@xleddyl/443-components-vue 0.16.93 → 0.16.94

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 CHANGED
@@ -61,6 +61,7 @@ Playground paths in this file are relative to `playground/nuxt/app/pages/compone
61
61
  | Number in a range | `Slider` |
62
62
  | One time code, OTP | `PinInput` |
63
63
  | File or folder upload with drop zone | `FileInput` |
64
+ | Focal point of an image (the part kept in view when cropped) | `FocalPointInput` (preview the crops with `Thumbnail` `focal`) |
64
65
  | Drop files on any element | `useFileDrop` |
65
66
  | Confirm a destructive action | `useConfirm` |
66
67
  | Show a message the user must acknowledge | `useAlert` |
@@ -98,6 +99,7 @@ Playground paths in this file are relative to `playground/nuxt/app/pages/compone
98
99
  | Reorder any list by drag and keyboard | `useSortable` |
99
100
  | Status label, counter, dot | `Badge` |
100
101
  | User picture or initials; stack of users | `Avatar`; `AvatarGroup` |
102
+ | Preview of an image, video or file (media grid, upload tile, table cell) | `Thumbnail` |
101
103
  | Key figure with delta and trend (KPI) | `Stat` |
102
104
  | Label and value pairs (details) | `DescriptionList` |
103
105
  | Event history, activity feed | `Timeline` |
@@ -107,6 +109,7 @@ Playground paths in this file are relative to `playground/nuxt/app/pages/compone
107
109
  | Wizard steps, step indicator (Step 2 of 4) | `Stepper` |
108
110
  | Collapsible sections, FAQ | `Accordion` |
109
111
  | Container with title and actions | `Card` |
112
+ | "Add" tile next to a grid of items, empty drop area | `Card` `variant="dashed"` (`as="button"`, `icon`, `title`) |
110
113
  | Page title, description, breadcrumbs, actions | `PageHeader` (or a page template) |
111
114
  | Breadcrumb trail as the page title (a record, a nested page) | `trail` on `PageHeader` |
112
115
  | Breadcrumbs only | `Breadcrumbs` |
@@ -163,7 +166,7 @@ Playground paths in this file are relative to `playground/nuxt/app/pages/compone
163
166
 
164
167
  ## Forms
165
168
 
166
- 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`.
169
+ 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`, `FocalPointInput` has no `required` and no `size`. They use `v-model`.
167
170
 
168
171
  | Component | Purpose and when to use it | Main props, models, slots, events | Playground |
169
172
  | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
@@ -190,6 +193,7 @@ All field components work inside `FormField` and take `invalid`, `disabled`, `re
190
193
  | `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` |
191
194
  | `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` |
192
195
  | `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`, `fill` (fills the height of its parent, centered), `loading`, `capture`, `title`, `dropText`, `hint`. Slots: `title`, `hint`, `actions`. Events: `add`, `remove`, `invalid`, `reject`. | `forms/file-input.vue` |
196
+ | `FocalPointInput` | Point on an image that must stay visible when it is cropped: click or drag on the image, or the arrow keys. | Model: `FocalPoint` (`{ x, y }` from 0 to 1) or null. Props: `src`, `alt`, `label`, `clearable` (a Reset button, Delete and Backspace clear), `clearLabel`, `horizontalLabel`, `verticalLabel`, `emptyText`, `step` (0.01, Shift times 10), `invalid`, `disabled`, `readonly`. | `forms/focal-point-input.vue` |
193
197
 
194
198
  ## Overlays
195
199
 
@@ -226,6 +230,7 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
226
230
  | `Badge` | Status label, counter or dot. Not interactive. | Props: `label` (string or number), `tone`, `color` (palette name or hex), `variant` (soft, solid, outline), `size`, `dot`, `pulse`, `icon`. Slot: default. | `data/badge.vue` |
227
231
  | `Avatar` | User picture with initials fallback and status dot. | Props: `src`, `name`, `alt`, `size` (xs to xl), `shape` (circle, square), `status` (online, away, busy, offline), `decorative`. Slot: `fallback`. | `data/avatar.vue` |
228
232
  | `AvatarGroup` | Overlapping stack of avatars with "+N". | Props: `items` (`src`, `name`, `alt`), `max`, `size`, `shape`, `moreLabel`. | `data/avatar.vue` |
233
+ | `Thumbnail` | Preview box for an image, the first frame of a video or a file icon, with loading and missing states. Fixed sizes for inline use or fluid with an aspect ratio. | Props: `src`, `alt`, `kind` (image, video, file, icon), `icon` (fallback icon), `fit` (cover, contain), `aspect` (`'4/3'`, `'16/9'` or a number, default 1), `size` (xs to lg, fluid when unset), `rounded` (none, sm, md, lg, full), `missing`, `missingText`, `focal` (`{ x, y }` from 0 to 1), `objectPosition`, `caption`, `reveal` (overlays shown only on hover and focus, default `['caption']`), `lazy`. Slots: default (replaces the media), `top-start`, `top-end`, `caption`. | `data/thumbnail.vue` |
229
234
  | `Stat` | Key figure (KPI) with unit, delta, trend, hint and optional sparkline. Can be a link. | Props: `label`, `value`, `unit`, `delta`, `trend` (up, down, flat), `invert` (down is good), `hint`, `icon`, `loading`, `to`, `href`, `plain`. Slots: `label`, `value`, `icon`, `sparkline`, `footer`. | `data/stat.vue` |
230
235
  | `RecordList` | Short list of records (settings, users, tokens): title, badge, description, leading and action slots, `SkeletonList` while `loading`, empty state. | Props: `items` (`RecordListItem`: `id`, `title` (truncated, full text on hover), `description`, `badge` `{ label, tone }`), `loading`, `avatar`, `action`, `label`, `skeletonRows`, `emptyText`, `emptyDescription`, `emptyIcon`, `emptyVariant` (card, the default, or plain). Event: `row-click` (`item`, `event`): each row becomes a navigation item (padding, hover and press background like a ghost button, no separators) and its title a button, so Tab reaches every row and Enter or Space opens it (focus ring on the row, the description is the button description). Clicks on buttons, links, inputs, menu items and inside an open menu, popover or dialog of the row are ignored, and pressing them does not tint the row; `rowClickable(item)` keeps some rows static in the same list (no button, no hover). Slots: `leading`, `action` (`{ item }`), `empty`, `empty-actions` (buttons in the default empty state). | `data/record-list.vue` |
231
236
  | `DescriptionList` | Label and value pairs for a record. Use it on detail views. | Props: `items` (`key`, `label`, `value`, `hint`), `layout` (stacked, inline, grid), `columns`, `divided`, `emptyText`. Slots: `term`, `value`, `value-<key>`. | `data/description-list.vue` |
@@ -236,7 +241,7 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
236
241
 
237
242
  | Component | Purpose and when to use it | Main props, models, slots, events | Playground |
238
243
  | ---------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------- |
239
- | `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` |
244
+ | `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, dashed: a centered add or empty tile), `padding`, `as`, `to`, `href`, `selected`, `disabled`, `animated`. Slots: default, `header`, `title`, `description`, `icon`, `actions`, `footer`. | `layout/card.vue` |
240
245
  | `PageHeader` | Page title with description, breadcrumbs, badge and actions. The page templates include it. | Props: `title`, `description`, `icon`, `breadcrumbs` (small trail above the title), `trail` (the earlier levels as links: the title becomes a breadcrumb trail whose last item is the heading), `trailLabel`, `level`, `bordered`, `align`, `truncate`. Slots: `actions`, `badge`, `description`, `title`, `icon`, `breadcrumbs`. | `layout/page-header.vue` |
241
246
  | `Breadcrumbs` | Path navigation. | Props: `items` (`label`, `to`, `href`, `icon`), `separator`, `linkLast`, `ancestors`, `size` (`md`, `lg` for a title sized trail), `heading` (the current item is a heading of that level). Slot: `item`. | `layout/breadcrumbs.vue` |
242
247
  | `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` |
package/README.md CHANGED
@@ -468,18 +468,18 @@ async function switchView() {
468
468
 
469
469
  ## Components
470
470
 
471
- | Group | Components |
472
- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
473
- | core | Root, Icon, Button, Spinner, Input, Textarea, FormField, FieldMessage, FieldBoundary, Form, FormAlerts, Kbd, VisuallyHidden |
474
- | forms | Calendar, Checkbox, CheckboxGroup, ColorInput, Combobox, DateInput, DatePicker, FileInput, InputAddon, InputGroup, NumberInput, PaletteSelect, PasswordInput, PinInput, Radio, RadioGroup, SegmentedControl, Select, Slider, Switch, TimeInput, TreeSelect |
475
- | overlays | CommandButton, CommandList, CommandPalette, ConfirmDialog, ConfirmHost, ContextMenu, Drawer, DropdownMenu, HoverCard, Modal, OverlayHost, Popover, Toaster, Tooltip |
476
- | data | Avatar, AvatarGroup, Badge, DescriptionList, FilterPill, FilterPills, Pagination, RecordList, SelectionBar, Stat, Table, Tag, TagList, Timeline, Tree |
477
- | layout | Accordion, AppShell, Breadcrumbs, Card, CopyButton, Grid, NavLink, PageHeader, Separator, Sidebar, SidebarNav, SidebarSection, Stack, Stepper, Tabs, ThemeSwitch, Toolbar |
478
- | templates | DashboardLayout, AuthLayout, AuthLogin, AuthLogout, DashboardPage, ListPage, DetailPage, FormPage, SettingsPage, SettingsSection, SettingsModal, SettingsGroup, AppearanceSettings, SaveBar, ErrorPage, NotFoundPage, EmptyPage, Brand, AccountMenu, FormDrawer |
479
- | feedback | Alert, EmptyState, LoadingOverlay, Meter, Progress, ProgressRing, Skeleton, SkeletonForm, SkeletonList |
480
- | grid | DataGrid, GridToolbar, cell renderers (BadgeCell, BooleanCell, ButtonCell, DateCell, EmptyCell, ImageCell, LinkCell) |
481
- | editor | RichTextEditor, TemplateEditor, TemplateText |
482
- | chart | ChartPanel, ChartLegend, LineChart, BarChart, DoughnutChart |
471
+ | Group | Components |
472
+ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
473
+ | core | Root, Icon, Button, Spinner, Input, Textarea, FormField, FieldMessage, FieldBoundary, Form, FormAlerts, Kbd, VisuallyHidden |
474
+ | forms | Calendar, Checkbox, CheckboxGroup, ColorInput, Combobox, DateInput, DatePicker, FileInput, FocalPointInput, InputAddon, InputGroup, NumberInput, PaletteSelect, PasswordInput, PinInput, Radio, RadioGroup, SegmentedControl, Select, Slider, Switch, TimeInput, TreeSelect |
475
+ | overlays | CommandButton, CommandList, CommandPalette, ConfirmDialog, ConfirmHost, ContextMenu, Drawer, DropdownMenu, HoverCard, Modal, OverlayHost, Popover, Toaster, Tooltip |
476
+ | data | Avatar, AvatarGroup, Badge, DescriptionList, FilterPill, FilterPills, Pagination, RecordList, SelectionBar, Stat, Table, Tag, TagList, Thumbnail, Timeline, Tree |
477
+ | layout | Accordion, AppShell, Breadcrumbs, Card, CopyButton, Grid, NavLink, PageHeader, Separator, Sidebar, SidebarNav, SidebarSection, Stack, Stepper, Tabs, ThemeSwitch, Toolbar |
478
+ | templates | DashboardLayout, AuthLayout, AuthLogin, AuthLogout, DashboardPage, ListPage, DetailPage, FormPage, SettingsPage, SettingsSection, SettingsModal, SettingsGroup, AppearanceSettings, SaveBar, ErrorPage, NotFoundPage, EmptyPage, Brand, AccountMenu, FormDrawer |
479
+ | feedback | Alert, EmptyState, LoadingOverlay, Meter, Progress, ProgressRing, Skeleton, SkeletonForm, SkeletonList |
480
+ | grid | DataGrid, GridToolbar, cell renderers (BadgeCell, BooleanCell, ButtonCell, DateCell, EmptyCell, ImageCell, LinkCell) |
481
+ | editor | RichTextEditor, TemplateEditor, TemplateText |
482
+ | chart | ChartPanel, ChartLegend, LineChart, BarChart, DoughnutChart |
483
483
 
484
484
  Composables: `useTheme`, `usePreset`, `useForm`, `useField`, `useFieldControl`, `useToast` (and `toast`), `useConfirm`, `useAlert`, `usePrompt`, `useModal`, `useDrawer`, `useOverlay`, `useModalContext`, `useLoading` (and `withLoading`), `useLoadingState`, `useHotkey`, `useCopy`, `useFileDrop` (with `readDroppedFiles`), `useSortable`, `usePasswordStrength`, `useTableSort`, `useAppShell`, `useRouteState`, `useRouteRecord`, `usePageCommands`, `usePreference` (with `usePreferences`, `createPreferences`, `providePreferences`), `useScrollLock`, `useLeaveGuard` (with `useLeaveScope`, `provideLeaveScope`), `useDirtyGuard`, `useIcons` helpers and `useLinkComponent`, `provideFieldBoundary`, `provideAuxiliaryControls`, `provideForm`, `provideGridConfig` (with `createGridConfig`, `useGridConfig`), `useLocale`. With the Nuxt module also `useDashboard()` (runtime account, breadcrumbs and badges for the `k-dashboard` layout) and `useNavigationPending()` (`true` while a navigation to another path renders the new page), auto-imported or imported from `@xleddyl/443-components-vue/nuxt/composables`.
485
485
 
@@ -536,6 +536,7 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
536
536
  ```
537
537
 
538
538
  - `Tabs` items take `dot: true` for a small indicator without a number (`dotTone`, default `danger`; `dotLabel` is the hidden text, default "Needs attention"). `color` (a palette name or a hex, `ColorValue`) draws a small color dot before the label, separate from the status dot. `title` shows a tooltip on hover and keyboard focus (the native `title` only until mount) and becomes the tab description; a disabled tab keeps it (it uses `aria-disabled`, cannot be selected and is skipped by Tab and the arrow keys), so it can say why it is disabled. The same items work in the `tabs` of `Modal`, `Drawer`, `FormDrawer` and `DetailPage`.
539
+ - `Card` takes `variant="dashed"` (`CardVariant`) for a placeholder tile: a dashed `--k-line-strong` border on `--k-subtle`, with the icon, title and description centered in a column (the icon in a raised box, the title at 0.8125rem). As a button (`as="button"`) or a link (`to`, `href`) it gets the hover and focus of the `FileInput` dropzone (`--k-fill` and a `--k-text-dimmed` border on hover, a solid `--k-ring` border and the focus ring on focus); `disabled` dims it, and `selected` tints it with the accent, for a drop target while something is dragged over it. Use it for an "Add" tile at the end of a grid of items and for an empty area: `<KCard variant="dashed" as="button" icon="plus" title="Add block" @click="add" />`.
539
540
  - `DropdownMenu` takes `matchTriggerWidth` (the menu is at least as wide as its trigger) and `minWidth` (a CSS length).
540
541
  - `PageHeader` takes `align` (`'end'` by default, `'start'` or `'center'`) for the title block and the actions, and `truncate` to keep the title on one line with an ellipsis (the full title is in its `title` attribute). `trail` (`BreadcrumbItem[]`, the earlier levels as links) turns the title into a breadcrumb trail that ends with `title`, at the page title size: a `nav` (named by `trailLabel`, default "Breadcrumb") around an ordered list whose last item is the heading (`h<level>`, `aria-current="page"`, only the title, `#title` fills it). With `truncate` the trail stays on one line and the title gets the ellipsis. Use it for a record or a nested page instead of `Breadcrumbs` in `#title` (a `nav` inside a heading). `breadcrumbs` stays the small trail above the title.
541
542
  - `RichTextEditor` accepts `'underline'` in `toolbar` (not in the default toolbar).
@@ -545,6 +546,15 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
545
546
  - `FilterPills` is generic: the value type comes from the options, `multiple` makes the model an array and `required` drops `null` from it (like `SegmentedControl`). Options take `menu` items (a dropdown trigger showing `valueLabel`) or `panel: true`, which opens a popover with the `#panel-<value>` slot (`{ option, active, toggle, close }`, `panelLabel` names it). The `#pill` slot renders any trigger and its scope has `defaultPill`, a component that renders the built-in pill for that option, so one custom pill does not mean rewriting the others: `<component :is="defaultPill" v-else />`. `FilterPill` is exported so custom triggers match the other pills.
546
547
  - `SegmentedControl` with `required` narrows `v-model` to a non null value. Options take `title` (tooltip and description) and `muted`, and the `#option` slot replaces the content of each option.
547
548
  - `FileInput` takes `directory` (folder picker; dropped folders are walked, every file keeps its relative path) or `directory="drop"` (the click opens a file picker, dropped folders are still walked), `directoryAction` (an "Upload a folder" button under the dropzone, `directoryActionLabel` renames it) or the `#actions` slot (`{ browse, browseDirectory, disabled }`), `skipHidden` (ignores dot files and dot folders), `list: false` (no file list: picks and drops only emit `add`), `fill` (the dropzone fills the height of its flex column parent, with the icon and the text centered: an import screen), `loading` and the `#hint` slot. `add` receives `(files, { entries: [{ file, path }], directories, source, event, dataTransfer })`; `directories` lists every folder path of a folder pick or drop, empty folders included, and `add` also fires for a drop of empty folders. `invalid` fires per file and `reject` once with every rejected file (`(events, detail)`). `acceptMode="hint"` only passes `accept` to the picker and leaves filtering to the host. The component exposes `browse()`, `browseDirectory()`, `addFiles()` and `focus()`.
549
+ - `FocalPointInput` edits the point of an image that must stay visible when it is cropped: `v-model` is a `FocalPoint` (`{ x, y }`, each from 0 to 1, rounded to 0.001) or `null` (not set). Click or drag on the `src` image to place the crosshair; the arrow keys move it by `step` (default 0.01, ten times with Shift; from the center when it is not set), Home, End, Page Up and Page Down move along one axis. It is a group (named by `label` or the FormField label, with a development warning when unnamed) of two visually hidden range inputs, "Horizontal position" and "Vertical position" (`horizontalLabel`, `verticalLabel`), with one tab stop: their value text is the percentage, or "Not set" (`emptyText`), and a hidden hint describes the pointer and keys. The current value shows under the image ("X 30%, Y 40%"). `clearable` adds a Reset button (`clearLabel`, focus moves to the point before it disappears) and lets Delete and Backspace clear the value. `disabled` follows `Form`, `Fieldset` and `FormField` (an explicit `:disabled="false"` opts out), `readonly` keeps the point visible and focusable without changes, `invalid` comes from the field. `--k-focal-point-input-height` (20rem) caps the image height. Pass the value to `Thumbnail` `focal` to preview the crops.
550
+
551
+ ```vue
552
+ <KFormField label="Focal point">
553
+ <KFocalPointInput v-model="focal" :src="url" :alt="alt" clearable />
554
+ </KFormField>
555
+ <KThumbnail :src="url" aspect="16/9" :focal="focal" />
556
+ ```
557
+
548
558
  - `TagList` renders `v-model` (`TagListItem[]`: `value`, `label`, `tone`, `icon`, `removable`, `disabled`) as `Tag` chips in a labelled list (`label`, default "Items"). `removable` (or `removable` per item) adds the remove button; the chip is dropped from the model, `remove(item, index)` fires, focus moves to the neighbor and "Label removed" is announced. `sortable` reorders by pointer drag (the list updates live while dragging, Escape cancels), and the chips become one tab stop: the arrow keys, Home and End move between chips, Alt with an arrow key (or Alt with Home and End) moves the focused chip, Delete removes it, and every move is announced ("Name moved to position 2 of 4", `sortable.moved`). `moveButtons` adds "Move earlier" and "Move later" buttons to every chip, a single pointer alternative to dragging. A disabled item cannot move or be removed. `move({ item, from, to })` fires after each move. `accept` (a MIME type, a list of them, or `(event) => boolean`) makes the list a drop target for native drags from outside: an insertion marker follows the pointer and `itemDrop({ index, dataTransfer, event })` (`@item-drop`, named apart from the native `drop` event) gives the insertion index, so the host inserts the item (`dropEffect`, default `copy`, must match the `effectAllowed` of the source). The `#item` slot (`{ item, index }`) replaces the chip label.
549
559
 
550
560
  ```vue
@@ -562,6 +572,16 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
562
572
 
563
573
  - `useSortable(container, options)` is the reorder logic of `TagList` for any list. Options: `items` (a ref or getter), `onMove(items, move)` (`SortableMove`: `{ item, from, to, items, source }`, write `items` back to your state), `orientation` (`'vertical'` by default, `'horizontal'` for wrapping rows), `disabled`, `handle` (a selector: only a pointer down on it starts a drag; without it any pointer down outside buttons, links and inputs does), `canMove(item, index)`, `label(item)` and `movedText(move)` for the announcement. Bind `itemProps(index)` on each item element (the attribute marks it, plus pointer and Alt with arrow key handlers) and render `announcement` in a polite live region. `move(from, to, { announce })` moves from your own buttons, `dragging` is the index being dragged (for a lifted style), `canMove(index)` reports locked items. Pointer drags reorder live and follow the pointer, Escape or a cancelled pointer puts the item back, and the click after a drag is swallowed.
564
574
 
575
+ - `Thumbnail` previews an image, a video or a file: `kind` (`ThumbnailKind`, `'image' | 'video' | 'file' | 'icon'`, default `'image'`), `src`, `alt` and `icon` (the fallback icon, by default `photo`, `video-camera` or `document`). A video shows its first frame (`preload="metadata"`, muted, no controls) under a play glyph. Without `size` it is fluid (the width of its parent, the height from `aspect`, a ratio string like `'4/3'` or a number, default 1); `size` (`ThumbnailSize`, `'xs' | 'sm' | 'md' | 'lg'`) gives a fixed inline box for tables and lists. `fit` is `'cover'` (default) or `'contain'`, `rounded` (`ThumbnailRounded`, `'none' | 'sm' | 'md' | 'lg' | 'full'`) overrides the radius of the size, and `focal` (`FocalPoint`, `{ x, y }` from 0 to 1, what `FocalPointInput` edits) or `objectPosition` (any CSS value, it wins) choose the part of the image that stays in view. While the media loads the box pulses; `missing`, or an image or video that fails to load, shows a hatched box with the icon and a hidden "File not available" (`thumbnail.missing`, `missingText` overrides it). The `top-start` and `top-end` slots put badges and actions in the corners, `caption` (or the `#caption` slot) sits at the bottom on a readable scrim, and `reveal` (`ThumbnailOverlay[]`, default `['caption']`) lists the overlays that only show on hover and focus, also when a link or button around the thumbnail is hovered or focused (always on touch screens). The default slot replaces the media with your own content (a text preview). Text and icons over media use the `--k-media-scrim` and `--k-media-text` tokens, the same in both themes; use them for your own overlays too.
576
+
577
+ ```vue
578
+ <KThumbnail :src="url" kind="video" aspect="4/3" :caption="name" :reveal="['caption', 'top-end']">
579
+ <template #top-end>
580
+ <KButton icon="trash" size="xs" variant="solid" tone="neutral" square aria-label="Remove" />
581
+ </template>
582
+ </KThumbnail>
583
+ ```
584
+
565
585
  - `useFileDrop` returns `{ over, reset }` and takes `ignore(event)`. A drop handled by a nested drop zone is skipped by the outer ones, and the state resets after any drop, even when a child stops propagation. `readDroppedFiles(dataTransfer)` walks dropped folders (call it synchronously in the drop handler) and resolves to `[{ file, path }]`; `readDroppedFiles(dataTransfer, { directories: true })` resolves to `{ files, directories }` with every folder path, empty ones included, and `skipHidden: true` leaves out dot entries.
566
586
  - `Tabs` items take `badgeTone` and `badgeLabel` (the accessible name of the badge); the `#panel="{ item }"` slot renders a single panel for the active tab. `stretch` makes the tabs fill the remaining height of a flex column and the active panel grow with it (`flex: 1; min-height: 0`), and `inset` spaces the tab list from the container edges with the panel flush below it, for inspectors and side panes. `Breadcrumbs` items take `attrs` and `onClick` (an item without a link renders a button, handy for drop targets), `#item` customizes the content, and `ancestors` links every item and ends with a separator (`breadcrumbsAncestors` on `PageHeader`). `heading` (a heading level) renders the current item as that heading, for a trail that is the title of the page. `Accordion` takes `variant` `card` (default), `outline` (the same card without a shadow), `separated` or `plain`; items take `description`, and `contentVariant="neutral"` drops the content padding and text styling.
567
587
  - `RichTextEditor` labels heading buttons by their real level (`headingLabel="relative"` numbers them from 1) and `toolbar` picks and orders the buttons: `['headings', '|', 'bold', 'italic', 'link']`.
@@ -991,7 +1011,7 @@ The components target WCAG 2.2 AA in every preset and both themes.
991
1011
 
992
1012
  Accessibility related props and defaults:
993
1013
 
994
- - Accessible names: `label` on `RadioGroup` and `CheckboxGroup` (alias of `legend`), `SegmentedControl`, `Slider`, `PinInput`, `InputGroup`, `Tabs`, `Toolbar`, `Modal`, `Drawer` and `useModal`/`useDrawer` options (when there is no `title`), `Card` (stretched link without a title), `ChartLegend`. `AppShell` takes `closeLabel` for the close button of the mobile navigation, which opens as a named modal dialog. `Sidebar`'s collapse button keeps one label (`collapseLabel`) and exposes the state with `aria-expanded`.
1014
+ - Accessible names: `label` on `RadioGroup` and `CheckboxGroup` (alias of `legend`), `SegmentedControl`, `Slider`, `FocalPointInput`, `PinInput`, `InputGroup`, `Tabs`, `Toolbar`, `Modal`, `Drawer` and `useModal`/`useDrawer` options (when there is no `title`), `Card` (stretched link without a title), `ChartLegend`. `AppShell` takes `closeLabel` for the close button of the mobile navigation, which opens as a named modal dialog. `Sidebar`'s collapse button keeps one label (`collapseLabel`) and exposes the state with `aria-expanded`.
995
1015
  - Heading levels: `level` on `Calendar`, `DatePicker`, `ChartPanel`, `ErrorPage` and `NotFoundPage`; page templates pass `level + 1` to their sections and empty states.
996
1016
  - Live roles are opt in on `Alert`: pass `role="alert"` or `role="status"` for messages that appear at runtime; static banners get none. Without a title the tone is spoken from a hidden prefix.
997
1017
  - `Toolbar` uses roving focus by default (`:roving="false"` renders a plain named group).
@@ -10,7 +10,7 @@ type __VLS_Slots = {} & {
10
10
  };
11
11
  declare const __VLS_base: import("vue").DefineComponent<{
12
12
  label?: string;
13
- type?: "submit" | "button" | "reset" | undefined;
13
+ type?: "reset" | "submit" | "button" | undefined;
14
14
  size?: ButtonSize;
15
15
  tone?: Tone;
16
16
  variant?: ButtonVariant;
@@ -237,7 +237,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
237
237
  popovertargetaction?: import("../../index.ts").PopoverTargetAction | undefined;
238
238
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
239
239
  label?: string;
240
- type?: "submit" | "button" | "reset" | undefined;
240
+ type?: "reset" | "submit" | "button" | undefined;
241
241
  size?: ButtonSize;
242
242
  tone?: Tone;
243
243
  variant?: ButtonVariant;
@@ -466,7 +466,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
466
466
  size: ButtonSize;
467
467
  tone: Tone;
468
468
  tooltip: string | false;
469
- type: "submit" | "button" | "reset";
469
+ type: "reset" | "submit" | "button";
470
470
  variant: ButtonVariant;
471
471
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
472
472
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -0,0 +1,157 @@
1
+ <template>
2
+ <span
3
+ class="k-thumbnail"
4
+ :class="[
5
+ size ? `k-thumbnail-${size}` : 'k-thumbnail-fluid',
6
+ `k-thumbnail-${fit}`,
7
+ `k-thumbnail-rounded-${radius}`,
8
+ {
9
+ 'has-media': hasMedia,
10
+ 'is-loading': loading,
11
+ 'is-missing': isMissing
12
+ }
13
+ ]"
14
+ :style="{ '--k-thumbnail-aspect': aspectRatio }"
15
+ >
16
+ <span v-if="$slots.default" class="k-thumbnail-content"><slot /></span>
17
+ <template v-else>
18
+ <img
19
+ v-if="showImage"
20
+ ref="image"
21
+ class="k-thumbnail-media"
22
+ :class="{ 'is-loaded': loaded }"
23
+ :src="src"
24
+ :alt="alt ?? ''"
25
+ :style="mediaStyle"
26
+ :loading="lazy ? 'lazy' : void 0"
27
+ decoding="async"
28
+ draggable="false"
29
+ @load="loaded = true"
30
+ @error="failed = true"
31
+ />
32
+ <span
33
+ v-else
34
+ class="k-thumbnail-frame"
35
+ :role="alt ? 'img' : void 0"
36
+ :aria-label="alt || void 0"
37
+ :aria-hidden="alt ? void 0 : 'true'"
38
+ >
39
+ <video
40
+ v-if="showVideo"
41
+ ref="video"
42
+ class="k-thumbnail-media"
43
+ :class="{ 'is-loaded': loaded }"
44
+ :src="videoSrc"
45
+ :style="mediaStyle"
46
+ preload="metadata"
47
+ muted
48
+ playsinline
49
+ tabindex="-1"
50
+ @loadeddata="loaded = true"
51
+ @error="failed = true"
52
+ />
53
+ <span v-if="showVideo" class="k-thumbnail-play"><Icon name="play" /></span>
54
+ <Icon v-else class="k-thumbnail-icon" :name="iconName" />
55
+ </span>
56
+ </template>
57
+ <span v-if="isMissing" class="k-visually-hidden">{{ missingCopy }}</span>
58
+ <span
59
+ v-if="$slots['top-start']"
60
+ class="k-thumbnail-overlay k-thumbnail-top-start"
61
+ :class="{ 'is-reveal': reveal.includes('top-start') }"
62
+ >
63
+ <slot name="top-start" />
64
+ </span>
65
+ <span
66
+ v-if="$slots['top-end']"
67
+ class="k-thumbnail-overlay k-thumbnail-top-end"
68
+ :class="{ 'is-reveal': reveal.includes('top-end') }"
69
+ >
70
+ <slot name="top-end" />
71
+ </span>
72
+ <span
73
+ v-if="caption || $slots.caption"
74
+ class="k-thumbnail-overlay k-thumbnail-caption"
75
+ :class="{ 'is-reveal': reveal.includes('caption') }"
76
+ >
77
+ <slot name="caption">
78
+ <span class="k-thumbnail-caption-text" :title="caption">{{ caption }}</span>
79
+ </slot>
80
+ </span>
81
+ </span>
82
+ </template>
83
+
84
+ <script setup>
85
+ import { computed, onMounted, ref, useTemplateRef, watch } from "vue";
86
+ import { useLocale } from "../../composables/useLocale";
87
+ import Icon from "../core/Icon.vue";
88
+ const props = defineProps({
89
+ src: { type: String, required: false },
90
+ alt: { type: String, required: false },
91
+ kind: { type: String, required: false, default: "image" },
92
+ icon: { type: null, required: false },
93
+ fit: { type: String, required: false, default: "cover" },
94
+ aspect: { type: [String, Number], required: false, default: 1 },
95
+ size: { type: String, required: false },
96
+ rounded: { type: String, required: false },
97
+ missing: { type: Boolean, required: false },
98
+ missingText: { type: String, required: false },
99
+ focal: { type: [Object, null], required: false },
100
+ objectPosition: { type: String, required: false },
101
+ caption: { type: String, required: false },
102
+ reveal: { type: Array, required: false, default: () => ["caption"] },
103
+ lazy: { type: Boolean, required: false, default: true }
104
+ });
105
+ defineSlots();
106
+ const KIND_ICONS = {
107
+ image: "photo",
108
+ video: "video-camera",
109
+ file: "document",
110
+ icon: "photo"
111
+ };
112
+ const { t } = useLocale();
113
+ const image = useTemplateRef("image");
114
+ const video = useTemplateRef("video");
115
+ const failed = ref(false);
116
+ const loaded = ref(false);
117
+ const isMissing = computed(() => props.missing || failed.value);
118
+ const playable = computed(() => Boolean(props.src) && !isMissing.value);
119
+ const showImage = computed(() => props.kind === "image" && playable.value);
120
+ const showVideo = computed(() => props.kind === "video" && playable.value);
121
+ const hasMedia = computed(() => showImage.value || showVideo.value);
122
+ const loading = computed(() => hasMedia.value && !loaded.value);
123
+ const iconName = computed(() => props.icon ?? KIND_ICONS[props.kind]);
124
+ const missingCopy = computed(() => props.missingText ?? t("thumbnail.missing"));
125
+ const radius = computed(() => {
126
+ if (props.rounded) return props.rounded;
127
+ return props.size === "xs" || props.size === "sm" ? "sm" : "md";
128
+ });
129
+ const aspectRatio = computed(() => String(props.aspect));
130
+ const videoSrc = computed(
131
+ () => props.src && !props.src.includes("#") ? `${props.src}#t=0.001` : props.src
132
+ );
133
+ const position = computed(() => {
134
+ if (props.objectPosition) return props.objectPosition;
135
+ if (!props.focal) return void 0;
136
+ const x = Math.min(1, Math.max(0, props.focal.x)) * 100;
137
+ const y = Math.min(1, Math.max(0, props.focal.y)) * 100;
138
+ return `${x}% ${y}%`;
139
+ });
140
+ const mediaStyle = computed(() => position.value ? { objectPosition: position.value } : void 0);
141
+ watch(
142
+ () => [props.src, props.kind],
143
+ () => {
144
+ failed.value = false;
145
+ loaded.value = false;
146
+ }
147
+ );
148
+ onMounted(() => {
149
+ const element = image.value;
150
+ if (element?.complete) {
151
+ if (element.naturalWidth === 0) failed.value = true;
152
+ else loaded.value = true;
153
+ }
154
+ if (video.value?.error) failed.value = true;
155
+ else if (video.value && video.value.readyState >= 2) loaded.value = true;
156
+ });
157
+ </script>