# ToastManager Usage

`ToastManager` provides lightweight toast notifications and modal-like prompts.
Import it from `FrontEnd/JsLibs2/core/ToastManager.js`.

Note: The implementation relies on jQuery for DOM manipulation and assumes `$` is available globally.

```javascript
import { ToastManager, TOAST_TYPES } from '../JsLibs2/core/ToastManager.js';

const toaster = new ToastManager({ position: 'bottom-right' });

toaster.show('Saved!', TOAST_TYPES.SUCCESS);
```

## Methods

### `show(message, type, duration, allowHtml, buttons)`
Displays a toast. `type` should come from `TOAST_TYPES`. Optional `buttons` add actions and dismiss on click.

```javascript
toaster.show('Oops', TOAST_TYPES.ERROR, 5000);
```

### `confirm(options)`
Shows a confirmation toast with buttons and resolves with the clicked value.

```javascript
await toaster.confirm({
  message: 'Are you sure?',
  buttons: [{ text: 'Yes', value: true }, { text: 'No', value: false }]
});
```

### `prompt(fields, options)`
Prompts the user for input and resolves with the form data or `null` if cancelled.

### `showCritical(options)`
Blocks the screen with a draggable dialog. Ideal for serious errors.

## Accessibility
`confirm()`, `prompt()` and `showCritical()` display modal dialogs. Each toast
element has `role="dialog"` and `aria-modal="true"`. For `confirm()` and
`prompt()`, the toast receives an `aria-label` based on the provided message (or
a generic label if none is given). `showCritical()` references its header with
`aria-labelledby` so screen readers announce the title.

## Positions
Set `position` when creating the manager to control where the container appears.
Valid values are exported as `TOAST_POSITIONS`:

- `top-right` (default)
- `top-left`
- `bottom-right`
- `bottom-left`
- `center` – container centered on screen
- `blocker` – covers the viewport and centers its toasts

Passing any other value defaults to `top-right`.
