@byyuurin/ui 0.0.5 → 0.0.6

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 (108) hide show
  1. package/README.md +13 -8
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.mjs +3 -0
  4. package/dist/nuxt.mjs +4 -3
  5. package/dist/nuxt.mjs.map +1 -1
  6. package/dist/runtime/components/App.vue +1 -1
  7. package/dist/runtime/components/Badge.vue +0 -1
  8. package/dist/runtime/components/Button.vue +4 -1
  9. package/dist/runtime/components/ButtonGroup.vue +47 -0
  10. package/dist/runtime/components/Carousel.vue +310 -0
  11. package/dist/runtime/components/Checkbox.vue +0 -1
  12. package/dist/runtime/components/Chip.vue +7 -2
  13. package/dist/runtime/components/Input.vue +8 -4
  14. package/dist/runtime/components/Modal.vue +2 -3
  15. package/dist/runtime/components/Pagination.vue +167 -0
  16. package/dist/runtime/components/PinInput.vue +0 -1
  17. package/dist/runtime/components/RadioGroup.vue +0 -1
  18. package/dist/runtime/components/ScrollArea.vue +1 -1
  19. package/dist/runtime/components/Select.vue +5 -1
  20. package/dist/runtime/components/Slider.vue +0 -1
  21. package/dist/runtime/components/Switch.vue +1 -3
  22. package/dist/runtime/components/Tabs.vue +0 -1
  23. package/dist/runtime/components/Textarea.vue +0 -1
  24. package/dist/runtime/components/Toast.vue +20 -9
  25. package/dist/runtime/components/Toaster.vue +3 -4
  26. package/dist/runtime/composables/useButtonGroup.d.ts +13 -0
  27. package/dist/runtime/composables/useButtonGroup.mjs +14 -0
  28. package/dist/runtime/composables/useTheme.d.ts +2 -2
  29. package/dist/runtime/composables/useTheme.mjs +1 -1
  30. package/dist/runtime/composables/useToast.d.ts +4 -4
  31. package/dist/runtime/composables/useToast.mjs +19 -6
  32. package/dist/runtime/theme/accordion.d.ts +17 -0
  33. package/dist/runtime/theme/alert.d.ts +40 -0
  34. package/dist/runtime/theme/alert.mjs +4 -4
  35. package/dist/runtime/theme/app.d.ts +5 -0
  36. package/dist/runtime/theme/app.mjs +6 -1
  37. package/dist/runtime/theme/badge.d.ts +3 -0
  38. package/dist/runtime/theme/badge.mjs +5 -2
  39. package/dist/runtime/theme/button-group.d.ts +66 -0
  40. package/dist/runtime/theme/button-group.mjs +42 -0
  41. package/dist/runtime/theme/button.d.ts +11 -0
  42. package/dist/runtime/theme/button.mjs +23 -18
  43. package/dist/runtime/theme/card.d.ts +19 -0
  44. package/dist/runtime/theme/card.mjs +1 -1
  45. package/dist/runtime/theme/carousel.d.ts +113 -0
  46. package/dist/runtime/theme/carousel.mjs +43 -0
  47. package/dist/runtime/theme/checkbox.d.ts +3 -0
  48. package/dist/runtime/theme/checkbox.mjs +6 -3
  49. package/dist/runtime/theme/chip.d.ts +11 -0
  50. package/dist/runtime/theme/chip.mjs +10 -5
  51. package/dist/runtime/theme/drawer.d.ts +38 -0
  52. package/dist/runtime/theme/drawer.mjs +2 -2
  53. package/dist/runtime/theme/index.d.ts +5 -2
  54. package/dist/runtime/theme/index.mjs +5 -2
  55. package/dist/runtime/theme/input.d.ts +33 -22
  56. package/dist/runtime/theme/input.mjs +36 -31
  57. package/dist/runtime/theme/link.d.ts +13 -0
  58. package/dist/runtime/theme/modal.d.ts +3 -0
  59. package/dist/runtime/theme/modal.mjs +5 -2
  60. package/dist/runtime/theme/pagination.d.ts +56 -0
  61. package/dist/runtime/theme/pagination.mjs +13 -0
  62. package/dist/runtime/theme/pinInput.d.ts +3 -0
  63. package/dist/runtime/theme/pinInput.mjs +14 -11
  64. package/dist/runtime/theme/popover.d.ts +11 -0
  65. package/dist/runtime/theme/popover.mjs +1 -1
  66. package/dist/runtime/theme/{radioGroup.d.ts → radio-group.d.ts} +3 -0
  67. package/dist/runtime/theme/{radioGroup.mjs → radio-group.mjs} +4 -1
  68. package/dist/runtime/theme/{scrollArea.d.ts → scroll-area.d.ts} +22 -0
  69. package/dist/runtime/theme/{scrollArea.mjs → scroll-area.mjs} +2 -2
  70. package/dist/runtime/theme/select.d.ts +11 -0
  71. package/dist/runtime/theme/select.mjs +20 -15
  72. package/dist/runtime/theme/slider.d.ts +3 -0
  73. package/dist/runtime/theme/slider.mjs +6 -3
  74. package/dist/runtime/theme/switch.d.ts +3 -0
  75. package/dist/runtime/theme/switch.mjs +5 -2
  76. package/dist/runtime/theme/tabs.d.ts +3 -0
  77. package/dist/runtime/theme/tabs.mjs +13 -10
  78. package/dist/runtime/theme/textarea.d.ts +3 -0
  79. package/dist/runtime/theme/textarea.mjs +14 -11
  80. package/dist/runtime/theme/toast.d.ts +44 -6
  81. package/dist/runtime/theme/toast.mjs +12 -7
  82. package/dist/runtime/theme/toaster.d.ts +49 -0
  83. package/dist/runtime/theme/toaster.mjs +5 -0
  84. package/dist/runtime/theme/tooltip.d.ts +13 -0
  85. package/dist/runtime/theme/tooltip.mjs +1 -1
  86. package/dist/runtime/types/components.d.ts +27 -25
  87. package/dist/runtime/types/components.mjs +27 -0
  88. package/dist/runtime/types/utils.d.ts +1 -1
  89. package/dist/runtime/utils/styler.d.ts +2 -2
  90. package/dist/shared/ui.D4zm1r0C.mjs +4 -0
  91. package/dist/shared/ui.D4zm1r0C.mjs.map +1 -0
  92. package/dist/{unocss-preset.d.mts → unocss.d.mts} +4 -4
  93. package/dist/{unocss-preset.d.ts → unocss.d.ts} +4 -4
  94. package/dist/{unocss-preset.mjs → unocss.mjs} +15 -2
  95. package/dist/unocss.mjs.map +1 -0
  96. package/dist/unplugin.d.mts +4 -3
  97. package/dist/unplugin.d.ts +4 -3
  98. package/dist/unplugin.mjs +13 -5
  99. package/dist/unplugin.mjs.map +1 -1
  100. package/dist/vite.d.mts +2 -1
  101. package/dist/vite.d.ts +2 -1
  102. package/dist/vite.mjs +5 -5
  103. package/dist/vite.mjs.map +1 -1
  104. package/package.json +35 -22
  105. package/dist/shared/ui.CzDyI29e.mjs +0 -8
  106. package/dist/shared/ui.CzDyI29e.mjs.map +0 -1
  107. package/dist/unocss-preset.mjs.map +0 -1
  108. /package/{LICENSE.md → LICENSE} +0 -0
@@ -0,0 +1,167 @@
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'
5
+
6
+ export interface PaginationProps extends ComponentAttrs<typeof pagination>, Pick<PaginationRootProps, 'as' | 'defaultPage' | 'disabled' | 'itemsPerPage' | 'page' | 'showEdges' | 'siblingCount' | 'total'> {
7
+ /**
8
+ * The icon to use for the first page control.
9
+ * @default app.icons.doubleLeft
10
+ */
11
+ firstIcon?: string
12
+ /**
13
+ * The icon to use for the last page control.
14
+ * @default app.icons.doubleRight
15
+ */
16
+ lastIcon?: string
17
+ /**
18
+ * The icon to use for the previous page control.
19
+ * @default app.icons.arrowLeft
20
+ */
21
+ prevIcon?: string
22
+ /**
23
+ * The icon to use for the next page control.
24
+ * @default app.icons.arrowRight
25
+ */
26
+ nextIcon?: string
27
+ /**
28
+ * The icon to use for the ellipsis control.
29
+ * @default app.icons.ellipsis
30
+ */
31
+ ellipsisIcon?: string
32
+ /**
33
+ * The size of the pagination controls.
34
+ * @default 'md'
35
+ */
36
+ size?: ButtonProps['size']
37
+ /**
38
+ * The variant of the pagination controls.
39
+ * @default 'outline'
40
+ */
41
+ variant?: ButtonProps['variant']
42
+ /**
43
+ * The variant of the active pagination control.
44
+ * @default 'solid'
45
+ */
46
+ activeVariant?: ButtonProps['variant']
47
+ /**
48
+ * Whether to show the first, previous, next, and last controls.
49
+ * @default true
50
+ */
51
+ showControls?: boolean
52
+ }
53
+
54
+ export interface PaginationEmits extends PaginationRootEmits {}
55
+
56
+ export interface PaginationSlots {
57
+ first?: (props?: {}) => any
58
+ prev?: (props?: {}) => any
59
+ next?: (props?: {}) => any
60
+ last?: (props?: {}) => any
61
+ ellipsis?: (props?: {}) => any
62
+ item?: (props: {
63
+ page: number
64
+ pageCount: number
65
+ item: {
66
+ type: 'ellipsis'
67
+ } | {
68
+ type: 'page'
69
+ value: number
70
+ }
71
+ index: number
72
+ }) => any
73
+ }
74
+ </script>
75
+
76
+ <script setup lang="ts">
77
+ import { reactivePick } from '@vueuse/core'
78
+ import { PaginationEllipsis, PaginationFirst, PaginationLast, PaginationList, PaginationListItem, PaginationNext, PaginationPrev, PaginationRoot, useForwardPropsEmits } from 'reka-ui'
79
+ import { computed } from 'vue'
80
+ import { useTheme } from '../composables/useTheme'
81
+ import Button from './Button.vue'
82
+
83
+ const props = withDefaults(defineProps<PaginationProps>(), {
84
+ variant: 'outline',
85
+ activeVariant: 'solid',
86
+ showControls: true,
87
+ showEdges: false,
88
+ itemsPerPage: 10,
89
+ siblingCount: 2,
90
+ total: 0,
91
+ })
92
+
93
+ const emit = defineEmits<PaginationEmits>()
94
+ const slots = defineSlots<PaginationSlots>()
95
+
96
+ const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultPage', 'disabled', 'itemsPerPage', 'page', 'showEdges', 'siblingCount', 'total'), emit)
97
+
98
+ const { theme, createStyler } = useTheme()
99
+
100
+ const firstIcon = computed(() => props.firstIcon || theme.value.app.icons.doubleLeft)
101
+ const prevIcon = computed(() => props.prevIcon || theme.value.app.icons.arrowLeft)
102
+ const nextIcon = computed(() => props.nextIcon || theme.value.app.icons.arrowRight)
103
+ const lastIcon = computed(() => props.lastIcon || theme.value.app.icons.doubleRight)
104
+ const ellipsisIcon = computed(() => props.ellipsisIcon || theme.value.app.icons.ellipsis)
105
+
106
+ const style = computed(() => {
107
+ const styler = createStyler(theme.value.pagination)
108
+ return styler(props)
109
+ })
110
+ </script>
111
+
112
+ <template>
113
+ <PaginationRoot v-slot="{ page, pageCount }" v-bind="rootProps" :class="style.root({ class: [props.class, props.ui?.root] })">
114
+ <PaginationList v-slot="{ items }" :class="style.list({ class: props.ui?.list })">
115
+ <PaginationFirst v-if="props.showControls || !!slots.first" as-child>
116
+ <slot name="first">
117
+ <Button :class="style.item({ class: props.ui?.item })" :variant="props.variant" :size="props.size" :icon="firstIcon" />
118
+ </slot>
119
+ </PaginationFirst>
120
+ <PaginationPrev v-if="props.showControls || !!slots.prev" as-child>
121
+ <slot name="prev">
122
+ <Button :class="style.item({ class: props.ui?.item })" :variant="props.variant" :size="props.size" :icon="prevIcon" />
123
+ </slot>
124
+ </PaginationPrev>
125
+
126
+ <template v-for="(item, index) in items">
127
+ <PaginationListItem v-if="item.type === 'page'" :key="index" as-child :value="item.value">
128
+ <slot name="item" v-bind="{ item, index, page, pageCount }">
129
+ <Button
130
+ :class="style.item({ class: props.ui?.item })"
131
+ :variant="props.page === item.value ? props.activeVariant : props.variant"
132
+ :size="props.size"
133
+ :label="String(item.value)"
134
+ :ui="{ label: style.label() }"
135
+ />
136
+ </slot>
137
+ </PaginationListItem>
138
+
139
+ <PaginationEllipsis v-else :key="item.type" :index="index" as-child>
140
+ <slot name="ellipsis">
141
+ <Button
142
+ :variant="props.variant"
143
+ :size="props.size"
144
+ :icon="ellipsisIcon"
145
+ :disabled="props.disabled /* TODO: remove after reka-ui update */"
146
+ :class="[
147
+ style.item({ class: props.ui?.item }),
148
+ style.ellipsis({ class: props.ui?.ellipsis }),
149
+ ]"
150
+ />
151
+ </slot>
152
+ </PaginationEllipsis>
153
+ </template>
154
+
155
+ <PaginationNext v-if="props.showControls || !!slots.next" as-child>
156
+ <slot name="next">
157
+ <Button :class="style.item({ class: props.ui?.item })" :variant="props.variant" :size="props.size" :icon="nextIcon" />
158
+ </slot>
159
+ </PaginationNext>
160
+ <PaginationLast v-if="props.showControls || !!slots.last" as-child>
161
+ <slot name="last">
162
+ <Button :class="style.item({ class: props.ui?.item })" :variant="props.variant" :size="props.size" :icon="lastIcon" />
163
+ </slot>
164
+ </PaginationLast>
165
+ </PaginationList>
166
+ </PaginationRoot>
167
+ </template>
@@ -31,7 +31,6 @@ import { looseToNumber } from '../utils'
31
31
 
32
32
  const props = withDefaults(defineProps<PinInputProps>(), {
33
33
  variant: 'outline',
34
- size: 'md',
35
34
  length: 5,
36
35
  type: 'text',
37
36
  })
@@ -74,7 +74,6 @@ import { useTheme } from '../composables/useTheme'
74
74
  import { get } from '../utils'
75
75
 
76
76
  const props = withDefaults(defineProps<RadioGroupProps<T>>(), {
77
- size: 'md',
78
77
  valueKey: 'value',
79
78
  labelKey: 'label',
80
79
  descriptionKey: 'description',
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { ScrollAreaRootProps } from 'reka-ui'
3
3
  import type { scrollArea } from '../theme'
4
- import { transitionProps } from '../theme/scrollArea'
4
+ import { transitionProps } from '../theme/scroll-area'
5
5
  import type { ComponentAttrs } from '../types'
6
6
 
7
7
  export interface ScrollAreaProps extends ComponentAttrs<typeof scrollArea>, Pick<ScrollAreaRootProps, 'type' | 'dir' | 'scrollHideDelay'> {}
@@ -105,13 +105,13 @@ import { reactivePick } from '@vueuse/core'
105
105
  import { defu } from 'defu'
106
106
  import { SelectArrow, SelectContent, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectLabel, SelectPortal, SelectRoot, SelectSeparator, SelectTrigger, SelectViewport, useForwardPropsEmits } from 'reka-ui'
107
107
  import { computed, toRef } from 'vue'
108
+ import { useButtonGroup } from '../composables/useButtonGroup'
108
109
  import { useComponentIcons } from '../composables/useComponentIcons'
109
110
  import { useTheme } from '../composables/useTheme'
110
111
  import { compare, get } from '../utils'
111
112
 
112
113
  const props = withDefaults(defineProps<SelectProps<T, I, V, M>>(), {
113
114
  variant: 'outline',
114
- size: 'md',
115
115
  valueKey: 'value' as never,
116
116
  labelKey: 'label' as never,
117
117
  portal: true,
@@ -125,6 +125,8 @@ const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffse
125
125
  const arrowProps = toRef(() => props.arrow as SelectArrowProps)
126
126
 
127
127
  const { theme, createStyler } = useTheme()
128
+
129
+ const { size, orientation } = useButtonGroup(props)
128
130
  const { isPrefix, isSuffix, prefixIconName, suffixIconName } = useComponentIcons(toRef(() => defu(props, {
129
131
  suffixIcon: theme.value.app.icons.down,
130
132
  })))
@@ -136,6 +138,8 @@ const style = computed(() => {
136
138
  const styler = createStyler(theme.value.select)
137
139
  return styler({
138
140
  ...props,
141
+ size: size.value,
142
+ groupOrientation: orientation.value,
139
143
  prefix: isPrefix.value,
140
144
  suffix: isSuffix.value,
141
145
  })
@@ -31,7 +31,6 @@ import { computed } from 'vue'
31
31
  import { useTheme } from '../composables/useTheme'
32
32
 
33
33
  const props = withDefaults(defineProps<SliderProps>(), {
34
- size: 'md',
35
34
  orientation: 'horizontal',
36
35
  step: 1,
37
36
  max: 100,
@@ -40,9 +40,7 @@ import { Label, Primitive, SwitchRoot, SwitchThumb, useForwardProps } from 'reka
40
40
  import { computed, useId } from 'vue'
41
41
  import { useTheme } from '../composables/useTheme'
42
42
 
43
- const props = withDefaults(defineProps<SwitchProps>(), {
44
- size: 'md',
45
- })
43
+ const props = withDefaults(defineProps<SwitchProps>(), {})
46
44
  const emit = defineEmits<SwitchEmits>()
47
45
  const slots = defineSlots<SwitchSlots>()
48
46
  const modelValue = defineModel<boolean>({ default: undefined })
@@ -59,7 +59,6 @@ const props = withDefaults(defineProps<TabsProps<T>>(), {
59
59
  defaultValue: '0',
60
60
  variant: 'solid',
61
61
  orientation: 'horizontal',
62
- size: 'md',
63
62
  full: true,
64
63
  content: true,
65
64
  labelKey: 'label',
@@ -49,7 +49,6 @@ defineOptions({
49
49
  })
50
50
 
51
51
  const props = withDefaults(defineProps<TextareaProps>(), {
52
- size: 'md',
53
52
  variant: 'outline',
54
53
  rows: 3,
55
54
  maxRows: 0,
@@ -1,21 +1,30 @@
1
1
  <script lang="ts">
2
+ import type { VariantProps } from '@byyuurin/ui-kit'
2
3
  import type { PrimitiveProps, ToastRootEmits, ToastRootProps } from 'reka-ui'
3
4
  import type { toast } from '../theme'
4
5
  import type { ButtonProps, ComponentAttrs } from '../types'
5
6
 
7
+ type ToastVariants = VariantProps<typeof toast>
8
+
6
9
  export interface ToastProps extends ComponentAttrs<typeof toast>, Pick<ToastRootProps, 'defaultOpen' | 'open' | 'type' | 'duration'> {
7
10
  /** @default "li" */
8
11
  as?: PrimitiveProps['as']
9
12
  title?: string
10
13
  description?: string
11
14
  icon?: string
15
+ orientation?: ToastVariants['orientation']
16
+ /**
17
+ * Display a list of actions:
18
+ * - under the title and description when orientation is `vertical`
19
+ * - next to the close button when orientation is `horizontal`
20
+ */
12
21
  actions?: ButtonProps[]
13
22
  /**
14
23
  * Display a close button to dismiss the toast.
15
24
  * @default true
16
25
  */
17
26
  close?: ButtonProps | boolean
18
- /** @default `app.icons.close` */
27
+ /** @default app.icons.close */
19
28
  closeIcon?: string
20
29
  }
21
30
 
@@ -39,6 +48,7 @@ import { useTheme } from '../composables/useTheme'
39
48
  import Button from './Button.vue'
40
49
 
41
50
  const props = withDefaults(defineProps<ToastProps>(), {
51
+ orientation: 'vertical',
42
52
  close: true,
43
53
  })
44
54
 
@@ -50,12 +60,13 @@ const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultOpen',
50
60
  const el = ref<InstanceType<typeof ToastRoot>>()
51
61
  const { height } = useElementBounding(() => el.value?.$el.getBoundingClientRect ? el.value.$el : undefined)
52
62
 
53
- const multiline = computed(() => !!props.title && !!props.description)
54
-
55
63
  const { theme, createStyler } = useTheme()
56
64
  const style = computed(() => {
57
65
  const styler = createStyler(theme.value.toast)
58
- return styler({ ...props, multiline: multiline.value })
66
+ return styler({
67
+ ...props,
68
+ title: !!(props.title || slots.title),
69
+ })
59
70
  })
60
71
 
61
72
  defineExpose({
@@ -68,7 +79,7 @@ defineExpose({
68
79
  ref="el"
69
80
  v-slot="{ remaining, duration }"
70
81
  v-bind="rootProps"
71
- :class="style.root({ class: [props.class, props.ui?.root], multiline })"
82
+ :class="style.root({ class: [props.class, props.ui?.root] })"
72
83
  :style="{ '--height': height }"
73
84
  >
74
85
  <slot name="icon">
@@ -87,7 +98,7 @@ defineExpose({
87
98
  </slot>
88
99
  </ToastDescription>
89
100
 
90
- <div v-if="multiline && actions?.length" :class="style.actions({ class: props.ui?.actions, multiline: true })">
101
+ <div v-if="props.orientation === 'vertical' && actions?.length" :class="style.actions({ class: props.ui?.actions })">
91
102
  <slot name="actions">
92
103
  <ToastAction v-for="(action, index) in props.actions" :key="index" :alt-text="action.label || 'Action'" as-child @click.stop>
93
104
  <Button size="xs" v-bind="action" />
@@ -96,8 +107,8 @@ defineExpose({
96
107
  </div>
97
108
  </div>
98
109
 
99
- <div v-if="(!multiline && actions?.length) || props.close !== null" :class="style.actions({ class: props.ui?.actions, multiline: false })">
100
- <template v-if="!multiline">
110
+ <div v-if="(props.orientation === 'horizontal' && actions?.length) || props.close !== null" :class="style.actions({ class: props.ui?.actions })">
111
+ <template v-if="props.orientation === 'horizontal'">
101
112
  <slot name="actions">
102
113
  <ToastAction v-for="(action, index) in props.actions" :key="index" :alt-text="action.label || 'Action'" as-child @click.stop>
103
114
  <Button size="xs" v-bind="action" />
@@ -107,7 +118,7 @@ defineExpose({
107
118
 
108
119
  <ToastClose as-child>
109
120
  <slot name="close" :ui="ui">
110
- <UButton
121
+ <Button
111
122
  v-if="props.close"
112
123
  :icon="props.closeIcon || theme.app.icons.close"
113
124
  size="md"
@@ -72,6 +72,7 @@ const style = computed(() => {
72
72
  return styler({
73
73
  ...props,
74
74
  swipeDirection: swipeDirection.value,
75
+ clickable: false,
75
76
  })
76
77
  })
77
78
 
@@ -114,11 +115,9 @@ function getOffset(index: number) {
114
115
  '--translate': expanded ? 'calc(var(--offset) * var(--translate-factor))' : 'calc(var(--before) * var(--gap))',
115
116
  '--transform': 'translateY(var(--translate)) scale(var(--scale))',
116
117
  }"
117
- :class="[style.base(), {
118
- 'cursor-pointer': !!toast.click,
119
- }]"
118
+ :class="style.base({ clickable: !!(toast.onClick) })"
120
119
  @update:open="onUpdateOpen($event, toast.id)"
121
- @click="toast.click && toast.click(toast)"
120
+ @click="toast.onClick && toast.onClick(toast)"
122
121
  />
123
122
 
124
123
  <ToastPortal :disabled="!portal">
@@ -0,0 +1,13 @@
1
+ import type { ComputedRef } from 'vue';
2
+ import type { ButtonGroupProps } from '../components/ButtonGroup.vue';
3
+ interface ButtonGroupInjectData {
4
+ size: ButtonGroupProps['size'];
5
+ orientation: ButtonGroupProps['orientation'];
6
+ }
7
+ export declare const InjectionKeyButtonGroup: import("vue").InjectionKey<ComputedRef<ButtonGroupInjectData>>, injectButtonGroup: () => ComputedRef<ButtonGroupInjectData> | undefined, provideButtonGroup: (value: ComputedRef<ButtonGroupInjectData>) => void;
8
+ type UseButtonGroupProps = Pick<ButtonGroupProps, 'size'>;
9
+ export declare function useButtonGroup(props?: UseButtonGroupProps): {
10
+ size: ComputedRef<any>;
11
+ orientation: ComputedRef<any>;
12
+ };
13
+ export {};
@@ -0,0 +1,14 @@
1
+ import { computed } from "vue";
2
+ import { defineInjection } from "./defineInjection.mjs";
3
+ export const {
4
+ InjectionKey: InjectionKeyButtonGroup,
5
+ inject: injectButtonGroup,
6
+ provide: provideButtonGroup
7
+ } = defineInjection("ui.buttonGroup");
8
+ export function useButtonGroup(props = {}) {
9
+ const buttonGroup = injectButtonGroup();
10
+ return {
11
+ size: computed(() => props.size ?? buttonGroup?.value.size),
12
+ orientation: computed(() => buttonGroup?.value.orientation)
13
+ };
14
+ }
@@ -1,9 +1,9 @@
1
- import type { UserConfig } from 'unocss';
1
+ import type { UserConfig } from '@unocss/core';
2
2
  import type { MaybeRefOrGetter } from 'vue';
3
3
  import * as theme from '../theme';
4
4
  export declare const InjectionKeyThemeExtension: import("vue").InjectionKey<MaybeRefOrGetter<import("../types").PartialTheme<typeof theme>>>, provideThemeExtension: (value: MaybeRefOrGetter<import("../types").PartialTheme<typeof theme>>) => void, injectThemeExtension: () => MaybeRefOrGetter<import("../types").PartialTheme<typeof theme>>;
5
5
  export declare const InjectionKeyUnoConfig: import("vue").InjectionKey<UserConfig<object>>, provideUnoConfig: (value: UserConfig<object>) => void, injectUnoConfig: () => UserConfig<object>;
6
6
  export declare const useTheme: () => {
7
7
  theme: import("vue").ComputedRef<typeof theme>;
8
- createStyler: <V extends import("@byyuurin/ui-kit/index").CVVariants<S, B>, CV extends import("@byyuurin/ui-kit/index").CVCompoundVariants<V, S, B>, B extends import("@byyuurin/ui-kit/index").ClassValue = undefined, S extends import("@byyuurin/ui-kit/index").CVSlots = undefined>(theme: import("@byyuurin/ui-kit/index").CVMeta<V, CV, never, B, S>) => [keyof V] extends string[] ? (props: Required<import("@byyuurin/ui-kit/index").VariantProps<import("@byyuurin/ui-kit/index").CVReturnType<V, S, B>>> & import("../types").StylerBaseProps) => S extends undefined ? string : { [K in keyof S | (B extends undefined ? never : "base")]: import("@byyuurin/ui-kit/index").CVHandler<V, S, string>; } : (props?: import("../types").StylerBaseProps) => S extends undefined ? string : { [K in keyof S | (B extends undefined ? never : "base")]: import("@byyuurin/ui-kit/index").CVHandler<V, S, string>; };
8
+ createStyler: <V extends import("@byyuurin/ui-kit/index").CVVariants<S, B>, CV extends import("@byyuurin/ui-kit/index").CVCompoundVariants<V, S, B>, DV extends import("@byyuurin/ui-kit/index").CVDefaultVariants<V, S>, B extends import("@byyuurin/ui-kit/index").ClassValue = undefined, S extends import("@byyuurin/ui-kit/index").CVSlots = undefined>(theme: import("@byyuurin/ui-kit/index").CVMeta<V, CV, DV, B, S>) => [keyof V] extends string[] ? (props: import("@byyuurin/ui-kit/index").VariantProps<import("@byyuurin/ui-kit/index").CVReturnType<V, S, B>> & import("../types").StylerBaseProps) => S extends undefined ? string : { [K in keyof S | (B extends undefined ? never : "base")]: import("@byyuurin/ui-kit/index").CVHandler<V, S, string>; } : (props?: import("../types").StylerBaseProps) => S extends undefined ? string : { [K in keyof S | (B extends undefined ? never : "base")]: import("@byyuurin/ui-kit/index").CVHandler<V, S, string>; };
9
9
  };
@@ -1,4 +1,4 @@
1
- import { transformUnoRules } from "@byyuurin/ui/unocss-preset";
1
+ import { transformUnoRules } from "@byyuurin/ui/unocss";
2
2
  import { createSharedComposable } from "@vueuse/core";
3
3
  import { computed, toValue } from "vue";
4
4
  import * as theme from "../theme/index.mjs";
@@ -1,7 +1,7 @@
1
- import type { ToastProps } from '@byyuurin/ui';
1
+ import type { ToastProps } from '../types';
2
2
  export interface Toast extends Omit<ToastProps, 'defaultOpen'> {
3
3
  id: string | number;
4
- click?: (toast: Toast) => void;
4
+ onClick?: (toast: Toast) => void;
5
5
  }
6
6
  export declare const useToast: () => {
7
7
  toasts: import("vue").Ref<{
@@ -9,13 +9,13 @@ export declare const useToast: () => {
9
9
  [x: number]: any;
10
10
  [x: symbol]: ToastProps;
11
11
  id: string | number;
12
- click?: ((toast: Toast) => void) | undefined;
12
+ onClick?: ((toast: Toast) => void) | undefined;
13
13
  }[], Toast[] | {
14
14
  [x: string]: any;
15
15
  [x: number]: any;
16
16
  [x: symbol]: ToastProps;
17
17
  id: string | number;
18
- click?: ((toast: Toast) => void) | undefined;
18
+ onClick?: ((toast: Toast) => void) | undefined;
19
19
  }[]>;
20
20
  add: (toast: Partial<Toast>) => Toast;
21
21
  update: (id: string | number, toast: Partial<Omit<Toast, "id">>) => void;
@@ -1,17 +1,30 @@
1
1
  import { createSharedComposable } from "@vueuse/core";
2
- import { ref } from "vue";
2
+ import { nextTick, ref } from "vue";
3
3
  export const useToast = createSharedComposable(() => {
4
4
  const toasts = ref([]);
5
+ const running = ref(false);
6
+ const maxToasts = 5;
7
+ const queue = [];
8
+ const generateId = () => `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
9
+ async function processQueue() {
10
+ if (running.value || queue.length === 0)
11
+ return;
12
+ running.value = true;
13
+ while (queue.length > 0) {
14
+ const toast = queue.shift();
15
+ await nextTick();
16
+ toasts.value = [...toasts.value, toast].slice(-maxToasts);
17
+ }
18
+ running.value = false;
19
+ }
5
20
  function add(toast) {
6
21
  const body = {
7
- id: Date.now().toString(),
22
+ id: generateId(),
8
23
  open: true,
9
24
  ...toast
10
25
  };
11
- const index = toasts.value.findIndex((t) => t.id === body.id);
12
- if (index === -1)
13
- toasts.value.push(body);
14
- toasts.value = toasts.value.slice(-5);
26
+ queue.push(body);
27
+ processQueue();
15
28
  return body;
16
29
  }
17
30
  function update(id, toast) {
@@ -35,5 +35,22 @@ declare const _default: {
35
35
  trailingIcon: string;
36
36
  label: string;
37
37
  }, undefined>;
38
+ defaultVariants: import("@byyuurin/ui-kit/index").CVDefaultVariants<{
39
+ disabled: {
40
+ true: {
41
+ trigger: string;
42
+ };
43
+ };
44
+ }, {
45
+ root: string;
46
+ item: string;
47
+ header: string;
48
+ trigger: string;
49
+ content: string[];
50
+ body: string;
51
+ icon: string;
52
+ trailingIcon: string;
53
+ label: string;
54
+ }>;
38
55
  };
39
56
  export default _default;
@@ -81,5 +81,45 @@ declare const _default: {
81
81
  actions: string;
82
82
  close: string;
83
83
  }, undefined>;
84
+ defaultVariants: import("@byyuurin/ui-kit/index").CVDefaultVariants<{
85
+ variant: {
86
+ solid: {
87
+ root: string;
88
+ close: string;
89
+ };
90
+ outline: {
91
+ root: string;
92
+ };
93
+ soft: {
94
+ root: string;
95
+ };
96
+ 'soft-outline': {
97
+ root: string;
98
+ };
99
+ };
100
+ orientation: {
101
+ horizontal: {
102
+ root: string;
103
+ actions: string;
104
+ };
105
+ vertical: {
106
+ root: string;
107
+ actions: string;
108
+ };
109
+ };
110
+ title: {
111
+ true: {
112
+ description: string;
113
+ };
114
+ };
115
+ }, {
116
+ root: string;
117
+ wrapper: string;
118
+ title: string;
119
+ description: string;
120
+ icon: string;
121
+ actions: string;
122
+ close: string;
123
+ }>;
84
124
  };
85
125
  export default _default;
@@ -14,17 +14,17 @@ export default ct(
14
14
  variants: {
15
15
  variant: {
16
16
  "solid": {
17
- root: "color-ui-c1 bg-ui-fill",
17
+ root: "color-ui-c1 bg-solid-ui-fill",
18
18
  close: "ui-base-inverted"
19
19
  },
20
20
  "outline": {
21
- root: "color-ui-content bg-ui-c1 ring ring-inset ring-ui-fill"
21
+ root: "color-ui-content bg-solid-ui-c1 ring ring-inset ring-ui-fill"
22
22
  },
23
23
  "soft": {
24
- root: "color-ui-content bg-ui-fill/10"
24
+ root: "color-ui-content bg-solid-ui-fill/10"
25
25
  },
26
26
  "soft-outline": {
27
- root: "color-ui-content bg-ui-fill/10 ring ring-inset ring-ui-fill/40"
27
+ root: "color-ui-content bg-solid-ui-fill/10 ring ring-inset ring-ui-fill/40"
28
28
  }
29
29
  },
30
30
  orientation: {
@@ -5,6 +5,11 @@ declare const _default: {
5
5
  check: string;
6
6
  indeterminate: string;
7
7
  down: string;
8
+ arrowLeft: string;
9
+ arrowRight: string;
10
+ doubleLeft: string;
11
+ doubleRight: string;
12
+ ellipsis: string;
8
13
  };
9
14
  };
10
15
  export default _default;
@@ -5,6 +5,11 @@ export default {
5
5
  loading: "i-mdi-loading",
6
6
  check: "i-mdi-check-bold",
7
7
  indeterminate: "i-mdi-minus-thick",
8
- down: "i-mdi-chevron-down"
8
+ down: "i-mdi-chevron-down",
9
+ arrowLeft: "i-mdi-chevron-left",
10
+ arrowRight: "i-mdi-chevron-right",
11
+ doubleLeft: "i-mdi-chevron-double-left",
12
+ doubleRight: "i-mdi-chevron-double-right",
13
+ ellipsis: "i-mdi-dots-horizontal"
9
14
  }
10
15
  };
@@ -75,5 +75,8 @@ declare const _default: {
75
75
  base: string;
76
76
  };
77
77
  })[];
78
+ defaultVariants: {
79
+ size: "md";
80
+ };
78
81
  };
79
82
  export default _default;
@@ -6,7 +6,7 @@ export default ct(
6
6
  root: "relative inline-flex items-center justify-center shrink-0",
7
7
  base: [
8
8
  "inline-block rounded-full ring ring-ui-c1 flex items-center justify-center color-ui-c1 font-medium whitespace-nowrap",
9
- "h-1.2em min-w-1.2em p-0.2em text-0.8em bg-ui-fill"
9
+ "h-1.2em min-w-1.2em p-0.2em text-0.8em bg-solid-ui-fill"
10
10
  ]
11
11
  },
12
12
  variants: {
@@ -84,6 +84,9 @@ export default ct(
84
84
  base: "translate-y-1/2 -translate-x-1/2 transform"
85
85
  }
86
86
  }
87
- ]
87
+ ],
88
+ defaultVariants: {
89
+ size: "md"
90
+ }
88
91
  }
89
92
  );