@nuxt/ui 3.1.3 → 3.2.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 (130) hide show
  1. package/.nuxt/ui/avatar.ts +1 -1
  2. package/.nuxt/ui/card.ts +1 -1
  3. package/.nuxt/ui/carousel.ts +1 -1
  4. package/.nuxt/ui/command-palette.ts +1 -0
  5. package/.nuxt/ui/drawer.ts +1 -1
  6. package/.nuxt/ui/index.ts +2 -0
  7. package/.nuxt/ui/input-menu.ts +24 -10
  8. package/.nuxt/ui/input-tags.ts +310 -0
  9. package/.nuxt/ui/modal.ts +1 -1
  10. package/.nuxt/ui/navigation-menu.ts +1 -1
  11. package/.nuxt/ui/select-menu.ts +11 -6
  12. package/.nuxt/ui/select.ts +11 -6
  13. package/.nuxt/ui/table.ts +3 -2
  14. package/.nuxt/ui/timeline.ts +321 -0
  15. package/.nuxt/ui/toaster.ts +1 -1
  16. package/cli/templates.mjs +7 -4
  17. package/dist/module.json +1 -1
  18. package/dist/module.mjs +2 -2
  19. package/dist/runtime/components/Alert.vue +0 -1
  20. package/dist/runtime/components/Avatar.vue +10 -2
  21. package/dist/runtime/components/Avatar.vue.d.ts +2 -0
  22. package/dist/runtime/components/Calendar.vue +4 -1
  23. package/dist/runtime/components/Carousel.vue +1 -2
  24. package/dist/runtime/components/Checkbox.vue +1 -1
  25. package/dist/runtime/components/CommandPalette.vue +80 -16
  26. package/dist/runtime/components/CommandPalette.vue.d.ts +32 -8
  27. package/dist/runtime/components/ContextMenuContent.vue.d.ts +4 -20
  28. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +4 -20
  29. package/dist/runtime/components/Form.vue +6 -6
  30. package/dist/runtime/components/Form.vue.d.ts +12 -11
  31. package/dist/runtime/components/InputMenu.vue.d.ts +4 -4
  32. package/dist/runtime/components/InputNumber.vue +3 -2
  33. package/dist/runtime/components/InputNumber.vue.d.ts +1 -1
  34. package/dist/runtime/components/InputTags.vue +159 -0
  35. package/dist/runtime/components/InputTags.vue.d.ts +183 -0
  36. package/dist/runtime/components/Modal.vue +14 -13
  37. package/dist/runtime/components/Modal.vue.d.ts +14 -4
  38. package/dist/runtime/components/NavigationMenu.vue +16 -15
  39. package/dist/runtime/components/OverlayProvider.vue +2 -2
  40. package/dist/runtime/components/Pagination.vue +1 -1
  41. package/dist/runtime/components/Pagination.vue.d.ts +0 -1
  42. package/dist/runtime/components/PinInput.vue +4 -3
  43. package/dist/runtime/components/PinInput.vue.d.ts +22 -19
  44. package/dist/runtime/components/Progress.vue +2 -1
  45. package/dist/runtime/components/Progress.vue.d.ts +1 -1
  46. package/dist/runtime/components/RadioGroup.vue +2 -2
  47. package/dist/runtime/components/Select.vue +23 -4
  48. package/dist/runtime/components/Select.vue.d.ts +107 -1
  49. package/dist/runtime/components/SelectMenu.vue +24 -5
  50. package/dist/runtime/components/SelectMenu.vue.d.ts +105 -1
  51. package/dist/runtime/components/Slideover.vue +14 -13
  52. package/dist/runtime/components/Slideover.vue.d.ts +14 -4
  53. package/dist/runtime/components/Table.vue +7 -1
  54. package/dist/runtime/components/Table.vue.d.ts +10 -8
  55. package/dist/runtime/components/Tabs.vue +13 -2
  56. package/dist/runtime/components/Tabs.vue.d.ts +4 -1
  57. package/dist/runtime/components/Textarea.vue.d.ts +4 -3
  58. package/dist/runtime/components/Timeline.vue +92 -0
  59. package/dist/runtime/components/Timeline.vue.d.ts +70 -0
  60. package/dist/runtime/components/Toast.vue +4 -5
  61. package/dist/runtime/components/Tree.vue +3 -2
  62. package/dist/runtime/components/Tree.vue.d.ts +1 -1
  63. package/dist/runtime/composables/defineLocale.d.ts +2 -0
  64. package/dist/runtime/composables/defineLocale.js +4 -0
  65. package/dist/runtime/composables/defineShortcuts.js +2 -2
  66. package/dist/runtime/composables/useOverlay.d.ts +2 -1
  67. package/dist/runtime/composables/useOverlay.js +7 -6
  68. package/dist/runtime/locale/ar.js +2 -1
  69. package/dist/runtime/locale/az.js +2 -1
  70. package/dist/runtime/locale/bg.js +2 -1
  71. package/dist/runtime/locale/bn.js +2 -1
  72. package/dist/runtime/locale/ca.js +2 -1
  73. package/dist/runtime/locale/ckb.js +2 -1
  74. package/dist/runtime/locale/cs.js +2 -1
  75. package/dist/runtime/locale/da.js +2 -1
  76. package/dist/runtime/locale/de.js +2 -1
  77. package/dist/runtime/locale/el.js +2 -1
  78. package/dist/runtime/locale/en.js +2 -1
  79. package/dist/runtime/locale/es.js +2 -1
  80. package/dist/runtime/locale/et.js +2 -1
  81. package/dist/runtime/locale/fa_ir.js +2 -1
  82. package/dist/runtime/locale/fi.js +2 -1
  83. package/dist/runtime/locale/fr.js +2 -1
  84. package/dist/runtime/locale/he.js +2 -1
  85. package/dist/runtime/locale/hi.js +2 -1
  86. package/dist/runtime/locale/hu.js +2 -1
  87. package/dist/runtime/locale/hy.js +2 -1
  88. package/dist/runtime/locale/id.js +2 -1
  89. package/dist/runtime/locale/index.d.ts +1 -0
  90. package/dist/runtime/locale/index.js +1 -0
  91. package/dist/runtime/locale/it.js +2 -1
  92. package/dist/runtime/locale/ja.js +2 -1
  93. package/dist/runtime/locale/kk.js +2 -1
  94. package/dist/runtime/locale/km.js +2 -1
  95. package/dist/runtime/locale/ko.js +2 -1
  96. package/dist/runtime/locale/ky.js +2 -1
  97. package/dist/runtime/locale/lb.d.ts +3 -0
  98. package/dist/runtime/locale/lb.js +55 -0
  99. package/dist/runtime/locale/lt.js +2 -1
  100. package/dist/runtime/locale/mn.js +2 -1
  101. package/dist/runtime/locale/ms.js +2 -1
  102. package/dist/runtime/locale/nb_no.js +2 -1
  103. package/dist/runtime/locale/nl.js +2 -1
  104. package/dist/runtime/locale/pl.js +2 -1
  105. package/dist/runtime/locale/pt.js +2 -1
  106. package/dist/runtime/locale/pt_br.js +2 -1
  107. package/dist/runtime/locale/ro.js +2 -1
  108. package/dist/runtime/locale/ru.js +2 -1
  109. package/dist/runtime/locale/sk.js +2 -1
  110. package/dist/runtime/locale/sl.js +2 -1
  111. package/dist/runtime/locale/sv.js +2 -1
  112. package/dist/runtime/locale/th.js +2 -1
  113. package/dist/runtime/locale/tj.js +2 -1
  114. package/dist/runtime/locale/tr.js +2 -1
  115. package/dist/runtime/locale/ug_cn.js +2 -1
  116. package/dist/runtime/locale/uk.js +2 -1
  117. package/dist/runtime/locale/ur.js +2 -1
  118. package/dist/runtime/locale/uz.js +2 -1
  119. package/dist/runtime/locale/vi.js +2 -1
  120. package/dist/runtime/locale/zh_cn.js +2 -1
  121. package/dist/runtime/locale/zh_tw.js +2 -1
  122. package/dist/runtime/types/form.d.ts +11 -10
  123. package/dist/runtime/types/index.d.ts +2 -0
  124. package/dist/runtime/types/index.js +2 -0
  125. package/dist/runtime/types/locale.d.ts +1 -0
  126. package/dist/runtime/types/utils.d.ts +3 -0
  127. package/dist/shared/{ui.Bix4DSU4.mjs → ui.BPVxSPGY.mjs} +282 -26
  128. package/dist/unplugin.mjs +1 -1
  129. package/dist/vite.mjs +1 -1
  130. package/package.json +28 -29
@@ -3,7 +3,7 @@ import theme from "#build/ui/command-palette";
3
3
  </script>
4
4
 
5
5
  <script setup>
6
- import { computed } from "vue";
6
+ import { computed, ref, useTemplateRef } from "vue";
7
7
  import { ListboxRoot, ListboxFilter, ListboxContent, ListboxGroup, ListboxGroupLabel, ListboxItem, ListboxItemIndicator, useForwardProps, useForwardPropsEmits } from "reka-ui";
8
8
  import { defu } from "defu";
9
9
  import { reactivePick } from "@vueuse/core";
@@ -26,10 +26,13 @@ const props = defineProps({
26
26
  as: { type: null, required: false },
27
27
  icon: { type: String, required: false },
28
28
  selectedIcon: { type: String, required: false },
29
+ trailingIcon: { type: String, required: false },
29
30
  placeholder: { type: String, required: false },
30
31
  autofocus: { type: Boolean, required: false, default: true },
31
32
  close: { type: [Boolean, Object], required: false },
32
33
  closeIcon: { type: String, required: false },
34
+ back: { type: [Boolean, Object], required: false, default: true },
35
+ backIcon: { type: String, required: false },
33
36
  groups: { type: Array, required: false },
34
37
  fuse: { type: Object, required: false },
35
38
  labelKey: { type: String, required: false, default: "label" },
@@ -40,6 +43,7 @@ const props = defineProps({
40
43
  modelValue: { type: null, required: false, default: "" },
41
44
  defaultValue: { type: null, required: false },
42
45
  highlightOnHover: { type: Boolean, required: false },
46
+ selectionBehavior: { type: String, required: false },
43
47
  loading: { type: Boolean, required: false },
44
48
  loadingIcon: { type: String, required: false }
45
49
  });
@@ -48,7 +52,7 @@ const slots = defineSlots();
48
52
  const searchTerm = defineModel("searchTerm", { type: String, ...{ default: "" } });
49
53
  const { t } = useLocale();
50
54
  const appConfig = useAppConfig();
51
- const rootProps = useForwardPropsEmits(reactivePick(props, "as", "disabled", "multiple", "modelValue", "defaultValue", "highlightOnHover"), emits);
55
+ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "disabled", "multiple", "modelValue", "defaultValue", "highlightOnHover", "selectionBehavior"), emits);
52
56
  const inputProps = useForwardProps(reactivePick(props, "loading", "loadingIcon"));
53
57
  const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.commandPalette || {} })());
54
58
  const fuse = computed(() => defu({}, props.fuse, {
@@ -60,7 +64,10 @@ const fuse = computed(() => defu({}, props.fuse, {
60
64
  resultLimit: 12,
61
65
  matchAllWhenSearchEmpty: true
62
66
  }));
63
- const items = computed(() => props.groups?.filter((group) => {
67
+ const history = ref([]);
68
+ const placeholder = computed(() => history.value[history.value.length - 1]?.placeholder || props.placeholder || t("commandPalette.placeholder"));
69
+ const groups = computed(() => history.value?.length ? [history.value[history.value.length - 1]] : props.groups);
70
+ const items = computed(() => groups.value?.filter((group) => {
64
71
  if (!group.id) {
65
72
  console.warn(`[@nuxt/ui] CommandPalette group is missing an \`id\` property`);
66
73
  return false;
@@ -69,7 +76,7 @@ const items = computed(() => props.groups?.filter((group) => {
69
76
  return false;
70
77
  }
71
78
  return true;
72
- }).flatMap((group) => group.items?.map((item) => ({ ...item, group: group.id })) || []) || []);
79
+ })?.flatMap((group) => group.items?.map((item) => ({ ...item, group: group.id })) || []) || []);
73
80
  const { results: fuseResults } = useFuse(searchTerm, items, fuse);
74
81
  function getGroupWithItems(group, items2) {
75
82
  if (group?.postFilter && typeof group.postFilter === "function") {
@@ -86,7 +93,7 @@ function getGroupWithItems(group, items2) {
86
93
  })
87
94
  };
88
95
  }
89
- const groups = computed(() => {
96
+ const filteredGroups = computed(() => {
90
97
  const groupsById = fuseResults.value.reduce((acc, result) => {
91
98
  const { item, matches } = result;
92
99
  if (!item.group) {
@@ -97,37 +104,87 @@ const groups = computed(() => {
97
104
  return acc;
98
105
  }, {});
99
106
  const fuseGroups = Object.entries(groupsById).map(([id, items2]) => {
100
- const group = props.groups?.find((group2) => group2.id === id);
107
+ const group = groups.value?.find((group2) => group2.id === id);
101
108
  if (!group) {
102
109
  return;
103
110
  }
104
111
  return getGroupWithItems(group, items2);
105
112
  }).filter((group) => !!group);
106
- const nonFuseGroups = props.groups?.map((group, index) => ({ ...group, index }))?.filter((group) => group.ignoreFilter && group.items?.length)?.map((group) => ({ ...getGroupWithItems(group, group.items || []), index: group.index })) || [];
113
+ const nonFuseGroups = groups.value?.map((group, index) => ({ ...group, index }))?.filter((group) => group.ignoreFilter && group.items?.length)?.map((group) => ({ ...getGroupWithItems(group, group.items || []), index: group.index })) || [];
107
114
  return nonFuseGroups.reduce((acc, group) => {
108
115
  acc.splice(group.index, 0, group);
109
116
  return acc;
110
117
  }, [...fuseGroups]);
111
118
  });
119
+ const listboxRootRef = useTemplateRef("listboxRootRef");
120
+ function navigate(item) {
121
+ if (!item.children?.length) {
122
+ return;
123
+ }
124
+ history.value.push({
125
+ id: `history-${history.value.length}`,
126
+ label: item.label,
127
+ slot: item.slot,
128
+ placeholder: item.placeholder,
129
+ items: item.children
130
+ });
131
+ searchTerm.value = "";
132
+ listboxRootRef.value?.highlightFirstItem();
133
+ }
134
+ function navigateBack() {
135
+ if (!history.value.length) {
136
+ return;
137
+ }
138
+ history.value.pop();
139
+ searchTerm.value = "";
140
+ listboxRootRef.value?.highlightFirstItem();
141
+ }
142
+ function onBackspace() {
143
+ if (!searchTerm.value) {
144
+ navigateBack();
145
+ }
146
+ }
147
+ function onSelect(e, item) {
148
+ if (item.children?.length) {
149
+ e.preventDefault();
150
+ navigate(item);
151
+ } else {
152
+ item.onSelect?.(e);
153
+ }
154
+ }
112
155
  </script>
113
156
 
114
157
  <template>
115
- <ListboxRoot v-bind="rootProps" :class="ui.root({ class: [props.ui?.root, props.class] })">
158
+ <ListboxRoot v-bind="rootProps" ref="listboxRootRef" :class="ui.root({ class: [props.ui?.root, props.class] })">
116
159
  <ListboxFilter v-model="searchTerm" as-child>
117
160
  <UInput
118
- :placeholder="placeholder || t('commandPalette.placeholder')"
161
+ :placeholder="placeholder"
119
162
  variant="none"
120
163
  :autofocus="autofocus"
121
164
  v-bind="inputProps"
122
165
  :icon="icon || appConfig.ui.icons.search"
123
166
  :class="ui.input({ class: props.ui?.input })"
167
+ @keydown.backspace="onBackspace"
124
168
  >
169
+ <template v-if="history?.length && (back || !!slots.back)" #leading>
170
+ <slot name="back" :ui="ui">
171
+ <UButton
172
+ :icon="backIcon || appConfig.ui.icons.arrowLeft"
173
+ color="neutral"
174
+ variant="link"
175
+ :aria-label="t('commandPalette.back')"
176
+ v-bind="typeof back === 'object' ? back : {}"
177
+ :class="ui.back({ class: props.ui?.back })"
178
+ @click="navigateBack"
179
+ />
180
+ </slot>
181
+ </template>
182
+
125
183
  <template v-if="close || !!slots.close" #trailing>
126
184
  <slot name="close" :ui="ui">
127
185
  <UButton
128
186
  v-if="close"
129
187
  :icon="closeIcon || appConfig.ui.icons.close"
130
- size="md"
131
188
  color="neutral"
132
189
  variant="ghost"
133
190
  :aria-label="t('commandPalette.close')"
@@ -141,8 +198,8 @@ const groups = computed(() => {
141
198
  </ListboxFilter>
142
199
 
143
200
  <ListboxContent :class="ui.content({ class: props.ui?.content })">
144
- <div v-if="groups?.length" role="presentation" :class="ui.viewport({ class: props.ui?.viewport })">
145
- <ListboxGroup v-for="group in groups" :key="`group-${group.id}`" :class="ui.group({ class: props.ui?.group })">
201
+ <div v-if="filteredGroups?.length" role="presentation" :class="ui.viewport({ class: props.ui?.viewport })">
202
+ <ListboxGroup v-for="group in filteredGroups" :key="`group-${group.id}`" :class="ui.group({ class: props.ui?.group })">
146
203
  <ListboxGroupLabel v-if="get(group, props.labelKey)" :class="ui.label({ class: props.ui?.label })">
147
204
  {{ get(group, props.labelKey) }}
148
205
  </ListboxGroupLabel>
@@ -150,10 +207,10 @@ const groups = computed(() => {
150
207
  <ListboxItem
151
208
  v-for="(item, index) in group.items"
152
209
  :key="`group-${group.id}-${index}`"
153
- :value="omit(item, ['matches', 'group', 'onSelect', 'labelHtml', 'suffixHtml'])"
210
+ :value="omit(item, ['matches', 'group', 'onSelect', 'labelHtml', 'suffixHtml', 'children'])"
154
211
  :disabled="item.disabled"
155
212
  as-child
156
- @select="item.onSelect"
213
+ @select="onSelect($event, item)"
157
214
  >
158
215
  <ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
159
216
  <ULinkBase v-bind="slotProps" :class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class], active: active || item.active })">
@@ -184,13 +241,20 @@ const groups = computed(() => {
184
241
 
185
242
  <span :class="ui.itemTrailing({ class: [props.ui?.itemTrailing, item.ui?.itemTrailing] })">
186
243
  <slot :name="item.slot ? `${item.slot}-trailing` : group.slot ? `${group.slot}-trailing` : `item-trailing`" :item="item" :index="index">
187
- <span v-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: [props.ui?.itemTrailingKbds, item.ui?.itemTrailingKbds] })">
244
+ <UIcon
245
+ v-if="item.children && item.children.length > 0"
246
+ :name="trailingIcon || appConfig.ui.icons.chevronRight"
247
+ :class="ui.itemTrailingIcon({ class: [props.ui?.itemTrailingIcon, item.ui?.itemTrailingIcon] })"
248
+ />
249
+
250
+ <span v-else-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: [props.ui?.itemTrailingKbds, item.ui?.itemTrailingKbds] })">
188
251
  <UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="item.ui?.itemTrailingKbdsSize || props.ui?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
189
252
  </span>
253
+
190
254
  <UIcon v-else-if="group.highlightedIcon" :name="group.highlightedIcon" :class="ui.itemTrailingHighlightedIcon({ class: [props.ui?.itemTrailingHighlightedIcon, item.ui?.itemTrailingHighlightedIcon] })" />
191
255
  </slot>
192
256
 
193
- <ListboxItemIndicator as-child>
257
+ <ListboxItemIndicator v-if="!item.children?.length" as-child>
194
258
  <UIcon :name="selectedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: [props.ui?.itemTrailingIcon, item.ui?.itemTrailingIcon] })" />
195
259
  </ListboxItemIndicator>
196
260
  </span>
@@ -21,12 +21,17 @@ export interface CommandPaletteItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
21
21
  loading?: boolean;
22
22
  disabled?: boolean;
23
23
  slot?: string;
24
+ /**
25
+ * The placeholder to display when the item has children.
26
+ */
27
+ placeholder?: string;
28
+ children?: CommandPaletteItem[];
24
29
  onSelect?(e?: Event): void;
25
30
  class?: any;
26
31
  ui?: Pick<CommandPalette['slots'], 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemLabel' | 'itemLabelPrefix' | 'itemLabelBase' | 'itemLabelSuffix' | 'itemTrailing' | 'itemTrailingKbds' | 'itemTrailingKbdsSize' | 'itemTrailingHighlightedIcon' | 'itemTrailingIcon'>;
27
32
  [key: string]: any;
28
33
  }
29
- export interface CommandPaletteGroup<T> {
34
+ export interface CommandPaletteGroup<T extends CommandPaletteItem = CommandPaletteItem> {
30
35
  id: string;
31
36
  label?: string;
32
37
  slot?: string;
@@ -45,7 +50,7 @@ export interface CommandPaletteGroup<T> {
45
50
  */
46
51
  highlightedIcon?: string;
47
52
  }
48
- export interface CommandPaletteProps<G, T> extends Pick<ListboxRootProps, 'multiple' | 'disabled' | 'modelValue' | 'defaultValue' | 'highlightOnHover'>, Pick<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
53
+ export interface CommandPaletteProps<G extends CommandPaletteGroup<T> = CommandPaletteGroup<any>, T extends CommandPaletteItem = CommandPaletteItem> extends Pick<ListboxRootProps, 'multiple' | 'disabled' | 'modelValue' | 'defaultValue' | 'highlightOnHover' | 'selectionBehavior'>, Pick<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
49
54
  /**
50
55
  * The element or component this component should render as.
51
56
  * @defaultValue 'div'
@@ -63,6 +68,12 @@ export interface CommandPaletteProps<G, T> extends Pick<ListboxRootProps, 'multi
63
68
  * @IconifyIcon
64
69
  */
65
70
  selectedIcon?: string;
71
+ /**
72
+ * The icon displayed when an item has children.
73
+ * @defaultValue appConfig.ui.icons.chevronRight
74
+ * @IconifyIcon
75
+ */
76
+ trailingIcon?: string;
66
77
  /**
67
78
  * The placeholder text for the input.
68
79
  * @defaultValue t('commandPalette.placeholder')
@@ -86,6 +97,18 @@ export interface CommandPaletteProps<G, T> extends Pick<ListboxRootProps, 'multi
86
97
  * @IconifyIcon
87
98
  */
88
99
  closeIcon?: string;
100
+ /**
101
+ * Display a button to navigate back in history.
102
+ * `{ size: 'md', color: 'neutral', variant: 'link' }`{lang="ts-type"}
103
+ * @defaultValue true
104
+ */
105
+ back?: boolean | ButtonProps;
106
+ /**
107
+ * The icon displayed in the back button.
108
+ * @defaultValue appConfig.ui.icons.arrowLeft
109
+ * @IconifyIcon
110
+ */
111
+ backIcon?: string;
89
112
  groups?: G[];
90
113
  /**
91
114
  * Options for [useFuse](https://vueuse.org/integrations/useFuse).
@@ -108,21 +131,22 @@ export interface CommandPaletteProps<G, T> extends Pick<ListboxRootProps, 'multi
108
131
  class?: any;
109
132
  ui?: CommandPalette['slots'];
110
133
  }
111
- export type CommandPaletteEmits<T> = ListboxRootEmits<T> & {
134
+ export type CommandPaletteEmits<T extends CommandPaletteItem = CommandPaletteItem> = ListboxRootEmits<T> & {
112
135
  'update:open': [value: boolean];
113
136
  };
114
137
  type SlotProps<T> = (props: {
115
138
  item: T;
116
139
  index: number;
117
140
  }) => any;
118
- export type CommandPaletteSlots<G extends {
119
- slot?: string;
120
- }, T extends {
121
- slot?: string;
122
- }> = {
141
+ export type CommandPaletteSlots<G extends CommandPaletteGroup<T> = CommandPaletteGroup<any>, T extends CommandPaletteItem = CommandPaletteItem> = {
123
142
  'empty'(props: {
124
143
  searchTerm?: string;
125
144
  }): any;
145
+ 'back'(props: {
146
+ ui: {
147
+ [K in keyof Required<CommandPalette['slots']>]: (props?: Record<string, any>) => string;
148
+ };
149
+ }): any;
126
150
  'close'(props: {
127
151
  ui: {
128
152
  [K in keyof Required<CommandPalette['slots']>]: (props?: Record<string, any>) => string;
@@ -31,31 +31,15 @@ interface ContextMenuContentProps<T extends ArrayOrNested<ContextMenuItem>> exte
31
31
  declare const _default: <T extends ArrayOrNested<ContextMenuItem>>(__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<{
32
32
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
33
33
  readonly onEscapeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
34
- readonly onPointerDownOutside?: ((event: CustomEvent<{
35
- originalEvent: PointerEvent;
36
- }>) => any) | undefined;
37
- readonly onFocusOutside?: ((event: CustomEvent<{
38
- originalEvent: FocusEvent;
39
- }>) => any) | undefined;
40
- readonly onInteractOutside?: ((event: CustomEvent<{
41
- originalEvent: PointerEvent;
42
- }> | CustomEvent<{
43
- originalEvent: FocusEvent;
44
- }>) => any) | undefined;
34
+ readonly onPointerDownOutside?: ((event: import("reka-ui").PointerDownOutsideEvent) => any) | undefined;
35
+ readonly onFocusOutside?: ((event: import("reka-ui").FocusOutsideEvent) => any) | undefined;
36
+ readonly onInteractOutside?: ((event: import("reka-ui").PointerDownOutsideEvent | import("reka-ui").FocusOutsideEvent) => any) | undefined;
45
37
  readonly onCloseAutoFocus?: ((event: Event) => any) | undefined;
46
38
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onEscapeKeyDown" | "onPointerDownOutside" | "onFocusOutside" | "onInteractOutside" | "onCloseAutoFocus"> & ContextMenuContentProps<T> & Partial<{}>> & import("vue").PublicProps;
47
39
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
48
40
  attrs: any;
49
41
  slots: ContextMenuSlots<T>;
50
- emit: ((evt: "escapeKeyDown", event: KeyboardEvent) => void) & ((evt: "pointerDownOutside", event: CustomEvent<{
51
- originalEvent: PointerEvent;
52
- }>) => void) & ((evt: "focusOutside", event: CustomEvent<{
53
- originalEvent: FocusEvent;
54
- }>) => void) & ((evt: "interactOutside", event: CustomEvent<{
55
- originalEvent: PointerEvent;
56
- }> | CustomEvent<{
57
- originalEvent: FocusEvent;
58
- }>) => void) & ((evt: "closeAutoFocus", event: Event) => void);
42
+ emit: ((evt: "escapeKeyDown", event: KeyboardEvent) => void) & ((evt: "pointerDownOutside", event: import("reka-ui").PointerDownOutsideEvent) => void) & ((evt: "focusOutside", event: import("reka-ui").FocusOutsideEvent) => void) & ((evt: "interactOutside", event: import("reka-ui").PointerDownOutsideEvent | import("reka-ui").FocusOutsideEvent) => void) & ((evt: "closeAutoFocus", event: Event) => void);
59
43
  }>) => import("vue").VNode & {
60
44
  __ctx?: Awaited<typeof __VLS_setup>;
61
45
  };
@@ -34,31 +34,15 @@ type DropdownMenuContentSlots<T extends ArrayOrNested<DropdownMenuItem>> = Omit<
34
34
  declare const _default: <T extends ArrayOrNested<DropdownMenuItem>>(__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<{
35
35
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
36
36
  readonly onEscapeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
37
- readonly onPointerDownOutside?: ((event: CustomEvent<{
38
- originalEvent: PointerEvent;
39
- }>) => any) | undefined;
40
- readonly onFocusOutside?: ((event: CustomEvent<{
41
- originalEvent: FocusEvent;
42
- }>) => any) | undefined;
43
- readonly onInteractOutside?: ((event: CustomEvent<{
44
- originalEvent: PointerEvent;
45
- }> | CustomEvent<{
46
- originalEvent: FocusEvent;
47
- }>) => any) | undefined;
37
+ readonly onPointerDownOutside?: ((event: import("reka-ui").PointerDownOutsideEvent) => any) | undefined;
38
+ readonly onFocusOutside?: ((event: import("reka-ui").FocusOutsideEvent) => any) | undefined;
39
+ readonly onInteractOutside?: ((event: import("reka-ui").PointerDownOutsideEvent | import("reka-ui").FocusOutsideEvent) => any) | undefined;
48
40
  readonly onCloseAutoFocus?: ((event: Event) => any) | undefined;
49
41
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onEscapeKeyDown" | "onPointerDownOutside" | "onFocusOutside" | "onInteractOutside" | "onCloseAutoFocus"> & DropdownMenuContentProps<T> & Partial<{}>> & import("vue").PublicProps;
50
42
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
51
43
  attrs: any;
52
44
  slots: DropdownMenuContentSlots<T>;
53
- emit: ((evt: "escapeKeyDown", event: KeyboardEvent) => void) & ((evt: "pointerDownOutside", event: CustomEvent<{
54
- originalEvent: PointerEvent;
55
- }>) => void) & ((evt: "focusOutside", event: CustomEvent<{
56
- originalEvent: FocusEvent;
57
- }>) => void) & ((evt: "interactOutside", event: CustomEvent<{
58
- originalEvent: PointerEvent;
59
- }> | CustomEvent<{
60
- originalEvent: FocusEvent;
61
- }>) => void) & ((evt: "closeAutoFocus", event: Event) => void);
45
+ emit: ((evt: "escapeKeyDown", event: KeyboardEvent) => void) & ((evt: "pointerDownOutside", event: import("reka-ui").PointerDownOutsideEvent) => void) & ((evt: "focusOutside", event: import("reka-ui").FocusOutsideEvent) => void) & ((evt: "interactOutside", event: import("reka-ui").PointerDownOutsideEvent | import("reka-ui").FocusOutsideEvent) => void) & ((evt: "closeAutoFocus", event: Event) => void);
62
46
  }>) => import("vue").VNode & {
63
47
  __ctx?: Awaited<typeof __VLS_setup>;
64
48
  };
@@ -3,7 +3,7 @@ import theme from "#build/ui/form";
3
3
  </script>
4
4
 
5
5
  <script setup>
6
- import { provide, inject, nextTick, ref, onUnmounted, onMounted, computed, useId, readonly } from "vue";
6
+ import { provide, inject, nextTick, ref, onUnmounted, onMounted, computed, useId, readonly, reactive } from "vue";
7
7
  import { useEventBus } from "@vueuse/core";
8
8
  import { useAppConfig } from "#imports";
9
9
  import { formOptionsInjectionKey, formInputsInjectionKey, formBusInjectionKey, formLoadingInjectionKey } from "../composables/useFormField";
@@ -20,7 +20,7 @@ const props = defineProps({
20
20
  } },
21
21
  disabled: { type: Boolean, required: false },
22
22
  validateOnInputDelay: { type: Number, required: false, default: 300 },
23
- transform: { type: Boolean, required: false, default: true },
23
+ transform: { type: null, required: false, default: () => true },
24
24
  attach: { type: Boolean, required: false, default: true },
25
25
  loadingAuto: { type: Boolean, required: false, default: true },
26
26
  class: { type: null, required: false },
@@ -80,9 +80,9 @@ const errors = ref([]);
80
80
  provide("form-errors", errors);
81
81
  const inputs = ref({});
82
82
  provide(formInputsInjectionKey, inputs);
83
- const dirtyFields = /* @__PURE__ */ new Set();
84
- const touchedFields = /* @__PURE__ */ new Set();
85
- const blurredFields = /* @__PURE__ */ new Set();
83
+ const dirtyFields = reactive(/* @__PURE__ */ new Set());
84
+ const touchedFields = reactive(/* @__PURE__ */ new Set());
85
+ const blurredFields = reactive(/* @__PURE__ */ new Set());
86
86
  function resolveErrorIds(errs) {
87
87
  return errs.map((err) => ({
88
88
  ...err,
@@ -205,6 +205,6 @@ defineExpose({
205
205
  :class="ui({ class: props.class })"
206
206
  @submit.prevent="onSubmitWrapper"
207
207
  >
208
- <slot :errors="errors" />
208
+ <slot :errors="errors" :loading="loading" />
209
209
  </component>
210
210
  </template>
@@ -1,5 +1,5 @@
1
- import type { FormSchema, FormError, FormInputEvents, FormErrorEvent, FormSubmitEvent, Form, InferInput, InferOutput } from '../types/form';
2
- export interface FormProps<S extends FormSchema> {
1
+ import type { FormSchema, FormError, FormInputEvents, FormErrorEvent, FormSubmitEvent, Form, InferInput, FormData } from '../types/form';
2
+ export interface FormProps<S extends FormSchema, T extends boolean = true> {
3
3
  id?: string | number;
4
4
  /** Schema to validate the form state. Supports Standard Schema objects, Yup, Joi, and Superstructs. */
5
5
  schema?: S;
@@ -27,7 +27,7 @@ export interface FormProps<S extends FormSchema> {
27
27
  * If true, schema transformations will be applied to the state on submit.
28
28
  * @defaultValue `true`
29
29
  */
30
- transform?: boolean;
30
+ transform?: T;
31
31
  /**
32
32
  * If true, this form will attach to its parent Form (if any) and validate at the same time.
33
33
  * @defaultValue `true`
@@ -40,26 +40,27 @@ export interface FormProps<S extends FormSchema> {
40
40
  */
41
41
  loadingAuto?: boolean;
42
42
  class?: any;
43
- onSubmit?: ((event: FormSubmitEvent<InferOutput<S>>) => void | Promise<void>) | (() => void | Promise<void>);
43
+ onSubmit?: ((event: FormSubmitEvent<FormData<S, T>>) => void | Promise<void>) | (() => void | Promise<void>);
44
44
  }
45
- export interface FormEmits<S extends FormSchema> {
46
- (e: 'submit', payload: FormSubmitEvent<InferOutput<S>>): void;
45
+ export interface FormEmits<S extends FormSchema, T extends boolean = true> {
46
+ (e: 'submit', payload: FormSubmitEvent<FormData<S, T>>): void;
47
47
  (e: 'error', payload: FormErrorEvent): void;
48
48
  }
49
49
  export interface FormSlots {
50
50
  default(props?: {
51
51
  errors: FormError[];
52
+ loading: boolean;
52
53
  }): any;
53
54
  }
54
- declare const _default: <S extends FormSchema>(__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<{
55
+ declare const _default: <S extends FormSchema, T extends boolean = true>(__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<{
55
56
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
56
57
  readonly onError?: ((payload: FormErrorEvent) => any) | undefined;
57
- readonly onSubmit?: ((payload: FormSubmitEvent<InferOutput<S>>) => any) | undefined;
58
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onError" | "onSubmit"> & FormProps<S> & Partial<{}>> & import("vue").PublicProps;
59
- expose(exposed: import("vue").ShallowUnwrapRef<Form<InferInput<S>>>): void;
58
+ readonly onSubmit?: ((payload: FormSubmitEvent<FormData<S, T>>) => any) | undefined;
59
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onError" | "onSubmit"> & FormProps<S, T> & Partial<{}>> & import("vue").PublicProps;
60
+ expose(exposed: import("vue").ShallowUnwrapRef<Form<S>>): void;
60
61
  attrs: any;
61
62
  slots: FormSlots;
62
- emit: FormEmits<S>;
63
+ emit: FormEmits<S, T>;
63
64
  }>) => import("vue").VNode & {
64
65
  __ctx?: Awaited<typeof __VLS_setup>;
65
66
  };
@@ -301,11 +301,11 @@ declare const _default: <T extends ArrayOrNested<InputMenuItem>, VK extends GetI
301
301
  "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
302
302
  }>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
303
303
  $slots: Readonly<{
304
- default: (props: {
304
+ default?: (props: {
305
305
  modelValue: string | undefined;
306
306
  }) => any;
307
307
  }> & {
308
- default: (props: {
308
+ default?: (props: {
309
309
  modelValue: string | undefined;
310
310
  }) => any;
311
311
  };
@@ -465,11 +465,11 @@ declare const _default: <T extends ArrayOrNested<InputMenuItem>, VK extends GetI
465
465
  "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
466
466
  }>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
467
467
  $slots: Readonly<{
468
- default: (props: {
468
+ default?: (props: {
469
469
  modelValue: string | undefined;
470
470
  }) => any;
471
471
  }> & {
472
- default: (props: {
472
+ default?: (props: {
473
473
  modelValue: string | undefined;
474
474
  }) => any;
475
475
  };
@@ -43,13 +43,14 @@ const props = defineProps({
43
43
  id: { type: String, required: false },
44
44
  name: { type: String, required: false },
45
45
  formatOptions: { type: null, required: false },
46
- disableWheelChange: { type: Boolean, required: false }
46
+ disableWheelChange: { type: Boolean, required: false },
47
+ invertWheelChange: { type: Boolean, required: false }
47
48
  });
48
49
  const emits = defineEmits(["update:modelValue", "blur", "change"]);
49
50
  defineSlots();
50
51
  const { t, code: codeLocale } = useLocale();
51
52
  const appConfig = useAppConfig();
52
- const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "min", "max", "step", "stepSnapping", "formatOptions", "disableWheelChange"), emits);
53
+ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "min", "max", "step", "stepSnapping", "formatOptions", "disableWheelChange", "invertWheelChange"), emits);
53
54
  const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size: formGroupSize, name, highlight, disabled, ariaAttrs } = useFormField(props);
54
55
  const { orientation, size: buttonGroupSize } = useButtonGroup(props);
55
56
  const locale = computed(() => props.locale || codeLocale.value);
@@ -4,7 +4,7 @@ import theme from '#build/ui/input-number';
4
4
  import type { ButtonProps } from '../types';
5
5
  import type { ComponentConfig } from '../types/utils';
6
6
  type InputNumber = ComponentConfig<typeof theme, AppConfig, 'inputNumber'>;
7
- export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue' | 'defaultValue' | 'min' | 'max' | 'step' | 'stepSnapping' | 'disabled' | 'required' | 'id' | 'name' | 'formatOptions' | 'disableWheelChange'> {
7
+ export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue' | 'defaultValue' | 'min' | 'max' | 'step' | 'stepSnapping' | 'disabled' | 'required' | 'id' | 'name' | 'formatOptions' | 'disableWheelChange' | 'invertWheelChange'> {
8
8
  /**
9
9
  * The element or component this component should render as.
10
10
  * @defaultValue 'div'