@viasat/beam-shared 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -0
- package/chunks/SegmentedControl.B9dLCFSF.js +9 -0
- package/chunks/SegmentedControl.D0l_8a7O.js +1 -0
- package/chunks/accordion.C1LkPYXv.js +1 -0
- package/chunks/accordion.CCM7ddD5.js +11 -0
- package/chunks/actionList.LFHBSlrg.js +1 -0
- package/chunks/actionList.X99uHmXK.js +26 -0
- package/chunks/alert.B4q5-o6H.js +1 -0
- package/chunks/alert.BZ4L-6bC.js +32 -0
- package/chunks/avatar.BbM_sNXk.js +63 -0
- package/chunks/avatar.VNzxbOMa.js +1 -0
- package/chunks/badge.B_k2GBe6.js +1 -0
- package/chunks/badge.DZN0yrZh.js +44 -0
- package/chunks/badgeDot.ClhZtqzd.js +25 -0
- package/chunks/badgeDot.Dkqfk3zg.js +1 -0
- package/chunks/box.CsO__7hu.js +1 -0
- package/chunks/box._mFtvgTp.js +82 -0
- package/chunks/button.Bbz_mfWv.js +1 -0
- package/chunks/button.Dz8Zhr7J.js +51 -0
- package/chunks/card.CG-SDcm1.js +27 -0
- package/chunks/card.CLwQAceo.js +1 -0
- package/chunks/chips.DKEagIsp.js +1 -0
- package/chunks/chips.GU9UVEOU.js +13 -0
- package/chunks/closeButton.C1A3p88y.js +1 -0
- package/chunks/closeButton.g8_iRoUg.js +15 -0
- package/chunks/dialog.BTq-pLBf.js +28 -0
- package/chunks/dialog.DnkeApRr.js +1 -0
- package/chunks/divider.BYMLu6Wp.js +1 -0
- package/chunks/divider.DgP7kpLb.js +35 -0
- package/chunks/fileUpload.BbSIsjJv.js +240 -0
- package/chunks/fileUpload.C-l2YXzO.js +1 -0
- package/chunks/form.BRWIo59c.js +154 -0
- package/chunks/form.CIzlawbr.js +1 -0
- package/chunks/helperText.C-apoW8Z.js +1 -0
- package/chunks/helperText.CS5sun4r.js +16 -0
- package/chunks/icon.SiHuIfL8.js +1 -0
- package/chunks/icon.tCAxaKQh.js +28 -0
- package/chunks/inputChoiceGroup.BSousduj.js +1 -0
- package/chunks/inputChoiceGroup.DkDdA57f.js +10 -0
- package/chunks/link.DxTb3yhm.js +16 -0
- package/chunks/link.VyBRMFxS.js +1 -0
- package/chunks/list.CCq0lIzm.js +29 -0
- package/chunks/list.D6NIx1OS.js +1 -0
- package/chunks/logo.CLQZSaVN.js +1 -0
- package/chunks/logo.Cl29Chxj.js +11 -0
- package/chunks/nativeSelect.D9HZm9uJ.js +28 -0
- package/chunks/nativeSelect.Lz45VyQX.js +1 -0
- package/chunks/pageHeader.CbDGb6ot.js +1 -0
- package/chunks/pageHeader.fsTiHDRc.js +12 -0
- package/chunks/pagination.Br7vTt5b.js +1 -0
- package/chunks/pagination.DinViL55.js +38 -0
- package/chunks/progressBar.84w2qF8R.js +42 -0
- package/chunks/progressBar.DcG-X-RY.js +1 -0
- package/chunks/spinner.B6R6yphw.js +1 -0
- package/chunks/spinner.oNNLX64f.js +105 -0
- package/chunks/stepper.ByKqsxhz.js +1 -0
- package/chunks/stepper.FT6nDHjL.js +18 -0
- package/chunks/switch.Dalf8ccu.js +1 -0
- package/chunks/switch.hUukrKTd.js +11 -0
- package/chunks/tabs.C7SBQq_R.js +1 -0
- package/chunks/tabs.CIfcdjPn.js +13 -0
- package/chunks/text.CW-ftgoP.js +1 -0
- package/chunks/text.DpbJhMDB.js +152 -0
- package/chunks/textArea.CmtmGm_y.js +22 -0
- package/chunks/textArea.DF76BVU5.js +1 -0
- package/chunks/toast.Bs1t4Urq.js +36 -0
- package/chunks/toast.C-h1RUq_.js +1 -0
- package/chunks/tooltip.D1fCHa9d.js +16 -0
- package/chunks/tooltip.DZTJP5dS.js +1 -0
- package/index.cjs.js +1 -0
- package/index.d.ts +3 -0
- package/index.es.js +164 -0
- package/lib/components/SegmentedControl.cjs.js +1 -0
- package/lib/components/SegmentedControl.d.ts +2 -0
- package/lib/components/SegmentedControl.es.js +5 -0
- package/lib/components/accordion.cjs.js +1 -0
- package/lib/components/accordion.d.ts +3 -0
- package/lib/components/accordion.es.js +6 -0
- package/lib/components/actionList.cjs.js +1 -0
- package/lib/components/actionList.d.ts +15 -0
- package/lib/components/actionList.es.js +13 -0
- package/lib/components/alert.cjs.js +1 -0
- package/lib/components/alert.d.ts +17 -0
- package/lib/components/alert.es.js +11 -0
- package/lib/components/aspectRatio.cjs.js +1 -0
- package/lib/components/aspectRatio.d.ts +16 -0
- package/lib/components/aspectRatio.es.js +14 -0
- package/lib/components/avatar.cjs.js +1 -0
- package/lib/components/avatar.d.ts +17 -0
- package/lib/components/avatar.es.js +23 -0
- package/lib/components/badge.cjs.js +1 -0
- package/lib/components/badge.d.ts +17 -0
- package/lib/components/badge.es.js +15 -0
- package/lib/components/badgeDot.cjs.js +1 -0
- package/lib/components/badgeDot.d.ts +6 -0
- package/lib/components/badgeDot.es.js +7 -0
- package/lib/components/box.cjs.js +1 -0
- package/lib/components/box.d.ts +82 -0
- package/lib/components/box.es.js +8 -0
- package/lib/components/button.cjs.js +1 -0
- package/lib/components/button.d.ts +36 -0
- package/lib/components/button.es.js +16 -0
- package/lib/components/card.cjs.js +1 -0
- package/lib/components/card.d.ts +22 -0
- package/lib/components/card.es.js +7 -0
- package/lib/components/chips.cjs.js +1 -0
- package/lib/components/chips.d.ts +5 -0
- package/lib/components/chips.es.js +7 -0
- package/lib/components/closeButton.cjs.js +1 -0
- package/lib/components/closeButton.d.ts +2 -0
- package/lib/components/closeButton.es.js +5 -0
- package/lib/components/dialog.cjs.js +1 -0
- package/lib/components/dialog.d.ts +5 -0
- package/lib/components/dialog.es.js +7 -0
- package/lib/components/divider.cjs.js +1 -0
- package/lib/components/divider.d.ts +30 -0
- package/lib/components/divider.es.js +9 -0
- package/lib/components/fileUpload.cjs.js +1 -0
- package/lib/components/fileUpload.d.ts +90 -0
- package/lib/components/fileUpload.es.js +22 -0
- package/lib/components/floatingui.cjs.js +1 -0
- package/lib/components/floatingui.d.ts +71 -0
- package/lib/components/floatingui.es.js +608 -0
- package/lib/components/form.cjs.js +1 -0
- package/lib/components/form.d.ts +69 -0
- package/lib/components/form.es.js +9 -0
- package/lib/components/helperText.cjs.js +1 -0
- package/lib/components/helperText.d.ts +4 -0
- package/lib/components/helperText.es.js +6 -0
- package/lib/components/icon.cjs.js +1 -0
- package/lib/components/icon.d.ts +6 -0
- package/lib/components/icon.es.js +7 -0
- package/lib/components/index.cjs.js +1 -0
- package/lib/components/index.d.ts +34 -0
- package/lib/components/index.es.js +70 -0
- package/lib/components/inputChoiceGroup.cjs.js +1 -0
- package/lib/components/inputChoiceGroup.d.ts +10 -0
- package/lib/components/inputChoiceGroup.es.js +5 -0
- package/lib/components/link.cjs.js +1 -0
- package/lib/components/link.d.ts +4 -0
- package/lib/components/link.es.js +6 -0
- package/lib/components/list.cjs.js +1 -0
- package/lib/components/list.d.ts +14 -0
- package/lib/components/list.es.js +10 -0
- package/lib/components/logo.cjs.js +1 -0
- package/lib/components/logo.d.ts +5 -0
- package/lib/components/logo.es.js +6 -0
- package/lib/components/nativeSelect.cjs.js +1 -0
- package/lib/components/nativeSelect.d.ts +5 -0
- package/lib/components/nativeSelect.es.js +7 -0
- package/lib/components/pageHeader.cjs.js +1 -0
- package/lib/components/pageHeader.d.ts +5 -0
- package/lib/components/pageHeader.es.js +5 -0
- package/lib/components/pagination.cjs.js +1 -0
- package/lib/components/pagination.d.ts +69 -0
- package/lib/components/pagination.es.js +13 -0
- package/lib/components/progressBar.cjs.js +1 -0
- package/lib/components/progressBar.d.ts +14 -0
- package/lib/components/progressBar.es.js +11 -0
- package/lib/components/spinner.cjs.js +1 -0
- package/lib/components/spinner.d.ts +82 -0
- package/lib/components/spinner.es.js +19 -0
- package/lib/components/stepper.cjs.js +1 -0
- package/lib/components/stepper.d.ts +12 -0
- package/lib/components/stepper.es.js +5 -0
- package/lib/components/switch.cjs.js +1 -0
- package/lib/components/switch.d.ts +3 -0
- package/lib/components/switch.es.js +6 -0
- package/lib/components/tabs.cjs.js +1 -0
- package/lib/components/tabs.d.ts +6 -0
- package/lib/components/tabs.es.js +7 -0
- package/lib/components/text.cjs.js +1 -0
- package/lib/components/text.d.ts +15 -0
- package/lib/components/text.es.js +13 -0
- package/lib/components/textArea.cjs.js +1 -0
- package/lib/components/textArea.d.ts +2 -0
- package/lib/components/textArea.es.js +4 -0
- package/lib/components/toast.cjs.js +1 -0
- package/lib/components/toast.d.ts +14 -0
- package/lib/components/toast.es.js +9 -0
- package/lib/components/tooltip.cjs.js +1 -0
- package/lib/components/tooltip.d.ts +2 -0
- package/lib/components/tooltip.es.js +5 -0
- package/lib/shared.cjs.js +1 -0
- package/lib/shared.d.ts +4 -0
- package/lib/shared.es.js +6 -0
- package/lib/utils/CSSLookup.cjs.js +1 -0
- package/lib/utils/CSSLookup.d.ts +84 -0
- package/lib/utils/CSSLookup.es.js +110 -0
- package/lib/utils/classNames.cjs.js +1 -0
- package/lib/utils/classNames.d.ts +9 -0
- package/lib/utils/classNames.es.js +18 -0
- package/lib/utils/constants.cjs.js +1 -0
- package/lib/utils/constants.d.ts +174 -0
- package/lib/utils/constants.es.js +151 -0
- package/lib/utils/dom.cjs.js +1 -0
- package/lib/utils/dom.d.ts +18 -0
- package/lib/utils/dom.es.js +34 -0
- package/lib/utils/helpers.cjs.js +1 -0
- package/lib/utils/helpers.d.ts +66 -0
- package/lib/utils/helpers.es.js +154 -0
- package/lib/utils/index.cjs.js +1 -0
- package/lib/utils/index.d.ts +7 -0
- package/lib/utils/index.es.js +94 -0
- package/lib/utils/overflow.cjs.js +1 -0
- package/lib/utils/overflow.d.ts +34 -0
- package/lib/utils/overflow.es.js +34 -0
- package/lib/utils/raf.cjs.js +1 -0
- package/lib/utils/raf.d.ts +8 -0
- package/lib/utils/raf.es.js +14 -0
- package/lib/utils/styles.cjs.js +1 -0
- package/lib/utils/styles.d.ts +1 -0
- package/lib/utils/styles.es.js +5 -0
- package/lib/utils/types.cjs.js +1 -0
- package/lib/utils/types.d.ts +6 -0
- package/lib/utils/types.es.js +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { allSizes as g } from "../lib/utils/constants.es.js";
|
|
2
|
+
var A = function(e, r) {
|
|
3
|
+
if (e && r) {
|
|
4
|
+
var t = Array.isArray(r) ? r : r.split(",");
|
|
5
|
+
if (t.length === 0)
|
|
6
|
+
return !0;
|
|
7
|
+
var a = e.name || "", o = (e.type || "").toLowerCase(), s = o.replace(/\/.*$/, "");
|
|
8
|
+
return t.some(function(i) {
|
|
9
|
+
var n = i.trim().toLowerCase();
|
|
10
|
+
return n.charAt(0) === "." ? a.toLowerCase().endsWith(n) : n.endsWith("/*") ? s === n.replace(/\/.*$/, "") : o === n;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return !0;
|
|
14
|
+
};
|
|
15
|
+
const h = "dropzone", y = "action", D = [h, y], R = [g.md, g.lg], I = "uploading", F = "success", C = "uploaded", T = "error", j = [I, F, C, T], z = (e, r) => {
|
|
16
|
+
const t = new FormData();
|
|
17
|
+
return r.files.forEach((a, o) => {
|
|
18
|
+
r.shouldAddToFormData[o] && t.append(e, a);
|
|
19
|
+
}), t;
|
|
20
|
+
}, E = {
|
|
21
|
+
fileItems: [],
|
|
22
|
+
abortControllers: [],
|
|
23
|
+
files: [],
|
|
24
|
+
shouldAddToFormData: [],
|
|
25
|
+
validFileCount: 0
|
|
26
|
+
};
|
|
27
|
+
function w(e) {
|
|
28
|
+
return e < 6 ? `${e} B` : e < 1048576 / 2 ? `${(e / 1024).toFixed(2)} KB` : e < 1073741824 / 2 ? `${(e / 1048576).toFixed(2)} MB` : e < 1099511627776 / 2 ? `${(e / 1073741824).toFixed(2)} GB` : `${(e / 1099511627776 / 2).toFixed(2)} TB`;
|
|
29
|
+
}
|
|
30
|
+
const b = (e, r, { accept: t, fileLimit: a, maxFileSize: o }) => {
|
|
31
|
+
if (t && !A(e, t))
|
|
32
|
+
return "Incorrect file type";
|
|
33
|
+
if (a && r >= a)
|
|
34
|
+
return "Attachment limit reached";
|
|
35
|
+
if (o && e.size > o)
|
|
36
|
+
return "File size exceeds limit";
|
|
37
|
+
}, L = (e, {
|
|
38
|
+
state: r,
|
|
39
|
+
error: t
|
|
40
|
+
}) => ({
|
|
41
|
+
id: URL.createObjectURL(e),
|
|
42
|
+
fileName: e.name,
|
|
43
|
+
fileSize: w(e.size),
|
|
44
|
+
state: r ?? "uploaded",
|
|
45
|
+
progress: 0,
|
|
46
|
+
error: t
|
|
47
|
+
}), S = (e, r) => {
|
|
48
|
+
const t = new Image();
|
|
49
|
+
t.src = URL.createObjectURL(e), t.onload = () => {
|
|
50
|
+
const a = document.createElement("canvas"), o = a.getContext("2d");
|
|
51
|
+
o && (a.width = t.width, a.height = t.height, o.drawImage(t, 0, 0), r(a.toDataURL("image/jpeg")));
|
|
52
|
+
};
|
|
53
|
+
}, O = (e) => URL.createObjectURL(e), $ = (e, r) => {
|
|
54
|
+
const t = document.createElement("video"), a = document.createElement("source"), o = document.createElement("canvas"), s = o.getContext("2d");
|
|
55
|
+
if (!s)
|
|
56
|
+
return;
|
|
57
|
+
t.crossOrigin = "anonymous", t.preload = "metadata", t.appendChild(a), a.src = URL.createObjectURL(e), t.currentTime = 0, t.load(), t.addEventListener("loadedmetadata", () => {
|
|
58
|
+
o.width = t.videoWidth, o.height = t.videoHeight;
|
|
59
|
+
});
|
|
60
|
+
const i = () => {
|
|
61
|
+
s.drawImage(t, 0, 0, o.width, o.height), r(o.toDataURL("image/jpeg"));
|
|
62
|
+
};
|
|
63
|
+
if (typeof t.requestVideoFrameCallback < "u")
|
|
64
|
+
t.requestVideoFrameCallback(i);
|
|
65
|
+
else {
|
|
66
|
+
const n = () => {
|
|
67
|
+
setTimeout(i, 0), t.removeEventListener("seeked", n);
|
|
68
|
+
};
|
|
69
|
+
t.addEventListener("seeked", n);
|
|
70
|
+
}
|
|
71
|
+
}, x = (e, r) => {
|
|
72
|
+
if (e.type === "image/gif")
|
|
73
|
+
return S(e, r);
|
|
74
|
+
if (e.type.startsWith("image/"))
|
|
75
|
+
return O(e);
|
|
76
|
+
if (e.type.startsWith("video/"))
|
|
77
|
+
return $(e, r);
|
|
78
|
+
};
|
|
79
|
+
function k(e, r) {
|
|
80
|
+
r({ type: "remove", payload: e });
|
|
81
|
+
}
|
|
82
|
+
function B(e, r, t, a, o, s, i, n) {
|
|
83
|
+
if (!e)
|
|
84
|
+
return;
|
|
85
|
+
let l = t;
|
|
86
|
+
const p = Array.from(e).map((u) => {
|
|
87
|
+
const m = b(u, l, {
|
|
88
|
+
accept: a,
|
|
89
|
+
fileLimit: o,
|
|
90
|
+
maxFileSize: s
|
|
91
|
+
}), d = L(u, {
|
|
92
|
+
error: m,
|
|
93
|
+
state: m ? "error" : i ?? "uploaded"
|
|
94
|
+
}), v = new AbortController();
|
|
95
|
+
d.thumbnail = x(u, (c) => {
|
|
96
|
+
r({
|
|
97
|
+
type: "update",
|
|
98
|
+
payload: { fileItem: d, updates: { thumbnail: c } }
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
let f = !m;
|
|
102
|
+
return m || (l++, n ? f = (n == null ? void 0 : n(
|
|
103
|
+
u,
|
|
104
|
+
{
|
|
105
|
+
progress(c) {
|
|
106
|
+
r({
|
|
107
|
+
type: "update",
|
|
108
|
+
payload: { fileItem: d, updates: { state: "uploading", progress: c } }
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
success() {
|
|
112
|
+
r({
|
|
113
|
+
type: "update",
|
|
114
|
+
payload: { fileItem: d, updates: { state: "success" } }
|
|
115
|
+
}), setTimeout(() => {
|
|
116
|
+
r({
|
|
117
|
+
type: "update",
|
|
118
|
+
payload: { fileItem: d, updates: { state: "uploaded" } }
|
|
119
|
+
});
|
|
120
|
+
}, 3e3);
|
|
121
|
+
},
|
|
122
|
+
error(c) {
|
|
123
|
+
r({
|
|
124
|
+
type: "update",
|
|
125
|
+
payload: { fileItem: d, updates: { state: "error", error: c } }
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
dismiss() {
|
|
129
|
+
r({ type: "remove", payload: d });
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
v.signal
|
|
133
|
+
)) ?? !1 : f = !0), { file: u, fileItem: d, abortController: v, shouldAddToFormData: f };
|
|
134
|
+
});
|
|
135
|
+
r({ type: "add", payload: p });
|
|
136
|
+
}
|
|
137
|
+
function U(e, r) {
|
|
138
|
+
var t;
|
|
139
|
+
switch (r.type) {
|
|
140
|
+
case "add":
|
|
141
|
+
return {
|
|
142
|
+
fileItems: [
|
|
143
|
+
...e.fileItems,
|
|
144
|
+
...r.payload.map(({ fileItem: a }) => a)
|
|
145
|
+
],
|
|
146
|
+
abortControllers: [
|
|
147
|
+
...e.abortControllers,
|
|
148
|
+
...r.payload.map(({ abortController: a }) => a)
|
|
149
|
+
],
|
|
150
|
+
files: [...e.files, ...r.payload.map(({ file: a }) => a)],
|
|
151
|
+
shouldAddToFormData: [
|
|
152
|
+
...e.shouldAddToFormData,
|
|
153
|
+
...r.payload.map(({ shouldAddToFormData: a }) => a)
|
|
154
|
+
],
|
|
155
|
+
validFileCount: r.payload.reduce(
|
|
156
|
+
(a, { fileItem: o }) => o.state !== "error" ? a + 1 : a,
|
|
157
|
+
e.validFileCount
|
|
158
|
+
)
|
|
159
|
+
};
|
|
160
|
+
case "remove": {
|
|
161
|
+
const { payload: a } = r, o = e.fileItems.findIndex((s) => s.id === a.id);
|
|
162
|
+
return o < 0 ? e : ((t = e.abortControllers[o]) == null || t.abort(), {
|
|
163
|
+
fileItems: [
|
|
164
|
+
...e.fileItems.slice(0, o),
|
|
165
|
+
...e.fileItems.slice(o + 1)
|
|
166
|
+
],
|
|
167
|
+
abortControllers: [
|
|
168
|
+
...e.abortControllers.slice(0, o),
|
|
169
|
+
...e.abortControllers.slice(o + 1)
|
|
170
|
+
],
|
|
171
|
+
files: [...e.files.slice(0, o), ...e.files.slice(o + 1)],
|
|
172
|
+
shouldAddToFormData: [
|
|
173
|
+
...e.shouldAddToFormData.slice(0, o),
|
|
174
|
+
...e.shouldAddToFormData.slice(o + 1)
|
|
175
|
+
],
|
|
176
|
+
validFileCount: e.validFileCount - (a.state !== "error" ? 1 : 0)
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
case "update": {
|
|
180
|
+
const { fileItem: a, updates: o } = r.payload, s = e.fileItems.findIndex((p) => p.id === a.id);
|
|
181
|
+
if (s < 0)
|
|
182
|
+
return e;
|
|
183
|
+
const i = e.fileItems[s].state, n = o.state ?? i;
|
|
184
|
+
let l = e.validFileCount;
|
|
185
|
+
return i !== "error" && n === "error" && (l -= 1), i === "error" && n !== "error" && (l += 1), {
|
|
186
|
+
...e,
|
|
187
|
+
fileItems: [
|
|
188
|
+
...e.fileItems.slice(0, s),
|
|
189
|
+
{ ...e.fileItems[s], ...o },
|
|
190
|
+
...e.fileItems.slice(s + 1)
|
|
191
|
+
],
|
|
192
|
+
validFileCount: l
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
default:
|
|
196
|
+
return e;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const _ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
200
|
+
__proto__: null,
|
|
201
|
+
action: y,
|
|
202
|
+
addFiles: B,
|
|
203
|
+
convertBytesToFriendly: w,
|
|
204
|
+
createFileItem: L,
|
|
205
|
+
dismissFile: k,
|
|
206
|
+
dropzone: h,
|
|
207
|
+
error: T,
|
|
208
|
+
filesReducer: U,
|
|
209
|
+
generateThumbnail: x,
|
|
210
|
+
getFormData: z,
|
|
211
|
+
initialState: E,
|
|
212
|
+
kinds: D,
|
|
213
|
+
listItemStates: j,
|
|
214
|
+
listSizes: R,
|
|
215
|
+
success: F,
|
|
216
|
+
uploaded: C,
|
|
217
|
+
uploading: I,
|
|
218
|
+
validateFile: b
|
|
219
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
220
|
+
export {
|
|
221
|
+
y as a,
|
|
222
|
+
C as b,
|
|
223
|
+
j as c,
|
|
224
|
+
h as d,
|
|
225
|
+
T as e,
|
|
226
|
+
_ as f,
|
|
227
|
+
z as g,
|
|
228
|
+
w as h,
|
|
229
|
+
E as i,
|
|
230
|
+
L as j,
|
|
231
|
+
D as k,
|
|
232
|
+
R as l,
|
|
233
|
+
x as m,
|
|
234
|
+
k as n,
|
|
235
|
+
B as o,
|
|
236
|
+
U as p,
|
|
237
|
+
F as s,
|
|
238
|
+
I as u,
|
|
239
|
+
b as v
|
|
240
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const D=require("../lib/utils/constants.cjs.js");var O=function(e,t){if(e&&t){var r=Array.isArray(t)?t:t.split(",");if(r.length===0)return!0;var a=e.name||"",o=(e.type||"").toLowerCase(),i=o.replace(/\/.*$/,"");return r.some(function(d){var n=d.trim().toLowerCase();return n.charAt(0)==="."?a.toLowerCase().endsWith(n):n.endsWith("/*")?i===n.replace(/\/.*$/,""):o===n})}return!0};const v="dropzone",g="action",A=[v,g],x=[D.allSizes.md,D.allSizes.lg],h="uploading",F="success",y="uploaded",I="error",R=[h,F,y,I],S=(e,t)=>{const r=new FormData;return t.files.forEach((a,o)=>{t.shouldAddToFormData[o]&&r.append(e,a)}),r},z={fileItems:[],abortControllers:[],files:[],shouldAddToFormData:[],validFileCount:0};function C(e){return e<6?`${e} B`:e<1048576/2?`${(e/1024).toFixed(2)} KB`:e<1073741824/2?`${(e/1048576).toFixed(2)} MB`:e<1099511627776/2?`${(e/1073741824).toFixed(2)} GB`:`${(e/1099511627776/2).toFixed(2)} TB`}const T=(e,t,{accept:r,fileLimit:a,maxFileSize:o})=>{if(r&&!O(e,r))return"Incorrect file type";if(a&&t>=a)return"Attachment limit reached";if(o&&e.size>o)return"File size exceeds limit"},b=(e,{state:t,error:r})=>({id:URL.createObjectURL(e),fileName:e.name,fileSize:C(e.size),state:t??"uploaded",progress:0,error:r}),U=(e,t)=>{const r=new Image;r.src=URL.createObjectURL(e),r.onload=()=>{const a=document.createElement("canvas"),o=a.getContext("2d");o&&(a.width=r.width,a.height=r.height,o.drawImage(r,0,0),t(a.toDataURL("image/jpeg")))}},_=e=>URL.createObjectURL(e),$=(e,t)=>{const r=document.createElement("video"),a=document.createElement("source"),o=document.createElement("canvas"),i=o.getContext("2d");if(!i)return;r.crossOrigin="anonymous",r.preload="metadata",r.appendChild(a),a.src=URL.createObjectURL(e),r.currentTime=0,r.load(),r.addEventListener("loadedmetadata",()=>{o.width=r.videoWidth,o.height=r.videoHeight});const d=()=>{i.drawImage(r,0,0,o.width,o.height),t(o.toDataURL("image/jpeg"))};if(typeof r.requestVideoFrameCallback<"u")r.requestVideoFrameCallback(d);else{const n=()=>{setTimeout(d,0),r.removeEventListener("seeked",n)};r.addEventListener("seeked",n)}},w=(e,t)=>{if(e.type==="image/gif")return U(e,t);if(e.type.startsWith("image/"))return _(e);if(e.type.startsWith("video/"))return $(e,t)};function j(e,t){t({type:"remove",payload:e})}function E(e,t,r,a,o,i,d,n){if(!e)return;let l=r;const p=Array.from(e).map(u=>{const m=T(u,l,{accept:a,fileLimit:o,maxFileSize:i}),s=b(u,{error:m,state:m?"error":d??"uploaded"}),L=new AbortController;s.thumbnail=w(u,c=>{t({type:"update",payload:{fileItem:s,updates:{thumbnail:c}}})});let f=!m;return m||(l++,n?f=(n==null?void 0:n(u,{progress(c){t({type:"update",payload:{fileItem:s,updates:{state:"uploading",progress:c}}})},success(){t({type:"update",payload:{fileItem:s,updates:{state:"success"}}}),setTimeout(()=>{t({type:"update",payload:{fileItem:s,updates:{state:"uploaded"}}})},3e3)},error(c){t({type:"update",payload:{fileItem:s,updates:{state:"error",error:c}}})},dismiss(){t({type:"remove",payload:s})}},L.signal))??!1:f=!0),{file:u,fileItem:s,abortController:L,shouldAddToFormData:f}});t({type:"add",payload:p})}function B(e,t){var r;switch(t.type){case"add":return{fileItems:[...e.fileItems,...t.payload.map(({fileItem:a})=>a)],abortControllers:[...e.abortControllers,...t.payload.map(({abortController:a})=>a)],files:[...e.files,...t.payload.map(({file:a})=>a)],shouldAddToFormData:[...e.shouldAddToFormData,...t.payload.map(({shouldAddToFormData:a})=>a)],validFileCount:t.payload.reduce((a,{fileItem:o})=>o.state!=="error"?a+1:a,e.validFileCount)};case"remove":{const{payload:a}=t,o=e.fileItems.findIndex(i=>i.id===a.id);return o<0?e:((r=e.abortControllers[o])==null||r.abort(),{fileItems:[...e.fileItems.slice(0,o),...e.fileItems.slice(o+1)],abortControllers:[...e.abortControllers.slice(0,o),...e.abortControllers.slice(o+1)],files:[...e.files.slice(0,o),...e.files.slice(o+1)],shouldAddToFormData:[...e.shouldAddToFormData.slice(0,o),...e.shouldAddToFormData.slice(o+1)],validFileCount:e.validFileCount-(a.state!=="error"?1:0)})}case"update":{const{fileItem:a,updates:o}=t.payload,i=e.fileItems.findIndex(p=>p.id===a.id);if(i<0)return e;const d=e.fileItems[i].state,n=o.state??d;let l=e.validFileCount;return d!=="error"&&n==="error"&&(l-=1),d==="error"&&n!=="error"&&(l+=1),{...e,fileItems:[...e.fileItems.slice(0,i),{...e.fileItems[i],...o},...e.fileItems.slice(i+1)],validFileCount:l}}default:return e}}const k=Object.freeze(Object.defineProperty({__proto__:null,action:g,addFiles:E,convertBytesToFriendly:C,createFileItem:b,dismissFile:j,dropzone:v,error:I,filesReducer:B,generateThumbnail:w,getFormData:S,initialState:z,kinds:A,listItemStates:R,listSizes:x,success:F,uploaded:y,uploading:h,validateFile:T},Symbol.toStringTag,{value:"Module"}));exports.action=g;exports.addFiles=E;exports.convertBytesToFriendly=C;exports.createFileItem=b;exports.dismissFile=j;exports.dropzone=v;exports.error=I;exports.fileUpload=k;exports.filesReducer=B;exports.generateThumbnail=w;exports.getFormData=S;exports.initialState=z;exports.kinds=A;exports.listItemStates=R;exports.listSizes=x;exports.success=F;exports.uploaded=y;exports.uploading=h;exports.validateFile=T;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
const d = ["onChange", "onBlur", "onSubmit"], p = async (n, r) => (await Promise.all(
|
|
2
|
+
r.map(
|
|
3
|
+
async (e) => {
|
|
4
|
+
const { validator: t } = e;
|
|
5
|
+
return t(n);
|
|
6
|
+
}
|
|
7
|
+
)
|
|
8
|
+
)).reduce(
|
|
9
|
+
(e, t) => {
|
|
10
|
+
const { error: s, message: c } = t;
|
|
11
|
+
return s ? [...e, c] : e;
|
|
12
|
+
},
|
|
13
|
+
[]
|
|
14
|
+
), h = (n) => {
|
|
15
|
+
const { target: r, relatedTarget: o } = n || {};
|
|
16
|
+
if (!o) return { groupBlur: !!o };
|
|
17
|
+
const { name: e } = r, { name: t } = o, { control: s } = o, { name: c } = s || {};
|
|
18
|
+
return { groupBlur: e === t || e === c };
|
|
19
|
+
}, i = (n) => {
|
|
20
|
+
const { type: r, checked: o } = n, e = r === "checkbox";
|
|
21
|
+
if (e)
|
|
22
|
+
return {
|
|
23
|
+
isCheckBoxGroup: e,
|
|
24
|
+
selectedBoxes: o ? [n] : []
|
|
25
|
+
};
|
|
26
|
+
const t = Array.from(n), s = t.every((l) => {
|
|
27
|
+
const { type: u } = l;
|
|
28
|
+
return u === "checkbox";
|
|
29
|
+
}), c = !!t.length && s;
|
|
30
|
+
if (!c) return { isCheckBoxGroup: c, selectedBoxes: [] };
|
|
31
|
+
const a = t.filter(
|
|
32
|
+
({ checked: l }) => l
|
|
33
|
+
);
|
|
34
|
+
return { isCheckBoxGroup: c, selectedBoxes: a };
|
|
35
|
+
}, g = (n) => {
|
|
36
|
+
const { type: r, multiple: o, options: e } = n, t = r === "select-multiple" && o;
|
|
37
|
+
if (!t) return { isMultiSelect: t, selectedOptions: [] };
|
|
38
|
+
const s = [].filter.call(
|
|
39
|
+
e,
|
|
40
|
+
({ selected: c }) => c
|
|
41
|
+
);
|
|
42
|
+
return { isMultiSelect: t, selectedOptions: s };
|
|
43
|
+
}, v = new RegExp(
|
|
44
|
+
[
|
|
45
|
+
"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:",
|
|
46
|
+
"\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:",
|
|
47
|
+
"[-\b\v\f-!#-[]-]",
|
|
48
|
+
'|\\\\[- \v\f-])*")@(?:(?:',
|
|
49
|
+
"[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:",
|
|
50
|
+
"[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|",
|
|
51
|
+
"[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:",
|
|
52
|
+
"(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?",
|
|
53
|
+
"[0-9])|[a-z0-9-]*[a-z0-9]:(?:",
|
|
54
|
+
"[-\b\v\f-!-ZS-]|\\\\[-",
|
|
55
|
+
" \v\f-])+)\\])"
|
|
56
|
+
].join("")
|
|
57
|
+
), x = (n) => ({
|
|
58
|
+
name: "min",
|
|
59
|
+
validator: (r) => {
|
|
60
|
+
const { value: o, message: e } = n, { value: t } = r;
|
|
61
|
+
return { error: !!t && Number(t) < o, message: e };
|
|
62
|
+
}
|
|
63
|
+
}), f = (n) => ({
|
|
64
|
+
name: "max",
|
|
65
|
+
validator: (r) => {
|
|
66
|
+
const { value: o, message: e } = n, { value: t } = r;
|
|
67
|
+
return { error: !!t && Number(t) > o, message: e };
|
|
68
|
+
}
|
|
69
|
+
}), B = (n) => ({
|
|
70
|
+
name: "email",
|
|
71
|
+
validator: (r) => {
|
|
72
|
+
const { message: o } = n || {}, { value: e } = r;
|
|
73
|
+
return { error: !!e && !v.test(e), message: o };
|
|
74
|
+
}
|
|
75
|
+
}), k = (n) => ({
|
|
76
|
+
name: "pattern",
|
|
77
|
+
validator: (r) => {
|
|
78
|
+
const { pattern: o, message: e } = n, { value: t } = r;
|
|
79
|
+
return { error: !!t && !t.match(o), message: e };
|
|
80
|
+
}
|
|
81
|
+
}), y = (n) => ({
|
|
82
|
+
name: "required",
|
|
83
|
+
validator: (r) => {
|
|
84
|
+
const { message: o } = n || {}, { value: e } = r, {
|
|
85
|
+
isCheckBoxGroup: t,
|
|
86
|
+
selectedBoxes: { length: s }
|
|
87
|
+
} = i(r);
|
|
88
|
+
if (t) return { error: !s, message: o };
|
|
89
|
+
const {
|
|
90
|
+
isMultiSelect: c,
|
|
91
|
+
selectedOptions: { length: a }
|
|
92
|
+
} = g(r);
|
|
93
|
+
return c ? { error: !a, message: o } : { error: !e, message: o };
|
|
94
|
+
}
|
|
95
|
+
}), z = (n) => ({
|
|
96
|
+
name: "minLength",
|
|
97
|
+
validator: (r) => {
|
|
98
|
+
const { length: o, message: e } = n, { value: t } = r, s = !!t && t.length < o, {
|
|
99
|
+
isCheckBoxGroup: c,
|
|
100
|
+
selectedBoxes: { length: a }
|
|
101
|
+
} = i(r);
|
|
102
|
+
if (c)
|
|
103
|
+
return { error: !!a && a < o, message: e };
|
|
104
|
+
const {
|
|
105
|
+
isMultiSelect: l,
|
|
106
|
+
selectedOptions: { length: u }
|
|
107
|
+
} = g(r);
|
|
108
|
+
return l ? { error: !!u && u < o, message: e } : { error: s, message: e };
|
|
109
|
+
}
|
|
110
|
+
}), E = (n) => ({
|
|
111
|
+
name: "maxLength",
|
|
112
|
+
validator: (r) => {
|
|
113
|
+
const { length: o, message: e } = n, { value: t } = r, s = !!t && t.length > o, {
|
|
114
|
+
isCheckBoxGroup: c,
|
|
115
|
+
selectedBoxes: { length: a }
|
|
116
|
+
} = i(r);
|
|
117
|
+
if (c)
|
|
118
|
+
return { error: !!a && a > o, message: e };
|
|
119
|
+
const {
|
|
120
|
+
isMultiSelect: l,
|
|
121
|
+
selectedOptions: { length: u }
|
|
122
|
+
} = g(r);
|
|
123
|
+
return l ? { error: !!u && u > o, message: e } : { error: s, message: e };
|
|
124
|
+
}
|
|
125
|
+
}), b = (n) => ({
|
|
126
|
+
name: "define",
|
|
127
|
+
validator: (r) => n(r)
|
|
128
|
+
}), L = {
|
|
129
|
+
min: x,
|
|
130
|
+
max: f,
|
|
131
|
+
email: B,
|
|
132
|
+
define: b,
|
|
133
|
+
pattern: k,
|
|
134
|
+
required: y,
|
|
135
|
+
minLength: z,
|
|
136
|
+
maxLength: E
|
|
137
|
+
}, O = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
138
|
+
__proto__: null,
|
|
139
|
+
getCheckBoxGroupMeta: i,
|
|
140
|
+
getMultiSelectMeta: g,
|
|
141
|
+
isGroupBlurEvent: h,
|
|
142
|
+
validateFormField: p,
|
|
143
|
+
validationModes: d,
|
|
144
|
+
validators: L
|
|
145
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
146
|
+
export {
|
|
147
|
+
p as a,
|
|
148
|
+
g as b,
|
|
149
|
+
L as c,
|
|
150
|
+
O as f,
|
|
151
|
+
i as g,
|
|
152
|
+
h as i,
|
|
153
|
+
d as v
|
|
154
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const m=["onChange","onBlur","onSubmit"],p=async(n,r)=>(await Promise.all(r.map(async e=>{const{validator:t}=e;return t(n)}))).reduce((e,t)=>{const{error:s,message:c}=t;return s?[...e,c]:e},[]),h=n=>{const{target:r,relatedTarget:o}=n||{};if(!o)return{groupBlur:!!o};const{name:e}=r,{name:t}=o,{control:s}=o,{name:c}=s||{};return{groupBlur:e===t||e===c}},i=n=>{const{type:r,checked:o}=n,e=r==="checkbox";if(e)return{isCheckBoxGroup:e,selectedBoxes:o?[n]:[]};const t=Array.from(n),s=t.every(l=>{const{type:u}=l;return u==="checkbox"}),c=!!t.length&&s;if(!c)return{isCheckBoxGroup:c,selectedBoxes:[]};const a=t.filter(({checked:l})=>l);return{isCheckBoxGroup:c,selectedBoxes:a}},g=n=>{const{type:r,multiple:o,options:e}=n,t=r==="select-multiple"&&o;if(!t)return{isMultiSelect:t,selectedOptions:[]};const s=[].filter.call(e,({selected:c})=>c);return{isMultiSelect:t,selectedOptions:s}},x=new RegExp(["(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:","\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:","[-\b\v\f-!#-[]-]",'|\\\\[- \v\f-])*")@(?:(?:',"[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:","[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|","[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:","(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?","[0-9])|[a-z0-9-]*[a-z0-9]:(?:","[-\b\v\f-!-ZS-]|\\\\[-"," \v\f-])+)\\])"].join("")),B=n=>({name:"min",validator:r=>{const{value:o,message:e}=n,{value:t}=r;return{error:!!t&&Number(t)<o,message:e}}}),f=n=>({name:"max",validator:r=>{const{value:o,message:e}=n,{value:t}=r;return{error:!!t&&Number(t)>o,message:e}}}),M=n=>({name:"email",validator:r=>{const{message:o}=n||{},{value:e}=r;return{error:!!e&&!x.test(e),message:o}}}),k=n=>({name:"pattern",validator:r=>{const{pattern:o,message:e}=n,{value:t}=r;return{error:!!t&&!t.match(o),message:e}}}),E=n=>({name:"required",validator:r=>{const{message:o}=n||{},{value:e}=r,{isCheckBoxGroup:t,selectedBoxes:{length:s}}=i(r);if(t)return{error:!s,message:o};const{isMultiSelect:c,selectedOptions:{length:a}}=g(r);return c?{error:!a,message:o}:{error:!e,message:o}}}),y=n=>({name:"minLength",validator:r=>{const{length:o,message:e}=n,{value:t}=r,s=!!t&&t.length<o,{isCheckBoxGroup:c,selectedBoxes:{length:a}}=i(r);if(c)return{error:!!a&&a<o,message:e};const{isMultiSelect:l,selectedOptions:{length:u}}=g(r);return l?{error:!!u&&u<o,message:e}:{error:s,message:e}}}),z=n=>({name:"maxLength",validator:r=>{const{length:o,message:e}=n,{value:t}=r,s=!!t&&t.length>o,{isCheckBoxGroup:c,selectedBoxes:{length:a}}=i(r);if(c)return{error:!!a&&a>o,message:e};const{isMultiSelect:l,selectedOptions:{length:u}}=g(r);return l?{error:!!u&&u>o,message:e}:{error:s,message:e}}}),S=n=>({name:"define",validator:r=>n(r)}),v={min:B,max:f,email:M,define:S,pattern:k,required:E,minLength:y,maxLength:z},C=Object.freeze(Object.defineProperty({__proto__:null,getCheckBoxGroupMeta:i,getMultiSelectMeta:g,isGroupBlurEvent:h,validateFormField:p,validationModes:m,validators:v},Symbol.toStringTag,{value:"Module"}));exports.form=C;exports.getCheckBoxGroupMeta=i;exports.getMultiSelectMeta=g;exports.isGroupBlurEvent=h;exports.validateFormField=p;exports.validationModes=m;exports.validators=v;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("../lib/utils/constants.cjs.js"),s=[e.allSizes.sm,e.allSizes.md],t=[e.appearances.info,e.appearances.warning,e.appearances.positive,e.appearances.negative],a=Object.freeze(Object.defineProperty({__proto__:null,sizes:s,states:t},Symbol.toStringTag,{value:"Module"}));exports.helperText=a;exports.sizes=s;exports.states=t;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { allSizes as t, appearances as e } from "../lib/utils/constants.es.js";
|
|
2
|
+
const s = [t.sm, t.md], o = [
|
|
3
|
+
e.info,
|
|
4
|
+
e.warning,
|
|
5
|
+
e.positive,
|
|
6
|
+
e.negative
|
|
7
|
+
], n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8
|
+
__proto__: null,
|
|
9
|
+
sizes: s,
|
|
10
|
+
states: o
|
|
11
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
12
|
+
export {
|
|
13
|
+
o as a,
|
|
14
|
+
n as h,
|
|
15
|
+
s
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("../lib/utils/constants.cjs.js"),l=[o.allColors.primary,o.allColors.secondary,o.allColors.positive,o.allColors.warning,o.allColors.negative,o.allColors.infoPrimary,o.allColors.infoSecondary,o.allColors.positiveStrong,o.allColors.warningStrong,o.allColors.negativeStrong,o.allColors.infoPrimaryStrong,o.allColors.infoSecondaryStrong,o.allColors.primaryInverse,o.allColors.secondaryInverse],r=[o.xs,o.sm,o.md,o.lg,o.xl],n=["presentation","img","button","link","none"],s=Object.freeze(Object.defineProperty({__proto__:null,iconColors:l,iconSizes:r,roles:n},Symbol.toStringTag,{value:"Module"}));exports.icon=s;exports.iconColors=l;exports.iconSizes=r;exports.roles=n;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { allColors as o, xs as n, sm as r, md as e, lg as i, xl as t } from "../lib/utils/constants.es.js";
|
|
2
|
+
const a = [
|
|
3
|
+
o.primary,
|
|
4
|
+
o.secondary,
|
|
5
|
+
o.positive,
|
|
6
|
+
o.warning,
|
|
7
|
+
o.negative,
|
|
8
|
+
o.infoPrimary,
|
|
9
|
+
o.infoSecondary,
|
|
10
|
+
o.positiveStrong,
|
|
11
|
+
o.warningStrong,
|
|
12
|
+
o.negativeStrong,
|
|
13
|
+
o.infoPrimaryStrong,
|
|
14
|
+
o.infoSecondaryStrong,
|
|
15
|
+
o.primaryInverse,
|
|
16
|
+
o.secondaryInverse
|
|
17
|
+
], s = [n, r, e, i, t], c = ["presentation", "img", "button", "link", "none"], l = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
18
|
+
__proto__: null,
|
|
19
|
+
iconColors: a,
|
|
20
|
+
iconSizes: s,
|
|
21
|
+
roles: c
|
|
22
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
23
|
+
export {
|
|
24
|
+
a,
|
|
25
|
+
s as b,
|
|
26
|
+
l as i,
|
|
27
|
+
c as r
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=["vertical","horizontal"],t=["vertical","horizontal","horizontalFluid"],e=Object.freeze(Object.defineProperty({__proto__:null,layouts:t,orientations:o},Symbol.toStringTag,{value:"Module"}));exports.inputChoiceGroup=e;exports.layouts=t;exports.orientations=o;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const o = ["vertical", "horizontal"], t = ["vertical", "horizontal", "horizontalFluid"], e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2
|
+
__proto__: null,
|
|
3
|
+
layouts: t,
|
|
4
|
+
orientations: o
|
|
5
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
6
|
+
export {
|
|
7
|
+
e as i,
|
|
8
|
+
t as l,
|
|
9
|
+
o
|
|
10
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { allSizes as e, appearances as a } from "../lib/utils/constants.es.js";
|
|
2
|
+
const l = [
|
|
3
|
+
e.sm,
|
|
4
|
+
e.md,
|
|
5
|
+
e.lg,
|
|
6
|
+
e.xl
|
|
7
|
+
], o = [a.primary, a.secondary], n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8
|
+
__proto__: null,
|
|
9
|
+
linkAppearance: o,
|
|
10
|
+
linkSize: l
|
|
11
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
12
|
+
export {
|
|
13
|
+
l as a,
|
|
14
|
+
o as b,
|
|
15
|
+
n as l
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("../lib/utils/constants.cjs.js"),l=[e.allSizes.sm,e.allSizes.md,e.allSizes.lg,e.allSizes.xl],n=[e.appearances.primary,e.appearances.secondary],a=Object.freeze(Object.defineProperty({__proto__:null,linkAppearance:n,linkSize:l},Symbol.toStringTag,{value:"Module"}));exports.link=a;exports.linkAppearance=n;exports.linkSize=l;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { allSizes as e } from "../lib/utils/constants.es.js";
|
|
2
|
+
const s = ["ordered", "unordered", "unstyled", "withIcons"], l = {
|
|
3
|
+
ordered: "ol",
|
|
4
|
+
unordered: "ul",
|
|
5
|
+
unstyled: "ul",
|
|
6
|
+
withIcons: "ul"
|
|
7
|
+
}, o = [
|
|
8
|
+
e.sm,
|
|
9
|
+
e.md,
|
|
10
|
+
e.lg,
|
|
11
|
+
e.xl
|
|
12
|
+
], t = [e.md, e.lg], r = ["decimal", "lower-alpha", "lower-roman"], d = ["disc", "circle"], i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
13
|
+
__proto__: null,
|
|
14
|
+
listDensity: t,
|
|
15
|
+
listKind: s,
|
|
16
|
+
listKindToElement: l,
|
|
17
|
+
listSizes: o,
|
|
18
|
+
orderedListStyles: r,
|
|
19
|
+
unorderedListStyles: d
|
|
20
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
21
|
+
export {
|
|
22
|
+
s as a,
|
|
23
|
+
l as b,
|
|
24
|
+
o as c,
|
|
25
|
+
t as d,
|
|
26
|
+
i as l,
|
|
27
|
+
r as o,
|
|
28
|
+
d as u
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("../lib/utils/constants.cjs.js"),l=["ordered","unordered","unstyled","withIcons"],s={ordered:"ol",unordered:"ul",unstyled:"ul",withIcons:"ul"},t=[e.allSizes.sm,e.allSizes.md,e.allSizes.lg,e.allSizes.xl],i=[e.allSizes.md,e.allSizes.lg],o=["decimal","lower-alpha","lower-roman"],n=["disc","circle"],d=Object.freeze(Object.defineProperty({__proto__:null,listDensity:i,listKind:l,listKindToElement:s,listSizes:t,orderedListStyles:o,unorderedListStyles:n},Symbol.toStringTag,{value:"Module"}));exports.list=d;exports.listDensity=i;exports.listKind=l;exports.listKindToElement=s;exports.listSizes=t;exports.orderedListStyles=o;exports.unorderedListStyles=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("../lib/utils/constants.cjs.js"),e=[o.xs,o.sm,o.md,o.lg,o.xl],t=["presentation","img","button","link","none"],l=Object.freeze(Object.defineProperty({__proto__:null,logoSizes:e,roles:t},Symbol.toStringTag,{value:"Module"}));exports.logo=l;exports.logoSizes=e;exports.roles=t;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { xs as o, sm as e, md as t, lg as l, xl as n } from "../lib/utils/constants.es.js";
|
|
2
|
+
const r = [o, e, t, l, n], s = ["presentation", "img", "button", "link", "none"], i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3
|
+
__proto__: null,
|
|
4
|
+
logoSizes: r,
|
|
5
|
+
roles: s
|
|
6
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
7
|
+
export {
|
|
8
|
+
r as a,
|
|
9
|
+
i as l,
|
|
10
|
+
s as r
|
|
11
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isMobileDevice as r } from "../lib/utils/helpers.es.js";
|
|
2
|
+
const d = (e, t) => {
|
|
3
|
+
if (!r() || !e) return;
|
|
4
|
+
const { options: n = [] } = e;
|
|
5
|
+
Array.prototype.forEach.call(n, (s) => {
|
|
6
|
+
const { disabled: i, dataset: a } = s, { disabled: o } = a;
|
|
7
|
+
o || (s.dataset.disabled = String(i));
|
|
8
|
+
const { disabled: l } = a;
|
|
9
|
+
s.disabled = t || l === String(!0);
|
|
10
|
+
});
|
|
11
|
+
}, c = (e) => {
|
|
12
|
+
const t = !!e.match(new RegExp("^\\p{L}$", "u")), n = [" ", "ArrowUp", "ArrowDown"].includes(e);
|
|
13
|
+
return t || n;
|
|
14
|
+
}, p = (e) => (t) => {
|
|
15
|
+
const n = t instanceof HTMLOptionElement, s = t instanceof HTMLOptGroupElement;
|
|
16
|
+
(n || s) && e.add(t);
|
|
17
|
+
}, b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
18
|
+
__proto__: null,
|
|
19
|
+
addOption: p,
|
|
20
|
+
hideOptions: d,
|
|
21
|
+
isManipulateEvent: c
|
|
22
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
23
|
+
export {
|
|
24
|
+
p as a,
|
|
25
|
+
d as h,
|
|
26
|
+
c as i,
|
|
27
|
+
b as n
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const p=require("../lib/utils/helpers.cjs.js"),l=(e,t)=>{if(!p.isMobileDevice()||!e)return;const{options:n=[]}=e;Array.prototype.forEach.call(n,i=>{const{disabled:s,dataset:a}=i,{disabled:r}=a;r||(i.dataset.disabled=String(s));const{disabled:c}=a;i.disabled=t||c===String(!0)})},o=e=>{const t=!!e.match(new RegExp("^\\p{L}$","u")),n=[" ","ArrowUp","ArrowDown"].includes(e);return t||n},d=e=>t=>{const n=t instanceof HTMLOptionElement,i=t instanceof HTMLOptGroupElement;(n||i)&&e.add(t)},u=Object.freeze(Object.defineProperty({__proto__:null,addOption:d,hideOptions:l,isManipulateEvent:o},Symbol.toStringTag,{value:"Module"}));exports.addOption=d;exports.hideOptions=l;exports.isManipulateEvent=o;exports.nativeSelect=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("../lib/utils/constants.cjs.js"),t={[e.allSizes.md]:"heading-lg",[e.allSizes.lg]:"heading-2xl"},n=Object.freeze(Object.defineProperty({__proto__:null,HeadingContentSize:t},Symbol.toStringTag,{value:"Module"}));exports.HeadingContentSize=t;exports.pageHeader=n;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { allSizes as e } from "../lib/utils/constants.es.js";
|
|
2
|
+
const o = {
|
|
3
|
+
[e.md]: "heading-lg",
|
|
4
|
+
[e.lg]: "heading-2xl"
|
|
5
|
+
}, a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6
|
+
__proto__: null,
|
|
7
|
+
HeadingContentSize: o
|
|
8
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
9
|
+
export {
|
|
10
|
+
o as H,
|
|
11
|
+
a as p
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const E=A=>A-2,e=A=>A*2,N=(A,T)=>{const _=e(T);if(A<1)throw new Error("totalPages must be at least 1");if(A<7||T<1)return 0;for(;T>0&&A<_+5;)T--;return T},I=(A,T)=>Array.from({length:T},(_,t)=>A+t),M=(A,T,_=0)=>{const t=e(_);if(T<1||T>A)throw new Error(`currentPage must be between 1 and ${A}`);return T<4+_||T>A-3-_?[]:I(T-_,t+1)},n=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_OFFSET:0,MAX_END_PAGES:3,MAX_INITIAL_PAGES:4,MIDPOINT_START:2,TRUNCATION_PAGE_MINIMUM:5,calculateTotalOffset:e,compensateOffset:N,createPageRange:I,generateMiddlePages:M,getAdjustedTotalPages:E},Symbol.toStringTag,{value:"Module"}));exports.DEFAULT_OFFSET=0;exports.MAX_END_PAGES=3;exports.MAX_INITIAL_PAGES=4;exports.MIDPOINT_START=2;exports.TRUNCATION_PAGE_MINIMUM=5;exports.calculateTotalOffset=e;exports.compensateOffset=N;exports.createPageRange=I;exports.generateMiddlePages=M;exports.getAdjustedTotalPages=E;exports.pagination=n;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const E = 5, N = 0, M = 4, o = 3, O = 2, I = (T) => T - 2, e = (T) => T * 2, s = (T, _) => {
|
|
2
|
+
const t = e(_);
|
|
3
|
+
if (T < 1) throw new Error("totalPages must be at least 1");
|
|
4
|
+
if (T < 7 || _ < 1) return 0;
|
|
5
|
+
for (; _ > 0 && T < t + 5; )
|
|
6
|
+
_--;
|
|
7
|
+
return _;
|
|
8
|
+
}, n = (T, _) => Array.from({ length: _ }, (t, A) => T + A), a = (T, _, t = 0) => {
|
|
9
|
+
const A = e(t);
|
|
10
|
+
if (_ < 1 || _ > T)
|
|
11
|
+
throw new Error(`currentPage must be between 1 and ${T}`);
|
|
12
|
+
return _ < 4 + t || _ > T - 3 - t ? [] : n(_ - t, A + 1);
|
|
13
|
+
}, r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
14
|
+
__proto__: null,
|
|
15
|
+
DEFAULT_OFFSET: 0,
|
|
16
|
+
MAX_END_PAGES: 3,
|
|
17
|
+
MAX_INITIAL_PAGES: 4,
|
|
18
|
+
MIDPOINT_START: 2,
|
|
19
|
+
TRUNCATION_PAGE_MINIMUM: 5,
|
|
20
|
+
calculateTotalOffset: e,
|
|
21
|
+
compensateOffset: s,
|
|
22
|
+
createPageRange: n,
|
|
23
|
+
generateMiddlePages: a,
|
|
24
|
+
getAdjustedTotalPages: I
|
|
25
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
26
|
+
export {
|
|
27
|
+
N as D,
|
|
28
|
+
M,
|
|
29
|
+
E as T,
|
|
30
|
+
o as a,
|
|
31
|
+
O as b,
|
|
32
|
+
e as c,
|
|
33
|
+
s as d,
|
|
34
|
+
n as e,
|
|
35
|
+
a as f,
|
|
36
|
+
I as g,
|
|
37
|
+
r as p
|
|
38
|
+
};
|