@nuxt/ui 2.12.0 → 2.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -1
  3. package/dist/runtime/components/elements/Button.vue +6 -3
  4. package/dist/runtime/components/elements/Button.vue.d.ts +118 -0
  5. package/dist/runtime/components/elements/Dropdown.vue +3 -3
  6. package/dist/runtime/components/elements/Dropdown.vue.d.ts +1 -2
  7. package/dist/runtime/components/elements/Link.vue +7 -2
  8. package/dist/runtime/components/elements/Link.vue.d.ts +194 -4
  9. package/dist/runtime/components/forms/InputMenu.vue +10 -1
  10. package/dist/runtime/components/forms/InputMenu.vue.d.ts +3 -2
  11. package/dist/runtime/components/forms/SelectMenu.vue +18 -2
  12. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +3 -2
  13. package/dist/runtime/components/layout/Divider.vue +4 -5
  14. package/dist/runtime/components/navigation/Breadcrumb.vue +3 -3
  15. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +1 -2
  16. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +2 -2
  17. package/dist/runtime/components/navigation/VerticalNavigation.vue +8 -10
  18. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +2 -3
  19. package/dist/runtime/components/overlays/Tooltip.vue +1 -1
  20. package/dist/runtime/types/chip.d.ts +4 -0
  21. package/dist/runtime/types/index.d.ts +1 -0
  22. package/dist/runtime/types/link.d.ts +3 -0
  23. package/dist/runtime/types/tooltip.d.ts +7 -0
  24. package/dist/runtime/utils/index.d.ts +1 -0
  25. package/dist/runtime/utils/index.mjs +1 -0
  26. package/dist/runtime/utils/link.d.ts +58 -0
  27. package/dist/runtime/utils/link.mjs +111 -0
  28. package/package.json +17 -17
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
- "version": "2.12.0",
3
+ "version": "2.12.2",
4
4
  "configKey": "ui",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.0.0-rc.8"
package/dist/module.mjs CHANGED
@@ -14,7 +14,7 @@ const __filename = __cjs_url__.fileURLToPath(import.meta.url);
14
14
  const __dirname = __cjs_path__.dirname(__filename);
15
15
  const require = __cjs_mod__.createRequire(import.meta.url);
16
16
  const name = "@nuxt/ui";
17
- const version = "2.12.0";
17
+ const version = "2.12.2";
18
18
 
19
19
  function omit(object, keysToOmit) {
20
20
  const result = { ...object };
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <ULink :type="type" :disabled="disabled || loading" :class="buttonClass" v-bind="attrs">
2
+ <ULink :type="type" :disabled="disabled || loading" :class="buttonClass" v-bind="{ ...linkProps, ...attrs }">
3
3
  <slot name="leading" :disabled="disabled" :loading="loading">
4
4
  <UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="leadingIconClass" aria-hidden="true" />
5
5
  </slot>
@@ -22,7 +22,7 @@ import { twMerge, twJoin } from "tailwind-merge";
22
22
  import UIcon from "../elements/Icon.vue";
23
23
  import ULink from "../elements/Link.vue";
24
24
  import { useUI } from "../../composables/useUI";
25
- import { mergeConfig } from "../../utils";
25
+ import { mergeConfig, nuxtLinkProps, getNuxtLinkProps } from "../../utils";
26
26
  import { useInjectButtonGroup } from "../../composables/useButtonGroup";
27
27
  import appConfig from "#build/app.config";
28
28
  import { button } from "#ui/ui.config";
@@ -34,6 +34,7 @@ export default defineComponent({
34
34
  },
35
35
  inheritAttrs: false,
36
36
  props: {
37
+ ...nuxtLinkProps,
37
38
  type: {
38
39
  type: String,
39
40
  default: "button"
@@ -172,6 +173,7 @@ export default defineComponent({
172
173
  props.loading && !isLeading.value && ui.value.icon.loading
173
174
  );
174
175
  });
176
+ const linkProps = computed(() => getNuxtLinkProps(props));
175
177
  return {
176
178
  // eslint-disable-next-line vue/no-dupe-keys
177
179
  ui,
@@ -183,7 +185,8 @@ export default defineComponent({
183
185
  leadingIconName,
184
186
  trailingIconName,
185
187
  leadingIconClass,
186
- trailingIconClass
188
+ trailingIconClass,
189
+ linkProps
187
190
  };
188
191
  }
189
192
  });
@@ -80,6 +80,58 @@ declare const _default: import("vue").DefineComponent<{
80
80
  type: PropType<any>;
81
81
  default: () => {};
82
82
  };
83
+ to: {
84
+ readonly type: PropType<import("vue-router").RouteLocationRaw>;
85
+ readonly default: undefined;
86
+ };
87
+ href: {
88
+ readonly type: PropType<import("vue-router").RouteLocationRaw>;
89
+ readonly default: undefined;
90
+ };
91
+ target: {
92
+ readonly type: PropType<(string & {}) | "_blank" | "_parent" | "_self" | "_top" | null>;
93
+ readonly default: undefined;
94
+ };
95
+ rel: {
96
+ readonly type: PropType<string | null>;
97
+ readonly default: undefined;
98
+ };
99
+ noRel: {
100
+ readonly type: BooleanConstructor;
101
+ readonly default: undefined;
102
+ };
103
+ prefetch: {
104
+ readonly type: BooleanConstructor;
105
+ readonly default: undefined;
106
+ };
107
+ noPrefetch: {
108
+ readonly type: BooleanConstructor;
109
+ readonly default: undefined;
110
+ };
111
+ activeClass: {
112
+ readonly type: StringConstructor;
113
+ readonly default: undefined;
114
+ };
115
+ exactActiveClass: {
116
+ readonly type: StringConstructor;
117
+ readonly default: undefined;
118
+ };
119
+ prefetchedClass: {
120
+ readonly type: StringConstructor;
121
+ readonly default: undefined;
122
+ };
123
+ replace: {
124
+ readonly type: BooleanConstructor;
125
+ readonly default: undefined;
126
+ };
127
+ ariaCurrentValue: {
128
+ readonly type: StringConstructor;
129
+ readonly default: undefined;
130
+ };
131
+ external: {
132
+ readonly type: BooleanConstructor;
133
+ readonly default: undefined;
134
+ };
83
135
  }, {
84
136
  ui: import("vue").ComputedRef<any>;
85
137
  attrs: import("vue").ComputedRef<Pick<{
@@ -93,6 +145,7 @@ declare const _default: import("vue").DefineComponent<{
93
145
  trailingIconName: import("vue").ComputedRef<string | undefined>;
94
146
  leadingIconClass: import("vue").ComputedRef<string>;
95
147
  trailingIconClass: import("vue").ComputedRef<string>;
148
+ linkProps: import("vue").ComputedRef<{}>;
96
149
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
97
150
  type: {
98
151
  type: StringConstructor;
@@ -173,6 +226,58 @@ declare const _default: import("vue").DefineComponent<{
173
226
  type: PropType<any>;
174
227
  default: () => {};
175
228
  };
229
+ to: {
230
+ readonly type: PropType<import("vue-router").RouteLocationRaw>;
231
+ readonly default: undefined;
232
+ };
233
+ href: {
234
+ readonly type: PropType<import("vue-router").RouteLocationRaw>;
235
+ readonly default: undefined;
236
+ };
237
+ target: {
238
+ readonly type: PropType<(string & {}) | "_blank" | "_parent" | "_self" | "_top" | null>;
239
+ readonly default: undefined;
240
+ };
241
+ rel: {
242
+ readonly type: PropType<string | null>;
243
+ readonly default: undefined;
244
+ };
245
+ noRel: {
246
+ readonly type: BooleanConstructor;
247
+ readonly default: undefined;
248
+ };
249
+ prefetch: {
250
+ readonly type: BooleanConstructor;
251
+ readonly default: undefined;
252
+ };
253
+ noPrefetch: {
254
+ readonly type: BooleanConstructor;
255
+ readonly default: undefined;
256
+ };
257
+ activeClass: {
258
+ readonly type: StringConstructor;
259
+ readonly default: undefined;
260
+ };
261
+ exactActiveClass: {
262
+ readonly type: StringConstructor;
263
+ readonly default: undefined;
264
+ };
265
+ prefetchedClass: {
266
+ readonly type: StringConstructor;
267
+ readonly default: undefined;
268
+ };
269
+ replace: {
270
+ readonly type: BooleanConstructor;
271
+ readonly default: undefined;
272
+ };
273
+ ariaCurrentValue: {
274
+ readonly type: StringConstructor;
275
+ readonly default: undefined;
276
+ };
277
+ external: {
278
+ readonly type: BooleanConstructor;
279
+ readonly default: undefined;
280
+ };
176
281
  }>>, {
177
282
  size: ButtonSize;
178
283
  ui: any;
@@ -181,6 +286,7 @@ declare const _default: import("vue").DefineComponent<{
181
286
  color: any;
182
287
  type: string;
183
288
  leading: boolean;
289
+ replace: boolean;
184
290
  class: any;
185
291
  label: string;
186
292
  loading: boolean;
@@ -193,5 +299,17 @@ declare const _default: import("vue").DefineComponent<{
193
299
  trailingIcon: string;
194
300
  trailing: boolean;
195
301
  square: boolean;
302
+ to: import("vue-router").RouteLocationRaw;
303
+ href: import("vue-router").RouteLocationRaw;
304
+ target: (string & {}) | "_blank" | "_parent" | "_self" | "_top" | null;
305
+ rel: string | null;
306
+ noRel: boolean;
307
+ prefetch: boolean;
308
+ noPrefetch: boolean;
309
+ activeClass: string;
310
+ exactActiveClass: string;
311
+ prefetchedClass: string;
312
+ ariaCurrentValue: string;
313
+ external: boolean;
196
314
  }, {}>;
197
315
  export default _default;
@@ -23,7 +23,7 @@
23
23
 
24
24
  <HMenuItems :class="[ui.base, ui.divide, ui.ring, ui.rounded, ui.shadow, ui.background, ui.height]" static>
25
25
  <div v-for="(subItems, index) of items" :key="index" :class="ui.padding">
26
- <NuxtLink v-for="(item, subIndex) of subItems" :key="subIndex" v-slot="{ href, target, rel, navigate, isExternal }" v-bind="omit(item, ['label', 'labelClass', 'slot', 'icon', 'iconClass', 'avatar', 'shortcuts', 'disabled', 'class', 'click'])" custom>
26
+ <NuxtLink v-for="(item, subIndex) of subItems" :key="subIndex" v-slot="{ href, target, rel, navigate, isExternal }" v-bind="getNuxtLinkProps(item)" custom>
27
27
  <HMenuItem v-slot="{ active, disabled: itemDisabled, close }" :disabled="item.disabled">
28
28
  <component
29
29
  :is="!!href ? 'a' : 'button'"
@@ -64,7 +64,7 @@ import UAvatar from "../elements/Avatar.vue";
64
64
  import UKbd from "../elements/Kbd.vue";
65
65
  import { useUI } from "../../composables/useUI";
66
66
  import { usePopper } from "../../composables/usePopper";
67
- import { mergeConfig, omit } from "../../utils";
67
+ import { mergeConfig, getNuxtLinkProps } from "../../utils";
68
68
  import appConfig from "#build/app.config";
69
69
  import { dropdown } from "#ui/ui.config";
70
70
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.dropdown, dropdown);
@@ -233,7 +233,7 @@ export default defineComponent({
233
233
  onMouseOver,
234
234
  onMouseLeave,
235
235
  onClick,
236
- omit,
236
+ getNuxtLinkProps,
237
237
  twMerge,
238
238
  twJoin,
239
239
  NuxtLink
@@ -1,6 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
2
  import { twJoin } from 'tailwind-merge';
3
- import { omit } from '../../utils';
4
3
  import type { DropdownItem, PopperOptions } from '../../types';
5
4
  declare const _default: import("vue").DefineComponent<{
6
5
  items: {
@@ -77,7 +76,7 @@ declare const _default: import("vue").DefineComponent<{
77
76
  close: any;
78
77
  isExternal: any;
79
78
  }) => void;
80
- omit: typeof omit;
79
+ getNuxtLinkProps: (props: any) => {};
81
80
  twMerge: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
82
81
  twJoin: typeof twJoin;
83
82
  NuxtLink: string | import("vue").ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
@@ -2,6 +2,7 @@
2
2
  <component
3
3
  :is="as"
4
4
  v-if="!to"
5
+ :type="type"
5
6
  :disabled="disabled"
6
7
  v-bind="$attrs"
7
8
  :class="active ? activeClass : inactiveClass"
@@ -32,15 +33,19 @@
32
33
  <script>
33
34
  import { isEqual } from "ohash";
34
35
  import { defineComponent } from "vue";
35
- import { NuxtLink } from "#components";
36
+ import { nuxtLinkProps } from "../../utils";
36
37
  export default defineComponent({
37
38
  inheritAttrs: false,
38
39
  props: {
39
- ...NuxtLink.props,
40
+ ...nuxtLinkProps,
40
41
  as: {
41
42
  type: String,
42
43
  default: "button"
43
44
  },
45
+ type: {
46
+ type: String,
47
+ default: "button"
48
+ },
44
49
  disabled: {
45
50
  type: Boolean,
46
51
  default: null
@@ -1,9 +1,199 @@
1
- declare const _default: import("vue").DefineComponent<any, {
1
+ declare const _default: import("vue").DefineComponent<{
2
+ as: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ type: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ disabled: {
11
+ type: BooleanConstructor;
12
+ default: null;
13
+ };
14
+ active: {
15
+ type: BooleanConstructor;
16
+ default: undefined;
17
+ };
18
+ exact: {
19
+ type: BooleanConstructor;
20
+ default: boolean;
21
+ };
22
+ exactQuery: {
23
+ type: BooleanConstructor;
24
+ default: boolean;
25
+ };
26
+ exactHash: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
30
+ inactiveClass: {
31
+ type: StringConstructor;
32
+ default: undefined;
33
+ };
34
+ to: {
35
+ readonly type: import("vue").PropType<import("vue-router").RouteLocationRaw>;
36
+ readonly default: undefined;
37
+ };
38
+ href: {
39
+ readonly type: import("vue").PropType<import("vue-router").RouteLocationRaw>;
40
+ readonly default: undefined;
41
+ };
42
+ target: {
43
+ readonly type: import("vue").PropType<(string & {}) | "_blank" | "_parent" | "_self" | "_top" | null>;
44
+ readonly default: undefined;
45
+ };
46
+ rel: {
47
+ readonly type: import("vue").PropType<string | null>;
48
+ readonly default: undefined;
49
+ };
50
+ noRel: {
51
+ readonly type: BooleanConstructor;
52
+ readonly default: undefined;
53
+ };
54
+ prefetch: {
55
+ readonly type: BooleanConstructor;
56
+ readonly default: undefined;
57
+ };
58
+ noPrefetch: {
59
+ readonly type: BooleanConstructor;
60
+ readonly default: undefined;
61
+ };
62
+ activeClass: {
63
+ readonly type: StringConstructor;
64
+ readonly default: undefined;
65
+ };
66
+ exactActiveClass: {
67
+ readonly type: StringConstructor;
68
+ readonly default: undefined;
69
+ };
70
+ prefetchedClass: {
71
+ readonly type: StringConstructor;
72
+ readonly default: undefined;
73
+ };
74
+ replace: {
75
+ readonly type: BooleanConstructor;
76
+ readonly default: undefined;
77
+ };
78
+ ariaCurrentValue: {
79
+ readonly type: StringConstructor;
80
+ readonly default: undefined;
81
+ };
82
+ external: {
83
+ readonly type: BooleanConstructor;
84
+ readonly default: undefined;
85
+ };
86
+ }, {
2
87
  resolveLinkClass: (route: any, $route: any, { isActive, isExactActive }: {
3
88
  isActive: boolean;
4
89
  isExactActive: boolean;
5
- }) => any;
6
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<any>, {} | {
7
- [x: string]: any;
90
+ }) => string | undefined;
91
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
92
+ as: {
93
+ type: StringConstructor;
94
+ default: string;
95
+ };
96
+ type: {
97
+ type: StringConstructor;
98
+ default: string;
99
+ };
100
+ disabled: {
101
+ type: BooleanConstructor;
102
+ default: null;
103
+ };
104
+ active: {
105
+ type: BooleanConstructor;
106
+ default: undefined;
107
+ };
108
+ exact: {
109
+ type: BooleanConstructor;
110
+ default: boolean;
111
+ };
112
+ exactQuery: {
113
+ type: BooleanConstructor;
114
+ default: boolean;
115
+ };
116
+ exactHash: {
117
+ type: BooleanConstructor;
118
+ default: boolean;
119
+ };
120
+ inactiveClass: {
121
+ type: StringConstructor;
122
+ default: undefined;
123
+ };
124
+ to: {
125
+ readonly type: import("vue").PropType<import("vue-router").RouteLocationRaw>;
126
+ readonly default: undefined;
127
+ };
128
+ href: {
129
+ readonly type: import("vue").PropType<import("vue-router").RouteLocationRaw>;
130
+ readonly default: undefined;
131
+ };
132
+ target: {
133
+ readonly type: import("vue").PropType<(string & {}) | "_blank" | "_parent" | "_self" | "_top" | null>;
134
+ readonly default: undefined;
135
+ };
136
+ rel: {
137
+ readonly type: import("vue").PropType<string | null>;
138
+ readonly default: undefined;
139
+ };
140
+ noRel: {
141
+ readonly type: BooleanConstructor;
142
+ readonly default: undefined;
143
+ };
144
+ prefetch: {
145
+ readonly type: BooleanConstructor;
146
+ readonly default: undefined;
147
+ };
148
+ noPrefetch: {
149
+ readonly type: BooleanConstructor;
150
+ readonly default: undefined;
151
+ };
152
+ activeClass: {
153
+ readonly type: StringConstructor;
154
+ readonly default: undefined;
155
+ };
156
+ exactActiveClass: {
157
+ readonly type: StringConstructor;
158
+ readonly default: undefined;
159
+ };
160
+ prefetchedClass: {
161
+ readonly type: StringConstructor;
162
+ readonly default: undefined;
163
+ };
164
+ replace: {
165
+ readonly type: BooleanConstructor;
166
+ readonly default: undefined;
167
+ };
168
+ ariaCurrentValue: {
169
+ readonly type: StringConstructor;
170
+ readonly default: undefined;
171
+ };
172
+ external: {
173
+ readonly type: BooleanConstructor;
174
+ readonly default: undefined;
175
+ };
176
+ }>>, {
177
+ type: string;
178
+ replace: boolean;
179
+ as: string;
180
+ disabled: boolean;
181
+ to: import("vue-router").RouteLocationRaw;
182
+ href: import("vue-router").RouteLocationRaw;
183
+ target: (string & {}) | "_blank" | "_parent" | "_self" | "_top" | null;
184
+ rel: string | null;
185
+ noRel: boolean;
186
+ prefetch: boolean;
187
+ noPrefetch: boolean;
188
+ activeClass: string;
189
+ exactActiveClass: string;
190
+ prefetchedClass: string;
191
+ ariaCurrentValue: string;
192
+ external: boolean;
193
+ active: boolean;
194
+ exact: boolean;
195
+ exactQuery: boolean;
196
+ exactHash: boolean;
197
+ inactiveClass: string;
8
198
  }, {}>;
9
199
  export default _default;
@@ -19,7 +19,7 @@
19
19
  :class="inputClass"
20
20
  autocomplete="off"
21
21
  v-bind="attrs"
22
- :display-value="() => query ? query : ['string', 'number'].includes(typeof modelValue) ? modelValue : modelValue[optionAttribute]"
22
+ :display-value="() => query ? query : label"
23
23
  @change="onChange"
24
24
  />
25
25
 
@@ -280,6 +280,14 @@ export default defineComponent({
280
280
  emit("update:query", value);
281
281
  }
282
282
  });
283
+ const label = computed(() => {
284
+ if (props.valueAttribute) {
285
+ const option = props.options.find((option2) => option2[props.valueAttribute] === props.modelValue);
286
+ return option ? option[props.optionAttribute] : null;
287
+ } else {
288
+ return ["string", "number"].includes(typeof props.modelValue) ? props.modelValue : props.modelValue[props.optionAttribute];
289
+ }
290
+ });
283
291
  const inputClass = computed(() => {
284
292
  const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
285
293
  return twMerge(twJoin(
@@ -389,6 +397,7 @@ export default defineComponent({
389
397
  popper,
390
398
  trigger,
391
399
  container,
400
+ label,
392
401
  isLeading,
393
402
  isTrailing,
394
403
  // eslint-disable-next-line vue/no-dupe-keys
@@ -2,7 +2,7 @@ import type { PropType } from 'vue';
2
2
  import type { InputSize, InputVariant, PopperOptions } from '../../types';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  modelValue: {
5
- type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
5
+ type: (ObjectConstructor | NumberConstructor | StringConstructor | ArrayConstructor)[];
6
6
  default: string;
7
7
  };
8
8
  query: {
@@ -142,6 +142,7 @@ declare const _default: import("vue").DefineComponent<{
142
142
  popper: import("vue").ComputedRef<PopperOptions>;
143
143
  trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
144
144
  container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
145
+ label: import("vue").ComputedRef<any>;
145
146
  isLeading: import("vue").ComputedRef<string | true>;
146
147
  isTrailing: import("vue").ComputedRef<string | true | undefined>;
147
148
  inputClass: import("vue").ComputedRef<string>;
@@ -157,7 +158,7 @@ declare const _default: import("vue").DefineComponent<{
157
158
  onChange: (event: any) => void;
158
159
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "update:modelValue" | "open" | "update:query")[], "change" | "close" | "update:modelValue" | "open" | "update:query", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
159
160
  modelValue: {
160
- type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
161
+ type: (ObjectConstructor | NumberConstructor | StringConstructor | ArrayConstructor)[];
161
162
  default: string;
162
163
  };
163
164
  query: {
@@ -36,8 +36,7 @@
36
36
  </span>
37
37
 
38
38
  <slot name="label">
39
- <span v-if="multiple && Array.isArray(modelValue) && modelValue.length" :class="uiMenu.label">{{ modelValue.length }} selected</span>
40
- <span v-else-if="!multiple && modelValue" :class="uiMenu.label">{{ ['string', 'number'].includes(typeof modelValue) ? modelValue : modelValue[optionAttribute] }}</span>
39
+ <span v-if="label" :class="uiMenu.label">{{ label }}</span>
41
40
  <span v-else :class="uiMenu.label">{{ placeholder || '&nbsp;' }}</span>
42
41
  </slot>
43
42
 
@@ -342,6 +341,22 @@ export default defineComponent({
342
341
  emit("update:query", value);
343
342
  }
344
343
  });
344
+ const label = computed(() => {
345
+ if (props.multiple) {
346
+ if (Array.isArray(props.modelValue) && props.modelValue.length) {
347
+ return `${props.modelValue.length} selected`;
348
+ } else {
349
+ return null;
350
+ }
351
+ } else {
352
+ if (props.valueAttribute) {
353
+ const option = props.options.find((option2) => option2[props.valueAttribute] === props.modelValue);
354
+ return option ? option[props.optionAttribute] : null;
355
+ } else {
356
+ return ["string", "number"].includes(typeof props.modelValue) ? props.modelValue : props.modelValue[props.optionAttribute];
357
+ }
358
+ }
359
+ });
345
360
  const selectClass = computed(() => {
346
361
  const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
347
362
  return twMerge(twJoin(
@@ -472,6 +487,7 @@ export default defineComponent({
472
487
  popper,
473
488
  trigger,
474
489
  container,
490
+ label,
475
491
  isLeading,
476
492
  isTrailing,
477
493
  // eslint-disable-next-line vue/no-dupe-keys
@@ -2,7 +2,7 @@ import type { PropType } from 'vue';
2
2
  import type { SelectSize, SelectVariant, PopperOptions } from '../../types';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  modelValue: {
5
- type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
5
+ type: (ObjectConstructor | NumberConstructor | StringConstructor | ArrayConstructor)[];
6
6
  default: string;
7
7
  };
8
8
  query: {
@@ -162,6 +162,7 @@ declare const _default: import("vue").DefineComponent<{
162
162
  popper: import("vue").ComputedRef<PopperOptions>;
163
163
  trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
164
164
  container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
165
+ label: import("vue").ComputedRef<any>;
165
166
  isLeading: import("vue").ComputedRef<string | true>;
166
167
  isTrailing: import("vue").ComputedRef<string | true | undefined>;
167
168
  selectClass: import("vue").ComputedRef<string>;
@@ -180,7 +181,7 @@ declare const _default: import("vue").DefineComponent<{
180
181
  onChange: (event: any) => void;
181
182
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "update:modelValue" | "open" | "update:query")[], "change" | "close" | "update:modelValue" | "open" | "update:query", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
182
183
  modelValue: {
183
- type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
184
+ type: (ObjectConstructor | NumberConstructor | StringConstructor | ArrayConstructor)[];
184
185
  default: string;
185
186
  };
186
187
  query: {
@@ -68,24 +68,23 @@ export default defineComponent({
68
68
  },
69
69
  setup(props) {
70
70
  const { ui, attrs } = useUI("divider", toRef(props, "ui"), config);
71
- const isHorizontal = computed(() => props.orientation === "horizontal");
72
71
  const wrapperClass = computed(() => {
73
72
  return twMerge(twJoin(
74
73
  ui.value.wrapper.base,
75
- isHorizontal.value ? ui.value.wrapper.horizontal : ui.value.wrapper.vertical
74
+ ui.value.wrapper[props.orientation]
76
75
  ), props.class);
77
76
  });
78
77
  const containerClass = computed(() => {
79
78
  return twJoin(
80
79
  ui.value.container.base,
81
- isHorizontal.value ? ui.value.container.horizontal : ui.value.container.vertical
80
+ ui.value.container[props.orientation]
82
81
  );
83
82
  });
84
83
  const borderClass = computed(() => {
85
84
  return twJoin(
86
85
  ui.value.border.base,
87
- isHorizontal.value ? ui.value.border.horizontal : ui.value.border.vertical,
88
- isHorizontal.value ? ui.value.border.size.horizontal : ui.value.border.size.vertical,
86
+ ui.value.border[props.orientation],
87
+ ui.value.border.size[props.orientation],
89
88
  ui.value.border.type[props.type]
90
89
  );
91
90
  });
@@ -5,7 +5,7 @@
5
5
  <ULink
6
6
  as="span"
7
7
  :class="[ui.base, index === links.length - 1 ? ui.active : !!link.to ? ui.inactive : '']"
8
- v-bind="omit(link, ['label', 'labelClass', 'icon', 'iconClass'])"
8
+ v-bind="getULinkProps(link)"
9
9
  :aria-current="index === links.length - 1 ? 'page' : undefined"
10
10
  >
11
11
  <slot name="icon" :link="link" :index="index" :is-active="index === links.length - 1">
@@ -38,7 +38,7 @@ import { twMerge, twJoin } from "tailwind-merge";
38
38
  import UIcon from "../elements/Icon.vue";
39
39
  import ULink from "../elements/Link.vue";
40
40
  import { useUI } from "../../composables/useUI";
41
- import { mergeConfig, omit } from "../../utils";
41
+ import { mergeConfig, getULinkProps } from "../../utils";
42
42
  import appConfig from "#build/app.config";
43
43
  import { breadcrumb } from "#ui/ui.config";
44
44
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.breadcrumb, breadcrumb);
@@ -72,7 +72,7 @@ export default defineComponent({
72
72
  // eslint-disable-next-line vue/no-dupe-keys
73
73
  ui,
74
74
  attrs,
75
- omit,
75
+ getULinkProps,
76
76
  twMerge,
77
77
  twJoin
78
78
  };
@@ -1,6 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
2
  import { twJoin } from 'tailwind-merge';
3
- import { omit } from '../../utils';
4
3
  import type { BreadcrumbLink } from '../../types';
5
4
  declare const _default: import("vue").DefineComponent<{
6
5
  links: {
@@ -24,7 +23,7 @@ declare const _default: import("vue").DefineComponent<{
24
23
  attrs: import("vue").ComputedRef<Pick<{
25
24
  [x: string]: unknown;
26
25
  }, string>>;
27
- omit: typeof omit;
26
+ getULinkProps: (props: any) => {};
28
27
  twMerge: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
29
28
  twJoin: typeof twJoin;
30
29
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -3,7 +3,7 @@ import type { UseFuseOptions } from '@vueuse/integrations/useFuse';
3
3
  import type { Group, Command, Button } from '../../types';
4
4
  declare const _default: import("vue").DefineComponent<{
5
5
  modelValue: {
6
- type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
6
+ type: (ObjectConstructor | NumberConstructor | StringConstructor | ArrayConstructor)[];
7
7
  default: null;
8
8
  };
9
9
  by: {
@@ -112,7 +112,7 @@ declare const _default: import("vue").DefineComponent<{
112
112
  onClear: () => void;
113
113
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "update:modelValue")[], "close" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
114
114
  modelValue: {
115
- type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
115
+ type: (ObjectConstructor | NumberConstructor | StringConstructor | ArrayConstructor)[];
116
116
  default: null;
117
117
  };
118
118
  by: {
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <nav :class="ui.wrapper" v-bind="attrs">
3
- <ul v-for="(section, sectionIndex) of linkSections" :key="`linkSection${sectionIndex}`">
4
- <li v-for="(link, index) of section" :key="`linkSection${sectionIndex}-${index}`">
3
+ <ul v-for="(section, sectionIndex) of sections" :key="`section${sectionIndex}`">
4
+ <li v-for="(link, index) of section" :key="`section${sectionIndex}-${index}`">
5
5
  <ULink
6
6
  v-slot="{ isActive }"
7
- v-bind="omit(link, ['label', 'labelClass', 'icon', 'iconClass', 'avatar', 'badge', 'click'])"
7
+ v-bind="getULinkProps(link)"
8
8
  :class="[ui.base, ui.padding, ui.width, ui.ring, ui.rounded, ui.font, ui.size]"
9
9
  :active-class="ui.active"
10
10
  :inactive-class="ui.inactive"
@@ -40,7 +40,7 @@
40
40
  </slot>
41
41
  </ULink>
42
42
  </li>
43
- <UDivider v-if="sectionIndex < linkSections.length - 1" :ui="ui.divider" />
43
+ <UDivider v-if="sectionIndex < sections.length - 1" :ui="ui.divider" />
44
44
  </ul>
45
45
  </nav>
46
46
  </template>
@@ -53,7 +53,7 @@ import UAvatar from "../elements/Avatar.vue";
53
53
  import ULink from "../elements/Link.vue";
54
54
  import UDivider from "../layout/Divider.vue";
55
55
  import { useUI } from "../../composables/useUI";
56
- import { mergeConfig, omit } from "../../utils";
56
+ import { mergeConfig, getULinkProps } from "../../utils";
57
57
  import appConfig from "#build/app.config";
58
58
  import { verticalNavigation } from "#ui/ui.config";
59
59
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.verticalNavigation, verticalNavigation);
@@ -81,15 +81,13 @@ export default defineComponent({
81
81
  },
82
82
  setup(props) {
83
83
  const { ui, attrs } = useUI("verticalNavigation", toRef(props, "ui"), config, toRef(props, "class"));
84
- const linkSections = computed(() => {
85
- return Array.isArray(props.links[0]) ? props.links : [props.links];
86
- });
84
+ const sections = computed(() => Array.isArray(props.links[0]) ? props.links : [props.links]);
87
85
  return {
88
86
  // eslint-disable-next-line vue/no-dupe-keys
89
87
  ui,
90
88
  attrs,
91
- omit,
92
- linkSections,
89
+ sections,
90
+ getULinkProps,
93
91
  twMerge,
94
92
  twJoin
95
93
  };
@@ -1,6 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
2
  import { twJoin } from 'tailwind-merge';
3
- import { omit } from '../../utils';
4
3
  import type { VerticalNavigationLink } from '../../types';
5
4
  declare const _default: import("vue").DefineComponent<{
6
5
  links: {
@@ -20,8 +19,8 @@ declare const _default: import("vue").DefineComponent<{
20
19
  attrs: import("vue").ComputedRef<Pick<{
21
20
  [x: string]: unknown;
22
21
  }, string>>;
23
- omit: typeof omit;
24
- linkSections: import("vue").ComputedRef<VerticalNavigationLink[][]>;
22
+ sections: import("vue").ComputedRef<VerticalNavigationLink[][]>;
23
+ getULinkProps: (props: any) => {};
25
24
  twMerge: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
26
25
  twJoin: typeof twJoin;
27
26
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -19,7 +19,7 @@
19
19
 
20
20
  <UKbd v-for="shortcut of shortcuts" :key="shortcut" size="xs">
21
21
  {{ shortcut }}
22
- </Ukbd>
22
+ </UKbd>
23
23
  </span>
24
24
  </div>
25
25
  </div>
@@ -6,6 +6,10 @@ export type ChipColor = 'gray' | typeof colors[number]
6
6
  export type ChipPosition = keyof typeof chip.position
7
7
 
8
8
  export interface Chip {
9
+ size?: ChipSize
9
10
  color?: ChipColor
10
11
  position?: ChipPosition
12
+ text?: string
13
+ inset?: boolean
14
+ show?: boolean
11
15
  }
@@ -22,5 +22,6 @@ export * from './select'
22
22
  export * from './tabs'
23
23
  export * from './textarea'
24
24
  export * from './toggle'
25
+ export * from './tooltip'
25
26
  export * from './vertical-navigation'
26
27
  export * from './utils'
@@ -1,6 +1,9 @@
1
1
  import type { NuxtLinkProps } from '#app'
2
2
 
3
3
  export interface Link extends NuxtLinkProps {
4
+ as?: string
5
+ type?: string
6
+ disabled?: boolean
4
7
  active?: boolean
5
8
  exact?: boolean
6
9
  exactQuery?: boolean
@@ -0,0 +1,7 @@
1
+ export interface Tooltip {
2
+ text?: string
3
+ prevent?: boolean
4
+ shortcuts?: string[]
5
+ openDelay?: number
6
+ closeDelay?: number
7
+ }
@@ -8,3 +8,4 @@ export declare function getSlotsChildren(slots: any): any;
8
8
  */
9
9
  export declare function looseToNumber(val: any): any;
10
10
  export * from './lodash';
11
+ export * from './link';
@@ -55,3 +55,4 @@ export function looseToNumber(val) {
55
55
  return isNaN(n) ? val : n;
56
56
  }
57
57
  export * from "./lodash.mjs";
58
+ export * from "./link.mjs";
@@ -0,0 +1,58 @@
1
+ import type { PropType } from 'vue';
2
+ import type { RouteLocationRaw } from 'vue-router';
3
+ export declare const nuxtLinkProps: {
4
+ readonly to: {
5
+ readonly type: PropType<RouteLocationRaw>;
6
+ readonly default: undefined;
7
+ };
8
+ readonly href: {
9
+ readonly type: PropType<RouteLocationRaw>;
10
+ readonly default: undefined;
11
+ };
12
+ readonly target: {
13
+ readonly type: PropType<(string & {}) | "_blank" | "_parent" | "_self" | "_top" | null>;
14
+ readonly default: undefined;
15
+ };
16
+ readonly rel: {
17
+ readonly type: PropType<string | null>;
18
+ readonly default: undefined;
19
+ };
20
+ readonly noRel: {
21
+ readonly type: BooleanConstructor;
22
+ readonly default: undefined;
23
+ };
24
+ readonly prefetch: {
25
+ readonly type: BooleanConstructor;
26
+ readonly default: undefined;
27
+ };
28
+ readonly noPrefetch: {
29
+ readonly type: BooleanConstructor;
30
+ readonly default: undefined;
31
+ };
32
+ readonly activeClass: {
33
+ readonly type: StringConstructor;
34
+ readonly default: undefined;
35
+ };
36
+ readonly exactActiveClass: {
37
+ readonly type: StringConstructor;
38
+ readonly default: undefined;
39
+ };
40
+ readonly prefetchedClass: {
41
+ readonly type: StringConstructor;
42
+ readonly default: undefined;
43
+ };
44
+ readonly replace: {
45
+ readonly type: BooleanConstructor;
46
+ readonly default: undefined;
47
+ };
48
+ readonly ariaCurrentValue: {
49
+ readonly type: StringConstructor;
50
+ readonly default: undefined;
51
+ };
52
+ readonly external: {
53
+ readonly type: BooleanConstructor;
54
+ readonly default: undefined;
55
+ };
56
+ };
57
+ export declare const getNuxtLinkProps: (props: any) => {};
58
+ export declare const getULinkProps: (props: any) => {};
@@ -0,0 +1,111 @@
1
+ export const nuxtLinkProps = {
2
+ to: {
3
+ type: [String, Object],
4
+ default: void 0
5
+ },
6
+ href: {
7
+ type: [String, Object],
8
+ default: void 0
9
+ },
10
+ // Attributes
11
+ target: {
12
+ type: String,
13
+ default: void 0
14
+ },
15
+ rel: {
16
+ type: String,
17
+ default: void 0
18
+ },
19
+ noRel: {
20
+ type: Boolean,
21
+ default: void 0
22
+ },
23
+ // Prefetching
24
+ prefetch: {
25
+ type: Boolean,
26
+ default: void 0
27
+ },
28
+ noPrefetch: {
29
+ type: Boolean,
30
+ default: void 0
31
+ },
32
+ // Styling
33
+ activeClass: {
34
+ type: String,
35
+ default: void 0
36
+ },
37
+ exactActiveClass: {
38
+ type: String,
39
+ default: void 0
40
+ },
41
+ prefetchedClass: {
42
+ type: String,
43
+ default: void 0
44
+ },
45
+ // Vue Router's `<RouterLink>` additional props
46
+ replace: {
47
+ type: Boolean,
48
+ default: void 0
49
+ },
50
+ ariaCurrentValue: {
51
+ type: String,
52
+ default: void 0
53
+ },
54
+ // Edge cases handling
55
+ external: {
56
+ type: Boolean,
57
+ default: void 0
58
+ }
59
+ };
60
+ const uLinkProps = {
61
+ as: {
62
+ type: String,
63
+ default: "button"
64
+ },
65
+ type: {
66
+ type: String,
67
+ default: "button"
68
+ },
69
+ disabled: {
70
+ type: Boolean,
71
+ default: null
72
+ },
73
+ active: {
74
+ type: Boolean,
75
+ default: void 0
76
+ },
77
+ exact: {
78
+ type: Boolean,
79
+ default: false
80
+ },
81
+ exactQuery: {
82
+ type: Boolean,
83
+ default: false
84
+ },
85
+ exactHash: {
86
+ type: Boolean,
87
+ default: false
88
+ },
89
+ inactiveClass: {
90
+ type: String,
91
+ default: void 0
92
+ }
93
+ };
94
+ export const getNuxtLinkProps = (props) => {
95
+ const keys = Object.keys(nuxtLinkProps);
96
+ return keys.reduce((acc, key) => {
97
+ if (props[key] !== void 0) {
98
+ acc[key] = props[key];
99
+ }
100
+ return acc;
101
+ }, {});
102
+ };
103
+ export const getULinkProps = (props) => {
104
+ const keys = [...Object.keys(nuxtLinkProps), ...Object.keys(uLinkProps)];
105
+ return keys.reduce((acc, key) => {
106
+ if (props[key] !== void 0) {
107
+ acc[key] = props[key];
108
+ }
109
+ return acc;
110
+ }, {});
111
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
- "version": "2.12.0",
3
+ "version": "2.12.2",
4
4
  "repository": "nuxt/ui",
5
5
  "homepage": "https://ui.nuxt.com",
6
6
  "license": "MIT",
@@ -34,52 +34,52 @@
34
34
  "dependencies": {
35
35
  "@egoist/tailwindcss-icons": "^1.7.2",
36
36
  "@headlessui/tailwindcss": "^0.2.0",
37
- "@headlessui/vue": "^1.7.16",
37
+ "@headlessui/vue": "1.7.16",
38
38
  "@iconify-json/heroicons": "^1.1.19",
39
- "@nuxt/kit": "^3.9.1",
39
+ "@nuxt/kit": "^3.9.3",
40
40
  "@nuxtjs/color-mode": "^3.3.2",
41
- "@nuxtjs/tailwindcss": "^6.10.3",
41
+ "@nuxtjs/tailwindcss": "^6.10.4",
42
42
  "@popperjs/core": "^2.11.8",
43
43
  "@tailwindcss/aspect-ratio": "^0.4.2",
44
44
  "@tailwindcss/container-queries": "^0.1.1",
45
45
  "@tailwindcss/forms": "^0.5.7",
46
46
  "@tailwindcss/typography": "^0.5.10",
47
- "@vueuse/core": "^10.7.1",
48
- "@vueuse/integrations": "^10.7.1",
49
- "@vueuse/math": "^10.7.1",
47
+ "@vueuse/core": "^10.7.2",
48
+ "@vueuse/integrations": "^10.7.2",
49
+ "@vueuse/math": "^10.7.2",
50
50
  "defu": "^6.1.4",
51
51
  "fuse.js": "^6.6.2",
52
52
  "nuxt-icon": "^0.6.8",
53
53
  "ohash": "^1.1.3",
54
- "pathe": "^1.1.1",
55
- "scule": "^1.1.1",
54
+ "pathe": "^1.1.2",
55
+ "scule": "^1.2.0",
56
56
  "tailwind-merge": "^2.2.0",
57
57
  "tailwindcss": "^3.4.1"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@nuxt/eslint-config": "^0.2.0",
61
61
  "@nuxt/module-builder": "^0.5.5",
62
- "@nuxt/test-utils": "^3.9.0",
62
+ "@nuxt/test-utils": "^3.10.0",
63
63
  "@release-it/conventional-changelog": "^8.0.1",
64
64
  "@vue/test-utils": "^2.4.3",
65
65
  "eslint": "^8.56.0",
66
66
  "happy-dom": "^12.10.3",
67
- "joi": "^17.11.0",
68
- "nuxt": "^3.9.1",
67
+ "joi": "^17.11.1",
68
+ "nuxt": "^3.9.3",
69
69
  "release-it": "^17.0.1",
70
70
  "typescript": "^5.3.3",
71
71
  "unbuild": "^2.0.0",
72
72
  "valibot": "^0.25.0",
73
- "vitest": "^1.1.3",
73
+ "vitest": "^1.2.1",
74
74
  "vitest-environment-nuxt": "^1.0.0",
75
75
  "vue-tsc": "^1.8.27",
76
76
  "yup": "^1.3.3",
77
77
  "zod": "^3.22.4"
78
78
  },
79
79
  "resolutions": {
80
- "@nuxt/kit": "3.9.1",
81
- "@nuxt/schema": "3.9.1",
82
- "vue": "3.3.13",
83
- "tailwindcss": "3.4.1"
80
+ "@nuxt/kit": "3.9.3",
81
+ "@nuxt/schema": "3.9.3",
82
+ "tailwindcss": "3.4.1",
83
+ "vue": "3.3.13"
84
84
  }
85
85
  }