@wikicasa-dev/components 2.1.24-alpha.4 → 2.1.24-alpha.6
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.
|
@@ -9,8 +9,11 @@ export type SnackbarProps = {
|
|
|
9
9
|
/**
|
|
10
10
|
* Vue native teleport component prop :to
|
|
11
11
|
* @see https://vuejs.org/guide/built-ins/teleport.html#basic-usage
|
|
12
|
+
*
|
|
13
|
+
* If false, the viewport won't use the teleport feature.
|
|
12
14
|
*/
|
|
13
|
-
to?: ToastPortalProps["to"];
|
|
15
|
+
to?: string | false | ToastPortalProps["to"];
|
|
16
|
+
dataCy?: string;
|
|
14
17
|
};
|
|
15
18
|
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
|
|
16
19
|
open?: Optional<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.uikit-alert-viewport{--uikit-alert-viewport-padding: 0px;padding:var(--uikit-alert-viewport-padding)}.uikit-alert{--uikit-alert-bg-color: #e9effe;--uikit-alert-text-color: #2b5dff;background-color:var(--uikit-alert-bg-color);color:var(--uikit-alert-text-color)}.uikit-alert.uikit-alert-w-danger{--uikit-alert-bg-color: #fff4f4;--uikit-alert-text-color: #f20003}.uikit-alert.uikit-alert-w-darkblue{--uikit-alert-bg-color: #2a3761;--uikit-alert-text-color: #fff}.toast-root{will-change:animation,transform,opacity}.toast-root[data-state=open]{animation:slideLeft .1s ease-out}.toast-root[data-state=closed]{animation:slideRight .1s ease-out}.toast-root[data-swipe=move]{transform:translate(var(--reka-toast-swipe-move-x))}.toast-root[data-swipe=cancel]{transform:translate(0);transition:transform .2s ease-out}.toast-root[data-swipe=end]{animation:slideRight .1s ease-out}@keyframes slideLeft{0%{transform:translate(100%);opacity:0}to{transform:translate(var(--reka-toast-swipe-end-x));opacity:1}}@keyframes slideRight{0%{transform:translate(var(--reka-toast-swipe-end-x));opacity:1}to{transform:translate(100%);opacity:0}}
|
|
1
|
+
.uikit-alert-viewport{--uikit-alert-viewport-padding: 0px;--uikit-alert-viewport-position: absolute;--uikit-alert-viewport-top: 0px;--uikit-alert-viewport-right: 0px;--uikit-alert-viewport-bottom: 0px;--uikit-alert-viewport-left: 0px;padding:var(--uikit-alert-viewport-padding);position:var(--uikit-alert-viewport-position);inset:var(--uikit-alert-viewport-top) var(--uikit-alert-viewport-right) var(--uikit-alert-viewport-bottom) var(--uikit-alert-viewport-left)}.uikit-alert{--uikit-alert-bg-color: #e9effe;--uikit-alert-text-color: #2b5dff;background-color:var(--uikit-alert-bg-color);color:var(--uikit-alert-text-color)}.uikit-alert.uikit-alert-w-danger{--uikit-alert-bg-color: #fff4f4;--uikit-alert-text-color: #f20003}.uikit-alert.uikit-alert-w-darkblue{--uikit-alert-bg-color: #2a3761;--uikit-alert-text-color: #fff}.toast-root{will-change:animation,transform,opacity}.toast-root[data-state=open]{animation:slideLeft .1s ease-out}.toast-root[data-state=closed]{animation:slideRight .1s ease-out}.toast-root[data-swipe=move]{transform:translate(var(--reka-toast-swipe-move-x))}.toast-root[data-swipe=cancel]{transform:translate(0);transition:transform .2s ease-out}.toast-root[data-swipe=end]{animation:slideRight .1s ease-out}@keyframes slideLeft{0%{transform:translate(100%);opacity:0}to{transform:translate(var(--reka-toast-swipe-end-x));opacity:1}}@keyframes slideRight{0%{transform:translate(var(--reka-toast-swipe-end-x));opacity:1}to{transform:translate(100%);opacity:0}}
|
|
@@ -1,72 +1,75 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { CloseIcon as
|
|
1
|
+
import { defineComponent as x, mergeModels as y, useModel as T, ref as g, watch as h, nextTick as C, createBlock as n, openBlock as d, unref as t, withCtx as a, renderSlot as k, createVNode as l, normalizeClass as b, createCommentVNode as I, normalizeStyle as V } from "vue";
|
|
2
|
+
import { CloseIcon as $ } from "../../node_modules/@wikicasa-dev/svg-icons/dist/CloseIcon.js";
|
|
3
3
|
import "../../node_modules/@wikicasa-dev/svg-icons/dist/PharmacyIcon.js";
|
|
4
|
-
import { ToastProvider as
|
|
5
|
-
const q = /* @__PURE__ */
|
|
4
|
+
import { ToastProvider as B, ToastRoot as P, ToastTitle as z, ToastDescription as D, ToastClose as M, ToastAction as S, ProgressRoot as j, ProgressIndicator as A, ToastPortal as N, ToastViewport as c } from "reka-ui";
|
|
5
|
+
const q = /* @__PURE__ */ x({
|
|
6
|
+
inheritAttrs: !1,
|
|
6
7
|
__name: "BaseSnackbar",
|
|
7
|
-
props: /* @__PURE__ */
|
|
8
|
+
props: /* @__PURE__ */ y({
|
|
8
9
|
alertClass: { default: "primary" },
|
|
9
10
|
duration: { default: 3e3 },
|
|
10
|
-
to: { default: "body" }
|
|
11
|
+
to: { type: [String, Boolean], default: "body" },
|
|
12
|
+
dataCy: { default: "" }
|
|
11
13
|
}, {
|
|
12
14
|
open: { type: Boolean, default: !1 },
|
|
13
15
|
openModifiers: {}
|
|
14
16
|
}),
|
|
15
17
|
emits: ["update:open"],
|
|
16
|
-
setup(
|
|
17
|
-
const r =
|
|
18
|
-
let
|
|
19
|
-
const
|
|
20
|
-
|
|
18
|
+
setup(i) {
|
|
19
|
+
const r = T(i, "open"), o = g(0);
|
|
20
|
+
let f, m;
|
|
21
|
+
const p = (e = 3e3) => {
|
|
22
|
+
o.value = 0;
|
|
21
23
|
const u = Date.now();
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
24
|
+
m = setInterval(() => {
|
|
25
|
+
const w = Date.now() - u;
|
|
26
|
+
o.value = Math.min(100, w / e * 100), o.value >= 100 && clearInterval(m);
|
|
25
27
|
}, 30);
|
|
26
|
-
},
|
|
27
|
-
clearTimeout(
|
|
28
|
+
}, v = () => {
|
|
29
|
+
clearTimeout(f), f = setTimeout(() => {
|
|
28
30
|
r.value = !1;
|
|
29
|
-
},
|
|
31
|
+
}, i.duration), p(i.duration);
|
|
30
32
|
};
|
|
31
33
|
return h(
|
|
32
34
|
r,
|
|
33
35
|
(e) => {
|
|
34
36
|
C(() => {
|
|
35
37
|
if (e) {
|
|
36
|
-
|
|
38
|
+
v();
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
39
|
-
clearInterval(
|
|
41
|
+
clearInterval(m), clearTimeout(f), o.value = 0;
|
|
40
42
|
});
|
|
41
43
|
},
|
|
42
44
|
{ immediate: !0 }
|
|
43
|
-
), (e, u) => (
|
|
44
|
-
default:
|
|
45
|
-
|
|
45
|
+
), (e, u) => (d(), n(t(B), null, {
|
|
46
|
+
default: a(() => [
|
|
47
|
+
k(e.$slots, "trigger", {
|
|
46
48
|
open: () => r.value = !0
|
|
47
49
|
}),
|
|
48
|
-
|
|
50
|
+
l(t(P), {
|
|
49
51
|
open: r.value,
|
|
50
52
|
"onUpdate:open": u[1] || (u[1] = (s) => r.value = s),
|
|
51
|
-
duration:
|
|
52
|
-
class: b(["toast-root uikit-
|
|
53
|
+
duration: i.duration,
|
|
54
|
+
class: b(["toast-root uikit-relative uikit-flex uikit-gap-[8px] uikit-overflow-hidden uikit-rounded-[4px] uikit-p-[16px] uikit-text-16 uikit-font-medium uikit-shadow-surface sm:uikit-max-w-[460px]", ["uikit-alert", `uikit-alert-w-${i.alertClass}`]]),
|
|
55
|
+
"data-cy": i.dataCy
|
|
53
56
|
}, {
|
|
54
|
-
default:
|
|
55
|
-
e.$slots.title ? (
|
|
57
|
+
default: a(() => [
|
|
58
|
+
e.$slots.title ? (d(), n(t(z), {
|
|
56
59
|
key: 0,
|
|
57
60
|
"as-child": ""
|
|
58
61
|
}, {
|
|
59
|
-
default:
|
|
60
|
-
|
|
62
|
+
default: a(() => [
|
|
63
|
+
k(e.$slots, "title")
|
|
61
64
|
]),
|
|
62
65
|
_: 3
|
|
63
|
-
})) :
|
|
64
|
-
|
|
65
|
-
default:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
default:
|
|
69
|
-
|
|
66
|
+
})) : I("", !0),
|
|
67
|
+
l(t(D), { "as-child": "" }, {
|
|
68
|
+
default: a(() => [
|
|
69
|
+
k(e.$slots, "default"),
|
|
70
|
+
l(t(M), { class: "uikit-ml-[16px] uikit-flex uikit-size-[24px] uikit-shrink-0 uikit-cursor-pointer uikit-appearance-none uikit-items-center uikit-justify-center uikit-rounded-full uikit-bg-[#C1C8D5]" }, {
|
|
71
|
+
default: a(() => [
|
|
72
|
+
l(t($), {
|
|
70
73
|
width: 12,
|
|
71
74
|
height: 12,
|
|
72
75
|
"stroke-color": "#fff"
|
|
@@ -77,38 +80,44 @@ const q = /* @__PURE__ */ T({
|
|
|
77
80
|
]),
|
|
78
81
|
_: 3
|
|
79
82
|
}),
|
|
80
|
-
|
|
83
|
+
l(t(S), {
|
|
81
84
|
class: "[grid-area:_action]",
|
|
82
85
|
"as-child": "",
|
|
83
86
|
"alt-text": "Goto schedule to undo"
|
|
84
87
|
}, {
|
|
85
|
-
default:
|
|
86
|
-
|
|
88
|
+
default: a(() => [
|
|
89
|
+
k(e.$slots, "toast-action")
|
|
87
90
|
]),
|
|
88
91
|
_: 3
|
|
89
92
|
}),
|
|
90
|
-
|
|
91
|
-
modelValue:
|
|
92
|
-
"onUpdate:modelValue": u[0] || (u[0] = (s) =>
|
|
93
|
+
l(t(j), {
|
|
94
|
+
modelValue: o.value,
|
|
95
|
+
"onUpdate:modelValue": u[0] || (u[0] = (s) => o.value = s),
|
|
93
96
|
class: "uikit-absolute uikit-bottom-0 uikit-left-0 uikit-h-[4px] uikit-w-full uikit-overflow-hidden"
|
|
94
97
|
}, {
|
|
95
|
-
default:
|
|
96
|
-
|
|
98
|
+
default: a(() => [
|
|
99
|
+
l(t(A), {
|
|
97
100
|
class: "uikit-relative uikit-block uikit-size-full uikit-bg-[#2b5dff] uikit-transition-transform uikit-duration-75 uikit-will-change-transform",
|
|
98
|
-
style:
|
|
101
|
+
style: V(`transform: translateX(-${100 - o.value}%)`)
|
|
99
102
|
}, null, 8, ["style"])
|
|
100
103
|
]),
|
|
101
104
|
_: 1
|
|
102
105
|
}, 8, ["modelValue"])
|
|
103
106
|
]),
|
|
104
107
|
_: 3
|
|
105
|
-
}, 8, ["open", "duration", "class"]),
|
|
106
|
-
i(t(N), {
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
}, 8, ["open", "duration", "class", "data-cy"]),
|
|
109
|
+
i.to ? (d(), n(t(N), {
|
|
110
|
+
key: 0,
|
|
111
|
+
to: i.to
|
|
112
|
+
}, {
|
|
113
|
+
default: a(() => [
|
|
114
|
+
l(t(c), { class: "uikit-alert-viewport uikit-m-0 uikit-flex uikit-w-full uikit-list-none uikit-flex-col uikit-items-end uikit-justify-end uikit-gap-[8px]" })
|
|
109
115
|
]),
|
|
110
116
|
_: 1
|
|
111
|
-
}, 8, ["to"])
|
|
117
|
+
}, 8, ["to"])) : (d(), n(t(c), {
|
|
118
|
+
key: 1,
|
|
119
|
+
class: "uikit-alert-viewport uikit-m-0 uikit-flex uikit-w-full uikit-list-none uikit-flex-col uikit-items-end uikit-justify-end uikit-gap-[8px]"
|
|
120
|
+
}))
|
|
112
121
|
]),
|
|
113
122
|
_: 3
|
|
114
123
|
}));
|