@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.
@@ -7,12 +7,12 @@
7
7
  CJS Build start
8
8
  ESM Build start
9
9
  DTS Build start
10
- ESM dist/index.js 541.22 KB
11
- ESM dist/index.js.map 1.12 MB
12
- ESM ⚡️ Build success in 7846ms
13
- CJS dist/index.cjs 573.11 KB
14
- CJS dist/index.cjs.map 1.12 MB
15
- CJS ⚡️ Build success in 7847ms
16
- DTS ⚡️ Build success in 21839ms
17
- DTS dist/index.d.cts 114.50 KB
18
- DTS dist/index.d.ts 114.50 KB
10
+ CJS dist/index.cjs 574.67 KB
11
+ CJS dist/index.cjs.map 1.13 MB
12
+ CJS ⚡️ Build success in 7657ms
13
+ ESM dist/index.js 542.68 KB
14
+ ESM dist/index.js.map 1.13 MB
15
+ ESM ⚡️ Build success in 7657ms
16
+ DTS ⚡️ Build success in 21480ms
17
+ DTS dist/index.d.cts 114.88 KB
18
+ DTS dist/index.d.ts 114.88 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @butternutbox/pawprint-native
2
2
 
3
+ ## 1.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 047b351: fix(INC-4913): re-anchor the searchable dropdown when the keyboard moves its field
8
+
9
+ `SelectPrimitive.Trigger` measures the trigger once, synchronously, on press,
10
+ and the searchable field then re-renders into search mode — where the trigger
11
+ is a plain `View` rather than a `SelectPrimitive.Trigger`, so the measured node
12
+ unmounts and nothing can measure it again. Any scroll after that point, such as
13
+ a `KeyboardAwareScrollView` lifting the focused search input clear of the
14
+ keyboard, moved the field while the dropdown stayed at the coordinates the
15
+ field used to occupy.
16
+
17
+ The dropdown now re-measures its trigger and pushes the new position through
18
+ `setTriggerPosition` when the keyboard shows or hides, so the list follows the
19
+ field instead of being stranded over the keyboard. Reported by the direct-sales
20
+ team: on the breed step with two or three dogs, the lower fields scroll up and
21
+ their dropdown is left behind.
22
+
23
+ ## 1.6.0
24
+
25
+ ### Minor Changes
26
+
27
+ - 061597a: Add `onExitComplete` to `Drawer.Root`, called once the drawer has fully closed (exit animation finished and native `Modal` removed), so consumers can chain another modal drawer or unmount the drawer's host without racing the exit.
28
+
3
29
  ## 1.5.1
4
30
 
5
31
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -6440,6 +6440,7 @@ var DrawerRoot = React66__default.default.forwardRef(
6440
6440
  open: controlledOpen,
6441
6441
  defaultOpen = false,
6442
6442
  onOpenChange,
6443
+ onExitComplete,
6443
6444
  backdrop = true,
6444
6445
  children,
6445
6446
  style,
@@ -6448,6 +6449,7 @@ var DrawerRoot = React66__default.default.forwardRef(
6448
6449
  "open",
6449
6450
  "defaultOpen",
6450
6451
  "onOpenChange",
6452
+ "onExitComplete",
6451
6453
  "backdrop",
6452
6454
  "children",
6453
6455
  "style",
@@ -6470,9 +6472,19 @@ var DrawerRoot = React66__default.default.forwardRef(
6470
6472
  if (!isControlled.current) setInternalOpen(false);
6471
6473
  onOpenChange == null ? void 0 : onOpenChange(false);
6472
6474
  }, [onOpenChange]);
6473
- const onExitComplete = React66.useCallback(() => {
6475
+ const handleExitComplete = React66.useCallback(() => {
6474
6476
  setModalVisible(false);
6475
6477
  }, []);
6478
+ const onExitCompleteRef = React66.useRef(onExitComplete);
6479
+ onExitCompleteRef.current = onExitComplete;
6480
+ const wasModalVisible = React66.useRef(modalVisible);
6481
+ React66.useEffect(() => {
6482
+ var _a2;
6483
+ if (wasModalVisible.current && !modalVisible) {
6484
+ (_a2 = onExitCompleteRef.current) == null ? void 0 : _a2.call(onExitCompleteRef);
6485
+ }
6486
+ wasModalVisible.current = modalVisible;
6487
+ }, [modalVisible]);
6476
6488
  const ctx = React66.useMemo(
6477
6489
  () => ({
6478
6490
  isOpen,
@@ -6480,9 +6492,16 @@ var DrawerRoot = React66__default.default.forwardRef(
6480
6492
  backdrop,
6481
6493
  openDrawer,
6482
6494
  closeDrawer,
6483
- onExitComplete
6495
+ onExitComplete: handleExitComplete
6484
6496
  }),
6485
- [isOpen, modalVisible, backdrop, openDrawer, closeDrawer, onExitComplete]
6497
+ [
6498
+ isOpen,
6499
+ modalVisible,
6500
+ backdrop,
6501
+ openDrawer,
6502
+ closeDrawer,
6503
+ handleExitComplete
6504
+ ]
6486
6505
  );
6487
6506
  return /* @__PURE__ */ jsxRuntime.jsx(DrawerContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
6488
6507
  reactNative.View,
@@ -9053,6 +9072,25 @@ var StyledRoot14 = styled51__default.default(reactNative.View)(({ theme: theme2
9053
9072
  gap: parseTokenValue48(spacing.gap)
9054
9073
  };
9055
9074
  });
9075
+ function SelectFieldAnchor({ triggerRef, enabled }) {
9076
+ const { setTriggerPosition } = SelectPrimitive3__namespace.useRootContext();
9077
+ React66__default.default.useEffect(() => {
9078
+ if (!enabled) return;
9079
+ const reanchor = () => {
9080
+ var _a;
9081
+ (_a = triggerRef.current) == null ? void 0 : _a.measure((_x, _y, width, height, pageX, pageY) => {
9082
+ setTriggerPosition({ width, height, pageX, pageY });
9083
+ });
9084
+ };
9085
+ const shown = reactNative.Keyboard.addListener("keyboardDidShow", reanchor);
9086
+ const hidden = reactNative.Keyboard.addListener("keyboardDidHide", reanchor);
9087
+ return () => {
9088
+ shown.remove();
9089
+ hidden.remove();
9090
+ };
9091
+ }, [enabled, setTriggerPosition, triggerRef]);
9092
+ return null;
9093
+ }
9056
9094
  var SelectFieldRoot = React66__default.default.forwardRef(
9057
9095
  (_a, ref) => {
9058
9096
  var _b = _a, {
@@ -9102,6 +9140,7 @@ var SelectFieldRoot = React66__default.default.forwardRef(
9102
9140
  const [searchQuery, setSearchQuery] = React66__default.default.useState("");
9103
9141
  const [clearKey, setClearKey] = React66__default.default.useState(0);
9104
9142
  const searchInputRef = React66__default.default.useRef(null);
9143
+ const triggerViewRef = React66__default.default.useRef(null);
9105
9144
  const isQueryMode = searchable && typeof onSearchQuery === "function";
9106
9145
  const [searchResults, setSearchResults] = React66__default.default.useState([]);
9107
9146
  const [isSearching, setIsSearching] = React66__default.default.useState(false);
@@ -9262,6 +9301,7 @@ var SelectFieldRoot = React66__default.default.forwardRef(
9262
9301
  /* @__PURE__ */ jsxRuntime.jsx(
9263
9302
  SelectFieldTrigger,
9264
9303
  {
9304
+ ref: triggerViewRef,
9265
9305
  state,
9266
9306
  leadingIcon,
9267
9307
  isOpen,
@@ -9291,6 +9331,13 @@ var SelectFieldRoot = React66__default.default.forwardRef(
9291
9331
  description && /* @__PURE__ */ jsxRuntime.jsx(InputDescription, { state, children: description }),
9292
9332
  error && state === "error" && /* @__PURE__ */ jsxRuntime.jsx(InputError, { children: error })
9293
9333
  ] })),
9334
+ /* @__PURE__ */ jsxRuntime.jsx(
9335
+ SelectFieldAnchor,
9336
+ {
9337
+ triggerRef: triggerViewRef,
9338
+ enabled: searchable && isOpen
9339
+ }
9340
+ ),
9294
9341
  showContent && hasContentToShow && /* @__PURE__ */ jsxRuntime.jsx(SelectFieldContent, { children: isSearching ? /* @__PURE__ */ jsxRuntime.jsx(StyledStatusRow, { children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: "sm" }) }) : searchFailed ? /* @__PURE__ */ jsxRuntime.jsx(StyledStatusRow, { children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { size: "sm", children: errorText }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9295
9342
  itemsToRender.map((child) => {
9296
9343
  if (React66__default.default.isValidElement(child) && child.type === SelectFieldItem) {