@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 { SeparatorProps as _SeparatorProps } 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/separator'
7
+ import { tv } from '../utils/tv'
7
8
  import type { AvatarProps } from '../types'
8
9
 
9
- const appConfig = _appConfig as AppConfig & { ui: { separator: Partial<typeof theme> } }
10
+ const appConfigSeparator = _appConfig as AppConfig & { ui: { separator: Partial<typeof theme> } }
10
11
 
11
- const separator = tv({ extend: tv(theme), ...(appConfig.ui?.separator || {}) })
12
+ const separator = tv({ extend: tv(theme), ...(appConfigSeparator.ui?.separator || {}) })
12
13
 
13
14
  type SeparatorVariants = VariantProps<typeof separator>
14
15
 
@@ -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/skeleton'
5
+ import { tv } from '../utils/tv'
6
6
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
7
7
 
8
- const appConfig = _appConfig as AppConfig & { ui: { skeleton: Partial<typeof theme> } }
8
+ const appConfigSkeleton = _appConfig as AppConfig & { ui: { skeleton: Partial<typeof theme> } }
9
9
 
10
- const skeleton = tv({ extend: tv(theme), ...(appConfig.ui?.skeleton || {}) })
10
+ const skeleton = tv({ extend: tv(theme), ...(appConfigSkeleton.ui?.skeleton || {}) })
11
11
 
12
12
  export interface SkeletonProps {
13
13
  /**
@@ -1,15 +1,16 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { DialogRootProps, DialogRootEmits, DialogContentProps } 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/slideover'
7
7
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
+ import { tv } from '../utils/tv'
8
9
  import type { ButtonProps } from '../types'
9
10
 
10
- const appConfig = _appConfig as AppConfig & { ui: { slideover: Partial<typeof theme> } }
11
+ const appConfigSlideover = _appConfig as AppConfig & { ui: { slideover: Partial<typeof theme> } }
11
12
 
12
- const slideover = tv({ extend: tv(theme), ...(appConfig.ui?.slideover || {}) })
13
+ const slideover = tv({ extend: tv(theme), ...(appConfigSlideover.ui?.slideover || {}) })
13
14
 
14
15
  type SlideoverVariants = VariantProps<typeof slideover>
15
16
 
@@ -46,10 +47,10 @@ export interface SlideoverProps extends DialogRootProps {
46
47
  */
47
48
  closeIcon?: string
48
49
  /**
49
- * When `true`, the slideover will not close when clicking outside.
50
- * @defaultValue false
50
+ * When `false`, the slideover will not close when clicking outside or pressing escape.
51
+ * @defaultValue true
51
52
  */
52
- preventClose?: boolean
53
+ dismissible?: boolean
53
54
  class?: any
54
55
  ui?: Partial<typeof slideover.slots>
55
56
  }
@@ -84,6 +85,7 @@ const props = withDefaults(defineProps<SlideoverProps>(), {
84
85
  overlay: true,
85
86
  transition: true,
86
87
  modal: true,
88
+ dismissible: true,
87
89
  side: 'right'
88
90
  })
89
91
  const emits = defineEmits<SlideoverEmits>()
@@ -95,7 +97,7 @@ const appConfig = useAppConfig()
95
97
  const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'modal'), emits)
96
98
  const contentProps = toRef(() => props.content)
97
99
  const contentEvents = computed(() => {
98
- if (props.preventClose) {
100
+ if (!props.dismissible) {
99
101
  return {
100
102
  pointerDownOutside: (e: Event) => e.preventDefault(),
101
103
  interactOutside: (e: Event) => e.preventDefault(),
@@ -103,13 +105,7 @@ const contentEvents = computed(() => {
103
105
  }
104
106
  }
105
107
 
106
- return {
107
- interactOutside: (e: Event) => {
108
- if (e.target instanceof Element && e.target.closest('[data-sonner-toaster]')) {
109
- return e.preventDefault()
110
- }
111
- }
112
- }
108
+ return {}
113
109
  })
114
110
 
115
111
  const ui = computed(() => slideover({
@@ -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 { SliderRootProps } 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/slider'
7
+ import { tv } from '../utils/tv'
7
8
 
8
- const appConfig = _appConfig as AppConfig & { ui: { slider: Partial<typeof theme> } }
9
+ const appConfigSlider = _appConfig as AppConfig & { ui: { slider: Partial<typeof theme> } }
9
10
 
10
- const slider = tv({ extend: tv(theme), ...(appConfig.ui?.slider || {}) })
11
+ const slider = tv({ extend: tv(theme), ...(appConfigSlider.ui?.slider || {}) })
11
12
 
12
13
  type SliderVariants = VariantProps<typeof slider>
13
14
 
@@ -54,7 +55,7 @@ const modelValue = defineModel<number | number[]>()
54
55
 
55
56
  const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'orientation', 'min', 'max', 'step', 'minStepsBetweenThumbs', 'inverted'), emits)
56
57
 
57
- const { id, emitFormChange, emitFormInput, size, color, name, disabled } = useFormField<SliderProps>(props)
58
+ const { id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField<SliderProps>(props)
58
59
 
59
60
  const defaultSliderValue = computed(() => {
60
61
  if (typeof props.defaultValue === 'number') {
@@ -94,7 +95,7 @@ function onChange(value: any) {
94
95
 
95
96
  <template>
96
97
  <SliderRoot
97
- v-bind="rootProps"
98
+ v-bind="{ ...rootProps, ...ariaAttrs }"
98
99
  :id="id"
99
100
  v-model="sliderValue"
100
101
  :name="name"
@@ -1,21 +1,22 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { StepperRootProps, StepperRootEmits } 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/stepper'
7
7
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
+ import { tv } from '../utils/tv'
8
9
  import type { DynamicSlots } from '../types/utils'
9
10
 
10
- const appConfig = _appConfig as AppConfig & { ui: { stepper: Partial<typeof theme> } }
11
+ const appConfigStepper = _appConfig as AppConfig & { ui: { stepper: Partial<typeof theme> } }
11
12
 
12
- const stepper = tv({ extend: tv(theme), ...(appConfig.ui?.stepper || {}) })
13
+ const stepper = tv({ extend: tv(theme), ...(appConfigStepper.ui?.stepper || {}) })
13
14
 
14
15
  type StepperVariants = VariantProps<typeof stepper>
15
16
 
16
17
  export interface StepperItem {
17
18
  slot?: string
18
- value?: string
19
+ value?: string | number
19
20
  title?: string
20
21
  description?: string
21
22
  icon?: string
@@ -66,6 +67,7 @@ import { reactivePick } from '@vueuse/core'
66
67
  import UIcon from './Icon.vue'
67
68
 
68
69
  const props = withDefaults(defineProps<StepperProps<T>>(), {
70
+ orientation: 'horizontal',
69
71
  linear: true
70
72
  })
71
73
  const emits = defineEmits<StepperEmits<T>>()
@@ -146,12 +148,12 @@ defineExpose({
146
148
 
147
149
  <div :class="ui.wrapper({ class: props.ui?.wrapper })">
148
150
  <StepperTitle :class="ui.title({ class: props.ui?.title })">
149
- <slot name="title" :item="currentStep">
151
+ <slot name="title" :item="item">
150
152
  {{ item.title }}
151
153
  </slot>
152
154
  </StepperTitle>
153
155
  <StepperDescription :class="ui.description({ class: props.ui?.description })">
154
- <slot name="description" :item="currentStep">
156
+ <slot name="description" :item="item">
155
157
  {{ item.description }}
156
158
  </slot>
157
159
  </StepperDescription>
@@ -1,15 +1,16 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { SwitchRootProps } 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/switch'
7
7
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
+ import { tv } from '../utils/tv'
8
9
  import type { PartialString } from '../types/utils'
9
10
 
10
- const appConfig = _appConfig as AppConfig & { ui: { switch: Partial<typeof theme> } }
11
+ const appConfigSwitch = _appConfig as AppConfig & { ui: { switch: Partial<typeof theme> } }
11
12
 
12
- const switchTv = tv({ extend: tv(theme), ...(appConfig.ui?.switch || {}) })
13
+ const switchTv = tv({ extend: tv(theme), ...(appConfigSwitch.ui?.switch || {}) })
13
14
 
14
15
  type SwitchVariants = VariantProps<typeof switchTv>
15
16
 
@@ -67,7 +68,7 @@ const modelValue = defineModel<boolean>({ default: undefined })
67
68
  const appConfig = useAppConfig()
68
69
  const rootProps = useForwardProps(reactivePick(props, 'required', 'value', 'defaultValue'))
69
70
 
70
- const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled } = useFormField<SwitchProps>(props)
71
+ const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField<SwitchProps>(props)
71
72
  const id = _id.value ?? useId()
72
73
 
73
74
  const ui = computed(() => switchTv({
@@ -92,7 +93,7 @@ function onUpdate(value: any) {
92
93
  <div :class="ui.container({ class: props.ui?.container })">
93
94
  <SwitchRoot
94
95
  :id="id"
95
- v-bind="rootProps"
96
+ v-bind="{ ...rootProps, ...ariaAttrs }"
96
97
  v-model="modelValue"
97
98
  :name="name"
98
99
  :disabled="disabled || loading"
@@ -1,7 +1,7 @@
1
1
  <!-- eslint-disable vue/block-tag-newline -->
2
2
  <script lang="ts">
3
3
  import type { Ref } from 'vue'
4
- import { tv, type VariantProps } from 'tailwind-variants'
4
+ import type { VariantProps } from 'tailwind-variants'
5
5
  import type { AppConfig } from '@nuxt/schema'
6
6
  import type { RowData } from '@tanstack/table-core'
7
7
  import type {
@@ -26,6 +26,7 @@ import type {
26
26
  } from '@tanstack/vue-table'
27
27
  import _appConfig from '#build/app.config'
28
28
  import theme from '#build/ui/table'
29
+ import { tv } from '../utils/tv'
29
30
 
30
31
  declare module '@tanstack/table-core' {
31
32
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -37,9 +38,9 @@ declare module '@tanstack/table-core' {
37
38
  }
38
39
  }
39
40
 
40
- const appConfig = _appConfig as AppConfig & { ui: { table: Partial<typeof theme> } }
41
+ const appConfigTable = _appConfig as AppConfig & { ui: { table: Partial<typeof theme> } }
41
42
 
42
- const table = tv({ extend: tv(theme), ...(appConfig.ui?.table || {}) })
43
+ const table = tv({ extend: tv(theme), ...(appConfigTable.ui?.table || {}) })
43
44
 
44
45
  type TableVariants = VariantProps<typeof table>
45
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 { TabsRootProps, TabsRootEmits } 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/tabs'
7
7
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
+ import { tv } from '../utils/tv'
8
9
  import type { AvatarProps } from '../types'
9
10
  import type { DynamicSlots, PartialString } from '../types/utils'
10
11
 
11
- const appConfig = _appConfig as AppConfig & { ui: { tabs: Partial<typeof theme> } }
12
+ const appConfigTabs = _appConfig as AppConfig & { ui: { tabs: Partial<typeof theme> } }
12
13
 
13
- const tabs = tv({ extend: tv(theme), ...(appConfig.ui?.tabs || {}) })
14
+ const tabs = tv({ extend: tv(theme), ...(appConfigTabs.ui?.tabs || {}) })
14
15
 
15
16
  export interface TabsItem {
16
17
  label?: string
@@ -96,6 +97,7 @@ const props = withDefaults(defineProps<TabsProps<T>>(), {
96
97
  content: true,
97
98
  defaultValue: '0',
98
99
  orientation: 'horizontal',
100
+ unmountOnHide: true,
99
101
  labelKey: 'label'
100
102
  })
101
103
  const emits = defineEmits<TabsEmits>()
@@ -1,12 +1,13 @@
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/textarea'
6
+ import { tv } from '../utils/tv'
6
7
 
7
- const appConfig = _appConfig as AppConfig & { ui: { textarea: Partial<typeof theme> } }
8
+ const appConfigTextarea = _appConfig as AppConfig & { ui: { textarea: Partial<typeof theme> } }
8
9
 
9
- const textarea = tv({ extend: tv(theme), ...(appConfig.ui?.textarea || {}) })
10
+ const textarea = tv({ extend: tv(theme), ...(appConfigTextarea.ui?.textarea || {}) })
10
11
 
11
12
  type TextareaVariants = VariantProps<typeof textarea>
12
13
 
@@ -65,7 +66,7 @@ const emits = defineEmits<TextareaEmits>()
65
66
 
66
67
  const [modelValue, modelModifiers] = defineModel<string | number>()
67
68
 
68
- const { emitFormBlur, emitFormInput, emitFormChange, size, color, id, name, highlight, disabled } = useFormField<TextareaProps>(props)
69
+ const { emitFormFocus, emitFormBlur, emitFormInput, emitFormChange, size, color, id, name, highlight, disabled, ariaAttrs } = useFormField<TextareaProps>(props, { deferInputValidation: true })
69
70
 
70
71
  const ui = computed(() => textarea({
71
72
  color: color.value,
@@ -184,10 +185,11 @@ onMounted(() => {
184
185
  :class="ui.base({ class: props.ui?.base })"
185
186
  :disabled="disabled"
186
187
  :required="required"
187
- v-bind="$attrs"
188
+ v-bind="{ ...$attrs, ...ariaAttrs }"
188
189
  @input="onInput"
189
190
  @blur="onBlur"
190
191
  @change="onChange"
192
+ @focus="emitFormFocus"
191
193
  />
192
194
 
193
195
  <slot />
@@ -1,15 +1,16 @@
1
1
  <script lang="ts">
2
- import { tv, type VariantProps } from 'tailwind-variants'
2
+ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { ToastRootProps, ToastRootEmits } 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/toast'
7
7
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
+ import { tv } from '../utils/tv'
8
9
  import type { AvatarProps, ButtonProps } from '../types'
9
10
 
10
- const appConfig = _appConfig as AppConfig & { ui: { toast: Partial<typeof theme> } }
11
+ const appConfigToast = _appConfig as AppConfig & { ui: { toast: Partial<typeof theme> } }
11
12
 
12
- const toast = tv({ extend: tv(theme), ...(appConfig.ui?.toast || {}) })
13
+ const toast = tv({ extend: tv(theme), ...(appConfigToast.ui?.toast || {}) })
13
14
 
14
15
  type ToastVariants = VariantProps<typeof toast>
15
16
 
@@ -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 { ToastProviderProps } 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/toaster'
7
7
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
8
+ import { tv } from '../utils/tv'
8
9
 
9
- const appConfig = _appConfig as AppConfig & { ui: { toaster: Partial<typeof theme> } }
10
+ const appConfigToaster = _appConfig as AppConfig & { ui: { toaster: Partial<typeof theme> } }
10
11
 
11
- const toaster = tv({ extend: tv(theme), ...(appConfig.ui?.toaster || {}) })
12
+ const toaster = tv({ extend: tv(theme), ...(appConfigToaster.ui?.toaster || {}) })
12
13
 
13
14
  type ToasterVariants = VariantProps<typeof toaster>
14
15
 
@@ -1,15 +1,15 @@
1
1
  <script lang="ts">
2
- import { tv } from 'tailwind-variants'
3
2
  import type { TooltipRootProps, TooltipRootEmits, TooltipContentProps, TooltipArrowProps } 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/tooltip'
7
6
  import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
7
+ import { tv } from '../utils/tv'
8
8
  import type { KbdProps } from '../types'
9
9
 
10
- const appConfig = _appConfig as AppConfig & { ui: { tooltip: Partial<typeof theme> } }
10
+ const appConfigTooltip = _appConfig as AppConfig & { ui: { tooltip: Partial<typeof theme> } }
11
11
 
12
- const tooltip = tv({ extend: tv(theme), ...(appConfig.ui?.tooltip || {}) })
12
+ const tooltip = tv({ extend: tv(theme), ...(appConfigTooltip.ui?.tooltip || {}) })
13
13
 
14
14
  export interface TooltipProps extends TooltipRootProps {
15
15
  /** The text content of the tooltip. */
@@ -6,7 +6,7 @@ export function extractShortcuts(items) {
6
6
  const shortcuts = {};
7
7
  function traverse(items2) {
8
8
  items2.forEach((item) => {
9
- if (item.kbds?.length && (item.select || item.click)) {
9
+ if (item.kbds?.length && (item.onSelect || item.onClick)) {
10
10
  const shortcutKey = item.kbds.join("_");
11
11
  shortcuts[shortcutKey] = item.onSelect || item.onClick;
12
12
  }
@@ -8,13 +8,11 @@ type Props<T> = {
8
8
  name?: string;
9
9
  size?: GetObjectField<T, 'size'>;
10
10
  color?: GetObjectField<T, 'color'>;
11
- eagerValidation?: boolean;
12
- legend?: string;
13
11
  highlight?: boolean;
14
12
  disabled?: boolean;
15
13
  };
16
14
  export declare const formOptionsInjectionKey: InjectionKey<ComputedRef<FormInjectedOptions>>;
17
- export declare const formBusInjectionKey: InjectionKey<UseEventBusReturn<FormEvent, string>>;
15
+ export declare const formBusInjectionKey: InjectionKey<UseEventBusReturn<FormEvent<any>, string>>;
18
16
  export declare const formFieldInjectionKey: InjectionKey<ComputedRef<FormFieldInjectedOptions<FormFieldProps>>>;
19
17
  export declare const inputIdInjectionKey: InjectionKey<Ref<string | undefined>>;
20
18
  export declare const formInputsInjectionKey: InjectionKey<Ref<Record<string, {
@@ -24,6 +22,7 @@ export declare const formInputsInjectionKey: InjectionKey<Ref<Record<string, {
24
22
  export declare const formLoadingInjectionKey: InjectionKey<Readonly<Ref<boolean>>>;
25
23
  export declare function useFormField<T>(props?: Props<T>, opts?: {
26
24
  bind?: boolean;
25
+ deferInputValidation?: boolean;
27
26
  }): {
28
27
  id: ComputedRef<string | undefined>;
29
28
  name: ComputedRef<string | undefined>;
@@ -34,5 +33,10 @@ export declare function useFormField<T>(props?: Props<T>, opts?: {
34
33
  emitFormBlur: () => void;
35
34
  emitFormInput: import("@vueuse/core").PromisifyFn<() => void>;
36
35
  emitFormChange: () => void;
36
+ emitFormFocus: () => void;
37
+ ariaAttrs: ComputedRef<{
38
+ 'aria-describedby': string;
39
+ 'aria-invalid': boolean;
40
+ } | undefined>;
37
41
  };
38
42
  export {};
@@ -1,4 +1,4 @@
1
- import { inject, ref, computed } from "vue";
1
+ import { inject, computed } from "vue";
2
2
  import { useDebounceFn } from "@vueuse/core";
3
3
  export const formOptionsInjectionKey = Symbol("nuxt-ui.form-options");
4
4
  export const formBusInjectionKey = Symbol("nuxt-ui.form-events");
@@ -13,7 +13,7 @@ export function useFormField(props, opts) {
13
13
  const formInputs = inject(formInputsInjectionKey, void 0);
14
14
  const inputId = inject(inputIdInjectionKey, void 0);
15
15
  if (formField && inputId) {
16
- if (opts?.bind === false || props?.legend) {
16
+ if (opts?.bind === false) {
17
17
  inputId.value = void 0;
18
18
  } else if (props?.id) {
19
19
  inputId.value = props?.id;
@@ -22,22 +22,23 @@ export function useFormField(props, opts) {
22
22
  formInputs.value[formField.value.name] = { id: inputId.value, pattern: formField.value.errorPattern };
23
23
  }
24
24
  }
25
- const blurred = ref(false);
26
- function emitFormEvent(type, name) {
25
+ function emitFormEvent(type, name, eager) {
27
26
  if (formBus && formField && name) {
28
- formBus.emit({ type, name });
27
+ formBus.emit({ type, name, eager });
29
28
  }
30
29
  }
31
30
  function emitFormBlur() {
32
31
  emitFormEvent("blur", formField?.value.name);
33
- blurred.value = true;
32
+ }
33
+ function emitFormFocus() {
34
+ emitFormEvent("focus", formField?.value.name);
34
35
  }
35
36
  function emitFormChange() {
36
37
  emitFormEvent("change", formField?.value.name);
37
38
  }
38
39
  const emitFormInput = useDebounceFn(
39
40
  () => {
40
- emitFormEvent("input", formField?.value.name);
41
+ emitFormEvent("input", formField?.value.name, !opts?.deferInputValidation || formField?.value.eagerValidation);
41
42
  },
42
43
  formField?.value.validateOnInputDelay ?? formOptions?.value.validateOnInputDelay ?? 0
43
44
  );
@@ -50,6 +51,15 @@ export function useFormField(props, opts) {
50
51
  disabled: computed(() => formOptions?.value.disabled || props?.disabled),
51
52
  emitFormBlur,
52
53
  emitFormInput,
53
- emitFormChange
54
+ emitFormChange,
55
+ emitFormFocus,
56
+ ariaAttrs: computed(() => {
57
+ if (!formField?.value) return;
58
+ const descriptiveAttrs = ["error", "hint", "description"].filter((type) => formField?.value?.[type]).map((type) => `${formField?.value.ariaId}-${type}`) || [];
59
+ return {
60
+ "aria-describedby": descriptiveAttrs.join(" "),
61
+ "aria-invalid": !!formField?.value.error
62
+ };
63
+ })
54
64
  };
55
65
  }
@@ -5,7 +5,7 @@ export interface Toast extends Omit<ToastProps, 'defaultOpen'> {
5
5
  }
6
6
  export declare function useToast(): {
7
7
  toasts: import("vue").Ref<Toast[], Toast[]>;
8
- add: (toast: Partial<Toast>) => Toast;
8
+ add: (toast: Partial<Toast>) => Promise<Toast>;
9
9
  update: (id: string | number, toast: Omit<Partial<Toast>, "id">) => void;
10
10
  remove: (id: string | number) => void;
11
11
  clear: () => void;
@@ -1,17 +1,31 @@
1
+ import { ref, nextTick } from "vue";
1
2
  import { useState } from "#imports";
2
3
  export function useToast() {
3
4
  const toasts = useState("toasts", () => []);
4
- function add(toast) {
5
+ const maxToasts = 5;
6
+ const running = ref(false);
7
+ const queue = [];
8
+ const generateId = () => `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
9
+ async function processQueue() {
10
+ if (running.value || queue.length === 0) {
11
+ return;
12
+ }
13
+ running.value = true;
14
+ while (queue.length > 0) {
15
+ const toast = queue.shift();
16
+ await nextTick();
17
+ toasts.value = [...toasts.value, toast].slice(-maxToasts);
18
+ }
19
+ running.value = false;
20
+ }
21
+ async function add(toast) {
5
22
  const body = {
6
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
23
+ id: generateId(),
7
24
  open: true,
8
25
  ...toast
9
26
  };
10
- const index = toasts.value.findIndex((t) => t.id === body.id);
11
- if (index === -1) {
12
- toasts.value.push(body);
13
- }
14
- toasts.value = toasts.value.slice(-5);
27
+ queue.push(body);
28
+ await processQueue();
15
29
  return body;
16
30
  }
17
31
  function update(id, toast) {
@@ -1 +1 @@
1
- @import "./keyframes.css";@variant dark (&:where(.dark, .dark *));@layer base{body{@apply antialiased text-[var(--ui-text)] bg-[var(--ui-bg)] scheme-light dark:scheme-dark}:root{--ui-text-dimmed:var(--ui-color-neutral-400);--ui-text-muted:var(--ui-color-neutral-500);--ui-text-toned:var(--ui-color-neutral-600);--ui-text:var(--ui-color-neutral-700);--ui-text-highlighted:var(--ui-color-neutral-900);--ui-bg:var(--color-white);--ui-bg-muted:var(--ui-color-neutral-50);--ui-bg-elevated:var(--ui-color-neutral-100);--ui-bg-accented:var(--ui-color-neutral-200);--ui-bg-inverted:var(--ui-color-neutral-900);--ui-border:var(--ui-color-neutral-200);--ui-border-muted:var(--ui-color-neutral-200);--ui-border-accented:var(--ui-color-neutral-300);--ui-border-inverted:var(--ui-color-neutral-900);--ui-radius:var(--radius-sm);--ui-container:var(--container-7xl)}.dark{--ui-text-dimmed:var(--ui-color-neutral-500);--ui-text-muted:var(--ui-color-neutral-400);--ui-text-toned:var(--ui-color-neutral-300);--ui-text:var(--ui-color-neutral-200);--ui-text-highlighted:var(--color-white);--ui-bg:var(--ui-color-neutral-900);--ui-bg-muted:var(--ui-color-neutral-800);--ui-bg-elevated:var(--ui-color-neutral-800);--ui-bg-accented:var(--ui-color-neutral-700);--ui-bg-inverted:var(--color-white);--ui-border:var(--ui-color-neutral-800);--ui-border-muted:var(--ui-color-neutral-700);--ui-border-accented:var(--ui-color-neutral-700);--ui-border-inverted:var(--color-white)}}
1
+ @import "./keyframes.css";@variant light (&:where(.light, .light *));@variant dark (&:where(.dark, .dark *));@layer base{body{@apply antialiased text-[var(--ui-text)] bg-[var(--ui-bg)] scheme-light dark:scheme-dark}.light,:root{--ui-text-dimmed:var(--ui-color-neutral-400);--ui-text-muted:var(--ui-color-neutral-500);--ui-text-toned:var(--ui-color-neutral-600);--ui-text:var(--ui-color-neutral-700);--ui-text-highlighted:var(--ui-color-neutral-900);--ui-bg:var(--color-white);--ui-bg-muted:var(--ui-color-neutral-50);--ui-bg-elevated:var(--ui-color-neutral-100);--ui-bg-accented:var(--ui-color-neutral-200);--ui-bg-inverted:var(--ui-color-neutral-900);--ui-border:var(--ui-color-neutral-200);--ui-border-muted:var(--ui-color-neutral-200);--ui-border-accented:var(--ui-color-neutral-300);--ui-border-inverted:var(--ui-color-neutral-900);--ui-radius:var(--radius-sm);--ui-container:var(--container-7xl)}.dark{--ui-text-dimmed:var(--ui-color-neutral-500);--ui-text-muted:var(--ui-color-neutral-400);--ui-text-toned:var(--ui-color-neutral-300);--ui-text:var(--ui-color-neutral-200);--ui-text-highlighted:var(--color-white);--ui-bg:var(--ui-color-neutral-900);--ui-bg-muted:var(--ui-color-neutral-800);--ui-bg-elevated:var(--ui-color-neutral-800);--ui-bg-accented:var(--ui-color-neutral-700);--ui-bg-inverted:var(--color-white);--ui-border:var(--ui-color-neutral-800);--ui-border-muted:var(--ui-color-neutral-700);--ui-border-accented:var(--ui-color-neutral-700);--ui-border-inverted:var(--color-white)}}
@@ -20,6 +20,7 @@ export default defineLocale({
20
20
  decrement: "\u062A\u0642\u0644\u064A\u0644"
21
21
  },
22
22
  commandPalette: {
23
+ placeholder: "\u0627\u0643\u062A\u0628 \u0623\u0645\u0631\u064B\u0627 \u0623\u0648 \u0627\u0628\u062D\u062B...",
23
24
  noMatch: "\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C \u0645\u0637\u0627\u0628\u0642\u0629",
24
25
  noData: "\u0644\u0627 \u062A\u0648\u062C\u062F \u0628\u064A\u0627\u0646\u0627\u062A",
25
26
  close: "\u0625\u063A\u0644\u0627\u0642"
@@ -27,7 +28,8 @@ export default defineLocale({
27
28
  selectMenu: {
28
29
  noMatch: "\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C \u0645\u0637\u0627\u0628\u0642\u0629",
29
30
  noData: "\u0644\u0627 \u062A\u0648\u062C\u062F \u0628\u064A\u0627\u0646\u0627\u062A",
30
- create: '\u0625\u0646\u0634\u0627\u0621 "{label}"'
31
+ create: '\u0625\u0646\u0634\u0627\u0621 "{label}"',
32
+ search: "\u0628\u062D\u062B..."
31
33
  },
32
34
  toast: {
33
35
  close: "\u0625\u063A\u0644\u0627\u0642"
@@ -19,6 +19,7 @@ export default defineLocale({
19
19
  decrement: "Sn\xED\u017Eit"
20
20
  },
21
21
  commandPalette: {
22
+ placeholder: "Zadejte p\u0159\xEDkaz nebo hledejte...",
22
23
  noMatch: "\u017D\xE1dn\xE1 shoda",
23
24
  noData: "\u017D\xE1dn\xE1 data",
24
25
  close: "Zav\u0159\xEDt"
@@ -26,7 +27,8 @@ export default defineLocale({
26
27
  selectMenu: {
27
28
  noMatch: "\u017D\xE1dn\xE1 shoda",
28
29
  noData: "\u017D\xE1dn\xE1 data",
29
- create: 'Vytvo\u0159it "{label}"'
30
+ create: 'Vytvo\u0159it "{label}"',
31
+ search: "Hledat..."
30
32
  },
31
33
  toast: {
32
34
  close: "Zav\u0159\xEDt"
@@ -0,0 +1,54 @@
1
+ import { defineLocale } from "../composables/defineLocale.js";
2
+ export default defineLocale({
3
+ name: "Danish",
4
+ code: "da",
5
+ messages: {
6
+ inputMenu: {
7
+ noMatch: "Ingen matchende data",
8
+ noData: "Ingen data",
9
+ create: 'Opret "{label}"'
10
+ },
11
+ calendar: {
12
+ prevYear: "Forrige \xE5r",
13
+ nextYear: "N\xE6ste \xE5r",
14
+ prevMonth: "Forrige m\xE5ned",
15
+ nextMonth: "N\xE6ste m\xE5ned"
16
+ },
17
+ inputNumber: {
18
+ increment: "\xD8g",
19
+ decrement: "Reducer"
20
+ },
21
+ commandPalette: {
22
+ placeholder: "Skriv en kommando eller s\xF8g...",
23
+ noMatch: "Ingen matchende data",
24
+ noData: "Ingen data",
25
+ close: "Luk"
26
+ },
27
+ selectMenu: {
28
+ noMatch: "Ingen matchende data",
29
+ noData: "Ingen data",
30
+ create: 'Opret "{label}"',
31
+ search: "S\xF8g..."
32
+ },
33
+ toast: {
34
+ close: "Luk"
35
+ },
36
+ carousel: {
37
+ prev: "Forrige",
38
+ next: "N\xE6ste",
39
+ goto: "G\xE5 til slide {slide}"
40
+ },
41
+ modal: {
42
+ close: "Luk"
43
+ },
44
+ slideover: {
45
+ close: "Luk"
46
+ },
47
+ alert: {
48
+ close: "Luk"
49
+ },
50
+ table: {
51
+ noData: "Ingen data"
52
+ }
53
+ }
54
+ });