@privyid/persona 0.16.0 → 0.17.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/dist/components/avatar/Avatar.vue.d.ts +3 -3
- package/dist/components/button/Button.vue.d.ts +2 -2
- package/dist/components/card/Card.vue +8 -5
- package/dist/components/carousel/Carousel.vue +197 -0
- package/dist/components/carousel/Carousel.vue.d.ts +111 -0
- package/dist/components/carousel/CarouselBody.vue +25 -0
- package/dist/components/carousel/CarouselBody.vue.d.ts +2 -0
- package/dist/components/carousel/CarouselItem.vue +15 -0
- package/dist/components/carousel/CarouselItem.vue.d.ts +2 -0
- package/dist/components/carousel/index.d.ts +4 -0
- package/dist/components/carousel/index.mjs +1 -0
- package/dist/components/checkbox/Checkbox.vue +2 -2
- package/dist/components/checkbox/Checkbox.vue.d.ts +6 -6
- package/dist/components/contextual-bar/ContextualBar.vue.d.ts +2 -2
- package/dist/components/cropper/Cropper.vue.d.ts +2 -2
- package/dist/components/cropper/utils/use-ratio.d.ts +1 -1
- package/dist/components/cropper/utils/use-ratio.mjs +2 -2
- package/dist/components/datepicker/Datepicker.vue +1 -0
- package/dist/components/dropdown/Dropdown.vue +11 -1
- package/dist/components/dropdown/Dropdown.vue.d.ts +13 -4
- package/dist/components/dropdown/DropdownHeader.vue +35 -0
- package/dist/components/dropdown/DropdownHeader.vue.d.ts +2 -0
- package/dist/components/filterbar/pinned/PinnedSelect.vue.d.ts +2 -2
- package/dist/components/filterbar/pinned/PinnedToggle.vue.d.ts +6 -6
- package/dist/components/form-group/FormGroup.vue +16 -5
- package/dist/components/input/Input.vue +4 -3
- package/dist/components/input/Input.vue.d.ts +4 -4
- package/dist/components/input/index.mjs +1 -1
- package/dist/components/input-file/InputFile.vue.d.ts +2 -2
- package/dist/components/input-group/InputGroup.vue.d.ts +1 -1
- package/dist/components/input-password/InputPassword.vue +5 -5
- package/dist/components/input-pin/InputPin.vue +3 -3
- package/dist/components/input-pin/InputPin.vue.d.ts +3 -3
- package/dist/components/input-range/InputRange.vue.d.ts +1 -1
- package/dist/components/label/Label.vue.d.ts +1 -1
- package/dist/components/list-group/ListGroup.vue +51 -0
- package/dist/components/list-group/ListGroup.vue.d.ts +25 -0
- package/dist/components/list-group/ListGroupItem.vue +94 -0
- package/dist/components/list-group/ListGroupItem.vue.d.ts +37 -0
- package/dist/components/list-group/index.d.ts +1 -0
- package/dist/components/list-group/index.mjs +0 -0
- package/dist/components/modal/Modal.vue.d.ts +1 -1
- package/dist/components/nav/Nav.vue.d.ts +1 -1
- package/dist/components/nav/NavItem.vue +1 -1
- package/dist/components/nav/NavItem.vue.d.ts +2 -2
- package/dist/components/nav/NavItemDropdown.vue +6 -1
- package/dist/components/nav/NavItemDropdown.vue.d.ts +12 -3
- package/dist/components/navbar/Navbar.vue +2 -1
- package/dist/components/pdf-object/PdfObject.vue.d.ts +1 -1
- package/dist/components/pdf-text/PdfText.vue.d.ts +3 -3
- package/dist/components/pdf-viewer/PdfViewer.vue.d.ts +1 -1
- package/dist/components/progress-indicator/ProgressIndicator.vue +125 -0
- package/dist/components/progress-indicator/ProgressIndicator.vue.d.ts +42 -0
- package/dist/components/radio/Radio.vue +2 -2
- package/dist/components/radio/Radio.vue.d.ts +4 -4
- package/dist/components/select/Select.vue.d.ts +3 -3
- package/dist/components/sidebar-menu/SidebarMenu.vue +139 -2
- package/dist/components/sidebar-menu/SidebarMenu.vue.d.ts +31 -1
- package/dist/components/sidebar-menu/index.d.ts +3 -0
- package/dist/components/signature-draw/SignatureDraw.vue +5 -6
- package/dist/components/signature-draw/SignatureDraw.vue.d.ts +0 -1
- package/dist/components/signature-text/SignatureText.vue.d.ts +1 -1
- package/dist/components/steps/StepSlider.vue +6 -8
- package/dist/components/steps/StepSlider.vue.d.ts +9 -0
- package/dist/components/steps/Steps.vue +28 -9
- package/dist/components/steps/Steps.vue.d.ts +30 -2
- package/dist/components/steps/index.d.ts +2 -0
- package/dist/components/tabs/Tabs.vue.d.ts +1 -1
- package/dist/components/text/Text.vue +4 -2
- package/dist/components/textarea/Textarea.vue +1 -1
- package/dist/components/textarea/Textarea.vue.d.ts +3 -3
- package/dist/components/toast/Toast.vue +18 -9
- package/dist/components/toast/ToastContainer.vue +116 -31
- package/dist/components/toast/ToastContainer.vue.d.ts +18 -3
- package/dist/components/toast/ToastRoot.vue +45 -0
- package/dist/components/toast/ToastRoot.vue.d.ts +13 -0
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/index.mjs +3 -3
- package/dist/components/toggle/Toggle.vue.d.ts +6 -6
- package/dist/components/tour/TourDialog.vue.d.ts +1 -1
- package/dist/components/truncate/Truncate.vue.d.ts +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -0
- package/package.json +6 -6
|
@@ -3,9 +3,7 @@ import {
|
|
|
3
3
|
defineComponent,
|
|
4
4
|
h,
|
|
5
5
|
KeepAlive,
|
|
6
|
-
|
|
7
|
-
Transition,
|
|
8
|
-
watch
|
|
6
|
+
Transition
|
|
9
7
|
} from "vue-demi";
|
|
10
8
|
import { findAllChildren } from "../utils/vnode";
|
|
11
9
|
export default defineComponent({
|
|
@@ -17,20 +15,20 @@ export default defineComponent({
|
|
|
17
15
|
keepAlive: {
|
|
18
16
|
type: Boolean,
|
|
19
17
|
default: false
|
|
18
|
+
},
|
|
19
|
+
transition: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "slide-left"
|
|
20
22
|
}
|
|
21
23
|
},
|
|
22
24
|
setup(props, { slots }) {
|
|
23
|
-
const transition = ref("slide-left");
|
|
24
|
-
watch(() => props.active, (value, old) => {
|
|
25
|
-
transition.value = value > old ? "slide-left" : "slide-right";
|
|
26
|
-
});
|
|
27
25
|
return () => {
|
|
28
26
|
const step = findAllChildren(slots.default(), "Step").at(props.active);
|
|
29
27
|
const body = () => {
|
|
30
28
|
return props.keepAlive ? h(KeepAlive, () => h(step, { key: props.active })) : h(step, { key: props.active });
|
|
31
29
|
};
|
|
32
30
|
return h(Transition, {
|
|
33
|
-
name: transition
|
|
31
|
+
name: props.transition,
|
|
34
32
|
mode: "out-in"
|
|
35
33
|
}, body);
|
|
36
34
|
};
|
|
@@ -7,6 +7,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
7
7
|
type: BooleanConstructor;
|
|
8
8
|
default: boolean;
|
|
9
9
|
};
|
|
10
|
+
transition: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
10
14
|
}, () => import("vue-demi").VNode<import("vue-demi").RendererNode, import("vue-demi").RendererElement, {
|
|
11
15
|
[key: string]: any;
|
|
12
16
|
}>, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
@@ -18,8 +22,13 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
18
22
|
type: BooleanConstructor;
|
|
19
23
|
default: boolean;
|
|
20
24
|
};
|
|
25
|
+
transition: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
default: string;
|
|
28
|
+
};
|
|
21
29
|
}>>, {
|
|
22
30
|
active: number;
|
|
31
|
+
transition: string;
|
|
23
32
|
keepAlive: boolean;
|
|
24
33
|
}, {}>;
|
|
25
34
|
export default _default;
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
class="steps"
|
|
4
4
|
data-testid="steps">
|
|
5
5
|
<StepSlider
|
|
6
|
-
:active="
|
|
7
|
-
:keep-alive="keepAlive"
|
|
6
|
+
:active="step - 1"
|
|
7
|
+
:keep-alive="keepAlive"
|
|
8
|
+
:transition="transition">
|
|
8
9
|
<slot />
|
|
9
10
|
</StepSlider>
|
|
10
11
|
</div>
|
|
@@ -38,6 +39,18 @@ export default defineComponent({
|
|
|
38
39
|
type: Boolean,
|
|
39
40
|
default: false
|
|
40
41
|
},
|
|
42
|
+
direction: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: "horizontal"
|
|
45
|
+
},
|
|
46
|
+
loop: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
animation: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "slide"
|
|
53
|
+
},
|
|
41
54
|
onBeforePrev: {
|
|
42
55
|
type: Function,
|
|
43
56
|
default: () => true
|
|
@@ -60,15 +73,16 @@ export default defineComponent({
|
|
|
60
73
|
const onNextHooks = ref([props.onBeforeNext]);
|
|
61
74
|
const onPrevHooks = ref([props.onBeforePrev]);
|
|
62
75
|
const model = useVModel(props);
|
|
76
|
+
const transition = ref(props.direction === "vertical" ? "slide-top" : "slide-left");
|
|
63
77
|
const total = computed(() => {
|
|
64
78
|
return findAllChildren(slots.default(), "Step").length;
|
|
65
79
|
});
|
|
66
80
|
const step = useClamp(model, 1, total);
|
|
67
81
|
const canNext = computed(() => {
|
|
68
|
-
return model.value <= total.value;
|
|
82
|
+
return props.loop || model.value <= total.value;
|
|
69
83
|
});
|
|
70
84
|
const canPrev = computed(() => {
|
|
71
|
-
return model.value > 1;
|
|
85
|
+
return props.loop || model.value > 1;
|
|
72
86
|
});
|
|
73
87
|
async function next() {
|
|
74
88
|
if (canNext.value)
|
|
@@ -81,10 +95,12 @@ export default defineComponent({
|
|
|
81
95
|
async function toStep(to) {
|
|
82
96
|
const from = model.value;
|
|
83
97
|
const hooks = to > from ? onNextHooks.value : onPrevHooks.value;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
98
|
+
const toIndex = props.loop ? ((to - 1) % total.value + total.value) % total.value + 1 : to;
|
|
99
|
+
if (await runAllHooks(hooks, toIndex, from)) {
|
|
100
|
+
if (toIndex <= total.value) {
|
|
101
|
+
transition.value = to > from ? props.direction === "vertical" ? `${props.animation}-top` : `${props.animation}-left` : props.direction === "vertical" ? `${props.animation}-bottom` : `${props.animation}-right`;
|
|
102
|
+
step.value = toIndex;
|
|
103
|
+
} else
|
|
88
104
|
await props.onFinished();
|
|
89
105
|
}
|
|
90
106
|
}
|
|
@@ -99,7 +115,10 @@ export default defineComponent({
|
|
|
99
115
|
onPrevHooks,
|
|
100
116
|
onNextHooks
|
|
101
117
|
});
|
|
102
|
-
return {
|
|
118
|
+
return {
|
|
119
|
+
transition,
|
|
120
|
+
step
|
|
121
|
+
};
|
|
103
122
|
}
|
|
104
123
|
});
|
|
105
124
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropType } from 'vue-demi';
|
|
2
|
-
import { TravelHook, FinishedHook } from '.';
|
|
2
|
+
import { TravelHook, FinishedHook, DirectionVariant, AnimationVariant } from '.';
|
|
3
3
|
declare const _default: import("vue-demi").DefineComponent<{
|
|
4
4
|
modelValue: {
|
|
5
5
|
type: NumberConstructor;
|
|
@@ -9,6 +9,18 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
9
9
|
type: BooleanConstructor;
|
|
10
10
|
default: boolean;
|
|
11
11
|
};
|
|
12
|
+
direction: {
|
|
13
|
+
type: PropType<DirectionVariant>;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
loop: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
animation: {
|
|
21
|
+
type: PropType<AnimationVariant>;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
12
24
|
onBeforePrev: {
|
|
13
25
|
type: PropType<TravelHook>;
|
|
14
26
|
default: () => boolean;
|
|
@@ -22,7 +34,8 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
22
34
|
default: (...args: any[]) => void;
|
|
23
35
|
};
|
|
24
36
|
}, {
|
|
25
|
-
|
|
37
|
+
transition: import("vue-demi").Ref<string>;
|
|
38
|
+
step: import("vue-demi").Ref<number>;
|
|
26
39
|
}, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
27
40
|
modelValue: {
|
|
28
41
|
type: NumberConstructor;
|
|
@@ -32,6 +45,18 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
32
45
|
type: BooleanConstructor;
|
|
33
46
|
default: boolean;
|
|
34
47
|
};
|
|
48
|
+
direction: {
|
|
49
|
+
type: PropType<DirectionVariant>;
|
|
50
|
+
default: string;
|
|
51
|
+
};
|
|
52
|
+
loop: {
|
|
53
|
+
type: BooleanConstructor;
|
|
54
|
+
default: boolean;
|
|
55
|
+
};
|
|
56
|
+
animation: {
|
|
57
|
+
type: PropType<AnimationVariant>;
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
35
60
|
onBeforePrev: {
|
|
36
61
|
type: PropType<TravelHook>;
|
|
37
62
|
default: () => boolean;
|
|
@@ -48,6 +73,9 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
48
73
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
49
74
|
}, {
|
|
50
75
|
modelValue: number;
|
|
76
|
+
direction: DirectionVariant;
|
|
77
|
+
loop: boolean;
|
|
78
|
+
animation: AnimationVariant;
|
|
51
79
|
onBeforePrev: TravelHook;
|
|
52
80
|
onBeforeNext: TravelHook;
|
|
53
81
|
keepAlive: boolean;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ComputedRef, InjectionKey, Ref } from 'vue-demi';
|
|
2
2
|
export type TravelHook = (to: number, from: number) => boolean | Promise<boolean>;
|
|
3
3
|
export type FinishedHook = () => void | Promise<void>;
|
|
4
|
+
export type DirectionVariant = 'horizontal' | 'vertical';
|
|
5
|
+
export type AnimationVariant = 'slide' | 'slide-full';
|
|
4
6
|
export interface StepContext {
|
|
5
7
|
next: () => void;
|
|
6
8
|
prev: () => void;
|
|
@@ -72,8 +72,8 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
72
72
|
fill: boolean;
|
|
73
73
|
variant: TabsStyleVariant;
|
|
74
74
|
modelValue: number;
|
|
75
|
-
align: TabsAlignVariant;
|
|
76
75
|
vertical: boolean;
|
|
76
|
+
align: TabsAlignVariant;
|
|
77
77
|
justified: boolean;
|
|
78
78
|
navWrapperClass: string;
|
|
79
79
|
}, {}>;
|
|
@@ -169,10 +169,12 @@ export default defineComponent({
|
|
|
169
169
|
* Form Label Style
|
|
170
170
|
*/
|
|
171
171
|
&--formlabel {
|
|
172
|
-
@apply font-medium text-sm tracking-wide;
|
|
172
|
+
@apply font-medium text-sm tracking-wide text-subtle;
|
|
173
|
+
@apply dark:text-dark-subtle;
|
|
173
174
|
}
|
|
174
175
|
&--formlabel2 {
|
|
175
|
-
@apply font-medium text-xs leading-tightest;
|
|
176
|
+
@apply font-medium text-xs leading-tightest text-subtle;
|
|
177
|
+
@apply dark:text-dark-subtle;
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare const _default: import("vue-demi").DefineComponent<{
|
|
2
2
|
modelValue: {
|
|
3
3
|
type: StringConstructor;
|
|
4
|
-
default:
|
|
4
|
+
default: undefined;
|
|
5
5
|
};
|
|
6
6
|
placeholder: {
|
|
7
7
|
type: StringConstructor;
|
|
@@ -40,7 +40,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
40
40
|
default: undefined;
|
|
41
41
|
};
|
|
42
42
|
}, {
|
|
43
|
-
model: import("vue-demi").Ref<string>;
|
|
43
|
+
model: import("vue-demi").Ref<string | undefined>;
|
|
44
44
|
classNames: import("vue-demi").ComputedRef<string[]>;
|
|
45
45
|
handleInput: () => void;
|
|
46
46
|
charactersLength: import("vue-demi").ComputedRef<number | "0">;
|
|
@@ -48,7 +48,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
48
48
|
}, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, ("input" | "update:modelValue")[], "input" | "update:modelValue", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
49
49
|
modelValue: {
|
|
50
50
|
type: StringConstructor;
|
|
51
|
-
default:
|
|
51
|
+
default: undefined;
|
|
52
52
|
};
|
|
53
53
|
placeholder: {
|
|
54
54
|
type: StringConstructor;
|
|
@@ -122,8 +122,8 @@ export default defineComponent({
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
.toast__close {
|
|
125
|
-
@apply cursor-pointer text-default/
|
|
126
|
-
@apply dark:text-
|
|
125
|
+
@apply cursor-pointer text-dark-default/50 hover:text-default/50;
|
|
126
|
+
@apply dark:text-default/30;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
.toast__body {
|
|
@@ -154,13 +154,13 @@ export default defineComponent({
|
|
|
154
154
|
*/
|
|
155
155
|
&:is(.toast--info) {
|
|
156
156
|
.toast__title {
|
|
157
|
-
@apply text-
|
|
158
|
-
@apply dark:text-dark-
|
|
157
|
+
@apply text-on-emphasis;
|
|
158
|
+
@apply dark:text-dark-on-emphasis;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
.toast__text {
|
|
162
|
-
@apply text-
|
|
163
|
-
@apply dark:text-dark-
|
|
162
|
+
@apply text-on-emphasis;
|
|
163
|
+
@apply dark:text-dark-on-emphasis;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -170,10 +170,19 @@ export default defineComponent({
|
|
|
170
170
|
* variant is filled
|
|
171
171
|
*/
|
|
172
172
|
&&--info {
|
|
173
|
-
.
|
|
173
|
+
&:is(.toast--simple) {
|
|
174
|
+
.toast__icon {
|
|
175
|
+
@apply bg-base text-info;
|
|
176
|
+
@apply dark:bg-dark-base dark:text-dark-info;
|
|
177
|
+
}
|
|
178
|
+
.toast__title {
|
|
179
|
+
@apply text-default;
|
|
180
|
+
@apply dark:text-dark-default;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
174
183
|
&.toast--filled {
|
|
175
|
-
@apply bg-
|
|
176
|
-
@apply dark:bg-dark-
|
|
184
|
+
@apply bg-inverse text-info;
|
|
185
|
+
@apply dark:bg-dark-inverse dark:text-dark-info;
|
|
177
186
|
}
|
|
178
187
|
}
|
|
179
188
|
|
|
@@ -1,34 +1,61 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
name="toast"
|
|
2
|
+
<div
|
|
3
|
+
data-testid="toast-container"
|
|
5
4
|
class="toast-container"
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
:class="classNames">
|
|
6
|
+
<TransitionGroup
|
|
7
|
+
tag="div"
|
|
8
|
+
name="toast">
|
|
9
|
+
<Toast
|
|
10
|
+
v-for="(item, i) in items"
|
|
11
|
+
:key="item._id"
|
|
12
|
+
:title="item.title"
|
|
13
|
+
:text="item.text"
|
|
14
|
+
:type="item.type"
|
|
15
|
+
:variant="item.variant"
|
|
16
|
+
:duration="item.duration"
|
|
17
|
+
:class="item.toastClass"
|
|
18
|
+
@dismissed="remove(i)" />
|
|
19
|
+
</TransitionGroup>
|
|
20
|
+
</div>
|
|
18
21
|
</template>
|
|
19
22
|
|
|
20
23
|
<script>
|
|
21
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
computed,
|
|
26
|
+
defineComponent,
|
|
27
|
+
ref
|
|
28
|
+
} from "vue-demi";
|
|
22
29
|
import Toast from "./Toast.vue";
|
|
30
|
+
import { startsWith } from "lodash-es";
|
|
23
31
|
export default defineComponent({
|
|
24
32
|
components: { Toast },
|
|
25
|
-
|
|
33
|
+
props: {
|
|
34
|
+
position: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: "bottom-left"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
setup(props) {
|
|
26
40
|
const items = ref([]);
|
|
41
|
+
const classNames = computed(() => {
|
|
42
|
+
const result = [];
|
|
43
|
+
if (props.position)
|
|
44
|
+
result.push(`toast-container--${props.position}`);
|
|
45
|
+
return result;
|
|
46
|
+
});
|
|
27
47
|
function add(option) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
48
|
+
if (startsWith(option.position, "bottom")) {
|
|
49
|
+
items.value.push({
|
|
50
|
+
...option,
|
|
51
|
+
_id: Symbol("id")
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
items.value.unshift({
|
|
55
|
+
...option,
|
|
56
|
+
_id: Symbol("id")
|
|
57
|
+
});
|
|
58
|
+
}
|
|
32
59
|
}
|
|
33
60
|
function remove(index) {
|
|
34
61
|
items.value.splice(index, 1);
|
|
@@ -36,7 +63,8 @@ export default defineComponent({
|
|
|
36
63
|
return {
|
|
37
64
|
add,
|
|
38
65
|
remove,
|
|
39
|
-
items
|
|
66
|
+
items,
|
|
67
|
+
classNames
|
|
40
68
|
};
|
|
41
69
|
}
|
|
42
70
|
});
|
|
@@ -45,24 +73,81 @@ export default defineComponent({
|
|
|
45
73
|
<style lang="postcss">
|
|
46
74
|
.toast-container {
|
|
47
75
|
--p-toast-z-index: theme(zIndex.toast);
|
|
48
|
-
@apply z-[var(--p-toast-z-index)] fixed
|
|
76
|
+
@apply z-[var(--p-toast-z-index)] fixed flex flex-col space-y-2 max-h-screen overflow-visible;
|
|
77
|
+
|
|
78
|
+
&--top-right {
|
|
79
|
+
@apply top-0 right-0;
|
|
49
80
|
|
|
50
|
-
|
|
51
|
-
|
|
81
|
+
.toast {
|
|
82
|
+
&-enter-from,
|
|
83
|
+
&-leave-to {
|
|
84
|
+
@apply opacity-0 translate-x-20;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&--top-center {
|
|
90
|
+
@apply top-0 left-1/2 -translate-x-1/2;
|
|
91
|
+
|
|
92
|
+
.toast {
|
|
93
|
+
&-enter-from,
|
|
94
|
+
&-leave-to {
|
|
95
|
+
@apply opacity-0 -translate-y-20;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&--top-left {
|
|
101
|
+
@apply top-0 left-0;
|
|
102
|
+
|
|
103
|
+
.toast {
|
|
104
|
+
&-enter-from,
|
|
105
|
+
&-leave-to {
|
|
106
|
+
@apply opacity-0 -translate-x-20;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&--bottom-right {
|
|
112
|
+
@apply bottom-0 right-0;
|
|
113
|
+
|
|
114
|
+
.toast {
|
|
115
|
+
&-enter-from,
|
|
116
|
+
&-leave-to {
|
|
117
|
+
@apply opacity-0 translate-x-20;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&--bottom-center {
|
|
123
|
+
@apply bottom-0 left-1/2 -translate-x-1/2;
|
|
124
|
+
|
|
125
|
+
.toast {
|
|
126
|
+
&-enter-from,
|
|
127
|
+
&-leave-to {
|
|
128
|
+
@apply opacity-0 translate-y-20;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&--bottom-left {
|
|
134
|
+
@apply bottom-0 left-0;
|
|
135
|
+
|
|
136
|
+
.toast {
|
|
137
|
+
&-enter-from,
|
|
138
|
+
&-leave-to {
|
|
139
|
+
@apply opacity-0 -translate-x-20;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
52
142
|
}
|
|
53
143
|
}
|
|
54
144
|
|
|
55
145
|
.toast {
|
|
56
|
-
@apply will-change-[opacity,transform];
|
|
146
|
+
@apply will-change-[opacity,transform] my-2;
|
|
57
147
|
|
|
58
148
|
&-enter-active,
|
|
59
149
|
&-leave-active {
|
|
60
150
|
@apply transition-all duration-150;
|
|
61
151
|
}
|
|
62
|
-
|
|
63
|
-
&-enter-from,
|
|
64
|
-
&-leave-to {
|
|
65
|
-
@apply opacity-0 translate-x-20;
|
|
66
|
-
}
|
|
67
152
|
}
|
|
68
153
|
</style>
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { PropType } from 'vue-demi';
|
|
2
|
+
import { ToastOption, ToastPositionVariant } from '.';
|
|
3
|
+
declare const _default: import("vue-demi").DefineComponent<{
|
|
4
|
+
position: {
|
|
5
|
+
type: PropType<ToastPositionVariant>;
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
}, {
|
|
3
9
|
add: (option: ToastOption) => void;
|
|
4
10
|
remove: (index: number) => void;
|
|
5
11
|
items: import("vue-demi").Ref<{
|
|
@@ -10,6 +16,15 @@ declare const _default: import("vue-demi").DefineComponent<{}, {
|
|
|
10
16
|
text: string;
|
|
11
17
|
duration?: number | undefined;
|
|
12
18
|
toastClass?: string | string[] | undefined;
|
|
19
|
+
position?: ToastPositionVariant | undefined;
|
|
13
20
|
}[]>;
|
|
14
|
-
|
|
21
|
+
classNames: import("vue-demi").ComputedRef<string[]>;
|
|
22
|
+
}, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
23
|
+
position: {
|
|
24
|
+
type: PropType<ToastPositionVariant>;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
}>>, {
|
|
28
|
+
position: ToastPositionVariant;
|
|
29
|
+
}, {}>;
|
|
15
30
|
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<template
|
|
4
|
+
v-for="item in groups.values()"
|
|
5
|
+
:key="item.position">
|
|
6
|
+
<ToastGroup
|
|
7
|
+
:ref="item.ref"
|
|
8
|
+
:position="item.position" />
|
|
9
|
+
</template>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import {
|
|
15
|
+
ref,
|
|
16
|
+
defineComponent,
|
|
17
|
+
shallowRef,
|
|
18
|
+
triggerRef,
|
|
19
|
+
nextTick
|
|
20
|
+
} from "vue-demi";
|
|
21
|
+
import ToastGroup from "./ToastContainer.vue";
|
|
22
|
+
export default defineComponent({
|
|
23
|
+
components: { ToastGroup },
|
|
24
|
+
setup() {
|
|
25
|
+
const groups = shallowRef(/* @__PURE__ */ new Map());
|
|
26
|
+
async function add(options) {
|
|
27
|
+
if (!options.position)
|
|
28
|
+
options.position = "bottom-left";
|
|
29
|
+
const position = options.position;
|
|
30
|
+
let group = groups.value.get(position);
|
|
31
|
+
if (!group) {
|
|
32
|
+
group = { ref: ref(), position };
|
|
33
|
+
groups.value.set(position, group);
|
|
34
|
+
triggerRef(groups);
|
|
35
|
+
await nextTick();
|
|
36
|
+
}
|
|
37
|
+
group.ref.value?.at(0).add(options);
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
add,
|
|
41
|
+
groups
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Ref } from 'vue-demi';
|
|
2
|
+
import ToastGroup from './ToastContainer.vue';
|
|
3
|
+
import { ToastOption, ToastPositionVariant } from '.';
|
|
4
|
+
type ToastInstance = InstanceType<typeof ToastGroup>;
|
|
5
|
+
type ToastGroupMap = Map<ToastPositionVariant, {
|
|
6
|
+
position: ToastPositionVariant;
|
|
7
|
+
ref: Ref<ToastInstance[]>;
|
|
8
|
+
}>;
|
|
9
|
+
declare const _default: import("vue-demi").DefineComponent<{}, {
|
|
10
|
+
add: (options: ToastOption) => Promise<void>;
|
|
11
|
+
groups: import("vue-demi").ShallowRef<ToastGroupMap>;
|
|
12
|
+
}, {}, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{}>>, {}, {}>;
|
|
13
|
+
export default _default;
|
|
@@ -7,6 +7,7 @@ export interface ToastOption {
|
|
|
7
7
|
text: string;
|
|
8
8
|
duration?: number;
|
|
9
9
|
toastClass?: string | string[];
|
|
10
|
+
position?: ToastPositionVariant;
|
|
10
11
|
}
|
|
11
12
|
export type ToastPositionVariant = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
12
13
|
export default function showToast(option: ToastOption): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useSingleton } from "../global/use-singleton.mjs";
|
|
2
2
|
export default async function showToast(option) {
|
|
3
|
-
const { default:
|
|
4
|
-
const toast = await useSingleton(
|
|
5
|
-
toast.add(option);
|
|
3
|
+
const { default: ToastRoot } = await import("./ToastRoot.vue");
|
|
4
|
+
const toast = await useSingleton(ToastRoot);
|
|
5
|
+
await toast.add(option);
|
|
6
6
|
}
|
|
@@ -6,15 +6,15 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
6
6
|
default: string;
|
|
7
7
|
};
|
|
8
8
|
modelValue: {
|
|
9
|
-
type: (NumberConstructor | StringConstructor |
|
|
9
|
+
type: (NumberConstructor | StringConstructor | ArrayConstructor | ObjectConstructor | BooleanConstructor | DateConstructor)[];
|
|
10
10
|
default: boolean;
|
|
11
11
|
};
|
|
12
12
|
value: {
|
|
13
|
-
type: (NumberConstructor | StringConstructor |
|
|
13
|
+
type: (NumberConstructor | StringConstructor | ArrayConstructor | ObjectConstructor | BooleanConstructor | DateConstructor)[];
|
|
14
14
|
default: boolean;
|
|
15
15
|
};
|
|
16
16
|
uncheckedValue: {
|
|
17
|
-
type: (NumberConstructor | StringConstructor |
|
|
17
|
+
type: (NumberConstructor | StringConstructor | ArrayConstructor | ObjectConstructor | BooleanConstructor | DateConstructor)[];
|
|
18
18
|
default: boolean;
|
|
19
19
|
};
|
|
20
20
|
checked: {
|
|
@@ -51,15 +51,15 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
51
51
|
default: string;
|
|
52
52
|
};
|
|
53
53
|
modelValue: {
|
|
54
|
-
type: (NumberConstructor | StringConstructor |
|
|
54
|
+
type: (NumberConstructor | StringConstructor | ArrayConstructor | ObjectConstructor | BooleanConstructor | DateConstructor)[];
|
|
55
55
|
default: boolean;
|
|
56
56
|
};
|
|
57
57
|
value: {
|
|
58
|
-
type: (NumberConstructor | StringConstructor |
|
|
58
|
+
type: (NumberConstructor | StringConstructor | ArrayConstructor | ObjectConstructor | BooleanConstructor | DateConstructor)[];
|
|
59
59
|
default: boolean;
|
|
60
60
|
};
|
|
61
61
|
uncheckedValue: {
|
|
62
|
-
type: (NumberConstructor | StringConstructor |
|
|
62
|
+
type: (NumberConstructor | StringConstructor | ArrayConstructor | ObjectConstructor | BooleanConstructor | DateConstructor)[];
|
|
63
63
|
default: boolean;
|
|
64
64
|
};
|
|
65
65
|
checked: {
|
|
@@ -93,9 +93,9 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
93
93
|
onDismiss?: ((...args: any[]) => any) | undefined;
|
|
94
94
|
onPrev?: ((...args: any[]) => any) | undefined;
|
|
95
95
|
}, {
|
|
96
|
+
image: string;
|
|
96
97
|
dismissable: boolean;
|
|
97
98
|
text: string;
|
|
98
|
-
image: string;
|
|
99
99
|
title: string;
|
|
100
100
|
step: number;
|
|
101
101
|
highlight: boolean;
|