@nuxt/ui 3.0.2 → 3.1.1

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 (221) hide show
  1. package/.nuxt/ui/accordion.ts +2 -2
  2. package/.nuxt/ui/alert.ts +29 -29
  3. package/.nuxt/ui/avatar-group.ts +1 -1
  4. package/.nuxt/ui/avatar.ts +3 -3
  5. package/.nuxt/ui/badge.ts +33 -33
  6. package/.nuxt/ui/breadcrumb.ts +5 -5
  7. package/.nuxt/ui/button.ts +43 -43
  8. package/.nuxt/ui/calendar.ts +17 -17
  9. package/.nuxt/ui/card.ts +5 -5
  10. package/.nuxt/ui/carousel.ts +6 -6
  11. package/.nuxt/ui/checkbox-group.ts +61 -0
  12. package/.nuxt/ui/checkbox.ts +140 -27
  13. package/.nuxt/ui/chip.ts +8 -8
  14. package/.nuxt/ui/color-picker.ts +3 -3
  15. package/.nuxt/ui/command-palette.ts +14 -14
  16. package/.nuxt/ui/context-menu.ts +33 -33
  17. package/.nuxt/ui/drawer.ts +10 -10
  18. package/.nuxt/ui/dropdown-menu.ts +34 -34
  19. package/.nuxt/ui/form-field.ts +6 -6
  20. package/.nuxt/ui/index.ts +1 -0
  21. package/.nuxt/ui/input-menu.ts +42 -42
  22. package/.nuxt/ui/input-number.ts +20 -20
  23. package/.nuxt/ui/input.ts +23 -23
  24. package/.nuxt/ui/kbd.ts +4 -4
  25. package/.nuxt/ui/link.ts +3 -3
  26. package/.nuxt/ui/modal.ts +5 -5
  27. package/.nuxt/ui/navigation-menu.ts +78 -80
  28. package/.nuxt/ui/pin-input.ts +20 -20
  29. package/.nuxt/ui/popover.ts +2 -2
  30. package/.nuxt/ui/progress.ts +17 -17
  31. package/.nuxt/ui/radio-group.ts +250 -35
  32. package/.nuxt/ui/select-menu.ts +36 -33
  33. package/.nuxt/ui/select.ts +32 -32
  34. package/.nuxt/ui/separator.ts +8 -8
  35. package/.nuxt/ui/skeleton.ts +1 -1
  36. package/.nuxt/ui/slideover.ts +4 -4
  37. package/.nuxt/ui/slider.ts +16 -16
  38. package/.nuxt/ui/stepper.ts +18 -18
  39. package/.nuxt/ui/switch.ts +20 -20
  40. package/.nuxt/ui/table.ts +15 -15
  41. package/.nuxt/ui/tabs.ts +32 -32
  42. package/.nuxt/ui/textarea.ts +40 -35
  43. package/.nuxt/ui/toast.ts +24 -24
  44. package/.nuxt/ui/tooltip.ts +2 -2
  45. package/.nuxt/ui/tree.ts +18 -18
  46. package/.nuxt/ui.css +63 -12
  47. package/README.md +15 -0
  48. package/cli/templates.mjs +18 -17
  49. package/dist/module.json +5 -5
  50. package/dist/module.mjs +12 -7
  51. package/dist/runtime/components/Accordion.vue +36 -93
  52. package/dist/runtime/components/Accordion.vue.d.ts +75 -0
  53. package/dist/runtime/components/Alert.vue +37 -100
  54. package/dist/runtime/components/Alert.vue.d.ts +81 -0
  55. package/dist/runtime/components/App.vue +28 -34
  56. package/dist/runtime/components/App.vue.d.ts +24 -0
  57. package/dist/runtime/components/Avatar.vue +42 -75
  58. package/dist/runtime/components/Avatar.vue.d.ts +39 -0
  59. package/dist/runtime/components/AvatarGroup.vue +40 -77
  60. package/dist/runtime/components/AvatarGroup.vue.d.ts +31 -0
  61. package/dist/runtime/components/Badge.vue +33 -62
  62. package/dist/runtime/components/Badge.vue.d.ts +41 -0
  63. package/dist/runtime/components/Breadcrumb.vue +37 -90
  64. package/dist/runtime/components/Breadcrumb.vue.d.ts +64 -0
  65. package/dist/runtime/components/Button.vue +95 -104
  66. package/dist/runtime/components/Button.vue.d.ts +48 -0
  67. package/dist/runtime/components/ButtonGroup.vue +20 -46
  68. package/dist/runtime/components/ButtonGroup.vue.d.ts +34 -0
  69. package/dist/runtime/components/Calendar.vue +67 -150
  70. package/dist/runtime/components/Calendar.vue.d.ts +111 -0
  71. package/dist/runtime/components/Card.vue +18 -40
  72. package/dist/runtime/components/Card.vue.d.ts +29 -0
  73. package/dist/runtime/components/Carousel.vue +112 -234
  74. package/dist/runtime/components/Carousel.vue.d.ts +122 -0
  75. package/dist/runtime/components/Checkbox.vue +52 -93
  76. package/dist/runtime/components/Checkbox.vue.d.ts +73 -0
  77. package/dist/runtime/components/CheckboxGroup.vue +121 -0
  78. package/dist/runtime/components/CheckboxGroup.vue.d.ts +78 -0
  79. package/dist/runtime/components/Chip.vue +26 -69
  80. package/dist/runtime/components/Chip.vue.d.ts +57 -0
  81. package/dist/runtime/components/Collapsible.vue +22 -41
  82. package/dist/runtime/components/Collapsible.vue.d.ts +35 -0
  83. package/dist/runtime/components/ColorPicker.vue +111 -197
  84. package/dist/runtime/components/ColorPicker.vue.d.ts +48 -0
  85. package/dist/runtime/components/CommandPalette.vue +96 -237
  86. package/dist/runtime/components/CommandPalette.vue.d.ts +161 -0
  87. package/dist/runtime/components/Container.vue +15 -28
  88. package/dist/runtime/components/Container.vue.d.ts +18 -0
  89. package/dist/runtime/components/ContextMenu.vue +34 -133
  90. package/dist/runtime/components/ContextMenu.vue.d.ts +107 -0
  91. package/dist/runtime/components/ContextMenuContent.vue +73 -81
  92. package/dist/runtime/components/ContextMenuContent.vue.d.ts +65 -0
  93. package/dist/runtime/components/Drawer.vue +49 -83
  94. package/dist/runtime/components/Drawer.vue.d.ts +78 -0
  95. package/dist/runtime/components/DropdownMenu.vue +39 -142
  96. package/dist/runtime/components/DropdownMenu.vue.d.ts +117 -0
  97. package/dist/runtime/components/DropdownMenuContent.vue +78 -88
  98. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +68 -0
  99. package/dist/runtime/components/Form.vue +135 -220
  100. package/dist/runtime/components/Form.vue.d.ts +69 -0
  101. package/dist/runtime/components/FormField.vue +35 -77
  102. package/dist/runtime/components/FormField.vue.d.ts +61 -0
  103. package/dist/runtime/components/Icon.vue +12 -19
  104. package/dist/runtime/components/Icon.vue.d.ts +8 -0
  105. package/dist/runtime/components/Input.vue +82 -140
  106. package/dist/runtime/components/Input.vue.d.ts +76 -0
  107. package/dist/runtime/components/InputMenu.vue +185 -332
  108. package/dist/runtime/components/InputMenu.vue.d.ts +324 -0
  109. package/dist/runtime/components/InputNumber.vue +71 -133
  110. package/dist/runtime/components/InputNumber.vue.d.ts +182 -0
  111. package/dist/runtime/components/Kbd.vue +20 -46
  112. package/dist/runtime/components/Kbd.vue.d.ts +34 -0
  113. package/dist/runtime/components/Link.vue +98 -176
  114. package/dist/runtime/components/Link.vue.d.ts +93 -0
  115. package/dist/runtime/components/LinkBase.vue +33 -42
  116. package/dist/runtime/components/LinkBase.vue.d.ts +25 -0
  117. package/dist/runtime/components/Modal.vue +53 -116
  118. package/dist/runtime/components/Modal.vue.d.ts +93 -0
  119. package/dist/runtime/components/NavigationMenu.vue +77 -209
  120. package/dist/runtime/components/NavigationMenu.vue.d.ts +139 -0
  121. package/dist/runtime/components/OverlayProvider.vue +14 -18
  122. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
  123. package/dist/runtime/components/Pagination.vue +46 -140
  124. package/dist/runtime/components/Pagination.vue.d.ts +119 -0
  125. package/dist/runtime/components/PinInput.vue +61 -78
  126. package/dist/runtime/components/PinInput.vue.d.ts +57 -0
  127. package/dist/runtime/components/Popover.vue +47 -84
  128. package/dist/runtime/components/Popover.vue.d.ts +63 -0
  129. package/dist/runtime/components/Progress.vue +70 -131
  130. package/dist/runtime/components/Progress.vue.d.ts +66 -0
  131. package/dist/runtime/components/RadioGroup.vue +70 -132
  132. package/dist/runtime/components/RadioGroup.vue.d.ts +91 -0
  133. package/dist/runtime/components/Select.vue +110 -224
  134. package/dist/runtime/components/Select.vue.d.ts +145 -0
  135. package/dist/runtime/components/SelectMenu.vue +161 -310
  136. package/dist/runtime/components/SelectMenu.vue.d.ts +196 -0
  137. package/dist/runtime/components/Separator.vue +29 -71
  138. package/dist/runtime/components/Separator.vue.d.ts +54 -0
  139. package/dist/runtime/components/Skeleton.vue +21 -23
  140. package/dist/runtime/components/Skeleton.vue.d.ts +17 -0
  141. package/dist/runtime/components/Slideover.vue +53 -120
  142. package/dist/runtime/components/Slideover.vue.d.ts +94 -0
  143. package/dist/runtime/components/Slider.vue +46 -84
  144. package/dist/runtime/components/Slider.vue.d.ts +52 -0
  145. package/dist/runtime/components/Stepper.vue +45 -115
  146. package/dist/runtime/components/Stepper.vue.d.ts +83 -0
  147. package/dist/runtime/components/Switch.vue +45 -93
  148. package/dist/runtime/components/Switch.vue.d.ts +70 -0
  149. package/dist/runtime/components/Table.vue +163 -267
  150. package/dist/runtime/components/Table.vue.d.ts +183 -0
  151. package/dist/runtime/components/Tabs.vue +41 -107
  152. package/dist/runtime/components/Tabs.vue.d.ts +88 -0
  153. package/dist/runtime/components/Textarea.vue +113 -158
  154. package/dist/runtime/components/Textarea.vue.d.ts +78 -0
  155. package/dist/runtime/components/Toast.vue +49 -110
  156. package/dist/runtime/components/Toast.vue.d.ts +157 -0
  157. package/dist/runtime/components/Toaster.vue +70 -107
  158. package/dist/runtime/components/Toaster.vue.d.ts +38 -0
  159. package/dist/runtime/components/Tooltip.vue +38 -65
  160. package/dist/runtime/components/Tooltip.vue.d.ts +50 -0
  161. package/dist/runtime/components/Tree.vue +59 -166
  162. package/dist/runtime/components/Tree.vue.d.ts +111 -0
  163. package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
  164. package/dist/runtime/composables/defineShortcuts.js +6 -0
  165. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  166. package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
  167. package/dist/runtime/composables/useFormField.d.ts +2 -2
  168. package/dist/runtime/composables/useKbd.d.ts +1 -0
  169. package/dist/runtime/composables/useKbd.js +4 -3
  170. package/dist/runtime/composables/useOverlay.d.ts +14 -8
  171. package/dist/runtime/composables/useOverlay.js +20 -7
  172. package/dist/runtime/composables/usePortal.d.ts +6 -0
  173. package/dist/runtime/composables/usePortal.js +17 -0
  174. package/dist/runtime/index.css +1 -1
  175. package/dist/runtime/inertia/components/Link.vue +146 -0
  176. package/dist/runtime/inertia/components/Link.vue.d.ts +63 -0
  177. package/dist/runtime/inertia/stubs.d.ts +43 -0
  178. package/dist/runtime/inertia/stubs.js +82 -0
  179. package/dist/runtime/locale/bg.d.ts +3 -0
  180. package/dist/runtime/locale/bg.js +54 -0
  181. package/dist/runtime/locale/index.d.ts +5 -1
  182. package/dist/runtime/locale/index.js +5 -1
  183. package/dist/runtime/locale/kk.d.ts +3 -0
  184. package/dist/runtime/locale/kk.js +54 -0
  185. package/dist/runtime/locale/tj.d.ts +3 -0
  186. package/dist/runtime/locale/tj.js +54 -0
  187. package/dist/runtime/locale/ug_cn.d.ts +3 -0
  188. package/dist/runtime/locale/ug_cn.js +55 -0
  189. package/dist/runtime/types/form.d.ts +4 -1
  190. package/dist/runtime/types/index.d.ts +1 -0
  191. package/dist/runtime/types/index.js +1 -0
  192. package/dist/runtime/types/tv.d.ts +53 -0
  193. package/dist/runtime/types/tv.js +0 -0
  194. package/dist/runtime/types/utils.d.ts +7 -17
  195. package/dist/runtime/types/utils.js +1 -0
  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 +5 -0
  201. package/dist/runtime/vue/components/Link.vue +118 -202
  202. package/dist/runtime/vue/components/Link.vue.d.ts +93 -0
  203. package/dist/runtime/vue/stubs.d.ts +2 -2
  204. package/dist/shared/{ui.BkNUP964.mjs → ui.CbtTMMzt.mjs} +631 -366
  205. package/dist/types.d.mts +3 -5
  206. package/dist/unplugin.d.mts +6 -2
  207. package/dist/unplugin.mjs +25 -4
  208. package/dist/vite.d.mts +1 -1
  209. package/dist/vite.mjs +2 -2
  210. package/package.json +96 -54
  211. package/dist/module.cjs +0 -62
  212. package/dist/module.d.cts +0 -45
  213. package/dist/module.d.ts +0 -45
  214. package/dist/shared/ui.BL-XB3u1.cjs +0 -3555
  215. package/dist/types.d.ts +0 -7
  216. package/dist/unplugin.cjs +0 -232
  217. package/dist/unplugin.d.cts +0 -62
  218. package/dist/unplugin.d.ts +0 -62
  219. package/dist/vite.cjs +0 -23
  220. package/dist/vite.d.cts +0 -15
  221. package/dist/vite.d.ts +0 -15
@@ -1,92 +1,55 @@
1
- <script lang="ts">
2
- import type { PopoverRootProps, HoverCardRootProps, PopoverRootEmits, PopoverContentProps, PopoverContentEmits, PopoverArrowProps } from 'reka-ui'
3
- import type { AppConfig } from '@nuxt/schema'
4
- import _appConfig from '#build/app.config'
5
- import theme from '#build/ui/popover'
6
- import { tv } from '../utils/tv'
7
- import type { EmitsToProps } from '../types/utils'
8
-
9
- const appConfigPopover = _appConfig as AppConfig & { ui: { popover: Partial<typeof theme> } }
10
-
11
- const popover = tv({ extend: tv(theme), ...(appConfigPopover.ui?.popover || {}) })
12
-
13
- export interface PopoverProps extends PopoverRootProps, Pick<HoverCardRootProps, 'openDelay' | 'closeDelay'> {
14
- /**
15
- * The display mode of the popover.
16
- * @defaultValue 'click'
17
- */
18
- mode?: 'click' | 'hover'
19
- /**
20
- * The content of the popover.
21
- * @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
22
- */
23
- content?: Omit<PopoverContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<PopoverContentEmits>>
24
- /**
25
- * Display an arrow alongside the popover.
26
- * @defaultValue false
27
- */
28
- arrow?: boolean | Omit<PopoverArrowProps, 'as' | 'asChild'>
29
- /**
30
- * Render the popover in a portal.
31
- * @defaultValue true
32
- */
33
- portal?: boolean
34
- /**
35
- * When `false`, the popover will not close when clicking outside or pressing escape.
36
- * @defaultValue true
37
- */
38
- dismissible?: boolean
39
- class?: any
40
- ui?: Partial<typeof popover.slots>
41
- }
42
-
43
- export interface PopoverEmits extends PopoverRootEmits {}
44
-
45
- export interface PopoverSlots {
46
- default(props: { open: boolean }): any
47
- content(props?: {}): any
48
- }
1
+ <script>
2
+ import theme from "#build/ui/popover";
49
3
  </script>
50
4
 
51
- <script setup lang="ts">
52
- import { computed, toRef } from 'vue'
53
- import { defu } from 'defu'
54
- import { useForwardPropsEmits } from 'reka-ui'
55
- import { Popover, HoverCard } from 'reka-ui/namespaced'
56
- import { reactivePick } from '@vueuse/core'
57
-
58
- const props = withDefaults(defineProps<PopoverProps>(), {
59
- portal: true,
60
- mode: 'click',
61
- openDelay: 0,
62
- closeDelay: 0,
63
- dismissible: true
64
- })
65
- const emits = defineEmits<PopoverEmits>()
66
- const slots = defineSlots<PopoverSlots>()
67
-
68
- const pick = props.mode === 'hover' ? reactivePick(props, 'defaultOpen', 'open', 'openDelay', 'closeDelay') : reactivePick(props, 'defaultOpen', 'open', 'modal')
69
- const rootProps = useForwardPropsEmits(pick, emits)
70
- const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8 }) as PopoverContentProps)
5
+ <script setup>
6
+ import { computed, toRef } from "vue";
7
+ import { defu } from "defu";
8
+ import { useForwardPropsEmits } from "reka-ui";
9
+ import { Popover, HoverCard } from "reka-ui/namespaced";
10
+ import { reactivePick } from "@vueuse/core";
11
+ import { useAppConfig } from "#imports";
12
+ import { usePortal } from "../composables/usePortal";
13
+ import { tv } from "../utils/tv";
14
+ const props = defineProps({
15
+ mode: { type: String, required: false, default: "click" },
16
+ content: { type: Object, required: false },
17
+ arrow: { type: [Boolean, Object], required: false },
18
+ portal: { type: [Boolean, String], required: false, skipCheck: true, default: true },
19
+ dismissible: { type: Boolean, required: false, default: true },
20
+ class: { type: null, required: false },
21
+ ui: { type: null, required: false },
22
+ defaultOpen: { type: Boolean, required: false },
23
+ open: { type: Boolean, required: false },
24
+ modal: { type: Boolean, required: false },
25
+ openDelay: { type: Number, required: false, default: 0 },
26
+ closeDelay: { type: Number, required: false, default: 0 }
27
+ });
28
+ const emits = defineEmits(["close:prevent", "update:open"]);
29
+ const slots = defineSlots();
30
+ const appConfig = useAppConfig();
31
+ const pick = props.mode === "hover" ? reactivePick(props, "defaultOpen", "open", "openDelay", "closeDelay") : reactivePick(props, "defaultOpen", "open", "modal");
32
+ const rootProps = useForwardPropsEmits(pick, emits);
33
+ const portalProps = usePortal(toRef(() => props.portal));
34
+ const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8 }));
71
35
  const contentEvents = computed(() => {
72
36
  if (!props.dismissible) {
73
- return {
74
- pointerDownOutside: (e: Event) => e.preventDefault(),
75
- interactOutside: (e: Event) => e.preventDefault(),
76
- escapeKeyDown: (e: Event) => e.preventDefault()
77
- }
37
+ const events = ["pointerDownOutside", "interactOutside", "escapeKeyDown"];
38
+ return events.reduce((acc, curr) => {
39
+ acc[curr] = (e) => {
40
+ e.preventDefault();
41
+ emits("close:prevent");
42
+ };
43
+ return acc;
44
+ }, {});
78
45
  }
79
-
80
- return {}
81
- })
82
- const arrowProps = toRef(() => props.arrow as PopoverArrowProps)
83
-
84
- // eslint-disable-next-line vue/no-dupe-keys
85
- const ui = computed(() => popover({
46
+ return {};
47
+ });
48
+ const arrowProps = toRef(() => props.arrow);
49
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.popover || {} })({
86
50
  side: contentProps.value.side
87
- }))
88
-
89
- const Component = computed(() => props.mode === 'hover' ? HoverCard : Popover)
51
+ }));
52
+ const Component = computed(() => props.mode === "hover" ? HoverCard : Popover);
90
53
  </script>
91
54
 
92
55
  <template>
@@ -95,7 +58,7 @@ const Component = computed(() => props.mode === 'hover' ? HoverCard : Popover)
95
58
  <slot :open="open" />
96
59
  </Component.Trigger>
97
60
 
98
- <Component.Portal :disabled="!portal">
61
+ <Component.Portal v-bind="portalProps">
99
62
  <Component.Content v-bind="contentProps" :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-on="contentEvents">
100
63
  <slot name="content" />
101
64
 
@@ -0,0 +1,63 @@
1
+ import { Popover } from 'reka-ui/namespaced';
2
+ import type { PopoverRootProps, HoverCardRootProps, PopoverRootEmits, PopoverContentProps, PopoverContentEmits, PopoverArrowProps } from 'reka-ui';
3
+ import type { AppConfig } from '@nuxt/schema';
4
+ import theme from '#build/ui/popover';
5
+ import type { EmitsToProps, ComponentConfig } from '../types/utils';
6
+ type Popover = ComponentConfig<typeof theme, AppConfig, 'popover'>;
7
+ export interface PopoverProps extends PopoverRootProps, Pick<HoverCardRootProps, 'openDelay' | 'closeDelay'> {
8
+ /**
9
+ * The display mode of the popover.
10
+ * @defaultValue 'click'
11
+ */
12
+ mode?: 'click' | 'hover';
13
+ /**
14
+ * The content of the popover.
15
+ * @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
16
+ */
17
+ content?: Omit<PopoverContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<PopoverContentEmits>>;
18
+ /**
19
+ * Display an arrow alongside the popover.
20
+ * @defaultValue false
21
+ */
22
+ arrow?: boolean | Omit<PopoverArrowProps, 'as' | 'asChild'>;
23
+ /**
24
+ * Render the popover in a portal.
25
+ * @defaultValue true
26
+ */
27
+ portal?: boolean | string | HTMLElement;
28
+ /**
29
+ * When `false`, the popover will not close when clicking outside or pressing escape.
30
+ * @defaultValue true
31
+ */
32
+ dismissible?: boolean;
33
+ class?: any;
34
+ ui?: Popover['slots'];
35
+ }
36
+ export interface PopoverEmits extends PopoverRootEmits {
37
+ 'close:prevent': [];
38
+ }
39
+ export interface PopoverSlots {
40
+ default(props: {
41
+ open: boolean;
42
+ }): any;
43
+ content(props?: {}): any;
44
+ }
45
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<PopoverProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
46
+ "update:open": (value: boolean) => any;
47
+ "close:prevent": () => any;
48
+ }, string, import("vue").PublicProps, Readonly<PopoverProps> & Readonly<{
49
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
50
+ "onClose:prevent"?: (() => any) | undefined;
51
+ }>, {
52
+ mode: "click" | "hover";
53
+ portal: boolean | string | HTMLElement;
54
+ dismissible: boolean;
55
+ openDelay: number;
56
+ closeDelay: number;
57
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, PopoverSlots>;
58
+ export default _default;
59
+ type __VLS_WithSlots<T, S> = T & {
60
+ new (): {
61
+ $slots: S;
62
+ };
63
+ };
@@ -1,172 +1,111 @@
1
- <!-- eslint-disable vue/block-tag-newline -->
2
- <script lang="ts">
3
- import type { VariantProps } from 'tailwind-variants'
4
- import type { ProgressRootProps, ProgressRootEmits } from 'reka-ui'
5
- import type { AppConfig } from '@nuxt/schema'
6
- import _appConfig from '#build/app.config'
7
- import theme from '#build/ui/progress'
8
- import { tv } from '../utils/tv'
9
-
10
- const appConfigProgress = _appConfig as AppConfig & { ui: { progress: Partial<typeof theme> } }
11
-
12
- const progress = tv({ extend: tv(theme), ...(appConfigProgress.ui?.progress || {}) })
13
-
14
- type ProgressVariants = VariantProps<typeof progress>
15
-
16
- export interface ProgressProps extends Pick<ProgressRootProps, 'getValueLabel' | 'modelValue'> {
17
- /**
18
- * The element or component this component should render as.
19
- * @defaultValue 'div'
20
- */
21
- as?: any
22
- /** The maximum progress value. */
23
- max?: number | Array<any>
24
- /** Display the current progress value. */
25
- status?: boolean
26
- /** Whether the progress is visually inverted. */
27
- inverted?: boolean
28
- /**
29
- * @defaultValue 'md'
30
- */
31
- size?: ProgressVariants['size']
32
- /**
33
- * @defaultValue 'primary'
34
- */
35
- color?: ProgressVariants['color']
36
- /**
37
- * The orientation of the progress bar.
38
- * @defaultValue 'horizontal'
39
- */
40
- orientation?: ProgressVariants['orientation']
41
- /**
42
- * The animation of the progress bar.
43
- * @defaultValue 'carousel'
44
- */
45
- animation?: ProgressVariants['animation']
46
- class?: any
47
- ui?: Partial<typeof progress.slots>
48
- }
49
-
50
- export interface ProgressEmits extends ProgressRootEmits {}
51
-
52
- export type ProgressSlots = {
53
- status(props: { percent?: number }): any
54
- } & {
55
- [key: string]: (props: { step: number }) => any
56
- }
57
-
1
+ <script>
2
+ import theme from "#build/ui/progress";
58
3
  </script>
59
4
 
60
- <script setup lang="ts">
61
- import { computed } from 'vue'
62
- import { Primitive, ProgressRoot, ProgressIndicator, useForwardPropsEmits } from 'reka-ui'
63
- import { reactivePick } from '@vueuse/core'
64
- import { useLocale } from '../composables/useLocale'
65
-
66
- const props = withDefaults(defineProps<ProgressProps>(), {
67
- inverted: false,
68
- modelValue: null,
69
- orientation: 'horizontal'
70
- })
71
- const emits = defineEmits<ProgressEmits>()
72
- const slots = defineSlots<ProgressSlots>()
73
-
74
- const { dir } = useLocale()
75
-
76
- const rootProps = useForwardPropsEmits(reactivePick(props, 'getValueLabel', 'modelValue'), emits)
77
-
78
- const isIndeterminate = computed(() => rootProps.value.modelValue === null)
79
- const hasSteps = computed(() => Array.isArray(props.max))
80
-
5
+ <script setup>
6
+ import { computed } from "vue";
7
+ import { Primitive, ProgressRoot, ProgressIndicator, useForwardPropsEmits } from "reka-ui";
8
+ import { reactivePick } from "@vueuse/core";
9
+ import { useAppConfig } from "#imports";
10
+ import { useLocale } from "../composables/useLocale";
11
+ import { tv } from "../utils/tv";
12
+ const props = defineProps({
13
+ as: { type: null, required: false },
14
+ max: { type: [Number, Array], required: false },
15
+ status: { type: Boolean, required: false },
16
+ inverted: { type: Boolean, required: false, default: false },
17
+ size: { type: null, required: false },
18
+ color: { type: null, required: false },
19
+ orientation: { type: null, required: false, default: "horizontal" },
20
+ animation: { type: null, required: false },
21
+ class: { type: null, required: false },
22
+ ui: { type: null, required: false },
23
+ getValueLabel: { type: Function, required: false },
24
+ modelValue: { type: [Number, null], required: false, default: null }
25
+ });
26
+ const emits = defineEmits(["update:modelValue", "update:max"]);
27
+ const slots = defineSlots();
28
+ const { dir } = useLocale();
29
+ const appConfig = useAppConfig();
30
+ const rootProps = useForwardPropsEmits(reactivePick(props, "getValueLabel", "modelValue"), emits);
31
+ const isIndeterminate = computed(() => rootProps.value.modelValue === null);
32
+ const hasSteps = computed(() => Array.isArray(props.max));
81
33
  const realMax = computed(() => {
82
34
  if (isIndeterminate.value || !props.max) {
83
- return undefined
35
+ return void 0;
84
36
  }
85
-
86
37
  if (Array.isArray(props.max)) {
87
- return props.max.length - 1
38
+ return props.max.length - 1;
88
39
  }
89
-
90
- return Number(props.max)
91
- })
92
-
40
+ return Number(props.max);
41
+ });
93
42
  const percent = computed(() => {
94
43
  if (isIndeterminate.value) {
95
- return undefined
44
+ return void 0;
96
45
  }
97
-
98
46
  switch (true) {
99
- case rootProps.value.modelValue! < 0: return 0
100
- case rootProps.value.modelValue! > (realMax.value ?? 100): return 100
101
- default: return Math.round((rootProps.value.modelValue! / (realMax.value ?? 100)) * 100)
47
+ case rootProps.value.modelValue < 0:
48
+ return 0;
49
+ case rootProps.value.modelValue > (realMax.value ?? 100):
50
+ return 100;
51
+ default:
52
+ return Math.round(rootProps.value.modelValue / (realMax.value ?? 100) * 100);
102
53
  }
103
- })
104
-
54
+ });
105
55
  const indicatorStyle = computed(() => {
106
- if (percent.value === undefined) {
107
- return
56
+ if (percent.value === void 0) {
57
+ return;
108
58
  }
109
-
110
- if (props.orientation === 'vertical') {
59
+ if (props.orientation === "vertical") {
111
60
  return {
112
- transform: `translateY(${props.inverted ? '' : '-'}${100 - percent.value}%)`
113
- }
61
+ transform: `translateY(${props.inverted ? "" : "-"}${100 - percent.value}%)`
62
+ };
114
63
  } else {
115
- if (dir.value === 'rtl') {
64
+ if (dir.value === "rtl") {
116
65
  return {
117
- transform: `translateX(${props.inverted ? '-' : ''}${100 - percent.value}%)`
118
- }
66
+ transform: `translateX(${props.inverted ? "-" : ""}${100 - percent.value}%)`
67
+ };
119
68
  } else {
120
69
  return {
121
- transform: `translateX(${props.inverted ? '' : '-'}${100 - percent.value}%)`
122
- }
70
+ transform: `translateX(${props.inverted ? "" : "-"}${100 - percent.value}%)`
71
+ };
123
72
  }
124
73
  }
125
- })
126
-
74
+ });
127
75
  const statusStyle = computed(() => {
128
76
  return {
129
- [props.orientation === 'vertical' ? 'height' : 'width']: percent.value ? `${percent.value}%` : 'fit-content'
130
- }
131
- })
132
-
133
- function isActive(index: number) {
134
- return index === Number(props.modelValue)
77
+ [props.orientation === "vertical" ? "height" : "width"]: percent.value ? `${percent.value}%` : "fit-content"
78
+ };
79
+ });
80
+ function isActive(index) {
81
+ return index === Number(props.modelValue);
135
82
  }
136
-
137
- function isFirst(index: number) {
138
- return index === 0
83
+ function isFirst(index) {
84
+ return index === 0;
139
85
  }
140
-
141
- function isLast(index: number) {
142
- return index === realMax.value
86
+ function isLast(index) {
87
+ return index === realMax.value;
143
88
  }
144
-
145
- function stepVariant(index: number | string) {
146
- index = Number(index)
147
-
89
+ function stepVariant(index) {
90
+ index = Number(index);
148
91
  if (isActive(index) && !isFirst(index)) {
149
- return 'active'
92
+ return "active";
150
93
  }
151
-
152
94
  if (isFirst(index) && isActive(index)) {
153
- return 'first'
95
+ return "first";
154
96
  }
155
-
156
97
  if (isLast(index) && isActive(index)) {
157
- return 'last'
98
+ return "last";
158
99
  }
159
-
160
- return 'other'
100
+ return "other";
161
101
  }
162
-
163
- const ui = computed(() => progress({
102
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.progress || {} })({
164
103
  animation: props.animation,
165
104
  size: props.size,
166
105
  color: props.color,
167
106
  orientation: props.orientation,
168
107
  inverted: props.inverted
169
- }))
108
+ }));
170
109
  </script>
171
110
 
172
111
  <template>
@@ -0,0 +1,66 @@
1
+ import type { ProgressRootProps, ProgressRootEmits } from 'reka-ui';
2
+ import type { AppConfig } from '@nuxt/schema';
3
+ import theme from '#build/ui/progress';
4
+ import type { ComponentConfig } from '../types/utils';
5
+ type Progress = ComponentConfig<typeof theme, AppConfig, 'progress'>;
6
+ export interface ProgressProps extends Pick<ProgressRootProps, 'getValueLabel' | 'modelValue'> {
7
+ /**
8
+ * The element or component this component should render as.
9
+ * @defaultValue 'div'
10
+ */
11
+ as?: any;
12
+ /** The maximum progress value. */
13
+ max?: number | Array<any>;
14
+ /** Display the current progress value. */
15
+ status?: boolean;
16
+ /** Whether the progress is visually inverted. */
17
+ inverted?: boolean;
18
+ /**
19
+ * @defaultValue 'md'
20
+ */
21
+ size?: Progress['variants']['size'];
22
+ /**
23
+ * @defaultValue 'primary'
24
+ */
25
+ color?: Progress['variants']['color'];
26
+ /**
27
+ * The orientation of the progress bar.
28
+ * @defaultValue 'horizontal'
29
+ */
30
+ orientation?: Progress['variants']['orientation'];
31
+ /**
32
+ * The animation of the progress bar.
33
+ * @defaultValue 'carousel'
34
+ */
35
+ animation?: Progress['variants']['animation'];
36
+ class?: any;
37
+ ui?: Progress['slots'];
38
+ }
39
+ export interface ProgressEmits extends ProgressRootEmits {
40
+ }
41
+ export type ProgressSlots = {
42
+ status(props: {
43
+ percent?: number;
44
+ }): any;
45
+ } & {
46
+ [key: string]: (props: {
47
+ step: number;
48
+ }) => any;
49
+ };
50
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ProgressProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
51
+ "update:modelValue": (value: string[] | undefined) => any;
52
+ "update:max": (value: number) => any;
53
+ }, string, import("vue").PublicProps, Readonly<ProgressProps> & Readonly<{
54
+ "onUpdate:modelValue"?: ((value: string[] | undefined) => any) | undefined;
55
+ "onUpdate:max"?: ((value: number) => any) | undefined;
56
+ }>, {
57
+ orientation: Progress["variants"]["orientation"];
58
+ modelValue: number | null;
59
+ inverted: boolean;
60
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ProgressSlots>;
61
+ export default _default;
62
+ type __VLS_WithSlots<T, S> = T & {
63
+ new (): {
64
+ $slots: S;
65
+ };
66
+ };