@byyuurin/ui 0.0.6 → 0.0.8

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 (198) hide show
  1. package/README.md +4 -5
  2. package/dist/module.cjs +5 -0
  3. package/dist/module.json +12 -0
  4. package/dist/{nuxt.mjs → module.mjs} +8 -8
  5. package/dist/module.mjs.map +1 -0
  6. package/dist/runtime/app/injections.d.ts +16 -0
  7. package/dist/runtime/app/injections.js +31 -0
  8. package/dist/runtime/components/Accordion.vue +27 -38
  9. package/dist/runtime/components/Alert.vue +23 -16
  10. package/dist/runtime/components/App.vue +15 -15
  11. package/dist/runtime/components/Avatar.vue +73 -0
  12. package/dist/runtime/components/AvatarGroup.vue +90 -0
  13. package/dist/runtime/components/Badge.vue +15 -10
  14. package/dist/runtime/components/Breadcrumb.vue +105 -0
  15. package/dist/runtime/components/Button.vue +22 -23
  16. package/dist/runtime/components/ButtonGroup.vue +12 -10
  17. package/dist/runtime/components/Card.vue +16 -8
  18. package/dist/runtime/components/Carousel.vue +19 -12
  19. package/dist/runtime/components/Checkbox.vue +16 -12
  20. package/dist/runtime/components/Chip.vue +17 -12
  21. package/dist/runtime/components/Collapsible.vue +56 -0
  22. package/dist/runtime/components/Drawer.vue +18 -17
  23. package/dist/runtime/components/Input.vue +28 -28
  24. package/dist/runtime/components/InputNumber.vue +169 -0
  25. package/dist/runtime/components/Kbd.vue +51 -0
  26. package/dist/runtime/components/Link.vue +301 -72
  27. package/dist/runtime/components/LinkBase.vue +88 -0
  28. package/dist/runtime/components/Modal.vue +11 -9
  29. package/dist/runtime/components/ModalProvider.vue +2 -1
  30. package/dist/runtime/components/Pagination.vue +30 -30
  31. package/dist/runtime/components/PinInput.vue +7 -7
  32. package/dist/runtime/components/Popover.vue +7 -7
  33. package/dist/runtime/components/Progress.vue +165 -0
  34. package/dist/runtime/components/RadioGroup.vue +33 -29
  35. package/dist/runtime/components/Select.vue +40 -40
  36. package/dist/runtime/components/Separator.vue +63 -0
  37. package/dist/runtime/components/Skeleton.vue +33 -0
  38. package/dist/runtime/components/Slider.vue +6 -6
  39. package/dist/runtime/components/Switch.vue +14 -15
  40. package/dist/runtime/components/Table.vue +300 -0
  41. package/dist/runtime/components/Tabs.vue +25 -21
  42. package/dist/runtime/components/Textarea.vue +11 -11
  43. package/dist/runtime/components/Toast.vue +15 -14
  44. package/dist/runtime/components/Toaster.vue +5 -39
  45. package/dist/runtime/components/Tooltip.vue +7 -7
  46. package/dist/runtime/composables/useAvatarGroup.d.ts +4 -0
  47. package/dist/runtime/composables/useAvatarGroup.js +8 -0
  48. package/dist/runtime/composables/useButtonGroup.d.ts +4 -12
  49. package/dist/runtime/composables/{useButtonGroup.mjs → useButtonGroup.js} +1 -6
  50. package/dist/runtime/composables/useComponentIcons.d.ts +9 -9
  51. package/dist/runtime/composables/useComponentIcons.js +24 -0
  52. package/dist/runtime/composables/useKbd.d.ts +35 -0
  53. package/dist/runtime/composables/useKbd.js +49 -0
  54. package/dist/runtime/composables/useLocale.d.ts +8 -0
  55. package/dist/runtime/composables/useLocale.js +22 -0
  56. package/dist/runtime/composables/useModal.d.ts +2 -7
  57. package/dist/runtime/composables/{useModal.mjs → useModal.js} +1 -6
  58. package/dist/runtime/composables/useTheme.d.ts +2 -6
  59. package/dist/runtime/composables/useTheme.js +16 -0
  60. package/dist/runtime/composables/useToast.d.ts +1 -1
  61. package/dist/runtime/index.d.ts +40 -0
  62. package/dist/runtime/index.js +40 -0
  63. package/dist/runtime/locale/en.d.ts +2 -0
  64. package/dist/runtime/locale/en.js +28 -0
  65. package/dist/runtime/locale/index.d.ts +2 -0
  66. package/dist/runtime/locale/index.js +2 -0
  67. package/dist/runtime/locale/zh-tw.d.ts +2 -0
  68. package/dist/runtime/locale/zh-tw.js +28 -0
  69. package/dist/runtime/theme/accordion.d.ts +5 -5
  70. package/dist/runtime/theme/{accordion.mjs → accordion.js} +2 -2
  71. package/dist/runtime/theme/alert.d.ts +2 -2
  72. package/dist/runtime/theme/{alert.mjs → alert.js} +4 -4
  73. package/dist/runtime/theme/app.d.ts +8 -5
  74. package/dist/runtime/theme/app.js +18 -0
  75. package/dist/runtime/theme/avatar-group.d.ts +52 -0
  76. package/dist/runtime/theme/avatar-group.js +32 -0
  77. package/dist/runtime/theme/avatar.d.ts +56 -0
  78. package/dist/runtime/theme/avatar.js +34 -0
  79. package/dist/runtime/theme/badge.d.ts +45 -21
  80. package/dist/runtime/theme/{badge.mjs → badge.js} +2 -2
  81. package/dist/runtime/theme/breadcrumb.d.ts +67 -0
  82. package/dist/runtime/theme/breadcrumb.js +44 -0
  83. package/dist/runtime/theme/button-group.d.ts +2 -2
  84. package/dist/runtime/theme/button.d.ts +61 -115
  85. package/dist/runtime/theme/button.js +164 -0
  86. package/dist/runtime/theme/card.d.ts +38 -38
  87. package/dist/runtime/theme/card.js +37 -0
  88. package/dist/runtime/theme/carousel.d.ts +2 -2
  89. package/dist/runtime/theme/{carousel.mjs → carousel.js} +2 -2
  90. package/dist/runtime/theme/checkbox.d.ts +1 -1
  91. package/dist/runtime/theme/{checkbox.mjs → checkbox.js} +3 -3
  92. package/dist/runtime/theme/chip.d.ts +47 -14
  93. package/dist/runtime/theme/{chip.mjs → chip.js} +7 -9
  94. package/dist/runtime/theme/collapsible.d.ts +38 -0
  95. package/dist/runtime/theme/collapsible.js +10 -0
  96. package/dist/runtime/theme/drawer.d.ts +43 -43
  97. package/dist/runtime/theme/{drawer.mjs → drawer.js} +33 -22
  98. package/dist/runtime/theme/index.d.ts +37 -27
  99. package/dist/runtime/theme/index.js +37 -0
  100. package/dist/runtime/theme/input-number.d.ts +141 -0
  101. package/dist/runtime/theme/input-number.js +95 -0
  102. package/dist/runtime/theme/input.d.ts +77 -105
  103. package/dist/runtime/theme/{input.mjs → input.js} +25 -25
  104. package/dist/runtime/theme/kbd.d.ts +39 -0
  105. package/dist/runtime/theme/kbd.js +26 -0
  106. package/dist/runtime/theme/link.d.ts +2 -2
  107. package/dist/runtime/theme/{link.mjs → link.js} +1 -1
  108. package/dist/runtime/theme/modal.d.ts +31 -8
  109. package/dist/runtime/theme/{modal.mjs → modal.js} +4 -9
  110. package/dist/runtime/theme/pagination.d.ts +17 -17
  111. package/dist/runtime/theme/pinInput.d.ts +42 -42
  112. package/dist/runtime/theme/{pinInput.mjs → pinInput.js} +10 -10
  113. package/dist/runtime/theme/popover.d.ts +8 -8
  114. package/dist/runtime/theme/{popover.mjs → popover.js} +1 -1
  115. package/dist/runtime/theme/progress.d.ts +122 -0
  116. package/dist/runtime/theme/progress.js +95 -0
  117. package/dist/runtime/theme/radio-group.d.ts +1 -1
  118. package/dist/runtime/theme/{radio-group.mjs → radio-group.js} +1 -1
  119. package/dist/runtime/theme/scroll-area.d.ts +17 -17
  120. package/dist/runtime/theme/{scroll-area.mjs → scroll-area.js} +2 -2
  121. package/dist/runtime/theme/select.d.ts +93 -108
  122. package/dist/runtime/theme/{select.mjs → select.js} +31 -31
  123. package/dist/runtime/theme/separator.d.ts +95 -0
  124. package/dist/runtime/theme/separator.js +53 -0
  125. package/dist/runtime/theme/skeleton.d.ts +8 -0
  126. package/dist/runtime/theme/skeleton.js +7 -0
  127. package/dist/runtime/theme/slider.d.ts +1 -1
  128. package/dist/runtime/theme/{slider.mjs → slider.js} +3 -3
  129. package/dist/runtime/theme/switch.d.ts +1 -1
  130. package/dist/runtime/theme/{switch.mjs → switch.js} +3 -3
  131. package/dist/runtime/theme/table.d.ts +89 -0
  132. package/dist/runtime/theme/table.js +35 -0
  133. package/dist/runtime/theme/tabs.d.ts +70 -53
  134. package/dist/runtime/theme/{tabs.mjs → tabs.js} +12 -12
  135. package/dist/runtime/theme/textarea.d.ts +43 -37
  136. package/dist/runtime/theme/{textarea.mjs → textarea.js} +10 -10
  137. package/dist/runtime/theme/toast.d.ts +2 -2
  138. package/dist/runtime/theme/{toast.mjs → toast.js} +3 -3
  139. package/dist/runtime/theme/toaster.d.ts +42 -27
  140. package/dist/runtime/theme/tooltip.d.ts +11 -11
  141. package/dist/runtime/theme/tooltip.js +11 -0
  142. package/dist/runtime/types/components.d.ts +37 -27
  143. package/dist/runtime/types/index.d.ts +5 -4
  144. package/dist/runtime/types/index.js +3 -0
  145. package/dist/runtime/types/locale.d.ts +23 -0
  146. package/dist/runtime/types/locale.js +0 -0
  147. package/dist/runtime/types/utils.d.ts +1 -1
  148. package/dist/runtime/types/utils.js +0 -0
  149. package/dist/runtime/utils/index.d.ts +9 -4
  150. package/dist/runtime/utils/{index.mjs → index.js} +9 -7
  151. package/dist/runtime/utils/link.d.ts +22 -7
  152. package/dist/runtime/utils/link.js +30 -0
  153. package/dist/runtime/utils/styler.d.ts +1 -1
  154. package/dist/runtime/utils/translator.d.ts +18 -0
  155. package/dist/runtime/utils/translator.js +8 -0
  156. package/dist/runtime/vue/stubs.d.ts +9 -0
  157. package/dist/runtime/vue/stubs.js +16 -0
  158. package/dist/shared/ui.ba24b380.mjs +4 -0
  159. package/dist/shared/ui.ba24b380.mjs.map +1 -0
  160. package/dist/types.d.mts +1 -0
  161. package/dist/types.d.ts +1 -0
  162. package/dist/unocss.d.mts +6 -11
  163. package/dist/unocss.d.ts +6 -11
  164. package/dist/unocss.mjs +40 -21
  165. package/dist/unocss.mjs.map +1 -1
  166. package/dist/unplugin.mjs +35 -8
  167. package/dist/unplugin.mjs.map +1 -1
  168. package/dist/vite.d.mts +0 -1
  169. package/dist/vite.d.ts +0 -1
  170. package/dist/vite.mjs +3 -1
  171. package/dist/vite.mjs.map +1 -1
  172. package/package.json +50 -38
  173. package/dist/index.d.ts +0 -29
  174. package/dist/index.mjs +0 -29
  175. package/dist/nuxt.mjs.map +0 -1
  176. package/dist/runtime/composables/useComponentIcons.mjs +0 -24
  177. package/dist/runtime/composables/useTheme.mjs +0 -26
  178. package/dist/runtime/theme/app.mjs +0 -15
  179. package/dist/runtime/theme/button.mjs +0 -148
  180. package/dist/runtime/theme/card.mjs +0 -14
  181. package/dist/runtime/theme/index.mjs +0 -27
  182. package/dist/runtime/theme/tooltip.mjs +0 -11
  183. package/dist/runtime/types/components.mjs +0 -27
  184. package/dist/runtime/types/index.mjs +0 -2
  185. package/dist/runtime/utils/link.mjs +0 -4
  186. package/dist/shared/ui.D4zm1r0C.mjs +0 -4
  187. package/dist/shared/ui.D4zm1r0C.mjs.map +0 -1
  188. /package/dist/{nuxt.d.mts → module.d.mts} +0 -0
  189. /package/dist/{nuxt.d.ts → module.d.ts} +0 -0
  190. /package/dist/runtime/composables/{useToast.mjs → useToast.js} +0 -0
  191. /package/dist/runtime/theme/{button-group.mjs → button-group.js} +0 -0
  192. /package/dist/runtime/theme/{pagination.mjs → pagination.js} +0 -0
  193. /package/dist/runtime/theme/{toaster.mjs → toaster.js} +0 -0
  194. /package/dist/runtime/types/{utils.mjs → components.js} +0 -0
  195. /package/dist/runtime/utils/{extend-theme.mjs → extend-theme.js} +0 -0
  196. /package/dist/runtime/utils/{styler.mjs → styler.js} +0 -0
  197. /package/dist/runtime/{composables/defineInjection.d.ts → utils/vue.d.ts} +0 -0
  198. /package/dist/runtime/{composables/defineInjection.mjs → utils/vue.js} +0 -0
@@ -4,6 +4,13 @@ import type { PinInputRootProps } from 'reka-ui'
4
4
  import type { pinInput } from '../theme'
5
5
  import type { ComponentAttrs } from '../types'
6
6
 
7
+ export interface PinInputEmits {
8
+ (event: 'update:modelValue', value: string[]): void
9
+ (event: 'complete', value: string[]): void
10
+ (event: 'change', payload: Event): void
11
+ (event: 'blur', payload: Event): void
12
+ }
13
+
7
14
  type PinInputVariants = VariantProps<typeof pinInput>
8
15
 
9
16
  export interface PinInputProps extends ComponentAttrs<typeof pinInput>, Pick<PinInputRootProps, 'as' | 'defaultValue' | 'disabled' | 'id' | 'mask' | 'modelValue' | 'name' | 'otp' | 'placeholder' | 'required' | 'type'> {
@@ -13,13 +20,6 @@ export interface PinInputProps extends ComponentAttrs<typeof pinInput>, Pick<Pin
13
20
  underline?: boolean
14
21
  highlight?: boolean
15
22
  }
16
-
17
- export interface PinInputEmits {
18
- (event: 'update:modelValue', value: string[]): void
19
- (event: 'complete', value: string[]): void
20
- (event: 'change', payload: Event): void
21
- (event: 'blur', payload: Event): void
22
- }
23
23
  </script>
24
24
 
25
25
  <script setup lang="ts">
@@ -3,6 +3,13 @@ import type { HoverCardRootProps, PopoverArrowProps, PopoverContentProps, Popove
3
3
  import type { popover } from '../theme'
4
4
  import type { ComponentAttrs } from '../types'
5
5
 
6
+ export interface PopoverEmits extends PopoverRootEmits {}
7
+
8
+ export interface PopoverSlots {
9
+ default?: (props: { open: boolean }) => any
10
+ content?: (props?: {}) => any
11
+ }
12
+
6
13
  export interface PopoverProps extends ComponentAttrs<typeof popover>, PopoverRootProps, Pick<HoverCardRootProps, 'openDelay' | 'closeDelay'> {
7
14
  /**
8
15
  * The display mode of the popover.
@@ -20,13 +27,6 @@ export interface PopoverProps extends ComponentAttrs<typeof popover>, PopoverRoo
20
27
  */
21
28
  dismissible?: boolean
22
29
  }
23
-
24
- export interface PopoverEmits extends PopoverRootEmits {}
25
-
26
- export interface PopoverSlots {
27
- default?: (props: { open: boolean }) => any
28
- content?: (props?: {}) => any
29
- }
30
30
  </script>
31
31
 
32
32
  <script setup lang="ts">
@@ -0,0 +1,165 @@
1
+ <script lang="ts">
2
+ import type { VariantProps } from '@byyuurin/ui-kit'
3
+ import type { PrimitiveProps, ProgressRootEmits, ProgressRootProps } from 'reka-ui'
4
+ import type { progress } from '../theme'
5
+ import type { ComponentAttrs } from '../types'
6
+
7
+ export interface ProgressEmits extends ProgressRootEmits {}
8
+
9
+ export type ProgressSlots = {
10
+ status?: (props: { percent?: number }) => any
11
+ } & {
12
+ [key: `step-${number}`]: (props: { step: string | number }) => any
13
+ }
14
+
15
+ type ProgressVariants = VariantProps<typeof progress>
16
+
17
+ export interface ProgressProps extends ComponentAttrs<typeof progress>, Pick<ProgressRootProps, 'getValueLabel' | 'modelValue'> {
18
+ /**
19
+ * The element or component this component should render as.
20
+ * @default "div"
21
+ */
22
+ as?: PrimitiveProps['as']
23
+ /** The maximum progress value. */
24
+ max?: number | string[]
25
+ /**
26
+ * @default "md"
27
+ */
28
+ size?: ProgressVariants['size']
29
+ /**
30
+ * The orientation of the progress bar.
31
+ * @default "horizontal"
32
+ */
33
+ orientation?: ProgressVariants['orientation']
34
+ /** Display the current progress value. */
35
+ status?: boolean
36
+ /** Whether the progress is visually inverted. */
37
+ inverted?: boolean
38
+ }
39
+ </script>
40
+
41
+ <script setup lang="ts">
42
+ import { reactivePick } from '@vueuse/core'
43
+ import { Primitive, ProgressIndicator, ProgressRoot, useForwardPropsEmits } from 'reka-ui'
44
+ import { computed } from 'vue'
45
+ import { useLocale } from '../composables/useLocale'
46
+ import { useTheme } from '../composables/useTheme'
47
+
48
+ const props = withDefaults(defineProps<ProgressProps>(), {
49
+ modelValue: null,
50
+ orientation: 'horizontal',
51
+ })
52
+ const emit = defineEmits<ProgressEmits>()
53
+ const slots = defineSlots<ProgressSlots>()
54
+
55
+ const rootProps = useForwardPropsEmits(reactivePick(props, 'getValueLabel', 'modelValue'), emit)
56
+
57
+ const isIndeterminate = computed(() => rootProps.value.modelValue === null || Number.isNaN(+rootProps.value.modelValue))
58
+ const hasSteps = computed(() => Array.isArray(props.max))
59
+
60
+ const max = computed(() => {
61
+ if (isIndeterminate.value || !props.max)
62
+ return
63
+
64
+ if (Array.isArray(props.max))
65
+ return props.max.length - 1
66
+
67
+ return Number(props.max)
68
+ })
69
+
70
+ const percent = computed(() => {
71
+ if (isIndeterminate.value)
72
+ return
73
+
74
+ if (rootProps.value.modelValue! < 0)
75
+ return 0
76
+
77
+ const _max = max.value ?? 100
78
+
79
+ if (rootProps.value.modelValue! > _max)
80
+ return 100
81
+
82
+ return Math.round((rootProps.value.modelValue! / _max) * 100)
83
+ })
84
+
85
+ const { dir } = useLocale()
86
+ const { theme, createStyler } = useTheme()
87
+ const style = computed(() => {
88
+ const styler = createStyler(theme.value.progress)
89
+ return styler(props)
90
+ })
91
+
92
+ const indicatorStyle = computed(() => {
93
+ if (percent.value === undefined)
94
+ return
95
+
96
+ if (props.orientation === 'vertical')
97
+ return { transform: `translateY(${props.inverted ? '' : '-'}${100 - percent.value}%)` }
98
+
99
+ if (dir.value === 'rtl')
100
+ return { transform: `translateX(${props.inverted ? '-' : ''}${100 - percent.value}%)` }
101
+
102
+ return { transform: `translateX(${props.inverted ? '' : '-'}${100 - percent.value}%)` }
103
+ })
104
+
105
+ const statusStyle = computed(() => {
106
+ return {
107
+ [props.orientation === 'vertical' ? 'height' : 'width']: percent.value ? `${percent.value}%` : 'fit-content',
108
+ }
109
+ })
110
+
111
+ function isActive(index: number) {
112
+ return index === Number(props.modelValue)
113
+ }
114
+
115
+ function isFirst(index: number) {
116
+ return index === 0
117
+ }
118
+
119
+ function isLast(index: number) {
120
+ return index === max.value
121
+ }
122
+
123
+ function stepVariant(index: number | string) {
124
+ index = Number(index)
125
+
126
+ if (isActive(index) && !isFirst(index))
127
+ return 'active'
128
+
129
+ if (isFirst(index) && isActive(index))
130
+ return 'first'
131
+
132
+ if (isLast(index) && isActive(index))
133
+ return 'last'
134
+
135
+ return 'other'
136
+ }
137
+ </script>
138
+
139
+ <template>
140
+ <Primitive :as="props.as" :class="style.wrapper({ class: [props.class, props.ui?.wrapper] })">
141
+ <div v-if="!isIndeterminate && (props.status || slots.status)" :class="style.status({ class: props.ui?.status })" :style="statusStyle">
142
+ <slot name="status" :percent="percent">
143
+ {{ percent }}%
144
+ </slot>
145
+ </div>
146
+
147
+ <ProgressRoot
148
+ v-bind="rootProps"
149
+ :model-value="Number.isNaN(rootProps.modelValue) ? null : rootProps.modelValue"
150
+ :max="max"
151
+ :class="style.root({ class: props.ui?.root })"
152
+ style="transform: translateZ(0)"
153
+ >
154
+ <ProgressIndicator :class="style.indicator({ class: props.ui?.indicator })" :style="indicatorStyle" />
155
+ </ProgressRoot>
156
+
157
+ <div v-if="hasSteps" :class="style.steps({ class: props.ui?.steps })">
158
+ <div v-for="(step, index) in props.max" :key="index" :class="style.step({ class: props.ui?.step, step: stepVariant(index) })">
159
+ <slot :name="`step-${index}`" :step="step">
160
+ {{ step }}
161
+ </slot>
162
+ </div>
163
+ </div>
164
+ </Primitive>
165
+ </template>
@@ -4,6 +4,31 @@ import type { AcceptableValue, PrimitiveProps, RadioGroupRootProps } from 'reka-
4
4
  import type { radioGroup } from '../theme'
5
5
  import type { ComponentAttrs } from '../types'
6
6
 
7
+ export interface RadioGroupEmits {
8
+ (event: 'update:modelValue', payload: string): void
9
+ (event: 'change', payload: Event): void
10
+ }
11
+
12
+ type SlotProps<T> = (props: { item: NormalizeItem<T>, modelValue?: AcceptableValue }) => any
13
+
14
+ export interface RadioGroupSlots<T> {
15
+ legend?: (props?: {}) => any
16
+ label?: SlotProps<T>
17
+ description?: SlotProps<T>
18
+ }
19
+
20
+ type NormalizeItem<T> = { id: string } & (
21
+ T extends RadioOption
22
+ ? T
23
+ : {
24
+ id: string
25
+ label: string
26
+ value: any
27
+ description: string
28
+ disabled: false
29
+ }
30
+ )
31
+
7
32
  type RadioGroupVariants = VariantProps<typeof radioGroup>
8
33
 
9
34
  export interface RadioOption {
@@ -14,56 +39,35 @@ export interface RadioOption {
14
39
  }
15
40
 
16
41
  export interface RadioGroupProps<T> extends ComponentAttrs<typeof radioGroup>, Pick<RadioGroupRootProps, 'defaultValue' | 'disabled' | 'loop' | 'modelValue' | 'name' | 'required'> {
42
+ /**
43
+ * The element or component this component should render as.
44
+ * @default "div"
45
+ */
17
46
  as?: PrimitiveProps['as']
18
47
  legend?: string
19
48
  /**
20
49
  * When `options` is an array of objects, select the field to use as the value.
21
- * @default 'value'
50
+ * @default "value"
22
51
  */
23
52
  valueKey?: string
24
53
  /**
25
54
  * When `options` is an array of objects, select the field to use as the label.
26
- * @default 'label'
55
+ * @default "label"
27
56
  */
28
57
  labelKey?: string
29
58
  /**
30
59
  * When `options` is an array of objects, select the field to use as the description.
31
- * @default 'description'
60
+ * @default "description"
32
61
  */
33
62
  descriptionKey?: string
34
63
  options?: T[]
35
64
  size?: RadioGroupVariants['size']
36
65
  /**
37
66
  * The orientation the radio buttons are laid out.
38
- * @default 'vertical'
67
+ * @default "vertical"
39
68
  */
40
69
  orientation?: RadioGroupRootProps['orientation']
41
70
  }
42
-
43
- export interface RadioGroupEmits {
44
- (event: 'update:modelValue', payload: string): void
45
- (event: 'change', payload: Event): void
46
- }
47
-
48
- type SlotProps<T> = (props: { item: NormalizeItem<T>, modelValue?: AcceptableValue }) => any
49
-
50
- export interface RadioGroupSlots<T> {
51
- legend?: (props?: {}) => any
52
- label?: SlotProps<T>
53
- description?: SlotProps<T>
54
- }
55
-
56
- type NormalizeItem<T> = { id: string } & (
57
- T extends RadioOption
58
- ? T
59
- : {
60
- id: string
61
- label: string
62
- value: any
63
- description: string
64
- disabled: false
65
- }
66
- )
67
71
  </script>
68
72
 
69
73
  <script lang="ts" setup generic="T extends RadioOption | AcceptableValue">
@@ -5,6 +5,26 @@ import type { UseComponentIconsProps } from '../composables/useComponentIcons'
5
5
  import type { select } from '../theme'
6
6
  import type { ComponentAttrs, MaybeArray, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectOptionKey } from '../types'
7
7
 
8
+ export interface SelectEmits<T, V, M extends boolean> {
9
+ (event: 'update:open', value: boolean): void
10
+ (event: 'update:modelValue', payload: SelectModelValue<T, V, M, T extends { value: infer U } ? U : never>): void
11
+ (event: 'change', payload: Event): void
12
+ (event: 'blur', payload: FocusEvent): void
13
+ (event: 'focus', payload: FocusEvent): void
14
+ }
15
+
16
+ type SlotProps<T> = (props: { item: T, index: number }) => any
17
+
18
+ export interface SelectSlots<T, M extends boolean> {
19
+ 'leading'?: (props: { modelValue?: M extends true ? AcceptableValue[] : AcceptableValue, open: boolean, ui: ComponentAttrs<typeof select>['ui'] }) => any
20
+ 'default'?: (props: { modelValue?: M extends true ? AcceptableValue[] : AcceptableValue, open: boolean }) => any
21
+ 'trailing'?: (props: { modelValue?: M extends true ? AcceptableValue[] : AcceptableValue, open: boolean, ui: ComponentAttrs<typeof select>['ui'] }) => any
22
+ 'item'?: SlotProps<T>
23
+ 'item-leading'?: SlotProps<T>
24
+ 'item-label'?: SlotProps<T>
25
+ 'item-trailing'?: SlotProps<T>
26
+ }
27
+
8
28
  type SelectVariants = VariantProps<typeof select>
9
29
 
10
30
  export interface SelectOption {
@@ -12,7 +32,7 @@ export interface SelectOption {
12
32
  icon?: string
13
33
  /**
14
34
  * The option type.
15
- * @default 'option'
35
+ * @default "option"
16
36
  */
17
37
  type?: 'label' | 'separator' | 'option'
18
38
  value?: string
@@ -34,9 +54,9 @@ export interface SelectProps<
34
54
  size?: SelectVariants['size']
35
55
  /**
36
56
  * The icon displayed to open the menu.
37
- * @default app.icons.down
57
+ * @default app.icons.chevronDown
38
58
  */
39
- suffixIcon?: string
59
+ trailingIcon?: string
40
60
  /**
41
61
  * The icon displayed when an item is selected.
42
62
  * @default app.icons.check
@@ -59,7 +79,7 @@ export interface SelectProps<
59
79
  portal?: boolean
60
80
  /**
61
81
  * When `options` is an array of objects, select the field to use as the value.
62
- * @default 'value'
82
+ * @default "value"
63
83
  */
64
84
  valueKey?: V
65
85
  /**
@@ -78,26 +98,6 @@ export interface SelectProps<
78
98
  highlight?: boolean
79
99
  underline?: boolean
80
100
  }
81
-
82
- export interface SelectEmits<T, V, M extends boolean> {
83
- (event: 'update:open', value: boolean): void
84
- (event: 'update:modelValue', payload: SelectModelValue<T, V, M, T extends { value: infer U } ? U : never>): void
85
- (event: 'change', payload: Event): void
86
- (event: 'blur', payload: FocusEvent): void
87
- (event: 'focus', payload: FocusEvent): void
88
- }
89
-
90
- type SlotProps<T> = (props: { item: T, index: number }) => any
91
-
92
- export interface SelectSlots<T, M extends boolean> {
93
- prefix?: (props: { modelValue?: M extends true ? AcceptableValue[] : AcceptableValue, open: boolean, ui: ComponentAttrs<typeof select>['ui'] }) => any
94
- default?: (props: { modelValue?: M extends true ? AcceptableValue[] : AcceptableValue, open: boolean }) => any
95
- suffix?: (props: { modelValue?: M extends true ? AcceptableValue[] : AcceptableValue, open: boolean, ui: ComponentAttrs<typeof select>['ui'] }) => any
96
- item?: SlotProps<T>
97
- itemPrefix?: SlotProps<T>
98
- itemLabel?: SlotProps<T>
99
- itemSuffix?: SlotProps<T>
100
- }
101
101
  </script>
102
102
 
103
103
  <script lang="ts" setup generic="T extends MaybeArrayOfArrayItem<I>, I extends MaybeArrayOfArray<SelectOption | AcceptableValue | boolean> = MaybeArrayOfArray<SelectOption | AcceptableValue | boolean>, V extends SelectOptionKey<T> | undefined = undefined, M extends boolean = false">
@@ -127,8 +127,8 @@ const arrowProps = toRef(() => props.arrow as SelectArrowProps)
127
127
  const { theme, createStyler } = useTheme()
128
128
 
129
129
  const { size, orientation } = useButtonGroup(props)
130
- const { isPrefix, isSuffix, prefixIconName, suffixIconName } = useComponentIcons(toRef(() => defu(props, {
131
- suffixIcon: theme.value.app.icons.down,
130
+ const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, {
131
+ trailingIcon: theme.value.app.icons.chevronDown,
132
132
  })))
133
133
 
134
134
  const groups = computed(() => props.options?.length ? (Array.isArray(props.options[0]) ? props.options : [props.options]) as SelectOption[][] : [])
@@ -140,8 +140,8 @@ const style = computed(() => {
140
140
  ...props,
141
141
  size: size.value,
142
142
  groupOrientation: orientation.value,
143
- prefix: isPrefix.value,
144
- suffix: isSuffix.value,
143
+ leading: isLeading.value,
144
+ trailing: isTrailing.value,
145
145
  })
146
146
  })
147
147
 
@@ -196,9 +196,9 @@ function onUpdateOpen(value: boolean) {
196
196
  @update:open="onUpdateOpen"
197
197
  >
198
198
  <SelectTrigger :id="props.id" :class="style.base({ class: [props.class, props.ui?.base] })">
199
- <span v-if="isPrefix || slots.prefix" :class="style.prefix({ class: props.ui?.prefix })">
200
- <slot name="prefix" :model-value="typedValue(innerValue)" :open="open" :ui="props.ui">
201
- <i v-if="isPrefix && prefixIconName" :class="style.prefixIcon({ class: [prefixIconName, props.ui?.prefixIcon] })"></i>
199
+ <span v-if="isLeading || slots.leading" :class="style.leading({ class: props.ui?.leading })">
200
+ <slot name="leading" :model-value="typedValue(innerValue)" :open="open" :ui="props.ui">
201
+ <span v-if="isLeading && leadingIconName" :class="style.leadingIcon({ class: [leadingIconName, props.ui?.leadingIcon] })"></span>
202
202
  </slot>
203
203
  </span>
204
204
 
@@ -213,9 +213,9 @@ function onUpdateOpen(value: boolean) {
213
213
  </template>
214
214
  </slot>
215
215
 
216
- <span v-if="isSuffix || !!slots.suffix" :class="style.suffix({ class: props.ui?.suffix })">
217
- <slot name="suffix" :model-value="typedValue(innerValue)" :open="open" :ui="props.ui">
218
- <i v-if="suffixIconName" :class="style.suffixIcon({ class: [suffixIconName, props.ui?.suffixIcon] })"></i>
216
+ <span v-if="isTrailing || !!slots.trailing" :class="style.trailing({ class: props.ui?.trailing })">
217
+ <slot name="trailing" :model-value="typedValue(innerValue)" :open="open" :ui="props.ui">
218
+ <span v-if="trailingIconName" :class="style.trailingIcon({ class: [trailingIconName, props.ui?.trailingIcon] })"></span>
219
219
  </slot>
220
220
  </span>
221
221
  </SelectTrigger>
@@ -237,21 +237,21 @@ function onUpdateOpen(value: boolean) {
237
237
  :value="typeof item === 'object' ? get(item, props.valueKey as string) : item"
238
238
  >
239
239
  <slot name="item" :item="typedItem(item)" :index="index">
240
- <slot name="itemPrefix" :item="typedItem(item)" :index="index">
241
- <i v-if="item.icon" :class="style.itemPrefixIcon({ class: [item.icon, props.ui?.itemPrefixIcon] })"></i>
240
+ <slot name="item-leading" :item="typedItem(item)" :index="index">
241
+ <span v-if="item.icon" :class="style.itemLeadingIcon({ class: [item.icon, props.ui?.itemLeadingIcon] })"></span>
242
242
  </slot>
243
243
 
244
244
  <SelectItemText :class="style.itemLabel({ class: props.ui?.itemLabel })">
245
- <slot name="itemLabel" :item="typedItem(item)" :index="index">
245
+ <slot name="item-label" :item="typedItem(item)" :index="index">
246
246
  {{ typeof item === 'object' ? get(item, props.labelKey as string) : item }}
247
247
  </slot>
248
248
  </SelectItemText>
249
249
 
250
- <span :class="style.itemSuffix({ class: props.ui?.itemSuffix })">
251
- <slot name="itemSuffix" :item="typedItem(item)" :index="index"></slot>
250
+ <span :class="style.itemTrailing({ class: props.ui?.itemTrailing })">
251
+ <slot name="item-trailing" :item="typedItem(item)" :index="index"></slot>
252
252
 
253
253
  <SelectItemIndicator as-child>
254
- <i :class="style.itemSuffixIcon({ class: [props.selectedIcon || theme.app.icons.check, props.ui?.itemSuffixIcon] })"></i>
254
+ <span :class="style.itemTrailingIcon({ class: [props.selectedIcon || theme.app.icons.check, props.ui?.itemTrailingIcon] })"></span>
255
255
  </SelectItemIndicator>
256
256
  </span>
257
257
  </slot>
@@ -0,0 +1,63 @@
1
+ <script lang="ts">
2
+ import type { VariantProps } from '@byyuurin/ui-kit'
3
+ import type { SeparatorProps as RekaSeparatorProps } from 'reka-ui'
4
+ import type { separator } from '../theme'
5
+ import type { ComponentAttrs } from '../types'
6
+
7
+ export interface SeparatorSlots {
8
+ default?: (props: {}) => any
9
+ }
10
+
11
+ type SeparatorVariants = VariantProps<typeof separator>
12
+
13
+ export interface SeparatorProps extends ComponentAttrs<typeof separator>, Pick<RekaSeparatorProps, 'as' | 'decorative'> {
14
+ orientation?: SeparatorVariants['orientation']
15
+ align?: 'start' | 'end' | 'center'
16
+ /** Display a label in the middle. */
17
+ label?: string
18
+ /**
19
+ * Display an icon in the middle.
20
+ */
21
+ icon?: string
22
+ }
23
+ </script>
24
+
25
+ <script setup lang="ts">
26
+ import { reactivePick } from '@vueuse/core'
27
+ import { Separator, useForwardProps } from 'reka-ui'
28
+ import { computed } from 'vue'
29
+ import { useTheme } from '../composables/useTheme'
30
+
31
+ const props = withDefaults(defineProps<SeparatorProps>(), {
32
+ orientation: 'horizontal',
33
+ position: 'center',
34
+ })
35
+
36
+ const slots = defineSlots<SeparatorSlots>()
37
+
38
+ const rootProps = useForwardProps(reactivePick(props, 'as', 'decorative', 'orientation'))
39
+
40
+ const { theme, createStyler } = useTheme()
41
+
42
+ const style = computed(() => {
43
+ const styler = createStyler(theme.value.separator)
44
+ return styler(props)
45
+ })
46
+ </script>
47
+
48
+ <template>
49
+ <Separator v-bind="rootProps" :class="style.root({ class: [props.class, props.ui?.root] })">
50
+ <div :class="style.line({ class: props.ui?.line, start: props.align === 'start' })"></div>
51
+
52
+ <template v-if="props.label || props.icon || slots.default">
53
+ <div :class="style.container({ class: props.ui?.container })">
54
+ <slot>
55
+ <span v-if="props.label" :class="style.label({ class: props.ui?.label })">{{ props.label }}</span>
56
+ <span v-else-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></span>
57
+ </slot>
58
+ </div>
59
+
60
+ <div :class="style.line({ class: props.ui?.line, end: props.align === 'end' })"></div>
61
+ </template>
62
+ </Separator>
63
+ </template>
@@ -0,0 +1,33 @@
1
+ <script lang="ts">
2
+ import type { PrimitiveProps } from 'reka-ui'
3
+ import type { skeleton } from '../theme'
4
+ import type { ComponentAttrs } from '../types'
5
+
6
+ export interface SkeletonProps extends Omit<ComponentAttrs<typeof skeleton>, 'ui'> {
7
+ /**
8
+ * The element or component this component should render as.
9
+ * @default "div"
10
+ */
11
+ as?: PrimitiveProps['as']
12
+ }
13
+ </script>
14
+
15
+ <script setup lang="ts">
16
+ import { Primitive } from 'reka-ui'
17
+ import { computed } from 'vue'
18
+ import { useTheme } from '../composables/useTheme'
19
+
20
+ const props = withDefaults(defineProps<SkeletonProps>(), {})
21
+
22
+ const { theme, createStyler } = useTheme()
23
+ const styler = computed(() => {
24
+ const styler = createStyler(theme.value.skeleton)
25
+ return styler(props)
26
+ })
27
+ </script>
28
+
29
+ <template>
30
+ <Primitive :as="props.as" :class="styler">
31
+ <slot></slot>
32
+ </Primitive>
33
+ </template>
@@ -4,6 +4,11 @@ import type { SliderRootProps } from 'reka-ui'
4
4
  import type { slider } from '../theme'
5
5
  import type { ComponentAttrs } from '../types'
6
6
 
7
+ export interface SliderEmits {
8
+ (event: 'update:modelValue', payload: number | number[]): void
9
+ (event: 'change', payload: Event): void
10
+ }
11
+
7
12
  type SliderVariants = VariantProps<typeof slider>
8
13
 
9
14
  export interface SliderProps extends ComponentAttrs<typeof slider>, Pick<SliderRootProps, 'as' | 'name' | 'disabled' | 'inverted' | 'min' | 'max' | 'step' | 'minStepsBetweenThumbs'> {
@@ -11,17 +16,12 @@ export interface SliderProps extends ComponentAttrs<typeof slider>, Pick<SliderR
11
16
  size?: SliderVariants['size']
12
17
  /**
13
18
  * The orientation of the slider.
14
- * @default 'horizontal'
19
+ * @default "horizontal"
15
20
  */
16
21
  orientation?: SliderVariants['orientation']
17
22
  /** The value of the slider when initially rendered. Use when you do not need to control the state of the slider. */
18
23
  defaultValue?: number | number[]
19
24
  }
20
-
21
- export interface SliderEmits {
22
- (event: 'update:modelValue', payload: number | number[]): void
23
- (event: 'change', payload: Event): void
24
- }
25
25
  </script>
26
26
 
27
27
  <script setup lang="ts">
@@ -1,13 +1,21 @@
1
1
  <script lang="ts">
2
2
  import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { PrimitiveProps, SwitchRootProps } from 'reka-ui'
3
+ import type { SwitchRootProps } from 'reka-ui'
4
4
  import type { switch as _switch } from '../theme'
5
5
  import type { ComponentAttrs } from '../types'
6
6
 
7
+ export interface SwitchEmits {
8
+ (event: 'change', payload: Event): void
9
+ }
10
+
11
+ export interface SwitchSlots {
12
+ label?: (props: { label?: string }) => any
13
+ description?: (props: { description?: string }) => any
14
+ }
15
+
7
16
  type SwitchVariants = VariantProps<typeof _switch>
8
17
 
9
- export interface SwitchProps extends ComponentAttrs<typeof _switch>, Pick<SwitchRootProps, 'disabled' | 'id' | 'name' | 'required' | 'value' | 'defaultValue'> {
10
- as?: PrimitiveProps['as']
18
+ export interface SwitchProps extends ComponentAttrs<typeof _switch>, Pick<SwitchRootProps, 'as' | 'disabled' | 'id' | 'name' | 'required' | 'value' | 'defaultValue'> {
11
19
  size?: SwitchVariants['size']
12
20
  /** When `true`, the loading icon will be displayed. */
13
21
  loading?: boolean
@@ -23,15 +31,6 @@ export interface SwitchProps extends ComponentAttrs<typeof _switch>, Pick<Switch
23
31
  label?: string
24
32
  description?: string
25
33
  }
26
-
27
- export interface SwitchEmits {
28
- (event: 'change', payload: Event): void
29
- }
30
-
31
- export interface SwitchSlots {
32
- label?: (props: { label?: string }) => any
33
- description?: (props: { description?: string }) => any
34
- }
35
34
  </script>
36
35
 
37
36
  <script lang="ts" setup>
@@ -74,10 +73,10 @@ function onUpdate(value: any) {
74
73
  @update:model-value="onUpdate"
75
74
  >
76
75
  <SwitchThumb :class="style.thumb({ class: props.ui?.thumb })">
77
- <i v-if="props.loading" :class="style.icon({ class: [theme.app.icons.loading, props.ui?.icon], checked: true, unchecked: true })"></i>
76
+ <span v-if="props.loading" :class="style.icon({ class: [theme.app.icons.loading, props.ui?.icon], checked: true, unchecked: true })"></span>
78
77
  <template v-else>
79
- <i v-if="props.checkedIcon" :class="style.icon({ class: [props.checkedIcon, props.ui?.icon], checked: true })"></i>
80
- <i v-if="props.uncheckedIcon" :class="style.icon({ class: [props.uncheckedIcon, props.ui?.icon], unchecked: true })"></i>
78
+ <span v-if="props.checkedIcon" :class="style.icon({ class: [props.checkedIcon, props.ui?.icon], checked: true })"></span>
79
+ <span v-if="props.uncheckedIcon" :class="style.icon({ class: [props.uncheckedIcon, props.ui?.icon], unchecked: true })"></span>
81
80
  </template>
82
81
  </SwitchThumb>
83
82
  </SwitchRoot>