@byyuurin/ui 0.0.9 → 0.0.11

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 (215) hide show
  1. package/README.md +2 -5
  2. package/dist/module.json +3 -3
  3. package/dist/module.mjs +1 -1
  4. package/dist/module.mjs.map +1 -1
  5. package/dist/runtime/app/injections.d.ts +9323 -3
  6. package/dist/runtime/app/injections.js +35 -0
  7. package/dist/runtime/components/Accordion.vue +36 -69
  8. package/dist/runtime/components/Accordion.vue.d.ts +52 -0
  9. package/dist/runtime/components/Alert.vue +37 -75
  10. package/dist/runtime/components/Alert.vue.d.ts +59 -0
  11. package/dist/runtime/components/App.vue +25 -40
  12. package/dist/runtime/components/App.vue.d.ts +24 -0
  13. package/dist/runtime/components/Avatar.vue +31 -51
  14. package/dist/runtime/components/Avatar.vue.d.ts +25 -0
  15. package/dist/runtime/components/AvatarGroup.vue +38 -69
  16. package/dist/runtime/components/AvatarGroup.vue.d.ts +27 -0
  17. package/dist/runtime/components/Badge.vue +25 -51
  18. package/dist/runtime/components/Badge.vue.d.ts +44 -0
  19. package/dist/runtime/components/Breadcrumb.vue +35 -77
  20. package/dist/runtime/components/Breadcrumb.vue.d.ts +52 -0
  21. package/dist/runtime/components/Button.vue +62 -51
  22. package/dist/runtime/components/Button.vue.d.ts +29 -0
  23. package/dist/runtime/components/ButtonGroup.vue +17 -37
  24. package/dist/runtime/components/ButtonGroup.vue.d.ts +26 -0
  25. package/dist/runtime/components/Calendar.vue +75 -101
  26. package/dist/runtime/components/Calendar.vue.d.ts +75 -0
  27. package/dist/runtime/components/Card.vue +25 -42
  28. package/dist/runtime/components/Card.vue.d.ts +30 -0
  29. package/dist/runtime/components/Carousel.vue +118 -223
  30. package/dist/runtime/components/Carousel.vue.d.ts +104 -0
  31. package/dist/runtime/components/Checkbox.vue +49 -71
  32. package/dist/runtime/components/Checkbox.vue.d.ts +56 -0
  33. package/dist/runtime/components/Chip.vue +31 -48
  34. package/dist/runtime/components/Chip.vue.d.ts +30 -0
  35. package/dist/runtime/components/Collapsible.vue +22 -30
  36. package/dist/runtime/components/Collapsible.vue.d.ts +26 -0
  37. package/dist/runtime/components/Drawer.vue +52 -102
  38. package/dist/runtime/components/Drawer.vue.d.ts +80 -0
  39. package/dist/runtime/components/DropdownMenu.vue +65 -0
  40. package/dist/runtime/components/DropdownMenu.vue.d.ts +99 -0
  41. package/dist/runtime/components/DropdownMenuContent.vue +192 -0
  42. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +39 -0
  43. package/dist/runtime/components/Form.vue +197 -0
  44. package/dist/runtime/components/Form.vue.d.ts +78 -0
  45. package/dist/runtime/components/FormItem.vue +90 -0
  46. package/dist/runtime/components/FormItem.vue.d.ts +60 -0
  47. package/dist/runtime/components/Input.vue +93 -115
  48. package/dist/runtime/components/Input.vue.d.ts +64 -0
  49. package/dist/runtime/components/InputNumber.vue +81 -116
  50. package/dist/runtime/components/InputNumber.vue.d.ts +245 -0
  51. package/dist/runtime/components/Kbd.vue +18 -39
  52. package/dist/runtime/components/Kbd.vue.d.ts +28 -0
  53. package/dist/runtime/components/Link.vue +170 -244
  54. package/dist/runtime/components/Link.vue.d.ts +95 -0
  55. package/dist/runtime/components/LinkBase.vue +36 -54
  56. package/dist/runtime/components/LinkBase.vue.d.ts +28 -0
  57. package/dist/runtime/components/Modal.vue +50 -85
  58. package/dist/runtime/components/Modal.vue.d.ts +66 -0
  59. package/dist/runtime/components/OverlayProvider.vue +10 -14
  60. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
  61. package/dist/runtime/components/Pagination.vue +55 -121
  62. package/dist/runtime/components/Pagination.vue.d.ts +93 -0
  63. package/dist/runtime/components/PinInput.vue +57 -57
  64. package/dist/runtime/components/PinInput.vue.d.ts +35 -0
  65. package/dist/runtime/components/Popover.vue +39 -68
  66. package/dist/runtime/components/Popover.vue.d.ts +45 -0
  67. package/dist/runtime/components/Progress.vue +68 -120
  68. package/dist/runtime/components/Progress.vue.d.ts +54 -0
  69. package/dist/runtime/components/RadioGroup.vue +75 -129
  70. package/dist/runtime/components/RadioGroup.vue.d.ts +74 -0
  71. package/dist/runtime/components/ScrollArea.vue +31 -31
  72. package/dist/runtime/components/ScrollArea.vue.d.ts +17 -0
  73. package/dist/runtime/components/Select.vue +119 -199
  74. package/dist/runtime/components/Select.vue.d.ts +119 -0
  75. package/dist/runtime/components/Separator.vue +26 -44
  76. package/dist/runtime/components/Separator.vue.d.ts +27 -0
  77. package/dist/runtime/components/Skeleton.vue +12 -21
  78. package/dist/runtime/components/Skeleton.vue.d.ts +19 -0
  79. package/dist/runtime/components/Slider.vue +54 -71
  80. package/dist/runtime/components/Slider.vue.d.ts +36 -0
  81. package/dist/runtime/components/Switch.vue +54 -68
  82. package/dist/runtime/components/Switch.vue.d.ts +49 -0
  83. package/dist/runtime/components/Table.vue +113 -186
  84. package/dist/runtime/components/Table.vue.d.ts +148 -0
  85. package/dist/runtime/components/Tabs.vue +35 -79
  86. package/dist/runtime/components/Tabs.vue.d.ts +65 -0
  87. package/dist/runtime/components/Textarea.vue +82 -123
  88. package/dist/runtime/components/Textarea.vue.d.ts +60 -0
  89. package/dist/runtime/components/Toast.vue +51 -76
  90. package/dist/runtime/components/Toast.vue.d.ts +131 -0
  91. package/dist/runtime/components/ToastProvider.vue +65 -101
  92. package/dist/runtime/components/ToastProvider.vue.d.ts +38 -0
  93. package/dist/runtime/components/Tooltip.vue +36 -47
  94. package/dist/runtime/components/Tooltip.vue.d.ts +31 -0
  95. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  96. package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
  97. package/dist/runtime/composables/useFormItem.d.ts +27 -0
  98. package/dist/runtime/composables/useFormItem.js +64 -0
  99. package/dist/runtime/composables/useKbd.d.ts +1 -1
  100. package/dist/runtime/composables/useLocale.d.ts +3 -3
  101. package/dist/runtime/composables/useTheme.d.ts +1 -1
  102. package/dist/runtime/composables/useTheme.js +2 -1
  103. package/dist/runtime/composables/useToast.d.ts +1 -1
  104. package/dist/runtime/index.d.ts +3 -0
  105. package/dist/runtime/index.js +3 -0
  106. package/dist/runtime/locale/en.d.ts +1 -1
  107. package/dist/runtime/locale/zh-tw.d.ts +1 -1
  108. package/dist/runtime/theme/accordion.d.ts +45 -51
  109. package/dist/runtime/theme/accordion.js +1 -1
  110. package/dist/runtime/theme/alert.d.ts +115 -121
  111. package/dist/runtime/theme/alert.js +1 -1
  112. package/dist/runtime/theme/app.d.ts +1 -0
  113. package/dist/runtime/theme/app.js +2 -1
  114. package/dist/runtime/theme/avatar-group.d.ts +42 -48
  115. package/dist/runtime/theme/avatar-group.js +1 -1
  116. package/dist/runtime/theme/avatar.d.ts +46 -52
  117. package/dist/runtime/theme/avatar.js +1 -1
  118. package/dist/runtime/theme/badge.d.ts +63 -93
  119. package/dist/runtime/theme/badge.js +1 -1
  120. package/dist/runtime/theme/breadcrumb.d.ts +52 -58
  121. package/dist/runtime/theme/breadcrumb.js +1 -1
  122. package/dist/runtime/theme/button-group.d.ts +36 -42
  123. package/dist/runtime/theme/button.d.ts +165 -117
  124. package/dist/runtime/theme/button.js +1 -1
  125. package/dist/runtime/theme/calendar.d.ts +52 -50
  126. package/dist/runtime/theme/calendar.js +20 -3
  127. package/dist/runtime/theme/card.d.ts +52 -58
  128. package/dist/runtime/theme/card.js +1 -1
  129. package/dist/runtime/theme/carousel.d.ts +98 -104
  130. package/dist/runtime/theme/carousel.js +1 -1
  131. package/dist/runtime/theme/checkbox.d.ts +77 -83
  132. package/dist/runtime/theme/checkbox.js +1 -1
  133. package/dist/runtime/theme/chip.d.ts +50 -89
  134. package/dist/runtime/theme/chip.js +1 -1
  135. package/dist/runtime/theme/collapsible.d.ts +29 -35
  136. package/dist/runtime/theme/collapsible.js +1 -1
  137. package/dist/runtime/theme/drawer.d.ts +131 -102
  138. package/dist/runtime/theme/drawer.js +1 -1
  139. package/dist/runtime/theme/dropdown-menu.d.ts +65 -0
  140. package/dist/runtime/theme/dropdown-menu.js +83 -0
  141. package/dist/runtime/theme/form-item.d.ts +70 -0
  142. package/dist/runtime/theme/form-item.js +34 -0
  143. package/dist/runtime/theme/form.d.ts +2 -0
  144. package/dist/runtime/theme/form.js +7 -0
  145. package/dist/runtime/theme/index.d.ts +3 -0
  146. package/dist/runtime/theme/index.js +3 -0
  147. package/dist/runtime/theme/input-number.d.ts +100 -126
  148. package/dist/runtime/theme/input-number.js +1 -1
  149. package/dist/runtime/theme/input.d.ts +153 -131
  150. package/dist/runtime/theme/input.js +3 -3
  151. package/dist/runtime/theme/kbd.d.ts +30 -36
  152. package/dist/runtime/theme/link.d.ts +37 -43
  153. package/dist/runtime/theme/modal.d.ts +35 -69
  154. package/dist/runtime/theme/modal.js +1 -1
  155. package/dist/runtime/theme/pagination.d.ts +71 -77
  156. package/dist/runtime/theme/pagination.js +1 -1
  157. package/dist/runtime/theme/pinInput.d.ts +82 -88
  158. package/dist/runtime/theme/pinInput.js +2 -2
  159. package/dist/runtime/theme/popover.d.ts +29 -35
  160. package/dist/runtime/theme/popover.js +1 -1
  161. package/dist/runtime/theme/progress.d.ts +167 -109
  162. package/dist/runtime/theme/progress.js +1 -1
  163. package/dist/runtime/theme/radio-group.d.ts +99 -105
  164. package/dist/runtime/theme/radio-group.js +1 -1
  165. package/dist/runtime/theme/scroll-area.d.ts +62 -68
  166. package/dist/runtime/theme/scroll-area.js +1 -1
  167. package/dist/runtime/theme/select.d.ts +168 -158
  168. package/dist/runtime/theme/select.js +3 -2
  169. package/dist/runtime/theme/separator.d.ts +64 -85
  170. package/dist/runtime/theme/separator.js +1 -1
  171. package/dist/runtime/theme/skeleton.d.ts +1 -7
  172. package/dist/runtime/theme/slider.d.ts +62 -68
  173. package/dist/runtime/theme/slider.js +1 -1
  174. package/dist/runtime/theme/switch.d.ts +111 -117
  175. package/dist/runtime/theme/switch.js +1 -1
  176. package/dist/runtime/theme/table.d.ts +75 -78
  177. package/dist/runtime/theme/table.js +3 -2
  178. package/dist/runtime/theme/tabs.d.ts +116 -139
  179. package/dist/runtime/theme/tabs.js +1 -1
  180. package/dist/runtime/theme/textarea.d.ts +78 -90
  181. package/dist/runtime/theme/textarea.js +2 -2
  182. package/dist/runtime/theme/toast-provider.d.ts +110 -131
  183. package/dist/runtime/theme/toast-provider.js +1 -1
  184. package/dist/runtime/theme/toast.d.ts +74 -80
  185. package/dist/runtime/theme/toast.js +1 -1
  186. package/dist/runtime/theme/tooltip.d.ts +35 -41
  187. package/dist/runtime/theme/tooltip.js +1 -1
  188. package/dist/runtime/types/components.d.ts +3 -0
  189. package/dist/runtime/types/form.d.ts +45 -0
  190. package/dist/runtime/types/form.js +0 -0
  191. package/dist/runtime/types/index.d.ts +5 -2
  192. package/dist/runtime/types/index.js +1 -0
  193. package/dist/runtime/types/utils.d.ts +37 -16
  194. package/dist/runtime/utils/extend-theme.js +15 -4
  195. package/dist/runtime/utils/form.d.ts +5 -0
  196. package/dist/runtime/utils/form.js +24 -0
  197. package/dist/runtime/utils/index.d.ts +2 -0
  198. package/dist/runtime/utils/index.js +4 -0
  199. package/dist/runtime/utils/link.d.ts +4 -28
  200. package/dist/runtime/utils/link.js +10 -3
  201. package/dist/runtime/utils/styler.d.ts +2 -2
  202. package/dist/runtime/utils/styler.js +2 -2
  203. package/dist/shared/ui.D1BTWZFB.mjs +5 -0
  204. package/dist/shared/ui.D1BTWZFB.mjs.map +1 -0
  205. package/dist/types.d.mts +1 -1
  206. package/dist/unocss.mjs +7 -6
  207. package/dist/unocss.mjs.map +1 -1
  208. package/dist/unplugin.mjs +1 -1
  209. package/dist/unplugin.mjs.map +1 -1
  210. package/dist/vite.mjs +1 -1
  211. package/package.json +78 -74
  212. package/dist/module.cjs +0 -5
  213. package/dist/shared/ui.1a1f119c.mjs +0 -5
  214. package/dist/shared/ui.1a1f119c.mjs.map +0 -1
  215. package/dist/types.d.ts +0 -1
@@ -1,80 +1,62 @@
1
- <script lang="ts">
2
- import type { PrimitiveProps } from 'reka-ui'
1
+ <script>
3
2
 
4
- export interface LinkBaseProps {
5
- /**
6
- * The element or component this component should render as.
7
- * @default "button"
8
- */
9
- as?: PrimitiveProps['as']
10
- type?: string
11
- disabled?: boolean
12
- onClick?: ((e: MouseEvent) => void | Promise<void>) | Array<((e: MouseEvent) => void | Promise<void>)>
13
- href?: string
14
- navigate?: (e: MouseEvent) => void
15
- rel?: string
16
- target?: string
17
- isExternal?: boolean
18
- }
19
3
  </script>
20
4
 
21
- <script setup lang="ts">
22
- import { Primitive } from 'reka-ui'
23
- import { computed } from 'vue'
24
-
25
- const props = withDefaults(defineProps<LinkBaseProps>(), {
26
- as: 'button',
27
- type: 'button',
28
- })
29
-
5
+ <script setup>
6
+ import { Primitive } from "reka-ui";
7
+ import { computed } from "vue";
8
+ const props = defineProps({
9
+ as: { type: null, required: false, default: "button" },
10
+ type: { type: String, required: false, default: "button" },
11
+ disabled: { type: Boolean, required: false },
12
+ onClick: { type: [Function, Array], required: false },
13
+ href: { type: String, required: false },
14
+ navigate: { type: Function, required: false },
15
+ rel: { type: String, required: false },
16
+ target: { type: String, required: false },
17
+ isExternal: { type: Boolean, required: false }
18
+ });
30
19
  const wrapperProps = computed(() => {
31
- const { href, rel, target, disabled } = props
32
-
20
+ const { href, rel, target, disabled } = props;
33
21
  const baseProps = {
34
22
  rel,
35
- target,
36
- }
37
-
23
+ target
24
+ };
38
25
  if (props.href) {
39
26
  return {
40
27
  ...baseProps,
41
- 'as': 'a',
42
- 'href': disabled ? undefined : href,
43
- 'aria-disabled': disabled ? 'true' : undefined,
44
- 'role': disabled ? 'link' : undefined,
45
- 'tabindex': disabled ? -1 : undefined,
46
- }
28
+ "as": "a",
29
+ "href": disabled ? void 0 : href,
30
+ "aria-disabled": disabled ? "true" : void 0,
31
+ "role": disabled ? "link" : void 0,
32
+ "tabindex": disabled ? -1 : void 0
33
+ };
47
34
  }
48
-
49
- if (props.as === 'button') {
35
+ if (props.as === "button") {
50
36
  return {
51
37
  ...baseProps,
52
38
  as: props.as,
53
39
  type: props.type,
54
- disabled,
55
- }
40
+ disabled
41
+ };
56
42
  }
57
-
58
43
  return {
59
44
  ...baseProps,
60
- as: props.as,
61
- }
62
- })
63
-
64
- function onClickWrapper(e: MouseEvent) {
45
+ as: props.as
46
+ };
47
+ });
48
+ function onClickWrapper(e) {
65
49
  if (props.disabled) {
66
- e.stopPropagation()
67
- e.preventDefault()
68
- return
50
+ e.stopPropagation();
51
+ e.preventDefault();
52
+ return;
69
53
  }
70
-
71
54
  if (props.onClick) {
72
55
  for (const onClick of Array.isArray(props.onClick) ? props.onClick : [props.onClick])
73
- onClick(e)
56
+ onClick(e);
74
57
  }
75
-
76
58
  if (props.href && props.navigate && !props.isExternal)
77
- props.navigate(e)
59
+ props.navigate(e);
78
60
  }
79
61
  </script>
80
62
 
@@ -0,0 +1,28 @@
1
+ import type { PrimitiveProps } from 'reka-ui';
2
+ export interface LinkBaseProps {
3
+ /**
4
+ * The element or component this component should render as.
5
+ * @default "button"
6
+ */
7
+ as?: PrimitiveProps['as'];
8
+ type?: string;
9
+ disabled?: boolean;
10
+ onClick?: ((e: MouseEvent) => void | Promise<void>) | Array<((e: MouseEvent) => void | Promise<void>)>;
11
+ href?: string;
12
+ navigate?: (e: MouseEvent) => void;
13
+ rel?: string;
14
+ target?: string;
15
+ isExternal?: boolean;
16
+ }
17
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<LinkBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LinkBaseProps> & Readonly<{}>, {
18
+ type: string;
19
+ as: import("reka-ui").AsTag | import("vue").Component;
20
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
21
+ default?: (props: {}) => any;
22
+ }>;
23
+ export default _default;
24
+ type __VLS_WithSlots<T, S> = T & {
25
+ new (): {
26
+ $slots: S;
27
+ };
28
+ };
@@ -1,89 +1,50 @@
1
- <script lang="ts">
2
- import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { DialogContentProps, DialogRootEmits, DialogRootProps } from 'reka-ui'
4
- import type { modal } from '../theme'
5
- import type { ButtonProps, ComponentAttrs } from '../types'
1
+ <script>
6
2
 
7
- export interface ModalEmits extends DialogRootEmits {
8
- 'after-leave': []
9
- }
10
-
11
- export interface ModalSlots {
12
- default?: (props: { open: boolean }) => any
13
- content?: (props?: {}) => any
14
- header?: (props?: {}) => any
15
- title?: (props?: {}) => any
16
- description?: (props?: {}) => any
17
- close?: (props?: {}) => any
18
- body?: (props?: {}) => any
19
- footer?: (props?: {}) => any
20
- }
21
-
22
- type ModalVariants = VariantProps<typeof modal>
23
-
24
- export interface ModalProps extends ComponentAttrs<typeof modal>, DialogRootProps {
25
- title?: string
26
- description?: string
27
- size?: ModalVariants['size']
28
- content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'>
29
- /** @default true */
30
- portal?: boolean
31
- /** @default true */
32
- overlay?: boolean
33
- /** @default true */
34
- transition?: boolean
35
- /**
36
- * When `false`, the modal will not close when clicking outside or pressing escape.
37
- * @default true
38
- */
39
- dismissible?: boolean
40
- /**
41
- * Display a close button to dismiss the modal.
42
- * @default true
43
- */
44
- close?: ButtonProps | boolean
45
- /** @default app.icons.close */
46
- closeIcon?: string
47
- }
48
3
  </script>
49
4
 
50
- <script setup lang="ts">
51
- import { reactivePick } from '@vueuse/core'
52
- import { DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, useForwardPropsEmits, VisuallyHidden } from 'reka-ui'
53
- import { computed, toRef } from 'vue'
54
- import { useLocale } from '../composables/useLocale'
55
- import { useTheme } from '../composables/useTheme'
56
- import Button from './Button.vue'
57
-
58
- const props = withDefaults(defineProps<ModalProps>(), {
59
- modal: true,
60
- portal: true,
61
- overlay: true,
62
- transition: true,
63
- dismissible: true,
64
- close: true,
65
- })
66
- const emit = defineEmits<ModalEmits>()
67
- const slots = defineSlots<ModalSlots>()
68
- const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'modal'), emit)
5
+ <script setup>
6
+ import { reactivePick } from "@vueuse/core";
7
+ import { DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, useForwardPropsEmits, VisuallyHidden } from "reka-ui";
8
+ import { computed, toRef } from "vue";
9
+ import { useLocale } from "../composables/useLocale";
10
+ import { useTheme } from "../composables/useTheme";
11
+ import Button from "./Button.vue";
12
+ const props = defineProps({
13
+ title: { type: String, required: false },
14
+ description: { type: String, required: false },
15
+ size: { type: null, required: false },
16
+ content: { type: Object, required: false },
17
+ portal: { type: Boolean, required: false, default: true },
18
+ overlay: { type: Boolean, required: false, default: true },
19
+ transition: { type: Boolean, required: false, default: true },
20
+ dismissible: { type: Boolean, required: false, default: true },
21
+ close: { type: [Object, Boolean], required: false, default: true },
22
+ closeIcon: { type: String, required: false },
23
+ class: { type: null, required: false },
24
+ ui: { type: null, required: false },
25
+ open: { type: Boolean, required: false },
26
+ defaultOpen: { type: Boolean, required: false },
27
+ modal: { type: Boolean, required: false, default: true }
28
+ });
29
+ const emit = defineEmits(["after-leave", "update:open"]);
30
+ const slots = defineSlots();
31
+ const rootProps = useForwardPropsEmits(reactivePick(props, "open", "defaultOpen", "modal"), emit);
69
32
  const contentProps = toRef(() => ({
70
33
  ...props.content,
71
- ...(slots.content || slots.header || (!props.description && !slots.description)) ? { 'aria-describedby': undefined } : {},
72
- }))
34
+ ...slots.content || slots.header || !props.description && !slots.description ? { "aria-describedby": void 0 } : {}
35
+ }));
73
36
  const contentEvents = computed(() => {
74
37
  if (props.dismissible)
75
- return {}
76
-
38
+ return {};
77
39
  return {
78
- pointerDownOutside: (e: Event) => e.preventDefault(),
79
- interactOutside: (e: Event) => e.preventDefault(),
80
- escapeKeyDown: (e: Event) => e.preventDefault(),
81
- }
82
- })
83
-
84
- const { t } = useLocale()
85
- const { theme, generateStyle } = useTheme()
86
- const style = computed(() => generateStyle('modal', props))
40
+ pointerDownOutside: (e) => e.preventDefault(),
41
+ interactOutside: (e) => e.preventDefault(),
42
+ escapeKeyDown: (e) => e.preventDefault()
43
+ };
44
+ });
45
+ const { t } = useLocale();
46
+ const { theme, generateStyle } = useTheme();
47
+ const style = computed(() => generateStyle("modal", props));
87
48
  </script>
88
49
 
89
50
  <template>
@@ -96,10 +57,10 @@ const style = computed(() => generateStyle('modal', props))
96
57
  <slot :open="open"></slot>
97
58
  </DialogTrigger>
98
59
  <DialogPortal :disabled="!props.portal">
99
- <DialogOverlay v-if="props.overlay" :class="style.overlay({ class: props.ui?.overlay })" />
60
+ <DialogOverlay v-if="props.overlay" :class="style.overlay({ class: props.ui?.overlay })" data-part="overlay" />
100
61
 
101
- <DialogContent :class="style.content({ class: props.ui?.content })" v-bind="contentProps" v-on="contentEvents" @after-leave="emit('after-leave')">
102
- <VisuallyHidden v-if="slots.content || slots.header || (!props.title && !slots.title)">
62
+ <DialogContent :class="style.content({ class: props.ui?.content })" data-part="content" v-bind="contentProps" v-on="contentEvents" @after-leave="emit('after-leave')">
63
+ <VisuallyHidden v-if="slots.content || slots.header || !props.title && !slots.title">
103
64
  <DialogTitle />
104
65
  </VisuallyHidden>
105
66
 
@@ -107,11 +68,13 @@ const style = computed(() => generateStyle('modal', props))
107
68
  <div
108
69
  v-if="slots.header || props.title || slots.title || props.description || slots.description || props.close || slots.close"
109
70
  :class="style.header({ class: props.ui?.header })"
71
+ data-part="header"
110
72
  >
111
73
  <slot name="header">
112
74
  <DialogTitle
113
75
  v-if="props.title || slots.title"
114
76
  :class="style.title({ class: props.ui?.title })"
77
+ data-part="title"
115
78
  >
116
79
  <slot name="title">
117
80
  {{ props.title }}
@@ -119,13 +82,14 @@ const style = computed(() => generateStyle('modal', props))
119
82
  </DialogTitle>
120
83
 
121
84
  <DialogClose v-if="props.close || slots.close" as-child>
122
- <slot name="close">
85
+ <slot name="close" :ui="props.ui">
123
86
  <Button
124
87
  variant="ghost"
125
88
  :icon="props.closeIcon || theme.app.icons.close"
126
89
  v-bind="typeof props.close === 'boolean' ? {} : props.close"
127
- :class="style.close({ class: props.ui?.close })"
128
90
  :aria-label="t('modal.close')"
91
+ :class="style.close({ class: props.ui?.close })"
92
+ data-part="close"
129
93
  />
130
94
  </slot>
131
95
  </DialogClose>
@@ -133,6 +97,7 @@ const style = computed(() => generateStyle('modal', props))
133
97
  <DialogDescription
134
98
  v-if="props.description || slots.description"
135
99
  :class="style.description({ class: props.ui?.description })"
100
+ data-part="description"
136
101
  >
137
102
  <slot name="description">
138
103
  {{ props.description }}
@@ -141,11 +106,11 @@ const style = computed(() => generateStyle('modal', props))
141
106
  </slot>
142
107
  </div>
143
108
 
144
- <div v-if="slots.body" :class="style.body({ class: props.ui?.body })">
109
+ <div v-if="slots.body" :class="style.body({ class: props.ui?.body })" data-part="body">
145
110
  <slot name="body"></slot>
146
111
  </div>
147
112
 
148
- <div v-if="slots.footer" :class="style.footer({ class: props.ui?.footer })">
113
+ <div v-if="slots.footer" :class="style.footer({ class: props.ui?.footer })" data-part="footer">
149
114
  <slot name="footer"></slot>
150
115
  </div>
151
116
  </slot>
@@ -0,0 +1,66 @@
1
+ import type { VariantProps } from '@byyuurin/ui-kit';
2
+ import type { DialogContentEmits, DialogContentProps, DialogRootEmits, DialogRootProps } from 'reka-ui';
3
+ import type { modal } from '../theme/index.js';
4
+ import type { ButtonProps, ComponentAttrs, EmitsToProps } from '../types/index.js';
5
+ export interface ModalEmits extends DialogRootEmits {
6
+ 'after-leave': [];
7
+ }
8
+ export interface ModalSlots {
9
+ default?: (props: {
10
+ open: boolean;
11
+ }) => any;
12
+ content?: any;
13
+ header?: any;
14
+ title?: any;
15
+ description?: any;
16
+ close?: (props: {
17
+ ui: ComponentAttrs<typeof modal>['ui'];
18
+ }) => any;
19
+ body?: any;
20
+ footer?: any;
21
+ }
22
+ type ModalVariants = VariantProps<typeof modal>;
23
+ export interface ModalProps extends ComponentAttrs<typeof modal>, DialogRootProps {
24
+ title?: string;
25
+ description?: string;
26
+ size?: ModalVariants['size'];
27
+ content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DialogContentEmits>>;
28
+ /** @default true */
29
+ portal?: boolean;
30
+ /** @default true */
31
+ overlay?: boolean;
32
+ /** @default true */
33
+ transition?: boolean;
34
+ /**
35
+ * When `false`, the modal will not close when clicking outside or pressing escape.
36
+ * @default true
37
+ */
38
+ dismissible?: boolean;
39
+ /**
40
+ * Display a close button to dismiss the modal.
41
+ * @default true
42
+ */
43
+ close?: ButtonProps | boolean;
44
+ /** @default app.icons.close */
45
+ closeIcon?: string;
46
+ }
47
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ModalProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
48
+ "update:open": (value: boolean) => any;
49
+ "after-leave": () => any;
50
+ }, string, import("vue").PublicProps, Readonly<ModalProps> & Readonly<{
51
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
52
+ "onAfter-leave"?: (() => any) | undefined;
53
+ }>, {
54
+ close: ButtonProps | boolean;
55
+ overlay: boolean;
56
+ transition: boolean;
57
+ modal: boolean;
58
+ portal: boolean;
59
+ dismissible: boolean;
60
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ModalSlots>;
61
+ export default _default;
62
+ type __VLS_WithSlots<T, S> = T & {
63
+ new (): {
64
+ $slots: S;
65
+ };
66
+ };
@@ -1,18 +1,14 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue'
3
- import type { OverlayComponentState } from '../composables/useOverlay'
4
- import { useOverlay } from '../composables/useOverlay'
5
-
6
- const { overlays, unmount, close } = useOverlay()
7
- const mountedOverlays = computed(() => overlays.filter((overlay) => overlay.isMounted))
8
-
9
- function onOverlayUnmount(id: OverlayComponentState['id']) {
10
- close(id)
11
- unmount(id)
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { useOverlay } from "../composables/useOverlay";
4
+ const { overlays, unmount, close } = useOverlay();
5
+ const mountedOverlays = computed(() => overlays.filter((overlay) => overlay.isMounted));
6
+ function onOverlayUnmount(id) {
7
+ close(id);
8
+ unmount(id);
12
9
  }
13
-
14
- function onClose(id: OverlayComponentState['id'], value: any) {
15
- close(id, value)
10
+ function onClose(id, value) {
11
+ close(id, value);
16
12
  }
17
13
  </script>
18
14
 
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -1,132 +1,65 @@
1
- <script lang="ts">
2
- import type { PaginationRootEmits, PaginationRootProps } from 'reka-ui'
3
- import type { pagination } from '../theme'
4
- import type { ButtonProps, ComponentAttrs } from '../types'
1
+ <script>
5
2
 
6
- export interface PaginationEmits extends PaginationRootEmits {}
7
-
8
- export interface PaginationSlots {
9
- first?: (props?: {}) => any
10
- prev?: (props?: {}) => any
11
- next?: (props?: {}) => any
12
- last?: (props?: {}) => any
13
- ellipsis?: (props?: {}) => any
14
- item?: (props: {
15
- page: number
16
- pageCount: number
17
- item: {
18
- type: 'ellipsis'
19
- } | {
20
- type: 'page'
21
- value: number
22
- }
23
- index: number
24
- }) => any
25
- }
26
-
27
- export interface PaginationProps extends ComponentAttrs<typeof pagination>, Pick<PaginationRootProps, 'as' | 'defaultPage' | 'disabled' | 'itemsPerPage' | 'page' | 'showEdges' | 'siblingCount' | 'total'> {
28
- /**
29
- * The icon to use for the first page control.
30
- * @default app.icons.doubleLeft
31
- */
32
- firstIcon?: string
33
- /**
34
- * The icon to use for the last page control.
35
- * @default app.icons.doubleRight
36
- */
37
- lastIcon?: string
38
- /**
39
- * The icon to use for the previous page control.
40
- * @default app.icons.chevronLeft
41
- */
42
- prevIcon?: string
43
- /**
44
- * The icon to use for the next page control.
45
- * @default app.icons.chevronRight
46
- */
47
- nextIcon?: string
48
- /**
49
- * The icon to use for the ellipsis control.
50
- * @default app.icons.ellipsis
51
- */
52
- ellipsisIcon?: string
53
- /**
54
- * The size of the pagination controls.
55
- * @default "md"
56
- */
57
- size?: ButtonProps['size']
58
- /**
59
- * The variant of the pagination controls.
60
- * @default "outline"
61
- */
62
- variant?: ButtonProps['variant']
63
- /**
64
- * The variant of the active pagination control.
65
- * @default "solid"
66
- */
67
- activeVariant?: ButtonProps['variant']
68
- /**
69
- * Whether to show the first, previous, next, and last controls.
70
- * @default true
71
- */
72
- showControls?: boolean
73
- /**
74
- * A function to render page controls as links.
75
- */
76
- to?: (page: number) => ButtonProps['to']
77
- }
78
3
  </script>
79
4
 
80
- <script setup lang="ts">
81
- import { reactivePick } from '@vueuse/core'
82
- import { PaginationEllipsis, PaginationFirst, PaginationLast, PaginationList, PaginationListItem, PaginationNext, PaginationPrev, PaginationRoot, useForwardPropsEmits } from 'reka-ui'
83
- import { computed } from 'vue'
84
- import { useLocale } from '../composables/useLocale'
85
- import { useTheme } from '../composables/useTheme'
86
- import Button from './Button.vue'
87
-
88
- const props = withDefaults(defineProps<PaginationProps>(), {
89
- variant: 'outline',
90
- activeVariant: 'solid',
91
- showControls: true,
92
- showEdges: false,
93
- itemsPerPage: 10,
94
- siblingCount: 2,
95
- total: 0,
96
- })
97
-
98
- const emit = defineEmits<PaginationEmits>()
99
- const slots = defineSlots<PaginationSlots>()
100
-
101
- const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultPage', 'disabled', 'itemsPerPage', 'page', 'showEdges', 'siblingCount', 'total'), emit)
102
-
103
- const { dir } = useLocale()
104
- const { theme, generateStyle } = useTheme()
105
- const style = computed(() => generateStyle('pagination', props))
106
-
107
- const firstIcon = computed(() => props.firstIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronDoubleRight : theme.value.app.icons.chevronDoubleLeft))
108
- const prevIcon = computed(() => props.prevIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronRight : theme.value.app.icons.chevronLeft))
109
- const nextIcon = computed(() => props.nextIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight))
110
- const lastIcon = computed(() => props.lastIcon || (dir.value === 'rtl' ? theme.value.app.icons.chevronDoubleLeft : theme.value.app.icons.chevronDoubleRight))
111
- const ellipsisIcon = computed(() => props.ellipsisIcon || theme.value.app.icons.ellipsis)
5
+ <script setup>
6
+ import { reactivePick } from "@vueuse/core";
7
+ import { PaginationEllipsis, PaginationFirst, PaginationLast, PaginationList, PaginationListItem, PaginationNext, PaginationPrev, PaginationRoot, useForwardPropsEmits } from "reka-ui";
8
+ import { computed } from "vue";
9
+ import { useLocale } from "../composables/useLocale";
10
+ import { useTheme } from "../composables/useTheme";
11
+ import Button from "./Button.vue";
12
+ const props = defineProps({
13
+ firstIcon: { type: String, required: false },
14
+ lastIcon: { type: String, required: false },
15
+ prevIcon: { type: String, required: false },
16
+ nextIcon: { type: String, required: false },
17
+ ellipsisIcon: { type: String, required: false },
18
+ size: { type: null, required: false },
19
+ variant: { type: null, required: false, default: "outline" },
20
+ activeVariant: { type: null, required: false, default: "solid" },
21
+ showControls: { type: Boolean, required: false, default: true },
22
+ to: { type: Function, required: false },
23
+ class: { type: null, required: false },
24
+ ui: { type: null, required: false },
25
+ as: { type: null, required: false },
26
+ defaultPage: { type: Number, required: false },
27
+ disabled: { type: Boolean, required: false },
28
+ itemsPerPage: { type: Number, required: true, default: 10 },
29
+ page: { type: Number, required: false },
30
+ showEdges: { type: Boolean, required: false, default: false },
31
+ siblingCount: { type: Number, required: false, default: 2 },
32
+ total: { type: Number, required: false, default: 0 }
33
+ });
34
+ const emit = defineEmits(["update:page"]);
35
+ const slots = defineSlots();
36
+ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "defaultPage", "disabled", "itemsPerPage", "page", "showEdges", "siblingCount", "total"), emit);
37
+ const { dir } = useLocale();
38
+ const { theme, generateStyle } = useTheme();
39
+ const style = computed(() => generateStyle("pagination", props));
40
+ const firstIcon = computed(() => props.firstIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronDoubleRight : theme.value.app.icons.chevronDoubleLeft));
41
+ const prevIcon = computed(() => props.prevIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronRight : theme.value.app.icons.chevronLeft));
42
+ const nextIcon = computed(() => props.nextIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight));
43
+ const lastIcon = computed(() => props.lastIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronDoubleLeft : theme.value.app.icons.chevronDoubleRight));
44
+ const ellipsisIcon = computed(() => props.ellipsisIcon || theme.value.app.icons.ellipsis);
112
45
  </script>
113
46
 
114
47
  <template>
115
- <PaginationRoot v-slot="{ page, pageCount }" v-bind="rootProps" :class="style.root({ class: [props.class, props.ui?.root] })">
116
- <PaginationList v-slot="{ items }" :class="style.list({ class: props.ui?.list })">
117
- <PaginationFirst v-if="props.showControls || !!slots.first" :class="style.first({ class: props.ui?.first })" as-child>
48
+ <PaginationRoot v-slot="{ page, pageCount }" v-bind="rootProps" :class="style.root({ class: [props.class, props.ui?.root] })" data-part="root">
49
+ <PaginationList v-slot="{ items }" :class="style.list({ class: props.ui?.list })" data-part="list">
50
+ <PaginationFirst v-if="props.showControls || !!slots.first" :class="style.first({ class: props.ui?.first })" data-part="first" as-child>
118
51
  <slot name="first">
119
52
  <Button :variant="props.variant" :size="props.size" :icon="firstIcon" :to="props.to?.(1)" />
120
53
  </slot>
121
54
  </PaginationFirst>
122
- <PaginationPrev v-if="props.showControls || !!slots.prev" :class="style.prev({ class: props.ui?.prev })" as-child>
55
+ <PaginationPrev v-if="props.showControls || !!slots.prev" :class="style.prev({ class: props.ui?.prev })" data-part="perv" as-child>
123
56
  <slot name="prev">
124
- <Button :variant="props.variant" :size="props.size" :icon="prevIcon" :to="page > 1 ? props.to?.(page - 1) : undefined" />
57
+ <Button :variant="props.variant" :size="props.size" :icon="prevIcon" :to="page > 1 ? props.to?.(page - 1) : void 0" />
125
58
  </slot>
126
59
  </PaginationPrev>
127
60
 
128
61
  <template v-for="(item, index) in items">
129
- <PaginationListItem v-if="item.type === 'page'" :key="index" :class="style.item({ class: props.ui?.item })" :value="item.value" as-child>
62
+ <PaginationListItem v-if="item.type === 'page'" :key="index" :value="item.value" :class="style.item({ class: props.ui?.item })" data-part="item" as-child>
130
63
  <slot name="item" v-bind="{ item, index, page, pageCount }">
131
64
  <Button
132
65
  :variant="props.page === item.value ? props.activeVariant : props.variant"
@@ -141,12 +74,13 @@ const ellipsisIcon = computed(() => props.ellipsisIcon || theme.value.app.icons.
141
74
  <PaginationEllipsis
142
75
  v-else
143
76
  :key="item.type"
144
- :class="[
145
- style.item({ class: props.ui?.item }),
146
- style.ellipsis({ class: props.ui?.ellipsis }),
147
- ]"
148
77
  :index="index"
149
78
  :disabled="props.disabled"
79
+ :class="[
80
+ style.item({ class: props.ui?.item }),
81
+ style.ellipsis({ class: props.ui?.ellipsis })
82
+ ]"
83
+ data-part="ellipsis"
150
84
  as-child
151
85
  >
152
86
  <slot name="ellipsis">
@@ -159,12 +93,12 @@ const ellipsisIcon = computed(() => props.ellipsisIcon || theme.value.app.icons.
159
93
  </PaginationEllipsis>
160
94
  </template>
161
95
 
162
- <PaginationNext v-if="props.showControls || !!slots.next" :class="style.next({ class: props.ui?.next })" as-child>
96
+ <PaginationNext v-if="props.showControls || !!slots.next" :class="style.next({ class: props.ui?.next })" data-part="next" as-child>
163
97
  <slot name="next">
164
- <Button :variant="props.variant" :size="props.size" :icon="nextIcon" :to="page < pageCount ? props.to?.(page + 1) : undefined" />
98
+ <Button :variant="props.variant" :size="props.size" :icon="nextIcon" :to="page < pageCount ? props.to?.(page + 1) : void 0" />
165
99
  </slot>
166
100
  </PaginationNext>
167
- <PaginationLast v-if="props.showControls || !!slots.last" :class="style.last({ class: props.ui?.last })" as-child>
101
+ <PaginationLast v-if="props.showControls || !!slots.last" :class="style.last({ class: props.ui?.last })" data-part="last" as-child>
168
102
  <slot name="last">
169
103
  <Button :variant="props.variant" :size="props.size" :icon="lastIcon" :to="props.to?.(pageCount)" />
170
104
  </slot>