@nuxt/ui 3.0.0-alpha.10 → 3.0.0-alpha.12

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 (191) hide show
  1. package/.nuxt/ui/alert.ts +76 -59
  2. package/.nuxt/ui/avatar-group.ts +13 -1
  3. package/.nuxt/ui/avatar.ts +14 -2
  4. package/.nuxt/ui/badge.ts +102 -65
  5. package/.nuxt/ui/button-group.ts +13 -0
  6. package/.nuxt/ui/button.ts +124 -93
  7. package/.nuxt/ui/calendar.ts +20 -2
  8. package/.nuxt/ui/carousel.ts +5 -3
  9. package/.nuxt/ui/checkbox.ts +27 -9
  10. package/.nuxt/ui/chip.ts +36 -7
  11. package/.nuxt/ui/color-picker.ts +9 -1
  12. package/.nuxt/ui/context-menu.ts +31 -13
  13. package/.nuxt/ui/drawer.ts +11 -4
  14. package/.nuxt/ui/dropdown-menu.ts +31 -13
  15. package/.nuxt/ui/form-field.ts +9 -1
  16. package/.nuxt/ui/input-menu.ts +110 -75
  17. package/.nuxt/ui/input-number.ts +82 -51
  18. package/.nuxt/ui/input.ts +88 -53
  19. package/.nuxt/ui/kbd.ts +14 -2
  20. package/.nuxt/ui/navigation-menu.ts +193 -79
  21. package/.nuxt/ui/pin-input.ts +57 -31
  22. package/.nuxt/ui/popover.ts +1 -1
  23. package/.nuxt/ui/progress.ts +93 -54
  24. package/.nuxt/ui/radio-group.ts +25 -2
  25. package/.nuxt/ui/select-menu.ts +89 -54
  26. package/.nuxt/ui/select.ts +89 -54
  27. package/.nuxt/ui/separator.ts +52 -23
  28. package/.nuxt/ui/slideover.ts +11 -4
  29. package/.nuxt/ui/slider.ts +45 -22
  30. package/.nuxt/ui/stepper.ts +45 -23
  31. package/.nuxt/ui/switch.ts +20 -2
  32. package/.nuxt/ui/table.ts +30 -13
  33. package/.nuxt/ui/tabs.ts +67 -39
  34. package/.nuxt/ui/textarea.ts +88 -53
  35. package/.nuxt/ui/toast.ts +11 -1
  36. package/.nuxt/ui/toaster.ts +27 -11
  37. package/.nuxt/ui/tooltip.ts +1 -1
  38. package/README.md +8 -1
  39. package/cli/commands/make/component.mjs +12 -0
  40. package/cli/package.json +2 -2
  41. package/cli/templates.mjs +21 -16
  42. package/dist/chunks/component-meta.cjs +2590 -2511
  43. package/dist/chunks/component-meta.mjs +2590 -2511
  44. package/dist/client/devtools/200.html +1 -1
  45. package/dist/client/devtools/404.html +1 -1
  46. package/dist/client/devtools/_nuxt/CgoQwOTV.js +57 -0
  47. package/dist/client/devtools/_nuxt/DLmPhbaq.js +1 -0
  48. package/dist/client/devtools/_nuxt/DYuJNiSW.js +1 -0
  49. package/dist/client/devtools/_nuxt/builds/latest.json +1 -1
  50. package/dist/client/devtools/_nuxt/builds/meta/3184ffe2-7577-4441-af98-fe6e81c30e3a.json +1 -0
  51. package/dist/client/devtools/_nuxt/entry.ChJczkiN.css +1 -0
  52. package/dist/client/devtools/_nuxt/error-404.DyY3rYaL.css +1 -0
  53. package/dist/client/devtools/_nuxt/error-500.D_1PCaJh.css +1 -0
  54. package/dist/client/devtools/index.html +1 -1
  55. package/dist/module.cjs +1 -1
  56. package/dist/module.json +1 -1
  57. package/dist/module.mjs +1 -1
  58. package/dist/runtime/components/Accordion.vue +4 -3
  59. package/dist/runtime/components/Alert.vue +5 -4
  60. package/dist/runtime/components/Avatar.vue +35 -13
  61. package/dist/runtime/components/AvatarGroup.vue +4 -3
  62. package/dist/runtime/components/Badge.vue +4 -3
  63. package/dist/runtime/components/Breadcrumb.vue +3 -3
  64. package/dist/runtime/components/Button.vue +4 -3
  65. package/dist/runtime/components/ButtonGroup.vue +4 -3
  66. package/dist/runtime/components/Calendar.vue +6 -3
  67. package/dist/runtime/components/Card.vue +3 -3
  68. package/dist/runtime/components/Carousel.vue +4 -3
  69. package/dist/runtime/components/Checkbox.vue +6 -5
  70. package/dist/runtime/components/Chip.vue +5 -4
  71. package/dist/runtime/components/Collapsible.vue +6 -4
  72. package/dist/runtime/components/ColorPicker.vue +48 -16
  73. package/dist/runtime/components/CommandPalette.vue +14 -7
  74. package/dist/runtime/components/Container.vue +3 -3
  75. package/dist/runtime/components/ContextMenu.vue +4 -3
  76. package/dist/runtime/components/ContextMenuContent.vue +4 -4
  77. package/dist/runtime/components/Drawer.vue +9 -4
  78. package/dist/runtime/components/DropdownMenu.vue +4 -3
  79. package/dist/runtime/components/DropdownMenuContent.vue +4 -4
  80. package/dist/runtime/components/Form.vue +59 -29
  81. package/dist/runtime/components/FormField.vue +14 -7
  82. package/dist/runtime/components/Input.vue +7 -5
  83. package/dist/runtime/components/InputMenu.vue +19 -7
  84. package/dist/runtime/components/InputNumber.vue +9 -5
  85. package/dist/runtime/components/Kbd.vue +4 -3
  86. package/dist/runtime/components/Link.vue +3 -3
  87. package/dist/runtime/components/Modal.vue +10 -15
  88. package/dist/runtime/components/NavigationMenu.vue +97 -69
  89. package/dist/runtime/components/Pagination.vue +3 -3
  90. package/dist/runtime/components/PinInput.vue +9 -7
  91. package/dist/runtime/components/Popover.vue +9 -8
  92. package/dist/runtime/components/Progress.vue +6 -5
  93. package/dist/runtime/components/RadioGroup.vue +6 -5
  94. package/dist/runtime/components/Select.vue +12 -9
  95. package/dist/runtime/components/SelectMenu.vue +25 -8
  96. package/dist/runtime/components/Separator.vue +4 -3
  97. package/dist/runtime/components/Skeleton.vue +3 -3
  98. package/dist/runtime/components/Slideover.vue +10 -14
  99. package/dist/runtime/components/Slider.vue +6 -5
  100. package/dist/runtime/components/Stepper.vue +8 -6
  101. package/dist/runtime/components/Switch.vue +6 -5
  102. package/dist/runtime/components/Table.vue +4 -3
  103. package/dist/runtime/components/Tabs.vue +5 -3
  104. package/dist/runtime/components/Textarea.vue +7 -5
  105. package/dist/runtime/components/Toast.vue +4 -3
  106. package/dist/runtime/components/Toaster.vue +4 -3
  107. package/dist/runtime/components/Tooltip.vue +3 -3
  108. package/dist/runtime/composables/defineShortcuts.js +1 -1
  109. package/dist/runtime/composables/useFormField.d.ts +7 -3
  110. package/dist/runtime/composables/useFormField.js +18 -8
  111. package/dist/runtime/composables/useToast.d.ts +1 -1
  112. package/dist/runtime/composables/useToast.js +21 -7
  113. package/dist/runtime/index.css +1 -1
  114. package/dist/runtime/locale/ar.js +3 -1
  115. package/dist/runtime/locale/cs.js +3 -1
  116. package/dist/runtime/locale/da.js +54 -0
  117. package/dist/runtime/locale/de.js +3 -1
  118. package/dist/runtime/locale/el.js +54 -0
  119. package/dist/runtime/locale/en.js +3 -1
  120. package/dist/runtime/locale/es.js +5 -3
  121. package/dist/runtime/locale/et.d.ts +2 -0
  122. package/dist/runtime/locale/et.js +54 -0
  123. package/dist/runtime/locale/fa_ir.js +3 -1
  124. package/dist/runtime/locale/fi.d.ts +2 -0
  125. package/dist/runtime/locale/fi.js +54 -0
  126. package/dist/runtime/locale/fr.js +3 -1
  127. package/dist/runtime/locale/he.d.ts +2 -0
  128. package/dist/runtime/locale/he.js +53 -0
  129. package/dist/runtime/locale/hi.d.ts +2 -0
  130. package/dist/runtime/locale/hi.js +54 -0
  131. package/dist/runtime/locale/hu.d.ts +2 -0
  132. package/dist/runtime/locale/hu.js +54 -0
  133. package/dist/runtime/locale/id.d.ts +2 -0
  134. package/dist/runtime/locale/id.js +54 -0
  135. package/dist/runtime/locale/index.d.ts +14 -2
  136. package/dist/runtime/locale/index.js +14 -2
  137. package/dist/runtime/locale/it.js +3 -1
  138. package/dist/runtime/locale/ja.js +3 -1
  139. package/dist/runtime/locale/km.d.ts +2 -0
  140. package/dist/runtime/locale/km.js +54 -0
  141. package/dist/runtime/locale/ko.js +3 -1
  142. package/dist/runtime/locale/nb_no.d.ts +2 -0
  143. package/dist/runtime/locale/nb_no.js +54 -0
  144. package/dist/runtime/locale/nl.js +3 -1
  145. package/dist/runtime/locale/pl.js +3 -1
  146. package/dist/runtime/locale/pt.js +3 -1
  147. package/dist/runtime/locale/pt_br.js +3 -1
  148. package/dist/runtime/locale/ru.js +3 -1
  149. package/dist/runtime/locale/sk.js +3 -1
  150. package/dist/runtime/locale/sv.d.ts +2 -0
  151. package/dist/runtime/locale/sv.js +54 -0
  152. package/dist/runtime/locale/th.d.ts +2 -0
  153. package/dist/runtime/locale/th.js +54 -0
  154. package/dist/runtime/locale/tr.js +3 -1
  155. package/dist/runtime/locale/uk.d.ts +2 -0
  156. package/dist/runtime/locale/uk.js +54 -0
  157. package/dist/runtime/locale/vi.d.ts +2 -0
  158. package/dist/runtime/locale/vi.js +54 -0
  159. package/dist/runtime/locale/zh_cn.d.ts +2 -0
  160. package/dist/runtime/locale/{zh_hans.js → zh_cn.js} +4 -2
  161. package/dist/runtime/locale/zh_tw.d.ts +2 -0
  162. package/dist/runtime/locale/{zh_hant.js → zh_tw.js} +12 -10
  163. package/dist/runtime/plugins/colors.js +7 -4
  164. package/dist/runtime/types/form.d.ts +23 -14
  165. package/dist/runtime/types/form.js +2 -2
  166. package/dist/runtime/types/locale.d.ts +2 -0
  167. package/dist/runtime/utils/form.d.ts +2 -2
  168. package/dist/runtime/utils/form.js +5 -7
  169. package/dist/runtime/utils/tv.d.ts +1 -0
  170. package/dist/runtime/utils/tv.js +4 -0
  171. package/dist/runtime/vue/components/Icon.vue +2 -2
  172. package/dist/runtime/vue/components/Link.vue +2 -2
  173. package/dist/runtime/vue/plugins/head.d.ts +1 -1
  174. package/dist/runtime/vue/plugins/head.js +3 -3
  175. package/dist/shared/{ui.D_93iuwH.mjs → ui.CENZ17mM.mjs} +131 -48
  176. package/dist/shared/{ui.CwmIkD_Y.cjs → ui.ClMXjgLK.cjs} +131 -48
  177. package/dist/unplugin.cjs +5 -5
  178. package/dist/unplugin.mjs +5 -5
  179. package/dist/vite.cjs +1 -1
  180. package/dist/vite.mjs +1 -1
  181. package/package.json +55 -51
  182. package/dist/client/devtools/_nuxt/B1fTd_Rf.js +0 -1
  183. package/dist/client/devtools/_nuxt/CSUxkedg.js +0 -1
  184. package/dist/client/devtools/_nuxt/CbRTGpb7.js +0 -1
  185. package/dist/client/devtools/_nuxt/YQTlxbcT.js +0 -53
  186. package/dist/client/devtools/_nuxt/builds/meta/b3465abc-0a92-4ee7-ba6b-e5174891fcc0.json +0 -1
  187. package/dist/client/devtools/_nuxt/entry.DXXceQev.css +0 -1
  188. package/dist/client/devtools/_nuxt/error-404.BJpkZFyY.css +0 -1
  189. package/dist/client/devtools/_nuxt/error-500.D3i9VDlt.css +0 -1
  190. /package/dist/runtime/locale/{zh_hans.d.ts → da.d.ts} +0 -0
  191. /package/dist/runtime/locale/{zh_hant.d.ts → el.d.ts} +0 -0
@@ -1,14 +1,15 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { CalendarRootProps, CalendarRootEmits, RangeCalendarRootEmits, DateRange, CalendarCellTriggerProps } from 'reka-ui'
4
4
  import type { DateValue } from '@internationalized/date'
5
5
  import type { AppConfig } from '@nuxt/schema'
6
6
  import _appConfig from '#build/app.config'
7
7
  import theme from '#build/ui/calendar'
8
+ import { tv } from '../utils/tv'
8
9
 
9
- const appConfig = _appConfig as AppConfig & { ui: { calendar: Partial<typeof theme> } }
10
+ const appConfigCalendar = _appConfig as AppConfig & { ui: { calendar: Partial<typeof theme> } }
10
11
 
11
- const calendar = tv({ extend: tv(theme), ...(appConfig.ui?.calendar || {}) })
12
+ const calendar = tv({ extend: tv(theme), ...(appConfigCalendar.ui?.calendar || {}) })
12
13
 
13
14
  type CalendarVariants = VariantProps<typeof calendar>
14
15
 
@@ -76,6 +77,7 @@ import { computed } from 'vue'
76
77
  import { useForwardPropsEmits } from 'reka-ui'
77
78
  import { Calendar as SingleCalendar, RangeCalendar } from 'reka-ui/namespaced'
78
79
  import { reactiveOmit } from '@vueuse/core'
80
+ import { useAppConfig } from '#imports'
79
81
  import { useLocale } from '../composables/useLocale'
80
82
  import UButton from './Button.vue'
81
83
 
@@ -87,6 +89,7 @@ const props = withDefaults(defineProps<CalendarProps<R, M>>(), {
87
89
  const emits = defineEmits<CalendarEmits<R, M>>()
88
90
  defineSlots<CalendarSlots>()
89
91
 
92
+ const appConfig = useAppConfig()
90
93
  const { code: locale, dir, t } = useLocale()
91
94
 
92
95
  const rootProps = useForwardPropsEmits(reactiveOmit(props, 'range', 'modelValue', 'defaultValue', 'color', 'size', 'monthControls', 'yearControls', 'class', 'ui'), emits)
@@ -1,13 +1,13 @@
1
1
  <script lang="ts">
2
- import { tv } from 'tailwind-variants'
3
2
  import type { AppConfig } from '@nuxt/schema'
4
3
  import _appConfig from '#build/app.config'
5
4
  import theme from '#build/ui/card'
6
5
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
6
+ import { tv } from '../utils/tv'
7
7
 
8
- const appConfig = _appConfig as AppConfig & { ui: { card: Partial<typeof theme> } }
8
+ const appConfigCard = _appConfig as AppConfig & { ui: { card: Partial<typeof theme> } }
9
9
 
10
- const card = tv({ extend: tv(theme), ...(appConfig.ui?.card || {}) })
10
+ const card = tv({ extend: tv(theme), ...(appConfigCard.ui?.card || {}) })
11
11
 
12
12
  export interface CardProps {
13
13
  /**
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { AppConfig } from '@nuxt/schema'
4
4
  import type { AcceptableValue } from 'reka-ui'
5
5
  import type { EmblaCarouselType, EmblaOptionsType, EmblaPluginType } from 'embla-carousel'
@@ -12,12 +12,13 @@ import type { WheelGesturesPluginOptions } from 'embla-carousel-wheel-gestures'
12
12
  import _appConfig from '#build/app.config'
13
13
  import theme from '#build/ui/carousel'
14
14
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
15
+ import { tv } from '../utils/tv'
15
16
  import type { ButtonProps } from '../types'
16
17
  import type { PartialString } from '../types/utils'
17
18
 
18
- const appConfig = _appConfig as AppConfig & { ui: { carousel: Partial<typeof theme> } }
19
+ const appConfigCarousel = _appConfig as AppConfig & { ui: { carousel: Partial<typeof theme> } }
19
20
 
20
- const carousel = tv({ extend: tv(theme), ...(appConfig.ui?.carousel || {}) })
21
+ const carousel = tv({ extend: tv(theme), ...(appConfigCarousel.ui?.carousel || {}) })
21
22
 
22
23
  type CarouselVariants = VariantProps<typeof carousel>
23
24
 
@@ -1,14 +1,15 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { CheckboxRootProps } from 'reka-ui'
4
4
  import type { AppConfig } from '@nuxt/schema'
5
5
  import _appConfig from '#build/app.config'
6
6
  import theme from '#build/ui/checkbox'
7
7
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
+ import { tv } from '../utils/tv'
8
9
 
9
- const appConfig = _appConfig as AppConfig & { ui: { checkbox: Partial<typeof theme> } }
10
+ const appConfigCheckbox = _appConfig as AppConfig & { ui: { checkbox: Partial<typeof theme> } }
10
11
 
11
- const checkbox = tv({ extend: tv(theme), ...(appConfig.ui?.checkbox || {}) })
12
+ const checkbox = tv({ extend: tv(theme), ...(appConfigCheckbox.ui?.checkbox || {}) })
12
13
 
13
14
  type CheckboxVariants = VariantProps<typeof checkbox>
14
15
 
@@ -65,7 +66,7 @@ const modelValue = defineModel<boolean | 'indeterminate'>({ default: undefined }
65
66
  const rootProps = useForwardProps(reactivePick(props, 'required', 'value', 'defaultValue'))
66
67
 
67
68
  const appConfig = useAppConfig()
68
- const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled } = useFormField<CheckboxProps>(props)
69
+ const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField<CheckboxProps>(props)
69
70
  const id = _id.value ?? useId()
70
71
 
71
72
  const ui = computed(() => checkbox({
@@ -91,7 +92,7 @@ function onUpdate(value: any) {
91
92
  <div :class="ui.container({ class: props.ui?.container })">
92
93
  <CheckboxRoot
93
94
  :id="id"
94
- v-bind="rootProps"
95
+ v-bind="{ ...rootProps, ...ariaAttrs }"
95
96
  v-model="modelValue"
96
97
  :name="name"
97
98
  :disabled="disabled"
@@ -1,13 +1,14 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { AppConfig } from '@nuxt/schema'
4
4
  import _appConfig from '#build/app.config'
5
5
  import theme from '#build/ui/chip'
6
6
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
7
+ import { tv } from '../utils/tv'
7
8
 
8
- const appConfig = _appConfig as AppConfig & { ui: { chip: Partial<typeof theme> } }
9
+ const appConfigChip = _appConfig as AppConfig & { ui: { chip: Partial<typeof theme> } }
9
10
 
10
- const chip = tv({ extend: tv(theme), ...(appConfig.ui?.chip || {}) })
11
+ const chip = tv({ extend: tv(theme), ...(appConfigChip.ui?.chip || {}) })
11
12
 
12
13
  type ChipVariants = VariantProps<typeof chip>
13
14
 
@@ -22,7 +23,7 @@ export interface ChipProps {
22
23
  color?: ChipVariants['color']
23
24
  size?: ChipVariants['size']
24
25
  position?: ChipVariants['position']
25
- /** When `true`, translate the chip at the edge for non rounded elements. */
26
+ /** When `true`, keep the chip inside the component for rounded elements. */
26
27
  inset?: boolean
27
28
  /** When `true`, render the chip relatively to the parent. */
28
29
  standalone?: boolean
@@ -1,14 +1,14 @@
1
1
  <script lang="ts">
2
- import { tv } from 'tailwind-variants'
3
2
  import type { CollapsibleRootProps, CollapsibleRootEmits } from 'reka-ui'
4
3
  import type { AppConfig } from '@nuxt/schema'
5
4
  import _appConfig from '#build/app.config'
6
5
  import theme from '#build/ui/collapsible'
7
6
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
7
+ import { tv } from '../utils/tv'
8
8
 
9
- const appConfig = _appConfig as AppConfig & { ui: { collapsible: Partial<typeof theme> } }
9
+ const appConfigCollapsible = _appConfig as AppConfig & { ui: { collapsible: Partial<typeof theme> } }
10
10
 
11
- const collapsible = tv({ extend: tv(theme), ...(appConfig.ui?.collapsible || {}) })
11
+ const collapsible = tv({ extend: tv(theme), ...(appConfigCollapsible.ui?.collapsible || {}) })
12
12
 
13
13
  export interface CollapsibleProps extends Pick<CollapsibleRootProps, 'defaultOpen' | 'open' | 'disabled' | 'unmountOnHide'> {
14
14
  /**
@@ -34,7 +34,9 @@ extendDevtoolsMeta({ example: 'CollapsibleExample' })
34
34
  import { CollapsibleRoot, CollapsibleTrigger, CollapsibleContent, useForwardPropsEmits } from 'reka-ui'
35
35
  import { reactivePick } from '@vueuse/core'
36
36
 
37
- const props = defineProps<CollapsibleProps>()
37
+ const props = withDefaults(defineProps<CollapsibleProps>(), {
38
+ unmountOnHide: true
39
+ })
38
40
  const emits = defineEmits<CollapsibleEmits>()
39
41
  const slots = defineSlots<CollapsibleSlots>()
40
42
 
@@ -1,13 +1,15 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { MaybeRefOrGetter } from '@vueuse/shared'
4
4
  import type { AppConfig } from '@nuxt/schema'
5
5
  import _appConfig from '#build/app.config'
6
6
  import theme from '#build/ui/color-picker'
7
+ import { tv } from '../utils/tv'
8
+ import type { HSLObject } from 'colortranslator'
7
9
 
8
- const appConfig = _appConfig as AppConfig & { ui: { colorPicker: Partial<typeof theme> } }
10
+ const appConfigColorPicker = _appConfig as AppConfig & { ui: { colorPicker: Partial<typeof theme> } }
9
11
 
10
- const colorPicker = tv({ extend: tv(theme), ...(appConfig.ui?.colorPicker || {}) })
12
+ const colorPicker = tv({ extend: tv(theme), ...(appConfigColorPicker.ui?.colorPicker || {}) })
11
13
 
12
14
  type ColorPickerVariants = VariantProps<typeof colorPicker>
13
15
 
@@ -17,6 +19,27 @@ type HSVColor = {
17
19
  v: number
18
20
  }
19
21
 
22
+ function HSLtoHSV(hsl: HSLObject): HSVColor {
23
+ const x = hsl.S * (hsl.L < 50 ? hsl.L : 100 - hsl.L)
24
+ const v = hsl.L + (x / 100)
25
+
26
+ return {
27
+ h: hsl.H,
28
+ s: hsl.L === 0 ? hsl.S : 2 * x / v,
29
+ v
30
+ }
31
+ }
32
+
33
+ function HSVtoHSL(hsv: HSVColor): HSLObject {
34
+ const x = (200 - hsv.s) * hsv.v / 100
35
+
36
+ return {
37
+ H: hsv.h,
38
+ S: x === 0 || x === 200 ? 0 : Math.round(hsv.s * hsv.v / (x <= 100 ? x : 200 - x)),
39
+ L: Math.round(x / 2)
40
+ }
41
+ }
42
+
20
43
  export type ColorPickerProps = {
21
44
  /**
22
45
  * The element or component this component should render as.
@@ -39,7 +62,7 @@ export type ColorPickerProps = {
39
62
  * Format of the color
40
63
  * @defaultValue 'hex'
41
64
  */
42
- format?: 'hex' | 'rgb' | 'hsl' | 'hwb'
65
+ format?: 'hex' | 'rgb' | 'hsl' | 'cmyk' | 'lab'
43
66
  size?: ColorPickerVariants['size']
44
67
  class?: any
45
68
  ui?: Partial<typeof colorPicker.slots>
@@ -51,7 +74,7 @@ import { ref, nextTick, computed, toValue } from 'vue'
51
74
  import { Primitive } from 'reka-ui'
52
75
  import { useEventListener, useElementBounding, watchThrottled, watchPausable } from '@vueuse/core'
53
76
  import { isClient } from '@vueuse/shared'
54
- import Color from 'color'
77
+ import { ColorTranslator } from 'colortranslator'
55
78
 
56
79
  const props = withDefaults(defineProps<ColorPickerProps>(), {
57
80
  format: 'hex',
@@ -63,28 +86,37 @@ const modelValue = defineModel<string>(undefined)
63
86
  const pickedColor = computed<HSVColor>({
64
87
  get() {
65
88
  try {
66
- const color = Color(modelValue.value || props.defaultValue)
67
- return color.hsv().object() as HSVColor
89
+ const color = new ColorTranslator(modelValue.value || props.defaultValue)
90
+
91
+ return HSLtoHSV(color.HSLObject)
68
92
  } catch (_) {
69
93
  return { h: 0, s: 0, v: 100 }
70
94
  }
71
95
  },
72
96
  set(value) {
73
- const color = Color.hsv(value.h, value.s, value.v)
97
+ const color = new ColorTranslator(HSVtoHSL(value), {
98
+ decimals: 2,
99
+ labUnit: 'percent',
100
+ cmykUnit: 'percent',
101
+ cmykFunction: 'cmyk'
102
+ })
74
103
 
75
104
  switch (props.format) {
76
105
  case 'rgb':
77
- modelValue.value = color.rgb().string()
106
+ modelValue.value = color.RGB
78
107
  break
79
108
  case 'hsl':
80
- modelValue.value = color.hsl().string()
109
+ modelValue.value = color.HSL
110
+ break
111
+ case 'cmyk':
112
+ modelValue.value = color.CMYK
81
113
  break
82
- case 'hwb':
83
- modelValue.value = color.hwb().string()
114
+ case 'lab':
115
+ modelValue.value = color.CIELab
84
116
  break
85
117
  case 'hex':
86
118
  default:
87
- modelValue.value = color.hex()
119
+ modelValue.value = color.HEX
88
120
  }
89
121
  }
90
122
  })
@@ -201,18 +233,18 @@ watchThrottled([selectorThumbPosition, trackThumbPosition], () => {
201
233
  nextTick(resumeWatchColor)
202
234
  }, { throttle: () => props.throttle })
203
235
 
204
- const trackThumbColor = computed(() => Color({
236
+ const trackThumbColor = computed(() => new ColorTranslator(HSVtoHSL({
205
237
  h: normalizeHue(trackThumbPosition.value.y),
206
238
  s: 100,
207
239
  v: 100
208
- }).hex())
240
+ })).HEX)
209
241
 
210
242
  const selectorStyle = computed(() => ({
211
243
  backgroundColor: trackThumbColor.value
212
244
  }))
213
245
 
214
246
  const selectorThumbStyle = computed(() => ({
215
- backgroundColor: Color(modelValue.value || props.defaultValue).hex(),
247
+ backgroundColor: new ColorTranslator(modelValue.value || props.defaultValue).HEX,
216
248
  left: `${selectorThumbPosition.value.x}%`,
217
249
  top: `${selectorThumbPosition.value.y}%`
218
250
  }))
@@ -1,5 +1,4 @@
1
1
  <script lang="ts">
2
- import { tv } from 'tailwind-variants'
3
2
  import type { ListboxRootProps, ListboxRootEmits } from 'reka-ui'
4
3
  import type { FuseResult } from 'fuse.js'
5
4
  import type { AppConfig } from '@nuxt/schema'
@@ -8,12 +7,13 @@ import _appConfig from '#build/app.config'
8
7
  import theme from '#build/ui/command-palette'
9
8
  import type { UseComponentIconsProps } from '../composables/useComponentIcons'
10
9
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
10
+ import { tv } from '../utils/tv'
11
11
  import type { AvatarProps, ButtonProps, ChipProps, KbdProps, InputProps } from '../types'
12
12
  import type { DynamicSlots, PartialString } from '../types/utils'
13
13
 
14
- const appConfig = _appConfig as AppConfig & { ui: { commandPalette: Partial<typeof theme> } }
14
+ const appConfigCommandPalette = _appConfig as AppConfig & { ui: { commandPalette: Partial<typeof theme> } }
15
15
 
16
- const commandPalette = tv({ extend: tv(theme), ...(appConfig.ui?.commandPalette || {}) })
16
+ const commandPalette = tv({ extend: tv(theme), ...(appConfigCommandPalette.ui?.commandPalette || {}) })
17
17
 
18
18
  export interface CommandPaletteItem {
19
19
  prefix?: string
@@ -68,9 +68,15 @@ export interface CommandPaletteProps<G, T> extends Pick<ListboxRootProps, 'multi
68
68
  * @defaultValue 'Type a command or search...'
69
69
  */
70
70
  placeholder?: InputProps['placeholder']
71
+ /**
72
+ * Automatically focus the input when component is mounted.
73
+ * @defaultValue true
74
+ */
75
+ autofocus?: boolean
71
76
  /**
72
77
  * Display a close button in the input (useful when inside a Modal for example).
73
78
  * `{ size: 'md', color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
79
+ * @emits 'update:open'
74
80
  * @defaultValue false
75
81
  */
76
82
  close?: ButtonProps | boolean
@@ -139,8 +145,8 @@ import UInput from './Input.vue'
139
145
 
140
146
  const props = withDefaults(defineProps<CommandPaletteProps<G, T>>(), {
141
147
  modelValue: '',
142
- placeholder: 'Type a command or search...',
143
- labelKey: 'label'
148
+ labelKey: 'label',
149
+ autofocus: true
144
150
  })
145
151
  const emits = defineEmits<CommandPaletteEmits<T>>()
146
152
  const slots = defineSlots<CommandPaletteSlots<G, T>>()
@@ -151,7 +157,7 @@ const { t } = useLocale()
151
157
  const appConfig = useAppConfig()
152
158
 
153
159
  const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'disabled', 'multiple', 'modelValue', 'defaultValue', 'highlightOnHover'), emits)
154
- const inputProps = useForwardProps(reactivePick(props, 'loading', 'loadingIcon', 'placeholder'))
160
+ const inputProps = useForwardProps(reactivePick(props, 'loading', 'loadingIcon'))
155
161
 
156
162
  // eslint-disable-next-line vue/no-dupe-keys
157
163
  const ui = commandPalette()
@@ -237,8 +243,9 @@ const groups = computed(() => {
237
243
  <ListboxRoot v-bind="rootProps" :class="ui.root({ class: [props.class, props.ui?.root] })">
238
244
  <ListboxFilter v-model="searchTerm" as-child>
239
245
  <UInput
246
+ :placeholder="placeholder || t('commandPalette.placeholder')"
240
247
  variant="none"
241
- autofocus
248
+ :autofocus="autofocus"
242
249
  size="lg"
243
250
  v-bind="inputProps"
244
251
  :icon="icon || appConfig.ui.icons.search"
@@ -1,13 +1,13 @@
1
1
  <script lang="ts">
2
- import { tv } from 'tailwind-variants'
3
2
  import type { AppConfig } from '@nuxt/schema'
4
3
  import _appConfig from '#build/app.config'
5
4
  import theme from '#build/ui/container'
6
5
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
6
+ import { tv } from '../utils/tv'
7
7
 
8
- const appConfig = _appConfig as AppConfig & { ui: { container: Partial<typeof theme> } }
8
+ const appConfigContainer = _appConfig as AppConfig & { ui: { container: Partial<typeof theme> } }
9
9
 
10
- const container = tv({ extend: tv(theme), ...(appConfig.ui?.container || {}) })
10
+ const container = tv({ extend: tv(theme), ...(appConfigContainer.ui?.container || {}) })
11
11
 
12
12
  export interface ContainerProps {
13
13
  /**
@@ -1,16 +1,17 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { ContextMenuRootProps, ContextMenuRootEmits, ContextMenuContentProps } from 'reka-ui'
4
4
  import type { AppConfig } from '@nuxt/schema'
5
5
  import _appConfig from '#build/app.config'
6
6
  import theme from '#build/ui/context-menu'
7
7
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
+ import { tv } from '../utils/tv'
8
9
  import type { AvatarProps, KbdProps, LinkProps } from '../types'
9
10
  import type { DynamicSlots, PartialString } from '../types/utils'
10
11
 
11
- const appConfig = _appConfig as AppConfig & { ui: { contextMenu: Partial<typeof theme> } }
12
+ const appConfigContextMenu = _appConfig as AppConfig & { ui: { contextMenu: Partial<typeof theme> } }
12
13
 
13
- const contextMenu = tv({ extend: tv(theme), ...(appConfig.ui?.contextMenu || {}) })
14
+ const contextMenu = tv({ extend: tv(theme), ...(appConfigContextMenu.ui?.contextMenu || {}) })
14
15
 
15
16
  type ContextMenuVariants = VariantProps<typeof contextMenu>
16
17
 
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
- import { tv } from 'tailwind-variants'
3
2
  import type { ContextMenuContentProps as RekaContextMenuContentProps, ContextMenuContentEmits as RekaContextMenuContentEmits } from 'reka-ui'
4
3
  import theme from '#build/ui/context-menu'
4
+ import { tv } from '../utils/tv'
5
5
  import type { KbdProps, AvatarProps, ContextMenuItem, ContextMenuSlots } from '../types'
6
6
 
7
7
  const _contextMenu = tv(theme)()
@@ -42,7 +42,7 @@ const emits = defineEmits<ContextMenuContentEmits>()
42
42
  const slots = defineSlots<ContextMenuSlots<T>>()
43
43
 
44
44
  const appConfig = useAppConfig()
45
- const contentProps = useForwardPropsEmits(reactiveOmit(props, 'sub', 'items', 'portal', 'class', 'ui'), emits)
45
+ const contentProps = useForwardPropsEmits(reactiveOmit(props, 'sub', 'items', 'portal', 'labelKey', 'checkedIcon', 'loadingIcon', 'class', 'ui', 'uiOverride'), emits)
46
46
  const proxySlots = omit(slots, ['default']) as Record<string, ContextMenuSlots<T>[string]>
47
47
 
48
48
  const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate<{ item: ContextMenuItem, active?: boolean, index: number }>()
@@ -121,11 +121,11 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
121
121
  </ContextMenu.Sub>
122
122
  <ContextMenu.CheckboxItem
123
123
  v-else-if="item.type === 'checkbox'"
124
- :checked="item.checked"
124
+ :model-value="item.checked"
125
125
  :disabled="item.disabled"
126
126
  :text-value="get(item, props.labelKey as string)"
127
127
  :class="ui.item({ class: [uiOverride?.item, item.class], color: item?.color })"
128
- @update:checked="item.onUpdateChecked"
128
+ @update:model-value="item.onUpdateChecked"
129
129
  @select="item.onSelect"
130
130
  >
131
131
  <ReuseItemTemplate :item="item" :index="index" />
@@ -1,17 +1,17 @@
1
1
  <script lang="ts">
2
- import { tv } from 'tailwind-variants'
3
2
  import type { DrawerRootProps, DrawerRootEmits } from 'vaul-vue'
4
3
  import type { DialogContentProps } from 'reka-ui'
5
4
  import type { AppConfig } from '@nuxt/schema'
6
5
  import _appConfig from '#build/app.config'
7
6
  import theme from '#build/ui/drawer'
8
7
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
+ import { tv } from '../utils/tv'
9
9
 
10
- const appConfig = _appConfig as AppConfig & { ui: { drawer: Partial<typeof theme> } }
10
+ const appConfigDrawer = _appConfig as AppConfig & { ui: { drawer: Partial<typeof theme> } }
11
11
 
12
- const drawer = tv({ extend: tv(theme), ...(appConfig.ui?.drawer || {}) })
12
+ const drawer = tv({ extend: tv(theme), ...(appConfigDrawer.ui?.drawer || {}) })
13
13
 
14
- export interface DrawerProps extends Pick<DrawerRootProps, 'activeSnapPoint' | 'closeThreshold' | 'defaultOpen' | 'direction' | 'dismissible' | 'fadeFromIndex' | 'fixed' | 'modal' | 'nested' | 'direction' | 'open' | 'scrollLockTimeout' | 'shouldScaleBackground' | 'snapPoints'> {
14
+ export interface DrawerProps extends Pick<DrawerRootProps, 'activeSnapPoint' | 'closeThreshold' | 'defaultOpen' | 'direction' | 'fadeFromIndex' | 'fixed' | 'modal' | 'nested' | 'direction' | 'open' | 'scrollLockTimeout' | 'shouldScaleBackground' | 'snapPoints'> {
15
15
  /**
16
16
  * The element or component this component should render as.
17
17
  * @defaultValue 'div'
@@ -36,6 +36,11 @@ export interface DrawerProps extends Pick<DrawerRootProps, 'activeSnapPoint' | '
36
36
  * @defaultValue true
37
37
  */
38
38
  portal?: boolean
39
+ /**
40
+ * When `false`, the drawer will not close when clicking outside or pressing escape.
41
+ * @defaultValue true
42
+ */
43
+ dismissible?: boolean
39
44
  class?: any
40
45
  ui?: Partial<typeof drawer.slots>
41
46
  }
@@ -1,16 +1,17 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { DropdownMenuRootProps, DropdownMenuRootEmits, DropdownMenuContentProps, DropdownMenuArrowProps } from 'reka-ui'
4
4
  import type { AppConfig } from '@nuxt/schema'
5
5
  import _appConfig from '#build/app.config'
6
6
  import theme from '#build/ui/dropdown-menu'
7
7
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
+ import { tv } from '../utils/tv'
8
9
  import type { AvatarProps, KbdProps, LinkProps } from '../types'
9
10
  import type { DynamicSlots, PartialString } from '../types/utils'
10
11
 
11
- const appConfig = _appConfig as AppConfig & { ui: { dropdownMenu: Partial<typeof theme> } }
12
+ const appConfigDropdownMenu = _appConfig as AppConfig & { ui: { dropdownMenu: Partial<typeof theme> } }
12
13
 
13
- const dropdownMenu = tv({ extend: tv(theme), ...(appConfig.ui?.dropdownMenu || {}) })
14
+ const dropdownMenu = tv({ extend: tv(theme), ...(appConfigDropdownMenu.ui?.dropdownMenu || {}) })
14
15
 
15
16
  type DropdownMenuVariants = VariantProps<typeof dropdownMenu>
16
17
 
@@ -1,8 +1,8 @@
1
1
  <!-- eslint-disable vue/block-tag-newline -->
2
2
  <script lang="ts">
3
- import { tv } from 'tailwind-variants'
4
3
  import type { DropdownMenuContentProps as RekaDropdownMenuContentProps, DropdownMenuContentEmits as RekaDropdownMenuContentEmits } from 'reka-ui'
5
4
  import theme from '#build/ui/dropdown-menu'
5
+ import { tv } from '../utils/tv'
6
6
  import type { KbdProps, AvatarProps, DropdownMenuItem, DropdownMenuSlots } from '../types'
7
7
 
8
8
  const _dropdownMenu = tv(theme)()
@@ -48,7 +48,7 @@ const emits = defineEmits<DropdownMenuContentEmits>()
48
48
  const slots = defineSlots<DropdownMenuContentSlots<T>>()
49
49
 
50
50
  const appConfig = useAppConfig()
51
- const contentProps = useForwardPropsEmits(reactiveOmit(props, 'sub', 'items', 'portal', 'class', 'ui'), emits)
51
+ const contentProps = useForwardPropsEmits(reactiveOmit(props, 'sub', 'items', 'portal', 'labelKey', 'checkedIcon', 'loadingIcon', 'class', 'ui', 'uiOverride'), emits)
52
52
  const proxySlots = omit(slots, ['default']) as Record<string, DropdownMenuContentSlots<T>[string]>
53
53
 
54
54
  const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate<{ item: DropdownMenuItem, active?: boolean, index: number }>()
@@ -130,11 +130,11 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
130
130
  </DropdownMenu.Sub>
131
131
  <DropdownMenu.CheckboxItem
132
132
  v-else-if="item.type === 'checkbox'"
133
- :checked="item.checked"
133
+ :model-value="item.checked"
134
134
  :disabled="item.disabled"
135
135
  :text-value="get(item, props.labelKey as string)"
136
136
  :class="ui.item({ class: [uiOverride?.item, item.class], color: item?.color })"
137
- @update:checked="item.onUpdateChecked"
137
+ @update:model-value="item.onUpdateChecked"
138
138
  @select="item.onSelect"
139
139
  >
140
140
  <ReuseItemTemplate :item="item" :index="index" />