@nuxt/ui 3.1.0 → 3.1.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 (187) hide show
  1. package/.nuxt/ui/accordion.ts +2 -23
  2. package/.nuxt/ui/alert.ts +2 -28
  3. package/.nuxt/ui/avatar-group.ts +2 -23
  4. package/.nuxt/ui/avatar.ts +2 -23
  5. package/.nuxt/ui/badge.ts +32 -30
  6. package/.nuxt/ui/breadcrumb.ts +2 -23
  7. package/.nuxt/ui/button-group.ts +2 -36
  8. package/.nuxt/ui/button.ts +4 -30
  9. package/.nuxt/ui/calendar.ts +4 -25
  10. package/.nuxt/ui/card.ts +2 -23
  11. package/.nuxt/ui/carousel.ts +2 -28
  12. package/.nuxt/ui/checkbox-group.ts +146 -24
  13. package/.nuxt/ui/checkbox.ts +2 -23
  14. package/.nuxt/ui/chip.ts +2 -23
  15. package/.nuxt/ui/collapsible.ts +2 -23
  16. package/.nuxt/ui/color-picker.ts +4 -25
  17. package/.nuxt/ui/command-palette.ts +2 -23
  18. package/.nuxt/ui/container.ts +2 -23
  19. package/.nuxt/ui/context-menu.ts +2 -23
  20. package/.nuxt/ui/drawer.ts +2 -23
  21. package/.nuxt/ui/dropdown-menu.ts +2 -23
  22. package/.nuxt/ui/form-field.ts +2 -23
  23. package/.nuxt/ui/form.ts +2 -23
  24. package/.nuxt/ui/input-menu.ts +4 -34
  25. package/.nuxt/ui/input-number.ts +12 -23
  26. package/.nuxt/ui/input.ts +4 -34
  27. package/.nuxt/ui/kbd.ts +2 -23
  28. package/.nuxt/ui/link.ts +14 -28
  29. package/.nuxt/ui/modal.ts +2 -23
  30. package/.nuxt/ui/navigation-menu.ts +3 -24
  31. package/.nuxt/ui/pagination.ts +2 -23
  32. package/.nuxt/ui/pin-input.ts +2 -23
  33. package/.nuxt/ui/popover.ts +2 -23
  34. package/.nuxt/ui/progress.ts +2 -23
  35. package/.nuxt/ui/radio-group.ts +2 -23
  36. package/.nuxt/ui/select-menu.ts +4 -34
  37. package/.nuxt/ui/select.ts +4 -34
  38. package/.nuxt/ui/separator.ts +2 -23
  39. package/.nuxt/ui/skeleton.ts +2 -23
  40. package/.nuxt/ui/slideover.ts +2 -23
  41. package/.nuxt/ui/slider.ts +2 -23
  42. package/.nuxt/ui/stepper.ts +2 -23
  43. package/.nuxt/ui/switch.ts +2 -23
  44. package/.nuxt/ui/table.ts +2 -23
  45. package/.nuxt/ui/tabs.ts +6 -26
  46. package/.nuxt/ui/textarea.ts +4 -34
  47. package/.nuxt/ui/toast.ts +2 -28
  48. package/.nuxt/ui/toaster.ts +2 -23
  49. package/.nuxt/ui/tooltip.ts +2 -23
  50. package/.nuxt/ui/tree.ts +2 -23
  51. package/.nuxt/ui.css +15 -8
  52. package/README.md +4 -0
  53. package/cli/templates.mjs +2 -2
  54. package/dist/module.json +1 -1
  55. package/dist/module.mjs +15 -5
  56. package/dist/runtime/components/Accordion.vue +9 -9
  57. package/dist/runtime/components/Accordion.vue.d.ts +6 -20
  58. package/dist/runtime/components/Alert.vue +1 -1
  59. package/dist/runtime/components/Alert.vue.d.ts +7 -22
  60. package/dist/runtime/components/App.vue.d.ts +2 -2
  61. package/dist/runtime/components/Avatar.vue +2 -2
  62. package/dist/runtime/components/Avatar.vue.d.ts +4 -25
  63. package/dist/runtime/components/AvatarGroup.vue +1 -1
  64. package/dist/runtime/components/AvatarGroup.vue.d.ts +2 -11
  65. package/dist/runtime/components/Badge.vue +5 -3
  66. package/dist/runtime/components/Badge.vue.d.ts +5 -24
  67. package/dist/runtime/components/Breadcrumb.vue +8 -8
  68. package/dist/runtime/components/Breadcrumb.vue.d.ts +4 -20
  69. package/dist/runtime/components/Button.vue +2 -3
  70. package/dist/runtime/components/Button.vue.d.ts +4 -29
  71. package/dist/runtime/components/ButtonGroup.vue.d.ts +3 -24
  72. package/dist/runtime/components/Calendar.vue +2 -1
  73. package/dist/runtime/components/Calendar.vue.d.ts +6 -2
  74. package/dist/runtime/components/Card.vue +1 -1
  75. package/dist/runtime/components/Card.vue.d.ts +2 -11
  76. package/dist/runtime/components/Carousel.vue +5 -2
  77. package/dist/runtime/components/Carousel.vue.d.ts +10 -3
  78. package/dist/runtime/components/Checkbox.vue +2 -2
  79. package/dist/runtime/components/Checkbox.vue.d.ts +10 -13
  80. package/dist/runtime/components/CheckboxGroup.vue +8 -5
  81. package/dist/runtime/components/CheckboxGroup.vue.d.ts +12 -3
  82. package/dist/runtime/components/Chip.vue +1 -1
  83. package/dist/runtime/components/Chip.vue.d.ts +10 -24
  84. package/dist/runtime/components/Collapsible.vue +1 -1
  85. package/dist/runtime/components/Collapsible.vue.d.ts +7 -22
  86. package/dist/runtime/components/ColorPicker.vue +1 -1
  87. package/dist/runtime/components/ColorPicker.vue.d.ts +9 -24
  88. package/dist/runtime/components/CommandPalette.vue +17 -17
  89. package/dist/runtime/components/CommandPalette.vue.d.ts +17 -27
  90. package/dist/runtime/components/Container.vue.d.ts +2 -11
  91. package/dist/runtime/components/ContextMenu.vue.d.ts +6 -24
  92. package/dist/runtime/components/ContextMenuContent.vue +15 -15
  93. package/dist/runtime/components/ContextMenuContent.vue.d.ts +17 -57
  94. package/dist/runtime/components/Drawer.vue.d.ts +17 -27
  95. package/dist/runtime/components/DropdownMenu.vue.d.ts +6 -28
  96. package/dist/runtime/components/DropdownMenuContent.vue +15 -15
  97. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +19 -6
  98. package/dist/runtime/components/Form.vue.d.ts +5 -2
  99. package/dist/runtime/components/FormField.vue +5 -5
  100. package/dist/runtime/components/FormField.vue.d.ts +2 -11
  101. package/dist/runtime/components/Icon.vue.d.ts +1 -10
  102. package/dist/runtime/components/Input.vue +2 -2
  103. package/dist/runtime/components/Input.vue.d.ts +20 -41
  104. package/dist/runtime/components/InputMenu.vue +17 -17
  105. package/dist/runtime/components/InputMenu.vue.d.ts +227 -5
  106. package/dist/runtime/components/InputNumber.vue +13 -7
  107. package/dist/runtime/components/InputNumber.vue.d.ts +90 -23
  108. package/dist/runtime/components/Kbd.vue.d.ts +3 -24
  109. package/dist/runtime/components/Link.vue +5 -14
  110. package/dist/runtime/components/Link.vue.d.ts +3 -34
  111. package/dist/runtime/components/LinkBase.vue.d.ts +4 -27
  112. package/dist/runtime/components/Modal.vue.d.ts +12 -28
  113. package/dist/runtime/components/NavigationMenu.vue +35 -28
  114. package/dist/runtime/components/NavigationMenu.vue.d.ts +24 -26
  115. package/dist/runtime/components/Pagination.vue +1 -1
  116. package/dist/runtime/components/Pagination.vue.d.ts +9 -33
  117. package/dist/runtime/components/PinInput.vue +1 -1
  118. package/dist/runtime/components/PinInput.vue.d.ts +13 -24
  119. package/dist/runtime/components/Popover.vue.d.ts +9 -26
  120. package/dist/runtime/components/Progress.vue +1 -1
  121. package/dist/runtime/components/Progress.vue.d.ts +10 -41
  122. package/dist/runtime/components/RadioGroup.vue +8 -8
  123. package/dist/runtime/components/RadioGroup.vue.d.ts +8 -3
  124. package/dist/runtime/components/Select.vue +12 -12
  125. package/dist/runtime/components/Select.vue.d.ts +11 -3
  126. package/dist/runtime/components/SelectMenu.vue +13 -13
  127. package/dist/runtime/components/SelectMenu.vue.d.ts +19 -5
  128. package/dist/runtime/components/Separator.vue +1 -1
  129. package/dist/runtime/components/Separator.vue.d.ts +3 -24
  130. package/dist/runtime/components/Skeleton.vue.d.ts +3 -12
  131. package/dist/runtime/components/Slideover.vue.d.ts +12 -29
  132. package/dist/runtime/components/Slider.vue +16 -4
  133. package/dist/runtime/components/Slider.vue.d.ts +23 -36
  134. package/dist/runtime/components/Stepper.vue +10 -10
  135. package/dist/runtime/components/Stepper.vue.d.ts +10 -14
  136. package/dist/runtime/components/Switch.vue +1 -1
  137. package/dist/runtime/components/Switch.vue.d.ts +10 -13
  138. package/dist/runtime/components/Table.vue +2 -2
  139. package/dist/runtime/components/Table.vue.d.ts +17 -17
  140. package/dist/runtime/components/Tabs.vue +6 -6
  141. package/dist/runtime/components/Tabs.vue.d.ts +6 -20
  142. package/dist/runtime/components/Textarea.vue +3 -3
  143. package/dist/runtime/components/Textarea.vue.d.ts +20 -44
  144. package/dist/runtime/components/Toast.vue +3 -2
  145. package/dist/runtime/components/Toast.vue.d.ts +92 -24
  146. package/dist/runtime/components/Toaster.vue +4 -4
  147. package/dist/runtime/components/Toaster.vue.d.ts +9 -28
  148. package/dist/runtime/components/Tooltip.vue.d.ts +7 -22
  149. package/dist/runtime/components/Tree.vue +10 -10
  150. package/dist/runtime/components/Tree.vue.d.ts +7 -22
  151. package/dist/runtime/composables/defineShortcuts.js +6 -0
  152. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  153. package/dist/runtime/composables/useButtonGroup.d.ts +1 -1
  154. package/dist/runtime/composables/useFormField.d.ts +2 -2
  155. package/dist/runtime/composables/useFormField.js +2 -1
  156. package/dist/runtime/composables/useKbd.d.ts +1 -0
  157. package/dist/runtime/composables/useKbd.js +4 -3
  158. package/dist/runtime/composables/useOverlay.d.ts +9 -10
  159. package/dist/runtime/composables/useOverlay.js +11 -6
  160. package/dist/runtime/inertia/components/Link.vue +46 -60
  161. package/dist/runtime/inertia/components/Link.vue.d.ts +4 -33
  162. package/dist/runtime/inertia/components/LinkBase.vue +68 -0
  163. package/dist/runtime/inertia/components/LinkBase.vue.d.ts +25 -0
  164. package/dist/runtime/inertia/stubs.d.ts +1 -1
  165. package/dist/runtime/inertia/stubs.js +1 -1
  166. package/dist/runtime/locale/index.d.ts +1 -0
  167. package/dist/runtime/locale/index.js +1 -0
  168. package/dist/runtime/locale/sl.d.ts +3 -0
  169. package/dist/runtime/locale/sl.js +54 -0
  170. package/dist/runtime/types/tv.d.ts +53 -0
  171. package/dist/runtime/types/tv.js +0 -0
  172. package/dist/runtime/types/utils.d.ts +2 -52
  173. package/dist/runtime/types/utils.js +1 -0
  174. package/dist/runtime/utils/link.d.ts +1 -0
  175. package/dist/runtime/utils/link.js +12 -0
  176. package/dist/runtime/vue/components/Icon.vue.d.ts +1 -10
  177. package/dist/runtime/vue/components/Link.vue +27 -40
  178. package/dist/runtime/vue/components/Link.vue.d.ts +3 -34
  179. package/dist/runtime/vue/composables/useAppConfig.js +3 -1
  180. package/dist/runtime/vue/stubs.d.ts +1 -1
  181. package/dist/runtime/vue/stubs.js +1 -1
  182. package/dist/shared/{ui.D7lOOabO.mjs → ui.BvUP-pSb.mjs} +120 -27
  183. package/dist/unplugin.d.mts +2 -2
  184. package/dist/unplugin.mjs +1 -1
  185. package/dist/vite.d.mts +1 -1
  186. package/dist/vite.mjs +2 -2
  187. package/package.json +28 -27
@@ -3,15 +3,17 @@ import theme from "#build/ui/link";
3
3
  </script>
4
4
 
5
5
  <script setup>
6
- import { computed, getCurrentInstance } from "vue";
6
+ import { computed } from "vue";
7
7
  import { defu } from "defu";
8
- import { isEqual, diff } from "ohash/utils";
8
+ import { isEqual } from "ohash/utils";
9
9
  import { useForwardProps } from "reka-ui";
10
10
  import { reactiveOmit } from "@vueuse/core";
11
11
  import { hasProtocol } from "ufo";
12
12
  import { useRoute, RouterLink } from "vue-router";
13
13
  import { useAppConfig } from "#imports";
14
14
  import { tv } from "../../utils/tv";
15
+ import { isPartiallyEqual } from "../../utils/link";
16
+ import ULinkBase from "../../components/LinkBase.vue";
15
17
  defineOptions({ inheritAttrs: false });
16
18
  const props = defineProps({
17
19
  as: { type: null, required: false, default: "button" },
@@ -42,20 +44,9 @@ const props = defineProps({
42
44
  replace: { type: Boolean, required: false }
43
45
  });
44
46
  defineSlots();
45
- const hasRouter = computed(() => {
46
- const app = getCurrentInstance()?.appContext.app;
47
- return !!app?.config?.globalProperties?.$router;
48
- });
49
- const route = computed(() => {
50
- if (!hasRouter.value) return null;
51
- try {
52
- return useRoute();
53
- } catch {
54
- return null;
55
- }
56
- });
47
+ const route = useRoute();
57
48
  const appConfig = useAppConfig();
58
- const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "raw", "class"));
49
+ const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
59
50
  const ui = computed(() => tv({
60
51
  extend: tv(theme),
61
52
  ...defu({
@@ -67,34 +58,29 @@ const ui = computed(() => tv({
67
58
  }
68
59
  }, appConfig.ui?.link || {})
69
60
  }));
70
- function isPartiallyEqual(item1, item2) {
71
- const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
72
- if (q.type === "added") {
73
- filtered.add(q.key);
74
- }
75
- return filtered;
76
- }, /* @__PURE__ */ new Set());
77
- const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)));
78
- const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)));
79
- return isEqual(item1Filtered, item2Filtered);
80
- }
61
+ const to = computed(() => props.to ?? props.href);
81
62
  const isExternal = computed(() => {
82
- if (!props.to) return false;
83
- return typeof props.to === "string" && hasProtocol(props.to, { acceptRelative: true });
63
+ if (props.external) {
64
+ return true;
65
+ }
66
+ if (!to.value) {
67
+ return false;
68
+ }
69
+ return typeof to.value === "string" && hasProtocol(to.value, { acceptRelative: true });
84
70
  });
85
71
  function isLinkActive({ route: linkRoute, isActive, isExactActive }) {
86
72
  if (props.active !== void 0) {
87
73
  return props.active;
88
74
  }
89
- if (!props.to || !route.value) {
75
+ if (!to.value) {
90
76
  return false;
91
77
  }
92
78
  if (props.exactQuery === "partial") {
93
- if (!isPartiallyEqual(linkRoute.query, route.value.query)) return false;
79
+ if (!isPartiallyEqual(linkRoute.query, route.query)) return false;
94
80
  } else if (props.exactQuery === true) {
95
- if (!isEqual(linkRoute.query, route.value.query)) return false;
81
+ if (!isEqual(linkRoute.query, route.query)) return false;
96
82
  }
97
- if (props.exactHash && linkRoute.hash !== route.value.hash) {
83
+ if (props.exactHash && linkRoute.hash !== route.hash) {
98
84
  return false;
99
85
  }
100
86
  if (props.exact && isExactActive) {
@@ -115,8 +101,8 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
115
101
  </script>
116
102
 
117
103
  <template>
118
- <template v-if="hasRouter && !isExternal">
119
- <RouterLink v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }" v-bind="routerLinkProps" :to="to || '#'" custom>
104
+ <template v-if="!isExternal && !!to">
105
+ <RouterLink v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }" v-bind="routerLinkProps" :to="to" custom>
120
106
  <template v-if="custom">
121
107
  <slot
122
108
  v-bind="{
@@ -125,7 +111,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
125
111
  as,
126
112
  type,
127
113
  disabled,
128
- href: to ? href : void 0,
114
+ href,
129
115
  navigate,
130
116
  active: isLinkActive({ route: linkRoute, isActive, isExactActive })
131
117
  }"
@@ -139,7 +125,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
139
125
  as,
140
126
  type,
141
127
  disabled,
142
- href: to ? href : void 0,
128
+ href,
143
129
  navigate
144
130
  }"
145
131
  :class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
@@ -159,7 +145,8 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
159
145
  disabled,
160
146
  href: to,
161
147
  target: isExternal ? '_blank' : void 0,
162
- active: false
148
+ active,
149
+ isExternal
163
150
  }"
164
151
  />
165
152
  </template>
@@ -171,12 +158,12 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
171
158
  type,
172
159
  disabled,
173
160
  href: to,
174
- target: isExternal ? '_blank' : void 0
161
+ target: isExternal ? '_blank' : void 0,
162
+ isExternal
175
163
  }"
176
- :is-external="isExternal"
177
164
  :class="resolveLinkClass()"
178
165
  >
179
- <slot :active="false" />
166
+ <slot :active="active" />
180
167
  </ULinkBase>
181
168
  </template>
182
169
  </template>
@@ -77,48 +77,17 @@ export interface LinkSlots {
77
77
  active: boolean;
78
78
  }): any;
79
79
  }
80
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<LinkProps>, {
81
- as: string;
82
- type: string;
83
- ariaCurrentValue: string;
84
- active: undefined;
85
- activeClass: string;
86
- inactiveClass: string;
87
- }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<LinkProps>, {
88
- as: string;
89
- type: string;
90
- ariaCurrentValue: string;
91
- active: undefined;
92
- activeClass: string;
93
- inactiveClass: string;
94
- }>>> & Readonly<{}>, {
80
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<LinkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LinkProps> & Readonly<{}>, {
95
81
  type: "reset" | "submit" | "button";
96
82
  as: any;
97
83
  activeClass: string;
98
84
  ariaCurrentValue: "page" | "step" | "location" | "date" | "time" | "true" | "false";
99
85
  active: boolean;
100
86
  inactiveClass: string;
101
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<LinkSlots> & LinkSlots>;
87
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, LinkSlots>;
102
88
  export default _default;
103
- type __VLS_WithDefaults<P, D> = {
104
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
105
- default: D[K];
106
- }> : P[K];
107
- };
108
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
109
- type __VLS_TypePropsToOption<T> = {
110
- [K in keyof T]-?: {} extends Pick<T, K> ? {
111
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
112
- } : {
113
- type: import('vue').PropType<T[K]>;
114
- required: true;
115
- };
116
- };
117
- type __VLS_WithTemplateSlots<T, S> = T & {
89
+ type __VLS_WithSlots<T, S> = T & {
118
90
  new (): {
119
91
  $slots: S;
120
92
  };
121
93
  };
122
- type __VLS_PrettifyLocal<T> = {
123
- [K in keyof T]: T[K];
124
- } & {};
@@ -1,2 +1,4 @@
1
+ import { reactive } from "vue";
1
2
  import appConfig from "#build/app.config";
2
- export const useAppConfig = () => appConfig;
3
+ const _appConfig = reactive(appConfig);
4
+ export const useAppConfig = () => _appConfig;
@@ -2,6 +2,7 @@ import type { Ref } from 'vue';
2
2
  import type { NuxtApp } from '#app';
3
3
  export { useHead } from '@unhead/vue';
4
4
  export { useRoute, useRouter } from 'vue-router';
5
+ export { useAppConfig } from './composables/useAppConfig';
5
6
  export { defineShortcuts } from '../composables/defineShortcuts';
6
7
  export { defineLocale } from '../composables/defineLocale';
7
8
  export { useLocale } from '../composables/useLocale';
@@ -14,7 +15,6 @@ export declare const useColorMode: () => {
14
15
  readonly value: import("@vueuse/core").BasicColorMode;
15
16
  forced: boolean;
16
17
  };
17
- export declare const useAppConfig: () => any;
18
18
  export declare const useCookie: <T = string>(_name: string, _options?: Record<string, any>) => {
19
19
  value: Ref<T, T>;
20
20
  get: () => T;
@@ -4,6 +4,7 @@ import appConfig from "#build/app.config";
4
4
  import { useColorMode as useColorModeVueUse } from "@vueuse/core";
5
5
  export { useHead } from "@unhead/vue";
6
6
  export { useRoute, useRouter } from "vue-router";
7
+ export { useAppConfig } from "./composables/useAppConfig.js";
7
8
  export { defineShortcuts } from "../composables/defineShortcuts.js";
8
9
  export { defineLocale } from "../composables/defineLocale.js";
9
10
  export { useLocale } from "../composables/useLocale.js";
@@ -27,7 +28,6 @@ export const useColorMode = () => {
27
28
  forced: false
28
29
  };
29
30
  };
30
- export const useAppConfig = () => appConfig;
31
31
  export const useCookie = (_name, _options = {}) => {
32
32
  const value = ref(null);
33
33
  return {
@@ -4,6 +4,7 @@ import { kebabCase } from 'scule';
4
4
  import { addTypeTemplate, addTemplate } from '@nuxt/kit';
5
5
  import { defuFn, defu } from 'defu';
6
6
  import colors from 'tailwindcss/colors';
7
+ import { genExport } from 'knitwork';
7
8
 
8
9
  const icons = {
9
10
  arrowLeft: "i-lucide-arrow-left",
@@ -252,18 +253,18 @@ const avatarGroup = {
252
253
 
253
254
  const buttonGroupVariant = {
254
255
  buttonGroup: {
255
- horizontal: "not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none",
256
- vertical: "not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none"
256
+ horizontal: "not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]",
257
+ vertical: "not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]"
257
258
  }
258
259
  };
259
260
  const buttonGroupVariantWithRoot = {
260
261
  buttonGroup: {
261
262
  horizontal: {
262
- root: "group",
263
+ root: "group has-focus-visible:z-[1]",
263
264
  base: "group-not-only:group-first:rounded-e-none group-not-only:group-last:rounded-s-none group-not-last:group-not-first:rounded-none"
264
265
  },
265
266
  vertical: {
266
- root: "group",
267
+ root: "group has-focus-visible:z-[1]",
267
268
  base: "group-not-only:group-first:rounded-b-none group-not-only:group-last:rounded-t-none group-not-last:group-not-first:rounded-none"
268
269
  }
269
270
  }
@@ -337,6 +338,9 @@ const badge = (options) => ({
337
338
  leadingAvatarSize: "2xs",
338
339
  trailingIcon: "size-6"
339
340
  }
341
+ },
342
+ square: {
343
+ true: ""
340
344
  }
341
345
  },
342
346
  compoundVariants: [...(options.theme.colors || []).map((color) => ({
@@ -371,6 +375,26 @@ const badge = (options) => ({
371
375
  color: "neutral",
372
376
  variant: "subtle",
373
377
  class: "ring ring-inset ring-accented text-default bg-elevated"
378
+ }, {
379
+ size: "xs",
380
+ square: true,
381
+ class: "p-0.5"
382
+ }, {
383
+ size: "sm",
384
+ square: true,
385
+ class: "p-1"
386
+ }, {
387
+ size: "md",
388
+ square: true,
389
+ class: "p-1"
390
+ }, {
391
+ size: "lg",
392
+ square: true,
393
+ class: "p-1"
394
+ }, {
395
+ size: "xl",
396
+ square: true,
397
+ class: "p-1"
374
398
  }],
375
399
  defaultVariants: {
376
400
  color: "primary",
@@ -598,7 +622,7 @@ const calendar = (options) => ({
598
622
  body: "flex flex-col space-y-4 pt-4 sm:flex-row sm:space-x-4 sm:space-y-0",
599
623
  heading: "text-center font-medium truncate mx-auto",
600
624
  grid: "w-full border-collapse select-none space-y-1 focus:outline-none",
601
- gridRow: "grid grid-cols-7",
625
+ gridRow: "grid grid-cols-7 place-items-center",
602
626
  gridWeekDaysRow: "mb-1 grid w-full grid-cols-7",
603
627
  gridBody: "grid",
604
628
  headCell: "rounded-md",
@@ -613,7 +637,7 @@ const calendar = (options) => ({
613
637
  }])),
614
638
  neutral: {
615
639
  headCell: "text-highlighted",
616
- cellTrigger: "focus-visible:ring-inverted data-[selected]:bg-inverted data-today:not-data-[selected]:text-inverted data-[highlighted]:bg-inverted/20 hover:not-data-[selected]:bg-inverted/10"
640
+ cellTrigger: "focus-visible:ring-inverted data-[selected]:bg-inverted data-today:not-data-[selected]:text-highlighted data-[highlighted]:bg-inverted/20 hover:not-data-[selected]:bg-inverted/10"
617
641
  }
618
642
  },
619
643
  size: {
@@ -841,7 +865,7 @@ const checkbox = (options) => ({
841
865
  }
842
866
  });
843
867
 
844
- const checkboxGroup = {
868
+ const checkboxGroup = (options) => ({
845
869
  slots: {
846
870
  root: "relative",
847
871
  fieldset: "flex gap-x-2",
@@ -857,6 +881,17 @@ const checkboxGroup = {
857
881
  fieldset: "flex-col"
858
882
  }
859
883
  },
884
+ color: {
885
+ ...Object.fromEntries((options.theme.colors || []).map((color) => [color, {}])),
886
+ neutral: {}
887
+ },
888
+ variant: {
889
+ list: {},
890
+ card: {},
891
+ table: {
892
+ item: "border border-muted"
893
+ }
894
+ },
860
895
  size: {
861
896
  xs: {
862
897
  fieldset: "gap-y-0.5",
@@ -885,10 +920,56 @@ const checkboxGroup = {
885
920
  }
886
921
  }
887
922
  },
923
+ compoundVariants: [
924
+ { size: "xs", variant: "table", class: { item: "p-2.5" } },
925
+ { size: "sm", variant: "table", class: { item: "p-3" } },
926
+ { size: "md", variant: "table", class: { item: "p-3.5" } },
927
+ { size: "lg", variant: "table", class: { item: "p-4" } },
928
+ { size: "xl", variant: "table", class: { item: "p-4.5" } },
929
+ {
930
+ orientation: "horizontal",
931
+ variant: "table",
932
+ class: {
933
+ item: "first-of-type:rounded-l-lg last-of-type:rounded-r-lg",
934
+ fieldset: "gap-0 -space-x-px"
935
+ }
936
+ },
937
+ {
938
+ orientation: "vertical",
939
+ variant: "table",
940
+ class: {
941
+ item: "first-of-type:rounded-t-lg last-of-type:rounded-b-lg",
942
+ fieldset: "gap-0 -space-y-px"
943
+ }
944
+ },
945
+ ...(options.theme.colors || []).map((color) => ({
946
+ color,
947
+ variant: "table",
948
+ class: {
949
+ item: `has-data-[state=checked]:bg-${color}/10 has-data-[state=checked]:border-${color}/50 has-data-[state=checked]:z-[1]`
950
+ }
951
+ })),
952
+ {
953
+ color: "neutral",
954
+ variant: "table",
955
+ class: {
956
+ item: "has-data-[state=checked]:bg-elevated has-data-[state=checked]:border-inverted/50 has-data-[state=checked]:z-[1]"
957
+ }
958
+ },
959
+ {
960
+ variant: "table",
961
+ disabled: true,
962
+ class: {
963
+ item: "cursor-not-allowed opacity-75"
964
+ }
965
+ }
966
+ ],
888
967
  defaultVariants: {
889
- size: "md"
968
+ size: "md",
969
+ variant: "list",
970
+ color: "primary"
890
971
  }
891
- };
972
+ });
892
973
 
893
974
  const chip = (options) => ({
894
975
  slots: {
@@ -959,10 +1040,10 @@ const colorPicker = {
959
1040
  slots: {
960
1041
  root: "data-[disabled]:opacity-75",
961
1042
  picker: "flex gap-4",
962
- selector: "rounded-md",
1043
+ selector: "rounded-md touch-none",
963
1044
  selectorBackground: "w-full h-full relative rounded-md",
964
1045
  selectorThumb: "-translate-y-1/2 -translate-x-1/2 absolute size-4 ring-2 ring-(--color-white) rounded-full cursor-pointer data-[disabled]:cursor-not-allowed",
965
- track: "w-[8px] relative rounded-md",
1046
+ track: "w-[8px] relative rounded-md touch-none",
966
1047
  trackThumb: "absolute transform -translate-y-1/2 -translate-x-[4px] rtl:translate-x-[4px] size-4 rounded-full ring-2 ring-(--color-white) cursor-pointer data-[disabled]:cursor-not-allowed"
967
1048
  },
968
1049
  variants: {
@@ -1668,6 +1749,7 @@ const inputNumber = (options) => {
1668
1749
  decrement: "absolute flex items-center"
1669
1750
  },
1670
1751
  variants: {
1752
+ ...buttonGroupVariantWithRoot,
1671
1753
  color: {
1672
1754
  ...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
1673
1755
  neutral: ""
@@ -1793,12 +1875,17 @@ const link = (options) => ({
1793
1875
  variants: {
1794
1876
  active: {
1795
1877
  true: "text-primary",
1796
- false: ["text-muted hover:text-default", options.theme.transitions && "transition-colors"]
1878
+ false: "text-muted"
1797
1879
  },
1798
1880
  disabled: {
1799
1881
  true: "cursor-not-allowed opacity-75"
1800
1882
  }
1801
- }
1883
+ },
1884
+ compoundVariants: [{
1885
+ active: false,
1886
+ disabled: false,
1887
+ class: ["hover:text-default", options.theme.transitions && "transition-colors"]
1888
+ }]
1802
1889
  });
1803
1890
 
1804
1891
  const modal = {
@@ -1858,7 +1945,7 @@ const navigationMenu = (options) => ({
1858
1945
  separator: "px-2 h-px bg-border",
1859
1946
  viewportWrapper: "absolute top-full left-0 flex w-full",
1860
1947
  viewport: "relative overflow-hidden bg-default shadow-lg rounded-md ring ring-default h-(--reka-navigation-menu-viewport-height) w-full transition-[width,height,left] duration-200 origin-[top_center] data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] z-[1]",
1861
- content: "absolute top-0 left-0 w-full sm:w-auto",
1948
+ content: "absolute top-0 left-0 w-full",
1862
1949
  indicator: "absolute data-[state=visible]:animate-[fade-in_100ms_ease-out] data-[state=hidden]:animate-[fade-out_100ms_ease-in] data-[state=hidden]:opacity-0 bottom-0 z-[2] w-(--reka-navigation-menu-indicator-size) translate-x-(--reka-navigation-menu-indicator-position) flex h-2.5 items-end justify-center overflow-hidden transition-[translate,width] duration-200",
1863
1950
  arrow: "relative top-[50%] size-2.5 rotate-45 border border-default bg-default z-[1] rounded-xs"
1864
1951
  },
@@ -3229,7 +3316,7 @@ const tabs = (options) => ({
3229
3316
  root: "flex items-center gap-2",
3230
3317
  list: "relative flex p-1 group",
3231
3318
  indicator: "absolute transition-[translate,width] duration-200",
3232
- trigger: ["group relative inline-flex items-center shrink-0 min-w-0 data-[state=inactive]:text-muted hover:data-[state=inactive]:not-disabled:text-default font-medium rounded-md disabled:cursor-not-allowed disabled:opacity-75", options.theme.transitions && "transition-colors"],
3319
+ trigger: ["group relative inline-flex items-center min-w-0 data-[state=inactive]:text-muted hover:data-[state=inactive]:not-disabled:text-default font-medium rounded-md disabled:cursor-not-allowed disabled:opacity-75", options.theme.transitions && "transition-colors"],
3233
3320
  content: "focus:outline-none w-full",
3234
3321
  leadingIcon: "shrink-0",
3235
3322
  leadingAvatar: "shrink-0",
@@ -3244,12 +3331,13 @@ const tabs = (options) => ({
3244
3331
  variant: {
3245
3332
  pill: {
3246
3333
  list: "bg-elevated rounded-lg",
3247
- trigger: "flex-1 w-full",
3334
+ trigger: "grow",
3248
3335
  indicator: "rounded-md shadow-xs"
3249
3336
  },
3250
3337
  link: {
3251
3338
  list: "border-default",
3252
- indicator: "rounded-full"
3339
+ indicator: "rounded-full",
3340
+ trigger: "focus:outline-none"
3253
3341
  }
3254
3342
  },
3255
3343
  orientation: {
@@ -3664,7 +3752,7 @@ function getTemplates(options, uiConfig) {
3664
3752
  });
3665
3753
  }
3666
3754
  function generateVariantDeclarations(variants2) {
3667
- return variants2.map((variant) => {
3755
+ return variants2.filter((variant) => json.includes(`as typeof ${variant}`)).map((variant) => {
3668
3756
  const keys = Object.keys(result.variants[variant]);
3669
3757
  return `const ${variant} = ${JSON.stringify(keys, null, 2)} as const`;
3670
3758
  });
@@ -3681,7 +3769,7 @@ function getTemplates(options, uiConfig) {
3681
3769
  write: true,
3682
3770
  getContents: () => `@source "./ui";
3683
3771
 
3684
- @theme default {
3772
+ @theme default inline {
3685
3773
  --color-old-neutral-50: ${colors.neutral[50]};
3686
3774
  --color-old-neutral-100: ${colors.neutral[100]};
3687
3775
  --color-old-neutral-200: ${colors.neutral[200]};
@@ -3693,10 +3781,8 @@ function getTemplates(options, uiConfig) {
3693
3781
  --color-old-neutral-800: ${colors.neutral[800]};
3694
3782
  --color-old-neutral-900: ${colors.neutral[900]};
3695
3783
  --color-old-neutral-950: ${colors.neutral[950]};
3696
- ${[...(options.theme?.colors || []).filter((color) => !colors[color]), "neutral"].map((color) => [
3697
- color !== "neutral" && `--color-${color}: var(--ui-${color});`,
3698
- ...[50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950].map((shade) => `--color-${color}-${shade}: var(--ui-color-${color}-${shade});`)
3699
- ].filter(Boolean).join("\n ")).join("\n ")}
3784
+ ${[...(options.theme?.colors || []).filter((color) => !colors[color]), "neutral"].map((color) => [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950].map((shade) => `--color-${color}-${shade}: var(--ui-color-${color}-${shade});`).join("\n ")).join("\n ")}
3785
+ ${options.theme?.colors?.map((color) => `--color-${color}: var(--ui-${color});`).join("\n ")}
3700
3786
  --radius-xs: calc(var(--ui-radius) * 0.5);
3701
3787
  --radius-sm: var(--ui-radius);
3702
3788
  --radius-md: calc(var(--ui-radius) * 1.5);
@@ -3720,15 +3806,22 @@ function getTemplates(options, uiConfig) {
3720
3806
  --border-color-muted: var(--ui-border-muted);
3721
3807
  --border-color-accented: var(--ui-border-accented);
3722
3808
  --border-color-inverted: var(--ui-border-inverted);
3809
+ --border-color-bg: var(--ui-bg);
3723
3810
  --ring-color-default: var(--ui-border);
3724
3811
  --ring-color-muted: var(--ui-border-muted);
3725
3812
  --ring-color-accented: var(--ui-border-accented);
3726
3813
  --ring-color-inverted: var(--ui-border-inverted);
3727
3814
  --ring-color-bg: var(--ui-bg);
3815
+ --ring-offset-color-default: var(--ui-border);
3816
+ --ring-offset-color-muted: var(--ui-border-muted);
3817
+ --ring-offset-color-accented: var(--ui-border-accented);
3818
+ --ring-offset-color-inverted: var(--ui-border-inverted);
3819
+ --ring-offset-color-bg: var(--ui-bg);
3728
3820
  --divide-color-default: var(--ui-border);
3729
3821
  --divide-color-muted: var(--ui-border-muted);
3730
3822
  --divide-color-accented: var(--ui-border-accented);
3731
3823
  --divide-color-inverted: var(--ui-border-inverted);
3824
+ --divide-color-bg: var(--ui-bg);
3732
3825
  --outline-color-default: var(--ui-border);
3733
3826
  --outline-color-inverted: var(--ui-border-inverted);
3734
3827
  --stroke-default: var(--ui-border);
@@ -3746,7 +3839,7 @@ function getTemplates(options, uiConfig) {
3746
3839
  templates.push({
3747
3840
  filename: "types/ui.d.ts",
3748
3841
  getContents: () => `import * as ui from '#build/ui'
3749
- import type { DeepPartial } from '@nuxt/ui'
3842
+ import type { TVConfig } from '@nuxt/ui'
3750
3843
  import type { defaultConfig } from 'tailwind-variants'
3751
3844
  import colors from 'tailwindcss/colors'
3752
3845
 
@@ -3762,7 +3855,7 @@ type AppConfigUI = {
3762
3855
  }
3763
3856
  icons?: Partial<typeof icons>
3764
3857
  tv?: typeof defaultConfig
3765
- } & DeepPartial<typeof ui>
3858
+ } & TVConfig<typeof ui>
3766
3859
 
3767
3860
  declare module '@nuxt/schema' {
3768
3861
  interface AppConfigInput {
@@ -3781,8 +3874,8 @@ export {}
3781
3874
  filename: "ui-image-component.ts",
3782
3875
  write: true,
3783
3876
  getContents: ({ app }) => {
3784
- const image = app?.components?.find((c) => c.pascalName === "NuxtImg" && !c.filePath.includes("nuxt/dist/app"));
3785
- return image ? `export { default } from "${image.filePath}"` : 'export default "img"';
3877
+ const image = app?.components?.find((c) => c.pascalName === "NuxtImg" && !/nuxt(?:-nightly)?\/dist\/app/.test(c.filePath));
3878
+ return image ? genExport(image.filePath, [{ name: image.export, as: "default" }]) : 'export default "img"';
3786
3879
  }
3787
3880
  });
3788
3881
  return templates;
@@ -4,7 +4,7 @@ import { Options as Options$1 } from 'unplugin-vue-components/types';
4
4
  import colors from 'tailwindcss/colors';
5
5
  import * as ui from '#build/ui';
6
6
  import { ModuleOptions } from './module.mjs';
7
- import { DeepPartial } from '../dist/runtime/types/utils.js';
7
+ import { TVConfig } from '../dist/runtime/types/tv.js';
8
8
  import '@nuxt/schema';
9
9
  import '../dist/runtime/types/index.js';
10
10
 
@@ -36,7 +36,7 @@ type AppConfigUI = {
36
36
  neutral?: NeutralColor;
37
37
  };
38
38
  icons?: Partial<typeof _default>;
39
- } & DeepPartial<typeof ui>;
39
+ } & TVConfig<typeof ui>;
40
40
  interface NuxtUIOptions extends Omit<ModuleOptions, 'fonts' | 'colorMode'> {
41
41
  /** Whether to generate declaration files for auto-imported components. */
42
42
  dts?: boolean;
package/dist/unplugin.mjs CHANGED
@@ -3,7 +3,7 @@ import { join, normalize } from 'pathe';
3
3
  import { createUnplugin } from 'unplugin';
4
4
  import { defu } from 'defu';
5
5
  import tailwind from '@tailwindcss/vite';
6
- import { g as getTemplates, d as defaultOptions, r as resolveColors, a as getDefaultUiConfig } from './shared/ui.D7lOOabO.mjs';
6
+ import { g as getTemplates, d as defaultOptions, r as resolveColors, a as getDefaultUiConfig } from './shared/ui.BvUP-pSb.mjs';
7
7
  import { globSync } from 'tinyglobby';
8
8
  import { genSafeVariableName } from 'knitwork';
9
9
  import MagicString from 'magic-string';
package/dist/vite.d.mts CHANGED
@@ -8,7 +8,7 @@ import '#build/ui';
8
8
  import './module.mjs';
9
9
  import '@nuxt/schema';
10
10
  import '../dist/runtime/types/index.js';
11
- import '../dist/runtime/types/utils.js';
11
+ import '../dist/runtime/types/tv.js';
12
12
 
13
13
  declare const _default: (options?: NuxtUIOptions | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
14
14
 
package/dist/vite.mjs CHANGED
@@ -4,13 +4,13 @@ import 'pathe';
4
4
  import 'unplugin';
5
5
  import 'defu';
6
6
  import '@tailwindcss/vite';
7
- import './shared/ui.D7lOOabO.mjs';
7
+ import './shared/ui.BvUP-pSb.mjs';
8
8
  import '../dist/runtime/utils/index.js';
9
9
  import 'scule';
10
10
  import '@nuxt/kit';
11
11
  import 'tailwindcss/colors';
12
- import 'tinyglobby';
13
12
  import 'knitwork';
13
+ import 'tinyglobby';
14
14
  import 'magic-string';
15
15
  import 'mlly';
16
16
  import 'unplugin-vue-components';