@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
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { PaginationRootEmits, PaginationRootProps } from 'reka-ui';
|
|
2
|
+
import type { pagination } from '../theme/index.js';
|
|
3
|
+
import type { ButtonProps, ComponentAttrs } from '../types/index.js';
|
|
4
|
+
export interface PaginationEmits extends PaginationRootEmits {
|
|
5
|
+
}
|
|
6
|
+
export interface PaginationSlots {
|
|
7
|
+
first?: (props?: {}) => any;
|
|
8
|
+
prev?: (props?: {}) => any;
|
|
9
|
+
next?: (props?: {}) => any;
|
|
10
|
+
last?: (props?: {}) => any;
|
|
11
|
+
ellipsis?: (props?: {}) => any;
|
|
12
|
+
item?: (props: {
|
|
13
|
+
page: number;
|
|
14
|
+
pageCount: number;
|
|
15
|
+
item: {
|
|
16
|
+
type: 'ellipsis';
|
|
17
|
+
} | {
|
|
18
|
+
type: 'page';
|
|
19
|
+
value: number;
|
|
20
|
+
};
|
|
21
|
+
index: number;
|
|
22
|
+
}) => any;
|
|
23
|
+
}
|
|
24
|
+
export interface PaginationProps extends ComponentAttrs<typeof pagination>, Pick<PaginationRootProps, 'as' | 'defaultPage' | 'disabled' | 'itemsPerPage' | 'page' | 'showEdges' | 'siblingCount' | 'total'> {
|
|
25
|
+
/**
|
|
26
|
+
* The icon to use for the first page control.
|
|
27
|
+
* @default app.icons.doubleLeft
|
|
28
|
+
*/
|
|
29
|
+
firstIcon?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The icon to use for the last page control.
|
|
32
|
+
* @default app.icons.doubleRight
|
|
33
|
+
*/
|
|
34
|
+
lastIcon?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The icon to use for the previous page control.
|
|
37
|
+
* @default app.icons.chevronLeft
|
|
38
|
+
*/
|
|
39
|
+
prevIcon?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The icon to use for the next page control.
|
|
42
|
+
* @default app.icons.chevronRight
|
|
43
|
+
*/
|
|
44
|
+
nextIcon?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The icon to use for the ellipsis control.
|
|
47
|
+
* @default app.icons.ellipsis
|
|
48
|
+
*/
|
|
49
|
+
ellipsisIcon?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The size of the pagination controls.
|
|
52
|
+
* @default "md"
|
|
53
|
+
*/
|
|
54
|
+
size?: ButtonProps['size'];
|
|
55
|
+
/**
|
|
56
|
+
* The variant of the pagination controls.
|
|
57
|
+
* @default "outline"
|
|
58
|
+
*/
|
|
59
|
+
variant?: ButtonProps['variant'];
|
|
60
|
+
/**
|
|
61
|
+
* The variant of the active pagination control.
|
|
62
|
+
* @default "solid"
|
|
63
|
+
*/
|
|
64
|
+
activeVariant?: ButtonProps['variant'];
|
|
65
|
+
/**
|
|
66
|
+
* Whether to show the first, previous, next, and last controls.
|
|
67
|
+
* @default true
|
|
68
|
+
*/
|
|
69
|
+
showControls?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* A function to render page controls as links.
|
|
72
|
+
*/
|
|
73
|
+
to?: (page: number) => ButtonProps['to'];
|
|
74
|
+
}
|
|
75
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<PaginationProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
76
|
+
"update:page": (value: number) => any;
|
|
77
|
+
}, string, import("vue").PublicProps, Readonly<PaginationProps> & Readonly<{
|
|
78
|
+
"onUpdate:page"?: ((value: number) => any) | undefined;
|
|
79
|
+
}>, {
|
|
80
|
+
variant: "solid" | "outline" | "soft" | "soft-outline" | "link" | "ghost";
|
|
81
|
+
itemsPerPage: number;
|
|
82
|
+
showEdges: boolean;
|
|
83
|
+
siblingCount: number;
|
|
84
|
+
total: number;
|
|
85
|
+
activeVariant: "solid" | "outline" | "soft" | "soft-outline" | "link" | "ghost";
|
|
86
|
+
showControls: boolean;
|
|
87
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, PaginationSlots>;
|
|
88
|
+
export default _default;
|
|
89
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
90
|
+
new (): {
|
|
91
|
+
$slots: S;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
-
import type { PinInputRootProps } from 'reka-ui'
|
|
4
|
-
import type { pinInput } from '../theme'
|
|
5
|
-
import type { ComponentAttrs } from '../types'
|
|
1
|
+
<script>
|
|
6
2
|
|
|
7
|
-
export interface PinInputEmits {
|
|
8
|
-
(event: 'update:modelValue', value: string[]): void
|
|
9
|
-
(event: 'complete', value: string[]): void
|
|
10
|
-
(event: 'change', payload: Event): void
|
|
11
|
-
(event: 'blur', payload: Event): void
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
type PinInputVariants = VariantProps<typeof pinInput>
|
|
15
|
-
|
|
16
|
-
export interface PinInputProps extends ComponentAttrs<typeof pinInput>, Pick<PinInputRootProps, 'as' | 'defaultValue' | 'disabled' | 'id' | 'mask' | 'modelValue' | 'name' | 'otp' | 'placeholder' | 'required' | 'type'> {
|
|
17
|
-
variant?: PinInputVariants['variant']
|
|
18
|
-
size?: PinInputVariants['size']
|
|
19
|
-
length?: number | string
|
|
20
|
-
underline?: boolean
|
|
21
|
-
highlight?: boolean
|
|
22
|
-
}
|
|
23
3
|
</script>
|
|
24
4
|
|
|
25
|
-
<script setup
|
|
26
|
-
import { reactivePick } from
|
|
27
|
-
import { PinInputInput, PinInputRoot, useForwardPropsEmits } from
|
|
28
|
-
import { computed, ref } from
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
const props =
|
|
33
|
-
variant:
|
|
34
|
-
|
|
35
|
-
type:
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { reactivePick } from "@vueuse/core";
|
|
7
|
+
import { PinInputInput, PinInputRoot, useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { computed, ref } from "vue";
|
|
9
|
+
import { useFormItem } from "../composables/useFormItem";
|
|
10
|
+
import { useTheme } from "../composables/useTheme";
|
|
11
|
+
import { looseToNumber } from "../utils";
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
variant: { type: null, required: false, default: "outline" },
|
|
14
|
+
size: { type: null, required: false },
|
|
15
|
+
length: { type: [Number, String], required: false, default: 5 },
|
|
16
|
+
underline: { type: Boolean, required: false },
|
|
17
|
+
highlight: { type: Boolean, required: false },
|
|
18
|
+
class: { type: null, required: false },
|
|
19
|
+
ui: { type: null, required: false },
|
|
20
|
+
as: { type: null, required: false },
|
|
21
|
+
defaultValue: { type: Array, required: false },
|
|
22
|
+
disabled: { type: Boolean, required: false },
|
|
23
|
+
id: { type: String, required: false },
|
|
24
|
+
mask: { type: Boolean, required: false },
|
|
25
|
+
modelValue: { type: null, required: false },
|
|
26
|
+
name: { type: String, required: false },
|
|
27
|
+
otp: { type: Boolean, required: false },
|
|
28
|
+
placeholder: { type: String, required: false },
|
|
29
|
+
required: { type: Boolean, required: false },
|
|
30
|
+
type: { type: null, required: false, default: "text" }
|
|
31
|
+
});
|
|
32
|
+
const emit = defineEmits(["update:modelValue", "complete", "change", "blur"]);
|
|
33
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "defaultValue", "disabled", "id", "mask", "modelValue", "name", "otp", "required", "type"), emit);
|
|
34
|
+
const completed = ref(false);
|
|
35
|
+
const { id, name, size, highlight, disabled, ariaAttrs, emitFormInput, emitFormChange, emitFormFocus, emitFormBlur } = useFormItem(props);
|
|
36
|
+
const { generateStyle } = useTheme();
|
|
37
|
+
const style = computed(() => generateStyle("pinInput", {
|
|
38
|
+
...props,
|
|
39
|
+
size: size.value,
|
|
40
|
+
highlight: highlight.value
|
|
41
|
+
}));
|
|
42
|
+
function onComplete(value) {
|
|
43
|
+
const event = new Event("change", { target: { value } });
|
|
44
|
+
emit("change", event);
|
|
45
|
+
emitFormChange();
|
|
51
46
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
function onBlur(event) {
|
|
48
|
+
if (!event.relatedTarget || completed.value) {
|
|
49
|
+
emit("blur", event);
|
|
50
|
+
emitFormBlur();
|
|
51
|
+
}
|
|
56
52
|
}
|
|
57
53
|
</script>
|
|
58
54
|
|
|
59
55
|
<template>
|
|
60
56
|
<PinInputRoot
|
|
61
|
-
v-bind="rootProps"
|
|
62
|
-
:
|
|
63
|
-
:name="props.name"
|
|
57
|
+
v-bind="{ ...rootProps, ...ariaAttrs, id, name }"
|
|
58
|
+
:placeholder="props.placeholder"
|
|
64
59
|
:class="style.root({ class: [props.class, props.ui?.root] })"
|
|
60
|
+
data-part="root"
|
|
61
|
+
@update:model-value="emitFormInput"
|
|
65
62
|
@complete="onComplete"
|
|
66
63
|
>
|
|
67
64
|
<span
|
|
68
65
|
v-for="(ids, index) in looseToNumber(props.length)"
|
|
69
66
|
:key="ids"
|
|
67
|
+
:aria-disabled="disabled ? true : void 0"
|
|
70
68
|
:class="style.container({ class: props.ui?.container })"
|
|
71
|
-
|
|
69
|
+
data-part="container"
|
|
72
70
|
>
|
|
73
71
|
<PinInputInput
|
|
72
|
+
v-bind="$attrs"
|
|
74
73
|
:index="index"
|
|
74
|
+
:disabled="disabled"
|
|
75
75
|
:class="style.base({ class: props.ui?.base })"
|
|
76
|
-
|
|
77
|
-
:disabled="props.disabled"
|
|
76
|
+
data-part="base"
|
|
78
77
|
@blur="onBlur"
|
|
78
|
+
@focus="emitFormFocus"
|
|
79
79
|
/>
|
|
80
80
|
</span>
|
|
81
81
|
</PinInputRoot>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { PinInputRootEmits, PinInputRootProps } from 'reka-ui';
|
|
3
|
+
import type { pinInput } from '../theme/index.js';
|
|
4
|
+
import type { ComponentAttrs } from '../types/index.js';
|
|
5
|
+
type PinInputType = 'text' | 'number';
|
|
6
|
+
export type PinInputEmits<T extends PinInputType = 'text' | 'number'> = PinInputRootEmits<T> & {
|
|
7
|
+
change: [payload: Event];
|
|
8
|
+
blur: [payload: Event];
|
|
9
|
+
};
|
|
10
|
+
type PinInputVariants = VariantProps<typeof pinInput>;
|
|
11
|
+
export interface PinInputProps<T extends PinInputType = 'text' | 'number'> extends ComponentAttrs<typeof pinInput>, Pick<PinInputRootProps<T>, 'as' | 'defaultValue' | 'disabled' | 'id' | 'mask' | 'modelValue' | 'name' | 'otp' | 'placeholder' | 'required' | 'type'> {
|
|
12
|
+
variant?: PinInputVariants['variant'];
|
|
13
|
+
size?: PinInputVariants['size'];
|
|
14
|
+
length?: number | string;
|
|
15
|
+
underline?: boolean;
|
|
16
|
+
highlight?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const _default: <T extends PinInputType = "text" | "number">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
19
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
20
|
+
readonly onBlur?: ((payload: Event) => any) | undefined;
|
|
21
|
+
readonly onChange?: ((payload: Event) => any) | undefined;
|
|
22
|
+
readonly "onUpdate:modelValue"?: ((value: T extends "number" ? number[] : string[]) => any) | undefined;
|
|
23
|
+
readonly onComplete?: ((value: T extends "number" ? number[] : string[]) => any) | undefined;
|
|
24
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onBlur" | "onChange" | "onUpdate:modelValue" | "onComplete"> & PinInputProps<T> & Partial<{}>> & import("vue").PublicProps;
|
|
25
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
26
|
+
attrs: any;
|
|
27
|
+
slots: {};
|
|
28
|
+
emit: ((evt: "blur", payload: Event) => void) & ((evt: "change", payload: Event) => void) & ((evt: "update:modelValue", value: T extends "number" ? number[] : string[]) => void) & ((evt: "complete", value: T extends "number" ? number[] : string[]) => void);
|
|
29
|
+
}>) => import("vue").VNode & {
|
|
30
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
31
|
+
};
|
|
32
|
+
export default _default;
|
|
33
|
+
type __VLS_PrettifyLocal<T> = {
|
|
34
|
+
[K in keyof T]: T[K];
|
|
35
|
+
} & {};
|
|
@@ -1,76 +1,46 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { HoverCardRootProps, PopoverArrowProps, PopoverContentProps, PopoverRootEmits, PopoverRootProps } from 'reka-ui'
|
|
3
|
-
import type { popover } from '../theme'
|
|
4
|
-
import type { ComponentAttrs } from '../types'
|
|
1
|
+
<script>
|
|
5
2
|
|
|
6
|
-
export interface PopoverEmits extends PopoverRootEmits {}
|
|
7
|
-
|
|
8
|
-
export interface PopoverSlots {
|
|
9
|
-
default?: (props: { open: boolean }) => any
|
|
10
|
-
content?: (props?: {}) => any
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface PopoverProps extends ComponentAttrs<typeof popover>, PopoverRootProps, Pick<HoverCardRootProps, 'openDelay' | 'closeDelay'> {
|
|
14
|
-
/**
|
|
15
|
-
* The display mode of the popover.
|
|
16
|
-
* @default "click"
|
|
17
|
-
*/
|
|
18
|
-
mode?: 'click' | 'hover'
|
|
19
|
-
/** @default { side: 'bottom', sideOffset: 8, collisionPadding: 8 } */
|
|
20
|
-
content?: Omit<PopoverContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
21
|
-
arrow?: boolean | Omit<PopoverArrowProps, 'as' | 'asChild'>
|
|
22
|
-
/** @default true */
|
|
23
|
-
portal?: boolean
|
|
24
|
-
/**
|
|
25
|
-
* When `false`, the popover will not close when clicking outside or pressing escape.
|
|
26
|
-
* @default true
|
|
27
|
-
*/
|
|
28
|
-
dismissible?: boolean
|
|
29
|
-
}
|
|
30
3
|
</script>
|
|
31
4
|
|
|
32
|
-
<script setup
|
|
33
|
-
import { reactivePick } from
|
|
34
|
-
import { defu } from
|
|
35
|
-
import { useForwardPropsEmits } from
|
|
36
|
-
import { HoverCard, Popover } from
|
|
37
|
-
import { computed, toRef } from
|
|
38
|
-
import { useTheme } from
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { reactivePick } from "@vueuse/core";
|
|
7
|
+
import { defu } from "defu";
|
|
8
|
+
import { useForwardPropsEmits } from "reka-ui";
|
|
9
|
+
import { HoverCard, Popover } from "reka-ui/namespaced";
|
|
10
|
+
import { computed, toRef } from "vue";
|
|
11
|
+
import { useTheme } from "../composables/useTheme";
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
mode: { type: String, required: false, default: "click" },
|
|
14
|
+
content: { type: Object, required: false },
|
|
15
|
+
arrow: { type: [Boolean, Object], required: false },
|
|
16
|
+
portal: { type: Boolean, required: false, default: true },
|
|
17
|
+
dismissible: { type: Boolean, required: false, default: true },
|
|
18
|
+
class: { type: null, required: false },
|
|
19
|
+
ui: { type: null, required: false },
|
|
20
|
+
defaultOpen: { type: Boolean, required: false },
|
|
21
|
+
open: { type: Boolean, required: false },
|
|
22
|
+
modal: { type: Boolean, required: false },
|
|
23
|
+
openDelay: { type: Number, required: false, default: 0 },
|
|
24
|
+
closeDelay: { type: Number, required: false, default: 0 }
|
|
25
|
+
});
|
|
26
|
+
const emit = defineEmits(["update:open"]);
|
|
27
|
+
const slots = defineSlots();
|
|
28
|
+
const pick = props.mode === "hover" ? reactivePick(props, "defaultOpen", "open", "openDelay", "closeDelay") : reactivePick(props, "defaultOpen", "open", "modal");
|
|
29
|
+
const rootProps = useForwardPropsEmits(pick, emit);
|
|
30
|
+
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8 }));
|
|
57
31
|
const contentEvents = computed(() => {
|
|
58
32
|
if (props.dismissible)
|
|
59
|
-
return {}
|
|
60
|
-
|
|
33
|
+
return {};
|
|
61
34
|
return {
|
|
62
|
-
pointerDownOutside: (e
|
|
63
|
-
interactOutside: (e
|
|
64
|
-
escapeKeyDown: (e
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
const { generateStyle } = useTheme()
|
|
73
|
-
const style = computed(() => generateStyle('popover', props))
|
|
35
|
+
pointerDownOutside: (e) => e.preventDefault(),
|
|
36
|
+
interactOutside: (e) => e.preventDefault(),
|
|
37
|
+
escapeKeyDown: (e) => e.preventDefault()
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
const arrowProps = toRef(() => props.arrow);
|
|
41
|
+
const Component = computed(() => props.mode === "hover" ? HoverCard : Popover);
|
|
42
|
+
const { generateStyle } = useTheme();
|
|
43
|
+
const style = computed(() => generateStyle("popover", props));
|
|
74
44
|
</script>
|
|
75
45
|
|
|
76
46
|
<template>
|
|
@@ -83,11 +53,12 @@ const style = computed(() => generateStyle('popover', props))
|
|
|
83
53
|
<Component.Content
|
|
84
54
|
v-bind="contentProps"
|
|
85
55
|
:class="style.content({ class: [!slots.default && props.class, props.ui?.content] })"
|
|
56
|
+
data-part="content"
|
|
86
57
|
v-on="contentEvents"
|
|
87
58
|
>
|
|
88
59
|
<slot name="content"></slot>
|
|
89
60
|
|
|
90
|
-
<Component.Arrow v-if="!!arrow" v-bind="arrowProps" :class="style.arrow({ class: props.ui?.arrow })" />
|
|
61
|
+
<Component.Arrow v-if="!!arrow" v-bind="arrowProps" :class="style.arrow({ class: props.ui?.arrow })" data-part="arrow" />
|
|
91
62
|
</Component.Content>
|
|
92
63
|
</Component.Portal>
|
|
93
64
|
</Component.Root>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { HoverCardRootProps, PopoverArrowProps, PopoverContentEmits, PopoverContentProps, PopoverRootEmits, PopoverRootProps } from 'reka-ui';
|
|
2
|
+
import type { popover } from '../theme/index.js';
|
|
3
|
+
import type { ComponentAttrs, EmitsToProps } from '../types/index.js';
|
|
4
|
+
export interface PopoverEmits extends PopoverRootEmits {
|
|
5
|
+
}
|
|
6
|
+
export interface PopoverSlots {
|
|
7
|
+
default?: (props: {
|
|
8
|
+
open: boolean;
|
|
9
|
+
}) => any;
|
|
10
|
+
content?: (props?: {}) => any;
|
|
11
|
+
}
|
|
12
|
+
export interface PopoverProps extends ComponentAttrs<typeof popover>, PopoverRootProps, Pick<HoverCardRootProps, 'openDelay' | 'closeDelay'> {
|
|
13
|
+
/**
|
|
14
|
+
* The display mode of the popover.
|
|
15
|
+
* @default "click"
|
|
16
|
+
*/
|
|
17
|
+
mode?: 'click' | 'hover';
|
|
18
|
+
/** @default { side: 'bottom', sideOffset: 8, collisionPadding: 8 } */
|
|
19
|
+
content?: Omit<PopoverContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<PopoverContentEmits>>;
|
|
20
|
+
arrow?: boolean | Omit<PopoverArrowProps, 'as' | 'asChild'>;
|
|
21
|
+
/** @default true */
|
|
22
|
+
portal?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* When `false`, the popover will not close when clicking outside or pressing escape.
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
dismissible?: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<PopoverProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
30
|
+
"update:open": (value: boolean) => any;
|
|
31
|
+
}, string, import("vue").PublicProps, Readonly<PopoverProps> & Readonly<{
|
|
32
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
33
|
+
}>, {
|
|
34
|
+
mode: "click" | "hover";
|
|
35
|
+
portal: boolean;
|
|
36
|
+
dismissible: boolean;
|
|
37
|
+
openDelay: number;
|
|
38
|
+
closeDelay: number;
|
|
39
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, PopoverSlots>;
|
|
40
|
+
export default _default;
|
|
41
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
42
|
+
new (): {
|
|
43
|
+
$slots: S;
|
|
44
|
+
};
|
|
45
|
+
};
|