@nuxt/ui 3.0.2 → 3.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/.nuxt/ui/accordion.ts +25 -4
- package/.nuxt/ui/alert.ts +52 -31
- package/.nuxt/ui/avatar-group.ts +24 -3
- package/.nuxt/ui/avatar.ts +26 -5
- package/.nuxt/ui/badge.ts +56 -35
- package/.nuxt/ui/breadcrumb.ts +28 -7
- package/.nuxt/ui/button-group.ts +23 -2
- package/.nuxt/ui/button.ts +66 -45
- package/.nuxt/ui/calendar.ts +39 -18
- package/.nuxt/ui/card.ts +28 -7
- package/.nuxt/ui/carousel.ts +29 -8
- package/.nuxt/ui/checkbox-group.ts +82 -0
- package/.nuxt/ui/checkbox.ts +163 -29
- package/.nuxt/ui/chip.ts +31 -10
- package/.nuxt/ui/collapsible.ts +23 -2
- package/.nuxt/ui/color-picker.ts +26 -5
- package/.nuxt/ui/command-palette.ts +37 -16
- package/.nuxt/ui/container.ts +23 -2
- package/.nuxt/ui/context-menu.ts +56 -35
- package/.nuxt/ui/drawer.ts +33 -12
- package/.nuxt/ui/dropdown-menu.ts +57 -36
- package/.nuxt/ui/form-field.ts +29 -8
- package/.nuxt/ui/form.ts +23 -2
- package/.nuxt/ui/index.ts +1 -0
- package/.nuxt/ui/input-menu.ts +65 -44
- package/.nuxt/ui/input-number.ts +43 -22
- package/.nuxt/ui/input.ts +46 -25
- package/.nuxt/ui/kbd.ts +27 -6
- package/.nuxt/ui/link.ts +26 -5
- package/.nuxt/ui/modal.ts +28 -7
- package/.nuxt/ui/navigation-menu.ts +102 -83
- package/.nuxt/ui/pagination.ts +23 -2
- package/.nuxt/ui/pin-input.ts +43 -22
- package/.nuxt/ui/popover.ts +25 -4
- package/.nuxt/ui/progress.ts +40 -19
- package/.nuxt/ui/radio-group.ts +273 -37
- package/.nuxt/ui/select-menu.ts +59 -35
- package/.nuxt/ui/select.ts +55 -34
- package/.nuxt/ui/separator.ts +31 -10
- package/.nuxt/ui/skeleton.ts +24 -3
- package/.nuxt/ui/slideover.ts +27 -6
- package/.nuxt/ui/slider.ts +39 -18
- package/.nuxt/ui/stepper.ts +41 -20
- package/.nuxt/ui/switch.ts +43 -22
- package/.nuxt/ui/table.ts +38 -17
- package/.nuxt/ui/tabs.ts +55 -34
- package/.nuxt/ui/textarea.ts +63 -37
- package/.nuxt/ui/toast.ts +47 -26
- package/.nuxt/ui/toaster.ts +23 -2
- package/.nuxt/ui/tooltip.ts +25 -4
- package/.nuxt/ui/tree.ts +41 -20
- package/.nuxt/ui.css +56 -12
- package/README.md +11 -0
- package/cli/templates.mjs +18 -17
- package/dist/module.json +5 -5
- package/dist/module.mjs +11 -7
- package/dist/runtime/components/Accordion.vue +36 -93
- package/dist/runtime/components/Accordion.vue.d.ts +91 -0
- package/dist/runtime/components/Alert.vue +37 -100
- package/dist/runtime/components/Alert.vue.d.ts +96 -0
- package/dist/runtime/components/App.vue +28 -34
- package/dist/runtime/components/App.vue.d.ts +24 -0
- package/dist/runtime/components/Avatar.vue +42 -75
- package/dist/runtime/components/Avatar.vue.d.ts +60 -0
- package/dist/runtime/components/AvatarGroup.vue +40 -77
- package/dist/runtime/components/AvatarGroup.vue.d.ts +40 -0
- package/dist/runtime/components/Badge.vue +33 -62
- package/dist/runtime/components/Badge.vue.d.ts +62 -0
- package/dist/runtime/components/Breadcrumb.vue +37 -90
- package/dist/runtime/components/Breadcrumb.vue.d.ts +82 -0
- package/dist/runtime/components/Button.vue +95 -104
- package/dist/runtime/components/Button.vue.d.ts +73 -0
- package/dist/runtime/components/ButtonGroup.vue +20 -46
- package/dist/runtime/components/ButtonGroup.vue.d.ts +55 -0
- package/dist/runtime/components/Calendar.vue +67 -150
- package/dist/runtime/components/Calendar.vue.d.ts +107 -0
- package/dist/runtime/components/Card.vue +18 -40
- package/dist/runtime/components/Card.vue.d.ts +38 -0
- package/dist/runtime/components/Carousel.vue +112 -234
- package/dist/runtime/components/Carousel.vue.d.ts +120 -0
- package/dist/runtime/components/Checkbox.vue +52 -93
- package/dist/runtime/components/Checkbox.vue.d.ts +76 -0
- package/dist/runtime/components/CheckboxGroup.vue +121 -0
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +75 -0
- package/dist/runtime/components/Chip.vue +26 -69
- package/dist/runtime/components/Chip.vue.d.ts +71 -0
- package/dist/runtime/components/Collapsible.vue +22 -41
- package/dist/runtime/components/Collapsible.vue.d.ts +50 -0
- package/dist/runtime/components/ColorPicker.vue +111 -197
- package/dist/runtime/components/ColorPicker.vue.d.ts +63 -0
- package/dist/runtime/components/CommandPalette.vue +96 -237
- package/dist/runtime/components/CommandPalette.vue.d.ts +173 -0
- package/dist/runtime/components/Container.vue +15 -28
- package/dist/runtime/components/Container.vue.d.ts +27 -0
- package/dist/runtime/components/ContextMenu.vue +34 -133
- package/dist/runtime/components/ContextMenu.vue.d.ts +127 -0
- package/dist/runtime/components/ContextMenuContent.vue +73 -81
- package/dist/runtime/components/ContextMenuContent.vue.d.ts +105 -0
- package/dist/runtime/components/Drawer.vue +49 -83
- package/dist/runtime/components/Drawer.vue.d.ts +88 -0
- package/dist/runtime/components/DropdownMenu.vue +39 -142
- package/dist/runtime/components/DropdownMenu.vue.d.ts +141 -0
- package/dist/runtime/components/DropdownMenuContent.vue +78 -88
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +55 -0
- package/dist/runtime/components/Form.vue +135 -220
- package/dist/runtime/components/Form.vue.d.ts +66 -0
- package/dist/runtime/components/FormField.vue +35 -77
- package/dist/runtime/components/FormField.vue.d.ts +70 -0
- package/dist/runtime/components/Icon.vue +12 -19
- package/dist/runtime/components/Icon.vue.d.ts +17 -0
- package/dist/runtime/components/Input.vue +82 -140
- package/dist/runtime/components/Input.vue.d.ts +91 -0
- package/dist/runtime/components/InputMenu.vue +185 -332
- package/dist/runtime/components/InputMenu.vue.d.ts +312 -0
- package/dist/runtime/components/InputNumber.vue +71 -133
- package/dist/runtime/components/InputNumber.vue.d.ts +193 -0
- package/dist/runtime/components/Kbd.vue +20 -46
- package/dist/runtime/components/Kbd.vue.d.ts +55 -0
- package/dist/runtime/components/Link.vue +98 -176
- package/dist/runtime/components/Link.vue.d.ts +124 -0
- package/dist/runtime/components/LinkBase.vue +33 -42
- package/dist/runtime/components/LinkBase.vue.d.ts +48 -0
- package/dist/runtime/components/Modal.vue +53 -116
- package/dist/runtime/components/Modal.vue.d.ts +109 -0
- package/dist/runtime/components/NavigationMenu.vue +77 -209
- package/dist/runtime/components/NavigationMenu.vue.d.ts +159 -0
- package/dist/runtime/components/OverlayProvider.vue +14 -18
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Pagination.vue +46 -140
- package/dist/runtime/components/Pagination.vue.d.ts +143 -0
- package/dist/runtime/components/PinInput.vue +61 -78
- package/dist/runtime/components/PinInput.vue.d.ts +68 -0
- package/dist/runtime/components/Popover.vue +47 -84
- package/dist/runtime/components/Popover.vue.d.ts +80 -0
- package/dist/runtime/components/Progress.vue +70 -131
- package/dist/runtime/components/Progress.vue.d.ts +97 -0
- package/dist/runtime/components/RadioGroup.vue +70 -132
- package/dist/runtime/components/RadioGroup.vue.d.ts +88 -0
- package/dist/runtime/components/Select.vue +110 -224
- package/dist/runtime/components/Select.vue.d.ts +139 -0
- package/dist/runtime/components/SelectMenu.vue +161 -310
- package/dist/runtime/components/SelectMenu.vue.d.ts +184 -0
- package/dist/runtime/components/Separator.vue +29 -71
- package/dist/runtime/components/Separator.vue.d.ts +75 -0
- package/dist/runtime/components/Skeleton.vue +21 -23
- package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
- package/dist/runtime/components/Slideover.vue +53 -120
- package/dist/runtime/components/Slideover.vue.d.ts +111 -0
- package/dist/runtime/components/Slider.vue +46 -84
- package/dist/runtime/components/Slider.vue.d.ts +71 -0
- package/dist/runtime/components/Stepper.vue +45 -115
- package/dist/runtime/components/Stepper.vue.d.ts +89 -0
- package/dist/runtime/components/Switch.vue +45 -93
- package/dist/runtime/components/Switch.vue.d.ts +73 -0
- package/dist/runtime/components/Table.vue +163 -267
- package/dist/runtime/components/Table.vue.d.ts +183 -0
- package/dist/runtime/components/Tabs.vue +41 -107
- package/dist/runtime/components/Tabs.vue.d.ts +104 -0
- package/dist/runtime/components/Textarea.vue +113 -158
- package/dist/runtime/components/Textarea.vue.d.ts +95 -0
- package/dist/runtime/components/Toast.vue +49 -110
- package/dist/runtime/components/Toast.vue.d.ts +95 -0
- package/dist/runtime/components/Toaster.vue +70 -107
- package/dist/runtime/components/Toaster.vue.d.ts +63 -0
- package/dist/runtime/components/Tooltip.vue +38 -65
- package/dist/runtime/components/Tooltip.vue.d.ts +65 -0
- package/dist/runtime/components/Tree.vue +59 -166
- package/dist/runtime/components/Tree.vue.d.ts +128 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useFormField.d.ts +2 -2
- package/dist/runtime/composables/useOverlay.d.ts +14 -7
- package/dist/runtime/composables/useOverlay.js +14 -6
- package/dist/runtime/composables/usePortal.d.ts +6 -0
- package/dist/runtime/composables/usePortal.js +17 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/inertia/components/Link.vue +146 -0
- package/dist/runtime/inertia/components/Link.vue.d.ts +92 -0
- package/dist/runtime/inertia/stubs.d.ts +43 -0
- package/dist/runtime/inertia/stubs.js +82 -0
- package/dist/runtime/locale/bg.d.ts +3 -0
- package/dist/runtime/locale/bg.js +54 -0
- package/dist/runtime/locale/index.d.ts +5 -1
- package/dist/runtime/locale/index.js +5 -1
- package/dist/runtime/locale/kk.d.ts +3 -0
- package/dist/runtime/locale/kk.js +54 -0
- package/dist/runtime/locale/tj.d.ts +3 -0
- package/dist/runtime/locale/tj.js +54 -0
- package/dist/runtime/locale/ug_cn.d.ts +3 -0
- package/dist/runtime/locale/ug_cn.js +55 -0
- package/dist/runtime/types/form.d.ts +4 -1
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/utils.d.ts +47 -7
- package/dist/runtime/utils/link.d.ts +3 -3
- package/dist/runtime/utils/link.js +1 -0
- package/dist/runtime/utils/tv.js +2 -2
- package/dist/runtime/vue/components/Icon.vue +7 -8
- package/dist/runtime/vue/components/Icon.vue.d.ts +14 -0
- package/dist/runtime/vue/components/Link.vue +118 -202
- package/dist/runtime/vue/components/Link.vue.d.ts +124 -0
- package/dist/runtime/vue/stubs.d.ts +2 -2
- package/dist/shared/{ui.BkNUP964.mjs → ui.D7lOOabO.mjs} +621 -362
- package/dist/types.d.mts +3 -5
- package/dist/unplugin.d.mts +4 -0
- package/dist/unplugin.mjs +25 -4
- package/dist/vite.mjs +1 -1
- package/package.json +94 -53
- package/dist/module.cjs +0 -62
- package/dist/module.d.cts +0 -45
- package/dist/module.d.ts +0 -45
- package/dist/shared/ui.BL-XB3u1.cjs +0 -3555
- package/dist/types.d.ts +0 -7
- package/dist/unplugin.cjs +0 -232
- package/dist/unplugin.d.cts +0 -62
- package/dist/unplugin.d.ts +0 -62
- package/dist/vite.cjs +0 -23
- package/dist/vite.d.cts +0 -15
- package/dist/vite.d.ts +0 -15
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes } from 'vue';
|
|
2
|
+
import type { RouterLinkProps, RouteLocationRaw } from 'vue-router';
|
|
3
|
+
interface NuxtLinkProps extends Omit<RouterLinkProps, 'to'> {
|
|
4
|
+
/**
|
|
5
|
+
* Route Location the link should navigate to when clicked on.
|
|
6
|
+
*/
|
|
7
|
+
to?: RouteLocationRaw;
|
|
8
|
+
/**
|
|
9
|
+
* An alias for `to`. If used with `to`, `href` will be ignored
|
|
10
|
+
*/
|
|
11
|
+
href?: NuxtLinkProps['to'];
|
|
12
|
+
/**
|
|
13
|
+
* Forces the link to be considered as external (true) or internal (false). This is helpful to handle edge-cases
|
|
14
|
+
*/
|
|
15
|
+
external?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Where to display the linked URL, as the name for a browsing context.
|
|
18
|
+
*/
|
|
19
|
+
target?: '_blank' | '_parent' | '_self' | '_top' | (string & {}) | null;
|
|
20
|
+
/**
|
|
21
|
+
* A rel attribute value to apply on the link. Defaults to "noopener noreferrer" for external links.
|
|
22
|
+
*/
|
|
23
|
+
rel?: 'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc' | (string & {}) | null;
|
|
24
|
+
/**
|
|
25
|
+
* If set to true, no rel attribute will be added to the link
|
|
26
|
+
*/
|
|
27
|
+
noRel?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* A class to apply to links that have been prefetched.
|
|
30
|
+
*/
|
|
31
|
+
prefetchedClass?: string;
|
|
32
|
+
/**
|
|
33
|
+
* When enabled will prefetch middleware, layouts and payloads of links in the viewport.
|
|
34
|
+
*/
|
|
35
|
+
prefetch?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Allows controlling when to prefetch links. By default, prefetch is triggered only on visibility.
|
|
38
|
+
*/
|
|
39
|
+
prefetchOn?: 'visibility' | 'interaction' | Partial<{
|
|
40
|
+
visibility: boolean;
|
|
41
|
+
interaction: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Escape hatch to disable `prefetch` attribute.
|
|
45
|
+
*/
|
|
46
|
+
noPrefetch?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface LinkProps extends NuxtLinkProps {
|
|
49
|
+
/**
|
|
50
|
+
* The element or component this component should render as when not a link.
|
|
51
|
+
* @defaultValue 'button'
|
|
52
|
+
*/
|
|
53
|
+
as?: any;
|
|
54
|
+
/**
|
|
55
|
+
* The type of the button when not a link.
|
|
56
|
+
* @defaultValue 'button'
|
|
57
|
+
*/
|
|
58
|
+
type?: ButtonHTMLAttributes['type'];
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
/** Force the link to be active independent of the current route. */
|
|
61
|
+
active?: boolean;
|
|
62
|
+
/** Will only be active if the current route is an exact match. */
|
|
63
|
+
exact?: boolean;
|
|
64
|
+
/** Allows controlling how the current route query sets the link as active. */
|
|
65
|
+
exactQuery?: boolean | 'partial';
|
|
66
|
+
/** Will only be active if the current route hash is an exact match. */
|
|
67
|
+
exactHash?: boolean;
|
|
68
|
+
/** The class to apply when the link is inactive. */
|
|
69
|
+
inactiveClass?: string;
|
|
70
|
+
custom?: boolean;
|
|
71
|
+
/** When `true`, only styles from `class`, `activeClass`, and `inactiveClass` will be applied. */
|
|
72
|
+
raw?: boolean;
|
|
73
|
+
class?: any;
|
|
74
|
+
}
|
|
75
|
+
export interface LinkSlots {
|
|
76
|
+
default(props: {
|
|
77
|
+
active: boolean;
|
|
78
|
+
}): any;
|
|
79
|
+
}
|
|
80
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<LinkProps>, {
|
|
81
|
+
as: string;
|
|
82
|
+
type: string;
|
|
83
|
+
ariaCurrentValue: string;
|
|
84
|
+
active: undefined;
|
|
85
|
+
activeClass: string;
|
|
86
|
+
inactiveClass: string;
|
|
87
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<LinkProps>, {
|
|
88
|
+
as: string;
|
|
89
|
+
type: string;
|
|
90
|
+
ariaCurrentValue: string;
|
|
91
|
+
active: undefined;
|
|
92
|
+
activeClass: string;
|
|
93
|
+
inactiveClass: string;
|
|
94
|
+
}>>> & Readonly<{}>, {
|
|
95
|
+
type: "reset" | "submit" | "button";
|
|
96
|
+
as: any;
|
|
97
|
+
activeClass: string;
|
|
98
|
+
ariaCurrentValue: "page" | "step" | "location" | "date" | "time" | "true" | "false";
|
|
99
|
+
active: boolean;
|
|
100
|
+
inactiveClass: string;
|
|
101
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<LinkSlots> & LinkSlots>;
|
|
102
|
+
export default _default;
|
|
103
|
+
type __VLS_WithDefaults<P, D> = {
|
|
104
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
105
|
+
default: D[K];
|
|
106
|
+
}> : P[K];
|
|
107
|
+
};
|
|
108
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
109
|
+
type __VLS_TypePropsToOption<T> = {
|
|
110
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
111
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
112
|
+
} : {
|
|
113
|
+
type: import('vue').PropType<T[K]>;
|
|
114
|
+
required: true;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
118
|
+
new (): {
|
|
119
|
+
$slots: S;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
type __VLS_PrettifyLocal<T> = {
|
|
123
|
+
[K in keyof T]: T[K];
|
|
124
|
+
} & {};
|
|
@@ -1,43 +1,34 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { LinkProps } from '../types'
|
|
1
|
+
<script>
|
|
3
2
|
|
|
4
|
-
export interface LinkBaseProps {
|
|
5
|
-
as?: string
|
|
6
|
-
type?: string
|
|
7
|
-
disabled?: boolean
|
|
8
|
-
onClick?: ((e: MouseEvent) => void | Promise<void>) | Array<((e: MouseEvent) => void | Promise<void>)>
|
|
9
|
-
href?: string
|
|
10
|
-
navigate?: (e: MouseEvent) => void
|
|
11
|
-
target?: LinkProps['target']
|
|
12
|
-
rel?: LinkProps['rel']
|
|
13
|
-
active?: boolean
|
|
14
|
-
isExternal?: boolean
|
|
15
|
-
}
|
|
16
3
|
</script>
|
|
17
4
|
|
|
18
|
-
<script setup
|
|
19
|
-
import { Primitive } from
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
type:
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { Primitive } from "reka-ui";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
as: { type: String, required: false, default: "button" },
|
|
9
|
+
type: { type: String, required: false, default: "button" },
|
|
10
|
+
disabled: { type: Boolean, required: false },
|
|
11
|
+
onClick: { type: [Function, Array], required: false },
|
|
12
|
+
href: { type: String, required: false },
|
|
13
|
+
navigate: { type: Function, required: false },
|
|
14
|
+
target: { type: [String, Object, null], required: false },
|
|
15
|
+
rel: { type: [String, Object, null], required: false },
|
|
16
|
+
active: { type: Boolean, required: false },
|
|
17
|
+
isExternal: { type: Boolean, required: false }
|
|
18
|
+
});
|
|
19
|
+
function onClickWrapper(e) {
|
|
27
20
|
if (props.disabled) {
|
|
28
|
-
e.stopPropagation()
|
|
29
|
-
e.preventDefault()
|
|
30
|
-
return
|
|
21
|
+
e.stopPropagation();
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
return;
|
|
31
24
|
}
|
|
32
|
-
|
|
33
25
|
if (props.onClick) {
|
|
34
26
|
for (const onClick of Array.isArray(props.onClick) ? props.onClick : [props.onClick]) {
|
|
35
|
-
onClick(e)
|
|
27
|
+
onClick(e);
|
|
36
28
|
}
|
|
37
29
|
}
|
|
38
|
-
|
|
39
30
|
if (props.href && props.navigate && !props.isExternal) {
|
|
40
|
-
props.navigate(e)
|
|
31
|
+
props.navigate(e);
|
|
41
32
|
}
|
|
42
33
|
}
|
|
43
34
|
</script>
|
|
@@ -45,18 +36,18 @@ function onClickWrapper(e: MouseEvent) {
|
|
|
45
36
|
<template>
|
|
46
37
|
<Primitive
|
|
47
38
|
v-bind="href ? {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
39
|
+
'as': 'a',
|
|
40
|
+
'href': disabled ? void 0 : href,
|
|
41
|
+
'aria-disabled': disabled ? 'true' : void 0,
|
|
42
|
+
'role': disabled ? 'link' : void 0,
|
|
43
|
+
'tabindex': disabled ? -1 : void 0
|
|
44
|
+
} : as === 'button' ? {
|
|
45
|
+
as,
|
|
46
|
+
type,
|
|
47
|
+
disabled
|
|
48
|
+
} : {
|
|
49
|
+
as
|
|
50
|
+
}"
|
|
60
51
|
:rel="rel"
|
|
61
52
|
:target="target"
|
|
62
53
|
@click="onClickWrapper"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { LinkProps } from '../types';
|
|
2
|
+
export interface LinkBaseProps {
|
|
3
|
+
as?: string;
|
|
4
|
+
type?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onClick?: ((e: MouseEvent) => void | Promise<void>) | Array<((e: MouseEvent) => void | Promise<void>)>;
|
|
7
|
+
href?: string;
|
|
8
|
+
navigate?: (e: MouseEvent) => void;
|
|
9
|
+
target?: LinkProps['target'];
|
|
10
|
+
rel?: LinkProps['rel'];
|
|
11
|
+
active?: boolean;
|
|
12
|
+
isExternal?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<LinkBaseProps>, {
|
|
15
|
+
as: string;
|
|
16
|
+
type: string;
|
|
17
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<LinkBaseProps>, {
|
|
18
|
+
as: string;
|
|
19
|
+
type: string;
|
|
20
|
+
}>>> & Readonly<{}>, {
|
|
21
|
+
type: string;
|
|
22
|
+
as: string;
|
|
23
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
24
|
+
default?(_: {}): any;
|
|
25
|
+
}>;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithDefaults<P, D> = {
|
|
28
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
29
|
+
default: D[K];
|
|
30
|
+
}> : P[K];
|
|
31
|
+
};
|
|
32
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
33
|
+
type __VLS_TypePropsToOption<T> = {
|
|
34
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
35
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
36
|
+
} : {
|
|
37
|
+
type: import('vue').PropType<T[K]>;
|
|
38
|
+
required: true;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
42
|
+
new (): {
|
|
43
|
+
$slots: S;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
type __VLS_PrettifyLocal<T> = {
|
|
47
|
+
[K in keyof T]: T[K];
|
|
48
|
+
} & {};
|
|
@@ -1,123 +1,60 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
-
import _appConfig from '#build/app.config'
|
|
5
|
-
import theme from '#build/ui/modal'
|
|
6
|
-
import { tv } from '../utils/tv'
|
|
7
|
-
import type { ButtonProps } from '../types'
|
|
8
|
-
import type { EmitsToProps } from '../types/utils'
|
|
9
|
-
|
|
10
|
-
const appConfigModal = _appConfig as AppConfig & { ui: { modal: Partial<typeof theme> } }
|
|
11
|
-
|
|
12
|
-
const modal = tv({ extend: tv(theme), ...(appConfigModal.ui?.modal || {}) })
|
|
13
|
-
|
|
14
|
-
export interface ModalProps extends DialogRootProps {
|
|
15
|
-
title?: string
|
|
16
|
-
description?: string
|
|
17
|
-
/** The content of the modal. */
|
|
18
|
-
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DialogContentEmits>>
|
|
19
|
-
/**
|
|
20
|
-
* Render an overlay behind the modal.
|
|
21
|
-
* @defaultValue true
|
|
22
|
-
*/
|
|
23
|
-
overlay?: boolean
|
|
24
|
-
/**
|
|
25
|
-
* Animate the modal when opening or closing.
|
|
26
|
-
* @defaultValue true
|
|
27
|
-
*/
|
|
28
|
-
transition?: boolean
|
|
29
|
-
/**
|
|
30
|
-
* When `true`, the modal will take up the full screen.
|
|
31
|
-
* @defaultValue false
|
|
32
|
-
*/
|
|
33
|
-
fullscreen?: boolean
|
|
34
|
-
/**
|
|
35
|
-
* Render the modal in a portal.
|
|
36
|
-
* @defaultValue true
|
|
37
|
-
*/
|
|
38
|
-
portal?: boolean
|
|
39
|
-
/**
|
|
40
|
-
* Display a close button to dismiss the modal.
|
|
41
|
-
* `{ size: 'md', color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
|
|
42
|
-
* @defaultValue true
|
|
43
|
-
*/
|
|
44
|
-
close?: boolean | Partial<ButtonProps>
|
|
45
|
-
/**
|
|
46
|
-
* The icon displayed in the close button.
|
|
47
|
-
* @defaultValue appConfig.ui.icons.close
|
|
48
|
-
* @IconifyIcon
|
|
49
|
-
*/
|
|
50
|
-
closeIcon?: string
|
|
51
|
-
/**
|
|
52
|
-
* When `false`, the modal will not close when clicking outside or pressing escape.
|
|
53
|
-
* @defaultValue true
|
|
54
|
-
*/
|
|
55
|
-
dismissible?: boolean
|
|
56
|
-
class?: any
|
|
57
|
-
ui?: Partial<typeof modal.slots>
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface ModalEmits extends DialogRootEmits {
|
|
61
|
-
'after:leave': []
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface ModalSlots {
|
|
65
|
-
default(props: { open: boolean }): any
|
|
66
|
-
content(props?: {}): any
|
|
67
|
-
header(props?: {}): any
|
|
68
|
-
title(props?: {}): any
|
|
69
|
-
description(props?: {}): any
|
|
70
|
-
close(props: { ui: ReturnType<typeof modal> }): any
|
|
71
|
-
body(props?: {}): any
|
|
72
|
-
footer(props?: {}): any
|
|
73
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/modal";
|
|
74
3
|
</script>
|
|
75
4
|
|
|
76
|
-
<script setup
|
|
77
|
-
import { computed, toRef } from
|
|
78
|
-
import { DialogRoot, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, VisuallyHidden, useForwardPropsEmits } from
|
|
79
|
-
import { reactivePick } from
|
|
80
|
-
import { useAppConfig } from
|
|
81
|
-
import { useLocale } from
|
|
82
|
-
import
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed, toRef } from "vue";
|
|
7
|
+
import { DialogRoot, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, VisuallyHidden, useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { reactivePick } from "@vueuse/core";
|
|
9
|
+
import { useAppConfig } from "#imports";
|
|
10
|
+
import { useLocale } from "../composables/useLocale";
|
|
11
|
+
import { usePortal } from "../composables/usePortal";
|
|
12
|
+
import { tv } from "../utils/tv";
|
|
13
|
+
import UButton from "./Button.vue";
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
title: { type: String, required: false },
|
|
16
|
+
description: { type: String, required: false },
|
|
17
|
+
content: { type: Object, required: false },
|
|
18
|
+
overlay: { type: Boolean, required: false, default: true },
|
|
19
|
+
transition: { type: Boolean, required: false, default: true },
|
|
20
|
+
fullscreen: { type: Boolean, required: false },
|
|
21
|
+
portal: { type: [Boolean, String], required: false, skipCheck: true, default: true },
|
|
22
|
+
close: { type: [Boolean, Object], required: false, default: true },
|
|
23
|
+
closeIcon: { type: String, required: false },
|
|
24
|
+
dismissible: { type: Boolean, required: false, default: true },
|
|
25
|
+
class: { type: null, required: false },
|
|
26
|
+
ui: { type: null, required: false },
|
|
27
|
+
open: { type: Boolean, required: false },
|
|
28
|
+
defaultOpen: { type: Boolean, required: false },
|
|
29
|
+
modal: { type: Boolean, required: false, default: true }
|
|
30
|
+
});
|
|
31
|
+
const emits = defineEmits(["after:leave", "close:prevent", "update:open"]);
|
|
32
|
+
const slots = defineSlots();
|
|
33
|
+
const { t } = useLocale();
|
|
34
|
+
const appConfig = useAppConfig();
|
|
35
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "open", "defaultOpen", "modal"), emits);
|
|
36
|
+
const portalProps = usePortal(toRef(() => props.portal));
|
|
37
|
+
const contentProps = toRef(() => props.content);
|
|
100
38
|
const contentEvents = computed(() => {
|
|
101
|
-
const
|
|
102
|
-
closeAutoFocus: (e
|
|
103
|
-
}
|
|
104
|
-
|
|
39
|
+
const defaultEvents = {
|
|
40
|
+
closeAutoFocus: (e) => e.preventDefault()
|
|
41
|
+
};
|
|
105
42
|
if (!props.dismissible) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
43
|
+
const events = ["pointerDownOutside", "interactOutside", "escapeKeyDown", "closeAutoFocus"];
|
|
44
|
+
return events.reduce((acc, curr) => {
|
|
45
|
+
acc[curr] = (e) => {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
emits("close:prevent");
|
|
48
|
+
};
|
|
49
|
+
return acc;
|
|
50
|
+
}, {});
|
|
112
51
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
const ui = computed(() => modal({
|
|
52
|
+
return defaultEvents;
|
|
53
|
+
});
|
|
54
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.modal || {} })({
|
|
118
55
|
transition: props.transition,
|
|
119
56
|
fullscreen: props.fullscreen
|
|
120
|
-
}))
|
|
57
|
+
}));
|
|
121
58
|
</script>
|
|
122
59
|
|
|
123
60
|
<template>
|
|
@@ -126,11 +63,11 @@ const ui = computed(() => modal({
|
|
|
126
63
|
<slot :open="open" />
|
|
127
64
|
</DialogTrigger>
|
|
128
65
|
|
|
129
|
-
<DialogPortal
|
|
66
|
+
<DialogPortal v-bind="portalProps">
|
|
130
67
|
<DialogOverlay v-if="overlay" :class="ui.overlay({ class: props.ui?.overlay })" />
|
|
131
68
|
|
|
132
69
|
<DialogContent :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-bind="contentProps" @after-leave="emits('after:leave')" v-on="contentEvents">
|
|
133
|
-
<VisuallyHidden v-if="!!slots.content && (
|
|
70
|
+
<VisuallyHidden v-if="!!slots.content && (title || !!slots.title || (description || !!slots.description))">
|
|
134
71
|
<DialogTitle v-if="title || !!slots.title">
|
|
135
72
|
<slot name="title">
|
|
136
73
|
{{ title }}
|
|
@@ -170,7 +107,7 @@ const ui = computed(() => modal({
|
|
|
170
107
|
color="neutral"
|
|
171
108
|
variant="ghost"
|
|
172
109
|
:aria-label="t('modal.close')"
|
|
173
|
-
v-bind="
|
|
110
|
+
v-bind="typeof close === 'object' ? close : {}"
|
|
174
111
|
:class="ui.close({ class: props.ui?.close })"
|
|
175
112
|
/>
|
|
176
113
|
</slot>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { DialogRootProps, DialogRootEmits, DialogContentProps, DialogContentEmits } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/ui/modal';
|
|
4
|
+
import type { ButtonProps } from '../types';
|
|
5
|
+
import type { EmitsToProps, ComponentConfig } from '../types/utils';
|
|
6
|
+
type Modal = ComponentConfig<typeof theme, AppConfig, 'modal'>;
|
|
7
|
+
export interface ModalProps extends DialogRootProps {
|
|
8
|
+
title?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
/** The content of the modal. */
|
|
11
|
+
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DialogContentEmits>>;
|
|
12
|
+
/**
|
|
13
|
+
* Render an overlay behind the modal.
|
|
14
|
+
* @defaultValue true
|
|
15
|
+
*/
|
|
16
|
+
overlay?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Animate the modal when opening or closing.
|
|
19
|
+
* @defaultValue true
|
|
20
|
+
*/
|
|
21
|
+
transition?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* When `true`, the modal will take up the full screen.
|
|
24
|
+
* @defaultValue false
|
|
25
|
+
*/
|
|
26
|
+
fullscreen?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Render the modal in a portal.
|
|
29
|
+
* @defaultValue true
|
|
30
|
+
*/
|
|
31
|
+
portal?: boolean | string | HTMLElement;
|
|
32
|
+
/**
|
|
33
|
+
* Display a close button to dismiss the modal.
|
|
34
|
+
* `{ size: 'md', color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
|
|
35
|
+
* @defaultValue true
|
|
36
|
+
*/
|
|
37
|
+
close?: boolean | Partial<ButtonProps>;
|
|
38
|
+
/**
|
|
39
|
+
* The icon displayed in the close button.
|
|
40
|
+
* @defaultValue appConfig.ui.icons.close
|
|
41
|
+
* @IconifyIcon
|
|
42
|
+
*/
|
|
43
|
+
closeIcon?: string;
|
|
44
|
+
/**
|
|
45
|
+
* When `false`, the modal will not close when clicking outside or pressing escape.
|
|
46
|
+
* @defaultValue true
|
|
47
|
+
*/
|
|
48
|
+
dismissible?: boolean;
|
|
49
|
+
class?: any;
|
|
50
|
+
ui?: Modal['slots'];
|
|
51
|
+
}
|
|
52
|
+
export interface ModalEmits extends DialogRootEmits {
|
|
53
|
+
'after:leave': [];
|
|
54
|
+
'close:prevent': [];
|
|
55
|
+
}
|
|
56
|
+
export interface ModalSlots {
|
|
57
|
+
default(props: {
|
|
58
|
+
open: boolean;
|
|
59
|
+
}): any;
|
|
60
|
+
content(props?: {}): any;
|
|
61
|
+
header(props?: {}): any;
|
|
62
|
+
title(props?: {}): any;
|
|
63
|
+
description(props?: {}): any;
|
|
64
|
+
close(props: {
|
|
65
|
+
ui: {
|
|
66
|
+
[K in keyof Required<Modal['slots']>]: (props?: Record<string, any>) => string;
|
|
67
|
+
};
|
|
68
|
+
}): any;
|
|
69
|
+
body(props?: {}): any;
|
|
70
|
+
footer(props?: {}): any;
|
|
71
|
+
}
|
|
72
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<ModalProps>, {
|
|
73
|
+
close: boolean;
|
|
74
|
+
portal: boolean;
|
|
75
|
+
overlay: boolean;
|
|
76
|
+
transition: boolean;
|
|
77
|
+
modal: boolean;
|
|
78
|
+
dismissible: boolean;
|
|
79
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {
|
|
80
|
+
close: boolean | Partial<ButtonProps>;
|
|
81
|
+
modal: boolean;
|
|
82
|
+
transition: boolean;
|
|
83
|
+
portal: boolean | string | HTMLElement;
|
|
84
|
+
overlay: boolean;
|
|
85
|
+
dismissible: boolean;
|
|
86
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<ModalSlots> & ModalSlots>;
|
|
87
|
+
export default _default;
|
|
88
|
+
type __VLS_WithDefaults<P, D> = {
|
|
89
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
90
|
+
default: D[K];
|
|
91
|
+
}> : P[K];
|
|
92
|
+
};
|
|
93
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
94
|
+
type __VLS_TypePropsToOption<T> = {
|
|
95
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
96
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
97
|
+
} : {
|
|
98
|
+
type: import('vue').PropType<T[K]>;
|
|
99
|
+
required: true;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
103
|
+
new (): {
|
|
104
|
+
$slots: S;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
type __VLS_PrettifyLocal<T> = {
|
|
108
|
+
[K in keyof T]: T[K];
|
|
109
|
+
} & {};
|