@butternutbox/pawprint-native 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +21 -0
- package/COMPONENT_GUIDELINES.md +12 -8
- package/dist/index.cjs +232 -116
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +161 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__mocks__/react-native.tsx +10 -1
- package/src/components/atoms/IconButton/IconButton.tsx +1 -0
- package/src/components/molecules/DatePicker/DatePicker.tsx +32 -2
- package/src/components/molecules/Drawer/Drawer.test.tsx +63 -0
- package/src/components/molecules/Drawer/DrawerBody.tsx +131 -25
- package/src/components/molecules/Drawer/DrawerContent.tsx +9 -6
- package/src/components/molecules/Drawer/DrawerKeyboardInsetContext.ts +9 -0
- package/src/components/molecules/SelectField/SelectField.tsx +13 -3
package/dist/index.d.cts
CHANGED
|
@@ -2132,6 +2132,7 @@ type DatePickerOwnProps = {
|
|
|
2132
2132
|
getDateState?: (date: Date) => DateItemState;
|
|
2133
2133
|
getDateAccessibilityLabel?: (date: Date, state: DateItemState, monthLabel: string) => string;
|
|
2134
2134
|
isDateDisabled?: (date: Date) => boolean;
|
|
2135
|
+
focusDate?: Date | null;
|
|
2135
2136
|
minDate?: Date;
|
|
2136
2137
|
maxDate?: Date;
|
|
2137
2138
|
};
|
|
@@ -2160,6 +2161,8 @@ type DatePickerProps = DatePickerOwnProps & Omit<ViewProps, keyof DatePickerOwnP
|
|
|
2160
2161
|
* Defaults to: past="previous", today="current", future="default".
|
|
2161
2162
|
* @param {(date: Date, state: DateItemState, monthLabel: string) => string} [getDateAccessibilityLabel] - Returns the screen-reader label for a date,
|
|
2162
2163
|
* e.g. to announce delivery states. Defaults to "{day} {monthLabel}".
|
|
2164
|
+
* @param {Date | null} [focusDate] - Moves screen-reader focus to this date's cell when it is set or
|
|
2165
|
+
* changes, e.g. to return focus to a picked date after a confirmation sheet closes.
|
|
2163
2166
|
* @param {(date: Date) => boolean} [isDateDisabled] - Returns true to disable a date.
|
|
2164
2167
|
* @param {Date} [minDate] - Dates before this (exclusive of time) will be disabled.
|
|
2165
2168
|
* @param {Date} [maxDate] - Dates after this (exclusive of time) will be disabled.
|
package/dist/index.d.ts
CHANGED
|
@@ -2132,6 +2132,7 @@ type DatePickerOwnProps = {
|
|
|
2132
2132
|
getDateState?: (date: Date) => DateItemState;
|
|
2133
2133
|
getDateAccessibilityLabel?: (date: Date, state: DateItemState, monthLabel: string) => string;
|
|
2134
2134
|
isDateDisabled?: (date: Date) => boolean;
|
|
2135
|
+
focusDate?: Date | null;
|
|
2135
2136
|
minDate?: Date;
|
|
2136
2137
|
maxDate?: Date;
|
|
2137
2138
|
};
|
|
@@ -2160,6 +2161,8 @@ type DatePickerProps = DatePickerOwnProps & Omit<ViewProps, keyof DatePickerOwnP
|
|
|
2160
2161
|
* Defaults to: past="previous", today="current", future="default".
|
|
2161
2162
|
* @param {(date: Date, state: DateItemState, monthLabel: string) => string} [getDateAccessibilityLabel] - Returns the screen-reader label for a date,
|
|
2162
2163
|
* e.g. to announce delivery states. Defaults to "{day} {monthLabel}".
|
|
2164
|
+
* @param {Date | null} [focusDate] - Moves screen-reader focus to this date's cell when it is set or
|
|
2165
|
+
* changes, e.g. to return focus to a picked date after a confirmation sheet closes.
|
|
2163
2166
|
* @param {(date: Date) => boolean} [isDateDisabled] - Returns true to disable a date.
|
|
2164
2167
|
* @param {Date} [minDate] - Dates before this (exclusive of time) will be disabled.
|
|
2165
2168
|
* @param {Date} [maxDate] - Dates after this (exclusive of time) will be disabled.
|
package/dist/index.js
CHANGED
|
@@ -8,10 +8,10 @@ export * from '@butternutbox/pawprint-fonts';
|
|
|
8
8
|
import React65, { createContext, forwardRef, useRef, useEffect, useState, useCallback, useMemo, useContext } from 'react';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import * as AvatarPrimitive from '@rn-primitives/avatar';
|
|
11
|
-
import { Text, View, Animated, Pressable, TextInput, Easing, useWindowDimensions, StyleSheet, Platform, Keyboard, PanResponder, Image,
|
|
11
|
+
import { Text, View, Animated, Pressable, TextInput, Easing, useWindowDimensions, StyleSheet, Platform, Keyboard, PanResponder, Image, ActionSheetIOS, TouchableOpacity, Modal, TouchableWithoutFeedback, FlatList, AccessibilityInfo, ScrollView, Linking, Clipboard, Alert } from 'react-native';
|
|
12
12
|
import Svg72, { Path, Defs, LinearGradient, Stop, Rect, G, ClipPath } from 'react-native-svg';
|
|
13
13
|
import * as SwitchPrimitive from '@rn-primitives/switch';
|
|
14
|
-
import
|
|
14
|
+
import Animated10, { Keyframe, Easing as Easing$1, FadeInLeft, FadeInRight, FadeInUp, FadeInDown, FadeIn, FadeOutLeft, FadeOutRight, FadeOutUp, FadeOutDown, FadeOut, useReducedMotion, useSharedValue, withTiming, useAnimatedStyle, ComplexAnimationBuilder, withSpring, withDelay, withRepeat, withSequence } from 'react-native-reanimated';
|
|
15
15
|
import { Slot } from '@rn-primitives/slot';
|
|
16
16
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
17
17
|
import * as ProgressPrimitive from '@rn-primitives/progress';
|
|
@@ -20,7 +20,7 @@ import * as SliderPrimitive from '@rn-primitives/slider';
|
|
|
20
20
|
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
21
21
|
import { scheduleOnRN } from 'react-native-worklets';
|
|
22
22
|
import * as TooltipPrimitive from '@rn-primitives/tooltip';
|
|
23
|
-
import { isSameDay, isToday, isBefore
|
|
23
|
+
import { isSameDay, format, isToday, isBefore } from 'date-fns';
|
|
24
24
|
import * as TabsPrimitive from '@rn-primitives/tabs';
|
|
25
25
|
|
|
26
26
|
var __defProp = Object.defineProperty;
|
|
@@ -1464,6 +1464,7 @@ var IconButton = React65.forwardRef(
|
|
|
1464
1464
|
__spreadProps(__spreadValues({
|
|
1465
1465
|
ref,
|
|
1466
1466
|
disabled: isDisabled,
|
|
1467
|
+
accessibilityRole: "button",
|
|
1467
1468
|
accessibilityLabel: ariaLabel,
|
|
1468
1469
|
accessibilityState: { disabled: isDisabled, busy: loading },
|
|
1469
1470
|
onPressIn: () => setPressed(true),
|
|
@@ -5627,7 +5628,7 @@ var Animated5 = React65.forwardRef(
|
|
|
5627
5628
|
const delayMs = delay !== void 0 && delay > 0 ? Math.round(delay * 1e3) : 0;
|
|
5628
5629
|
const entering = delayMs > 0 ? buildDelayedEntering(variant, delayMs) : ENTERING[variant];
|
|
5629
5630
|
return /* @__PURE__ */ jsx(
|
|
5630
|
-
|
|
5631
|
+
Animated10.View,
|
|
5631
5632
|
__spreadProps(__spreadValues({
|
|
5632
5633
|
ref,
|
|
5633
5634
|
entering,
|
|
@@ -5706,6 +5707,10 @@ var DrawerBodyMaxContext = createContext(null);
|
|
|
5706
5707
|
var useDrawerBodyMax = () => useContext(DrawerBodyMaxContext);
|
|
5707
5708
|
var DrawerFooterContext = React65.createContext(false);
|
|
5708
5709
|
var useDrawerFooterContext = () => React65.useContext(DrawerFooterContext);
|
|
5710
|
+
var DrawerKeyboardInsetContext = createContext(
|
|
5711
|
+
null
|
|
5712
|
+
);
|
|
5713
|
+
var useDrawerKeyboardInset = () => useContext(DrawerKeyboardInsetContext);
|
|
5709
5714
|
var DrawerHeaderContext = React65.createContext(null);
|
|
5710
5715
|
var useDrawerHeaderContext = () => React65.useContext(DrawerHeaderContext);
|
|
5711
5716
|
var KEYBOARD_DURATION = 250;
|
|
@@ -5713,6 +5718,7 @@ var OPEN_DURATION = 320;
|
|
|
5713
5718
|
var CLOSE_DURATION = 220;
|
|
5714
5719
|
var DISMISS_THRESHOLD = 80;
|
|
5715
5720
|
var parseTokenValue23 = (value) => parseFloat(value);
|
|
5721
|
+
var claimTouch = () => true;
|
|
5716
5722
|
var StyledPanel2 = styled52(View)(
|
|
5717
5723
|
({
|
|
5718
5724
|
panelBorderRadius,
|
|
@@ -5753,9 +5759,8 @@ var DrawerContent = React65.forwardRef(
|
|
|
5753
5759
|
const { colour, dimensions: dimensions3 } = theme2.tokens.semantics;
|
|
5754
5760
|
const { isOpen, closeDrawer, onExitComplete } = useDrawerContext();
|
|
5755
5761
|
const { height: windowHeight } = useWindowDimensions();
|
|
5756
|
-
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
5757
5762
|
const keyboardSpacer = useRef(new Animated.Value(0)).current;
|
|
5758
|
-
const maxHeight =
|
|
5763
|
+
const maxHeight = windowHeight * 0.9;
|
|
5759
5764
|
const topBorder = parseTokenValue23(dimensions3.borderWidth.sm);
|
|
5760
5765
|
const noFooterBodyPadding = parseTokenValue23(dimensions3.spacing["2xl"]);
|
|
5761
5766
|
const closeDrawerRef = useRef(closeDrawer);
|
|
@@ -5793,11 +5798,9 @@ var DrawerContent = React65.forwardRef(
|
|
|
5793
5798
|
}).start();
|
|
5794
5799
|
};
|
|
5795
5800
|
const shown = Keyboard.addListener(showEvent, (event) => {
|
|
5796
|
-
setKeyboardHeight(event.endCoordinates.height);
|
|
5797
5801
|
lift(event.endCoordinates.height, event.duration);
|
|
5798
5802
|
});
|
|
5799
5803
|
const hidden = Keyboard.addListener(hideEvent, (event) => {
|
|
5800
|
-
setKeyboardHeight(0);
|
|
5801
5804
|
lift(0, event.duration);
|
|
5802
5805
|
});
|
|
5803
5806
|
return () => {
|
|
@@ -5997,17 +6000,18 @@ var DrawerContent = React65.forwardRef(
|
|
|
5997
6000
|
panelBorderRadius: parseTokenValue23(drawer.borderRadius.top),
|
|
5998
6001
|
panelBgColor: colour.background.container.default,
|
|
5999
6002
|
panelMaxWidth: parseTokenValue23(drawer.size.maxWidth),
|
|
6000
|
-
panelMaxHeight: maxHeight
|
|
6003
|
+
panelMaxHeight: maxHeight,
|
|
6001
6004
|
panelBorderWidth: parseTokenValue23(dimensions3.borderWidth.sm),
|
|
6002
6005
|
panelBorderColor: colour.border.default,
|
|
6003
6006
|
panelShadowColor: modal.shadow.color,
|
|
6004
6007
|
panelShadowOffsetY: parseTokenValue23(modal.shadow.offsetY),
|
|
6005
6008
|
panelShadowBlur: parseTokenValue23(modal.shadow.blur),
|
|
6006
6009
|
accessibilityViewIsModal: true,
|
|
6007
|
-
onAccessibilityEscape: closeDrawer
|
|
6010
|
+
onAccessibilityEscape: closeDrawer,
|
|
6011
|
+
onStartShouldSetResponder: claimTouch
|
|
6008
6012
|
}, props), {
|
|
6009
6013
|
children: [
|
|
6010
|
-
/* @__PURE__ */ jsx(DrawerBodyMaxContext.Provider, { value: bodyMax, children }),
|
|
6014
|
+
/* @__PURE__ */ jsx(DrawerBodyMaxContext.Provider, { value: bodyMax, children: /* @__PURE__ */ jsx(DrawerKeyboardInsetContext.Provider, { value: keyboardSpacer, children }) }),
|
|
6011
6015
|
/* @__PURE__ */ jsx(Animated.View, { style: { height: keyboardSpacer } })
|
|
6012
6016
|
]
|
|
6013
6017
|
})
|
|
@@ -6320,27 +6324,36 @@ var DrawerDescription = React65.forwardRef(
|
|
|
6320
6324
|
);
|
|
6321
6325
|
DrawerDescription.displayName = "Drawer.Description";
|
|
6322
6326
|
var parseTokenValue27 = (value) => parseFloat(value);
|
|
6323
|
-
var StyledScrollView = styled52(ScrollView)(
|
|
6324
|
-
(
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
flexGrow: 0,
|
|
6334
|
-
flexShrink: 1,
|
|
6335
|
-
paddingLeft: bodyPaddingHorizontal,
|
|
6336
|
-
paddingRight: bodyPaddingRight,
|
|
6337
|
-
maxHeight: bodyMaxHeight,
|
|
6338
|
-
paddingBottom: bodyPaddingBottom
|
|
6339
|
-
})
|
|
6340
|
-
);
|
|
6327
|
+
var StyledScrollView = styled52(Animated.ScrollView)(({ bodyPaddingHorizontal, bodyPaddingRight, bodyPaddingBottom }) => ({
|
|
6328
|
+
// No `flex: 1`: the ScrollView self-sizes to its content (up to
|
|
6329
|
+
// `maxHeight`), so the panel wraps tight around short content and scrolls
|
|
6330
|
+
// only when content exceeds the chrome-aware cap.
|
|
6331
|
+
flexGrow: 0,
|
|
6332
|
+
flexShrink: 1,
|
|
6333
|
+
paddingLeft: bodyPaddingHorizontal,
|
|
6334
|
+
paddingRight: bodyPaddingRight,
|
|
6335
|
+
paddingBottom: bodyPaddingBottom
|
|
6336
|
+
}));
|
|
6341
6337
|
var DrawerBody = React65.forwardRef(
|
|
6342
6338
|
(_a, ref) => {
|
|
6343
|
-
var _b = _a, {
|
|
6339
|
+
var _b = _a, {
|
|
6340
|
+
children,
|
|
6341
|
+
contentContainerStyle,
|
|
6342
|
+
keyboardShouldPersistTaps = "handled",
|
|
6343
|
+
scrollEventThrottle = 16,
|
|
6344
|
+
onScroll,
|
|
6345
|
+
onLayout,
|
|
6346
|
+
style
|
|
6347
|
+
} = _b, props = __objRest(_b, [
|
|
6348
|
+
"children",
|
|
6349
|
+
"contentContainerStyle",
|
|
6350
|
+
"keyboardShouldPersistTaps",
|
|
6351
|
+
"scrollEventThrottle",
|
|
6352
|
+
"onScroll",
|
|
6353
|
+
"onLayout",
|
|
6354
|
+
"style"
|
|
6355
|
+
]);
|
|
6356
|
+
var _a2;
|
|
6344
6357
|
const theme2 = useTheme();
|
|
6345
6358
|
const { spacing } = theme2.tokens.components.drawer;
|
|
6346
6359
|
const { buttons } = theme2.tokens.components;
|
|
@@ -6348,12 +6361,83 @@ var DrawerBody = React65.forwardRef(
|
|
|
6348
6361
|
const headerContext = useDrawerHeaderContext();
|
|
6349
6362
|
const footerContext = useDrawerFooterContext();
|
|
6350
6363
|
const providedMaxHeight = useDrawerBodyMax();
|
|
6364
|
+
const keyboardInset = useDrawerKeyboardInset();
|
|
6351
6365
|
const { height: windowHeight } = useWindowDimensions();
|
|
6352
6366
|
const insets = useSafeAreaInsets();
|
|
6353
6367
|
const gap = parseTokenValue27(content.slot.gap);
|
|
6354
6368
|
const horizontalPadding = parseTokenValue27(content.slot.horizontalPadding);
|
|
6355
6369
|
const topPadding = parseTokenValue27(content.slot.verticalPadding);
|
|
6356
6370
|
const bodyMaxHeight = providedMaxHeight != null ? providedMaxHeight : windowHeight - 300;
|
|
6371
|
+
const _b2 = (_a2 = StyleSheet.flatten(style)) != null ? _a2 : {}, { maxHeight: styleMaxHeight } = _b2, restStyle = __objRest(_b2, ["maxHeight"]);
|
|
6372
|
+
const cap = typeof styleMaxHeight === "number" ? Math.min(styleMaxHeight, bodyMaxHeight) : bodyMaxHeight;
|
|
6373
|
+
const maxHeight = useMemo(() => {
|
|
6374
|
+
if (!keyboardInset || bodyMaxHeight <= 0) return cap;
|
|
6375
|
+
const slack = bodyMaxHeight - cap;
|
|
6376
|
+
return keyboardInset.interpolate({
|
|
6377
|
+
inputRange: slack > 0 ? [0, slack, bodyMaxHeight] : [0, bodyMaxHeight],
|
|
6378
|
+
outputRange: slack > 0 ? [cap, cap, 0] : [cap, 0],
|
|
6379
|
+
extrapolate: "clamp"
|
|
6380
|
+
});
|
|
6381
|
+
}, [keyboardInset, bodyMaxHeight, cap]);
|
|
6382
|
+
const scrollRef = useRef(null);
|
|
6383
|
+
const contentRef = useRef(null);
|
|
6384
|
+
const scrollOffsetRef = useRef(0);
|
|
6385
|
+
const viewportHeightRef = useRef(0);
|
|
6386
|
+
const combinedRef = useCallback(
|
|
6387
|
+
(node) => {
|
|
6388
|
+
scrollRef.current = node;
|
|
6389
|
+
if (typeof ref === "function") {
|
|
6390
|
+
ref(node);
|
|
6391
|
+
} else if (ref) {
|
|
6392
|
+
ref.current = node;
|
|
6393
|
+
}
|
|
6394
|
+
},
|
|
6395
|
+
[ref]
|
|
6396
|
+
);
|
|
6397
|
+
const handleScroll = useCallback(
|
|
6398
|
+
(event) => {
|
|
6399
|
+
scrollOffsetRef.current = event.nativeEvent.contentOffset.y;
|
|
6400
|
+
onScroll == null ? void 0 : onScroll(event);
|
|
6401
|
+
},
|
|
6402
|
+
[onScroll]
|
|
6403
|
+
);
|
|
6404
|
+
const handleLayout = useCallback(
|
|
6405
|
+
(event) => {
|
|
6406
|
+
viewportHeightRef.current = event.nativeEvent.layout.height;
|
|
6407
|
+
onLayout == null ? void 0 : onLayout(event);
|
|
6408
|
+
},
|
|
6409
|
+
[onLayout]
|
|
6410
|
+
);
|
|
6411
|
+
useEffect(() => {
|
|
6412
|
+
const subscription = Keyboard.addListener("keyboardDidShow", () => {
|
|
6413
|
+
const scrollView = scrollRef.current;
|
|
6414
|
+
const focusedInput = TextInput.State.currentlyFocusedInput();
|
|
6415
|
+
const contentView = contentRef.current;
|
|
6416
|
+
if (!scrollView || !focusedInput || !contentView) return;
|
|
6417
|
+
focusedInput.measureLayout(
|
|
6418
|
+
contentView,
|
|
6419
|
+
(_left, inputTop, _width, inputHeight) => {
|
|
6420
|
+
const viewportHeight = viewportHeightRef.current;
|
|
6421
|
+
if (viewportHeight <= 0) return;
|
|
6422
|
+
const visibleTop = scrollOffsetRef.current;
|
|
6423
|
+
const visibleBottom = visibleTop + viewportHeight;
|
|
6424
|
+
const wantedTop = inputTop - gap;
|
|
6425
|
+
const wantedBottom = inputTop + inputHeight + gap;
|
|
6426
|
+
if (wantedTop < visibleTop) {
|
|
6427
|
+
scrollView.scrollTo({ y: Math.max(0, wantedTop), animated: true });
|
|
6428
|
+
} else if (wantedBottom > visibleBottom) {
|
|
6429
|
+
scrollView.scrollTo({
|
|
6430
|
+
y: Math.min(wantedTop, wantedBottom - viewportHeight),
|
|
6431
|
+
animated: true
|
|
6432
|
+
});
|
|
6433
|
+
}
|
|
6434
|
+
},
|
|
6435
|
+
() => {
|
|
6436
|
+
}
|
|
6437
|
+
);
|
|
6438
|
+
});
|
|
6439
|
+
return () => subscription.remove();
|
|
6440
|
+
}, [gap]);
|
|
6357
6441
|
const paddingRight = headerContext === null ? parseTokenValue27(spacing.close.right.md) + parseTokenValue27(buttons.size.sm.minHeight) : horizontalPadding;
|
|
6358
6442
|
const bodyPaddingBottom = !footerContext ? Math.max(
|
|
6359
6443
|
parseTokenValue27(theme2.tokens.semantics.dimensions.spacing["2xl"]),
|
|
@@ -6362,11 +6446,12 @@ var DrawerBody = React65.forwardRef(
|
|
|
6362
6446
|
return /* @__PURE__ */ jsx(
|
|
6363
6447
|
StyledScrollView,
|
|
6364
6448
|
__spreadProps(__spreadValues({
|
|
6365
|
-
ref,
|
|
6449
|
+
ref: combinedRef,
|
|
6450
|
+
innerViewRef: contentRef,
|
|
6366
6451
|
bodyPaddingHorizontal: horizontalPadding,
|
|
6367
6452
|
bodyPaddingRight: paddingRight,
|
|
6368
|
-
bodyMaxHeight,
|
|
6369
6453
|
bodyPaddingBottom,
|
|
6454
|
+
style: [restStyle, { maxHeight }],
|
|
6370
6455
|
contentContainerStyle: [
|
|
6371
6456
|
{
|
|
6372
6457
|
gap,
|
|
@@ -6374,7 +6459,11 @@ var DrawerBody = React65.forwardRef(
|
|
|
6374
6459
|
paddingBottom: 0
|
|
6375
6460
|
},
|
|
6376
6461
|
contentContainerStyle
|
|
6377
|
-
]
|
|
6462
|
+
],
|
|
6463
|
+
keyboardShouldPersistTaps,
|
|
6464
|
+
scrollEventThrottle,
|
|
6465
|
+
onScroll: handleScroll,
|
|
6466
|
+
onLayout: handleLayout
|
|
6378
6467
|
}, props), {
|
|
6379
6468
|
children
|
|
6380
6469
|
})
|
|
@@ -7920,7 +8009,7 @@ var StyledTrack = styled52(View)(({ trackHeight, trackMinWidth, trackBorderRadiu
|
|
|
7920
8009
|
backgroundColor: trackBgColor,
|
|
7921
8010
|
overflow: "hidden"
|
|
7922
8011
|
}));
|
|
7923
|
-
var StyledIndicator = styled52(
|
|
8012
|
+
var StyledIndicator = styled52(Animated10.View)(({ indicatorBorderRadius, indicatorBgColor }) => ({
|
|
7924
8013
|
height: "100%",
|
|
7925
8014
|
borderRadius: indicatorBorderRadius,
|
|
7926
8015
|
backgroundColor: indicatorBgColor
|
|
@@ -9130,9 +9219,17 @@ var SelectField = React65.forwardRef(
|
|
|
9130
9219
|
}
|
|
9131
9220
|
);
|
|
9132
9221
|
}, [windowHeight, keyboardHeight, maxDropdownHeight]);
|
|
9222
|
+
const isOpen = isFocused && !disabled;
|
|
9133
9223
|
React65.useEffect(() => {
|
|
9134
|
-
if (
|
|
9135
|
-
|
|
9224
|
+
if (!isOpen) return;
|
|
9225
|
+
let frame = 0;
|
|
9226
|
+
const track = () => {
|
|
9227
|
+
measurePlacement();
|
|
9228
|
+
frame = requestAnimationFrame(track);
|
|
9229
|
+
};
|
|
9230
|
+
track();
|
|
9231
|
+
return () => cancelAnimationFrame(frame);
|
|
9232
|
+
}, [isOpen, measurePlacement]);
|
|
9136
9233
|
React65.useEffect(() => {
|
|
9137
9234
|
if (!isControlled || isFocused) return;
|
|
9138
9235
|
if (value === null || value === void 0) {
|
|
@@ -9191,7 +9288,6 @@ var SelectField = React65.forwardRef(
|
|
|
9191
9288
|
if (searchable) (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
9192
9289
|
};
|
|
9193
9290
|
const fieldState = error ? "error" : state;
|
|
9194
|
-
const isOpen = isFocused && !disabled;
|
|
9195
9291
|
const clearAction = !disabled && inputText.length > 0 ? /* @__PURE__ */ jsx(
|
|
9196
9292
|
Pressable,
|
|
9197
9293
|
{
|
|
@@ -9503,7 +9599,7 @@ var Wrapper = styled52(View)({
|
|
|
9503
9599
|
alignItems: "center",
|
|
9504
9600
|
justifyContent: "space-between"
|
|
9505
9601
|
});
|
|
9506
|
-
var SelectIcon = styled52(
|
|
9602
|
+
var SelectIcon = styled52(Animated10.View)({
|
|
9507
9603
|
position: "absolute",
|
|
9508
9604
|
right: 0,
|
|
9509
9605
|
marginRight: 0
|
|
@@ -10054,9 +10150,9 @@ var Slider = React65.forwardRef(
|
|
|
10054
10150
|
onLayout: handleNativeLayout,
|
|
10055
10151
|
children: [
|
|
10056
10152
|
/* @__PURE__ */ jsx(View, { style: trackBackgroundStyle }),
|
|
10057
|
-
/* @__PURE__ */ jsx(
|
|
10153
|
+
/* @__PURE__ */ jsx(Animated10.View, { style: [indicatorBaseStyle, indicatorAnimStyle] }),
|
|
10058
10154
|
/* @__PURE__ */ jsx(
|
|
10059
|
-
|
|
10155
|
+
Animated10.View,
|
|
10060
10156
|
{
|
|
10061
10157
|
style: [
|
|
10062
10158
|
__spreadProps(__spreadValues({}, thumbStyle), { position: "absolute", left: 0 }),
|
|
@@ -10470,7 +10566,7 @@ var StackedCard = ({
|
|
|
10470
10566
|
}));
|
|
10471
10567
|
const isFront = depth === 0;
|
|
10472
10568
|
return /* @__PURE__ */ jsx(
|
|
10473
|
-
|
|
10569
|
+
Animated10.View,
|
|
10474
10570
|
{
|
|
10475
10571
|
entering: wasBackfill ? void 0 : CARD_ENTERING,
|
|
10476
10572
|
exiting: CARD_EXITING,
|
|
@@ -10478,7 +10574,7 @@ var StackedCard = ({
|
|
|
10478
10574
|
accessibilityElementsHidden: !isFront,
|
|
10479
10575
|
importantForAccessibility: isFront ? "auto" : "no-hide-descendants",
|
|
10480
10576
|
style: [CARD_BASE_STYLE, { zIndex: -depth }],
|
|
10481
|
-
children: /* @__PURE__ */ jsx(
|
|
10577
|
+
children: /* @__PURE__ */ jsx(Animated10.View, { style: [DEPTH_LAYER_STYLE, depthStyle], children: /* @__PURE__ */ jsx(
|
|
10482
10578
|
Notification,
|
|
10483
10579
|
{
|
|
10484
10580
|
variant: "toast",
|
|
@@ -11192,6 +11288,7 @@ var MONTH_SLIDE_EXITING = {
|
|
|
11192
11288
|
forward: FadeOutLeft.duration(200),
|
|
11193
11289
|
backward: FadeOutRight.duration(200)
|
|
11194
11290
|
};
|
|
11291
|
+
var FOCUS_DELAY_MS = 150;
|
|
11195
11292
|
var DEFAULT_WEEK_LABELS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
11196
11293
|
function buildCalendarGrid(year, month) {
|
|
11197
11294
|
const firstDay = new Date(year, month, 1);
|
|
@@ -11305,6 +11402,7 @@ var DatePicker = React65.forwardRef(
|
|
|
11305
11402
|
getDateState,
|
|
11306
11403
|
getDateAccessibilityLabel,
|
|
11307
11404
|
isDateDisabled,
|
|
11405
|
+
focusDate,
|
|
11308
11406
|
minDate,
|
|
11309
11407
|
maxDate
|
|
11310
11408
|
} = _b, rest = __objRest(_b, [
|
|
@@ -11326,6 +11424,7 @@ var DatePicker = React65.forwardRef(
|
|
|
11326
11424
|
"getDateState",
|
|
11327
11425
|
"getDateAccessibilityLabel",
|
|
11328
11426
|
"isDateDisabled",
|
|
11427
|
+
"focusDate",
|
|
11329
11428
|
"minDate",
|
|
11330
11429
|
"maxDate"
|
|
11331
11430
|
]);
|
|
@@ -11362,6 +11461,18 @@ var DatePicker = React65.forwardRef(
|
|
|
11362
11461
|
}),
|
|
11363
11462
|
[datePicker, dt, theme2]
|
|
11364
11463
|
);
|
|
11464
|
+
const cellRefs = useRef(/* @__PURE__ */ new Map());
|
|
11465
|
+
const focusTime = focusDate == null ? void 0 : focusDate.getTime();
|
|
11466
|
+
useEffect(() => {
|
|
11467
|
+
if (focusTime === void 0) return;
|
|
11468
|
+
const target = new Date(focusTime);
|
|
11469
|
+
if (target.getFullYear() !== year || target.getMonth() !== month) return;
|
|
11470
|
+
const timeout = setTimeout(() => {
|
|
11471
|
+
const cell = cellRefs.current.get(toDateKey(target));
|
|
11472
|
+
if (cell) AccessibilityInfo.sendAccessibilityEvent(cell, "focus");
|
|
11473
|
+
}, FOCUS_DELAY_MS);
|
|
11474
|
+
return () => clearTimeout(timeout);
|
|
11475
|
+
}, [focusTime, year, month]);
|
|
11365
11476
|
const resolvedGetDateState = useCallback(
|
|
11366
11477
|
(date) => {
|
|
11367
11478
|
var _a3;
|
|
@@ -11519,7 +11630,7 @@ var DatePicker = React65.forwardRef(
|
|
|
11519
11630
|
) })
|
|
11520
11631
|
] }),
|
|
11521
11632
|
/* @__PURE__ */ jsx(
|
|
11522
|
-
|
|
11633
|
+
Animated10.View,
|
|
11523
11634
|
{
|
|
11524
11635
|
entering: MONTH_SLIDE_ENTERING[slideDir],
|
|
11525
11636
|
exiting: MONTH_SLIDE_EXITING[slideDir],
|
|
@@ -11554,6 +11665,11 @@ var DatePicker = React65.forwardRef(
|
|
|
11554
11665
|
return /* @__PURE__ */ jsx(
|
|
11555
11666
|
Pressable,
|
|
11556
11667
|
{
|
|
11668
|
+
ref: (node) => {
|
|
11669
|
+
const key = toDateKey(date);
|
|
11670
|
+
if (node) cellRefs.current.set(key, node);
|
|
11671
|
+
else cellRefs.current.delete(key);
|
|
11672
|
+
},
|
|
11557
11673
|
onPress: !isDisabled ? () => onDateSelect == null ? void 0 : onDateSelect(date) : void 0,
|
|
11558
11674
|
disabled: isDisabled,
|
|
11559
11675
|
accessible: true,
|
|
@@ -12791,7 +12907,7 @@ var ShineOverlay = ({
|
|
|
12791
12907
|
{ borderRadius: radius, overflow: "hidden" }
|
|
12792
12908
|
],
|
|
12793
12909
|
children: width > 0 && /* @__PURE__ */ jsx(
|
|
12794
|
-
|
|
12910
|
+
Animated10.View,
|
|
12795
12911
|
{
|
|
12796
12912
|
style: [
|
|
12797
12913
|
{ position: "absolute", top: 0, bottom: 0, width: bandWidth },
|
|
@@ -12846,7 +12962,7 @@ var createNudgingIcon = (IconComponent, axis, direction) => {
|
|
|
12846
12962
|
const nudgeStyle = useAnimatedStyle(
|
|
12847
12963
|
() => axis === "translateX" ? { transform: [{ translateX: offset.value }] } : { transform: [{ translateY: offset.value }] }
|
|
12848
12964
|
);
|
|
12849
|
-
return /* @__PURE__ */ jsx(
|
|
12965
|
+
return /* @__PURE__ */ jsx(Animated10.View, { style: nudgeStyle, children: /* @__PURE__ */ jsx(IconComponent, __spreadValues({}, props)) });
|
|
12850
12966
|
};
|
|
12851
12967
|
NudgingIcon.displayName = `Nudging(${(_a = IconComponent.displayName) != null ? _a : "Icon"})`;
|
|
12852
12968
|
return NudgingIcon;
|