@butternutbox/pawprint-native 1.6.0 → 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 +6 -6
- package/CHANGELOG.md +20 -0
- package/dist/index.cjs +28 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -0
- 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/SelectField/SelectField.test.tsx +47 -0
- package/src/components/molecules/SelectField/SelectField.tsx +35 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
[34mCJS[39m Build start
|
|
8
8
|
[34mESM[39m Build start
|
|
9
9
|
[34mDTS[39m Build start
|
|
10
|
-
[
|
|
11
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m1.12 MB[39m
|
|
12
|
-
[32mESM[39m ⚡️ Build success in 7672ms
|
|
13
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m573.67 KB[39m
|
|
10
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m574.67 KB[39m
|
|
14
11
|
[32mCJS[39m [1mdist/index.cjs.map [22m[32m1.13 MB[39m
|
|
15
|
-
[32mCJS[39m ⚡️ Build success in
|
|
16
|
-
[
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 7657ms
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m542.68 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m1.13 MB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 7657ms
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 21480ms
|
|
17
17
|
[32mDTS[39m [1mdist/index.d.cts [22m[32m114.88 KB[39m
|
|
18
18
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m114.88 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
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
|
+
|
|
3
23
|
## 1.6.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -9072,6 +9072,25 @@ var StyledRoot14 = styled51__default.default(reactNative.View)(({ theme: theme2
|
|
|
9072
9072
|
gap: parseTokenValue48(spacing.gap)
|
|
9073
9073
|
};
|
|
9074
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
|
+
}
|
|
9075
9094
|
var SelectFieldRoot = React66__default.default.forwardRef(
|
|
9076
9095
|
(_a, ref) => {
|
|
9077
9096
|
var _b = _a, {
|
|
@@ -9121,6 +9140,7 @@ var SelectFieldRoot = React66__default.default.forwardRef(
|
|
|
9121
9140
|
const [searchQuery, setSearchQuery] = React66__default.default.useState("");
|
|
9122
9141
|
const [clearKey, setClearKey] = React66__default.default.useState(0);
|
|
9123
9142
|
const searchInputRef = React66__default.default.useRef(null);
|
|
9143
|
+
const triggerViewRef = React66__default.default.useRef(null);
|
|
9124
9144
|
const isQueryMode = searchable && typeof onSearchQuery === "function";
|
|
9125
9145
|
const [searchResults, setSearchResults] = React66__default.default.useState([]);
|
|
9126
9146
|
const [isSearching, setIsSearching] = React66__default.default.useState(false);
|
|
@@ -9281,6 +9301,7 @@ var SelectFieldRoot = React66__default.default.forwardRef(
|
|
|
9281
9301
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9282
9302
|
SelectFieldTrigger,
|
|
9283
9303
|
{
|
|
9304
|
+
ref: triggerViewRef,
|
|
9284
9305
|
state,
|
|
9285
9306
|
leadingIcon,
|
|
9286
9307
|
isOpen,
|
|
@@ -9310,6 +9331,13 @@ var SelectFieldRoot = React66__default.default.forwardRef(
|
|
|
9310
9331
|
description && /* @__PURE__ */ jsxRuntime.jsx(InputDescription, { state, children: description }),
|
|
9311
9332
|
error && state === "error" && /* @__PURE__ */ jsxRuntime.jsx(InputError, { children: error })
|
|
9312
9333
|
] })),
|
|
9334
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9335
|
+
SelectFieldAnchor,
|
|
9336
|
+
{
|
|
9337
|
+
triggerRef: triggerViewRef,
|
|
9338
|
+
enabled: searchable && isOpen
|
|
9339
|
+
}
|
|
9340
|
+
),
|
|
9313
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: [
|
|
9314
9342
|
itemsToRender.map((child) => {
|
|
9315
9343
|
if (React66__default.default.isValidElement(child) && child.type === SelectFieldItem) {
|