@jirawatpyk/aura-react 4.7.2 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/aura.bundle.js +1075 -595
- package/dist/cjs/index.cjs +1074 -594
- package/dist/esm/Accordion.js +66 -0
- package/dist/esm/Alert.js +31 -0
- package/dist/esm/AppShell.js +55 -0
- package/dist/esm/Avatar.js +39 -0
- package/dist/esm/Badge.js +26 -0
- package/dist/esm/Breadcrumb.js +16 -0
- package/dist/esm/Card.js +26 -0
- package/dist/esm/Combobox.js +311 -236
- package/dist/esm/Container.js +18 -0
- package/dist/esm/DatePicker.js +1 -1
- package/dist/esm/Dialog.js +1 -1
- package/dist/esm/EmptyState.js +22 -0
- package/dist/esm/Field.js +46 -0
- package/dist/esm/FileUpload.js +1 -1
- package/dist/esm/Grid.js +21 -0
- package/dist/esm/NumberField.js +175 -0
- package/dist/esm/Pagination.js +94 -0
- package/dist/esm/Popover.js +131 -0
- package/dist/esm/Progress.js +40 -0
- package/dist/esm/RadioGroup.js +46 -0
- package/dist/esm/SegmentedControl.js +104 -0
- package/dist/esm/Select.js +48 -0
- package/dist/esm/SideNav.js +36 -0
- package/dist/esm/Skeleton.js +29 -0
- package/dist/esm/Stack.js +20 -0
- package/dist/esm/Stepper.js +54 -0
- package/dist/esm/Switch.js +30 -0
- package/dist/esm/Tabs.js +89 -0
- package/dist/esm/Tag.js +42 -0
- package/dist/esm/TextField.js +39 -0
- package/dist/esm/Textarea.js +38 -0
- package/dist/esm/TimePicker.js +1 -1
- package/dist/esm/Toaster.js +124 -0
- package/dist/esm/Tooltip.js +80 -0
- package/dist/esm/index.js +33 -5
- package/dist/esm/internal.js +5 -0
- package/dist/esm/locale.js +12 -0
- package/dist/esm/responsive.js +50 -0
- package/dist/index.d.ts +109 -10
- package/dist/styles.css +107 -0
- package/package.json +1 -1
- package/dist/esm/extra.js +0 -412
- package/dist/esm/feedback.js +0 -220
- package/dist/esm/forms.js +0 -212
- package/dist/esm/layout.js +0 -183
- package/dist/esm/layout2.js +0 -138
- /package/dist/esm/{overlay.js → useModal.js} +0 -0
package/dist/cjs/index.cjs
CHANGED
|
@@ -60,17 +60,20 @@ __export(index_exports, {
|
|
|
60
60
|
Icon: () => Icon,
|
|
61
61
|
IconButton: () => IconButton,
|
|
62
62
|
Menu: () => Menu,
|
|
63
|
+
NumberField: () => NumberField,
|
|
63
64
|
Pagination: () => Pagination,
|
|
64
65
|
Popover: () => Popover,
|
|
65
66
|
Progress: () => Progress,
|
|
66
67
|
RadioGroup: () => RadioGroup,
|
|
67
68
|
STRINGS: () => STRINGS,
|
|
69
|
+
SegmentedControl: () => SegmentedControl,
|
|
68
70
|
Select: () => Select,
|
|
69
71
|
SideNav: () => SideNav,
|
|
70
72
|
Skeleton: () => Skeleton,
|
|
71
73
|
Stack: () => Stack,
|
|
72
74
|
Stat: () => Stat,
|
|
73
75
|
StatusPill: () => StatusPill,
|
|
76
|
+
Stepper: () => Stepper,
|
|
74
77
|
Surface: () => Surface,
|
|
75
78
|
Switch: () => Switch,
|
|
76
79
|
Tabs: () => Tabs,
|
|
@@ -185,6 +188,10 @@ function useMergedRef(a, b) {
|
|
|
185
188
|
[a, b]
|
|
186
189
|
);
|
|
187
190
|
}
|
|
191
|
+
var TONES = ["neutral", "accent", "success", "warning", "danger"];
|
|
192
|
+
function tone(t) {
|
|
193
|
+
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
194
|
+
}
|
|
188
195
|
|
|
189
196
|
// src/Icon.tsx
|
|
190
197
|
var h = React2.createElement;
|
|
@@ -514,7 +521,7 @@ var StatusPill = React8.forwardRef(function StatusPill2(props, ref) {
|
|
|
514
521
|
return /* @__PURE__ */ React8.createElement("span", { ref, className: cx("aura-pill", "aura-pill--" + tone2, props.className) }, /* @__PURE__ */ React8.createElement(Icon, { name: TONE_ICON[tone2] || "circle", size: 12 }), props.children);
|
|
515
522
|
});
|
|
516
523
|
|
|
517
|
-
// src/
|
|
524
|
+
// src/Field.tsx
|
|
518
525
|
var React10 = __toESM(require("react"), 1);
|
|
519
526
|
|
|
520
527
|
// src/locale.tsx
|
|
@@ -602,6 +609,12 @@ var STRINGS = {
|
|
|
602
609
|
return "Up to " + n2 + " files";
|
|
603
610
|
},
|
|
604
611
|
colorScheme: "Colour scheme",
|
|
612
|
+
increase: "Increase",
|
|
613
|
+
decrease: "Decrease",
|
|
614
|
+
stepDone: "completed",
|
|
615
|
+
stepOf: function(i, total) {
|
|
616
|
+
return "Step " + i + " of " + total;
|
|
617
|
+
},
|
|
605
618
|
schemeLight: "Light",
|
|
606
619
|
schemeDark: "Dark",
|
|
607
620
|
schemeSystem: "System",
|
|
@@ -694,6 +707,12 @@ var STRINGS = {
|
|
|
694
707
|
return "\u0E41\u0E19\u0E1A\u0E44\u0E14\u0E49\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 " + n2 + " \u0E44\u0E1F\u0E25\u0E4C";
|
|
695
708
|
},
|
|
696
709
|
colorScheme: "\u0E42\u0E2B\u0E21\u0E14\u0E2A\u0E35",
|
|
710
|
+
increase: "\u0E40\u0E1E\u0E34\u0E48\u0E21",
|
|
711
|
+
decrease: "\u0E25\u0E14",
|
|
712
|
+
stepDone: "\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E41\u0E25\u0E49\u0E27",
|
|
713
|
+
stepOf: function(i, total) {
|
|
714
|
+
return "\u0E02\u0E31\u0E49\u0E19\u0E17\u0E35\u0E48 " + i + " \u0E08\u0E32\u0E01 " + total;
|
|
715
|
+
},
|
|
697
716
|
schemeLight: "\u0E2A\u0E27\u0E48\u0E32\u0E07",
|
|
698
717
|
schemeDark: "\u0E21\u0E37\u0E14",
|
|
699
718
|
schemeSystem: "\u0E15\u0E32\u0E21\u0E23\u0E30\u0E1A\u0E1A",
|
|
@@ -730,7 +749,7 @@ function useStrings() {
|
|
|
730
749
|
return useAuraLocale().strings;
|
|
731
750
|
}
|
|
732
751
|
|
|
733
|
-
// src/
|
|
752
|
+
// src/Field.tsx
|
|
734
753
|
var h2 = React10.createElement;
|
|
735
754
|
var Field = React10.forwardRef(function Field2(props, ref) {
|
|
736
755
|
const t = useStrings();
|
|
@@ -767,10 +786,13 @@ var FIELD_KEYS = [
|
|
|
767
786
|
"options",
|
|
768
787
|
"placeholder"
|
|
769
788
|
];
|
|
770
|
-
|
|
789
|
+
|
|
790
|
+
// src/TextField.tsx
|
|
791
|
+
var React11 = __toESM(require("react"), 1);
|
|
792
|
+
var TextField = React11.forwardRef(function TextField2(props, ref) {
|
|
771
793
|
const auto = uid(), id = props.id || auto;
|
|
772
794
|
const rest = omit(props, FIELD_KEYS);
|
|
773
|
-
return /* @__PURE__ */
|
|
795
|
+
return /* @__PURE__ */ React11.createElement(
|
|
774
796
|
Field,
|
|
775
797
|
{
|
|
776
798
|
id,
|
|
@@ -782,7 +804,7 @@ var TextField = React10.forwardRef(function TextField2(props, ref) {
|
|
|
782
804
|
disabled: props.disabled,
|
|
783
805
|
className: props.className
|
|
784
806
|
},
|
|
785
|
-
/* @__PURE__ */
|
|
807
|
+
/* @__PURE__ */ React11.createElement("div", { className: cx("aura-input", props.icon && "has-icon", props.suffix && "has-suffix") }, props.icon ? /* @__PURE__ */ React11.createElement(Icon, { name: props.icon, className: "aura-input__icon" }) : null, /* @__PURE__ */ React11.createElement(
|
|
786
808
|
"input",
|
|
787
809
|
{
|
|
788
810
|
type: "text",
|
|
@@ -795,13 +817,16 @@ var TextField = React10.forwardRef(function TextField2(props, ref) {
|
|
|
795
817
|
"aria-invalid": props.error ? true : void 0,
|
|
796
818
|
"aria-describedby": describedBy(id, props)
|
|
797
819
|
}
|
|
798
|
-
), props.suffix ? /* @__PURE__ */
|
|
820
|
+
), props.suffix ? /* @__PURE__ */ React11.createElement("span", { className: "aura-input__suffix" }, props.suffix) : null)
|
|
799
821
|
);
|
|
800
822
|
});
|
|
801
|
-
|
|
823
|
+
|
|
824
|
+
// src/Textarea.tsx
|
|
825
|
+
var React12 = __toESM(require("react"), 1);
|
|
826
|
+
var Textarea = React12.forwardRef(function Textarea2(props, ref) {
|
|
802
827
|
const auto = uid(), id = props.id || auto;
|
|
803
828
|
const rest = omit(props, FIELD_KEYS);
|
|
804
|
-
return /* @__PURE__ */
|
|
829
|
+
return /* @__PURE__ */ React12.createElement(
|
|
805
830
|
Field,
|
|
806
831
|
{
|
|
807
832
|
id,
|
|
@@ -813,7 +838,7 @@ var Textarea = React10.forwardRef(function Textarea2(props, ref) {
|
|
|
813
838
|
disabled: props.disabled,
|
|
814
839
|
className: props.className
|
|
815
840
|
},
|
|
816
|
-
/* @__PURE__ */
|
|
841
|
+
/* @__PURE__ */ React12.createElement(
|
|
817
842
|
"textarea",
|
|
818
843
|
{
|
|
819
844
|
rows: 4,
|
|
@@ -829,19 +854,23 @@ var Textarea = React10.forwardRef(function Textarea2(props, ref) {
|
|
|
829
854
|
)
|
|
830
855
|
);
|
|
831
856
|
});
|
|
832
|
-
|
|
857
|
+
|
|
858
|
+
// src/Select.tsx
|
|
859
|
+
var React13 = __toESM(require("react"), 1);
|
|
860
|
+
var h3 = React13.createElement;
|
|
861
|
+
var Select = React13.forwardRef(function Select2(props, ref) {
|
|
833
862
|
const auto = uid(), id = props.id || auto;
|
|
834
863
|
const rest = omit(props, FIELD_KEYS.concat(["children"]));
|
|
835
864
|
const opts = (props.options || []).map(function(o) {
|
|
836
865
|
const v = typeof o === "object" ? o : { value: o, label: o };
|
|
837
|
-
return /* @__PURE__ */
|
|
866
|
+
return /* @__PURE__ */ React13.createElement("option", { key: v.value, value: v.value, disabled: v.disabled }, v.label);
|
|
838
867
|
});
|
|
839
868
|
if (props.placeholder)
|
|
840
869
|
opts.unshift(
|
|
841
|
-
/* @__PURE__ */
|
|
870
|
+
/* @__PURE__ */ React13.createElement("option", { key: "__ph", value: "", disabled: true }, props.placeholder)
|
|
842
871
|
);
|
|
843
872
|
const extra = props.value === void 0 && props.defaultValue === void 0 && props.placeholder ? { defaultValue: "" } : {};
|
|
844
|
-
return /* @__PURE__ */
|
|
873
|
+
return /* @__PURE__ */ React13.createElement(
|
|
845
874
|
Field,
|
|
846
875
|
{
|
|
847
876
|
id,
|
|
@@ -853,7 +882,7 @@ var Select = React10.forwardRef(function Select2(props, ref) {
|
|
|
853
882
|
disabled: props.disabled,
|
|
854
883
|
className: props.className
|
|
855
884
|
},
|
|
856
|
-
/* @__PURE__ */
|
|
885
|
+
/* @__PURE__ */ React13.createElement("div", { className: cx("aura-input aura-select", props.icon && "has-icon") }, props.icon ? /* @__PURE__ */ React13.createElement(Icon, { name: props.icon, className: "aura-input__icon" }) : null, h3(
|
|
857
886
|
"select",
|
|
858
887
|
Object.assign(extra, rest, {
|
|
859
888
|
ref,
|
|
@@ -865,10 +894,13 @@ var Select = React10.forwardRef(function Select2(props, ref) {
|
|
|
865
894
|
}),
|
|
866
895
|
opts,
|
|
867
896
|
props.children
|
|
868
|
-
), /* @__PURE__ */
|
|
897
|
+
), /* @__PURE__ */ React13.createElement(Icon, { name: "chevron-down", className: "aura-select__chevron" }))
|
|
869
898
|
);
|
|
870
899
|
});
|
|
871
|
-
|
|
900
|
+
|
|
901
|
+
// src/RadioGroup.tsx
|
|
902
|
+
var React14 = __toESM(require("react"), 1);
|
|
903
|
+
var RadioGroup = React14.forwardRef(function RadioGroup2(props, ref) {
|
|
872
904
|
const auto = uid(), id = props.id || auto;
|
|
873
905
|
const st = useMaybeControlled(
|
|
874
906
|
props.value,
|
|
@@ -876,7 +908,7 @@ var RadioGroup = React10.forwardRef(function RadioGroup2(props, ref) {
|
|
|
876
908
|
props.onChange
|
|
877
909
|
);
|
|
878
910
|
const name = props.name || id;
|
|
879
|
-
return /* @__PURE__ */
|
|
911
|
+
return /* @__PURE__ */ React14.createElement(
|
|
880
912
|
"fieldset",
|
|
881
913
|
{
|
|
882
914
|
ref,
|
|
@@ -885,10 +917,10 @@ var RadioGroup = React10.forwardRef(function RadioGroup2(props, ref) {
|
|
|
885
917
|
"aria-invalid": props.error ? true : void 0,
|
|
886
918
|
disabled: props.disabled
|
|
887
919
|
},
|
|
888
|
-
props.label ? /* @__PURE__ */
|
|
889
|
-
/* @__PURE__ */
|
|
920
|
+
props.label ? /* @__PURE__ */ React14.createElement("legend", { className: "aura-field__label" }, props.label, props.required ? /* @__PURE__ */ React14.createElement("span", { className: "aura-field__req", "aria-hidden": true }, " *") : null) : null,
|
|
921
|
+
/* @__PURE__ */ React14.createElement("div", { className: cx("aura-radio-group__list", props.orientation === "horizontal" && "is-horizontal") }, (props.options || []).map(function(o) {
|
|
890
922
|
const v = typeof o === "object" ? o : { value: o, label: o };
|
|
891
|
-
return /* @__PURE__ */
|
|
923
|
+
return /* @__PURE__ */ React14.createElement("label", { key: v.value, className: cx("aura-choice", v.disabled && "is-disabled") }, /* @__PURE__ */ React14.createElement(
|
|
892
924
|
"input",
|
|
893
925
|
{
|
|
894
926
|
type: "radio",
|
|
@@ -901,16 +933,19 @@ var RadioGroup = React10.forwardRef(function RadioGroup2(props, ref) {
|
|
|
901
933
|
st[1](v.value);
|
|
902
934
|
}
|
|
903
935
|
}
|
|
904
|
-
), /* @__PURE__ */
|
|
936
|
+
), /* @__PURE__ */ React14.createElement("span", { className: "aura-choice__text" }, /* @__PURE__ */ React14.createElement("span", { className: "aura-choice__label" }, v.label), v.description ? /* @__PURE__ */ React14.createElement("span", { className: "aura-choice__desc" }, v.description) : null));
|
|
905
937
|
})),
|
|
906
|
-
props.error ? /* @__PURE__ */
|
|
938
|
+
props.error ? /* @__PURE__ */ React14.createElement("p", { className: "aura-field__error", id: id + "-error" }, /* @__PURE__ */ React14.createElement(Icon, { name: "circle-alert", size: 14 }), props.error) : props.hint ? /* @__PURE__ */ React14.createElement("p", { className: "aura-field__hint", id: id + "-hint" }, props.hint) : null
|
|
907
939
|
);
|
|
908
940
|
});
|
|
909
|
-
|
|
941
|
+
|
|
942
|
+
// src/Switch.tsx
|
|
943
|
+
var React15 = __toESM(require("react"), 1);
|
|
944
|
+
var Switch = React15.forwardRef(function Switch2(props, ref) {
|
|
910
945
|
const auto = uid(), id = props.id || auto;
|
|
911
946
|
const st = useMaybeControlled(props.checked, !!props.defaultChecked, props.onChange);
|
|
912
947
|
const on = !!st[0];
|
|
913
|
-
return /* @__PURE__ */
|
|
948
|
+
return /* @__PURE__ */ React15.createElement("div", { className: cx("aura-switch-row", props.disabled && "is-disabled", props.className) }, /* @__PURE__ */ React15.createElement(
|
|
914
949
|
"button",
|
|
915
950
|
{
|
|
916
951
|
ref,
|
|
@@ -927,12 +962,12 @@ var Switch = React10.forwardRef(function Switch2(props, ref) {
|
|
|
927
962
|
st[1](!on);
|
|
928
963
|
}
|
|
929
964
|
},
|
|
930
|
-
/* @__PURE__ */
|
|
931
|
-
), props.label ? /* @__PURE__ */
|
|
965
|
+
/* @__PURE__ */ React15.createElement("span", { className: "aura-switch__thumb" })
|
|
966
|
+
), props.label ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__text" }, /* @__PURE__ */ React15.createElement("label", { className: "aura-choice__label", id: id + "-label", htmlFor: id }, props.label), props.description ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__desc", id: id + "-desc" }, props.description) : null) : null);
|
|
932
967
|
});
|
|
933
968
|
|
|
934
969
|
// src/Combobox.tsx
|
|
935
|
-
var
|
|
970
|
+
var React16 = __toESM(require("react"), 1);
|
|
936
971
|
var import_react_dom2 = require("react-dom");
|
|
937
972
|
function norm(s) {
|
|
938
973
|
return String(s == null ? "" : s).normalize("NFC").toLocaleLowerCase("th");
|
|
@@ -947,260 +982,335 @@ function defaultFilter(option, query) {
|
|
|
947
982
|
return norm(k).indexOf(q) >= 0;
|
|
948
983
|
});
|
|
949
984
|
}
|
|
950
|
-
var Combobox =
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
props.
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
const
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
985
|
+
var Combobox = React16.forwardRef(
|
|
986
|
+
function Combobox2(all, ref) {
|
|
987
|
+
const props = all;
|
|
988
|
+
const multi = all.multiple === true;
|
|
989
|
+
const mp = all;
|
|
990
|
+
const t = useStrings();
|
|
991
|
+
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
992
|
+
const options = (props.options || []).map(toOpt);
|
|
993
|
+
const st = useMaybeControlled(
|
|
994
|
+
multi ? mp.value : props.value === void 0 ? void 0 : props.value == null ? [] : [props.value],
|
|
995
|
+
multi ? mp.defaultValue || [] : props.defaultValue == null ? [] : [props.defaultValue],
|
|
996
|
+
function(next) {
|
|
997
|
+
if (multi) {
|
|
998
|
+
if (mp.onChange) mp.onChange(next);
|
|
999
|
+
} else if (props.onChange) props.onChange(next.length ? next[0] : null);
|
|
1000
|
+
}
|
|
1001
|
+
);
|
|
1002
|
+
const values = st[0], setValues = st[1];
|
|
1003
|
+
const value = values.length ? values[0] : null;
|
|
1004
|
+
function setValue(v) {
|
|
1005
|
+
setValues(v == null ? [] : [v]);
|
|
1006
|
+
}
|
|
1007
|
+
const isPicked = function(v) {
|
|
1008
|
+
return values.indexOf(v) >= 0;
|
|
1009
|
+
};
|
|
1010
|
+
const full = multi && mp.max != null && values.length >= mp.max;
|
|
1011
|
+
const selected = multi ? null : options.filter(function(o) {
|
|
1012
|
+
return o.value === value;
|
|
1013
|
+
})[0] || null;
|
|
1014
|
+
const picked = multi ? values.map(function(v) {
|
|
1015
|
+
return options.filter(function(o) {
|
|
1016
|
+
return o.value === v;
|
|
1017
|
+
})[0];
|
|
1018
|
+
}).filter(Boolean) : [];
|
|
1019
|
+
const openState = React16.useState(false), open = openState[0], setOpen = openState[1];
|
|
1020
|
+
const qState = React16.useState(null), query = qState[0], setQuery = qState[1];
|
|
1021
|
+
const aState = React16.useState(0), active = aState[0], setActive = aState[1];
|
|
1022
|
+
const posState = React16.useState(null);
|
|
1023
|
+
const inputRef = React16.useRef(null), inputMerged = useMergedRef(ref, inputRef), boxRef = React16.useRef(null), listRef = React16.useRef(null);
|
|
1024
|
+
const mounted = useMounted();
|
|
1025
|
+
const limit = props.limit || 200;
|
|
1026
|
+
const filter = props.filter || defaultFilter;
|
|
1027
|
+
let shown = props.onSearch || query == null ? options : options.filter(function(o) {
|
|
1028
|
+
return filter(o, query);
|
|
987
1029
|
});
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1030
|
+
const more = shown.length > limit;
|
|
1031
|
+
shown = shown.slice(0, limit);
|
|
1032
|
+
const activeIdx = Math.min(active, shown.length - 1);
|
|
1033
|
+
function place() {
|
|
1034
|
+
if (!boxRef.current) return;
|
|
1035
|
+
const r = boxRef.current.getBoundingClientRect();
|
|
1036
|
+
const maxH = 320, below = window.innerHeight - r.bottom - 8, up = below < 200 && r.top > below;
|
|
1037
|
+
posState[1]({
|
|
1038
|
+
left: r.left,
|
|
1039
|
+
width: r.width,
|
|
1040
|
+
top: up ? void 0 : r.bottom + 4,
|
|
1041
|
+
bottom: up ? window.innerHeight - r.top + 4 : void 0,
|
|
1042
|
+
maxHeight: Math.min(maxH, (up ? r.top : below) - 8)
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
useIsoLayoutEffect(
|
|
1046
|
+
function() {
|
|
1047
|
+
if (open) place();
|
|
1048
|
+
},
|
|
1049
|
+
[open, shown.length]
|
|
1050
|
+
);
|
|
1051
|
+
React16.useEffect(
|
|
1052
|
+
function() {
|
|
1053
|
+
if (!open) return;
|
|
1054
|
+
function outside(e) {
|
|
1055
|
+
if (boxRef.current && boxRef.current.contains(e.target)) return;
|
|
1056
|
+
if (listRef.current && listRef.current.contains(e.target)) return;
|
|
1057
|
+
close(false);
|
|
1058
|
+
}
|
|
1059
|
+
function onScroll(e) {
|
|
1060
|
+
if (!listRef.current || !listRef.current.contains(e.target)) place();
|
|
1061
|
+
}
|
|
1062
|
+
document.addEventListener("pointerdown", outside, true);
|
|
1063
|
+
window.addEventListener("scroll", onScroll, true);
|
|
1064
|
+
window.addEventListener("resize", place);
|
|
1065
|
+
return function() {
|
|
1066
|
+
document.removeEventListener("pointerdown", outside, true);
|
|
1067
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
1068
|
+
window.removeEventListener("resize", place);
|
|
1069
|
+
};
|
|
1070
|
+
},
|
|
1071
|
+
[open]
|
|
1072
|
+
);
|
|
1073
|
+
React16.useEffect(
|
|
1074
|
+
function() {
|
|
1075
|
+
if (!open || !listRef.current) return;
|
|
1076
|
+
const el = listRef.current.querySelector('[data-idx="' + activeIdx + '"]');
|
|
1077
|
+
if (el && el.scrollIntoView) el.scrollIntoView({ block: "nearest" });
|
|
1078
|
+
},
|
|
1079
|
+
[activeIdx, open]
|
|
1080
|
+
);
|
|
1081
|
+
function openList() {
|
|
1082
|
+
if (!open && !props.disabled && !props.readOnly) {
|
|
1083
|
+
setOpen(true);
|
|
1084
|
+
const i = selected ? shown.indexOf(selected) : 0;
|
|
1085
|
+
setActive(i < 0 ? 0 : i);
|
|
1002
1086
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1087
|
+
}
|
|
1088
|
+
function close(restoreLabel) {
|
|
1089
|
+
setOpen(false);
|
|
1090
|
+
setQuery(null);
|
|
1091
|
+
}
|
|
1092
|
+
function choose(o) {
|
|
1093
|
+
if (!o || o.disabled) return;
|
|
1094
|
+
if (multi) {
|
|
1095
|
+
if (isPicked(o.value))
|
|
1096
|
+
setValues(
|
|
1097
|
+
values.filter(function(v) {
|
|
1098
|
+
return v !== o.value;
|
|
1099
|
+
})
|
|
1100
|
+
);
|
|
1101
|
+
else if (!full) setValues(values.concat([o.value]));
|
|
1102
|
+
setQuery(null);
|
|
1103
|
+
if (inputRef.current) inputRef.current.focus();
|
|
1104
|
+
return;
|
|
1005
1105
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
document.removeEventListener("pointerdown", outside, true);
|
|
1011
|
-
window.removeEventListener("scroll", onScroll, true);
|
|
1012
|
-
window.removeEventListener("resize", place);
|
|
1013
|
-
};
|
|
1014
|
-
},
|
|
1015
|
-
[open]
|
|
1016
|
-
);
|
|
1017
|
-
React11.useEffect(
|
|
1018
|
-
function() {
|
|
1019
|
-
if (!open || !listRef.current) return;
|
|
1020
|
-
const el = listRef.current.querySelector('[data-idx="' + activeIdx + '"]');
|
|
1021
|
-
if (el && el.scrollIntoView) el.scrollIntoView({ block: "nearest" });
|
|
1022
|
-
},
|
|
1023
|
-
[activeIdx, open]
|
|
1024
|
-
);
|
|
1025
|
-
function openList() {
|
|
1026
|
-
if (!open && !props.disabled && !props.readOnly) {
|
|
1027
|
-
setOpen(true);
|
|
1028
|
-
const i = selected ? shown.indexOf(selected) : 0;
|
|
1029
|
-
setActive(i < 0 ? 0 : i);
|
|
1106
|
+
setValue(o.value);
|
|
1107
|
+
setQuery(null);
|
|
1108
|
+
setOpen(false);
|
|
1109
|
+
if (inputRef.current) inputRef.current.focus();
|
|
1030
1110
|
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
setQuery(null);
|
|
1035
|
-
}
|
|
1036
|
-
function choose(o) {
|
|
1037
|
-
if (!o || o.disabled) return;
|
|
1038
|
-
setValue(o.value);
|
|
1039
|
-
setQuery(null);
|
|
1040
|
-
setOpen(false);
|
|
1041
|
-
if (inputRef.current) inputRef.current.focus();
|
|
1042
|
-
}
|
|
1043
|
-
function onKeyDown(e) {
|
|
1044
|
-
const k = e.key;
|
|
1045
|
-
if (k === "ArrowDown") {
|
|
1046
|
-
e.preventDefault();
|
|
1047
|
-
if (!open) openList();
|
|
1048
|
-
else setActive(Math.min(activeIdx + 1, shown.length - 1));
|
|
1049
|
-
} else if (k === "ArrowUp") {
|
|
1050
|
-
e.preventDefault();
|
|
1051
|
-
if (!open) openList();
|
|
1052
|
-
else setActive(Math.max(activeIdx - 1, 0));
|
|
1053
|
-
} else if (k === "Home" && open) {
|
|
1054
|
-
e.preventDefault();
|
|
1055
|
-
setActive(0);
|
|
1056
|
-
} else if (k === "End" && open) {
|
|
1057
|
-
e.preventDefault();
|
|
1058
|
-
setActive(shown.length - 1);
|
|
1059
|
-
} else if (k === "Enter") {
|
|
1060
|
-
if (open && shown[activeIdx]) {
|
|
1111
|
+
function onKeyDown(e) {
|
|
1112
|
+
const k = e.key;
|
|
1113
|
+
if (k === "ArrowDown") {
|
|
1061
1114
|
e.preventDefault();
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
if (open) {
|
|
1115
|
+
if (!open) openList();
|
|
1116
|
+
else setActive(Math.min(activeIdx + 1, shown.length - 1));
|
|
1117
|
+
} else if (k === "ArrowUp") {
|
|
1066
1118
|
e.preventDefault();
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
} else if (
|
|
1070
|
-
|
|
1119
|
+
if (!open) openList();
|
|
1120
|
+
else setActive(Math.max(activeIdx - 1, 0));
|
|
1121
|
+
} else if (k === "Home" && open) {
|
|
1122
|
+
e.preventDefault();
|
|
1123
|
+
setActive(0);
|
|
1124
|
+
} else if (k === "End" && open) {
|
|
1125
|
+
e.preventDefault();
|
|
1126
|
+
setActive(shown.length - 1);
|
|
1127
|
+
} else if (k === "Enter") {
|
|
1128
|
+
if (open && shown[activeIdx]) {
|
|
1129
|
+
e.preventDefault();
|
|
1130
|
+
choose(shown[activeIdx]);
|
|
1131
|
+
}
|
|
1132
|
+
} else if (k === "Escape") {
|
|
1133
|
+
if (open) {
|
|
1134
|
+
e.preventDefault();
|
|
1135
|
+
e.stopPropagation();
|
|
1136
|
+
close();
|
|
1137
|
+
} else if (!multi && props.clearable !== false && value != null && query == null) {
|
|
1138
|
+
setValue(null);
|
|
1139
|
+
}
|
|
1140
|
+
} else if (k === "Backspace" && multi && !text && values.length) {
|
|
1141
|
+
setValues(values.slice(0, -1));
|
|
1142
|
+
} else if (k === "Tab") {
|
|
1143
|
+
if (open) close();
|
|
1071
1144
|
}
|
|
1072
|
-
} else if (k === "Tab") {
|
|
1073
|
-
if (open) close();
|
|
1074
1145
|
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
return /* @__PURE__ */ React11.createElement(
|
|
1084
|
-
"li",
|
|
1146
|
+
const text = query != null ? query : selected ? selected.label : "";
|
|
1147
|
+
const summaryId = id + "-picked";
|
|
1148
|
+
const optId = function(i) {
|
|
1149
|
+
return id + "-opt-" + i;
|
|
1150
|
+
};
|
|
1151
|
+
const list = open && mounted && posState[0] ? (0, import_react_dom2.createPortal)(
|
|
1152
|
+
/* @__PURE__ */ React16.createElement("div", { ref: listRef, className: "aura-combo__popover", style: posState[0] }, /* @__PURE__ */ React16.createElement(
|
|
1153
|
+
"ul",
|
|
1085
1154
|
{
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
"
|
|
1090
|
-
"
|
|
1091
|
-
"aria-disabled": o.disabled || void 0,
|
|
1092
|
-
className: cx(
|
|
1093
|
-
"aura-combo__option",
|
|
1094
|
-
i === activeIdx && "is-active",
|
|
1095
|
-
isSel && "is-selected",
|
|
1096
|
-
o.disabled && "is-disabled"
|
|
1097
|
-
),
|
|
1098
|
-
onPointerDown: function(e) {
|
|
1099
|
-
e.preventDefault();
|
|
1100
|
-
},
|
|
1101
|
-
onClick: function() {
|
|
1102
|
-
choose(o);
|
|
1103
|
-
},
|
|
1104
|
-
onPointerMove: function() {
|
|
1105
|
-
if (activeIdx !== i) setActive(i);
|
|
1106
|
-
}
|
|
1155
|
+
id: listId,
|
|
1156
|
+
role: "listbox",
|
|
1157
|
+
"aria-label": props.label,
|
|
1158
|
+
"aria-multiselectable": multi || void 0,
|
|
1159
|
+
className: "aura-combo__list"
|
|
1107
1160
|
},
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1161
|
+
props.loading ? /* @__PURE__ */ React16.createElement("li", { className: "aura-combo__note", role: "presentation" }, /* @__PURE__ */ React16.createElement(Icon, { name: "loader-circle", className: "aura-spin" }), props.loadingText || t.searching) : !shown.length ? /* @__PURE__ */ React16.createElement("li", { className: "aura-combo__note", role: "presentation" }, props.emptyText || t.noMatches) : shown.map(function(o, i) {
|
|
1162
|
+
const isSel = multi ? isPicked(o.value) : !!selected && o.value === selected.value;
|
|
1163
|
+
const blocked = o.disabled || multi && full && !isSel;
|
|
1164
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1165
|
+
"li",
|
|
1166
|
+
{
|
|
1167
|
+
key: o.value,
|
|
1168
|
+
id: optId(i),
|
|
1169
|
+
role: "option",
|
|
1170
|
+
"data-idx": i,
|
|
1171
|
+
"aria-selected": isSel,
|
|
1172
|
+
"aria-disabled": blocked || void 0,
|
|
1173
|
+
className: cx(
|
|
1174
|
+
"aura-combo__option",
|
|
1175
|
+
i === activeIdx && "is-active",
|
|
1176
|
+
isSel && "is-selected",
|
|
1177
|
+
blocked && "is-disabled"
|
|
1178
|
+
),
|
|
1179
|
+
onPointerDown: function(e) {
|
|
1180
|
+
e.preventDefault();
|
|
1181
|
+
},
|
|
1182
|
+
onClick: function() {
|
|
1183
|
+
if (!blocked || isSel) choose(o);
|
|
1184
|
+
},
|
|
1185
|
+
onPointerMove: function() {
|
|
1186
|
+
if (activeIdx !== i) setActive(i);
|
|
1187
|
+
}
|
|
1188
|
+
},
|
|
1189
|
+
o.icon ? /* @__PURE__ */ React16.createElement(Icon, { name: o.icon }) : null,
|
|
1190
|
+
/* @__PURE__ */ React16.createElement("span", { className: "aura-combo__text" }, /* @__PURE__ */ React16.createElement("span", { className: "aura-combo__label" }, o.label), o.description ? /* @__PURE__ */ React16.createElement("span", { className: "aura-combo__desc" }, o.description) : null),
|
|
1191
|
+
isSel ? /* @__PURE__ */ React16.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
1192
|
+
);
|
|
1193
|
+
}),
|
|
1194
|
+
more && !props.loading ? /* @__PURE__ */ React16.createElement("li", { className: "aura-combo__note", role: "presentation" }, t.keepTyping((props.options || []).length)) : null
|
|
1195
|
+
)),
|
|
1196
|
+
document.body
|
|
1197
|
+
) : null;
|
|
1198
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1199
|
+
Field,
|
|
1129
1200
|
{
|
|
1130
|
-
ref: inputMerged,
|
|
1131
1201
|
id,
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
autoComplete: "off",
|
|
1136
|
-
"aria-expanded": open,
|
|
1137
|
-
"aria-controls": listId,
|
|
1138
|
-
"aria-autocomplete": "list",
|
|
1139
|
-
"aria-activedescendant": open && shown[activeIdx] ? optId(activeIdx) : void 0,
|
|
1140
|
-
"aria-invalid": props.error ? true : void 0,
|
|
1141
|
-
"aria-describedby": props.error ? id + "-error" : props.hint ? id + "-hint" : void 0,
|
|
1142
|
-
placeholder: props.placeholder,
|
|
1143
|
-
disabled: props.disabled,
|
|
1144
|
-
readOnly: props.readOnly,
|
|
1202
|
+
label: props.label,
|
|
1203
|
+
hint: props.hint,
|
|
1204
|
+
error: props.error,
|
|
1145
1205
|
required: props.required,
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
setQuery(e.target.value);
|
|
1150
|
-
setActive(0);
|
|
1151
|
-
if (!open) setOpen(true);
|
|
1152
|
-
if (props.onSearch) props.onSearch(e.target.value);
|
|
1153
|
-
},
|
|
1154
|
-
onClick: openList,
|
|
1155
|
-
onKeyDown,
|
|
1156
|
-
onBlur: function() {
|
|
1157
|
-
setTimeout(function() {
|
|
1158
|
-
if (listRef.current && listRef.current.contains(document.activeElement)) return;
|
|
1159
|
-
setOpen(false);
|
|
1160
|
-
setQuery(null);
|
|
1161
|
-
}, 0);
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */ React11.createElement(
|
|
1165
|
-
"button",
|
|
1166
|
-
{
|
|
1167
|
-
type: "button",
|
|
1168
|
-
className: "aura-combo__clear",
|
|
1169
|
-
"aria-label": t.clear(props.label),
|
|
1170
|
-
tabIndex: -1,
|
|
1171
|
-
onClick: function() {
|
|
1172
|
-
setValue(null);
|
|
1173
|
-
setQuery(null);
|
|
1174
|
-
if (inputRef.current) inputRef.current.focus();
|
|
1175
|
-
}
|
|
1206
|
+
optional: props.optional,
|
|
1207
|
+
disabled: props.disabled,
|
|
1208
|
+
className: props.className
|
|
1176
1209
|
},
|
|
1177
|
-
/* @__PURE__ */
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1210
|
+
/* @__PURE__ */ React16.createElement("div", { ref: boxRef, className: cx("aura-input aura-combo has-icon", open && "is-open", multi && "is-multi") }, /* @__PURE__ */ React16.createElement(Icon, { name: props.icon || "search", className: "aura-input__icon" }), multi && picked.length ? /* @__PURE__ */ React16.createElement("span", { className: "aura-combo__chips" }, picked.map(function(o) {
|
|
1211
|
+
return /* @__PURE__ */ React16.createElement("span", { key: o.value, className: "aura-combo__chip" }, /* @__PURE__ */ React16.createElement("span", { className: "aura-combo__chip-label" }, o.label), props.disabled || props.readOnly ? null : /* @__PURE__ */ React16.createElement(
|
|
1212
|
+
"button",
|
|
1213
|
+
{
|
|
1214
|
+
type: "button",
|
|
1215
|
+
tabIndex: -1,
|
|
1216
|
+
className: "aura-combo__chip-remove",
|
|
1217
|
+
"aria-label": t.remove(o.label),
|
|
1218
|
+
onPointerDown: function(e) {
|
|
1219
|
+
e.preventDefault();
|
|
1220
|
+
},
|
|
1221
|
+
onClick: function() {
|
|
1222
|
+
setValues(
|
|
1223
|
+
values.filter(function(v) {
|
|
1224
|
+
return v !== o.value;
|
|
1225
|
+
})
|
|
1226
|
+
);
|
|
1227
|
+
if (inputRef.current) inputRef.current.focus();
|
|
1228
|
+
}
|
|
1229
|
+
},
|
|
1230
|
+
/* @__PURE__ */ React16.createElement(Icon, { name: "x" })
|
|
1231
|
+
));
|
|
1232
|
+
})) : null, multi ? /* @__PURE__ */ React16.createElement("span", { id: summaryId, className: "aura-sr-only" }, picked.length ? t.selectedCount(picked.length) + ": " + picked.map(function(o) {
|
|
1233
|
+
return o.label;
|
|
1234
|
+
}).join(", ") : "") : null, multi && props.name ? values.map(function(v) {
|
|
1235
|
+
return /* @__PURE__ */ React16.createElement("input", { key: v, type: "hidden", name: props.name, value: v });
|
|
1236
|
+
}) : null, /* @__PURE__ */ React16.createElement(
|
|
1237
|
+
"input",
|
|
1238
|
+
{
|
|
1239
|
+
ref: inputMerged,
|
|
1240
|
+
id,
|
|
1241
|
+
type: "text",
|
|
1242
|
+
role: "combobox",
|
|
1243
|
+
className: "aura-input__control",
|
|
1244
|
+
autoComplete: "off",
|
|
1245
|
+
"aria-expanded": open,
|
|
1246
|
+
"aria-controls": listId,
|
|
1247
|
+
"aria-autocomplete": "list",
|
|
1248
|
+
"aria-activedescendant": open && shown[activeIdx] ? optId(activeIdx) : void 0,
|
|
1249
|
+
"aria-invalid": props.error ? true : void 0,
|
|
1250
|
+
"aria-describedby": [props.error ? id + "-error" : props.hint ? id + "-hint" : "", multi && picked.length ? summaryId : ""].filter(Boolean).join(" ") || void 0,
|
|
1251
|
+
placeholder: multi && values.length ? void 0 : props.placeholder,
|
|
1252
|
+
disabled: props.disabled,
|
|
1253
|
+
readOnly: props.readOnly,
|
|
1254
|
+
required: props.required && (!multi || !values.length),
|
|
1255
|
+
name: multi ? void 0 : props.name,
|
|
1256
|
+
value: text,
|
|
1257
|
+
onChange: function(e) {
|
|
1258
|
+
setQuery(e.target.value);
|
|
1259
|
+
setActive(0);
|
|
1260
|
+
if (!open) setOpen(true);
|
|
1261
|
+
if (props.onSearch) props.onSearch(e.target.value);
|
|
1262
|
+
},
|
|
1263
|
+
onClick: openList,
|
|
1264
|
+
onKeyDown,
|
|
1265
|
+
onBlur: function() {
|
|
1266
|
+
setTimeout(function() {
|
|
1267
|
+
if (listRef.current && listRef.current.contains(document.activeElement)) return;
|
|
1268
|
+
setOpen(false);
|
|
1269
|
+
setQuery(null);
|
|
1270
|
+
}, 0);
|
|
1193
1271
|
}
|
|
1194
1272
|
}
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1273
|
+
), props.clearable !== false && values.length && !props.disabled ? /* @__PURE__ */ React16.createElement(
|
|
1274
|
+
"button",
|
|
1275
|
+
{
|
|
1276
|
+
type: "button",
|
|
1277
|
+
className: "aura-combo__clear",
|
|
1278
|
+
"aria-label": t.clear(props.label),
|
|
1279
|
+
tabIndex: -1,
|
|
1280
|
+
onClick: function() {
|
|
1281
|
+
setValues([]);
|
|
1282
|
+
setQuery(null);
|
|
1283
|
+
if (inputRef.current) inputRef.current.focus();
|
|
1284
|
+
}
|
|
1285
|
+
},
|
|
1286
|
+
/* @__PURE__ */ React16.createElement(Icon, { name: "x" })
|
|
1287
|
+
) : null, /* @__PURE__ */ React16.createElement(
|
|
1288
|
+
"button",
|
|
1289
|
+
{
|
|
1290
|
+
type: "button",
|
|
1291
|
+
tabIndex: -1,
|
|
1292
|
+
"aria-hidden": true,
|
|
1293
|
+
className: "aura-combo__toggle",
|
|
1294
|
+
onPointerDown: function(e) {
|
|
1295
|
+
e.preventDefault();
|
|
1296
|
+
},
|
|
1297
|
+
onClick: function() {
|
|
1298
|
+
if (open) close();
|
|
1299
|
+
else {
|
|
1300
|
+
openList();
|
|
1301
|
+
inputRef.current && inputRef.current.focus();
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
},
|
|
1305
|
+
/* @__PURE__ */ React16.createElement(Icon, { name: "chevron-down" })
|
|
1306
|
+
)),
|
|
1307
|
+
list
|
|
1308
|
+
);
|
|
1309
|
+
}
|
|
1310
|
+
);
|
|
1201
1311
|
|
|
1202
1312
|
// src/DatePicker.tsx
|
|
1203
|
-
var
|
|
1313
|
+
var React17 = __toESM(require("react"), 1);
|
|
1204
1314
|
var import_react_dom3 = require("react-dom");
|
|
1205
1315
|
var ERA = /^พ\.ศ\.\s?|\s?(BE|พ\.ศ\.)$/g;
|
|
1206
1316
|
var pad = function(n2) {
|
|
@@ -1282,29 +1392,29 @@ function parseDate(text) {
|
|
|
1282
1392
|
const dt = new Date(y, mo - 1, d);
|
|
1283
1393
|
return dt.getMonth() === mo - 1 && dt.getDate() === d ? toISO(dt) : null;
|
|
1284
1394
|
}
|
|
1285
|
-
var Calendar =
|
|
1395
|
+
var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
1286
1396
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", tag = localeTag(locale, calendar);
|
|
1287
1397
|
const weekStart = props.weekStartsOn == null ? 0 : props.weekStartsOn;
|
|
1288
1398
|
let today = /* @__PURE__ */ new Date();
|
|
1289
1399
|
today = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
1290
1400
|
const min = fromISO(props.min), max = fromISO(props.max);
|
|
1291
1401
|
const start = fromISO(props.start), end = fromISO(props.end);
|
|
1292
|
-
const focusState =
|
|
1402
|
+
const focusState = React17.useState(fromISO(props.focus) || start || today);
|
|
1293
1403
|
const focusDate = focusState[0], setFocus = focusState[1];
|
|
1294
|
-
const viewState =
|
|
1295
|
-
const hoverState =
|
|
1296
|
-
const gridRef =
|
|
1404
|
+
const viewState = React17.useState("days"), view = viewState[0], setView = viewState[1];
|
|
1405
|
+
const hoverState = React17.useState(null);
|
|
1406
|
+
const gridRef = React17.useRef(null), gridMerged = useMergedRef(ref, gridRef), moved = React17.useRef(false);
|
|
1297
1407
|
const th = locale !== "en";
|
|
1298
1408
|
function disabled(d) {
|
|
1299
1409
|
return !!(min && d < min || max && d > max || props.isDateDisabled && props.isDateDisabled(toISO(d)));
|
|
1300
1410
|
}
|
|
1301
|
-
|
|
1411
|
+
React17.useEffect(function() {
|
|
1302
1412
|
if (!moved.current) return;
|
|
1303
1413
|
moved.current = false;
|
|
1304
1414
|
const el = gridRef.current && gridRef.current.querySelector('[data-date="' + toISO(focusDate) + '"]');
|
|
1305
1415
|
if (el) el.focus();
|
|
1306
1416
|
});
|
|
1307
|
-
|
|
1417
|
+
React17.useEffect(function() {
|
|
1308
1418
|
if (props.autoFocus === false) return;
|
|
1309
1419
|
const el = gridRef.current && gridRef.current.querySelector('[tabindex="0"]');
|
|
1310
1420
|
if (el) el.focus();
|
|
@@ -1356,7 +1466,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1356
1466
|
const yr = focusDate.getFullYear(), base = yr - yr % 12;
|
|
1357
1467
|
const years = [];
|
|
1358
1468
|
for (let y = base; y < base + 12; y++) years.push(y);
|
|
1359
|
-
return /* @__PURE__ */
|
|
1469
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1360
1470
|
IconButton,
|
|
1361
1471
|
{
|
|
1362
1472
|
icon: "chevron-left",
|
|
@@ -1365,7 +1475,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1365
1475
|
setFocus(new Date(yr - 12, focusDate.getMonth(), 1));
|
|
1366
1476
|
}
|
|
1367
1477
|
}
|
|
1368
|
-
), /* @__PURE__ */
|
|
1478
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1369
1479
|
"button",
|
|
1370
1480
|
{
|
|
1371
1481
|
type: "button",
|
|
@@ -1375,7 +1485,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1375
1485
|
}
|
|
1376
1486
|
},
|
|
1377
1487
|
fmt(tag, { year: "numeric" }, new Date(base, 0, 1)).replace(ERA, "") + " \u2013 " + fmt(tag, { year: "numeric" }, new Date(base + 11, 0, 1)).replace(ERA, "")
|
|
1378
|
-
), /* @__PURE__ */
|
|
1488
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1379
1489
|
IconButton,
|
|
1380
1490
|
{
|
|
1381
1491
|
icon: "chevron-right",
|
|
@@ -1384,9 +1494,9 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1384
1494
|
setFocus(new Date(yr + 12, focusDate.getMonth(), 1));
|
|
1385
1495
|
}
|
|
1386
1496
|
}
|
|
1387
|
-
)), /* @__PURE__ */
|
|
1497
|
+
)), /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__years" }, years.map(function(y) {
|
|
1388
1498
|
const d = new Date(y, focusDate.getMonth(), 1);
|
|
1389
|
-
return /* @__PURE__ */
|
|
1499
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1390
1500
|
"button",
|
|
1391
1501
|
{
|
|
1392
1502
|
key: y,
|
|
@@ -1403,7 +1513,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1403
1513
|
);
|
|
1404
1514
|
})));
|
|
1405
1515
|
}
|
|
1406
|
-
return /* @__PURE__ */
|
|
1516
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1407
1517
|
IconButton,
|
|
1408
1518
|
{
|
|
1409
1519
|
icon: "chevron-left",
|
|
@@ -1412,7 +1522,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1412
1522
|
setFocus(addMonths(focusDate, -1));
|
|
1413
1523
|
}
|
|
1414
1524
|
}
|
|
1415
|
-
), /* @__PURE__ */
|
|
1525
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1416
1526
|
"button",
|
|
1417
1527
|
{
|
|
1418
1528
|
type: "button",
|
|
@@ -1423,8 +1533,8 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1423
1533
|
}
|
|
1424
1534
|
},
|
|
1425
1535
|
monthTitle,
|
|
1426
|
-
/* @__PURE__ */
|
|
1427
|
-
), /* @__PURE__ */
|
|
1536
|
+
/* @__PURE__ */ React17.createElement(Icon, { name: "chevron-down", size: 14 })
|
|
1537
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1428
1538
|
IconButton,
|
|
1429
1539
|
{
|
|
1430
1540
|
icon: "chevron-right",
|
|
@@ -1433,9 +1543,9 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1433
1543
|
setFocus(addMonths(focusDate, 1));
|
|
1434
1544
|
}
|
|
1435
1545
|
}
|
|
1436
|
-
)), /* @__PURE__ */
|
|
1437
|
-
return /* @__PURE__ */
|
|
1438
|
-
}))), /* @__PURE__ */
|
|
1546
|
+
)), /* @__PURE__ */ React17.createElement("table", { role: "grid", className: "aura-cal__grid", "aria-label": monthTitle }, /* @__PURE__ */ React17.createElement("thead", null, /* @__PURE__ */ React17.createElement("tr", null, weekdayNames.map(function(n2, i) {
|
|
1547
|
+
return /* @__PURE__ */ React17.createElement("th", { key: i, scope: "col", abbr: n2.long }, /* @__PURE__ */ React17.createElement("span", { "aria-hidden": true }, n2.short));
|
|
1548
|
+
}))), /* @__PURE__ */ React17.createElement(
|
|
1439
1549
|
"tbody",
|
|
1440
1550
|
{
|
|
1441
1551
|
onMouseLeave: function() {
|
|
@@ -1443,11 +1553,11 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1443
1553
|
}
|
|
1444
1554
|
},
|
|
1445
1555
|
weeks.map(function(wk, wi) {
|
|
1446
|
-
return /* @__PURE__ */
|
|
1556
|
+
return /* @__PURE__ */ React17.createElement("tr", { key: wi }, wk.map(function(d) {
|
|
1447
1557
|
const iso = toISO(d), out = d.getMonth() !== focusDate.getMonth(), dis = disabled(d);
|
|
1448
1558
|
const isStart = same(d, start), isEnd = same(d, end) || !end && props.range && same(d, hover) && start;
|
|
1449
1559
|
const sel = isStart || same(d, end);
|
|
1450
|
-
return /* @__PURE__ */
|
|
1560
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1451
1561
|
"td",
|
|
1452
1562
|
{
|
|
1453
1563
|
key: iso,
|
|
@@ -1459,7 +1569,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1459
1569
|
props.range && isEnd && start && "is-range-end"
|
|
1460
1570
|
)
|
|
1461
1571
|
},
|
|
1462
|
-
/* @__PURE__ */
|
|
1572
|
+
/* @__PURE__ */ React17.createElement(
|
|
1463
1573
|
"button",
|
|
1464
1574
|
{
|
|
1465
1575
|
type: "button",
|
|
@@ -1491,7 +1601,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1491
1601
|
);
|
|
1492
1602
|
}));
|
|
1493
1603
|
})
|
|
1494
|
-
)), props.footer === false ? null : /* @__PURE__ */
|
|
1604
|
+
)), props.footer === false ? null : /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__foot" }, /* @__PURE__ */ React17.createElement(
|
|
1495
1605
|
"button",
|
|
1496
1606
|
{
|
|
1497
1607
|
type: "button",
|
|
@@ -1503,11 +1613,11 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1503
1613
|
}
|
|
1504
1614
|
},
|
|
1505
1615
|
th ? "\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49" : "Today"
|
|
1506
|
-
), props.onClear ? /* @__PURE__ */
|
|
1616
|
+
), props.onClear ? /* @__PURE__ */ React17.createElement("button", { type: "button", className: "aura-cal__link", onClick: props.onClear }, th ? "\u0E25\u0E49\u0E32\u0E07" : "Clear") : null));
|
|
1507
1617
|
});
|
|
1508
1618
|
function useCalendarPopover(boxRef) {
|
|
1509
|
-
const openState =
|
|
1510
|
-
const pos =
|
|
1619
|
+
const openState = React17.useState(false), open = openState[0], setOpen = openState[1];
|
|
1620
|
+
const pos = React17.useState(null), popRef = React17.useRef(null), mounted = useMounted();
|
|
1511
1621
|
function place() {
|
|
1512
1622
|
if (!boxRef.current) return;
|
|
1513
1623
|
const r = boxRef.current.getBoundingClientRect(), H = 380;
|
|
@@ -1521,7 +1631,7 @@ function useCalendarPopover(boxRef) {
|
|
|
1521
1631
|
},
|
|
1522
1632
|
[open]
|
|
1523
1633
|
);
|
|
1524
|
-
|
|
1634
|
+
React17.useEffect(
|
|
1525
1635
|
function() {
|
|
1526
1636
|
if (!open) return;
|
|
1527
1637
|
function outside(e) {
|
|
@@ -1543,8 +1653,8 @@ function useCalendarPopover(boxRef) {
|
|
|
1543
1653
|
return { open, setOpen, pos: pos[0], popRef, mounted };
|
|
1544
1654
|
}
|
|
1545
1655
|
function DateField(props) {
|
|
1546
|
-
const editState =
|
|
1547
|
-
return /* @__PURE__ */
|
|
1656
|
+
const editState = React17.useState(null), editing = editState[0], setEditing = editState[1];
|
|
1657
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1548
1658
|
Field,
|
|
1549
1659
|
{
|
|
1550
1660
|
id: props.id,
|
|
@@ -1556,7 +1666,7 @@ function DateField(props) {
|
|
|
1556
1666
|
disabled: props.disabled,
|
|
1557
1667
|
className: props.className
|
|
1558
1668
|
},
|
|
1559
|
-
/* @__PURE__ */
|
|
1669
|
+
/* @__PURE__ */ React17.createElement("div", { ref: props.boxRef, className: cx("aura-input aura-date", props.open && "is-open") }, /* @__PURE__ */ React17.createElement(
|
|
1560
1670
|
"input",
|
|
1561
1671
|
{
|
|
1562
1672
|
ref: props.inputRef,
|
|
@@ -1595,7 +1705,7 @@ function DateField(props) {
|
|
|
1595
1705
|
}
|
|
1596
1706
|
}
|
|
1597
1707
|
}
|
|
1598
|
-
), props.clearable !== false && props.hasValue && !props.disabled ? /* @__PURE__ */
|
|
1708
|
+
), props.clearable !== false && props.hasValue && !props.disabled ? /* @__PURE__ */ React17.createElement(
|
|
1599
1709
|
"button",
|
|
1600
1710
|
{
|
|
1601
1711
|
type: "button",
|
|
@@ -1604,8 +1714,8 @@ function DateField(props) {
|
|
|
1604
1714
|
"aria-label": props.clearLabel,
|
|
1605
1715
|
onClick: props.onClear
|
|
1606
1716
|
},
|
|
1607
|
-
/* @__PURE__ */
|
|
1608
|
-
) : null, /* @__PURE__ */
|
|
1717
|
+
/* @__PURE__ */ React17.createElement(Icon, { name: "x" })
|
|
1718
|
+
) : null, /* @__PURE__ */ React17.createElement(
|
|
1609
1719
|
"button",
|
|
1610
1720
|
{
|
|
1611
1721
|
type: "button",
|
|
@@ -1619,11 +1729,11 @@ function DateField(props) {
|
|
|
1619
1729
|
props.onToggle(!props.open);
|
|
1620
1730
|
}
|
|
1621
1731
|
},
|
|
1622
|
-
/* @__PURE__ */
|
|
1732
|
+
/* @__PURE__ */ React17.createElement(Icon, { name: "calendar" })
|
|
1623
1733
|
))
|
|
1624
1734
|
);
|
|
1625
1735
|
}
|
|
1626
|
-
var DatePicker =
|
|
1736
|
+
var DatePicker = React17.forwardRef(function DatePicker2(props, ref) {
|
|
1627
1737
|
const auto = uid(), id = props.id || auto, dialogId = id + "-cal";
|
|
1628
1738
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", th = locale !== "en";
|
|
1629
1739
|
const st = useMaybeControlled(
|
|
@@ -1631,7 +1741,7 @@ var DatePicker = React12.forwardRef(function DatePicker2(props, ref) {
|
|
|
1631
1741
|
props.defaultValue == null ? null : props.defaultValue,
|
|
1632
1742
|
props.onChange
|
|
1633
1743
|
);
|
|
1634
|
-
const boxRef =
|
|
1744
|
+
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
1635
1745
|
const pop = useCalendarPopover(boxRef);
|
|
1636
1746
|
function commit(text) {
|
|
1637
1747
|
if (!text.trim()) {
|
|
@@ -1646,7 +1756,7 @@ var DatePicker = React12.forwardRef(function DatePicker2(props, ref) {
|
|
|
1646
1756
|
if (inputRef.current) inputRef.current.focus();
|
|
1647
1757
|
}
|
|
1648
1758
|
const cal = pop.open && pop.mounted && pop.pos ? (0, import_react_dom3.createPortal)(
|
|
1649
|
-
/* @__PURE__ */
|
|
1759
|
+
/* @__PURE__ */ React17.createElement(
|
|
1650
1760
|
"div",
|
|
1651
1761
|
{
|
|
1652
1762
|
ref: pop.popRef,
|
|
@@ -1663,7 +1773,7 @@ var DatePicker = React12.forwardRef(function DatePicker2(props, ref) {
|
|
|
1663
1773
|
} else trapTab(e, pop.popRef.current);
|
|
1664
1774
|
}
|
|
1665
1775
|
},
|
|
1666
|
-
/* @__PURE__ */
|
|
1776
|
+
/* @__PURE__ */ React17.createElement(
|
|
1667
1777
|
Calendar,
|
|
1668
1778
|
{
|
|
1669
1779
|
locale,
|
|
@@ -1683,7 +1793,7 @@ var DatePicker = React12.forwardRef(function DatePicker2(props, ref) {
|
|
|
1683
1793
|
),
|
|
1684
1794
|
document.body
|
|
1685
1795
|
) : null;
|
|
1686
|
-
return /* @__PURE__ */
|
|
1796
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1687
1797
|
DateField,
|
|
1688
1798
|
{
|
|
1689
1799
|
id,
|
|
@@ -1717,7 +1827,7 @@ var DatePicker = React12.forwardRef(function DatePicker2(props, ref) {
|
|
|
1717
1827
|
}
|
|
1718
1828
|
), cal);
|
|
1719
1829
|
});
|
|
1720
|
-
var DateRangePicker =
|
|
1830
|
+
var DateRangePicker = React17.forwardRef(
|
|
1721
1831
|
function DateRangePicker2(props, ref) {
|
|
1722
1832
|
const auto = uid(), id = props.id || auto, dialogId = id + "-cal";
|
|
1723
1833
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", th = locale !== "en";
|
|
@@ -1727,8 +1837,8 @@ var DateRangePicker = React12.forwardRef(
|
|
|
1727
1837
|
props.onChange
|
|
1728
1838
|
);
|
|
1729
1839
|
const v = st[0] || { start: null, end: null };
|
|
1730
|
-
const draft =
|
|
1731
|
-
const boxRef =
|
|
1840
|
+
const draft = React17.useState(null);
|
|
1841
|
+
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
1732
1842
|
const pop = useCalendarPopover(boxRef);
|
|
1733
1843
|
const o = { locale, calendar };
|
|
1734
1844
|
function show(r) {
|
|
@@ -1760,7 +1870,7 @@ var DateRangePicker = React12.forwardRef(
|
|
|
1760
1870
|
close();
|
|
1761
1871
|
}
|
|
1762
1872
|
const cal = pop.open && pop.mounted && pop.pos ? (0, import_react_dom3.createPortal)(
|
|
1763
|
-
/* @__PURE__ */
|
|
1873
|
+
/* @__PURE__ */ React17.createElement(
|
|
1764
1874
|
"div",
|
|
1765
1875
|
{
|
|
1766
1876
|
ref: pop.popRef,
|
|
@@ -1777,8 +1887,8 @@ var DateRangePicker = React12.forwardRef(
|
|
|
1777
1887
|
} else trapTab(e, pop.popRef.current);
|
|
1778
1888
|
}
|
|
1779
1889
|
},
|
|
1780
|
-
/* @__PURE__ */
|
|
1781
|
-
/* @__PURE__ */
|
|
1890
|
+
/* @__PURE__ */ React17.createElement("p", { className: "aura-cal__hint", "aria-live": "polite" }, draft[0] ? th ? "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14" : "Choose the end date" : th ? "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19" : "Choose the start date"),
|
|
1891
|
+
/* @__PURE__ */ React17.createElement(
|
|
1782
1892
|
Calendar,
|
|
1783
1893
|
{
|
|
1784
1894
|
range: true,
|
|
@@ -1797,7 +1907,7 @@ var DateRangePicker = React12.forwardRef(
|
|
|
1797
1907
|
),
|
|
1798
1908
|
document.body
|
|
1799
1909
|
) : null;
|
|
1800
|
-
return /* @__PURE__ */
|
|
1910
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1801
1911
|
DateField,
|
|
1802
1912
|
{
|
|
1803
1913
|
id,
|
|
@@ -1834,30 +1944,33 @@ var DateRangePicker = React12.forwardRef(
|
|
|
1834
1944
|
}
|
|
1835
1945
|
);
|
|
1836
1946
|
|
|
1837
|
-
// src/
|
|
1838
|
-
var
|
|
1839
|
-
var import_react_dom4 = require("react-dom");
|
|
1947
|
+
// src/Alert.tsx
|
|
1948
|
+
var React18 = __toESM(require("react"), 1);
|
|
1840
1949
|
var ALERT_ICON = {
|
|
1841
1950
|
info: "info",
|
|
1842
1951
|
success: "circle-check",
|
|
1843
1952
|
warning: "triangle-alert",
|
|
1844
1953
|
danger: "circle-alert"
|
|
1845
1954
|
};
|
|
1846
|
-
var Alert =
|
|
1955
|
+
var Alert = React18.forwardRef(function Alert2(props, ref) {
|
|
1847
1956
|
const t = useStrings();
|
|
1848
1957
|
const tone2 = props.tone || "info";
|
|
1849
|
-
return /* @__PURE__ */
|
|
1958
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1850
1959
|
"div",
|
|
1851
1960
|
{
|
|
1852
1961
|
ref,
|
|
1853
1962
|
className: cx("aura-alert", "aura-alert--" + tone2, props.className),
|
|
1854
1963
|
role: tone2 === "danger" || tone2 === "warning" ? "alert" : "status"
|
|
1855
1964
|
},
|
|
1856
|
-
/* @__PURE__ */
|
|
1857
|
-
/* @__PURE__ */
|
|
1858
|
-
props.onDismiss ? /* @__PURE__ */
|
|
1965
|
+
/* @__PURE__ */ React18.createElement(Icon, { name: ALERT_ICON[tone2], className: "aura-alert__icon" }),
|
|
1966
|
+
/* @__PURE__ */ React18.createElement("div", { className: "aura-alert__body" }, props.title ? /* @__PURE__ */ React18.createElement("p", { className: "aura-alert__title" }, props.title) : null, props.children ? /* @__PURE__ */ React18.createElement("div", { className: "aura-alert__text" }, props.children) : null, props.action ? /* @__PURE__ */ React18.createElement("div", { className: "aura-alert__action" }, props.action) : null),
|
|
1967
|
+
props.onDismiss ? /* @__PURE__ */ React18.createElement(IconButton, { icon: "x", label: t.dismiss, className: "aura-alert__close", onClick: props.onDismiss }) : null
|
|
1859
1968
|
);
|
|
1860
1969
|
});
|
|
1970
|
+
|
|
1971
|
+
// src/Toaster.tsx
|
|
1972
|
+
var React19 = __toESM(require("react"), 1);
|
|
1973
|
+
var import_react_dom4 = require("react-dom");
|
|
1861
1974
|
var toastState = {
|
|
1862
1975
|
list: [],
|
|
1863
1976
|
subs: [],
|
|
@@ -1885,7 +1998,7 @@ toast.dismiss = function(id) {
|
|
|
1885
1998
|
};
|
|
1886
1999
|
function ToastItem(props) {
|
|
1887
2000
|
const str = useStrings();
|
|
1888
|
-
const t = props.toast, timer =
|
|
2001
|
+
const t = props.toast, timer = React19.useRef(null), left = React19.useRef(t.duration || 5e3), since = React19.useRef(0);
|
|
1889
2002
|
function start() {
|
|
1890
2003
|
if (left.current === Infinity) return;
|
|
1891
2004
|
since.current = Date.now();
|
|
@@ -1900,11 +2013,11 @@ function ToastItem(props) {
|
|
|
1900
2013
|
left.current -= Date.now() - since.current;
|
|
1901
2014
|
}
|
|
1902
2015
|
}
|
|
1903
|
-
|
|
2016
|
+
React19.useEffect(function() {
|
|
1904
2017
|
start();
|
|
1905
2018
|
return pause;
|
|
1906
2019
|
}, []);
|
|
1907
|
-
return /* @__PURE__ */
|
|
2020
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1908
2021
|
"div",
|
|
1909
2022
|
{
|
|
1910
2023
|
className: cx("aura-toast", "aura-toast--" + t.tone),
|
|
@@ -1914,9 +2027,9 @@ function ToastItem(props) {
|
|
|
1914
2027
|
onFocus: pause,
|
|
1915
2028
|
onBlur: start
|
|
1916
2029
|
},
|
|
1917
|
-
/* @__PURE__ */
|
|
1918
|
-
/* @__PURE__ */
|
|
1919
|
-
t.action ? /* @__PURE__ */
|
|
2030
|
+
/* @__PURE__ */ React19.createElement(Icon, { name: ALERT_ICON[t.tone] || "info", className: "aura-toast__icon" }),
|
|
2031
|
+
/* @__PURE__ */ React19.createElement("div", { className: "aura-toast__body" }, /* @__PURE__ */ React19.createElement("p", { className: "aura-toast__title" }, t.title), t.description ? /* @__PURE__ */ React19.createElement("p", { className: "aura-toast__text" }, t.description) : null),
|
|
2032
|
+
t.action ? /* @__PURE__ */ React19.createElement(
|
|
1920
2033
|
"button",
|
|
1921
2034
|
{
|
|
1922
2035
|
type: "button",
|
|
@@ -1928,7 +2041,7 @@ function ToastItem(props) {
|
|
|
1928
2041
|
},
|
|
1929
2042
|
t.action.label
|
|
1930
2043
|
) : null,
|
|
1931
|
-
/* @__PURE__ */
|
|
2044
|
+
/* @__PURE__ */ React19.createElement(
|
|
1932
2045
|
IconButton,
|
|
1933
2046
|
{
|
|
1934
2047
|
icon: "x",
|
|
@@ -1944,8 +2057,8 @@ function ToastItem(props) {
|
|
|
1944
2057
|
function Toaster(props) {
|
|
1945
2058
|
const t = useStrings();
|
|
1946
2059
|
const mounted = useMounted();
|
|
1947
|
-
const s =
|
|
1948
|
-
|
|
2060
|
+
const s = React19.useState(toastState.list);
|
|
2061
|
+
React19.useEffect(function() {
|
|
1949
2062
|
toastState.subs.push(s[1]);
|
|
1950
2063
|
return function() {
|
|
1951
2064
|
toastState.subs = toastState.subs.filter(function(f) {
|
|
@@ -1955,7 +2068,7 @@ function Toaster(props) {
|
|
|
1955
2068
|
}, []);
|
|
1956
2069
|
if (!mounted) return null;
|
|
1957
2070
|
return (0, import_react_dom4.createPortal)(
|
|
1958
|
-
/* @__PURE__ */
|
|
2071
|
+
/* @__PURE__ */ React19.createElement(
|
|
1959
2072
|
"div",
|
|
1960
2073
|
{
|
|
1961
2074
|
className: cx("aura-toaster", props && props.position === "top" && "is-top"),
|
|
@@ -1964,16 +2077,20 @@ function Toaster(props) {
|
|
|
1964
2077
|
"aria-label": t.notifications
|
|
1965
2078
|
},
|
|
1966
2079
|
s[0].map(function(t2) {
|
|
1967
|
-
return /* @__PURE__ */
|
|
2080
|
+
return /* @__PURE__ */ React19.createElement(ToastItem, { key: t2.id, toast: t2 });
|
|
1968
2081
|
})
|
|
1969
2082
|
),
|
|
1970
2083
|
document.body
|
|
1971
2084
|
);
|
|
1972
2085
|
}
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
2086
|
+
|
|
2087
|
+
// src/Tooltip.tsx
|
|
2088
|
+
var React20 = __toESM(require("react"), 1);
|
|
2089
|
+
var import_react_dom5 = require("react-dom");
|
|
2090
|
+
var Tooltip = React20.forwardRef(function Tooltip2(props, ref) {
|
|
2091
|
+
const id = uid(), st = React20.useState(false), open = props.open !== void 0 ? props.open : st[0], set = st[1];
|
|
2092
|
+
const anchor = React20.useRef(null), anchorMerged = useMergedRef(ref, anchor), tip = React20.useRef(null), timer = React20.useRef(void 0);
|
|
2093
|
+
const pos = React20.useState(null);
|
|
1977
2094
|
function show(now) {
|
|
1978
2095
|
clearTimeout(timer.current);
|
|
1979
2096
|
timer.current = setTimeout(
|
|
@@ -1998,7 +2115,7 @@ var Tooltip = React13.forwardRef(function Tooltip2(props, ref) {
|
|
|
1998
2115
|
},
|
|
1999
2116
|
[open]
|
|
2000
2117
|
);
|
|
2001
|
-
|
|
2118
|
+
React20.useEffect(
|
|
2002
2119
|
function() {
|
|
2003
2120
|
if (!open) return;
|
|
2004
2121
|
function esc(e) {
|
|
@@ -2011,8 +2128,8 @@ var Tooltip = React13.forwardRef(function Tooltip2(props, ref) {
|
|
|
2011
2128
|
},
|
|
2012
2129
|
[open]
|
|
2013
2130
|
);
|
|
2014
|
-
const child =
|
|
2015
|
-
const trigger = /* @__PURE__ */
|
|
2131
|
+
const child = React20.Children.only(props.children);
|
|
2132
|
+
const trigger = /* @__PURE__ */ React20.createElement(
|
|
2016
2133
|
"span",
|
|
2017
2134
|
{
|
|
2018
2135
|
ref: anchorMerged,
|
|
@@ -2026,10 +2143,10 @@ var Tooltip = React13.forwardRef(function Tooltip2(props, ref) {
|
|
|
2026
2143
|
},
|
|
2027
2144
|
onBlur: hide
|
|
2028
2145
|
},
|
|
2029
|
-
|
|
2146
|
+
React20.cloneElement(child, { "aria-describedby": open ? id : child.props["aria-describedby"] })
|
|
2030
2147
|
);
|
|
2031
|
-
return /* @__PURE__ */
|
|
2032
|
-
/* @__PURE__ */
|
|
2148
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, trigger, open ? (0, import_react_dom5.createPortal)(
|
|
2149
|
+
/* @__PURE__ */ React20.createElement(
|
|
2033
2150
|
"div",
|
|
2034
2151
|
{
|
|
2035
2152
|
ref: tip,
|
|
@@ -2045,16 +2162,16 @@ var Tooltip = React13.forwardRef(function Tooltip2(props, ref) {
|
|
|
2045
2162
|
});
|
|
2046
2163
|
|
|
2047
2164
|
// src/Dialog.tsx
|
|
2048
|
-
var
|
|
2049
|
-
var
|
|
2165
|
+
var React22 = __toESM(require("react"), 1);
|
|
2166
|
+
var import_react_dom6 = require("react-dom");
|
|
2050
2167
|
|
|
2051
|
-
// src/
|
|
2052
|
-
var
|
|
2168
|
+
// src/useModal.tsx
|
|
2169
|
+
var React21 = __toESM(require("react"), 1);
|
|
2053
2170
|
function useModal(open, ref, opts) {
|
|
2054
2171
|
const mounted = useMounted();
|
|
2055
|
-
const prev =
|
|
2172
|
+
const prev = React21.useRef(null);
|
|
2056
2173
|
const o = opts || {};
|
|
2057
|
-
|
|
2174
|
+
React21.useEffect(
|
|
2058
2175
|
function() {
|
|
2059
2176
|
if (!open || !mounted) return;
|
|
2060
2177
|
prev.current = document.activeElement;
|
|
@@ -2095,9 +2212,9 @@ function useModal(open, ref, opts) {
|
|
|
2095
2212
|
}
|
|
2096
2213
|
|
|
2097
2214
|
// src/Dialog.tsx
|
|
2098
|
-
var Dialog =
|
|
2215
|
+
var Dialog = React22.forwardRef(function Dialog2(props, ref) {
|
|
2099
2216
|
const t = useStrings();
|
|
2100
|
-
const own =
|
|
2217
|
+
const own = React22.useRef(null), merged = useMergedRef(ref, own), titleId = uid(), descId = uid();
|
|
2101
2218
|
function close() {
|
|
2102
2219
|
if (props.dismissible !== false && props.onClose) props.onClose();
|
|
2103
2220
|
}
|
|
@@ -2108,8 +2225,8 @@ var Dialog = React15.forwardRef(function Dialog2(props, ref) {
|
|
|
2108
2225
|
footSelector: ".aura-dialog__foot"
|
|
2109
2226
|
});
|
|
2110
2227
|
if (!modal.ready) return null;
|
|
2111
|
-
return (0,
|
|
2112
|
-
/* @__PURE__ */
|
|
2228
|
+
return (0, import_react_dom6.createPortal)(
|
|
2229
|
+
/* @__PURE__ */ React22.createElement("div", { className: "aura-dialog-layer", onKeyDown: modal.onKeyDown }, /* @__PURE__ */ React22.createElement("div", { className: "aura-scrim", onClick: close, "aria-hidden": true }), /* @__PURE__ */ React22.createElement(
|
|
2113
2230
|
"div",
|
|
2114
2231
|
{
|
|
2115
2232
|
ref: merged,
|
|
@@ -2120,17 +2237,17 @@ var Dialog = React15.forwardRef(function Dialog2(props, ref) {
|
|
|
2120
2237
|
tabIndex: -1,
|
|
2121
2238
|
className: cx("aura-dialog", "aura-dialog--" + (props.size || "md"), props.className)
|
|
2122
2239
|
},
|
|
2123
|
-
/* @__PURE__ */
|
|
2124
|
-
props.description ? /* @__PURE__ */
|
|
2125
|
-
props.children ? /* @__PURE__ */
|
|
2126
|
-
props.footer ? /* @__PURE__ */
|
|
2240
|
+
/* @__PURE__ */ React22.createElement("div", { className: "aura-dialog__head" }, /* @__PURE__ */ React22.createElement("h2", { className: "aura-dialog__title", id: titleId }, props.title), props.dismissible !== false ? /* @__PURE__ */ React22.createElement(IconButton, { icon: "x", label: t.close, className: "aura-dialog__close", onClick: close }) : null),
|
|
2241
|
+
props.description ? /* @__PURE__ */ React22.createElement("p", { className: "aura-dialog__desc", id: descId }, props.description) : null,
|
|
2242
|
+
props.children ? /* @__PURE__ */ React22.createElement("div", { className: "aura-dialog__body" }, props.children) : null,
|
|
2243
|
+
props.footer ? /* @__PURE__ */ React22.createElement("div", { className: "aura-dialog__foot" }, props.footer) : null
|
|
2127
2244
|
)),
|
|
2128
2245
|
document.body
|
|
2129
2246
|
);
|
|
2130
2247
|
});
|
|
2131
|
-
var Drawer =
|
|
2248
|
+
var Drawer = React22.forwardRef(function Drawer2(props, ref) {
|
|
2132
2249
|
const t = useStrings();
|
|
2133
|
-
const own =
|
|
2250
|
+
const own = React22.useRef(null), merged = useMergedRef(ref, own), titleId = uid(), descId = uid();
|
|
2134
2251
|
function close() {
|
|
2135
2252
|
if (props.dismissible !== false && props.onClose) props.onClose();
|
|
2136
2253
|
}
|
|
@@ -2142,8 +2259,8 @@ var Drawer = React15.forwardRef(function Drawer2(props, ref) {
|
|
|
2142
2259
|
});
|
|
2143
2260
|
if (!modal.ready) return null;
|
|
2144
2261
|
const side = props.side === "left" ? "left" : "right";
|
|
2145
|
-
return (0,
|
|
2146
|
-
/* @__PURE__ */
|
|
2262
|
+
return (0, import_react_dom6.createPortal)(
|
|
2263
|
+
/* @__PURE__ */ React22.createElement("div", { className: "aura-dialog-layer aura-drawer-layer", onKeyDown: modal.onKeyDown }, /* @__PURE__ */ React22.createElement("div", { className: "aura-scrim", onClick: close, "aria-hidden": true }), /* @__PURE__ */ React22.createElement(
|
|
2147
2264
|
"div",
|
|
2148
2265
|
{
|
|
2149
2266
|
ref: merged,
|
|
@@ -2155,17 +2272,17 @@ var Drawer = React15.forwardRef(function Drawer2(props, ref) {
|
|
|
2155
2272
|
tabIndex: -1,
|
|
2156
2273
|
className: cx("aura-drawer", "aura-drawer--" + side, "aura-drawer--" + (props.size || "md"), props.className)
|
|
2157
2274
|
},
|
|
2158
|
-
props.title || props.dismissible !== false ? /* @__PURE__ */
|
|
2159
|
-
props.description ? /* @__PURE__ */
|
|
2160
|
-
/* @__PURE__ */
|
|
2161
|
-
props.footer ? /* @__PURE__ */
|
|
2275
|
+
props.title || props.dismissible !== false ? /* @__PURE__ */ React22.createElement("div", { className: "aura-drawer__head" }, props.title ? /* @__PURE__ */ React22.createElement("h2", { className: "aura-drawer__title", id: titleId }, props.title) : /* @__PURE__ */ React22.createElement("span", { style: { flex: 1 } }), props.dismissible !== false ? /* @__PURE__ */ React22.createElement(IconButton, { icon: "x", label: t.close, onClick: close }) : null) : null,
|
|
2276
|
+
props.description ? /* @__PURE__ */ React22.createElement("p", { className: "aura-drawer__desc", id: descId }, props.description) : null,
|
|
2277
|
+
/* @__PURE__ */ React22.createElement("div", { className: "aura-drawer__body" }, props.children),
|
|
2278
|
+
props.footer ? /* @__PURE__ */ React22.createElement("div", { className: "aura-drawer__foot" }, props.footer) : null
|
|
2162
2279
|
)),
|
|
2163
2280
|
document.body
|
|
2164
2281
|
);
|
|
2165
2282
|
});
|
|
2166
2283
|
|
|
2167
2284
|
// src/DataTable.tsx
|
|
2168
|
-
var
|
|
2285
|
+
var React23 = __toESM(require("react"), 1);
|
|
2169
2286
|
var BP = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
2170
2287
|
var DEFAULT_COLUMNS = [
|
|
2171
2288
|
{ key: "id", label: "ID", width: 96, mono: true },
|
|
@@ -2177,7 +2294,7 @@ var SKELETON_WIDTHS = ["72%", "56%", "84%", "44%", "64%"];
|
|
|
2177
2294
|
var ROW_H = 48;
|
|
2178
2295
|
var OVERSCAN = 8;
|
|
2179
2296
|
var FLEX_MIN = 160;
|
|
2180
|
-
var DataTable =
|
|
2297
|
+
var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
2181
2298
|
const t = useStrings();
|
|
2182
2299
|
const columns = props.columns || DEFAULT_COLUMNS;
|
|
2183
2300
|
const byKey = {};
|
|
@@ -2220,23 +2337,23 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2220
2337
|
}),
|
|
2221
2338
|
props.onPinnedColumnsChange
|
|
2222
2339
|
);
|
|
2223
|
-
const widthState =
|
|
2340
|
+
const widthState = React23.useState({});
|
|
2224
2341
|
const widths = widthState[0], setWidths = widthState[1];
|
|
2225
|
-
const activeState =
|
|
2226
|
-
const scrollState =
|
|
2342
|
+
const activeState = React23.useState({ r: 1, c: 0 });
|
|
2343
|
+
const scrollState = React23.useState(0);
|
|
2227
2344
|
const scrollTop = scrollState[0], setScrollTop = scrollState[1];
|
|
2228
|
-
const scrolledX =
|
|
2229
|
-
const menuState =
|
|
2345
|
+
const scrolledX = React23.useState(false);
|
|
2346
|
+
const menuState = React23.useState(null);
|
|
2230
2347
|
const menu = menuState[0], setMenu = menuState[1];
|
|
2231
|
-
const dragState =
|
|
2348
|
+
const dragState = React23.useState(null);
|
|
2232
2349
|
const drag = dragState[0], setDrag = dragState[1];
|
|
2233
|
-
const gridRef =
|
|
2234
|
-
const wrapRef =
|
|
2235
|
-
const boxWidth =
|
|
2350
|
+
const gridRef = React23.useRef(null);
|
|
2351
|
+
const wrapRef = React23.useRef(null), wrapMerged = useMergedRef(ref, wrapRef);
|
|
2352
|
+
const boxWidth = React23.useState(null);
|
|
2236
2353
|
const measure = !!props.stackBelow || columns.some(function(c) {
|
|
2237
2354
|
return c.hideBelow != null;
|
|
2238
2355
|
});
|
|
2239
|
-
|
|
2356
|
+
React23.useEffect(
|
|
2240
2357
|
function() {
|
|
2241
2358
|
if (!measure || !wrapRef.current || typeof ResizeObserver === "undefined") return;
|
|
2242
2359
|
const ro = new ResizeObserver(function(en) {
|
|
@@ -2255,9 +2372,9 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2255
2372
|
const px = typeof c.hideBelow === "number" ? c.hideBelow : BP[c.hideBelow];
|
|
2256
2373
|
return px != null && boxWidth[0] < px;
|
|
2257
2374
|
}
|
|
2258
|
-
const scrollRef =
|
|
2259
|
-
const pending =
|
|
2260
|
-
const resizing =
|
|
2375
|
+
const scrollRef = React23.useRef(null);
|
|
2376
|
+
const pending = React23.useRef(null);
|
|
2377
|
+
const resizing = React23.useRef(false);
|
|
2261
2378
|
useIsoLayoutEffect(function() {
|
|
2262
2379
|
if (stacked || !gridRef.current) return;
|
|
2263
2380
|
const els = gridRef.current.querySelectorAll(
|
|
@@ -2316,7 +2433,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2316
2433
|
if (isPinned(c)) s.left = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + "px)";
|
|
2317
2434
|
return s;
|
|
2318
2435
|
}
|
|
2319
|
-
const view =
|
|
2436
|
+
const view = React23.useMemo(
|
|
2320
2437
|
function() {
|
|
2321
2438
|
if (!sort || !sort.key || !byKey[sort.key]) return rows;
|
|
2322
2439
|
const col = byKey[sort.key];
|
|
@@ -2375,7 +2492,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2375
2492
|
if (!activeRendered) return r === 0 && c === ac ? 0 : -1;
|
|
2376
2493
|
return r === ar && c === ac ? 0 : -1;
|
|
2377
2494
|
}
|
|
2378
|
-
|
|
2495
|
+
React23.useEffect(function() {
|
|
2379
2496
|
const p = pending.current;
|
|
2380
2497
|
if (!p || !gridRef.current) return;
|
|
2381
2498
|
let c = p.c;
|
|
@@ -2686,10 +2803,10 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2686
2803
|
e.stopPropagation();
|
|
2687
2804
|
}
|
|
2688
2805
|
}
|
|
2689
|
-
const head = [/* @__PURE__ */
|
|
2806
|
+
const head = [/* @__PURE__ */ React23.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
|
|
2690
2807
|
if (selectable)
|
|
2691
2808
|
head.push(
|
|
2692
|
-
/* @__PURE__ */
|
|
2809
|
+
/* @__PURE__ */ React23.createElement(
|
|
2693
2810
|
"span",
|
|
2694
2811
|
{
|
|
2695
2812
|
key: "__sel",
|
|
@@ -2703,7 +2820,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2703
2820
|
activeState[1]({ r: 0, c: 0 });
|
|
2704
2821
|
}
|
|
2705
2822
|
},
|
|
2706
|
-
nRows ? /* @__PURE__ */
|
|
2823
|
+
nRows ? /* @__PURE__ */ React23.createElement(
|
|
2707
2824
|
Checkbox,
|
|
2708
2825
|
{
|
|
2709
2826
|
checked: all,
|
|
@@ -2722,7 +2839,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2722
2839
|
const ariaSort = isSorted && canSort ? sort.dir === "desc" ? "descending" : "ascending" : canSort ? "none" : void 0;
|
|
2723
2840
|
const pin = isPinned(c), edge = pin && i === nPinned - 1;
|
|
2724
2841
|
head.push(
|
|
2725
|
-
/* @__PURE__ */
|
|
2842
|
+
/* @__PURE__ */ React23.createElement(
|
|
2726
2843
|
"span",
|
|
2727
2844
|
{
|
|
2728
2845
|
key: c.key,
|
|
@@ -2770,7 +2887,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2770
2887
|
setDrag(null);
|
|
2771
2888
|
}
|
|
2772
2889
|
},
|
|
2773
|
-
/* @__PURE__ */
|
|
2890
|
+
/* @__PURE__ */ React23.createElement("span", { className: "aura-table__th-inner" }, canSort ? /* @__PURE__ */ React23.createElement(
|
|
2774
2891
|
"button",
|
|
2775
2892
|
{
|
|
2776
2893
|
type: "button",
|
|
@@ -2783,8 +2900,8 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2783
2900
|
}
|
|
2784
2901
|
},
|
|
2785
2902
|
c.label,
|
|
2786
|
-
/* @__PURE__ */
|
|
2787
|
-
) : /* @__PURE__ */
|
|
2903
|
+
/* @__PURE__ */ React23.createElement(Icon, { name: isSorted ? sort.dir === "desc" ? "arrow-down" : "arrow-up" : "arrow-up-down", size: 12 })
|
|
2904
|
+
) : /* @__PURE__ */ React23.createElement("span", { className: cx("aura-table__th-label", !c.label && "aura-sr-only") }, c.label || (c.actions ? t.actions : c.key)), pin ? /* @__PURE__ */ React23.createElement(Icon, { name: "pin", size: 12, className: "aura-table__pin-icon", label: t.pinned }) : null, controls ? /* @__PURE__ */ React23.createElement(
|
|
2788
2905
|
"button",
|
|
2789
2906
|
{
|
|
2790
2907
|
type: "button",
|
|
@@ -2798,9 +2915,9 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2798
2915
|
openMenu("col", c.key, e.currentTarget, { r: 0, c: ci });
|
|
2799
2916
|
}
|
|
2800
2917
|
},
|
|
2801
|
-
/* @__PURE__ */
|
|
2918
|
+
/* @__PURE__ */ React23.createElement(Icon, { name: "ellipsis" })
|
|
2802
2919
|
) : null),
|
|
2803
|
-
canResize(c) ? /* @__PURE__ */
|
|
2920
|
+
canResize(c) ? /* @__PURE__ */ React23.createElement(
|
|
2804
2921
|
"span",
|
|
2805
2922
|
{
|
|
2806
2923
|
className: "aura-table__resize",
|
|
@@ -2822,7 +2939,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2822
2939
|
);
|
|
2823
2940
|
});
|
|
2824
2941
|
head.push(
|
|
2825
|
-
/* @__PURE__ */
|
|
2942
|
+
/* @__PURE__ */ React23.createElement(
|
|
2826
2943
|
"span",
|
|
2827
2944
|
{
|
|
2828
2945
|
key: "__gr",
|
|
@@ -2833,10 +2950,10 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2833
2950
|
);
|
|
2834
2951
|
function rowCells(r, i, k, isSel) {
|
|
2835
2952
|
const ri = i + 1;
|
|
2836
|
-
const cells = [/* @__PURE__ */
|
|
2953
|
+
const cells = [/* @__PURE__ */ React23.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
|
|
2837
2954
|
if (selectable)
|
|
2838
2955
|
cells.push(
|
|
2839
|
-
/* @__PURE__ */
|
|
2956
|
+
/* @__PURE__ */ React23.createElement(
|
|
2840
2957
|
"span",
|
|
2841
2958
|
{
|
|
2842
2959
|
key: "__sel",
|
|
@@ -2850,7 +2967,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2850
2967
|
if (e.target === e.currentTarget) activeState[1]({ r: ri, c: 0 });
|
|
2851
2968
|
}
|
|
2852
2969
|
},
|
|
2853
|
-
/* @__PURE__ */
|
|
2970
|
+
/* @__PURE__ */ React23.createElement(
|
|
2854
2971
|
Checkbox,
|
|
2855
2972
|
{
|
|
2856
2973
|
checked: isSel,
|
|
@@ -2866,7 +2983,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2866
2983
|
vis.forEach(function(c, j) {
|
|
2867
2984
|
const ci = j + (selectable ? 1 : 0), v = r[c.key], pin = isPinned(c);
|
|
2868
2985
|
cells.push(
|
|
2869
|
-
/* @__PURE__ */
|
|
2986
|
+
/* @__PURE__ */ React23.createElement(
|
|
2870
2987
|
"span",
|
|
2871
2988
|
{
|
|
2872
2989
|
key: c.key,
|
|
@@ -2885,12 +3002,12 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2885
3002
|
if (activeState[0].r !== ri || activeState[0].c !== ci) activeState[1]({ r: ri, c: ci });
|
|
2886
3003
|
}
|
|
2887
3004
|
},
|
|
2888
|
-
c.render ? c.render(r) : c.pill ? /* @__PURE__ */
|
|
3005
|
+
c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React23.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v
|
|
2889
3006
|
)
|
|
2890
3007
|
);
|
|
2891
3008
|
});
|
|
2892
3009
|
cells.push(
|
|
2893
|
-
/* @__PURE__ */
|
|
3010
|
+
/* @__PURE__ */ React23.createElement(
|
|
2894
3011
|
"span",
|
|
2895
3012
|
{
|
|
2896
3013
|
key: "__gr",
|
|
@@ -2907,14 +3024,14 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2907
3024
|
const n2 = pageSize || props.skeletonRows || 5;
|
|
2908
3025
|
const skRows = body = [];
|
|
2909
3026
|
for (let i = 0; i < n2; i++) {
|
|
2910
|
-
const sk = [/* @__PURE__ */
|
|
3027
|
+
const sk = [/* @__PURE__ */ React23.createElement("span", { key: "__gl", className: "aura-table__gutter" })];
|
|
2911
3028
|
if (selectable)
|
|
2912
3029
|
sk.push(
|
|
2913
|
-
/* @__PURE__ */
|
|
3030
|
+
/* @__PURE__ */ React23.createElement("span", { key: "__sel", className: cx("aura-table__sel", nPinned && "is-pinned") }, /* @__PURE__ */ React23.createElement("span", { className: "aura-skel aura-skel--box" }))
|
|
2914
3031
|
);
|
|
2915
3032
|
vis.forEach(function(c, j) {
|
|
2916
3033
|
sk.push(
|
|
2917
|
-
/* @__PURE__ */
|
|
3034
|
+
/* @__PURE__ */ React23.createElement("span", { key: c.key, className: cx("aura-table__td", isPinned(c) && "is-pinned"), style: cellStyle(c, j) }, /* @__PURE__ */ React23.createElement(
|
|
2918
3035
|
"span",
|
|
2919
3036
|
{
|
|
2920
3037
|
className: cx("aura-skel", c.pill && "aura-skel--pill"),
|
|
@@ -2924,24 +3041,24 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2924
3041
|
);
|
|
2925
3042
|
});
|
|
2926
3043
|
sk.push(
|
|
2927
|
-
/* @__PURE__ */
|
|
3044
|
+
/* @__PURE__ */ React23.createElement("span", { key: "__gr", className: cx("aura-table__gutter aura-table__gutter--end", controls && "has-picker") })
|
|
2928
3045
|
);
|
|
2929
3046
|
skRows.push(
|
|
2930
|
-
/* @__PURE__ */
|
|
3047
|
+
/* @__PURE__ */ React23.createElement("div", { key: "sk" + i, className: "aura-table__row aura-table__row--skeleton", "aria-hidden": true, style: rowStyle }, sk)
|
|
2931
3048
|
);
|
|
2932
3049
|
}
|
|
2933
3050
|
} else if (!rows.length) {
|
|
2934
3051
|
const em = props.empty || {};
|
|
2935
|
-
body = /* @__PURE__ */
|
|
3052
|
+
body = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty", role: "row" }, /* @__PURE__ */ React23.createElement("div", { role: "gridcell" }, /* @__PURE__ */ React23.createElement("span", { className: "aura-table__empty-icon" }, /* @__PURE__ */ React23.createElement(Icon, { name: em.icon || "inbox", size: "lg" })), /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-title" }, em.title || t.empty), em.description ? /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-text" }, em.description) : null, em.action ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty-action" }, em.action) : null));
|
|
2936
3053
|
} else {
|
|
2937
3054
|
const bodyRows = body = [];
|
|
2938
3055
|
if (virtual && start > 0)
|
|
2939
|
-
bodyRows.push(/* @__PURE__ */
|
|
3056
|
+
bodyRows.push(/* @__PURE__ */ React23.createElement("div", { key: "__top", style: { height: start * ROW_H + "px" }, "aria-hidden": true }));
|
|
2940
3057
|
for (let ri = start; ri < end; ri++) {
|
|
2941
3058
|
(function(r, i) {
|
|
2942
3059
|
const k = r[rowKey], isSel = !!selSet[k];
|
|
2943
3060
|
bodyRows.push(
|
|
2944
|
-
/* @__PURE__ */
|
|
3061
|
+
/* @__PURE__ */ React23.createElement(
|
|
2945
3062
|
"div",
|
|
2946
3063
|
{
|
|
2947
3064
|
key: k,
|
|
@@ -2962,12 +3079,12 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2962
3079
|
})(pageRows[ri], ri);
|
|
2963
3080
|
}
|
|
2964
3081
|
if (virtual && end < pageRows.length)
|
|
2965
|
-
bodyRows.push(/* @__PURE__ */
|
|
3082
|
+
bodyRows.push(/* @__PURE__ */ React23.createElement("div", { key: "__bot", style: { height: (pageRows.length - end) * ROW_H + "px" }, "aria-hidden": true }));
|
|
2966
3083
|
}
|
|
2967
3084
|
let foot = null;
|
|
2968
3085
|
if (pageSize && (rows.length || loading)) {
|
|
2969
3086
|
const from = rows.length ? first + 1 : 0, to = Math.min(first + pageSize, view.length);
|
|
2970
|
-
foot = /* @__PURE__ */
|
|
3087
|
+
foot = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React23.createElement("span", { "aria-live": "polite" }, loading ? t.loading : t.range(from, to, view.length)), /* @__PURE__ */ React23.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React23.createElement("span", null, t.page(page, pageCount)), /* @__PURE__ */ React23.createElement(
|
|
2971
3088
|
IconButton,
|
|
2972
3089
|
{
|
|
2973
3090
|
icon: "chevron-left",
|
|
@@ -2977,7 +3094,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2977
3094
|
goPage(page - 1);
|
|
2978
3095
|
}
|
|
2979
3096
|
}
|
|
2980
|
-
), /* @__PURE__ */
|
|
3097
|
+
), /* @__PURE__ */ React23.createElement(
|
|
2981
3098
|
IconButton,
|
|
2982
3099
|
{
|
|
2983
3100
|
icon: "chevron-right",
|
|
@@ -2989,7 +3106,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2989
3106
|
}
|
|
2990
3107
|
)));
|
|
2991
3108
|
} else if (height && rows.length && !loading) {
|
|
2992
|
-
foot = /* @__PURE__ */
|
|
3109
|
+
foot = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React23.createElement("span", null, t.rowCount(view.length)), selectable && selected.length ? /* @__PURE__ */ React23.createElement("span", null, t.selectedCount(selected.length)) : /* @__PURE__ */ React23.createElement("span", null));
|
|
2993
3110
|
}
|
|
2994
3111
|
if (stacked) {
|
|
2995
3112
|
const titleCol = vis[0], pillCol = vis.filter(function(c) {
|
|
@@ -3003,20 +3120,20 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3003
3120
|
});
|
|
3004
3121
|
let cardBody;
|
|
3005
3122
|
if (loading) {
|
|
3006
|
-
cardBody = /* @__PURE__ */
|
|
3007
|
-
return /* @__PURE__ */
|
|
3123
|
+
cardBody = /* @__PURE__ */ React23.createElement("ul", { className: "aura-table__cards", "aria-busy": true }, [0, 1, 2].map(function(i) {
|
|
3124
|
+
return /* @__PURE__ */ React23.createElement("li", { key: i, className: "aura-table__card", "aria-hidden": true }, /* @__PURE__ */ React23.createElement("span", { className: "aura-skel", style: { width: "50%", height: "14px" } }), /* @__PURE__ */ React23.createElement("span", { className: "aura-skel", style: { width: "80%" } }), /* @__PURE__ */ React23.createElement("span", { className: "aura-skel", style: { width: "64%" } }));
|
|
3008
3125
|
}));
|
|
3009
3126
|
} else if (!rows.length) {
|
|
3010
3127
|
const em2 = props.empty || {};
|
|
3011
|
-
cardBody = /* @__PURE__ */
|
|
3128
|
+
cardBody = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty" }, /* @__PURE__ */ React23.createElement("div", null, /* @__PURE__ */ React23.createElement("span", { className: "aura-table__empty-icon" }, /* @__PURE__ */ React23.createElement(Icon, { name: em2.icon || "inbox", size: "lg" })), /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-title" }, em2.title || t.empty), em2.description ? /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-text" }, em2.description) : null, em2.action ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty-action" }, em2.action) : null));
|
|
3012
3129
|
} else {
|
|
3013
3130
|
const cellVal = function(c, r) {
|
|
3014
3131
|
const v = r[c.key];
|
|
3015
|
-
return c.render ? c.render(r) : c.pill ? /* @__PURE__ */
|
|
3132
|
+
return c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React23.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v;
|
|
3016
3133
|
};
|
|
3017
|
-
cardBody = /* @__PURE__ */
|
|
3134
|
+
cardBody = /* @__PURE__ */ React23.createElement("ul", { className: "aura-table__cards", "aria-label": props.label }, pageRows.map(function(r) {
|
|
3018
3135
|
const k = r[rowKey], isSel = !!selSet[k];
|
|
3019
|
-
return /* @__PURE__ */
|
|
3136
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3020
3137
|
"li",
|
|
3021
3138
|
{
|
|
3022
3139
|
key: k,
|
|
@@ -3031,7 +3148,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3031
3148
|
if (e.target === e.currentTarget && e.key === "Enter" && props.onRowActivate) props.onRowActivate(r);
|
|
3032
3149
|
}
|
|
3033
3150
|
},
|
|
3034
|
-
/* @__PURE__ */
|
|
3151
|
+
/* @__PURE__ */ React23.createElement("div", { className: "aura-table__card-head" }, selectable ? /* @__PURE__ */ React23.createElement(
|
|
3035
3152
|
Checkbox,
|
|
3036
3153
|
{
|
|
3037
3154
|
checked: isSel,
|
|
@@ -3040,16 +3157,16 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3040
3157
|
toggle(k, on);
|
|
3041
3158
|
}
|
|
3042
3159
|
}
|
|
3043
|
-
) : null, /* @__PURE__ */
|
|
3044
|
-
return /* @__PURE__ */
|
|
3160
|
+
) : null, /* @__PURE__ */ React23.createElement("span", { className: cx("aura-table__card-title", titleCol.mono && "aura-table__mono") }, cellVal(titleCol, r)), pillCol ? cellVal(pillCol, r) : null, actionCols.map(function(c) {
|
|
3161
|
+
return /* @__PURE__ */ React23.createElement("span", { key: c.key, className: "aura-table__card-actions" }, cellVal(c, r));
|
|
3045
3162
|
})),
|
|
3046
|
-
rest.length ? /* @__PURE__ */
|
|
3047
|
-
return /* @__PURE__ */
|
|
3163
|
+
rest.length ? /* @__PURE__ */ React23.createElement("dl", { className: "aura-table__card-fields" }, rest.map(function(c) {
|
|
3164
|
+
return /* @__PURE__ */ React23.createElement("div", { key: c.key }, /* @__PURE__ */ React23.createElement("dt", null, c.label), /* @__PURE__ */ React23.createElement("dd", { className: c.mono ? "aura-table__mono" : void 0 }, cellVal(c, r)));
|
|
3048
3165
|
})) : null
|
|
3049
3166
|
);
|
|
3050
3167
|
}));
|
|
3051
3168
|
}
|
|
3052
|
-
return /* @__PURE__ */
|
|
3169
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3053
3170
|
"div",
|
|
3054
3171
|
{
|
|
3055
3172
|
ref: wrapMerged,
|
|
@@ -3058,7 +3175,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3058
3175
|
"aria-label": props.label,
|
|
3059
3176
|
"aria-busy": loading || void 0
|
|
3060
3177
|
},
|
|
3061
|
-
selectable && pageRows.length && !loading ? /* @__PURE__ */
|
|
3178
|
+
selectable && pageRows.length && !loading ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__stack-bar" }, /* @__PURE__ */ React23.createElement(
|
|
3062
3179
|
Checkbox,
|
|
3063
3180
|
{
|
|
3064
3181
|
checked: all,
|
|
@@ -3066,7 +3183,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3066
3183
|
label: all ? t.deselectAllRows : t.selectAllRows,
|
|
3067
3184
|
onChange: toggleAll
|
|
3068
3185
|
}
|
|
3069
|
-
), /* @__PURE__ */
|
|
3186
|
+
), /* @__PURE__ */ React23.createElement("span", null, nSel ? t.selectedCount(nSel) : t.selectAll)) : null,
|
|
3070
3187
|
cardBody,
|
|
3071
3188
|
foot
|
|
3072
3189
|
);
|
|
@@ -3076,7 +3193,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3076
3193
|
scrollPaddingTop: ROW_H + "px"
|
|
3077
3194
|
};
|
|
3078
3195
|
if (height) scrollStyle.height = height + "px";
|
|
3079
|
-
return /* @__PURE__ */
|
|
3196
|
+
return /* @__PURE__ */ React23.createElement("div", { ref: wrapMerged, className: cx("aura-table", scrolledX[0] && "is-scrolled-x", props.className) }, /* @__PURE__ */ React23.createElement(
|
|
3080
3197
|
"div",
|
|
3081
3198
|
{
|
|
3082
3199
|
ref: function(el) {
|
|
@@ -3101,9 +3218,9 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3101
3218
|
if (sx !== scrolledX[0]) scrolledX[1](sx);
|
|
3102
3219
|
}
|
|
3103
3220
|
},
|
|
3104
|
-
/* @__PURE__ */
|
|
3221
|
+
/* @__PURE__ */ React23.createElement("div", { className: "aura-table__head", role: "row", "aria-rowindex": 1, style: rowStyle }, head),
|
|
3105
3222
|
body
|
|
3106
|
-
), loading ? /* @__PURE__ */
|
|
3223
|
+
), loading ? /* @__PURE__ */ React23.createElement("span", { className: "aura-sr-only", role: "status" }, t.loadingRows) : null, controls ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__picker" }, /* @__PURE__ */ React23.createElement(
|
|
3107
3224
|
IconButton,
|
|
3108
3225
|
{
|
|
3109
3226
|
icon: "columns-3",
|
|
@@ -3113,7 +3230,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3113
3230
|
openMenu("picker", null, e.currentTarget);
|
|
3114
3231
|
}
|
|
3115
3232
|
}
|
|
3116
|
-
)) : null, foot, menu ? /* @__PURE__ */
|
|
3233
|
+
)) : null, foot, menu ? /* @__PURE__ */ React23.createElement(
|
|
3117
3234
|
Menu,
|
|
3118
3235
|
{
|
|
3119
3236
|
anchor: menu.anchor,
|
|
@@ -3124,12 +3241,12 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3124
3241
|
) : null);
|
|
3125
3242
|
});
|
|
3126
3243
|
|
|
3127
|
-
// src/
|
|
3128
|
-
var
|
|
3129
|
-
var
|
|
3130
|
-
var Card =
|
|
3244
|
+
// src/Card.tsx
|
|
3245
|
+
var React24 = __toESM(require("react"), 1);
|
|
3246
|
+
var h4 = React24.createElement;
|
|
3247
|
+
var Card = React24.forwardRef(function Card2(props, ref) {
|
|
3131
3248
|
const creative = props.variant === "creative";
|
|
3132
|
-
return
|
|
3249
|
+
return h4(
|
|
3133
3250
|
props.as || "section",
|
|
3134
3251
|
{
|
|
3135
3252
|
ref,
|
|
@@ -3141,19 +3258,22 @@ var Card = React17.forwardRef(function Card2(props, ref) {
|
|
|
3141
3258
|
),
|
|
3142
3259
|
"aria-labelledby": props.title && props.titleId ? props.titleId : void 0
|
|
3143
3260
|
},
|
|
3144
|
-
props.title || props.actions ? /* @__PURE__ */
|
|
3145
|
-
props.children ? /* @__PURE__ */
|
|
3146
|
-
props.footer ? /* @__PURE__ */
|
|
3261
|
+
props.title || props.actions ? /* @__PURE__ */ React24.createElement("div", { className: "aura-card__head" }, /* @__PURE__ */ React24.createElement("div", { className: "aura-card__heading" }, props.title ? h4("h" + (props.headingLevel || 3), { className: "aura-card__title", id: props.titleId }, props.title) : null, props.description ? /* @__PURE__ */ React24.createElement("p", { className: "aura-card__desc" }, props.description) : null), props.actions ? /* @__PURE__ */ React24.createElement("div", { className: "aura-card__actions" }, props.actions) : null) : null,
|
|
3262
|
+
props.children ? /* @__PURE__ */ React24.createElement("div", { className: "aura-card__body" }, props.children) : null,
|
|
3263
|
+
props.footer ? /* @__PURE__ */ React24.createElement("div", { className: "aura-card__foot" }, props.footer) : null
|
|
3147
3264
|
);
|
|
3148
3265
|
});
|
|
3149
|
-
|
|
3266
|
+
|
|
3267
|
+
// src/Tabs.tsx
|
|
3268
|
+
var React25 = __toESM(require("react"), 1);
|
|
3269
|
+
var Tabs = React25.forwardRef(function Tabs2(props, ref) {
|
|
3150
3270
|
const items = props.tabs || [], base = uid();
|
|
3151
3271
|
const st = useMaybeControlled(
|
|
3152
3272
|
props.value,
|
|
3153
3273
|
props.defaultValue || items[0] && items[0].id,
|
|
3154
3274
|
props.onChange
|
|
3155
3275
|
);
|
|
3156
|
-
const refs =
|
|
3276
|
+
const refs = React25.useRef({});
|
|
3157
3277
|
const current2 = items.filter(function(t) {
|
|
3158
3278
|
return t.id === st[0];
|
|
3159
3279
|
})[0] || items[0];
|
|
@@ -3165,7 +3285,7 @@ var Tabs = React17.forwardRef(function Tabs2(props, ref) {
|
|
|
3165
3285
|
st[1](t.id);
|
|
3166
3286
|
if (refs.current[t.id]) refs.current[t.id].focus();
|
|
3167
3287
|
}
|
|
3168
|
-
return /* @__PURE__ */
|
|
3288
|
+
return /* @__PURE__ */ React25.createElement("div", { ref, className: cx("aura-tabs", props.className) }, /* @__PURE__ */ React25.createElement(
|
|
3169
3289
|
"div",
|
|
3170
3290
|
{
|
|
3171
3291
|
role: "tablist",
|
|
@@ -3192,7 +3312,7 @@ var Tabs = React17.forwardRef(function Tabs2(props, ref) {
|
|
|
3192
3312
|
},
|
|
3193
3313
|
items.map(function(t) {
|
|
3194
3314
|
const on = current2 && t.id === current2.id;
|
|
3195
|
-
return /* @__PURE__ */
|
|
3315
|
+
return /* @__PURE__ */ React25.createElement(
|
|
3196
3316
|
"button",
|
|
3197
3317
|
{
|
|
3198
3318
|
key: t.id,
|
|
@@ -3211,12 +3331,12 @@ var Tabs = React17.forwardRef(function Tabs2(props, ref) {
|
|
|
3211
3331
|
st[1](t.id);
|
|
3212
3332
|
}
|
|
3213
3333
|
},
|
|
3214
|
-
t.icon ? /* @__PURE__ */
|
|
3334
|
+
t.icon ? /* @__PURE__ */ React25.createElement(Icon, { name: t.icon }) : null,
|
|
3215
3335
|
t.label,
|
|
3216
|
-
t.count != null ? /* @__PURE__ */
|
|
3336
|
+
t.count != null ? /* @__PURE__ */ React25.createElement("span", { className: "aura-tab__count" }, t.count) : null
|
|
3217
3337
|
);
|
|
3218
3338
|
})
|
|
3219
|
-
), current2 && current2.content !== void 0 ? /* @__PURE__ */
|
|
3339
|
+
), current2 && current2.content !== void 0 ? /* @__PURE__ */ React25.createElement(
|
|
3220
3340
|
"div",
|
|
3221
3341
|
{
|
|
3222
3342
|
role: "tabpanel",
|
|
@@ -3228,7 +3348,10 @@ var Tabs = React17.forwardRef(function Tabs2(props, ref) {
|
|
|
3228
3348
|
current2.content
|
|
3229
3349
|
) : null);
|
|
3230
3350
|
});
|
|
3231
|
-
|
|
3351
|
+
|
|
3352
|
+
// src/SideNav.tsx
|
|
3353
|
+
var React26 = __toESM(require("react"), 1);
|
|
3354
|
+
var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
3232
3355
|
const t = useStrings();
|
|
3233
3356
|
const st = useMaybeControlled(
|
|
3234
3357
|
props.value,
|
|
@@ -3238,9 +3361,9 @@ var SideNav = React17.forwardRef(function SideNav2(props, ref) {
|
|
|
3238
3361
|
function item(it) {
|
|
3239
3362
|
const on = st[0] === it.id;
|
|
3240
3363
|
const inner = [
|
|
3241
|
-
it.icon ? /* @__PURE__ */
|
|
3242
|
-
/* @__PURE__ */
|
|
3243
|
-
it.count != null ? /* @__PURE__ */
|
|
3364
|
+
it.icon ? /* @__PURE__ */ React26.createElement(Icon, { key: "i", name: it.icon }) : null,
|
|
3365
|
+
/* @__PURE__ */ React26.createElement("span", { key: "l", className: "aura-nav__label" }, it.label),
|
|
3366
|
+
it.count != null ? /* @__PURE__ */ React26.createElement("span", { key: "c", className: "aura-nav__count" }, it.count) : null
|
|
3244
3367
|
];
|
|
3245
3368
|
const common = {
|
|
3246
3369
|
className: cx("aura-nav__item", on && "is-active"),
|
|
@@ -3250,33 +3373,39 @@ var SideNav = React17.forwardRef(function SideNav2(props, ref) {
|
|
|
3250
3373
|
st[1](it.id);
|
|
3251
3374
|
}
|
|
3252
3375
|
};
|
|
3253
|
-
return /* @__PURE__ */
|
|
3376
|
+
return /* @__PURE__ */ React26.createElement("li", { key: it.id }, it.href ? /* @__PURE__ */ React26.createElement("a", { href: it.href, ...common }, inner) : /* @__PURE__ */ React26.createElement("button", { type: "button", ...common }, inner));
|
|
3254
3377
|
}
|
|
3255
|
-
return /* @__PURE__ */
|
|
3256
|
-
return /* @__PURE__ */
|
|
3257
|
-
})), props.footer ? /* @__PURE__ */
|
|
3378
|
+
return /* @__PURE__ */ React26.createElement("nav", { ref, className: cx("aura-nav", props.className), "aria-label": props.label || t.mainNav }, props.header ? /* @__PURE__ */ React26.createElement("div", { className: "aura-nav__header" }, props.header) : null, /* @__PURE__ */ React26.createElement("div", { className: "aura-nav__scroll" }, (props.sections || [{ items: props.items || [] }]).map(function(s, i) {
|
|
3379
|
+
return /* @__PURE__ */ React26.createElement("div", { key: i, className: "aura-nav__section" }, s.title ? /* @__PURE__ */ React26.createElement("p", { className: "aura-nav__title" }, s.title) : null, /* @__PURE__ */ React26.createElement("ul", { className: "aura-nav__list" }, s.items.map(item)));
|
|
3380
|
+
})), props.footer ? /* @__PURE__ */ React26.createElement("div", { className: "aura-nav__footer" }, props.footer) : null);
|
|
3258
3381
|
});
|
|
3259
|
-
|
|
3382
|
+
|
|
3383
|
+
// src/Breadcrumb.tsx
|
|
3384
|
+
var React27 = __toESM(require("react"), 1);
|
|
3385
|
+
var Breadcrumb = React27.forwardRef(function Breadcrumb2(props, ref) {
|
|
3260
3386
|
const t = useStrings();
|
|
3261
3387
|
const items = props.items || [];
|
|
3262
|
-
return /* @__PURE__ */
|
|
3388
|
+
return /* @__PURE__ */ React27.createElement("nav", { ref, "aria-label": props.label || t.breadcrumb, className: cx("aura-crumbs", props.className) }, /* @__PURE__ */ React27.createElement("ol", null, items.map(function(it, i) {
|
|
3263
3389
|
const last = i === items.length - 1;
|
|
3264
|
-
return /* @__PURE__ */
|
|
3390
|
+
return /* @__PURE__ */ React27.createElement("li", { key: i }, last ? /* @__PURE__ */ React27.createElement("span", { "aria-current": "page", className: "aura-crumbs__current" }, it.label) : it.href ? /* @__PURE__ */ React27.createElement("a", { href: it.href, onClick: it.onClick }, it.label) : /* @__PURE__ */ React27.createElement("button", { type: "button", onClick: it.onClick }, it.label), last ? null : /* @__PURE__ */ React27.createElement(Icon, { name: "chevron-right", size: 12, className: "aura-crumbs__sep" }));
|
|
3265
3391
|
})));
|
|
3266
3392
|
});
|
|
3393
|
+
|
|
3394
|
+
// src/Avatar.tsx
|
|
3395
|
+
var React28 = __toESM(require("react"), 1);
|
|
3267
3396
|
var AVATAR_TONES = ["progress", "ready", "neutral", "warning"];
|
|
3268
3397
|
function initials(name) {
|
|
3269
3398
|
const parts = String(name || "?").trim().split(/\s+/);
|
|
3270
3399
|
return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
|
|
3271
3400
|
}
|
|
3272
|
-
var Avatar =
|
|
3273
|
-
const size = props.size || "md", errState =
|
|
3401
|
+
var Avatar = React28.forwardRef(function Avatar2(props, ref) {
|
|
3402
|
+
const size = props.size || "md", errState = React28.useState(false);
|
|
3274
3403
|
let hash = 0;
|
|
3275
3404
|
String(props.name || "").split("").forEach(function(ch) {
|
|
3276
3405
|
hash = hash * 31 + ch.charCodeAt(0) >>> 0;
|
|
3277
3406
|
});
|
|
3278
3407
|
const tone2 = AVATAR_TONES[hash % AVATAR_TONES.length];
|
|
3279
|
-
return /* @__PURE__ */
|
|
3408
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3280
3409
|
"span",
|
|
3281
3410
|
{
|
|
3282
3411
|
ref,
|
|
@@ -3284,7 +3413,7 @@ var Avatar = React17.forwardRef(function Avatar2(props, ref) {
|
|
|
3284
3413
|
role: "img",
|
|
3285
3414
|
"aria-label": props.name + (props.status ? ", " + props.status : "")
|
|
3286
3415
|
},
|
|
3287
|
-
props.src && !errState[0] ? /* @__PURE__ */
|
|
3416
|
+
props.src && !errState[0] ? /* @__PURE__ */ React28.createElement(
|
|
3288
3417
|
"img",
|
|
3289
3418
|
{
|
|
3290
3419
|
src: props.src,
|
|
@@ -3293,18 +3422,20 @@ var Avatar = React17.forwardRef(function Avatar2(props, ref) {
|
|
|
3293
3422
|
errState[1](true);
|
|
3294
3423
|
}
|
|
3295
3424
|
}
|
|
3296
|
-
) : /* @__PURE__ */
|
|
3297
|
-
props.status === "online" ? /* @__PURE__ */
|
|
3425
|
+
) : /* @__PURE__ */ React28.createElement("span", { "aria-hidden": true }, initials(props.name)),
|
|
3426
|
+
props.status === "online" ? /* @__PURE__ */ React28.createElement("span", { className: "aura-avatar__status", "aria-hidden": true }) : null
|
|
3298
3427
|
);
|
|
3299
3428
|
});
|
|
3300
3429
|
|
|
3301
|
-
// src/
|
|
3302
|
-
var
|
|
3303
|
-
|
|
3430
|
+
// src/Stack.tsx
|
|
3431
|
+
var React30 = __toESM(require("react"), 1);
|
|
3432
|
+
|
|
3433
|
+
// src/responsive.tsx
|
|
3434
|
+
var React29 = __toESM(require("react"), 1);
|
|
3304
3435
|
var breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
3305
3436
|
var ORDER = ["base", "sm", "md", "lg", "xl"];
|
|
3306
3437
|
function useBreakpoint() {
|
|
3307
|
-
return
|
|
3438
|
+
return React29.useSyncExternalStore(subscribe, current, function() {
|
|
3308
3439
|
return "lg";
|
|
3309
3440
|
});
|
|
3310
3441
|
}
|
|
@@ -3342,7 +3473,10 @@ function respVars(prefix, value, map) {
|
|
|
3342
3473
|
var space = function(v) {
|
|
3343
3474
|
return typeof v === "number" ? "var(--aura-space-" + v + ")" : v;
|
|
3344
3475
|
};
|
|
3345
|
-
|
|
3476
|
+
|
|
3477
|
+
// src/Stack.tsx
|
|
3478
|
+
var h5 = React30.createElement;
|
|
3479
|
+
var Stack = React30.forwardRef(function Stack2(props, ref) {
|
|
3346
3480
|
const style = Object.assign(
|
|
3347
3481
|
{},
|
|
3348
3482
|
respVars("aura-stack-dir", props.direction || "column"),
|
|
@@ -3352,23 +3486,31 @@ var Stack = React18.forwardRef(function Stack2(props, ref) {
|
|
|
3352
3486
|
props.wrap ? { flexWrap: "wrap" } : null,
|
|
3353
3487
|
props.style
|
|
3354
3488
|
);
|
|
3355
|
-
return
|
|
3489
|
+
return h5(props.as || "div", { ref, className: cx("aura-stack", props.className), style }, props.children);
|
|
3356
3490
|
});
|
|
3357
|
-
|
|
3491
|
+
|
|
3492
|
+
// src/Grid.tsx
|
|
3493
|
+
var React31 = __toESM(require("react"), 1);
|
|
3494
|
+
var h6 = React31.createElement;
|
|
3495
|
+
var Grid = React31.forwardRef(function Grid2(props, ref) {
|
|
3358
3496
|
const style = Object.assign(
|
|
3359
3497
|
{},
|
|
3360
3498
|
respVars("aura-grid-gap", props.gap == null ? 6 : props.gap, space),
|
|
3361
3499
|
props.minItemWidth ? { gridTemplateColumns: "repeat(auto-fill, minmax(min(" + props.minItemWidth + "px, 100%), 1fr))" } : respVars("aura-grid-cols", props.columns || 1),
|
|
3362
3500
|
props.style
|
|
3363
3501
|
);
|
|
3364
|
-
return
|
|
3502
|
+
return h6(
|
|
3365
3503
|
props.as || "div",
|
|
3366
3504
|
{ ref, className: cx("aura-grid-layout", props.minItemWidth && "is-auto", props.className), style },
|
|
3367
3505
|
props.children
|
|
3368
3506
|
);
|
|
3369
3507
|
});
|
|
3370
|
-
|
|
3371
|
-
|
|
3508
|
+
|
|
3509
|
+
// src/Container.tsx
|
|
3510
|
+
var React32 = __toESM(require("react"), 1);
|
|
3511
|
+
var h7 = React32.createElement;
|
|
3512
|
+
var Container = React32.forwardRef(function Container2(props, ref) {
|
|
3513
|
+
return h7(
|
|
3372
3514
|
props.as || "div",
|
|
3373
3515
|
{
|
|
3374
3516
|
ref,
|
|
@@ -3378,26 +3520,29 @@ var Container = React18.forwardRef(function Container2(props, ref) {
|
|
|
3378
3520
|
props.children
|
|
3379
3521
|
);
|
|
3380
3522
|
});
|
|
3381
|
-
|
|
3523
|
+
|
|
3524
|
+
// src/AppShell.tsx
|
|
3525
|
+
var React33 = __toESM(require("react"), 1);
|
|
3526
|
+
var AppShell = React33.forwardRef(function AppShell2(props, ref) {
|
|
3382
3527
|
const t = useStrings();
|
|
3383
3528
|
const bp = useBreakpoint();
|
|
3384
3529
|
const compact = bp === "base" || bp === "sm" || bp === "md";
|
|
3385
|
-
const st =
|
|
3386
|
-
|
|
3530
|
+
const st = React33.useState(false), open = st[0], setOpen = st[1];
|
|
3531
|
+
React33.useEffect(
|
|
3387
3532
|
function() {
|
|
3388
3533
|
if (!compact) setOpen(false);
|
|
3389
3534
|
},
|
|
3390
3535
|
[compact]
|
|
3391
3536
|
);
|
|
3392
3537
|
const navEl = props.nav;
|
|
3393
|
-
const nav = props.nav &&
|
|
3538
|
+
const nav = props.nav && React33.isValidElement(props.nav) && compact ? React33.cloneElement(navEl, {
|
|
3394
3539
|
onChange: function(id) {
|
|
3395
3540
|
if (navEl.props.onChange) navEl.props.onChange(id);
|
|
3396
3541
|
setOpen(false);
|
|
3397
3542
|
},
|
|
3398
3543
|
className: cx(navEl.props.className, "is-in-drawer")
|
|
3399
3544
|
}) : props.nav;
|
|
3400
|
-
return /* @__PURE__ */
|
|
3545
|
+
return /* @__PURE__ */ React33.createElement("div", { ref, className: cx("aura-shell", compact && "is-compact", props.className) }, !compact ? /* @__PURE__ */ React33.createElement("div", { className: "aura-shell__nav" }, nav) : null, compact ? /* @__PURE__ */ React33.createElement(
|
|
3401
3546
|
Drawer,
|
|
3402
3547
|
{
|
|
3403
3548
|
open,
|
|
@@ -3410,7 +3555,7 @@ var AppShell = React18.forwardRef(function AppShell2(props, ref) {
|
|
|
3410
3555
|
dismissible: true
|
|
3411
3556
|
},
|
|
3412
3557
|
nav
|
|
3413
|
-
) : null, /* @__PURE__ */
|
|
3558
|
+
) : null, /* @__PURE__ */ React33.createElement("div", { className: "aura-shell__main" }, props.header || compact ? /* @__PURE__ */ React33.createElement("header", { className: "aura-shell__bar" }, compact ? /* @__PURE__ */ React33.createElement(
|
|
3414
3559
|
IconButton,
|
|
3415
3560
|
{
|
|
3416
3561
|
icon: "menu",
|
|
@@ -3421,16 +3566,16 @@ var AppShell = React18.forwardRef(function AppShell2(props, ref) {
|
|
|
3421
3566
|
},
|
|
3422
3567
|
"aria-expanded": open
|
|
3423
3568
|
}
|
|
3424
|
-
) : null, /* @__PURE__ */
|
|
3569
|
+
) : null, /* @__PURE__ */ React33.createElement("div", { className: "aura-shell__bar-content" }, props.header)) : null, /* @__PURE__ */ React33.createElement("main", { className: "aura-shell__content", id: props.mainId || "main" }, props.children)));
|
|
3425
3570
|
});
|
|
3426
3571
|
|
|
3427
3572
|
// src/Surface.tsx
|
|
3428
|
-
var
|
|
3429
|
-
var
|
|
3430
|
-
var Surface =
|
|
3573
|
+
var React34 = __toESM(require("react"), 1);
|
|
3574
|
+
var h8 = React34.createElement;
|
|
3575
|
+
var Surface = React34.forwardRef(function Surface2(props, ref) {
|
|
3431
3576
|
const t = props.texture || "mesh";
|
|
3432
3577
|
const rest = omit(props, ["texture", "className", "children", "as"]);
|
|
3433
|
-
return
|
|
3578
|
+
return h8(
|
|
3434
3579
|
props.as || "div",
|
|
3435
3580
|
Object.assign({}, rest, {
|
|
3436
3581
|
ref,
|
|
@@ -3448,14 +3593,14 @@ var Surface = React19.forwardRef(function Surface2(props, ref) {
|
|
|
3448
3593
|
});
|
|
3449
3594
|
|
|
3450
3595
|
// src/Stat.tsx
|
|
3451
|
-
var
|
|
3452
|
-
var Stat =
|
|
3596
|
+
var React35 = __toESM(require("react"), 1);
|
|
3597
|
+
var Stat = React35.forwardRef(function Stat2(props, ref) {
|
|
3453
3598
|
const ch = props.change;
|
|
3454
3599
|
const dir = ch && (ch.direction || "flat");
|
|
3455
3600
|
const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
|
|
3456
3601
|
const Tag3 = props.href ? "a" : props.onClick ? "button" : "div";
|
|
3457
3602
|
const interactive = Tag3 !== "div";
|
|
3458
|
-
return /* @__PURE__ */
|
|
3603
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3459
3604
|
Tag3,
|
|
3460
3605
|
{
|
|
3461
3606
|
ref,
|
|
@@ -3465,15 +3610,15 @@ var Stat = React20.forwardRef(function Stat2(props, ref) {
|
|
|
3465
3610
|
type: Tag3 === "button" ? "button" : void 0,
|
|
3466
3611
|
"aria-busy": props.loading || void 0
|
|
3467
3612
|
},
|
|
3468
|
-
/* @__PURE__ */
|
|
3469
|
-
props.loading ? /* @__PURE__ */
|
|
3470
|
-
ch && !props.loading || props.caption ? /* @__PURE__ */
|
|
3613
|
+
/* @__PURE__ */ React35.createElement("span", { className: "aura-stat__head" }, /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__label" }, props.label), props.icon ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__icon" }, /* @__PURE__ */ React35.createElement(Icon, { name: props.icon })) : null),
|
|
3614
|
+
props.loading ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__value" }, /* @__PURE__ */ React35.createElement("span", { className: "aura-skel aura-stat__skel" })) : /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__value" }, props.value, props.unit ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__unit" }, props.unit) : null),
|
|
3615
|
+
ch && !props.loading || props.caption ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__foot" }, ch && !props.loading ? /* @__PURE__ */ React35.createElement("span", { className: cx("aura-stat__change", "is-" + tone2) }, /* @__PURE__ */ React35.createElement(Icon, { name: dir === "up" ? "trending-up" : dir === "down" ? "trending-down" : "minus", size: 14 }), /* @__PURE__ */ React35.createElement("span", null, ch.value)) : null, ch && ch.label && !props.loading ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__caption" }, ch.label) : null, props.caption ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__caption" }, props.caption) : null) : null
|
|
3471
3616
|
);
|
|
3472
3617
|
});
|
|
3473
3618
|
|
|
3474
3619
|
// src/TimePicker.tsx
|
|
3475
|
-
var
|
|
3476
|
-
var
|
|
3620
|
+
var React36 = __toESM(require("react"), 1);
|
|
3621
|
+
var import_react_dom7 = require("react-dom");
|
|
3477
3622
|
function pad2(n2) {
|
|
3478
3623
|
return (n2 < 10 ? "0" : "") + n2;
|
|
3479
3624
|
}
|
|
@@ -3496,7 +3641,7 @@ function parseTime(text) {
|
|
|
3496
3641
|
if (hh > 23 || mm > 59) return null;
|
|
3497
3642
|
return pad2(hh) + ":" + pad2(mm);
|
|
3498
3643
|
}
|
|
3499
|
-
var TimePicker =
|
|
3644
|
+
var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
3500
3645
|
const t = useStrings();
|
|
3501
3646
|
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
3502
3647
|
const st = useMaybeControlled(
|
|
@@ -3506,7 +3651,7 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3506
3651
|
);
|
|
3507
3652
|
const value = st[0];
|
|
3508
3653
|
const step = props.step || 30, lo = toMin(props.min) != null ? toMin(props.min) : 0, hi = toMin(props.max) != null ? toMin(props.max) : 24 * 60 - 1;
|
|
3509
|
-
const slots =
|
|
3654
|
+
const slots = React36.useMemo(
|
|
3510
3655
|
function() {
|
|
3511
3656
|
const out = [];
|
|
3512
3657
|
for (let m = lo; m <= hi; m += step) out.push(fromMin(m));
|
|
@@ -3518,12 +3663,12 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3518
3663
|
const n2 = toMin(v);
|
|
3519
3664
|
return n2 == null || n2 < lo || n2 > hi || props.isTimeDisabled && props.isTimeDisabled(v);
|
|
3520
3665
|
}
|
|
3521
|
-
const openState =
|
|
3522
|
-
const editState =
|
|
3523
|
-
const aState =
|
|
3524
|
-
const errState =
|
|
3525
|
-
const pos =
|
|
3526
|
-
const boxRef =
|
|
3666
|
+
const openState = React36.useState(false), open = openState[0], setOpen = openState[1];
|
|
3667
|
+
const editState = React36.useState(null), editing = editState[0], setEditing = editState[1];
|
|
3668
|
+
const aState = React36.useState(0), active = aState[0], setActive = aState[1];
|
|
3669
|
+
const errState = React36.useState(null);
|
|
3670
|
+
const pos = React36.useState(null);
|
|
3671
|
+
const boxRef = React36.useRef(null), inputRef = React36.useRef(null), listRef = React36.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
3527
3672
|
const mounted = useMounted();
|
|
3528
3673
|
function nearest(v) {
|
|
3529
3674
|
const n2 = toMin(v);
|
|
@@ -3551,7 +3696,7 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3551
3696
|
},
|
|
3552
3697
|
[open]
|
|
3553
3698
|
);
|
|
3554
|
-
|
|
3699
|
+
React36.useEffect(
|
|
3555
3700
|
function() {
|
|
3556
3701
|
if (!open) return;
|
|
3557
3702
|
function outside(e) {
|
|
@@ -3573,7 +3718,7 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3573
3718
|
},
|
|
3574
3719
|
[open]
|
|
3575
3720
|
);
|
|
3576
|
-
|
|
3721
|
+
React36.useEffect(
|
|
3577
3722
|
function() {
|
|
3578
3723
|
if (!open || !listRef.current) return;
|
|
3579
3724
|
const el = listRef.current.querySelector('[data-idx="' + active + '"]');
|
|
@@ -3670,10 +3815,10 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3670
3815
|
}
|
|
3671
3816
|
}
|
|
3672
3817
|
const error = errState[0] || props.error;
|
|
3673
|
-
const list = open && mounted && pos[0] ? (0,
|
|
3674
|
-
/* @__PURE__ */
|
|
3818
|
+
const list = open && mounted && pos[0] ? (0, import_react_dom7.createPortal)(
|
|
3819
|
+
/* @__PURE__ */ React36.createElement("div", { ref: listRef, className: "aura-combo__popover aura-time__popover", style: pos[0] }, /* @__PURE__ */ React36.createElement("ul", { id: listId, role: "listbox", "aria-label": props.label, className: "aura-combo__list" }, slots.map(function(s, i) {
|
|
3675
3820
|
const dis = blocked(s), sel = s === value;
|
|
3676
|
-
return /* @__PURE__ */
|
|
3821
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3677
3822
|
"li",
|
|
3678
3823
|
{
|
|
3679
3824
|
key: s,
|
|
@@ -3698,13 +3843,13 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3698
3843
|
if (active !== i) setActive(i);
|
|
3699
3844
|
}
|
|
3700
3845
|
},
|
|
3701
|
-
/* @__PURE__ */
|
|
3702
|
-
sel ? /* @__PURE__ */
|
|
3846
|
+
/* @__PURE__ */ React36.createElement("span", { className: "aura-combo__label" }, s),
|
|
3847
|
+
sel ? /* @__PURE__ */ React36.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
3703
3848
|
);
|
|
3704
3849
|
}))),
|
|
3705
3850
|
document.body
|
|
3706
3851
|
) : null;
|
|
3707
|
-
return /* @__PURE__ */
|
|
3852
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3708
3853
|
Field,
|
|
3709
3854
|
{
|
|
3710
3855
|
id,
|
|
@@ -3716,7 +3861,7 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3716
3861
|
disabled: props.disabled,
|
|
3717
3862
|
className: props.className
|
|
3718
3863
|
},
|
|
3719
|
-
/* @__PURE__ */
|
|
3864
|
+
/* @__PURE__ */ React36.createElement("div", { ref: boxRef, className: cx("aura-input aura-combo aura-time has-icon", open && "is-open") }, /* @__PURE__ */ React36.createElement(Icon, { name: "clock", className: "aura-input__icon" }), /* @__PURE__ */ React36.createElement(
|
|
3720
3865
|
"input",
|
|
3721
3866
|
{
|
|
3722
3867
|
ref: inputMerged,
|
|
@@ -3756,7 +3901,7 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3756
3901
|
}, 0);
|
|
3757
3902
|
}
|
|
3758
3903
|
}
|
|
3759
|
-
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */
|
|
3904
|
+
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */ React36.createElement(
|
|
3760
3905
|
"button",
|
|
3761
3906
|
{
|
|
3762
3907
|
type: "button",
|
|
@@ -3769,8 +3914,8 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3769
3914
|
if (inputRef.current) inputRef.current.focus();
|
|
3770
3915
|
}
|
|
3771
3916
|
},
|
|
3772
|
-
/* @__PURE__ */
|
|
3773
|
-
) : null, /* @__PURE__ */
|
|
3917
|
+
/* @__PURE__ */ React36.createElement(Icon, { name: "x" })
|
|
3918
|
+
) : null, /* @__PURE__ */ React36.createElement(
|
|
3774
3919
|
"button",
|
|
3775
3920
|
{
|
|
3776
3921
|
type: "button",
|
|
@@ -3788,14 +3933,14 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3788
3933
|
}
|
|
3789
3934
|
}
|
|
3790
3935
|
},
|
|
3791
|
-
/* @__PURE__ */
|
|
3936
|
+
/* @__PURE__ */ React36.createElement(Icon, { name: "chevron-down" })
|
|
3792
3937
|
)),
|
|
3793
3938
|
list
|
|
3794
3939
|
);
|
|
3795
3940
|
});
|
|
3796
3941
|
|
|
3797
3942
|
// src/FileUpload.tsx
|
|
3798
|
-
var
|
|
3943
|
+
var React37 = __toESM(require("react"), 1);
|
|
3799
3944
|
function formatBytes(n2) {
|
|
3800
3945
|
if (n2 == null) return "";
|
|
3801
3946
|
if (n2 < 1024) return n2 + " B";
|
|
@@ -3829,17 +3974,17 @@ function describeAccept(accept, t) {
|
|
|
3829
3974
|
}).join(", ");
|
|
3830
3975
|
}
|
|
3831
3976
|
var seq = 0;
|
|
3832
|
-
var FileUpload =
|
|
3977
|
+
var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
3833
3978
|
const t = useStrings();
|
|
3834
3979
|
const auto = uid(), id = props.id || auto;
|
|
3835
3980
|
const st = useMaybeControlled(props.value, props.defaultValue || [], props.onChange);
|
|
3836
3981
|
const items = st[0] || [];
|
|
3837
|
-
const dragState =
|
|
3838
|
-
const inputRef =
|
|
3839
|
-
const urls =
|
|
3982
|
+
const dragState = React37.useState(false), over = dragState[0];
|
|
3983
|
+
const inputRef = React37.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
3984
|
+
const urls = React37.useRef({});
|
|
3840
3985
|
const maxFiles = props.multiple ? props.maxFiles : 1;
|
|
3841
3986
|
const note = t.accepts(describeAccept(props.accept, t), props.maxSize ? formatBytes(props.maxSize) : "");
|
|
3842
|
-
|
|
3987
|
+
React37.useEffect(function() {
|
|
3843
3988
|
return function() {
|
|
3844
3989
|
Object.keys(urls.current).forEach(function(k) {
|
|
3845
3990
|
URL.revokeObjectURL(urls.current[k]);
|
|
@@ -3890,7 +4035,7 @@ var FileUpload = React22.forwardRef(function FileUpload2(props, ref) {
|
|
|
3890
4035
|
if (inputRef.current) inputRef.current.focus();
|
|
3891
4036
|
}
|
|
3892
4037
|
const error = props.error;
|
|
3893
|
-
return /* @__PURE__ */
|
|
4038
|
+
return /* @__PURE__ */ React37.createElement(
|
|
3894
4039
|
Field,
|
|
3895
4040
|
{
|
|
3896
4041
|
id,
|
|
@@ -3902,7 +4047,7 @@ var FileUpload = React22.forwardRef(function FileUpload2(props, ref) {
|
|
|
3902
4047
|
disabled: props.disabled,
|
|
3903
4048
|
className: props.className
|
|
3904
4049
|
},
|
|
3905
|
-
/* @__PURE__ */
|
|
4050
|
+
/* @__PURE__ */ React37.createElement(
|
|
3906
4051
|
"div",
|
|
3907
4052
|
{
|
|
3908
4053
|
className: cx("aura-upload", over && "is-over", props.disabled && "is-disabled", error && "is-invalid"),
|
|
@@ -3923,9 +4068,9 @@ var FileUpload = React22.forwardRef(function FileUpload2(props, ref) {
|
|
|
3923
4068
|
add(e.dataTransfer && e.dataTransfer.files);
|
|
3924
4069
|
}
|
|
3925
4070
|
},
|
|
3926
|
-
/* @__PURE__ */
|
|
3927
|
-
/* @__PURE__ */
|
|
3928
|
-
/* @__PURE__ */
|
|
4071
|
+
/* @__PURE__ */ React37.createElement(Icon, { name: "cloud-upload", size: "lg", className: "aura-upload__icon" }),
|
|
4072
|
+
/* @__PURE__ */ React37.createElement("span", { className: "aura-upload__text" }, t.dropFiles, " "),
|
|
4073
|
+
/* @__PURE__ */ React37.createElement(
|
|
3929
4074
|
"input",
|
|
3930
4075
|
{
|
|
3931
4076
|
ref: inputMerged,
|
|
@@ -3947,12 +4092,12 @@ var FileUpload = React22.forwardRef(function FileUpload2(props, ref) {
|
|
|
3947
4092
|
}
|
|
3948
4093
|
}
|
|
3949
4094
|
),
|
|
3950
|
-
/* @__PURE__ */
|
|
3951
|
-
note ? /* @__PURE__ */
|
|
4095
|
+
/* @__PURE__ */ React37.createElement("span", { className: "aura-upload__browse", "aria-hidden": true }, props.multiple ? t.browse : t.browseOne),
|
|
4096
|
+
note ? /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__note", id: id + "-note" }, note) : null
|
|
3952
4097
|
),
|
|
3953
|
-
items.length ? /* @__PURE__ */
|
|
4098
|
+
items.length ? /* @__PURE__ */ React37.createElement("ul", { className: "aura-upload__list", "aria-live": "polite" }, items.map(function(it) {
|
|
3954
4099
|
const src = thumb(it);
|
|
3955
|
-
return /* @__PURE__ */
|
|
4100
|
+
return /* @__PURE__ */ React37.createElement("li", { key: it.id, className: cx("aura-upload__item", it.error && "is-error") }, src ? /* @__PURE__ */ React37.createElement("img", { className: "aura-upload__thumb", src, alt: "" }) : /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__thumb is-icon", "aria-hidden": true }, /* @__PURE__ */ React37.createElement(Icon, { name: /^image\//.test(it.type || "") ? "image" : "file", size: "md" })), /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__meta" }, /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__name" }, it.name), /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__sub" }, it.error ? /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement(Icon, { name: "circle-alert", size: 12 }), it.error) : it.status === "uploading" ? t.uploading + (it.progress != null ? " " + Math.round(it.progress) + "%" : "") : it.status === "done" ? /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement(Icon, { name: "circle-check", size: 12 }), formatBytes(it.size)) : formatBytes(it.size)), it.status === "uploading" ? /* @__PURE__ */ React37.createElement(
|
|
3956
4101
|
"span",
|
|
3957
4102
|
{
|
|
3958
4103
|
className: "aura-upload__bar",
|
|
@@ -3962,8 +4107,8 @@ var FileUpload = React22.forwardRef(function FileUpload2(props, ref) {
|
|
|
3962
4107
|
"aria-valuemax": 100,
|
|
3963
4108
|
"aria-valuenow": it.progress != null ? Math.round(it.progress) : void 0
|
|
3964
4109
|
},
|
|
3965
|
-
/* @__PURE__ */
|
|
3966
|
-
) : null), /* @__PURE__ */
|
|
4110
|
+
/* @__PURE__ */ React37.createElement("span", { style: { width: (it.progress || 0) + "%" } })
|
|
4111
|
+
) : null), /* @__PURE__ */ React37.createElement(
|
|
3967
4112
|
IconButton,
|
|
3968
4113
|
{
|
|
3969
4114
|
icon: "x",
|
|
@@ -3979,14 +4124,14 @@ var FileUpload = React22.forwardRef(function FileUpload2(props, ref) {
|
|
|
3979
4124
|
|
|
3980
4125
|
// src/theme.ts
|
|
3981
4126
|
function hexToRgb(hex) {
|
|
3982
|
-
let
|
|
3983
|
-
if (
|
|
3984
|
-
|
|
4127
|
+
let h9 = String(hex).trim().replace("#", "");
|
|
4128
|
+
if (h9.length === 3)
|
|
4129
|
+
h9 = h9.split("").map(function(c) {
|
|
3985
4130
|
return c + c;
|
|
3986
4131
|
}).join("");
|
|
3987
|
-
if (!/^[0-9a-f]{6}$/i.test(
|
|
4132
|
+
if (!/^[0-9a-f]{6}$/i.test(h9)) throw new Error('createTheme: "' + hex + '" is not a #rgb or #rrggbb colour');
|
|
3988
4133
|
return [0, 2, 4].map(function(i) {
|
|
3989
|
-
return parseInt(
|
|
4134
|
+
return parseInt(h9.slice(i, i + 2), 16) / 255;
|
|
3990
4135
|
});
|
|
3991
4136
|
}
|
|
3992
4137
|
function rgbToHex(rgb) {
|
|
@@ -4213,9 +4358,9 @@ function createTheme(opts) {
|
|
|
4213
4358
|
}
|
|
4214
4359
|
|
|
4215
4360
|
// src/ThemeStyle.tsx
|
|
4216
|
-
var
|
|
4361
|
+
var React38 = __toESM(require("react"), 1);
|
|
4217
4362
|
function ThemeStyle(props) {
|
|
4218
|
-
const css =
|
|
4363
|
+
const css = React38.useMemo(
|
|
4219
4364
|
function() {
|
|
4220
4365
|
return createTheme({ brand: props.brand, signal: props.signal, primary: props.primary, name: props.name }).css(
|
|
4221
4366
|
props.selector
|
|
@@ -4223,11 +4368,11 @@ function ThemeStyle(props) {
|
|
|
4223
4368
|
},
|
|
4224
4369
|
[props.brand, props.signal, props.primary, props.name, props.selector]
|
|
4225
4370
|
);
|
|
4226
|
-
return /* @__PURE__ */
|
|
4371
|
+
return /* @__PURE__ */ React38.createElement("style", { "data-aura-theme": props.name || props.brand, dangerouslySetInnerHTML: { __html: css } });
|
|
4227
4372
|
}
|
|
4228
4373
|
|
|
4229
4374
|
// src/colorScheme.tsx
|
|
4230
|
-
var
|
|
4375
|
+
var React39 = __toESM(require("react"), 1);
|
|
4231
4376
|
var DEFAULT_KEY = "aura-color-scheme";
|
|
4232
4377
|
var SCHEMES = ["light", "dark", "system"];
|
|
4233
4378
|
var EVENT = "aura-color-scheme";
|
|
@@ -4240,7 +4385,7 @@ function colorSchemeScript(options) {
|
|
|
4240
4385
|
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){}})();`;
|
|
4241
4386
|
}
|
|
4242
4387
|
function ColorSchemeScript(props) {
|
|
4243
|
-
return /* @__PURE__ */
|
|
4388
|
+
return /* @__PURE__ */ React39.createElement("script", { "data-aura-color-scheme": "", dangerouslySetInnerHTML: { __html: colorSchemeScript(props) } });
|
|
4244
4389
|
}
|
|
4245
4390
|
function systemDark() {
|
|
4246
4391
|
return typeof window !== "undefined" && !!window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -4258,7 +4403,7 @@ function apply(scheme) {
|
|
|
4258
4403
|
function useColorScheme(options) {
|
|
4259
4404
|
const key = options && options.storageKey || DEFAULT_KEY;
|
|
4260
4405
|
const fallback = options && options.defaultScheme || "system";
|
|
4261
|
-
const subscribe2 =
|
|
4406
|
+
const subscribe2 = React39.useCallback(
|
|
4262
4407
|
function(cb) {
|
|
4263
4408
|
const mq = window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)") : null;
|
|
4264
4409
|
function onSystem() {
|
|
@@ -4276,7 +4421,7 @@ function useColorScheme(options) {
|
|
|
4276
4421
|
},
|
|
4277
4422
|
[fallback]
|
|
4278
4423
|
);
|
|
4279
|
-
const snapshot =
|
|
4424
|
+
const snapshot = React39.useSyncExternalStore(
|
|
4280
4425
|
subscribe2,
|
|
4281
4426
|
function() {
|
|
4282
4427
|
const s = readScheme(fallback);
|
|
@@ -4287,7 +4432,7 @@ function useColorScheme(options) {
|
|
|
4287
4432
|
}
|
|
4288
4433
|
);
|
|
4289
4434
|
const parts = snapshot.split("|");
|
|
4290
|
-
const setScheme =
|
|
4435
|
+
const setScheme = React39.useCallback(
|
|
4291
4436
|
function(next) {
|
|
4292
4437
|
if (!valid(next)) return;
|
|
4293
4438
|
try {
|
|
@@ -4306,11 +4451,11 @@ function ColorSchemeToggle(props) {
|
|
|
4306
4451
|
const cs = useColorScheme(props);
|
|
4307
4452
|
const names = { light: t.schemeLight, dark: t.schemeDark, system: t.schemeSystem };
|
|
4308
4453
|
const label = props.label || t.colorScheme;
|
|
4309
|
-
return /* @__PURE__ */
|
|
4454
|
+
return /* @__PURE__ */ React39.createElement(
|
|
4310
4455
|
DropdownMenu,
|
|
4311
4456
|
{
|
|
4312
4457
|
label,
|
|
4313
|
-
trigger: /* @__PURE__ */
|
|
4458
|
+
trigger: /* @__PURE__ */ React39.createElement(IconButton, { icon: cs.resolved === "dark" ? "moon" : "sun", label: label + ": " + names[cs.scheme] }),
|
|
4314
4459
|
items: SCHEMES.map(function(s) {
|
|
4315
4460
|
return {
|
|
4316
4461
|
label: names[s],
|
|
@@ -4324,16 +4469,11 @@ function ColorSchemeToggle(props) {
|
|
|
4324
4469
|
);
|
|
4325
4470
|
}
|
|
4326
4471
|
|
|
4327
|
-
// src/
|
|
4328
|
-
var
|
|
4329
|
-
var
|
|
4330
|
-
var TONES = ["neutral", "accent", "success", "warning", "danger"];
|
|
4331
|
-
function tone(t) {
|
|
4332
|
-
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
4333
|
-
}
|
|
4334
|
-
var Badge = React25.forwardRef(function Badge2(props, ref) {
|
|
4472
|
+
// src/Badge.tsx
|
|
4473
|
+
var React40 = __toESM(require("react"), 1);
|
|
4474
|
+
var Badge = React40.forwardRef(function Badge2(props, ref) {
|
|
4335
4475
|
const rest = omit(props, ["tone", "variant", "icon", "className", "children"]);
|
|
4336
|
-
return /* @__PURE__ */
|
|
4476
|
+
return /* @__PURE__ */ React40.createElement(
|
|
4337
4477
|
"span",
|
|
4338
4478
|
{
|
|
4339
4479
|
...rest,
|
|
@@ -4346,20 +4486,23 @@ var Badge = React25.forwardRef(function Badge2(props, ref) {
|
|
|
4346
4486
|
props.className
|
|
4347
4487
|
)
|
|
4348
4488
|
},
|
|
4349
|
-
props.icon ? /* @__PURE__ */
|
|
4489
|
+
props.icon ? /* @__PURE__ */ React40.createElement(Icon, { name: props.icon, size: 12 }) : null,
|
|
4350
4490
|
props.children
|
|
4351
4491
|
);
|
|
4352
4492
|
});
|
|
4353
|
-
|
|
4493
|
+
|
|
4494
|
+
// src/Tag.tsx
|
|
4495
|
+
var React41 = __toESM(require("react"), 1);
|
|
4496
|
+
var Tag = React41.forwardRef(function Tag2(props, ref) {
|
|
4354
4497
|
const t = useStrings();
|
|
4355
4498
|
const selectable = props.onClick != null || props.selected != null;
|
|
4356
4499
|
const rest = omit(props, ["onRemove", "selected", "icon", "className", "children", "disabled", "removeLabel"]);
|
|
4357
4500
|
const inner = [
|
|
4358
|
-
props.icon ? /* @__PURE__ */
|
|
4359
|
-
/* @__PURE__ */
|
|
4501
|
+
props.icon ? /* @__PURE__ */ React41.createElement(Icon, { key: "i", name: props.icon, size: 14 }) : null,
|
|
4502
|
+
/* @__PURE__ */ React41.createElement("span", { key: "t", className: "aura-tag__text" }, props.children)
|
|
4360
4503
|
];
|
|
4361
4504
|
if (selectable) {
|
|
4362
|
-
return /* @__PURE__ */
|
|
4505
|
+
return /* @__PURE__ */ React41.createElement(
|
|
4363
4506
|
"button",
|
|
4364
4507
|
{
|
|
4365
4508
|
...rest,
|
|
@@ -4369,11 +4512,11 @@ var Tag = React25.forwardRef(function Tag2(props, ref) {
|
|
|
4369
4512
|
disabled: props.disabled,
|
|
4370
4513
|
className: cx("aura-tag is-selectable", props.selected && "is-selected", props.className)
|
|
4371
4514
|
},
|
|
4372
|
-
props.selected ? /* @__PURE__ */
|
|
4515
|
+
props.selected ? /* @__PURE__ */ React41.createElement(Icon, { name: "check", size: 14 }) : inner[0],
|
|
4373
4516
|
inner[1]
|
|
4374
4517
|
);
|
|
4375
4518
|
}
|
|
4376
|
-
return /* @__PURE__ */
|
|
4519
|
+
return /* @__PURE__ */ React41.createElement("span", { ...rest, ref, className: cx("aura-tag", props.disabled && "is-disabled", props.className) }, inner, props.onRemove && !props.disabled ? /* @__PURE__ */ React41.createElement(
|
|
4377
4520
|
"button",
|
|
4378
4521
|
{
|
|
4379
4522
|
type: "button",
|
|
@@ -4381,15 +4524,18 @@ var Tag = React25.forwardRef(function Tag2(props, ref) {
|
|
|
4381
4524
|
"aria-label": props.removeLabel || t.remove(typeof props.children === "string" ? props.children : ""),
|
|
4382
4525
|
onClick: props.onRemove
|
|
4383
4526
|
},
|
|
4384
|
-
/* @__PURE__ */
|
|
4527
|
+
/* @__PURE__ */ React41.createElement(Icon, { name: "x", size: 12 })
|
|
4385
4528
|
) : null);
|
|
4386
4529
|
});
|
|
4387
|
-
|
|
4530
|
+
|
|
4531
|
+
// src/Progress.tsx
|
|
4532
|
+
var React42 = __toESM(require("react"), 1);
|
|
4533
|
+
var Progress = React42.forwardRef(function Progress2(props, ref) {
|
|
4388
4534
|
const auto = uid(), id = props.id || auto;
|
|
4389
4535
|
const max = props.max || 100, det = props.value != null;
|
|
4390
4536
|
const pct = det ? Math.max(0, Math.min(100, props.value / max * 100)) : 0;
|
|
4391
4537
|
const shown = props.valueLabel != null ? props.valueLabel : det ? Math.round(pct) + "%" : null;
|
|
4392
|
-
return /* @__PURE__ */
|
|
4538
|
+
return /* @__PURE__ */ React42.createElement(
|
|
4393
4539
|
"div",
|
|
4394
4540
|
{
|
|
4395
4541
|
ref,
|
|
@@ -4400,8 +4546,8 @@ var Progress = React25.forwardRef(function Progress2(props, ref) {
|
|
|
4400
4546
|
props.className
|
|
4401
4547
|
)
|
|
4402
4548
|
},
|
|
4403
|
-
props.label || props.showValue && shown ? /* @__PURE__ */
|
|
4404
|
-
/* @__PURE__ */
|
|
4549
|
+
props.label || props.showValue && shown ? /* @__PURE__ */ React42.createElement("div", { className: "aura-progress__head" }, props.label ? /* @__PURE__ */ React42.createElement("span", { className: "aura-progress__label", id: id + "-label" }, props.label) : /* @__PURE__ */ React42.createElement("span", null), props.showValue && shown ? /* @__PURE__ */ React42.createElement("span", { className: "aura-progress__value" }, shown) : null) : null,
|
|
4550
|
+
/* @__PURE__ */ React42.createElement(
|
|
4405
4551
|
"div",
|
|
4406
4552
|
{
|
|
4407
4553
|
className: cx("aura-progress__track", !det && "is-indeterminate"),
|
|
@@ -4413,18 +4559,21 @@ var Progress = React25.forwardRef(function Progress2(props, ref) {
|
|
|
4413
4559
|
"aria-valuenow": det ? props.value : void 0,
|
|
4414
4560
|
"aria-valuetext": det && props.valueLabel != null ? String(props.valueLabel) : void 0
|
|
4415
4561
|
},
|
|
4416
|
-
/* @__PURE__ */
|
|
4562
|
+
/* @__PURE__ */ React42.createElement("span", { className: "aura-progress__bar", style: det ? { width: pct + "%" } : void 0 })
|
|
4417
4563
|
),
|
|
4418
|
-
props.hint ? /* @__PURE__ */
|
|
4564
|
+
props.hint ? /* @__PURE__ */ React42.createElement("p", { className: "aura-progress__hint" }, props.hint) : null
|
|
4419
4565
|
);
|
|
4420
4566
|
});
|
|
4421
|
-
|
|
4567
|
+
|
|
4568
|
+
// src/Skeleton.tsx
|
|
4569
|
+
var React43 = __toESM(require("react"), 1);
|
|
4570
|
+
var Skeleton = React43.forwardRef(function Skeleton2(props, ref) {
|
|
4422
4571
|
const v = props.variant || "text";
|
|
4423
4572
|
if (v === "text" && (props.lines || 1) > 1) {
|
|
4424
4573
|
const n2 = props.lines, rows = [];
|
|
4425
4574
|
for (let i = 0; i < n2; i++)
|
|
4426
|
-
rows.push(/* @__PURE__ */
|
|
4427
|
-
return /* @__PURE__ */
|
|
4575
|
+
rows.push(/* @__PURE__ */ React43.createElement("span", { key: i, className: "aura-skel aura-skel--text", style: { width: i === n2 - 1 ? "60%" : "100%" } }));
|
|
4576
|
+
return /* @__PURE__ */ React43.createElement(
|
|
4428
4577
|
"span",
|
|
4429
4578
|
{
|
|
4430
4579
|
ref,
|
|
@@ -4439,22 +4588,28 @@ var Skeleton = React25.forwardRef(function Skeleton2(props, ref) {
|
|
|
4439
4588
|
if (v === "circle") {
|
|
4440
4589
|
style.width = style.height = props.size || props.width || 40;
|
|
4441
4590
|
}
|
|
4442
|
-
return /* @__PURE__ */
|
|
4591
|
+
return /* @__PURE__ */ React43.createElement("span", { ref, "aria-hidden": true, className: cx("aura-skel", "aura-skel--" + v, props.className), style });
|
|
4443
4592
|
});
|
|
4444
|
-
|
|
4593
|
+
|
|
4594
|
+
// src/EmptyState.tsx
|
|
4595
|
+
var React44 = __toESM(require("react"), 1);
|
|
4596
|
+
var EmptyState = React44.forwardRef(function EmptyState2(props, ref) {
|
|
4445
4597
|
const HT = "h" + (props.headingLevel || 3);
|
|
4446
|
-
return /* @__PURE__ */
|
|
4598
|
+
return /* @__PURE__ */ React44.createElement(
|
|
4447
4599
|
"div",
|
|
4448
4600
|
{
|
|
4449
4601
|
ref,
|
|
4450
4602
|
className: cx("aura-empty", props.size === "sm" && "is-sm", props.bordered && "is-bordered", props.className)
|
|
4451
4603
|
},
|
|
4452
|
-
/* @__PURE__ */
|
|
4453
|
-
/* @__PURE__ */
|
|
4454
|
-
props.description ? /* @__PURE__ */
|
|
4455
|
-
props.action ? /* @__PURE__ */
|
|
4604
|
+
/* @__PURE__ */ React44.createElement("span", { className: "aura-empty__icon", "aria-hidden": true }, /* @__PURE__ */ React44.createElement(Icon, { name: props.icon || "inbox", size: props.size === "sm" ? "md" : "lg" })),
|
|
4605
|
+
/* @__PURE__ */ React44.createElement(HT, { className: "aura-empty__title" }, props.title),
|
|
4606
|
+
props.description ? /* @__PURE__ */ React44.createElement("p", { className: "aura-empty__text" }, props.description) : null,
|
|
4607
|
+
props.action ? /* @__PURE__ */ React44.createElement("div", { className: "aura-empty__action" }, props.action) : null
|
|
4456
4608
|
);
|
|
4457
4609
|
});
|
|
4610
|
+
|
|
4611
|
+
// src/Pagination.tsx
|
|
4612
|
+
var React45 = __toESM(require("react"), 1);
|
|
4458
4613
|
function pageList(page, count, sib) {
|
|
4459
4614
|
let out = [], lo = Math.max(2, page - sib), hi = Math.min(count - 1, page + sib);
|
|
4460
4615
|
if (page - sib <= 3) {
|
|
@@ -4474,7 +4629,7 @@ function pageList(page, count, sib) {
|
|
|
4474
4629
|
if (count > 1) out.push(count);
|
|
4475
4630
|
return out;
|
|
4476
4631
|
}
|
|
4477
|
-
var Pagination =
|
|
4632
|
+
var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
4478
4633
|
const t = useStrings();
|
|
4479
4634
|
const count = Math.max(1, props.pageCount || 1);
|
|
4480
4635
|
const st = useMaybeControlled(props.page, props.defaultPage || 1, props.onChange);
|
|
@@ -4492,7 +4647,7 @@ var Pagination = React25.forwardRef(function Pagination2(props, ref) {
|
|
|
4492
4647
|
},
|
|
4493
4648
|
extra
|
|
4494
4649
|
);
|
|
4495
|
-
return link ? /* @__PURE__ */
|
|
4650
|
+
return link ? /* @__PURE__ */ React45.createElement(
|
|
4496
4651
|
"a",
|
|
4497
4652
|
{
|
|
4498
4653
|
href: link(p),
|
|
@@ -4505,7 +4660,7 @@ var Pagination = React25.forwardRef(function Pagination2(props, ref) {
|
|
|
4505
4660
|
...common
|
|
4506
4661
|
},
|
|
4507
4662
|
label
|
|
4508
|
-
) : /* @__PURE__ */
|
|
4663
|
+
) : /* @__PURE__ */ React45.createElement(
|
|
4509
4664
|
"button",
|
|
4510
4665
|
{
|
|
4511
4666
|
type: "button",
|
|
@@ -4517,7 +4672,7 @@ var Pagination = React25.forwardRef(function Pagination2(props, ref) {
|
|
|
4517
4672
|
label
|
|
4518
4673
|
);
|
|
4519
4674
|
}
|
|
4520
|
-
return /* @__PURE__ */
|
|
4675
|
+
return /* @__PURE__ */ React45.createElement("nav", { ref, className: cx("aura-pagination", props.className), "aria-label": props.label || t.pagination }, /* @__PURE__ */ React45.createElement(
|
|
4521
4676
|
IconButton,
|
|
4522
4677
|
{
|
|
4523
4678
|
icon: "chevron-left",
|
|
@@ -4527,9 +4682,9 @@ var Pagination = React25.forwardRef(function Pagination2(props, ref) {
|
|
|
4527
4682
|
go(page - 1);
|
|
4528
4683
|
}
|
|
4529
4684
|
}
|
|
4530
|
-
), /* @__PURE__ */
|
|
4531
|
-
return typeof p === "number" ? /* @__PURE__ */
|
|
4532
|
-
})), /* @__PURE__ */
|
|
4685
|
+
), /* @__PURE__ */ React45.createElement("ol", { className: "aura-pagination__list" }, pageList(page, count, props.siblingCount == null ? 1 : props.siblingCount).map(function(p) {
|
|
4686
|
+
return typeof p === "number" ? /* @__PURE__ */ React45.createElement("li", { key: p }, item(p, p)) : /* @__PURE__ */ React45.createElement("li", { key: p, className: "aura-pagination__gap", "aria-hidden": true }, "\u2026");
|
|
4687
|
+
})), /* @__PURE__ */ React45.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)), /* @__PURE__ */ React45.createElement(
|
|
4533
4688
|
IconButton,
|
|
4534
4689
|
{
|
|
4535
4690
|
icon: "chevron-right",
|
|
@@ -4541,7 +4696,10 @@ var Pagination = React25.forwardRef(function Pagination2(props, ref) {
|
|
|
4541
4696
|
}
|
|
4542
4697
|
));
|
|
4543
4698
|
});
|
|
4544
|
-
|
|
4699
|
+
|
|
4700
|
+
// src/Accordion.tsx
|
|
4701
|
+
var React46 = __toESM(require("react"), 1);
|
|
4702
|
+
var Accordion = React46.forwardRef(function Accordion2(props, ref) {
|
|
4545
4703
|
const auto = uid(), base = props.id || auto;
|
|
4546
4704
|
const multiple = props.type === "multiple";
|
|
4547
4705
|
const st = useMaybeControlled(
|
|
@@ -4579,9 +4737,9 @@ var Accordion = React25.forwardRef(function Accordion2(props, ref) {
|
|
|
4579
4737
|
n2.focus();
|
|
4580
4738
|
}
|
|
4581
4739
|
}
|
|
4582
|
-
return /* @__PURE__ */
|
|
4740
|
+
return /* @__PURE__ */ React46.createElement("div", { ref, className: cx("aura-accordion", props.className), onKeyDown: onKey }, items.map(function(it) {
|
|
4583
4741
|
const on = open.indexOf(it.id) >= 0, bid = base + "-btn-" + it.id, pid = base + "-panel-" + it.id;
|
|
4584
|
-
return /* @__PURE__ */
|
|
4742
|
+
return /* @__PURE__ */ React46.createElement("div", { key: it.id, className: cx("aura-accordion__item", on && "is-open") }, /* @__PURE__ */ React46.createElement(HT, { className: "aura-accordion__heading" }, /* @__PURE__ */ React46.createElement(
|
|
4585
4743
|
"button",
|
|
4586
4744
|
{
|
|
4587
4745
|
type: "button",
|
|
@@ -4593,12 +4751,16 @@ var Accordion = React25.forwardRef(function Accordion2(props, ref) {
|
|
|
4593
4751
|
toggle(it.id);
|
|
4594
4752
|
}
|
|
4595
4753
|
},
|
|
4596
|
-
it.icon ? /* @__PURE__ */
|
|
4597
|
-
/* @__PURE__ */
|
|
4598
|
-
/* @__PURE__ */
|
|
4599
|
-
)), /* @__PURE__ */
|
|
4754
|
+
it.icon ? /* @__PURE__ */ React46.createElement(Icon, { name: it.icon, className: "aura-accordion__lead" }) : null,
|
|
4755
|
+
/* @__PURE__ */ React46.createElement("span", { className: "aura-accordion__title" }, it.title, it.description ? /* @__PURE__ */ React46.createElement("span", { className: "aura-accordion__desc" }, it.description) : null),
|
|
4756
|
+
/* @__PURE__ */ React46.createElement(Icon, { name: "chevron-down", className: "aura-accordion__chevron" })
|
|
4757
|
+
)), /* @__PURE__ */ React46.createElement("div", { id: pid, role: "region", "aria-labelledby": bid, className: "aura-accordion__panel", hidden: !on }, it.content));
|
|
4600
4758
|
}));
|
|
4601
4759
|
});
|
|
4760
|
+
|
|
4761
|
+
// src/Popover.tsx
|
|
4762
|
+
var React47 = __toESM(require("react"), 1);
|
|
4763
|
+
var import_react_dom8 = require("react-dom");
|
|
4602
4764
|
function position(anchor, pop, placement) {
|
|
4603
4765
|
const r = anchor.getBoundingClientRect(), pw = pop.offsetWidth, ph = pop.offsetHeight, vw = window.innerWidth, vh = window.innerHeight, gap = 6;
|
|
4604
4766
|
let side = (placement || "bottom-start").split("-")[0], align = (placement || "bottom-start").split("-")[1] || "start";
|
|
@@ -4608,13 +4770,13 @@ function position(anchor, pop, placement) {
|
|
|
4608
4770
|
const left = align === "end" ? r.right - pw : align === "center" ? r.left + r.width / 2 - pw / 2 : r.left;
|
|
4609
4771
|
return { top: Math.max(8, top), left: Math.max(8, Math.min(left, vw - pw - 8)), side };
|
|
4610
4772
|
}
|
|
4611
|
-
var Popover =
|
|
4773
|
+
var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
4612
4774
|
const t = useStrings();
|
|
4613
4775
|
const auto = uid(), id = props.id || auto;
|
|
4614
4776
|
const st = useMaybeControlled(props.open, !!props.defaultOpen, props.onOpenChange);
|
|
4615
4777
|
const open = !!st[0];
|
|
4616
|
-
const wrap =
|
|
4617
|
-
const pos =
|
|
4778
|
+
const wrap = React47.useRef(null), pop = React47.useRef(null), popMerged = useMergedRef(ref, pop);
|
|
4779
|
+
const pos = React47.useState(null), mounted = useMounted();
|
|
4618
4780
|
function trigger() {
|
|
4619
4781
|
return wrap.current && (wrap.current.querySelector('button, [role="button"], a, input') || wrap.current.firstElementChild);
|
|
4620
4782
|
}
|
|
@@ -4641,7 +4803,7 @@ var Popover = React25.forwardRef(function Popover2(props, ref) {
|
|
|
4641
4803
|
},
|
|
4642
4804
|
[open, mounted, props.placement]
|
|
4643
4805
|
);
|
|
4644
|
-
|
|
4806
|
+
React47.useEffect(
|
|
4645
4807
|
function() {
|
|
4646
4808
|
if (!open || !mounted) return;
|
|
4647
4809
|
if (props.autoFocus !== false && pop.current) {
|
|
@@ -4660,9 +4822,9 @@ var Popover = React25.forwardRef(function Popover2(props, ref) {
|
|
|
4660
4822
|
},
|
|
4661
4823
|
[open, mounted]
|
|
4662
4824
|
);
|
|
4663
|
-
const child =
|
|
4664
|
-
const panel = open && mounted ? (0,
|
|
4665
|
-
/* @__PURE__ */
|
|
4825
|
+
const child = React47.Children.only(props.trigger);
|
|
4826
|
+
const panel = open && mounted ? (0, import_react_dom8.createPortal)(
|
|
4827
|
+
/* @__PURE__ */ React47.createElement(
|
|
4666
4828
|
"div",
|
|
4667
4829
|
{
|
|
4668
4830
|
ref: popMerged,
|
|
@@ -4684,7 +4846,7 @@ var Popover = React25.forwardRef(function Popover2(props, ref) {
|
|
|
4684
4846
|
} else trapTab(e, pop.current);
|
|
4685
4847
|
}
|
|
4686
4848
|
},
|
|
4687
|
-
props.title ? /* @__PURE__ */
|
|
4849
|
+
props.title ? /* @__PURE__ */ React47.createElement("div", { className: "aura-popover__head" }, /* @__PURE__ */ React47.createElement("p", { className: "aura-popover__title", id: id + "-title" }, props.title), /* @__PURE__ */ React47.createElement(
|
|
4688
4850
|
IconButton,
|
|
4689
4851
|
{
|
|
4690
4852
|
icon: "x",
|
|
@@ -4694,7 +4856,7 @@ var Popover = React25.forwardRef(function Popover2(props, ref) {
|
|
|
4694
4856
|
}
|
|
4695
4857
|
}
|
|
4696
4858
|
)) : null,
|
|
4697
|
-
/* @__PURE__ */
|
|
4859
|
+
/* @__PURE__ */ React47.createElement("div", { className: "aura-popover__body" }, typeof props.children === "function" ? props.children({
|
|
4698
4860
|
close: function() {
|
|
4699
4861
|
close(true);
|
|
4700
4862
|
}
|
|
@@ -4702,7 +4864,7 @@ var Popover = React25.forwardRef(function Popover2(props, ref) {
|
|
|
4702
4864
|
),
|
|
4703
4865
|
document.body
|
|
4704
4866
|
) : null;
|
|
4705
|
-
return /* @__PURE__ */
|
|
4867
|
+
return /* @__PURE__ */ React47.createElement("span", { ref: wrap, className: "aura-popover-anchor" }, React47.cloneElement(child, {
|
|
4706
4868
|
onClick: function(e) {
|
|
4707
4869
|
if (child.props.onClick) child.props.onClick(e);
|
|
4708
4870
|
st[1](!open);
|
|
@@ -4712,3 +4874,321 @@ var Popover = React25.forwardRef(function Popover2(props, ref) {
|
|
|
4712
4874
|
"aria-controls": open ? id : void 0
|
|
4713
4875
|
}), panel);
|
|
4714
4876
|
});
|
|
4877
|
+
|
|
4878
|
+
// src/NumberField.tsx
|
|
4879
|
+
var React48 = __toESM(require("react"), 1);
|
|
4880
|
+
function decimalsOf(n2) {
|
|
4881
|
+
const s = String(n2);
|
|
4882
|
+
const i = s.indexOf(".");
|
|
4883
|
+
return i < 0 ? 0 : s.length - i - 1;
|
|
4884
|
+
}
|
|
4885
|
+
function parse(text) {
|
|
4886
|
+
const s = text.replace(/[,\s ]/g, "");
|
|
4887
|
+
if (!/^-?(\d+\.?\d*|\.\d+)$/.test(s)) return NaN;
|
|
4888
|
+
return Number(s);
|
|
4889
|
+
}
|
|
4890
|
+
var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
4891
|
+
const t = useStrings();
|
|
4892
|
+
const auto = uid(), id = props.id || auto;
|
|
4893
|
+
const step = props.step || 1;
|
|
4894
|
+
const decimals = props.decimals != null ? props.decimals : decimalsOf(step);
|
|
4895
|
+
const st = useMaybeControlled(
|
|
4896
|
+
props.value,
|
|
4897
|
+
props.defaultValue == null ? null : props.defaultValue,
|
|
4898
|
+
props.onChange
|
|
4899
|
+
);
|
|
4900
|
+
const value = st[0], setValue = st[1];
|
|
4901
|
+
const draftState = React48.useState(null), draft = draftState[0], setDraft = draftState[1];
|
|
4902
|
+
function fmt2(n2) {
|
|
4903
|
+
if (n2 == null || isNaN(n2)) return "";
|
|
4904
|
+
return n2.toLocaleString("en", { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
|
|
4905
|
+
}
|
|
4906
|
+
function fit2(n2) {
|
|
4907
|
+
let v = n2;
|
|
4908
|
+
if (props.min != null && v < props.min) v = props.min;
|
|
4909
|
+
if (props.max != null && v > props.max) v = props.max;
|
|
4910
|
+
const f = Math.pow(10, decimals);
|
|
4911
|
+
return Math.round(v * f) / f;
|
|
4912
|
+
}
|
|
4913
|
+
function nudge(by) {
|
|
4914
|
+
if (props.disabled || props.readOnly) return;
|
|
4915
|
+
const base = value == null ? props.min != null && props.min > 0 ? props.min - by : 0 : value;
|
|
4916
|
+
const next = fit2(base + by);
|
|
4917
|
+
setValue(next);
|
|
4918
|
+
setDraft(null);
|
|
4919
|
+
}
|
|
4920
|
+
function onKeyDown(e) {
|
|
4921
|
+
const k = e.key;
|
|
4922
|
+
let by = 0;
|
|
4923
|
+
if (k === "ArrowUp") by = step;
|
|
4924
|
+
else if (k === "ArrowDown") by = -step;
|
|
4925
|
+
else if (k === "PageUp") by = step * 10;
|
|
4926
|
+
else if (k === "PageDown") by = -step * 10;
|
|
4927
|
+
else if (k === "Home" && props.min != null) {
|
|
4928
|
+
e.preventDefault();
|
|
4929
|
+
setValue(props.min);
|
|
4930
|
+
setDraft(null);
|
|
4931
|
+
return;
|
|
4932
|
+
} else if (k === "End" && props.max != null) {
|
|
4933
|
+
e.preventDefault();
|
|
4934
|
+
setValue(props.max);
|
|
4935
|
+
setDraft(null);
|
|
4936
|
+
return;
|
|
4937
|
+
}
|
|
4938
|
+
if (by) {
|
|
4939
|
+
e.preventDefault();
|
|
4940
|
+
nudge(by);
|
|
4941
|
+
}
|
|
4942
|
+
}
|
|
4943
|
+
const atMin = value != null && props.min != null && value <= props.min;
|
|
4944
|
+
const atMax = value != null && props.max != null && value >= props.max;
|
|
4945
|
+
const affixText = function(x) {
|
|
4946
|
+
return typeof x === "string" || typeof x === "number" ? String(x) : "";
|
|
4947
|
+
};
|
|
4948
|
+
const valueText = value == null ? void 0 : [affixText(props.prefix), fmt2(value), affixText(props.suffix)].join(" ").trim();
|
|
4949
|
+
const stepper = props.stepper !== false && !props.readOnly;
|
|
4950
|
+
return /* @__PURE__ */ React48.createElement(
|
|
4951
|
+
Field,
|
|
4952
|
+
{
|
|
4953
|
+
id,
|
|
4954
|
+
label: props.label,
|
|
4955
|
+
hint: props.hint,
|
|
4956
|
+
error: props.error,
|
|
4957
|
+
required: props.required,
|
|
4958
|
+
optional: props.optional,
|
|
4959
|
+
disabled: props.disabled,
|
|
4960
|
+
className: props.className
|
|
4961
|
+
},
|
|
4962
|
+
/* @__PURE__ */ React48.createElement("div", { className: cx("aura-input aura-number", stepper && "has-stepper") }, props.prefix != null ? /* @__PURE__ */ React48.createElement("span", { className: "aura-number__affix", "aria-hidden": true }, props.prefix) : null, /* @__PURE__ */ React48.createElement(
|
|
4963
|
+
"input",
|
|
4964
|
+
{
|
|
4965
|
+
ref,
|
|
4966
|
+
id,
|
|
4967
|
+
type: "text",
|
|
4968
|
+
role: "spinbutton",
|
|
4969
|
+
inputMode: decimals > 0 || props.min != null && props.min < 0 ? "decimal" : "numeric",
|
|
4970
|
+
autoComplete: "off",
|
|
4971
|
+
className: "aura-input__control",
|
|
4972
|
+
name: props.name,
|
|
4973
|
+
placeholder: props.placeholder,
|
|
4974
|
+
disabled: props.disabled,
|
|
4975
|
+
readOnly: props.readOnly,
|
|
4976
|
+
required: props.required,
|
|
4977
|
+
"aria-valuenow": value == null ? void 0 : value,
|
|
4978
|
+
"aria-valuemin": props.min,
|
|
4979
|
+
"aria-valuemax": props.max,
|
|
4980
|
+
"aria-valuetext": valueText,
|
|
4981
|
+
"aria-invalid": props.error ? true : void 0,
|
|
4982
|
+
"aria-describedby": describedBy(id, props),
|
|
4983
|
+
value: draft != null ? draft : fmt2(value),
|
|
4984
|
+
onFocus: function() {
|
|
4985
|
+
setDraft(fmt2(value));
|
|
4986
|
+
},
|
|
4987
|
+
onChange: function(e) {
|
|
4988
|
+
const text = e.target.value;
|
|
4989
|
+
setDraft(text);
|
|
4990
|
+
if (!text.trim()) setValue(null);
|
|
4991
|
+
else {
|
|
4992
|
+
const n2 = parse(text);
|
|
4993
|
+
if (!isNaN(n2)) setValue(n2);
|
|
4994
|
+
}
|
|
4995
|
+
},
|
|
4996
|
+
onBlur: function(e) {
|
|
4997
|
+
const n2 = draft == null ? value : !draft.trim() ? null : parse(draft);
|
|
4998
|
+
if (n2 == null) {
|
|
4999
|
+
if (value != null) setValue(null);
|
|
5000
|
+
} else if (!isNaN(n2)) {
|
|
5001
|
+
const f = fit2(n2);
|
|
5002
|
+
if (f !== value) setValue(f);
|
|
5003
|
+
}
|
|
5004
|
+
setDraft(null);
|
|
5005
|
+
if (props.onBlur) props.onBlur(e);
|
|
5006
|
+
},
|
|
5007
|
+
onKeyDown
|
|
5008
|
+
}
|
|
5009
|
+
), props.suffix != null ? /* @__PURE__ */ React48.createElement("span", { className: "aura-number__affix", "aria-hidden": true }, props.suffix) : null, stepper ? /* @__PURE__ */ React48.createElement("span", { className: "aura-number__steps" }, /* @__PURE__ */ React48.createElement(
|
|
5010
|
+
"button",
|
|
5011
|
+
{
|
|
5012
|
+
type: "button",
|
|
5013
|
+
tabIndex: -1,
|
|
5014
|
+
className: "aura-number__step",
|
|
5015
|
+
"aria-label": t.decrease,
|
|
5016
|
+
"aria-controls": id,
|
|
5017
|
+
disabled: props.disabled || atMin,
|
|
5018
|
+
onPointerDown: function(e) {
|
|
5019
|
+
e.preventDefault();
|
|
5020
|
+
},
|
|
5021
|
+
onClick: function() {
|
|
5022
|
+
nudge(-step);
|
|
5023
|
+
}
|
|
5024
|
+
},
|
|
5025
|
+
/* @__PURE__ */ React48.createElement(Icon, { name: "minus" })
|
|
5026
|
+
), /* @__PURE__ */ React48.createElement(
|
|
5027
|
+
"button",
|
|
5028
|
+
{
|
|
5029
|
+
type: "button",
|
|
5030
|
+
tabIndex: -1,
|
|
5031
|
+
className: "aura-number__step",
|
|
5032
|
+
"aria-label": t.increase,
|
|
5033
|
+
"aria-controls": id,
|
|
5034
|
+
disabled: props.disabled || atMax,
|
|
5035
|
+
onPointerDown: function(e) {
|
|
5036
|
+
e.preventDefault();
|
|
5037
|
+
},
|
|
5038
|
+
onClick: function() {
|
|
5039
|
+
nudge(step);
|
|
5040
|
+
}
|
|
5041
|
+
},
|
|
5042
|
+
/* @__PURE__ */ React48.createElement(Icon, { name: "plus" })
|
|
5043
|
+
)) : null)
|
|
5044
|
+
);
|
|
5045
|
+
});
|
|
5046
|
+
|
|
5047
|
+
// src/Stepper.tsx
|
|
5048
|
+
var React49 = __toESM(require("react"), 1);
|
|
5049
|
+
var Stepper = React49.forwardRef(function Stepper2(props, ref) {
|
|
5050
|
+
const t = useStrings();
|
|
5051
|
+
const steps = props.steps || [];
|
|
5052
|
+
let at = -1;
|
|
5053
|
+
steps.forEach(function(s, i) {
|
|
5054
|
+
if (s.id === props.current) at = i;
|
|
5055
|
+
});
|
|
5056
|
+
if (at < 0) at = 0;
|
|
5057
|
+
const vertical = props.orientation === "vertical";
|
|
5058
|
+
const cur = steps[at];
|
|
5059
|
+
return /* @__PURE__ */ React49.createElement(
|
|
5060
|
+
"nav",
|
|
5061
|
+
{
|
|
5062
|
+
ref,
|
|
5063
|
+
"aria-label": props.label,
|
|
5064
|
+
className: cx("aura-stepper", vertical ? "aura-stepper--vertical" : "aura-stepper--horizontal", props.className)
|
|
5065
|
+
},
|
|
5066
|
+
/* @__PURE__ */ React49.createElement("ol", { className: "aura-stepper__list" }, steps.map(function(s, i) {
|
|
5067
|
+
const state = i < at ? "done" : i === at ? "current" : "upcoming";
|
|
5068
|
+
const marker = /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__marker", "aria-hidden": true }, state === "done" ? /* @__PURE__ */ React49.createElement(Icon, { name: "check" }) : i + 1);
|
|
5069
|
+
const text = /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__text" }, /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__label" }, s.label, state === "done" ? /* @__PURE__ */ React49.createElement("span", { className: "aura-sr-only" }, ", " + t.stepDone) : null), s.description ? /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__desc" }, s.description) : null);
|
|
5070
|
+
const clickable = state === "done" && !!props.onStepClick;
|
|
5071
|
+
return /* @__PURE__ */ React49.createElement(
|
|
5072
|
+
"li",
|
|
5073
|
+
{
|
|
5074
|
+
key: s.id,
|
|
5075
|
+
className: cx("aura-stepper__item", "is-" + state),
|
|
5076
|
+
"aria-current": state === "current" ? "step" : void 0
|
|
5077
|
+
},
|
|
5078
|
+
clickable ? /* @__PURE__ */ React49.createElement(
|
|
5079
|
+
"button",
|
|
5080
|
+
{
|
|
5081
|
+
type: "button",
|
|
5082
|
+
className: "aura-stepper__step aura-focusable",
|
|
5083
|
+
onClick: function() {
|
|
5084
|
+
props.onStepClick(s.id);
|
|
5085
|
+
}
|
|
5086
|
+
},
|
|
5087
|
+
marker,
|
|
5088
|
+
text
|
|
5089
|
+
) : /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__step" }, marker, text)
|
|
5090
|
+
);
|
|
5091
|
+
})),
|
|
5092
|
+
!vertical && cur ? /* @__PURE__ */ React49.createElement("p", { className: "aura-stepper__compact", "aria-hidden": true }, /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__count" }, t.stepOf(at + 1, steps.length)), /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__compact-label" }, cur.label)) : null
|
|
5093
|
+
);
|
|
5094
|
+
});
|
|
5095
|
+
|
|
5096
|
+
// src/SegmentedControl.tsx
|
|
5097
|
+
var React50 = __toESM(require("react"), 1);
|
|
5098
|
+
function toOpt2(o) {
|
|
5099
|
+
return typeof o === "object" ? o : { value: o, label: o };
|
|
5100
|
+
}
|
|
5101
|
+
var SegmentedControl = React50.forwardRef(
|
|
5102
|
+
function SegmentedControl2(props, ref) {
|
|
5103
|
+
const options = (props.options || []).map(toOpt2);
|
|
5104
|
+
const firstEnabled = options.filter(function(o) {
|
|
5105
|
+
return !o.disabled;
|
|
5106
|
+
})[0];
|
|
5107
|
+
const st = useMaybeControlled(
|
|
5108
|
+
props.value,
|
|
5109
|
+
props.defaultValue != null ? props.defaultValue : firstEnabled ? firstEnabled.value : void 0,
|
|
5110
|
+
props.onChange
|
|
5111
|
+
);
|
|
5112
|
+
const value = st[0], setValue = st[1];
|
|
5113
|
+
const auto = uid(), id = props.id || auto;
|
|
5114
|
+
const refs = React50.useRef([]);
|
|
5115
|
+
const selIdx = options.findIndex(function(o) {
|
|
5116
|
+
return o.value === value;
|
|
5117
|
+
});
|
|
5118
|
+
const tabIdx = selIdx >= 0 && !options[selIdx].disabled ? selIdx : options.indexOf(firstEnabled);
|
|
5119
|
+
function move(from, dir) {
|
|
5120
|
+
const n2 = options.length;
|
|
5121
|
+
for (let k = 1; k <= n2; k++) {
|
|
5122
|
+
const i = ((from + dir * k) % n2 + n2) % n2;
|
|
5123
|
+
if (!options[i].disabled) {
|
|
5124
|
+
setValue(options[i].value);
|
|
5125
|
+
const el = refs.current[i];
|
|
5126
|
+
if (el) el.focus();
|
|
5127
|
+
return;
|
|
5128
|
+
}
|
|
5129
|
+
}
|
|
5130
|
+
}
|
|
5131
|
+
function onKeyDown(e, i) {
|
|
5132
|
+
const k = e.key;
|
|
5133
|
+
if (k === "ArrowRight" || k === "ArrowDown") {
|
|
5134
|
+
e.preventDefault();
|
|
5135
|
+
move(i, 1);
|
|
5136
|
+
} else if (k === "ArrowLeft" || k === "ArrowUp") {
|
|
5137
|
+
e.preventDefault();
|
|
5138
|
+
move(i, -1);
|
|
5139
|
+
} else if (k === "Home") {
|
|
5140
|
+
e.preventDefault();
|
|
5141
|
+
move(-1, 1);
|
|
5142
|
+
} else if (k === "End") {
|
|
5143
|
+
e.preventDefault();
|
|
5144
|
+
move(options.length, -1);
|
|
5145
|
+
}
|
|
5146
|
+
}
|
|
5147
|
+
return /* @__PURE__ */ React50.createElement(
|
|
5148
|
+
"div",
|
|
5149
|
+
{
|
|
5150
|
+
ref,
|
|
5151
|
+
id,
|
|
5152
|
+
role: "radiogroup",
|
|
5153
|
+
"aria-label": props.label,
|
|
5154
|
+
"aria-disabled": props.disabled || void 0,
|
|
5155
|
+
className: cx(
|
|
5156
|
+
"aura-segmented",
|
|
5157
|
+
props.size === "sm" && "aura-segmented--sm",
|
|
5158
|
+
props.fullWidth && "is-full",
|
|
5159
|
+
props.disabled && "is-disabled",
|
|
5160
|
+
props.className
|
|
5161
|
+
)
|
|
5162
|
+
},
|
|
5163
|
+
options.map(function(o, i) {
|
|
5164
|
+
const on = o.value === value;
|
|
5165
|
+
const off = props.disabled || o.disabled;
|
|
5166
|
+
return /* @__PURE__ */ React50.createElement(
|
|
5167
|
+
"button",
|
|
5168
|
+
{
|
|
5169
|
+
key: o.value,
|
|
5170
|
+
ref: function(el) {
|
|
5171
|
+
refs.current[i] = el;
|
|
5172
|
+
},
|
|
5173
|
+
type: "button",
|
|
5174
|
+
role: "radio",
|
|
5175
|
+
"aria-checked": on,
|
|
5176
|
+
"aria-label": o.iconOnly ? o.label : void 0,
|
|
5177
|
+
title: o.iconOnly ? o.label : void 0,
|
|
5178
|
+
tabIndex: i === tabIdx && !props.disabled ? 0 : -1,
|
|
5179
|
+
disabled: off,
|
|
5180
|
+
className: cx("aura-segmented__option", on && "is-selected", o.iconOnly && "is-icon"),
|
|
5181
|
+
onClick: function() {
|
|
5182
|
+
setValue(o.value);
|
|
5183
|
+
},
|
|
5184
|
+
onKeyDown: function(e) {
|
|
5185
|
+
onKeyDown(e, i);
|
|
5186
|
+
}
|
|
5187
|
+
},
|
|
5188
|
+
o.icon ? /* @__PURE__ */ React50.createElement(Icon, { name: o.icon }) : null,
|
|
5189
|
+
o.iconOnly ? null : /* @__PURE__ */ React50.createElement("span", null, o.label)
|
|
5190
|
+
);
|
|
5191
|
+
})
|
|
5192
|
+
);
|
|
5193
|
+
}
|
|
5194
|
+
);
|