@scalar/components 0.19.9 → 0.19.12
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/constants.d.ts +2 -2
- package/dist/components/ScalarButton/constants.d.ts.map +1 -1
- package/dist/components/ScalarButton/constants.js +2 -5
- package/dist/components/ScalarCopy/ScalarCopy.vue.d.ts.map +1 -1
- package/dist/components/ScalarCopy/ScalarCopy.vue.js +18 -13
- package/dist/components/ScalarCopy/ScalarCopyButton.vue.js +34 -34
- package/dist/components/ScalarCopy/index.d.ts +1 -0
- package/dist/components/ScalarCopy/index.d.ts.map +1 -1
- package/dist/components/ScalarCopy/types.d.ts +2 -0
- package/dist/components/ScalarCopy/types.d.ts.map +1 -1
- package/dist/components/ScalarForm/ScalarFormInput.vue.d.ts.map +1 -1
- package/dist/components/ScalarForm/ScalarFormInput.vue.js +13 -12
- package/dist/components/ScalarTextArea/ScalarTextArea.vue.d.ts.map +1 -1
- package/dist/components/ScalarTextArea/ScalarTextArea.vue.js +11 -9
- package/dist/components/ScalarTextInput/ScalarTextInput.vue.d.ts +6 -7
- package/dist/components/ScalarTextInput/ScalarTextInput.vue.d.ts.map +1 -1
- package/dist/components/ScalarTextInput/ScalarTextInput.vue.js +40 -40
- package/dist/components/ScalarTextInput/ScalarTextInputCopy.vue.d.ts +50 -0
- package/dist/components/ScalarTextInput/ScalarTextInputCopy.vue.d.ts.map +1 -0
- package/dist/components/ScalarTextInput/ScalarTextInputCopy.vue.js +68 -0
- package/dist/components/ScalarTextInput/ScalarTextInputCopy.vue2.js +4 -0
- package/dist/components/ScalarTextInput/index.d.ts +1 -0
- package/dist/components/ScalarTextInput/index.d.ts.map +1 -1
- package/dist/index.js +180 -176
- package/dist/style.css +1 -1
- package/package.json +5 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** Styles for the different button variants */
|
|
2
2
|
export declare const BUTTON_VARIANT_STYLES: {
|
|
3
3
|
readonly solid: ["scalar-button-solid", "bg-b-btn text-c-btn focus-visible:border-c-btn active:bg-b-btn hover:bg-h-btn outline-offset-1"];
|
|
4
|
-
readonly outlined: ["scalar-button-outlined", "active:bg-btn-1
|
|
4
|
+
readonly outlined: ["scalar-button-outlined", "active:bg-btn-1 shadow-border bg-b-1 text-c-1 hover:bg-b-2"];
|
|
5
5
|
readonly ghost: ["scalar-button-ghost", "bg-transparent text-c-3 active:text-c-1 hover:text-c-1"];
|
|
6
|
-
readonly gradient: ["scalar-button-gradient", "border bg-b-1.5 bg-linear-to-b from-b-1 to-b-2 hover:bg-linear-to-t", "dark:bg-linear-to-t dark:hover:bg-linear-to-b"];
|
|
6
|
+
readonly gradient: ["scalar-button-gradient", "shadow-border bg-b-1.5 bg-linear-to-b from-b-1 to-b-2 hover:bg-linear-to-t", "dark:bg-linear-to-t dark:hover:bg-linear-to-b"];
|
|
7
7
|
readonly danger: ["scalar-button-danger", "bg-c-danger text-white active:brightness-90 hover:brightness-90"];
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarButton/constants.ts"],"names":[],"mappings":"AAEA,+CAA+C;AAC/C,eAAO,MAAM,qBAAqB;;;;;;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarButton/constants.ts"],"names":[],"mappings":"AAEA,+CAA+C;AAC/C,eAAO,MAAM,qBAAqB;;;;;;CAcmB,CAAA"}
|
|
@@ -3,14 +3,11 @@ const t = {
|
|
|
3
3
|
"scalar-button-solid",
|
|
4
4
|
"bg-b-btn text-c-btn focus-visible:border-c-btn active:bg-b-btn hover:bg-h-btn outline-offset-1"
|
|
5
5
|
],
|
|
6
|
-
outlined: [
|
|
7
|
-
"scalar-button-outlined",
|
|
8
|
-
"active:bg-btn-1 border border-solid border-border bg-b-1 text-c-1 hover:bg-b-2"
|
|
9
|
-
],
|
|
6
|
+
outlined: ["scalar-button-outlined", "active:bg-btn-1 shadow-border bg-b-1 text-c-1 hover:bg-b-2"],
|
|
10
7
|
ghost: ["scalar-button-ghost", "bg-transparent text-c-3 active:text-c-1 hover:text-c-1"],
|
|
11
8
|
gradient: [
|
|
12
9
|
"scalar-button-gradient",
|
|
13
|
-
"border bg-b-1.5 bg-linear-to-b from-b-1 to-b-2 hover:bg-linear-to-t",
|
|
10
|
+
"shadow-border bg-b-1.5 bg-linear-to-b from-b-1 to-b-2 hover:bg-linear-to-t",
|
|
14
11
|
// in dark mode we want to reverse the gradient direction
|
|
15
12
|
"dark:bg-linear-to-t dark:hover:bg-linear-to-b"
|
|
16
13
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarCopy.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCopy/ScalarCopy.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScalarCopy.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCopy/ScalarCopy.vue"],"names":[],"mappings":"AAyEA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG/D;;;;;;;;;;GAUG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;aA+BP,OAAO;;;;aAAP,OAAO;;;oGA0Fd,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1,30 +1,35 @@
|
|
|
1
|
-
import { defineComponent as p, mergeModels as s, useModel as r, watch as
|
|
2
|
-
import { useClipboard as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
|
|
1
|
+
import { defineComponent as p, mergeModels as s, useModel as m, onMounted as r, watch as u, createBlock as f, openBlock as y, unref as c, createSlots as b, withCtx as t, renderSlot as a } from "vue";
|
|
2
|
+
import { useClipboard as k } from "@vueuse/core";
|
|
3
|
+
import $ from "./ScalarCopyButton.vue.js";
|
|
4
|
+
const v = {}, L = /* @__PURE__ */ p({
|
|
5
|
+
...v,
|
|
6
6
|
__name: "ScalarCopy",
|
|
7
7
|
props: /* @__PURE__ */ s({
|
|
8
8
|
content: { default: "" },
|
|
9
9
|
placement: {},
|
|
10
10
|
showLabel: { type: Boolean },
|
|
11
|
-
duration: { default: 1500 }
|
|
11
|
+
duration: { default: 1500 },
|
|
12
|
+
immediate: { type: Boolean }
|
|
12
13
|
}, {
|
|
13
14
|
copied: { type: Boolean, default: !1 },
|
|
14
15
|
copiedModifiers: {}
|
|
15
16
|
}),
|
|
16
17
|
emits: ["update:copied"],
|
|
17
18
|
setup(o) {
|
|
18
|
-
const n =
|
|
19
|
+
const n = m(o, "copied");
|
|
20
|
+
r(() => {
|
|
21
|
+
o.immediate && d(o.content);
|
|
22
|
+
});
|
|
23
|
+
const { copy: d, copied: i } = k({
|
|
19
24
|
legacy: !0,
|
|
20
25
|
copiedDuring: o.duration
|
|
21
26
|
});
|
|
22
|
-
return
|
|
27
|
+
return u(i, (e) => n.value = e), (e, l) => (y(), f($, {
|
|
28
|
+
copied: n.value || c(i),
|
|
23
29
|
placement: o.placement,
|
|
24
30
|
showLabel: o.showLabel,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, y({ _: 2 }, [
|
|
31
|
+
onClick: l[0] || (l[0] = (w) => c(d)(o.content))
|
|
32
|
+
}, b({ _: 2 }, [
|
|
28
33
|
e.$slots.copy ? {
|
|
29
34
|
name: "copy",
|
|
30
35
|
fn: t(() => [
|
|
@@ -46,9 +51,9 @@ const $ = {}, B = /* @__PURE__ */ p({
|
|
|
46
51
|
]),
|
|
47
52
|
key: "2"
|
|
48
53
|
} : void 0
|
|
49
|
-
]), 1032, ["
|
|
54
|
+
]), 1032, ["copied", "placement", "showLabel"]));
|
|
50
55
|
}
|
|
51
56
|
});
|
|
52
57
|
export {
|
|
53
|
-
|
|
58
|
+
L as default
|
|
54
59
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { defineComponent as y, mergeModels as v, useModel as
|
|
1
|
+
import { defineComponent as y, mergeModels as v, useModel as C, computed as b, createElementBlock as a, openBlock as t, mergeProps as k, unref as x, createVNode as i, createElementVNode as c, Transition as d, withCtx as p, createBlock as h, resolveDynamicComponent as g, normalizeClass as u, renderSlot as l, createTextVNode as r } from "vue";
|
|
2
2
|
import { ScalarIconCheck as w, ScalarIconCopy as B } from "@scalar/icons";
|
|
3
|
-
import { useBindCx as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
3
|
+
import { useBindCx as T } from "@scalar/use-hooks/useBindCx";
|
|
4
|
+
import $ from "./ScalarCopyBackdrop.vue.js";
|
|
5
|
+
const z = {
|
|
6
6
|
"aria-hidden": "true",
|
|
7
7
|
class: "flex items-center py-1.5 mask-y-from-[calc(100%-8px)] mask-y-to-100%"
|
|
8
|
-
},
|
|
8
|
+
}, A = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "whitespace-nowrap px-1.5"
|
|
11
|
-
},
|
|
11
|
+
}, F = {
|
|
12
12
|
key: 0,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
13
|
+
class: "sr-only",
|
|
14
|
+
role: "alert"
|
|
15
|
+
}, S = {
|
|
16
16
|
key: 1,
|
|
17
17
|
class: "sr-only"
|
|
18
|
-
},
|
|
19
|
-
...
|
|
18
|
+
}, M = {}, L = /* @__PURE__ */ y({
|
|
19
|
+
...M,
|
|
20
20
|
inheritAttrs: !1,
|
|
21
21
|
__name: "ScalarCopyButton",
|
|
22
22
|
props: /* @__PURE__ */ v({
|
|
@@ -28,23 +28,23 @@ const S = {
|
|
|
28
28
|
}),
|
|
29
29
|
emits: ["update:copied"],
|
|
30
30
|
setup(n) {
|
|
31
|
-
const o =
|
|
32
|
-
return (s, e) => (t(), a("button",
|
|
31
|
+
const o = C(n, "copied"), { cx: m } = T(), f = b(() => o.value ? w : B);
|
|
32
|
+
return (s, e) => (t(), a("button", k(
|
|
33
33
|
{ type: "button" },
|
|
34
|
-
|
|
34
|
+
x(m)(
|
|
35
35
|
"group/copy-button relative z-0 flex items-center justify-center",
|
|
36
36
|
"size-6 p-1.25 -m-1 rounded text-xs bg-b-2",
|
|
37
37
|
o.value ? "text-c-1" : "text-c-2 hover:text-c-1"
|
|
38
38
|
)
|
|
39
39
|
), [
|
|
40
40
|
i(d, {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
enterActiveClass: "transition-transform",
|
|
42
|
+
enterFromClass: "scale-0",
|
|
43
|
+
enterToClass: "scale-100",
|
|
44
|
+
leaveActiveClass: "transition-transform",
|
|
45
|
+
leaveFromClass: "scale-100",
|
|
46
|
+
leaveToClass: "scale-0",
|
|
47
|
+
mode: "out-in"
|
|
48
48
|
}, {
|
|
49
49
|
default: p(() => [
|
|
50
50
|
(t(), h(g(f.value), { class: "size-full" }))
|
|
@@ -58,18 +58,18 @@ const S = {
|
|
|
58
58
|
"right-0 pr-[100%]": n.placement === "left"
|
|
59
59
|
}])
|
|
60
60
|
}, [
|
|
61
|
-
c("div",
|
|
61
|
+
c("div", z, [
|
|
62
62
|
i(d, {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
enterActiveClass: "transition-transform ease-out",
|
|
64
|
+
enterFromClass: "translate-y-1.5",
|
|
65
|
+
enterToClass: "translate-y-0",
|
|
66
|
+
leaveActiveClass: "transition-transform ease-in",
|
|
67
|
+
leaveFromClass: "translate-y-0",
|
|
68
|
+
leaveToClass: "-translate-y-1.5",
|
|
69
|
+
mode: "out-in"
|
|
70
70
|
}, {
|
|
71
71
|
default: p(() => [
|
|
72
|
-
o.value ? (t(), a("div",
|
|
72
|
+
o.value ? (t(), a("div", A, [
|
|
73
73
|
l(s.$slots, "copied", {}, () => [
|
|
74
74
|
e[0] || (e[0] = r("Copied", -1))
|
|
75
75
|
])
|
|
@@ -87,22 +87,22 @@ const S = {
|
|
|
87
87
|
_: 3
|
|
88
88
|
})
|
|
89
89
|
]),
|
|
90
|
-
o.value ? (t(), a("div",
|
|
90
|
+
o.value ? (t(), a("div", F, [
|
|
91
91
|
l(s.$slots, "copied", {}, () => [
|
|
92
92
|
e[2] || (e[2] = r("Copied", -1))
|
|
93
93
|
])
|
|
94
|
-
])) : (t(), a("div",
|
|
94
|
+
])) : (t(), a("div", S, [
|
|
95
95
|
l(s.$slots, "copy", {}, () => [
|
|
96
96
|
e[3] || (e[3] = r("Copy", -1))
|
|
97
97
|
])
|
|
98
98
|
])),
|
|
99
99
|
l(s.$slots, "backdrop", {}, () => [
|
|
100
|
-
i(
|
|
100
|
+
i($)
|
|
101
101
|
])
|
|
102
102
|
], 2)
|
|
103
103
|
], 16));
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
export {
|
|
107
|
-
|
|
107
|
+
L as default
|
|
108
108
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCopy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCopy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -14,6 +14,8 @@ export type ScalarCopyProps = {
|
|
|
14
14
|
* @default 1500
|
|
15
15
|
*/
|
|
16
16
|
duration?: number;
|
|
17
|
+
/** Whether to copy the content immediately on mount */
|
|
18
|
+
immediate?: boolean;
|
|
17
19
|
};
|
|
18
20
|
export type ScalarCopySlots = {
|
|
19
21
|
/** The label shown next to the copy button before it is clicked */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCopy/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,CAAA;AAElD,MAAM,MAAM,eAAe,GAAG;IAC5B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCopy/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,CAAA;AAElD,MAAM,MAAM,eAAe,GAAG;IAC5B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uDAAuD;IACvD,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,OAAO,CAAA;IACpB,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,OAAO,CAAA;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,OAAO,CAAA;CACrB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarFormInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarForm/ScalarFormInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScalarFormInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarForm/ScalarFormInput.vue"],"names":[],"mappings":"AA4DA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAKpC;;;;;;;;;;;;GAYG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;SAEX,MAAM,GAAG,SAAS;;SAAlB,MAAM,GAAG,SAAS;;cAkEX,CAAC,KAAK,IAAgB,KAAK,GAAG;EASxC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useBindCx as
|
|
3
|
-
import { useFormGroupInput as
|
|
4
|
-
const
|
|
5
|
-
...
|
|
1
|
+
import { defineComponent as u, createBlock as i, openBlock as a, resolveDynamicComponent as d, mergeProps as c, unref as e, withCtx as l, renderSlot as p } from "vue";
|
|
2
|
+
import { useBindCx as f, cva as b } from "@scalar/use-hooks/useBindCx";
|
|
3
|
+
import { useFormGroupInput as m } from "./useFormGroups.js";
|
|
4
|
+
const g = {}, C = /* @__PURE__ */ u({
|
|
5
|
+
...g,
|
|
6
6
|
inheritAttrs: !1,
|
|
7
7
|
__name: "ScalarFormInput",
|
|
8
8
|
props: {
|
|
9
9
|
is: { default: "button" }
|
|
10
10
|
},
|
|
11
11
|
setup(t) {
|
|
12
|
-
const { cx: o } =
|
|
12
|
+
const { cx: o } = f(), r = m(), n = b({
|
|
13
13
|
base: [
|
|
14
14
|
// Layout
|
|
15
|
-
"bg-b-1.5 flex items-center text-c-2 gap-0.75
|
|
15
|
+
"bg-b-1.5 flex items-center text-c-2 gap-0.75 p-3",
|
|
16
|
+
"text-base leading-5",
|
|
16
17
|
//Focus
|
|
17
18
|
"outline-offset-[-1px] has-[:focus-visible]:outline"
|
|
18
19
|
],
|
|
19
20
|
variants: {
|
|
20
21
|
grouped: {
|
|
21
22
|
true: "first:rounded-t-[inherit] last:rounded-b-[inherit]",
|
|
22
|
-
false: "rounded border"
|
|
23
|
+
false: "rounded shadow-border"
|
|
23
24
|
},
|
|
24
25
|
button: { true: "cursor-pointer hover:bg-b-2" }
|
|
25
26
|
}
|
|
26
27
|
});
|
|
27
|
-
return (
|
|
28
|
+
return (s, h) => (a(), i(d(t.is), c({
|
|
28
29
|
type: t.is === "button" ? "button" : void 0
|
|
29
30
|
}, e(o)(e(n)({ button: t.is === "button", grouped: e(r) }))), {
|
|
30
|
-
default:
|
|
31
|
-
|
|
31
|
+
default: l(() => [
|
|
32
|
+
p(s.$slots, "default")
|
|
32
33
|
]),
|
|
33
34
|
_: 3
|
|
34
35
|
}, 16, ["type"]));
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
+
C as default
|
|
39
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarTextArea.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTextArea/ScalarTextArea.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScalarTextArea.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTextArea/ScalarTextArea.vue"],"names":[],"mappings":"AA4DA;;;;;;;GAOG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;iBAmBL,MAAM;;;;iBAAN,MAAM;;;kFAsFf,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineComponent as u, useModel as m, onMounted as f, createBlock as d, openBlock as c, unref as t, mergeProps as l, withCtx as p, withDirectives as x, createElementVNode as _, vModelText as v } from "vue";
|
|
2
|
-
import { useBindCx as
|
|
3
|
-
import { useTextareaAutosize as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
6
|
-
...
|
|
2
|
+
import { useBindCx as g } from "@scalar/use-hooks/useBindCx";
|
|
3
|
+
import { useTextareaAutosize as h } from "@vueuse/core";
|
|
4
|
+
import k from "../ScalarForm/ScalarFormInput.vue.js";
|
|
5
|
+
const A = {}, B = /* @__PURE__ */ u({
|
|
6
|
+
...A,
|
|
7
7
|
inheritAttrs: !1,
|
|
8
8
|
__name: "ScalarTextArea",
|
|
9
9
|
props: {
|
|
@@ -12,16 +12,18 @@ const C = {}, B = /* @__PURE__ */ u({
|
|
|
12
12
|
},
|
|
13
13
|
emits: ["update:modelValue"],
|
|
14
14
|
setup(i) {
|
|
15
|
-
const o = m(i, "modelValue"), { textarea: r } =
|
|
15
|
+
const o = m(i, "modelValue"), { textarea: r } = h({
|
|
16
16
|
// @ts-expect-error - unexpected type mismatch
|
|
17
17
|
input: o,
|
|
18
18
|
styleProp: "minHeight"
|
|
19
|
-
}), { stylingAttrsCx: a, otherAttrs: n } =
|
|
19
|
+
}), { stylingAttrsCx: a, otherAttrs: n } = g();
|
|
20
20
|
return f(() => {
|
|
21
21
|
"autofocus" in n.value && r.value?.focus();
|
|
22
|
-
}), (
|
|
22
|
+
}), (C, e) => (c(), d(t(k), l(
|
|
23
23
|
{ is: "div" },
|
|
24
|
-
t(a)(
|
|
24
|
+
t(a)(
|
|
25
|
+
"custom-scroll flex text-c-1 min-h-0 shrink cursor-text leading-snug"
|
|
26
|
+
),
|
|
25
27
|
{
|
|
26
28
|
onClick: e[1] || (e[1] = (s) => t(r)?.focus())
|
|
27
29
|
}
|
|
@@ -14,20 +14,19 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
14
14
|
modelValue?: string;
|
|
15
15
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
16
|
"update:modelValue": (value: string | undefined) => any;
|
|
17
|
+
} & {
|
|
18
|
+
click: (event: MouseEvent) => any;
|
|
17
19
|
}, string, import("vue").PublicProps, Readonly<{
|
|
18
20
|
readonly?: boolean;
|
|
19
21
|
} & {
|
|
20
22
|
modelValue?: string;
|
|
21
23
|
}> & Readonly<{
|
|
22
24
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
25
|
+
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
23
26
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
24
|
-
prefix?: (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} & {
|
|
28
|
-
suffix?: (props: {}) => any;
|
|
29
|
-
} & {
|
|
30
|
-
aside?: (props: {}) => any;
|
|
27
|
+
prefix?: () => unknown;
|
|
28
|
+
suffix?: () => unknown;
|
|
29
|
+
aside?: () => unknown;
|
|
31
30
|
}>;
|
|
32
31
|
type __VLS_WithSlots<T, S> = T & {
|
|
33
32
|
new (): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarTextInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTextInput/ScalarTextInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScalarTextInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTextInput/ScalarTextInput.vue"],"names":[],"mappings":"AA6GA;;;;;;;GAOG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;eAEL,OAAO;;iBA8CP,MAAM;;;;;;eA9CN,OAAO;;iBA8CP,MAAM;;;;;aAjCR,MAAM,OAAO;aAEb,MAAM,OAAO;YAEd,MAAM,OAAO;EA0KnB,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useBindCx as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as k, mergeModels as f, useModel as $, ref as w, onMounted as _, createBlock as C, openBlock as o, unref as a, mergeProps as m, withCtx as g, createElementVNode as d, renderSlot as n, createElementBlock as l, createCommentVNode as i, withDirectives as V, vModelDynamic as b, toDisplayString as B } from "vue";
|
|
2
|
+
import { useBindCx as M } from "@scalar/use-hooks/useBindCx";
|
|
3
|
+
import A from "../ScalarForm/ScalarFormInput.vue.js";
|
|
4
|
+
const D = { class: "flex items-center flex-1 relative" }, S = {
|
|
5
5
|
key: 0,
|
|
6
|
-
class: "select-none whitespace-nowrap text-
|
|
7
|
-
},
|
|
6
|
+
class: "select-none whitespace-nowrap text-transparent"
|
|
7
|
+
}, E = ["aria-readonly", "readonly"], N = {
|
|
8
8
|
key: 1,
|
|
9
|
-
class: "absolute inset-0 select-none overflow-hidden whitespace-nowrap
|
|
10
|
-
},
|
|
9
|
+
class: "absolute flex items-center inset-0 select-none overflow-hidden whitespace-nowrap"
|
|
10
|
+
}, z = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "text-c-2"
|
|
13
|
-
},
|
|
13
|
+
}, I = { class: "text-transparent" }, P = {
|
|
14
14
|
key: 1,
|
|
15
15
|
class: "text-c-2"
|
|
16
|
-
},
|
|
17
|
-
...
|
|
16
|
+
}, T = {}, F = /* @__PURE__ */ k({
|
|
17
|
+
...T,
|
|
18
18
|
inheritAttrs: !1,
|
|
19
19
|
__name: "ScalarTextInput",
|
|
20
|
-
props: /* @__PURE__ */
|
|
20
|
+
props: /* @__PURE__ */ f({
|
|
21
21
|
readonly: { type: Boolean }
|
|
22
22
|
}, {
|
|
23
23
|
modelValue: {},
|
|
24
24
|
modelModifiers: {}
|
|
25
25
|
}),
|
|
26
|
-
emits: ["update:modelValue"],
|
|
27
|
-
setup(t) {
|
|
28
|
-
const r =
|
|
29
|
-
|
|
30
|
-
"autofocus" in
|
|
26
|
+
emits: /* @__PURE__ */ f(["click"], ["update:modelValue"]),
|
|
27
|
+
setup(t, { emit: p }) {
|
|
28
|
+
const h = p, r = $(t, "modelValue"), s = w(), { stylingAttrsCx: y, otherAttrs: c } = M();
|
|
29
|
+
_(() => {
|
|
30
|
+
"autofocus" in c.value && s.value?.focus();
|
|
31
31
|
});
|
|
32
|
-
function
|
|
33
|
-
t.readonly ?
|
|
32
|
+
function v(e) {
|
|
33
|
+
h("click", e), t.readonly ? s.value?.select() : s.value?.focus();
|
|
34
34
|
}
|
|
35
|
-
return (e,
|
|
35
|
+
return (e, u) => (o(), C(a(A), m(
|
|
36
36
|
{ is: "div" },
|
|
37
|
-
|
|
37
|
+
a(y)(
|
|
38
38
|
"cursor-text text-c-1",
|
|
39
39
|
t.readonly ? "" : "focus-within:bg-b-1"
|
|
40
40
|
),
|
|
41
|
-
{ onClick:
|
|
41
|
+
{ onClick: v }
|
|
42
42
|
), {
|
|
43
|
-
default:
|
|
44
|
-
d("div",
|
|
45
|
-
e.$slots.prefix ? (
|
|
43
|
+
default: g(() => [
|
|
44
|
+
d("div", D, [
|
|
45
|
+
e.$slots.prefix ? (o(), l("div", S, [
|
|
46
46
|
n(e.$slots, "prefix")
|
|
47
|
-
])) :
|
|
48
|
-
|
|
47
|
+
])) : i("", !0),
|
|
48
|
+
V(d("input", m({
|
|
49
49
|
ref_key: "input",
|
|
50
|
-
ref:
|
|
51
|
-
"onUpdate:modelValue":
|
|
50
|
+
ref: s,
|
|
51
|
+
"onUpdate:modelValue": u[0] || (u[0] = (x) => r.value = x),
|
|
52
52
|
"aria-readonly": t.readonly || void 0,
|
|
53
|
-
class: "z-1 min-w-0 flex-1 border-none bg-transparent
|
|
53
|
+
class: "z-1 min-w-0 flex-1 rounded-none border-none bg-transparent placeholder:font-[inherit] focus-within:outline-none",
|
|
54
54
|
readonly: t.readonly
|
|
55
|
-
},
|
|
56
|
-
[
|
|
55
|
+
}, a(c)), null, 16, E), [
|
|
56
|
+
[b, r.value]
|
|
57
57
|
]),
|
|
58
|
-
e.$slots.prefix || e.$slots.suffix ? (
|
|
59
|
-
e.$slots.prefix ? (
|
|
58
|
+
e.$slots.prefix || e.$slots.suffix ? (o(), l("div", N, [
|
|
59
|
+
e.$slots.prefix ? (o(), l("span", z, [
|
|
60
60
|
n(e.$slots, "prefix")
|
|
61
|
-
])) :
|
|
62
|
-
d("span",
|
|
63
|
-
e.$slots.suffix ? (
|
|
61
|
+
])) : i("", !0),
|
|
62
|
+
d("span", I, B(r.value || e.$attrs.placeholder), 1),
|
|
63
|
+
e.$slots.suffix ? (o(), l("span", P, [
|
|
64
64
|
n(e.$slots, "suffix")
|
|
65
|
-
])) :
|
|
66
|
-
])) :
|
|
65
|
+
])) : i("", !0)
|
|
66
|
+
])) : i("", !0)
|
|
67
67
|
]),
|
|
68
68
|
n(e.$slots, "aside")
|
|
69
69
|
]),
|
|
@@ -72,5 +72,5 @@ const M = { class: "flex flex-1 relative" }, A = {
|
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
export {
|
|
75
|
-
|
|
75
|
+
F as default
|
|
76
76
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scalar Text Input Copy component
|
|
3
|
+
*
|
|
4
|
+
* A wrapper around the ScalarTextInput component that provides a
|
|
5
|
+
* copy button and allows copying of the input content to the clipboard.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <ScalarTextInputCopy v-model="model" />
|
|
9
|
+
*/
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
12
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
13
|
+
/** The placement of the copy button */
|
|
14
|
+
duration?: number;
|
|
15
|
+
/** Whether the input is writable */
|
|
16
|
+
editable?: boolean;
|
|
17
|
+
/** Whether to copy the model value immediately on mount */
|
|
18
|
+
immediate?: boolean;
|
|
19
|
+
} & {
|
|
20
|
+
modelValue?: string;
|
|
21
|
+
copied?: boolean;
|
|
22
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
|
+
"update:modelValue": (value: string | undefined) => any;
|
|
24
|
+
"update:copied": (value: boolean) => any;
|
|
25
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
26
|
+
/** The placement of the copy button */
|
|
27
|
+
duration?: number;
|
|
28
|
+
/** Whether the input is writable */
|
|
29
|
+
editable?: boolean;
|
|
30
|
+
/** Whether to copy the model value immediately on mount */
|
|
31
|
+
immediate?: boolean;
|
|
32
|
+
} & {
|
|
33
|
+
modelValue?: string;
|
|
34
|
+
copied?: boolean;
|
|
35
|
+
}> & Readonly<{
|
|
36
|
+
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
37
|
+
"onUpdate:copied"?: ((value: boolean) => any) | undefined;
|
|
38
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
39
|
+
prefix?: () => unknown;
|
|
40
|
+
suffix?: () => unknown;
|
|
41
|
+
aside?: () => unknown;
|
|
42
|
+
copy?: () => unknown;
|
|
43
|
+
copied?: () => unknown;
|
|
44
|
+
}>;
|
|
45
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
46
|
+
new (): {
|
|
47
|
+
$slots: S;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=ScalarTextInputCopy.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarTextInputCopy.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTextInput/ScalarTextInputCopy.vue"],"names":[],"mappings":"AAgGA;;;;;;;;GAQG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAEhB,uCAAuC;eAC5B,MAAM;IACjB,oCAAoC;eACzB,OAAO;IAClB,2DAA2D;gBAC/C,OAAO;;iBAyCR,MAAM;aACR,OAAO;;;;;IA/ChB,uCAAuC;eAC5B,MAAM;IACjB,oCAAoC;eACzB,OAAO;IAClB,2DAA2D;gBAC/C,OAAO;;iBAyCR,MAAM;aACR,OAAO;;;;;aAnCP,MAAM,OAAO;aAEb,MAAM,OAAO;YAEd,MAAM,OAAO;WAEd,MAAM,OAAO;aAEX,MAAM,OAAO;EAiKpB,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { defineComponent as c, mergeModels as f, onMounted as v, useModel as p, watch as y, createBlock as $, openBlock as b, unref as d, withCtx as t, createVNode as r, withModifiers as k, createSlots as C, renderSlot as s } from "vue";
|
|
2
|
+
import { useClipboard as V } from "@vueuse/core";
|
|
3
|
+
import M from "./ScalarTextInput.vue.js";
|
|
4
|
+
import B from "../ScalarCopy/ScalarCopyButton.vue.js";
|
|
5
|
+
import g from "../ScalarCopy/ScalarCopyBackdrop.vue.js";
|
|
6
|
+
const w = {}, T = /* @__PURE__ */ c({
|
|
7
|
+
...w,
|
|
8
|
+
__name: "ScalarTextInputCopy",
|
|
9
|
+
props: /* @__PURE__ */ f({
|
|
10
|
+
duration: { default: 1500 },
|
|
11
|
+
editable: { type: Boolean },
|
|
12
|
+
immediate: { type: Boolean }
|
|
13
|
+
}, {
|
|
14
|
+
modelValue: {},
|
|
15
|
+
modelModifiers: {},
|
|
16
|
+
copied: { type: Boolean, default: !1 },
|
|
17
|
+
copiedModifiers: {}
|
|
18
|
+
}),
|
|
19
|
+
emits: ["update:modelValue", "update:copied"],
|
|
20
|
+
setup(a) {
|
|
21
|
+
v(() => {
|
|
22
|
+
a.immediate && e.value && i(e.value);
|
|
23
|
+
});
|
|
24
|
+
const e = p(a, "modelValue"), u = p(a, "copied"), { copy: i, copied: m } = V({
|
|
25
|
+
legacy: !0,
|
|
26
|
+
copiedDuring: a.duration
|
|
27
|
+
});
|
|
28
|
+
return y(m, (o) => u.value = o), (o, l) => (b(), $(M, {
|
|
29
|
+
modelValue: e.value,
|
|
30
|
+
"onUpdate:modelValue": l[1] || (l[1] = (n) => e.value = n),
|
|
31
|
+
readonly: !a.editable,
|
|
32
|
+
onClick: l[2] || (l[2] = (n) => e.value && d(i)(e.value))
|
|
33
|
+
}, {
|
|
34
|
+
aside: t(() => [
|
|
35
|
+
r(d(B), {
|
|
36
|
+
class: "z-1",
|
|
37
|
+
copied: u.value || d(m),
|
|
38
|
+
placement: "left",
|
|
39
|
+
onClick: l[0] || (l[0] = k((n) => e.value && d(i)(e.value), ["stop"]))
|
|
40
|
+
}, C({
|
|
41
|
+
backdrop: t(() => [
|
|
42
|
+
r(d(g), { class: "bg-b-1.5" })
|
|
43
|
+
]),
|
|
44
|
+
_: 2
|
|
45
|
+
}, [
|
|
46
|
+
o.$slots.copy ? {
|
|
47
|
+
name: "copy",
|
|
48
|
+
fn: t(() => [
|
|
49
|
+
s(o.$slots, "copy")
|
|
50
|
+
]),
|
|
51
|
+
key: "0"
|
|
52
|
+
} : void 0,
|
|
53
|
+
o.$slots.copied ? {
|
|
54
|
+
name: "copied",
|
|
55
|
+
fn: t(() => [
|
|
56
|
+
s(o.$slots, "copied")
|
|
57
|
+
]),
|
|
58
|
+
key: "1"
|
|
59
|
+
} : void 0
|
|
60
|
+
]), 1032, ["copied"])
|
|
61
|
+
]),
|
|
62
|
+
_: 3
|
|
63
|
+
}, 8, ["modelValue", "readonly"]));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
export {
|
|
67
|
+
T as default
|
|
68
|
+
};
|