@butternutbox/pawprint-native 1.5.1 → 1.6.1
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 +26 -0
- package/dist/index.cjs +50 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +50 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__mocks__/react-native.tsx +46 -5
- package/src/__mocks__/rn-primitives/select.tsx +22 -3
- package/src/components/molecules/Drawer/Drawer.test.tsx +49 -2
- package/src/components/molecules/Drawer/Drawer.tsx +32 -3
- package/src/components/molecules/SelectField/SelectField.test.tsx +47 -0
- package/src/components/molecules/SelectField/SelectField.tsx +35 -0
package/dist/index.d.cts
CHANGED
|
@@ -941,6 +941,14 @@ type DrawerRootOwnProps = {
|
|
|
941
941
|
open?: boolean;
|
|
942
942
|
defaultOpen?: boolean;
|
|
943
943
|
onOpenChange?: (open: boolean) => void;
|
|
944
|
+
/**
|
|
945
|
+
* Called once the drawer has fully closed: the exit animation has finished
|
|
946
|
+
* and the native `Modal` has been removed. Use it to chain work that can't
|
|
947
|
+
* overlap the drawer, such as opening another modal drawer (iOS won't present
|
|
948
|
+
* a second `Modal` while the first is still on screen) or unmounting the
|
|
949
|
+
* drawer's host.
|
|
950
|
+
*/
|
|
951
|
+
onExitComplete?: () => void;
|
|
944
952
|
/**
|
|
945
953
|
* Whether the drawer shows a dimming backdrop and presents as a blocking
|
|
946
954
|
* modal (default `true`). Set to `false` for a backdrop-less, pass-through
|
package/dist/index.d.ts
CHANGED
|
@@ -941,6 +941,14 @@ type DrawerRootOwnProps = {
|
|
|
941
941
|
open?: boolean;
|
|
942
942
|
defaultOpen?: boolean;
|
|
943
943
|
onOpenChange?: (open: boolean) => void;
|
|
944
|
+
/**
|
|
945
|
+
* Called once the drawer has fully closed: the exit animation has finished
|
|
946
|
+
* and the native `Modal` has been removed. Use it to chain work that can't
|
|
947
|
+
* overlap the drawer, such as opening another modal drawer (iOS won't present
|
|
948
|
+
* a second `Modal` while the first is still on screen) or unmounting the
|
|
949
|
+
* drawer's host.
|
|
950
|
+
*/
|
|
951
|
+
onExitComplete?: () => void;
|
|
944
952
|
/**
|
|
945
953
|
* Whether the drawer shows a dimming backdrop and presents as a blocking
|
|
946
954
|
* modal (default `true`). Set to `false` for a backdrop-less, pass-through
|
package/dist/index.js
CHANGED
|
@@ -6409,6 +6409,7 @@ var DrawerRoot = React66.forwardRef(
|
|
|
6409
6409
|
open: controlledOpen,
|
|
6410
6410
|
defaultOpen = false,
|
|
6411
6411
|
onOpenChange,
|
|
6412
|
+
onExitComplete,
|
|
6412
6413
|
backdrop = true,
|
|
6413
6414
|
children,
|
|
6414
6415
|
style,
|
|
@@ -6417,6 +6418,7 @@ var DrawerRoot = React66.forwardRef(
|
|
|
6417
6418
|
"open",
|
|
6418
6419
|
"defaultOpen",
|
|
6419
6420
|
"onOpenChange",
|
|
6421
|
+
"onExitComplete",
|
|
6420
6422
|
"backdrop",
|
|
6421
6423
|
"children",
|
|
6422
6424
|
"style",
|
|
@@ -6439,9 +6441,19 @@ var DrawerRoot = React66.forwardRef(
|
|
|
6439
6441
|
if (!isControlled.current) setInternalOpen(false);
|
|
6440
6442
|
onOpenChange == null ? void 0 : onOpenChange(false);
|
|
6441
6443
|
}, [onOpenChange]);
|
|
6442
|
-
const
|
|
6444
|
+
const handleExitComplete = useCallback(() => {
|
|
6443
6445
|
setModalVisible(false);
|
|
6444
6446
|
}, []);
|
|
6447
|
+
const onExitCompleteRef = useRef(onExitComplete);
|
|
6448
|
+
onExitCompleteRef.current = onExitComplete;
|
|
6449
|
+
const wasModalVisible = useRef(modalVisible);
|
|
6450
|
+
useEffect(() => {
|
|
6451
|
+
var _a2;
|
|
6452
|
+
if (wasModalVisible.current && !modalVisible) {
|
|
6453
|
+
(_a2 = onExitCompleteRef.current) == null ? void 0 : _a2.call(onExitCompleteRef);
|
|
6454
|
+
}
|
|
6455
|
+
wasModalVisible.current = modalVisible;
|
|
6456
|
+
}, [modalVisible]);
|
|
6445
6457
|
const ctx = useMemo(
|
|
6446
6458
|
() => ({
|
|
6447
6459
|
isOpen,
|
|
@@ -6449,9 +6461,16 @@ var DrawerRoot = React66.forwardRef(
|
|
|
6449
6461
|
backdrop,
|
|
6450
6462
|
openDrawer,
|
|
6451
6463
|
closeDrawer,
|
|
6452
|
-
onExitComplete
|
|
6464
|
+
onExitComplete: handleExitComplete
|
|
6453
6465
|
}),
|
|
6454
|
-
[
|
|
6466
|
+
[
|
|
6467
|
+
isOpen,
|
|
6468
|
+
modalVisible,
|
|
6469
|
+
backdrop,
|
|
6470
|
+
openDrawer,
|
|
6471
|
+
closeDrawer,
|
|
6472
|
+
handleExitComplete
|
|
6473
|
+
]
|
|
6455
6474
|
);
|
|
6456
6475
|
return /* @__PURE__ */ jsx(DrawerContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
6457
6476
|
View,
|
|
@@ -9022,6 +9041,25 @@ var StyledRoot14 = styled51(View)(({ theme: theme2 }) => {
|
|
|
9022
9041
|
gap: parseTokenValue48(spacing.gap)
|
|
9023
9042
|
};
|
|
9024
9043
|
});
|
|
9044
|
+
function SelectFieldAnchor({ triggerRef, enabled }) {
|
|
9045
|
+
const { setTriggerPosition } = SelectPrimitive3.useRootContext();
|
|
9046
|
+
React66.useEffect(() => {
|
|
9047
|
+
if (!enabled) return;
|
|
9048
|
+
const reanchor = () => {
|
|
9049
|
+
var _a;
|
|
9050
|
+
(_a = triggerRef.current) == null ? void 0 : _a.measure((_x, _y, width, height, pageX, pageY) => {
|
|
9051
|
+
setTriggerPosition({ width, height, pageX, pageY });
|
|
9052
|
+
});
|
|
9053
|
+
};
|
|
9054
|
+
const shown = Keyboard.addListener("keyboardDidShow", reanchor);
|
|
9055
|
+
const hidden = Keyboard.addListener("keyboardDidHide", reanchor);
|
|
9056
|
+
return () => {
|
|
9057
|
+
shown.remove();
|
|
9058
|
+
hidden.remove();
|
|
9059
|
+
};
|
|
9060
|
+
}, [enabled, setTriggerPosition, triggerRef]);
|
|
9061
|
+
return null;
|
|
9062
|
+
}
|
|
9025
9063
|
var SelectFieldRoot = React66.forwardRef(
|
|
9026
9064
|
(_a, ref) => {
|
|
9027
9065
|
var _b = _a, {
|
|
@@ -9071,6 +9109,7 @@ var SelectFieldRoot = React66.forwardRef(
|
|
|
9071
9109
|
const [searchQuery, setSearchQuery] = React66.useState("");
|
|
9072
9110
|
const [clearKey, setClearKey] = React66.useState(0);
|
|
9073
9111
|
const searchInputRef = React66.useRef(null);
|
|
9112
|
+
const triggerViewRef = React66.useRef(null);
|
|
9074
9113
|
const isQueryMode = searchable && typeof onSearchQuery === "function";
|
|
9075
9114
|
const [searchResults, setSearchResults] = React66.useState([]);
|
|
9076
9115
|
const [isSearching, setIsSearching] = React66.useState(false);
|
|
@@ -9231,6 +9270,7 @@ var SelectFieldRoot = React66.forwardRef(
|
|
|
9231
9270
|
/* @__PURE__ */ jsx(
|
|
9232
9271
|
SelectFieldTrigger,
|
|
9233
9272
|
{
|
|
9273
|
+
ref: triggerViewRef,
|
|
9234
9274
|
state,
|
|
9235
9275
|
leadingIcon,
|
|
9236
9276
|
isOpen,
|
|
@@ -9260,6 +9300,13 @@ var SelectFieldRoot = React66.forwardRef(
|
|
|
9260
9300
|
description && /* @__PURE__ */ jsx(InputDescription, { state, children: description }),
|
|
9261
9301
|
error && state === "error" && /* @__PURE__ */ jsx(InputError, { children: error })
|
|
9262
9302
|
] })),
|
|
9303
|
+
/* @__PURE__ */ jsx(
|
|
9304
|
+
SelectFieldAnchor,
|
|
9305
|
+
{
|
|
9306
|
+
triggerRef: triggerViewRef,
|
|
9307
|
+
enabled: searchable && isOpen
|
|
9308
|
+
}
|
|
9309
|
+
),
|
|
9263
9310
|
showContent && hasContentToShow && /* @__PURE__ */ jsx(SelectFieldContent, { children: isSearching ? /* @__PURE__ */ jsx(StyledStatusRow, { children: /* @__PURE__ */ jsx(Spinner, { size: "sm" }) }) : searchFailed ? /* @__PURE__ */ jsx(StyledStatusRow, { children: /* @__PURE__ */ jsx(Typography, { size: "sm", children: errorText }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9264
9311
|
itemsToRender.map((child) => {
|
|
9265
9312
|
if (React66.isValidElement(child) && child.type === SelectFieldItem) {
|