@nuxt/ui 3.0.2 → 3.1.1
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 +2 -2
- package/.nuxt/ui/alert.ts +29 -29
- package/.nuxt/ui/avatar-group.ts +1 -1
- package/.nuxt/ui/avatar.ts +3 -3
- package/.nuxt/ui/badge.ts +33 -33
- package/.nuxt/ui/breadcrumb.ts +5 -5
- package/.nuxt/ui/button.ts +43 -43
- package/.nuxt/ui/calendar.ts +17 -17
- package/.nuxt/ui/card.ts +5 -5
- package/.nuxt/ui/carousel.ts +6 -6
- package/.nuxt/ui/checkbox-group.ts +61 -0
- package/.nuxt/ui/checkbox.ts +140 -27
- package/.nuxt/ui/chip.ts +8 -8
- package/.nuxt/ui/color-picker.ts +3 -3
- package/.nuxt/ui/command-palette.ts +14 -14
- package/.nuxt/ui/context-menu.ts +33 -33
- package/.nuxt/ui/drawer.ts +10 -10
- package/.nuxt/ui/dropdown-menu.ts +34 -34
- package/.nuxt/ui/form-field.ts +6 -6
- package/.nuxt/ui/index.ts +1 -0
- package/.nuxt/ui/input-menu.ts +42 -42
- package/.nuxt/ui/input-number.ts +20 -20
- package/.nuxt/ui/input.ts +23 -23
- package/.nuxt/ui/kbd.ts +4 -4
- package/.nuxt/ui/link.ts +3 -3
- package/.nuxt/ui/modal.ts +5 -5
- package/.nuxt/ui/navigation-menu.ts +78 -80
- package/.nuxt/ui/pin-input.ts +20 -20
- package/.nuxt/ui/popover.ts +2 -2
- package/.nuxt/ui/progress.ts +17 -17
- package/.nuxt/ui/radio-group.ts +250 -35
- package/.nuxt/ui/select-menu.ts +36 -33
- package/.nuxt/ui/select.ts +32 -32
- package/.nuxt/ui/separator.ts +8 -8
- package/.nuxt/ui/skeleton.ts +1 -1
- package/.nuxt/ui/slideover.ts +4 -4
- package/.nuxt/ui/slider.ts +16 -16
- package/.nuxt/ui/stepper.ts +18 -18
- package/.nuxt/ui/switch.ts +20 -20
- package/.nuxt/ui/table.ts +15 -15
- package/.nuxt/ui/tabs.ts +32 -32
- package/.nuxt/ui/textarea.ts +40 -35
- package/.nuxt/ui/toast.ts +24 -24
- package/.nuxt/ui/tooltip.ts +2 -2
- package/.nuxt/ui/tree.ts +18 -18
- package/.nuxt/ui.css +63 -12
- package/README.md +15 -0
- package/cli/templates.mjs +18 -17
- package/dist/module.json +5 -5
- package/dist/module.mjs +12 -7
- package/dist/runtime/components/Accordion.vue +36 -93
- package/dist/runtime/components/Accordion.vue.d.ts +75 -0
- package/dist/runtime/components/Alert.vue +37 -100
- package/dist/runtime/components/Alert.vue.d.ts +81 -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 +39 -0
- package/dist/runtime/components/AvatarGroup.vue +40 -77
- package/dist/runtime/components/AvatarGroup.vue.d.ts +31 -0
- package/dist/runtime/components/Badge.vue +33 -62
- package/dist/runtime/components/Badge.vue.d.ts +41 -0
- package/dist/runtime/components/Breadcrumb.vue +37 -90
- package/dist/runtime/components/Breadcrumb.vue.d.ts +64 -0
- package/dist/runtime/components/Button.vue +95 -104
- package/dist/runtime/components/Button.vue.d.ts +48 -0
- package/dist/runtime/components/ButtonGroup.vue +20 -46
- package/dist/runtime/components/ButtonGroup.vue.d.ts +34 -0
- package/dist/runtime/components/Calendar.vue +67 -150
- package/dist/runtime/components/Calendar.vue.d.ts +111 -0
- package/dist/runtime/components/Card.vue +18 -40
- package/dist/runtime/components/Card.vue.d.ts +29 -0
- package/dist/runtime/components/Carousel.vue +112 -234
- package/dist/runtime/components/Carousel.vue.d.ts +122 -0
- package/dist/runtime/components/Checkbox.vue +52 -93
- package/dist/runtime/components/Checkbox.vue.d.ts +73 -0
- package/dist/runtime/components/CheckboxGroup.vue +121 -0
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +78 -0
- package/dist/runtime/components/Chip.vue +26 -69
- package/dist/runtime/components/Chip.vue.d.ts +57 -0
- package/dist/runtime/components/Collapsible.vue +22 -41
- package/dist/runtime/components/Collapsible.vue.d.ts +35 -0
- package/dist/runtime/components/ColorPicker.vue +111 -197
- package/dist/runtime/components/ColorPicker.vue.d.ts +48 -0
- package/dist/runtime/components/CommandPalette.vue +96 -237
- package/dist/runtime/components/CommandPalette.vue.d.ts +161 -0
- package/dist/runtime/components/Container.vue +15 -28
- package/dist/runtime/components/Container.vue.d.ts +18 -0
- package/dist/runtime/components/ContextMenu.vue +34 -133
- package/dist/runtime/components/ContextMenu.vue.d.ts +107 -0
- package/dist/runtime/components/ContextMenuContent.vue +73 -81
- package/dist/runtime/components/ContextMenuContent.vue.d.ts +65 -0
- package/dist/runtime/components/Drawer.vue +49 -83
- package/dist/runtime/components/Drawer.vue.d.ts +78 -0
- package/dist/runtime/components/DropdownMenu.vue +39 -142
- package/dist/runtime/components/DropdownMenu.vue.d.ts +117 -0
- package/dist/runtime/components/DropdownMenuContent.vue +78 -88
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +68 -0
- package/dist/runtime/components/Form.vue +135 -220
- package/dist/runtime/components/Form.vue.d.ts +69 -0
- package/dist/runtime/components/FormField.vue +35 -77
- package/dist/runtime/components/FormField.vue.d.ts +61 -0
- package/dist/runtime/components/Icon.vue +12 -19
- package/dist/runtime/components/Icon.vue.d.ts +8 -0
- package/dist/runtime/components/Input.vue +82 -140
- package/dist/runtime/components/Input.vue.d.ts +76 -0
- package/dist/runtime/components/InputMenu.vue +185 -332
- package/dist/runtime/components/InputMenu.vue.d.ts +324 -0
- package/dist/runtime/components/InputNumber.vue +71 -133
- package/dist/runtime/components/InputNumber.vue.d.ts +182 -0
- package/dist/runtime/components/Kbd.vue +20 -46
- package/dist/runtime/components/Kbd.vue.d.ts +34 -0
- package/dist/runtime/components/Link.vue +98 -176
- package/dist/runtime/components/Link.vue.d.ts +93 -0
- package/dist/runtime/components/LinkBase.vue +33 -42
- package/dist/runtime/components/LinkBase.vue.d.ts +25 -0
- package/dist/runtime/components/Modal.vue +53 -116
- package/dist/runtime/components/Modal.vue.d.ts +93 -0
- package/dist/runtime/components/NavigationMenu.vue +77 -209
- package/dist/runtime/components/NavigationMenu.vue.d.ts +139 -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 +119 -0
- package/dist/runtime/components/PinInput.vue +61 -78
- package/dist/runtime/components/PinInput.vue.d.ts +57 -0
- package/dist/runtime/components/Popover.vue +47 -84
- package/dist/runtime/components/Popover.vue.d.ts +63 -0
- package/dist/runtime/components/Progress.vue +70 -131
- package/dist/runtime/components/Progress.vue.d.ts +66 -0
- package/dist/runtime/components/RadioGroup.vue +70 -132
- package/dist/runtime/components/RadioGroup.vue.d.ts +91 -0
- package/dist/runtime/components/Select.vue +110 -224
- package/dist/runtime/components/Select.vue.d.ts +145 -0
- package/dist/runtime/components/SelectMenu.vue +161 -310
- package/dist/runtime/components/SelectMenu.vue.d.ts +196 -0
- package/dist/runtime/components/Separator.vue +29 -71
- package/dist/runtime/components/Separator.vue.d.ts +54 -0
- package/dist/runtime/components/Skeleton.vue +21 -23
- package/dist/runtime/components/Skeleton.vue.d.ts +17 -0
- package/dist/runtime/components/Slideover.vue +53 -120
- package/dist/runtime/components/Slideover.vue.d.ts +94 -0
- package/dist/runtime/components/Slider.vue +46 -84
- package/dist/runtime/components/Slider.vue.d.ts +52 -0
- package/dist/runtime/components/Stepper.vue +45 -115
- package/dist/runtime/components/Stepper.vue.d.ts +83 -0
- package/dist/runtime/components/Switch.vue +45 -93
- package/dist/runtime/components/Switch.vue.d.ts +70 -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 +88 -0
- package/dist/runtime/components/Textarea.vue +113 -158
- package/dist/runtime/components/Textarea.vue.d.ts +78 -0
- package/dist/runtime/components/Toast.vue +49 -110
- package/dist/runtime/components/Toast.vue.d.ts +157 -0
- package/dist/runtime/components/Toaster.vue +70 -107
- package/dist/runtime/components/Toaster.vue.d.ts +38 -0
- package/dist/runtime/components/Tooltip.vue +38 -65
- package/dist/runtime/components/Tooltip.vue.d.ts +50 -0
- package/dist/runtime/components/Tree.vue +59 -166
- package/dist/runtime/components/Tree.vue.d.ts +111 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/defineShortcuts.js +6 -0
- 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/useKbd.d.ts +1 -0
- package/dist/runtime/composables/useKbd.js +4 -3
- package/dist/runtime/composables/useOverlay.d.ts +14 -8
- package/dist/runtime/composables/useOverlay.js +20 -7
- 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 +63 -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/tv.d.ts +53 -0
- package/dist/runtime/types/tv.js +0 -0
- package/dist/runtime/types/utils.d.ts +7 -17
- package/dist/runtime/types/utils.js +1 -0
- 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 +5 -0
- package/dist/runtime/vue/components/Link.vue +118 -202
- package/dist/runtime/vue/components/Link.vue.d.ts +93 -0
- package/dist/runtime/vue/stubs.d.ts +2 -2
- package/dist/shared/{ui.BkNUP964.mjs → ui.CbtTMMzt.mjs} +631 -366
- package/dist/types.d.mts +3 -5
- package/dist/unplugin.d.mts +6 -2
- package/dist/unplugin.mjs +25 -4
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +96 -54
- 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,157 @@
|
|
|
1
|
+
import type { ToastRootProps, ToastRootEmits } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/ui/toast';
|
|
4
|
+
import type { AvatarProps, ButtonProps } from '../types';
|
|
5
|
+
import type { StringOrVNode, ComponentConfig } from '../types/utils';
|
|
6
|
+
type Toast = ComponentConfig<typeof theme, AppConfig, 'toast'>;
|
|
7
|
+
export interface ToastProps extends Pick<ToastRootProps, 'defaultOpen' | 'open' | 'type' | 'duration'> {
|
|
8
|
+
/**
|
|
9
|
+
* The element or component this component should render as.
|
|
10
|
+
* @defaultValue 'li'
|
|
11
|
+
*/
|
|
12
|
+
as?: any;
|
|
13
|
+
title?: StringOrVNode;
|
|
14
|
+
description?: StringOrVNode;
|
|
15
|
+
/**
|
|
16
|
+
* @IconifyIcon
|
|
17
|
+
*/
|
|
18
|
+
icon?: string;
|
|
19
|
+
avatar?: AvatarProps;
|
|
20
|
+
/**
|
|
21
|
+
* @defaultValue 'primary'
|
|
22
|
+
*/
|
|
23
|
+
color?: Toast['variants']['color'];
|
|
24
|
+
/**
|
|
25
|
+
* The orientation between the content and the actions.
|
|
26
|
+
* @defaultValue 'vertical'
|
|
27
|
+
*/
|
|
28
|
+
orientation?: Toast['variants']['orientation'];
|
|
29
|
+
/**
|
|
30
|
+
* Display a list of actions:
|
|
31
|
+
* - under the title and description when orientation is `vertical`
|
|
32
|
+
* - next to the close button when orientation is `horizontal`
|
|
33
|
+
* `{ size: 'xs' }`{lang="ts-type"}
|
|
34
|
+
*/
|
|
35
|
+
actions?: ButtonProps[];
|
|
36
|
+
/**
|
|
37
|
+
* Display a close button to dismiss the toast.
|
|
38
|
+
* `{ size: 'md', color: 'neutral', variant: 'link' }`{lang="ts-type"}
|
|
39
|
+
* @defaultValue true
|
|
40
|
+
*/
|
|
41
|
+
close?: boolean | Partial<ButtonProps>;
|
|
42
|
+
/**
|
|
43
|
+
* The icon displayed in the close button.
|
|
44
|
+
* @defaultValue appConfig.ui.icons.close
|
|
45
|
+
* @IconifyIcon
|
|
46
|
+
*/
|
|
47
|
+
closeIcon?: string;
|
|
48
|
+
class?: any;
|
|
49
|
+
ui?: Toast['slots'];
|
|
50
|
+
}
|
|
51
|
+
export interface ToastEmits extends ToastRootEmits {
|
|
52
|
+
}
|
|
53
|
+
export interface ToastSlots {
|
|
54
|
+
leading(props?: {}): any;
|
|
55
|
+
title(props?: {}): any;
|
|
56
|
+
description(props?: {}): any;
|
|
57
|
+
actions(props?: {}): any;
|
|
58
|
+
close(props: {
|
|
59
|
+
ui: {
|
|
60
|
+
[K in keyof Required<Toast['slots']>]: (props?: Record<string, any>) => string;
|
|
61
|
+
};
|
|
62
|
+
}): any;
|
|
63
|
+
}
|
|
64
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ToastProps, {
|
|
65
|
+
height: import("vue").Ref<number, number>;
|
|
66
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
67
|
+
resume: () => any;
|
|
68
|
+
pause: () => any;
|
|
69
|
+
"update:open": (value: boolean) => any;
|
|
70
|
+
escapeKeyDown: (event: KeyboardEvent) => any;
|
|
71
|
+
swipeStart: (event: {
|
|
72
|
+
currentTarget: EventTarget & HTMLElement;
|
|
73
|
+
} & Omit<CustomEvent<{
|
|
74
|
+
originalEvent: PointerEvent;
|
|
75
|
+
delta: {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
};
|
|
79
|
+
}>, "currentTarget">) => any;
|
|
80
|
+
swipeMove: (event: {
|
|
81
|
+
currentTarget: EventTarget & HTMLElement;
|
|
82
|
+
} & Omit<CustomEvent<{
|
|
83
|
+
originalEvent: PointerEvent;
|
|
84
|
+
delta: {
|
|
85
|
+
x: number;
|
|
86
|
+
y: number;
|
|
87
|
+
};
|
|
88
|
+
}>, "currentTarget">) => any;
|
|
89
|
+
swipeCancel: (event: {
|
|
90
|
+
currentTarget: EventTarget & HTMLElement;
|
|
91
|
+
} & Omit<CustomEvent<{
|
|
92
|
+
originalEvent: PointerEvent;
|
|
93
|
+
delta: {
|
|
94
|
+
x: number;
|
|
95
|
+
y: number;
|
|
96
|
+
};
|
|
97
|
+
}>, "currentTarget">) => any;
|
|
98
|
+
swipeEnd: (event: {
|
|
99
|
+
currentTarget: EventTarget & HTMLElement;
|
|
100
|
+
} & Omit<CustomEvent<{
|
|
101
|
+
originalEvent: PointerEvent;
|
|
102
|
+
delta: {
|
|
103
|
+
x: number;
|
|
104
|
+
y: number;
|
|
105
|
+
};
|
|
106
|
+
}>, "currentTarget">) => any;
|
|
107
|
+
}, string, import("vue").PublicProps, Readonly<ToastProps> & Readonly<{
|
|
108
|
+
onResume?: (() => any) | undefined;
|
|
109
|
+
onPause?: (() => any) | undefined;
|
|
110
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
111
|
+
onEscapeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
|
|
112
|
+
onSwipeStart?: ((event: {
|
|
113
|
+
currentTarget: EventTarget & HTMLElement;
|
|
114
|
+
} & Omit<CustomEvent<{
|
|
115
|
+
originalEvent: PointerEvent;
|
|
116
|
+
delta: {
|
|
117
|
+
x: number;
|
|
118
|
+
y: number;
|
|
119
|
+
};
|
|
120
|
+
}>, "currentTarget">) => any) | undefined;
|
|
121
|
+
onSwipeMove?: ((event: {
|
|
122
|
+
currentTarget: EventTarget & HTMLElement;
|
|
123
|
+
} & Omit<CustomEvent<{
|
|
124
|
+
originalEvent: PointerEvent;
|
|
125
|
+
delta: {
|
|
126
|
+
x: number;
|
|
127
|
+
y: number;
|
|
128
|
+
};
|
|
129
|
+
}>, "currentTarget">) => any) | undefined;
|
|
130
|
+
onSwipeCancel?: ((event: {
|
|
131
|
+
currentTarget: EventTarget & HTMLElement;
|
|
132
|
+
} & Omit<CustomEvent<{
|
|
133
|
+
originalEvent: PointerEvent;
|
|
134
|
+
delta: {
|
|
135
|
+
x: number;
|
|
136
|
+
y: number;
|
|
137
|
+
};
|
|
138
|
+
}>, "currentTarget">) => any) | undefined;
|
|
139
|
+
onSwipeEnd?: ((event: {
|
|
140
|
+
currentTarget: EventTarget & HTMLElement;
|
|
141
|
+
} & Omit<CustomEvent<{
|
|
142
|
+
originalEvent: PointerEvent;
|
|
143
|
+
delta: {
|
|
144
|
+
x: number;
|
|
145
|
+
y: number;
|
|
146
|
+
};
|
|
147
|
+
}>, "currentTarget">) => any) | undefined;
|
|
148
|
+
}>, {
|
|
149
|
+
close: boolean | Partial<ButtonProps>;
|
|
150
|
+
orientation: Toast["variants"]["orientation"];
|
|
151
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ToastSlots>;
|
|
152
|
+
export default _default;
|
|
153
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
154
|
+
new (): {
|
|
155
|
+
$slots: S;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
@@ -1,104 +1,67 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import type { ToastProviderProps } from 'reka-ui'
|
|
4
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
-
import _appConfig from '#build/app.config'
|
|
6
|
-
import theme from '#build/ui/toaster'
|
|
7
|
-
import { tv } from '../utils/tv'
|
|
8
|
-
|
|
9
|
-
const appConfigToaster = _appConfig as AppConfig & { ui: { toaster: Partial<typeof theme> } }
|
|
10
|
-
|
|
11
|
-
const toaster = tv({ extend: tv(theme), ...(appConfigToaster.ui?.toaster || {}) })
|
|
12
|
-
|
|
13
|
-
type ToasterVariants = VariantProps<typeof toaster>
|
|
14
|
-
|
|
15
|
-
export interface ToasterProps extends Omit<ToastProviderProps, 'swipeDirection'> {
|
|
16
|
-
/**
|
|
17
|
-
* The position on the screen to display the toasts.
|
|
18
|
-
* @defaultValue 'bottom-right'
|
|
19
|
-
*/
|
|
20
|
-
position?: ToasterVariants['position']
|
|
21
|
-
/**
|
|
22
|
-
* Expand the toasts to show multiple toasts at once.
|
|
23
|
-
* @defaultValue true
|
|
24
|
-
*/
|
|
25
|
-
expand?: boolean
|
|
26
|
-
/**
|
|
27
|
-
* Render the toaster in a portal.
|
|
28
|
-
* @defaultValue true
|
|
29
|
-
*/
|
|
30
|
-
portal?: boolean
|
|
31
|
-
class?: any
|
|
32
|
-
ui?: Partial<typeof toaster.slots>
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface ToasterSlots {
|
|
36
|
-
default(props?: {}): any
|
|
37
|
-
}
|
|
38
|
-
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/toaster";
|
|
39
3
|
export default {
|
|
40
|
-
name:
|
|
41
|
-
}
|
|
4
|
+
name: "Toaster"
|
|
5
|
+
};
|
|
42
6
|
</script>
|
|
43
7
|
|
|
44
|
-
<script setup
|
|
45
|
-
import { ref, computed } from
|
|
46
|
-
import { ToastProvider, ToastViewport, ToastPortal, useForwardProps } from
|
|
47
|
-
import { reactivePick } from
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
8
|
+
<script setup>
|
|
9
|
+
import { ref, computed, toRef } from "vue";
|
|
10
|
+
import { ToastProvider, ToastViewport, ToastPortal, useForwardProps } from "reka-ui";
|
|
11
|
+
import { reactivePick } from "@vueuse/core";
|
|
12
|
+
import { useAppConfig } from "#imports";
|
|
13
|
+
import { useToast } from "../composables/useToast";
|
|
14
|
+
import { usePortal } from "../composables/usePortal";
|
|
15
|
+
import { omit } from "../utils";
|
|
16
|
+
import { tv } from "../utils/tv";
|
|
17
|
+
import UToast from "./Toast.vue";
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
position: { type: null, required: false },
|
|
20
|
+
expand: { type: Boolean, required: false, default: true },
|
|
21
|
+
portal: { type: [Boolean, String], required: false, skipCheck: true, default: true },
|
|
22
|
+
class: { type: null, required: false },
|
|
23
|
+
ui: { type: null, required: false },
|
|
24
|
+
label: { type: String, required: false },
|
|
25
|
+
duration: { type: Number, required: false, default: 5e3 },
|
|
26
|
+
swipeThreshold: { type: Number, required: false }
|
|
27
|
+
});
|
|
28
|
+
defineSlots();
|
|
29
|
+
const { toasts, remove } = useToast();
|
|
30
|
+
const appConfig = useAppConfig();
|
|
31
|
+
const providerProps = useForwardProps(reactivePick(props, "duration", "label", "swipeThreshold"));
|
|
32
|
+
const portalProps = usePortal(toRef(() => props.portal));
|
|
63
33
|
const swipeDirection = computed(() => {
|
|
64
34
|
switch (props.position) {
|
|
65
|
-
case
|
|
66
|
-
return
|
|
67
|
-
case
|
|
68
|
-
case
|
|
69
|
-
return
|
|
70
|
-
case
|
|
71
|
-
return
|
|
72
|
-
case
|
|
73
|
-
case
|
|
74
|
-
return
|
|
35
|
+
case "top-center":
|
|
36
|
+
return "up";
|
|
37
|
+
case "top-right":
|
|
38
|
+
case "bottom-right":
|
|
39
|
+
return "right";
|
|
40
|
+
case "bottom-center":
|
|
41
|
+
return "down";
|
|
42
|
+
case "top-left":
|
|
43
|
+
case "bottom-left":
|
|
44
|
+
return "left";
|
|
75
45
|
}
|
|
76
|
-
return
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
const ui = computed(() => toaster({
|
|
46
|
+
return "right";
|
|
47
|
+
});
|
|
48
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.toaster || {} })({
|
|
80
49
|
position: props.position,
|
|
81
50
|
swipeDirection: swipeDirection.value
|
|
82
|
-
}))
|
|
83
|
-
|
|
84
|
-
function onUpdateOpen(value: boolean, id: string | number) {
|
|
51
|
+
}));
|
|
52
|
+
function onUpdateOpen(value, id) {
|
|
85
53
|
if (value) {
|
|
86
|
-
return
|
|
54
|
+
return;
|
|
87
55
|
}
|
|
88
|
-
|
|
89
|
-
remove(id)
|
|
56
|
+
remove(id);
|
|
90
57
|
}
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const frontHeight = computed(() => refs.value[refs.value.length - 1]?.height || 0)
|
|
99
|
-
|
|
100
|
-
function getOffset(index: number) {
|
|
101
|
-
return refs.value.slice(index + 1).reduce((acc, { height }) => acc + height + 16, 0)
|
|
58
|
+
const hovered = ref(false);
|
|
59
|
+
const expanded = computed(() => props.expand || hovered.value);
|
|
60
|
+
const refs = ref([]);
|
|
61
|
+
const height = computed(() => refs.value.reduce((acc, { height: height2 }) => acc + height2 + 16, 0));
|
|
62
|
+
const frontHeight = computed(() => refs.value[refs.value.length - 1]?.height || 0);
|
|
63
|
+
function getOffset(index) {
|
|
64
|
+
return refs.value.slice(index + 1).reduce((acc, { height: height2 }) => acc + height2 + 16, 0);
|
|
102
65
|
}
|
|
103
66
|
</script>
|
|
104
67
|
|
|
@@ -111,35 +74,35 @@ function getOffset(index: number) {
|
|
|
111
74
|
:key="toast.id"
|
|
112
75
|
ref="refs"
|
|
113
76
|
v-bind="omit(toast, ['id', 'close'])"
|
|
114
|
-
:close="
|
|
77
|
+
:close="toast.close"
|
|
115
78
|
:data-expanded="expanded"
|
|
116
79
|
:data-front="!expanded && index === toasts.length - 1"
|
|
117
80
|
:style="{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
81
|
+
'--index': index - toasts.length + toasts.length,
|
|
82
|
+
'--before': toasts.length - 1 - index,
|
|
83
|
+
'--offset': getOffset(index),
|
|
84
|
+
'--scale': expanded ? '1' : 'calc(1 - var(--before) * var(--scale-factor))',
|
|
85
|
+
'--translate': expanded ? 'calc(var(--offset) * var(--translate-factor))' : 'calc(var(--before) * var(--gap))',
|
|
86
|
+
'--transform': 'translateY(var(--translate)) scale(var(--scale))'
|
|
87
|
+
}"
|
|
125
88
|
:class="[ui.base(), {
|
|
126
|
-
|
|
127
|
-
|
|
89
|
+
'cursor-pointer': !!toast.onClick
|
|
90
|
+
}]"
|
|
128
91
|
@update:open="onUpdateOpen($event, toast.id)"
|
|
129
92
|
@click="toast.onClick && toast.onClick(toast)"
|
|
130
93
|
/>
|
|
131
94
|
|
|
132
|
-
<ToastPortal
|
|
95
|
+
<ToastPortal v-bind="portalProps">
|
|
133
96
|
<ToastViewport
|
|
134
97
|
:data-expanded="expanded"
|
|
135
98
|
:class="ui.viewport({ class: [props.class, props.ui?.viewport] })"
|
|
136
99
|
:style="{
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
100
|
+
'--scale-factor': '0.05',
|
|
101
|
+
'--translate-factor': position?.startsWith('top') ? '1px' : '-1px',
|
|
102
|
+
'--gap': position?.startsWith('top') ? '16px' : '-16px',
|
|
103
|
+
'--front-height': `${frontHeight}px`,
|
|
104
|
+
'--height': `${height}px`
|
|
105
|
+
}"
|
|
143
106
|
@mouseenter="hovered = true"
|
|
144
107
|
@mouseleave="hovered = false"
|
|
145
108
|
/>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ToastProviderProps } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/ui/toaster';
|
|
4
|
+
import type { ComponentConfig } from '../types/utils';
|
|
5
|
+
type Toaster = ComponentConfig<typeof theme, AppConfig, 'toaster'>;
|
|
6
|
+
export interface ToasterProps extends Omit<ToastProviderProps, 'swipeDirection'> {
|
|
7
|
+
/**
|
|
8
|
+
* The position on the screen to display the toasts.
|
|
9
|
+
* @defaultValue 'bottom-right'
|
|
10
|
+
*/
|
|
11
|
+
position?: Toaster['variants']['position'];
|
|
12
|
+
/**
|
|
13
|
+
* Expand the toasts to show multiple toasts at once.
|
|
14
|
+
* @defaultValue true
|
|
15
|
+
*/
|
|
16
|
+
expand?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Render the toaster in a portal.
|
|
19
|
+
* @defaultValue true
|
|
20
|
+
*/
|
|
21
|
+
portal?: boolean | string | HTMLElement;
|
|
22
|
+
class?: any;
|
|
23
|
+
ui?: Toaster['slots'];
|
|
24
|
+
}
|
|
25
|
+
export interface ToasterSlots {
|
|
26
|
+
default(props?: {}): any;
|
|
27
|
+
}
|
|
28
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ToasterProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ToasterProps> & Readonly<{}>, {
|
|
29
|
+
duration: number;
|
|
30
|
+
expand: boolean;
|
|
31
|
+
portal: boolean | string | HTMLElement;
|
|
32
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ToasterSlots>;
|
|
33
|
+
export default _default;
|
|
34
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
35
|
+
new (): {
|
|
36
|
+
$slots: S;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -1,69 +1,42 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
-
import _appConfig from '#build/app.config'
|
|
5
|
-
import theme from '#build/ui/tooltip'
|
|
6
|
-
import { tv } from '../utils/tv'
|
|
7
|
-
import type { KbdProps } from '../types'
|
|
8
|
-
import type { EmitsToProps } from '../types/utils'
|
|
9
|
-
|
|
10
|
-
const appConfigTooltip = _appConfig as AppConfig & { ui: { tooltip: Partial<typeof theme> } }
|
|
11
|
-
|
|
12
|
-
const tooltip = tv({ extend: tv(theme), ...(appConfigTooltip.ui?.tooltip || {}) })
|
|
13
|
-
|
|
14
|
-
export interface TooltipProps extends TooltipRootProps {
|
|
15
|
-
/** The text content of the tooltip. */
|
|
16
|
-
text?: string
|
|
17
|
-
/** The keyboard keys to display in the tooltip. */
|
|
18
|
-
kbds?: KbdProps['value'][] | KbdProps[]
|
|
19
|
-
/**
|
|
20
|
-
* The content of the tooltip.
|
|
21
|
-
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
|
|
22
|
-
*/
|
|
23
|
-
content?: Omit<TooltipContentProps, 'as' | 'asChild'> & Partial<EmitsToProps<TooltipContentEmits>>
|
|
24
|
-
/**
|
|
25
|
-
* Display an arrow alongside the tooltip.
|
|
26
|
-
* @defaultValue false
|
|
27
|
-
*/
|
|
28
|
-
arrow?: boolean | Omit<TooltipArrowProps, 'as' | 'asChild'>
|
|
29
|
-
/**
|
|
30
|
-
* Render the tooltip in a portal.
|
|
31
|
-
* @defaultValue true
|
|
32
|
-
*/
|
|
33
|
-
portal?: boolean
|
|
34
|
-
class?: any
|
|
35
|
-
ui?: Partial<typeof tooltip.slots>
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface TooltipEmits extends TooltipRootEmits {}
|
|
39
|
-
|
|
40
|
-
export interface TooltipSlots {
|
|
41
|
-
default(props: { open: boolean }): any
|
|
42
|
-
content(props?: {}): any
|
|
43
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/tooltip";
|
|
44
3
|
</script>
|
|
45
4
|
|
|
46
|
-
<script setup
|
|
47
|
-
import { computed, toRef } from
|
|
48
|
-
import { defu } from
|
|
49
|
-
import { TooltipRoot, TooltipTrigger, TooltipPortal, TooltipContent, TooltipArrow, useForwardPropsEmits } from
|
|
50
|
-
import { reactivePick } from
|
|
51
|
-
import
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed, toRef } from "vue";
|
|
7
|
+
import { defu } from "defu";
|
|
8
|
+
import { TooltipRoot, TooltipTrigger, TooltipPortal, TooltipContent, TooltipArrow, useForwardPropsEmits } from "reka-ui";
|
|
9
|
+
import { reactivePick } from "@vueuse/core";
|
|
10
|
+
import { useAppConfig } from "#imports";
|
|
11
|
+
import { usePortal } from "../composables/usePortal";
|
|
12
|
+
import { tv } from "../utils/tv";
|
|
13
|
+
import UKbd from "./Kbd.vue";
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
text: { type: String, required: false },
|
|
16
|
+
kbds: { type: Array, required: false },
|
|
17
|
+
content: { type: Object, required: false },
|
|
18
|
+
arrow: { type: [Boolean, Object], required: false },
|
|
19
|
+
portal: { type: [Boolean, String], required: false, skipCheck: true, default: true },
|
|
20
|
+
class: { type: null, required: false },
|
|
21
|
+
ui: { type: null, required: false },
|
|
22
|
+
defaultOpen: { type: Boolean, required: false },
|
|
23
|
+
open: { type: Boolean, required: false },
|
|
24
|
+
delayDuration: { type: Number, required: false },
|
|
25
|
+
disableHoverableContent: { type: Boolean, required: false },
|
|
26
|
+
disableClosingTrigger: { type: Boolean, required: false },
|
|
27
|
+
disabled: { type: Boolean, required: false },
|
|
28
|
+
ignoreNonKeyboardFocus: { type: Boolean, required: false }
|
|
29
|
+
});
|
|
30
|
+
const emits = defineEmits(["update:open"]);
|
|
31
|
+
const slots = defineSlots();
|
|
32
|
+
const appConfig = useAppConfig();
|
|
33
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "defaultOpen", "open", "delayDuration", "disableHoverableContent", "disableClosingTrigger", "disabled", "ignoreNonKeyboardFocus"), emits);
|
|
34
|
+
const portalProps = usePortal(toRef(() => props.portal));
|
|
35
|
+
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8 }));
|
|
36
|
+
const arrowProps = toRef(() => props.arrow);
|
|
37
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.tooltip || {} })({
|
|
65
38
|
side: contentProps.value.side
|
|
66
|
-
}))
|
|
39
|
+
}));
|
|
67
40
|
</script>
|
|
68
41
|
|
|
69
42
|
<template>
|
|
@@ -72,13 +45,13 @@ const ui = computed(() => tooltip({
|
|
|
72
45
|
<slot :open="open" />
|
|
73
46
|
</TooltipTrigger>
|
|
74
47
|
|
|
75
|
-
<TooltipPortal
|
|
48
|
+
<TooltipPortal v-bind="portalProps">
|
|
76
49
|
<TooltipContent v-bind="contentProps" :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })">
|
|
77
50
|
<slot name="content">
|
|
78
51
|
<span v-if="text" :class="ui.text({ class: props.ui?.text })">{{ text }}</span>
|
|
79
52
|
|
|
80
53
|
<span v-if="kbds?.length" :class="ui.kbds({ class: props.ui?.kbds })">
|
|
81
|
-
<UKbd v-for="(kbd, index) in kbds" :key="index" :size="
|
|
54
|
+
<UKbd v-for="(kbd, index) in kbds" :key="index" :size="props.ui?.kbdsSize || ui.kbdsSize()" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
|
82
55
|
</span>
|
|
83
56
|
</slot>
|
|
84
57
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { TooltipRootProps, TooltipRootEmits, TooltipContentProps, TooltipContentEmits, TooltipArrowProps } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/ui/tooltip';
|
|
4
|
+
import type { KbdProps } from '../types';
|
|
5
|
+
import type { EmitsToProps, ComponentConfig } from '../types/utils';
|
|
6
|
+
type Tooltip = ComponentConfig<typeof theme, AppConfig, 'tooltip'>;
|
|
7
|
+
export interface TooltipProps extends TooltipRootProps {
|
|
8
|
+
/** The text content of the tooltip. */
|
|
9
|
+
text?: string;
|
|
10
|
+
/** The keyboard keys to display in the tooltip. */
|
|
11
|
+
kbds?: KbdProps['value'][] | KbdProps[];
|
|
12
|
+
/**
|
|
13
|
+
* The content of the tooltip.
|
|
14
|
+
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
|
|
15
|
+
*/
|
|
16
|
+
content?: Omit<TooltipContentProps, 'as' | 'asChild'> & Partial<EmitsToProps<TooltipContentEmits>>;
|
|
17
|
+
/**
|
|
18
|
+
* Display an arrow alongside the tooltip.
|
|
19
|
+
* @defaultValue false
|
|
20
|
+
*/
|
|
21
|
+
arrow?: boolean | Omit<TooltipArrowProps, 'as' | 'asChild'>;
|
|
22
|
+
/**
|
|
23
|
+
* Render the tooltip in a portal.
|
|
24
|
+
* @defaultValue true
|
|
25
|
+
*/
|
|
26
|
+
portal?: boolean | string | HTMLElement;
|
|
27
|
+
class?: any;
|
|
28
|
+
ui?: Tooltip['slots'];
|
|
29
|
+
}
|
|
30
|
+
export interface TooltipEmits extends TooltipRootEmits {
|
|
31
|
+
}
|
|
32
|
+
export interface TooltipSlots {
|
|
33
|
+
default(props: {
|
|
34
|
+
open: boolean;
|
|
35
|
+
}): any;
|
|
36
|
+
content(props?: {}): any;
|
|
37
|
+
}
|
|
38
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<TooltipProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
39
|
+
"update:open": (value: boolean) => any;
|
|
40
|
+
}, string, import("vue").PublicProps, Readonly<TooltipProps> & Readonly<{
|
|
41
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
42
|
+
}>, {
|
|
43
|
+
portal: boolean | string | HTMLElement;
|
|
44
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, TooltipSlots>;
|
|
45
|
+
export default _default;
|
|
46
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
47
|
+
new (): {
|
|
48
|
+
$slots: S;
|
|
49
|
+
};
|
|
50
|
+
};
|