iryx-ui 0.7.0 → 0.9.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 +155 -7
- package/dist/component-names.d.ts +1 -1
- package/dist/components/BarChart.vue.d.ts +36 -0
- package/dist/components/FileUpload.vue.d.ts +64 -0
- package/dist/components/Sparkline.vue.d.ts +38 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/composables/element-size.d.ts +15 -0
- package/dist/composables/scale.d.ts +36 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +78 -70
- package/dist/node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js +86 -7
- package/dist/packages/iryx-ui/src/component-names.js +1 -1
- package/dist/packages/iryx-ui/src/components/BarChart.js +5 -0
- package/dist/packages/iryx-ui/src/components/BarChart.vue_vue_type_script_setup_true_lang.js +178 -0
- package/dist/packages/iryx-ui/src/components/FileUpload.js +5 -0
- package/dist/packages/iryx-ui/src/components/FileUpload.vue_vue_type_script_setup_true_lang.js +209 -0
- package/dist/packages/iryx-ui/src/components/PasswordInput.vue_vue_type_script_setup_true_lang.js +9 -9
- package/dist/packages/iryx-ui/src/components/Sparkline.js +5 -0
- package/dist/packages/iryx-ui/src/components/Sparkline.vue_vue_type_script_setup_true_lang.js +110 -0
- package/dist/packages/iryx-ui/src/components/index.js +72 -66
- package/dist/packages/iryx-ui/src/composables/element-size.js +22 -0
- package/dist/packages/iryx-ui/src/composables/scale.js +43 -0
- package/dist/packages/iryx-ui/src/theme/bar-chart.js +18 -0
- package/dist/packages/iryx-ui/src/theme/file-upload.js +29 -0
- package/dist/packages/iryx-ui/src/theme/password-input.js +1 -0
- package/dist/packages/iryx-ui/src/theme/sparkline.js +15 -0
- package/dist/theme/bar-chart.d.ts +111 -0
- package/dist/theme/file-upload.d.ts +143 -0
- package/dist/theme/form.d.ts +3 -3
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/password-input.d.ts +18 -0
- package/dist/theme/sparkline.d.ts +58 -0
- package/package.json +1 -1
|
@@ -132,6 +132,60 @@ var e = [
|
|
|
132
132
|
strokeWidth: "1.5",
|
|
133
133
|
key: "1"
|
|
134
134
|
}]], l = [
|
|
135
|
+
["path", {
|
|
136
|
+
d: "M19.5 5.5L18.8803 15.5251C18.7219 18.0864 18.6428 19.3671 18.0008 20.2879C17.6833 20.7431 17.2747 21.1273 16.8007 21.416C15.8421 22 14.559 22 11.9927 22C9.42312 22 8.1383 22 7.17905 21.4149C6.7048 21.1257 6.296 20.7408 5.97868 20.2848C5.33688 19.3626 5.25945 18.0801 5.10461 15.5152L4.5 5.5",
|
|
137
|
+
stroke: "currentColor",
|
|
138
|
+
strokeLinecap: "round",
|
|
139
|
+
strokeWidth: "1.5",
|
|
140
|
+
key: "0"
|
|
141
|
+
}],
|
|
142
|
+
["path", {
|
|
143
|
+
d: "M3 5.5H21M16.0557 5.5L15.3731 4.09173C14.9196 3.15626 14.6928 2.68852 14.3017 2.39681C14.215 2.3321 14.1231 2.27454 14.027 2.2247C13.5939 2 13.0741 2 12.0345 2C10.9688 2 10.436 2 9.99568 2.23412C9.8981 2.28601 9.80498 2.3459 9.71729 2.41317C9.32164 2.7167 9.10063 3.20155 8.65861 4.17126L8.05292 5.5",
|
|
144
|
+
stroke: "currentColor",
|
|
145
|
+
strokeLinecap: "round",
|
|
146
|
+
strokeWidth: "1.5",
|
|
147
|
+
key: "1"
|
|
148
|
+
}],
|
|
149
|
+
["path", {
|
|
150
|
+
d: "M9.5 16.5L9.5 10.5",
|
|
151
|
+
stroke: "currentColor",
|
|
152
|
+
strokeLinecap: "round",
|
|
153
|
+
strokeWidth: "1.5",
|
|
154
|
+
key: "2"
|
|
155
|
+
}],
|
|
156
|
+
["path", {
|
|
157
|
+
d: "M14.5 16.5L14.5 10.5",
|
|
158
|
+
stroke: "currentColor",
|
|
159
|
+
strokeLinecap: "round",
|
|
160
|
+
strokeWidth: "1.5",
|
|
161
|
+
key: "3"
|
|
162
|
+
}]
|
|
163
|
+
], u = [
|
|
164
|
+
["path", {
|
|
165
|
+
d: "M8 7L16 7",
|
|
166
|
+
stroke: "currentColor",
|
|
167
|
+
strokeLinecap: "round",
|
|
168
|
+
strokeLinejoin: "round",
|
|
169
|
+
strokeWidth: "1.5",
|
|
170
|
+
key: "0"
|
|
171
|
+
}],
|
|
172
|
+
["path", {
|
|
173
|
+
d: "M8 11L12 11",
|
|
174
|
+
stroke: "currentColor",
|
|
175
|
+
strokeLinecap: "round",
|
|
176
|
+
strokeLinejoin: "round",
|
|
177
|
+
strokeWidth: "1.5",
|
|
178
|
+
key: "1"
|
|
179
|
+
}],
|
|
180
|
+
["path", {
|
|
181
|
+
d: "M13 21.5V21C13 18.1716 13 16.7574 13.8787 15.8787C14.7574 15 16.1716 15 19 15H19.5M20 13.3431V10C20 6.22876 20 4.34315 18.8284 3.17157C17.6569 2 15.7712 2 12 2C8.22877 2 6.34315 2 5.17157 3.17157C4 4.34314 4 6.22876 4 10L4 14.5442C4 17.7892 4 19.4117 4.88607 20.5107C5.06508 20.7327 5.26731 20.9349 5.48933 21.1139C6.58831 22 8.21082 22 11.4558 22C12.1614 22 12.5141 22 12.8372 21.886C12.9044 21.8623 12.9702 21.835 13.0345 21.8043C13.3436 21.6564 13.593 21.407 14.0919 20.9081L18.8284 16.1716C19.4065 15.5935 19.6955 15.3045 19.8478 14.9369C20 14.5694 20 14.1606 20 13.3431Z",
|
|
182
|
+
stroke: "currentColor",
|
|
183
|
+
strokeLinecap: "round",
|
|
184
|
+
strokeLinejoin: "round",
|
|
185
|
+
strokeWidth: "1.5",
|
|
186
|
+
key: "2"
|
|
187
|
+
}]
|
|
188
|
+
], d = [
|
|
135
189
|
["circle", {
|
|
136
190
|
cx: "12",
|
|
137
191
|
cy: "12",
|
|
@@ -158,7 +212,7 @@ var e = [
|
|
|
158
212
|
strokeWidth: "1.5",
|
|
159
213
|
key: "2"
|
|
160
214
|
}]
|
|
161
|
-
],
|
|
215
|
+
], f = [
|
|
162
216
|
["path", {
|
|
163
217
|
d: "M12 3V6",
|
|
164
218
|
stroke: "currentColor",
|
|
@@ -215,21 +269,21 @@ var e = [
|
|
|
215
269
|
strokeWidth: "1.5",
|
|
216
270
|
key: "7"
|
|
217
271
|
}]
|
|
218
|
-
],
|
|
272
|
+
], p = [["path", {
|
|
219
273
|
d: "M20 12L4 12",
|
|
220
274
|
stroke: "currentColor",
|
|
221
275
|
strokeLinecap: "round",
|
|
222
276
|
strokeLinejoin: "round",
|
|
223
277
|
strokeWidth: "1.5",
|
|
224
278
|
key: "0"
|
|
225
|
-
}]],
|
|
279
|
+
}]], m = [["path", {
|
|
226
280
|
d: "M5 14L8.5 17.5L19 6.5",
|
|
227
281
|
stroke: "currentColor",
|
|
228
282
|
strokeLinecap: "round",
|
|
229
283
|
strokeLinejoin: "round",
|
|
230
284
|
strokeWidth: "1.5",
|
|
231
285
|
key: "0"
|
|
232
|
-
}]],
|
|
286
|
+
}]], h = [["path", {
|
|
233
287
|
d: "M18 14C18 14 13.5811 19 12 19C10.4188 19 6 14 6 14",
|
|
234
288
|
stroke: "currentColor",
|
|
235
289
|
strokeLinecap: "round",
|
|
@@ -243,7 +297,32 @@ var e = [
|
|
|
243
297
|
strokeLinejoin: "round",
|
|
244
298
|
strokeWidth: "1.5",
|
|
245
299
|
key: "1"
|
|
246
|
-
}]],
|
|
300
|
+
}]], g = [
|
|
301
|
+
["path", {
|
|
302
|
+
d: "M2.50006 13.5V6.5H21.5001V13.5C21.5001 17.2712 21.5001 19.1569 20.3285 20.3284C19.1569 21.5 17.2713 21.5 13.5001 21.5H10.5001C6.72883 21.5 4.84321 21.5 3.67163 20.3284C2.50006 19.1569 2.50006 17.2712 2.50006 13.5Z",
|
|
303
|
+
stroke: "currentColor",
|
|
304
|
+
strokeLinecap: "round",
|
|
305
|
+
strokeLinejoin: "round",
|
|
306
|
+
strokeWidth: "1.5",
|
|
307
|
+
key: "0"
|
|
308
|
+
}],
|
|
309
|
+
["path", {
|
|
310
|
+
d: "M2.50006 6.5L3.10006 5.7C4.27777 4.12972 4.86662 3.34458 5.71121 2.92229C6.55579 2.5 7.53721 2.5 9.50006 2.5H14.5001C16.4629 2.5 17.4443 2.5 18.2889 2.92229C19.1335 3.34458 19.7224 4.12972 20.9001 5.7L21.5001 6.5",
|
|
311
|
+
stroke: "currentColor",
|
|
312
|
+
strokeLinecap: "round",
|
|
313
|
+
strokeLinejoin: "round",
|
|
314
|
+
strokeWidth: "1.5",
|
|
315
|
+
key: "1"
|
|
316
|
+
}],
|
|
317
|
+
["path", {
|
|
318
|
+
d: "M15.0001 13.5C15.0001 13.5 12.7906 10.5 12 10.5C11.2095 10.5 9.00006 13.5 9.00006 13.5M12 11L12.0001 17.5",
|
|
319
|
+
stroke: "currentColor",
|
|
320
|
+
strokeLinecap: "round",
|
|
321
|
+
strokeLinejoin: "round",
|
|
322
|
+
strokeWidth: "1.5",
|
|
323
|
+
key: "2"
|
|
324
|
+
}]
|
|
325
|
+
], _ = [
|
|
247
326
|
["path", {
|
|
248
327
|
d: "M22 8C22 8 18 14 12 14C6 14 2 8 2 8",
|
|
249
328
|
stroke: "currentColor",
|
|
@@ -283,7 +362,7 @@ var e = [
|
|
|
283
362
|
strokeWidth: "1.5",
|
|
284
363
|
key: "4"
|
|
285
364
|
}]
|
|
286
|
-
],
|
|
365
|
+
], v = [["path", {
|
|
287
366
|
d: "M21.544 11.045C21.848 11.4713 22 11.6845 22 12C22 12.3155 21.848 12.5287 21.544 12.955C20.1779 14.8706 16.6892 19 12 19C7.31078 19 3.8221 14.8706 2.45604 12.955C2.15201 12.5287 2 12.3155 2 12C2 11.6845 2.15201 11.4713 2.45604 11.045C3.8221 9.12944 7.31078 5 12 5C16.6892 5 20.1779 9.12944 21.544 11.045Z",
|
|
288
367
|
stroke: "currentColor",
|
|
289
368
|
strokeWidth: "1.5",
|
|
@@ -295,4 +374,4 @@ var e = [
|
|
|
295
374
|
key: "1"
|
|
296
375
|
}]];
|
|
297
376
|
//#endregion
|
|
298
|
-
export { e as Alert02Icon, t as AlertCircleIcon, n as ArrowDown01Icon, r as ArrowLeft01Icon, i as ArrowRight01Icon, a as ArrowUp01Icon, o as Calendar03Icon, s as Cancel01Icon, c as CheckmarkCircle02Icon, l as
|
|
377
|
+
export { e as Alert02Icon, t as AlertCircleIcon, n as ArrowDown01Icon, r as ArrowLeft01Icon, i as ArrowRight01Icon, a as ArrowUp01Icon, o as Calendar03Icon, s as Cancel01Icon, c as CheckmarkCircle02Icon, l as Delete02Icon, u as File01Icon, d as InformationCircleIcon, f as Loading03Icon, p as MinusSignIcon, m as Tick02Icon, h as UnfoldMoreIcon, g as Upload05Icon, v as ViewIcon, _ as ViewOffIcon };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/component-names.ts
|
|
2
|
-
var e = /* @__PURE__ */ "Alert.App.Badge.Banner.Breadcrumb.Button.ButtonGroup.Card.Checkbox.Combobox.ConfirmDialog.DatePicker.DateRangePicker.Dialog.DropdownMenu.EmptyState.Form.FormField.Input.Label.NumberInput.Pagination.PasswordInput.Progress.RadioGroup.Select.Separator.Skeleton.Stat.Stepper.Switch.Table.Tabs.Textarea.Toaster.Tooltip".split(".");
|
|
2
|
+
var e = /* @__PURE__ */ "Alert.App.Badge.BarChart.Banner.Breadcrumb.Button.ButtonGroup.Card.Checkbox.Combobox.ConfirmDialog.DatePicker.DateRangePicker.Dialog.DropdownMenu.EmptyState.FileUpload.Form.FormField.Input.Label.NumberInput.Pagination.PasswordInput.Progress.RadioGroup.Select.Separator.Skeleton.Sparkline.Stat.Stepper.Switch.Table.Tabs.Textarea.Toaster.Tooltip".split(".");
|
|
3
3
|
//#endregion
|
|
4
4
|
export { e as componentNames };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { useIryxUiConfig as e } from "../config.js";
|
|
2
|
+
import { useElementSize as t } from "../composables/element-size.js";
|
|
3
|
+
import { extent as n, linearScale as r, niceTicks as i } from "../composables/scale.js";
|
|
4
|
+
import { barChartTheme as a } from "../theme/bar-chart.js";
|
|
5
|
+
import { Fragment as o, computed as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, defineComponent as d, normalizeClass as f, normalizeStyle as p, openBlock as m, ref as h, renderList as g, toDisplayString as _, unref as v } from "vue";
|
|
6
|
+
//#region src/components/BarChart.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var y = ["role", "aria-label"], b = [
|
|
8
|
+
"width",
|
|
9
|
+
"height",
|
|
10
|
+
"viewBox"
|
|
11
|
+
], x = [
|
|
12
|
+
"x1",
|
|
13
|
+
"y1",
|
|
14
|
+
"x2",
|
|
15
|
+
"y2"
|
|
16
|
+
], S = ["x", "y"], C = ["d"], w = ["x", "y"], T = [
|
|
17
|
+
"x",
|
|
18
|
+
"y",
|
|
19
|
+
"width",
|
|
20
|
+
"height",
|
|
21
|
+
"onPointerenter"
|
|
22
|
+
], E = { scope: "row" }, D = 6.5, O = 8, k = 20, A = 8, j = .7, M = /*@__PURE__*/ d({
|
|
23
|
+
__name: "BarChart",
|
|
24
|
+
props: {
|
|
25
|
+
data: { default: () => [] },
|
|
26
|
+
height: { default: 240 },
|
|
27
|
+
ticks: { default: 5 },
|
|
28
|
+
axis: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !0
|
|
31
|
+
},
|
|
32
|
+
locale: {},
|
|
33
|
+
format: {},
|
|
34
|
+
label: {},
|
|
35
|
+
unstyled: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: void 0
|
|
38
|
+
},
|
|
39
|
+
class: {},
|
|
40
|
+
ui: {}
|
|
41
|
+
},
|
|
42
|
+
setup(d) {
|
|
43
|
+
let M = d, N = e(), P = s(() => M.unstyled ?? N.unstyled), F = h(), { width: I } = t(F), L = s(() => new Intl.NumberFormat(M.locale, M.format));
|
|
44
|
+
function R(e) {
|
|
45
|
+
return L.value.format(e);
|
|
46
|
+
}
|
|
47
|
+
let z = s(() => {
|
|
48
|
+
let e = n(M.data.map((e) => e.value));
|
|
49
|
+
return e ? i(Math.min(0, e[0]), Math.max(0, e[1]), M.ticks) : i(0, 1, M.ticks);
|
|
50
|
+
}), B = s(() => {
|
|
51
|
+
if (!M.axis) return 0;
|
|
52
|
+
let e = Math.max(...z.value.ticks.map((e) => R(e).length), 1);
|
|
53
|
+
return Math.ceil(e * D) + O;
|
|
54
|
+
}), V = s(() => ({
|
|
55
|
+
left: B.value,
|
|
56
|
+
top: A,
|
|
57
|
+
width: Math.max(I.value - B.value, 0),
|
|
58
|
+
height: Math.max(M.height - A - k, 0)
|
|
59
|
+
})), H = s(() => r([z.value.min, z.value.max], [V.value.top + V.value.height, V.value.top])), U = s(() => M.data.length ? V.value.width / M.data.length : 0), W = s(() => Math.max(2, Math.min(24, U.value * j))), G = s(() => {
|
|
60
|
+
if (!I.value || !M.data.length) return [];
|
|
61
|
+
let e = H.value(0);
|
|
62
|
+
return M.data.flatMap((t, n) => {
|
|
63
|
+
let r = t.value;
|
|
64
|
+
if (typeof r != "number" || !Number.isFinite(r)) return [];
|
|
65
|
+
let i = H.value(r);
|
|
66
|
+
return [{
|
|
67
|
+
x: V.value.left + U.value * (n + .5) - W.value / 2,
|
|
68
|
+
y: Math.min(i, e),
|
|
69
|
+
width: W.value,
|
|
70
|
+
height: Math.abs(e - i),
|
|
71
|
+
up: r >= 0,
|
|
72
|
+
datum: t
|
|
73
|
+
}];
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
function K(e) {
|
|
77
|
+
let t = Math.min(4, e.width / 2, e.height), { x: n, width: r } = e, i = n + r;
|
|
78
|
+
if (e.up) {
|
|
79
|
+
let r = e.y, a = e.y + e.height;
|
|
80
|
+
return `M${n} ${a} L${n} ${r + t} Q${n} ${r} ${n + t} ${r} L${i - t} ${r} Q${i} ${r} ${i} ${r + t} L${i} ${a} Z`;
|
|
81
|
+
}
|
|
82
|
+
let a = e.y, o = e.y + e.height;
|
|
83
|
+
return `M${n} ${a} L${n} ${o - t} Q${n} ${o} ${n + t} ${o} L${i - t} ${o} Q${i} ${o} ${i} ${o - t} L${i} ${a} Z`;
|
|
84
|
+
}
|
|
85
|
+
let q = s(() => {
|
|
86
|
+
if (!U.value || !M.data.length) return 1;
|
|
87
|
+
let e = Math.max(...M.data.map((e) => e.label.length), 1);
|
|
88
|
+
return Math.max(1, Math.ceil((e * D + 8) / U.value));
|
|
89
|
+
}), J = h(), Y = s(() => {
|
|
90
|
+
if (J.value == null) return;
|
|
91
|
+
let e = M.data[J.value];
|
|
92
|
+
if (!e || typeof e.value != "number") return;
|
|
93
|
+
let t = e.label, n = R(e.value), r = ((t.length + n.length) * D + 28) / 2, i = V.value.left + U.value * (J.value + .5);
|
|
94
|
+
return {
|
|
95
|
+
label: t,
|
|
96
|
+
value: n,
|
|
97
|
+
x: Math.min(Math.max(i, r), Math.max(I.value - r, r)),
|
|
98
|
+
y: Math.min(H.value(e.value), H.value(0))
|
|
99
|
+
};
|
|
100
|
+
}), X = s(() => a());
|
|
101
|
+
function Z(e, t) {
|
|
102
|
+
let n = M.ui?.[e];
|
|
103
|
+
return P.value ? [n, t] : X.value[e]({ class: [n, t] });
|
|
104
|
+
}
|
|
105
|
+
function Q(e) {
|
|
106
|
+
let t = J.value != null && J.value !== e;
|
|
107
|
+
return P.value ? [M.ui?.bar] : X.value.bar({ class: [M.ui?.bar, t ? X.value.faded() : void 0] });
|
|
108
|
+
}
|
|
109
|
+
return (e, t) => (m(), l("div", {
|
|
110
|
+
ref_key: "root",
|
|
111
|
+
ref: F,
|
|
112
|
+
role: M.label ? "figure" : void 0,
|
|
113
|
+
"aria-label": M.label,
|
|
114
|
+
class: f(Z("root", M.class))
|
|
115
|
+
}, [
|
|
116
|
+
(m(), l("svg", {
|
|
117
|
+
width: v(I),
|
|
118
|
+
height: M.height,
|
|
119
|
+
viewBox: `0 0 ${v(I)} ${M.height}`,
|
|
120
|
+
"aria-hidden": "true",
|
|
121
|
+
class: f(Z("svg"))
|
|
122
|
+
}, [
|
|
123
|
+
M.axis ? (m(!0), l(o, { key: 0 }, g(z.value.ticks, (e) => (m(), l("g", { key: `tick-${e}` }, [u("line", {
|
|
124
|
+
x1: V.value.left,
|
|
125
|
+
y1: H.value(e),
|
|
126
|
+
x2: V.value.left + V.value.width,
|
|
127
|
+
y2: H.value(e),
|
|
128
|
+
"stroke-width": "1",
|
|
129
|
+
class: f(Z("grid"))
|
|
130
|
+
}, null, 10, x), u("text", {
|
|
131
|
+
x: V.value.left - O,
|
|
132
|
+
y: H.value(e),
|
|
133
|
+
"text-anchor": "end",
|
|
134
|
+
"dominant-baseline": "middle",
|
|
135
|
+
class: f(Z("tick"))
|
|
136
|
+
}, _(R(e)), 11, S)]))), 128)) : c("", !0),
|
|
137
|
+
(m(!0), l(o, null, g(G.value, (e, t) => (m(), l("path", {
|
|
138
|
+
key: `bar-${e.datum.label}-${t}`,
|
|
139
|
+
d: K(e),
|
|
140
|
+
class: f(Q(t))
|
|
141
|
+
}, null, 10, C))), 128)),
|
|
142
|
+
(m(!0), l(o, null, g(M.data, (e, t) => (m(), l(o, { key: `label-${e.label}-${t}` }, [t % q.value === 0 ? (m(), l("text", {
|
|
143
|
+
key: 0,
|
|
144
|
+
x: V.value.left + U.value * (t + .5),
|
|
145
|
+
y: V.value.top + V.value.height + 14,
|
|
146
|
+
"text-anchor": "middle",
|
|
147
|
+
class: f(Z("category"))
|
|
148
|
+
}, _(e.label), 11, w)) : c("", !0)], 64))), 128)),
|
|
149
|
+
(m(!0), l(o, null, g(M.data, (e, n) => (m(), l("rect", {
|
|
150
|
+
key: `hit-${e.label}-${n}`,
|
|
151
|
+
x: V.value.left + U.value * n,
|
|
152
|
+
y: V.value.top,
|
|
153
|
+
width: U.value,
|
|
154
|
+
height: V.value.height,
|
|
155
|
+
class: f(P.value ? void 0 : X.value.hit()),
|
|
156
|
+
onPointerenter: (e) => J.value = n,
|
|
157
|
+
onPointerleave: t[0] ||= (e) => J.value = void 0
|
|
158
|
+
}, null, 42, T))), 128))
|
|
159
|
+
], 10, b)),
|
|
160
|
+
Y.value ? (m(), l("div", {
|
|
161
|
+
key: 0,
|
|
162
|
+
class: f(Z("tooltip")),
|
|
163
|
+
style: p({
|
|
164
|
+
left: `${Y.value.x}px`,
|
|
165
|
+
top: `${Y.value.y}px`,
|
|
166
|
+
transform: "translate(-50%, -100%) translateY(-8px)"
|
|
167
|
+
})
|
|
168
|
+
}, [u("span", { class: f(Z("tooltipLabel")) }, _(Y.value.label), 3), u("span", { class: f(Z("tooltipValue")) }, _(Y.value.value), 3)], 6)) : c("", !0),
|
|
169
|
+
u("table", { class: f(Z("table")) }, [
|
|
170
|
+
u("caption", null, _(M.label), 1),
|
|
171
|
+
t[1] ||= u("thead", null, [u("tr", null, [u("th", { scope: "col" }, " Category "), u("th", { scope: "col" }, " Value ")])], -1),
|
|
172
|
+
u("tbody", null, [(m(!0), l(o, null, g(M.data, (e, t) => (m(), l("tr", { key: `row-${e.label}-${t}` }, [u("th", E, _(e.label), 1), u("td", null, _(typeof e.value == "number" ? R(e.value) : "—"), 1)]))), 128))])
|
|
173
|
+
], 2)
|
|
174
|
+
], 10, y));
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
//#endregion
|
|
178
|
+
export { M as default };
|
package/dist/packages/iryx-ui/src/components/FileUpload.vue_vue_type_script_setup_true_lang.js
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { Delete02Icon as e, File01Icon as t, Upload05Icon as n } from "../../../../node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js";
|
|
2
|
+
import { useIryxUiConfig as r } from "../config.js";
|
|
3
|
+
import i from "./Icon.js";
|
|
4
|
+
import a from "./Button.js";
|
|
5
|
+
import { useFormField as o } from "../composables/form.js";
|
|
6
|
+
import { fileUploadTheme as s } from "../theme/file-upload.js";
|
|
7
|
+
import { Fragment as c, computed as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, mergeModels as g, normalizeClass as _, onBeforeUnmount as v, openBlock as y, ref as b, renderList as x, toDisplayString as S, unref as C, useModel as w, watch as T, withCtx as E, withModifiers as D } from "vue";
|
|
8
|
+
//#region src/components/FileUpload.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
+
var O = [
|
|
10
|
+
"id",
|
|
11
|
+
"multiple",
|
|
12
|
+
"accept",
|
|
13
|
+
"disabled",
|
|
14
|
+
"aria-invalid",
|
|
15
|
+
"aria-describedby"
|
|
16
|
+
], k = ["src"], A = [
|
|
17
|
+
"aria-label",
|
|
18
|
+
"disabled",
|
|
19
|
+
"onClick"
|
|
20
|
+
], j = /*@__PURE__*/ h({
|
|
21
|
+
__name: "FileUpload",
|
|
22
|
+
props: /*@__PURE__*/ g({
|
|
23
|
+
multiple: { type: Boolean },
|
|
24
|
+
accept: {},
|
|
25
|
+
maxSize: {},
|
|
26
|
+
maxFiles: {},
|
|
27
|
+
disabled: { type: Boolean },
|
|
28
|
+
invalid: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: void 0
|
|
31
|
+
},
|
|
32
|
+
id: {},
|
|
33
|
+
label: { default: "Drag and drop a file here" },
|
|
34
|
+
hint: {},
|
|
35
|
+
browseLabel: { default: "Browse files" },
|
|
36
|
+
removeLabel: { default: "Remove" },
|
|
37
|
+
tooLargeText: { default: "is too large" },
|
|
38
|
+
wrongTypeText: { default: "is not an accepted type" },
|
|
39
|
+
tooManyText: { default: "exceeds the file limit" },
|
|
40
|
+
unstyled: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: void 0
|
|
43
|
+
},
|
|
44
|
+
class: {},
|
|
45
|
+
ui: {}
|
|
46
|
+
}, {
|
|
47
|
+
modelValue: { default: () => [] },
|
|
48
|
+
modelModifiers: {}
|
|
49
|
+
}),
|
|
50
|
+
emits: /*@__PURE__*/ g(["reject"], ["update:modelValue"]),
|
|
51
|
+
setup(h, { emit: g }) {
|
|
52
|
+
let j = h, ee = g, M = w(h, "modelValue"), N = o(), P = l(() => j.id ?? N?.id.value), F = l(() => j.invalid ?? N?.invalid.value ?? !1), I = r(), L = l(() => j.unstyled ?? I.unstyled), R = b([]);
|
|
53
|
+
function z(e) {
|
|
54
|
+
if (!j.accept) return !0;
|
|
55
|
+
let t = e.name.toLowerCase(), n = e.type.toLowerCase();
|
|
56
|
+
return j.accept.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean).some((e) => e.startsWith(".") ? t.endsWith(e) : e.endsWith("/*") ? n.startsWith(e.slice(0, -1)) : n === e);
|
|
57
|
+
}
|
|
58
|
+
function B(e) {
|
|
59
|
+
let t = [], n = [], r = j.multiple ? M.value : [];
|
|
60
|
+
for (let i of e) {
|
|
61
|
+
if (!z(i)) {
|
|
62
|
+
n.push({
|
|
63
|
+
file: i,
|
|
64
|
+
reason: "type"
|
|
65
|
+
});
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (j.maxSize != null && i.size > j.maxSize) {
|
|
69
|
+
n.push({
|
|
70
|
+
file: i,
|
|
71
|
+
reason: "size"
|
|
72
|
+
});
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
let e = j.multiple ? j.maxFiles : 1;
|
|
76
|
+
if (e != null && r.length + t.length >= e) {
|
|
77
|
+
n.push({
|
|
78
|
+
file: i,
|
|
79
|
+
reason: "count"
|
|
80
|
+
});
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
t.push(i);
|
|
84
|
+
}
|
|
85
|
+
R.value = n, n.length && ee("reject", n), t.length && (M.value = [...r, ...t]);
|
|
86
|
+
}
|
|
87
|
+
let V = b();
|
|
88
|
+
function H(e) {
|
|
89
|
+
let t = e.target;
|
|
90
|
+
B([...t.files ?? []]), t.value = "";
|
|
91
|
+
}
|
|
92
|
+
function U(e) {
|
|
93
|
+
M.value = M.value.filter((t, n) => n !== e);
|
|
94
|
+
}
|
|
95
|
+
let W = b(0), G = l(() => W.value > 0);
|
|
96
|
+
function K() {
|
|
97
|
+
j.disabled || W.value++;
|
|
98
|
+
}
|
|
99
|
+
function q() {
|
|
100
|
+
W.value > 0 && W.value--;
|
|
101
|
+
}
|
|
102
|
+
function J(e) {
|
|
103
|
+
W.value = 0, !j.disabled && B([...e.dataTransfer?.files ?? []]);
|
|
104
|
+
}
|
|
105
|
+
let Y = b(/* @__PURE__ */ new Map());
|
|
106
|
+
T(M, (e) => {
|
|
107
|
+
for (let [t, n] of Y.value) e.includes(t) || (URL.revokeObjectURL(n), Y.value.delete(t));
|
|
108
|
+
for (let t of e) t.type.startsWith("image/") && !Y.value.has(t) && Y.value.set(t, URL.createObjectURL(t));
|
|
109
|
+
}, {
|
|
110
|
+
immediate: !0,
|
|
111
|
+
deep: !0
|
|
112
|
+
}), v(() => {
|
|
113
|
+
for (let e of Y.value.values()) URL.revokeObjectURL(e);
|
|
114
|
+
});
|
|
115
|
+
function X(e) {
|
|
116
|
+
let t = [
|
|
117
|
+
"B",
|
|
118
|
+
"kB",
|
|
119
|
+
"MB",
|
|
120
|
+
"GB"
|
|
121
|
+
], n = e, r = 0;
|
|
122
|
+
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r++;
|
|
123
|
+
return `${r === 0 ? n : Math.round(n * 10) / 10} ${t[r]}`;
|
|
124
|
+
}
|
|
125
|
+
function Z(e) {
|
|
126
|
+
let t = e.reason === "size" ? j.tooLargeText : e.reason === "type" ? j.wrongTypeText : j.tooManyText;
|
|
127
|
+
return `${e.file.name} ${t}`;
|
|
128
|
+
}
|
|
129
|
+
let Q = l(() => s({
|
|
130
|
+
dragging: G.value,
|
|
131
|
+
invalid: F.value,
|
|
132
|
+
disabled: j.disabled
|
|
133
|
+
}));
|
|
134
|
+
function $(e, t) {
|
|
135
|
+
let n = j.ui?.[e];
|
|
136
|
+
return L.value ? [n, t] : Q.value[e]({ class: [n, t] });
|
|
137
|
+
}
|
|
138
|
+
let te = l(() => L.value ? j.ui?.browse : Q.value.browse({ class: j.ui?.browse }));
|
|
139
|
+
return (r, o) => (y(), d("div", { class: _($("root", j.class)) }, [
|
|
140
|
+
f("label", {
|
|
141
|
+
class: _($("dropzone")),
|
|
142
|
+
onDragenter: D(K, ["prevent"]),
|
|
143
|
+
onDragover: o[0] ||= D(() => {}, ["prevent"]),
|
|
144
|
+
onDragleave: D(q, ["prevent"]),
|
|
145
|
+
onDrop: D(J, ["prevent"])
|
|
146
|
+
}, [
|
|
147
|
+
f("input", {
|
|
148
|
+
id: P.value,
|
|
149
|
+
ref_key: "inputEl",
|
|
150
|
+
ref: V,
|
|
151
|
+
type: "file",
|
|
152
|
+
multiple: j.multiple,
|
|
153
|
+
accept: j.accept,
|
|
154
|
+
disabled: j.disabled,
|
|
155
|
+
"aria-invalid": F.value || void 0,
|
|
156
|
+
"aria-describedby": C(N)?.describedBy.value,
|
|
157
|
+
class: _($("input")),
|
|
158
|
+
onChange: H
|
|
159
|
+
}, null, 42, O),
|
|
160
|
+
f("span", { class: _($("icon")) }, [m(i, { icon: C(n) }, null, 8, ["icon"])], 2),
|
|
161
|
+
f("span", { class: _($("label")) }, S(j.label), 3),
|
|
162
|
+
j.hint ? (y(), d("span", {
|
|
163
|
+
key: 0,
|
|
164
|
+
class: _($("hint"))
|
|
165
|
+
}, S(j.hint), 3)) : u("", !0),
|
|
166
|
+
m(a, {
|
|
167
|
+
as: "span",
|
|
168
|
+
variant: "outline",
|
|
169
|
+
size: "sm",
|
|
170
|
+
class: _(te.value)
|
|
171
|
+
}, {
|
|
172
|
+
default: E(() => [p(S(j.browseLabel), 1)]),
|
|
173
|
+
_: 1
|
|
174
|
+
}, 8, ["class"])
|
|
175
|
+
], 34),
|
|
176
|
+
(y(!0), d(c, null, x(R.value, (e) => (y(), d("p", {
|
|
177
|
+
key: e.file.name,
|
|
178
|
+
class: _($("error"))
|
|
179
|
+
}, S(Z(e)), 3))), 128)),
|
|
180
|
+
M.value.length ? (y(), d("ul", {
|
|
181
|
+
key: 0,
|
|
182
|
+
class: _($("list"))
|
|
183
|
+
}, [(y(!0), d(c, null, x(M.value, (n, r) => (y(), d("li", {
|
|
184
|
+
key: `${n.name}-${r}`,
|
|
185
|
+
class: _($("item"))
|
|
186
|
+
}, [
|
|
187
|
+
Y.value.get(n) ? (y(), d("img", {
|
|
188
|
+
key: 0,
|
|
189
|
+
src: Y.value.get(n),
|
|
190
|
+
alt: "",
|
|
191
|
+
class: _($("thumbnail"))
|
|
192
|
+
}, null, 10, k)) : (y(), d("span", {
|
|
193
|
+
key: 1,
|
|
194
|
+
class: _($("placeholder"))
|
|
195
|
+
}, [m(i, { icon: C(t) }, null, 8, ["icon"])], 2)),
|
|
196
|
+
f("span", { class: _($("details")) }, [f("span", { class: _($("name")) }, S(n.name), 3), f("span", { class: _($("meta")) }, S(X(n.size)), 3)], 2),
|
|
197
|
+
f("button", {
|
|
198
|
+
type: "button",
|
|
199
|
+
"aria-label": `${j.removeLabel} ${n.name}`,
|
|
200
|
+
disabled: j.disabled,
|
|
201
|
+
class: _($("remove")),
|
|
202
|
+
onClick: (e) => U(r)
|
|
203
|
+
}, [m(i, { icon: C(e) }, null, 8, ["icon"])], 10, A)
|
|
204
|
+
], 2))), 128))], 2)) : u("", !0)
|
|
205
|
+
], 2));
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
//#endregion
|
|
209
|
+
export { j as default };
|
package/dist/packages/iryx-ui/src/components/PasswordInput.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -52,12 +52,12 @@ var w = [
|
|
|
52
52
|
if (!e) return 0;
|
|
53
53
|
let t = 0;
|
|
54
54
|
return e.length >= 8 && t++, e.length >= 12 && t++, /[a-z]/.test(e) && /[A-Z]/.test(e) && t++, /\d/.test(e) && t++, /[^\w\s]/.test(e) && t++, Math.max(1, Math.min(t, 4));
|
|
55
|
-
}), j = s(() => m.strength && E.value.length > 0), M = s(() => a({ score: A.value }));
|
|
56
|
-
function
|
|
55
|
+
}), j = s(() => m.strength && E.value.length > 0), M = s(() => a({ score: A.value })), N = s(() => O.value ? m.ui?.input : M.value.input({ class: m.ui?.input }));
|
|
56
|
+
function P(e, t) {
|
|
57
57
|
let n = m.ui?.[e];
|
|
58
58
|
return O.value ? [n, t] : M.value[e]({ class: [n, t] });
|
|
59
59
|
}
|
|
60
|
-
return (n, a) => (_(), l("div", { class: g(
|
|
60
|
+
return (n, a) => (_(), l("div", { class: g(P("root", m.class)) }, [f(i, h({
|
|
61
61
|
id: m.id,
|
|
62
62
|
modelValue: E.value,
|
|
63
63
|
"onUpdate:modelValue": a[1] ||= (e) => E.value = e,
|
|
@@ -68,7 +68,7 @@ var w = [
|
|
|
68
68
|
required: m.required,
|
|
69
69
|
invalid: m.invalid,
|
|
70
70
|
unstyled: m.unstyled,
|
|
71
|
-
ui: { input:
|
|
71
|
+
ui: { input: N.value },
|
|
72
72
|
autocomplete: "current-password"
|
|
73
73
|
}, n.$attrs), d({ _: 2 }, [m.toggle ? {
|
|
74
74
|
name: "trailing",
|
|
@@ -78,7 +78,7 @@ var w = [
|
|
|
78
78
|
"aria-label": k.value ? m.hideLabel : m.showLabel,
|
|
79
79
|
"aria-pressed": k.value,
|
|
80
80
|
disabled: m.disabled,
|
|
81
|
-
class: g(
|
|
81
|
+
class: g(P("toggle")),
|
|
82
82
|
onClick: a[0] ||= (e) => k.value = !k.value
|
|
83
83
|
}, [f(r, { icon: k.value ? x(t) : x(e) }, null, 8, ["icon"])], 10, w)]),
|
|
84
84
|
key: "0"
|
|
@@ -95,16 +95,16 @@ var w = [
|
|
|
95
95
|
"ui"
|
|
96
96
|
]), j.value ? (_(), l("div", {
|
|
97
97
|
key: 0,
|
|
98
|
-
class: g(
|
|
98
|
+
class: g(P("meter"))
|
|
99
99
|
}, [u("div", {
|
|
100
|
-
class: g(
|
|
100
|
+
class: g(P("track")),
|
|
101
101
|
"aria-hidden": "true"
|
|
102
102
|
}, [(_(), l(o, null, y(4, (e) => u("span", {
|
|
103
103
|
key: e,
|
|
104
104
|
"data-filled": e <= A.value ? "" : void 0,
|
|
105
|
-
class: g(
|
|
105
|
+
class: g(P("segment"))
|
|
106
106
|
}, null, 10, T)), 64))], 2), u("span", {
|
|
107
|
-
class: g(
|
|
107
|
+
class: g(P("label")),
|
|
108
108
|
role: "status"
|
|
109
109
|
}, b(m.strengthLabels[A.value - 1]), 3)], 2)) : c("", !0)], 2));
|
|
110
110
|
}
|