@jirawatpyk/aura-react 4.15.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 +76 -5
- package/dist/aura.bundle.js +239 -142
- package/dist/cjs/index.cjs +239 -142
- package/dist/esm/AppShell.js +9 -9
- package/dist/esm/Breadcrumb.js +1 -1
- package/dist/esm/Button.js +12 -3
- package/dist/esm/Command.js +69 -49
- package/dist/esm/DataTable.js +43 -16
- package/dist/esm/DatePicker.js +17 -146
- package/dist/esm/FileUpload.js +1 -10
- package/dist/esm/Pagination.js +35 -23
- package/dist/esm/Skeleton.js +4 -1
- 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 +537 -503
- 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 +69 -4
- package/dist/styles.layer.css +1352 -0
- package/package.json +11 -4
package/dist/aura.bundle.js
CHANGED
|
@@ -267,6 +267,8 @@ window.Aura = (() => {
|
|
|
267
267
|
|
|
268
268
|
// src/locale.tsx
|
|
269
269
|
var React3 = __toESM(require_react(), 1);
|
|
270
|
+
|
|
271
|
+
// src/strings.ts
|
|
270
272
|
var n = function(x) {
|
|
271
273
|
return Number(x).toLocaleString("en");
|
|
272
274
|
};
|
|
@@ -614,6 +616,8 @@ window.Aura = (() => {
|
|
|
614
616
|
}
|
|
615
617
|
}
|
|
616
618
|
};
|
|
619
|
+
|
|
620
|
+
// src/locale.tsx
|
|
617
621
|
var LocaleContext = React3.createContext(null);
|
|
618
622
|
function AuraProvider(props) {
|
|
619
623
|
const outer = React3.useContext(LocaleContext);
|
|
@@ -661,7 +665,8 @@ window.Aura = (() => {
|
|
|
661
665
|
"disabled",
|
|
662
666
|
"linkComponent",
|
|
663
667
|
"href",
|
|
664
|
-
"fullWidth"
|
|
668
|
+
"fullWidth",
|
|
669
|
+
"size"
|
|
665
670
|
]);
|
|
666
671
|
const Tag3 = disabled ? "a" : Link;
|
|
667
672
|
return /* @__PURE__ */ React4.createElement(
|
|
@@ -673,7 +678,13 @@ window.Aura = (() => {
|
|
|
673
678
|
role: disabled ? "link" : void 0,
|
|
674
679
|
"aria-disabled": disabled || void 0,
|
|
675
680
|
tabIndex: disabled ? -1 : props.tabIndex,
|
|
676
|
-
className: cx(
|
|
681
|
+
className: cx(
|
|
682
|
+
"aura-btn",
|
|
683
|
+
"aura-btn--" + variant,
|
|
684
|
+
props.size === "sm" && "aura-btn--sm",
|
|
685
|
+
props.fullWidth && "aura-btn--full",
|
|
686
|
+
props.className
|
|
687
|
+
),
|
|
677
688
|
onClick: disabled ? void 0 : props.onClick
|
|
678
689
|
},
|
|
679
690
|
props.icon ? /* @__PURE__ */ React4.createElement(Icon, { name: props.icon }) : null,
|
|
@@ -699,7 +710,8 @@ window.Aura = (() => {
|
|
|
699
710
|
"iconRight",
|
|
700
711
|
"loading",
|
|
701
712
|
"onClick",
|
|
702
|
-
"fullWidth"
|
|
713
|
+
"fullWidth",
|
|
714
|
+
"size"
|
|
703
715
|
]);
|
|
704
716
|
return /* @__PURE__ */ React4.createElement(
|
|
705
717
|
"button",
|
|
@@ -710,6 +722,7 @@ window.Aura = (() => {
|
|
|
710
722
|
className: cx(
|
|
711
723
|
"aura-btn",
|
|
712
724
|
"aura-btn--" + variant,
|
|
725
|
+
props.size === "sm" && "aura-btn--sm",
|
|
713
726
|
props.fullWidth && "aura-btn--full",
|
|
714
727
|
loading && "is-loading",
|
|
715
728
|
props.className
|
|
@@ -937,12 +950,8 @@ window.Aura = (() => {
|
|
|
937
950
|
|
|
938
951
|
// src/StatusPill.tsx
|
|
939
952
|
var React9 = __toESM(require_react(), 1);
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
progress: "circle-dot-dashed",
|
|
943
|
-
ready: "circle-check",
|
|
944
|
-
blocked: "ban"
|
|
945
|
-
};
|
|
953
|
+
|
|
954
|
+
// src/status.ts
|
|
946
955
|
var TONE_WORDS = {
|
|
947
956
|
ready: ["ready", "done", "complete", "completed", "approved", "live", "passed"],
|
|
948
957
|
progress: ["in progress", "in review", "review", "syncing", "running", "pending"],
|
|
@@ -954,6 +963,14 @@ window.Aura = (() => {
|
|
|
954
963
|
return "neutral";
|
|
955
964
|
}
|
|
956
965
|
var TONE_ORDER = { neutral: 0, progress: 1, ready: 2, blocked: 3 };
|
|
966
|
+
|
|
967
|
+
// src/StatusPill.tsx
|
|
968
|
+
var TONE_ICON = {
|
|
969
|
+
neutral: "circle",
|
|
970
|
+
progress: "circle-dot-dashed",
|
|
971
|
+
ready: "circle-check",
|
|
972
|
+
blocked: "ban"
|
|
973
|
+
};
|
|
957
974
|
var StatusPill = React9.forwardRef(function StatusPill2(props, ref) {
|
|
958
975
|
const tone2 = props.tone || toneFor(props.children);
|
|
959
976
|
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);
|
|
@@ -1535,6 +1552,8 @@ window.Aura = (() => {
|
|
|
1535
1552
|
// src/DatePicker.tsx
|
|
1536
1553
|
var React17 = __toESM(require_react(), 1);
|
|
1537
1554
|
var import_react_dom3 = __toESM(require_react_dom(), 1);
|
|
1555
|
+
|
|
1556
|
+
// src/dates.ts
|
|
1538
1557
|
var ERA = /^พ\.ศ\.\s?|\s?(BE|พ\.ศ\.)$/g;
|
|
1539
1558
|
var pad = function(n2) {
|
|
1540
1559
|
return (n2 < 10 ? "0" : "") + n2;
|
|
@@ -1640,22 +1659,6 @@ window.Aura = (() => {
|
|
|
1640
1659
|
const loc = o.locale || "th";
|
|
1641
1660
|
return fmt(localeTag(loc, o.calendar || defaultCalendar(loc)), f, d).replace(ERA, "");
|
|
1642
1661
|
}
|
|
1643
|
-
function useFormatDate() {
|
|
1644
|
-
const ctx = useAuraLocale(), locale = ctx.locale || "en", calendar = ctx.calendar;
|
|
1645
|
-
return React17.useCallback(
|
|
1646
|
-
function(iso, opts) {
|
|
1647
|
-
const o = opts || {}, loc = o.locale || locale;
|
|
1648
|
-
return formatDate(
|
|
1649
|
-
iso,
|
|
1650
|
-
Object.assign({}, o, {
|
|
1651
|
-
locale: loc,
|
|
1652
|
-
calendar: o.calendar || (o.locale ? void 0 : calendar) || defaultCalendar(loc)
|
|
1653
|
-
})
|
|
1654
|
-
);
|
|
1655
|
-
},
|
|
1656
|
-
[locale, calendar]
|
|
1657
|
-
);
|
|
1658
|
-
}
|
|
1659
1662
|
var MONTHS = null;
|
|
1660
1663
|
function monthIndex(word) {
|
|
1661
1664
|
if (!MONTHS) {
|
|
@@ -1693,6 +1696,24 @@ window.Aura = (() => {
|
|
|
1693
1696
|
const dt = new Date(y, mo - 1, d);
|
|
1694
1697
|
return dt.getMonth() === mo - 1 && dt.getDate() === d ? toISO(dt) : null;
|
|
1695
1698
|
}
|
|
1699
|
+
|
|
1700
|
+
// src/DatePicker.tsx
|
|
1701
|
+
function useFormatDate() {
|
|
1702
|
+
const ctx = useAuraLocale(), locale = ctx.locale || "en", calendar = ctx.calendar;
|
|
1703
|
+
return React17.useCallback(
|
|
1704
|
+
function(iso, opts) {
|
|
1705
|
+
const o = opts || {}, loc = o.locale || locale;
|
|
1706
|
+
return formatDate(
|
|
1707
|
+
iso,
|
|
1708
|
+
Object.assign({}, o, {
|
|
1709
|
+
locale: loc,
|
|
1710
|
+
calendar: o.calendar || (o.locale ? void 0 : calendar) || defaultCalendar(loc)
|
|
1711
|
+
})
|
|
1712
|
+
);
|
|
1713
|
+
},
|
|
1714
|
+
[locale, calendar]
|
|
1715
|
+
);
|
|
1716
|
+
}
|
|
1696
1717
|
var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
1697
1718
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "en", calendar = props.calendar || ctx.calendar || defaultCalendar(locale), tag = localeTag(locale, calendar);
|
|
1698
1719
|
const weekStart = props.weekStartsOn == null ? locale === "sv" ? 1 : 0 : props.weekStartsOn;
|
|
@@ -2740,7 +2761,12 @@ window.Aura = (() => {
|
|
|
2740
2761
|
const id = uid(), listId = id + "-list";
|
|
2741
2762
|
const box = React25.useRef(null);
|
|
2742
2763
|
const input = React25.useRef(null);
|
|
2743
|
-
const
|
|
2764
|
+
const qState = React25.useState(""), act = React25.useState(null);
|
|
2765
|
+
const query = props.query !== void 0 ? props.query : qState[0];
|
|
2766
|
+
function setQuery(v) {
|
|
2767
|
+
if (props.query === void 0) qState[1](v);
|
|
2768
|
+
if (props.onQueryChange) props.onQueryChange(v);
|
|
2769
|
+
}
|
|
2744
2770
|
const openRef = React25.useRef(props.open);
|
|
2745
2771
|
openRef.current = props.open;
|
|
2746
2772
|
const close = function() {
|
|
@@ -2766,15 +2792,15 @@ window.Aura = (() => {
|
|
|
2766
2792
|
React25.useEffect(
|
|
2767
2793
|
function() {
|
|
2768
2794
|
if (!props.open) {
|
|
2769
|
-
|
|
2770
|
-
act[1](
|
|
2795
|
+
if (query) setQuery("");
|
|
2796
|
+
act[1](null);
|
|
2771
2797
|
}
|
|
2772
2798
|
},
|
|
2773
2799
|
[props.open]
|
|
2774
2800
|
);
|
|
2775
|
-
const filter = props.filter || defaultFilter;
|
|
2801
|
+
const filter = props.filter === false ? null : props.filter || defaultFilter;
|
|
2776
2802
|
const shown = (props.items || []).filter(function(it) {
|
|
2777
|
-
return filter(it,
|
|
2803
|
+
return !filter || filter(it, query);
|
|
2778
2804
|
});
|
|
2779
2805
|
const groups = [];
|
|
2780
2806
|
shown.forEach(function(it) {
|
|
@@ -2796,7 +2822,10 @@ window.Aura = (() => {
|
|
|
2796
2822
|
}).filter(function(i2) {
|
|
2797
2823
|
return i2 >= 0;
|
|
2798
2824
|
});
|
|
2799
|
-
const
|
|
2825
|
+
const byId = act[0] == null ? -1 : flat.findIndex(function(it) {
|
|
2826
|
+
return it.id === act[0];
|
|
2827
|
+
});
|
|
2828
|
+
const active = enabled.indexOf(byId) >= 0 ? byId : enabled.length ? enabled[0] : -1;
|
|
2800
2829
|
const optId = function(i2) {
|
|
2801
2830
|
return id + "-o" + i2;
|
|
2802
2831
|
};
|
|
@@ -2821,7 +2850,7 @@ window.Aura = (() => {
|
|
|
2821
2850
|
if (dir === "first") n2 = 0;
|
|
2822
2851
|
else if (dir === "last") n2 = enabled.length - 1;
|
|
2823
2852
|
else n2 = (at + dir + enabled.length) % enabled.length;
|
|
2824
|
-
act[1](enabled[n2]);
|
|
2853
|
+
act[1](flat[enabled[n2]].id);
|
|
2825
2854
|
}
|
|
2826
2855
|
function onKey(e) {
|
|
2827
2856
|
if (e.key === "ArrowDown") {
|
|
@@ -2879,56 +2908,68 @@ window.Aura = (() => {
|
|
|
2879
2908
|
"aria-label": props.label || t.commandMenu,
|
|
2880
2909
|
placeholder: props.placeholder || t.commandPlaceholder,
|
|
2881
2910
|
className: "aura-command__input",
|
|
2882
|
-
value:
|
|
2911
|
+
value: query,
|
|
2883
2912
|
autoComplete: "off",
|
|
2884
2913
|
spellCheck: false,
|
|
2885
2914
|
onChange: function(e) {
|
|
2886
|
-
|
|
2887
|
-
act[1](
|
|
2915
|
+
setQuery(e.target.value);
|
|
2916
|
+
act[1](null);
|
|
2888
2917
|
},
|
|
2889
2918
|
onKeyDown: onKey
|
|
2890
2919
|
}
|
|
2891
2920
|
), /* @__PURE__ */ React25.createElement("kbd", { className: "aura-command__kbd" }, "Esc")),
|
|
2892
|
-
/* @__PURE__ */ React25.createElement(
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
"
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
g
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2921
|
+
/* @__PURE__ */ React25.createElement(
|
|
2922
|
+
"div",
|
|
2923
|
+
{
|
|
2924
|
+
className: "aura-command__list",
|
|
2925
|
+
id: listId,
|
|
2926
|
+
role: "listbox",
|
|
2927
|
+
"aria-label": props.label || t.commandMenu,
|
|
2928
|
+
"aria-busy": props.loading || void 0
|
|
2929
|
+
},
|
|
2930
|
+
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,
|
|
2931
|
+
!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) {
|
|
2932
|
+
const gid = id + "-g" + gi;
|
|
2933
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2934
|
+
"div",
|
|
2935
|
+
{
|
|
2936
|
+
key: g.name || gi,
|
|
2937
|
+
role: "group",
|
|
2938
|
+
"aria-labelledby": g.name ? gid : void 0,
|
|
2939
|
+
className: "aura-command__group"
|
|
2940
|
+
},
|
|
2941
|
+
g.name ? /* @__PURE__ */ React25.createElement("div", { className: "aura-command__heading", id: gid, role: "presentation" }, g.name) : null,
|
|
2942
|
+
g.items.map(function(it) {
|
|
2943
|
+
i++;
|
|
2944
|
+
const n2 = i;
|
|
2945
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2946
|
+
"div",
|
|
2947
|
+
{
|
|
2948
|
+
key: it.id,
|
|
2949
|
+
id: optId(n2),
|
|
2950
|
+
role: "option",
|
|
2951
|
+
"aria-selected": n2 === active,
|
|
2952
|
+
"aria-disabled": it.disabled || void 0,
|
|
2953
|
+
className: cx("aura-command__item", n2 === active && "is-active", it.disabled && "is-disabled"),
|
|
2954
|
+
onPointerDown: function(e) {
|
|
2955
|
+
e.preventDefault();
|
|
2956
|
+
},
|
|
2957
|
+
onPointerMove: function() {
|
|
2958
|
+
if (!it.disabled && act[0] !== it.id) act[1](it.id);
|
|
2959
|
+
},
|
|
2960
|
+
onClick: function() {
|
|
2961
|
+
run(it);
|
|
2962
|
+
}
|
|
2920
2963
|
},
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
}
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
);
|
|
2931
|
-
})),
|
|
2964
|
+
it.icon ? /* @__PURE__ */ React25.createElement(Icon, { name: it.icon }) : null,
|
|
2965
|
+
/* @__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),
|
|
2966
|
+
it.shortcut ? /* @__PURE__ */ React25.createElement("kbd", { className: "aura-command__kbd" }, it.shortcut) : null
|
|
2967
|
+
);
|
|
2968
|
+
})
|
|
2969
|
+
);
|
|
2970
|
+
})
|
|
2971
|
+
),
|
|
2972
|
+
/* @__PURE__ */ React25.createElement("span", { className: "aura-sr-only", role: "status" }, props.loading ? t.searching : props.loading === false && query ? t.results(flat.length) : ""),
|
|
2932
2973
|
/* @__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"))
|
|
2933
2974
|
)
|
|
2934
2975
|
),
|
|
@@ -3097,6 +3138,7 @@ window.Aura = (() => {
|
|
|
3097
3138
|
{ key: "owner", label: "OWNER" }
|
|
3098
3139
|
];
|
|
3099
3140
|
var SKELETON_WIDTHS = ["72%", "56%", "84%", "44%", "64%"];
|
|
3141
|
+
var STACK_WIDTHS = [360, 400, 480, 520, 560, 600, 640, 720, 768, 800, 900, 960, 1024];
|
|
3100
3142
|
var ROW_H_DEFAULT = 48;
|
|
3101
3143
|
var OVERSCAN = 8;
|
|
3102
3144
|
var FLEX_MIN = 160;
|
|
@@ -3117,11 +3159,20 @@ window.Aura = (() => {
|
|
|
3117
3159
|
const selectable = !!props.selectable;
|
|
3118
3160
|
const reorderable = props.reorderable !== false && !!props.columnControls;
|
|
3119
3161
|
const controls = !!props.columnControls;
|
|
3120
|
-
const
|
|
3162
|
+
const oneCallback = !!props.onStateChange;
|
|
3163
|
+
const sortState = useMaybeControlled(
|
|
3164
|
+
props.sort,
|
|
3165
|
+
props.defaultSort || null,
|
|
3166
|
+
oneCallback ? null : props.onSortChange
|
|
3167
|
+
);
|
|
3121
3168
|
const sort = sortState[0], setSort = sortState[1];
|
|
3122
3169
|
const selState = useMaybeControlled(props.selected, props.defaultSelected || [], props.onSelectionChange);
|
|
3123
3170
|
const selected = selState[0], setSelected = selState[1];
|
|
3124
|
-
const pageState = useMaybeControlled(
|
|
3171
|
+
const pageState = useMaybeControlled(
|
|
3172
|
+
props.page,
|
|
3173
|
+
props.defaultPage || 1,
|
|
3174
|
+
oneCallback ? null : props.onPageChange
|
|
3175
|
+
);
|
|
3125
3176
|
const orderState = useMaybeControlled(
|
|
3126
3177
|
props.columnOrder,
|
|
3127
3178
|
columns.map(function(c) {
|
|
@@ -3163,6 +3214,7 @@ window.Aura = (() => {
|
|
|
3163
3214
|
const measure = !!props.stackBelow || columns.some(function(c) {
|
|
3164
3215
|
return c.hideBelow != null;
|
|
3165
3216
|
});
|
|
3217
|
+
const dual = !!props.stackBelow && boxWidth[0] == null && STACK_WIDTHS.indexOf(props.stackBelow) >= 0;
|
|
3166
3218
|
React28.useEffect(
|
|
3167
3219
|
function() {
|
|
3168
3220
|
if (!measure || !wrapRef.current || typeof ResizeObserver === "undefined") return;
|
|
@@ -3174,9 +3226,15 @@ window.Aura = (() => {
|
|
|
3174
3226
|
ro.disconnect();
|
|
3175
3227
|
};
|
|
3176
3228
|
},
|
|
3177
|
-
[measure]
|
|
3229
|
+
[measure, dual]
|
|
3178
3230
|
);
|
|
3179
3231
|
const stacked = !!props.stackBelow && boxWidth[0] != null && boxWidth[0] < props.stackBelow;
|
|
3232
|
+
useIsoLayoutEffect(
|
|
3233
|
+
function() {
|
|
3234
|
+
if (measure && boxWidth[0] == null && wrapRef.current) boxWidth[1](wrapRef.current.getBoundingClientRect().width);
|
|
3235
|
+
},
|
|
3236
|
+
[measure]
|
|
3237
|
+
);
|
|
3180
3238
|
function tooNarrow(c) {
|
|
3181
3239
|
if (c.hideBelow == null || boxWidth[0] == null || stacked) return false;
|
|
3182
3240
|
const px = typeof c.hideBelow === "number" ? c.hideBelow : BP[c.hideBelow];
|
|
@@ -3284,11 +3342,15 @@ window.Aura = (() => {
|
|
|
3284
3342
|
const pageRows = pageSize && !manual ? view.slice(first, first + pageSize) : view;
|
|
3285
3343
|
const canSortAny = !busy && (manual ? total > 1 : rows.length > 1);
|
|
3286
3344
|
const shownTotal = manual && props.totalRows == null ? first + rows.length : total;
|
|
3287
|
-
const linkPaging = !!props.getPageHref && !props.onPageChange;
|
|
3345
|
+
const linkPaging = !!props.getPageHref && !props.onPageChange && !oneCallback;
|
|
3288
3346
|
const prevLink = React28.useRef(null), nextLink = React28.useRef(null);
|
|
3289
|
-
function
|
|
3347
|
+
function emit(s, p) {
|
|
3348
|
+
if (props.onStateChange) props.onStateChange({ sort: s, page: p });
|
|
3349
|
+
}
|
|
3350
|
+
function goPage(p, focus, quiet) {
|
|
3290
3351
|
const next = Math.min(Math.max(1, p), pageCount);
|
|
3291
3352
|
if (next === page) return false;
|
|
3353
|
+
if (!quiet) emit(sort, next);
|
|
3292
3354
|
if (linkPaging) {
|
|
3293
3355
|
const a = next === page - 1 ? prevLink.current : next === page + 1 ? nextLink.current : null;
|
|
3294
3356
|
if (a) a.click();
|
|
@@ -3300,8 +3362,12 @@ window.Aura = (() => {
|
|
|
3300
3362
|
return true;
|
|
3301
3363
|
}
|
|
3302
3364
|
function sortBy(key) {
|
|
3303
|
-
|
|
3304
|
-
|
|
3365
|
+
applySort(nextSort(key));
|
|
3366
|
+
}
|
|
3367
|
+
function applySort(s) {
|
|
3368
|
+
setSort(s);
|
|
3369
|
+
if (!(manual && linkPaging)) goPage(1, void 0, true);
|
|
3370
|
+
emit(s, 1);
|
|
3305
3371
|
}
|
|
3306
3372
|
const rowHref = props.getRowHref;
|
|
3307
3373
|
function followRow(el, e) {
|
|
@@ -3516,16 +3582,14 @@ window.Aura = (() => {
|
|
|
3516
3582
|
label: t.sortAsc,
|
|
3517
3583
|
icon: "arrow-up",
|
|
3518
3584
|
onSelect: function() {
|
|
3519
|
-
|
|
3520
|
-
goPage(1);
|
|
3585
|
+
applySort({ key: c.key, dir: "asc" });
|
|
3521
3586
|
}
|
|
3522
3587
|
},
|
|
3523
3588
|
{
|
|
3524
3589
|
label: t.sortDesc,
|
|
3525
3590
|
icon: "arrow-down",
|
|
3526
3591
|
onSelect: function() {
|
|
3527
|
-
|
|
3528
|
-
goPage(1);
|
|
3592
|
+
applySort({ key: c.key, dir: "desc" });
|
|
3529
3593
|
}
|
|
3530
3594
|
},
|
|
3531
3595
|
{ separator: true }
|
|
@@ -3962,9 +4026,10 @@ window.Aura = (() => {
|
|
|
3962
4026
|
className: "aura-icon-btn",
|
|
3963
4027
|
"aria-label": label,
|
|
3964
4028
|
onClick: function(e) {
|
|
3965
|
-
if (props.onPageChange) {
|
|
4029
|
+
if (props.onPageChange || oneCallback) {
|
|
3966
4030
|
e.preventDefault();
|
|
3967
4031
|
pageState[1](p);
|
|
4032
|
+
emit(sort, p);
|
|
3968
4033
|
}
|
|
3969
4034
|
}
|
|
3970
4035
|
},
|
|
@@ -3988,7 +4053,7 @@ window.Aura = (() => {
|
|
|
3988
4053
|
} else if (height && rows.length && !loading) {
|
|
3989
4054
|
foot = /* @__PURE__ */ React28.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React28.createElement("span", null, t.rowCount(shownTotal)), selectable && selected.length ? /* @__PURE__ */ React28.createElement("span", null, t.selectedCount(selected.length)) : /* @__PURE__ */ React28.createElement("span", null));
|
|
3990
4055
|
}
|
|
3991
|
-
|
|
4056
|
+
function renderStacked(wrapRefArg) {
|
|
3992
4057
|
const titleCol = vis[0], pillCol = vis.filter(function(c) {
|
|
3993
4058
|
return c.pill && c !== titleCol;
|
|
3994
4059
|
})[0];
|
|
@@ -4052,7 +4117,7 @@ window.Aura = (() => {
|
|
|
4052
4117
|
return /* @__PURE__ */ React28.createElement(
|
|
4053
4118
|
"div",
|
|
4054
4119
|
{
|
|
4055
|
-
ref:
|
|
4120
|
+
ref: wrapRefArg,
|
|
4056
4121
|
"data-density": props.density,
|
|
4057
4122
|
className: cx("aura-table aura-table--stacked", refreshing && "is-refreshing", props.className),
|
|
4058
4123
|
role: "region",
|
|
@@ -4073,15 +4138,16 @@ window.Aura = (() => {
|
|
|
4073
4138
|
foot
|
|
4074
4139
|
);
|
|
4075
4140
|
}
|
|
4141
|
+
if (stacked) return renderStacked(wrapMerged);
|
|
4076
4142
|
const scrollStyle = {
|
|
4077
4143
|
scrollPaddingLeft: "calc(var(--aura-space-6)" + selW + " + " + acc + "px)",
|
|
4078
4144
|
scrollPaddingTop: ROW_H + "px"
|
|
4079
4145
|
};
|
|
4080
4146
|
if (height) scrollStyle.height = height + "px";
|
|
4081
|
-
|
|
4147
|
+
const gridEl = /* @__PURE__ */ React28.createElement(
|
|
4082
4148
|
"div",
|
|
4083
4149
|
{
|
|
4084
|
-
ref: wrapMerged,
|
|
4150
|
+
ref: dual ? void 0 : wrapMerged,
|
|
4085
4151
|
"data-density": props.density,
|
|
4086
4152
|
className: cx("aura-table", scrolledX[0] && "is-scrolled-x", refreshing && "is-refreshing", props.className)
|
|
4087
4153
|
},
|
|
@@ -4137,6 +4203,8 @@ window.Aura = (() => {
|
|
|
4137
4203
|
}
|
|
4138
4204
|
) : null
|
|
4139
4205
|
);
|
|
4206
|
+
if (!dual) return gridEl;
|
|
4207
|
+
return /* @__PURE__ */ React28.createElement("div", { ref: wrapMerged, className: "aura-table-dual", "data-stack-below": props.stackBelow }, renderStacked(void 0), gridEl);
|
|
4140
4208
|
});
|
|
4141
4209
|
|
|
4142
4210
|
// src/Card.tsx
|
|
@@ -4455,7 +4523,7 @@ window.Aura = (() => {
|
|
|
4455
4523
|
var React32 = __toESM(require_react(), 1);
|
|
4456
4524
|
var Breadcrumb = React32.forwardRef(function Breadcrumb2(props, ref) {
|
|
4457
4525
|
const t = useStrings();
|
|
4458
|
-
const Link = useLinkComponent();
|
|
4526
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
4459
4527
|
const items2 = props.items || [];
|
|
4460
4528
|
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) {
|
|
4461
4529
|
const last = i === items2.length - 1;
|
|
@@ -4504,7 +4572,11 @@ window.Aura = (() => {
|
|
|
4504
4572
|
|
|
4505
4573
|
// src/responsive.tsx
|
|
4506
4574
|
var React34 = __toESM(require_react(), 1);
|
|
4575
|
+
|
|
4576
|
+
// src/breakpoints.ts
|
|
4507
4577
|
var breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
4578
|
+
|
|
4579
|
+
// src/responsive.tsx
|
|
4508
4580
|
var ORDER = ["base", "sm", "md", "lg", "xl"];
|
|
4509
4581
|
function useBreakpoint() {
|
|
4510
4582
|
return React34.useSyncExternalStore(subscribe, current, function() {
|
|
@@ -4598,26 +4670,25 @@ window.Aura = (() => {
|
|
|
4598
4670
|
var AppShell = React38.forwardRef(function AppShell2(props, ref) {
|
|
4599
4671
|
const t = useStrings();
|
|
4600
4672
|
const bp = useBreakpoint();
|
|
4601
|
-
const
|
|
4673
|
+
const wide = bp === "lg" || bp === "xl";
|
|
4602
4674
|
const st = React38.useState(false), open = st[0], setOpen = st[1];
|
|
4603
4675
|
React38.useEffect(
|
|
4604
4676
|
function() {
|
|
4605
|
-
if (
|
|
4677
|
+
if (wide) setOpen(false);
|
|
4606
4678
|
},
|
|
4607
|
-
[
|
|
4679
|
+
[wide]
|
|
4608
4680
|
);
|
|
4609
|
-
const navEl = props.nav;
|
|
4610
|
-
const
|
|
4681
|
+
const navEl = props.nav && React38.isValidElement(props.nav) ? props.nav : null;
|
|
4682
|
+
const drawerNav = navEl ? React38.cloneElement(navEl, {
|
|
4611
4683
|
onChange: function(id) {
|
|
4612
4684
|
if (navEl.props.onChange) navEl.props.onChange(id);
|
|
4613
4685
|
setOpen(false);
|
|
4614
4686
|
},
|
|
4615
4687
|
className: cx(navEl.props.className, "is-in-drawer"),
|
|
4616
|
-
/* The drawer is already full-size: never a rail, no collapse button. */
|
|
4617
4688
|
collapsed: false,
|
|
4618
4689
|
collapsible: false
|
|
4619
4690
|
}) : props.nav;
|
|
4620
|
-
return /* @__PURE__ */ React38.createElement("div", { ref, className: cx("aura-shell",
|
|
4691
|
+
return /* @__PURE__ */ React38.createElement("div", { ref, className: cx("aura-shell", props.className) }, props.nav ? /* @__PURE__ */ React38.createElement("div", { className: "aura-shell__nav" }, props.nav) : null, props.nav ? /* @__PURE__ */ React38.createElement(
|
|
4621
4692
|
Drawer,
|
|
4622
4693
|
{
|
|
4623
4694
|
open,
|
|
@@ -4629,10 +4700,11 @@ window.Aura = (() => {
|
|
|
4629
4700
|
"aria-label": props.navLabel || t.navigation,
|
|
4630
4701
|
dismissible: true
|
|
4631
4702
|
},
|
|
4632
|
-
|
|
4633
|
-
) : null, /* @__PURE__ */ React38.createElement("div", { className: "aura-shell__main" }, props.header ||
|
|
4703
|
+
drawerNav
|
|
4704
|
+
) : null, /* @__PURE__ */ React38.createElement("div", { className: "aura-shell__main" }, props.header || props.nav ? /* @__PURE__ */ React38.createElement("header", { className: cx("aura-shell__bar", !props.header && "aura-shell__bar--menu-only") }, props.nav ? /* @__PURE__ */ React38.createElement(
|
|
4634
4705
|
IconButton,
|
|
4635
4706
|
{
|
|
4707
|
+
className: "aura-shell__menu",
|
|
4636
4708
|
icon: "menu",
|
|
4637
4709
|
label: props.menuLabel || t.openNav,
|
|
4638
4710
|
size: "md",
|
|
@@ -4673,7 +4745,7 @@ window.Aura = (() => {
|
|
|
4673
4745
|
const ch = props.change;
|
|
4674
4746
|
const dir = ch && (ch.direction || "flat");
|
|
4675
4747
|
const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
|
|
4676
|
-
const Link = useLinkComponent();
|
|
4748
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
4677
4749
|
const v = props.value;
|
|
4678
4750
|
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, ""));
|
|
4679
4751
|
const Tag3 = props.href ? Link : props.onClick ? "button" : "div";
|
|
@@ -4697,16 +4769,21 @@ window.Aura = (() => {
|
|
|
4697
4769
|
// src/TimePicker.tsx
|
|
4698
4770
|
var React41 = __toESM(require_react(), 1);
|
|
4699
4771
|
var import_react_dom9 = __toESM(require_react_dom(), 1);
|
|
4772
|
+
|
|
4773
|
+
// src/text.ts
|
|
4774
|
+
function formatBytes(n2) {
|
|
4775
|
+
if (n2 == null) return "";
|
|
4776
|
+
if (n2 < 1024) return n2 + " B";
|
|
4777
|
+
let u = ["KB", "MB", "GB"], i = -1;
|
|
4778
|
+
do {
|
|
4779
|
+
n2 /= 1024;
|
|
4780
|
+
i++;
|
|
4781
|
+
} while (n2 >= 1024 && i < u.length - 1);
|
|
4782
|
+
return (n2 >= 10 || Math.round(n2) === n2 ? Math.round(n2) : n2.toFixed(1)) + " " + u[i];
|
|
4783
|
+
}
|
|
4700
4784
|
function pad2(n2) {
|
|
4701
4785
|
return (n2 < 10 ? "0" : "") + n2;
|
|
4702
4786
|
}
|
|
4703
|
-
function toMin(t) {
|
|
4704
|
-
const m = /^(\d{2}):(\d{2})$/.exec(t || "");
|
|
4705
|
-
return m ? +m[1] * 60 + +m[2] : null;
|
|
4706
|
-
}
|
|
4707
|
-
function fromMin(n2) {
|
|
4708
|
-
return pad2(Math.floor(n2 / 60)) + ":" + pad2(n2 % 60);
|
|
4709
|
-
}
|
|
4710
4787
|
function parseTime(text) {
|
|
4711
4788
|
let s = String(text || "").trim().toLowerCase().replace(/\s*(น\.?|นาฬิกา)$/, "").trim();
|
|
4712
4789
|
const pm = /\s*(pm|p\.m\.)$/.test(s), am = /\s*(am|a\.m\.)$/.test(s);
|
|
@@ -4719,6 +4796,18 @@ window.Aura = (() => {
|
|
|
4719
4796
|
if (hh > 23 || mm > 59) return null;
|
|
4720
4797
|
return pad2(hh) + ":" + pad2(mm);
|
|
4721
4798
|
}
|
|
4799
|
+
|
|
4800
|
+
// src/TimePicker.tsx
|
|
4801
|
+
function pad3(n2) {
|
|
4802
|
+
return (n2 < 10 ? "0" : "") + n2;
|
|
4803
|
+
}
|
|
4804
|
+
function toMin(t) {
|
|
4805
|
+
const m = /^(\d{2}):(\d{2})$/.exec(t || "");
|
|
4806
|
+
return m ? +m[1] * 60 + +m[2] : null;
|
|
4807
|
+
}
|
|
4808
|
+
function fromMin(n2) {
|
|
4809
|
+
return pad3(Math.floor(n2 / 60)) + ":" + pad3(n2 % 60);
|
|
4810
|
+
}
|
|
4722
4811
|
var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
4723
4812
|
const t = useStrings();
|
|
4724
4813
|
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
@@ -5019,16 +5108,6 @@ window.Aura = (() => {
|
|
|
5019
5108
|
|
|
5020
5109
|
// src/FileUpload.tsx
|
|
5021
5110
|
var React42 = __toESM(require_react(), 1);
|
|
5022
|
-
function formatBytes(n2) {
|
|
5023
|
-
if (n2 == null) return "";
|
|
5024
|
-
if (n2 < 1024) return n2 + " B";
|
|
5025
|
-
let u = ["KB", "MB", "GB"], i = -1;
|
|
5026
|
-
do {
|
|
5027
|
-
n2 /= 1024;
|
|
5028
|
-
i++;
|
|
5029
|
-
} while (n2 >= 1024 && i < u.length - 1);
|
|
5030
|
-
return (n2 >= 10 || Math.round(n2) === n2 ? Math.round(n2) : n2.toFixed(1)) + " " + u[i];
|
|
5031
|
-
}
|
|
5032
5111
|
function matches(file, accept) {
|
|
5033
5112
|
if (!accept) return true;
|
|
5034
5113
|
const name = (file.name || "").toLowerCase(), type = (file.type || "").toLowerCase();
|
|
@@ -5487,6 +5566,8 @@ window.Aura = (() => {
|
|
|
5487
5566
|
|
|
5488
5567
|
// src/colorScheme.tsx
|
|
5489
5568
|
var React44 = __toESM(require_react(), 1);
|
|
5569
|
+
|
|
5570
|
+
// src/colorSchemeScript.ts
|
|
5490
5571
|
var DEFAULT_KEY = "aura-color-scheme";
|
|
5491
5572
|
var SCHEMES = ["light", "dark", "system"];
|
|
5492
5573
|
var EVENT = "aura-color-scheme";
|
|
@@ -5498,6 +5579,8 @@ window.Aura = (() => {
|
|
|
5498
5579
|
const fallback = JSON.stringify(options && options.defaultScheme || "system");
|
|
5499
5580
|
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){}})();`;
|
|
5500
5581
|
}
|
|
5582
|
+
|
|
5583
|
+
// src/colorScheme.tsx
|
|
5501
5584
|
function ColorSchemeScript(props) {
|
|
5502
5585
|
return /* @__PURE__ */ React44.createElement(
|
|
5503
5586
|
"script",
|
|
@@ -5668,7 +5751,10 @@ window.Aura = (() => {
|
|
|
5668
5751
|
rows
|
|
5669
5752
|
);
|
|
5670
5753
|
}
|
|
5671
|
-
const style = {
|
|
5754
|
+
const style = {
|
|
5755
|
+
width: props.width,
|
|
5756
|
+
height: props.height
|
|
5757
|
+
};
|
|
5672
5758
|
if (v === "circle") {
|
|
5673
5759
|
style.width = style.height = props.size || props.width || 40;
|
|
5674
5760
|
}
|
|
@@ -5722,7 +5808,7 @@ window.Aura = (() => {
|
|
|
5722
5808
|
if (p >= 1 && p <= count && p !== page) st[1](p);
|
|
5723
5809
|
}
|
|
5724
5810
|
const link = props.getHref;
|
|
5725
|
-
const Link = useLinkComponent();
|
|
5811
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
5726
5812
|
function item(p, label, extra) {
|
|
5727
5813
|
const common = Object.assign(
|
|
5728
5814
|
{
|
|
@@ -5757,29 +5843,40 @@ window.Aura = (() => {
|
|
|
5757
5843
|
label
|
|
5758
5844
|
);
|
|
5759
5845
|
}
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5846
|
+
function arrow(p, icon, label, rel, disabled) {
|
|
5847
|
+
if (!link || disabled)
|
|
5848
|
+
return /* @__PURE__ */ React49.createElement(
|
|
5849
|
+
IconButton,
|
|
5850
|
+
{
|
|
5851
|
+
icon,
|
|
5852
|
+
label,
|
|
5853
|
+
disabled,
|
|
5854
|
+
onClick: function() {
|
|
5855
|
+
go(p);
|
|
5856
|
+
}
|
|
5857
|
+
}
|
|
5858
|
+
);
|
|
5859
|
+
return /* @__PURE__ */ React49.createElement(
|
|
5860
|
+
Link,
|
|
5861
|
+
{
|
|
5862
|
+
href: link(p),
|
|
5863
|
+
rel,
|
|
5864
|
+
className: "aura-icon-btn",
|
|
5865
|
+
"aria-label": label,
|
|
5866
|
+
title: label,
|
|
5867
|
+
onClick: function(e) {
|
|
5868
|
+
if (props.onChange) {
|
|
5869
|
+
e.preventDefault();
|
|
5870
|
+
go(p);
|
|
5871
|
+
}
|
|
5872
|
+
}
|
|
5873
|
+
},
|
|
5874
|
+
/* @__PURE__ */ React49.createElement(Icon, { name: icon, size: "sm" })
|
|
5875
|
+
);
|
|
5876
|
+
}
|
|
5877
|
+
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) {
|
|
5771
5878
|
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");
|
|
5772
|
-
})), /* @__PURE__ */ React49.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)),
|
|
5773
|
-
IconButton,
|
|
5774
|
-
{
|
|
5775
|
-
icon: "chevron-right",
|
|
5776
|
-
label: t.nextPage,
|
|
5777
|
-
disabled: page >= count,
|
|
5778
|
-
onClick: function() {
|
|
5779
|
-
go(page + 1);
|
|
5780
|
-
}
|
|
5781
|
-
}
|
|
5782
|
-
));
|
|
5879
|
+
})), /* @__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));
|
|
5783
5880
|
});
|
|
5784
5881
|
|
|
5785
5882
|
// src/Accordion.tsx
|