@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/aura.bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @ds-bundle: {"format":4,"namespace":"Aura","components":[{"name":"Icon"},{"name":"Button"},{"name":"IconButton"},{"name":"Menu"},{"name":"DropdownMenu"},{"name":"Checkbox"},{"name":"StatusPill"},{"name":"TextField"},{"name":"Textarea"},{"name":"Select"},{"name":"RadioGroup"},{"name":"Switch"},{"name":"Combobox"},{"name":"DatePicker"},{"name":"DateRangePicker"},{"name":"Calendar"},{"name":"Alert"},{"name":"Toaster"},{"name":"Tooltip"},{"name":"Dialog"},{"name":"Drawer"},{"name":"DataTable"},{"name":"Card"},{"name":"Tabs"},{"name":"SideNav"},{"name":"Breadcrumb"},{"name":"Avatar"},{"name":"Stack"},{"name":"Grid"},{"name":"Container"},{"name":"AppShell"},{"name":"Surface"},{"name":"Stat"},{"name":"TimePicker"},{"name":"FileUpload"},{"name":"ColorSchemeScript"},{"name":"ColorSchemeToggle"},{"name":"Badge"},{"name":"Tag"},{"name":"Progress"},{"name":"Skeleton"},{"name":"EmptyState"},{"name":"Pagination"},{"name":"Accordion"},{"name":"Popover"}]} */
|
|
1
|
+
/* @ds-bundle: {"format":4,"namespace":"Aura","components":[{"name":"Icon"},{"name":"Button"},{"name":"IconButton"},{"name":"Menu"},{"name":"DropdownMenu"},{"name":"Checkbox"},{"name":"StatusPill"},{"name":"TextField"},{"name":"Textarea"},{"name":"Select"},{"name":"RadioGroup"},{"name":"Switch"},{"name":"Combobox"},{"name":"DatePicker"},{"name":"DateRangePicker"},{"name":"Calendar"},{"name":"Alert"},{"name":"Toaster"},{"name":"Tooltip"},{"name":"Dialog"},{"name":"Drawer"},{"name":"DataTable"},{"name":"Card"},{"name":"Tabs"},{"name":"SideNav"},{"name":"Breadcrumb"},{"name":"Avatar"},{"name":"Stack"},{"name":"Grid"},{"name":"Container"},{"name":"AppShell"},{"name":"Surface"},{"name":"Stat"},{"name":"TimePicker"},{"name":"FileUpload"},{"name":"ColorSchemeScript"},{"name":"ColorSchemeToggle"},{"name":"Badge"},{"name":"Tag"},{"name":"Progress"},{"name":"Skeleton"},{"name":"EmptyState"},{"name":"Pagination"},{"name":"Accordion"},{"name":"Popover"},{"name":"NumberField"},{"name":"Stepper"},{"name":"SegmentedControl"}]} */
|
|
2
2
|
window.Aura = (() => {
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -79,17 +79,20 @@ window.Aura = (() => {
|
|
|
79
79
|
Icon: () => Icon,
|
|
80
80
|
IconButton: () => IconButton,
|
|
81
81
|
Menu: () => Menu,
|
|
82
|
+
NumberField: () => NumberField,
|
|
82
83
|
Pagination: () => Pagination,
|
|
83
84
|
Popover: () => Popover,
|
|
84
85
|
Progress: () => Progress,
|
|
85
86
|
RadioGroup: () => RadioGroup,
|
|
86
87
|
STRINGS: () => STRINGS,
|
|
88
|
+
SegmentedControl: () => SegmentedControl,
|
|
87
89
|
Select: () => Select,
|
|
88
90
|
SideNav: () => SideNav,
|
|
89
91
|
Skeleton: () => Skeleton,
|
|
90
92
|
Stack: () => Stack,
|
|
91
93
|
Stat: () => Stat,
|
|
92
94
|
StatusPill: () => StatusPill,
|
|
95
|
+
Stepper: () => Stepper,
|
|
93
96
|
Surface: () => Surface,
|
|
94
97
|
Switch: () => Switch,
|
|
95
98
|
Tabs: () => Tabs,
|
|
@@ -203,6 +206,10 @@ window.Aura = (() => {
|
|
|
203
206
|
[a, b]
|
|
204
207
|
);
|
|
205
208
|
}
|
|
209
|
+
var TONES = ["neutral", "accent", "success", "warning", "danger"];
|
|
210
|
+
function tone(t) {
|
|
211
|
+
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
212
|
+
}
|
|
206
213
|
|
|
207
214
|
// src/Icon.tsx
|
|
208
215
|
var h = React2.createElement;
|
|
@@ -532,7 +539,7 @@ window.Aura = (() => {
|
|
|
532
539
|
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);
|
|
533
540
|
});
|
|
534
541
|
|
|
535
|
-
// src/
|
|
542
|
+
// src/Field.tsx
|
|
536
543
|
var React10 = __toESM(require_react(), 1);
|
|
537
544
|
|
|
538
545
|
// src/locale.tsx
|
|
@@ -620,6 +627,12 @@ window.Aura = (() => {
|
|
|
620
627
|
return "Up to " + n2 + " files";
|
|
621
628
|
},
|
|
622
629
|
colorScheme: "Colour scheme",
|
|
630
|
+
increase: "Increase",
|
|
631
|
+
decrease: "Decrease",
|
|
632
|
+
stepDone: "completed",
|
|
633
|
+
stepOf: function(i, total) {
|
|
634
|
+
return "Step " + i + " of " + total;
|
|
635
|
+
},
|
|
623
636
|
schemeLight: "Light",
|
|
624
637
|
schemeDark: "Dark",
|
|
625
638
|
schemeSystem: "System",
|
|
@@ -712,6 +725,12 @@ window.Aura = (() => {
|
|
|
712
725
|
return "\u0E41\u0E19\u0E1A\u0E44\u0E14\u0E49\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 " + n2 + " \u0E44\u0E1F\u0E25\u0E4C";
|
|
713
726
|
},
|
|
714
727
|
colorScheme: "\u0E42\u0E2B\u0E21\u0E14\u0E2A\u0E35",
|
|
728
|
+
increase: "\u0E40\u0E1E\u0E34\u0E48\u0E21",
|
|
729
|
+
decrease: "\u0E25\u0E14",
|
|
730
|
+
stepDone: "\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E41\u0E25\u0E49\u0E27",
|
|
731
|
+
stepOf: function(i, total) {
|
|
732
|
+
return "\u0E02\u0E31\u0E49\u0E19\u0E17\u0E35\u0E48 " + i + " \u0E08\u0E32\u0E01 " + total;
|
|
733
|
+
},
|
|
715
734
|
schemeLight: "\u0E2A\u0E27\u0E48\u0E32\u0E07",
|
|
716
735
|
schemeDark: "\u0E21\u0E37\u0E14",
|
|
717
736
|
schemeSystem: "\u0E15\u0E32\u0E21\u0E23\u0E30\u0E1A\u0E1A",
|
|
@@ -748,7 +767,7 @@ window.Aura = (() => {
|
|
|
748
767
|
return useAuraLocale().strings;
|
|
749
768
|
}
|
|
750
769
|
|
|
751
|
-
// src/
|
|
770
|
+
// src/Field.tsx
|
|
752
771
|
var h2 = React10.createElement;
|
|
753
772
|
var Field = React10.forwardRef(function Field2(props, ref) {
|
|
754
773
|
const t = useStrings();
|
|
@@ -785,10 +804,13 @@ window.Aura = (() => {
|
|
|
785
804
|
"options",
|
|
786
805
|
"placeholder"
|
|
787
806
|
];
|
|
788
|
-
|
|
807
|
+
|
|
808
|
+
// src/TextField.tsx
|
|
809
|
+
var React11 = __toESM(require_react(), 1);
|
|
810
|
+
var TextField = React11.forwardRef(function TextField2(props, ref) {
|
|
789
811
|
const auto = uid(), id = props.id || auto;
|
|
790
812
|
const rest = omit(props, FIELD_KEYS);
|
|
791
|
-
return /* @__PURE__ */
|
|
813
|
+
return /* @__PURE__ */ React11.createElement(
|
|
792
814
|
Field,
|
|
793
815
|
{
|
|
794
816
|
id,
|
|
@@ -800,7 +822,7 @@ window.Aura = (() => {
|
|
|
800
822
|
disabled: props.disabled,
|
|
801
823
|
className: props.className
|
|
802
824
|
},
|
|
803
|
-
/* @__PURE__ */
|
|
825
|
+
/* @__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(
|
|
804
826
|
"input",
|
|
805
827
|
{
|
|
806
828
|
type: "text",
|
|
@@ -813,13 +835,16 @@ window.Aura = (() => {
|
|
|
813
835
|
"aria-invalid": props.error ? true : void 0,
|
|
814
836
|
"aria-describedby": describedBy(id, props)
|
|
815
837
|
}
|
|
816
|
-
), props.suffix ? /* @__PURE__ */
|
|
838
|
+
), props.suffix ? /* @__PURE__ */ React11.createElement("span", { className: "aura-input__suffix" }, props.suffix) : null)
|
|
817
839
|
);
|
|
818
840
|
});
|
|
819
|
-
|
|
841
|
+
|
|
842
|
+
// src/Textarea.tsx
|
|
843
|
+
var React12 = __toESM(require_react(), 1);
|
|
844
|
+
var Textarea = React12.forwardRef(function Textarea2(props, ref) {
|
|
820
845
|
const auto = uid(), id = props.id || auto;
|
|
821
846
|
const rest = omit(props, FIELD_KEYS);
|
|
822
|
-
return /* @__PURE__ */
|
|
847
|
+
return /* @__PURE__ */ React12.createElement(
|
|
823
848
|
Field,
|
|
824
849
|
{
|
|
825
850
|
id,
|
|
@@ -831,7 +856,7 @@ window.Aura = (() => {
|
|
|
831
856
|
disabled: props.disabled,
|
|
832
857
|
className: props.className
|
|
833
858
|
},
|
|
834
|
-
/* @__PURE__ */
|
|
859
|
+
/* @__PURE__ */ React12.createElement(
|
|
835
860
|
"textarea",
|
|
836
861
|
{
|
|
837
862
|
rows: 4,
|
|
@@ -847,19 +872,23 @@ window.Aura = (() => {
|
|
|
847
872
|
)
|
|
848
873
|
);
|
|
849
874
|
});
|
|
850
|
-
|
|
875
|
+
|
|
876
|
+
// src/Select.tsx
|
|
877
|
+
var React13 = __toESM(require_react(), 1);
|
|
878
|
+
var h3 = React13.createElement;
|
|
879
|
+
var Select = React13.forwardRef(function Select2(props, ref) {
|
|
851
880
|
const auto = uid(), id = props.id || auto;
|
|
852
881
|
const rest = omit(props, FIELD_KEYS.concat(["children"]));
|
|
853
882
|
const opts = (props.options || []).map(function(o) {
|
|
854
883
|
const v = typeof o === "object" ? o : { value: o, label: o };
|
|
855
|
-
return /* @__PURE__ */
|
|
884
|
+
return /* @__PURE__ */ React13.createElement("option", { key: v.value, value: v.value, disabled: v.disabled }, v.label);
|
|
856
885
|
});
|
|
857
886
|
if (props.placeholder)
|
|
858
887
|
opts.unshift(
|
|
859
|
-
/* @__PURE__ */
|
|
888
|
+
/* @__PURE__ */ React13.createElement("option", { key: "__ph", value: "", disabled: true }, props.placeholder)
|
|
860
889
|
);
|
|
861
890
|
const extra = props.value === void 0 && props.defaultValue === void 0 && props.placeholder ? { defaultValue: "" } : {};
|
|
862
|
-
return /* @__PURE__ */
|
|
891
|
+
return /* @__PURE__ */ React13.createElement(
|
|
863
892
|
Field,
|
|
864
893
|
{
|
|
865
894
|
id,
|
|
@@ -871,7 +900,7 @@ window.Aura = (() => {
|
|
|
871
900
|
disabled: props.disabled,
|
|
872
901
|
className: props.className
|
|
873
902
|
},
|
|
874
|
-
/* @__PURE__ */
|
|
903
|
+
/* @__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(
|
|
875
904
|
"select",
|
|
876
905
|
Object.assign(extra, rest, {
|
|
877
906
|
ref,
|
|
@@ -883,10 +912,13 @@ window.Aura = (() => {
|
|
|
883
912
|
}),
|
|
884
913
|
opts,
|
|
885
914
|
props.children
|
|
886
|
-
), /* @__PURE__ */
|
|
915
|
+
), /* @__PURE__ */ React13.createElement(Icon, { name: "chevron-down", className: "aura-select__chevron" }))
|
|
887
916
|
);
|
|
888
917
|
});
|
|
889
|
-
|
|
918
|
+
|
|
919
|
+
// src/RadioGroup.tsx
|
|
920
|
+
var React14 = __toESM(require_react(), 1);
|
|
921
|
+
var RadioGroup = React14.forwardRef(function RadioGroup2(props, ref) {
|
|
890
922
|
const auto = uid(), id = props.id || auto;
|
|
891
923
|
const st = useMaybeControlled(
|
|
892
924
|
props.value,
|
|
@@ -894,7 +926,7 @@ window.Aura = (() => {
|
|
|
894
926
|
props.onChange
|
|
895
927
|
);
|
|
896
928
|
const name = props.name || id;
|
|
897
|
-
return /* @__PURE__ */
|
|
929
|
+
return /* @__PURE__ */ React14.createElement(
|
|
898
930
|
"fieldset",
|
|
899
931
|
{
|
|
900
932
|
ref,
|
|
@@ -903,10 +935,10 @@ window.Aura = (() => {
|
|
|
903
935
|
"aria-invalid": props.error ? true : void 0,
|
|
904
936
|
disabled: props.disabled
|
|
905
937
|
},
|
|
906
|
-
props.label ? /* @__PURE__ */
|
|
907
|
-
/* @__PURE__ */
|
|
938
|
+
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,
|
|
939
|
+
/* @__PURE__ */ React14.createElement("div", { className: cx("aura-radio-group__list", props.orientation === "horizontal" && "is-horizontal") }, (props.options || []).map(function(o) {
|
|
908
940
|
const v = typeof o === "object" ? o : { value: o, label: o };
|
|
909
|
-
return /* @__PURE__ */
|
|
941
|
+
return /* @__PURE__ */ React14.createElement("label", { key: v.value, className: cx("aura-choice", v.disabled && "is-disabled") }, /* @__PURE__ */ React14.createElement(
|
|
910
942
|
"input",
|
|
911
943
|
{
|
|
912
944
|
type: "radio",
|
|
@@ -919,16 +951,19 @@ window.Aura = (() => {
|
|
|
919
951
|
st[1](v.value);
|
|
920
952
|
}
|
|
921
953
|
}
|
|
922
|
-
), /* @__PURE__ */
|
|
954
|
+
), /* @__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));
|
|
923
955
|
})),
|
|
924
|
-
props.error ? /* @__PURE__ */
|
|
956
|
+
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
|
|
925
957
|
);
|
|
926
958
|
});
|
|
927
|
-
|
|
959
|
+
|
|
960
|
+
// src/Switch.tsx
|
|
961
|
+
var React15 = __toESM(require_react(), 1);
|
|
962
|
+
var Switch = React15.forwardRef(function Switch2(props, ref) {
|
|
928
963
|
const auto = uid(), id = props.id || auto;
|
|
929
964
|
const st = useMaybeControlled(props.checked, !!props.defaultChecked, props.onChange);
|
|
930
965
|
const on = !!st[0];
|
|
931
|
-
return /* @__PURE__ */
|
|
966
|
+
return /* @__PURE__ */ React15.createElement("div", { className: cx("aura-switch-row", props.disabled && "is-disabled", props.className) }, /* @__PURE__ */ React15.createElement(
|
|
932
967
|
"button",
|
|
933
968
|
{
|
|
934
969
|
ref,
|
|
@@ -945,12 +980,12 @@ window.Aura = (() => {
|
|
|
945
980
|
st[1](!on);
|
|
946
981
|
}
|
|
947
982
|
},
|
|
948
|
-
/* @__PURE__ */
|
|
949
|
-
), props.label ? /* @__PURE__ */
|
|
983
|
+
/* @__PURE__ */ React15.createElement("span", { className: "aura-switch__thumb" })
|
|
984
|
+
), 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);
|
|
950
985
|
});
|
|
951
986
|
|
|
952
987
|
// src/Combobox.tsx
|
|
953
|
-
var
|
|
988
|
+
var React16 = __toESM(require_react(), 1);
|
|
954
989
|
var import_react_dom2 = __toESM(require_react_dom(), 1);
|
|
955
990
|
function norm(s) {
|
|
956
991
|
return String(s == null ? "" : s).normalize("NFC").toLocaleLowerCase("th");
|
|
@@ -965,260 +1000,335 @@ window.Aura = (() => {
|
|
|
965
1000
|
return norm(k).indexOf(q) >= 0;
|
|
966
1001
|
});
|
|
967
1002
|
}
|
|
968
|
-
var Combobox =
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
props.
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
const
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1003
|
+
var Combobox = React16.forwardRef(
|
|
1004
|
+
function Combobox2(all, ref) {
|
|
1005
|
+
const props = all;
|
|
1006
|
+
const multi = all.multiple === true;
|
|
1007
|
+
const mp = all;
|
|
1008
|
+
const t = useStrings();
|
|
1009
|
+
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
1010
|
+
const options = (props.options || []).map(toOpt);
|
|
1011
|
+
const st = useMaybeControlled(
|
|
1012
|
+
multi ? mp.value : props.value === void 0 ? void 0 : props.value == null ? [] : [props.value],
|
|
1013
|
+
multi ? mp.defaultValue || [] : props.defaultValue == null ? [] : [props.defaultValue],
|
|
1014
|
+
function(next) {
|
|
1015
|
+
if (multi) {
|
|
1016
|
+
if (mp.onChange) mp.onChange(next);
|
|
1017
|
+
} else if (props.onChange) props.onChange(next.length ? next[0] : null);
|
|
1018
|
+
}
|
|
1019
|
+
);
|
|
1020
|
+
const values = st[0], setValues = st[1];
|
|
1021
|
+
const value = values.length ? values[0] : null;
|
|
1022
|
+
function setValue(v) {
|
|
1023
|
+
setValues(v == null ? [] : [v]);
|
|
1024
|
+
}
|
|
1025
|
+
const isPicked = function(v) {
|
|
1026
|
+
return values.indexOf(v) >= 0;
|
|
1027
|
+
};
|
|
1028
|
+
const full = multi && mp.max != null && values.length >= mp.max;
|
|
1029
|
+
const selected = multi ? null : options.filter(function(o) {
|
|
1030
|
+
return o.value === value;
|
|
1031
|
+
})[0] || null;
|
|
1032
|
+
const picked = multi ? values.map(function(v) {
|
|
1033
|
+
return options.filter(function(o) {
|
|
1034
|
+
return o.value === v;
|
|
1035
|
+
})[0];
|
|
1036
|
+
}).filter(Boolean) : [];
|
|
1037
|
+
const openState = React16.useState(false), open = openState[0], setOpen = openState[1];
|
|
1038
|
+
const qState = React16.useState(null), query = qState[0], setQuery = qState[1];
|
|
1039
|
+
const aState = React16.useState(0), active = aState[0], setActive = aState[1];
|
|
1040
|
+
const posState = React16.useState(null);
|
|
1041
|
+
const inputRef = React16.useRef(null), inputMerged = useMergedRef(ref, inputRef), boxRef = React16.useRef(null), listRef = React16.useRef(null);
|
|
1042
|
+
const mounted = useMounted();
|
|
1043
|
+
const limit = props.limit || 200;
|
|
1044
|
+
const filter = props.filter || defaultFilter;
|
|
1045
|
+
let shown = props.onSearch || query == null ? options : options.filter(function(o) {
|
|
1046
|
+
return filter(o, query);
|
|
1005
1047
|
});
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1048
|
+
const more = shown.length > limit;
|
|
1049
|
+
shown = shown.slice(0, limit);
|
|
1050
|
+
const activeIdx = Math.min(active, shown.length - 1);
|
|
1051
|
+
function place() {
|
|
1052
|
+
if (!boxRef.current) return;
|
|
1053
|
+
const r = boxRef.current.getBoundingClientRect();
|
|
1054
|
+
const maxH = 320, below = window.innerHeight - r.bottom - 8, up = below < 200 && r.top > below;
|
|
1055
|
+
posState[1]({
|
|
1056
|
+
left: r.left,
|
|
1057
|
+
width: r.width,
|
|
1058
|
+
top: up ? void 0 : r.bottom + 4,
|
|
1059
|
+
bottom: up ? window.innerHeight - r.top + 4 : void 0,
|
|
1060
|
+
maxHeight: Math.min(maxH, (up ? r.top : below) - 8)
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
useIsoLayoutEffect(
|
|
1064
|
+
function() {
|
|
1065
|
+
if (open) place();
|
|
1066
|
+
},
|
|
1067
|
+
[open, shown.length]
|
|
1068
|
+
);
|
|
1069
|
+
React16.useEffect(
|
|
1070
|
+
function() {
|
|
1071
|
+
if (!open) return;
|
|
1072
|
+
function outside(e) {
|
|
1073
|
+
if (boxRef.current && boxRef.current.contains(e.target)) return;
|
|
1074
|
+
if (listRef.current && listRef.current.contains(e.target)) return;
|
|
1075
|
+
close(false);
|
|
1076
|
+
}
|
|
1077
|
+
function onScroll(e) {
|
|
1078
|
+
if (!listRef.current || !listRef.current.contains(e.target)) place();
|
|
1079
|
+
}
|
|
1080
|
+
document.addEventListener("pointerdown", outside, true);
|
|
1081
|
+
window.addEventListener("scroll", onScroll, true);
|
|
1082
|
+
window.addEventListener("resize", place);
|
|
1083
|
+
return function() {
|
|
1084
|
+
document.removeEventListener("pointerdown", outside, true);
|
|
1085
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
1086
|
+
window.removeEventListener("resize", place);
|
|
1087
|
+
};
|
|
1088
|
+
},
|
|
1089
|
+
[open]
|
|
1090
|
+
);
|
|
1091
|
+
React16.useEffect(
|
|
1092
|
+
function() {
|
|
1093
|
+
if (!open || !listRef.current) return;
|
|
1094
|
+
const el = listRef.current.querySelector('[data-idx="' + activeIdx + '"]');
|
|
1095
|
+
if (el && el.scrollIntoView) el.scrollIntoView({ block: "nearest" });
|
|
1096
|
+
},
|
|
1097
|
+
[activeIdx, open]
|
|
1098
|
+
);
|
|
1099
|
+
function openList() {
|
|
1100
|
+
if (!open && !props.disabled && !props.readOnly) {
|
|
1101
|
+
setOpen(true);
|
|
1102
|
+
const i = selected ? shown.indexOf(selected) : 0;
|
|
1103
|
+
setActive(i < 0 ? 0 : i);
|
|
1020
1104
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1105
|
+
}
|
|
1106
|
+
function close(restoreLabel) {
|
|
1107
|
+
setOpen(false);
|
|
1108
|
+
setQuery(null);
|
|
1109
|
+
}
|
|
1110
|
+
function choose(o) {
|
|
1111
|
+
if (!o || o.disabled) return;
|
|
1112
|
+
if (multi) {
|
|
1113
|
+
if (isPicked(o.value))
|
|
1114
|
+
setValues(
|
|
1115
|
+
values.filter(function(v) {
|
|
1116
|
+
return v !== o.value;
|
|
1117
|
+
})
|
|
1118
|
+
);
|
|
1119
|
+
else if (!full) setValues(values.concat([o.value]));
|
|
1120
|
+
setQuery(null);
|
|
1121
|
+
if (inputRef.current) inputRef.current.focus();
|
|
1122
|
+
return;
|
|
1023
1123
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
document.removeEventListener("pointerdown", outside, true);
|
|
1029
|
-
window.removeEventListener("scroll", onScroll, true);
|
|
1030
|
-
window.removeEventListener("resize", place);
|
|
1031
|
-
};
|
|
1032
|
-
},
|
|
1033
|
-
[open]
|
|
1034
|
-
);
|
|
1035
|
-
React11.useEffect(
|
|
1036
|
-
function() {
|
|
1037
|
-
if (!open || !listRef.current) return;
|
|
1038
|
-
const el = listRef.current.querySelector('[data-idx="' + activeIdx + '"]');
|
|
1039
|
-
if (el && el.scrollIntoView) el.scrollIntoView({ block: "nearest" });
|
|
1040
|
-
},
|
|
1041
|
-
[activeIdx, open]
|
|
1042
|
-
);
|
|
1043
|
-
function openList() {
|
|
1044
|
-
if (!open && !props.disabled && !props.readOnly) {
|
|
1045
|
-
setOpen(true);
|
|
1046
|
-
const i = selected ? shown.indexOf(selected) : 0;
|
|
1047
|
-
setActive(i < 0 ? 0 : i);
|
|
1124
|
+
setValue(o.value);
|
|
1125
|
+
setQuery(null);
|
|
1126
|
+
setOpen(false);
|
|
1127
|
+
if (inputRef.current) inputRef.current.focus();
|
|
1048
1128
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
setQuery(null);
|
|
1053
|
-
}
|
|
1054
|
-
function choose(o) {
|
|
1055
|
-
if (!o || o.disabled) return;
|
|
1056
|
-
setValue(o.value);
|
|
1057
|
-
setQuery(null);
|
|
1058
|
-
setOpen(false);
|
|
1059
|
-
if (inputRef.current) inputRef.current.focus();
|
|
1060
|
-
}
|
|
1061
|
-
function onKeyDown(e) {
|
|
1062
|
-
const k = e.key;
|
|
1063
|
-
if (k === "ArrowDown") {
|
|
1064
|
-
e.preventDefault();
|
|
1065
|
-
if (!open) openList();
|
|
1066
|
-
else setActive(Math.min(activeIdx + 1, shown.length - 1));
|
|
1067
|
-
} else if (k === "ArrowUp") {
|
|
1068
|
-
e.preventDefault();
|
|
1069
|
-
if (!open) openList();
|
|
1070
|
-
else setActive(Math.max(activeIdx - 1, 0));
|
|
1071
|
-
} else if (k === "Home" && open) {
|
|
1072
|
-
e.preventDefault();
|
|
1073
|
-
setActive(0);
|
|
1074
|
-
} else if (k === "End" && open) {
|
|
1075
|
-
e.preventDefault();
|
|
1076
|
-
setActive(shown.length - 1);
|
|
1077
|
-
} else if (k === "Enter") {
|
|
1078
|
-
if (open && shown[activeIdx]) {
|
|
1129
|
+
function onKeyDown(e) {
|
|
1130
|
+
const k = e.key;
|
|
1131
|
+
if (k === "ArrowDown") {
|
|
1079
1132
|
e.preventDefault();
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
if (open) {
|
|
1133
|
+
if (!open) openList();
|
|
1134
|
+
else setActive(Math.min(activeIdx + 1, shown.length - 1));
|
|
1135
|
+
} else if (k === "ArrowUp") {
|
|
1084
1136
|
e.preventDefault();
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
} else if (
|
|
1088
|
-
|
|
1137
|
+
if (!open) openList();
|
|
1138
|
+
else setActive(Math.max(activeIdx - 1, 0));
|
|
1139
|
+
} else if (k === "Home" && open) {
|
|
1140
|
+
e.preventDefault();
|
|
1141
|
+
setActive(0);
|
|
1142
|
+
} else if (k === "End" && open) {
|
|
1143
|
+
e.preventDefault();
|
|
1144
|
+
setActive(shown.length - 1);
|
|
1145
|
+
} else if (k === "Enter") {
|
|
1146
|
+
if (open && shown[activeIdx]) {
|
|
1147
|
+
e.preventDefault();
|
|
1148
|
+
choose(shown[activeIdx]);
|
|
1149
|
+
}
|
|
1150
|
+
} else if (k === "Escape") {
|
|
1151
|
+
if (open) {
|
|
1152
|
+
e.preventDefault();
|
|
1153
|
+
e.stopPropagation();
|
|
1154
|
+
close();
|
|
1155
|
+
} else if (!multi && props.clearable !== false && value != null && query == null) {
|
|
1156
|
+
setValue(null);
|
|
1157
|
+
}
|
|
1158
|
+
} else if (k === "Backspace" && multi && !text && values.length) {
|
|
1159
|
+
setValues(values.slice(0, -1));
|
|
1160
|
+
} else if (k === "Tab") {
|
|
1161
|
+
if (open) close();
|
|
1089
1162
|
}
|
|
1090
|
-
} else if (k === "Tab") {
|
|
1091
|
-
if (open) close();
|
|
1092
1163
|
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
return /* @__PURE__ */ React11.createElement(
|
|
1102
|
-
"li",
|
|
1164
|
+
const text = query != null ? query : selected ? selected.label : "";
|
|
1165
|
+
const summaryId = id + "-picked";
|
|
1166
|
+
const optId = function(i) {
|
|
1167
|
+
return id + "-opt-" + i;
|
|
1168
|
+
};
|
|
1169
|
+
const list = open && mounted && posState[0] ? (0, import_react_dom2.createPortal)(
|
|
1170
|
+
/* @__PURE__ */ React16.createElement("div", { ref: listRef, className: "aura-combo__popover", style: posState[0] }, /* @__PURE__ */ React16.createElement(
|
|
1171
|
+
"ul",
|
|
1103
1172
|
{
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
"
|
|
1108
|
-
"
|
|
1109
|
-
"aria-disabled": o.disabled || void 0,
|
|
1110
|
-
className: cx(
|
|
1111
|
-
"aura-combo__option",
|
|
1112
|
-
i === activeIdx && "is-active",
|
|
1113
|
-
isSel && "is-selected",
|
|
1114
|
-
o.disabled && "is-disabled"
|
|
1115
|
-
),
|
|
1116
|
-
onPointerDown: function(e) {
|
|
1117
|
-
e.preventDefault();
|
|
1118
|
-
},
|
|
1119
|
-
onClick: function() {
|
|
1120
|
-
choose(o);
|
|
1121
|
-
},
|
|
1122
|
-
onPointerMove: function() {
|
|
1123
|
-
if (activeIdx !== i) setActive(i);
|
|
1124
|
-
}
|
|
1173
|
+
id: listId,
|
|
1174
|
+
role: "listbox",
|
|
1175
|
+
"aria-label": props.label,
|
|
1176
|
+
"aria-multiselectable": multi || void 0,
|
|
1177
|
+
className: "aura-combo__list"
|
|
1125
1178
|
},
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1179
|
+
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) {
|
|
1180
|
+
const isSel = multi ? isPicked(o.value) : !!selected && o.value === selected.value;
|
|
1181
|
+
const blocked = o.disabled || multi && full && !isSel;
|
|
1182
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1183
|
+
"li",
|
|
1184
|
+
{
|
|
1185
|
+
key: o.value,
|
|
1186
|
+
id: optId(i),
|
|
1187
|
+
role: "option",
|
|
1188
|
+
"data-idx": i,
|
|
1189
|
+
"aria-selected": isSel,
|
|
1190
|
+
"aria-disabled": blocked || void 0,
|
|
1191
|
+
className: cx(
|
|
1192
|
+
"aura-combo__option",
|
|
1193
|
+
i === activeIdx && "is-active",
|
|
1194
|
+
isSel && "is-selected",
|
|
1195
|
+
blocked && "is-disabled"
|
|
1196
|
+
),
|
|
1197
|
+
onPointerDown: function(e) {
|
|
1198
|
+
e.preventDefault();
|
|
1199
|
+
},
|
|
1200
|
+
onClick: function() {
|
|
1201
|
+
if (!blocked || isSel) choose(o);
|
|
1202
|
+
},
|
|
1203
|
+
onPointerMove: function() {
|
|
1204
|
+
if (activeIdx !== i) setActive(i);
|
|
1205
|
+
}
|
|
1206
|
+
},
|
|
1207
|
+
o.icon ? /* @__PURE__ */ React16.createElement(Icon, { name: o.icon }) : null,
|
|
1208
|
+
/* @__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),
|
|
1209
|
+
isSel ? /* @__PURE__ */ React16.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
1210
|
+
);
|
|
1211
|
+
}),
|
|
1212
|
+
more && !props.loading ? /* @__PURE__ */ React16.createElement("li", { className: "aura-combo__note", role: "presentation" }, t.keepTyping((props.options || []).length)) : null
|
|
1213
|
+
)),
|
|
1214
|
+
document.body
|
|
1215
|
+
) : null;
|
|
1216
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1217
|
+
Field,
|
|
1147
1218
|
{
|
|
1148
|
-
ref: inputMerged,
|
|
1149
1219
|
id,
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
autoComplete: "off",
|
|
1154
|
-
"aria-expanded": open,
|
|
1155
|
-
"aria-controls": listId,
|
|
1156
|
-
"aria-autocomplete": "list",
|
|
1157
|
-
"aria-activedescendant": open && shown[activeIdx] ? optId(activeIdx) : void 0,
|
|
1158
|
-
"aria-invalid": props.error ? true : void 0,
|
|
1159
|
-
"aria-describedby": props.error ? id + "-error" : props.hint ? id + "-hint" : void 0,
|
|
1160
|
-
placeholder: props.placeholder,
|
|
1161
|
-
disabled: props.disabled,
|
|
1162
|
-
readOnly: props.readOnly,
|
|
1220
|
+
label: props.label,
|
|
1221
|
+
hint: props.hint,
|
|
1222
|
+
error: props.error,
|
|
1163
1223
|
required: props.required,
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
setQuery(e.target.value);
|
|
1168
|
-
setActive(0);
|
|
1169
|
-
if (!open) setOpen(true);
|
|
1170
|
-
if (props.onSearch) props.onSearch(e.target.value);
|
|
1171
|
-
},
|
|
1172
|
-
onClick: openList,
|
|
1173
|
-
onKeyDown,
|
|
1174
|
-
onBlur: function() {
|
|
1175
|
-
setTimeout(function() {
|
|
1176
|
-
if (listRef.current && listRef.current.contains(document.activeElement)) return;
|
|
1177
|
-
setOpen(false);
|
|
1178
|
-
setQuery(null);
|
|
1179
|
-
}, 0);
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */ React11.createElement(
|
|
1183
|
-
"button",
|
|
1184
|
-
{
|
|
1185
|
-
type: "button",
|
|
1186
|
-
className: "aura-combo__clear",
|
|
1187
|
-
"aria-label": t.clear(props.label),
|
|
1188
|
-
tabIndex: -1,
|
|
1189
|
-
onClick: function() {
|
|
1190
|
-
setValue(null);
|
|
1191
|
-
setQuery(null);
|
|
1192
|
-
if (inputRef.current) inputRef.current.focus();
|
|
1193
|
-
}
|
|
1224
|
+
optional: props.optional,
|
|
1225
|
+
disabled: props.disabled,
|
|
1226
|
+
className: props.className
|
|
1194
1227
|
},
|
|
1195
|
-
/* @__PURE__ */
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1228
|
+
/* @__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) {
|
|
1229
|
+
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(
|
|
1230
|
+
"button",
|
|
1231
|
+
{
|
|
1232
|
+
type: "button",
|
|
1233
|
+
tabIndex: -1,
|
|
1234
|
+
className: "aura-combo__chip-remove",
|
|
1235
|
+
"aria-label": t.remove(o.label),
|
|
1236
|
+
onPointerDown: function(e) {
|
|
1237
|
+
e.preventDefault();
|
|
1238
|
+
},
|
|
1239
|
+
onClick: function() {
|
|
1240
|
+
setValues(
|
|
1241
|
+
values.filter(function(v) {
|
|
1242
|
+
return v !== o.value;
|
|
1243
|
+
})
|
|
1244
|
+
);
|
|
1245
|
+
if (inputRef.current) inputRef.current.focus();
|
|
1246
|
+
}
|
|
1247
|
+
},
|
|
1248
|
+
/* @__PURE__ */ React16.createElement(Icon, { name: "x" })
|
|
1249
|
+
));
|
|
1250
|
+
})) : null, multi ? /* @__PURE__ */ React16.createElement("span", { id: summaryId, className: "aura-sr-only" }, picked.length ? t.selectedCount(picked.length) + ": " + picked.map(function(o) {
|
|
1251
|
+
return o.label;
|
|
1252
|
+
}).join(", ") : "") : null, multi && props.name ? values.map(function(v) {
|
|
1253
|
+
return /* @__PURE__ */ React16.createElement("input", { key: v, type: "hidden", name: props.name, value: v });
|
|
1254
|
+
}) : null, /* @__PURE__ */ React16.createElement(
|
|
1255
|
+
"input",
|
|
1256
|
+
{
|
|
1257
|
+
ref: inputMerged,
|
|
1258
|
+
id,
|
|
1259
|
+
type: "text",
|
|
1260
|
+
role: "combobox",
|
|
1261
|
+
className: "aura-input__control",
|
|
1262
|
+
autoComplete: "off",
|
|
1263
|
+
"aria-expanded": open,
|
|
1264
|
+
"aria-controls": listId,
|
|
1265
|
+
"aria-autocomplete": "list",
|
|
1266
|
+
"aria-activedescendant": open && shown[activeIdx] ? optId(activeIdx) : void 0,
|
|
1267
|
+
"aria-invalid": props.error ? true : void 0,
|
|
1268
|
+
"aria-describedby": [props.error ? id + "-error" : props.hint ? id + "-hint" : "", multi && picked.length ? summaryId : ""].filter(Boolean).join(" ") || void 0,
|
|
1269
|
+
placeholder: multi && values.length ? void 0 : props.placeholder,
|
|
1270
|
+
disabled: props.disabled,
|
|
1271
|
+
readOnly: props.readOnly,
|
|
1272
|
+
required: props.required && (!multi || !values.length),
|
|
1273
|
+
name: multi ? void 0 : props.name,
|
|
1274
|
+
value: text,
|
|
1275
|
+
onChange: function(e) {
|
|
1276
|
+
setQuery(e.target.value);
|
|
1277
|
+
setActive(0);
|
|
1278
|
+
if (!open) setOpen(true);
|
|
1279
|
+
if (props.onSearch) props.onSearch(e.target.value);
|
|
1280
|
+
},
|
|
1281
|
+
onClick: openList,
|
|
1282
|
+
onKeyDown,
|
|
1283
|
+
onBlur: function() {
|
|
1284
|
+
setTimeout(function() {
|
|
1285
|
+
if (listRef.current && listRef.current.contains(document.activeElement)) return;
|
|
1286
|
+
setOpen(false);
|
|
1287
|
+
setQuery(null);
|
|
1288
|
+
}, 0);
|
|
1211
1289
|
}
|
|
1212
1290
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1291
|
+
), props.clearable !== false && values.length && !props.disabled ? /* @__PURE__ */ React16.createElement(
|
|
1292
|
+
"button",
|
|
1293
|
+
{
|
|
1294
|
+
type: "button",
|
|
1295
|
+
className: "aura-combo__clear",
|
|
1296
|
+
"aria-label": t.clear(props.label),
|
|
1297
|
+
tabIndex: -1,
|
|
1298
|
+
onClick: function() {
|
|
1299
|
+
setValues([]);
|
|
1300
|
+
setQuery(null);
|
|
1301
|
+
if (inputRef.current) inputRef.current.focus();
|
|
1302
|
+
}
|
|
1303
|
+
},
|
|
1304
|
+
/* @__PURE__ */ React16.createElement(Icon, { name: "x" })
|
|
1305
|
+
) : null, /* @__PURE__ */ React16.createElement(
|
|
1306
|
+
"button",
|
|
1307
|
+
{
|
|
1308
|
+
type: "button",
|
|
1309
|
+
tabIndex: -1,
|
|
1310
|
+
"aria-hidden": true,
|
|
1311
|
+
className: "aura-combo__toggle",
|
|
1312
|
+
onPointerDown: function(e) {
|
|
1313
|
+
e.preventDefault();
|
|
1314
|
+
},
|
|
1315
|
+
onClick: function() {
|
|
1316
|
+
if (open) close();
|
|
1317
|
+
else {
|
|
1318
|
+
openList();
|
|
1319
|
+
inputRef.current && inputRef.current.focus();
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
},
|
|
1323
|
+
/* @__PURE__ */ React16.createElement(Icon, { name: "chevron-down" })
|
|
1324
|
+
)),
|
|
1325
|
+
list
|
|
1326
|
+
);
|
|
1327
|
+
}
|
|
1328
|
+
);
|
|
1219
1329
|
|
|
1220
1330
|
// src/DatePicker.tsx
|
|
1221
|
-
var
|
|
1331
|
+
var React17 = __toESM(require_react(), 1);
|
|
1222
1332
|
var import_react_dom3 = __toESM(require_react_dom(), 1);
|
|
1223
1333
|
var ERA = /^พ\.ศ\.\s?|\s?(BE|พ\.ศ\.)$/g;
|
|
1224
1334
|
var pad = function(n2) {
|
|
@@ -1300,29 +1410,29 @@ window.Aura = (() => {
|
|
|
1300
1410
|
const dt = new Date(y, mo - 1, d);
|
|
1301
1411
|
return dt.getMonth() === mo - 1 && dt.getDate() === d ? toISO(dt) : null;
|
|
1302
1412
|
}
|
|
1303
|
-
var Calendar =
|
|
1413
|
+
var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
1304
1414
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", tag = localeTag(locale, calendar);
|
|
1305
1415
|
const weekStart = props.weekStartsOn == null ? 0 : props.weekStartsOn;
|
|
1306
1416
|
let today = /* @__PURE__ */ new Date();
|
|
1307
1417
|
today = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
1308
1418
|
const min = fromISO(props.min), max = fromISO(props.max);
|
|
1309
1419
|
const start = fromISO(props.start), end = fromISO(props.end);
|
|
1310
|
-
const focusState =
|
|
1420
|
+
const focusState = React17.useState(fromISO(props.focus) || start || today);
|
|
1311
1421
|
const focusDate = focusState[0], setFocus = focusState[1];
|
|
1312
|
-
const viewState =
|
|
1313
|
-
const hoverState =
|
|
1314
|
-
const gridRef =
|
|
1422
|
+
const viewState = React17.useState("days"), view = viewState[0], setView = viewState[1];
|
|
1423
|
+
const hoverState = React17.useState(null);
|
|
1424
|
+
const gridRef = React17.useRef(null), gridMerged = useMergedRef(ref, gridRef), moved = React17.useRef(false);
|
|
1315
1425
|
const th = locale !== "en";
|
|
1316
1426
|
function disabled(d) {
|
|
1317
1427
|
return !!(min && d < min || max && d > max || props.isDateDisabled && props.isDateDisabled(toISO(d)));
|
|
1318
1428
|
}
|
|
1319
|
-
|
|
1429
|
+
React17.useEffect(function() {
|
|
1320
1430
|
if (!moved.current) return;
|
|
1321
1431
|
moved.current = false;
|
|
1322
1432
|
const el = gridRef.current && gridRef.current.querySelector('[data-date="' + toISO(focusDate) + '"]');
|
|
1323
1433
|
if (el) el.focus();
|
|
1324
1434
|
});
|
|
1325
|
-
|
|
1435
|
+
React17.useEffect(function() {
|
|
1326
1436
|
if (props.autoFocus === false) return;
|
|
1327
1437
|
const el = gridRef.current && gridRef.current.querySelector('[tabindex="0"]');
|
|
1328
1438
|
if (el) el.focus();
|
|
@@ -1374,7 +1484,7 @@ window.Aura = (() => {
|
|
|
1374
1484
|
const yr = focusDate.getFullYear(), base = yr - yr % 12;
|
|
1375
1485
|
const years = [];
|
|
1376
1486
|
for (let y = base; y < base + 12; y++) years.push(y);
|
|
1377
|
-
return /* @__PURE__ */
|
|
1487
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1378
1488
|
IconButton,
|
|
1379
1489
|
{
|
|
1380
1490
|
icon: "chevron-left",
|
|
@@ -1383,7 +1493,7 @@ window.Aura = (() => {
|
|
|
1383
1493
|
setFocus(new Date(yr - 12, focusDate.getMonth(), 1));
|
|
1384
1494
|
}
|
|
1385
1495
|
}
|
|
1386
|
-
), /* @__PURE__ */
|
|
1496
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1387
1497
|
"button",
|
|
1388
1498
|
{
|
|
1389
1499
|
type: "button",
|
|
@@ -1393,7 +1503,7 @@ window.Aura = (() => {
|
|
|
1393
1503
|
}
|
|
1394
1504
|
},
|
|
1395
1505
|
fmt(tag, { year: "numeric" }, new Date(base, 0, 1)).replace(ERA, "") + " \u2013 " + fmt(tag, { year: "numeric" }, new Date(base + 11, 0, 1)).replace(ERA, "")
|
|
1396
|
-
), /* @__PURE__ */
|
|
1506
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1397
1507
|
IconButton,
|
|
1398
1508
|
{
|
|
1399
1509
|
icon: "chevron-right",
|
|
@@ -1402,9 +1512,9 @@ window.Aura = (() => {
|
|
|
1402
1512
|
setFocus(new Date(yr + 12, focusDate.getMonth(), 1));
|
|
1403
1513
|
}
|
|
1404
1514
|
}
|
|
1405
|
-
)), /* @__PURE__ */
|
|
1515
|
+
)), /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__years" }, years.map(function(y) {
|
|
1406
1516
|
const d = new Date(y, focusDate.getMonth(), 1);
|
|
1407
|
-
return /* @__PURE__ */
|
|
1517
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1408
1518
|
"button",
|
|
1409
1519
|
{
|
|
1410
1520
|
key: y,
|
|
@@ -1421,7 +1531,7 @@ window.Aura = (() => {
|
|
|
1421
1531
|
);
|
|
1422
1532
|
})));
|
|
1423
1533
|
}
|
|
1424
|
-
return /* @__PURE__ */
|
|
1534
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1425
1535
|
IconButton,
|
|
1426
1536
|
{
|
|
1427
1537
|
icon: "chevron-left",
|
|
@@ -1430,7 +1540,7 @@ window.Aura = (() => {
|
|
|
1430
1540
|
setFocus(addMonths(focusDate, -1));
|
|
1431
1541
|
}
|
|
1432
1542
|
}
|
|
1433
|
-
), /* @__PURE__ */
|
|
1543
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1434
1544
|
"button",
|
|
1435
1545
|
{
|
|
1436
1546
|
type: "button",
|
|
@@ -1441,8 +1551,8 @@ window.Aura = (() => {
|
|
|
1441
1551
|
}
|
|
1442
1552
|
},
|
|
1443
1553
|
monthTitle,
|
|
1444
|
-
/* @__PURE__ */
|
|
1445
|
-
), /* @__PURE__ */
|
|
1554
|
+
/* @__PURE__ */ React17.createElement(Icon, { name: "chevron-down", size: 14 })
|
|
1555
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1446
1556
|
IconButton,
|
|
1447
1557
|
{
|
|
1448
1558
|
icon: "chevron-right",
|
|
@@ -1451,9 +1561,9 @@ window.Aura = (() => {
|
|
|
1451
1561
|
setFocus(addMonths(focusDate, 1));
|
|
1452
1562
|
}
|
|
1453
1563
|
}
|
|
1454
|
-
)), /* @__PURE__ */
|
|
1455
|
-
return /* @__PURE__ */
|
|
1456
|
-
}))), /* @__PURE__ */
|
|
1564
|
+
)), /* @__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) {
|
|
1565
|
+
return /* @__PURE__ */ React17.createElement("th", { key: i, scope: "col", abbr: n2.long }, /* @__PURE__ */ React17.createElement("span", { "aria-hidden": true }, n2.short));
|
|
1566
|
+
}))), /* @__PURE__ */ React17.createElement(
|
|
1457
1567
|
"tbody",
|
|
1458
1568
|
{
|
|
1459
1569
|
onMouseLeave: function() {
|
|
@@ -1461,11 +1571,11 @@ window.Aura = (() => {
|
|
|
1461
1571
|
}
|
|
1462
1572
|
},
|
|
1463
1573
|
weeks.map(function(wk, wi) {
|
|
1464
|
-
return /* @__PURE__ */
|
|
1574
|
+
return /* @__PURE__ */ React17.createElement("tr", { key: wi }, wk.map(function(d) {
|
|
1465
1575
|
const iso = toISO(d), out = d.getMonth() !== focusDate.getMonth(), dis = disabled(d);
|
|
1466
1576
|
const isStart = same(d, start), isEnd = same(d, end) || !end && props.range && same(d, hover) && start;
|
|
1467
1577
|
const sel = isStart || same(d, end);
|
|
1468
|
-
return /* @__PURE__ */
|
|
1578
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1469
1579
|
"td",
|
|
1470
1580
|
{
|
|
1471
1581
|
key: iso,
|
|
@@ -1477,7 +1587,7 @@ window.Aura = (() => {
|
|
|
1477
1587
|
props.range && isEnd && start && "is-range-end"
|
|
1478
1588
|
)
|
|
1479
1589
|
},
|
|
1480
|
-
/* @__PURE__ */
|
|
1590
|
+
/* @__PURE__ */ React17.createElement(
|
|
1481
1591
|
"button",
|
|
1482
1592
|
{
|
|
1483
1593
|
type: "button",
|
|
@@ -1509,7 +1619,7 @@ window.Aura = (() => {
|
|
|
1509
1619
|
);
|
|
1510
1620
|
}));
|
|
1511
1621
|
})
|
|
1512
|
-
)), props.footer === false ? null : /* @__PURE__ */
|
|
1622
|
+
)), props.footer === false ? null : /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__foot" }, /* @__PURE__ */ React17.createElement(
|
|
1513
1623
|
"button",
|
|
1514
1624
|
{
|
|
1515
1625
|
type: "button",
|
|
@@ -1521,11 +1631,11 @@ window.Aura = (() => {
|
|
|
1521
1631
|
}
|
|
1522
1632
|
},
|
|
1523
1633
|
th ? "\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49" : "Today"
|
|
1524
|
-
), props.onClear ? /* @__PURE__ */
|
|
1634
|
+
), props.onClear ? /* @__PURE__ */ React17.createElement("button", { type: "button", className: "aura-cal__link", onClick: props.onClear }, th ? "\u0E25\u0E49\u0E32\u0E07" : "Clear") : null));
|
|
1525
1635
|
});
|
|
1526
1636
|
function useCalendarPopover(boxRef) {
|
|
1527
|
-
const openState =
|
|
1528
|
-
const pos =
|
|
1637
|
+
const openState = React17.useState(false), open = openState[0], setOpen = openState[1];
|
|
1638
|
+
const pos = React17.useState(null), popRef = React17.useRef(null), mounted = useMounted();
|
|
1529
1639
|
function place() {
|
|
1530
1640
|
if (!boxRef.current) return;
|
|
1531
1641
|
const r = boxRef.current.getBoundingClientRect(), H = 380;
|
|
@@ -1539,7 +1649,7 @@ window.Aura = (() => {
|
|
|
1539
1649
|
},
|
|
1540
1650
|
[open]
|
|
1541
1651
|
);
|
|
1542
|
-
|
|
1652
|
+
React17.useEffect(
|
|
1543
1653
|
function() {
|
|
1544
1654
|
if (!open) return;
|
|
1545
1655
|
function outside(e) {
|
|
@@ -1561,8 +1671,8 @@ window.Aura = (() => {
|
|
|
1561
1671
|
return { open, setOpen, pos: pos[0], popRef, mounted };
|
|
1562
1672
|
}
|
|
1563
1673
|
function DateField(props) {
|
|
1564
|
-
const editState =
|
|
1565
|
-
return /* @__PURE__ */
|
|
1674
|
+
const editState = React17.useState(null), editing = editState[0], setEditing = editState[1];
|
|
1675
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1566
1676
|
Field,
|
|
1567
1677
|
{
|
|
1568
1678
|
id: props.id,
|
|
@@ -1574,7 +1684,7 @@ window.Aura = (() => {
|
|
|
1574
1684
|
disabled: props.disabled,
|
|
1575
1685
|
className: props.className
|
|
1576
1686
|
},
|
|
1577
|
-
/* @__PURE__ */
|
|
1687
|
+
/* @__PURE__ */ React17.createElement("div", { ref: props.boxRef, className: cx("aura-input aura-date", props.open && "is-open") }, /* @__PURE__ */ React17.createElement(
|
|
1578
1688
|
"input",
|
|
1579
1689
|
{
|
|
1580
1690
|
ref: props.inputRef,
|
|
@@ -1613,7 +1723,7 @@ window.Aura = (() => {
|
|
|
1613
1723
|
}
|
|
1614
1724
|
}
|
|
1615
1725
|
}
|
|
1616
|
-
), props.clearable !== false && props.hasValue && !props.disabled ? /* @__PURE__ */
|
|
1726
|
+
), props.clearable !== false && props.hasValue && !props.disabled ? /* @__PURE__ */ React17.createElement(
|
|
1617
1727
|
"button",
|
|
1618
1728
|
{
|
|
1619
1729
|
type: "button",
|
|
@@ -1622,8 +1732,8 @@ window.Aura = (() => {
|
|
|
1622
1732
|
"aria-label": props.clearLabel,
|
|
1623
1733
|
onClick: props.onClear
|
|
1624
1734
|
},
|
|
1625
|
-
/* @__PURE__ */
|
|
1626
|
-
) : null, /* @__PURE__ */
|
|
1735
|
+
/* @__PURE__ */ React17.createElement(Icon, { name: "x" })
|
|
1736
|
+
) : null, /* @__PURE__ */ React17.createElement(
|
|
1627
1737
|
"button",
|
|
1628
1738
|
{
|
|
1629
1739
|
type: "button",
|
|
@@ -1637,11 +1747,11 @@ window.Aura = (() => {
|
|
|
1637
1747
|
props.onToggle(!props.open);
|
|
1638
1748
|
}
|
|
1639
1749
|
},
|
|
1640
|
-
/* @__PURE__ */
|
|
1750
|
+
/* @__PURE__ */ React17.createElement(Icon, { name: "calendar" })
|
|
1641
1751
|
))
|
|
1642
1752
|
);
|
|
1643
1753
|
}
|
|
1644
|
-
var DatePicker =
|
|
1754
|
+
var DatePicker = React17.forwardRef(function DatePicker2(props, ref) {
|
|
1645
1755
|
const auto = uid(), id = props.id || auto, dialogId = id + "-cal";
|
|
1646
1756
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", th = locale !== "en";
|
|
1647
1757
|
const st = useMaybeControlled(
|
|
@@ -1649,7 +1759,7 @@ window.Aura = (() => {
|
|
|
1649
1759
|
props.defaultValue == null ? null : props.defaultValue,
|
|
1650
1760
|
props.onChange
|
|
1651
1761
|
);
|
|
1652
|
-
const boxRef =
|
|
1762
|
+
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
1653
1763
|
const pop = useCalendarPopover(boxRef);
|
|
1654
1764
|
function commit(text) {
|
|
1655
1765
|
if (!text.trim()) {
|
|
@@ -1664,7 +1774,7 @@ window.Aura = (() => {
|
|
|
1664
1774
|
if (inputRef.current) inputRef.current.focus();
|
|
1665
1775
|
}
|
|
1666
1776
|
const cal = pop.open && pop.mounted && pop.pos ? (0, import_react_dom3.createPortal)(
|
|
1667
|
-
/* @__PURE__ */
|
|
1777
|
+
/* @__PURE__ */ React17.createElement(
|
|
1668
1778
|
"div",
|
|
1669
1779
|
{
|
|
1670
1780
|
ref: pop.popRef,
|
|
@@ -1681,7 +1791,7 @@ window.Aura = (() => {
|
|
|
1681
1791
|
} else trapTab(e, pop.popRef.current);
|
|
1682
1792
|
}
|
|
1683
1793
|
},
|
|
1684
|
-
/* @__PURE__ */
|
|
1794
|
+
/* @__PURE__ */ React17.createElement(
|
|
1685
1795
|
Calendar,
|
|
1686
1796
|
{
|
|
1687
1797
|
locale,
|
|
@@ -1701,7 +1811,7 @@ window.Aura = (() => {
|
|
|
1701
1811
|
),
|
|
1702
1812
|
document.body
|
|
1703
1813
|
) : null;
|
|
1704
|
-
return /* @__PURE__ */
|
|
1814
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1705
1815
|
DateField,
|
|
1706
1816
|
{
|
|
1707
1817
|
id,
|
|
@@ -1735,7 +1845,7 @@ window.Aura = (() => {
|
|
|
1735
1845
|
}
|
|
1736
1846
|
), cal);
|
|
1737
1847
|
});
|
|
1738
|
-
var DateRangePicker =
|
|
1848
|
+
var DateRangePicker = React17.forwardRef(
|
|
1739
1849
|
function DateRangePicker2(props, ref) {
|
|
1740
1850
|
const auto = uid(), id = props.id || auto, dialogId = id + "-cal";
|
|
1741
1851
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", th = locale !== "en";
|
|
@@ -1745,8 +1855,8 @@ window.Aura = (() => {
|
|
|
1745
1855
|
props.onChange
|
|
1746
1856
|
);
|
|
1747
1857
|
const v = st[0] || { start: null, end: null };
|
|
1748
|
-
const draft =
|
|
1749
|
-
const boxRef =
|
|
1858
|
+
const draft = React17.useState(null);
|
|
1859
|
+
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
1750
1860
|
const pop = useCalendarPopover(boxRef);
|
|
1751
1861
|
const o = { locale, calendar };
|
|
1752
1862
|
function show(r) {
|
|
@@ -1778,7 +1888,7 @@ window.Aura = (() => {
|
|
|
1778
1888
|
close();
|
|
1779
1889
|
}
|
|
1780
1890
|
const cal = pop.open && pop.mounted && pop.pos ? (0, import_react_dom3.createPortal)(
|
|
1781
|
-
/* @__PURE__ */
|
|
1891
|
+
/* @__PURE__ */ React17.createElement(
|
|
1782
1892
|
"div",
|
|
1783
1893
|
{
|
|
1784
1894
|
ref: pop.popRef,
|
|
@@ -1795,8 +1905,8 @@ window.Aura = (() => {
|
|
|
1795
1905
|
} else trapTab(e, pop.popRef.current);
|
|
1796
1906
|
}
|
|
1797
1907
|
},
|
|
1798
|
-
/* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */
|
|
1908
|
+
/* @__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"),
|
|
1909
|
+
/* @__PURE__ */ React17.createElement(
|
|
1800
1910
|
Calendar,
|
|
1801
1911
|
{
|
|
1802
1912
|
range: true,
|
|
@@ -1815,7 +1925,7 @@ window.Aura = (() => {
|
|
|
1815
1925
|
),
|
|
1816
1926
|
document.body
|
|
1817
1927
|
) : null;
|
|
1818
|
-
return /* @__PURE__ */
|
|
1928
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1819
1929
|
DateField,
|
|
1820
1930
|
{
|
|
1821
1931
|
id,
|
|
@@ -1852,30 +1962,33 @@ window.Aura = (() => {
|
|
|
1852
1962
|
}
|
|
1853
1963
|
);
|
|
1854
1964
|
|
|
1855
|
-
// src/
|
|
1856
|
-
var
|
|
1857
|
-
var import_react_dom4 = __toESM(require_react_dom(), 1);
|
|
1965
|
+
// src/Alert.tsx
|
|
1966
|
+
var React18 = __toESM(require_react(), 1);
|
|
1858
1967
|
var ALERT_ICON = {
|
|
1859
1968
|
info: "info",
|
|
1860
1969
|
success: "circle-check",
|
|
1861
1970
|
warning: "triangle-alert",
|
|
1862
1971
|
danger: "circle-alert"
|
|
1863
1972
|
};
|
|
1864
|
-
var Alert =
|
|
1973
|
+
var Alert = React18.forwardRef(function Alert2(props, ref) {
|
|
1865
1974
|
const t = useStrings();
|
|
1866
1975
|
const tone2 = props.tone || "info";
|
|
1867
|
-
return /* @__PURE__ */
|
|
1976
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1868
1977
|
"div",
|
|
1869
1978
|
{
|
|
1870
1979
|
ref,
|
|
1871
1980
|
className: cx("aura-alert", "aura-alert--" + tone2, props.className),
|
|
1872
1981
|
role: tone2 === "danger" || tone2 === "warning" ? "alert" : "status"
|
|
1873
1982
|
},
|
|
1874
|
-
/* @__PURE__ */
|
|
1875
|
-
/* @__PURE__ */
|
|
1876
|
-
props.onDismiss ? /* @__PURE__ */
|
|
1983
|
+
/* @__PURE__ */ React18.createElement(Icon, { name: ALERT_ICON[tone2], className: "aura-alert__icon" }),
|
|
1984
|
+
/* @__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),
|
|
1985
|
+
props.onDismiss ? /* @__PURE__ */ React18.createElement(IconButton, { icon: "x", label: t.dismiss, className: "aura-alert__close", onClick: props.onDismiss }) : null
|
|
1877
1986
|
);
|
|
1878
1987
|
});
|
|
1988
|
+
|
|
1989
|
+
// src/Toaster.tsx
|
|
1990
|
+
var React19 = __toESM(require_react(), 1);
|
|
1991
|
+
var import_react_dom4 = __toESM(require_react_dom(), 1);
|
|
1879
1992
|
var toastState = {
|
|
1880
1993
|
list: [],
|
|
1881
1994
|
subs: [],
|
|
@@ -1903,7 +2016,7 @@ window.Aura = (() => {
|
|
|
1903
2016
|
};
|
|
1904
2017
|
function ToastItem(props) {
|
|
1905
2018
|
const str = useStrings();
|
|
1906
|
-
const t = props.toast, timer =
|
|
2019
|
+
const t = props.toast, timer = React19.useRef(null), left = React19.useRef(t.duration || 5e3), since = React19.useRef(0);
|
|
1907
2020
|
function start() {
|
|
1908
2021
|
if (left.current === Infinity) return;
|
|
1909
2022
|
since.current = Date.now();
|
|
@@ -1918,11 +2031,11 @@ window.Aura = (() => {
|
|
|
1918
2031
|
left.current -= Date.now() - since.current;
|
|
1919
2032
|
}
|
|
1920
2033
|
}
|
|
1921
|
-
|
|
2034
|
+
React19.useEffect(function() {
|
|
1922
2035
|
start();
|
|
1923
2036
|
return pause;
|
|
1924
2037
|
}, []);
|
|
1925
|
-
return /* @__PURE__ */
|
|
2038
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1926
2039
|
"div",
|
|
1927
2040
|
{
|
|
1928
2041
|
className: cx("aura-toast", "aura-toast--" + t.tone),
|
|
@@ -1932,9 +2045,9 @@ window.Aura = (() => {
|
|
|
1932
2045
|
onFocus: pause,
|
|
1933
2046
|
onBlur: start
|
|
1934
2047
|
},
|
|
1935
|
-
/* @__PURE__ */
|
|
1936
|
-
/* @__PURE__ */
|
|
1937
|
-
t.action ? /* @__PURE__ */
|
|
2048
|
+
/* @__PURE__ */ React19.createElement(Icon, { name: ALERT_ICON[t.tone] || "info", className: "aura-toast__icon" }),
|
|
2049
|
+
/* @__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),
|
|
2050
|
+
t.action ? /* @__PURE__ */ React19.createElement(
|
|
1938
2051
|
"button",
|
|
1939
2052
|
{
|
|
1940
2053
|
type: "button",
|
|
@@ -1946,7 +2059,7 @@ window.Aura = (() => {
|
|
|
1946
2059
|
},
|
|
1947
2060
|
t.action.label
|
|
1948
2061
|
) : null,
|
|
1949
|
-
/* @__PURE__ */
|
|
2062
|
+
/* @__PURE__ */ React19.createElement(
|
|
1950
2063
|
IconButton,
|
|
1951
2064
|
{
|
|
1952
2065
|
icon: "x",
|
|
@@ -1962,8 +2075,8 @@ window.Aura = (() => {
|
|
|
1962
2075
|
function Toaster(props) {
|
|
1963
2076
|
const t = useStrings();
|
|
1964
2077
|
const mounted = useMounted();
|
|
1965
|
-
const s =
|
|
1966
|
-
|
|
2078
|
+
const s = React19.useState(toastState.list);
|
|
2079
|
+
React19.useEffect(function() {
|
|
1967
2080
|
toastState.subs.push(s[1]);
|
|
1968
2081
|
return function() {
|
|
1969
2082
|
toastState.subs = toastState.subs.filter(function(f) {
|
|
@@ -1973,7 +2086,7 @@ window.Aura = (() => {
|
|
|
1973
2086
|
}, []);
|
|
1974
2087
|
if (!mounted) return null;
|
|
1975
2088
|
return (0, import_react_dom4.createPortal)(
|
|
1976
|
-
/* @__PURE__ */
|
|
2089
|
+
/* @__PURE__ */ React19.createElement(
|
|
1977
2090
|
"div",
|
|
1978
2091
|
{
|
|
1979
2092
|
className: cx("aura-toaster", props && props.position === "top" && "is-top"),
|
|
@@ -1982,16 +2095,20 @@ window.Aura = (() => {
|
|
|
1982
2095
|
"aria-label": t.notifications
|
|
1983
2096
|
},
|
|
1984
2097
|
s[0].map(function(t2) {
|
|
1985
|
-
return /* @__PURE__ */
|
|
2098
|
+
return /* @__PURE__ */ React19.createElement(ToastItem, { key: t2.id, toast: t2 });
|
|
1986
2099
|
})
|
|
1987
2100
|
),
|
|
1988
2101
|
document.body
|
|
1989
2102
|
);
|
|
1990
2103
|
}
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2104
|
+
|
|
2105
|
+
// src/Tooltip.tsx
|
|
2106
|
+
var React20 = __toESM(require_react(), 1);
|
|
2107
|
+
var import_react_dom5 = __toESM(require_react_dom(), 1);
|
|
2108
|
+
var Tooltip = React20.forwardRef(function Tooltip2(props, ref) {
|
|
2109
|
+
const id = uid(), st = React20.useState(false), open = props.open !== void 0 ? props.open : st[0], set = st[1];
|
|
2110
|
+
const anchor = React20.useRef(null), anchorMerged = useMergedRef(ref, anchor), tip = React20.useRef(null), timer = React20.useRef(void 0);
|
|
2111
|
+
const pos = React20.useState(null);
|
|
1995
2112
|
function show(now) {
|
|
1996
2113
|
clearTimeout(timer.current);
|
|
1997
2114
|
timer.current = setTimeout(
|
|
@@ -2016,7 +2133,7 @@ window.Aura = (() => {
|
|
|
2016
2133
|
},
|
|
2017
2134
|
[open]
|
|
2018
2135
|
);
|
|
2019
|
-
|
|
2136
|
+
React20.useEffect(
|
|
2020
2137
|
function() {
|
|
2021
2138
|
if (!open) return;
|
|
2022
2139
|
function esc(e) {
|
|
@@ -2029,8 +2146,8 @@ window.Aura = (() => {
|
|
|
2029
2146
|
},
|
|
2030
2147
|
[open]
|
|
2031
2148
|
);
|
|
2032
|
-
const child =
|
|
2033
|
-
const trigger = /* @__PURE__ */
|
|
2149
|
+
const child = React20.Children.only(props.children);
|
|
2150
|
+
const trigger = /* @__PURE__ */ React20.createElement(
|
|
2034
2151
|
"span",
|
|
2035
2152
|
{
|
|
2036
2153
|
ref: anchorMerged,
|
|
@@ -2044,10 +2161,10 @@ window.Aura = (() => {
|
|
|
2044
2161
|
},
|
|
2045
2162
|
onBlur: hide
|
|
2046
2163
|
},
|
|
2047
|
-
|
|
2164
|
+
React20.cloneElement(child, { "aria-describedby": open ? id : child.props["aria-describedby"] })
|
|
2048
2165
|
);
|
|
2049
|
-
return /* @__PURE__ */
|
|
2050
|
-
/* @__PURE__ */
|
|
2166
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, trigger, open ? (0, import_react_dom5.createPortal)(
|
|
2167
|
+
/* @__PURE__ */ React20.createElement(
|
|
2051
2168
|
"div",
|
|
2052
2169
|
{
|
|
2053
2170
|
ref: tip,
|
|
@@ -2063,16 +2180,16 @@ window.Aura = (() => {
|
|
|
2063
2180
|
});
|
|
2064
2181
|
|
|
2065
2182
|
// src/Dialog.tsx
|
|
2066
|
-
var
|
|
2067
|
-
var
|
|
2183
|
+
var React22 = __toESM(require_react(), 1);
|
|
2184
|
+
var import_react_dom6 = __toESM(require_react_dom(), 1);
|
|
2068
2185
|
|
|
2069
|
-
// src/
|
|
2070
|
-
var
|
|
2186
|
+
// src/useModal.tsx
|
|
2187
|
+
var React21 = __toESM(require_react(), 1);
|
|
2071
2188
|
function useModal(open, ref, opts) {
|
|
2072
2189
|
const mounted = useMounted();
|
|
2073
|
-
const prev =
|
|
2190
|
+
const prev = React21.useRef(null);
|
|
2074
2191
|
const o = opts || {};
|
|
2075
|
-
|
|
2192
|
+
React21.useEffect(
|
|
2076
2193
|
function() {
|
|
2077
2194
|
if (!open || !mounted) return;
|
|
2078
2195
|
prev.current = document.activeElement;
|
|
@@ -2113,9 +2230,9 @@ window.Aura = (() => {
|
|
|
2113
2230
|
}
|
|
2114
2231
|
|
|
2115
2232
|
// src/Dialog.tsx
|
|
2116
|
-
var Dialog =
|
|
2233
|
+
var Dialog = React22.forwardRef(function Dialog2(props, ref) {
|
|
2117
2234
|
const t = useStrings();
|
|
2118
|
-
const own =
|
|
2235
|
+
const own = React22.useRef(null), merged = useMergedRef(ref, own), titleId = uid(), descId = uid();
|
|
2119
2236
|
function close() {
|
|
2120
2237
|
if (props.dismissible !== false && props.onClose) props.onClose();
|
|
2121
2238
|
}
|
|
@@ -2126,8 +2243,8 @@ window.Aura = (() => {
|
|
|
2126
2243
|
footSelector: ".aura-dialog__foot"
|
|
2127
2244
|
});
|
|
2128
2245
|
if (!modal.ready) return null;
|
|
2129
|
-
return (0,
|
|
2130
|
-
/* @__PURE__ */
|
|
2246
|
+
return (0, import_react_dom6.createPortal)(
|
|
2247
|
+
/* @__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(
|
|
2131
2248
|
"div",
|
|
2132
2249
|
{
|
|
2133
2250
|
ref: merged,
|
|
@@ -2138,17 +2255,17 @@ window.Aura = (() => {
|
|
|
2138
2255
|
tabIndex: -1,
|
|
2139
2256
|
className: cx("aura-dialog", "aura-dialog--" + (props.size || "md"), props.className)
|
|
2140
2257
|
},
|
|
2141
|
-
/* @__PURE__ */
|
|
2142
|
-
props.description ? /* @__PURE__ */
|
|
2143
|
-
props.children ? /* @__PURE__ */
|
|
2144
|
-
props.footer ? /* @__PURE__ */
|
|
2258
|
+
/* @__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),
|
|
2259
|
+
props.description ? /* @__PURE__ */ React22.createElement("p", { className: "aura-dialog__desc", id: descId }, props.description) : null,
|
|
2260
|
+
props.children ? /* @__PURE__ */ React22.createElement("div", { className: "aura-dialog__body" }, props.children) : null,
|
|
2261
|
+
props.footer ? /* @__PURE__ */ React22.createElement("div", { className: "aura-dialog__foot" }, props.footer) : null
|
|
2145
2262
|
)),
|
|
2146
2263
|
document.body
|
|
2147
2264
|
);
|
|
2148
2265
|
});
|
|
2149
|
-
var Drawer =
|
|
2266
|
+
var Drawer = React22.forwardRef(function Drawer2(props, ref) {
|
|
2150
2267
|
const t = useStrings();
|
|
2151
|
-
const own =
|
|
2268
|
+
const own = React22.useRef(null), merged = useMergedRef(ref, own), titleId = uid(), descId = uid();
|
|
2152
2269
|
function close() {
|
|
2153
2270
|
if (props.dismissible !== false && props.onClose) props.onClose();
|
|
2154
2271
|
}
|
|
@@ -2160,8 +2277,8 @@ window.Aura = (() => {
|
|
|
2160
2277
|
});
|
|
2161
2278
|
if (!modal.ready) return null;
|
|
2162
2279
|
const side = props.side === "left" ? "left" : "right";
|
|
2163
|
-
return (0,
|
|
2164
|
-
/* @__PURE__ */
|
|
2280
|
+
return (0, import_react_dom6.createPortal)(
|
|
2281
|
+
/* @__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(
|
|
2165
2282
|
"div",
|
|
2166
2283
|
{
|
|
2167
2284
|
ref: merged,
|
|
@@ -2173,17 +2290,17 @@ window.Aura = (() => {
|
|
|
2173
2290
|
tabIndex: -1,
|
|
2174
2291
|
className: cx("aura-drawer", "aura-drawer--" + side, "aura-drawer--" + (props.size || "md"), props.className)
|
|
2175
2292
|
},
|
|
2176
|
-
props.title || props.dismissible !== false ? /* @__PURE__ */
|
|
2177
|
-
props.description ? /* @__PURE__ */
|
|
2178
|
-
/* @__PURE__ */
|
|
2179
|
-
props.footer ? /* @__PURE__ */
|
|
2293
|
+
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,
|
|
2294
|
+
props.description ? /* @__PURE__ */ React22.createElement("p", { className: "aura-drawer__desc", id: descId }, props.description) : null,
|
|
2295
|
+
/* @__PURE__ */ React22.createElement("div", { className: "aura-drawer__body" }, props.children),
|
|
2296
|
+
props.footer ? /* @__PURE__ */ React22.createElement("div", { className: "aura-drawer__foot" }, props.footer) : null
|
|
2180
2297
|
)),
|
|
2181
2298
|
document.body
|
|
2182
2299
|
);
|
|
2183
2300
|
});
|
|
2184
2301
|
|
|
2185
2302
|
// src/DataTable.tsx
|
|
2186
|
-
var
|
|
2303
|
+
var React23 = __toESM(require_react(), 1);
|
|
2187
2304
|
var BP = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
2188
2305
|
var DEFAULT_COLUMNS = [
|
|
2189
2306
|
{ key: "id", label: "ID", width: 96, mono: true },
|
|
@@ -2195,7 +2312,7 @@ window.Aura = (() => {
|
|
|
2195
2312
|
var ROW_H = 48;
|
|
2196
2313
|
var OVERSCAN = 8;
|
|
2197
2314
|
var FLEX_MIN = 160;
|
|
2198
|
-
var DataTable =
|
|
2315
|
+
var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
2199
2316
|
const t = useStrings();
|
|
2200
2317
|
const columns = props.columns || DEFAULT_COLUMNS;
|
|
2201
2318
|
const byKey = {};
|
|
@@ -2238,23 +2355,23 @@ window.Aura = (() => {
|
|
|
2238
2355
|
}),
|
|
2239
2356
|
props.onPinnedColumnsChange
|
|
2240
2357
|
);
|
|
2241
|
-
const widthState =
|
|
2358
|
+
const widthState = React23.useState({});
|
|
2242
2359
|
const widths = widthState[0], setWidths = widthState[1];
|
|
2243
|
-
const activeState =
|
|
2244
|
-
const scrollState =
|
|
2360
|
+
const activeState = React23.useState({ r: 1, c: 0 });
|
|
2361
|
+
const scrollState = React23.useState(0);
|
|
2245
2362
|
const scrollTop = scrollState[0], setScrollTop = scrollState[1];
|
|
2246
|
-
const scrolledX =
|
|
2247
|
-
const menuState =
|
|
2363
|
+
const scrolledX = React23.useState(false);
|
|
2364
|
+
const menuState = React23.useState(null);
|
|
2248
2365
|
const menu = menuState[0], setMenu = menuState[1];
|
|
2249
|
-
const dragState =
|
|
2366
|
+
const dragState = React23.useState(null);
|
|
2250
2367
|
const drag = dragState[0], setDrag = dragState[1];
|
|
2251
|
-
const gridRef =
|
|
2252
|
-
const wrapRef =
|
|
2253
|
-
const boxWidth =
|
|
2368
|
+
const gridRef = React23.useRef(null);
|
|
2369
|
+
const wrapRef = React23.useRef(null), wrapMerged = useMergedRef(ref, wrapRef);
|
|
2370
|
+
const boxWidth = React23.useState(null);
|
|
2254
2371
|
const measure = !!props.stackBelow || columns.some(function(c) {
|
|
2255
2372
|
return c.hideBelow != null;
|
|
2256
2373
|
});
|
|
2257
|
-
|
|
2374
|
+
React23.useEffect(
|
|
2258
2375
|
function() {
|
|
2259
2376
|
if (!measure || !wrapRef.current || typeof ResizeObserver === "undefined") return;
|
|
2260
2377
|
const ro = new ResizeObserver(function(en) {
|
|
@@ -2273,9 +2390,9 @@ window.Aura = (() => {
|
|
|
2273
2390
|
const px = typeof c.hideBelow === "number" ? c.hideBelow : BP[c.hideBelow];
|
|
2274
2391
|
return px != null && boxWidth[0] < px;
|
|
2275
2392
|
}
|
|
2276
|
-
const scrollRef =
|
|
2277
|
-
const pending =
|
|
2278
|
-
const resizing =
|
|
2393
|
+
const scrollRef = React23.useRef(null);
|
|
2394
|
+
const pending = React23.useRef(null);
|
|
2395
|
+
const resizing = React23.useRef(false);
|
|
2279
2396
|
useIsoLayoutEffect(function() {
|
|
2280
2397
|
if (stacked || !gridRef.current) return;
|
|
2281
2398
|
const els = gridRef.current.querySelectorAll(
|
|
@@ -2334,7 +2451,7 @@ window.Aura = (() => {
|
|
|
2334
2451
|
if (isPinned(c)) s.left = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + "px)";
|
|
2335
2452
|
return s;
|
|
2336
2453
|
}
|
|
2337
|
-
const view =
|
|
2454
|
+
const view = React23.useMemo(
|
|
2338
2455
|
function() {
|
|
2339
2456
|
if (!sort || !sort.key || !byKey[sort.key]) return rows;
|
|
2340
2457
|
const col = byKey[sort.key];
|
|
@@ -2393,7 +2510,7 @@ window.Aura = (() => {
|
|
|
2393
2510
|
if (!activeRendered) return r === 0 && c === ac ? 0 : -1;
|
|
2394
2511
|
return r === ar && c === ac ? 0 : -1;
|
|
2395
2512
|
}
|
|
2396
|
-
|
|
2513
|
+
React23.useEffect(function() {
|
|
2397
2514
|
const p = pending.current;
|
|
2398
2515
|
if (!p || !gridRef.current) return;
|
|
2399
2516
|
let c = p.c;
|
|
@@ -2704,10 +2821,10 @@ window.Aura = (() => {
|
|
|
2704
2821
|
e.stopPropagation();
|
|
2705
2822
|
}
|
|
2706
2823
|
}
|
|
2707
|
-
const head = [/* @__PURE__ */
|
|
2824
|
+
const head = [/* @__PURE__ */ React23.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
|
|
2708
2825
|
if (selectable)
|
|
2709
2826
|
head.push(
|
|
2710
|
-
/* @__PURE__ */
|
|
2827
|
+
/* @__PURE__ */ React23.createElement(
|
|
2711
2828
|
"span",
|
|
2712
2829
|
{
|
|
2713
2830
|
key: "__sel",
|
|
@@ -2721,7 +2838,7 @@ window.Aura = (() => {
|
|
|
2721
2838
|
activeState[1]({ r: 0, c: 0 });
|
|
2722
2839
|
}
|
|
2723
2840
|
},
|
|
2724
|
-
nRows ? /* @__PURE__ */
|
|
2841
|
+
nRows ? /* @__PURE__ */ React23.createElement(
|
|
2725
2842
|
Checkbox,
|
|
2726
2843
|
{
|
|
2727
2844
|
checked: all,
|
|
@@ -2740,7 +2857,7 @@ window.Aura = (() => {
|
|
|
2740
2857
|
const ariaSort = isSorted && canSort ? sort.dir === "desc" ? "descending" : "ascending" : canSort ? "none" : void 0;
|
|
2741
2858
|
const pin = isPinned(c), edge = pin && i === nPinned - 1;
|
|
2742
2859
|
head.push(
|
|
2743
|
-
/* @__PURE__ */
|
|
2860
|
+
/* @__PURE__ */ React23.createElement(
|
|
2744
2861
|
"span",
|
|
2745
2862
|
{
|
|
2746
2863
|
key: c.key,
|
|
@@ -2788,7 +2905,7 @@ window.Aura = (() => {
|
|
|
2788
2905
|
setDrag(null);
|
|
2789
2906
|
}
|
|
2790
2907
|
},
|
|
2791
|
-
/* @__PURE__ */
|
|
2908
|
+
/* @__PURE__ */ React23.createElement("span", { className: "aura-table__th-inner" }, canSort ? /* @__PURE__ */ React23.createElement(
|
|
2792
2909
|
"button",
|
|
2793
2910
|
{
|
|
2794
2911
|
type: "button",
|
|
@@ -2801,8 +2918,8 @@ window.Aura = (() => {
|
|
|
2801
2918
|
}
|
|
2802
2919
|
},
|
|
2803
2920
|
c.label,
|
|
2804
|
-
/* @__PURE__ */
|
|
2805
|
-
) : /* @__PURE__ */
|
|
2921
|
+
/* @__PURE__ */ React23.createElement(Icon, { name: isSorted ? sort.dir === "desc" ? "arrow-down" : "arrow-up" : "arrow-up-down", size: 12 })
|
|
2922
|
+
) : /* @__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(
|
|
2806
2923
|
"button",
|
|
2807
2924
|
{
|
|
2808
2925
|
type: "button",
|
|
@@ -2816,9 +2933,9 @@ window.Aura = (() => {
|
|
|
2816
2933
|
openMenu("col", c.key, e.currentTarget, { r: 0, c: ci });
|
|
2817
2934
|
}
|
|
2818
2935
|
},
|
|
2819
|
-
/* @__PURE__ */
|
|
2936
|
+
/* @__PURE__ */ React23.createElement(Icon, { name: "ellipsis" })
|
|
2820
2937
|
) : null),
|
|
2821
|
-
canResize(c) ? /* @__PURE__ */
|
|
2938
|
+
canResize(c) ? /* @__PURE__ */ React23.createElement(
|
|
2822
2939
|
"span",
|
|
2823
2940
|
{
|
|
2824
2941
|
className: "aura-table__resize",
|
|
@@ -2840,7 +2957,7 @@ window.Aura = (() => {
|
|
|
2840
2957
|
);
|
|
2841
2958
|
});
|
|
2842
2959
|
head.push(
|
|
2843
|
-
/* @__PURE__ */
|
|
2960
|
+
/* @__PURE__ */ React23.createElement(
|
|
2844
2961
|
"span",
|
|
2845
2962
|
{
|
|
2846
2963
|
key: "__gr",
|
|
@@ -2851,10 +2968,10 @@ window.Aura = (() => {
|
|
|
2851
2968
|
);
|
|
2852
2969
|
function rowCells(r, i, k, isSel) {
|
|
2853
2970
|
const ri = i + 1;
|
|
2854
|
-
const cells = [/* @__PURE__ */
|
|
2971
|
+
const cells = [/* @__PURE__ */ React23.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
|
|
2855
2972
|
if (selectable)
|
|
2856
2973
|
cells.push(
|
|
2857
|
-
/* @__PURE__ */
|
|
2974
|
+
/* @__PURE__ */ React23.createElement(
|
|
2858
2975
|
"span",
|
|
2859
2976
|
{
|
|
2860
2977
|
key: "__sel",
|
|
@@ -2868,7 +2985,7 @@ window.Aura = (() => {
|
|
|
2868
2985
|
if (e.target === e.currentTarget) activeState[1]({ r: ri, c: 0 });
|
|
2869
2986
|
}
|
|
2870
2987
|
},
|
|
2871
|
-
/* @__PURE__ */
|
|
2988
|
+
/* @__PURE__ */ React23.createElement(
|
|
2872
2989
|
Checkbox,
|
|
2873
2990
|
{
|
|
2874
2991
|
checked: isSel,
|
|
@@ -2884,7 +3001,7 @@ window.Aura = (() => {
|
|
|
2884
3001
|
vis.forEach(function(c, j) {
|
|
2885
3002
|
const ci = j + (selectable ? 1 : 0), v = r[c.key], pin = isPinned(c);
|
|
2886
3003
|
cells.push(
|
|
2887
|
-
/* @__PURE__ */
|
|
3004
|
+
/* @__PURE__ */ React23.createElement(
|
|
2888
3005
|
"span",
|
|
2889
3006
|
{
|
|
2890
3007
|
key: c.key,
|
|
@@ -2903,12 +3020,12 @@ window.Aura = (() => {
|
|
|
2903
3020
|
if (activeState[0].r !== ri || activeState[0].c !== ci) activeState[1]({ r: ri, c: ci });
|
|
2904
3021
|
}
|
|
2905
3022
|
},
|
|
2906
|
-
c.render ? c.render(r) : c.pill ? /* @__PURE__ */
|
|
3023
|
+
c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React23.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v
|
|
2907
3024
|
)
|
|
2908
3025
|
);
|
|
2909
3026
|
});
|
|
2910
3027
|
cells.push(
|
|
2911
|
-
/* @__PURE__ */
|
|
3028
|
+
/* @__PURE__ */ React23.createElement(
|
|
2912
3029
|
"span",
|
|
2913
3030
|
{
|
|
2914
3031
|
key: "__gr",
|
|
@@ -2925,14 +3042,14 @@ window.Aura = (() => {
|
|
|
2925
3042
|
const n2 = pageSize || props.skeletonRows || 5;
|
|
2926
3043
|
const skRows = body = [];
|
|
2927
3044
|
for (let i = 0; i < n2; i++) {
|
|
2928
|
-
const sk = [/* @__PURE__ */
|
|
3045
|
+
const sk = [/* @__PURE__ */ React23.createElement("span", { key: "__gl", className: "aura-table__gutter" })];
|
|
2929
3046
|
if (selectable)
|
|
2930
3047
|
sk.push(
|
|
2931
|
-
/* @__PURE__ */
|
|
3048
|
+
/* @__PURE__ */ React23.createElement("span", { key: "__sel", className: cx("aura-table__sel", nPinned && "is-pinned") }, /* @__PURE__ */ React23.createElement("span", { className: "aura-skel aura-skel--box" }))
|
|
2932
3049
|
);
|
|
2933
3050
|
vis.forEach(function(c, j) {
|
|
2934
3051
|
sk.push(
|
|
2935
|
-
/* @__PURE__ */
|
|
3052
|
+
/* @__PURE__ */ React23.createElement("span", { key: c.key, className: cx("aura-table__td", isPinned(c) && "is-pinned"), style: cellStyle(c, j) }, /* @__PURE__ */ React23.createElement(
|
|
2936
3053
|
"span",
|
|
2937
3054
|
{
|
|
2938
3055
|
className: cx("aura-skel", c.pill && "aura-skel--pill"),
|
|
@@ -2942,24 +3059,24 @@ window.Aura = (() => {
|
|
|
2942
3059
|
);
|
|
2943
3060
|
});
|
|
2944
3061
|
sk.push(
|
|
2945
|
-
/* @__PURE__ */
|
|
3062
|
+
/* @__PURE__ */ React23.createElement("span", { key: "__gr", className: cx("aura-table__gutter aura-table__gutter--end", controls && "has-picker") })
|
|
2946
3063
|
);
|
|
2947
3064
|
skRows.push(
|
|
2948
|
-
/* @__PURE__ */
|
|
3065
|
+
/* @__PURE__ */ React23.createElement("div", { key: "sk" + i, className: "aura-table__row aura-table__row--skeleton", "aria-hidden": true, style: rowStyle }, sk)
|
|
2949
3066
|
);
|
|
2950
3067
|
}
|
|
2951
3068
|
} else if (!rows.length) {
|
|
2952
3069
|
const em = props.empty || {};
|
|
2953
|
-
body = /* @__PURE__ */
|
|
3070
|
+
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));
|
|
2954
3071
|
} else {
|
|
2955
3072
|
const bodyRows = body = [];
|
|
2956
3073
|
if (virtual && start > 0)
|
|
2957
|
-
bodyRows.push(/* @__PURE__ */
|
|
3074
|
+
bodyRows.push(/* @__PURE__ */ React23.createElement("div", { key: "__top", style: { height: start * ROW_H + "px" }, "aria-hidden": true }));
|
|
2958
3075
|
for (let ri = start; ri < end; ri++) {
|
|
2959
3076
|
(function(r, i) {
|
|
2960
3077
|
const k = r[rowKey], isSel = !!selSet[k];
|
|
2961
3078
|
bodyRows.push(
|
|
2962
|
-
/* @__PURE__ */
|
|
3079
|
+
/* @__PURE__ */ React23.createElement(
|
|
2963
3080
|
"div",
|
|
2964
3081
|
{
|
|
2965
3082
|
key: k,
|
|
@@ -2980,12 +3097,12 @@ window.Aura = (() => {
|
|
|
2980
3097
|
})(pageRows[ri], ri);
|
|
2981
3098
|
}
|
|
2982
3099
|
if (virtual && end < pageRows.length)
|
|
2983
|
-
bodyRows.push(/* @__PURE__ */
|
|
3100
|
+
bodyRows.push(/* @__PURE__ */ React23.createElement("div", { key: "__bot", style: { height: (pageRows.length - end) * ROW_H + "px" }, "aria-hidden": true }));
|
|
2984
3101
|
}
|
|
2985
3102
|
let foot = null;
|
|
2986
3103
|
if (pageSize && (rows.length || loading)) {
|
|
2987
3104
|
const from = rows.length ? first + 1 : 0, to = Math.min(first + pageSize, view.length);
|
|
2988
|
-
foot = /* @__PURE__ */
|
|
3105
|
+
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(
|
|
2989
3106
|
IconButton,
|
|
2990
3107
|
{
|
|
2991
3108
|
icon: "chevron-left",
|
|
@@ -2995,7 +3112,7 @@ window.Aura = (() => {
|
|
|
2995
3112
|
goPage(page - 1);
|
|
2996
3113
|
}
|
|
2997
3114
|
}
|
|
2998
|
-
), /* @__PURE__ */
|
|
3115
|
+
), /* @__PURE__ */ React23.createElement(
|
|
2999
3116
|
IconButton,
|
|
3000
3117
|
{
|
|
3001
3118
|
icon: "chevron-right",
|
|
@@ -3007,7 +3124,7 @@ window.Aura = (() => {
|
|
|
3007
3124
|
}
|
|
3008
3125
|
)));
|
|
3009
3126
|
} else if (height && rows.length && !loading) {
|
|
3010
|
-
foot = /* @__PURE__ */
|
|
3127
|
+
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));
|
|
3011
3128
|
}
|
|
3012
3129
|
if (stacked) {
|
|
3013
3130
|
const titleCol = vis[0], pillCol = vis.filter(function(c) {
|
|
@@ -3021,20 +3138,20 @@ window.Aura = (() => {
|
|
|
3021
3138
|
});
|
|
3022
3139
|
let cardBody;
|
|
3023
3140
|
if (loading) {
|
|
3024
|
-
cardBody = /* @__PURE__ */
|
|
3025
|
-
return /* @__PURE__ */
|
|
3141
|
+
cardBody = /* @__PURE__ */ React23.createElement("ul", { className: "aura-table__cards", "aria-busy": true }, [0, 1, 2].map(function(i) {
|
|
3142
|
+
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%" } }));
|
|
3026
3143
|
}));
|
|
3027
3144
|
} else if (!rows.length) {
|
|
3028
3145
|
const em2 = props.empty || {};
|
|
3029
|
-
cardBody = /* @__PURE__ */
|
|
3146
|
+
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));
|
|
3030
3147
|
} else {
|
|
3031
3148
|
const cellVal = function(c, r) {
|
|
3032
3149
|
const v = r[c.key];
|
|
3033
|
-
return c.render ? c.render(r) : c.pill ? /* @__PURE__ */
|
|
3150
|
+
return c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React23.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v;
|
|
3034
3151
|
};
|
|
3035
|
-
cardBody = /* @__PURE__ */
|
|
3152
|
+
cardBody = /* @__PURE__ */ React23.createElement("ul", { className: "aura-table__cards", "aria-label": props.label }, pageRows.map(function(r) {
|
|
3036
3153
|
const k = r[rowKey], isSel = !!selSet[k];
|
|
3037
|
-
return /* @__PURE__ */
|
|
3154
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3038
3155
|
"li",
|
|
3039
3156
|
{
|
|
3040
3157
|
key: k,
|
|
@@ -3049,7 +3166,7 @@ window.Aura = (() => {
|
|
|
3049
3166
|
if (e.target === e.currentTarget && e.key === "Enter" && props.onRowActivate) props.onRowActivate(r);
|
|
3050
3167
|
}
|
|
3051
3168
|
},
|
|
3052
|
-
/* @__PURE__ */
|
|
3169
|
+
/* @__PURE__ */ React23.createElement("div", { className: "aura-table__card-head" }, selectable ? /* @__PURE__ */ React23.createElement(
|
|
3053
3170
|
Checkbox,
|
|
3054
3171
|
{
|
|
3055
3172
|
checked: isSel,
|
|
@@ -3058,16 +3175,16 @@ window.Aura = (() => {
|
|
|
3058
3175
|
toggle(k, on);
|
|
3059
3176
|
}
|
|
3060
3177
|
}
|
|
3061
|
-
) : null, /* @__PURE__ */
|
|
3062
|
-
return /* @__PURE__ */
|
|
3178
|
+
) : 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) {
|
|
3179
|
+
return /* @__PURE__ */ React23.createElement("span", { key: c.key, className: "aura-table__card-actions" }, cellVal(c, r));
|
|
3063
3180
|
})),
|
|
3064
|
-
rest.length ? /* @__PURE__ */
|
|
3065
|
-
return /* @__PURE__ */
|
|
3181
|
+
rest.length ? /* @__PURE__ */ React23.createElement("dl", { className: "aura-table__card-fields" }, rest.map(function(c) {
|
|
3182
|
+
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)));
|
|
3066
3183
|
})) : null
|
|
3067
3184
|
);
|
|
3068
3185
|
}));
|
|
3069
3186
|
}
|
|
3070
|
-
return /* @__PURE__ */
|
|
3187
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3071
3188
|
"div",
|
|
3072
3189
|
{
|
|
3073
3190
|
ref: wrapMerged,
|
|
@@ -3076,7 +3193,7 @@ window.Aura = (() => {
|
|
|
3076
3193
|
"aria-label": props.label,
|
|
3077
3194
|
"aria-busy": loading || void 0
|
|
3078
3195
|
},
|
|
3079
|
-
selectable && pageRows.length && !loading ? /* @__PURE__ */
|
|
3196
|
+
selectable && pageRows.length && !loading ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__stack-bar" }, /* @__PURE__ */ React23.createElement(
|
|
3080
3197
|
Checkbox,
|
|
3081
3198
|
{
|
|
3082
3199
|
checked: all,
|
|
@@ -3084,7 +3201,7 @@ window.Aura = (() => {
|
|
|
3084
3201
|
label: all ? t.deselectAllRows : t.selectAllRows,
|
|
3085
3202
|
onChange: toggleAll
|
|
3086
3203
|
}
|
|
3087
|
-
), /* @__PURE__ */
|
|
3204
|
+
), /* @__PURE__ */ React23.createElement("span", null, nSel ? t.selectedCount(nSel) : t.selectAll)) : null,
|
|
3088
3205
|
cardBody,
|
|
3089
3206
|
foot
|
|
3090
3207
|
);
|
|
@@ -3094,7 +3211,7 @@ window.Aura = (() => {
|
|
|
3094
3211
|
scrollPaddingTop: ROW_H + "px"
|
|
3095
3212
|
};
|
|
3096
3213
|
if (height) scrollStyle.height = height + "px";
|
|
3097
|
-
return /* @__PURE__ */
|
|
3214
|
+
return /* @__PURE__ */ React23.createElement("div", { ref: wrapMerged, className: cx("aura-table", scrolledX[0] && "is-scrolled-x", props.className) }, /* @__PURE__ */ React23.createElement(
|
|
3098
3215
|
"div",
|
|
3099
3216
|
{
|
|
3100
3217
|
ref: function(el) {
|
|
@@ -3119,9 +3236,9 @@ window.Aura = (() => {
|
|
|
3119
3236
|
if (sx !== scrolledX[0]) scrolledX[1](sx);
|
|
3120
3237
|
}
|
|
3121
3238
|
},
|
|
3122
|
-
/* @__PURE__ */
|
|
3239
|
+
/* @__PURE__ */ React23.createElement("div", { className: "aura-table__head", role: "row", "aria-rowindex": 1, style: rowStyle }, head),
|
|
3123
3240
|
body
|
|
3124
|
-
), loading ? /* @__PURE__ */
|
|
3241
|
+
), 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(
|
|
3125
3242
|
IconButton,
|
|
3126
3243
|
{
|
|
3127
3244
|
icon: "columns-3",
|
|
@@ -3131,7 +3248,7 @@ window.Aura = (() => {
|
|
|
3131
3248
|
openMenu("picker", null, e.currentTarget);
|
|
3132
3249
|
}
|
|
3133
3250
|
}
|
|
3134
|
-
)) : null, foot, menu ? /* @__PURE__ */
|
|
3251
|
+
)) : null, foot, menu ? /* @__PURE__ */ React23.createElement(
|
|
3135
3252
|
Menu,
|
|
3136
3253
|
{
|
|
3137
3254
|
anchor: menu.anchor,
|
|
@@ -3142,12 +3259,12 @@ window.Aura = (() => {
|
|
|
3142
3259
|
) : null);
|
|
3143
3260
|
});
|
|
3144
3261
|
|
|
3145
|
-
// src/
|
|
3146
|
-
var
|
|
3147
|
-
var
|
|
3148
|
-
var Card =
|
|
3262
|
+
// src/Card.tsx
|
|
3263
|
+
var React24 = __toESM(require_react(), 1);
|
|
3264
|
+
var h4 = React24.createElement;
|
|
3265
|
+
var Card = React24.forwardRef(function Card2(props, ref) {
|
|
3149
3266
|
const creative = props.variant === "creative";
|
|
3150
|
-
return
|
|
3267
|
+
return h4(
|
|
3151
3268
|
props.as || "section",
|
|
3152
3269
|
{
|
|
3153
3270
|
ref,
|
|
@@ -3159,19 +3276,22 @@ window.Aura = (() => {
|
|
|
3159
3276
|
),
|
|
3160
3277
|
"aria-labelledby": props.title && props.titleId ? props.titleId : void 0
|
|
3161
3278
|
},
|
|
3162
|
-
props.title || props.actions ? /* @__PURE__ */
|
|
3163
|
-
props.children ? /* @__PURE__ */
|
|
3164
|
-
props.footer ? /* @__PURE__ */
|
|
3279
|
+
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,
|
|
3280
|
+
props.children ? /* @__PURE__ */ React24.createElement("div", { className: "aura-card__body" }, props.children) : null,
|
|
3281
|
+
props.footer ? /* @__PURE__ */ React24.createElement("div", { className: "aura-card__foot" }, props.footer) : null
|
|
3165
3282
|
);
|
|
3166
3283
|
});
|
|
3167
|
-
|
|
3284
|
+
|
|
3285
|
+
// src/Tabs.tsx
|
|
3286
|
+
var React25 = __toESM(require_react(), 1);
|
|
3287
|
+
var Tabs = React25.forwardRef(function Tabs2(props, ref) {
|
|
3168
3288
|
const items = props.tabs || [], base = uid();
|
|
3169
3289
|
const st = useMaybeControlled(
|
|
3170
3290
|
props.value,
|
|
3171
3291
|
props.defaultValue || items[0] && items[0].id,
|
|
3172
3292
|
props.onChange
|
|
3173
3293
|
);
|
|
3174
|
-
const refs =
|
|
3294
|
+
const refs = React25.useRef({});
|
|
3175
3295
|
const current2 = items.filter(function(t) {
|
|
3176
3296
|
return t.id === st[0];
|
|
3177
3297
|
})[0] || items[0];
|
|
@@ -3183,7 +3303,7 @@ window.Aura = (() => {
|
|
|
3183
3303
|
st[1](t.id);
|
|
3184
3304
|
if (refs.current[t.id]) refs.current[t.id].focus();
|
|
3185
3305
|
}
|
|
3186
|
-
return /* @__PURE__ */
|
|
3306
|
+
return /* @__PURE__ */ React25.createElement("div", { ref, className: cx("aura-tabs", props.className) }, /* @__PURE__ */ React25.createElement(
|
|
3187
3307
|
"div",
|
|
3188
3308
|
{
|
|
3189
3309
|
role: "tablist",
|
|
@@ -3210,7 +3330,7 @@ window.Aura = (() => {
|
|
|
3210
3330
|
},
|
|
3211
3331
|
items.map(function(t) {
|
|
3212
3332
|
const on = current2 && t.id === current2.id;
|
|
3213
|
-
return /* @__PURE__ */
|
|
3333
|
+
return /* @__PURE__ */ React25.createElement(
|
|
3214
3334
|
"button",
|
|
3215
3335
|
{
|
|
3216
3336
|
key: t.id,
|
|
@@ -3229,12 +3349,12 @@ window.Aura = (() => {
|
|
|
3229
3349
|
st[1](t.id);
|
|
3230
3350
|
}
|
|
3231
3351
|
},
|
|
3232
|
-
t.icon ? /* @__PURE__ */
|
|
3352
|
+
t.icon ? /* @__PURE__ */ React25.createElement(Icon, { name: t.icon }) : null,
|
|
3233
3353
|
t.label,
|
|
3234
|
-
t.count != null ? /* @__PURE__ */
|
|
3354
|
+
t.count != null ? /* @__PURE__ */ React25.createElement("span", { className: "aura-tab__count" }, t.count) : null
|
|
3235
3355
|
);
|
|
3236
3356
|
})
|
|
3237
|
-
), current2 && current2.content !== void 0 ? /* @__PURE__ */
|
|
3357
|
+
), current2 && current2.content !== void 0 ? /* @__PURE__ */ React25.createElement(
|
|
3238
3358
|
"div",
|
|
3239
3359
|
{
|
|
3240
3360
|
role: "tabpanel",
|
|
@@ -3246,7 +3366,10 @@ window.Aura = (() => {
|
|
|
3246
3366
|
current2.content
|
|
3247
3367
|
) : null);
|
|
3248
3368
|
});
|
|
3249
|
-
|
|
3369
|
+
|
|
3370
|
+
// src/SideNav.tsx
|
|
3371
|
+
var React26 = __toESM(require_react(), 1);
|
|
3372
|
+
var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
3250
3373
|
const t = useStrings();
|
|
3251
3374
|
const st = useMaybeControlled(
|
|
3252
3375
|
props.value,
|
|
@@ -3256,9 +3379,9 @@ window.Aura = (() => {
|
|
|
3256
3379
|
function item(it) {
|
|
3257
3380
|
const on = st[0] === it.id;
|
|
3258
3381
|
const inner = [
|
|
3259
|
-
it.icon ? /* @__PURE__ */
|
|
3260
|
-
/* @__PURE__ */
|
|
3261
|
-
it.count != null ? /* @__PURE__ */
|
|
3382
|
+
it.icon ? /* @__PURE__ */ React26.createElement(Icon, { key: "i", name: it.icon }) : null,
|
|
3383
|
+
/* @__PURE__ */ React26.createElement("span", { key: "l", className: "aura-nav__label" }, it.label),
|
|
3384
|
+
it.count != null ? /* @__PURE__ */ React26.createElement("span", { key: "c", className: "aura-nav__count" }, it.count) : null
|
|
3262
3385
|
];
|
|
3263
3386
|
const common = {
|
|
3264
3387
|
className: cx("aura-nav__item", on && "is-active"),
|
|
@@ -3268,33 +3391,39 @@ window.Aura = (() => {
|
|
|
3268
3391
|
st[1](it.id);
|
|
3269
3392
|
}
|
|
3270
3393
|
};
|
|
3271
|
-
return /* @__PURE__ */
|
|
3394
|
+
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));
|
|
3272
3395
|
}
|
|
3273
|
-
return /* @__PURE__ */
|
|
3274
|
-
return /* @__PURE__ */
|
|
3275
|
-
})), props.footer ? /* @__PURE__ */
|
|
3396
|
+
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) {
|
|
3397
|
+
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)));
|
|
3398
|
+
})), props.footer ? /* @__PURE__ */ React26.createElement("div", { className: "aura-nav__footer" }, props.footer) : null);
|
|
3276
3399
|
});
|
|
3277
|
-
|
|
3400
|
+
|
|
3401
|
+
// src/Breadcrumb.tsx
|
|
3402
|
+
var React27 = __toESM(require_react(), 1);
|
|
3403
|
+
var Breadcrumb = React27.forwardRef(function Breadcrumb2(props, ref) {
|
|
3278
3404
|
const t = useStrings();
|
|
3279
3405
|
const items = props.items || [];
|
|
3280
|
-
return /* @__PURE__ */
|
|
3406
|
+
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) {
|
|
3281
3407
|
const last = i === items.length - 1;
|
|
3282
|
-
return /* @__PURE__ */
|
|
3408
|
+
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" }));
|
|
3283
3409
|
})));
|
|
3284
3410
|
});
|
|
3411
|
+
|
|
3412
|
+
// src/Avatar.tsx
|
|
3413
|
+
var React28 = __toESM(require_react(), 1);
|
|
3285
3414
|
var AVATAR_TONES = ["progress", "ready", "neutral", "warning"];
|
|
3286
3415
|
function initials(name) {
|
|
3287
3416
|
const parts = String(name || "?").trim().split(/\s+/);
|
|
3288
3417
|
return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
|
|
3289
3418
|
}
|
|
3290
|
-
var Avatar =
|
|
3291
|
-
const size = props.size || "md", errState =
|
|
3419
|
+
var Avatar = React28.forwardRef(function Avatar2(props, ref) {
|
|
3420
|
+
const size = props.size || "md", errState = React28.useState(false);
|
|
3292
3421
|
let hash = 0;
|
|
3293
3422
|
String(props.name || "").split("").forEach(function(ch) {
|
|
3294
3423
|
hash = hash * 31 + ch.charCodeAt(0) >>> 0;
|
|
3295
3424
|
});
|
|
3296
3425
|
const tone2 = AVATAR_TONES[hash % AVATAR_TONES.length];
|
|
3297
|
-
return /* @__PURE__ */
|
|
3426
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3298
3427
|
"span",
|
|
3299
3428
|
{
|
|
3300
3429
|
ref,
|
|
@@ -3302,7 +3431,7 @@ window.Aura = (() => {
|
|
|
3302
3431
|
role: "img",
|
|
3303
3432
|
"aria-label": props.name + (props.status ? ", " + props.status : "")
|
|
3304
3433
|
},
|
|
3305
|
-
props.src && !errState[0] ? /* @__PURE__ */
|
|
3434
|
+
props.src && !errState[0] ? /* @__PURE__ */ React28.createElement(
|
|
3306
3435
|
"img",
|
|
3307
3436
|
{
|
|
3308
3437
|
src: props.src,
|
|
@@ -3311,18 +3440,20 @@ window.Aura = (() => {
|
|
|
3311
3440
|
errState[1](true);
|
|
3312
3441
|
}
|
|
3313
3442
|
}
|
|
3314
|
-
) : /* @__PURE__ */
|
|
3315
|
-
props.status === "online" ? /* @__PURE__ */
|
|
3443
|
+
) : /* @__PURE__ */ React28.createElement("span", { "aria-hidden": true }, initials(props.name)),
|
|
3444
|
+
props.status === "online" ? /* @__PURE__ */ React28.createElement("span", { className: "aura-avatar__status", "aria-hidden": true }) : null
|
|
3316
3445
|
);
|
|
3317
3446
|
});
|
|
3318
3447
|
|
|
3319
|
-
// src/
|
|
3320
|
-
var
|
|
3321
|
-
|
|
3448
|
+
// src/Stack.tsx
|
|
3449
|
+
var React30 = __toESM(require_react(), 1);
|
|
3450
|
+
|
|
3451
|
+
// src/responsive.tsx
|
|
3452
|
+
var React29 = __toESM(require_react(), 1);
|
|
3322
3453
|
var breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
3323
3454
|
var ORDER = ["base", "sm", "md", "lg", "xl"];
|
|
3324
3455
|
function useBreakpoint() {
|
|
3325
|
-
return
|
|
3456
|
+
return React29.useSyncExternalStore(subscribe, current, function() {
|
|
3326
3457
|
return "lg";
|
|
3327
3458
|
});
|
|
3328
3459
|
}
|
|
@@ -3360,7 +3491,10 @@ window.Aura = (() => {
|
|
|
3360
3491
|
var space = function(v) {
|
|
3361
3492
|
return typeof v === "number" ? "var(--aura-space-" + v + ")" : v;
|
|
3362
3493
|
};
|
|
3363
|
-
|
|
3494
|
+
|
|
3495
|
+
// src/Stack.tsx
|
|
3496
|
+
var h5 = React30.createElement;
|
|
3497
|
+
var Stack = React30.forwardRef(function Stack2(props, ref) {
|
|
3364
3498
|
const style = Object.assign(
|
|
3365
3499
|
{},
|
|
3366
3500
|
respVars("aura-stack-dir", props.direction || "column"),
|
|
@@ -3370,23 +3504,31 @@ window.Aura = (() => {
|
|
|
3370
3504
|
props.wrap ? { flexWrap: "wrap" } : null,
|
|
3371
3505
|
props.style
|
|
3372
3506
|
);
|
|
3373
|
-
return
|
|
3507
|
+
return h5(props.as || "div", { ref, className: cx("aura-stack", props.className), style }, props.children);
|
|
3374
3508
|
});
|
|
3375
|
-
|
|
3509
|
+
|
|
3510
|
+
// src/Grid.tsx
|
|
3511
|
+
var React31 = __toESM(require_react(), 1);
|
|
3512
|
+
var h6 = React31.createElement;
|
|
3513
|
+
var Grid = React31.forwardRef(function Grid2(props, ref) {
|
|
3376
3514
|
const style = Object.assign(
|
|
3377
3515
|
{},
|
|
3378
3516
|
respVars("aura-grid-gap", props.gap == null ? 6 : props.gap, space),
|
|
3379
3517
|
props.minItemWidth ? { gridTemplateColumns: "repeat(auto-fill, minmax(min(" + props.minItemWidth + "px, 100%), 1fr))" } : respVars("aura-grid-cols", props.columns || 1),
|
|
3380
3518
|
props.style
|
|
3381
3519
|
);
|
|
3382
|
-
return
|
|
3520
|
+
return h6(
|
|
3383
3521
|
props.as || "div",
|
|
3384
3522
|
{ ref, className: cx("aura-grid-layout", props.minItemWidth && "is-auto", props.className), style },
|
|
3385
3523
|
props.children
|
|
3386
3524
|
);
|
|
3387
3525
|
});
|
|
3388
|
-
|
|
3389
|
-
|
|
3526
|
+
|
|
3527
|
+
// src/Container.tsx
|
|
3528
|
+
var React32 = __toESM(require_react(), 1);
|
|
3529
|
+
var h7 = React32.createElement;
|
|
3530
|
+
var Container = React32.forwardRef(function Container2(props, ref) {
|
|
3531
|
+
return h7(
|
|
3390
3532
|
props.as || "div",
|
|
3391
3533
|
{
|
|
3392
3534
|
ref,
|
|
@@ -3396,26 +3538,29 @@ window.Aura = (() => {
|
|
|
3396
3538
|
props.children
|
|
3397
3539
|
);
|
|
3398
3540
|
});
|
|
3399
|
-
|
|
3541
|
+
|
|
3542
|
+
// src/AppShell.tsx
|
|
3543
|
+
var React33 = __toESM(require_react(), 1);
|
|
3544
|
+
var AppShell = React33.forwardRef(function AppShell2(props, ref) {
|
|
3400
3545
|
const t = useStrings();
|
|
3401
3546
|
const bp = useBreakpoint();
|
|
3402
3547
|
const compact = bp === "base" || bp === "sm" || bp === "md";
|
|
3403
|
-
const st =
|
|
3404
|
-
|
|
3548
|
+
const st = React33.useState(false), open = st[0], setOpen = st[1];
|
|
3549
|
+
React33.useEffect(
|
|
3405
3550
|
function() {
|
|
3406
3551
|
if (!compact) setOpen(false);
|
|
3407
3552
|
},
|
|
3408
3553
|
[compact]
|
|
3409
3554
|
);
|
|
3410
3555
|
const navEl = props.nav;
|
|
3411
|
-
const nav = props.nav &&
|
|
3556
|
+
const nav = props.nav && React33.isValidElement(props.nav) && compact ? React33.cloneElement(navEl, {
|
|
3412
3557
|
onChange: function(id) {
|
|
3413
3558
|
if (navEl.props.onChange) navEl.props.onChange(id);
|
|
3414
3559
|
setOpen(false);
|
|
3415
3560
|
},
|
|
3416
3561
|
className: cx(navEl.props.className, "is-in-drawer")
|
|
3417
3562
|
}) : props.nav;
|
|
3418
|
-
return /* @__PURE__ */
|
|
3563
|
+
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(
|
|
3419
3564
|
Drawer,
|
|
3420
3565
|
{
|
|
3421
3566
|
open,
|
|
@@ -3428,7 +3573,7 @@ window.Aura = (() => {
|
|
|
3428
3573
|
dismissible: true
|
|
3429
3574
|
},
|
|
3430
3575
|
nav
|
|
3431
|
-
) : null, /* @__PURE__ */
|
|
3576
|
+
) : null, /* @__PURE__ */ React33.createElement("div", { className: "aura-shell__main" }, props.header || compact ? /* @__PURE__ */ React33.createElement("header", { className: "aura-shell__bar" }, compact ? /* @__PURE__ */ React33.createElement(
|
|
3432
3577
|
IconButton,
|
|
3433
3578
|
{
|
|
3434
3579
|
icon: "menu",
|
|
@@ -3439,16 +3584,16 @@ window.Aura = (() => {
|
|
|
3439
3584
|
},
|
|
3440
3585
|
"aria-expanded": open
|
|
3441
3586
|
}
|
|
3442
|
-
) : null, /* @__PURE__ */
|
|
3587
|
+
) : 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)));
|
|
3443
3588
|
});
|
|
3444
3589
|
|
|
3445
3590
|
// src/Surface.tsx
|
|
3446
|
-
var
|
|
3447
|
-
var
|
|
3448
|
-
var Surface =
|
|
3591
|
+
var React34 = __toESM(require_react(), 1);
|
|
3592
|
+
var h8 = React34.createElement;
|
|
3593
|
+
var Surface = React34.forwardRef(function Surface2(props, ref) {
|
|
3449
3594
|
const t = props.texture || "mesh";
|
|
3450
3595
|
const rest = omit(props, ["texture", "className", "children", "as"]);
|
|
3451
|
-
return
|
|
3596
|
+
return h8(
|
|
3452
3597
|
props.as || "div",
|
|
3453
3598
|
Object.assign({}, rest, {
|
|
3454
3599
|
ref,
|
|
@@ -3466,14 +3611,14 @@ window.Aura = (() => {
|
|
|
3466
3611
|
});
|
|
3467
3612
|
|
|
3468
3613
|
// src/Stat.tsx
|
|
3469
|
-
var
|
|
3470
|
-
var Stat =
|
|
3614
|
+
var React35 = __toESM(require_react(), 1);
|
|
3615
|
+
var Stat = React35.forwardRef(function Stat2(props, ref) {
|
|
3471
3616
|
const ch = props.change;
|
|
3472
3617
|
const dir = ch && (ch.direction || "flat");
|
|
3473
3618
|
const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
|
|
3474
3619
|
const Tag3 = props.href ? "a" : props.onClick ? "button" : "div";
|
|
3475
3620
|
const interactive = Tag3 !== "div";
|
|
3476
|
-
return /* @__PURE__ */
|
|
3621
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3477
3622
|
Tag3,
|
|
3478
3623
|
{
|
|
3479
3624
|
ref,
|
|
@@ -3483,15 +3628,15 @@ window.Aura = (() => {
|
|
|
3483
3628
|
type: Tag3 === "button" ? "button" : void 0,
|
|
3484
3629
|
"aria-busy": props.loading || void 0
|
|
3485
3630
|
},
|
|
3486
|
-
/* @__PURE__ */
|
|
3487
|
-
props.loading ? /* @__PURE__ */
|
|
3488
|
-
ch && !props.loading || props.caption ? /* @__PURE__ */
|
|
3631
|
+
/* @__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),
|
|
3632
|
+
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),
|
|
3633
|
+
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
|
|
3489
3634
|
);
|
|
3490
3635
|
});
|
|
3491
3636
|
|
|
3492
3637
|
// src/TimePicker.tsx
|
|
3493
|
-
var
|
|
3494
|
-
var
|
|
3638
|
+
var React36 = __toESM(require_react(), 1);
|
|
3639
|
+
var import_react_dom7 = __toESM(require_react_dom(), 1);
|
|
3495
3640
|
function pad2(n2) {
|
|
3496
3641
|
return (n2 < 10 ? "0" : "") + n2;
|
|
3497
3642
|
}
|
|
@@ -3514,7 +3659,7 @@ window.Aura = (() => {
|
|
|
3514
3659
|
if (hh > 23 || mm > 59) return null;
|
|
3515
3660
|
return pad2(hh) + ":" + pad2(mm);
|
|
3516
3661
|
}
|
|
3517
|
-
var TimePicker =
|
|
3662
|
+
var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
3518
3663
|
const t = useStrings();
|
|
3519
3664
|
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
3520
3665
|
const st = useMaybeControlled(
|
|
@@ -3524,7 +3669,7 @@ window.Aura = (() => {
|
|
|
3524
3669
|
);
|
|
3525
3670
|
const value = st[0];
|
|
3526
3671
|
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;
|
|
3527
|
-
const slots =
|
|
3672
|
+
const slots = React36.useMemo(
|
|
3528
3673
|
function() {
|
|
3529
3674
|
const out = [];
|
|
3530
3675
|
for (let m = lo; m <= hi; m += step) out.push(fromMin(m));
|
|
@@ -3536,12 +3681,12 @@ window.Aura = (() => {
|
|
|
3536
3681
|
const n2 = toMin(v);
|
|
3537
3682
|
return n2 == null || n2 < lo || n2 > hi || props.isTimeDisabled && props.isTimeDisabled(v);
|
|
3538
3683
|
}
|
|
3539
|
-
const openState =
|
|
3540
|
-
const editState =
|
|
3541
|
-
const aState =
|
|
3542
|
-
const errState =
|
|
3543
|
-
const pos =
|
|
3544
|
-
const boxRef =
|
|
3684
|
+
const openState = React36.useState(false), open = openState[0], setOpen = openState[1];
|
|
3685
|
+
const editState = React36.useState(null), editing = editState[0], setEditing = editState[1];
|
|
3686
|
+
const aState = React36.useState(0), active = aState[0], setActive = aState[1];
|
|
3687
|
+
const errState = React36.useState(null);
|
|
3688
|
+
const pos = React36.useState(null);
|
|
3689
|
+
const boxRef = React36.useRef(null), inputRef = React36.useRef(null), listRef = React36.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
3545
3690
|
const mounted = useMounted();
|
|
3546
3691
|
function nearest(v) {
|
|
3547
3692
|
const n2 = toMin(v);
|
|
@@ -3569,7 +3714,7 @@ window.Aura = (() => {
|
|
|
3569
3714
|
},
|
|
3570
3715
|
[open]
|
|
3571
3716
|
);
|
|
3572
|
-
|
|
3717
|
+
React36.useEffect(
|
|
3573
3718
|
function() {
|
|
3574
3719
|
if (!open) return;
|
|
3575
3720
|
function outside(e) {
|
|
@@ -3591,7 +3736,7 @@ window.Aura = (() => {
|
|
|
3591
3736
|
},
|
|
3592
3737
|
[open]
|
|
3593
3738
|
);
|
|
3594
|
-
|
|
3739
|
+
React36.useEffect(
|
|
3595
3740
|
function() {
|
|
3596
3741
|
if (!open || !listRef.current) return;
|
|
3597
3742
|
const el = listRef.current.querySelector('[data-idx="' + active + '"]');
|
|
@@ -3688,10 +3833,10 @@ window.Aura = (() => {
|
|
|
3688
3833
|
}
|
|
3689
3834
|
}
|
|
3690
3835
|
const error = errState[0] || props.error;
|
|
3691
|
-
const list = open && mounted && pos[0] ? (0,
|
|
3692
|
-
/* @__PURE__ */
|
|
3836
|
+
const list = open && mounted && pos[0] ? (0, import_react_dom7.createPortal)(
|
|
3837
|
+
/* @__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) {
|
|
3693
3838
|
const dis = blocked(s), sel = s === value;
|
|
3694
|
-
return /* @__PURE__ */
|
|
3839
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3695
3840
|
"li",
|
|
3696
3841
|
{
|
|
3697
3842
|
key: s,
|
|
@@ -3716,13 +3861,13 @@ window.Aura = (() => {
|
|
|
3716
3861
|
if (active !== i) setActive(i);
|
|
3717
3862
|
}
|
|
3718
3863
|
},
|
|
3719
|
-
/* @__PURE__ */
|
|
3720
|
-
sel ? /* @__PURE__ */
|
|
3864
|
+
/* @__PURE__ */ React36.createElement("span", { className: "aura-combo__label" }, s),
|
|
3865
|
+
sel ? /* @__PURE__ */ React36.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
3721
3866
|
);
|
|
3722
3867
|
}))),
|
|
3723
3868
|
document.body
|
|
3724
3869
|
) : null;
|
|
3725
|
-
return /* @__PURE__ */
|
|
3870
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3726
3871
|
Field,
|
|
3727
3872
|
{
|
|
3728
3873
|
id,
|
|
@@ -3734,7 +3879,7 @@ window.Aura = (() => {
|
|
|
3734
3879
|
disabled: props.disabled,
|
|
3735
3880
|
className: props.className
|
|
3736
3881
|
},
|
|
3737
|
-
/* @__PURE__ */
|
|
3882
|
+
/* @__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(
|
|
3738
3883
|
"input",
|
|
3739
3884
|
{
|
|
3740
3885
|
ref: inputMerged,
|
|
@@ -3774,7 +3919,7 @@ window.Aura = (() => {
|
|
|
3774
3919
|
}, 0);
|
|
3775
3920
|
}
|
|
3776
3921
|
}
|
|
3777
|
-
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */
|
|
3922
|
+
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */ React36.createElement(
|
|
3778
3923
|
"button",
|
|
3779
3924
|
{
|
|
3780
3925
|
type: "button",
|
|
@@ -3787,8 +3932,8 @@ window.Aura = (() => {
|
|
|
3787
3932
|
if (inputRef.current) inputRef.current.focus();
|
|
3788
3933
|
}
|
|
3789
3934
|
},
|
|
3790
|
-
/* @__PURE__ */
|
|
3791
|
-
) : null, /* @__PURE__ */
|
|
3935
|
+
/* @__PURE__ */ React36.createElement(Icon, { name: "x" })
|
|
3936
|
+
) : null, /* @__PURE__ */ React36.createElement(
|
|
3792
3937
|
"button",
|
|
3793
3938
|
{
|
|
3794
3939
|
type: "button",
|
|
@@ -3806,14 +3951,14 @@ window.Aura = (() => {
|
|
|
3806
3951
|
}
|
|
3807
3952
|
}
|
|
3808
3953
|
},
|
|
3809
|
-
/* @__PURE__ */
|
|
3954
|
+
/* @__PURE__ */ React36.createElement(Icon, { name: "chevron-down" })
|
|
3810
3955
|
)),
|
|
3811
3956
|
list
|
|
3812
3957
|
);
|
|
3813
3958
|
});
|
|
3814
3959
|
|
|
3815
3960
|
// src/FileUpload.tsx
|
|
3816
|
-
var
|
|
3961
|
+
var React37 = __toESM(require_react(), 1);
|
|
3817
3962
|
function formatBytes(n2) {
|
|
3818
3963
|
if (n2 == null) return "";
|
|
3819
3964
|
if (n2 < 1024) return n2 + " B";
|
|
@@ -3847,17 +3992,17 @@ window.Aura = (() => {
|
|
|
3847
3992
|
}).join(", ");
|
|
3848
3993
|
}
|
|
3849
3994
|
var seq = 0;
|
|
3850
|
-
var FileUpload =
|
|
3995
|
+
var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
3851
3996
|
const t = useStrings();
|
|
3852
3997
|
const auto = uid(), id = props.id || auto;
|
|
3853
3998
|
const st = useMaybeControlled(props.value, props.defaultValue || [], props.onChange);
|
|
3854
3999
|
const items = st[0] || [];
|
|
3855
|
-
const dragState =
|
|
3856
|
-
const inputRef =
|
|
3857
|
-
const urls =
|
|
4000
|
+
const dragState = React37.useState(false), over = dragState[0];
|
|
4001
|
+
const inputRef = React37.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
4002
|
+
const urls = React37.useRef({});
|
|
3858
4003
|
const maxFiles = props.multiple ? props.maxFiles : 1;
|
|
3859
4004
|
const note = t.accepts(describeAccept(props.accept, t), props.maxSize ? formatBytes(props.maxSize) : "");
|
|
3860
|
-
|
|
4005
|
+
React37.useEffect(function() {
|
|
3861
4006
|
return function() {
|
|
3862
4007
|
Object.keys(urls.current).forEach(function(k) {
|
|
3863
4008
|
URL.revokeObjectURL(urls.current[k]);
|
|
@@ -3908,7 +4053,7 @@ window.Aura = (() => {
|
|
|
3908
4053
|
if (inputRef.current) inputRef.current.focus();
|
|
3909
4054
|
}
|
|
3910
4055
|
const error = props.error;
|
|
3911
|
-
return /* @__PURE__ */
|
|
4056
|
+
return /* @__PURE__ */ React37.createElement(
|
|
3912
4057
|
Field,
|
|
3913
4058
|
{
|
|
3914
4059
|
id,
|
|
@@ -3920,7 +4065,7 @@ window.Aura = (() => {
|
|
|
3920
4065
|
disabled: props.disabled,
|
|
3921
4066
|
className: props.className
|
|
3922
4067
|
},
|
|
3923
|
-
/* @__PURE__ */
|
|
4068
|
+
/* @__PURE__ */ React37.createElement(
|
|
3924
4069
|
"div",
|
|
3925
4070
|
{
|
|
3926
4071
|
className: cx("aura-upload", over && "is-over", props.disabled && "is-disabled", error && "is-invalid"),
|
|
@@ -3941,9 +4086,9 @@ window.Aura = (() => {
|
|
|
3941
4086
|
add(e.dataTransfer && e.dataTransfer.files);
|
|
3942
4087
|
}
|
|
3943
4088
|
},
|
|
3944
|
-
/* @__PURE__ */
|
|
3945
|
-
/* @__PURE__ */
|
|
3946
|
-
/* @__PURE__ */
|
|
4089
|
+
/* @__PURE__ */ React37.createElement(Icon, { name: "cloud-upload", size: "lg", className: "aura-upload__icon" }),
|
|
4090
|
+
/* @__PURE__ */ React37.createElement("span", { className: "aura-upload__text" }, t.dropFiles, " "),
|
|
4091
|
+
/* @__PURE__ */ React37.createElement(
|
|
3947
4092
|
"input",
|
|
3948
4093
|
{
|
|
3949
4094
|
ref: inputMerged,
|
|
@@ -3965,12 +4110,12 @@ window.Aura = (() => {
|
|
|
3965
4110
|
}
|
|
3966
4111
|
}
|
|
3967
4112
|
),
|
|
3968
|
-
/* @__PURE__ */
|
|
3969
|
-
note ? /* @__PURE__ */
|
|
4113
|
+
/* @__PURE__ */ React37.createElement("span", { className: "aura-upload__browse", "aria-hidden": true }, props.multiple ? t.browse : t.browseOne),
|
|
4114
|
+
note ? /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__note", id: id + "-note" }, note) : null
|
|
3970
4115
|
),
|
|
3971
|
-
items.length ? /* @__PURE__ */
|
|
4116
|
+
items.length ? /* @__PURE__ */ React37.createElement("ul", { className: "aura-upload__list", "aria-live": "polite" }, items.map(function(it) {
|
|
3972
4117
|
const src = thumb(it);
|
|
3973
|
-
return /* @__PURE__ */
|
|
4118
|
+
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(
|
|
3974
4119
|
"span",
|
|
3975
4120
|
{
|
|
3976
4121
|
className: "aura-upload__bar",
|
|
@@ -3980,8 +4125,8 @@ window.Aura = (() => {
|
|
|
3980
4125
|
"aria-valuemax": 100,
|
|
3981
4126
|
"aria-valuenow": it.progress != null ? Math.round(it.progress) : void 0
|
|
3982
4127
|
},
|
|
3983
|
-
/* @__PURE__ */
|
|
3984
|
-
) : null), /* @__PURE__ */
|
|
4128
|
+
/* @__PURE__ */ React37.createElement("span", { style: { width: (it.progress || 0) + "%" } })
|
|
4129
|
+
) : null), /* @__PURE__ */ React37.createElement(
|
|
3985
4130
|
IconButton,
|
|
3986
4131
|
{
|
|
3987
4132
|
icon: "x",
|
|
@@ -3997,14 +4142,14 @@ window.Aura = (() => {
|
|
|
3997
4142
|
|
|
3998
4143
|
// src/theme.ts
|
|
3999
4144
|
function hexToRgb(hex) {
|
|
4000
|
-
let
|
|
4001
|
-
if (
|
|
4002
|
-
|
|
4145
|
+
let h9 = String(hex).trim().replace("#", "");
|
|
4146
|
+
if (h9.length === 3)
|
|
4147
|
+
h9 = h9.split("").map(function(c) {
|
|
4003
4148
|
return c + c;
|
|
4004
4149
|
}).join("");
|
|
4005
|
-
if (!/^[0-9a-f]{6}$/i.test(
|
|
4150
|
+
if (!/^[0-9a-f]{6}$/i.test(h9)) throw new Error('createTheme: "' + hex + '" is not a #rgb or #rrggbb colour');
|
|
4006
4151
|
return [0, 2, 4].map(function(i) {
|
|
4007
|
-
return parseInt(
|
|
4152
|
+
return parseInt(h9.slice(i, i + 2), 16) / 255;
|
|
4008
4153
|
});
|
|
4009
4154
|
}
|
|
4010
4155
|
function rgbToHex(rgb) {
|
|
@@ -4231,9 +4376,9 @@ window.Aura = (() => {
|
|
|
4231
4376
|
}
|
|
4232
4377
|
|
|
4233
4378
|
// src/ThemeStyle.tsx
|
|
4234
|
-
var
|
|
4379
|
+
var React38 = __toESM(require_react(), 1);
|
|
4235
4380
|
function ThemeStyle(props) {
|
|
4236
|
-
const css =
|
|
4381
|
+
const css = React38.useMemo(
|
|
4237
4382
|
function() {
|
|
4238
4383
|
return createTheme({ brand: props.brand, signal: props.signal, primary: props.primary, name: props.name }).css(
|
|
4239
4384
|
props.selector
|
|
@@ -4241,11 +4386,11 @@ window.Aura = (() => {
|
|
|
4241
4386
|
},
|
|
4242
4387
|
[props.brand, props.signal, props.primary, props.name, props.selector]
|
|
4243
4388
|
);
|
|
4244
|
-
return /* @__PURE__ */
|
|
4389
|
+
return /* @__PURE__ */ React38.createElement("style", { "data-aura-theme": props.name || props.brand, dangerouslySetInnerHTML: { __html: css } });
|
|
4245
4390
|
}
|
|
4246
4391
|
|
|
4247
4392
|
// src/colorScheme.tsx
|
|
4248
|
-
var
|
|
4393
|
+
var React39 = __toESM(require_react(), 1);
|
|
4249
4394
|
var DEFAULT_KEY = "aura-color-scheme";
|
|
4250
4395
|
var SCHEMES = ["light", "dark", "system"];
|
|
4251
4396
|
var EVENT = "aura-color-scheme";
|
|
@@ -4258,7 +4403,7 @@ window.Aura = (() => {
|
|
|
4258
4403
|
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){}})();`;
|
|
4259
4404
|
}
|
|
4260
4405
|
function ColorSchemeScript(props) {
|
|
4261
|
-
return /* @__PURE__ */
|
|
4406
|
+
return /* @__PURE__ */ React39.createElement("script", { "data-aura-color-scheme": "", dangerouslySetInnerHTML: { __html: colorSchemeScript(props) } });
|
|
4262
4407
|
}
|
|
4263
4408
|
function systemDark() {
|
|
4264
4409
|
return typeof window !== "undefined" && !!window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -4276,7 +4421,7 @@ window.Aura = (() => {
|
|
|
4276
4421
|
function useColorScheme(options) {
|
|
4277
4422
|
const key = options && options.storageKey || DEFAULT_KEY;
|
|
4278
4423
|
const fallback = options && options.defaultScheme || "system";
|
|
4279
|
-
const subscribe2 =
|
|
4424
|
+
const subscribe2 = React39.useCallback(
|
|
4280
4425
|
function(cb) {
|
|
4281
4426
|
const mq = window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)") : null;
|
|
4282
4427
|
function onSystem() {
|
|
@@ -4294,7 +4439,7 @@ window.Aura = (() => {
|
|
|
4294
4439
|
},
|
|
4295
4440
|
[fallback]
|
|
4296
4441
|
);
|
|
4297
|
-
const snapshot =
|
|
4442
|
+
const snapshot = React39.useSyncExternalStore(
|
|
4298
4443
|
subscribe2,
|
|
4299
4444
|
function() {
|
|
4300
4445
|
const s = readScheme(fallback);
|
|
@@ -4305,7 +4450,7 @@ window.Aura = (() => {
|
|
|
4305
4450
|
}
|
|
4306
4451
|
);
|
|
4307
4452
|
const parts = snapshot.split("|");
|
|
4308
|
-
const setScheme =
|
|
4453
|
+
const setScheme = React39.useCallback(
|
|
4309
4454
|
function(next) {
|
|
4310
4455
|
if (!valid(next)) return;
|
|
4311
4456
|
try {
|
|
@@ -4324,11 +4469,11 @@ window.Aura = (() => {
|
|
|
4324
4469
|
const cs = useColorScheme(props);
|
|
4325
4470
|
const names = { light: t.schemeLight, dark: t.schemeDark, system: t.schemeSystem };
|
|
4326
4471
|
const label = props.label || t.colorScheme;
|
|
4327
|
-
return /* @__PURE__ */
|
|
4472
|
+
return /* @__PURE__ */ React39.createElement(
|
|
4328
4473
|
DropdownMenu,
|
|
4329
4474
|
{
|
|
4330
4475
|
label,
|
|
4331
|
-
trigger: /* @__PURE__ */
|
|
4476
|
+
trigger: /* @__PURE__ */ React39.createElement(IconButton, { icon: cs.resolved === "dark" ? "moon" : "sun", label: label + ": " + names[cs.scheme] }),
|
|
4332
4477
|
items: SCHEMES.map(function(s) {
|
|
4333
4478
|
return {
|
|
4334
4479
|
label: names[s],
|
|
@@ -4342,16 +4487,11 @@ window.Aura = (() => {
|
|
|
4342
4487
|
);
|
|
4343
4488
|
}
|
|
4344
4489
|
|
|
4345
|
-
// src/
|
|
4346
|
-
var
|
|
4347
|
-
var
|
|
4348
|
-
var TONES = ["neutral", "accent", "success", "warning", "danger"];
|
|
4349
|
-
function tone(t) {
|
|
4350
|
-
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
4351
|
-
}
|
|
4352
|
-
var Badge = React25.forwardRef(function Badge2(props, ref) {
|
|
4490
|
+
// src/Badge.tsx
|
|
4491
|
+
var React40 = __toESM(require_react(), 1);
|
|
4492
|
+
var Badge = React40.forwardRef(function Badge2(props, ref) {
|
|
4353
4493
|
const rest = omit(props, ["tone", "variant", "icon", "className", "children"]);
|
|
4354
|
-
return /* @__PURE__ */
|
|
4494
|
+
return /* @__PURE__ */ React40.createElement(
|
|
4355
4495
|
"span",
|
|
4356
4496
|
{
|
|
4357
4497
|
...rest,
|
|
@@ -4364,20 +4504,23 @@ window.Aura = (() => {
|
|
|
4364
4504
|
props.className
|
|
4365
4505
|
)
|
|
4366
4506
|
},
|
|
4367
|
-
props.icon ? /* @__PURE__ */
|
|
4507
|
+
props.icon ? /* @__PURE__ */ React40.createElement(Icon, { name: props.icon, size: 12 }) : null,
|
|
4368
4508
|
props.children
|
|
4369
4509
|
);
|
|
4370
4510
|
});
|
|
4371
|
-
|
|
4511
|
+
|
|
4512
|
+
// src/Tag.tsx
|
|
4513
|
+
var React41 = __toESM(require_react(), 1);
|
|
4514
|
+
var Tag = React41.forwardRef(function Tag2(props, ref) {
|
|
4372
4515
|
const t = useStrings();
|
|
4373
4516
|
const selectable = props.onClick != null || props.selected != null;
|
|
4374
4517
|
const rest = omit(props, ["onRemove", "selected", "icon", "className", "children", "disabled", "removeLabel"]);
|
|
4375
4518
|
const inner = [
|
|
4376
|
-
props.icon ? /* @__PURE__ */
|
|
4377
|
-
/* @__PURE__ */
|
|
4519
|
+
props.icon ? /* @__PURE__ */ React41.createElement(Icon, { key: "i", name: props.icon, size: 14 }) : null,
|
|
4520
|
+
/* @__PURE__ */ React41.createElement("span", { key: "t", className: "aura-tag__text" }, props.children)
|
|
4378
4521
|
];
|
|
4379
4522
|
if (selectable) {
|
|
4380
|
-
return /* @__PURE__ */
|
|
4523
|
+
return /* @__PURE__ */ React41.createElement(
|
|
4381
4524
|
"button",
|
|
4382
4525
|
{
|
|
4383
4526
|
...rest,
|
|
@@ -4387,11 +4530,11 @@ window.Aura = (() => {
|
|
|
4387
4530
|
disabled: props.disabled,
|
|
4388
4531
|
className: cx("aura-tag is-selectable", props.selected && "is-selected", props.className)
|
|
4389
4532
|
},
|
|
4390
|
-
props.selected ? /* @__PURE__ */
|
|
4533
|
+
props.selected ? /* @__PURE__ */ React41.createElement(Icon, { name: "check", size: 14 }) : inner[0],
|
|
4391
4534
|
inner[1]
|
|
4392
4535
|
);
|
|
4393
4536
|
}
|
|
4394
|
-
return /* @__PURE__ */
|
|
4537
|
+
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(
|
|
4395
4538
|
"button",
|
|
4396
4539
|
{
|
|
4397
4540
|
type: "button",
|
|
@@ -4399,15 +4542,18 @@ window.Aura = (() => {
|
|
|
4399
4542
|
"aria-label": props.removeLabel || t.remove(typeof props.children === "string" ? props.children : ""),
|
|
4400
4543
|
onClick: props.onRemove
|
|
4401
4544
|
},
|
|
4402
|
-
/* @__PURE__ */
|
|
4545
|
+
/* @__PURE__ */ React41.createElement(Icon, { name: "x", size: 12 })
|
|
4403
4546
|
) : null);
|
|
4404
4547
|
});
|
|
4405
|
-
|
|
4548
|
+
|
|
4549
|
+
// src/Progress.tsx
|
|
4550
|
+
var React42 = __toESM(require_react(), 1);
|
|
4551
|
+
var Progress = React42.forwardRef(function Progress2(props, ref) {
|
|
4406
4552
|
const auto = uid(), id = props.id || auto;
|
|
4407
4553
|
const max = props.max || 100, det = props.value != null;
|
|
4408
4554
|
const pct = det ? Math.max(0, Math.min(100, props.value / max * 100)) : 0;
|
|
4409
4555
|
const shown = props.valueLabel != null ? props.valueLabel : det ? Math.round(pct) + "%" : null;
|
|
4410
|
-
return /* @__PURE__ */
|
|
4556
|
+
return /* @__PURE__ */ React42.createElement(
|
|
4411
4557
|
"div",
|
|
4412
4558
|
{
|
|
4413
4559
|
ref,
|
|
@@ -4418,8 +4564,8 @@ window.Aura = (() => {
|
|
|
4418
4564
|
props.className
|
|
4419
4565
|
)
|
|
4420
4566
|
},
|
|
4421
|
-
props.label || props.showValue && shown ? /* @__PURE__ */
|
|
4422
|
-
/* @__PURE__ */
|
|
4567
|
+
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,
|
|
4568
|
+
/* @__PURE__ */ React42.createElement(
|
|
4423
4569
|
"div",
|
|
4424
4570
|
{
|
|
4425
4571
|
className: cx("aura-progress__track", !det && "is-indeterminate"),
|
|
@@ -4431,18 +4577,21 @@ window.Aura = (() => {
|
|
|
4431
4577
|
"aria-valuenow": det ? props.value : void 0,
|
|
4432
4578
|
"aria-valuetext": det && props.valueLabel != null ? String(props.valueLabel) : void 0
|
|
4433
4579
|
},
|
|
4434
|
-
/* @__PURE__ */
|
|
4580
|
+
/* @__PURE__ */ React42.createElement("span", { className: "aura-progress__bar", style: det ? { width: pct + "%" } : void 0 })
|
|
4435
4581
|
),
|
|
4436
|
-
props.hint ? /* @__PURE__ */
|
|
4582
|
+
props.hint ? /* @__PURE__ */ React42.createElement("p", { className: "aura-progress__hint" }, props.hint) : null
|
|
4437
4583
|
);
|
|
4438
4584
|
});
|
|
4439
|
-
|
|
4585
|
+
|
|
4586
|
+
// src/Skeleton.tsx
|
|
4587
|
+
var React43 = __toESM(require_react(), 1);
|
|
4588
|
+
var Skeleton = React43.forwardRef(function Skeleton2(props, ref) {
|
|
4440
4589
|
const v = props.variant || "text";
|
|
4441
4590
|
if (v === "text" && (props.lines || 1) > 1) {
|
|
4442
4591
|
const n2 = props.lines, rows = [];
|
|
4443
4592
|
for (let i = 0; i < n2; i++)
|
|
4444
|
-
rows.push(/* @__PURE__ */
|
|
4445
|
-
return /* @__PURE__ */
|
|
4593
|
+
rows.push(/* @__PURE__ */ React43.createElement("span", { key: i, className: "aura-skel aura-skel--text", style: { width: i === n2 - 1 ? "60%" : "100%" } }));
|
|
4594
|
+
return /* @__PURE__ */ React43.createElement(
|
|
4446
4595
|
"span",
|
|
4447
4596
|
{
|
|
4448
4597
|
ref,
|
|
@@ -4457,22 +4606,28 @@ window.Aura = (() => {
|
|
|
4457
4606
|
if (v === "circle") {
|
|
4458
4607
|
style.width = style.height = props.size || props.width || 40;
|
|
4459
4608
|
}
|
|
4460
|
-
return /* @__PURE__ */
|
|
4609
|
+
return /* @__PURE__ */ React43.createElement("span", { ref, "aria-hidden": true, className: cx("aura-skel", "aura-skel--" + v, props.className), style });
|
|
4461
4610
|
});
|
|
4462
|
-
|
|
4611
|
+
|
|
4612
|
+
// src/EmptyState.tsx
|
|
4613
|
+
var React44 = __toESM(require_react(), 1);
|
|
4614
|
+
var EmptyState = React44.forwardRef(function EmptyState2(props, ref) {
|
|
4463
4615
|
const HT = "h" + (props.headingLevel || 3);
|
|
4464
|
-
return /* @__PURE__ */
|
|
4616
|
+
return /* @__PURE__ */ React44.createElement(
|
|
4465
4617
|
"div",
|
|
4466
4618
|
{
|
|
4467
4619
|
ref,
|
|
4468
4620
|
className: cx("aura-empty", props.size === "sm" && "is-sm", props.bordered && "is-bordered", props.className)
|
|
4469
4621
|
},
|
|
4470
|
-
/* @__PURE__ */
|
|
4471
|
-
/* @__PURE__ */
|
|
4472
|
-
props.description ? /* @__PURE__ */
|
|
4473
|
-
props.action ? /* @__PURE__ */
|
|
4622
|
+
/* @__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" })),
|
|
4623
|
+
/* @__PURE__ */ React44.createElement(HT, { className: "aura-empty__title" }, props.title),
|
|
4624
|
+
props.description ? /* @__PURE__ */ React44.createElement("p", { className: "aura-empty__text" }, props.description) : null,
|
|
4625
|
+
props.action ? /* @__PURE__ */ React44.createElement("div", { className: "aura-empty__action" }, props.action) : null
|
|
4474
4626
|
);
|
|
4475
4627
|
});
|
|
4628
|
+
|
|
4629
|
+
// src/Pagination.tsx
|
|
4630
|
+
var React45 = __toESM(require_react(), 1);
|
|
4476
4631
|
function pageList(page, count, sib) {
|
|
4477
4632
|
let out = [], lo = Math.max(2, page - sib), hi = Math.min(count - 1, page + sib);
|
|
4478
4633
|
if (page - sib <= 3) {
|
|
@@ -4492,7 +4647,7 @@ window.Aura = (() => {
|
|
|
4492
4647
|
if (count > 1) out.push(count);
|
|
4493
4648
|
return out;
|
|
4494
4649
|
}
|
|
4495
|
-
var Pagination =
|
|
4650
|
+
var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
4496
4651
|
const t = useStrings();
|
|
4497
4652
|
const count = Math.max(1, props.pageCount || 1);
|
|
4498
4653
|
const st = useMaybeControlled(props.page, props.defaultPage || 1, props.onChange);
|
|
@@ -4510,7 +4665,7 @@ window.Aura = (() => {
|
|
|
4510
4665
|
},
|
|
4511
4666
|
extra
|
|
4512
4667
|
);
|
|
4513
|
-
return link ? /* @__PURE__ */
|
|
4668
|
+
return link ? /* @__PURE__ */ React45.createElement(
|
|
4514
4669
|
"a",
|
|
4515
4670
|
{
|
|
4516
4671
|
href: link(p),
|
|
@@ -4523,7 +4678,7 @@ window.Aura = (() => {
|
|
|
4523
4678
|
...common
|
|
4524
4679
|
},
|
|
4525
4680
|
label
|
|
4526
|
-
) : /* @__PURE__ */
|
|
4681
|
+
) : /* @__PURE__ */ React45.createElement(
|
|
4527
4682
|
"button",
|
|
4528
4683
|
{
|
|
4529
4684
|
type: "button",
|
|
@@ -4535,7 +4690,7 @@ window.Aura = (() => {
|
|
|
4535
4690
|
label
|
|
4536
4691
|
);
|
|
4537
4692
|
}
|
|
4538
|
-
return /* @__PURE__ */
|
|
4693
|
+
return /* @__PURE__ */ React45.createElement("nav", { ref, className: cx("aura-pagination", props.className), "aria-label": props.label || t.pagination }, /* @__PURE__ */ React45.createElement(
|
|
4539
4694
|
IconButton,
|
|
4540
4695
|
{
|
|
4541
4696
|
icon: "chevron-left",
|
|
@@ -4545,9 +4700,9 @@ window.Aura = (() => {
|
|
|
4545
4700
|
go(page - 1);
|
|
4546
4701
|
}
|
|
4547
4702
|
}
|
|
4548
|
-
), /* @__PURE__ */
|
|
4549
|
-
return typeof p === "number" ? /* @__PURE__ */
|
|
4550
|
-
})), /* @__PURE__ */
|
|
4703
|
+
), /* @__PURE__ */ React45.createElement("ol", { className: "aura-pagination__list" }, pageList(page, count, props.siblingCount == null ? 1 : props.siblingCount).map(function(p) {
|
|
4704
|
+
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");
|
|
4705
|
+
})), /* @__PURE__ */ React45.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)), /* @__PURE__ */ React45.createElement(
|
|
4551
4706
|
IconButton,
|
|
4552
4707
|
{
|
|
4553
4708
|
icon: "chevron-right",
|
|
@@ -4559,7 +4714,10 @@ window.Aura = (() => {
|
|
|
4559
4714
|
}
|
|
4560
4715
|
));
|
|
4561
4716
|
});
|
|
4562
|
-
|
|
4717
|
+
|
|
4718
|
+
// src/Accordion.tsx
|
|
4719
|
+
var React46 = __toESM(require_react(), 1);
|
|
4720
|
+
var Accordion = React46.forwardRef(function Accordion2(props, ref) {
|
|
4563
4721
|
const auto = uid(), base = props.id || auto;
|
|
4564
4722
|
const multiple = props.type === "multiple";
|
|
4565
4723
|
const st = useMaybeControlled(
|
|
@@ -4597,9 +4755,9 @@ window.Aura = (() => {
|
|
|
4597
4755
|
n2.focus();
|
|
4598
4756
|
}
|
|
4599
4757
|
}
|
|
4600
|
-
return /* @__PURE__ */
|
|
4758
|
+
return /* @__PURE__ */ React46.createElement("div", { ref, className: cx("aura-accordion", props.className), onKeyDown: onKey }, items.map(function(it) {
|
|
4601
4759
|
const on = open.indexOf(it.id) >= 0, bid = base + "-btn-" + it.id, pid = base + "-panel-" + it.id;
|
|
4602
|
-
return /* @__PURE__ */
|
|
4760
|
+
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(
|
|
4603
4761
|
"button",
|
|
4604
4762
|
{
|
|
4605
4763
|
type: "button",
|
|
@@ -4611,12 +4769,16 @@ window.Aura = (() => {
|
|
|
4611
4769
|
toggle(it.id);
|
|
4612
4770
|
}
|
|
4613
4771
|
},
|
|
4614
|
-
it.icon ? /* @__PURE__ */
|
|
4615
|
-
/* @__PURE__ */
|
|
4616
|
-
/* @__PURE__ */
|
|
4617
|
-
)), /* @__PURE__ */
|
|
4772
|
+
it.icon ? /* @__PURE__ */ React46.createElement(Icon, { name: it.icon, className: "aura-accordion__lead" }) : null,
|
|
4773
|
+
/* @__PURE__ */ React46.createElement("span", { className: "aura-accordion__title" }, it.title, it.description ? /* @__PURE__ */ React46.createElement("span", { className: "aura-accordion__desc" }, it.description) : null),
|
|
4774
|
+
/* @__PURE__ */ React46.createElement(Icon, { name: "chevron-down", className: "aura-accordion__chevron" })
|
|
4775
|
+
)), /* @__PURE__ */ React46.createElement("div", { id: pid, role: "region", "aria-labelledby": bid, className: "aura-accordion__panel", hidden: !on }, it.content));
|
|
4618
4776
|
}));
|
|
4619
4777
|
});
|
|
4778
|
+
|
|
4779
|
+
// src/Popover.tsx
|
|
4780
|
+
var React47 = __toESM(require_react(), 1);
|
|
4781
|
+
var import_react_dom8 = __toESM(require_react_dom(), 1);
|
|
4620
4782
|
function position(anchor, pop, placement) {
|
|
4621
4783
|
const r = anchor.getBoundingClientRect(), pw = pop.offsetWidth, ph = pop.offsetHeight, vw = window.innerWidth, vh = window.innerHeight, gap = 6;
|
|
4622
4784
|
let side = (placement || "bottom-start").split("-")[0], align = (placement || "bottom-start").split("-")[1] || "start";
|
|
@@ -4626,13 +4788,13 @@ window.Aura = (() => {
|
|
|
4626
4788
|
const left = align === "end" ? r.right - pw : align === "center" ? r.left + r.width / 2 - pw / 2 : r.left;
|
|
4627
4789
|
return { top: Math.max(8, top), left: Math.max(8, Math.min(left, vw - pw - 8)), side };
|
|
4628
4790
|
}
|
|
4629
|
-
var Popover =
|
|
4791
|
+
var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
4630
4792
|
const t = useStrings();
|
|
4631
4793
|
const auto = uid(), id = props.id || auto;
|
|
4632
4794
|
const st = useMaybeControlled(props.open, !!props.defaultOpen, props.onOpenChange);
|
|
4633
4795
|
const open = !!st[0];
|
|
4634
|
-
const wrap =
|
|
4635
|
-
const pos =
|
|
4796
|
+
const wrap = React47.useRef(null), pop = React47.useRef(null), popMerged = useMergedRef(ref, pop);
|
|
4797
|
+
const pos = React47.useState(null), mounted = useMounted();
|
|
4636
4798
|
function trigger() {
|
|
4637
4799
|
return wrap.current && (wrap.current.querySelector('button, [role="button"], a, input') || wrap.current.firstElementChild);
|
|
4638
4800
|
}
|
|
@@ -4659,7 +4821,7 @@ window.Aura = (() => {
|
|
|
4659
4821
|
},
|
|
4660
4822
|
[open, mounted, props.placement]
|
|
4661
4823
|
);
|
|
4662
|
-
|
|
4824
|
+
React47.useEffect(
|
|
4663
4825
|
function() {
|
|
4664
4826
|
if (!open || !mounted) return;
|
|
4665
4827
|
if (props.autoFocus !== false && pop.current) {
|
|
@@ -4678,9 +4840,9 @@ window.Aura = (() => {
|
|
|
4678
4840
|
},
|
|
4679
4841
|
[open, mounted]
|
|
4680
4842
|
);
|
|
4681
|
-
const child =
|
|
4682
|
-
const panel = open && mounted ? (0,
|
|
4683
|
-
/* @__PURE__ */
|
|
4843
|
+
const child = React47.Children.only(props.trigger);
|
|
4844
|
+
const panel = open && mounted ? (0, import_react_dom8.createPortal)(
|
|
4845
|
+
/* @__PURE__ */ React47.createElement(
|
|
4684
4846
|
"div",
|
|
4685
4847
|
{
|
|
4686
4848
|
ref: popMerged,
|
|
@@ -4702,7 +4864,7 @@ window.Aura = (() => {
|
|
|
4702
4864
|
} else trapTab(e, pop.current);
|
|
4703
4865
|
}
|
|
4704
4866
|
},
|
|
4705
|
-
props.title ? /* @__PURE__ */
|
|
4867
|
+
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(
|
|
4706
4868
|
IconButton,
|
|
4707
4869
|
{
|
|
4708
4870
|
icon: "x",
|
|
@@ -4712,7 +4874,7 @@ window.Aura = (() => {
|
|
|
4712
4874
|
}
|
|
4713
4875
|
}
|
|
4714
4876
|
)) : null,
|
|
4715
|
-
/* @__PURE__ */
|
|
4877
|
+
/* @__PURE__ */ React47.createElement("div", { className: "aura-popover__body" }, typeof props.children === "function" ? props.children({
|
|
4716
4878
|
close: function() {
|
|
4717
4879
|
close(true);
|
|
4718
4880
|
}
|
|
@@ -4720,7 +4882,7 @@ window.Aura = (() => {
|
|
|
4720
4882
|
),
|
|
4721
4883
|
document.body
|
|
4722
4884
|
) : null;
|
|
4723
|
-
return /* @__PURE__ */
|
|
4885
|
+
return /* @__PURE__ */ React47.createElement("span", { ref: wrap, className: "aura-popover-anchor" }, React47.cloneElement(child, {
|
|
4724
4886
|
onClick: function(e) {
|
|
4725
4887
|
if (child.props.onClick) child.props.onClick(e);
|
|
4726
4888
|
st[1](!open);
|
|
@@ -4730,5 +4892,323 @@ window.Aura = (() => {
|
|
|
4730
4892
|
"aria-controls": open ? id : void 0
|
|
4731
4893
|
}), panel);
|
|
4732
4894
|
});
|
|
4895
|
+
|
|
4896
|
+
// src/NumberField.tsx
|
|
4897
|
+
var React48 = __toESM(require_react(), 1);
|
|
4898
|
+
function decimalsOf(n2) {
|
|
4899
|
+
const s = String(n2);
|
|
4900
|
+
const i = s.indexOf(".");
|
|
4901
|
+
return i < 0 ? 0 : s.length - i - 1;
|
|
4902
|
+
}
|
|
4903
|
+
function parse(text) {
|
|
4904
|
+
const s = text.replace(/[,\s ]/g, "");
|
|
4905
|
+
if (!/^-?(\d+\.?\d*|\.\d+)$/.test(s)) return NaN;
|
|
4906
|
+
return Number(s);
|
|
4907
|
+
}
|
|
4908
|
+
var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
4909
|
+
const t = useStrings();
|
|
4910
|
+
const auto = uid(), id = props.id || auto;
|
|
4911
|
+
const step = props.step || 1;
|
|
4912
|
+
const decimals = props.decimals != null ? props.decimals : decimalsOf(step);
|
|
4913
|
+
const st = useMaybeControlled(
|
|
4914
|
+
props.value,
|
|
4915
|
+
props.defaultValue == null ? null : props.defaultValue,
|
|
4916
|
+
props.onChange
|
|
4917
|
+
);
|
|
4918
|
+
const value = st[0], setValue = st[1];
|
|
4919
|
+
const draftState = React48.useState(null), draft = draftState[0], setDraft = draftState[1];
|
|
4920
|
+
function fmt2(n2) {
|
|
4921
|
+
if (n2 == null || isNaN(n2)) return "";
|
|
4922
|
+
return n2.toLocaleString("en", { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
|
|
4923
|
+
}
|
|
4924
|
+
function fit2(n2) {
|
|
4925
|
+
let v = n2;
|
|
4926
|
+
if (props.min != null && v < props.min) v = props.min;
|
|
4927
|
+
if (props.max != null && v > props.max) v = props.max;
|
|
4928
|
+
const f = Math.pow(10, decimals);
|
|
4929
|
+
return Math.round(v * f) / f;
|
|
4930
|
+
}
|
|
4931
|
+
function nudge(by) {
|
|
4932
|
+
if (props.disabled || props.readOnly) return;
|
|
4933
|
+
const base = value == null ? props.min != null && props.min > 0 ? props.min - by : 0 : value;
|
|
4934
|
+
const next = fit2(base + by);
|
|
4935
|
+
setValue(next);
|
|
4936
|
+
setDraft(null);
|
|
4937
|
+
}
|
|
4938
|
+
function onKeyDown(e) {
|
|
4939
|
+
const k = e.key;
|
|
4940
|
+
let by = 0;
|
|
4941
|
+
if (k === "ArrowUp") by = step;
|
|
4942
|
+
else if (k === "ArrowDown") by = -step;
|
|
4943
|
+
else if (k === "PageUp") by = step * 10;
|
|
4944
|
+
else if (k === "PageDown") by = -step * 10;
|
|
4945
|
+
else if (k === "Home" && props.min != null) {
|
|
4946
|
+
e.preventDefault();
|
|
4947
|
+
setValue(props.min);
|
|
4948
|
+
setDraft(null);
|
|
4949
|
+
return;
|
|
4950
|
+
} else if (k === "End" && props.max != null) {
|
|
4951
|
+
e.preventDefault();
|
|
4952
|
+
setValue(props.max);
|
|
4953
|
+
setDraft(null);
|
|
4954
|
+
return;
|
|
4955
|
+
}
|
|
4956
|
+
if (by) {
|
|
4957
|
+
e.preventDefault();
|
|
4958
|
+
nudge(by);
|
|
4959
|
+
}
|
|
4960
|
+
}
|
|
4961
|
+
const atMin = value != null && props.min != null && value <= props.min;
|
|
4962
|
+
const atMax = value != null && props.max != null && value >= props.max;
|
|
4963
|
+
const affixText = function(x) {
|
|
4964
|
+
return typeof x === "string" || typeof x === "number" ? String(x) : "";
|
|
4965
|
+
};
|
|
4966
|
+
const valueText = value == null ? void 0 : [affixText(props.prefix), fmt2(value), affixText(props.suffix)].join(" ").trim();
|
|
4967
|
+
const stepper = props.stepper !== false && !props.readOnly;
|
|
4968
|
+
return /* @__PURE__ */ React48.createElement(
|
|
4969
|
+
Field,
|
|
4970
|
+
{
|
|
4971
|
+
id,
|
|
4972
|
+
label: props.label,
|
|
4973
|
+
hint: props.hint,
|
|
4974
|
+
error: props.error,
|
|
4975
|
+
required: props.required,
|
|
4976
|
+
optional: props.optional,
|
|
4977
|
+
disabled: props.disabled,
|
|
4978
|
+
className: props.className
|
|
4979
|
+
},
|
|
4980
|
+
/* @__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(
|
|
4981
|
+
"input",
|
|
4982
|
+
{
|
|
4983
|
+
ref,
|
|
4984
|
+
id,
|
|
4985
|
+
type: "text",
|
|
4986
|
+
role: "spinbutton",
|
|
4987
|
+
inputMode: decimals > 0 || props.min != null && props.min < 0 ? "decimal" : "numeric",
|
|
4988
|
+
autoComplete: "off",
|
|
4989
|
+
className: "aura-input__control",
|
|
4990
|
+
name: props.name,
|
|
4991
|
+
placeholder: props.placeholder,
|
|
4992
|
+
disabled: props.disabled,
|
|
4993
|
+
readOnly: props.readOnly,
|
|
4994
|
+
required: props.required,
|
|
4995
|
+
"aria-valuenow": value == null ? void 0 : value,
|
|
4996
|
+
"aria-valuemin": props.min,
|
|
4997
|
+
"aria-valuemax": props.max,
|
|
4998
|
+
"aria-valuetext": valueText,
|
|
4999
|
+
"aria-invalid": props.error ? true : void 0,
|
|
5000
|
+
"aria-describedby": describedBy(id, props),
|
|
5001
|
+
value: draft != null ? draft : fmt2(value),
|
|
5002
|
+
onFocus: function() {
|
|
5003
|
+
setDraft(fmt2(value));
|
|
5004
|
+
},
|
|
5005
|
+
onChange: function(e) {
|
|
5006
|
+
const text = e.target.value;
|
|
5007
|
+
setDraft(text);
|
|
5008
|
+
if (!text.trim()) setValue(null);
|
|
5009
|
+
else {
|
|
5010
|
+
const n2 = parse(text);
|
|
5011
|
+
if (!isNaN(n2)) setValue(n2);
|
|
5012
|
+
}
|
|
5013
|
+
},
|
|
5014
|
+
onBlur: function(e) {
|
|
5015
|
+
const n2 = draft == null ? value : !draft.trim() ? null : parse(draft);
|
|
5016
|
+
if (n2 == null) {
|
|
5017
|
+
if (value != null) setValue(null);
|
|
5018
|
+
} else if (!isNaN(n2)) {
|
|
5019
|
+
const f = fit2(n2);
|
|
5020
|
+
if (f !== value) setValue(f);
|
|
5021
|
+
}
|
|
5022
|
+
setDraft(null);
|
|
5023
|
+
if (props.onBlur) props.onBlur(e);
|
|
5024
|
+
},
|
|
5025
|
+
onKeyDown
|
|
5026
|
+
}
|
|
5027
|
+
), 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(
|
|
5028
|
+
"button",
|
|
5029
|
+
{
|
|
5030
|
+
type: "button",
|
|
5031
|
+
tabIndex: -1,
|
|
5032
|
+
className: "aura-number__step",
|
|
5033
|
+
"aria-label": t.decrease,
|
|
5034
|
+
"aria-controls": id,
|
|
5035
|
+
disabled: props.disabled || atMin,
|
|
5036
|
+
onPointerDown: function(e) {
|
|
5037
|
+
e.preventDefault();
|
|
5038
|
+
},
|
|
5039
|
+
onClick: function() {
|
|
5040
|
+
nudge(-step);
|
|
5041
|
+
}
|
|
5042
|
+
},
|
|
5043
|
+
/* @__PURE__ */ React48.createElement(Icon, { name: "minus" })
|
|
5044
|
+
), /* @__PURE__ */ React48.createElement(
|
|
5045
|
+
"button",
|
|
5046
|
+
{
|
|
5047
|
+
type: "button",
|
|
5048
|
+
tabIndex: -1,
|
|
5049
|
+
className: "aura-number__step",
|
|
5050
|
+
"aria-label": t.increase,
|
|
5051
|
+
"aria-controls": id,
|
|
5052
|
+
disabled: props.disabled || atMax,
|
|
5053
|
+
onPointerDown: function(e) {
|
|
5054
|
+
e.preventDefault();
|
|
5055
|
+
},
|
|
5056
|
+
onClick: function() {
|
|
5057
|
+
nudge(step);
|
|
5058
|
+
}
|
|
5059
|
+
},
|
|
5060
|
+
/* @__PURE__ */ React48.createElement(Icon, { name: "plus" })
|
|
5061
|
+
)) : null)
|
|
5062
|
+
);
|
|
5063
|
+
});
|
|
5064
|
+
|
|
5065
|
+
// src/Stepper.tsx
|
|
5066
|
+
var React49 = __toESM(require_react(), 1);
|
|
5067
|
+
var Stepper = React49.forwardRef(function Stepper2(props, ref) {
|
|
5068
|
+
const t = useStrings();
|
|
5069
|
+
const steps = props.steps || [];
|
|
5070
|
+
let at = -1;
|
|
5071
|
+
steps.forEach(function(s, i) {
|
|
5072
|
+
if (s.id === props.current) at = i;
|
|
5073
|
+
});
|
|
5074
|
+
if (at < 0) at = 0;
|
|
5075
|
+
const vertical = props.orientation === "vertical";
|
|
5076
|
+
const cur = steps[at];
|
|
5077
|
+
return /* @__PURE__ */ React49.createElement(
|
|
5078
|
+
"nav",
|
|
5079
|
+
{
|
|
5080
|
+
ref,
|
|
5081
|
+
"aria-label": props.label,
|
|
5082
|
+
className: cx("aura-stepper", vertical ? "aura-stepper--vertical" : "aura-stepper--horizontal", props.className)
|
|
5083
|
+
},
|
|
5084
|
+
/* @__PURE__ */ React49.createElement("ol", { className: "aura-stepper__list" }, steps.map(function(s, i) {
|
|
5085
|
+
const state = i < at ? "done" : i === at ? "current" : "upcoming";
|
|
5086
|
+
const marker = /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__marker", "aria-hidden": true }, state === "done" ? /* @__PURE__ */ React49.createElement(Icon, { name: "check" }) : i + 1);
|
|
5087
|
+
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);
|
|
5088
|
+
const clickable = state === "done" && !!props.onStepClick;
|
|
5089
|
+
return /* @__PURE__ */ React49.createElement(
|
|
5090
|
+
"li",
|
|
5091
|
+
{
|
|
5092
|
+
key: s.id,
|
|
5093
|
+
className: cx("aura-stepper__item", "is-" + state),
|
|
5094
|
+
"aria-current": state === "current" ? "step" : void 0
|
|
5095
|
+
},
|
|
5096
|
+
clickable ? /* @__PURE__ */ React49.createElement(
|
|
5097
|
+
"button",
|
|
5098
|
+
{
|
|
5099
|
+
type: "button",
|
|
5100
|
+
className: "aura-stepper__step aura-focusable",
|
|
5101
|
+
onClick: function() {
|
|
5102
|
+
props.onStepClick(s.id);
|
|
5103
|
+
}
|
|
5104
|
+
},
|
|
5105
|
+
marker,
|
|
5106
|
+
text
|
|
5107
|
+
) : /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__step" }, marker, text)
|
|
5108
|
+
);
|
|
5109
|
+
})),
|
|
5110
|
+
!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
|
|
5111
|
+
);
|
|
5112
|
+
});
|
|
5113
|
+
|
|
5114
|
+
// src/SegmentedControl.tsx
|
|
5115
|
+
var React50 = __toESM(require_react(), 1);
|
|
5116
|
+
function toOpt2(o) {
|
|
5117
|
+
return typeof o === "object" ? o : { value: o, label: o };
|
|
5118
|
+
}
|
|
5119
|
+
var SegmentedControl = React50.forwardRef(
|
|
5120
|
+
function SegmentedControl2(props, ref) {
|
|
5121
|
+
const options = (props.options || []).map(toOpt2);
|
|
5122
|
+
const firstEnabled = options.filter(function(o) {
|
|
5123
|
+
return !o.disabled;
|
|
5124
|
+
})[0];
|
|
5125
|
+
const st = useMaybeControlled(
|
|
5126
|
+
props.value,
|
|
5127
|
+
props.defaultValue != null ? props.defaultValue : firstEnabled ? firstEnabled.value : void 0,
|
|
5128
|
+
props.onChange
|
|
5129
|
+
);
|
|
5130
|
+
const value = st[0], setValue = st[1];
|
|
5131
|
+
const auto = uid(), id = props.id || auto;
|
|
5132
|
+
const refs = React50.useRef([]);
|
|
5133
|
+
const selIdx = options.findIndex(function(o) {
|
|
5134
|
+
return o.value === value;
|
|
5135
|
+
});
|
|
5136
|
+
const tabIdx = selIdx >= 0 && !options[selIdx].disabled ? selIdx : options.indexOf(firstEnabled);
|
|
5137
|
+
function move(from, dir) {
|
|
5138
|
+
const n2 = options.length;
|
|
5139
|
+
for (let k = 1; k <= n2; k++) {
|
|
5140
|
+
const i = ((from + dir * k) % n2 + n2) % n2;
|
|
5141
|
+
if (!options[i].disabled) {
|
|
5142
|
+
setValue(options[i].value);
|
|
5143
|
+
const el = refs.current[i];
|
|
5144
|
+
if (el) el.focus();
|
|
5145
|
+
return;
|
|
5146
|
+
}
|
|
5147
|
+
}
|
|
5148
|
+
}
|
|
5149
|
+
function onKeyDown(e, i) {
|
|
5150
|
+
const k = e.key;
|
|
5151
|
+
if (k === "ArrowRight" || k === "ArrowDown") {
|
|
5152
|
+
e.preventDefault();
|
|
5153
|
+
move(i, 1);
|
|
5154
|
+
} else if (k === "ArrowLeft" || k === "ArrowUp") {
|
|
5155
|
+
e.preventDefault();
|
|
5156
|
+
move(i, -1);
|
|
5157
|
+
} else if (k === "Home") {
|
|
5158
|
+
e.preventDefault();
|
|
5159
|
+
move(-1, 1);
|
|
5160
|
+
} else if (k === "End") {
|
|
5161
|
+
e.preventDefault();
|
|
5162
|
+
move(options.length, -1);
|
|
5163
|
+
}
|
|
5164
|
+
}
|
|
5165
|
+
return /* @__PURE__ */ React50.createElement(
|
|
5166
|
+
"div",
|
|
5167
|
+
{
|
|
5168
|
+
ref,
|
|
5169
|
+
id,
|
|
5170
|
+
role: "radiogroup",
|
|
5171
|
+
"aria-label": props.label,
|
|
5172
|
+
"aria-disabled": props.disabled || void 0,
|
|
5173
|
+
className: cx(
|
|
5174
|
+
"aura-segmented",
|
|
5175
|
+
props.size === "sm" && "aura-segmented--sm",
|
|
5176
|
+
props.fullWidth && "is-full",
|
|
5177
|
+
props.disabled && "is-disabled",
|
|
5178
|
+
props.className
|
|
5179
|
+
)
|
|
5180
|
+
},
|
|
5181
|
+
options.map(function(o, i) {
|
|
5182
|
+
const on = o.value === value;
|
|
5183
|
+
const off = props.disabled || o.disabled;
|
|
5184
|
+
return /* @__PURE__ */ React50.createElement(
|
|
5185
|
+
"button",
|
|
5186
|
+
{
|
|
5187
|
+
key: o.value,
|
|
5188
|
+
ref: function(el) {
|
|
5189
|
+
refs.current[i] = el;
|
|
5190
|
+
},
|
|
5191
|
+
type: "button",
|
|
5192
|
+
role: "radio",
|
|
5193
|
+
"aria-checked": on,
|
|
5194
|
+
"aria-label": o.iconOnly ? o.label : void 0,
|
|
5195
|
+
title: o.iconOnly ? o.label : void 0,
|
|
5196
|
+
tabIndex: i === tabIdx && !props.disabled ? 0 : -1,
|
|
5197
|
+
disabled: off,
|
|
5198
|
+
className: cx("aura-segmented__option", on && "is-selected", o.iconOnly && "is-icon"),
|
|
5199
|
+
onClick: function() {
|
|
5200
|
+
setValue(o.value);
|
|
5201
|
+
},
|
|
5202
|
+
onKeyDown: function(e) {
|
|
5203
|
+
onKeyDown(e, i);
|
|
5204
|
+
}
|
|
5205
|
+
},
|
|
5206
|
+
o.icon ? /* @__PURE__ */ React50.createElement(Icon, { name: o.icon }) : null,
|
|
5207
|
+
o.iconOnly ? null : /* @__PURE__ */ React50.createElement("span", null, o.label)
|
|
5208
|
+
);
|
|
5209
|
+
})
|
|
5210
|
+
);
|
|
5211
|
+
}
|
|
5212
|
+
);
|
|
4733
5213
|
return __toCommonJS(index_exports);
|
|
4734
5214
|
})();
|