@byyuurin/ui 0.0.11 → 0.2.0
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 +170 -58
- package/dist/module.d.mts +4 -13
- package/dist/module.json +4 -4
- package/dist/module.mjs +54 -20
- package/dist/runtime/components/Accordion.vue +28 -23
- package/dist/runtime/components/Accordion.vue.d.ts +51 -29
- package/dist/runtime/components/Alert.vue +47 -27
- package/dist/runtime/components/Alert.vue.d.ts +37 -25
- package/dist/runtime/components/App.vue +9 -8
- package/dist/runtime/components/App.vue.d.ts +22 -20
- package/dist/runtime/components/Avatar.vue +65 -21
- package/dist/runtime/components/Avatar.vue.d.ts +27 -13
- package/dist/runtime/components/AvatarGroup.vue +14 -10
- package/dist/runtime/components/AvatarGroup.vue.d.ts +12 -9
- package/dist/runtime/components/Badge.vue +64 -32
- package/dist/runtime/components/Badge.vue.d.ts +30 -29
- package/dist/runtime/components/Breadcrumb.vue +40 -22
- package/dist/runtime/components/Breadcrumb.vue.d.ts +48 -21
- package/dist/runtime/components/Button.vue +113 -52
- package/dist/runtime/components/Button.vue.d.ts +36 -20
- package/dist/runtime/components/Calendar.vue +50 -43
- package/dist/runtime/components/Calendar.vue.d.ts +58 -31
- package/dist/runtime/components/Card.vue +18 -14
- package/dist/runtime/components/Card.vue.d.ts +18 -14
- package/dist/runtime/components/Carousel.vue +99 -46
- package/dist/runtime/components/Carousel.vue.d.ts +46 -25
- package/dist/runtime/components/Checkbox.vue +60 -35
- package/dist/runtime/components/Checkbox.vue.d.ts +35 -28
- package/dist/runtime/components/CheckboxGroup.vue +131 -0
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +89 -0
- package/dist/runtime/components/Chip.vue +35 -32
- package/dist/runtime/components/Chip.vue.d.ts +33 -15
- package/dist/runtime/components/Collapsible.vue +13 -9
- package/dist/runtime/components/Collapsible.vue.d.ts +16 -8
- package/dist/runtime/components/Drawer.vue +80 -70
- package/dist/runtime/components/Drawer.vue.d.ts +51 -28
- package/dist/runtime/components/DropdownMenu.vue +23 -16
- package/dist/runtime/components/DropdownMenu.vue.d.ts +77 -36
- package/dist/runtime/components/DropdownMenuContent.vue +136 -106
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +38 -26
- package/dist/runtime/components/FieldGroup.vue +33 -0
- package/dist/runtime/components/FieldGroup.vue.d.ts +33 -0
- package/dist/runtime/components/Form.vue +172 -88
- package/dist/runtime/components/Form.vue.d.ts +69 -44
- package/dist/runtime/components/FormField.vue +108 -0
- package/dist/runtime/components/FormField.vue.d.ts +63 -0
- package/dist/runtime/components/Icon.vue +20 -0
- package/dist/runtime/components/Icon.vue.d.ts +9 -0
- package/dist/runtime/components/Input.vue +84 -79
- package/dist/runtime/components/Input.vue.d.ts +55 -43
- package/dist/runtime/components/InputNumber.vue +66 -52
- package/dist/runtime/components/InputNumber.vue.d.ts +50 -109
- package/dist/runtime/components/InputTags.vue +155 -0
- package/dist/runtime/components/InputTags.vue.d.ts +85 -0
- package/dist/runtime/components/Kbd.vue +11 -5
- package/dist/runtime/components/Kbd.vue.d.ts +17 -11
- package/dist/runtime/components/Link.vue +54 -197
- package/dist/runtime/components/Link.vue.d.ts +17 -17
- package/dist/runtime/components/LinkBase.vue +11 -33
- package/dist/runtime/components/LinkBase.vue.d.ts +8 -3
- package/dist/runtime/components/Marquee.vue +38 -0
- package/dist/runtime/components/Marquee.vue.d.ts +54 -0
- package/dist/runtime/components/Modal.vue +53 -39
- package/dist/runtime/components/Modal.vue.d.ts +64 -34
- package/dist/runtime/components/NavigationMenu.vue +345 -0
- package/dist/runtime/components/NavigationMenu.vue.d.ts +216 -0
- package/dist/runtime/components/OverlayProvider.vue +3 -3
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -1
- package/dist/runtime/components/Pagination.vue +39 -47
- package/dist/runtime/components/Pagination.vue.d.ts +54 -31
- package/dist/runtime/components/PinInput.vue +46 -32
- package/dist/runtime/components/PinInput.vue.d.ts +40 -21
- package/dist/runtime/components/Popover.vue +33 -19
- package/dist/runtime/components/Popover.vue.d.ts +57 -32
- package/dist/runtime/components/Progress.vue +31 -26
- package/dist/runtime/components/Progress.vue.d.ts +32 -23
- package/dist/runtime/components/RadioGroup.vue +75 -48
- package/dist/runtime/components/RadioGroup.vue.d.ts +58 -36
- package/dist/runtime/components/ScrollArea.vue +33 -31
- package/dist/runtime/components/ScrollArea.vue.d.ts +9 -5
- package/dist/runtime/components/Select.vue +166 -76
- package/dist/runtime/components/Select.vue.d.ts +206 -65
- package/dist/runtime/components/Separator.vue +42 -16
- package/dist/runtime/components/Separator.vue.d.ts +35 -14
- package/dist/runtime/components/Skeleton.vue +18 -6
- package/dist/runtime/components/Skeleton.vue.d.ts +4 -4
- package/dist/runtime/components/Slider.vue +42 -24
- package/dist/runtime/components/Slider.vue.d.ts +43 -27
- package/dist/runtime/components/Switch.vue +40 -31
- package/dist/runtime/components/Switch.vue.d.ts +36 -27
- package/dist/runtime/components/Table.vue +329 -79
- package/dist/runtime/components/Table.vue.d.ts +152 -66
- package/dist/runtime/components/Tabs.vue +70 -23
- package/dist/runtime/components/Tabs.vue.d.ts +61 -29
- package/dist/runtime/components/Textarea.vue +102 -54
- package/dist/runtime/components/Textarea.vue.d.ts +57 -41
- package/dist/runtime/components/Timeline.vue +102 -0
- package/dist/runtime/components/Timeline.vue.d.ts +74 -0
- package/dist/runtime/components/Toast.vue +84 -38
- package/dist/runtime/components/Toast.vue.d.ts +48 -27
- package/dist/runtime/components/ToastProvider.vue +31 -22
- package/dist/runtime/components/ToastProvider.vue.d.ts +30 -17
- package/dist/runtime/components/Tooltip.vue +33 -21
- package/dist/runtime/components/Tooltip.vue.d.ts +37 -15
- package/dist/runtime/composables/defineShortcuts.d.ts +16 -0
- package/dist/runtime/composables/defineShortcuts.js +129 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +8 -3
- package/dist/runtime/composables/useAvatarGroup.js +10 -3
- package/dist/runtime/composables/useComponentIcons.d.ts +9 -6
- package/dist/runtime/composables/useComponentIcons.js +4 -4
- package/dist/runtime/composables/useFieldGroup.d.ts +8 -0
- package/dist/runtime/composables/useFieldGroup.js +14 -0
- package/dist/runtime/composables/useFormField.d.ts +62 -0
- package/dist/runtime/composables/useFormField.js +99 -0
- package/dist/runtime/composables/useKbd.d.ts +3 -2
- package/dist/runtime/composables/useKbd.js +3 -2
- package/dist/runtime/composables/useLocale.d.ts +68 -5
- package/dist/runtime/composables/useLocale.js +11 -11
- package/dist/runtime/composables/useOverlay.d.ts +51 -15
- package/dist/runtime/composables/useOverlay.js +44 -30
- package/dist/runtime/composables/usePortal.d.ts +6 -0
- package/dist/runtime/composables/usePortal.js +17 -0
- package/dist/runtime/composables/useToast.d.ts +12 -5
- package/dist/runtime/composables/useToast.js +12 -7
- package/dist/runtime/locale/en.d.ts +30 -1
- package/dist/runtime/locale/en.js +2 -1
- package/dist/runtime/locale/index.d.ts +2 -2
- package/dist/runtime/locale/index.js +1 -1
- package/dist/runtime/locale/zh_tw.d.ts +31 -0
- package/dist/runtime/locale/{zh-tw.js → zh_tw.js} +2 -1
- package/dist/runtime/plugins/colors.d.ts +2 -0
- package/dist/runtime/plugins/colors.js +50 -0
- package/dist/runtime/types/app.config.d.ts +6 -0
- package/dist/runtime/types/form.d.ts +58 -17
- package/dist/runtime/types/form.js +11 -0
- package/dist/runtime/types/index.d.ts +56 -8
- package/dist/runtime/types/index.js +49 -1
- package/dist/runtime/types/input.d.ts +8 -0
- package/dist/runtime/types/locale.d.ts +5 -0
- package/dist/runtime/types/style.d.ts +33 -0
- package/dist/runtime/types/style.js +0 -0
- package/dist/runtime/types/unocss.d.ts +4 -0
- package/dist/runtime/types/utils.d.ts +41 -37
- package/dist/runtime/utils/form.d.ts +5 -1
- package/dist/runtime/utils/form.js +49 -0
- package/dist/runtime/utils/index.d.ts +10 -13
- package/dist/runtime/utils/index.js +41 -48
- package/dist/runtime/utils/link.d.ts +3 -2
- package/dist/runtime/utils/link.js +16 -2
- package/dist/runtime/utils/locale.d.ts +5 -0
- package/dist/runtime/utils/locale.js +10 -0
- package/dist/runtime/utils/style.d.ts +94 -0
- package/dist/runtime/utils/style.js +37 -0
- package/dist/runtime/vue/components/Icon.vue +15 -0
- package/dist/runtime/vue/components/Icon.vue.d.ts +7 -0
- package/dist/runtime/vue/components/Link.vue +163 -0
- package/dist/runtime/vue/components/Link.vue.d.ts +95 -0
- package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
- package/dist/runtime/vue/composables/useAppConfig.js +4 -0
- package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
- package/dist/runtime/vue/plugins/color-mode.js +6 -0
- package/dist/runtime/vue/plugins/head.d.ts +4 -0
- package/dist/runtime/vue/plugins/head.js +9 -0
- package/dist/runtime/vue/stubs.d.ts +16 -1
- package/dist/runtime/vue/stubs.js +32 -1
- package/dist/setup.d.mts +13 -0
- package/dist/setup.mjs +12 -0
- package/dist/shared/ui.CzIlLITK.mjs +51 -0
- package/dist/shared/ui.DLOxhmP0.mjs +4242 -0
- package/dist/shared/ui.DpbffTXs.d.mts +84 -0
- package/dist/shared/ui.IulR-OYx.d.mts +64 -0
- package/dist/types.d.mts +3 -1
- package/dist/unocss.d.mts +12 -52
- package/dist/unocss.mjs +144 -254
- package/dist/unplugin.d.mts +13 -26
- package/dist/unplugin.mjs +193 -18
- package/dist/vite.d.mts +10 -1
- package/dist/vite.mjs +12 -3
- package/package.json +154 -87
- package/vue-plugin.d.ts +5 -0
- package/dist/module.d.ts +0 -13
- package/dist/module.mjs.map +0 -1
- package/dist/runtime/app/injections.d.ts +0 -9331
- package/dist/runtime/app/injections.js +0 -61
- package/dist/runtime/components/ButtonGroup.vue +0 -26
- package/dist/runtime/components/ButtonGroup.vue.d.ts +0 -26
- package/dist/runtime/components/FormItem.vue +0 -90
- package/dist/runtime/components/FormItem.vue.d.ts +0 -60
- package/dist/runtime/composables/useButtonGroup.d.ts +0 -5
- package/dist/runtime/composables/useButtonGroup.js +0 -9
- package/dist/runtime/composables/useFormItem.d.ts +0 -27
- package/dist/runtime/composables/useFormItem.js +0 -64
- package/dist/runtime/composables/useTheme.d.ts +0 -9
- package/dist/runtime/composables/useTheme.js +0 -23
- package/dist/runtime/index.d.ts +0 -44
- package/dist/runtime/index.js +0 -44
- package/dist/runtime/locale/zh-tw.d.ts +0 -2
- package/dist/runtime/theme/accordion.d.ts +0 -50
- package/dist/runtime/theme/accordion.js +0 -28
- package/dist/runtime/theme/alert.d.ts +0 -119
- package/dist/runtime/theme/alert.js +0 -47
- package/dist/runtime/theme/app.d.ts +0 -19
- package/dist/runtime/theme/app.js +0 -19
- package/dist/runtime/theme/avatar-group.d.ts +0 -46
- package/dist/runtime/theme/avatar-group.js +0 -32
- package/dist/runtime/theme/avatar.d.ts +0 -50
- package/dist/runtime/theme/avatar.js +0 -34
- package/dist/runtime/theme/badge.d.ts +0 -76
- package/dist/runtime/theme/badge.js +0 -92
- package/dist/runtime/theme/breadcrumb.d.ts +0 -61
- package/dist/runtime/theme/breadcrumb.js +0 -44
- package/dist/runtime/theme/button-group.d.ts +0 -60
- package/dist/runtime/theme/button-group.js +0 -42
- package/dist/runtime/theme/button.d.ts +0 -184
- package/dist/runtime/theme/button.js +0 -164
- package/dist/runtime/theme/calendar.d.ts +0 -58
- package/dist/runtime/theme/calendar.js +0 -86
- package/dist/runtime/theme/card.d.ts +0 -56
- package/dist/runtime/theme/card.js +0 -37
- package/dist/runtime/theme/carousel.d.ts +0 -107
- package/dist/runtime/theme/carousel.js +0 -43
- package/dist/runtime/theme/checkbox.d.ts +0 -82
- package/dist/runtime/theme/checkbox.js +0 -54
- package/dist/runtime/theme/chip.d.ts +0 -61
- package/dist/runtime/theme/chip.js +0 -66
- package/dist/runtime/theme/collapsible.d.ts +0 -32
- package/dist/runtime/theme/collapsible.js +0 -10
- package/dist/runtime/theme/drawer.d.ts +0 -142
- package/dist/runtime/theme/drawer.js +0 -113
- package/dist/runtime/theme/dropdown-menu.d.ts +0 -65
- package/dist/runtime/theme/dropdown-menu.js +0 -83
- package/dist/runtime/theme/form-item.d.ts +0 -70
- package/dist/runtime/theme/form-item.js +0 -34
- package/dist/runtime/theme/form.d.ts +0 -2
- package/dist/runtime/theme/form.js +0 -7
- package/dist/runtime/theme/index.d.ts +0 -41
- package/dist/runtime/theme/index.js +0 -41
- package/dist/runtime/theme/input-number.d.ts +0 -115
- package/dist/runtime/theme/input-number.js +0 -95
- package/dist/runtime/theme/input.d.ts +0 -172
- package/dist/runtime/theme/input.js +0 -151
- package/dist/runtime/theme/kbd.d.ts +0 -33
- package/dist/runtime/theme/kbd.js +0 -26
- package/dist/runtime/theme/link.d.ts +0 -38
- package/dist/runtime/theme/link.js +0 -26
- package/dist/runtime/theme/modal.d.ts +0 -42
- package/dist/runtime/theme/modal.js +0 -55
- package/dist/runtime/theme/pagination.d.ts +0 -74
- package/dist/runtime/theme/pagination.js +0 -17
- package/dist/runtime/theme/pinInput.d.ts +0 -94
- package/dist/runtime/theme/pinInput.js +0 -111
- package/dist/runtime/theme/popover.d.ts +0 -32
- package/dist/runtime/theme/popover.js +0 -13
- package/dist/runtime/theme/progress.d.ts +0 -180
- package/dist/runtime/theme/progress.js +0 -95
- package/dist/runtime/theme/radio-group.d.ts +0 -104
- package/dist/runtime/theme/radio-group.js +0 -61
- package/dist/runtime/theme/scroll-area.d.ts +0 -67
- package/dist/runtime/theme/scroll-area.js +0 -33
- package/dist/runtime/theme/select.d.ts +0 -186
- package/dist/runtime/theme/select.js +0 -173
- package/dist/runtime/theme/separator.d.ts +0 -74
- package/dist/runtime/theme/separator.js +0 -53
- package/dist/runtime/theme/skeleton.d.ts +0 -2
- package/dist/runtime/theme/skeleton.js +0 -7
- package/dist/runtime/theme/slider.d.ts +0 -70
- package/dist/runtime/theme/slider.js +0 -52
- package/dist/runtime/theme/switch.d.ts +0 -116
- package/dist/runtime/theme/switch.js +0 -78
- package/dist/runtime/theme/table.d.ts +0 -86
- package/dist/runtime/theme/table.js +0 -36
- package/dist/runtime/theme/tabs.d.ts +0 -129
- package/dist/runtime/theme/tabs.js +0 -146
- package/dist/runtime/theme/textarea.d.ts +0 -90
- package/dist/runtime/theme/textarea.js +0 -116
- package/dist/runtime/theme/toast-provider.d.ts +0 -116
- package/dist/runtime/theme/toast-provider.js +0 -97
- package/dist/runtime/theme/toast.d.ts +0 -83
- package/dist/runtime/theme/toast.js +0 -35
- package/dist/runtime/theme/tooltip.d.ts +0 -38
- package/dist/runtime/theme/tooltip.js +0 -11
- package/dist/runtime/types/components.d.ts +0 -42
- package/dist/runtime/utils/extend-theme.d.ts +0 -9
- package/dist/runtime/utils/extend-theme.js +0 -27
- package/dist/runtime/utils/styler.d.ts +0 -4
- package/dist/runtime/utils/styler.js +0 -10
- package/dist/runtime/utils/translator.d.ts +0 -18
- package/dist/runtime/utils/translator.js +0 -8
- package/dist/shared/ui.D1BTWZFB.mjs +0 -5
- package/dist/shared/ui.D1BTWZFB.mjs.map +0 -1
- package/dist/unocss.d.ts +0 -52
- package/dist/unocss.mjs.map +0 -1
- package/dist/unplugin.d.ts +0 -26
- package/dist/unplugin.mjs.map +0 -1
- package/dist/vite.d.ts +0 -9
- package/dist/vite.mjs.map +0 -1
- /package/dist/runtime/types/{components.js → input.js} +0 -0
|
@@ -1,35 +1,54 @@
|
|
|
1
|
+
import type { ComponentPublicInstance } from 'vue';
|
|
1
2
|
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
3
|
import type { PinInputRootEmits, PinInputRootProps } from 'reka-ui';
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
4
|
+
import theme from '#build/ui/pin-input';
|
|
5
|
+
import type { ComponentBaseProps, ComponentUIProps } from '../types';
|
|
5
6
|
type PinInputType = 'text' | 'number';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
type ThemeVariants = VariantProps<typeof theme>;
|
|
8
|
+
export interface PinInputProps<T extends PinInputType = 'text'> extends ComponentBaseProps, Pick<PinInputRootProps<T>, 'defaultValue' | 'disabled' | 'id' | 'mask' | 'modelValue' | 'name' | 'otp' | 'placeholder' | 'required' | 'type'> {
|
|
9
|
+
/**
|
|
10
|
+
* The element or component this component should render as.
|
|
11
|
+
* @default "div"
|
|
12
|
+
*/
|
|
13
|
+
as?: PinInputRootProps<T>['as'];
|
|
14
|
+
/** @default "solid" */
|
|
15
|
+
variant?: ThemeVariants['variant'];
|
|
16
|
+
/** @default "md" */
|
|
17
|
+
size?: ThemeVariants['size'];
|
|
18
|
+
/** @default "primary" */
|
|
19
|
+
color?: ThemeVariants['color'];
|
|
20
|
+
/**
|
|
21
|
+
* The number of input fields.
|
|
22
|
+
* @default 5
|
|
23
|
+
*/
|
|
14
24
|
length?: number | string;
|
|
15
|
-
|
|
25
|
+
autofocus?: boolean;
|
|
26
|
+
autofocusDelay?: number;
|
|
16
27
|
highlight?: boolean;
|
|
28
|
+
ui?: ComponentUIProps<typeof theme>;
|
|
17
29
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
export type PinInputEmits<T extends PinInputType = 'text'> = PinInputRootEmits<T> & {
|
|
31
|
+
change: [event: Event];
|
|
32
|
+
blur: [event: Event];
|
|
33
|
+
};
|
|
34
|
+
declare const __VLS_export: <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<{
|
|
35
|
+
props: __VLS_PrettifyLocal<PinInputProps<T> & {
|
|
36
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
37
|
+
onBlur?: ((event: Event) => any) | undefined;
|
|
38
|
+
"onUpdate:modelValue"?: ((value: [T] extends ["number"] ? number[] : string[]) => any) | undefined;
|
|
39
|
+
onComplete?: ((value: [T] extends ["number"] ? number[] : string[]) => any) | undefined;
|
|
40
|
+
}> & import("vue").PublicProps;
|
|
41
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
42
|
+
inputsRef: import("vue").Ref<ComponentPublicInstance[], ComponentPublicInstance[]>;
|
|
43
|
+
}>) => void;
|
|
26
44
|
attrs: any;
|
|
27
45
|
slots: {};
|
|
28
|
-
emit: ((evt: "
|
|
46
|
+
emit: ((evt: "change", event: Event) => void) & ((evt: "blur", event: Event) => void) & ((evt: "update:modelValue", value: [T] extends ["number"] ? number[] : string[]) => void) & ((evt: "complete", value: [T] extends ["number"] ? number[] : string[]) => void);
|
|
29
47
|
}>) => import("vue").VNode & {
|
|
30
48
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
31
49
|
};
|
|
50
|
+
declare const _default: typeof __VLS_export;
|
|
32
51
|
export default _default;
|
|
33
52
|
type __VLS_PrettifyLocal<T> = {
|
|
34
|
-
[K in keyof T]: T[K];
|
|
53
|
+
[K in keyof T as K]: T[K];
|
|
35
54
|
} & {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
2
|
+
import theme from "#build/ui/popover";
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
@@ -8,57 +8,71 @@ import { defu } from "defu";
|
|
|
8
8
|
import { useForwardPropsEmits } from "reka-ui";
|
|
9
9
|
import { HoverCard, Popover } from "reka-ui/namespaced";
|
|
10
10
|
import { computed, toRef } from "vue";
|
|
11
|
-
import {
|
|
11
|
+
import { useAppConfig } from "#imports";
|
|
12
|
+
import { usePortal } from "../composables/usePortal";
|
|
13
|
+
import { cv, merge } from "../utils/style";
|
|
12
14
|
const props = defineProps({
|
|
13
|
-
mode: { type:
|
|
15
|
+
mode: { type: null, required: false, default: "click" },
|
|
14
16
|
content: { type: Object, required: false },
|
|
15
17
|
arrow: { type: [Boolean, Object], required: false },
|
|
16
|
-
portal: { type: Boolean, required: false, default: true },
|
|
18
|
+
portal: { type: [Boolean, String], required: false, skipCheck: true, default: true },
|
|
19
|
+
reference: { type: null, required: false },
|
|
17
20
|
dismissible: { type: Boolean, required: false, default: true },
|
|
18
|
-
class: { type: null, required: false },
|
|
19
21
|
ui: { type: null, required: false },
|
|
22
|
+
class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
|
|
20
23
|
defaultOpen: { type: Boolean, required: false },
|
|
21
24
|
open: { type: Boolean, required: false },
|
|
22
25
|
modal: { type: Boolean, required: false },
|
|
23
26
|
openDelay: { type: Number, required: false, default: 0 },
|
|
24
27
|
closeDelay: { type: Number, required: false, default: 0 }
|
|
25
28
|
});
|
|
26
|
-
const emit = defineEmits(["update:open"]);
|
|
29
|
+
const emit = defineEmits(["close-prevent", "update:open"]);
|
|
27
30
|
const slots = defineSlots();
|
|
28
31
|
const pick = props.mode === "hover" ? reactivePick(props, "defaultOpen", "open", "openDelay", "closeDelay") : reactivePick(props, "defaultOpen", "open", "modal");
|
|
29
32
|
const rootProps = useForwardPropsEmits(pick, emit);
|
|
33
|
+
const portalProps = usePortal(toRef(() => props.portal));
|
|
30
34
|
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8 }));
|
|
31
35
|
const contentEvents = computed(() => {
|
|
32
36
|
if (props.dismissible)
|
|
33
37
|
return {};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
const events = ["pointerDownOutside", "interactOutside", "escapeKeyDown"];
|
|
39
|
+
return events.reduce((acc, curr) => {
|
|
40
|
+
acc[curr] = (e) => {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
emit("close-prevent");
|
|
43
|
+
};
|
|
44
|
+
return acc;
|
|
45
|
+
}, {});
|
|
39
46
|
});
|
|
40
47
|
const arrowProps = toRef(() => props.arrow);
|
|
41
48
|
const Component = computed(() => props.mode === "hover" ? HoverCard : Popover);
|
|
42
|
-
const
|
|
43
|
-
const
|
|
49
|
+
const appConfig = useAppConfig();
|
|
50
|
+
const ui = computed(() => {
|
|
51
|
+
const styler = cv(merge(theme, appConfig.ui.popover));
|
|
52
|
+
return styler(props);
|
|
53
|
+
});
|
|
44
54
|
</script>
|
|
45
55
|
|
|
46
56
|
<template>
|
|
47
|
-
<Component.Root v-slot="{ open }" v-bind="rootProps">
|
|
48
|
-
<Component.Trigger v-if="!!slots.default" as-child :class="props.class">
|
|
57
|
+
<Component.Root v-slot="{ open, close }" v-bind="rootProps">
|
|
58
|
+
<Component.Trigger v-if="!!slots.default || !!props.reference" :reference="props.reference" as-child :class="props.class">
|
|
49
59
|
<slot :open="open"></slot>
|
|
50
60
|
</Component.Trigger>
|
|
51
61
|
|
|
52
|
-
<Component.
|
|
62
|
+
<Component.Anchor v-if="'Anchor' in Component && !!slots.anchor" as-child>
|
|
63
|
+
<slot name="anchor" v-bind="close ? { close } : {}"></slot>
|
|
64
|
+
</Component.Anchor>
|
|
65
|
+
|
|
66
|
+
<Component.Portal v-bind="portalProps">
|
|
53
67
|
<Component.Content
|
|
54
68
|
v-bind="contentProps"
|
|
55
|
-
:class="
|
|
69
|
+
:class="ui.content({ class: [props.ui?.content, !slots.default && props.class] })"
|
|
56
70
|
data-part="content"
|
|
57
71
|
v-on="contentEvents"
|
|
58
72
|
>
|
|
59
|
-
<slot name="content"></slot>
|
|
73
|
+
<slot name="content" v-bind="close ? { close } : {}"></slot>
|
|
60
74
|
|
|
61
|
-
<Component.Arrow v-if="!!arrow" v-bind="arrowProps" :class="
|
|
75
|
+
<Component.Arrow v-if="!!props.arrow" v-bind="arrowProps" :class="ui.arrow({ class: props.ui?.arrow })" data-part="arrow" />
|
|
62
76
|
</Component.Content>
|
|
63
77
|
</Component.Portal>
|
|
64
78
|
</Component.Root>
|
|
@@ -1,45 +1,70 @@
|
|
|
1
|
-
import type { HoverCardRootProps, PopoverArrowProps, PopoverContentEmits, PopoverContentProps, PopoverRootEmits, PopoverRootProps } from 'reka-ui';
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export interface
|
|
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'> {
|
|
1
|
+
import type { HoverCardRootProps, HoverCardTriggerProps, PopoverArrowProps, PopoverContentEmits, PopoverContentProps, PopoverRootEmits, PopoverRootProps } from 'reka-ui';
|
|
2
|
+
import theme from '#build/ui/popover';
|
|
3
|
+
import type { ComponentBaseProps, ComponentUIProps } from '../types';
|
|
4
|
+
import type { EmitsToProps, StaticSlot } from '../types/utils';
|
|
5
|
+
type PopoverMode = 'click' | 'hover';
|
|
6
|
+
export interface PopoverProps<M extends PopoverMode = PopoverMode> extends ComponentBaseProps, PopoverRootProps, Pick<HoverCardRootProps, 'openDelay' | 'closeDelay'> {
|
|
13
7
|
/**
|
|
14
8
|
* The display mode of the popover.
|
|
15
9
|
* @default "click"
|
|
16
10
|
*/
|
|
17
|
-
mode?:
|
|
18
|
-
/**
|
|
11
|
+
mode?: M;
|
|
12
|
+
/**
|
|
13
|
+
* The content of the popover.
|
|
14
|
+
* @default { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
|
|
15
|
+
*/
|
|
19
16
|
content?: Omit<PopoverContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<PopoverContentEmits>>;
|
|
17
|
+
/**
|
|
18
|
+
* Display an arrow alongside the popover.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
20
21
|
arrow?: boolean | Omit<PopoverArrowProps, 'as' | 'asChild'>;
|
|
21
|
-
/**
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Render the popover in a portal.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
portal?: boolean | string | HTMLElement;
|
|
27
|
+
/**
|
|
28
|
+
* The reference (or anchor) element that is being referred to for positioning.
|
|
29
|
+
*
|
|
30
|
+
* If not provided will use the current component as anchor.
|
|
31
|
+
*/
|
|
32
|
+
reference?: HoverCardTriggerProps['reference'];
|
|
23
33
|
/**
|
|
24
34
|
* When `false`, the popover will not close when clicking outside or pressing escape.
|
|
25
35
|
* @default true
|
|
26
36
|
*/
|
|
27
37
|
dismissible?: boolean;
|
|
38
|
+
ui?: ComponentUIProps<typeof theme>;
|
|
28
39
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
export interface PopoverEmits extends PopoverRootEmits {
|
|
41
|
+
'close-prevent': [];
|
|
42
|
+
}
|
|
43
|
+
export interface PopoverSlots<M extends PopoverMode = PopoverMode> {
|
|
44
|
+
default: StaticSlot<{
|
|
45
|
+
open: boolean;
|
|
46
|
+
}>;
|
|
47
|
+
content: StaticSlot<[M] extends ['hover'] ? undefined : {
|
|
48
|
+
close: () => void;
|
|
49
|
+
}>;
|
|
50
|
+
anchor: StaticSlot<[M] extends ['hover'] ? undefined : {
|
|
51
|
+
close: () => void;
|
|
52
|
+
}>;
|
|
53
|
+
}
|
|
54
|
+
declare const __VLS_export: <M extends PopoverMode>(__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<{
|
|
55
|
+
props: __VLS_PrettifyLocal<PopoverProps<M> & {
|
|
56
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
57
|
+
"onClose-prevent"?: (() => any) | undefined;
|
|
58
|
+
}> & import("vue").PublicProps;
|
|
59
|
+
expose: (exposed: {}) => void;
|
|
60
|
+
attrs: any;
|
|
61
|
+
slots: PopoverSlots<M>;
|
|
62
|
+
emit: ((evt: "update:open", value: boolean) => void) & ((evt: "close-prevent") => void);
|
|
63
|
+
}>) => import("vue").VNode & {
|
|
64
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
45
65
|
};
|
|
66
|
+
declare const _default: typeof __VLS_export;
|
|
67
|
+
export default _default;
|
|
68
|
+
type __VLS_PrettifyLocal<T> = {
|
|
69
|
+
[K in keyof T as K]: T[K];
|
|
70
|
+
} & {};
|
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
2
|
+
import theme from "#build/ui/progress";
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { reactivePick } from "@vueuse/core";
|
|
7
7
|
import { Primitive, ProgressIndicator, ProgressRoot, useForwardPropsEmits } from "reka-ui";
|
|
8
8
|
import { computed } from "vue";
|
|
9
|
+
import { useAppConfig } from "#imports";
|
|
9
10
|
import { useLocale } from "../composables/useLocale";
|
|
10
|
-
import {
|
|
11
|
+
import { cv, merge } from "../utils/style";
|
|
11
12
|
const props = defineProps({
|
|
12
13
|
as: { type: null, required: false },
|
|
13
|
-
max: { type: [Number, Array], required: false },
|
|
14
14
|
size: { type: null, required: false },
|
|
15
|
+
color: { type: null, required: false },
|
|
15
16
|
orientation: { type: null, required: false, default: "horizontal" },
|
|
17
|
+
animation: { type: null, required: false },
|
|
18
|
+
max: { type: [Number, Array], required: false },
|
|
16
19
|
status: { type: Boolean, required: false },
|
|
17
|
-
inverted: { type: Boolean, required: false },
|
|
18
|
-
class: { type: null, required: false },
|
|
20
|
+
inverted: { type: Boolean, required: false, default: false },
|
|
19
21
|
ui: { type: null, required: false },
|
|
22
|
+
class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
|
|
20
23
|
getValueLabel: { type: Function, required: false },
|
|
24
|
+
getValueText: { type: Function, required: false },
|
|
21
25
|
modelValue: { type: [Number, null], required: false, default: null }
|
|
22
26
|
});
|
|
23
27
|
const emit = defineEmits(["update:modelValue", "update:max"]);
|
|
24
28
|
const slots = defineSlots();
|
|
25
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, "getValueLabel", "modelValue"), emit);
|
|
26
|
-
const isIndeterminate = computed(() => rootProps.value.modelValue === null
|
|
29
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "getValueLabel", "getValueText", "modelValue"), emit);
|
|
30
|
+
const isIndeterminate = computed(() => rootProps.value.modelValue === null);
|
|
27
31
|
const hasSteps = computed(() => Array.isArray(props.max));
|
|
28
|
-
const
|
|
32
|
+
const realMax = computed(() => {
|
|
29
33
|
if (isIndeterminate.value || !props.max)
|
|
30
34
|
return;
|
|
31
35
|
if (Array.isArray(props.max))
|
|
@@ -37,14 +41,12 @@ const percent = computed(() => {
|
|
|
37
41
|
return;
|
|
38
42
|
if (rootProps.value.modelValue < 0)
|
|
39
43
|
return 0;
|
|
40
|
-
const
|
|
41
|
-
if (rootProps.value.modelValue >
|
|
44
|
+
const max = realMax.value ?? 100;
|
|
45
|
+
if (rootProps.value.modelValue > max)
|
|
42
46
|
return 100;
|
|
43
|
-
return Math.round(rootProps.value.modelValue /
|
|
47
|
+
return Math.round(rootProps.value.modelValue / max * 100);
|
|
44
48
|
});
|
|
45
49
|
const { dir } = useLocale();
|
|
46
|
-
const { generateStyle } = useTheme();
|
|
47
|
-
const style = computed(() => generateStyle("progress", props));
|
|
48
50
|
const indicatorStyle = computed(() => {
|
|
49
51
|
if (percent.value === void 0)
|
|
50
52
|
return;
|
|
@@ -55,9 +57,8 @@ const indicatorStyle = computed(() => {
|
|
|
55
57
|
return { transform: `translateX(${props.inverted ? "" : "-"}${100 - percent.value}%)` };
|
|
56
58
|
});
|
|
57
59
|
const statusStyle = computed(() => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
60
|
+
const value = `${Math.max(percent.value ?? 0, 0)}%`;
|
|
61
|
+
return props.orientation === "vertical" ? { height: value } : { width: value };
|
|
61
62
|
});
|
|
62
63
|
function isActive(index) {
|
|
63
64
|
return index === Number(props.modelValue);
|
|
@@ -66,7 +67,7 @@ function isFirst(index) {
|
|
|
66
67
|
return index === 0;
|
|
67
68
|
}
|
|
68
69
|
function isLast(index) {
|
|
69
|
-
return index ===
|
|
70
|
+
return index === realMax.value;
|
|
70
71
|
}
|
|
71
72
|
function stepVariant(index) {
|
|
72
73
|
index = Number(index);
|
|
@@ -78,11 +79,16 @@ function stepVariant(index) {
|
|
|
78
79
|
return "last";
|
|
79
80
|
return "other";
|
|
80
81
|
}
|
|
82
|
+
const appConfig = useAppConfig();
|
|
83
|
+
const ui = computed(() => {
|
|
84
|
+
const styler = cv(merge(theme, appConfig.ui.progress));
|
|
85
|
+
return styler(props);
|
|
86
|
+
});
|
|
81
87
|
</script>
|
|
82
88
|
|
|
83
89
|
<template>
|
|
84
|
-
<Primitive :as="props.as" :class="
|
|
85
|
-
<div v-if="!isIndeterminate && (props.status || slots.status)" :class="
|
|
90
|
+
<Primitive :as="props.as" :class="ui.root({ class: [props.ui?.root, props.class] })" :data-orientation="orientation" data-part="root">
|
|
91
|
+
<div v-if="!isIndeterminate && (props.status || !!slots.status)" :class="ui.status({ class: props.ui?.status })" data-part="status" :style="statusStyle">
|
|
86
92
|
<slot name="status" :percent="percent">
|
|
87
93
|
{{ percent }}%
|
|
88
94
|
</slot>
|
|
@@ -90,17 +96,16 @@ function stepVariant(index) {
|
|
|
90
96
|
|
|
91
97
|
<ProgressRoot
|
|
92
98
|
v-bind="rootProps"
|
|
93
|
-
:
|
|
94
|
-
:
|
|
95
|
-
|
|
96
|
-
data-part="root"
|
|
99
|
+
:max="realMax"
|
|
100
|
+
:class="ui.base({ class: props.ui?.base })"
|
|
101
|
+
data-part="base"
|
|
97
102
|
style="transform: translateZ(0)"
|
|
98
103
|
>
|
|
99
|
-
<ProgressIndicator :class="
|
|
104
|
+
<ProgressIndicator :class="ui.indicator({ class: props.ui?.indicator })" data-part="indicator" :style="indicatorStyle" />
|
|
100
105
|
</ProgressRoot>
|
|
101
106
|
|
|
102
|
-
<div v-if="hasSteps" :class="
|
|
103
|
-
<div v-for="(step, index) in props.max" :key="index" :class="
|
|
107
|
+
<div v-if="hasSteps" :class="ui.steps({ class: props.ui?.steps })" data-part="steps">
|
|
108
|
+
<div v-for="(step, index) in props.max" :key="index" :class="ui.step({ class: props.ui?.step, step: stepVariant(index) })" data-part="step">
|
|
104
109
|
<slot :name="`step-${index}`" :step="step">
|
|
105
110
|
{{ step }}
|
|
106
111
|
</slot>
|
|
@@ -1,42 +1,49 @@
|
|
|
1
1
|
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
2
|
import type { PrimitiveProps, ProgressRootEmits, ProgressRootProps } from 'reka-ui';
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
status?: (props: {
|
|
9
|
-
percent?: number;
|
|
10
|
-
}) => any;
|
|
11
|
-
} & {
|
|
12
|
-
[key: `step-${number}`]: (props: {
|
|
13
|
-
step: string | number;
|
|
14
|
-
}) => any;
|
|
15
|
-
};
|
|
16
|
-
type ProgressVariants = VariantProps<typeof progress>;
|
|
17
|
-
export interface ProgressProps extends ComponentAttrs<typeof progress>, Pick<ProgressRootProps, 'getValueLabel' | 'modelValue'> {
|
|
3
|
+
import theme from '#build/ui/progress';
|
|
4
|
+
import type { ComponentBaseProps, ComponentUIProps } from '../types';
|
|
5
|
+
import type { StaticSlot } from '../types/utils';
|
|
6
|
+
type ThemeVariants = VariantProps<typeof theme>;
|
|
7
|
+
export interface ProgressProps extends ComponentBaseProps, Pick<ProgressRootProps, 'getValueLabel' | 'getValueText' | 'modelValue'> {
|
|
18
8
|
/**
|
|
19
9
|
* The element or component this component should render as.
|
|
20
10
|
* @default "div"
|
|
21
11
|
*/
|
|
22
12
|
as?: PrimitiveProps['as'];
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
*/
|
|
28
|
-
size?: ProgressVariants['size'];
|
|
13
|
+
/** @default "md" */
|
|
14
|
+
size?: ThemeVariants['size'];
|
|
15
|
+
/** @default "primary" */
|
|
16
|
+
color?: ThemeVariants['color'];
|
|
29
17
|
/**
|
|
30
18
|
* The orientation of the progress bar.
|
|
31
19
|
* @default "horizontal"
|
|
32
20
|
*/
|
|
33
|
-
orientation?:
|
|
21
|
+
orientation?: ThemeVariants['orientation'];
|
|
22
|
+
/**
|
|
23
|
+
* The animation of the progress bar.
|
|
24
|
+
* @default "carousel"
|
|
25
|
+
*/
|
|
26
|
+
animation?: ThemeVariants['animation'];
|
|
27
|
+
/** The maximum progress value. */
|
|
28
|
+
max?: number | Array<any>;
|
|
34
29
|
/** Display the current progress value. */
|
|
35
30
|
status?: boolean;
|
|
36
31
|
/** Whether the progress is visually inverted. */
|
|
37
32
|
inverted?: boolean;
|
|
33
|
+
ui?: ComponentUIProps<typeof theme>;
|
|
34
|
+
}
|
|
35
|
+
export interface ProgressEmits extends ProgressRootEmits {
|
|
38
36
|
}
|
|
39
|
-
|
|
37
|
+
export type ProgressSlots = {
|
|
38
|
+
status: StaticSlot<{
|
|
39
|
+
percent?: number;
|
|
40
|
+
}>;
|
|
41
|
+
} & {
|
|
42
|
+
[key: `step-${number}`]: StaticSlot<{
|
|
43
|
+
step: string | number;
|
|
44
|
+
}>;
|
|
45
|
+
};
|
|
46
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ProgressProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
40
47
|
"update:modelValue": (value: string[] | undefined) => any;
|
|
41
48
|
"update:max": (value: number) => any;
|
|
42
49
|
}, string, import("vue").PublicProps, Readonly<ProgressProps> & Readonly<{
|
|
@@ -44,8 +51,10 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ProgressPr
|
|
|
44
51
|
"onUpdate:max"?: ((value: number) => any) | undefined;
|
|
45
52
|
}>, {
|
|
46
53
|
orientation: "horizontal" | "vertical";
|
|
54
|
+
inverted: boolean;
|
|
47
55
|
modelValue: number | null;
|
|
48
56
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ProgressSlots>;
|
|
57
|
+
declare const _default: typeof __VLS_export;
|
|
49
58
|
export default _default;
|
|
50
59
|
type __VLS_WithSlots<T, S> = T & {
|
|
51
60
|
new (): {
|