@byyuurin/ui 0.1.0 → 0.3.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/LICENSE +20 -20
- package/README.md +5 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Accordion.vue +41 -41
- package/dist/runtime/components/Accordion.vue.d.ts +11 -7
- package/dist/runtime/components/Alert.vue +63 -63
- package/dist/runtime/components/Alert.vue.d.ts +4 -4
- package/dist/runtime/components/App.vue +11 -10
- package/dist/runtime/components/App.vue.d.ts +11 -7
- package/dist/runtime/components/Avatar.vue +29 -29
- package/dist/runtime/components/Avatar.vue.d.ts +4 -3
- package/dist/runtime/components/AvatarGroup.vue +4 -4
- package/dist/runtime/components/AvatarGroup.vue.d.ts +1 -1
- package/dist/runtime/components/Badge.vue +32 -32
- package/dist/runtime/components/Badge.vue.d.ts +2 -2
- package/dist/runtime/components/Breadcrumb.vue +49 -49
- package/dist/runtime/components/Breadcrumb.vue.d.ts +10 -6
- package/dist/runtime/components/Button.vue +52 -51
- package/dist/runtime/components/Button.vue.d.ts +1 -1
- package/dist/runtime/components/Calendar.vue +75 -77
- package/dist/runtime/components/Calendar.vue.d.ts +16 -12
- package/dist/runtime/components/Card.vue +41 -41
- package/dist/runtime/components/Card.vue.d.ts +1 -1
- package/dist/runtime/components/Carousel.vue +85 -66
- package/dist/runtime/components/Carousel.vue.d.ts +14 -10
- package/dist/runtime/components/Checkbox.vue +46 -46
- package/dist/runtime/components/Checkbox.vue.d.ts +4 -3
- package/dist/runtime/components/CheckboxGroup.vue +131 -0
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +93 -0
- package/dist/runtime/components/Chip.vue +15 -15
- package/dist/runtime/components/Chip.vue.d.ts +2 -2
- package/dist/runtime/components/Collapsible.vue +14 -14
- package/dist/runtime/components/Collapsible.vue.d.ts +2 -2
- package/dist/runtime/components/Drawer.vue +76 -76
- package/dist/runtime/components/Drawer.vue.d.ts +6 -6
- package/dist/runtime/components/DropdownMenu.vue +28 -28
- package/dist/runtime/components/DropdownMenu.vue.d.ts +17 -9
- package/dist/runtime/components/DropdownMenuContent.vue +152 -153
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +11 -7
- package/dist/runtime/components/FieldGroup.vue +3 -3
- package/dist/runtime/components/FieldGroup.vue.d.ts +2 -2
- package/dist/runtime/components/Form.vue +9 -9
- package/dist/runtime/components/Form.vue.d.ts +13 -8
- package/dist/runtime/components/FormField.vue +39 -38
- package/dist/runtime/components/FormField.vue.d.ts +7 -2
- package/dist/runtime/components/Icon.vue +2 -2
- package/dist/runtime/components/Icon.vue.d.ts +1 -1
- package/dist/runtime/components/Input.vue +48 -48
- package/dist/runtime/components/Input.vue.d.ts +16 -12
- package/dist/runtime/components/InputNumber.vue +48 -50
- package/dist/runtime/components/InputNumber.vue.d.ts +128 -129
- package/dist/runtime/components/InputTags.vue +156 -0
- package/dist/runtime/components/InputTags.vue.d.ts +90 -0
- package/dist/runtime/components/Kbd.vue +3 -3
- package/dist/runtime/components/Kbd.vue.d.ts +2 -2
- package/dist/runtime/components/Link.vue +26 -25
- package/dist/runtime/components/Link.vue.d.ts +16 -6
- package/dist/runtime/components/LinkBase.vue +3 -3
- package/dist/runtime/components/LinkBase.vue.d.ts +2 -2
- package/dist/runtime/components/Marquee.vue +38 -0
- package/dist/runtime/components/Marquee.vue.d.ts +54 -0
- package/dist/runtime/components/Modal.vue +74 -74
- package/dist/runtime/components/Modal.vue.d.ts +6 -6
- package/dist/runtime/components/NavigationMenu.vue +243 -234
- package/dist/runtime/components/NavigationMenu.vue.d.ts +53 -14
- package/dist/runtime/components/OverlayProvider.vue +9 -9
- package/dist/runtime/components/Pagination.vue +47 -47
- package/dist/runtime/components/Pagination.vue.d.ts +4 -4
- package/dist/runtime/components/PinInput.vue +23 -23
- package/dist/runtime/components/PinInput.vue.d.ts +14 -10
- package/dist/runtime/components/Popover.vue +22 -22
- package/dist/runtime/components/Popover.vue.d.ts +11 -7
- package/dist/runtime/components/Progress.vue +25 -25
- package/dist/runtime/components/Progress.vue.d.ts +2 -2
- package/dist/runtime/components/RadioGroup.vue +50 -50
- package/dist/runtime/components/RadioGroup.vue.d.ts +13 -9
- package/dist/runtime/components/ScrollArea.vue +32 -32
- package/dist/runtime/components/ScrollArea.vue.d.ts +2 -2
- package/dist/runtime/components/Select.vue +299 -148
- package/dist/runtime/components/Select.vue.d.ts +103 -123
- package/dist/runtime/components/Separator.vue +30 -30
- package/dist/runtime/components/Separator.vue.d.ts +2 -2
- package/dist/runtime/components/Skeleton.vue +11 -11
- package/dist/runtime/components/Skeleton.vue.d.ts +2 -2
- package/dist/runtime/components/Slider.vue +25 -25
- package/dist/runtime/components/Slider.vue.d.ts +11 -7
- package/dist/runtime/components/Stepper.vue +116 -0
- package/dist/runtime/components/Stepper.vue.d.ts +83 -0
- package/dist/runtime/components/Switch.vue +30 -30
- package/dist/runtime/components/Switch.vue.d.ts +4 -3
- package/dist/runtime/components/Table.vue +188 -166
- package/dist/runtime/components/Table.vue.d.ts +27 -22
- package/dist/runtime/components/Tabs.vue +74 -74
- package/dist/runtime/components/Tabs.vue.d.ts +12 -8
- package/dist/runtime/components/Textarea.vue +47 -47
- package/dist/runtime/components/Textarea.vue.d.ts +16 -11
- package/dist/runtime/components/Timeline.vue +102 -0
- package/dist/runtime/components/Timeline.vue.d.ts +78 -0
- package/dist/runtime/components/Toast.vue +93 -93
- package/dist/runtime/components/Toast.vue.d.ts +5 -5
- package/dist/runtime/components/ToastProvider.vue +29 -29
- package/dist/runtime/components/ToastProvider.vue.d.ts +3 -3
- package/dist/runtime/components/Tooltip.vue +24 -25
- package/dist/runtime/components/Tooltip.vue.d.ts +2 -2
- package/dist/runtime/components/Tree.vue +241 -0
- package/dist/runtime/components/Tree.vue.d.ts +121 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -0
- package/dist/runtime/composables/defineShortcuts.js +44 -8
- package/dist/runtime/composables/useLocale.d.ts +12 -0
- package/dist/runtime/locale/en.d.ts +6 -0
- package/dist/runtime/locale/en.js +6 -0
- package/dist/runtime/locale/zh_tw.d.ts +6 -0
- package/dist/runtime/locale/zh_tw.js +6 -0
- package/dist/runtime/types/html.d.ts +8 -0
- package/dist/runtime/types/html.js +0 -0
- package/dist/runtime/types/index.d.ts +7 -0
- package/dist/runtime/types/index.js +7 -0
- package/dist/runtime/types/input.d.ts +5 -5
- package/dist/runtime/types/locale.d.ts +6 -0
- package/dist/runtime/types/unocss.d.ts +4 -4
- package/dist/runtime/types/utils.d.ts +9 -6
- package/dist/runtime/utils/index.d.ts +3 -3
- package/dist/runtime/utils/link.d.ts +2 -1
- package/dist/runtime/utils/link.js +40 -29
- package/dist/runtime/vue/components/Icon.vue +2 -2
- package/dist/runtime/vue/components/Icon.vue.d.ts +1 -1
- package/dist/runtime/vue/components/Link.vue +7 -12
- package/dist/runtime/vue/components/Link.vue.d.ts +11 -40
- package/dist/setup.d.mts +1 -1
- package/dist/shared/{ui.CzIlLITK.mjs → ui.9kQouwss.mjs} +5 -3
- package/dist/shared/{ui.DpbffTXs.d.mts → ui.D8Bg1HWt.d.mts} +2 -0
- package/dist/shared/{ui.DSyJHSTk.mjs → ui.DpkP12cX.mjs} +784 -84
- package/dist/unocss.mjs +1 -1
- package/dist/unplugin.d.mts +1 -1
- package/dist/unplugin.mjs +2 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +29 -29
- package/vue-plugin.d.ts +5 -5
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { CheckboxGroupRootEmits, CheckboxGroupRootProps, CheckboxRootProps } from 'reka-ui';
|
|
3
|
+
import theme from '#build/ui/checkbox-group';
|
|
4
|
+
import type { CheckboxProps, ComponentBaseProps, ComponentUIProps } from '../types';
|
|
5
|
+
import type { AcceptableValue, GetItemKeys, GetModelValue, StaticSlot } from '../types/utils';
|
|
6
|
+
type ThemeVariants = VariantProps<typeof theme>;
|
|
7
|
+
export type CheckboxGroupValue = AcceptableValue;
|
|
8
|
+
interface CheckboxGroupItemBase {
|
|
9
|
+
label?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
value?: AcceptableValue;
|
|
13
|
+
class?: ComponentBaseProps['class'];
|
|
14
|
+
ui?: Pick<ComponentUIProps<typeof theme>, 'item'> & Omit<Required<CheckboxProps>['ui'], 'root'>;
|
|
15
|
+
}
|
|
16
|
+
export type CheckboxGroupItem = CheckboxGroupValue | (CheckboxGroupItemBase & {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
});
|
|
19
|
+
export interface CheckboxGroupProps<T extends CheckboxGroupItem[] = CheckboxGroupItem[], VK extends GetItemKeys<T> = 'value'> extends ComponentBaseProps, Pick<CheckboxGroupRootProps, 'disabled' | 'loop' | 'name' | 'required'>, Pick<CheckboxProps, 'color' | 'indicator' | 'icon'> {
|
|
20
|
+
/**
|
|
21
|
+
* The element or component this component should render as.
|
|
22
|
+
* @default "div"
|
|
23
|
+
*/
|
|
24
|
+
as?: CheckboxRootProps['as'];
|
|
25
|
+
legend?: string;
|
|
26
|
+
/**
|
|
27
|
+
* When `items` is an array of objects, select the field to use as the value.
|
|
28
|
+
* @default "value"
|
|
29
|
+
*/
|
|
30
|
+
valueKey?: VK;
|
|
31
|
+
/**
|
|
32
|
+
* When `items` is an array of objects, select the field to use as the label.
|
|
33
|
+
* @default "label"
|
|
34
|
+
*/
|
|
35
|
+
labelKey?: GetItemKeys<T>;
|
|
36
|
+
/**
|
|
37
|
+
* When `items` is an array of objects, select the field to use as the description.
|
|
38
|
+
* @default "description"
|
|
39
|
+
*/
|
|
40
|
+
descriptionKey?: GetItemKeys<T>;
|
|
41
|
+
items?: T;
|
|
42
|
+
/** The controlled value of the CheckboxGroup. Can be bind as `v-model`. */
|
|
43
|
+
modelValue?: GetModelValue<T, VK, true>;
|
|
44
|
+
/** The value of the CheckboxGroup when initially rendered. Use when you do not need to control the state of the CheckboxGroup. */
|
|
45
|
+
defaultValue?: GetModelValue<T, VK, true>;
|
|
46
|
+
/** @default "md" */
|
|
47
|
+
size?: ThemeVariants['size'];
|
|
48
|
+
/** @default "list" */
|
|
49
|
+
variant?: ThemeVariants['variant'];
|
|
50
|
+
/**
|
|
51
|
+
* The orientation the checkbox buttons are laid out.
|
|
52
|
+
* @default "vertical"
|
|
53
|
+
*/
|
|
54
|
+
orientation?: ThemeVariants['orientation'];
|
|
55
|
+
ui?: ComponentUIProps<typeof theme>;
|
|
56
|
+
}
|
|
57
|
+
export type CheckboxGroupEmits<T extends CheckboxGroupItem[] = CheckboxGroupItem[]> = CheckboxGroupRootEmits<T[number]> & {
|
|
58
|
+
change: [event: Event];
|
|
59
|
+
};
|
|
60
|
+
export interface CheckboxGroupSlots<T extends CheckboxGroupItem[] = CheckboxGroupItem[]> {
|
|
61
|
+
legend: StaticSlot;
|
|
62
|
+
label: StaticSlot<{
|
|
63
|
+
item: T[number] & {
|
|
64
|
+
id: string;
|
|
65
|
+
};
|
|
66
|
+
}>;
|
|
67
|
+
description: StaticSlot<{
|
|
68
|
+
item: T[number] & {
|
|
69
|
+
id: string;
|
|
70
|
+
};
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
declare const _default: typeof __VLS_export;
|
|
74
|
+
export default _default;
|
|
75
|
+
declare const __VLS_export: <T extends CheckboxGroupItem[], VK extends GetItemKeys<T> = "value">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
76
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<CheckboxGroupProps<T, VK> & {
|
|
77
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
78
|
+
"onUpdate:modelValue"?: ((value: T[number][]) => any) | undefined;
|
|
79
|
+
}> & (typeof globalThis extends {
|
|
80
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
81
|
+
} ? P : {});
|
|
82
|
+
expose: (exposed: {}) => void;
|
|
83
|
+
attrs: any;
|
|
84
|
+
slots: CheckboxGroupSlots<CheckboxGroupItem[]>;
|
|
85
|
+
emit: ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T[number][]) => void);
|
|
86
|
+
}>) => import("vue").VNode & {
|
|
87
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
88
|
+
};
|
|
89
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
90
|
+
[K in keyof T]: T[K];
|
|
91
|
+
} : {
|
|
92
|
+
[K in keyof T as K]: T[K];
|
|
93
|
+
}) & {};
|
|
@@ -34,19 +34,19 @@ const ui = computed(() => {
|
|
|
34
34
|
</script>
|
|
35
35
|
|
|
36
36
|
<template>
|
|
37
|
-
<Primitive
|
|
38
|
-
:as="props.as"
|
|
39
|
-
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
40
|
-
data-part="root"
|
|
41
|
-
>
|
|
42
|
-
<Slot v-bind="$attrs">
|
|
43
|
-
<slot></slot>
|
|
44
|
-
</Slot>
|
|
45
|
-
|
|
46
|
-
<span v-if="show" :class="ui.base({ class: props.ui?.base })" data-part="base">
|
|
47
|
-
<slot name="content">
|
|
48
|
-
{{ props.text }}
|
|
49
|
-
</slot>
|
|
50
|
-
</span>
|
|
51
|
-
</Primitive>
|
|
37
|
+
<Primitive
|
|
38
|
+
:as="props.as"
|
|
39
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
40
|
+
data-part="root"
|
|
41
|
+
>
|
|
42
|
+
<Slot v-bind="$attrs">
|
|
43
|
+
<slot></slot>
|
|
44
|
+
</Slot>
|
|
45
|
+
|
|
46
|
+
<span v-if="show" :class="ui.base({ class: props.ui?.base })" data-part="base">
|
|
47
|
+
<slot name="content">
|
|
48
|
+
{{ props.text }}
|
|
49
|
+
</slot>
|
|
50
|
+
</span>
|
|
51
|
+
</Primitive>
|
|
52
52
|
</template>
|
|
@@ -32,6 +32,8 @@ export interface ChipSlots {
|
|
|
32
32
|
default: StaticSlot;
|
|
33
33
|
content: StaticSlot;
|
|
34
34
|
}
|
|
35
|
+
declare const _default: typeof __VLS_export;
|
|
36
|
+
export default _default;
|
|
35
37
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ChipProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
38
|
"update:show": (show: boolean) => any;
|
|
37
39
|
}, string, import("vue").PublicProps, Readonly<ChipProps> & Readonly<{
|
|
@@ -39,8 +41,6 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ChipPr
|
|
|
39
41
|
}>, {
|
|
40
42
|
show: boolean;
|
|
41
43
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ChipSlots>;
|
|
42
|
-
declare const _default: typeof __VLS_export;
|
|
43
|
-
export default _default;
|
|
44
44
|
type __VLS_WithSlots<T, S> = T & {
|
|
45
45
|
new (): {
|
|
46
46
|
$slots: S;
|
|
@@ -28,20 +28,20 @@ const ui = computed(() => {
|
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
30
|
<template>
|
|
31
|
-
<CollapsibleRoot
|
|
32
|
-
v-slot="{ open }"
|
|
33
|
-
v-bind="rootProps"
|
|
34
|
-
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
35
|
-
data-part="root"
|
|
36
|
-
>
|
|
37
|
-
<CollapsibleTrigger v-if="!!slots.default" as-child>
|
|
38
|
-
<slot :open="open"></slot>
|
|
39
|
-
</CollapsibleTrigger>
|
|
40
|
-
|
|
41
|
-
<CollapsibleContent :class="ui.content({ class: props.ui?.content })" data-part="content">
|
|
42
|
-
<slot name="content"></slot>
|
|
43
|
-
</CollapsibleContent>
|
|
44
|
-
</CollapsibleRoot>
|
|
31
|
+
<CollapsibleRoot
|
|
32
|
+
v-slot="{ open }"
|
|
33
|
+
v-bind="rootProps"
|
|
34
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
35
|
+
data-part="root"
|
|
36
|
+
>
|
|
37
|
+
<CollapsibleTrigger v-if="!!slots.default" as-child>
|
|
38
|
+
<slot :open="open"></slot>
|
|
39
|
+
</CollapsibleTrigger>
|
|
40
|
+
|
|
41
|
+
<CollapsibleContent :class="ui.content({ class: props.ui?.content })" data-part="content">
|
|
42
|
+
<slot name="content"></slot>
|
|
43
|
+
</CollapsibleContent>
|
|
44
|
+
</CollapsibleRoot>
|
|
45
45
|
</template>
|
|
46
46
|
|
|
47
47
|
<style>
|
|
@@ -18,6 +18,8 @@ export interface CollapsibleSlots {
|
|
|
18
18
|
}>;
|
|
19
19
|
content: StaticSlot;
|
|
20
20
|
}
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
21
23
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CollapsibleProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
22
24
|
"update:open": (value: boolean) => any;
|
|
23
25
|
}, string, import("vue").PublicProps, Readonly<CollapsibleProps> & Readonly<{
|
|
@@ -25,8 +27,6 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Collap
|
|
|
25
27
|
}>, {
|
|
26
28
|
unmountOnHide: boolean;
|
|
27
29
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, CollapsibleSlots>;
|
|
28
|
-
declare const _default: typeof __VLS_export;
|
|
29
|
-
export default _default;
|
|
30
30
|
type __VLS_WithSlots<T, S> = T & {
|
|
31
31
|
new (): {
|
|
32
32
|
$slots: S;
|
|
@@ -58,80 +58,80 @@ const ui = computed(() => {
|
|
|
58
58
|
</script>
|
|
59
59
|
|
|
60
60
|
<template>
|
|
61
|
-
<DialogRoot v-slot="{ open, close }" v-bind="rootProps">
|
|
62
|
-
<DialogTrigger v-if="!!slots.default" as-child :class="props.class">
|
|
63
|
-
<slot :open="open"></slot>
|
|
64
|
-
</DialogTrigger>
|
|
65
|
-
|
|
66
|
-
<DialogPortal v-bind="portalProps">
|
|
67
|
-
<DialogOverlay v-if="props.overlay" :class="ui.overlay({ class: props.ui?.overlay })" data-part="overlay" />
|
|
68
|
-
|
|
69
|
-
<DialogContent
|
|
70
|
-
:class="ui.content({ class: [props.ui?.content, !slots.default && props.class] })"
|
|
71
|
-
v-bind="contentProps"
|
|
72
|
-
:data-direction="props.direction"
|
|
73
|
-
data-part="content"
|
|
74
|
-
@after-enter="emit('after-enter')"
|
|
75
|
-
@after-leave="emit('after-leave')"
|
|
76
|
-
v-on="contentEvents"
|
|
77
|
-
>
|
|
78
|
-
<VisuallyHidden v-if="!!slots.content || !!slots.header || !props.title && !slots.title">
|
|
79
|
-
<DialogTitle />
|
|
80
|
-
</VisuallyHidden>
|
|
81
|
-
|
|
82
|
-
<slot name="content" :close="close">
|
|
83
|
-
<div
|
|
84
|
-
v-if="slots.header || (props.title || !!slots.title) || (props.description || !!slots.description) || (props.close || !!slots.close)"
|
|
85
|
-
:class="ui.header({ class: props.ui?.header })"
|
|
86
|
-
data-part="header"
|
|
87
|
-
>
|
|
88
|
-
<slot name="header" :close="close">
|
|
89
|
-
<DialogTitle
|
|
90
|
-
v-if="props.title || slots.title"
|
|
91
|
-
:class="ui.title({ class: props.ui?.title })"
|
|
92
|
-
data-part="title"
|
|
93
|
-
>
|
|
94
|
-
<slot name="title">
|
|
95
|
-
{{ props.title }}
|
|
96
|
-
</slot>
|
|
97
|
-
</DialogTitle>
|
|
98
|
-
|
|
99
|
-
<DialogClose v-if="props.close || !!slots.close" as-child>
|
|
100
|
-
<slot name="close" :close="close" :ui="ui">
|
|
101
|
-
<Button
|
|
102
|
-
v-if="props.close"
|
|
103
|
-
color="neutral"
|
|
104
|
-
variant="ghost"
|
|
105
|
-
:icon="props.closeIcon || appConfig.ui.icons.close"
|
|
106
|
-
:aria-label="t('modal.close')"
|
|
107
|
-
v-bind="typeof props.close === 'object' ? props.close : {}"
|
|
108
|
-
:class="ui.close({ class: props.ui?.close })"
|
|
109
|
-
data-part="close"
|
|
110
|
-
/>
|
|
111
|
-
</slot>
|
|
112
|
-
</DialogClose>
|
|
113
|
-
|
|
114
|
-
<DialogDescription
|
|
115
|
-
v-if="props.description || !!slots.description"
|
|
116
|
-
:class="ui.description({ class: props.ui?.description })"
|
|
117
|
-
data-part="description"
|
|
118
|
-
>
|
|
119
|
-
<slot name="description">
|
|
120
|
-
{{ props.description }}
|
|
121
|
-
</slot>
|
|
122
|
-
</DialogDescription>
|
|
123
|
-
</slot>
|
|
124
|
-
</div>
|
|
125
|
-
|
|
126
|
-
<div v-if="slots.body" :class="ui.body({ class: props.ui?.body })" data-part="body">
|
|
127
|
-
<slot name="body" :close="close"></slot>
|
|
128
|
-
</div>
|
|
129
|
-
|
|
130
|
-
<div v-if="slots.footer" :class="ui.footer({ class: props.ui?.footer })" data-part="footer">
|
|
131
|
-
<slot name="footer" :close="close"></slot>
|
|
132
|
-
</div>
|
|
133
|
-
</slot>
|
|
134
|
-
</DialogContent>
|
|
135
|
-
</DialogPortal>
|
|
136
|
-
</DialogRoot>
|
|
61
|
+
<DialogRoot v-slot="{ open, close }" v-bind="rootProps">
|
|
62
|
+
<DialogTrigger v-if="!!slots.default" as-child :class="props.class">
|
|
63
|
+
<slot :open="open"></slot>
|
|
64
|
+
</DialogTrigger>
|
|
65
|
+
|
|
66
|
+
<DialogPortal v-bind="portalProps">
|
|
67
|
+
<DialogOverlay v-if="props.overlay" :class="ui.overlay({ class: props.ui?.overlay })" data-part="overlay" />
|
|
68
|
+
|
|
69
|
+
<DialogContent
|
|
70
|
+
:class="ui.content({ class: [props.ui?.content, !slots.default && props.class] })"
|
|
71
|
+
v-bind="contentProps"
|
|
72
|
+
:data-direction="props.direction"
|
|
73
|
+
data-part="content"
|
|
74
|
+
@after-enter="emit('after-enter')"
|
|
75
|
+
@after-leave="emit('after-leave')"
|
|
76
|
+
v-on="contentEvents"
|
|
77
|
+
>
|
|
78
|
+
<VisuallyHidden v-if="!!slots.content || !!slots.header || !props.title && !slots.title">
|
|
79
|
+
<DialogTitle />
|
|
80
|
+
</VisuallyHidden>
|
|
81
|
+
|
|
82
|
+
<slot name="content" :close="close">
|
|
83
|
+
<div
|
|
84
|
+
v-if="slots.header || (props.title || !!slots.title) || (props.description || !!slots.description) || (props.close || !!slots.close)"
|
|
85
|
+
:class="ui.header({ class: props.ui?.header })"
|
|
86
|
+
data-part="header"
|
|
87
|
+
>
|
|
88
|
+
<slot name="header" :close="close">
|
|
89
|
+
<DialogTitle
|
|
90
|
+
v-if="props.title || slots.title"
|
|
91
|
+
:class="ui.title({ class: props.ui?.title })"
|
|
92
|
+
data-part="title"
|
|
93
|
+
>
|
|
94
|
+
<slot name="title">
|
|
95
|
+
{{ props.title }}
|
|
96
|
+
</slot>
|
|
97
|
+
</DialogTitle>
|
|
98
|
+
|
|
99
|
+
<DialogClose v-if="props.close || !!slots.close" as-child>
|
|
100
|
+
<slot name="close" :close="close" :ui="ui">
|
|
101
|
+
<Button
|
|
102
|
+
v-if="props.close"
|
|
103
|
+
color="neutral"
|
|
104
|
+
variant="ghost"
|
|
105
|
+
:icon="props.closeIcon || appConfig.ui.icons.close"
|
|
106
|
+
:aria-label="t('modal.close')"
|
|
107
|
+
v-bind="typeof props.close === 'object' ? props.close : {}"
|
|
108
|
+
:class="ui.close({ class: props.ui?.close })"
|
|
109
|
+
data-part="close"
|
|
110
|
+
/>
|
|
111
|
+
</slot>
|
|
112
|
+
</DialogClose>
|
|
113
|
+
|
|
114
|
+
<DialogDescription
|
|
115
|
+
v-if="props.description || !!slots.description"
|
|
116
|
+
:class="ui.description({ class: props.ui?.description })"
|
|
117
|
+
data-part="description"
|
|
118
|
+
>
|
|
119
|
+
<slot name="description">
|
|
120
|
+
{{ props.description }}
|
|
121
|
+
</slot>
|
|
122
|
+
</DialogDescription>
|
|
123
|
+
</slot>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<div v-if="slots.body" :class="ui.body({ class: props.ui?.body })" data-part="body">
|
|
127
|
+
<slot name="body" :close="close"></slot>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<div v-if="slots.footer" :class="ui.footer({ class: props.ui?.footer })" data-part="footer">
|
|
131
|
+
<slot name="footer" :close="close"></slot>
|
|
132
|
+
</div>
|
|
133
|
+
</slot>
|
|
134
|
+
</DialogContent>
|
|
135
|
+
</DialogPortal>
|
|
136
|
+
</DialogRoot>
|
|
137
137
|
</template>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
2
|
import type { DialogContentEmits, DialogContentProps, DialogRootEmits, DialogRootProps } from 'reka-ui';
|
|
3
3
|
import theme from '#build/ui/drawer';
|
|
4
|
-
import type { ButtonProps, ComponentBaseProps, ComponentStyler, ComponentUIProps, IconProps } from '../types';
|
|
4
|
+
import type { ButtonProps, ComponentBaseProps, ComponentStyler, ComponentUIProps, IconProps, LinkPropsKeys } from '../types';
|
|
5
5
|
import type { EmitsToProps, StaticSlot } from '../types/utils';
|
|
6
6
|
type ThemeVariants = VariantProps<typeof theme>;
|
|
7
7
|
export interface DrawerProps extends ComponentBaseProps, DialogRootProps {
|
|
@@ -37,7 +37,7 @@ export interface DrawerProps extends ComponentBaseProps, DialogRootProps {
|
|
|
37
37
|
* Display a close button to dismiss the drawer.
|
|
38
38
|
* @default true
|
|
39
39
|
*/
|
|
40
|
-
close?: boolean |
|
|
40
|
+
close?: boolean | Omit<ButtonProps, LinkPropsKeys>;
|
|
41
41
|
/** @default app.icons.close */
|
|
42
42
|
closeIcon?: IconProps['name'];
|
|
43
43
|
/**
|
|
@@ -75,6 +75,8 @@ export interface DrawerSlots {
|
|
|
75
75
|
close: () => void;
|
|
76
76
|
}>;
|
|
77
77
|
}
|
|
78
|
+
declare const _default: typeof __VLS_export;
|
|
79
|
+
export default _default;
|
|
78
80
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<DrawerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
79
81
|
"update:open": (value: boolean) => any;
|
|
80
82
|
"after-leave": () => any;
|
|
@@ -86,16 +88,14 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Drawer
|
|
|
86
88
|
"onAfter-enter"?: (() => any) | undefined;
|
|
87
89
|
"onClose-prevent"?: (() => any) | undefined;
|
|
88
90
|
}>, {
|
|
89
|
-
|
|
90
|
-
close: boolean | Partial<ButtonProps>;
|
|
91
|
+
close: boolean | Omit<ButtonProps, LinkPropsKeys>;
|
|
91
92
|
transition: boolean;
|
|
93
|
+
overlay: boolean;
|
|
92
94
|
direction: "top" | "right" | "bottom" | "left";
|
|
93
95
|
modal: boolean;
|
|
94
96
|
portal: boolean | string | HTMLElement;
|
|
95
97
|
dismissible: boolean;
|
|
96
98
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, DrawerSlots>;
|
|
97
|
-
declare const _default: typeof __VLS_export;
|
|
98
|
-
export default _default;
|
|
99
99
|
type __VLS_WithSlots<T, S> = T & {
|
|
100
100
|
new (): {
|
|
101
101
|
$slots: S;
|
|
@@ -26,7 +26,7 @@ const props = defineProps({
|
|
|
26
26
|
class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
|
|
27
27
|
defaultOpen: { type: Boolean, required: false },
|
|
28
28
|
open: { type: Boolean, required: false },
|
|
29
|
-
modal: { type: Boolean, required: false, default:
|
|
29
|
+
modal: { type: Boolean, required: false, default: false }
|
|
30
30
|
});
|
|
31
31
|
const emit = defineEmits(["update:open"]);
|
|
32
32
|
const slots = defineSlots();
|
|
@@ -42,31 +42,31 @@ const ui = computed(() => {
|
|
|
42
42
|
</script>
|
|
43
43
|
|
|
44
44
|
<template>
|
|
45
|
-
<DropdownMenuRoot v-slot="{ open }" v-bind="rootProps">
|
|
46
|
-
<DropdownMenuTrigger v-if="!!slots.default" as-child :class="props.class" :disabled="props.disabled">
|
|
47
|
-
<slot :open="open"></slot>
|
|
48
|
-
</DropdownMenuTrigger>
|
|
49
|
-
|
|
50
|
-
<DropdownMenuContent
|
|
51
|
-
v-bind="contentProps"
|
|
52
|
-
:size="props.size"
|
|
53
|
-
:items="props.items"
|
|
54
|
-
:portal="props.portal"
|
|
55
|
-
:label-key="props.labelKey"
|
|
56
|
-
:description-key="props.descriptionKey"
|
|
57
|
-
:checked-icon="props.checkedIcon"
|
|
58
|
-
:loading-icon="props.loadingIcon"
|
|
59
|
-
:external-icon="props.externalIcon"
|
|
60
|
-
:ui="ui"
|
|
61
|
-
:ui-override="props.ui"
|
|
62
|
-
:class="ui.content({ class: [props.ui?.content, !slots.default && props.class] })"
|
|
63
|
-
data-part="content"
|
|
64
|
-
>
|
|
65
|
-
<template v-for="(_, name) in getProxySlots()" #[name]="slotProps">
|
|
66
|
-
<slot :name="name" v-bind="slotProps"></slot>
|
|
67
|
-
</template>
|
|
68
|
-
|
|
69
|
-
<DropdownMenuArrow v-if="props.arrow" v-bind="arrowProps" :class="ui.arrow({ class: props.ui?.arrow })" data-part="arrow" />
|
|
70
|
-
</DropdownMenuContent>
|
|
71
|
-
</DropdownMenuRoot>
|
|
45
|
+
<DropdownMenuRoot v-slot="{ open }" v-bind="rootProps">
|
|
46
|
+
<DropdownMenuTrigger v-if="!!slots.default" as-child :class="props.class" :disabled="props.disabled">
|
|
47
|
+
<slot :open="open"></slot>
|
|
48
|
+
</DropdownMenuTrigger>
|
|
49
|
+
|
|
50
|
+
<DropdownMenuContent
|
|
51
|
+
v-bind="contentProps"
|
|
52
|
+
:size="props.size"
|
|
53
|
+
:items="props.items"
|
|
54
|
+
:portal="props.portal"
|
|
55
|
+
:label-key="props.labelKey"
|
|
56
|
+
:description-key="props.descriptionKey"
|
|
57
|
+
:checked-icon="props.checkedIcon"
|
|
58
|
+
:loading-icon="props.loadingIcon"
|
|
59
|
+
:external-icon="props.externalIcon"
|
|
60
|
+
:ui="ui"
|
|
61
|
+
:ui-override="props.ui"
|
|
62
|
+
:class="ui.content({ class: [props.ui?.content, !slots.default && props.class] })"
|
|
63
|
+
data-part="content"
|
|
64
|
+
>
|
|
65
|
+
<template v-for="(_, name) in getProxySlots()" #[name]="slotProps">
|
|
66
|
+
<slot :name="name" v-bind="slotProps"></slot>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<DropdownMenuArrow v-if="props.arrow" v-bind="arrowProps" :class="ui.arrow({ class: props.ui?.arrow })" data-part="arrow" />
|
|
70
|
+
</DropdownMenuContent>
|
|
71
|
+
</DropdownMenuRoot>
|
|
72
72
|
</template>
|
|
@@ -112,8 +112,12 @@ export type DropdownMenuSlots<A extends ArrayOrNested<DropdownMenuItem> = ArrayO
|
|
|
112
112
|
index: number;
|
|
113
113
|
ui: ComponentStyler<typeof theme>;
|
|
114
114
|
}>;
|
|
115
|
-
'content-top': StaticSlot
|
|
116
|
-
|
|
115
|
+
'content-top': StaticSlot<{
|
|
116
|
+
sub: boolean;
|
|
117
|
+
}>;
|
|
118
|
+
'content-bottom': StaticSlot<{
|
|
119
|
+
sub: boolean;
|
|
120
|
+
}>;
|
|
117
121
|
} & DynamicSlots<MergeTypes<T>, 'label' | 'description', {
|
|
118
122
|
active?: boolean;
|
|
119
123
|
index: number;
|
|
@@ -122,10 +126,14 @@ export type DropdownMenuSlots<A extends ArrayOrNested<DropdownMenuItem> = ArrayO
|
|
|
122
126
|
index: number;
|
|
123
127
|
ui: ComponentStyler<typeof theme>;
|
|
124
128
|
}>;
|
|
125
|
-
declare const
|
|
126
|
-
|
|
129
|
+
declare const _default: typeof __VLS_export;
|
|
130
|
+
export default _default;
|
|
131
|
+
declare const __VLS_export: <T extends ArrayOrNested<DropdownMenuItem>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
132
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<DropdownMenuProps<T> & {
|
|
127
133
|
"onUpdate:open"?: ((payload: boolean) => any) | undefined;
|
|
128
|
-
}> &
|
|
134
|
+
}> & (typeof globalThis extends {
|
|
135
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
136
|
+
} ? P : {});
|
|
129
137
|
expose: (exposed: {}) => void;
|
|
130
138
|
attrs: any;
|
|
131
139
|
slots: DropdownMenuSlots<T, NestedItem<T>>;
|
|
@@ -133,8 +141,8 @@ declare const __VLS_export: <T extends ArrayOrNested<DropdownMenuItem>>(__VLS_pr
|
|
|
133
141
|
}>) => import("vue").VNode & {
|
|
134
142
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
135
143
|
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
144
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
145
|
+
[K in keyof T]: T[K];
|
|
146
|
+
} : {
|
|
139
147
|
[K in keyof T as K]: T[K];
|
|
140
|
-
} & {};
|
|
148
|
+
}) & {};
|