@nuxt/ui 3.2.0 → 3.3.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 (175) hide show
  1. package/.nuxt/ui/button.ts +42 -42
  2. package/.nuxt/ui/command-palette.ts +2 -1
  3. package/.nuxt/ui/file-upload.ts +290 -0
  4. package/.nuxt/ui/index.ts +1 -0
  5. package/.nuxt/ui/kbd.ts +167 -3
  6. package/.nuxt/ui/table.ts +8 -0
  7. package/.nuxt/ui/tabs.ts +4 -2
  8. package/.nuxt/ui/toast.ts +8 -15
  9. package/.nuxt/ui/tooltip.ts +1 -1
  10. package/cli/templates.mjs +4 -3
  11. package/dist/module.d.mts +15 -1
  12. package/dist/module.json +1 -1
  13. package/dist/module.mjs +3 -3
  14. package/dist/runtime/components/Accordion.vue.d.ts +1 -1
  15. package/dist/runtime/components/Alert.vue.d.ts +2 -2
  16. package/dist/runtime/components/App.vue.d.ts +1 -1
  17. package/dist/runtime/components/Avatar.vue.d.ts +1 -1
  18. package/dist/runtime/components/AvatarGroup.vue.d.ts +1 -1
  19. package/dist/runtime/components/Badge.vue.d.ts +1 -1
  20. package/dist/runtime/components/Breadcrumb.vue.d.ts +1 -1
  21. package/dist/runtime/components/Button.vue +6 -6
  22. package/dist/runtime/components/Button.vue.d.ts +1 -5
  23. package/dist/runtime/components/ButtonGroup.vue.d.ts +1 -1
  24. package/dist/runtime/components/Calendar.vue.d.ts +1 -1
  25. package/dist/runtime/components/Card.vue.d.ts +1 -1
  26. package/dist/runtime/components/Carousel.vue +18 -14
  27. package/dist/runtime/components/Carousel.vue.d.ts +1 -1
  28. package/dist/runtime/components/Checkbox.vue.d.ts +1 -1
  29. package/dist/runtime/components/CheckboxGroup.vue.d.ts +1 -1
  30. package/dist/runtime/components/Chip.vue.d.ts +2 -2
  31. package/dist/runtime/components/Collapsible.vue.d.ts +1 -1
  32. package/dist/runtime/components/ColorPicker.vue +1 -2
  33. package/dist/runtime/components/ColorPicker.vue.d.ts +1 -1
  34. package/dist/runtime/components/CommandPalette.vue +4 -0
  35. package/dist/runtime/components/CommandPalette.vue.d.ts +6 -1
  36. package/dist/runtime/components/Container.vue.d.ts +1 -1
  37. package/dist/runtime/components/ContextMenu.vue.d.ts +1 -1
  38. package/dist/runtime/components/ContextMenuContent.vue.d.ts +1 -1
  39. package/dist/runtime/components/Drawer.vue +4 -4
  40. package/dist/runtime/components/Drawer.vue.d.ts +6 -1
  41. package/dist/runtime/components/DropdownMenu.vue.d.ts +1 -1
  42. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +8 -5
  43. package/dist/runtime/components/FileUpload.vue +242 -0
  44. package/dist/runtime/components/FileUpload.vue.d.ts +167 -0
  45. package/dist/runtime/components/Form.vue.d.ts +6 -5
  46. package/dist/runtime/components/FormField.vue +2 -2
  47. package/dist/runtime/components/FormField.vue.d.ts +4 -4
  48. package/dist/runtime/components/Icon.vue.d.ts +1 -1
  49. package/dist/runtime/components/Input.vue +10 -7
  50. package/dist/runtime/components/Input.vue.d.ts +9 -9
  51. package/dist/runtime/components/InputMenu.vue +17 -10
  52. package/dist/runtime/components/InputMenu.vue.d.ts +15 -12
  53. package/dist/runtime/components/InputNumber.vue.d.ts +4 -4
  54. package/dist/runtime/components/InputTags.vue +2 -0
  55. package/dist/runtime/components/InputTags.vue.d.ts +5 -3
  56. package/dist/runtime/components/Kbd.vue +2 -1
  57. package/dist/runtime/components/Kbd.vue.d.ts +5 -1
  58. package/dist/runtime/components/Link.vue +6 -5
  59. package/dist/runtime/components/Link.vue.d.ts +1 -3
  60. package/dist/runtime/components/LinkBase.vue.d.ts +1 -1
  61. package/dist/runtime/components/Modal.vue.d.ts +2 -2
  62. package/dist/runtime/components/NavigationMenu.vue +3 -2
  63. package/dist/runtime/components/NavigationMenu.vue.d.ts +1 -1
  64. package/dist/runtime/components/OverlayProvider.vue.d.ts +1 -1
  65. package/dist/runtime/components/Pagination.vue.d.ts +1 -1
  66. package/dist/runtime/components/PinInput.vue.d.ts +1 -1
  67. package/dist/runtime/components/Popover.vue +2 -1
  68. package/dist/runtime/components/Popover.vue.d.ts +8 -2
  69. package/dist/runtime/components/Progress.vue.d.ts +1 -1
  70. package/dist/runtime/components/RadioGroup.vue +1 -1
  71. package/dist/runtime/components/RadioGroup.vue.d.ts +5 -4
  72. package/dist/runtime/components/Select.vue.d.ts +1 -1
  73. package/dist/runtime/components/SelectMenu.vue +9 -6
  74. package/dist/runtime/components/SelectMenu.vue.d.ts +1 -1
  75. package/dist/runtime/components/Separator.vue.d.ts +1 -1
  76. package/dist/runtime/components/Skeleton.vue.d.ts +1 -1
  77. package/dist/runtime/components/Slideover.vue.d.ts +2 -2
  78. package/dist/runtime/components/Slider.vue.d.ts +5 -5
  79. package/dist/runtime/components/Stepper.vue.d.ts +1 -1
  80. package/dist/runtime/components/Switch.vue.d.ts +1 -1
  81. package/dist/runtime/components/Table.vue +83 -8
  82. package/dist/runtime/components/Table.vue.d.ts +20 -4
  83. package/dist/runtime/components/Tabs.vue +11 -2
  84. package/dist/runtime/components/Tabs.vue.d.ts +8 -3
  85. package/dist/runtime/components/Textarea.vue +10 -7
  86. package/dist/runtime/components/Textarea.vue.d.ts +10 -9
  87. package/dist/runtime/components/Timeline.vue.d.ts +1 -1
  88. package/dist/runtime/components/Toast.vue +12 -4
  89. package/dist/runtime/components/Toast.vue.d.ts +14 -13
  90. package/dist/runtime/components/Toaster.vue.d.ts +1 -1
  91. package/dist/runtime/components/Tooltip.vue +2 -1
  92. package/dist/runtime/components/Tooltip.vue.d.ts +8 -2
  93. package/dist/runtime/components/Tree.vue +3 -2
  94. package/dist/runtime/components/Tree.vue.d.ts +1 -1
  95. package/dist/runtime/composables/defineShortcuts.js +5 -3
  96. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  97. package/dist/runtime/composables/useComponentIcons.d.ts +1 -1
  98. package/dist/runtime/composables/useFileUpload.d.ts +19 -0
  99. package/dist/runtime/composables/useFileUpload.js +63 -0
  100. package/dist/runtime/composables/useFormField.d.ts +3 -6
  101. package/dist/runtime/composables/useFormField.js +5 -2
  102. package/dist/runtime/composables/useKbd.d.ts +1 -1
  103. package/dist/runtime/composables/useLocale.js +2 -2
  104. package/dist/runtime/composables/useOverlay.d.ts +28 -1
  105. package/dist/runtime/composables/useOverlay.js +4 -4
  106. package/dist/runtime/composables/usePortal.d.ts +1 -1
  107. package/dist/runtime/inertia/components/Link.vue.d.ts +1 -1
  108. package/dist/runtime/inertia/components/LinkBase.vue.d.ts +1 -1
  109. package/dist/runtime/inertia/stubs.d.ts +1 -0
  110. package/dist/runtime/inertia/stubs.js +4 -2
  111. package/dist/runtime/locale/ar.js +2 -1
  112. package/dist/runtime/locale/az.js +1 -0
  113. package/dist/runtime/locale/bg.js +1 -0
  114. package/dist/runtime/locale/bn.js +1 -0
  115. package/dist/runtime/locale/ca.js +1 -0
  116. package/dist/runtime/locale/ckb.js +2 -1
  117. package/dist/runtime/locale/cs.js +1 -0
  118. package/dist/runtime/locale/da.js +1 -0
  119. package/dist/runtime/locale/de.js +1 -0
  120. package/dist/runtime/locale/el.js +1 -0
  121. package/dist/runtime/locale/en.js +1 -0
  122. package/dist/runtime/locale/es.js +1 -0
  123. package/dist/runtime/locale/et.js +1 -0
  124. package/dist/runtime/locale/fa_ir.js +1 -0
  125. package/dist/runtime/locale/fi.js +1 -0
  126. package/dist/runtime/locale/fr.js +1 -0
  127. package/dist/runtime/locale/he.js +1 -0
  128. package/dist/runtime/locale/hi.js +2 -1
  129. package/dist/runtime/locale/hu.js +1 -0
  130. package/dist/runtime/locale/hy.js +1 -0
  131. package/dist/runtime/locale/id.js +1 -0
  132. package/dist/runtime/locale/it.js +1 -0
  133. package/dist/runtime/locale/ja.js +1 -0
  134. package/dist/runtime/locale/kk.js +1 -0
  135. package/dist/runtime/locale/km.js +2 -1
  136. package/dist/runtime/locale/ko.js +1 -0
  137. package/dist/runtime/locale/ky.js +1 -0
  138. package/dist/runtime/locale/lb.js +1 -0
  139. package/dist/runtime/locale/lt.js +1 -0
  140. package/dist/runtime/locale/mn.js +1 -0
  141. package/dist/runtime/locale/ms.js +1 -0
  142. package/dist/runtime/locale/nb_no.js +1 -0
  143. package/dist/runtime/locale/nl.js +1 -0
  144. package/dist/runtime/locale/pl.js +1 -0
  145. package/dist/runtime/locale/pt.js +1 -0
  146. package/dist/runtime/locale/pt_br.js +1 -0
  147. package/dist/runtime/locale/ro.js +1 -0
  148. package/dist/runtime/locale/ru.js +1 -0
  149. package/dist/runtime/locale/sk.js +1 -0
  150. package/dist/runtime/locale/sl.js +1 -0
  151. package/dist/runtime/locale/sv.js +1 -0
  152. package/dist/runtime/locale/th.js +1 -0
  153. package/dist/runtime/locale/tj.js +1 -0
  154. package/dist/runtime/locale/tr.js +1 -0
  155. package/dist/runtime/locale/ug_cn.js +1 -0
  156. package/dist/runtime/locale/uk.js +1 -0
  157. package/dist/runtime/locale/ur.js +1 -0
  158. package/dist/runtime/locale/uz.js +1 -0
  159. package/dist/runtime/locale/vi.js +1 -0
  160. package/dist/runtime/locale/zh_cn.js +1 -0
  161. package/dist/runtime/locale/zh_tw.js +1 -0
  162. package/dist/runtime/types/index.d.ts +1 -0
  163. package/dist/runtime/types/index.js +1 -0
  164. package/dist/runtime/types/locale.d.ts +1 -0
  165. package/dist/runtime/utils/index.d.ts +1 -0
  166. package/dist/runtime/utils/index.js +9 -0
  167. package/dist/runtime/vue/components/Icon.vue.d.ts +1 -1
  168. package/dist/runtime/vue/components/Link.vue.d.ts +1 -1
  169. package/dist/runtime/vue/stubs.d.ts +1 -0
  170. package/dist/runtime/vue/stubs.js +3 -1
  171. package/dist/shared/{ui.BPVxSPGY.mjs → ui.BkSj2DmF.mjs} +278 -29
  172. package/dist/unplugin.d.mts +2 -0
  173. package/dist/unplugin.mjs +6 -3
  174. package/dist/vite.mjs +1 -1
  175. package/package.json +24 -24
@@ -56,5 +56,5 @@ declare const _default: <T extends PinInputType = "text">(__VLS_props: NonNullab
56
56
  };
57
57
  export default _default;
58
58
  type __VLS_PrettifyLocal<T> = {
59
- [K in keyof T]: T[K];
59
+ [K in keyof T as K]: T[K];
60
60
  } & {};
@@ -16,6 +16,7 @@ const props = defineProps({
16
16
  content: { type: Object, required: false },
17
17
  arrow: { type: [Boolean, Object], required: false },
18
18
  portal: { type: [Boolean, String], required: false, skipCheck: true, default: true },
19
+ reference: { type: null, required: false },
19
20
  dismissible: { type: Boolean, required: false, default: true },
20
21
  class: { type: null, required: false },
21
22
  ui: { type: null, required: false },
@@ -54,7 +55,7 @@ const Component = computed(() => props.mode === "hover" ? HoverCard : Popover);
54
55
 
55
56
  <template>
56
57
  <Component.Root v-slot="{ open }" v-bind="rootProps">
57
- <Component.Trigger v-if="!!slots.default" as-child :class="props.class">
58
+ <Component.Trigger v-if="!!slots.default || !!reference" as-child :reference="reference" :class="props.class">
58
59
  <slot :open="open" />
59
60
  </Component.Trigger>
60
61
 
@@ -1,5 +1,5 @@
1
1
  import { Popover } from 'reka-ui/namespaced';
2
- import type { PopoverRootProps, HoverCardRootProps, PopoverRootEmits, PopoverContentProps, PopoverContentEmits, PopoverArrowProps } from 'reka-ui';
2
+ import type { PopoverRootProps, HoverCardRootProps, PopoverRootEmits, PopoverContentProps, PopoverContentEmits, PopoverArrowProps, HoverCardTriggerProps } from 'reka-ui';
3
3
  import type { AppConfig } from '@nuxt/schema';
4
4
  import theme from '#build/ui/popover';
5
5
  import type { EmitsToProps, ComponentConfig } from '../types/utils';
@@ -25,6 +25,12 @@ export interface PopoverProps extends PopoverRootProps, Pick<HoverCardRootProps,
25
25
  * @defaultValue true
26
26
  */
27
27
  portal?: boolean | string | HTMLElement;
28
+ /**
29
+ * The reference (or anchor) element that is being referred to for positioning.
30
+ *
31
+ * If not provided will use the current component as anchor.
32
+ */
33
+ reference?: HoverCardTriggerProps['reference'];
28
34
  /**
29
35
  * When `false`, the popover will not close when clicking outside or pressing escape.
30
36
  * @defaultValue true
@@ -43,7 +49,7 @@ export interface PopoverSlots {
43
49
  content(props?: {}): any;
44
50
  anchor(props?: {}): any;
45
51
  }
46
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<PopoverProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
52
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<PopoverProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
47
53
  "update:open": (value: boolean) => any;
48
54
  "close:prevent": () => any;
49
55
  }, string, import("vue").PublicProps, Readonly<PopoverProps> & Readonly<{
@@ -47,7 +47,7 @@ export type ProgressSlots = {
47
47
  step: number;
48
48
  }) => any;
49
49
  };
50
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ProgressProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
50
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ProgressProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
51
51
  "update:modelValue": (value: string[] | undefined) => any;
52
52
  "update:max": (value: number) => any;
53
53
  }, string, import("vue").PublicProps, Readonly<ProgressProps> & Readonly<{
@@ -54,7 +54,7 @@ function normalizeItem(item) {
54
54
  label: void 0
55
55
  };
56
56
  }
57
- if (typeof item === "string" || typeof item === "number") {
57
+ if (typeof item === "string" || typeof item === "number" || typeof item === "bigint") {
58
58
  return {
59
59
  id: `${id}:${item}`,
60
60
  value: String(item),
@@ -64,10 +64,11 @@ export interface RadioGroupProps<T extends RadioGroupItem = RadioGroupItem> exte
64
64
  export type RadioGroupEmits = RadioGroupRootEmits & {
65
65
  change: [payload: Event];
66
66
  };
67
+ type NormalizeItem<T extends RadioGroupItem> = Exclude<T & {
68
+ id: string;
69
+ }, RadioGroupValue>;
67
70
  type SlotProps<T extends RadioGroupItem> = (props: {
68
- item: T & {
69
- id: string;
70
- };
71
+ item: NormalizeItem<T>;
71
72
  modelValue?: RadioGroupValue;
72
73
  }) => any;
73
74
  export interface RadioGroupSlots<T extends RadioGroupItem = RadioGroupItem> {
@@ -89,5 +90,5 @@ declare const _default: <T extends RadioGroupItem>(__VLS_props: NonNullable<Awai
89
90
  };
90
91
  export default _default;
91
92
  type __VLS_PrettifyLocal<T> = {
92
- [K in keyof T]: T[K];
93
+ [K in keyof T as K]: T[K];
93
94
  } & {};
@@ -249,5 +249,5 @@ declare const _default: <T extends ArrayOrNested<SelectItem>, VK extends GetItem
249
249
  };
250
250
  export default _default;
251
251
  type __VLS_PrettifyLocal<T> = {
252
- [K in keyof T]: T[K];
252
+ [K in keyof T as K]: T[K];
253
253
  } & {};
@@ -93,10 +93,7 @@ function displayValue(value) {
93
93
  const values = value.map((v) => displayValue(v)).filter(Boolean);
94
94
  return values?.length ? values.join(", ") : void 0;
95
95
  }
96
- if (!props.valueKey) {
97
- return value && (typeof value === "object" ? get(value, props.labelKey) : value);
98
- }
99
- const item = items.value.find((item2) => compare(typeof item2 === "object" ? get(item2, props.valueKey) : item2, value));
96
+ const item = items.value.find((item2) => compare(typeof item2 === "object" && props.valueKey ? get(item2, props.valueKey) : item2, value));
100
97
  return item && (typeof item === "object" ? get(item, props.labelKey) : item);
101
98
  }
102
99
  const groups = computed(
@@ -109,13 +106,19 @@ const filteredGroups = computed(() => {
109
106
  }
110
107
  const fields = Array.isArray(props.filterFields) ? props.filterFields : [props.labelKey];
111
108
  return groups.value.map((items2) => items2.filter((item) => {
112
- if (typeof item !== "object" || item === null) {
109
+ if (item === void 0 || item === null) {
110
+ return false;
111
+ }
112
+ if (typeof item !== "object") {
113
113
  return contains(String(item), searchTerm.value);
114
114
  }
115
115
  if (item.type && ["label", "separator"].includes(item.type)) {
116
116
  return true;
117
117
  }
118
- return fields.some((field) => contains(get(item, field), searchTerm.value));
118
+ return fields.some((field) => {
119
+ const value = get(item, field);
120
+ return value !== void 0 && value !== null && contains(String(value), searchTerm.value);
121
+ });
119
122
  })).filter((group) => group.filter(
120
123
  (item) => !isSelectItem(item) || (!item.type || !["label", "separator"].includes(item.type))
121
124
  ).length > 0);
@@ -298,5 +298,5 @@ declare const _default: <T extends ArrayOrNested<SelectMenuItem>, VK extends Get
298
298
  };
299
299
  export default _default;
300
300
  type __VLS_PrettifyLocal<T> = {
301
- [K in keyof T]: T[K];
301
+ [K in keyof T as K]: T[K];
302
302
  } & {};
@@ -43,7 +43,7 @@ export interface SeparatorProps extends Pick<_SeparatorProps, 'decorative'> {
43
43
  export interface SeparatorSlots {
44
44
  default(props?: {}): any;
45
45
  }
46
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<SeparatorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SeparatorProps> & Readonly<{}>, {
46
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<SeparatorProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SeparatorProps> & Readonly<{}>, {
47
47
  orientation: "horizontal" | "vertical";
48
48
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, SeparatorSlots>;
49
49
  export default _default;
@@ -6,7 +6,7 @@ export interface SkeletonProps {
6
6
  as?: any;
7
7
  class?: any;
8
8
  }
9
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<SkeletonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SkeletonProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
9
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<SkeletonProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SkeletonProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
10
10
  default?: (props: {}) => any;
11
11
  }>;
12
12
  export default _default;
@@ -80,7 +80,7 @@ export interface SlideoverSlots {
80
80
  close: () => void;
81
81
  }): any;
82
82
  }
83
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<SlideoverProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
83
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<SlideoverProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
84
84
  "update:open": (value: boolean) => any;
85
85
  "after:leave": () => any;
86
86
  "after:enter": () => any;
@@ -93,9 +93,9 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<SlideoverP
93
93
  }>, {
94
94
  close: boolean | Partial<ButtonProps>;
95
95
  modal: boolean;
96
+ transition: boolean;
96
97
  portal: boolean | string | HTMLElement;
97
98
  overlay: boolean;
98
- transition: boolean;
99
99
  side: Slideover["variants"]["side"];
100
100
  dismissible: boolean;
101
101
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, SlideoverSlots>;
@@ -35,24 +35,24 @@ export interface SliderProps extends Pick<SliderRootProps, 'name' | 'disabled' |
35
35
  ui?: Slider['slots'];
36
36
  }
37
37
  export interface SliderEmits<T extends number | number[] = number | number[]> {
38
- (e: 'update:modelValue', payload: T): void;
39
- (e: 'change', payload: Event): void;
38
+ 'update:modelValue': [payload: T];
39
+ 'change': [payload: Event];
40
40
  }
41
41
  declare const _default: <T extends number | number[]>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
42
42
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
43
43
  readonly onChange?: ((payload: Event) => any) | undefined;
44
- readonly "onUpdate:modelValue"?: ((payload: T) => any) | undefined;
44
+ readonly "onUpdate:modelValue"?: ((...args: unknown[]) => any) | undefined;
45
45
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onChange" | "onUpdate:modelValue"> & (SliderProps & {
46
46
  modelValue?: T;
47
47
  }) & Partial<{}>> & import("vue").PublicProps;
48
48
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
49
49
  attrs: any;
50
50
  slots: {};
51
- emit: SliderEmits<T> & ((evt: "update:modelValue", value: T | undefined) => void);
51
+ emit: (((evt: "change", payload: Event) => void) & ((evt: "update:modelValue", payload: T) => void)) & ((evt: "update:modelValue", value: T | undefined) => void);
52
52
  }>) => import("vue").VNode & {
53
53
  __ctx?: Awaited<typeof __VLS_setup>;
54
54
  };
55
55
  export default _default;
56
56
  type __VLS_PrettifyLocal<T> = {
57
- [K in keyof T]: T[K];
57
+ [K in keyof T as K]: T[K];
58
58
  } & {};
@@ -81,5 +81,5 @@ declare const _default: <T extends StepperItem>(__VLS_props: NonNullable<Awaited
81
81
  };
82
82
  export default _default;
83
83
  type __VLS_PrettifyLocal<T> = {
84
- [K in keyof T]: T[K];
84
+ [K in keyof T as K]: T[K];
85
85
  } & {};
@@ -53,7 +53,7 @@ export interface SwitchSlots {
53
53
  }
54
54
  declare const _default: __VLS_WithSlots<import("vue").DefineComponent<SwitchProps & {
55
55
  modelValue?: boolean;
56
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
56
+ }, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
57
57
  change: (payload: Event) => any;
58
58
  "update:modelValue": (value: boolean) => any;
59
59
  }, string, import("vue").PublicProps, Readonly<SwitchProps & {
@@ -18,7 +18,7 @@ const props = defineProps({
18
18
  caption: { type: String, required: false },
19
19
  meta: { type: Object, required: false },
20
20
  empty: { type: String, required: false },
21
- sticky: { type: Boolean, required: false },
21
+ sticky: { type: [Boolean, String], required: false },
22
22
  loading: { type: Boolean, required: false },
23
23
  loadingColor: { type: null, required: false },
24
24
  loadingAnimation: { type: null, required: false },
@@ -38,6 +38,8 @@ const props = defineProps({
38
38
  paginationOptions: { type: Object, required: false },
39
39
  facetedOptions: { type: Object, required: false },
40
40
  onSelect: { type: Function, required: false },
41
+ onHover: { type: Function, required: false },
42
+ onContextmenu: { type: [Function, Array], required: false },
41
43
  class: { type: null, required: false },
42
44
  ui: { type: null, required: false },
43
45
  state: { type: Object, required: false },
@@ -69,6 +71,20 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.table || {} }
69
71
  loadingColor: props.loadingColor,
70
72
  loadingAnimation: props.loadingAnimation
71
73
  }));
74
+ const hasFooter = computed(() => {
75
+ function hasFooterRecursive(columns2) {
76
+ for (const column of columns2) {
77
+ if ("footer" in column) {
78
+ return true;
79
+ }
80
+ if ("columns" in column && hasFooterRecursive(column.columns)) {
81
+ return true;
82
+ }
83
+ }
84
+ return false;
85
+ }
86
+ return hasFooterRecursive(columns.value);
87
+ });
72
88
  const globalFilterState = defineModel("globalFilter", { type: String, ...{ default: void 0 } });
73
89
  const columnFiltersState = defineModel("columnFilters", { type: Array, ...{ default: [] } });
74
90
  const columnOrderState = defineModel("columnOrder", { type: Array, ...{ default: [] } });
@@ -86,7 +102,9 @@ const tableRef = ref(null);
86
102
  const tableApi = useVueTable({
87
103
  ...reactiveOmit(props, "as", "data", "columns", "caption", "sticky", "loading", "loadingColor", "loadingAnimation", "class", "ui"),
88
104
  data,
89
- columns: columns.value,
105
+ get columns() {
106
+ return columns.value;
107
+ },
90
108
  meta: meta.value,
91
109
  getCoreRowModel: getCoreRowModel(),
92
110
  ...props.globalFilterOptions || {},
@@ -162,7 +180,7 @@ const tableApi = useVueTable({
162
180
  function valueUpdater(updaterOrValue, ref2) {
163
181
  ref2.value = typeof updaterOrValue === "function" ? updaterOrValue(ref2.value) : updaterOrValue;
164
182
  }
165
- function handleRowSelect(row, e) {
183
+ function onRowSelect(e, row) {
166
184
  if (!props.onSelect) {
167
185
  return;
168
186
  }
@@ -175,6 +193,28 @@ function handleRowSelect(row, e) {
175
193
  e.stopPropagation();
176
194
  props.onSelect(row, e);
177
195
  }
196
+ function onRowHover(e, row) {
197
+ if (!props.onHover) {
198
+ return;
199
+ }
200
+ props.onHover(e, row);
201
+ }
202
+ function onRowContextmenu(e, row) {
203
+ if (!props.onContextmenu) {
204
+ return;
205
+ }
206
+ if (Array.isArray(props.onContextmenu)) {
207
+ props.onContextmenu.forEach((fn) => fn(e, row));
208
+ } else {
209
+ props.onContextmenu(e, row);
210
+ }
211
+ }
212
+ function resolveValue(prop, arg) {
213
+ if (typeof prop === "function") {
214
+ return prop(arg);
215
+ }
216
+ return prop;
217
+ }
178
218
  watch(
179
219
  () => props.data,
180
220
  () => {
@@ -203,11 +243,13 @@ defineExpose({
203
243
  v-for="header in headerGroup.headers"
204
244
  :key="header.id"
205
245
  :data-pinned="header.column.getIsPinned()"
246
+ :scope="header.colSpan > 1 ? 'colgroup' : 'col'"
206
247
  :colspan="header.colSpan > 1 ? header.colSpan : void 0"
248
+ :rowspan="header.rowSpan > 1 ? header.rowSpan : void 0"
207
249
  :class="ui.th({
208
250
  class: [
209
251
  props.ui?.th,
210
- typeof header.column.columnDef.meta?.class?.th === 'function' ? header.column.columnDef.meta.class.th(header) : header.column.columnDef.meta?.class?.th
252
+ resolveValue(header.column.columnDef.meta?.class?.th, header)
211
253
  ],
212
254
  pinned: !!header.column.getIsPinned()
213
255
  })"
@@ -228,29 +270,36 @@ defineExpose({
228
270
  <template v-for="row in tableApi.getRowModel().rows" :key="row.id">
229
271
  <tr
230
272
  :data-selected="row.getIsSelected()"
231
- :data-selectable="!!props.onSelect"
273
+ :data-selectable="!!props.onSelect || !!props.onHover || !!props.onContextmenu"
232
274
  :data-expanded="row.getIsExpanded()"
233
275
  :role="props.onSelect ? 'button' : void 0"
234
276
  :tabindex="props.onSelect ? 0 : void 0"
235
277
  :class="ui.tr({
236
278
  class: [
237
279
  props.ui?.tr,
238
- typeof tableApi.options.meta?.class?.tr === 'function' ? tableApi.options.meta.class.tr(row) : tableApi.options.meta?.class?.tr
280
+ resolveValue(tableApi.options.meta?.class?.tr, row)
239
281
  ]
240
282
  })"
241
- @click="handleRowSelect(row, $event)"
283
+ :style="resolveValue(tableApi.options.meta?.style?.tr, row)"
284
+ @click="onRowSelect($event, row)"
285
+ @pointerenter="onRowHover($event, row)"
286
+ @pointerleave="onRowHover($event, null)"
287
+ @contextmenu="onRowContextmenu($event, row)"
242
288
  >
243
289
  <td
244
290
  v-for="cell in row.getVisibleCells()"
245
291
  :key="cell.id"
246
292
  :data-pinned="cell.column.getIsPinned()"
293
+ :colspan="resolveValue(cell.column.columnDef.meta?.colspan?.td, cell)"
294
+ :rowspan="resolveValue(cell.column.columnDef.meta?.rowspan?.td, cell)"
247
295
  :class="ui.td({
248
296
  class: [
249
297
  props.ui?.td,
250
- typeof cell.column.columnDef.meta?.class?.td === 'function' ? cell.column.columnDef.meta.class.td(cell) : cell.column.columnDef.meta?.class?.td
298
+ resolveValue(cell.column.columnDef.meta?.class?.td, cell)
251
299
  ],
252
300
  pinned: !!cell.column.getIsPinned()
253
301
  })"
302
+ :style="resolveValue(cell.column.columnDef.meta?.style?.td, cell)"
254
303
  >
255
304
  <slot :name="`${cell.column.id}-cell`" v-bind="cell.getContext()">
256
305
  <FlexRender :render="cell.column.columnDef.cell" :props="cell.getContext()" />
@@ -281,6 +330,32 @@ defineExpose({
281
330
 
282
331
  <slot name="body-bottom" />
283
332
  </tbody>
333
+
334
+ <tfoot v-if="hasFooter" :class="ui.tfoot({ class: [props.ui?.tfoot] })">
335
+ <tr :class="ui.separator({ class: [props.ui?.separator] })" />
336
+
337
+ <tr v-for="footerGroup in tableApi.getFooterGroups()" :key="footerGroup.id" :class="ui.tr({ class: [props.ui?.tr] })">
338
+ <th
339
+ v-for="header in footerGroup.headers"
340
+ :key="header.id"
341
+ :data-pinned="header.column.getIsPinned()"
342
+ :colspan="header.colSpan > 1 ? header.colSpan : void 0"
343
+ :rowspan="header.rowSpan > 1 ? header.rowSpan : void 0"
344
+ :class="ui.th({
345
+ class: [
346
+ props.ui?.th,
347
+ resolveValue(header.column.columnDef.meta?.class?.th, header)
348
+ ],
349
+ pinned: !!header.column.getIsPinned()
350
+ })"
351
+ :style="resolveValue(header.column.columnDef.meta?.style?.th, header)"
352
+ >
353
+ <slot :name="`${header.id}-footer`" v-bind="header.getContext()">
354
+ <FlexRender v-if="!header.isPlaceholder" :render="header.column.columnDef.footer" :props="header.getContext()" />
355
+ </slot>
356
+ </th>
357
+ </tr>
358
+ </tfoot>
284
359
  </table>
285
360
  </Primitive>
286
361
  </template>
@@ -10,11 +10,24 @@ declare module '@tanstack/table-core' {
10
10
  th?: string | ((cell: Header<TData, TValue>) => string);
11
11
  td?: string | ((cell: Cell<TData, TValue>) => string);
12
12
  };
13
+ style?: {
14
+ th?: string | Record<string, string> | ((cell: Header<TData, TValue>) => string | Record<string, string>);
15
+ td?: string | Record<string, string> | ((cell: Cell<TData, TValue>) => string | Record<string, string>);
16
+ };
17
+ colspan?: {
18
+ td?: string | ((cell: Cell<TData, TValue>) => string);
19
+ };
20
+ rowspan?: {
21
+ td?: string | ((cell: Cell<TData, TValue>) => string);
22
+ };
13
23
  }
14
24
  interface TableMeta<TData> {
15
25
  class?: {
16
26
  tr?: string | ((row: Row<TData>) => string);
17
27
  };
28
+ style?: {
29
+ tr?: string | Record<string, string> | ((row: Row<TData>) => string | Record<string, string>);
30
+ };
18
31
  }
19
32
  }
20
33
  type Table = ComponentConfig<typeof theme, AppConfig, 'table'>;
@@ -42,10 +55,10 @@ export interface TableProps<T extends TableData = TableData> extends TableOption
42
55
  */
43
56
  empty?: string;
44
57
  /**
45
- * Whether the table should have a sticky header.
58
+ * Whether the table should have a sticky header or footer. True for both, 'header' for header only, 'footer' for footer only.
46
59
  * @defaultValue false
47
60
  */
48
- sticky?: boolean;
61
+ sticky?: boolean | 'header' | 'footer';
49
62
  /** Whether the table should be in loading state. */
50
63
  loading?: boolean;
51
64
  /**
@@ -124,10 +137,13 @@ export interface TableProps<T extends TableData = TableData> extends TableOption
124
137
  */
125
138
  facetedOptions?: FacetedOptions<T>;
126
139
  onSelect?: (row: TableRow<T>, e?: Event) => void;
140
+ onHover?: (e: Event, row: TableRow<T> | null) => void;
141
+ onContextmenu?: ((e: Event, row: TableRow<T>) => void) | Array<((e: Event, row: TableRow<T>) => void)>;
127
142
  class?: any;
128
143
  ui?: Table['slots'];
129
144
  }
130
145
  type DynamicHeaderSlots<T, K = keyof T> = Record<string, (props: HeaderContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-header`, (props: HeaderContext<T, unknown>) => any>;
146
+ type DynamicFooterSlots<T, K = keyof T> = Record<string, (props: HeaderContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-footer`, (props: HeaderContext<T, unknown>) => any>;
131
147
  type DynamicCellSlots<T, K = keyof T> = Record<string, (props: CellContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-cell`, (props: CellContext<T, unknown>) => any>;
132
148
  export type TableSlots<T extends TableData = TableData> = {
133
149
  'expanded': (props: {
@@ -138,7 +154,7 @@ export type TableSlots<T extends TableData = TableData> = {
138
154
  'caption': (props?: {}) => any;
139
155
  'body-top': (props?: {}) => any;
140
156
  'body-bottom': (props?: {}) => any;
141
- } & DynamicHeaderSlots<T> & DynamicCellSlots<T>;
157
+ } & DynamicHeaderSlots<T> & DynamicFooterSlots<T> & DynamicCellSlots<T>;
142
158
  declare const _default: <T extends TableData>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
143
159
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
144
160
  readonly "onUpdate:globalFilter"?: ((value: string) => any) | undefined;
@@ -181,5 +197,5 @@ declare const _default: <T extends TableData>(__VLS_props: NonNullable<Awaited<t
181
197
  };
182
198
  export default _default;
183
199
  type __VLS_PrettifyLocal<T> = {
184
- [K in keyof T]: T[K];
200
+ [K in keyof T as K]: T[K];
185
201
  } & {};
@@ -60,14 +60,23 @@ defineExpose({
60
60
  >
61
61
  <slot name="leading" :item="item" :index="index">
62
62
  <UIcon v-if="item.icon" :name="item.icon" :class="ui.leadingIcon({ class: [props.ui?.leadingIcon, item.ui?.leadingIcon] })" />
63
- <UAvatar v-else-if="item.avatar" :size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()" v-bind="item.avatar" :class="ui.leadingAvatar({ class: [props.ui?.leadingAvatar, item.ui?.leadingAvatar] })" />
63
+ <UAvatar v-else-if="item.avatar" :size="item.ui?.leadingAvatarSize || props.ui?.leadingAvatarSize || ui.leadingAvatarSize()" v-bind="item.avatar" :class="ui.leadingAvatar({ class: [props.ui?.leadingAvatar, item.ui?.leadingAvatar] })" />
64
64
  </slot>
65
65
 
66
66
  <span v-if="get(item, props.labelKey) || !!slots.default" :class="ui.label({ class: [props.ui?.label, item.ui?.label] })">
67
67
  <slot :item="item" :index="index">{{ get(item, props.labelKey) }}</slot>
68
68
  </span>
69
69
 
70
- <slot name="trailing" :item="item" :index="index" />
70
+ <slot name="trailing" :item="item" :index="index">
71
+ <UBadge
72
+ v-if="item.badge !== void 0"
73
+ color="neutral"
74
+ variant="outline"
75
+ :size="item.ui?.trailingBadgeSize || props.ui?.trailingBadgeSize || ui.trailingBadgeSize()"
76
+ v-bind="typeof item.badge === 'string' || typeof item.badge === 'number' ? { label: item.badge } : item.badge"
77
+ :class="ui.trailingBadge({ class: [props.ui?.trailingBadge, item.ui?.trailingBadge] })"
78
+ />
79
+ </slot>
71
80
  </TabsTrigger>
72
81
 
73
82
  <slot name="list-trailing" />
@@ -2,7 +2,7 @@ import type { ComponentPublicInstance } from 'vue';
2
2
  import type { TabsRootProps, TabsRootEmits } from 'reka-ui';
3
3
  import type { AppConfig } from '@nuxt/schema';
4
4
  import theme from '#build/ui/tabs';
5
- import type { AvatarProps } from '../types';
5
+ import type { AvatarProps, BadgeProps } from '../types';
6
6
  import type { DynamicSlots, ComponentConfig } from '../types/utils';
7
7
  type Tabs = ComponentConfig<typeof theme, AppConfig, 'tabs'>;
8
8
  export interface TabsItem {
@@ -12,13 +12,18 @@ export interface TabsItem {
12
12
  */
13
13
  icon?: string;
14
14
  avatar?: AvatarProps;
15
+ /**
16
+ * Display a badge on the item.
17
+ * `{ size: 'sm', color: 'neutral', variant: 'outline' }`{lang="ts-type"}
18
+ */
19
+ badge?: string | number | BadgeProps;
15
20
  slot?: string;
16
21
  content?: string;
17
22
  /** A unique value for the tab item. Defaults to the index. */
18
23
  value?: string | number;
19
24
  disabled?: boolean;
20
25
  class?: any;
21
- ui?: Pick<Tabs['slots'], 'trigger' | 'leadingIcon' | 'leadingAvatar' | 'label' | 'content'>;
26
+ ui?: Pick<Tabs['slots'], 'trigger' | 'leadingIcon' | 'leadingAvatar' | 'leadingAvatarSize' | 'label' | 'trailingBadge' | 'trailingBadgeSize' | 'content'>;
22
27
  [key: string]: any;
23
28
  }
24
29
  export interface TabsProps<T extends TabsItem = TabsItem> extends Pick<TabsRootProps<string | number>, 'defaultValue' | 'modelValue' | 'activationMode' | 'unmountOnHide'> {
@@ -89,5 +94,5 @@ declare const _default: <T extends TabsItem>(__VLS_props: NonNullable<Awaited<ty
89
94
  };
90
95
  export default _default;
91
96
  type __VLS_PrettifyLocal<T> = {
92
- [K in keyof T]: T[K];
97
+ [K in keyof T as K]: T[K];
93
98
  } & {};
@@ -5,6 +5,7 @@ import theme from "#build/ui/textarea";
5
5
  <script setup>
6
6
  import { ref, computed, onMounted, nextTick, watch } from "vue";
7
7
  import { Primitive } from "reka-ui";
8
+ import { useVModel } from "@vueuse/core";
8
9
  import { useAppConfig } from "#imports";
9
10
  import { useComponentIcons } from "../composables/useComponentIcons";
10
11
  import { useFormField } from "../composables/useFormField";
@@ -30,6 +31,8 @@ const props = defineProps({
30
31
  rows: { type: Number, required: false, default: 3 },
31
32
  maxrows: { type: Number, required: false, default: 0 },
32
33
  highlight: { type: Boolean, required: false },
34
+ modelValue: { type: null, required: false },
35
+ defaultValue: { type: null, required: false },
33
36
  modelModifiers: { type: Object, required: false },
34
37
  class: { type: null, required: false },
35
38
  ui: { type: null, required: false },
@@ -44,7 +47,7 @@ const props = defineProps({
44
47
  });
45
48
  const emits = defineEmits(["update:modelValue", "blur", "change"]);
46
49
  const slots = defineSlots();
47
- const [modelValue, modelModifiers] = defineModel({ type: null });
50
+ const modelValue = useVModel(props, "modelValue", emits, { defaultValue: props.defaultValue });
48
51
  const appConfig = useAppConfig();
49
52
  const { emitFormFocus, emitFormBlur, emitFormInput, emitFormChange, size, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props, { deferInputValidation: true });
50
53
  const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props);
@@ -60,13 +63,13 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.textarea || {
60
63
  }));
61
64
  const textareaRef = ref(null);
62
65
  function updateInput(value) {
63
- if (modelModifiers.trim) {
66
+ if (props.modelModifiers?.trim) {
64
67
  value = value?.trim() ?? null;
65
68
  }
66
- if (modelModifiers.number) {
69
+ if (props.modelModifiers?.number) {
67
70
  value = looseToNumber(value);
68
71
  }
69
- if (modelModifiers.nullify) {
72
+ if (props.modelModifiers?.nullify) {
70
73
  value ||= null;
71
74
  }
72
75
  modelValue.value = value;
@@ -74,16 +77,16 @@ function updateInput(value) {
74
77
  }
75
78
  function onInput(event) {
76
79
  autoResize();
77
- if (!modelModifiers.lazy) {
80
+ if (!props.modelModifiers?.lazy) {
78
81
  updateInput(event.target.value);
79
82
  }
80
83
  }
81
84
  function onChange(event) {
82
85
  const value = event.target.value;
83
- if (modelModifiers.lazy) {
86
+ if (props.modelModifiers?.lazy) {
84
87
  updateInput(value);
85
88
  }
86
- if (modelModifiers.trim) {
89
+ if (props.modelModifiers?.trim) {
87
90
  event.target.value = value.trim();
88
91
  }
89
92
  emitFormChange();