@geckoui/geckoui 2.0.5 → 2.1.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/dist/index.d.mts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +522 -418
- package/dist/index.mjs +302 -198
- package/dist/styles.css +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -197,7 +197,7 @@ __export(index_exports, {
|
|
|
197
197
|
module.exports = __toCommonJS(index_exports);
|
|
198
198
|
|
|
199
199
|
// src/hooks/useClickOutside.ts
|
|
200
|
-
var
|
|
200
|
+
var import_react2 = require("react");
|
|
201
201
|
|
|
202
202
|
// src/utils/isInsideShadowDom.ts
|
|
203
203
|
function isInsideShadowDOM(node) {
|
|
@@ -207,14 +207,61 @@ function isInsideShadowDOM(node) {
|
|
|
207
207
|
return rootNode instanceof ShadowRoot;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
// src/utils/layerStack.ts
|
|
211
|
+
var import_react = require("react");
|
|
212
|
+
var stack = [];
|
|
213
|
+
var topAtGesture;
|
|
214
|
+
var gestureActive = false;
|
|
215
|
+
var listening = false;
|
|
216
|
+
function startGesture() {
|
|
217
|
+
topAtGesture = stack[stack.length - 1];
|
|
218
|
+
gestureActive = true;
|
|
219
|
+
}
|
|
220
|
+
function endGesture() {
|
|
221
|
+
setTimeout(() => {
|
|
222
|
+
gestureActive = false;
|
|
223
|
+
topAtGesture = void 0;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function listen() {
|
|
227
|
+
if (listening || typeof window === "undefined") return;
|
|
228
|
+
listening = true;
|
|
229
|
+
for (const type of ["pointerdown", "touchstart", "keydown"]) {
|
|
230
|
+
window.addEventListener(type, startGesture, true);
|
|
231
|
+
}
|
|
232
|
+
for (const type of ["click", "keyup", "pointercancel"]) {
|
|
233
|
+
window.addEventListener(type, endGesture, true);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function isTopLayer(layer) {
|
|
237
|
+
return (gestureActive ? topAtGesture : stack[stack.length - 1]) === layer;
|
|
238
|
+
}
|
|
239
|
+
function useLayer(active) {
|
|
240
|
+
const layer = (0, import_react.useRef)({}).current;
|
|
241
|
+
(0, import_react.useEffect)(() => {
|
|
242
|
+
if (!active) return;
|
|
243
|
+
listen();
|
|
244
|
+
stack.push(layer);
|
|
245
|
+
return () => {
|
|
246
|
+
const index = stack.lastIndexOf(layer);
|
|
247
|
+
if (index !== -1) stack.splice(index, 1);
|
|
248
|
+
};
|
|
249
|
+
}, [active, layer]);
|
|
250
|
+
return (0, import_react.useCallback)(() => isTopLayer(layer), [layer]);
|
|
251
|
+
}
|
|
252
|
+
|
|
210
253
|
// src/hooks/useClickOutside.ts
|
|
211
|
-
var useClickOutside = (handler, refs) => {
|
|
212
|
-
const
|
|
213
|
-
const
|
|
254
|
+
var useClickOutside = (handler, refs, open) => {
|
|
255
|
+
const isTop = useLayer(!!open);
|
|
256
|
+
const layered = open !== void 0;
|
|
257
|
+
const layeredRef = (0, import_react2.useRef)(layered);
|
|
258
|
+
layeredRef.current = layered;
|
|
259
|
+
const handlerRef = (0, import_react2.useRef)(handler);
|
|
260
|
+
const refsRef = (0, import_react2.useRef)(refs);
|
|
214
261
|
handlerRef.current = handler;
|
|
215
262
|
refsRef.current = refs;
|
|
216
263
|
const enabled = !!handler && !!refs && refs.length > 0;
|
|
217
|
-
(0,
|
|
264
|
+
(0, import_react2.useEffect)(() => {
|
|
218
265
|
if (!enabled) return;
|
|
219
266
|
const listener = (event) => {
|
|
220
267
|
var _a, _b, _c;
|
|
@@ -227,6 +274,7 @@ var useClickOutside = (handler, refs) => {
|
|
|
227
274
|
})) {
|
|
228
275
|
return;
|
|
229
276
|
}
|
|
277
|
+
if (layeredRef.current && !isTop()) return;
|
|
230
278
|
(_c = handlerRef.current) == null ? void 0 : _c.call(handlerRef, event);
|
|
231
279
|
};
|
|
232
280
|
document.addEventListener("mousedown", listener, true);
|
|
@@ -235,12 +283,12 @@ var useClickOutside = (handler, refs) => {
|
|
|
235
283
|
document.removeEventListener("mousedown", listener, true);
|
|
236
284
|
document.removeEventListener("touchstart", listener, true);
|
|
237
285
|
};
|
|
238
|
-
}, [enabled]);
|
|
286
|
+
}, [enabled, isTop]);
|
|
239
287
|
};
|
|
240
288
|
var useClickOutside_default = useClickOutside;
|
|
241
289
|
|
|
242
290
|
// src/hooks/useFilePicker.ts
|
|
243
|
-
var
|
|
291
|
+
var import_react6 = require("react");
|
|
244
292
|
|
|
245
293
|
// src/utils/isNil.ts
|
|
246
294
|
var isNil = (value) => {
|
|
@@ -293,10 +341,10 @@ function isTwoFileEqualByFileContent(file1, file2) {
|
|
|
293
341
|
}
|
|
294
342
|
|
|
295
343
|
// src/utils/isElement.ts
|
|
296
|
-
var
|
|
344
|
+
var import_react3 = require("react");
|
|
297
345
|
var hasDisplayName = (displayName) => (e) => {
|
|
298
346
|
var _a;
|
|
299
|
-
return (0,
|
|
347
|
+
return (0, import_react3.isValidElement)(e) && ((_a = e.type) == null ? void 0 : _a.displayName) === displayName;
|
|
300
348
|
};
|
|
301
349
|
|
|
302
350
|
// src/utils/formatNumericInput.ts
|
|
@@ -370,8 +418,8 @@ function devWarn(message) {
|
|
|
370
418
|
}
|
|
371
419
|
|
|
372
420
|
// src/utils/asChildElement.ts
|
|
373
|
-
var
|
|
374
|
-
var asChildElement = (children) => (0,
|
|
421
|
+
var import_react4 = require("react");
|
|
422
|
+
var asChildElement = (children) => (0, import_react4.isValidElement)(children) ? children : null;
|
|
375
423
|
|
|
376
424
|
// src/lib/FilePicker/handlers/BaseFilePickerHandler.ts
|
|
377
425
|
var BaseFilePickerHandler = class {
|
|
@@ -634,11 +682,11 @@ var FilePicker = (() => {
|
|
|
634
682
|
var FilePicker_default = FilePicker;
|
|
635
683
|
|
|
636
684
|
// src/hooks/useRevokedPreviews.ts
|
|
637
|
-
var
|
|
685
|
+
var import_react5 = require("react");
|
|
638
686
|
var useRevokedPreviews = (previews) => {
|
|
639
|
-
const held = (0,
|
|
640
|
-
const inherited = (0,
|
|
641
|
-
(0,
|
|
687
|
+
const held = (0, import_react5.useRef)(/* @__PURE__ */ new Set());
|
|
688
|
+
const inherited = (0, import_react5.useRef)(null);
|
|
689
|
+
(0, import_react5.useEffect)(() => {
|
|
642
690
|
const current = new Set(previews.filter((preview) => Boolean(preview)));
|
|
643
691
|
if (inherited.current === null) inherited.current = current;
|
|
644
692
|
held.current.forEach((preview) => {
|
|
@@ -646,7 +694,7 @@ var useRevokedPreviews = (previews) => {
|
|
|
646
694
|
});
|
|
647
695
|
held.current = current;
|
|
648
696
|
});
|
|
649
|
-
(0,
|
|
697
|
+
(0, import_react5.useEffect)(
|
|
650
698
|
() => () => {
|
|
651
699
|
held.current.forEach((preview) => {
|
|
652
700
|
var _a;
|
|
@@ -673,11 +721,11 @@ function useFilePicker(options) {
|
|
|
673
721
|
disabled = false,
|
|
674
722
|
multiple = true
|
|
675
723
|
} = options || {};
|
|
676
|
-
const dropzoneRef = (0,
|
|
677
|
-
const [loading, setLoading] = (0,
|
|
678
|
-
const [dragging, setDragging] = (0,
|
|
724
|
+
const dropzoneRef = (0, import_react6.useRef)(null);
|
|
725
|
+
const [loading, setLoading] = (0, import_react6.useState)(false);
|
|
726
|
+
const [dragging, setDragging] = (0, import_react6.useState)(false);
|
|
679
727
|
useRevokedPreviews_default(files.map((file) => file.preview));
|
|
680
|
-
const handleOnChange = (0,
|
|
728
|
+
const handleOnChange = (0, import_react6.useCallback)(
|
|
681
729
|
(res) => __async(null, null, function* () {
|
|
682
730
|
const transformedRes = transform ? yield transform(res) : res;
|
|
683
731
|
const _result = keepOldFiles ? [...files].concat(transformedRes) : transformedRes;
|
|
@@ -707,7 +755,7 @@ function useFilePicker(options) {
|
|
|
707
755
|
setLoading(() => false);
|
|
708
756
|
}
|
|
709
757
|
});
|
|
710
|
-
(0,
|
|
758
|
+
(0, import_react6.useEffect)(() => {
|
|
711
759
|
const el = dropzoneRef.current;
|
|
712
760
|
if (!el || disabled) return;
|
|
713
761
|
const handleDragOver = (e) => {
|
|
@@ -774,9 +822,9 @@ function useFilePicker(options) {
|
|
|
774
822
|
var useFilePicker_default = useFilePicker;
|
|
775
823
|
|
|
776
824
|
// src/hooks/usePreventDefault.ts
|
|
777
|
-
var
|
|
825
|
+
var import_react7 = require("react");
|
|
778
826
|
var usePreventDefault = () => {
|
|
779
|
-
const preventAction = (0,
|
|
827
|
+
const preventAction = (0, import_react7.useRef)(false);
|
|
780
828
|
const preventDefault = () => preventAction.current = true;
|
|
781
829
|
const attachPreventDefault = (fn) => __async(null, null, function* () {
|
|
782
830
|
if (preventAction.current) {
|
|
@@ -790,9 +838,9 @@ var usePreventDefault = () => {
|
|
|
790
838
|
var usePreventDefault_default = usePreventDefault;
|
|
791
839
|
|
|
792
840
|
// src/hooks/useEscListener.ts
|
|
793
|
-
var
|
|
841
|
+
var import_react8 = require("react");
|
|
794
842
|
var useEscListener = (callback) => {
|
|
795
|
-
(0,
|
|
843
|
+
(0, import_react8.useEffect)(() => {
|
|
796
844
|
if (!callback) return;
|
|
797
845
|
const dismissListener = (e) => {
|
|
798
846
|
const node = e.target;
|
|
@@ -811,7 +859,7 @@ var useEscListener = (callback) => {
|
|
|
811
859
|
var useEscListener_default = useEscListener;
|
|
812
860
|
|
|
813
861
|
// src/hooks/useScrollLock.ts
|
|
814
|
-
var
|
|
862
|
+
var import_react9 = require("react");
|
|
815
863
|
var lockCount = 0;
|
|
816
864
|
var previousOverflow = "";
|
|
817
865
|
var previousPaddingRight = "";
|
|
@@ -838,7 +886,7 @@ function unlockBodyScroll() {
|
|
|
838
886
|
documentElement.style.removeProperty(SCROLLBAR_VARIABLE);
|
|
839
887
|
}
|
|
840
888
|
var useScrollLock = (enabled) => {
|
|
841
|
-
(0,
|
|
889
|
+
(0, import_react9.useEffect)(() => {
|
|
842
890
|
if (!enabled) return;
|
|
843
891
|
lockBodyScroll();
|
|
844
892
|
return unlockBodyScroll;
|
|
@@ -847,7 +895,7 @@ var useScrollLock = (enabled) => {
|
|
|
847
895
|
var useScrollLock_default = useScrollLock;
|
|
848
896
|
|
|
849
897
|
// src/components/Checkbox/Checkbox.tsx
|
|
850
|
-
var
|
|
898
|
+
var import_react10 = require("react");
|
|
851
899
|
|
|
852
900
|
// src/icons/CheckIcon.tsx
|
|
853
901
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -948,12 +996,12 @@ var X_default = X;
|
|
|
948
996
|
|
|
949
997
|
// src/components/Checkbox/Checkbox.tsx
|
|
950
998
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
951
|
-
var Checkbox = (0,
|
|
999
|
+
var Checkbox = (0, import_react10.forwardRef)(
|
|
952
1000
|
(_a, ref) => {
|
|
953
1001
|
var _b = _a, { id, disabled, className, checked, indeterminate } = _b, rest = __objRest(_b, ["id", "disabled", "className", "checked", "indeterminate"]);
|
|
954
|
-
const _id = (0,
|
|
955
|
-
const innerRef = (0,
|
|
956
|
-
const setRefs = (0,
|
|
1002
|
+
const _id = (0, import_react10.useId)();
|
|
1003
|
+
const innerRef = (0, import_react10.useRef)(null);
|
|
1004
|
+
const setRefs = (0, import_react10.useCallback)(
|
|
957
1005
|
(node) => {
|
|
958
1006
|
innerRef.current = node;
|
|
959
1007
|
if (typeof ref === "function") ref(node);
|
|
@@ -961,7 +1009,7 @@ var Checkbox = (0, import_react9.forwardRef)(
|
|
|
961
1009
|
},
|
|
962
1010
|
[ref]
|
|
963
1011
|
);
|
|
964
|
-
(0,
|
|
1012
|
+
(0, import_react10.useEffect)(() => {
|
|
965
1013
|
if (innerRef.current) innerRef.current.indeterminate = Boolean(indeterminate);
|
|
966
1014
|
});
|
|
967
1015
|
const Icon = indeterminate ? IndeterminateIcon_default : CheckIcon_default;
|
|
@@ -986,13 +1034,13 @@ Checkbox.displayName = "Checkbox";
|
|
|
986
1034
|
var Checkbox_default = Checkbox;
|
|
987
1035
|
|
|
988
1036
|
// src/components/CounterInput/CounterInput.tsx
|
|
989
|
-
var
|
|
1037
|
+
var import_react11 = require("react");
|
|
990
1038
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
991
1039
|
var countDecimals = (value) => {
|
|
992
1040
|
var _a;
|
|
993
1041
|
return ((_a = String(value).split(".")[1]) != null ? _a : "").length;
|
|
994
1042
|
};
|
|
995
|
-
var CounterInput = (0,
|
|
1043
|
+
var CounterInput = (0, import_react11.forwardRef)(
|
|
996
1044
|
(_a, ref) => {
|
|
997
1045
|
var _b = _a, {
|
|
998
1046
|
value,
|
|
@@ -1116,11 +1164,11 @@ CounterInput.displayName = "CounterInput";
|
|
|
1116
1164
|
var CounterInput_default = CounterInput;
|
|
1117
1165
|
|
|
1118
1166
|
// src/components/DateInput/DateInput.tsx
|
|
1119
|
-
var
|
|
1120
|
-
var
|
|
1167
|
+
var import_react15 = require("@floating-ui/react");
|
|
1168
|
+
var import_react16 = require("react");
|
|
1121
1169
|
|
|
1122
1170
|
// src/components/BaseDateInput/BaseDateInput.tsx
|
|
1123
|
-
var
|
|
1171
|
+
var import_react12 = require("react");
|
|
1124
1172
|
|
|
1125
1173
|
// src/components/DynamicComponentRenderer/DynamicComponentRenderer.tsx
|
|
1126
1174
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
@@ -1221,14 +1269,14 @@ var BaseDateInput = ({
|
|
|
1221
1269
|
hasFocus,
|
|
1222
1270
|
"aria-invalid": invalid
|
|
1223
1271
|
}) => {
|
|
1224
|
-
const containerRef = (0,
|
|
1225
|
-
const monthRef = (0,
|
|
1226
|
-
const dayRef = (0,
|
|
1227
|
-
const yearRef = (0,
|
|
1228
|
-
const [month, setMonth] = (0,
|
|
1229
|
-
const [day, setDay] = (0,
|
|
1230
|
-
const [year, setYear] = (0,
|
|
1231
|
-
const [lastUpdatedTime, setLastUpdatedTime] = (0,
|
|
1272
|
+
const containerRef = (0, import_react12.useRef)(null);
|
|
1273
|
+
const monthRef = (0, import_react12.useRef)(null);
|
|
1274
|
+
const dayRef = (0, import_react12.useRef)(null);
|
|
1275
|
+
const yearRef = (0, import_react12.useRef)(null);
|
|
1276
|
+
const [month, setMonth] = (0, import_react12.useState)("");
|
|
1277
|
+
const [day, setDay] = (0, import_react12.useState)("");
|
|
1278
|
+
const [year, setYear] = (0, import_react12.useState)("");
|
|
1279
|
+
const [lastUpdatedTime, setLastUpdatedTime] = (0, import_react12.useState)(0);
|
|
1232
1280
|
const segmentRefs = { month: monthRef, day: dayRef, year: yearRef };
|
|
1233
1281
|
const focusRef = (ref) => {
|
|
1234
1282
|
var _a, _b;
|
|
@@ -1383,7 +1431,7 @@ var BaseDateInput = ({
|
|
|
1383
1431
|
onSubmit == null ? void 0 : onSubmit();
|
|
1384
1432
|
clearFocus();
|
|
1385
1433
|
};
|
|
1386
|
-
(0,
|
|
1434
|
+
(0, import_react12.useEffect)(() => {
|
|
1387
1435
|
const now = Date.now();
|
|
1388
1436
|
const timeSinceLastUpdate = now - lastUpdatedTime;
|
|
1389
1437
|
if (timeSinceLastUpdate > 500) {
|
|
@@ -1437,7 +1485,7 @@ var BaseDateInput = ({
|
|
|
1437
1485
|
children: [
|
|
1438
1486
|
Boolean(prefix) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "GeckoUIDateInput__prefix", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DynamicComponentRenderer_default, { component: prefix }) }),
|
|
1439
1487
|
!!isEmpty && !hasFocus && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: classNames("GeckoUIDateInput__placeholder", placeholderClassName), children: placeholder != null ? placeholder : generatePlaceholder(format, separator) }),
|
|
1440
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: classNames("GeckoUIDateInput__display-container"), children: inputs.map(({ ref, value: value2, onChange: onChange2, maxLength, segment, display }, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1488
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: classNames("GeckoUIDateInput__display-container"), children: inputs.map(({ ref, value: value2, onChange: onChange2, maxLength, segment, display }, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react12.Fragment, { children: [
|
|
1441
1489
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1442
1490
|
"label",
|
|
1443
1491
|
{
|
|
@@ -1493,7 +1541,7 @@ BaseDateInput.displayName = "BaseDateInput";
|
|
|
1493
1541
|
var BaseDateInput_default = BaseDateInput;
|
|
1494
1542
|
|
|
1495
1543
|
// src/components/Calendar/Calendar/Calendar.tsx
|
|
1496
|
-
var
|
|
1544
|
+
var import_react14 = require("react");
|
|
1497
1545
|
|
|
1498
1546
|
// src/components/Calendar/Calendar.utils.ts
|
|
1499
1547
|
function daysInMonth(month, year) {
|
|
@@ -1758,12 +1806,12 @@ CalendarMonthPicker.displayName = "CalendarMonthPicker";
|
|
|
1758
1806
|
var CalendarMonthPicker_default = CalendarMonthPicker;
|
|
1759
1807
|
|
|
1760
1808
|
// src/components/Calendar/CalendarYearPicker/CalendarYearPicker.tsx
|
|
1761
|
-
var
|
|
1809
|
+
var import_react13 = require("react");
|
|
1762
1810
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1763
1811
|
function CalendarYearPicker(_a) {
|
|
1764
1812
|
var _b = _a, { activeYear, onSelectYear } = _b, headerProps = __objRest(_b, ["activeYear", "onSelectYear"]);
|
|
1765
1813
|
const start = Math.floor(activeYear / 10) * 10;
|
|
1766
|
-
const [years, setYears] = (0,
|
|
1814
|
+
const [years, setYears] = (0, import_react13.useState)(
|
|
1767
1815
|
() => Array.from({ length: 12 }).map((_, index) => start - 1 + index)
|
|
1768
1816
|
);
|
|
1769
1817
|
const handleLeft = () => {
|
|
@@ -1822,9 +1870,9 @@ var Calendar = (props) => {
|
|
|
1822
1870
|
fixedWeeks,
|
|
1823
1871
|
mode = "single"
|
|
1824
1872
|
} = props;
|
|
1825
|
-
const [view, setView] = (0,
|
|
1826
|
-
const [rangeSelectionStart, setRangeSelectionStart] = (0,
|
|
1827
|
-
const [hoveredDate, setHoveredDate] = (0,
|
|
1873
|
+
const [view, setView] = (0, import_react14.useState)("day" /* Day */);
|
|
1874
|
+
const [rangeSelectionStart, setRangeSelectionStart] = (0, import_react14.useState)(null);
|
|
1875
|
+
const [hoveredDate, setHoveredDate] = (0, import_react14.useState)(null);
|
|
1828
1876
|
const selectedDate = mode === "single" ? props.selectedDate : void 0;
|
|
1829
1877
|
const onSelectDate = mode === "single" ? props.onSelectDate : void 0;
|
|
1830
1878
|
const selectedRange = mode === "range" ? props.selectedRange : void 0;
|
|
@@ -1838,8 +1886,8 @@ var Calendar = (props) => {
|
|
|
1838
1886
|
const isValidDate2 = isValidISOFormat(initialDate);
|
|
1839
1887
|
const today = getTodayDate();
|
|
1840
1888
|
const [year, month] = (isValidDate2 ? initialDate : today).split("-").map(Number);
|
|
1841
|
-
const [activeMonth, setActiveMonth] = (0,
|
|
1842
|
-
const [activeYear, setActiveYear] = (0,
|
|
1889
|
+
const [activeMonth, setActiveMonth] = (0, import_react14.useState)(month - 1);
|
|
1890
|
+
const [activeYear, setActiveYear] = (0, import_react14.useState)(year);
|
|
1843
1891
|
const increaseYear = () => {
|
|
1844
1892
|
setActiveYear((prev) => prev + 1);
|
|
1845
1893
|
};
|
|
@@ -1863,7 +1911,7 @@ var Calendar = (props) => {
|
|
|
1863
1911
|
onSelectDate == null ? void 0 : onSelectDate("");
|
|
1864
1912
|
}
|
|
1865
1913
|
};
|
|
1866
|
-
(0,
|
|
1914
|
+
(0, import_react14.useImperativeHandle)(calendarRef, () => {
|
|
1867
1915
|
return {
|
|
1868
1916
|
moveTo: (month2, year2) => {
|
|
1869
1917
|
setActiveMonth(month2 - 1);
|
|
@@ -1873,7 +1921,7 @@ var Calendar = (props) => {
|
|
|
1873
1921
|
clearSelection
|
|
1874
1922
|
};
|
|
1875
1923
|
});
|
|
1876
|
-
(0,
|
|
1924
|
+
(0, import_react14.useEffect)(() => {
|
|
1877
1925
|
if (mode === "single") {
|
|
1878
1926
|
if (selectedDate && !isValidISOFormat(selectedDate)) {
|
|
1879
1927
|
devWarn(
|
|
@@ -2049,20 +2097,24 @@ var DateInput = (_a) => {
|
|
|
2049
2097
|
"onStateUpdate",
|
|
2050
2098
|
"onSubmit"
|
|
2051
2099
|
]);
|
|
2052
|
-
const calendarRef = (0,
|
|
2053
|
-
const [openCalendar, setOpenCalendar] = (0,
|
|
2054
|
-
const { refs, floatingStyles } = (0,
|
|
2100
|
+
const calendarRef = (0, import_react16.useRef)(null);
|
|
2101
|
+
const [openCalendar, setOpenCalendar] = (0, import_react16.useState)(false);
|
|
2102
|
+
const { refs, floatingStyles } = (0, import_react15.useFloating)({
|
|
2055
2103
|
placement: calendarPlacement,
|
|
2056
2104
|
strategy: floatingStrategy,
|
|
2057
|
-
middleware: [(0,
|
|
2058
|
-
whileElementsMounted:
|
|
2105
|
+
middleware: [(0, import_react15.flip)({ padding: 4 }), (0, import_react15.offset)({ mainAxis: 4 })],
|
|
2106
|
+
whileElementsMounted: import_react15.autoUpdate,
|
|
2059
2107
|
open: openCalendar,
|
|
2060
2108
|
onOpenChange: setOpenCalendar
|
|
2061
2109
|
});
|
|
2062
|
-
useClickOutside_default(
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2110
|
+
useClickOutside_default(
|
|
2111
|
+
() => {
|
|
2112
|
+
setOpenCalendar(false);
|
|
2113
|
+
},
|
|
2114
|
+
[refs.reference],
|
|
2115
|
+
openCalendar
|
|
2116
|
+
);
|
|
2117
|
+
const handleStateUpdateInternal = (0, import_react16.useCallback)(
|
|
2066
2118
|
(state) => {
|
|
2067
2119
|
var _a2;
|
|
2068
2120
|
if (!hideCalendar) {
|
|
@@ -2080,11 +2132,11 @@ var DateInput = (_a) => {
|
|
|
2080
2132
|
},
|
|
2081
2133
|
[hideCalendar, onStateUpdate]
|
|
2082
2134
|
);
|
|
2083
|
-
const handleSubmit = (0,
|
|
2135
|
+
const handleSubmit = (0, import_react16.useCallback)(() => {
|
|
2084
2136
|
setOpenCalendar(false);
|
|
2085
2137
|
onSubmit == null ? void 0 : onSubmit();
|
|
2086
2138
|
}, [onSubmit]);
|
|
2087
|
-
const handleChange = (0,
|
|
2139
|
+
const handleChange = (0, import_react16.useCallback)(
|
|
2088
2140
|
(date) => {
|
|
2089
2141
|
onChange == null ? void 0 : onChange(date);
|
|
2090
2142
|
if (date === null) {
|
|
@@ -2153,11 +2205,11 @@ DateInput.displayName = "DateInput";
|
|
|
2153
2205
|
var DateInput_default = DateInput;
|
|
2154
2206
|
|
|
2155
2207
|
// src/components/DateRangeInput/DateRangeInput.tsx
|
|
2156
|
-
var
|
|
2157
|
-
var
|
|
2208
|
+
var import_react18 = require("@floating-ui/react");
|
|
2209
|
+
var import_react19 = require("react");
|
|
2158
2210
|
|
|
2159
2211
|
// src/components/BaseDateRangeInput/BaseDateRangeInput.tsx
|
|
2160
|
-
var
|
|
2212
|
+
var import_react17 = require("react");
|
|
2161
2213
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2162
2214
|
var BaseDateRangeInput = (_a) => {
|
|
2163
2215
|
var _b = _a, {
|
|
@@ -2201,20 +2253,20 @@ var BaseDateRangeInput = (_a) => {
|
|
|
2201
2253
|
"hasFocus",
|
|
2202
2254
|
"aria-invalid"
|
|
2203
2255
|
]);
|
|
2204
|
-
const containerRef = (0,
|
|
2205
|
-
const startMonthRef = (0,
|
|
2206
|
-
const startDayRef = (0,
|
|
2207
|
-
const startYearRef = (0,
|
|
2208
|
-
const endMonthRef = (0,
|
|
2209
|
-
const endDayRef = (0,
|
|
2210
|
-
const endYearRef = (0,
|
|
2211
|
-
const [startMonth, setStartMonth] = (0,
|
|
2212
|
-
const [startDay, setStartDay] = (0,
|
|
2213
|
-
const [startYear, setStartYear] = (0,
|
|
2214
|
-
const [endMonth, setEndMonth] = (0,
|
|
2215
|
-
const [endDay, setEndDay] = (0,
|
|
2216
|
-
const [endYear, setEndYear] = (0,
|
|
2217
|
-
const [lastUpdatedTime, setLastUpdatedTime] = (0,
|
|
2256
|
+
const containerRef = (0, import_react17.useRef)(null);
|
|
2257
|
+
const startMonthRef = (0, import_react17.useRef)(null);
|
|
2258
|
+
const startDayRef = (0, import_react17.useRef)(null);
|
|
2259
|
+
const startYearRef = (0, import_react17.useRef)(null);
|
|
2260
|
+
const endMonthRef = (0, import_react17.useRef)(null);
|
|
2261
|
+
const endDayRef = (0, import_react17.useRef)(null);
|
|
2262
|
+
const endYearRef = (0, import_react17.useRef)(null);
|
|
2263
|
+
const [startMonth, setStartMonth] = (0, import_react17.useState)("");
|
|
2264
|
+
const [startDay, setStartDay] = (0, import_react17.useState)("");
|
|
2265
|
+
const [startYear, setStartYear] = (0, import_react17.useState)("");
|
|
2266
|
+
const [endMonth, setEndMonth] = (0, import_react17.useState)("");
|
|
2267
|
+
const [endDay, setEndDay] = (0, import_react17.useState)("");
|
|
2268
|
+
const [endYear, setEndYear] = (0, import_react17.useState)("");
|
|
2269
|
+
const [lastUpdatedTime, setLastUpdatedTime] = (0, import_react17.useState)(0);
|
|
2218
2270
|
const segmentRefs = {
|
|
2219
2271
|
startMonth: startMonthRef,
|
|
2220
2272
|
startDay: startDayRef,
|
|
@@ -2402,7 +2454,7 @@ var BaseDateRangeInput = (_a) => {
|
|
|
2402
2454
|
onSubmit == null ? void 0 : onSubmit();
|
|
2403
2455
|
clearFocus();
|
|
2404
2456
|
};
|
|
2405
|
-
(0,
|
|
2457
|
+
(0, import_react17.useEffect)(() => {
|
|
2406
2458
|
const now = Date.now();
|
|
2407
2459
|
const timeSinceLastUpdate = now - lastUpdatedTime;
|
|
2408
2460
|
if (timeSinceLastUpdate > 500) {
|
|
@@ -2521,7 +2573,7 @@ var BaseDateRangeInput = (_a) => {
|
|
|
2521
2573
|
const endValid = isValidDate(endYear, endMonth, endDay);
|
|
2522
2574
|
const isError = !isEmpty && (!startEmpty && !startValid || !endEmpty && !endValid) || invalid === true || invalid === "true";
|
|
2523
2575
|
const state = disabled ? "disabled" : readOnly ? "readonly" : "enabled";
|
|
2524
|
-
const renderSegments = (segments) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: segments.map(({ ref, value: value2, onChange: onChange2, maxLength, segment, display }, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2576
|
+
const renderSegments = (segments) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: segments.map(({ ref, value: value2, onChange: onChange2, maxLength, segment, display }, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react17.Fragment, { children: [
|
|
2525
2577
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2526
2578
|
"label",
|
|
2527
2579
|
{
|
|
@@ -2651,8 +2703,8 @@ var DateRangeInput = (_a) => {
|
|
|
2651
2703
|
"onStateUpdate",
|
|
2652
2704
|
"onSubmit"
|
|
2653
2705
|
]);
|
|
2654
|
-
const calendarRef = (0,
|
|
2655
|
-
const [openCalendar, setOpenCalendar] = (0,
|
|
2706
|
+
const calendarRef = (0, import_react19.useRef)(null);
|
|
2707
|
+
const [openCalendar, setOpenCalendar] = (0, import_react19.useState)(false);
|
|
2656
2708
|
const handleCloseCalendar = () => {
|
|
2657
2709
|
setOpenCalendar(false);
|
|
2658
2710
|
if (!(value == null ? void 0 : value.from) || !(value == null ? void 0 : value.to)) return;
|
|
@@ -2660,17 +2712,21 @@ var DateRangeInput = (_a) => {
|
|
|
2660
2712
|
onChange == null ? void 0 : onChange({ from: value.to, to: value.from });
|
|
2661
2713
|
}
|
|
2662
2714
|
};
|
|
2663
|
-
const { refs, floatingStyles } = (0,
|
|
2715
|
+
const { refs, floatingStyles } = (0, import_react18.useFloating)({
|
|
2664
2716
|
placement: calendarPlacement,
|
|
2665
2717
|
strategy: floatingStrategy,
|
|
2666
|
-
middleware: [(0,
|
|
2667
|
-
whileElementsMounted:
|
|
2718
|
+
middleware: [(0, import_react18.flip)({ padding: 4 }), (0, import_react18.offset)({ mainAxis: 4 })],
|
|
2719
|
+
whileElementsMounted: import_react18.autoUpdate,
|
|
2668
2720
|
open: openCalendar,
|
|
2669
2721
|
onOpenChange: setOpenCalendar
|
|
2670
2722
|
});
|
|
2671
|
-
useClickOutside_default(
|
|
2672
|
-
|
|
2673
|
-
|
|
2723
|
+
useClickOutside_default(
|
|
2724
|
+
() => {
|
|
2725
|
+
handleCloseCalendar();
|
|
2726
|
+
},
|
|
2727
|
+
[refs.reference],
|
|
2728
|
+
openCalendar
|
|
2729
|
+
);
|
|
2674
2730
|
const handleStateUpdateInternal = (state) => {
|
|
2675
2731
|
var _a2;
|
|
2676
2732
|
if (!hideCalendar) {
|
|
@@ -2761,12 +2817,12 @@ DateRangeInput.displayName = "DateRangeInput";
|
|
|
2761
2817
|
var DateRangeInput_default = DateRangeInput;
|
|
2762
2818
|
|
|
2763
2819
|
// src/components/Input/Input.tsx
|
|
2764
|
-
var
|
|
2820
|
+
var import_react20 = require("react");
|
|
2765
2821
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2766
|
-
var Input = (0,
|
|
2822
|
+
var Input = (0, import_react20.forwardRef)(
|
|
2767
2823
|
(_a, ref) => {
|
|
2768
2824
|
var _b = _a, { name, prefix, id, suffix, inputClassName, className, disabled, readOnly } = _b, props = __objRest(_b, ["name", "prefix", "id", "suffix", "inputClassName", "className", "disabled", "readOnly"]);
|
|
2769
|
-
const _id = (0,
|
|
2825
|
+
const _id = (0, import_react20.useId)();
|
|
2770
2826
|
const { dataAttributes, rest } = splitDataAttributes(props);
|
|
2771
2827
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2772
2828
|
"label",
|
|
@@ -2800,8 +2856,8 @@ Input.displayName = "Input";
|
|
|
2800
2856
|
var Input_default = Input;
|
|
2801
2857
|
|
|
2802
2858
|
// src/components/Tooltip/Tooltip.tsx
|
|
2803
|
-
var
|
|
2804
|
-
var
|
|
2859
|
+
var import_react21 = require("@floating-ui/react");
|
|
2860
|
+
var import_react22 = require("react");
|
|
2805
2861
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2806
2862
|
var Tooltip = ({
|
|
2807
2863
|
children,
|
|
@@ -2815,14 +2871,14 @@ var Tooltip = ({
|
|
|
2815
2871
|
placement = "top",
|
|
2816
2872
|
sideOffset = 12
|
|
2817
2873
|
}) => {
|
|
2818
|
-
const [isOpen2, setIsOpen] = (0,
|
|
2819
|
-
const arrowRef = (0,
|
|
2820
|
-
const timeoutRef = (0,
|
|
2821
|
-
const { refs, floatingStyles, context } = (0,
|
|
2874
|
+
const [isOpen2, setIsOpen] = (0, import_react22.useState)(false);
|
|
2875
|
+
const arrowRef = (0, import_react22.useRef)(null);
|
|
2876
|
+
const timeoutRef = (0, import_react22.useRef)(null);
|
|
2877
|
+
const { refs, floatingStyles, context } = (0, import_react21.useFloating)({
|
|
2822
2878
|
open: isOpen2,
|
|
2823
2879
|
onOpenChange: setIsOpen,
|
|
2824
2880
|
placement,
|
|
2825
|
-
middleware: [(0,
|
|
2881
|
+
middleware: [(0, import_react21.offset)(sideOffset), (0, import_react21.flip)(), (0, import_react21.shift)({ padding: 5 }), (0, import_react21.arrow)({ element: arrowRef })]
|
|
2826
2882
|
});
|
|
2827
2883
|
const handleMouseEnter = () => {
|
|
2828
2884
|
if (timeoutRef.current) {
|
|
@@ -2849,7 +2905,7 @@ var Tooltip = ({
|
|
|
2849
2905
|
const renderTrigger = () => {
|
|
2850
2906
|
const child = triggerAsChild ? asChildElement(children) : null;
|
|
2851
2907
|
if (child) {
|
|
2852
|
-
return (0,
|
|
2908
|
+
return (0, import_react22.cloneElement)(child, __spreadProps(__spreadValues({}, triggerProps), {
|
|
2853
2909
|
className: classNames(child.props.className, triggerClassName)
|
|
2854
2910
|
}));
|
|
2855
2911
|
}
|
|
@@ -2857,7 +2913,7 @@ var Tooltip = ({
|
|
|
2857
2913
|
};
|
|
2858
2914
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
2859
2915
|
renderTrigger(),
|
|
2860
|
-
isOpen2 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2916
|
+
isOpen2 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react21.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2861
2917
|
"div",
|
|
2862
2918
|
{
|
|
2863
2919
|
ref: refs.setFloating,
|
|
@@ -2867,7 +2923,7 @@ var Tooltip = ({
|
|
|
2867
2923
|
children: [
|
|
2868
2924
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DynamicComponentRenderer_default, { component: content }),
|
|
2869
2925
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2870
|
-
|
|
2926
|
+
import_react21.FloatingArrow,
|
|
2871
2927
|
{
|
|
2872
2928
|
ref: arrowRef,
|
|
2873
2929
|
context,
|
|
@@ -2927,9 +2983,9 @@ var InputError = (_a) => {
|
|
|
2927
2983
|
var InputError_default = InputError;
|
|
2928
2984
|
|
|
2929
2985
|
// src/components/Button/Button.tsx
|
|
2930
|
-
var
|
|
2986
|
+
var import_react23 = require("react");
|
|
2931
2987
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2932
|
-
var Button = (0,
|
|
2988
|
+
var Button = (0, import_react23.forwardRef)(
|
|
2933
2989
|
(_a, ref) => {
|
|
2934
2990
|
var _b = _a, { children, className, variant = "filled", size: size2 = "md", color = "primary" } = _b, rest = __objRest(_b, ["children", "className", "variant", "size", "color"]);
|
|
2935
2991
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
@@ -3030,7 +3086,7 @@ LoadingButton.displayName = "LoadingButton";
|
|
|
3030
3086
|
var LoadingButton_default = LoadingButton;
|
|
3031
3087
|
|
|
3032
3088
|
// src/components/RHF/RHFCheckbox/RHFCheckbox.tsx
|
|
3033
|
-
var
|
|
3089
|
+
var import_react24 = require("react");
|
|
3034
3090
|
|
|
3035
3091
|
// src/utils/isEqual.ts
|
|
3036
3092
|
var import_lodash = __toESM(require("lodash.isequal"));
|
|
@@ -3085,7 +3141,7 @@ var RHFCheckbox = (_a) => {
|
|
|
3085
3141
|
"indeterminate",
|
|
3086
3142
|
"onBlur"
|
|
3087
3143
|
]);
|
|
3088
|
-
const _id = (0,
|
|
3144
|
+
const _id = (0, import_react24.useId)();
|
|
3089
3145
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3090
3146
|
RHFController_default,
|
|
3091
3147
|
{
|
|
@@ -3257,7 +3313,7 @@ RHFInput.displayName = "RHFInput";
|
|
|
3257
3313
|
var RHFInput_default = RHFInput;
|
|
3258
3314
|
|
|
3259
3315
|
// src/components/RHF/RHFError/RHFError.tsx
|
|
3260
|
-
var
|
|
3316
|
+
var import_react25 = require("react");
|
|
3261
3317
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3262
3318
|
var RHFError = ({ name, control, className, render }) => {
|
|
3263
3319
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
@@ -3267,7 +3323,7 @@ var RHFError = ({ name, control, className, render }) => {
|
|
|
3267
3323
|
name,
|
|
3268
3324
|
render: ({ fieldState }) => {
|
|
3269
3325
|
const { error } = fieldState;
|
|
3270
|
-
if (!(error == null ? void 0 : error.message)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3326
|
+
if (!(error == null ? void 0 : error.message)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react25.Fragment, {}, "rhf-error");
|
|
3271
3327
|
if (typeof render === "function") {
|
|
3272
3328
|
return render(fieldState);
|
|
3273
3329
|
}
|
|
@@ -3398,12 +3454,12 @@ RHFCurrencyInput.displayName = "RHFCurrencyInput";
|
|
|
3398
3454
|
var RHFCurrencyInput_default = RHFCurrencyInput;
|
|
3399
3455
|
|
|
3400
3456
|
// src/components/Textarea/Textarea.tsx
|
|
3401
|
-
var
|
|
3457
|
+
var import_react27 = require("react");
|
|
3402
3458
|
|
|
3403
3459
|
// src/hooks/useAutoResize.ts
|
|
3404
|
-
var
|
|
3460
|
+
var import_react26 = require("react");
|
|
3405
3461
|
var useAutoResize = (ref, { enabled, minRows, maxRows, value }) => {
|
|
3406
|
-
const fit = (0,
|
|
3462
|
+
const fit = (0, import_react26.useCallback)(() => {
|
|
3407
3463
|
const el = ref.current;
|
|
3408
3464
|
if (!el || !enabled) return;
|
|
3409
3465
|
const style = getComputedStyle(el);
|
|
@@ -3417,7 +3473,7 @@ var useAutoResize = (ref, { enabled, minRows, maxRows, value }) => {
|
|
|
3417
3473
|
el.style.height = `${Math.min(Math.max(content, min), max) + (style.boxSizing === "border-box" ? border : -padding)}px`;
|
|
3418
3474
|
el.style.overflowY = content > max ? "auto" : "hidden";
|
|
3419
3475
|
}, [ref, enabled, minRows, maxRows]);
|
|
3420
|
-
(0,
|
|
3476
|
+
(0, import_react26.useLayoutEffect)(() => {
|
|
3421
3477
|
const el = ref.current;
|
|
3422
3478
|
if (!el) return;
|
|
3423
3479
|
if (!enabled) {
|
|
@@ -3446,17 +3502,17 @@ var useAutoResize_default = useAutoResize;
|
|
|
3446
3502
|
|
|
3447
3503
|
// src/components/Textarea/Textarea.tsx
|
|
3448
3504
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3449
|
-
var Textarea = (0,
|
|
3505
|
+
var Textarea = (0, import_react27.forwardRef)(
|
|
3450
3506
|
(_a, ref) => {
|
|
3451
3507
|
var _b = _a, { autoResize = false, className, rows = 2, maxRows, onInput, value } = _b, rest = __objRest(_b, ["autoResize", "className", "rows", "maxRows", "onInput", "value"]);
|
|
3452
|
-
const innerRef = (0,
|
|
3508
|
+
const innerRef = (0, import_react27.useRef)(null);
|
|
3453
3509
|
const fit = useAutoResize_default(innerRef, {
|
|
3454
3510
|
enabled: autoResize,
|
|
3455
3511
|
minRows: rows,
|
|
3456
3512
|
maxRows,
|
|
3457
3513
|
value
|
|
3458
3514
|
});
|
|
3459
|
-
const handleInput = (0,
|
|
3515
|
+
const handleInput = (0, import_react27.useCallback)(
|
|
3460
3516
|
(event) => {
|
|
3461
3517
|
fit();
|
|
3462
3518
|
onInput == null ? void 0 : onInput(event);
|
|
@@ -3541,9 +3597,9 @@ RHFTextarea.displayName = "RHFTextarea";
|
|
|
3541
3597
|
var RHFTextarea_default = RHFTextarea;
|
|
3542
3598
|
|
|
3543
3599
|
// src/components/Switch/Switch.tsx
|
|
3544
|
-
var
|
|
3600
|
+
var import_react28 = require("react");
|
|
3545
3601
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3546
|
-
var Switch = (0,
|
|
3602
|
+
var Switch = (0, import_react28.forwardRef)(
|
|
3547
3603
|
(_a, ref) => {
|
|
3548
3604
|
var _b = _a, { size: size2 = "md", className, thumbClassName, onChange, onKeyDown } = _b, rest = __objRest(_b, ["size", "className", "thumbClassName", "onChange", "onKeyDown"]);
|
|
3549
3605
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: classNames("GeckoUISwitch", className), "data-size": size2, children: [
|
|
@@ -3648,12 +3704,12 @@ RHFSwitch.displayName = "RHFSwitch";
|
|
|
3648
3704
|
var RHFSwitch_default = RHFSwitch;
|
|
3649
3705
|
|
|
3650
3706
|
// src/components/RHF/RHFRadio/RHFRadio.tsx
|
|
3651
|
-
var
|
|
3707
|
+
var import_react30 = require("react");
|
|
3652
3708
|
|
|
3653
3709
|
// src/components/Radio/Radio.tsx
|
|
3654
|
-
var
|
|
3710
|
+
var import_react29 = require("react");
|
|
3655
3711
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3656
|
-
var Radio = (0,
|
|
3712
|
+
var Radio = (0, import_react29.forwardRef)((_a, ref) => {
|
|
3657
3713
|
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
3658
3714
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", __spreadProps(__spreadValues({ className: classNames("GeckoUIRadio", className), ref }, rest), { type: "radio" }));
|
|
3659
3715
|
});
|
|
@@ -3686,7 +3742,7 @@ var RHFRadio = (_a) => {
|
|
|
3686
3742
|
"onChange",
|
|
3687
3743
|
"onBlur"
|
|
3688
3744
|
]);
|
|
3689
|
-
const _id = (0,
|
|
3745
|
+
const _id = (0, import_react30.useId)();
|
|
3690
3746
|
const uniqueId = id || _id;
|
|
3691
3747
|
if (value === void 0 || value === null) {
|
|
3692
3748
|
throw new Error("RHFRadio: value cannot be undefined or null");
|
|
@@ -3760,8 +3816,8 @@ RHFDateInput.displayName = "RHFDateInput";
|
|
|
3760
3816
|
var RHFDateInput_default = RHFDateInput;
|
|
3761
3817
|
|
|
3762
3818
|
// src/components/TimeInput/TimeInput.tsx
|
|
3763
|
-
var
|
|
3764
|
-
var
|
|
3819
|
+
var import_react31 = require("@floating-ui/react");
|
|
3820
|
+
var import_react32 = require("react");
|
|
3765
3821
|
|
|
3766
3822
|
// src/components/TimeInput/TimeInput.utils.ts
|
|
3767
3823
|
var hasSeconds = (format) => format.includes("ss");
|
|
@@ -3887,28 +3943,28 @@ var TimeInput = ({
|
|
|
3887
3943
|
const twelve = isTwelveHour(format);
|
|
3888
3944
|
const withSeconds = hasSeconds(format);
|
|
3889
3945
|
const segments = segmentsFor(format);
|
|
3890
|
-
const fieldRef = (0,
|
|
3891
|
-
const listRef = (0,
|
|
3892
|
-
const columnsRef = (0,
|
|
3893
|
-
const hourRef = (0,
|
|
3894
|
-
const minuteRef = (0,
|
|
3895
|
-
const secondRef = (0,
|
|
3896
|
-
const meridiemRef = (0,
|
|
3946
|
+
const fieldRef = (0, import_react32.useRef)(null);
|
|
3947
|
+
const listRef = (0, import_react32.useRef)(null);
|
|
3948
|
+
const columnsRef = (0, import_react32.useRef)(null);
|
|
3949
|
+
const hourRef = (0, import_react32.useRef)(null);
|
|
3950
|
+
const minuteRef = (0, import_react32.useRef)(null);
|
|
3951
|
+
const secondRef = (0, import_react32.useRef)(null);
|
|
3952
|
+
const meridiemRef = (0, import_react32.useRef)(null);
|
|
3897
3953
|
const refs = {
|
|
3898
3954
|
hour: hourRef,
|
|
3899
3955
|
minute: minuteRef,
|
|
3900
3956
|
second: secondRef,
|
|
3901
3957
|
meridiem: meridiemRef
|
|
3902
3958
|
};
|
|
3903
|
-
const [draft, setDraft] = (0,
|
|
3904
|
-
const [focused, setFocused] = (0,
|
|
3905
|
-
const [open, setOpen] = (0,
|
|
3959
|
+
const [draft, setDraft] = (0, import_react32.useState)(null);
|
|
3960
|
+
const [focused, setFocused] = (0, import_react32.useState)(false);
|
|
3961
|
+
const [open, setOpen] = (0, import_react32.useState)(false);
|
|
3906
3962
|
const parts = draft != null ? draft : partsFrom(value, twelve);
|
|
3907
|
-
const floating = (0,
|
|
3963
|
+
const floating = (0, import_react31.useFloating)({
|
|
3908
3964
|
placement: listPlacement,
|
|
3909
3965
|
strategy: floatingStrategy,
|
|
3910
|
-
middleware: [(0,
|
|
3911
|
-
whileElementsMounted:
|
|
3966
|
+
middleware: [(0, import_react31.offset)(4), (0, import_react31.flip)({ padding: 8 }), (0, import_react31.shift)({ padding: 8 })],
|
|
3967
|
+
whileElementsMounted: import_react31.autoUpdate,
|
|
3912
3968
|
open,
|
|
3913
3969
|
onOpenChange: setOpen
|
|
3914
3970
|
});
|
|
@@ -3916,8 +3972,8 @@ var TimeInput = ({
|
|
|
3916
3972
|
setOpen(false);
|
|
3917
3973
|
setDraft(null);
|
|
3918
3974
|
};
|
|
3919
|
-
useClickOutside_default(close, [listRef, fieldRef]);
|
|
3920
|
-
(0,
|
|
3975
|
+
useClickOutside_default(close, [listRef, fieldRef], open);
|
|
3976
|
+
(0, import_react32.useEffect)(() => {
|
|
3921
3977
|
var _a;
|
|
3922
3978
|
if (!open) return;
|
|
3923
3979
|
(_a = columnsRef.current) == null ? void 0 : _a.querySelectorAll('[data-state="selected"]').forEach((cell) => {
|
|
@@ -4031,7 +4087,7 @@ var TimeInput = ({
|
|
|
4031
4087
|
children: [
|
|
4032
4088
|
Boolean(prefix) && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "GeckoUITimeInput__prefix", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DynamicComponentRenderer_default, { component: prefix }) }),
|
|
4033
4089
|
isEmpty && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: classNames("GeckoUITimeInput__placeholder", placeholderClassName), children: placeholder != null ? placeholder : format }),
|
|
4034
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "GeckoUITimeInput__segments", children: segments.map((segment, index) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
4090
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "GeckoUITimeInput__segments", children: segments.map((segment, index) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react32.Fragment, { children: [
|
|
4035
4091
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
4036
4092
|
"label",
|
|
4037
4093
|
{
|
|
@@ -4184,7 +4240,7 @@ RHFTimeInput.displayName = "RHFTimeInput";
|
|
|
4184
4240
|
var RHFTimeInput_default = RHFTimeInput;
|
|
4185
4241
|
|
|
4186
4242
|
// src/components/Slider/SliderBase/SliderBase.tsx
|
|
4187
|
-
var
|
|
4243
|
+
var import_react33 = require("react");
|
|
4188
4244
|
|
|
4189
4245
|
// src/components/Slider/Slider.utils.ts
|
|
4190
4246
|
var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
@@ -4226,9 +4282,9 @@ var SliderBase = ({
|
|
|
4226
4282
|
className,
|
|
4227
4283
|
thumbLabels
|
|
4228
4284
|
}) => {
|
|
4229
|
-
const trackRef = (0,
|
|
4230
|
-
const [active, setActive] = (0,
|
|
4231
|
-
const [focused, setFocused] = (0,
|
|
4285
|
+
const trackRef = (0, import_react33.useRef)(null);
|
|
4286
|
+
const [active, setActive] = (0, import_react33.useState)(null);
|
|
4287
|
+
const [focused, setFocused] = (0, import_react33.useState)(null);
|
|
4232
4288
|
const boundsFor = (index) => [
|
|
4233
4289
|
index === 0 ? min : values[index - 1] + minGap,
|
|
4234
4290
|
index === values.length - 1 ? max : values[index + 1] - minGap
|
|
@@ -4515,8 +4571,8 @@ RHFSlider.displayName = "RHFSlider";
|
|
|
4515
4571
|
var RHFSlider_default = RHFSlider;
|
|
4516
4572
|
|
|
4517
4573
|
// src/components/TagInput/TagInput/TagInput.tsx
|
|
4518
|
-
var
|
|
4519
|
-
var
|
|
4574
|
+
var import_react36 = require("@floating-ui/react");
|
|
4575
|
+
var import_react37 = require("react");
|
|
4520
4576
|
|
|
4521
4577
|
// src/utils/isTextIncludes.ts
|
|
4522
4578
|
function isTextIncludes(baseString = "", searchString) {
|
|
@@ -4525,15 +4581,15 @@ function isTextIncludes(baseString = "", searchString) {
|
|
|
4525
4581
|
var isTextIncludes_default = isTextIncludes;
|
|
4526
4582
|
|
|
4527
4583
|
// src/components/TagInput/TagInput.utils.ts
|
|
4528
|
-
var
|
|
4584
|
+
var import_react34 = require("react");
|
|
4529
4585
|
var labelOf = (props) => {
|
|
4530
4586
|
if (props.label) return props.label;
|
|
4531
4587
|
return typeof props.children === "string" ? props.children : props.value;
|
|
4532
4588
|
};
|
|
4533
|
-
var optionsFrom = (children) =>
|
|
4589
|
+
var optionsFrom = (children) => import_react34.Children.toArray(children).filter(
|
|
4534
4590
|
(child) => {
|
|
4535
4591
|
var _a;
|
|
4536
|
-
return (0,
|
|
4592
|
+
return (0, import_react34.isValidElement)(child) && ((_a = child.type) == null ? void 0 : _a.displayName) === "TagInputOption";
|
|
4537
4593
|
}
|
|
4538
4594
|
);
|
|
4539
4595
|
var looseKey = (text) => text.trim().replace(/\s+/g, " ").toLowerCase();
|
|
@@ -4544,10 +4600,10 @@ var splitOnSeparators = (text, separators) => {
|
|
|
4544
4600
|
};
|
|
4545
4601
|
|
|
4546
4602
|
// src/components/TagInput/useTagInput.tsx
|
|
4547
|
-
var
|
|
4548
|
-
var TagInputContext = (0,
|
|
4603
|
+
var import_react35 = require("react");
|
|
4604
|
+
var TagInputContext = (0, import_react35.createContext)(null);
|
|
4549
4605
|
var useTagInput = () => {
|
|
4550
|
-
const context = (0,
|
|
4606
|
+
const context = (0, import_react35.useContext)(TagInputContext);
|
|
4551
4607
|
if (!context) {
|
|
4552
4608
|
throw new Error("TagInput components have to be used inside a <TagInput>.");
|
|
4553
4609
|
}
|
|
@@ -4581,21 +4637,21 @@ var TagInput = ({
|
|
|
4581
4637
|
children,
|
|
4582
4638
|
"aria-invalid": invalid
|
|
4583
4639
|
}) => {
|
|
4584
|
-
const fieldRef = (0,
|
|
4585
|
-
const menuRef = (0,
|
|
4586
|
-
const inputRef = (0,
|
|
4587
|
-
const [keyword, setKeyword] = (0,
|
|
4588
|
-
const [focused, setFocused] = (0,
|
|
4589
|
-
const [open, setOpen] = (0,
|
|
4590
|
-
const floating = (0,
|
|
4640
|
+
const fieldRef = (0, import_react37.useRef)(null);
|
|
4641
|
+
const menuRef = (0, import_react37.useRef)(null);
|
|
4642
|
+
const inputRef = (0, import_react37.useRef)(null);
|
|
4643
|
+
const [keyword, setKeyword] = (0, import_react37.useState)("");
|
|
4644
|
+
const [focused, setFocused] = (0, import_react37.useState)(null);
|
|
4645
|
+
const [open, setOpen] = (0, import_react37.useState)(false);
|
|
4646
|
+
const floating = (0, import_react36.useFloating)({
|
|
4591
4647
|
placement: menuPlacement,
|
|
4592
4648
|
strategy: floatingStrategy,
|
|
4593
|
-
middleware: [(0,
|
|
4594
|
-
whileElementsMounted:
|
|
4649
|
+
middleware: [(0, import_react36.offset)(4), (0, import_react36.flip)({ padding: 8 }), (0, import_react36.shift)({ padding: 8 })],
|
|
4650
|
+
whileElementsMounted: import_react36.autoUpdate,
|
|
4595
4651
|
open,
|
|
4596
4652
|
onOpenChange: setOpen
|
|
4597
4653
|
});
|
|
4598
|
-
useClickOutside_default(() => setOpen(false), [menuRef, fieldRef]);
|
|
4654
|
+
useClickOutside_default(() => setOpen(false), [menuRef, fieldRef], open);
|
|
4599
4655
|
const declared = optionsFrom(children);
|
|
4600
4656
|
const isSelected = (tag) => value.includes(tag);
|
|
4601
4657
|
const canonical = (tag) => {
|
|
@@ -4849,7 +4905,7 @@ RHFTagInput.displayName = "RHFTagInput";
|
|
|
4849
4905
|
var RHFTagInput_default = RHFTagInput;
|
|
4850
4906
|
|
|
4851
4907
|
// src/components/Rating/Rating.tsx
|
|
4852
|
-
var
|
|
4908
|
+
var import_react38 = require("react");
|
|
4853
4909
|
|
|
4854
4910
|
// src/components/Rating/Rating.utils.ts
|
|
4855
4911
|
var snap = (value, precision) => Number((Math.round(value / precision) * precision).toFixed(4));
|
|
@@ -4907,9 +4963,9 @@ var Rating = (_a) => {
|
|
|
4907
4963
|
"className",
|
|
4908
4964
|
"aria-label"
|
|
4909
4965
|
]);
|
|
4910
|
-
const generated = (0,
|
|
4911
|
-
const iconsRef = (0,
|
|
4912
|
-
const [hovered, setHovered] = (0,
|
|
4966
|
+
const generated = (0, import_react38.useId)();
|
|
4967
|
+
const iconsRef = (0, import_react38.useRef)([]);
|
|
4968
|
+
const [hovered, setHovered] = (0, import_react38.useState)(null);
|
|
4913
4969
|
const interactive = !readOnly && !disabled;
|
|
4914
4970
|
const group = name != null ? name : `GeckoUIRating-${generated}`;
|
|
4915
4971
|
const steps = stepsFor(max, precision);
|
|
@@ -5053,11 +5109,11 @@ RHFRating.displayName = "RHFRating";
|
|
|
5053
5109
|
var RHFRating_default = RHFRating;
|
|
5054
5110
|
|
|
5055
5111
|
// src/components/ColorInput/ColorInput.tsx
|
|
5056
|
-
var
|
|
5057
|
-
var
|
|
5112
|
+
var import_react43 = require("@floating-ui/react");
|
|
5113
|
+
var import_react44 = require("react");
|
|
5058
5114
|
|
|
5059
5115
|
// src/components/ColorPicker/ColorPicker.tsx
|
|
5060
|
-
var
|
|
5116
|
+
var import_react42 = require("react");
|
|
5061
5117
|
|
|
5062
5118
|
// src/components/ColorPicker/ColorPicker.utils.ts
|
|
5063
5119
|
var clamp2 = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
@@ -5172,7 +5228,7 @@ var cssColor = (hsva) => formatColor(hsva, "rgb", true);
|
|
|
5172
5228
|
var sameColor = (a, b) => a.h === b.h && a.s === b.s && a.v === b.v && a.a === b.a;
|
|
5173
5229
|
|
|
5174
5230
|
// src/components/ColorPicker/ColorSlider/ColorSlider.tsx
|
|
5175
|
-
var
|
|
5231
|
+
var import_react39 = require("react");
|
|
5176
5232
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5177
5233
|
var ColorSlider = ({
|
|
5178
5234
|
value,
|
|
@@ -5188,8 +5244,8 @@ var ColorSlider = ({
|
|
|
5188
5244
|
valueText,
|
|
5189
5245
|
children
|
|
5190
5246
|
}) => {
|
|
5191
|
-
const trackRef = (0,
|
|
5192
|
-
const [dragging, setDragging] = (0,
|
|
5247
|
+
const trackRef = (0, import_react39.useRef)(null);
|
|
5248
|
+
const [dragging, setDragging] = (0, import_react39.useState)(false);
|
|
5193
5249
|
const moveTo = (event) => {
|
|
5194
5250
|
var _a;
|
|
5195
5251
|
const track = (_a = trackRef.current) == null ? void 0 : _a.getBoundingClientRect();
|
|
@@ -5274,15 +5330,15 @@ ColorSlider.displayName = "ColorSlider";
|
|
|
5274
5330
|
var ColorSlider_default = ColorSlider;
|
|
5275
5331
|
|
|
5276
5332
|
// src/components/ColorPicker/FormatSelect/FormatSelect.tsx
|
|
5277
|
-
var
|
|
5333
|
+
var import_react40 = require("react");
|
|
5278
5334
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5279
5335
|
var FormatSelect = ({ value, options, labels, disabled, onChange }) => {
|
|
5280
|
-
const rootRef = (0,
|
|
5281
|
-
const listRef = (0,
|
|
5282
|
-
const [open, setOpen] = (0,
|
|
5283
|
-
const [active, setActive] = (0,
|
|
5284
|
-
useClickOutside_default(() => setOpen(false), [rootRef]);
|
|
5285
|
-
(0,
|
|
5336
|
+
const rootRef = (0, import_react40.useRef)(null);
|
|
5337
|
+
const listRef = (0, import_react40.useRef)(null);
|
|
5338
|
+
const [open, setOpen] = (0, import_react40.useState)(false);
|
|
5339
|
+
const [active, setActive] = (0, import_react40.useState)(() => Math.max(options.indexOf(value), 0));
|
|
5340
|
+
useClickOutside_default(() => setOpen(false), [rootRef], open);
|
|
5341
|
+
(0, import_react40.useEffect)(() => {
|
|
5286
5342
|
var _a;
|
|
5287
5343
|
if (!open) return;
|
|
5288
5344
|
setActive(Math.max(options.indexOf(value), 0));
|
|
@@ -5380,7 +5436,7 @@ FormatSelect.displayName = "FormatSelect";
|
|
|
5380
5436
|
var FormatSelect_default = FormatSelect;
|
|
5381
5437
|
|
|
5382
5438
|
// src/components/ColorPicker/SaturationArea/SaturationArea.tsx
|
|
5383
|
-
var
|
|
5439
|
+
var import_react41 = require("react");
|
|
5384
5440
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5385
5441
|
var SaturationArea = ({
|
|
5386
5442
|
hsva,
|
|
@@ -5390,8 +5446,8 @@ var SaturationArea = ({
|
|
|
5390
5446
|
label,
|
|
5391
5447
|
children
|
|
5392
5448
|
}) => {
|
|
5393
|
-
const areaRef = (0,
|
|
5394
|
-
const [dragging, setDragging] = (0,
|
|
5449
|
+
const areaRef = (0, import_react41.useRef)(null);
|
|
5450
|
+
const [dragging, setDragging] = (0, import_react41.useState)(false);
|
|
5395
5451
|
const moveTo = (event) => {
|
|
5396
5452
|
var _a;
|
|
5397
5453
|
const area = (_a = areaRef.current) == null ? void 0 : _a.getBoundingClientRect();
|
|
@@ -5512,20 +5568,20 @@ var ColorPicker = (_a) => {
|
|
|
5512
5568
|
"className"
|
|
5513
5569
|
]);
|
|
5514
5570
|
var _a2;
|
|
5515
|
-
const [internal, setInternal] = (0,
|
|
5571
|
+
const [internal, setInternal] = (0, import_react42.useState)(() => {
|
|
5516
5572
|
var _a3;
|
|
5517
5573
|
return (_a3 = parseColor(value != null ? value : defaultValue)) != null ? _a3 : BLACK;
|
|
5518
5574
|
});
|
|
5519
|
-
const [typed, setTyped] = (0,
|
|
5520
|
-
const [hasDropper, setHasDropper] = (0,
|
|
5575
|
+
const [typed, setTyped] = (0, import_react42.useState)(null);
|
|
5576
|
+
const [hasDropper, setHasDropper] = (0, import_react42.useState)(false);
|
|
5521
5577
|
const preferred = (_a2 = formats[0]) != null ? _a2 : "hex";
|
|
5522
|
-
const [active, setActive] = (0,
|
|
5523
|
-
(0,
|
|
5524
|
-
const emitted = (0,
|
|
5525
|
-
(0,
|
|
5578
|
+
const [active, setActive] = (0, import_react42.useState)(preferred);
|
|
5579
|
+
(0, import_react42.useEffect)(() => setActive(preferred), [preferred]);
|
|
5580
|
+
const emitted = (0, import_react42.useRef)(null);
|
|
5581
|
+
(0, import_react42.useEffect)(() => {
|
|
5526
5582
|
setHasDropper(typeof window !== "undefined" && typeof window.EyeDropper === "function");
|
|
5527
5583
|
}, []);
|
|
5528
|
-
(0,
|
|
5584
|
+
(0, import_react42.useEffect)(() => {
|
|
5529
5585
|
if (value === void 0 || value === emitted.current) return;
|
|
5530
5586
|
const parsed = parseColor(value);
|
|
5531
5587
|
if (parsed && !sameColor(parsed, internal)) setInternal(parsed);
|
|
@@ -5733,15 +5789,15 @@ var ColorInput = (_a) => {
|
|
|
5733
5789
|
"wrapperClassName",
|
|
5734
5790
|
"pickerClassName"
|
|
5735
5791
|
]);
|
|
5736
|
-
const fieldRef = (0,
|
|
5737
|
-
const panelRef = (0,
|
|
5738
|
-
const [internal, setInternal] = (0,
|
|
5739
|
-
const [open, setOpen] = (0,
|
|
5740
|
-
const floating = (0,
|
|
5792
|
+
const fieldRef = (0, import_react44.useRef)(null);
|
|
5793
|
+
const panelRef = (0, import_react44.useRef)(null);
|
|
5794
|
+
const [internal, setInternal] = (0, import_react44.useState)(defaultValue);
|
|
5795
|
+
const [open, setOpen] = (0, import_react44.useState)(false);
|
|
5796
|
+
const floating = (0, import_react43.useFloating)({
|
|
5741
5797
|
placement: pickerPlacement,
|
|
5742
5798
|
strategy: floatingStrategy,
|
|
5743
|
-
middleware: [(0,
|
|
5744
|
-
whileElementsMounted:
|
|
5799
|
+
middleware: [(0, import_react43.offset)(4), (0, import_react43.flip)({ padding: 8 }), (0, import_react43.shift)({ padding: 8 })],
|
|
5800
|
+
whileElementsMounted: import_react43.autoUpdate,
|
|
5745
5801
|
open,
|
|
5746
5802
|
onOpenChange: setOpen
|
|
5747
5803
|
});
|
|
@@ -5751,7 +5807,7 @@ var ColorInput = (_a) => {
|
|
|
5751
5807
|
setOpen(next);
|
|
5752
5808
|
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
5753
5809
|
};
|
|
5754
|
-
useClickOutside_default(() => toggle(false), [panelRef, fieldRef]);
|
|
5810
|
+
useClickOutside_default(() => toggle(false), [panelRef, fieldRef], open);
|
|
5755
5811
|
const color = value != null ? value : internal;
|
|
5756
5812
|
const parsed = parseColor(color);
|
|
5757
5813
|
const handleChange = (next) => {
|
|
@@ -5959,7 +6015,7 @@ RHFDateRangeInput.displayName = "RHFDateRangeInput";
|
|
|
5959
6015
|
var RHFDateRangeInput_default = RHFDateRangeInput;
|
|
5960
6016
|
|
|
5961
6017
|
// src/components/FileInput/FileInput.tsx
|
|
5962
|
-
var
|
|
6018
|
+
var import_react45 = require("react");
|
|
5963
6019
|
|
|
5964
6020
|
// src/components/FileInput/FileInput.utils.ts
|
|
5965
6021
|
var countLabel = (count) => {
|
|
@@ -6006,9 +6062,9 @@ var FileInput = (props) => {
|
|
|
6006
6062
|
"unique",
|
|
6007
6063
|
"max"
|
|
6008
6064
|
]);
|
|
6009
|
-
const fieldRef = (0,
|
|
6010
|
-
const [dragging, setDragging] = (0,
|
|
6011
|
-
const [loading, setLoading] = (0,
|
|
6065
|
+
const fieldRef = (0, import_react45.useRef)(null);
|
|
6066
|
+
const [dragging, setDragging] = (0, import_react45.useState)(false);
|
|
6067
|
+
const [loading, setLoading] = (0, import_react45.useState)(false);
|
|
6012
6068
|
const held = multiple ? value != null ? value : [] : value ? [value] : [];
|
|
6013
6069
|
useRevokedPreviews_default(held.map((file) => file.preview));
|
|
6014
6070
|
const usable = !disabled && !readOnly;
|
|
@@ -6170,9 +6226,9 @@ RHFFileInput.displayName = "RHFFileInput";
|
|
|
6170
6226
|
var RHFFileInput_default = RHFFileInput;
|
|
6171
6227
|
|
|
6172
6228
|
// src/components/OTPInput/OTPInput.tsx
|
|
6173
|
-
var
|
|
6229
|
+
var import_react46 = require("react");
|
|
6174
6230
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6175
|
-
var OTPInput = (0,
|
|
6231
|
+
var OTPInput = (0, import_react46.forwardRef)(
|
|
6176
6232
|
(_a, ref) => {
|
|
6177
6233
|
var _b = _a, {
|
|
6178
6234
|
value = "",
|
|
@@ -6199,7 +6255,7 @@ var OTPInput = (0, import_react45.forwardRef)(
|
|
|
6199
6255
|
"disabled",
|
|
6200
6256
|
"aria-invalid"
|
|
6201
6257
|
]);
|
|
6202
|
-
const divRef = (0,
|
|
6258
|
+
const divRef = (0, import_react46.useRef)(null);
|
|
6203
6259
|
const { dataAttributes } = splitDataAttributes(props);
|
|
6204
6260
|
const focus = (index) => {
|
|
6205
6261
|
var _a2, _b2;
|
|
@@ -6362,8 +6418,8 @@ RHFOTPInput.displayName = "RHFOTPInput";
|
|
|
6362
6418
|
var RHFOTPInput_default = RHFOTPInput;
|
|
6363
6419
|
|
|
6364
6420
|
// src/components/Select/Select/Select.tsx
|
|
6365
|
-
var
|
|
6366
|
-
var
|
|
6421
|
+
var import_react51 = require("@floating-ui/react");
|
|
6422
|
+
var import_react52 = require("react");
|
|
6367
6423
|
|
|
6368
6424
|
// src/components/Select/Select.utils.ts
|
|
6369
6425
|
var isSelect = hasDisplayName("Select");
|
|
@@ -6426,7 +6482,7 @@ function findSelectOptions(el) {
|
|
|
6426
6482
|
}
|
|
6427
6483
|
|
|
6428
6484
|
// src/components/Select/SelectButton/SelectButton.tsx
|
|
6429
|
-
var
|
|
6485
|
+
var import_react49 = require("react");
|
|
6430
6486
|
|
|
6431
6487
|
// src/utils/createLabel.ts
|
|
6432
6488
|
function isBlankLabel(value) {
|
|
@@ -6468,13 +6524,13 @@ function createLabel(item) {
|
|
|
6468
6524
|
var createLabel_default = createLabel;
|
|
6469
6525
|
|
|
6470
6526
|
// src/components/Select/hooks/useSelectTrigger.tsx
|
|
6471
|
-
var
|
|
6527
|
+
var import_react48 = require("react");
|
|
6472
6528
|
|
|
6473
6529
|
// src/components/Select/useSelect.tsx
|
|
6474
|
-
var
|
|
6475
|
-
var SelectContext = (0,
|
|
6530
|
+
var import_react47 = require("react");
|
|
6531
|
+
var SelectContext = (0, import_react47.createContext)(void 0);
|
|
6476
6532
|
var useSelect = () => {
|
|
6477
|
-
const context = (0,
|
|
6533
|
+
const context = (0, import_react47.useContext)(SelectContext);
|
|
6478
6534
|
if (context === void 0) {
|
|
6479
6535
|
throw new Error("SelectContext must be used within a SelectProvider");
|
|
6480
6536
|
}
|
|
@@ -6495,14 +6551,17 @@ var useSelectTrigger = () => {
|
|
|
6495
6551
|
open,
|
|
6496
6552
|
multiple,
|
|
6497
6553
|
isEmpty,
|
|
6498
|
-
handleChange
|
|
6554
|
+
handleChange,
|
|
6555
|
+
filterable,
|
|
6556
|
+
requestSearchFocus
|
|
6499
6557
|
} = useSelect();
|
|
6558
|
+
const hasDropdownSearch = filterable === true || filterable === "dropdown";
|
|
6500
6559
|
const filteredOptions = options.filter(
|
|
6501
6560
|
({ label, visibility }) => !isHideSelectOption({ keyword, label, visibility, isEmpty })
|
|
6502
6561
|
);
|
|
6503
|
-
const
|
|
6504
|
-
setKeyword(() =>
|
|
6505
|
-
let focusedValue = options.find(({ label }) => isTextIncludes_default(label,
|
|
6562
|
+
const filterTo = (text) => {
|
|
6563
|
+
setKeyword(() => text);
|
|
6564
|
+
let focusedValue = options.find(({ label }) => isTextIncludes_default(label, text));
|
|
6506
6565
|
if (!focusedValue && filteredOptions.length) {
|
|
6507
6566
|
focusedValue = filteredOptions[0];
|
|
6508
6567
|
}
|
|
@@ -6510,7 +6569,16 @@ var useSelectTrigger = () => {
|
|
|
6510
6569
|
setFocusedOption(__spreadProps(__spreadValues({}, focusedValue), { focusType: "keyboard" }));
|
|
6511
6570
|
}
|
|
6512
6571
|
};
|
|
6572
|
+
const handleInputChange = (e) => filterTo(e.target.value);
|
|
6513
6573
|
const handleKeyboardInteraction = (e) => {
|
|
6574
|
+
const printable = e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;
|
|
6575
|
+
if (hasDropdownSearch && printable && !(e.key === " " && !keyword)) {
|
|
6576
|
+
e.preventDefault();
|
|
6577
|
+
if (!open) openMenu();
|
|
6578
|
+
filterTo((open ? keyword : "") + e.key);
|
|
6579
|
+
requestSearchFocus();
|
|
6580
|
+
return;
|
|
6581
|
+
}
|
|
6514
6582
|
if (e.key === "Escape") {
|
|
6515
6583
|
e.currentTarget.blur();
|
|
6516
6584
|
closeMenu();
|
|
@@ -6554,13 +6622,13 @@ var useSelectTrigger = () => {
|
|
|
6554
6622
|
}
|
|
6555
6623
|
};
|
|
6556
6624
|
const matchesAnOption = options.some((opt) => isEqual_default(opt.value, value));
|
|
6557
|
-
(0,
|
|
6625
|
+
(0, import_react48.useEffect)(() => {
|
|
6558
6626
|
if (multiple || matchesAnOption || isNil_default(value) || value === "") return;
|
|
6559
6627
|
devWarn(
|
|
6560
6628
|
"Select was given a value that matches no SelectOption, so the label was worked out from the value itself. Add an option for it, or give the value a `label` key."
|
|
6561
6629
|
);
|
|
6562
6630
|
}, [multiple, matchesAnOption, value]);
|
|
6563
|
-
const hasValue = (0,
|
|
6631
|
+
const hasValue = (0, import_react48.useMemo)(() => {
|
|
6564
6632
|
if (multiple) {
|
|
6565
6633
|
return Array.isArray(value) && !!(value == null ? void 0 : value.length);
|
|
6566
6634
|
}
|
|
@@ -6619,10 +6687,10 @@ function SelectButton(_a) {
|
|
|
6619
6687
|
onChange,
|
|
6620
6688
|
clearable
|
|
6621
6689
|
} = useSelect();
|
|
6622
|
-
const id = (0,
|
|
6623
|
-
const pointerDownRef = (0,
|
|
6690
|
+
const id = (0, import_react49.useId)();
|
|
6691
|
+
const pointerDownRef = (0, import_react49.useRef)(false);
|
|
6624
6692
|
const { hasValue, handleInputChange, handleKeyboardInteraction } = useSelectTrigger();
|
|
6625
|
-
const trigger = (0,
|
|
6693
|
+
const trigger = (0, import_react49.useMemo)(() => import_react49.Children.toArray(children).find(isSelectTrigger), [children]);
|
|
6626
6694
|
const handleClear = (e) => {
|
|
6627
6695
|
e.stopPropagation();
|
|
6628
6696
|
if (disabled) return;
|
|
@@ -6690,6 +6758,7 @@ function SelectButton(_a) {
|
|
|
6690
6758
|
disabled,
|
|
6691
6759
|
className: "GeckoUISelectButton__search__input"
|
|
6692
6760
|
}, (open && !hasValue || !multiple && hasValue) && { "data-initial": "" }), !filterable && { "data-readonly": "" }), {
|
|
6761
|
+
readOnly: !filterable,
|
|
6693
6762
|
onKeyDown: handleKeyboardInteraction,
|
|
6694
6763
|
onFocusCapture: openMenu,
|
|
6695
6764
|
onChange: filterable ? handleInputChange : (
|
|
@@ -6803,7 +6872,7 @@ SelectButton.displayName = "SelectButton";
|
|
|
6803
6872
|
var SelectButton_default = SelectButton;
|
|
6804
6873
|
|
|
6805
6874
|
// src/components/Select/SelectMenu/SelectMenu.tsx
|
|
6806
|
-
var
|
|
6875
|
+
var import_react50 = require("react");
|
|
6807
6876
|
|
|
6808
6877
|
// src/components/Select/SelectDropdownSearch/SelectDropdownSearch.tsx
|
|
6809
6878
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
@@ -6909,13 +6978,20 @@ var SelectMenu = (_a) => {
|
|
|
6909
6978
|
disabled,
|
|
6910
6979
|
open,
|
|
6911
6980
|
filterable,
|
|
6981
|
+
autoFocusSearch,
|
|
6982
|
+
searchFocusRequest,
|
|
6912
6983
|
menuScrollContainerRef,
|
|
6913
6984
|
floating: { refs, floatingStyles }
|
|
6914
6985
|
} = useSelect();
|
|
6915
|
-
const menuItems = (0,
|
|
6916
|
-
() =>
|
|
6986
|
+
const menuItems = (0, import_react50.useMemo)(
|
|
6987
|
+
() => import_react50.Children.toArray(children).filter((el) => !isSelectTrigger(el)),
|
|
6917
6988
|
[children]
|
|
6918
6989
|
);
|
|
6990
|
+
(0, import_react50.useEffect)(() => {
|
|
6991
|
+
var _a2, _b2;
|
|
6992
|
+
if (!searchFocusRequest) return;
|
|
6993
|
+
(_b2 = (_a2 = refs.floating.current) == null ? void 0 : _a2.querySelector(".GeckoUISelectMenu__search-container input")) == null ? void 0 : _b2.focus();
|
|
6994
|
+
}, [searchFocusRequest, refs.floating]);
|
|
6919
6995
|
if (!open || disabled) {
|
|
6920
6996
|
return null;
|
|
6921
6997
|
}
|
|
@@ -6929,7 +7005,13 @@ var SelectMenu = (_a) => {
|
|
|
6929
7005
|
"data-with-search": hasDropdownSearch || void 0
|
|
6930
7006
|
}, rest), {
|
|
6931
7007
|
children: [
|
|
6932
|
-
hasDropdownSearch && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7008
|
+
hasDropdownSearch && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7009
|
+
SelectDropdownSearch_default,
|
|
7010
|
+
{
|
|
7011
|
+
className: "GeckoUISelectMenu__search-container",
|
|
7012
|
+
autoFocus: autoFocusSearch
|
|
7013
|
+
}
|
|
7014
|
+
),
|
|
6933
7015
|
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { ref: menuScrollContainerRef, className: "GeckoUISelectMenu__items", children: [
|
|
6934
7016
|
menuItems,
|
|
6935
7017
|
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Empty, { children: menuItems })
|
|
@@ -6941,7 +7023,7 @@ var SelectMenu = (_a) => {
|
|
|
6941
7023
|
function Empty({ children }) {
|
|
6942
7024
|
const { hideDefaultEmptyUI = false } = useSelect();
|
|
6943
7025
|
if (hideDefaultEmptyUI) return null;
|
|
6944
|
-
const customEmpty =
|
|
7026
|
+
const customEmpty = import_react50.Children.toArray(children).find(isSelectEmpty);
|
|
6945
7027
|
if (customEmpty) return null;
|
|
6946
7028
|
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SelectEmpty_default, {});
|
|
6947
7029
|
}
|
|
@@ -6951,8 +7033,8 @@ var SelectMenu_default = SelectMenu;
|
|
|
6951
7033
|
// src/components/Select/Select/Select.tsx
|
|
6952
7034
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6953
7035
|
var Select = (props) => {
|
|
6954
|
-
const inputRef = (0,
|
|
6955
|
-
const menuScrollContainerRef = (0,
|
|
7036
|
+
const inputRef = (0, import_react52.useRef)(null);
|
|
7037
|
+
const menuScrollContainerRef = (0, import_react52.useRef)(null);
|
|
6956
7038
|
const _a = props, {
|
|
6957
7039
|
disabled,
|
|
6958
7040
|
inputRef: customInputRef,
|
|
@@ -6980,16 +7062,17 @@ var Select = (props) => {
|
|
|
6980
7062
|
"floatingStrategy",
|
|
6981
7063
|
"clearable"
|
|
6982
7064
|
]);
|
|
6983
|
-
const [open, setOpen] = (0,
|
|
6984
|
-
const [keyword, setKeyword] = (0,
|
|
6985
|
-
const [
|
|
6986
|
-
const
|
|
7065
|
+
const [open, setOpen] = (0, import_react52.useState)(false);
|
|
7066
|
+
const [keyword, setKeyword] = (0, import_react52.useState)("");
|
|
7067
|
+
const [searchFocusRequest, setSearchFocusRequest] = (0, import_react52.useState)(0);
|
|
7068
|
+
const [focusedOption, setFocusedOption] = (0, import_react52.useState)(null);
|
|
7069
|
+
const floating = (0, import_react51.useFloating)({
|
|
6987
7070
|
placement,
|
|
6988
7071
|
strategy: floatingStrategy,
|
|
6989
7072
|
middleware: [
|
|
6990
|
-
(0,
|
|
6991
|
-
(0,
|
|
6992
|
-
(0,
|
|
7073
|
+
(0, import_react51.flip)({ padding: 6 }),
|
|
7074
|
+
(0, import_react51.offset)({ mainAxis: 6 }),
|
|
7075
|
+
(0, import_react51.size)({
|
|
6993
7076
|
padding: 6,
|
|
6994
7077
|
apply({ rects, availableWidth, elements }) {
|
|
6995
7078
|
Object.assign(elements.floating.style, {
|
|
@@ -7000,15 +7083,15 @@ var Select = (props) => {
|
|
|
7000
7083
|
}
|
|
7001
7084
|
})
|
|
7002
7085
|
],
|
|
7003
|
-
whileElementsMounted:
|
|
7086
|
+
whileElementsMounted: import_react51.autoUpdate,
|
|
7004
7087
|
open,
|
|
7005
7088
|
onOpenChange: setOpen
|
|
7006
7089
|
});
|
|
7007
7090
|
const { refs } = floating;
|
|
7008
|
-
const options = (0,
|
|
7091
|
+
const options = (0, import_react52.useMemo)(
|
|
7009
7092
|
() => {
|
|
7010
7093
|
var _a2;
|
|
7011
|
-
return (_a2 =
|
|
7094
|
+
return (_a2 = import_react52.Children.toArray(children).map(findSelectOptions).filter(Boolean).flat()) != null ? _a2 : [];
|
|
7012
7095
|
},
|
|
7013
7096
|
[children]
|
|
7014
7097
|
);
|
|
@@ -7054,9 +7137,13 @@ var Select = (props) => {
|
|
|
7054
7137
|
onChange([...prevValue, optionValue]);
|
|
7055
7138
|
}
|
|
7056
7139
|
};
|
|
7057
|
-
useClickOutside_default(
|
|
7058
|
-
|
|
7059
|
-
|
|
7140
|
+
useClickOutside_default(
|
|
7141
|
+
() => {
|
|
7142
|
+
closeMenu();
|
|
7143
|
+
},
|
|
7144
|
+
[refs.reference],
|
|
7145
|
+
open
|
|
7146
|
+
);
|
|
7060
7147
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
7061
7148
|
SelectContext.Provider,
|
|
7062
7149
|
{
|
|
@@ -7065,6 +7152,8 @@ var Select = (props) => {
|
|
|
7065
7152
|
setOpen,
|
|
7066
7153
|
keyword,
|
|
7067
7154
|
setKeyword,
|
|
7155
|
+
searchFocusRequest,
|
|
7156
|
+
requestSearchFocus: () => setSearchFocusRequest((n) => n + 1),
|
|
7068
7157
|
floating,
|
|
7069
7158
|
openMenu,
|
|
7070
7159
|
closeMenu,
|
|
@@ -7104,7 +7193,7 @@ Select.displayName = "Select";
|
|
|
7104
7193
|
var Select_default = Select;
|
|
7105
7194
|
|
|
7106
7195
|
// src/components/Select/SelectOption/SelectOption.tsx
|
|
7107
|
-
var
|
|
7196
|
+
var import_react53 = require("react");
|
|
7108
7197
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
7109
7198
|
var SelectOption = (_a) => {
|
|
7110
7199
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
@@ -7127,7 +7216,7 @@ var SelectOption = (_a) => {
|
|
|
7127
7216
|
"onRemove",
|
|
7128
7217
|
"disabled"
|
|
7129
7218
|
]);
|
|
7130
|
-
const ref = (0,
|
|
7219
|
+
const ref = (0, import_react53.useRef)(null);
|
|
7131
7220
|
const { preventDefault, attachPreventDefault } = usePreventDefault_default();
|
|
7132
7221
|
const {
|
|
7133
7222
|
closeMenuOnSelect,
|
|
@@ -7145,7 +7234,7 @@ var SelectOption = (_a) => {
|
|
|
7145
7234
|
} = useSelect();
|
|
7146
7235
|
const selected = isSelected(value);
|
|
7147
7236
|
const focused = !isNil_default(focusedOption) && isEqual_default(focusedOption == null ? void 0 : focusedOption.value, value);
|
|
7148
|
-
(0,
|
|
7237
|
+
(0, import_react53.useEffect)(() => {
|
|
7149
7238
|
if (!ref.current || !menuScrollContainerRef.current) return;
|
|
7150
7239
|
if ((focusedOption == null ? void 0 : focusedOption.focusType) !== "mouse" && focused) {
|
|
7151
7240
|
const scrollContainer = menuScrollContainerRef.current;
|
|
@@ -7321,7 +7410,7 @@ RHFSelect.displayName = "RHFSelect";
|
|
|
7321
7410
|
var RHFSelect_default = RHFSelect;
|
|
7322
7411
|
|
|
7323
7412
|
// src/components/Tabs/Tabs/Tabs.tsx
|
|
7324
|
-
var
|
|
7413
|
+
var import_react55 = require("react");
|
|
7325
7414
|
|
|
7326
7415
|
// src/components/Tabs/Tabs.utils.ts
|
|
7327
7416
|
var isTab = hasDisplayName("Tab");
|
|
@@ -7338,10 +7427,10 @@ function findTabs(el) {
|
|
|
7338
7427
|
}
|
|
7339
7428
|
|
|
7340
7429
|
// src/components/Tabs/useTabs.tsx
|
|
7341
|
-
var
|
|
7342
|
-
var TabsContext = (0,
|
|
7430
|
+
var import_react54 = require("react");
|
|
7431
|
+
var TabsContext = (0, import_react54.createContext)(void 0);
|
|
7343
7432
|
var useTabs = () => {
|
|
7344
|
-
const context = (0,
|
|
7433
|
+
const context = (0, import_react54.useContext)(TabsContext);
|
|
7345
7434
|
if (context === void 0) {
|
|
7346
7435
|
throw new Error("useTabs must be used within a Tabs");
|
|
7347
7436
|
}
|
|
@@ -7376,14 +7465,14 @@ var Tabs = (_a) => {
|
|
|
7376
7465
|
"className",
|
|
7377
7466
|
"children"
|
|
7378
7467
|
]);
|
|
7379
|
-
const firstEnabled = (0,
|
|
7468
|
+
const firstEnabled = (0, import_react55.useMemo)(
|
|
7380
7469
|
() => {
|
|
7381
7470
|
var _a2;
|
|
7382
7471
|
return (_a2 = findTabs(children).find((tab) => !tab.disabled)) == null ? void 0 : _a2.value;
|
|
7383
7472
|
},
|
|
7384
7473
|
[children]
|
|
7385
7474
|
);
|
|
7386
|
-
const [internalValue, setInternalValue] = (0,
|
|
7475
|
+
const [internalValue, setInternalValue] = (0, import_react55.useState)(defaultValue);
|
|
7387
7476
|
const isControlled = value !== void 0;
|
|
7388
7477
|
const selectedValue = isControlled ? value : internalValue != null ? internalValue : firstEnabled;
|
|
7389
7478
|
const select = (next) => {
|
|
@@ -7413,13 +7502,13 @@ Tabs.displayName = "Tabs";
|
|
|
7413
7502
|
var Tabs_default = Tabs;
|
|
7414
7503
|
|
|
7415
7504
|
// src/components/Tabs/TabList/TabList.tsx
|
|
7416
|
-
var
|
|
7505
|
+
var import_react56 = require("react");
|
|
7417
7506
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
7418
7507
|
var TabList = (_a) => {
|
|
7419
7508
|
var _b = _a, { className, children } = _b, rest = __objRest(_b, ["className", "children"]);
|
|
7420
7509
|
const { selectedValue, isNav, orientation } = useTabs();
|
|
7421
|
-
const listRef = (0,
|
|
7422
|
-
(0,
|
|
7510
|
+
const listRef = (0, import_react56.useRef)(null);
|
|
7511
|
+
(0, import_react56.useEffect)(() => {
|
|
7423
7512
|
const list = listRef.current;
|
|
7424
7513
|
if (!list) return;
|
|
7425
7514
|
const tab = list.querySelector('[data-gecko-tab][data-state="selected"]');
|
|
@@ -7491,7 +7580,7 @@ TabList.displayName = "TabList";
|
|
|
7491
7580
|
var TabList_default = TabList;
|
|
7492
7581
|
|
|
7493
7582
|
// src/components/Tabs/Tab/Tab.tsx
|
|
7494
|
-
var
|
|
7583
|
+
var import_react57 = require("react");
|
|
7495
7584
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
7496
7585
|
var Tab = (_a) => {
|
|
7497
7586
|
var _b = _a, { value, disabled, asChild, className, children } = _b, rest = __objRest(_b, ["value", "disabled", "asChild", "className", "children"]);
|
|
@@ -7513,7 +7602,7 @@ var Tab = (_a) => {
|
|
|
7513
7602
|
});
|
|
7514
7603
|
const child = asChild ? asChildElement(children) : null;
|
|
7515
7604
|
if (child) {
|
|
7516
|
-
return (0,
|
|
7605
|
+
return (0, import_react57.cloneElement)(child, __spreadProps(__spreadValues(__spreadValues({}, tabProps), rest), {
|
|
7517
7606
|
className: classNames(
|
|
7518
7607
|
"GeckoUITabs__tab",
|
|
7519
7608
|
child.props.className,
|
|
@@ -7562,21 +7651,21 @@ TabPanel.displayName = "TabPanel";
|
|
|
7562
7651
|
var TabPanel_default = TabPanel;
|
|
7563
7652
|
|
|
7564
7653
|
// src/components/Accordion/Accordion/Accordion.tsx
|
|
7565
|
-
var
|
|
7654
|
+
var import_react59 = require("react");
|
|
7566
7655
|
|
|
7567
7656
|
// src/components/Accordion/useAccordion.tsx
|
|
7568
|
-
var
|
|
7569
|
-
var AccordionContext = (0,
|
|
7570
|
-
var AccordionItemContext = (0,
|
|
7657
|
+
var import_react58 = require("react");
|
|
7658
|
+
var AccordionContext = (0, import_react58.createContext)(void 0);
|
|
7659
|
+
var AccordionItemContext = (0, import_react58.createContext)(void 0);
|
|
7571
7660
|
var useAccordion = () => {
|
|
7572
|
-
const context = (0,
|
|
7661
|
+
const context = (0, import_react58.useContext)(AccordionContext);
|
|
7573
7662
|
if (context === void 0) {
|
|
7574
7663
|
throw new Error("useAccordion must be used within an Accordion");
|
|
7575
7664
|
}
|
|
7576
7665
|
return context;
|
|
7577
7666
|
};
|
|
7578
7667
|
var useAccordionItem = () => {
|
|
7579
|
-
const context = (0,
|
|
7668
|
+
const context = (0, import_react58.useContext)(AccordionItemContext);
|
|
7580
7669
|
if (context === void 0) {
|
|
7581
7670
|
throw new Error("useAccordionItem must be used within an AccordionItem");
|
|
7582
7671
|
}
|
|
@@ -7613,8 +7702,8 @@ var Accordion = (_a) => {
|
|
|
7613
7702
|
"className",
|
|
7614
7703
|
"children"
|
|
7615
7704
|
]);
|
|
7616
|
-
const rootRef = (0,
|
|
7617
|
-
const [internalValue, setInternalValue] = (0,
|
|
7705
|
+
const rootRef = (0, import_react59.useRef)(null);
|
|
7706
|
+
const [internalValue, setInternalValue] = (0, import_react59.useState)(defaultValue);
|
|
7618
7707
|
const isControlled = value !== void 0;
|
|
7619
7708
|
const openValues = toArray(isControlled ? value : internalValue);
|
|
7620
7709
|
const toggle = (itemValue) => {
|
|
@@ -7809,7 +7898,7 @@ var Alert = (props) => {
|
|
|
7809
7898
|
var Alert_default = Alert;
|
|
7810
7899
|
|
|
7811
7900
|
// src/components/Avatar/Avatar/Avatar.tsx
|
|
7812
|
-
var
|
|
7901
|
+
var import_react61 = require("react");
|
|
7813
7902
|
|
|
7814
7903
|
// src/components/Avatar/Avatar.utils.ts
|
|
7815
7904
|
var initialsFrom = (name) => {
|
|
@@ -7822,9 +7911,9 @@ var initialsFrom = (name) => {
|
|
|
7822
7911
|
};
|
|
7823
7912
|
|
|
7824
7913
|
// src/components/Avatar/useAvatarGroup.tsx
|
|
7825
|
-
var
|
|
7826
|
-
var AvatarGroupContext = (0,
|
|
7827
|
-
var useAvatarGroup = () => (0,
|
|
7914
|
+
var import_react60 = require("react");
|
|
7915
|
+
var AvatarGroupContext = (0, import_react60.createContext)(null);
|
|
7916
|
+
var useAvatarGroup = () => (0, import_react60.useContext)(AvatarGroupContext);
|
|
7828
7917
|
|
|
7829
7918
|
// src/components/Avatar/Avatar/Avatar.tsx
|
|
7830
7919
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
@@ -7838,7 +7927,7 @@ var PersonIcon = () => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("svg", { vi
|
|
|
7838
7927
|
strokeLinejoin: "round"
|
|
7839
7928
|
}
|
|
7840
7929
|
) });
|
|
7841
|
-
var Avatar = (0,
|
|
7930
|
+
var Avatar = (0, import_react61.forwardRef)(
|
|
7842
7931
|
(_a, ref) => {
|
|
7843
7932
|
var _b = _a, {
|
|
7844
7933
|
src,
|
|
@@ -7865,7 +7954,7 @@ var Avatar = (0, import_react60.forwardRef)(
|
|
|
7865
7954
|
]);
|
|
7866
7955
|
var _a2, _b2;
|
|
7867
7956
|
const group = useAvatarGroup();
|
|
7868
|
-
const [failedSrc, setFailedSrc] = (0,
|
|
7957
|
+
const [failedSrc, setFailedSrc] = (0, import_react61.useState)();
|
|
7869
7958
|
const label = alt != null ? alt : name;
|
|
7870
7959
|
const showImage = !!src && failedSrc !== src;
|
|
7871
7960
|
const initials = name ? initialsFrom(name) : "";
|
|
@@ -7909,7 +7998,7 @@ Avatar.displayName = "Avatar";
|
|
|
7909
7998
|
var Avatar_default = Avatar;
|
|
7910
7999
|
|
|
7911
8000
|
// src/components/Avatar/AvatarGroup/AvatarGroup.tsx
|
|
7912
|
-
var
|
|
8001
|
+
var import_react62 = require("react");
|
|
7913
8002
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
7914
8003
|
var NAME_DELAY2 = 150;
|
|
7915
8004
|
var defaultOverflow = ({ avatars }) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("ul", { className: "GeckoUIAvatarGroup__list", children: avatars.map((avatar, index) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("li", { className: "GeckoUIAvatarGroup__list__item", children: [
|
|
@@ -7934,9 +8023,9 @@ var AvatarGroup = (_a) => {
|
|
|
7934
8023
|
"className",
|
|
7935
8024
|
"children"
|
|
7936
8025
|
]);
|
|
7937
|
-
const items =
|
|
8026
|
+
const items = import_react62.Children.toArray(children);
|
|
7938
8027
|
const visible = max && max > 0 ? items.slice(0, max) : items;
|
|
7939
|
-
const avatars = items.slice(visible.length).map((child) => (0,
|
|
8028
|
+
const avatars = items.slice(visible.length).map((child) => (0, import_react62.isValidElement)(child) ? child.props : {});
|
|
7940
8029
|
const chip = avatars.length ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
7941
8030
|
Avatar_default,
|
|
7942
8031
|
{
|
|
@@ -7980,9 +8069,9 @@ AvatarGroup.displayName = "AvatarGroup";
|
|
|
7980
8069
|
var AvatarGroup_default = AvatarGroup;
|
|
7981
8070
|
|
|
7982
8071
|
// src/components/Badge/Badge.tsx
|
|
7983
|
-
var
|
|
8072
|
+
var import_react63 = require("react");
|
|
7984
8073
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
7985
|
-
var Badge = (0,
|
|
8074
|
+
var Badge = (0, import_react63.forwardRef)(
|
|
7986
8075
|
(_a, ref) => {
|
|
7987
8076
|
var _b = _a, {
|
|
7988
8077
|
children,
|
|
@@ -8025,9 +8114,9 @@ Badge.displayName = "Badge";
|
|
|
8025
8114
|
var Badge_default = Badge;
|
|
8026
8115
|
|
|
8027
8116
|
// src/components/Skeleton/Skeleton.tsx
|
|
8028
|
-
var
|
|
8117
|
+
var import_react64 = require("react");
|
|
8029
8118
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
8030
|
-
var Skeleton = (0,
|
|
8119
|
+
var Skeleton = (0, import_react64.forwardRef)(
|
|
8031
8120
|
(_a, ref) => {
|
|
8032
8121
|
var _b = _a, {
|
|
8033
8122
|
shape = "text",
|
|
@@ -8064,13 +8153,13 @@ Skeleton.displayName = "Skeleton";
|
|
|
8064
8153
|
var Skeleton_default = Skeleton;
|
|
8065
8154
|
|
|
8066
8155
|
// src/components/Progress/Progress.tsx
|
|
8067
|
-
var
|
|
8156
|
+
var import_react65 = require("react");
|
|
8068
8157
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
8069
|
-
var Progress = (0,
|
|
8158
|
+
var Progress = (0, import_react65.forwardRef)(
|
|
8070
8159
|
(_a, ref) => {
|
|
8071
8160
|
var _b = _a, { value, max = 100, color = "primary", size: size2 = "md", label, className } = _b, rest = __objRest(_b, ["value", "max", "color", "size", "label", "className"]);
|
|
8072
8161
|
const indeterminate = value === void 0;
|
|
8073
|
-
(0,
|
|
8162
|
+
(0, import_react65.useEffect)(() => {
|
|
8074
8163
|
if (max <= 0) devWarn(`Progress needs a max above 0, but got ${max}.`);
|
|
8075
8164
|
}, [max]);
|
|
8076
8165
|
const clamped = indeterminate || max <= 0 ? 0 : Math.min(Math.max(value, 0), max);
|
|
@@ -8107,13 +8196,13 @@ Progress.displayName = "Progress";
|
|
|
8107
8196
|
var Progress_default = Progress;
|
|
8108
8197
|
|
|
8109
8198
|
// src/components/Breadcrumb/Breadcrumb/Breadcrumb.tsx
|
|
8110
|
-
var
|
|
8111
|
-
var
|
|
8199
|
+
var import_react67 = require("@floating-ui/react");
|
|
8200
|
+
var import_react68 = require("react");
|
|
8112
8201
|
|
|
8113
8202
|
// src/components/Breadcrumb/useBreadcrumb.tsx
|
|
8114
|
-
var
|
|
8115
|
-
var BreadcrumbContext = (0,
|
|
8116
|
-
var useBreadcrumb = () => (0,
|
|
8203
|
+
var import_react66 = require("react");
|
|
8204
|
+
var BreadcrumbContext = (0, import_react66.createContext)({ isLast: false });
|
|
8205
|
+
var useBreadcrumb = () => (0, import_react66.useContext)(BreadcrumbContext);
|
|
8117
8206
|
|
|
8118
8207
|
// src/components/Breadcrumb/Breadcrumb/Breadcrumb.tsx
|
|
8119
8208
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
@@ -8144,20 +8233,20 @@ var Breadcrumb = (_a) => {
|
|
|
8144
8233
|
"menuClassName",
|
|
8145
8234
|
"aria-label"
|
|
8146
8235
|
]);
|
|
8147
|
-
const triggerRef = (0,
|
|
8148
|
-
const menuRef = (0,
|
|
8149
|
-
const [open, setOpen] = (0,
|
|
8150
|
-
const floating = (0,
|
|
8236
|
+
const triggerRef = (0, import_react68.useRef)(null);
|
|
8237
|
+
const menuRef = (0, import_react68.useRef)(null);
|
|
8238
|
+
const [open, setOpen] = (0, import_react68.useState)(false);
|
|
8239
|
+
const floating = (0, import_react67.useFloating)({
|
|
8151
8240
|
placement: menuPlacement,
|
|
8152
|
-
middleware: [(0,
|
|
8153
|
-
whileElementsMounted:
|
|
8241
|
+
middleware: [(0, import_react67.offset)(6), (0, import_react67.flip)({ padding: 8 }), (0, import_react67.shift)({ padding: 8 })],
|
|
8242
|
+
whileElementsMounted: import_react67.autoUpdate,
|
|
8154
8243
|
open,
|
|
8155
8244
|
onOpenChange: setOpen
|
|
8156
8245
|
});
|
|
8157
|
-
useClickOutside_default(() => setOpen(false), [menuRef, triggerRef]);
|
|
8158
|
-
const crumbs =
|
|
8246
|
+
useClickOutside_default(() => setOpen(false), [menuRef, triggerRef], open);
|
|
8247
|
+
const crumbs = import_react68.Children.toArray(children);
|
|
8159
8248
|
const claimed = crumbs.some(
|
|
8160
|
-
(crumb) => (0,
|
|
8249
|
+
(crumb) => (0, import_react68.isValidElement)(crumb) && crumb.props.current
|
|
8161
8250
|
);
|
|
8162
8251
|
const collapsed = maxItems !== void 0 && maxItems > 0 && crumbs.length > maxItems;
|
|
8163
8252
|
const hidden = collapsed ? crumbs.slice(itemsBeforeCollapse, crumbs.length - itemsAfterCollapse) : [];
|
|
@@ -8176,7 +8265,7 @@ var Breadcrumb = (_a) => {
|
|
|
8176
8265
|
children: [
|
|
8177
8266
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("ol", { className: "GeckoUIBreadcrumb__list", children: shown.map((crumb, index) => {
|
|
8178
8267
|
const last = index === shown.length - 1;
|
|
8179
|
-
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
8268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_react68.Fragment, { children: [
|
|
8180
8269
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("li", { className: "GeckoUIBreadcrumb__crumb", children: crumb === "ellipsis" ? (
|
|
8181
8270
|
/*
|
|
8182
8271
|
* A list rather than opening out in place. On a narrow screen unfolding a
|
|
@@ -8235,7 +8324,7 @@ Breadcrumb.displayName = "Breadcrumb";
|
|
|
8235
8324
|
var Breadcrumb_default = Breadcrumb;
|
|
8236
8325
|
|
|
8237
8326
|
// src/components/Breadcrumb/BreadcrumbItem/BreadcrumbItem.tsx
|
|
8238
|
-
var
|
|
8327
|
+
var import_react69 = require("react");
|
|
8239
8328
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
8240
8329
|
var BreadcrumbItem = (_a) => {
|
|
8241
8330
|
var _b = _a, {
|
|
@@ -8264,7 +8353,7 @@ var BreadcrumbItem = (_a) => {
|
|
|
8264
8353
|
if (asChild) {
|
|
8265
8354
|
const child = asChildElement(children);
|
|
8266
8355
|
if (child) {
|
|
8267
|
-
return (0,
|
|
8356
|
+
return (0, import_react69.cloneElement)(child, __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, shared), rest), onClick ? { onClick } : {}), {
|
|
8268
8357
|
className: classNames(classes, child.props.className)
|
|
8269
8358
|
}));
|
|
8270
8359
|
}
|
|
@@ -8287,11 +8376,11 @@ BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
|
8287
8376
|
var BreadcrumbItem_default = BreadcrumbItem;
|
|
8288
8377
|
|
|
8289
8378
|
// src/components/Stepper/Stepper.utils.ts
|
|
8290
|
-
var
|
|
8291
|
-
var stepValuesFrom = (children) =>
|
|
8379
|
+
var import_react70 = require("react");
|
|
8380
|
+
var stepValuesFrom = (children) => import_react70.Children.toArray(children).filter(
|
|
8292
8381
|
(child) => {
|
|
8293
8382
|
var _a;
|
|
8294
|
-
return (0,
|
|
8383
|
+
return (0, import_react70.isValidElement)(child) && ((_a = child.type) == null ? void 0 : _a.displayName) === "Step";
|
|
8295
8384
|
}
|
|
8296
8385
|
).map((child) => child.props.value);
|
|
8297
8386
|
var statusAt = (index, currentIndex) => {
|
|
@@ -8302,10 +8391,10 @@ var statusAt = (index, currentIndex) => {
|
|
|
8302
8391
|
var isReachableAt = (index, currentIndex, linear) => linear ? index <= currentIndex : true;
|
|
8303
8392
|
|
|
8304
8393
|
// src/components/Stepper/useStepper.tsx
|
|
8305
|
-
var
|
|
8306
|
-
var StepperContext = (0,
|
|
8394
|
+
var import_react71 = require("react");
|
|
8395
|
+
var StepperContext = (0, import_react71.createContext)(null);
|
|
8307
8396
|
var useStepper = () => {
|
|
8308
|
-
const context = (0,
|
|
8397
|
+
const context = (0, import_react71.useContext)(StepperContext);
|
|
8309
8398
|
if (!context) throw new Error("Step has to be used inside a <Stepper>.");
|
|
8310
8399
|
return context;
|
|
8311
8400
|
};
|
|
@@ -8530,14 +8619,14 @@ var Pagination = ({ currentPage, totalPages, onChange, className }) => {
|
|
|
8530
8619
|
var Pagination_default = Pagination;
|
|
8531
8620
|
|
|
8532
8621
|
// src/components/Popover/Popover/Popover.tsx
|
|
8533
|
-
var
|
|
8534
|
-
var
|
|
8622
|
+
var import_react73 = require("@floating-ui/react");
|
|
8623
|
+
var import_react74 = require("react");
|
|
8535
8624
|
|
|
8536
8625
|
// src/components/Popover/usePopover.tsx
|
|
8537
|
-
var
|
|
8538
|
-
var PopoverContext = (0,
|
|
8626
|
+
var import_react72 = require("react");
|
|
8627
|
+
var PopoverContext = (0, import_react72.createContext)(void 0);
|
|
8539
8628
|
var usePopover = () => {
|
|
8540
|
-
const context = (0,
|
|
8629
|
+
const context = (0, import_react72.useContext)(PopoverContext);
|
|
8541
8630
|
if (context === void 0) {
|
|
8542
8631
|
throw new Error("usePopover must be used within a Popover");
|
|
8543
8632
|
}
|
|
@@ -8575,10 +8664,10 @@ var Popover = (_a) => {
|
|
|
8575
8664
|
"className",
|
|
8576
8665
|
"children"
|
|
8577
8666
|
]);
|
|
8578
|
-
const arrowRef = (0,
|
|
8579
|
-
const triggerRef = (0,
|
|
8580
|
-
const rootRef = (0,
|
|
8581
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
8667
|
+
const arrowRef = (0, import_react74.useRef)(null);
|
|
8668
|
+
const triggerRef = (0, import_react74.useRef)(null);
|
|
8669
|
+
const rootRef = (0, import_react74.useRef)(null);
|
|
8670
|
+
const [internalOpen, setInternalOpen] = (0, import_react74.useState)(defaultOpen);
|
|
8582
8671
|
const isControlled = controlledOpen !== void 0;
|
|
8583
8672
|
const open = disabled ? false : isControlled ? controlledOpen : internalOpen;
|
|
8584
8673
|
const setOpen = (next) => {
|
|
@@ -8592,27 +8681,29 @@ var Popover = (_a) => {
|
|
|
8592
8681
|
setOpen(false);
|
|
8593
8682
|
(_a2 = triggerRef.current) == null ? void 0 : _a2.focus();
|
|
8594
8683
|
};
|
|
8595
|
-
const floating = (0,
|
|
8684
|
+
const floating = (0, import_react73.useFloating)({
|
|
8596
8685
|
placement,
|
|
8597
8686
|
strategy: floatingStrategy,
|
|
8598
8687
|
middleware: [
|
|
8599
8688
|
// `offset` is the gap between the trigger and the nearest part of the popover. The
|
|
8600
8689
|
// arrow sticks out past the panel edge, so it has to be paid for here or the tip
|
|
8601
8690
|
// lands on the trigger.
|
|
8602
|
-
(0,
|
|
8603
|
-
(0,
|
|
8604
|
-
(0,
|
|
8605
|
-
...arrow2 ? [(0,
|
|
8691
|
+
(0, import_react73.offset)(arrow2 ? offset10 + ARROW_HEIGHT : offset10),
|
|
8692
|
+
(0, import_react73.flip)({ padding: 6 }),
|
|
8693
|
+
(0, import_react73.shift)({ padding: 6 }),
|
|
8694
|
+
...arrow2 ? [(0, import_react73.arrow)({ element: arrowRef })] : []
|
|
8606
8695
|
],
|
|
8607
|
-
whileElementsMounted:
|
|
8696
|
+
whileElementsMounted: import_react73.autoUpdate,
|
|
8608
8697
|
open,
|
|
8609
8698
|
onOpenChange: setOpen
|
|
8610
8699
|
});
|
|
8611
|
-
|
|
8700
|
+
const isTop = useLayer(open);
|
|
8701
|
+
(0, import_react74.useEffect)(() => {
|
|
8612
8702
|
if (!dismissOnOutsideClick || !open) return;
|
|
8613
8703
|
const dismiss = (event) => {
|
|
8614
8704
|
var _a2;
|
|
8615
8705
|
if ((_a2 = rootRef.current) == null ? void 0 : _a2.contains(event.target)) return;
|
|
8706
|
+
if (!isTop()) return;
|
|
8616
8707
|
setOpen(false);
|
|
8617
8708
|
};
|
|
8618
8709
|
document.addEventListener("click", dismiss);
|
|
@@ -8642,6 +8733,7 @@ var Popover = (_a) => {
|
|
|
8642
8733
|
className: classNames("GeckoUIPopover", className),
|
|
8643
8734
|
onKeyDown: (e) => {
|
|
8644
8735
|
if (!dismissOnEscape || !open || e.key !== "Escape") return;
|
|
8736
|
+
if (!isTop()) return;
|
|
8645
8737
|
e.stopPropagation();
|
|
8646
8738
|
close();
|
|
8647
8739
|
}
|
|
@@ -8656,7 +8748,7 @@ Popover.displayName = "Popover";
|
|
|
8656
8748
|
var Popover_default = Popover;
|
|
8657
8749
|
|
|
8658
8750
|
// src/components/Popover/PopoverTrigger/PopoverTrigger.tsx
|
|
8659
|
-
var
|
|
8751
|
+
var import_react75 = require("react");
|
|
8660
8752
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
8661
8753
|
var PopoverTrigger = ({ children }) => {
|
|
8662
8754
|
var _a;
|
|
@@ -8684,21 +8776,21 @@ var PopoverTrigger = ({ children }) => {
|
|
|
8684
8776
|
toggle();
|
|
8685
8777
|
}
|
|
8686
8778
|
};
|
|
8687
|
-
if (child) return (0,
|
|
8779
|
+
if (child) return (0, import_react75.cloneElement)(child, triggerProps);
|
|
8688
8780
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", __spreadProps(__spreadValues({}, triggerProps), { children }));
|
|
8689
8781
|
};
|
|
8690
8782
|
PopoverTrigger.displayName = "PopoverTrigger";
|
|
8691
8783
|
var PopoverTrigger_default = PopoverTrigger;
|
|
8692
8784
|
|
|
8693
8785
|
// src/components/Popover/PopoverContent/PopoverContent.tsx
|
|
8694
|
-
var
|
|
8695
|
-
var
|
|
8786
|
+
var import_react76 = require("@floating-ui/react");
|
|
8787
|
+
var import_react77 = require("react");
|
|
8696
8788
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
8697
8789
|
var PopoverContent = (_a) => {
|
|
8698
8790
|
var _b = _a, { className, children } = _b, rest = __objRest(_b, ["className", "children"]);
|
|
8699
8791
|
const { open, arrow: arrow2, arrowRef, floating } = usePopover();
|
|
8700
|
-
const contentRef = (0,
|
|
8701
|
-
(0,
|
|
8792
|
+
const contentRef = (0, import_react77.useRef)(null);
|
|
8793
|
+
(0, import_react77.useEffect)(() => {
|
|
8702
8794
|
var _a2, _b2;
|
|
8703
8795
|
if (!open) return;
|
|
8704
8796
|
const focusable = (_a2 = contentRef.current) == null ? void 0 : _a2.querySelector(
|
|
@@ -8723,7 +8815,7 @@ var PopoverContent = (_a) => {
|
|
|
8723
8815
|
children: [
|
|
8724
8816
|
children,
|
|
8725
8817
|
arrow2 && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
8726
|
-
|
|
8818
|
+
import_react76.FloatingArrow,
|
|
8727
8819
|
{
|
|
8728
8820
|
ref: arrowRef,
|
|
8729
8821
|
context: floating.context,
|
|
@@ -8739,7 +8831,7 @@ PopoverContent.displayName = "PopoverContent";
|
|
|
8739
8831
|
var PopoverContent_default = PopoverContent;
|
|
8740
8832
|
|
|
8741
8833
|
// src/components/ConfirmDialog/ConfirmDialog.tsx
|
|
8742
|
-
var
|
|
8834
|
+
var import_react79 = require("react");
|
|
8743
8835
|
|
|
8744
8836
|
// src/components/GeckoUIProvider/overlay-store.ts
|
|
8745
8837
|
var OVERLAY_ANIMATION_DURATION = 300;
|
|
@@ -8871,7 +8963,7 @@ var overlayStore = {
|
|
|
8871
8963
|
};
|
|
8872
8964
|
|
|
8873
8965
|
// src/components/Dialog/DialogSurface.tsx
|
|
8874
|
-
var
|
|
8966
|
+
var import_react78 = require("react");
|
|
8875
8967
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
8876
8968
|
function DialogSurface({
|
|
8877
8969
|
open,
|
|
@@ -8885,27 +8977,27 @@ function DialogSurface({
|
|
|
8885
8977
|
onExited,
|
|
8886
8978
|
children
|
|
8887
8979
|
}) {
|
|
8888
|
-
const [animationState, setAnimationState] = (0,
|
|
8980
|
+
const [animationState, setAnimationState] = (0, import_react78.useState)(
|
|
8889
8981
|
open ? "entering" : "closed"
|
|
8890
8982
|
);
|
|
8891
|
-
const rootRef = (0,
|
|
8892
|
-
const backdropRef = (0,
|
|
8893
|
-
const pressedOutside = (0,
|
|
8894
|
-
const onDismissRef = (0,
|
|
8895
|
-
const onExitedRef = (0,
|
|
8983
|
+
const rootRef = (0, import_react78.useRef)(null);
|
|
8984
|
+
const backdropRef = (0, import_react78.useRef)(null);
|
|
8985
|
+
const pressedOutside = (0, import_react78.useRef)(false);
|
|
8986
|
+
const onDismissRef = (0, import_react78.useRef)(onDismiss);
|
|
8987
|
+
const onExitedRef = (0, import_react78.useRef)(onExited);
|
|
8896
8988
|
onDismissRef.current = onDismiss;
|
|
8897
8989
|
onExitedRef.current = onExited;
|
|
8898
|
-
const requestDismiss = (0,
|
|
8990
|
+
const requestDismiss = (0, import_react78.useCallback)(() => {
|
|
8899
8991
|
var _a;
|
|
8900
8992
|
(_a = onDismissRef.current) == null ? void 0 : _a.call(onDismissRef);
|
|
8901
8993
|
}, []);
|
|
8902
|
-
(0,
|
|
8994
|
+
(0, import_react78.useEffect)(() => {
|
|
8903
8995
|
setAnimationState((current) => {
|
|
8904
8996
|
if (open) return current === "open" ? current : "entering";
|
|
8905
8997
|
return current === "closed" ? current : "closing";
|
|
8906
8998
|
});
|
|
8907
8999
|
}, [open]);
|
|
8908
|
-
(0,
|
|
9000
|
+
(0, import_react78.useEffect)(() => {
|
|
8909
9001
|
if (animationState === "entering") {
|
|
8910
9002
|
let innerFrame = 0;
|
|
8911
9003
|
const outerFrame = requestAnimationFrame(() => {
|
|
@@ -8927,7 +9019,11 @@ function DialogSurface({
|
|
|
8927
9019
|
}, [animationState]);
|
|
8928
9020
|
useScrollLock_default(animationState !== "closed");
|
|
8929
9021
|
const canDismiss = open && isTop && animationState !== "closing";
|
|
8930
|
-
|
|
9022
|
+
const isTopLayer2 = useLayer(open);
|
|
9023
|
+
const dismissIfTopLayer = (0, import_react78.useCallback)(() => {
|
|
9024
|
+
if (isTopLayer2()) requestDismiss();
|
|
9025
|
+
}, [isTopLayer2, requestDismiss]);
|
|
9026
|
+
useEscListener_default(canDismiss && dismissOnEscape ? dismissIfTopLayer : void 0);
|
|
8931
9027
|
const isOutside = (target) => target === backdropRef.current || target === rootRef.current;
|
|
8932
9028
|
const handleMouseDown = (event) => {
|
|
8933
9029
|
pressedOutside.current = isOutside(event.target);
|
|
@@ -8935,7 +9031,7 @@ function DialogSurface({
|
|
|
8935
9031
|
const handleMouseUp = (event) => {
|
|
8936
9032
|
const shouldDismiss2 = pressedOutside.current && isOutside(event.target);
|
|
8937
9033
|
pressedOutside.current = false;
|
|
8938
|
-
if (shouldDismiss2 && canDismiss && dismissOnOutsideClick)
|
|
9034
|
+
if (shouldDismiss2 && canDismiss && dismissOnOutsideClick) dismissIfTopLayer();
|
|
8939
9035
|
};
|
|
8940
9036
|
if (animationState === "closed") return null;
|
|
8941
9037
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
@@ -9017,10 +9113,10 @@ function ConfirmDialogContent({
|
|
|
9017
9113
|
onCancel,
|
|
9018
9114
|
isTop = true
|
|
9019
9115
|
}) {
|
|
9020
|
-
const [cancelLoading, setCancelLoading] = (0,
|
|
9021
|
-
const [confirmLoading, setConfirmLoading] = (0,
|
|
9116
|
+
const [cancelLoading, setCancelLoading] = (0, import_react79.useState)(false);
|
|
9117
|
+
const [confirmLoading, setConfirmLoading] = (0, import_react79.useState)(false);
|
|
9022
9118
|
const { preventDefault, attachPreventDefault } = usePreventDefault_default();
|
|
9023
|
-
const handleConfirm = (0,
|
|
9119
|
+
const handleConfirm = (0, import_react79.useCallback)(() => __async(null, null, function* () {
|
|
9024
9120
|
const isAsync = isAsyncFn(onConfirm);
|
|
9025
9121
|
if (isAsync) {
|
|
9026
9122
|
setConfirmLoading(true);
|
|
@@ -9037,7 +9133,7 @@ function ConfirmDialogContent({
|
|
|
9037
9133
|
setCancelLoading(false);
|
|
9038
9134
|
attachPreventDefault(dismiss);
|
|
9039
9135
|
});
|
|
9040
|
-
(0,
|
|
9136
|
+
(0, import_react79.useEffect)(() => {
|
|
9041
9137
|
if (!isTop) return;
|
|
9042
9138
|
const onKeyDown = (e) => {
|
|
9043
9139
|
const el = document.activeElement;
|
|
@@ -9197,11 +9293,11 @@ toast.promise = (promise, messages, options) => {
|
|
|
9197
9293
|
toast.dismiss = (id) => toastStore.dismiss(id);
|
|
9198
9294
|
|
|
9199
9295
|
// src/components/Toast/Toaster.tsx
|
|
9200
|
-
var
|
|
9296
|
+
var import_react81 = require("react");
|
|
9201
9297
|
var import_react_dom = require("react-dom");
|
|
9202
9298
|
|
|
9203
9299
|
// src/components/Toast/ToastItem.tsx
|
|
9204
|
-
var
|
|
9300
|
+
var import_react80 = require("react");
|
|
9205
9301
|
|
|
9206
9302
|
// src/components/Toast/Toast.utils.ts
|
|
9207
9303
|
var swipeDirectionsFor = (position) => ({
|
|
@@ -9271,31 +9367,31 @@ var icons = {
|
|
|
9271
9367
|
function ToastItem({ toast: toast2, defaults, paused, position }) {
|
|
9272
9368
|
var _a, _b, _c, _d;
|
|
9273
9369
|
const { options, message, variant, custom } = toast2;
|
|
9274
|
-
const [state, setState] = (0,
|
|
9370
|
+
const [state, setState] = (0, import_react80.useState)("entering");
|
|
9275
9371
|
const duration = (_a = options.duration) != null ? _a : defaults.duration;
|
|
9276
9372
|
const dismissible = (_c = (_b = options.dismissible) != null ? _b : defaults.dismissible) != null ? _c : true;
|
|
9277
9373
|
const closeButton = (_d = options.closeButton) != null ? _d : defaults.closeButton;
|
|
9278
9374
|
const swipe = swipeDirectionsFor(position);
|
|
9279
|
-
const [offset10, setOffset] = (0,
|
|
9280
|
-
const [axis, setAxis] = (0,
|
|
9281
|
-
const [dragging, setDragging] = (0,
|
|
9282
|
-
const dragFrom = (0,
|
|
9283
|
-
const dragStartedAt = (0,
|
|
9284
|
-
const remaining = (0,
|
|
9285
|
-
const startedAt = (0,
|
|
9286
|
-
const closedBy = (0,
|
|
9287
|
-
const close = (0,
|
|
9375
|
+
const [offset10, setOffset] = (0, import_react80.useState)(0);
|
|
9376
|
+
const [axis, setAxis] = (0, import_react80.useState)(null);
|
|
9377
|
+
const [dragging, setDragging] = (0, import_react80.useState)(false);
|
|
9378
|
+
const dragFrom = (0, import_react80.useRef)({ x: 0, y: 0 });
|
|
9379
|
+
const dragStartedAt = (0, import_react80.useRef)(0);
|
|
9380
|
+
const remaining = (0, import_react80.useRef)(duration);
|
|
9381
|
+
const startedAt = (0, import_react80.useRef)(0);
|
|
9382
|
+
const closedBy = (0, import_react80.useRef)(null);
|
|
9383
|
+
const close = (0, import_react80.useCallback)((reason) => {
|
|
9288
9384
|
if (closedBy.current) return;
|
|
9289
9385
|
closedBy.current = reason;
|
|
9290
9386
|
setState("closing");
|
|
9291
9387
|
}, []);
|
|
9292
|
-
(0,
|
|
9293
|
-
(0,
|
|
9388
|
+
(0, import_react80.useEffect)(() => toastStore.registerDismiss(toast2.id, () => close("manual")), [toast2.id, close]);
|
|
9389
|
+
(0, import_react80.useEffect)(() => {
|
|
9294
9390
|
const raf = requestAnimationFrame(() => setState("open"));
|
|
9295
9391
|
return () => cancelAnimationFrame(raf);
|
|
9296
9392
|
}, []);
|
|
9297
|
-
const generationRef = (0,
|
|
9298
|
-
(0,
|
|
9393
|
+
const generationRef = (0, import_react80.useRef)(toast2.generation);
|
|
9394
|
+
(0, import_react80.useEffect)(() => {
|
|
9299
9395
|
if (generationRef.current !== toast2.generation) {
|
|
9300
9396
|
generationRef.current = toast2.generation;
|
|
9301
9397
|
remaining.current = duration;
|
|
@@ -9468,13 +9564,13 @@ function Toaster(_a) {
|
|
|
9468
9564
|
"offset",
|
|
9469
9565
|
"className"
|
|
9470
9566
|
]);
|
|
9471
|
-
const isMounted = (0,
|
|
9472
|
-
const toasts2 = (0,
|
|
9567
|
+
const isMounted = (0, import_react81.useSyncExternalStore)(subscribeNever, mounted, notMounted);
|
|
9568
|
+
const toasts2 = (0, import_react81.useSyncExternalStore)(
|
|
9473
9569
|
toastStore.subscribe,
|
|
9474
9570
|
toastStore.getSnapshot,
|
|
9475
9571
|
toastStore.getServerSnapshot
|
|
9476
9572
|
);
|
|
9477
|
-
const [pausedRegion, setPausedRegion] = (0,
|
|
9573
|
+
const [pausedRegion, setPausedRegion] = (0, import_react81.useState)(null);
|
|
9478
9574
|
if (!isMounted || toasts2.length === 0) return null;
|
|
9479
9575
|
const defaults = __spreadValues({ duration, closeButton, dismissible }, rest);
|
|
9480
9576
|
return (0, import_react_dom.createPortal)(
|
|
@@ -9513,11 +9609,11 @@ function Toaster(_a) {
|
|
|
9513
9609
|
}
|
|
9514
9610
|
|
|
9515
9611
|
// src/components/GeckoUIProvider/GeckoUIProvider.tsx
|
|
9516
|
-
var
|
|
9612
|
+
var import_react83 = require("react");
|
|
9517
9613
|
var import_react_dom2 = require("react-dom");
|
|
9518
9614
|
|
|
9519
9615
|
// src/components/Drawer/Drawer.tsx
|
|
9520
|
-
var
|
|
9616
|
+
var import_react82 = require("react");
|
|
9521
9617
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
9522
9618
|
function Drawer({
|
|
9523
9619
|
open = false,
|
|
@@ -9532,38 +9628,42 @@ function Drawer({
|
|
|
9532
9628
|
keepMounted = false,
|
|
9533
9629
|
style
|
|
9534
9630
|
}) {
|
|
9535
|
-
const drawerRef = (0,
|
|
9536
|
-
const [readyFor, setReadyFor] = (0,
|
|
9537
|
-
(0,
|
|
9631
|
+
const drawerRef = (0, import_react82.useRef)(null);
|
|
9632
|
+
const [readyFor, setReadyFor] = (0, import_react82.useState)(null);
|
|
9633
|
+
(0, import_react82.useEffect)(() => {
|
|
9538
9634
|
const frame = requestAnimationFrame(() => setReadyFor(placement));
|
|
9539
9635
|
return () => cancelAnimationFrame(frame);
|
|
9540
9636
|
}, [placement]);
|
|
9541
9637
|
const ready = readyFor === placement;
|
|
9542
9638
|
const visible = open && ready;
|
|
9543
|
-
const [closing, setClosing] = (0,
|
|
9544
|
-
const [prevOpen, setPrevOpen] = (0,
|
|
9639
|
+
const [closing, setClosing] = (0, import_react82.useState)(false);
|
|
9640
|
+
const [prevOpen, setPrevOpen] = (0, import_react82.useState)(open);
|
|
9545
9641
|
if (prevOpen !== open) {
|
|
9546
9642
|
setPrevOpen(open);
|
|
9547
9643
|
setClosing(!open);
|
|
9548
9644
|
}
|
|
9549
|
-
(0,
|
|
9645
|
+
(0, import_react82.useEffect)(() => {
|
|
9550
9646
|
if (!closing) return;
|
|
9551
9647
|
const timer = setTimeout(() => setClosing(false), OVERLAY_ANIMATION_DURATION);
|
|
9552
9648
|
return () => clearTimeout(timer);
|
|
9553
9649
|
}, [closing]);
|
|
9554
|
-
const onCloseRef = (0,
|
|
9650
|
+
const onCloseRef = (0, import_react82.useRef)(onClose);
|
|
9555
9651
|
onCloseRef.current = onClose;
|
|
9556
|
-
const
|
|
9652
|
+
const isTop = useLayer(open);
|
|
9653
|
+
const handleDismiss = (0, import_react82.useCallback)(() => {
|
|
9557
9654
|
var _a;
|
|
9558
9655
|
(_a = onCloseRef.current) == null ? void 0 : _a.call(onCloseRef);
|
|
9559
9656
|
}, []);
|
|
9560
|
-
const
|
|
9657
|
+
const dismissIfTop = (0, import_react82.useCallback)(() => {
|
|
9658
|
+
if (isTop()) handleDismiss();
|
|
9659
|
+
}, [isTop, handleDismiss]);
|
|
9660
|
+
const dismissOnClickOutside = (0, import_react82.useCallback)(() => {
|
|
9561
9661
|
if (!allowClickOutside || !open) return;
|
|
9562
|
-
|
|
9563
|
-
}, [allowClickOutside, open,
|
|
9662
|
+
dismissIfTop();
|
|
9663
|
+
}, [allowClickOutside, open, dismissIfTop]);
|
|
9564
9664
|
useClickOutside_default(dismissOnClickOutside, [drawerRef]);
|
|
9565
9665
|
useScrollLock_default((open || closing) && !allowClickOutside);
|
|
9566
|
-
useEscListener_default(open && dismissOnEscape ?
|
|
9666
|
+
useEscListener_default(open && dismissOnEscape ? dismissIfTop : void 0);
|
|
9567
9667
|
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "GeckoUIDrawer", style, children: [
|
|
9568
9668
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
9569
9669
|
"div",
|
|
@@ -9571,7 +9671,7 @@ function Drawer({
|
|
|
9571
9671
|
"data-state": visible && !hideBackdrop ? "visible" : "hidden",
|
|
9572
9672
|
"data-clickthrough": allowClickOutside || void 0,
|
|
9573
9673
|
className: classNames("GeckoUIDrawer__backdrop", backdropClassName),
|
|
9574
|
-
onMouseDown: open ?
|
|
9674
|
+
onMouseDown: open ? dismissIfTop : void 0,
|
|
9575
9675
|
role: "presentation"
|
|
9576
9676
|
}
|
|
9577
9677
|
),
|
|
@@ -9591,7 +9691,7 @@ function Drawer({
|
|
|
9591
9691
|
)
|
|
9592
9692
|
] });
|
|
9593
9693
|
}
|
|
9594
|
-
var INERT_IS_BOOLEAN = Number(
|
|
9694
|
+
var INERT_IS_BOOLEAN = Number(import_react82.version.split(".")[0]) >= 19;
|
|
9595
9695
|
function inertProps(inert) {
|
|
9596
9696
|
if (INERT_IS_BOOLEAN) return { inert };
|
|
9597
9697
|
return inert ? { inert: "" } : {};
|
|
@@ -9613,14 +9713,14 @@ var emptySubscribe = () => () => {
|
|
|
9613
9713
|
var getNoHost = () => null;
|
|
9614
9714
|
var getMounted = () => true;
|
|
9615
9715
|
var getNotMounted = () => false;
|
|
9616
|
-
var useIsMounted = () => (0,
|
|
9716
|
+
var useIsMounted = () => (0, import_react83.useSyncExternalStore)(emptySubscribe, getMounted, getNotMounted);
|
|
9617
9717
|
function useOverlayEntry(id) {
|
|
9618
|
-
const [open, setOpen] = (0,
|
|
9619
|
-
const close = (0,
|
|
9718
|
+
const [open, setOpen] = (0, import_react83.useState)(true);
|
|
9719
|
+
const close = (0, import_react83.useCallback)(() => {
|
|
9620
9720
|
setOpen(false);
|
|
9621
9721
|
overlayStore.markClosing(id);
|
|
9622
9722
|
}, [id]);
|
|
9623
|
-
const handleExited = (0,
|
|
9723
|
+
const handleExited = (0, import_react83.useCallback)(() => {
|
|
9624
9724
|
overlayStore.remove(id);
|
|
9625
9725
|
}, [id]);
|
|
9626
9726
|
return { open, close, handleExited };
|
|
@@ -9638,7 +9738,7 @@ function DialogEntryRenderer({ id, options, isTop, zIndex }) {
|
|
|
9638
9738
|
"dismissOnOutsideClick"
|
|
9639
9739
|
]);
|
|
9640
9740
|
const { open, close, handleExited } = useOverlayEntry(id);
|
|
9641
|
-
(0,
|
|
9741
|
+
(0, import_react83.useEffect)(() => overlayStore.registerDismiss(id, close), [id, close]);
|
|
9642
9742
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
9643
9743
|
DialogSurface,
|
|
9644
9744
|
{
|
|
@@ -9663,15 +9763,15 @@ function DrawerEntryRenderer({
|
|
|
9663
9763
|
zIndex
|
|
9664
9764
|
}) {
|
|
9665
9765
|
const { open, close, handleExited } = useOverlayEntry(id);
|
|
9666
|
-
const onCloseRef = (0,
|
|
9766
|
+
const onCloseRef = (0, import_react83.useRef)(options.onClose);
|
|
9667
9767
|
onCloseRef.current = options.onClose;
|
|
9668
|
-
const handleClose = (0,
|
|
9768
|
+
const handleClose = (0, import_react83.useCallback)(() => {
|
|
9669
9769
|
var _a;
|
|
9670
9770
|
(_a = onCloseRef.current) == null ? void 0 : _a.call(onCloseRef);
|
|
9671
9771
|
close();
|
|
9672
9772
|
}, [close]);
|
|
9673
|
-
(0,
|
|
9674
|
-
(0,
|
|
9773
|
+
(0, import_react83.useEffect)(() => overlayStore.registerDismiss(id, handleClose), [id, handleClose]);
|
|
9774
|
+
(0, import_react83.useEffect)(() => {
|
|
9675
9775
|
if (open) return;
|
|
9676
9776
|
const timer = setTimeout(handleExited, OVERLAY_ANIMATION_DURATION);
|
|
9677
9777
|
return () => clearTimeout(timer);
|
|
@@ -9700,14 +9800,14 @@ function OverlayEntryRenderer({
|
|
|
9700
9800
|
}
|
|
9701
9801
|
function GeckoUIProvider({ children, toastOptions = {} }) {
|
|
9702
9802
|
const mounted2 = useIsMounted();
|
|
9703
|
-
const [hostId] = (0,
|
|
9704
|
-
(0,
|
|
9705
|
-
const activeHost2 = (0,
|
|
9803
|
+
const [hostId] = (0, import_react83.useState)(() => overlayStore.createHostId());
|
|
9804
|
+
(0, import_react83.useEffect)(() => overlayStore.registerHost(hostId), [hostId]);
|
|
9805
|
+
const activeHost2 = (0, import_react83.useSyncExternalStore)(
|
|
9706
9806
|
overlayStore.subscribe,
|
|
9707
9807
|
overlayStore.getActiveHost,
|
|
9708
9808
|
getNoHost
|
|
9709
9809
|
);
|
|
9710
|
-
const entries2 = (0,
|
|
9810
|
+
const entries2 = (0, import_react83.useSyncExternalStore)(
|
|
9711
9811
|
overlayStore.subscribe,
|
|
9712
9812
|
overlayStore.getSnapshot,
|
|
9713
9813
|
overlayStore.getServerSnapshot
|
|
@@ -9735,17 +9835,17 @@ function GeckoUIProvider({ children, toastOptions = {} }) {
|
|
|
9735
9835
|
}
|
|
9736
9836
|
|
|
9737
9837
|
// src/components/Menu/Menu/Menu.tsx
|
|
9738
|
-
var
|
|
9739
|
-
var
|
|
9838
|
+
var import_react87 = require("@floating-ui/react");
|
|
9839
|
+
var import_react88 = require("react");
|
|
9740
9840
|
|
|
9741
9841
|
// src/components/Menu/Menu.utils.ts
|
|
9742
|
-
var
|
|
9842
|
+
var import_react85 = require("react");
|
|
9743
9843
|
|
|
9744
9844
|
// src/components/Menu/useMenu.tsx
|
|
9745
|
-
var
|
|
9746
|
-
var MenuContext = (0,
|
|
9845
|
+
var import_react84 = require("react");
|
|
9846
|
+
var MenuContext = (0, import_react84.createContext)(void 0);
|
|
9747
9847
|
var useMenu = () => {
|
|
9748
|
-
const context = (0,
|
|
9848
|
+
const context = (0, import_react84.useContext)(MenuContext);
|
|
9749
9849
|
if (context === void 0) {
|
|
9750
9850
|
throw new Error("useMenu must be used within a Menu");
|
|
9751
9851
|
}
|
|
@@ -9762,7 +9862,7 @@ var MenuTrigger_default = MenuTrigger;
|
|
|
9762
9862
|
|
|
9763
9863
|
// src/components/Menu/Menu.utils.ts
|
|
9764
9864
|
function isMenuTrigger(child) {
|
|
9765
|
-
return (0,
|
|
9865
|
+
return (0, import_react85.isValidElement)(child) && child.type === MenuTrigger_default;
|
|
9766
9866
|
}
|
|
9767
9867
|
|
|
9768
9868
|
// src/components/Menu/MenuButton/MenuButton.tsx
|
|
@@ -9797,7 +9897,7 @@ MenuButton.displayName = "MenuButton";
|
|
|
9797
9897
|
var MenuButton_default = MenuButton;
|
|
9798
9898
|
|
|
9799
9899
|
// src/components/Menu/MenuPanel/MenuPanel.tsx
|
|
9800
|
-
var
|
|
9900
|
+
var import_react86 = require("react");
|
|
9801
9901
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
9802
9902
|
var MenuPanel = ({ children, className }) => {
|
|
9803
9903
|
const {
|
|
@@ -9807,8 +9907,8 @@ var MenuPanel = ({ children, className }) => {
|
|
|
9807
9907
|
menuRef,
|
|
9808
9908
|
floating: { refs, floatingStyles }
|
|
9809
9909
|
} = useMenu();
|
|
9810
|
-
const panelRef = (0,
|
|
9811
|
-
(0,
|
|
9910
|
+
const panelRef = (0, import_react86.useRef)(null);
|
|
9911
|
+
(0, import_react86.useEffect)(() => {
|
|
9812
9912
|
if (!open || !panelRef.current) return;
|
|
9813
9913
|
panelRef.current.focus();
|
|
9814
9914
|
}, [open]);
|
|
@@ -9872,35 +9972,39 @@ var Menu = ({
|
|
|
9872
9972
|
buttonClassName,
|
|
9873
9973
|
children
|
|
9874
9974
|
}) => {
|
|
9875
|
-
const menuRef = (0,
|
|
9876
|
-
const [open, setOpen] = (0,
|
|
9877
|
-
const floating = (0,
|
|
9975
|
+
const menuRef = (0, import_react88.useRef)(null);
|
|
9976
|
+
const [open, setOpen] = (0, import_react88.useState)(false);
|
|
9977
|
+
const floating = (0, import_react87.useFloating)({
|
|
9878
9978
|
placement,
|
|
9879
9979
|
strategy: floatingStrategy,
|
|
9880
|
-
middleware: [(0,
|
|
9881
|
-
whileElementsMounted:
|
|
9980
|
+
middleware: [(0, import_react87.flip)({ padding: 6 }), (0, import_react87.offset)({ mainAxis: 6 })],
|
|
9981
|
+
whileElementsMounted: import_react87.autoUpdate,
|
|
9882
9982
|
open,
|
|
9883
9983
|
onOpenChange: setOpen
|
|
9884
9984
|
});
|
|
9885
9985
|
const { refs } = floating;
|
|
9886
|
-
const openMenu = (0,
|
|
9986
|
+
const openMenu = (0, import_react88.useCallback)(() => {
|
|
9887
9987
|
if (disabled || open) return;
|
|
9888
9988
|
setOpen(true);
|
|
9889
9989
|
}, [disabled, open]);
|
|
9890
|
-
const closeMenu = (0,
|
|
9990
|
+
const closeMenu = (0, import_react88.useCallback)(() => {
|
|
9891
9991
|
setOpen(false);
|
|
9892
9992
|
}, []);
|
|
9893
|
-
const toggleMenu = (0,
|
|
9993
|
+
const toggleMenu = (0, import_react88.useCallback)(() => {
|
|
9894
9994
|
if (open) {
|
|
9895
9995
|
closeMenu();
|
|
9896
9996
|
} else {
|
|
9897
9997
|
openMenu();
|
|
9898
9998
|
}
|
|
9899
9999
|
}, [open, openMenu, closeMenu]);
|
|
9900
|
-
useClickOutside_default(
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
10000
|
+
useClickOutside_default(
|
|
10001
|
+
() => {
|
|
10002
|
+
closeMenu();
|
|
10003
|
+
},
|
|
10004
|
+
[refs.reference],
|
|
10005
|
+
open
|
|
10006
|
+
);
|
|
10007
|
+
const childArray = import_react88.Children.toArray(children);
|
|
9904
10008
|
const trigger = childArray.find(isMenuTrigger);
|
|
9905
10009
|
const menuItems = childArray.filter((el) => !isMenuTrigger(el));
|
|
9906
10010
|
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|