tamagui 1.82.4 → 1.82.5

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/native.js CHANGED
@@ -1114,7 +1114,7 @@ var require_config_native = __commonJS({
1114
1114
  }, getConfig3 = () => {
1115
1115
  if (!conf)
1116
1116
  throw new Error(
1117
- process.env.NODE_ENV !== "production" ? "Missing tamagui config, you either have a duplicate config, or haven't set it up. Be sure createTamagui is called before rendering. Also, make sure all of your tamagui dependencies are on the same version (`tamagui`, `@tamagui/package-name`, etc.)" : "Err0"
1117
+ process.env.NODE_ENV !== "production" ? "Missing tamagui config, you either have a duplicate config, or haven't set it up. Be sure createTamagui is called before rendering. Also, make sure all of your tamagui dependencies are on the same version (`tamagui`, `@tamagui/package-name`, etc.) not just in your package.json, but in your lockfile." : "Err0"
1118
1118
  );
1119
1119
  return conf;
1120
1120
  }, tokensMerged;
@@ -15242,7 +15242,9 @@ var require_Popper_native = __commonJS({
15242
15242
  React2.forwardRef(
15243
15243
  function(props, forwardedRef) {
15244
15244
  let { virtualRef, __scopePopper, ...anchorProps } = props, { anchorRef, getReferenceProps } = usePopperContext(__scopePopper), ref = React2.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref, anchorRef);
15245
- if (virtualRef)
15245
+ if (React2.useEffect(() => {
15246
+ anchorRef((virtualRef == null ? void 0 : virtualRef.current) || ref.current);
15247
+ }, [anchorRef, virtualRef]), virtualRef)
15246
15248
  return null;
15247
15249
  let stackProps = {
15248
15250
  ref: composedRefs,
@@ -15278,7 +15280,7 @@ var require_Popper_native = __commonJS({
15278
15280
  unstyled: process.env.TAMAGUI_HEADLESS === "1"
15279
15281
  }
15280
15282
  }), PopperContent = React2.forwardRef(function(props, forwardedRef) {
15281
- let { __scopePopper, ...rest } = props, { strategy, placement, refs, x, y, getFloatingProps, size: size2, isMounted, update } = usePopperContext(__scopePopper), contentRefs = (0, import_compose_refs.useComposedRefs)(refs.setFloating, forwardedRef), contents = React2.useMemo(() => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
15283
+ let { __scopePopper, enableAnimationForPositionChange, ...rest } = props, { strategy, placement, refs, x, y, getFloatingProps, size: size2, isMounted, update } = usePopperContext(__scopePopper), contentRefs = (0, import_compose_refs.useComposedRefs)(refs.setFloating, forwardedRef), contents = React2.useMemo(() => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
15282
15284
  PopperContentFrame,
15283
15285
  {
15284
15286
  "data-placement": placement,
@@ -15288,8 +15290,10 @@ var require_Popper_native = __commonJS({
15288
15290
  ...rest
15289
15291
  },
15290
15292
  "popper-content-frame"
15291
- ), [placement, strategy, props]);
15292
- if ((0, import_constants22.useIsomorphicLayoutEffect)(() => {
15293
+ ), [placement, strategy, props]), [hasInitialPosition, setHasInitialPosition] = React2.useState(!0);
15294
+ if (React2.useEffect(() => {
15295
+ (x || y) && setHasInitialPosition(!1);
15296
+ }, [x, y]), (0, import_constants22.useIsomorphicLayoutEffect)(() => {
15293
15297
  isMounted && update();
15294
15298
  }, [isMounted]), !isMounted)
15295
15299
  return null;
@@ -15297,7 +15301,16 @@ var require_Popper_native = __commonJS({
15297
15301
  ref: contentRefs,
15298
15302
  x: x || 0,
15299
15303
  y: y || 0,
15300
- position: strategy
15304
+ position: strategy,
15305
+ ...enableAnimationForPositionChange && {
15306
+ // apply animation but disable it on initial render to avoid animating from 0 to the first position
15307
+ animation: rest.animation,
15308
+ animateOnly: ["none"]
15309
+ },
15310
+ ...enableAnimationForPositionChange && !hasInitialPosition && {
15311
+ animation: rest.animation,
15312
+ animateOnly: rest.animateOnly
15313
+ }
15301
15314
  };
15302
15315
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_stacks3.YStack, { ...getFloatingProps ? getFloatingProps(frameProps) : frameProps, children: contents });
15303
15316
  }), PopperArrowFrame = (0, import_core13.styled)(import_stacks3.YStack, {
@@ -15461,7 +15474,28 @@ var require_Popover_native = __commonJS({
15461
15474
  }
15462
15475
  );
15463
15476
  }), PopoverTrigger = React2.forwardRef(function(props, forwardedRef) {
15464
- let { __scopePopover, ...rest } = props, context = usePopoverContext(__scopePopover), composedTriggerRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.triggerRef), trigger = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
15477
+ let { __scopePopover, ...rest } = props, context = usePopoverContext(__scopePopover), anchorTo = context.anchorTo, composedTriggerRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.triggerRef);
15478
+ if (anchorTo) {
15479
+ let virtualRef = {
15480
+ current: {
15481
+ getBoundingClientRect: () => import_constants4.isWeb ? DOMRect.fromRect(anchorTo) : anchorTo,
15482
+ ...!import_constants4.isWeb && {
15483
+ measure: (c) => c(anchorTo == null ? void 0 : anchorTo.x, anchorTo == null ? void 0 : anchorTo.y, anchorTo == null ? void 0 : anchorTo.width, anchorTo == null ? void 0 : anchorTo.height),
15484
+ measureInWindow: (c) => c(anchorTo == null ? void 0 : anchorTo.x, anchorTo == null ? void 0 : anchorTo.y, anchorTo == null ? void 0 : anchorTo.width, anchorTo == null ? void 0 : anchorTo.height)
15485
+ }
15486
+ }
15487
+ };
15488
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
15489
+ import_popper.PopperAnchor,
15490
+ {
15491
+ virtualRef,
15492
+ __scopePopper: __scopePopover || POPOVER_SCOPE
15493
+ }
15494
+ );
15495
+ }
15496
+ if (!props.children)
15497
+ return null;
15498
+ let trigger = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
15465
15499
  import_core13.View,
15466
15500
  {
15467
15501
  "aria-haspopup": "dialog",
@@ -15643,47 +15677,62 @@ var require_Popover_native = __commonJS({
15643
15677
  }
15644
15678
  );
15645
15679
  }), Popover = (0, import_helpers.withStaticProperties)(
15646
- function(props) {
15647
- let {
15648
- children,
15649
- open: openProp,
15650
- defaultOpen,
15651
- onOpenChange,
15652
- __scopePopover,
15653
- keepChildrenMounted,
15654
- hoverable,
15655
- disableFocus,
15656
- ...restProps
15657
- } = props, id = React2.useId(), { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
15658
- Contents: React2.useCallback(() => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_portal2.PortalHost, { name: `${id}PopoverContents` }), [])
15659
- }), sheetBreakpoint = when, triggerRef = React2.useRef(null), [hasCustomAnchor, setHasCustomAnchor] = React2.useState(!1), [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
15660
- prop: openProp,
15661
- defaultProp: defaultOpen || !1,
15662
- onChange: onOpenChange
15663
- }), sheetActive = useSheetBreakpointActive(sheetBreakpoint), floatingContext = (0, import_useFloatingContext.useFloatingContext)({
15664
- open,
15665
- setOpen,
15666
- disable: sheetActive,
15667
- hoverable,
15668
- disableFocus
15669
- }), popoverContext = {
15670
- id,
15671
- sheetBreakpoint,
15672
- contentId: React2.useId(),
15673
- triggerRef,
15674
- open,
15675
- breakpointActive: sheetActive,
15676
- onOpenChange: setOpen,
15677
- onOpenToggle: (0, import_core13.useEvent)(() => {
15678
- open && sheetActive || setOpen(!open);
15679
- }),
15680
- hasCustomAnchor,
15681
- onCustomAnchorAdd: React2.useCallback(() => setHasCustomAnchor(!0), []),
15682
- onCustomAnchorRemove: React2.useCallback(() => setHasCustomAnchor(!1), []),
15683
- keepChildrenMounted
15684
- }, contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_popper.Popper, { __scopePopper: __scopePopover || POPOVER_SCOPE, stayInFrame: !0, ...restProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverContext.Provider, { scope: __scopePopover, ...popoverContext, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverSheetController, { onOpenChange: setOpen, children }) }) });
15685
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AdaptProvider, { children: import_constants4.isWeb ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_floating.FloatingOverrideContext.Provider, { value: floatingContext, children: contents }) : contents });
15686
- },
15680
+ React2.forwardRef(
15681
+ (props, forwardedRef) => {
15682
+ let {
15683
+ children,
15684
+ open: openProp,
15685
+ defaultOpen,
15686
+ onOpenChange,
15687
+ __scopePopover,
15688
+ keepChildrenMounted,
15689
+ hoverable,
15690
+ disableFocus,
15691
+ ...restProps
15692
+ } = props, id = React2.useId(), { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
15693
+ Contents: React2.useCallback(() => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_portal2.PortalHost, { name: `${id}PopoverContents` }), [])
15694
+ }), sheetBreakpoint = when, triggerRef = React2.useRef(null), [hasCustomAnchor, setHasCustomAnchor] = React2.useState(!1), [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
15695
+ prop: openProp,
15696
+ defaultProp: defaultOpen || !1,
15697
+ onChange: onOpenChange
15698
+ }), sheetActive = useSheetBreakpointActive(sheetBreakpoint), floatingContext = (0, import_useFloatingContext.useFloatingContext)({
15699
+ open,
15700
+ setOpen,
15701
+ disable: sheetActive,
15702
+ hoverable,
15703
+ disableFocus
15704
+ }), [anchorTo, setAnchorTo] = React2.useState();
15705
+ React2.useImperativeHandle(forwardedRef, () => ({
15706
+ anchorTo: setAnchorTo
15707
+ }));
15708
+ let popoverContext = {
15709
+ id,
15710
+ sheetBreakpoint,
15711
+ contentId: React2.useId(),
15712
+ triggerRef,
15713
+ open,
15714
+ breakpointActive: sheetActive,
15715
+ onOpenChange: setOpen,
15716
+ onOpenToggle: (0, import_core13.useEvent)(() => {
15717
+ open && sheetActive || setOpen(!open);
15718
+ }),
15719
+ hasCustomAnchor,
15720
+ anchorTo,
15721
+ onCustomAnchorAdd: React2.useCallback(() => setHasCustomAnchor(!0), []),
15722
+ onCustomAnchorRemove: React2.useCallback(() => setHasCustomAnchor(!1), []),
15723
+ keepChildrenMounted
15724
+ }, contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
15725
+ import_popper.Popper,
15726
+ {
15727
+ __scopePopper: __scopePopover || POPOVER_SCOPE,
15728
+ stayInFrame: !0,
15729
+ ...restProps,
15730
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverContext.Provider, { scope: __scopePopover, ...popoverContext, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverSheetController, { onOpenChange: setOpen, children }) })
15731
+ }
15732
+ );
15733
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AdaptProvider, { children: import_constants4.isWeb ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_floating.FloatingOverrideContext.Provider, { value: floatingContext, children: contents }) : contents });
15734
+ }
15735
+ ),
15687
15736
  {
15688
15737
  Anchor: PopoverAnchor,
15689
15738
  Arrow: PopoverArrow,