@nuxt/ui 4.10.0 → 4.11.0

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.
Files changed (97) hide show
  1. package/.nuxt/ui.static.css +11 -11
  2. package/README.md +1 -0
  3. package/cli/commands/make/locale.mjs +40 -11
  4. package/cli/templates.mjs +2 -2
  5. package/dist/module.d.mts +1 -1
  6. package/dist/module.json +2 -2
  7. package/dist/module.mjs +5 -2
  8. package/dist/runtime/components/AuthForm.d.vue.ts +7 -7
  9. package/dist/runtime/components/AuthForm.vue.d.ts +7 -7
  10. package/dist/runtime/components/Button.vue +11 -2
  11. package/dist/runtime/components/ChatPromptSubmit.d.vue.ts +2 -2
  12. package/dist/runtime/components/ChatPromptSubmit.vue.d.ts +2 -2
  13. package/dist/runtime/components/Checkbox.d.vue.ts +1 -1
  14. package/dist/runtime/components/Checkbox.vue +12 -6
  15. package/dist/runtime/components/Checkbox.vue.d.ts +1 -1
  16. package/dist/runtime/components/CheckboxGroup.d.vue.ts +6 -0
  17. package/dist/runtime/components/CheckboxGroup.vue +10 -4
  18. package/dist/runtime/components/CheckboxGroup.vue.d.ts +6 -0
  19. package/dist/runtime/components/Editor.vue +4 -1
  20. package/dist/runtime/components/Error.d.vue.ts +1 -1
  21. package/dist/runtime/components/Error.vue.d.ts +1 -1
  22. package/dist/runtime/components/FileUpload.vue +17 -10
  23. package/dist/runtime/components/Input.vue +12 -7
  24. package/dist/runtime/components/InputDate.vue +12 -8
  25. package/dist/runtime/components/InputMenu.vue +25 -11
  26. package/dist/runtime/components/InputNumber.vue +14 -9
  27. package/dist/runtime/components/InputRating.vue +10 -7
  28. package/dist/runtime/components/InputTags.vue +12 -7
  29. package/dist/runtime/components/InputTime.vue +12 -7
  30. package/dist/runtime/components/Listbox.vue +10 -6
  31. package/dist/runtime/components/Modal.vue +12 -5
  32. package/dist/runtime/components/PinInput.vue +13 -8
  33. package/dist/runtime/components/Popover.vue +0 -1
  34. package/dist/runtime/components/PricingTable.d.vue.ts +1 -1
  35. package/dist/runtime/components/PricingTable.vue.d.ts +1 -1
  36. package/dist/runtime/components/Progress.d.vue.ts +2 -1
  37. package/dist/runtime/components/Progress.vue +5 -6
  38. package/dist/runtime/components/Progress.vue.d.ts +2 -1
  39. package/dist/runtime/components/ProgressGroup.d.vue.ts +91 -0
  40. package/dist/runtime/components/ProgressGroup.vue +99 -0
  41. package/dist/runtime/components/ProgressGroup.vue.d.ts +91 -0
  42. package/dist/runtime/components/RadioGroup.d.vue.ts +7 -1
  43. package/dist/runtime/components/RadioGroup.vue +14 -5
  44. package/dist/runtime/components/RadioGroup.vue.d.ts +7 -1
  45. package/dist/runtime/components/Select.vue +21 -8
  46. package/dist/runtime/components/SelectMenu.vue +26 -12
  47. package/dist/runtime/components/Slider.vue +14 -7
  48. package/dist/runtime/components/Splitter.d.vue.ts +266 -0
  49. package/dist/runtime/components/Splitter.vue +99 -0
  50. package/dist/runtime/components/Splitter.vue.d.ts +266 -0
  51. package/dist/runtime/components/Switch.vue +8 -4
  52. package/dist/runtime/components/Textarea.vue +17 -7
  53. package/dist/runtime/components/Theme.d.vue.ts +1 -1
  54. package/dist/runtime/components/Theme.vue +4 -3
  55. package/dist/runtime/components/Theme.vue.d.ts +1 -1
  56. package/dist/runtime/components/Tree.vue +1 -1
  57. package/dist/runtime/components/content/ContentNavigation.vue +8 -1
  58. package/dist/runtime/components/content/ContentToc.vue +4 -1
  59. package/dist/runtime/composables/useComponentProps.d.ts +1 -1
  60. package/dist/runtime/composables/useComponentProps.js +6 -0
  61. package/dist/runtime/composables/useFormField.d.ts +10 -4
  62. package/dist/runtime/composables/useFormField.js +10 -3
  63. package/dist/runtime/keyframes.css +1 -1
  64. package/dist/runtime/locale/da.js +1 -1
  65. package/dist/runtime/locale/de_at.js +7 -0
  66. package/dist/runtime/locale/de_ch.js +1 -1
  67. package/dist/runtime/locale/eu.js +1 -1
  68. package/dist/runtime/locale/fi.js +1 -1
  69. package/dist/runtime/locale/he.js +1 -1
  70. package/dist/runtime/locale/hi.js +1 -1
  71. package/dist/runtime/locale/index.d.ts +2 -1
  72. package/dist/runtime/locale/index.js +2 -1
  73. package/dist/runtime/locale/is.js +1 -1
  74. package/dist/runtime/locale/lb.js +1 -1
  75. package/dist/runtime/locale/tg.d.ts +3 -0
  76. package/dist/runtime/locale/{tj.js → tg.js} +1 -1
  77. package/dist/runtime/locale/ur.js +1 -1
  78. package/dist/runtime/types/form.d.ts +1 -1
  79. package/dist/runtime/types/html.d.ts +3 -1
  80. package/dist/runtime/types/index.d.ts +2 -0
  81. package/dist/runtime/types/index.js +2 -0
  82. package/dist/runtime/types/theme.d.ts +2 -0
  83. package/dist/runtime/types/tv.d.ts +6 -2
  84. package/dist/runtime/utils/link-keys.d.ts +1 -0
  85. package/dist/runtime/utils/link-keys.js +40 -0
  86. package/dist/runtime/utils/link.d.ts +2 -1
  87. package/dist/runtime/utils/link.js +2 -40
  88. package/dist/runtime/utils/search.js +3 -12
  89. package/dist/runtime/utils/tv.d.ts +1 -1
  90. package/dist/runtime/utils/tv.js +103 -25
  91. package/dist/runtime/vue/components/Icon.vue +5 -2
  92. package/dist/shared/{ui.XkBrgXFP.mjs → ui.DNq7CNkE.mjs} +589 -213
  93. package/dist/unplugin.d.mts +1 -1
  94. package/dist/unplugin.mjs +22 -6
  95. package/dist/vite.mjs +4 -4
  96. package/package.json +51 -50
  97. /package/dist/runtime/locale/{tj.d.ts → de_at.d.ts} +0 -0
@@ -0,0 +1,91 @@
1
+ import type { VNode } from 'vue';
2
+ import type { AppConfig } from '@nuxt/schema';
3
+ import theme from '#build/ui/progress-group';
4
+ import type { IconProps } from './Icon.vue';
5
+ import type { DynamicSlots } from '../types/utils';
6
+ import type { ComponentConfig } from '../types/tv';
7
+ type ProgressGroup = ComponentConfig<typeof theme, AppConfig, 'progressGroup'>;
8
+ export interface ProgressGroupItem {
9
+ label?: string;
10
+ /**
11
+ * @IconifyIcon
12
+ */
13
+ icon?: IconProps['name'];
14
+ /** The part of `max` this segment takes up. */
15
+ value?: number;
16
+ /**
17
+ * Any theme color, or any CSS color value for palettes outside the theme.
18
+ * @defaultValue 'primary'
19
+ */
20
+ color?: ProgressGroup['variants']['color'] | (string & {});
21
+ slot?: string;
22
+ class?: any;
23
+ ui?: Pick<ProgressGroup['slots'], 'segment' | 'indicator' | 'item' | 'itemLeadingIcon' | 'itemLeadingDot' | 'itemLabel' | 'itemTrailing'>;
24
+ [key: string]: any;
25
+ }
26
+ export interface ProgressGroupProps<T extends ProgressGroupItem = ProgressGroupItem> {
27
+ /**
28
+ * The element or component this component should render as.
29
+ * @defaultValue 'div'
30
+ */
31
+ as?: any;
32
+ items?: T[];
33
+ /**
34
+ * The value all items add up to, used to compute each segment's share of the track.
35
+ * @defaultValue 100
36
+ */
37
+ max?: number;
38
+ /** Display the summed progress value. */
39
+ status?: boolean;
40
+ /**
41
+ * @defaultValue 'md'
42
+ */
43
+ size?: ProgressGroup['variants']['size'];
44
+ /**
45
+ * Any theme color, or any CSS color value for palettes outside the theme.
46
+ * @defaultValue 'primary'
47
+ */
48
+ color?: ProgressGroup['variants']['color'] | (string & {});
49
+ /**
50
+ * The orientation of the progress bar.
51
+ * @defaultValue 'horizontal'
52
+ */
53
+ orientation?: ProgressGroup['variants']['orientation'];
54
+ class?: any;
55
+ ui?: ProgressGroup['slots'];
56
+ }
57
+ type SlotProps<T extends ProgressGroupItem> = (props: {
58
+ item: T;
59
+ index: number;
60
+ percent: number;
61
+ }) => VNode[];
62
+ export type ProgressGroupSlots<T extends ProgressGroupItem = ProgressGroupItem> = {
63
+ 'status'?: (props: {
64
+ percent: number;
65
+ }) => VNode[];
66
+ 'item'?: SlotProps<T>;
67
+ 'item-leading'?: SlotProps<T>;
68
+ 'item-label'?: SlotProps<T>;
69
+ 'item-trailing'?: SlotProps<T>;
70
+ } & DynamicSlots<T, 'leading' | 'label' | 'trailing', {
71
+ index: number;
72
+ percent: number;
73
+ }>;
74
+ declare const _default: typeof __VLS_export;
75
+ export default _default;
76
+ declare const __VLS_export: <T extends ProgressGroupItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
77
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<ProgressGroupProps<T>> & (typeof globalThis extends {
78
+ __VLS_PROPS_FALLBACK: infer P;
79
+ } ? P : {});
80
+ expose: (exposed: {}) => void;
81
+ attrs: any;
82
+ slots: ProgressGroupSlots<T>;
83
+ emit: {};
84
+ }>) => import("vue").VNode & {
85
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
86
+ };
87
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
88
+ [K in keyof T]: T[K];
89
+ } : {
90
+ [K in keyof T as K]: T[K];
91
+ }) & {};
@@ -0,0 +1,99 @@
1
+ <script>
2
+ import theme from "#build/ui/progress-group";
3
+ </script>
4
+
5
+ <script setup>
6
+ import { computed } from "vue";
7
+ import { Primitive, ProgressRoot, ProgressIndicator } from "reka-ui";
8
+ import { useAppConfig } from "#imports";
9
+ import { useComponentProps } from "../composables/useComponentProps";
10
+ import { tv } from "../utils/tv";
11
+ import UIcon from "./Icon.vue";
12
+ const _props = defineProps({
13
+ as: { type: null, required: false },
14
+ items: { type: Array, required: false },
15
+ max: { type: Number, required: false, default: 100 },
16
+ status: { type: Boolean, required: false },
17
+ size: { type: null, required: false },
18
+ color: { type: null, required: false },
19
+ orientation: { type: null, required: false, default: "horizontal" },
20
+ class: { type: null, required: false },
21
+ ui: { type: Object, required: false }
22
+ });
23
+ const slots = defineSlots();
24
+ const props = useComponentProps("progressGroup", _props);
25
+ const appConfig = useAppConfig();
26
+ const ui = computed(() => tv({ extend: theme, ...appConfig.ui?.progressGroup || {} })({
27
+ size: props.size,
28
+ color: props.color,
29
+ orientation: props.orientation
30
+ }));
31
+ const max = computed(() => {
32
+ const value = Number(props.max);
33
+ return Number.isFinite(value) && value > 0 ? value : 100;
34
+ });
35
+ const values = computed(() => (props.items ?? []).map((item) => Math.min(Math.max(Number(item.value) || 0, 0), max.value)));
36
+ const percents = computed(() => values.value.map((value) => value / max.value * 100));
37
+ const percent = computed(() => Math.min(100, Math.round(percents.value.reduce((total, value) => total + value, 0))));
38
+ const statusStyle = computed(() => ({ "--percent": `${percent.value}%` }));
39
+ const themeColors = computed(() => Object.keys({ ...theme.variants?.color, ...appConfig.ui?.progressGroup?.variants?.color }));
40
+ const itemColors = computed(() => (props.items ?? []).map((item) => item.color || props.color));
41
+ const customColors = computed(() => itemColors.value.map((color) => color && !themeColors.value.includes(color) ? color : void 0));
42
+ const hasList = computed(() => !!props.items?.length && (props.items.some((item) => item.label || item.icon || item.slot) || !!slots.item || !!slots["item-leading"] || !!slots["item-label"] || !!slots["item-trailing"]));
43
+ function segmentStyle(index) {
44
+ const value = `${percents.value[index] ?? 0}%`;
45
+ return props.orientation === "vertical" ? { height: value } : { width: value };
46
+ }
47
+ const valueLabels = computed(() => (props.items ?? []).map((item) => {
48
+ const label = item.label;
49
+ return label ? () => label : void 0;
50
+ }));
51
+ </script>
52
+
53
+ <template>
54
+ <Primitive :as="props.as" :data-orientation="props.orientation" data-slot="root" :class="ui.root({ class: [props.ui?.root, props.class] })">
55
+ <div v-if="props.status || !!slots.status" data-slot="status" :class="ui.status({ class: props.ui?.status })" :style="statusStyle">
56
+ <slot name="status" :percent="percent">
57
+ {{ percent }}%
58
+ </slot>
59
+ </div>
60
+
61
+ <div data-slot="base" :class="ui.base({ class: props.ui?.base })">
62
+ <ProgressRoot
63
+ v-for="(item, index) in props.items"
64
+ :key="index"
65
+ :model-value="values[index]"
66
+ :max="max"
67
+ :get-value-label="valueLabels[index]"
68
+ data-slot="segment"
69
+ :class="ui.segment({ class: [props.ui?.segment, item.ui?.segment] })"
70
+ :style="segmentStyle(index)"
71
+ >
72
+ <ProgressIndicator data-slot="indicator" :class="ui.indicator({ color: itemColors[index], class: [props.ui?.indicator, item.ui?.indicator] })" :style="customColors[index] ? { backgroundColor: customColors[index] } : void 0" />
73
+ </ProgressRoot>
74
+ </div>
75
+
76
+ <ul v-if="hasList" data-slot="list" :class="ui.list({ class: props.ui?.list })">
77
+ <li v-for="(item, index) in props.items" :key="index" data-slot="item" :class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class] })">
78
+ <slot :name="item.slot || 'item'" :item="item" :index="index" :percent="percents[index] ?? 0">
79
+ <slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :index="index" :percent="percents[index] ?? 0">
80
+ <UIcon v-if="item.icon" :name="item.icon" data-slot="itemLeadingIcon" :class="ui.itemLeadingIcon({ color: itemColors[index], class: [props.ui?.itemLeadingIcon, item.ui?.itemLeadingIcon] })" :style="customColors[index] ? { color: customColors[index] } : void 0" />
81
+ <span v-else data-slot="itemLeadingDot" :class="ui.itemLeadingDot({ color: itemColors[index], class: [props.ui?.itemLeadingDot, item.ui?.itemLeadingDot] })" :style="customColors[index] ? { backgroundColor: customColors[index] } : void 0" />
82
+ </slot>
83
+
84
+ <span v-if="item.label || !!slots[item.slot ? `${item.slot}-label` : 'item-label']" data-slot="itemLabel" :class="ui.itemLabel({ class: [props.ui?.itemLabel, item.ui?.itemLabel] })">
85
+ <slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="item" :index="index" :percent="percents[index] ?? 0">
86
+ {{ item.label }}
87
+ </slot>
88
+ </span>
89
+
90
+ <span data-slot="itemTrailing" :class="ui.itemTrailing({ class: [props.ui?.itemTrailing, item.ui?.itemTrailing] })">
91
+ <slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :index="index" :percent="percents[index] ?? 0">
92
+ {{ Math.round(percents[index] ?? 0) }}%
93
+ </slot>
94
+ </span>
95
+ </slot>
96
+ </li>
97
+ </ul>
98
+ </Primitive>
99
+ </template>
@@ -0,0 +1,91 @@
1
+ import type { VNode } from 'vue';
2
+ import type { AppConfig } from '@nuxt/schema';
3
+ import theme from '#build/ui/progress-group';
4
+ import type { IconProps } from './Icon.vue';
5
+ import type { DynamicSlots } from '../types/utils';
6
+ import type { ComponentConfig } from '../types/tv';
7
+ type ProgressGroup = ComponentConfig<typeof theme, AppConfig, 'progressGroup'>;
8
+ export interface ProgressGroupItem {
9
+ label?: string;
10
+ /**
11
+ * @IconifyIcon
12
+ */
13
+ icon?: IconProps['name'];
14
+ /** The part of `max` this segment takes up. */
15
+ value?: number;
16
+ /**
17
+ * Any theme color, or any CSS color value for palettes outside the theme.
18
+ * @defaultValue 'primary'
19
+ */
20
+ color?: ProgressGroup['variants']['color'] | (string & {});
21
+ slot?: string;
22
+ class?: any;
23
+ ui?: Pick<ProgressGroup['slots'], 'segment' | 'indicator' | 'item' | 'itemLeadingIcon' | 'itemLeadingDot' | 'itemLabel' | 'itemTrailing'>;
24
+ [key: string]: any;
25
+ }
26
+ export interface ProgressGroupProps<T extends ProgressGroupItem = ProgressGroupItem> {
27
+ /**
28
+ * The element or component this component should render as.
29
+ * @defaultValue 'div'
30
+ */
31
+ as?: any;
32
+ items?: T[];
33
+ /**
34
+ * The value all items add up to, used to compute each segment's share of the track.
35
+ * @defaultValue 100
36
+ */
37
+ max?: number;
38
+ /** Display the summed progress value. */
39
+ status?: boolean;
40
+ /**
41
+ * @defaultValue 'md'
42
+ */
43
+ size?: ProgressGroup['variants']['size'];
44
+ /**
45
+ * Any theme color, or any CSS color value for palettes outside the theme.
46
+ * @defaultValue 'primary'
47
+ */
48
+ color?: ProgressGroup['variants']['color'] | (string & {});
49
+ /**
50
+ * The orientation of the progress bar.
51
+ * @defaultValue 'horizontal'
52
+ */
53
+ orientation?: ProgressGroup['variants']['orientation'];
54
+ class?: any;
55
+ ui?: ProgressGroup['slots'];
56
+ }
57
+ type SlotProps<T extends ProgressGroupItem> = (props: {
58
+ item: T;
59
+ index: number;
60
+ percent: number;
61
+ }) => VNode[];
62
+ export type ProgressGroupSlots<T extends ProgressGroupItem = ProgressGroupItem> = {
63
+ 'status'?: (props: {
64
+ percent: number;
65
+ }) => VNode[];
66
+ 'item'?: SlotProps<T>;
67
+ 'item-leading'?: SlotProps<T>;
68
+ 'item-label'?: SlotProps<T>;
69
+ 'item-trailing'?: SlotProps<T>;
70
+ } & DynamicSlots<T, 'leading' | 'label' | 'trailing', {
71
+ index: number;
72
+ percent: number;
73
+ }>;
74
+ declare const _default: typeof __VLS_export;
75
+ export default _default;
76
+ declare const __VLS_export: <T extends ProgressGroupItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
77
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<ProgressGroupProps<T>> & (typeof globalThis extends {
78
+ __VLS_PROPS_FALLBACK: infer P;
79
+ } ? P : {});
80
+ expose: (exposed: {}) => void;
81
+ attrs: any;
82
+ slots: ProgressGroupSlots<T>;
83
+ emit: {};
84
+ }>) => import("vue").VNode & {
85
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
86
+ };
87
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
88
+ [K in keyof T]: T[K];
89
+ } : {
90
+ [K in keyof T as K]: T[K];
91
+ }) & {};
@@ -2,6 +2,7 @@ import type { RadioGroupRootProps, RadioGroupRootEmits } from 'reka-ui';
2
2
  import type { VNode } from 'vue';
3
3
  import type { AppConfig } from '@nuxt/schema';
4
4
  import theme from '#build/ui/radio-group';
5
+ import type { IconProps } from './Icon.vue';
5
6
  import type { AcceptableValue, GetItemKeys, GetModelValue, GetModelValueEmits } from '../types/utils';
6
7
  import type { ComponentConfig } from '../types/tv';
7
8
  type RadioGroup = ComponentConfig<typeof theme, AppConfig, 'radioGroup'>;
@@ -11,8 +12,13 @@ export type RadioGroupItem = RadioGroupValue | {
11
12
  description?: string;
12
13
  disabled?: boolean;
13
14
  value?: RadioGroupValue;
15
+ /**
16
+ * The icon displayed above the label when `indicator` is `hidden`.
17
+ * @IconifyIcon
18
+ */
19
+ icon?: IconProps['name'];
14
20
  class?: any;
15
- ui?: Pick<RadioGroup['slots'], 'item' | 'container' | 'base' | 'indicator' | 'wrapper' | 'label' | 'description'>;
21
+ ui?: Pick<RadioGroup['slots'], 'item' | 'container' | 'base' | 'indicator' | 'wrapper' | 'label' | 'icon' | 'description'>;
16
22
  [key: string]: any;
17
23
  };
18
24
  export interface RadioGroupProps<T extends RadioGroupItem[] = RadioGroupItem[], VK extends GetItemKeys<T> = 'value'> extends Pick<RadioGroupRootProps, 'disabled' | 'loop' | 'name' | 'required'> {
@@ -12,6 +12,7 @@ import { useForwardProps } from "../composables/useForwardProps";
12
12
  import { useFormField } from "../composables/useFormField";
13
13
  import { get } from "../utils";
14
14
  import { tv } from "../utils/tv";
15
+ import UIcon from "./Icon.vue";
15
16
  const _props = defineProps({
16
17
  as: { type: null, required: false },
17
18
  legend: { type: String, required: false },
@@ -39,12 +40,16 @@ const slots = defineSlots();
39
40
  const props = useComponentProps("radioGroup", _props);
40
41
  const appConfig = useAppConfig();
41
42
  const rootProps = useForwardProps(reactivePick(props, "as", "loop", "required"), emits);
42
- const { emitFormChange, emitFormInput, color, name, size, highlight, id: _id, disabled, ariaAttrs } = useFormField(_props, { bind: false });
43
+ const { emitFormChange, emitFormInput, color: formFieldColor, name, size: formFieldSize, highlight: formFieldHighlight, id: _id, disabled: formFieldDisabled, ariaAttrs } = useFormField(_props, { bind: false });
43
44
  const id = _id.value ?? useId();
45
+ const color = computed(() => formFieldColor.value ?? props.color);
46
+ const highlight = computed(() => formFieldHighlight.value ?? props.highlight);
47
+ const size = computed(() => formFieldSize.value ?? props.size);
48
+ const disabled = computed(() => formFieldDisabled.value ?? props.disabled);
44
49
  const ui = computed(() => tv({ extend: theme, ...appConfig.ui?.radioGroup || {} })({
45
- size: size.value ?? props.size,
46
- color: color.value ?? props.color,
47
- highlight: highlight.value ?? props.highlight,
50
+ size: size.value,
51
+ color: color.value,
52
+ highlight: highlight.value,
48
53
  disabled: disabled.value,
49
54
  required: props.required,
50
55
  orientation: props.orientation,
@@ -83,6 +88,9 @@ const normalizedItems = computed(() => {
83
88
  }
84
89
  return props.items.map(normalizeItem);
85
90
  });
91
+ function labelIcon(item) {
92
+ return props.indicator === "hidden" ? item.icon : void 0;
93
+ }
86
94
  function onUpdate(value) {
87
95
  const event = new Event("change", { target: { value } });
88
96
  emits("change", event);
@@ -124,7 +132,8 @@ function onUpdate(value) {
124
132
  </RRadioGroupItem>
125
133
  </div>
126
134
 
127
- <div v-if="item.label || !!slots.label || (item.description || !!slots.description)" data-slot="wrapper" :class="ui.wrapper({ class: [props.ui?.wrapper, item.ui?.wrapper] })">
135
+ <div v-if="labelIcon(item) || (item.label || !!slots.label) || (item.description || !!slots.description)" data-slot="wrapper" :class="ui.wrapper({ class: [props.ui?.wrapper, item.ui?.wrapper] })">
136
+ <UIcon v-if="labelIcon(item)" :name="labelIcon(item)" data-slot="icon" :class="ui.icon({ class: [props.ui?.icon, item.ui?.icon] })" />
128
137
  <component :is="!props.variant || props.variant === 'list' ? Label : 'p'" v-if="item.label || !!slots.label" :for="item.id" data-slot="label" :class="ui.label({ class: [props.ui?.label, item.ui?.label], disabled: item.disabled || disabled })">
129
138
  <slot name="label" :item="item" :model-value="props.modelValue">
130
139
  {{ item.label }}
@@ -2,6 +2,7 @@ import type { RadioGroupRootProps, RadioGroupRootEmits } from 'reka-ui';
2
2
  import type { VNode } from 'vue';
3
3
  import type { AppConfig } from '@nuxt/schema';
4
4
  import theme from '#build/ui/radio-group';
5
+ import type { IconProps } from './Icon.vue';
5
6
  import type { AcceptableValue, GetItemKeys, GetModelValue, GetModelValueEmits } from '../types/utils';
6
7
  import type { ComponentConfig } from '../types/tv';
7
8
  type RadioGroup = ComponentConfig<typeof theme, AppConfig, 'radioGroup'>;
@@ -11,8 +12,13 @@ export type RadioGroupItem = RadioGroupValue | {
11
12
  description?: string;
12
13
  disabled?: boolean;
13
14
  value?: RadioGroupValue;
15
+ /**
16
+ * The icon displayed above the label when `indicator` is `hidden`.
17
+ * @IconifyIcon
18
+ */
19
+ icon?: IconProps['name'];
14
20
  class?: any;
15
- ui?: Pick<RadioGroup['slots'], 'item' | 'container' | 'base' | 'indicator' | 'wrapper' | 'label' | 'description'>;
21
+ ui?: Pick<RadioGroup['slots'], 'item' | 'container' | 'base' | 'indicator' | 'wrapper' | 'label' | 'icon' | 'description'>;
16
22
  [key: string]: any;
17
23
  };
18
24
  export interface RadioGroupProps<T extends RadioGroupItem[] = RadioGroupItem[], VK extends GetItemKeys<T> = 'value'> extends Pick<RadioGroupRootProps, 'disabled' | 'loop' | 'name' | 'required'> {
@@ -3,7 +3,7 @@ import theme from "#build/ui/select";
3
3
  </script>
4
4
 
5
5
  <script setup>
6
- import { useTemplateRef, computed, onMounted, toRef } from "vue";
6
+ import { useTemplateRef, computed, onMounted, onScopeDispose, toRef } from "vue";
7
7
  import { SelectRoot, SelectArrow, SelectTrigger, SelectPortal, SelectContent, SelectViewport, SelectValue as RSelectValue, SelectLabel, SelectGroup, SelectItem as RSelectItem, SelectItemIndicator, SelectItemText, SelectSeparator } from "reka-ui";
8
8
  import { defu } from "defu";
9
9
  import { reactivePick } from "@vueuse/core";
@@ -68,17 +68,28 @@ const portalProps = usePortal(toRef(() => props.portal));
68
68
  const position = computed(() => props.content?.position ?? appConfig.ui?.select?.defaultVariants?.position ?? theme.defaultVariants?.position);
69
69
  const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: position.value }));
70
70
  const arrowProps = toRef(() => defu(props.arrow, { rounded: true }));
71
- const { emitFormChange, emitFormInput, emitFormBlur, emitFormFocus, size: formFieldSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(_props);
71
+ const { emitFormChange, emitFormInput, emitFormBlur, emitFormFocus, size: formFieldSize, color: formFieldColor, id, name, highlight: formFieldHighlight, disabled: formFieldDisabled, ariaAttrs } = useFormField(_props);
72
72
  const { orientation, size: fieldGroupSize } = useFieldGroup(_props);
73
- const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: appConfig.ui.icons.chevronDown })));
74
- const selectSize = computed(() => fieldGroupSize.value || formFieldSize.value);
73
+ const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(computed(() => ({
74
+ icon: props.icon,
75
+ leading: props.leading,
76
+ leadingIcon: props.leadingIcon,
77
+ trailing: props.trailing,
78
+ trailingIcon: props.trailingIcon ?? appConfig.ui.icons.chevronDown,
79
+ loading: props.loading,
80
+ loadingIcon: props.loadingIcon
81
+ })));
82
+ const color = computed(() => formFieldColor.value ?? props.color);
83
+ const highlight = computed(() => formFieldHighlight.value ?? props.highlight);
84
+ const size = computed(() => fieldGroupSize.value ?? formFieldSize.value ?? props.size);
85
+ const disabled = computed(() => formFieldDisabled.value ?? props.disabled);
75
86
  const isItemAligned = computed(() => position.value === "item-aligned");
76
87
  const ui = computed(() => tv({ extend: theme, ...appConfig.ui?.select || {} })({
77
- color: color.value ?? props.color,
88
+ color: color.value,
78
89
  variant: props.variant,
79
- size: selectSize.value ?? props.size,
90
+ size: size.value,
80
91
  loading: props.loading,
81
- highlight: highlight.value ?? props.highlight,
92
+ highlight: highlight.value,
82
93
  leading: isLeading.value || !!props.avatar || !!slots.leading,
83
94
  trailing: isTrailing.value || !!slots.trailing,
84
95
  fieldGroup: orientation.value,
@@ -110,11 +121,13 @@ function autoFocus() {
110
121
  });
111
122
  }
112
123
  }
124
+ let autofocusTimeoutId;
113
125
  onMounted(() => {
114
- setTimeout(() => {
126
+ autofocusTimeoutId = setTimeout(() => {
115
127
  autoFocus();
116
128
  }, props.autofocusDelay);
117
129
  });
130
+ onScopeDispose(() => clearTimeout(autofocusTimeoutId));
118
131
  function onUpdate(value) {
119
132
  if (props.modelModifiers?.trim && (typeof value === "string" || value === null || value === void 0)) {
120
133
  value = value?.trim() ?? null;
@@ -3,7 +3,7 @@ import theme from "#build/ui/select-menu";
3
3
  </script>
4
4
 
5
5
  <script setup>
6
- import { useTemplateRef, computed, ref, onMounted, toRef, toRaw, watch, nextTick } from "vue";
6
+ import { useTemplateRef, computed, ref, onMounted, onScopeDispose, toRef, toRaw, watch, nextTick } from "vue";
7
7
  import { ComboboxRoot, ComboboxArrow, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxCancel, ComboboxPortal, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxVirtualizer, ComboboxLabel, ComboboxSeparator, ComboboxItem, ComboboxItemIndicator, FocusScope } from "reka-ui";
8
8
  import { useForwardProps } from "../composables/useForwardProps";
9
9
  import { defu } from "defu";
@@ -89,14 +89,25 @@ const clearProps = computed(() => typeof props.clear === "object" ? props.clear
89
89
  const virtualizerProps = toRef(() => {
90
90
  if (!props.virtualize) return false;
91
91
  return defu(typeof props.virtualize === "boolean" ? {} : props.virtualize, {
92
- estimateSize: getEstimateSize(filteredItems.value, selectSize.value || "md", props.descriptionKey, !!slots["item-description"])
92
+ estimateSize: getEstimateSize(filteredItems.value, size.value ?? "md", props.descriptionKey, !!slots["item-description"])
93
93
  });
94
94
  });
95
95
  const searchInputProps = toRef(() => defu(props.searchInput, { placeholder: t("selectMenu.search"), variant: "none" }));
96
- const { emitFormBlur, emitFormFocus, emitFormInput, emitFormChange, size: formFieldSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(_props);
96
+ const { emitFormBlur, emitFormFocus, emitFormInput, emitFormChange, size: formFieldSize, color: formFieldColor, id, name, highlight: formFieldHighlight, disabled: formFieldDisabled, ariaAttrs } = useFormField(_props);
97
97
  const { orientation, size: fieldGroupSize } = useFieldGroup(_props);
98
- const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: appConfig.ui.icons.chevronDown })));
99
- const selectSize = computed(() => fieldGroupSize.value || formFieldSize.value);
98
+ const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(computed(() => ({
99
+ icon: props.icon,
100
+ leading: props.leading,
101
+ leadingIcon: props.leadingIcon,
102
+ trailing: props.trailing,
103
+ trailingIcon: props.trailingIcon ?? appConfig.ui.icons.chevronDown,
104
+ loading: props.loading,
105
+ loadingIcon: props.loadingIcon
106
+ })));
107
+ const color = computed(() => formFieldColor.value ?? props.color);
108
+ const highlight = computed(() => formFieldHighlight.value ?? props.highlight);
109
+ const size = computed(() => fieldGroupSize.value ?? formFieldSize.value ?? props.size);
110
+ const disabled = computed(() => formFieldDisabled.value ?? props.disabled);
100
111
  const [DefineCreateItemTemplate, ReuseCreateItemTemplate] = createReusableTemplate();
101
112
  const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate({
102
113
  props: {
@@ -111,11 +122,11 @@ const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate({
111
122
  }
112
123
  });
113
124
  const ui = computed(() => tv({ extend: theme, ...appConfig.ui?.selectMenu || {} })({
114
- color: color.value ?? props.color,
125
+ color: color.value,
115
126
  variant: props.variant,
116
- size: selectSize?.value ?? props.size,
127
+ size: size.value,
117
128
  loading: props.loading,
118
- highlight: highlight.value ?? props.highlight,
129
+ highlight: highlight.value,
119
130
  leading: isLeading.value || !!props.avatar || !!slots.leading,
120
131
  trailing: isTrailing.value || !!slots.trailing,
121
132
  fieldGroup: orientation.value,
@@ -171,11 +182,13 @@ function autoFocus() {
171
182
  });
172
183
  }
173
184
  }
185
+ let autofocusTimeoutId;
174
186
  onMounted(() => {
175
- setTimeout(() => {
187
+ autofocusTimeoutId = setTimeout(() => {
176
188
  autoFocus();
177
189
  }, props.autofocusDelay);
178
190
  });
191
+ onScopeDispose(() => clearTimeout(autofocusTimeoutId));
179
192
  function onUpdate(value) {
180
193
  if (toRaw(props.modelValue) === value) {
181
194
  return;
@@ -201,9 +214,10 @@ function onUpdate(value) {
201
214
  }
202
215
  }
203
216
  const isOpen = ref(false);
217
+ let timeoutId;
218
+ onScopeDispose(() => clearTimeout(timeoutId));
204
219
  function onUpdateOpen(value) {
205
220
  isOpen.value = value;
206
- let timeoutId;
207
221
  if (!value) {
208
222
  const event = new FocusEvent("blur");
209
223
  emits("blur", event);
@@ -378,7 +392,7 @@ defineExpose({
378
392
  <UButton
379
393
  as="span"
380
394
  :icon="props.clearIcon || appConfig.ui.icons.close"
381
- :size="selectSize"
395
+ :size="size"
382
396
  variant="link"
383
397
  color="neutral"
384
398
  tabindex="-1"
@@ -405,7 +419,7 @@ defineExpose({
405
419
  <UInput
406
420
  autofocus
407
421
  autocomplete="off"
408
- :size="selectSize"
422
+ :size="size"
409
423
  v-bind="searchInputProps"
410
424
  :model-modifiers="{
411
425
  trim: props.modelModifiers?.trim
@@ -10,6 +10,7 @@ import { reactivePick } from "@vueuse/core";
10
10
  import { useAppConfig } from "#imports";
11
11
  import { useComponentProps } from "../composables/useComponentProps";
12
12
  import { useFormField } from "../composables/useFormField";
13
+ import { pick, omit } from "../utils";
13
14
  import { tv } from "../utils/tv";
14
15
  import UTooltip from "./Tooltip.vue";
15
16
  const _props = defineProps({
@@ -30,11 +31,15 @@ const _props = defineProps({
30
31
  minStepsBetweenThumbs: { type: Number, required: false }
31
32
  });
32
33
  const emits = defineEmits(["change"]);
34
+ defineOptions({ inheritAttrs: false });
33
35
  const props = useComponentProps("slider", _props);
34
36
  const modelValue = defineModel({ type: null });
35
37
  const appConfig = useAppConfig();
36
38
  const rootProps = useForwardProps(reactivePick(props, "as", "orientation", "min", "max", "step", "minStepsBetweenThumbs", "inverted"), emits);
37
- const { id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField(_props);
39
+ const { id, emitFormChange, emitFormInput, size: formFieldSize, color: formFieldColor, name, disabled: formFieldDisabled, ariaAttrs } = useFormField(_props);
40
+ const color = computed(() => formFieldColor.value ?? props.color);
41
+ const size = computed(() => formFieldSize.value ?? props.size);
42
+ const disabled = computed(() => formFieldDisabled.value ?? props.disabled);
38
43
  const defaultSliderValue = computed(() => {
39
44
  if (typeof props.defaultValue === "number") {
40
45
  return [props.defaultValue];
@@ -53,10 +58,11 @@ const sliderValue = computed({
53
58
  }
54
59
  });
55
60
  const thumbs = computed(() => sliderValue.value?.length ?? 1);
61
+ const thumbAttrs = ["aria-label", "aria-labelledby", "aria-describedby", "aria-valuetext", "aria-invalid", "aria-errormessage"];
56
62
  const ui = computed(() => tv({ extend: theme, ...appConfig.ui?.slider || {} })({
57
63
  disabled: disabled.value,
58
- size: size.value ?? props.size,
59
- color: color.value ?? props.color,
64
+ size: size.value,
65
+ color: color.value,
60
66
  orientation: props.orientation
61
67
  }));
62
68
  function onChange(value) {
@@ -68,12 +74,13 @@ function onChange(value) {
68
74
 
69
75
  <template>
70
76
  <SliderRoot
71
- v-bind="{ ...rootProps, ...ariaAttrs }"
72
77
  :id="id"
73
78
  v-model="sliderValue"
79
+ data-slot="root"
80
+ :role="thumbs > 1 && ($attrs['aria-label'] || $attrs['aria-labelledby']) ? 'group' : void 0"
81
+ v-bind="{ ...rootProps, ...thumbs > 1 ? $attrs : omit($attrs, thumbAttrs) }"
74
82
  :name="name"
75
83
  :disabled="disabled"
76
- data-slot="root"
77
84
  :class="ui.root({ class: [props.ui?.root, props.class] })"
78
85
  :default-value="defaultSliderValue"
79
86
  @update:model-value="emitFormInput()"
@@ -90,9 +97,9 @@ function onChange(value) {
90
97
  disable-closing-trigger
91
98
  v-bind="typeof props.tooltip === 'object' ? props.tooltip : {}"
92
99
  >
93
- <SliderThumb data-slot="thumb" :class="ui.thumb({ class: props.ui?.thumb })" :aria-label="thumbs === 1 ? 'Thumb' : `Thumb ${thumb} of ${thumbs}`" />
100
+ <SliderThumb data-slot="thumb" :class="ui.thumb({ class: props.ui?.thumb })" v-bind="{ ...thumbs === 1 ? pick($attrs, thumbAttrs) : {}, ...ariaAttrs }" :aria-label="thumbs > 1 || $attrs['aria-labelledby'] ? void 0 : $attrs['aria-label'] ?? 'Thumb'" />
94
101
  </UTooltip>
95
- <SliderThumb v-else data-slot="thumb" :class="ui.thumb({ class: props.ui?.thumb })" :aria-label="thumbs === 1 ? 'Thumb' : `Thumb ${thumb} of ${thumbs}`" />
102
+ <SliderThumb v-else data-slot="thumb" :class="ui.thumb({ class: props.ui?.thumb })" v-bind="{ ...thumbs === 1 ? pick($attrs, thumbAttrs) : {}, ...ariaAttrs }" :aria-label="thumbs > 1 || $attrs['aria-labelledby'] ? void 0 : $attrs['aria-label'] ?? 'Thumb'" />
96
103
  </template>
97
104
  </SliderRoot>
98
105
  </template>