@jirawatpyk/aura-react 5.0.1 → 5.1.1
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 +8 -0
- package/dist/aura.bundle.js +464 -154
- package/dist/cjs/index.cjs +464 -154
- package/dist/esm/AppShell.js +10 -2
- package/dist/esm/Avatar.js +4 -3
- package/dist/esm/BottomNav.js +2 -1
- package/dist/esm/Checkbox.js +13 -4
- package/dist/esm/Combobox.js +19 -19
- package/dist/esm/Command.js +1 -0
- package/dist/esm/DataTable.js +46 -14
- package/dist/esm/DatePicker.js +81 -18
- package/dist/esm/DropdownMenu.js +12 -0
- package/dist/esm/FileUpload.js +15 -0
- package/dist/esm/FormErrorSummary.js +19 -4
- package/dist/esm/Icon.js +1 -1
- package/dist/esm/Menu.js +20 -7
- package/dist/esm/NumberField.js +3 -1
- package/dist/esm/Pagination.js +3 -3
- package/dist/esm/Popover.js +11 -1
- package/dist/esm/RadioGroup.js +14 -1
- package/dist/esm/SideNav.js +8 -2
- package/dist/esm/StatusPill.js +1 -0
- package/dist/esm/Switch.js +1 -1
- package/dist/esm/Table.js +3 -2
- package/dist/esm/Tabs.js +11 -7
- package/dist/esm/TextField.js +2 -2
- package/dist/esm/Textarea.js +2 -2
- package/dist/esm/ThemeStyle.js +13 -3
- package/dist/esm/Toaster.js +1 -0
- package/dist/esm/Tooltip.js +54 -29
- package/dist/esm/colorScheme.js +7 -3
- package/dist/esm/colorSchemeScript.js +3 -3
- package/dist/esm/dates.js +6 -3
- package/dist/esm/internal.js +32 -7
- package/dist/esm/locale.js +6 -5
- package/dist/esm/status.js +2 -1
- package/dist/esm/theme.js +3 -1
- package/dist/esm/useModal.js +42 -9
- package/dist/index.d.cts +1508 -0
- package/dist/index.d.ts +13 -6
- package/dist/server/index.cjs +7 -4
- package/dist/server/index.d.cts +176 -0
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +7 -4
- package/dist/styles.css +23 -3
- package/dist/styles.layer.css +23 -3
- package/package.json +19 -8
package/dist/esm/DatePicker.js
CHANGED
|
@@ -38,14 +38,37 @@ function useFormatDate() {
|
|
|
38
38
|
[locale, calendar]
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
|
+
function allowedDate(iso, o) {
|
|
42
|
+
const t = o.min === "today" || o.max === "today" ? o.today && fromISO(o.today) ? o.today : todayIn(o.timeZone) : "";
|
|
43
|
+
const lo = o.min === "today" ? t : o.min, hi = o.max === "today" ? t : o.max;
|
|
44
|
+
if (lo && fromISO(lo) && iso < lo) return false;
|
|
45
|
+
if (hi && fromISO(hi) && iso > hi) return false;
|
|
46
|
+
return !(o.isDateDisabled && o.isDateDisabled(iso));
|
|
47
|
+
}
|
|
41
48
|
const Calendar = React.forwardRef(function Calendar2(props, ref) {
|
|
42
49
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "en", calendar = props.calendar || ctx.calendar || defaultCalendar(locale), tag = localeTag(locale, calendar);
|
|
43
50
|
const weekStart = props.weekStartsOn == null ? locale === "sv" ? 1 : 0 : props.weekStartsOn;
|
|
44
|
-
const
|
|
51
|
+
const given = props.today && fromISO(props.today) ? props.today : null, zone = props.timeZone || ctx.timeZone;
|
|
52
|
+
const todayISO = given || todayIn(zone);
|
|
45
53
|
const today = fromISO(todayISO);
|
|
54
|
+
const mounted = useMounted(), gridKey = given || mounted ? "client" : "server";
|
|
46
55
|
const min = fromISO(props.min === "today" ? todayISO : props.min), max = fromISO(props.max === "today" ? todayISO : props.max);
|
|
47
56
|
const start = fromISO(props.start), end = fromISO(props.end);
|
|
48
|
-
|
|
57
|
+
function disabledAt(d) {
|
|
58
|
+
return !!(min && d < min || max && d > max || props.isDateDisabled && props.isDateDisabled(toISO(d)));
|
|
59
|
+
}
|
|
60
|
+
function select(iso) {
|
|
61
|
+
if (props.onSelect) props.onSelect(iso);
|
|
62
|
+
}
|
|
63
|
+
const focusState = React.useState(function() {
|
|
64
|
+
const d0 = fromISO(props.focus) || start || today;
|
|
65
|
+
if (!disabledAt(d0)) return d0;
|
|
66
|
+
for (let i = 1; i <= 366; i++) {
|
|
67
|
+
if (!disabledAt(addDays(d0, i))) return addDays(d0, i);
|
|
68
|
+
if (!disabledAt(addDays(d0, -i))) return addDays(d0, -i);
|
|
69
|
+
}
|
|
70
|
+
return d0;
|
|
71
|
+
});
|
|
49
72
|
const focusDate = focusState[0], setFocus = focusState[1];
|
|
50
73
|
const viewState = React.useState("days"), view = viewState[0], setView = viewState[1];
|
|
51
74
|
const hoverState = React.useState(null);
|
|
@@ -53,7 +76,7 @@ const Calendar = React.forwardRef(function Calendar2(props, ref) {
|
|
|
53
76
|
const th = locale === "th";
|
|
54
77
|
const dt = dateText(locale);
|
|
55
78
|
function disabled(d) {
|
|
56
|
-
return
|
|
79
|
+
return disabledAt(d);
|
|
57
80
|
}
|
|
58
81
|
React.useEffect(function() {
|
|
59
82
|
if (!moved.current) return;
|
|
@@ -61,11 +84,14 @@ const Calendar = React.forwardRef(function Calendar2(props, ref) {
|
|
|
61
84
|
const el = gridRef.current && gridRef.current.querySelector('[data-date="' + toISO(focusDate) + '"]');
|
|
62
85
|
if (el) el.focus();
|
|
63
86
|
});
|
|
64
|
-
React.useEffect(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
87
|
+
React.useEffect(
|
|
88
|
+
function() {
|
|
89
|
+
if (props.autoFocus === false) return;
|
|
90
|
+
const el = gridRef.current && gridRef.current.querySelector('[tabindex="0"]');
|
|
91
|
+
if (el) el.focus();
|
|
92
|
+
},
|
|
93
|
+
[gridKey]
|
|
94
|
+
);
|
|
69
95
|
function move(d) {
|
|
70
96
|
moved.current = true;
|
|
71
97
|
setFocus(d);
|
|
@@ -90,7 +116,7 @@ const Calendar = React.forwardRef(function Calendar2(props, ref) {
|
|
|
90
116
|
else if (k === "PageDown") n = addMonths(d, e.shiftKey ? 12 : 1);
|
|
91
117
|
else if (k === "Enter" || k === " ") {
|
|
92
118
|
e.preventDefault();
|
|
93
|
-
if (!disabled(d))
|
|
119
|
+
if (!disabled(d)) select(toISO(d));
|
|
94
120
|
return;
|
|
95
121
|
}
|
|
96
122
|
if (n) {
|
|
@@ -113,7 +139,7 @@ const Calendar = React.forwardRef(function Calendar2(props, ref) {
|
|
|
113
139
|
const yr = focusDate.getFullYear(), base = yr - yr % 12;
|
|
114
140
|
const years = [];
|
|
115
141
|
for (let y = base; y < base + 12; y++) years.push(y);
|
|
116
|
-
return /* @__PURE__ */ React.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React.createElement(
|
|
142
|
+
return /* @__PURE__ */ React.createElement("div", { className: "aura-cal", ref: gridMerged, key: gridKey }, /* @__PURE__ */ React.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React.createElement(
|
|
117
143
|
IconButton,
|
|
118
144
|
{
|
|
119
145
|
icon: "chevron-left",
|
|
@@ -160,7 +186,7 @@ const Calendar = React.forwardRef(function Calendar2(props, ref) {
|
|
|
160
186
|
);
|
|
161
187
|
})));
|
|
162
188
|
}
|
|
163
|
-
return /* @__PURE__ */ React.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React.createElement(
|
|
189
|
+
return /* @__PURE__ */ React.createElement("div", { className: "aura-cal", ref: gridMerged, key: gridKey }, /* @__PURE__ */ React.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React.createElement(
|
|
164
190
|
IconButton,
|
|
165
191
|
{
|
|
166
192
|
icon: "chevron-left",
|
|
@@ -222,7 +248,7 @@ const Calendar = React.forwardRef(function Calendar2(props, ref) {
|
|
|
222
248
|
type: "button",
|
|
223
249
|
"data-date": iso,
|
|
224
250
|
tabIndex: same(d, focusDate) ? 0 : -1,
|
|
225
|
-
disabled: dis,
|
|
251
|
+
"aria-disabled": dis || void 0,
|
|
226
252
|
"aria-label": fmt(tag, { weekday: "long", day: "numeric", month: "long", year: "numeric" }, d),
|
|
227
253
|
suppressHydrationWarning: true,
|
|
228
254
|
"aria-current": same(d, today) ? "date" : void 0,
|
|
@@ -235,7 +261,7 @@ const Calendar = React.forwardRef(function Calendar2(props, ref) {
|
|
|
235
261
|
),
|
|
236
262
|
onClick: function() {
|
|
237
263
|
setFocus(d);
|
|
238
|
-
|
|
264
|
+
if (!dis) select(iso);
|
|
239
265
|
},
|
|
240
266
|
onKeyDown: function(e) {
|
|
241
267
|
onKey(e, d);
|
|
@@ -257,7 +283,7 @@ const Calendar = React.forwardRef(function Calendar2(props, ref) {
|
|
|
257
283
|
disabled: disabled(today),
|
|
258
284
|
onClick: function() {
|
|
259
285
|
move(today);
|
|
260
|
-
|
|
286
|
+
select(toISO(today));
|
|
261
287
|
}
|
|
262
288
|
},
|
|
263
289
|
dt.today
|
|
@@ -391,13 +417,30 @@ const DatePicker = React.forwardRef(function DatePicker2(props, ref) {
|
|
|
391
417
|
);
|
|
392
418
|
const boxRef = React.useRef(null), inputRef = React.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
393
419
|
const pop = useCalendarPopover(boxRef);
|
|
420
|
+
const limits = {
|
|
421
|
+
min: props.min,
|
|
422
|
+
max: props.max,
|
|
423
|
+
today: props.today,
|
|
424
|
+
timeZone: props.timeZone || ctx.timeZone,
|
|
425
|
+
isDateDisabled: props.isDateDisabled
|
|
426
|
+
};
|
|
427
|
+
const bad = React.useState(null);
|
|
428
|
+
React.useEffect(
|
|
429
|
+
function() {
|
|
430
|
+
bad[1](null);
|
|
431
|
+
},
|
|
432
|
+
[st[0]]
|
|
433
|
+
);
|
|
394
434
|
function commit(text) {
|
|
435
|
+
bad[1](null);
|
|
395
436
|
if (!text.trim()) {
|
|
396
437
|
st[1](null);
|
|
397
438
|
return;
|
|
398
439
|
}
|
|
399
440
|
const iso = parseDate(text);
|
|
400
|
-
if (iso)
|
|
441
|
+
if (!iso) return;
|
|
442
|
+
if (allowedDate(iso, limits)) st[1](iso);
|
|
443
|
+
else bad[1](dt.dateUnavailable);
|
|
401
444
|
}
|
|
402
445
|
function close() {
|
|
403
446
|
pop.setOpen(false);
|
|
@@ -435,6 +478,7 @@ const DatePicker = React.forwardRef(function DatePicker2(props, ref) {
|
|
|
435
478
|
start: st[0],
|
|
436
479
|
focus: st[0],
|
|
437
480
|
onSelect: function(iso) {
|
|
481
|
+
bad[1](null);
|
|
438
482
|
st[1](iso);
|
|
439
483
|
close();
|
|
440
484
|
}
|
|
@@ -450,7 +494,7 @@ const DatePicker = React.forwardRef(function DatePicker2(props, ref) {
|
|
|
450
494
|
dialogId,
|
|
451
495
|
label: props.label,
|
|
452
496
|
hint: props.hint,
|
|
453
|
-
error: props.error,
|
|
497
|
+
error: bad[0] || props.error,
|
|
454
498
|
required: props.required,
|
|
455
499
|
optional: props.optional,
|
|
456
500
|
disabled: props.disabled,
|
|
@@ -464,6 +508,7 @@ const DatePicker = React.forwardRef(function DatePicker2(props, ref) {
|
|
|
464
508
|
hasValue: st[0] != null,
|
|
465
509
|
clearable: props.clearable,
|
|
466
510
|
onClear: function() {
|
|
511
|
+
bad[1](null);
|
|
467
512
|
st[1](null);
|
|
468
513
|
inputRef.current && inputRef.current.focus();
|
|
469
514
|
},
|
|
@@ -490,20 +535,36 @@ const DateRangePicker = React.forwardRef(
|
|
|
490
535
|
const draft = React.useState(null);
|
|
491
536
|
const boxRef = React.useRef(null), inputRef = React.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
492
537
|
const pop = useCalendarPopover(boxRef);
|
|
538
|
+
const limits = {
|
|
539
|
+
min: props.min,
|
|
540
|
+
max: props.max,
|
|
541
|
+
today: props.today,
|
|
542
|
+
timeZone: props.timeZone || ctx.timeZone,
|
|
543
|
+
isDateDisabled: props.isDateDisabled
|
|
544
|
+
};
|
|
493
545
|
const o = { locale, calendar };
|
|
494
546
|
function show(r) {
|
|
495
547
|
if (!r.start) return "";
|
|
496
548
|
if (!r.end) return formatDateBase(r.start, o) + " \u2013";
|
|
497
549
|
return formatDateBase(r.start, o) + " \u2013 " + formatDateBase(r.end, o);
|
|
498
550
|
}
|
|
551
|
+
const bad = React.useState(null);
|
|
552
|
+
React.useEffect(
|
|
553
|
+
function() {
|
|
554
|
+
bad[1](null);
|
|
555
|
+
},
|
|
556
|
+
[v.start, v.end]
|
|
557
|
+
);
|
|
499
558
|
function commit(text) {
|
|
559
|
+
bad[1](null);
|
|
500
560
|
const parts = String(text).split(/\s[–-]\s|\s*–\s*/);
|
|
501
561
|
if (!text.trim()) {
|
|
502
562
|
st[1]({ start: null, end: null });
|
|
503
563
|
return;
|
|
504
564
|
}
|
|
505
565
|
const a = parseDate(parts[0]), b = parseDate(parts[1] || "");
|
|
506
|
-
if (a && b
|
|
566
|
+
if (a && b && !(allowedDate(a, limits) && allowedDate(b, limits))) bad[1](dt.dateUnavailable);
|
|
567
|
+
else if (a && b) st[1](a <= b ? { start: a, end: b } : { start: b, end: a });
|
|
507
568
|
}
|
|
508
569
|
function close() {
|
|
509
570
|
pop.setOpen(false);
|
|
@@ -516,6 +577,7 @@ const DateRangePicker = React.forwardRef(
|
|
|
516
577
|
return;
|
|
517
578
|
}
|
|
518
579
|
const a = draft[0], b = iso;
|
|
580
|
+
bad[1](null);
|
|
519
581
|
st[1](a <= b ? { start: a, end: b } : { start: b, end: a });
|
|
520
582
|
close();
|
|
521
583
|
}
|
|
@@ -566,7 +628,7 @@ const DateRangePicker = React.forwardRef(
|
|
|
566
628
|
dialogId,
|
|
567
629
|
label: props.label,
|
|
568
630
|
hint: props.hint,
|
|
569
|
-
error: props.error,
|
|
631
|
+
error: bad[0] || props.error,
|
|
570
632
|
required: props.required,
|
|
571
633
|
optional: props.optional,
|
|
572
634
|
disabled: props.disabled,
|
|
@@ -580,6 +642,7 @@ const DateRangePicker = React.forwardRef(
|
|
|
580
642
|
hasValue: v.start != null,
|
|
581
643
|
clearable: props.clearable,
|
|
582
644
|
onClear: function() {
|
|
645
|
+
bad[1](null);
|
|
583
646
|
st[1]({ start: null, end: null });
|
|
584
647
|
inputRef.current && inputRef.current.focus();
|
|
585
648
|
},
|
package/dist/esm/DropdownMenu.js
CHANGED
|
@@ -6,6 +6,16 @@ const DropdownMenu = React.forwardRef(function DropdownMenu2(props, ref) {
|
|
|
6
6
|
const st = React.useState(null), anchor = st[0], setAnchor = st[1];
|
|
7
7
|
const wrap = React.useRef(null), wrapMerged = useMergedRef(ref, wrap);
|
|
8
8
|
const child = React.Children.only(props.trigger);
|
|
9
|
+
const menuRef = React.useRef(null), toLast = React.useRef(false);
|
|
10
|
+
React.useEffect(
|
|
11
|
+
function() {
|
|
12
|
+
if (!anchor || !toLast.current || !menuRef.current) return;
|
|
13
|
+
toLast.current = false;
|
|
14
|
+
const list = menuRef.current.querySelectorAll('[role^="menuitem"]:not([disabled])');
|
|
15
|
+
if (list.length) list[list.length - 1].focus();
|
|
16
|
+
},
|
|
17
|
+
[anchor]
|
|
18
|
+
);
|
|
9
19
|
function toggle(e) {
|
|
10
20
|
if (child.props.onClick) child.props.onClick(e);
|
|
11
21
|
const el = wrap.current && (wrap.current.querySelector('button, [role="button"], a') || wrap.current);
|
|
@@ -14,12 +24,14 @@ const DropdownMenu = React.forwardRef(function DropdownMenu2(props, ref) {
|
|
|
14
24
|
function onKeyDown(e) {
|
|
15
25
|
if ((e.key === "ArrowDown" || e.key === "ArrowUp") && !anchor) {
|
|
16
26
|
e.preventDefault();
|
|
27
|
+
toLast.current = e.key === "ArrowUp";
|
|
17
28
|
setAnchor(wrap.current.querySelector('button, [role="button"], a') || wrap.current);
|
|
18
29
|
}
|
|
19
30
|
}
|
|
20
31
|
return /* @__PURE__ */ React.createElement("span", { ref: wrapMerged, className: "aura-dropdown", onKeyDown }, React.cloneElement(child, { onClick: toggle, "aria-haspopup": "menu", "aria-expanded": anchor ? true : false }), anchor ? /* @__PURE__ */ React.createElement(
|
|
21
32
|
Menu,
|
|
22
33
|
{
|
|
34
|
+
ref: menuRef,
|
|
23
35
|
anchor,
|
|
24
36
|
label: props.label,
|
|
25
37
|
items: props.items,
|
package/dist/esm/FileUpload.js
CHANGED
|
@@ -46,6 +46,21 @@ const FileUpload = React.forwardRef(function FileUpload2(props, ref) {
|
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
48
|
}, []);
|
|
49
|
+
React.useEffect(
|
|
50
|
+
function() {
|
|
51
|
+
const el = inputRef.current;
|
|
52
|
+
if (!el || !props.name || typeof DataTransfer === "undefined") return;
|
|
53
|
+
try {
|
|
54
|
+
const dt = new DataTransfer();
|
|
55
|
+
items.forEach(function(i) {
|
|
56
|
+
if (i.file && !i.error) dt.items.add(i.file);
|
|
57
|
+
});
|
|
58
|
+
el.files = dt.files;
|
|
59
|
+
} catch (e) {
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
[items, props.name]
|
|
63
|
+
);
|
|
49
64
|
function thumb(it) {
|
|
50
65
|
if (!it.file || !/^image\//.test(it.type || "") || typeof URL === "undefined" || !URL.createObjectURL) return null;
|
|
51
66
|
if (!urls.current[it.id]) urls.current[it.id] = URL.createObjectURL(it.file);
|
|
@@ -6,15 +6,30 @@ import { useStrings } from "./locale.js";
|
|
|
6
6
|
function items(errors) {
|
|
7
7
|
if (Array.isArray(errors)) return errors;
|
|
8
8
|
const out = [];
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
function walk(e, path, depth) {
|
|
10
|
+
if (!e || typeof e !== "object" || depth > 8) return;
|
|
11
|
+
const o = e;
|
|
12
|
+
if (o.message) out.push({ field: path, message: o.message });
|
|
13
|
+
for (const k in o) {
|
|
14
|
+
if (k === "ref" || k === "type" || k === "types" || k === "message") continue;
|
|
15
|
+
walk(o[k], path ? path + "." + k : k, depth + 1);
|
|
16
|
+
}
|
|
12
17
|
}
|
|
18
|
+
walk(errors, "", 0);
|
|
13
19
|
return out;
|
|
14
20
|
}
|
|
15
21
|
function fieldElement(field) {
|
|
16
22
|
if (typeof document === "undefined") return null;
|
|
17
|
-
|
|
23
|
+
const byId = document.getElementById(field);
|
|
24
|
+
if (byId) return byId;
|
|
25
|
+
const named = document.querySelector('[name="' + field.replace(/"/g, '\\"') + '"]');
|
|
26
|
+
if (named && named.getAttribute("type") === "hidden") {
|
|
27
|
+
const box = named.closest(".aura-field") || named.parentElement;
|
|
28
|
+
return box && box.querySelector(
|
|
29
|
+
'input:not([type="hidden"]), [role="combobox"], select, textarea, button:not([tabindex="-1"])'
|
|
30
|
+
) || named;
|
|
31
|
+
}
|
|
32
|
+
return named;
|
|
18
33
|
}
|
|
19
34
|
const FormErrorSummary = React.forwardRef(
|
|
20
35
|
function FormErrorSummary2(props, ref) {
|
package/dist/esm/Icon.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { cx } from "./internal.js";
|
|
4
4
|
const h = React.createElement;
|
|
5
|
-
const ICONS = { "check": [["path", { "d": "M20 6 9 17l-5-5" }]], "x": [["path", { "d": "M18 6 6 18" }], ["path", { "d": "m6 6 12 12" }]], "plus": [["path", { "d": "M5 12h14" }], ["path", { "d": "M12 5v14" }]], "minus": [["path", { "d": "M5 12h14" }]], "search": [["path", { "d": "m21 21-4.34-4.34" }], ["circle", { "cx": "11", "cy": "11", "r": "8" }]], "chevron-down": [["path", { "d": "m6 9 6 6 6-6" }]], "chevron-up": [["path", { "d": "m18 15-6-6-6 6" }]], "chevron-left": [["path", { "d": "m15 18-6-6 6-6" }]], "chevron-right": [["path", { "d": "m9 18 6-6-6-6" }]], "arrow-right": [["path", { "d": "M5 12h14" }], ["path", { "d": "m12 5 7 7-7 7" }]], "arrow-up-right": [["path", { "d": "M7 7h10v10" }], ["path", { "d": "M7 17 17 7" }]], "arrow-up-down": [["path", { "d": "m21 16-4 4-4-4" }], ["path", { "d": "M17 20V4" }], ["path", { "d": "m3 8 4-4 4 4" }], ["path", { "d": "M7 4v16" }]], "loader-circle": [["path", { "d": "M21 12a9 9 0 1 1-6.219-8.56" }]], "circle-alert": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["line", { "x1": "12", "x2": "12", "y1": "8", "y2": "12" }], ["line", { "x1": "12", "x2": "12.01", "y1": "16", "y2": "16" }]], "circle-check": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "m16 9-5.5 5.5L8 12" }]], "info": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M12 16v-4" }], ["path", { "d": "M12 8h.01" }]], "triangle-alert": [["path", { "d": "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }], ["path", { "d": "M12 9v4" }], ["path", { "d": "M12 17h.01" }]], "settings": [["path", { "d": "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" }], ["circle", { "cx": "12", "cy": "12", "r": "3" }]], "user": [["path", { "d": "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }], ["circle", { "cx": "12", "cy": "7", "r": "4" }]], "users": [["path", { "d": "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }], ["path", { "d": "M16 3.128a4 4 0 0 1 0 7.744" }], ["path", { "d": "M22 21v-2a4 4 0 0 0-3-3.87" }], ["circle", { "cx": "9", "cy": "7", "r": "4" }]], "filter": [["path", { "d": "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z" }]], "ellipsis": [["circle", { "cx": "12", "cy": "12", "r": "1" }], ["circle", { "cx": "19", "cy": "12", "r": "1" }], ["circle", { "cx": "5", "cy": "12", "r": "1" }]], "external-link": [["path", { "d": "M15 3h6v6" }], ["path", { "d": "M10 14 21 3" }], ["path", { "d": "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }]], "copy": [["rect", { "width": "14", "height": "14", "x": "8", "y": "8", "rx": "2", "ry": "2" }], ["path", { "d": "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" }]], "trash-2": [["path", { "d": "M10 11v6" }], ["path", { "d": "M14 11v6" }], ["path", { "d": "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }], ["path", { "d": "M3 6h18" }], ["path", { "d": "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }]], "pencil": [["path", { "d": "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }], ["path", { "d": "m15 5 4 4" }]], "download": [["path", { "d": "M12 15V3" }], ["path", { "d": "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }], ["path", { "d": "m7 10 5 5 5-5" }]], "upload": [["path", { "d": "M12 3v12" }], ["path", { "d": "m17 8-5-5-5 5" }], ["path", { "d": "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }]], "calendar": [["path", { "d": "M8 2v3" }], ["path", { "d": "M16 2v3" }], ["rect", { "x": "3", "y": "3", "width": "18", "height": "18", "rx": "2" }], ["path", { "d": "M3 9h18" }]], "bell": [["path", { "d": "M10.268 21a2 2 0 0 0 3.464 0" }], ["path", { "d": "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" }]], "menu": [["path", { "d": "M4 5h16" }], ["path", { "d": "M4 12h16" }], ["path", { "d": "M4 19h16" }]], "eye": [["path", { "d": "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" }], ["circle", { "cx": "12", "cy": "12", "r": "3" }]], "log-out": [["path", { "d": "m16 17 5-5-5-5" }], ["path", { "d": "M21 12H9" }], ["path", { "d": "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }]], "circle": [["circle", { "cx": "12", "cy": "12", "r": "10" }]], "circle-dot-dashed": [["path", { "d": "M10.1 2.18a9.93 9.93 0 0 1 3.8 0" }], ["path", { "d": "M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7" }], ["path", { "d": "M21.82 10.1a9.93 9.93 0 0 1 0 3.8" }], ["path", { "d": "M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69" }], ["path", { "d": "M13.9 21.82a9.94 9.94 0 0 1-3.8 0" }], ["path", { "d": "M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7" }], ["path", { "d": "M2.18 13.9a9.93 9.93 0 0 1 0-3.8" }], ["path", { "d": "M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69" }], ["circle", { "cx": "12", "cy": "12", "r": "1" }]], "ban": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M4.929 4.929 19.07 19.071" }]], "arrow-up": [["path", { "d": "m5 12 7-7 7 7" }], ["path", { "d": "M12 19V5" }]], "arrow-down": [["path", { "d": "M12 5v14" }], ["path", { "d": "m19 12-7 7-7-7" }]], "inbox": [["polyline", { "points": "22 12 16 12 14 15 10 15 8 12 2 12" }], ["path", { "d": "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" }]], "pin": [["path", { "d": "M12 17v5" }], ["path", { "d": "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" }]], "pin-off": [["path", { "d": "M12 17v5" }], ["path", { "d": "M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89" }], ["path", { "d": "m2 2 20 20" }], ["path", { "d": "M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11" }]], "eye-off": [["path", { "d": "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" }], ["path", { "d": "M14.084 14.158a3 3 0 0 1-4.242-4.242" }], ["path", { "d": "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" }], ["path", { "d": "m2 2 20 20" }]], "columns-3": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2" }], ["path", { "d": "M9 3v18" }], ["path", { "d": "M15 3v18" }]], "arrow-left": [["path", { "d": "m12 19-7-7 7-7" }], ["path", { "d": "M19 12H5" }]], "rotate-ccw": [["path", { "d": "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }], ["path", { "d": "M3 3v5h5" }]], "house": [["path", { "d": "M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8" }], ["path", { "d": "M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }]], "layout-dashboard": [["rect", { "width": "7", "height": "9", "x": "3", "y": "3", "rx": "1" }], ["rect", { "width": "7", "height": "5", "x": "14", "y": "3", "rx": "1" }], ["rect", { "width": "7", "height": "9", "x": "14", "y": "12", "rx": "1" }], ["rect", { "width": "7", "height": "5", "x": "3", "y": "16", "rx": "1" }]], "folder": [["path", { "d": "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }]], "chart-column": [["path", { "d": "M3 3v16a2 2 0 0 0 2 2h16" }], ["path", { "d": "M18 17V9" }], ["path", { "d": "M13 17V5" }], ["path", { "d": "M8 17v-3" }]], "file-text": [["path", { "d": "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" }], ["path", { "d": "M14 2v5a1 1 0 0 0 1 1h5" }], ["path", { "d": "M10 9H8" }], ["path", { "d": "M16 13H8" }], ["path", { "d": "M16 17H8" }]], "mail": [["path", { "d": "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7" }], ["rect", { "x": "2", "y": "4", "width": "20", "height": "16", "rx": "2" }]], "lock": [["rect", { "width": "18", "height": "11", "x": "3", "y": "11", "rx": "2", "ry": "2" }], ["path", { "d": "M7 11V7a5 5 0 0 1 10 0v4" }]], "clock": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M12 6v6l4 2" }]], "trending-up": [["path", { "d": "M16 7h6v6" }], ["path", { "d": "m22 7-8.5 8.5-5-5L2 17" }]], "trending-down": [["path", { "d": "M16 17h6v-6" }], ["path", { "d": "m22 17-8.5-8.5-5 5L2 7" }]], "image": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2", "ry": "2" }], ["circle", { "cx": "9", "cy": "9", "r": "2" }], ["path", { "d": "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" }]], "paperclip": [["path", { "d": "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551" }]], "cloud-upload": [["path", { "d": "M12 13v8" }], ["path", { "d": "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }], ["path", { "d": "m8 17 4-4 4 4" }]], "file": [["path", { "d": "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" }], ["path", { "d": "M14 2v5a1 1 0 0 0 1 1h5" }]], "sun": [["circle", { "cx": "12", "cy": "12", "r": "4" }], ["path", { "d": "M12 2v2" }], ["path", { "d": "M12 20v2" }], ["path", { "d": "m4.93 4.93 1.41 1.41" }], ["path", { "d": "m17.66 17.66 1.41 1.41" }], ["path", { "d": "M2 12h2" }], ["path", { "d": "M20 12h2" }], ["path", { "d": "m6.34 17.66-1.41 1.41" }], ["path", { "d": "m19.07 4.93-1.41 1.41" }]], "moon": [["path", { "d": "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401" }]], "monitor": [["rect", { "width": "20", "height": "14", "x": "2", "y": "3", "rx": "2" }], ["line", { "x1": "8", "x2": "16", "y1": "21", "y2": "21" }], ["line", { "x1": "12", "x2": "12", "y1": "17", "y2": "21" }]], "panel-left-close": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2" }], ["path", { "d": "M9 3v18" }], ["path", { "d": "m16 15-3-3 3-3" }]], "panel-left-open": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2" }], ["path", { "d": "M9 3v18" }], ["path", { "d": "m14 9 3 3-3 3" }]] };
|
|
5
|
+
const ICONS = { "check": [["path", { "d": "M20 6 9 17l-5-5" }]], "x": [["path", { "d": "M18 6 6 18" }], ["path", { "d": "m6 6 12 12" }]], "plus": [["path", { "d": "M5 12h14" }], ["path", { "d": "M12 5v14" }]], "minus": [["path", { "d": "M5 12h14" }]], "search": [["path", { "d": "m21 21-4.34-4.34" }], ["circle", { "cx": "11", "cy": "11", "r": "8" }]], "chevron-down": [["path", { "d": "m6 9 6 6 6-6" }]], "chevron-up": [["path", { "d": "m18 15-6-6-6 6" }]], "chevron-left": [["path", { "d": "m15 18-6-6 6-6" }]], "chevron-right": [["path", { "d": "m9 18 6-6-6-6" }]], "arrow-right": [["path", { "d": "M5 12h14" }], ["path", { "d": "m12 5 7 7-7 7" }]], "arrow-up-right": [["path", { "d": "M7 7h10v10" }], ["path", { "d": "M7 17 17 7" }]], "arrow-up-down": [["path", { "d": "m21 16-4 4-4-4" }], ["path", { "d": "M17 20V4" }], ["path", { "d": "m3 8 4-4 4 4" }], ["path", { "d": "M7 4v16" }]], "loader-circle": [["path", { "d": "M21 12a9 9 0 1 1-6.219-8.56" }]], "circle-alert": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["line", { "x1": "12", "x2": "12", "y1": "8", "y2": "12" }], ["line", { "x1": "12", "x2": "12.01", "y1": "16", "y2": "16" }]], "circle-check": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "m16 9-5.5 5.5L8 12" }]], "info": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M12 16v-4" }], ["path", { "d": "M12 8h.01" }]], "triangle-alert": [["path", { "d": "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }], ["path", { "d": "M12 9v4" }], ["path", { "d": "M12 17h.01" }]], "settings": [["path", { "d": "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" }], ["circle", { "cx": "12", "cy": "12", "r": "3" }]], "user": [["path", { "d": "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }], ["circle", { "cx": "12", "cy": "7", "r": "4" }]], "users": [["path", { "d": "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }], ["path", { "d": "M16 3.128a4 4 0 0 1 0 7.744" }], ["path", { "d": "M22 21v-2a4 4 0 0 0-3-3.87" }], ["circle", { "cx": "9", "cy": "7", "r": "4" }]], "filter": [["path", { "d": "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z" }]], "ellipsis": [["circle", { "cx": "12", "cy": "12", "r": "1" }], ["circle", { "cx": "19", "cy": "12", "r": "1" }], ["circle", { "cx": "5", "cy": "12", "r": "1" }]], "external-link": [["path", { "d": "M15 3h6v6" }], ["path", { "d": "M10 14 21 3" }], ["path", { "d": "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }]], "copy": [["rect", { "width": "14", "height": "14", "x": "8", "y": "8", "rx": "2", "ry": "2" }], ["path", { "d": "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" }]], "trash-2": [["path", { "d": "M10 11v6" }], ["path", { "d": "M14 11v6" }], ["path", { "d": "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }], ["path", { "d": "M3 6h18" }], ["path", { "d": "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }]], "pencil": [["path", { "d": "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }], ["path", { "d": "m15 5 4 4" }]], "download": [["path", { "d": "M12 15V3" }], ["path", { "d": "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }], ["path", { "d": "m7 10 5 5 5-5" }]], "upload": [["path", { "d": "M12 3v12" }], ["path", { "d": "m17 8-5-5-5 5" }], ["path", { "d": "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }]], "calendar": [["path", { "d": "M8 2v3" }], ["path", { "d": "M16 2v3" }], ["rect", { "x": "3", "y": "3", "width": "18", "height": "18", "rx": "2" }], ["path", { "d": "M3 9h18" }]], "bell": [["path", { "d": "M10.268 21a2 2 0 0 0 3.464 0" }], ["path", { "d": "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" }]], "menu": [["path", { "d": "M4 5h16" }], ["path", { "d": "M4 12h16" }], ["path", { "d": "M4 19h16" }]], "eye": [["path", { "d": "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" }], ["circle", { "cx": "12", "cy": "12", "r": "3" }]], "log-out": [["path", { "d": "m16 17 5-5-5-5" }], ["path", { "d": "M21 12H9" }], ["path", { "d": "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }]], "circle": [["circle", { "cx": "12", "cy": "12", "r": "10" }]], "circle-dot-dashed": [["path", { "d": "M10.1 2.18a9.93 9.93 0 0 1 3.8 0" }], ["path", { "d": "M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7" }], ["path", { "d": "M21.82 10.1a9.93 9.93 0 0 1 0 3.8" }], ["path", { "d": "M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69" }], ["path", { "d": "M13.9 21.82a9.94 9.94 0 0 1-3.8 0" }], ["path", { "d": "M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7" }], ["path", { "d": "M2.18 13.9a9.93 9.93 0 0 1 0-3.8" }], ["path", { "d": "M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69" }], ["circle", { "cx": "12", "cy": "12", "r": "1" }]], "ban": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M4.929 4.929 19.07 19.071" }]], "arrow-up": [["path", { "d": "m5 12 7-7 7 7" }], ["path", { "d": "M12 19V5" }]], "arrow-down": [["path", { "d": "M12 5v14" }], ["path", { "d": "m19 12-7 7-7-7" }]], "inbox": [["polyline", { "points": "22 12 16 12 14 15 10 15 8 12 2 12" }], ["path", { "d": "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" }]], "pin": [["path", { "d": "M12 17v5" }], ["path", { "d": "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" }]], "pin-off": [["path", { "d": "M12 17v5" }], ["path", { "d": "M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89" }], ["path", { "d": "m2 2 20 20" }], ["path", { "d": "M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11" }]], "eye-off": [["path", { "d": "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" }], ["path", { "d": "M14.084 14.158a3 3 0 0 1-4.242-4.242" }], ["path", { "d": "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" }], ["path", { "d": "m2 2 20 20" }]], "columns-3": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2" }], ["path", { "d": "M9 3v18" }], ["path", { "d": "M15 3v18" }]], "arrow-left": [["path", { "d": "m12 19-7-7 7-7" }], ["path", { "d": "M19 12H5" }]], "rotate-ccw": [["path", { "d": "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }], ["path", { "d": "M3 3v5h5" }]], "house": [["path", { "d": "M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8" }], ["path", { "d": "M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }]], "layout-dashboard": [["rect", { "width": "7", "height": "9", "x": "3", "y": "3", "rx": "1" }], ["rect", { "width": "7", "height": "5", "x": "14", "y": "3", "rx": "1" }], ["rect", { "width": "7", "height": "9", "x": "14", "y": "12", "rx": "1" }], ["rect", { "width": "7", "height": "5", "x": "3", "y": "16", "rx": "1" }]], "folder": [["path", { "d": "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }]], "chart-column": [["path", { "d": "M3 3v16a2 2 0 0 0 2 2h16" }], ["path", { "d": "M18 17V9" }], ["path", { "d": "M13 17V5" }], ["path", { "d": "M8 17v-3" }]], "file-text": [["path", { "d": "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" }], ["path", { "d": "M14 2v5a1 1 0 0 0 1 1h5" }], ["path", { "d": "M10 9H8" }], ["path", { "d": "M16 13H8" }], ["path", { "d": "M16 17H8" }]], "mail": [["path", { "d": "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7" }], ["rect", { "x": "2", "y": "4", "width": "20", "height": "16", "rx": "2" }]], "lock": [["rect", { "width": "18", "height": "11", "x": "3", "y": "11", "rx": "2", "ry": "2" }], ["path", { "d": "M7 11V7a5 5 0 0 1 10 0v4" }]], "clock": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M12 6v6l4 2" }]], "trending-up": [["path", { "d": "M16 7h6v6" }], ["path", { "d": "m22 7-8.5 8.5-5-5L2 17" }]], "trending-down": [["path", { "d": "M16 17h6v-6" }], ["path", { "d": "m22 17-8.5-8.5-5 5L2 7" }]], "image": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2", "ry": "2" }], ["circle", { "cx": "9", "cy": "9", "r": "2" }], ["path", { "d": "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" }]], "paperclip": [["path", { "d": "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551" }]], "cloud-upload": [["path", { "d": "M12 13v8" }], ["path", { "d": "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }], ["path", { "d": "m8 17 4-4 4 4" }]], "file": [["path", { "d": "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" }], ["path", { "d": "M14 2v5a1 1 0 0 0 1 1h5" }]], "sun": [["circle", { "cx": "12", "cy": "12", "r": "4" }], ["path", { "d": "M12 2v2" }], ["path", { "d": "M12 20v2" }], ["path", { "d": "m4.93 4.93 1.41 1.41" }], ["path", { "d": "m17.66 17.66 1.41 1.41" }], ["path", { "d": "M2 12h2" }], ["path", { "d": "M20 12h2" }], ["path", { "d": "m6.34 17.66-1.41 1.41" }], ["path", { "d": "m19.07 4.93-1.41 1.41" }]], "moon": [["path", { "d": "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401" }]], "monitor": [["rect", { "width": "20", "height": "14", "x": "2", "y": "3", "rx": "2" }], ["line", { "x1": "8", "x2": "16", "y1": "21", "y2": "21" }], ["line", { "x1": "12", "x2": "12", "y1": "17", "y2": "21" }]], "panel-left-close": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2" }], ["path", { "d": "M9 3v18" }], ["path", { "d": "m16 15-3-3 3-3" }]], "panel-left-open": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2" }], ["path", { "d": "M9 3v18" }], ["path", { "d": "m14 9 3 3-3 3" }]], "server": [["rect", { "width": "20", "height": "8", "x": "2", "y": "2", "rx": "2", "ry": "2" }], ["rect", { "width": "20", "height": "8", "x": "2", "y": "14", "rx": "2", "ry": "2" }], ["line", { "x1": "6", "x2": "6.01", "y1": "6", "y2": "6" }], ["line", { "x1": "6", "x2": "6.01", "y1": "18", "y2": "18" }]], "globe": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" }], ["path", { "d": "M2 12h20" }]], "activity": [["path", { "d": "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2" }]], "shield-alert": [["path", { "d": "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" }], ["path", { "d": "M12 8v4" }], ["path", { "d": "M12 16h.01" }]], "phone": [["path", { "d": "M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384" }]], "wrench": [["path", { "d": "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z" }]] };
|
|
6
6
|
const SIZES = { sm: 16, md: 20, lg: 24 };
|
|
7
7
|
const Icon = React.forwardRef(function Icon2(props, ref) {
|
|
8
8
|
const size = SIZES[props.size] || props.size || 16;
|
package/dist/esm/Menu.js
CHANGED
|
@@ -15,11 +15,17 @@ const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
|
15
15
|
function() {
|
|
16
16
|
const a = props.anchor, m = own.current;
|
|
17
17
|
if (!a || !m) return;
|
|
18
|
-
const r = a.getBoundingClientRect(), mh = m.
|
|
19
|
-
let top = r.bottom + 4;
|
|
20
|
-
if (
|
|
18
|
+
const r = a.getBoundingClientRect(), mh = m.scrollHeight, mw = m.offsetWidth, below = window.innerHeight - r.bottom - 12, above = r.top - 12;
|
|
19
|
+
let top = r.bottom + 4, maxHeight;
|
|
20
|
+
if (mh > below) {
|
|
21
|
+
if (mh <= above) top = r.top - mh - 4;
|
|
22
|
+
else if (above > below) {
|
|
23
|
+
maxHeight = above;
|
|
24
|
+
top = r.top - above - 4;
|
|
25
|
+
} else maxHeight = below;
|
|
26
|
+
}
|
|
21
27
|
const left = Math.max(8, Math.min(r.right - mw, window.innerWidth - mw - 8));
|
|
22
|
-
setPos({ top, left });
|
|
28
|
+
setPos({ top, left, maxHeight });
|
|
23
29
|
},
|
|
24
30
|
[props.anchor, mounted]
|
|
25
31
|
);
|
|
@@ -63,6 +69,9 @@ const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
|
63
69
|
} else if (e.key === "End") {
|
|
64
70
|
e.preventDefault();
|
|
65
71
|
list[list.length - 1].focus();
|
|
72
|
+
} else if (e.key === " " && document.activeElement && document.activeElement.tagName === "A") {
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
document.activeElement.click();
|
|
66
75
|
} else if (e.key === "Escape") {
|
|
67
76
|
e.preventDefault();
|
|
68
77
|
props.onClose(true);
|
|
@@ -103,9 +112,9 @@ const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
|
103
112
|
tabIndex: -1,
|
|
104
113
|
role: "menuitem",
|
|
105
114
|
className: cls,
|
|
106
|
-
onClick: function() {
|
|
115
|
+
onClick: function(e) {
|
|
107
116
|
if (it.onSelect) it.onSelect();
|
|
108
|
-
props.onClose(
|
|
117
|
+
props.onClose(e.detail === 0);
|
|
109
118
|
}
|
|
110
119
|
},
|
|
111
120
|
body
|
|
@@ -136,7 +145,11 @@ const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
|
136
145
|
"aria-label": props.label,
|
|
137
146
|
className: "aura-menu",
|
|
138
147
|
onKeyDown,
|
|
139
|
-
style: {
|
|
148
|
+
style: {
|
|
149
|
+
top: pos ? pos.top : -9999,
|
|
150
|
+
left: pos ? pos.left : -9999,
|
|
151
|
+
maxHeight: pos && pos.maxHeight ? pos.maxHeight : void 0
|
|
152
|
+
}
|
|
140
153
|
},
|
|
141
154
|
groupItems(items).map(function(block, bi) {
|
|
142
155
|
const rendered = block.items.map(function(x) {
|
package/dist/esm/NumberField.js
CHANGED
|
@@ -10,7 +10,9 @@ function decimalsOf(n) {
|
|
|
10
10
|
return i < 0 ? 0 : s.length - i - 1;
|
|
11
11
|
}
|
|
12
12
|
function parse(text) {
|
|
13
|
-
|
|
13
|
+
let t = text.trim();
|
|
14
|
+
if (t.indexOf(".") < 0 && /^-?\d+,\d+$/.test(t.replace(/[\s ]/g, "")) && !/,\d{3}$/.test(t)) t = t.replace(",", ".");
|
|
15
|
+
const s = t.replace(/[,\s ]/g, "");
|
|
14
16
|
if (!/^-?(\d+\.?\d*|\.\d+)$/.test(s)) return NaN;
|
|
15
17
|
return Number(s);
|
|
16
18
|
}
|
package/dist/esm/Pagination.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Icon } from "./Icon.js";
|
|
4
4
|
import { IconButton } from "./IconButton.js";
|
|
5
|
-
import { cx, useMaybeControlled } from "./internal.js";
|
|
5
|
+
import { cx, plainClick, useMaybeControlled } from "./internal.js";
|
|
6
6
|
import { useLinkComponent, useStrings } from "./locale.js";
|
|
7
7
|
function pageList(page, count, sib) {
|
|
8
8
|
let out = [], lo = Math.max(2, page - sib), hi = Math.min(count - 1, page + sib);
|
|
@@ -47,7 +47,7 @@ const Pagination = React.forwardRef(function Pagination2(props, ref) {
|
|
|
47
47
|
{
|
|
48
48
|
href: link(p),
|
|
49
49
|
onClick: function(e) {
|
|
50
|
-
if (props.onChange) {
|
|
50
|
+
if (props.onChange && plainClick(e)) {
|
|
51
51
|
e.preventDefault();
|
|
52
52
|
go(p);
|
|
53
53
|
}
|
|
@@ -89,7 +89,7 @@ const Pagination = React.forwardRef(function Pagination2(props, ref) {
|
|
|
89
89
|
"aria-label": label,
|
|
90
90
|
title: label,
|
|
91
91
|
onClick: function(e) {
|
|
92
|
-
if (props.onChange) {
|
|
92
|
+
if (props.onChange && plainClick(e)) {
|
|
93
93
|
e.preventDefault();
|
|
94
94
|
go(p);
|
|
95
95
|
}
|
package/dist/esm/Popover.js
CHANGED
|
@@ -30,6 +30,7 @@ const Popover = React.forwardRef(function Popover2(props, ref) {
|
|
|
30
30
|
const open = !!st[0];
|
|
31
31
|
const wrap = React.useRef(null), pop = React.useRef(null), popMerged = useMergedRef(ref, pop);
|
|
32
32
|
const pos = React.useState(null), mounted = useMounted();
|
|
33
|
+
const inTree = React.useRef(false);
|
|
33
34
|
function trigger() {
|
|
34
35
|
return wrap.current && (wrap.current.querySelector('button, [role="button"], a, input') || wrap.current.firstElementChild);
|
|
35
36
|
}
|
|
@@ -63,13 +64,19 @@ const Popover = React.forwardRef(function Popover2(props, ref) {
|
|
|
63
64
|
const f = pop.current.querySelector("[data-autofocus]") || pop.current.querySelector(FOCUSABLE);
|
|
64
65
|
(f || pop.current).focus();
|
|
65
66
|
}
|
|
67
|
+
let timer;
|
|
66
68
|
function outside(e) {
|
|
67
69
|
if (pop.current && pop.current.contains(e.target)) return;
|
|
68
70
|
if (wrap.current && wrap.current.contains(e.target)) return;
|
|
69
|
-
|
|
71
|
+
inTree.current = false;
|
|
72
|
+
clearTimeout(timer);
|
|
73
|
+
timer = setTimeout(function() {
|
|
74
|
+
if (!inTree.current) close(false);
|
|
75
|
+
}, 0);
|
|
70
76
|
}
|
|
71
77
|
document.addEventListener("pointerdown", outside, true);
|
|
72
78
|
return function() {
|
|
79
|
+
clearTimeout(timer);
|
|
73
80
|
document.removeEventListener("pointerdown", outside, true);
|
|
74
81
|
};
|
|
75
82
|
},
|
|
@@ -88,6 +95,9 @@ const Popover = React.forwardRef(function Popover2(props, ref) {
|
|
|
88
95
|
"aria-label": props.title ? void 0 : props.label,
|
|
89
96
|
"aria-labelledby": props.title ? id + "-title" : void 0,
|
|
90
97
|
tabIndex: -1,
|
|
98
|
+
onPointerDownCapture: function() {
|
|
99
|
+
inTree.current = true;
|
|
100
|
+
},
|
|
91
101
|
className: cx("aura-popover", pos[0] && "is-" + pos[0].side, props.className),
|
|
92
102
|
style: Object.assign(
|
|
93
103
|
{ top: pos[0] ? pos[0].top : -9999, left: pos[0] ? pos[0].left : -9999 },
|
package/dist/esm/RadioGroup.js
CHANGED
|
@@ -11,10 +11,22 @@ const RadioGroup = React.forwardRef(function RadioGroup2(props, ref) {
|
|
|
11
11
|
props.onChange
|
|
12
12
|
);
|
|
13
13
|
const name = props.name || id;
|
|
14
|
+
const setRef = React.useCallback(
|
|
15
|
+
function(el) {
|
|
16
|
+
if (el)
|
|
17
|
+
el.focus = function(opts) {
|
|
18
|
+
const r = el.querySelector('input[type="radio"]:checked') || el.querySelector('input[type="radio"]:not(:disabled)');
|
|
19
|
+
if (r) r.focus(opts);
|
|
20
|
+
};
|
|
21
|
+
if (typeof ref === "function") ref(el);
|
|
22
|
+
else if (ref) ref.current = el;
|
|
23
|
+
},
|
|
24
|
+
[ref]
|
|
25
|
+
);
|
|
14
26
|
return /* @__PURE__ */ React.createElement(
|
|
15
27
|
"fieldset",
|
|
16
28
|
{
|
|
17
|
-
ref,
|
|
29
|
+
ref: setRef,
|
|
18
30
|
className: cx("aura-field aura-radio-group", props.error && "is-invalid", props.className),
|
|
19
31
|
"aria-describedby": describedBy(id, props),
|
|
20
32
|
"aria-invalid": props.error ? true : void 0,
|
|
@@ -31,6 +43,7 @@ const RadioGroup = React.forwardRef(function RadioGroup2(props, ref) {
|
|
|
31
43
|
name,
|
|
32
44
|
value: v.value,
|
|
33
45
|
disabled: v.disabled,
|
|
46
|
+
required: props.required || void 0,
|
|
34
47
|
checked: st[0] === v.value,
|
|
35
48
|
onChange: function() {
|
|
36
49
|
st[1](v.value);
|
package/dist/esm/SideNav.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import { Icon } from "./Icon.js";
|
|
5
5
|
import { IconButton } from "./IconButton.js";
|
|
6
|
-
import { cx, uid, useMaybeControlled } from "./internal.js";
|
|
6
|
+
import { cx, plainClick, uid, useMaybeControlled } from "./internal.js";
|
|
7
7
|
import { useLinkComponent, useStrings } from "./locale.js";
|
|
8
8
|
function contains(it, id) {
|
|
9
9
|
return !!id && !!it.children && it.children.some(function(c) {
|
|
@@ -154,6 +154,7 @@ const SideNav = React.forwardRef(function SideNav2(props, ref) {
|
|
|
154
154
|
style: depth ? { ["--aura-nav-depth"]: depth } : void 0,
|
|
155
155
|
onClick: function(e) {
|
|
156
156
|
if (!it.href) e.preventDefault();
|
|
157
|
+
else if (!plainClick(e)) return;
|
|
157
158
|
st[1](it.id);
|
|
158
159
|
}
|
|
159
160
|
};
|
|
@@ -167,7 +168,12 @@ const SideNav = React.forwardRef(function SideNav2(props, ref) {
|
|
|
167
168
|
if (typeof ref === "function") ref(el);
|
|
168
169
|
else if (ref) ref.current = el;
|
|
169
170
|
},
|
|
170
|
-
className: cx(
|
|
171
|
+
className: cx(
|
|
172
|
+
"aura-nav",
|
|
173
|
+
collapsed && "aura-nav--collapsed",
|
|
174
|
+
props.bordered === false && "aura-nav--borderless",
|
|
175
|
+
props.className
|
|
176
|
+
),
|
|
171
177
|
"data-collapsed": collapsed ? "" : void 0,
|
|
172
178
|
"aria-label": props.label || t.mainNav,
|
|
173
179
|
onKeyDown
|
package/dist/esm/StatusPill.js
CHANGED
package/dist/esm/Switch.js
CHANGED
|
@@ -34,7 +34,7 @@ const Switch = React.forwardRef(function Switch2(props, ref) {
|
|
|
34
34
|
},
|
|
35
35
|
/* @__PURE__ */ React.createElement("span", { className: "aura-switch__thumb" })
|
|
36
36
|
),
|
|
37
|
-
props.label ? /* @__PURE__ */ React.createElement("span", { className: "aura-choice__text" }, /* @__PURE__ */ React.createElement("label", { className: "aura-choice__label", id: id + "-label", htmlFor: id }, props.label), props.description ? /* @__PURE__ */ React.createElement("span", { className: "aura-choice__desc", id: id + "-desc" }, props.description) : null) : null
|
|
37
|
+
props.label ? /* @__PURE__ */ React.createElement("span", { className: "aura-choice__text" }, /* @__PURE__ */ React.createElement("label", { className: "aura-choice__label", id: id + "-label", htmlFor: id }, props.label), props.description ? /* @__PURE__ */ React.createElement("span", { className: "aura-choice__desc", id: id + "-desc" }, props.description) : null) : props.description ? /* @__PURE__ */ React.createElement("span", { className: "aura-sr-only", id: id + "-desc" }, props.description) : null
|
|
38
38
|
);
|
|
39
39
|
});
|
|
40
40
|
export {
|