@butternutbox/pawprint-native 1.6.0 → 1.6.2
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 +34 -0
- package/dist/index.cjs +38 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -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 +78 -1
- package/src/components/molecules/SelectField/SelectField.tsx +59 -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[32m575.22 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 7644ms
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m543.22 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m1.13 MB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 7647ms
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 21210ms
|
|
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,39 @@
|
|
|
1
1
|
# @butternutbox/pawprint-native
|
|
2
2
|
|
|
3
|
+
## 1.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2bdd943: fix(INC-4913): keep the searchable dropdown anchored to its field wherever the field moves
|
|
8
|
+
|
|
9
|
+
The dropdown re-measured its field only when the keyboard showed or hid. A
|
|
10
|
+
`KeyboardAwareScrollView` also scrolls the focused input while the keyboard is
|
|
11
|
+
already up — on every keystroke, and when the app asks it to re-check the
|
|
12
|
+
focused input — so the field moved and the list stayed behind the keyboard.
|
|
13
|
+
|
|
14
|
+
While open, the dropdown now measures its field each frame and moves the list
|
|
15
|
+
once the field has come to rest, whatever moved it.
|
|
16
|
+
|
|
17
|
+
## 1.6.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 047b351: fix(INC-4913): re-anchor the searchable dropdown when the keyboard moves its field
|
|
22
|
+
|
|
23
|
+
`SelectPrimitive.Trigger` measures the trigger once, synchronously, on press,
|
|
24
|
+
and the searchable field then re-renders into search mode — where the trigger
|
|
25
|
+
is a plain `View` rather than a `SelectPrimitive.Trigger`, so the measured node
|
|
26
|
+
unmounts and nothing can measure it again. Any scroll after that point, such as
|
|
27
|
+
a `KeyboardAwareScrollView` lifting the focused search input clear of the
|
|
28
|
+
keyboard, moved the field while the dropdown stayed at the coordinates the
|
|
29
|
+
field used to occupy.
|
|
30
|
+
|
|
31
|
+
The dropdown now re-measures its trigger and pushes the new position through
|
|
32
|
+
`setTriggerPosition` when the keyboard shows or hides, so the list follows the
|
|
33
|
+
field instead of being stranded over the keyboard. Reported by the direct-sales
|
|
34
|
+
team: on the breed step with two or three dogs, the lower fields scroll up and
|
|
35
|
+
their dropdown is left behind.
|
|
36
|
+
|
|
3
37
|
## 1.6.0
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -9072,6 +9072,35 @@ var StyledRoot14 = styled51__default.default(reactNative.View)(({ theme: theme2
|
|
|
9072
9072
|
gap: parseTokenValue48(spacing.gap)
|
|
9073
9073
|
};
|
|
9074
9074
|
});
|
|
9075
|
+
var isSamePosition = (a, b) => a !== null && b !== null && a.width === b.width && a.height === b.height && a.pageX === b.pageX && a.pageY === b.pageY;
|
|
9076
|
+
function SelectFieldAnchor({ triggerRef, enabled }) {
|
|
9077
|
+
const { triggerPosition, setTriggerPosition } = SelectPrimitive3__namespace.useRootContext();
|
|
9078
|
+
const anchoredRef = React66__default.default.useRef(null);
|
|
9079
|
+
React66__default.default.useEffect(() => {
|
|
9080
|
+
anchoredRef.current = triggerPosition != null ? triggerPosition : null;
|
|
9081
|
+
}, [triggerPosition]);
|
|
9082
|
+
React66__default.default.useEffect(() => {
|
|
9083
|
+
if (!enabled) return;
|
|
9084
|
+
let frame;
|
|
9085
|
+
let previous = null;
|
|
9086
|
+
const track = () => {
|
|
9087
|
+
var _a;
|
|
9088
|
+
(_a = triggerRef.current) == null ? void 0 : _a.measure((_x, _y, width, height, pageX, pageY) => {
|
|
9089
|
+
const measured = { width, height, pageX, pageY };
|
|
9090
|
+
const settled = isSamePosition(measured, previous);
|
|
9091
|
+
if (settled && !isSamePosition(measured, anchoredRef.current)) {
|
|
9092
|
+
anchoredRef.current = measured;
|
|
9093
|
+
setTriggerPosition(measured);
|
|
9094
|
+
}
|
|
9095
|
+
previous = measured;
|
|
9096
|
+
});
|
|
9097
|
+
frame = requestAnimationFrame(track);
|
|
9098
|
+
};
|
|
9099
|
+
frame = requestAnimationFrame(track);
|
|
9100
|
+
return () => cancelAnimationFrame(frame);
|
|
9101
|
+
}, [enabled, setTriggerPosition, triggerRef]);
|
|
9102
|
+
return null;
|
|
9103
|
+
}
|
|
9075
9104
|
var SelectFieldRoot = React66__default.default.forwardRef(
|
|
9076
9105
|
(_a, ref) => {
|
|
9077
9106
|
var _b = _a, {
|
|
@@ -9121,6 +9150,7 @@ var SelectFieldRoot = React66__default.default.forwardRef(
|
|
|
9121
9150
|
const [searchQuery, setSearchQuery] = React66__default.default.useState("");
|
|
9122
9151
|
const [clearKey, setClearKey] = React66__default.default.useState(0);
|
|
9123
9152
|
const searchInputRef = React66__default.default.useRef(null);
|
|
9153
|
+
const triggerViewRef = React66__default.default.useRef(null);
|
|
9124
9154
|
const isQueryMode = searchable && typeof onSearchQuery === "function";
|
|
9125
9155
|
const [searchResults, setSearchResults] = React66__default.default.useState([]);
|
|
9126
9156
|
const [isSearching, setIsSearching] = React66__default.default.useState(false);
|
|
@@ -9281,6 +9311,7 @@ var SelectFieldRoot = React66__default.default.forwardRef(
|
|
|
9281
9311
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9282
9312
|
SelectFieldTrigger,
|
|
9283
9313
|
{
|
|
9314
|
+
ref: triggerViewRef,
|
|
9284
9315
|
state,
|
|
9285
9316
|
leadingIcon,
|
|
9286
9317
|
isOpen,
|
|
@@ -9310,6 +9341,13 @@ var SelectFieldRoot = React66__default.default.forwardRef(
|
|
|
9310
9341
|
description && /* @__PURE__ */ jsxRuntime.jsx(InputDescription, { state, children: description }),
|
|
9311
9342
|
error && state === "error" && /* @__PURE__ */ jsxRuntime.jsx(InputError, { children: error })
|
|
9312
9343
|
] })),
|
|
9344
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9345
|
+
SelectFieldAnchor,
|
|
9346
|
+
{
|
|
9347
|
+
triggerRef: triggerViewRef,
|
|
9348
|
+
enabled: searchable && isOpen
|
|
9349
|
+
}
|
|
9350
|
+
),
|
|
9313
9351
|
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
9352
|
itemsToRender.map((child) => {
|
|
9315
9353
|
if (React66__default.default.isValidElement(child) && child.type === SelectFieldItem) {
|