@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
|
@@ -6,12 +6,24 @@ import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
|
6
6
|
import type { input } from '../theme'
|
|
7
7
|
import type { ComponentAttrs } from '../types'
|
|
8
8
|
|
|
9
|
+
export interface InputEmits {
|
|
10
|
+
(e: 'update:modelValue', payload: string | number): void
|
|
11
|
+
(e: 'blur', event: FocusEvent): void
|
|
12
|
+
(e: 'change', event: Event): void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface InputSlots {
|
|
16
|
+
leading?: (props?: {}) => any
|
|
17
|
+
default?: (props?: {}) => any
|
|
18
|
+
trailing?: (props?: {}) => any
|
|
19
|
+
}
|
|
20
|
+
|
|
9
21
|
type InputVariants = VariantProps<typeof input>
|
|
10
22
|
|
|
11
23
|
export interface InputProps extends ComponentAttrs<typeof input>, UseComponentIconsProps {
|
|
12
24
|
/**
|
|
13
25
|
* The element or component this component should render as.
|
|
14
|
-
* @
|
|
26
|
+
* @default "div"
|
|
15
27
|
*/
|
|
16
28
|
as?: PrimitiveProps['as']
|
|
17
29
|
id?: string
|
|
@@ -29,18 +41,6 @@ export interface InputProps extends ComponentAttrs<typeof input>, UseComponentIc
|
|
|
29
41
|
autofocusDelay?: number
|
|
30
42
|
disabled?: boolean
|
|
31
43
|
}
|
|
32
|
-
|
|
33
|
-
export interface InputEmits {
|
|
34
|
-
(e: 'update:modelValue', payload: string | number): void
|
|
35
|
-
(e: 'blur', event: FocusEvent): void
|
|
36
|
-
(e: 'change', event: Event): void
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface InputSlots {
|
|
40
|
-
prefix?: (props?: {}) => any
|
|
41
|
-
default?: (props?: {}) => any
|
|
42
|
-
suffix?: (props?: {}) => any
|
|
43
|
-
}
|
|
44
44
|
</script>
|
|
45
45
|
|
|
46
46
|
<script setup lang="ts">
|
|
@@ -69,7 +69,7 @@ const [modelValue, modelModifiers] = defineModel<string | number>()
|
|
|
69
69
|
const inputRef = ref<HTMLInputElement | null>(null)
|
|
70
70
|
|
|
71
71
|
const { size, orientation } = useButtonGroup(props)
|
|
72
|
-
const {
|
|
72
|
+
const { isLeading, leadingIconName, isTrailing, trailingIconName } = useComponentIcons(props)
|
|
73
73
|
|
|
74
74
|
const { theme, createStyler } = useTheme()
|
|
75
75
|
const style = computed(() => {
|
|
@@ -80,8 +80,8 @@ const style = computed(() => {
|
|
|
80
80
|
type: props.type,
|
|
81
81
|
size: size.value,
|
|
82
82
|
groupOrientation: orientation.value,
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
leading: isLeading.value || !!slots.leading,
|
|
84
|
+
trailing: isTrailing.value || !!slots.trailing,
|
|
85
85
|
})
|
|
86
86
|
})
|
|
87
87
|
|
|
@@ -138,12 +138,12 @@ onMounted(() => {
|
|
|
138
138
|
:class="style.base({ class: [props.class, props.ui?.base] })"
|
|
139
139
|
:aria-disabled="props.disabled ? true : undefined"
|
|
140
140
|
>
|
|
141
|
-
<span v-if="
|
|
142
|
-
<slot name="
|
|
143
|
-
<
|
|
144
|
-
v-if="
|
|
145
|
-
:class="style.
|
|
146
|
-
></
|
|
141
|
+
<span v-if="isLeading || slots.leading" :class="style.leading({ class: props.ui?.leading })">
|
|
142
|
+
<slot name="leading">
|
|
143
|
+
<span
|
|
144
|
+
v-if="isLeading && leadingIconName"
|
|
145
|
+
:class="style.leadingIcon({ class: [leadingIconName, props.ui?.leadingIcon] })"
|
|
146
|
+
></span>
|
|
147
147
|
</slot>
|
|
148
148
|
</span>
|
|
149
149
|
|
|
@@ -166,12 +166,12 @@ onMounted(() => {
|
|
|
166
166
|
|
|
167
167
|
<slot></slot>
|
|
168
168
|
|
|
169
|
-
<span v-if="
|
|
170
|
-
<slot name="
|
|
171
|
-
<
|
|
172
|
-
v-if="
|
|
173
|
-
:class="style.
|
|
174
|
-
></
|
|
169
|
+
<span v-if="isTrailing || slots.trailing" :class="style.trailing({ class: props.ui?.trailing })">
|
|
170
|
+
<slot name="trailing">
|
|
171
|
+
<span
|
|
172
|
+
v-if="isTrailing && trailingIconName"
|
|
173
|
+
:class="style.trailingIcon({ class: [trailingIconName, props.ui?.trailingIcon] })"
|
|
174
|
+
></span>
|
|
175
175
|
</slot>
|
|
176
176
|
</span>
|
|
177
177
|
</Primitive>
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
+
import type { NumberFieldRootProps } from 'reka-ui'
|
|
4
|
+
import type { inputNumber } from '../theme'
|
|
5
|
+
import type { ButtonProps, ComponentAttrs } from '../types'
|
|
6
|
+
|
|
7
|
+
export interface InputNumberEmits {
|
|
8
|
+
(e: 'update:modelValue', payload: number): void
|
|
9
|
+
(e: 'blur', event: FocusEvent): void
|
|
10
|
+
(e: 'change', payload: Event): void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface InputNumberSlots {
|
|
14
|
+
increment?: (props?: {}) => any
|
|
15
|
+
decrement?: (props?: {}) => any
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type InputNumberVariants = VariantProps<typeof inputNumber>
|
|
19
|
+
|
|
20
|
+
export interface InputNumberProps extends ComponentAttrs<typeof inputNumber>, Pick<NumberFieldRootProps, 'as' | 'modelValue' | 'defaultValue' | 'min' | 'max' | 'step' | 'disabled' | 'required' | 'id' | 'name' | 'formatOptions'> {
|
|
21
|
+
/** The placeholder text when the input is empty. */
|
|
22
|
+
placeholder?: string
|
|
23
|
+
variant?: InputNumberVariants['variant']
|
|
24
|
+
size?: InputNumberVariants['size']
|
|
25
|
+
underline?: boolean
|
|
26
|
+
/** Highlight the ring color like a focus state. */
|
|
27
|
+
highlight?: boolean
|
|
28
|
+
/**
|
|
29
|
+
* The orientation of the input menu.
|
|
30
|
+
* @default "horizontal"
|
|
31
|
+
*/
|
|
32
|
+
orientation?: InputNumberVariants['orientation']
|
|
33
|
+
/**
|
|
34
|
+
* Configure the increment button. The `color` and `size` are inherited.
|
|
35
|
+
* @default { variant: 'link' }
|
|
36
|
+
*/
|
|
37
|
+
increment?: ButtonProps
|
|
38
|
+
/**
|
|
39
|
+
* The icon displayed to increment the value.
|
|
40
|
+
* @default app.icons.plus
|
|
41
|
+
*/
|
|
42
|
+
incrementIcon?: string
|
|
43
|
+
/**
|
|
44
|
+
* Configure the decrement button. The `color` and `size` are inherited.
|
|
45
|
+
* @default { variant: 'link' }
|
|
46
|
+
*/
|
|
47
|
+
decrement?: ButtonProps
|
|
48
|
+
/**
|
|
49
|
+
* The icon displayed to decrement the value.
|
|
50
|
+
* @default app.icons.minus
|
|
51
|
+
*/
|
|
52
|
+
decrementIcon?: string
|
|
53
|
+
autofocus?: boolean
|
|
54
|
+
autofocusDelay?: number
|
|
55
|
+
/**
|
|
56
|
+
* The locale to use for formatting and parsing numbers.
|
|
57
|
+
*/
|
|
58
|
+
locale?: string
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<script setup lang="ts">
|
|
63
|
+
import { reactivePick } from '@vueuse/core'
|
|
64
|
+
import { NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, NumberFieldRoot, useForwardPropsEmits } from 'reka-ui'
|
|
65
|
+
import { computed, onMounted, ref } from 'vue'
|
|
66
|
+
import { useLocale } from '../composables/useLocale'
|
|
67
|
+
import { useTheme } from '../composables/useTheme'
|
|
68
|
+
import Button from './Button.vue'
|
|
69
|
+
|
|
70
|
+
defineOptions({
|
|
71
|
+
inheritAttrs: false,
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const props = withDefaults(defineProps<InputNumberProps>(), {
|
|
75
|
+
orientation: 'horizontal',
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const emit = defineEmits<InputNumberEmits>()
|
|
79
|
+
defineSlots<InputNumberSlots>()
|
|
80
|
+
|
|
81
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'min', 'max', 'step', 'formatOptions'), emit)
|
|
82
|
+
|
|
83
|
+
const inputRef = ref<InstanceType<typeof NumberFieldInput> | null>(null)
|
|
84
|
+
|
|
85
|
+
const { t } = useLocale()
|
|
86
|
+
const { theme, createStyler } = useTheme()
|
|
87
|
+
const incrementIcon = computed(() => props.incrementIcon || (props.orientation === 'horizontal' ? theme.value.app.icons.plus : theme.value.app.icons.chevronUp))
|
|
88
|
+
const decrementIcon = computed(() => props.decrementIcon || (props.orientation === 'horizontal' ? theme.value.app.icons.minus : theme.value.app.icons.chevronDown))
|
|
89
|
+
|
|
90
|
+
const style = computed(() => {
|
|
91
|
+
const styler = createStyler(theme.value.inputNumber)
|
|
92
|
+
return styler(props)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
onMounted(() => {
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
autoFocus()
|
|
98
|
+
}, props.autofocusDelay)
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
defineExpose({
|
|
102
|
+
inputRef,
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
function autoFocus() {
|
|
106
|
+
if (props.autofocus)
|
|
107
|
+
inputRef.value?.$el?.focus()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function onUpdate(value: number) {
|
|
111
|
+
// @ts-expect-error - 'target' does not exist in type 'EventInit'
|
|
112
|
+
const event = new Event('change', { target: { value } })
|
|
113
|
+
emit('change', event)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function onBlur(event: FocusEvent) {
|
|
117
|
+
emit('blur', event)
|
|
118
|
+
}
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<template>
|
|
122
|
+
<NumberFieldRoot
|
|
123
|
+
v-bind="rootProps"
|
|
124
|
+
:id="props.id"
|
|
125
|
+
:name="props.name"
|
|
126
|
+
:disabled="props.disabled"
|
|
127
|
+
:locale="props.locale"
|
|
128
|
+
:class="style.base({ class: [props.class, props.ui?.base] })"
|
|
129
|
+
:aria-disabled="props.disabled ? true : undefined"
|
|
130
|
+
@update:model-value="onUpdate"
|
|
131
|
+
>
|
|
132
|
+
<NumberFieldInput
|
|
133
|
+
v-bind="$attrs"
|
|
134
|
+
ref="inputRef"
|
|
135
|
+
:placeholder="props.placeholder"
|
|
136
|
+
:required="props.required"
|
|
137
|
+
:class="style.input({ class: props.ui?.input })"
|
|
138
|
+
@blur="onBlur"
|
|
139
|
+
/>
|
|
140
|
+
|
|
141
|
+
<div :class="style.increment({ class: props.ui?.increment })">
|
|
142
|
+
<NumberFieldIncrement as-child :disabled="props.disabled">
|
|
143
|
+
<slot name="increment">
|
|
144
|
+
<Button
|
|
145
|
+
:icon="incrementIcon"
|
|
146
|
+
:size="props.size"
|
|
147
|
+
variant="link"
|
|
148
|
+
:aria-label="t('inputNumber.increment')"
|
|
149
|
+
v-bind="typeof props.increment === 'object' ? props.increment : undefined"
|
|
150
|
+
/>
|
|
151
|
+
</slot>
|
|
152
|
+
</NumberFieldIncrement>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<div :class="style.decrement({ class: props.ui?.decrement })">
|
|
156
|
+
<NumberFieldDecrement as-child :disabled="props.disabled">
|
|
157
|
+
<slot name="decrement">
|
|
158
|
+
<Button
|
|
159
|
+
:icon="decrementIcon"
|
|
160
|
+
:size="props.size"
|
|
161
|
+
variant="link"
|
|
162
|
+
:aria-label="t('inputNumber.decrement')"
|
|
163
|
+
v-bind="typeof props.decrement === 'object' ? props.decrement : undefined"
|
|
164
|
+
/>
|
|
165
|
+
</slot>
|
|
166
|
+
</NumberFieldDecrement>
|
|
167
|
+
</div>
|
|
168
|
+
</NumberFieldRoot>
|
|
169
|
+
</template>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
+
import type { PrimitiveProps } from 'reka-ui'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
import type { KbdKey } from '../composables/useKbd'
|
|
6
|
+
import type { kbd } from '../theme'
|
|
7
|
+
import type { ComponentAttrs } from '../types'
|
|
8
|
+
|
|
9
|
+
export interface KbdSlots {
|
|
10
|
+
default?: (props?: {}) => any
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type KbdVariants = VariantProps<typeof kbd>
|
|
14
|
+
|
|
15
|
+
export interface KbdProps extends Omit<ComponentAttrs<typeof kbd>, 'ui'> {
|
|
16
|
+
/**
|
|
17
|
+
* The element or component this component should render as.
|
|
18
|
+
* @default "kbd"
|
|
19
|
+
*/
|
|
20
|
+
as?: PrimitiveProps['as']
|
|
21
|
+
variant?: KbdVariants['variant']
|
|
22
|
+
size?: KbdVariants['size']
|
|
23
|
+
value?: KbdKey | (string & {})
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
import { Primitive } from 'reka-ui'
|
|
29
|
+
import { useKbd } from '../composables/useKbd'
|
|
30
|
+
import { useTheme } from '../composables/useTheme'
|
|
31
|
+
|
|
32
|
+
const props = withDefaults(defineProps<KbdProps>(), {
|
|
33
|
+
as: 'kbd',
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
defineSlots<KbdSlots>()
|
|
37
|
+
|
|
38
|
+
const { getKbdKey } = useKbd()
|
|
39
|
+
|
|
40
|
+
const { theme, createStyler } = useTheme()
|
|
41
|
+
const style = computed(() => {
|
|
42
|
+
const styler = createStyler(theme.value.kbd)
|
|
43
|
+
return styler(props)
|
|
44
|
+
})
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<template>
|
|
48
|
+
<Primitive :as="props.as" :class="style">
|
|
49
|
+
<slot>{{ getKbdKey(props.value) }}</slot>
|
|
50
|
+
</Primitive>
|
|
51
|
+
</template>
|