@xleddyl/443-components-vue 0.16.34 → 0.16.36
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 +6 -4
- package/README.md +29 -16
- package/dist/components/layout/Breadcrumbs.vue +7 -2
- package/dist/components/layout/Breadcrumbs.vue.d.ts +4 -1
- package/dist/components/layout/types.d.ts +1 -0
- package/dist/components/overlays/CommandPalette.vue +10 -0
- package/dist/components/overlays/types.d.ts +7 -1
- package/dist/components/templates/AuthLayout.vue +53 -40
- package/dist/components/templates/AuthLayout.vue.d.ts +20 -21
- package/dist/components/templates/AuthLogin.vue +220 -0
- package/dist/components/templates/AuthLogin.vue.d.ts +469 -0
- package/dist/components/templates/AuthLogout.vue +82 -0
- package/dist/components/templates/AuthLogout.vue.d.ts +456 -0
- package/dist/components/templates/auth.d.ts +4 -0
- package/dist/components/templates/auth.mjs +17 -0
- package/dist/components/templates/index.d.ts +3 -0
- package/dist/components/templates/index.mjs +3 -0
- package/dist/components/templates/types.d.ts +27 -2
- package/dist/locale/de.mjs +18 -1
- package/dist/locale/en.mjs +18 -1
- package/dist/locale/it.mjs +18 -1
- package/dist/locale/types.d.ts +17 -0
- package/dist/nuxt/runtime/layouts/auth.vue +0 -1
- package/dist/styles/layout/breadcrumbs.css +28 -0
- package/dist/styles/overlays/command.css +4 -0
- package/dist/styles/shared.css +1 -0
- package/dist/styles/templates/auth-layout.css +88 -40
- package/package.json +1 -1
package/CATALOG.md
CHANGED
|
@@ -110,7 +110,7 @@ Playground paths in this file are relative to `playground/nuxt/app/pages/compone
|
|
|
110
110
|
| Actions in a settings section header ("Add user") | `#actions-<id>` on `SettingsModal`, `#settings-actions-<id>` on `DashboardLayout` (gets `page`, `openPage`, `back`) |
|
|
111
111
|
| Page that fills the panel height (a full height grid) | `content="fill"` or `"centered"` on `DashboardLayout` / `AppShell`, `definePageMeta({ content: 'fill' })` |
|
|
112
112
|
| Custom app frame with your own sidebar | `AppShell` + `Sidebar` + `SidebarNav` |
|
|
113
|
-
| Login, sign up, reset password page | `
|
|
113
|
+
| Login, sign up, reset password page | `AuthLogin` + `AuthLogout` (two step flow); `AuthLayout` (or `k-auth`) for other pages |
|
|
114
114
|
| Settings in a modal (account, appearance, your sections) | `SettingsModal` (the `DashboardLayout` embeds it) |
|
|
115
115
|
| Settings as a page with sections | `SettingsPage` + `SettingsSection` + `SettingsGroup` |
|
|
116
116
|
| Theme and preset choice | `AppearanceSettings`, `ThemeSwitch`, `useTheme`, `usePreset` |
|
|
@@ -201,7 +201,7 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
201
201
|
| `Popover` | Floating panel with any content (a form, filters) opened by its trigger. Use `DropdownMenu` for a list of actions. | Model: `v-model:open`. Props: `placement`, `offset`, `arrow`, `label`, `initialFocus`. Slots: default (the trigger), `content`. | `overlays/popover.vue` |
|
|
202
202
|
| `HoverCard` | Rich preview on hover or focus (user card, link preview). Use `Tooltip` for plain text. | Model: `v-model:open`. Props: `placement`, `openDelay`, `closeDelay`, `arrow`, `disabled`. Slots: default (trigger), `content`. | `overlays/hover-card.vue` |
|
|
203
203
|
| `Tooltip` | Short text on hover or focus. Optional shortcut. | Props: `text`, `placement`, `openDelay`, `closeDelay`, `arrow`, `shortcut`, `disabled`. Slots: default (trigger), `content`. | `overlays/tooltip.vue` |
|
|
204
|
-
| `CommandPalette` | Search and command dialog (Cmd+K) with groups, recent items, async search and typed item data. Groups take `icon` (default item icon) and `more` (a last "show all" item). Matching (`matchesSearch`, exported) finds every word in any order, without case or accents. | Models: `v-model:open`, `v-model:query`. Props: `groups` (items with `id`, `label`, `description`, `icon`, `shortcut`, `keywords`, `to`, `data`, `onSelect`), `search(query, signal)`, `shortcut`, `trigger`, `recentKey`, `emptyText`, `notice`. Slots: `item`, `empty`, `group-label`, `after-results`. Events: `select`, `open`, `close`.
|
|
204
|
+
| `CommandPalette` | Search and command dialog (Cmd+K) with groups, recent items, async search and typed item data. Groups take `icon` (default item icon) and `more` (a last "show all" item). Matching (`matchesSearch`, exported) finds every word in any order, without case or accents. | Models: `v-model:open`, `v-model:query`. Props: `groups` (items with `id`, `label`, `description`, `icon`, `badge`, `shortcut`, `keywords`, `to`, `data`, `onSelect`), `search(query, signal)`, `shortcut`, `trigger`, `recentKey`, `emptyText`, `notice`. Slots: `item`, `empty`, `group-label`, `after-results`. Events: `select`, `open`, `close`. | `overlays/command-palette.vue` |
|
|
205
205
|
| `CommandButton` | A `Button` made from a `CommandItem`: label, icon, `to`, `href`, `disabled` and `onSelect` come from the command. | Props: `command`, `label`, `icon`, and every `Button` prop (size, variant, tone). | `overlays/command-palette.vue` |
|
|
206
206
|
|
|
207
207
|
## Data
|
|
@@ -230,7 +230,7 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
230
230
|
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
|
|
231
231
|
| `Card` | Container with optional title, description, icon, actions and footer. Can be a link or a selectable button. | Props: `title`, `description`, `icon`, `variant` (raised, outline, subtle), `padding`, `as`, `to`, `href`, `selected`, `disabled`, `animated`. Slots: default, `header`, `title`, `description`, `icon`, `actions`, `footer`. | `layout/card.vue` |
|
|
232
232
|
| `PageHeader` | Page title with description, breadcrumbs, badge and actions. The page templates include it. | Props: `title`, `description`, `icon`, `breadcrumbs`, `level`, `bordered`, `align`, `truncate`. Slots: `actions`, `badge`, `description`, `title`, `icon`, `breadcrumbs`. | `layout/page-header.vue` |
|
|
233
|
-
| `Breadcrumbs` | Path navigation. | Props: `items` (`label`, `to`, `href`, `icon`), `separator`, `linkLast`, `ancestors
|
|
233
|
+
| `Breadcrumbs` | Path navigation. | Props: `items` (`label`, `to`, `href`, `icon`), `separator`, `linkLast`, `ancestors`, `size` (`md`, `lg` for a title sized trail). Slot: `item`. | `layout/breadcrumbs.vue` |
|
|
234
234
|
| `Stepper` | Step indicator for wizards and multi step flows (import, checkout). Horizontal or vertical, compact on narrow widths. | Model: `v-model` (current step value). Props: `steps` (`value`, `label`, `description`, `icon`, `disabled`, `state`: `complete` or `error`), `label`, `orientation`, `size`, `linear` (only completed and current steps clickable), `readonly`, `compact` (`'auto'` by default, `true`, `false`), `summary` (false hides the compact "Step 2 of 4" line), `positionLabel`, `completeLabel`, `errorLabel`. Event: `select`. | `layout/stepper.vue` |
|
|
235
235
|
| `Tabs` | Tabs with panels, badges and dots. Segmented or underline. | Model: `v-model` (active value). Props: `items` (`value`, `label`, `icon`, `badge`, `badgeTone`, `dot`, `disabled`), `variant`, `size`, `lazy`, `fill`, `stretch`, `inset`, `controls` (id of a panel outside the component: only the tab list renders). Slots: `panel-<value>`, `panel`. | `layout/tabs.vue` |
|
|
236
236
|
| `Accordion` | Collapsible sections. | Model: `v-model` (open value or values). Props: `items` (`value`, `title`, `description`, `content`, `icon`), `multiple`, `collapsible`, `variant`. Slots: default, `title`. | `layout/accordion.vue` |
|
|
@@ -267,7 +267,9 @@ Templates combine core parts into whole pages and layouts. Start from them for n
|
|
|
267
267
|
| Component | Purpose and when to use it | Main props, models, slots, events | Playground |
|
|
268
268
|
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
|
|
269
269
|
| `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`, `sidebar-footer`, `account`, `topbar`, `search-item`, `settings-account-fields`, `settings-section-<id>`, `settings-actions-<id>`. Event: `accountSelect`. | `templates/dashboard-layout.vue` |
|
|
270
|
-
| `AuthLayout` |
|
|
270
|
+
| `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` |
|
|
271
|
+
| `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` |
|
|
272
|
+
| `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` |
|
|
271
273
|
| `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` |
|
|
272
274
|
| `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` |
|
|
273
275
|
| `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` (per tab, for a full height table), `tabs` (`FormDrawerTab`: `fields` gives the error dot and opens the tab on a failed submit), `tabRoute` (keeps the tab in the hash under this key), `trail`, `backLabel`, `form`, `loading`, `readonly`, `creating` (submit says Create, no dirty needed), `requireDirty`, `deletable`, `deleteDisabled`, `deleteHint`, `submitLabel`, `cancelLabel`, `deleteLabel`, `guard`, `guardTitle`, `guardMessage`, `beforeClose`, `onCancel`. Slots: default (`{ tab }`), `actions`, `title-trailing`, `skeleton`, `footer`. Events: `delete`, `navigate`, `afterLeave`. Exposes `confirmDiscard()`, `close()`. | `templates/form-drawer.vue` |
|
package/README.md
CHANGED
|
@@ -424,18 +424,18 @@ Several controls in one `FormField`. Only the primary control takes the field id
|
|
|
424
424
|
|
|
425
425
|
## Components
|
|
426
426
|
|
|
427
|
-
| Group | Components
|
|
428
|
-
| --------- |
|
|
429
|
-
| core | Root, Icon, Button, Spinner, Input, Textarea, FormField, FieldMessage, FieldBoundary, Form, FormAlerts, Kbd, VisuallyHidden
|
|
430
|
-
| forms | Calendar, Checkbox, CheckboxGroup, ColorInput, Combobox, DateInput, DatePicker, FileInput, InputAddon, InputGroup, NumberInput, PasswordInput, PinInput, Radio, RadioGroup, SegmentedControl, Select, Slider, Switch, TimeInput
|
|
431
|
-
| overlays | CommandPalette, ConfirmDialog, ConfirmHost, ContextMenu, Drawer, DropdownMenu, HoverCard, Modal, OverlayHost, Popover, Toaster, Tooltip
|
|
432
|
-
| data | Avatar, AvatarGroup, Badge, DescriptionList, FilterPill, FilterPills, Pagination, SelectionBar, Stat, Table, Tag, TagList, Timeline, Tree
|
|
433
|
-
| layout | Accordion, AppShell, Breadcrumbs, Card, CopyButton, Grid, NavLink, PageHeader, Separator, Sidebar, SidebarNav, SidebarSection, Stack, Stepper, Tabs, ThemeSwitch, Toolbar
|
|
434
|
-
| templates | DashboardLayout, AuthLayout, DashboardPage, ListPage, DetailPage, FormPage, SettingsPage, SettingsSection, SettingsModal, SettingsGroup, AppearanceSettings, SaveBar, ErrorPage, NotFoundPage, EmptyPage, Brand, AccountMenu
|
|
435
|
-
| feedback | Alert, EmptyState, LoadingOverlay, Meter, Progress, ProgressRing, Skeleton
|
|
436
|
-
| grid | DataGrid, GridToolbar, cell renderers (BadgeCell, BooleanCell, ButtonCell, DateCell, EmptyCell, ImageCell, LinkCell)
|
|
437
|
-
| editor | RichTextEditor
|
|
438
|
-
| chart | ChartPanel, ChartLegend, LineChart, BarChart, DoughnutChart
|
|
427
|
+
| Group | Components |
|
|
428
|
+
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
429
|
+
| core | Root, Icon, Button, Spinner, Input, Textarea, FormField, FieldMessage, FieldBoundary, Form, FormAlerts, Kbd, VisuallyHidden |
|
|
430
|
+
| forms | Calendar, Checkbox, CheckboxGroup, ColorInput, Combobox, DateInput, DatePicker, FileInput, InputAddon, InputGroup, NumberInput, PasswordInput, PinInput, Radio, RadioGroup, SegmentedControl, Select, Slider, Switch, TimeInput |
|
|
431
|
+
| overlays | CommandPalette, ConfirmDialog, ConfirmHost, ContextMenu, Drawer, DropdownMenu, HoverCard, Modal, OverlayHost, Popover, Toaster, Tooltip |
|
|
432
|
+
| data | Avatar, AvatarGroup, Badge, DescriptionList, FilterPill, FilterPills, Pagination, SelectionBar, Stat, Table, Tag, TagList, Timeline, Tree |
|
|
433
|
+
| layout | Accordion, AppShell, Breadcrumbs, Card, CopyButton, Grid, NavLink, PageHeader, Separator, Sidebar, SidebarNav, SidebarSection, Stack, Stepper, Tabs, ThemeSwitch, Toolbar |
|
|
434
|
+
| templates | DashboardLayout, AuthLayout, AuthLogin, AuthLogout, DashboardPage, ListPage, DetailPage, FormPage, SettingsPage, SettingsSection, SettingsModal, SettingsGroup, AppearanceSettings, SaveBar, ErrorPage, NotFoundPage, EmptyPage, Brand, AccountMenu |
|
|
435
|
+
| feedback | Alert, EmptyState, LoadingOverlay, Meter, Progress, ProgressRing, Skeleton |
|
|
436
|
+
| grid | DataGrid, GridToolbar, cell renderers (BadgeCell, BooleanCell, ButtonCell, DateCell, EmptyCell, ImageCell, LinkCell) |
|
|
437
|
+
| editor | RichTextEditor |
|
|
438
|
+
| chart | ChartPanel, ChartLegend, LineChart, BarChart, DoughnutChart |
|
|
439
439
|
|
|
440
440
|
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`, `useScrollLock`, `useDirtyGuard`, `useIcons` helpers and `useLinkComponent`, `provideFieldBoundary`, `provideAuxiliaryControls`, `provideForm`, `useLocale`. With the Nuxt module also `useDashboard()` (runtime account, breadcrumbs and badges for the `k-dashboard` layout).
|
|
441
441
|
|
|
@@ -620,7 +620,7 @@ const archived = useRouteState('archived', {
|
|
|
620
620
|
- Pages that set `definePageMeta({ key: (route) => route.fullPath })` remount on every query change; keep the default page key for pages with deep links.
|
|
621
621
|
- To leave the page from inside an overlay, navigate (a link or `router.push`): the new route has no parameter, so the overlay closes. Do not set the ref to `undefined` and navigate in the same tick: the later navigation cancels the earlier one.
|
|
622
622
|
|
|
623
|
-
`CommandPalette`: items take typed `data` (`CommandItem<T>`, `CommandGroup<T>`), which reaches the `#item` slot and the `select` event typed; `emptyText` also takes `(query) => string`. Groups take a `description` (shown after the label), the `#group-label` slot (`{ group, label, description, recent }`) replaces the label, and `notice` or the `#after-results` slot (`{ query, count }`) adds a line under the results, for example "Showing the first results".
|
|
623
|
+
`CommandPalette`: an item takes a `badge` (a label, or `{ label, tone, color }`), shown before its shortcut. Recent items do not keep the badge, because it can change. Items take typed `data` (`CommandItem<T>`, `CommandGroup<T>`), which reaches the `#item` slot and the `select` event typed; `emptyText` also takes `(query) => string`. Groups take a `description` (shown after the label), the `#group-label` slot (`{ group, label, description, recent }`) replaces the label, and `notice` or the `#after-results` slot (`{ query, count }`) adds a line under the results, for example "Showing the first results".
|
|
624
624
|
|
|
625
625
|
- `Brand`: `logo` takes an image URL, trusted inline SVG markup (`'<svg ...>'`) or a component; the `#logo` slot replaces the boxed mark; `show-name` keeps the name visible next to a logo.
|
|
626
626
|
- `Card`: `selected` gives a pressed look (`aria-pressed` on `as="button"`, `aria-selected` with `role="option"` and similar roles); `:animated="false"` turns off the entrance animation.
|
|
@@ -714,7 +714,20 @@ A large dialog (60rem) with a section nav on the left and the content on the rig
|
|
|
714
714
|
|
|
715
715
|
### AuthLayout
|
|
716
716
|
|
|
717
|
-
|
|
717
|
+
Two columns: on the left the brand at the top, then the title, the description and the form (aligned left, `--k-auth-width`, default 24rem), and the footer at the bottom. On the right an aside panel that shows from 960px (`:aside="false"` hides it). `breadcrumbs` replaces the title with a large trail (`Breadcrumbs size="lg"`), for a step of a flow. Props: `title`, `description`, `breadcrumbs`, `footer`, `brandName`, `brandSubtitle`, `brandIcon`, `brandLogo`, `brandTo`, `aside`, `asideTitle`, `asideDescription`, `themeSwitch`. Slots: default (form), `title`, `description`, `links` (under the form), `footer`, `brand`, `aside`, `corner`.
|
|
718
|
+
|
|
719
|
+
### AuthLogin and AuthLogout
|
|
720
|
+
|
|
721
|
+
`AuthLogin` is the complete sign in page, built on `AuthLayout`. Step one asks for the email and checks its format. Step two asks for the password and shows the email in a breadcrumb that goes back to step one. The step is in the query (`?step=password`, `stepKey`), so the browser back button works. `submit({ email, password })` signs in and navigates. A thrown error goes through `submitError` and shows on the form.
|
|
722
|
+
|
|
723
|
+
`AuthLogout` signs out on mount (`logout()`), keeps `account` (`{ email, name }`) in the session storage and reloads `loginTo` (default `/login`) with `?reason=signed-out`. The full reload clears the state of the previous account. `AuthLogin` then shows "See you soon, {name}" with "Sign in again" (straight to the password step) and "Use another account". If `logout()` fails, the page shows retry and a link to the sign in page.
|
|
724
|
+
|
|
725
|
+
```vue
|
|
726
|
+
<KAuthLogin :submit="signIn" :submit-error="toFormError" brand-name="Acme" />
|
|
727
|
+
<KAuthLogout :logout="signOut" :account="{ email: user.email, name: user.firstName }" />
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
Both take the `AuthLayout` frame props and the `brand`, `corner`, `footer` and `aside` slots. `AuthLogin` also has `#links` (`{ email, step }`), for example a password reset link. `rememberSignedOutAccount()`, `takeSignedOutAccount()` and `SIGNED_OUT_REASON` are exported for a custom flow.
|
|
718
731
|
|
|
719
732
|
### Page templates
|
|
720
733
|
|
|
@@ -804,14 +817,14 @@ export default defineAppConfig({
|
|
|
804
817
|
signOutTo: '/logout',
|
|
805
818
|
},
|
|
806
819
|
dashboard: { variant: 'inset', search: true },
|
|
807
|
-
auth: {
|
|
820
|
+
auth: { footer: 'Acme Inc.', asideTitle: 'Run the store.' },
|
|
808
821
|
},
|
|
809
822
|
})
|
|
810
823
|
```
|
|
811
824
|
|
|
812
825
|
The account row opens the SettingsModal (`account.action: 'menu'` with `account.menu` for a dropdown instead). Sections from `app.config` can be built-ins or links (`to`); `settings.presets` limits the preset cards, `settings.signOutTo` adds Sign out, `settings.route` (`true` or a query key) syncs the modal with the URL (see SettingsModal, deep links).
|
|
813
826
|
|
|
814
|
-
Pages pick them with `definePageMeta({ layout: 'k-dashboard', title: 'Items' })` or `layout: 'k-auth'` (the auth
|
|
827
|
+
Pages pick them with `definePageMeta({ layout: 'k-dashboard', title: 'Items' })` or `layout: 'k-auth'` (the auth frame shows `title` and `description` from the page meta). Both layouts set the document title from `meta.title` and the brand name (`Items · Acme`; a page's own `useHead({ title })` wins) and announce route changes through a polite live region, unless the app already renders `<NuxtRouteAnnouncer />`. Breadcrumbs come from `meta.breadcrumbs`, otherwise from the matching navigation item (plus `meta.title` on deeper pages). At runtime `useDashboard().value = { account, breadcrumbs, badges: { '/items': 12 } }` overrides the account, the breadcrumbs and the badges. Set it in route middleware (`definePageMeta({ middleware })`) or a plugin, not in the page `setup`: the layout renders the sidebar and breadcrumbs before the page, so a value set during the page render would differ between the server HTML and hydration.
|
|
815
828
|
|
|
816
829
|
### Starter
|
|
817
830
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<nav
|
|
2
|
+
<nav
|
|
3
|
+
class="k-breadcrumbs"
|
|
4
|
+
:class="[`k-breadcrumbs-${size}`, { 'is-ancestors': ancestors }]"
|
|
5
|
+
:aria-label="navText"
|
|
6
|
+
>
|
|
3
7
|
<ol role="list" class="k-breadcrumbs-list">
|
|
4
8
|
<li v-for="(part, index) in parts" :key="index" class="k-breadcrumbs-item">
|
|
5
9
|
<component
|
|
@@ -32,7 +36,8 @@ const props = defineProps({
|
|
|
32
36
|
label: { type: String, required: false },
|
|
33
37
|
separator: { type: null, required: false, default: "chevron-right" },
|
|
34
38
|
linkLast: { type: Boolean, required: false },
|
|
35
|
-
ancestors: { type: Boolean, required: false }
|
|
39
|
+
ancestors: { type: Boolean, required: false },
|
|
40
|
+
size: { type: String, required: false, default: "md" }
|
|
36
41
|
});
|
|
37
42
|
defineSlots();
|
|
38
43
|
const { t } = useLocale();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IconName } from '../../composables/useIcons';
|
|
2
|
-
import type { BreadcrumbItem } from './types';
|
|
2
|
+
import type { BreadcrumbItem, BreadcrumbsSize } from './types';
|
|
3
3
|
type __VLS_Slots = {
|
|
4
4
|
item?: (props: {
|
|
5
5
|
item: BreadcrumbItem;
|
|
@@ -13,6 +13,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
13
13
|
separator?: IconName;
|
|
14
14
|
linkLast?: boolean;
|
|
15
15
|
ancestors?: boolean;
|
|
16
|
+
size?: BreadcrumbsSize;
|
|
16
17
|
innerHTML?: string | undefined | undefined;
|
|
17
18
|
class?: import("vue").ClassValue;
|
|
18
19
|
style?: import("vue").StyleValue;
|
|
@@ -211,6 +212,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
211
212
|
separator?: IconName;
|
|
212
213
|
linkLast?: boolean;
|
|
213
214
|
ancestors?: boolean;
|
|
215
|
+
size?: BreadcrumbsSize;
|
|
214
216
|
innerHTML?: string | undefined | undefined;
|
|
215
217
|
class?: import("vue").ClassValue;
|
|
216
218
|
style?: import("vue").StyleValue;
|
|
@@ -404,6 +406,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
404
406
|
ref_for?: boolean | undefined | undefined;
|
|
405
407
|
ref_key?: string | undefined | undefined;
|
|
406
408
|
}> & Readonly<{}>, {
|
|
409
|
+
size: BreadcrumbsSize;
|
|
407
410
|
separator: IconName;
|
|
408
411
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
409
412
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -113,6 +113,12 @@
|
|
|
113
113
|
{{ entry.item.description }}
|
|
114
114
|
</span>
|
|
115
115
|
</span>
|
|
116
|
+
<Badge
|
|
117
|
+
v-if="entry.item.badge"
|
|
118
|
+
v-bind="badgeProps(entry.item.badge)"
|
|
119
|
+
size="sm"
|
|
120
|
+
class="k-command-option-badge"
|
|
121
|
+
/>
|
|
116
122
|
<span
|
|
117
123
|
v-if="entry.item.shortcut"
|
|
118
124
|
class="k-command-option-shortcut"
|
|
@@ -157,6 +163,7 @@ import { useRouterLike } from "../../internal/layout/route";
|
|
|
157
163
|
import { ButtonElement } from "../../internal/core/ButtonElement";
|
|
158
164
|
import LiveRegion from "../../internal/core/LiveRegion.vue";
|
|
159
165
|
import Icon from "../core/Icon.vue";
|
|
166
|
+
import Badge from "../data/Badge.vue";
|
|
160
167
|
import Kbd from "../core/Kbd.vue";
|
|
161
168
|
import Spinner from "../core/Spinner.vue";
|
|
162
169
|
import { provideFieldBoundary } from "../../composables/useFieldBoundary";
|
|
@@ -321,6 +328,9 @@ watch(active, (index) => {
|
|
|
321
328
|
if (option && bodyRef.value?.contains(option)) option.scrollIntoView({ block: "nearest" });
|
|
322
329
|
});
|
|
323
330
|
});
|
|
331
|
+
function badgeProps(badge) {
|
|
332
|
+
return typeof badge === "string" ? { label: badge } : badge;
|
|
333
|
+
}
|
|
324
334
|
function readRecent() {
|
|
325
335
|
if (!props.recentKey) return;
|
|
326
336
|
const stored = readStorageJson(props.recentKey);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LinkTarget, PaletteColor } from '../core/types';
|
|
1
|
+
import type { LinkTarget, PaletteColor, Tone } from '../core/types';
|
|
2
2
|
import type { IconName } from '../../composables/useIcons';
|
|
3
3
|
import type { AnchorTarget, Placement, Side, VirtualAnchor } from '../../internal/floating/position';
|
|
4
4
|
export type { AnchorTarget as OverlayAnchorTarget, Placement as OverlayPlacement, Side as OverlaySide, VirtualAnchor as OverlayVirtualAnchor, };
|
|
@@ -62,11 +62,17 @@ export interface MenuSeparator {
|
|
|
62
62
|
export type MenuItem = MenuActionItem | MenuCheckboxItem | MenuRadioItem;
|
|
63
63
|
export type MenuEntry = MenuItem | MenuLabel | MenuSeparator;
|
|
64
64
|
export type MenuItems = MenuEntry[] | MenuEntry[][];
|
|
65
|
+
export interface CommandItemBadge {
|
|
66
|
+
label: string;
|
|
67
|
+
tone?: Tone;
|
|
68
|
+
color?: PaletteColor;
|
|
69
|
+
}
|
|
65
70
|
export interface CommandItem<T = unknown> {
|
|
66
71
|
id: string;
|
|
67
72
|
label: string;
|
|
68
73
|
description?: string;
|
|
69
74
|
icon?: IconName;
|
|
75
|
+
badge?: string | CommandItemBadge;
|
|
70
76
|
shortcut?: string;
|
|
71
77
|
keywords?: string[];
|
|
72
78
|
to?: LinkTarget;
|
|
@@ -1,44 +1,51 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="k-auth" :class="
|
|
2
|
+
<div class="k-auth" :class="{ 'has-aside': aside }">
|
|
3
3
|
<a class="k-auth-skip k-visually-hidden-focusable" :href="`#${mainId}`">{{ skipText }}</a>
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
hide-text
|
|
21
|
-
/>
|
|
22
|
-
</slot>
|
|
23
|
-
<h1 v-if="title || $slots.title" class="k-auth-title">
|
|
24
|
-
<slot name="title">{{ title }}</slot>
|
|
25
|
-
</h1>
|
|
26
|
-
<p v-if="description || $slots.description" class="k-auth-description">
|
|
27
|
-
<slot name="description">{{ description }}</slot>
|
|
28
|
-
</p>
|
|
29
|
-
</header>
|
|
30
|
-
<div v-if="$slots.default" class="k-auth-card">
|
|
31
|
-
<slot />
|
|
4
|
+
<div class="k-auth-panel">
|
|
5
|
+
<header class="k-auth-top">
|
|
6
|
+
<slot name="brand">
|
|
7
|
+
<Brand
|
|
8
|
+
v-if="brandName || brandIcon || brandLogo"
|
|
9
|
+
class="k-auth-brand"
|
|
10
|
+
:name="brandName"
|
|
11
|
+
:icon="brandIcon"
|
|
12
|
+
:logo="brandLogo"
|
|
13
|
+
:to="brandTo"
|
|
14
|
+
hide-text
|
|
15
|
+
/>
|
|
16
|
+
</slot>
|
|
17
|
+
<div v-if="themeSwitch || $slots.corner" class="k-auth-corner">
|
|
18
|
+
<slot name="corner" />
|
|
19
|
+
<ThemeSwitch v-if="themeSwitch" variant="icon" :label="themeLabel" />
|
|
32
20
|
</div>
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
</header>
|
|
22
|
+
<main :id="mainId" class="k-auth-main" tabindex="-1">
|
|
23
|
+
<div class="k-auth-content">
|
|
24
|
+
<header v-if="hasHeader" class="k-auth-header">
|
|
25
|
+
<template v-if="breadcrumbs?.length">
|
|
26
|
+
<h1 v-if="title" class="k-visually-hidden">{{ title }}</h1>
|
|
27
|
+
<Breadcrumbs class="k-auth-trail" :items="breadcrumbs" size="lg" />
|
|
28
|
+
</template>
|
|
29
|
+
<h1 v-else-if="title || $slots.title" class="k-auth-title">
|
|
30
|
+
<slot name="title">{{ title }}</slot>
|
|
31
|
+
</h1>
|
|
32
|
+
<p v-if="description || $slots.description" class="k-auth-description">
|
|
33
|
+
<slot name="description">{{ description }}</slot>
|
|
34
|
+
</p>
|
|
35
|
+
</header>
|
|
36
|
+
<div v-if="$slots.default" class="k-auth-body">
|
|
37
|
+
<slot />
|
|
38
|
+
</div>
|
|
39
|
+
<div v-if="$slots.links" class="k-auth-links">
|
|
40
|
+
<slot name="links" />
|
|
41
|
+
</div>
|
|
35
42
|
</div>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
</
|
|
40
|
-
</
|
|
41
|
-
<aside v-if="
|
|
43
|
+
</main>
|
|
44
|
+
<footer v-if="footer || $slots.footer" class="k-auth-footer">
|
|
45
|
+
<slot name="footer">{{ footer }}</slot>
|
|
46
|
+
</footer>
|
|
47
|
+
</div>
|
|
48
|
+
<aside v-if="aside" class="k-auth-aside" :aria-label="asideText">
|
|
42
49
|
<slot name="aside">
|
|
43
50
|
<div class="k-auth-aside-art" aria-hidden="true">
|
|
44
51
|
<span class="k-auth-aside-orb" />
|
|
@@ -63,20 +70,22 @@
|
|
|
63
70
|
</template>
|
|
64
71
|
|
|
65
72
|
<script setup>
|
|
66
|
-
import { computed, useId } from "vue";
|
|
73
|
+
import { computed, useId, useSlots } from "vue";
|
|
67
74
|
import { useLocale } from "../../composables/useLocale";
|
|
75
|
+
import Breadcrumbs from "../layout/Breadcrumbs.vue";
|
|
68
76
|
import ThemeSwitch from "../layout/ThemeSwitch.vue";
|
|
69
77
|
import Brand from "./Brand.vue";
|
|
70
78
|
const props = defineProps({
|
|
71
|
-
variant: { type: String, required: false, default: "centered" },
|
|
72
79
|
title: { type: String, required: false },
|
|
73
80
|
description: { type: String, required: false },
|
|
81
|
+
breadcrumbs: { type: Array, required: false },
|
|
74
82
|
footer: { type: String, required: false },
|
|
75
83
|
brandName: { type: String, required: false },
|
|
76
84
|
brandSubtitle: { type: String, required: false },
|
|
77
85
|
brandIcon: { type: null, required: false },
|
|
78
|
-
brandLogo: { type:
|
|
86
|
+
brandLogo: { type: null, required: false },
|
|
79
87
|
brandTo: { type: [String, Object], required: false },
|
|
88
|
+
aside: { type: Boolean, required: false, default: true },
|
|
80
89
|
asideTitle: { type: String, required: false },
|
|
81
90
|
asideDescription: { type: String, required: false },
|
|
82
91
|
asideLabel: { type: String, required: false },
|
|
@@ -84,8 +93,12 @@ const props = defineProps({
|
|
|
84
93
|
themeLabel: { type: String, required: false },
|
|
85
94
|
skipLabel: { type: String, required: false }
|
|
86
95
|
});
|
|
96
|
+
const slots = useSlots();
|
|
87
97
|
const { t } = useLocale();
|
|
88
98
|
const asideText = computed(() => props.asideLabel ?? t("auth.aside"));
|
|
89
99
|
const skipText = computed(() => props.skipLabel ?? t("shell.skipToContent"));
|
|
100
|
+
const hasHeader = computed(
|
|
101
|
+
() => !!(props.title || props.breadcrumbs?.length || props.description || slots.title || slots.description)
|
|
102
|
+
);
|
|
90
103
|
const mainId = useId();
|
|
91
104
|
</script>
|
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
import type { AuthLayoutVariant } from './types';
|
|
3
|
-
import type { LinkTarget } from '../core/types';
|
|
4
|
-
declare var __VLS_1: {}, __VLS_8: {}, __VLS_15: {}, __VLS_17: {}, __VLS_19: {}, __VLS_21: {}, __VLS_23: {}, __VLS_25: {};
|
|
1
|
+
declare var __VLS_1: {}, __VLS_8: {}, __VLS_20: {}, __VLS_22: {}, __VLS_24: {}, __VLS_26: {}, __VLS_28: {}, __VLS_30: {};
|
|
5
2
|
type __VLS_Slots = {} & {
|
|
6
|
-
|
|
3
|
+
brand?: (props: typeof __VLS_1) => any;
|
|
7
4
|
} & {
|
|
8
|
-
|
|
5
|
+
corner?: (props: typeof __VLS_8) => any;
|
|
9
6
|
} & {
|
|
10
|
-
title?: (props: typeof
|
|
7
|
+
title?: (props: typeof __VLS_20) => any;
|
|
11
8
|
} & {
|
|
12
|
-
description?: (props: typeof
|
|
9
|
+
description?: (props: typeof __VLS_22) => any;
|
|
13
10
|
} & {
|
|
14
|
-
default?: (props: typeof
|
|
11
|
+
default?: (props: typeof __VLS_24) => any;
|
|
15
12
|
} & {
|
|
16
|
-
links?: (props: typeof
|
|
13
|
+
links?: (props: typeof __VLS_26) => any;
|
|
17
14
|
} & {
|
|
18
|
-
footer?: (props: typeof
|
|
15
|
+
footer?: (props: typeof __VLS_28) => any;
|
|
19
16
|
} & {
|
|
20
|
-
aside?: (props: typeof
|
|
17
|
+
aside?: (props: typeof __VLS_30) => any;
|
|
21
18
|
};
|
|
22
19
|
declare const __VLS_base: import("vue").DefineComponent<{
|
|
23
|
-
variant?: AuthLayoutVariant;
|
|
24
20
|
title?: string | undefined;
|
|
25
21
|
description?: string;
|
|
22
|
+
breadcrumbs?: import("../layout/types.ts").BreadcrumbItem[];
|
|
26
23
|
footer?: string;
|
|
27
24
|
brandName?: string;
|
|
28
25
|
brandSubtitle?: string;
|
|
29
|
-
brandIcon?: IconName;
|
|
30
|
-
brandLogo?:
|
|
31
|
-
brandTo?: LinkTarget;
|
|
26
|
+
brandIcon?: import("../../index.ts").IconName;
|
|
27
|
+
brandLogo?: import("./types").BrandLogo;
|
|
28
|
+
brandTo?: import("../core/types.ts").LinkTarget;
|
|
29
|
+
aside?: boolean;
|
|
32
30
|
asideTitle?: string;
|
|
33
31
|
asideDescription?: string;
|
|
34
32
|
asideLabel?: string;
|
|
@@ -227,15 +225,16 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
227
225
|
ref_for?: boolean | undefined | undefined;
|
|
228
226
|
ref_key?: string | undefined | undefined;
|
|
229
227
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
230
|
-
variant?: AuthLayoutVariant;
|
|
231
228
|
title?: string | undefined;
|
|
232
229
|
description?: string;
|
|
230
|
+
breadcrumbs?: import("../layout/types.ts").BreadcrumbItem[];
|
|
233
231
|
footer?: string;
|
|
234
232
|
brandName?: string;
|
|
235
233
|
brandSubtitle?: string;
|
|
236
|
-
brandIcon?: IconName;
|
|
237
|
-
brandLogo?:
|
|
238
|
-
brandTo?: LinkTarget;
|
|
234
|
+
brandIcon?: import("../../index.ts").IconName;
|
|
235
|
+
brandLogo?: import("./types").BrandLogo;
|
|
236
|
+
brandTo?: import("../core/types.ts").LinkTarget;
|
|
237
|
+
aside?: boolean;
|
|
239
238
|
asideTitle?: string;
|
|
240
239
|
asideDescription?: string;
|
|
241
240
|
asideLabel?: string;
|
|
@@ -434,7 +433,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
434
433
|
ref_for?: boolean | undefined | undefined;
|
|
435
434
|
ref_key?: string | undefined | undefined;
|
|
436
435
|
}> & Readonly<{}>, {
|
|
437
|
-
|
|
436
|
+
aside: boolean;
|
|
438
437
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
439
438
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
440
439
|
declare const _default: typeof __VLS_export;
|