@xleddyl/443-components-vue 0.16.97 → 0.16.98
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 +43 -39
- package/README.md +67 -30
- package/dist/components/core/FormField.vue +46 -2
- package/dist/components/core/FormField.vue.d.ts +2 -0
- package/dist/components/core/Root.vue +2 -0
- package/dist/components/core/Root.vue.d.ts +2 -0
- package/dist/components/core/types.d.ts +1 -0
- package/dist/components/data/FilterPills.vue +2 -1
- package/dist/components/data/Table.vue +3 -1
- package/dist/components/data/Table.vue.d.ts +1 -0
- package/dist/components/data/TileGrid.vue +1 -0
- package/dist/components/data/types.d.ts +1 -0
- package/dist/components/feedback/Alert.vue +13 -3
- package/dist/components/feedback/Alert.vue.d.ts +4 -4
- package/dist/components/forms/FileDropOverlay.vue +28 -0
- package/dist/components/forms/FileDropOverlay.vue.d.ts +410 -0
- package/dist/components/forms/SegmentedControl.vue +20 -1
- package/dist/components/forms/index.d.ts +1 -0
- package/dist/components/forms/index.mjs +1 -0
- package/dist/components/forms/types.d.ts +4 -1
- package/dist/components/layout/Accordion.vue +7 -2
- package/dist/components/layout/Accordion.vue.d.ts +2 -0
- package/dist/components/layout/Card.vue +47 -6
- package/dist/components/layout/Card.vue.d.ts +4 -0
- package/dist/components/layout/Stack.vue +3 -2
- package/dist/components/layout/Stack.vue.d.ts +2 -0
- package/dist/components/overlays/CommandList.vue +22 -4
- package/dist/components/overlays/types.d.ts +7 -1
- package/dist/components/templates/ListPage.vue +3 -2
- package/dist/components/templates/SettingsSection.vue.d.ts +4 -0
- package/dist/composables/core.d.ts +1 -0
- package/dist/composables/core.mjs +1 -0
- package/dist/composables/forms.d.ts +1 -0
- package/dist/composables/forms.mjs +1 -0
- package/dist/composables/useFieldHighlight.d.ts +8 -0
- package/dist/composables/useFieldHighlight.mjs +19 -0
- package/dist/composables/useFileDialog.d.ts +17 -0
- package/dist/composables/useFileDialog.mjs +40 -0
- package/dist/internal/core/HighlightText.d.ts +12 -0
- package/dist/internal/core/HighlightText.mjs +30 -0
- package/dist/locale/de.mjs +3 -0
- package/dist/locale/en.mjs +3 -0
- package/dist/locale/it.mjs +3 -0
- package/dist/locale/types.d.ts +3 -0
- package/dist/nuxt/runtime/layouts/auth.vue.d.ts +2 -0
- package/dist/nuxt/runtime/layouts/dashboard.vue.d.ts +2 -0
- package/dist/styles/base.css +13 -0
- package/dist/styles/core/form-field.css +13 -0
- package/dist/styles/core/root.css +23 -0
- package/dist/styles/data/table.css +17 -0
- package/dist/styles/data/thumbnail.css +5 -2
- package/dist/styles/data/tile-grid.css +2 -1
- package/dist/styles/design-tokens.css +4 -0
- package/dist/styles/feedback/alert.css +13 -0
- package/dist/styles/forced-colors.css +12 -1
- package/dist/styles/forms/file-drop-overlay.css +48 -0
- package/dist/styles/forms/segmented.css +36 -0
- package/dist/styles/forms.css +1 -0
- package/dist/styles/layout/accordion.css +8 -0
- package/dist/styles/layout/card.css +19 -7
- package/dist/styles/layout/stack.css +5 -0
- package/dist/styles/overlays/command.css +17 -0
- package/dist/styles/shared.css +8 -0
- package/dist/styles/templates/list-page.css +1 -21
- package/package.json +3 -2
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
'is-interactive': isInteractive,
|
|
12
12
|
'is-disabled': disabled,
|
|
13
13
|
'is-selected': selected,
|
|
14
|
-
'is-static': !animated
|
|
14
|
+
'is-static': !animated,
|
|
15
|
+
'is-fill': fill
|
|
15
16
|
}
|
|
16
17
|
]"
|
|
17
18
|
>
|
|
@@ -63,14 +64,16 @@
|
|
|
63
64
|
:aria-label="label"
|
|
64
65
|
:aria-labelledby="label ? void 0 : overlayLabelledBy"
|
|
65
66
|
/>
|
|
67
|
+
<HintTooltip v-if="reasonActive && mounted" :id="hintId" :text="disabledReason" />
|
|
66
68
|
</Polymorphic>
|
|
67
69
|
</template>
|
|
68
70
|
|
|
69
71
|
<script setup>
|
|
70
72
|
import { useLinkResolver } from "../../internal/core/link";
|
|
71
73
|
import { Polymorphic } from "../../internal/core/Polymorphic";
|
|
72
|
-
import { computed, useAttrs, useId, useSlots } from "vue";
|
|
74
|
+
import { computed, onMounted, ref, useAttrs, useId, useSlots } from "vue";
|
|
73
75
|
import { joinIds } from "../../internal/forms/control";
|
|
76
|
+
import HintTooltip from "../../internal/overlays/HintTooltip.vue";
|
|
74
77
|
import Icon from "../core/Icon.vue";
|
|
75
78
|
defineOptions({ inheritAttrs: false });
|
|
76
79
|
const props = defineProps({
|
|
@@ -85,8 +88,10 @@ const props = defineProps({
|
|
|
85
88
|
href: { type: String, required: false },
|
|
86
89
|
target: { type: String, required: false },
|
|
87
90
|
disabled: { type: Boolean, required: false },
|
|
91
|
+
disabledReason: { type: String, required: false },
|
|
88
92
|
selected: { type: Boolean, required: false, default: void 0 },
|
|
89
93
|
animated: { type: Boolean, required: false, default: true },
|
|
94
|
+
fill: { type: Boolean, required: false },
|
|
90
95
|
label: { type: String, required: false }
|
|
91
96
|
});
|
|
92
97
|
const SELECTABLE_ROLES = /* @__PURE__ */ new Set(["option", "tab", "gridcell", "row", "treeitem"]);
|
|
@@ -98,9 +103,26 @@ const hasHeader = computed(
|
|
|
98
103
|
)
|
|
99
104
|
);
|
|
100
105
|
const { resolveLink } = useLinkResolver();
|
|
101
|
-
const
|
|
106
|
+
const hintId = `${useId()}-hint`;
|
|
107
|
+
const mounted = ref(false);
|
|
108
|
+
const isButton = computed(() => props.as === "button");
|
|
109
|
+
const linkTarget = computed(() => props.to !== void 0 || props.href !== void 0);
|
|
110
|
+
const reasonActive = computed(
|
|
111
|
+
() => Boolean(props.disabled && props.disabledReason && (isButton.value || linkTarget.value))
|
|
112
|
+
);
|
|
113
|
+
const reasonAttrs = computed(() => ({
|
|
114
|
+
role: "link",
|
|
115
|
+
tabindex: 0,
|
|
116
|
+
"aria-disabled": "true",
|
|
117
|
+
"aria-describedby": mounted.value ? hintId : void 0,
|
|
118
|
+
title: mounted.value ? void 0 : props.disabledReason
|
|
119
|
+
}));
|
|
120
|
+
const link = computed(() => {
|
|
121
|
+
if (reasonActive.value && !isButton.value) return { is: "a", attrs: reasonAttrs.value };
|
|
122
|
+
return props.disabled ? null : resolveLink(props);
|
|
123
|
+
});
|
|
102
124
|
const isLink = computed(() => link.value !== null);
|
|
103
|
-
const isInteractive = computed(() => isLink.value ||
|
|
125
|
+
const isInteractive = computed(() => isLink.value || isButton.value);
|
|
104
126
|
const plain = computed(() => props.as === "button" || attrs.role === "button");
|
|
105
127
|
const hasTitle = computed(() => Boolean(props.title || slots.title));
|
|
106
128
|
const headerId = useId();
|
|
@@ -110,14 +132,33 @@ const overlayLabelledBy = computed(
|
|
|
110
132
|
);
|
|
111
133
|
const rootAttrs = computed(() => ({
|
|
112
134
|
...selectionAttrs.value,
|
|
113
|
-
...
|
|
135
|
+
...isButton.value ? buttonAttrs.value : {},
|
|
136
|
+
...reasonActive.value ? { onClickCapture: ignoreClick } : {}
|
|
114
137
|
}));
|
|
138
|
+
const buttonAttrs = computed(() => {
|
|
139
|
+
if (!reasonActive.value) return { type: "button", disabled: props.disabled || void 0 };
|
|
140
|
+
return {
|
|
141
|
+
type: "button",
|
|
142
|
+
"aria-disabled": "true",
|
|
143
|
+
"aria-describedby": mounted.value ? hintId : void 0,
|
|
144
|
+
title: mounted.value ? void 0 : props.disabledReason
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
function ignoreClick(event) {
|
|
148
|
+
const target = event.target;
|
|
149
|
+
if (target?.closest(".k-card-actions, .k-card-footer")) return;
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
event.stopImmediatePropagation();
|
|
152
|
+
}
|
|
115
153
|
const selectionAttrs = computed(() => {
|
|
116
154
|
if (props.selected === void 0) return void 0;
|
|
117
155
|
const state = props.selected ? "true" : "false";
|
|
118
156
|
const role = typeof attrs.role === "string" ? attrs.role : void 0;
|
|
119
157
|
if (role && SELECTABLE_ROLES.has(role)) return { "aria-selected": state };
|
|
120
|
-
if (
|
|
158
|
+
if (isButton.value && !role) return { "aria-pressed": state };
|
|
121
159
|
return { "data-selected": state };
|
|
122
160
|
});
|
|
161
|
+
onMounted(() => {
|
|
162
|
+
mounted.value = true;
|
|
163
|
+
});
|
|
123
164
|
</script>
|
|
@@ -31,8 +31,10 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
31
31
|
href?: string | undefined;
|
|
32
32
|
target?: string | undefined;
|
|
33
33
|
disabled?: boolean;
|
|
34
|
+
disabledReason?: string;
|
|
34
35
|
selected?: boolean;
|
|
35
36
|
animated?: boolean;
|
|
37
|
+
fill?: boolean;
|
|
36
38
|
label?: string;
|
|
37
39
|
inlist?: any;
|
|
38
40
|
download?: any;
|
|
@@ -251,8 +253,10 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
251
253
|
href?: string | undefined;
|
|
252
254
|
target?: string | undefined;
|
|
253
255
|
disabled?: boolean;
|
|
256
|
+
disabledReason?: string;
|
|
254
257
|
selected?: boolean;
|
|
255
258
|
animated?: boolean;
|
|
259
|
+
fill?: boolean;
|
|
256
260
|
label?: string;
|
|
257
261
|
inlist?: any;
|
|
258
262
|
download?: any;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
`k-stack-gap-${gap}`,
|
|
9
9
|
align ? `k-stack-align-${align}` : void 0,
|
|
10
10
|
justify ? `k-stack-justify-${justify}` : void 0,
|
|
11
|
-
{ 'is-wrap': wrap, 'is-responsive': responsive }
|
|
11
|
+
{ 'is-wrap': wrap, 'is-responsive': responsive, 'is-grow': grow }
|
|
12
12
|
]"
|
|
13
13
|
>
|
|
14
14
|
<slot />
|
|
@@ -25,6 +25,7 @@ defineProps({
|
|
|
25
25
|
align: { type: String, required: false },
|
|
26
26
|
justify: { type: String, required: false },
|
|
27
27
|
wrap: { type: Boolean, required: false },
|
|
28
|
-
responsive: { type: Boolean, required: false }
|
|
28
|
+
responsive: { type: Boolean, required: false },
|
|
29
|
+
grow: { type: Boolean, required: false }
|
|
29
30
|
});
|
|
30
31
|
</script>
|
|
@@ -11,6 +11,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
11
11
|
justify?: LayoutJustify;
|
|
12
12
|
wrap?: boolean;
|
|
13
13
|
responsive?: boolean;
|
|
14
|
+
grow?: boolean;
|
|
14
15
|
inlist?: any;
|
|
15
16
|
download?: any;
|
|
16
17
|
key?: PropertyKey | undefined;
|
|
@@ -227,6 +228,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
227
228
|
justify?: LayoutJustify;
|
|
228
229
|
wrap?: boolean;
|
|
229
230
|
responsive?: boolean;
|
|
231
|
+
grow?: boolean;
|
|
230
232
|
inlist?: any;
|
|
231
233
|
download?: any;
|
|
232
234
|
key?: PropertyKey | undefined;
|
|
@@ -79,10 +79,24 @@
|
|
|
79
79
|
class="k-command-option-icon"
|
|
80
80
|
/>
|
|
81
81
|
<span class="k-command-option-text">
|
|
82
|
-
<span class="k-command-option-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
<span v-if="entry.item.meta" class="k-command-option-head">
|
|
83
|
+
<span class="k-command-option-label"
|
|
84
|
+
><HighlightText
|
|
85
|
+
:text="entry.item.label"
|
|
86
|
+
:ranges="entry.item.highlight?.label"
|
|
87
|
+
/></span>
|
|
88
|
+
<span class="k-command-option-meta">{{ entry.item.meta }}</span>
|
|
85
89
|
</span>
|
|
90
|
+
<span v-else class="k-command-option-label"
|
|
91
|
+
><HighlightText
|
|
92
|
+
:text="entry.item.label"
|
|
93
|
+
:ranges="entry.item.highlight?.label"
|
|
94
|
+
/></span>
|
|
95
|
+
<span v-if="entry.item.description" class="k-command-option-description"
|
|
96
|
+
><HighlightText
|
|
97
|
+
:text="entry.item.description"
|
|
98
|
+
:ranges="entry.item.highlight?.description"
|
|
99
|
+
/></span>
|
|
86
100
|
</span>
|
|
87
101
|
<Badge
|
|
88
102
|
v-if="entry.item.badge"
|
|
@@ -141,6 +155,7 @@ import { matchesSearch } from "../../internal/core/text";
|
|
|
141
155
|
import { readStorageJson, writeStorageJson } from "../../internal/core/storage";
|
|
142
156
|
import { useRouterLike } from "../../internal/layout/route";
|
|
143
157
|
import { DivElement } from "../../internal/core/DivElement";
|
|
158
|
+
import { HighlightText } from "../../internal/core/HighlightText";
|
|
144
159
|
import LiveRegion from "../../internal/core/LiveRegion.vue";
|
|
145
160
|
import HintTooltip from "../../internal/overlays/HintTooltip.vue";
|
|
146
161
|
import Icon from "../core/Icon.vue";
|
|
@@ -221,7 +236,10 @@ const resultGroups = computed(() => {
|
|
|
221
236
|
return props.groups.map((group) => ({
|
|
222
237
|
...group,
|
|
223
238
|
items: group.items.filter(
|
|
224
|
-
(item) => matchesSearch(
|
|
239
|
+
(item) => matchesSearch(
|
|
240
|
+
[item.label, item.description, item.meta, ...item.keywords ?? []],
|
|
241
|
+
term.value
|
|
242
|
+
)
|
|
225
243
|
)
|
|
226
244
|
})).filter((group) => group.items.length);
|
|
227
245
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ColorValue, DotColor, LinkTarget, Tone } from '../core/types';
|
|
1
|
+
import type { ColorValue, DotColor, LinkTarget, TextRange, 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, };
|
|
@@ -68,10 +68,16 @@ export interface CommandItemBadge {
|
|
|
68
68
|
tone?: Tone;
|
|
69
69
|
color?: ColorValue;
|
|
70
70
|
}
|
|
71
|
+
export interface CommandItemHighlight {
|
|
72
|
+
label?: TextRange[];
|
|
73
|
+
description?: TextRange[];
|
|
74
|
+
}
|
|
71
75
|
export interface CommandItem<T = unknown> {
|
|
72
76
|
id: string;
|
|
73
77
|
label: string;
|
|
74
78
|
description?: string;
|
|
79
|
+
meta?: string;
|
|
80
|
+
highlight?: CommandItemHighlight;
|
|
75
81
|
icon?: IconName;
|
|
76
82
|
badge?: string | CommandItemBadge;
|
|
77
83
|
shortcut?: string;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
<slot name="before" />
|
|
19
19
|
|
|
20
|
-
<Card v-if="error" class="k-list-state" padding="lg" role="alert">
|
|
20
|
+
<Card v-if="error" class="k-list-state" padding="lg" role="alert" :fill="fill">
|
|
21
21
|
<slot name="error" :retry="() => emit('retry')">
|
|
22
22
|
<EmptyState
|
|
23
23
|
variant="plain"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
</EmptyState>
|
|
57
57
|
</slot>
|
|
58
58
|
|
|
59
|
-
<Card v-else class="k-list-card" padding="none">
|
|
59
|
+
<Card v-else class="k-list-card" padding="none" :fill="fill">
|
|
60
60
|
<div v-if="hasToolbar" class="k-list-toolbar" role="search" :aria-label="toolbarText">
|
|
61
61
|
<div class="k-list-toolbar-start">
|
|
62
62
|
<Input
|
|
@@ -119,6 +119,7 @@
|
|
|
119
119
|
:density="density"
|
|
120
120
|
:bordered="false"
|
|
121
121
|
:sticky-header="stickyHeader"
|
|
122
|
+
:fill="fill"
|
|
122
123
|
@row-click="(row, index, event) => emit('rowClick', row, index, event)"
|
|
123
124
|
>
|
|
124
125
|
<template v-for="name in cellSlots" :key="name" #[name]="scope">
|
|
@@ -23,6 +23,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
23
23
|
level?: HeadingLevel;
|
|
24
24
|
key?: PropertyKey | undefined;
|
|
25
25
|
prefix?: string | undefined;
|
|
26
|
+
fill?: boolean;
|
|
26
27
|
selected?: boolean;
|
|
27
28
|
label?: string;
|
|
28
29
|
style?: import("vue").StyleValue;
|
|
@@ -33,6 +34,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
33
34
|
to?: import("../core/types.ts").LinkTarget;
|
|
34
35
|
href?: string | undefined;
|
|
35
36
|
disabled?: boolean;
|
|
37
|
+
disabledReason?: string;
|
|
36
38
|
onSelect?: ((payload: Event) => void) | undefined;
|
|
37
39
|
dir?: string | undefined;
|
|
38
40
|
contextmenu?: string | undefined;
|
|
@@ -251,6 +253,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
251
253
|
level?: HeadingLevel;
|
|
252
254
|
key?: PropertyKey | undefined;
|
|
253
255
|
prefix?: string | undefined;
|
|
256
|
+
fill?: boolean;
|
|
254
257
|
selected?: boolean;
|
|
255
258
|
label?: string;
|
|
256
259
|
style?: import("vue").StyleValue;
|
|
@@ -261,6 +264,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
261
264
|
to?: import("../core/types.ts").LinkTarget;
|
|
262
265
|
href?: string | undefined;
|
|
263
266
|
disabled?: boolean;
|
|
267
|
+
disabledReason?: string;
|
|
264
268
|
onSelect?: ((payload: Event) => void) | undefined;
|
|
265
269
|
dir?: string | undefined;
|
|
266
270
|
contextmenu?: string | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
export declare const FIELD_HIGHLIGHT_DURATION = 2400;
|
|
3
|
+
export interface FieldHighlight {
|
|
4
|
+
highlighted: Readonly<Ref<string | null>>;
|
|
5
|
+
highlight: (name: string) => void;
|
|
6
|
+
clear: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function useFieldHighlight(duration?: number): FieldHighlight;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getCurrentScope, nextTick, onScopeDispose, ref } from "vue";
|
|
2
|
+
export const FIELD_HIGHLIGHT_DURATION = 2400;
|
|
3
|
+
export function useFieldHighlight(duration = FIELD_HIGHLIGHT_DURATION) {
|
|
4
|
+
const highlighted = ref(null);
|
|
5
|
+
let timer;
|
|
6
|
+
function clear() {
|
|
7
|
+
clearTimeout(timer);
|
|
8
|
+
highlighted.value = null;
|
|
9
|
+
}
|
|
10
|
+
function highlight(name) {
|
|
11
|
+
clear();
|
|
12
|
+
void nextTick(() => {
|
|
13
|
+
highlighted.value = name;
|
|
14
|
+
timer = setTimeout(() => highlighted.value = null, duration);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (getCurrentScope()) onScopeDispose(() => clearTimeout(timer));
|
|
18
|
+
return { highlighted, highlight, clear };
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
export interface FileDialogOptions {
|
|
3
|
+
accept?: MaybeRefOrGetter<string | undefined>;
|
|
4
|
+
multiple?: MaybeRefOrGetter<boolean | undefined>;
|
|
5
|
+
directory?: MaybeRefOrGetter<boolean | undefined>;
|
|
6
|
+
onChange?: (files: File[]) => void;
|
|
7
|
+
}
|
|
8
|
+
export interface FileDialogOpenOptions {
|
|
9
|
+
accept?: string;
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
directory?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function useFileDialog(options?: FileDialogOptions): {
|
|
14
|
+
files: import("vue").ShallowRef<File[], File[]>;
|
|
15
|
+
open: (overrides?: FileDialogOpenOptions) => Promise<File[]>;
|
|
16
|
+
reset: () => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { shallowRef, toValue } from "vue";
|
|
2
|
+
import { isClient } from "../internal/core/env.mjs";
|
|
3
|
+
export function useFileDialog(options = {}) {
|
|
4
|
+
const files = shallowRef([]);
|
|
5
|
+
let pending = null;
|
|
6
|
+
function settle(selected) {
|
|
7
|
+
const resolve = pending;
|
|
8
|
+
pending = null;
|
|
9
|
+
resolve?.(selected);
|
|
10
|
+
}
|
|
11
|
+
function open(overrides = {}) {
|
|
12
|
+
if (!isClient()) return Promise.resolve([]);
|
|
13
|
+
settle([]);
|
|
14
|
+
const input = document.createElement("input");
|
|
15
|
+
input.type = "file";
|
|
16
|
+
const accept = overrides.accept ?? toValue(options.accept);
|
|
17
|
+
if (accept) input.accept = accept;
|
|
18
|
+
input.multiple = Boolean(overrides.multiple ?? toValue(options.multiple));
|
|
19
|
+
input.webkitdirectory = Boolean(overrides.directory ?? toValue(options.directory));
|
|
20
|
+
return new Promise((resolve) => {
|
|
21
|
+
pending = resolve;
|
|
22
|
+
input.addEventListener(
|
|
23
|
+
"change",
|
|
24
|
+
() => {
|
|
25
|
+
const selected = Array.from(input.files ?? []);
|
|
26
|
+
files.value = selected;
|
|
27
|
+
if (selected.length) options.onChange?.(selected);
|
|
28
|
+
settle(selected);
|
|
29
|
+
},
|
|
30
|
+
{ once: true }
|
|
31
|
+
);
|
|
32
|
+
input.addEventListener("cancel", () => settle([]), { once: true });
|
|
33
|
+
input.click();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function reset() {
|
|
37
|
+
files.value = [];
|
|
38
|
+
}
|
|
39
|
+
return { files, open, reset };
|
|
40
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DefineComponent } from 'vue';
|
|
2
|
+
import type { TextRange } from '../../components/core/types';
|
|
3
|
+
interface Segment {
|
|
4
|
+
text: string;
|
|
5
|
+
match: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function highlightSegments(text: string, ranges?: readonly TextRange[]): Segment[];
|
|
8
|
+
export declare const HighlightText: DefineComponent<{
|
|
9
|
+
text: string;
|
|
10
|
+
ranges?: readonly TextRange[];
|
|
11
|
+
}>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineComponent, h } from "vue";
|
|
2
|
+
export function highlightSegments(text, ranges = []) {
|
|
3
|
+
const sorted = ranges.map(([start, end]) => [Math.max(0, start), Math.min(text.length, end)]).filter(([start, end]) => end > start).sort((a, b) => a[0] - b[0]);
|
|
4
|
+
const segments = [];
|
|
5
|
+
let cursor = 0;
|
|
6
|
+
for (const [start, end] of sorted) {
|
|
7
|
+
if (end <= cursor) continue;
|
|
8
|
+
const from = Math.max(start, cursor);
|
|
9
|
+
if (from > cursor) segments.push({ text: text.slice(cursor, from), match: false });
|
|
10
|
+
segments.push({ text: text.slice(from, end), match: true });
|
|
11
|
+
cursor = end;
|
|
12
|
+
}
|
|
13
|
+
if (cursor < text.length) segments.push({ text: text.slice(cursor), match: false });
|
|
14
|
+
return segments;
|
|
15
|
+
}
|
|
16
|
+
export const HighlightText = defineComponent({
|
|
17
|
+
name: "KHighlightText",
|
|
18
|
+
props: {
|
|
19
|
+
text: { type: String, required: true },
|
|
20
|
+
ranges: { type: Array, default: void 0 }
|
|
21
|
+
},
|
|
22
|
+
setup(props) {
|
|
23
|
+
return () => {
|
|
24
|
+
if (!props.ranges?.length) return props.text;
|
|
25
|
+
return highlightSegments(props.text, props.ranges).map(
|
|
26
|
+
(segment) => segment.match ? h("mark", { class: "k-mark" }, segment.text) : segment.text
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
package/dist/locale/de.mjs
CHANGED
package/dist/locale/en.mjs
CHANGED
package/dist/locale/it.mjs
CHANGED
package/dist/locale/types.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
|
|
|
11
11
|
readonly fontMono?: string | undefined;
|
|
12
12
|
readonly fontDisplay?: string | undefined;
|
|
13
13
|
readonly radiusScale?: number | undefined;
|
|
14
|
+
readonly document?: boolean | undefined;
|
|
14
15
|
readonly as?: (string | import("vue").Component) | undefined;
|
|
15
16
|
readonly inlist?: any;
|
|
16
17
|
readonly download?: any;
|
|
@@ -229,6 +230,7 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
|
|
|
229
230
|
readonly fontMono?: string | undefined;
|
|
230
231
|
readonly fontDisplay?: string | undefined;
|
|
231
232
|
readonly radiusScale?: number | undefined;
|
|
233
|
+
readonly document?: boolean | undefined;
|
|
232
234
|
readonly as?: (string | import("vue").Component) | undefined;
|
|
233
235
|
readonly inlist?: any;
|
|
234
236
|
readonly download?: any;
|
|
@@ -11,6 +11,7 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
|
|
|
11
11
|
readonly fontMono?: string | undefined;
|
|
12
12
|
readonly fontDisplay?: string | undefined;
|
|
13
13
|
readonly radiusScale?: number | undefined;
|
|
14
|
+
readonly document?: boolean | undefined;
|
|
14
15
|
readonly as?: (string | import("vue").Component) | undefined;
|
|
15
16
|
readonly inlist?: any;
|
|
16
17
|
readonly download?: any;
|
|
@@ -229,6 +230,7 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
|
|
|
229
230
|
readonly fontMono?: string | undefined;
|
|
230
231
|
readonly fontDisplay?: string | undefined;
|
|
231
232
|
readonly radiusScale?: number | undefined;
|
|
233
|
+
readonly document?: boolean | undefined;
|
|
232
234
|
readonly as?: (string | import("vue").Component) | undefined;
|
|
233
235
|
readonly inlist?: any;
|
|
234
236
|
readonly download?: any;
|
package/dist/styles/base.css
CHANGED
|
@@ -172,6 +172,19 @@ html.k-root > body {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
@keyframes k-field-highlight {
|
|
176
|
+
0%,
|
|
177
|
+
60% {
|
|
178
|
+
background: var(--k-accent-soft);
|
|
179
|
+
box-shadow: 0 0 0 0.375rem var(--k-accent-soft);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
100% {
|
|
183
|
+
background: transparent;
|
|
184
|
+
box-shadow: 0 0 0 0.375rem transparent;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
175
188
|
@media (prefers-reduced-motion: reduce) {
|
|
176
189
|
:where(.k-root, .k-root *, .k-root *::before, .k-root *::after) {
|
|
177
190
|
animation-duration: 0.01ms !important;
|
|
@@ -62,6 +62,19 @@
|
|
|
62
62
|
animation: k-shake 320ms var(--k-ease);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
.k-form-field.is-highlighted {
|
|
66
|
+
border-radius: var(--k-radius-md);
|
|
67
|
+
animation: k-field-highlight 2400ms var(--k-ease) both;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (prefers-reduced-motion: reduce) {
|
|
71
|
+
.k-form-field.is-highlighted {
|
|
72
|
+
background: var(--k-accent-soft);
|
|
73
|
+
box-shadow: 0 0 0 0.375rem var(--k-accent-soft);
|
|
74
|
+
animation-name: none;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
65
78
|
.k-form-field-help {
|
|
66
79
|
--k-icon-size: 0.875rem;
|
|
67
80
|
display: inline-flex;
|
|
@@ -2,3 +2,26 @@
|
|
|
2
2
|
min-height: 100%;
|
|
3
3
|
background: var(--k-canvas);
|
|
4
4
|
}
|
|
5
|
+
|
|
6
|
+
.k-root.is-document {
|
|
7
|
+
min-height: 100dvh;
|
|
8
|
+
background: var(--k-canvas);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:root:has(.k-root.is-document) {
|
|
12
|
+
color-scheme: light dark;
|
|
13
|
+
overscroll-behavior-y: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:root:has(.k-root.is-document[data-theme='light']) {
|
|
17
|
+
color-scheme: light;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:root:has(.k-root.is-document[data-theme='dark']) {
|
|
21
|
+
color-scheme: dark;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:root:has(.k-root.is-document) > body {
|
|
25
|
+
margin: 0;
|
|
26
|
+
overscroll-behavior-y: none;
|
|
27
|
+
}
|
|
@@ -31,6 +31,23 @@
|
|
|
31
31
|
overscroll-behavior-x: contain;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
.k-table.is-fill {
|
|
35
|
+
flex: 1 1 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.k-table.is-fill > .k-table-scroll {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.k-table.is-fill .k-table-el {
|
|
44
|
+
flex: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.k-table.is-fill .k-table-el:has(> .k-table-body > .k-table-empty-row) {
|
|
48
|
+
flex: 1 0 auto;
|
|
49
|
+
}
|
|
50
|
+
|
|
34
51
|
.k-table-scroll:focus-visible {
|
|
35
52
|
outline-offset: -2px;
|
|
36
53
|
}
|
|
@@ -196,8 +196,11 @@
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
.k-thumbnail:is(:hover, :focus-within) .k-thumbnail-overlay.is-reveal,
|
|
199
|
-
.k-
|
|
200
|
-
|
|
199
|
+
:is(a[href], button, label, .k-tile-grid-item, .k-card.is-interactive, .k-thumbnail-anchor):is(
|
|
200
|
+
:hover,
|
|
201
|
+
:focus-visible,
|
|
202
|
+
:has(:focus-visible)
|
|
203
|
+
)
|
|
201
204
|
.k-thumbnail-overlay.is-reveal {
|
|
202
205
|
opacity: 1;
|
|
203
206
|
}
|