@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/dist/index.js
CHANGED
|
@@ -9041,6 +9041,25 @@ var StyledRoot14 = styled51(View)(({ theme: theme2 }) => {
|
|
|
9041
9041
|
gap: parseTokenValue48(spacing.gap)
|
|
9042
9042
|
};
|
|
9043
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
|
+
}
|
|
9044
9063
|
var SelectFieldRoot = React66.forwardRef(
|
|
9045
9064
|
(_a, ref) => {
|
|
9046
9065
|
var _b = _a, {
|
|
@@ -9090,6 +9109,7 @@ var SelectFieldRoot = React66.forwardRef(
|
|
|
9090
9109
|
const [searchQuery, setSearchQuery] = React66.useState("");
|
|
9091
9110
|
const [clearKey, setClearKey] = React66.useState(0);
|
|
9092
9111
|
const searchInputRef = React66.useRef(null);
|
|
9112
|
+
const triggerViewRef = React66.useRef(null);
|
|
9093
9113
|
const isQueryMode = searchable && typeof onSearchQuery === "function";
|
|
9094
9114
|
const [searchResults, setSearchResults] = React66.useState([]);
|
|
9095
9115
|
const [isSearching, setIsSearching] = React66.useState(false);
|
|
@@ -9250,6 +9270,7 @@ var SelectFieldRoot = React66.forwardRef(
|
|
|
9250
9270
|
/* @__PURE__ */ jsx(
|
|
9251
9271
|
SelectFieldTrigger,
|
|
9252
9272
|
{
|
|
9273
|
+
ref: triggerViewRef,
|
|
9253
9274
|
state,
|
|
9254
9275
|
leadingIcon,
|
|
9255
9276
|
isOpen,
|
|
@@ -9279,6 +9300,13 @@ var SelectFieldRoot = React66.forwardRef(
|
|
|
9279
9300
|
description && /* @__PURE__ */ jsx(InputDescription, { state, children: description }),
|
|
9280
9301
|
error && state === "error" && /* @__PURE__ */ jsx(InputError, { children: error })
|
|
9281
9302
|
] })),
|
|
9303
|
+
/* @__PURE__ */ jsx(
|
|
9304
|
+
SelectFieldAnchor,
|
|
9305
|
+
{
|
|
9306
|
+
triggerRef: triggerViewRef,
|
|
9307
|
+
enabled: searchable && isOpen
|
|
9308
|
+
}
|
|
9309
|
+
),
|
|
9282
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: [
|
|
9283
9311
|
itemsToRender.map((child) => {
|
|
9284
9312
|
if (React66.isValidElement(child) && child.type === SelectFieldItem) {
|