@nuxt/ui 4.11.1 → 4.11.3
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/README.md +3 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Accordion.d.vue.ts +1 -1
- package/dist/runtime/components/Accordion.vue.d.ts +1 -1
- package/dist/runtime/components/App.vue +2 -1
- package/dist/runtime/components/AuthForm.d.vue.ts +4 -0
- package/dist/runtime/components/AuthForm.vue.d.ts +4 -0
- package/dist/runtime/components/Breadcrumb.d.vue.ts +1 -1
- package/dist/runtime/components/Breadcrumb.vue.d.ts +1 -1
- package/dist/runtime/components/Carousel.d.vue.ts +1 -1
- package/dist/runtime/components/Carousel.vue.d.ts +1 -1
- package/dist/runtime/components/ChatPrompt.vue +1 -1
- package/dist/runtime/components/CheckboxGroup.d.vue.ts +1 -1
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +1 -1
- package/dist/runtime/components/CommandPalette.d.vue.ts +1 -1
- package/dist/runtime/components/CommandPalette.vue.d.ts +1 -1
- package/dist/runtime/components/ContextMenu.d.vue.ts +1 -1
- package/dist/runtime/components/ContextMenu.vue.d.ts +1 -1
- package/dist/runtime/components/DashboardNavbar.vue +1 -1
- package/dist/runtime/components/DashboardSearch.vue +3 -3
- package/dist/runtime/components/DashboardSidebar.vue +3 -3
- package/dist/runtime/components/DropdownMenu.d.vue.ts +1 -1
- package/dist/runtime/components/DropdownMenu.vue.d.ts +1 -1
- package/dist/runtime/components/EditorToolbar.vue +6 -5
- package/dist/runtime/components/FooterColumns.d.vue.ts +1 -1
- package/dist/runtime/components/FooterColumns.vue.d.ts +1 -1
- package/dist/runtime/components/Form.d.vue.ts +2 -0
- package/dist/runtime/components/Form.vue +57 -30
- package/dist/runtime/components/Form.vue.d.ts +2 -0
- package/dist/runtime/components/Header.vue +3 -3
- package/dist/runtime/components/Input.vue +5 -5
- package/dist/runtime/components/InputDate.vue +12 -6
- package/dist/runtime/components/InputMenu.d.vue.ts +1 -1
- package/dist/runtime/components/InputMenu.vue +18 -7
- package/dist/runtime/components/InputMenu.vue.d.ts +1 -1
- package/dist/runtime/components/InputTime.vue +12 -6
- package/dist/runtime/components/LinkBase.vue +3 -1
- package/dist/runtime/components/Listbox.d.vue.ts +1 -1
- package/dist/runtime/components/Listbox.vue.d.ts +1 -1
- package/dist/runtime/components/NavigationMenu.d.vue.ts +1 -1
- package/dist/runtime/components/NavigationMenu.vue.d.ts +1 -1
- package/dist/runtime/components/PageAnchors.d.vue.ts +1 -1
- package/dist/runtime/components/PageAnchors.vue.d.ts +1 -1
- package/dist/runtime/components/PageLinks.d.vue.ts +1 -1
- package/dist/runtime/components/PageLinks.vue.d.ts +1 -1
- package/dist/runtime/components/PinInput.d.vue.ts +5 -3
- package/dist/runtime/components/PinInput.vue +15 -7
- package/dist/runtime/components/PinInput.vue.d.ts +5 -3
- package/dist/runtime/components/ProgressGroup.d.vue.ts +1 -1
- package/dist/runtime/components/ProgressGroup.vue.d.ts +1 -1
- package/dist/runtime/components/RadioGroup.d.vue.ts +1 -1
- package/dist/runtime/components/RadioGroup.vue.d.ts +1 -1
- package/dist/runtime/components/Select.d.vue.ts +1 -1
- package/dist/runtime/components/Select.vue +7 -1
- package/dist/runtime/components/Select.vue.d.ts +1 -1
- package/dist/runtime/components/SelectMenu.d.vue.ts +1 -1
- package/dist/runtime/components/SelectMenu.vue +22 -3
- package/dist/runtime/components/SelectMenu.vue.d.ts +1 -1
- package/dist/runtime/components/Splitter.d.vue.ts +1 -1
- package/dist/runtime/components/Splitter.vue.d.ts +1 -1
- package/dist/runtime/components/Stepper.d.vue.ts +1 -1
- package/dist/runtime/components/Stepper.vue.d.ts +1 -1
- package/dist/runtime/components/Table.vue +24 -2
- package/dist/runtime/components/Tabs.d.vue.ts +1 -1
- package/dist/runtime/components/Tabs.vue.d.ts +1 -1
- package/dist/runtime/components/Textarea.vue +5 -5
- package/dist/runtime/components/Timeline.d.vue.ts +1 -1
- package/dist/runtime/components/Timeline.vue.d.ts +1 -1
- package/dist/runtime/components/Toaster.vue +1 -1
- package/dist/runtime/components/Tree.d.vue.ts +1 -1
- package/dist/runtime/components/Tree.vue +1 -1
- package/dist/runtime/components/Tree.vue.d.ts +1 -1
- package/dist/runtime/components/content/ContentNavigation.d.vue.ts +1 -1
- package/dist/runtime/components/content/ContentNavigation.vue.d.ts +1 -1
- package/dist/runtime/components/content/ContentSearch.vue +3 -3
- package/dist/runtime/components/content/ContentSurround.d.vue.ts +1 -1
- package/dist/runtime/components/content/ContentSurround.vue.d.ts +1 -1
- package/dist/runtime/components/content/ContentToc.d.vue.ts +1 -1
- package/dist/runtime/components/content/ContentToc.vue.d.ts +1 -1
- package/dist/runtime/composables/useFilter.js +7 -1
- package/dist/runtime/composables/useFormField.d.ts +1 -1
- package/dist/runtime/composables/useFormField.js +8 -4
- package/dist/runtime/composables/useForwardProps.js +2 -2
- package/dist/runtime/composables/useOverlay.d.ts +2 -2
- package/dist/runtime/composables/useOverlay.js +5 -5
- package/dist/runtime/composables/useResizable.js +1 -1
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/types/form.d.ts +3 -0
- package/dist/runtime/utils/form.js +3 -20
- package/dist/runtime/utils/index.js +22 -18
- package/dist/runtime/utils/virtualizer.d.ts +1 -1
- package/dist/runtime/utils/virtualizer.js +9 -11
- package/dist/runtime/vue/overrides/inertia/LinkBase.vue +3 -1
- package/dist/shared/{ui.DCJ9twx8.mjs → ui.CNAeRcb0.mjs} +45 -13
- package/dist/unplugin.d.mts +2 -1
- package/dist/unplugin.mjs +22 -10
- package/dist/vite.mjs +1 -1
- package/package.json +57 -60
- package/cli/commands/make/component.mjs +0 -86
- package/cli/commands/make/index.mjs +0 -14
- package/cli/commands/make/locale.mjs +0 -93
- package/cli/index.mjs +0 -15
- package/cli/package.json +0 -13
- package/cli/templates.mjs +0 -256
- package/cli/utils.mjs +0 -50
|
@@ -18,7 +18,7 @@ export interface StepperItem {
|
|
|
18
18
|
content?: string;
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
class?: any;
|
|
21
|
-
ui?: Pick<Stepper['slots'], 'item' | 'container' | 'trigger' | 'indicator' | 'icon' | 'separator' | 'wrapper' | 'title' | 'description'
|
|
21
|
+
ui?: Partial<Pick<Stepper['slots'], 'item' | 'container' | 'trigger' | 'indicator' | 'icon' | 'separator' | 'wrapper' | 'title' | 'description'>>;
|
|
22
22
|
[key: string]: any;
|
|
23
23
|
}
|
|
24
24
|
export interface StepperProps<T extends StepperItem = StepperItem> extends Pick<StepperRootProps, 'linear'> {
|
|
@@ -18,7 +18,7 @@ export interface StepperItem {
|
|
|
18
18
|
content?: string;
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
class?: any;
|
|
21
|
-
ui?: Pick<Stepper['slots'], 'item' | 'container' | 'trigger' | 'indicator' | 'icon' | 'separator' | 'wrapper' | 'title' | 'description'
|
|
21
|
+
ui?: Partial<Pick<Stepper['slots'], 'item' | 'container' | 'trigger' | 'indicator' | 'icon' | 'separator' | 'wrapper' | 'title' | 'description'>>;
|
|
22
22
|
[key: string]: any;
|
|
23
23
|
}
|
|
24
24
|
export interface StepperProps<T extends StepperItem = StepperItem> extends Pick<StepperRootProps, 'linear'> {
|
|
@@ -259,12 +259,15 @@ function onRowSelect(e, row) {
|
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
261
261
|
const target = e.target;
|
|
262
|
-
const isInteractive = target.closest("button
|
|
262
|
+
const isInteractive = target.closest("a, button, input, label, select, textarea");
|
|
263
263
|
if (isInteractive) {
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
266
266
|
e.preventDefault();
|
|
267
267
|
e.stopPropagation();
|
|
268
|
+
if (e.repeat) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
268
271
|
props.onSelect(e, row);
|
|
269
272
|
}
|
|
270
273
|
function onRowHover(e, row) {
|
|
@@ -299,6 +302,24 @@ function getColumnStyles(column) {
|
|
|
299
302
|
}
|
|
300
303
|
return styles;
|
|
301
304
|
}
|
|
305
|
+
function isSortable(column) {
|
|
306
|
+
return column.columnDef.enableSorting === true && column.getCanSort();
|
|
307
|
+
}
|
|
308
|
+
function getAriaSort(header) {
|
|
309
|
+
if (header.isPlaceholder || !isSortable(header.column)) {
|
|
310
|
+
return void 0;
|
|
311
|
+
}
|
|
312
|
+
const sorted = header.column.getIsSorted();
|
|
313
|
+
if (!sorted) {
|
|
314
|
+
return "none";
|
|
315
|
+
}
|
|
316
|
+
const sortableIds = new Set(tableApi.getVisibleLeafColumns().filter(isSortable).map((column) => column.id));
|
|
317
|
+
const primary = tableApi.getState().sorting.find(({ id }) => sortableIds.has(id));
|
|
318
|
+
if (primary?.id !== header.column.id) {
|
|
319
|
+
return "none";
|
|
320
|
+
}
|
|
321
|
+
return sorted === "asc" ? "ascending" : "descending";
|
|
322
|
+
}
|
|
302
323
|
watch(() => props.data, () => {
|
|
303
324
|
data.value = props.data ? [...props.data] : [];
|
|
304
325
|
}, props.watchOptions);
|
|
@@ -318,7 +339,6 @@ defineExpose({
|
|
|
318
339
|
:data-selectable="!!props.onSelect || !!props.onHover || !!props.onContextmenu"
|
|
319
340
|
:data-expanded="row.getIsExpanded()"
|
|
320
341
|
:data-pinned="row.getIsPinned() || void 0"
|
|
321
|
-
:role="props.onSelect ? 'button' : void 0"
|
|
322
342
|
:tabindex="props.onSelect ? 0 : void 0"
|
|
323
343
|
data-slot="tr"
|
|
324
344
|
:class="ui.tr({
|
|
@@ -329,6 +349,7 @@ defineExpose({
|
|
|
329
349
|
})"
|
|
330
350
|
:style="[resolveValue(tableApi.options.meta?.style?.tr, row), style]"
|
|
331
351
|
@click="onRowSelect($event, row)"
|
|
352
|
+
@keydown.self.exact.enter.space="onRowSelect($event, row)"
|
|
332
353
|
@pointerenter="onRowHover($event, row)"
|
|
333
354
|
@pointerleave="onRowHover($event, null)"
|
|
334
355
|
@contextmenu="onRowContextmenu($event, row)"
|
|
@@ -382,6 +403,7 @@ defineExpose({
|
|
|
382
403
|
:scope="header.colSpan > 1 ? 'colgroup' : 'col'"
|
|
383
404
|
:colspan="header.colSpan > 1 ? header.colSpan : void 0"
|
|
384
405
|
:rowspan="header.rowSpan > 1 ? header.rowSpan : void 0"
|
|
406
|
+
:aria-sort="getAriaSort(header)"
|
|
385
407
|
data-slot="th"
|
|
386
408
|
:class="ui.th({
|
|
387
409
|
class: [
|
|
@@ -30,7 +30,7 @@ export interface TabsItem {
|
|
|
30
30
|
value?: string | number;
|
|
31
31
|
disabled?: boolean;
|
|
32
32
|
class?: any;
|
|
33
|
-
ui?: Pick<Tabs['slots'], 'trigger' | 'leadingIcon' | 'leadingAvatar' | 'leadingAvatarSize' | 'label' | 'trailingBadge' | 'trailingBadgeSize' | 'content'
|
|
33
|
+
ui?: Partial<Pick<Tabs['slots'], 'trigger' | 'leadingIcon' | 'leadingAvatar' | 'leadingAvatarSize' | 'label' | 'trailingBadge' | 'trailingBadgeSize' | 'content'>>;
|
|
34
34
|
[key: string]: any;
|
|
35
35
|
}
|
|
36
36
|
export interface TabsProps<T extends TabsItem = TabsItem> extends Pick<TabsRootProps<string | number>, 'defaultValue' | 'modelValue' | 'activationMode' | 'unmountOnHide'> {
|
|
@@ -30,7 +30,7 @@ export interface TabsItem {
|
|
|
30
30
|
value?: string | number;
|
|
31
31
|
disabled?: boolean;
|
|
32
32
|
class?: any;
|
|
33
|
-
ui?: Pick<Tabs['slots'], 'trigger' | 'leadingIcon' | 'leadingAvatar' | 'leadingAvatarSize' | 'label' | 'trailingBadge' | 'trailingBadgeSize' | 'content'
|
|
33
|
+
ui?: Partial<Pick<Tabs['slots'], 'trigger' | 'leadingIcon' | 'leadingAvatar' | 'leadingAvatarSize' | 'label' | 'trailingBadge' | 'trailingBadgeSize' | 'content'>>;
|
|
34
34
|
[key: string]: any;
|
|
35
35
|
}
|
|
36
36
|
export interface TabsProps<T extends TabsItem = TabsItem> extends Pick<TabsRootProps<string | number>, 'defaultValue' | 'modelValue' | 'activationMode' | 'unmountOnHide'> {
|
|
@@ -10,7 +10,7 @@ import { useAppConfig } from "#imports";
|
|
|
10
10
|
import { useComponentProps } from "../composables/useComponentProps";
|
|
11
11
|
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
12
12
|
import { useFormField } from "../composables/useFormField";
|
|
13
|
-
import { looseToNumber } from "../utils";
|
|
13
|
+
import { isEmpty, looseToNumber } from "../utils";
|
|
14
14
|
import { tv } from "../utils/tv";
|
|
15
15
|
import UIcon from "./Icon.vue";
|
|
16
16
|
import UAvatar from "./Avatar.vue";
|
|
@@ -77,11 +77,11 @@ function updateInput(value) {
|
|
|
77
77
|
if (props.modelModifiers?.number) {
|
|
78
78
|
value = looseToNumber(value);
|
|
79
79
|
}
|
|
80
|
-
if (props.modelModifiers?.nullable) {
|
|
81
|
-
value
|
|
80
|
+
if (props.modelModifiers?.nullable && isEmpty(value)) {
|
|
81
|
+
value = null;
|
|
82
82
|
}
|
|
83
|
-
if (props.modelModifiers?.optional && !props.modelModifiers?.nullable && value !== null) {
|
|
84
|
-
value
|
|
83
|
+
if (props.modelModifiers?.optional && !props.modelModifiers?.nullable && value !== null && isEmpty(value)) {
|
|
84
|
+
value = void 0;
|
|
85
85
|
}
|
|
86
86
|
modelValue.value = value;
|
|
87
87
|
emitFormInput();
|
|
@@ -15,7 +15,7 @@ export interface TimelineItem {
|
|
|
15
15
|
value?: string | number;
|
|
16
16
|
slot?: string;
|
|
17
17
|
class?: any;
|
|
18
|
-
ui?: Pick<Timeline['slots'], 'item' | 'container' | 'indicator' | 'separator' | 'wrapper' | 'date' | 'title' | 'description'
|
|
18
|
+
ui?: Partial<Pick<Timeline['slots'], 'item' | 'container' | 'indicator' | 'separator' | 'wrapper' | 'date' | 'title' | 'description'>>;
|
|
19
19
|
[key: string]: any;
|
|
20
20
|
}
|
|
21
21
|
export interface TimelineProps<T extends TimelineItem = TimelineItem> {
|
|
@@ -15,7 +15,7 @@ export interface TimelineItem {
|
|
|
15
15
|
value?: string | number;
|
|
16
16
|
slot?: string;
|
|
17
17
|
class?: any;
|
|
18
|
-
ui?: Pick<Timeline['slots'], 'item' | 'container' | 'indicator' | 'separator' | 'wrapper' | 'date' | 'title' | 'description'
|
|
18
|
+
ui?: Partial<Pick<Timeline['slots'], 'item' | 'container' | 'indicator' | 'separator' | 'wrapper' | 'date' | 'title' | 'description'>>;
|
|
19
19
|
[key: string]: any;
|
|
20
20
|
}
|
|
21
21
|
export interface TimelineProps<T extends TimelineItem = TimelineItem> {
|
|
@@ -81,7 +81,7 @@ function getOffset(index) {
|
|
|
81
81
|
:key="toast.id"
|
|
82
82
|
ref="refs"
|
|
83
83
|
:progress="props.progress"
|
|
84
|
-
v-bind="omit(toast, ['id', 'close', '_duplicate', '_updated'])"
|
|
84
|
+
v-bind="omit(toast, ['id', 'close', '_duplicate', '_updated', 'onClick'])"
|
|
85
85
|
:close="toast.close"
|
|
86
86
|
:data-expanded="expanded"
|
|
87
87
|
:data-front="!expanded && index === toasts.length - 1"
|
|
@@ -23,7 +23,7 @@ export type TreeItem = {
|
|
|
23
23
|
onToggle?: (e: TreeItemToggleEvent<TreeItem>) => void;
|
|
24
24
|
onSelect?: (e: TreeItemSelectEvent<TreeItem>) => void;
|
|
25
25
|
class?: any;
|
|
26
|
-
ui?: Pick<Tree['slots'], 'item' | 'itemWithChildren' | 'link' | 'linkLeadingIcon' | 'linkLabel' | 'linkTrailing' | 'linkTrailingIcon' | 'listWithChildren'
|
|
26
|
+
ui?: Partial<Pick<Tree['slots'], 'item' | 'itemWithChildren' | 'link' | 'linkLeadingIcon' | 'linkLabel' | 'linkTrailing' | 'linkTrailingIcon' | 'listWithChildren'>>;
|
|
27
27
|
[key: string]: any;
|
|
28
28
|
};
|
|
29
29
|
export interface TreeProps<T extends TreeItem[] = TreeItem[], M extends boolean = false> extends Pick<TreeRootProps<T>, 'expanded' | 'defaultExpanded' | 'selectionBehavior' | 'propagateSelect' | 'disabled' | 'bubbleSelect'> {
|
|
@@ -66,7 +66,7 @@ const flattenedPaddingFormula = computed(() => {
|
|
|
66
66
|
xl: { base: 3, perLevel: 7.5 }
|
|
67
67
|
// px-3, ms-6 + ps-1.5
|
|
68
68
|
};
|
|
69
|
-
const config = sizeConfig[props.size
|
|
69
|
+
const config = sizeConfig[props.size] ?? sizeConfig.md;
|
|
70
70
|
return (level) => `calc(var(--spacing) * ${(level - 1) * config.perLevel + config.base})`;
|
|
71
71
|
});
|
|
72
72
|
const virtualizerProps = toRef(() => {
|
|
@@ -23,7 +23,7 @@ export type TreeItem = {
|
|
|
23
23
|
onToggle?: (e: TreeItemToggleEvent<TreeItem>) => void;
|
|
24
24
|
onSelect?: (e: TreeItemSelectEvent<TreeItem>) => void;
|
|
25
25
|
class?: any;
|
|
26
|
-
ui?: Pick<Tree['slots'], 'item' | 'itemWithChildren' | 'link' | 'linkLeadingIcon' | 'linkLabel' | 'linkTrailing' | 'linkTrailingIcon' | 'listWithChildren'
|
|
26
|
+
ui?: Partial<Pick<Tree['slots'], 'item' | 'itemWithChildren' | 'link' | 'linkLeadingIcon' | 'linkLabel' | 'linkTrailing' | 'linkTrailingIcon' | 'listWithChildren'>>;
|
|
27
27
|
[key: string]: any;
|
|
28
28
|
};
|
|
29
29
|
export interface TreeProps<T extends TreeItem[] = TreeItem[], M extends boolean = false> extends Pick<TreeRootProps<T>, 'expanded' | 'defaultExpanded' | 'selectionBehavior' | 'propagateSelect' | 'disabled' | 'bubbleSelect'> {
|
|
@@ -28,7 +28,7 @@ export interface ContentNavigationLink extends ContentNavigationItem {
|
|
|
28
28
|
defaultOpen?: boolean;
|
|
29
29
|
active?: boolean;
|
|
30
30
|
class?: any;
|
|
31
|
-
ui?: Pick<ContentNavigation['slots'], 'link' | 'linkLeadingIcon' | 'linkTitle' | 'linkTrailing' | 'linkTrailingIcon' | 'linkTrailingBadge' | 'linkTrailingBadgeSize' | 'linkTrailingIcon' | 'linkTitleExternalIcon' | 'trigger' | 'content' | 'item' | 'itemWithChildren'
|
|
31
|
+
ui?: Partial<Pick<ContentNavigation['slots'], 'link' | 'linkLeadingIcon' | 'linkTitle' | 'linkTrailing' | 'linkTrailingIcon' | 'linkTrailingBadge' | 'linkTrailingBadgeSize' | 'linkTrailingIcon' | 'linkTitleExternalIcon' | 'trigger' | 'content' | 'item' | 'itemWithChildren'>>;
|
|
32
32
|
}
|
|
33
33
|
export interface ContentNavigationProps<T extends ContentNavigationLink = ContentNavigationLink> extends Pick<AccordionRootProps, 'disabled' | 'type' | 'unmountOnHide'> {
|
|
34
34
|
/**
|
|
@@ -28,7 +28,7 @@ export interface ContentNavigationLink extends ContentNavigationItem {
|
|
|
28
28
|
defaultOpen?: boolean;
|
|
29
29
|
active?: boolean;
|
|
30
30
|
class?: any;
|
|
31
|
-
ui?: Pick<ContentNavigation['slots'], 'link' | 'linkLeadingIcon' | 'linkTitle' | 'linkTrailing' | 'linkTrailingIcon' | 'linkTrailingBadge' | 'linkTrailingBadgeSize' | 'linkTrailingIcon' | 'linkTitleExternalIcon' | 'trigger' | 'content' | 'item' | 'itemWithChildren'
|
|
31
|
+
ui?: Partial<Pick<ContentNavigation['slots'], 'link' | 'linkLeadingIcon' | 'linkTitle' | 'linkTrailing' | 'linkTrailingIcon' | 'linkTrailingBadge' | 'linkTrailingBadgeSize' | 'linkTrailingIcon' | 'linkTitleExternalIcon' | 'trigger' | 'content' | 'item' | 'itemWithChildren'>>;
|
|
32
32
|
}
|
|
33
33
|
export interface ContentNavigationProps<T extends ContentNavigationLink = ContentNavigationLink> extends Pick<AccordionRootProps, 'disabled' | 'type' | 'unmountOnHide'> {
|
|
34
34
|
/**
|
|
@@ -62,7 +62,7 @@ const _props = defineProps({
|
|
|
62
62
|
const slots = defineSlots();
|
|
63
63
|
const props = useComponentProps("contentSearch", _props);
|
|
64
64
|
const searchTerm = defineModel("searchTerm", { type: String, ...{ default: "" } });
|
|
65
|
-
const { t } = useLocale();
|
|
65
|
+
const { t, locale } = useLocale();
|
|
66
66
|
const { open, mapNavigationItems, mapLinks, mapSearchResults, postFilter } = useContentSearch();
|
|
67
67
|
const colorMode = useColorMode();
|
|
68
68
|
const appConfig = useAppConfig();
|
|
@@ -214,8 +214,8 @@ defineExpose({
|
|
|
214
214
|
<template>
|
|
215
215
|
<UModal
|
|
216
216
|
v-model:open="open"
|
|
217
|
-
:title="props.title || t('
|
|
218
|
-
:description="props.description ||
|
|
217
|
+
:title="props.title || locale.messages.contentSearch?.title || t('contentSearchButton.label')"
|
|
218
|
+
:description="props.description || locale.messages.contentSearch?.description"
|
|
219
219
|
v-bind="modalProps"
|
|
220
220
|
data-slot="modal"
|
|
221
221
|
:class="ui.modal({ class: [props.ui?.modal, props.class] })"
|
|
@@ -12,7 +12,7 @@ export interface ContentSurroundLink extends ContentNavigationItem {
|
|
|
12
12
|
*/
|
|
13
13
|
icon?: IconProps['name'];
|
|
14
14
|
class?: any;
|
|
15
|
-
ui?: Pick<ContentSurround['slots'], 'link' | 'linkLeading' | 'linkLeadingIcon' | 'linkTitle' | 'linkDescription'
|
|
15
|
+
ui?: Partial<Pick<ContentSurround['slots'], 'link' | 'linkLeading' | 'linkLeadingIcon' | 'linkTitle' | 'linkDescription'>>;
|
|
16
16
|
}
|
|
17
17
|
export interface ContentSurroundProps<T extends ContentSurroundLink = ContentSurroundLink> {
|
|
18
18
|
/**
|
|
@@ -12,7 +12,7 @@ export interface ContentSurroundLink extends ContentNavigationItem {
|
|
|
12
12
|
*/
|
|
13
13
|
icon?: IconProps['name'];
|
|
14
14
|
class?: any;
|
|
15
|
-
ui?: Pick<ContentSurround['slots'], 'link' | 'linkLeading' | 'linkLeadingIcon' | 'linkTitle' | 'linkDescription'
|
|
15
|
+
ui?: Partial<Pick<ContentSurround['slots'], 'link' | 'linkLeading' | 'linkLeadingIcon' | 'linkTitle' | 'linkDescription'>>;
|
|
16
16
|
}
|
|
17
17
|
export interface ContentSurroundProps<T extends ContentSurroundLink = ContentSurroundLink> {
|
|
18
18
|
/**
|
|
@@ -8,7 +8,7 @@ import type { ComponentConfig } from '../../types/tv';
|
|
|
8
8
|
type ContentToc = ComponentConfig<typeof theme, AppConfig, 'contentToc'>;
|
|
9
9
|
export type ContentTocLink = TocLink & {
|
|
10
10
|
class?: any;
|
|
11
|
-
ui?: Pick<ContentToc['slots'], 'item' | 'itemWithChildren' | 'link' | 'linkText'
|
|
11
|
+
ui?: Partial<Pick<ContentToc['slots'], 'item' | 'itemWithChildren' | 'link' | 'linkText'>>;
|
|
12
12
|
};
|
|
13
13
|
export interface ContentTocProps<T extends ContentTocLink = ContentTocLink> extends Pick<CollapsibleRootProps, 'defaultOpen' | 'open'> {
|
|
14
14
|
/**
|
|
@@ -8,7 +8,7 @@ import type { ComponentConfig } from '../../types/tv';
|
|
|
8
8
|
type ContentToc = ComponentConfig<typeof theme, AppConfig, 'contentToc'>;
|
|
9
9
|
export type ContentTocLink = TocLink & {
|
|
10
10
|
class?: any;
|
|
11
|
-
ui?: Pick<ContentToc['slots'], 'item' | 'itemWithChildren' | 'link' | 'linkText'
|
|
11
|
+
ui?: Partial<Pick<ContentToc['slots'], 'item' | 'itemWithChildren' | 'link' | 'linkText'>>;
|
|
12
12
|
};
|
|
13
13
|
export interface ContentTocProps<T extends ContentTocLink = ContentTocLink> extends Pick<CollapsibleRootProps, 'defaultOpen' | 'open'> {
|
|
14
14
|
/**
|
|
@@ -52,7 +52,13 @@ export function useFilter() {
|
|
|
52
52
|
result.push({ item, score: s });
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
let start = 0;
|
|
56
|
+
for (let i = 0; i <= result.length; i++) {
|
|
57
|
+
if (i === result.length || result[i].score === -1) {
|
|
58
|
+
result.splice(start, i - start, ...result.slice(start, i).sort((a, b) => a.score - b.score));
|
|
59
|
+
start = i + 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
56
62
|
return result.map(({ item }) => item);
|
|
57
63
|
}).filter((group) => group.some((item) => !options.isStructural?.(item)));
|
|
58
64
|
}
|
|
@@ -59,7 +59,7 @@ export declare function useFormField<T>(props?: Props<T>, opts?: {
|
|
|
59
59
|
highlight: ComputedRef<true | undefined>;
|
|
60
60
|
disabled: ComputedRef<true | undefined>;
|
|
61
61
|
emitFormBlur: () => void;
|
|
62
|
-
emitFormInput: import("@vueuse/shared").
|
|
62
|
+
emitFormInput: () => import("@vueuse/shared").Promisify<void>;
|
|
63
63
|
emitFormChange: () => void;
|
|
64
64
|
emitFormFocus: () => void;
|
|
65
65
|
ariaAttrs: ComputedRef<Record<string, any> | undefined>;
|
|
@@ -21,9 +21,9 @@ export function useFormField(props, opts) {
|
|
|
21
21
|
inputId.value = props?.id;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
function emitFormEvent(type, name,
|
|
24
|
+
function emitFormEvent(type, name, flags) {
|
|
25
25
|
if (formBus && formField && name) {
|
|
26
|
-
formBus.emit({ type, name,
|
|
26
|
+
formBus.emit({ type, name, ...flags });
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
function emitFormBlur() {
|
|
@@ -41,13 +41,17 @@ export function useFormField(props, opts) {
|
|
|
41
41
|
disposed = true;
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
const
|
|
44
|
+
const validateInput = useDebounceFn(
|
|
45
45
|
() => {
|
|
46
46
|
if (disposed) return;
|
|
47
|
-
emitFormEvent("input", formField?.value.name, !opts?.deferInputValidation || formField?.value.eagerValidation);
|
|
47
|
+
emitFormEvent("input", formField?.value.name, { eager: !opts?.deferInputValidation || formField?.value.eagerValidation, track: false });
|
|
48
48
|
},
|
|
49
49
|
formField?.value.validateOnInputDelay ?? formOptions?.value.validateOnInputDelay ?? 0
|
|
50
50
|
);
|
|
51
|
+
function emitFormInput() {
|
|
52
|
+
emitFormEvent("input", formField?.value.name, { validate: false });
|
|
53
|
+
return validateInput();
|
|
54
|
+
}
|
|
51
55
|
return {
|
|
52
56
|
id: computed(() => props?.id ?? inputId?.value),
|
|
53
57
|
name: computed(() => props?.name ?? formField?.value.name),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { computed,
|
|
1
|
+
import { computed, unref } from "vue";
|
|
2
2
|
import { useEmitAsProps } from "reka-ui";
|
|
3
3
|
export function useForwardProps(source, emits) {
|
|
4
4
|
const emitAsProps = emits ? useEmitAsProps(emits) : {};
|
|
5
5
|
return computed(() => {
|
|
6
|
-
const src =
|
|
6
|
+
const src = unref(source);
|
|
7
7
|
const out = { ...emitAsProps };
|
|
8
8
|
for (const key in src) {
|
|
9
9
|
const value = src[key];
|
|
@@ -41,7 +41,7 @@ interface ManagedOverlayOptionsPrivate<T extends Component> {
|
|
|
41
41
|
isMounted: boolean;
|
|
42
42
|
isOpen: boolean;
|
|
43
43
|
originalProps?: ComponentProps<T>;
|
|
44
|
-
|
|
44
|
+
resolvers: ((value: any) => void)[];
|
|
45
45
|
}
|
|
46
46
|
export type Overlay = OverlayOptions<Component> & ManagedOverlayOptionsPrivate<Component>;
|
|
47
47
|
type OverlayInstance<T extends Component> = Omit<ManagedOverlayOptionsPrivate<T>, 'component'> & {
|
|
@@ -50,7 +50,7 @@ type OverlayInstance<T extends Component> = Omit<ManagedOverlayOptionsPrivate<T>
|
|
|
50
50
|
close: (value?: any) => void;
|
|
51
51
|
patch: (props: Partial<ComponentProps<T>>) => void;
|
|
52
52
|
};
|
|
53
|
-
type OpenedOverlay<T extends Component> = Omit<OverlayInstance<T>, 'open' | 'close' | 'patch' | 'modelValue' | '
|
|
53
|
+
type OpenedOverlay<T extends Component> = Omit<OverlayInstance<T>, 'open' | 'close' | 'patch' | 'modelValue' | 'resolvers'> & {
|
|
54
54
|
result: Promise<CloseEventArgType<ComponentEmit<T>>>;
|
|
55
55
|
} & Promise<CloseEventArgType<ComponentEmit<T>>>;
|
|
56
56
|
declare function _useOverlay(): {
|
|
@@ -11,7 +11,8 @@ function _useOverlay() {
|
|
|
11
11
|
isMounted: !!defaultOpen,
|
|
12
12
|
destroyOnClose: !!destroyOnClose,
|
|
13
13
|
originalProps: props || {},
|
|
14
|
-
props: { ...props }
|
|
14
|
+
props: { ...props },
|
|
15
|
+
resolvers: []
|
|
15
16
|
});
|
|
16
17
|
overlays.push(options);
|
|
17
18
|
return {
|
|
@@ -30,7 +31,7 @@ function _useOverlay() {
|
|
|
30
31
|
}
|
|
31
32
|
overlay.isOpen = true;
|
|
32
33
|
overlay.isMounted = true;
|
|
33
|
-
const result = new Promise((resolve) => overlay.
|
|
34
|
+
const result = new Promise((resolve) => overlay.resolvers.push(resolve));
|
|
34
35
|
return Object.assign(result, {
|
|
35
36
|
id,
|
|
36
37
|
isMounted: overlay.isMounted,
|
|
@@ -41,9 +42,8 @@ function _useOverlay() {
|
|
|
41
42
|
const close = (id, value) => {
|
|
42
43
|
const overlay = getOverlay(id);
|
|
43
44
|
overlay.isOpen = false;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
overlay.resolvePromise = void 0;
|
|
45
|
+
for (const resolve of overlay.resolvers.splice(0)) {
|
|
46
|
+
resolve(value);
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
const closeAll = () => {
|
|
@@ -15,7 +15,7 @@ export function useResizable(key, options = {}, { collapsed = ref(false) } = {})
|
|
|
15
15
|
collapsedSize: 0,
|
|
16
16
|
resizable: true,
|
|
17
17
|
unit: "%",
|
|
18
|
-
...
|
|
18
|
+
...unref(options)
|
|
19
19
|
}));
|
|
20
20
|
const { dir } = useLocale();
|
|
21
21
|
const defaultStorageValue = {
|
package/dist/runtime/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@import "#build/ui.css";@import "./keyframes.css";@source "./components";@variant light (&:where(.light, .light *));@variant dark (&:where(.dark, .dark *));@layer base{a:focus-visible{outline-offset:0}}@layer theme{:host,:root{--ui-header-height:4rem;--ui-radius:0.25rem;--ui-container:80rem}.light,:host,:root{--ui-text-dimmed:var(--ui-color-neutral-400);--ui-text-muted:var(--ui-color-neutral-500);--ui-text-toned:var(--ui-color-neutral-600);--ui-text:var(--ui-color-neutral-700);--ui-text-highlighted:var(--ui-color-neutral-900);--ui-text-inverted:#fff;--ui-bg:#fff;--ui-bg-muted:var(--ui-color-neutral-50);--ui-bg-elevated:var(--ui-color-neutral-100);--ui-bg-accented:var(--ui-color-neutral-200);--ui-bg-inverted:var(--ui-color-neutral-900);--ui-border:var(--ui-color-neutral-200);--ui-border-muted:var(--ui-color-neutral-200);--ui-border-accented:var(--ui-color-neutral-300);--ui-border-inverted:var(--ui-color-neutral-900)}.dark{--ui-text-dimmed:var(--ui-color-neutral-500);--ui-text-muted:var(--ui-color-neutral-400);--ui-text-toned:var(--ui-color-neutral-300);--ui-text:var(--ui-color-neutral-200);--ui-text-highlighted:#fff;--ui-text-inverted:var(--ui-color-neutral-900);--ui-bg:var(--ui-color-neutral-900);--ui-bg-muted:var(--ui-color-neutral-800);--ui-bg-elevated:var(--ui-color-neutral-800);--ui-bg-accented:var(--ui-color-neutral-700);--ui-bg-inverted:#fff;--ui-border:var(--ui-color-neutral-800);--ui-border-muted:var(--ui-color-neutral-700);--ui-border-accented:var(--ui-color-neutral-700);--ui-border-inverted:#fff}}
|
|
1
|
+
@import "#build/ui.css";@import "./keyframes.css";@source "./components";@custom-variant light (&:where(.light, .light *));@custom-variant dark (&:where(.dark, .dark *));@layer base{a:focus-visible{outline-offset:0}}@layer theme{:host,:root{--ui-header-height:4rem;--ui-radius:0.25rem;--ui-container:80rem}.light,:host,:root{--ui-text-dimmed:var(--ui-color-neutral-400);--ui-text-muted:var(--ui-color-neutral-500);--ui-text-toned:var(--ui-color-neutral-600);--ui-text:var(--ui-color-neutral-700);--ui-text-highlighted:var(--ui-color-neutral-900);--ui-text-inverted:#fff;--ui-bg:#fff;--ui-bg-muted:var(--ui-color-neutral-50);--ui-bg-elevated:var(--ui-color-neutral-100);--ui-bg-accented:var(--ui-color-neutral-200);--ui-bg-inverted:var(--ui-color-neutral-900);--ui-border:var(--ui-color-neutral-200);--ui-border-muted:var(--ui-color-neutral-200);--ui-border-accented:var(--ui-color-neutral-300);--ui-border-inverted:var(--ui-color-neutral-900)}.dark{--ui-text-dimmed:var(--ui-color-neutral-500);--ui-text-muted:var(--ui-color-neutral-400);--ui-text-toned:var(--ui-color-neutral-300);--ui-text:var(--ui-color-neutral-200);--ui-text-highlighted:#fff;--ui-text-inverted:var(--ui-color-neutral-900);--ui-bg:var(--ui-color-neutral-900);--ui-bg-muted:var(--ui-color-neutral-800);--ui-bg-elevated:var(--ui-color-neutral-800);--ui-bg-accented:var(--ui-color-neutral-700);--ui-bg-inverted:#fff;--ui-border:var(--ui-color-neutral-800);--ui-border-muted:var(--ui-color-neutral-700);--ui-border-accented:var(--ui-color-neutral-700);--ui-border-inverted:#fff}}
|
|
@@ -46,6 +46,7 @@ export type FormChildAttachEvent<S extends FormSchema> = {
|
|
|
46
46
|
type: 'attach';
|
|
47
47
|
formId: string | number;
|
|
48
48
|
validate: Form<any>['validate'];
|
|
49
|
+
clearDirty: () => void;
|
|
49
50
|
name?: string;
|
|
50
51
|
api: Form<S>;
|
|
51
52
|
};
|
|
@@ -57,6 +58,8 @@ export type FormInputEvent<T extends object> = {
|
|
|
57
58
|
type: FormEventType;
|
|
58
59
|
name: keyof T;
|
|
59
60
|
eager?: boolean;
|
|
61
|
+
track?: boolean;
|
|
62
|
+
validate?: boolean;
|
|
60
63
|
};
|
|
61
64
|
export type FormEvent<T extends object> = FormInputEvent<T> | FormChildAttachEvent<any> | FormChildDetachEvent;
|
|
62
65
|
export interface FormInjectedOptions {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { toRaw } from "vue";
|
|
2
|
+
import { get, set } from "./index.js";
|
|
2
3
|
export function isSuperStructSchema(schema) {
|
|
3
4
|
return "schema" in schema && typeof schema.coercer === "function" && typeof schema.validator === "function" && typeof schema.refiner === "function";
|
|
4
5
|
}
|
|
@@ -50,29 +51,11 @@ export function validateSchema(state, _schema) {
|
|
|
50
51
|
}
|
|
51
52
|
export function getAtPath(data, path) {
|
|
52
53
|
if (!path) return data;
|
|
53
|
-
|
|
54
|
-
(value2, key) => value2?.[key],
|
|
55
|
-
data
|
|
56
|
-
);
|
|
57
|
-
return value;
|
|
54
|
+
return get(data, path);
|
|
58
55
|
}
|
|
59
56
|
export function setAtPath(data, path, value) {
|
|
60
57
|
if (!path) return Object.assign(data, value);
|
|
61
58
|
if (!data) return data;
|
|
62
|
-
|
|
63
|
-
let current = data;
|
|
64
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
65
|
-
const key = keys[i];
|
|
66
|
-
if (current[key] === void 0 || current[key] === null) {
|
|
67
|
-
if (i + 1 < keys.length && !Number.isNaN(Number(keys[i + 1]))) {
|
|
68
|
-
current[key] = [];
|
|
69
|
-
} else {
|
|
70
|
-
current[key] = {};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
current = current[key];
|
|
74
|
-
}
|
|
75
|
-
const lastKey = keys[keys.length - 1];
|
|
76
|
-
current[lastKey] = value;
|
|
59
|
+
set(data, path, value);
|
|
77
60
|
return data;
|
|
78
61
|
}
|
|
@@ -15,14 +15,9 @@ export function omit(data, keys) {
|
|
|
15
15
|
return result;
|
|
16
16
|
}
|
|
17
17
|
export function get(object, path, defaultValue) {
|
|
18
|
-
|
|
19
|
-
path = path.split(".").map((key) => {
|
|
20
|
-
const numKey = Number(key);
|
|
21
|
-
return Number.isNaN(numKey) ? key : numKey;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
18
|
+
const keys = typeof path === "string" ? path.split(".") : path;
|
|
24
19
|
let result = object;
|
|
25
|
-
for (const key of
|
|
20
|
+
for (const key of keys) {
|
|
26
21
|
if (result === void 0 || result === null) {
|
|
27
22
|
return defaultValue;
|
|
28
23
|
}
|
|
@@ -31,17 +26,26 @@ export function get(object, path, defaultValue) {
|
|
|
31
26
|
return result !== void 0 ? result : defaultValue;
|
|
32
27
|
}
|
|
33
28
|
export function set(object, path, value) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
const keys = [];
|
|
30
|
+
for (const segment of typeof path === "string" ? path.split(".") : path) {
|
|
31
|
+
const key = String(segment);
|
|
32
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
keys.push(key);
|
|
36
|
+
}
|
|
37
|
+
let current = object;
|
|
38
|
+
for (let i = 0; i < keys.length; i++) {
|
|
39
|
+
const key = keys[i];
|
|
40
|
+
if (i === keys.length - 1) {
|
|
41
|
+
current[key] = value;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (current[key] === null || typeof current[key] !== "object" && typeof current[key] !== "function") {
|
|
45
|
+
current[key] = /^(?:0|[1-9]\d*)$/.test(keys[i + 1]) ? [] : {};
|
|
46
|
+
}
|
|
47
|
+
current = current[key];
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
50
|
export function looseToNumber(val) {
|
|
47
51
|
const n = Number.parseFloat(val);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get estimate size for virtualizers that checks each item individually
|
|
3
3
|
*/
|
|
4
|
-
export declare function getEstimateSize(items: any[], size: 'xs' | 'sm' | 'md' | 'lg' | 'xl', descriptionKey?: string, hasDescriptionSlot?: boolean): (index: number) => number;
|
|
4
|
+
export declare function getEstimateSize(items: any[], size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | (string & {}), descriptionKey?: string, hasDescriptionSlot?: boolean): (index: number) => number;
|
|
@@ -7,22 +7,20 @@ function itemHasDescription(item, descriptionKey) {
|
|
|
7
7
|
return value !== void 0 && value !== null && value !== "";
|
|
8
8
|
}
|
|
9
9
|
function getSize(size, hasDescription) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}[size];
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
10
|
+
const sizes = hasDescription ? {
|
|
11
|
+
xs: 44,
|
|
12
|
+
sm: 48,
|
|
13
|
+
md: 52,
|
|
14
|
+
lg: 56,
|
|
15
|
+
xl: 60
|
|
16
|
+
} : {
|
|
20
17
|
xs: 24,
|
|
21
18
|
sm: 28,
|
|
22
19
|
md: 32,
|
|
23
20
|
lg: 36,
|
|
24
21
|
xl: 40
|
|
25
|
-
}
|
|
22
|
+
};
|
|
23
|
+
return sizes[size] ?? sizes.md;
|
|
26
24
|
}
|
|
27
25
|
export function getEstimateSize(items, size, descriptionKey, hasDescriptionSlot) {
|
|
28
26
|
const sizeWithDescription = getSize(size, true);
|
|
@@ -23,11 +23,13 @@ function onClickWrapper(e) {
|
|
|
23
23
|
e.preventDefault();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
+
const results = [];
|
|
26
27
|
if (props.onClick) {
|
|
27
28
|
for (const onClick of Array.isArray(props.onClick) ? props.onClick : [props.onClick]) {
|
|
28
|
-
onClick(e);
|
|
29
|
+
results.push(onClick(e));
|
|
29
30
|
}
|
|
30
31
|
}
|
|
32
|
+
return Promise.all(results);
|
|
31
33
|
}
|
|
32
34
|
</script>
|
|
33
35
|
|