@nuxt/ui 3.3.0 → 3.3.1

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 (88) hide show
  1. package/.nuxt/ui/drawer.ts +1 -1
  2. package/.nuxt/ui/input.ts +1 -1
  3. package/.nuxt/ui/select.ts +7 -7
  4. package/.nuxt/ui/textarea.ts +1 -1
  5. package/cli/templates.mjs +4 -0
  6. package/dist/module.json +2 -2
  7. package/dist/module.mjs +2 -2
  8. package/dist/runtime/components/ContextMenuContent.vue +5 -3
  9. package/dist/runtime/components/DropdownMenuContent.vue +5 -3
  10. package/dist/runtime/components/FileUpload.vue +7 -1
  11. package/dist/runtime/components/Form.vue +3 -3
  12. package/dist/runtime/components/InputMenu.vue +11 -6
  13. package/dist/runtime/components/InputMenu.vue.d.ts +3 -211
  14. package/dist/runtime/components/InputNumber.vue +3 -2
  15. package/dist/runtime/components/InputNumber.vue.d.ts +3 -77
  16. package/dist/runtime/components/InputTags.vue.d.ts +2 -2
  17. package/dist/runtime/components/PinInput.vue +3 -1
  18. package/dist/runtime/components/PinInput.vue.d.ts +4 -4
  19. package/dist/runtime/components/Select.vue +16 -6
  20. package/dist/runtime/components/Select.vue.d.ts +2 -2
  21. package/dist/runtime/components/SelectMenu.vue +10 -5
  22. package/dist/runtime/components/SelectMenu.vue.d.ts +2 -2
  23. package/dist/runtime/components/Tabs.vue +1 -0
  24. package/dist/runtime/components/Toast.vue.d.ts +2 -2
  25. package/dist/runtime/components/Tooltip.vue +2 -2
  26. package/dist/runtime/components/Tree.vue +29 -27
  27. package/dist/runtime/components/Tree.vue.d.ts +1 -0
  28. package/dist/runtime/composables/useFileUpload.js +7 -1
  29. package/dist/runtime/composables/useOverlay.d.ts +1 -1
  30. package/dist/runtime/composables/useOverlay.js +4 -3
  31. package/dist/runtime/locale/ar.js +3 -0
  32. package/dist/runtime/locale/az.js +3 -0
  33. package/dist/runtime/locale/bg.js +3 -0
  34. package/dist/runtime/locale/bn.js +3 -0
  35. package/dist/runtime/locale/ca.js +3 -0
  36. package/dist/runtime/locale/ckb.js +3 -0
  37. package/dist/runtime/locale/cs.js +3 -0
  38. package/dist/runtime/locale/da.js +3 -0
  39. package/dist/runtime/locale/de.js +3 -0
  40. package/dist/runtime/locale/el.js +3 -0
  41. package/dist/runtime/locale/en.js +3 -0
  42. package/dist/runtime/locale/es.js +3 -0
  43. package/dist/runtime/locale/et.js +3 -0
  44. package/dist/runtime/locale/fa_ir.js +3 -0
  45. package/dist/runtime/locale/fi.js +3 -0
  46. package/dist/runtime/locale/fr.js +3 -0
  47. package/dist/runtime/locale/he.js +3 -0
  48. package/dist/runtime/locale/hi.js +3 -0
  49. package/dist/runtime/locale/hu.js +3 -0
  50. package/dist/runtime/locale/hy.js +3 -0
  51. package/dist/runtime/locale/id.js +3 -0
  52. package/dist/runtime/locale/it.js +3 -0
  53. package/dist/runtime/locale/ja.js +3 -0
  54. package/dist/runtime/locale/kk.js +3 -0
  55. package/dist/runtime/locale/km.js +3 -0
  56. package/dist/runtime/locale/ko.js +3 -0
  57. package/dist/runtime/locale/ky.js +3 -0
  58. package/dist/runtime/locale/lb.js +3 -0
  59. package/dist/runtime/locale/lt.js +3 -0
  60. package/dist/runtime/locale/mn.js +3 -0
  61. package/dist/runtime/locale/ms.js +3 -0
  62. package/dist/runtime/locale/nb_no.js +3 -0
  63. package/dist/runtime/locale/nl.js +3 -0
  64. package/dist/runtime/locale/pl.js +3 -0
  65. package/dist/runtime/locale/pt.js +3 -0
  66. package/dist/runtime/locale/pt_br.js +3 -0
  67. package/dist/runtime/locale/ro.js +3 -0
  68. package/dist/runtime/locale/ru.js +3 -0
  69. package/dist/runtime/locale/sk.js +3 -0
  70. package/dist/runtime/locale/sl.js +3 -0
  71. package/dist/runtime/locale/sv.js +3 -0
  72. package/dist/runtime/locale/th.js +3 -0
  73. package/dist/runtime/locale/tj.js +3 -0
  74. package/dist/runtime/locale/tr.js +3 -0
  75. package/dist/runtime/locale/ug_cn.js +3 -0
  76. package/dist/runtime/locale/uk.js +3 -0
  77. package/dist/runtime/locale/ur.js +3 -0
  78. package/dist/runtime/locale/uz.js +3 -0
  79. package/dist/runtime/locale/vi.js +3 -0
  80. package/dist/runtime/locale/zh_cn.js +3 -0
  81. package/dist/runtime/locale/zh_tw.js +3 -0
  82. package/dist/runtime/types/locale.d.ts +3 -0
  83. package/dist/runtime/utils/index.d.ts +5 -0
  84. package/dist/runtime/utils/index.js +18 -0
  85. package/dist/shared/{ui.BkSj2DmF.mjs → ui.BTUFJHYJ.mjs} +21 -7
  86. package/dist/unplugin.mjs +1 -1
  87. package/dist/vite.mjs +1 -1
  88. package/package.json +20 -16
@@ -41,7 +41,7 @@ export default {
41
41
  },
42
42
  "inset": {
43
43
  "true": {
44
- "content": "rounded-lg after:hidden overflow-hidden"
44
+ "content": "rounded-lg after:hidden overflow-hidden [--initial-transform:calc(100%+1.5rem)]"
45
45
  }
46
46
  }
47
47
  },
package/.nuxt/ui/input.ts CHANGED
@@ -28,7 +28,7 @@ export default {
28
28
  "slots": {
29
29
  "root": "relative inline-flex items-center",
30
30
  "base": [
31
- "w-full rounded-md border-0 placeholder:text-dimmed focus:outline-none disabled:cursor-not-allowed disabled:opacity-75",
31
+ "w-full rounded-md border-0 appearance-none placeholder:text-dimmed focus:outline-none disabled:cursor-not-allowed disabled:opacity-75",
32
32
  "transition-colors"
33
33
  ],
34
34
  "leading": "absolute inset-y-0 start-0 flex items-center",
@@ -187,7 +187,7 @@ export default {
187
187
  "outline" as typeof variant[number],
188
188
  "subtle" as typeof variant[number]
189
189
  ],
190
- "class": "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary"
190
+ "class": "focus:ring-2 focus:ring-inset focus:ring-primary"
191
191
  },
192
192
  {
193
193
  "color": "secondary" as typeof color[number],
@@ -195,7 +195,7 @@ export default {
195
195
  "outline" as typeof variant[number],
196
196
  "subtle" as typeof variant[number]
197
197
  ],
198
- "class": "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary"
198
+ "class": "focus:ring-2 focus:ring-inset focus:ring-secondary"
199
199
  },
200
200
  {
201
201
  "color": "success" as typeof color[number],
@@ -203,7 +203,7 @@ export default {
203
203
  "outline" as typeof variant[number],
204
204
  "subtle" as typeof variant[number]
205
205
  ],
206
- "class": "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-success"
206
+ "class": "focus:ring-2 focus:ring-inset focus:ring-success"
207
207
  },
208
208
  {
209
209
  "color": "info" as typeof color[number],
@@ -211,7 +211,7 @@ export default {
211
211
  "outline" as typeof variant[number],
212
212
  "subtle" as typeof variant[number]
213
213
  ],
214
- "class": "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-info"
214
+ "class": "focus:ring-2 focus:ring-inset focus:ring-info"
215
215
  },
216
216
  {
217
217
  "color": "warning" as typeof color[number],
@@ -219,7 +219,7 @@ export default {
219
219
  "outline" as typeof variant[number],
220
220
  "subtle" as typeof variant[number]
221
221
  ],
222
- "class": "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-warning"
222
+ "class": "focus:ring-2 focus:ring-inset focus:ring-warning"
223
223
  },
224
224
  {
225
225
  "color": "error" as typeof color[number],
@@ -227,7 +227,7 @@ export default {
227
227
  "outline" as typeof variant[number],
228
228
  "subtle" as typeof variant[number]
229
229
  ],
230
- "class": "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-error"
230
+ "class": "focus:ring-2 focus:ring-inset focus:ring-error"
231
231
  },
232
232
  {
233
233
  "color": "primary" as typeof color[number],
@@ -265,7 +265,7 @@ export default {
265
265
  "outline" as typeof variant[number],
266
266
  "subtle" as typeof variant[number]
267
267
  ],
268
- "class": "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-inverted"
268
+ "class": "focus:ring-2 focus:ring-inset focus:ring-inverted"
269
269
  },
270
270
  {
271
271
  "color": "neutral" as typeof color[number],
@@ -28,7 +28,7 @@ export default {
28
28
  "slots": {
29
29
  "root": "relative inline-flex items-center",
30
30
  "base": [
31
- "w-full rounded-md border-0 placeholder:text-dimmed focus:outline-none disabled:cursor-not-allowed disabled:opacity-75",
31
+ "w-full rounded-md border-0 appearance-none placeholder:text-dimmed focus:outline-none disabled:cursor-not-allowed disabled:opacity-75",
32
32
  "transition-colors"
33
33
  ],
34
34
  "leading": "absolute start-0 flex items-start",
package/cli/templates.mjs CHANGED
@@ -213,6 +213,10 @@ navigation.badge: Soon
213
213
  ## Theme
214
214
 
215
215
  :component-theme${pro ? '{pro}' : ''}
216
+
217
+ ## Changelog
218
+
219
+ :component-changelog
216
220
  `
217
221
  }
218
222
  }
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "docs": "https://ui.nuxt.com/getting-started/installation/nuxt",
5
5
  "configKey": "ui",
6
6
  "compatibility": {
@@ -8,6 +8,6 @@
8
8
  },
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "1.0.1",
11
- "unbuild": "3.5.0"
11
+ "unbuild": "3.6.0"
12
12
  }
13
13
  }
package/dist/module.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defu } from 'defu';
2
2
  import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, addComponentsDir, addImportsDir, hasNuxtModule, installModule } from '@nuxt/kit';
3
- import { d as defaultOptions, r as resolveColors, a as getDefaultUiConfig, b as addTemplates } from './shared/ui.BkSj2DmF.mjs';
3
+ import { d as defaultOptions, r as resolveColors, a as getDefaultUiConfig, b as addTemplates } from './shared/ui.BTUFJHYJ.mjs';
4
4
  import '../dist/runtime/utils/index.js';
5
5
  import 'node:url';
6
6
  import 'scule';
@@ -8,7 +8,7 @@ import 'tailwindcss/colors';
8
8
  import 'knitwork';
9
9
 
10
10
  const name = "@nuxt/ui";
11
- const version = "3.3.0";
11
+ const version = "3.3.1";
12
12
 
13
13
  const module = defineNuxtModule({
14
14
  meta: {
@@ -30,7 +30,9 @@ const props = defineProps({
30
30
  ui: { type: null, required: true },
31
31
  uiOverride: { type: null, required: false },
32
32
  loop: { type: Boolean, required: false },
33
+ sideFlip: { type: Boolean, required: false },
33
34
  alignOffset: { type: Number, required: false },
35
+ alignFlip: { type: Boolean, required: false },
34
36
  avoidCollisions: { type: Boolean, required: false },
35
37
  collisionBoundary: { type: null, required: false },
36
38
  collisionPadding: { type: [Number, Object], required: false },
@@ -61,7 +63,7 @@ const groups = computed(
61
63
  <slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :active="active" :index="index">
62
64
  <UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: [uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item?.color, loading: true })" />
63
65
  <UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: [uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item?.color, active })" />
64
- <UAvatar v-else-if="item.avatar" :size="item.ui?.itemLeadingAvatarSize || props.uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: [uiOverride?.itemLeadingAvatar, item.ui?.itemLeadingAvatar], active })" />
66
+ <UAvatar v-else-if="item.avatar" :size="item.ui?.itemLeadingAvatarSize || uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: [uiOverride?.itemLeadingAvatar, item.ui?.itemLeadingAvatar], active })" />
65
67
  </slot>
66
68
 
67
69
  <span v-if="get(item, props.labelKey) || !!slots[item.slot ? `${item.slot}-label` : 'item-label']" :class="ui.itemLabel({ class: [uiOverride?.itemLabel, item.ui?.itemLabel], active })">
@@ -76,7 +78,7 @@ const groups = computed(
76
78
  <slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index">
77
79
  <UIcon v-if="item.children?.length" :name="childrenIcon" :class="ui.itemTrailingIcon({ class: [uiOverride?.itemTrailingIcon, item.ui?.itemTrailingIcon], color: item?.color, active })" />
78
80
  <span v-else-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: [uiOverride?.itemTrailingKbds, item.ui?.itemTrailingKbds] })">
79
- <UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="item.ui?.itemTrailingKbdsSize || props.uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
81
+ <UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="item.ui?.itemTrailingKbdsSize || uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
80
82
  </span>
81
83
  </slot>
82
84
 
@@ -91,7 +93,7 @@ const groups = computed(
91
93
  <component :is="sub ? ContextMenu.SubContent : ContextMenu.Content" :class="props.class" v-bind="contentProps">
92
94
  <slot name="content-top" />
93
95
 
94
- <div role="presentation" :class="ui.viewport({ class: props.ui?.viewport })">
96
+ <div role="presentation" :class="ui.viewport({ class: uiOverride?.viewport })">
95
97
  <ContextMenu.Group v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="ui.group({ class: uiOverride?.group })">
96
98
  <template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
97
99
  <ContextMenu.Label v-if="item.type === 'label'" :class="ui.label({ class: [uiOverride?.label, item.ui?.label, item.class] })">
@@ -32,8 +32,10 @@ const props = defineProps({
32
32
  loop: { type: Boolean, required: false },
33
33
  side: { type: null, required: false },
34
34
  sideOffset: { type: Number, required: false },
35
+ sideFlip: { type: Boolean, required: false },
35
36
  align: { type: null, required: false },
36
37
  alignOffset: { type: Number, required: false },
38
+ alignFlip: { type: Boolean, required: false },
37
39
  avoidCollisions: { type: Boolean, required: false },
38
40
  collisionBoundary: { type: null, required: false },
39
41
  collisionPadding: { type: [Number, Object], required: false },
@@ -66,7 +68,7 @@ const groups = computed(
66
68
  <slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :active="active" :index="index">
67
69
  <UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: [uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item?.color, loading: true })" />
68
70
  <UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: [uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item?.color, active })" />
69
- <UAvatar v-else-if="item.avatar" :size="item.ui?.itemLeadingAvatarSize || props.uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: [uiOverride?.itemLeadingAvatar, item.ui?.itemLeadingAvatar], active })" />
71
+ <UAvatar v-else-if="item.avatar" :size="item.ui?.itemLeadingAvatarSize || uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: [uiOverride?.itemLeadingAvatar, item.ui?.itemLeadingAvatar], active })" />
70
72
  </slot>
71
73
 
72
74
  <span v-if="get(item, props.labelKey) || !!slots[item.slot ? `${item.slot}-label` : 'item-label']" :class="ui.itemLabel({ class: [uiOverride?.itemLabel, item.ui?.itemLabel], active })">
@@ -81,7 +83,7 @@ const groups = computed(
81
83
  <slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index">
82
84
  <UIcon v-if="item.children?.length" :name="childrenIcon" :class="ui.itemTrailingIcon({ class: [uiOverride?.itemTrailingIcon, item.ui?.itemTrailingIcon], color: item?.color, active })" />
83
85
  <span v-else-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: [uiOverride?.itemTrailingKbds, item.ui?.itemTrailingKbds] })">
84
- <UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="item.ui?.itemTrailingKbdsSize || props.uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
86
+ <UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="item.ui?.itemTrailingKbdsSize || uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
85
87
  </span>
86
88
  </slot>
87
89
 
@@ -96,7 +98,7 @@ const groups = computed(
96
98
  <component :is="sub ? DropdownMenu.SubContent : DropdownMenu.Content" :class="props.class" v-bind="contentProps">
97
99
  <slot name="content-top" />
98
100
 
99
- <div role="presentation" :class="ui.viewport({ class: props.ui?.viewport })">
101
+ <div role="presentation" :class="ui.viewport({ class: uiOverride?.viewport })">
100
102
  <DropdownMenu.Group v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="ui.group({ class: uiOverride?.group })">
101
103
  <template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
102
104
  <DropdownMenu.Label v-if="item.type === 'label'" :class="ui.label({ class: [uiOverride?.label, item.ui?.label, item.class] })">
@@ -6,7 +6,7 @@ import theme from "#build/ui/file-upload";
6
6
  import { computed, watch } from "vue";
7
7
  import { Primitive } from "reka-ui";
8
8
  import { createReusableTemplate } from "@vueuse/core";
9
- import { useAppConfig } from "#imports";
9
+ import { useAppConfig, useLocale } from "#imports";
10
10
  import { useFormField } from "../composables/useFormField";
11
11
  import { useFileUpload } from "../composables/useFileUpload";
12
12
  import { tv } from "../utils/tv";
@@ -44,6 +44,7 @@ const emits = defineEmits(["update:modelValue", "change"]);
44
44
  const slots = defineSlots();
45
45
  const modelValue = defineModel({ type: null });
46
46
  const appConfig = useAppConfig();
47
+ const { t } = useLocale();
47
48
  const [DefineFilesTemplate, ReuseFilesTemplate] = createReusableTemplate();
48
49
  const { isDragging, open, inputRef, dropzoneRef } = useFileUpload({
49
50
  accept: props.accept,
@@ -112,11 +113,13 @@ function removeFile(index) {
112
113
  }
113
114
  if (!props.multiple || index === void 0) {
114
115
  onUpdate([], true);
116
+ dropzoneRef.value?.focus();
115
117
  return;
116
118
  }
117
119
  const files = [...modelValue.value];
118
120
  files.splice(index, 1);
119
121
  onUpdate(files, true);
122
+ dropzoneRef.value?.focus();
120
123
  }
121
124
  watch(modelValue, (newValue) => {
122
125
  const hasModelReset = !Array.isArray(newValue) || !newValue.length;
@@ -170,6 +173,7 @@ defineExpose({
170
173
  },
171
174
  ...typeof fileDelete === 'object' ? fileDelete : void 0
172
175
  }"
176
+ :aria-label="t('fileUpload.removeFile', { filename: file.name })"
173
177
  :trailing-icon="fileDeleteIcon || appConfig.ui.icons.close"
174
178
  :class="ui.fileTrailingButton({ class: props.ui?.fileTrailingButton })"
175
179
  @click.stop.prevent="removeFile(index)"
@@ -194,6 +198,8 @@ defineExpose({
194
198
  :class="ui.base({ class: props.ui?.base })"
195
199
  :tabindex="interactive && !disabled ? 0 : -1"
196
200
  @click="interactive && !disabled && open()"
201
+ @keydown.prevent
202
+ @keyup.enter.space="interactive && !disabled && open()"
197
203
  >
198
204
  <ReuseFilesTemplate v-if="position === 'inside'" />
199
205
 
@@ -168,7 +168,7 @@ defineExpose({
168
168
  errors,
169
169
  setErrors(errs, name) {
170
170
  if (name) {
171
- errors.value = errors.value.filter((error) => error.name !== name).concat(resolveErrorIds(errs));
171
+ errors.value = errors.value.filter((err) => name instanceof RegExp ? !(err.name && name.test(err.name)) : err.name !== name).concat(resolveErrorIds(errs));
172
172
  } else {
173
173
  errors.value = resolveErrorIds(errs);
174
174
  }
@@ -178,13 +178,13 @@ defineExpose({
178
178
  },
179
179
  getErrors(name) {
180
180
  if (name) {
181
- return errors.value.filter((err) => err.name === name);
181
+ return errors.value.filter((err) => name instanceof RegExp ? err.name && name.test(err.name) : err.name === name);
182
182
  }
183
183
  return errors.value;
184
184
  },
185
185
  clear(name) {
186
186
  if (name) {
187
- errors.value = errors.value.filter((err) => err.name !== name);
187
+ errors.value = errors.value.filter((err) => name instanceof RegExp ? !(err.name && name.test(err.name)) : err.name !== name);
188
188
  } else {
189
189
  errors.value = [];
190
190
  }
@@ -14,7 +14,7 @@ import { useComponentIcons } from "../composables/useComponentIcons";
14
14
  import { useFormField } from "../composables/useFormField";
15
15
  import { useLocale } from "../composables/useLocale";
16
16
  import { usePortal } from "../composables/usePortal";
17
- import { compare, get, isArrayOfArray } from "../utils";
17
+ import { compare, get, getDisplayValue, isArrayOfArray } from "../utils";
18
18
  import { tv } from "../utils/tv";
19
19
  import UIcon from "./Icon.vue";
20
20
  import UAvatar from "./Avatar.vue";
@@ -56,6 +56,8 @@ const props = defineProps({
56
56
  resetSearchTermOnBlur: { type: Boolean, required: false, default: true },
57
57
  resetSearchTermOnSelect: { type: Boolean, required: false, default: true },
58
58
  highlightOnHover: { type: Boolean, required: false },
59
+ openOnClick: { type: Boolean, required: false },
60
+ openOnFocus: { type: Boolean, required: false },
59
61
  icon: { type: String, required: false },
60
62
  avatar: { type: Object, required: false },
61
63
  leading: { type: Boolean, required: false },
@@ -70,7 +72,7 @@ const searchTerm = defineModel("searchTerm", { type: String, ...{ default: "" }
70
72
  const { t } = useLocale();
71
73
  const appConfig = useAppConfig();
72
74
  const { contains } = useFilter({ sensitivity: "base" });
73
- const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "open", "defaultOpen", "required", "multiple", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "highlightOnHover", "ignoreFilter"), emits);
75
+ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "open", "defaultOpen", "required", "multiple", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "highlightOnHover", "openOnClick", "openOnFocus"), emits);
74
76
  const portalProps = usePortal(toRef(() => props.portal));
75
77
  const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
76
78
  const arrowProps = toRef(() => props.arrow);
@@ -91,8 +93,10 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.inputMenu ||
91
93
  buttonGroup: orientation.value
92
94
  }));
93
95
  function displayValue(value) {
94
- const item = items.value.find((item2) => compare(typeof item2 === "object" && props.valueKey ? get(item2, props.valueKey) : item2, value));
95
- return item && (typeof item === "object" ? get(item, props.labelKey) : item);
96
+ return getDisplayValue(items.value, value, {
97
+ labelKey: props.labelKey,
98
+ valueKey: props.valueKey
99
+ }) ?? "";
96
100
  }
97
101
  const groups = computed(
98
102
  () => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
@@ -231,7 +235,6 @@ defineExpose({
231
235
  </DefineCreateItemTemplate>
232
236
 
233
237
  <ComboboxRoot
234
- :id="id"
235
238
  v-slot="{ modelValue, open }"
236
239
  v-bind="rootProps"
237
240
  :name="name"
@@ -259,7 +262,7 @@ defineExpose({
259
262
  <TagsInputItem v-for="(item, index) in tags" :key="index" :value="item" :class="ui.tagsItem({ class: [props.ui?.tagsItem, isInputItem(item) && item.ui?.tagsItem] })">
260
263
  <TagsInputItemText :class="ui.tagsItemText({ class: [props.ui?.tagsItemText, isInputItem(item) && item.ui?.tagsItemText] })">
261
264
  <slot name="tags-item-text" :item="item" :index="index">
262
- {{ displayValue(item) ?? item }}
265
+ {{ displayValue(item) }}
263
266
  </slot>
264
267
  </TagsInputItemText>
265
268
 
@@ -272,6 +275,7 @@ defineExpose({
272
275
 
273
276
  <ComboboxInput v-model="searchTerm" as-child>
274
277
  <TagsInputInput
278
+ :id="id"
275
279
  ref="inputRef"
276
280
  v-bind="{ ...$attrs, ...ariaAttrs }"
277
281
  :placeholder="placeholder"
@@ -283,6 +287,7 @@ defineExpose({
283
287
 
284
288
  <ComboboxInput
285
289
  v-else
290
+ :id="id"
286
291
  ref="inputRef"
287
292
  :display-value="displayValue"
288
293
  v-bind="{ ...$attrs, ...ariaAttrs }"
@@ -27,7 +27,7 @@ interface _InputMenuItem {
27
27
  [key: string]: any;
28
28
  }
29
29
  export type InputMenuItem = _InputMenuItem | AcceptableValue | boolean;
30
- export interface InputMenuProps<T extends ArrayOrNested<InputMenuItem> = ArrayOrNested<InputMenuItem>, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false> extends Pick<ComboboxRootProps<T>, 'open' | 'defaultOpen' | 'disabled' | 'name' | 'resetSearchTermOnBlur' | 'resetSearchTermOnSelect' | 'highlightOnHover'>, UseComponentIconsProps {
30
+ export interface InputMenuProps<T extends ArrayOrNested<InputMenuItem> = ArrayOrNested<InputMenuItem>, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false> extends Pick<ComboboxRootProps<T>, 'open' | 'defaultOpen' | 'disabled' | 'name' | 'resetSearchTermOnBlur' | 'resetSearchTermOnSelect' | 'highlightOnHover' | 'openOnClick' | 'openOnFocus'>, UseComponentIconsProps {
31
31
  /**
32
32
  * The element or component this component should render as.
33
33
  * @defaultValue 'div'
@@ -209,110 +209,6 @@ declare const _default: <T extends ArrayOrNested<InputMenuItem>, VK extends GetI
209
209
  };
210
210
  $refs: {
211
211
  [x: string]: unknown;
212
- } & {
213
- primitiveElement: ({
214
- $: import("vue").ComponentInternalInstance;
215
- $data: {};
216
- $props: {
217
- readonly modelValue?: string | undefined;
218
- readonly autoFocus?: boolean | undefined;
219
- readonly disabled?: boolean | undefined;
220
- readonly asChild?: boolean | undefined;
221
- readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
222
- readonly "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
223
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
224
- $attrs: {
225
- [x: string]: unknown;
226
- };
227
- $refs: {
228
- [x: string]: unknown;
229
- } & {
230
- primitiveElement: import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
231
- asChild: {
232
- type: BooleanConstructor;
233
- default: boolean;
234
- };
235
- as: {
236
- type: import("vue").PropType<import("reka-ui").AsTag | import("vue").Component>;
237
- default: string;
238
- };
239
- }>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
240
- [key: string]: any;
241
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
242
- asChild: boolean;
243
- as: import("reka-ui").AsTag | import("vue").Component;
244
- }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
245
- P: {};
246
- B: {};
247
- D: {};
248
- C: {};
249
- M: {};
250
- Defaults: {};
251
- }, Readonly<import("vue").ExtractPropTypes<{
252
- asChild: {
253
- type: BooleanConstructor;
254
- default: boolean;
255
- };
256
- as: {
257
- type: import("vue").PropType<import("reka-ui").AsTag | import("vue").Component>;
258
- default: string;
259
- };
260
- }>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
261
- [key: string]: any;
262
- }>, {}, {}, {}, {
263
- asChild: boolean;
264
- as: import("reka-ui").AsTag | import("vue").Component;
265
- }> | null;
266
- };
267
- $slots: Readonly<{
268
- [name: string]: import("vue").Slot<any> | undefined;
269
- }>;
270
- $root: import("vue").ComponentPublicInstance | null;
271
- $parent: import("vue").ComponentPublicInstance | null;
272
- $host: Element | null;
273
- $emit: (event: "update:modelValue", args_0: string) => void;
274
- $el: any;
275
- $options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").ListboxFilterProps> & Readonly<{
276
- "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
277
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
278
- "update:modelValue": (args_0: string) => any;
279
- }, string, {
280
- as: import("reka-ui").AsTag | import("vue").Component;
281
- }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
282
- beforeCreate?: (() => void) | (() => void)[];
283
- created?: (() => void) | (() => void)[];
284
- beforeMount?: (() => void) | (() => void)[];
285
- mounted?: (() => void) | (() => void)[];
286
- beforeUpdate?: (() => void) | (() => void)[];
287
- updated?: (() => void) | (() => void)[];
288
- activated?: (() => void) | (() => void)[];
289
- deactivated?: (() => void) | (() => void)[];
290
- beforeDestroy?: (() => void) | (() => void)[];
291
- beforeUnmount?: (() => void) | (() => void)[];
292
- destroyed?: (() => void) | (() => void)[];
293
- unmounted?: (() => void) | (() => void)[];
294
- renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
295
- renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
296
- errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
297
- };
298
- $forceUpdate: () => void;
299
- $nextTick: typeof nextTick;
300
- $watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
301
- } & Readonly<{
302
- as: import("reka-ui").AsTag | import("vue").Component;
303
- }> & Omit<Readonly<import("reka-ui").ListboxFilterProps> & Readonly<{
304
- "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
305
- }>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
306
- $slots: Readonly<{
307
- default?: (props: {
308
- modelValue: string | undefined;
309
- }) => any;
310
- }> & {
311
- default?: (props: {
312
- modelValue: string | undefined;
313
- }) => any;
314
- };
315
- }) | null;
316
212
  };
317
213
  $slots: Readonly<{
318
214
  [name: string]: import("vue").Slot<any> | undefined;
@@ -354,7 +250,7 @@ declare const _default: <T extends ArrayOrNested<InputMenuItem>, VK extends GetI
354
250
  "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
355
251
  }>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
356
252
  $slots: {
357
- default?(_: {}): any;
253
+ default?: (props: {}) => any;
358
254
  };
359
255
  }) | null, ({
360
256
  $: import("vue").ComponentInternalInstance;
@@ -373,110 +269,6 @@ declare const _default: <T extends ArrayOrNested<InputMenuItem>, VK extends GetI
373
269
  };
374
270
  $refs: {
375
271
  [x: string]: unknown;
376
- } & {
377
- primitiveElement: ({
378
- $: import("vue").ComponentInternalInstance;
379
- $data: {};
380
- $props: {
381
- readonly modelValue?: string | undefined;
382
- readonly autoFocus?: boolean | undefined;
383
- readonly disabled?: boolean | undefined;
384
- readonly asChild?: boolean | undefined;
385
- readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
386
- readonly "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
387
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
388
- $attrs: {
389
- [x: string]: unknown;
390
- };
391
- $refs: {
392
- [x: string]: unknown;
393
- } & {
394
- primitiveElement: import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
395
- asChild: {
396
- type: BooleanConstructor;
397
- default: boolean;
398
- };
399
- as: {
400
- type: import("vue").PropType<import("reka-ui").AsTag | import("vue").Component>;
401
- default: string;
402
- };
403
- }>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
404
- [key: string]: any;
405
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
406
- asChild: boolean;
407
- as: import("reka-ui").AsTag | import("vue").Component;
408
- }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
409
- P: {};
410
- B: {};
411
- D: {};
412
- C: {};
413
- M: {};
414
- Defaults: {};
415
- }, Readonly<import("vue").ExtractPropTypes<{
416
- asChild: {
417
- type: BooleanConstructor;
418
- default: boolean;
419
- };
420
- as: {
421
- type: import("vue").PropType<import("reka-ui").AsTag | import("vue").Component>;
422
- default: string;
423
- };
424
- }>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
425
- [key: string]: any;
426
- }>, {}, {}, {}, {
427
- asChild: boolean;
428
- as: import("reka-ui").AsTag | import("vue").Component;
429
- }> | null;
430
- };
431
- $slots: Readonly<{
432
- [name: string]: import("vue").Slot<any> | undefined;
433
- }>;
434
- $root: import("vue").ComponentPublicInstance | null;
435
- $parent: import("vue").ComponentPublicInstance | null;
436
- $host: Element | null;
437
- $emit: (event: "update:modelValue", args_0: string) => void;
438
- $el: any;
439
- $options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").ListboxFilterProps> & Readonly<{
440
- "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
441
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
442
- "update:modelValue": (args_0: string) => any;
443
- }, string, {
444
- as: import("reka-ui").AsTag | import("vue").Component;
445
- }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
446
- beforeCreate?: (() => void) | (() => void)[];
447
- created?: (() => void) | (() => void)[];
448
- beforeMount?: (() => void) | (() => void)[];
449
- mounted?: (() => void) | (() => void)[];
450
- beforeUpdate?: (() => void) | (() => void)[];
451
- updated?: (() => void) | (() => void)[];
452
- activated?: (() => void) | (() => void)[];
453
- deactivated?: (() => void) | (() => void)[];
454
- beforeDestroy?: (() => void) | (() => void)[];
455
- beforeUnmount?: (() => void) | (() => void)[];
456
- destroyed?: (() => void) | (() => void)[];
457
- unmounted?: (() => void) | (() => void)[];
458
- renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
459
- renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
460
- errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
461
- };
462
- $forceUpdate: () => void;
463
- $nextTick: typeof nextTick;
464
- $watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
465
- } & Readonly<{
466
- as: import("reka-ui").AsTag | import("vue").Component;
467
- }> & Omit<Readonly<import("reka-ui").ListboxFilterProps> & Readonly<{
468
- "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
469
- }>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
470
- $slots: Readonly<{
471
- default?: (props: {
472
- modelValue: string | undefined;
473
- }) => any;
474
- }> & {
475
- default?: (props: {
476
- modelValue: string | undefined;
477
- }) => any;
478
- };
479
- }) | null;
480
272
  };
481
273
  $slots: Readonly<{
482
274
  [name: string]: import("vue").Slot<any> | undefined;
@@ -518,7 +310,7 @@ declare const _default: <T extends ArrayOrNested<InputMenuItem>, VK extends GetI
518
310
  "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
519
311
  }>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
520
312
  $slots: {
521
- default?(_: {}): any;
313
+ default?: (props: {}) => any;
522
314
  };
523
315
  }) | null>;
524
316
  }>): void;
@@ -44,13 +44,14 @@ const props = defineProps({
44
44
  name: { type: String, required: false },
45
45
  formatOptions: { type: null, required: false },
46
46
  disableWheelChange: { type: Boolean, required: false },
47
- invertWheelChange: { type: Boolean, required: false }
47
+ invertWheelChange: { type: Boolean, required: false },
48
+ readonly: { type: Boolean, required: false }
48
49
  });
49
50
  const emits = defineEmits(["update:modelValue", "blur", "change"]);
50
51
  defineSlots();
51
52
  const { t, code: codeLocale } = useLocale();
52
53
  const appConfig = useAppConfig();
53
- const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "min", "max", "step", "stepSnapping", "formatOptions", "disableWheelChange", "invertWheelChange"), emits);
54
+ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "min", "max", "step", "stepSnapping", "formatOptions", "disableWheelChange", "invertWheelChange", "readonly"), emits);
54
55
  const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size: formGroupSize, name, highlight, disabled, ariaAttrs } = useFormField(props);
55
56
  const { orientation, size: buttonGroupSize } = useButtonGroup(props);
56
57
  const locale = computed(() => props.locale || codeLocale.value);