@butternutbox/pawprint-native 2.1.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 +44 -0
- package/COMPONENT_GUIDELINES.md +12 -8
- package/dist/index.cjs +302 -187
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +231 -116
- 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 +49 -8
- 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 +10 -8
- package/src/components/molecules/Drawer/DrawerKeyboardInsetContext.ts +9 -0
- package/src/components/molecules/SelectField/SelectField.tsx +13 -3
package/dist/index.d.cts
CHANGED
|
@@ -2130,7 +2130,9 @@ type DatePickerOwnProps = {
|
|
|
2130
2130
|
getMonthLabel?: (year: number, month: number, locale?: Locale) => string;
|
|
2131
2131
|
weekDayLabels?: [string, string, string, string, string, string, string];
|
|
2132
2132
|
getDateState?: (date: Date) => DateItemState;
|
|
2133
|
+
getDateAccessibilityLabel?: (date: Date, state: DateItemState, monthLabel: string) => string;
|
|
2133
2134
|
isDateDisabled?: (date: Date) => boolean;
|
|
2135
|
+
focusDate?: Date | null;
|
|
2134
2136
|
minDate?: Date;
|
|
2135
2137
|
maxDate?: Date;
|
|
2136
2138
|
};
|
|
@@ -2157,6 +2159,10 @@ type DatePickerProps = DatePickerOwnProps & Omit<ViewProps, keyof DatePickerOwnP
|
|
|
2157
2159
|
* @param {[string,string,string,string,string,string,string]} [weekDayLabels] - Day-column labels Mon→Sun.
|
|
2158
2160
|
* @param {(date: Date) => DateItemState} [getDateState] - Returns the visual state for a date.
|
|
2159
2161
|
* Defaults to: past="previous", today="current", future="default".
|
|
2162
|
+
* @param {(date: Date, state: DateItemState, monthLabel: string) => string} [getDateAccessibilityLabel] - Returns the screen-reader label for a date,
|
|
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.
|
|
2160
2166
|
* @param {(date: Date) => boolean} [isDateDisabled] - Returns true to disable a date.
|
|
2161
2167
|
* @param {Date} [minDate] - Dates before this (exclusive of time) will be disabled.
|
|
2162
2168
|
* @param {Date} [maxDate] - Dates after this (exclusive of time) will be disabled.
|
package/dist/index.d.ts
CHANGED
|
@@ -2130,7 +2130,9 @@ type DatePickerOwnProps = {
|
|
|
2130
2130
|
getMonthLabel?: (year: number, month: number, locale?: Locale) => string;
|
|
2131
2131
|
weekDayLabels?: [string, string, string, string, string, string, string];
|
|
2132
2132
|
getDateState?: (date: Date) => DateItemState;
|
|
2133
|
+
getDateAccessibilityLabel?: (date: Date, state: DateItemState, monthLabel: string) => string;
|
|
2133
2134
|
isDateDisabled?: (date: Date) => boolean;
|
|
2135
|
+
focusDate?: Date | null;
|
|
2134
2136
|
minDate?: Date;
|
|
2135
2137
|
maxDate?: Date;
|
|
2136
2138
|
};
|
|
@@ -2157,6 +2159,10 @@ type DatePickerProps = DatePickerOwnProps & Omit<ViewProps, keyof DatePickerOwnP
|
|
|
2157
2159
|
* @param {[string,string,string,string,string,string,string]} [weekDayLabels] - Day-column labels Mon→Sun.
|
|
2158
2160
|
* @param {(date: Date) => DateItemState} [getDateState] - Returns the visual state for a date.
|
|
2159
2161
|
* Defaults to: past="previous", today="current", future="default".
|
|
2162
|
+
* @param {(date: Date, state: DateItemState, monthLabel: string) => string} [getDateAccessibilityLabel] - Returns the screen-reader label for a date,
|
|
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.
|
|
2160
2166
|
* @param {(date: Date) => boolean} [isDateDisabled] - Returns true to disable a date.
|
|
2161
2167
|
* @param {Date} [minDate] - Dates before this (exclusive of time) will be disabled.
|
|
2162
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,18 +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
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
+
accessibilityViewIsModal: true,
|
|
6010
|
+
onAccessibilityEscape: closeDrawer,
|
|
6011
|
+
onStartShouldSetResponder: claimTouch
|
|
6009
6012
|
}, props), {
|
|
6010
6013
|
children: [
|
|
6011
|
-
/* @__PURE__ */ jsx(DrawerBodyMaxContext.Provider, { value: bodyMax, children }),
|
|
6014
|
+
/* @__PURE__ */ jsx(DrawerBodyMaxContext.Provider, { value: bodyMax, children: /* @__PURE__ */ jsx(DrawerKeyboardInsetContext.Provider, { value: keyboardSpacer, children }) }),
|
|
6012
6015
|
/* @__PURE__ */ jsx(Animated.View, { style: { height: keyboardSpacer } })
|
|
6013
6016
|
]
|
|
6014
6017
|
})
|
|
@@ -6321,27 +6324,36 @@ var DrawerDescription = React65.forwardRef(
|
|
|
6321
6324
|
);
|
|
6322
6325
|
DrawerDescription.displayName = "Drawer.Description";
|
|
6323
6326
|
var parseTokenValue27 = (value) => parseFloat(value);
|
|
6324
|
-
var StyledScrollView = styled52(ScrollView)(
|
|
6325
|
-
(
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
flexGrow: 0,
|
|
6335
|
-
flexShrink: 1,
|
|
6336
|
-
paddingLeft: bodyPaddingHorizontal,
|
|
6337
|
-
paddingRight: bodyPaddingRight,
|
|
6338
|
-
maxHeight: bodyMaxHeight,
|
|
6339
|
-
paddingBottom: bodyPaddingBottom
|
|
6340
|
-
})
|
|
6341
|
-
);
|
|
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
|
+
}));
|
|
6342
6337
|
var DrawerBody = React65.forwardRef(
|
|
6343
6338
|
(_a, ref) => {
|
|
6344
|
-
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;
|
|
6345
6357
|
const theme2 = useTheme();
|
|
6346
6358
|
const { spacing } = theme2.tokens.components.drawer;
|
|
6347
6359
|
const { buttons } = theme2.tokens.components;
|
|
@@ -6349,12 +6361,83 @@ var DrawerBody = React65.forwardRef(
|
|
|
6349
6361
|
const headerContext = useDrawerHeaderContext();
|
|
6350
6362
|
const footerContext = useDrawerFooterContext();
|
|
6351
6363
|
const providedMaxHeight = useDrawerBodyMax();
|
|
6364
|
+
const keyboardInset = useDrawerKeyboardInset();
|
|
6352
6365
|
const { height: windowHeight } = useWindowDimensions();
|
|
6353
6366
|
const insets = useSafeAreaInsets();
|
|
6354
6367
|
const gap = parseTokenValue27(content.slot.gap);
|
|
6355
6368
|
const horizontalPadding = parseTokenValue27(content.slot.horizontalPadding);
|
|
6356
6369
|
const topPadding = parseTokenValue27(content.slot.verticalPadding);
|
|
6357
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]);
|
|
6358
6441
|
const paddingRight = headerContext === null ? parseTokenValue27(spacing.close.right.md) + parseTokenValue27(buttons.size.sm.minHeight) : horizontalPadding;
|
|
6359
6442
|
const bodyPaddingBottom = !footerContext ? Math.max(
|
|
6360
6443
|
parseTokenValue27(theme2.tokens.semantics.dimensions.spacing["2xl"]),
|
|
@@ -6363,11 +6446,12 @@ var DrawerBody = React65.forwardRef(
|
|
|
6363
6446
|
return /* @__PURE__ */ jsx(
|
|
6364
6447
|
StyledScrollView,
|
|
6365
6448
|
__spreadProps(__spreadValues({
|
|
6366
|
-
ref,
|
|
6449
|
+
ref: combinedRef,
|
|
6450
|
+
innerViewRef: contentRef,
|
|
6367
6451
|
bodyPaddingHorizontal: horizontalPadding,
|
|
6368
6452
|
bodyPaddingRight: paddingRight,
|
|
6369
|
-
bodyMaxHeight,
|
|
6370
6453
|
bodyPaddingBottom,
|
|
6454
|
+
style: [restStyle, { maxHeight }],
|
|
6371
6455
|
contentContainerStyle: [
|
|
6372
6456
|
{
|
|
6373
6457
|
gap,
|
|
@@ -6375,7 +6459,11 @@ var DrawerBody = React65.forwardRef(
|
|
|
6375
6459
|
paddingBottom: 0
|
|
6376
6460
|
},
|
|
6377
6461
|
contentContainerStyle
|
|
6378
|
-
]
|
|
6462
|
+
],
|
|
6463
|
+
keyboardShouldPersistTaps,
|
|
6464
|
+
scrollEventThrottle,
|
|
6465
|
+
onScroll: handleScroll,
|
|
6466
|
+
onLayout: handleLayout
|
|
6379
6467
|
}, props), {
|
|
6380
6468
|
children
|
|
6381
6469
|
})
|
|
@@ -7921,7 +8009,7 @@ var StyledTrack = styled52(View)(({ trackHeight, trackMinWidth, trackBorderRadiu
|
|
|
7921
8009
|
backgroundColor: trackBgColor,
|
|
7922
8010
|
overflow: "hidden"
|
|
7923
8011
|
}));
|
|
7924
|
-
var StyledIndicator = styled52(
|
|
8012
|
+
var StyledIndicator = styled52(Animated10.View)(({ indicatorBorderRadius, indicatorBgColor }) => ({
|
|
7925
8013
|
height: "100%",
|
|
7926
8014
|
borderRadius: indicatorBorderRadius,
|
|
7927
8015
|
backgroundColor: indicatorBgColor
|
|
@@ -9131,9 +9219,17 @@ var SelectField = React65.forwardRef(
|
|
|
9131
9219
|
}
|
|
9132
9220
|
);
|
|
9133
9221
|
}, [windowHeight, keyboardHeight, maxDropdownHeight]);
|
|
9222
|
+
const isOpen = isFocused && !disabled;
|
|
9134
9223
|
React65.useEffect(() => {
|
|
9135
|
-
if (
|
|
9136
|
-
|
|
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]);
|
|
9137
9233
|
React65.useEffect(() => {
|
|
9138
9234
|
if (!isControlled || isFocused) return;
|
|
9139
9235
|
if (value === null || value === void 0) {
|
|
@@ -9192,7 +9288,6 @@ var SelectField = React65.forwardRef(
|
|
|
9192
9288
|
if (searchable) (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
9193
9289
|
};
|
|
9194
9290
|
const fieldState = error ? "error" : state;
|
|
9195
|
-
const isOpen = isFocused && !disabled;
|
|
9196
9291
|
const clearAction = !disabled && inputText.length > 0 ? /* @__PURE__ */ jsx(
|
|
9197
9292
|
Pressable,
|
|
9198
9293
|
{
|
|
@@ -9504,7 +9599,7 @@ var Wrapper = styled52(View)({
|
|
|
9504
9599
|
alignItems: "center",
|
|
9505
9600
|
justifyContent: "space-between"
|
|
9506
9601
|
});
|
|
9507
|
-
var SelectIcon = styled52(
|
|
9602
|
+
var SelectIcon = styled52(Animated10.View)({
|
|
9508
9603
|
position: "absolute",
|
|
9509
9604
|
right: 0,
|
|
9510
9605
|
marginRight: 0
|
|
@@ -10055,9 +10150,9 @@ var Slider = React65.forwardRef(
|
|
|
10055
10150
|
onLayout: handleNativeLayout,
|
|
10056
10151
|
children: [
|
|
10057
10152
|
/* @__PURE__ */ jsx(View, { style: trackBackgroundStyle }),
|
|
10058
|
-
/* @__PURE__ */ jsx(
|
|
10153
|
+
/* @__PURE__ */ jsx(Animated10.View, { style: [indicatorBaseStyle, indicatorAnimStyle] }),
|
|
10059
10154
|
/* @__PURE__ */ jsx(
|
|
10060
|
-
|
|
10155
|
+
Animated10.View,
|
|
10061
10156
|
{
|
|
10062
10157
|
style: [
|
|
10063
10158
|
__spreadProps(__spreadValues({}, thumbStyle), { position: "absolute", left: 0 }),
|
|
@@ -10471,7 +10566,7 @@ var StackedCard = ({
|
|
|
10471
10566
|
}));
|
|
10472
10567
|
const isFront = depth === 0;
|
|
10473
10568
|
return /* @__PURE__ */ jsx(
|
|
10474
|
-
|
|
10569
|
+
Animated10.View,
|
|
10475
10570
|
{
|
|
10476
10571
|
entering: wasBackfill ? void 0 : CARD_ENTERING,
|
|
10477
10572
|
exiting: CARD_EXITING,
|
|
@@ -10479,7 +10574,7 @@ var StackedCard = ({
|
|
|
10479
10574
|
accessibilityElementsHidden: !isFront,
|
|
10480
10575
|
importantForAccessibility: isFront ? "auto" : "no-hide-descendants",
|
|
10481
10576
|
style: [CARD_BASE_STYLE, { zIndex: -depth }],
|
|
10482
|
-
children: /* @__PURE__ */ jsx(
|
|
10577
|
+
children: /* @__PURE__ */ jsx(Animated10.View, { style: [DEPTH_LAYER_STYLE, depthStyle], children: /* @__PURE__ */ jsx(
|
|
10483
10578
|
Notification,
|
|
10484
10579
|
{
|
|
10485
10580
|
variant: "toast",
|
|
@@ -11193,6 +11288,7 @@ var MONTH_SLIDE_EXITING = {
|
|
|
11193
11288
|
forward: FadeOutLeft.duration(200),
|
|
11194
11289
|
backward: FadeOutRight.duration(200)
|
|
11195
11290
|
};
|
|
11291
|
+
var FOCUS_DELAY_MS = 150;
|
|
11196
11292
|
var DEFAULT_WEEK_LABELS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
11197
11293
|
function buildCalendarGrid(year, month) {
|
|
11198
11294
|
const firstDay = new Date(year, month, 1);
|
|
@@ -11304,7 +11400,9 @@ var DatePicker = React65.forwardRef(
|
|
|
11304
11400
|
getMonthLabel,
|
|
11305
11401
|
weekDayLabels = DEFAULT_WEEK_LABELS,
|
|
11306
11402
|
getDateState,
|
|
11403
|
+
getDateAccessibilityLabel,
|
|
11307
11404
|
isDateDisabled,
|
|
11405
|
+
focusDate,
|
|
11308
11406
|
minDate,
|
|
11309
11407
|
maxDate
|
|
11310
11408
|
} = _b, rest = __objRest(_b, [
|
|
@@ -11324,7 +11422,9 @@ var DatePicker = React65.forwardRef(
|
|
|
11324
11422
|
"getMonthLabel",
|
|
11325
11423
|
"weekDayLabels",
|
|
11326
11424
|
"getDateState",
|
|
11425
|
+
"getDateAccessibilityLabel",
|
|
11327
11426
|
"isDateDisabled",
|
|
11427
|
+
"focusDate",
|
|
11328
11428
|
"minDate",
|
|
11329
11429
|
"maxDate"
|
|
11330
11430
|
]);
|
|
@@ -11361,6 +11461,18 @@ var DatePicker = React65.forwardRef(
|
|
|
11361
11461
|
}),
|
|
11362
11462
|
[datePicker, dt, theme2]
|
|
11363
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]);
|
|
11364
11476
|
const resolvedGetDateState = useCallback(
|
|
11365
11477
|
(date) => {
|
|
11366
11478
|
var _a3;
|
|
@@ -11500,6 +11612,7 @@ var DatePicker = React65.forwardRef(
|
|
|
11500
11612
|
token: datePicker.month.typography,
|
|
11501
11613
|
align: "center",
|
|
11502
11614
|
color: datePicker.month.colour.text.default,
|
|
11615
|
+
accessibilityRole: "header",
|
|
11503
11616
|
children: resolvedMonthLabel
|
|
11504
11617
|
}
|
|
11505
11618
|
) }),
|
|
@@ -11517,86 +11630,88 @@ var DatePicker = React65.forwardRef(
|
|
|
11517
11630
|
) })
|
|
11518
11631
|
] }),
|
|
11519
11632
|
/* @__PURE__ */ jsx(
|
|
11520
|
-
|
|
11633
|
+
Animated10.View,
|
|
11521
11634
|
{
|
|
11522
11635
|
entering: MONTH_SLIDE_ENTERING[slideDir],
|
|
11523
11636
|
exiting: MONTH_SLIDE_EXITING[slideDir],
|
|
11524
|
-
children: /* @__PURE__ */ jsx(
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11637
|
+
children: /* @__PURE__ */ jsx(StyledDatesGrid, { rowGap, children: calendarRows.map((row, rowIdx) => /* @__PURE__ */ jsx(StyledDateRow, { children: row.map(
|
|
11638
|
+
(date, colIdx) => !date ? /* @__PURE__ */ jsx(
|
|
11639
|
+
StyledDateCell,
|
|
11640
|
+
{
|
|
11641
|
+
cellHeight,
|
|
11642
|
+
accessibilityElementsHidden: true
|
|
11643
|
+
},
|
|
11644
|
+
`empty-${rowIdx}-${colIdx}`
|
|
11645
|
+
) : /* @__PURE__ */ jsx(
|
|
11646
|
+
StyledDateCell,
|
|
11647
|
+
{
|
|
11648
|
+
cellHeight,
|
|
11649
|
+
children: (() => {
|
|
11650
|
+
var _a3;
|
|
11651
|
+
const isDisabled = resolvedIsDateDisabled(date);
|
|
11652
|
+
const {
|
|
11653
|
+
state,
|
|
11654
|
+
indicatorBg,
|
|
11655
|
+
indicatorBorderColor,
|
|
11656
|
+
textColor,
|
|
11657
|
+
typography,
|
|
11658
|
+
textDecoration,
|
|
11659
|
+
isSelected
|
|
11660
|
+
} = resolveDateCellConfig(date);
|
|
11661
|
+
const isUndeliverable = isDisabled && state === "default";
|
|
11662
|
+
const cellOpacity = isDisabled && !isUndeliverable ? disabledOpacity : 1;
|
|
11663
|
+
const cellTextDecoration = isUndeliverable ? "line-through" : textDecoration;
|
|
11664
|
+
const cellTextColor = isUndeliverable ? dt.colour.text.previous : textColor;
|
|
11665
|
+
return /* @__PURE__ */ jsx(
|
|
11666
|
+
Pressable,
|
|
11667
|
+
{
|
|
11668
|
+
ref: (node) => {
|
|
11669
|
+
const key = toDateKey(date);
|
|
11670
|
+
if (node) cellRefs.current.set(key, node);
|
|
11671
|
+
else cellRefs.current.delete(key);
|
|
11672
|
+
},
|
|
11673
|
+
onPress: !isDisabled ? () => onDateSelect == null ? void 0 : onDateSelect(date) : void 0,
|
|
11674
|
+
disabled: isDisabled,
|
|
11675
|
+
accessible: true,
|
|
11676
|
+
accessibilityRole: "button",
|
|
11677
|
+
accessibilityLabel: (_a3 = getDateAccessibilityLabel == null ? void 0 : getDateAccessibilityLabel(
|
|
11678
|
+
date,
|
|
11545
11679
|
state,
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
|
|
11554
|
-
|
|
11555
|
-
|
|
11556
|
-
const cellTextColor = isUndeliverable ? dt.colour.text.previous : textColor;
|
|
11557
|
-
return /* @__PURE__ */ jsx(
|
|
11558
|
-
Pressable,
|
|
11680
|
+
resolvedMonthLabel
|
|
11681
|
+
)) != null ? _a3 : `${date.getDate()} ${resolvedMonthLabel}`,
|
|
11682
|
+
accessibilityState: {
|
|
11683
|
+
selected: isSelected,
|
|
11684
|
+
disabled: isDisabled
|
|
11685
|
+
},
|
|
11686
|
+
accessibilityHint: state === "current" ? "Today" : void 0,
|
|
11687
|
+
style: { opacity: cellOpacity },
|
|
11688
|
+
children: /* @__PURE__ */ jsx(
|
|
11689
|
+
StyledIndicator3,
|
|
11559
11690
|
{
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
|
|
11563
|
-
|
|
11564
|
-
|
|
11565
|
-
|
|
11566
|
-
selected: isSelected,
|
|
11567
|
-
disabled: isDisabled
|
|
11568
|
-
},
|
|
11569
|
-
accessibilityHint: state === "current" ? "Today" : void 0,
|
|
11570
|
-
style: { opacity: cellOpacity },
|
|
11691
|
+
indicatorSize,
|
|
11692
|
+
indicatorBorderRadius,
|
|
11693
|
+
indicatorBg,
|
|
11694
|
+
indicatorBorderWidth: indicatorBorderColor !== "transparent" ? selectedBorderWidth : 0,
|
|
11695
|
+
indicatorBorderColor,
|
|
11696
|
+
indicatorBorderStyle: indicatorBorderColor !== "transparent" ? "dashed" : "solid",
|
|
11571
11697
|
children: /* @__PURE__ */ jsx(
|
|
11572
|
-
|
|
11698
|
+
Typography,
|
|
11573
11699
|
{
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
indicatorBorderColor,
|
|
11579
|
-
indicatorBorderStyle: indicatorBorderColor !== "transparent" ? "dashed" : "solid",
|
|
11580
|
-
children: /* @__PURE__ */ jsx(
|
|
11581
|
-
Typography,
|
|
11582
|
-
{
|
|
11583
|
-
color: cellTextColor,
|
|
11584
|
-
token: typography,
|
|
11585
|
-
textDecoration: cellTextDecoration,
|
|
11586
|
-
children: date.getDate().toString()
|
|
11587
|
-
}
|
|
11588
|
-
)
|
|
11700
|
+
color: cellTextColor,
|
|
11701
|
+
token: typography,
|
|
11702
|
+
textDecoration: cellTextDecoration,
|
|
11703
|
+
children: date.getDate().toString()
|
|
11589
11704
|
}
|
|
11590
11705
|
)
|
|
11591
11706
|
}
|
|
11592
|
-
)
|
|
11593
|
-
}
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
)
|
|
11598
|
-
|
|
11599
|
-
)
|
|
11707
|
+
)
|
|
11708
|
+
}
|
|
11709
|
+
);
|
|
11710
|
+
})()
|
|
11711
|
+
},
|
|
11712
|
+
toDateKey(date)
|
|
11713
|
+
)
|
|
11714
|
+
) }, rowIdx)) })
|
|
11600
11715
|
},
|
|
11601
11716
|
`${year}-${month}`
|
|
11602
11717
|
)
|
|
@@ -12792,7 +12907,7 @@ var ShineOverlay = ({
|
|
|
12792
12907
|
{ borderRadius: radius, overflow: "hidden" }
|
|
12793
12908
|
],
|
|
12794
12909
|
children: width > 0 && /* @__PURE__ */ jsx(
|
|
12795
|
-
|
|
12910
|
+
Animated10.View,
|
|
12796
12911
|
{
|
|
12797
12912
|
style: [
|
|
12798
12913
|
{ position: "absolute", top: 0, bottom: 0, width: bandWidth },
|
|
@@ -12847,7 +12962,7 @@ var createNudgingIcon = (IconComponent, axis, direction) => {
|
|
|
12847
12962
|
const nudgeStyle = useAnimatedStyle(
|
|
12848
12963
|
() => axis === "translateX" ? { transform: [{ translateX: offset.value }] } : { transform: [{ translateY: offset.value }] }
|
|
12849
12964
|
);
|
|
12850
|
-
return /* @__PURE__ */ jsx(
|
|
12965
|
+
return /* @__PURE__ */ jsx(Animated10.View, { style: nudgeStyle, children: /* @__PURE__ */ jsx(IconComponent, __spreadValues({}, props)) });
|
|
12851
12966
|
};
|
|
12852
12967
|
NudgingIcon.displayName = `Nudging(${(_a = IconComponent.displayName) != null ? _a : "Icon"})`;
|
|
12853
12968
|
return NudgingIcon;
|