@wickermoney/ui-kit 0.6.1 → 0.8.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 +119 -4
- 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/Button.d.ts +8 -1
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +3 -2
- package/dist/Button.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/Field.d.ts +8 -2
- package/dist/Field.d.ts.map +1 -1
- package/dist/Field.js +2 -2
- package/dist/Field.js.map +1 -1
- package/dist/IconButton.d.ts +4 -2
- package/dist/IconButton.d.ts.map +1 -1
- package/dist/IconButton.js +4 -2
- package/dist/IconButton.js.map +1 -1
- package/dist/SelectField.d.ts +6 -1
- package/dist/SelectField.d.ts.map +1 -1
- package/dist/SelectField.js +3 -2
- package/dist/SelectField.js.map +1 -1
- package/dist/Table.d.ts +14 -2
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +24 -2
- package/dist/Table.js.map +1 -1
- package/dist/Toast.d.ts +43 -0
- package/dist/Toast.d.ts.map +1 -0
- package/dist/Toast.js +275 -0
- package/dist/Toast.js.map +1 -0
- package/dist/busy.d.ts +25 -0
- package/dist/busy.d.ts.map +1 -0
- package/dist/busy.js +71 -0
- package/dist/busy.js.map +1 -0
- package/dist/components.css +45 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -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 +3 -3
package/README.md
CHANGED
|
@@ -49,17 +49,18 @@ A federated remote's emitted stylesheet is never requested.
|
|
|
49
49
|
| Component | Purpose |
|
|
50
50
|
|---|---|
|
|
51
51
|
| `Surface` | Card/panel with an optional title and header action |
|
|
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 `
|
|
52
|
+
| `Button` | `variant`: `default`, `primary` or `danger`. `busy` for a request in flight (see [Busy controls](#busy-controls)) |
|
|
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`; `busy` as for `Button`. 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
|
-
| `Field`, `SelectField` | Labelled form inputs; optional `hint` and `error` (wires `aria-invalid` and `aria-describedby`) |
|
|
55
|
+
| `Field`, `SelectField` | Labelled form inputs; optional `hint` and `error` (wires `aria-invalid` and `aria-describedby`); `busy` while a request that uses the field runs (see [Busy controls](#busy-controls)) |
|
|
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,98 @@ 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
|
+
- **Clearance.** While a banner shows, `ToastViewport` sets `--wm-toast-height`
|
|
162
|
+
(its height in px, rounded up) on its parent element and removes it when the
|
|
163
|
+
banner goes, so a stylesheet can keep a control that is scrolled to (Tab,
|
|
164
|
+
Shift+Tab) out from behind it without measuring: `scroll-margin-top:
|
|
165
|
+
calc(var(--wm-toast-offset-top, 0px) + var(--wm-toast-height, 0px) + 8px)`.
|
|
166
|
+
Put the rule on the control, not its row. Like the rest of the toast, the
|
|
167
|
+
property is experimental.
|
|
168
|
+
- **Tokens.** `--wm-shadow-raised` (light and dark) is new; the rest are existing
|
|
169
|
+
surface, border, text, accent and status colours.
|
|
170
|
+
|
|
78
171
|
### Focus trap
|
|
79
172
|
|
|
80
173
|
`useFocusTrap(ref, active, options?)` keeps Tab and Shift+Tab inside the element
|
|
@@ -110,6 +203,28 @@ It is for hand-rolled modals that are not a native `<dialog>`. A native `<dialog
|
|
|
110
203
|
opened with `showModal()` already keeps focus inside, and the kit's own `Dialog`
|
|
111
204
|
is one.
|
|
112
205
|
|
|
206
|
+
### Busy controls
|
|
207
|
+
|
|
208
|
+
A control that is `disabled` while its request runs loses keyboard focus, and a
|
|
209
|
+
screen reader's cursor with it, the moment it is set. `Button`, `IconButton`,
|
|
210
|
+
`Field` and `SelectField` take `busy` instead: the control stays focusable and
|
|
211
|
+
looks disabled; a button or select is `aria-disabled="true"` and ignores a click
|
|
212
|
+
or a change (so a submit button submits nothing and a controlled select keeps its
|
|
213
|
+
value), and a field is `readOnly`. Ignoring an activation says "Still working. Try
|
|
214
|
+
again in a moment." in the toast provider's live region when one is mounted, or in
|
|
215
|
+
a hidden `role="status"` region of its own (as in a plugin frame). Use `disabled`
|
|
216
|
+
for a control that cannot be used for another reason, such as an empty required
|
|
217
|
+
field; both can be set.
|
|
218
|
+
|
|
219
|
+
For a plain element (a checkbox, a switch) set `aria-disabled={busy || undefined}`
|
|
220
|
+
and wrap its handler in `guardBusy(busy, handler)`, which returns the handler
|
|
221
|
+
unchanged when not busy and otherwise cancels the event and says so.
|
|
222
|
+
|
|
223
|
+
```tsx
|
|
224
|
+
<Button variant="primary" busy={saving} onClick={save}>Save</Button>
|
|
225
|
+
<input type="checkbox" checked={on} aria-disabled={saving || undefined} onChange={guardBusy(saving, toggle)} />
|
|
226
|
+
```
|
|
227
|
+
|
|
113
228
|
## Design tokens
|
|
114
229
|
|
|
115
230
|
All styling goes through CSS custom properties prefixed `--wm-`: surfaces, text,
|
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/Button.d.ts
CHANGED
|
@@ -3,6 +3,13 @@ import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
|
3
3
|
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
4
|
/** Visual emphasis. Defaults to `"default"`. */
|
|
5
5
|
readonly variant?: 'default' | 'primary' | 'danger';
|
|
6
|
+
/**
|
|
7
|
+
* `true` while the action this button starts (or one beside it) is running. The button stays focusable and
|
|
8
|
+
* looks disabled, is `aria-disabled`, and ignores a click with a spoken "Still working" message. Use it instead
|
|
9
|
+
* of `disabled` for a request in flight: `disabled` drops keyboard focus to `<body>`. Keep `disabled` for a
|
|
10
|
+
* button that cannot be used for another reason (an empty field).
|
|
11
|
+
*/
|
|
12
|
+
readonly busy?: boolean;
|
|
6
13
|
/** The button label or content. */
|
|
7
14
|
readonly children?: ReactNode;
|
|
8
15
|
}
|
|
@@ -12,5 +19,5 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
12
19
|
* `type` defaults to `"button"` rather than the browser's `"submit"`, which
|
|
13
20
|
* surprises people inside a form. Pass `type="submit"` to opt in.
|
|
14
21
|
*/
|
|
15
|
-
export declare function Button({ variant, className, children, ...rest }: ButtonProps): import("react").JSX.Element;
|
|
22
|
+
export declare function Button({ variant, busy, className, children, onClick, ...rest }: ButtonProps): import("react").JSX.Element;
|
|
16
23
|
//# sourceMappingURL=Button.d.ts.map
|
package/dist/Button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAG5D,yFAAyF;AACzF,MAAM,WAAW,WAAY,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IAC1E,gDAAgD;IAChD,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAA;IACnD;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IACvB,mCAAmC;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,EAAE,OAAmB,EAAE,IAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,+BAS/G"}
|
package/dist/Button.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { guardBusy } from './busy.js';
|
|
2
3
|
/**
|
|
3
4
|
* A button.
|
|
4
5
|
*
|
|
5
6
|
* `type` defaults to `"button"` rather than the browser's `"submit"`, which
|
|
6
7
|
* surprises people inside a form. Pass `type="submit"` to opt in.
|
|
7
8
|
*/
|
|
8
|
-
export function Button({ variant = 'default', className, children, ...rest }) {
|
|
9
|
+
export function Button({ variant = 'default', busy = false, className, children, onClick, ...rest }) {
|
|
9
10
|
const classes = ['wm-btn', variant !== 'default' ? `wm-btn--${variant}` : '', className ?? '']
|
|
10
11
|
.filter(Boolean)
|
|
11
12
|
.join(' ');
|
|
12
|
-
return (_jsx("button", { type: "button", ...rest, className: classes, children: children }));
|
|
13
|
+
return (_jsx("button", { type: "button", ...rest, ...(busy ? { 'aria-disabled': true } : {}), className: classes, onClick: guardBusy(busy, onClick), children: children }));
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=Button.js.map
|
package/dist/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAiBrC;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,EAAE,IAAI,GAAG,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,EAAe;IAC9G,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,IAAI,EAAE,CAAC;SAC3F,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAA;IACZ,OAAO,CACL,iBAAQ,IAAI,EAAC,QAAQ,KAAK,IAAI,KAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,YAC/H,QAAQ,GACF,CACV,CAAA;AACH,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,CAA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LAttributes } from 'react';
|
|
2
2
|
import { type FieldCommon } from './FieldCommon.js';
|
|
3
3
|
/** Props for {@link Field}: the shared field props plus every native `<input>` attribute. */
|
|
4
|
-
export type FieldProps = FieldCommon & InputHTMLAttributes<HTMLInputElement
|
|
4
|
+
export type FieldProps = FieldCommon & InputHTMLAttributes<HTMLInputElement> & {
|
|
5
|
+
/**
|
|
6
|
+
* `true` while a request that uses this field is running. The input stays focusable but cannot be edited
|
|
7
|
+
* (`readOnly`, which a screen reader announces), where `disabled` would drop keyboard focus to `<body>`.
|
|
8
|
+
*/
|
|
9
|
+
readonly busy?: boolean;
|
|
10
|
+
};
|
|
5
11
|
/** A labelled text input. The label is always associated, never a bare placeholder. */
|
|
6
|
-
export declare function Field({ label, error, hint, ...rest }: FieldProps): import("react").JSX.Element;
|
|
12
|
+
export declare function Field({ label, error, hint, busy, ...rest }: FieldProps): import("react").JSX.Element;
|
|
7
13
|
//# sourceMappingURL=Field.d.ts.map
|
package/dist/Field.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../src/Field.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAA;AACvD,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEhE,6FAA6F;AAC7F,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../src/Field.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAA;AACvD,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEhE,6FAA6F;AAC7F,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;IAC7E;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AAED,uFAAuF;AACvF,wBAAgB,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAY,EAAE,GAAG,IAAI,EAAE,EAAE,UAAU,+BAmB9E"}
|
package/dist/Field.js
CHANGED
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useId } from 'react';
|
|
3
3
|
import { describedBy } from './FieldCommon.js';
|
|
4
4
|
/** A labelled text input. The label is always associated, never a bare placeholder. */
|
|
5
|
-
export function Field({ label, error, hint, ...rest }) {
|
|
5
|
+
export function Field({ label, error, hint, busy = false, ...rest }) {
|
|
6
6
|
const id = useId();
|
|
7
|
-
return (_jsxs("div", { className: "wm-field", children: [_jsx("label", { className: "wm-field__label", htmlFor: id, children: label }), _jsx("input", { id: id, className: "wm-field__control", "aria-invalid": error !== undefined, "aria-describedby": describedBy(id, hint, error), ...rest }), hint !== undefined ? _jsx("span", { className: "wm-field__hint", id: `${id}-hint`, children: hint }) : null, error !== undefined ? (_jsx("span", { className: "wm-field__error", id: `${id}-error`, children: error })) : null] }));
|
|
7
|
+
return (_jsxs("div", { className: "wm-field", children: [_jsx("label", { className: "wm-field__label", htmlFor: id, children: label }), _jsx("input", { id: id, className: "wm-field__control", "aria-invalid": error !== undefined, "aria-describedby": describedBy(id, hint, error), ...rest, ...(busy ? { readOnly: true } : {}) }), hint !== undefined ? _jsx("span", { className: "wm-field__hint", id: `${id}-hint`, children: hint }) : null, error !== undefined ? (_jsx("span", { className: "wm-field__error", id: `${id}-error`, children: error })) : null] }));
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=Field.js.map
|
package/dist/Field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../src/Field.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAA4B,MAAM,OAAO,CAAA;AACvD,OAAO,EAAE,WAAW,EAAoB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../src/Field.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAA4B,MAAM,OAAO,CAAA;AACvD,OAAO,EAAE,WAAW,EAAoB,MAAM,kBAAkB,CAAA;AAWhE,uFAAuF;AACvF,MAAM,UAAU,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,KAAK,EAAE,GAAG,IAAI,EAAc;IAC7E,MAAM,EAAE,GAAG,KAAK,EAAE,CAAA;IAClB,OAAO,CACL,eAAK,SAAS,EAAC,UAAU,aACvB,gBAAO,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAE,EAAE,YAAG,KAAK,GAAS,EAC/D,gBACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAC,mBAAmB,kBACf,KAAK,KAAK,SAAS,sBACf,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAC1C,IAAI,KACJ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACpC,EACD,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,gBAAgB,EAAC,EAAE,EAAE,GAAG,EAAE,OAAO,YAAG,IAAI,GAAQ,CAAC,CAAC,CAAC,IAAI,EAC5F,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CACrB,eAAM,SAAS,EAAC,iBAAiB,EAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,YAAG,KAAK,GAAQ,CACpE,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,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. */
|
|
@@ -13,6 +13,8 @@ export interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonEle
|
|
|
13
13
|
readonly label: string;
|
|
14
14
|
/** Visual emphasis. Defaults to `"default"`. */
|
|
15
15
|
readonly variant?: 'default' | 'danger';
|
|
16
|
+
/** As {@link ButtonProps.busy}: focusable, looks disabled, ignores a click and says so. */
|
|
17
|
+
readonly busy?: boolean;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* A square, icon-only button for table rows.
|
|
@@ -21,5 +23,5 @@ export interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonEle
|
|
|
21
23
|
* danger colour behave identically; it only swaps the text for a drawn icon and
|
|
22
24
|
* pins the size so a column of them lines up.
|
|
23
25
|
*/
|
|
24
|
-
export declare function IconButton({ icon, label, variant, className, ...rest }: IconButtonProps): import("react").JSX.Element;
|
|
26
|
+
export declare function IconButton({ icon, label, variant, busy, className, onClick, ...rest }: IconButtonProps): import("react").JSX.Element;
|
|
25
27
|
//# sourceMappingURL=IconButton.d.ts.map
|
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;
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../src/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAa,MAAM,OAAO,CAAA;AAG5D,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;IACvC,2FAA2F;IAC3F,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAmB,EAAE,IAAY,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,eAAe,+BAc1H"}
|
package/dist/IconButton.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { guardBusy } from './busy.js';
|
|
2
3
|
// Paths are 24x24, stroke-only, in the style of the Lucide set (ISC licence).
|
|
3
4
|
const ICONS = {
|
|
4
5
|
edit: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z" }), _jsx("path", { d: "m15 5 4 4" })] })),
|
|
@@ -8,6 +9,7 @@ const ICONS = {
|
|
|
8
9
|
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
10
|
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
11
|
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" })] })),
|
|
12
|
+
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
13
|
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
14
|
};
|
|
13
15
|
/**
|
|
@@ -17,10 +19,10 @@ const ICONS = {
|
|
|
17
19
|
* danger colour behave identically; it only swaps the text for a drawn icon and
|
|
18
20
|
* pins the size so a column of them lines up.
|
|
19
21
|
*/
|
|
20
|
-
export function IconButton({ icon, label, variant = 'default', className, ...rest }) {
|
|
22
|
+
export function IconButton({ icon, label, variant = 'default', busy = false, className, onClick, ...rest }) {
|
|
21
23
|
const classes = ['wm-btn', 'wm-icon-btn', variant === 'danger' ? 'wm-btn--danger' : '', className ?? '']
|
|
22
24
|
.filter(Boolean)
|
|
23
25
|
.join(' ');
|
|
24
|
-
return (_jsx("button", { type: "button", ...rest, className: classes, "aria-label": label, title: label, children: _jsx("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", children: ICONS[icon] }) }));
|
|
26
|
+
return (_jsx("button", { type: "button", ...rest, ...(busy ? { 'aria-disabled': true } : {}), className: classes, "aria-label": label, title: label, onClick: guardBusy(busy, onClick), children: _jsx("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", children: ICONS[icon] }) }));
|
|
25
27
|
}
|
|
26
28
|
//# sourceMappingURL=IconButton.js.map
|
package/dist/IconButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../src/IconButton.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../src/IconButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAKrC,8EAA8E;AAC9E,MAAM,KAAK,GAAgC;IACzC,IAAI,EAAE,CACJ,8BACE,eAAM,CAAC,EAAC,kDAAkD,GAAG,EAC7D,eAAM,CAAC,EAAC,WAAW,GAAG,IACrB,CACJ;IACD,MAAM,EAAE,CACN,8BACE,eAAM,CAAC,EAAC,SAAS,GAAG,EACpB,eAAM,CAAC,EAA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AEhG,KAAK,CAAC,IAAI,CAAC,GACR,GACC,CACV,CAAA;AACH,CAAC"}
|
package/dist/SelectField.d.ts
CHANGED
|
@@ -4,7 +4,12 @@ import { type FieldCommon } from './FieldCommon.js';
|
|
|
4
4
|
export type SelectFieldProps = FieldCommon & SelectHTMLAttributes<HTMLSelectElement> & {
|
|
5
5
|
/** The `<option>` and `<optgroup>` elements to choose between. */
|
|
6
6
|
readonly children: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* `true` while a request that uses this select is running. It stays focusable, looks disabled and is
|
|
9
|
+
* `aria-disabled`; a change is cancelled and announced as "Still working", and a controlled value stays as it was.
|
|
10
|
+
*/
|
|
11
|
+
readonly busy?: boolean;
|
|
7
12
|
};
|
|
8
13
|
/** A labelled `<select>`. The label is always associated with the control. */
|
|
9
|
-
export declare function SelectField({ label, error, hint, children, ...rest }: SelectFieldProps): import("react").JSX.Element;
|
|
14
|
+
export declare function SelectField({ label, error, hint, children, busy, onChange, ...rest }: SelectFieldProps): import("react").JSX.Element;
|
|
10
15
|
//# sourceMappingURL=SelectField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../src/SelectField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,SAAS,EAAE,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../src/SelectField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,SAAS,EAAE,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAExE,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEhE,oGAAoG;AACpG,MAAM,MAAM,gBAAgB,GAAG,WAAW,GACxC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACxC,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;IAC5B;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AAEH,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAY,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,+BAoB9G"}
|
package/dist/SelectField.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from 'react';
|
|
3
|
+
import { guardBusy } from './busy.js';
|
|
3
4
|
import { describedBy } from './FieldCommon.js';
|
|
4
5
|
/** A labelled `<select>`. The label is always associated with the control. */
|
|
5
|
-
export function SelectField({ label, error, hint, children, ...rest }) {
|
|
6
|
+
export function SelectField({ label, error, hint, children, busy = false, onChange, ...rest }) {
|
|
6
7
|
const id = useId();
|
|
7
|
-
return (_jsxs("div", { className: "wm-field", children: [_jsx("label", { className: "wm-field__label", htmlFor: id, children: label }), _jsx("select", { id: id, className: "wm-field__control", "aria-invalid": error !== undefined, "aria-describedby": describedBy(id, hint, error), ...rest, children: children }), hint !== undefined ? _jsx("span", { className: "wm-field__hint", id: `${id}-hint`, children: hint }) : null, error !== undefined ? _jsx("span", { className: "wm-field__error", id: `${id}-error`, children: error }) : null] }));
|
|
8
|
+
return (_jsxs("div", { className: "wm-field", children: [_jsx("label", { className: "wm-field__label", htmlFor: id, children: label }), _jsx("select", { id: id, className: "wm-field__control", "aria-invalid": error !== undefined, "aria-describedby": describedBy(id, hint, error), ...rest, ...(busy ? { 'aria-disabled': true } : {}), onChange: guardBusy(busy, onChange), children: children }), hint !== undefined ? _jsx("span", { className: "wm-field__hint", id: `${id}-hint`, children: hint }) : null, error !== undefined ? _jsx("span", { className: "wm-field__error", id: `${id}-error`, children: error }) : null] }));
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=SelectField.js.map
|
package/dist/SelectField.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectField.js","sourceRoot":"","sources":["../src/SelectField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAA6C,MAAM,OAAO,CAAA;AACxE,OAAO,EAAE,WAAW,EAAoB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"SelectField.js","sourceRoot":"","sources":["../src/SelectField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAA6C,MAAM,OAAO,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,WAAW,EAAoB,MAAM,kBAAkB,CAAA;AAchE,8EAA8E;AAC9E,MAAM,UAAU,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAoB;IAC7G,MAAM,EAAE,GAAG,KAAK,EAAE,CAAA;IAClB,OAAO,CACL,eAAK,SAAS,EAAC,UAAU,aACvB,gBAAO,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAE,EAAE,YAAG,KAAK,GAAS,EAC/D,iBACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAC,mBAAmB,kBACf,KAAK,KAAK,SAAS,sBACf,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAC1C,IAAI,KACJ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAC3C,QAAQ,EAAE,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,YAElC,QAAQ,GACF,EACR,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,gBAAgB,EAAC,EAAE,EAAE,GAAG,EAAE,OAAO,YAAG,IAAI,GAAQ,CAAC,CAAC,CAAC,IAAI,EAC5F,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,iBAAiB,EAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,YAAG,KAAK,GAAQ,CAAC,CAAC,CAAC,IAAI,IAC7F,CACP,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,EAAyC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAE7E,+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,+BAgEtG"}
|
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, useEffect, useRef, useState } from 'react';
|
|
2
3
|
/**
|
|
3
4
|
* A data table.
|
|
4
5
|
*
|
|
@@ -10,9 +11,30 @@ 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 }) {
|
|
15
|
+
const scroller = useRef(null);
|
|
16
|
+
const [overflowing, setOverflowing] = useState(false);
|
|
17
|
+
// A scroller whose table is wider than its room can only be scrolled with a pointer unless the keyboard can reach
|
|
18
|
+
// it, and cells with no control in them give the keyboard nothing to land on. Make the scroller itself a stop, but
|
|
19
|
+
// only while it really overflows, so a table that fits adds no Tab stop.
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const el = scroller.current;
|
|
22
|
+
if (el === null || typeof ResizeObserver === 'undefined')
|
|
23
|
+
return undefined;
|
|
24
|
+
const measure = () => { setOverflowing(el.scrollWidth > el.clientWidth); };
|
|
25
|
+
measure();
|
|
26
|
+
const observer = new ResizeObserver(measure);
|
|
27
|
+
observer.observe(el);
|
|
28
|
+
if (el.firstElementChild !== null)
|
|
29
|
+
observer.observe(el.firstElementChild);
|
|
30
|
+
return () => { observer.disconnect(); };
|
|
31
|
+
});
|
|
14
32
|
if (rows.length === 0 && empty !== undefined)
|
|
15
33
|
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) =>
|
|
34
|
+
return (_jsx("div", { ref: scroller, className: className === undefined ? 'wm-table__scroll' : `wm-table__scroll ${className}`, ...(overflowing ? { tabIndex: 0, ...(caption === undefined ? {} : { role: 'region', 'aria-label': caption }) } : {}), 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) => {
|
|
35
|
+
const detail = rowDetail?.(row);
|
|
36
|
+
const open = detail !== undefined && detail !== null && detail !== false;
|
|
37
|
+
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)));
|
|
38
|
+
}) })] }) }));
|
|
17
39
|
}
|
|
18
40
|
//# 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,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAsD7E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,KAAK,CAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAiB;IACrG,MAAM,QAAQ,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAC7C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACrD,kHAAkH;IAClH,mHAAmH;IACnH,yEAAyE;IACzE,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAA;QAC3B,IAAI,EAAE,KAAK,IAAI,IAAI,OAAO,cAAc,KAAK,WAAW;YAAE,OAAO,SAAS,CAAA;QAC1E,MAAM,OAAO,GAAG,GAAS,EAAE,GAAG,cAAc,CAAC,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,CAAC,CAAA,CAAC,CAAC,CAAA;QAC/E,OAAO,EAAE,CAAA;QACT,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAA;QAC5C,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QACpB,IAAI,EAAE,CAAC,iBAAiB,KAAK,IAAI;YAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAA;QACzE,OAAO,GAAG,EAAE,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAA,CAAC,CAAC,CAAA;IACxC,C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AAI,MAAM,KAAK,KAAK,CAAA;wBACxE,OAAO,CACL,MAAC,QAAQ,eACP,aAAI,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,YACpD,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAClB,yBAEY,CAAC,CAAC,GAAG,gBACH,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAClF,SAAS,EAAE,CAAC,CAAC,OAAO,KAAK,IAAI,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,43 @@
|
|
|
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. While the banner shows, it sets
|
|
33
|
+
* `--wm-toast-height` (its height in px, rounded up) on its parent element, so
|
|
34
|
+
* styles for the content below it can keep a focused or scrolled-to control
|
|
35
|
+
* clear of the banner; the property is absent, and a `var(--wm-toast-height, 0px)`
|
|
36
|
+
* fallback applies, when no toast shows. It takes no props, is not a live region (the
|
|
37
|
+
* provider's announcer speaks), holds no tab stop when empty, and renders
|
|
38
|
+
* nothing outside a {@link ToastProvider}.
|
|
39
|
+
*
|
|
40
|
+
* @experimental May change in any 0.x release; for the core app only until the plugin path ships.
|
|
41
|
+
*/
|
|
42
|
+
export declare function ToastViewport(): import("react").JSX.Element | null;
|
|
43
|
+
//# 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;AAOd,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,+BAwIvE;AAuDD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,uCAI5B"}
|