@jirawatpyk/aura-react 4.16.0 → 4.17.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 +66 -3
- package/dist/aura.bundle.js +198 -124
- package/dist/cjs/index.cjs +198 -124
- package/dist/esm/Breadcrumb.js +1 -1
- package/dist/esm/Command.js +69 -49
- package/dist/esm/DataTable.js +27 -11
- package/dist/esm/DatePicker.js +17 -146
- package/dist/esm/FileUpload.js +1 -10
- package/dist/esm/Pagination.js +35 -23
- package/dist/esm/Stat.js +1 -1
- package/dist/esm/StatusPill.js +4 -13
- package/dist/esm/TimePicker.js +1 -12
- package/dist/esm/breakpoints.js +5 -0
- package/dist/esm/colorScheme.js +1 -11
- package/dist/esm/colorSchemeScript.js +19 -0
- package/dist/esm/dates.js +164 -0
- package/dist/esm/locale.js +1 -347
- package/dist/esm/responsive.js +1 -1
- package/dist/esm/status.js +17 -0
- package/dist/esm/strings.js +351 -0
- package/dist/esm/text.js +30 -0
- package/dist/index.d.ts +33 -7
- package/dist/server/index.cjs +791 -0
- package/dist/server/index.d.ts +171 -0
- package/dist/server/index.js +768 -0
- package/dist/styles.css +18 -3
- package/dist/styles.layer.css +1352 -0
- package/package.json +8 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -249,6 +249,8 @@ var React4 = __toESM(require("react"), 1);
|
|
|
249
249
|
|
|
250
250
|
// src/locale.tsx
|
|
251
251
|
var React3 = __toESM(require("react"), 1);
|
|
252
|
+
|
|
253
|
+
// src/strings.ts
|
|
252
254
|
var n = function(x) {
|
|
253
255
|
return Number(x).toLocaleString("en");
|
|
254
256
|
};
|
|
@@ -596,6 +598,8 @@ var STRINGS = {
|
|
|
596
598
|
}
|
|
597
599
|
}
|
|
598
600
|
};
|
|
601
|
+
|
|
602
|
+
// src/locale.tsx
|
|
599
603
|
var LocaleContext = React3.createContext(null);
|
|
600
604
|
function AuraProvider(props) {
|
|
601
605
|
const outer = React3.useContext(LocaleContext);
|
|
@@ -928,12 +932,8 @@ var Checkbox = React8.forwardRef(function Checkbox2(props, ref) {
|
|
|
928
932
|
|
|
929
933
|
// src/StatusPill.tsx
|
|
930
934
|
var React9 = __toESM(require("react"), 1);
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
progress: "circle-dot-dashed",
|
|
934
|
-
ready: "circle-check",
|
|
935
|
-
blocked: "ban"
|
|
936
|
-
};
|
|
935
|
+
|
|
936
|
+
// src/status.ts
|
|
937
937
|
var TONE_WORDS = {
|
|
938
938
|
ready: ["ready", "done", "complete", "completed", "approved", "live", "passed"],
|
|
939
939
|
progress: ["in progress", "in review", "review", "syncing", "running", "pending"],
|
|
@@ -945,6 +945,14 @@ function toneFor(status) {
|
|
|
945
945
|
return "neutral";
|
|
946
946
|
}
|
|
947
947
|
var TONE_ORDER = { neutral: 0, progress: 1, ready: 2, blocked: 3 };
|
|
948
|
+
|
|
949
|
+
// src/StatusPill.tsx
|
|
950
|
+
var TONE_ICON = {
|
|
951
|
+
neutral: "circle",
|
|
952
|
+
progress: "circle-dot-dashed",
|
|
953
|
+
ready: "circle-check",
|
|
954
|
+
blocked: "ban"
|
|
955
|
+
};
|
|
948
956
|
var StatusPill = React9.forwardRef(function StatusPill2(props, ref) {
|
|
949
957
|
const tone2 = props.tone || toneFor(props.children);
|
|
950
958
|
return /* @__PURE__ */ React9.createElement("span", { ref, className: cx("aura-pill", "aura-pill--" + tone2, props.className) }, /* @__PURE__ */ React9.createElement(Icon, { name: TONE_ICON[tone2] || "circle", size: 12 }), props.children);
|
|
@@ -1526,6 +1534,8 @@ var Combobox = React16.forwardRef(
|
|
|
1526
1534
|
// src/DatePicker.tsx
|
|
1527
1535
|
var React17 = __toESM(require("react"), 1);
|
|
1528
1536
|
var import_react_dom3 = require("react-dom");
|
|
1537
|
+
|
|
1538
|
+
// src/dates.ts
|
|
1529
1539
|
var ERA = /^พ\.ศ\.\s?|\s?(BE|พ\.ศ\.)$/g;
|
|
1530
1540
|
var pad = function(n2) {
|
|
1531
1541
|
return (n2 < 10 ? "0" : "") + n2;
|
|
@@ -1631,22 +1641,6 @@ function formatDate(iso, opts) {
|
|
|
1631
1641
|
const loc = o.locale || "th";
|
|
1632
1642
|
return fmt(localeTag(loc, o.calendar || defaultCalendar(loc)), f, d).replace(ERA, "");
|
|
1633
1643
|
}
|
|
1634
|
-
function useFormatDate() {
|
|
1635
|
-
const ctx = useAuraLocale(), locale = ctx.locale || "en", calendar = ctx.calendar;
|
|
1636
|
-
return React17.useCallback(
|
|
1637
|
-
function(iso, opts) {
|
|
1638
|
-
const o = opts || {}, loc = o.locale || locale;
|
|
1639
|
-
return formatDate(
|
|
1640
|
-
iso,
|
|
1641
|
-
Object.assign({}, o, {
|
|
1642
|
-
locale: loc,
|
|
1643
|
-
calendar: o.calendar || (o.locale ? void 0 : calendar) || defaultCalendar(loc)
|
|
1644
|
-
})
|
|
1645
|
-
);
|
|
1646
|
-
},
|
|
1647
|
-
[locale, calendar]
|
|
1648
|
-
);
|
|
1649
|
-
}
|
|
1650
1644
|
var MONTHS = null;
|
|
1651
1645
|
function monthIndex(word) {
|
|
1652
1646
|
if (!MONTHS) {
|
|
@@ -1684,6 +1678,24 @@ function parseDate(text) {
|
|
|
1684
1678
|
const dt = new Date(y, mo - 1, d);
|
|
1685
1679
|
return dt.getMonth() === mo - 1 && dt.getDate() === d ? toISO(dt) : null;
|
|
1686
1680
|
}
|
|
1681
|
+
|
|
1682
|
+
// src/DatePicker.tsx
|
|
1683
|
+
function useFormatDate() {
|
|
1684
|
+
const ctx = useAuraLocale(), locale = ctx.locale || "en", calendar = ctx.calendar;
|
|
1685
|
+
return React17.useCallback(
|
|
1686
|
+
function(iso, opts) {
|
|
1687
|
+
const o = opts || {}, loc = o.locale || locale;
|
|
1688
|
+
return formatDate(
|
|
1689
|
+
iso,
|
|
1690
|
+
Object.assign({}, o, {
|
|
1691
|
+
locale: loc,
|
|
1692
|
+
calendar: o.calendar || (o.locale ? void 0 : calendar) || defaultCalendar(loc)
|
|
1693
|
+
})
|
|
1694
|
+
);
|
|
1695
|
+
},
|
|
1696
|
+
[locale, calendar]
|
|
1697
|
+
);
|
|
1698
|
+
}
|
|
1687
1699
|
var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
1688
1700
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "en", calendar = props.calendar || ctx.calendar || defaultCalendar(locale), tag = localeTag(locale, calendar);
|
|
1689
1701
|
const weekStart = props.weekStartsOn == null ? locale === "sv" ? 1 : 0 : props.weekStartsOn;
|
|
@@ -2731,7 +2743,12 @@ function Command(props) {
|
|
|
2731
2743
|
const id = uid(), listId = id + "-list";
|
|
2732
2744
|
const box = React25.useRef(null);
|
|
2733
2745
|
const input = React25.useRef(null);
|
|
2734
|
-
const
|
|
2746
|
+
const qState = React25.useState(""), act = React25.useState(null);
|
|
2747
|
+
const query = props.query !== void 0 ? props.query : qState[0];
|
|
2748
|
+
function setQuery(v) {
|
|
2749
|
+
if (props.query === void 0) qState[1](v);
|
|
2750
|
+
if (props.onQueryChange) props.onQueryChange(v);
|
|
2751
|
+
}
|
|
2735
2752
|
const openRef = React25.useRef(props.open);
|
|
2736
2753
|
openRef.current = props.open;
|
|
2737
2754
|
const close = function() {
|
|
@@ -2757,15 +2774,15 @@ function Command(props) {
|
|
|
2757
2774
|
React25.useEffect(
|
|
2758
2775
|
function() {
|
|
2759
2776
|
if (!props.open) {
|
|
2760
|
-
|
|
2761
|
-
act[1](
|
|
2777
|
+
if (query) setQuery("");
|
|
2778
|
+
act[1](null);
|
|
2762
2779
|
}
|
|
2763
2780
|
},
|
|
2764
2781
|
[props.open]
|
|
2765
2782
|
);
|
|
2766
|
-
const filter = props.filter || defaultFilter;
|
|
2783
|
+
const filter = props.filter === false ? null : props.filter || defaultFilter;
|
|
2767
2784
|
const shown = (props.items || []).filter(function(it) {
|
|
2768
|
-
return filter(it,
|
|
2785
|
+
return !filter || filter(it, query);
|
|
2769
2786
|
});
|
|
2770
2787
|
const groups = [];
|
|
2771
2788
|
shown.forEach(function(it) {
|
|
@@ -2787,7 +2804,10 @@ function Command(props) {
|
|
|
2787
2804
|
}).filter(function(i2) {
|
|
2788
2805
|
return i2 >= 0;
|
|
2789
2806
|
});
|
|
2790
|
-
const
|
|
2807
|
+
const byId = act[0] == null ? -1 : flat.findIndex(function(it) {
|
|
2808
|
+
return it.id === act[0];
|
|
2809
|
+
});
|
|
2810
|
+
const active = enabled.indexOf(byId) >= 0 ? byId : enabled.length ? enabled[0] : -1;
|
|
2791
2811
|
const optId = function(i2) {
|
|
2792
2812
|
return id + "-o" + i2;
|
|
2793
2813
|
};
|
|
@@ -2812,7 +2832,7 @@ function Command(props) {
|
|
|
2812
2832
|
if (dir === "first") n2 = 0;
|
|
2813
2833
|
else if (dir === "last") n2 = enabled.length - 1;
|
|
2814
2834
|
else n2 = (at + dir + enabled.length) % enabled.length;
|
|
2815
|
-
act[1](enabled[n2]);
|
|
2835
|
+
act[1](flat[enabled[n2]].id);
|
|
2816
2836
|
}
|
|
2817
2837
|
function onKey(e) {
|
|
2818
2838
|
if (e.key === "ArrowDown") {
|
|
@@ -2870,56 +2890,68 @@ function Command(props) {
|
|
|
2870
2890
|
"aria-label": props.label || t.commandMenu,
|
|
2871
2891
|
placeholder: props.placeholder || t.commandPlaceholder,
|
|
2872
2892
|
className: "aura-command__input",
|
|
2873
|
-
value:
|
|
2893
|
+
value: query,
|
|
2874
2894
|
autoComplete: "off",
|
|
2875
2895
|
spellCheck: false,
|
|
2876
2896
|
onChange: function(e) {
|
|
2877
|
-
|
|
2878
|
-
act[1](
|
|
2897
|
+
setQuery(e.target.value);
|
|
2898
|
+
act[1](null);
|
|
2879
2899
|
},
|
|
2880
2900
|
onKeyDown: onKey
|
|
2881
2901
|
}
|
|
2882
2902
|
), /* @__PURE__ */ React25.createElement("kbd", { className: "aura-command__kbd" }, "Esc")),
|
|
2883
|
-
/* @__PURE__ */ React25.createElement(
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
"
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
g
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2903
|
+
/* @__PURE__ */ React25.createElement(
|
|
2904
|
+
"div",
|
|
2905
|
+
{
|
|
2906
|
+
className: "aura-command__list",
|
|
2907
|
+
id: listId,
|
|
2908
|
+
role: "listbox",
|
|
2909
|
+
"aria-label": props.label || t.commandMenu,
|
|
2910
|
+
"aria-busy": props.loading || void 0
|
|
2911
|
+
},
|
|
2912
|
+
props.loading ? /* @__PURE__ */ React25.createElement("div", { className: "aura-command__loading", role: "presentation" }, /* @__PURE__ */ React25.createElement(Icon, { name: "loader-circle", className: "aura-spin" }), t.searching) : null,
|
|
2913
|
+
!flat.length ? props.loading ? null : /* @__PURE__ */ React25.createElement("div", { className: "aura-command__empty", role: "presentation" }, props.empty != null ? props.empty : props.emptyText || t.noMatches) : groups.map(function(g, gi) {
|
|
2914
|
+
const gid = id + "-g" + gi;
|
|
2915
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2916
|
+
"div",
|
|
2917
|
+
{
|
|
2918
|
+
key: g.name || gi,
|
|
2919
|
+
role: "group",
|
|
2920
|
+
"aria-labelledby": g.name ? gid : void 0,
|
|
2921
|
+
className: "aura-command__group"
|
|
2922
|
+
},
|
|
2923
|
+
g.name ? /* @__PURE__ */ React25.createElement("div", { className: "aura-command__heading", id: gid, role: "presentation" }, g.name) : null,
|
|
2924
|
+
g.items.map(function(it) {
|
|
2925
|
+
i++;
|
|
2926
|
+
const n2 = i;
|
|
2927
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2928
|
+
"div",
|
|
2929
|
+
{
|
|
2930
|
+
key: it.id,
|
|
2931
|
+
id: optId(n2),
|
|
2932
|
+
role: "option",
|
|
2933
|
+
"aria-selected": n2 === active,
|
|
2934
|
+
"aria-disabled": it.disabled || void 0,
|
|
2935
|
+
className: cx("aura-command__item", n2 === active && "is-active", it.disabled && "is-disabled"),
|
|
2936
|
+
onPointerDown: function(e) {
|
|
2937
|
+
e.preventDefault();
|
|
2938
|
+
},
|
|
2939
|
+
onPointerMove: function() {
|
|
2940
|
+
if (!it.disabled && act[0] !== it.id) act[1](it.id);
|
|
2941
|
+
},
|
|
2942
|
+
onClick: function() {
|
|
2943
|
+
run(it);
|
|
2944
|
+
}
|
|
2911
2945
|
},
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
}
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
);
|
|
2922
|
-
})),
|
|
2946
|
+
it.icon ? /* @__PURE__ */ React25.createElement(Icon, { name: it.icon }) : null,
|
|
2947
|
+
/* @__PURE__ */ React25.createElement("span", { className: "aura-command__text" }, /* @__PURE__ */ React25.createElement("span", { className: "aura-command__label" }, it.label), it.description ? /* @__PURE__ */ React25.createElement("span", { className: "aura-command__desc" }, it.description) : null),
|
|
2948
|
+
it.shortcut ? /* @__PURE__ */ React25.createElement("kbd", { className: "aura-command__kbd" }, it.shortcut) : null
|
|
2949
|
+
);
|
|
2950
|
+
})
|
|
2951
|
+
);
|
|
2952
|
+
})
|
|
2953
|
+
),
|
|
2954
|
+
/* @__PURE__ */ React25.createElement("span", { className: "aura-sr-only", role: "status" }, props.loading ? t.searching : props.loading === false && query ? t.results(flat.length) : ""),
|
|
2923
2955
|
/* @__PURE__ */ React25.createElement("div", { className: "aura-command__foot", "aria-hidden": true }, t.commandHint, /* @__PURE__ */ React25.createElement("span", { className: "aura-command__mod" }, isMac() ? "\u2318K" : "Ctrl K"))
|
|
2924
2956
|
)
|
|
2925
2957
|
),
|
|
@@ -3109,11 +3141,20 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3109
3141
|
const selectable = !!props.selectable;
|
|
3110
3142
|
const reorderable = props.reorderable !== false && !!props.columnControls;
|
|
3111
3143
|
const controls = !!props.columnControls;
|
|
3112
|
-
const
|
|
3144
|
+
const oneCallback = !!props.onStateChange;
|
|
3145
|
+
const sortState = useMaybeControlled(
|
|
3146
|
+
props.sort,
|
|
3147
|
+
props.defaultSort || null,
|
|
3148
|
+
oneCallback ? null : props.onSortChange
|
|
3149
|
+
);
|
|
3113
3150
|
const sort = sortState[0], setSort = sortState[1];
|
|
3114
3151
|
const selState = useMaybeControlled(props.selected, props.defaultSelected || [], props.onSelectionChange);
|
|
3115
3152
|
const selected = selState[0], setSelected = selState[1];
|
|
3116
|
-
const pageState = useMaybeControlled(
|
|
3153
|
+
const pageState = useMaybeControlled(
|
|
3154
|
+
props.page,
|
|
3155
|
+
props.defaultPage || 1,
|
|
3156
|
+
oneCallback ? null : props.onPageChange
|
|
3157
|
+
);
|
|
3117
3158
|
const orderState = useMaybeControlled(
|
|
3118
3159
|
props.columnOrder,
|
|
3119
3160
|
columns.map(function(c) {
|
|
@@ -3283,11 +3324,15 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3283
3324
|
const pageRows = pageSize && !manual ? view.slice(first, first + pageSize) : view;
|
|
3284
3325
|
const canSortAny = !busy && (manual ? total > 1 : rows.length > 1);
|
|
3285
3326
|
const shownTotal = manual && props.totalRows == null ? first + rows.length : total;
|
|
3286
|
-
const linkPaging = !!props.getPageHref && !props.onPageChange;
|
|
3327
|
+
const linkPaging = !!props.getPageHref && !props.onPageChange && !oneCallback;
|
|
3287
3328
|
const prevLink = React28.useRef(null), nextLink = React28.useRef(null);
|
|
3288
|
-
function
|
|
3329
|
+
function emit(s, p) {
|
|
3330
|
+
if (props.onStateChange) props.onStateChange({ sort: s, page: p });
|
|
3331
|
+
}
|
|
3332
|
+
function goPage(p, focus, quiet) {
|
|
3289
3333
|
const next = Math.min(Math.max(1, p), pageCount);
|
|
3290
3334
|
if (next === page) return false;
|
|
3335
|
+
if (!quiet) emit(sort, next);
|
|
3291
3336
|
if (linkPaging) {
|
|
3292
3337
|
const a = next === page - 1 ? prevLink.current : next === page + 1 ? nextLink.current : null;
|
|
3293
3338
|
if (a) a.click();
|
|
@@ -3299,8 +3344,12 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3299
3344
|
return true;
|
|
3300
3345
|
}
|
|
3301
3346
|
function sortBy(key) {
|
|
3302
|
-
|
|
3303
|
-
|
|
3347
|
+
applySort(nextSort(key));
|
|
3348
|
+
}
|
|
3349
|
+
function applySort(s) {
|
|
3350
|
+
setSort(s);
|
|
3351
|
+
if (!(manual && linkPaging)) goPage(1, void 0, true);
|
|
3352
|
+
emit(s, 1);
|
|
3304
3353
|
}
|
|
3305
3354
|
const rowHref = props.getRowHref;
|
|
3306
3355
|
function followRow(el, e) {
|
|
@@ -3515,16 +3564,14 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3515
3564
|
label: t.sortAsc,
|
|
3516
3565
|
icon: "arrow-up",
|
|
3517
3566
|
onSelect: function() {
|
|
3518
|
-
|
|
3519
|
-
goPage(1);
|
|
3567
|
+
applySort({ key: c.key, dir: "asc" });
|
|
3520
3568
|
}
|
|
3521
3569
|
},
|
|
3522
3570
|
{
|
|
3523
3571
|
label: t.sortDesc,
|
|
3524
3572
|
icon: "arrow-down",
|
|
3525
3573
|
onSelect: function() {
|
|
3526
|
-
|
|
3527
|
-
goPage(1);
|
|
3574
|
+
applySort({ key: c.key, dir: "desc" });
|
|
3528
3575
|
}
|
|
3529
3576
|
},
|
|
3530
3577
|
{ separator: true }
|
|
@@ -3961,9 +4008,10 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3961
4008
|
className: "aura-icon-btn",
|
|
3962
4009
|
"aria-label": label,
|
|
3963
4010
|
onClick: function(e) {
|
|
3964
|
-
if (props.onPageChange) {
|
|
4011
|
+
if (props.onPageChange || oneCallback) {
|
|
3965
4012
|
e.preventDefault();
|
|
3966
4013
|
pageState[1](p);
|
|
4014
|
+
emit(sort, p);
|
|
3967
4015
|
}
|
|
3968
4016
|
}
|
|
3969
4017
|
},
|
|
@@ -4457,7 +4505,7 @@ var SideNav = React31.forwardRef(function SideNav2(props, ref) {
|
|
|
4457
4505
|
var React32 = __toESM(require("react"), 1);
|
|
4458
4506
|
var Breadcrumb = React32.forwardRef(function Breadcrumb2(props, ref) {
|
|
4459
4507
|
const t = useStrings();
|
|
4460
|
-
const Link = useLinkComponent();
|
|
4508
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
4461
4509
|
const items2 = props.items || [];
|
|
4462
4510
|
return /* @__PURE__ */ React32.createElement("nav", { ref, "aria-label": props.label || t.breadcrumb, className: cx("aura-crumbs", props.className) }, /* @__PURE__ */ React32.createElement("ol", null, items2.map(function(it, i) {
|
|
4463
4511
|
const last = i === items2.length - 1;
|
|
@@ -4506,7 +4554,11 @@ var React35 = __toESM(require("react"), 1);
|
|
|
4506
4554
|
|
|
4507
4555
|
// src/responsive.tsx
|
|
4508
4556
|
var React34 = __toESM(require("react"), 1);
|
|
4557
|
+
|
|
4558
|
+
// src/breakpoints.ts
|
|
4509
4559
|
var breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
4560
|
+
|
|
4561
|
+
// src/responsive.tsx
|
|
4510
4562
|
var ORDER = ["base", "sm", "md", "lg", "xl"];
|
|
4511
4563
|
function useBreakpoint() {
|
|
4512
4564
|
return React34.useSyncExternalStore(subscribe, current, function() {
|
|
@@ -4675,7 +4727,7 @@ var Stat = React40.forwardRef(function Stat2(props, ref) {
|
|
|
4675
4727
|
const ch = props.change;
|
|
4676
4728
|
const dir = ch && (ch.direction || "flat");
|
|
4677
4729
|
const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
|
|
4678
|
-
const Link = useLinkComponent();
|
|
4730
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
4679
4731
|
const v = props.value;
|
|
4680
4732
|
const numeric = typeof v === "number" || typeof v === "string" && /\d/.test(v) && /^[\s\d.,:+\-\u2212%()\u0E3F$\u20AC\u00A3\u00A5kKmMbB]+$/.test(v.replace(/\b[A-Z]{3}\b/g, ""));
|
|
4681
4733
|
const Tag3 = props.href ? Link : props.onClick ? "button" : "div";
|
|
@@ -4699,16 +4751,21 @@ var Stat = React40.forwardRef(function Stat2(props, ref) {
|
|
|
4699
4751
|
// src/TimePicker.tsx
|
|
4700
4752
|
var React41 = __toESM(require("react"), 1);
|
|
4701
4753
|
var import_react_dom9 = require("react-dom");
|
|
4754
|
+
|
|
4755
|
+
// src/text.ts
|
|
4756
|
+
function formatBytes(n2) {
|
|
4757
|
+
if (n2 == null) return "";
|
|
4758
|
+
if (n2 < 1024) return n2 + " B";
|
|
4759
|
+
let u = ["KB", "MB", "GB"], i = -1;
|
|
4760
|
+
do {
|
|
4761
|
+
n2 /= 1024;
|
|
4762
|
+
i++;
|
|
4763
|
+
} while (n2 >= 1024 && i < u.length - 1);
|
|
4764
|
+
return (n2 >= 10 || Math.round(n2) === n2 ? Math.round(n2) : n2.toFixed(1)) + " " + u[i];
|
|
4765
|
+
}
|
|
4702
4766
|
function pad2(n2) {
|
|
4703
4767
|
return (n2 < 10 ? "0" : "") + n2;
|
|
4704
4768
|
}
|
|
4705
|
-
function toMin(t) {
|
|
4706
|
-
const m = /^(\d{2}):(\d{2})$/.exec(t || "");
|
|
4707
|
-
return m ? +m[1] * 60 + +m[2] : null;
|
|
4708
|
-
}
|
|
4709
|
-
function fromMin(n2) {
|
|
4710
|
-
return pad2(Math.floor(n2 / 60)) + ":" + pad2(n2 % 60);
|
|
4711
|
-
}
|
|
4712
4769
|
function parseTime(text) {
|
|
4713
4770
|
let s = String(text || "").trim().toLowerCase().replace(/\s*(น\.?|นาฬิกา)$/, "").trim();
|
|
4714
4771
|
const pm = /\s*(pm|p\.m\.)$/.test(s), am = /\s*(am|a\.m\.)$/.test(s);
|
|
@@ -4721,6 +4778,18 @@ function parseTime(text) {
|
|
|
4721
4778
|
if (hh > 23 || mm > 59) return null;
|
|
4722
4779
|
return pad2(hh) + ":" + pad2(mm);
|
|
4723
4780
|
}
|
|
4781
|
+
|
|
4782
|
+
// src/TimePicker.tsx
|
|
4783
|
+
function pad3(n2) {
|
|
4784
|
+
return (n2 < 10 ? "0" : "") + n2;
|
|
4785
|
+
}
|
|
4786
|
+
function toMin(t) {
|
|
4787
|
+
const m = /^(\d{2}):(\d{2})$/.exec(t || "");
|
|
4788
|
+
return m ? +m[1] * 60 + +m[2] : null;
|
|
4789
|
+
}
|
|
4790
|
+
function fromMin(n2) {
|
|
4791
|
+
return pad3(Math.floor(n2 / 60)) + ":" + pad3(n2 % 60);
|
|
4792
|
+
}
|
|
4724
4793
|
var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
4725
4794
|
const t = useStrings();
|
|
4726
4795
|
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
@@ -5021,16 +5090,6 @@ var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
|
5021
5090
|
|
|
5022
5091
|
// src/FileUpload.tsx
|
|
5023
5092
|
var React42 = __toESM(require("react"), 1);
|
|
5024
|
-
function formatBytes(n2) {
|
|
5025
|
-
if (n2 == null) return "";
|
|
5026
|
-
if (n2 < 1024) return n2 + " B";
|
|
5027
|
-
let u = ["KB", "MB", "GB"], i = -1;
|
|
5028
|
-
do {
|
|
5029
|
-
n2 /= 1024;
|
|
5030
|
-
i++;
|
|
5031
|
-
} while (n2 >= 1024 && i < u.length - 1);
|
|
5032
|
-
return (n2 >= 10 || Math.round(n2) === n2 ? Math.round(n2) : n2.toFixed(1)) + " " + u[i];
|
|
5033
|
-
}
|
|
5034
5093
|
function matches(file, accept) {
|
|
5035
5094
|
if (!accept) return true;
|
|
5036
5095
|
const name = (file.name || "").toLowerCase(), type = (file.type || "").toLowerCase();
|
|
@@ -5489,6 +5548,8 @@ function ThemeStyle(props) {
|
|
|
5489
5548
|
|
|
5490
5549
|
// src/colorScheme.tsx
|
|
5491
5550
|
var React44 = __toESM(require("react"), 1);
|
|
5551
|
+
|
|
5552
|
+
// src/colorSchemeScript.ts
|
|
5492
5553
|
var DEFAULT_KEY = "aura-color-scheme";
|
|
5493
5554
|
var SCHEMES = ["light", "dark", "system"];
|
|
5494
5555
|
var EVENT = "aura-color-scheme";
|
|
@@ -5500,6 +5561,8 @@ function colorSchemeScript(options) {
|
|
|
5500
5561
|
const fallback = JSON.stringify(options && options.defaultScheme || "system");
|
|
5501
5562
|
return "(function(){try{var s=localStorage.getItem(" + key + ");if(s!=='light'&&s!=='dark'&&s!=='system')s=" + fallback + `;var d=document.documentElement;d.setAttribute("data-theme",s);var dark=s==='dark'||(s==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);d.classList.toggle("dark",dark);}catch(e){}})();`;
|
|
5502
5563
|
}
|
|
5564
|
+
|
|
5565
|
+
// src/colorScheme.tsx
|
|
5503
5566
|
function ColorSchemeScript(props) {
|
|
5504
5567
|
return /* @__PURE__ */ React44.createElement(
|
|
5505
5568
|
"script",
|
|
@@ -5727,7 +5790,7 @@ var Pagination = React49.forwardRef(function Pagination2(props, ref) {
|
|
|
5727
5790
|
if (p >= 1 && p <= count && p !== page) st[1](p);
|
|
5728
5791
|
}
|
|
5729
5792
|
const link = props.getHref;
|
|
5730
|
-
const Link = useLinkComponent();
|
|
5793
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
5731
5794
|
function item(p, label, extra) {
|
|
5732
5795
|
const common = Object.assign(
|
|
5733
5796
|
{
|
|
@@ -5762,29 +5825,40 @@ var Pagination = React49.forwardRef(function Pagination2(props, ref) {
|
|
|
5762
5825
|
label
|
|
5763
5826
|
);
|
|
5764
5827
|
}
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5828
|
+
function arrow(p, icon, label, rel, disabled) {
|
|
5829
|
+
if (!link || disabled)
|
|
5830
|
+
return /* @__PURE__ */ React49.createElement(
|
|
5831
|
+
IconButton,
|
|
5832
|
+
{
|
|
5833
|
+
icon,
|
|
5834
|
+
label,
|
|
5835
|
+
disabled,
|
|
5836
|
+
onClick: function() {
|
|
5837
|
+
go(p);
|
|
5838
|
+
}
|
|
5839
|
+
}
|
|
5840
|
+
);
|
|
5841
|
+
return /* @__PURE__ */ React49.createElement(
|
|
5842
|
+
Link,
|
|
5843
|
+
{
|
|
5844
|
+
href: link(p),
|
|
5845
|
+
rel,
|
|
5846
|
+
className: "aura-icon-btn",
|
|
5847
|
+
"aria-label": label,
|
|
5848
|
+
title: label,
|
|
5849
|
+
onClick: function(e) {
|
|
5850
|
+
if (props.onChange) {
|
|
5851
|
+
e.preventDefault();
|
|
5852
|
+
go(p);
|
|
5853
|
+
}
|
|
5854
|
+
}
|
|
5855
|
+
},
|
|
5856
|
+
/* @__PURE__ */ React49.createElement(Icon, { name: icon, size: "sm" })
|
|
5857
|
+
);
|
|
5858
|
+
}
|
|
5859
|
+
return /* @__PURE__ */ React49.createElement("nav", { ref, className: cx("aura-pagination", props.className), "aria-label": props.label || t.pagination }, arrow(page - 1, "chevron-left", t.prevPage, "prev", page <= 1), /* @__PURE__ */ React49.createElement("ol", { className: "aura-pagination__list" }, pageList(page, count, props.siblingCount == null ? 1 : props.siblingCount).map(function(p) {
|
|
5776
5860
|
return typeof p === "number" ? /* @__PURE__ */ React49.createElement("li", { key: p }, item(p, p)) : /* @__PURE__ */ React49.createElement("li", { key: p, className: "aura-pagination__gap", "aria-hidden": true }, "\u2026");
|
|
5777
|
-
})), /* @__PURE__ */ React49.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)),
|
|
5778
|
-
IconButton,
|
|
5779
|
-
{
|
|
5780
|
-
icon: "chevron-right",
|
|
5781
|
-
label: t.nextPage,
|
|
5782
|
-
disabled: page >= count,
|
|
5783
|
-
onClick: function() {
|
|
5784
|
-
go(page + 1);
|
|
5785
|
-
}
|
|
5786
|
-
}
|
|
5787
|
-
));
|
|
5861
|
+
})), /* @__PURE__ */ React49.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)), arrow(page + 1, "chevron-right", t.nextPage, "next", page >= count));
|
|
5788
5862
|
});
|
|
5789
5863
|
|
|
5790
5864
|
// src/Accordion.tsx
|
package/dist/esm/Breadcrumb.js
CHANGED
|
@@ -5,7 +5,7 @@ import { cx } from "./internal.js";
|
|
|
5
5
|
import { useLinkComponent, useStrings } from "./locale.js";
|
|
6
6
|
const Breadcrumb = React.forwardRef(function Breadcrumb2(props, ref) {
|
|
7
7
|
const t = useStrings();
|
|
8
|
-
const Link = useLinkComponent();
|
|
8
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
9
9
|
const items = props.items || [];
|
|
10
10
|
return /* @__PURE__ */ React.createElement("nav", { ref, "aria-label": props.label || t.breadcrumb, className: cx("aura-crumbs", props.className) }, /* @__PURE__ */ React.createElement("ol", null, items.map(function(it, i) {
|
|
11
11
|
const last = i === items.length - 1;
|