@nuxt/ui 3.0.0-alpha.0 → 3.0.0-alpha.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 (173) hide show
  1. package/README.md +1 -1
  2. package/cli/node_modules/.ignored/citty/LICENSE +36 -0
  3. package/cli/node_modules/.ignored/citty/README.md +134 -0
  4. package/cli/node_modules/.ignored/citty/dist/index.cjs +475 -0
  5. package/cli/node_modules/.ignored/citty/dist/index.d.cts +80 -0
  6. package/cli/node_modules/.ignored/citty/dist/index.d.mts +80 -0
  7. package/cli/node_modules/.ignored/citty/dist/index.d.ts +80 -0
  8. package/cli/node_modules/.ignored/citty/dist/index.mjs +463 -0
  9. package/cli/node_modules/.ignored/citty/package.json +49 -0
  10. package/cli/node_modules/.ignored/consola/LICENSE +47 -0
  11. package/cli/node_modules/.ignored/consola/README.md +318 -0
  12. package/cli/node_modules/.ignored/consola/core.d.ts +1 -0
  13. package/cli/node_modules/.ignored/consola/dist/basic.cjs +32 -0
  14. package/cli/node_modules/.ignored/consola/dist/basic.d.ts +9 -0
  15. package/cli/node_modules/.ignored/consola/dist/basic.mjs +24 -0
  16. package/cli/node_modules/.ignored/consola/dist/browser.cjs +80 -0
  17. package/cli/node_modules/.ignored/consola/dist/browser.d.ts +7 -0
  18. package/cli/node_modules/.ignored/consola/dist/browser.mjs +72 -0
  19. package/cli/node_modules/.ignored/consola/dist/chunks/prompt.cjs +436 -0
  20. package/cli/node_modules/.ignored/consola/dist/chunks/prompt.mjs +429 -0
  21. package/cli/node_modules/.ignored/consola/dist/core.cjs +415 -0
  22. package/cli/node_modules/.ignored/consola/dist/core.d.ts +124 -0
  23. package/cli/node_modules/.ignored/consola/dist/core.mjs +410 -0
  24. package/cli/node_modules/.ignored/consola/dist/index.cjs +21 -0
  25. package/cli/node_modules/.ignored/consola/dist/index.d.ts +9 -0
  26. package/cli/node_modules/.ignored/consola/dist/index.mjs +8 -0
  27. package/cli/node_modules/.ignored/consola/dist/shared/consola.06ad8a64.mjs +62 -0
  28. package/cli/node_modules/.ignored/consola/dist/shared/consola.36c0034f.mjs +636 -0
  29. package/cli/node_modules/.ignored/consola/dist/shared/consola.4bbae468.cjs +645 -0
  30. package/cli/node_modules/.ignored/consola/dist/shared/consola.deac7d5a.cjs +65 -0
  31. package/cli/node_modules/.ignored/consola/dist/utils.cjs +308 -0
  32. package/cli/node_modules/.ignored/consola/dist/utils.d.ts +169 -0
  33. package/cli/node_modules/.ignored/consola/dist/utils.mjs +284 -0
  34. package/cli/node_modules/.ignored/consola/lib/index.cjs +9 -0
  35. package/cli/node_modules/.ignored/consola/package.json +101 -0
  36. package/cli/node_modules/.ignored/consola/utils.d.ts +1 -0
  37. package/cli/node_modules/.ignored/pathe/LICENSE +44 -0
  38. package/cli/node_modules/.ignored/pathe/README.md +69 -0
  39. package/cli/node_modules/.ignored/pathe/dist/index.cjs +23 -0
  40. package/cli/node_modules/.ignored/pathe/dist/index.d.cts +36 -0
  41. package/cli/node_modules/.ignored/pathe/dist/index.d.mts +36 -0
  42. package/cli/node_modules/.ignored/pathe/dist/index.d.ts +36 -0
  43. package/cli/node_modules/.ignored/pathe/dist/index.mjs +1 -0
  44. package/cli/node_modules/.ignored/pathe/dist/shared/pathe.1f0a373c.cjs +238 -0
  45. package/cli/node_modules/.ignored/pathe/dist/shared/pathe.ff20891b.mjs +221 -0
  46. package/cli/node_modules/.ignored/pathe/dist/utils.cjs +58 -0
  47. package/cli/node_modules/.ignored/pathe/dist/utils.d.cts +5 -0
  48. package/cli/node_modules/.ignored/pathe/dist/utils.d.mts +5 -0
  49. package/cli/node_modules/.ignored/pathe/dist/utils.d.ts +5 -0
  50. package/cli/node_modules/.ignored/pathe/dist/utils.mjs +54 -0
  51. package/cli/node_modules/.ignored/pathe/package.json +48 -0
  52. package/cli/node_modules/.ignored/pathe/utils.d.ts +1 -0
  53. package/cli/node_modules/.ignored/scule/LICENSE +21 -0
  54. package/cli/node_modules/.ignored/scule/README.md +149 -0
  55. package/cli/node_modules/.ignored/scule/dist/index.cjs +92 -0
  56. package/cli/node_modules/.ignored/scule/dist/index.d.cts +57 -0
  57. package/cli/node_modules/.ignored/scule/dist/index.d.mts +57 -0
  58. package/cli/node_modules/.ignored/scule/dist/index.d.ts +57 -0
  59. package/cli/node_modules/.ignored/scule/dist/index.mjs +80 -0
  60. package/cli/node_modules/.ignored/scule/package.json +43 -0
  61. package/cli/node_modules/.package-lock.json +33 -0
  62. package/dist/module.d.mts +9 -2
  63. package/dist/module.d.ts +9 -2
  64. package/dist/module.json +3 -3
  65. package/dist/module.mjs +62 -103
  66. package/dist/runtime/components/Accordion.vue +49 -6
  67. package/dist/runtime/components/Alert.vue +58 -6
  68. package/dist/runtime/components/App.vue +12 -2
  69. package/dist/runtime/components/Avatar.vue +27 -6
  70. package/dist/runtime/components/AvatarGroup.vue +30 -6
  71. package/dist/runtime/components/Badge.vue +28 -6
  72. package/dist/runtime/components/Breadcrumb.vue +44 -6
  73. package/dist/runtime/components/Button.vue +68 -10
  74. package/dist/runtime/components/ButtonGroup.vue +30 -6
  75. package/dist/runtime/components/Card.vue +25 -6
  76. package/dist/runtime/components/Checkbox.vue +45 -6
  77. package/dist/runtime/components/Chip.vue +39 -6
  78. package/dist/runtime/components/Collapsible.vue +27 -6
  79. package/dist/runtime/components/CommandPalette.vue +100 -7
  80. package/dist/runtime/components/Container.vue +22 -6
  81. package/dist/runtime/components/ContextMenu.vue +58 -6
  82. package/dist/runtime/components/ContextMenuContent.vue +18 -4
  83. package/dist/runtime/components/Drawer.vue +48 -6
  84. package/dist/runtime/components/DropdownMenu.vue +66 -6
  85. package/dist/runtime/components/DropdownMenuContent.vue +22 -4
  86. package/dist/runtime/components/Form.vue +58 -26
  87. package/dist/runtime/components/FormField.vue +41 -16
  88. package/dist/runtime/components/Icon.vue +12 -2
  89. package/dist/runtime/components/Input.vue +46 -6
  90. package/dist/runtime/components/InputMenu.vue +113 -6
  91. package/dist/runtime/components/Kbd.vue +28 -6
  92. package/dist/runtime/components/Link.vue +81 -17
  93. package/dist/runtime/components/LinkBase.vue +18 -7
  94. package/dist/runtime/components/Modal.vue +69 -6
  95. package/dist/runtime/components/NavigationMenu.vue +76 -6
  96. package/dist/runtime/components/Pagination.vue +99 -6
  97. package/dist/runtime/components/Popover.vue +42 -6
  98. package/dist/runtime/components/Progress.vue +44 -6
  99. package/dist/runtime/components/RadioGroup.vue +55 -7
  100. package/dist/runtime/components/Select.vue +89 -7
  101. package/dist/runtime/components/SelectMenu.vue +105 -7
  102. package/dist/runtime/components/Separator.vue +41 -6
  103. package/dist/runtime/components/Skeleton.vue +18 -6
  104. package/dist/runtime/components/Slideover.vue +67 -6
  105. package/dist/runtime/components/Slider.vue +36 -6
  106. package/dist/runtime/components/Switch.vue +50 -6
  107. package/dist/runtime/components/Tabs.vue +59 -6
  108. package/dist/runtime/components/Textarea.vue +46 -6
  109. package/dist/runtime/components/Toast.vue +55 -6
  110. package/dist/runtime/components/Toaster.vue +28 -7
  111. package/dist/runtime/components/Tooltip.vue +42 -6
  112. package/dist/runtime/composables/useAvatarGroup.d.ts +2 -2
  113. package/dist/runtime/composables/useButtonGroup.d.ts +3 -3
  114. package/dist/runtime/composables/useFormField.d.ts +7 -3
  115. package/dist/runtime/composables/useFormField.js +12 -7
  116. package/dist/runtime/composables/useModal.d.ts +1 -1
  117. package/dist/runtime/composables/useSlideover.d.ts +1 -1
  118. package/dist/runtime/composables/useToast.d.ts +2 -2
  119. package/dist/runtime/index.css +1 -0
  120. package/dist/runtime/plugins/colors.d.ts +2 -0
  121. package/dist/runtime/plugins/modal.d.ts +2 -0
  122. package/dist/runtime/plugins/slideover.d.ts +2 -0
  123. package/dist/runtime/types/form.d.ts +1 -2
  124. package/dist/runtime/utils/index.d.ts +1 -1
  125. package/dist/runtime/utils/link.d.ts +23 -55
  126. package/package.json +26 -25
  127. package/dist/runtime/assets/css/animations.css +0 -1
  128. package/dist/runtime/components/Accordion.vue.d.ts +0 -492
  129. package/dist/runtime/components/Alert.vue.d.ts +0 -548
  130. package/dist/runtime/components/App.vue.d.ts +0 -25
  131. package/dist/runtime/components/Avatar.vue.d.ts +0 -384
  132. package/dist/runtime/components/AvatarGroup.vue.d.ts +0 -381
  133. package/dist/runtime/components/Badge.vue.d.ts +0 -422
  134. package/dist/runtime/components/Breadcrumb.vue.d.ts +0 -307
  135. package/dist/runtime/components/Button.vue.d.ts +0 -949
  136. package/dist/runtime/components/ButtonGroup.vue.d.ts +0 -182
  137. package/dist/runtime/components/Card.vue.d.ts +0 -191
  138. package/dist/runtime/components/Checkbox.vue.d.ts +0 -819
  139. package/dist/runtime/components/Chip.vue.d.ts +0 -590
  140. package/dist/runtime/components/Collapsible.vue.d.ts +0 -159
  141. package/dist/runtime/components/CommandPalette.vue.d.ts +0 -684
  142. package/dist/runtime/components/Container.vue.d.ts +0 -27
  143. package/dist/runtime/components/ContextMenu.vue.d.ts +0 -796
  144. package/dist/runtime/components/ContextMenuContent.vue.d.ts +0 -0
  145. package/dist/runtime/components/Drawer.vue.d.ts +0 -343
  146. package/dist/runtime/components/DropdownMenu.vue.d.ts +0 -815
  147. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +0 -0
  148. package/dist/runtime/components/Form.vue.d.ts +0 -39
  149. package/dist/runtime/components/FormField.vue.d.ts +0 -356
  150. package/dist/runtime/components/Icon.vue.d.ts +0 -17
  151. package/dist/runtime/components/Input.vue.d.ts +0 -1137
  152. package/dist/runtime/components/InputMenu.vue.d.ts +0 -2121
  153. package/dist/runtime/components/Kbd.vue.d.ts +0 -169
  154. package/dist/runtime/components/Link.vue.d.ts +0 -76
  155. package/dist/runtime/components/LinkBase.vue.d.ts +0 -49
  156. package/dist/runtime/components/Modal.vue.d.ts +0 -319
  157. package/dist/runtime/components/NavigationMenu.vue.d.ts +0 -1789
  158. package/dist/runtime/components/Pagination.vue.d.ts +0 -295
  159. package/dist/runtime/components/Popover.vue.d.ts +0 -197
  160. package/dist/runtime/components/Progress.vue.d.ts +0 -1781
  161. package/dist/runtime/components/RadioGroup.vue.d.ts +0 -1715
  162. package/dist/runtime/components/Select.vue.d.ts +0 -1569
  163. package/dist/runtime/components/SelectMenu.vue.d.ts +0 -1661
  164. package/dist/runtime/components/Separator.vue.d.ts +0 -0
  165. package/dist/runtime/components/Skeleton.vue.d.ts +0 -26
  166. package/dist/runtime/components/Slideover.vue.d.ts +0 -375
  167. package/dist/runtime/components/Slider.vue.d.ts +0 -0
  168. package/dist/runtime/components/Switch.vue.d.ts +0 -1676
  169. package/dist/runtime/components/Tabs.vue.d.ts +0 -934
  170. package/dist/runtime/components/Textarea.vue.d.ts +0 -1133
  171. package/dist/runtime/components/Toast.vue.d.ts +0 -0
  172. package/dist/runtime/components/Toaster.vue.d.ts +0 -362
  173. package/dist/runtime/components/Tooltip.vue.d.ts +0 -248
@@ -1,9 +1,31 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/badge";
5
- const appConfig = _appConfig;
6
- const badge = tv({ extend: tv(theme), ...appConfig.ui?.badge || {} });
1
+ <script lang="ts">
2
+ import { tv, 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
+
7
+ const appConfig = _appConfig as AppConfig & { ui: { badge: Partial<typeof theme> } }
8
+
9
+ const badge = tv({ extend: tv(theme), ...(appConfig.ui?.badge || {}) })
10
+
11
+ type BadgeVariants = VariantProps<typeof badge>
12
+
13
+ export interface BadgeProps {
14
+ /**
15
+ * The element or component this component should render as.
16
+ * @defaultValue 'span'
17
+ */
18
+ as?: any
19
+ label?: string | number
20
+ color?: BadgeVariants['color']
21
+ variant?: BadgeVariants['variant']
22
+ size?: BadgeVariants['size']
23
+ class?: any
24
+ }
25
+
26
+ export interface BadgeSlots {
27
+ default(props?: {}): any
28
+ }
7
29
  </script>
8
30
 
9
31
  <script setup lang="ts">
@@ -1,9 +1,47 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/breadcrumb";
5
- const appConfig = _appConfig;
6
- const breadcrumb = tv({ extend: tv(theme), ...appConfig.ui?.breadcrumb || {} });
1
+ <script lang="ts">
2
+ import { tv } from 'tailwind-variants'
3
+ import type { AppConfig } from '@nuxt/schema'
4
+ import _appConfig from '#build/app.config'
5
+ import theme from '#build/ui/breadcrumb'
6
+ import type { AvatarProps, LinkProps } from '../types'
7
+ import type { DynamicSlots } from '../types/utils'
8
+
9
+ const appConfig = _appConfig as AppConfig & { ui: { breadcrumb: Partial<typeof theme> } }
10
+
11
+ const breadcrumb = tv({ extend: tv(theme), ...(appConfig.ui?.breadcrumb || {}) })
12
+
13
+ export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
14
+ label?: string
15
+ icon?: string
16
+ avatar?: AvatarProps
17
+ slot?: string
18
+ }
19
+
20
+ export interface BreadcrumbProps<T> {
21
+ /**
22
+ * The element or component this component should render as.
23
+ * @defaultValue 'div'
24
+ */
25
+ as?: any
26
+ items?: T[]
27
+ /**
28
+ * The icon to use as a separator.
29
+ * @defaultValue appConfig.ui.icons.chevronRight
30
+ */
31
+ separatorIcon?: string
32
+ class?: any
33
+ ui?: Partial<typeof breadcrumb.slots>
34
+ }
35
+
36
+ type SlotProps<T> = (props: { item: T, index: number, active?: boolean }) => any
37
+
38
+ export type BreadcrumbSlots<T extends { slot?: string }> = {
39
+ 'item': SlotProps<T>
40
+ 'item-leading': SlotProps<T>
41
+ 'item-label': SlotProps<T>
42
+ 'item-trailing': SlotProps<T>
43
+ 'separator'(props?: {}): any
44
+ } & DynamicSlots<T, SlotProps<T>>
7
45
  </script>
8
46
 
9
47
  <script setup lang="ts" generic="T extends BreadcrumbItem">
@@ -1,13 +1,44 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/button";
5
- const appConfig = _appConfig;
6
- const button = tv({ extend: tv(theme), ...appConfig.ui?.button || {} });
1
+ <script lang="ts">
2
+ import { tv, 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 type { PartialString } from '../types/utils'
9
+ import { formLoadingInjectionKey } from '../composables/useFormField'
10
+
11
+ const appConfig = _appConfig as AppConfig & { ui: { button: Partial<typeof theme> } }
12
+
13
+ const button = tv({ extend: tv(theme), ...(appConfig.ui?.button || {}) })
14
+
15
+ type ButtonVariants = VariantProps<typeof button>
16
+
17
+ export interface ButtonProps extends UseComponentIconsProps, Omit<LinkProps, 'raw' | 'custom'> {
18
+ label?: string
19
+ color?: ButtonVariants['color']
20
+ variant?: ButtonVariants['variant']
21
+ size?: ButtonVariants['size']
22
+ /** Render the button with equal padding on all sides. */
23
+ square?: boolean
24
+ /** Render the button full width. */
25
+ block?: boolean
26
+ /** Set loading state automatically based on the `@click` promise state */
27
+ loadingAuto?: boolean
28
+ onClick?: ((event: MouseEvent) => void | Promise<void>) | Array<((event: MouseEvent) => void | Promise<void>)>
29
+ class?: any
30
+ ui?: PartialString<typeof button.slots>
31
+ }
32
+
33
+ export interface ButtonSlots {
34
+ leading(props?: {}): any
35
+ default(props?: {}): any
36
+ trailing(props?: {}): any
37
+ }
7
38
  </script>
8
39
 
9
40
  <script setup lang="ts">
10
- import { computed } from 'vue'
41
+ import { type Ref, computed, ref, inject } from 'vue'
11
42
  import { useForwardProps } from 'radix-vue'
12
43
  import { useComponentIcons } from '../composables/useComponentIcons'
13
44
  import { useButtonGroup } from '../composables/useButtonGroup'
@@ -21,13 +52,33 @@ const slots = defineSlots<ButtonSlots>()
21
52
  const linkProps = useForwardProps(pickLinkProps(props))
22
53
 
23
54
  const { orientation, size: buttonSize } = useButtonGroup<ButtonProps>(props)
24
- const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props)
55
+
56
+ const loadingAutoState = ref(false)
57
+ const formLoading = inject<Ref<boolean> | undefined>(formLoadingInjectionKey, undefined)
58
+
59
+ async function onClickWrapper(event: MouseEvent) {
60
+ loadingAutoState.value = true
61
+ const callbacks = Array.isArray(props.onClick) ? props.onClick : [props.onClick]
62
+ try {
63
+ await Promise.all(callbacks.map(fn => fn?.(event)))
64
+ } finally {
65
+ loadingAutoState.value = false
66
+ }
67
+ }
68
+
69
+ const isLoading = computed(() => {
70
+ return props.loading || (props.loadingAuto && (loadingAutoState.value || (formLoading?.value && props.type === 'submit')))
71
+ })
72
+
73
+ const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(
74
+ computed(() => ({ ...props, loading: isLoading.value }))
75
+ )
25
76
 
26
77
  const ui = computed(() => button({
27
78
  color: props.color,
28
79
  variant: props.variant,
29
80
  size: buttonSize.value,
30
- loading: props.loading,
81
+ loading: isLoading.value,
31
82
  block: props.block,
32
83
  square: props.square || (!slots.default && !props.label),
33
84
  leading: isLeading.value,
@@ -37,7 +88,14 @@ const ui = computed(() => button({
37
88
  </script>
38
89
 
39
90
  <template>
40
- <ULink :type="type" :disabled="disabled || loading" :class="ui.base({ class: props.class })" v-bind="linkProps" raw>
91
+ <ULink
92
+ :type="type"
93
+ :disabled="disabled || isLoading"
94
+ :class="ui.base({ class: [props.class, props.ui?.base] })"
95
+ v-bind="linkProps"
96
+ raw
97
+ @click="onClickWrapper"
98
+ >
41
99
  <slot name="leading">
42
100
  <UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
43
101
  </slot>
@@ -1,9 +1,33 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/button-group";
5
- const appConfig = _appConfig;
6
- const buttonGroup = tv({ extend: tv(theme), ...appConfig.ui?.buttonGroup });
1
+ <script lang="ts">
2
+ import { tv, 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-group'
6
+
7
+ const appConfig = _appConfig as AppConfig & { ui: { buttonGroup: Partial<typeof theme> } }
8
+
9
+ const buttonGroup = tv({ extend: tv(theme), ...(appConfig.ui?.buttonGroup) })
10
+
11
+ type ButtonGroupVariants = VariantProps<typeof buttonGroup>
12
+
13
+ export interface ButtonGroupProps {
14
+ /**
15
+ * The element or component this component should render as.
16
+ * @defaultValue 'div'
17
+ */
18
+ as?: any
19
+ size?: ButtonGroupVariants['size']
20
+ /**
21
+ * The orientation the buttons are laid out.
22
+ * @defaultValue 'horizontal'
23
+ */
24
+ orientation?: ButtonGroupVariants['orientation']
25
+ class?: any
26
+ }
27
+
28
+ export interface ButtonGroupSlots {
29
+ default(props?: {}): any
30
+ }
7
31
  </script>
8
32
 
9
33
  <script setup lang="ts">
@@ -1,9 +1,28 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/card";
5
- const appConfig = _appConfig;
6
- const card = tv({ extend: tv(theme), ...appConfig.ui?.card || {} });
1
+ <script lang="ts">
2
+ import { tv } from 'tailwind-variants'
3
+ import type { AppConfig } from '@nuxt/schema'
4
+ import _appConfig from '#build/app.config'
5
+ import theme from '#build/ui/card'
6
+
7
+ const appConfig = _appConfig as AppConfig & { ui: { card: Partial<typeof theme> } }
8
+
9
+ const card = tv({ extend: tv(theme), ...(appConfig.ui?.card || {}) })
10
+
11
+ export interface CardProps {
12
+ /**
13
+ * The element or component this component should render as.
14
+ * @defaultValue 'div'
15
+ */
16
+ as?: any
17
+ class?: any
18
+ ui?: Partial<typeof card.slots>
19
+ }
20
+
21
+ export interface CardSlots {
22
+ header(props?: {}): any
23
+ default(props?: {}): any
24
+ footer(props?: {}): any
25
+ }
7
26
  </script>
8
27
 
9
28
  <script setup lang="ts">
@@ -1,9 +1,48 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/checkbox";
5
- const appConfig = _appConfig;
6
- const checkbox = tv({ extend: tv(theme), ...appConfig.ui?.checkbox || {} });
1
+ <script lang="ts">
2
+ import type { InputHTMLAttributes } from 'vue'
3
+ import { tv, type VariantProps } from 'tailwind-variants'
4
+ import type { CheckboxRootProps } from 'radix-vue'
5
+ import type { AppConfig } from '@nuxt/schema'
6
+ import _appConfig from '#build/app.config'
7
+ import theme from '#build/ui/checkbox'
8
+
9
+ const appConfig = _appConfig as AppConfig & { ui: { checkbox: Partial<typeof theme> } }
10
+
11
+ const checkbox = tv({ extend: tv(theme), ...(appConfig.ui?.checkbox || {}) })
12
+
13
+ type CheckboxVariants = VariantProps<typeof checkbox>
14
+
15
+ export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id'> {
16
+ label?: string
17
+ description?: string
18
+ color?: CheckboxVariants['color']
19
+ size?: CheckboxVariants['size']
20
+ /**
21
+ * The icon displayed when checked.
22
+ * @defaultValue appConfig.ui.icons.check
23
+ */
24
+ icon?: string
25
+ indeterminate?: InputHTMLAttributes['indeterminate']
26
+ /**
27
+ * The icon displayed when the checkbox is indeterminate.
28
+ * @defaultValue appConfig.ui.icons.minus
29
+ */
30
+ indeterminateIcon?: string
31
+ /** The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state. */
32
+ defaultValue?: boolean
33
+ class?: any
34
+ ui?: Partial<typeof checkbox.slots>
35
+ }
36
+
37
+ export interface CheckboxEmits {
38
+ (e: 'update:modelValue', payload: boolean): void
39
+ (e: 'change', payload: Event): void
40
+ }
41
+
42
+ export interface CheckboxSlots {
43
+ label(props: { label?: string }): any
44
+ description(props: { description?: string }): any
45
+ }
7
46
  </script>
8
47
 
9
48
  <script setup lang="ts">
@@ -1,9 +1,42 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/chip";
5
- const appConfig = _appConfig;
6
- const chip = tv({ extend: tv(theme), ...appConfig.ui?.chip || {} });
1
+ <script lang="ts">
2
+ import { tv, 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/chip'
6
+
7
+ const appConfig = _appConfig as AppConfig & { ui: { chip: Partial<typeof theme> } }
8
+
9
+ const chip = tv({ extend: tv(theme), ...(appConfig.ui?.chip || {}) })
10
+
11
+ type ChipVariants = VariantProps<typeof chip>
12
+
13
+ export interface ChipProps {
14
+ /**
15
+ * The element or component this component should render as.
16
+ * @defaultValue 'div'
17
+ */
18
+ as?: any
19
+ /** Display some text inside the chip. */
20
+ text?: string | number
21
+ color?: ChipVariants['color']
22
+ size?: ChipVariants['size']
23
+ position?: ChipVariants['position']
24
+ /** When `true`, translate the chip at the edge for non rounded elements. */
25
+ inset?: boolean
26
+ /** When `true`, render the chip relatively to the parent. */
27
+ standalone?: boolean
28
+ class?: any
29
+ ui?: Partial<typeof chip.slots>
30
+ }
31
+
32
+ export interface ChipEmits {
33
+ (e: 'update:show', payload: boolean): void
34
+ }
35
+
36
+ export interface ChipSlots {
37
+ default(props?: {}): any
38
+ content(props?: {}): any
39
+ }
7
40
  </script>
8
41
 
9
42
  <script setup lang="ts">
@@ -1,9 +1,30 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/collapsible";
5
- const appConfig = _appConfig;
6
- const collapsible = tv({ extend: tv(theme), ...appConfig.ui?.collapsible || {} });
1
+ <script lang="ts">
2
+ import { tv } from 'tailwind-variants'
3
+ import type { CollapsibleRootProps, CollapsibleRootEmits } from 'radix-vue'
4
+ import type { AppConfig } from '@nuxt/schema'
5
+ import _appConfig from '#build/app.config'
6
+ import theme from '#build/ui/collapsible'
7
+
8
+ const appConfig = _appConfig as AppConfig & { ui: { collapsible: Partial<typeof theme> } }
9
+
10
+ const collapsible = tv({ extend: tv(theme), ...(appConfig.ui?.collapsible || {}) })
11
+
12
+ export interface CollapsibleProps extends Pick<CollapsibleRootProps, 'defaultOpen' | 'open' | 'disabled'> {
13
+ /**
14
+ * The element or component this component should render as.
15
+ * @defaultValue 'div'
16
+ */
17
+ as?: any
18
+ class?: any
19
+ ui?: Partial<typeof collapsible.slots>
20
+ }
21
+
22
+ export interface CollapsibleEmits extends CollapsibleRootEmits {}
23
+
24
+ export interface CollapsibleSlots {
25
+ default(props: { open: boolean }): any
26
+ content(props?: {}): any
27
+ }
7
28
  </script>
8
29
 
9
30
  <script setup lang="ts">
@@ -1,9 +1,102 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/command-palette";
5
- const appConfig = _appConfig;
6
- const commandPalette = tv({ extend: tv(theme), ...appConfig.ui?.commandPalette || {} });
1
+ <script lang="ts">
2
+ import { tv } from 'tailwind-variants'
3
+ import type { ComboboxRootProps, ComboboxRootEmits, ComboboxItemProps } from 'radix-vue'
4
+ import type { FuseResult } from 'fuse.js'
5
+ import type { AppConfig } from '@nuxt/schema'
6
+ import type { UseFuseOptions } from '@vueuse/integrations/useFuse'
7
+ import _appConfig from '#build/app.config'
8
+ import theme from '#build/ui/command-palette'
9
+ import type { UseComponentIconsProps } from '../composables/useComponentIcons'
10
+ import type { AvatarProps, ButtonProps, ChipProps, KbdProps, InputProps } from '../types'
11
+ import type { DynamicSlots, PartialString } from '../types/utils'
12
+
13
+ const appConfig = _appConfig as AppConfig & { ui: { commandPalette: Partial<typeof theme> } }
14
+
15
+ const commandPalette = tv({ extend: tv(theme), ...(appConfig.ui?.commandPalette || {}) })
16
+
17
+ export interface CommandPaletteItem extends Pick<ComboboxItemProps, 'disabled'> {
18
+ prefix?: string
19
+ label?: string
20
+ suffix?: string
21
+ icon?: string
22
+ avatar?: AvatarProps
23
+ chip?: ChipProps
24
+ kbds?: KbdProps['value'][] | KbdProps[]
25
+ slot?: string
26
+ select?(e?: Event): void
27
+ }
28
+
29
+ export interface CommandPaletteGroup<T> {
30
+ id: string
31
+ label?: string
32
+ slot?: string
33
+ items?: T[]
34
+ /**
35
+ * Wether to filter group items with [useFuse](https://vueuse.org/integrations/useFuse).
36
+ * When `false`, items will not be filtered which is useful for custom filtering (useAsyncData, useFetch, etc.).
37
+ * @defaultValue true
38
+ */
39
+ filter?: boolean
40
+ /** Filter group items after the search happened. */
41
+ postFilter?: (searchTerm: string, items: T[]) => T[]
42
+ /** The icon displayed when an item is highlighted. */
43
+ highlightedIcon?: string
44
+ }
45
+
46
+ export interface CommandPaletteProps<G, T> extends Pick<ComboboxRootProps, 'multiple' | 'disabled' | 'modelValue' | 'defaultValue' | 'selectedValue' | 'resetSearchTermOnBlur'>, Pick<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
47
+ /**
48
+ * The element or component this component should render as.
49
+ * @defaultValue 'div'
50
+ */
51
+ as?: any
52
+ /**
53
+ * The icon displayed in the input.
54
+ * @defaultValue appConfig.ui.icons.search
55
+ */
56
+ icon?: string
57
+ /**
58
+ * The icon displayed when an item is selected.
59
+ * @defaultValue appConfig.ui.icons.check
60
+ */
61
+ selectedIcon?: string
62
+ /**
63
+ * The placeholder text for the input.
64
+ * @defaultValue 'Type a command or search...'
65
+ */
66
+ placeholder?: InputProps['placeholder']
67
+ /**
68
+ * Display a close button in the input (useful when inside a `UModal`).
69
+ * `{ size: 'md', color: 'gray', variant: 'ghost' }`{lang="ts-type"}
70
+ * @defaultValue false
71
+ */
72
+ close?: ButtonProps | boolean
73
+ /**
74
+ * The icon displayed in the close button.
75
+ * @defaultValue appConfig.ui.icons.close
76
+ */
77
+ closeIcon?: string
78
+ groups?: G[]
79
+ /**
80
+ * Options for [useFuse](https://vueuse.org/integrations/useFuse).
81
+ * @defaultValue { ignoreLocation: true, threshold: 0.1, keys: ['label', 'suffix'], resultLimit: 12, matchAllWhenSearchEmpty: true }
82
+ */
83
+ fuse?: UseFuseOptions<T>
84
+ class?: any
85
+ ui?: PartialString<typeof commandPalette.slots>
86
+ }
87
+
88
+ export type CommandPaletteEmits<T> = ComboboxRootEmits<T>
89
+
90
+ type SlotProps<T> = (props: { item: T, index: number }) => any
91
+
92
+ export type CommandPaletteSlots<G extends { slot?: string }, T extends { slot?: string }> = {
93
+ 'empty'(props: { searchTerm?: string }): any
94
+ 'close'(props: { ui: any }): any
95
+ 'item': SlotProps<T>
96
+ 'item-leading': SlotProps<T>
97
+ 'item-label': SlotProps<T>
98
+ 'item-trailing': SlotProps<T>
99
+ } & DynamicSlots<G, SlotProps<T>> & DynamicSlots<T, SlotProps<T>>
7
100
  </script>
8
101
 
9
102
  <script setup lang="ts" generic="G extends CommandPaletteGroup<T>, T extends CommandPaletteItem">
@@ -87,7 +180,7 @@ const groups = computed(() => {
87
180
  }
88
181
 
89
182
  acc[item.group] ||= []
90
- acc[item.group].push({ ...item, matches })
183
+ acc[item.group]?.push({ ...item, matches })
91
184
 
92
185
  return acc
93
186
  }, {} as Record<string, (T & { matches?: FuseResult<T>['matches'] })[]>)
@@ -1,9 +1,25 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/container";
5
- const appConfig = _appConfig;
6
- const container = tv({ extend: tv(theme), ...appConfig.ui?.container || {} });
1
+ <script lang="ts">
2
+ import { tv } from 'tailwind-variants'
3
+ import type { AppConfig } from '@nuxt/schema'
4
+ import _appConfig from '#build/app.config'
5
+ import theme from '#build/ui/container'
6
+
7
+ const appConfig = _appConfig as AppConfig & { ui: { container: Partial<typeof theme> } }
8
+
9
+ const container = tv({ extend: tv(theme), ...(appConfig.ui?.container || {}) })
10
+
11
+ export interface ContainerProps {
12
+ /**
13
+ * The element or component this component should render as.
14
+ * @defaultValue 'div'
15
+ */
16
+ as?: any
17
+ class?: any
18
+ }
19
+
20
+ export interface ContainerSlots {
21
+ default(props?: {}): any
22
+ }
7
23
  </script>
8
24
 
9
25
  <script setup lang="ts">
@@ -1,9 +1,61 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/context-menu";
5
- const appConfig = _appConfig;
6
- const contextMenu = tv({ extend: tv(theme), ...appConfig.ui?.contextMenu || {} });
1
+ <script lang="ts">
2
+ import { tv, type VariantProps } from 'tailwind-variants'
3
+ import type { ContextMenuRootProps, ContextMenuRootEmits, ContextMenuContentProps, ContextMenuTriggerProps, ContextMenuItemProps } from 'radix-vue'
4
+ import type { AppConfig } from '@nuxt/schema'
5
+ import _appConfig from '#build/app.config'
6
+ import theme from '#build/ui/context-menu'
7
+ import type { AvatarProps, KbdProps, LinkProps } from '../types'
8
+ import type { DynamicSlots } from '../types/utils'
9
+
10
+ const appConfig = _appConfig as AppConfig & { ui: { contextMenu: Partial<typeof theme> } }
11
+
12
+ const contextMenu = tv({ extend: tv(theme), ...(appConfig.ui?.contextMenu || {}) })
13
+
14
+ export interface ContextMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'>, Pick<ContextMenuItemProps, 'disabled'> {
15
+ label?: string
16
+ icon?: string
17
+ avatar?: AvatarProps
18
+ content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'>
19
+ kbds?: KbdProps['value'][] | KbdProps[]
20
+ /**
21
+ * The item type.
22
+ * @defaultValue 'link'
23
+ */
24
+ type?: 'label' | 'separator' | 'link'
25
+ slot?: string
26
+ open?: boolean
27
+ defaultOpen?: boolean
28
+ children?: ContextMenuItem[] | ContextMenuItem[][]
29
+ select?(e: Event): void
30
+ }
31
+
32
+ type ContextMenuVariants = VariantProps<typeof contextMenu>
33
+
34
+ export interface ContextMenuProps<T> extends Omit<ContextMenuRootProps, 'dir'>, Pick<ContextMenuTriggerProps, 'disabled'> {
35
+ size?: ContextMenuVariants['size']
36
+ items?: T[] | T[][]
37
+ /** The content of the menu. */
38
+ content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'>
39
+ /**
40
+ * Render the menu in a portal.
41
+ * @defaultValue true
42
+ */
43
+ portal?: boolean
44
+ class?: any
45
+ ui?: Partial<typeof contextMenu.slots>
46
+ }
47
+
48
+ export interface ContextMenuEmits extends ContextMenuRootEmits {}
49
+
50
+ type SlotProps<T> = (props: { item: T, active?: boolean, index: number }) => any
51
+
52
+ export type ContextMenuSlots<T extends { slot?: string }> = {
53
+ 'default'(props?: {}): any
54
+ 'item': SlotProps<T>
55
+ 'item-leading': SlotProps<T>
56
+ 'item-label': SlotProps<T>
57
+ 'item-trailing': SlotProps<T>
58
+ } & DynamicSlots<T, SlotProps<T>>
7
59
  </script>
8
60
 
9
61
  <script setup lang="ts" generic="T extends ContextMenuItem">
@@ -1,7 +1,21 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import theme from "#build/ui/context-menu";
4
- const contextMenu = tv(theme)();
1
+ <script lang="ts">
2
+ import { tv } from 'tailwind-variants'
3
+ import type { ContextMenuContentProps as RadixContextMenuContentProps, ContextMenuContentEmits as RadixContextMenuContentEmits } from 'radix-vue'
4
+ import theme from '#build/ui/context-menu'
5
+ import type { KbdProps, AvatarProps, ContextMenuItem, ContextMenuSlots } from '../types'
6
+
7
+ const _contextMenu = tv(theme)()
8
+
9
+ interface ContextMenuContentProps<T> extends Omit<RadixContextMenuContentProps, 'as' | 'asChild' | 'forceMount'> {
10
+ items?: T[] | T[][]
11
+ portal?: boolean
12
+ sub?: boolean
13
+ class?: any
14
+ ui: typeof _contextMenu
15
+ uiOverride?: any
16
+ }
17
+
18
+ interface ContextMenuContentEmits extends RadixContextMenuContentEmits {}
5
19
  </script>
6
20
 
7
21
  <script setup lang="ts" generic="T extends ContextMenuItem">