@ecohouse/ui 0.1.61 → 0.1.62
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.cjs +328 -114
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +329 -116
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Checkbox/Checkbox.tsx +6 -0
- package/src/components/Counter/Counter.test.ts +38 -0
- package/src/components/Counter/Counter.tsx +7 -10
- package/src/components/Counter/Counter.utils.ts +28 -0
- package/src/components/DatePicker/DatePicker.tsx +5 -14
- package/src/components/Drawer/Drawer.tsx +15 -12
- package/src/components/Modal/Modal.tsx +31 -11
- package/src/components/RadioButton/RadioButton.tsx +14 -0
- package/src/components/Select/Select.tsx +16 -8
- package/src/components/Toggle/Toggle.tsx +6 -0
- package/src/components/VerificationCodeInput/VerificationCodeInput.test.ts +60 -12
- package/src/components/VerificationCodeInput/VerificationCodeInput.tsx +29 -24
- package/src/components/VerificationCodeInput/VerificationCodeInput.utils.ts +53 -13
- package/src/index.ts +6 -1
- package/src/utils/dateUtils.test.ts +72 -0
- package/src/utils/dateUtils.ts +30 -2
- package/src/utils/focusTrap.test.ts +26 -0
- package/src/utils/focusTrap.ts +39 -0
- package/src/utils/overlayStack.test.ts +175 -0
- package/src/utils/overlayStack.ts +105 -0
- package/src/utils/useHydrated.test.ts +14 -0
- package/src/utils/useHydrated.ts +14 -0
- package/src/utils/useOverlayLayer.ts +41 -0
- package/src/utils/useWebFocusTrap.ts +68 -0
- package/src/utils/webToggleKey.test.ts +49 -0
- package/src/utils/webToggleKey.ts +23 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef, useRef, useMemo, useState, useCallback, useEffect, useLayoutEffect, useId, useImperativeHandle, isValidElement, cloneElement } from 'react';
|
|
1
|
+
import { forwardRef, useRef, useMemo, useState, useCallback, useEffect, useLayoutEffect, useId, useImperativeHandle, useSyncExternalStore, isValidElement, cloneElement } from 'react';
|
|
2
2
|
import { View, Text, Platform, Pressable, StyleSheet, Image, useWindowDimensions, Animated, Easing, TouchableOpacity, ActivityIndicator, Modal as Modal$1, TextInput, ScrollView, PanResponder } from 'react-native';
|
|
3
3
|
import Svg31, { Path, Rect } from 'react-native-svg';
|
|
4
4
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
@@ -18765,29 +18765,29 @@ var require_react_dom_development = __commonJS({
|
|
|
18765
18765
|
}
|
|
18766
18766
|
return [newState, dispatch];
|
|
18767
18767
|
}
|
|
18768
|
-
function mountMutableSource(source, getSnapshot,
|
|
18768
|
+
function mountMutableSource(source, getSnapshot, subscribe2) {
|
|
18769
18769
|
{
|
|
18770
18770
|
return void 0;
|
|
18771
18771
|
}
|
|
18772
18772
|
}
|
|
18773
|
-
function updateMutableSource(source, getSnapshot,
|
|
18773
|
+
function updateMutableSource(source, getSnapshot, subscribe2) {
|
|
18774
18774
|
{
|
|
18775
18775
|
return void 0;
|
|
18776
18776
|
}
|
|
18777
18777
|
}
|
|
18778
|
-
function mountSyncExternalStore(
|
|
18778
|
+
function mountSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot2) {
|
|
18779
18779
|
var fiber = currentlyRenderingFiber$1;
|
|
18780
18780
|
var hook = mountWorkInProgressHook();
|
|
18781
18781
|
var nextSnapshot;
|
|
18782
18782
|
var isHydrating2 = getIsHydrating();
|
|
18783
18783
|
if (isHydrating2) {
|
|
18784
|
-
if (
|
|
18784
|
+
if (getServerSnapshot2 === void 0) {
|
|
18785
18785
|
throw new Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.");
|
|
18786
18786
|
}
|
|
18787
|
-
nextSnapshot =
|
|
18787
|
+
nextSnapshot = getServerSnapshot2();
|
|
18788
18788
|
{
|
|
18789
18789
|
if (!didWarnUncachedGetSnapshot) {
|
|
18790
|
-
if (nextSnapshot !==
|
|
18790
|
+
if (nextSnapshot !== getServerSnapshot2()) {
|
|
18791
18791
|
error("The result of getServerSnapshot should be cached to avoid an infinite loop");
|
|
18792
18792
|
didWarnUncachedGetSnapshot = true;
|
|
18793
18793
|
}
|
|
@@ -18818,12 +18818,12 @@ var require_react_dom_development = __commonJS({
|
|
|
18818
18818
|
getSnapshot
|
|
18819
18819
|
};
|
|
18820
18820
|
hook.queue = inst;
|
|
18821
|
-
mountEffect(subscribeToStore.bind(null, fiber, inst,
|
|
18821
|
+
mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe2), [subscribe2]);
|
|
18822
18822
|
fiber.flags |= Passive;
|
|
18823
18823
|
pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), void 0, null);
|
|
18824
18824
|
return nextSnapshot;
|
|
18825
18825
|
}
|
|
18826
|
-
function updateSyncExternalStore(
|
|
18826
|
+
function updateSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot2) {
|
|
18827
18827
|
var fiber = currentlyRenderingFiber$1;
|
|
18828
18828
|
var hook = updateWorkInProgressHook();
|
|
18829
18829
|
var nextSnapshot = getSnapshot();
|
|
@@ -18843,7 +18843,7 @@ var require_react_dom_development = __commonJS({
|
|
|
18843
18843
|
markWorkInProgressReceivedUpdate();
|
|
18844
18844
|
}
|
|
18845
18845
|
var inst = hook.queue;
|
|
18846
|
-
updateEffect(subscribeToStore.bind(null, fiber, inst,
|
|
18846
|
+
updateEffect(subscribeToStore.bind(null, fiber, inst, subscribe2), [subscribe2]);
|
|
18847
18847
|
if (inst.getSnapshot !== getSnapshot || snapshotChanged || // Check if the susbcribe function changed. We can save some memory by
|
|
18848
18848
|
// checking whether we scheduled a subscription effect above.
|
|
18849
18849
|
workInProgressHook !== null && workInProgressHook.memoizedState.tag & HasEffect) {
|
|
@@ -18886,13 +18886,13 @@ var require_react_dom_development = __commonJS({
|
|
|
18886
18886
|
forceStoreRerender(fiber);
|
|
18887
18887
|
}
|
|
18888
18888
|
}
|
|
18889
|
-
function subscribeToStore(fiber, inst,
|
|
18889
|
+
function subscribeToStore(fiber, inst, subscribe2) {
|
|
18890
18890
|
var handleStoreChange = function() {
|
|
18891
18891
|
if (checkIfSnapshotChanged(inst)) {
|
|
18892
18892
|
forceStoreRerender(fiber);
|
|
18893
18893
|
}
|
|
18894
18894
|
};
|
|
18895
|
-
return
|
|
18895
|
+
return subscribe2(handleStoreChange);
|
|
18896
18896
|
}
|
|
18897
18897
|
function checkIfSnapshotChanged(inst) {
|
|
18898
18898
|
var latestGetSnapshot = inst.getSnapshot;
|
|
@@ -19473,15 +19473,15 @@ var require_react_dom_development = __commonJS({
|
|
|
19473
19473
|
mountHookTypesDev();
|
|
19474
19474
|
return mountTransition();
|
|
19475
19475
|
},
|
|
19476
|
-
useMutableSource: function(source, getSnapshot,
|
|
19476
|
+
useMutableSource: function(source, getSnapshot, subscribe2) {
|
|
19477
19477
|
currentHookNameInDev = "useMutableSource";
|
|
19478
19478
|
mountHookTypesDev();
|
|
19479
19479
|
return mountMutableSource();
|
|
19480
19480
|
},
|
|
19481
|
-
useSyncExternalStore: function(
|
|
19481
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot2) {
|
|
19482
19482
|
currentHookNameInDev = "useSyncExternalStore";
|
|
19483
19483
|
mountHookTypesDev();
|
|
19484
|
-
return mountSyncExternalStore(
|
|
19484
|
+
return mountSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot2);
|
|
19485
19485
|
},
|
|
19486
19486
|
useId: function() {
|
|
19487
19487
|
currentHookNameInDev = "useId";
|
|
@@ -19577,15 +19577,15 @@ var require_react_dom_development = __commonJS({
|
|
|
19577
19577
|
updateHookTypesDev();
|
|
19578
19578
|
return mountTransition();
|
|
19579
19579
|
},
|
|
19580
|
-
useMutableSource: function(source, getSnapshot,
|
|
19580
|
+
useMutableSource: function(source, getSnapshot, subscribe2) {
|
|
19581
19581
|
currentHookNameInDev = "useMutableSource";
|
|
19582
19582
|
updateHookTypesDev();
|
|
19583
19583
|
return mountMutableSource();
|
|
19584
19584
|
},
|
|
19585
|
-
useSyncExternalStore: function(
|
|
19585
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot2) {
|
|
19586
19586
|
currentHookNameInDev = "useSyncExternalStore";
|
|
19587
19587
|
updateHookTypesDev();
|
|
19588
|
-
return mountSyncExternalStore(
|
|
19588
|
+
return mountSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot2);
|
|
19589
19589
|
},
|
|
19590
19590
|
useId: function() {
|
|
19591
19591
|
currentHookNameInDev = "useId";
|
|
@@ -19681,15 +19681,15 @@ var require_react_dom_development = __commonJS({
|
|
|
19681
19681
|
updateHookTypesDev();
|
|
19682
19682
|
return updateTransition();
|
|
19683
19683
|
},
|
|
19684
|
-
useMutableSource: function(source, getSnapshot,
|
|
19684
|
+
useMutableSource: function(source, getSnapshot, subscribe2) {
|
|
19685
19685
|
currentHookNameInDev = "useMutableSource";
|
|
19686
19686
|
updateHookTypesDev();
|
|
19687
19687
|
return updateMutableSource();
|
|
19688
19688
|
},
|
|
19689
|
-
useSyncExternalStore: function(
|
|
19689
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot2) {
|
|
19690
19690
|
currentHookNameInDev = "useSyncExternalStore";
|
|
19691
19691
|
updateHookTypesDev();
|
|
19692
|
-
return updateSyncExternalStore(
|
|
19692
|
+
return updateSyncExternalStore(subscribe2, getSnapshot);
|
|
19693
19693
|
},
|
|
19694
19694
|
useId: function() {
|
|
19695
19695
|
currentHookNameInDev = "useId";
|
|
@@ -19785,15 +19785,15 @@ var require_react_dom_development = __commonJS({
|
|
|
19785
19785
|
updateHookTypesDev();
|
|
19786
19786
|
return rerenderTransition();
|
|
19787
19787
|
},
|
|
19788
|
-
useMutableSource: function(source, getSnapshot,
|
|
19788
|
+
useMutableSource: function(source, getSnapshot, subscribe2) {
|
|
19789
19789
|
currentHookNameInDev = "useMutableSource";
|
|
19790
19790
|
updateHookTypesDev();
|
|
19791
19791
|
return updateMutableSource();
|
|
19792
19792
|
},
|
|
19793
|
-
useSyncExternalStore: function(
|
|
19793
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot2) {
|
|
19794
19794
|
currentHookNameInDev = "useSyncExternalStore";
|
|
19795
19795
|
updateHookTypesDev();
|
|
19796
|
-
return updateSyncExternalStore(
|
|
19796
|
+
return updateSyncExternalStore(subscribe2, getSnapshot);
|
|
19797
19797
|
},
|
|
19798
19798
|
useId: function() {
|
|
19799
19799
|
currentHookNameInDev = "useId";
|
|
@@ -19903,17 +19903,17 @@ var require_react_dom_development = __commonJS({
|
|
|
19903
19903
|
mountHookTypesDev();
|
|
19904
19904
|
return mountTransition();
|
|
19905
19905
|
},
|
|
19906
|
-
useMutableSource: function(source, getSnapshot,
|
|
19906
|
+
useMutableSource: function(source, getSnapshot, subscribe2) {
|
|
19907
19907
|
currentHookNameInDev = "useMutableSource";
|
|
19908
19908
|
warnInvalidHookAccess();
|
|
19909
19909
|
mountHookTypesDev();
|
|
19910
19910
|
return mountMutableSource();
|
|
19911
19911
|
},
|
|
19912
|
-
useSyncExternalStore: function(
|
|
19912
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot2) {
|
|
19913
19913
|
currentHookNameInDev = "useSyncExternalStore";
|
|
19914
19914
|
warnInvalidHookAccess();
|
|
19915
19915
|
mountHookTypesDev();
|
|
19916
|
-
return mountSyncExternalStore(
|
|
19916
|
+
return mountSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot2);
|
|
19917
19917
|
},
|
|
19918
19918
|
useId: function() {
|
|
19919
19919
|
currentHookNameInDev = "useId";
|
|
@@ -20024,17 +20024,17 @@ var require_react_dom_development = __commonJS({
|
|
|
20024
20024
|
updateHookTypesDev();
|
|
20025
20025
|
return updateTransition();
|
|
20026
20026
|
},
|
|
20027
|
-
useMutableSource: function(source, getSnapshot,
|
|
20027
|
+
useMutableSource: function(source, getSnapshot, subscribe2) {
|
|
20028
20028
|
currentHookNameInDev = "useMutableSource";
|
|
20029
20029
|
warnInvalidHookAccess();
|
|
20030
20030
|
updateHookTypesDev();
|
|
20031
20031
|
return updateMutableSource();
|
|
20032
20032
|
},
|
|
20033
|
-
useSyncExternalStore: function(
|
|
20033
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot2) {
|
|
20034
20034
|
currentHookNameInDev = "useSyncExternalStore";
|
|
20035
20035
|
warnInvalidHookAccess();
|
|
20036
20036
|
updateHookTypesDev();
|
|
20037
|
-
return updateSyncExternalStore(
|
|
20037
|
+
return updateSyncExternalStore(subscribe2, getSnapshot);
|
|
20038
20038
|
},
|
|
20039
20039
|
useId: function() {
|
|
20040
20040
|
currentHookNameInDev = "useId";
|
|
@@ -20145,17 +20145,17 @@ var require_react_dom_development = __commonJS({
|
|
|
20145
20145
|
updateHookTypesDev();
|
|
20146
20146
|
return rerenderTransition();
|
|
20147
20147
|
},
|
|
20148
|
-
useMutableSource: function(source, getSnapshot,
|
|
20148
|
+
useMutableSource: function(source, getSnapshot, subscribe2) {
|
|
20149
20149
|
currentHookNameInDev = "useMutableSource";
|
|
20150
20150
|
warnInvalidHookAccess();
|
|
20151
20151
|
updateHookTypesDev();
|
|
20152
20152
|
return updateMutableSource();
|
|
20153
20153
|
},
|
|
20154
|
-
useSyncExternalStore: function(
|
|
20154
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot2) {
|
|
20155
20155
|
currentHookNameInDev = "useSyncExternalStore";
|
|
20156
20156
|
warnInvalidHookAccess();
|
|
20157
20157
|
updateHookTypesDev();
|
|
20158
|
-
return updateSyncExternalStore(
|
|
20158
|
+
return updateSyncExternalStore(subscribe2, getSnapshot);
|
|
20159
20159
|
},
|
|
20160
20160
|
useId: function() {
|
|
20161
20161
|
currentHookNameInDev = "useId";
|
|
@@ -33156,14 +33156,23 @@ var styles18 = StyleSheet.create({
|
|
|
33156
33156
|
includeFontPadding: false
|
|
33157
33157
|
}
|
|
33158
33158
|
});
|
|
33159
|
+
|
|
33160
|
+
// src/components/Counter/Counter.utils.ts
|
|
33161
|
+
function clampCounterValue(value, min, max) {
|
|
33162
|
+
return Math.max(min, max === void 0 ? value : Math.min(value, max));
|
|
33163
|
+
}
|
|
33164
|
+
function resolveCounterValue(controlledValue, uncontrolledValue, min, max) {
|
|
33165
|
+
if (controlledValue !== void 0 && Number.isFinite(controlledValue)) return controlledValue;
|
|
33166
|
+
return clampCounterValue(controlledValue === void 0 ? uncontrolledValue : min, min, max);
|
|
33167
|
+
}
|
|
33168
|
+
function stepCounterValue(current, delta, min, max) {
|
|
33169
|
+
return clampCounterValue(current + delta, min, max);
|
|
33170
|
+
}
|
|
33159
33171
|
var BUTTON_SIZE = 32;
|
|
33160
33172
|
var webBlurStyle7 = Platform.OS === "web" ? {
|
|
33161
33173
|
backdropFilter: "blur(20px)",
|
|
33162
33174
|
WebkitBackdropFilter: "blur(20px)"
|
|
33163
33175
|
} : {};
|
|
33164
|
-
function clamp(value, min, max) {
|
|
33165
|
-
return Math.max(min, max === void 0 ? value : Math.min(value, max));
|
|
33166
|
-
}
|
|
33167
33176
|
var Counter = forwardRef(function Counter2({
|
|
33168
33177
|
value,
|
|
33169
33178
|
defaultValue,
|
|
@@ -33181,16 +33190,16 @@ var Counter = forwardRef(function Counter2({
|
|
|
33181
33190
|
const containerRef = useRef(null);
|
|
33182
33191
|
const isControlled = value !== void 0;
|
|
33183
33192
|
const [uncontrolledValue, setUncontrolledValue] = useState(
|
|
33184
|
-
() =>
|
|
33193
|
+
() => clampCounterValue(defaultValue ?? min, min, max)
|
|
33185
33194
|
);
|
|
33186
|
-
const resolvedValue =
|
|
33195
|
+
const resolvedValue = resolveCounterValue(value, uncontrolledValue, min, max);
|
|
33187
33196
|
const resolvedClassName = className?.trim() || void 0;
|
|
33188
33197
|
const setContainerRef = useMemo(() => mergeRefs(containerRef, forwardedRef), [forwardedRef]);
|
|
33189
33198
|
const decrementDisabled = disabled || resolvedValue <= min;
|
|
33190
33199
|
const incrementDisabled = disabled || max !== void 0 && resolvedValue >= max;
|
|
33191
33200
|
useApplyWebClassName(containerRef, resolvedClassName);
|
|
33192
|
-
const updateValue = (
|
|
33193
|
-
const next =
|
|
33201
|
+
const updateValue = (delta) => {
|
|
33202
|
+
const next = stepCounterValue(resolvedValue, delta, min, max);
|
|
33194
33203
|
if (next === resolvedValue) return;
|
|
33195
33204
|
if (!isControlled) setUncontrolledValue(next);
|
|
33196
33205
|
onValueChange?.(next);
|
|
@@ -33200,7 +33209,7 @@ var Counter = forwardRef(function Counter2({
|
|
|
33200
33209
|
{
|
|
33201
33210
|
disabled: decrementDisabled,
|
|
33202
33211
|
hitSlop,
|
|
33203
|
-
onPress: () => updateValue(
|
|
33212
|
+
onPress: () => updateValue(-step),
|
|
33204
33213
|
accessibilityRole: "button",
|
|
33205
33214
|
accessibilityLabel: "Decrease value",
|
|
33206
33215
|
accessibilityState: { disabled: decrementDisabled },
|
|
@@ -33213,7 +33222,7 @@ var Counter = forwardRef(function Counter2({
|
|
|
33213
33222
|
{
|
|
33214
33223
|
disabled: incrementDisabled,
|
|
33215
33224
|
hitSlop,
|
|
33216
|
-
onPress: () => updateValue(
|
|
33225
|
+
onPress: () => updateValue(step),
|
|
33217
33226
|
accessibilityRole: "button",
|
|
33218
33227
|
accessibilityLabel: "Increase value",
|
|
33219
33228
|
accessibilityState: { disabled: incrementDisabled },
|
|
@@ -34496,6 +34505,15 @@ var styles25 = StyleSheet.create({
|
|
|
34496
34505
|
top: 0
|
|
34497
34506
|
}
|
|
34498
34507
|
});
|
|
34508
|
+
|
|
34509
|
+
// src/utils/webToggleKey.ts
|
|
34510
|
+
function handleWebToggleKeyDown(event, onToggle) {
|
|
34511
|
+
const isSpace = event.key === " " || event.key === "Spacebar";
|
|
34512
|
+
if (!isSpace || event.target !== event.currentTarget) return false;
|
|
34513
|
+
event.preventDefault();
|
|
34514
|
+
if (!event.repeat) onToggle();
|
|
34515
|
+
return true;
|
|
34516
|
+
}
|
|
34499
34517
|
var BOX_SIZE = 20;
|
|
34500
34518
|
var BOX_RADIUS = 6;
|
|
34501
34519
|
var CHECK_SIZE = 12;
|
|
@@ -34551,6 +34569,8 @@ var Checkbox = forwardRef(function Checkbox2({
|
|
|
34551
34569
|
accessibilityRole: "checkbox",
|
|
34552
34570
|
accessibilityLabel: resolvedAccessibilityLabel,
|
|
34553
34571
|
accessibilityState: { checked: isActive, disabled },
|
|
34572
|
+
"aria-checked": isActive,
|
|
34573
|
+
...Platform.OS === "web" && !disabled ? { onKeyDown: (event) => handleWebToggleKeyDown(event, handlePress) } : null,
|
|
34554
34574
|
style: [styles26.root, disabled && styles26.disabled, style],
|
|
34555
34575
|
children: [
|
|
34556
34576
|
/* @__PURE__ */ jsx(
|
|
@@ -34644,8 +34664,23 @@ function abbreviateMonthName(monthName, letterCount = 3) {
|
|
|
34644
34664
|
}
|
|
34645
34665
|
return chars.slice(0, end).join("");
|
|
34646
34666
|
}
|
|
34667
|
+
function abbreviateMonthNames(monthNames, letterCount = 3) {
|
|
34668
|
+
return monthNames.map((name, index) => {
|
|
34669
|
+
const maxLetters = abbreviatedLetterCount(name);
|
|
34670
|
+
let count = letterCount;
|
|
34671
|
+
while (count < maxLetters && monthNames.some(
|
|
34672
|
+
(other, otherIndex) => otherIndex !== index && abbreviateMonthName(other, count) === abbreviateMonthName(name, count)
|
|
34673
|
+
)) {
|
|
34674
|
+
count += 1;
|
|
34675
|
+
}
|
|
34676
|
+
return abbreviateMonthName(name, count);
|
|
34677
|
+
});
|
|
34678
|
+
}
|
|
34679
|
+
function abbreviatedLetterCount(monthName) {
|
|
34680
|
+
return Array.from(monthName.replace(/ու/g, "u")).length;
|
|
34681
|
+
}
|
|
34647
34682
|
function formatDateDayShortMonth(date, monthNames, letterCount = 3) {
|
|
34648
|
-
const month =
|
|
34683
|
+
const month = abbreviateMonthNames(monthNames, letterCount)[date.getMonth()] ?? "";
|
|
34649
34684
|
return `${date.getDate()} ${month} ${date.getFullYear()}`;
|
|
34650
34685
|
}
|
|
34651
34686
|
function getMonthMatrix(monthDate, weekStartsOn = 1) {
|
|
@@ -34669,6 +34704,78 @@ function getMonthMatrix(monthDate, weekStartsOn = 1) {
|
|
|
34669
34704
|
}
|
|
34670
34705
|
return weeks;
|
|
34671
34706
|
}
|
|
34707
|
+
|
|
34708
|
+
// src/utils/overlayStack.ts
|
|
34709
|
+
function createOverlayStack(target) {
|
|
34710
|
+
const layers = [];
|
|
34711
|
+
const top = (kind) => {
|
|
34712
|
+
for (let index = layers.length - 1; index >= 0; index -= 1) {
|
|
34713
|
+
if (layers[index].kind === kind) return layers[index];
|
|
34714
|
+
}
|
|
34715
|
+
return void 0;
|
|
34716
|
+
};
|
|
34717
|
+
const handleCapture = (event) => {
|
|
34718
|
+
const layer = top("popover");
|
|
34719
|
+
if (event.key !== "Escape" || event.defaultPrevented || !layer) return;
|
|
34720
|
+
event.preventDefault();
|
|
34721
|
+
event.stopImmediatePropagation();
|
|
34722
|
+
layer.onEscape();
|
|
34723
|
+
};
|
|
34724
|
+
const handleBubble = (event) => {
|
|
34725
|
+
const layer = top("overlay");
|
|
34726
|
+
if (event.key !== "Escape" || event.defaultPrevented || !layer) return;
|
|
34727
|
+
event.preventDefault();
|
|
34728
|
+
layer.onEscape();
|
|
34729
|
+
};
|
|
34730
|
+
return {
|
|
34731
|
+
push(layer) {
|
|
34732
|
+
layers.push(layer);
|
|
34733
|
+
if (layers.length === 1) {
|
|
34734
|
+
target.addEventListener("keydown", handleCapture, true);
|
|
34735
|
+
target.addEventListener("keydown", handleBubble, false);
|
|
34736
|
+
}
|
|
34737
|
+
return () => {
|
|
34738
|
+
const index = layers.indexOf(layer);
|
|
34739
|
+
if (index === -1) return;
|
|
34740
|
+
layers.splice(index, 1);
|
|
34741
|
+
if (layers.length === 0) {
|
|
34742
|
+
target.removeEventListener("keydown", handleCapture, true);
|
|
34743
|
+
target.removeEventListener("keydown", handleBubble, false);
|
|
34744
|
+
}
|
|
34745
|
+
};
|
|
34746
|
+
},
|
|
34747
|
+
isTop: (layer) => top(layer.kind) === layer
|
|
34748
|
+
};
|
|
34749
|
+
}
|
|
34750
|
+
var documentStack = null;
|
|
34751
|
+
function getDocumentOverlayStack() {
|
|
34752
|
+
if (!documentStack) {
|
|
34753
|
+
documentStack = createOverlayStack(document);
|
|
34754
|
+
}
|
|
34755
|
+
return documentStack;
|
|
34756
|
+
}
|
|
34757
|
+
|
|
34758
|
+
// src/utils/useOverlayLayer.ts
|
|
34759
|
+
function useOverlayLayer(kind, active, onEscape) {
|
|
34760
|
+
const onEscapeRef = useRef(onEscape);
|
|
34761
|
+
onEscapeRef.current = onEscape;
|
|
34762
|
+
const layerRef = useRef(null);
|
|
34763
|
+
useEffect(() => {
|
|
34764
|
+
if (!active || Platform.OS !== "web" || typeof document === "undefined") return void 0;
|
|
34765
|
+
const layer = { kind, onEscape: () => onEscapeRef.current() };
|
|
34766
|
+
const stack = getDocumentOverlayStack();
|
|
34767
|
+
const remove = stack.push(layer);
|
|
34768
|
+
layerRef.current = layer;
|
|
34769
|
+
return () => {
|
|
34770
|
+
remove();
|
|
34771
|
+
if (layerRef.current === layer) layerRef.current = null;
|
|
34772
|
+
};
|
|
34773
|
+
}, [active, kind]);
|
|
34774
|
+
return useCallback(() => {
|
|
34775
|
+
const layer = layerRef.current;
|
|
34776
|
+
return layer !== null && getDocumentOverlayStack().isTop(layer);
|
|
34777
|
+
}, []);
|
|
34778
|
+
}
|
|
34672
34779
|
var DEFAULT_MONTH_NAMES = [
|
|
34673
34780
|
"\u0540\u0578\u0582\u0576\u057E\u0561\u0580",
|
|
34674
34781
|
"\u0553\u0565\u057F\u0580\u057E\u0561\u0580",
|
|
@@ -34863,17 +34970,7 @@ var DatePicker = forwardRef(
|
|
|
34863
34970
|
setOpen(false);
|
|
34864
34971
|
focusTrigger();
|
|
34865
34972
|
}, [focusTrigger, setOpen]);
|
|
34866
|
-
|
|
34867
|
-
if (Platform.OS !== "web" || !isOpen) return;
|
|
34868
|
-
const handleKeyDown = (event) => {
|
|
34869
|
-
if (event.key === "Escape") {
|
|
34870
|
-
event.preventDefault();
|
|
34871
|
-
closeAndFocusTrigger();
|
|
34872
|
-
}
|
|
34873
|
-
};
|
|
34874
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
34875
|
-
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
34876
|
-
}, [isOpen, closeAndFocusTrigger]);
|
|
34973
|
+
useOverlayLayer("popover", isOpen, closeAndFocusTrigger);
|
|
34877
34974
|
const handleTriggerPress = () => {
|
|
34878
34975
|
if (disabled) return;
|
|
34879
34976
|
setOpen(!isOpen);
|
|
@@ -34963,6 +35060,7 @@ var DatePicker = forwardRef(
|
|
|
34963
35060
|
accessibilityRole: "button",
|
|
34964
35061
|
accessibilityLabel: resolvedAccessibilityLabel,
|
|
34965
35062
|
accessibilityState: { disabled, expanded: isOpen },
|
|
35063
|
+
"aria-expanded": isOpen,
|
|
34966
35064
|
style: [
|
|
34967
35065
|
styles27.trigger,
|
|
34968
35066
|
usesRangeTrigger && styles27.rangeTrigger,
|
|
@@ -35521,6 +35619,78 @@ var styles28 = StyleSheet.create({
|
|
|
35521
35619
|
|
|
35522
35620
|
// src/components/Modal/Modal.tsx
|
|
35523
35621
|
var import_react_dom = __toESM(require_react_dom());
|
|
35622
|
+
var subscribe = () => () => {
|
|
35623
|
+
};
|
|
35624
|
+
var getClientSnapshot = () => true;
|
|
35625
|
+
var getServerSnapshot = () => false;
|
|
35626
|
+
function useHydrated() {
|
|
35627
|
+
return useSyncExternalStore(subscribe, getClientSnapshot, getServerSnapshot);
|
|
35628
|
+
}
|
|
35629
|
+
|
|
35630
|
+
// src/utils/focusTrap.ts
|
|
35631
|
+
var TABBABLE_SELECTOR = [
|
|
35632
|
+
"a[href]",
|
|
35633
|
+
"area[href]",
|
|
35634
|
+
"button",
|
|
35635
|
+
"input:not([type='hidden'])",
|
|
35636
|
+
"select",
|
|
35637
|
+
"textarea",
|
|
35638
|
+
"iframe",
|
|
35639
|
+
"[contenteditable='true']",
|
|
35640
|
+
"[tabindex]"
|
|
35641
|
+
].join(",");
|
|
35642
|
+
function getTabbableElements(container) {
|
|
35643
|
+
return Array.from(container.querySelectorAll(TABBABLE_SELECTOR)).filter(
|
|
35644
|
+
(element) => element.tabIndex >= 0 && !element.hasAttribute("disabled") && element.getAttribute("aria-hidden") !== "true" && element.getClientRects().length > 0
|
|
35645
|
+
);
|
|
35646
|
+
}
|
|
35647
|
+
function getWrappedFocusIndex(count, currentIndex, backwards) {
|
|
35648
|
+
if (count === 0) return null;
|
|
35649
|
+
if (currentIndex === -1) return backwards ? count - 1 : 0;
|
|
35650
|
+
if (backwards && currentIndex === 0) return count - 1;
|
|
35651
|
+
if (!backwards && currentIndex === count - 1) return 0;
|
|
35652
|
+
return null;
|
|
35653
|
+
}
|
|
35654
|
+
|
|
35655
|
+
// src/utils/useWebFocusTrap.ts
|
|
35656
|
+
function useWebFocusTrap(containerRef, active, isTopLayer) {
|
|
35657
|
+
useEffect(() => {
|
|
35658
|
+
if (!active || Platform.OS !== "web" || typeof document === "undefined") return void 0;
|
|
35659
|
+
const container = containerRef.current;
|
|
35660
|
+
if (!container) return void 0;
|
|
35661
|
+
const previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
35662
|
+
if (!container.contains(document.activeElement)) container.focus({ preventScroll: true });
|
|
35663
|
+
const handleKeyDown = (event) => {
|
|
35664
|
+
if (event.key !== "Tab" || event.defaultPrevented || !isTopLayer()) return;
|
|
35665
|
+
const activeElement = document.activeElement;
|
|
35666
|
+
if (activeElement !== null && activeElement !== document.body && !container.contains(activeElement)) {
|
|
35667
|
+
return;
|
|
35668
|
+
}
|
|
35669
|
+
const tabbables = getTabbableElements(container);
|
|
35670
|
+
if (tabbables.length === 0) {
|
|
35671
|
+
event.preventDefault();
|
|
35672
|
+
container.focus({ preventScroll: true });
|
|
35673
|
+
return;
|
|
35674
|
+
}
|
|
35675
|
+
const nextIndex = getWrappedFocusIndex(
|
|
35676
|
+
tabbables.length,
|
|
35677
|
+
tabbables.indexOf(activeElement),
|
|
35678
|
+
event.shiftKey
|
|
35679
|
+
);
|
|
35680
|
+
if (nextIndex === null) return;
|
|
35681
|
+
event.preventDefault();
|
|
35682
|
+
tabbables[nextIndex].focus();
|
|
35683
|
+
};
|
|
35684
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
35685
|
+
return () => {
|
|
35686
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
35687
|
+
const current = document.activeElement;
|
|
35688
|
+
if (previouslyFocused?.isConnected && (current === null || current === document.body || container.contains(current))) {
|
|
35689
|
+
previouslyFocused.focus({ preventScroll: true });
|
|
35690
|
+
}
|
|
35691
|
+
};
|
|
35692
|
+
}, [active, containerRef, isTopLayer]);
|
|
35693
|
+
}
|
|
35524
35694
|
var BACKDROP_COLOR = "#09090933";
|
|
35525
35695
|
var WEB_Z_INDEX = 500;
|
|
35526
35696
|
var webBackdropDomStyle = {
|
|
@@ -35548,6 +35718,13 @@ var webRootDomStyle = {
|
|
|
35548
35718
|
alignItems: "center",
|
|
35549
35719
|
justifyContent: "center"
|
|
35550
35720
|
};
|
|
35721
|
+
var webDialogDomStyle = {
|
|
35722
|
+
position: "relative",
|
|
35723
|
+
zIndex: 1,
|
|
35724
|
+
maxWidth: "100%",
|
|
35725
|
+
maxHeight: "100%",
|
|
35726
|
+
outline: "none"
|
|
35727
|
+
};
|
|
35551
35728
|
var Modal = forwardRef(function Modal2({
|
|
35552
35729
|
open,
|
|
35553
35730
|
onClose,
|
|
@@ -35558,22 +35735,22 @@ var Modal = forwardRef(function Modal2({
|
|
|
35558
35735
|
className
|
|
35559
35736
|
}, forwardedRef) {
|
|
35560
35737
|
const contentRef = useRef(null);
|
|
35738
|
+
const dialogRef = useRef(null);
|
|
35561
35739
|
const setContentRef = useMemo(() => mergeRefs(contentRef, forwardedRef), [forwardedRef]);
|
|
35562
35740
|
const resolvedClassName = className?.trim() || void 0;
|
|
35563
|
-
|
|
35741
|
+
const hydrated = useHydrated();
|
|
35742
|
+
const webOpen = open && hydrated && Platform.OS === "web";
|
|
35743
|
+
useApplyWebClassName(contentRef, resolvedClassName, webOpen);
|
|
35564
35744
|
useEffect(() => {
|
|
35565
|
-
if (!
|
|
35745
|
+
if (!webOpen) return void 0;
|
|
35566
35746
|
const previousOverflow = document.body.style.overflow;
|
|
35567
35747
|
document.body.style.overflow = "hidden";
|
|
35568
|
-
const onKeyDown = (event) => {
|
|
35569
|
-
if (event.key === "Escape") onClose();
|
|
35570
|
-
};
|
|
35571
|
-
document.addEventListener("keydown", onKeyDown);
|
|
35572
35748
|
return () => {
|
|
35573
35749
|
document.body.style.overflow = previousOverflow;
|
|
35574
|
-
document.removeEventListener("keydown", onKeyDown);
|
|
35575
35750
|
};
|
|
35576
|
-
}, [
|
|
35751
|
+
}, [webOpen]);
|
|
35752
|
+
const isTopLayer = useOverlayLayer("overlay", webOpen, onClose);
|
|
35753
|
+
useWebFocusTrap(dialogRef, webOpen, isTopLayer);
|
|
35577
35754
|
const content = /* @__PURE__ */ jsx(
|
|
35578
35755
|
View,
|
|
35579
35756
|
{
|
|
@@ -35584,7 +35761,7 @@ var Modal = forwardRef(function Modal2({
|
|
|
35584
35761
|
}
|
|
35585
35762
|
);
|
|
35586
35763
|
if (Platform.OS === "web") {
|
|
35587
|
-
if (!
|
|
35764
|
+
if (!webOpen) return null;
|
|
35588
35765
|
return (0, import_react_dom.createPortal)(
|
|
35589
35766
|
/* @__PURE__ */ jsxs("div", { style: webRootDomStyle, role: "presentation", children: [
|
|
35590
35767
|
/* @__PURE__ */ jsx(
|
|
@@ -35597,7 +35774,16 @@ var Modal = forwardRef(function Modal2({
|
|
|
35597
35774
|
style: webBackdropDomStyle
|
|
35598
35775
|
}
|
|
35599
35776
|
),
|
|
35600
|
-
/* @__PURE__ */ jsx(
|
|
35777
|
+
/* @__PURE__ */ jsx(
|
|
35778
|
+
"div",
|
|
35779
|
+
{
|
|
35780
|
+
ref: dialogRef,
|
|
35781
|
+
role: "dialog",
|
|
35782
|
+
tabIndex: -1,
|
|
35783
|
+
style: webDialogDomStyle,
|
|
35784
|
+
children: content
|
|
35785
|
+
}
|
|
35786
|
+
)
|
|
35601
35787
|
] }),
|
|
35602
35788
|
document.body
|
|
35603
35789
|
);
|
|
@@ -35672,20 +35858,18 @@ var Drawer = forwardRef(function Drawer2({
|
|
|
35672
35858
|
const [entered, setEntered] = useState(false);
|
|
35673
35859
|
const animatedWidth = useRef(new Animated.Value(open ? width : 0)).current;
|
|
35674
35860
|
const animatedBackdrop = useRef(new Animated.Value(open ? 1 : 0)).current;
|
|
35675
|
-
|
|
35861
|
+
const hydrated = useHydrated();
|
|
35862
|
+
const webMounted = mounted && hydrated && Platform.OS === "web";
|
|
35863
|
+
useApplyWebClassName(panelRef, resolvedClassName, webMounted);
|
|
35676
35864
|
useEffect(() => {
|
|
35677
|
-
if (!
|
|
35865
|
+
if (!webMounted) return void 0;
|
|
35678
35866
|
const previousOverflow = document.body.style.overflow;
|
|
35679
35867
|
document.body.style.overflow = "hidden";
|
|
35680
|
-
const onKeyDown = (event) => {
|
|
35681
|
-
if (event.key === "Escape") onClose();
|
|
35682
|
-
};
|
|
35683
|
-
document.addEventListener("keydown", onKeyDown);
|
|
35684
35868
|
return () => {
|
|
35685
35869
|
document.body.style.overflow = previousOverflow;
|
|
35686
|
-
document.removeEventListener("keydown", onKeyDown);
|
|
35687
35870
|
};
|
|
35688
|
-
}, [
|
|
35871
|
+
}, [webMounted]);
|
|
35872
|
+
useOverlayLayer("overlay", webMounted && open, onClose);
|
|
35689
35873
|
const targetWidth = Math.min(width, typeof window !== "undefined" ? window.innerWidth : width);
|
|
35690
35874
|
const playWidth = useCallback(
|
|
35691
35875
|
(target) => {
|
|
@@ -35726,7 +35910,7 @@ var Drawer = forwardRef(function Drawer2({
|
|
|
35726
35910
|
};
|
|
35727
35911
|
}, [open, animationDuration, playWidth]);
|
|
35728
35912
|
useEffect(() => {
|
|
35729
|
-
if (
|
|
35913
|
+
if (!webMounted || !open) return void 0;
|
|
35730
35914
|
const shell = shellRef.current;
|
|
35731
35915
|
if (shell) {
|
|
35732
35916
|
shell.style.transition = "none";
|
|
@@ -35739,7 +35923,7 @@ var Drawer = forwardRef(function Drawer2({
|
|
|
35739
35923
|
});
|
|
35740
35924
|
});
|
|
35741
35925
|
return () => cancelAnimationFrame(frame);
|
|
35742
|
-
}, [
|
|
35926
|
+
}, [webMounted, open, targetWidth, playWidth]);
|
|
35743
35927
|
useEffect(() => {
|
|
35744
35928
|
if (Platform.OS === "web") return void 0;
|
|
35745
35929
|
if (open) {
|
|
@@ -35820,7 +36004,7 @@ var Drawer = forwardRef(function Drawer2({
|
|
|
35820
36004
|
}
|
|
35821
36005
|
);
|
|
35822
36006
|
if (Platform.OS === "web") {
|
|
35823
|
-
if (!
|
|
36007
|
+
if (!webMounted) return null;
|
|
35824
36008
|
return (0, import_react_dom2.createPortal)(
|
|
35825
36009
|
/* @__PURE__ */ jsxs(
|
|
35826
36010
|
"div",
|
|
@@ -36520,21 +36704,42 @@ var styles32 = StyleSheet.create({
|
|
|
36520
36704
|
function normalizeVerificationCode(value, length) {
|
|
36521
36705
|
return value.replace(/\D/g, "").slice(0, Math.max(1, length));
|
|
36522
36706
|
}
|
|
36523
|
-
function
|
|
36707
|
+
function toVerificationCells(code, length) {
|
|
36708
|
+
const safeLength = Math.max(1, length);
|
|
36709
|
+
const digits = normalizeVerificationCode(code, safeLength);
|
|
36710
|
+
return Array.from({ length: safeLength }, (_, index) => digits[index] ?? "");
|
|
36711
|
+
}
|
|
36712
|
+
function verificationCellsToCode(cells) {
|
|
36713
|
+
return cells.join("");
|
|
36714
|
+
}
|
|
36715
|
+
function isVerificationCodeComplete(cells) {
|
|
36716
|
+
return cells.length > 0 && cells.every((cell) => cell !== "");
|
|
36717
|
+
}
|
|
36718
|
+
function reconcileVerificationCells(cells, code, length) {
|
|
36719
|
+
const safeLength = Math.max(1, length);
|
|
36720
|
+
const normalized = normalizeVerificationCode(code, safeLength);
|
|
36721
|
+
if (cells.length === safeLength && verificationCellsToCode(cells) === normalized) {
|
|
36722
|
+
return [...cells];
|
|
36723
|
+
}
|
|
36724
|
+
return toVerificationCells(normalized, safeLength);
|
|
36725
|
+
}
|
|
36726
|
+
function updateVerificationCells(currentCells, index, input, length) {
|
|
36524
36727
|
const safeLength = Math.max(1, length);
|
|
36525
36728
|
const safeIndex = Math.min(Math.max(0, index), safeLength - 1);
|
|
36526
|
-
const
|
|
36729
|
+
const cells = Array.from({ length: safeLength }, (_, cellIndex) => {
|
|
36730
|
+
const cell = currentCells[cellIndex] ?? "";
|
|
36731
|
+
return /^\d$/.test(cell) ? cell : "";
|
|
36732
|
+
});
|
|
36527
36733
|
const insertedDigits = normalizeVerificationCode(input, safeLength - safeIndex);
|
|
36528
36734
|
if (!insertedDigits) {
|
|
36529
|
-
|
|
36530
|
-
|
|
36531
|
-
nextFocus: safeIndex
|
|
36532
|
-
};
|
|
36735
|
+
cells[safeIndex] = "";
|
|
36736
|
+
return { cells, nextFocus: safeIndex };
|
|
36533
36737
|
}
|
|
36738
|
+
Array.from(insertedDigits).forEach((digit, offset) => {
|
|
36739
|
+
cells[safeIndex + offset] = digit;
|
|
36740
|
+
});
|
|
36534
36741
|
return {
|
|
36535
|
-
|
|
36536
|
-
safeIndex + insertedDigits.length
|
|
36537
|
-
)}`.slice(0, safeLength),
|
|
36742
|
+
cells,
|
|
36538
36743
|
nextFocus: Math.min(safeIndex + insertedDigits.length, safeLength - 1)
|
|
36539
36744
|
};
|
|
36540
36745
|
}
|
|
@@ -36565,17 +36770,17 @@ var VerificationCodeInput = forwardRef(function VerificationCodeInput2({
|
|
|
36565
36770
|
}, forwardedRef) {
|
|
36566
36771
|
const safeLength = Math.max(1, Math.floor(length));
|
|
36567
36772
|
const isControlled = typeof value === "string";
|
|
36568
|
-
const [
|
|
36569
|
-
() => normalizeVerificationCode(defaultValue, safeLength)
|
|
36570
|
-
);
|
|
36773
|
+
const [cellsState, setCellsState] = useState(() => toVerificationCells(defaultValue, safeLength));
|
|
36571
36774
|
const [focusedIndex, setFocusedIndex] = useState(null);
|
|
36572
36775
|
const { width: viewportWidth } = useWindowDimensions();
|
|
36573
36776
|
const rootRef = useRef(null);
|
|
36574
36777
|
const inputRefs = useRef([]);
|
|
36575
|
-
const
|
|
36576
|
-
|
|
36778
|
+
const cells = reconcileVerificationCells(
|
|
36779
|
+
cellsState,
|
|
36780
|
+
isControlled ? value : verificationCellsToCode(cellsState),
|
|
36577
36781
|
safeLength
|
|
36578
36782
|
);
|
|
36783
|
+
const currentCode = verificationCellsToCode(cells);
|
|
36579
36784
|
useApplyWebClassName(rootRef, className);
|
|
36580
36785
|
const focus = useCallback(
|
|
36581
36786
|
(index = 0) => {
|
|
@@ -36585,39 +36790,37 @@ var VerificationCodeInput = forwardRef(function VerificationCodeInput2({
|
|
|
36585
36790
|
[safeLength]
|
|
36586
36791
|
);
|
|
36587
36792
|
const commit = useCallback(
|
|
36588
|
-
(
|
|
36589
|
-
|
|
36590
|
-
|
|
36591
|
-
|
|
36592
|
-
|
|
36593
|
-
|
|
36594
|
-
if (normalized.length === safeLength) {
|
|
36595
|
-
onComplete?.(normalized);
|
|
36793
|
+
(nextCells) => {
|
|
36794
|
+
setCellsState(nextCells);
|
|
36795
|
+
const code = verificationCellsToCode(nextCells);
|
|
36796
|
+
onValueChange?.(code);
|
|
36797
|
+
if (isVerificationCodeComplete(nextCells)) {
|
|
36798
|
+
onComplete?.(code);
|
|
36596
36799
|
}
|
|
36597
36800
|
},
|
|
36598
|
-
[
|
|
36801
|
+
[onComplete, onValueChange]
|
|
36599
36802
|
);
|
|
36600
36803
|
useImperativeHandle(
|
|
36601
36804
|
forwardedRef,
|
|
36602
36805
|
() => ({
|
|
36603
36806
|
clear: () => {
|
|
36604
|
-
commit("");
|
|
36807
|
+
commit(toVerificationCells("", safeLength));
|
|
36605
36808
|
focus(0);
|
|
36606
36809
|
},
|
|
36607
36810
|
focus
|
|
36608
36811
|
}),
|
|
36609
|
-
[commit, focus]
|
|
36812
|
+
[commit, focus, safeLength]
|
|
36610
36813
|
);
|
|
36611
36814
|
const handleChange = (index, input) => {
|
|
36612
|
-
const update =
|
|
36613
|
-
commit(update.
|
|
36815
|
+
const update = updateVerificationCells(cells, index, input, safeLength);
|
|
36816
|
+
commit(update.cells);
|
|
36614
36817
|
focus(update.nextFocus);
|
|
36615
36818
|
};
|
|
36616
36819
|
const handleKeyPress = (index, event) => {
|
|
36617
36820
|
const key = event.nativeEvent.key;
|
|
36618
|
-
if (key === "Backspace" && !
|
|
36619
|
-
const update =
|
|
36620
|
-
commit(update.
|
|
36821
|
+
if (key === "Backspace" && !cells[index] && index > 0) {
|
|
36822
|
+
const update = updateVerificationCells(cells, index - 1, "", safeLength);
|
|
36823
|
+
commit(update.cells);
|
|
36621
36824
|
focus(index - 1);
|
|
36622
36825
|
return;
|
|
36623
36826
|
}
|
|
@@ -36685,7 +36888,7 @@ var VerificationCodeInput = forwardRef(function VerificationCodeInput2({
|
|
|
36685
36888
|
Platform.OS === "android" ? styles33.cellAndroid : null,
|
|
36686
36889
|
inputStyle
|
|
36687
36890
|
],
|
|
36688
|
-
value:
|
|
36891
|
+
value: cells[index] ?? ""
|
|
36689
36892
|
},
|
|
36690
36893
|
index
|
|
36691
36894
|
);
|
|
@@ -36771,6 +36974,9 @@ var FALLBACK_ELLIPSIS_WIDTH = 20;
|
|
|
36771
36974
|
var WEB_MENU_Z_INDEX = 600;
|
|
36772
36975
|
var WEB_VIEWPORT_PADDING = 8;
|
|
36773
36976
|
var WEB_MENU_GAP = 8;
|
|
36977
|
+
function webListboxProps(multiple) {
|
|
36978
|
+
return { role: "listbox", "aria-multiselectable": multiple };
|
|
36979
|
+
}
|
|
36774
36980
|
function itemBackground(state) {
|
|
36775
36981
|
switch (state) {
|
|
36776
36982
|
case "hover":
|
|
@@ -37084,6 +37290,7 @@ var Select = forwardRef(
|
|
|
37084
37290
|
setOpen(false);
|
|
37085
37291
|
focusTrigger();
|
|
37086
37292
|
}, [focusTrigger, setOpen]);
|
|
37293
|
+
useOverlayLayer("popover", isOpen, closeAndFocusTrigger);
|
|
37087
37294
|
useEffect(() => {
|
|
37088
37295
|
if (Platform.OS !== "web") return;
|
|
37089
37296
|
const isTriggerFocused = () => document.activeElement === triggerRef.current;
|
|
@@ -37097,11 +37304,6 @@ var Select = forwardRef(
|
|
|
37097
37304
|
}
|
|
37098
37305
|
return;
|
|
37099
37306
|
}
|
|
37100
|
-
if (event.key === "Escape") {
|
|
37101
|
-
event.preventDefault();
|
|
37102
|
-
closeAndFocusTrigger();
|
|
37103
|
-
return;
|
|
37104
|
-
}
|
|
37105
37307
|
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
37106
37308
|
event.preventDefault();
|
|
37107
37309
|
setHoveredValue((current) => {
|
|
@@ -37139,7 +37341,6 @@ var Select = forwardRef(
|
|
|
37139
37341
|
filteredOptions,
|
|
37140
37342
|
hoveredValue,
|
|
37141
37343
|
multiple,
|
|
37142
|
-
closeAndFocusTrigger,
|
|
37143
37344
|
focusTrigger,
|
|
37144
37345
|
handleSelect,
|
|
37145
37346
|
setOpen
|
|
@@ -37206,6 +37407,7 @@ var Select = forwardRef(
|
|
|
37206
37407
|
contentContainerStyle: styles34.optionListContent,
|
|
37207
37408
|
keyboardShouldPersistTaps: "handled",
|
|
37208
37409
|
showsVerticalScrollIndicator: false,
|
|
37410
|
+
...Platform.OS === "web" ? webListboxProps(multiple) : null,
|
|
37209
37411
|
children: [
|
|
37210
37412
|
loading ? /* @__PURE__ */ jsx(View, { style: styles34.statusRow, children: /* @__PURE__ */ jsx(Text, { style: styles34.statusText, children: "Loading..." }) }) : filteredOptions.length === 0 ? /* @__PURE__ */ jsx(View, { style: styles34.statusRow, children: /* @__PURE__ */ jsx(Text, { style: styles34.statusText, children: emptyText }) }) : null,
|
|
37211
37413
|
!loading && filteredOptions.map((option) => {
|
|
@@ -37223,6 +37425,8 @@ var Select = forwardRef(
|
|
|
37223
37425
|
onPressOut: () => setHoveredValue((current) => current === option.value ? null : current),
|
|
37224
37426
|
accessibilityRole: multiple ? "checkbox" : "button",
|
|
37225
37427
|
accessibilityState: { selected: isSelected, checked: isSelected, disabled },
|
|
37428
|
+
role: Platform.OS === "web" ? "option" : void 0,
|
|
37429
|
+
"aria-selected": isSelected,
|
|
37226
37430
|
style: [
|
|
37227
37431
|
styles34.item,
|
|
37228
37432
|
{
|
|
@@ -37263,6 +37467,7 @@ var Select = forwardRef(
|
|
|
37263
37467
|
accessibilityRole: "combobox",
|
|
37264
37468
|
accessibilityLabel: resolvedAccessibilityLabel,
|
|
37265
37469
|
accessibilityState: { disabled, expanded: isOpen },
|
|
37470
|
+
"aria-expanded": isOpen,
|
|
37266
37471
|
style: [
|
|
37267
37472
|
styles34.trigger,
|
|
37268
37473
|
{
|
|
@@ -37746,6 +37951,8 @@ var Toggle = forwardRef(function Toggle2({
|
|
|
37746
37951
|
accessibilityRole: "switch",
|
|
37747
37952
|
accessibilityLabel: resolvedAccessibilityLabel,
|
|
37748
37953
|
accessibilityState: { checked: isActive, disabled },
|
|
37954
|
+
"aria-checked": isActive,
|
|
37955
|
+
...Platform.OS === "web" && !disabled ? { onKeyDown: (event) => handleWebToggleKeyDown(event, handlePress) } : null,
|
|
37749
37956
|
style: [styles36.pressable, disabled && styles36.disabled, style],
|
|
37750
37957
|
children: [
|
|
37751
37958
|
/* @__PURE__ */ jsx(
|
|
@@ -37897,7 +38104,7 @@ var BASE_ITEM_SIZE = 16;
|
|
|
37897
38104
|
var ICON_WIDTH_RATIO = 12.57 / BASE_ITEM_SIZE;
|
|
37898
38105
|
var ICON_HEIGHT_RATIO = 11.98 / BASE_ITEM_SIZE;
|
|
37899
38106
|
var STAR_GAP_RATIO = 2 / BASE_ITEM_SIZE;
|
|
37900
|
-
function
|
|
38107
|
+
function clamp(value) {
|
|
37901
38108
|
return Math.max(0, Math.min(value, STAR_COUNT));
|
|
37902
38109
|
}
|
|
37903
38110
|
var RatingInput = forwardRef(
|
|
@@ -37921,8 +38128,8 @@ var RatingInput = forwardRef(
|
|
|
37921
38128
|
const containerRef = useRef(null);
|
|
37922
38129
|
const setContainerRef = useMemo(() => mergeRefs(containerRef, forwardedRef), [forwardedRef]);
|
|
37923
38130
|
const isControlled = value !== void 0;
|
|
37924
|
-
const [uncontrolledValue, setUncontrolledValue] = useState(() =>
|
|
37925
|
-
const selectedValue =
|
|
38131
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(() => clamp(defaultValue));
|
|
38132
|
+
const selectedValue = clamp(isControlled ? value : uncontrolledValue);
|
|
37926
38133
|
const selectedStarCount = Math.round(selectedValue);
|
|
37927
38134
|
const iconWidth = size * ICON_WIDTH_RATIO;
|
|
37928
38135
|
const iconHeight = size * ICON_HEIGHT_RATIO;
|
|
@@ -39085,6 +39292,12 @@ var RadioButton = forwardRef(
|
|
|
39085
39292
|
accessibilityRole: "radio",
|
|
39086
39293
|
accessibilityLabel: resolvedAccessibilityLabel,
|
|
39087
39294
|
accessibilityState: { selected: isActive, disabled },
|
|
39295
|
+
...Platform.OS === "web" ? {
|
|
39296
|
+
"aria-checked": isActive,
|
|
39297
|
+
...disabled ? null : {
|
|
39298
|
+
onKeyDown: (event) => handleWebToggleKeyDown(event, handlePress)
|
|
39299
|
+
}
|
|
39300
|
+
} : null,
|
|
39088
39301
|
style: [styles42.root, disabled && styles42.disabled, style],
|
|
39089
39302
|
children: [
|
|
39090
39303
|
/* @__PURE__ */ jsx(View, { style: styles42.control, children: isActive ? /* @__PURE__ */ jsx(View, { style: styles42.dot }) : null }),
|
|
@@ -39236,6 +39449,6 @@ react-dom/cjs/react-dom.development.js:
|
|
|
39236
39449
|
*)
|
|
39237
39450
|
*/
|
|
39238
39451
|
|
|
39239
|
-
export { Accordion, AccordionItem, AccountHeader, ActiveGuestsIcon, AlertTriangleIcon, Amenity, AmenityIcon, AppleIcon, AreaExpandIcon, ArrowLeftIcon, ArrowRightIcon, AutocompleteInput, Avatar, AvatarSimple, BRAND_LOGO_COLORS, BRAND_LOGO_DEFAULT_HEIGHT, BRAND_LOGO_DEFAULT_WIDTH, BackspaceIcon, Badge, BagIcon, BanIcon, BathroomsIcon, BedroomsIcon, BellIcon, BlockedGuestsIcon, BookingWarningNotification, BrandLogo, BuildingIcon, Button, CalendarFilledIcon, CalendarIcon, CalendarMinusIcon, CalendarOutlineIcon, CameraFilledIcon, CameraIcon, CancelledBookingNotification, CardLocationIcon, CheckBadgeIcon, CheckIcon, CheckSuccessIcon, Checkbox, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ClockFilledIcon, ClockIcon, CloseIcon, CloudUploadIcon, CommentCard, ContactInfoCard, CopyIcon, Counter, CurrentLocationIcon, CutleryIcon, DatePicker, DeactivateIcon, DollarIcon, DoubleCheckIcon, DownloadIcon, DragHandleIcon, DramIcon, Drawer, EditIcon, ExternalLinkIcon, EyeIcon, FacebookIcon, FavoritesButton, FiltersIcon, FingerprintIcon, FloatingActionButton, FullscreenIcon, GlobeIcon, GoogleBrandIcon, GooglePlayIcon, GuestCheckInNotification, GuestsIcon, HeadsetIcon, HeartIcon, HelpCircleIcon, HideIcon, HomeIcon, Icon, IconStatusBadge, ImageIcon, InfoCardV2, InfoCircleIcon, InfoTile, Input, InstagramIcon, KeyIcon, LanguageSwitcher, LayoutGridIcon, LinkedInIcon, ListViewIcon, LocationPinIcon, LocationUserIcon, LockIcon, LogOutIcon, MailIcon, MapCollapseIcon, MapExpandIcon, MapViewIcon, MenuIcon, MenuItem, MenuLinesIcon, MinusIcon, Modal, MoonStarsIcon, MoreHorizontalIcon, NavigateIcon, NewBookingNotification, NoPetsIcon, NoReviewIcon, NoSmokingIcon, NotificationCancelledIcon, NotificationCheckoutIcon, NotificationQrCodeIcon, NotificationStatusSkeleton, NotificationSuccessIcon, NotificationWarningIcon, PaginationDots, PawIcon, PaymentCardIcon, PhoneIcon, PlusIcon, QrCodeIcon, QrKeyNotification, QuantityInput, QuietHoursIcon, RadioButton, Range, RatingInput, RatingStarIcon, ReceiptIcon, RefreshIcon, RefundStatusIcon, SaveHeartIcon, SearchIcon, SegmentedToggle, Select, SettingsIcon, ShareIcon, ShowIcon, Sidebar, SidebarIcon, SmartKeyIcon, SortIcon, StarFilledIcon, StarIcon, StarOutlineIcon, StatCard, StatusBadge, StatusIndicator, StayHomeIcon, StepList, StepPager, SunIcon, TableViewIcon, Textarea, Toggle, ToggleRow, TooltipArrowIcon, TotalGuestsIcon, TrashIcon, UnlockIcon, UserIcon, UsersAltIcon, VerificationCodeInput, VideoIcon, VideoOffIcon, WasherIcon, WhatsAppIcon, ZoomOutIcon, abbreviateMonthName, avatarTypography, badgeTypography, buttonTypography, colors, commentCardTypography, counterTypography, datePickerTypography, defaultLanguageOptions, fonts, formatDate, formatDateDayShortMonth, getIconsByGroup, grey, iconGroupNames, iconGroups, iconNames, icons, inputTypography, languageSwitcherTypography, ratingTypography, resolvePopoverAlign, segmentedToggleTypography, selectTypography, statCardTypography, textareaTypography };
|
|
39452
|
+
export { Accordion, AccordionItem, AccountHeader, ActiveGuestsIcon, AlertTriangleIcon, Amenity, AmenityIcon, AppleIcon, AreaExpandIcon, ArrowLeftIcon, ArrowRightIcon, AutocompleteInput, Avatar, AvatarSimple, BRAND_LOGO_COLORS, BRAND_LOGO_DEFAULT_HEIGHT, BRAND_LOGO_DEFAULT_WIDTH, BackspaceIcon, Badge, BagIcon, BanIcon, BathroomsIcon, BedroomsIcon, BellIcon, BlockedGuestsIcon, BookingWarningNotification, BrandLogo, BuildingIcon, Button, CalendarFilledIcon, CalendarIcon, CalendarMinusIcon, CalendarOutlineIcon, CameraFilledIcon, CameraIcon, CancelledBookingNotification, CardLocationIcon, CheckBadgeIcon, CheckIcon, CheckSuccessIcon, Checkbox, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ClockFilledIcon, ClockIcon, CloseIcon, CloudUploadIcon, CommentCard, ContactInfoCard, CopyIcon, Counter, CurrentLocationIcon, CutleryIcon, DatePicker, DeactivateIcon, DollarIcon, DoubleCheckIcon, DownloadIcon, DragHandleIcon, DramIcon, Drawer, EditIcon, ExternalLinkIcon, EyeIcon, FacebookIcon, FavoritesButton, FiltersIcon, FingerprintIcon, FloatingActionButton, FullscreenIcon, GlobeIcon, GoogleBrandIcon, GooglePlayIcon, GuestCheckInNotification, GuestsIcon, HeadsetIcon, HeartIcon, HelpCircleIcon, HideIcon, HomeIcon, Icon, IconStatusBadge, ImageIcon, InfoCardV2, InfoCircleIcon, InfoTile, Input, InstagramIcon, KeyIcon, LanguageSwitcher, LayoutGridIcon, LinkedInIcon, ListViewIcon, LocationPinIcon, LocationUserIcon, LockIcon, LogOutIcon, MailIcon, MapCollapseIcon, MapExpandIcon, MapViewIcon, MenuIcon, MenuItem, MenuLinesIcon, MinusIcon, Modal, MoonStarsIcon, MoreHorizontalIcon, NavigateIcon, NewBookingNotification, NoPetsIcon, NoReviewIcon, NoSmokingIcon, NotificationCancelledIcon, NotificationCheckoutIcon, NotificationQrCodeIcon, NotificationStatusSkeleton, NotificationSuccessIcon, NotificationWarningIcon, PaginationDots, PawIcon, PaymentCardIcon, PhoneIcon, PlusIcon, QrCodeIcon, QrKeyNotification, QuantityInput, QuietHoursIcon, RadioButton, Range, RatingInput, RatingStarIcon, ReceiptIcon, RefreshIcon, RefundStatusIcon, SaveHeartIcon, SearchIcon, SegmentedToggle, Select, SettingsIcon, ShareIcon, ShowIcon, Sidebar, SidebarIcon, SmartKeyIcon, SortIcon, StarFilledIcon, StarIcon, StarOutlineIcon, StatCard, StatusBadge, StatusIndicator, StayHomeIcon, StepList, StepPager, SunIcon, TableViewIcon, Textarea, Toggle, ToggleRow, TooltipArrowIcon, TotalGuestsIcon, TrashIcon, UnlockIcon, UserIcon, UsersAltIcon, VerificationCodeInput, VideoIcon, VideoOffIcon, WasherIcon, WhatsAppIcon, ZoomOutIcon, abbreviateMonthName, abbreviateMonthNames, avatarTypography, badgeTypography, buttonTypography, colors, commentCardTypography, counterTypography, datePickerTypography, defaultLanguageOptions, fonts, formatDate, formatDateDayShortMonth, getIconsByGroup, grey, iconGroupNames, iconGroups, iconNames, icons, inputTypography, languageSwitcherTypography, ratingTypography, resolvePopoverAlign, segmentedToggleTypography, selectTypography, statCardTypography, textareaTypography };
|
|
39240
39453
|
//# sourceMappingURL=index.js.map
|
|
39241
39454
|
//# sourceMappingURL=index.js.map
|