@jirawatpyk/aura-react 4.7.2 → 4.8.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 +1 -1
- package/dist/aura.bundle.js +451 -379
- package/dist/cjs/index.cjs +451 -379
- 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 +1 -1
- 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/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/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/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 +27 -5
- package/dist/esm/internal.js +5 -0
- package/dist/esm/responsive.js +50 -0
- package/dist/index.d.ts +8 -8
- package/package.json +1 -1
- package/dist/esm/extra.js +0 -412
- package/dist/esm/feedback.js +0 -220
- package/dist/esm/forms.js +0 -212
- package/dist/esm/layout.js +0 -183
- package/dist/esm/layout2.js +0 -138
- /package/dist/esm/{overlay.js → useModal.js} +0 -0
package/dist/cjs/index.cjs
CHANGED
|
@@ -185,6 +185,10 @@ function useMergedRef(a, b) {
|
|
|
185
185
|
[a, b]
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
|
+
var TONES = ["neutral", "accent", "success", "warning", "danger"];
|
|
189
|
+
function tone(t) {
|
|
190
|
+
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
191
|
+
}
|
|
188
192
|
|
|
189
193
|
// src/Icon.tsx
|
|
190
194
|
var h = React2.createElement;
|
|
@@ -514,7 +518,7 @@ var StatusPill = React8.forwardRef(function StatusPill2(props, ref) {
|
|
|
514
518
|
return /* @__PURE__ */ React8.createElement("span", { ref, className: cx("aura-pill", "aura-pill--" + tone2, props.className) }, /* @__PURE__ */ React8.createElement(Icon, { name: TONE_ICON[tone2] || "circle", size: 12 }), props.children);
|
|
515
519
|
});
|
|
516
520
|
|
|
517
|
-
// src/
|
|
521
|
+
// src/Field.tsx
|
|
518
522
|
var React10 = __toESM(require("react"), 1);
|
|
519
523
|
|
|
520
524
|
// src/locale.tsx
|
|
@@ -730,7 +734,7 @@ function useStrings() {
|
|
|
730
734
|
return useAuraLocale().strings;
|
|
731
735
|
}
|
|
732
736
|
|
|
733
|
-
// src/
|
|
737
|
+
// src/Field.tsx
|
|
734
738
|
var h2 = React10.createElement;
|
|
735
739
|
var Field = React10.forwardRef(function Field2(props, ref) {
|
|
736
740
|
const t = useStrings();
|
|
@@ -767,10 +771,13 @@ var FIELD_KEYS = [
|
|
|
767
771
|
"options",
|
|
768
772
|
"placeholder"
|
|
769
773
|
];
|
|
770
|
-
|
|
774
|
+
|
|
775
|
+
// src/TextField.tsx
|
|
776
|
+
var React11 = __toESM(require("react"), 1);
|
|
777
|
+
var TextField = React11.forwardRef(function TextField2(props, ref) {
|
|
771
778
|
const auto = uid(), id = props.id || auto;
|
|
772
779
|
const rest = omit(props, FIELD_KEYS);
|
|
773
|
-
return /* @__PURE__ */
|
|
780
|
+
return /* @__PURE__ */ React11.createElement(
|
|
774
781
|
Field,
|
|
775
782
|
{
|
|
776
783
|
id,
|
|
@@ -782,7 +789,7 @@ var TextField = React10.forwardRef(function TextField2(props, ref) {
|
|
|
782
789
|
disabled: props.disabled,
|
|
783
790
|
className: props.className
|
|
784
791
|
},
|
|
785
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ React11.createElement("div", { className: cx("aura-input", props.icon && "has-icon", props.suffix && "has-suffix") }, props.icon ? /* @__PURE__ */ React11.createElement(Icon, { name: props.icon, className: "aura-input__icon" }) : null, /* @__PURE__ */ React11.createElement(
|
|
786
793
|
"input",
|
|
787
794
|
{
|
|
788
795
|
type: "text",
|
|
@@ -795,13 +802,16 @@ var TextField = React10.forwardRef(function TextField2(props, ref) {
|
|
|
795
802
|
"aria-invalid": props.error ? true : void 0,
|
|
796
803
|
"aria-describedby": describedBy(id, props)
|
|
797
804
|
}
|
|
798
|
-
), props.suffix ? /* @__PURE__ */
|
|
805
|
+
), props.suffix ? /* @__PURE__ */ React11.createElement("span", { className: "aura-input__suffix" }, props.suffix) : null)
|
|
799
806
|
);
|
|
800
807
|
});
|
|
801
|
-
|
|
808
|
+
|
|
809
|
+
// src/Textarea.tsx
|
|
810
|
+
var React12 = __toESM(require("react"), 1);
|
|
811
|
+
var Textarea = React12.forwardRef(function Textarea2(props, ref) {
|
|
802
812
|
const auto = uid(), id = props.id || auto;
|
|
803
813
|
const rest = omit(props, FIELD_KEYS);
|
|
804
|
-
return /* @__PURE__ */
|
|
814
|
+
return /* @__PURE__ */ React12.createElement(
|
|
805
815
|
Field,
|
|
806
816
|
{
|
|
807
817
|
id,
|
|
@@ -813,7 +823,7 @@ var Textarea = React10.forwardRef(function Textarea2(props, ref) {
|
|
|
813
823
|
disabled: props.disabled,
|
|
814
824
|
className: props.className
|
|
815
825
|
},
|
|
816
|
-
/* @__PURE__ */
|
|
826
|
+
/* @__PURE__ */ React12.createElement(
|
|
817
827
|
"textarea",
|
|
818
828
|
{
|
|
819
829
|
rows: 4,
|
|
@@ -829,19 +839,23 @@ var Textarea = React10.forwardRef(function Textarea2(props, ref) {
|
|
|
829
839
|
)
|
|
830
840
|
);
|
|
831
841
|
});
|
|
832
|
-
|
|
842
|
+
|
|
843
|
+
// src/Select.tsx
|
|
844
|
+
var React13 = __toESM(require("react"), 1);
|
|
845
|
+
var h3 = React13.createElement;
|
|
846
|
+
var Select = React13.forwardRef(function Select2(props, ref) {
|
|
833
847
|
const auto = uid(), id = props.id || auto;
|
|
834
848
|
const rest = omit(props, FIELD_KEYS.concat(["children"]));
|
|
835
849
|
const opts = (props.options || []).map(function(o) {
|
|
836
850
|
const v = typeof o === "object" ? o : { value: o, label: o };
|
|
837
|
-
return /* @__PURE__ */
|
|
851
|
+
return /* @__PURE__ */ React13.createElement("option", { key: v.value, value: v.value, disabled: v.disabled }, v.label);
|
|
838
852
|
});
|
|
839
853
|
if (props.placeholder)
|
|
840
854
|
opts.unshift(
|
|
841
|
-
/* @__PURE__ */
|
|
855
|
+
/* @__PURE__ */ React13.createElement("option", { key: "__ph", value: "", disabled: true }, props.placeholder)
|
|
842
856
|
);
|
|
843
857
|
const extra = props.value === void 0 && props.defaultValue === void 0 && props.placeholder ? { defaultValue: "" } : {};
|
|
844
|
-
return /* @__PURE__ */
|
|
858
|
+
return /* @__PURE__ */ React13.createElement(
|
|
845
859
|
Field,
|
|
846
860
|
{
|
|
847
861
|
id,
|
|
@@ -853,7 +867,7 @@ var Select = React10.forwardRef(function Select2(props, ref) {
|
|
|
853
867
|
disabled: props.disabled,
|
|
854
868
|
className: props.className
|
|
855
869
|
},
|
|
856
|
-
/* @__PURE__ */
|
|
870
|
+
/* @__PURE__ */ React13.createElement("div", { className: cx("aura-input aura-select", props.icon && "has-icon") }, props.icon ? /* @__PURE__ */ React13.createElement(Icon, { name: props.icon, className: "aura-input__icon" }) : null, h3(
|
|
857
871
|
"select",
|
|
858
872
|
Object.assign(extra, rest, {
|
|
859
873
|
ref,
|
|
@@ -865,10 +879,13 @@ var Select = React10.forwardRef(function Select2(props, ref) {
|
|
|
865
879
|
}),
|
|
866
880
|
opts,
|
|
867
881
|
props.children
|
|
868
|
-
), /* @__PURE__ */
|
|
882
|
+
), /* @__PURE__ */ React13.createElement(Icon, { name: "chevron-down", className: "aura-select__chevron" }))
|
|
869
883
|
);
|
|
870
884
|
});
|
|
871
|
-
|
|
885
|
+
|
|
886
|
+
// src/RadioGroup.tsx
|
|
887
|
+
var React14 = __toESM(require("react"), 1);
|
|
888
|
+
var RadioGroup = React14.forwardRef(function RadioGroup2(props, ref) {
|
|
872
889
|
const auto = uid(), id = props.id || auto;
|
|
873
890
|
const st = useMaybeControlled(
|
|
874
891
|
props.value,
|
|
@@ -876,7 +893,7 @@ var RadioGroup = React10.forwardRef(function RadioGroup2(props, ref) {
|
|
|
876
893
|
props.onChange
|
|
877
894
|
);
|
|
878
895
|
const name = props.name || id;
|
|
879
|
-
return /* @__PURE__ */
|
|
896
|
+
return /* @__PURE__ */ React14.createElement(
|
|
880
897
|
"fieldset",
|
|
881
898
|
{
|
|
882
899
|
ref,
|
|
@@ -885,10 +902,10 @@ var RadioGroup = React10.forwardRef(function RadioGroup2(props, ref) {
|
|
|
885
902
|
"aria-invalid": props.error ? true : void 0,
|
|
886
903
|
disabled: props.disabled
|
|
887
904
|
},
|
|
888
|
-
props.label ? /* @__PURE__ */
|
|
889
|
-
/* @__PURE__ */
|
|
905
|
+
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,
|
|
906
|
+
/* @__PURE__ */ React14.createElement("div", { className: cx("aura-radio-group__list", props.orientation === "horizontal" && "is-horizontal") }, (props.options || []).map(function(o) {
|
|
890
907
|
const v = typeof o === "object" ? o : { value: o, label: o };
|
|
891
|
-
return /* @__PURE__ */
|
|
908
|
+
return /* @__PURE__ */ React14.createElement("label", { key: v.value, className: cx("aura-choice", v.disabled && "is-disabled") }, /* @__PURE__ */ React14.createElement(
|
|
892
909
|
"input",
|
|
893
910
|
{
|
|
894
911
|
type: "radio",
|
|
@@ -901,16 +918,19 @@ var RadioGroup = React10.forwardRef(function RadioGroup2(props, ref) {
|
|
|
901
918
|
st[1](v.value);
|
|
902
919
|
}
|
|
903
920
|
}
|
|
904
|
-
), /* @__PURE__ */
|
|
921
|
+
), /* @__PURE__ */ React14.createElement("span", { className: "aura-choice__text" }, /* @__PURE__ */ React14.createElement("span", { className: "aura-choice__label" }, v.label), v.description ? /* @__PURE__ */ React14.createElement("span", { className: "aura-choice__desc" }, v.description) : null));
|
|
905
922
|
})),
|
|
906
|
-
props.error ? /* @__PURE__ */
|
|
923
|
+
props.error ? /* @__PURE__ */ React14.createElement("p", { className: "aura-field__error", id: id + "-error" }, /* @__PURE__ */ React14.createElement(Icon, { name: "circle-alert", size: 14 }), props.error) : props.hint ? /* @__PURE__ */ React14.createElement("p", { className: "aura-field__hint", id: id + "-hint" }, props.hint) : null
|
|
907
924
|
);
|
|
908
925
|
});
|
|
909
|
-
|
|
926
|
+
|
|
927
|
+
// src/Switch.tsx
|
|
928
|
+
var React15 = __toESM(require("react"), 1);
|
|
929
|
+
var Switch = React15.forwardRef(function Switch2(props, ref) {
|
|
910
930
|
const auto = uid(), id = props.id || auto;
|
|
911
931
|
const st = useMaybeControlled(props.checked, !!props.defaultChecked, props.onChange);
|
|
912
932
|
const on = !!st[0];
|
|
913
|
-
return /* @__PURE__ */
|
|
933
|
+
return /* @__PURE__ */ React15.createElement("div", { className: cx("aura-switch-row", props.disabled && "is-disabled", props.className) }, /* @__PURE__ */ React15.createElement(
|
|
914
934
|
"button",
|
|
915
935
|
{
|
|
916
936
|
ref,
|
|
@@ -927,12 +947,12 @@ var Switch = React10.forwardRef(function Switch2(props, ref) {
|
|
|
927
947
|
st[1](!on);
|
|
928
948
|
}
|
|
929
949
|
},
|
|
930
|
-
/* @__PURE__ */
|
|
931
|
-
), props.label ? /* @__PURE__ */
|
|
950
|
+
/* @__PURE__ */ React15.createElement("span", { className: "aura-switch__thumb" })
|
|
951
|
+
), props.label ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__text" }, /* @__PURE__ */ React15.createElement("label", { className: "aura-choice__label", id: id + "-label", htmlFor: id }, props.label), props.description ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__desc", id: id + "-desc" }, props.description) : null) : null);
|
|
932
952
|
});
|
|
933
953
|
|
|
934
954
|
// src/Combobox.tsx
|
|
935
|
-
var
|
|
955
|
+
var React16 = __toESM(require("react"), 1);
|
|
936
956
|
var import_react_dom2 = require("react-dom");
|
|
937
957
|
function norm(s) {
|
|
938
958
|
return String(s == null ? "" : s).normalize("NFC").toLocaleLowerCase("th");
|
|
@@ -947,7 +967,7 @@ function defaultFilter(option, query) {
|
|
|
947
967
|
return norm(k).indexOf(q) >= 0;
|
|
948
968
|
});
|
|
949
969
|
}
|
|
950
|
-
var Combobox =
|
|
970
|
+
var Combobox = React16.forwardRef(function Combobox2(props, ref) {
|
|
951
971
|
const t = useStrings();
|
|
952
972
|
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
953
973
|
const options = (props.options || []).map(toOpt);
|
|
@@ -960,11 +980,11 @@ var Combobox = React11.forwardRef(function Combobox2(props, ref) {
|
|
|
960
980
|
const selected = options.filter(function(o) {
|
|
961
981
|
return o.value === value;
|
|
962
982
|
})[0] || null;
|
|
963
|
-
const openState =
|
|
964
|
-
const qState =
|
|
965
|
-
const aState =
|
|
966
|
-
const posState =
|
|
967
|
-
const inputRef =
|
|
983
|
+
const openState = React16.useState(false), open = openState[0], setOpen = openState[1];
|
|
984
|
+
const qState = React16.useState(null), query = qState[0], setQuery = qState[1];
|
|
985
|
+
const aState = React16.useState(0), active = aState[0], setActive = aState[1];
|
|
986
|
+
const posState = React16.useState(null);
|
|
987
|
+
const inputRef = React16.useRef(null), inputMerged = useMergedRef(ref, inputRef), boxRef = React16.useRef(null), listRef = React16.useRef(null);
|
|
968
988
|
const mounted = useMounted();
|
|
969
989
|
const limit = props.limit || 200;
|
|
970
990
|
const filter = props.filter || defaultFilter;
|
|
@@ -992,7 +1012,7 @@ var Combobox = React11.forwardRef(function Combobox2(props, ref) {
|
|
|
992
1012
|
},
|
|
993
1013
|
[open, shown.length]
|
|
994
1014
|
);
|
|
995
|
-
|
|
1015
|
+
React16.useEffect(
|
|
996
1016
|
function() {
|
|
997
1017
|
if (!open) return;
|
|
998
1018
|
function outside(e) {
|
|
@@ -1014,7 +1034,7 @@ var Combobox = React11.forwardRef(function Combobox2(props, ref) {
|
|
|
1014
1034
|
},
|
|
1015
1035
|
[open]
|
|
1016
1036
|
);
|
|
1017
|
-
|
|
1037
|
+
React16.useEffect(
|
|
1018
1038
|
function() {
|
|
1019
1039
|
if (!open || !listRef.current) return;
|
|
1020
1040
|
const el = listRef.current.querySelector('[data-idx="' + activeIdx + '"]');
|
|
@@ -1078,9 +1098,9 @@ var Combobox = React11.forwardRef(function Combobox2(props, ref) {
|
|
|
1078
1098
|
return id + "-opt-" + i;
|
|
1079
1099
|
};
|
|
1080
1100
|
const list = open && mounted && posState[0] ? (0, import_react_dom2.createPortal)(
|
|
1081
|
-
/* @__PURE__ */
|
|
1101
|
+
/* @__PURE__ */ React16.createElement("div", { ref: listRef, className: "aura-combo__popover", style: posState[0] }, /* @__PURE__ */ React16.createElement("ul", { id: listId, role: "listbox", "aria-label": props.label, className: "aura-combo__list" }, 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) {
|
|
1082
1102
|
const isSel = selected && o.value === selected.value;
|
|
1083
|
-
return /* @__PURE__ */
|
|
1103
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1084
1104
|
"li",
|
|
1085
1105
|
{
|
|
1086
1106
|
key: o.value,
|
|
@@ -1105,14 +1125,14 @@ var Combobox = React11.forwardRef(function Combobox2(props, ref) {
|
|
|
1105
1125
|
if (activeIdx !== i) setActive(i);
|
|
1106
1126
|
}
|
|
1107
1127
|
},
|
|
1108
|
-
o.icon ? /* @__PURE__ */
|
|
1109
|
-
/* @__PURE__ */
|
|
1110
|
-
isSel ? /* @__PURE__ */
|
|
1128
|
+
o.icon ? /* @__PURE__ */ React16.createElement(Icon, { name: o.icon }) : null,
|
|
1129
|
+
/* @__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),
|
|
1130
|
+
isSel ? /* @__PURE__ */ React16.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
1111
1131
|
);
|
|
1112
|
-
}), more && !props.loading ? /* @__PURE__ */
|
|
1132
|
+
}), more && !props.loading ? /* @__PURE__ */ React16.createElement("li", { className: "aura-combo__note", role: "presentation" }, t.keepTyping((props.options || []).length)) : null)),
|
|
1113
1133
|
document.body
|
|
1114
1134
|
) : null;
|
|
1115
|
-
return /* @__PURE__ */
|
|
1135
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1116
1136
|
Field,
|
|
1117
1137
|
{
|
|
1118
1138
|
id,
|
|
@@ -1124,7 +1144,7 @@ var Combobox = React11.forwardRef(function Combobox2(props, ref) {
|
|
|
1124
1144
|
disabled: props.disabled,
|
|
1125
1145
|
className: props.className
|
|
1126
1146
|
},
|
|
1127
|
-
/* @__PURE__ */
|
|
1147
|
+
/* @__PURE__ */ React16.createElement("div", { ref: boxRef, className: cx("aura-input aura-combo has-icon", open && "is-open") }, /* @__PURE__ */ React16.createElement(Icon, { name: props.icon || "search", className: "aura-input__icon" }), /* @__PURE__ */ React16.createElement(
|
|
1128
1148
|
"input",
|
|
1129
1149
|
{
|
|
1130
1150
|
ref: inputMerged,
|
|
@@ -1161,7 +1181,7 @@ var Combobox = React11.forwardRef(function Combobox2(props, ref) {
|
|
|
1161
1181
|
}, 0);
|
|
1162
1182
|
}
|
|
1163
1183
|
}
|
|
1164
|
-
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */
|
|
1184
|
+
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */ React16.createElement(
|
|
1165
1185
|
"button",
|
|
1166
1186
|
{
|
|
1167
1187
|
type: "button",
|
|
@@ -1174,8 +1194,8 @@ var Combobox = React11.forwardRef(function Combobox2(props, ref) {
|
|
|
1174
1194
|
if (inputRef.current) inputRef.current.focus();
|
|
1175
1195
|
}
|
|
1176
1196
|
},
|
|
1177
|
-
/* @__PURE__ */
|
|
1178
|
-
) : null, /* @__PURE__ */
|
|
1197
|
+
/* @__PURE__ */ React16.createElement(Icon, { name: "x" })
|
|
1198
|
+
) : null, /* @__PURE__ */ React16.createElement(
|
|
1179
1199
|
"button",
|
|
1180
1200
|
{
|
|
1181
1201
|
type: "button",
|
|
@@ -1193,14 +1213,14 @@ var Combobox = React11.forwardRef(function Combobox2(props, ref) {
|
|
|
1193
1213
|
}
|
|
1194
1214
|
}
|
|
1195
1215
|
},
|
|
1196
|
-
/* @__PURE__ */
|
|
1216
|
+
/* @__PURE__ */ React16.createElement(Icon, { name: "chevron-down" })
|
|
1197
1217
|
)),
|
|
1198
1218
|
list
|
|
1199
1219
|
);
|
|
1200
1220
|
});
|
|
1201
1221
|
|
|
1202
1222
|
// src/DatePicker.tsx
|
|
1203
|
-
var
|
|
1223
|
+
var React17 = __toESM(require("react"), 1);
|
|
1204
1224
|
var import_react_dom3 = require("react-dom");
|
|
1205
1225
|
var ERA = /^พ\.ศ\.\s?|\s?(BE|พ\.ศ\.)$/g;
|
|
1206
1226
|
var pad = function(n2) {
|
|
@@ -1282,29 +1302,29 @@ function parseDate(text) {
|
|
|
1282
1302
|
const dt = new Date(y, mo - 1, d);
|
|
1283
1303
|
return dt.getMonth() === mo - 1 && dt.getDate() === d ? toISO(dt) : null;
|
|
1284
1304
|
}
|
|
1285
|
-
var Calendar =
|
|
1305
|
+
var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
1286
1306
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", tag = localeTag(locale, calendar);
|
|
1287
1307
|
const weekStart = props.weekStartsOn == null ? 0 : props.weekStartsOn;
|
|
1288
1308
|
let today = /* @__PURE__ */ new Date();
|
|
1289
1309
|
today = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
1290
1310
|
const min = fromISO(props.min), max = fromISO(props.max);
|
|
1291
1311
|
const start = fromISO(props.start), end = fromISO(props.end);
|
|
1292
|
-
const focusState =
|
|
1312
|
+
const focusState = React17.useState(fromISO(props.focus) || start || today);
|
|
1293
1313
|
const focusDate = focusState[0], setFocus = focusState[1];
|
|
1294
|
-
const viewState =
|
|
1295
|
-
const hoverState =
|
|
1296
|
-
const gridRef =
|
|
1314
|
+
const viewState = React17.useState("days"), view = viewState[0], setView = viewState[1];
|
|
1315
|
+
const hoverState = React17.useState(null);
|
|
1316
|
+
const gridRef = React17.useRef(null), gridMerged = useMergedRef(ref, gridRef), moved = React17.useRef(false);
|
|
1297
1317
|
const th = locale !== "en";
|
|
1298
1318
|
function disabled(d) {
|
|
1299
1319
|
return !!(min && d < min || max && d > max || props.isDateDisabled && props.isDateDisabled(toISO(d)));
|
|
1300
1320
|
}
|
|
1301
|
-
|
|
1321
|
+
React17.useEffect(function() {
|
|
1302
1322
|
if (!moved.current) return;
|
|
1303
1323
|
moved.current = false;
|
|
1304
1324
|
const el = gridRef.current && gridRef.current.querySelector('[data-date="' + toISO(focusDate) + '"]');
|
|
1305
1325
|
if (el) el.focus();
|
|
1306
1326
|
});
|
|
1307
|
-
|
|
1327
|
+
React17.useEffect(function() {
|
|
1308
1328
|
if (props.autoFocus === false) return;
|
|
1309
1329
|
const el = gridRef.current && gridRef.current.querySelector('[tabindex="0"]');
|
|
1310
1330
|
if (el) el.focus();
|
|
@@ -1356,7 +1376,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1356
1376
|
const yr = focusDate.getFullYear(), base = yr - yr % 12;
|
|
1357
1377
|
const years = [];
|
|
1358
1378
|
for (let y = base; y < base + 12; y++) years.push(y);
|
|
1359
|
-
return /* @__PURE__ */
|
|
1379
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1360
1380
|
IconButton,
|
|
1361
1381
|
{
|
|
1362
1382
|
icon: "chevron-left",
|
|
@@ -1365,7 +1385,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1365
1385
|
setFocus(new Date(yr - 12, focusDate.getMonth(), 1));
|
|
1366
1386
|
}
|
|
1367
1387
|
}
|
|
1368
|
-
), /* @__PURE__ */
|
|
1388
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1369
1389
|
"button",
|
|
1370
1390
|
{
|
|
1371
1391
|
type: "button",
|
|
@@ -1375,7 +1395,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1375
1395
|
}
|
|
1376
1396
|
},
|
|
1377
1397
|
fmt(tag, { year: "numeric" }, new Date(base, 0, 1)).replace(ERA, "") + " \u2013 " + fmt(tag, { year: "numeric" }, new Date(base + 11, 0, 1)).replace(ERA, "")
|
|
1378
|
-
), /* @__PURE__ */
|
|
1398
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1379
1399
|
IconButton,
|
|
1380
1400
|
{
|
|
1381
1401
|
icon: "chevron-right",
|
|
@@ -1384,9 +1404,9 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1384
1404
|
setFocus(new Date(yr + 12, focusDate.getMonth(), 1));
|
|
1385
1405
|
}
|
|
1386
1406
|
}
|
|
1387
|
-
)), /* @__PURE__ */
|
|
1407
|
+
)), /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__years" }, years.map(function(y) {
|
|
1388
1408
|
const d = new Date(y, focusDate.getMonth(), 1);
|
|
1389
|
-
return /* @__PURE__ */
|
|
1409
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1390
1410
|
"button",
|
|
1391
1411
|
{
|
|
1392
1412
|
key: y,
|
|
@@ -1403,7 +1423,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1403
1423
|
);
|
|
1404
1424
|
})));
|
|
1405
1425
|
}
|
|
1406
|
-
return /* @__PURE__ */
|
|
1426
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1407
1427
|
IconButton,
|
|
1408
1428
|
{
|
|
1409
1429
|
icon: "chevron-left",
|
|
@@ -1412,7 +1432,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1412
1432
|
setFocus(addMonths(focusDate, -1));
|
|
1413
1433
|
}
|
|
1414
1434
|
}
|
|
1415
|
-
), /* @__PURE__ */
|
|
1435
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1416
1436
|
"button",
|
|
1417
1437
|
{
|
|
1418
1438
|
type: "button",
|
|
@@ -1423,8 +1443,8 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1423
1443
|
}
|
|
1424
1444
|
},
|
|
1425
1445
|
monthTitle,
|
|
1426
|
-
/* @__PURE__ */
|
|
1427
|
-
), /* @__PURE__ */
|
|
1446
|
+
/* @__PURE__ */ React17.createElement(Icon, { name: "chevron-down", size: 14 })
|
|
1447
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1428
1448
|
IconButton,
|
|
1429
1449
|
{
|
|
1430
1450
|
icon: "chevron-right",
|
|
@@ -1433,9 +1453,9 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1433
1453
|
setFocus(addMonths(focusDate, 1));
|
|
1434
1454
|
}
|
|
1435
1455
|
}
|
|
1436
|
-
)), /* @__PURE__ */
|
|
1437
|
-
return /* @__PURE__ */
|
|
1438
|
-
}))), /* @__PURE__ */
|
|
1456
|
+
)), /* @__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) {
|
|
1457
|
+
return /* @__PURE__ */ React17.createElement("th", { key: i, scope: "col", abbr: n2.long }, /* @__PURE__ */ React17.createElement("span", { "aria-hidden": true }, n2.short));
|
|
1458
|
+
}))), /* @__PURE__ */ React17.createElement(
|
|
1439
1459
|
"tbody",
|
|
1440
1460
|
{
|
|
1441
1461
|
onMouseLeave: function() {
|
|
@@ -1443,11 +1463,11 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1443
1463
|
}
|
|
1444
1464
|
},
|
|
1445
1465
|
weeks.map(function(wk, wi) {
|
|
1446
|
-
return /* @__PURE__ */
|
|
1466
|
+
return /* @__PURE__ */ React17.createElement("tr", { key: wi }, wk.map(function(d) {
|
|
1447
1467
|
const iso = toISO(d), out = d.getMonth() !== focusDate.getMonth(), dis = disabled(d);
|
|
1448
1468
|
const isStart = same(d, start), isEnd = same(d, end) || !end && props.range && same(d, hover) && start;
|
|
1449
1469
|
const sel = isStart || same(d, end);
|
|
1450
|
-
return /* @__PURE__ */
|
|
1470
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1451
1471
|
"td",
|
|
1452
1472
|
{
|
|
1453
1473
|
key: iso,
|
|
@@ -1459,7 +1479,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1459
1479
|
props.range && isEnd && start && "is-range-end"
|
|
1460
1480
|
)
|
|
1461
1481
|
},
|
|
1462
|
-
/* @__PURE__ */
|
|
1482
|
+
/* @__PURE__ */ React17.createElement(
|
|
1463
1483
|
"button",
|
|
1464
1484
|
{
|
|
1465
1485
|
type: "button",
|
|
@@ -1491,7 +1511,7 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1491
1511
|
);
|
|
1492
1512
|
}));
|
|
1493
1513
|
})
|
|
1494
|
-
)), props.footer === false ? null : /* @__PURE__ */
|
|
1514
|
+
)), props.footer === false ? null : /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__foot" }, /* @__PURE__ */ React17.createElement(
|
|
1495
1515
|
"button",
|
|
1496
1516
|
{
|
|
1497
1517
|
type: "button",
|
|
@@ -1503,11 +1523,11 @@ var Calendar = React12.forwardRef(function Calendar2(props, ref) {
|
|
|
1503
1523
|
}
|
|
1504
1524
|
},
|
|
1505
1525
|
th ? "\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49" : "Today"
|
|
1506
|
-
), props.onClear ? /* @__PURE__ */
|
|
1526
|
+
), props.onClear ? /* @__PURE__ */ React17.createElement("button", { type: "button", className: "aura-cal__link", onClick: props.onClear }, th ? "\u0E25\u0E49\u0E32\u0E07" : "Clear") : null));
|
|
1507
1527
|
});
|
|
1508
1528
|
function useCalendarPopover(boxRef) {
|
|
1509
|
-
const openState =
|
|
1510
|
-
const pos =
|
|
1529
|
+
const openState = React17.useState(false), open = openState[0], setOpen = openState[1];
|
|
1530
|
+
const pos = React17.useState(null), popRef = React17.useRef(null), mounted = useMounted();
|
|
1511
1531
|
function place() {
|
|
1512
1532
|
if (!boxRef.current) return;
|
|
1513
1533
|
const r = boxRef.current.getBoundingClientRect(), H = 380;
|
|
@@ -1521,7 +1541,7 @@ function useCalendarPopover(boxRef) {
|
|
|
1521
1541
|
},
|
|
1522
1542
|
[open]
|
|
1523
1543
|
);
|
|
1524
|
-
|
|
1544
|
+
React17.useEffect(
|
|
1525
1545
|
function() {
|
|
1526
1546
|
if (!open) return;
|
|
1527
1547
|
function outside(e) {
|
|
@@ -1543,8 +1563,8 @@ function useCalendarPopover(boxRef) {
|
|
|
1543
1563
|
return { open, setOpen, pos: pos[0], popRef, mounted };
|
|
1544
1564
|
}
|
|
1545
1565
|
function DateField(props) {
|
|
1546
|
-
const editState =
|
|
1547
|
-
return /* @__PURE__ */
|
|
1566
|
+
const editState = React17.useState(null), editing = editState[0], setEditing = editState[1];
|
|
1567
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1548
1568
|
Field,
|
|
1549
1569
|
{
|
|
1550
1570
|
id: props.id,
|
|
@@ -1556,7 +1576,7 @@ function DateField(props) {
|
|
|
1556
1576
|
disabled: props.disabled,
|
|
1557
1577
|
className: props.className
|
|
1558
1578
|
},
|
|
1559
|
-
/* @__PURE__ */
|
|
1579
|
+
/* @__PURE__ */ React17.createElement("div", { ref: props.boxRef, className: cx("aura-input aura-date", props.open && "is-open") }, /* @__PURE__ */ React17.createElement(
|
|
1560
1580
|
"input",
|
|
1561
1581
|
{
|
|
1562
1582
|
ref: props.inputRef,
|
|
@@ -1595,7 +1615,7 @@ function DateField(props) {
|
|
|
1595
1615
|
}
|
|
1596
1616
|
}
|
|
1597
1617
|
}
|
|
1598
|
-
), props.clearable !== false && props.hasValue && !props.disabled ? /* @__PURE__ */
|
|
1618
|
+
), props.clearable !== false && props.hasValue && !props.disabled ? /* @__PURE__ */ React17.createElement(
|
|
1599
1619
|
"button",
|
|
1600
1620
|
{
|
|
1601
1621
|
type: "button",
|
|
@@ -1604,8 +1624,8 @@ function DateField(props) {
|
|
|
1604
1624
|
"aria-label": props.clearLabel,
|
|
1605
1625
|
onClick: props.onClear
|
|
1606
1626
|
},
|
|
1607
|
-
/* @__PURE__ */
|
|
1608
|
-
) : null, /* @__PURE__ */
|
|
1627
|
+
/* @__PURE__ */ React17.createElement(Icon, { name: "x" })
|
|
1628
|
+
) : null, /* @__PURE__ */ React17.createElement(
|
|
1609
1629
|
"button",
|
|
1610
1630
|
{
|
|
1611
1631
|
type: "button",
|
|
@@ -1619,11 +1639,11 @@ function DateField(props) {
|
|
|
1619
1639
|
props.onToggle(!props.open);
|
|
1620
1640
|
}
|
|
1621
1641
|
},
|
|
1622
|
-
/* @__PURE__ */
|
|
1642
|
+
/* @__PURE__ */ React17.createElement(Icon, { name: "calendar" })
|
|
1623
1643
|
))
|
|
1624
1644
|
);
|
|
1625
1645
|
}
|
|
1626
|
-
var DatePicker =
|
|
1646
|
+
var DatePicker = React17.forwardRef(function DatePicker2(props, ref) {
|
|
1627
1647
|
const auto = uid(), id = props.id || auto, dialogId = id + "-cal";
|
|
1628
1648
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", th = locale !== "en";
|
|
1629
1649
|
const st = useMaybeControlled(
|
|
@@ -1631,7 +1651,7 @@ var DatePicker = React12.forwardRef(function DatePicker2(props, ref) {
|
|
|
1631
1651
|
props.defaultValue == null ? null : props.defaultValue,
|
|
1632
1652
|
props.onChange
|
|
1633
1653
|
);
|
|
1634
|
-
const boxRef =
|
|
1654
|
+
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
1635
1655
|
const pop = useCalendarPopover(boxRef);
|
|
1636
1656
|
function commit(text) {
|
|
1637
1657
|
if (!text.trim()) {
|
|
@@ -1646,7 +1666,7 @@ var DatePicker = React12.forwardRef(function DatePicker2(props, ref) {
|
|
|
1646
1666
|
if (inputRef.current) inputRef.current.focus();
|
|
1647
1667
|
}
|
|
1648
1668
|
const cal = pop.open && pop.mounted && pop.pos ? (0, import_react_dom3.createPortal)(
|
|
1649
|
-
/* @__PURE__ */
|
|
1669
|
+
/* @__PURE__ */ React17.createElement(
|
|
1650
1670
|
"div",
|
|
1651
1671
|
{
|
|
1652
1672
|
ref: pop.popRef,
|
|
@@ -1663,7 +1683,7 @@ var DatePicker = React12.forwardRef(function DatePicker2(props, ref) {
|
|
|
1663
1683
|
} else trapTab(e, pop.popRef.current);
|
|
1664
1684
|
}
|
|
1665
1685
|
},
|
|
1666
|
-
/* @__PURE__ */
|
|
1686
|
+
/* @__PURE__ */ React17.createElement(
|
|
1667
1687
|
Calendar,
|
|
1668
1688
|
{
|
|
1669
1689
|
locale,
|
|
@@ -1683,7 +1703,7 @@ var DatePicker = React12.forwardRef(function DatePicker2(props, ref) {
|
|
|
1683
1703
|
),
|
|
1684
1704
|
document.body
|
|
1685
1705
|
) : null;
|
|
1686
|
-
return /* @__PURE__ */
|
|
1706
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1687
1707
|
DateField,
|
|
1688
1708
|
{
|
|
1689
1709
|
id,
|
|
@@ -1717,7 +1737,7 @@ var DatePicker = React12.forwardRef(function DatePicker2(props, ref) {
|
|
|
1717
1737
|
}
|
|
1718
1738
|
), cal);
|
|
1719
1739
|
});
|
|
1720
|
-
var DateRangePicker =
|
|
1740
|
+
var DateRangePicker = React17.forwardRef(
|
|
1721
1741
|
function DateRangePicker2(props, ref) {
|
|
1722
1742
|
const auto = uid(), id = props.id || auto, dialogId = id + "-cal";
|
|
1723
1743
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", th = locale !== "en";
|
|
@@ -1727,8 +1747,8 @@ var DateRangePicker = React12.forwardRef(
|
|
|
1727
1747
|
props.onChange
|
|
1728
1748
|
);
|
|
1729
1749
|
const v = st[0] || { start: null, end: null };
|
|
1730
|
-
const draft =
|
|
1731
|
-
const boxRef =
|
|
1750
|
+
const draft = React17.useState(null);
|
|
1751
|
+
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
1732
1752
|
const pop = useCalendarPopover(boxRef);
|
|
1733
1753
|
const o = { locale, calendar };
|
|
1734
1754
|
function show(r) {
|
|
@@ -1760,7 +1780,7 @@ var DateRangePicker = React12.forwardRef(
|
|
|
1760
1780
|
close();
|
|
1761
1781
|
}
|
|
1762
1782
|
const cal = pop.open && pop.mounted && pop.pos ? (0, import_react_dom3.createPortal)(
|
|
1763
|
-
/* @__PURE__ */
|
|
1783
|
+
/* @__PURE__ */ React17.createElement(
|
|
1764
1784
|
"div",
|
|
1765
1785
|
{
|
|
1766
1786
|
ref: pop.popRef,
|
|
@@ -1777,8 +1797,8 @@ var DateRangePicker = React12.forwardRef(
|
|
|
1777
1797
|
} else trapTab(e, pop.popRef.current);
|
|
1778
1798
|
}
|
|
1779
1799
|
},
|
|
1780
|
-
/* @__PURE__ */
|
|
1781
|
-
/* @__PURE__ */
|
|
1800
|
+
/* @__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"),
|
|
1801
|
+
/* @__PURE__ */ React17.createElement(
|
|
1782
1802
|
Calendar,
|
|
1783
1803
|
{
|
|
1784
1804
|
range: true,
|
|
@@ -1797,7 +1817,7 @@ var DateRangePicker = React12.forwardRef(
|
|
|
1797
1817
|
),
|
|
1798
1818
|
document.body
|
|
1799
1819
|
) : null;
|
|
1800
|
-
return /* @__PURE__ */
|
|
1820
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1801
1821
|
DateField,
|
|
1802
1822
|
{
|
|
1803
1823
|
id,
|
|
@@ -1834,30 +1854,33 @@ var DateRangePicker = React12.forwardRef(
|
|
|
1834
1854
|
}
|
|
1835
1855
|
);
|
|
1836
1856
|
|
|
1837
|
-
// src/
|
|
1838
|
-
var
|
|
1839
|
-
var import_react_dom4 = require("react-dom");
|
|
1857
|
+
// src/Alert.tsx
|
|
1858
|
+
var React18 = __toESM(require("react"), 1);
|
|
1840
1859
|
var ALERT_ICON = {
|
|
1841
1860
|
info: "info",
|
|
1842
1861
|
success: "circle-check",
|
|
1843
1862
|
warning: "triangle-alert",
|
|
1844
1863
|
danger: "circle-alert"
|
|
1845
1864
|
};
|
|
1846
|
-
var Alert =
|
|
1865
|
+
var Alert = React18.forwardRef(function Alert2(props, ref) {
|
|
1847
1866
|
const t = useStrings();
|
|
1848
1867
|
const tone2 = props.tone || "info";
|
|
1849
|
-
return /* @__PURE__ */
|
|
1868
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1850
1869
|
"div",
|
|
1851
1870
|
{
|
|
1852
1871
|
ref,
|
|
1853
1872
|
className: cx("aura-alert", "aura-alert--" + tone2, props.className),
|
|
1854
1873
|
role: tone2 === "danger" || tone2 === "warning" ? "alert" : "status"
|
|
1855
1874
|
},
|
|
1856
|
-
/* @__PURE__ */
|
|
1857
|
-
/* @__PURE__ */
|
|
1858
|
-
props.onDismiss ? /* @__PURE__ */
|
|
1875
|
+
/* @__PURE__ */ React18.createElement(Icon, { name: ALERT_ICON[tone2], className: "aura-alert__icon" }),
|
|
1876
|
+
/* @__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),
|
|
1877
|
+
props.onDismiss ? /* @__PURE__ */ React18.createElement(IconButton, { icon: "x", label: t.dismiss, className: "aura-alert__close", onClick: props.onDismiss }) : null
|
|
1859
1878
|
);
|
|
1860
1879
|
});
|
|
1880
|
+
|
|
1881
|
+
// src/Toaster.tsx
|
|
1882
|
+
var React19 = __toESM(require("react"), 1);
|
|
1883
|
+
var import_react_dom4 = require("react-dom");
|
|
1861
1884
|
var toastState = {
|
|
1862
1885
|
list: [],
|
|
1863
1886
|
subs: [],
|
|
@@ -1885,7 +1908,7 @@ toast.dismiss = function(id) {
|
|
|
1885
1908
|
};
|
|
1886
1909
|
function ToastItem(props) {
|
|
1887
1910
|
const str = useStrings();
|
|
1888
|
-
const t = props.toast, timer =
|
|
1911
|
+
const t = props.toast, timer = React19.useRef(null), left = React19.useRef(t.duration || 5e3), since = React19.useRef(0);
|
|
1889
1912
|
function start() {
|
|
1890
1913
|
if (left.current === Infinity) return;
|
|
1891
1914
|
since.current = Date.now();
|
|
@@ -1900,11 +1923,11 @@ function ToastItem(props) {
|
|
|
1900
1923
|
left.current -= Date.now() - since.current;
|
|
1901
1924
|
}
|
|
1902
1925
|
}
|
|
1903
|
-
|
|
1926
|
+
React19.useEffect(function() {
|
|
1904
1927
|
start();
|
|
1905
1928
|
return pause;
|
|
1906
1929
|
}, []);
|
|
1907
|
-
return /* @__PURE__ */
|
|
1930
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1908
1931
|
"div",
|
|
1909
1932
|
{
|
|
1910
1933
|
className: cx("aura-toast", "aura-toast--" + t.tone),
|
|
@@ -1914,9 +1937,9 @@ function ToastItem(props) {
|
|
|
1914
1937
|
onFocus: pause,
|
|
1915
1938
|
onBlur: start
|
|
1916
1939
|
},
|
|
1917
|
-
/* @__PURE__ */
|
|
1918
|
-
/* @__PURE__ */
|
|
1919
|
-
t.action ? /* @__PURE__ */
|
|
1940
|
+
/* @__PURE__ */ React19.createElement(Icon, { name: ALERT_ICON[t.tone] || "info", className: "aura-toast__icon" }),
|
|
1941
|
+
/* @__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),
|
|
1942
|
+
t.action ? /* @__PURE__ */ React19.createElement(
|
|
1920
1943
|
"button",
|
|
1921
1944
|
{
|
|
1922
1945
|
type: "button",
|
|
@@ -1928,7 +1951,7 @@ function ToastItem(props) {
|
|
|
1928
1951
|
},
|
|
1929
1952
|
t.action.label
|
|
1930
1953
|
) : null,
|
|
1931
|
-
/* @__PURE__ */
|
|
1954
|
+
/* @__PURE__ */ React19.createElement(
|
|
1932
1955
|
IconButton,
|
|
1933
1956
|
{
|
|
1934
1957
|
icon: "x",
|
|
@@ -1944,8 +1967,8 @@ function ToastItem(props) {
|
|
|
1944
1967
|
function Toaster(props) {
|
|
1945
1968
|
const t = useStrings();
|
|
1946
1969
|
const mounted = useMounted();
|
|
1947
|
-
const s =
|
|
1948
|
-
|
|
1970
|
+
const s = React19.useState(toastState.list);
|
|
1971
|
+
React19.useEffect(function() {
|
|
1949
1972
|
toastState.subs.push(s[1]);
|
|
1950
1973
|
return function() {
|
|
1951
1974
|
toastState.subs = toastState.subs.filter(function(f) {
|
|
@@ -1955,7 +1978,7 @@ function Toaster(props) {
|
|
|
1955
1978
|
}, []);
|
|
1956
1979
|
if (!mounted) return null;
|
|
1957
1980
|
return (0, import_react_dom4.createPortal)(
|
|
1958
|
-
/* @__PURE__ */
|
|
1981
|
+
/* @__PURE__ */ React19.createElement(
|
|
1959
1982
|
"div",
|
|
1960
1983
|
{
|
|
1961
1984
|
className: cx("aura-toaster", props && props.position === "top" && "is-top"),
|
|
@@ -1964,16 +1987,20 @@ function Toaster(props) {
|
|
|
1964
1987
|
"aria-label": t.notifications
|
|
1965
1988
|
},
|
|
1966
1989
|
s[0].map(function(t2) {
|
|
1967
|
-
return /* @__PURE__ */
|
|
1990
|
+
return /* @__PURE__ */ React19.createElement(ToastItem, { key: t2.id, toast: t2 });
|
|
1968
1991
|
})
|
|
1969
1992
|
),
|
|
1970
1993
|
document.body
|
|
1971
1994
|
);
|
|
1972
1995
|
}
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1996
|
+
|
|
1997
|
+
// src/Tooltip.tsx
|
|
1998
|
+
var React20 = __toESM(require("react"), 1);
|
|
1999
|
+
var import_react_dom5 = require("react-dom");
|
|
2000
|
+
var Tooltip = React20.forwardRef(function Tooltip2(props, ref) {
|
|
2001
|
+
const id = uid(), st = React20.useState(false), open = props.open !== void 0 ? props.open : st[0], set = st[1];
|
|
2002
|
+
const anchor = React20.useRef(null), anchorMerged = useMergedRef(ref, anchor), tip = React20.useRef(null), timer = React20.useRef(void 0);
|
|
2003
|
+
const pos = React20.useState(null);
|
|
1977
2004
|
function show(now) {
|
|
1978
2005
|
clearTimeout(timer.current);
|
|
1979
2006
|
timer.current = setTimeout(
|
|
@@ -1998,7 +2025,7 @@ var Tooltip = React13.forwardRef(function Tooltip2(props, ref) {
|
|
|
1998
2025
|
},
|
|
1999
2026
|
[open]
|
|
2000
2027
|
);
|
|
2001
|
-
|
|
2028
|
+
React20.useEffect(
|
|
2002
2029
|
function() {
|
|
2003
2030
|
if (!open) return;
|
|
2004
2031
|
function esc(e) {
|
|
@@ -2011,8 +2038,8 @@ var Tooltip = React13.forwardRef(function Tooltip2(props, ref) {
|
|
|
2011
2038
|
},
|
|
2012
2039
|
[open]
|
|
2013
2040
|
);
|
|
2014
|
-
const child =
|
|
2015
|
-
const trigger = /* @__PURE__ */
|
|
2041
|
+
const child = React20.Children.only(props.children);
|
|
2042
|
+
const trigger = /* @__PURE__ */ React20.createElement(
|
|
2016
2043
|
"span",
|
|
2017
2044
|
{
|
|
2018
2045
|
ref: anchorMerged,
|
|
@@ -2026,10 +2053,10 @@ var Tooltip = React13.forwardRef(function Tooltip2(props, ref) {
|
|
|
2026
2053
|
},
|
|
2027
2054
|
onBlur: hide
|
|
2028
2055
|
},
|
|
2029
|
-
|
|
2056
|
+
React20.cloneElement(child, { "aria-describedby": open ? id : child.props["aria-describedby"] })
|
|
2030
2057
|
);
|
|
2031
|
-
return /* @__PURE__ */
|
|
2032
|
-
/* @__PURE__ */
|
|
2058
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, trigger, open ? (0, import_react_dom5.createPortal)(
|
|
2059
|
+
/* @__PURE__ */ React20.createElement(
|
|
2033
2060
|
"div",
|
|
2034
2061
|
{
|
|
2035
2062
|
ref: tip,
|
|
@@ -2045,16 +2072,16 @@ var Tooltip = React13.forwardRef(function Tooltip2(props, ref) {
|
|
|
2045
2072
|
});
|
|
2046
2073
|
|
|
2047
2074
|
// src/Dialog.tsx
|
|
2048
|
-
var
|
|
2049
|
-
var
|
|
2075
|
+
var React22 = __toESM(require("react"), 1);
|
|
2076
|
+
var import_react_dom6 = require("react-dom");
|
|
2050
2077
|
|
|
2051
|
-
// src/
|
|
2052
|
-
var
|
|
2078
|
+
// src/useModal.tsx
|
|
2079
|
+
var React21 = __toESM(require("react"), 1);
|
|
2053
2080
|
function useModal(open, ref, opts) {
|
|
2054
2081
|
const mounted = useMounted();
|
|
2055
|
-
const prev =
|
|
2082
|
+
const prev = React21.useRef(null);
|
|
2056
2083
|
const o = opts || {};
|
|
2057
|
-
|
|
2084
|
+
React21.useEffect(
|
|
2058
2085
|
function() {
|
|
2059
2086
|
if (!open || !mounted) return;
|
|
2060
2087
|
prev.current = document.activeElement;
|
|
@@ -2095,9 +2122,9 @@ function useModal(open, ref, opts) {
|
|
|
2095
2122
|
}
|
|
2096
2123
|
|
|
2097
2124
|
// src/Dialog.tsx
|
|
2098
|
-
var Dialog =
|
|
2125
|
+
var Dialog = React22.forwardRef(function Dialog2(props, ref) {
|
|
2099
2126
|
const t = useStrings();
|
|
2100
|
-
const own =
|
|
2127
|
+
const own = React22.useRef(null), merged = useMergedRef(ref, own), titleId = uid(), descId = uid();
|
|
2101
2128
|
function close() {
|
|
2102
2129
|
if (props.dismissible !== false && props.onClose) props.onClose();
|
|
2103
2130
|
}
|
|
@@ -2108,8 +2135,8 @@ var Dialog = React15.forwardRef(function Dialog2(props, ref) {
|
|
|
2108
2135
|
footSelector: ".aura-dialog__foot"
|
|
2109
2136
|
});
|
|
2110
2137
|
if (!modal.ready) return null;
|
|
2111
|
-
return (0,
|
|
2112
|
-
/* @__PURE__ */
|
|
2138
|
+
return (0, import_react_dom6.createPortal)(
|
|
2139
|
+
/* @__PURE__ */ React22.createElement("div", { className: "aura-dialog-layer", onKeyDown: modal.onKeyDown }, /* @__PURE__ */ React22.createElement("div", { className: "aura-scrim", onClick: close, "aria-hidden": true }), /* @__PURE__ */ React22.createElement(
|
|
2113
2140
|
"div",
|
|
2114
2141
|
{
|
|
2115
2142
|
ref: merged,
|
|
@@ -2120,17 +2147,17 @@ var Dialog = React15.forwardRef(function Dialog2(props, ref) {
|
|
|
2120
2147
|
tabIndex: -1,
|
|
2121
2148
|
className: cx("aura-dialog", "aura-dialog--" + (props.size || "md"), props.className)
|
|
2122
2149
|
},
|
|
2123
|
-
/* @__PURE__ */
|
|
2124
|
-
props.description ? /* @__PURE__ */
|
|
2125
|
-
props.children ? /* @__PURE__ */
|
|
2126
|
-
props.footer ? /* @__PURE__ */
|
|
2150
|
+
/* @__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),
|
|
2151
|
+
props.description ? /* @__PURE__ */ React22.createElement("p", { className: "aura-dialog__desc", id: descId }, props.description) : null,
|
|
2152
|
+
props.children ? /* @__PURE__ */ React22.createElement("div", { className: "aura-dialog__body" }, props.children) : null,
|
|
2153
|
+
props.footer ? /* @__PURE__ */ React22.createElement("div", { className: "aura-dialog__foot" }, props.footer) : null
|
|
2127
2154
|
)),
|
|
2128
2155
|
document.body
|
|
2129
2156
|
);
|
|
2130
2157
|
});
|
|
2131
|
-
var Drawer =
|
|
2158
|
+
var Drawer = React22.forwardRef(function Drawer2(props, ref) {
|
|
2132
2159
|
const t = useStrings();
|
|
2133
|
-
const own =
|
|
2160
|
+
const own = React22.useRef(null), merged = useMergedRef(ref, own), titleId = uid(), descId = uid();
|
|
2134
2161
|
function close() {
|
|
2135
2162
|
if (props.dismissible !== false && props.onClose) props.onClose();
|
|
2136
2163
|
}
|
|
@@ -2142,8 +2169,8 @@ var Drawer = React15.forwardRef(function Drawer2(props, ref) {
|
|
|
2142
2169
|
});
|
|
2143
2170
|
if (!modal.ready) return null;
|
|
2144
2171
|
const side = props.side === "left" ? "left" : "right";
|
|
2145
|
-
return (0,
|
|
2146
|
-
/* @__PURE__ */
|
|
2172
|
+
return (0, import_react_dom6.createPortal)(
|
|
2173
|
+
/* @__PURE__ */ React22.createElement("div", { className: "aura-dialog-layer aura-drawer-layer", onKeyDown: modal.onKeyDown }, /* @__PURE__ */ React22.createElement("div", { className: "aura-scrim", onClick: close, "aria-hidden": true }), /* @__PURE__ */ React22.createElement(
|
|
2147
2174
|
"div",
|
|
2148
2175
|
{
|
|
2149
2176
|
ref: merged,
|
|
@@ -2155,17 +2182,17 @@ var Drawer = React15.forwardRef(function Drawer2(props, ref) {
|
|
|
2155
2182
|
tabIndex: -1,
|
|
2156
2183
|
className: cx("aura-drawer", "aura-drawer--" + side, "aura-drawer--" + (props.size || "md"), props.className)
|
|
2157
2184
|
},
|
|
2158
|
-
props.title || props.dismissible !== false ? /* @__PURE__ */
|
|
2159
|
-
props.description ? /* @__PURE__ */
|
|
2160
|
-
/* @__PURE__ */
|
|
2161
|
-
props.footer ? /* @__PURE__ */
|
|
2185
|
+
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,
|
|
2186
|
+
props.description ? /* @__PURE__ */ React22.createElement("p", { className: "aura-drawer__desc", id: descId }, props.description) : null,
|
|
2187
|
+
/* @__PURE__ */ React22.createElement("div", { className: "aura-drawer__body" }, props.children),
|
|
2188
|
+
props.footer ? /* @__PURE__ */ React22.createElement("div", { className: "aura-drawer__foot" }, props.footer) : null
|
|
2162
2189
|
)),
|
|
2163
2190
|
document.body
|
|
2164
2191
|
);
|
|
2165
2192
|
});
|
|
2166
2193
|
|
|
2167
2194
|
// src/DataTable.tsx
|
|
2168
|
-
var
|
|
2195
|
+
var React23 = __toESM(require("react"), 1);
|
|
2169
2196
|
var BP = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
2170
2197
|
var DEFAULT_COLUMNS = [
|
|
2171
2198
|
{ key: "id", label: "ID", width: 96, mono: true },
|
|
@@ -2177,7 +2204,7 @@ var SKELETON_WIDTHS = ["72%", "56%", "84%", "44%", "64%"];
|
|
|
2177
2204
|
var ROW_H = 48;
|
|
2178
2205
|
var OVERSCAN = 8;
|
|
2179
2206
|
var FLEX_MIN = 160;
|
|
2180
|
-
var DataTable =
|
|
2207
|
+
var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
2181
2208
|
const t = useStrings();
|
|
2182
2209
|
const columns = props.columns || DEFAULT_COLUMNS;
|
|
2183
2210
|
const byKey = {};
|
|
@@ -2220,23 +2247,23 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2220
2247
|
}),
|
|
2221
2248
|
props.onPinnedColumnsChange
|
|
2222
2249
|
);
|
|
2223
|
-
const widthState =
|
|
2250
|
+
const widthState = React23.useState({});
|
|
2224
2251
|
const widths = widthState[0], setWidths = widthState[1];
|
|
2225
|
-
const activeState =
|
|
2226
|
-
const scrollState =
|
|
2252
|
+
const activeState = React23.useState({ r: 1, c: 0 });
|
|
2253
|
+
const scrollState = React23.useState(0);
|
|
2227
2254
|
const scrollTop = scrollState[0], setScrollTop = scrollState[1];
|
|
2228
|
-
const scrolledX =
|
|
2229
|
-
const menuState =
|
|
2255
|
+
const scrolledX = React23.useState(false);
|
|
2256
|
+
const menuState = React23.useState(null);
|
|
2230
2257
|
const menu = menuState[0], setMenu = menuState[1];
|
|
2231
|
-
const dragState =
|
|
2258
|
+
const dragState = React23.useState(null);
|
|
2232
2259
|
const drag = dragState[0], setDrag = dragState[1];
|
|
2233
|
-
const gridRef =
|
|
2234
|
-
const wrapRef =
|
|
2235
|
-
const boxWidth =
|
|
2260
|
+
const gridRef = React23.useRef(null);
|
|
2261
|
+
const wrapRef = React23.useRef(null), wrapMerged = useMergedRef(ref, wrapRef);
|
|
2262
|
+
const boxWidth = React23.useState(null);
|
|
2236
2263
|
const measure = !!props.stackBelow || columns.some(function(c) {
|
|
2237
2264
|
return c.hideBelow != null;
|
|
2238
2265
|
});
|
|
2239
|
-
|
|
2266
|
+
React23.useEffect(
|
|
2240
2267
|
function() {
|
|
2241
2268
|
if (!measure || !wrapRef.current || typeof ResizeObserver === "undefined") return;
|
|
2242
2269
|
const ro = new ResizeObserver(function(en) {
|
|
@@ -2255,9 +2282,9 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2255
2282
|
const px = typeof c.hideBelow === "number" ? c.hideBelow : BP[c.hideBelow];
|
|
2256
2283
|
return px != null && boxWidth[0] < px;
|
|
2257
2284
|
}
|
|
2258
|
-
const scrollRef =
|
|
2259
|
-
const pending =
|
|
2260
|
-
const resizing =
|
|
2285
|
+
const scrollRef = React23.useRef(null);
|
|
2286
|
+
const pending = React23.useRef(null);
|
|
2287
|
+
const resizing = React23.useRef(false);
|
|
2261
2288
|
useIsoLayoutEffect(function() {
|
|
2262
2289
|
if (stacked || !gridRef.current) return;
|
|
2263
2290
|
const els = gridRef.current.querySelectorAll(
|
|
@@ -2316,7 +2343,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2316
2343
|
if (isPinned(c)) s.left = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + "px)";
|
|
2317
2344
|
return s;
|
|
2318
2345
|
}
|
|
2319
|
-
const view =
|
|
2346
|
+
const view = React23.useMemo(
|
|
2320
2347
|
function() {
|
|
2321
2348
|
if (!sort || !sort.key || !byKey[sort.key]) return rows;
|
|
2322
2349
|
const col = byKey[sort.key];
|
|
@@ -2375,7 +2402,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2375
2402
|
if (!activeRendered) return r === 0 && c === ac ? 0 : -1;
|
|
2376
2403
|
return r === ar && c === ac ? 0 : -1;
|
|
2377
2404
|
}
|
|
2378
|
-
|
|
2405
|
+
React23.useEffect(function() {
|
|
2379
2406
|
const p = pending.current;
|
|
2380
2407
|
if (!p || !gridRef.current) return;
|
|
2381
2408
|
let c = p.c;
|
|
@@ -2686,10 +2713,10 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2686
2713
|
e.stopPropagation();
|
|
2687
2714
|
}
|
|
2688
2715
|
}
|
|
2689
|
-
const head = [/* @__PURE__ */
|
|
2716
|
+
const head = [/* @__PURE__ */ React23.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
|
|
2690
2717
|
if (selectable)
|
|
2691
2718
|
head.push(
|
|
2692
|
-
/* @__PURE__ */
|
|
2719
|
+
/* @__PURE__ */ React23.createElement(
|
|
2693
2720
|
"span",
|
|
2694
2721
|
{
|
|
2695
2722
|
key: "__sel",
|
|
@@ -2703,7 +2730,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2703
2730
|
activeState[1]({ r: 0, c: 0 });
|
|
2704
2731
|
}
|
|
2705
2732
|
},
|
|
2706
|
-
nRows ? /* @__PURE__ */
|
|
2733
|
+
nRows ? /* @__PURE__ */ React23.createElement(
|
|
2707
2734
|
Checkbox,
|
|
2708
2735
|
{
|
|
2709
2736
|
checked: all,
|
|
@@ -2722,7 +2749,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2722
2749
|
const ariaSort = isSorted && canSort ? sort.dir === "desc" ? "descending" : "ascending" : canSort ? "none" : void 0;
|
|
2723
2750
|
const pin = isPinned(c), edge = pin && i === nPinned - 1;
|
|
2724
2751
|
head.push(
|
|
2725
|
-
/* @__PURE__ */
|
|
2752
|
+
/* @__PURE__ */ React23.createElement(
|
|
2726
2753
|
"span",
|
|
2727
2754
|
{
|
|
2728
2755
|
key: c.key,
|
|
@@ -2770,7 +2797,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2770
2797
|
setDrag(null);
|
|
2771
2798
|
}
|
|
2772
2799
|
},
|
|
2773
|
-
/* @__PURE__ */
|
|
2800
|
+
/* @__PURE__ */ React23.createElement("span", { className: "aura-table__th-inner" }, canSort ? /* @__PURE__ */ React23.createElement(
|
|
2774
2801
|
"button",
|
|
2775
2802
|
{
|
|
2776
2803
|
type: "button",
|
|
@@ -2783,8 +2810,8 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2783
2810
|
}
|
|
2784
2811
|
},
|
|
2785
2812
|
c.label,
|
|
2786
|
-
/* @__PURE__ */
|
|
2787
|
-
) : /* @__PURE__ */
|
|
2813
|
+
/* @__PURE__ */ React23.createElement(Icon, { name: isSorted ? sort.dir === "desc" ? "arrow-down" : "arrow-up" : "arrow-up-down", size: 12 })
|
|
2814
|
+
) : /* @__PURE__ */ React23.createElement("span", { className: cx("aura-table__th-label", !c.label && "aura-sr-only") }, c.label || (c.actions ? t.actions : c.key)), pin ? /* @__PURE__ */ React23.createElement(Icon, { name: "pin", size: 12, className: "aura-table__pin-icon", label: t.pinned }) : null, controls ? /* @__PURE__ */ React23.createElement(
|
|
2788
2815
|
"button",
|
|
2789
2816
|
{
|
|
2790
2817
|
type: "button",
|
|
@@ -2798,9 +2825,9 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2798
2825
|
openMenu("col", c.key, e.currentTarget, { r: 0, c: ci });
|
|
2799
2826
|
}
|
|
2800
2827
|
},
|
|
2801
|
-
/* @__PURE__ */
|
|
2828
|
+
/* @__PURE__ */ React23.createElement(Icon, { name: "ellipsis" })
|
|
2802
2829
|
) : null),
|
|
2803
|
-
canResize(c) ? /* @__PURE__ */
|
|
2830
|
+
canResize(c) ? /* @__PURE__ */ React23.createElement(
|
|
2804
2831
|
"span",
|
|
2805
2832
|
{
|
|
2806
2833
|
className: "aura-table__resize",
|
|
@@ -2822,7 +2849,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2822
2849
|
);
|
|
2823
2850
|
});
|
|
2824
2851
|
head.push(
|
|
2825
|
-
/* @__PURE__ */
|
|
2852
|
+
/* @__PURE__ */ React23.createElement(
|
|
2826
2853
|
"span",
|
|
2827
2854
|
{
|
|
2828
2855
|
key: "__gr",
|
|
@@ -2833,10 +2860,10 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2833
2860
|
);
|
|
2834
2861
|
function rowCells(r, i, k, isSel) {
|
|
2835
2862
|
const ri = i + 1;
|
|
2836
|
-
const cells = [/* @__PURE__ */
|
|
2863
|
+
const cells = [/* @__PURE__ */ React23.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
|
|
2837
2864
|
if (selectable)
|
|
2838
2865
|
cells.push(
|
|
2839
|
-
/* @__PURE__ */
|
|
2866
|
+
/* @__PURE__ */ React23.createElement(
|
|
2840
2867
|
"span",
|
|
2841
2868
|
{
|
|
2842
2869
|
key: "__sel",
|
|
@@ -2850,7 +2877,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2850
2877
|
if (e.target === e.currentTarget) activeState[1]({ r: ri, c: 0 });
|
|
2851
2878
|
}
|
|
2852
2879
|
},
|
|
2853
|
-
/* @__PURE__ */
|
|
2880
|
+
/* @__PURE__ */ React23.createElement(
|
|
2854
2881
|
Checkbox,
|
|
2855
2882
|
{
|
|
2856
2883
|
checked: isSel,
|
|
@@ -2866,7 +2893,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2866
2893
|
vis.forEach(function(c, j) {
|
|
2867
2894
|
const ci = j + (selectable ? 1 : 0), v = r[c.key], pin = isPinned(c);
|
|
2868
2895
|
cells.push(
|
|
2869
|
-
/* @__PURE__ */
|
|
2896
|
+
/* @__PURE__ */ React23.createElement(
|
|
2870
2897
|
"span",
|
|
2871
2898
|
{
|
|
2872
2899
|
key: c.key,
|
|
@@ -2885,12 +2912,12 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2885
2912
|
if (activeState[0].r !== ri || activeState[0].c !== ci) activeState[1]({ r: ri, c: ci });
|
|
2886
2913
|
}
|
|
2887
2914
|
},
|
|
2888
|
-
c.render ? c.render(r) : c.pill ? /* @__PURE__ */
|
|
2915
|
+
c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React23.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v
|
|
2889
2916
|
)
|
|
2890
2917
|
);
|
|
2891
2918
|
});
|
|
2892
2919
|
cells.push(
|
|
2893
|
-
/* @__PURE__ */
|
|
2920
|
+
/* @__PURE__ */ React23.createElement(
|
|
2894
2921
|
"span",
|
|
2895
2922
|
{
|
|
2896
2923
|
key: "__gr",
|
|
@@ -2907,14 +2934,14 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2907
2934
|
const n2 = pageSize || props.skeletonRows || 5;
|
|
2908
2935
|
const skRows = body = [];
|
|
2909
2936
|
for (let i = 0; i < n2; i++) {
|
|
2910
|
-
const sk = [/* @__PURE__ */
|
|
2937
|
+
const sk = [/* @__PURE__ */ React23.createElement("span", { key: "__gl", className: "aura-table__gutter" })];
|
|
2911
2938
|
if (selectable)
|
|
2912
2939
|
sk.push(
|
|
2913
|
-
/* @__PURE__ */
|
|
2940
|
+
/* @__PURE__ */ React23.createElement("span", { key: "__sel", className: cx("aura-table__sel", nPinned && "is-pinned") }, /* @__PURE__ */ React23.createElement("span", { className: "aura-skel aura-skel--box" }))
|
|
2914
2941
|
);
|
|
2915
2942
|
vis.forEach(function(c, j) {
|
|
2916
2943
|
sk.push(
|
|
2917
|
-
/* @__PURE__ */
|
|
2944
|
+
/* @__PURE__ */ React23.createElement("span", { key: c.key, className: cx("aura-table__td", isPinned(c) && "is-pinned"), style: cellStyle(c, j) }, /* @__PURE__ */ React23.createElement(
|
|
2918
2945
|
"span",
|
|
2919
2946
|
{
|
|
2920
2947
|
className: cx("aura-skel", c.pill && "aura-skel--pill"),
|
|
@@ -2924,24 +2951,24 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2924
2951
|
);
|
|
2925
2952
|
});
|
|
2926
2953
|
sk.push(
|
|
2927
|
-
/* @__PURE__ */
|
|
2954
|
+
/* @__PURE__ */ React23.createElement("span", { key: "__gr", className: cx("aura-table__gutter aura-table__gutter--end", controls && "has-picker") })
|
|
2928
2955
|
);
|
|
2929
2956
|
skRows.push(
|
|
2930
|
-
/* @__PURE__ */
|
|
2957
|
+
/* @__PURE__ */ React23.createElement("div", { key: "sk" + i, className: "aura-table__row aura-table__row--skeleton", "aria-hidden": true, style: rowStyle }, sk)
|
|
2931
2958
|
);
|
|
2932
2959
|
}
|
|
2933
2960
|
} else if (!rows.length) {
|
|
2934
2961
|
const em = props.empty || {};
|
|
2935
|
-
body = /* @__PURE__ */
|
|
2962
|
+
body = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty", role: "row" }, /* @__PURE__ */ React23.createElement("div", { role: "gridcell" }, /* @__PURE__ */ React23.createElement("span", { className: "aura-table__empty-icon" }, /* @__PURE__ */ React23.createElement(Icon, { name: em.icon || "inbox", size: "lg" })), /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-title" }, em.title || t.empty), em.description ? /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-text" }, em.description) : null, em.action ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty-action" }, em.action) : null));
|
|
2936
2963
|
} else {
|
|
2937
2964
|
const bodyRows = body = [];
|
|
2938
2965
|
if (virtual && start > 0)
|
|
2939
|
-
bodyRows.push(/* @__PURE__ */
|
|
2966
|
+
bodyRows.push(/* @__PURE__ */ React23.createElement("div", { key: "__top", style: { height: start * ROW_H + "px" }, "aria-hidden": true }));
|
|
2940
2967
|
for (let ri = start; ri < end; ri++) {
|
|
2941
2968
|
(function(r, i) {
|
|
2942
2969
|
const k = r[rowKey], isSel = !!selSet[k];
|
|
2943
2970
|
bodyRows.push(
|
|
2944
|
-
/* @__PURE__ */
|
|
2971
|
+
/* @__PURE__ */ React23.createElement(
|
|
2945
2972
|
"div",
|
|
2946
2973
|
{
|
|
2947
2974
|
key: k,
|
|
@@ -2962,12 +2989,12 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2962
2989
|
})(pageRows[ri], ri);
|
|
2963
2990
|
}
|
|
2964
2991
|
if (virtual && end < pageRows.length)
|
|
2965
|
-
bodyRows.push(/* @__PURE__ */
|
|
2992
|
+
bodyRows.push(/* @__PURE__ */ React23.createElement("div", { key: "__bot", style: { height: (pageRows.length - end) * ROW_H + "px" }, "aria-hidden": true }));
|
|
2966
2993
|
}
|
|
2967
2994
|
let foot = null;
|
|
2968
2995
|
if (pageSize && (rows.length || loading)) {
|
|
2969
2996
|
const from = rows.length ? first + 1 : 0, to = Math.min(first + pageSize, view.length);
|
|
2970
|
-
foot = /* @__PURE__ */
|
|
2997
|
+
foot = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React23.createElement("span", { "aria-live": "polite" }, loading ? t.loading : t.range(from, to, view.length)), /* @__PURE__ */ React23.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React23.createElement("span", null, t.page(page, pageCount)), /* @__PURE__ */ React23.createElement(
|
|
2971
2998
|
IconButton,
|
|
2972
2999
|
{
|
|
2973
3000
|
icon: "chevron-left",
|
|
@@ -2977,7 +3004,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2977
3004
|
goPage(page - 1);
|
|
2978
3005
|
}
|
|
2979
3006
|
}
|
|
2980
|
-
), /* @__PURE__ */
|
|
3007
|
+
), /* @__PURE__ */ React23.createElement(
|
|
2981
3008
|
IconButton,
|
|
2982
3009
|
{
|
|
2983
3010
|
icon: "chevron-right",
|
|
@@ -2989,7 +3016,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
2989
3016
|
}
|
|
2990
3017
|
)));
|
|
2991
3018
|
} else if (height && rows.length && !loading) {
|
|
2992
|
-
foot = /* @__PURE__ */
|
|
3019
|
+
foot = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React23.createElement("span", null, t.rowCount(view.length)), selectable && selected.length ? /* @__PURE__ */ React23.createElement("span", null, t.selectedCount(selected.length)) : /* @__PURE__ */ React23.createElement("span", null));
|
|
2993
3020
|
}
|
|
2994
3021
|
if (stacked) {
|
|
2995
3022
|
const titleCol = vis[0], pillCol = vis.filter(function(c) {
|
|
@@ -3003,20 +3030,20 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3003
3030
|
});
|
|
3004
3031
|
let cardBody;
|
|
3005
3032
|
if (loading) {
|
|
3006
|
-
cardBody = /* @__PURE__ */
|
|
3007
|
-
return /* @__PURE__ */
|
|
3033
|
+
cardBody = /* @__PURE__ */ React23.createElement("ul", { className: "aura-table__cards", "aria-busy": true }, [0, 1, 2].map(function(i) {
|
|
3034
|
+
return /* @__PURE__ */ React23.createElement("li", { key: i, className: "aura-table__card", "aria-hidden": true }, /* @__PURE__ */ React23.createElement("span", { className: "aura-skel", style: { width: "50%", height: "14px" } }), /* @__PURE__ */ React23.createElement("span", { className: "aura-skel", style: { width: "80%" } }), /* @__PURE__ */ React23.createElement("span", { className: "aura-skel", style: { width: "64%" } }));
|
|
3008
3035
|
}));
|
|
3009
3036
|
} else if (!rows.length) {
|
|
3010
3037
|
const em2 = props.empty || {};
|
|
3011
|
-
cardBody = /* @__PURE__ */
|
|
3038
|
+
cardBody = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty" }, /* @__PURE__ */ React23.createElement("div", null, /* @__PURE__ */ React23.createElement("span", { className: "aura-table__empty-icon" }, /* @__PURE__ */ React23.createElement(Icon, { name: em2.icon || "inbox", size: "lg" })), /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-title" }, em2.title || t.empty), em2.description ? /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-text" }, em2.description) : null, em2.action ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty-action" }, em2.action) : null));
|
|
3012
3039
|
} else {
|
|
3013
3040
|
const cellVal = function(c, r) {
|
|
3014
3041
|
const v = r[c.key];
|
|
3015
|
-
return c.render ? c.render(r) : c.pill ? /* @__PURE__ */
|
|
3042
|
+
return c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React23.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v;
|
|
3016
3043
|
};
|
|
3017
|
-
cardBody = /* @__PURE__ */
|
|
3044
|
+
cardBody = /* @__PURE__ */ React23.createElement("ul", { className: "aura-table__cards", "aria-label": props.label }, pageRows.map(function(r) {
|
|
3018
3045
|
const k = r[rowKey], isSel = !!selSet[k];
|
|
3019
|
-
return /* @__PURE__ */
|
|
3046
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3020
3047
|
"li",
|
|
3021
3048
|
{
|
|
3022
3049
|
key: k,
|
|
@@ -3031,7 +3058,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3031
3058
|
if (e.target === e.currentTarget && e.key === "Enter" && props.onRowActivate) props.onRowActivate(r);
|
|
3032
3059
|
}
|
|
3033
3060
|
},
|
|
3034
|
-
/* @__PURE__ */
|
|
3061
|
+
/* @__PURE__ */ React23.createElement("div", { className: "aura-table__card-head" }, selectable ? /* @__PURE__ */ React23.createElement(
|
|
3035
3062
|
Checkbox,
|
|
3036
3063
|
{
|
|
3037
3064
|
checked: isSel,
|
|
@@ -3040,16 +3067,16 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3040
3067
|
toggle(k, on);
|
|
3041
3068
|
}
|
|
3042
3069
|
}
|
|
3043
|
-
) : null, /* @__PURE__ */
|
|
3044
|
-
return /* @__PURE__ */
|
|
3070
|
+
) : 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) {
|
|
3071
|
+
return /* @__PURE__ */ React23.createElement("span", { key: c.key, className: "aura-table__card-actions" }, cellVal(c, r));
|
|
3045
3072
|
})),
|
|
3046
|
-
rest.length ? /* @__PURE__ */
|
|
3047
|
-
return /* @__PURE__ */
|
|
3073
|
+
rest.length ? /* @__PURE__ */ React23.createElement("dl", { className: "aura-table__card-fields" }, rest.map(function(c) {
|
|
3074
|
+
return /* @__PURE__ */ React23.createElement("div", { key: c.key }, /* @__PURE__ */ React23.createElement("dt", null, c.label), /* @__PURE__ */ React23.createElement("dd", { className: c.mono ? "aura-table__mono" : void 0 }, cellVal(c, r)));
|
|
3048
3075
|
})) : null
|
|
3049
3076
|
);
|
|
3050
3077
|
}));
|
|
3051
3078
|
}
|
|
3052
|
-
return /* @__PURE__ */
|
|
3079
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3053
3080
|
"div",
|
|
3054
3081
|
{
|
|
3055
3082
|
ref: wrapMerged,
|
|
@@ -3058,7 +3085,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3058
3085
|
"aria-label": props.label,
|
|
3059
3086
|
"aria-busy": loading || void 0
|
|
3060
3087
|
},
|
|
3061
|
-
selectable && pageRows.length && !loading ? /* @__PURE__ */
|
|
3088
|
+
selectable && pageRows.length && !loading ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__stack-bar" }, /* @__PURE__ */ React23.createElement(
|
|
3062
3089
|
Checkbox,
|
|
3063
3090
|
{
|
|
3064
3091
|
checked: all,
|
|
@@ -3066,7 +3093,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3066
3093
|
label: all ? t.deselectAllRows : t.selectAllRows,
|
|
3067
3094
|
onChange: toggleAll
|
|
3068
3095
|
}
|
|
3069
|
-
), /* @__PURE__ */
|
|
3096
|
+
), /* @__PURE__ */ React23.createElement("span", null, nSel ? t.selectedCount(nSel) : t.selectAll)) : null,
|
|
3070
3097
|
cardBody,
|
|
3071
3098
|
foot
|
|
3072
3099
|
);
|
|
@@ -3076,7 +3103,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3076
3103
|
scrollPaddingTop: ROW_H + "px"
|
|
3077
3104
|
};
|
|
3078
3105
|
if (height) scrollStyle.height = height + "px";
|
|
3079
|
-
return /* @__PURE__ */
|
|
3106
|
+
return /* @__PURE__ */ React23.createElement("div", { ref: wrapMerged, className: cx("aura-table", scrolledX[0] && "is-scrolled-x", props.className) }, /* @__PURE__ */ React23.createElement(
|
|
3080
3107
|
"div",
|
|
3081
3108
|
{
|
|
3082
3109
|
ref: function(el) {
|
|
@@ -3101,9 +3128,9 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3101
3128
|
if (sx !== scrolledX[0]) scrolledX[1](sx);
|
|
3102
3129
|
}
|
|
3103
3130
|
},
|
|
3104
|
-
/* @__PURE__ */
|
|
3131
|
+
/* @__PURE__ */ React23.createElement("div", { className: "aura-table__head", role: "row", "aria-rowindex": 1, style: rowStyle }, head),
|
|
3105
3132
|
body
|
|
3106
|
-
), loading ? /* @__PURE__ */
|
|
3133
|
+
), loading ? /* @__PURE__ */ React23.createElement("span", { className: "aura-sr-only", role: "status" }, t.loadingRows) : null, controls ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__picker" }, /* @__PURE__ */ React23.createElement(
|
|
3107
3134
|
IconButton,
|
|
3108
3135
|
{
|
|
3109
3136
|
icon: "columns-3",
|
|
@@ -3113,7 +3140,7 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3113
3140
|
openMenu("picker", null, e.currentTarget);
|
|
3114
3141
|
}
|
|
3115
3142
|
}
|
|
3116
|
-
)) : null, foot, menu ? /* @__PURE__ */
|
|
3143
|
+
)) : null, foot, menu ? /* @__PURE__ */ React23.createElement(
|
|
3117
3144
|
Menu,
|
|
3118
3145
|
{
|
|
3119
3146
|
anchor: menu.anchor,
|
|
@@ -3124,12 +3151,12 @@ var DataTable = React16.forwardRef(function DataTable2(props, ref) {
|
|
|
3124
3151
|
) : null);
|
|
3125
3152
|
});
|
|
3126
3153
|
|
|
3127
|
-
// src/
|
|
3128
|
-
var
|
|
3129
|
-
var
|
|
3130
|
-
var Card =
|
|
3154
|
+
// src/Card.tsx
|
|
3155
|
+
var React24 = __toESM(require("react"), 1);
|
|
3156
|
+
var h4 = React24.createElement;
|
|
3157
|
+
var Card = React24.forwardRef(function Card2(props, ref) {
|
|
3131
3158
|
const creative = props.variant === "creative";
|
|
3132
|
-
return
|
|
3159
|
+
return h4(
|
|
3133
3160
|
props.as || "section",
|
|
3134
3161
|
{
|
|
3135
3162
|
ref,
|
|
@@ -3141,19 +3168,22 @@ var Card = React17.forwardRef(function Card2(props, ref) {
|
|
|
3141
3168
|
),
|
|
3142
3169
|
"aria-labelledby": props.title && props.titleId ? props.titleId : void 0
|
|
3143
3170
|
},
|
|
3144
|
-
props.title || props.actions ? /* @__PURE__ */
|
|
3145
|
-
props.children ? /* @__PURE__ */
|
|
3146
|
-
props.footer ? /* @__PURE__ */
|
|
3171
|
+
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,
|
|
3172
|
+
props.children ? /* @__PURE__ */ React24.createElement("div", { className: "aura-card__body" }, props.children) : null,
|
|
3173
|
+
props.footer ? /* @__PURE__ */ React24.createElement("div", { className: "aura-card__foot" }, props.footer) : null
|
|
3147
3174
|
);
|
|
3148
3175
|
});
|
|
3149
|
-
|
|
3176
|
+
|
|
3177
|
+
// src/Tabs.tsx
|
|
3178
|
+
var React25 = __toESM(require("react"), 1);
|
|
3179
|
+
var Tabs = React25.forwardRef(function Tabs2(props, ref) {
|
|
3150
3180
|
const items = props.tabs || [], base = uid();
|
|
3151
3181
|
const st = useMaybeControlled(
|
|
3152
3182
|
props.value,
|
|
3153
3183
|
props.defaultValue || items[0] && items[0].id,
|
|
3154
3184
|
props.onChange
|
|
3155
3185
|
);
|
|
3156
|
-
const refs =
|
|
3186
|
+
const refs = React25.useRef({});
|
|
3157
3187
|
const current2 = items.filter(function(t) {
|
|
3158
3188
|
return t.id === st[0];
|
|
3159
3189
|
})[0] || items[0];
|
|
@@ -3165,7 +3195,7 @@ var Tabs = React17.forwardRef(function Tabs2(props, ref) {
|
|
|
3165
3195
|
st[1](t.id);
|
|
3166
3196
|
if (refs.current[t.id]) refs.current[t.id].focus();
|
|
3167
3197
|
}
|
|
3168
|
-
return /* @__PURE__ */
|
|
3198
|
+
return /* @__PURE__ */ React25.createElement("div", { ref, className: cx("aura-tabs", props.className) }, /* @__PURE__ */ React25.createElement(
|
|
3169
3199
|
"div",
|
|
3170
3200
|
{
|
|
3171
3201
|
role: "tablist",
|
|
@@ -3192,7 +3222,7 @@ var Tabs = React17.forwardRef(function Tabs2(props, ref) {
|
|
|
3192
3222
|
},
|
|
3193
3223
|
items.map(function(t) {
|
|
3194
3224
|
const on = current2 && t.id === current2.id;
|
|
3195
|
-
return /* @__PURE__ */
|
|
3225
|
+
return /* @__PURE__ */ React25.createElement(
|
|
3196
3226
|
"button",
|
|
3197
3227
|
{
|
|
3198
3228
|
key: t.id,
|
|
@@ -3211,12 +3241,12 @@ var Tabs = React17.forwardRef(function Tabs2(props, ref) {
|
|
|
3211
3241
|
st[1](t.id);
|
|
3212
3242
|
}
|
|
3213
3243
|
},
|
|
3214
|
-
t.icon ? /* @__PURE__ */
|
|
3244
|
+
t.icon ? /* @__PURE__ */ React25.createElement(Icon, { name: t.icon }) : null,
|
|
3215
3245
|
t.label,
|
|
3216
|
-
t.count != null ? /* @__PURE__ */
|
|
3246
|
+
t.count != null ? /* @__PURE__ */ React25.createElement("span", { className: "aura-tab__count" }, t.count) : null
|
|
3217
3247
|
);
|
|
3218
3248
|
})
|
|
3219
|
-
), current2 && current2.content !== void 0 ? /* @__PURE__ */
|
|
3249
|
+
), current2 && current2.content !== void 0 ? /* @__PURE__ */ React25.createElement(
|
|
3220
3250
|
"div",
|
|
3221
3251
|
{
|
|
3222
3252
|
role: "tabpanel",
|
|
@@ -3228,7 +3258,10 @@ var Tabs = React17.forwardRef(function Tabs2(props, ref) {
|
|
|
3228
3258
|
current2.content
|
|
3229
3259
|
) : null);
|
|
3230
3260
|
});
|
|
3231
|
-
|
|
3261
|
+
|
|
3262
|
+
// src/SideNav.tsx
|
|
3263
|
+
var React26 = __toESM(require("react"), 1);
|
|
3264
|
+
var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
3232
3265
|
const t = useStrings();
|
|
3233
3266
|
const st = useMaybeControlled(
|
|
3234
3267
|
props.value,
|
|
@@ -3238,9 +3271,9 @@ var SideNav = React17.forwardRef(function SideNav2(props, ref) {
|
|
|
3238
3271
|
function item(it) {
|
|
3239
3272
|
const on = st[0] === it.id;
|
|
3240
3273
|
const inner = [
|
|
3241
|
-
it.icon ? /* @__PURE__ */
|
|
3242
|
-
/* @__PURE__ */
|
|
3243
|
-
it.count != null ? /* @__PURE__ */
|
|
3274
|
+
it.icon ? /* @__PURE__ */ React26.createElement(Icon, { key: "i", name: it.icon }) : null,
|
|
3275
|
+
/* @__PURE__ */ React26.createElement("span", { key: "l", className: "aura-nav__label" }, it.label),
|
|
3276
|
+
it.count != null ? /* @__PURE__ */ React26.createElement("span", { key: "c", className: "aura-nav__count" }, it.count) : null
|
|
3244
3277
|
];
|
|
3245
3278
|
const common = {
|
|
3246
3279
|
className: cx("aura-nav__item", on && "is-active"),
|
|
@@ -3250,33 +3283,39 @@ var SideNav = React17.forwardRef(function SideNav2(props, ref) {
|
|
|
3250
3283
|
st[1](it.id);
|
|
3251
3284
|
}
|
|
3252
3285
|
};
|
|
3253
|
-
return /* @__PURE__ */
|
|
3286
|
+
return /* @__PURE__ */ React26.createElement("li", { key: it.id }, it.href ? /* @__PURE__ */ React26.createElement("a", { href: it.href, ...common }, inner) : /* @__PURE__ */ React26.createElement("button", { type: "button", ...common }, inner));
|
|
3254
3287
|
}
|
|
3255
|
-
return /* @__PURE__ */
|
|
3256
|
-
return /* @__PURE__ */
|
|
3257
|
-
})), props.footer ? /* @__PURE__ */
|
|
3288
|
+
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) {
|
|
3289
|
+
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)));
|
|
3290
|
+
})), props.footer ? /* @__PURE__ */ React26.createElement("div", { className: "aura-nav__footer" }, props.footer) : null);
|
|
3258
3291
|
});
|
|
3259
|
-
|
|
3292
|
+
|
|
3293
|
+
// src/Breadcrumb.tsx
|
|
3294
|
+
var React27 = __toESM(require("react"), 1);
|
|
3295
|
+
var Breadcrumb = React27.forwardRef(function Breadcrumb2(props, ref) {
|
|
3260
3296
|
const t = useStrings();
|
|
3261
3297
|
const items = props.items || [];
|
|
3262
|
-
return /* @__PURE__ */
|
|
3298
|
+
return /* @__PURE__ */ React27.createElement("nav", { ref, "aria-label": props.label || t.breadcrumb, className: cx("aura-crumbs", props.className) }, /* @__PURE__ */ React27.createElement("ol", null, items.map(function(it, i) {
|
|
3263
3299
|
const last = i === items.length - 1;
|
|
3264
|
-
return /* @__PURE__ */
|
|
3300
|
+
return /* @__PURE__ */ React27.createElement("li", { key: i }, last ? /* @__PURE__ */ React27.createElement("span", { "aria-current": "page", className: "aura-crumbs__current" }, it.label) : it.href ? /* @__PURE__ */ React27.createElement("a", { href: it.href, onClick: it.onClick }, it.label) : /* @__PURE__ */ React27.createElement("button", { type: "button", onClick: it.onClick }, it.label), last ? null : /* @__PURE__ */ React27.createElement(Icon, { name: "chevron-right", size: 12, className: "aura-crumbs__sep" }));
|
|
3265
3301
|
})));
|
|
3266
3302
|
});
|
|
3303
|
+
|
|
3304
|
+
// src/Avatar.tsx
|
|
3305
|
+
var React28 = __toESM(require("react"), 1);
|
|
3267
3306
|
var AVATAR_TONES = ["progress", "ready", "neutral", "warning"];
|
|
3268
3307
|
function initials(name) {
|
|
3269
3308
|
const parts = String(name || "?").trim().split(/\s+/);
|
|
3270
3309
|
return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
|
|
3271
3310
|
}
|
|
3272
|
-
var Avatar =
|
|
3273
|
-
const size = props.size || "md", errState =
|
|
3311
|
+
var Avatar = React28.forwardRef(function Avatar2(props, ref) {
|
|
3312
|
+
const size = props.size || "md", errState = React28.useState(false);
|
|
3274
3313
|
let hash = 0;
|
|
3275
3314
|
String(props.name || "").split("").forEach(function(ch) {
|
|
3276
3315
|
hash = hash * 31 + ch.charCodeAt(0) >>> 0;
|
|
3277
3316
|
});
|
|
3278
3317
|
const tone2 = AVATAR_TONES[hash % AVATAR_TONES.length];
|
|
3279
|
-
return /* @__PURE__ */
|
|
3318
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3280
3319
|
"span",
|
|
3281
3320
|
{
|
|
3282
3321
|
ref,
|
|
@@ -3284,7 +3323,7 @@ var Avatar = React17.forwardRef(function Avatar2(props, ref) {
|
|
|
3284
3323
|
role: "img",
|
|
3285
3324
|
"aria-label": props.name + (props.status ? ", " + props.status : "")
|
|
3286
3325
|
},
|
|
3287
|
-
props.src && !errState[0] ? /* @__PURE__ */
|
|
3326
|
+
props.src && !errState[0] ? /* @__PURE__ */ React28.createElement(
|
|
3288
3327
|
"img",
|
|
3289
3328
|
{
|
|
3290
3329
|
src: props.src,
|
|
@@ -3293,18 +3332,20 @@ var Avatar = React17.forwardRef(function Avatar2(props, ref) {
|
|
|
3293
3332
|
errState[1](true);
|
|
3294
3333
|
}
|
|
3295
3334
|
}
|
|
3296
|
-
) : /* @__PURE__ */
|
|
3297
|
-
props.status === "online" ? /* @__PURE__ */
|
|
3335
|
+
) : /* @__PURE__ */ React28.createElement("span", { "aria-hidden": true }, initials(props.name)),
|
|
3336
|
+
props.status === "online" ? /* @__PURE__ */ React28.createElement("span", { className: "aura-avatar__status", "aria-hidden": true }) : null
|
|
3298
3337
|
);
|
|
3299
3338
|
});
|
|
3300
3339
|
|
|
3301
|
-
// src/
|
|
3302
|
-
var
|
|
3303
|
-
|
|
3340
|
+
// src/Stack.tsx
|
|
3341
|
+
var React30 = __toESM(require("react"), 1);
|
|
3342
|
+
|
|
3343
|
+
// src/responsive.tsx
|
|
3344
|
+
var React29 = __toESM(require("react"), 1);
|
|
3304
3345
|
var breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
3305
3346
|
var ORDER = ["base", "sm", "md", "lg", "xl"];
|
|
3306
3347
|
function useBreakpoint() {
|
|
3307
|
-
return
|
|
3348
|
+
return React29.useSyncExternalStore(subscribe, current, function() {
|
|
3308
3349
|
return "lg";
|
|
3309
3350
|
});
|
|
3310
3351
|
}
|
|
@@ -3342,7 +3383,10 @@ function respVars(prefix, value, map) {
|
|
|
3342
3383
|
var space = function(v) {
|
|
3343
3384
|
return typeof v === "number" ? "var(--aura-space-" + v + ")" : v;
|
|
3344
3385
|
};
|
|
3345
|
-
|
|
3386
|
+
|
|
3387
|
+
// src/Stack.tsx
|
|
3388
|
+
var h5 = React30.createElement;
|
|
3389
|
+
var Stack = React30.forwardRef(function Stack2(props, ref) {
|
|
3346
3390
|
const style = Object.assign(
|
|
3347
3391
|
{},
|
|
3348
3392
|
respVars("aura-stack-dir", props.direction || "column"),
|
|
@@ -3352,23 +3396,31 @@ var Stack = React18.forwardRef(function Stack2(props, ref) {
|
|
|
3352
3396
|
props.wrap ? { flexWrap: "wrap" } : null,
|
|
3353
3397
|
props.style
|
|
3354
3398
|
);
|
|
3355
|
-
return
|
|
3399
|
+
return h5(props.as || "div", { ref, className: cx("aura-stack", props.className), style }, props.children);
|
|
3356
3400
|
});
|
|
3357
|
-
|
|
3401
|
+
|
|
3402
|
+
// src/Grid.tsx
|
|
3403
|
+
var React31 = __toESM(require("react"), 1);
|
|
3404
|
+
var h6 = React31.createElement;
|
|
3405
|
+
var Grid = React31.forwardRef(function Grid2(props, ref) {
|
|
3358
3406
|
const style = Object.assign(
|
|
3359
3407
|
{},
|
|
3360
3408
|
respVars("aura-grid-gap", props.gap == null ? 6 : props.gap, space),
|
|
3361
3409
|
props.minItemWidth ? { gridTemplateColumns: "repeat(auto-fill, minmax(min(" + props.minItemWidth + "px, 100%), 1fr))" } : respVars("aura-grid-cols", props.columns || 1),
|
|
3362
3410
|
props.style
|
|
3363
3411
|
);
|
|
3364
|
-
return
|
|
3412
|
+
return h6(
|
|
3365
3413
|
props.as || "div",
|
|
3366
3414
|
{ ref, className: cx("aura-grid-layout", props.minItemWidth && "is-auto", props.className), style },
|
|
3367
3415
|
props.children
|
|
3368
3416
|
);
|
|
3369
3417
|
});
|
|
3370
|
-
|
|
3371
|
-
|
|
3418
|
+
|
|
3419
|
+
// src/Container.tsx
|
|
3420
|
+
var React32 = __toESM(require("react"), 1);
|
|
3421
|
+
var h7 = React32.createElement;
|
|
3422
|
+
var Container = React32.forwardRef(function Container2(props, ref) {
|
|
3423
|
+
return h7(
|
|
3372
3424
|
props.as || "div",
|
|
3373
3425
|
{
|
|
3374
3426
|
ref,
|
|
@@ -3378,26 +3430,29 @@ var Container = React18.forwardRef(function Container2(props, ref) {
|
|
|
3378
3430
|
props.children
|
|
3379
3431
|
);
|
|
3380
3432
|
});
|
|
3381
|
-
|
|
3433
|
+
|
|
3434
|
+
// src/AppShell.tsx
|
|
3435
|
+
var React33 = __toESM(require("react"), 1);
|
|
3436
|
+
var AppShell = React33.forwardRef(function AppShell2(props, ref) {
|
|
3382
3437
|
const t = useStrings();
|
|
3383
3438
|
const bp = useBreakpoint();
|
|
3384
3439
|
const compact = bp === "base" || bp === "sm" || bp === "md";
|
|
3385
|
-
const st =
|
|
3386
|
-
|
|
3440
|
+
const st = React33.useState(false), open = st[0], setOpen = st[1];
|
|
3441
|
+
React33.useEffect(
|
|
3387
3442
|
function() {
|
|
3388
3443
|
if (!compact) setOpen(false);
|
|
3389
3444
|
},
|
|
3390
3445
|
[compact]
|
|
3391
3446
|
);
|
|
3392
3447
|
const navEl = props.nav;
|
|
3393
|
-
const nav = props.nav &&
|
|
3448
|
+
const nav = props.nav && React33.isValidElement(props.nav) && compact ? React33.cloneElement(navEl, {
|
|
3394
3449
|
onChange: function(id) {
|
|
3395
3450
|
if (navEl.props.onChange) navEl.props.onChange(id);
|
|
3396
3451
|
setOpen(false);
|
|
3397
3452
|
},
|
|
3398
3453
|
className: cx(navEl.props.className, "is-in-drawer")
|
|
3399
3454
|
}) : props.nav;
|
|
3400
|
-
return /* @__PURE__ */
|
|
3455
|
+
return /* @__PURE__ */ React33.createElement("div", { ref, className: cx("aura-shell", compact && "is-compact", props.className) }, !compact ? /* @__PURE__ */ React33.createElement("div", { className: "aura-shell__nav" }, nav) : null, compact ? /* @__PURE__ */ React33.createElement(
|
|
3401
3456
|
Drawer,
|
|
3402
3457
|
{
|
|
3403
3458
|
open,
|
|
@@ -3410,7 +3465,7 @@ var AppShell = React18.forwardRef(function AppShell2(props, ref) {
|
|
|
3410
3465
|
dismissible: true
|
|
3411
3466
|
},
|
|
3412
3467
|
nav
|
|
3413
|
-
) : null, /* @__PURE__ */
|
|
3468
|
+
) : null, /* @__PURE__ */ React33.createElement("div", { className: "aura-shell__main" }, props.header || compact ? /* @__PURE__ */ React33.createElement("header", { className: "aura-shell__bar" }, compact ? /* @__PURE__ */ React33.createElement(
|
|
3414
3469
|
IconButton,
|
|
3415
3470
|
{
|
|
3416
3471
|
icon: "menu",
|
|
@@ -3421,16 +3476,16 @@ var AppShell = React18.forwardRef(function AppShell2(props, ref) {
|
|
|
3421
3476
|
},
|
|
3422
3477
|
"aria-expanded": open
|
|
3423
3478
|
}
|
|
3424
|
-
) : null, /* @__PURE__ */
|
|
3479
|
+
) : null, /* @__PURE__ */ React33.createElement("div", { className: "aura-shell__bar-content" }, props.header)) : null, /* @__PURE__ */ React33.createElement("main", { className: "aura-shell__content", id: props.mainId || "main" }, props.children)));
|
|
3425
3480
|
});
|
|
3426
3481
|
|
|
3427
3482
|
// src/Surface.tsx
|
|
3428
|
-
var
|
|
3429
|
-
var
|
|
3430
|
-
var Surface =
|
|
3483
|
+
var React34 = __toESM(require("react"), 1);
|
|
3484
|
+
var h8 = React34.createElement;
|
|
3485
|
+
var Surface = React34.forwardRef(function Surface2(props, ref) {
|
|
3431
3486
|
const t = props.texture || "mesh";
|
|
3432
3487
|
const rest = omit(props, ["texture", "className", "children", "as"]);
|
|
3433
|
-
return
|
|
3488
|
+
return h8(
|
|
3434
3489
|
props.as || "div",
|
|
3435
3490
|
Object.assign({}, rest, {
|
|
3436
3491
|
ref,
|
|
@@ -3448,14 +3503,14 @@ var Surface = React19.forwardRef(function Surface2(props, ref) {
|
|
|
3448
3503
|
});
|
|
3449
3504
|
|
|
3450
3505
|
// src/Stat.tsx
|
|
3451
|
-
var
|
|
3452
|
-
var Stat =
|
|
3506
|
+
var React35 = __toESM(require("react"), 1);
|
|
3507
|
+
var Stat = React35.forwardRef(function Stat2(props, ref) {
|
|
3453
3508
|
const ch = props.change;
|
|
3454
3509
|
const dir = ch && (ch.direction || "flat");
|
|
3455
3510
|
const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
|
|
3456
3511
|
const Tag3 = props.href ? "a" : props.onClick ? "button" : "div";
|
|
3457
3512
|
const interactive = Tag3 !== "div";
|
|
3458
|
-
return /* @__PURE__ */
|
|
3513
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3459
3514
|
Tag3,
|
|
3460
3515
|
{
|
|
3461
3516
|
ref,
|
|
@@ -3465,15 +3520,15 @@ var Stat = React20.forwardRef(function Stat2(props, ref) {
|
|
|
3465
3520
|
type: Tag3 === "button" ? "button" : void 0,
|
|
3466
3521
|
"aria-busy": props.loading || void 0
|
|
3467
3522
|
},
|
|
3468
|
-
/* @__PURE__ */
|
|
3469
|
-
props.loading ? /* @__PURE__ */
|
|
3470
|
-
ch && !props.loading || props.caption ? /* @__PURE__ */
|
|
3523
|
+
/* @__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),
|
|
3524
|
+
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),
|
|
3525
|
+
ch && !props.loading || props.caption ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__foot" }, ch && !props.loading ? /* @__PURE__ */ React35.createElement("span", { className: cx("aura-stat__change", "is-" + tone2) }, /* @__PURE__ */ React35.createElement(Icon, { name: dir === "up" ? "trending-up" : dir === "down" ? "trending-down" : "minus", size: 14 }), /* @__PURE__ */ React35.createElement("span", null, ch.value)) : null, ch && ch.label && !props.loading ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__caption" }, ch.label) : null, props.caption ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__caption" }, props.caption) : null) : null
|
|
3471
3526
|
);
|
|
3472
3527
|
});
|
|
3473
3528
|
|
|
3474
3529
|
// src/TimePicker.tsx
|
|
3475
|
-
var
|
|
3476
|
-
var
|
|
3530
|
+
var React36 = __toESM(require("react"), 1);
|
|
3531
|
+
var import_react_dom7 = require("react-dom");
|
|
3477
3532
|
function pad2(n2) {
|
|
3478
3533
|
return (n2 < 10 ? "0" : "") + n2;
|
|
3479
3534
|
}
|
|
@@ -3496,7 +3551,7 @@ function parseTime(text) {
|
|
|
3496
3551
|
if (hh > 23 || mm > 59) return null;
|
|
3497
3552
|
return pad2(hh) + ":" + pad2(mm);
|
|
3498
3553
|
}
|
|
3499
|
-
var TimePicker =
|
|
3554
|
+
var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
3500
3555
|
const t = useStrings();
|
|
3501
3556
|
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
3502
3557
|
const st = useMaybeControlled(
|
|
@@ -3506,7 +3561,7 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3506
3561
|
);
|
|
3507
3562
|
const value = st[0];
|
|
3508
3563
|
const step = props.step || 30, lo = toMin(props.min) != null ? toMin(props.min) : 0, hi = toMin(props.max) != null ? toMin(props.max) : 24 * 60 - 1;
|
|
3509
|
-
const slots =
|
|
3564
|
+
const slots = React36.useMemo(
|
|
3510
3565
|
function() {
|
|
3511
3566
|
const out = [];
|
|
3512
3567
|
for (let m = lo; m <= hi; m += step) out.push(fromMin(m));
|
|
@@ -3518,12 +3573,12 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3518
3573
|
const n2 = toMin(v);
|
|
3519
3574
|
return n2 == null || n2 < lo || n2 > hi || props.isTimeDisabled && props.isTimeDisabled(v);
|
|
3520
3575
|
}
|
|
3521
|
-
const openState =
|
|
3522
|
-
const editState =
|
|
3523
|
-
const aState =
|
|
3524
|
-
const errState =
|
|
3525
|
-
const pos =
|
|
3526
|
-
const boxRef =
|
|
3576
|
+
const openState = React36.useState(false), open = openState[0], setOpen = openState[1];
|
|
3577
|
+
const editState = React36.useState(null), editing = editState[0], setEditing = editState[1];
|
|
3578
|
+
const aState = React36.useState(0), active = aState[0], setActive = aState[1];
|
|
3579
|
+
const errState = React36.useState(null);
|
|
3580
|
+
const pos = React36.useState(null);
|
|
3581
|
+
const boxRef = React36.useRef(null), inputRef = React36.useRef(null), listRef = React36.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
3527
3582
|
const mounted = useMounted();
|
|
3528
3583
|
function nearest(v) {
|
|
3529
3584
|
const n2 = toMin(v);
|
|
@@ -3551,7 +3606,7 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3551
3606
|
},
|
|
3552
3607
|
[open]
|
|
3553
3608
|
);
|
|
3554
|
-
|
|
3609
|
+
React36.useEffect(
|
|
3555
3610
|
function() {
|
|
3556
3611
|
if (!open) return;
|
|
3557
3612
|
function outside(e) {
|
|
@@ -3573,7 +3628,7 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3573
3628
|
},
|
|
3574
3629
|
[open]
|
|
3575
3630
|
);
|
|
3576
|
-
|
|
3631
|
+
React36.useEffect(
|
|
3577
3632
|
function() {
|
|
3578
3633
|
if (!open || !listRef.current) return;
|
|
3579
3634
|
const el = listRef.current.querySelector('[data-idx="' + active + '"]');
|
|
@@ -3670,10 +3725,10 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3670
3725
|
}
|
|
3671
3726
|
}
|
|
3672
3727
|
const error = errState[0] || props.error;
|
|
3673
|
-
const list = open && mounted && pos[0] ? (0,
|
|
3674
|
-
/* @__PURE__ */
|
|
3728
|
+
const list = open && mounted && pos[0] ? (0, import_react_dom7.createPortal)(
|
|
3729
|
+
/* @__PURE__ */ React36.createElement("div", { ref: listRef, className: "aura-combo__popover aura-time__popover", style: pos[0] }, /* @__PURE__ */ React36.createElement("ul", { id: listId, role: "listbox", "aria-label": props.label, className: "aura-combo__list" }, slots.map(function(s, i) {
|
|
3675
3730
|
const dis = blocked(s), sel = s === value;
|
|
3676
|
-
return /* @__PURE__ */
|
|
3731
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3677
3732
|
"li",
|
|
3678
3733
|
{
|
|
3679
3734
|
key: s,
|
|
@@ -3698,13 +3753,13 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3698
3753
|
if (active !== i) setActive(i);
|
|
3699
3754
|
}
|
|
3700
3755
|
},
|
|
3701
|
-
/* @__PURE__ */
|
|
3702
|
-
sel ? /* @__PURE__ */
|
|
3756
|
+
/* @__PURE__ */ React36.createElement("span", { className: "aura-combo__label" }, s),
|
|
3757
|
+
sel ? /* @__PURE__ */ React36.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
3703
3758
|
);
|
|
3704
3759
|
}))),
|
|
3705
3760
|
document.body
|
|
3706
3761
|
) : null;
|
|
3707
|
-
return /* @__PURE__ */
|
|
3762
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3708
3763
|
Field,
|
|
3709
3764
|
{
|
|
3710
3765
|
id,
|
|
@@ -3716,7 +3771,7 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3716
3771
|
disabled: props.disabled,
|
|
3717
3772
|
className: props.className
|
|
3718
3773
|
},
|
|
3719
|
-
/* @__PURE__ */
|
|
3774
|
+
/* @__PURE__ */ React36.createElement("div", { ref: boxRef, className: cx("aura-input aura-combo aura-time has-icon", open && "is-open") }, /* @__PURE__ */ React36.createElement(Icon, { name: "clock", className: "aura-input__icon" }), /* @__PURE__ */ React36.createElement(
|
|
3720
3775
|
"input",
|
|
3721
3776
|
{
|
|
3722
3777
|
ref: inputMerged,
|
|
@@ -3756,7 +3811,7 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3756
3811
|
}, 0);
|
|
3757
3812
|
}
|
|
3758
3813
|
}
|
|
3759
|
-
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */
|
|
3814
|
+
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */ React36.createElement(
|
|
3760
3815
|
"button",
|
|
3761
3816
|
{
|
|
3762
3817
|
type: "button",
|
|
@@ -3769,8 +3824,8 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3769
3824
|
if (inputRef.current) inputRef.current.focus();
|
|
3770
3825
|
}
|
|
3771
3826
|
},
|
|
3772
|
-
/* @__PURE__ */
|
|
3773
|
-
) : null, /* @__PURE__ */
|
|
3827
|
+
/* @__PURE__ */ React36.createElement(Icon, { name: "x" })
|
|
3828
|
+
) : null, /* @__PURE__ */ React36.createElement(
|
|
3774
3829
|
"button",
|
|
3775
3830
|
{
|
|
3776
3831
|
type: "button",
|
|
@@ -3788,14 +3843,14 @@ var TimePicker = React21.forwardRef(function TimePicker2(props, ref) {
|
|
|
3788
3843
|
}
|
|
3789
3844
|
}
|
|
3790
3845
|
},
|
|
3791
|
-
/* @__PURE__ */
|
|
3846
|
+
/* @__PURE__ */ React36.createElement(Icon, { name: "chevron-down" })
|
|
3792
3847
|
)),
|
|
3793
3848
|
list
|
|
3794
3849
|
);
|
|
3795
3850
|
});
|
|
3796
3851
|
|
|
3797
3852
|
// src/FileUpload.tsx
|
|
3798
|
-
var
|
|
3853
|
+
var React37 = __toESM(require("react"), 1);
|
|
3799
3854
|
function formatBytes(n2) {
|
|
3800
3855
|
if (n2 == null) return "";
|
|
3801
3856
|
if (n2 < 1024) return n2 + " B";
|
|
@@ -3829,17 +3884,17 @@ function describeAccept(accept, t) {
|
|
|
3829
3884
|
}).join(", ");
|
|
3830
3885
|
}
|
|
3831
3886
|
var seq = 0;
|
|
3832
|
-
var FileUpload =
|
|
3887
|
+
var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
3833
3888
|
const t = useStrings();
|
|
3834
3889
|
const auto = uid(), id = props.id || auto;
|
|
3835
3890
|
const st = useMaybeControlled(props.value, props.defaultValue || [], props.onChange);
|
|
3836
3891
|
const items = st[0] || [];
|
|
3837
|
-
const dragState =
|
|
3838
|
-
const inputRef =
|
|
3839
|
-
const urls =
|
|
3892
|
+
const dragState = React37.useState(false), over = dragState[0];
|
|
3893
|
+
const inputRef = React37.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
3894
|
+
const urls = React37.useRef({});
|
|
3840
3895
|
const maxFiles = props.multiple ? props.maxFiles : 1;
|
|
3841
3896
|
const note = t.accepts(describeAccept(props.accept, t), props.maxSize ? formatBytes(props.maxSize) : "");
|
|
3842
|
-
|
|
3897
|
+
React37.useEffect(function() {
|
|
3843
3898
|
return function() {
|
|
3844
3899
|
Object.keys(urls.current).forEach(function(k) {
|
|
3845
3900
|
URL.revokeObjectURL(urls.current[k]);
|
|
@@ -3890,7 +3945,7 @@ var FileUpload = React22.forwardRef(function FileUpload2(props, ref) {
|
|
|
3890
3945
|
if (inputRef.current) inputRef.current.focus();
|
|
3891
3946
|
}
|
|
3892
3947
|
const error = props.error;
|
|
3893
|
-
return /* @__PURE__ */
|
|
3948
|
+
return /* @__PURE__ */ React37.createElement(
|
|
3894
3949
|
Field,
|
|
3895
3950
|
{
|
|
3896
3951
|
id,
|
|
@@ -3902,7 +3957,7 @@ var FileUpload = React22.forwardRef(function FileUpload2(props, ref) {
|
|
|
3902
3957
|
disabled: props.disabled,
|
|
3903
3958
|
className: props.className
|
|
3904
3959
|
},
|
|
3905
|
-
/* @__PURE__ */
|
|
3960
|
+
/* @__PURE__ */ React37.createElement(
|
|
3906
3961
|
"div",
|
|
3907
3962
|
{
|
|
3908
3963
|
className: cx("aura-upload", over && "is-over", props.disabled && "is-disabled", error && "is-invalid"),
|
|
@@ -3923,9 +3978,9 @@ var FileUpload = React22.forwardRef(function FileUpload2(props, ref) {
|
|
|
3923
3978
|
add(e.dataTransfer && e.dataTransfer.files);
|
|
3924
3979
|
}
|
|
3925
3980
|
},
|
|
3926
|
-
/* @__PURE__ */
|
|
3927
|
-
/* @__PURE__ */
|
|
3928
|
-
/* @__PURE__ */
|
|
3981
|
+
/* @__PURE__ */ React37.createElement(Icon, { name: "cloud-upload", size: "lg", className: "aura-upload__icon" }),
|
|
3982
|
+
/* @__PURE__ */ React37.createElement("span", { className: "aura-upload__text" }, t.dropFiles, " "),
|
|
3983
|
+
/* @__PURE__ */ React37.createElement(
|
|
3929
3984
|
"input",
|
|
3930
3985
|
{
|
|
3931
3986
|
ref: inputMerged,
|
|
@@ -3947,12 +4002,12 @@ var FileUpload = React22.forwardRef(function FileUpload2(props, ref) {
|
|
|
3947
4002
|
}
|
|
3948
4003
|
}
|
|
3949
4004
|
),
|
|
3950
|
-
/* @__PURE__ */
|
|
3951
|
-
note ? /* @__PURE__ */
|
|
4005
|
+
/* @__PURE__ */ React37.createElement("span", { className: "aura-upload__browse", "aria-hidden": true }, props.multiple ? t.browse : t.browseOne),
|
|
4006
|
+
note ? /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__note", id: id + "-note" }, note) : null
|
|
3952
4007
|
),
|
|
3953
|
-
items.length ? /* @__PURE__ */
|
|
4008
|
+
items.length ? /* @__PURE__ */ React37.createElement("ul", { className: "aura-upload__list", "aria-live": "polite" }, items.map(function(it) {
|
|
3954
4009
|
const src = thumb(it);
|
|
3955
|
-
return /* @__PURE__ */
|
|
4010
|
+
return /* @__PURE__ */ React37.createElement("li", { key: it.id, className: cx("aura-upload__item", it.error && "is-error") }, src ? /* @__PURE__ */ React37.createElement("img", { className: "aura-upload__thumb", src, alt: "" }) : /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__thumb is-icon", "aria-hidden": true }, /* @__PURE__ */ React37.createElement(Icon, { name: /^image\//.test(it.type || "") ? "image" : "file", size: "md" })), /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__meta" }, /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__name" }, it.name), /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__sub" }, it.error ? /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement(Icon, { name: "circle-alert", size: 12 }), it.error) : it.status === "uploading" ? t.uploading + (it.progress != null ? " " + Math.round(it.progress) + "%" : "") : it.status === "done" ? /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement(Icon, { name: "circle-check", size: 12 }), formatBytes(it.size)) : formatBytes(it.size)), it.status === "uploading" ? /* @__PURE__ */ React37.createElement(
|
|
3956
4011
|
"span",
|
|
3957
4012
|
{
|
|
3958
4013
|
className: "aura-upload__bar",
|
|
@@ -3962,8 +4017,8 @@ var FileUpload = React22.forwardRef(function FileUpload2(props, ref) {
|
|
|
3962
4017
|
"aria-valuemax": 100,
|
|
3963
4018
|
"aria-valuenow": it.progress != null ? Math.round(it.progress) : void 0
|
|
3964
4019
|
},
|
|
3965
|
-
/* @__PURE__ */
|
|
3966
|
-
) : null), /* @__PURE__ */
|
|
4020
|
+
/* @__PURE__ */ React37.createElement("span", { style: { width: (it.progress || 0) + "%" } })
|
|
4021
|
+
) : null), /* @__PURE__ */ React37.createElement(
|
|
3967
4022
|
IconButton,
|
|
3968
4023
|
{
|
|
3969
4024
|
icon: "x",
|
|
@@ -3979,14 +4034,14 @@ var FileUpload = React22.forwardRef(function FileUpload2(props, ref) {
|
|
|
3979
4034
|
|
|
3980
4035
|
// src/theme.ts
|
|
3981
4036
|
function hexToRgb(hex) {
|
|
3982
|
-
let
|
|
3983
|
-
if (
|
|
3984
|
-
|
|
4037
|
+
let h9 = String(hex).trim().replace("#", "");
|
|
4038
|
+
if (h9.length === 3)
|
|
4039
|
+
h9 = h9.split("").map(function(c) {
|
|
3985
4040
|
return c + c;
|
|
3986
4041
|
}).join("");
|
|
3987
|
-
if (!/^[0-9a-f]{6}$/i.test(
|
|
4042
|
+
if (!/^[0-9a-f]{6}$/i.test(h9)) throw new Error('createTheme: "' + hex + '" is not a #rgb or #rrggbb colour');
|
|
3988
4043
|
return [0, 2, 4].map(function(i) {
|
|
3989
|
-
return parseInt(
|
|
4044
|
+
return parseInt(h9.slice(i, i + 2), 16) / 255;
|
|
3990
4045
|
});
|
|
3991
4046
|
}
|
|
3992
4047
|
function rgbToHex(rgb) {
|
|
@@ -4213,9 +4268,9 @@ function createTheme(opts) {
|
|
|
4213
4268
|
}
|
|
4214
4269
|
|
|
4215
4270
|
// src/ThemeStyle.tsx
|
|
4216
|
-
var
|
|
4271
|
+
var React38 = __toESM(require("react"), 1);
|
|
4217
4272
|
function ThemeStyle(props) {
|
|
4218
|
-
const css =
|
|
4273
|
+
const css = React38.useMemo(
|
|
4219
4274
|
function() {
|
|
4220
4275
|
return createTheme({ brand: props.brand, signal: props.signal, primary: props.primary, name: props.name }).css(
|
|
4221
4276
|
props.selector
|
|
@@ -4223,11 +4278,11 @@ function ThemeStyle(props) {
|
|
|
4223
4278
|
},
|
|
4224
4279
|
[props.brand, props.signal, props.primary, props.name, props.selector]
|
|
4225
4280
|
);
|
|
4226
|
-
return /* @__PURE__ */
|
|
4281
|
+
return /* @__PURE__ */ React38.createElement("style", { "data-aura-theme": props.name || props.brand, dangerouslySetInnerHTML: { __html: css } });
|
|
4227
4282
|
}
|
|
4228
4283
|
|
|
4229
4284
|
// src/colorScheme.tsx
|
|
4230
|
-
var
|
|
4285
|
+
var React39 = __toESM(require("react"), 1);
|
|
4231
4286
|
var DEFAULT_KEY = "aura-color-scheme";
|
|
4232
4287
|
var SCHEMES = ["light", "dark", "system"];
|
|
4233
4288
|
var EVENT = "aura-color-scheme";
|
|
@@ -4240,7 +4295,7 @@ function colorSchemeScript(options) {
|
|
|
4240
4295
|
return "(function(){try{var s=localStorage.getItem(" + key + ");if(s!=='light'&&s!=='dark'&&s!=='system')s=" + fallback + `;var d=document.documentElement;d.setAttribute("data-theme",s);var dark=s==='dark'||(s==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);d.classList.toggle("dark",dark);}catch(e){}})();`;
|
|
4241
4296
|
}
|
|
4242
4297
|
function ColorSchemeScript(props) {
|
|
4243
|
-
return /* @__PURE__ */
|
|
4298
|
+
return /* @__PURE__ */ React39.createElement("script", { "data-aura-color-scheme": "", dangerouslySetInnerHTML: { __html: colorSchemeScript(props) } });
|
|
4244
4299
|
}
|
|
4245
4300
|
function systemDark() {
|
|
4246
4301
|
return typeof window !== "undefined" && !!window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -4258,7 +4313,7 @@ function apply(scheme) {
|
|
|
4258
4313
|
function useColorScheme(options) {
|
|
4259
4314
|
const key = options && options.storageKey || DEFAULT_KEY;
|
|
4260
4315
|
const fallback = options && options.defaultScheme || "system";
|
|
4261
|
-
const subscribe2 =
|
|
4316
|
+
const subscribe2 = React39.useCallback(
|
|
4262
4317
|
function(cb) {
|
|
4263
4318
|
const mq = window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)") : null;
|
|
4264
4319
|
function onSystem() {
|
|
@@ -4276,7 +4331,7 @@ function useColorScheme(options) {
|
|
|
4276
4331
|
},
|
|
4277
4332
|
[fallback]
|
|
4278
4333
|
);
|
|
4279
|
-
const snapshot =
|
|
4334
|
+
const snapshot = React39.useSyncExternalStore(
|
|
4280
4335
|
subscribe2,
|
|
4281
4336
|
function() {
|
|
4282
4337
|
const s = readScheme(fallback);
|
|
@@ -4287,7 +4342,7 @@ function useColorScheme(options) {
|
|
|
4287
4342
|
}
|
|
4288
4343
|
);
|
|
4289
4344
|
const parts = snapshot.split("|");
|
|
4290
|
-
const setScheme =
|
|
4345
|
+
const setScheme = React39.useCallback(
|
|
4291
4346
|
function(next) {
|
|
4292
4347
|
if (!valid(next)) return;
|
|
4293
4348
|
try {
|
|
@@ -4306,11 +4361,11 @@ function ColorSchemeToggle(props) {
|
|
|
4306
4361
|
const cs = useColorScheme(props);
|
|
4307
4362
|
const names = { light: t.schemeLight, dark: t.schemeDark, system: t.schemeSystem };
|
|
4308
4363
|
const label = props.label || t.colorScheme;
|
|
4309
|
-
return /* @__PURE__ */
|
|
4364
|
+
return /* @__PURE__ */ React39.createElement(
|
|
4310
4365
|
DropdownMenu,
|
|
4311
4366
|
{
|
|
4312
4367
|
label,
|
|
4313
|
-
trigger: /* @__PURE__ */
|
|
4368
|
+
trigger: /* @__PURE__ */ React39.createElement(IconButton, { icon: cs.resolved === "dark" ? "moon" : "sun", label: label + ": " + names[cs.scheme] }),
|
|
4314
4369
|
items: SCHEMES.map(function(s) {
|
|
4315
4370
|
return {
|
|
4316
4371
|
label: names[s],
|
|
@@ -4324,16 +4379,11 @@ function ColorSchemeToggle(props) {
|
|
|
4324
4379
|
);
|
|
4325
4380
|
}
|
|
4326
4381
|
|
|
4327
|
-
// src/
|
|
4328
|
-
var
|
|
4329
|
-
var
|
|
4330
|
-
var TONES = ["neutral", "accent", "success", "warning", "danger"];
|
|
4331
|
-
function tone(t) {
|
|
4332
|
-
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
4333
|
-
}
|
|
4334
|
-
var Badge = React25.forwardRef(function Badge2(props, ref) {
|
|
4382
|
+
// src/Badge.tsx
|
|
4383
|
+
var React40 = __toESM(require("react"), 1);
|
|
4384
|
+
var Badge = React40.forwardRef(function Badge2(props, ref) {
|
|
4335
4385
|
const rest = omit(props, ["tone", "variant", "icon", "className", "children"]);
|
|
4336
|
-
return /* @__PURE__ */
|
|
4386
|
+
return /* @__PURE__ */ React40.createElement(
|
|
4337
4387
|
"span",
|
|
4338
4388
|
{
|
|
4339
4389
|
...rest,
|
|
@@ -4346,20 +4396,23 @@ var Badge = React25.forwardRef(function Badge2(props, ref) {
|
|
|
4346
4396
|
props.className
|
|
4347
4397
|
)
|
|
4348
4398
|
},
|
|
4349
|
-
props.icon ? /* @__PURE__ */
|
|
4399
|
+
props.icon ? /* @__PURE__ */ React40.createElement(Icon, { name: props.icon, size: 12 }) : null,
|
|
4350
4400
|
props.children
|
|
4351
4401
|
);
|
|
4352
4402
|
});
|
|
4353
|
-
|
|
4403
|
+
|
|
4404
|
+
// src/Tag.tsx
|
|
4405
|
+
var React41 = __toESM(require("react"), 1);
|
|
4406
|
+
var Tag = React41.forwardRef(function Tag2(props, ref) {
|
|
4354
4407
|
const t = useStrings();
|
|
4355
4408
|
const selectable = props.onClick != null || props.selected != null;
|
|
4356
4409
|
const rest = omit(props, ["onRemove", "selected", "icon", "className", "children", "disabled", "removeLabel"]);
|
|
4357
4410
|
const inner = [
|
|
4358
|
-
props.icon ? /* @__PURE__ */
|
|
4359
|
-
/* @__PURE__ */
|
|
4411
|
+
props.icon ? /* @__PURE__ */ React41.createElement(Icon, { key: "i", name: props.icon, size: 14 }) : null,
|
|
4412
|
+
/* @__PURE__ */ React41.createElement("span", { key: "t", className: "aura-tag__text" }, props.children)
|
|
4360
4413
|
];
|
|
4361
4414
|
if (selectable) {
|
|
4362
|
-
return /* @__PURE__ */
|
|
4415
|
+
return /* @__PURE__ */ React41.createElement(
|
|
4363
4416
|
"button",
|
|
4364
4417
|
{
|
|
4365
4418
|
...rest,
|
|
@@ -4369,11 +4422,11 @@ var Tag = React25.forwardRef(function Tag2(props, ref) {
|
|
|
4369
4422
|
disabled: props.disabled,
|
|
4370
4423
|
className: cx("aura-tag is-selectable", props.selected && "is-selected", props.className)
|
|
4371
4424
|
},
|
|
4372
|
-
props.selected ? /* @__PURE__ */
|
|
4425
|
+
props.selected ? /* @__PURE__ */ React41.createElement(Icon, { name: "check", size: 14 }) : inner[0],
|
|
4373
4426
|
inner[1]
|
|
4374
4427
|
);
|
|
4375
4428
|
}
|
|
4376
|
-
return /* @__PURE__ */
|
|
4429
|
+
return /* @__PURE__ */ React41.createElement("span", { ...rest, ref, className: cx("aura-tag", props.disabled && "is-disabled", props.className) }, inner, props.onRemove && !props.disabled ? /* @__PURE__ */ React41.createElement(
|
|
4377
4430
|
"button",
|
|
4378
4431
|
{
|
|
4379
4432
|
type: "button",
|
|
@@ -4381,15 +4434,18 @@ var Tag = React25.forwardRef(function Tag2(props, ref) {
|
|
|
4381
4434
|
"aria-label": props.removeLabel || t.remove(typeof props.children === "string" ? props.children : ""),
|
|
4382
4435
|
onClick: props.onRemove
|
|
4383
4436
|
},
|
|
4384
|
-
/* @__PURE__ */
|
|
4437
|
+
/* @__PURE__ */ React41.createElement(Icon, { name: "x", size: 12 })
|
|
4385
4438
|
) : null);
|
|
4386
4439
|
});
|
|
4387
|
-
|
|
4440
|
+
|
|
4441
|
+
// src/Progress.tsx
|
|
4442
|
+
var React42 = __toESM(require("react"), 1);
|
|
4443
|
+
var Progress = React42.forwardRef(function Progress2(props, ref) {
|
|
4388
4444
|
const auto = uid(), id = props.id || auto;
|
|
4389
4445
|
const max = props.max || 100, det = props.value != null;
|
|
4390
4446
|
const pct = det ? Math.max(0, Math.min(100, props.value / max * 100)) : 0;
|
|
4391
4447
|
const shown = props.valueLabel != null ? props.valueLabel : det ? Math.round(pct) + "%" : null;
|
|
4392
|
-
return /* @__PURE__ */
|
|
4448
|
+
return /* @__PURE__ */ React42.createElement(
|
|
4393
4449
|
"div",
|
|
4394
4450
|
{
|
|
4395
4451
|
ref,
|
|
@@ -4400,8 +4456,8 @@ var Progress = React25.forwardRef(function Progress2(props, ref) {
|
|
|
4400
4456
|
props.className
|
|
4401
4457
|
)
|
|
4402
4458
|
},
|
|
4403
|
-
props.label || props.showValue && shown ? /* @__PURE__ */
|
|
4404
|
-
/* @__PURE__ */
|
|
4459
|
+
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,
|
|
4460
|
+
/* @__PURE__ */ React42.createElement(
|
|
4405
4461
|
"div",
|
|
4406
4462
|
{
|
|
4407
4463
|
className: cx("aura-progress__track", !det && "is-indeterminate"),
|
|
@@ -4413,18 +4469,21 @@ var Progress = React25.forwardRef(function Progress2(props, ref) {
|
|
|
4413
4469
|
"aria-valuenow": det ? props.value : void 0,
|
|
4414
4470
|
"aria-valuetext": det && props.valueLabel != null ? String(props.valueLabel) : void 0
|
|
4415
4471
|
},
|
|
4416
|
-
/* @__PURE__ */
|
|
4472
|
+
/* @__PURE__ */ React42.createElement("span", { className: "aura-progress__bar", style: det ? { width: pct + "%" } : void 0 })
|
|
4417
4473
|
),
|
|
4418
|
-
props.hint ? /* @__PURE__ */
|
|
4474
|
+
props.hint ? /* @__PURE__ */ React42.createElement("p", { className: "aura-progress__hint" }, props.hint) : null
|
|
4419
4475
|
);
|
|
4420
4476
|
});
|
|
4421
|
-
|
|
4477
|
+
|
|
4478
|
+
// src/Skeleton.tsx
|
|
4479
|
+
var React43 = __toESM(require("react"), 1);
|
|
4480
|
+
var Skeleton = React43.forwardRef(function Skeleton2(props, ref) {
|
|
4422
4481
|
const v = props.variant || "text";
|
|
4423
4482
|
if (v === "text" && (props.lines || 1) > 1) {
|
|
4424
4483
|
const n2 = props.lines, rows = [];
|
|
4425
4484
|
for (let i = 0; i < n2; i++)
|
|
4426
|
-
rows.push(/* @__PURE__ */
|
|
4427
|
-
return /* @__PURE__ */
|
|
4485
|
+
rows.push(/* @__PURE__ */ React43.createElement("span", { key: i, className: "aura-skel aura-skel--text", style: { width: i === n2 - 1 ? "60%" : "100%" } }));
|
|
4486
|
+
return /* @__PURE__ */ React43.createElement(
|
|
4428
4487
|
"span",
|
|
4429
4488
|
{
|
|
4430
4489
|
ref,
|
|
@@ -4439,22 +4498,28 @@ var Skeleton = React25.forwardRef(function Skeleton2(props, ref) {
|
|
|
4439
4498
|
if (v === "circle") {
|
|
4440
4499
|
style.width = style.height = props.size || props.width || 40;
|
|
4441
4500
|
}
|
|
4442
|
-
return /* @__PURE__ */
|
|
4501
|
+
return /* @__PURE__ */ React43.createElement("span", { ref, "aria-hidden": true, className: cx("aura-skel", "aura-skel--" + v, props.className), style });
|
|
4443
4502
|
});
|
|
4444
|
-
|
|
4503
|
+
|
|
4504
|
+
// src/EmptyState.tsx
|
|
4505
|
+
var React44 = __toESM(require("react"), 1);
|
|
4506
|
+
var EmptyState = React44.forwardRef(function EmptyState2(props, ref) {
|
|
4445
4507
|
const HT = "h" + (props.headingLevel || 3);
|
|
4446
|
-
return /* @__PURE__ */
|
|
4508
|
+
return /* @__PURE__ */ React44.createElement(
|
|
4447
4509
|
"div",
|
|
4448
4510
|
{
|
|
4449
4511
|
ref,
|
|
4450
4512
|
className: cx("aura-empty", props.size === "sm" && "is-sm", props.bordered && "is-bordered", props.className)
|
|
4451
4513
|
},
|
|
4452
|
-
/* @__PURE__ */
|
|
4453
|
-
/* @__PURE__ */
|
|
4454
|
-
props.description ? /* @__PURE__ */
|
|
4455
|
-
props.action ? /* @__PURE__ */
|
|
4514
|
+
/* @__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" })),
|
|
4515
|
+
/* @__PURE__ */ React44.createElement(HT, { className: "aura-empty__title" }, props.title),
|
|
4516
|
+
props.description ? /* @__PURE__ */ React44.createElement("p", { className: "aura-empty__text" }, props.description) : null,
|
|
4517
|
+
props.action ? /* @__PURE__ */ React44.createElement("div", { className: "aura-empty__action" }, props.action) : null
|
|
4456
4518
|
);
|
|
4457
4519
|
});
|
|
4520
|
+
|
|
4521
|
+
// src/Pagination.tsx
|
|
4522
|
+
var React45 = __toESM(require("react"), 1);
|
|
4458
4523
|
function pageList(page, count, sib) {
|
|
4459
4524
|
let out = [], lo = Math.max(2, page - sib), hi = Math.min(count - 1, page + sib);
|
|
4460
4525
|
if (page - sib <= 3) {
|
|
@@ -4474,7 +4539,7 @@ function pageList(page, count, sib) {
|
|
|
4474
4539
|
if (count > 1) out.push(count);
|
|
4475
4540
|
return out;
|
|
4476
4541
|
}
|
|
4477
|
-
var Pagination =
|
|
4542
|
+
var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
4478
4543
|
const t = useStrings();
|
|
4479
4544
|
const count = Math.max(1, props.pageCount || 1);
|
|
4480
4545
|
const st = useMaybeControlled(props.page, props.defaultPage || 1, props.onChange);
|
|
@@ -4492,7 +4557,7 @@ var Pagination = React25.forwardRef(function Pagination2(props, ref) {
|
|
|
4492
4557
|
},
|
|
4493
4558
|
extra
|
|
4494
4559
|
);
|
|
4495
|
-
return link ? /* @__PURE__ */
|
|
4560
|
+
return link ? /* @__PURE__ */ React45.createElement(
|
|
4496
4561
|
"a",
|
|
4497
4562
|
{
|
|
4498
4563
|
href: link(p),
|
|
@@ -4505,7 +4570,7 @@ var Pagination = React25.forwardRef(function Pagination2(props, ref) {
|
|
|
4505
4570
|
...common
|
|
4506
4571
|
},
|
|
4507
4572
|
label
|
|
4508
|
-
) : /* @__PURE__ */
|
|
4573
|
+
) : /* @__PURE__ */ React45.createElement(
|
|
4509
4574
|
"button",
|
|
4510
4575
|
{
|
|
4511
4576
|
type: "button",
|
|
@@ -4517,7 +4582,7 @@ var Pagination = React25.forwardRef(function Pagination2(props, ref) {
|
|
|
4517
4582
|
label
|
|
4518
4583
|
);
|
|
4519
4584
|
}
|
|
4520
|
-
return /* @__PURE__ */
|
|
4585
|
+
return /* @__PURE__ */ React45.createElement("nav", { ref, className: cx("aura-pagination", props.className), "aria-label": props.label || t.pagination }, /* @__PURE__ */ React45.createElement(
|
|
4521
4586
|
IconButton,
|
|
4522
4587
|
{
|
|
4523
4588
|
icon: "chevron-left",
|
|
@@ -4527,9 +4592,9 @@ var Pagination = React25.forwardRef(function Pagination2(props, ref) {
|
|
|
4527
4592
|
go(page - 1);
|
|
4528
4593
|
}
|
|
4529
4594
|
}
|
|
4530
|
-
), /* @__PURE__ */
|
|
4531
|
-
return typeof p === "number" ? /* @__PURE__ */
|
|
4532
|
-
})), /* @__PURE__ */
|
|
4595
|
+
), /* @__PURE__ */ React45.createElement("ol", { className: "aura-pagination__list" }, pageList(page, count, props.siblingCount == null ? 1 : props.siblingCount).map(function(p) {
|
|
4596
|
+
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");
|
|
4597
|
+
})), /* @__PURE__ */ React45.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)), /* @__PURE__ */ React45.createElement(
|
|
4533
4598
|
IconButton,
|
|
4534
4599
|
{
|
|
4535
4600
|
icon: "chevron-right",
|
|
@@ -4541,7 +4606,10 @@ var Pagination = React25.forwardRef(function Pagination2(props, ref) {
|
|
|
4541
4606
|
}
|
|
4542
4607
|
));
|
|
4543
4608
|
});
|
|
4544
|
-
|
|
4609
|
+
|
|
4610
|
+
// src/Accordion.tsx
|
|
4611
|
+
var React46 = __toESM(require("react"), 1);
|
|
4612
|
+
var Accordion = React46.forwardRef(function Accordion2(props, ref) {
|
|
4545
4613
|
const auto = uid(), base = props.id || auto;
|
|
4546
4614
|
const multiple = props.type === "multiple";
|
|
4547
4615
|
const st = useMaybeControlled(
|
|
@@ -4579,9 +4647,9 @@ var Accordion = React25.forwardRef(function Accordion2(props, ref) {
|
|
|
4579
4647
|
n2.focus();
|
|
4580
4648
|
}
|
|
4581
4649
|
}
|
|
4582
|
-
return /* @__PURE__ */
|
|
4650
|
+
return /* @__PURE__ */ React46.createElement("div", { ref, className: cx("aura-accordion", props.className), onKeyDown: onKey }, items.map(function(it) {
|
|
4583
4651
|
const on = open.indexOf(it.id) >= 0, bid = base + "-btn-" + it.id, pid = base + "-panel-" + it.id;
|
|
4584
|
-
return /* @__PURE__ */
|
|
4652
|
+
return /* @__PURE__ */ React46.createElement("div", { key: it.id, className: cx("aura-accordion__item", on && "is-open") }, /* @__PURE__ */ React46.createElement(HT, { className: "aura-accordion__heading" }, /* @__PURE__ */ React46.createElement(
|
|
4585
4653
|
"button",
|
|
4586
4654
|
{
|
|
4587
4655
|
type: "button",
|
|
@@ -4593,12 +4661,16 @@ var Accordion = React25.forwardRef(function Accordion2(props, ref) {
|
|
|
4593
4661
|
toggle(it.id);
|
|
4594
4662
|
}
|
|
4595
4663
|
},
|
|
4596
|
-
it.icon ? /* @__PURE__ */
|
|
4597
|
-
/* @__PURE__ */
|
|
4598
|
-
/* @__PURE__ */
|
|
4599
|
-
)), /* @__PURE__ */
|
|
4664
|
+
it.icon ? /* @__PURE__ */ React46.createElement(Icon, { name: it.icon, className: "aura-accordion__lead" }) : null,
|
|
4665
|
+
/* @__PURE__ */ React46.createElement("span", { className: "aura-accordion__title" }, it.title, it.description ? /* @__PURE__ */ React46.createElement("span", { className: "aura-accordion__desc" }, it.description) : null),
|
|
4666
|
+
/* @__PURE__ */ React46.createElement(Icon, { name: "chevron-down", className: "aura-accordion__chevron" })
|
|
4667
|
+
)), /* @__PURE__ */ React46.createElement("div", { id: pid, role: "region", "aria-labelledby": bid, className: "aura-accordion__panel", hidden: !on }, it.content));
|
|
4600
4668
|
}));
|
|
4601
4669
|
});
|
|
4670
|
+
|
|
4671
|
+
// src/Popover.tsx
|
|
4672
|
+
var React47 = __toESM(require("react"), 1);
|
|
4673
|
+
var import_react_dom8 = require("react-dom");
|
|
4602
4674
|
function position(anchor, pop, placement) {
|
|
4603
4675
|
const r = anchor.getBoundingClientRect(), pw = pop.offsetWidth, ph = pop.offsetHeight, vw = window.innerWidth, vh = window.innerHeight, gap = 6;
|
|
4604
4676
|
let side = (placement || "bottom-start").split("-")[0], align = (placement || "bottom-start").split("-")[1] || "start";
|
|
@@ -4608,13 +4680,13 @@ function position(anchor, pop, placement) {
|
|
|
4608
4680
|
const left = align === "end" ? r.right - pw : align === "center" ? r.left + r.width / 2 - pw / 2 : r.left;
|
|
4609
4681
|
return { top: Math.max(8, top), left: Math.max(8, Math.min(left, vw - pw - 8)), side };
|
|
4610
4682
|
}
|
|
4611
|
-
var Popover =
|
|
4683
|
+
var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
4612
4684
|
const t = useStrings();
|
|
4613
4685
|
const auto = uid(), id = props.id || auto;
|
|
4614
4686
|
const st = useMaybeControlled(props.open, !!props.defaultOpen, props.onOpenChange);
|
|
4615
4687
|
const open = !!st[0];
|
|
4616
|
-
const wrap =
|
|
4617
|
-
const pos =
|
|
4688
|
+
const wrap = React47.useRef(null), pop = React47.useRef(null), popMerged = useMergedRef(ref, pop);
|
|
4689
|
+
const pos = React47.useState(null), mounted = useMounted();
|
|
4618
4690
|
function trigger() {
|
|
4619
4691
|
return wrap.current && (wrap.current.querySelector('button, [role="button"], a, input') || wrap.current.firstElementChild);
|
|
4620
4692
|
}
|
|
@@ -4641,7 +4713,7 @@ var Popover = React25.forwardRef(function Popover2(props, ref) {
|
|
|
4641
4713
|
},
|
|
4642
4714
|
[open, mounted, props.placement]
|
|
4643
4715
|
);
|
|
4644
|
-
|
|
4716
|
+
React47.useEffect(
|
|
4645
4717
|
function() {
|
|
4646
4718
|
if (!open || !mounted) return;
|
|
4647
4719
|
if (props.autoFocus !== false && pop.current) {
|
|
@@ -4660,9 +4732,9 @@ var Popover = React25.forwardRef(function Popover2(props, ref) {
|
|
|
4660
4732
|
},
|
|
4661
4733
|
[open, mounted]
|
|
4662
4734
|
);
|
|
4663
|
-
const child =
|
|
4664
|
-
const panel = open && mounted ? (0,
|
|
4665
|
-
/* @__PURE__ */
|
|
4735
|
+
const child = React47.Children.only(props.trigger);
|
|
4736
|
+
const panel = open && mounted ? (0, import_react_dom8.createPortal)(
|
|
4737
|
+
/* @__PURE__ */ React47.createElement(
|
|
4666
4738
|
"div",
|
|
4667
4739
|
{
|
|
4668
4740
|
ref: popMerged,
|
|
@@ -4684,7 +4756,7 @@ var Popover = React25.forwardRef(function Popover2(props, ref) {
|
|
|
4684
4756
|
} else trapTab(e, pop.current);
|
|
4685
4757
|
}
|
|
4686
4758
|
},
|
|
4687
|
-
props.title ? /* @__PURE__ */
|
|
4759
|
+
props.title ? /* @__PURE__ */ React47.createElement("div", { className: "aura-popover__head" }, /* @__PURE__ */ React47.createElement("p", { className: "aura-popover__title", id: id + "-title" }, props.title), /* @__PURE__ */ React47.createElement(
|
|
4688
4760
|
IconButton,
|
|
4689
4761
|
{
|
|
4690
4762
|
icon: "x",
|
|
@@ -4694,7 +4766,7 @@ var Popover = React25.forwardRef(function Popover2(props, ref) {
|
|
|
4694
4766
|
}
|
|
4695
4767
|
}
|
|
4696
4768
|
)) : null,
|
|
4697
|
-
/* @__PURE__ */
|
|
4769
|
+
/* @__PURE__ */ React47.createElement("div", { className: "aura-popover__body" }, typeof props.children === "function" ? props.children({
|
|
4698
4770
|
close: function() {
|
|
4699
4771
|
close(true);
|
|
4700
4772
|
}
|
|
@@ -4702,7 +4774,7 @@ var Popover = React25.forwardRef(function Popover2(props, ref) {
|
|
|
4702
4774
|
),
|
|
4703
4775
|
document.body
|
|
4704
4776
|
) : null;
|
|
4705
|
-
return /* @__PURE__ */
|
|
4777
|
+
return /* @__PURE__ */ React47.createElement("span", { ref: wrap, className: "aura-popover-anchor" }, React47.cloneElement(child, {
|
|
4706
4778
|
onClick: function(e) {
|
|
4707
4779
|
if (child.props.onClick) child.props.onClick(e);
|
|
4708
4780
|
st[1](!open);
|