@enonic/ui 1.3.0 → 1.5.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 +48 -5
- package/dist/enonic-ui.cjs +1 -1
- package/dist/enonic-ui.es.js +127 -122
- package/dist/style.cjs +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/style.css +1 -1
- package/dist/types/components/dialog/dialog-actions.d.ts +18 -0
- package/dist/types/components/dialog/dialog.d.ts +17 -1
- package/dist/types/components/dialog/index.d.ts +2 -1
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/tag/index.d.ts +1 -0
- package/dist/types/components/tag/tag.d.ts +42 -0
- package/dist/types/providers/combobox-provider.d.ts +3 -1
- package/dist/types/providers/index.d.ts +1 -0
- package/dist/types/providers/tag-provider.d.ts +13 -0
- package/package.json +22 -15
package/README.md
CHANGED
|
@@ -154,11 +154,10 @@ The `icon` prop accepts either package.
|
|
|
154
154
|
|
|
155
155
|
Optional peers, needed per feature:
|
|
156
156
|
|
|
157
|
-
| Package
|
|
158
|
-
|
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
161
|
-
| `tw-animate-css` | Component animations on the `preset.css` path |
|
|
157
|
+
| Package | Needed for |
|
|
158
|
+
| ---------------- | ------------------------------------------------- |
|
|
159
|
+
| `react-virtuoso` | `VirtualizedTreeList` and other virtualized lists |
|
|
160
|
+
| `tw-animate-css` | Component animations on the `preset.css` path |
|
|
162
161
|
|
|
163
162
|
## Localization
|
|
164
163
|
|
|
@@ -195,6 +194,50 @@ it in a `useMemo` keyed on that instead, or the labels keep their first wording.
|
|
|
195
194
|
and check its bundle against. Texts the application supplies through props — a dialog title, an
|
|
196
195
|
item name — never pass through the provider.
|
|
197
196
|
|
|
197
|
+
## Dialog action shortcuts
|
|
198
|
+
|
|
199
|
+
Shortcuts are opt-in. Use `Dialog.Shortcut` inside `Dialog.Content` to register a primary action,
|
|
200
|
+
or set `shortcut='secondary'` for the secondary action. On macOS, Cmd+Enter activates primary and
|
|
201
|
+
Cmd+Shift+Enter activates secondary; on Windows and Linux, use Ctrl instead of Cmd. By default,
|
|
202
|
+
`Dialog.Shortcut` renders a native button. Set `asChild` to wrap `Button`, `Dialog.Close asChild`,
|
|
203
|
+
or `Stepper.Next/Previous asChild`; the child must forward its ref and props to a native button:
|
|
204
|
+
|
|
205
|
+
```tsx
|
|
206
|
+
<Dialog.Shortcut asChild shortcut='secondary'>
|
|
207
|
+
<Dialog.Close asChild>
|
|
208
|
+
<Button label='Cancel' />
|
|
209
|
+
</Dialog.Close>
|
|
210
|
+
</Dialog.Shortcut>
|
|
211
|
+
<Dialog.Shortcut asChild pending={saving}>
|
|
212
|
+
<Button label='Save' disabled={saving} onClick={save} />
|
|
213
|
+
</Dialog.Shortcut>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
The shortcut calls the registered button's click path, preserving its click handler and close or
|
|
217
|
+
step behavior. `pending` blocks shortcut activation and sets `aria-busy`; it does not block an
|
|
218
|
+
ordinary click, so also disable the button while saving if clicks must be blocked. Disabled,
|
|
219
|
+
hidden, and unmounted actions do not respond to shortcuts. Only the topmost open dialog handles
|
|
220
|
+
shortcuts and Escape. Shortcut keys can come from its content or a registered portal. Modal dialogs
|
|
221
|
+
also accept keys from `<body>` or `document`, preserving shortcuts if a focused field loses
|
|
222
|
+
focus. Non-modal dialogs reject keys from outside their content and registered portals.
|
|
223
|
+
When a shortcut hides the focused step panel, focus moves to the dialog content.
|
|
224
|
+
If two actions use the same shortcut, the first registered action wins until it unregisters;
|
|
225
|
+
development builds warn.
|
|
226
|
+
Buttons keep their ordinary focus, Enter, and Space behavior.
|
|
227
|
+
|
|
228
|
+
Use `shortcutEnabled={false}` to unregister a mounted action without disabling its button; set
|
|
229
|
+
it on inactive views when they share a shortcut. A disabled `Dialog.Shortcut` can render outside
|
|
230
|
+
`Dialog.Content`; enabled registration requires content. For platform-specific hints,
|
|
231
|
+
`getDialogShortcutKeys` returns
|
|
232
|
+
`Meta+Enter` / `Meta+Shift+Enter` on macOS and `Control+Enter` / `Control+Shift+Enter` elsewhere.
|
|
233
|
+
Separately bundled copies share a dialog stack when they use the same shortcut protocol; incompatible
|
|
234
|
+
protocol versions cannot coordinate their topmost scopes.
|
|
235
|
+
|
|
236
|
+
For a multi-step dialog, use `Dialog.StepIndicator keyboardShortcuts`. Previous is secondary;
|
|
237
|
+
Next is primary until the last step, where the final action becomes primary. Its `disabled` and
|
|
238
|
+
`pending` props suppress the corresponding shortcuts. Add visible shortcut hints where people
|
|
239
|
+
need to discover them.
|
|
240
|
+
|
|
198
241
|
## What's exported
|
|
199
242
|
|
|
200
243
|
Beyond the components, the package entry re-exports the hooks that drive them (roving tabindex, type-ahead, floating position, scroll lock, and more), the bundled icon set, context providers, shared types, and the `cn` class-merge helper.
|