@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.
- package/README.md +4 -5
- package/dist/module.cjs +5 -0
- package/dist/module.json +12 -0
- package/dist/{nuxt.mjs → module.mjs} +8 -8
- package/dist/module.mjs.map +1 -0
- package/dist/runtime/app/injections.d.ts +16 -0
- package/dist/runtime/app/injections.js +31 -0
- package/dist/runtime/components/Accordion.vue +27 -38
- package/dist/runtime/components/Alert.vue +23 -16
- package/dist/runtime/components/App.vue +15 -15
- package/dist/runtime/components/Avatar.vue +73 -0
- package/dist/runtime/components/AvatarGroup.vue +90 -0
- package/dist/runtime/components/Badge.vue +15 -10
- package/dist/runtime/components/Breadcrumb.vue +105 -0
- package/dist/runtime/components/Button.vue +22 -23
- package/dist/runtime/components/ButtonGroup.vue +12 -10
- package/dist/runtime/components/Card.vue +16 -8
- package/dist/runtime/components/Carousel.vue +19 -12
- package/dist/runtime/components/Checkbox.vue +16 -12
- package/dist/runtime/components/Chip.vue +17 -12
- package/dist/runtime/components/Collapsible.vue +56 -0
- package/dist/runtime/components/Drawer.vue +18 -17
- package/dist/runtime/components/Input.vue +28 -28
- package/dist/runtime/components/InputNumber.vue +169 -0
- package/dist/runtime/components/Kbd.vue +51 -0
- package/dist/runtime/components/Link.vue +301 -72
- package/dist/runtime/components/LinkBase.vue +88 -0
- package/dist/runtime/components/Modal.vue +11 -9
- package/dist/runtime/components/ModalProvider.vue +2 -1
- package/dist/runtime/components/Pagination.vue +30 -30
- package/dist/runtime/components/PinInput.vue +7 -7
- package/dist/runtime/components/Popover.vue +7 -7
- package/dist/runtime/components/Progress.vue +165 -0
- package/dist/runtime/components/RadioGroup.vue +33 -29
- package/dist/runtime/components/Select.vue +40 -40
- package/dist/runtime/components/Separator.vue +63 -0
- package/dist/runtime/components/Skeleton.vue +33 -0
- package/dist/runtime/components/Slider.vue +6 -6
- package/dist/runtime/components/Switch.vue +14 -15
- package/dist/runtime/components/Table.vue +300 -0
- package/dist/runtime/components/Tabs.vue +25 -21
- package/dist/runtime/components/Textarea.vue +11 -11
- package/dist/runtime/components/Toast.vue +15 -14
- package/dist/runtime/components/Toaster.vue +5 -39
- package/dist/runtime/components/Tooltip.vue +7 -7
- package/dist/runtime/composables/useAvatarGroup.d.ts +4 -0
- package/dist/runtime/composables/useAvatarGroup.js +8 -0
- package/dist/runtime/composables/useButtonGroup.d.ts +4 -12
- package/dist/runtime/composables/{useButtonGroup.mjs → useButtonGroup.js} +1 -6
- package/dist/runtime/composables/useComponentIcons.d.ts +9 -9
- package/dist/runtime/composables/useComponentIcons.js +24 -0
- package/dist/runtime/composables/useKbd.d.ts +35 -0
- package/dist/runtime/composables/useKbd.js +49 -0
- package/dist/runtime/composables/useLocale.d.ts +8 -0
- package/dist/runtime/composables/useLocale.js +22 -0
- package/dist/runtime/composables/useModal.d.ts +2 -7
- package/dist/runtime/composables/{useModal.mjs → useModal.js} +1 -6
- package/dist/runtime/composables/useTheme.d.ts +2 -6
- package/dist/runtime/composables/useTheme.js +16 -0
- package/dist/runtime/composables/useToast.d.ts +1 -1
- package/dist/runtime/index.d.ts +40 -0
- package/dist/runtime/index.js +40 -0
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +28 -0
- package/dist/runtime/locale/index.d.ts +2 -0
- package/dist/runtime/locale/index.js +2 -0
- package/dist/runtime/locale/zh-tw.d.ts +2 -0
- package/dist/runtime/locale/zh-tw.js +28 -0
- package/dist/runtime/theme/accordion.d.ts +5 -5
- package/dist/runtime/theme/{accordion.mjs → accordion.js} +2 -2
- package/dist/runtime/theme/alert.d.ts +2 -2
- package/dist/runtime/theme/{alert.mjs → alert.js} +4 -4
- package/dist/runtime/theme/app.d.ts +8 -5
- package/dist/runtime/theme/app.js +18 -0
- package/dist/runtime/theme/avatar-group.d.ts +52 -0
- package/dist/runtime/theme/avatar-group.js +32 -0
- package/dist/runtime/theme/avatar.d.ts +56 -0
- package/dist/runtime/theme/avatar.js +34 -0
- package/dist/runtime/theme/badge.d.ts +45 -21
- package/dist/runtime/theme/{badge.mjs → badge.js} +2 -2
- package/dist/runtime/theme/breadcrumb.d.ts +67 -0
- package/dist/runtime/theme/breadcrumb.js +44 -0
- package/dist/runtime/theme/button-group.d.ts +2 -2
- package/dist/runtime/theme/button.d.ts +61 -115
- package/dist/runtime/theme/button.js +164 -0
- package/dist/runtime/theme/card.d.ts +38 -38
- package/dist/runtime/theme/card.js +37 -0
- package/dist/runtime/theme/carousel.d.ts +2 -2
- package/dist/runtime/theme/{carousel.mjs → carousel.js} +2 -2
- package/dist/runtime/theme/checkbox.d.ts +1 -1
- package/dist/runtime/theme/{checkbox.mjs → checkbox.js} +3 -3
- package/dist/runtime/theme/chip.d.ts +47 -14
- package/dist/runtime/theme/{chip.mjs → chip.js} +7 -9
- package/dist/runtime/theme/collapsible.d.ts +38 -0
- package/dist/runtime/theme/collapsible.js +10 -0
- package/dist/runtime/theme/drawer.d.ts +43 -43
- package/dist/runtime/theme/{drawer.mjs → drawer.js} +33 -22
- package/dist/runtime/theme/index.d.ts +37 -27
- package/dist/runtime/theme/index.js +37 -0
- package/dist/runtime/theme/input-number.d.ts +141 -0
- package/dist/runtime/theme/input-number.js +95 -0
- package/dist/runtime/theme/input.d.ts +77 -105
- package/dist/runtime/theme/{input.mjs → input.js} +25 -25
- package/dist/runtime/theme/kbd.d.ts +39 -0
- package/dist/runtime/theme/kbd.js +26 -0
- package/dist/runtime/theme/link.d.ts +2 -2
- package/dist/runtime/theme/{link.mjs → link.js} +1 -1
- package/dist/runtime/theme/modal.d.ts +31 -8
- package/dist/runtime/theme/{modal.mjs → modal.js} +4 -9
- package/dist/runtime/theme/pagination.d.ts +17 -17
- package/dist/runtime/theme/pinInput.d.ts +42 -42
- package/dist/runtime/theme/{pinInput.mjs → pinInput.js} +10 -10
- package/dist/runtime/theme/popover.d.ts +8 -8
- package/dist/runtime/theme/{popover.mjs → popover.js} +1 -1
- package/dist/runtime/theme/progress.d.ts +122 -0
- package/dist/runtime/theme/progress.js +95 -0
- package/dist/runtime/theme/radio-group.d.ts +1 -1
- package/dist/runtime/theme/{radio-group.mjs → radio-group.js} +1 -1
- package/dist/runtime/theme/scroll-area.d.ts +17 -17
- package/dist/runtime/theme/{scroll-area.mjs → scroll-area.js} +2 -2
- package/dist/runtime/theme/select.d.ts +93 -108
- package/dist/runtime/theme/{select.mjs → select.js} +31 -31
- package/dist/runtime/theme/separator.d.ts +95 -0
- package/dist/runtime/theme/separator.js +53 -0
- package/dist/runtime/theme/skeleton.d.ts +8 -0
- package/dist/runtime/theme/skeleton.js +7 -0
- package/dist/runtime/theme/slider.d.ts +1 -1
- package/dist/runtime/theme/{slider.mjs → slider.js} +3 -3
- package/dist/runtime/theme/switch.d.ts +1 -1
- package/dist/runtime/theme/{switch.mjs → switch.js} +3 -3
- package/dist/runtime/theme/table.d.ts +89 -0
- package/dist/runtime/theme/table.js +35 -0
- package/dist/runtime/theme/tabs.d.ts +70 -53
- package/dist/runtime/theme/{tabs.mjs → tabs.js} +12 -12
- package/dist/runtime/theme/textarea.d.ts +43 -37
- package/dist/runtime/theme/{textarea.mjs → textarea.js} +10 -10
- package/dist/runtime/theme/toast.d.ts +2 -2
- package/dist/runtime/theme/{toast.mjs → toast.js} +3 -3
- package/dist/runtime/theme/toaster.d.ts +42 -27
- package/dist/runtime/theme/tooltip.d.ts +11 -11
- package/dist/runtime/theme/tooltip.js +11 -0
- package/dist/runtime/types/components.d.ts +37 -27
- package/dist/runtime/types/index.d.ts +5 -4
- package/dist/runtime/types/index.js +3 -0
- package/dist/runtime/types/locale.d.ts +23 -0
- package/dist/runtime/types/locale.js +0 -0
- package/dist/runtime/types/utils.d.ts +1 -1
- package/dist/runtime/types/utils.js +0 -0
- package/dist/runtime/utils/index.d.ts +9 -4
- package/dist/runtime/utils/{index.mjs → index.js} +9 -7
- package/dist/runtime/utils/link.d.ts +22 -7
- package/dist/runtime/utils/link.js +30 -0
- package/dist/runtime/utils/styler.d.ts +1 -1
- package/dist/runtime/utils/translator.d.ts +18 -0
- package/dist/runtime/utils/translator.js +8 -0
- package/dist/runtime/vue/stubs.d.ts +9 -0
- package/dist/runtime/vue/stubs.js +16 -0
- package/dist/shared/ui.ba24b380.mjs +4 -0
- package/dist/shared/ui.ba24b380.mjs.map +1 -0
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/unocss.d.mts +6 -11
- package/dist/unocss.d.ts +6 -11
- package/dist/unocss.mjs +40 -21
- package/dist/unocss.mjs.map +1 -1
- package/dist/unplugin.mjs +35 -8
- package/dist/unplugin.mjs.map +1 -1
- package/dist/vite.d.mts +0 -1
- package/dist/vite.d.ts +0 -1
- package/dist/vite.mjs +3 -1
- package/dist/vite.mjs.map +1 -1
- package/package.json +50 -38
- package/dist/index.d.ts +0 -29
- package/dist/index.mjs +0 -29
- package/dist/nuxt.mjs.map +0 -1
- package/dist/runtime/composables/useComponentIcons.mjs +0 -24
- package/dist/runtime/composables/useTheme.mjs +0 -26
- package/dist/runtime/theme/app.mjs +0 -15
- package/dist/runtime/theme/button.mjs +0 -148
- package/dist/runtime/theme/card.mjs +0 -14
- package/dist/runtime/theme/index.mjs +0 -27
- package/dist/runtime/theme/tooltip.mjs +0 -11
- package/dist/runtime/types/components.mjs +0 -27
- package/dist/runtime/types/index.mjs +0 -2
- package/dist/runtime/utils/link.mjs +0 -4
- package/dist/shared/ui.D4zm1r0C.mjs +0 -4
- package/dist/shared/ui.D4zm1r0C.mjs.map +0 -1
- /package/dist/{nuxt.d.mts → module.d.mts} +0 -0
- /package/dist/{nuxt.d.ts → module.d.ts} +0 -0
- /package/dist/runtime/composables/{useToast.mjs → useToast.js} +0 -0
- /package/dist/runtime/theme/{button-group.mjs → button-group.js} +0 -0
- /package/dist/runtime/theme/{pagination.mjs → pagination.js} +0 -0
- /package/dist/runtime/theme/{toaster.mjs → toaster.js} +0 -0
- /package/dist/runtime/types/{utils.mjs → components.js} +0 -0
- /package/dist/runtime/utils/{extend-theme.mjs → extend-theme.js} +0 -0
- /package/dist/runtime/utils/{styler.mjs → styler.js} +0 -0
- /package/dist/runtime/{composables/defineInjection.d.ts → utils/vue.d.ts} +0 -0
- /package/dist/runtime/{composables/defineInjection.mjs → utils/vue.js} +0 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { PrimitiveProps } from 'reka-ui'
|
|
3
|
+
import type { breadcrumb } from '../theme'
|
|
4
|
+
import type { ComponentAttrs, DynamicSlots, LinkProps } from '../types'
|
|
5
|
+
|
|
6
|
+
type SlotProps<T> = (props: { item: T, index: number, active?: boolean }) => any
|
|
7
|
+
|
|
8
|
+
export type BreadcrumbSlots<T extends { slot?: string }> = {
|
|
9
|
+
'item'?: SlotProps<T>
|
|
10
|
+
'item-leading'?: SlotProps<T>
|
|
11
|
+
'item-label'?: SlotProps<T>
|
|
12
|
+
'item-trailing'?: SlotProps<T>
|
|
13
|
+
'separator'?: (props?: {}) => any
|
|
14
|
+
} & DynamicSlots<T, SlotProps<T>>
|
|
15
|
+
|
|
16
|
+
export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
|
|
17
|
+
label?: string
|
|
18
|
+
icon?: string
|
|
19
|
+
slot?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface BreadcrumbProps<T> extends ComponentAttrs<typeof breadcrumb> {
|
|
23
|
+
/**
|
|
24
|
+
* The element or component this component should render as.
|
|
25
|
+
* @default "nav"
|
|
26
|
+
*/
|
|
27
|
+
as?: PrimitiveProps['as']
|
|
28
|
+
dir?: 'rtl' | 'ltr'
|
|
29
|
+
items?: T[]
|
|
30
|
+
/**
|
|
31
|
+
* The icon to use as a separator.
|
|
32
|
+
* @default app.icons.chevronRight
|
|
33
|
+
*/
|
|
34
|
+
separatorIcon?: string
|
|
35
|
+
/**
|
|
36
|
+
* The key used to get the label from the item.
|
|
37
|
+
* @default "label"
|
|
38
|
+
*/
|
|
39
|
+
labelKey?: string
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<script setup lang="ts" generic="T extends BreadcrumbItem">
|
|
44
|
+
import { Primitive } from 'reka-ui'
|
|
45
|
+
import { computed } from 'vue'
|
|
46
|
+
import { useTheme } from '../composables/useTheme'
|
|
47
|
+
import { get, pickLinkProps } from '../utils'
|
|
48
|
+
import Link from './Link.vue'
|
|
49
|
+
import LinkBase from './LinkBase.vue'
|
|
50
|
+
|
|
51
|
+
const props = withDefaults(defineProps<BreadcrumbProps<T>>(), {
|
|
52
|
+
as: 'nav',
|
|
53
|
+
labelKey: 'label',
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const slots = defineSlots<BreadcrumbSlots<T>>()
|
|
57
|
+
|
|
58
|
+
const { theme, createStyler } = useTheme()
|
|
59
|
+
|
|
60
|
+
const separatorIcon = computed(() => props.separatorIcon || (props.dir === 'rtl' ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight))
|
|
61
|
+
|
|
62
|
+
const style = computed(() => {
|
|
63
|
+
const styler = createStyler(theme.value.breadcrumb)
|
|
64
|
+
return styler(props)
|
|
65
|
+
})
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<template>
|
|
69
|
+
<Primitive :as="props.as" aria-label="breadcrumb" :class="style.root({ class: [props.class, props.ui?.root] })">
|
|
70
|
+
<ol :class="style.list({ class: props.ui?.list })">
|
|
71
|
+
<template v-for="(item, index) in props.items" :key="index">
|
|
72
|
+
<li :class="style.item({ class: props.ui?.item })">
|
|
73
|
+
<Link v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
|
74
|
+
<LinkBase
|
|
75
|
+
v-bind="slotProps"
|
|
76
|
+
as="span"
|
|
77
|
+
:aria-current="active && (index === items!.length - 1) ? 'page' : undefined"
|
|
78
|
+
:class="style.link({ class: props.ui?.link, active: index === items!.length - 1, disabled: item.disabled, to: !!item.to })"
|
|
79
|
+
>
|
|
80
|
+
<slot :name="item.slot || 'item'" :item="item" :index="index">
|
|
81
|
+
<slot :name="`${item.slot || 'item'}-leading`" :item="item" :active="index === items!.length - 1" :index="index">
|
|
82
|
+
<span v-if="item.icon" :class="style.linkLeadingIcon({ class: [item.icon, props.ui?.linkLeadingIcon] })"></span>
|
|
83
|
+
</slot>
|
|
84
|
+
|
|
85
|
+
<span v-if="get(item, props.labelKey) || slots[`${item.slot || 'item'}-label`]" :class="style.linkLabel({ class: props.ui?.linkLabel })">
|
|
86
|
+
<slot :name="`${item.slot || 'item'}-label`" :item="item" :active="index === items!.length - 1" :index="index">
|
|
87
|
+
{{ get(item, props.labelKey) }}
|
|
88
|
+
</slot>
|
|
89
|
+
</span>
|
|
90
|
+
|
|
91
|
+
<slot :name="`${item.slot || 'item'}-trailing`" :item="item" :active="index === items!.length - 1" :index="index"></slot>
|
|
92
|
+
</slot>
|
|
93
|
+
</LinkBase>
|
|
94
|
+
</Link>
|
|
95
|
+
</li>
|
|
96
|
+
|
|
97
|
+
<li v-if="index < items!.length - 1" role="presentation" aria-hidden="true" :class="style.separator({ class: props.ui?.separator })">
|
|
98
|
+
<slot name="separator">
|
|
99
|
+
<span :class="style.separatorIcon({ class: [separatorIcon, props.ui?.separatorIcon] })"></span>
|
|
100
|
+
</slot>
|
|
101
|
+
</li>
|
|
102
|
+
</template>
|
|
103
|
+
</ol>
|
|
104
|
+
</Primitive>
|
|
105
|
+
</template>
|
|
@@ -6,15 +6,14 @@ import type { ComponentAttrs } from '../types'
|
|
|
6
6
|
import type { LinkProps } from './Link.vue'
|
|
7
7
|
|
|
8
8
|
export interface ButtonSlots {
|
|
9
|
-
default?: (props?:
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
default?: (props?: {}) => any
|
|
10
|
+
leading?: (props?: {}) => any
|
|
11
|
+
trailing?: (props?: {}) => any
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
type ButtonVariants = VariantProps<typeof button>
|
|
15
|
-
type UIOptions = ComponentAttrs<typeof button>['ui'] & LinkProps['ui']
|
|
16
15
|
|
|
17
|
-
export interface ButtonProps extends
|
|
16
|
+
export interface ButtonProps extends ComponentAttrs<typeof button>, UseComponentIconsProps, Omit<LinkProps, 'raw' | 'custom' | 'underline'> {
|
|
18
17
|
icon?: string
|
|
19
18
|
label?: string
|
|
20
19
|
variant?: ButtonVariants['variant']
|
|
@@ -22,11 +21,11 @@ export interface ButtonProps extends Omit<ComponentAttrs<typeof button>, 'ui'>,
|
|
|
22
21
|
loading?: boolean
|
|
23
22
|
active?: boolean
|
|
24
23
|
disabled?: boolean
|
|
25
|
-
ui?: UIOptions
|
|
26
24
|
}
|
|
27
25
|
</script>
|
|
28
26
|
|
|
29
27
|
<script lang="ts" setup>
|
|
28
|
+
import { useForwardProps } from 'reka-ui'
|
|
30
29
|
import { computed } from 'vue'
|
|
31
30
|
import { useButtonGroup } from '../composables/useButtonGroup'
|
|
32
31
|
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
@@ -41,11 +40,11 @@ const props = withDefaults(defineProps<ButtonProps>(), {
|
|
|
41
40
|
const slots = defineSlots<ButtonSlots>()
|
|
42
41
|
|
|
43
42
|
const { size, orientation } = useButtonGroup(props)
|
|
44
|
-
const {
|
|
43
|
+
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(
|
|
45
44
|
computed(() => ({ ...props, loading: props.loading })),
|
|
46
45
|
)
|
|
47
46
|
|
|
48
|
-
const linkProps = pickLinkProps(props)
|
|
47
|
+
const linkProps = useForwardProps(pickLinkProps(props))
|
|
49
48
|
|
|
50
49
|
const { theme, createStyler } = useTheme()
|
|
51
50
|
|
|
@@ -55,12 +54,12 @@ const style = computed(() => {
|
|
|
55
54
|
...props,
|
|
56
55
|
size: size.value,
|
|
57
56
|
groupOrientation: orientation.value,
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
leading: isLeading.value,
|
|
58
|
+
trailing: isTrailing.value,
|
|
60
59
|
class: [
|
|
61
60
|
props.class,
|
|
62
|
-
props.active ? props.
|
|
63
|
-
props.disabled ? props.
|
|
61
|
+
props.active ? props.activeClass : props.inactiveClass,
|
|
62
|
+
props.disabled ? props.disableClass : undefined,
|
|
64
63
|
],
|
|
65
64
|
})
|
|
66
65
|
})
|
|
@@ -71,14 +70,14 @@ const style = computed(() => {
|
|
|
71
70
|
:class="style.base({ class: [props.class, props.ui?.base] })"
|
|
72
71
|
:type="props.type"
|
|
73
72
|
:disabled="props.disabled || props.loading"
|
|
74
|
-
v-bind="omit(linkProps, ['type', 'disabled'])"
|
|
73
|
+
v-bind="omit(linkProps, ['type', 'disabled', 'activeClass', 'inactiveClass', 'disableClass'])"
|
|
75
74
|
raw
|
|
76
75
|
>
|
|
77
|
-
<slot name="
|
|
78
|
-
<
|
|
79
|
-
v-if="
|
|
80
|
-
:class="style.
|
|
81
|
-
></
|
|
76
|
+
<slot name="leading">
|
|
77
|
+
<span
|
|
78
|
+
v-if="isLeading && leadingIconName"
|
|
79
|
+
:class="style.leadingIcon({ class: [leadingIconName, props.ui?.leadingIcon] })"
|
|
80
|
+
></span>
|
|
82
81
|
</slot>
|
|
83
82
|
<span
|
|
84
83
|
v-if="props.label || slots.default"
|
|
@@ -86,11 +85,11 @@ const style = computed(() => {
|
|
|
86
85
|
>
|
|
87
86
|
<slot>{{ label }}</slot>
|
|
88
87
|
</span>
|
|
89
|
-
<slot name="
|
|
90
|
-
<
|
|
91
|
-
v-if="
|
|
92
|
-
:class="style.
|
|
93
|
-
></
|
|
88
|
+
<slot name="trailing">
|
|
89
|
+
<span
|
|
90
|
+
v-if="isTrailing && trailingIconName"
|
|
91
|
+
:class="style.trailingIcon({ class: [trailingIconName, props.ui?.trailingIcon] })"
|
|
92
|
+
></span>
|
|
94
93
|
</slot>
|
|
95
94
|
</Link>
|
|
96
95
|
</template>
|
|
@@ -4,22 +4,27 @@ import type { PrimitiveProps } from 'reka-ui'
|
|
|
4
4
|
import type { buttonGroup } from '../theme'
|
|
5
5
|
import type { ComponentAttrs } from '../types'
|
|
6
6
|
|
|
7
|
+
export interface ButtonGroupSlots {
|
|
8
|
+
default?: (props?: {}) => any
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
type ButtonGroupVariant = VariantProps<typeof buttonGroup>
|
|
8
12
|
|
|
9
|
-
export interface ButtonGroupProps extends Omit<ComponentAttrs<typeof buttonGroup>, 'ui'
|
|
13
|
+
export interface ButtonGroupProps extends Omit<ComponentAttrs<typeof buttonGroup>, 'ui'> {
|
|
14
|
+
/**
|
|
15
|
+
* The element or component this component should render as.
|
|
16
|
+
* @default "div"
|
|
17
|
+
*/
|
|
18
|
+
as?: PrimitiveProps['as']
|
|
10
19
|
size?: ButtonGroupVariant['size']
|
|
11
20
|
orientation?: ButtonGroupVariant['orientation']
|
|
12
21
|
}
|
|
13
|
-
|
|
14
|
-
export interface ButtonGroupSlots {
|
|
15
|
-
default?: (props?: any) => any
|
|
16
|
-
}
|
|
17
22
|
</script>
|
|
18
23
|
|
|
19
24
|
<script setup lang="ts">
|
|
20
25
|
import { Primitive } from 'reka-ui'
|
|
21
26
|
import { computed } from 'vue'
|
|
22
|
-
import { provideButtonGroup } from '../
|
|
27
|
+
import { provideButtonGroup } from '../app/injections'
|
|
23
28
|
import { useTheme } from '../composables/useTheme'
|
|
24
29
|
|
|
25
30
|
const props = withDefaults(defineProps<ButtonGroupProps>(), {
|
|
@@ -28,10 +33,7 @@ const props = withDefaults(defineProps<ButtonGroupProps>(), {
|
|
|
28
33
|
|
|
29
34
|
defineSlots<ButtonGroupSlots>()
|
|
30
35
|
|
|
31
|
-
provideButtonGroup(computed(() =>
|
|
32
|
-
size: props.size,
|
|
33
|
-
orientation: props.orientation,
|
|
34
|
-
})))
|
|
36
|
+
provideButtonGroup(computed(() => props))
|
|
35
37
|
|
|
36
38
|
const { theme, createStyler } = useTheme()
|
|
37
39
|
const style = computed(() => {
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
2
3
|
import type { PrimitiveProps } from 'reka-ui'
|
|
3
4
|
import type { card } from '../theme'
|
|
4
5
|
import type { ComponentAttrs } from '../types'
|
|
5
6
|
|
|
6
|
-
export interface CardProps extends ComponentAttrs<typeof card> {
|
|
7
|
-
as?: PrimitiveProps['as']
|
|
8
|
-
title?: string
|
|
9
|
-
description?: string
|
|
10
|
-
}
|
|
11
|
-
|
|
12
7
|
export interface CardSlots {
|
|
13
8
|
default?: (props?: {}) => any
|
|
14
9
|
content?: (props?: {}) => any
|
|
15
10
|
header?: (props?: {}) => any
|
|
16
|
-
title?: (props?:
|
|
17
|
-
description?: (props?:
|
|
11
|
+
title?: (props?: {}) => any
|
|
12
|
+
description?: (props?: {}) => any
|
|
18
13
|
footer?: (props?: {}) => any
|
|
19
14
|
}
|
|
15
|
+
|
|
16
|
+
type CardVariants = VariantProps<typeof card>
|
|
17
|
+
|
|
18
|
+
export interface CardProps extends ComponentAttrs<typeof card> {
|
|
19
|
+
/**
|
|
20
|
+
* The element or component this component should render as.
|
|
21
|
+
* @default "div"
|
|
22
|
+
*/
|
|
23
|
+
as?: PrimitiveProps['as']
|
|
24
|
+
variant?: CardVariants['variant']
|
|
25
|
+
title?: string
|
|
26
|
+
description?: string
|
|
27
|
+
}
|
|
20
28
|
</script>
|
|
21
29
|
|
|
22
30
|
<script setup lang="ts">
|
|
@@ -11,9 +11,18 @@ import type { AcceptableValue, PrimitiveProps } from 'reka-ui'
|
|
|
11
11
|
import type { carousel } from '../theme'
|
|
12
12
|
import type { ButtonProps, ComponentAttrs } from '../types'
|
|
13
13
|
|
|
14
|
+
export interface CarouselSlots<T> {
|
|
15
|
+
default?: (props: { item: T, index: number }) => any
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
type CarouselVariants = VariantProps<typeof carousel>
|
|
15
19
|
|
|
16
|
-
export interface CarouselProps<T> extends ComponentAttrs<typeof carousel>,
|
|
20
|
+
export interface CarouselProps<T> extends ComponentAttrs<typeof carousel>, Omit<EmblaOptionsType, 'axis' | 'container' | 'slides' | 'direction'> {
|
|
21
|
+
/**
|
|
22
|
+
* The element or component this component should render as.
|
|
23
|
+
* @default "div"
|
|
24
|
+
*/
|
|
25
|
+
as?: PrimitiveProps['as']
|
|
17
26
|
/**
|
|
18
27
|
* Configure the prev button when arrows are enabled.
|
|
19
28
|
* @default { size: 'md', variant: 'link' }
|
|
@@ -21,7 +30,7 @@ export interface CarouselProps<T> extends ComponentAttrs<typeof carousel>, Pick<
|
|
|
21
30
|
prev?: ButtonProps
|
|
22
31
|
/**
|
|
23
32
|
* The icon displayed in the prev button.
|
|
24
|
-
* @default
|
|
33
|
+
* @default app.icons.chevronLeft
|
|
25
34
|
*/
|
|
26
35
|
prevIcon?: string
|
|
27
36
|
/**
|
|
@@ -31,7 +40,7 @@ export interface CarouselProps<T> extends ComponentAttrs<typeof carousel>, Pick<
|
|
|
31
40
|
next?: ButtonProps
|
|
32
41
|
/**
|
|
33
42
|
* The icon displayed in the next button.
|
|
34
|
-
* @default
|
|
43
|
+
* @default app.icons.chevronRight
|
|
35
44
|
*/
|
|
36
45
|
nextIcon?: string
|
|
37
46
|
/**
|
|
@@ -78,10 +87,6 @@ export interface CarouselProps<T> extends ComponentAttrs<typeof carousel>, Pick<
|
|
|
78
87
|
*/
|
|
79
88
|
wheelGestures?: boolean | WheelGesturesPluginOptions
|
|
80
89
|
}
|
|
81
|
-
|
|
82
|
-
export interface CarouselSlots<T> {
|
|
83
|
-
default?: (props: { item: T, index: number }) => any
|
|
84
|
-
}
|
|
85
90
|
</script>
|
|
86
91
|
|
|
87
92
|
<script setup lang="ts" generic="T extends AcceptableValue">
|
|
@@ -89,6 +94,7 @@ import { computedAsync, reactivePick } from '@vueuse/core'
|
|
|
89
94
|
import useEmblaCarousel from 'embla-carousel-vue'
|
|
90
95
|
import { Primitive, useForwardProps } from 'reka-ui'
|
|
91
96
|
import { computed, onMounted, ref, watch } from 'vue'
|
|
97
|
+
import { useLocale } from '../composables/useLocale'
|
|
92
98
|
import { useTheme } from '../composables/useTheme'
|
|
93
99
|
import Button from './Button.vue'
|
|
94
100
|
|
|
@@ -129,14 +135,15 @@ defineSlots<CarouselSlots<T>>()
|
|
|
129
135
|
|
|
130
136
|
const rootProps = useForwardProps(reactivePick(props, 'active', 'align', 'breakpoints', 'containScroll', 'dragFree', 'dragThreshold', 'duration', 'inViewThreshold', 'loop', 'skipSnaps', 'slidesToScroll', 'startIndex', 'watchDrag', 'watchResize', 'watchSlides', 'watchFocus'))
|
|
131
137
|
|
|
138
|
+
const { t } = useLocale()
|
|
132
139
|
const { theme, createStyler } = useTheme()
|
|
133
140
|
const style = computed(() => {
|
|
134
141
|
const styler = createStyler(theme.value.carousel)
|
|
135
142
|
return styler(props)
|
|
136
143
|
})
|
|
137
144
|
|
|
138
|
-
const prevIcon = computed(() => props.prevIcon || (props.dir === 'rtl' ? theme.value.app.icons.
|
|
139
|
-
const nextIcon = computed(() => props.nextIcon || (props.dir === 'rtl' ? theme.value.app.icons.
|
|
145
|
+
const prevIcon = computed(() => props.prevIcon || (props.dir === 'rtl' ? theme.value.app.icons.chevronRight : theme.value.app.icons.chevronLeft))
|
|
146
|
+
const nextIcon = computed(() => props.nextIcon || (props.dir === 'rtl' ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight))
|
|
140
147
|
|
|
141
148
|
const options = computed<EmblaOptionsType>(() => ({
|
|
142
149
|
...(props.fade ? { align: 'center', containScroll: false } : {}),
|
|
@@ -279,7 +286,7 @@ defineExpose({
|
|
|
279
286
|
:icon="prevIcon"
|
|
280
287
|
size="md"
|
|
281
288
|
variant="outline"
|
|
282
|
-
aria-label="prev"
|
|
289
|
+
:aria-label="t('carousel.prev')"
|
|
283
290
|
v-bind="typeof props.prev === 'object' ? props.prev : undefined"
|
|
284
291
|
:class="style.prev({ class: props.ui?.prev })"
|
|
285
292
|
@click="scrollPrev"
|
|
@@ -289,7 +296,7 @@ defineExpose({
|
|
|
289
296
|
:icon="nextIcon"
|
|
290
297
|
size="md"
|
|
291
298
|
variant="outline"
|
|
292
|
-
aria-label="next"
|
|
299
|
+
:aria-label="t('carousel.next')"
|
|
293
300
|
v-bind="typeof props.next === 'object' ? props.next : undefined"
|
|
294
301
|
:class="style.next({ class: props.ui?.next })"
|
|
295
302
|
@click="scrollNext"
|
|
@@ -299,7 +306,7 @@ defineExpose({
|
|
|
299
306
|
<div v-if="props.dots" :class="style.dots({ class: props.ui?.dots })">
|
|
300
307
|
<template v-for="(_, index) in scrollSnaps" :key="index">
|
|
301
308
|
<button
|
|
302
|
-
:aria-label="
|
|
309
|
+
:aria-label="t('carousel.goto', { page: index + 1 })"
|
|
303
310
|
:class="style.dot({ class: props.ui?.dot, active: selectedIndex === index })"
|
|
304
311
|
@click="scrollTo(index)"
|
|
305
312
|
></button>
|
|
@@ -4,9 +4,22 @@ import type { CheckboxRootProps, PrimitiveProps } from 'reka-ui'
|
|
|
4
4
|
import type { checkbox } from '../theme'
|
|
5
5
|
import type { ComponentAttrs } from '../types'
|
|
6
6
|
|
|
7
|
+
export interface CheckboxEmits {
|
|
8
|
+
(event: 'change', payload: Event): void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface CheckboxSlots {
|
|
12
|
+
label?: (props: { label?: string }) => any
|
|
13
|
+
description?: (props: { description?: string }) => any
|
|
14
|
+
}
|
|
15
|
+
|
|
7
16
|
type CheckboxVariants = VariantProps<typeof checkbox>
|
|
8
17
|
|
|
9
18
|
export interface CheckboxProps extends ComponentAttrs<typeof checkbox>, Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id' | 'defaultValue'> {
|
|
19
|
+
/**
|
|
20
|
+
* The element or component this component should render as.
|
|
21
|
+
* @default "div"
|
|
22
|
+
*/
|
|
10
23
|
as?: PrimitiveProps['as']
|
|
11
24
|
label?: string
|
|
12
25
|
description?: string
|
|
@@ -22,15 +35,6 @@ export interface CheckboxProps extends ComponentAttrs<typeof checkbox>, Pick<Che
|
|
|
22
35
|
*/
|
|
23
36
|
indeterminateIcon?: string
|
|
24
37
|
}
|
|
25
|
-
|
|
26
|
-
export interface CheckboxEmits {
|
|
27
|
-
(event: 'change', payload: Event): void
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface CheckboxSlots {
|
|
31
|
-
label?: (props: { label?: string }) => any
|
|
32
|
-
description?: (props: { description?: string }) => any
|
|
33
|
-
}
|
|
34
38
|
</script>
|
|
35
39
|
|
|
36
40
|
<script lang="ts" setup>
|
|
@@ -78,11 +82,11 @@ function onUpdate(value: any) {
|
|
|
78
82
|
@update:model-value="onUpdate"
|
|
79
83
|
>
|
|
80
84
|
<CheckboxIndicator as-child force-mount>
|
|
81
|
-
<
|
|
85
|
+
<span
|
|
82
86
|
v-if="modelValue === 'indeterminate'"
|
|
83
87
|
:class="style.icon({ class: [props.indeterminateIcon || theme.app.icons.indeterminate, props.ui?.icon] })"
|
|
84
|
-
></
|
|
85
|
-
<
|
|
88
|
+
></span>
|
|
89
|
+
<span v-else :class="style.icon({ class: [props.icon, theme.app.icons.check, props.ui?.icon] })"></span>
|
|
86
90
|
</CheckboxIndicator>
|
|
87
91
|
</CheckboxRoot>
|
|
88
92
|
</div>
|
|
@@ -5,19 +5,24 @@ import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
|
5
5
|
import type { chip } from '../theme'
|
|
6
6
|
import type { ComponentAttrs } from '../types'
|
|
7
7
|
|
|
8
|
+
export interface ChipSlots {
|
|
9
|
+
leading?: (props?: {}) => any
|
|
10
|
+
default?: (props?: {}) => any
|
|
11
|
+
trailing?: (props?: {}) => any
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
type ChipVariants = VariantProps<typeof chip>
|
|
9
15
|
|
|
10
|
-
export interface ChipProps extends ComponentAttrs<typeof chip>,
|
|
16
|
+
export interface ChipProps extends ComponentAttrs<typeof chip>, Omit<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
|
|
17
|
+
/**
|
|
18
|
+
* The element or component this component should render as.
|
|
19
|
+
* @default "div"
|
|
20
|
+
*/
|
|
21
|
+
as?: PrimitiveProps['as']
|
|
11
22
|
variant?: ChipVariants['variant']
|
|
12
23
|
size?: ChipVariants['size']
|
|
13
24
|
label?: string
|
|
14
25
|
}
|
|
15
|
-
|
|
16
|
-
export interface ChipSlots {
|
|
17
|
-
prefix?: (props?: {}) => any
|
|
18
|
-
default?: (props?: {}) => any
|
|
19
|
-
suffix?: (props?: {}) => any
|
|
20
|
-
}
|
|
21
26
|
</script>
|
|
22
27
|
|
|
23
28
|
<script setup lang="ts">
|
|
@@ -34,7 +39,7 @@ const props = withDefaults(defineProps<ChipProps>(), {
|
|
|
34
39
|
const slots = defineSlots<ChipSlots>()
|
|
35
40
|
|
|
36
41
|
const { size, orientation } = useButtonGroup(props)
|
|
37
|
-
const {
|
|
42
|
+
const { isLeading, leadingIconName, isTrailing, trailingIconName } = useComponentIcons(props)
|
|
38
43
|
|
|
39
44
|
const { theme, createStyler } = useTheme()
|
|
40
45
|
const style = computed(() => {
|
|
@@ -49,16 +54,16 @@ const style = computed(() => {
|
|
|
49
54
|
|
|
50
55
|
<template>
|
|
51
56
|
<Primitive :as="props.as" :class="style.base({ class: [props.class, props.ui?.base] })">
|
|
52
|
-
<slot name="
|
|
53
|
-
<
|
|
57
|
+
<slot name="leading">
|
|
58
|
+
<span v-if="isLeading && leadingIconName" :class="style.leadingIcon({ class: [leadingIconName, props.ui?.leadingIcon] })"></span>
|
|
54
59
|
</slot>
|
|
55
60
|
|
|
56
61
|
<span v-if="props.label || slots.default" :class="style.label({ class: props.ui?.label })">
|
|
57
62
|
<slot>{{ props.label }}</slot>
|
|
58
63
|
</span>
|
|
59
64
|
|
|
60
|
-
<slot name="
|
|
61
|
-
<
|
|
65
|
+
<slot name="trailing">
|
|
66
|
+
<span v-if="isTrailing && trailingIconName" :class="style.trailingIcon({ class: [trailingIconName, props.ui?.trailingIcon] })"></span>
|
|
62
67
|
</slot>
|
|
63
68
|
</Primitive>
|
|
64
69
|
</template>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { CollapsibleRootEmits, CollapsibleRootProps } from 'reka-ui'
|
|
3
|
+
import type { collapsible } from '../theme'
|
|
4
|
+
import type { ComponentAttrs } from '../types'
|
|
5
|
+
|
|
6
|
+
export interface CollapsibleEmits extends CollapsibleRootEmits {}
|
|
7
|
+
|
|
8
|
+
export interface CollapsibleSlots {
|
|
9
|
+
default?: (props: { open: boolean }) => any
|
|
10
|
+
content?: (props?: {}) => any
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface CollapsibleProps extends ComponentAttrs<typeof collapsible>, Pick<CollapsibleRootProps, 'as' | 'defaultOpen' | 'open' | 'disabled' | 'unmountOnHide'> {
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
import { reactivePick } from '@vueuse/core'
|
|
19
|
+
import { CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, useForwardPropsEmits } from 'reka-ui'
|
|
20
|
+
import { computed } from 'vue'
|
|
21
|
+
import { useTheme } from '../composables/useTheme'
|
|
22
|
+
|
|
23
|
+
const props = withDefaults(defineProps<CollapsibleProps>(), {
|
|
24
|
+
unmountOnHide: true,
|
|
25
|
+
})
|
|
26
|
+
const emit = defineEmits<CollapsibleEmits>()
|
|
27
|
+
const slots = defineSlots<CollapsibleSlots>()
|
|
28
|
+
|
|
29
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultOpen', 'open', 'disabled', 'unmountOnHide'), emit)
|
|
30
|
+
|
|
31
|
+
const { theme, createStyler } = useTheme()
|
|
32
|
+
const style = computed(() => {
|
|
33
|
+
const styler = createStyler(theme.value.collapsible)
|
|
34
|
+
return styler(props)
|
|
35
|
+
})
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<CollapsibleRoot
|
|
40
|
+
v-slot="{ open }"
|
|
41
|
+
v-bind="rootProps"
|
|
42
|
+
:class="style.root({ class: [props.class, props.ui?.root] })"
|
|
43
|
+
>
|
|
44
|
+
<CollapsibleTrigger v-if="slots.default" as-child>
|
|
45
|
+
<slot :open="open"></slot>
|
|
46
|
+
</CollapsibleTrigger>
|
|
47
|
+
|
|
48
|
+
<CollapsibleContent :class="style.content({ class: props.ui?.content })">
|
|
49
|
+
<slot name="content"></slot>
|
|
50
|
+
</CollapsibleContent>
|
|
51
|
+
</CollapsibleRoot>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<style>
|
|
55
|
+
@keyframes collapsible-up{0%{height:var(--reka-collapsible-content-height)}to{height:0}}@keyframes collapsible-down{0%{height:0}to{height:var(--reka-collapsible-content-height)}}
|
|
56
|
+
</style>
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { DialogContentProps
|
|
2
|
+
import type { DialogContentProps } from 'reka-ui'
|
|
3
3
|
import type { DrawerRootEmits, DrawerRootProps } from 'vaul-vue'
|
|
4
4
|
import type { drawer } from '../theme'
|
|
5
5
|
import type { ComponentAttrs } from '../types'
|
|
6
6
|
|
|
7
|
+
export interface DrawerEmits extends DrawerRootEmits {}
|
|
8
|
+
|
|
9
|
+
export interface DrawerSlots {
|
|
10
|
+
default?: (props?: {}) => any
|
|
11
|
+
handle?: (props?: {}) => any
|
|
12
|
+
content?: (props?: {}) => any
|
|
13
|
+
header?: (props?: {}) => any
|
|
14
|
+
title?: (props?: {}) => any
|
|
15
|
+
description?: (props?: {}) => any
|
|
16
|
+
body?: (props?: {}) => any
|
|
17
|
+
footer?: (props?: {}) => any
|
|
18
|
+
}
|
|
19
|
+
|
|
7
20
|
export interface DrawerProps extends ComponentAttrs<typeof drawer>, Pick<DrawerRootProps, 'activeSnapPoint' | 'closeThreshold' | 'defaultOpen' | 'direction' | 'fadeFromIndex' | 'fixed' | 'modal' | 'nested' | 'direction' | 'open' | 'scrollLockTimeout' | 'shouldScaleBackground' | 'snapPoints'> {
|
|
8
|
-
as?: PrimitiveProps['as']
|
|
9
21
|
title?: string
|
|
10
22
|
description?: string
|
|
11
23
|
/** The content of the drawer. */
|
|
@@ -15,8 +27,10 @@ export interface DrawerProps extends ComponentAttrs<typeof drawer>, Pick<DrawerR
|
|
|
15
27
|
* @default true
|
|
16
28
|
*/
|
|
17
29
|
overlay?: boolean
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Whether to inset the drawer from the edges.
|
|
32
|
+
*/
|
|
33
|
+
inset?: boolean
|
|
20
34
|
/**
|
|
21
35
|
* Render a handle on the drawer.
|
|
22
36
|
* @default true
|
|
@@ -33,19 +47,6 @@ export interface DrawerProps extends ComponentAttrs<typeof drawer>, Pick<DrawerR
|
|
|
33
47
|
*/
|
|
34
48
|
dismissible?: boolean
|
|
35
49
|
}
|
|
36
|
-
|
|
37
|
-
export interface DrawerEmits extends DrawerRootEmits {}
|
|
38
|
-
|
|
39
|
-
export interface DrawerSlots {
|
|
40
|
-
default?: (props?: {}) => any
|
|
41
|
-
handle?: (props?: {}) => any
|
|
42
|
-
content?: (props?: {}) => any
|
|
43
|
-
header?: (props?: {}) => any
|
|
44
|
-
title?: (props?: {}) => any
|
|
45
|
-
description?: (props?: {}) => any
|
|
46
|
-
body?: (props?: {}) => any
|
|
47
|
-
footer?: (props?: {}) => any
|
|
48
|
-
}
|
|
49
50
|
</script>
|
|
50
51
|
|
|
51
52
|
<script setup lang="ts">
|