@nuxt/ui 3.0.2 → 3.1.0

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 (220) hide show
  1. package/.nuxt/ui/accordion.ts +25 -4
  2. package/.nuxt/ui/alert.ts +52 -31
  3. package/.nuxt/ui/avatar-group.ts +24 -3
  4. package/.nuxt/ui/avatar.ts +26 -5
  5. package/.nuxt/ui/badge.ts +56 -35
  6. package/.nuxt/ui/breadcrumb.ts +28 -7
  7. package/.nuxt/ui/button-group.ts +23 -2
  8. package/.nuxt/ui/button.ts +66 -45
  9. package/.nuxt/ui/calendar.ts +39 -18
  10. package/.nuxt/ui/card.ts +28 -7
  11. package/.nuxt/ui/carousel.ts +29 -8
  12. package/.nuxt/ui/checkbox-group.ts +82 -0
  13. package/.nuxt/ui/checkbox.ts +163 -29
  14. package/.nuxt/ui/chip.ts +31 -10
  15. package/.nuxt/ui/collapsible.ts +23 -2
  16. package/.nuxt/ui/color-picker.ts +26 -5
  17. package/.nuxt/ui/command-palette.ts +37 -16
  18. package/.nuxt/ui/container.ts +23 -2
  19. package/.nuxt/ui/context-menu.ts +56 -35
  20. package/.nuxt/ui/drawer.ts +33 -12
  21. package/.nuxt/ui/dropdown-menu.ts +57 -36
  22. package/.nuxt/ui/form-field.ts +29 -8
  23. package/.nuxt/ui/form.ts +23 -2
  24. package/.nuxt/ui/index.ts +1 -0
  25. package/.nuxt/ui/input-menu.ts +65 -44
  26. package/.nuxt/ui/input-number.ts +43 -22
  27. package/.nuxt/ui/input.ts +46 -25
  28. package/.nuxt/ui/kbd.ts +27 -6
  29. package/.nuxt/ui/link.ts +26 -5
  30. package/.nuxt/ui/modal.ts +28 -7
  31. package/.nuxt/ui/navigation-menu.ts +102 -83
  32. package/.nuxt/ui/pagination.ts +23 -2
  33. package/.nuxt/ui/pin-input.ts +43 -22
  34. package/.nuxt/ui/popover.ts +25 -4
  35. package/.nuxt/ui/progress.ts +40 -19
  36. package/.nuxt/ui/radio-group.ts +273 -37
  37. package/.nuxt/ui/select-menu.ts +59 -35
  38. package/.nuxt/ui/select.ts +55 -34
  39. package/.nuxt/ui/separator.ts +31 -10
  40. package/.nuxt/ui/skeleton.ts +24 -3
  41. package/.nuxt/ui/slideover.ts +27 -6
  42. package/.nuxt/ui/slider.ts +39 -18
  43. package/.nuxt/ui/stepper.ts +41 -20
  44. package/.nuxt/ui/switch.ts +43 -22
  45. package/.nuxt/ui/table.ts +38 -17
  46. package/.nuxt/ui/tabs.ts +55 -34
  47. package/.nuxt/ui/textarea.ts +63 -37
  48. package/.nuxt/ui/toast.ts +47 -26
  49. package/.nuxt/ui/toaster.ts +23 -2
  50. package/.nuxt/ui/tooltip.ts +25 -4
  51. package/.nuxt/ui/tree.ts +41 -20
  52. package/.nuxt/ui.css +56 -12
  53. package/README.md +11 -0
  54. package/cli/templates.mjs +18 -17
  55. package/dist/module.json +5 -5
  56. package/dist/module.mjs +11 -7
  57. package/dist/runtime/components/Accordion.vue +36 -93
  58. package/dist/runtime/components/Accordion.vue.d.ts +91 -0
  59. package/dist/runtime/components/Alert.vue +37 -100
  60. package/dist/runtime/components/Alert.vue.d.ts +96 -0
  61. package/dist/runtime/components/App.vue +28 -34
  62. package/dist/runtime/components/App.vue.d.ts +24 -0
  63. package/dist/runtime/components/Avatar.vue +42 -75
  64. package/dist/runtime/components/Avatar.vue.d.ts +60 -0
  65. package/dist/runtime/components/AvatarGroup.vue +40 -77
  66. package/dist/runtime/components/AvatarGroup.vue.d.ts +40 -0
  67. package/dist/runtime/components/Badge.vue +33 -62
  68. package/dist/runtime/components/Badge.vue.d.ts +62 -0
  69. package/dist/runtime/components/Breadcrumb.vue +37 -90
  70. package/dist/runtime/components/Breadcrumb.vue.d.ts +82 -0
  71. package/dist/runtime/components/Button.vue +95 -104
  72. package/dist/runtime/components/Button.vue.d.ts +73 -0
  73. package/dist/runtime/components/ButtonGroup.vue +20 -46
  74. package/dist/runtime/components/ButtonGroup.vue.d.ts +55 -0
  75. package/dist/runtime/components/Calendar.vue +67 -150
  76. package/dist/runtime/components/Calendar.vue.d.ts +107 -0
  77. package/dist/runtime/components/Card.vue +18 -40
  78. package/dist/runtime/components/Card.vue.d.ts +38 -0
  79. package/dist/runtime/components/Carousel.vue +112 -234
  80. package/dist/runtime/components/Carousel.vue.d.ts +120 -0
  81. package/dist/runtime/components/Checkbox.vue +52 -93
  82. package/dist/runtime/components/Checkbox.vue.d.ts +76 -0
  83. package/dist/runtime/components/CheckboxGroup.vue +121 -0
  84. package/dist/runtime/components/CheckboxGroup.vue.d.ts +75 -0
  85. package/dist/runtime/components/Chip.vue +26 -69
  86. package/dist/runtime/components/Chip.vue.d.ts +71 -0
  87. package/dist/runtime/components/Collapsible.vue +22 -41
  88. package/dist/runtime/components/Collapsible.vue.d.ts +50 -0
  89. package/dist/runtime/components/ColorPicker.vue +111 -197
  90. package/dist/runtime/components/ColorPicker.vue.d.ts +63 -0
  91. package/dist/runtime/components/CommandPalette.vue +96 -237
  92. package/dist/runtime/components/CommandPalette.vue.d.ts +173 -0
  93. package/dist/runtime/components/Container.vue +15 -28
  94. package/dist/runtime/components/Container.vue.d.ts +27 -0
  95. package/dist/runtime/components/ContextMenu.vue +34 -133
  96. package/dist/runtime/components/ContextMenu.vue.d.ts +127 -0
  97. package/dist/runtime/components/ContextMenuContent.vue +73 -81
  98. package/dist/runtime/components/ContextMenuContent.vue.d.ts +105 -0
  99. package/dist/runtime/components/Drawer.vue +49 -83
  100. package/dist/runtime/components/Drawer.vue.d.ts +88 -0
  101. package/dist/runtime/components/DropdownMenu.vue +39 -142
  102. package/dist/runtime/components/DropdownMenu.vue.d.ts +141 -0
  103. package/dist/runtime/components/DropdownMenuContent.vue +78 -88
  104. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +55 -0
  105. package/dist/runtime/components/Form.vue +135 -220
  106. package/dist/runtime/components/Form.vue.d.ts +66 -0
  107. package/dist/runtime/components/FormField.vue +35 -77
  108. package/dist/runtime/components/FormField.vue.d.ts +70 -0
  109. package/dist/runtime/components/Icon.vue +12 -19
  110. package/dist/runtime/components/Icon.vue.d.ts +17 -0
  111. package/dist/runtime/components/Input.vue +82 -140
  112. package/dist/runtime/components/Input.vue.d.ts +91 -0
  113. package/dist/runtime/components/InputMenu.vue +185 -332
  114. package/dist/runtime/components/InputMenu.vue.d.ts +312 -0
  115. package/dist/runtime/components/InputNumber.vue +71 -133
  116. package/dist/runtime/components/InputNumber.vue.d.ts +193 -0
  117. package/dist/runtime/components/Kbd.vue +20 -46
  118. package/dist/runtime/components/Kbd.vue.d.ts +55 -0
  119. package/dist/runtime/components/Link.vue +98 -176
  120. package/dist/runtime/components/Link.vue.d.ts +124 -0
  121. package/dist/runtime/components/LinkBase.vue +33 -42
  122. package/dist/runtime/components/LinkBase.vue.d.ts +48 -0
  123. package/dist/runtime/components/Modal.vue +53 -116
  124. package/dist/runtime/components/Modal.vue.d.ts +109 -0
  125. package/dist/runtime/components/NavigationMenu.vue +77 -209
  126. package/dist/runtime/components/NavigationMenu.vue.d.ts +159 -0
  127. package/dist/runtime/components/OverlayProvider.vue +14 -18
  128. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
  129. package/dist/runtime/components/Pagination.vue +46 -140
  130. package/dist/runtime/components/Pagination.vue.d.ts +143 -0
  131. package/dist/runtime/components/PinInput.vue +61 -78
  132. package/dist/runtime/components/PinInput.vue.d.ts +68 -0
  133. package/dist/runtime/components/Popover.vue +47 -84
  134. package/dist/runtime/components/Popover.vue.d.ts +80 -0
  135. package/dist/runtime/components/Progress.vue +70 -131
  136. package/dist/runtime/components/Progress.vue.d.ts +97 -0
  137. package/dist/runtime/components/RadioGroup.vue +70 -132
  138. package/dist/runtime/components/RadioGroup.vue.d.ts +88 -0
  139. package/dist/runtime/components/Select.vue +110 -224
  140. package/dist/runtime/components/Select.vue.d.ts +139 -0
  141. package/dist/runtime/components/SelectMenu.vue +161 -310
  142. package/dist/runtime/components/SelectMenu.vue.d.ts +184 -0
  143. package/dist/runtime/components/Separator.vue +29 -71
  144. package/dist/runtime/components/Separator.vue.d.ts +75 -0
  145. package/dist/runtime/components/Skeleton.vue +21 -23
  146. package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
  147. package/dist/runtime/components/Slideover.vue +53 -120
  148. package/dist/runtime/components/Slideover.vue.d.ts +111 -0
  149. package/dist/runtime/components/Slider.vue +46 -84
  150. package/dist/runtime/components/Slider.vue.d.ts +71 -0
  151. package/dist/runtime/components/Stepper.vue +45 -115
  152. package/dist/runtime/components/Stepper.vue.d.ts +89 -0
  153. package/dist/runtime/components/Switch.vue +45 -93
  154. package/dist/runtime/components/Switch.vue.d.ts +73 -0
  155. package/dist/runtime/components/Table.vue +163 -267
  156. package/dist/runtime/components/Table.vue.d.ts +183 -0
  157. package/dist/runtime/components/Tabs.vue +41 -107
  158. package/dist/runtime/components/Tabs.vue.d.ts +104 -0
  159. package/dist/runtime/components/Textarea.vue +113 -158
  160. package/dist/runtime/components/Textarea.vue.d.ts +95 -0
  161. package/dist/runtime/components/Toast.vue +49 -110
  162. package/dist/runtime/components/Toast.vue.d.ts +95 -0
  163. package/dist/runtime/components/Toaster.vue +70 -107
  164. package/dist/runtime/components/Toaster.vue.d.ts +63 -0
  165. package/dist/runtime/components/Tooltip.vue +38 -65
  166. package/dist/runtime/components/Tooltip.vue.d.ts +65 -0
  167. package/dist/runtime/components/Tree.vue +59 -166
  168. package/dist/runtime/components/Tree.vue.d.ts +128 -0
  169. package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
  170. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  171. package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
  172. package/dist/runtime/composables/useFormField.d.ts +2 -2
  173. package/dist/runtime/composables/useOverlay.d.ts +14 -7
  174. package/dist/runtime/composables/useOverlay.js +14 -6
  175. package/dist/runtime/composables/usePortal.d.ts +6 -0
  176. package/dist/runtime/composables/usePortal.js +17 -0
  177. package/dist/runtime/index.css +1 -1
  178. package/dist/runtime/inertia/components/Link.vue +146 -0
  179. package/dist/runtime/inertia/components/Link.vue.d.ts +92 -0
  180. package/dist/runtime/inertia/stubs.d.ts +43 -0
  181. package/dist/runtime/inertia/stubs.js +82 -0
  182. package/dist/runtime/locale/bg.d.ts +3 -0
  183. package/dist/runtime/locale/bg.js +54 -0
  184. package/dist/runtime/locale/index.d.ts +5 -1
  185. package/dist/runtime/locale/index.js +5 -1
  186. package/dist/runtime/locale/kk.d.ts +3 -0
  187. package/dist/runtime/locale/kk.js +54 -0
  188. package/dist/runtime/locale/tj.d.ts +3 -0
  189. package/dist/runtime/locale/tj.js +54 -0
  190. package/dist/runtime/locale/ug_cn.d.ts +3 -0
  191. package/dist/runtime/locale/ug_cn.js +55 -0
  192. package/dist/runtime/types/form.d.ts +4 -1
  193. package/dist/runtime/types/index.d.ts +1 -0
  194. package/dist/runtime/types/index.js +1 -0
  195. package/dist/runtime/types/utils.d.ts +47 -7
  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 +14 -0
  201. package/dist/runtime/vue/components/Link.vue +118 -202
  202. package/dist/runtime/vue/components/Link.vue.d.ts +124 -0
  203. package/dist/runtime/vue/stubs.d.ts +2 -2
  204. package/dist/shared/{ui.BkNUP964.mjs → ui.D7lOOabO.mjs} +621 -362
  205. package/dist/types.d.mts +3 -5
  206. package/dist/unplugin.d.mts +4 -0
  207. package/dist/unplugin.mjs +25 -4
  208. package/dist/vite.mjs +1 -1
  209. package/package.json +94 -53
  210. package/dist/module.cjs +0 -62
  211. package/dist/module.d.cts +0 -45
  212. package/dist/module.d.ts +0 -45
  213. package/dist/shared/ui.BL-XB3u1.cjs +0 -3555
  214. package/dist/types.d.ts +0 -7
  215. package/dist/unplugin.cjs +0 -232
  216. package/dist/unplugin.d.cts +0 -62
  217. package/dist/unplugin.d.ts +0 -62
  218. package/dist/vite.cjs +0 -23
  219. package/dist/vite.d.cts +0 -15
  220. package/dist/vite.d.ts +0 -15
@@ -1,101 +1,60 @@
1
- <script lang="ts">
2
- import type { VariantProps } from 'tailwind-variants'
3
- import type { CheckboxRootProps } from 'reka-ui'
4
- import type { AppConfig } from '@nuxt/schema'
5
- import _appConfig from '#build/app.config'
6
- import theme from '#build/ui/checkbox'
7
- import { tv } from '../utils/tv'
8
-
9
- const appConfigCheckbox = _appConfig as AppConfig & { ui: { checkbox: Partial<typeof theme> } }
10
-
11
- const checkbox = tv({ extend: tv(theme), ...(appConfigCheckbox.ui?.checkbox || {}) })
12
-
13
- type CheckboxVariants = VariantProps<typeof checkbox>
14
-
15
- export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id' | 'defaultValue'> {
16
- /**
17
- * The element or component this component should render as.
18
- * @defaultValue 'div'
19
- */
20
- as?: any
21
- label?: string
22
- description?: string
23
- /**
24
- * @defaultValue 'primary'
25
- */
26
- color?: CheckboxVariants['color']
27
- /**
28
- * @defaultValue 'md'
29
- */
30
- size?: CheckboxVariants['size']
31
- /**
32
- * The icon displayed when checked.
33
- * @defaultValue appConfig.ui.icons.check
34
- * @IconifyIcon
35
- */
36
- icon?: string
37
- /**
38
- * The icon displayed when the checkbox is indeterminate.
39
- * @defaultValue appConfig.ui.icons.minus
40
- * @IconifyIcon
41
- */
42
- indeterminateIcon?: string
43
- class?: any
44
- ui?: Partial<typeof checkbox.slots>
45
- }
46
-
47
- export type CheckboxEmits = {
48
- change: [payload: Event]
49
- }
50
-
51
- export interface CheckboxSlots {
52
- label(props: { label?: string }): any
53
- description(props: { description?: string }): any
54
- }
1
+ <script>
2
+ import theme from "#build/ui/checkbox";
55
3
  </script>
56
4
 
57
- <script setup lang="ts">
58
- import { computed, useId } from 'vue'
59
- import { Primitive, CheckboxRoot, CheckboxIndicator, Label, useForwardProps } from 'reka-ui'
60
- import { reactivePick } from '@vueuse/core'
61
- import { useAppConfig } from '#imports'
62
- import { useFormField } from '../composables/useFormField'
63
- import UIcon from './Icon.vue'
64
-
65
- defineOptions({ inheritAttrs: false })
66
-
67
- const props = defineProps<CheckboxProps>()
68
- const slots = defineSlots<CheckboxSlots>()
69
- const emits = defineEmits<CheckboxEmits>()
70
-
71
- const modelValue = defineModel<boolean | 'indeterminate'>({ default: undefined })
72
-
73
- const rootProps = useForwardProps(reactivePick(props, 'required', 'value', 'defaultValue'))
74
-
75
- const appConfig = useAppConfig()
76
- const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField<CheckboxProps>(props)
77
- const id = _id.value ?? useId()
78
-
79
- const ui = computed(() => checkbox({
5
+ <script setup>
6
+ import { computed, useId } from "vue";
7
+ import { Primitive, CheckboxRoot, CheckboxIndicator, Label, useForwardProps } from "reka-ui";
8
+ import { reactivePick } from "@vueuse/core";
9
+ import { useAppConfig } from "#imports";
10
+ import { useFormField } from "../composables/useFormField";
11
+ import { tv } from "../utils/tv";
12
+ import UIcon from "./Icon.vue";
13
+ defineOptions({ inheritAttrs: false });
14
+ const props = defineProps({
15
+ as: { type: null, required: false },
16
+ label: { type: String, required: false },
17
+ description: { type: String, required: false },
18
+ color: { type: null, required: false },
19
+ variant: { type: null, required: false },
20
+ size: { type: null, required: false },
21
+ indicator: { type: null, required: false },
22
+ icon: { type: String, required: false },
23
+ indeterminateIcon: { type: String, required: false },
24
+ class: { type: null, required: false },
25
+ ui: { type: null, required: false },
26
+ disabled: { type: Boolean, required: false },
27
+ required: { type: Boolean, required: false },
28
+ name: { type: String, required: false },
29
+ value: { type: [String, Number, Object, null], required: false },
30
+ id: { type: String, required: false },
31
+ defaultValue: { type: [Boolean, String], required: false }
32
+ });
33
+ const slots = defineSlots();
34
+ const emits = defineEmits(["change"]);
35
+ const modelValue = defineModel({ type: [Boolean, String], ...{ default: void 0 } });
36
+ const appConfig = useAppConfig();
37
+ const rootProps = useForwardProps(reactivePick(props, "required", "value", "defaultValue"));
38
+ const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField(props);
39
+ const id = _id.value ?? useId();
40
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.checkbox || {} })({
80
41
  size: size.value,
81
42
  color: color.value,
43
+ variant: props.variant,
44
+ indicator: props.indicator,
82
45
  required: props.required,
83
- disabled: disabled.value,
84
- checked: Boolean(modelValue.value ?? props.defaultValue)
85
- }))
86
-
87
- function onUpdate(value: any) {
88
- // @ts-expect-error - 'target' does not exist in type 'EventInit'
89
- const event = new Event('change', { target: { value } })
90
- emits('change', event)
91
- emitFormChange()
92
- emitFormInput()
46
+ disabled: disabled.value
47
+ }));
48
+ function onUpdate(value) {
49
+ const event = new Event("change", { target: { value } });
50
+ emits("change", event);
51
+ emitFormChange();
52
+ emitFormInput();
93
53
  }
94
54
  </script>
95
55
 
96
- <!-- eslint-disable vue/no-template-shadow -->
97
56
  <template>
98
- <Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
57
+ <Primitive :as="variant === 'list' ? as : Label" :class="ui.root({ class: [props.class, props.ui?.root] })">
99
58
  <div :class="ui.container({ class: props.ui?.container })">
100
59
  <CheckboxRoot
101
60
  :id="id"
@@ -107,7 +66,7 @@ function onUpdate(value: any) {
107
66
  @update:model-value="onUpdate"
108
67
  >
109
68
  <template #default="{ modelValue }">
110
- <CheckboxIndicator as-child>
69
+ <CheckboxIndicator :class="ui.indicator({ class: props.ui?.indicator })">
111
70
  <UIcon v-if="modelValue === 'indeterminate'" :name="indeterminateIcon || appConfig.ui.icons.minus" :class="ui.icon({ class: props.ui?.icon })" />
112
71
  <UIcon v-else :name="icon || appConfig.ui.icons.check" :class="ui.icon({ class: props.ui?.icon })" />
113
72
  </CheckboxIndicator>
@@ -115,12 +74,12 @@ function onUpdate(value: any) {
115
74
  </CheckboxRoot>
116
75
  </div>
117
76
 
118
- <div v-if="(label || !!slots.label) || (description || !!slots.description)" :class="ui.wrapper({ class: props.ui?.wrapper })">
119
- <Label v-if="label || !!slots.label" :for="id" :class="ui.label({ class: props.ui?.label })">
77
+ <div v-if="label || !!slots.label || (description || !!slots.description)" :class="ui.wrapper({ class: props.ui?.wrapper })">
78
+ <component :is="variant === 'list' ? Label : 'p'" v-if="label || !!slots.label" :for="id" :class="ui.label({ class: props.ui?.label })">
120
79
  <slot name="label" :label="label">
121
80
  {{ label }}
122
81
  </slot>
123
- </Label>
82
+ </component>
124
83
  <p v-if="description || !!slots.description" :class="ui.description({ class: props.ui?.description })">
125
84
  <slot name="description" :description="description">
126
85
  {{ description }}
@@ -0,0 +1,76 @@
1
+ import type { CheckboxRootProps } from 'reka-ui';
2
+ import type { AppConfig } from '@nuxt/schema';
3
+ import theme from '#build/ui/checkbox';
4
+ import type { ComponentConfig } from '../types/utils';
5
+ type Checkbox = ComponentConfig<typeof theme, AppConfig, 'checkbox'>;
6
+ export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id' | 'defaultValue'> {
7
+ /**
8
+ * The element or component this component should render as.
9
+ * @defaultValue 'div'
10
+ */
11
+ as?: any;
12
+ label?: string;
13
+ description?: string;
14
+ /**
15
+ * @defaultValue 'primary'
16
+ */
17
+ color?: Checkbox['variants']['color'];
18
+ /**
19
+ * @defaultValue 'list'
20
+ */
21
+ variant?: Checkbox['variants']['variant'];
22
+ /**
23
+ * @defaultValue 'md'
24
+ */
25
+ size?: Checkbox['variants']['size'];
26
+ /**
27
+ * Position of the indicator.
28
+ * @defaultValue 'start'
29
+ */
30
+ indicator?: Checkbox['variants']['indicator'];
31
+ /**
32
+ * The icon displayed when checked.
33
+ * @defaultValue appConfig.ui.icons.check
34
+ * @IconifyIcon
35
+ */
36
+ icon?: string;
37
+ /**
38
+ * The icon displayed when the checkbox is indeterminate.
39
+ * @defaultValue appConfig.ui.icons.minus
40
+ * @IconifyIcon
41
+ */
42
+ indeterminateIcon?: string;
43
+ class?: any;
44
+ ui?: Checkbox['slots'];
45
+ }
46
+ export type CheckboxEmits = {
47
+ change: [payload: Event];
48
+ };
49
+ export interface CheckboxSlots {
50
+ label(props: {
51
+ label?: string;
52
+ }): any;
53
+ description(props: {
54
+ description?: string;
55
+ }): any;
56
+ }
57
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
58
+ modelValue?: boolean | "indeterminate";
59
+ } & CheckboxProps>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
60
+ modelValue?: boolean | "indeterminate";
61
+ } & CheckboxProps>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<CheckboxSlots> & CheckboxSlots>;
62
+ export default _default;
63
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
64
+ type __VLS_TypePropsToOption<T> = {
65
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
66
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
67
+ } : {
68
+ type: import('vue').PropType<T[K]>;
69
+ required: true;
70
+ };
71
+ };
72
+ type __VLS_WithTemplateSlots<T, S> = T & {
73
+ new (): {
74
+ $slots: S;
75
+ };
76
+ };
@@ -0,0 +1,121 @@
1
+ <script>
2
+ import theme from "#build/ui/checkbox-group";
3
+ </script>
4
+
5
+ <script setup>
6
+ import { computed, useId } from "vue";
7
+ import { CheckboxGroupRoot, useForwardProps, useForwardPropsEmits } from "reka-ui";
8
+ import { reactivePick } from "@vueuse/core";
9
+ import { useAppConfig } from "#imports";
10
+ import { useFormField } from "../composables/useFormField";
11
+ import { get, omit } from "../utils";
12
+ import { tv } from "../utils/tv";
13
+ const props = defineProps({
14
+ as: { type: null, required: false },
15
+ legend: { type: String, required: false },
16
+ valueKey: { type: String, required: false, default: "value" },
17
+ labelKey: { type: String, required: false, default: "label" },
18
+ descriptionKey: { type: String, required: false, default: "description" },
19
+ items: { type: Array, required: false },
20
+ size: { type: null, required: false },
21
+ orientation: { type: null, required: false, default: "vertical" },
22
+ class: { type: null, required: false },
23
+ ui: { type: void 0, required: false },
24
+ defaultValue: { type: Array, required: false },
25
+ disabled: { type: Boolean, required: false },
26
+ loop: { type: Boolean, required: false },
27
+ modelValue: { type: Array, required: false },
28
+ name: { type: String, required: false },
29
+ required: { type: Boolean, required: false },
30
+ color: { type: null, required: false },
31
+ variant: { type: null, required: false },
32
+ indicator: { type: null, required: false },
33
+ icon: { type: String, required: false }
34
+ });
35
+ const emits = defineEmits(["update:modelValue", "change"]);
36
+ const slots = defineSlots();
37
+ const appConfig = useAppConfig();
38
+ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "orientation", "loop", "required"), emits);
39
+ const checkboxProps = useForwardProps(reactivePick(props, "variant", "indicator", "icon"));
40
+ const proxySlots = omit(slots, ["legend"]);
41
+ const { emitFormChange, emitFormInput, color, name, size, id: _id, disabled, ariaAttrs } = useFormField(props, { bind: false });
42
+ const id = _id.value ?? useId();
43
+ const ui = computed(() => tv({ extend: theme, ...appConfig.ui?.checkboxGroup || {} })({
44
+ size: size.value,
45
+ required: props.required,
46
+ orientation: props.orientation
47
+ }));
48
+ function normalizeItem(item) {
49
+ if (item === null) {
50
+ return {
51
+ id: `${id}:null`,
52
+ value: void 0,
53
+ label: void 0
54
+ };
55
+ }
56
+ if (typeof item === "string" || typeof item === "number") {
57
+ return {
58
+ id: `${id}:${item}`,
59
+ value: String(item),
60
+ label: String(item)
61
+ };
62
+ }
63
+ const value = get(item, props.valueKey);
64
+ const label = get(item, props.labelKey);
65
+ const description = get(item, props.descriptionKey);
66
+ return {
67
+ ...item,
68
+ value,
69
+ label,
70
+ description,
71
+ id: `${id}:${value}`
72
+ };
73
+ }
74
+ const normalizedItems = computed(() => {
75
+ if (!props.items) {
76
+ return [];
77
+ }
78
+ return props.items.map(normalizeItem);
79
+ });
80
+ function onUpdate(value) {
81
+ const event = new Event("change", { target: { value } });
82
+ emits("change", event);
83
+ emitFormChange();
84
+ emitFormInput();
85
+ }
86
+ </script>
87
+
88
+ <template>
89
+ <CheckboxGroupRoot
90
+ :id="id"
91
+ v-bind="rootProps"
92
+ :name="name"
93
+ :disabled="disabled"
94
+ :class="ui.root({ class: [props.class, props.ui?.root] })"
95
+ @update:model-value="onUpdate"
96
+ >
97
+ <fieldset :class="ui.fieldset({ class: props.ui?.fieldset })" v-bind="ariaAttrs">
98
+ <legend v-if="legend || !!slots.legend" :class="ui.legend({ class: props.ui?.legend })">
99
+ <slot name="legend">
100
+ {{ legend }}
101
+ </slot>
102
+ </legend>
103
+
104
+ <UCheckbox
105
+ v-for="item in normalizedItems"
106
+ :key="item.value"
107
+ v-bind="{ ...item, ...checkboxProps }"
108
+ :color="color"
109
+ :size="size"
110
+ :name="name"
111
+ :disabled="item.disabled || disabled"
112
+ :ui="props.ui ? omit(props.ui, ['root']) : void 0"
113
+ :class="ui.item({ class: props.ui?.item })"
114
+ >
115
+ <template v-for="(_, name) in proxySlots" #[name]>
116
+ <slot :name="name" :item="item" />
117
+ </template>
118
+ </UCheckbox>
119
+ </fieldset>
120
+ </CheckboxGroupRoot>
121
+ </template>
@@ -0,0 +1,75 @@
1
+ import type { CheckboxGroupRootProps, CheckboxGroupRootEmits } from 'reka-ui';
2
+ import type { AppConfig } from '@nuxt/schema';
3
+ import theme from '#build/ui/checkbox-group';
4
+ import type { CheckboxProps } from '../types';
5
+ import type { AcceptableValue, ComponentConfig } from '../types/utils';
6
+ type CheckboxGroup = ComponentConfig<typeof theme, AppConfig, 'checkboxGroup'>;
7
+ export type CheckboxGroupValue = AcceptableValue;
8
+ export type CheckboxGroupItem = {
9
+ label?: string;
10
+ description?: string;
11
+ disabled?: boolean;
12
+ value?: string;
13
+ [key: string]: any;
14
+ } | CheckboxGroupValue;
15
+ export interface CheckboxGroupProps<T extends CheckboxGroupItem = CheckboxGroupItem> extends Pick<CheckboxGroupRootProps, 'defaultValue' | 'disabled' | 'loop' | 'modelValue' | 'name' | 'required'>, Pick<CheckboxProps, 'color' | 'variant' | 'indicator' | 'icon'> {
16
+ /**
17
+ * The element or component this component should render as.
18
+ * @defaultValue 'div'
19
+ */
20
+ as?: any;
21
+ legend?: string;
22
+ /**
23
+ * When `items` is an array of objects, select the field to use as the value.
24
+ * @defaultValue 'value'
25
+ */
26
+ valueKey?: string;
27
+ /**
28
+ * When `items` is an array of objects, select the field to use as the label.
29
+ * @defaultValue 'label'
30
+ */
31
+ labelKey?: string;
32
+ /**
33
+ * When `items` is an array of objects, select the field to use as the description.
34
+ * @defaultValue 'description'
35
+ */
36
+ descriptionKey?: string;
37
+ items?: T[];
38
+ /**
39
+ * @defaultValue 'md'
40
+ */
41
+ size?: CheckboxGroup['variants']['size'];
42
+ /**
43
+ * The orientation the checkbox buttons are laid out.
44
+ * @defaultValue 'vertical'
45
+ */
46
+ orientation?: CheckboxGroupRootProps['orientation'];
47
+ class?: any;
48
+ ui?: CheckboxGroup['slots'] & CheckboxProps['ui'];
49
+ }
50
+ export type CheckboxGroupEmits = CheckboxGroupRootEmits & {
51
+ change: [payload: Event];
52
+ };
53
+ type SlotProps<T extends CheckboxGroupItem> = (props: {
54
+ item: T & {
55
+ id: string;
56
+ };
57
+ }) => any;
58
+ export interface CheckboxGroupSlots<T extends CheckboxGroupItem = CheckboxGroupItem> {
59
+ legend(props?: {}): any;
60
+ label: SlotProps<T>;
61
+ description: SlotProps<T>;
62
+ }
63
+ declare const _default: <T extends CheckboxGroupItem>(__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<{
64
+ props: __VLS_PrettifyLocal<any & CheckboxGroupProps<T> & Partial<{}>> & (import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps);
65
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
66
+ attrs: any;
67
+ slots: Readonly<CheckboxGroupSlots<T>> & CheckboxGroupSlots<T>;
68
+ emit: ((evt: "change", payload: Event) => void) & ((evt: "update:modelValue", value: import("reka-ui").AcceptableValue[]) => void);
69
+ }>) => import("vue").VNode & {
70
+ __ctx?: Awaited<typeof __VLS_setup>;
71
+ };
72
+ export default _default;
73
+ type __VLS_PrettifyLocal<T> = {
74
+ [K in keyof T]: T[K];
75
+ } & {};
@@ -1,79 +1,36 @@
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/chip'
6
- import { tv } from '../utils/tv'
7
-
8
- const appConfigChip = _appConfig as AppConfig & { ui: { chip: Partial<typeof theme> } }
9
-
10
- const chip = tv({ extend: tv(theme), ...(appConfigChip.ui?.chip || {}) })
11
-
12
- type ChipVariants = VariantProps<typeof chip>
13
-
14
- export interface ChipProps {
15
- /**
16
- * The element or component this component should render as.
17
- * @defaultValue 'div'
18
- */
19
- as?: any
20
- /** Display some text inside the chip. */
21
- text?: string | number
22
- /**
23
- * @defaultValue 'primary'
24
- */
25
- color?: ChipVariants['color']
26
- /**
27
- * @defaultValue 'md'
28
- */
29
- size?: ChipVariants['size']
30
- /**
31
- * The position of the chip.
32
- * @defaultValue 'top-right'
33
- */
34
- position?: ChipVariants['position']
35
- /** When `true`, keep the chip inside the component for rounded elements. */
36
- inset?: boolean
37
- /** When `true`, render the chip relatively to the parent. */
38
- standalone?: boolean
39
- class?: any
40
- ui?: Partial<typeof chip.slots>
41
- }
42
-
43
- export interface ChipEmits {
44
- (e: 'update:show', payload: boolean): void
45
- }
46
-
47
- export interface ChipSlots {
48
- default(props?: {}): any
49
- content(props?: {}): any
50
- }
1
+ <script>
2
+ import theme from "#build/ui/chip";
51
3
  </script>
52
4
 
53
- <script setup lang="ts">
54
- import { computed } from 'vue'
55
- import { Primitive, Slot } from 'reka-ui'
56
- import { useAvatarGroup } from '../composables/useAvatarGroup'
57
-
58
- defineOptions({ inheritAttrs: false })
59
-
60
- const props = withDefaults(defineProps<ChipProps>(), {
61
- inset: false,
62
- standalone: false
63
- })
64
- defineSlots<ChipSlots>()
65
-
66
- const show = defineModel<boolean>('show', { default: true })
67
-
68
- const { size } = useAvatarGroup(props)
69
-
70
- const ui = computed(() => chip({
5
+ <script setup>
6
+ import { computed } from "vue";
7
+ import { Primitive, Slot } from "reka-ui";
8
+ import { useAppConfig } from "#imports";
9
+ import { useAvatarGroup } from "../composables/useAvatarGroup";
10
+ import { tv } from "../utils/tv";
11
+ defineOptions({ inheritAttrs: false });
12
+ const props = defineProps({
13
+ as: { type: null, required: false },
14
+ text: { type: [String, Number], required: false },
15
+ color: { type: null, required: false },
16
+ size: { type: null, required: false },
17
+ position: { type: null, required: false },
18
+ inset: { type: Boolean, required: false, default: false },
19
+ standalone: { type: Boolean, required: false, default: false },
20
+ class: { type: null, required: false },
21
+ ui: { type: null, required: false }
22
+ });
23
+ defineSlots();
24
+ const show = defineModel("show", { type: Boolean, ...{ default: true } });
25
+ const { size } = useAvatarGroup(props);
26
+ const appConfig = useAppConfig();
27
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.chip || {} })({
71
28
  color: props.color,
72
29
  size: size.value,
73
30
  position: props.position,
74
31
  inset: props.inset,
75
32
  standalone: props.standalone
76
- }))
33
+ }));
77
34
  </script>
78
35
 
79
36
  <template>
@@ -0,0 +1,71 @@
1
+ import type { AppConfig } from '@nuxt/schema';
2
+ import theme from '#build/ui/chip';
3
+ import type { ComponentConfig } from '../types/utils';
4
+ type Chip = ComponentConfig<typeof theme, AppConfig, 'chip'>;
5
+ export interface ChipProps {
6
+ /**
7
+ * The element or component this component should render as.
8
+ * @defaultValue 'div'
9
+ */
10
+ as?: any;
11
+ /** Display some text inside the chip. */
12
+ text?: string | number;
13
+ /**
14
+ * @defaultValue 'primary'
15
+ */
16
+ color?: Chip['variants']['color'];
17
+ /**
18
+ * @defaultValue 'md'
19
+ */
20
+ size?: Chip['variants']['size'];
21
+ /**
22
+ * The position of the chip.
23
+ * @defaultValue 'top-right'
24
+ */
25
+ position?: Chip['variants']['position'];
26
+ /** When `true`, keep the chip inside the component for rounded elements. */
27
+ inset?: boolean;
28
+ /** When `true`, render the chip relatively to the parent. */
29
+ standalone?: boolean;
30
+ class?: any;
31
+ ui?: Chip['slots'];
32
+ }
33
+ export interface ChipEmits {
34
+ (e: 'update:show', payload: boolean): void;
35
+ }
36
+ export interface ChipSlots {
37
+ default(props?: {}): any;
38
+ content(props?: {}): any;
39
+ }
40
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
41
+ show?: boolean;
42
+ } & ChipProps>, {
43
+ inset: boolean;
44
+ standalone: boolean;
45
+ }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {
46
+ inset: boolean;
47
+ standalone: boolean;
48
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<ChipSlots> & ChipSlots>;
49
+ export default _default;
50
+ type __VLS_WithDefaults<P, D> = {
51
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
52
+ default: D[K];
53
+ }> : P[K];
54
+ };
55
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
56
+ type __VLS_TypePropsToOption<T> = {
57
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
58
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
59
+ } : {
60
+ type: import('vue').PropType<T[K]>;
61
+ required: true;
62
+ };
63
+ };
64
+ type __VLS_WithTemplateSlots<T, S> = T & {
65
+ new (): {
66
+ $slots: S;
67
+ };
68
+ };
69
+ type __VLS_PrettifyLocal<T> = {
70
+ [K in keyof T]: T[K];
71
+ } & {};