@xleddyl/443-components-vue 0.16.72 → 0.16.74
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/CATALOG.md +49 -48
- package/README.md +2 -1
- package/dist/components/forms/Combobox.vue +114 -14
- package/dist/components/forms/Combobox.vue.d.ts +4 -3
- package/dist/components/forms/PaletteSelect.vue +1 -0
- package/dist/components/forms/PaletteSelect.vue.d.ts +4 -2
- package/dist/components/templates/DashboardLayout.vue +3 -0
- package/dist/components/templates/DashboardLayout.vue.d.ts +3 -0
- package/dist/components/templates/SettingsModal.vue +3 -0
- package/dist/components/templates/SettingsModal.vue.d.ts +3 -0
- package/dist/grid/GridToolbar.vue.d.ts +1 -1
- package/dist/styles/forms/combobox.css +45 -1
- package/dist/styles/templates/settings-modal.css +12 -0
- package/package.json +1 -1
package/CATALOG.md
CHANGED
|
@@ -46,6 +46,7 @@ Playground paths in this file are relative to `playground/nuxt/app/pages/compone
|
|
|
46
46
|
| Money or unit prefix and suffix around an input | `InputGroup` + `InputAddon` |
|
|
47
47
|
| One choice from a short list (5 or fewer) | `RadioGroup` or `SegmentedControl` |
|
|
48
48
|
| One choice from a longer list, no search | `Select` |
|
|
49
|
+
| One choice from a short fixed list with a color dot or an icon, no search | `Combobox` with `:searchable="false"` (a button trigger with typeahead, also `multiple`) |
|
|
49
50
|
| Searchable select, async search, multi select, create option | `Combobox` |
|
|
50
51
|
| Pick one node of a hierarchy (category, folder) | `TreeSelect` (`leavesOnly` to allow only leaves) |
|
|
51
52
|
| Create new values with a format or rule (tags, codes) | `Combobox` with `creatable`, `createTransform`, `createValidate` |
|
|
@@ -162,31 +163,31 @@ Playground paths in this file are relative to `playground/nuxt/app/pages/compone
|
|
|
162
163
|
|
|
163
164
|
All field components work inside `FormField` and take `invalid`, `disabled`, `readonly`, `required` and `size`, except: `Select` has no `readonly`, `Slider` and `PaletteSelect` have no `required`, `Calendar` takes only `disabled` and `readonly`. They use `v-model`.
|
|
164
165
|
|
|
165
|
-
| Component | Purpose and when to use it
|
|
166
|
-
| ------------------ |
|
|
167
|
-
| `Checkbox` | One boolean, or one value in an array model. Use `Switch` for an instant setting.
|
|
168
|
-
| `CheckboxGroup` | Several choices as checkboxes from `options`.
|
|
169
|
-
| `Radio` | One radio option, used inside `RadioGroup`.
|
|
170
|
-
| `RadioGroup` | One choice from a short list. Use `Select` for long lists, `SegmentedControl` for a compact toggle.
|
|
171
|
-
| `SegmentedControl` | Compact toggle between 2 to 5 options (view mode, period).
|
|
172
|
-
| `Select` | Native styled select. Use `Combobox` when search or async options are needed.
|
|
173
|
-
| `Combobox` | Searchable select. Local filter, async `search`, `multiple` with tags, `creatable`.
|
|
174
|
-
| `TreeSelect` | Pick one node of a hierarchy (category, folder) with a drill-down panel, one level at a time.
|
|
175
|
-
| `Switch` | On or off setting that applies at once.
|
|
176
|
-
| `NumberInput` | Locale aware number with stepper, min, max, step.
|
|
177
|
-
| `PasswordInput` | Password with show or hide, optional generator, copy and strength meter.
|
|
178
|
-
| `PinInput` | One time code or PIN in separate cells.
|
|
179
|
-
| `InputGroup` | Join an input with addons or buttons on its sides.
|
|
180
|
-
| `Fieldset` | Group of fields that can be disabled together, outside or inside a `Form` (a read only part of a page).
|
|
181
|
-
| `InputAddon` | Static text or icon (currency, domain, unit) inside an `InputGroup`.
|
|
182
|
-
| `DateInput` | Native date, datetime-local, month or week input. Use `DatePicker` for a calendar popover or ranges.
|
|
183
|
-
| `DatePicker` | Input with a calendar popover. Single date or `range`.
|
|
184
|
-
| `Calendar` | Inline calendar. Use it for availability views, or as a building block.
|
|
185
|
-
| `TimeInput` | Time of day (HH:MM, optional seconds).
|
|
186
|
-
| `ColorInput` | Color text field with picker and swatches.
|
|
187
|
-
| `PaletteSelect` | Select of a palette color, with the dot and the localized color name.
|
|
188
|
-
| `Slider` | Number in a range with drag handle.
|
|
189
|
-
| `FileInput` | Drop zone and file picker. Validates type, size and count. Supports folders and previews.
|
|
166
|
+
| Component | Purpose and when to use it | Main props, models, slots, events | Playground |
|
|
167
|
+
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
|
|
168
|
+
| `Checkbox` | One boolean, or one value in an array model. Use `Switch` for an instant setting. | Model: boolean or array. Props: `label`, `description`, `value`, `indeterminate`. Slots: default, `description`. | `forms/checkbox.vue` |
|
|
169
|
+
| `CheckboxGroup` | Several choices as checkboxes from `options`. | Model: `T[]`. Props: `options` (`label`, `value`, `description`, `disabled`, `icon`), `legend`, `orientation`, `columns`, `variant` (default, filled), `name`. | `forms/checkbox-group.vue` |
|
|
170
|
+
| `Radio` | One radio option, used inside `RadioGroup`. | Props: `value`, `label`, `description`, `icon`. Slots: default, `description`. | `forms/radio-group.vue` |
|
|
171
|
+
| `RadioGroup` | One choice from a short list. Use `Select` for long lists, `SegmentedControl` for a compact toggle. | Model: value or null. Props: `options`, `legend`, `orientation`, `variant` (default, card), `name`. | `forms/radio-group.vue` |
|
|
172
|
+
| `SegmentedControl` | Compact toggle between 2 to 5 options (view mode, period). | Model: value (with `required` it is never null). Props: `options` (`label`, `value`, `icon`, `title`, `muted`), `iconOnly`, `block`, `label`. Slot: `option`. | `forms/segmented-control.vue` |
|
|
173
|
+
| `Select` | Native styled select. Use `Combobox` when search or async options are needed. | Model: `T or null`. Props: `options` (items or groups with `label`, `value`, `disabled`), `placeholder`, `icon`. Option values can be string, number or boolean. | `forms/select.vue` |
|
|
174
|
+
| `Combobox` | Searchable select. Local filter, async `search`, `multiple` with tags, `creatable`. `:searchable="false"` makes it a plain select with dots and icons. | Models: `v-model`, `v-model:query`. Props: `options` (`label`, `value`, `description`, `icon`, `color` (dot and tag color), `group` (divider with the group name, also the tooltip of a selected tag), `keywords`), `search(query, signal)`, `filter`, `searchable` (default `true`; `false` is a button trigger without typing, with typeahead, and ignores `creatable`, `createActions` and `search`), `multiple`, `hideTags`, `creatable`, `createActions`, `createTransform`, `createValidate` (a returned string is the inline error), `debounce`, `minQueryLength`, `maxSelected`, `clearable`, `loading`, `placeholder`, `emptyText`. Slots: `option`, `empty`, `header` (top of the panel, for example quick filter pills). Events: `create`, `open`, `close`. | `forms/combobox.vue` |
|
|
175
|
+
| `TreeSelect` | Pick one node of a hierarchy (category, folder) with a drill-down panel, one level at a time. | Model: `TreeNodeId or null`. Props: `nodes` (`TreeNode`: `id`, `label`, `description`, `icon`, `disabled`, `children`), `leavesOnly` (parents only navigate), `separator` (path in the control and in search results, default `' / '`), `clearable`, `placeholder`, `searchPlaceholder`, `emptyText`, `icon`. Search lists every match with its path. Slots: `node` (`node`, `selected`, `path`), `empty`. Events: `open`, `close`. | `forms/tree-select.vue` |
|
|
176
|
+
| `Switch` | On or off setting that applies at once. | Model: boolean. Props: `label`, `description`, `labelPosition`, `checkedIcon`, `uncheckedIcon`, `name`. Slots: default, `description`. | `forms/switch.vue` |
|
|
177
|
+
| `NumberInput` | Locale aware number with stepper, min, max, step. | Model: number or null. Props: `min`, `max`, `step`, `largeStep`, `locale`, `formatOptions` (currency, percent), `decimalSeparator` (`'.'` or `','`, default from the locale), `stepper`, `wheel`, `align` (`start`, the default, or `end`), `icon`, `placeholder`. Numbers are left aligned like every other field. Typing keeps only digits, one decimal separator (a typed `.` or `,` becomes the separator) and a leading `-` when `min` allows negatives. | `forms/number-input.vue` |
|
|
178
|
+
| `PasswordInput` | Password with show or hide, optional generator, copy and strength meter. | Model: string. Props: `generate` (true or a function), `copy`, `strength`, `minLength`, `autocomplete`. Event: `generate`. | `forms/password-input.vue` |
|
|
179
|
+
| `PinInput` | One time code or PIN in separate cells. | Model: string. Props: `length`, `mode` (numeric, alphanumeric, alphabetic), `mask`, `uppercase`, `separatorAfter`, `autocomplete`. Event: `complete(value)`. | `forms/pin-input.vue` |
|
|
180
|
+
| `InputGroup` | Join an input with addons or buttons on its sides. | Props: `label`, `size`, `block`. Slot: default (inputs, `InputAddon`, `Button`). | `forms/input-group.vue` |
|
|
181
|
+
| `Fieldset` | Group of fields that can be disabled together, outside or inside a `Form` (a read only part of a page). | Props: `disabled` (every field inside is disabled, the same as `Form` `disabled`; without it the group inherits the state of its parent, `false` enables a group inside a disabled form), `legend`. Slots: default, `legend`. A native `fieldset`: buttons inside are disabled too, links are not. When it becomes disabled with the focus inside, the focus moves to the fieldset. | `forms/fieldset.vue` |
|
|
182
|
+
| `InputAddon` | Static text or icon (currency, domain, unit) inside an `InputGroup`. | Props: `label`, `icon`, `size`. Slot: default. | `forms/input-group.vue` |
|
|
183
|
+
| `DateInput` | Native date, datetime-local, month or week input. Use `DatePicker` for a calendar popover or ranges. | Model: ISO string or null. Props: `type`, `min`, `max`, `step`, `clearable`. | `forms/date-input.vue` |
|
|
184
|
+
| `DatePicker` | Input with a calendar popover. Single date or `range`. | Model: ISO string, range object (`start`, `end`) or null. Props: `range`, `min`, `max`, `isDateDisabled`, `locale`, `weekStartsOn`, `format`, `closeOnSelect`, `clearable`. Slot: `footer`. | `forms/date-picker.vue` |
|
|
185
|
+
| `Calendar` | Inline calendar. Use it for availability views, or as a building block. | Models: `v-model` (date or range), `v-model:month`. Props: `range`, `min`, `max`, `isDateDisabled`, `locale`, `weekStartsOn`, `dayText(iso)`. Slots: `day`, `footer`. Event: `select`. | `forms/calendar.vue` |
|
|
186
|
+
| `TimeInput` | Time of day (HH:MM, optional seconds). | Model: string or null. Props: `min`, `max`, `step`, `seconds`, `clearable`. | `forms/time-input.vue` |
|
|
187
|
+
| `ColorInput` | Color text field with picker and swatches. | Model: hex string or null. Props: `swatches` (strings or `{ value, label }`), `placeholder`, `invalidText`. | `forms/color-input.vue` |
|
|
188
|
+
| `PaletteSelect` | Select of a palette color, with the dot and the localized color name. | Model: `ColorValue` (palette name or `#rrggbb`) or null. A non-searchable `Combobox` (pass `:searchable="true"` to type a filter). Props: `colors` (subset of `PALETTE_COLORS`), `clearable` (placeholder "Automatic"), `custom` (adds "Custom": choosing it shows a `ColorInput` under the select and the model becomes the hex), `customLabel` (name of the color input), `placeholder`, `size`, `disabled`, `readonly`, `invalid`. | `forms/palette-select.vue` |
|
|
189
|
+
| `Slider` | Number in a range with drag handle. | Model: number. Props: `min`, `max`, `step`, `bubble` (true, always), `marks`, `format(value)`, `label`. Event: `change` (on release). | `forms/slider.vue` |
|
|
190
|
+
| `FileInput` | Drop zone and file picker. Validates type, size and count. Supports folders and previews. | Model: `File`, `File[]` or null. Props: `accept`, `acceptMode`, `maxSize`, `maxFiles`, `multiple`, `directory`, `directoryAction`, `previews`, `list`, `loading`, `capture`, `title`, `dropText`, `hint`. Slots: `title`, `hint`, `actions`. Events: `add`, `remove`, `invalid`, `reject`. | `forms/file-input.vue` |
|
|
190
191
|
|
|
191
192
|
## Overlays
|
|
192
193
|
|
|
@@ -268,29 +269,29 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
268
269
|
|
|
269
270
|
Templates combine core parts into whole pages and layouts. Start from them for new pages.
|
|
270
271
|
|
|
271
|
-
| Component | Purpose and when to use it | Main props, models, slots, events
|
|
272
|
-
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
273
|
-
| `DashboardLayout` | Ready app frame: brand, navigation, command search, account menu, settings modal, breadcrumbs, theme switch. Put it in `layouts/default.vue`. | Models: `v-model:collapsed`, `v-model:open`, `v-model:settingsOpen`, `v-model:settingsSection`. Props: `navigation` (`NavItem[]` or `NavSection[]`), `account` (`name`, `email`, `avatar`, `role`, `menu`), `brandName`, `brandIcon`, `brandLogo`, `breadcrumbs`, `search` (true, groups or function), `settingsSections`, `settingsRoute`, `settingsRouteLocation`, `settingsAccountSection`, `settingsResolvePage`, `settingsHideSession`, `variant`, `content` (`page`, `fill`, `centered`, `bleed`; per page with `definePageMeta({ content })` in `k-dashboard`), `fluid`, `fill`, `onSignOut`. Slots: default, `actions`, `brand`, `sidebar-top`, `sidebar`, `sidebar-footer`, `account`, `topbar`, `search-item`, `settings-account-start`, `settings-account-fields`, `settings-section-<id>`, `settings-actions-<id>`, `settings-tabs-<id
|
|
274
|
-
| `AuthLayout` | Frame of sign in, sign up and reset password pages: left column with brand, title (or a large breadcrumb), form and footer; aside panel on the right from 960px. | Props: `title`, `description`, `breadcrumbs`, `footer`, `brandName`, `brandIcon`, `brandLogo`, `aside`, `asideTitle`, `asideDescription`, `themeSwitch`. Slots: default, `links`, `footer`, `brand`, `aside`, `corner`.
|
|
275
|
-
| `AuthLogin` | Complete sign in page in two steps (email, then password with a breadcrumb back). Offers to sign in again after `AuthLogout`. | Props: `submit` (`{ email, password }`), `submitError`, `title`, `description`, `emailLabel`, `emailPlaceholder`, `passwordLabel`, `submitLabel`, `stepKey`, `reasonKey`, frame props of `AuthLayout`. Slots: `links` (`{ email, step }`), `footer`, `brand`, `aside`, `corner`.
|
|
276
|
-
| `AuthLogout` | Sign out page: runs `logout()`, remembers the account, reloads the sign in page. Retry on error. | Props: `logout`, `account` (`{ email, name }`), `loginTo`, `reasonKey`, frame props of `AuthLayout`. Slots: `footer`, `brand`, `aside`, `corner`. Helpers: `rememberSignedOutAccount`, `takeSignedOutAccount`, `SIGNED_OUT_REASON`.
|
|
277
|
-
| `ListPage` | Whole list page: header, search, filters, table, pagination, bulk actions, loading, empty, no results and error states. Client or server mode (`total`). | Models: `page`, `pageSize`, `search`, `filter`, `sort`, `selected`. Props: `title`, `rows`, `columns`, `rowKey`, `rowTo`, `selectable`, `loading`, `error`, `total`, `paginate`, `searchable`, `searchKeys`, `filters`, `filterKey`, `filterMultiple`, `emptyTitle`. Slots: `actions`, `toolbar`, `toolbar-end`, `bulk`, `empty`, `empty-actions`, `no-results`, `error`, `cell-<key>`, `table`. Events: `retry`, `clear`, `rowClick`.
|
|
278
|
-
| `DetailPage` | Record page: back link, title, status, actions, tabs, main column and aside with description lists. | Model: `v-model:tab`. Props: `title`, `backTo`, `backLabel`, `status` (`label`, `tone`, `dot`), `tabs`, `sections` (`title`, `items`), `loading`, `error`. Slots: default, `actions`, `badge`, `meta`, `aside`, `aside-before`, `panel-<value>`.
|
|
279
|
-
| `FormDrawer` | Drawer with a form: `Form` around the body, footer with delete (left), cancel and submit, a discard confirmation on close when the form is dirty, `SkeletonForm` while `loading`. | Models: `v-model:open`, `v-model:tab`. Props: `title`, `description`, `side`, `size`, `fill` (full height body), `tabs` (`FormDrawerTab`: `fields` gives the error dot and opens the tab on a failed submit, `fill: true` makes the drawer `fill` while the tab is active), `tabRoute` (keeps the tab in the hash under this key), `trail`, `backLabel`, `form`, `loading`, `readonly` (also disables every field of the body, your own `Form` in the slot too), `creating` (submit says Create, no dirty needed), `requireDirty`, `deletable`, `deleteDisabled`, `deleteHint`, `submitLabel`, `cancelLabel`, `deleteLabel`, `submitIcon` (icon of the submit button), `deleteIcon` (default `trash`), `guard`, `guardTitle`, `guardMessage` (the leave guard of the drawer: close, cancel, trail navigation), `beforeClose`, `onCancel`. `deleteHint` is a tooltip of the delete button, and the reason when `deleteDisabled`. Slots: default (`{ tab }`), `actions`, `title-trailing`, `skeleton`, `footer`. Events: `delete`, `submitted`, `navigate`, `afterLeave`. Exposes `confirmDiscard()`, `close()`.
|
|
280
|
-
| `FormModal` | Modal with a form, like `FormDrawer`: `Form` around the body, footer with delete (left), cancel and submit, the leave guard on close, `SkeletonForm` while `loading`, `readonly`. | Model: `v-model:open`. Props: `title`, `description`, `label`, `size`, `sheet`, `width`, `fill`, `dismissible`, `form`, `nested` (the form is a `div`: a modal opened from a field of another form), `loading`, `readonly`, `creating`, `requireDirty`, `deletable`, `deleteDisabled`, `deleteHint`, `submitLabel`, `cancelLabel`, `deleteLabel`, `submitIcon` (icon of the submit button), `deleteIcon` (default `trash`), `guard`, `guardTitle`, `guardMessage`, `beforeClose`, `onCancel`. Slots: default, `actions`, `title-trailing`, `skeleton`, `footer` (`{ submit, cancel }`). Events: `delete`, `submitted`, `open`, `close`, `afterLeave`. Exposes `submit()`, `confirmDiscard()`, `close()`.
|
|
281
|
-
| `FormPage` | Form page: header, cards in a `Form`, sticky submit and cancel footer, dirty guard. | Props: `title`, `backTo`, `form` (from `useForm`), `dirty`, `saving`, `guard`, `requireDirty`, `submitLabel`, `cancelLabel`, `cancelTo`, `width`, `sticky`. Slots: default, `actions`, `footer`, `status`. Events: `submit`, `submitted`, `invalid`, `reset`, `cancel`.
|
|
282
|
-
| `DashboardPage` | Overview page: header, stat grid, content grid. | Props: `title`, `eyebrow`, `description`, `stats` (`PageStat[]`), `statsColumns`, `columns`, `loading`. Slots: default, `actions`, `stats`, `sparkline`, `before`, `after`, `eyebrow`.
|
|
283
|
-
| `SettingsPage` | Settings as a page: section nav, panels, floating save bar when `dirty`. | Model: `v-model:section`. Props: `title`, `sections` (`value`, `label`, `icon`, `to`), `dirty`, `saving`, `saveBar`, `form`. Slots: `section-<value>`, `actions`, `nav-footer`. Events: `save`, `discard`.
|
|
284
|
-
| `SettingsSection` | Card of one settings section with a save footer. | Props: `title`, `description`, `icon`, `hint`, `saveable`, `saving`, `saveDisabled`, `saveLabel`, `form`. Slots: default, `actions`, `footer`, `hint`. Event: `save`.
|
|
285
|
-
| `SettingsGroup` | Block with label, description and actions inside a settings section. | Props: `label`, `description`, `level`, `row`. Slots: default, `label`, `description`, `actions`.
|
|
286
|
-
| `SettingsModal` | Settings dialog with nav, built-in account and appearance sections, your own sections and subpages. A subpage title is a one line trail. | Models: `v-model:open`, `v-model:section`, `v-model:pages`. Props: `sections` (`id`, `label`, `icon`, `group`, `badge`, `to`), `account`, `presets`, `title`, `onSignOut`, `hideSession`, `beforeClose`, `route` (sync with `?settings=<section>/<page>`), `routeLocation` (`'hash'`: `#settings/<section>/<page>`), `accountSection` (id with the built-in account content, default `account`), `resolvePage(section, id, parents)`, `guard`, `guardTitle`, `guardMessage` (back, breadcrumb, another section, close and a route change of the modal ask before discarding a dirty `Form` of the section). Slot props: `section`, `close`, `page`, `pages`, `openPage(page)`, `back()`, `goTo(depth)` (the last three resolve `false` when the user keeps editing), `confirmLeave()`. Slots: `section-<id>`, `actions-<id>` (right of the header row, also on a subpage), `tabs-<id>` (tabs at the bottom of the header, like a drawer; the strip shows only when the slot renders content), `account-start` (above the profile card), `account-fields`.
|
|
287
|
-
| `AppearanceSettings` | Theme (light, dark, system) and preset cards. Used by `SettingsModal`. Use alone in a settings page. | Props: `presets` (list or false), `themes`, `level`.
|
|
288
|
-
| `SaveBar` | Floating bar with save and discard for unsaved changes. | Props: `visible`, `saving`, `message`, `saveLabel`, `discardLabel`, `form`. Slots: default, `actions`. Events: `save`, `discard`.
|
|
289
|
-
| `EmptyPage` | First run screen with illustration, actions and onboarding steps. | Props: `title`, `description`, `icon`, `actionLabel`, `actionTo`, `onAction`, `actionIcon`, `secondaryLabel`, `secondaryTo`, `secondaryHref`, `onSecondary`, `steps` (`title`, `description`, `done`, `to`), `fill`. Slots: default, `illustration`, `title`, `description`, `actions`.
|
|
290
|
-
| `ErrorPage` | Error screen. Reads a Nuxt `error`. Use it in `app/error.vue`. | Props: `error`, `statusCode`, `title`, `message`, `homeTo`, `homeLabel`, `retryLabel`, `brandName`, `fill`, `onHome`, `onRetry`. Slots: default, `title`, `message`, `actions`, `brand`.
|
|
291
|
-
| `NotFoundPage` | 404 screen. | Props: `title`, `message`, `homeTo`, `homeLabel`, `backLabel`, `brandName`, `fill`, `onHome`. Slots: default, `actions`, `brand`.
|
|
292
|
-
| `Brand` | Logo and name block (image URL, inline SVG or component). | Props: `name`, `subtitle`, `icon`, `logo`, `to`, `size`, `accent`, `hideText`, `showName`. Slots: default, `logo`, `mark`, `subtitle`.
|
|
293
|
-
| `AccountMenu` | Account button with avatar, name and a dropdown menu. Used by `DashboardLayout`. | Props: `name`, `email`, `avatar`, `menu` (menu items), `placement`, `icon`. Event: `select`.
|
|
272
|
+
| Component | Purpose and when to use it | Main props, models, slots, events | Playground |
|
|
273
|
+
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
|
|
274
|
+
| `DashboardLayout` | Ready app frame: brand, navigation, command search, account menu, settings modal, breadcrumbs, theme switch. Put it in `layouts/default.vue`. | Models: `v-model:collapsed`, `v-model:open`, `v-model:settingsOpen`, `v-model:settingsSection`. Props: `navigation` (`NavItem[]` or `NavSection[]`), `account` (`name`, `email`, `avatar`, `role`, `menu`), `brandName`, `brandIcon`, `brandLogo`, `breadcrumbs`, `search` (true, groups or function), `settingsSections`, `settingsRoute`, `settingsRouteLocation`, `settingsAccountSection`, `settingsResolvePage`, `settingsHideSession`, `variant`, `content` (`page`, `fill`, `centered`, `bleed`; per page with `definePageMeta({ content })` in `k-dashboard`), `fluid`, `fill`, `onSignOut`. Slots: default, `actions`, `brand`, `sidebar-top`, `sidebar`, `sidebar-footer`, `account`, `topbar`, `search-item`, `settings-account-start`, `settings-account-fields`, `settings-section-<id>`, `settings-actions-<id>`, `settings-tabs-<id>`, `settings-nav-footer`. Event: `accountSelect`. | `templates/dashboard-layout.vue` |
|
|
275
|
+
| `AuthLayout` | Frame of sign in, sign up and reset password pages: left column with brand, title (or a large breadcrumb), form and footer; aside panel on the right from 960px. | Props: `title`, `description`, `breadcrumbs`, `footer`, `brandName`, `brandIcon`, `brandLogo`, `aside`, `asideTitle`, `asideDescription`, `themeSwitch`. Slots: default, `links`, `footer`, `brand`, `aside`, `corner`. | `templates/auth-layout.vue` |
|
|
276
|
+
| `AuthLogin` | Complete sign in page in two steps (email, then password with a breadcrumb back). Offers to sign in again after `AuthLogout`. | Props: `submit` (`{ email, password }`), `submitError`, `title`, `description`, `emailLabel`, `emailPlaceholder`, `passwordLabel`, `submitLabel`, `stepKey`, `reasonKey`, frame props of `AuthLayout`. Slots: `links` (`{ email, step }`), `footer`, `brand`, `aside`, `corner`. | `templates/auth-login.vue` |
|
|
277
|
+
| `AuthLogout` | Sign out page: runs `logout()`, remembers the account, reloads the sign in page. Retry on error. | Props: `logout`, `account` (`{ email, name }`), `loginTo`, `reasonKey`, frame props of `AuthLayout`. Slots: `footer`, `brand`, `aside`, `corner`. Helpers: `rememberSignedOutAccount`, `takeSignedOutAccount`, `SIGNED_OUT_REASON`. | `templates/auth-login.vue` |
|
|
278
|
+
| `ListPage` | Whole list page: header, search, filters, table, pagination, bulk actions, loading, empty, no results and error states. Client or server mode (`total`). | Models: `page`, `pageSize`, `search`, `filter`, `sort`, `selected`. Props: `title`, `rows`, `columns`, `rowKey`, `rowTo`, `selectable`, `loading`, `error`, `total`, `paginate`, `searchable`, `searchKeys`, `filters`, `filterKey`, `filterMultiple`, `emptyTitle`. Slots: `actions`, `toolbar`, `toolbar-end`, `bulk`, `empty`, `empty-actions`, `no-results`, `error`, `cell-<key>`, `table`. Events: `retry`, `clear`, `rowClick`. | `templates/list-page.vue` |
|
|
279
|
+
| `DetailPage` | Record page: back link, title, status, actions, tabs, main column and aside with description lists. | Model: `v-model:tab`. Props: `title`, `backTo`, `backLabel`, `status` (`label`, `tone`, `dot`), `tabs`, `sections` (`title`, `items`), `loading`, `error`. Slots: default, `actions`, `badge`, `meta`, `aside`, `aside-before`, `panel-<value>`. | `templates/detail-page.vue` |
|
|
280
|
+
| `FormDrawer` | Drawer with a form: `Form` around the body, footer with delete (left), cancel and submit, a discard confirmation on close when the form is dirty, `SkeletonForm` while `loading`. | Models: `v-model:open`, `v-model:tab`. Props: `title`, `description`, `side`, `size`, `fill` (full height body), `tabs` (`FormDrawerTab`: `fields` gives the error dot and opens the tab on a failed submit, `fill: true` makes the drawer `fill` while the tab is active), `tabRoute` (keeps the tab in the hash under this key), `trail`, `backLabel`, `form`, `loading`, `readonly` (also disables every field of the body, your own `Form` in the slot too), `creating` (submit says Create, no dirty needed), `requireDirty`, `deletable`, `deleteDisabled`, `deleteHint`, `submitLabel`, `cancelLabel`, `deleteLabel`, `submitIcon` (icon of the submit button), `deleteIcon` (default `trash`), `guard`, `guardTitle`, `guardMessage` (the leave guard of the drawer: close, cancel, trail navigation), `beforeClose`, `onCancel`. `deleteHint` is a tooltip of the delete button, and the reason when `deleteDisabled`. Slots: default (`{ tab }`), `actions`, `title-trailing`, `skeleton`, `footer`. Events: `delete`, `submitted`, `navigate`, `afterLeave`. Exposes `confirmDiscard()`, `close()`. | `templates/form-drawer.vue` |
|
|
281
|
+
| `FormModal` | Modal with a form, like `FormDrawer`: `Form` around the body, footer with delete (left), cancel and submit, the leave guard on close, `SkeletonForm` while `loading`, `readonly`. | Model: `v-model:open`. Props: `title`, `description`, `label`, `size`, `sheet`, `width`, `fill`, `dismissible`, `form`, `nested` (the form is a `div`: a modal opened from a field of another form), `loading`, `readonly`, `creating`, `requireDirty`, `deletable`, `deleteDisabled`, `deleteHint`, `submitLabel`, `cancelLabel`, `deleteLabel`, `submitIcon` (icon of the submit button), `deleteIcon` (default `trash`), `guard`, `guardTitle`, `guardMessage`, `beforeClose`, `onCancel`. Slots: default, `actions`, `title-trailing`, `skeleton`, `footer` (`{ submit, cancel }`). Events: `delete`, `submitted`, `open`, `close`, `afterLeave`. Exposes `submit()`, `confirmDiscard()`, `close()`. | `templates/form-modal.vue` |
|
|
282
|
+
| `FormPage` | Form page: header, cards in a `Form`, sticky submit and cancel footer, dirty guard. | Props: `title`, `backTo`, `form` (from `useForm`), `dirty`, `saving`, `guard`, `requireDirty`, `submitLabel`, `cancelLabel`, `cancelTo`, `width`, `sticky`. Slots: default, `actions`, `footer`, `status`. Events: `submit`, `submitted`, `invalid`, `reset`, `cancel`. | `templates/form-page.vue` |
|
|
283
|
+
| `DashboardPage` | Overview page: header, stat grid, content grid. | Props: `title`, `eyebrow`, `description`, `stats` (`PageStat[]`), `statsColumns`, `columns`, `loading`. Slots: default, `actions`, `stats`, `sparkline`, `before`, `after`, `eyebrow`. | `templates/dashboard-page.vue` |
|
|
284
|
+
| `SettingsPage` | Settings as a page: section nav, panels, floating save bar when `dirty`. | Model: `v-model:section`. Props: `title`, `sections` (`value`, `label`, `icon`, `to`), `dirty`, `saving`, `saveBar`, `form`. Slots: `section-<value>`, `actions`, `nav-footer`. Events: `save`, `discard`. | `templates/settings-page.vue` |
|
|
285
|
+
| `SettingsSection` | Card of one settings section with a save footer. | Props: `title`, `description`, `icon`, `hint`, `saveable`, `saving`, `saveDisabled`, `saveLabel`, `form`. Slots: default, `actions`, `footer`, `hint`. Event: `save`. | `templates/settings-page.vue` |
|
|
286
|
+
| `SettingsGroup` | Block with label, description and actions inside a settings section. | Props: `label`, `description`, `level`, `row`. Slots: default, `label`, `description`, `actions`. | `templates/settings-modal.vue` |
|
|
287
|
+
| `SettingsModal` | Settings dialog with nav, built-in account and appearance sections, your own sections and subpages. A subpage title is a one line trail. | Models: `v-model:open`, `v-model:section`, `v-model:pages`. Props: `sections` (`id`, `label`, `icon`, `group`, `badge`, `to`), `account`, `presets`, `title`, `onSignOut`, `hideSession`, `beforeClose`, `route` (sync with `?settings=<section>/<page>`), `routeLocation` (`'hash'`: `#settings/<section>/<page>`), `accountSection` (id with the built-in account content, default `account`), `resolvePage(section, id, parents)`, `guard`, `guardTitle`, `guardMessage` (back, breadcrumb, another section, close and a route change of the modal ask before discarding a dirty `Form` of the section). Slot props: `section`, `close`, `page`, `pages`, `openPage(page)`, `back()`, `goTo(depth)` (the last three resolve `false` when the user keeps editing), `confirmLeave()`. Slots: `section-<id>`, `actions-<id>` (right of the header row, also on a subpage), `nav-footer` (small text at the bottom of the side navigation, for example the app version; hidden at phone width), `tabs-<id>` (tabs at the bottom of the header, like a drawer; the strip shows only when the slot renders content), `account-start` (above the profile card), `account-fields`. | `templates/settings-modal.vue` |
|
|
288
|
+
| `AppearanceSettings` | Theme (light, dark, system) and preset cards. Used by `SettingsModal`. Use alone in a settings page. | Props: `presets` (list or false), `themes`, `level`. | `presets.vue` (pages root) |
|
|
289
|
+
| `SaveBar` | Floating bar with save and discard for unsaved changes. | Props: `visible`, `saving`, `message`, `saveLabel`, `discardLabel`, `form`. Slots: default, `actions`. Events: `save`, `discard`. | `templates/settings-page.vue` |
|
|
290
|
+
| `EmptyPage` | First run screen with illustration, actions and onboarding steps. | Props: `title`, `description`, `icon`, `actionLabel`, `actionTo`, `onAction`, `actionIcon`, `secondaryLabel`, `secondaryTo`, `secondaryHref`, `onSecondary`, `steps` (`title`, `description`, `done`, `to`), `fill`. Slots: default, `illustration`, `title`, `description`, `actions`. | `templates/empty-page.vue` |
|
|
291
|
+
| `ErrorPage` | Error screen. Reads a Nuxt `error`. Use it in `app/error.vue`. | Props: `error`, `statusCode`, `title`, `message`, `homeTo`, `homeLabel`, `retryLabel`, `brandName`, `fill`, `onHome`, `onRetry`. Slots: default, `title`, `message`, `actions`, `brand`. | `templates/error-page.vue` |
|
|
292
|
+
| `NotFoundPage` | 404 screen. | Props: `title`, `message`, `homeTo`, `homeLabel`, `backLabel`, `brandName`, `fill`, `onHome`. Slots: default, `actions`, `brand`. | `templates/error-page.vue` |
|
|
293
|
+
| `Brand` | Logo and name block (image URL, inline SVG or component). | Props: `name`, `subtitle`, `icon`, `logo`, `to`, `size`, `accent`, `hideText`, `showName`. Slots: default, `logo`, `mark`, `subtitle`. | `templates/dashboard-layout.vue` |
|
|
294
|
+
| `AccountMenu` | Account button with avatar, name and a dropdown menu. Used by `DashboardLayout`. | Props: `name`, `email`, `avatar`, `menu` (menu items), `placement`, `icon`. Event: `select`. | `templates/dashboard-layout.vue` |
|
|
294
295
|
|
|
295
296
|
Nuxt ready layouts: with `k: { layouts: true }` the module registers the layouts `k-dashboard` and `k-auth`. They read brand, navigation, account and settings from `app.config.ts` (`k` key). `useDashboard()` gives the runtime account, breadcrumbs and badges for `k-dashboard`. See README, section "Nuxt: ready layouts".
|
|
296
297
|
|
package/README.md
CHANGED
|
@@ -511,6 +511,7 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
|
|
|
511
511
|
- `CheckboxGroup` takes `columns` (a number): the options are laid out in a grid with that many equal columns. Unset keeps the `orientation` layout. `variant="filled"` (`CheckboxGroupVariant`, `'default' | 'filled'`, default `'default'`) puts the options in a subtle filled panel, styled by `--k-checkbox-group-background` (`--k-subtle`), `--k-checkbox-group-padding` (0.75rem), `--k-checkbox-group-radius` (`--k-radius-md`) and `--k-checkbox-group-border` (none).
|
|
512
512
|
- `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'" />`.
|
|
513
513
|
- `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 }]" />`.
|
|
514
|
+
- `Combobox` with `:searchable="false"` is a plain select that keeps the option dots, icons, descriptions and groups: the control is a `<button>` with `role="combobox"` and `aria-haspopup="listbox"` that shows the selected label (with the color dot or the `icon`), or the placeholder when empty. There is no text to type and no filter. Click, Enter, Space, ArrowDown or ArrowUp open the list, the arrows, Home and End move, Enter or Space select (with `multiple` the list stays open), Escape and Tab close, and typing letters moves to the next option whose label starts with them (typeahead, like a native select). `clearable`, `disabled`, `readonly`, `invalid`, `size`, `icon`, `multiple` and `hideTags` work as usual; `creatable`, `createActions` and the async `search` are ignored. Use it for a short fixed list that needs a color dot or an icon (`PaletteSelect` uses it): `<KCombobox v-model="status" :options="statuses" :searchable="false" />`. The exposed `el` is the input, or the trigger button when not searchable.
|
|
514
515
|
- `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.
|
|
515
516
|
- `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.
|
|
516
517
|
- `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.
|
|
@@ -759,7 +760,7 @@ Ready defaults to start a dashboard project: an app frame, an auth frame and pag
|
|
|
759
760
|
| `fill` | `false` | Full height, full bleed content (the same as `content="bleed"`): no padding, gap or max width, and the content fills the panel (a page that is one DataGrid with `height="100%"`). Also on `AppShell`; in the `k-dashboard` layout per page with `definePageMeta({ fill: true })` or for every page with `dashboard.fill`. |
|
|
760
761
|
| `content` | `'page'` | Content layout (`ShellContent`). `page`: max width (`--k-shell-content`, 72rem), padding, the panel scrolls. `fill`: full width and full height with the normal padding and gap; the panel never scrolls and the content is a flex column with `min-height: 0`, so a child with `flex: 1` (a `DataGrid` with `fill`, `Tabs` with `stretch`, a `.k-page` root) takes the rest of the height. `centered`: the same full height, with the width kept at `--k-shell-content` and centered. `bleed`: full width and height without padding or gap. `fill` (boolean) is an alias of `bleed` and `fluid` removes the max width of `page`; `content` wins over both. Also on `AppShell`; in the `k-dashboard` layout per page with `definePageMeta({ content: 'fill' })` (typed) or for every page with `dashboard.content` in the app config. |
|
|
761
762
|
|
|
762
|
-
Slots: `brand`, `search`, `sidebar-top` (under the search, for example a workspace select), `sidebar` (replaces the navigation), `sidebar-footer`, `account`, `topbar-brand`, `topbar`, `actions`, default, plus `settings-section-<id>`, `settings-actions-<id>`, `settings-tabs-<id>`, `settings-account-start` and `settings-account-fields`, forwarded to the SettingsModal. The exposed `openSettings(id?)` opens it on a section. Landmarks: skip link, `aside` and `nav` with labels, `main` with an id, `aria-current="page"` on the active link. `SidebarNav` (layout group) renders the same navigation data inside your own `Sidebar`.
|
|
763
|
+
Slots: `brand`, `search`, `sidebar-top` (under the search, for example a workspace select), `sidebar` (replaces the navigation), `sidebar-footer`, `account`, `topbar-brand`, `topbar`, `actions`, default, plus `settings-section-<id>`, `settings-actions-<id>`, `settings-tabs-<id>`, `settings-nav-footer`, `settings-account-start` and `settings-account-fields`, forwarded to the SettingsModal. The exposed `openSettings(id?)` opens it on a section. Landmarks: skip link, `aside` and `nav` with labels, `main` with an id, `aria-current="page"` on the active link. `SidebarNav` (layout group) renders the same navigation data inside your own `Sidebar`.
|
|
763
764
|
|
|
764
765
|
### SettingsModal
|
|
765
766
|
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
{
|
|
8
8
|
'is-open': layer.isOpen.value,
|
|
9
9
|
'is-multiple': multiple,
|
|
10
|
+
'is-select': !searchable,
|
|
10
11
|
'is-disabled': control.disabled.value,
|
|
11
12
|
'has-lead': Boolean(icon || leadColor)
|
|
12
13
|
},
|
|
@@ -57,6 +58,7 @@
|
|
|
57
58
|
</span>
|
|
58
59
|
</template>
|
|
59
60
|
<input
|
|
61
|
+
v-if="searchable"
|
|
60
62
|
ref="inputRef"
|
|
61
63
|
:id="control.id.value"
|
|
62
64
|
v-bind="$attrs"
|
|
@@ -88,6 +90,40 @@
|
|
|
88
90
|
@focus="onFocus"
|
|
89
91
|
@blur="onBlur"
|
|
90
92
|
/>
|
|
93
|
+
<button
|
|
94
|
+
v-else
|
|
95
|
+
ref="triggerRef"
|
|
96
|
+
:id="control.id.value"
|
|
97
|
+
:aria-labelledby="
|
|
98
|
+
control.labelledBy.value && !$attrs['aria-label'] ? `${control.labelledBy.value} ${valueId}` : void 0
|
|
99
|
+
"
|
|
100
|
+
v-bind="$attrs"
|
|
101
|
+
:disabled="control.disabled.value || void 0"
|
|
102
|
+
:aria-required="control.required.value ? 'true' : void 0"
|
|
103
|
+
:aria-invalid="invalid ? 'true' : void 0"
|
|
104
|
+
:aria-readonly="readonly ? 'true' : void 0"
|
|
105
|
+
:aria-describedby="joinIds($attrs['aria-describedby'], control.describedBy.value)"
|
|
106
|
+
type="button"
|
|
107
|
+
class="k-combobox-trigger"
|
|
108
|
+
role="combobox"
|
|
109
|
+
aria-haspopup="listbox"
|
|
110
|
+
:aria-expanded="layer.isOpen.value ? 'true' : 'false'"
|
|
111
|
+
:aria-controls="listId"
|
|
112
|
+
:aria-activedescendant="activeId"
|
|
113
|
+
@keydown="onTriggerKeydown"
|
|
114
|
+
@focus="onFocus"
|
|
115
|
+
@blur="onBlur"
|
|
116
|
+
>
|
|
117
|
+
<span
|
|
118
|
+
:id="valueId"
|
|
119
|
+
class="k-combobox-value"
|
|
120
|
+
:class="{ 'is-placeholder': !triggerText && !hiddenText }"
|
|
121
|
+
>
|
|
122
|
+
<template v-if="triggerText">{{ triggerText }}</template>
|
|
123
|
+
<span v-else-if="hiddenText" class="k-visually-hidden">{{ hiddenText }}</span>
|
|
124
|
+
<template v-else>{{ placeholder }}</template>
|
|
125
|
+
</span>
|
|
126
|
+
</button>
|
|
91
127
|
<span class="k-combobox-trail">
|
|
92
128
|
<Spinner v-if="busy" decorative size="xs" class="k-combobox-spinner" />
|
|
93
129
|
<button
|
|
@@ -237,7 +273,7 @@ import {
|
|
|
237
273
|
import { useFieldControl } from "../../composables/useField";
|
|
238
274
|
import { useLocale } from "../../composables/useLocale";
|
|
239
275
|
import { useFloatingLayer } from "../../internal/floating/layer";
|
|
240
|
-
import { nextEnabledIndex } from "../../internal/core/roving";
|
|
276
|
+
import { nextEnabledIndex, useTypeahead } from "../../internal/core/roving";
|
|
241
277
|
import { useAsyncSearch } from "../../internal/core/search";
|
|
242
278
|
import LiveRegion from "../../internal/core/LiveRegion.vue";
|
|
243
279
|
import { useLiveMessage } from "../../internal/core/live";
|
|
@@ -253,6 +289,7 @@ const props = defineProps({
|
|
|
253
289
|
options: { type: Array, required: false, default: () => [] },
|
|
254
290
|
name: { type: String, required: false },
|
|
255
291
|
search: { type: Function, required: false },
|
|
292
|
+
searchable: { type: Boolean, required: false, default: true },
|
|
256
293
|
filter: { type: Function, required: false },
|
|
257
294
|
multiple: { type: Boolean, required: false },
|
|
258
295
|
hideTags: { type: Boolean, required: false },
|
|
@@ -303,10 +340,15 @@ const attrs = useAttrs();
|
|
|
303
340
|
const baseId = useId();
|
|
304
341
|
const listId = `${baseId}-listbox`;
|
|
305
342
|
const panelId = `${baseId}-panel`;
|
|
343
|
+
const valueId = `${baseId}-value`;
|
|
306
344
|
const rootRef = useTemplateRef("rootRef");
|
|
307
345
|
const controlRef = useTemplateRef("controlRef");
|
|
308
346
|
const panelRef = useTemplateRef("panelRef");
|
|
309
347
|
const inputRef = useTemplateRef("inputRef");
|
|
348
|
+
const triggerRef = useTemplateRef("triggerRef");
|
|
349
|
+
const controlEl = computed(
|
|
350
|
+
() => inputRef.value ?? triggerRef.value
|
|
351
|
+
);
|
|
310
352
|
const errorId = `${baseId}-create-error`;
|
|
311
353
|
const createError = ref();
|
|
312
354
|
const editing = ref(false);
|
|
@@ -324,8 +366,9 @@ const control = useFieldControl({
|
|
|
324
366
|
disabled: () => props.disabled,
|
|
325
367
|
required: () => props.required
|
|
326
368
|
});
|
|
369
|
+
const asyncSearch = computed(() => props.searchable ? props.search : void 0);
|
|
327
370
|
const search = useAsyncSearch({
|
|
328
|
-
search: () =>
|
|
371
|
+
search: () => asyncSearch.value,
|
|
329
372
|
onResults: (found, text) => {
|
|
330
373
|
results.value = found;
|
|
331
374
|
searchedOnce.value = true;
|
|
@@ -385,13 +428,17 @@ const inputValue = computed(() => {
|
|
|
385
428
|
const inputPlaceholder = computed(
|
|
386
429
|
() => props.multiple && !props.hideTags && selectedValues.value.length ? void 0 : props.placeholder
|
|
387
430
|
);
|
|
431
|
+
const triggerText = computed(() => props.multiple ? "" : selectedLabel.value);
|
|
432
|
+
const hiddenText = computed(
|
|
433
|
+
() => props.multiple && !props.hideTags ? selectedValues.value.map(labelFor).join(", ") : ""
|
|
434
|
+
);
|
|
388
435
|
const showClear = computed(
|
|
389
436
|
() => props.clearable && interactive.value && selectedValues.value.length > 0
|
|
390
437
|
);
|
|
391
438
|
const activeQuery = computed(() => editing.value ? query.value.trim() : "");
|
|
392
|
-
const sourceOptions = computed(() =>
|
|
439
|
+
const sourceOptions = computed(() => asyncSearch.value ? results.value : props.options);
|
|
393
440
|
const filteredOptions = computed(() => {
|
|
394
|
-
if (
|
|
441
|
+
if (asyncSearch.value) return results.value;
|
|
395
442
|
const needle = normalizeSearch(activeQuery.value);
|
|
396
443
|
if (!needle) return props.options;
|
|
397
444
|
return props.options.filter(
|
|
@@ -502,7 +549,7 @@ function openList() {
|
|
|
502
549
|
if (!interactive.value || layer.isOpen.value) return;
|
|
503
550
|
layer.show();
|
|
504
551
|
initialActive();
|
|
505
|
-
if (
|
|
552
|
+
if (asyncSearch.value && !searchedOnce.value) scheduleSearch(0);
|
|
506
553
|
}
|
|
507
554
|
function closeList() {
|
|
508
555
|
layer.hide();
|
|
@@ -529,6 +576,9 @@ function onBlur(event) {
|
|
|
529
576
|
closeList();
|
|
530
577
|
resetQuery();
|
|
531
578
|
}
|
|
579
|
+
function focusControl() {
|
|
580
|
+
controlEl.value?.focus();
|
|
581
|
+
}
|
|
532
582
|
function onControlMousedown(event) {
|
|
533
583
|
if (!interactive.value) return;
|
|
534
584
|
const target = event.target;
|
|
@@ -536,21 +586,71 @@ function onControlMousedown(event) {
|
|
|
536
586
|
if (!layer.isOpen.value) openList();
|
|
537
587
|
return;
|
|
538
588
|
}
|
|
539
|
-
if (target.closest("button")) {
|
|
589
|
+
if (target.closest("button") && !triggerRef.value?.contains(target)) {
|
|
540
590
|
event.preventDefault();
|
|
541
591
|
return;
|
|
542
592
|
}
|
|
543
593
|
event.preventDefault();
|
|
544
|
-
|
|
594
|
+
focusControl();
|
|
545
595
|
if (layer.isOpen.value) closeList();
|
|
546
596
|
else openList();
|
|
547
597
|
}
|
|
548
598
|
function onToggleClick() {
|
|
549
599
|
if (!interactive.value) return;
|
|
550
|
-
|
|
600
|
+
focusControl();
|
|
551
601
|
if (layer.isOpen.value) closeList();
|
|
552
602
|
else openList();
|
|
553
603
|
}
|
|
604
|
+
const typeahead = useTypeahead();
|
|
605
|
+
function onTypeahead(event) {
|
|
606
|
+
if (event.key.length !== 1 || event.ctrlKey || event.metaKey || event.altKey) return false;
|
|
607
|
+
if (event.key === " " && !typeahead.typing()) return false;
|
|
608
|
+
const { query: text, cycle } = typeahead.type(event.key);
|
|
609
|
+
openList();
|
|
610
|
+
const needle = normalizeSearch(text);
|
|
611
|
+
const list = items.value;
|
|
612
|
+
const start = cycle ? activeIndex.value + 1 : Math.max(activeIndex.value, 0);
|
|
613
|
+
for (let offset = 0; offset < list.length; offset++) {
|
|
614
|
+
const index = (start + offset) % list.length;
|
|
615
|
+
const option = list[index].option;
|
|
616
|
+
if (!option.disabled && normalizeSearch(option.label).startsWith(needle)) {
|
|
617
|
+
activeIndex.value = index;
|
|
618
|
+
break;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return true;
|
|
622
|
+
}
|
|
623
|
+
function openAt(index) {
|
|
624
|
+
openList();
|
|
625
|
+
if (index >= 0) activeIndex.value = index;
|
|
626
|
+
}
|
|
627
|
+
function onTriggerKeydown(event) {
|
|
628
|
+
if (!interactive.value) return;
|
|
629
|
+
if (onTypeahead(event)) {
|
|
630
|
+
event.preventDefault();
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
const open = layer.isOpen.value;
|
|
634
|
+
const last = () => firstEnabled(items.value.length - 1, -1);
|
|
635
|
+
if (!open && (event.key === "Enter" || event.key === " " || event.key === "ArrowDown")) {
|
|
636
|
+
event.preventDefault();
|
|
637
|
+
openList();
|
|
638
|
+
if (!event.altKey && activeIndex.value < 0) activeIndex.value = firstEnabled();
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
if (!open && (event.key === "Home" || event.key === "End")) {
|
|
642
|
+
event.preventDefault();
|
|
643
|
+
openAt(event.key === "Home" ? firstEnabled() : last());
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
if (open && event.key === " ") {
|
|
647
|
+
event.preventDefault();
|
|
648
|
+
const item = items.value[activeIndex.value];
|
|
649
|
+
if (item) void choose(item);
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
onKeydown(event);
|
|
653
|
+
}
|
|
554
654
|
function onKeydown(event) {
|
|
555
655
|
if (!interactive.value) return;
|
|
556
656
|
const open = layer.isOpen.value;
|
|
@@ -666,7 +766,7 @@ function select(option) {
|
|
|
666
766
|
}
|
|
667
767
|
if (editing.value && query.value) {
|
|
668
768
|
resetQuery();
|
|
669
|
-
if (
|
|
769
|
+
if (asyncSearch.value) scheduleSearch(0);
|
|
670
770
|
nextTick(() => {
|
|
671
771
|
activeIndex.value = items.value.findIndex((item) => keyOf(item.option.value) === key);
|
|
672
772
|
});
|
|
@@ -675,17 +775,17 @@ function select(option) {
|
|
|
675
775
|
function dismissQuery() {
|
|
676
776
|
resetQuery();
|
|
677
777
|
if (!props.multiple) closeList();
|
|
678
|
-
else if (
|
|
778
|
+
else if (asyncSearch.value) scheduleSearch(0);
|
|
679
779
|
}
|
|
680
780
|
function remove(value) {
|
|
681
781
|
const key = keyOf(value);
|
|
682
782
|
model.value = selectedValues.value.filter((entry) => keyOf(entry) !== key);
|
|
683
|
-
|
|
783
|
+
focusControl();
|
|
684
784
|
}
|
|
685
785
|
function clear() {
|
|
686
786
|
model.value = props.multiple ? [] : null;
|
|
687
787
|
resetQuery();
|
|
688
|
-
|
|
788
|
+
focusControl();
|
|
689
789
|
}
|
|
690
790
|
function scheduleSearch(delay) {
|
|
691
791
|
const text = activeQuery.value;
|
|
@@ -717,9 +817,9 @@ watch(
|
|
|
717
817
|
{ immediate: true }
|
|
718
818
|
);
|
|
719
819
|
defineExpose({
|
|
720
|
-
focus:
|
|
820
|
+
focus: focusControl,
|
|
721
821
|
open: openList,
|
|
722
822
|
close: closeList,
|
|
723
|
-
el:
|
|
823
|
+
el: controlEl
|
|
724
824
|
});
|
|
725
825
|
</script>
|
|
@@ -6,6 +6,7 @@ declare const __VLS_export: <T extends string | number, M extends T | T[] | null
|
|
|
6
6
|
options?: ComboboxOption<T>[];
|
|
7
7
|
name?: string;
|
|
8
8
|
search?: ComboboxSearch<T>;
|
|
9
|
+
searchable?: boolean;
|
|
9
10
|
filter?: (option: ComboboxOption<T>, query: string) => boolean;
|
|
10
11
|
multiple?: boolean;
|
|
11
12
|
hideTags?: boolean;
|
|
@@ -45,14 +46,14 @@ declare const __VLS_export: <T extends string | number, M extends T | T[] | null
|
|
|
45
46
|
onOpen?: (() => any) | undefined;
|
|
46
47
|
"onUpdate:modelValue"?: ((value: M | undefined) => any) | undefined;
|
|
47
48
|
"onUpdate:query"?: ((value: string) => any) | undefined;
|
|
48
|
-
} & Partial<import("vue").InputHTMLAttributes & import("vue").ReservedProps>> & (typeof globalThis extends {
|
|
49
|
+
} & Partial<import("vue").InputHTMLAttributes & import("vue").ReservedProps & import("vue").ButtonHTMLAttributes>> & (typeof globalThis extends {
|
|
49
50
|
__VLS_PROPS_FALLBACK: infer P;
|
|
50
51
|
} ? P : {});
|
|
51
52
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
52
|
-
focus: () => void
|
|
53
|
+
focus: () => void;
|
|
53
54
|
open: () => void;
|
|
54
55
|
close: () => void;
|
|
55
|
-
el:
|
|
56
|
+
el: import("vue").ComputedRef<HTMLInputElement | HTMLButtonElement | null>;
|
|
56
57
|
}>) => void;
|
|
57
58
|
attrs: any;
|
|
58
59
|
slots: {
|
|
@@ -139,7 +139,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
139
139
|
color?: string | undefined | undefined;
|
|
140
140
|
height?: (string | number) | undefined;
|
|
141
141
|
lang?: string | undefined | undefined;
|
|
142
|
-
type?:
|
|
142
|
+
type?: "submit" | "button" | "reset" | undefined;
|
|
143
143
|
width?: (string | number) | undefined;
|
|
144
144
|
tabindex?: (string | number) | undefined;
|
|
145
145
|
'aria-activedescendant'?: string | undefined | undefined;
|
|
@@ -256,6 +256,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
256
256
|
onCreate?: ((option: ComboboxOption<PaletteOptionValue>) => any) | undefined;
|
|
257
257
|
onOpen?: (() => any) | undefined;
|
|
258
258
|
"onUpdate:query"?: ((value: string) => any) | undefined;
|
|
259
|
+
searchable?: boolean | undefined;
|
|
259
260
|
hideTags?: boolean | undefined;
|
|
260
261
|
creatable?: boolean | import("./types").ComboboxCreate<PaletteOptionValue> | undefined;
|
|
261
262
|
createActions?: import("./types").ComboboxCreateActions<PaletteOptionValue> | undefined;
|
|
@@ -408,7 +409,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
408
409
|
color?: string | undefined | undefined;
|
|
409
410
|
height?: (string | number) | undefined;
|
|
410
411
|
lang?: string | undefined | undefined;
|
|
411
|
-
type?:
|
|
412
|
+
type?: "submit" | "button" | "reset" | undefined;
|
|
412
413
|
width?: (string | number) | undefined;
|
|
413
414
|
tabindex?: (string | number) | undefined;
|
|
414
415
|
'aria-activedescendant'?: string | undefined | undefined;
|
|
@@ -525,6 +526,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
525
526
|
onCreate?: ((option: ComboboxOption<PaletteOptionValue>) => any) | undefined;
|
|
526
527
|
onOpen?: (() => any) | undefined;
|
|
527
528
|
"onUpdate:query"?: ((value: string) => any) | undefined;
|
|
529
|
+
searchable?: boolean | undefined;
|
|
528
530
|
hideTags?: boolean | undefined;
|
|
529
531
|
creatable?: boolean | import("./types").ComboboxCreate<PaletteOptionValue> | undefined;
|
|
530
532
|
createActions?: import("./types").ComboboxCreateActions<PaletteOptionValue> | undefined;
|
|
@@ -152,6 +152,9 @@
|
|
|
152
152
|
:hide-session="settingsHideSession"
|
|
153
153
|
:resolve-page="settingsResolvePage"
|
|
154
154
|
>
|
|
155
|
+
<template v-if="$slots['settings-nav-footer']" #nav-footer="scope">
|
|
156
|
+
<slot name="settings-nav-footer" v-bind="scope" />
|
|
157
|
+
</template>
|
|
155
158
|
<template v-if="$slots['settings-account-start']" #account-start="scope">
|
|
156
159
|
<slot name="settings-account-start" v-bind="scope" />
|
|
157
160
|
</template>
|
|
@@ -323,6 +323,9 @@ declare const __VLS_export: <T = unknown>(__VLS_props: NonNullable<Awaited<typeo
|
|
|
323
323
|
query: string;
|
|
324
324
|
count: number;
|
|
325
325
|
}) => unknown;
|
|
326
|
+
'settings-nav-footer'?: (props: {
|
|
327
|
+
close: () => void;
|
|
328
|
+
}) => unknown;
|
|
326
329
|
'settings-account-start'?: (props: {
|
|
327
330
|
account: SettingsModalAccount;
|
|
328
331
|
close: () => void;
|
|
@@ -4,6 +4,9 @@ import type { RouteLocation } from '../../internal/layout/query';
|
|
|
4
4
|
import type { DialogBeforeClose } from '../overlays/types';
|
|
5
5
|
import type { SettingsModalAccount, SettingsModalPage, SettingsModalSection, SettingsPageResolver, SettingsSectionSlotProps } from './types';
|
|
6
6
|
type __VLS_Slots = {
|
|
7
|
+
'nav-footer'?: (props: {
|
|
8
|
+
close: () => void;
|
|
9
|
+
}) => unknown;
|
|
7
10
|
'account-start'?: (props: {
|
|
8
11
|
account: SettingsModalAccount;
|
|
9
12
|
close: () => void;
|
|
@@ -428,8 +428,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
428
428
|
onFiltersReset?: (() => any) | undefined;
|
|
429
429
|
onFilterRemove?: ((id: string) => any) | undefined;
|
|
430
430
|
}>, {
|
|
431
|
-
debounce: number;
|
|
432
431
|
searchable: boolean;
|
|
432
|
+
debounce: number;
|
|
433
433
|
columnMenu: boolean;
|
|
434
434
|
exportable: boolean;
|
|
435
435
|
exportFileName: string;
|
|
@@ -55,10 +55,54 @@
|
|
|
55
55
|
padding-left: 0.25rem;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
.k-combobox-input:disabled
|
|
58
|
+
.k-combobox-input:disabled,
|
|
59
|
+
.k-combobox-trigger:disabled {
|
|
59
60
|
cursor: not-allowed;
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
.k-combobox-trigger:disabled {
|
|
64
|
+
color: var(--k-text-muted);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.k-combobox.is-select .k-combobox-control:not(.is-disabled, .is-readonly) {
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.k-combobox.is-select .k-combobox-control.is-readonly {
|
|
72
|
+
cursor: default;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.k-combobox-trigger {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex: 1 1 4rem;
|
|
78
|
+
align-items: center;
|
|
79
|
+
min-width: 4rem;
|
|
80
|
+
height: var(--k-combobox-tag-height);
|
|
81
|
+
padding: 0;
|
|
82
|
+
border: 0;
|
|
83
|
+
outline: none;
|
|
84
|
+
background: transparent;
|
|
85
|
+
color: var(--k-text);
|
|
86
|
+
font: inherit;
|
|
87
|
+
text-align: left;
|
|
88
|
+
cursor: inherit;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.k-combobox.is-multiple .k-combobox-control:has(.k-combobox-tag) .k-combobox-trigger {
|
|
92
|
+
padding-left: 0.25rem;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.k-combobox-value {
|
|
96
|
+
min-width: 0;
|
|
97
|
+
overflow-x: clip;
|
|
98
|
+
text-overflow: ellipsis;
|
|
99
|
+
white-space: nowrap;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.k-combobox-value.is-placeholder {
|
|
103
|
+
color: var(--k-text-muted);
|
|
104
|
+
}
|
|
105
|
+
|
|
62
106
|
.k-combobox-lead {
|
|
63
107
|
display: flex;
|
|
64
108
|
margin-right: 0.25rem;
|
|
@@ -28,6 +28,14 @@
|
|
|
28
28
|
background: var(--k-subtle);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
.k-settings-modal-nav-footer {
|
|
32
|
+
flex: none;
|
|
33
|
+
padding: 0.5rem 0.625rem 0.125rem;
|
|
34
|
+
font-size: 0.75rem;
|
|
35
|
+
color: var(--k-text-dimmed);
|
|
36
|
+
overflow-wrap: anywhere;
|
|
37
|
+
}
|
|
38
|
+
|
|
31
39
|
.k-settings-modal-close {
|
|
32
40
|
align-self: flex-start;
|
|
33
41
|
margin-bottom: 0.25rem;
|
|
@@ -512,6 +520,10 @@
|
|
|
512
520
|
display: contents;
|
|
513
521
|
}
|
|
514
522
|
|
|
523
|
+
.k-settings-modal-nav-footer {
|
|
524
|
+
display: none;
|
|
525
|
+
}
|
|
526
|
+
|
|
515
527
|
.k-settings-modal-nav .k-settings-modal-tab,
|
|
516
528
|
.k-settings-modal-close {
|
|
517
529
|
flex: none;
|
package/package.json
CHANGED