@nuxt/ui 2.14.1 → 2.14.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.
package/dist/module.d.mts CHANGED
@@ -1271,6 +1271,7 @@ declare const _default$n: {
1271
1271
 
1272
1272
  declare const _default$m: {
1273
1273
  wrapper: string;
1274
+ fieldset: string;
1274
1275
  legend: string;
1275
1276
  default: {
1276
1277
  color: string;
package/dist/module.d.ts CHANGED
@@ -1271,6 +1271,7 @@ declare const _default$n: {
1271
1271
 
1272
1272
  declare const _default$m: {
1273
1273
  wrapper: string;
1274
+ fieldset: string;
1274
1275
  legend: string;
1275
1276
  default: {
1276
1277
  color: string;
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
- "version": "2.14.1",
3
+ "version": "2.14.2",
4
4
  "configKey": "ui",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.10.0"
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.14.1";
17
+ const version = "2.14.2";
18
18
 
19
19
  function createTemplates(nuxt = useNuxt()) {
20
20
  const template = addTemplate({
@@ -10,7 +10,7 @@
10
10
  {{ title }}
11
11
  </slot>
12
12
  </p>
13
- <p v-if="description || $slots.description" :class="ui.description">
13
+ <p v-if="description || $slots.description" :class="twMerge(ui.description, !(title && $slots.title) && 'mt-0 leading-5')">
14
14
  <slot name="description" :description="description">
15
15
  {{ description }}
16
16
  </slot>
@@ -7,7 +7,8 @@
7
7
  :disabled="disabled"
8
8
  :class="ui.trigger"
9
9
  role="button"
10
- @mouseover="onMouseOver"
10
+ @mouseenter="onMouseEnter"
11
+ @touchstart.prevent="onTouchStart"
11
12
  >
12
13
  <slot :open="open" :disabled="disabled">
13
14
  <button :disabled="disabled">
@@ -16,25 +17,25 @@
16
17
  </slot>
17
18
  </HMenuButton>
18
19
 
19
- <div v-if="open && items.length" ref="container" :class="[ui.container, ui.width]" :style="containerStyle" @mouseover="onMouseOver">
20
+ <div v-if="open && items.length" ref="container" :class="[ui.container, ui.width]" :style="containerStyle">
20
21
  <Transition appear v-bind="ui.transition">
21
22
  <div>
22
23
  <div v-if="popper.arrow" data-popper-arrow :class="Object.values(ui.arrow)" />
23
24
 
24
25
  <HMenuItems :class="[ui.base, ui.divide, ui.ring, ui.rounded, ui.shadow, ui.background, ui.height]" static>
25
26
  <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="getNuxtLinkProps(item)" custom>
27
+ <NuxtLink v-for="(item, subIndex) of subItems" :key="subIndex" v-slot="{ href, target, rel, navigate, isExternal, isActive }" v-bind="getNuxtLinkProps(item)" custom>
27
28
  <HMenuItem v-slot="{ active, disabled: itemDisabled, close }" :disabled="item.disabled">
28
29
  <component
29
30
  :is="!!href ? 'a' : 'button'"
30
31
  :href="!itemDisabled ? href : undefined"
31
32
  :rel="rel"
32
33
  :target="target"
33
- :class="twMerge(twJoin(ui.item.base, ui.item.padding, ui.item.size, ui.item.rounded, active ? ui.item.active : ui.item.inactive, itemDisabled && ui.item.disabled), item.class)"
34
+ :class="twMerge(twJoin(ui.item.base, ui.item.padding, ui.item.size, ui.item.rounded, active || isActive ? ui.item.active : ui.item.inactive, itemDisabled && ui.item.disabled), item.class)"
34
35
  @click="onClick($event, item, { href, navigate, close, isExternal })"
35
36
  >
36
37
  <slot :name="item.slot || 'item'" :item="item">
37
- <UIcon v-if="item.icon" :name="item.icon" :class="twMerge(twJoin(ui.item.icon.base, active ? ui.item.icon.active : ui.item.icon.inactive), item.iconClass)" />
38
+ <UIcon v-if="item.icon" :name="item.icon" :class="twMerge(twJoin(ui.item.icon.base, active || isActive ? ui.item.icon.active : ui.item.icon.inactive), item.iconClass)" />
38
39
  <UAvatar v-else-if="item.avatar" v-bind="{ size: ui.item.avatar.size, ...item.avatar }" :class="ui.item.avatar.base" />
39
40
 
40
41
  <span :class="twMerge(ui.item.label, item.labelClass)">{{ item.label }}</span>
@@ -164,7 +165,17 @@ export default defineComponent({
164
165
  };
165
166
  }
166
167
  });
167
- function onMouseOver() {
168
+ function onTouchStart() {
169
+ if (!menuApi.value) {
170
+ return;
171
+ }
172
+ if (menuApi.value.menuState === 0) {
173
+ menuApi.value.closeMenu();
174
+ } else {
175
+ menuApi.value.openMenu();
176
+ }
177
+ }
178
+ function onMouseEnter() {
168
179
  if (props.mode !== "hover" || !menuApi.value) {
169
180
  return;
170
181
  }
@@ -232,7 +243,8 @@ export default defineComponent({
232
243
  trigger,
233
244
  container,
234
245
  containerStyle,
235
- onMouseOver,
246
+ onTouchStart,
247
+ onMouseEnter,
236
248
  onMouseLeave,
237
249
  onClick,
238
250
  getNuxtLinkProps,
@@ -68,7 +68,8 @@ declare const _default: import("vue").DefineComponent<{
68
68
  paddingLeft: string;
69
69
  paddingRight: string;
70
70
  }>;
71
- onMouseOver: () => void;
71
+ onTouchStart: () => void;
72
+ onMouseEnter: () => void;
72
73
  onMouseLeave: () => void;
73
74
  onClick: (e: any, item: any, { href, navigate, close, isExternal }: {
74
75
  href: any;
@@ -35,6 +35,7 @@ import { useFormGroup } from "../../composables/useFormGroup";
35
35
  import { mergeConfig } from "../../utils";
36
36
  import appConfig from "#build/app.config";
37
37
  import { checkbox } from "#ui/ui.config";
38
+ import { useId } from "#app";
38
39
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.checkbox, checkbox);
39
40
  export default defineComponent({
40
41
  inheritAttrs: false,
@@ -98,7 +99,8 @@ export default defineComponent({
98
99
  emits: ["update:modelValue", "change"],
99
100
  setup(props, { emit }) {
100
101
  const { ui, attrs } = useUI("checkbox", toRef(props, "ui"), config, toRef(props, "class"));
101
- const { emitFormChange, color, name, inputId } = useFormGroup(props);
102
+ const { emitFormChange, color, name, inputId: _inputId } = useFormGroup(props);
103
+ const inputId = _inputId.value ?? useId();
102
104
  const toggle = computed({
103
105
  get() {
104
106
  return props.modelValue;
@@ -59,7 +59,7 @@ declare const _default: import("vue").DefineComponent<{
59
59
  [x: string]: unknown;
60
60
  }, string>>;
61
61
  toggle: import("vue").WritableComputedRef<boolean | unknown[]>;
62
- inputId: import("vue").ComputedRef<string | undefined>;
62
+ inputId: any;
63
63
  name: import("vue").ComputedRef<string | undefined>;
64
64
  inputClass: import("vue").ComputedRef<string>;
65
65
  onChange: (event: Event) => void;
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div :class="ui.wrapper">
3
- <fieldset v-bind="attrs">
3
+ <fieldset v-bind="attrs" :class="ui.fieldset">
4
4
  <legend v-if="legend || $slots.legend" :class="ui.legend">
5
5
  <slot name="legend">
6
6
  {{ legend }}
@@ -350,7 +350,7 @@ export default defineComponent({
350
350
  } else {
351
351
  return null;
352
352
  }
353
- } else {
353
+ } else if (props.modelValue) {
354
354
  if (props.valueAttribute) {
355
355
  const option = props.options.find((option2) => option2[props.valueAttribute] === props.modelValue);
356
356
  return option ? option[props.optionAttribute] : null;
@@ -358,6 +358,7 @@ export default defineComponent({
358
358
  return ["string", "number"].includes(typeof props.modelValue) ? props.modelValue : props.modelValue[props.optionAttribute];
359
359
  }
360
360
  }
361
+ return null;
361
362
  });
362
363
  const selectClass = computed(() => {
363
364
  const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <div :class="ui.group.wrapper" role="option">
2
+ <div :class="ui.group.wrapper">
3
3
  <h2 v-if="label" :class="ui.group.label">
4
4
  {{ label }}
5
5
  </h2>
6
6
 
7
- <div :class="ui.group.container" role="listbox" :aria-label="group[groupAttribute]">
7
+ <div :class="ui.group.container" :aria-label="group[groupAttribute]">
8
8
  <HComboboxOption
9
9
  v-for="(command, index) of group.commands"
10
10
  :key="`${group.key}-${index}`"
@@ -18,7 +18,7 @@
18
18
  {{ title }}
19
19
  </slot>
20
20
  </p>
21
- <p v-if="(description || $slots.description)" :class="ui.description">
21
+ <p v-if="(description || $slots.description)" :class="twMerge(ui.description, !(title && $slots.title) && 'mt-0 leading-5')">
22
22
  <slot name="description" :description="description">
23
23
  {{ description }}
24
24
  </slot>
@@ -7,7 +7,8 @@
7
7
  :disabled="disabled"
8
8
  :class="ui.trigger"
9
9
  role="button"
10
- @mouseover="onMouseOver"
10
+ @mouseenter="onMouseEnter"
11
+ @touchstart.prevent="onTouchStart"
11
12
  >
12
13
  <slot :open="open" :close="close">
13
14
  <button :disabled="disabled">
@@ -20,7 +21,7 @@
20
21
  <div v-if="open" :class="[ui.overlay.base, ui.overlay.background]" />
21
22
  </Transition>
22
23
 
23
- <div v-if="open" ref="container" :class="[ui.container, ui.width]" :style="containerStyle" @mouseover="onMouseOver">
24
+ <div v-if="open" ref="container" :class="[ui.container, ui.width]" :style="containerStyle">
24
25
  <Transition appear v-bind="ui.transition">
25
26
  <div>
26
27
  <div v-if="popper.arrow" data-popper-arrow :class="Object.values(ui.arrow)" />
@@ -137,7 +138,17 @@ export default defineComponent({
137
138
  };
138
139
  }
139
140
  });
140
- function onMouseOver() {
141
+ function onTouchStart() {
142
+ if (!popoverApi.value) {
143
+ return;
144
+ }
145
+ if (popoverApi.value.popoverState === 0) {
146
+ popoverApi.value.closePopover();
147
+ } else {
148
+ popoverApi.value.togglePopover();
149
+ }
150
+ }
151
+ function onMouseEnter() {
141
152
  if (props.mode !== "hover" || !popoverApi.value) {
142
153
  return;
143
154
  }
@@ -196,7 +207,8 @@ export default defineComponent({
196
207
  trigger,
197
208
  container,
198
209
  containerStyle,
199
- onMouseOver,
210
+ onTouchStart,
211
+ onMouseEnter,
200
212
  onMouseLeave
201
213
  };
202
214
  }
@@ -68,7 +68,8 @@ declare const _default: import("vue").DefineComponent<{
68
68
  paddingLeft: string;
69
69
  paddingRight: string;
70
70
  }>;
71
- onMouseOver: () => void;
71
+ onTouchStart: () => void;
72
+ onMouseEnter: () => void;
72
73
  onMouseLeave: () => void;
73
74
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:open"[], "update:open", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
74
75
  mode: {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div ref="trigger" :class="ui.wrapper" v-bind="attrs" @mouseover="onMouseOver" @mouseleave="onMouseLeave">
2
+ <div ref="trigger" :class="ui.wrapper" v-bind="attrs" @mouseenter="onMouseEnter" @mouseleave="onMouseLeave">
3
3
  <slot :open="open">
4
4
  Hover
5
5
  </slot>
@@ -84,7 +84,7 @@ export default defineComponent({
84
84
  const open = ref(false);
85
85
  let openTimeout = null;
86
86
  let closeTimeout = null;
87
- function onMouseOver() {
87
+ function onMouseEnter() {
88
88
  if (closeTimeout) {
89
89
  clearTimeout(closeTimeout);
90
90
  closeTimeout = null;
@@ -119,7 +119,7 @@ export default defineComponent({
119
119
  trigger,
120
120
  container,
121
121
  open,
122
- onMouseOver,
122
+ onMouseEnter,
123
123
  onMouseLeave
124
124
  };
125
125
  }
@@ -42,7 +42,7 @@ declare const _default: import("vue").DefineComponent<{
42
42
  trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
43
43
  container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
44
44
  open: import("vue").Ref<boolean>;
45
- onMouseOver: () => void;
45
+ onMouseEnter: () => void;
46
46
  onMouseLeave: () => void;
47
47
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
48
48
  text: {
@@ -1,12 +1,12 @@
1
1
  export declare const _useShortcuts: () => {
2
2
  macOS: import("vue").ComputedRef<false | "" | RegExpMatchArray | null | undefined>;
3
3
  metaSymbol: import("vue").Ref<string>;
4
- activeElement: import("@vueuse/shared").ComputedRefWithControl<HTMLElement | null | undefined>;
4
+ activeElement: import("vue").Ref<HTMLElement | null | undefined>;
5
5
  usingInput: import("vue").ComputedRef<string | boolean>;
6
6
  };
7
7
  export declare const useShortcuts: () => {
8
8
  macOS: import("vue").ComputedRef<false | "" | RegExpMatchArray | null | undefined>;
9
9
  metaSymbol: import("vue").Ref<string>;
10
- activeElement: import("@vueuse/shared").ComputedRefWithControl<HTMLElement | null | undefined>;
10
+ activeElement: import("vue").Ref<HTMLElement | null | undefined>;
11
11
  usingInput: import("vue").ComputedRef<string | boolean>;
12
12
  };
@@ -1,5 +1,6 @@
1
1
  declare const _default: {
2
2
  wrapper: string;
3
+ fieldset: string;
3
4
  legend: string;
4
5
  default: {
5
6
  color: string;
@@ -1,5 +1,6 @@
1
1
  export default {
2
2
  wrapper: "relative flex items-start",
3
+ fieldset: "",
3
4
  legend: "text-sm font-medium text-gray-700 dark:text-gray-200 mb-1",
4
5
  default: {
5
6
  color: "primary"
@@ -9,7 +9,7 @@ export default {
9
9
  inactive: "text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",
10
10
  label: "truncate relative",
11
11
  icon: {
12
- base: "flex-shrink-0 w-5 h-5",
12
+ base: "flex-shrink-0 w-5 h-5 relative",
13
13
  active: "text-gray-700 dark:text-gray-200",
14
14
  inactive: "text-gray-400 dark:text-gray-500 group-hover:text-gray-700 dark:group-hover:text-gray-200"
15
15
  },
@@ -11,7 +11,7 @@ export default {
11
11
  inactive: "text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:before:bg-gray-50 dark:hover:before:bg-gray-800/50",
12
12
  label: "truncate relative",
13
13
  icon: {
14
- base: "flex-shrink-0 w-5 h-5",
14
+ base: "flex-shrink-0 w-5 h-5 relative",
15
15
  active: "text-gray-700 dark:text-gray-200",
16
16
  inactive: "text-gray-400 dark:text-gray-500 group-hover:text-gray-700 dark:group-hover:text-gray-200"
17
17
  },
@@ -4,7 +4,7 @@ export default {
4
4
  container: "flex min-h-full items-end sm:items-center justify-center text-center",
5
5
  padding: "p-4 sm:p-0",
6
6
  margin: "sm:my-8",
7
- base: "relative text-left rtl:text-right overflow-hidden flex flex-col",
7
+ base: "relative text-left rtl:text-right flex flex-col",
8
8
  overlay: {
9
9
  base: "fixed inset-0 transition-opacity",
10
10
  background: "bg-gray-200/75 dark:bg-gray-800/75",
@@ -27,5 +27,8 @@ export default {
27
27
  openDelay: 0,
28
28
  closeDelay: 0
29
29
  },
30
- arrow
30
+ arrow: {
31
+ ...arrow,
32
+ base: "[@media(pointer:coarse)]:hidden invisible before:visible before:block before:rotate-45 before:z-[-1] before:w-2 before:h-2"
33
+ }
31
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
- "version": "2.14.1",
3
+ "version": "2.14.2",
4
4
  "repository": "nuxt/ui",
5
5
  "homepage": "https://ui.nuxt.com",
6
6
  "type": "module",
@@ -45,9 +45,9 @@
45
45
  "@tailwindcss/container-queries": "^0.1.1",
46
46
  "@tailwindcss/forms": "^0.5.7",
47
47
  "@tailwindcss/typography": "^0.5.10",
48
- "@vueuse/core": "^10.8.0",
49
- "@vueuse/integrations": "^10.8.0",
50
- "@vueuse/math": "^10.8.0",
48
+ "@vueuse/core": "^10.9.0",
49
+ "@vueuse/integrations": "^10.9.0",
50
+ "@vueuse/math": "^10.9.0",
51
51
  "defu": "^6.1.4",
52
52
  "fuse.js": "^6.6.2",
53
53
  "nuxt-icon": "^0.6.8",
@@ -63,8 +63,8 @@
63
63
  "@nuxt/test-utils": "^3.11.0",
64
64
  "@release-it/conventional-changelog": "^8.0.1",
65
65
  "@vue/test-utils": "^2.4.4",
66
- "eslint": "^8.56.0",
67
- "happy-dom": "^13.4.1",
66
+ "eslint": "^8.57.0",
67
+ "happy-dom": "^13.6.2",
68
68
  "joi": "^17.12.2",
69
69
  "nuxt": "^3.10.3",
70
70
  "release-it": "^17.1.1",
@@ -73,7 +73,7 @@
73
73
  "valibot": "^0.29.0",
74
74
  "vitest": "^1.3.1",
75
75
  "vitest-environment-nuxt": "^1.0.0",
76
- "vue-tsc": "^1.8.27",
76
+ "vue-tsc": "^2.0.4",
77
77
  "yup": "^1.3.3",
78
78
  "zod": "^3.22.4"
79
79
  },
@@ -82,6 +82,6 @@
82
82
  "@nuxt/schema": "3.10.3",
83
83
  "tailwindcss": "3.4.1",
84
84
  "@headlessui/vue": "1.7.19",
85
- "vue": "3.4.19"
85
+ "vue": "3.4.21"
86
86
  }
87
87
  }