@jirawatpyk/aura-react 4.7.1 → 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/aura.bundle.js
CHANGED
|
@@ -203,6 +203,10 @@ window.Aura = (() => {
|
|
|
203
203
|
[a, b]
|
|
204
204
|
);
|
|
205
205
|
}
|
|
206
|
+
var TONES = ["neutral", "accent", "success", "warning", "danger"];
|
|
207
|
+
function tone(t) {
|
|
208
|
+
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
209
|
+
}
|
|
206
210
|
|
|
207
211
|
// src/Icon.tsx
|
|
208
212
|
var h = React2.createElement;
|
|
@@ -532,7 +536,7 @@ window.Aura = (() => {
|
|
|
532
536
|
return /* @__PURE__ */ React8.createElement("span", { ref, className: cx("aura-pill", "aura-pill--" + tone2, props.className) }, /* @__PURE__ */ React8.createElement(Icon, { name: TONE_ICON[tone2] || "circle", size: 12 }), props.children);
|
|
533
537
|
});
|
|
534
538
|
|
|
535
|
-
// src/
|
|
539
|
+
// src/Field.tsx
|
|
536
540
|
var React10 = __toESM(require_react(), 1);
|
|
537
541
|
|
|
538
542
|
// src/locale.tsx
|
|
@@ -748,7 +752,7 @@ window.Aura = (() => {
|
|
|
748
752
|
return useAuraLocale().strings;
|
|
749
753
|
}
|
|
750
754
|
|
|
751
|
-
// src/
|
|
755
|
+
// src/Field.tsx
|
|
752
756
|
var h2 = React10.createElement;
|
|
753
757
|
var Field = React10.forwardRef(function Field2(props, ref) {
|
|
754
758
|
const t = useStrings();
|
|
@@ -785,10 +789,13 @@ window.Aura = (() => {
|
|
|
785
789
|
"options",
|
|
786
790
|
"placeholder"
|
|
787
791
|
];
|
|
788
|
-
|
|
792
|
+
|
|
793
|
+
// src/TextField.tsx
|
|
794
|
+
var React11 = __toESM(require_react(), 1);
|
|
795
|
+
var TextField = React11.forwardRef(function TextField2(props, ref) {
|
|
789
796
|
const auto = uid(), id = props.id || auto;
|
|
790
797
|
const rest = omit(props, FIELD_KEYS);
|
|
791
|
-
return /* @__PURE__ */
|
|
798
|
+
return /* @__PURE__ */ React11.createElement(
|
|
792
799
|
Field,
|
|
793
800
|
{
|
|
794
801
|
id,
|
|
@@ -800,7 +807,7 @@ window.Aura = (() => {
|
|
|
800
807
|
disabled: props.disabled,
|
|
801
808
|
className: props.className
|
|
802
809
|
},
|
|
803
|
-
/* @__PURE__ */
|
|
810
|
+
/* @__PURE__ */ React11.createElement("div", { className: cx("aura-input", props.icon && "has-icon", props.suffix && "has-suffix") }, props.icon ? /* @__PURE__ */ React11.createElement(Icon, { name: props.icon, className: "aura-input__icon" }) : null, /* @__PURE__ */ React11.createElement(
|
|
804
811
|
"input",
|
|
805
812
|
{
|
|
806
813
|
type: "text",
|
|
@@ -813,13 +820,16 @@ window.Aura = (() => {
|
|
|
813
820
|
"aria-invalid": props.error ? true : void 0,
|
|
814
821
|
"aria-describedby": describedBy(id, props)
|
|
815
822
|
}
|
|
816
|
-
), props.suffix ? /* @__PURE__ */
|
|
823
|
+
), props.suffix ? /* @__PURE__ */ React11.createElement("span", { className: "aura-input__suffix" }, props.suffix) : null)
|
|
817
824
|
);
|
|
818
825
|
});
|
|
819
|
-
|
|
826
|
+
|
|
827
|
+
// src/Textarea.tsx
|
|
828
|
+
var React12 = __toESM(require_react(), 1);
|
|
829
|
+
var Textarea = React12.forwardRef(function Textarea2(props, ref) {
|
|
820
830
|
const auto = uid(), id = props.id || auto;
|
|
821
831
|
const rest = omit(props, FIELD_KEYS);
|
|
822
|
-
return /* @__PURE__ */
|
|
832
|
+
return /* @__PURE__ */ React12.createElement(
|
|
823
833
|
Field,
|
|
824
834
|
{
|
|
825
835
|
id,
|
|
@@ -831,7 +841,7 @@ window.Aura = (() => {
|
|
|
831
841
|
disabled: props.disabled,
|
|
832
842
|
className: props.className
|
|
833
843
|
},
|
|
834
|
-
/* @__PURE__ */
|
|
844
|
+
/* @__PURE__ */ React12.createElement(
|
|
835
845
|
"textarea",
|
|
836
846
|
{
|
|
837
847
|
rows: 4,
|
|
@@ -847,19 +857,23 @@ window.Aura = (() => {
|
|
|
847
857
|
)
|
|
848
858
|
);
|
|
849
859
|
});
|
|
850
|
-
|
|
860
|
+
|
|
861
|
+
// src/Select.tsx
|
|
862
|
+
var React13 = __toESM(require_react(), 1);
|
|
863
|
+
var h3 = React13.createElement;
|
|
864
|
+
var Select = React13.forwardRef(function Select2(props, ref) {
|
|
851
865
|
const auto = uid(), id = props.id || auto;
|
|
852
866
|
const rest = omit(props, FIELD_KEYS.concat(["children"]));
|
|
853
867
|
const opts = (props.options || []).map(function(o) {
|
|
854
868
|
const v = typeof o === "object" ? o : { value: o, label: o };
|
|
855
|
-
return /* @__PURE__ */
|
|
869
|
+
return /* @__PURE__ */ React13.createElement("option", { key: v.value, value: v.value, disabled: v.disabled }, v.label);
|
|
856
870
|
});
|
|
857
871
|
if (props.placeholder)
|
|
858
872
|
opts.unshift(
|
|
859
|
-
/* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ React13.createElement("option", { key: "__ph", value: "", disabled: true }, props.placeholder)
|
|
860
874
|
);
|
|
861
875
|
const extra = props.value === void 0 && props.defaultValue === void 0 && props.placeholder ? { defaultValue: "" } : {};
|
|
862
|
-
return /* @__PURE__ */
|
|
876
|
+
return /* @__PURE__ */ React13.createElement(
|
|
863
877
|
Field,
|
|
864
878
|
{
|
|
865
879
|
id,
|
|
@@ -871,7 +885,7 @@ window.Aura = (() => {
|
|
|
871
885
|
disabled: props.disabled,
|
|
872
886
|
className: props.className
|
|
873
887
|
},
|
|
874
|
-
/* @__PURE__ */
|
|
888
|
+
/* @__PURE__ */ React13.createElement("div", { className: cx("aura-input aura-select", props.icon && "has-icon") }, props.icon ? /* @__PURE__ */ React13.createElement(Icon, { name: props.icon, className: "aura-input__icon" }) : null, h3(
|
|
875
889
|
"select",
|
|
876
890
|
Object.assign(extra, rest, {
|
|
877
891
|
ref,
|
|
@@ -883,10 +897,13 @@ window.Aura = (() => {
|
|
|
883
897
|
}),
|
|
884
898
|
opts,
|
|
885
899
|
props.children
|
|
886
|
-
), /* @__PURE__ */
|
|
900
|
+
), /* @__PURE__ */ React13.createElement(Icon, { name: "chevron-down", className: "aura-select__chevron" }))
|
|
887
901
|
);
|
|
888
902
|
});
|
|
889
|
-
|
|
903
|
+
|
|
904
|
+
// src/RadioGroup.tsx
|
|
905
|
+
var React14 = __toESM(require_react(), 1);
|
|
906
|
+
var RadioGroup = React14.forwardRef(function RadioGroup2(props, ref) {
|
|
890
907
|
const auto = uid(), id = props.id || auto;
|
|
891
908
|
const st = useMaybeControlled(
|
|
892
909
|
props.value,
|
|
@@ -894,7 +911,7 @@ window.Aura = (() => {
|
|
|
894
911
|
props.onChange
|
|
895
912
|
);
|
|
896
913
|
const name = props.name || id;
|
|
897
|
-
return /* @__PURE__ */
|
|
914
|
+
return /* @__PURE__ */ React14.createElement(
|
|
898
915
|
"fieldset",
|
|
899
916
|
{
|
|
900
917
|
ref,
|
|
@@ -903,10 +920,10 @@ window.Aura = (() => {
|
|
|
903
920
|
"aria-invalid": props.error ? true : void 0,
|
|
904
921
|
disabled: props.disabled
|
|
905
922
|
},
|
|
906
|
-
props.label ? /* @__PURE__ */
|
|
907
|
-
/* @__PURE__ */
|
|
923
|
+
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,
|
|
924
|
+
/* @__PURE__ */ React14.createElement("div", { className: cx("aura-radio-group__list", props.orientation === "horizontal" && "is-horizontal") }, (props.options || []).map(function(o) {
|
|
908
925
|
const v = typeof o === "object" ? o : { value: o, label: o };
|
|
909
|
-
return /* @__PURE__ */
|
|
926
|
+
return /* @__PURE__ */ React14.createElement("label", { key: v.value, className: cx("aura-choice", v.disabled && "is-disabled") }, /* @__PURE__ */ React14.createElement(
|
|
910
927
|
"input",
|
|
911
928
|
{
|
|
912
929
|
type: "radio",
|
|
@@ -919,16 +936,19 @@ window.Aura = (() => {
|
|
|
919
936
|
st[1](v.value);
|
|
920
937
|
}
|
|
921
938
|
}
|
|
922
|
-
), /* @__PURE__ */
|
|
939
|
+
), /* @__PURE__ */ React14.createElement("span", { className: "aura-choice__text" }, /* @__PURE__ */ React14.createElement("span", { className: "aura-choice__label" }, v.label), v.description ? /* @__PURE__ */ React14.createElement("span", { className: "aura-choice__desc" }, v.description) : null));
|
|
923
940
|
})),
|
|
924
|
-
props.error ? /* @__PURE__ */
|
|
941
|
+
props.error ? /* @__PURE__ */ React14.createElement("p", { className: "aura-field__error", id: id + "-error" }, /* @__PURE__ */ React14.createElement(Icon, { name: "circle-alert", size: 14 }), props.error) : props.hint ? /* @__PURE__ */ React14.createElement("p", { className: "aura-field__hint", id: id + "-hint" }, props.hint) : null
|
|
925
942
|
);
|
|
926
943
|
});
|
|
927
|
-
|
|
944
|
+
|
|
945
|
+
// src/Switch.tsx
|
|
946
|
+
var React15 = __toESM(require_react(), 1);
|
|
947
|
+
var Switch = React15.forwardRef(function Switch2(props, ref) {
|
|
928
948
|
const auto = uid(), id = props.id || auto;
|
|
929
949
|
const st = useMaybeControlled(props.checked, !!props.defaultChecked, props.onChange);
|
|
930
950
|
const on = !!st[0];
|
|
931
|
-
return /* @__PURE__ */
|
|
951
|
+
return /* @__PURE__ */ React15.createElement("div", { className: cx("aura-switch-row", props.disabled && "is-disabled", props.className) }, /* @__PURE__ */ React15.createElement(
|
|
932
952
|
"button",
|
|
933
953
|
{
|
|
934
954
|
ref,
|
|
@@ -945,12 +965,12 @@ window.Aura = (() => {
|
|
|
945
965
|
st[1](!on);
|
|
946
966
|
}
|
|
947
967
|
},
|
|
948
|
-
/* @__PURE__ */
|
|
949
|
-
), props.label ? /* @__PURE__ */
|
|
968
|
+
/* @__PURE__ */ React15.createElement("span", { className: "aura-switch__thumb" })
|
|
969
|
+
), props.label ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__text" }, /* @__PURE__ */ React15.createElement("label", { className: "aura-choice__label", id: id + "-label", htmlFor: id }, props.label), props.description ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__desc", id: id + "-desc" }, props.description) : null) : null);
|
|
950
970
|
});
|
|
951
971
|
|
|
952
972
|
// src/Combobox.tsx
|
|
953
|
-
var
|
|
973
|
+
var React16 = __toESM(require_react(), 1);
|
|
954
974
|
var import_react_dom2 = __toESM(require_react_dom(), 1);
|
|
955
975
|
function norm(s) {
|
|
956
976
|
return String(s == null ? "" : s).normalize("NFC").toLocaleLowerCase("th");
|
|
@@ -965,7 +985,7 @@ window.Aura = (() => {
|
|
|
965
985
|
return norm(k).indexOf(q) >= 0;
|
|
966
986
|
});
|
|
967
987
|
}
|
|
968
|
-
var Combobox =
|
|
988
|
+
var Combobox = React16.forwardRef(function Combobox2(props, ref) {
|
|
969
989
|
const t = useStrings();
|
|
970
990
|
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
971
991
|
const options = (props.options || []).map(toOpt);
|
|
@@ -978,11 +998,11 @@ window.Aura = (() => {
|
|
|
978
998
|
const selected = options.filter(function(o) {
|
|
979
999
|
return o.value === value;
|
|
980
1000
|
})[0] || null;
|
|
981
|
-
const openState =
|
|
982
|
-
const qState =
|
|
983
|
-
const aState =
|
|
984
|
-
const posState =
|
|
985
|
-
const inputRef =
|
|
1001
|
+
const openState = React16.useState(false), open = openState[0], setOpen = openState[1];
|
|
1002
|
+
const qState = React16.useState(null), query = qState[0], setQuery = qState[1];
|
|
1003
|
+
const aState = React16.useState(0), active = aState[0], setActive = aState[1];
|
|
1004
|
+
const posState = React16.useState(null);
|
|
1005
|
+
const inputRef = React16.useRef(null), inputMerged = useMergedRef(ref, inputRef), boxRef = React16.useRef(null), listRef = React16.useRef(null);
|
|
986
1006
|
const mounted = useMounted();
|
|
987
1007
|
const limit = props.limit || 200;
|
|
988
1008
|
const filter = props.filter || defaultFilter;
|
|
@@ -1010,7 +1030,7 @@ window.Aura = (() => {
|
|
|
1010
1030
|
},
|
|
1011
1031
|
[open, shown.length]
|
|
1012
1032
|
);
|
|
1013
|
-
|
|
1033
|
+
React16.useEffect(
|
|
1014
1034
|
function() {
|
|
1015
1035
|
if (!open) return;
|
|
1016
1036
|
function outside(e) {
|
|
@@ -1032,7 +1052,7 @@ window.Aura = (() => {
|
|
|
1032
1052
|
},
|
|
1033
1053
|
[open]
|
|
1034
1054
|
);
|
|
1035
|
-
|
|
1055
|
+
React16.useEffect(
|
|
1036
1056
|
function() {
|
|
1037
1057
|
if (!open || !listRef.current) return;
|
|
1038
1058
|
const el = listRef.current.querySelector('[data-idx="' + activeIdx + '"]');
|
|
@@ -1096,9 +1116,9 @@ window.Aura = (() => {
|
|
|
1096
1116
|
return id + "-opt-" + i;
|
|
1097
1117
|
};
|
|
1098
1118
|
const list = open && mounted && posState[0] ? (0, import_react_dom2.createPortal)(
|
|
1099
|
-
/* @__PURE__ */
|
|
1119
|
+
/* @__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) {
|
|
1100
1120
|
const isSel = selected && o.value === selected.value;
|
|
1101
|
-
return /* @__PURE__ */
|
|
1121
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1102
1122
|
"li",
|
|
1103
1123
|
{
|
|
1104
1124
|
key: o.value,
|
|
@@ -1123,14 +1143,14 @@ window.Aura = (() => {
|
|
|
1123
1143
|
if (activeIdx !== i) setActive(i);
|
|
1124
1144
|
}
|
|
1125
1145
|
},
|
|
1126
|
-
o.icon ? /* @__PURE__ */
|
|
1127
|
-
/* @__PURE__ */
|
|
1128
|
-
isSel ? /* @__PURE__ */
|
|
1146
|
+
o.icon ? /* @__PURE__ */ React16.createElement(Icon, { name: o.icon }) : null,
|
|
1147
|
+
/* @__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),
|
|
1148
|
+
isSel ? /* @__PURE__ */ React16.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
1129
1149
|
);
|
|
1130
|
-
}), more && !props.loading ? /* @__PURE__ */
|
|
1150
|
+
}), more && !props.loading ? /* @__PURE__ */ React16.createElement("li", { className: "aura-combo__note", role: "presentation" }, t.keepTyping((props.options || []).length)) : null)),
|
|
1131
1151
|
document.body
|
|
1132
1152
|
) : null;
|
|
1133
|
-
return /* @__PURE__ */
|
|
1153
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1134
1154
|
Field,
|
|
1135
1155
|
{
|
|
1136
1156
|
id,
|
|
@@ -1142,7 +1162,7 @@ window.Aura = (() => {
|
|
|
1142
1162
|
disabled: props.disabled,
|
|
1143
1163
|
className: props.className
|
|
1144
1164
|
},
|
|
1145
|
-
/* @__PURE__ */
|
|
1165
|
+
/* @__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(
|
|
1146
1166
|
"input",
|
|
1147
1167
|
{
|
|
1148
1168
|
ref: inputMerged,
|
|
@@ -1179,7 +1199,7 @@ window.Aura = (() => {
|
|
|
1179
1199
|
}, 0);
|
|
1180
1200
|
}
|
|
1181
1201
|
}
|
|
1182
|
-
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */
|
|
1202
|
+
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */ React16.createElement(
|
|
1183
1203
|
"button",
|
|
1184
1204
|
{
|
|
1185
1205
|
type: "button",
|
|
@@ -1192,8 +1212,8 @@ window.Aura = (() => {
|
|
|
1192
1212
|
if (inputRef.current) inputRef.current.focus();
|
|
1193
1213
|
}
|
|
1194
1214
|
},
|
|
1195
|
-
/* @__PURE__ */
|
|
1196
|
-
) : null, /* @__PURE__ */
|
|
1215
|
+
/* @__PURE__ */ React16.createElement(Icon, { name: "x" })
|
|
1216
|
+
) : null, /* @__PURE__ */ React16.createElement(
|
|
1197
1217
|
"button",
|
|
1198
1218
|
{
|
|
1199
1219
|
type: "button",
|
|
@@ -1211,14 +1231,14 @@ window.Aura = (() => {
|
|
|
1211
1231
|
}
|
|
1212
1232
|
}
|
|
1213
1233
|
},
|
|
1214
|
-
/* @__PURE__ */
|
|
1234
|
+
/* @__PURE__ */ React16.createElement(Icon, { name: "chevron-down" })
|
|
1215
1235
|
)),
|
|
1216
1236
|
list
|
|
1217
1237
|
);
|
|
1218
1238
|
});
|
|
1219
1239
|
|
|
1220
1240
|
// src/DatePicker.tsx
|
|
1221
|
-
var
|
|
1241
|
+
var React17 = __toESM(require_react(), 1);
|
|
1222
1242
|
var import_react_dom3 = __toESM(require_react_dom(), 1);
|
|
1223
1243
|
var ERA = /^พ\.ศ\.\s?|\s?(BE|พ\.ศ\.)$/g;
|
|
1224
1244
|
var pad = function(n2) {
|
|
@@ -1300,29 +1320,29 @@ window.Aura = (() => {
|
|
|
1300
1320
|
const dt = new Date(y, mo - 1, d);
|
|
1301
1321
|
return dt.getMonth() === mo - 1 && dt.getDate() === d ? toISO(dt) : null;
|
|
1302
1322
|
}
|
|
1303
|
-
var Calendar =
|
|
1323
|
+
var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
1304
1324
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", tag = localeTag(locale, calendar);
|
|
1305
1325
|
const weekStart = props.weekStartsOn == null ? 0 : props.weekStartsOn;
|
|
1306
1326
|
let today = /* @__PURE__ */ new Date();
|
|
1307
1327
|
today = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
1308
1328
|
const min = fromISO(props.min), max = fromISO(props.max);
|
|
1309
1329
|
const start = fromISO(props.start), end = fromISO(props.end);
|
|
1310
|
-
const focusState =
|
|
1330
|
+
const focusState = React17.useState(fromISO(props.focus) || start || today);
|
|
1311
1331
|
const focusDate = focusState[0], setFocus = focusState[1];
|
|
1312
|
-
const viewState =
|
|
1313
|
-
const hoverState =
|
|
1314
|
-
const gridRef =
|
|
1332
|
+
const viewState = React17.useState("days"), view = viewState[0], setView = viewState[1];
|
|
1333
|
+
const hoverState = React17.useState(null);
|
|
1334
|
+
const gridRef = React17.useRef(null), gridMerged = useMergedRef(ref, gridRef), moved = React17.useRef(false);
|
|
1315
1335
|
const th = locale !== "en";
|
|
1316
1336
|
function disabled(d) {
|
|
1317
1337
|
return !!(min && d < min || max && d > max || props.isDateDisabled && props.isDateDisabled(toISO(d)));
|
|
1318
1338
|
}
|
|
1319
|
-
|
|
1339
|
+
React17.useEffect(function() {
|
|
1320
1340
|
if (!moved.current) return;
|
|
1321
1341
|
moved.current = false;
|
|
1322
1342
|
const el = gridRef.current && gridRef.current.querySelector('[data-date="' + toISO(focusDate) + '"]');
|
|
1323
1343
|
if (el) el.focus();
|
|
1324
1344
|
});
|
|
1325
|
-
|
|
1345
|
+
React17.useEffect(function() {
|
|
1326
1346
|
if (props.autoFocus === false) return;
|
|
1327
1347
|
const el = gridRef.current && gridRef.current.querySelector('[tabindex="0"]');
|
|
1328
1348
|
if (el) el.focus();
|
|
@@ -1374,7 +1394,7 @@ window.Aura = (() => {
|
|
|
1374
1394
|
const yr = focusDate.getFullYear(), base = yr - yr % 12;
|
|
1375
1395
|
const years = [];
|
|
1376
1396
|
for (let y = base; y < base + 12; y++) years.push(y);
|
|
1377
|
-
return /* @__PURE__ */
|
|
1397
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1378
1398
|
IconButton,
|
|
1379
1399
|
{
|
|
1380
1400
|
icon: "chevron-left",
|
|
@@ -1383,7 +1403,7 @@ window.Aura = (() => {
|
|
|
1383
1403
|
setFocus(new Date(yr - 12, focusDate.getMonth(), 1));
|
|
1384
1404
|
}
|
|
1385
1405
|
}
|
|
1386
|
-
), /* @__PURE__ */
|
|
1406
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1387
1407
|
"button",
|
|
1388
1408
|
{
|
|
1389
1409
|
type: "button",
|
|
@@ -1393,7 +1413,7 @@ window.Aura = (() => {
|
|
|
1393
1413
|
}
|
|
1394
1414
|
},
|
|
1395
1415
|
fmt(tag, { year: "numeric" }, new Date(base, 0, 1)).replace(ERA, "") + " \u2013 " + fmt(tag, { year: "numeric" }, new Date(base + 11, 0, 1)).replace(ERA, "")
|
|
1396
|
-
), /* @__PURE__ */
|
|
1416
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1397
1417
|
IconButton,
|
|
1398
1418
|
{
|
|
1399
1419
|
icon: "chevron-right",
|
|
@@ -1402,9 +1422,9 @@ window.Aura = (() => {
|
|
|
1402
1422
|
setFocus(new Date(yr + 12, focusDate.getMonth(), 1));
|
|
1403
1423
|
}
|
|
1404
1424
|
}
|
|
1405
|
-
)), /* @__PURE__ */
|
|
1425
|
+
)), /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__years" }, years.map(function(y) {
|
|
1406
1426
|
const d = new Date(y, focusDate.getMonth(), 1);
|
|
1407
|
-
return /* @__PURE__ */
|
|
1427
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1408
1428
|
"button",
|
|
1409
1429
|
{
|
|
1410
1430
|
key: y,
|
|
@@ -1421,7 +1441,7 @@ window.Aura = (() => {
|
|
|
1421
1441
|
);
|
|
1422
1442
|
})));
|
|
1423
1443
|
}
|
|
1424
|
-
return /* @__PURE__ */
|
|
1444
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1425
1445
|
IconButton,
|
|
1426
1446
|
{
|
|
1427
1447
|
icon: "chevron-left",
|
|
@@ -1430,7 +1450,7 @@ window.Aura = (() => {
|
|
|
1430
1450
|
setFocus(addMonths(focusDate, -1));
|
|
1431
1451
|
}
|
|
1432
1452
|
}
|
|
1433
|
-
), /* @__PURE__ */
|
|
1453
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1434
1454
|
"button",
|
|
1435
1455
|
{
|
|
1436
1456
|
type: "button",
|
|
@@ -1441,8 +1461,8 @@ window.Aura = (() => {
|
|
|
1441
1461
|
}
|
|
1442
1462
|
},
|
|
1443
1463
|
monthTitle,
|
|
1444
|
-
/* @__PURE__ */
|
|
1445
|
-
), /* @__PURE__ */
|
|
1464
|
+
/* @__PURE__ */ React17.createElement(Icon, { name: "chevron-down", size: 14 })
|
|
1465
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1446
1466
|
IconButton,
|
|
1447
1467
|
{
|
|
1448
1468
|
icon: "chevron-right",
|
|
@@ -1451,9 +1471,9 @@ window.Aura = (() => {
|
|
|
1451
1471
|
setFocus(addMonths(focusDate, 1));
|
|
1452
1472
|
}
|
|
1453
1473
|
}
|
|
1454
|
-
)), /* @__PURE__ */
|
|
1455
|
-
return /* @__PURE__ */
|
|
1456
|
-
}))), /* @__PURE__ */
|
|
1474
|
+
)), /* @__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) {
|
|
1475
|
+
return /* @__PURE__ */ React17.createElement("th", { key: i, scope: "col", abbr: n2.long }, /* @__PURE__ */ React17.createElement("span", { "aria-hidden": true }, n2.short));
|
|
1476
|
+
}))), /* @__PURE__ */ React17.createElement(
|
|
1457
1477
|
"tbody",
|
|
1458
1478
|
{
|
|
1459
1479
|
onMouseLeave: function() {
|
|
@@ -1461,11 +1481,11 @@ window.Aura = (() => {
|
|
|
1461
1481
|
}
|
|
1462
1482
|
},
|
|
1463
1483
|
weeks.map(function(wk, wi) {
|
|
1464
|
-
return /* @__PURE__ */
|
|
1484
|
+
return /* @__PURE__ */ React17.createElement("tr", { key: wi }, wk.map(function(d) {
|
|
1465
1485
|
const iso = toISO(d), out = d.getMonth() !== focusDate.getMonth(), dis = disabled(d);
|
|
1466
1486
|
const isStart = same(d, start), isEnd = same(d, end) || !end && props.range && same(d, hover) && start;
|
|
1467
1487
|
const sel = isStart || same(d, end);
|
|
1468
|
-
return /* @__PURE__ */
|
|
1488
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1469
1489
|
"td",
|
|
1470
1490
|
{
|
|
1471
1491
|
key: iso,
|
|
@@ -1477,7 +1497,7 @@ window.Aura = (() => {
|
|
|
1477
1497
|
props.range && isEnd && start && "is-range-end"
|
|
1478
1498
|
)
|
|
1479
1499
|
},
|
|
1480
|
-
/* @__PURE__ */
|
|
1500
|
+
/* @__PURE__ */ React17.createElement(
|
|
1481
1501
|
"button",
|
|
1482
1502
|
{
|
|
1483
1503
|
type: "button",
|
|
@@ -1509,7 +1529,7 @@ window.Aura = (() => {
|
|
|
1509
1529
|
);
|
|
1510
1530
|
}));
|
|
1511
1531
|
})
|
|
1512
|
-
)), props.footer === false ? null : /* @__PURE__ */
|
|
1532
|
+
)), props.footer === false ? null : /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__foot" }, /* @__PURE__ */ React17.createElement(
|
|
1513
1533
|
"button",
|
|
1514
1534
|
{
|
|
1515
1535
|
type: "button",
|
|
@@ -1521,11 +1541,11 @@ window.Aura = (() => {
|
|
|
1521
1541
|
}
|
|
1522
1542
|
},
|
|
1523
1543
|
th ? "\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49" : "Today"
|
|
1524
|
-
), props.onClear ? /* @__PURE__ */
|
|
1544
|
+
), props.onClear ? /* @__PURE__ */ React17.createElement("button", { type: "button", className: "aura-cal__link", onClick: props.onClear }, th ? "\u0E25\u0E49\u0E32\u0E07" : "Clear") : null));
|
|
1525
1545
|
});
|
|
1526
1546
|
function useCalendarPopover(boxRef) {
|
|
1527
|
-
const openState =
|
|
1528
|
-
const pos =
|
|
1547
|
+
const openState = React17.useState(false), open = openState[0], setOpen = openState[1];
|
|
1548
|
+
const pos = React17.useState(null), popRef = React17.useRef(null), mounted = useMounted();
|
|
1529
1549
|
function place() {
|
|
1530
1550
|
if (!boxRef.current) return;
|
|
1531
1551
|
const r = boxRef.current.getBoundingClientRect(), H = 380;
|
|
@@ -1539,7 +1559,7 @@ window.Aura = (() => {
|
|
|
1539
1559
|
},
|
|
1540
1560
|
[open]
|
|
1541
1561
|
);
|
|
1542
|
-
|
|
1562
|
+
React17.useEffect(
|
|
1543
1563
|
function() {
|
|
1544
1564
|
if (!open) return;
|
|
1545
1565
|
function outside(e) {
|
|
@@ -1561,8 +1581,8 @@ window.Aura = (() => {
|
|
|
1561
1581
|
return { open, setOpen, pos: pos[0], popRef, mounted };
|
|
1562
1582
|
}
|
|
1563
1583
|
function DateField(props) {
|
|
1564
|
-
const editState =
|
|
1565
|
-
return /* @__PURE__ */
|
|
1584
|
+
const editState = React17.useState(null), editing = editState[0], setEditing = editState[1];
|
|
1585
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1566
1586
|
Field,
|
|
1567
1587
|
{
|
|
1568
1588
|
id: props.id,
|
|
@@ -1574,7 +1594,7 @@ window.Aura = (() => {
|
|
|
1574
1594
|
disabled: props.disabled,
|
|
1575
1595
|
className: props.className
|
|
1576
1596
|
},
|
|
1577
|
-
/* @__PURE__ */
|
|
1597
|
+
/* @__PURE__ */ React17.createElement("div", { ref: props.boxRef, className: cx("aura-input aura-date", props.open && "is-open") }, /* @__PURE__ */ React17.createElement(
|
|
1578
1598
|
"input",
|
|
1579
1599
|
{
|
|
1580
1600
|
ref: props.inputRef,
|
|
@@ -1613,7 +1633,7 @@ window.Aura = (() => {
|
|
|
1613
1633
|
}
|
|
1614
1634
|
}
|
|
1615
1635
|
}
|
|
1616
|
-
), props.clearable !== false && props.hasValue && !props.disabled ? /* @__PURE__ */
|
|
1636
|
+
), props.clearable !== false && props.hasValue && !props.disabled ? /* @__PURE__ */ React17.createElement(
|
|
1617
1637
|
"button",
|
|
1618
1638
|
{
|
|
1619
1639
|
type: "button",
|
|
@@ -1622,8 +1642,8 @@ window.Aura = (() => {
|
|
|
1622
1642
|
"aria-label": props.clearLabel,
|
|
1623
1643
|
onClick: props.onClear
|
|
1624
1644
|
},
|
|
1625
|
-
/* @__PURE__ */
|
|
1626
|
-
) : null, /* @__PURE__ */
|
|
1645
|
+
/* @__PURE__ */ React17.createElement(Icon, { name: "x" })
|
|
1646
|
+
) : null, /* @__PURE__ */ React17.createElement(
|
|
1627
1647
|
"button",
|
|
1628
1648
|
{
|
|
1629
1649
|
type: "button",
|
|
@@ -1637,11 +1657,11 @@ window.Aura = (() => {
|
|
|
1637
1657
|
props.onToggle(!props.open);
|
|
1638
1658
|
}
|
|
1639
1659
|
},
|
|
1640
|
-
/* @__PURE__ */
|
|
1660
|
+
/* @__PURE__ */ React17.createElement(Icon, { name: "calendar" })
|
|
1641
1661
|
))
|
|
1642
1662
|
);
|
|
1643
1663
|
}
|
|
1644
|
-
var DatePicker =
|
|
1664
|
+
var DatePicker = React17.forwardRef(function DatePicker2(props, ref) {
|
|
1645
1665
|
const auto = uid(), id = props.id || auto, dialogId = id + "-cal";
|
|
1646
1666
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", th = locale !== "en";
|
|
1647
1667
|
const st = useMaybeControlled(
|
|
@@ -1649,7 +1669,7 @@ window.Aura = (() => {
|
|
|
1649
1669
|
props.defaultValue == null ? null : props.defaultValue,
|
|
1650
1670
|
props.onChange
|
|
1651
1671
|
);
|
|
1652
|
-
const boxRef =
|
|
1672
|
+
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
1653
1673
|
const pop = useCalendarPopover(boxRef);
|
|
1654
1674
|
function commit(text) {
|
|
1655
1675
|
if (!text.trim()) {
|
|
@@ -1664,7 +1684,7 @@ window.Aura = (() => {
|
|
|
1664
1684
|
if (inputRef.current) inputRef.current.focus();
|
|
1665
1685
|
}
|
|
1666
1686
|
const cal = pop.open && pop.mounted && pop.pos ? (0, import_react_dom3.createPortal)(
|
|
1667
|
-
/* @__PURE__ */
|
|
1687
|
+
/* @__PURE__ */ React17.createElement(
|
|
1668
1688
|
"div",
|
|
1669
1689
|
{
|
|
1670
1690
|
ref: pop.popRef,
|
|
@@ -1681,7 +1701,7 @@ window.Aura = (() => {
|
|
|
1681
1701
|
} else trapTab(e, pop.popRef.current);
|
|
1682
1702
|
}
|
|
1683
1703
|
},
|
|
1684
|
-
/* @__PURE__ */
|
|
1704
|
+
/* @__PURE__ */ React17.createElement(
|
|
1685
1705
|
Calendar,
|
|
1686
1706
|
{
|
|
1687
1707
|
locale,
|
|
@@ -1701,7 +1721,7 @@ window.Aura = (() => {
|
|
|
1701
1721
|
),
|
|
1702
1722
|
document.body
|
|
1703
1723
|
) : null;
|
|
1704
|
-
return /* @__PURE__ */
|
|
1724
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1705
1725
|
DateField,
|
|
1706
1726
|
{
|
|
1707
1727
|
id,
|
|
@@ -1735,7 +1755,7 @@ window.Aura = (() => {
|
|
|
1735
1755
|
}
|
|
1736
1756
|
), cal);
|
|
1737
1757
|
});
|
|
1738
|
-
var DateRangePicker =
|
|
1758
|
+
var DateRangePicker = React17.forwardRef(
|
|
1739
1759
|
function DateRangePicker2(props, ref) {
|
|
1740
1760
|
const auto = uid(), id = props.id || auto, dialogId = id + "-cal";
|
|
1741
1761
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", th = locale !== "en";
|
|
@@ -1745,8 +1765,8 @@ window.Aura = (() => {
|
|
|
1745
1765
|
props.onChange
|
|
1746
1766
|
);
|
|
1747
1767
|
const v = st[0] || { start: null, end: null };
|
|
1748
|
-
const draft =
|
|
1749
|
-
const boxRef =
|
|
1768
|
+
const draft = React17.useState(null);
|
|
1769
|
+
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
1750
1770
|
const pop = useCalendarPopover(boxRef);
|
|
1751
1771
|
const o = { locale, calendar };
|
|
1752
1772
|
function show(r) {
|
|
@@ -1778,7 +1798,7 @@ window.Aura = (() => {
|
|
|
1778
1798
|
close();
|
|
1779
1799
|
}
|
|
1780
1800
|
const cal = pop.open && pop.mounted && pop.pos ? (0, import_react_dom3.createPortal)(
|
|
1781
|
-
/* @__PURE__ */
|
|
1801
|
+
/* @__PURE__ */ React17.createElement(
|
|
1782
1802
|
"div",
|
|
1783
1803
|
{
|
|
1784
1804
|
ref: pop.popRef,
|
|
@@ -1795,8 +1815,8 @@ window.Aura = (() => {
|
|
|
1795
1815
|
} else trapTab(e, pop.popRef.current);
|
|
1796
1816
|
}
|
|
1797
1817
|
},
|
|
1798
|
-
/* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */
|
|
1818
|
+
/* @__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"),
|
|
1819
|
+
/* @__PURE__ */ React17.createElement(
|
|
1800
1820
|
Calendar,
|
|
1801
1821
|
{
|
|
1802
1822
|
range: true,
|
|
@@ -1815,7 +1835,7 @@ window.Aura = (() => {
|
|
|
1815
1835
|
),
|
|
1816
1836
|
document.body
|
|
1817
1837
|
) : null;
|
|
1818
|
-
return /* @__PURE__ */
|
|
1838
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1819
1839
|
DateField,
|
|
1820
1840
|
{
|
|
1821
1841
|
id,
|
|
@@ -1852,30 +1872,33 @@ window.Aura = (() => {
|
|
|
1852
1872
|
}
|
|
1853
1873
|
);
|
|
1854
1874
|
|
|
1855
|
-
// src/
|
|
1856
|
-
var
|
|
1857
|
-
var import_react_dom4 = __toESM(require_react_dom(), 1);
|
|
1875
|
+
// src/Alert.tsx
|
|
1876
|
+
var React18 = __toESM(require_react(), 1);
|
|
1858
1877
|
var ALERT_ICON = {
|
|
1859
1878
|
info: "info",
|
|
1860
1879
|
success: "circle-check",
|
|
1861
1880
|
warning: "triangle-alert",
|
|
1862
1881
|
danger: "circle-alert"
|
|
1863
1882
|
};
|
|
1864
|
-
var Alert =
|
|
1883
|
+
var Alert = React18.forwardRef(function Alert2(props, ref) {
|
|
1865
1884
|
const t = useStrings();
|
|
1866
1885
|
const tone2 = props.tone || "info";
|
|
1867
|
-
return /* @__PURE__ */
|
|
1886
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1868
1887
|
"div",
|
|
1869
1888
|
{
|
|
1870
1889
|
ref,
|
|
1871
1890
|
className: cx("aura-alert", "aura-alert--" + tone2, props.className),
|
|
1872
1891
|
role: tone2 === "danger" || tone2 === "warning" ? "alert" : "status"
|
|
1873
1892
|
},
|
|
1874
|
-
/* @__PURE__ */
|
|
1875
|
-
/* @__PURE__ */
|
|
1876
|
-
props.onDismiss ? /* @__PURE__ */
|
|
1893
|
+
/* @__PURE__ */ React18.createElement(Icon, { name: ALERT_ICON[tone2], className: "aura-alert__icon" }),
|
|
1894
|
+
/* @__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),
|
|
1895
|
+
props.onDismiss ? /* @__PURE__ */ React18.createElement(IconButton, { icon: "x", label: t.dismiss, className: "aura-alert__close", onClick: props.onDismiss }) : null
|
|
1877
1896
|
);
|
|
1878
1897
|
});
|
|
1898
|
+
|
|
1899
|
+
// src/Toaster.tsx
|
|
1900
|
+
var React19 = __toESM(require_react(), 1);
|
|
1901
|
+
var import_react_dom4 = __toESM(require_react_dom(), 1);
|
|
1879
1902
|
var toastState = {
|
|
1880
1903
|
list: [],
|
|
1881
1904
|
subs: [],
|
|
@@ -1903,7 +1926,7 @@ window.Aura = (() => {
|
|
|
1903
1926
|
};
|
|
1904
1927
|
function ToastItem(props) {
|
|
1905
1928
|
const str = useStrings();
|
|
1906
|
-
const t = props.toast, timer =
|
|
1929
|
+
const t = props.toast, timer = React19.useRef(null), left = React19.useRef(t.duration || 5e3), since = React19.useRef(0);
|
|
1907
1930
|
function start() {
|
|
1908
1931
|
if (left.current === Infinity) return;
|
|
1909
1932
|
since.current = Date.now();
|
|
@@ -1918,11 +1941,11 @@ window.Aura = (() => {
|
|
|
1918
1941
|
left.current -= Date.now() - since.current;
|
|
1919
1942
|
}
|
|
1920
1943
|
}
|
|
1921
|
-
|
|
1944
|
+
React19.useEffect(function() {
|
|
1922
1945
|
start();
|
|
1923
1946
|
return pause;
|
|
1924
1947
|
}, []);
|
|
1925
|
-
return /* @__PURE__ */
|
|
1948
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1926
1949
|
"div",
|
|
1927
1950
|
{
|
|
1928
1951
|
className: cx("aura-toast", "aura-toast--" + t.tone),
|
|
@@ -1932,9 +1955,9 @@ window.Aura = (() => {
|
|
|
1932
1955
|
onFocus: pause,
|
|
1933
1956
|
onBlur: start
|
|
1934
1957
|
},
|
|
1935
|
-
/* @__PURE__ */
|
|
1936
|
-
/* @__PURE__ */
|
|
1937
|
-
t.action ? /* @__PURE__ */
|
|
1958
|
+
/* @__PURE__ */ React19.createElement(Icon, { name: ALERT_ICON[t.tone] || "info", className: "aura-toast__icon" }),
|
|
1959
|
+
/* @__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),
|
|
1960
|
+
t.action ? /* @__PURE__ */ React19.createElement(
|
|
1938
1961
|
"button",
|
|
1939
1962
|
{
|
|
1940
1963
|
type: "button",
|
|
@@ -1946,7 +1969,7 @@ window.Aura = (() => {
|
|
|
1946
1969
|
},
|
|
1947
1970
|
t.action.label
|
|
1948
1971
|
) : null,
|
|
1949
|
-
/* @__PURE__ */
|
|
1972
|
+
/* @__PURE__ */ React19.createElement(
|
|
1950
1973
|
IconButton,
|
|
1951
1974
|
{
|
|
1952
1975
|
icon: "x",
|
|
@@ -1962,8 +1985,8 @@ window.Aura = (() => {
|
|
|
1962
1985
|
function Toaster(props) {
|
|
1963
1986
|
const t = useStrings();
|
|
1964
1987
|
const mounted = useMounted();
|
|
1965
|
-
const s =
|
|
1966
|
-
|
|
1988
|
+
const s = React19.useState(toastState.list);
|
|
1989
|
+
React19.useEffect(function() {
|
|
1967
1990
|
toastState.subs.push(s[1]);
|
|
1968
1991
|
return function() {
|
|
1969
1992
|
toastState.subs = toastState.subs.filter(function(f) {
|
|
@@ -1973,7 +1996,7 @@ window.Aura = (() => {
|
|
|
1973
1996
|
}, []);
|
|
1974
1997
|
if (!mounted) return null;
|
|
1975
1998
|
return (0, import_react_dom4.createPortal)(
|
|
1976
|
-
/* @__PURE__ */
|
|
1999
|
+
/* @__PURE__ */ React19.createElement(
|
|
1977
2000
|
"div",
|
|
1978
2001
|
{
|
|
1979
2002
|
className: cx("aura-toaster", props && props.position === "top" && "is-top"),
|
|
@@ -1982,16 +2005,20 @@ window.Aura = (() => {
|
|
|
1982
2005
|
"aria-label": t.notifications
|
|
1983
2006
|
},
|
|
1984
2007
|
s[0].map(function(t2) {
|
|
1985
|
-
return /* @__PURE__ */
|
|
2008
|
+
return /* @__PURE__ */ React19.createElement(ToastItem, { key: t2.id, toast: t2 });
|
|
1986
2009
|
})
|
|
1987
2010
|
),
|
|
1988
2011
|
document.body
|
|
1989
2012
|
);
|
|
1990
2013
|
}
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2014
|
+
|
|
2015
|
+
// src/Tooltip.tsx
|
|
2016
|
+
var React20 = __toESM(require_react(), 1);
|
|
2017
|
+
var import_react_dom5 = __toESM(require_react_dom(), 1);
|
|
2018
|
+
var Tooltip = React20.forwardRef(function Tooltip2(props, ref) {
|
|
2019
|
+
const id = uid(), st = React20.useState(false), open = props.open !== void 0 ? props.open : st[0], set = st[1];
|
|
2020
|
+
const anchor = React20.useRef(null), anchorMerged = useMergedRef(ref, anchor), tip = React20.useRef(null), timer = React20.useRef(void 0);
|
|
2021
|
+
const pos = React20.useState(null);
|
|
1995
2022
|
function show(now) {
|
|
1996
2023
|
clearTimeout(timer.current);
|
|
1997
2024
|
timer.current = setTimeout(
|
|
@@ -2016,7 +2043,7 @@ window.Aura = (() => {
|
|
|
2016
2043
|
},
|
|
2017
2044
|
[open]
|
|
2018
2045
|
);
|
|
2019
|
-
|
|
2046
|
+
React20.useEffect(
|
|
2020
2047
|
function() {
|
|
2021
2048
|
if (!open) return;
|
|
2022
2049
|
function esc(e) {
|
|
@@ -2029,8 +2056,8 @@ window.Aura = (() => {
|
|
|
2029
2056
|
},
|
|
2030
2057
|
[open]
|
|
2031
2058
|
);
|
|
2032
|
-
const child =
|
|
2033
|
-
const trigger = /* @__PURE__ */
|
|
2059
|
+
const child = React20.Children.only(props.children);
|
|
2060
|
+
const trigger = /* @__PURE__ */ React20.createElement(
|
|
2034
2061
|
"span",
|
|
2035
2062
|
{
|
|
2036
2063
|
ref: anchorMerged,
|
|
@@ -2044,10 +2071,10 @@ window.Aura = (() => {
|
|
|
2044
2071
|
},
|
|
2045
2072
|
onBlur: hide
|
|
2046
2073
|
},
|
|
2047
|
-
|
|
2074
|
+
React20.cloneElement(child, { "aria-describedby": open ? id : child.props["aria-describedby"] })
|
|
2048
2075
|
);
|
|
2049
|
-
return /* @__PURE__ */
|
|
2050
|
-
/* @__PURE__ */
|
|
2076
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, trigger, open ? (0, import_react_dom5.createPortal)(
|
|
2077
|
+
/* @__PURE__ */ React20.createElement(
|
|
2051
2078
|
"div",
|
|
2052
2079
|
{
|
|
2053
2080
|
ref: tip,
|
|
@@ -2063,16 +2090,16 @@ window.Aura = (() => {
|
|
|
2063
2090
|
});
|
|
2064
2091
|
|
|
2065
2092
|
// src/Dialog.tsx
|
|
2066
|
-
var
|
|
2067
|
-
var
|
|
2093
|
+
var React22 = __toESM(require_react(), 1);
|
|
2094
|
+
var import_react_dom6 = __toESM(require_react_dom(), 1);
|
|
2068
2095
|
|
|
2069
|
-
// src/
|
|
2070
|
-
var
|
|
2096
|
+
// src/useModal.tsx
|
|
2097
|
+
var React21 = __toESM(require_react(), 1);
|
|
2071
2098
|
function useModal(open, ref, opts) {
|
|
2072
2099
|
const mounted = useMounted();
|
|
2073
|
-
const prev =
|
|
2100
|
+
const prev = React21.useRef(null);
|
|
2074
2101
|
const o = opts || {};
|
|
2075
|
-
|
|
2102
|
+
React21.useEffect(
|
|
2076
2103
|
function() {
|
|
2077
2104
|
if (!open || !mounted) return;
|
|
2078
2105
|
prev.current = document.activeElement;
|
|
@@ -2113,9 +2140,9 @@ window.Aura = (() => {
|
|
|
2113
2140
|
}
|
|
2114
2141
|
|
|
2115
2142
|
// src/Dialog.tsx
|
|
2116
|
-
var Dialog =
|
|
2143
|
+
var Dialog = React22.forwardRef(function Dialog2(props, ref) {
|
|
2117
2144
|
const t = useStrings();
|
|
2118
|
-
const own =
|
|
2145
|
+
const own = React22.useRef(null), merged = useMergedRef(ref, own), titleId = uid(), descId = uid();
|
|
2119
2146
|
function close() {
|
|
2120
2147
|
if (props.dismissible !== false && props.onClose) props.onClose();
|
|
2121
2148
|
}
|
|
@@ -2126,8 +2153,8 @@ window.Aura = (() => {
|
|
|
2126
2153
|
footSelector: ".aura-dialog__foot"
|
|
2127
2154
|
});
|
|
2128
2155
|
if (!modal.ready) return null;
|
|
2129
|
-
return (0,
|
|
2130
|
-
/* @__PURE__ */
|
|
2156
|
+
return (0, import_react_dom6.createPortal)(
|
|
2157
|
+
/* @__PURE__ */ React22.createElement("div", { className: "aura-dialog-layer", onKeyDown: modal.onKeyDown }, /* @__PURE__ */ React22.createElement("div", { className: "aura-scrim", onClick: close, "aria-hidden": true }), /* @__PURE__ */ React22.createElement(
|
|
2131
2158
|
"div",
|
|
2132
2159
|
{
|
|
2133
2160
|
ref: merged,
|
|
@@ -2138,17 +2165,17 @@ window.Aura = (() => {
|
|
|
2138
2165
|
tabIndex: -1,
|
|
2139
2166
|
className: cx("aura-dialog", "aura-dialog--" + (props.size || "md"), props.className)
|
|
2140
2167
|
},
|
|
2141
|
-
/* @__PURE__ */
|
|
2142
|
-
props.description ? /* @__PURE__ */
|
|
2143
|
-
props.children ? /* @__PURE__ */
|
|
2144
|
-
props.footer ? /* @__PURE__ */
|
|
2168
|
+
/* @__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),
|
|
2169
|
+
props.description ? /* @__PURE__ */ React22.createElement("p", { className: "aura-dialog__desc", id: descId }, props.description) : null,
|
|
2170
|
+
props.children ? /* @__PURE__ */ React22.createElement("div", { className: "aura-dialog__body" }, props.children) : null,
|
|
2171
|
+
props.footer ? /* @__PURE__ */ React22.createElement("div", { className: "aura-dialog__foot" }, props.footer) : null
|
|
2145
2172
|
)),
|
|
2146
2173
|
document.body
|
|
2147
2174
|
);
|
|
2148
2175
|
});
|
|
2149
|
-
var Drawer =
|
|
2176
|
+
var Drawer = React22.forwardRef(function Drawer2(props, ref) {
|
|
2150
2177
|
const t = useStrings();
|
|
2151
|
-
const own =
|
|
2178
|
+
const own = React22.useRef(null), merged = useMergedRef(ref, own), titleId = uid(), descId = uid();
|
|
2152
2179
|
function close() {
|
|
2153
2180
|
if (props.dismissible !== false && props.onClose) props.onClose();
|
|
2154
2181
|
}
|
|
@@ -2160,8 +2187,8 @@ window.Aura = (() => {
|
|
|
2160
2187
|
});
|
|
2161
2188
|
if (!modal.ready) return null;
|
|
2162
2189
|
const side = props.side === "left" ? "left" : "right";
|
|
2163
|
-
return (0,
|
|
2164
|
-
/* @__PURE__ */
|
|
2190
|
+
return (0, import_react_dom6.createPortal)(
|
|
2191
|
+
/* @__PURE__ */ React22.createElement("div", { className: "aura-dialog-layer aura-drawer-layer", onKeyDown: modal.onKeyDown }, /* @__PURE__ */ React22.createElement("div", { className: "aura-scrim", onClick: close, "aria-hidden": true }), /* @__PURE__ */ React22.createElement(
|
|
2165
2192
|
"div",
|
|
2166
2193
|
{
|
|
2167
2194
|
ref: merged,
|
|
@@ -2173,17 +2200,17 @@ window.Aura = (() => {
|
|
|
2173
2200
|
tabIndex: -1,
|
|
2174
2201
|
className: cx("aura-drawer", "aura-drawer--" + side, "aura-drawer--" + (props.size || "md"), props.className)
|
|
2175
2202
|
},
|
|
2176
|
-
props.title || props.dismissible !== false ? /* @__PURE__ */
|
|
2177
|
-
props.description ? /* @__PURE__ */
|
|
2178
|
-
/* @__PURE__ */
|
|
2179
|
-
props.footer ? /* @__PURE__ */
|
|
2203
|
+
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,
|
|
2204
|
+
props.description ? /* @__PURE__ */ React22.createElement("p", { className: "aura-drawer__desc", id: descId }, props.description) : null,
|
|
2205
|
+
/* @__PURE__ */ React22.createElement("div", { className: "aura-drawer__body" }, props.children),
|
|
2206
|
+
props.footer ? /* @__PURE__ */ React22.createElement("div", { className: "aura-drawer__foot" }, props.footer) : null
|
|
2180
2207
|
)),
|
|
2181
2208
|
document.body
|
|
2182
2209
|
);
|
|
2183
2210
|
});
|
|
2184
2211
|
|
|
2185
2212
|
// src/DataTable.tsx
|
|
2186
|
-
var
|
|
2213
|
+
var React23 = __toESM(require_react(), 1);
|
|
2187
2214
|
var BP = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
2188
2215
|
var DEFAULT_COLUMNS = [
|
|
2189
2216
|
{ key: "id", label: "ID", width: 96, mono: true },
|
|
@@ -2195,7 +2222,7 @@ window.Aura = (() => {
|
|
|
2195
2222
|
var ROW_H = 48;
|
|
2196
2223
|
var OVERSCAN = 8;
|
|
2197
2224
|
var FLEX_MIN = 160;
|
|
2198
|
-
var DataTable =
|
|
2225
|
+
var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
2199
2226
|
const t = useStrings();
|
|
2200
2227
|
const columns = props.columns || DEFAULT_COLUMNS;
|
|
2201
2228
|
const byKey = {};
|
|
@@ -2238,23 +2265,23 @@ window.Aura = (() => {
|
|
|
2238
2265
|
}),
|
|
2239
2266
|
props.onPinnedColumnsChange
|
|
2240
2267
|
);
|
|
2241
|
-
const widthState =
|
|
2268
|
+
const widthState = React23.useState({});
|
|
2242
2269
|
const widths = widthState[0], setWidths = widthState[1];
|
|
2243
|
-
const activeState =
|
|
2244
|
-
const scrollState =
|
|
2270
|
+
const activeState = React23.useState({ r: 1, c: 0 });
|
|
2271
|
+
const scrollState = React23.useState(0);
|
|
2245
2272
|
const scrollTop = scrollState[0], setScrollTop = scrollState[1];
|
|
2246
|
-
const scrolledX =
|
|
2247
|
-
const menuState =
|
|
2273
|
+
const scrolledX = React23.useState(false);
|
|
2274
|
+
const menuState = React23.useState(null);
|
|
2248
2275
|
const menu = menuState[0], setMenu = menuState[1];
|
|
2249
|
-
const dragState =
|
|
2276
|
+
const dragState = React23.useState(null);
|
|
2250
2277
|
const drag = dragState[0], setDrag = dragState[1];
|
|
2251
|
-
const gridRef =
|
|
2252
|
-
const wrapRef =
|
|
2253
|
-
const boxWidth =
|
|
2278
|
+
const gridRef = React23.useRef(null);
|
|
2279
|
+
const wrapRef = React23.useRef(null), wrapMerged = useMergedRef(ref, wrapRef);
|
|
2280
|
+
const boxWidth = React23.useState(null);
|
|
2254
2281
|
const measure = !!props.stackBelow || columns.some(function(c) {
|
|
2255
2282
|
return c.hideBelow != null;
|
|
2256
2283
|
});
|
|
2257
|
-
|
|
2284
|
+
React23.useEffect(
|
|
2258
2285
|
function() {
|
|
2259
2286
|
if (!measure || !wrapRef.current || typeof ResizeObserver === "undefined") return;
|
|
2260
2287
|
const ro = new ResizeObserver(function(en) {
|
|
@@ -2273,9 +2300,9 @@ window.Aura = (() => {
|
|
|
2273
2300
|
const px = typeof c.hideBelow === "number" ? c.hideBelow : BP[c.hideBelow];
|
|
2274
2301
|
return px != null && boxWidth[0] < px;
|
|
2275
2302
|
}
|
|
2276
|
-
const scrollRef =
|
|
2277
|
-
const pending =
|
|
2278
|
-
const resizing =
|
|
2303
|
+
const scrollRef = React23.useRef(null);
|
|
2304
|
+
const pending = React23.useRef(null);
|
|
2305
|
+
const resizing = React23.useRef(false);
|
|
2279
2306
|
useIsoLayoutEffect(function() {
|
|
2280
2307
|
if (stacked || !gridRef.current) return;
|
|
2281
2308
|
const els = gridRef.current.querySelectorAll(
|
|
@@ -2334,7 +2361,7 @@ window.Aura = (() => {
|
|
|
2334
2361
|
if (isPinned(c)) s.left = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + "px)";
|
|
2335
2362
|
return s;
|
|
2336
2363
|
}
|
|
2337
|
-
const view =
|
|
2364
|
+
const view = React23.useMemo(
|
|
2338
2365
|
function() {
|
|
2339
2366
|
if (!sort || !sort.key || !byKey[sort.key]) return rows;
|
|
2340
2367
|
const col = byKey[sort.key];
|
|
@@ -2393,7 +2420,7 @@ window.Aura = (() => {
|
|
|
2393
2420
|
if (!activeRendered) return r === 0 && c === ac ? 0 : -1;
|
|
2394
2421
|
return r === ar && c === ac ? 0 : -1;
|
|
2395
2422
|
}
|
|
2396
|
-
|
|
2423
|
+
React23.useEffect(function() {
|
|
2397
2424
|
const p = pending.current;
|
|
2398
2425
|
if (!p || !gridRef.current) return;
|
|
2399
2426
|
let c = p.c;
|
|
@@ -2704,10 +2731,10 @@ window.Aura = (() => {
|
|
|
2704
2731
|
e.stopPropagation();
|
|
2705
2732
|
}
|
|
2706
2733
|
}
|
|
2707
|
-
const head = [/* @__PURE__ */
|
|
2734
|
+
const head = [/* @__PURE__ */ React23.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
|
|
2708
2735
|
if (selectable)
|
|
2709
2736
|
head.push(
|
|
2710
|
-
/* @__PURE__ */
|
|
2737
|
+
/* @__PURE__ */ React23.createElement(
|
|
2711
2738
|
"span",
|
|
2712
2739
|
{
|
|
2713
2740
|
key: "__sel",
|
|
@@ -2721,7 +2748,7 @@ window.Aura = (() => {
|
|
|
2721
2748
|
activeState[1]({ r: 0, c: 0 });
|
|
2722
2749
|
}
|
|
2723
2750
|
},
|
|
2724
|
-
nRows ? /* @__PURE__ */
|
|
2751
|
+
nRows ? /* @__PURE__ */ React23.createElement(
|
|
2725
2752
|
Checkbox,
|
|
2726
2753
|
{
|
|
2727
2754
|
checked: all,
|
|
@@ -2740,7 +2767,7 @@ window.Aura = (() => {
|
|
|
2740
2767
|
const ariaSort = isSorted && canSort ? sort.dir === "desc" ? "descending" : "ascending" : canSort ? "none" : void 0;
|
|
2741
2768
|
const pin = isPinned(c), edge = pin && i === nPinned - 1;
|
|
2742
2769
|
head.push(
|
|
2743
|
-
/* @__PURE__ */
|
|
2770
|
+
/* @__PURE__ */ React23.createElement(
|
|
2744
2771
|
"span",
|
|
2745
2772
|
{
|
|
2746
2773
|
key: c.key,
|
|
@@ -2788,7 +2815,7 @@ window.Aura = (() => {
|
|
|
2788
2815
|
setDrag(null);
|
|
2789
2816
|
}
|
|
2790
2817
|
},
|
|
2791
|
-
/* @__PURE__ */
|
|
2818
|
+
/* @__PURE__ */ React23.createElement("span", { className: "aura-table__th-inner" }, canSort ? /* @__PURE__ */ React23.createElement(
|
|
2792
2819
|
"button",
|
|
2793
2820
|
{
|
|
2794
2821
|
type: "button",
|
|
@@ -2801,8 +2828,8 @@ window.Aura = (() => {
|
|
|
2801
2828
|
}
|
|
2802
2829
|
},
|
|
2803
2830
|
c.label,
|
|
2804
|
-
/* @__PURE__ */
|
|
2805
|
-
) : /* @__PURE__ */
|
|
2831
|
+
/* @__PURE__ */ React23.createElement(Icon, { name: isSorted ? sort.dir === "desc" ? "arrow-down" : "arrow-up" : "arrow-up-down", size: 12 })
|
|
2832
|
+
) : /* @__PURE__ */ React23.createElement("span", { className: cx("aura-table__th-label", !c.label && "aura-sr-only") }, c.label || (c.actions ? t.actions : c.key)), pin ? /* @__PURE__ */ React23.createElement(Icon, { name: "pin", size: 12, className: "aura-table__pin-icon", label: t.pinned }) : null, controls ? /* @__PURE__ */ React23.createElement(
|
|
2806
2833
|
"button",
|
|
2807
2834
|
{
|
|
2808
2835
|
type: "button",
|
|
@@ -2816,9 +2843,9 @@ window.Aura = (() => {
|
|
|
2816
2843
|
openMenu("col", c.key, e.currentTarget, { r: 0, c: ci });
|
|
2817
2844
|
}
|
|
2818
2845
|
},
|
|
2819
|
-
/* @__PURE__ */
|
|
2846
|
+
/* @__PURE__ */ React23.createElement(Icon, { name: "ellipsis" })
|
|
2820
2847
|
) : null),
|
|
2821
|
-
canResize(c) ? /* @__PURE__ */
|
|
2848
|
+
canResize(c) ? /* @__PURE__ */ React23.createElement(
|
|
2822
2849
|
"span",
|
|
2823
2850
|
{
|
|
2824
2851
|
className: "aura-table__resize",
|
|
@@ -2840,7 +2867,7 @@ window.Aura = (() => {
|
|
|
2840
2867
|
);
|
|
2841
2868
|
});
|
|
2842
2869
|
head.push(
|
|
2843
|
-
/* @__PURE__ */
|
|
2870
|
+
/* @__PURE__ */ React23.createElement(
|
|
2844
2871
|
"span",
|
|
2845
2872
|
{
|
|
2846
2873
|
key: "__gr",
|
|
@@ -2851,10 +2878,10 @@ window.Aura = (() => {
|
|
|
2851
2878
|
);
|
|
2852
2879
|
function rowCells(r, i, k, isSel) {
|
|
2853
2880
|
const ri = i + 1;
|
|
2854
|
-
const cells = [/* @__PURE__ */
|
|
2881
|
+
const cells = [/* @__PURE__ */ React23.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
|
|
2855
2882
|
if (selectable)
|
|
2856
2883
|
cells.push(
|
|
2857
|
-
/* @__PURE__ */
|
|
2884
|
+
/* @__PURE__ */ React23.createElement(
|
|
2858
2885
|
"span",
|
|
2859
2886
|
{
|
|
2860
2887
|
key: "__sel",
|
|
@@ -2868,7 +2895,7 @@ window.Aura = (() => {
|
|
|
2868
2895
|
if (e.target === e.currentTarget) activeState[1]({ r: ri, c: 0 });
|
|
2869
2896
|
}
|
|
2870
2897
|
},
|
|
2871
|
-
/* @__PURE__ */
|
|
2898
|
+
/* @__PURE__ */ React23.createElement(
|
|
2872
2899
|
Checkbox,
|
|
2873
2900
|
{
|
|
2874
2901
|
checked: isSel,
|
|
@@ -2884,7 +2911,7 @@ window.Aura = (() => {
|
|
|
2884
2911
|
vis.forEach(function(c, j) {
|
|
2885
2912
|
const ci = j + (selectable ? 1 : 0), v = r[c.key], pin = isPinned(c);
|
|
2886
2913
|
cells.push(
|
|
2887
|
-
/* @__PURE__ */
|
|
2914
|
+
/* @__PURE__ */ React23.createElement(
|
|
2888
2915
|
"span",
|
|
2889
2916
|
{
|
|
2890
2917
|
key: c.key,
|
|
@@ -2903,12 +2930,12 @@ window.Aura = (() => {
|
|
|
2903
2930
|
if (activeState[0].r !== ri || activeState[0].c !== ci) activeState[1]({ r: ri, c: ci });
|
|
2904
2931
|
}
|
|
2905
2932
|
},
|
|
2906
|
-
c.render ? c.render(r) : c.pill ? /* @__PURE__ */
|
|
2933
|
+
c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React23.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v
|
|
2907
2934
|
)
|
|
2908
2935
|
);
|
|
2909
2936
|
});
|
|
2910
2937
|
cells.push(
|
|
2911
|
-
/* @__PURE__ */
|
|
2938
|
+
/* @__PURE__ */ React23.createElement(
|
|
2912
2939
|
"span",
|
|
2913
2940
|
{
|
|
2914
2941
|
key: "__gr",
|
|
@@ -2925,14 +2952,14 @@ window.Aura = (() => {
|
|
|
2925
2952
|
const n2 = pageSize || props.skeletonRows || 5;
|
|
2926
2953
|
const skRows = body = [];
|
|
2927
2954
|
for (let i = 0; i < n2; i++) {
|
|
2928
|
-
const sk = [/* @__PURE__ */
|
|
2955
|
+
const sk = [/* @__PURE__ */ React23.createElement("span", { key: "__gl", className: "aura-table__gutter" })];
|
|
2929
2956
|
if (selectable)
|
|
2930
2957
|
sk.push(
|
|
2931
|
-
/* @__PURE__ */
|
|
2958
|
+
/* @__PURE__ */ React23.createElement("span", { key: "__sel", className: cx("aura-table__sel", nPinned && "is-pinned") }, /* @__PURE__ */ React23.createElement("span", { className: "aura-skel aura-skel--box" }))
|
|
2932
2959
|
);
|
|
2933
2960
|
vis.forEach(function(c, j) {
|
|
2934
2961
|
sk.push(
|
|
2935
|
-
/* @__PURE__ */
|
|
2962
|
+
/* @__PURE__ */ React23.createElement("span", { key: c.key, className: cx("aura-table__td", isPinned(c) && "is-pinned"), style: cellStyle(c, j) }, /* @__PURE__ */ React23.createElement(
|
|
2936
2963
|
"span",
|
|
2937
2964
|
{
|
|
2938
2965
|
className: cx("aura-skel", c.pill && "aura-skel--pill"),
|
|
@@ -2942,24 +2969,24 @@ window.Aura = (() => {
|
|
|
2942
2969
|
);
|
|
2943
2970
|
});
|
|
2944
2971
|
sk.push(
|
|
2945
|
-
/* @__PURE__ */
|
|
2972
|
+
/* @__PURE__ */ React23.createElement("span", { key: "__gr", className: cx("aura-table__gutter aura-table__gutter--end", controls && "has-picker") })
|
|
2946
2973
|
);
|
|
2947
2974
|
skRows.push(
|
|
2948
|
-
/* @__PURE__ */
|
|
2975
|
+
/* @__PURE__ */ React23.createElement("div", { key: "sk" + i, className: "aura-table__row aura-table__row--skeleton", "aria-hidden": true, style: rowStyle }, sk)
|
|
2949
2976
|
);
|
|
2950
2977
|
}
|
|
2951
2978
|
} else if (!rows.length) {
|
|
2952
2979
|
const em = props.empty || {};
|
|
2953
|
-
body = /* @__PURE__ */
|
|
2980
|
+
body = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty", role: "row" }, /* @__PURE__ */ React23.createElement("div", { role: "gridcell" }, /* @__PURE__ */ React23.createElement("span", { className: "aura-table__empty-icon" }, /* @__PURE__ */ React23.createElement(Icon, { name: em.icon || "inbox", size: "lg" })), /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-title" }, em.title || t.empty), em.description ? /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-text" }, em.description) : null, em.action ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty-action" }, em.action) : null));
|
|
2954
2981
|
} else {
|
|
2955
2982
|
const bodyRows = body = [];
|
|
2956
2983
|
if (virtual && start > 0)
|
|
2957
|
-
bodyRows.push(/* @__PURE__ */
|
|
2984
|
+
bodyRows.push(/* @__PURE__ */ React23.createElement("div", { key: "__top", style: { height: start * ROW_H + "px" }, "aria-hidden": true }));
|
|
2958
2985
|
for (let ri = start; ri < end; ri++) {
|
|
2959
2986
|
(function(r, i) {
|
|
2960
2987
|
const k = r[rowKey], isSel = !!selSet[k];
|
|
2961
2988
|
bodyRows.push(
|
|
2962
|
-
/* @__PURE__ */
|
|
2989
|
+
/* @__PURE__ */ React23.createElement(
|
|
2963
2990
|
"div",
|
|
2964
2991
|
{
|
|
2965
2992
|
key: k,
|
|
@@ -2980,12 +3007,12 @@ window.Aura = (() => {
|
|
|
2980
3007
|
})(pageRows[ri], ri);
|
|
2981
3008
|
}
|
|
2982
3009
|
if (virtual && end < pageRows.length)
|
|
2983
|
-
bodyRows.push(/* @__PURE__ */
|
|
3010
|
+
bodyRows.push(/* @__PURE__ */ React23.createElement("div", { key: "__bot", style: { height: (pageRows.length - end) * ROW_H + "px" }, "aria-hidden": true }));
|
|
2984
3011
|
}
|
|
2985
3012
|
let foot = null;
|
|
2986
3013
|
if (pageSize && (rows.length || loading)) {
|
|
2987
3014
|
const from = rows.length ? first + 1 : 0, to = Math.min(first + pageSize, view.length);
|
|
2988
|
-
foot = /* @__PURE__ */
|
|
3015
|
+
foot = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React23.createElement("span", { "aria-live": "polite" }, loading ? t.loading : t.range(from, to, view.length)), /* @__PURE__ */ React23.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React23.createElement("span", null, t.page(page, pageCount)), /* @__PURE__ */ React23.createElement(
|
|
2989
3016
|
IconButton,
|
|
2990
3017
|
{
|
|
2991
3018
|
icon: "chevron-left",
|
|
@@ -2995,7 +3022,7 @@ window.Aura = (() => {
|
|
|
2995
3022
|
goPage(page - 1);
|
|
2996
3023
|
}
|
|
2997
3024
|
}
|
|
2998
|
-
), /* @__PURE__ */
|
|
3025
|
+
), /* @__PURE__ */ React23.createElement(
|
|
2999
3026
|
IconButton,
|
|
3000
3027
|
{
|
|
3001
3028
|
icon: "chevron-right",
|
|
@@ -3007,7 +3034,7 @@ window.Aura = (() => {
|
|
|
3007
3034
|
}
|
|
3008
3035
|
)));
|
|
3009
3036
|
} else if (height && rows.length && !loading) {
|
|
3010
|
-
foot = /* @__PURE__ */
|
|
3037
|
+
foot = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React23.createElement("span", null, t.rowCount(view.length)), selectable && selected.length ? /* @__PURE__ */ React23.createElement("span", null, t.selectedCount(selected.length)) : /* @__PURE__ */ React23.createElement("span", null));
|
|
3011
3038
|
}
|
|
3012
3039
|
if (stacked) {
|
|
3013
3040
|
const titleCol = vis[0], pillCol = vis.filter(function(c) {
|
|
@@ -3021,20 +3048,20 @@ window.Aura = (() => {
|
|
|
3021
3048
|
});
|
|
3022
3049
|
let cardBody;
|
|
3023
3050
|
if (loading) {
|
|
3024
|
-
cardBody = /* @__PURE__ */
|
|
3025
|
-
return /* @__PURE__ */
|
|
3051
|
+
cardBody = /* @__PURE__ */ React23.createElement("ul", { className: "aura-table__cards", "aria-busy": true }, [0, 1, 2].map(function(i) {
|
|
3052
|
+
return /* @__PURE__ */ React23.createElement("li", { key: i, className: "aura-table__card", "aria-hidden": true }, /* @__PURE__ */ React23.createElement("span", { className: "aura-skel", style: { width: "50%", height: "14px" } }), /* @__PURE__ */ React23.createElement("span", { className: "aura-skel", style: { width: "80%" } }), /* @__PURE__ */ React23.createElement("span", { className: "aura-skel", style: { width: "64%" } }));
|
|
3026
3053
|
}));
|
|
3027
3054
|
} else if (!rows.length) {
|
|
3028
3055
|
const em2 = props.empty || {};
|
|
3029
|
-
cardBody = /* @__PURE__ */
|
|
3056
|
+
cardBody = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty" }, /* @__PURE__ */ React23.createElement("div", null, /* @__PURE__ */ React23.createElement("span", { className: "aura-table__empty-icon" }, /* @__PURE__ */ React23.createElement(Icon, { name: em2.icon || "inbox", size: "lg" })), /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-title" }, em2.title || t.empty), em2.description ? /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-text" }, em2.description) : null, em2.action ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty-action" }, em2.action) : null));
|
|
3030
3057
|
} else {
|
|
3031
3058
|
const cellVal = function(c, r) {
|
|
3032
3059
|
const v = r[c.key];
|
|
3033
|
-
return c.render ? c.render(r) : c.pill ? /* @__PURE__ */
|
|
3060
|
+
return c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React23.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v;
|
|
3034
3061
|
};
|
|
3035
|
-
cardBody = /* @__PURE__ */
|
|
3062
|
+
cardBody = /* @__PURE__ */ React23.createElement("ul", { className: "aura-table__cards", "aria-label": props.label }, pageRows.map(function(r) {
|
|
3036
3063
|
const k = r[rowKey], isSel = !!selSet[k];
|
|
3037
|
-
return /* @__PURE__ */
|
|
3064
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3038
3065
|
"li",
|
|
3039
3066
|
{
|
|
3040
3067
|
key: k,
|
|
@@ -3049,7 +3076,7 @@ window.Aura = (() => {
|
|
|
3049
3076
|
if (e.target === e.currentTarget && e.key === "Enter" && props.onRowActivate) props.onRowActivate(r);
|
|
3050
3077
|
}
|
|
3051
3078
|
},
|
|
3052
|
-
/* @__PURE__ */
|
|
3079
|
+
/* @__PURE__ */ React23.createElement("div", { className: "aura-table__card-head" }, selectable ? /* @__PURE__ */ React23.createElement(
|
|
3053
3080
|
Checkbox,
|
|
3054
3081
|
{
|
|
3055
3082
|
checked: isSel,
|
|
@@ -3058,16 +3085,16 @@ window.Aura = (() => {
|
|
|
3058
3085
|
toggle(k, on);
|
|
3059
3086
|
}
|
|
3060
3087
|
}
|
|
3061
|
-
) : null, /* @__PURE__ */
|
|
3062
|
-
return /* @__PURE__ */
|
|
3088
|
+
) : 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) {
|
|
3089
|
+
return /* @__PURE__ */ React23.createElement("span", { key: c.key, className: "aura-table__card-actions" }, cellVal(c, r));
|
|
3063
3090
|
})),
|
|
3064
|
-
rest.length ? /* @__PURE__ */
|
|
3065
|
-
return /* @__PURE__ */
|
|
3091
|
+
rest.length ? /* @__PURE__ */ React23.createElement("dl", { className: "aura-table__card-fields" }, rest.map(function(c) {
|
|
3092
|
+
return /* @__PURE__ */ React23.createElement("div", { key: c.key }, /* @__PURE__ */ React23.createElement("dt", null, c.label), /* @__PURE__ */ React23.createElement("dd", { className: c.mono ? "aura-table__mono" : void 0 }, cellVal(c, r)));
|
|
3066
3093
|
})) : null
|
|
3067
3094
|
);
|
|
3068
3095
|
}));
|
|
3069
3096
|
}
|
|
3070
|
-
return /* @__PURE__ */
|
|
3097
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3071
3098
|
"div",
|
|
3072
3099
|
{
|
|
3073
3100
|
ref: wrapMerged,
|
|
@@ -3076,7 +3103,7 @@ window.Aura = (() => {
|
|
|
3076
3103
|
"aria-label": props.label,
|
|
3077
3104
|
"aria-busy": loading || void 0
|
|
3078
3105
|
},
|
|
3079
|
-
selectable && pageRows.length && !loading ? /* @__PURE__ */
|
|
3106
|
+
selectable && pageRows.length && !loading ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__stack-bar" }, /* @__PURE__ */ React23.createElement(
|
|
3080
3107
|
Checkbox,
|
|
3081
3108
|
{
|
|
3082
3109
|
checked: all,
|
|
@@ -3084,7 +3111,7 @@ window.Aura = (() => {
|
|
|
3084
3111
|
label: all ? t.deselectAllRows : t.selectAllRows,
|
|
3085
3112
|
onChange: toggleAll
|
|
3086
3113
|
}
|
|
3087
|
-
), /* @__PURE__ */
|
|
3114
|
+
), /* @__PURE__ */ React23.createElement("span", null, nSel ? t.selectedCount(nSel) : t.selectAll)) : null,
|
|
3088
3115
|
cardBody,
|
|
3089
3116
|
foot
|
|
3090
3117
|
);
|
|
@@ -3094,7 +3121,7 @@ window.Aura = (() => {
|
|
|
3094
3121
|
scrollPaddingTop: ROW_H + "px"
|
|
3095
3122
|
};
|
|
3096
3123
|
if (height) scrollStyle.height = height + "px";
|
|
3097
|
-
return /* @__PURE__ */
|
|
3124
|
+
return /* @__PURE__ */ React23.createElement("div", { ref: wrapMerged, className: cx("aura-table", scrolledX[0] && "is-scrolled-x", props.className) }, /* @__PURE__ */ React23.createElement(
|
|
3098
3125
|
"div",
|
|
3099
3126
|
{
|
|
3100
3127
|
ref: function(el) {
|
|
@@ -3119,9 +3146,9 @@ window.Aura = (() => {
|
|
|
3119
3146
|
if (sx !== scrolledX[0]) scrolledX[1](sx);
|
|
3120
3147
|
}
|
|
3121
3148
|
},
|
|
3122
|
-
/* @__PURE__ */
|
|
3149
|
+
/* @__PURE__ */ React23.createElement("div", { className: "aura-table__head", role: "row", "aria-rowindex": 1, style: rowStyle }, head),
|
|
3123
3150
|
body
|
|
3124
|
-
), loading ? /* @__PURE__ */
|
|
3151
|
+
), loading ? /* @__PURE__ */ React23.createElement("span", { className: "aura-sr-only", role: "status" }, t.loadingRows) : null, controls ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__picker" }, /* @__PURE__ */ React23.createElement(
|
|
3125
3152
|
IconButton,
|
|
3126
3153
|
{
|
|
3127
3154
|
icon: "columns-3",
|
|
@@ -3131,7 +3158,7 @@ window.Aura = (() => {
|
|
|
3131
3158
|
openMenu("picker", null, e.currentTarget);
|
|
3132
3159
|
}
|
|
3133
3160
|
}
|
|
3134
|
-
)) : null, foot, menu ? /* @__PURE__ */
|
|
3161
|
+
)) : null, foot, menu ? /* @__PURE__ */ React23.createElement(
|
|
3135
3162
|
Menu,
|
|
3136
3163
|
{
|
|
3137
3164
|
anchor: menu.anchor,
|
|
@@ -3142,12 +3169,12 @@ window.Aura = (() => {
|
|
|
3142
3169
|
) : null);
|
|
3143
3170
|
});
|
|
3144
3171
|
|
|
3145
|
-
// src/
|
|
3146
|
-
var
|
|
3147
|
-
var
|
|
3148
|
-
var Card =
|
|
3172
|
+
// src/Card.tsx
|
|
3173
|
+
var React24 = __toESM(require_react(), 1);
|
|
3174
|
+
var h4 = React24.createElement;
|
|
3175
|
+
var Card = React24.forwardRef(function Card2(props, ref) {
|
|
3149
3176
|
const creative = props.variant === "creative";
|
|
3150
|
-
return
|
|
3177
|
+
return h4(
|
|
3151
3178
|
props.as || "section",
|
|
3152
3179
|
{
|
|
3153
3180
|
ref,
|
|
@@ -3159,19 +3186,22 @@ window.Aura = (() => {
|
|
|
3159
3186
|
),
|
|
3160
3187
|
"aria-labelledby": props.title && props.titleId ? props.titleId : void 0
|
|
3161
3188
|
},
|
|
3162
|
-
props.title || props.actions ? /* @__PURE__ */
|
|
3163
|
-
props.children ? /* @__PURE__ */
|
|
3164
|
-
props.footer ? /* @__PURE__ */
|
|
3189
|
+
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,
|
|
3190
|
+
props.children ? /* @__PURE__ */ React24.createElement("div", { className: "aura-card__body" }, props.children) : null,
|
|
3191
|
+
props.footer ? /* @__PURE__ */ React24.createElement("div", { className: "aura-card__foot" }, props.footer) : null
|
|
3165
3192
|
);
|
|
3166
3193
|
});
|
|
3167
|
-
|
|
3194
|
+
|
|
3195
|
+
// src/Tabs.tsx
|
|
3196
|
+
var React25 = __toESM(require_react(), 1);
|
|
3197
|
+
var Tabs = React25.forwardRef(function Tabs2(props, ref) {
|
|
3168
3198
|
const items = props.tabs || [], base = uid();
|
|
3169
3199
|
const st = useMaybeControlled(
|
|
3170
3200
|
props.value,
|
|
3171
3201
|
props.defaultValue || items[0] && items[0].id,
|
|
3172
3202
|
props.onChange
|
|
3173
3203
|
);
|
|
3174
|
-
const refs =
|
|
3204
|
+
const refs = React25.useRef({});
|
|
3175
3205
|
const current2 = items.filter(function(t) {
|
|
3176
3206
|
return t.id === st[0];
|
|
3177
3207
|
})[0] || items[0];
|
|
@@ -3183,7 +3213,7 @@ window.Aura = (() => {
|
|
|
3183
3213
|
st[1](t.id);
|
|
3184
3214
|
if (refs.current[t.id]) refs.current[t.id].focus();
|
|
3185
3215
|
}
|
|
3186
|
-
return /* @__PURE__ */
|
|
3216
|
+
return /* @__PURE__ */ React25.createElement("div", { ref, className: cx("aura-tabs", props.className) }, /* @__PURE__ */ React25.createElement(
|
|
3187
3217
|
"div",
|
|
3188
3218
|
{
|
|
3189
3219
|
role: "tablist",
|
|
@@ -3210,7 +3240,7 @@ window.Aura = (() => {
|
|
|
3210
3240
|
},
|
|
3211
3241
|
items.map(function(t) {
|
|
3212
3242
|
const on = current2 && t.id === current2.id;
|
|
3213
|
-
return /* @__PURE__ */
|
|
3243
|
+
return /* @__PURE__ */ React25.createElement(
|
|
3214
3244
|
"button",
|
|
3215
3245
|
{
|
|
3216
3246
|
key: t.id,
|
|
@@ -3229,12 +3259,12 @@ window.Aura = (() => {
|
|
|
3229
3259
|
st[1](t.id);
|
|
3230
3260
|
}
|
|
3231
3261
|
},
|
|
3232
|
-
t.icon ? /* @__PURE__ */
|
|
3262
|
+
t.icon ? /* @__PURE__ */ React25.createElement(Icon, { name: t.icon }) : null,
|
|
3233
3263
|
t.label,
|
|
3234
|
-
t.count != null ? /* @__PURE__ */
|
|
3264
|
+
t.count != null ? /* @__PURE__ */ React25.createElement("span", { className: "aura-tab__count" }, t.count) : null
|
|
3235
3265
|
);
|
|
3236
3266
|
})
|
|
3237
|
-
), current2 && current2.content !== void 0 ? /* @__PURE__ */
|
|
3267
|
+
), current2 && current2.content !== void 0 ? /* @__PURE__ */ React25.createElement(
|
|
3238
3268
|
"div",
|
|
3239
3269
|
{
|
|
3240
3270
|
role: "tabpanel",
|
|
@@ -3246,7 +3276,10 @@ window.Aura = (() => {
|
|
|
3246
3276
|
current2.content
|
|
3247
3277
|
) : null);
|
|
3248
3278
|
});
|
|
3249
|
-
|
|
3279
|
+
|
|
3280
|
+
// src/SideNav.tsx
|
|
3281
|
+
var React26 = __toESM(require_react(), 1);
|
|
3282
|
+
var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
3250
3283
|
const t = useStrings();
|
|
3251
3284
|
const st = useMaybeControlled(
|
|
3252
3285
|
props.value,
|
|
@@ -3256,9 +3289,9 @@ window.Aura = (() => {
|
|
|
3256
3289
|
function item(it) {
|
|
3257
3290
|
const on = st[0] === it.id;
|
|
3258
3291
|
const inner = [
|
|
3259
|
-
it.icon ? /* @__PURE__ */
|
|
3260
|
-
/* @__PURE__ */
|
|
3261
|
-
it.count != null ? /* @__PURE__ */
|
|
3292
|
+
it.icon ? /* @__PURE__ */ React26.createElement(Icon, { key: "i", name: it.icon }) : null,
|
|
3293
|
+
/* @__PURE__ */ React26.createElement("span", { key: "l", className: "aura-nav__label" }, it.label),
|
|
3294
|
+
it.count != null ? /* @__PURE__ */ React26.createElement("span", { key: "c", className: "aura-nav__count" }, it.count) : null
|
|
3262
3295
|
];
|
|
3263
3296
|
const common = {
|
|
3264
3297
|
className: cx("aura-nav__item", on && "is-active"),
|
|
@@ -3268,33 +3301,39 @@ window.Aura = (() => {
|
|
|
3268
3301
|
st[1](it.id);
|
|
3269
3302
|
}
|
|
3270
3303
|
};
|
|
3271
|
-
return /* @__PURE__ */
|
|
3304
|
+
return /* @__PURE__ */ React26.createElement("li", { key: it.id }, it.href ? /* @__PURE__ */ React26.createElement("a", { href: it.href, ...common }, inner) : /* @__PURE__ */ React26.createElement("button", { type: "button", ...common }, inner));
|
|
3272
3305
|
}
|
|
3273
|
-
return /* @__PURE__ */
|
|
3274
|
-
return /* @__PURE__ */
|
|
3275
|
-
})), props.footer ? /* @__PURE__ */
|
|
3306
|
+
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) {
|
|
3307
|
+
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)));
|
|
3308
|
+
})), props.footer ? /* @__PURE__ */ React26.createElement("div", { className: "aura-nav__footer" }, props.footer) : null);
|
|
3276
3309
|
});
|
|
3277
|
-
|
|
3310
|
+
|
|
3311
|
+
// src/Breadcrumb.tsx
|
|
3312
|
+
var React27 = __toESM(require_react(), 1);
|
|
3313
|
+
var Breadcrumb = React27.forwardRef(function Breadcrumb2(props, ref) {
|
|
3278
3314
|
const t = useStrings();
|
|
3279
3315
|
const items = props.items || [];
|
|
3280
|
-
return /* @__PURE__ */
|
|
3316
|
+
return /* @__PURE__ */ React27.createElement("nav", { ref, "aria-label": props.label || t.breadcrumb, className: cx("aura-crumbs", props.className) }, /* @__PURE__ */ React27.createElement("ol", null, items.map(function(it, i) {
|
|
3281
3317
|
const last = i === items.length - 1;
|
|
3282
|
-
return /* @__PURE__ */
|
|
3318
|
+
return /* @__PURE__ */ React27.createElement("li", { key: i }, last ? /* @__PURE__ */ React27.createElement("span", { "aria-current": "page", className: "aura-crumbs__current" }, it.label) : it.href ? /* @__PURE__ */ React27.createElement("a", { href: it.href, onClick: it.onClick }, it.label) : /* @__PURE__ */ React27.createElement("button", { type: "button", onClick: it.onClick }, it.label), last ? null : /* @__PURE__ */ React27.createElement(Icon, { name: "chevron-right", size: 12, className: "aura-crumbs__sep" }));
|
|
3283
3319
|
})));
|
|
3284
3320
|
});
|
|
3321
|
+
|
|
3322
|
+
// src/Avatar.tsx
|
|
3323
|
+
var React28 = __toESM(require_react(), 1);
|
|
3285
3324
|
var AVATAR_TONES = ["progress", "ready", "neutral", "warning"];
|
|
3286
3325
|
function initials(name) {
|
|
3287
3326
|
const parts = String(name || "?").trim().split(/\s+/);
|
|
3288
3327
|
return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
|
|
3289
3328
|
}
|
|
3290
|
-
var Avatar =
|
|
3291
|
-
const size = props.size || "md", errState =
|
|
3329
|
+
var Avatar = React28.forwardRef(function Avatar2(props, ref) {
|
|
3330
|
+
const size = props.size || "md", errState = React28.useState(false);
|
|
3292
3331
|
let hash = 0;
|
|
3293
3332
|
String(props.name || "").split("").forEach(function(ch) {
|
|
3294
3333
|
hash = hash * 31 + ch.charCodeAt(0) >>> 0;
|
|
3295
3334
|
});
|
|
3296
3335
|
const tone2 = AVATAR_TONES[hash % AVATAR_TONES.length];
|
|
3297
|
-
return /* @__PURE__ */
|
|
3336
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3298
3337
|
"span",
|
|
3299
3338
|
{
|
|
3300
3339
|
ref,
|
|
@@ -3302,7 +3341,7 @@ window.Aura = (() => {
|
|
|
3302
3341
|
role: "img",
|
|
3303
3342
|
"aria-label": props.name + (props.status ? ", " + props.status : "")
|
|
3304
3343
|
},
|
|
3305
|
-
props.src && !errState[0] ? /* @__PURE__ */
|
|
3344
|
+
props.src && !errState[0] ? /* @__PURE__ */ React28.createElement(
|
|
3306
3345
|
"img",
|
|
3307
3346
|
{
|
|
3308
3347
|
src: props.src,
|
|
@@ -3311,18 +3350,20 @@ window.Aura = (() => {
|
|
|
3311
3350
|
errState[1](true);
|
|
3312
3351
|
}
|
|
3313
3352
|
}
|
|
3314
|
-
) : /* @__PURE__ */
|
|
3315
|
-
props.status === "online" ? /* @__PURE__ */
|
|
3353
|
+
) : /* @__PURE__ */ React28.createElement("span", { "aria-hidden": true }, initials(props.name)),
|
|
3354
|
+
props.status === "online" ? /* @__PURE__ */ React28.createElement("span", { className: "aura-avatar__status", "aria-hidden": true }) : null
|
|
3316
3355
|
);
|
|
3317
3356
|
});
|
|
3318
3357
|
|
|
3319
|
-
// src/
|
|
3320
|
-
var
|
|
3321
|
-
|
|
3358
|
+
// src/Stack.tsx
|
|
3359
|
+
var React30 = __toESM(require_react(), 1);
|
|
3360
|
+
|
|
3361
|
+
// src/responsive.tsx
|
|
3362
|
+
var React29 = __toESM(require_react(), 1);
|
|
3322
3363
|
var breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
3323
3364
|
var ORDER = ["base", "sm", "md", "lg", "xl"];
|
|
3324
3365
|
function useBreakpoint() {
|
|
3325
|
-
return
|
|
3366
|
+
return React29.useSyncExternalStore(subscribe, current, function() {
|
|
3326
3367
|
return "lg";
|
|
3327
3368
|
});
|
|
3328
3369
|
}
|
|
@@ -3360,7 +3401,10 @@ window.Aura = (() => {
|
|
|
3360
3401
|
var space = function(v) {
|
|
3361
3402
|
return typeof v === "number" ? "var(--aura-space-" + v + ")" : v;
|
|
3362
3403
|
};
|
|
3363
|
-
|
|
3404
|
+
|
|
3405
|
+
// src/Stack.tsx
|
|
3406
|
+
var h5 = React30.createElement;
|
|
3407
|
+
var Stack = React30.forwardRef(function Stack2(props, ref) {
|
|
3364
3408
|
const style = Object.assign(
|
|
3365
3409
|
{},
|
|
3366
3410
|
respVars("aura-stack-dir", props.direction || "column"),
|
|
@@ -3370,23 +3414,31 @@ window.Aura = (() => {
|
|
|
3370
3414
|
props.wrap ? { flexWrap: "wrap" } : null,
|
|
3371
3415
|
props.style
|
|
3372
3416
|
);
|
|
3373
|
-
return
|
|
3417
|
+
return h5(props.as || "div", { ref, className: cx("aura-stack", props.className), style }, props.children);
|
|
3374
3418
|
});
|
|
3375
|
-
|
|
3419
|
+
|
|
3420
|
+
// src/Grid.tsx
|
|
3421
|
+
var React31 = __toESM(require_react(), 1);
|
|
3422
|
+
var h6 = React31.createElement;
|
|
3423
|
+
var Grid = React31.forwardRef(function Grid2(props, ref) {
|
|
3376
3424
|
const style = Object.assign(
|
|
3377
3425
|
{},
|
|
3378
3426
|
respVars("aura-grid-gap", props.gap == null ? 6 : props.gap, space),
|
|
3379
3427
|
props.minItemWidth ? { gridTemplateColumns: "repeat(auto-fill, minmax(min(" + props.minItemWidth + "px, 100%), 1fr))" } : respVars("aura-grid-cols", props.columns || 1),
|
|
3380
3428
|
props.style
|
|
3381
3429
|
);
|
|
3382
|
-
return
|
|
3430
|
+
return h6(
|
|
3383
3431
|
props.as || "div",
|
|
3384
3432
|
{ ref, className: cx("aura-grid-layout", props.minItemWidth && "is-auto", props.className), style },
|
|
3385
3433
|
props.children
|
|
3386
3434
|
);
|
|
3387
3435
|
});
|
|
3388
|
-
|
|
3389
|
-
|
|
3436
|
+
|
|
3437
|
+
// src/Container.tsx
|
|
3438
|
+
var React32 = __toESM(require_react(), 1);
|
|
3439
|
+
var h7 = React32.createElement;
|
|
3440
|
+
var Container = React32.forwardRef(function Container2(props, ref) {
|
|
3441
|
+
return h7(
|
|
3390
3442
|
props.as || "div",
|
|
3391
3443
|
{
|
|
3392
3444
|
ref,
|
|
@@ -3396,26 +3448,29 @@ window.Aura = (() => {
|
|
|
3396
3448
|
props.children
|
|
3397
3449
|
);
|
|
3398
3450
|
});
|
|
3399
|
-
|
|
3451
|
+
|
|
3452
|
+
// src/AppShell.tsx
|
|
3453
|
+
var React33 = __toESM(require_react(), 1);
|
|
3454
|
+
var AppShell = React33.forwardRef(function AppShell2(props, ref) {
|
|
3400
3455
|
const t = useStrings();
|
|
3401
3456
|
const bp = useBreakpoint();
|
|
3402
3457
|
const compact = bp === "base" || bp === "sm" || bp === "md";
|
|
3403
|
-
const st =
|
|
3404
|
-
|
|
3458
|
+
const st = React33.useState(false), open = st[0], setOpen = st[1];
|
|
3459
|
+
React33.useEffect(
|
|
3405
3460
|
function() {
|
|
3406
3461
|
if (!compact) setOpen(false);
|
|
3407
3462
|
},
|
|
3408
3463
|
[compact]
|
|
3409
3464
|
);
|
|
3410
3465
|
const navEl = props.nav;
|
|
3411
|
-
const nav = props.nav &&
|
|
3466
|
+
const nav = props.nav && React33.isValidElement(props.nav) && compact ? React33.cloneElement(navEl, {
|
|
3412
3467
|
onChange: function(id) {
|
|
3413
3468
|
if (navEl.props.onChange) navEl.props.onChange(id);
|
|
3414
3469
|
setOpen(false);
|
|
3415
3470
|
},
|
|
3416
3471
|
className: cx(navEl.props.className, "is-in-drawer")
|
|
3417
3472
|
}) : props.nav;
|
|
3418
|
-
return /* @__PURE__ */
|
|
3473
|
+
return /* @__PURE__ */ React33.createElement("div", { ref, className: cx("aura-shell", compact && "is-compact", props.className) }, !compact ? /* @__PURE__ */ React33.createElement("div", { className: "aura-shell__nav" }, nav) : null, compact ? /* @__PURE__ */ React33.createElement(
|
|
3419
3474
|
Drawer,
|
|
3420
3475
|
{
|
|
3421
3476
|
open,
|
|
@@ -3428,7 +3483,7 @@ window.Aura = (() => {
|
|
|
3428
3483
|
dismissible: true
|
|
3429
3484
|
},
|
|
3430
3485
|
nav
|
|
3431
|
-
) : null, /* @__PURE__ */
|
|
3486
|
+
) : null, /* @__PURE__ */ React33.createElement("div", { className: "aura-shell__main" }, props.header || compact ? /* @__PURE__ */ React33.createElement("header", { className: "aura-shell__bar" }, compact ? /* @__PURE__ */ React33.createElement(
|
|
3432
3487
|
IconButton,
|
|
3433
3488
|
{
|
|
3434
3489
|
icon: "menu",
|
|
@@ -3439,16 +3494,16 @@ window.Aura = (() => {
|
|
|
3439
3494
|
},
|
|
3440
3495
|
"aria-expanded": open
|
|
3441
3496
|
}
|
|
3442
|
-
) : null, /* @__PURE__ */
|
|
3497
|
+
) : null, /* @__PURE__ */ React33.createElement("div", { className: "aura-shell__bar-content" }, props.header)) : null, /* @__PURE__ */ React33.createElement("main", { className: "aura-shell__content", id: props.mainId || "main" }, props.children)));
|
|
3443
3498
|
});
|
|
3444
3499
|
|
|
3445
3500
|
// src/Surface.tsx
|
|
3446
|
-
var
|
|
3447
|
-
var
|
|
3448
|
-
var Surface =
|
|
3501
|
+
var React34 = __toESM(require_react(), 1);
|
|
3502
|
+
var h8 = React34.createElement;
|
|
3503
|
+
var Surface = React34.forwardRef(function Surface2(props, ref) {
|
|
3449
3504
|
const t = props.texture || "mesh";
|
|
3450
3505
|
const rest = omit(props, ["texture", "className", "children", "as"]);
|
|
3451
|
-
return
|
|
3506
|
+
return h8(
|
|
3452
3507
|
props.as || "div",
|
|
3453
3508
|
Object.assign({}, rest, {
|
|
3454
3509
|
ref,
|
|
@@ -3466,14 +3521,14 @@ window.Aura = (() => {
|
|
|
3466
3521
|
});
|
|
3467
3522
|
|
|
3468
3523
|
// src/Stat.tsx
|
|
3469
|
-
var
|
|
3470
|
-
var Stat =
|
|
3524
|
+
var React35 = __toESM(require_react(), 1);
|
|
3525
|
+
var Stat = React35.forwardRef(function Stat2(props, ref) {
|
|
3471
3526
|
const ch = props.change;
|
|
3472
3527
|
const dir = ch && (ch.direction || "flat");
|
|
3473
3528
|
const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
|
|
3474
3529
|
const Tag3 = props.href ? "a" : props.onClick ? "button" : "div";
|
|
3475
3530
|
const interactive = Tag3 !== "div";
|
|
3476
|
-
return /* @__PURE__ */
|
|
3531
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3477
3532
|
Tag3,
|
|
3478
3533
|
{
|
|
3479
3534
|
ref,
|
|
@@ -3483,15 +3538,15 @@ window.Aura = (() => {
|
|
|
3483
3538
|
type: Tag3 === "button" ? "button" : void 0,
|
|
3484
3539
|
"aria-busy": props.loading || void 0
|
|
3485
3540
|
},
|
|
3486
|
-
/* @__PURE__ */
|
|
3487
|
-
props.loading ? /* @__PURE__ */
|
|
3488
|
-
ch && !props.loading || props.caption ? /* @__PURE__ */
|
|
3541
|
+
/* @__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),
|
|
3542
|
+
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),
|
|
3543
|
+
ch && !props.loading || props.caption ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__foot" }, ch && !props.loading ? /* @__PURE__ */ React35.createElement("span", { className: cx("aura-stat__change", "is-" + tone2) }, /* @__PURE__ */ React35.createElement(Icon, { name: dir === "up" ? "trending-up" : dir === "down" ? "trending-down" : "minus", size: 14 }), /* @__PURE__ */ React35.createElement("span", null, ch.value)) : null, ch && ch.label && !props.loading ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__caption" }, ch.label) : null, props.caption ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__caption" }, props.caption) : null) : null
|
|
3489
3544
|
);
|
|
3490
3545
|
});
|
|
3491
3546
|
|
|
3492
3547
|
// src/TimePicker.tsx
|
|
3493
|
-
var
|
|
3494
|
-
var
|
|
3548
|
+
var React36 = __toESM(require_react(), 1);
|
|
3549
|
+
var import_react_dom7 = __toESM(require_react_dom(), 1);
|
|
3495
3550
|
function pad2(n2) {
|
|
3496
3551
|
return (n2 < 10 ? "0" : "") + n2;
|
|
3497
3552
|
}
|
|
@@ -3514,7 +3569,7 @@ window.Aura = (() => {
|
|
|
3514
3569
|
if (hh > 23 || mm > 59) return null;
|
|
3515
3570
|
return pad2(hh) + ":" + pad2(mm);
|
|
3516
3571
|
}
|
|
3517
|
-
var TimePicker =
|
|
3572
|
+
var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
3518
3573
|
const t = useStrings();
|
|
3519
3574
|
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
3520
3575
|
const st = useMaybeControlled(
|
|
@@ -3524,7 +3579,7 @@ window.Aura = (() => {
|
|
|
3524
3579
|
);
|
|
3525
3580
|
const value = st[0];
|
|
3526
3581
|
const step = props.step || 30, lo = toMin(props.min) != null ? toMin(props.min) : 0, hi = toMin(props.max) != null ? toMin(props.max) : 24 * 60 - 1;
|
|
3527
|
-
const slots =
|
|
3582
|
+
const slots = React36.useMemo(
|
|
3528
3583
|
function() {
|
|
3529
3584
|
const out = [];
|
|
3530
3585
|
for (let m = lo; m <= hi; m += step) out.push(fromMin(m));
|
|
@@ -3536,12 +3591,12 @@ window.Aura = (() => {
|
|
|
3536
3591
|
const n2 = toMin(v);
|
|
3537
3592
|
return n2 == null || n2 < lo || n2 > hi || props.isTimeDisabled && props.isTimeDisabled(v);
|
|
3538
3593
|
}
|
|
3539
|
-
const openState =
|
|
3540
|
-
const editState =
|
|
3541
|
-
const aState =
|
|
3542
|
-
const errState =
|
|
3543
|
-
const pos =
|
|
3544
|
-
const boxRef =
|
|
3594
|
+
const openState = React36.useState(false), open = openState[0], setOpen = openState[1];
|
|
3595
|
+
const editState = React36.useState(null), editing = editState[0], setEditing = editState[1];
|
|
3596
|
+
const aState = React36.useState(0), active = aState[0], setActive = aState[1];
|
|
3597
|
+
const errState = React36.useState(null);
|
|
3598
|
+
const pos = React36.useState(null);
|
|
3599
|
+
const boxRef = React36.useRef(null), inputRef = React36.useRef(null), listRef = React36.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
3545
3600
|
const mounted = useMounted();
|
|
3546
3601
|
function nearest(v) {
|
|
3547
3602
|
const n2 = toMin(v);
|
|
@@ -3569,7 +3624,7 @@ window.Aura = (() => {
|
|
|
3569
3624
|
},
|
|
3570
3625
|
[open]
|
|
3571
3626
|
);
|
|
3572
|
-
|
|
3627
|
+
React36.useEffect(
|
|
3573
3628
|
function() {
|
|
3574
3629
|
if (!open) return;
|
|
3575
3630
|
function outside(e) {
|
|
@@ -3591,7 +3646,7 @@ window.Aura = (() => {
|
|
|
3591
3646
|
},
|
|
3592
3647
|
[open]
|
|
3593
3648
|
);
|
|
3594
|
-
|
|
3649
|
+
React36.useEffect(
|
|
3595
3650
|
function() {
|
|
3596
3651
|
if (!open || !listRef.current) return;
|
|
3597
3652
|
const el = listRef.current.querySelector('[data-idx="' + active + '"]');
|
|
@@ -3688,10 +3743,10 @@ window.Aura = (() => {
|
|
|
3688
3743
|
}
|
|
3689
3744
|
}
|
|
3690
3745
|
const error = errState[0] || props.error;
|
|
3691
|
-
const list = open && mounted && pos[0] ? (0,
|
|
3692
|
-
/* @__PURE__ */
|
|
3746
|
+
const list = open && mounted && pos[0] ? (0, import_react_dom7.createPortal)(
|
|
3747
|
+
/* @__PURE__ */ React36.createElement("div", { ref: listRef, className: "aura-combo__popover aura-time__popover", style: pos[0] }, /* @__PURE__ */ React36.createElement("ul", { id: listId, role: "listbox", "aria-label": props.label, className: "aura-combo__list" }, slots.map(function(s, i) {
|
|
3693
3748
|
const dis = blocked(s), sel = s === value;
|
|
3694
|
-
return /* @__PURE__ */
|
|
3749
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3695
3750
|
"li",
|
|
3696
3751
|
{
|
|
3697
3752
|
key: s,
|
|
@@ -3716,13 +3771,13 @@ window.Aura = (() => {
|
|
|
3716
3771
|
if (active !== i) setActive(i);
|
|
3717
3772
|
}
|
|
3718
3773
|
},
|
|
3719
|
-
/* @__PURE__ */
|
|
3720
|
-
sel ? /* @__PURE__ */
|
|
3774
|
+
/* @__PURE__ */ React36.createElement("span", { className: "aura-combo__label" }, s),
|
|
3775
|
+
sel ? /* @__PURE__ */ React36.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
3721
3776
|
);
|
|
3722
3777
|
}))),
|
|
3723
3778
|
document.body
|
|
3724
3779
|
) : null;
|
|
3725
|
-
return /* @__PURE__ */
|
|
3780
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3726
3781
|
Field,
|
|
3727
3782
|
{
|
|
3728
3783
|
id,
|
|
@@ -3734,7 +3789,7 @@ window.Aura = (() => {
|
|
|
3734
3789
|
disabled: props.disabled,
|
|
3735
3790
|
className: props.className
|
|
3736
3791
|
},
|
|
3737
|
-
/* @__PURE__ */
|
|
3792
|
+
/* @__PURE__ */ React36.createElement("div", { ref: boxRef, className: cx("aura-input aura-combo aura-time has-icon", open && "is-open") }, /* @__PURE__ */ React36.createElement(Icon, { name: "clock", className: "aura-input__icon" }), /* @__PURE__ */ React36.createElement(
|
|
3738
3793
|
"input",
|
|
3739
3794
|
{
|
|
3740
3795
|
ref: inputMerged,
|
|
@@ -3774,7 +3829,7 @@ window.Aura = (() => {
|
|
|
3774
3829
|
}, 0);
|
|
3775
3830
|
}
|
|
3776
3831
|
}
|
|
3777
|
-
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */
|
|
3832
|
+
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */ React36.createElement(
|
|
3778
3833
|
"button",
|
|
3779
3834
|
{
|
|
3780
3835
|
type: "button",
|
|
@@ -3787,8 +3842,8 @@ window.Aura = (() => {
|
|
|
3787
3842
|
if (inputRef.current) inputRef.current.focus();
|
|
3788
3843
|
}
|
|
3789
3844
|
},
|
|
3790
|
-
/* @__PURE__ */
|
|
3791
|
-
) : null, /* @__PURE__ */
|
|
3845
|
+
/* @__PURE__ */ React36.createElement(Icon, { name: "x" })
|
|
3846
|
+
) : null, /* @__PURE__ */ React36.createElement(
|
|
3792
3847
|
"button",
|
|
3793
3848
|
{
|
|
3794
3849
|
type: "button",
|
|
@@ -3806,14 +3861,14 @@ window.Aura = (() => {
|
|
|
3806
3861
|
}
|
|
3807
3862
|
}
|
|
3808
3863
|
},
|
|
3809
|
-
/* @__PURE__ */
|
|
3864
|
+
/* @__PURE__ */ React36.createElement(Icon, { name: "chevron-down" })
|
|
3810
3865
|
)),
|
|
3811
3866
|
list
|
|
3812
3867
|
);
|
|
3813
3868
|
});
|
|
3814
3869
|
|
|
3815
3870
|
// src/FileUpload.tsx
|
|
3816
|
-
var
|
|
3871
|
+
var React37 = __toESM(require_react(), 1);
|
|
3817
3872
|
function formatBytes(n2) {
|
|
3818
3873
|
if (n2 == null) return "";
|
|
3819
3874
|
if (n2 < 1024) return n2 + " B";
|
|
@@ -3847,17 +3902,17 @@ window.Aura = (() => {
|
|
|
3847
3902
|
}).join(", ");
|
|
3848
3903
|
}
|
|
3849
3904
|
var seq = 0;
|
|
3850
|
-
var FileUpload =
|
|
3905
|
+
var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
3851
3906
|
const t = useStrings();
|
|
3852
3907
|
const auto = uid(), id = props.id || auto;
|
|
3853
3908
|
const st = useMaybeControlled(props.value, props.defaultValue || [], props.onChange);
|
|
3854
3909
|
const items = st[0] || [];
|
|
3855
|
-
const dragState =
|
|
3856
|
-
const inputRef =
|
|
3857
|
-
const urls =
|
|
3910
|
+
const dragState = React37.useState(false), over = dragState[0];
|
|
3911
|
+
const inputRef = React37.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
3912
|
+
const urls = React37.useRef({});
|
|
3858
3913
|
const maxFiles = props.multiple ? props.maxFiles : 1;
|
|
3859
3914
|
const note = t.accepts(describeAccept(props.accept, t), props.maxSize ? formatBytes(props.maxSize) : "");
|
|
3860
|
-
|
|
3915
|
+
React37.useEffect(function() {
|
|
3861
3916
|
return function() {
|
|
3862
3917
|
Object.keys(urls.current).forEach(function(k) {
|
|
3863
3918
|
URL.revokeObjectURL(urls.current[k]);
|
|
@@ -3908,7 +3963,7 @@ window.Aura = (() => {
|
|
|
3908
3963
|
if (inputRef.current) inputRef.current.focus();
|
|
3909
3964
|
}
|
|
3910
3965
|
const error = props.error;
|
|
3911
|
-
return /* @__PURE__ */
|
|
3966
|
+
return /* @__PURE__ */ React37.createElement(
|
|
3912
3967
|
Field,
|
|
3913
3968
|
{
|
|
3914
3969
|
id,
|
|
@@ -3920,7 +3975,7 @@ window.Aura = (() => {
|
|
|
3920
3975
|
disabled: props.disabled,
|
|
3921
3976
|
className: props.className
|
|
3922
3977
|
},
|
|
3923
|
-
/* @__PURE__ */
|
|
3978
|
+
/* @__PURE__ */ React37.createElement(
|
|
3924
3979
|
"div",
|
|
3925
3980
|
{
|
|
3926
3981
|
className: cx("aura-upload", over && "is-over", props.disabled && "is-disabled", error && "is-invalid"),
|
|
@@ -3941,9 +3996,9 @@ window.Aura = (() => {
|
|
|
3941
3996
|
add(e.dataTransfer && e.dataTransfer.files);
|
|
3942
3997
|
}
|
|
3943
3998
|
},
|
|
3944
|
-
/* @__PURE__ */
|
|
3945
|
-
/* @__PURE__ */
|
|
3946
|
-
/* @__PURE__ */
|
|
3999
|
+
/* @__PURE__ */ React37.createElement(Icon, { name: "cloud-upload", size: "lg", className: "aura-upload__icon" }),
|
|
4000
|
+
/* @__PURE__ */ React37.createElement("span", { className: "aura-upload__text" }, t.dropFiles, " "),
|
|
4001
|
+
/* @__PURE__ */ React37.createElement(
|
|
3947
4002
|
"input",
|
|
3948
4003
|
{
|
|
3949
4004
|
ref: inputMerged,
|
|
@@ -3965,12 +4020,12 @@ window.Aura = (() => {
|
|
|
3965
4020
|
}
|
|
3966
4021
|
}
|
|
3967
4022
|
),
|
|
3968
|
-
/* @__PURE__ */
|
|
3969
|
-
note ? /* @__PURE__ */
|
|
4023
|
+
/* @__PURE__ */ React37.createElement("span", { className: "aura-upload__browse", "aria-hidden": true }, props.multiple ? t.browse : t.browseOne),
|
|
4024
|
+
note ? /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__note", id: id + "-note" }, note) : null
|
|
3970
4025
|
),
|
|
3971
|
-
items.length ? /* @__PURE__ */
|
|
4026
|
+
items.length ? /* @__PURE__ */ React37.createElement("ul", { className: "aura-upload__list", "aria-live": "polite" }, items.map(function(it) {
|
|
3972
4027
|
const src = thumb(it);
|
|
3973
|
-
return /* @__PURE__ */
|
|
4028
|
+
return /* @__PURE__ */ React37.createElement("li", { key: it.id, className: cx("aura-upload__item", it.error && "is-error") }, src ? /* @__PURE__ */ React37.createElement("img", { className: "aura-upload__thumb", src, alt: "" }) : /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__thumb is-icon", "aria-hidden": true }, /* @__PURE__ */ React37.createElement(Icon, { name: /^image\//.test(it.type || "") ? "image" : "file", size: "md" })), /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__meta" }, /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__name" }, it.name), /* @__PURE__ */ React37.createElement("span", { className: "aura-upload__sub" }, it.error ? /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement(Icon, { name: "circle-alert", size: 12 }), it.error) : it.status === "uploading" ? t.uploading + (it.progress != null ? " " + Math.round(it.progress) + "%" : "") : it.status === "done" ? /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement(Icon, { name: "circle-check", size: 12 }), formatBytes(it.size)) : formatBytes(it.size)), it.status === "uploading" ? /* @__PURE__ */ React37.createElement(
|
|
3974
4029
|
"span",
|
|
3975
4030
|
{
|
|
3976
4031
|
className: "aura-upload__bar",
|
|
@@ -3980,8 +4035,8 @@ window.Aura = (() => {
|
|
|
3980
4035
|
"aria-valuemax": 100,
|
|
3981
4036
|
"aria-valuenow": it.progress != null ? Math.round(it.progress) : void 0
|
|
3982
4037
|
},
|
|
3983
|
-
/* @__PURE__ */
|
|
3984
|
-
) : null), /* @__PURE__ */
|
|
4038
|
+
/* @__PURE__ */ React37.createElement("span", { style: { width: (it.progress || 0) + "%" } })
|
|
4039
|
+
) : null), /* @__PURE__ */ React37.createElement(
|
|
3985
4040
|
IconButton,
|
|
3986
4041
|
{
|
|
3987
4042
|
icon: "x",
|
|
@@ -3997,14 +4052,14 @@ window.Aura = (() => {
|
|
|
3997
4052
|
|
|
3998
4053
|
// src/theme.ts
|
|
3999
4054
|
function hexToRgb(hex) {
|
|
4000
|
-
let
|
|
4001
|
-
if (
|
|
4002
|
-
|
|
4055
|
+
let h9 = String(hex).trim().replace("#", "");
|
|
4056
|
+
if (h9.length === 3)
|
|
4057
|
+
h9 = h9.split("").map(function(c) {
|
|
4003
4058
|
return c + c;
|
|
4004
4059
|
}).join("");
|
|
4005
|
-
if (!/^[0-9a-f]{6}$/i.test(
|
|
4060
|
+
if (!/^[0-9a-f]{6}$/i.test(h9)) throw new Error('createTheme: "' + hex + '" is not a #rgb or #rrggbb colour');
|
|
4006
4061
|
return [0, 2, 4].map(function(i) {
|
|
4007
|
-
return parseInt(
|
|
4062
|
+
return parseInt(h9.slice(i, i + 2), 16) / 255;
|
|
4008
4063
|
});
|
|
4009
4064
|
}
|
|
4010
4065
|
function rgbToHex(rgb) {
|
|
@@ -4231,9 +4286,9 @@ window.Aura = (() => {
|
|
|
4231
4286
|
}
|
|
4232
4287
|
|
|
4233
4288
|
// src/ThemeStyle.tsx
|
|
4234
|
-
var
|
|
4289
|
+
var React38 = __toESM(require_react(), 1);
|
|
4235
4290
|
function ThemeStyle(props) {
|
|
4236
|
-
const css =
|
|
4291
|
+
const css = React38.useMemo(
|
|
4237
4292
|
function() {
|
|
4238
4293
|
return createTheme({ brand: props.brand, signal: props.signal, primary: props.primary, name: props.name }).css(
|
|
4239
4294
|
props.selector
|
|
@@ -4241,11 +4296,11 @@ window.Aura = (() => {
|
|
|
4241
4296
|
},
|
|
4242
4297
|
[props.brand, props.signal, props.primary, props.name, props.selector]
|
|
4243
4298
|
);
|
|
4244
|
-
return /* @__PURE__ */
|
|
4299
|
+
return /* @__PURE__ */ React38.createElement("style", { "data-aura-theme": props.name || props.brand, dangerouslySetInnerHTML: { __html: css } });
|
|
4245
4300
|
}
|
|
4246
4301
|
|
|
4247
4302
|
// src/colorScheme.tsx
|
|
4248
|
-
var
|
|
4303
|
+
var React39 = __toESM(require_react(), 1);
|
|
4249
4304
|
var DEFAULT_KEY = "aura-color-scheme";
|
|
4250
4305
|
var SCHEMES = ["light", "dark", "system"];
|
|
4251
4306
|
var EVENT = "aura-color-scheme";
|
|
@@ -4258,7 +4313,7 @@ window.Aura = (() => {
|
|
|
4258
4313
|
return "(function(){try{var s=localStorage.getItem(" + key + ");if(s!=='light'&&s!=='dark'&&s!=='system')s=" + fallback + `;var d=document.documentElement;d.setAttribute("data-theme",s);var dark=s==='dark'||(s==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);d.classList.toggle("dark",dark);}catch(e){}})();`;
|
|
4259
4314
|
}
|
|
4260
4315
|
function ColorSchemeScript(props) {
|
|
4261
|
-
return /* @__PURE__ */
|
|
4316
|
+
return /* @__PURE__ */ React39.createElement("script", { "data-aura-color-scheme": "", dangerouslySetInnerHTML: { __html: colorSchemeScript(props) } });
|
|
4262
4317
|
}
|
|
4263
4318
|
function systemDark() {
|
|
4264
4319
|
return typeof window !== "undefined" && !!window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -4276,7 +4331,7 @@ window.Aura = (() => {
|
|
|
4276
4331
|
function useColorScheme(options) {
|
|
4277
4332
|
const key = options && options.storageKey || DEFAULT_KEY;
|
|
4278
4333
|
const fallback = options && options.defaultScheme || "system";
|
|
4279
|
-
const subscribe2 =
|
|
4334
|
+
const subscribe2 = React39.useCallback(
|
|
4280
4335
|
function(cb) {
|
|
4281
4336
|
const mq = window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)") : null;
|
|
4282
4337
|
function onSystem() {
|
|
@@ -4294,7 +4349,7 @@ window.Aura = (() => {
|
|
|
4294
4349
|
},
|
|
4295
4350
|
[fallback]
|
|
4296
4351
|
);
|
|
4297
|
-
const snapshot =
|
|
4352
|
+
const snapshot = React39.useSyncExternalStore(
|
|
4298
4353
|
subscribe2,
|
|
4299
4354
|
function() {
|
|
4300
4355
|
const s = readScheme(fallback);
|
|
@@ -4305,7 +4360,7 @@ window.Aura = (() => {
|
|
|
4305
4360
|
}
|
|
4306
4361
|
);
|
|
4307
4362
|
const parts = snapshot.split("|");
|
|
4308
|
-
const setScheme =
|
|
4363
|
+
const setScheme = React39.useCallback(
|
|
4309
4364
|
function(next) {
|
|
4310
4365
|
if (!valid(next)) return;
|
|
4311
4366
|
try {
|
|
@@ -4324,11 +4379,11 @@ window.Aura = (() => {
|
|
|
4324
4379
|
const cs = useColorScheme(props);
|
|
4325
4380
|
const names = { light: t.schemeLight, dark: t.schemeDark, system: t.schemeSystem };
|
|
4326
4381
|
const label = props.label || t.colorScheme;
|
|
4327
|
-
return /* @__PURE__ */
|
|
4382
|
+
return /* @__PURE__ */ React39.createElement(
|
|
4328
4383
|
DropdownMenu,
|
|
4329
4384
|
{
|
|
4330
4385
|
label,
|
|
4331
|
-
trigger: /* @__PURE__ */
|
|
4386
|
+
trigger: /* @__PURE__ */ React39.createElement(IconButton, { icon: cs.resolved === "dark" ? "moon" : "sun", label: label + ": " + names[cs.scheme] }),
|
|
4332
4387
|
items: SCHEMES.map(function(s) {
|
|
4333
4388
|
return {
|
|
4334
4389
|
label: names[s],
|
|
@@ -4342,16 +4397,11 @@ window.Aura = (() => {
|
|
|
4342
4397
|
);
|
|
4343
4398
|
}
|
|
4344
4399
|
|
|
4345
|
-
// src/
|
|
4346
|
-
var
|
|
4347
|
-
var
|
|
4348
|
-
var TONES = ["neutral", "accent", "success", "warning", "danger"];
|
|
4349
|
-
function tone(t) {
|
|
4350
|
-
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
4351
|
-
}
|
|
4352
|
-
var Badge = React25.forwardRef(function Badge2(props, ref) {
|
|
4400
|
+
// src/Badge.tsx
|
|
4401
|
+
var React40 = __toESM(require_react(), 1);
|
|
4402
|
+
var Badge = React40.forwardRef(function Badge2(props, ref) {
|
|
4353
4403
|
const rest = omit(props, ["tone", "variant", "icon", "className", "children"]);
|
|
4354
|
-
return /* @__PURE__ */
|
|
4404
|
+
return /* @__PURE__ */ React40.createElement(
|
|
4355
4405
|
"span",
|
|
4356
4406
|
{
|
|
4357
4407
|
...rest,
|
|
@@ -4364,20 +4414,23 @@ window.Aura = (() => {
|
|
|
4364
4414
|
props.className
|
|
4365
4415
|
)
|
|
4366
4416
|
},
|
|
4367
|
-
props.icon ? /* @__PURE__ */
|
|
4417
|
+
props.icon ? /* @__PURE__ */ React40.createElement(Icon, { name: props.icon, size: 12 }) : null,
|
|
4368
4418
|
props.children
|
|
4369
4419
|
);
|
|
4370
4420
|
});
|
|
4371
|
-
|
|
4421
|
+
|
|
4422
|
+
// src/Tag.tsx
|
|
4423
|
+
var React41 = __toESM(require_react(), 1);
|
|
4424
|
+
var Tag = React41.forwardRef(function Tag2(props, ref) {
|
|
4372
4425
|
const t = useStrings();
|
|
4373
4426
|
const selectable = props.onClick != null || props.selected != null;
|
|
4374
4427
|
const rest = omit(props, ["onRemove", "selected", "icon", "className", "children", "disabled", "removeLabel"]);
|
|
4375
4428
|
const inner = [
|
|
4376
|
-
props.icon ? /* @__PURE__ */
|
|
4377
|
-
/* @__PURE__ */
|
|
4429
|
+
props.icon ? /* @__PURE__ */ React41.createElement(Icon, { key: "i", name: props.icon, size: 14 }) : null,
|
|
4430
|
+
/* @__PURE__ */ React41.createElement("span", { key: "t", className: "aura-tag__text" }, props.children)
|
|
4378
4431
|
];
|
|
4379
4432
|
if (selectable) {
|
|
4380
|
-
return /* @__PURE__ */
|
|
4433
|
+
return /* @__PURE__ */ React41.createElement(
|
|
4381
4434
|
"button",
|
|
4382
4435
|
{
|
|
4383
4436
|
...rest,
|
|
@@ -4387,11 +4440,11 @@ window.Aura = (() => {
|
|
|
4387
4440
|
disabled: props.disabled,
|
|
4388
4441
|
className: cx("aura-tag is-selectable", props.selected && "is-selected", props.className)
|
|
4389
4442
|
},
|
|
4390
|
-
props.selected ? /* @__PURE__ */
|
|
4443
|
+
props.selected ? /* @__PURE__ */ React41.createElement(Icon, { name: "check", size: 14 }) : inner[0],
|
|
4391
4444
|
inner[1]
|
|
4392
4445
|
);
|
|
4393
4446
|
}
|
|
4394
|
-
return /* @__PURE__ */
|
|
4447
|
+
return /* @__PURE__ */ React41.createElement("span", { ...rest, ref, className: cx("aura-tag", props.disabled && "is-disabled", props.className) }, inner, props.onRemove && !props.disabled ? /* @__PURE__ */ React41.createElement(
|
|
4395
4448
|
"button",
|
|
4396
4449
|
{
|
|
4397
4450
|
type: "button",
|
|
@@ -4399,15 +4452,18 @@ window.Aura = (() => {
|
|
|
4399
4452
|
"aria-label": props.removeLabel || t.remove(typeof props.children === "string" ? props.children : ""),
|
|
4400
4453
|
onClick: props.onRemove
|
|
4401
4454
|
},
|
|
4402
|
-
/* @__PURE__ */
|
|
4455
|
+
/* @__PURE__ */ React41.createElement(Icon, { name: "x", size: 12 })
|
|
4403
4456
|
) : null);
|
|
4404
4457
|
});
|
|
4405
|
-
|
|
4458
|
+
|
|
4459
|
+
// src/Progress.tsx
|
|
4460
|
+
var React42 = __toESM(require_react(), 1);
|
|
4461
|
+
var Progress = React42.forwardRef(function Progress2(props, ref) {
|
|
4406
4462
|
const auto = uid(), id = props.id || auto;
|
|
4407
4463
|
const max = props.max || 100, det = props.value != null;
|
|
4408
4464
|
const pct = det ? Math.max(0, Math.min(100, props.value / max * 100)) : 0;
|
|
4409
4465
|
const shown = props.valueLabel != null ? props.valueLabel : det ? Math.round(pct) + "%" : null;
|
|
4410
|
-
return /* @__PURE__ */
|
|
4466
|
+
return /* @__PURE__ */ React42.createElement(
|
|
4411
4467
|
"div",
|
|
4412
4468
|
{
|
|
4413
4469
|
ref,
|
|
@@ -4418,8 +4474,8 @@ window.Aura = (() => {
|
|
|
4418
4474
|
props.className
|
|
4419
4475
|
)
|
|
4420
4476
|
},
|
|
4421
|
-
props.label || props.showValue && shown ? /* @__PURE__ */
|
|
4422
|
-
/* @__PURE__ */
|
|
4477
|
+
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,
|
|
4478
|
+
/* @__PURE__ */ React42.createElement(
|
|
4423
4479
|
"div",
|
|
4424
4480
|
{
|
|
4425
4481
|
className: cx("aura-progress__track", !det && "is-indeterminate"),
|
|
@@ -4431,18 +4487,21 @@ window.Aura = (() => {
|
|
|
4431
4487
|
"aria-valuenow": det ? props.value : void 0,
|
|
4432
4488
|
"aria-valuetext": det && props.valueLabel != null ? String(props.valueLabel) : void 0
|
|
4433
4489
|
},
|
|
4434
|
-
/* @__PURE__ */
|
|
4490
|
+
/* @__PURE__ */ React42.createElement("span", { className: "aura-progress__bar", style: det ? { width: pct + "%" } : void 0 })
|
|
4435
4491
|
),
|
|
4436
|
-
props.hint ? /* @__PURE__ */
|
|
4492
|
+
props.hint ? /* @__PURE__ */ React42.createElement("p", { className: "aura-progress__hint" }, props.hint) : null
|
|
4437
4493
|
);
|
|
4438
4494
|
});
|
|
4439
|
-
|
|
4495
|
+
|
|
4496
|
+
// src/Skeleton.tsx
|
|
4497
|
+
var React43 = __toESM(require_react(), 1);
|
|
4498
|
+
var Skeleton = React43.forwardRef(function Skeleton2(props, ref) {
|
|
4440
4499
|
const v = props.variant || "text";
|
|
4441
4500
|
if (v === "text" && (props.lines || 1) > 1) {
|
|
4442
4501
|
const n2 = props.lines, rows = [];
|
|
4443
4502
|
for (let i = 0; i < n2; i++)
|
|
4444
|
-
rows.push(/* @__PURE__ */
|
|
4445
|
-
return /* @__PURE__ */
|
|
4503
|
+
rows.push(/* @__PURE__ */ React43.createElement("span", { key: i, className: "aura-skel aura-skel--text", style: { width: i === n2 - 1 ? "60%" : "100%" } }));
|
|
4504
|
+
return /* @__PURE__ */ React43.createElement(
|
|
4446
4505
|
"span",
|
|
4447
4506
|
{
|
|
4448
4507
|
ref,
|
|
@@ -4457,22 +4516,28 @@ window.Aura = (() => {
|
|
|
4457
4516
|
if (v === "circle") {
|
|
4458
4517
|
style.width = style.height = props.size || props.width || 40;
|
|
4459
4518
|
}
|
|
4460
|
-
return /* @__PURE__ */
|
|
4519
|
+
return /* @__PURE__ */ React43.createElement("span", { ref, "aria-hidden": true, className: cx("aura-skel", "aura-skel--" + v, props.className), style });
|
|
4461
4520
|
});
|
|
4462
|
-
|
|
4521
|
+
|
|
4522
|
+
// src/EmptyState.tsx
|
|
4523
|
+
var React44 = __toESM(require_react(), 1);
|
|
4524
|
+
var EmptyState = React44.forwardRef(function EmptyState2(props, ref) {
|
|
4463
4525
|
const HT = "h" + (props.headingLevel || 3);
|
|
4464
|
-
return /* @__PURE__ */
|
|
4526
|
+
return /* @__PURE__ */ React44.createElement(
|
|
4465
4527
|
"div",
|
|
4466
4528
|
{
|
|
4467
4529
|
ref,
|
|
4468
4530
|
className: cx("aura-empty", props.size === "sm" && "is-sm", props.bordered && "is-bordered", props.className)
|
|
4469
4531
|
},
|
|
4470
|
-
/* @__PURE__ */
|
|
4471
|
-
/* @__PURE__ */
|
|
4472
|
-
props.description ? /* @__PURE__ */
|
|
4473
|
-
props.action ? /* @__PURE__ */
|
|
4532
|
+
/* @__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" })),
|
|
4533
|
+
/* @__PURE__ */ React44.createElement(HT, { className: "aura-empty__title" }, props.title),
|
|
4534
|
+
props.description ? /* @__PURE__ */ React44.createElement("p", { className: "aura-empty__text" }, props.description) : null,
|
|
4535
|
+
props.action ? /* @__PURE__ */ React44.createElement("div", { className: "aura-empty__action" }, props.action) : null
|
|
4474
4536
|
);
|
|
4475
4537
|
});
|
|
4538
|
+
|
|
4539
|
+
// src/Pagination.tsx
|
|
4540
|
+
var React45 = __toESM(require_react(), 1);
|
|
4476
4541
|
function pageList(page, count, sib) {
|
|
4477
4542
|
let out = [], lo = Math.max(2, page - sib), hi = Math.min(count - 1, page + sib);
|
|
4478
4543
|
if (page - sib <= 3) {
|
|
@@ -4492,7 +4557,7 @@ window.Aura = (() => {
|
|
|
4492
4557
|
if (count > 1) out.push(count);
|
|
4493
4558
|
return out;
|
|
4494
4559
|
}
|
|
4495
|
-
var Pagination =
|
|
4560
|
+
var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
4496
4561
|
const t = useStrings();
|
|
4497
4562
|
const count = Math.max(1, props.pageCount || 1);
|
|
4498
4563
|
const st = useMaybeControlled(props.page, props.defaultPage || 1, props.onChange);
|
|
@@ -4510,7 +4575,7 @@ window.Aura = (() => {
|
|
|
4510
4575
|
},
|
|
4511
4576
|
extra
|
|
4512
4577
|
);
|
|
4513
|
-
return link ? /* @__PURE__ */
|
|
4578
|
+
return link ? /* @__PURE__ */ React45.createElement(
|
|
4514
4579
|
"a",
|
|
4515
4580
|
{
|
|
4516
4581
|
href: link(p),
|
|
@@ -4523,7 +4588,7 @@ window.Aura = (() => {
|
|
|
4523
4588
|
...common
|
|
4524
4589
|
},
|
|
4525
4590
|
label
|
|
4526
|
-
) : /* @__PURE__ */
|
|
4591
|
+
) : /* @__PURE__ */ React45.createElement(
|
|
4527
4592
|
"button",
|
|
4528
4593
|
{
|
|
4529
4594
|
type: "button",
|
|
@@ -4535,7 +4600,7 @@ window.Aura = (() => {
|
|
|
4535
4600
|
label
|
|
4536
4601
|
);
|
|
4537
4602
|
}
|
|
4538
|
-
return /* @__PURE__ */
|
|
4603
|
+
return /* @__PURE__ */ React45.createElement("nav", { ref, className: cx("aura-pagination", props.className), "aria-label": props.label || t.pagination }, /* @__PURE__ */ React45.createElement(
|
|
4539
4604
|
IconButton,
|
|
4540
4605
|
{
|
|
4541
4606
|
icon: "chevron-left",
|
|
@@ -4545,9 +4610,9 @@ window.Aura = (() => {
|
|
|
4545
4610
|
go(page - 1);
|
|
4546
4611
|
}
|
|
4547
4612
|
}
|
|
4548
|
-
), /* @__PURE__ */
|
|
4549
|
-
return typeof p === "number" ? /* @__PURE__ */
|
|
4550
|
-
})), /* @__PURE__ */
|
|
4613
|
+
), /* @__PURE__ */ React45.createElement("ol", { className: "aura-pagination__list" }, pageList(page, count, props.siblingCount == null ? 1 : props.siblingCount).map(function(p) {
|
|
4614
|
+
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");
|
|
4615
|
+
})), /* @__PURE__ */ React45.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)), /* @__PURE__ */ React45.createElement(
|
|
4551
4616
|
IconButton,
|
|
4552
4617
|
{
|
|
4553
4618
|
icon: "chevron-right",
|
|
@@ -4559,7 +4624,10 @@ window.Aura = (() => {
|
|
|
4559
4624
|
}
|
|
4560
4625
|
));
|
|
4561
4626
|
});
|
|
4562
|
-
|
|
4627
|
+
|
|
4628
|
+
// src/Accordion.tsx
|
|
4629
|
+
var React46 = __toESM(require_react(), 1);
|
|
4630
|
+
var Accordion = React46.forwardRef(function Accordion2(props, ref) {
|
|
4563
4631
|
const auto = uid(), base = props.id || auto;
|
|
4564
4632
|
const multiple = props.type === "multiple";
|
|
4565
4633
|
const st = useMaybeControlled(
|
|
@@ -4597,9 +4665,9 @@ window.Aura = (() => {
|
|
|
4597
4665
|
n2.focus();
|
|
4598
4666
|
}
|
|
4599
4667
|
}
|
|
4600
|
-
return /* @__PURE__ */
|
|
4668
|
+
return /* @__PURE__ */ React46.createElement("div", { ref, className: cx("aura-accordion", props.className), onKeyDown: onKey }, items.map(function(it) {
|
|
4601
4669
|
const on = open.indexOf(it.id) >= 0, bid = base + "-btn-" + it.id, pid = base + "-panel-" + it.id;
|
|
4602
|
-
return /* @__PURE__ */
|
|
4670
|
+
return /* @__PURE__ */ React46.createElement("div", { key: it.id, className: cx("aura-accordion__item", on && "is-open") }, /* @__PURE__ */ React46.createElement(HT, { className: "aura-accordion__heading" }, /* @__PURE__ */ React46.createElement(
|
|
4603
4671
|
"button",
|
|
4604
4672
|
{
|
|
4605
4673
|
type: "button",
|
|
@@ -4611,12 +4679,16 @@ window.Aura = (() => {
|
|
|
4611
4679
|
toggle(it.id);
|
|
4612
4680
|
}
|
|
4613
4681
|
},
|
|
4614
|
-
it.icon ? /* @__PURE__ */
|
|
4615
|
-
/* @__PURE__ */
|
|
4616
|
-
/* @__PURE__ */
|
|
4617
|
-
)), /* @__PURE__ */
|
|
4682
|
+
it.icon ? /* @__PURE__ */ React46.createElement(Icon, { name: it.icon, className: "aura-accordion__lead" }) : null,
|
|
4683
|
+
/* @__PURE__ */ React46.createElement("span", { className: "aura-accordion__title" }, it.title, it.description ? /* @__PURE__ */ React46.createElement("span", { className: "aura-accordion__desc" }, it.description) : null),
|
|
4684
|
+
/* @__PURE__ */ React46.createElement(Icon, { name: "chevron-down", className: "aura-accordion__chevron" })
|
|
4685
|
+
)), /* @__PURE__ */ React46.createElement("div", { id: pid, role: "region", "aria-labelledby": bid, className: "aura-accordion__panel", hidden: !on }, it.content));
|
|
4618
4686
|
}));
|
|
4619
4687
|
});
|
|
4688
|
+
|
|
4689
|
+
// src/Popover.tsx
|
|
4690
|
+
var React47 = __toESM(require_react(), 1);
|
|
4691
|
+
var import_react_dom8 = __toESM(require_react_dom(), 1);
|
|
4620
4692
|
function position(anchor, pop, placement) {
|
|
4621
4693
|
const r = anchor.getBoundingClientRect(), pw = pop.offsetWidth, ph = pop.offsetHeight, vw = window.innerWidth, vh = window.innerHeight, gap = 6;
|
|
4622
4694
|
let side = (placement || "bottom-start").split("-")[0], align = (placement || "bottom-start").split("-")[1] || "start";
|
|
@@ -4626,13 +4698,13 @@ window.Aura = (() => {
|
|
|
4626
4698
|
const left = align === "end" ? r.right - pw : align === "center" ? r.left + r.width / 2 - pw / 2 : r.left;
|
|
4627
4699
|
return { top: Math.max(8, top), left: Math.max(8, Math.min(left, vw - pw - 8)), side };
|
|
4628
4700
|
}
|
|
4629
|
-
var Popover =
|
|
4701
|
+
var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
4630
4702
|
const t = useStrings();
|
|
4631
4703
|
const auto = uid(), id = props.id || auto;
|
|
4632
4704
|
const st = useMaybeControlled(props.open, !!props.defaultOpen, props.onOpenChange);
|
|
4633
4705
|
const open = !!st[0];
|
|
4634
|
-
const wrap =
|
|
4635
|
-
const pos =
|
|
4706
|
+
const wrap = React47.useRef(null), pop = React47.useRef(null), popMerged = useMergedRef(ref, pop);
|
|
4707
|
+
const pos = React47.useState(null), mounted = useMounted();
|
|
4636
4708
|
function trigger() {
|
|
4637
4709
|
return wrap.current && (wrap.current.querySelector('button, [role="button"], a, input') || wrap.current.firstElementChild);
|
|
4638
4710
|
}
|
|
@@ -4659,7 +4731,7 @@ window.Aura = (() => {
|
|
|
4659
4731
|
},
|
|
4660
4732
|
[open, mounted, props.placement]
|
|
4661
4733
|
);
|
|
4662
|
-
|
|
4734
|
+
React47.useEffect(
|
|
4663
4735
|
function() {
|
|
4664
4736
|
if (!open || !mounted) return;
|
|
4665
4737
|
if (props.autoFocus !== false && pop.current) {
|
|
@@ -4678,9 +4750,9 @@ window.Aura = (() => {
|
|
|
4678
4750
|
},
|
|
4679
4751
|
[open, mounted]
|
|
4680
4752
|
);
|
|
4681
|
-
const child =
|
|
4682
|
-
const panel = open && mounted ? (0,
|
|
4683
|
-
/* @__PURE__ */
|
|
4753
|
+
const child = React47.Children.only(props.trigger);
|
|
4754
|
+
const panel = open && mounted ? (0, import_react_dom8.createPortal)(
|
|
4755
|
+
/* @__PURE__ */ React47.createElement(
|
|
4684
4756
|
"div",
|
|
4685
4757
|
{
|
|
4686
4758
|
ref: popMerged,
|
|
@@ -4702,7 +4774,7 @@ window.Aura = (() => {
|
|
|
4702
4774
|
} else trapTab(e, pop.current);
|
|
4703
4775
|
}
|
|
4704
4776
|
},
|
|
4705
|
-
props.title ? /* @__PURE__ */
|
|
4777
|
+
props.title ? /* @__PURE__ */ React47.createElement("div", { className: "aura-popover__head" }, /* @__PURE__ */ React47.createElement("p", { className: "aura-popover__title", id: id + "-title" }, props.title), /* @__PURE__ */ React47.createElement(
|
|
4706
4778
|
IconButton,
|
|
4707
4779
|
{
|
|
4708
4780
|
icon: "x",
|
|
@@ -4712,7 +4784,7 @@ window.Aura = (() => {
|
|
|
4712
4784
|
}
|
|
4713
4785
|
}
|
|
4714
4786
|
)) : null,
|
|
4715
|
-
/* @__PURE__ */
|
|
4787
|
+
/* @__PURE__ */ React47.createElement("div", { className: "aura-popover__body" }, typeof props.children === "function" ? props.children({
|
|
4716
4788
|
close: function() {
|
|
4717
4789
|
close(true);
|
|
4718
4790
|
}
|
|
@@ -4720,7 +4792,7 @@ window.Aura = (() => {
|
|
|
4720
4792
|
),
|
|
4721
4793
|
document.body
|
|
4722
4794
|
) : null;
|
|
4723
|
-
return /* @__PURE__ */
|
|
4795
|
+
return /* @__PURE__ */ React47.createElement("span", { ref: wrap, className: "aura-popover-anchor" }, React47.cloneElement(child, {
|
|
4724
4796
|
onClick: function(e) {
|
|
4725
4797
|
if (child.props.onClick) child.props.onClick(e);
|
|
4726
4798
|
st[1](!open);
|