@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/dist/index.js CHANGED
@@ -9041,6 +9041,35 @@ var StyledRoot14 = styled51(View)(({ theme: theme2 }) => {
9041
9041
  gap: parseTokenValue48(spacing.gap)
9042
9042
  };
9043
9043
  });
9044
+ var isSamePosition = (a, b) => a !== null && b !== null && a.width === b.width && a.height === b.height && a.pageX === b.pageX && a.pageY === b.pageY;
9045
+ function SelectFieldAnchor({ triggerRef, enabled }) {
9046
+ const { triggerPosition, setTriggerPosition } = SelectPrimitive3.useRootContext();
9047
+ const anchoredRef = React66.useRef(null);
9048
+ React66.useEffect(() => {
9049
+ anchoredRef.current = triggerPosition != null ? triggerPosition : null;
9050
+ }, [triggerPosition]);
9051
+ React66.useEffect(() => {
9052
+ if (!enabled) return;
9053
+ let frame;
9054
+ let previous = null;
9055
+ const track = () => {
9056
+ var _a;
9057
+ (_a = triggerRef.current) == null ? void 0 : _a.measure((_x, _y, width, height, pageX, pageY) => {
9058
+ const measured = { width, height, pageX, pageY };
9059
+ const settled = isSamePosition(measured, previous);
9060
+ if (settled && !isSamePosition(measured, anchoredRef.current)) {
9061
+ anchoredRef.current = measured;
9062
+ setTriggerPosition(measured);
9063
+ }
9064
+ previous = measured;
9065
+ });
9066
+ frame = requestAnimationFrame(track);
9067
+ };
9068
+ frame = requestAnimationFrame(track);
9069
+ return () => cancelAnimationFrame(frame);
9070
+ }, [enabled, setTriggerPosition, triggerRef]);
9071
+ return null;
9072
+ }
9044
9073
  var SelectFieldRoot = React66.forwardRef(
9045
9074
  (_a, ref) => {
9046
9075
  var _b = _a, {
@@ -9090,6 +9119,7 @@ var SelectFieldRoot = React66.forwardRef(
9090
9119
  const [searchQuery, setSearchQuery] = React66.useState("");
9091
9120
  const [clearKey, setClearKey] = React66.useState(0);
9092
9121
  const searchInputRef = React66.useRef(null);
9122
+ const triggerViewRef = React66.useRef(null);
9093
9123
  const isQueryMode = searchable && typeof onSearchQuery === "function";
9094
9124
  const [searchResults, setSearchResults] = React66.useState([]);
9095
9125
  const [isSearching, setIsSearching] = React66.useState(false);
@@ -9250,6 +9280,7 @@ var SelectFieldRoot = React66.forwardRef(
9250
9280
  /* @__PURE__ */ jsx(
9251
9281
  SelectFieldTrigger,
9252
9282
  {
9283
+ ref: triggerViewRef,
9253
9284
  state,
9254
9285
  leadingIcon,
9255
9286
  isOpen,
@@ -9279,6 +9310,13 @@ var SelectFieldRoot = React66.forwardRef(
9279
9310
  description && /* @__PURE__ */ jsx(InputDescription, { state, children: description }),
9280
9311
  error && state === "error" && /* @__PURE__ */ jsx(InputError, { children: error })
9281
9312
  ] })),
9313
+ /* @__PURE__ */ jsx(
9314
+ SelectFieldAnchor,
9315
+ {
9316
+ triggerRef: triggerViewRef,
9317
+ enabled: searchable && isOpen
9318
+ }
9319
+ ),
9282
9320
  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
9321
  itemsToRender.map((child) => {
9284
9322
  if (React66.isValidElement(child) && child.type === SelectFieldItem) {