@byyuurin/ui 0.0.10 → 0.1.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 +48 -72
- package/dist/runtime/components/Accordion.vue.d.ts +74 -0
- package/dist/runtime/components/Alert.vue +65 -83
- package/dist/runtime/components/Alert.vue.d.ts +71 -0
- package/dist/runtime/components/App.vue +28 -42
- package/dist/runtime/components/App.vue.d.ts +26 -0
- package/dist/runtime/components/Avatar.vue +82 -58
- package/dist/runtime/components/Avatar.vue.d.ts +39 -0
- package/dist/runtime/components/AvatarGroup.vue +43 -70
- package/dist/runtime/components/AvatarGroup.vue.d.ts +30 -0
- package/dist/runtime/components/Badge.vue +70 -64
- package/dist/runtime/components/Badge.vue.d.ts +45 -0
- package/dist/runtime/components/Breadcrumb.vue +56 -76
- package/dist/runtime/components/Breadcrumb.vue.d.ts +79 -0
- package/dist/runtime/components/Button.vue +150 -78
- package/dist/runtime/components/Button.vue.d.ts +45 -0
- package/dist/runtime/components/Calendar.vue +99 -125
- package/dist/runtime/components/Calendar.vue.d.ts +102 -0
- package/dist/runtime/components/Card.vue +33 -46
- package/dist/runtime/components/Card.vue.d.ts +34 -0
- package/dist/runtime/components/Carousel.vue +164 -237
- package/dist/runtime/components/Carousel.vue.d.ts +125 -0
- package/dist/runtime/components/Checkbox.vue +86 -88
- package/dist/runtime/components/Checkbox.vue.d.ts +63 -0
- package/dist/runtime/components/Chip.vue +44 -58
- package/dist/runtime/components/Chip.vue.d.ts +48 -0
- package/dist/runtime/components/Collapsible.vue +29 -33
- package/dist/runtime/components/Collapsible.vue.d.ts +34 -0
- package/dist/runtime/components/Drawer.vue +110 -150
- package/dist/runtime/components/Drawer.vue.d.ts +103 -0
- package/dist/runtime/components/DropdownMenu.vue +49 -120
- package/dist/runtime/components/DropdownMenu.vue.d.ts +140 -0
- package/dist/runtime/components/DropdownMenuContent.vue +177 -143
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +51 -0
- package/dist/runtime/components/FieldGroup.vue +33 -0
- package/dist/runtime/components/FieldGroup.vue.d.ts +33 -0
- package/dist/runtime/components/Form.vue +245 -275
- package/dist/runtime/components/Form.vue.d.ts +103 -0
- 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 +125 -156
- package/dist/runtime/components/Input.vue.d.ts +76 -0
- package/dist/runtime/components/InputNumber.vue +103 -130
- package/dist/runtime/components/InputNumber.vue.d.ts +191 -0
- package/dist/runtime/components/Kbd.vue +24 -39
- package/dist/runtime/components/Kbd.vue.d.ts +34 -0
- package/dist/runtime/components/Link.vue +105 -337
- package/dist/runtime/components/Link.vue.d.ts +95 -0
- package/dist/runtime/components/LinkBase.vue +31 -71
- package/dist/runtime/components/LinkBase.vue.d.ts +33 -0
- package/dist/runtime/components/Modal.vue +82 -103
- package/dist/runtime/components/Modal.vue.d.ts +96 -0
- package/dist/runtime/components/NavigationMenu.vue +336 -0
- package/dist/runtime/components/NavigationMenu.vue.d.ts +181 -0
- package/dist/runtime/components/OverlayProvider.vue +12 -16
- package/dist/runtime/components/OverlayProvider.vue.d.ts +3 -0
- package/dist/runtime/components/Pagination.vue +65 -139
- package/dist/runtime/components/Pagination.vue.d.ts +116 -0
- package/dist/runtime/components/PinInput.vue +78 -73
- package/dist/runtime/components/PinInput.vue.d.ts +54 -0
- package/dist/runtime/components/Popover.vue +60 -75
- package/dist/runtime/components/Popover.vue.d.ts +70 -0
- package/dist/runtime/components/Progress.vue +79 -126
- package/dist/runtime/components/Progress.vue.d.ts +63 -0
- package/dist/runtime/components/RadioGroup.vue +109 -140
- package/dist/runtime/components/RadioGroup.vue.d.ts +96 -0
- package/dist/runtime/components/ScrollArea.vue +50 -48
- package/dist/runtime/components/ScrollArea.vue.d.ts +21 -0
- package/dist/runtime/components/Select.vue +221 -221
- package/dist/runtime/components/Select.vue.d.ts +260 -0
- package/dist/runtime/components/Separator.vue +55 -47
- package/dist/runtime/components/Separator.vue.d.ts +48 -0
- package/dist/runtime/components/Skeleton.vue +25 -22
- package/dist/runtime/components/Skeleton.vue.d.ts +19 -0
- package/dist/runtime/components/Slider.vue +73 -77
- package/dist/runtime/components/Slider.vue.d.ts +52 -0
- package/dist/runtime/components/Switch.vue +66 -77
- package/dist/runtime/components/Switch.vue.d.ts +58 -0
- package/dist/runtime/components/Table.vue +357 -215
- package/dist/runtime/components/Table.vue.d.ts +234 -0
- package/dist/runtime/components/Tabs.vue +90 -88
- package/dist/runtime/components/Tabs.vue.d.ts +97 -0
- package/dist/runtime/components/Textarea.vue +147 -146
- package/dist/runtime/components/Textarea.vue.d.ts +76 -0
- package/dist/runtime/components/Toast.vue +108 -90
- package/dist/runtime/components/Toast.vue.d.ts +152 -0
- package/dist/runtime/components/ToastProvider.vue +82 -109
- package/dist/runtime/components/ToastProvider.vue.d.ts +51 -0
- package/dist/runtime/components/Tooltip.vue +54 -53
- package/dist/runtime/components/Tooltip.vue.d.ts +53 -0
- 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 +51 -8
- package/dist/runtime/types/index.js +45 -2
- 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 +38 -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 +5 -6
- 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.DSyJHSTk.mjs +3787 -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 -253
- 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 +156 -87
- package/vue-plugin.d.ts +5 -0
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -13
- package/dist/module.mjs.map +0 -1
- package/dist/runtime/app/injections.d.ts +0 -9307
- package/dist/runtime/app/injections.js +0 -61
- package/dist/runtime/components/ButtonGroup.vue +0 -46
- package/dist/runtime/components/FormItem.vue +0 -129
- 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 -56
- package/dist/runtime/theme/accordion.js +0 -28
- package/dist/runtime/theme/alert.d.ts +0 -125
- 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 -52
- package/dist/runtime/theme/avatar-group.js +0 -32
- package/dist/runtime/theme/avatar.d.ts +0 -56
- package/dist/runtime/theme/avatar.js +0 -34
- package/dist/runtime/theme/badge.d.ts +0 -82
- package/dist/runtime/theme/badge.js +0 -92
- package/dist/runtime/theme/breadcrumb.d.ts +0 -67
- package/dist/runtime/theme/breadcrumb.js +0 -44
- package/dist/runtime/theme/button-group.d.ts +0 -66
- package/dist/runtime/theme/button-group.js +0 -42
- package/dist/runtime/theme/button.d.ts +0 -190
- package/dist/runtime/theme/button.js +0 -164
- package/dist/runtime/theme/calendar.d.ts +0 -56
- package/dist/runtime/theme/calendar.js +0 -69
- package/dist/runtime/theme/card.d.ts +0 -62
- package/dist/runtime/theme/card.js +0 -37
- package/dist/runtime/theme/carousel.d.ts +0 -113
- package/dist/runtime/theme/carousel.js +0 -43
- package/dist/runtime/theme/checkbox.d.ts +0 -88
- package/dist/runtime/theme/checkbox.js +0 -54
- package/dist/runtime/theme/chip.d.ts +0 -67
- package/dist/runtime/theme/chip.js +0 -66
- package/dist/runtime/theme/collapsible.d.ts +0 -38
- package/dist/runtime/theme/collapsible.js +0 -10
- package/dist/runtime/theme/drawer.d.ts +0 -148
- package/dist/runtime/theme/drawer.js +0 -113
- package/dist/runtime/theme/dropdown-menu.d.ts +0 -71
- package/dist/runtime/theme/dropdown-menu.js +0 -83
- package/dist/runtime/theme/form-item.d.ts +0 -76
- package/dist/runtime/theme/form-item.js +0 -34
- package/dist/runtime/theme/form.d.ts +0 -8
- 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 -121
- package/dist/runtime/theme/input-number.js +0 -95
- package/dist/runtime/theme/input.d.ts +0 -178
- package/dist/runtime/theme/input.js +0 -151
- package/dist/runtime/theme/kbd.d.ts +0 -39
- package/dist/runtime/theme/kbd.js +0 -26
- package/dist/runtime/theme/link.d.ts +0 -44
- package/dist/runtime/theme/link.js +0 -26
- package/dist/runtime/theme/modal.d.ts +0 -48
- package/dist/runtime/theme/modal.js +0 -55
- package/dist/runtime/theme/pagination.d.ts +0 -80
- package/dist/runtime/theme/pagination.js +0 -17
- package/dist/runtime/theme/pinInput.d.ts +0 -100
- package/dist/runtime/theme/pinInput.js +0 -111
- package/dist/runtime/theme/popover.d.ts +0 -38
- package/dist/runtime/theme/popover.js +0 -13
- package/dist/runtime/theme/progress.d.ts +0 -186
- package/dist/runtime/theme/progress.js +0 -95
- package/dist/runtime/theme/radio-group.d.ts +0 -110
- package/dist/runtime/theme/radio-group.js +0 -61
- package/dist/runtime/theme/scroll-area.d.ts +0 -73
- package/dist/runtime/theme/scroll-area.js +0 -33
- package/dist/runtime/theme/select.d.ts +0 -192
- package/dist/runtime/theme/select.js +0 -173
- package/dist/runtime/theme/separator.d.ts +0 -80
- package/dist/runtime/theme/separator.js +0 -53
- package/dist/runtime/theme/skeleton.d.ts +0 -8
- package/dist/runtime/theme/skeleton.js +0 -7
- package/dist/runtime/theme/slider.d.ts +0 -76
- package/dist/runtime/theme/slider.js +0 -52
- package/dist/runtime/theme/switch.d.ts +0 -122
- package/dist/runtime/theme/switch.js +0 -78
- package/dist/runtime/theme/table.d.ts +0 -92
- package/dist/runtime/theme/table.js +0 -36
- package/dist/runtime/theme/tabs.d.ts +0 -135
- package/dist/runtime/theme/tabs.js +0 -146
- package/dist/runtime/theme/textarea.d.ts +0 -96
- package/dist/runtime/theme/textarea.js +0 -116
- package/dist/runtime/theme/toast-provider.d.ts +0 -122
- package/dist/runtime/theme/toast-provider.js +0 -97
- package/dist/runtime/theme/toast.d.ts +0 -89
- package/dist/runtime/theme/toast.js +0 -35
- package/dist/runtime/theme/tooltip.d.ts +0 -44
- 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.3e7fad19.mjs +0 -5
- package/dist/shared/ui.3e7fad19.mjs.map +0 -1
- package/dist/types.d.ts +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,93 +1,78 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import type { popover } from '../theme'
|
|
4
|
-
import type { ComponentAttrs, EmitsToProps } from '../types'
|
|
5
|
-
|
|
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'> & Partial<EmitsToProps<PopoverContentEmits>>
|
|
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
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/popover";
|
|
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 {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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 { useAppConfig } from "#imports";
|
|
12
|
+
import { usePortal } from "../composables/usePortal";
|
|
13
|
+
import { cv, merge } from "../utils/style";
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
mode: { type: null, required: false, default: "click" },
|
|
16
|
+
content: { type: Object, required: false },
|
|
17
|
+
arrow: { type: [Boolean, Object], required: false },
|
|
18
|
+
portal: { type: [Boolean, String], required: false, skipCheck: true, default: true },
|
|
19
|
+
reference: { type: null, required: false },
|
|
20
|
+
dismissible: { type: Boolean, required: false, default: true },
|
|
21
|
+
ui: { type: null, required: false },
|
|
22
|
+
class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
|
|
23
|
+
defaultOpen: { type: Boolean, required: false },
|
|
24
|
+
open: { type: Boolean, required: false },
|
|
25
|
+
modal: { type: Boolean, required: false },
|
|
26
|
+
openDelay: { type: Number, required: false, default: 0 },
|
|
27
|
+
closeDelay: { type: Number, required: false, default: 0 }
|
|
28
|
+
});
|
|
29
|
+
const emit = defineEmits(["close-prevent", "update:open"]);
|
|
30
|
+
const slots = defineSlots();
|
|
31
|
+
const pick = props.mode === "hover" ? reactivePick(props, "defaultOpen", "open", "openDelay", "closeDelay") : reactivePick(props, "defaultOpen", "open", "modal");
|
|
32
|
+
const rootProps = useForwardPropsEmits(pick, emit);
|
|
33
|
+
const portalProps = usePortal(toRef(() => props.portal));
|
|
34
|
+
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8 }));
|
|
57
35
|
const contentEvents = computed(() => {
|
|
58
36
|
if (props.dismissible)
|
|
59
|
-
return {}
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const Component = computed(() => props.mode ===
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
const
|
|
37
|
+
return {};
|
|
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
|
+
}, {});
|
|
46
|
+
});
|
|
47
|
+
const arrowProps = toRef(() => props.arrow);
|
|
48
|
+
const Component = computed(() => props.mode === "hover" ? HoverCard : Popover);
|
|
49
|
+
const appConfig = useAppConfig();
|
|
50
|
+
const ui = computed(() => {
|
|
51
|
+
const styler = cv(merge(theme, appConfig.ui.popover));
|
|
52
|
+
return styler(props);
|
|
53
|
+
});
|
|
74
54
|
</script>
|
|
75
55
|
|
|
76
56
|
<template>
|
|
77
|
-
<Component.Root v-slot="{ open }" v-bind="rootProps">
|
|
78
|
-
<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">
|
|
79
59
|
<slot :open="open"></slot>
|
|
80
60
|
</Component.Trigger>
|
|
81
61
|
|
|
82
|
-
<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">
|
|
83
67
|
<Component.Content
|
|
84
68
|
v-bind="contentProps"
|
|
85
|
-
:class="
|
|
69
|
+
:class="ui.content({ class: [props.ui?.content, !slots.default && props.class] })"
|
|
70
|
+
data-part="content"
|
|
86
71
|
v-on="contentEvents"
|
|
87
72
|
>
|
|
88
|
-
<slot name="content"></slot>
|
|
73
|
+
<slot name="content" v-bind="close ? { close } : {}"></slot>
|
|
89
74
|
|
|
90
|
-
<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" />
|
|
91
76
|
</Component.Content>
|
|
92
77
|
</Component.Portal>
|
|
93
78
|
</Component.Root>
|
|
@@ -0,0 +1,70 @@
|
|
|
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'> {
|
|
7
|
+
/**
|
|
8
|
+
* The display mode of the popover.
|
|
9
|
+
* @default "click"
|
|
10
|
+
*/
|
|
11
|
+
mode?: M;
|
|
12
|
+
/**
|
|
13
|
+
* The content of the popover.
|
|
14
|
+
* @default { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
|
|
15
|
+
*/
|
|
16
|
+
content?: Omit<PopoverContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<PopoverContentEmits>>;
|
|
17
|
+
/**
|
|
18
|
+
* Display an arrow alongside the popover.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
arrow?: boolean | Omit<PopoverArrowProps, 'as' | 'asChild'>;
|
|
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'];
|
|
33
|
+
/**
|
|
34
|
+
* When `false`, the popover will not close when clicking outside or pressing escape.
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
dismissible?: boolean;
|
|
38
|
+
ui?: ComponentUIProps<typeof theme>;
|
|
39
|
+
}
|
|
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>;
|
|
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,141 +1,94 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import type { PrimitiveProps, ProgressRootEmits, ProgressRootProps } from 'reka-ui'
|
|
4
|
-
import type { progress } from '../theme'
|
|
5
|
-
import type { ComponentAttrs } from '../types'
|
|
6
|
-
|
|
7
|
-
export interface ProgressEmits extends ProgressRootEmits {}
|
|
8
|
-
|
|
9
|
-
export type ProgressSlots = {
|
|
10
|
-
status?: (props: { percent?: number }) => any
|
|
11
|
-
} & {
|
|
12
|
-
[key: `step-${number}`]: (props: { step: string | number }) => any
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
type ProgressVariants = VariantProps<typeof progress>
|
|
16
|
-
|
|
17
|
-
export interface ProgressProps extends ComponentAttrs<typeof progress>, Pick<ProgressRootProps, 'getValueLabel' | 'modelValue'> {
|
|
18
|
-
/**
|
|
19
|
-
* The element or component this component should render as.
|
|
20
|
-
* @default "div"
|
|
21
|
-
*/
|
|
22
|
-
as?: PrimitiveProps['as']
|
|
23
|
-
/** The maximum progress value. */
|
|
24
|
-
max?: number | string[]
|
|
25
|
-
/**
|
|
26
|
-
* @default "md"
|
|
27
|
-
*/
|
|
28
|
-
size?: ProgressVariants['size']
|
|
29
|
-
/**
|
|
30
|
-
* The orientation of the progress bar.
|
|
31
|
-
* @default "horizontal"
|
|
32
|
-
*/
|
|
33
|
-
orientation?: ProgressVariants['orientation']
|
|
34
|
-
/** Display the current progress value. */
|
|
35
|
-
status?: boolean
|
|
36
|
-
/** Whether the progress is visually inverted. */
|
|
37
|
-
inverted?: boolean
|
|
38
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/progress";
|
|
39
3
|
</script>
|
|
40
4
|
|
|
41
|
-
<script setup
|
|
42
|
-
import { reactivePick } from
|
|
43
|
-
import { Primitive, ProgressIndicator, ProgressRoot, useForwardPropsEmits } from
|
|
44
|
-
import { computed } from
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
|
|
48
|
-
const props =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { reactivePick } from "@vueuse/core";
|
|
7
|
+
import { Primitive, ProgressIndicator, ProgressRoot, useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { computed } from "vue";
|
|
9
|
+
import { useAppConfig } from "#imports";
|
|
10
|
+
import { useLocale } from "../composables/useLocale";
|
|
11
|
+
import { cv, merge } from "../utils/style";
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
as: { type: null, required: false },
|
|
14
|
+
size: { type: null, required: false },
|
|
15
|
+
color: { type: null, required: false },
|
|
16
|
+
orientation: { type: null, required: false, default: "horizontal" },
|
|
17
|
+
animation: { type: null, required: false },
|
|
18
|
+
max: { type: [Number, Array], required: false },
|
|
19
|
+
status: { type: Boolean, required: false },
|
|
20
|
+
inverted: { type: Boolean, required: false, default: false },
|
|
21
|
+
ui: { type: null, required: false },
|
|
22
|
+
class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
|
|
23
|
+
getValueLabel: { type: Function, required: false },
|
|
24
|
+
getValueText: { type: Function, required: false },
|
|
25
|
+
modelValue: { type: [Number, null], required: false, default: null }
|
|
26
|
+
});
|
|
27
|
+
const emit = defineEmits(["update:modelValue", "update:max"]);
|
|
28
|
+
const slots = defineSlots();
|
|
29
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "getValueLabel", "getValueText", "modelValue"), emit);
|
|
30
|
+
const isIndeterminate = computed(() => rootProps.value.modelValue === null);
|
|
31
|
+
const hasSteps = computed(() => Array.isArray(props.max));
|
|
32
|
+
const realMax = computed(() => {
|
|
61
33
|
if (isIndeterminate.value || !props.max)
|
|
62
|
-
return
|
|
63
|
-
|
|
34
|
+
return;
|
|
64
35
|
if (Array.isArray(props.max))
|
|
65
|
-
return props.max.length - 1
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
})
|
|
69
|
-
|
|
36
|
+
return props.max.length - 1;
|
|
37
|
+
return Number(props.max);
|
|
38
|
+
});
|
|
70
39
|
const percent = computed(() => {
|
|
71
40
|
if (isIndeterminate.value)
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return Math.round((rootProps.value.modelValue! / _max) * 100)
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
const { dir } = useLocale()
|
|
86
|
-
const { generateStyle } = useTheme()
|
|
87
|
-
const style = computed(() => generateStyle('progress', props))
|
|
88
|
-
|
|
41
|
+
return;
|
|
42
|
+
if (rootProps.value.modelValue < 0)
|
|
43
|
+
return 0;
|
|
44
|
+
const max = realMax.value ?? 100;
|
|
45
|
+
if (rootProps.value.modelValue > max)
|
|
46
|
+
return 100;
|
|
47
|
+
return Math.round(rootProps.value.modelValue / max * 100);
|
|
48
|
+
});
|
|
49
|
+
const { dir } = useLocale();
|
|
89
50
|
const indicatorStyle = computed(() => {
|
|
90
|
-
if (percent.value ===
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return { transform: `translateX(${props.inverted ? '' : '-'}${100 - percent.value}%)` }
|
|
100
|
-
})
|
|
101
|
-
|
|
51
|
+
if (percent.value === void 0)
|
|
52
|
+
return;
|
|
53
|
+
if (props.orientation === "vertical")
|
|
54
|
+
return { transform: `translateY(${props.inverted ? "" : "-"}${100 - percent.value}%)` };
|
|
55
|
+
if (dir.value === "rtl")
|
|
56
|
+
return { transform: `translateX(${props.inverted ? "-" : ""}${100 - percent.value}%)` };
|
|
57
|
+
return { transform: `translateX(${props.inverted ? "" : "-"}${100 - percent.value}%)` };
|
|
58
|
+
});
|
|
102
59
|
const statusStyle = computed(() => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
function isActive(index: number) {
|
|
109
|
-
return index === Number(props.modelValue)
|
|
60
|
+
const value = `${Math.max(percent.value ?? 0, 0)}%`;
|
|
61
|
+
return props.orientation === "vertical" ? { height: value } : { width: value };
|
|
62
|
+
});
|
|
63
|
+
function isActive(index) {
|
|
64
|
+
return index === Number(props.modelValue);
|
|
110
65
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return index === 0
|
|
66
|
+
function isFirst(index) {
|
|
67
|
+
return index === 0;
|
|
114
68
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return index === max.value
|
|
69
|
+
function isLast(index) {
|
|
70
|
+
return index === realMax.value;
|
|
118
71
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
index = Number(index)
|
|
122
|
-
|
|
72
|
+
function stepVariant(index) {
|
|
73
|
+
index = Number(index);
|
|
123
74
|
if (isActive(index) && !isFirst(index))
|
|
124
|
-
return
|
|
125
|
-
|
|
75
|
+
return "active";
|
|
126
76
|
if (isFirst(index) && isActive(index))
|
|
127
|
-
return
|
|
128
|
-
|
|
77
|
+
return "first";
|
|
129
78
|
if (isLast(index) && isActive(index))
|
|
130
|
-
return
|
|
131
|
-
|
|
132
|
-
return 'other'
|
|
79
|
+
return "last";
|
|
80
|
+
return "other";
|
|
133
81
|
}
|
|
82
|
+
const appConfig = useAppConfig();
|
|
83
|
+
const ui = computed(() => {
|
|
84
|
+
const styler = cv(merge(theme, appConfig.ui.progress));
|
|
85
|
+
return styler(props);
|
|
86
|
+
});
|
|
134
87
|
</script>
|
|
135
88
|
|
|
136
89
|
<template>
|
|
137
|
-
<Primitive :as="props.as" :class="
|
|
138
|
-
<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">
|
|
139
92
|
<slot name="status" :percent="percent">
|
|
140
93
|
{{ percent }}%
|
|
141
94
|
</slot>
|
|
@@ -143,16 +96,16 @@ function stepVariant(index: number | string) {
|
|
|
143
96
|
|
|
144
97
|
<ProgressRoot
|
|
145
98
|
v-bind="rootProps"
|
|
146
|
-
:
|
|
147
|
-
:
|
|
148
|
-
|
|
99
|
+
:max="realMax"
|
|
100
|
+
:class="ui.base({ class: props.ui?.base })"
|
|
101
|
+
data-part="base"
|
|
149
102
|
style="transform: translateZ(0)"
|
|
150
103
|
>
|
|
151
|
-
<ProgressIndicator :class="
|
|
104
|
+
<ProgressIndicator :class="ui.indicator({ class: props.ui?.indicator })" data-part="indicator" :style="indicatorStyle" />
|
|
152
105
|
</ProgressRoot>
|
|
153
106
|
|
|
154
|
-
<div v-if="hasSteps" :class="
|
|
155
|
-
<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">
|
|
156
109
|
<slot :name="`step-${index}`" :step="step">
|
|
157
110
|
{{ step }}
|
|
158
111
|
</slot>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { PrimitiveProps, ProgressRootEmits, ProgressRootProps } from 'reka-ui';
|
|
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'> {
|
|
8
|
+
/**
|
|
9
|
+
* The element or component this component should render as.
|
|
10
|
+
* @default "div"
|
|
11
|
+
*/
|
|
12
|
+
as?: PrimitiveProps['as'];
|
|
13
|
+
/** @default "md" */
|
|
14
|
+
size?: ThemeVariants['size'];
|
|
15
|
+
/** @default "primary" */
|
|
16
|
+
color?: ThemeVariants['color'];
|
|
17
|
+
/**
|
|
18
|
+
* The orientation of the progress bar.
|
|
19
|
+
* @default "horizontal"
|
|
20
|
+
*/
|
|
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>;
|
|
29
|
+
/** Display the current progress value. */
|
|
30
|
+
status?: boolean;
|
|
31
|
+
/** Whether the progress is visually inverted. */
|
|
32
|
+
inverted?: boolean;
|
|
33
|
+
ui?: ComponentUIProps<typeof theme>;
|
|
34
|
+
}
|
|
35
|
+
export interface ProgressEmits extends ProgressRootEmits {
|
|
36
|
+
}
|
|
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, {
|
|
47
|
+
"update:modelValue": (value: string[] | undefined) => any;
|
|
48
|
+
"update:max": (value: number) => any;
|
|
49
|
+
}, string, import("vue").PublicProps, Readonly<ProgressProps> & Readonly<{
|
|
50
|
+
"onUpdate:modelValue"?: ((value: string[] | undefined) => any) | undefined;
|
|
51
|
+
"onUpdate:max"?: ((value: number) => any) | undefined;
|
|
52
|
+
}>, {
|
|
53
|
+
orientation: "horizontal" | "vertical";
|
|
54
|
+
inverted: boolean;
|
|
55
|
+
modelValue: number | null;
|
|
56
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ProgressSlots>;
|
|
57
|
+
declare const _default: typeof __VLS_export;
|
|
58
|
+
export default _default;
|
|
59
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
60
|
+
new (): {
|
|
61
|
+
$slots: S;
|
|
62
|
+
};
|
|
63
|
+
};
|