@xleddyl/443-components-vue 0.16.90 → 0.16.91
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 +2 -2
- package/README.md +3 -2
- package/dist/components/data/Tree.vue +9 -17
- package/dist/components/data/Tree.vue.d.ts +1 -0
- package/dist/components/overlays/CommandList.vue +29 -3
- package/dist/internal/overlays/HintTooltip.vue +10 -2
- package/dist/internal/overlays/HintTooltip.vue.d.ts +2 -0
- package/dist/styles/data/tree.css +29 -5
- package/dist/styles/overlays/floating.css +1 -0
- package/package.json +1 -1
package/CATALOG.md
CHANGED
|
@@ -207,7 +207,7 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
207
207
|
| `Popover` | Floating panel with any content (a form, filters) opened by its trigger, or next to any element or point with `anchor`. Use `DropdownMenu` for a list of actions. | Model: `v-model:open`. Props: `placement`, `offset`, `arrow`, `label`, `initialFocus`, `anchor` (an element, also inside a same origin iframe, or a virtual `{ getBoundingClientRect() }`; positions against it instead of the trigger, the trigger slot becomes optional). Slots: default (the trigger), `content`. Exposed: `show`, `hide`, `toggle`. | `overlays/popover.vue` |
|
|
208
208
|
| `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` |
|
|
209
209
|
| `Tooltip` | Short text on hover or focus. Optional shortcut. `Button` already shows one for icon-only buttons, `tooltip` and `disabledReason`. | Props: `text`, `placement`, `openDelay`, `closeDelay`, `arrow`, `shortcut`, `disabled`. Slots: default (trigger), `content`. | `overlays/tooltip.vue` |
|
|
210
|
-
| `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)`, `pinned` (items or `(query) => items` shown first, never filtered or saved as recent), `shortcut`, `trigger`, `recentKey`, `emptyText`, `notice`. Slots: `item`, `empty`, `group-label`, `after-results`. Events: `select`, `open`, `close`.
|
|
210
|
+
| `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`, `disabled`, `disabledReason` (with `disabled`: reachable with the arrow keys but not selectable, a tooltip on hover and keyboard focus, linked with `aria-describedby`), `onSelect`), `search(query, signal)`, `pinned` (items or `(query) => items` shown first, never filtered or saved as recent), `shortcut`, `trigger`, `recentKey`, `emptyText`, `notice`. Slots: `item`, `empty`, `group-label`, `after-results`. Events: `select`, `open`, `close`. | `overlays/command-palette.vue` |
|
|
211
211
|
| `CommandList` | The search field and grouped list of `CommandPalette` without the dialog: place it inline in a panel or in a `Popover` (with `anchor` for a picker opened next to any element). Arrow keys, Enter and the same matching. | Model: `v-model:query`. Props: the `CommandPalette` list props (`groups`, `search`, `pinned`, `filter`, `loading`, `placeholder`, `label`, `recentKey`, `emptyText`, `notice` and the copy props), `autofocus` (default `true`), `footer` (the key hints, default `false`). Slots: `item`, `empty`, `group-label`, `after-results`. Events: `select`, `close` (Escape). Exposed: `focus`, `refresh`. | `overlays/command-palette.vue` |
|
|
212
212
|
| `CommandButton` | A `Button` made from a `CommandItem`: label, icon, `to`, `href`, `disabled`, `disabledReason` (tooltip on the disabled button) and `onSelect` come from the command. | Props: `command`, `label`, `icon`, `iconOnly` (a square button with the icon only, the label as `aria-label` and tooltip), and every `Button` prop (size, variant, tone). | `overlays/command-palette.vue` |
|
|
213
213
|
|
|
@@ -229,7 +229,7 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
229
229
|
| `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` |
|
|
230
230
|
| `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` |
|
|
231
231
|
| `Timeline` | Vertical list of events or activity. | Props: `items` (`title`, `description`, `time`, `datetime`, `icon`, `tone`), `compact`. Slot: `item`. | `data/timeline.vue` |
|
|
232
|
-
| `Tree` | Expandable hierarchy with selection, drag to reorder and nesting. | Models: `v-model:expanded`, `v-model:selected`. Props: `nodes` (`id`, `label`, `description`, `meta`, `icon`, `children`, `disabled`, `invalid`), `selectable`, `highlighted` (id or ids tinted like hover), `invalidText`, `reorderable`, `nestable`, `moveButtons` (default `true`; `false` hides the row arrows, drag and Alt+arrow keys still work), `canDrop`, `size`, `checkmark`, `emptyText`, `emptyDescription`, `emptyIcon`, `emptyVariant` (card, the default, or plain). Slots: `label`, `meta`, `actions` (row end, on hover, focus and the selected row; `node`, `level`, `selected`, `expanded`, `highlighted`, `hovered`), `empty`, `empty-actions` (buttons in the default empty state). Events: `select`, `move`, `hover` (node or `null`).
|
|
232
|
+
| `Tree` | Expandable hierarchy with selection, drag to reorder and nesting. | Models: `v-model:expanded`, `v-model:selected`. Props: `nodes` (`id`, `label`, `description`, `meta`, `icon`, `children`, `disabled`, `invalid`), `selectable`, `highlighted` (id or ids tinted like hover), `invalidText`, `reorderable`, `nestable`, `moveButtons` (default `true`; `false` hides the row arrows, drag and Alt+arrow keys still work), `canDrop`, `size`, `checkmark`, `emptyText`, `emptyDescription`, `emptyIcon`, `emptyVariant` (card, the default, or plain). Slots: `label` (`node`, `level`, `invalid`; an invalid row tints a custom label), `meta`, `actions` (row end, on hover, focus and the selected row, and while a popup opened from them is open; always visible without hover; `node`, `level`, `selected`, `expanded`, `highlighted`, `hovered`), `empty`, `empty-actions` (buttons in the default empty state). Events: `select`, `move`, `hover` (node or `null`). | `data/tree.vue` |
|
|
233
233
|
|
|
234
234
|
## Layout
|
|
235
235
|
|
package/README.md
CHANGED
|
@@ -287,7 +287,7 @@ The Nuxt module still writes the theme (`k-theme`), the preset (`k-preset`) and
|
|
|
287
287
|
- Everything sits in `@layer k.tokens, k.base, k.components, k.utilities`. Any unlayered host CSS wins, so overrides need no `!important`. The flip side: unlayered host element selectors (`button { ... }`) also reach library elements. Put global element styles in a layer or scope them.
|
|
288
288
|
- Tailwind 4 puts its preflight in the `base` layer. The Nuxt module declares `@layer theme, base, k, components, utilities` before any stylesheet (option `cssLayers`), so preflight never resets library components while Tailwind utilities still win on them. Without Nuxt, put the same statement at the top of your first stylesheet. A host reset of your own belongs in `base` (or any layer declared before `k`).
|
|
289
289
|
- The one exception is the dashboard frame: while an `AppShell` (`.k-shell`) is on the page, or with `k.global`, `html` and `body` get `overscroll-behavior: none` and `overflow-x: clip`, so the page never rubber bands or scrolls sideways. Only the content panel and the sidebar list scroll, with `overscroll-behavior: contain`.
|
|
290
|
-
- Overlays stay inside the root in the DOM (native top layer through `<dialog>` and `popover`), so they inherit tokens.
|
|
290
|
+
- Overlays stay inside the root in the DOM (native top layer through `<dialog>` and `popover`), so they inherit tokens. They also inherit from their trigger's parents: floating panels reset `pointer-events`, so a menu opened from a container with `pointer-events: none` (a hover reveal) stays clickable, but an `inert` or `visibility: hidden` ancestor still disables or hides it while it is open.
|
|
291
291
|
|
|
292
292
|
## Icons
|
|
293
293
|
|
|
@@ -482,6 +482,7 @@ Composables: `useTheme`, `usePreset`, `useForm`, `useField`, `useFieldControl`,
|
|
|
482
482
|
- `tooltip="..."` adds a tooltip to any button, also with a label; when it differs from the accessible name it is also the button description.
|
|
483
483
|
- `disabledReason` explains a disabled button. With `disabled` and a reason the button uses `aria-disabled` instead of `disabled`: it stays in the Tab order and receives hover, clicks (and implicit form submission) are ignored, the reason shows as a tooltip and is linked with `aria-describedby`, and before mount the reason is the native `title`. Without a reason a disabled button behaves as before.
|
|
484
484
|
- Menu items of `DropdownMenu` and `ContextMenu` (and every `MenuItems` list: the account menu, `FilterPills` option menus) take `disabledReason` too: with `disabled` the item stays reachable with the arrow keys but cannot be selected, and the reason shows as a tooltip on hover and keyboard focus and is linked with `aria-describedby`. Use it instead of putting the reason in `description`.
|
|
485
|
+
- Items of `CommandPalette` and `CommandList` take `disabledReason` the same way: a disabled item with a reason stays reachable with the arrow keys (one without a reason is skipped), Enter ignores it, and the reason shows as a tooltip on hover and when the arrow keys make it active, linked with `aria-describedby`.
|
|
485
486
|
- The same works for `CommandButton` (`CommandItem.disabledReason`, and `iconOnly` shows the label as a tooltip), `Tabs` (`TabItem.title`, also on a disabled tab), `FormDrawer` and `FormModal` (`deleteHint`) and the grid `ButtonCell` (`tooltip`, `disabled`, `disabledReason` params).
|
|
486
487
|
|
|
487
488
|
```vue
|
|
@@ -502,7 +503,7 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
|
|
|
502
503
|
|
|
503
504
|
### Lists, trees and uploads
|
|
504
505
|
|
|
505
|
-
- `Tree` takes `size="sm"` for dense rows, `checkmark`, `descriptionVariant` (`mono`, the default for paths and slugs, or `text`; a node can override it with its own `descriptionVariant`), `emptyText`, `emptyDescription`, `emptyIcon` and `emptyVariant` (`card`, the default, or `plain`) for the `EmptyState` shown without nodes (`#empty` replaces it, `#empty-actions` adds buttons inside it, like `RecordList`) and works inside a `FormField` (labelled and described by the field). With `reorderable` rows get a drag handle and Alt with the up and down arrows moves them; `nestable` also lets rows change level (drop in the middle of a row, Alt with left and right). Each row also shows move buttons; `moveButtons: false` hides them and keeps drag and the keyboard. The `move` event carries `{ node, target, position, from: { parent, index }, to: { parent, index } }`, `to.index` being the final index, and `applyTreeMove(nodes, move)` returns the updated tree. `canDrop(move)` vetoes a move. Moves are announced to screen readers. The `#actions` slot (`node`, `level`, `selected`, `expanded`, `highlighted`, `hovered`) renders row actions at the end of the row, over the label, on the hovered, focused and selected rows only; Tab from the focused row reaches them, and focus returns to a row when the focused one is removed. `highlighted` (an id or an array of ids) tints rows like hover, for a link with something outside the tree (a block hovered in a preview). The `hover` event carries the node under the pointer, then `null` when the pointer leaves the tree. A node with `invalid: true` shows a danger dot and a tinted label, and its row is described by a hidden "Contains errors" (`invalidText` overrides it).
|
|
506
|
+
- `Tree` takes `size="sm"` for dense rows, `checkmark`, `descriptionVariant` (`mono`, the default for paths and slugs, or `text`; a node can override it with its own `descriptionVariant`), `emptyText`, `emptyDescription`, `emptyIcon` and `emptyVariant` (`card`, the default, or `plain`) for the `EmptyState` shown without nodes (`#empty` replaces it, `#empty-actions` adds buttons inside it, like `RecordList`) and works inside a `FormField` (labelled and described by the field). With `reorderable` rows get a drag handle and Alt with the up and down arrows moves them; `nestable` also lets rows change level (drop in the middle of a row, Alt with left and right). Each row also shows move buttons; `moveButtons: false` hides them and keeps drag and the keyboard. The `move` event carries `{ node, target, position, from: { parent, index }, to: { parent, index } }`, `to.index` being the final index, and `applyTreeMove(nodes, move)` returns the updated tree. `canDrop(move)` vetoes a move. Moves are announced to screen readers. The `#actions` slot (`node`, `level`, `selected`, `expanded`, `highlighted`, `hovered`) renders row actions at the end of the row, over the label, on the hovered, focused and selected rows only; Tab from the focused row reaches them, and focus returns to a row when the focused one is removed. Actions stay visible and clickable while a menu, popover or select opened from them is open (any trigger inside with `aria-expanded="true"`), so the pointer can cross other rows to reach the menu items. On devices without hover (`hover: none`, touch) the slot actions are always visible and sit in the row after the label instead of over it, and the move buttons show on the focused (tapped) and selected rows. `highlighted` (an id or an array of ids) tints rows like hover, for a link with something outside the tree (a block hovered in a preview). The `hover` event carries the node under the pointer, then `null` when the pointer leaves the tree. A node with `invalid: true` shows a danger dot before the label (never covered by the actions) and a tinted label, and its row is described by a hidden "Contains errors" (`invalidText` overrides it). The `#label` slot receives `invalid` (with `node` and `level`), and a custom label inherits the danger text color unless it sets its own.
|
|
506
507
|
- `Select` takes string, number or boolean option values (`{ value: true, label: 'Yes' }`); the model gets the option value back with its type and is typed `T | null | undefined`, so `v-model` works on a narrow ref (`Ref<'a' | 'b' | null>`). An option whose value is `''` is a real option: it is selected and shown with its own label, distinct from the placeholder, which still maps to `null`.
|
|
507
508
|
- `Input` and `Textarea` take `counter`: with a `maxlength` attribute they show `length / maxlength` inside the field, describe the control with "12 of 40 characters" (`form.characterCount`) and announce "Character limit reached" when it is hit.
|
|
508
509
|
- Numbers are left aligned in every field. `Input` `numeric` sets the decimal keyboard, the number model and tabular digits; `NumberInput` takes `align="end"` to right align its value when a layout needs it (default `start`).
|
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
:class="rootClass"
|
|
16
16
|
data-k-shake
|
|
17
17
|
@pointerleave="onTreeLeave"
|
|
18
|
-
@focusin="hasFocus = true"
|
|
19
|
-
@focusout="onFocusOut"
|
|
20
18
|
>
|
|
21
19
|
<li
|
|
22
20
|
v-for="(entry, index) in visible"
|
|
@@ -77,8 +75,14 @@
|
|
|
77
75
|
<span v-if="entry.node.icon" class="k-tree-icon" aria-hidden="true">
|
|
78
76
|
<Icon :name="entry.node.icon" />
|
|
79
77
|
</span>
|
|
78
|
+
<span v-if="entry.node.invalid" class="k-tree-invalid" aria-hidden="true" />
|
|
80
79
|
<span :id="textId(entry.node.id)" class="k-tree-text">
|
|
81
|
-
<slot
|
|
80
|
+
<slot
|
|
81
|
+
name="label"
|
|
82
|
+
:node="entry.node"
|
|
83
|
+
:level="entry.level"
|
|
84
|
+
:invalid="Boolean(entry.node.invalid)"
|
|
85
|
+
>
|
|
82
86
|
<span :id="labelId(entry.node.id)" class="k-tree-label">{{ entry.node.label }}</span>
|
|
83
87
|
<span
|
|
84
88
|
v-if="entry.node.description"
|
|
@@ -89,7 +93,6 @@
|
|
|
89
93
|
>
|
|
90
94
|
</slot>
|
|
91
95
|
</span>
|
|
92
|
-
<span v-if="entry.node.invalid" class="k-tree-invalid" aria-hidden="true" />
|
|
93
96
|
<span
|
|
94
97
|
v-if="entry.node.meta || $slots.meta"
|
|
95
98
|
:id="metaId(entry.node.id)"
|
|
@@ -104,11 +107,10 @@
|
|
|
104
107
|
v-if="hasMoveButtons(entry) || $slots.actions"
|
|
105
108
|
class="k-tree-actions"
|
|
106
109
|
:class="{ 'has-slot': $slots.actions }"
|
|
107
|
-
:inert="actionsInert(entry) || void 0"
|
|
108
110
|
@click.stop
|
|
109
111
|
@focusin="focusId = entry.node.id"
|
|
110
112
|
>
|
|
111
|
-
<
|
|
113
|
+
<span v-if="hasMoveButtons(entry)" class="k-tree-moves">
|
|
112
114
|
<Button
|
|
113
115
|
v-for="action in rowActions(entry)"
|
|
114
116
|
:key="action.direction"
|
|
@@ -122,7 +124,7 @@
|
|
|
122
124
|
:disabled="!action.move"
|
|
123
125
|
@click="action.move && commit(action.move)"
|
|
124
126
|
/>
|
|
125
|
-
</
|
|
127
|
+
</span>
|
|
126
128
|
<slot
|
|
127
129
|
name="actions"
|
|
128
130
|
:node="entry.node"
|
|
@@ -223,7 +225,6 @@ const dragId = ref(null);
|
|
|
223
225
|
const dropState = ref(null);
|
|
224
226
|
const live = useLiveMessage();
|
|
225
227
|
const hoverId = ref(null);
|
|
226
|
-
const hasFocus = ref(false);
|
|
227
228
|
const ariaLabel = computed(() => {
|
|
228
229
|
if (props.label) return props.label;
|
|
229
230
|
return control.labelledBy.value ? void 0 : t("tree.label");
|
|
@@ -320,10 +321,6 @@ const hasInvalid = computed(() => visible.value.some((entry) => entry.node.inval
|
|
|
320
321
|
function hasMoveButtons(entry) {
|
|
321
322
|
return canReorder.value && props.moveButtons && !entry.node.disabled;
|
|
322
323
|
}
|
|
323
|
-
function actionsInert(entry) {
|
|
324
|
-
const id = entry.node.id;
|
|
325
|
-
return hoverId.value !== id && !(hasFocus.value && rovingId.value === id);
|
|
326
|
-
}
|
|
327
324
|
function setHover(node) {
|
|
328
325
|
const id = node?.id ?? null;
|
|
329
326
|
if (hoverId.value === id) return;
|
|
@@ -336,11 +333,6 @@ function onRowEnter(entry) {
|
|
|
336
333
|
function onTreeLeave() {
|
|
337
334
|
setHover(null);
|
|
338
335
|
}
|
|
339
|
-
function onFocusOut(event) {
|
|
340
|
-
const next = event.relatedTarget;
|
|
341
|
-
if (next instanceof Node && event.currentTarget.contains(next)) return;
|
|
342
|
-
hasFocus.value = false;
|
|
343
|
-
}
|
|
344
336
|
watch(visible, (list) => {
|
|
345
337
|
if (hoverId.value !== null && !list.some((entry) => entry.node.id === hoverId.value))
|
|
346
338
|
setHover(null);
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
:class="{ 'is-active': entry.index === active }"
|
|
68
68
|
:aria-selected="entry.index === active ? 'true' : 'false'"
|
|
69
69
|
:aria-disabled="entry.item.disabled ? 'true' : void 0"
|
|
70
|
-
|
|
70
|
+
:aria-describedby="reasonOf(entry.item) ? reasonId(entry.index) : void 0"
|
|
71
|
+
@pointermove="onOptionPointerMove(entry.index)"
|
|
71
72
|
@click="select(entry)"
|
|
72
73
|
>
|
|
73
74
|
<slot name="item" :item="entry.item" :active="entry.index === active">
|
|
@@ -103,6 +104,13 @@
|
|
|
103
104
|
</Kbd>
|
|
104
105
|
</span>
|
|
105
106
|
</slot>
|
|
107
|
+
<HintTooltip
|
|
108
|
+
v-if="reasonOf(entry.item)"
|
|
109
|
+
:id="reasonId(entry.index)"
|
|
110
|
+
:text="reasonOf(entry.item)"
|
|
111
|
+
:active="keyboardActive && entry.index === active"
|
|
112
|
+
placement="right"
|
|
113
|
+
/>
|
|
106
114
|
</div>
|
|
107
115
|
</div>
|
|
108
116
|
</div>
|
|
@@ -134,6 +142,7 @@ import { readStorageJson, writeStorageJson } from "../../internal/core/storage";
|
|
|
134
142
|
import { useRouterLike } from "../../internal/layout/route";
|
|
135
143
|
import { DivElement } from "../../internal/core/DivElement";
|
|
136
144
|
import LiveRegion from "../../internal/core/LiveRegion.vue";
|
|
145
|
+
import HintTooltip from "../../internal/overlays/HintTooltip.vue";
|
|
137
146
|
import Icon from "../core/Icon.vue";
|
|
138
147
|
import Badge from "../data/Badge.vue";
|
|
139
148
|
import Kbd from "../core/Kbd.vue";
|
|
@@ -193,6 +202,7 @@ const bodyRef = useTemplateRef("bodyRef");
|
|
|
193
202
|
const inputRef = useTemplateRef("inputRef");
|
|
194
203
|
const router = useRouterLike();
|
|
195
204
|
const active = ref(0);
|
|
205
|
+
const keyboardActive = ref(false);
|
|
196
206
|
const remote = shallowRef(null);
|
|
197
207
|
const recent = shallowRef([]);
|
|
198
208
|
const term = computed(() => query.value.trim());
|
|
@@ -292,6 +302,12 @@ function hasLabel(group) {
|
|
|
292
302
|
function optionId(index) {
|
|
293
303
|
return `${listId}-option-${index}`;
|
|
294
304
|
}
|
|
305
|
+
function reasonId(index) {
|
|
306
|
+
return `${optionId(index)}-reason`;
|
|
307
|
+
}
|
|
308
|
+
function reasonOf(item) {
|
|
309
|
+
return item.disabled && item.disabledReason ? item.disabledReason : void 0;
|
|
310
|
+
}
|
|
295
311
|
const search = useAsyncSearch({
|
|
296
312
|
search: () => props.search,
|
|
297
313
|
onResults: (groups) => remote.value = groups,
|
|
@@ -362,17 +378,27 @@ function select(entry) {
|
|
|
362
378
|
function isDisabled(index) {
|
|
363
379
|
return Boolean(flat.value[index]?.item.disabled);
|
|
364
380
|
}
|
|
381
|
+
function isSkipped(index) {
|
|
382
|
+
const item = flat.value[index]?.item;
|
|
383
|
+
return Boolean(item?.disabled && !reasonOf(item));
|
|
384
|
+
}
|
|
385
|
+
function onOptionPointerMove(index) {
|
|
386
|
+
keyboardActive.value = false;
|
|
387
|
+
active.value = index;
|
|
388
|
+
}
|
|
365
389
|
function onKeydown(event) {
|
|
366
390
|
const count = flat.value.length;
|
|
367
391
|
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
368
392
|
event.preventDefault();
|
|
369
393
|
if (!count) return;
|
|
370
394
|
const step = event.key === "ArrowDown" ? 1 : -1;
|
|
371
|
-
const next = nextEnabledIndex(count, active.value + step, step,
|
|
395
|
+
const next = nextEnabledIndex(count, active.value + step, step, isSkipped);
|
|
396
|
+
keyboardActive.value = true;
|
|
372
397
|
if (next !== -1) active.value = next;
|
|
373
398
|
} else if ((event.key === "Home" || event.key === "End") && event.ctrlKey && count) {
|
|
374
399
|
event.preventDefault();
|
|
375
|
-
const next = event.key === "Home" ? nextEnabledIndex(count, 0, 1,
|
|
400
|
+
const next = event.key === "Home" ? nextEnabledIndex(count, 0, 1, isSkipped) : nextEnabledIndex(count, count - 1, -1, isSkipped);
|
|
401
|
+
keyboardActive.value = true;
|
|
376
402
|
if (next !== -1) active.value = next;
|
|
377
403
|
} else if (event.key === "Enter" && !event.isComposing) {
|
|
378
404
|
event.preventDefault();
|
|
@@ -20,7 +20,8 @@ const props = defineProps({
|
|
|
20
20
|
text: { type: String, required: true },
|
|
21
21
|
placement: { type: null, required: false, default: "top" },
|
|
22
22
|
openDelay: { type: Number, required: false, default: 500 },
|
|
23
|
-
closeDelay: { type: Number, required: false, default: 80 }
|
|
23
|
+
closeDelay: { type: Number, required: false, default: 80 },
|
|
24
|
+
active: { type: Boolean, required: false }
|
|
24
25
|
});
|
|
25
26
|
const floatingRef = useTemplateRef("floatingRef");
|
|
26
27
|
const trigger = shallowRef(null);
|
|
@@ -53,9 +54,16 @@ function matches(element, selector) {
|
|
|
53
54
|
onMounted(() => {
|
|
54
55
|
const element = floatingRef.value?.parentElement ?? null;
|
|
55
56
|
trigger.value = element;
|
|
56
|
-
if (element && (matches(element, ":hover") || matches(element, ":focus-visible")))
|
|
57
|
+
if (element && (props.active || matches(element, ":hover") || matches(element, ":focus-visible")))
|
|
57
58
|
hover.scheduleOpen();
|
|
58
59
|
});
|
|
60
|
+
watch(
|
|
61
|
+
() => props.active,
|
|
62
|
+
(active) => {
|
|
63
|
+
if (active) hover.scheduleOpen();
|
|
64
|
+
else hover.scheduleClose(true);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
59
67
|
watch(
|
|
60
68
|
() => props.text,
|
|
61
69
|
(text) => {
|
|
@@ -5,6 +5,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
5
5
|
placement?: OverlayPlacement;
|
|
6
6
|
openDelay?: number;
|
|
7
7
|
closeDelay?: number;
|
|
8
|
+
active?: boolean;
|
|
8
9
|
innerHTML?: string | undefined | undefined;
|
|
9
10
|
class?: import("vue").ClassValue;
|
|
10
11
|
style?: import("vue").StyleValue;
|
|
@@ -202,6 +203,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
202
203
|
placement?: OverlayPlacement;
|
|
203
204
|
openDelay?: number;
|
|
204
205
|
closeDelay?: number;
|
|
206
|
+
active?: boolean;
|
|
205
207
|
innerHTML?: string | undefined | undefined;
|
|
206
208
|
class?: import("vue").ClassValue;
|
|
207
209
|
style?: import("vue").StyleValue;
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
background: var(--k-danger);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
.k-tree .k-tree-row.is-invalid > .k-tree-text,
|
|
125
126
|
.k-tree .k-tree-row.is-invalid .k-tree-label {
|
|
126
127
|
color: var(--k-danger-text);
|
|
127
128
|
}
|
|
@@ -301,22 +302,45 @@
|
|
|
301
302
|
border-radius: var(--k-radius-sm);
|
|
302
303
|
background: var(--k-elevated);
|
|
303
304
|
opacity: 0;
|
|
304
|
-
|
|
305
|
+
visibility: hidden;
|
|
305
306
|
translate: 0 -50%;
|
|
306
|
-
transition:
|
|
307
|
+
transition:
|
|
308
|
+
opacity var(--k-duration) var(--k-ease),
|
|
309
|
+
visibility var(--k-duration) var(--k-ease);
|
|
307
310
|
}
|
|
308
311
|
|
|
309
312
|
.k-tree-actions:empty {
|
|
310
313
|
display: none;
|
|
311
314
|
}
|
|
312
315
|
|
|
316
|
+
.k-tree-moves {
|
|
317
|
+
display: contents;
|
|
318
|
+
}
|
|
319
|
+
|
|
313
320
|
.k-tree-row:is(:hover, :focus-within) > .k-tree-actions,
|
|
314
|
-
.k-tree-row[aria-selected='true'] > .k-tree-actions.has-slot
|
|
321
|
+
.k-tree-row[aria-selected='true'] > .k-tree-actions.has-slot,
|
|
322
|
+
.k-tree-actions:has([aria-expanded='true']) {
|
|
315
323
|
opacity: 1;
|
|
316
|
-
|
|
324
|
+
visibility: visible;
|
|
317
325
|
}
|
|
318
326
|
|
|
319
327
|
.k-tree.is-dragging .k-tree-row > .k-tree-actions {
|
|
320
328
|
opacity: 0;
|
|
321
|
-
|
|
329
|
+
visibility: hidden;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
@media (hover: none) {
|
|
333
|
+
.k-tree-actions {
|
|
334
|
+
position: static;
|
|
335
|
+
flex: none;
|
|
336
|
+
background: none;
|
|
337
|
+
opacity: 1;
|
|
338
|
+
visibility: visible;
|
|
339
|
+
translate: none;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.k-tree-row:not(:focus-within, [aria-selected='true']) > .k-tree-actions:not(.has-slot),
|
|
343
|
+
.k-tree-row:not(:focus-within, [aria-selected='true']) > .k-tree-actions > .k-tree-moves {
|
|
344
|
+
display: none;
|
|
345
|
+
}
|
|
322
346
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
border-radius: var(--k-popover-radius, var(--k-radius-lg));
|
|
22
22
|
box-shadow: var(--k-popover-shadow, var(--k-shadow-overlay));
|
|
23
23
|
opacity: 0;
|
|
24
|
+
pointer-events: auto;
|
|
24
25
|
transform: translate(var(--k-floating-shift-x), var(--k-floating-shift-y)) scale(0.97);
|
|
25
26
|
transform-origin: var(--k-floating-origin, top center);
|
|
26
27
|
transition:
|
package/package.json
CHANGED