@wickermoney/ui-kit 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -2
- package/dist/Alert.d.ts +7 -1
- package/dist/Alert.d.ts.map +1 -1
- package/dist/Alert.js +7 -1
- package/dist/Alert.js.map +1 -1
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +4 -2
- package/dist/Dialog.js.map +1 -1
- package/dist/IconButton.d.ts +1 -1
- package/dist/IconButton.d.ts.map +1 -1
- package/dist/IconButton.js +1 -0
- package/dist/IconButton.js.map +1 -1
- package/dist/Table.d.ts +14 -2
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +7 -2
- package/dist/Table.js.map +1 -1
- package/dist/Toast.d.ts +39 -0
- package/dist/Toast.d.ts.map +1 -0
- package/dist/Toast.js +237 -0
- package/dist/Toast.js.map +1 -0
- package/dist/components.css +37 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/tokens.css +3 -0
- package/dist/useToast.d.ts +71 -0
- package/dist/useToast.d.ts.map +1 -0
- package/dist/useToast.js +22 -0
- package/dist/useToast.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,16 +50,17 @@ A federated remote's emitted stylesheet is never requested.
|
|
|
50
50
|
|---|---|
|
|
51
51
|
| `Surface` | Card/panel with an optional title and header action |
|
|
52
52
|
| `Button` | `variant`: `default`, `primary` or `danger` |
|
|
53
|
-
| `IconButton` | Square icon-only button for table rows. `icon` is one of `edit`, `delete`, `disable`, `enable`, `archive`, `history`, `end` or `
|
|
53
|
+
| `IconButton` | Square icon-only button for table rows. `icon` is one of `edit`, `delete`, `disable`, `enable`, `archive`, `history`, `end`, `balance` or `link`; `label` is required and is both the accessible name and the hover tooltip; `variant`: `default` or `danger`. Takes any other native `<button>` attribute |
|
|
54
54
|
| `Dialog` | Modal built on the native `<dialog>` (`showModal()`): a side drawer on a desktop window, a full-screen sheet on a phone. `title` is the heading and the accessible name; `describedBy` (optional) is the id of an element in the body that gives its accessible description; `onClose` is called on Escape, the close button or a click on the backdrop. The page behind is inert, Tab stays inside, the first input in the body gets focus, and focus returns to what opened it when it unmounts. Render it only while it is wanted |
|
|
55
55
|
| `Field`, `SelectField` | Labelled form inputs; optional `hint` and `error` (wires `aria-invalid` and `aria-describedby`) |
|
|
56
56
|
| `FormError` | A form-level error, shown beside the form's submit button |
|
|
57
|
-
| `Table` | Typed table: `columns`, `rows`, `rowKey`; `numeric` columns right-align. `empty` is rendered instead of the table when `rows` is empty; `className` adds a class to the table's scroller. Optional `caption` names the table: it is rendered as a visually hidden `<caption>` that a screen reader announces. Header cells carry `scope="col"`, and a column whose `header` is an empty string (a column of row buttons) gets a visually hidden "Actions" label in its header cell, so no header cell is empty |
|
|
57
|
+
| `Table` | Typed table: `columns`, `rows`, `rowKey`; `numeric` columns right-align. `empty` is rendered instead of the table when `rows` is empty; `className` adds a class to the table's scroller. Optional `caption` names the table: it is rendered as a visually hidden `<caption>` that a screen reader announces. Header cells carry `scope="col"`, and a column whose `header` is an empty string (a column of row buttons) gets a visually hidden "Actions" label in its header cell, so no header cell is empty. Optional `rowDetail(row)` adds a full-width detail row under a row (experimental, see [Table row detail](#table-row-detail)) |
|
|
58
58
|
| `Stat` | Label + value; `tone="auto"` colours by sign |
|
|
59
59
|
| `CategoryOptions`, `orderByParent` | Category `<option>` list grouped under parents |
|
|
60
60
|
| `Alert` | Inline error or notice (`role="alert"`) |
|
|
61
61
|
| `EmptyState` | Title, hint and an optional action for empty views |
|
|
62
62
|
| `Spinner` | Loading indicator |
|
|
63
|
+
| `ToastProvider`, `ToastViewport`, `useToast` | Notification toasts (experimental, see [Toasts](#toasts)) |
|
|
63
64
|
|
|
64
65
|
### Form errors
|
|
65
66
|
|
|
@@ -75,6 +76,91 @@ Every component's props type is exported alongside it (`SurfaceProps`,
|
|
|
75
76
|
`IconName`, `FieldCommon`, `GroupableCategory`, and the form-error types
|
|
76
77
|
`FormErrors`, `FormErrorState`, `FieldMatcher` and `ValidationIssue`.
|
|
77
78
|
|
|
79
|
+
### Table row detail
|
|
80
|
+
|
|
81
|
+
> **Stability: experimental.** `Table`'s `rowDetail` prop may change in any 0.x
|
|
82
|
+
> minor release, and it is **for the core app only until it has a second user**.
|
|
83
|
+
> Every other part of `Table` keeps the "Pre-1.0" rule above.
|
|
84
|
+
|
|
85
|
+
`rowDetail={(row) => node}` renders `node` in a full-width row directly under
|
|
86
|
+
`row`: `<tr class="wm-table__detail"><td colSpan>`. Return `null`, `undefined`
|
|
87
|
+
or `false` for no detail row. The row it belongs to gets the class
|
|
88
|
+
`wm-table__row--open` (its bottom border is hidden, so the two read as one). Use
|
|
89
|
+
it for something that belongs to one row but does not fit in its cells, such as
|
|
90
|
+
an inline picker. The content is yours: name it (`role="group"` and
|
|
91
|
+
`aria-label`), move focus into it when it opens and back to the control that
|
|
92
|
+
opened it when it closes. A page that restyles its table into cards on a phone
|
|
93
|
+
styles the detail row itself (`.wm-table__detail`); the cells in it carry no
|
|
94
|
+
`data-col`.
|
|
95
|
+
|
|
96
|
+
### Toasts
|
|
97
|
+
|
|
98
|
+
> **Stability: experimental.** `ToastProvider`, `ToastViewport`, `useToast` and
|
|
99
|
+
> their types may change in any 0.x minor release, and they are **for the core
|
|
100
|
+
> app only until a plugin path exists**. A plugin's copy of this package has no
|
|
101
|
+
> provider, so `useToast()` throws there with a message saying so; the plugin
|
|
102
|
+
> SDK has a reserved `notify` message but no host answers it yet. Every other export, apart from
|
|
103
|
+
> `Table`'s `rowDetail`, keeps the "Pre-1.0" rule above.
|
|
104
|
+
|
|
105
|
+
A toast reports the result of a discrete action ("Deleted 'Coffee'."). State
|
|
106
|
+
stays inline, and anything inside a modal stays inline too: a toast cannot be
|
|
107
|
+
reached while a modal is open.
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
import { ToastProvider, ToastViewport, useToast } from '@wickermoney/ui-kit'
|
|
111
|
+
|
|
112
|
+
// Once, above your routes. `routeKey` is optional: when it changes (pass the
|
|
113
|
+
// pathname) every toast but errors is cleared.
|
|
114
|
+
<ToastProvider routeKey={pathname}>
|
|
115
|
+
<main>
|
|
116
|
+
<ToastViewport /> {/* first child of the page container */}
|
|
117
|
+
<Routes>...</Routes>
|
|
118
|
+
</main>
|
|
119
|
+
</ToastProvider>
|
|
120
|
+
|
|
121
|
+
function DeleteButton() {
|
|
122
|
+
const toast = useToast()
|
|
123
|
+
return (
|
|
124
|
+
<button type="button" onClick={() => {
|
|
125
|
+
closeDialog() // close any dialog first
|
|
126
|
+
toast.show('Deleted Coffee (-$4.50).', { kind: 'success', key: 'txn:delete' })
|
|
127
|
+
}}>Delete</button>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
| Member | Description |
|
|
133
|
+
|---|---|
|
|
134
|
+
| `useToast()` | Returns `{ show, dismiss }`, stable for the life of the provider. Throws outside a `ToastProvider` |
|
|
135
|
+
| `show(message, { kind?, key? })` | Returns an id. `message` is a plain string (keep it under 200 characters). `kind` is `success`, `info` (default), `warning` or `error`. A toast with the same `key` replaces the earlier one in place and is announced again; the id is the same |
|
|
136
|
+
| `dismiss(id)` | Removes a visible, waiting or not yet delivered toast |
|
|
137
|
+
| `ToastProvider` | Props: `children`, `routeKey?`. Owns the queue and the screen-reader announcer |
|
|
138
|
+
| `ToastViewport` | No props. Draws the stack; renders nothing when empty or outside a provider |
|
|
139
|
+
|
|
140
|
+
How it behaves:
|
|
141
|
+
|
|
142
|
+
- **Nothing dismisses itself.** There is no duration, no timer and no pause on
|
|
143
|
+
hover: a toast stays until its Close button or Escape (with the toast focused)
|
|
144
|
+
closes it, or the same `key` replaces it. Focus returns to where it was.
|
|
145
|
+
- **Announcements.** One always-mounted, visually hidden `role="status"`
|
|
146
|
+
(`aria-live="polite"`, `aria-atomic="true"`) region speaks each toast once;
|
|
147
|
+
warnings and errors are prefixed "Warning: " and "Error: ". Calls in one
|
|
148
|
+
animation frame are announced together. The visible stack is not a live
|
|
149
|
+
region. `show()` never moves focus.
|
|
150
|
+
- **Limits.** Three toasts show (two at 560px and below); the rest wait and
|
|
151
|
+
appear as slots free, and an error goes ahead of the queue. "Dismiss all"
|
|
152
|
+
appears from two toasts and closes the ones showing.
|
|
153
|
+
- **While a modal is open** (`<dialog>` shown modally, or `aria-modal="true"`)
|
|
154
|
+
delivery is held for up to two seconds. Close the dialog first, then call
|
|
155
|
+
`show()`.
|
|
156
|
+
- **Placement.** The viewport is an in-flow banner that sticks at
|
|
157
|
+
`top: var(--wm-toast-offset-top, 0px)`; set that custom property to the bottom
|
|
158
|
+
edge of anything fixed to the top of the window (the app shell does this for
|
|
159
|
+
its phone bar). It pushes the page down rather than covering it. The fade is
|
|
160
|
+
150 ms of opacity and is off under `prefers-reduced-motion`.
|
|
161
|
+
- **Tokens.** `--wm-shadow-raised` (light and dark) is new; the rest are existing
|
|
162
|
+
surface, border, text, accent and status colours.
|
|
163
|
+
|
|
78
164
|
### Focus trap
|
|
79
165
|
|
|
80
166
|
`useFocusTrap(ref, active, options?)` keeps Tab and Shift+Tab inside the element
|
package/dist/Alert.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ export interface AlertProps {
|
|
|
4
4
|
/** The message to show. */
|
|
5
5
|
readonly children: ReactNode;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* A message banner with `role="alert"`, for a state that stays true until it is
|
|
9
|
+
* fixed: a page or section that failed to load, a plugin that failed to start.
|
|
10
|
+
* It is not for the result of an action (a save, a delete): raise a toast with
|
|
11
|
+
* `useToast` for that, and put a refusal that belongs to a field or form on
|
|
12
|
+
* the field or in `FormError` (ADR 0009).
|
|
13
|
+
*/
|
|
8
14
|
export declare function Alert({ children }: AlertProps): import("react").JSX.Element;
|
|
9
15
|
//# sourceMappingURL=Alert.d.ts.map
|
package/dist/Alert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../src/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,+BAA+B;AAC/B,MAAM,WAAW,UAAU;IACzB,2BAA2B;IAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAC7B;AAED
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../src/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,+BAA+B;AAC/B,MAAM,WAAW,UAAU;IACzB,2BAA2B;IAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,EAAE,UAAU,+BAE7C"}
|
package/dist/Alert.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* A message banner with `role="alert"`, for a state that stays true until it is
|
|
4
|
+
* fixed: a page or section that failed to load, a plugin that failed to start.
|
|
5
|
+
* It is not for the result of an action (a save, a delete): raise a toast with
|
|
6
|
+
* `useToast` for that, and put a refusal that belongs to a field or form on
|
|
7
|
+
* the field or in `FormError` (ADR 0009).
|
|
8
|
+
*/
|
|
3
9
|
export function Alert({ children }) {
|
|
4
10
|
return _jsx("div", { className: "wm-alert", role: "alert", children: children });
|
|
5
11
|
}
|
package/dist/Alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../src/Alert.tsx"],"names":[],"mappings":";AAQA
|
|
1
|
+
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../src/Alert.tsx"],"names":[],"mappings":";AAQA;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,EAAE,QAAQ,EAAc;IAC5C,OAAO,cAAK,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,OAAO,YAAE,QAAQ,GAAO,CAAA;AAChE,CAAC"}
|
package/dist/Dialog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../src/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEhE,gCAAgC;AAChC,MAAM,WAAW,WAAW;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,iGAAiG;IACjG,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;IAC5B,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAC9B;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,WAAW,+
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../src/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEhE,gCAAgC;AAChC,MAAM,WAAW,WAAW;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,iGAAiG;IACjG,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;IAC5B,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAC9B;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,WAAW,+BAyC5E"}
|
package/dist/Dialog.js
CHANGED
|
@@ -24,8 +24,10 @@ export function Dialog({ title, describedBy, onClose, children }) {
|
|
|
24
24
|
dialog.showModal();
|
|
25
25
|
else
|
|
26
26
|
dialog.setAttribute('open', '');
|
|
27
|
-
// showModal() would focus the close button; a form wants its first field.
|
|
28
|
-
|
|
27
|
+
// showModal() would focus the close button; a form wants its first field. preventScroll: the dialog is
|
|
28
|
+
// fixed to the window, so there is nothing to scroll to, and in a plugin's page frame (as tall as its
|
|
29
|
+
// content, inside a scrolling window) the scroll would throw the person to the top of the frame.
|
|
30
|
+
dialog.querySelector('.wm-dialog__body :is(input, select, textarea)')?.focus({ preventScroll: true });
|
|
29
31
|
}
|
|
30
32
|
return () => { opener?.focus(); };
|
|
31
33
|
}, []);
|
package/dist/Dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../src/Dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAA;AAkBhE;;;;;;;;GAQG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAe;IAC3E,MAAM,GAAG,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAA;IAC3C,MAAM,OAAO,GAAG,KAAK,EAAE,CAAA;IACvB,6EAA6E;IAC7E,6EAA6E;IAC7E,6CAA6C;IAC7C,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAErC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAA;QAC1B,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,YAAY,WAAW,CAAC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,aAAa,CAAc,+CAA+C,CAAC,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;QACpH,CAAC;QACD,OAAO,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,CAAA,CAAC,CAAC,CAAA;IAClC,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CACL,kBACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAC,WAAW,qBACJ,OAAO,sBACN,WAAW,EAC7B,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,eAAe,CAAC,OAAO,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,aAAa,CAAA,CAAC,CAAC,EAC9E,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,IAAI,eAAe,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,aAAa;YAAE,OAAO,EAAE,CAAA,CAAC,CAAC,aAE1F,eAAK,SAAS,EAAC,mBAAmB,aAChC,aAAI,SAAS,EAAC,kBAAkB,EAAC,EAAE,EAAE,OAAO,YAAG,KAAK,GAAM,EAC1D,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,yBAAyB,gBAAY,OAAO,EAAC,OAAO,EAAE,OAAO,uBAEpF,IACL,EACN,cAAK,SAAS,EAAC,iBAAiB,YAAE,QAAQ,GAAO,IAC1C,CACV,CAAA;AACH,CAAC"}
|
package/dist/IconButton.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ButtonHTMLAttributes } from 'react';
|
|
2
2
|
/** The icons an {@link IconButton} can draw. */
|
|
3
|
-
export type IconName = 'edit' | 'delete' | 'disable' | 'enable' | 'archive' | 'history' | 'end' | 'balance';
|
|
3
|
+
export type IconName = 'edit' | 'delete' | 'disable' | 'enable' | 'archive' | 'history' | 'end' | 'balance' | 'link';
|
|
4
4
|
/** Props for {@link IconButton}: every native `<button>` attribute except its content. */
|
|
5
5
|
export interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'title' | 'aria-label'> {
|
|
6
6
|
/** Which icon to draw. */
|
package/dist/IconButton.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../src/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAa,MAAM,OAAO,CAAA;AAE5D,gDAAgD;AAChD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../src/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAa,MAAM,OAAO,CAAA;AAE5D,gDAAgD;AAChD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAAA;AA0EpH,0FAA0F;AAC1F,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,YAAY,CAAC;IAC1F,0BAA0B;IAC1B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,gDAAgD;IAChD,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;CACxC;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAmB,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,eAAe,+BAcnG"}
|
package/dist/IconButton.js
CHANGED
|
@@ -8,6 +8,7 @@ const ICONS = {
|
|
|
8
8
|
history: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), _jsx("path", { d: "M3 3v5h5" }), _jsx("path", { d: "M12 7v5l4 2" })] })),
|
|
9
9
|
end: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M8 2v4" }), _jsx("path", { d: "M16 2v4" }), _jsx("rect", { width: "18", height: "18", x: "3", y: "4", rx: "2" }), _jsx("path", { d: "M3 10h18" }), _jsx("path", { d: "m14 14-4 4" }), _jsx("path", { d: "m10 14 4 4" })] })),
|
|
10
10
|
balance: (_jsxs(_Fragment, { children: [_jsx("path", { d: "m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z" }), _jsx("path", { d: "m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z" }), _jsx("path", { d: "M7 21h10" }), _jsx("path", { d: "M12 3v18" }), _jsx("path", { d: "M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2" })] })),
|
|
11
|
+
link: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }), _jsx("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })] })),
|
|
11
12
|
disable: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M9.88 9.88a3 3 0 1 0 4.24 4.24" }), _jsx("path", { d: "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" }), _jsx("path", { d: "M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" }), _jsx("path", { d: "M2 2l20 20" })] })),
|
|
12
13
|
};
|
|
13
14
|
/**
|
package/dist/IconButton.js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,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAC5E,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,iBAAa,MAAM,EAAC,SAAS,EAAC,OAAO,YAEhG,KAAK,CAAC,IAAI,CAAC,GACR,GACC,CACV,CAAA;AACH,CAAC"}
|
package/dist/Table.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
/** Describes one column of a {@link Table}. */
|
|
3
3
|
export interface Column<T> {
|
|
4
4
|
/** Stable identifier for the column. */
|
|
@@ -36,6 +36,18 @@ export interface TableProps<T> {
|
|
|
36
36
|
* heading above it does not say what the rows are.
|
|
37
37
|
*/
|
|
38
38
|
readonly caption?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Experimental (see the ui-kit README): may change in any 0.x minor release.
|
|
41
|
+
* Returns what to show in a full-width detail row directly under `row`, or
|
|
42
|
+
* `null`, `undefined` or `false` for none. The detail row is
|
|
43
|
+
* `<tr class="wm-table__detail"><td colSpan>` (one cell as wide as the table),
|
|
44
|
+
* and the row it belongs to gets the class `wm-table__row--open`, so that CSS
|
|
45
|
+
* can join the two. It is for what belongs to one row but does not fit in its
|
|
46
|
+
* cells, such as an inline picker. The content is the caller's: move focus into
|
|
47
|
+
* it when it opens and give it an accessible name. Not announced as a table
|
|
48
|
+
* row of its own beyond what the content says.
|
|
49
|
+
*/
|
|
50
|
+
readonly rowDetail?: (row: T) => ReactNode;
|
|
39
51
|
}
|
|
40
52
|
/**
|
|
41
53
|
* A data table.
|
|
@@ -48,5 +60,5 @@ export interface TableProps<T> {
|
|
|
48
60
|
* phone card layouts do not print it. The scroller is `position: relative` so
|
|
49
61
|
* that the label is clipped with the table instead of widening the page.
|
|
50
62
|
*/
|
|
51
|
-
export declare function Table<T>({ columns, rows, rowKey, empty, className, caption }: TableProps<T>): import("react").JSX.Element;
|
|
63
|
+
export declare function Table<T>({ columns, rows, rowKey, empty, className, caption, rowDetail }: TableProps<T>): import("react").JSX.Element;
|
|
52
64
|
//# sourceMappingURL=Table.d.ts.map
|
package/dist/Table.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../src/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../src/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEhD,+CAA+C;AAC/C,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,wCAAwC;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;IAC1B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,oCAAoC;IACpC,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,SAAS,CAAA;CACvC;AAED,+BAA+B;AAC/B,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;IACtC,+BAA+B;IAC/B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,CAAA;IAC3B,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAA;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,SAAS,CAAA;CAC3C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,+BA6CtG"}
|
package/dist/Table.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
2
3
|
/**
|
|
3
4
|
* A data table.
|
|
4
5
|
*
|
|
@@ -10,9 +11,13 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
10
11
|
* phone card layouts do not print it. The scroller is `position: relative` so
|
|
11
12
|
* that the label is clipped with the table instead of widening the page.
|
|
12
13
|
*/
|
|
13
|
-
export function Table({ columns, rows, rowKey, empty, className, caption }) {
|
|
14
|
+
export function Table({ columns, rows, rowKey, empty, className, caption, rowDetail }) {
|
|
14
15
|
if (rows.length === 0 && empty !== undefined)
|
|
15
16
|
return _jsx(_Fragment, { children: empty });
|
|
16
|
-
return (_jsx("div", { className: className === undefined ? 'wm-table__scroll' : `wm-table__scroll ${className}`, children: _jsxs("table", { className: "wm-table", children: [caption === undefined ? null : _jsx("caption", { className: "wm-visually-hidden", children: caption }), _jsx("thead", { children: _jsx("tr", { children: columns.map((c) => (_jsx("th", { scope: "col", "data-col": c.key, className: c.numeric === true ? 'wm-num' : undefined, children: c.header === '' ? _jsx("span", { className: "wm-visually-hidden", children: "Actions" }) : c.header }, c.key))) }) }), _jsx("tbody", { children: rows.map((row) =>
|
|
17
|
+
return (_jsx("div", { className: className === undefined ? 'wm-table__scroll' : `wm-table__scroll ${className}`, children: _jsxs("table", { className: "wm-table", children: [caption === undefined ? null : _jsx("caption", { className: "wm-visually-hidden", children: caption }), _jsx("thead", { children: _jsx("tr", { children: columns.map((c) => (_jsx("th", { scope: "col", "data-col": c.key, className: c.numeric === true ? 'wm-num' : undefined, children: c.header === '' ? _jsx("span", { className: "wm-visually-hidden", children: "Actions" }) : c.header }, c.key))) }) }), _jsx("tbody", { children: rows.map((row) => {
|
|
18
|
+
const detail = rowDetail?.(row);
|
|
19
|
+
const open = detail !== undefined && detail !== null && detail !== false;
|
|
20
|
+
return (_jsxs(Fragment, { children: [_jsx("tr", { className: open ? 'wm-table__row--open' : undefined, children: columns.map((c) => (_jsx("td", { "data-col": c.key, "data-label": typeof c.header === 'string' && c.header !== '' ? c.header : undefined, className: c.numeric === true ? 'wm-num' : undefined, children: c.render(row) }, c.key))) }), open ? (_jsx("tr", { className: "wm-table__detail", children: _jsx("td", { colSpan: columns.length, children: detail }) })) : null] }, rowKey(row)));
|
|
21
|
+
}) })] }) }));
|
|
17
22
|
}
|
|
18
23
|
//# sourceMappingURL=Table.js.map
|
package/dist/Table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../src/Table.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../src/Table.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAsDhD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,KAAK,CAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAiB;IACrG,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,4BAAG,KAAK,GAAI,CAAA;IACjE,OAAO,CACL,cAAK,SAAS,EAAE,SAA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I,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,YAEnD,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IALT,CAAC,CAAC,GAAG,CAMP,CACN,CAAC,GACC,EACJ,IAAI,CAAC,CAAC,CAAC,CACN,aAAI,SAAS,EAAC,kBAAkB,YAC9B,aAAI,OAAO,EAAE,OAAO,CAAC,MAAM,YAAG,MAAM,GAAM,GACvC,CACN,CAAC,CAAC,CAAC,IAAI,KAjBK,MAAM,CAAC,GAAG,CAAC,CAkBf,CACZ,CAAA;oBACH,CAAC,CAAC,GACI,IACF,GACJ,CACP,CAAA;AACH,CAAC"}
|
package/dist/Toast.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/** Props for {@link ToastProvider}. */
|
|
3
|
+
export interface ToastProviderProps {
|
|
4
|
+
readonly children: ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* When this value changes (pass the current route), every toast that is not
|
|
7
|
+
* an `error` is cleared: a confirmation from the page the person left is stale.
|
|
8
|
+
*/
|
|
9
|
+
readonly routeKey?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Owns the toast queue and the screen-reader announcer. Mount it once, above
|
|
13
|
+
* the routes, and place a {@link ToastViewport} where the stack should draw.
|
|
14
|
+
*
|
|
15
|
+
* - The announcer is one always-mounted, visually hidden `role="status"`
|
|
16
|
+
* region, separate from the visible stack. Nothing here moves focus.
|
|
17
|
+
* - Nothing dismisses itself. A toast stays until it is closed (its button,
|
|
18
|
+
* or Escape) or the same `key` replaces it.
|
|
19
|
+
* - A burst of `show()` calls in one animation frame is announced once.
|
|
20
|
+
* - While a modal is open (`dialog:modal` or `aria-modal="true"`) delivery is
|
|
21
|
+
* held, up to two seconds. Close the dialog first, then call `show()`.
|
|
22
|
+
*
|
|
23
|
+
* @experimental May change in any 0.x release; for the core app only until the plugin path ships.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ToastProvider({ children, routeKey }: ToastProviderProps): import("react").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Draws the toasts as an in-flow banner that sticks to the top of the page
|
|
28
|
+
* while it scrolls. Place it as the first child of `<main>`.
|
|
29
|
+
*
|
|
30
|
+
* It sticks at `top: var(--wm-toast-offset-top, 0px)`; set that custom
|
|
31
|
+
* property (on `<main>` or any ancestor) to the bottom edge of anything fixed
|
|
32
|
+
* to the top of the viewport. It takes no props, is not a live region (the
|
|
33
|
+
* provider's announcer speaks), holds no tab stop when empty, and renders
|
|
34
|
+
* nothing outside a {@link ToastProvider}.
|
|
35
|
+
*
|
|
36
|
+
* @experimental May change in any 0.x release; for the core app only until the plugin path ships.
|
|
37
|
+
*/
|
|
38
|
+
export declare function ToastViewport(): import("react").JSX.Element | null;
|
|
39
|
+
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../src/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEe,KAAK,SAAS,EACnC,MAAM,OAAO,CAAA;AAMd,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;IAC5B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAC3B;AA+CD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,kBAAkB,+BAqIvE;AA2BD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,uCAsB5B"}
|
package/dist/Toast.js
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useContext, useEffect, useId, useMemo, useRef, useState, useSyncExternalStore, } from 'react';
|
|
3
|
+
import { ToastApiContext, ToastViewContext, } from './useToast.js';
|
|
4
|
+
/** Three toasts on screen, two on a phone. Nothing is evicted: the rest wait. */
|
|
5
|
+
const LIMIT_DESKTOP = 3;
|
|
6
|
+
const LIMIT_PHONE = 2;
|
|
7
|
+
const PHONE_QUERY = '(max-width: 560px)';
|
|
8
|
+
/** The announcer is emptied this long after it is filled, so it is not read twice in browse mode. */
|
|
9
|
+
const ANNOUNCER_CLEAR_MS = 1500;
|
|
10
|
+
/** A toast raised while a modal is open waits at most this long for the modal to close. */
|
|
11
|
+
const MODAL_HOLD_MS = 2000;
|
|
12
|
+
const ADVISED_LENGTH = 200;
|
|
13
|
+
function subscribePhone(onChange) {
|
|
14
|
+
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
|
|
15
|
+
return () => undefined;
|
|
16
|
+
const query = window.matchMedia(PHONE_QUERY);
|
|
17
|
+
query.addEventListener('change', onChange);
|
|
18
|
+
return () => { query.removeEventListener('change', onChange); };
|
|
19
|
+
}
|
|
20
|
+
const phoneLimit = () => (typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(PHONE_QUERY).matches
|
|
21
|
+
? LIMIT_PHONE : LIMIT_DESKTOP);
|
|
22
|
+
function modalIsOpen() {
|
|
23
|
+
if (document.querySelector('[aria-modal="true"]') !== null)
|
|
24
|
+
return true;
|
|
25
|
+
try {
|
|
26
|
+
return document.querySelector('dialog:modal') !== null;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const announcedText = (t) => (t.kind === 'error' ? `Error: ${t.message}` : t.kind === 'warning' ? `Warning: ${t.message}` : t.message);
|
|
33
|
+
/** Adds delivered toasts to the list: the same id replaces in place, an error goes ahead of the waiting queue. */
|
|
34
|
+
function merge(list, batch, limit) {
|
|
35
|
+
const next = [...list];
|
|
36
|
+
for (const item of batch) {
|
|
37
|
+
const at = next.findIndex((t) => t.id === item.id);
|
|
38
|
+
if (at >= 0) {
|
|
39
|
+
next[at] = { ...item, rev: next[at].rev + 1 };
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (item.kind === 'error' && next.length >= limit) {
|
|
43
|
+
let i = limit;
|
|
44
|
+
while (next[i]?.kind === 'error')
|
|
45
|
+
i += 1;
|
|
46
|
+
next.splice(i, 0, item);
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
next.push(item);
|
|
50
|
+
}
|
|
51
|
+
return next;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Owns the toast queue and the screen-reader announcer. Mount it once, above
|
|
55
|
+
* the routes, and place a {@link ToastViewport} where the stack should draw.
|
|
56
|
+
*
|
|
57
|
+
* - The announcer is one always-mounted, visually hidden `role="status"`
|
|
58
|
+
* region, separate from the visible stack. Nothing here moves focus.
|
|
59
|
+
* - Nothing dismisses itself. A toast stays until it is closed (its button,
|
|
60
|
+
* or Escape) or the same `key` replaces it.
|
|
61
|
+
* - A burst of `show()` calls in one animation frame is announced once.
|
|
62
|
+
* - While a modal is open (`dialog:modal` or `aria-modal="true"`) delivery is
|
|
63
|
+
* held, up to two seconds. Close the dialog first, then call `show()`.
|
|
64
|
+
*
|
|
65
|
+
* @experimental May change in any 0.x release; for the core app only until the plugin path ships.
|
|
66
|
+
*/
|
|
67
|
+
export function ToastProvider({ children, routeKey }) {
|
|
68
|
+
const [list, setList] = useState([]);
|
|
69
|
+
const limit = useSyncExternalStore(subscribePhone, phoneLimit, () => LIMIT_DESKTOP);
|
|
70
|
+
const limitRef = useRef(limit);
|
|
71
|
+
limitRef.current = limit;
|
|
72
|
+
const pending = useRef([]);
|
|
73
|
+
const frame = useRef(null);
|
|
74
|
+
const heldSince = useRef(null);
|
|
75
|
+
const alive = useRef(false);
|
|
76
|
+
const counter = useRef(0);
|
|
77
|
+
const announcer = useRef(null);
|
|
78
|
+
const clearTimer = useRef(null);
|
|
79
|
+
const announced = useRef(new Set());
|
|
80
|
+
const originRef = useRef(null);
|
|
81
|
+
const groupRef = useRef(null);
|
|
82
|
+
const listRef = useRef(list);
|
|
83
|
+
listRef.current = list;
|
|
84
|
+
// A new route clears everything but errors. Adjusting state while rendering is
|
|
85
|
+
// the documented way to react to a changed prop without an extra commit.
|
|
86
|
+
const [lastRouteKey, setLastRouteKey] = useState(routeKey);
|
|
87
|
+
if (routeKey !== lastRouteKey) {
|
|
88
|
+
setLastRouteKey(routeKey);
|
|
89
|
+
if (list.some((t) => t.kind !== 'error'))
|
|
90
|
+
setList(list.filter((t) => t.kind === 'error'));
|
|
91
|
+
}
|
|
92
|
+
const announce = useCallback((text) => {
|
|
93
|
+
const el = announcer.current;
|
|
94
|
+
if (el === null)
|
|
95
|
+
return;
|
|
96
|
+
// A fresh node each time, so identical text twice is announced twice.
|
|
97
|
+
const span = document.createElement('span');
|
|
98
|
+
span.textContent = text;
|
|
99
|
+
el.replaceChildren(span);
|
|
100
|
+
if (clearTimer.current !== null)
|
|
101
|
+
clearTimeout(clearTimer.current);
|
|
102
|
+
clearTimer.current = setTimeout(() => { clearTimer.current = null; el.replaceChildren(); }, ANNOUNCER_CLEAR_MS);
|
|
103
|
+
}, []);
|
|
104
|
+
const tick = useCallback(() => {
|
|
105
|
+
frame.current = null;
|
|
106
|
+
if (!alive.current || pending.current.length === 0) {
|
|
107
|
+
heldSince.current = null;
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (modalIsOpen()) {
|
|
111
|
+
heldSince.current ??= Date.now();
|
|
112
|
+
if (Date.now() - heldSince.current < MODAL_HOLD_MS) {
|
|
113
|
+
frame.current = requestAnimationFrame(tick);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
heldSince.current = null;
|
|
118
|
+
const batch = pending.current;
|
|
119
|
+
pending.current = [];
|
|
120
|
+
setList((prev) => merge(prev, batch, limitRef.current));
|
|
121
|
+
}, []);
|
|
122
|
+
const schedule = useCallback(() => {
|
|
123
|
+
if (alive.current && frame.current === null)
|
|
124
|
+
frame.current = requestAnimationFrame(tick);
|
|
125
|
+
}, [tick]);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
alive.current = true;
|
|
128
|
+
if (pending.current.length > 0)
|
|
129
|
+
schedule();
|
|
130
|
+
return () => {
|
|
131
|
+
alive.current = false;
|
|
132
|
+
if (frame.current !== null) {
|
|
133
|
+
cancelAnimationFrame(frame.current);
|
|
134
|
+
frame.current = null;
|
|
135
|
+
}
|
|
136
|
+
if (clearTimer.current !== null) {
|
|
137
|
+
clearTimeout(clearTimer.current);
|
|
138
|
+
clearTimer.current = null;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}, [schedule]);
|
|
142
|
+
// Announce what has just become visible: a new toast, a replaced one, or one
|
|
143
|
+
// promoted from the queue. One update covers everything that appeared together.
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
const fresh = [];
|
|
146
|
+
const keep = new Set();
|
|
147
|
+
list.forEach((t, i) => {
|
|
148
|
+
const token = `${t.id}:${t.rev}`;
|
|
149
|
+
if (i >= limit)
|
|
150
|
+
return;
|
|
151
|
+
keep.add(token);
|
|
152
|
+
if (!announced.current.has(token))
|
|
153
|
+
fresh.push(t);
|
|
154
|
+
});
|
|
155
|
+
announced.current = keep;
|
|
156
|
+
if (fresh.length > 0)
|
|
157
|
+
announce(fresh.map(announcedText).join('. '));
|
|
158
|
+
}, [list, limit, announce]);
|
|
159
|
+
const removeIds = useCallback((ids) => {
|
|
160
|
+
// If focus is on a toast that is going away, give it back before it does.
|
|
161
|
+
const active = document.activeElement;
|
|
162
|
+
const holder = active instanceof Element ? active.closest('[data-toast-id]') : null;
|
|
163
|
+
if (holder !== null && groupRef.current?.contains(holder) === true && ids.includes(holder.dataset['toastId'] ?? '')) {
|
|
164
|
+
const origin = originRef.current;
|
|
165
|
+
const target = origin !== null && origin.isConnected && !groupRef.current.contains(origin)
|
|
166
|
+
? origin : document.querySelector('main');
|
|
167
|
+
target?.focus({ preventScroll: true });
|
|
168
|
+
}
|
|
169
|
+
pending.current = pending.current.filter((t) => !ids.includes(t.id));
|
|
170
|
+
setList((prev) => (prev.some((t) => ids.includes(t.id)) ? prev.filter((t) => !ids.includes(t.id)) : prev));
|
|
171
|
+
}, []);
|
|
172
|
+
const api = useMemo(() => ({
|
|
173
|
+
show(message, options) {
|
|
174
|
+
const kind = options?.kind ?? 'info';
|
|
175
|
+
const key = options?.key;
|
|
176
|
+
counter.current += 1;
|
|
177
|
+
const id = key !== undefined ? `key:${key}` : `toast:${counter.current}`;
|
|
178
|
+
if (message.length > ADVISED_LENGTH) {
|
|
179
|
+
const env = globalThis.process?.env;
|
|
180
|
+
if (env?.['NODE_ENV'] !== 'production') {
|
|
181
|
+
console.warn(`useToast().show: a message of ${message.length} characters is long; keep toasts under ${ADVISED_LENGTH}.`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const item = { id, message, kind, rev: 0 };
|
|
185
|
+
const at = pending.current.findIndex((t) => t.id === id);
|
|
186
|
+
if (at >= 0)
|
|
187
|
+
pending.current[at] = item;
|
|
188
|
+
else
|
|
189
|
+
pending.current.push(item);
|
|
190
|
+
schedule();
|
|
191
|
+
return id;
|
|
192
|
+
},
|
|
193
|
+
dismiss(id) { removeIds([id]); },
|
|
194
|
+
}), [schedule, removeIds]);
|
|
195
|
+
const visible = useMemo(() => list.slice(0, limit).reverse(), [list, limit]);
|
|
196
|
+
const view = useMemo(() => ({ visible, dismissMany: removeIds, originRef, groupRef }), [visible, removeIds]);
|
|
197
|
+
return (_jsx(ToastApiContext.Provider, { value: api, children: _jsxs(ToastViewContext.Provider, { value: view, children: [children, _jsx("div", { ref: announcer, className: "wm-visually-hidden", role: "status", "aria-live": "polite", "aria-atomic": "true" })] }) }));
|
|
198
|
+
}
|
|
199
|
+
const GLYPH = { success: '✓', info: 'i', warning: '!', error: '✕' };
|
|
200
|
+
const WORD = { success: '', info: '', warning: 'Warning: ', error: 'Error: ' };
|
|
201
|
+
function ToastCard({ item, onDismiss }) {
|
|
202
|
+
const textId = useId();
|
|
203
|
+
const onKeyDown = (e) => {
|
|
204
|
+
if (e.key !== 'Escape')
|
|
205
|
+
return;
|
|
206
|
+
e.preventDefault();
|
|
207
|
+
onDismiss(item.id);
|
|
208
|
+
};
|
|
209
|
+
return (_jsxs("div", { className: `wm-toast wm-toast--${item.kind}`, "data-toast-id": item.id, onKeyDown: onKeyDown, children: [_jsx("span", { className: "wm-toast__icon", "aria-hidden": "true", children: GLYPH[item.kind] }), _jsxs("p", { className: "wm-toast__text", id: textId, children: [WORD[item.kind] === '' ? null : _jsx("span", { className: "wm-visually-hidden", children: WORD[item.kind] }), item.message] }), _jsx("button", { type: "button", className: "wm-btn wm-toast__close", "aria-label": "Dismiss notification", "aria-describedby": textId, onClick: () => { onDismiss(item.id); }, children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) })] }));
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Draws the toasts as an in-flow banner that sticks to the top of the page
|
|
213
|
+
* while it scrolls. Place it as the first child of `<main>`.
|
|
214
|
+
*
|
|
215
|
+
* It sticks at `top: var(--wm-toast-offset-top, 0px)`; set that custom
|
|
216
|
+
* property (on `<main>` or any ancestor) to the bottom edge of anything fixed
|
|
217
|
+
* to the top of the viewport. It takes no props, is not a live region (the
|
|
218
|
+
* provider's announcer speaks), holds no tab stop when empty, and renders
|
|
219
|
+
* nothing outside a {@link ToastProvider}.
|
|
220
|
+
*
|
|
221
|
+
* @experimental May change in any 0.x release; for the core app only until the plugin path ships.
|
|
222
|
+
*/
|
|
223
|
+
export function ToastViewport() {
|
|
224
|
+
const view = useContext(ToastViewContext);
|
|
225
|
+
if (view === null || view.visible.length === 0)
|
|
226
|
+
return null;
|
|
227
|
+
const { visible, dismissMany, originRef, groupRef } = view;
|
|
228
|
+
return (_jsxs("div", { ref: groupRef, className: "wm-toast-viewport", role: "group", "aria-label": "Notifications", onFocus: (e) => {
|
|
229
|
+
// Remember where focus came from, so closing a focused toast can return it.
|
|
230
|
+
const from = e.relatedTarget;
|
|
231
|
+
if (from instanceof HTMLElement && !e.currentTarget.contains(from))
|
|
232
|
+
originRef.current = from;
|
|
233
|
+
else if (!(from instanceof HTMLElement))
|
|
234
|
+
originRef.current = null;
|
|
235
|
+
}, children: [visible.map((t) => _jsx(ToastCard, { item: t, onDismiss: (id) => { dismissMany([id]); } }, t.id)), visible.length >= 2 ? (_jsx("div", { className: "wm-toast-viewport__all", children: _jsx("button", { type: "button", className: "wm-btn", onClick: () => { dismissMany(visible.map((t) => t.id)); }, children: "Dismiss all" }) })) : null] }));
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../src/Toast.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,GAE3F,MAAM,OAAO,CAAA;AACd,OAAO,EACL,eAAe,EAAE,gBAAgB,GAElC,MAAM,eAAe,CAAA;AAYtB,iFAAiF;AACjF,MAAM,aAAa,GAAG,CAAC,CAAA;AACvB,MAAM,WAAW,GAAG,CAAC,CAAA;AACrB,MAAM,WAAW,GAAG,oBAAoB,CAAA;AACxC,qGAAqG;AACrG,MAAM,kBAAkB,GAAG,IAAI,CAAA;AAC/B,2FAA2F;AAC3F,MAAM,aAAa,GAAG,IAAI,CAAA;AAC1B,MAAM,cAAc,GAAG,GAAG,CAAA;AAE1B,SAAS,cAAc,CAAC,QAAoB;IAC1C,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU;QAAE,OAAO,GAAG,EAAE,CAAC,SAAS,CAAA;IACpG,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;IAC5C,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,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: var(--wm-accent); color: var(--wm-accent-text);
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
/* Must restate the background: `.wm-btn:hover:not(:disabled)` above has three classes' worth of
|
|
29
|
+
specificity to the variant's one, so without it a hovered primary button turns light grey under
|
|
30
|
+
its light text. Same specificity as that rule and later, so this one wins. */
|
|
31
|
+
.wm-btn--primary:hover:not(:disabled) { background: var(--wm-accent); filter: brightness(1.08); }
|
|
29
32
|
.wm-btn--danger { color: var(--wm-negative); }
|
|
30
33
|
/* Icon-only buttons: square and fixed, so a column of them lines up whatever the row holds. */
|
|
31
34
|
.wm-icon-btn, .wm-icon-slot { flex: none; width: 32px; height: 32px; padding: 0; }
|
|
@@ -58,6 +61,7 @@
|
|
|
58
61
|
.wm-table th, .wm-table td {
|
|
59
62
|
text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--wm-border);
|
|
60
63
|
}
|
|
64
|
+
.wm-table__row--open > td { border-bottom-color: transparent; }
|
|
61
65
|
.wm-table th { font-size: 12px; color: var(--wm-text-muted); font-weight: 600; }
|
|
62
66
|
.wm-table td.wm-num, .wm-table th.wm-num { text-align: right; font-family: var(--wm-mono); }
|
|
63
67
|
/* Positioned so that the visually hidden "Actions" header label (position:
|
|
@@ -123,3 +127,35 @@ body:has(.wm-dialog[open]) { overflow: hidden; }
|
|
|
123
127
|
@media (max-width: 560px) {
|
|
124
128
|
.wm-dialog { width: 100vw; border-left: 0; }
|
|
125
129
|
}
|
|
130
|
+
|
|
131
|
+
/* Toast: an in-flow banner that sticks under whatever is fixed to the top.
|
|
132
|
+
The shell sets --wm-toast-offset-top to the bottom edge of the phone bar. */
|
|
133
|
+
.wm-toast-viewport {
|
|
134
|
+
position: sticky; top: var(--wm-toast-offset-top, 0px); z-index: 15;
|
|
135
|
+
display: flex; flex-direction: column; gap: var(--wm-gap-sm); margin-bottom: 12px;
|
|
136
|
+
}
|
|
137
|
+
.wm-toast {
|
|
138
|
+
--wm-toast-kind: var(--wm-accent);
|
|
139
|
+
display: flex; align-items: flex-start; gap: 10px;
|
|
140
|
+
padding: 10px 6px 10px 12px; font-size: 13px;
|
|
141
|
+
background: var(--wm-surface); color: var(--wm-text);
|
|
142
|
+
border: 1px solid var(--wm-border); border-left: 4px solid var(--wm-toast-kind);
|
|
143
|
+
border-radius: var(--wm-radius-sm); box-shadow: var(--wm-shadow-raised);
|
|
144
|
+
animation: wm-toast-in 150ms ease-out;
|
|
145
|
+
}
|
|
146
|
+
.wm-toast--success { --wm-toast-kind: var(--wm-positive); }
|
|
147
|
+
.wm-toast--warning { --wm-toast-kind: var(--wm-warning); }
|
|
148
|
+
.wm-toast--error { --wm-toast-kind: var(--wm-negative); }
|
|
149
|
+
.wm-toast__icon {
|
|
150
|
+
flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px;
|
|
151
|
+
font-size: 12px; font-weight: 700; line-height: 1; color: var(--wm-toast-kind);
|
|
152
|
+
border: 1.5px solid var(--wm-toast-kind); border-radius: 50%;
|
|
153
|
+
}
|
|
154
|
+
.wm-toast__text { flex: 1 1 auto; min-width: 0; margin: 0; padding-top: 2px; overflow-wrap: anywhere; }
|
|
155
|
+
.wm-toast__close { flex: none; min-width: 32px; height: 32px; padding: 0; border-color: transparent; background: transparent; color: var(--wm-accent); font-size: 18px; line-height: 1; }
|
|
156
|
+
.wm-toast__close:hover:not(:disabled) { background: var(--wm-surface-alt); }
|
|
157
|
+
.wm-toast-viewport__all { display: flex; justify-content: flex-end; }
|
|
158
|
+
.wm-toast-viewport__all .wm-btn { background: var(--wm-surface); color: var(--wm-accent); box-shadow: var(--wm-shadow-raised); }
|
|
159
|
+
@keyframes wm-toast-in { from { opacity: 0; } to { opacity: 1; } }
|
|
160
|
+
@media (prefers-reduced-motion: reduce) { .wm-toast { animation: none; } }
|
|
161
|
+
@media (max-width: 560px) { .wm-toast__close { min-width: 40px; height: 40px; } }
|
package/dist/index.d.ts
CHANGED
|
@@ -39,4 +39,8 @@ export { Spinner } from './Spinner.js';
|
|
|
39
39
|
export type { SpinnerProps } from './Spinner.js';
|
|
40
40
|
export { useFocusTrap } from './useFocusTrap.js';
|
|
41
41
|
export type { FocusTrapOptions } from './useFocusTrap.js';
|
|
42
|
+
export { ToastProvider, ToastViewport } from './Toast.js';
|
|
43
|
+
export type { ToastProviderProps } from './Toast.js';
|
|
44
|
+
export { useToast } from './useToast.js';
|
|
45
|
+
export type { ToastApi, ToastKind, ToastOptions } from './useToast.js';
|
|
42
46
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAA;AACrB,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/D,YAAY,EAAE,UAAU,EA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EmptyState.js';
|
|
20
20
|
export { Spinner } from './Spinner.js';
|
|
21
21
|
export { useFocusTrap } from './useFocusTrap.js';
|
|
22
|
+
export { ToastProvider, ToastViewport } from './Toast.js';
|
|
23
|
+
export { useToast } from './useToast.js';
|
|
22
24
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAA;AACrB,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,OAA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M,YAAY,CAAA;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/tokens.css
CHANGED
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
--wm-gap: 16px;
|
|
56
56
|
--wm-gap-sm: 8px;
|
|
57
57
|
--wm-shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 4%);
|
|
58
|
+
--wm-shadow-raised: 0 4px 12px rgb(16 24 40 / 14%), 0 1px 3px rgb(16 24 40 / 10%);
|
|
58
59
|
--wm-font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
59
60
|
--wm-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
|
|
60
61
|
}
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
--wm-chart-other: #4e4d49;
|
|
88
89
|
--wm-chart-grid: #2b323c;
|
|
89
90
|
--wm-shadow: 0 1px 2px rgb(0 0 0 / 40%);
|
|
91
|
+
--wm-shadow-raised: 0 4px 14px rgb(0 0 0 / 55%), 0 0 0 1px rgb(255 255 255 / 5%);
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
|
|
@@ -112,6 +114,7 @@
|
|
|
112
114
|
--wm-chart-other: #4e4d49;
|
|
113
115
|
--wm-chart-grid: #2b323c;
|
|
114
116
|
--wm-shadow: 0 1px 2px rgb(0 0 0 / 40%);
|
|
117
|
+
--wm-shadow-raised: 0 4px 14px rgb(0 0 0 / 55%), 0 0 0 1px rgb(255 255 255 / 5%);
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
body {
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a toast looks and is announced.
|
|
3
|
+
*
|
|
4
|
+
* @experimental Part of the toast API, which may change in any 0.x release.
|
|
5
|
+
*/
|
|
6
|
+
export type ToastKind = 'success' | 'info' | 'warning' | 'error';
|
|
7
|
+
/**
|
|
8
|
+
* Options for {@link ToastApi.show}.
|
|
9
|
+
*
|
|
10
|
+
* @experimental Part of the toast API, which may change in any 0.x release.
|
|
11
|
+
*/
|
|
12
|
+
export interface ToastOptions {
|
|
13
|
+
/** Defaults to `'info'`. `warning` and `error` are announced with a "Warning: " or "Error: " prefix. */
|
|
14
|
+
readonly kind?: ToastKind;
|
|
15
|
+
/**
|
|
16
|
+
* A toast with the same key replaces the earlier one in place (visible or
|
|
17
|
+
* waiting) and is announced again. Use it for repeated actions of one kind,
|
|
18
|
+
* so they do not stack.
|
|
19
|
+
*/
|
|
20
|
+
readonly key?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* What {@link useToast} returns. Both members keep the same identity for the
|
|
24
|
+
* life of the provider.
|
|
25
|
+
*
|
|
26
|
+
* @experimental Part of the toast API, which may change in any 0.x release.
|
|
27
|
+
*/
|
|
28
|
+
export interface ToastApi {
|
|
29
|
+
/**
|
|
30
|
+
* Shows a plain-text message and returns its id. The message is delivered on
|
|
31
|
+
* the next animation frame (or after an open modal closes, see
|
|
32
|
+
* {@link ToastProvider}). Nothing dismisses a toast but the person or the same `key`.
|
|
33
|
+
*/
|
|
34
|
+
readonly show: (message: string, options?: ToastOptions) => string;
|
|
35
|
+
/** Removes a visible, waiting or not yet delivered toast. An unknown id is ignored. */
|
|
36
|
+
readonly dismiss: (id: string) => void;
|
|
37
|
+
}
|
|
38
|
+
/** One toast as the provider holds it. Internal. */
|
|
39
|
+
export interface ToastItem {
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly message: string;
|
|
42
|
+
readonly kind: ToastKind;
|
|
43
|
+
/** Incremented when the same key replaces it, so the replacement is announced again. */
|
|
44
|
+
readonly rev: number;
|
|
45
|
+
}
|
|
46
|
+
/** What the viewport reads. Internal: not exported from the package. */
|
|
47
|
+
export interface ToastView {
|
|
48
|
+
/** The toasts on screen, newest first. */
|
|
49
|
+
readonly visible: readonly ToastItem[];
|
|
50
|
+
readonly dismissMany: (ids: readonly string[]) => void;
|
|
51
|
+
/** Where focus was before it entered the stack, so closing a focused toast can give it back. */
|
|
52
|
+
readonly originRef: {
|
|
53
|
+
current: HTMLElement | null;
|
|
54
|
+
};
|
|
55
|
+
readonly groupRef: {
|
|
56
|
+
current: HTMLDivElement | null;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export declare const ToastApiContext: import("react").Context<ToastApi | null>;
|
|
60
|
+
export declare const ToastViewContext: import("react").Context<ToastView | null>;
|
|
61
|
+
/**
|
|
62
|
+
* The toast API, for use in event handlers and effects.
|
|
63
|
+
*
|
|
64
|
+
* Throws outside a {@link ToastProvider}. Plugins cannot use it: a plugin's
|
|
65
|
+
* copy of this package has no provider, and a way for plugins to notify
|
|
66
|
+
* (`ctx.notify`) is planned for a later release.
|
|
67
|
+
*
|
|
68
|
+
* @experimental May change in any 0.x release; for the core app only until the plugin path ships.
|
|
69
|
+
*/
|
|
70
|
+
export declare function useToast(): ToastApi;
|
|
71
|
+
//# sourceMappingURL=useToast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../src/useToast.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;AAEhE;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,wGAAwG;IACxG,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;IACzB;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,KAAK,MAAM,CAAA;IAClE,uFAAuF;IACvF,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CACvC;AAED,oDAAoD;AACpD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,wFAAwF;IACxF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB;AAED,wEAAwE;AACxE,MAAM,WAAW,SAAS;IACxB,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,CAAA;IACtC,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAA;IACtD,gGAAgG;IAChG,QAAQ,CAAC,SAAS,EAAE;QAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;KAAE,CAAA;IACnD,QAAQ,CAAC,QAAQ,EAAE;QAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAAA;KAAE,CAAA;CACtD;AAED,eAAO,MAAM,eAAe,0CAAuC,CAAA;AACnE,eAAO,MAAM,gBAAgB,2CAAwC,CAAA;AAErE;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,IAAI,QAAQ,CAUnC"}
|
package/dist/useToast.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const ToastApiContext = createContext(null);
|
|
3
|
+
export const ToastViewContext = createContext(null);
|
|
4
|
+
/**
|
|
5
|
+
* The toast API, for use in event handlers and effects.
|
|
6
|
+
*
|
|
7
|
+
* Throws outside a {@link ToastProvider}. Plugins cannot use it: a plugin's
|
|
8
|
+
* copy of this package has no provider, and a way for plugins to notify
|
|
9
|
+
* (`ctx.notify`) is planned for a later release.
|
|
10
|
+
*
|
|
11
|
+
* @experimental May change in any 0.x release; for the core app only until the plugin path ships.
|
|
12
|
+
*/
|
|
13
|
+
export function useToast() {
|
|
14
|
+
const api = useContext(ToastApiContext);
|
|
15
|
+
if (api === null) {
|
|
16
|
+
throw new Error('useToast() was called outside a <ToastProvider>. Mount ToastProvider once above your routes '
|
|
17
|
+
+ '(ADR 0009, notifications and action feedback). Plugins cannot use useToast: they will use '
|
|
18
|
+
+ 'ctx.notify in a later release.');
|
|
19
|
+
}
|
|
20
|
+
return api;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=useToast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToast.js","sourceRoot":"","sources":["../src/useToast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AA6DjD,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAkB,IAAI,CAAC,CAAA;AACnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAmB,IAAI,CAAC,CAAA;AAErE;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,GAAG,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IACvC,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,8FAA8F;cAC5F,4FAA4F;cAC5F,gCAAgC,CACnC,CAAA;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
|