@byyuurin/ui 0.0.7 → 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 (121) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +5 -5
  3. package/dist/module.mjs.map +1 -1
  4. package/dist/runtime/app/injections.d.ts +16 -0
  5. package/dist/runtime/app/injections.js +31 -0
  6. package/dist/runtime/components/Accordion.vue +20 -20
  7. package/dist/runtime/components/Alert.vue +22 -15
  8. package/dist/runtime/components/App.vue +15 -15
  9. package/dist/runtime/components/Avatar.vue +73 -0
  10. package/dist/runtime/components/AvatarGroup.vue +90 -0
  11. package/dist/runtime/components/Badge.vue +15 -10
  12. package/dist/runtime/components/Breadcrumb.vue +105 -0
  13. package/dist/runtime/components/Button.vue +13 -13
  14. package/dist/runtime/components/ButtonGroup.vue +12 -10
  15. package/dist/runtime/components/Card.vue +7 -2
  16. package/dist/runtime/components/Carousel.vue +19 -12
  17. package/dist/runtime/components/Checkbox.vue +13 -9
  18. package/dist/runtime/components/Chip.vue +17 -12
  19. package/dist/runtime/components/Collapsible.vue +3 -3
  20. package/dist/runtime/components/Drawer.vue +14 -15
  21. package/dist/runtime/components/Input.vue +24 -24
  22. package/dist/runtime/components/InputNumber.vue +7 -5
  23. package/dist/runtime/components/Kbd.vue +51 -0
  24. package/dist/runtime/components/Link.vue +10 -10
  25. package/dist/runtime/components/LinkBase.vue +1 -1
  26. package/dist/runtime/components/Modal.vue +11 -8
  27. package/dist/runtime/components/ModalProvider.vue +2 -1
  28. package/dist/runtime/components/Pagination.vue +30 -30
  29. package/dist/runtime/components/PinInput.vue +7 -7
  30. package/dist/runtime/components/Popover.vue +7 -7
  31. package/dist/runtime/components/Progress.vue +165 -0
  32. package/dist/runtime/components/RadioGroup.vue +33 -29
  33. package/dist/runtime/components/Select.vue +40 -40
  34. package/dist/runtime/components/Skeleton.vue +33 -0
  35. package/dist/runtime/components/Slider.vue +6 -6
  36. package/dist/runtime/components/Switch.vue +11 -12
  37. package/dist/runtime/components/Table.vue +19 -11
  38. package/dist/runtime/components/Tabs.vue +22 -18
  39. package/dist/runtime/components/Textarea.vue +11 -11
  40. package/dist/runtime/components/Toast.vue +14 -13
  41. package/dist/runtime/components/Toaster.vue +4 -4
  42. package/dist/runtime/components/Tooltip.vue +7 -7
  43. package/dist/runtime/composables/useAvatarGroup.d.ts +4 -0
  44. package/dist/runtime/composables/useAvatarGroup.js +8 -0
  45. package/dist/runtime/composables/useButtonGroup.d.ts +4 -12
  46. package/dist/runtime/composables/useButtonGroup.js +1 -6
  47. package/dist/runtime/composables/useComponentIcons.d.ts +9 -9
  48. package/dist/runtime/composables/useComponentIcons.js +11 -11
  49. package/dist/runtime/composables/useKbd.d.ts +35 -0
  50. package/dist/runtime/composables/useKbd.js +49 -0
  51. package/dist/runtime/composables/useLocale.d.ts +8 -0
  52. package/dist/runtime/composables/useLocale.js +22 -0
  53. package/dist/runtime/composables/useModal.d.ts +1 -6
  54. package/dist/runtime/composables/useModal.js +1 -6
  55. package/dist/runtime/composables/useTheme.d.ts +0 -4
  56. package/dist/runtime/composables/useTheme.js +2 -12
  57. package/dist/runtime/index.d.ts +6 -0
  58. package/dist/runtime/index.js +6 -0
  59. package/dist/runtime/locale/en.d.ts +2 -0
  60. package/dist/runtime/locale/en.js +28 -0
  61. package/dist/runtime/locale/index.d.ts +2 -0
  62. package/dist/runtime/locale/index.js +2 -0
  63. package/dist/runtime/locale/zh-tw.d.ts +2 -0
  64. package/dist/runtime/locale/zh-tw.js +28 -0
  65. package/dist/runtime/theme/accordion.d.ts +6 -6
  66. package/dist/runtime/theme/accordion.js +2 -2
  67. package/dist/runtime/theme/app.d.ts +6 -6
  68. package/dist/runtime/theme/app.js +7 -7
  69. package/dist/runtime/theme/avatar-group.d.ts +52 -0
  70. package/dist/runtime/theme/avatar-group.js +32 -0
  71. package/dist/runtime/theme/avatar.d.ts +56 -0
  72. package/dist/runtime/theme/avatar.js +34 -0
  73. package/dist/runtime/theme/breadcrumb.d.ts +67 -0
  74. package/dist/runtime/theme/breadcrumb.js +44 -0
  75. package/dist/runtime/theme/button.d.ts +8 -8
  76. package/dist/runtime/theme/button.js +9 -9
  77. package/dist/runtime/theme/chip.d.ts +4 -4
  78. package/dist/runtime/theme/chip.js +2 -2
  79. package/dist/runtime/theme/drawer.js +2 -2
  80. package/dist/runtime/theme/index.d.ts +6 -0
  81. package/dist/runtime/theme/index.js +6 -0
  82. package/dist/runtime/theme/input-number.d.ts +6 -0
  83. package/dist/runtime/theme/input-number.js +5 -2
  84. package/dist/runtime/theme/input.d.ts +12 -12
  85. package/dist/runtime/theme/input.js +12 -12
  86. package/dist/runtime/theme/kbd.d.ts +39 -0
  87. package/dist/runtime/theme/kbd.js +26 -0
  88. package/dist/runtime/theme/modal.js +2 -2
  89. package/dist/runtime/theme/popover.js +1 -1
  90. package/dist/runtime/theme/progress.d.ts +122 -0
  91. package/dist/runtime/theme/progress.js +95 -0
  92. package/dist/runtime/theme/select.d.ts +18 -18
  93. package/dist/runtime/theme/select.js +16 -16
  94. package/dist/runtime/theme/skeleton.d.ts +8 -0
  95. package/dist/runtime/theme/skeleton.js +7 -0
  96. package/dist/runtime/theme/switch.js +1 -1
  97. package/dist/runtime/theme/tabs.d.ts +2 -2
  98. package/dist/runtime/theme/tabs.js +1 -1
  99. package/dist/runtime/theme/toast.js +2 -2
  100. package/dist/runtime/theme/tooltip.js +1 -1
  101. package/dist/runtime/types/components.d.ts +6 -0
  102. package/dist/runtime/types/index.d.ts +1 -0
  103. package/dist/runtime/types/index.js +1 -0
  104. package/dist/runtime/types/locale.d.ts +23 -0
  105. package/dist/runtime/types/locale.js +0 -0
  106. package/dist/runtime/types/utils.d.ts +1 -1
  107. package/dist/runtime/utils/index.d.ts +6 -1
  108. package/dist/runtime/utils/index.js +6 -4
  109. package/dist/runtime/utils/link.d.ts +1 -1
  110. package/dist/runtime/utils/translator.d.ts +18 -0
  111. package/dist/runtime/utils/translator.js +8 -0
  112. package/dist/shared/ui.ba24b380.mjs +4 -0
  113. package/dist/shared/ui.ba24b380.mjs.map +1 -0
  114. package/dist/unplugin.mjs +3 -12
  115. package/dist/unplugin.mjs.map +1 -1
  116. package/dist/vite.mjs +1 -1
  117. package/package.json +24 -13
  118. package/dist/shared/ui.d1728164.mjs +0 -4
  119. package/dist/shared/ui.d1728164.mjs.map +0 -1
  120. /package/dist/runtime/{composables/defineInjection.d.ts → utils/vue.d.ts} +0 -0
  121. /package/dist/runtime/{composables/defineInjection.js → utils/vue.js} +0 -0
@@ -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>
@@ -5,16 +5,8 @@ import type { Ref } from 'vue'
5
5
  import type { table } from '../theme'
6
6
  import type { ComponentAttrs } from '../types'
7
7
 
8
- export type TableData = RowData
9
- export type TableColumn<T extends TableData, D = unknown> = ColumnDef<T, D> & { title?: string }
10
-
11
- export interface TableOptions<T extends TableData> extends Omit<CoreOptions<T>, 'data' | 'columns' | 'getCoreRowModel' | 'state' | 'onStateChange' | 'renderFallbackValue'> {
12
- state?: CoreOptions<T>['state']
13
- onStateChange?: CoreOptions<T>['onStateChange']
14
- renderFallbackValue?: CoreOptions<T>['renderFallbackValue']
15
- }
16
-
17
8
  type DynamicHeaderSlots<T, K = keyof T> = Record<string, (props: HeaderContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-header`, (props: HeaderContext<T, unknown>) => any>
9
+
18
10
  type DynamicCellSlots<T, K = keyof T> = Record<string, (props: CellContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-cell`, (props: CellContext<T, unknown>) => any>
19
11
 
20
12
  export type TableSlots<T> = {
@@ -23,7 +15,21 @@ export type TableSlots<T> = {
23
15
  caption: (props?: {}) => any
24
16
  } & DynamicHeaderSlots<T> & DynamicCellSlots<T>
25
17
 
26
- export interface TableProps<T extends TableData> extends ComponentAttrs<typeof table>, Pick<PrimitiveProps, 'as'>, TableOptions<T> {
18
+ export type TableData = RowData
19
+ export type TableColumn<T extends TableData, D = unknown> = ColumnDef<T, D> & { title?: string }
20
+
21
+ export interface TableOptions<T extends TableData> extends Omit<CoreOptions<T>, 'data' | 'columns' | 'getCoreRowModel' | 'state' | 'onStateChange' | 'renderFallbackValue'> {
22
+ state?: CoreOptions<T>['state']
23
+ onStateChange?: CoreOptions<T>['onStateChange']
24
+ renderFallbackValue?: CoreOptions<T>['renderFallbackValue']
25
+ }
26
+
27
+ export interface TableProps<T extends TableData> extends ComponentAttrs<typeof table>, TableOptions<T> {
28
+ /**
29
+ * The element or component this component should render as.
30
+ * @default "div"
31
+ */
32
+ as?: PrimitiveProps['as']
27
33
  data?: T[]
28
34
  columns?: TableColumn<T>[]
29
35
  caption?: string
@@ -101,6 +107,7 @@ import { reactiveOmit } from '@vueuse/core'
101
107
  import { Primitive } from 'reka-ui'
102
108
  import { upperFirst } from 'scule'
103
109
  import { computed } from 'vue'
110
+ import { useLocale } from '../composables/useLocale'
104
111
  import { useTheme } from '../composables/useTheme'
105
112
 
106
113
  const props = defineProps<TableProps<T>>()
@@ -221,6 +228,7 @@ function valueUpdater<T extends Updater<any>>(updaterOrValue: T, ref: Ref) {
221
228
  ref.value = typeof updaterOrValue === 'function' ? updaterOrValue(ref.value) : updaterOrValue
222
229
  }
223
230
 
231
+ const { t } = useLocale()
224
232
  const { theme, createStyler } = useTheme()
225
233
  const style = computed(() => {
226
234
  const styler = createStyler(theme.value.table)
@@ -282,7 +290,7 @@ defineExpose({
282
290
  <tr v-else :class="style.tr({ class: props.ui?.tr })">
283
291
  <td :colspan="columns.length" :class="style.empty({ class: props.ui?.empty })">
284
292
  <slot name="empty">
285
- Empty
293
+ {{ t('table.noData') }}
286
294
  </slot>
287
295
  </td>
288
296
  </tr>
@@ -1,8 +1,19 @@
1
1
  <script lang="ts">
2
2
  import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { PrimitiveProps, TabsRootEmits, TabsRootProps } from 'reka-ui'
3
+ import type { TabsRootEmits, TabsRootProps } from 'reka-ui'
4
4
  import type { tabs } from '../theme'
5
- import type { ComponentAttrs } from '../types'
5
+ import type { ComponentAttrs, DynamicSlots } from '../types'
6
+
7
+ export interface TabsEmits extends TabsRootEmits<string | number> {}
8
+
9
+ type SlotProps<T> = (props: { item: T, index: number }) => any
10
+
11
+ export type TabsSlots<T extends { slot?: string }> = {
12
+ leading?: SlotProps<T>
13
+ default?: SlotProps<T>
14
+ trailing?: SlotProps<T>
15
+ content?: SlotProps<T>
16
+ } & DynamicSlots<T, SlotProps<T>>
6
17
 
7
18
  export interface TabsItem {
8
19
  label?: string
@@ -14,21 +25,14 @@ export interface TabsItem {
14
25
  disabled?: boolean
15
26
  }
16
27
 
17
- export interface TabsEmits extends TabsRootEmits<string | number> {}
18
-
19
- type SlotProps<T> = (props: { item: T, index: number }) => any
20
-
21
- export type TabsSlots<T extends { slot?: string }> = {
22
- prefix?: SlotProps<T>
23
- default?: SlotProps<T>
24
- suffix?: SlotProps<T>
25
- content?: SlotProps<T>
26
- } & Record<string, SlotProps<T>>
27
-
28
28
  type TabsVariants = VariantProps<typeof tabs>
29
29
 
30
30
  export interface TabsProps<T> extends ComponentAttrs<typeof tabs>, Pick<TabsRootProps<string | number>, 'defaultValue' | 'modelValue' | 'activationMode' | 'unmountOnHide'> {
31
- as?: PrimitiveProps['as']
31
+ /**
32
+ * The element or component this component should render as.
33
+ * @default "div"
34
+ */
35
+ as?: TabsRootProps<string | number>['as']
32
36
  items?: T[]
33
37
  variant?: TabsVariants['variant']
34
38
  orientation?: TabsVariants['orientation']
@@ -42,7 +46,7 @@ export interface TabsProps<T> extends ComponentAttrs<typeof tabs>, Pick<TabsRoot
42
46
  content?: boolean
43
47
  /**
44
48
  * The key used to get the label from the item.
45
- * @default 'label'
49
+ * @default "label"
46
50
  */
47
51
  labelKey?: string
48
52
  }
@@ -88,15 +92,15 @@ const style = computed(() => {
88
92
  :disabled="item.disabled"
89
93
  :class="style.trigger({ class: props.ui?.trigger })"
90
94
  >
91
- <slot name="prefix" :item="item" :index="index">
92
- <span v-if="item.icon" :class="style.prefixIcon({ class: [item.icon, props.ui?.prefixIcon] })"></span>
95
+ <slot name="leading" :item="item" :index="index">
96
+ <span v-if="item.icon" :class="style.leadingIcon({ class: [item.icon, props.ui?.leadingIcon] })"></span>
93
97
  </slot>
94
98
 
95
99
  <span v-if="get(item, props.labelKey) || slots.default" :class="style.label({ class: props.ui?.label })">
96
100
  <slot :item="item" :index="index">{{ get(item, props.labelKey) }}</slot>
97
101
  </span>
98
102
 
99
- <slot name="suffix" :item="item" :index="index"></slot>
103
+ <slot name="trailing" :item="item" :index="index"></slot>
100
104
  </TabsTrigger>
101
105
  </TabsList>
102
106
 
@@ -4,12 +4,22 @@ import type { PrimitiveProps } from 'reka-ui'
4
4
  import type { textarea } from '../theme'
5
5
  import type { ComponentAttrs } from '../types'
6
6
 
7
+ export interface TextareaEmits {
8
+ (e: 'update:modelValue', payload: string): void
9
+ (e: 'blur', event: FocusEvent): void
10
+ (e: 'change', event: Event): void
11
+ }
12
+
13
+ export interface TextareaSlots {
14
+ default?: (props?: {}) => any
15
+ }
16
+
7
17
  type TextareaVariants = VariantProps<typeof textarea>
8
18
 
9
19
  export interface TextareaProps extends ComponentAttrs<typeof textarea> {
10
20
  /**
11
21
  * The element or component this component should render as.
12
- * @defaultValue 'div'
22
+ * @default "div"
13
23
  */
14
24
  as?: PrimitiveProps['as']
15
25
  id?: string
@@ -27,16 +37,6 @@ export interface TextareaProps extends ComponentAttrs<typeof textarea> {
27
37
  maxRows?: number
28
38
  autoResize?: boolean
29
39
  }
30
-
31
- export interface TextareaEmits {
32
- (e: 'update:modelValue', payload: string): void
33
- (e: 'blur', event: FocusEvent): void
34
- (e: 'change', event: Event): void
35
- }
36
-
37
- export interface TextareaSlots {
38
- default?: (props?: {}) => any
39
- }
40
40
  </script>
41
41
 
42
42
  <script setup lang="ts">
@@ -4,6 +4,16 @@ import type { PrimitiveProps, ToastRootEmits, ToastRootProps } from 'reka-ui'
4
4
  import type { toast } from '../theme'
5
5
  import type { ButtonProps, ComponentAttrs } from '../types'
6
6
 
7
+ export interface ToastEmits extends ToastRootEmits {}
8
+
9
+ export interface ToastSlots {
10
+ icon?: (props?: {}) => any
11
+ title?: (props?: {}) => any
12
+ description?: (props?: {}) => any
13
+ actions?: (props?: {}) => any
14
+ close?: (props: { ui: any }) => any
15
+ }
16
+
7
17
  type ToastVariants = VariantProps<typeof toast>
8
18
 
9
19
  export interface ToastProps extends ComponentAttrs<typeof toast>, Pick<ToastRootProps, 'defaultOpen' | 'open' | 'type' | 'duration'> {
@@ -27,23 +37,13 @@ export interface ToastProps extends ComponentAttrs<typeof toast>, Pick<ToastRoot
27
37
  /** @default app.icons.close */
28
38
  closeIcon?: string
29
39
  }
30
-
31
- export interface ToastEmits extends ToastRootEmits {}
32
-
33
- export interface ToastSlots {
34
- icon?: (props?: {}) => any
35
- title?: (props?: {}) => any
36
- description?: (props?: {}) => any
37
- actions?: (props?: {}) => any
38
- close?: (props: { ui: any }) => any
39
-
40
- }
41
40
  </script>
42
41
 
43
42
  <script setup lang="ts">
44
43
  import { reactivePick, useElementBounding } from '@vueuse/core'
45
44
  import { ToastAction, ToastClose, ToastDescription, ToastRoot, ToastTitle, useForwardPropsEmits } from 'reka-ui'
46
45
  import { computed, ref } from 'vue'
46
+ import { useLocale } from '../composables/useLocale'
47
47
  import { useTheme } from '../composables/useTheme'
48
48
  import Button from './Button.vue'
49
49
 
@@ -60,6 +60,7 @@ const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultOpen',
60
60
  const el = ref<InstanceType<typeof ToastRoot>>()
61
61
  const { height } = useElementBounding(() => el.value?.$el.getBoundingClientRect ? el.value.$el : undefined)
62
62
 
63
+ const { t } = useLocale()
63
64
  const { theme, createStyler } = useTheme()
64
65
  const style = computed(() => {
65
66
  const styler = createStyler(theme.value.toast)
@@ -121,9 +122,9 @@ defineExpose({
121
122
  <Button
122
123
  v-if="props.close"
123
124
  :icon="props.closeIcon || theme.app.icons.close"
124
- size="md"
125
+ size="sm"
125
126
  variant="link"
126
- aria-label="close"
127
+ :aria-label="t('toast.close')"
127
128
  v-bind="typeof close === 'object' ? close : undefined"
128
129
  :class="style.close({ class: props.ui?.close })"
129
130
  @click.stop
@@ -4,6 +4,10 @@ import type { ToastProviderProps } from 'reka-ui'
4
4
  import type { toaster } from '../theme'
5
5
  import type { ComponentAttrs } from '../types'
6
6
 
7
+ export interface ToasterSlots {
8
+ default?: (props?: {}) => any
9
+ }
10
+
7
11
  type ToasterVariants = VariantProps<typeof toaster>
8
12
 
9
13
  export interface ToasterProps extends ComponentAttrs<typeof toaster>, Omit<ToastProviderProps, 'swipeDirection'> {
@@ -20,10 +24,6 @@ export interface ToasterProps extends ComponentAttrs<typeof toaster>, Omit<Toast
20
24
  */
21
25
  portal?: boolean
22
26
  }
23
-
24
- export interface ToasterSlots {
25
- default?: (props?: {}) => any
26
- }
27
27
  </script>
28
28
 
29
29
  <script setup lang="ts">
@@ -3,6 +3,13 @@ import type { TooltipArrowProps, TooltipContentProps, TooltipRootEmits, TooltipR
3
3
  import type { tooltip } from '../theme'
4
4
  import type { ComponentAttrs } from '../types'
5
5
 
6
+ export interface TooltipEmits extends TooltipRootEmits {}
7
+
8
+ export interface TooltipSlots {
9
+ default?: (props: { open: boolean }) => any
10
+ content?: (props: {}) => any
11
+ }
12
+
6
13
  export interface TooltipProps extends ComponentAttrs<typeof tooltip>, TooltipRootProps {
7
14
  text?: string
8
15
  content?: Omit<TooltipContentProps, 'as' | 'asChild'>
@@ -10,13 +17,6 @@ export interface TooltipProps extends ComponentAttrs<typeof tooltip>, TooltipRoo
10
17
  /** @default true */
11
18
  portal?: boolean
12
19
  }
13
-
14
- export interface TooltipEmits extends TooltipRootEmits {}
15
-
16
- export interface TooltipSlots {
17
- default?: (props: { open: boolean }) => any
18
- content?: (props: {}) => any
19
- }
20
20
  </script>
21
21
 
22
22
  <script lang="ts" setup>
@@ -0,0 +1,4 @@
1
+ import type { AvatarProps } from '../types/index.js';
2
+ export declare function useAvatarGroup(props?: AvatarProps): {
3
+ size: import("vue").ComputedRef<any>;
4
+ };
@@ -0,0 +1,8 @@
1
+ import { computed } from "vue";
2
+ import { injectAvatarGroup } from "../app/injections.js";
3
+ export function useAvatarGroup(props = {}) {
4
+ const avatarGroup = injectAvatarGroup();
5
+ return {
6
+ size: computed(() => props.size ?? avatarGroup?.value.size)
7
+ };
8
+ }
@@ -1,13 +1,5 @@
1
- import type { ComputedRef } from 'vue';
2
- import type { ButtonGroupProps } from '../components/ButtonGroup.vue.js';
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>;
1
+ import type { ButtonProps } from '../types/index.js';
2
+ export declare function useButtonGroup(props?: Pick<ButtonProps, 'size'>): {
3
+ size: import("vue").ComputedRef<any>;
4
+ orientation: import("vue").ComputedRef<any>;
12
5
  };
13
- export {};
@@ -1,10 +1,5 @@
1
1
  import { computed } from "vue";
2
- import { defineInjection } from "./defineInjection.js";
3
- export const {
4
- InjectionKey: InjectionKeyButtonGroup,
5
- inject: injectButtonGroup,
6
- provide: provideButtonGroup
7
- } = defineInjection("ui.buttonGroup");
2
+ import { injectButtonGroup } from "../app/injections.js";
8
3
  export function useButtonGroup(props = {}) {
9
4
  const buttonGroup = injectButtonGroup();
10
5
  return {
@@ -1,15 +1,15 @@
1
1
  import { type MaybeRefOrGetter } from 'vue';
2
2
  export interface UseComponentIconsProps {
3
- /** Display an icon based on the `prefix` and `suffix` props. */
3
+ /** Display an icon based on the `leading` and `trailing` props. */
4
4
  icon?: string;
5
5
  /** When `true`, the icon will be displayed on the left side. */
6
- prefix?: boolean;
6
+ leading?: boolean;
7
7
  /** Display an icon on the left side. */
8
- prefixIcon?: string;
8
+ leadingIcon?: string;
9
9
  /** When `true`, the icon will be displayed on the right side. */
10
- suffix?: boolean;
10
+ trailing?: boolean;
11
11
  /** Display an icon on the right side. */
12
- suffixIcon?: string;
12
+ trailingIcon?: string;
13
13
  /** When `true`, the loading icon will be displayed. */
14
14
  loading?: boolean;
15
15
  /**
@@ -19,8 +19,8 @@ export interface UseComponentIconsProps {
19
19
  loadingIcon?: string;
20
20
  }
21
21
  export declare function useComponentIcons(componentProps: MaybeRefOrGetter<UseComponentIconsProps>): {
22
- isPrefix: import("vue").ComputedRef<boolean>;
23
- isSuffix: import("vue").ComputedRef<boolean>;
24
- prefixIconName: import("vue").ComputedRef<string | undefined>;
25
- suffixIconName: import("vue").ComputedRef<string | undefined>;
22
+ isLeading: import("vue").ComputedRef<boolean>;
23
+ isTrailing: import("vue").ComputedRef<boolean>;
24
+ leadingIconName: import("vue").ComputedRef<string | undefined>;
25
+ trailingIconName: import("vue").ComputedRef<string | undefined>;
26
26
  };
@@ -3,22 +3,22 @@ import { useTheme } from "./useTheme.js";
3
3
  export function useComponentIcons(componentProps) {
4
4
  const { theme } = useTheme();
5
5
  const props = computed(() => toValue(componentProps));
6
- const isPrefix = computed(() => props.value.icon && props.value.prefix || props.value.icon && !props.value.suffix || props.value.loading && !props.value.suffix || !!props.value.prefixIcon);
7
- const isSuffix = computed(() => props.value.icon && props.value.suffix || props.value.loading && props.value.suffix || !!props.value.suffixIcon);
8
- const prefixIconName = computed(() => {
6
+ const isLeading = computed(() => props.value.icon && props.value.leading || props.value.icon && !props.value.trailing || props.value.loading && !props.value.trailing || !!props.value.leadingIcon);
7
+ const isTrailing = computed(() => props.value.icon && props.value.trailing || props.value.loading && props.value.trailing || !!props.value.trailingIcon);
8
+ const leadingIconName = computed(() => {
9
9
  if (props.value.loading)
10
10
  return props.value.loadingIcon || theme.value.app.icons.loading;
11
- return props.value.prefixIcon || props.value.icon;
11
+ return props.value.leadingIcon || props.value.icon;
12
12
  });
13
- const suffixIconName = computed(() => {
14
- if (props.value.loading && !isPrefix.value)
13
+ const trailingIconName = computed(() => {
14
+ if (props.value.loading && !isLeading.value)
15
15
  return props.value.loadingIcon || theme.value.app.icons.loading;
16
- return props.value.suffixIcon || props.value.icon;
16
+ return props.value.trailingIcon || props.value.icon;
17
17
  });
18
18
  return {
19
- isPrefix,
20
- isSuffix,
21
- prefixIconName,
22
- suffixIconName
19
+ isLeading,
20
+ isTrailing,
21
+ leadingIconName,
22
+ trailingIconName
23
23
  };
24
24
  }
@@ -0,0 +1,35 @@
1
+ interface KbdKeysSpecificMap {
2
+ meta: string;
3
+ alt: string;
4
+ ctrl: string;
5
+ }
6
+ export declare const kbdKeysMap: {
7
+ meta: string;
8
+ ctrl: string;
9
+ alt: string;
10
+ win: string;
11
+ command: string;
12
+ shift: string;
13
+ option: string;
14
+ enter: string;
15
+ delete: string;
16
+ backspace: string;
17
+ escape: string;
18
+ tab: string;
19
+ capslock: string;
20
+ arrowup: string;
21
+ arrowright: string;
22
+ arrowdown: string;
23
+ arrowleft: string;
24
+ pageup: string;
25
+ pagedown: string;
26
+ home: string;
27
+ end: string;
28
+ };
29
+ export type KbdKey = keyof typeof kbdKeysMap;
30
+ export type KbdKeySpecific = keyof KbdKeysSpecificMap;
31
+ export declare const useKbd: () => {
32
+ macOS: import("vue").ComputedRef<any>;
33
+ getKbdKey: (value?: KbdKey | (string & {})) => string | undefined;
34
+ };
35
+ export {};
@@ -0,0 +1,49 @@
1
+ import { createSharedComposable } from "@vueuse/core";
2
+ import { computed, onMounted, reactive } from "vue";
3
+ export const kbdKeysMap = {
4
+ meta: "",
5
+ ctrl: "",
6
+ alt: "",
7
+ win: "\u229E",
8
+ command: "\u2318",
9
+ shift: "\u21E7",
10
+ option: "\u2325",
11
+ enter: "\u21B5",
12
+ delete: "\u2326",
13
+ backspace: "\u232B",
14
+ escape: "\u238B",
15
+ tab: "\u21E5",
16
+ capslock: "\u21EA",
17
+ arrowup: "\u2191",
18
+ arrowright: "\u2192",
19
+ arrowdown: "\u2193",
20
+ arrowleft: "\u2190",
21
+ pageup: "\u21DE",
22
+ pagedown: "\u21DF",
23
+ home: "\u2196",
24
+ end: "\u2198"
25
+ };
26
+ export const useKbd = createSharedComposable(() => {
27
+ const macOS = computed(() => import.meta.client && navigator && navigator.userAgent && navigator.userAgent.match(/Macintosh;/));
28
+ const kbdKeysSpecificMap = reactive({
29
+ meta: " ",
30
+ alt: " ",
31
+ ctrl: " "
32
+ });
33
+ onMounted(() => {
34
+ kbdKeysSpecificMap.meta = macOS.value ? kbdKeysMap.command : kbdKeysMap.win;
35
+ kbdKeysSpecificMap.alt = macOS.value ? kbdKeysMap.option : "alt";
36
+ kbdKeysSpecificMap.ctrl = macOS.value ? "\u2303" : "ctrl";
37
+ });
38
+ function getKbdKey(value) {
39
+ if (!value)
40
+ return;
41
+ if (["meta", "alt", "ctrl"].includes(value))
42
+ return kbdKeysSpecificMap[value];
43
+ return kbdKeysMap[value] || value.toUpperCase();
44
+ }
45
+ return {
46
+ macOS,
47
+ getKbdKey
48
+ };
49
+ });
@@ -0,0 +1,8 @@
1
+ import type { Translator } from '../utils/translator.js';
2
+ export declare const useLocale: () => {
3
+ locale: import("vue").ComputedRef<import("../utils").Locale<import("..").Messages>>;
4
+ lang: import("vue").ComputedRef<string>;
5
+ code: import("vue").ComputedRef<string>;
6
+ dir: import("vue").ComputedRef<import("../utils").Direction>;
7
+ t: Translator<import("..").Messages>;
8
+ };
@@ -0,0 +1,22 @@
1
+ import { createSharedComposable } from "@vueuse/core";
2
+ import { computed, toValue } from "vue";
3
+ import { injectLocaleContext } from "../app/injections.js";
4
+ import localeDefault from "../locale/en.js";
5
+ import { createTranslator } from "../utils/index.js";
6
+ export const useLocale = createSharedComposable(() => {
7
+ const _locale = injectLocaleContext();
8
+ const locale = computed(() => toValue(_locale) ?? localeDefault);
9
+ const lang = computed(() => locale.value.name);
10
+ const code = computed(() => locale.value.code);
11
+ const dir = computed(() => locale.value.dir ?? "ltr");
12
+ const t = (path, options) => {
13
+ return createTranslator(toValue(locale))(path, options);
14
+ };
15
+ return {
16
+ locale,
17
+ lang,
18
+ code,
19
+ dir,
20
+ t
21
+ };
22
+ });
@@ -1,11 +1,6 @@
1
- import type { Component, ShallowRef } from 'vue';
1
+ import type { Component } from 'vue';
2
2
  import type { ComponentProps } from 'vue-component-type-helpers';
3
3
  import type { ModalProps } from '../types/index.js';
4
- export interface ModalState {
5
- component: Component | string;
6
- props: ModalProps;
7
- }
8
- export declare const InjectionKeyModalState: import("vue").InjectionKey<ShallowRef<ModalState>>, injectModalState: () => ShallowRef<ModalState> | undefined, provideModalState: (value: ShallowRef<ModalState>) => void;
9
4
  export declare const useModal: () => {
10
5
  open: <T extends Component>(component: T, props?: ModalProps & ComponentProps<T>) => void;
11
6
  close: () => void;
@@ -1,11 +1,6 @@
1
1
  import { createSharedComposable } from "@vueuse/core";
2
2
  import { ref } from "vue";
3
- import { defineInjection } from "./defineInjection.js";
4
- export const {
5
- InjectionKey: InjectionKeyModalState,
6
- inject: injectModalState,
7
- provide: provideModalState
8
- } = defineInjection("ui.modal");
3
+ import { injectModalState } from "../app/injections.js";
9
4
  export const useModal = createSharedComposable(() => {
10
5
  const modalState = injectModalState();
11
6
  const isOpen = ref(false);
@@ -1,8 +1,4 @@
1
- import type { UserConfig } from '@unocss/core';
2
- import type { MaybeRefOrGetter } from 'vue';
3
1
  import * as theme from '../theme/index.js';
4
- export declare const InjectionKeyThemeExtension: import("vue").InjectionKey<MaybeRefOrGetter<import("..").PartialTheme<typeof theme>>>, provideThemeExtension: (value: MaybeRefOrGetter<import("..").PartialTheme<typeof theme>>) => void, injectThemeExtension: () => MaybeRefOrGetter<import("..").PartialTheme<typeof theme>>;
5
- export declare const InjectionKeyUnoConfig: import("vue").InjectionKey<UserConfig<object>>, provideUnoConfig: (value: UserConfig<object>) => void, injectUnoConfig: () => UserConfig<object>;
6
2
  export declare const useTheme: () => {
7
3
  theme: import("vue").ComputedRef<typeof theme>;
8
4
  createStyler: <V extends import("@byyuurin/ui-kit").CVVariants<S, B>, CV extends import("@byyuurin/ui-kit").CVCompoundVariants<V, S, B>, DV extends import("@byyuurin/ui-kit").CVDefaultVariants<V, S>, B extends import("@byyuurin/ui-kit").ClassValue = undefined, S extends import("@byyuurin/ui-kit").CVSlots = undefined>(theme: import("@byyuurin/ui-kit").CVMeta<V, CV, DV, B, S>) => [keyof V] extends string[] ? (props: import("@byyuurin/ui-kit").VariantProps<import("@byyuurin/ui-kit").CVReturnType<V, S, B>> & import("..").StylerBaseProps) => S extends undefined ? string : { [K in keyof S | (B extends undefined ? never : "base")]: import("@byyuurin/ui-kit").CVHandler<V, S, string>; } : (props?: import("..").StylerBaseProps) => S extends undefined ? string : { [K in keyof S | (B extends undefined ? never : "base")]: import("@byyuurin/ui-kit").CVHandler<V, S, string>; };