@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,91 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/select";
5
- const appConfig = _appConfig;
6
- const select = tv({ extend: tv(theme), ...appConfig.ui?.select || {} });
1
+ <script lang="ts">
2
+ import { tv, type VariantProps } from 'tailwind-variants'
3
+ import type { SelectRootProps, SelectRootEmits, SelectContentProps, SelectArrowProps, SelectItemProps } from 'radix-vue'
4
+ import type { AppConfig } from '@nuxt/schema'
5
+ import _appConfig from '#build/app.config'
6
+ import theme from '#build/ui/select'
7
+ import type { UseComponentIconsProps } from '../composables/useComponentIcons'
8
+ import type { AvatarProps, ChipProps, InputProps } from '../types'
9
+ import type { AcceptableValue, PartialString } from '../types/utils'
10
+
11
+ const appConfig = _appConfig as AppConfig & { ui: { select: Partial<typeof theme> } }
12
+
13
+ const select = tv({ extend: tv(theme), ...(appConfig.ui?.select || {}) })
14
+
15
+ export interface SelectItem extends Pick<SelectItemProps, 'disabled' | 'value'> {
16
+ label?: string
17
+ icon?: string
18
+ avatar?: AvatarProps
19
+ chip?: ChipProps
20
+ /**
21
+ * The item type.
22
+ * @defaultValue 'item'
23
+ */
24
+ type?: 'label' | 'separator' | 'item'
25
+ }
26
+
27
+ type SelectVariants = VariantProps<typeof select>
28
+
29
+ export interface SelectProps<T> extends Omit<SelectRootProps, 'dir'>, UseComponentIconsProps {
30
+ id?: string
31
+ /** The placeholder text when the select is empty. */
32
+ placeholder?: string
33
+ color?: SelectVariants['color']
34
+ variant?: SelectVariants['variant']
35
+ size?: SelectVariants['size']
36
+ /**
37
+ * The icon displayed to open the menu.
38
+ * @defaultValue appConfig.ui.icons.chevronDown
39
+ */
40
+ trailingIcon?: string
41
+ /**
42
+ * The icon displayed when an item is selected.
43
+ * @defaultValue appConfig.ui.icons.check
44
+ */
45
+ selectedIcon?: string
46
+ /**
47
+ * The content of the menu.
48
+ * @defaultValue { side: 'bottom', sideOffset: 8, position: 'popper' }
49
+ */
50
+ content?: Omit<SelectContentProps, 'as' | 'asChild' | 'forceMount'>
51
+ /**
52
+ * Display an arrow alongside the menu.
53
+ * @defaultValue false
54
+ */
55
+ arrow?: boolean | Omit<SelectArrowProps, 'as' | 'asChild'>
56
+ /**
57
+ * Render the menu in a portal.
58
+ * @defaultValue true
59
+ */
60
+ portal?: boolean
61
+ /**
62
+ * When `items` is an array of objects, select the field to use as the value.
63
+ * @defaultValue 'value'
64
+ */
65
+ valueKey?: string
66
+ items?: T[] | T[][]
67
+ /** Highlight the ring color like a focus state. */
68
+ highlight?: boolean
69
+ class?: any
70
+ ui?: PartialString<typeof select.slots>
71
+ }
72
+
73
+ export type SelectEmits = SelectRootEmits & {
74
+ change: [payload: Event]
75
+ blur: [payload: FocusEvent]
76
+ focus: [payload: FocusEvent]
77
+ }
78
+
79
+ type SlotProps<T> = (props: { item: T, index: number }) => any
80
+
81
+ export interface SelectSlots<T> {
82
+ 'leading'(props: { modelValue: string, open: boolean, ui: any }): any
83
+ 'trailing'(props: { modelValue: string, open: boolean, ui: any }): any
84
+ 'item': SlotProps<T>
85
+ 'item-leading': SlotProps<T>
86
+ 'item-label': SlotProps<T>
87
+ 'item-trailing': SlotProps<T>
88
+ }
7
89
  </script>
8
90
 
9
91
  <script setup lang="ts" generic="T extends SelectItem | AcceptableValue">
@@ -79,7 +161,7 @@ function onUpdateOpen(value: boolean) {
79
161
  @update:model-value="onUpdate"
80
162
  @update:open="onUpdateOpen"
81
163
  >
82
- <SelectTrigger :class="ui.base({ class: props.class })">
164
+ <SelectTrigger :class="ui.base({ class: [props.class, props.ui?.base] })">
83
165
  <span v-if="isLeading || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
84
166
  <slot name="leading" :model-value="modelValue" :open="open" :ui="ui">
85
167
  <UIcon v-if="leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
@@ -1,9 +1,107 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/select-menu";
5
- const appConfig = _appConfig;
6
- const selectMenu = tv({ extend: tv(theme), ...appConfig.ui?.selectMenu || {} });
1
+ <script lang="ts">
2
+ import { tv, type VariantProps } from 'tailwind-variants'
3
+ import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps, ComboboxItemProps, ComboboxArrowProps } from 'radix-vue'
4
+ import type { AppConfig } from '@nuxt/schema'
5
+ import _appConfig from '#build/app.config'
6
+ import theme from '#build/ui/select-menu'
7
+ import type { UseComponentIconsProps } from '../composables/useComponentIcons'
8
+ import type { AvatarProps, ChipProps, InputProps } from '../types'
9
+ import type { AcceptableValue, ArrayOrWrapped, PartialString } from '../types/utils'
10
+
11
+ const appConfig = _appConfig as AppConfig & { ui: { selectMenu: Partial<typeof theme> } }
12
+
13
+ const selectMenu = tv({ extend: tv(theme), ...(appConfig.ui?.selectMenu || {}) })
14
+
15
+ export interface SelectMenuItem extends Pick<ComboboxItemProps, 'disabled'> {
16
+ label?: string
17
+ icon?: string
18
+ avatar?: AvatarProps
19
+ chip?: ChipProps
20
+ /**
21
+ * The item type.
22
+ * @defaultValue 'item'
23
+ */
24
+ type?: 'label' | 'separator' | 'item'
25
+ }
26
+
27
+ type SelectMenuVariants = VariantProps<typeof selectMenu>
28
+
29
+ export interface SelectMenuProps<T> extends Pick<ComboboxRootProps<T>, 'modelValue' | 'defaultValue' | 'selectedValue' | 'open' | 'defaultOpen' | 'searchTerm' | 'multiple' | 'disabled' | 'name' | 'resetSearchTermOnBlur'>, UseComponentIconsProps {
30
+ id?: string
31
+ /** The placeholder text when the select is empty. */
32
+ placeholder?: string
33
+ /**
34
+ * Wether to display the search input or not.
35
+ * @defaultValue true
36
+ */
37
+ search?: boolean
38
+ /** The placeholder text when the search input is empty. */
39
+ searchPlaceholder?: string
40
+ color?: SelectMenuVariants['color']
41
+ variant?: SelectMenuVariants['variant']
42
+ size?: SelectMenuVariants['size']
43
+ required?: boolean
44
+ /**
45
+ * The icon displayed to open the menu.
46
+ * @defaultValue appConfig.ui.icons.chevronDown
47
+ */
48
+ trailingIcon?: string
49
+ /**
50
+ * The icon displayed when an item is selected.
51
+ * @defaultValue appConfig.ui.icons.check
52
+ */
53
+ selectedIcon?: string
54
+ /**
55
+ * The content of the menu.
56
+ * @defaultValue { side: 'bottom', sideOffset: 8, position: 'popper' }
57
+ */
58
+ content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'>
59
+ /**
60
+ * Display an arrow alongside the menu.
61
+ * @defaultValue false
62
+ */
63
+ arrow?: boolean | Omit<ComboboxArrowProps, 'as' | 'asChild'>
64
+ /**
65
+ * Render the menu in a portal.
66
+ * @defaultValue true
67
+ */
68
+ portal?: boolean
69
+ /**
70
+ * Whether to filter items or not, can be an array of fields to filter.
71
+ * When `false`, items will not be filtered which is useful for custom filtering (useAsyncData, useFetch, etc.).
72
+ * @defaultValue ['label']
73
+ */
74
+ filter?: boolean | string[]
75
+ /**
76
+ * When `items` is an array of objects, select the field to use as the value instead of the object itself.
77
+ * @defaultValue undefined
78
+ */
79
+ valueKey?: keyof T
80
+ items?: T[] | T[][]
81
+ /** Highlight the ring color like a focus state. */
82
+ highlight?: boolean
83
+ class?: any
84
+ ui?: PartialString<typeof selectMenu.slots>
85
+ }
86
+
87
+ export type SelectMenuEmits<T> = ComboboxRootEmits<T> & {
88
+ change: [payload: Event]
89
+ blur: [payload: FocusEvent]
90
+ focus: [payload: FocusEvent]
91
+ }
92
+
93
+ type SlotProps<T> = (props: { item: T, index: number }) => any
94
+
95
+ export type SelectMenuSlots<T> = {
96
+ 'leading'(props: { modelValue: T, open: boolean, ui: any }): any
97
+ 'default'(props: { modelValue: T, open: boolean }): any
98
+ 'trailing'(props: { modelValue: T, open: boolean, ui: any }): any
99
+ 'empty'(props: { searchTerm?: string }): any
100
+ 'item': SlotProps<T>
101
+ 'item-leading': SlotProps<T>
102
+ 'item-label': SlotProps<T>
103
+ 'item-trailing': SlotProps<T>
104
+ }
7
105
  </script>
8
106
 
9
107
  <script setup lang="ts" generic="T extends SelectMenuItem | AcceptableValue">
@@ -121,7 +219,7 @@ function onUpdateOpen(value: boolean) {
121
219
  @update:open="onUpdateOpen"
122
220
  >
123
221
  <ComboboxAnchor as-child>
124
- <ComboboxTrigger :class="ui.base({ class: props.class })" tabindex="0">
222
+ <ComboboxTrigger :class="ui.base({ class: [props.class, props.ui?.base] })" tabindex="0">
125
223
  <span v-if="isLeading || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
126
224
  <slot name="leading" :model-value="(modelValue as T)" :open="open" :ui="ui">
127
225
  <UIcon v-if="leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
@@ -1,9 +1,44 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/separator";
5
- const appConfig = _appConfig;
6
- const separator = tv({ extend: tv(theme), ...appConfig.ui?.separator || {} });
1
+ <script lang="ts">
2
+ import { tv, type VariantProps } from 'tailwind-variants'
3
+ import type { SeparatorProps as _SeparatorProps } from 'radix-vue'
4
+ import type { AppConfig } from '@nuxt/schema'
5
+ import _appConfig from '#build/app.config'
6
+ import theme from '#build/ui/separator'
7
+ import type { AvatarProps } from '../types'
8
+
9
+ const appConfig = _appConfig as AppConfig & { ui: { separator: Partial<typeof theme> } }
10
+
11
+ const separator = tv({ extend: tv(theme), ...(appConfig.ui?.separator || {}) })
12
+
13
+ type SeparatorVariants = VariantProps<typeof separator>
14
+
15
+ export interface SeparatorProps extends Pick<_SeparatorProps, 'decorative'> {
16
+ /**
17
+ * The element or component this component should render as.
18
+ * @defaultValue `div`
19
+ */
20
+ as?: any
21
+ /** Display a label in the middle. */
22
+ label?: string
23
+ /** Display an icon in the middle. */
24
+ icon?: string
25
+ /** Display an avatar in the middle. */
26
+ avatar?: AvatarProps
27
+ color?: SeparatorVariants['color']
28
+ size?: SeparatorVariants['size']
29
+ type?: SeparatorVariants['type']
30
+ /**
31
+ * The orientation of the separator.
32
+ * @defaultValue 'horizontal'
33
+ */
34
+ orientation?: _SeparatorProps['orientation']
35
+ class?: any
36
+ ui?: Partial<typeof separator.slots>
37
+ }
38
+
39
+ export interface SeparatorSlots {
40
+ default(props?: {}): any
41
+ }
7
42
  </script>
8
43
 
9
44
  <script setup lang="ts">
@@ -1,9 +1,21 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/skeleton";
5
- const appConfig = _appConfig;
6
- const skeleton = tv({ extend: tv(theme), ...appConfig.ui?.skeleton || {} });
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/skeleton'
6
+
7
+ const appConfig = _appConfig as AppConfig & { ui: { skeleton: Partial<typeof theme> } }
8
+
9
+ const skeleton = tv({ extend: tv(theme), ...(appConfig.ui?.skeleton || {}) })
10
+
11
+ export interface SkeletonProps {
12
+ /**
13
+ * The element or component this component should render as.
14
+ * @defaultValue 'div'
15
+ */
16
+ as?: any
17
+ class?: any
18
+ }
7
19
  </script>
8
20
 
9
21
  <script setup lang="ts">
@@ -1,9 +1,70 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/slideover";
5
- const appConfig = _appConfig;
6
- const slideover = tv({ extend: tv(theme), ...appConfig.ui?.slideover || {} });
1
+ <script lang="ts">
2
+ import { tv, type VariantProps } from 'tailwind-variants'
3
+ import type { DialogRootProps, DialogRootEmits, DialogContentProps } from 'radix-vue'
4
+ import type { AppConfig } from '@nuxt/schema'
5
+ import _appConfig from '#build/app.config'
6
+ import theme from '#build/ui/slideover'
7
+ import type { ButtonProps } from '../types'
8
+
9
+ const appConfig = _appConfig as AppConfig & { ui: { slideover: Partial<typeof theme> } }
10
+
11
+ const slideover = tv({ extend: tv(theme), ...(appConfig.ui?.slideover || {}) })
12
+
13
+ type SlideoverVariants = VariantProps<typeof slideover>
14
+
15
+ export interface SlideoverProps extends DialogRootProps {
16
+ title?: string
17
+ description?: string
18
+ /** The content of the slideover. */
19
+ content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'>
20
+ /**
21
+ * Render an overlay behind the slideover.
22
+ * @defaultValue true
23
+ */
24
+ overlay?: boolean
25
+ /**
26
+ * Animate the slideover when opening or closing.
27
+ * @defaultValue true
28
+ */
29
+ transition?: boolean
30
+ side?: SlideoverVariants['side']
31
+ /**
32
+ * Render the slideover in a portal.
33
+ * @defaultValue true
34
+ */
35
+ portal?: boolean
36
+ /**
37
+ * Display a close button to dismiss the slideover.
38
+ * `{ size: 'md', color: 'gray', variant: 'ghost' }`{lang="ts-type"}
39
+ * @defaultValue true
40
+ */
41
+ close?: ButtonProps | boolean
42
+ /**
43
+ * The icon displayed in the close button.
44
+ * @defaultValue appConfig.ui.icons.close
45
+ */
46
+ closeIcon?: string
47
+ /**
48
+ * When `true`, the slideover will not close when clicking outside.
49
+ * @defaultValue false
50
+ */
51
+ preventClose?: boolean
52
+ class?: any
53
+ ui?: Partial<typeof slideover.slots>
54
+ }
55
+
56
+ export interface SlideoverEmits extends DialogRootEmits {}
57
+
58
+ export interface SlideoverSlots {
59
+ default(props: { open: boolean }): any
60
+ content(props?: {}): any
61
+ header(props?: {}): any
62
+ title(props?: {}): any
63
+ description(props?: {}): any
64
+ close(props: { ui: any }): any
65
+ body(props?: {}): any
66
+ footer(props?: {}): any
67
+ }
7
68
  </script>
8
69
 
9
70
  <script setup lang="ts">
@@ -1,9 +1,39 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/slider";
5
- const appConfig = _appConfig;
6
- const slider = tv({ extend: tv(theme), ...appConfig.ui?.slider || {} });
1
+ <script lang="ts">
2
+ import { tv, type VariantProps } from 'tailwind-variants'
3
+ import type { SliderRootProps } from 'radix-vue'
4
+ import type { AppConfig } from '@nuxt/schema'
5
+ import _appConfig from '#build/app.config'
6
+ import theme from '#build/ui/slider'
7
+
8
+ const appConfig = _appConfig as AppConfig & { ui: { slider: Partial<typeof theme> } }
9
+
10
+ const slider = tv({ extend: tv(theme), ...(appConfig.ui?.slider || {}) })
11
+
12
+ type SliderVariants = VariantProps<typeof slider>
13
+
14
+ export interface SliderProps extends Pick<SliderRootProps, 'name' | 'disabled' | 'inverted' | 'min' | 'max' | 'step' | 'minStepsBetweenThumbs'> {
15
+ /**
16
+ * The element or component this component should render as.
17
+ * @defaultValue `div`
18
+ */
19
+ as?: any
20
+ size?: SliderVariants['size']
21
+ color?: SliderVariants['color']
22
+ /**
23
+ * The orientation of the slider.
24
+ * @defaultValue 'horizontal'
25
+ */
26
+ orientation?: SliderRootProps['orientation']
27
+ /** The value of the slider when initially rendered. Use when you do not need to control the state of the slider. */
28
+ defaultValue?: number | number[]
29
+ class?: any
30
+ ui?: Partial<typeof slider.slots>
31
+ }
32
+
33
+ export interface SliderEmits {
34
+ (e: 'update:modelValue', payload: number | number[]): void
35
+ (e: 'change', payload: Event): void
36
+ }
7
37
  </script>
8
38
 
9
39
  <script setup lang="ts">
@@ -1,9 +1,53 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/switch";
5
- const appConfig = _appConfig;
6
- const switchTv = tv({ extend: tv(theme), ...appConfig.ui?.switch || {} });
1
+ <script lang="ts">
2
+ import { tv, type VariantProps } from 'tailwind-variants'
3
+ import type { SwitchRootProps } from 'radix-vue'
4
+ import type { AppConfig } from '@nuxt/schema'
5
+ import _appConfig from '#build/app.config'
6
+ import theme from '#build/ui/switch'
7
+ import type { PartialString } from '../types/utils'
8
+
9
+ const appConfig = _appConfig as AppConfig & { ui: { switch: Partial<typeof theme> } }
10
+
11
+ const switchTv = tv({ extend: tv(theme), ...(appConfig.ui?.switch || {}) })
12
+
13
+ type SwitchVariants = VariantProps<typeof switchTv>
14
+
15
+ export interface SwitchProps extends Pick<SwitchRootProps, 'disabled' | 'id' | 'name' | 'required' | 'value'> {
16
+ /**
17
+ * The element or component this component should render as.
18
+ * @defaultValue `div`
19
+ */
20
+ as?: any
21
+ color?: SwitchVariants['color']
22
+ size?: SwitchVariants['size']
23
+ /** When `true`, the loading icon will be displayed. */
24
+ loading?: boolean
25
+ /**
26
+ * The icon when the `loading` prop is `true`.
27
+ * @defaultValue appConfig.ui.icons.loading
28
+ */
29
+ loadingIcon?: string
30
+ /** Display an icon when the switch is checked. */
31
+ checkedIcon?: string
32
+ /** Display an icon when the switch is unchecked. */
33
+ uncheckedIcon?: string
34
+ label?: string
35
+ description?: string
36
+ /** The state of the switch when it is initially rendered. Use when you do not need to control its state. */
37
+ defaultValue?: boolean
38
+ class?: any
39
+ ui?: PartialString<typeof switchTv.slots>
40
+ }
41
+
42
+ export interface SwitchEmits {
43
+ (e: 'update:modelValue', payload: boolean): void
44
+ (e: 'change', payload: Event): void
45
+ }
46
+
47
+ export interface SwitchSlots {
48
+ label(props: { label?: string }): any
49
+ description(props: { description?: string }): any
50
+ }
7
51
  </script>
8
52
 
9
53
  <script setup lang="ts">
@@ -1,9 +1,62 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/tabs";
5
- const appConfig = _appConfig;
6
- const tabs = tv({ extend: tv(theme), ...appConfig.ui?.tabs || {} });
1
+ <script lang="ts">
2
+ import { tv, type VariantProps } from 'tailwind-variants'
3
+ import type { TabsRootProps, TabsRootEmits, TabsContentProps, TabsTriggerProps } from 'radix-vue'
4
+ import type { AppConfig } from '@nuxt/schema'
5
+ import _appConfig from '#build/app.config'
6
+ import theme from '#build/ui/tabs'
7
+ import type { AvatarProps } from '../types'
8
+ import type { DynamicSlots, PartialString } from '../types/utils'
9
+
10
+ const appConfig = _appConfig as AppConfig & { ui: { tabs: Partial<typeof theme> } }
11
+
12
+ const tabs = tv({ extend: tv(theme), ...(appConfig.ui?.tabs || {}) })
13
+
14
+ export interface TabsItem extends Pick<TabsTriggerProps, 'disabled'> {
15
+ label?: string
16
+ icon?: string
17
+ avatar?: AvatarProps
18
+ slot?: string
19
+ content?: string
20
+ /** A unique value for the tab item. Defaults to the index. */
21
+ value?: string | number
22
+ }
23
+
24
+ type TabsVariants = VariantProps<typeof tabs>
25
+
26
+ export interface TabsProps<T> extends Pick<TabsRootProps<string | number>, 'defaultValue' | 'modelValue' | 'activationMode'> {
27
+ /**
28
+ * The element or component this component should render as.
29
+ * @defaultValue 'div'
30
+ */
31
+ as?: any
32
+ items?: T[]
33
+ color?: TabsVariants['color']
34
+ variant?: TabsVariants['variant']
35
+ size?: TabsVariants['size']
36
+ /**
37
+ * The orientation of the tabs.
38
+ * @defaultValue 'horizontal'
39
+ */
40
+ orientation?: TabsRootProps['orientation']
41
+ /**
42
+ * The content of the tabs, can be disabled to prevent rendering the content.
43
+ * @defaultValue true
44
+ */
45
+ content?: boolean | Omit<TabsContentProps, 'as' | 'asChild' | 'value'>
46
+ class?: any
47
+ ui?: PartialString<typeof tabs.slots>
48
+ }
49
+
50
+ export interface TabsEmits extends TabsRootEmits<string | number> {}
51
+
52
+ type SlotProps<T> = (props: { item: T, index: number }) => any
53
+
54
+ export type TabsSlots<T extends { slot?: string }> = {
55
+ leading: SlotProps<T>
56
+ default: SlotProps<T>
57
+ trailing: SlotProps<T>
58
+ content: SlotProps<T>
59
+ } & DynamicSlots<T, SlotProps<T>>
7
60
  </script>
8
61
 
9
62
  <script setup lang="ts" generic="T extends TabsItem">
@@ -1,9 +1,45 @@
1
- <script>
2
- import { tv } from "tailwind-variants";
3
- import _appConfig from "#build/app.config";
4
- import theme from "#build/ui/textarea";
5
- const appConfig = _appConfig;
6
- const textarea = tv({ extend: tv(theme), ...appConfig.ui?.textarea || {} });
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/textarea'
6
+
7
+ const appConfig = _appConfig as AppConfig & { ui: { textarea: Partial<typeof theme> } }
8
+
9
+ const textarea = tv({ extend: tv(theme), ...(appConfig.ui?.textarea || {}) })
10
+
11
+ type TextareaVariants = VariantProps<typeof textarea>
12
+
13
+ export interface TextareaProps {
14
+ id?: string
15
+ name?: string
16
+ /** The placeholder text when the textarea is empty. */
17
+ placeholder?: string
18
+ color?: TextareaVariants['color']
19
+ variant?: TextareaVariants['variant']
20
+ size?: TextareaVariants['size']
21
+ required?: boolean
22
+ autofocus?: boolean
23
+ autofocusDelay?: number
24
+ disabled?: boolean
25
+ class?: any
26
+ rows?: number
27
+ maxrows?: number
28
+ autoresize?: boolean
29
+ /** Highlight the ring color like a focus state. */
30
+ highlight?: boolean
31
+ ui?: Partial<typeof textarea.slots>
32
+ }
33
+
34
+ export interface TextareaEmits {
35
+ (e: 'update:modelValue', payload: string | number): void
36
+ (e: 'blur', event: FocusEvent): void
37
+ (e: 'change', event: Event): void
38
+ }
39
+
40
+ export interface TextareaSlots {
41
+ default(props?: {}): any
42
+ }
7
43
  </script>
8
44
 
9
45
  <script setup lang="ts">
@@ -96,6 +132,8 @@ function autoResize() {
96
132
  }
97
133
 
98
134
  textareaRef.value.rows = props.rows
135
+ const overflow = textareaRef.value.style.overflow
136
+ textareaRef.value.style.overflow = 'hidden'
99
137
 
100
138
  const styles = window.getComputedStyle(textareaRef.value)
101
139
  const paddingTop = Number.parseInt(styles.paddingTop)
@@ -108,6 +146,8 @@ function autoResize() {
108
146
  if (newRows > props.rows) {
109
147
  textareaRef.value.rows = props.maxrows ? Math.min(newRows, props.maxrows) : newRows
110
148
  }
149
+
150
+ textareaRef.value.style.overflow = overflow
111
151
  }
112
152
  }
113
153