@scalar/components 0.16.4 → 0.16.5
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/ScalarButton/ScalarButton.vue.js +27 -27
- package/dist/components/ScalarButton/types.d.ts +6 -6
- package/dist/components/ScalarButton/types.d.ts.map +1 -1
- package/dist/components/ScalarFileUpload/ScalarFileUpload.vue.js +25 -25
- package/dist/components/ScalarFileUpload/ScalarFileUploadLoading.vue.js +7 -7
- package/dist/components/ScalarLoading/ScalarLoading.vue.d.ts +14 -16
- package/dist/components/ScalarLoading/ScalarLoading.vue.d.ts.map +1 -1
- package/dist/components/ScalarLoading/ScalarLoading.vue.js +3 -5
- package/dist/components/ScalarLoading/ScalarLoading.vue2.js +20 -58
- package/dist/components/ScalarLoading/index.d.ts +3 -1
- package/dist/components/ScalarLoading/index.d.ts.map +1 -1
- package/dist/components/ScalarLoading/types.d.ts +61 -0
- package/dist/components/ScalarLoading/types.d.ts.map +1 -0
- package/dist/components/ScalarLoading/useLoadingState.d.ts +16 -0
- package/dist/components/ScalarLoading/useLoadingState.d.ts.map +1 -0
- package/dist/components/ScalarLoading/useLoadingState.js +39 -0
- package/dist/components/ScalarSearchInput/ScalarSearchInput.vue.d.ts +2 -2
- package/dist/components/ScalarSearchInput/ScalarSearchInput.vue.d.ts.map +1 -1
- package/dist/components/ScalarSearchInput/ScalarSearchInput.vue.js +17 -17
- package/dist/components/ScalarSidebar/ScalarSidebarGroup.vue.d.ts +3 -0
- package/dist/components/ScalarSidebar/ScalarSidebarGroup.vue.d.ts.map +1 -1
- package/dist/components/ScalarSidebar/ScalarSidebarGroup.vue.js +66 -62
- package/dist/components/ScalarSidebar/ScalarSidebarNestedItems.vue.d.ts +3 -0
- package/dist/components/ScalarSidebar/ScalarSidebarNestedItems.vue.d.ts.map +1 -1
- package/dist/components/ScalarSidebar/ScalarSidebarNestedItems.vue.js +63 -62
- package/dist/components/ScalarSidebar/ScalarSidebarSearchInput.vue.d.ts +1 -1
- package/dist/components/ScalarSidebar/ScalarSidebarSearchInput.vue.d.ts.map +1 -1
- package/dist/components/ScalarSidebar/ScalarSidebarSearchInput.vue.js +16 -16
- package/dist/components/ScalarSidebar/ScalarSidebarSection.vue.d.ts.map +1 -1
- package/dist/components/ScalarSidebar/ScalarSidebarSection.vue.js +35 -35
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +8 -8
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { cva as
|
|
1
|
+
import { defineComponent as v, createBlock as n, openBlock as s, resolveDynamicComponent as l, mergeProps as p, unref as a, withCtx as f, createElementBlock as i, createCommentVNode as d, renderSlot as t, normalizeClass as o, createVNode as z } from "vue";
|
|
2
|
+
import { cva as r, useBindCx as g } from "@scalar/use-hooks/useBindCx";
|
|
3
3
|
import { BUTTON_VARIANT_STYLES as y } from "./constants.js";
|
|
4
4
|
import h from "../ScalarLoading/ScalarLoading.vue.js";
|
|
5
5
|
const k = {
|
|
6
6
|
key: 3,
|
|
7
7
|
class: "centered"
|
|
8
|
-
},
|
|
9
|
-
...
|
|
8
|
+
}, A = {}, T = /* @__PURE__ */ v({
|
|
9
|
+
...A,
|
|
10
10
|
inheritAttrs: !1,
|
|
11
11
|
__name: "ScalarButton",
|
|
12
12
|
props: {
|
|
@@ -15,10 +15,10 @@ const k = {
|
|
|
15
15
|
size: { default: "md" },
|
|
16
16
|
disabled: { type: Boolean },
|
|
17
17
|
icon: { type: [Object, Function] },
|
|
18
|
-
|
|
18
|
+
loader: {}
|
|
19
19
|
},
|
|
20
|
-
setup(
|
|
21
|
-
const m =
|
|
20
|
+
setup(B) {
|
|
21
|
+
const m = r({
|
|
22
22
|
base: "scalar-button flex cursor-pointer items-center justify-center rounded font-medium -outline-offset-1",
|
|
23
23
|
variants: {
|
|
24
24
|
disabled: { true: "bg-b-2 text-color-3 shadow-none" },
|
|
@@ -41,7 +41,7 @@ const k = {
|
|
|
41
41
|
class: "to-b-1.5 bg-linear-to-b hover:bg-linear-to-b dark:hover:bg-linear-to-t"
|
|
42
42
|
}
|
|
43
43
|
]
|
|
44
|
-
}),
|
|
44
|
+
}), c = r({
|
|
45
45
|
base: "shrink-0",
|
|
46
46
|
variants: {
|
|
47
47
|
size: {
|
|
@@ -50,7 +50,7 @@ const k = {
|
|
|
50
50
|
md: "size-3.5 -ml-0.5 mr-1.5"
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
53
|
+
}), u = r({
|
|
54
54
|
variants: {
|
|
55
55
|
size: {
|
|
56
56
|
xs: "size-4",
|
|
@@ -58,36 +58,36 @@ const k = {
|
|
|
58
58
|
md: "size-6"
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
}), { cx:
|
|
62
|
-
return (e, V) => (
|
|
61
|
+
}), { cx: b } = g();
|
|
62
|
+
return (e, V) => (s(), n(l(e.is), p(
|
|
63
63
|
{
|
|
64
64
|
"aria-disabled": e.disabled || void 0,
|
|
65
65
|
type: e.is === "button" ? "button" : void 0
|
|
66
66
|
},
|
|
67
|
-
a(
|
|
68
|
-
relative: e.
|
|
67
|
+
a(b)(a(m)({ disabled: e.disabled, size: e.size, variant: e.variant }), {
|
|
68
|
+
relative: e.loader?.isActive
|
|
69
69
|
})
|
|
70
70
|
), {
|
|
71
|
-
default:
|
|
72
|
-
e.$slots.icon || e.icon ? (
|
|
71
|
+
default: f(() => [
|
|
72
|
+
e.$slots.icon || e.icon ? (s(), i("div", {
|
|
73
73
|
key: 0,
|
|
74
|
-
class:
|
|
74
|
+
class: o([a(c)({ size: e.size }), { invisible: e.loader?.isActive }])
|
|
75
75
|
}, [
|
|
76
|
-
|
|
77
|
-
(
|
|
76
|
+
t(e.$slots, "icon", {}, () => [
|
|
77
|
+
(s(), n(l(e.icon), { class: "size-full" }))
|
|
78
78
|
])
|
|
79
79
|
], 2)) : d("", !0),
|
|
80
|
-
e.
|
|
80
|
+
e.loader ? (s(), i("span", {
|
|
81
81
|
key: 1,
|
|
82
|
-
class:
|
|
82
|
+
class: o({ invisible: e.loader?.isActive })
|
|
83
83
|
}, [
|
|
84
|
-
|
|
85
|
-
], 2)) :
|
|
86
|
-
e.
|
|
87
|
-
|
|
88
|
-
class:
|
|
89
|
-
|
|
90
|
-
}, null, 8, ["class", "
|
|
84
|
+
t(e.$slots, "default")
|
|
85
|
+
], 2)) : t(e.$slots, "default", { key: 2 }),
|
|
86
|
+
e.loader?.isActive ? (s(), i("div", k, [
|
|
87
|
+
z(a(h), {
|
|
88
|
+
class: o(a(u)({ size: e.size })),
|
|
89
|
+
loader: e.loader
|
|
90
|
+
}, null, 8, ["class", "loader"])
|
|
91
91
|
])) : d("", !0)
|
|
92
92
|
]),
|
|
93
93
|
_: 3
|
|
@@ -55,18 +55,18 @@ export type ScalarButtonProps = {
|
|
|
55
55
|
/**
|
|
56
56
|
* The loading state of the button
|
|
57
57
|
*
|
|
58
|
-
* @see
|
|
58
|
+
* @see ScalarLoading
|
|
59
59
|
*
|
|
60
60
|
* @example
|
|
61
|
-
* import { useLoadingState } from '@scalar/components'
|
|
61
|
+
* import { ScalarButton, useLoadingState } from '@scalar/components'
|
|
62
62
|
* ...
|
|
63
|
-
* const
|
|
64
|
-
*
|
|
63
|
+
* const loader = useLoadingState()
|
|
64
|
+
* loader.start()
|
|
65
65
|
* ...
|
|
66
|
-
* <ScalarButton :
|
|
66
|
+
* <ScalarButton :loader>
|
|
67
67
|
* It's loading...
|
|
68
68
|
* </ScalarButton>
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
loader?: LoadingState;
|
|
71
71
|
};
|
|
72
72
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarButton/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAEpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAE9D,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAA;AAElF,2CAA2C;AAC3C,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAE3C,mCAAmC;AACnC,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;AAEzC,2CAA2C;AAC3C,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;;;;;OASG;IACH,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAA;IAC1B;;;;;;;;;;;;;;OAcG;IACH,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarButton/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAEpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAE9D,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAA;AAElF,2CAA2C;AAC3C,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAE3C,mCAAmC;AACnC,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;AAEzC,2CAA2C;AAC3C,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;;;;;OASG;IACH,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAA;IAC1B;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,EAAE,YAAY,CAAA;CACtB,CAAA"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useBindCx as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { defineComponent as A, mergeModels as m, useModel as p, ref as c, createElementBlock as v, openBlock as r, mergeProps as E, unref as s, withModifiers as g, renderSlot as a, createCommentVNode as y, createBlock as $, createElementVNode as F, resolveDynamicComponent as T, createSlots as k, withCtx as n, createVNode as b, createTextVNode as w, toDisplayString as j } from "vue";
|
|
2
|
+
import { useBindCx as P } from "@scalar/use-hooks/useBindCx";
|
|
3
|
+
import U from "./ScalarFileUploadDropTarget.vue.js";
|
|
4
|
+
import _ from "./ScalarFileUploadError.vue.js";
|
|
5
|
+
import q from "./ScalarFileUploadInput.vue.js";
|
|
6
|
+
import z from "./ScalarFileUploadInputCompact.vue.js";
|
|
7
|
+
import G from "./ScalarFileUploadLoading.vue.js";
|
|
8
8
|
import { isExtensionList as h } from "./types.js";
|
|
9
|
-
const
|
|
10
|
-
...
|
|
9
|
+
const H = ["accept", "multiple"], I = {}, Y = /* @__PURE__ */ A({
|
|
10
|
+
...I,
|
|
11
11
|
inheritAttrs: !1,
|
|
12
12
|
__name: "ScalarFileUpload",
|
|
13
13
|
props: /* @__PURE__ */ m({
|
|
@@ -23,9 +23,9 @@ const G = ["accept", "multiple"], H = {}, Y = /* @__PURE__ */ E({
|
|
|
23
23
|
}),
|
|
24
24
|
emits: /* @__PURE__ */ m(["selected"], ["update:modelValue", "update:error"]),
|
|
25
25
|
setup(i, { emit: C }) {
|
|
26
|
-
const D = C, V = p(i, "modelValue"), l = p(i, "error"),
|
|
27
|
-
function
|
|
28
|
-
|
|
26
|
+
const D = C, V = p(i, "modelValue"), l = p(i, "error"), u = c(), t = c(!1);
|
|
27
|
+
function d() {
|
|
28
|
+
u.value?.click();
|
|
29
29
|
}
|
|
30
30
|
function f(e) {
|
|
31
31
|
if (l.value = void 0, !e || e.length < 1) {
|
|
@@ -46,8 +46,8 @@ const G = ["accept", "multiple"], H = {}, Y = /* @__PURE__ */ E({
|
|
|
46
46
|
function M(e) {
|
|
47
47
|
t.value = !1, f(e.dataTransfer?.files);
|
|
48
48
|
}
|
|
49
|
-
const { cx: N } =
|
|
50
|
-
return (e, o) => (r(), v("div",
|
|
49
|
+
const { cx: N } = P();
|
|
50
|
+
return (e, o) => (r(), v("div", E(
|
|
51
51
|
s(N)(
|
|
52
52
|
"flex flex-col relative border-dashed border-1 has-[input:focus-visible]:outline outline-offset-1 rounded"
|
|
53
53
|
),
|
|
@@ -58,12 +58,12 @@ const G = ["accept", "multiple"], H = {}, Y = /* @__PURE__ */ E({
|
|
|
58
58
|
onDrop: g(M, ["prevent"])
|
|
59
59
|
}
|
|
60
60
|
), [
|
|
61
|
-
a(e.$slots, "default", { open:
|
|
62
|
-
(r(), $(
|
|
63
|
-
e.variant === "compact" ?
|
|
61
|
+
a(e.$slots, "default", { open: d }, () => [
|
|
62
|
+
(r(), $(T(
|
|
63
|
+
e.variant === "compact" ? z : q
|
|
64
64
|
), {
|
|
65
65
|
extensions: s(h)(e.accept) ? e.accept : void 0,
|
|
66
|
-
onClick:
|
|
66
|
+
onClick: d
|
|
67
67
|
}, k({ _: 2 }, [
|
|
68
68
|
e.$slots.label ? {
|
|
69
69
|
name: "default",
|
|
@@ -75,9 +75,9 @@ const G = ["accept", "multiple"], H = {}, Y = /* @__PURE__ */ E({
|
|
|
75
75
|
l.value ? {
|
|
76
76
|
name: "sublabel",
|
|
77
77
|
fn: n(() => [
|
|
78
|
-
b(
|
|
78
|
+
b(_, null, {
|
|
79
79
|
default: n(() => [
|
|
80
|
-
|
|
80
|
+
w(j(l.value), 1)
|
|
81
81
|
]),
|
|
82
82
|
_: 1
|
|
83
83
|
})
|
|
@@ -92,7 +92,7 @@ const G = ["accept", "multiple"], H = {}, Y = /* @__PURE__ */ E({
|
|
|
92
92
|
onDragleave: o[0] || (o[0] = (S) => t.value = !1)
|
|
93
93
|
}, [
|
|
94
94
|
a(e.$slots, "drop-target", {}, () => [
|
|
95
|
-
b(
|
|
95
|
+
b(U, null, k({ _: 2 }, [
|
|
96
96
|
e.$slots["drop-target-label"] ? {
|
|
97
97
|
name: "default",
|
|
98
98
|
fn: n(() => [
|
|
@@ -103,19 +103,19 @@ const G = ["accept", "multiple"], H = {}, Y = /* @__PURE__ */ E({
|
|
|
103
103
|
]), 1024)
|
|
104
104
|
])
|
|
105
105
|
], 32)) : y("", !0),
|
|
106
|
-
e.loader?.
|
|
106
|
+
e.loader?.isActive ? (r(), $(G, {
|
|
107
107
|
key: 1,
|
|
108
108
|
loader: e.loader
|
|
109
109
|
}, null, 8, ["loader"])) : y("", !0),
|
|
110
|
-
|
|
110
|
+
F("input", {
|
|
111
111
|
ref_key: "input",
|
|
112
|
-
ref:
|
|
112
|
+
ref: u,
|
|
113
113
|
accept: s(h)(e.accept) ? e.accept.join(",") : e.accept,
|
|
114
114
|
class: "sr-only",
|
|
115
115
|
multiple: e.multiple,
|
|
116
116
|
type: "file",
|
|
117
117
|
onChange: B
|
|
118
|
-
}, null, 40,
|
|
118
|
+
}, null, 40, H)
|
|
119
119
|
], 16));
|
|
120
120
|
}
|
|
121
121
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as t, createElementBlock as a, openBlock as n, normalizeProps as l, guardReactiveProps as i, unref as e, createVNode as s } from "vue";
|
|
2
2
|
import { useBindCx as c } from "@scalar/use-hooks/useBindCx";
|
|
3
3
|
import d from "../ScalarLoading/ScalarLoading.vue.js";
|
|
4
|
-
const p = {},
|
|
4
|
+
const p = {}, z = /* @__PURE__ */ t({
|
|
5
5
|
...p,
|
|
6
6
|
inheritAttrs: !1,
|
|
7
7
|
__name: "ScalarFileUploadLoading",
|
|
@@ -9,19 +9,19 @@ const p = {}, x = /* @__PURE__ */ r({
|
|
|
9
9
|
loader: {}
|
|
10
10
|
},
|
|
11
11
|
setup(u) {
|
|
12
|
-
const { cx:
|
|
12
|
+
const { cx: r } = c();
|
|
13
13
|
return (o, m) => (n(), a("div", l(i(
|
|
14
|
-
e(
|
|
14
|
+
e(r)(
|
|
15
15
|
" size-full flex items-center justify-center absolute inset-0 z-1 rounded p-1 backdrop-blur text-c-2"
|
|
16
16
|
)
|
|
17
17
|
)), [
|
|
18
18
|
s(e(d), {
|
|
19
|
-
|
|
19
|
+
loader: o.loader,
|
|
20
20
|
size: "md"
|
|
21
|
-
}, null, 8, ["
|
|
21
|
+
}, null, 8, ["loader"])
|
|
22
22
|
], 16));
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
export {
|
|
26
|
-
|
|
26
|
+
z as default
|
|
27
27
|
};
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import type { LoadingState } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Scalar Loading Component
|
|
4
|
+
*
|
|
5
|
+
* Displays a loading state for the application
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import { ScalarLoading, useLoadingState } from '@scalar/components'
|
|
9
|
+
*
|
|
10
|
+
* const loader = useLoadingState()
|
|
11
|
+
* loader.start()
|
|
12
|
+
* ...
|
|
13
|
+
* <ScalarLoading :loader="loader" />
|
|
6
14
|
*/
|
|
7
|
-
export declare function useLoadingState(): {
|
|
8
|
-
isValid: boolean;
|
|
9
|
-
isInvalid: boolean;
|
|
10
|
-
isLoading: boolean;
|
|
11
|
-
startLoading: () => void;
|
|
12
|
-
stopLoading: () => void;
|
|
13
|
-
validate: (time?: number, clear?: boolean) => Promise<unknown>;
|
|
14
|
-
invalidate: (time?: number, clear?: boolean) => Promise<unknown>;
|
|
15
|
-
clear: (time?: number) => Promise<unknown>;
|
|
16
|
-
};
|
|
17
15
|
declare const _default: import("vue").DefineComponent<{
|
|
18
|
-
|
|
16
|
+
loader?: LoadingState;
|
|
19
17
|
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
20
18
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
21
|
-
|
|
19
|
+
loader?: LoadingState;
|
|
22
20
|
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
23
21
|
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
22
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarLoading.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarLoading/ScalarLoading.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScalarLoading.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarLoading/ScalarLoading.vue"],"names":[],"mappings":"AAqMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C;;;;;;;;;;;;GAYG;;aAKQ,YAAY;;;aAAZ,YAAY;;;AAJvB,wBAmJC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import o from "./ScalarLoading.vue2.js";
|
|
2
|
-
import { useLoadingState as i } from "./ScalarLoading.vue2.js";
|
|
3
2
|
/* empty css */
|
|
4
|
-
import
|
|
5
|
-
const
|
|
3
|
+
import a from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const p = /* @__PURE__ */ a(o, [["__scopeId", "data-v-8e99b97a"]]);
|
|
6
5
|
export {
|
|
7
|
-
|
|
8
|
-
i as useLoadingState
|
|
6
|
+
p as default
|
|
9
7
|
};
|
|
@@ -1,52 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useBindCx as
|
|
3
|
-
const z = {
|
|
4
|
-
|
|
5
|
-
class: "circular-loader"
|
|
6
|
-
};
|
|
7
|
-
function x() {
|
|
8
|
-
return f({
|
|
9
|
-
isValid: !1,
|
|
10
|
-
isInvalid: !1,
|
|
11
|
-
isLoading: !1,
|
|
12
|
-
startLoading() {
|
|
13
|
-
this.isLoading = !0;
|
|
14
|
-
},
|
|
15
|
-
stopLoading() {
|
|
16
|
-
this.isLoading = !1;
|
|
17
|
-
},
|
|
18
|
-
validate(e = 800, s) {
|
|
19
|
-
this.isInvalid = !1, this.isValid = !0;
|
|
20
|
-
const i = s ? e - 300 : e;
|
|
21
|
-
return new Promise(
|
|
22
|
-
(a) => setTimeout(s ? () => this.clear().then(() => a(!0)) : () => a(!0), i)
|
|
23
|
-
);
|
|
24
|
-
},
|
|
25
|
-
invalidate(e = 1100, s) {
|
|
26
|
-
this.isValid = !1, this.isInvalid = !0;
|
|
27
|
-
const i = s ? e - 300 : e;
|
|
28
|
-
return new Promise(
|
|
29
|
-
(a) => setTimeout(s ? () => this.clear().then(() => a(!0)) : () => a(!0), i)
|
|
30
|
-
);
|
|
31
|
-
},
|
|
32
|
-
clear(e = 300) {
|
|
33
|
-
return this.isValid = !1, this.isInvalid = !1, this.isLoading = !1, new Promise((s) => {
|
|
34
|
-
setTimeout(() => {
|
|
35
|
-
s(!0);
|
|
36
|
-
}, e);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
const S = /* @__PURE__ */ h({
|
|
1
|
+
import { defineComponent as n, createElementBlock as e, createCommentVNode as p, openBlock as l, normalizeProps as c, mergeProps as m, unref as t, normalizeClass as r, createStaticVNode as v, createElementVNode as i } from "vue";
|
|
2
|
+
import { useBindCx as h, cva as g } from "@scalar/use-hooks/useBindCx";
|
|
3
|
+
const f = { class: "circular-loader" }, z = {}, w = /* @__PURE__ */ n({
|
|
4
|
+
...z,
|
|
42
5
|
inheritAttrs: !1,
|
|
43
6
|
__name: "ScalarLoading",
|
|
44
7
|
props: {
|
|
45
|
-
|
|
8
|
+
loader: {},
|
|
46
9
|
size: {}
|
|
47
10
|
},
|
|
48
|
-
setup(
|
|
49
|
-
const { cx:
|
|
11
|
+
setup(u) {
|
|
12
|
+
const { cx: o } = h(), d = g({
|
|
50
13
|
variants: {
|
|
51
14
|
size: {
|
|
52
15
|
xs: "size-3",
|
|
@@ -63,21 +26,21 @@ const S = /* @__PURE__ */ h({
|
|
|
63
26
|
size: "full"
|
|
64
27
|
}
|
|
65
28
|
});
|
|
66
|
-
return (a,
|
|
67
|
-
(l(),
|
|
68
|
-
class:
|
|
69
|
-
"icon-is-valid": a.
|
|
70
|
-
"icon-is-invalid": a.
|
|
29
|
+
return (a, s) => a.loader ? (l(), e("div", c(m({ key: 0 }, t(o)("loader-wrapper", t(d)({ size: a.size })))), [
|
|
30
|
+
(l(), e("svg", {
|
|
31
|
+
class: r(["svg-loader", {
|
|
32
|
+
"icon-is-valid": a.loader.isValid,
|
|
33
|
+
"icon-is-invalid": a.loader.isInvalid
|
|
71
34
|
}]),
|
|
72
35
|
viewBox: "0 0 100 100",
|
|
73
36
|
xmlns: "http://www.w3.org/2000/svg",
|
|
74
37
|
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
75
38
|
}, [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
class:
|
|
80
|
-
"loader-path-off": a.
|
|
39
|
+
s[0] || (s[0] = v('<path class="svg-path svg-check-mark" d="m 0 60 l 30 30 l 70 -80" data-v-8e99b97a></path><path class="svg-path svg-x-mark" d="m 50 50 l 40 -40" data-v-8e99b97a></path><path class="svg-path svg-x-mark" d="m 50 50 l 40 40" data-v-8e99b97a></path><path class="svg-path svg-x-mark" d="m 50 50 l -40 -40" data-v-8e99b97a></path><path class="svg-path svg-x-mark" d="m 50 50 l -40 40" data-v-8e99b97a></path>', 5)),
|
|
40
|
+
i("g", f, [
|
|
41
|
+
i("circle", {
|
|
42
|
+
class: r(["loader-path", {
|
|
43
|
+
"loader-path-off": !a.loader.isLoading
|
|
81
44
|
}]),
|
|
82
45
|
cx: "50",
|
|
83
46
|
cy: "50",
|
|
@@ -85,12 +48,11 @@ const S = /* @__PURE__ */ h({
|
|
|
85
48
|
r: "20",
|
|
86
49
|
"stroke-width": "3"
|
|
87
50
|
}, null, 2)
|
|
88
|
-
])
|
|
51
|
+
])
|
|
89
52
|
], 2))
|
|
90
|
-
], 16)) :
|
|
53
|
+
], 16)) : p("", !0);
|
|
91
54
|
}
|
|
92
55
|
});
|
|
93
56
|
export {
|
|
94
|
-
|
|
95
|
-
x as useLoadingState
|
|
57
|
+
w as default
|
|
96
58
|
};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export { default as ScalarLoading
|
|
1
|
+
export { default as ScalarLoading } from './ScalarLoading.vue.js';
|
|
2
|
+
export type { LoadingState } from './types';
|
|
3
|
+
export { useLoadingState } from './useLoadingState.js';
|
|
2
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarLoading/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarLoading/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9D,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for the validate and invalidate methods
|
|
3
|
+
*/
|
|
4
|
+
export type LoadingCompletionOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* The duration of to wait before clearing the loading state in milliseconds
|
|
7
|
+
*
|
|
8
|
+
* The promise will resolve after the duration has passed.
|
|
9
|
+
*
|
|
10
|
+
* @default the length of the completion animation and clearing animation
|
|
11
|
+
*/
|
|
12
|
+
duration?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to persist the loading state after the validation.
|
|
15
|
+
*
|
|
16
|
+
* If true, the loading state will not be cleared after the completion animation.
|
|
17
|
+
*
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
persist?: boolean;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The loading state for the ScalarLoading component
|
|
24
|
+
*/
|
|
25
|
+
export type LoadingState = {
|
|
26
|
+
/**
|
|
27
|
+
* Set to true if the loading state completed successfully
|
|
28
|
+
*/
|
|
29
|
+
isValid: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Set to true if the loading state completed with an error
|
|
32
|
+
*/
|
|
33
|
+
isInvalid: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Set to true if the loading state is currently loading
|
|
36
|
+
*/
|
|
37
|
+
isLoading: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Set to true if the loading state is currently active
|
|
40
|
+
*
|
|
41
|
+
* This is what you want to use to conditionally render (e.g. v-if) the loading component.
|
|
42
|
+
*/
|
|
43
|
+
isActive: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Start the loading animation
|
|
46
|
+
*/
|
|
47
|
+
start: () => void;
|
|
48
|
+
/**
|
|
49
|
+
* Set the loading state to true and complete successfully
|
|
50
|
+
*/
|
|
51
|
+
validate: (opts?: LoadingCompletionOptions) => Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Set the loading state to true and complete with an error
|
|
54
|
+
*/
|
|
55
|
+
invalidate: (opts?: LoadingCompletionOptions) => Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Clear the loading state
|
|
58
|
+
*/
|
|
59
|
+
clear: (opts?: Pick<LoadingCompletionOptions, 'duration'>) => Promise<void>;
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarLoading/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB;;OAEG;IACH,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,wBAAwB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5D;;OAEG;IACH,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,wBAAwB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9D;;OAEG;IACH,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,wBAAwB,EAAE,UAAU,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5E,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a reactive loading state for the ScalarLoading component
|
|
3
|
+
*
|
|
4
|
+
* @returns The loading state
|
|
5
|
+
*/
|
|
6
|
+
export declare function useLoadingState(): {
|
|
7
|
+
isValid: boolean;
|
|
8
|
+
isInvalid: boolean;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
start: () => void;
|
|
12
|
+
validate: (opts?: import("./types").LoadingCompletionOptions) => Promise<void>;
|
|
13
|
+
invalidate: (opts?: import("./types").LoadingCompletionOptions) => Promise<void>;
|
|
14
|
+
clear: (opts?: Pick<import("./types").LoadingCompletionOptions, "duration">) => Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useLoadingState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLoadingState.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarLoading/useLoadingState.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,eAAe;;;;;;mBAiCM,CAAC;qBAIL,CAAA;gBAIvB,CAAC;EASV"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { reactive as l } from "vue";
|
|
2
|
+
function r() {
|
|
3
|
+
return l({
|
|
4
|
+
isValid: !1,
|
|
5
|
+
isInvalid: !1,
|
|
6
|
+
isLoading: !1,
|
|
7
|
+
isActive: !1,
|
|
8
|
+
start() {
|
|
9
|
+
this.isLoading = !0, this.isActive = !0, this.isInvalid = !1, this.isValid = !1;
|
|
10
|
+
},
|
|
11
|
+
validate(t = {}) {
|
|
12
|
+
const { duration: i = 1100, persist: s = !1 } = t;
|
|
13
|
+
this.isLoading = !1, this.isInvalid = !1, this.isValid = !0, this.isActive = !0;
|
|
14
|
+
const e = s ? i : i - 300;
|
|
15
|
+
return new Promise(
|
|
16
|
+
(a) => setTimeout(s ? () => a() : () => this.clear().then(() => a()), e)
|
|
17
|
+
);
|
|
18
|
+
},
|
|
19
|
+
invalidate(t = {}) {
|
|
20
|
+
const { duration: i = 1100, persist: s = !1 } = t ?? {};
|
|
21
|
+
this.isLoading = !1, this.isValid = !1, this.isInvalid = !0, this.isActive = !0;
|
|
22
|
+
const e = s ? i : i - 300;
|
|
23
|
+
return new Promise(
|
|
24
|
+
(a) => setTimeout(s ? () => a() : () => this.clear().then(() => a()), e)
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
clear(t = {}) {
|
|
28
|
+
const { duration: i = 300 } = t;
|
|
29
|
+
return this.isValid = !1, this.isInvalid = !1, this.isLoading = !1, new Promise((s) => {
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
this.isActive = !1, s();
|
|
32
|
+
}, i);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
r as useLoadingState
|
|
39
|
+
};
|
|
@@ -12,14 +12,14 @@ import { type LoadingState } from '../ScalarLoading';
|
|
|
12
12
|
* <ScalarSearchInput v-model="search" />
|
|
13
13
|
*/
|
|
14
14
|
declare const _default: import("vue").DefineComponent<{
|
|
15
|
-
|
|
15
|
+
loader?: LoadingState;
|
|
16
16
|
label?: string;
|
|
17
17
|
} & {
|
|
18
18
|
modelValue?: string;
|
|
19
19
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
20
20
|
"update:modelValue": (value: string | undefined) => any;
|
|
21
21
|
}, string, import("vue").PublicProps, Readonly<{
|
|
22
|
-
|
|
22
|
+
loader?: LoadingState;
|
|
23
23
|
label?: string;
|
|
24
24
|
} & {
|
|
25
25
|
modelValue?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarSearchInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSearchInput/ScalarSearchInput.vue"],"names":[],"mappings":"AAoFA,OAAO,EAAE,KAAK,YAAY,EAAiB,MAAM,kBAAkB,CAAA;AAGnE;;;;;;;;;;;GAWG;;
|
|
1
|
+
{"version":3,"file":"ScalarSearchInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSearchInput/ScalarSearchInput.vue"],"names":[],"mappings":"AAoFA,OAAO,EAAE,KAAK,YAAY,EAAiB,MAAM,kBAAkB,CAAA;AAGnE;;;;;;;;;;;GAWG;;aAGQ,YAAY;YACb,MAAM;;iBAwBH,MAAM;;;;aAzBR,YAAY;YACb,MAAM;;iBAwBH,MAAM;;;;AA3BnB,wBA6JC"}
|