@enonic/ui 1.4.0 → 1.6.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 +52 -0
- package/dist/enonic-ui.cjs +1 -1
- package/dist/enonic-ui.es.js +129 -126
- package/dist/style.cjs +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/style.css +1 -1
- package/dist/types/components/combobox/combobox.d.ts +3 -2
- package/dist/types/components/dialog/dialog-actions.d.ts +33 -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/icon-button/icon-button.d.ts +4 -1
- package/dist/types/components/search-field/search-field.d.ts +4 -2
- package/dist/types/components/stepper/index.d.ts +1 -1
- package/dist/types/components/stepper/stepper.d.ts +12 -0
- package/dist/types/components/tab/tab.d.ts +4 -0
- package/dist/types/components/tab/tab.phrases.d.ts +4 -0
- package/dist/types/components/tag/tag.d.ts +2 -6
- package/dist/types/components/toast/toast.d.ts +2 -1
- package/dist/types/components/tree-list/tree-list.d.ts +2 -2
- package/dist/types/components/virtualized-tree-list/virtualized-tree-list.d.ts +3 -2
- package/dist/types/hooks/use-focus-outside.d.ts +9 -0
- package/dist/types/hooks/use-portal-focus-container.d.ts +6 -2
- package/dist/types/i18n/phrases.d.ts +3 -0
- package/dist/types/providers/combobox-provider.d.ts +1 -0
- package/dist/types/providers/context-menu-content-provider.d.ts +1 -0
- package/dist/types/providers/dialog-provider.d.ts +6 -5
- package/dist/types/providers/focus-container-provider.d.ts +3 -1
- package/dist/types/providers/menu-provider.d.ts +1 -0
- package/dist/types/providers/stepper-provider.d.ts +2 -0
- package/dist/types/utils/dom.d.ts +8 -0
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -194,6 +194,58 @@ it in a `useMemo` keyed on that instead, or the labels keep their first wording.
|
|
|
194
194
|
and check its bundle against. Texts the application supplies through props — a dialog title, an
|
|
195
195
|
item name — never pass through the provider.
|
|
196
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
|
+
Built-in widgets yield Cmd/Ctrl+Enter and Cmd/Ctrl+Shift+Enter to the topmost dialog when it owns
|
|
229
|
+
the event. Open selectors, date and time pickers, menus, context menus, menubar menus, and staged comboboxes keep Enter
|
|
230
|
+
local to select or apply values. Their closed controls yield to the dialog. Other widgets yield
|
|
231
|
+
before changing selection, opening popups, or activating items.
|
|
232
|
+
The dialog reserves these chords even when its action is missing, disabled, or pending. Outside
|
|
233
|
+
the dialog's content and registered portals, widget keyboard behavior stays unchanged. Plain
|
|
234
|
+
Enter, Shift+Enter, and modifier combinations the dialog does not own retain their existing behavior.
|
|
235
|
+
|
|
236
|
+
Use `shortcutEnabled={false}` to unregister a mounted action without disabling its button; set
|
|
237
|
+
it on inactive views when they share a shortcut. A disabled `Dialog.Shortcut` can render outside
|
|
238
|
+
`Dialog.Content`; enabled registration requires content. For platform-specific hints,
|
|
239
|
+
`getDialogShortcutKeys` returns
|
|
240
|
+
`Meta+Enter` / `Meta+Shift+Enter` on macOS and `Control+Enter` / `Control+Shift+Enter` elsewhere.
|
|
241
|
+
Separately bundled copies share a dialog stack when they use the same shortcut protocol; incompatible
|
|
242
|
+
protocol versions cannot coordinate their topmost scopes.
|
|
243
|
+
|
|
244
|
+
For a multi-step dialog, use `Dialog.StepIndicator keyboardShortcuts`. Previous is secondary;
|
|
245
|
+
Next is primary until the last step, where the final action becomes primary. Its `disabled` and
|
|
246
|
+
`pending` props suppress the corresponding shortcuts. Add visible shortcut hints where people
|
|
247
|
+
need to discover them.
|
|
248
|
+
|
|
197
249
|
## What's exported
|
|
198
250
|
|
|
199
251
|
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.
|