@nuxt/ui 3.0.2 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/.nuxt/ui/accordion.ts +2 -2
  2. package/.nuxt/ui/alert.ts +29 -29
  3. package/.nuxt/ui/avatar-group.ts +1 -1
  4. package/.nuxt/ui/avatar.ts +3 -3
  5. package/.nuxt/ui/badge.ts +33 -33
  6. package/.nuxt/ui/breadcrumb.ts +5 -5
  7. package/.nuxt/ui/button.ts +43 -43
  8. package/.nuxt/ui/calendar.ts +17 -17
  9. package/.nuxt/ui/card.ts +5 -5
  10. package/.nuxt/ui/carousel.ts +6 -6
  11. package/.nuxt/ui/checkbox-group.ts +61 -0
  12. package/.nuxt/ui/checkbox.ts +140 -27
  13. package/.nuxt/ui/chip.ts +8 -8
  14. package/.nuxt/ui/color-picker.ts +3 -3
  15. package/.nuxt/ui/command-palette.ts +14 -14
  16. package/.nuxt/ui/context-menu.ts +33 -33
  17. package/.nuxt/ui/drawer.ts +10 -10
  18. package/.nuxt/ui/dropdown-menu.ts +34 -34
  19. package/.nuxt/ui/form-field.ts +6 -6
  20. package/.nuxt/ui/index.ts +1 -0
  21. package/.nuxt/ui/input-menu.ts +42 -42
  22. package/.nuxt/ui/input-number.ts +20 -20
  23. package/.nuxt/ui/input.ts +23 -23
  24. package/.nuxt/ui/kbd.ts +4 -4
  25. package/.nuxt/ui/link.ts +3 -3
  26. package/.nuxt/ui/modal.ts +5 -5
  27. package/.nuxt/ui/navigation-menu.ts +78 -80
  28. package/.nuxt/ui/pin-input.ts +20 -20
  29. package/.nuxt/ui/popover.ts +2 -2
  30. package/.nuxt/ui/progress.ts +17 -17
  31. package/.nuxt/ui/radio-group.ts +250 -35
  32. package/.nuxt/ui/select-menu.ts +36 -33
  33. package/.nuxt/ui/select.ts +32 -32
  34. package/.nuxt/ui/separator.ts +8 -8
  35. package/.nuxt/ui/skeleton.ts +1 -1
  36. package/.nuxt/ui/slideover.ts +4 -4
  37. package/.nuxt/ui/slider.ts +16 -16
  38. package/.nuxt/ui/stepper.ts +18 -18
  39. package/.nuxt/ui/switch.ts +20 -20
  40. package/.nuxt/ui/table.ts +15 -15
  41. package/.nuxt/ui/tabs.ts +32 -32
  42. package/.nuxt/ui/textarea.ts +40 -35
  43. package/.nuxt/ui/toast.ts +24 -24
  44. package/.nuxt/ui/tooltip.ts +2 -2
  45. package/.nuxt/ui/tree.ts +18 -18
  46. package/.nuxt/ui.css +63 -12
  47. package/README.md +15 -0
  48. package/cli/templates.mjs +18 -17
  49. package/dist/module.json +5 -5
  50. package/dist/module.mjs +12 -7
  51. package/dist/runtime/components/Accordion.vue +36 -93
  52. package/dist/runtime/components/Accordion.vue.d.ts +75 -0
  53. package/dist/runtime/components/Alert.vue +37 -100
  54. package/dist/runtime/components/Alert.vue.d.ts +81 -0
  55. package/dist/runtime/components/App.vue +28 -34
  56. package/dist/runtime/components/App.vue.d.ts +24 -0
  57. package/dist/runtime/components/Avatar.vue +42 -75
  58. package/dist/runtime/components/Avatar.vue.d.ts +39 -0
  59. package/dist/runtime/components/AvatarGroup.vue +40 -77
  60. package/dist/runtime/components/AvatarGroup.vue.d.ts +31 -0
  61. package/dist/runtime/components/Badge.vue +33 -62
  62. package/dist/runtime/components/Badge.vue.d.ts +41 -0
  63. package/dist/runtime/components/Breadcrumb.vue +37 -90
  64. package/dist/runtime/components/Breadcrumb.vue.d.ts +64 -0
  65. package/dist/runtime/components/Button.vue +95 -104
  66. package/dist/runtime/components/Button.vue.d.ts +48 -0
  67. package/dist/runtime/components/ButtonGroup.vue +20 -46
  68. package/dist/runtime/components/ButtonGroup.vue.d.ts +34 -0
  69. package/dist/runtime/components/Calendar.vue +67 -150
  70. package/dist/runtime/components/Calendar.vue.d.ts +111 -0
  71. package/dist/runtime/components/Card.vue +18 -40
  72. package/dist/runtime/components/Card.vue.d.ts +29 -0
  73. package/dist/runtime/components/Carousel.vue +112 -234
  74. package/dist/runtime/components/Carousel.vue.d.ts +122 -0
  75. package/dist/runtime/components/Checkbox.vue +52 -93
  76. package/dist/runtime/components/Checkbox.vue.d.ts +73 -0
  77. package/dist/runtime/components/CheckboxGroup.vue +121 -0
  78. package/dist/runtime/components/CheckboxGroup.vue.d.ts +78 -0
  79. package/dist/runtime/components/Chip.vue +26 -69
  80. package/dist/runtime/components/Chip.vue.d.ts +57 -0
  81. package/dist/runtime/components/Collapsible.vue +22 -41
  82. package/dist/runtime/components/Collapsible.vue.d.ts +35 -0
  83. package/dist/runtime/components/ColorPicker.vue +111 -197
  84. package/dist/runtime/components/ColorPicker.vue.d.ts +48 -0
  85. package/dist/runtime/components/CommandPalette.vue +96 -237
  86. package/dist/runtime/components/CommandPalette.vue.d.ts +161 -0
  87. package/dist/runtime/components/Container.vue +15 -28
  88. package/dist/runtime/components/Container.vue.d.ts +18 -0
  89. package/dist/runtime/components/ContextMenu.vue +34 -133
  90. package/dist/runtime/components/ContextMenu.vue.d.ts +107 -0
  91. package/dist/runtime/components/ContextMenuContent.vue +73 -81
  92. package/dist/runtime/components/ContextMenuContent.vue.d.ts +65 -0
  93. package/dist/runtime/components/Drawer.vue +49 -83
  94. package/dist/runtime/components/Drawer.vue.d.ts +78 -0
  95. package/dist/runtime/components/DropdownMenu.vue +39 -142
  96. package/dist/runtime/components/DropdownMenu.vue.d.ts +117 -0
  97. package/dist/runtime/components/DropdownMenuContent.vue +78 -88
  98. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +68 -0
  99. package/dist/runtime/components/Form.vue +135 -220
  100. package/dist/runtime/components/Form.vue.d.ts +69 -0
  101. package/dist/runtime/components/FormField.vue +35 -77
  102. package/dist/runtime/components/FormField.vue.d.ts +61 -0
  103. package/dist/runtime/components/Icon.vue +12 -19
  104. package/dist/runtime/components/Icon.vue.d.ts +8 -0
  105. package/dist/runtime/components/Input.vue +82 -140
  106. package/dist/runtime/components/Input.vue.d.ts +76 -0
  107. package/dist/runtime/components/InputMenu.vue +185 -332
  108. package/dist/runtime/components/InputMenu.vue.d.ts +324 -0
  109. package/dist/runtime/components/InputNumber.vue +71 -133
  110. package/dist/runtime/components/InputNumber.vue.d.ts +182 -0
  111. package/dist/runtime/components/Kbd.vue +20 -46
  112. package/dist/runtime/components/Kbd.vue.d.ts +34 -0
  113. package/dist/runtime/components/Link.vue +98 -176
  114. package/dist/runtime/components/Link.vue.d.ts +93 -0
  115. package/dist/runtime/components/LinkBase.vue +33 -42
  116. package/dist/runtime/components/LinkBase.vue.d.ts +25 -0
  117. package/dist/runtime/components/Modal.vue +53 -116
  118. package/dist/runtime/components/Modal.vue.d.ts +93 -0
  119. package/dist/runtime/components/NavigationMenu.vue +77 -209
  120. package/dist/runtime/components/NavigationMenu.vue.d.ts +139 -0
  121. package/dist/runtime/components/OverlayProvider.vue +14 -18
  122. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
  123. package/dist/runtime/components/Pagination.vue +46 -140
  124. package/dist/runtime/components/Pagination.vue.d.ts +119 -0
  125. package/dist/runtime/components/PinInput.vue +61 -78
  126. package/dist/runtime/components/PinInput.vue.d.ts +57 -0
  127. package/dist/runtime/components/Popover.vue +47 -84
  128. package/dist/runtime/components/Popover.vue.d.ts +63 -0
  129. package/dist/runtime/components/Progress.vue +70 -131
  130. package/dist/runtime/components/Progress.vue.d.ts +66 -0
  131. package/dist/runtime/components/RadioGroup.vue +70 -132
  132. package/dist/runtime/components/RadioGroup.vue.d.ts +91 -0
  133. package/dist/runtime/components/Select.vue +110 -224
  134. package/dist/runtime/components/Select.vue.d.ts +145 -0
  135. package/dist/runtime/components/SelectMenu.vue +161 -310
  136. package/dist/runtime/components/SelectMenu.vue.d.ts +196 -0
  137. package/dist/runtime/components/Separator.vue +29 -71
  138. package/dist/runtime/components/Separator.vue.d.ts +54 -0
  139. package/dist/runtime/components/Skeleton.vue +21 -23
  140. package/dist/runtime/components/Skeleton.vue.d.ts +17 -0
  141. package/dist/runtime/components/Slideover.vue +53 -120
  142. package/dist/runtime/components/Slideover.vue.d.ts +94 -0
  143. package/dist/runtime/components/Slider.vue +46 -84
  144. package/dist/runtime/components/Slider.vue.d.ts +52 -0
  145. package/dist/runtime/components/Stepper.vue +45 -115
  146. package/dist/runtime/components/Stepper.vue.d.ts +83 -0
  147. package/dist/runtime/components/Switch.vue +45 -93
  148. package/dist/runtime/components/Switch.vue.d.ts +70 -0
  149. package/dist/runtime/components/Table.vue +163 -267
  150. package/dist/runtime/components/Table.vue.d.ts +183 -0
  151. package/dist/runtime/components/Tabs.vue +41 -107
  152. package/dist/runtime/components/Tabs.vue.d.ts +88 -0
  153. package/dist/runtime/components/Textarea.vue +113 -158
  154. package/dist/runtime/components/Textarea.vue.d.ts +78 -0
  155. package/dist/runtime/components/Toast.vue +49 -110
  156. package/dist/runtime/components/Toast.vue.d.ts +157 -0
  157. package/dist/runtime/components/Toaster.vue +70 -107
  158. package/dist/runtime/components/Toaster.vue.d.ts +38 -0
  159. package/dist/runtime/components/Tooltip.vue +38 -65
  160. package/dist/runtime/components/Tooltip.vue.d.ts +50 -0
  161. package/dist/runtime/components/Tree.vue +59 -166
  162. package/dist/runtime/components/Tree.vue.d.ts +111 -0
  163. package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
  164. package/dist/runtime/composables/defineShortcuts.js +6 -0
  165. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  166. package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
  167. package/dist/runtime/composables/useFormField.d.ts +2 -2
  168. package/dist/runtime/composables/useKbd.d.ts +1 -0
  169. package/dist/runtime/composables/useKbd.js +4 -3
  170. package/dist/runtime/composables/useOverlay.d.ts +14 -8
  171. package/dist/runtime/composables/useOverlay.js +20 -7
  172. package/dist/runtime/composables/usePortal.d.ts +6 -0
  173. package/dist/runtime/composables/usePortal.js +17 -0
  174. package/dist/runtime/index.css +1 -1
  175. package/dist/runtime/inertia/components/Link.vue +146 -0
  176. package/dist/runtime/inertia/components/Link.vue.d.ts +63 -0
  177. package/dist/runtime/inertia/stubs.d.ts +43 -0
  178. package/dist/runtime/inertia/stubs.js +82 -0
  179. package/dist/runtime/locale/bg.d.ts +3 -0
  180. package/dist/runtime/locale/bg.js +54 -0
  181. package/dist/runtime/locale/index.d.ts +5 -1
  182. package/dist/runtime/locale/index.js +5 -1
  183. package/dist/runtime/locale/kk.d.ts +3 -0
  184. package/dist/runtime/locale/kk.js +54 -0
  185. package/dist/runtime/locale/tj.d.ts +3 -0
  186. package/dist/runtime/locale/tj.js +54 -0
  187. package/dist/runtime/locale/ug_cn.d.ts +3 -0
  188. package/dist/runtime/locale/ug_cn.js +55 -0
  189. package/dist/runtime/types/form.d.ts +4 -1
  190. package/dist/runtime/types/index.d.ts +1 -0
  191. package/dist/runtime/types/index.js +1 -0
  192. package/dist/runtime/types/tv.d.ts +53 -0
  193. package/dist/runtime/types/tv.js +0 -0
  194. package/dist/runtime/types/utils.d.ts +7 -17
  195. package/dist/runtime/types/utils.js +1 -0
  196. package/dist/runtime/utils/link.d.ts +3 -3
  197. package/dist/runtime/utils/link.js +1 -0
  198. package/dist/runtime/utils/tv.js +2 -2
  199. package/dist/runtime/vue/components/Icon.vue +7 -8
  200. package/dist/runtime/vue/components/Icon.vue.d.ts +5 -0
  201. package/dist/runtime/vue/components/Link.vue +118 -202
  202. package/dist/runtime/vue/components/Link.vue.d.ts +93 -0
  203. package/dist/runtime/vue/stubs.d.ts +2 -2
  204. package/dist/shared/{ui.BkNUP964.mjs → ui.CbtTMMzt.mjs} +631 -366
  205. package/dist/types.d.mts +3 -5
  206. package/dist/unplugin.d.mts +6 -2
  207. package/dist/unplugin.mjs +25 -4
  208. package/dist/vite.d.mts +1 -1
  209. package/dist/vite.mjs +2 -2
  210. package/package.json +96 -54
  211. package/dist/module.cjs +0 -62
  212. package/dist/module.d.cts +0 -45
  213. package/dist/module.d.ts +0 -45
  214. package/dist/shared/ui.BL-XB3u1.cjs +0 -3555
  215. package/dist/types.d.ts +0 -7
  216. package/dist/unplugin.cjs +0 -232
  217. package/dist/unplugin.d.cts +0 -62
  218. package/dist/unplugin.d.ts +0 -62
  219. package/dist/vite.cjs +0 -23
  220. package/dist/vite.d.cts +0 -15
  221. package/dist/vite.d.ts +0 -15
@@ -0,0 +1,31 @@
1
+ import type { AppConfig } from '@nuxt/schema';
2
+ import theme from '#build/ui/avatar-group';
3
+ import type { ComponentConfig } from '../types/utils';
4
+ type AvatarGroup = ComponentConfig<typeof theme, AppConfig, 'avatarGroup'>;
5
+ export interface AvatarGroupProps {
6
+ /**
7
+ * The element or component this component should render as.
8
+ * @defaultValue 'div'
9
+ */
10
+ as?: any;
11
+ /**
12
+ * @defaultValue 'md'
13
+ */
14
+ size?: AvatarGroup['variants']['size'];
15
+ /**
16
+ * The maximum number of avatars to display.
17
+ */
18
+ max?: number | string;
19
+ class?: any;
20
+ ui?: AvatarGroup['slots'];
21
+ }
22
+ export interface AvatarGroupSlots {
23
+ default(props?: {}): any;
24
+ }
25
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<AvatarGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AvatarGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, AvatarGroupSlots>;
26
+ export default _default;
27
+ type __VLS_WithSlots<T, S> = T & {
28
+ new (): {
29
+ $slots: S;
30
+ };
31
+ };
@@ -1,77 +1,48 @@
1
- <script lang="ts">
2
- import type { VariantProps } from 'tailwind-variants'
3
- import type { AppConfig } from '@nuxt/schema'
4
- import _appConfig from '#build/app.config'
5
- import theme from '#build/ui/badge'
6
- import type { UseComponentIconsProps } from '../composables/useComponentIcons'
7
- import { tv } from '../utils/tv'
8
- import type { AvatarProps } from '../types'
9
-
10
- const appConfigBadge = _appConfig as AppConfig & { ui: { badge: Partial<typeof theme> } }
11
-
12
- const badge = tv({ extend: tv(theme), ...(appConfigBadge.ui?.badge || {}) })
13
-
14
- type BadgeVariants = VariantProps<typeof badge>
15
-
16
- export interface BadgeProps extends Omit<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
17
- /**
18
- * The element or component this component should render as.
19
- * @defaultValue 'span'
20
- */
21
- as?: any
22
- label?: string | number
23
- /**
24
- * @defaultValue 'primary'
25
- */
26
- color?: BadgeVariants['color']
27
- /**
28
- * @defaultValue 'solid'
29
- */
30
- variant?: BadgeVariants['variant']
31
- /**
32
- * @defaultValue 'md'
33
- */
34
- size?: BadgeVariants['size']
35
- class?: any
36
- ui?: Partial<typeof badge.slots>
37
- }
38
-
39
- export interface BadgeSlots {
40
- leading(props?: {}): any
41
- default(props?: {}): any
42
- trailing(props?: {}): any
43
- }
1
+ <script>
2
+ import theme from "#build/ui/badge";
44
3
  </script>
45
4
 
46
- <script setup lang="ts">
47
- import { computed } from 'vue'
48
- import { Primitive } from 'reka-ui'
49
- import { useButtonGroup } from '../composables/useButtonGroup'
50
- import { useComponentIcons } from '../composables/useComponentIcons'
51
- import UIcon from './Icon.vue'
52
- import UAvatar from './Avatar.vue'
53
-
54
- const props = withDefaults(defineProps<BadgeProps>(), {
55
- as: 'span'
56
- })
57
- defineSlots<BadgeSlots>()
58
-
59
- const { orientation, size: buttonGroupSize } = useButtonGroup<BadgeProps>(props)
60
- const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props)
61
-
62
- const ui = computed(() => badge({
5
+ <script setup>
6
+ import { computed } from "vue";
7
+ import { Primitive } from "reka-ui";
8
+ import { useAppConfig } from "#imports";
9
+ import { useButtonGroup } from "../composables/useButtonGroup";
10
+ import { useComponentIcons } from "../composables/useComponentIcons";
11
+ import { tv } from "../utils/tv";
12
+ import UIcon from "./Icon.vue";
13
+ import UAvatar from "./Avatar.vue";
14
+ const props = defineProps({
15
+ as: { type: null, required: false, default: "span" },
16
+ label: { type: [String, Number], required: false },
17
+ color: { type: null, required: false },
18
+ variant: { type: null, required: false },
19
+ size: { type: null, required: false },
20
+ class: { type: null, required: false },
21
+ ui: { type: null, required: false },
22
+ icon: { type: String, required: false },
23
+ avatar: { type: Object, required: false },
24
+ leading: { type: Boolean, required: false },
25
+ leadingIcon: { type: String, required: false },
26
+ trailing: { type: Boolean, required: false },
27
+ trailingIcon: { type: String, required: false }
28
+ });
29
+ defineSlots();
30
+ const appConfig = useAppConfig();
31
+ const { orientation, size: buttonGroupSize } = useButtonGroup(props);
32
+ const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props);
33
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.badge || {} })({
63
34
  color: props.color,
64
35
  variant: props.variant,
65
36
  size: buttonGroupSize.value || props.size,
66
37
  buttonGroup: orientation.value
67
- }))
38
+ }));
68
39
  </script>
69
40
 
70
41
  <template>
71
42
  <Primitive :as="as" :class="ui.base({ class: [props.class, props.ui?.base] })">
72
43
  <slot name="leading">
73
44
  <UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
74
- <UAvatar v-else-if="!!avatar" :size="((props.ui?.leadingAvatarSize || ui.leadingAvatarSize()) as AvatarProps['size'])" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
45
+ <UAvatar v-else-if="!!avatar" :size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
75
46
  </slot>
76
47
 
77
48
  <slot>
@@ -0,0 +1,41 @@
1
+ import type { AppConfig } from '@nuxt/schema';
2
+ import theme from '#build/ui/badge';
3
+ import type { UseComponentIconsProps } from '../composables/useComponentIcons';
4
+ import type { ComponentConfig } from '../types/utils';
5
+ type Badge = ComponentConfig<typeof theme, AppConfig, 'badge'>;
6
+ export interface BadgeProps extends Omit<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
7
+ /**
8
+ * The element or component this component should render as.
9
+ * @defaultValue 'span'
10
+ */
11
+ as?: any;
12
+ label?: string | number;
13
+ /**
14
+ * @defaultValue 'primary'
15
+ */
16
+ color?: Badge['variants']['color'];
17
+ /**
18
+ * @defaultValue 'solid'
19
+ */
20
+ variant?: Badge['variants']['variant'];
21
+ /**
22
+ * @defaultValue 'md'
23
+ */
24
+ size?: Badge['variants']['size'];
25
+ class?: any;
26
+ ui?: Badge['slots'];
27
+ }
28
+ export interface BadgeSlots {
29
+ leading(props?: {}): any;
30
+ default(props?: {}): any;
31
+ trailing(props?: {}): any;
32
+ }
33
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<BadgeProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BadgeProps> & Readonly<{}>, {
34
+ as: any;
35
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, BadgeSlots>;
36
+ export default _default;
37
+ type __VLS_WithSlots<T, S> = T & {
38
+ new (): {
39
+ $slots: S;
40
+ };
41
+ };
@@ -1,85 +1,32 @@
1
- <!-- eslint-disable vue/block-tag-newline -->
2
- <script lang="ts">
3
- import type { AppConfig } from '@nuxt/schema'
4
- import _appConfig from '#build/app.config'
5
- import theme from '#build/ui/breadcrumb'
6
- import { tv } from '../utils/tv'
7
- import type { AvatarProps, LinkProps } from '../types'
8
- import type { DynamicSlots, PartialString } from '../types/utils'
9
-
10
- const appConfigBreadcrumb = _appConfig as AppConfig & { ui: { breadcrumb: Partial<typeof theme> } }
11
-
12
- const breadcrumb = tv({ extend: tv(theme), ...(appConfigBreadcrumb.ui?.breadcrumb || {}) })
13
-
14
- export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
15
- label?: string
16
- /**
17
- * @IconifyIcon
18
- */
19
- icon?: string
20
- avatar?: AvatarProps
21
- slot?: string
22
- [key: string]: any
23
- }
24
-
25
- export interface BreadcrumbProps<T extends BreadcrumbItem = BreadcrumbItem> {
26
- /**
27
- * The element or component this component should render as.
28
- * @defaultValue 'nav'
29
- */
30
- as?: any
31
- items?: T[]
32
- /**
33
- * The icon to use as a separator.
34
- * @defaultValue appConfig.ui.icons.chevronRight
35
- * @IconifyIcon
36
- */
37
- separatorIcon?: string
38
- /**
39
- * The key used to get the label from the item.
40
- * @defaultValue 'label'
41
- */
42
- labelKey?: string
43
- class?: any
44
- ui?: PartialString<typeof breadcrumb.slots>
45
- }
46
-
47
- type SlotProps<T extends BreadcrumbItem> = (props: { item: T, index: number, active?: boolean }) => any
48
-
49
- export type BreadcrumbSlots<T extends BreadcrumbItem = BreadcrumbItem> = {
50
- 'item': SlotProps<T>
51
- 'item-leading': SlotProps<T>
52
- 'item-label': SlotProps<T>
53
- 'item-trailing': SlotProps<T>
54
- 'separator': any
55
- } & DynamicSlots<T, 'leading' | 'label' | 'trailing', { index: number, active?: boolean }>
56
-
1
+ <script>
2
+ import theme from "#build/ui/breadcrumb";
57
3
  </script>
58
4
 
59
- <script setup lang="ts" generic="T extends BreadcrumbItem">
60
- import { computed } from 'vue'
61
- import { Primitive } from 'reka-ui'
62
- import { useAppConfig } from '#imports'
63
- import { useLocale } from '../composables/useLocale'
64
- import { get } from '../utils'
65
- import { pickLinkProps } from '../utils/link'
66
- import UIcon from './Icon.vue'
67
- import UAvatar from './Avatar.vue'
68
- import ULinkBase from './LinkBase.vue'
69
- import ULink from './Link.vue'
70
-
71
- const props = withDefaults(defineProps<BreadcrumbProps<T>>(), {
72
- as: 'nav',
73
- labelKey: 'label'
74
- })
75
- const slots = defineSlots<BreadcrumbSlots<T>>()
76
- const { dir } = useLocale()
77
- const appConfig = useAppConfig()
78
-
79
- const separatorIcon = computed(() => props.separatorIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight))
80
-
81
- // eslint-disable-next-line vue/no-dupe-keys
82
- const ui = breadcrumb()
5
+ <script setup>
6
+ import { computed } from "vue";
7
+ import { Primitive } from "reka-ui";
8
+ import { useAppConfig } from "#imports";
9
+ import { useLocale } from "../composables/useLocale";
10
+ import { get } from "../utils";
11
+ import { tv } from "../utils/tv";
12
+ import { pickLinkProps } from "../utils/link";
13
+ import UIcon from "./Icon.vue";
14
+ import UAvatar from "./Avatar.vue";
15
+ import ULinkBase from "./LinkBase.vue";
16
+ import ULink from "./Link.vue";
17
+ const props = defineProps({
18
+ as: { type: null, required: false, default: "nav" },
19
+ items: { type: Array, required: false },
20
+ separatorIcon: { type: String, required: false },
21
+ labelKey: { type: String, required: false, default: "label" },
22
+ class: { type: null, required: false },
23
+ ui: { type: null, required: false }
24
+ });
25
+ const slots = defineSlots();
26
+ const { dir } = useLocale();
27
+ const appConfig = useAppConfig();
28
+ const separatorIcon = computed(() => props.separatorIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight));
29
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.breadcrumb || {} })());
83
30
  </script>
84
31
 
85
32
  <template>
@@ -88,26 +35,26 @@ const ui = breadcrumb()
88
35
  <template v-for="(item, index) in items" :key="index">
89
36
  <li :class="ui.item({ class: props.ui?.item })">
90
37
  <ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
91
- <ULinkBase v-bind="slotProps" as="span" :aria-current="active && (index === items!.length - 1) ? 'page' : undefined" :class="ui.link({ class: [props.ui?.link, item.class], active: index === items!.length - 1, disabled: !!item.disabled, to: !!item.to })">
92
- <slot :name="((item.slot || 'item') as keyof BreadcrumbSlots<T>)" :item="item" :index="index">
93
- <slot :name="((item.slot ? `${item.slot}-leading`: 'item-leading') as keyof BreadcrumbSlots<T>)" :item="item" :active="index === items!.length - 1" :index="index">
94
- <UIcon v-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon, active: index === items!.length - 1 })" />
95
- <UAvatar v-else-if="item.avatar" :size="((props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.linkLeadingAvatar({ class: props.ui?.linkLeadingAvatar, active: index === items!.length - 1 })" />
38
+ <ULinkBase v-bind="slotProps" as="span" :aria-current="active && index === items.length - 1 ? 'page' : void 0" :class="ui.link({ class: [props.ui?.link, item.class], active: index === items.length - 1, disabled: !!item.disabled, to: !!item.to })">
39
+ <slot :name="item.slot || 'item'" :item="item" :index="index">
40
+ <slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :active="index === items.length - 1" :index="index">
41
+ <UIcon v-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon, active: index === items.length - 1 })" />
42
+ <UAvatar v-else-if="item.avatar" :size="props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()" v-bind="item.avatar" :class="ui.linkLeadingAvatar({ class: props.ui?.linkLeadingAvatar, active: index === items.length - 1 })" />
96
43
  </slot>
97
44
 
98
- <span v-if="get(item, props.labelKey as string) || !!slots[(item.slot ? `${item.slot}-label`: 'item-label') as keyof BreadcrumbSlots<T>]" :class="ui.linkLabel({ class: props.ui?.linkLabel })">
99
- <slot :name="((item.slot ? `${item.slot}-label`: 'item-label') as keyof BreadcrumbSlots<T>)" :item="item" :active="index === items!.length - 1" :index="index">
100
- {{ get(item, props.labelKey as string) }}
45
+ <span v-if="get(item, props.labelKey) || !!slots[item.slot ? `${item.slot}-label` : 'item-label']" :class="ui.linkLabel({ class: props.ui?.linkLabel })">
46
+ <slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="item" :active="index === items.length - 1" :index="index">
47
+ {{ get(item, props.labelKey) }}
101
48
  </slot>
102
49
  </span>
103
50
 
104
- <slot :name="((item.slot ? `${item.slot}-trailing`: 'item-trailing') as keyof BreadcrumbSlots<T>)" :item="item" :active="index === items!.length - 1" :index="index" />
51
+ <slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="index === items.length - 1" :index="index" />
105
52
  </slot>
106
53
  </ULinkBase>
107
54
  </ULink>
108
55
  </li>
109
56
 
110
- <li v-if="index < items!.length - 1" role="presentation" aria-hidden="true" :class="ui.separator({ class: props.ui?.separator })">
57
+ <li v-if="index < items.length - 1" role="presentation" aria-hidden="true" :class="ui.separator({ class: props.ui?.separator })">
111
58
  <slot name="separator">
112
59
  <UIcon :name="separatorIcon" :class="ui.separatorIcon({ class: props.ui?.separatorIcon })" />
113
60
  </slot>
@@ -0,0 +1,64 @@
1
+ import type { AppConfig } from '@nuxt/schema';
2
+ import theme from '#build/ui/breadcrumb';
3
+ import type { AvatarProps, LinkProps } from '../types';
4
+ import type { DynamicSlots, ComponentConfig } from '../types/utils';
5
+ type Breadcrumb = ComponentConfig<typeof theme, AppConfig, 'breadcrumb'>;
6
+ export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
7
+ label?: string;
8
+ /**
9
+ * @IconifyIcon
10
+ */
11
+ icon?: string;
12
+ avatar?: AvatarProps;
13
+ slot?: string;
14
+ [key: string]: any;
15
+ }
16
+ export interface BreadcrumbProps<T extends BreadcrumbItem = BreadcrumbItem> {
17
+ /**
18
+ * The element or component this component should render as.
19
+ * @defaultValue 'nav'
20
+ */
21
+ as?: any;
22
+ items?: T[];
23
+ /**
24
+ * The icon to use as a separator.
25
+ * @defaultValue appConfig.ui.icons.chevronRight
26
+ * @IconifyIcon
27
+ */
28
+ separatorIcon?: string;
29
+ /**
30
+ * The key used to get the label from the item.
31
+ * @defaultValue 'label'
32
+ */
33
+ labelKey?: string;
34
+ class?: any;
35
+ ui?: Breadcrumb['slots'];
36
+ }
37
+ type SlotProps<T extends BreadcrumbItem> = (props: {
38
+ item: T;
39
+ index: number;
40
+ active?: boolean;
41
+ }) => any;
42
+ export type BreadcrumbSlots<T extends BreadcrumbItem = BreadcrumbItem> = {
43
+ 'item': SlotProps<T>;
44
+ 'item-leading': SlotProps<T>;
45
+ 'item-label': SlotProps<T>;
46
+ 'item-trailing': SlotProps<T>;
47
+ 'separator': any;
48
+ } & DynamicSlots<T, 'leading' | 'label' | 'trailing', {
49
+ index: number;
50
+ active?: boolean;
51
+ }>;
52
+ declare const _default: <T extends BreadcrumbItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
53
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & BreadcrumbProps<T> & Partial<{}>> & import("vue").PublicProps;
54
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
55
+ attrs: any;
56
+ slots: BreadcrumbSlots<T>;
57
+ emit: {};
58
+ }>) => import("vue").VNode & {
59
+ __ctx?: Awaited<typeof __VLS_setup>;
60
+ };
61
+ export default _default;
62
+ type __VLS_PrettifyLocal<T> = {
63
+ [K in keyof T]: T[K];
64
+ } & {};
@@ -1,122 +1,113 @@
1
- <script lang="ts">
2
- import type { VariantProps } from 'tailwind-variants'
3
- import type { AppConfig } from '@nuxt/schema'
4
- import _appConfig from '#build/app.config'
5
- import theme from '#build/ui/button'
6
- import type { LinkProps } from './Link.vue'
7
- import type { UseComponentIconsProps } from '../composables/useComponentIcons'
8
- import { tv } from '../utils/tv'
9
- import type { AvatarProps } from '../types'
10
- import type { PartialString } from '../types/utils'
11
-
12
- const appConfigButton = _appConfig as AppConfig & { ui: { button: Partial<typeof theme> } }
13
-
14
- const button = tv({ extend: tv(theme), ...(appConfigButton.ui?.button || {}) })
15
-
16
- type ButtonVariants = VariantProps<typeof button>
17
-
18
- export interface ButtonProps extends UseComponentIconsProps, Omit<LinkProps, 'raw' | 'custom'> {
19
- label?: string
20
- /**
21
- * @defaultValue 'primary'
22
- */
23
- color?: ButtonVariants['color']
24
- activeColor?: ButtonVariants['color']
25
- /**
26
- * @defaultValue 'solid'
27
- */
28
- variant?: ButtonVariants['variant']
29
- activeVariant?: ButtonVariants['variant']
30
- /**
31
- * @defaultValue 'md'
32
- */
33
- size?: ButtonVariants['size']
34
- /** Render the button with equal padding on all sides. */
35
- square?: boolean
36
- /** Render the button full width. */
37
- block?: boolean
38
- /** Set loading state automatically based on the `@click` promise state */
39
- loadingAuto?: boolean
40
- onClick?: ((event: MouseEvent) => void | Promise<void>) | Array<((event: MouseEvent) => void | Promise<void>)>
41
- class?: any
42
- ui?: PartialString<typeof button.slots>
43
- }
44
-
45
- export interface ButtonSlots {
46
- leading(props?: {}): any
47
- default(props?: {}): any
48
- trailing(props?: {}): any
49
- }
1
+ <script>
2
+ import theme from "#build/ui/button";
50
3
  </script>
51
4
 
52
- <script setup lang="ts">
53
- import { type Ref, computed, ref, inject } from 'vue'
54
- import { useForwardProps } from 'reka-ui'
55
- import { useComponentIcons } from '../composables/useComponentIcons'
56
- import { useButtonGroup } from '../composables/useButtonGroup'
57
- import { formLoadingInjectionKey } from '../composables/useFormField'
58
- import { omit } from '../utils'
59
- import { pickLinkProps } from '../utils/link'
60
- import UIcon from './Icon.vue'
61
- import UAvatar from './Avatar.vue'
62
- import ULink from './Link.vue'
63
- import ULinkBase from './LinkBase.vue'
64
-
65
- const props = withDefaults(defineProps<ButtonProps>(), {
66
- active: undefined,
67
- activeClass: '',
68
- inactiveClass: ''
69
- })
70
- const slots = defineSlots<ButtonSlots>()
71
-
72
- const linkProps = useForwardProps(pickLinkProps(props))
73
-
74
- const { orientation, size: buttonSize } = useButtonGroup<ButtonProps>(props)
75
-
76
- const loadingAutoState = ref(false)
77
- const formLoading = inject<Ref<boolean> | undefined>(formLoadingInjectionKey, undefined)
78
-
79
- async function onClickWrapper(event: MouseEvent) {
80
- loadingAutoState.value = true
81
- const callbacks = Array.isArray(props.onClick) ? props.onClick : [props.onClick]
5
+ <script setup>
6
+ import { computed, ref, inject } from "vue";
7
+ import { defu } from "defu";
8
+ import { useForwardProps } from "reka-ui";
9
+ import { useAppConfig } from "#imports";
10
+ import { useComponentIcons } from "../composables/useComponentIcons";
11
+ import { useButtonGroup } from "../composables/useButtonGroup";
12
+ import { formLoadingInjectionKey } from "../composables/useFormField";
13
+ import { omit } from "../utils";
14
+ import { tv } from "../utils/tv";
15
+ import { pickLinkProps } from "../utils/link";
16
+ import UIcon from "./Icon.vue";
17
+ import UAvatar from "./Avatar.vue";
18
+ import ULink from "./Link.vue";
19
+ import ULinkBase from "./LinkBase.vue";
20
+ const props = defineProps({
21
+ label: { type: String, required: false },
22
+ color: { type: null, required: false },
23
+ activeColor: { type: null, required: false },
24
+ variant: { type: null, required: false },
25
+ activeVariant: { type: null, required: false },
26
+ size: { type: null, required: false },
27
+ square: { type: Boolean, required: false },
28
+ block: { type: Boolean, required: false },
29
+ loadingAuto: { type: Boolean, required: false },
30
+ onClick: { type: [Function, Array], required: false },
31
+ class: { type: null, required: false },
32
+ ui: { type: null, required: false },
33
+ icon: { type: String, required: false },
34
+ avatar: { type: Object, required: false },
35
+ leading: { type: Boolean, required: false },
36
+ leadingIcon: { type: String, required: false },
37
+ trailing: { type: Boolean, required: false },
38
+ trailingIcon: { type: String, required: false },
39
+ loading: { type: Boolean, required: false },
40
+ loadingIcon: { type: String, required: false },
41
+ as: { type: null, required: false },
42
+ type: { type: null, required: false },
43
+ disabled: { type: Boolean, required: false },
44
+ active: { type: Boolean, required: false, default: void 0 },
45
+ exact: { type: Boolean, required: false },
46
+ exactQuery: { type: [Boolean, String], required: false },
47
+ exactHash: { type: Boolean, required: false },
48
+ inactiveClass: { type: String, required: false, default: "" },
49
+ to: { type: null, required: false },
50
+ href: { type: null, required: false },
51
+ external: { type: Boolean, required: false },
52
+ target: { type: [String, Object, null], required: false },
53
+ rel: { type: [String, Object, null], required: false },
54
+ noRel: { type: Boolean, required: false },
55
+ prefetchedClass: { type: String, required: false },
56
+ prefetch: { type: Boolean, required: false },
57
+ prefetchOn: { type: [String, Object], required: false },
58
+ noPrefetch: { type: Boolean, required: false },
59
+ activeClass: { type: String, required: false, default: "" },
60
+ exactActiveClass: { type: String, required: false },
61
+ ariaCurrentValue: { type: String, required: false },
62
+ viewTransition: { type: Boolean, required: false },
63
+ replace: { type: Boolean, required: false }
64
+ });
65
+ const slots = defineSlots();
66
+ const appConfig = useAppConfig();
67
+ const { orientation, size: buttonSize } = useButtonGroup(props);
68
+ const linkProps = useForwardProps(pickLinkProps(props));
69
+ const loadingAutoState = ref(false);
70
+ const formLoading = inject(formLoadingInjectionKey, void 0);
71
+ async function onClickWrapper(event) {
72
+ loadingAutoState.value = true;
73
+ const callbacks = Array.isArray(props.onClick) ? props.onClick : [props.onClick];
82
74
  try {
83
- await Promise.all(callbacks.map(fn => fn?.(event)))
75
+ await Promise.all(callbacks.map((fn) => fn?.(event)));
84
76
  } finally {
85
- loadingAutoState.value = false
77
+ loadingAutoState.value = false;
86
78
  }
87
79
  }
88
-
89
80
  const isLoading = computed(() => {
90
- return props.loading || (props.loadingAuto && (loadingAutoState.value || (formLoading?.value && props.type === 'submit')))
91
- })
92
-
81
+ return props.loading || props.loadingAuto && (loadingAutoState.value || formLoading?.value && props.type === "submit");
82
+ });
93
83
  const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(
94
84
  computed(() => ({ ...props, loading: isLoading.value }))
95
- )
96
-
85
+ );
97
86
  const ui = computed(() => tv({
98
- extend: button,
99
- variants: {
100
- active: {
101
- true: {
102
- base: props.activeClass
103
- },
104
- false: {
105
- base: props.inactiveClass
87
+ extend: tv(theme),
88
+ ...defu({
89
+ variants: {
90
+ active: {
91
+ true: {
92
+ base: props.activeClass
93
+ },
94
+ false: {
95
+ base: props.inactiveClass
96
+ }
106
97
  }
107
98
  }
108
- }
99
+ }, appConfig.ui?.button || {})
109
100
  })({
110
101
  color: props.color,
111
102
  variant: props.variant,
112
103
  size: buttonSize.value,
113
104
  loading: isLoading.value,
114
105
  block: props.block,
115
- square: props.square || (!slots.default && !props.label),
106
+ square: props.square || !slots.default && !props.label,
116
107
  leading: isLeading.value,
117
108
  trailing: isTrailing.value,
118
109
  buttonGroup: orientation.value
119
- }))
110
+ }));
120
111
  </script>
121
112
 
122
113
  <template>
@@ -131,16 +122,16 @@ const ui = computed(() => tv({
131
122
  <ULinkBase
132
123
  v-bind="slotProps"
133
124
  :class="ui.base({
134
- class: [props.class, props.ui?.base],
135
- active,
136
- ...(active && activeVariant ? { variant: activeVariant } : {}),
137
- ...(active && activeColor ? { color: activeColor } : {})
138
- })"
125
+ class: [props.class, props.ui?.base],
126
+ active,
127
+ ...active && activeVariant ? { variant: activeVariant } : {},
128
+ ...active && activeColor ? { color: activeColor } : {}
129
+ })"
139
130
  @click="onClickWrapper"
140
131
  >
141
132
  <slot name="leading">
142
133
  <UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon, active })" />
143
- <UAvatar v-else-if="!!avatar" :size="((props.ui?.leadingAvatarSize || ui.leadingAvatarSize()) as AvatarProps['size'])" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar, active })" />
134
+ <UAvatar v-else-if="!!avatar" :size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar, active })" />
144
135
  </slot>
145
136
 
146
137
  <slot>