@scalar/components 0.14.1 → 0.14.3

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.
Files changed (41) hide show
  1. package/dist/components/ScalarButton/ScalarButton.vue.d.ts.map +1 -1
  2. package/dist/components/ScalarButton/ScalarButton.vue.js +4 -4
  3. package/dist/components/ScalarButton/variants.js +5 -5
  4. package/dist/components/ScalarFileUpload/ScalarFileUpload.stories.d.ts +12 -12
  5. package/dist/components/ScalarFileUpload/ScalarFileUpload.vue.d.ts +1 -1
  6. package/dist/components/ScalarFileUpload/ScalarFileUpload.vue.js +129 -0
  7. package/dist/components/ScalarFileUpload/ScalarFileUpload.vue2.js +4 -0
  8. package/dist/components/ScalarFileUpload/ScalarFileUploadDropTarget.vue.js +31 -0
  9. package/dist/components/ScalarFileUpload/ScalarFileUploadDropTarget.vue2.js +4 -0
  10. package/dist/components/ScalarFileUpload/ScalarFileUploadError.vue.js +21 -0
  11. package/dist/components/ScalarFileUpload/ScalarFileUploadError.vue2.js +4 -0
  12. package/dist/components/ScalarFileUpload/ScalarFileUploadFileList.vue.js +55 -0
  13. package/dist/components/ScalarFileUpload/ScalarFileUploadFileList.vue2.js +4 -0
  14. package/dist/components/ScalarFileUpload/ScalarFileUploadInput.vue.d.ts +1 -1
  15. package/dist/components/ScalarFileUpload/ScalarFileUploadInput.vue.js +49 -0
  16. package/dist/components/ScalarFileUpload/ScalarFileUploadInput.vue2.js +4 -0
  17. package/dist/components/ScalarFileUpload/ScalarFileUploadInputCompact.vue.d.ts +1 -1
  18. package/dist/components/ScalarFileUpload/ScalarFileUploadInputCompact.vue.js +44 -0
  19. package/dist/components/ScalarFileUpload/ScalarFileUploadInputCompact.vue2.js +4 -0
  20. package/dist/components/ScalarFileUpload/ScalarFileUploadLoading.vue.js +27 -0
  21. package/dist/components/ScalarFileUpload/ScalarFileUploadLoading.vue2.js +4 -0
  22. package/dist/components/ScalarFileUpload/index.d.ts +7 -7
  23. package/dist/components/ScalarFileUpload/types.js +6 -0
  24. package/dist/components/ScalarMarkdown/ScalarMarkdown.stories.d.ts +20 -0
  25. package/dist/components/ScalarMarkdown/ScalarMarkdown.stories.d.ts.map +1 -1
  26. package/dist/components/ScalarMarkdown/ScalarMarkdown.test.d.ts +2 -0
  27. package/dist/components/ScalarMarkdown/ScalarMarkdown.test.d.ts.map +1 -0
  28. package/dist/components/ScalarMarkdown/ScalarMarkdown.vue.d.ts +3 -0
  29. package/dist/components/ScalarMarkdown/ScalarMarkdown.vue.d.ts.map +1 -1
  30. package/dist/components/ScalarMarkdown/ScalarMarkdown.vue.js +30 -20
  31. package/dist/components/ScalarModal/ScalarModal.vue.d.ts.map +1 -1
  32. package/dist/components/ScalarModal/ScalarModal.vue.js +2 -2
  33. package/dist/components/ScalarModal/ScalarModal.vue2.js +17 -17
  34. package/dist/components/ScalarSidebar/ScalarSidebarIndent.vue.d.ts.map +1 -1
  35. package/dist/components/ScalarSidebar/ScalarSidebarIndent.vue.js +2 -2
  36. package/dist/components/ScalarTooltip/ScalarTooltip.vue.d.ts.map +1 -1
  37. package/dist/index.d.ts +2 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +137 -123
  40. package/dist/style.css +1 -1
  41. package/package.json +10 -13
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarButton/ScalarButton.vue"],"names":[],"mappings":"AA+DA,OAAO,EAAE,KAAK,YAAY,EAAiB,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,YAAY,CAAA;AAIpD;;GAEG;AACH,KAAK,WAAW,GAAG;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IAClC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACvB,OAAO,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAA;IAC7B,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;CACrC,CAAC;AAyBJ,iBAAS,cAAc;WAoET,OAAO,IAA6B;;sBAVxB,GAAG;yBACA,GAAG;yBACH,GAAG;;;;EAa/B;AAYD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;eApHL,OAAO;UAIZ,QAAQ,GAAG,QAAQ,GAAG,OAAO;6EAuHtC,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAgBpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarButton/ScalarButton.vue"],"names":[],"mappings":"AA+DA,OAAO,EAAE,KAAK,YAAY,EAAiB,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,YAAY,CAAA;AAIpD;;GAEG;AACH,KAAK,WAAW,GAAG;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IAClC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACvB,OAAO,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAA;IAC7B,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;CACrC,CAAC;AAyBJ,iBAAS,cAAc;WAmET,OAAO,IAA6B;;sBAVxB,GAAG;yBACA,GAAG;yBACH,GAAG;;;;EAa/B;AAYD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;eAnHL,OAAO;UAIZ,QAAQ,GAAG,QAAQ,GAAG,OAAO;6EAsHtC,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAgBpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -4,7 +4,7 @@ import { variants as v } from "./variants.js";
4
4
  import y from "../ScalarLoading/ScalarLoading.vue.js";
5
5
  const h = ["ariaDisabled", "type"], c = {
6
6
  key: 3,
7
- class: "centered-x absolute"
7
+ class: "centered"
8
8
  }, $ = /* @__PURE__ */ f({
9
9
  inheritAttrs: !1,
10
10
  __name: "ScalarButton",
@@ -19,7 +19,7 @@ const h = ["ariaDisabled", "type"], c = {
19
19
  setup(k) {
20
20
  const { cx: p } = b();
21
21
  return (e, B) => {
22
- var s, n, t, d;
22
+ var s, n, d, t;
23
23
  return i(), a("button", m(
24
24
  {
25
25
  ariaDisabled: e.disabled || void 0,
@@ -37,11 +37,11 @@ const h = ["ariaDisabled", "type"], c = {
37
37
  ], 2)) : r("", !0),
38
38
  e.loading ? (i(), a("span", {
39
39
  key: 1,
40
- class: u({ invisible: (t = e.loading) == null ? void 0 : t.isLoading })
40
+ class: u({ invisible: (d = e.loading) == null ? void 0 : d.isLoading })
41
41
  }, [
42
42
  l(e.$slots, "default")
43
43
  ], 2)) : l(e.$slots, "default", { key: 2 }),
44
- (d = e.loading) != null && d.isLoading ? (i(), a("div", c, [
44
+ (t = e.loading) != null && t.isLoading ? (i(), a("div", c, [
45
45
  g(o(y), {
46
46
  loadingState: e.loading,
47
47
  size: "xl"
@@ -8,10 +8,10 @@ const e = {
8
8
  "scalar-button-outlined",
9
9
  "active:bg-btn-1 border border-solid border-border bg-b-1 text-c-1 hover:bg-b-2 shadow"
10
10
  ],
11
- ghost: ["scalar-button-ghost", "bg-transparent text-c-3 active:text-c-1 hocus:text-c-1"],
12
- danger: ["scalar-button-danger", "bg-c-danger text-white active:brightness-90 hocus:brightness-90"]
13
- }, s = t({
14
- base: "scalar-button scalar-row cursor-pointer items-center justify-center rounded font-medium -outline-offset-1",
11
+ ghost: ["scalar-button-ghost", "bg-transparent text-c-3 active:text-c-1 hover:text-c-1"],
12
+ danger: ["scalar-button-danger", "bg-c-danger text-white active:brightness-90 hover:brightness-90"]
13
+ }, r = t({
14
+ base: "scalar-button flex cursor-pointer items-center justify-center rounded font-medium -outline-offset-1",
15
15
  variants: {
16
16
  disabled: {
17
17
  true: "bg-background-2 text-color-3 shadow-none"
@@ -30,5 +30,5 @@ const e = {
30
30
  });
31
31
  export {
32
32
  e as styles,
33
- s as variants
33
+ r as variants
34
34
  };
@@ -6,7 +6,7 @@ declare const meta: {
6
6
  error?: string;
7
7
  } & {
8
8
  multiple?: boolean;
9
- accept?: import("./types").ExtensionList | string;
9
+ accept?: import("./types.js").ExtensionList | string;
10
10
  loader?: import("../ScalarLoading").LoadingState;
11
11
  variant?: "compact" | "default";
12
12
  }> & Readonly<{
@@ -30,7 +30,7 @@ declare const meta: {
30
30
  error?: string;
31
31
  } & {
32
32
  multiple?: boolean;
33
- accept?: import("./types").ExtensionList | string;
33
+ accept?: import("./types.js").ExtensionList | string;
34
34
  loader?: import("../ScalarLoading").LoadingState;
35
35
  variant?: "compact" | "default";
36
36
  }> & Readonly<{
@@ -46,7 +46,7 @@ declare const meta: {
46
46
  error?: string;
47
47
  } & {
48
48
  multiple?: boolean;
49
- accept?: import("./types").ExtensionList | string;
49
+ accept?: import("./types.js").ExtensionList | string;
50
50
  loader?: import("../ScalarLoading").LoadingState;
51
51
  variant?: "compact" | "default";
52
52
  }> & Readonly<{
@@ -95,7 +95,7 @@ declare const meta: {
95
95
  error?: string;
96
96
  } & {
97
97
  multiple?: boolean;
98
- accept?: import("./types").ExtensionList | string;
98
+ accept?: import("./types.js").ExtensionList | string;
99
99
  loader?: import("../ScalarLoading").LoadingState;
100
100
  variant?: "compact" | "default";
101
101
  }> & Readonly<{
@@ -119,7 +119,7 @@ declare const meta: {
119
119
  error?: string;
120
120
  } & {
121
121
  multiple?: boolean;
122
- accept?: import("./types").ExtensionList | string;
122
+ accept?: import("./types.js").ExtensionList | string;
123
123
  loader?: import("../ScalarLoading").LoadingState;
124
124
  variant?: "compact" | "default";
125
125
  }> & Readonly<{
@@ -135,7 +135,7 @@ declare const meta: {
135
135
  error?: string;
136
136
  } & {
137
137
  multiple?: boolean;
138
- accept?: import("./types").ExtensionList | string;
138
+ accept?: import("./types.js").ExtensionList | string;
139
139
  loader?: import("../ScalarLoading").LoadingState;
140
140
  variant?: "compact" | "default";
141
141
  }> & Readonly<{
@@ -171,7 +171,7 @@ declare const meta: {
171
171
  error?: string;
172
172
  } & {
173
173
  multiple?: boolean;
174
- accept?: import("./types").ExtensionList | string;
174
+ accept?: import("./types.js").ExtensionList | string;
175
175
  loader?: import("../ScalarLoading").LoadingState;
176
176
  variant?: "compact" | "default";
177
177
  }> & Readonly<{
@@ -195,7 +195,7 @@ declare const meta: {
195
195
  error?: string;
196
196
  } & {
197
197
  multiple?: boolean;
198
- accept?: import("./types").ExtensionList | string;
198
+ accept?: import("./types.js").ExtensionList | string;
199
199
  loader?: import("../ScalarLoading").LoadingState;
200
200
  variant?: "compact" | "default";
201
201
  }> & Readonly<{
@@ -211,7 +211,7 @@ declare const meta: {
211
211
  error?: string;
212
212
  } & {
213
213
  multiple?: boolean;
214
- accept?: import("./types").ExtensionList | string;
214
+ accept?: import("./types.js").ExtensionList | string;
215
215
  loader?: import("../ScalarLoading").LoadingState;
216
216
  variant?: "compact" | "default";
217
217
  }> & Readonly<{
@@ -260,7 +260,7 @@ declare const meta: {
260
260
  error?: string;
261
261
  } & {
262
262
  multiple?: boolean;
263
- accept?: import("./types").ExtensionList | string;
263
+ accept?: import("./types.js").ExtensionList | string;
264
264
  loader?: import("../ScalarLoading").LoadingState;
265
265
  variant?: "compact" | "default";
266
266
  }> & Readonly<{
@@ -284,7 +284,7 @@ declare const meta: {
284
284
  error?: string;
285
285
  } & {
286
286
  multiple?: boolean;
287
- accept?: import("./types").ExtensionList | string;
287
+ accept?: import("./types.js").ExtensionList | string;
288
288
  loader?: import("../ScalarLoading").LoadingState;
289
289
  variant?: "compact" | "default";
290
290
  }> & Readonly<{
@@ -300,7 +300,7 @@ declare const meta: {
300
300
  error?: string;
301
301
  } & {
302
302
  multiple?: boolean;
303
- accept?: import("./types").ExtensionList | string;
303
+ accept?: import("./types.js").ExtensionList | string;
304
304
  loader?: import("../ScalarLoading").LoadingState;
305
305
  variant?: "compact" | "default";
306
306
  }> & Readonly<{
@@ -1,5 +1,5 @@
1
1
  import type { LoadingState } from '../ScalarLoading';
2
- import { type ExtensionList } from './types';
2
+ import { type ExtensionList } from './types.js';
3
3
  /**
4
4
  * Scalar File Upload component
5
5
  *
@@ -0,0 +1,129 @@
1
+ import { defineComponent as F, mergeModels as p, useModel as c, ref as v, createElementBlock as g, openBlock as r, mergeProps as T, unref as s, withModifiers as y, renderSlot as a, createCommentVNode as $, createBlock as k, createElementVNode as w, resolveDynamicComponent as A, createSlots as b, withCtx as n, createVNode as h, createTextVNode as j, toDisplayString as L } 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
+ import { isExtensionList as C } from "./types.js";
9
+ const H = ["accept", "multiple"], I = {}, Z = /* @__PURE__ */ F({
10
+ ...I,
11
+ inheritAttrs: !1,
12
+ __name: "ScalarFileUpload",
13
+ props: /* @__PURE__ */ p({
14
+ multiple: { type: Boolean },
15
+ accept: { default: "*" },
16
+ loader: {},
17
+ variant: { default: "default" }
18
+ }, {
19
+ modelValue: {},
20
+ modelModifiers: {},
21
+ error: {},
22
+ errorModifiers: {}
23
+ }),
24
+ emits: /* @__PURE__ */ p(["selected"], ["update:modelValue", "update:error"]),
25
+ setup(i, { emit: D }) {
26
+ const V = D, B = c(i, "modelValue"), l = c(i, "error"), d = v(), t = v(!1);
27
+ function u() {
28
+ var e;
29
+ (e = d.value) == null || e.click();
30
+ }
31
+ function f(e) {
32
+ if (l.value = void 0, !e || e.length < 1) {
33
+ l.value = "No files found to upload";
34
+ return;
35
+ }
36
+ const o = Array.from(e);
37
+ if (!i.multiple && o.length > 1) {
38
+ l.value = "Too many files selected";
39
+ return;
40
+ }
41
+ B.value = o, V("selected", o);
42
+ }
43
+ function M(e) {
44
+ const o = e.target.files;
45
+ f(o);
46
+ }
47
+ function N(e) {
48
+ var o;
49
+ t.value = !1, f((o = e.dataTransfer) == null ? void 0 : o.files);
50
+ }
51
+ const { cx: S } = P();
52
+ return (e, o) => {
53
+ var m;
54
+ return r(), g("div", T(
55
+ s(S)(
56
+ "flex flex-col relative border-dashed border-1 has-[input:focus-visible]:outline outline-offset-1 rounded"
57
+ ),
58
+ {
59
+ onDragenter: o[1] || (o[1] = (E) => t.value = !0),
60
+ onDragover: o[2] || (o[2] = y(() => {
61
+ }, ["prevent"])),
62
+ onDrop: y(N, ["prevent"])
63
+ }
64
+ ), [
65
+ a(e.$slots, "default", { open: u }, () => [
66
+ (r(), k(A(
67
+ e.variant === "compact" ? z : q
68
+ ), {
69
+ extensions: s(C)(e.accept) ? e.accept : void 0,
70
+ onClick: u
71
+ }, b({ _: 2 }, [
72
+ e.$slots.label ? {
73
+ name: "default",
74
+ fn: n(() => [
75
+ a(e.$slots, "label")
76
+ ]),
77
+ key: "0"
78
+ } : void 0,
79
+ l.value ? {
80
+ name: "sublabel",
81
+ fn: n(() => [
82
+ h(_, null, {
83
+ default: n(() => [
84
+ j(L(l.value), 1)
85
+ ]),
86
+ _: 1
87
+ })
88
+ ]),
89
+ key: "1"
90
+ } : void 0
91
+ ]), 1032, ["extensions"]))
92
+ ]),
93
+ t.value ? (r(), g("div", {
94
+ key: 0,
95
+ class: "absolute inset-0",
96
+ onDragleave: o[0] || (o[0] = (E) => t.value = !1)
97
+ }, [
98
+ a(e.$slots, "drop-target", {}, () => [
99
+ h(U, null, b({ _: 2 }, [
100
+ e.$slots["drop-target-label"] ? {
101
+ name: "default",
102
+ fn: n(() => [
103
+ a(e.$slots, "drop-target-label")
104
+ ]),
105
+ key: "0"
106
+ } : void 0
107
+ ]), 1024)
108
+ ])
109
+ ], 32)) : $("", !0),
110
+ (m = e.loader) != null && m.isLoading ? (r(), k(G, {
111
+ key: 1,
112
+ loader: e.loader
113
+ }, null, 8, ["loader"])) : $("", !0),
114
+ w("input", {
115
+ ref_key: "input",
116
+ ref: d,
117
+ accept: s(C)(e.accept) ? e.accept.join(",") : e.accept,
118
+ class: "sr-only",
119
+ multiple: e.multiple,
120
+ type: "file",
121
+ onChange: M
122
+ }, null, 40, H)
123
+ ], 16);
124
+ };
125
+ }
126
+ });
127
+ export {
128
+ Z as default
129
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarFileUpload.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,31 @@
1
+ import { defineComponent as s, createElementBlock as a, openBlock as l, normalizeProps as i, guardReactiveProps as c, unref as t, createElementVNode as o, createVNode as d, renderSlot as p, createTextVNode as u } from "vue";
2
+ import { useBindCx as f } from "@scalar/use-hooks/useBindCx";
3
+ import m from "../ScalarIcon/ScalarIcon.vue.js";
4
+ const _ = { class: "pointer-events-none flex size-full items-center justify-center gap-1 rounded-md p-1 text-c-2" }, x = { class: "font-medium" }, z = {}, B = /* @__PURE__ */ s({
5
+ ...z,
6
+ inheritAttrs: !1,
7
+ __name: "ScalarFileUploadDropTarget",
8
+ setup(v) {
9
+ const { cx: r } = f();
10
+ return (n, e) => (l(), a("div", i(c(
11
+ t(r)(
12
+ " size-full flex items-center justify-center absolute inset-0 z-1 rounded p-1 backdrop-blur"
13
+ )
14
+ )), [
15
+ o("div", _, [
16
+ d(t(m), {
17
+ class: "size-4",
18
+ icon: "Upload"
19
+ }),
20
+ o("span", x, [
21
+ p(n.$slots, "default", {}, () => [
22
+ e[0] || (e[0] = u("Drop to upload"))
23
+ ])
24
+ ])
25
+ ])
26
+ ], 16));
27
+ }
28
+ });
29
+ export {
30
+ B as default
31
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarFileUploadDropTarget.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,21 @@
1
+ import { defineComponent as t, createElementBlock as n, openBlock as a, normalizeProps as c, guardReactiveProps as s, unref as e, createVNode as i, renderSlot as l } from "vue";
2
+ import { useBindCx as m } from "@scalar/use-hooks/useBindCx";
3
+ import p from "../ScalarIcon/ScalarIcon.vue.js";
4
+ const d = {}, B = /* @__PURE__ */ t({
5
+ ...d,
6
+ inheritAttrs: !1,
7
+ __name: "ScalarFileUploadError",
8
+ setup(f) {
9
+ const { cx: r } = m();
10
+ return (o, _) => (a(), n("div", c(s(e(r)("flex items-center gap-1 text-c-danger"))), [
11
+ i(e(p), {
12
+ icon: "Error",
13
+ size: "sm"
14
+ }),
15
+ l(o.$slots, "default")
16
+ ], 16));
17
+ }
18
+ });
19
+ export {
20
+ B as default
21
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarFileUploadError.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,55 @@
1
+ import { defineComponent as x, mergeModels as _, useModel as v, createElementBlock as o, openBlock as i, normalizeProps as g, guardReactiveProps as C, unref as l, createElementVNode as t, Fragment as V, renderList as k, toDisplayString as n, createVNode as d, withCtx as a, createTextVNode as m } from "vue";
2
+ import { useBindCx as y } from "@scalar/use-hooks/useBindCx";
3
+ import z from "pretty-bytes";
4
+ import u from "../ScalarButton/ScalarButton.vue.js";
5
+ const B = { class: "border rounded p-1 text-xs" }, $ = { class: "flex items-center justify-between" }, w = { class: "flex-1 min-w-0 truncate" }, F = { class: "text-c-3" }, M = { class: "flex items-center gap-1.5" }, N = {}, P = /* @__PURE__ */ x({
6
+ ...N,
7
+ inheritAttrs: !1,
8
+ __name: "ScalarFileUploadFileList",
9
+ props: {
10
+ modelValue: {},
11
+ modelModifiers: {}
12
+ },
13
+ emits: /* @__PURE__ */ _(["upload"], ["update:modelValue"]),
14
+ setup(p) {
15
+ const r = v(p, "modelValue"), { cx: f } = y();
16
+ return (c, e) => (i(), o("div", g(C(l(f)("flex flex-col gap-2 p-4"))), [
17
+ e[4] || (e[4] = t("div", { class: "text-c-2" }, "Selected files:", -1)),
18
+ (i(!0), o(V, null, k(r.value, (s) => (i(), o("ul", {
19
+ key: s.name,
20
+ class: "flex flex-col gap-0.5"
21
+ }, [
22
+ t("li", B, [
23
+ t("div", $, [
24
+ t("div", w, n(s.name), 1),
25
+ t("div", F, n(l(z)(s.size)), 1)
26
+ ])
27
+ ])
28
+ ]))), 128)),
29
+ t("div", M, [
30
+ d(l(u), {
31
+ size: "sm",
32
+ onClick: e[0] || (e[0] = (s) => c.$emit("upload"))
33
+ }, {
34
+ default: a(() => e[2] || (e[2] = [
35
+ m(" Upload ")
36
+ ])),
37
+ _: 1
38
+ }),
39
+ d(l(u), {
40
+ size: "sm",
41
+ variant: "outlined",
42
+ onClick: e[1] || (e[1] = (s) => r.value = [])
43
+ }, {
44
+ default: a(() => e[3] || (e[3] = [
45
+ m(" Clear ")
46
+ ])),
47
+ _: 1
48
+ })
49
+ ])
50
+ ], 16));
51
+ }
52
+ });
53
+ export {
54
+ P as default
55
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarFileUploadFileList.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -1,4 +1,4 @@
1
- import type { FileUploadInputProps, FileUploadInputSlots } from './types';
1
+ import type { FileUploadInputProps, FileUploadInputSlots } from './types.js';
2
2
  /**
3
3
  * Scalar File Upload Input
4
4
  *
@@ -0,0 +1,49 @@
1
+ import { defineComponent as m, createElementBlock as i, openBlock as n, normalizeProps as f, guardReactiveProps as u, unref as l, createElementVNode as s, renderSlot as r, createVNode as c, createTextVNode as o, toDisplayString as p, withCtx as x, createCommentVNode as _ } from "vue";
2
+ import { useBindCx as k } from "@scalar/use-hooks/useBindCx";
3
+ import y from "../ScalarButton/ScalarButton.vue.js";
4
+ const v = { class: "flex items-center gap-1.5 whitespace-nowrap" }, B = { class: "text-c-2" }, C = {
5
+ key: 0,
6
+ class: "text-c-3 text-xs"
7
+ }, g = {}, $ = /* @__PURE__ */ m({
8
+ ...g,
9
+ inheritAttrs: !1,
10
+ __name: "ScalarFileUploadInput",
11
+ props: {
12
+ multiple: { type: Boolean },
13
+ extensions: {}
14
+ },
15
+ emits: ["click"],
16
+ setup(w) {
17
+ const { cx: a } = k();
18
+ return (t, e) => (n(), i("div", f(u(l(a)("flex items-center justify-center gap-2 flex-col px-6 py-4"))), [
19
+ s("div", v, [
20
+ s("span", B, [
21
+ r(t.$slots, "default", {}, () => [
22
+ o("Drop " + p(t.multiple ? "files" : "file") + " here to upload", 1)
23
+ ]),
24
+ e[1] || (e[1] = s("span", { class: "text-c-3" }, " or", -1))
25
+ ]),
26
+ c(l(y), {
27
+ size: "sm",
28
+ tabindex: "-1",
29
+ variant: "outlined",
30
+ onClick: e[0] || (e[0] = (d) => t.$emit("click", d))
31
+ }, {
32
+ default: x(() => e[2] || (e[2] = [
33
+ o(" Browse files ")
34
+ ])),
35
+ _: 1
36
+ })
37
+ ]),
38
+ r(t.$slots, "sublabel", {}, () => [
39
+ t.extensions ? (n(), i("div", C, [
40
+ e[3] || (e[3] = s("span", { class: "font-medium" }, "Supported file types:", -1)),
41
+ o(" " + p(t.extensions.join(", ")), 1)
42
+ ])) : _("", !0)
43
+ ])
44
+ ], 16));
45
+ }
46
+ });
47
+ export {
48
+ $ as default
49
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarFileUploadInput.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -1,4 +1,4 @@
1
- import type { FileUploadInputProps, FileUploadInputSlots } from './types';
1
+ import type { FileUploadInputProps, FileUploadInputSlots } from './types.js';
2
2
  /**
3
3
  * Scalar File Upload Input
4
4
  *
@@ -0,0 +1,44 @@
1
+ import { defineComponent as c, createElementBlock as o, openBlock as n, mergeProps as m, unref as s, createElementVNode as l, renderSlot as i, createVNode as d, toDisplayString as r, createCommentVNode as u } from "vue";
2
+ import { useBindCx as f } from "@scalar/use-hooks/useBindCx";
3
+ import x from "../ScalarIcon/ScalarIcon.vue.js";
4
+ const _ = { class: "flex items-center gap-1 whitespace-nowrap text-c-2" }, b = {
5
+ key: 0,
6
+ class: "text-c-3 text-xs"
7
+ }, k = {}, B = /* @__PURE__ */ c({
8
+ ...k,
9
+ inheritAttrs: !1,
10
+ __name: "ScalarFileUploadInputCompact",
11
+ props: {
12
+ multiple: { type: Boolean },
13
+ extensions: {}
14
+ },
15
+ emits: ["click"],
16
+ setup(y) {
17
+ const { cx: p } = f();
18
+ return (e, t) => (n(), o("button", m(
19
+ { type: "button" },
20
+ s(p)(
21
+ "flex items-center justify-center gap-1 rounded flex-col px-4 py-3 hover:bg-b-2"
22
+ ),
23
+ {
24
+ onClick: t[0] || (t[0] = (a) => e.$emit("click", a))
25
+ }
26
+ ), [
27
+ l("div", _, [
28
+ i(e.$slots, "default", {}, () => [
29
+ d(s(x), {
30
+ icon: "Upload",
31
+ size: "sm"
32
+ }),
33
+ l("span", null, " Upload " + r(e.multiple ? "files" : "file"), 1)
34
+ ])
35
+ ]),
36
+ i(e.$slots, "sublabel", {}, () => [
37
+ e.extensions ? (n(), o("div", b, r(e.extensions.join(", ")), 1)) : u("", !0)
38
+ ])
39
+ ], 16));
40
+ }
41
+ });
42
+ export {
43
+ B as default
44
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarFileUploadInputCompact.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,27 @@
1
+ import { defineComponent as r, createElementBlock as a, openBlock as n, normalizeProps as l, guardReactiveProps as i, unref as e, createVNode as s } from "vue";
2
+ import { useBindCx as c } from "@scalar/use-hooks/useBindCx";
3
+ import d from "../ScalarLoading/ScalarLoading.vue.js";
4
+ const p = {}, x = /* @__PURE__ */ r({
5
+ ...p,
6
+ inheritAttrs: !1,
7
+ __name: "ScalarFileUploadLoading",
8
+ props: {
9
+ loader: {}
10
+ },
11
+ setup(u) {
12
+ const { cx: t } = c();
13
+ return (o, m) => (n(), a("div", l(i(
14
+ e(t)(
15
+ " size-full flex items-center justify-center absolute inset-0 z-1 rounded p-1 backdrop-blur text-c-2"
16
+ )
17
+ )), [
18
+ s(e(d), {
19
+ loadingState: o.loader,
20
+ size: "md"
21
+ }, null, 8, ["loadingState"])
22
+ ], 16));
23
+ }
24
+ });
25
+ export {
26
+ x as default
27
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarFileUploadLoading.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -1,8 +1,8 @@
1
- export { default as ScalarFileUpload } from './ScalarFileUpload.vue';
2
- export { default as ScalarFileUploadInput } from './ScalarFileUploadInput.vue';
3
- export { default as ScalarFileUploadInputCompact } from './ScalarFileUploadInputCompact.vue';
4
- export { default as ScalarFileUploadDropTarget } from './ScalarFileUploadDropTarget.vue';
5
- export { default as ScalarFileUploadLoading } from './ScalarFileUploadLoading.vue';
6
- export { default as ScalarFileUploadError } from './ScalarFileUploadError.vue';
7
- export { default as ScalarFileUploadFileList } from './ScalarFileUploadFileList.vue';
1
+ export { default as ScalarFileUpload } from './ScalarFileUpload.vue.js';
2
+ export { default as ScalarFileUploadInput } from './ScalarFileUploadInput.vue.js';
3
+ export { default as ScalarFileUploadInputCompact } from './ScalarFileUploadInputCompact.vue.js';
4
+ export { default as ScalarFileUploadDropTarget } from './ScalarFileUploadDropTarget.vue.js';
5
+ export { default as ScalarFileUploadLoading } from './ScalarFileUploadLoading.vue.js';
6
+ export { default as ScalarFileUploadError } from './ScalarFileUploadError.vue.js';
7
+ export { default as ScalarFileUploadFileList } from './ScalarFileUploadFileList.vue.js';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,6 @@
1
+ function i(r) {
2
+ return Array.isArray(r) && r.every((t) => t.startsWith("."));
3
+ }
4
+ export {
5
+ i as isExtensionList
6
+ };