@geckoui/geckoui 2.0.5 → 2.0.6
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/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -55,7 +55,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
55
55
|
var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
|
|
56
56
|
|
|
57
57
|
// src/hooks/useClickOutside.ts
|
|
58
|
-
import { useEffect, useRef } from "react";
|
|
58
|
+
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
59
59
|
|
|
60
60
|
// src/utils/isInsideShadowDom.ts
|
|
61
61
|
function isInsideShadowDOM(node) {
|
|
@@ -65,14 +65,61 @@ function isInsideShadowDOM(node) {
|
|
|
65
65
|
return rootNode instanceof ShadowRoot;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
// src/utils/layerStack.ts
|
|
69
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
70
|
+
var stack = [];
|
|
71
|
+
var topAtGesture;
|
|
72
|
+
var gestureActive = false;
|
|
73
|
+
var listening = false;
|
|
74
|
+
function startGesture() {
|
|
75
|
+
topAtGesture = stack[stack.length - 1];
|
|
76
|
+
gestureActive = true;
|
|
77
|
+
}
|
|
78
|
+
function endGesture() {
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
gestureActive = false;
|
|
81
|
+
topAtGesture = void 0;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function listen() {
|
|
85
|
+
if (listening || typeof window === "undefined") return;
|
|
86
|
+
listening = true;
|
|
87
|
+
for (const type of ["pointerdown", "touchstart", "keydown"]) {
|
|
88
|
+
window.addEventListener(type, startGesture, true);
|
|
89
|
+
}
|
|
90
|
+
for (const type of ["click", "keyup", "pointercancel"]) {
|
|
91
|
+
window.addEventListener(type, endGesture, true);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function isTopLayer(layer) {
|
|
95
|
+
return (gestureActive ? topAtGesture : stack[stack.length - 1]) === layer;
|
|
96
|
+
}
|
|
97
|
+
function useLayer(active) {
|
|
98
|
+
const layer = useRef({}).current;
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (!active) return;
|
|
101
|
+
listen();
|
|
102
|
+
stack.push(layer);
|
|
103
|
+
return () => {
|
|
104
|
+
const index = stack.lastIndexOf(layer);
|
|
105
|
+
if (index !== -1) stack.splice(index, 1);
|
|
106
|
+
};
|
|
107
|
+
}, [active, layer]);
|
|
108
|
+
return useCallback(() => isTopLayer(layer), [layer]);
|
|
109
|
+
}
|
|
110
|
+
|
|
68
111
|
// src/hooks/useClickOutside.ts
|
|
69
|
-
var useClickOutside = (handler, refs) => {
|
|
70
|
-
const
|
|
71
|
-
const
|
|
112
|
+
var useClickOutside = (handler, refs, open) => {
|
|
113
|
+
const isTop = useLayer(!!open);
|
|
114
|
+
const layered = open !== void 0;
|
|
115
|
+
const layeredRef = useRef2(layered);
|
|
116
|
+
layeredRef.current = layered;
|
|
117
|
+
const handlerRef = useRef2(handler);
|
|
118
|
+
const refsRef = useRef2(refs);
|
|
72
119
|
handlerRef.current = handler;
|
|
73
120
|
refsRef.current = refs;
|
|
74
121
|
const enabled = !!handler && !!refs && refs.length > 0;
|
|
75
|
-
|
|
122
|
+
useEffect2(() => {
|
|
76
123
|
if (!enabled) return;
|
|
77
124
|
const listener = (event) => {
|
|
78
125
|
var _a, _b, _c;
|
|
@@ -85,6 +132,7 @@ var useClickOutside = (handler, refs) => {
|
|
|
85
132
|
})) {
|
|
86
133
|
return;
|
|
87
134
|
}
|
|
135
|
+
if (layeredRef.current && !isTop()) return;
|
|
88
136
|
(_c = handlerRef.current) == null ? void 0 : _c.call(handlerRef, event);
|
|
89
137
|
};
|
|
90
138
|
document.addEventListener("mousedown", listener, true);
|
|
@@ -93,12 +141,12 @@ var useClickOutside = (handler, refs) => {
|
|
|
93
141
|
document.removeEventListener("mousedown", listener, true);
|
|
94
142
|
document.removeEventListener("touchstart", listener, true);
|
|
95
143
|
};
|
|
96
|
-
}, [enabled]);
|
|
144
|
+
}, [enabled, isTop]);
|
|
97
145
|
};
|
|
98
146
|
var useClickOutside_default = useClickOutside;
|
|
99
147
|
|
|
100
148
|
// src/hooks/useFilePicker.ts
|
|
101
|
-
import { useCallback, useEffect as
|
|
149
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef4, useState } from "react";
|
|
102
150
|
|
|
103
151
|
// src/utils/isNil.ts
|
|
104
152
|
var isNil = (value) => {
|
|
@@ -492,11 +540,11 @@ var FilePicker = (() => {
|
|
|
492
540
|
var FilePicker_default = FilePicker;
|
|
493
541
|
|
|
494
542
|
// src/hooks/useRevokedPreviews.ts
|
|
495
|
-
import { useEffect as
|
|
543
|
+
import { useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
496
544
|
var useRevokedPreviews = (previews) => {
|
|
497
|
-
const held =
|
|
498
|
-
const inherited =
|
|
499
|
-
|
|
545
|
+
const held = useRef3(/* @__PURE__ */ new Set());
|
|
546
|
+
const inherited = useRef3(null);
|
|
547
|
+
useEffect3(() => {
|
|
500
548
|
const current = new Set(previews.filter((preview) => Boolean(preview)));
|
|
501
549
|
if (inherited.current === null) inherited.current = current;
|
|
502
550
|
held.current.forEach((preview) => {
|
|
@@ -504,7 +552,7 @@ var useRevokedPreviews = (previews) => {
|
|
|
504
552
|
});
|
|
505
553
|
held.current = current;
|
|
506
554
|
});
|
|
507
|
-
|
|
555
|
+
useEffect3(
|
|
508
556
|
() => () => {
|
|
509
557
|
held.current.forEach((preview) => {
|
|
510
558
|
var _a;
|
|
@@ -531,11 +579,11 @@ function useFilePicker(options) {
|
|
|
531
579
|
disabled = false,
|
|
532
580
|
multiple = true
|
|
533
581
|
} = options || {};
|
|
534
|
-
const dropzoneRef =
|
|
582
|
+
const dropzoneRef = useRef4(null);
|
|
535
583
|
const [loading, setLoading] = useState(false);
|
|
536
584
|
const [dragging, setDragging] = useState(false);
|
|
537
585
|
useRevokedPreviews_default(files.map((file) => file.preview));
|
|
538
|
-
const handleOnChange =
|
|
586
|
+
const handleOnChange = useCallback2(
|
|
539
587
|
(res) => __async(null, null, function* () {
|
|
540
588
|
const transformedRes = transform ? yield transform(res) : res;
|
|
541
589
|
const _result = keepOldFiles ? [...files].concat(transformedRes) : transformedRes;
|
|
@@ -565,7 +613,7 @@ function useFilePicker(options) {
|
|
|
565
613
|
setLoading(() => false);
|
|
566
614
|
}
|
|
567
615
|
});
|
|
568
|
-
|
|
616
|
+
useEffect4(() => {
|
|
569
617
|
const el = dropzoneRef.current;
|
|
570
618
|
if (!el || disabled) return;
|
|
571
619
|
const handleDragOver = (e) => {
|
|
@@ -632,9 +680,9 @@ function useFilePicker(options) {
|
|
|
632
680
|
var useFilePicker_default = useFilePicker;
|
|
633
681
|
|
|
634
682
|
// src/hooks/usePreventDefault.ts
|
|
635
|
-
import { useRef as
|
|
683
|
+
import { useRef as useRef5 } from "react";
|
|
636
684
|
var usePreventDefault = () => {
|
|
637
|
-
const preventAction =
|
|
685
|
+
const preventAction = useRef5(false);
|
|
638
686
|
const preventDefault = () => preventAction.current = true;
|
|
639
687
|
const attachPreventDefault = (fn) => __async(null, null, function* () {
|
|
640
688
|
if (preventAction.current) {
|
|
@@ -648,9 +696,9 @@ var usePreventDefault = () => {
|
|
|
648
696
|
var usePreventDefault_default = usePreventDefault;
|
|
649
697
|
|
|
650
698
|
// src/hooks/useEscListener.ts
|
|
651
|
-
import { useEffect as
|
|
699
|
+
import { useEffect as useEffect5 } from "react";
|
|
652
700
|
var useEscListener = (callback) => {
|
|
653
|
-
|
|
701
|
+
useEffect5(() => {
|
|
654
702
|
if (!callback) return;
|
|
655
703
|
const dismissListener = (e) => {
|
|
656
704
|
const node = e.target;
|
|
@@ -669,7 +717,7 @@ var useEscListener = (callback) => {
|
|
|
669
717
|
var useEscListener_default = useEscListener;
|
|
670
718
|
|
|
671
719
|
// src/hooks/useScrollLock.ts
|
|
672
|
-
import { useEffect as
|
|
720
|
+
import { useEffect as useEffect6 } from "react";
|
|
673
721
|
var lockCount = 0;
|
|
674
722
|
var previousOverflow = "";
|
|
675
723
|
var previousPaddingRight = "";
|
|
@@ -696,7 +744,7 @@ function unlockBodyScroll() {
|
|
|
696
744
|
documentElement.style.removeProperty(SCROLLBAR_VARIABLE);
|
|
697
745
|
}
|
|
698
746
|
var useScrollLock = (enabled) => {
|
|
699
|
-
|
|
747
|
+
useEffect6(() => {
|
|
700
748
|
if (!enabled) return;
|
|
701
749
|
lockBodyScroll();
|
|
702
750
|
return unlockBodyScroll;
|
|
@@ -705,7 +753,7 @@ var useScrollLock = (enabled) => {
|
|
|
705
753
|
var useScrollLock_default = useScrollLock;
|
|
706
754
|
|
|
707
755
|
// src/components/Checkbox/Checkbox.tsx
|
|
708
|
-
import { forwardRef, useCallback as
|
|
756
|
+
import { forwardRef, useCallback as useCallback3, useEffect as useEffect7, useId, useRef as useRef6 } from "react";
|
|
709
757
|
|
|
710
758
|
// src/icons/CheckIcon.tsx
|
|
711
759
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -810,8 +858,8 @@ var Checkbox = forwardRef(
|
|
|
810
858
|
(_a, ref) => {
|
|
811
859
|
var _b = _a, { id, disabled, className, checked, indeterminate } = _b, rest = __objRest(_b, ["id", "disabled", "className", "checked", "indeterminate"]);
|
|
812
860
|
const _id = useId();
|
|
813
|
-
const innerRef =
|
|
814
|
-
const setRefs =
|
|
861
|
+
const innerRef = useRef6(null);
|
|
862
|
+
const setRefs = useCallback3(
|
|
815
863
|
(node) => {
|
|
816
864
|
innerRef.current = node;
|
|
817
865
|
if (typeof ref === "function") ref(node);
|
|
@@ -819,7 +867,7 @@ var Checkbox = forwardRef(
|
|
|
819
867
|
},
|
|
820
868
|
[ref]
|
|
821
869
|
);
|
|
822
|
-
|
|
870
|
+
useEffect7(() => {
|
|
823
871
|
if (innerRef.current) innerRef.current.indeterminate = Boolean(indeterminate);
|
|
824
872
|
});
|
|
825
873
|
const Icon = indeterminate ? IndeterminateIcon_default : CheckIcon_default;
|
|
@@ -975,10 +1023,10 @@ var CounterInput_default = CounterInput;
|
|
|
975
1023
|
|
|
976
1024
|
// src/components/DateInput/DateInput.tsx
|
|
977
1025
|
import { autoUpdate, flip, offset, useFloating } from "@floating-ui/react";
|
|
978
|
-
import { useCallback as
|
|
1026
|
+
import { useCallback as useCallback4, useRef as useRef8, useState as useState5 } from "react";
|
|
979
1027
|
|
|
980
1028
|
// src/components/BaseDateInput/BaseDateInput.tsx
|
|
981
|
-
import { Fragment, useEffect as
|
|
1029
|
+
import { Fragment, useEffect as useEffect8, useRef as useRef7, useState as useState2 } from "react";
|
|
982
1030
|
|
|
983
1031
|
// src/components/DynamicComponentRenderer/DynamicComponentRenderer.tsx
|
|
984
1032
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
@@ -1079,10 +1127,10 @@ var BaseDateInput = ({
|
|
|
1079
1127
|
hasFocus,
|
|
1080
1128
|
"aria-invalid": invalid
|
|
1081
1129
|
}) => {
|
|
1082
|
-
const containerRef =
|
|
1083
|
-
const monthRef =
|
|
1084
|
-
const dayRef =
|
|
1085
|
-
const yearRef =
|
|
1130
|
+
const containerRef = useRef7(null);
|
|
1131
|
+
const monthRef = useRef7(null);
|
|
1132
|
+
const dayRef = useRef7(null);
|
|
1133
|
+
const yearRef = useRef7(null);
|
|
1086
1134
|
const [month, setMonth] = useState2("");
|
|
1087
1135
|
const [day, setDay] = useState2("");
|
|
1088
1136
|
const [year, setYear] = useState2("");
|
|
@@ -1241,7 +1289,7 @@ var BaseDateInput = ({
|
|
|
1241
1289
|
onSubmit == null ? void 0 : onSubmit();
|
|
1242
1290
|
clearFocus();
|
|
1243
1291
|
};
|
|
1244
|
-
|
|
1292
|
+
useEffect8(() => {
|
|
1245
1293
|
const now = Date.now();
|
|
1246
1294
|
const timeSinceLastUpdate = now - lastUpdatedTime;
|
|
1247
1295
|
if (timeSinceLastUpdate > 500) {
|
|
@@ -1351,7 +1399,7 @@ BaseDateInput.displayName = "BaseDateInput";
|
|
|
1351
1399
|
var BaseDateInput_default = BaseDateInput;
|
|
1352
1400
|
|
|
1353
1401
|
// src/components/Calendar/Calendar/Calendar.tsx
|
|
1354
|
-
import { useEffect as
|
|
1402
|
+
import { useEffect as useEffect9, useImperativeHandle, useState as useState4 } from "react";
|
|
1355
1403
|
|
|
1356
1404
|
// src/components/Calendar/Calendar.utils.ts
|
|
1357
1405
|
function daysInMonth(month, year) {
|
|
@@ -1731,7 +1779,7 @@ var Calendar = (props) => {
|
|
|
1731
1779
|
clearSelection
|
|
1732
1780
|
};
|
|
1733
1781
|
});
|
|
1734
|
-
|
|
1782
|
+
useEffect9(() => {
|
|
1735
1783
|
if (mode === "single") {
|
|
1736
1784
|
if (selectedDate && !isValidISOFormat(selectedDate)) {
|
|
1737
1785
|
devWarn(
|
|
@@ -1907,7 +1955,7 @@ var DateInput = (_a) => {
|
|
|
1907
1955
|
"onStateUpdate",
|
|
1908
1956
|
"onSubmit"
|
|
1909
1957
|
]);
|
|
1910
|
-
const calendarRef =
|
|
1958
|
+
const calendarRef = useRef8(null);
|
|
1911
1959
|
const [openCalendar, setOpenCalendar] = useState5(false);
|
|
1912
1960
|
const { refs, floatingStyles } = useFloating({
|
|
1913
1961
|
placement: calendarPlacement,
|
|
@@ -1917,10 +1965,14 @@ var DateInput = (_a) => {
|
|
|
1917
1965
|
open: openCalendar,
|
|
1918
1966
|
onOpenChange: setOpenCalendar
|
|
1919
1967
|
});
|
|
1920
|
-
useClickOutside_default(
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1968
|
+
useClickOutside_default(
|
|
1969
|
+
() => {
|
|
1970
|
+
setOpenCalendar(false);
|
|
1971
|
+
},
|
|
1972
|
+
[refs.reference],
|
|
1973
|
+
openCalendar
|
|
1974
|
+
);
|
|
1975
|
+
const handleStateUpdateInternal = useCallback4(
|
|
1924
1976
|
(state) => {
|
|
1925
1977
|
var _a2;
|
|
1926
1978
|
if (!hideCalendar) {
|
|
@@ -1938,11 +1990,11 @@ var DateInput = (_a) => {
|
|
|
1938
1990
|
},
|
|
1939
1991
|
[hideCalendar, onStateUpdate]
|
|
1940
1992
|
);
|
|
1941
|
-
const handleSubmit =
|
|
1993
|
+
const handleSubmit = useCallback4(() => {
|
|
1942
1994
|
setOpenCalendar(false);
|
|
1943
1995
|
onSubmit == null ? void 0 : onSubmit();
|
|
1944
1996
|
}, [onSubmit]);
|
|
1945
|
-
const handleChange =
|
|
1997
|
+
const handleChange = useCallback4(
|
|
1946
1998
|
(date) => {
|
|
1947
1999
|
onChange == null ? void 0 : onChange(date);
|
|
1948
2000
|
if (date === null) {
|
|
@@ -2012,10 +2064,10 @@ var DateInput_default = DateInput;
|
|
|
2012
2064
|
|
|
2013
2065
|
// src/components/DateRangeInput/DateRangeInput.tsx
|
|
2014
2066
|
import { autoUpdate as autoUpdate2, flip as flip2, offset as offset2, useFloating as useFloating2 } from "@floating-ui/react";
|
|
2015
|
-
import { useRef as
|
|
2067
|
+
import { useRef as useRef10, useState as useState7 } from "react";
|
|
2016
2068
|
|
|
2017
2069
|
// src/components/BaseDateRangeInput/BaseDateRangeInput.tsx
|
|
2018
|
-
import { Fragment as Fragment5, useEffect as
|
|
2070
|
+
import { Fragment as Fragment5, useEffect as useEffect10, useRef as useRef9, useState as useState6 } from "react";
|
|
2019
2071
|
import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2020
2072
|
var BaseDateRangeInput = (_a) => {
|
|
2021
2073
|
var _b = _a, {
|
|
@@ -2059,13 +2111,13 @@ var BaseDateRangeInput = (_a) => {
|
|
|
2059
2111
|
"hasFocus",
|
|
2060
2112
|
"aria-invalid"
|
|
2061
2113
|
]);
|
|
2062
|
-
const containerRef =
|
|
2063
|
-
const startMonthRef =
|
|
2064
|
-
const startDayRef =
|
|
2065
|
-
const startYearRef =
|
|
2066
|
-
const endMonthRef =
|
|
2067
|
-
const endDayRef =
|
|
2068
|
-
const endYearRef =
|
|
2114
|
+
const containerRef = useRef9(null);
|
|
2115
|
+
const startMonthRef = useRef9(null);
|
|
2116
|
+
const startDayRef = useRef9(null);
|
|
2117
|
+
const startYearRef = useRef9(null);
|
|
2118
|
+
const endMonthRef = useRef9(null);
|
|
2119
|
+
const endDayRef = useRef9(null);
|
|
2120
|
+
const endYearRef = useRef9(null);
|
|
2069
2121
|
const [startMonth, setStartMonth] = useState6("");
|
|
2070
2122
|
const [startDay, setStartDay] = useState6("");
|
|
2071
2123
|
const [startYear, setStartYear] = useState6("");
|
|
@@ -2260,7 +2312,7 @@ var BaseDateRangeInput = (_a) => {
|
|
|
2260
2312
|
onSubmit == null ? void 0 : onSubmit();
|
|
2261
2313
|
clearFocus();
|
|
2262
2314
|
};
|
|
2263
|
-
|
|
2315
|
+
useEffect10(() => {
|
|
2264
2316
|
const now = Date.now();
|
|
2265
2317
|
const timeSinceLastUpdate = now - lastUpdatedTime;
|
|
2266
2318
|
if (timeSinceLastUpdate > 500) {
|
|
@@ -2509,7 +2561,7 @@ var DateRangeInput = (_a) => {
|
|
|
2509
2561
|
"onStateUpdate",
|
|
2510
2562
|
"onSubmit"
|
|
2511
2563
|
]);
|
|
2512
|
-
const calendarRef =
|
|
2564
|
+
const calendarRef = useRef10(null);
|
|
2513
2565
|
const [openCalendar, setOpenCalendar] = useState7(false);
|
|
2514
2566
|
const handleCloseCalendar = () => {
|
|
2515
2567
|
setOpenCalendar(false);
|
|
@@ -2526,9 +2578,13 @@ var DateRangeInput = (_a) => {
|
|
|
2526
2578
|
open: openCalendar,
|
|
2527
2579
|
onOpenChange: setOpenCalendar
|
|
2528
2580
|
});
|
|
2529
|
-
useClickOutside_default(
|
|
2530
|
-
|
|
2531
|
-
|
|
2581
|
+
useClickOutside_default(
|
|
2582
|
+
() => {
|
|
2583
|
+
handleCloseCalendar();
|
|
2584
|
+
},
|
|
2585
|
+
[refs.reference],
|
|
2586
|
+
openCalendar
|
|
2587
|
+
);
|
|
2532
2588
|
const handleStateUpdateInternal = (state) => {
|
|
2533
2589
|
var _a2;
|
|
2534
2590
|
if (!hideCalendar) {
|
|
@@ -2667,7 +2723,7 @@ import {
|
|
|
2667
2723
|
shift,
|
|
2668
2724
|
useFloating as useFloating3
|
|
2669
2725
|
} from "@floating-ui/react";
|
|
2670
|
-
import { cloneElement, useRef as
|
|
2726
|
+
import { cloneElement, useRef as useRef11, useState as useState8 } from "react";
|
|
2671
2727
|
import { Fragment as Fragment7, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2672
2728
|
var Tooltip = ({
|
|
2673
2729
|
children,
|
|
@@ -2682,8 +2738,8 @@ var Tooltip = ({
|
|
|
2682
2738
|
sideOffset = 12
|
|
2683
2739
|
}) => {
|
|
2684
2740
|
const [isOpen2, setIsOpen] = useState8(false);
|
|
2685
|
-
const arrowRef =
|
|
2686
|
-
const timeoutRef =
|
|
2741
|
+
const arrowRef = useRef11(null);
|
|
2742
|
+
const timeoutRef = useRef11(null);
|
|
2687
2743
|
const { refs, floatingStyles, context } = useFloating3({
|
|
2688
2744
|
open: isOpen2,
|
|
2689
2745
|
onOpenChange: setIsOpen,
|
|
@@ -3264,12 +3320,12 @@ RHFCurrencyInput.displayName = "RHFCurrencyInput";
|
|
|
3264
3320
|
var RHFCurrencyInput_default = RHFCurrencyInput;
|
|
3265
3321
|
|
|
3266
3322
|
// src/components/Textarea/Textarea.tsx
|
|
3267
|
-
import { forwardRef as forwardRef5, useCallback as
|
|
3323
|
+
import { forwardRef as forwardRef5, useCallback as useCallback6, useRef as useRef12 } from "react";
|
|
3268
3324
|
|
|
3269
3325
|
// src/hooks/useAutoResize.ts
|
|
3270
|
-
import { useCallback as
|
|
3326
|
+
import { useCallback as useCallback5, useLayoutEffect } from "react";
|
|
3271
3327
|
var useAutoResize = (ref, { enabled, minRows, maxRows, value }) => {
|
|
3272
|
-
const fit =
|
|
3328
|
+
const fit = useCallback5(() => {
|
|
3273
3329
|
const el = ref.current;
|
|
3274
3330
|
if (!el || !enabled) return;
|
|
3275
3331
|
const style = getComputedStyle(el);
|
|
@@ -3315,14 +3371,14 @@ import { jsx as jsx32 } from "react/jsx-runtime";
|
|
|
3315
3371
|
var Textarea = forwardRef5(
|
|
3316
3372
|
(_a, ref) => {
|
|
3317
3373
|
var _b = _a, { autoResize = false, className, rows = 2, maxRows, onInput, value } = _b, rest = __objRest(_b, ["autoResize", "className", "rows", "maxRows", "onInput", "value"]);
|
|
3318
|
-
const innerRef =
|
|
3374
|
+
const innerRef = useRef12(null);
|
|
3319
3375
|
const fit = useAutoResize_default(innerRef, {
|
|
3320
3376
|
enabled: autoResize,
|
|
3321
3377
|
minRows: rows,
|
|
3322
3378
|
maxRows,
|
|
3323
3379
|
value
|
|
3324
3380
|
});
|
|
3325
|
-
const handleInput =
|
|
3381
|
+
const handleInput = useCallback6(
|
|
3326
3382
|
(event) => {
|
|
3327
3383
|
fit();
|
|
3328
3384
|
onInput == null ? void 0 : onInput(event);
|
|
@@ -3627,7 +3683,7 @@ var RHFDateInput_default = RHFDateInput;
|
|
|
3627
3683
|
|
|
3628
3684
|
// src/components/TimeInput/TimeInput.tsx
|
|
3629
3685
|
import { autoUpdate as autoUpdate3, flip as flip4, offset as offset4, shift as shift2, useFloating as useFloating4 } from "@floating-ui/react";
|
|
3630
|
-
import { Fragment as Fragment9, useEffect as
|
|
3686
|
+
import { Fragment as Fragment9, useEffect as useEffect11, useRef as useRef13, useState as useState9 } from "react";
|
|
3631
3687
|
|
|
3632
3688
|
// src/components/TimeInput/TimeInput.utils.ts
|
|
3633
3689
|
var hasSeconds = (format) => format.includes("ss");
|
|
@@ -3753,13 +3809,13 @@ var TimeInput = ({
|
|
|
3753
3809
|
const twelve = isTwelveHour(format);
|
|
3754
3810
|
const withSeconds = hasSeconds(format);
|
|
3755
3811
|
const segments = segmentsFor(format);
|
|
3756
|
-
const fieldRef =
|
|
3757
|
-
const listRef =
|
|
3758
|
-
const columnsRef =
|
|
3759
|
-
const hourRef =
|
|
3760
|
-
const minuteRef =
|
|
3761
|
-
const secondRef =
|
|
3762
|
-
const meridiemRef =
|
|
3812
|
+
const fieldRef = useRef13(null);
|
|
3813
|
+
const listRef = useRef13(null);
|
|
3814
|
+
const columnsRef = useRef13(null);
|
|
3815
|
+
const hourRef = useRef13(null);
|
|
3816
|
+
const minuteRef = useRef13(null);
|
|
3817
|
+
const secondRef = useRef13(null);
|
|
3818
|
+
const meridiemRef = useRef13(null);
|
|
3763
3819
|
const refs = {
|
|
3764
3820
|
hour: hourRef,
|
|
3765
3821
|
minute: minuteRef,
|
|
@@ -3782,8 +3838,8 @@ var TimeInput = ({
|
|
|
3782
3838
|
setOpen(false);
|
|
3783
3839
|
setDraft(null);
|
|
3784
3840
|
};
|
|
3785
|
-
useClickOutside_default(close, [listRef, fieldRef]);
|
|
3786
|
-
|
|
3841
|
+
useClickOutside_default(close, [listRef, fieldRef], open);
|
|
3842
|
+
useEffect11(() => {
|
|
3787
3843
|
var _a;
|
|
3788
3844
|
if (!open) return;
|
|
3789
3845
|
(_a = columnsRef.current) == null ? void 0 : _a.querySelectorAll('[data-state="selected"]').forEach((cell) => {
|
|
@@ -4050,7 +4106,7 @@ RHFTimeInput.displayName = "RHFTimeInput";
|
|
|
4050
4106
|
var RHFTimeInput_default = RHFTimeInput;
|
|
4051
4107
|
|
|
4052
4108
|
// src/components/Slider/SliderBase/SliderBase.tsx
|
|
4053
|
-
import { useRef as
|
|
4109
|
+
import { useRef as useRef14, useState as useState10 } from "react";
|
|
4054
4110
|
|
|
4055
4111
|
// src/components/Slider/Slider.utils.ts
|
|
4056
4112
|
var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
@@ -4092,7 +4148,7 @@ var SliderBase = ({
|
|
|
4092
4148
|
className,
|
|
4093
4149
|
thumbLabels
|
|
4094
4150
|
}) => {
|
|
4095
|
-
const trackRef =
|
|
4151
|
+
const trackRef = useRef14(null);
|
|
4096
4152
|
const [active, setActive] = useState10(null);
|
|
4097
4153
|
const [focused, setFocused] = useState10(null);
|
|
4098
4154
|
const boundsFor = (index) => [
|
|
@@ -4382,7 +4438,7 @@ var RHFSlider_default = RHFSlider;
|
|
|
4382
4438
|
|
|
4383
4439
|
// src/components/TagInput/TagInput/TagInput.tsx
|
|
4384
4440
|
import { autoUpdate as autoUpdate4, flip as flip5, offset as offset5, shift as shift3, useFloating as useFloating5 } from "@floating-ui/react";
|
|
4385
|
-
import { useRef as
|
|
4441
|
+
import { useRef as useRef15, useState as useState11 } from "react";
|
|
4386
4442
|
|
|
4387
4443
|
// src/utils/isTextIncludes.ts
|
|
4388
4444
|
function isTextIncludes(baseString = "", searchString) {
|
|
@@ -4447,9 +4503,9 @@ var TagInput = ({
|
|
|
4447
4503
|
children,
|
|
4448
4504
|
"aria-invalid": invalid
|
|
4449
4505
|
}) => {
|
|
4450
|
-
const fieldRef =
|
|
4451
|
-
const menuRef =
|
|
4452
|
-
const inputRef =
|
|
4506
|
+
const fieldRef = useRef15(null);
|
|
4507
|
+
const menuRef = useRef15(null);
|
|
4508
|
+
const inputRef = useRef15(null);
|
|
4453
4509
|
const [keyword, setKeyword] = useState11("");
|
|
4454
4510
|
const [focused, setFocused] = useState11(null);
|
|
4455
4511
|
const [open, setOpen] = useState11(false);
|
|
@@ -4461,7 +4517,7 @@ var TagInput = ({
|
|
|
4461
4517
|
open,
|
|
4462
4518
|
onOpenChange: setOpen
|
|
4463
4519
|
});
|
|
4464
|
-
useClickOutside_default(() => setOpen(false), [menuRef, fieldRef]);
|
|
4520
|
+
useClickOutside_default(() => setOpen(false), [menuRef, fieldRef], open);
|
|
4465
4521
|
const declared = optionsFrom(children);
|
|
4466
4522
|
const isSelected = (tag) => value.includes(tag);
|
|
4467
4523
|
const canonical = (tag) => {
|
|
@@ -4715,7 +4771,7 @@ RHFTagInput.displayName = "RHFTagInput";
|
|
|
4715
4771
|
var RHFTagInput_default = RHFTagInput;
|
|
4716
4772
|
|
|
4717
4773
|
// src/components/Rating/Rating.tsx
|
|
4718
|
-
import { useId as useId5, useRef as
|
|
4774
|
+
import { useId as useId5, useRef as useRef16, useState as useState12 } from "react";
|
|
4719
4775
|
|
|
4720
4776
|
// src/components/Rating/Rating.utils.ts
|
|
4721
4777
|
var snap = (value, precision) => Number((Math.round(value / precision) * precision).toFixed(4));
|
|
@@ -4774,7 +4830,7 @@ var Rating = (_a) => {
|
|
|
4774
4830
|
"aria-label"
|
|
4775
4831
|
]);
|
|
4776
4832
|
const generated = useId5();
|
|
4777
|
-
const iconsRef =
|
|
4833
|
+
const iconsRef = useRef16([]);
|
|
4778
4834
|
const [hovered, setHovered] = useState12(null);
|
|
4779
4835
|
const interactive = !readOnly && !disabled;
|
|
4780
4836
|
const group = name != null ? name : `GeckoUIRating-${generated}`;
|
|
@@ -4920,10 +4976,10 @@ var RHFRating_default = RHFRating;
|
|
|
4920
4976
|
|
|
4921
4977
|
// src/components/ColorInput/ColorInput.tsx
|
|
4922
4978
|
import { autoUpdate as autoUpdate5, flip as flip6, offset as offset6, shift as shift4, useFloating as useFloating6 } from "@floating-ui/react";
|
|
4923
|
-
import { useRef as
|
|
4979
|
+
import { useRef as useRef21, useState as useState17 } from "react";
|
|
4924
4980
|
|
|
4925
4981
|
// src/components/ColorPicker/ColorPicker.tsx
|
|
4926
|
-
import { useEffect as
|
|
4982
|
+
import { useEffect as useEffect13, useRef as useRef20, useState as useState16 } from "react";
|
|
4927
4983
|
|
|
4928
4984
|
// src/components/ColorPicker/ColorPicker.utils.ts
|
|
4929
4985
|
var clamp2 = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
@@ -5038,7 +5094,7 @@ var cssColor = (hsva) => formatColor(hsva, "rgb", true);
|
|
|
5038
5094
|
var sameColor = (a, b) => a.h === b.h && a.s === b.s && a.v === b.v && a.a === b.a;
|
|
5039
5095
|
|
|
5040
5096
|
// src/components/ColorPicker/ColorSlider/ColorSlider.tsx
|
|
5041
|
-
import { useRef as
|
|
5097
|
+
import { useRef as useRef17, useState as useState13 } from "react";
|
|
5042
5098
|
import { jsx as jsx50, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5043
5099
|
var ColorSlider = ({
|
|
5044
5100
|
value,
|
|
@@ -5054,7 +5110,7 @@ var ColorSlider = ({
|
|
|
5054
5110
|
valueText,
|
|
5055
5111
|
children
|
|
5056
5112
|
}) => {
|
|
5057
|
-
const trackRef =
|
|
5113
|
+
const trackRef = useRef17(null);
|
|
5058
5114
|
const [dragging, setDragging] = useState13(false);
|
|
5059
5115
|
const moveTo = (event) => {
|
|
5060
5116
|
var _a;
|
|
@@ -5140,15 +5196,15 @@ ColorSlider.displayName = "ColorSlider";
|
|
|
5140
5196
|
var ColorSlider_default = ColorSlider;
|
|
5141
5197
|
|
|
5142
5198
|
// src/components/ColorPicker/FormatSelect/FormatSelect.tsx
|
|
5143
|
-
import { useEffect as
|
|
5199
|
+
import { useEffect as useEffect12, useRef as useRef18, useState as useState14 } from "react";
|
|
5144
5200
|
import { jsx as jsx51, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5145
5201
|
var FormatSelect = ({ value, options, labels, disabled, onChange }) => {
|
|
5146
|
-
const rootRef =
|
|
5147
|
-
const listRef =
|
|
5202
|
+
const rootRef = useRef18(null);
|
|
5203
|
+
const listRef = useRef18(null);
|
|
5148
5204
|
const [open, setOpen] = useState14(false);
|
|
5149
5205
|
const [active, setActive] = useState14(() => Math.max(options.indexOf(value), 0));
|
|
5150
|
-
useClickOutside_default(() => setOpen(false), [rootRef]);
|
|
5151
|
-
|
|
5206
|
+
useClickOutside_default(() => setOpen(false), [rootRef], open);
|
|
5207
|
+
useEffect12(() => {
|
|
5152
5208
|
var _a;
|
|
5153
5209
|
if (!open) return;
|
|
5154
5210
|
setActive(Math.max(options.indexOf(value), 0));
|
|
@@ -5246,7 +5302,7 @@ FormatSelect.displayName = "FormatSelect";
|
|
|
5246
5302
|
var FormatSelect_default = FormatSelect;
|
|
5247
5303
|
|
|
5248
5304
|
// src/components/ColorPicker/SaturationArea/SaturationArea.tsx
|
|
5249
|
-
import { useRef as
|
|
5305
|
+
import { useRef as useRef19, useState as useState15 } from "react";
|
|
5250
5306
|
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
5251
5307
|
var SaturationArea = ({
|
|
5252
5308
|
hsva,
|
|
@@ -5256,7 +5312,7 @@ var SaturationArea = ({
|
|
|
5256
5312
|
label,
|
|
5257
5313
|
children
|
|
5258
5314
|
}) => {
|
|
5259
|
-
const areaRef =
|
|
5315
|
+
const areaRef = useRef19(null);
|
|
5260
5316
|
const [dragging, setDragging] = useState15(false);
|
|
5261
5317
|
const moveTo = (event) => {
|
|
5262
5318
|
var _a;
|
|
@@ -5386,12 +5442,12 @@ var ColorPicker = (_a) => {
|
|
|
5386
5442
|
const [hasDropper, setHasDropper] = useState16(false);
|
|
5387
5443
|
const preferred = (_a2 = formats[0]) != null ? _a2 : "hex";
|
|
5388
5444
|
const [active, setActive] = useState16(preferred);
|
|
5389
|
-
|
|
5390
|
-
const emitted =
|
|
5391
|
-
|
|
5445
|
+
useEffect13(() => setActive(preferred), [preferred]);
|
|
5446
|
+
const emitted = useRef20(null);
|
|
5447
|
+
useEffect13(() => {
|
|
5392
5448
|
setHasDropper(typeof window !== "undefined" && typeof window.EyeDropper === "function");
|
|
5393
5449
|
}, []);
|
|
5394
|
-
|
|
5450
|
+
useEffect13(() => {
|
|
5395
5451
|
if (value === void 0 || value === emitted.current) return;
|
|
5396
5452
|
const parsed = parseColor(value);
|
|
5397
5453
|
if (parsed && !sameColor(parsed, internal)) setInternal(parsed);
|
|
@@ -5599,8 +5655,8 @@ var ColorInput = (_a) => {
|
|
|
5599
5655
|
"wrapperClassName",
|
|
5600
5656
|
"pickerClassName"
|
|
5601
5657
|
]);
|
|
5602
|
-
const fieldRef =
|
|
5603
|
-
const panelRef =
|
|
5658
|
+
const fieldRef = useRef21(null);
|
|
5659
|
+
const panelRef = useRef21(null);
|
|
5604
5660
|
const [internal, setInternal] = useState17(defaultValue);
|
|
5605
5661
|
const [open, setOpen] = useState17(false);
|
|
5606
5662
|
const floating = useFloating6({
|
|
@@ -5617,7 +5673,7 @@ var ColorInput = (_a) => {
|
|
|
5617
5673
|
setOpen(next);
|
|
5618
5674
|
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
5619
5675
|
};
|
|
5620
|
-
useClickOutside_default(() => toggle(false), [panelRef, fieldRef]);
|
|
5676
|
+
useClickOutside_default(() => toggle(false), [panelRef, fieldRef], open);
|
|
5621
5677
|
const color = value != null ? value : internal;
|
|
5622
5678
|
const parsed = parseColor(color);
|
|
5623
5679
|
const handleChange = (next) => {
|
|
@@ -5825,7 +5881,7 @@ RHFDateRangeInput.displayName = "RHFDateRangeInput";
|
|
|
5825
5881
|
var RHFDateRangeInput_default = RHFDateRangeInput;
|
|
5826
5882
|
|
|
5827
5883
|
// src/components/FileInput/FileInput.tsx
|
|
5828
|
-
import { useRef as
|
|
5884
|
+
import { useRef as useRef22, useState as useState18 } from "react";
|
|
5829
5885
|
|
|
5830
5886
|
// src/components/FileInput/FileInput.utils.ts
|
|
5831
5887
|
var countLabel = (count) => {
|
|
@@ -5872,7 +5928,7 @@ var FileInput = (props) => {
|
|
|
5872
5928
|
"unique",
|
|
5873
5929
|
"max"
|
|
5874
5930
|
]);
|
|
5875
|
-
const fieldRef =
|
|
5931
|
+
const fieldRef = useRef22(null);
|
|
5876
5932
|
const [dragging, setDragging] = useState18(false);
|
|
5877
5933
|
const [loading, setLoading] = useState18(false);
|
|
5878
5934
|
const held = multiple ? value != null ? value : [] : value ? [value] : [];
|
|
@@ -6036,7 +6092,7 @@ RHFFileInput.displayName = "RHFFileInput";
|
|
|
6036
6092
|
var RHFFileInput_default = RHFFileInput;
|
|
6037
6093
|
|
|
6038
6094
|
// src/components/OTPInput/OTPInput.tsx
|
|
6039
|
-
import { forwardRef as forwardRef8, useRef as
|
|
6095
|
+
import { forwardRef as forwardRef8, useRef as useRef23 } from "react";
|
|
6040
6096
|
import { jsx as jsx60, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6041
6097
|
var OTPInput = forwardRef8(
|
|
6042
6098
|
(_a, ref) => {
|
|
@@ -6065,7 +6121,7 @@ var OTPInput = forwardRef8(
|
|
|
6065
6121
|
"disabled",
|
|
6066
6122
|
"aria-invalid"
|
|
6067
6123
|
]);
|
|
6068
|
-
const divRef =
|
|
6124
|
+
const divRef = useRef23(null);
|
|
6069
6125
|
const { dataAttributes } = splitDataAttributes(props);
|
|
6070
6126
|
const focus = (index) => {
|
|
6071
6127
|
var _a2, _b2;
|
|
@@ -6229,7 +6285,7 @@ var RHFOTPInput_default = RHFOTPInput;
|
|
|
6229
6285
|
|
|
6230
6286
|
// src/components/Select/Select/Select.tsx
|
|
6231
6287
|
import { autoUpdate as autoUpdate6, flip as flip7, offset as offset7, size, useFloating as useFloating7 } from "@floating-ui/react";
|
|
6232
|
-
import { Children as Children4, useMemo as useMemo4, useRef as
|
|
6288
|
+
import { Children as Children4, useMemo as useMemo4, useRef as useRef25, useState as useState19 } from "react";
|
|
6233
6289
|
|
|
6234
6290
|
// src/components/Select/Select.utils.ts
|
|
6235
6291
|
var isSelect = hasDisplayName("Select");
|
|
@@ -6292,7 +6348,7 @@ function findSelectOptions(el) {
|
|
|
6292
6348
|
}
|
|
6293
6349
|
|
|
6294
6350
|
// src/components/Select/SelectButton/SelectButton.tsx
|
|
6295
|
-
import { Children as Children2, useId as useId6, useMemo as useMemo2, useRef as
|
|
6351
|
+
import { Children as Children2, useId as useId6, useMemo as useMemo2, useRef as useRef24 } from "react";
|
|
6296
6352
|
|
|
6297
6353
|
// src/utils/createLabel.ts
|
|
6298
6354
|
function isBlankLabel(value) {
|
|
@@ -6334,7 +6390,7 @@ function createLabel(item) {
|
|
|
6334
6390
|
var createLabel_default = createLabel;
|
|
6335
6391
|
|
|
6336
6392
|
// src/components/Select/hooks/useSelectTrigger.tsx
|
|
6337
|
-
import { useEffect as
|
|
6393
|
+
import { useEffect as useEffect14, useMemo } from "react";
|
|
6338
6394
|
|
|
6339
6395
|
// src/components/Select/useSelect.tsx
|
|
6340
6396
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
@@ -6361,14 +6417,17 @@ var useSelectTrigger = () => {
|
|
|
6361
6417
|
open,
|
|
6362
6418
|
multiple,
|
|
6363
6419
|
isEmpty,
|
|
6364
|
-
handleChange
|
|
6420
|
+
handleChange,
|
|
6421
|
+
filterable,
|
|
6422
|
+
requestSearchFocus
|
|
6365
6423
|
} = useSelect();
|
|
6424
|
+
const hasDropdownSearch = filterable === true || filterable === "dropdown";
|
|
6366
6425
|
const filteredOptions = options.filter(
|
|
6367
6426
|
({ label, visibility }) => !isHideSelectOption({ keyword, label, visibility, isEmpty })
|
|
6368
6427
|
);
|
|
6369
|
-
const
|
|
6370
|
-
setKeyword(() =>
|
|
6371
|
-
let focusedValue = options.find(({ label }) => isTextIncludes_default(label,
|
|
6428
|
+
const filterTo = (text) => {
|
|
6429
|
+
setKeyword(() => text);
|
|
6430
|
+
let focusedValue = options.find(({ label }) => isTextIncludes_default(label, text));
|
|
6372
6431
|
if (!focusedValue && filteredOptions.length) {
|
|
6373
6432
|
focusedValue = filteredOptions[0];
|
|
6374
6433
|
}
|
|
@@ -6376,7 +6435,16 @@ var useSelectTrigger = () => {
|
|
|
6376
6435
|
setFocusedOption(__spreadProps(__spreadValues({}, focusedValue), { focusType: "keyboard" }));
|
|
6377
6436
|
}
|
|
6378
6437
|
};
|
|
6438
|
+
const handleInputChange = (e) => filterTo(e.target.value);
|
|
6379
6439
|
const handleKeyboardInteraction = (e) => {
|
|
6440
|
+
const printable = e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;
|
|
6441
|
+
if (hasDropdownSearch && printable && !(e.key === " " && !keyword)) {
|
|
6442
|
+
e.preventDefault();
|
|
6443
|
+
if (!open) openMenu();
|
|
6444
|
+
filterTo((open ? keyword : "") + e.key);
|
|
6445
|
+
requestSearchFocus();
|
|
6446
|
+
return;
|
|
6447
|
+
}
|
|
6380
6448
|
if (e.key === "Escape") {
|
|
6381
6449
|
e.currentTarget.blur();
|
|
6382
6450
|
closeMenu();
|
|
@@ -6420,7 +6488,7 @@ var useSelectTrigger = () => {
|
|
|
6420
6488
|
}
|
|
6421
6489
|
};
|
|
6422
6490
|
const matchesAnOption = options.some((opt) => isEqual_default(opt.value, value));
|
|
6423
|
-
|
|
6491
|
+
useEffect14(() => {
|
|
6424
6492
|
if (multiple || matchesAnOption || isNil_default(value) || value === "") return;
|
|
6425
6493
|
devWarn(
|
|
6426
6494
|
"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."
|
|
@@ -6486,7 +6554,7 @@ function SelectButton(_a) {
|
|
|
6486
6554
|
clearable
|
|
6487
6555
|
} = useSelect();
|
|
6488
6556
|
const id = useId6();
|
|
6489
|
-
const pointerDownRef =
|
|
6557
|
+
const pointerDownRef = useRef24(false);
|
|
6490
6558
|
const { hasValue, handleInputChange, handleKeyboardInteraction } = useSelectTrigger();
|
|
6491
6559
|
const trigger = useMemo2(() => Children2.toArray(children).find(isSelectTrigger), [children]);
|
|
6492
6560
|
const handleClear = (e) => {
|
|
@@ -6556,6 +6624,7 @@ function SelectButton(_a) {
|
|
|
6556
6624
|
disabled,
|
|
6557
6625
|
className: "GeckoUISelectButton__search__input"
|
|
6558
6626
|
}, (open && !hasValue || !multiple && hasValue) && { "data-initial": "" }), !filterable && { "data-readonly": "" }), {
|
|
6627
|
+
readOnly: !filterable,
|
|
6559
6628
|
onKeyDown: handleKeyboardInteraction,
|
|
6560
6629
|
onFocusCapture: openMenu,
|
|
6561
6630
|
onChange: filterable ? handleInputChange : (
|
|
@@ -6669,7 +6738,7 @@ SelectButton.displayName = "SelectButton";
|
|
|
6669
6738
|
var SelectButton_default = SelectButton;
|
|
6670
6739
|
|
|
6671
6740
|
// src/components/Select/SelectMenu/SelectMenu.tsx
|
|
6672
|
-
import { Children as Children3, useMemo as useMemo3 } from "react";
|
|
6741
|
+
import { Children as Children3, useEffect as useEffect15, useMemo as useMemo3 } from "react";
|
|
6673
6742
|
|
|
6674
6743
|
// src/components/Select/SelectDropdownSearch/SelectDropdownSearch.tsx
|
|
6675
6744
|
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
@@ -6775,6 +6844,8 @@ var SelectMenu = (_a) => {
|
|
|
6775
6844
|
disabled,
|
|
6776
6845
|
open,
|
|
6777
6846
|
filterable,
|
|
6847
|
+
autoFocusSearch,
|
|
6848
|
+
searchFocusRequest,
|
|
6778
6849
|
menuScrollContainerRef,
|
|
6779
6850
|
floating: { refs, floatingStyles }
|
|
6780
6851
|
} = useSelect();
|
|
@@ -6782,6 +6853,11 @@ var SelectMenu = (_a) => {
|
|
|
6782
6853
|
() => Children3.toArray(children).filter((el) => !isSelectTrigger(el)),
|
|
6783
6854
|
[children]
|
|
6784
6855
|
);
|
|
6856
|
+
useEffect15(() => {
|
|
6857
|
+
var _a2, _b2;
|
|
6858
|
+
if (!searchFocusRequest) return;
|
|
6859
|
+
(_b2 = (_a2 = refs.floating.current) == null ? void 0 : _a2.querySelector(".GeckoUISelectMenu__search-container input")) == null ? void 0 : _b2.focus();
|
|
6860
|
+
}, [searchFocusRequest, refs.floating]);
|
|
6785
6861
|
if (!open || disabled) {
|
|
6786
6862
|
return null;
|
|
6787
6863
|
}
|
|
@@ -6795,7 +6871,13 @@ var SelectMenu = (_a) => {
|
|
|
6795
6871
|
"data-with-search": hasDropdownSearch || void 0
|
|
6796
6872
|
}, rest), {
|
|
6797
6873
|
children: [
|
|
6798
|
-
hasDropdownSearch && /* @__PURE__ */ jsx65(
|
|
6874
|
+
hasDropdownSearch && /* @__PURE__ */ jsx65(
|
|
6875
|
+
SelectDropdownSearch_default,
|
|
6876
|
+
{
|
|
6877
|
+
className: "GeckoUISelectMenu__search-container",
|
|
6878
|
+
autoFocus: autoFocusSearch
|
|
6879
|
+
}
|
|
6880
|
+
),
|
|
6799
6881
|
/* @__PURE__ */ jsxs31("div", { ref: menuScrollContainerRef, className: "GeckoUISelectMenu__items", children: [
|
|
6800
6882
|
menuItems,
|
|
6801
6883
|
/* @__PURE__ */ jsx65(Empty, { children: menuItems })
|
|
@@ -6817,8 +6899,8 @@ var SelectMenu_default = SelectMenu;
|
|
|
6817
6899
|
// src/components/Select/Select/Select.tsx
|
|
6818
6900
|
import { jsx as jsx66, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
6819
6901
|
var Select = (props) => {
|
|
6820
|
-
const inputRef =
|
|
6821
|
-
const menuScrollContainerRef =
|
|
6902
|
+
const inputRef = useRef25(null);
|
|
6903
|
+
const menuScrollContainerRef = useRef25(null);
|
|
6822
6904
|
const _a = props, {
|
|
6823
6905
|
disabled,
|
|
6824
6906
|
inputRef: customInputRef,
|
|
@@ -6848,6 +6930,7 @@ var Select = (props) => {
|
|
|
6848
6930
|
]);
|
|
6849
6931
|
const [open, setOpen] = useState19(false);
|
|
6850
6932
|
const [keyword, setKeyword] = useState19("");
|
|
6933
|
+
const [searchFocusRequest, setSearchFocusRequest] = useState19(0);
|
|
6851
6934
|
const [focusedOption, setFocusedOption] = useState19(null);
|
|
6852
6935
|
const floating = useFloating7({
|
|
6853
6936
|
placement,
|
|
@@ -6920,9 +7003,13 @@ var Select = (props) => {
|
|
|
6920
7003
|
onChange([...prevValue, optionValue]);
|
|
6921
7004
|
}
|
|
6922
7005
|
};
|
|
6923
|
-
useClickOutside_default(
|
|
6924
|
-
|
|
6925
|
-
|
|
7006
|
+
useClickOutside_default(
|
|
7007
|
+
() => {
|
|
7008
|
+
closeMenu();
|
|
7009
|
+
},
|
|
7010
|
+
[refs.reference],
|
|
7011
|
+
open
|
|
7012
|
+
);
|
|
6926
7013
|
return /* @__PURE__ */ jsx66(
|
|
6927
7014
|
SelectContext.Provider,
|
|
6928
7015
|
{
|
|
@@ -6931,6 +7018,8 @@ var Select = (props) => {
|
|
|
6931
7018
|
setOpen,
|
|
6932
7019
|
keyword,
|
|
6933
7020
|
setKeyword,
|
|
7021
|
+
searchFocusRequest,
|
|
7022
|
+
requestSearchFocus: () => setSearchFocusRequest((n) => n + 1),
|
|
6934
7023
|
floating,
|
|
6935
7024
|
openMenu,
|
|
6936
7025
|
closeMenu,
|
|
@@ -6970,7 +7059,7 @@ Select.displayName = "Select";
|
|
|
6970
7059
|
var Select_default = Select;
|
|
6971
7060
|
|
|
6972
7061
|
// src/components/Select/SelectOption/SelectOption.tsx
|
|
6973
|
-
import { useEffect as
|
|
7062
|
+
import { useEffect as useEffect16, useRef as useRef26 } from "react";
|
|
6974
7063
|
import { jsx as jsx67, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
6975
7064
|
var SelectOption = (_a) => {
|
|
6976
7065
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
@@ -6993,7 +7082,7 @@ var SelectOption = (_a) => {
|
|
|
6993
7082
|
"onRemove",
|
|
6994
7083
|
"disabled"
|
|
6995
7084
|
]);
|
|
6996
|
-
const ref =
|
|
7085
|
+
const ref = useRef26(null);
|
|
6997
7086
|
const { preventDefault, attachPreventDefault } = usePreventDefault_default();
|
|
6998
7087
|
const {
|
|
6999
7088
|
closeMenuOnSelect,
|
|
@@ -7011,7 +7100,7 @@ var SelectOption = (_a) => {
|
|
|
7011
7100
|
} = useSelect();
|
|
7012
7101
|
const selected = isSelected(value);
|
|
7013
7102
|
const focused = !isNil_default(focusedOption) && isEqual_default(focusedOption == null ? void 0 : focusedOption.value, value);
|
|
7014
|
-
|
|
7103
|
+
useEffect16(() => {
|
|
7015
7104
|
if (!ref.current || !menuScrollContainerRef.current) return;
|
|
7016
7105
|
if ((focusedOption == null ? void 0 : focusedOption.focusType) !== "mouse" && focused) {
|
|
7017
7106
|
const scrollContainer = menuScrollContainerRef.current;
|
|
@@ -7279,13 +7368,13 @@ Tabs.displayName = "Tabs";
|
|
|
7279
7368
|
var Tabs_default = Tabs;
|
|
7280
7369
|
|
|
7281
7370
|
// src/components/Tabs/TabList/TabList.tsx
|
|
7282
|
-
import { useEffect as
|
|
7371
|
+
import { useEffect as useEffect17, useRef as useRef27 } from "react";
|
|
7283
7372
|
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
7284
7373
|
var TabList = (_a) => {
|
|
7285
7374
|
var _b = _a, { className, children } = _b, rest = __objRest(_b, ["className", "children"]);
|
|
7286
7375
|
const { selectedValue, isNav, orientation } = useTabs();
|
|
7287
|
-
const listRef =
|
|
7288
|
-
|
|
7376
|
+
const listRef = useRef27(null);
|
|
7377
|
+
useEffect17(() => {
|
|
7289
7378
|
const list = listRef.current;
|
|
7290
7379
|
if (!list) return;
|
|
7291
7380
|
const tab = list.querySelector('[data-gecko-tab][data-state="selected"]');
|
|
@@ -7428,7 +7517,7 @@ TabPanel.displayName = "TabPanel";
|
|
|
7428
7517
|
var TabPanel_default = TabPanel;
|
|
7429
7518
|
|
|
7430
7519
|
// src/components/Accordion/Accordion/Accordion.tsx
|
|
7431
|
-
import { useRef as
|
|
7520
|
+
import { useRef as useRef28, useState as useState21 } from "react";
|
|
7432
7521
|
|
|
7433
7522
|
// src/components/Accordion/useAccordion.tsx
|
|
7434
7523
|
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
@@ -7479,7 +7568,7 @@ var Accordion = (_a) => {
|
|
|
7479
7568
|
"className",
|
|
7480
7569
|
"children"
|
|
7481
7570
|
]);
|
|
7482
|
-
const rootRef =
|
|
7571
|
+
const rootRef = useRef28(null);
|
|
7483
7572
|
const [internalValue, setInternalValue] = useState21(defaultValue);
|
|
7484
7573
|
const isControlled = value !== void 0;
|
|
7485
7574
|
const openValues = toArray(isControlled ? value : internalValue);
|
|
@@ -7930,13 +8019,13 @@ Skeleton.displayName = "Skeleton";
|
|
|
7930
8019
|
var Skeleton_default = Skeleton;
|
|
7931
8020
|
|
|
7932
8021
|
// src/components/Progress/Progress.tsx
|
|
7933
|
-
import { forwardRef as forwardRef12, useEffect as
|
|
8022
|
+
import { forwardRef as forwardRef12, useEffect as useEffect18 } from "react";
|
|
7934
8023
|
import { jsx as jsx82, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
7935
8024
|
var Progress = forwardRef12(
|
|
7936
8025
|
(_a, ref) => {
|
|
7937
8026
|
var _b = _a, { value, max = 100, color = "primary", size: size2 = "md", label, className } = _b, rest = __objRest(_b, ["value", "max", "color", "size", "label", "className"]);
|
|
7938
8027
|
const indeterminate = value === void 0;
|
|
7939
|
-
|
|
8028
|
+
useEffect18(() => {
|
|
7940
8029
|
if (max <= 0) devWarn(`Progress needs a max above 0, but got ${max}.`);
|
|
7941
8030
|
}, [max]);
|
|
7942
8031
|
const clamped = indeterminate || max <= 0 ? 0 : Math.min(Math.max(value, 0), max);
|
|
@@ -7974,7 +8063,7 @@ var Progress_default = Progress;
|
|
|
7974
8063
|
|
|
7975
8064
|
// src/components/Breadcrumb/Breadcrumb/Breadcrumb.tsx
|
|
7976
8065
|
import { autoUpdate as autoUpdate7, flip as flip8, offset as offset8, shift as shift5, useFloating as useFloating8 } from "@floating-ui/react";
|
|
7977
|
-
import { Children as Children6, Fragment as Fragment13, isValidElement as isValidElement5, useRef as
|
|
8066
|
+
import { Children as Children6, Fragment as Fragment13, isValidElement as isValidElement5, useRef as useRef29, useState as useState23 } from "react";
|
|
7978
8067
|
|
|
7979
8068
|
// src/components/Breadcrumb/useBreadcrumb.tsx
|
|
7980
8069
|
import { createContext as createContext6, useContext as useContext6 } from "react";
|
|
@@ -8010,8 +8099,8 @@ var Breadcrumb = (_a) => {
|
|
|
8010
8099
|
"menuClassName",
|
|
8011
8100
|
"aria-label"
|
|
8012
8101
|
]);
|
|
8013
|
-
const triggerRef =
|
|
8014
|
-
const menuRef =
|
|
8102
|
+
const triggerRef = useRef29(null);
|
|
8103
|
+
const menuRef = useRef29(null);
|
|
8015
8104
|
const [open, setOpen] = useState23(false);
|
|
8016
8105
|
const floating = useFloating8({
|
|
8017
8106
|
placement: menuPlacement,
|
|
@@ -8020,7 +8109,7 @@ var Breadcrumb = (_a) => {
|
|
|
8020
8109
|
open,
|
|
8021
8110
|
onOpenChange: setOpen
|
|
8022
8111
|
});
|
|
8023
|
-
useClickOutside_default(() => setOpen(false), [menuRef, triggerRef]);
|
|
8112
|
+
useClickOutside_default(() => setOpen(false), [menuRef, triggerRef], open);
|
|
8024
8113
|
const crumbs = Children6.toArray(children);
|
|
8025
8114
|
const claimed = crumbs.some(
|
|
8026
8115
|
(crumb) => isValidElement5(crumb) && crumb.props.current
|
|
@@ -8406,7 +8495,7 @@ import {
|
|
|
8406
8495
|
shift as shift6,
|
|
8407
8496
|
useFloating as useFloating9
|
|
8408
8497
|
} from "@floating-ui/react";
|
|
8409
|
-
import { useEffect as
|
|
8498
|
+
import { useEffect as useEffect19, useRef as useRef30, useState as useState24 } from "react";
|
|
8410
8499
|
|
|
8411
8500
|
// src/components/Popover/usePopover.tsx
|
|
8412
8501
|
import { createContext as createContext8, useContext as useContext8 } from "react";
|
|
@@ -8450,9 +8539,9 @@ var Popover = (_a) => {
|
|
|
8450
8539
|
"className",
|
|
8451
8540
|
"children"
|
|
8452
8541
|
]);
|
|
8453
|
-
const arrowRef =
|
|
8454
|
-
const triggerRef =
|
|
8455
|
-
const rootRef =
|
|
8542
|
+
const arrowRef = useRef30(null);
|
|
8543
|
+
const triggerRef = useRef30(null);
|
|
8544
|
+
const rootRef = useRef30(null);
|
|
8456
8545
|
const [internalOpen, setInternalOpen] = useState24(defaultOpen);
|
|
8457
8546
|
const isControlled = controlledOpen !== void 0;
|
|
8458
8547
|
const open = disabled ? false : isControlled ? controlledOpen : internalOpen;
|
|
@@ -8483,11 +8572,13 @@ var Popover = (_a) => {
|
|
|
8483
8572
|
open,
|
|
8484
8573
|
onOpenChange: setOpen
|
|
8485
8574
|
});
|
|
8486
|
-
|
|
8575
|
+
const isTop = useLayer(open);
|
|
8576
|
+
useEffect19(() => {
|
|
8487
8577
|
if (!dismissOnOutsideClick || !open) return;
|
|
8488
8578
|
const dismiss = (event) => {
|
|
8489
8579
|
var _a2;
|
|
8490
8580
|
if ((_a2 = rootRef.current) == null ? void 0 : _a2.contains(event.target)) return;
|
|
8581
|
+
if (!isTop()) return;
|
|
8491
8582
|
setOpen(false);
|
|
8492
8583
|
};
|
|
8493
8584
|
document.addEventListener("click", dismiss);
|
|
@@ -8517,6 +8608,7 @@ var Popover = (_a) => {
|
|
|
8517
8608
|
className: classNames("GeckoUIPopover", className),
|
|
8518
8609
|
onKeyDown: (e) => {
|
|
8519
8610
|
if (!dismissOnEscape || !open || e.key !== "Escape") return;
|
|
8611
|
+
if (!isTop()) return;
|
|
8520
8612
|
e.stopPropagation();
|
|
8521
8613
|
close();
|
|
8522
8614
|
}
|
|
@@ -8567,13 +8659,13 @@ var PopoverTrigger_default = PopoverTrigger;
|
|
|
8567
8659
|
|
|
8568
8660
|
// src/components/Popover/PopoverContent/PopoverContent.tsx
|
|
8569
8661
|
import { FloatingArrow as FloatingArrow2 } from "@floating-ui/react";
|
|
8570
|
-
import { useEffect as
|
|
8662
|
+
import { useEffect as useEffect20, useRef as useRef31 } from "react";
|
|
8571
8663
|
import { jsx as jsx90, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
8572
8664
|
var PopoverContent = (_a) => {
|
|
8573
8665
|
var _b = _a, { className, children } = _b, rest = __objRest(_b, ["className", "children"]);
|
|
8574
8666
|
const { open, arrow: arrow2, arrowRef, floating } = usePopover();
|
|
8575
|
-
const contentRef =
|
|
8576
|
-
|
|
8667
|
+
const contentRef = useRef31(null);
|
|
8668
|
+
useEffect20(() => {
|
|
8577
8669
|
var _a2, _b2;
|
|
8578
8670
|
if (!open) return;
|
|
8579
8671
|
const focusable = (_a2 = contentRef.current) == null ? void 0 : _a2.querySelector(
|
|
@@ -8614,7 +8706,7 @@ PopoverContent.displayName = "PopoverContent";
|
|
|
8614
8706
|
var PopoverContent_default = PopoverContent;
|
|
8615
8707
|
|
|
8616
8708
|
// src/components/ConfirmDialog/ConfirmDialog.tsx
|
|
8617
|
-
import { useCallback as
|
|
8709
|
+
import { useCallback as useCallback8, useEffect as useEffect22, useState as useState26 } from "react";
|
|
8618
8710
|
|
|
8619
8711
|
// src/components/GeckoUIProvider/overlay-store.ts
|
|
8620
8712
|
var OVERLAY_ANIMATION_DURATION = 300;
|
|
@@ -8746,7 +8838,7 @@ var overlayStore = {
|
|
|
8746
8838
|
};
|
|
8747
8839
|
|
|
8748
8840
|
// src/components/Dialog/DialogSurface.tsx
|
|
8749
|
-
import { useCallback as
|
|
8841
|
+
import { useCallback as useCallback7, useEffect as useEffect21, useRef as useRef32, useState as useState25 } from "react";
|
|
8750
8842
|
import { jsx as jsx91 } from "react/jsx-runtime";
|
|
8751
8843
|
function DialogSurface({
|
|
8752
8844
|
open,
|
|
@@ -8763,24 +8855,24 @@ function DialogSurface({
|
|
|
8763
8855
|
const [animationState, setAnimationState] = useState25(
|
|
8764
8856
|
open ? "entering" : "closed"
|
|
8765
8857
|
);
|
|
8766
|
-
const rootRef =
|
|
8767
|
-
const backdropRef =
|
|
8768
|
-
const pressedOutside =
|
|
8769
|
-
const onDismissRef =
|
|
8770
|
-
const onExitedRef =
|
|
8858
|
+
const rootRef = useRef32(null);
|
|
8859
|
+
const backdropRef = useRef32(null);
|
|
8860
|
+
const pressedOutside = useRef32(false);
|
|
8861
|
+
const onDismissRef = useRef32(onDismiss);
|
|
8862
|
+
const onExitedRef = useRef32(onExited);
|
|
8771
8863
|
onDismissRef.current = onDismiss;
|
|
8772
8864
|
onExitedRef.current = onExited;
|
|
8773
|
-
const requestDismiss =
|
|
8865
|
+
const requestDismiss = useCallback7(() => {
|
|
8774
8866
|
var _a;
|
|
8775
8867
|
(_a = onDismissRef.current) == null ? void 0 : _a.call(onDismissRef);
|
|
8776
8868
|
}, []);
|
|
8777
|
-
|
|
8869
|
+
useEffect21(() => {
|
|
8778
8870
|
setAnimationState((current) => {
|
|
8779
8871
|
if (open) return current === "open" ? current : "entering";
|
|
8780
8872
|
return current === "closed" ? current : "closing";
|
|
8781
8873
|
});
|
|
8782
8874
|
}, [open]);
|
|
8783
|
-
|
|
8875
|
+
useEffect21(() => {
|
|
8784
8876
|
if (animationState === "entering") {
|
|
8785
8877
|
let innerFrame = 0;
|
|
8786
8878
|
const outerFrame = requestAnimationFrame(() => {
|
|
@@ -8802,7 +8894,11 @@ function DialogSurface({
|
|
|
8802
8894
|
}, [animationState]);
|
|
8803
8895
|
useScrollLock_default(animationState !== "closed");
|
|
8804
8896
|
const canDismiss = open && isTop && animationState !== "closing";
|
|
8805
|
-
|
|
8897
|
+
const isTopLayer2 = useLayer(open);
|
|
8898
|
+
const dismissIfTopLayer = useCallback7(() => {
|
|
8899
|
+
if (isTopLayer2()) requestDismiss();
|
|
8900
|
+
}, [isTopLayer2, requestDismiss]);
|
|
8901
|
+
useEscListener_default(canDismiss && dismissOnEscape ? dismissIfTopLayer : void 0);
|
|
8806
8902
|
const isOutside = (target) => target === backdropRef.current || target === rootRef.current;
|
|
8807
8903
|
const handleMouseDown = (event) => {
|
|
8808
8904
|
pressedOutside.current = isOutside(event.target);
|
|
@@ -8810,7 +8906,7 @@ function DialogSurface({
|
|
|
8810
8906
|
const handleMouseUp = (event) => {
|
|
8811
8907
|
const shouldDismiss2 = pressedOutside.current && isOutside(event.target);
|
|
8812
8908
|
pressedOutside.current = false;
|
|
8813
|
-
if (shouldDismiss2 && canDismiss && dismissOnOutsideClick)
|
|
8909
|
+
if (shouldDismiss2 && canDismiss && dismissOnOutsideClick) dismissIfTopLayer();
|
|
8814
8910
|
};
|
|
8815
8911
|
if (animationState === "closed") return null;
|
|
8816
8912
|
return /* @__PURE__ */ jsx91(
|
|
@@ -8895,7 +8991,7 @@ function ConfirmDialogContent({
|
|
|
8895
8991
|
const [cancelLoading, setCancelLoading] = useState26(false);
|
|
8896
8992
|
const [confirmLoading, setConfirmLoading] = useState26(false);
|
|
8897
8993
|
const { preventDefault, attachPreventDefault } = usePreventDefault_default();
|
|
8898
|
-
const handleConfirm =
|
|
8994
|
+
const handleConfirm = useCallback8(() => __async(null, null, function* () {
|
|
8899
8995
|
const isAsync = isAsyncFn(onConfirm);
|
|
8900
8996
|
if (isAsync) {
|
|
8901
8997
|
setConfirmLoading(true);
|
|
@@ -8912,7 +9008,7 @@ function ConfirmDialogContent({
|
|
|
8912
9008
|
setCancelLoading(false);
|
|
8913
9009
|
attachPreventDefault(dismiss);
|
|
8914
9010
|
});
|
|
8915
|
-
|
|
9011
|
+
useEffect22(() => {
|
|
8916
9012
|
if (!isTop) return;
|
|
8917
9013
|
const onKeyDown = (e) => {
|
|
8918
9014
|
const el = document.activeElement;
|
|
@@ -9076,7 +9172,7 @@ import { useState as useState28, useSyncExternalStore } from "react";
|
|
|
9076
9172
|
import { createPortal } from "react-dom";
|
|
9077
9173
|
|
|
9078
9174
|
// src/components/Toast/ToastItem.tsx
|
|
9079
|
-
import { useCallback as
|
|
9175
|
+
import { useCallback as useCallback9, useEffect as useEffect23, useRef as useRef33, useState as useState27 } from "react";
|
|
9080
9176
|
|
|
9081
9177
|
// src/components/Toast/Toast.utils.ts
|
|
9082
9178
|
var swipeDirectionsFor = (position) => ({
|
|
@@ -9154,23 +9250,23 @@ function ToastItem({ toast: toast2, defaults, paused, position }) {
|
|
|
9154
9250
|
const [offset10, setOffset] = useState27(0);
|
|
9155
9251
|
const [axis, setAxis] = useState27(null);
|
|
9156
9252
|
const [dragging, setDragging] = useState27(false);
|
|
9157
|
-
const dragFrom =
|
|
9158
|
-
const dragStartedAt =
|
|
9159
|
-
const remaining =
|
|
9160
|
-
const startedAt =
|
|
9161
|
-
const closedBy =
|
|
9162
|
-
const close =
|
|
9253
|
+
const dragFrom = useRef33({ x: 0, y: 0 });
|
|
9254
|
+
const dragStartedAt = useRef33(0);
|
|
9255
|
+
const remaining = useRef33(duration);
|
|
9256
|
+
const startedAt = useRef33(0);
|
|
9257
|
+
const closedBy = useRef33(null);
|
|
9258
|
+
const close = useCallback9((reason) => {
|
|
9163
9259
|
if (closedBy.current) return;
|
|
9164
9260
|
closedBy.current = reason;
|
|
9165
9261
|
setState("closing");
|
|
9166
9262
|
}, []);
|
|
9167
|
-
|
|
9168
|
-
|
|
9263
|
+
useEffect23(() => toastStore.registerDismiss(toast2.id, () => close("manual")), [toast2.id, close]);
|
|
9264
|
+
useEffect23(() => {
|
|
9169
9265
|
const raf = requestAnimationFrame(() => setState("open"));
|
|
9170
9266
|
return () => cancelAnimationFrame(raf);
|
|
9171
9267
|
}, []);
|
|
9172
|
-
const generationRef =
|
|
9173
|
-
|
|
9268
|
+
const generationRef = useRef33(toast2.generation);
|
|
9269
|
+
useEffect23(() => {
|
|
9174
9270
|
if (generationRef.current !== toast2.generation) {
|
|
9175
9271
|
generationRef.current = toast2.generation;
|
|
9176
9272
|
remaining.current = duration;
|
|
@@ -9388,11 +9484,11 @@ function Toaster(_a) {
|
|
|
9388
9484
|
}
|
|
9389
9485
|
|
|
9390
9486
|
// src/components/GeckoUIProvider/GeckoUIProvider.tsx
|
|
9391
|
-
import { useCallback as
|
|
9487
|
+
import { useCallback as useCallback11, useEffect as useEffect25, useRef as useRef35, useState as useState30, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
9392
9488
|
import { createPortal as createPortal2 } from "react-dom";
|
|
9393
9489
|
|
|
9394
9490
|
// src/components/Drawer/Drawer.tsx
|
|
9395
|
-
import { useCallback as
|
|
9491
|
+
import { useCallback as useCallback10, useEffect as useEffect24, useRef as useRef34, useState as useState29, version } from "react";
|
|
9396
9492
|
import { jsx as jsx97, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
9397
9493
|
function Drawer({
|
|
9398
9494
|
open = false,
|
|
@@ -9407,9 +9503,9 @@ function Drawer({
|
|
|
9407
9503
|
keepMounted = false,
|
|
9408
9504
|
style
|
|
9409
9505
|
}) {
|
|
9410
|
-
const drawerRef =
|
|
9506
|
+
const drawerRef = useRef34(null);
|
|
9411
9507
|
const [readyFor, setReadyFor] = useState29(null);
|
|
9412
|
-
|
|
9508
|
+
useEffect24(() => {
|
|
9413
9509
|
const frame = requestAnimationFrame(() => setReadyFor(placement));
|
|
9414
9510
|
return () => cancelAnimationFrame(frame);
|
|
9415
9511
|
}, [placement]);
|
|
@@ -9421,24 +9517,28 @@ function Drawer({
|
|
|
9421
9517
|
setPrevOpen(open);
|
|
9422
9518
|
setClosing(!open);
|
|
9423
9519
|
}
|
|
9424
|
-
|
|
9520
|
+
useEffect24(() => {
|
|
9425
9521
|
if (!closing) return;
|
|
9426
9522
|
const timer = setTimeout(() => setClosing(false), OVERLAY_ANIMATION_DURATION);
|
|
9427
9523
|
return () => clearTimeout(timer);
|
|
9428
9524
|
}, [closing]);
|
|
9429
|
-
const onCloseRef =
|
|
9525
|
+
const onCloseRef = useRef34(onClose);
|
|
9430
9526
|
onCloseRef.current = onClose;
|
|
9431
|
-
const
|
|
9527
|
+
const isTop = useLayer(open);
|
|
9528
|
+
const handleDismiss = useCallback10(() => {
|
|
9432
9529
|
var _a;
|
|
9433
9530
|
(_a = onCloseRef.current) == null ? void 0 : _a.call(onCloseRef);
|
|
9434
9531
|
}, []);
|
|
9435
|
-
const
|
|
9532
|
+
const dismissIfTop = useCallback10(() => {
|
|
9533
|
+
if (isTop()) handleDismiss();
|
|
9534
|
+
}, [isTop, handleDismiss]);
|
|
9535
|
+
const dismissOnClickOutside = useCallback10(() => {
|
|
9436
9536
|
if (!allowClickOutside || !open) return;
|
|
9437
|
-
|
|
9438
|
-
}, [allowClickOutside, open,
|
|
9537
|
+
dismissIfTop();
|
|
9538
|
+
}, [allowClickOutside, open, dismissIfTop]);
|
|
9439
9539
|
useClickOutside_default(dismissOnClickOutside, [drawerRef]);
|
|
9440
9540
|
useScrollLock_default((open || closing) && !allowClickOutside);
|
|
9441
|
-
useEscListener_default(open && dismissOnEscape ?
|
|
9541
|
+
useEscListener_default(open && dismissOnEscape ? dismissIfTop : void 0);
|
|
9442
9542
|
return /* @__PURE__ */ jsxs46("div", { className: "GeckoUIDrawer", style, children: [
|
|
9443
9543
|
/* @__PURE__ */ jsx97(
|
|
9444
9544
|
"div",
|
|
@@ -9446,7 +9546,7 @@ function Drawer({
|
|
|
9446
9546
|
"data-state": visible && !hideBackdrop ? "visible" : "hidden",
|
|
9447
9547
|
"data-clickthrough": allowClickOutside || void 0,
|
|
9448
9548
|
className: classNames("GeckoUIDrawer__backdrop", backdropClassName),
|
|
9449
|
-
onMouseDown: open ?
|
|
9549
|
+
onMouseDown: open ? dismissIfTop : void 0,
|
|
9450
9550
|
role: "presentation"
|
|
9451
9551
|
}
|
|
9452
9552
|
),
|
|
@@ -9491,11 +9591,11 @@ var getNotMounted = () => false;
|
|
|
9491
9591
|
var useIsMounted = () => useSyncExternalStore2(emptySubscribe, getMounted, getNotMounted);
|
|
9492
9592
|
function useOverlayEntry(id) {
|
|
9493
9593
|
const [open, setOpen] = useState30(true);
|
|
9494
|
-
const close =
|
|
9594
|
+
const close = useCallback11(() => {
|
|
9495
9595
|
setOpen(false);
|
|
9496
9596
|
overlayStore.markClosing(id);
|
|
9497
9597
|
}, [id]);
|
|
9498
|
-
const handleExited =
|
|
9598
|
+
const handleExited = useCallback11(() => {
|
|
9499
9599
|
overlayStore.remove(id);
|
|
9500
9600
|
}, [id]);
|
|
9501
9601
|
return { open, close, handleExited };
|
|
@@ -9513,7 +9613,7 @@ function DialogEntryRenderer({ id, options, isTop, zIndex }) {
|
|
|
9513
9613
|
"dismissOnOutsideClick"
|
|
9514
9614
|
]);
|
|
9515
9615
|
const { open, close, handleExited } = useOverlayEntry(id);
|
|
9516
|
-
|
|
9616
|
+
useEffect25(() => overlayStore.registerDismiss(id, close), [id, close]);
|
|
9517
9617
|
return /* @__PURE__ */ jsx98(
|
|
9518
9618
|
DialogSurface,
|
|
9519
9619
|
{
|
|
@@ -9538,15 +9638,15 @@ function DrawerEntryRenderer({
|
|
|
9538
9638
|
zIndex
|
|
9539
9639
|
}) {
|
|
9540
9640
|
const { open, close, handleExited } = useOverlayEntry(id);
|
|
9541
|
-
const onCloseRef =
|
|
9641
|
+
const onCloseRef = useRef35(options.onClose);
|
|
9542
9642
|
onCloseRef.current = options.onClose;
|
|
9543
|
-
const handleClose =
|
|
9643
|
+
const handleClose = useCallback11(() => {
|
|
9544
9644
|
var _a;
|
|
9545
9645
|
(_a = onCloseRef.current) == null ? void 0 : _a.call(onCloseRef);
|
|
9546
9646
|
close();
|
|
9547
9647
|
}, [close]);
|
|
9548
|
-
|
|
9549
|
-
|
|
9648
|
+
useEffect25(() => overlayStore.registerDismiss(id, handleClose), [id, handleClose]);
|
|
9649
|
+
useEffect25(() => {
|
|
9550
9650
|
if (open) return;
|
|
9551
9651
|
const timer = setTimeout(handleExited, OVERLAY_ANIMATION_DURATION);
|
|
9552
9652
|
return () => clearTimeout(timer);
|
|
@@ -9576,7 +9676,7 @@ function OverlayEntryRenderer({
|
|
|
9576
9676
|
function GeckoUIProvider({ children, toastOptions = {} }) {
|
|
9577
9677
|
const mounted2 = useIsMounted();
|
|
9578
9678
|
const [hostId] = useState30(() => overlayStore.createHostId());
|
|
9579
|
-
|
|
9679
|
+
useEffect25(() => overlayStore.registerHost(hostId), [hostId]);
|
|
9580
9680
|
const activeHost2 = useSyncExternalStore2(
|
|
9581
9681
|
overlayStore.subscribe,
|
|
9582
9682
|
overlayStore.getActiveHost,
|
|
@@ -9611,7 +9711,7 @@ function GeckoUIProvider({ children, toastOptions = {} }) {
|
|
|
9611
9711
|
|
|
9612
9712
|
// src/components/Menu/Menu/Menu.tsx
|
|
9613
9713
|
import { autoUpdate as autoUpdate9, flip as flip10, offset as offset9, useFloating as useFloating10 } from "@floating-ui/react";
|
|
9614
|
-
import { Children as Children8, useCallback as
|
|
9714
|
+
import { Children as Children8, useCallback as useCallback12, useRef as useRef37, useState as useState31 } from "react";
|
|
9615
9715
|
|
|
9616
9716
|
// src/components/Menu/Menu.utils.ts
|
|
9617
9717
|
import { isValidElement as isValidElement7 } from "react";
|
|
@@ -9672,7 +9772,7 @@ MenuButton.displayName = "MenuButton";
|
|
|
9672
9772
|
var MenuButton_default = MenuButton;
|
|
9673
9773
|
|
|
9674
9774
|
// src/components/Menu/MenuPanel/MenuPanel.tsx
|
|
9675
|
-
import { useEffect as
|
|
9775
|
+
import { useEffect as useEffect26, useRef as useRef36 } from "react";
|
|
9676
9776
|
import { jsx as jsx100 } from "react/jsx-runtime";
|
|
9677
9777
|
var MenuPanel = ({ children, className }) => {
|
|
9678
9778
|
const {
|
|
@@ -9682,8 +9782,8 @@ var MenuPanel = ({ children, className }) => {
|
|
|
9682
9782
|
menuRef,
|
|
9683
9783
|
floating: { refs, floatingStyles }
|
|
9684
9784
|
} = useMenu();
|
|
9685
|
-
const panelRef =
|
|
9686
|
-
|
|
9785
|
+
const panelRef = useRef36(null);
|
|
9786
|
+
useEffect26(() => {
|
|
9687
9787
|
if (!open || !panelRef.current) return;
|
|
9688
9788
|
panelRef.current.focus();
|
|
9689
9789
|
}, [open]);
|
|
@@ -9747,7 +9847,7 @@ var Menu = ({
|
|
|
9747
9847
|
buttonClassName,
|
|
9748
9848
|
children
|
|
9749
9849
|
}) => {
|
|
9750
|
-
const menuRef =
|
|
9850
|
+
const menuRef = useRef37(null);
|
|
9751
9851
|
const [open, setOpen] = useState31(false);
|
|
9752
9852
|
const floating = useFloating10({
|
|
9753
9853
|
placement,
|
|
@@ -9758,23 +9858,27 @@ var Menu = ({
|
|
|
9758
9858
|
onOpenChange: setOpen
|
|
9759
9859
|
});
|
|
9760
9860
|
const { refs } = floating;
|
|
9761
|
-
const openMenu =
|
|
9861
|
+
const openMenu = useCallback12(() => {
|
|
9762
9862
|
if (disabled || open) return;
|
|
9763
9863
|
setOpen(true);
|
|
9764
9864
|
}, [disabled, open]);
|
|
9765
|
-
const closeMenu =
|
|
9865
|
+
const closeMenu = useCallback12(() => {
|
|
9766
9866
|
setOpen(false);
|
|
9767
9867
|
}, []);
|
|
9768
|
-
const toggleMenu =
|
|
9868
|
+
const toggleMenu = useCallback12(() => {
|
|
9769
9869
|
if (open) {
|
|
9770
9870
|
closeMenu();
|
|
9771
9871
|
} else {
|
|
9772
9872
|
openMenu();
|
|
9773
9873
|
}
|
|
9774
9874
|
}, [open, openMenu, closeMenu]);
|
|
9775
|
-
useClickOutside_default(
|
|
9776
|
-
|
|
9777
|
-
|
|
9875
|
+
useClickOutside_default(
|
|
9876
|
+
() => {
|
|
9877
|
+
closeMenu();
|
|
9878
|
+
},
|
|
9879
|
+
[refs.reference],
|
|
9880
|
+
open
|
|
9881
|
+
);
|
|
9778
9882
|
const childArray = Children8.toArray(children);
|
|
9779
9883
|
const trigger = childArray.find(isMenuTrigger);
|
|
9780
9884
|
const menuItems = childArray.filter((el) => !isMenuTrigger(el));
|