@byyuurin/ui 0.0.9 → 0.0.11
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 +2 -5
- package/dist/module.json +3 -3
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/runtime/app/injections.d.ts +9323 -3
- package/dist/runtime/app/injections.js +35 -0
- package/dist/runtime/components/Accordion.vue +36 -69
- package/dist/runtime/components/Accordion.vue.d.ts +52 -0
- package/dist/runtime/components/Alert.vue +37 -75
- package/dist/runtime/components/Alert.vue.d.ts +59 -0
- package/dist/runtime/components/App.vue +25 -40
- package/dist/runtime/components/App.vue.d.ts +24 -0
- package/dist/runtime/components/Avatar.vue +31 -51
- package/dist/runtime/components/Avatar.vue.d.ts +25 -0
- package/dist/runtime/components/AvatarGroup.vue +38 -69
- package/dist/runtime/components/AvatarGroup.vue.d.ts +27 -0
- package/dist/runtime/components/Badge.vue +25 -51
- package/dist/runtime/components/Badge.vue.d.ts +44 -0
- package/dist/runtime/components/Breadcrumb.vue +35 -77
- package/dist/runtime/components/Breadcrumb.vue.d.ts +52 -0
- package/dist/runtime/components/Button.vue +62 -51
- package/dist/runtime/components/Button.vue.d.ts +29 -0
- package/dist/runtime/components/ButtonGroup.vue +17 -37
- package/dist/runtime/components/ButtonGroup.vue.d.ts +26 -0
- package/dist/runtime/components/Calendar.vue +75 -101
- package/dist/runtime/components/Calendar.vue.d.ts +75 -0
- package/dist/runtime/components/Card.vue +25 -42
- package/dist/runtime/components/Card.vue.d.ts +30 -0
- package/dist/runtime/components/Carousel.vue +118 -223
- package/dist/runtime/components/Carousel.vue.d.ts +104 -0
- package/dist/runtime/components/Checkbox.vue +49 -71
- package/dist/runtime/components/Checkbox.vue.d.ts +56 -0
- package/dist/runtime/components/Chip.vue +31 -48
- package/dist/runtime/components/Chip.vue.d.ts +30 -0
- package/dist/runtime/components/Collapsible.vue +22 -30
- package/dist/runtime/components/Collapsible.vue.d.ts +26 -0
- package/dist/runtime/components/Drawer.vue +52 -102
- package/dist/runtime/components/Drawer.vue.d.ts +80 -0
- package/dist/runtime/components/DropdownMenu.vue +65 -0
- package/dist/runtime/components/DropdownMenu.vue.d.ts +99 -0
- package/dist/runtime/components/DropdownMenuContent.vue +192 -0
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +39 -0
- package/dist/runtime/components/Form.vue +197 -0
- package/dist/runtime/components/Form.vue.d.ts +78 -0
- package/dist/runtime/components/FormItem.vue +90 -0
- package/dist/runtime/components/FormItem.vue.d.ts +60 -0
- package/dist/runtime/components/Input.vue +93 -115
- package/dist/runtime/components/Input.vue.d.ts +64 -0
- package/dist/runtime/components/InputNumber.vue +81 -116
- package/dist/runtime/components/InputNumber.vue.d.ts +245 -0
- package/dist/runtime/components/Kbd.vue +18 -39
- package/dist/runtime/components/Kbd.vue.d.ts +28 -0
- package/dist/runtime/components/Link.vue +170 -244
- package/dist/runtime/components/Link.vue.d.ts +95 -0
- package/dist/runtime/components/LinkBase.vue +36 -54
- package/dist/runtime/components/LinkBase.vue.d.ts +28 -0
- package/dist/runtime/components/Modal.vue +50 -85
- package/dist/runtime/components/Modal.vue.d.ts +66 -0
- package/dist/runtime/components/OverlayProvider.vue +10 -14
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Pagination.vue +55 -121
- package/dist/runtime/components/Pagination.vue.d.ts +93 -0
- package/dist/runtime/components/PinInput.vue +57 -57
- package/dist/runtime/components/PinInput.vue.d.ts +35 -0
- package/dist/runtime/components/Popover.vue +39 -68
- package/dist/runtime/components/Popover.vue.d.ts +45 -0
- package/dist/runtime/components/Progress.vue +68 -120
- package/dist/runtime/components/Progress.vue.d.ts +54 -0
- package/dist/runtime/components/RadioGroup.vue +75 -129
- package/dist/runtime/components/RadioGroup.vue.d.ts +74 -0
- package/dist/runtime/components/ScrollArea.vue +31 -31
- package/dist/runtime/components/ScrollArea.vue.d.ts +17 -0
- package/dist/runtime/components/Select.vue +119 -199
- package/dist/runtime/components/Select.vue.d.ts +119 -0
- package/dist/runtime/components/Separator.vue +26 -44
- package/dist/runtime/components/Separator.vue.d.ts +27 -0
- package/dist/runtime/components/Skeleton.vue +12 -21
- package/dist/runtime/components/Skeleton.vue.d.ts +19 -0
- package/dist/runtime/components/Slider.vue +54 -71
- package/dist/runtime/components/Slider.vue.d.ts +36 -0
- package/dist/runtime/components/Switch.vue +54 -68
- package/dist/runtime/components/Switch.vue.d.ts +49 -0
- package/dist/runtime/components/Table.vue +113 -186
- package/dist/runtime/components/Table.vue.d.ts +148 -0
- package/dist/runtime/components/Tabs.vue +35 -79
- package/dist/runtime/components/Tabs.vue.d.ts +65 -0
- package/dist/runtime/components/Textarea.vue +82 -123
- package/dist/runtime/components/Textarea.vue.d.ts +60 -0
- package/dist/runtime/components/Toast.vue +51 -76
- package/dist/runtime/components/Toast.vue.d.ts +131 -0
- package/dist/runtime/components/ToastProvider.vue +65 -101
- package/dist/runtime/components/ToastProvider.vue.d.ts +38 -0
- package/dist/runtime/components/Tooltip.vue +36 -47
- package/dist/runtime/components/Tooltip.vue.d.ts +31 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useFormItem.d.ts +27 -0
- package/dist/runtime/composables/useFormItem.js +64 -0
- package/dist/runtime/composables/useKbd.d.ts +1 -1
- package/dist/runtime/composables/useLocale.d.ts +3 -3
- package/dist/runtime/composables/useTheme.d.ts +1 -1
- package/dist/runtime/composables/useTheme.js +2 -1
- package/dist/runtime/composables/useToast.d.ts +1 -1
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.js +3 -0
- package/dist/runtime/locale/en.d.ts +1 -1
- package/dist/runtime/locale/zh-tw.d.ts +1 -1
- package/dist/runtime/theme/accordion.d.ts +45 -51
- package/dist/runtime/theme/accordion.js +1 -1
- package/dist/runtime/theme/alert.d.ts +115 -121
- package/dist/runtime/theme/alert.js +1 -1
- package/dist/runtime/theme/app.d.ts +1 -0
- package/dist/runtime/theme/app.js +2 -1
- package/dist/runtime/theme/avatar-group.d.ts +42 -48
- package/dist/runtime/theme/avatar-group.js +1 -1
- package/dist/runtime/theme/avatar.d.ts +46 -52
- package/dist/runtime/theme/avatar.js +1 -1
- package/dist/runtime/theme/badge.d.ts +63 -93
- package/dist/runtime/theme/badge.js +1 -1
- package/dist/runtime/theme/breadcrumb.d.ts +52 -58
- package/dist/runtime/theme/breadcrumb.js +1 -1
- package/dist/runtime/theme/button-group.d.ts +36 -42
- package/dist/runtime/theme/button.d.ts +165 -117
- package/dist/runtime/theme/button.js +1 -1
- package/dist/runtime/theme/calendar.d.ts +52 -50
- package/dist/runtime/theme/calendar.js +20 -3
- package/dist/runtime/theme/card.d.ts +52 -58
- package/dist/runtime/theme/card.js +1 -1
- package/dist/runtime/theme/carousel.d.ts +98 -104
- package/dist/runtime/theme/carousel.js +1 -1
- package/dist/runtime/theme/checkbox.d.ts +77 -83
- package/dist/runtime/theme/checkbox.js +1 -1
- package/dist/runtime/theme/chip.d.ts +50 -89
- package/dist/runtime/theme/chip.js +1 -1
- package/dist/runtime/theme/collapsible.d.ts +29 -35
- package/dist/runtime/theme/collapsible.js +1 -1
- package/dist/runtime/theme/drawer.d.ts +131 -102
- package/dist/runtime/theme/drawer.js +1 -1
- package/dist/runtime/theme/dropdown-menu.d.ts +65 -0
- package/dist/runtime/theme/dropdown-menu.js +83 -0
- package/dist/runtime/theme/form-item.d.ts +70 -0
- package/dist/runtime/theme/form-item.js +34 -0
- package/dist/runtime/theme/form.d.ts +2 -0
- package/dist/runtime/theme/form.js +7 -0
- package/dist/runtime/theme/index.d.ts +3 -0
- package/dist/runtime/theme/index.js +3 -0
- package/dist/runtime/theme/input-number.d.ts +100 -126
- package/dist/runtime/theme/input-number.js +1 -1
- package/dist/runtime/theme/input.d.ts +153 -131
- package/dist/runtime/theme/input.js +3 -3
- package/dist/runtime/theme/kbd.d.ts +30 -36
- package/dist/runtime/theme/link.d.ts +37 -43
- package/dist/runtime/theme/modal.d.ts +35 -69
- package/dist/runtime/theme/modal.js +1 -1
- package/dist/runtime/theme/pagination.d.ts +71 -77
- package/dist/runtime/theme/pagination.js +1 -1
- package/dist/runtime/theme/pinInput.d.ts +82 -88
- package/dist/runtime/theme/pinInput.js +2 -2
- package/dist/runtime/theme/popover.d.ts +29 -35
- package/dist/runtime/theme/popover.js +1 -1
- package/dist/runtime/theme/progress.d.ts +167 -109
- package/dist/runtime/theme/progress.js +1 -1
- package/dist/runtime/theme/radio-group.d.ts +99 -105
- package/dist/runtime/theme/radio-group.js +1 -1
- package/dist/runtime/theme/scroll-area.d.ts +62 -68
- package/dist/runtime/theme/scroll-area.js +1 -1
- package/dist/runtime/theme/select.d.ts +168 -158
- package/dist/runtime/theme/select.js +3 -2
- package/dist/runtime/theme/separator.d.ts +64 -85
- package/dist/runtime/theme/separator.js +1 -1
- package/dist/runtime/theme/skeleton.d.ts +1 -7
- package/dist/runtime/theme/slider.d.ts +62 -68
- package/dist/runtime/theme/slider.js +1 -1
- package/dist/runtime/theme/switch.d.ts +111 -117
- package/dist/runtime/theme/switch.js +1 -1
- package/dist/runtime/theme/table.d.ts +75 -78
- package/dist/runtime/theme/table.js +3 -2
- package/dist/runtime/theme/tabs.d.ts +116 -139
- package/dist/runtime/theme/tabs.js +1 -1
- package/dist/runtime/theme/textarea.d.ts +78 -90
- package/dist/runtime/theme/textarea.js +2 -2
- package/dist/runtime/theme/toast-provider.d.ts +110 -131
- package/dist/runtime/theme/toast-provider.js +1 -1
- package/dist/runtime/theme/toast.d.ts +74 -80
- package/dist/runtime/theme/toast.js +1 -1
- package/dist/runtime/theme/tooltip.d.ts +35 -41
- package/dist/runtime/theme/tooltip.js +1 -1
- package/dist/runtime/types/components.d.ts +3 -0
- package/dist/runtime/types/form.d.ts +45 -0
- package/dist/runtime/types/form.js +0 -0
- package/dist/runtime/types/index.d.ts +5 -2
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/utils.d.ts +37 -16
- package/dist/runtime/utils/extend-theme.js +15 -4
- package/dist/runtime/utils/form.d.ts +5 -0
- package/dist/runtime/utils/form.js +24 -0
- package/dist/runtime/utils/index.d.ts +2 -0
- package/dist/runtime/utils/index.js +4 -0
- package/dist/runtime/utils/link.d.ts +4 -28
- package/dist/runtime/utils/link.js +10 -3
- package/dist/runtime/utils/styler.d.ts +2 -2
- package/dist/runtime/utils/styler.js +2 -2
- package/dist/shared/ui.D1BTWZFB.mjs +5 -0
- package/dist/shared/ui.D1BTWZFB.mjs.map +1 -0
- package/dist/types.d.mts +1 -1
- package/dist/unocss.mjs +7 -6
- package/dist/unocss.mjs.map +1 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/unplugin.mjs.map +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +78 -74
- package/dist/module.cjs +0 -5
- package/dist/shared/ui.1a1f119c.mjs +0 -5
- package/dist/shared/ui.1a1f119c.mjs.map +0 -1
- package/dist/types.d.ts +0 -1
|
@@ -1,163 +1,128 @@
|
|
|
1
|
-
<script
|
|
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'
|
|
1
|
+
<script>
|
|
6
2
|
|
|
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
3
|
</script>
|
|
61
4
|
|
|
62
|
-
<script setup
|
|
63
|
-
import { reactivePick } from
|
|
64
|
-
import { NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, NumberFieldRoot, useForwardPropsEmits } from
|
|
65
|
-
import { computed, onMounted, ref } from
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import
|
|
69
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { reactivePick } from "@vueuse/core";
|
|
7
|
+
import { NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, NumberFieldRoot, useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { computed, onMounted, ref } from "vue";
|
|
9
|
+
import { useFormItem } from "../composables/useFormItem";
|
|
10
|
+
import { useLocale } from "../composables/useLocale";
|
|
11
|
+
import { useTheme } from "../composables/useTheme";
|
|
12
|
+
import Button from "./Button.vue";
|
|
70
13
|
defineOptions({
|
|
71
|
-
inheritAttrs: false
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
14
|
+
inheritAttrs: false
|
|
15
|
+
});
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
placeholder: { type: String, required: false },
|
|
18
|
+
variant: { type: null, required: false },
|
|
19
|
+
size: { type: null, required: false },
|
|
20
|
+
underline: { type: Boolean, required: false },
|
|
21
|
+
highlight: { type: Boolean, required: false },
|
|
22
|
+
orientation: { type: null, required: false, default: "horizontal" },
|
|
23
|
+
increment: { type: Object, required: false },
|
|
24
|
+
incrementIcon: { type: String, required: false },
|
|
25
|
+
decrement: { type: Object, required: false },
|
|
26
|
+
decrementIcon: { type: String, required: false },
|
|
27
|
+
autofocus: { type: Boolean, required: false },
|
|
28
|
+
autofocusDelay: { type: Number, required: false },
|
|
29
|
+
locale: { type: String, required: false },
|
|
30
|
+
class: { type: null, required: false },
|
|
31
|
+
ui: { type: null, required: false },
|
|
32
|
+
as: { type: null, required: false },
|
|
33
|
+
modelValue: { type: [Number, null], required: false },
|
|
34
|
+
defaultValue: { type: Number, required: false },
|
|
35
|
+
min: { type: Number, required: false },
|
|
36
|
+
max: { type: Number, required: false },
|
|
37
|
+
step: { type: Number, required: false },
|
|
38
|
+
disabled: { type: Boolean, required: false },
|
|
39
|
+
required: { type: Boolean, required: false },
|
|
40
|
+
id: { type: String, required: false },
|
|
41
|
+
name: { type: String, required: false },
|
|
42
|
+
formatOptions: { type: null, required: false }
|
|
43
|
+
});
|
|
44
|
+
const emit = defineEmits(["update:modelValue", "blur", "change"]);
|
|
45
|
+
defineSlots();
|
|
46
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "min", "max", "step", "formatOptions"), emit);
|
|
47
|
+
const inputRef = ref(null);
|
|
48
|
+
const { t, code: codeLocale } = useLocale();
|
|
49
|
+
const locale = computed(() => props.locale || codeLocale.value);
|
|
50
|
+
const { id, name, size, highlight, disabled, ariaAttrs, emitFormBlur, emitFormFocus, emitFormInput, emitFormChange } = useFormItem(props);
|
|
51
|
+
const { theme, generateStyle } = useTheme();
|
|
52
|
+
const incrementIcon = computed(() => props.incrementIcon || (props.orientation === "horizontal" ? theme.value.app.icons.plus : theme.value.app.icons.chevronUp));
|
|
53
|
+
const decrementIcon = computed(() => props.decrementIcon || (props.orientation === "horizontal" ? theme.value.app.icons.minus : theme.value.app.icons.chevronDown));
|
|
54
|
+
const style = computed(() => generateStyle("inputNumber", {
|
|
55
|
+
...props,
|
|
56
|
+
size: size.value,
|
|
57
|
+
highlight: highlight.value
|
|
58
|
+
}));
|
|
92
59
|
onMounted(() => {
|
|
93
60
|
setTimeout(() => {
|
|
94
|
-
autoFocus()
|
|
95
|
-
}, props.autofocusDelay)
|
|
96
|
-
})
|
|
97
|
-
|
|
61
|
+
autoFocus();
|
|
62
|
+
}, props.autofocusDelay);
|
|
63
|
+
});
|
|
98
64
|
defineExpose({
|
|
99
|
-
inputRef
|
|
100
|
-
})
|
|
101
|
-
|
|
65
|
+
inputRef
|
|
66
|
+
});
|
|
102
67
|
function autoFocus() {
|
|
103
68
|
if (props.autofocus)
|
|
104
|
-
inputRef.value?.$el?.focus()
|
|
69
|
+
inputRef.value?.$el?.focus();
|
|
105
70
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
71
|
+
function onUpdate(value) {
|
|
72
|
+
const event = new Event("change", { target: { value } });
|
|
73
|
+
emit("change", event);
|
|
74
|
+
emitFormChange();
|
|
75
|
+
emitFormInput();
|
|
111
76
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
77
|
+
function onBlur(event) {
|
|
78
|
+
emit("blur", event);
|
|
79
|
+
emitFormBlur();
|
|
115
80
|
}
|
|
116
81
|
</script>
|
|
117
82
|
|
|
118
83
|
<template>
|
|
119
84
|
<NumberFieldRoot
|
|
120
|
-
v-bind="rootProps"
|
|
121
|
-
:
|
|
122
|
-
:
|
|
123
|
-
:disabled="props.disabled"
|
|
124
|
-
:locale="props.locale"
|
|
85
|
+
v-bind="{ ...rootProps, id, name, disabled }"
|
|
86
|
+
:locale="locale"
|
|
87
|
+
:aria-disabled="disabled ? true : void 0"
|
|
125
88
|
:class="style.base({ class: [props.class, props.ui?.base] })"
|
|
126
|
-
:
|
|
89
|
+
:data-part="$attrs['data-part'] ?? 'base'"
|
|
127
90
|
@update:model-value="onUpdate"
|
|
128
91
|
>
|
|
129
92
|
<NumberFieldInput
|
|
130
|
-
v-bind="
|
|
93
|
+
v-bind="{ ...$attrs, ...ariaAttrs }"
|
|
131
94
|
ref="inputRef"
|
|
132
95
|
:placeholder="props.placeholder"
|
|
133
96
|
:required="props.required"
|
|
134
97
|
:class="style.input({ class: props.ui?.input })"
|
|
98
|
+
data-part="input"
|
|
135
99
|
@blur="onBlur"
|
|
100
|
+
@focus="emitFormFocus"
|
|
136
101
|
/>
|
|
137
102
|
|
|
138
|
-
<div :class="style.increment({ class: props.ui?.increment })">
|
|
139
|
-
<NumberFieldIncrement as-child :disabled="
|
|
103
|
+
<div :class="style.increment({ class: props.ui?.increment })" data-part="increment">
|
|
104
|
+
<NumberFieldIncrement as-child :disabled="disabled">
|
|
140
105
|
<slot name="increment">
|
|
141
106
|
<Button
|
|
142
107
|
:icon="incrementIcon"
|
|
143
108
|
:size="props.size"
|
|
144
109
|
variant="link"
|
|
145
110
|
:aria-label="t('inputNumber.increment')"
|
|
146
|
-
v-bind="typeof props.increment === 'object' ? props.increment :
|
|
111
|
+
v-bind="typeof props.increment === 'object' ? props.increment : void 0"
|
|
147
112
|
/>
|
|
148
113
|
</slot>
|
|
149
114
|
</NumberFieldIncrement>
|
|
150
115
|
</div>
|
|
151
116
|
|
|
152
|
-
<div :class="style.decrement({ class: props.ui?.decrement })">
|
|
153
|
-
<NumberFieldDecrement as-child :disabled="
|
|
117
|
+
<div :class="style.decrement({ class: props.ui?.decrement })" data-part="decrement">
|
|
118
|
+
<NumberFieldDecrement as-child :disabled="disabled">
|
|
154
119
|
<slot name="decrement">
|
|
155
120
|
<Button
|
|
156
121
|
:icon="decrementIcon"
|
|
157
122
|
:size="props.size"
|
|
158
123
|
variant="link"
|
|
159
124
|
:aria-label="t('inputNumber.decrement')"
|
|
160
|
-
v-bind="typeof props.decrement === 'object' ? props.decrement :
|
|
125
|
+
v-bind="typeof props.decrement === 'object' ? props.decrement : void 0"
|
|
161
126
|
/>
|
|
162
127
|
</slot>
|
|
163
128
|
</NumberFieldDecrement>
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { NumberFieldRootProps } from 'reka-ui';
|
|
3
|
+
import type { inputNumber } from '../theme/index.js';
|
|
4
|
+
import type { ButtonProps, ComponentAttrs } from '../types/index.js';
|
|
5
|
+
export interface InputNumberEmits {
|
|
6
|
+
'update:modelValue': [payload: number];
|
|
7
|
+
'blur': [event: FocusEvent];
|
|
8
|
+
'change': [payload: Event];
|
|
9
|
+
}
|
|
10
|
+
export interface InputNumberSlots {
|
|
11
|
+
increment?: (props?: {}) => any;
|
|
12
|
+
decrement?: (props?: {}) => any;
|
|
13
|
+
}
|
|
14
|
+
type InputNumberVariants = VariantProps<typeof inputNumber>;
|
|
15
|
+
export interface InputNumberProps extends ComponentAttrs<typeof inputNumber>, Pick<NumberFieldRootProps, 'as' | 'modelValue' | 'defaultValue' | 'min' | 'max' | 'step' | 'disabled' | 'required' | 'id' | 'name' | 'formatOptions'> {
|
|
16
|
+
/** The placeholder text when the input is empty. */
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
variant?: InputNumberVariants['variant'];
|
|
19
|
+
size?: InputNumberVariants['size'];
|
|
20
|
+
underline?: boolean;
|
|
21
|
+
/** Highlight the ring color like a focus state. */
|
|
22
|
+
highlight?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The orientation of the input menu.
|
|
25
|
+
* @default "horizontal"
|
|
26
|
+
*/
|
|
27
|
+
orientation?: InputNumberVariants['orientation'];
|
|
28
|
+
/**
|
|
29
|
+
* Configure the increment button. The `color` and `size` are inherited.
|
|
30
|
+
* @default { variant: 'link' }
|
|
31
|
+
*/
|
|
32
|
+
increment?: ButtonProps;
|
|
33
|
+
/**
|
|
34
|
+
* The icon displayed to increment the value.
|
|
35
|
+
* @default app.icons.plus
|
|
36
|
+
*/
|
|
37
|
+
incrementIcon?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Configure the decrement button. The `color` and `size` are inherited.
|
|
40
|
+
* @default { variant: 'link' }
|
|
41
|
+
*/
|
|
42
|
+
decrement?: ButtonProps;
|
|
43
|
+
/**
|
|
44
|
+
* The icon displayed to decrement the value.
|
|
45
|
+
* @default app.icons.minus
|
|
46
|
+
*/
|
|
47
|
+
decrementIcon?: string;
|
|
48
|
+
autofocus?: boolean;
|
|
49
|
+
autofocusDelay?: number;
|
|
50
|
+
/**
|
|
51
|
+
* The locale to use for formatting and parsing numbers.
|
|
52
|
+
*/
|
|
53
|
+
locale?: string;
|
|
54
|
+
}
|
|
55
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<InputNumberProps, {
|
|
56
|
+
inputRef: import("vue").Ref<({
|
|
57
|
+
$: import("vue").ComponentInternalInstance;
|
|
58
|
+
$data: {};
|
|
59
|
+
$props: {
|
|
60
|
+
readonly asChild?: boolean | undefined;
|
|
61
|
+
readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
|
|
62
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
63
|
+
$attrs: {
|
|
64
|
+
[x: string]: unknown;
|
|
65
|
+
};
|
|
66
|
+
$refs: {
|
|
67
|
+
[x: string]: unknown;
|
|
68
|
+
} & {
|
|
69
|
+
primitiveElement: import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
70
|
+
asChild: {
|
|
71
|
+
type: BooleanConstructor;
|
|
72
|
+
default: boolean;
|
|
73
|
+
};
|
|
74
|
+
as: {
|
|
75
|
+
type: import("vue").PropType<import("reka-ui").AsTag | import("vue").Component>;
|
|
76
|
+
default: string;
|
|
77
|
+
};
|
|
78
|
+
}>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
81
|
+
asChild: boolean;
|
|
82
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
83
|
+
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
84
|
+
P: {};
|
|
85
|
+
B: {};
|
|
86
|
+
D: {};
|
|
87
|
+
C: {};
|
|
88
|
+
M: {};
|
|
89
|
+
Defaults: {};
|
|
90
|
+
}, Readonly<import("vue").ExtractPropTypes<{
|
|
91
|
+
asChild: {
|
|
92
|
+
type: BooleanConstructor;
|
|
93
|
+
default: boolean;
|
|
94
|
+
};
|
|
95
|
+
as: {
|
|
96
|
+
type: import("vue").PropType<import("reka-ui").AsTag | import("vue").Component>;
|
|
97
|
+
default: string;
|
|
98
|
+
};
|
|
99
|
+
}>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
100
|
+
[key: string]: any;
|
|
101
|
+
}>, {}, {}, {}, {
|
|
102
|
+
asChild: boolean;
|
|
103
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
104
|
+
}> | null;
|
|
105
|
+
};
|
|
106
|
+
$slots: Readonly<{
|
|
107
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
108
|
+
}>;
|
|
109
|
+
$root: import("vue").ComponentPublicInstance | null;
|
|
110
|
+
$parent: import("vue").ComponentPublicInstance | null;
|
|
111
|
+
$host: Element | null;
|
|
112
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
113
|
+
$el: any;
|
|
114
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").NumberFieldInputProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
115
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
116
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
117
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
118
|
+
created?: (() => void) | (() => void)[];
|
|
119
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
120
|
+
mounted?: (() => void) | (() => void)[];
|
|
121
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
122
|
+
updated?: (() => void) | (() => void)[];
|
|
123
|
+
activated?: (() => void) | (() => void)[];
|
|
124
|
+
deactivated?: (() => void) | (() => void)[];
|
|
125
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
126
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
127
|
+
destroyed?: (() => void) | (() => void)[];
|
|
128
|
+
unmounted?: (() => void) | (() => void)[];
|
|
129
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
130
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
131
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
132
|
+
};
|
|
133
|
+
$forceUpdate: () => void;
|
|
134
|
+
$nextTick: typeof import("vue").nextTick;
|
|
135
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
136
|
+
} & Readonly<{
|
|
137
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
138
|
+
}> & Omit<Readonly<import("reka-ui").NumberFieldInputProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
139
|
+
$slots: {
|
|
140
|
+
default?(_: {}): any;
|
|
141
|
+
};
|
|
142
|
+
}) | null, ({
|
|
143
|
+
$: import("vue").ComponentInternalInstance;
|
|
144
|
+
$data: {};
|
|
145
|
+
$props: {
|
|
146
|
+
readonly asChild?: boolean | undefined;
|
|
147
|
+
readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
|
|
148
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
149
|
+
$attrs: {
|
|
150
|
+
[x: string]: unknown;
|
|
151
|
+
};
|
|
152
|
+
$refs: {
|
|
153
|
+
[x: string]: unknown;
|
|
154
|
+
} & {
|
|
155
|
+
primitiveElement: import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
156
|
+
asChild: {
|
|
157
|
+
type: BooleanConstructor;
|
|
158
|
+
default: boolean;
|
|
159
|
+
};
|
|
160
|
+
as: {
|
|
161
|
+
type: import("vue").PropType<import("reka-ui").AsTag | import("vue").Component>;
|
|
162
|
+
default: string;
|
|
163
|
+
};
|
|
164
|
+
}>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
165
|
+
[key: string]: any;
|
|
166
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
167
|
+
asChild: boolean;
|
|
168
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
169
|
+
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
170
|
+
P: {};
|
|
171
|
+
B: {};
|
|
172
|
+
D: {};
|
|
173
|
+
C: {};
|
|
174
|
+
M: {};
|
|
175
|
+
Defaults: {};
|
|
176
|
+
}, Readonly<import("vue").ExtractPropTypes<{
|
|
177
|
+
asChild: {
|
|
178
|
+
type: BooleanConstructor;
|
|
179
|
+
default: boolean;
|
|
180
|
+
};
|
|
181
|
+
as: {
|
|
182
|
+
type: import("vue").PropType<import("reka-ui").AsTag | import("vue").Component>;
|
|
183
|
+
default: string;
|
|
184
|
+
};
|
|
185
|
+
}>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
186
|
+
[key: string]: any;
|
|
187
|
+
}>, {}, {}, {}, {
|
|
188
|
+
asChild: boolean;
|
|
189
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
190
|
+
}> | null;
|
|
191
|
+
};
|
|
192
|
+
$slots: Readonly<{
|
|
193
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
194
|
+
}>;
|
|
195
|
+
$root: import("vue").ComponentPublicInstance | null;
|
|
196
|
+
$parent: import("vue").ComponentPublicInstance | null;
|
|
197
|
+
$host: Element | null;
|
|
198
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
199
|
+
$el: any;
|
|
200
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").NumberFieldInputProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
201
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
202
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
203
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
204
|
+
created?: (() => void) | (() => void)[];
|
|
205
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
206
|
+
mounted?: (() => void) | (() => void)[];
|
|
207
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
208
|
+
updated?: (() => void) | (() => void)[];
|
|
209
|
+
activated?: (() => void) | (() => void)[];
|
|
210
|
+
deactivated?: (() => void) | (() => void)[];
|
|
211
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
212
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
213
|
+
destroyed?: (() => void) | (() => void)[];
|
|
214
|
+
unmounted?: (() => void) | (() => void)[];
|
|
215
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
216
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
217
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
218
|
+
};
|
|
219
|
+
$forceUpdate: () => void;
|
|
220
|
+
$nextTick: typeof import("vue").nextTick;
|
|
221
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
222
|
+
} & Readonly<{
|
|
223
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
224
|
+
}> & Omit<Readonly<import("reka-ui").NumberFieldInputProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
225
|
+
$slots: {
|
|
226
|
+
default?(_: {}): any;
|
|
227
|
+
};
|
|
228
|
+
}) | null>;
|
|
229
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
230
|
+
blur: (event: FocusEvent) => any;
|
|
231
|
+
change: (payload: Event) => any;
|
|
232
|
+
"update:modelValue": (payload: number) => any;
|
|
233
|
+
}, string, import("vue").PublicProps, Readonly<InputNumberProps> & Readonly<{
|
|
234
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
235
|
+
onChange?: ((payload: Event) => any) | undefined;
|
|
236
|
+
"onUpdate:modelValue"?: ((payload: number) => any) | undefined;
|
|
237
|
+
}>, {
|
|
238
|
+
orientation: "horizontal" | "vertical";
|
|
239
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, InputNumberSlots>;
|
|
240
|
+
export default _default;
|
|
241
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
242
|
+
new (): {
|
|
243
|
+
$slots: S;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
@@ -1,47 +1,26 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
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
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import { computed } from "vue";
|
|
25
3
|
</script>
|
|
26
4
|
|
|
27
|
-
<script setup
|
|
28
|
-
import { Primitive } from
|
|
29
|
-
import { useKbd } from
|
|
30
|
-
import { useTheme } from
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const {
|
|
40
|
-
const
|
|
5
|
+
<script setup>
|
|
6
|
+
import { Primitive } from "reka-ui";
|
|
7
|
+
import { useKbd } from "../composables/useKbd";
|
|
8
|
+
import { useTheme } from "../composables/useTheme";
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
as: { type: null, required: false, default: "kbd" },
|
|
11
|
+
variant: { type: null, required: false },
|
|
12
|
+
size: { type: null, required: false },
|
|
13
|
+
value: { type: null, required: false },
|
|
14
|
+
class: { type: null, required: false }
|
|
15
|
+
});
|
|
16
|
+
defineSlots();
|
|
17
|
+
const { getKbdKey } = useKbd();
|
|
18
|
+
const { generateStyle } = useTheme();
|
|
19
|
+
const style = computed(() => generateStyle("kbd", props));
|
|
41
20
|
</script>
|
|
42
21
|
|
|
43
22
|
<template>
|
|
44
|
-
<Primitive :as="props.as" :class="style">
|
|
23
|
+
<Primitive :as="props.as" :class="style.base()" data-part="base">
|
|
45
24
|
<slot>{{ getKbdKey(props.value) }}</slot>
|
|
46
25
|
</Primitive>
|
|
47
26
|
</template>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { PrimitiveProps } from 'reka-ui';
|
|
3
|
+
import type { KbdKey } from '../composables/useKbd.js';
|
|
4
|
+
import type { kbd } from '../theme/index.js';
|
|
5
|
+
import type { ComponentAttrs } from '../types/index.js';
|
|
6
|
+
export interface KbdSlots {
|
|
7
|
+
default?: (props?: {}) => any;
|
|
8
|
+
}
|
|
9
|
+
type KbdVariants = VariantProps<typeof kbd>;
|
|
10
|
+
export interface KbdProps extends Omit<ComponentAttrs<typeof kbd>, 'ui'> {
|
|
11
|
+
/**
|
|
12
|
+
* The element or component this component should render as.
|
|
13
|
+
* @default "kbd"
|
|
14
|
+
*/
|
|
15
|
+
as?: PrimitiveProps['as'];
|
|
16
|
+
variant?: KbdVariants['variant'];
|
|
17
|
+
size?: KbdVariants['size'];
|
|
18
|
+
value?: KbdKey | (string & {});
|
|
19
|
+
}
|
|
20
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<KbdProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KbdProps> & Readonly<{}>, {
|
|
21
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
22
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, KbdSlots>;
|
|
23
|
+
export default _default;
|
|
24
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|