@xleddyl/443-components-vue 0.16.70 → 0.16.71

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.
Files changed (75) hide show
  1. package/CATALOG.md +130 -127
  2. package/README.md +70 -16
  3. package/dist/components/core/Button.vue +67 -5
  4. package/dist/components/core/Button.vue.d.ts +9 -4
  5. package/dist/components/core/Form.vue +8 -2
  6. package/dist/components/core/Form.vue.d.ts +1 -0
  7. package/dist/components/core/Input.vue.d.ts +2 -2
  8. package/dist/components/data/RecordList.vue +29 -7
  9. package/dist/components/forms/ColorInput.vue.d.ts +2 -2
  10. package/dist/components/forms/DateInput.vue.d.ts +2 -2
  11. package/dist/components/forms/Fieldset.vue +16 -2
  12. package/dist/components/forms/Fieldset.vue.d.ts +3 -3
  13. package/dist/components/forms/NumberInput.vue.d.ts +2 -2
  14. package/dist/components/forms/PaletteSelect.vue.d.ts +4 -4
  15. package/dist/components/forms/PasswordInput.vue.d.ts +2 -2
  16. package/dist/components/forms/PinInput.vue.d.ts +2 -2
  17. package/dist/components/forms/Slider.vue.d.ts +2 -2
  18. package/dist/components/forms/TimeInput.vue.d.ts +2 -2
  19. package/dist/components/layout/Tabs.vue +10 -1
  20. package/dist/components/layout/ThemeSwitch.vue.d.ts +4 -0
  21. package/dist/components/overlays/CommandButton.vue +1 -0
  22. package/dist/components/overlays/ConfirmDialog.vue.d.ts +8 -2
  23. package/dist/components/overlays/ConfirmHost.vue.d.ts +8 -2
  24. package/dist/components/overlays/ContextMenu.vue.d.ts +2 -2
  25. package/dist/components/overlays/Drawer.vue +9 -1
  26. package/dist/components/overlays/Drawer.vue.d.ts +9 -0
  27. package/dist/components/overlays/Modal.vue +8 -0
  28. package/dist/components/overlays/Modal.vue.d.ts +9 -0
  29. package/dist/components/overlays/Tooltip.vue +3 -1
  30. package/dist/components/overlays/types.d.ts +1 -0
  31. package/dist/components/templates/AuthLogin.vue +4 -2
  32. package/dist/components/templates/FormDrawer.vue +14 -33
  33. package/dist/components/templates/FormDrawer.vue.d.ts +5 -1
  34. package/dist/components/templates/FormModal.vue +153 -0
  35. package/dist/components/templates/FormModal.vue.d.ts +303 -0
  36. package/dist/components/templates/FormPage.vue +1 -0
  37. package/dist/components/templates/SettingsModal.vue +61 -7
  38. package/dist/components/templates/SettingsModal.vue.d.ts +7 -0
  39. package/dist/components/templates/index.d.ts +1 -0
  40. package/dist/components/templates/index.mjs +1 -0
  41. package/dist/components/templates/types.d.ts +4 -2
  42. package/dist/composables/templates.d.ts +1 -0
  43. package/dist/composables/templates.mjs +1 -0
  44. package/dist/composables/useConfirm.mjs +11 -8
  45. package/dist/composables/useDirtyGuard.mjs +7 -47
  46. package/dist/composables/useForm.d.ts +4 -0
  47. package/dist/composables/useForm.mjs +9 -1
  48. package/dist/composables/useLeaveGuard.d.ts +19 -0
  49. package/dist/composables/useLeaveGuard.mjs +52 -0
  50. package/dist/composables/useRouteRecord.mjs +6 -5
  51. package/dist/grid/DataGrid.vue +124 -8
  52. package/dist/grid/DataGrid.vue.d.ts +7 -23
  53. package/dist/grid/cells/ButtonCell.vue +21 -1
  54. package/dist/grid/cells/ButtonCell.vue.d.ts +4 -0
  55. package/dist/grid/data-grid.css +7 -1
  56. package/dist/grid/types.d.ts +12 -0
  57. package/dist/internal/forms/form-overlay.d.ts +25 -0
  58. package/dist/internal/forms/form-overlay.mjs +31 -0
  59. package/dist/internal/forms/leave.d.ts +30 -0
  60. package/dist/internal/forms/leave.mjs +135 -0
  61. package/dist/internal/keys.d.ts +1 -0
  62. package/dist/internal/keys.mjs +1 -0
  63. package/dist/internal/layout/query.d.ts +4 -0
  64. package/dist/internal/layout/query.mjs +3 -0
  65. package/dist/internal/overlays/DialogFrame.vue +43 -5
  66. package/dist/internal/overlays/DialogFrame.vue.d.ts +11 -1
  67. package/dist/internal/overlays/HintTooltip.vue +65 -0
  68. package/dist/internal/overlays/HintTooltip.vue.d.ts +402 -0
  69. package/dist/internal/overlays/OverlayView.vue.d.ts +10 -4
  70. package/dist/styles/data/record-list.css +31 -1
  71. package/dist/styles/forms/fieldset.css +8 -0
  72. package/dist/styles/overlays/tooltip.css +11 -0
  73. package/dist/styles/templates/form-modal.css +16 -0
  74. package/dist/styles/templates.css +1 -0
  75. package/package.json +1 -1
package/README.md CHANGED
@@ -430,6 +430,35 @@ Several controls in one `FormField`. Only the primary control takes the field id
430
430
  </KFormField>
431
431
  ```
432
432
 
433
+ ### Unsaved changes
434
+
435
+ Every `Form` registers its dirty state in the nearest leave scope while it is mounted, so a form can not be left silently, wherever it is:
436
+
437
+ | Scope | Asks before |
438
+ | ------------------------- | -------------------------------------------------------------------------------------------------------------- |
439
+ | `Modal`, `Drawer` | close (button, Escape, backdrop, `close()`), trail navigation; then `beforeClose` runs |
440
+ | `FormDrawer`, `FormModal` | the same, plus the cancel button (`onCancel` too); `confirmDiscard()` asks on demand |
441
+ | `SettingsModal` | Back, the breadcrumb, another section, `openPage()`, close, a route change of its `route` entry (browser back) |
442
+ | `useRouteRecord` | a navigation that closes or replaces the record, with the topmost open dialog dirty (or your `beforeLeave`) |
443
+ | Page (the app root scope) | a route path change (vue-router or Nuxt, through `$router`) and the tab close (`beforeunload`) |
444
+
445
+ Scopes nest: a dirty form in a drawer also blocks a route change of the page. The question is `useConfirm().discard()` (localized in `en`, `it`, `de`, the copy of the nearest scope: `guardTitle` and `guardMessage` of the overlay), shown once even when several guards ask for the same navigation or click. A form does not block while it is submitting, disabled or read only, and a successful `onSubmit` marks it clean (throw to keep it dirty; without `onSubmit` nothing changes). `form.markClean()` does it by hand (a save outside `onSubmit`), `form.reset(values)` loads new saved values.
446
+
447
+ Opt out per form with `useForm({ guard: false })` or `<KForm :guard="false">`, per overlay with `guard: false` on `Modal`, `Drawer`, `FormDrawer`, `FormModal` or `SettingsModal`, for every form with `createFormConfig({ guard: false })` (`provideFormConfig` in a subtree). Programmatic changes (`open = false`, writing `v-model:pages`) never ask.
448
+
449
+ For state that is not a `Form` (an editable grid with dirty cells, a canvas) register a flag yourself. `useLeaveGuard` joins the nearest scope, `provideLeaveScope()` makes your own component a scope (call `scope.confirmLeave()` before you replace its content). `useDirtyGuard(dirty, options?)` is the same registration with `confirmLeave()` (asks only when its own flag is dirty) and `allowNext()` (lets the next route change through, after a save that navigates).
450
+
451
+ ```ts
452
+ const dirtyCells = ref(0)
453
+ const guard = useLeaveGuard(() => dirtyCells.value > 0, {
454
+ description: 'The edited cells will be lost.',
455
+ })
456
+
457
+ async function switchView() {
458
+ if (await guard.confirmLeave()) view.value = 'list'
459
+ }
460
+ ```
461
+
433
462
  ## Components
434
463
 
435
464
  | Group | Components |
@@ -445,7 +474,19 @@ Several controls in one `FormField`. Only the primary control takes the field id
445
474
  | editor | RichTextEditor |
446
475
  | chart | ChartPanel, ChartLegend, LineChart, BarChart, DoughnutChart |
447
476
 
448
- Composables: `useTheme`, `usePreset`, `useForm`, `useField`, `useFieldControl`, `useToast` (and `toast`), `useConfirm`, `useAlert`, `usePrompt`, `useModal`, `useDrawer`, `useOverlay`, `useModalContext`, `useLoading` (and `withLoading`), `useLoadingState`, `useHotkey`, `useCopy`, `useFileDrop` (with `readDroppedFiles`), `useSortable`, `usePasswordStrength`, `useTableSort`, `useAppShell`, `useRouteState`, `useRouteRecord`, `usePageCommands`, `usePreference` (with `usePreferences`, `createPreferences`, `providePreferences`), `useScrollLock`, `useDirtyGuard`, `useIcons` helpers and `useLinkComponent`, `provideFieldBoundary`, `provideAuxiliaryControls`, `provideForm`, `provideGridConfig` (with `createGridConfig`, `useGridConfig`), `useLocale`. With the Nuxt module also `useDashboard()` (runtime account, breadcrumbs and badges for the `k-dashboard` layout).
477
+ Composables: `useTheme`, `usePreset`, `useForm`, `useField`, `useFieldControl`, `useToast` (and `toast`), `useConfirm`, `useAlert`, `usePrompt`, `useModal`, `useDrawer`, `useOverlay`, `useModalContext`, `useLoading` (and `withLoading`), `useLoadingState`, `useHotkey`, `useCopy`, `useFileDrop` (with `readDroppedFiles`), `useSortable`, `usePasswordStrength`, `useTableSort`, `useAppShell`, `useRouteState`, `useRouteRecord`, `usePageCommands`, `usePreference` (with `usePreferences`, `createPreferences`, `providePreferences`), `useScrollLock`, `useLeaveGuard` (with `useLeaveScope`, `provideLeaveScope`), `useDirtyGuard`, `useIcons` helpers and `useLinkComponent`, `provideFieldBoundary`, `provideAuxiliaryControls`, `provideForm`, `provideGridConfig` (with `createGridConfig`, `useGridConfig`), `useLocale`. With the Nuxt module also `useDashboard()` (runtime account, breadcrumbs and badges for the `k-dashboard` layout).
478
+
479
+ ### Buttons and tooltips
480
+
481
+ - An icon-only `Button` (no label: `square`, or only an `icon`) shows its `aria-label` (or `title`) in a `Tooltip` styled tooltip on hover and keyboard focus, after the usual delay. The native `title` stays only until mount, so there is never a double tooltip. Inside a `Tooltip` trigger the button shows none (the outer tooltip wins); `tooltip: false` turns it off.
482
+ - `tooltip="..."` adds a tooltip to any button, also with a label; when it differs from the accessible name it is also the button description.
483
+ - `disabledReason` explains a disabled button. With `disabled` and a reason the button uses `aria-disabled` instead of `disabled`: it stays in the Tab order and receives hover, clicks (and implicit form submission) are ignored, the reason shows as a tooltip and is linked with `aria-describedby`, and before mount the reason is the native `title`. Without a reason a disabled button behaves as before.
484
+ - The same works for `CommandButton` (`CommandItem.disabledReason`, and `iconOnly` shows the label as a tooltip), `Tabs` (`TabItem.title`, also on a disabled tab), `FormDrawer` and `FormModal` (`deleteHint`) and the grid `ButtonCell` (`tooltip`, `disabled`, `disabledReason` params).
485
+
486
+ ```vue
487
+ <KButton icon="pencil" square variant="ghost" tone="neutral" aria-label="Edit" />
488
+ <KButton :disabled="!canPublish" disabled-reason="Only an admin can publish">Publish</KButton>
489
+ ```
449
490
 
450
491
  ### Colors
451
492
 
@@ -470,7 +511,8 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
470
511
  - `Combobox` with `creatable` takes `createTransform` (`ComboboxCreateTransform`, `(input) => string | null | undefined`) and `createValidate` (`ComboboxCreateValidate`, `(input) => string | true | undefined`). The transform runs on the typed text first: the "Create" option shows its result, and an empty result (or `null`) shows no create option. The validator gets the transformed text when the user picks the create option: a returned string is the error, shown inline through the surrounding `FormField` (`useFieldControl().setControlError`, or a `FieldMessage` under the control and an announcement without a field) with `aria-invalid` on the input, and nothing is created; `true` or nothing accepts it. The error clears when the query changes. Both work with `multiple`, where created values become tags: `<KCombobox v-model="tags" multiple creatable :create-transform="(input) => input.toLowerCase()" :create-validate="(input) => input.length >= 3 || 'Too short'" />`.
471
512
  - `Combobox` takes `createActions` (`ComboboxCreateActions`, `(query) => ComboboxCreateAction[]`) to show several create items instead of the single "Create" item. Each action has `id` (the item key is `__create:<id>`), `label`, `icon` (default `plus`) and `run(query)`. The actions show at the end of the list under the same conditions as the create item: a non-empty query after `createTransform`, with no option whose label or value matches it exactly. The function gets that text, and an empty array shows no action. `createValidate` runs before `run`. When `run` returns an option, the combobox remembers it, emits `create` and selects it. When it returns nothing (for example it opens a form for the full record), nothing is selected: the query clears and the list closes (with `multiple`, only the query clears). Errors from `run` are logged. `createActions` replaces `creatable`: `<KCombobox v-model="category" :options="categories" :create-actions="(query) => [{ id: 'quick', label: 'Create here', run: createCategory }, { id: 'form', label: 'Create with details', icon: 'pencil-square', run: openForm }]" />`.
472
513
  - `Combobox` with `multiple` takes `hideTags`: the selected values are not rendered as tags inside the control (the host shows them elsewhere), the placeholder stays visible and Backspace no longer removes the last value. Selection is still announced through the options. A long tag label is truncated with an ellipsis and the full label (with the option group or description) is in the tag tooltip.
473
- - `RecordList` keeps each title on one line with an ellipsis; the full title is in its `title` attribute. With a `row-click` listener each row is a navigation item (padding, the hover and press background of a ghost button, no separators, the list bleeds into the inline padding so the text stays aligned); a click on a button, link or input inside the row does not emit it, so keep a button in `#action` for the keyboard. `rowClickable(item)` returns `false` for the rows that open nothing: they keep the same padding, without hover and pointer.
514
+ - `RecordList` keeps each title on one line with an ellipsis; the full title is in its `title` attribute. With a `row-click` listener each row is a navigation item (padding, the hover and press background of a ghost button, no separators, the list bleeds into the inline padding so the text stays aligned). The title of a clickable row is a button: Tab reaches every row, Enter or Space emits `row-click`, the focus ring is drawn around the row and the description is the button description. A click anywhere else in the row emits it too, except on a button, link, input, menu item or tab inside the row and inside an open menu, popover or dialog that the row contains; pressing those does not tint the row. Keep the actions of a row as buttons in `#action`, never as a second clickable area. `rowClickable(item)` returns `false` for the rows that open nothing: they keep the same padding, without the button, hover and pointer.
515
+ - `Fieldset` is a native `fieldset`: `disabled` disables every control inside (also the buttons, not the links) and every `FormField` through the form disabled state. `:disabled="false"` enables a group inside a disabled `Form`. When it becomes disabled while a control inside has focus, the focus moves to the fieldset, never to the page. The legend comes from `legend` or the `#legend` slot.
474
516
  - `Pagination` takes `showEdges` (first and last page buttons, `firstLabel`, `lastLabel`) and `showJump` (a typed page number, `jumpLabel`). Both are off by default. `page` is clamped to the page count only when `total` is known: while `total` is `0` or `loading` is set (it also sets `aria-busy`), the page is kept, so a server reload does not reset it.
475
517
  - Page sizes are `PageSize` values (`number | 'all'`): `pageSizes: [25, 50, 100, 'all']` adds an "All" option (`pagination.all`, override with `allLabel`). With `'all'` the page size model is `'all'`, there is one page and the summary reads `1-<total> of <total>`. `Pagination`, `ListPage` and `DataGrid` take it; with `serverPagination` the grid emits `'all'` through `v-model:page-size` and your API returns every row.
476
518
  - `FilterPills` can list active filters: options with `removable: true` render as active pills with a remove button (`removeLabel`, a `'Remove {label}'` template). Clicking the pill emits `select(value)`, the button emits `remove(value)` (and drops the value from the model when it is selected); focus moves to the next pill when the removed one disappears.
@@ -483,7 +525,7 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
483
525
  <KStepper v-model="step" :steps="steps" linear label="Import" />
484
526
  ```
485
527
 
486
- - `Tabs` items take `dot: true` for a small indicator without a number (`dotTone`, default `danger`; `dotLabel` is the hidden text, default "Needs attention"). `color` (a palette name or a hex, `ColorValue`) draws a small color dot before the label, separate from the status dot. `title` is the native tooltip of the tab; a disabled tab keeps it (it uses `aria-disabled`, cannot be selected and is skipped by Tab and the arrow keys), so it can say why it is disabled. The same items work in the `tabs` of `Modal`, `Drawer`, `FormDrawer` and `DetailPage`.
528
+ - `Tabs` items take `dot: true` for a small indicator without a number (`dotTone`, default `danger`; `dotLabel` is the hidden text, default "Needs attention"). `color` (a palette name or a hex, `ColorValue`) draws a small color dot before the label, separate from the status dot. `title` shows a tooltip on hover and keyboard focus (the native `title` only until mount) and becomes the tab description; a disabled tab keeps it (it uses `aria-disabled`, cannot be selected and is skipped by Tab and the arrow keys), so it can say why it is disabled. The same items work in the `tabs` of `Modal`, `Drawer`, `FormDrawer` and `DetailPage`.
487
529
  - `DropdownMenu` takes `matchTriggerWidth` (the menu is at least as wide as its trigger) and `minWidth` (a CSS length).
488
530
  - `PageHeader` takes `align` (`'end'` by default, `'start'` or `'center'`) for the title block and the actions, and `truncate` to keep the title on one line with an ellipsis (the full title is in its `title` attribute).
489
531
  - `RichTextEditor` accepts `'underline'` in `toolbar` (not in the default toolbar).
@@ -581,7 +623,7 @@ await run(() => api.save(form))
581
623
 
582
624
  ### Dialogs
583
625
 
584
- `Modal` and `Drawer` take `beforeClose(reason)` (`'escape' | 'backdrop' | 'close-button' | 'action'`). It runs for every user close: Escape, a backdrop click, the close button and the `close` function of the slots. Return `false` (or a promise of `false`) to keep the dialog open, for example to ask before discarding changes. Setting `v-model:open` to `false` from the parent always closes. `useModal().open()` and `useDrawer().open()` take `beforeClose` too.
626
+ `Modal` and `Drawer` take `beforeClose(reason)` (`'escape' | 'backdrop' | 'close-button' | 'action'`). It runs for every user close: Escape, a backdrop click, the close button and the `close` function of the slots. Return `false` (or a promise of `false`) to keep the dialog open. A dirty `Form` inside already asks before any of these closes and before a trail navigation (`guard`, default `true`, copy in `guardTitle` and `guardMessage`; see [Unsaved changes](#unsaved-changes)); `beforeClose` runs after that question. Setting `v-model:open` to `false` from the parent always closes. `confirmLeave()` (exposed) asks on demand. `useModal().open()` and `useDrawer().open()` take `beforeClose` too.
585
627
 
586
628
  ```vue
587
629
  <KDrawer v-model:open="open" title="Spring campaign" :before-close="confirmDiscard">
@@ -618,7 +660,7 @@ const confirmDiscard = () => !dirty.value || confirm({ title: 'Discard changes?'
618
660
 
619
661
  ### Deep links
620
662
 
621
- `useRouteRecord(key, options?)` is the record version of `useRouteState`. `#family/fam_1` opens a record and `#family/new` the create form (`newId`). Options: `find(id)` (gives `current`), `loaded` (while false, `loading` is true, so the drawer opens at once with its skeleton; when true and `find` gives nothing, the entry is removed), `canCreate`, `linkedKeys` (entries removed together with the record, such as a tab or a sub record), `beforeLeave` (a function that returns `true` or `false`, or a promise of it, called before a navigation would close the open record or show another one: the entry changes or is removed, or the path changes while it is open; `false` cancels the navigation, so the back button, a link or a row of another record ask the same discard question as the drawer). It returns `param`, `id`, `isNew`, `current`, `loading`, `open` (for `v-model:open`), `openRecord(id | null, linked?)`, `close()` and `replaceId(id, linked?)` (after a create). All the entries change in one navigation. `close()`, `open = false`, `openRecord()` and `replaceId()` skip `beforeLeave` (they come after the drawer question or are on purpose). The guard is registered on mount, only in a component with a router.
663
+ `useRouteRecord(key, options?)` is the record version of `useRouteState`. `#family/fam_1` opens a record and `#family/new` the create form (`newId`). Options: `find(id)` (gives `current`), `loaded` (while false, `loading` is true, so the drawer opens at once with its skeleton; when true and `find` gives nothing, the entry is removed), `canCreate`, `linkedKeys` (entries removed together with the record, such as a tab or a sub record), `beforeLeave` (a function that returns `true` or `false`, or a promise of it, called before a navigation would close the open record or show another one: the entry changes or is removed, or the path changes while it is open; `false` cancels the navigation, so the back button, a link or a row of another record ask the same discard question as the drawer; without it the leave guard of the topmost open dialog asks, see [Unsaved changes](#unsaved-changes)). It returns `param`, `id`, `isNew`, `current`, `loading`, `open` (for `v-model:open`), `openRecord(id | null, linked?)`, `close()` and `replaceId(id, linked?)` (after a create). All the entries change in one navigation. `close()`, `open = false`, `openRecord()` and `replaceId()` skip `beforeLeave` (they come after the drawer question or are on purpose). The guard is registered on mount, only in a component with a router.
622
664
 
623
665
  ```ts
624
666
  const drawer = useTemplateRef<{ confirmDiscard: () => Promise<boolean> }>('drawer')
@@ -779,18 +821,19 @@ Both take the `AuthLayout` frame props and the `brand`, `corner`, `footer` and `
779
821
 
780
822
  ### Page templates
781
823
 
782
- | Component | What it gives you |
783
- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
784
- | `DashboardPage` | PageHeader (`title`, `eyebrow`, `description`, `#actions`), a Stat grid from `stats` (or `#stats`), a content grid (`columns`, default 1 then 3 columns). |
785
- | `ListPage` | Header, toolbar (search with `searchable`, FilterPills from `filters`, `#toolbar`, `#bulk` when rows are selected), Table from `columns`/`rows`, Pagination. Client mode filters (`searchKeys`, `filterKey`), sorts and paginates; pass `total` for server mode. States: `loading` skeleton rows, first run `#empty`, no results with a clear button, `error` with retry. `cell-*` and `header-*` slots go to the Table. |
786
- | `DetailPage` | Back link (`backTo`), title, `status` badge, `#actions`, optional `tabs` (`#panel-<value>`), main column plus an aside with DescriptionList cards from `sections` (or `#aside`). `loading` and `error` states. |
787
- | `FormDrawer` | A `Drawer` with a `Form` (`form` from `useForm`) around the body and a footer: delete on the left (`deletable`, `@delete`, `deleteDisabled`, `deleteHint`), cancel and submit on the right. `creating` changes the submit text to Create and enables it without changes; otherwise it needs a dirty form (`requireDirty`). `readonly` keeps only a Close button and disables every field of the body (see [Forms](#forms)). Every close asks before discarding a dirty form (`guard`), then runs `beforeClose`. `onCancel` replaces the close of the cancel button (back to a parent view), after the same question. `loading` shows a `SkeletonForm` (or `#skeleton`) and keeps the header, the tabs and the footer in place. Pass another `form` to switch the body to a subpage (with `trail`). A tab with `fill: true` (`FormDrawerTab`) makes the drawer `fill` while it is active (a tab with a long table). |
788
- | `FormPage` | Header, your cards inside `Form` (`form` from `useForm`, or a plain `form` emitting `submit`), sticky footer with cancel and submit, unsaved state, dirty guard (`guard`, on by default) through `useDirtyGuard`. |
789
- | `SettingsPage`, `SettingsSection`, `SaveBar` | Section nav (sticky on the left, a scrolling row on narrow screens; items with `to` become route links), `#section-<value>` panels, section cards with a save footer, and a floating save bar while `dirty`. |
790
- | `ErrorPage`, `NotFoundPage` | Status code, title, message (defaults per status code, reads a Nuxt `error`), home, retry (`@retry`) and back actions. `@home` replaces the home link, handy for `clearError`. |
791
- | `EmptyPage` | First run screen: illustration, title, description, primary and secondary actions, onboarding `steps`. |
824
+ | Component | What it gives you |
825
+ | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
826
+ | `DashboardPage` | PageHeader (`title`, `eyebrow`, `description`, `#actions`), a Stat grid from `stats` (or `#stats`), a content grid (`columns`, default 1 then 3 columns). |
827
+ | `ListPage` | Header, toolbar (search with `searchable`, FilterPills from `filters`, `#toolbar`, `#bulk` when rows are selected), Table from `columns`/`rows`, Pagination. Client mode filters (`searchKeys`, `filterKey`), sorts and paginates; pass `total` for server mode. States: `loading` skeleton rows, first run `#empty`, no results with a clear button, `error` with retry. `cell-*` and `header-*` slots go to the Table. |
828
+ | `DetailPage` | Back link (`backTo`), title, `status` badge, `#actions`, optional `tabs` (`#panel-<value>`), main column plus an aside with DescriptionList cards from `sections` (or `#aside`). `loading` and `error` states. |
829
+ | `FormDrawer` | A `Drawer` with a `Form` (`form` from `useForm`) around the body and a footer: delete on the left (`deletable`, `@delete`, `deleteDisabled`, `deleteHint`), cancel and submit on the right. `creating` changes the submit text to Create and enables it without changes; otherwise it needs a dirty form (`requireDirty`). `readonly` keeps only a Close button and disables every field of the body (see [Forms](#forms)). Every close asks before discarding a dirty form (`guard`, the leave guard of its `Drawer`), then runs `beforeClose`. `deleteHint` is the tooltip of the delete button, and its reason when `deleteDisabled`. `onCancel` replaces the close of the cancel button (back to a parent view), after the same question. `loading` shows a `SkeletonForm` (or `#skeleton`) and keeps the header, the tabs and the footer in place. Pass another `form` to switch the body to a subpage (with `trail`). A tab with `fill: true` (`FormDrawerTab`) makes the drawer `fill` while it is active (a tab with a long table). |
830
+ | `FormModal` | The modal version of `FormDrawer`: a `Modal` with a `Form` around the body, footer with delete (`deletable`, `deleteDisabled`, `deleteHint`), cancel (ghost) and submit (`creating`, `requireDirty`, `submitting` state), the leave guard on close and cancel, `loading` skeleton, `readonly`. `nested` renders the form as a `div`, for a modal opened from a field of another form (its footer submit then calls `submit()`). `@submitted` fires after a successful submit. |
831
+ | `FormPage` | Header, your cards inside `Form` (`form` from `useForm`, or a plain `form` emitting `submit`), sticky footer with cancel and submit, unsaved state, dirty guard (`guard`, on by default) through `useDirtyGuard`. |
832
+ | `SettingsPage`, `SettingsSection`, `SaveBar` | Section nav (sticky on the left, a scrolling row on narrow screens; items with `to` become route links), `#section-<value>` panels, section cards with a save footer, and a floating save bar while `dirty`. |
833
+ | `ErrorPage`, `NotFoundPage` | Status code, title, message (defaults per status code, reads a Nuxt `error`), home, retry (`@retry`) and back actions. `@home` replaces the home link, handy for `clearError`. |
834
+ | `EmptyPage` | First run screen: illustration, title, description, primary and secondary actions, onboarding `steps`. |
792
835
 
793
- `useDirtyGuard(dirty, options?)` asks before leaving (router navigation through `ConfirmHost`, or the native confirm) and on tab close. Returns `confirmLeave()` and `allowNext()`.
836
+ `useDirtyGuard(dirty, options?)` asks before leaving (router navigation through `ConfirmHost`, or the native confirm) and on tab close. Returns `confirmLeave()` and `allowNext()`. It is built on the leave guard, see [Unsaved changes](#unsaved-changes).
794
837
 
795
838
  ### Nuxt: your own layout
796
839
 
@@ -939,6 +982,17 @@ Accessibility related props and defaults:
939
982
  - A column without a visible header (a photo column) keeps a name for the Columns menu with `headerValueGetter: ({ location }) => (location === 'header' ? '' : 'Photo')`: the menu reads the name for the `columnToolPanel` location.
940
983
  - `DataGrid` takes `gridOptions` for any AG Grid option it does not wrap (`rowHeight`, `onCellEditingStopped`, `onFilterChanged`, ...). A prop of `DataGrid` wins only when it is set: `getRowId`, `rowSelection` (when `selectable` is off), `autoSizeStrategy` (also `undefined` to turn it off), `tooltipShowDelay`, `overlayNoRowsTemplate` and `overlayLoadingTemplate` from `gridOptions` are used otherwise; `defaultColDef` and `localeText` are merged over the component defaults, and `context` is merged under the cell context. Handlers from both run.
941
984
  - `DataGrid` row ids: `getRowId: (params) => string` (wins), `rowIdKey` (a field of the row), or `gridOptions.getRowId`.
985
+ - `DataGrid` `v-model:selected` (`string[]`) is the selected row ids, two way, for `selectable` grids (also `'single'`, at most one id). It needs row ids (`rowIdKey`, `getRowId` or `gridOptions.getRowId`); a dev warning tells you when they are missing. Leave it unbound for an uncontrolled grid. The header checkbox selects all the filtered rows (`selectAll: 'filtered'`): not the rows hidden by the search or the column filters, and not only the current page. A selected row stays selected when a filter hides it, and client pagination keeps the selection across pages. A row that disappears from `rows` is dropped from the model, except while `loading` is set or the rows are empty, so a preselected model survives the first load. With `serverPagination` the ids of rows that are not in the current `rows` stay in the model: the selection survives a page change and a re-fetch, the footer counts the whole model, and the header checkbox only selects the rows of the page. Ids of rows that are not loaded yet stay out of the grid and are selected when the rows arrive. `selectionChange` still emits the selected rows of the grid.
986
+ - `DataGrid` template ref methods have a type: `DataGridMethods<Row>` (`api`, `getSelectedRows`, `getSelectedIds`, `selectRows(ids)`, `selectAllRows()` for the filtered rows, `deselectAll`, `resetColumns` and the `GridSpreadsheetMethods`; `selectAll` stays the cell range one of the spreadsheet).
987
+
988
+ ```ts
989
+ import type { DataGridMethods } from '@xleddyl/443-components-vue/grid'
990
+
991
+ const grid = useTemplateRef<DataGridMethods<Row>>('grid')
992
+ grid.value?.selectAllRows()
993
+ const ids = grid.value?.getSelectedIds()
994
+ ```
995
+
942
996
  - `DataGrid` `fill` makes the grid, with its toolbar and footer, fill its parent (a flex or grid item with `flex: 1; min-height: 0`, or `height: 100%` in a block with a height) instead of the fixed `height`. Ignored with `autoHeight`.
943
997
  - `DataGrid` `showEdges` and `showJump` reach the footer pager (first and last page buttons, page number input). `loading` also keeps the pager from resetting the page while a server total is unknown.
944
998
  - `DataGrid` registers the AG Grid cell editors (text, large text, number, date, checkbox, select, custom and undo/redo) when `editable` is set or when a column or `gridOptions.defaultColDef` has `editable` at mount. `registerGridEditorModules()` from `/grid` does it by hand, before the first grid mounts, for columns that become editable later.
@@ -7,10 +7,15 @@
7
7
  :target="target"
8
8
  :external="external || void 0"
9
9
  :class="classes"
10
+ :title="titleAttr"
11
+ :aria-describedby="describedBy"
12
+ @pointerenter="armHint"
13
+ @focusin="armHint"
10
14
  >
11
15
  <ButtonContent v-bind="contentProps"
12
16
  ><slot>{{ label }}</slot></ButtonContent
13
17
  >
18
+ <HintTooltip v-if="showHint" :id="hintId" :text="hintText" />
14
19
  </component>
15
20
  <a
16
21
  v-else-if="isLink"
@@ -22,33 +27,46 @@
22
27
  :aria-disabled="inactive ? 'true' : void 0"
23
28
  :aria-busy="busy ? 'true' : void 0"
24
29
  :class="classes"
30
+ :title="titleAttr"
31
+ :aria-describedby="describedBy"
32
+ @pointerenter="armHint"
33
+ @focusin="armHint"
25
34
  >
26
35
  <ButtonContent v-bind="contentProps"
27
36
  ><slot>{{ label }}</slot></ButtonContent
28
37
  >
38
+ <HintTooltip v-if="showHint" :id="hintId" :text="hintText" />
29
39
  </a>
30
40
  <button
31
41
  v-else
32
42
  v-bind="$attrs"
33
43
  :type="type"
34
- :disabled="disabled || void 0"
35
- :aria-disabled="busy && !disabled ? 'true' : ariaDisabledAttr"
44
+ :disabled="disabled && !reasonActive || void 0"
45
+ :aria-disabled="reasonActive || busy && !disabled ? 'true' : ariaDisabledAttr"
36
46
  :aria-busy="busy ? 'true' : void 0"
37
47
  :class="classes"
48
+ :title="titleAttr"
49
+ :aria-describedby="describedBy"
38
50
  @click.capture="onBusyClick"
51
+ @pointerenter="armHint"
52
+ @focusin="armHint"
39
53
  >
40
54
  <ButtonContent v-bind="contentProps"
41
55
  ><slot>{{ label }}</slot></ButtonContent
42
56
  >
57
+ <HintTooltip v-if="showHint" :id="hintId" :text="hintText" />
43
58
  </button>
44
59
  </template>
45
60
 
46
61
  <script setup>
47
- import { computed, onMounted, useAttrs, useSlots, warn } from "vue";
62
+ import { computed, inject, onMounted, ref, useAttrs, useId, useSlots, warn } from "vue";
48
63
  import { useFormContext } from "../../composables/useForm";
49
64
  import { useLinkComponent } from "../../composables/useLink";
50
65
  import ButtonContent from "../../internal/core/ButtonContent.vue";
51
66
  import { linkHref } from "../../internal/core/link";
67
+ import { joinIds } from "../../internal/forms/control";
68
+ import { TOOLTIP_TRIGGER_KEY } from "../../internal/keys";
69
+ import HintTooltip from "../../internal/overlays/HintTooltip.vue";
52
70
  defineOptions({ inheritAttrs: false });
53
71
  const props = defineProps({
54
72
  label: { type: String, required: false },
@@ -65,7 +83,9 @@ const props = defineProps({
65
83
  disabled: { type: Boolean, required: false },
66
84
  loading: { type: Boolean, required: false },
67
85
  block: { type: Boolean, required: false },
68
- square: { type: Boolean, required: false }
86
+ square: { type: Boolean, required: false },
87
+ tooltip: { type: [String, Boolean], required: false, default: void 0 },
88
+ disabledReason: { type: String, required: false }
69
89
  });
70
90
  const slots = useSlots();
71
91
  const attrs = useAttrs();
@@ -93,8 +113,49 @@ const classes = computed(() => [
93
113
  const ariaDisabledAttr = computed(
94
114
  () => attrs["aria-disabled"]
95
115
  );
116
+ const insideTooltip = inject(TOOLTIP_TRIGGER_KEY, false);
117
+ const hintId = `${useId()}-hint`;
118
+ const mounted = ref(false);
119
+ const hintArmed = ref(false);
120
+ const reasonActive = computed(() => Boolean(props.disabled && props.disabledReason));
121
+ function textAttr(name) {
122
+ const value = attrs[name];
123
+ return typeof value === "string" && value.trim() ? value : void 0;
124
+ }
125
+ const hintText = computed(() => {
126
+ if (reasonActive.value) return props.disabledReason;
127
+ if (props.tooltip === false || insideTooltip) return void 0;
128
+ if (props.tooltip) return props.tooltip;
129
+ if (hasLabel.value) return void 0;
130
+ return textAttr("aria-label") ?? textAttr("title");
131
+ });
132
+ const describes = computed(() => {
133
+ const text = hintText.value;
134
+ if (!text) return false;
135
+ if (reasonActive.value) return true;
136
+ const name = textAttr("aria-label") ?? (hasLabel.value ? void 0 : textAttr("title"));
137
+ return Boolean(props.tooltip) && text !== name;
138
+ });
139
+ const showHint = computed(
140
+ () => Boolean(hintText.value) && mounted.value && (hintArmed.value || describes.value)
141
+ );
142
+ const titleAttr = computed(() => {
143
+ const own = attrs.title;
144
+ if (!hintText.value) return own;
145
+ if (mounted.value) return void 0;
146
+ return reasonActive.value ? props.disabledReason : own;
147
+ });
148
+ const describedBy = computed(
149
+ () => joinIds(
150
+ attrs["aria-describedby"],
151
+ showHint.value && describes.value ? hintId : void 0
152
+ )
153
+ );
154
+ function armHint() {
155
+ if (hintText.value) hintArmed.value = true;
156
+ }
96
157
  function onBusyClick(event) {
97
- if (!busy.value) return;
158
+ if (!busy.value && !reasonActive.value) return;
98
159
  event.preventDefault();
99
160
  event.stopImmediatePropagation();
100
161
  }
@@ -105,6 +166,7 @@ const contentProps = computed(() => ({
105
166
  trailingIcon: props.trailingIcon
106
167
  }));
107
168
  onMounted(() => {
169
+ mounted.value = true;
108
170
  const named = attrs["aria-label"] || attrs["aria-labelledby"] || attrs.title;
109
171
  if (iconOnly.value && !hasLabel.value && !named)
110
172
  warn(
@@ -1,12 +1,12 @@
1
1
  import type { IconName } from '../../composables/useIcons';
2
2
  import type { ButtonSize, ButtonVariant, LinkTarget, Tone } from './types';
3
- declare var __VLS_13: {}, __VLS_21: {}, __VLS_29: {};
3
+ declare var __VLS_16: {}, __VLS_29: {}, __VLS_42: {};
4
4
  type __VLS_Slots = {} & {
5
- default?: (props: typeof __VLS_13) => any;
6
- } & {
7
- default?: (props: typeof __VLS_21) => any;
5
+ default?: (props: typeof __VLS_16) => any;
8
6
  } & {
9
7
  default?: (props: typeof __VLS_29) => any;
8
+ } & {
9
+ default?: (props: typeof __VLS_42) => any;
10
10
  };
11
11
  declare const __VLS_base: import("vue").DefineComponent<{
12
12
  label?: string;
@@ -24,6 +24,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
24
24
  loading?: boolean;
25
25
  block?: boolean;
26
26
  square?: boolean;
27
+ tooltip?: string | false;
28
+ disabledReason?: string;
27
29
  download?: any;
28
30
  hreflang?: string | undefined | undefined;
29
31
  media?: string | undefined | undefined;
@@ -249,6 +251,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
249
251
  loading?: boolean;
250
252
  block?: boolean;
251
253
  square?: boolean;
254
+ tooltip?: string | false;
255
+ disabledReason?: string;
252
256
  download?: any;
253
257
  hreflang?: string | undefined | undefined;
254
258
  media?: string | undefined | undefined;
@@ -461,6 +465,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
461
465
  }> & Readonly<{}>, {
462
466
  size: ButtonSize;
463
467
  tone: Tone;
468
+ tooltip: string | false;
464
469
  type: "submit" | "button" | "reset";
465
470
  variant: ButtonVariant;
466
471
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -62,14 +62,17 @@
62
62
  <script setup>
63
63
  import { computed, nextTick, useTemplateRef } from "vue";
64
64
  import { provideForm } from "../../composables/useForm";
65
+ import { useLeaveScope } from "../../composables/useLeaveGuard";
65
66
  import { provideFormDisabled } from "../../internal/forms/disabled";
67
+ import { registerLeaveEntry } from "../../internal/forms/leave";
66
68
  import FormAlerts from "./FormAlerts.vue";
67
69
  const props = defineProps({
68
70
  form: { type: Object, required: true },
69
71
  as: { type: String, required: false, default: "form" },
70
72
  focusOnError: { type: Boolean, required: false, default: true },
71
73
  alerts: { type: [String, Boolean], required: false, default: "start" },
72
- disabled: { type: Boolean, required: false, default: void 0 }
74
+ disabled: { type: Boolean, required: false, default: void 0 },
75
+ guard: { type: Boolean, required: false, default: void 0 }
73
76
  });
74
77
  const emit = defineEmits(["submitted", "invalid", "reset"]);
75
78
  const formRef = useTemplateRef("formRef");
@@ -78,7 +81,10 @@ const rootRef = computed(() => formRef.value ?? divRef.value);
78
81
  const rootErrors = computed(() => props.form.rootErrors?.value ?? []);
79
82
  const rootWarnings = computed(() => props.form.rootWarnings?.value ?? []);
80
83
  provideForm(props.form);
81
- provideFormDisabled(() => props.disabled);
84
+ const inactive = provideFormDisabled(() => props.disabled);
85
+ registerLeaveEntry(useLeaveScope(), {
86
+ dirty: () => (props.guard ?? props.form.guard) !== false && !inactive.value && props.form.dirty.value && !props.form.submitting.value
87
+ });
82
88
  const IMPLICIT_SUBMIT_SKIP = /* @__PURE__ */ new Set([
83
89
  "button",
84
90
  "submit",
@@ -6,6 +6,7 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
6
6
  focusOnError?: boolean;
7
7
  alerts?: "start" | "end" | false;
8
8
  disabled?: boolean;
9
+ guard?: boolean;
9
10
  } & {
10
11
  onInvalid?: (() => any) | undefined;
11
12
  onReset?: (() => any) | undefined;
@@ -226,6 +226,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
226
226
  exportparts?: string | undefined;
227
227
  part?: string | undefined;
228
228
  popover?: (import("../../index.ts").PopoverMode | "" | boolean) | undefined;
229
+ capture?: boolean | "user" | "environment" | undefined | undefined;
229
230
  autofocus?: (boolean | "true" | "false") | undefined;
230
231
  formaction?: string | undefined | undefined;
231
232
  formenctype?: string | undefined | undefined;
@@ -239,7 +240,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
239
240
  multiple?: (boolean | "true" | "false") | undefined;
240
241
  accept?: string | undefined | undefined;
241
242
  alt?: string | undefined | undefined;
242
- capture?: boolean | "user" | "environment" | undefined | undefined;
243
243
  crossorigin?: string | undefined | undefined;
244
244
  minlength?: (string | number) | undefined;
245
245
  src?: string | undefined | undefined;
@@ -471,6 +471,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
471
471
  exportparts?: string | undefined;
472
472
  part?: string | undefined;
473
473
  popover?: (import("../../index.ts").PopoverMode | "" | boolean) | undefined;
474
+ capture?: boolean | "user" | "environment" | undefined | undefined;
474
475
  autofocus?: (boolean | "true" | "false") | undefined;
475
476
  formaction?: string | undefined | undefined;
476
477
  formenctype?: string | undefined | undefined;
@@ -484,7 +485,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
484
485
  multiple?: (boolean | "true" | "false") | undefined;
485
486
  accept?: string | undefined | undefined;
486
487
  alt?: string | undefined | undefined;
487
- capture?: boolean | "user" | "environment" | undefined | undefined;
488
488
  crossorigin?: string | undefined | undefined;
489
489
  minlength?: (string | number) | undefined;
490
490
  src?: string | undefined | undefined;
@@ -8,7 +8,7 @@
8
8
  :aria-label="label"
9
9
  >
10
10
  <li
11
- v-for="item in items"
11
+ v-for="(item, index) in items"
12
12
  :key="item.id"
13
13
  class="k-record-list-item"
14
14
  :class="{ 'is-interactive': clickable(item) }"
@@ -17,7 +17,17 @@
17
17
  <slot name="leading" :item="item" />
18
18
  <div class="k-record-list-text">
19
19
  <span class="k-record-list-title-row">
20
- <span class="k-record-list-title" :title="item.title">{{ item.title }}</span>
20
+ <button
21
+ v-if="clickable(item)"
22
+ type="button"
23
+ class="k-record-list-title k-record-list-trigger"
24
+ :title="item.title"
25
+ :aria-describedby="item.description ? descriptionId(index) : void 0"
26
+ @click="emit('rowClick', item, $event)"
27
+ >
28
+ {{ item.title }}
29
+ </button>
30
+ <span v-else class="k-record-list-title" :title="item.title">{{ item.title }}</span>
21
31
  <Badge
22
32
  v-if="item.badge"
23
33
  :label="item.badge.label"
@@ -25,7 +35,11 @@
25
35
  size="sm"
26
36
  />
27
37
  </span>
28
- <span v-if="item.description" class="k-record-list-description">
38
+ <span
39
+ v-if="item.description"
40
+ :id="descriptionId(index)"
41
+ class="k-record-list-description"
42
+ >
29
43
  {{ item.description }}
30
44
  </span>
31
45
  </div>
@@ -48,7 +62,7 @@
48
62
  </template>
49
63
 
50
64
  <script setup>
51
- import { computed, getCurrentInstance } from "vue";
65
+ import { computed, getCurrentInstance, useId } from "vue";
52
66
  import { useLocale } from "../../composables/useLocale";
53
67
  import EmptyState from "../feedback/EmptyState.vue";
54
68
  import SkeletonList from "../feedback/SkeletonList.vue";
@@ -70,7 +84,12 @@ defineSlots();
70
84
  const emit = defineEmits(["rowClick"]);
71
85
  const { t } = useLocale();
72
86
  const instance = getCurrentInstance();
73
- const interactiveSelector = 'a, button, input, select, textarea, label, summary, [role="button"]';
87
+ const baseId = useId();
88
+ function descriptionId(index) {
89
+ return `${baseId}-description-${index}`;
90
+ }
91
+ const interactiveSelector = 'a, button, input, select, textarea, label, summary, [contenteditable="true"], [role="button"], [role="menuitem"], [role="option"], [role="checkbox"], [role="switch"], [role="tab"]';
92
+ const layerSelector = "dialog, [popover], .k-floating";
74
93
  const hasRowClick = computed(
75
94
  () => Boolean(instance?.vnode.props?.onRowClick || instance?.vnode.props?.["onRow-click"])
76
95
  );
@@ -78,9 +97,12 @@ function clickable(item) {
78
97
  return hasRowClick.value && (props.rowClickable?.(item) ?? true);
79
98
  }
80
99
  function onRowClick(item, event) {
81
- if (!clickable(item)) return;
100
+ if (!clickable(item) || event.defaultPrevented) return;
82
101
  const row = event.currentTarget;
83
- const origin = event.target?.closest(interactiveSelector);
102
+ const target = event.target instanceof Element ? event.target : null;
103
+ const layer = target?.closest(layerSelector);
104
+ if (layer && row.contains(layer)) return;
105
+ const origin = target?.closest(interactiveSelector);
84
106
  if (origin && row.contains(origin)) return;
85
107
  if (window.getSelection()?.toString()) return;
86
108
  emit("rowClick", item, event);
@@ -216,6 +216,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
216
216
  exportparts?: string | undefined;
217
217
  part?: string | undefined;
218
218
  popover?: (import("../../index.ts").PopoverMode | "" | boolean) | undefined;
219
+ capture?: boolean | "user" | "environment" | undefined | undefined;
219
220
  autofocus?: (boolean | "true" | "false") | undefined;
220
221
  formaction?: string | undefined | undefined;
221
222
  formenctype?: string | undefined | undefined;
@@ -229,7 +230,6 @@ declare const __VLS_export: import("vue").DefineComponent<{
229
230
  multiple?: (boolean | "true" | "false") | undefined;
230
231
  accept?: string | undefined | undefined;
231
232
  alt?: string | undefined | undefined;
232
- capture?: boolean | "user" | "environment" | undefined | undefined;
233
233
  crossorigin?: string | undefined | undefined;
234
234
  minlength?: (string | number) | undefined;
235
235
  src?: string | undefined | undefined;
@@ -455,6 +455,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
455
455
  exportparts?: string | undefined;
456
456
  part?: string | undefined;
457
457
  popover?: (import("../../index.ts").PopoverMode | "" | boolean) | undefined;
458
+ capture?: boolean | "user" | "environment" | undefined | undefined;
458
459
  autofocus?: (boolean | "true" | "false") | undefined;
459
460
  formaction?: string | undefined | undefined;
460
461
  formenctype?: string | undefined | undefined;
@@ -468,7 +469,6 @@ declare const __VLS_export: import("vue").DefineComponent<{
468
469
  multiple?: (boolean | "true" | "false") | undefined;
469
470
  accept?: string | undefined | undefined;
470
471
  alt?: string | undefined | undefined;
471
- capture?: boolean | "user" | "environment" | undefined | undefined;
472
472
  crossorigin?: string | undefined | undefined;
473
473
  minlength?: (string | number) | undefined;
474
474
  src?: string | undefined | undefined;
@@ -215,6 +215,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
215
215
  part?: string;
216
216
  popover?: import("../../index.ts").PopoverMode | "" | boolean;
217
217
  numeric?: boolean;
218
+ capture?: boolean | "user" | "environment" | undefined;
218
219
  autofocus?: (boolean | "true" | "false") | undefined;
219
220
  formaction?: string | undefined;
220
221
  formenctype?: string | undefined;
@@ -238,7 +239,6 @@ declare const __VLS_export: import("vue").DefineComponent<{
238
239
  multiple?: (boolean | "true" | "false") | undefined;
239
240
  accept?: string | undefined;
240
241
  alt?: string | undefined;
241
- capture?: boolean | "user" | "environment" | undefined;
242
242
  crossorigin?: string | undefined;
243
243
  minlength?: (string | number) | undefined;
244
244
  src?: string | undefined;
@@ -462,6 +462,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
462
462
  part?: string;
463
463
  popover?: import("../../index.ts").PopoverMode | "" | boolean;
464
464
  numeric?: boolean;
465
+ capture?: boolean | "user" | "environment" | undefined;
465
466
  autofocus?: (boolean | "true" | "false") | undefined;
466
467
  formaction?: string | undefined;
467
468
  formenctype?: string | undefined;
@@ -485,7 +486,6 @@ declare const __VLS_export: import("vue").DefineComponent<{
485
486
  multiple?: (boolean | "true" | "false") | undefined;
486
487
  accept?: string | undefined;
487
488
  alt?: string | undefined;
488
- capture?: boolean | "user" | "environment" | undefined;
489
489
  crossorigin?: string | undefined;
490
490
  minlength?: (string | number) | undefined;
491
491
  src?: string | undefined;
@@ -1,15 +1,29 @@
1
1
  <template>
2
- <fieldset class="k-fieldset" :disabled="inactive">
3
- <legend v-if="legend" class="k-fieldset-legend">{{ legend }}</legend>
2
+ <fieldset ref="root" class="k-fieldset" :disabled="inactive">
3
+ <legend v-if="legend || $slots.legend" class="k-fieldset-legend">
4
+ <slot name="legend">{{ legend }}</slot>
5
+ </legend>
4
6
  <slot />
5
7
  </fieldset>
6
8
  </template>
7
9
 
8
10
  <script setup>
11
+ import { useTemplateRef, watch } from "vue";
12
+ import { focusStable, hasFocusWithin } from "../../internal/core/focus";
9
13
  import { provideFormDisabled } from "../../internal/forms/disabled";
10
14
  const props = defineProps({
11
15
  disabled: { type: Boolean, required: false, default: void 0 },
12
16
  legend: { type: String, required: false }
13
17
  });
18
+ defineSlots();
19
+ const root = useTemplateRef("root");
14
20
  const inactive = provideFormDisabled(() => props.disabled);
21
+ watch(
22
+ inactive,
23
+ (disabled) => {
24
+ const element = root.value;
25
+ if (disabled && element && hasFocusWithin(element)) focusStable(element);
26
+ },
27
+ { flush: "pre" }
28
+ );
15
29
  </script>