@nuxt/ui 4.11.0 → 4.11.2
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/Breadcrumb.d.vue.ts +1 -1
- package/dist/runtime/components/Breadcrumb.vue.d.ts +1 -1
- package/dist/runtime/components/Carousel.d.vue.ts +7 -7
- package/dist/runtime/components/Carousel.vue.d.ts +7 -7
- package/dist/runtime/components/ChatMessages.d.vue.ts +2 -2
- package/dist/runtime/components/ChatMessages.vue.d.ts +2 -2
- 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/DropdownMenu.d.vue.ts +1 -1
- package/dist/runtime/components/DropdownMenu.vue.d.ts +1 -1
- 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.vue +2 -2
- 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/InputNumber.vue +8 -5
- package/dist/runtime/components/InputTime.vue +12 -6
- package/dist/runtime/components/Link.vue +61 -7
- 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 +10 -10
- 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 +3 -1
- package/dist/runtime/components/PinInput.vue +15 -7
- package/dist/runtime/components/PinInput.vue.d.ts +3 -1
- 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 +3 -1
- package/dist/runtime/components/Select.vue +2 -0
- package/dist/runtime/components/Select.vue.d.ts +3 -1
- package/dist/runtime/components/SelectMenu.d.vue.ts +4 -1
- package/dist/runtime/components/SelectMenu.vue +24 -4
- package/dist/runtime/components/SelectMenu.vue.d.ts +4 -1
- package/dist/runtime/components/Slider.vue +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 +29 -7
- 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/color-mode/ColorModeSelect.vue +1 -0
- 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/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/components/locale/LocaleSelect.vue +1 -0
- package/dist/runtime/components/prose/CodeTree.vue +31 -18
- package/dist/runtime/composables/useForwardProps.js +2 -2
- package/dist/runtime/composables/useResizable.js +1 -1
- package/dist/runtime/utils/form.d.ts +1 -1
- package/dist/runtime/utils/form.js +3 -1
- package/dist/runtime/utils/prefetch.d.ts +5 -0
- package/dist/runtime/utils/prefetch.js +45 -0
- package/dist/runtime/utils/search.js +8 -6
- package/dist/runtime/utils/virtualizer.d.ts +1 -1
- package/dist/runtime/utils/virtualizer.js +9 -11
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue +1 -0
- package/dist/runtime/vue/overrides/inertia/LinkBase.vue +3 -1
- package/dist/shared/{ui.DNq7CNkE.mjs → ui.oNygBd3N.mjs} +40 -12
- package/dist/unplugin.d.mts +2 -1
- package/dist/unplugin.mjs +22 -10
- package/dist/vite.mjs +1 -1
- package/package.json +79 -83
- 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
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<picture>
|
|
2
|
-
<source media="(prefers-color-scheme: dark)" srcset="
|
|
3
|
-
<source media="(prefers-color-scheme: light)" srcset="
|
|
4
|
-
<img alt="Nuxt UI" width="
|
|
2
|
+
<source media="(prefers-color-scheme: dark)" srcset=".github/assets/banner-dark.png">
|
|
3
|
+
<source media="(prefers-color-scheme: light)" srcset=".github/assets/banner-light.png">
|
|
4
|
+
<img alt="Nuxt UI" width="900" height="472" src=".github/assets/banner-light.png">
|
|
5
5
|
</picture>
|
|
6
6
|
|
|
7
7
|
# Nuxt UI
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defu } from 'defu';
|
|
2
2
|
import { defineNuxtModule, createResolver, addPlugin, hasNuxtModule, addComponentsDir, addImportsDir, addImports } from '@nuxt/kit';
|
|
3
|
-
import { d as defaultOptions, r as resolveColors, c as getDefaultConfig, g as getClientBundleIcons, f as publicComposables, a as addTemplates } from './shared/ui.
|
|
3
|
+
import { d as defaultOptions, r as resolveColors, c as getDefaultConfig, g as getClientBundleIcons, f as publicComposables, a as addTemplates } from './shared/ui.oNygBd3N.mjs';
|
|
4
4
|
import '../dist/runtime/utils/index.js';
|
|
5
5
|
import 'node:url';
|
|
6
6
|
import 'scule';
|
|
@@ -14,7 +14,7 @@ import 'tinyglobby';
|
|
|
14
14
|
import 'mlly';
|
|
15
15
|
|
|
16
16
|
const name = "@nuxt/ui";
|
|
17
|
-
const version = "4.11.
|
|
17
|
+
const version = "4.11.2";
|
|
18
18
|
|
|
19
19
|
const module$1 = defineNuxtModule({
|
|
20
20
|
meta: {
|
|
@@ -27,7 +27,7 @@ export interface AccordionItem {
|
|
|
27
27
|
value?: string;
|
|
28
28
|
disabled?: boolean;
|
|
29
29
|
class?: any;
|
|
30
|
-
ui?: Pick<Accordion['slots'], 'item' | 'header' | 'trigger' | 'leadingIcon' | 'label' | 'trailingIcon' | 'content' | 'body'
|
|
30
|
+
ui?: Partial<Pick<Accordion['slots'], 'item' | 'header' | 'trigger' | 'leadingIcon' | 'label' | 'trailingIcon' | 'content' | 'body'>>;
|
|
31
31
|
[key: string]: any;
|
|
32
32
|
}
|
|
33
33
|
export interface AccordionProps<T extends AccordionItem = AccordionItem> extends Pick<AccordionRootProps, 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
|
|
@@ -27,7 +27,7 @@ export interface AccordionItem {
|
|
|
27
27
|
value?: string;
|
|
28
28
|
disabled?: boolean;
|
|
29
29
|
class?: any;
|
|
30
|
-
ui?: Pick<Accordion['slots'], 'item' | 'header' | 'trigger' | 'leadingIcon' | 'label' | 'trailingIcon' | 'content' | 'body'
|
|
30
|
+
ui?: Partial<Pick<Accordion['slots'], 'item' | 'header' | 'trigger' | 'leadingIcon' | 'label' | 'trailingIcon' | 'content' | 'body'>>;
|
|
31
31
|
[key: string]: any;
|
|
32
32
|
}
|
|
33
33
|
export interface AccordionProps<T extends AccordionItem = AccordionItem> extends Pick<AccordionRootProps, 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
|
|
@@ -16,7 +16,7 @@ export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
|
|
|
16
16
|
avatar?: AvatarProps;
|
|
17
17
|
slot?: string;
|
|
18
18
|
class?: any;
|
|
19
|
-
ui?: Pick<Breadcrumb['slots'], 'item' | 'link' | 'linkLeadingIcon' | 'linkLeadingAvatar' | 'linkLabel' | 'separator' | 'separatorIcon'
|
|
19
|
+
ui?: Partial<Pick<Breadcrumb['slots'], 'item' | 'link' | 'linkLeadingIcon' | 'linkLeadingAvatar' | 'linkLabel' | 'separator' | 'separatorIcon'>>;
|
|
20
20
|
[key: string]: any;
|
|
21
21
|
}
|
|
22
22
|
export interface BreadcrumbProps<T extends BreadcrumbItem = BreadcrumbItem> {
|
|
@@ -16,7 +16,7 @@ export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
|
|
|
16
16
|
avatar?: AvatarProps;
|
|
17
17
|
slot?: string;
|
|
18
18
|
class?: any;
|
|
19
|
-
ui?: Pick<Breadcrumb['slots'], 'item' | 'link' | 'linkLeadingIcon' | 'linkLeadingAvatar' | 'linkLabel' | 'separator' | 'separatorIcon'
|
|
19
|
+
ui?: Partial<Pick<Breadcrumb['slots'], 'item' | 'link' | 'linkLeadingIcon' | 'linkLeadingAvatar' | 'linkLabel' | 'separator' | 'separatorIcon'>>;
|
|
20
20
|
[key: string]: any;
|
|
21
21
|
}
|
|
22
22
|
export interface BreadcrumbProps<T extends BreadcrumbItem = BreadcrumbItem> {
|
|
@@ -17,7 +17,7 @@ type Carousel = ComponentConfig<typeof theme, AppConfig, 'carousel'>;
|
|
|
17
17
|
export type CarouselValue = AcceptableValue;
|
|
18
18
|
export type CarouselItem = CarouselValue | {
|
|
19
19
|
class?: any;
|
|
20
|
-
ui?: Pick<Carousel['slots'], 'item'
|
|
20
|
+
ui?: Partial<Pick<Carousel['slots'], 'item'>>;
|
|
21
21
|
[key: string]: any;
|
|
22
22
|
};
|
|
23
23
|
export interface CarouselProps<T extends CarouselItem = CarouselItem> extends Omit<EmblaOptionsType, 'axis' | 'container' | 'slides' | 'direction'> {
|
|
@@ -66,32 +66,32 @@ export interface CarouselProps<T extends CarouselItem = CarouselItem> extends Om
|
|
|
66
66
|
items?: T[];
|
|
67
67
|
/**
|
|
68
68
|
* Enable Autoplay plugin
|
|
69
|
-
* @see https://www.embla-carousel.com/plugins/autoplay
|
|
69
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/autoplay
|
|
70
70
|
*/
|
|
71
71
|
autoplay?: boolean | AutoplayOptionsType;
|
|
72
72
|
/**
|
|
73
73
|
* Enable Auto Scroll plugin
|
|
74
|
-
* @see https://www.embla-carousel.com/plugins/auto-scroll
|
|
74
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/auto-scroll
|
|
75
75
|
*/
|
|
76
76
|
autoScroll?: boolean | AutoScrollOptionsType;
|
|
77
77
|
/**
|
|
78
78
|
* Enable Auto Height plugin
|
|
79
|
-
* @see https://www.embla-carousel.com/plugins/auto-height
|
|
79
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/auto-height
|
|
80
80
|
*/
|
|
81
81
|
autoHeight?: boolean | AutoHeightOptionsType;
|
|
82
82
|
/**
|
|
83
83
|
* Enable Class Names plugin
|
|
84
|
-
* @see https://www.embla-carousel.com/plugins/class-names
|
|
84
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/class-names
|
|
85
85
|
*/
|
|
86
86
|
classNames?: boolean | ClassNamesOptionsType;
|
|
87
87
|
/**
|
|
88
88
|
* Enable Fade plugin
|
|
89
|
-
* @see https://www.embla-carousel.com/plugins/fade
|
|
89
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/fade
|
|
90
90
|
*/
|
|
91
91
|
fade?: boolean | FadeOptionsType;
|
|
92
92
|
/**
|
|
93
93
|
* Enable Wheel Gestures plugin
|
|
94
|
-
* @see https://www.embla-carousel.com/plugins/wheel-gestures
|
|
94
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/wheel-gestures
|
|
95
95
|
*/
|
|
96
96
|
wheelGestures?: boolean | WheelGesturesPluginOptions;
|
|
97
97
|
class?: any;
|
|
@@ -17,7 +17,7 @@ type Carousel = ComponentConfig<typeof theme, AppConfig, 'carousel'>;
|
|
|
17
17
|
export type CarouselValue = AcceptableValue;
|
|
18
18
|
export type CarouselItem = CarouselValue | {
|
|
19
19
|
class?: any;
|
|
20
|
-
ui?: Pick<Carousel['slots'], 'item'
|
|
20
|
+
ui?: Partial<Pick<Carousel['slots'], 'item'>>;
|
|
21
21
|
[key: string]: any;
|
|
22
22
|
};
|
|
23
23
|
export interface CarouselProps<T extends CarouselItem = CarouselItem> extends Omit<EmblaOptionsType, 'axis' | 'container' | 'slides' | 'direction'> {
|
|
@@ -66,32 +66,32 @@ export interface CarouselProps<T extends CarouselItem = CarouselItem> extends Om
|
|
|
66
66
|
items?: T[];
|
|
67
67
|
/**
|
|
68
68
|
* Enable Autoplay plugin
|
|
69
|
-
* @see https://www.embla-carousel.com/plugins/autoplay
|
|
69
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/autoplay
|
|
70
70
|
*/
|
|
71
71
|
autoplay?: boolean | AutoplayOptionsType;
|
|
72
72
|
/**
|
|
73
73
|
* Enable Auto Scroll plugin
|
|
74
|
-
* @see https://www.embla-carousel.com/plugins/auto-scroll
|
|
74
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/auto-scroll
|
|
75
75
|
*/
|
|
76
76
|
autoScroll?: boolean | AutoScrollOptionsType;
|
|
77
77
|
/**
|
|
78
78
|
* Enable Auto Height plugin
|
|
79
|
-
* @see https://www.embla-carousel.com/plugins/auto-height
|
|
79
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/auto-height
|
|
80
80
|
*/
|
|
81
81
|
autoHeight?: boolean | AutoHeightOptionsType;
|
|
82
82
|
/**
|
|
83
83
|
* Enable Class Names plugin
|
|
84
|
-
* @see https://www.embla-carousel.com/plugins/class-names
|
|
84
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/class-names
|
|
85
85
|
*/
|
|
86
86
|
classNames?: boolean | ClassNamesOptionsType;
|
|
87
87
|
/**
|
|
88
88
|
* Enable Fade plugin
|
|
89
|
-
* @see https://www.embla-carousel.com/plugins/fade
|
|
89
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/fade
|
|
90
90
|
*/
|
|
91
91
|
fade?: boolean | FadeOptionsType;
|
|
92
92
|
/**
|
|
93
93
|
* Enable Wheel Gestures plugin
|
|
94
|
-
* @see https://www.embla-carousel.com/plugins/wheel-gestures
|
|
94
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/wheel-gestures
|
|
95
95
|
*/
|
|
96
96
|
wheelGestures?: boolean | WheelGesturesPluginOptions;
|
|
97
97
|
class?: any;
|
|
@@ -39,12 +39,12 @@ export interface ChatMessagesProps<T extends UIMessage[] = UIMessage[]> {
|
|
|
39
39
|
* The `user` messages props.
|
|
40
40
|
* `{ side: 'right', variant: 'soft' }`{lang="ts-type"}
|
|
41
41
|
*/
|
|
42
|
-
user?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui'>;
|
|
42
|
+
user?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui' | 'color'>;
|
|
43
43
|
/**
|
|
44
44
|
* The `assistant` messages props.
|
|
45
45
|
* `{ side: 'left', variant: 'naked' }`{lang="ts-type"}
|
|
46
46
|
*/
|
|
47
|
-
assistant?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui'>;
|
|
47
|
+
assistant?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui' | 'color'>;
|
|
48
48
|
/**
|
|
49
49
|
* Render the messages in a compact style.
|
|
50
50
|
* This is done automatically when used inside a `UChatPalette`{lang="ts-type"}.
|
|
@@ -39,12 +39,12 @@ export interface ChatMessagesProps<T extends UIMessage[] = UIMessage[]> {
|
|
|
39
39
|
* The `user` messages props.
|
|
40
40
|
* `{ side: 'right', variant: 'soft' }`{lang="ts-type"}
|
|
41
41
|
*/
|
|
42
|
-
user?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui'>;
|
|
42
|
+
user?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui' | 'color'>;
|
|
43
43
|
/**
|
|
44
44
|
* The `assistant` messages props.
|
|
45
45
|
* `{ side: 'left', variant: 'naked' }`{lang="ts-type"}
|
|
46
46
|
*/
|
|
47
|
-
assistant?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui'>;
|
|
47
|
+
assistant?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui' | 'color'>;
|
|
48
48
|
/**
|
|
49
49
|
* Render the messages in a compact style.
|
|
50
50
|
* This is done automatically when used inside a `UChatPalette`{lang="ts-type"}.
|
|
@@ -19,7 +19,7 @@ export type CheckboxGroupItem = CheckboxGroupValue | {
|
|
|
19
19
|
*/
|
|
20
20
|
icon?: IconProps['name'];
|
|
21
21
|
class?: any;
|
|
22
|
-
ui?: Pick<CheckboxGroup['slots'], 'item'
|
|
22
|
+
ui?: Partial<Pick<CheckboxGroup['slots'], 'item'>> & Omit<Required<CheckboxProps>['ui'], 'root'>;
|
|
23
23
|
[key: string]: any;
|
|
24
24
|
};
|
|
25
25
|
export interface CheckboxGroupProps<T extends CheckboxGroupItem[] = CheckboxGroupItem[], VK extends GetItemKeys<T> = 'value'> extends Pick<CheckboxGroupRootProps, 'disabled' | 'loop' | 'name' | 'required'>, Pick<CheckboxProps, 'color' | 'highlight' | 'indicator' | 'icon'> {
|
|
@@ -19,7 +19,7 @@ export type CheckboxGroupItem = CheckboxGroupValue | {
|
|
|
19
19
|
*/
|
|
20
20
|
icon?: IconProps['name'];
|
|
21
21
|
class?: any;
|
|
22
|
-
ui?: Pick<CheckboxGroup['slots'], 'item'
|
|
22
|
+
ui?: Partial<Pick<CheckboxGroup['slots'], 'item'>> & Omit<Required<CheckboxProps>['ui'], 'root'>;
|
|
23
23
|
[key: string]: any;
|
|
24
24
|
};
|
|
25
25
|
export interface CheckboxGroupProps<T extends CheckboxGroupItem[] = CheckboxGroupItem[], VK extends GetItemKeys<T> = 'value'> extends Pick<CheckboxGroupRootProps, 'disabled' | 'loop' | 'name' | 'required'>, Pick<CheckboxProps, 'color' | 'highlight' | 'indicator' | 'icon'> {
|
|
@@ -37,7 +37,7 @@ export interface CommandPaletteItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
|
|
|
37
37
|
children?: CommandPaletteItem[];
|
|
38
38
|
onSelect?: (e: Event) => void;
|
|
39
39
|
class?: any;
|
|
40
|
-
ui?: Pick<CommandPalette['slots'], 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelPrefix' | 'itemLabelBase' | 'itemLabelSuffix' | 'itemTrailing' | 'itemTrailingKbds' | 'itemTrailingKbdsSize' | 'itemTrailingHighlightedIcon' | 'itemTrailingIcon'
|
|
40
|
+
ui?: Partial<Pick<CommandPalette['slots'], 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelPrefix' | 'itemLabelBase' | 'itemLabelSuffix' | 'itemTrailing' | 'itemTrailingKbds' | 'itemTrailingKbdsSize' | 'itemTrailingHighlightedIcon' | 'itemTrailingIcon'>>;
|
|
41
41
|
[key: string]: any;
|
|
42
42
|
}
|
|
43
43
|
export interface CommandPaletteGroup<T extends CommandPaletteItem = CommandPaletteItem> {
|
|
@@ -37,7 +37,7 @@ export interface CommandPaletteItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
|
|
|
37
37
|
children?: CommandPaletteItem[];
|
|
38
38
|
onSelect?: (e: Event) => void;
|
|
39
39
|
class?: any;
|
|
40
|
-
ui?: Pick<CommandPalette['slots'], 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelPrefix' | 'itemLabelBase' | 'itemLabelSuffix' | 'itemTrailing' | 'itemTrailingKbds' | 'itemTrailingKbdsSize' | 'itemTrailingHighlightedIcon' | 'itemTrailingIcon'
|
|
40
|
+
ui?: Partial<Pick<CommandPalette['slots'], 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelPrefix' | 'itemLabelBase' | 'itemLabelSuffix' | 'itemTrailing' | 'itemTrailingKbds' | 'itemTrailingKbdsSize' | 'itemTrailingHighlightedIcon' | 'itemTrailingIcon'>>;
|
|
41
41
|
[key: string]: any;
|
|
42
42
|
}
|
|
43
43
|
export interface CommandPaletteGroup<T extends CommandPaletteItem = CommandPaletteItem> {
|
|
@@ -37,7 +37,7 @@ export interface ContextMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custo
|
|
|
37
37
|
onSelect?: (e: Event) => void;
|
|
38
38
|
onUpdateChecked?: (checked: boolean) => void;
|
|
39
39
|
class?: any;
|
|
40
|
-
ui?: Pick<ContextMenu['slots'], 'content' | 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'
|
|
40
|
+
ui?: Partial<Pick<ContextMenu['slots'], 'content' | 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'>>;
|
|
41
41
|
[key: string]: any;
|
|
42
42
|
}
|
|
43
43
|
export interface ContextMenuProps<T extends ArrayOrNested<ContextMenuItem> = ArrayOrNested<ContextMenuItem>> extends Omit<ContextMenuRootProps, 'dir'> {
|
|
@@ -37,7 +37,7 @@ export interface ContextMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custo
|
|
|
37
37
|
onSelect?: (e: Event) => void;
|
|
38
38
|
onUpdateChecked?: (checked: boolean) => void;
|
|
39
39
|
class?: any;
|
|
40
|
-
ui?: Pick<ContextMenu['slots'], 'content' | 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'
|
|
40
|
+
ui?: Partial<Pick<ContextMenu['slots'], 'content' | 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'>>;
|
|
41
41
|
[key: string]: any;
|
|
42
42
|
}
|
|
43
43
|
export interface ContextMenuProps<T extends ArrayOrNested<ContextMenuItem> = ArrayOrNested<ContextMenuItem>> extends Omit<ContextMenuRootProps, 'dir'> {
|
|
@@ -52,7 +52,7 @@ const ui = computed(() => tv({ extend: theme, ...appConfig.ui?.dashboardNavbar |
|
|
|
52
52
|
<UIcon v-if="props.icon" :name="props.icon" data-slot="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
|
53
53
|
</slot>
|
|
54
54
|
|
|
55
|
-
<h1 data-slot="title" :class="ui.title({ class: props.ui?.title })">
|
|
55
|
+
<h1 v-if="props.title || !!slots.title" data-slot="title" :class="ui.title({ class: props.ui?.title })">
|
|
56
56
|
<slot name="title">
|
|
57
57
|
{{ props.title }}
|
|
58
58
|
</slot>
|
|
@@ -41,7 +41,7 @@ export interface DropdownMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cust
|
|
|
41
41
|
onSelect?: (e: Event) => void;
|
|
42
42
|
onUpdateChecked?: (checked: boolean) => void;
|
|
43
43
|
class?: any;
|
|
44
|
-
ui?: Pick<DropdownMenu['slots'], 'content' | 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'
|
|
44
|
+
ui?: Partial<Pick<DropdownMenu['slots'], 'content' | 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'>>;
|
|
45
45
|
[key: string]: any;
|
|
46
46
|
}
|
|
47
47
|
export interface DropdownMenuProps<T extends ArrayOrNested<DropdownMenuItem> = ArrayOrNested<DropdownMenuItem>> extends Omit<DropdownMenuRootProps, 'dir'> {
|
|
@@ -41,7 +41,7 @@ export interface DropdownMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cust
|
|
|
41
41
|
onSelect?: (e: Event) => void;
|
|
42
42
|
onUpdateChecked?: (checked: boolean) => void;
|
|
43
43
|
class?: any;
|
|
44
|
-
ui?: Pick<DropdownMenu['slots'], 'content' | 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'
|
|
44
|
+
ui?: Partial<Pick<DropdownMenu['slots'], 'content' | 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'>>;
|
|
45
45
|
[key: string]: any;
|
|
46
46
|
}
|
|
47
47
|
export interface DropdownMenuProps<T extends ArrayOrNested<DropdownMenuItem> = ArrayOrNested<DropdownMenuItem>> extends Omit<DropdownMenuRootProps, 'dir'> {
|
|
@@ -12,7 +12,7 @@ export interface FooterColumnLink extends Omit<LinkProps, 'custom'> {
|
|
|
12
12
|
*/
|
|
13
13
|
icon?: IconProps['name'];
|
|
14
14
|
class?: any;
|
|
15
|
-
ui?: Pick<FooterColumns['slots'], 'item' | 'link' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkLeadingIcon'
|
|
15
|
+
ui?: Partial<Pick<FooterColumns['slots'], 'item' | 'link' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkLeadingIcon'>>;
|
|
16
16
|
}
|
|
17
17
|
export interface FooterColumn<T extends FooterColumnLink = FooterColumnLink> {
|
|
18
18
|
label: string;
|
|
@@ -12,7 +12,7 @@ export interface FooterColumnLink extends Omit<LinkProps, 'custom'> {
|
|
|
12
12
|
*/
|
|
13
13
|
icon?: IconProps['name'];
|
|
14
14
|
class?: any;
|
|
15
|
-
ui?: Pick<FooterColumns['slots'], 'item' | 'link' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkLeadingIcon'
|
|
15
|
+
ui?: Partial<Pick<FooterColumns['slots'], 'item' | 'link' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkLeadingIcon'>>;
|
|
16
16
|
}
|
|
17
17
|
export interface FooterColumn<T extends FooterColumnLink = FooterColumnLink> {
|
|
18
18
|
label: string;
|
|
@@ -273,7 +273,7 @@ const api = {
|
|
|
273
273
|
) : [];
|
|
274
274
|
const nestedErrors = [];
|
|
275
275
|
for (const form of nestedForms.value.values()) {
|
|
276
|
-
if (matchesTarget(name, form.name)) form.api.clear();
|
|
276
|
+
if (matchesTarget(name, form.name)) form.api.clear(name instanceof RegExp ? void 0 : getNestedTarget(name, form.name || ""));
|
|
277
277
|
nestedErrors.push(...getFormErrors(form));
|
|
278
278
|
}
|
|
279
279
|
errors.value = [...localErrors, ...nestedErrors];
|
|
@@ -294,7 +294,7 @@ defineExpose(api);
|
|
|
294
294
|
:id="formId"
|
|
295
295
|
ref="formRef"
|
|
296
296
|
:name="parentBus ? void 0 : props.name"
|
|
297
|
-
method="post"
|
|
297
|
+
:method="parentBus ? void 0 : 'post'"
|
|
298
298
|
:class="ui({ class: [props.ui?.base, props.class] })"
|
|
299
299
|
@submit.prevent="onSubmitWrapper"
|
|
300
300
|
>
|
|
@@ -11,7 +11,7 @@ import { useComponentProps } from "../composables/useComponentProps";
|
|
|
11
11
|
import { useFieldGroup } from "../composables/useFieldGroup";
|
|
12
12
|
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
13
13
|
import { useFormField } from "../composables/useFormField";
|
|
14
|
-
import { looseToNumber } from "../utils";
|
|
14
|
+
import { isEmpty, looseToNumber } from "../utils";
|
|
15
15
|
import { tv } from "../utils/tv";
|
|
16
16
|
import UIcon from "./Icon.vue";
|
|
17
17
|
import UAvatar from "./Avatar.vue";
|
|
@@ -78,11 +78,11 @@ function updateInput(value) {
|
|
|
78
78
|
if (props.modelModifiers?.number || props.type === "number") {
|
|
79
79
|
value = looseToNumber(value);
|
|
80
80
|
}
|
|
81
|
-
if (props.modelModifiers?.nullable) {
|
|
82
|
-
value
|
|
81
|
+
if (props.modelModifiers?.nullable && isEmpty(value)) {
|
|
82
|
+
value = null;
|
|
83
83
|
}
|
|
84
|
-
if (props.modelModifiers?.optional && !props.modelModifiers?.nullable && value !== null) {
|
|
85
|
-
value
|
|
84
|
+
if (props.modelModifiers?.optional && !props.modelModifiers?.nullable && value !== null && isEmpty(value)) {
|
|
85
|
+
value = void 0;
|
|
86
86
|
}
|
|
87
87
|
modelValue.value = value;
|
|
88
88
|
emitFormInput();
|
|
@@ -90,13 +90,19 @@ function onUpdate(value) {
|
|
|
90
90
|
emitFormChange();
|
|
91
91
|
emitFormInput();
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
93
|
+
function onFocusOut(event) {
|
|
94
|
+
if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
95
97
|
emits("blur", event);
|
|
98
|
+
emitFormBlur();
|
|
96
99
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
100
|
+
function onFocusIn(event) {
|
|
101
|
+
if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
99
104
|
emits("focus", event);
|
|
105
|
+
emitFormFocus();
|
|
100
106
|
}
|
|
101
107
|
function autoFocus() {
|
|
102
108
|
if (props.autofocus) {
|
|
@@ -143,8 +149,8 @@ defineExpose({
|
|
|
143
149
|
:disabled="disabled"
|
|
144
150
|
:class="ui.base({ class: [props.ui?.base, props.class] })"
|
|
145
151
|
@update:model-value="onUpdate"
|
|
146
|
-
@
|
|
147
|
-
@
|
|
152
|
+
@focusout="onFocusOut"
|
|
153
|
+
@focusin="onFocusIn"
|
|
148
154
|
>
|
|
149
155
|
<template v-if="Array.isArray(segments)">
|
|
150
156
|
<ReuseSegmentsTemplate :segments="segments" />
|
|
@@ -31,7 +31,7 @@ export type InputMenuItem = InputMenuValue | {
|
|
|
31
31
|
disabled?: boolean;
|
|
32
32
|
onSelect?: (e: Event) => void;
|
|
33
33
|
class?: any;
|
|
34
|
-
ui?: Pick<InputMenu['slots'], 'tagsItem' | 'tagsItemText' | 'tagsItemDelete' | 'tagsItemDeleteIcon' | 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'
|
|
34
|
+
ui?: Partial<Pick<InputMenu['slots'], 'tagsItem' | 'tagsItemText' | 'tagsItemDelete' | 'tagsItemDeleteIcon' | 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'>>;
|
|
35
35
|
[key: string]: any;
|
|
36
36
|
};
|
|
37
37
|
type ExcludeItem = {
|
|
@@ -89,12 +89,13 @@ const { t } = useLocale();
|
|
|
89
89
|
const appConfig = useAppConfig();
|
|
90
90
|
const { filterGroups } = useFilter();
|
|
91
91
|
const isAutocomplete = computed(() => props.mode === "autocomplete");
|
|
92
|
+
const isMultiple = computed(() => !!props.multiple && !isAutocomplete.value);
|
|
92
93
|
const rootPropsPick = reactivePick(props, "as", "modelValue", "defaultValue", "open", "defaultOpen", "required", "multiple", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "resetModelValueOnClear", "highlightOnHover", "openOnClick", "openOnFocus", "by");
|
|
93
94
|
const rootPropsOmitted = reactiveOmit(rootPropsPick, "multiple", "resetSearchTermOnSelect", "resetModelValueOnClear", "by");
|
|
94
95
|
const rootProps = useForwardProps(computed(() => isAutocomplete.value ? rootPropsOmitted : rootPropsPick), emits);
|
|
95
96
|
const Component = computed(() => isAutocomplete.value ? Autocomplete : Combobox);
|
|
96
97
|
const attrs = useAttrs();
|
|
97
|
-
const baseDataSlot = computed(() =>
|
|
98
|
+
const baseDataSlot = computed(() => isMultiple.value ? attrs["data-slot"] ?? "base" : "base");
|
|
98
99
|
const portalProps = usePortal(toRef(() => props.portal));
|
|
99
100
|
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
|
|
100
101
|
const arrowProps = toRef(() => defu(props.arrow, { rounded: true }));
|
|
@@ -142,7 +143,7 @@ const ui = computed(() => tv({ extend: theme, ...appConfig.ui?.inputMenu || {} }
|
|
|
142
143
|
fixed: props.fixed,
|
|
143
144
|
leading: isLeading.value || !!props.avatar || !!slots.leading,
|
|
144
145
|
trailing: isTrailing.value || !!slots.trailing,
|
|
145
|
-
multiple:
|
|
146
|
+
multiple: isMultiple.value,
|
|
146
147
|
fieldGroup: orientation.value,
|
|
147
148
|
virtualize: !!props.virtualize
|
|
148
149
|
}));
|
|
@@ -298,8 +299,17 @@ function isModelValueEmpty(modelValue) {
|
|
|
298
299
|
return modelValue === void 0 || modelValue === null || modelValue === "";
|
|
299
300
|
}
|
|
300
301
|
function onClear() {
|
|
302
|
+
if (disabled.value) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
301
305
|
emits("clear");
|
|
302
306
|
}
|
|
307
|
+
function onTagsInputKeydown(event) {
|
|
308
|
+
if (event.isComposing || !searchTerm.value) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
event.preventDefault();
|
|
312
|
+
}
|
|
303
313
|
const viewportRef = useTemplateRef("viewportRef");
|
|
304
314
|
const comboboxRootRef = useTemplateRef("comboboxRootRef");
|
|
305
315
|
watch(() => props.items, async () => {
|
|
@@ -394,14 +404,14 @@ defineExpose({
|
|
|
394
404
|
:disabled="disabled"
|
|
395
405
|
:data-slot="$attrs['data-slot'] ?? 'root'"
|
|
396
406
|
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
397
|
-
:as-child="
|
|
407
|
+
:as-child="isMultiple"
|
|
398
408
|
ignore-filter
|
|
399
409
|
@update:model-value="onUpdate"
|
|
400
410
|
@update:open="onUpdateOpen"
|
|
401
411
|
>
|
|
402
|
-
<Component.Anchor :as-child="!
|
|
412
|
+
<Component.Anchor :as-child="!isMultiple" :data-slot="baseDataSlot" :class="ui.base({ class: props.ui?.base })">
|
|
403
413
|
<TagsInputRoot
|
|
404
|
-
v-if="
|
|
414
|
+
v-if="isMultiple"
|
|
405
415
|
v-slot="{ modelValue: tags }"
|
|
406
416
|
:model-value="modelValue"
|
|
407
417
|
:disabled="disabled"
|
|
@@ -435,6 +445,7 @@ defineExpose({
|
|
|
435
445
|
data-slot="tagsInput"
|
|
436
446
|
:class="ui.tagsInput({ class: props.ui?.tagsInput })"
|
|
437
447
|
@change.stop
|
|
448
|
+
@keydown.enter="onTagsInputKeydown"
|
|
438
449
|
/>
|
|
439
450
|
</Component.Input>
|
|
440
451
|
</TagsInputRoot>
|
|
@@ -444,7 +455,7 @@ defineExpose({
|
|
|
444
455
|
:id="id"
|
|
445
456
|
ref="inputRef"
|
|
446
457
|
v-bind="{ ...!isAutocomplete ? { displayValue } : {}, ...$attrs, ...ariaAttrs }"
|
|
447
|
-
|
|
458
|
+
data-slot="base"
|
|
448
459
|
:type="props.type"
|
|
449
460
|
:placeholder="props.placeholder"
|
|
450
461
|
:required="props.required"
|
|
@@ -463,7 +474,7 @@ defineExpose({
|
|
|
463
474
|
|
|
464
475
|
<Component.Trigger v-if="isTrailing || !!slots.trailing || !!props.clear" data-slot="trailing" :class="ui.trailing({ class: props.ui?.trailing })">
|
|
465
476
|
<slot name="trailing" :model-value="modelValue" :open="open" :ui="ui">
|
|
466
|
-
<Component.Cancel v-if="!!props.clear && !isModelValueEmpty(modelValue)" as-child>
|
|
477
|
+
<Component.Cancel v-if="!!props.clear && !disabled && !isModelValueEmpty(modelValue)" as-child>
|
|
467
478
|
<UButton
|
|
468
479
|
as="span"
|
|
469
480
|
:icon="props.clearIcon || appConfig.ui.icons.close"
|
|
@@ -31,7 +31,7 @@ export type InputMenuItem = InputMenuValue | {
|
|
|
31
31
|
disabled?: boolean;
|
|
32
32
|
onSelect?: (e: Event) => void;
|
|
33
33
|
class?: any;
|
|
34
|
-
ui?: Pick<InputMenu['slots'], 'tagsItem' | 'tagsItemText' | 'tagsItemDelete' | 'tagsItemDeleteIcon' | 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'
|
|
34
|
+
ui?: Partial<Pick<InputMenu['slots'], 'tagsItem' | 'tagsItemText' | 'tagsItemDelete' | 'tagsItemDeleteIcon' | 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'>>;
|
|
35
35
|
[key: string]: any;
|
|
36
36
|
};
|
|
37
37
|
type ExcludeItem = {
|
|
@@ -6,7 +6,7 @@ import theme from "#build/ui/input-number";
|
|
|
6
6
|
import { onMounted, onScopeDispose, computed, useTemplateRef, toRef } from "vue";
|
|
7
7
|
import { NumberFieldRoot, NumberFieldInput, NumberFieldDecrement, NumberFieldIncrement } from "reka-ui";
|
|
8
8
|
import { useForwardProps } from "../composables/useForwardProps";
|
|
9
|
-
import { reactivePick
|
|
9
|
+
import { reactivePick } from "@vueuse/core";
|
|
10
10
|
import { useAppConfig } from "#imports";
|
|
11
11
|
import { useComponentProps } from "../composables/useComponentProps";
|
|
12
12
|
import { useFieldGroup } from "../composables/useFieldGroup";
|
|
@@ -55,10 +55,9 @@ const _props = defineProps({
|
|
|
55
55
|
const emits = defineEmits(["update:modelValue", "blur", "change"]);
|
|
56
56
|
defineSlots();
|
|
57
57
|
const props = useComponentProps("inputNumber", _props);
|
|
58
|
-
const modelValue = useVModel(props, "modelValue", emits, { defaultValue: props.defaultValue });
|
|
59
58
|
const { t } = useLocale();
|
|
60
59
|
const appConfig = useAppConfig();
|
|
61
|
-
const rootProps = useForwardProps(reactivePick(props, "as", "stepSnapping", "formatOptions", "disableWheelChange", "invertWheelChange", "required", "readonly", "focusOnChange", "locale")
|
|
60
|
+
const rootProps = useForwardProps(reactivePick(props, "as", "stepSnapping", "formatOptions", "disableWheelChange", "invertWheelChange", "required", "readonly", "focusOnChange", "locale"));
|
|
62
61
|
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color: formFieldColor, size: formFieldSize, name, highlight: formFieldHighlight, disabled: formFieldDisabled, ariaAttrs } = useFormField(_props);
|
|
63
62
|
const { orientation, size: fieldGroupSize } = useFieldGroup(_props);
|
|
64
63
|
const color = computed(() => formFieldColor.value ?? props.color);
|
|
@@ -81,8 +80,12 @@ const decrementIcon = computed(() => props.decrementIcon || (props.orientation =
|
|
|
81
80
|
const inputRef = useTemplateRef("inputRef");
|
|
82
81
|
function onUpdate(value) {
|
|
83
82
|
if (props.modelModifiers?.optional) {
|
|
84
|
-
|
|
83
|
+
value = value ?? void 0;
|
|
85
84
|
}
|
|
85
|
+
if (value === props.modelValue || value == null && props.modelValue == null) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
emits("update:modelValue", value);
|
|
86
89
|
const event = new Event("change", { target: { value } });
|
|
87
90
|
emits("change", event);
|
|
88
91
|
emitFormChange();
|
|
@@ -114,7 +117,7 @@ defineExpose({
|
|
|
114
117
|
v-bind="rootProps"
|
|
115
118
|
:id="id"
|
|
116
119
|
:default-value="props.defaultValue"
|
|
117
|
-
:model-value="modelValue"
|
|
120
|
+
:model-value="props.modelValue"
|
|
118
121
|
:min="props.min"
|
|
119
122
|
:max="props.max"
|
|
120
123
|
:step="props.step"
|
|
@@ -93,13 +93,19 @@ function onUpdate(value) {
|
|
|
93
93
|
emitFormChange();
|
|
94
94
|
emitFormInput();
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
|
|
96
|
+
function onFocusOut(event) {
|
|
97
|
+
if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
98
100
|
emits("blur", event);
|
|
101
|
+
emitFormBlur();
|
|
99
102
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
103
|
+
function onFocusIn(event) {
|
|
104
|
+
if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
102
107
|
emits("focus", event);
|
|
108
|
+
emitFormFocus();
|
|
103
109
|
}
|
|
104
110
|
function autoFocus() {
|
|
105
111
|
if (props.autofocus) {
|
|
@@ -145,8 +151,8 @@ defineExpose({
|
|
|
145
151
|
:default-value="props.defaultValue"
|
|
146
152
|
:class="ui.base({ class: [props.ui?.base, props.class] })"
|
|
147
153
|
@update:model-value="onUpdate"
|
|
148
|
-
@
|
|
149
|
-
@
|
|
154
|
+
@focusout="onFocusOut"
|
|
155
|
+
@focusin="onFocusIn"
|
|
150
156
|
>
|
|
151
157
|
<template v-if="Array.isArray(segments)">
|
|
152
158
|
<ReuseSegmentsTemplate :segments="segments" />
|