@jirawatpyk/aura-react 4.16.0 → 4.18.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 +202 -126
- package/dist/cjs/index.cjs +202 -126
- package/dist/esm/Breadcrumb.js +1 -1
- package/dist/esm/Command.js +73 -51
- 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 +22 -4
- package/dist/styles.layer.css +1355 -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") {
|
|
@@ -2863,63 +2883,77 @@ function Command(props) {
|
|
|
2863
2883
|
"data-autofocus": "",
|
|
2864
2884
|
type: "text",
|
|
2865
2885
|
role: "combobox",
|
|
2866
|
-
"aria-expanded":
|
|
2867
|
-
"aria-controls": listId,
|
|
2886
|
+
"aria-expanded": flat.length > 0,
|
|
2887
|
+
"aria-controls": flat.length ? listId : void 0,
|
|
2868
2888
|
"aria-autocomplete": "list",
|
|
2869
2889
|
"aria-activedescendant": active >= 0 ? optId(active) : void 0,
|
|
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("div", { className: "aura-command__list",
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
"
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2903
|
+
/* @__PURE__ */ React25.createElement("div", { className: "aura-command__list", "aria-busy": props.loading || void 0 }, props.loading ? /* @__PURE__ */ React25.createElement("div", { className: "aura-command__loading" }, /* @__PURE__ */ React25.createElement(Icon, { name: "loader-circle", className: "aura-spin" }), t.searching) : null, !flat.length ? props.loading ? null : /* @__PURE__ */ React25.createElement("div", { className: "aura-command__empty" }, props.empty != null ? props.empty : props.emptyText || t.noMatches) : /* @__PURE__ */ React25.createElement(
|
|
2904
|
+
"div",
|
|
2905
|
+
{
|
|
2906
|
+
id: listId,
|
|
2907
|
+
role: "listbox",
|
|
2908
|
+
"aria-label": props.label || t.commandMenu,
|
|
2909
|
+
"aria-busy": props.loading || void 0
|
|
2910
|
+
},
|
|
2911
|
+
groups.map(function(g, gi) {
|
|
2912
|
+
const gid = id + "-g" + gi;
|
|
2913
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2914
|
+
"div",
|
|
2915
|
+
{
|
|
2916
|
+
key: g.name || gi,
|
|
2917
|
+
role: "group",
|
|
2918
|
+
"aria-labelledby": g.name ? gid : void 0,
|
|
2919
|
+
className: "aura-command__group"
|
|
2920
|
+
},
|
|
2921
|
+
g.name ? /* @__PURE__ */ React25.createElement("div", { className: "aura-command__heading", id: gid, role: "presentation" }, g.name) : null,
|
|
2922
|
+
g.items.map(function(it) {
|
|
2923
|
+
i++;
|
|
2924
|
+
const n2 = i;
|
|
2925
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2926
|
+
"div",
|
|
2927
|
+
{
|
|
2928
|
+
key: it.id,
|
|
2929
|
+
id: optId(n2),
|
|
2930
|
+
role: "option",
|
|
2931
|
+
"aria-selected": n2 === active,
|
|
2932
|
+
"aria-disabled": it.disabled || void 0,
|
|
2933
|
+
className: cx(
|
|
2934
|
+
"aura-command__item",
|
|
2935
|
+
n2 === active && "is-active",
|
|
2936
|
+
it.disabled && "is-disabled"
|
|
2937
|
+
),
|
|
2938
|
+
onPointerDown: function(e) {
|
|
2939
|
+
e.preventDefault();
|
|
2940
|
+
},
|
|
2941
|
+
onPointerMove: function() {
|
|
2942
|
+
if (!it.disabled && act[0] !== it.id) act[1](it.id);
|
|
2943
|
+
},
|
|
2944
|
+
onClick: function() {
|
|
2945
|
+
run(it);
|
|
2946
|
+
}
|
|
2911
2947
|
},
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
}
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
);
|
|
2922
|
-
})),
|
|
2948
|
+
it.icon ? /* @__PURE__ */ React25.createElement(Icon, { name: it.icon }) : null,
|
|
2949
|
+
/* @__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),
|
|
2950
|
+
it.shortcut ? /* @__PURE__ */ React25.createElement("kbd", { className: "aura-command__kbd" }, it.shortcut) : null
|
|
2951
|
+
);
|
|
2952
|
+
})
|
|
2953
|
+
);
|
|
2954
|
+
})
|
|
2955
|
+
)),
|
|
2956
|
+
/* @__PURE__ */ React25.createElement("span", { className: "aura-sr-only", role: "status" }, props.loading ? t.searching : query && !flat.length ? t.noMatches : props.loading === false && query ? t.results(flat.length) : ""),
|
|
2923
2957
|
/* @__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
2958
|
)
|
|
2925
2959
|
),
|
|
@@ -3109,11 +3143,20 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3109
3143
|
const selectable = !!props.selectable;
|
|
3110
3144
|
const reorderable = props.reorderable !== false && !!props.columnControls;
|
|
3111
3145
|
const controls = !!props.columnControls;
|
|
3112
|
-
const
|
|
3146
|
+
const oneCallback = !!props.onStateChange;
|
|
3147
|
+
const sortState = useMaybeControlled(
|
|
3148
|
+
props.sort,
|
|
3149
|
+
props.defaultSort || null,
|
|
3150
|
+
oneCallback ? null : props.onSortChange
|
|
3151
|
+
);
|
|
3113
3152
|
const sort = sortState[0], setSort = sortState[1];
|
|
3114
3153
|
const selState = useMaybeControlled(props.selected, props.defaultSelected || [], props.onSelectionChange);
|
|
3115
3154
|
const selected = selState[0], setSelected = selState[1];
|
|
3116
|
-
const pageState = useMaybeControlled(
|
|
3155
|
+
const pageState = useMaybeControlled(
|
|
3156
|
+
props.page,
|
|
3157
|
+
props.defaultPage || 1,
|
|
3158
|
+
oneCallback ? null : props.onPageChange
|
|
3159
|
+
);
|
|
3117
3160
|
const orderState = useMaybeControlled(
|
|
3118
3161
|
props.columnOrder,
|
|
3119
3162
|
columns.map(function(c) {
|
|
@@ -3283,11 +3326,15 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3283
3326
|
const pageRows = pageSize && !manual ? view.slice(first, first + pageSize) : view;
|
|
3284
3327
|
const canSortAny = !busy && (manual ? total > 1 : rows.length > 1);
|
|
3285
3328
|
const shownTotal = manual && props.totalRows == null ? first + rows.length : total;
|
|
3286
|
-
const linkPaging = !!props.getPageHref && !props.onPageChange;
|
|
3329
|
+
const linkPaging = !!props.getPageHref && !props.onPageChange && !oneCallback;
|
|
3287
3330
|
const prevLink = React28.useRef(null), nextLink = React28.useRef(null);
|
|
3288
|
-
function
|
|
3331
|
+
function emit(s, p) {
|
|
3332
|
+
if (props.onStateChange) props.onStateChange({ sort: s, page: p });
|
|
3333
|
+
}
|
|
3334
|
+
function goPage(p, focus, quiet) {
|
|
3289
3335
|
const next = Math.min(Math.max(1, p), pageCount);
|
|
3290
3336
|
if (next === page) return false;
|
|
3337
|
+
if (!quiet) emit(sort, next);
|
|
3291
3338
|
if (linkPaging) {
|
|
3292
3339
|
const a = next === page - 1 ? prevLink.current : next === page + 1 ? nextLink.current : null;
|
|
3293
3340
|
if (a) a.click();
|
|
@@ -3299,8 +3346,12 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3299
3346
|
return true;
|
|
3300
3347
|
}
|
|
3301
3348
|
function sortBy(key) {
|
|
3302
|
-
|
|
3303
|
-
|
|
3349
|
+
applySort(nextSort(key));
|
|
3350
|
+
}
|
|
3351
|
+
function applySort(s) {
|
|
3352
|
+
setSort(s);
|
|
3353
|
+
if (!(manual && linkPaging)) goPage(1, void 0, true);
|
|
3354
|
+
emit(s, 1);
|
|
3304
3355
|
}
|
|
3305
3356
|
const rowHref = props.getRowHref;
|
|
3306
3357
|
function followRow(el, e) {
|
|
@@ -3515,16 +3566,14 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3515
3566
|
label: t.sortAsc,
|
|
3516
3567
|
icon: "arrow-up",
|
|
3517
3568
|
onSelect: function() {
|
|
3518
|
-
|
|
3519
|
-
goPage(1);
|
|
3569
|
+
applySort({ key: c.key, dir: "asc" });
|
|
3520
3570
|
}
|
|
3521
3571
|
},
|
|
3522
3572
|
{
|
|
3523
3573
|
label: t.sortDesc,
|
|
3524
3574
|
icon: "arrow-down",
|
|
3525
3575
|
onSelect: function() {
|
|
3526
|
-
|
|
3527
|
-
goPage(1);
|
|
3576
|
+
applySort({ key: c.key, dir: "desc" });
|
|
3528
3577
|
}
|
|
3529
3578
|
},
|
|
3530
3579
|
{ separator: true }
|
|
@@ -3961,9 +4010,10 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3961
4010
|
className: "aura-icon-btn",
|
|
3962
4011
|
"aria-label": label,
|
|
3963
4012
|
onClick: function(e) {
|
|
3964
|
-
if (props.onPageChange) {
|
|
4013
|
+
if (props.onPageChange || oneCallback) {
|
|
3965
4014
|
e.preventDefault();
|
|
3966
4015
|
pageState[1](p);
|
|
4016
|
+
emit(sort, p);
|
|
3967
4017
|
}
|
|
3968
4018
|
}
|
|
3969
4019
|
},
|
|
@@ -4457,7 +4507,7 @@ var SideNav = React31.forwardRef(function SideNav2(props, ref) {
|
|
|
4457
4507
|
var React32 = __toESM(require("react"), 1);
|
|
4458
4508
|
var Breadcrumb = React32.forwardRef(function Breadcrumb2(props, ref) {
|
|
4459
4509
|
const t = useStrings();
|
|
4460
|
-
const Link = useLinkComponent();
|
|
4510
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
4461
4511
|
const items2 = props.items || [];
|
|
4462
4512
|
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
4513
|
const last = i === items2.length - 1;
|
|
@@ -4506,7 +4556,11 @@ var React35 = __toESM(require("react"), 1);
|
|
|
4506
4556
|
|
|
4507
4557
|
// src/responsive.tsx
|
|
4508
4558
|
var React34 = __toESM(require("react"), 1);
|
|
4559
|
+
|
|
4560
|
+
// src/breakpoints.ts
|
|
4509
4561
|
var breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
4562
|
+
|
|
4563
|
+
// src/responsive.tsx
|
|
4510
4564
|
var ORDER = ["base", "sm", "md", "lg", "xl"];
|
|
4511
4565
|
function useBreakpoint() {
|
|
4512
4566
|
return React34.useSyncExternalStore(subscribe, current, function() {
|
|
@@ -4675,7 +4729,7 @@ var Stat = React40.forwardRef(function Stat2(props, ref) {
|
|
|
4675
4729
|
const ch = props.change;
|
|
4676
4730
|
const dir = ch && (ch.direction || "flat");
|
|
4677
4731
|
const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
|
|
4678
|
-
const Link = useLinkComponent();
|
|
4732
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
4679
4733
|
const v = props.value;
|
|
4680
4734
|
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
4735
|
const Tag3 = props.href ? Link : props.onClick ? "button" : "div";
|
|
@@ -4699,16 +4753,21 @@ var Stat = React40.forwardRef(function Stat2(props, ref) {
|
|
|
4699
4753
|
// src/TimePicker.tsx
|
|
4700
4754
|
var React41 = __toESM(require("react"), 1);
|
|
4701
4755
|
var import_react_dom9 = require("react-dom");
|
|
4756
|
+
|
|
4757
|
+
// src/text.ts
|
|
4758
|
+
function formatBytes(n2) {
|
|
4759
|
+
if (n2 == null) return "";
|
|
4760
|
+
if (n2 < 1024) return n2 + " B";
|
|
4761
|
+
let u = ["KB", "MB", "GB"], i = -1;
|
|
4762
|
+
do {
|
|
4763
|
+
n2 /= 1024;
|
|
4764
|
+
i++;
|
|
4765
|
+
} while (n2 >= 1024 && i < u.length - 1);
|
|
4766
|
+
return (n2 >= 10 || Math.round(n2) === n2 ? Math.round(n2) : n2.toFixed(1)) + " " + u[i];
|
|
4767
|
+
}
|
|
4702
4768
|
function pad2(n2) {
|
|
4703
4769
|
return (n2 < 10 ? "0" : "") + n2;
|
|
4704
4770
|
}
|
|
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
4771
|
function parseTime(text) {
|
|
4713
4772
|
let s = String(text || "").trim().toLowerCase().replace(/\s*(น\.?|นาฬิกา)$/, "").trim();
|
|
4714
4773
|
const pm = /\s*(pm|p\.m\.)$/.test(s), am = /\s*(am|a\.m\.)$/.test(s);
|
|
@@ -4721,6 +4780,18 @@ function parseTime(text) {
|
|
|
4721
4780
|
if (hh > 23 || mm > 59) return null;
|
|
4722
4781
|
return pad2(hh) + ":" + pad2(mm);
|
|
4723
4782
|
}
|
|
4783
|
+
|
|
4784
|
+
// src/TimePicker.tsx
|
|
4785
|
+
function pad3(n2) {
|
|
4786
|
+
return (n2 < 10 ? "0" : "") + n2;
|
|
4787
|
+
}
|
|
4788
|
+
function toMin(t) {
|
|
4789
|
+
const m = /^(\d{2}):(\d{2})$/.exec(t || "");
|
|
4790
|
+
return m ? +m[1] * 60 + +m[2] : null;
|
|
4791
|
+
}
|
|
4792
|
+
function fromMin(n2) {
|
|
4793
|
+
return pad3(Math.floor(n2 / 60)) + ":" + pad3(n2 % 60);
|
|
4794
|
+
}
|
|
4724
4795
|
var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
4725
4796
|
const t = useStrings();
|
|
4726
4797
|
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
@@ -5021,16 +5092,6 @@ var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
|
5021
5092
|
|
|
5022
5093
|
// src/FileUpload.tsx
|
|
5023
5094
|
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
5095
|
function matches(file, accept) {
|
|
5035
5096
|
if (!accept) return true;
|
|
5036
5097
|
const name = (file.name || "").toLowerCase(), type = (file.type || "").toLowerCase();
|
|
@@ -5489,6 +5550,8 @@ function ThemeStyle(props) {
|
|
|
5489
5550
|
|
|
5490
5551
|
// src/colorScheme.tsx
|
|
5491
5552
|
var React44 = __toESM(require("react"), 1);
|
|
5553
|
+
|
|
5554
|
+
// src/colorSchemeScript.ts
|
|
5492
5555
|
var DEFAULT_KEY = "aura-color-scheme";
|
|
5493
5556
|
var SCHEMES = ["light", "dark", "system"];
|
|
5494
5557
|
var EVENT = "aura-color-scheme";
|
|
@@ -5500,6 +5563,8 @@ function colorSchemeScript(options) {
|
|
|
5500
5563
|
const fallback = JSON.stringify(options && options.defaultScheme || "system");
|
|
5501
5564
|
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
5565
|
}
|
|
5566
|
+
|
|
5567
|
+
// src/colorScheme.tsx
|
|
5503
5568
|
function ColorSchemeScript(props) {
|
|
5504
5569
|
return /* @__PURE__ */ React44.createElement(
|
|
5505
5570
|
"script",
|
|
@@ -5727,7 +5792,7 @@ var Pagination = React49.forwardRef(function Pagination2(props, ref) {
|
|
|
5727
5792
|
if (p >= 1 && p <= count && p !== page) st[1](p);
|
|
5728
5793
|
}
|
|
5729
5794
|
const link = props.getHref;
|
|
5730
|
-
const Link = useLinkComponent();
|
|
5795
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
5731
5796
|
function item(p, label, extra) {
|
|
5732
5797
|
const common = Object.assign(
|
|
5733
5798
|
{
|
|
@@ -5762,29 +5827,40 @@ var Pagination = React49.forwardRef(function Pagination2(props, ref) {
|
|
|
5762
5827
|
label
|
|
5763
5828
|
);
|
|
5764
5829
|
}
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5830
|
+
function arrow(p, icon, label, rel, disabled) {
|
|
5831
|
+
if (!link || disabled)
|
|
5832
|
+
return /* @__PURE__ */ React49.createElement(
|
|
5833
|
+
IconButton,
|
|
5834
|
+
{
|
|
5835
|
+
icon,
|
|
5836
|
+
label,
|
|
5837
|
+
disabled,
|
|
5838
|
+
onClick: function() {
|
|
5839
|
+
go(p);
|
|
5840
|
+
}
|
|
5841
|
+
}
|
|
5842
|
+
);
|
|
5843
|
+
return /* @__PURE__ */ React49.createElement(
|
|
5844
|
+
Link,
|
|
5845
|
+
{
|
|
5846
|
+
href: link(p),
|
|
5847
|
+
rel,
|
|
5848
|
+
className: "aura-icon-btn",
|
|
5849
|
+
"aria-label": label,
|
|
5850
|
+
title: label,
|
|
5851
|
+
onClick: function(e) {
|
|
5852
|
+
if (props.onChange) {
|
|
5853
|
+
e.preventDefault();
|
|
5854
|
+
go(p);
|
|
5855
|
+
}
|
|
5856
|
+
}
|
|
5857
|
+
},
|
|
5858
|
+
/* @__PURE__ */ React49.createElement(Icon, { name: icon, size: "sm" })
|
|
5859
|
+
);
|
|
5860
|
+
}
|
|
5861
|
+
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
5862
|
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
|
-
));
|
|
5863
|
+
})), /* @__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
5864
|
});
|
|
5789
5865
|
|
|
5790
5866
|
// 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;
|