tamagui 1.82.4 → 1.82.6

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.
@@ -1112,7 +1112,7 @@ var require_config_native = __commonJS({
1112
1112
  }, getConfig3 = () => {
1113
1113
  if (!conf)
1114
1114
  throw new Error(
1115
- "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.)"
1115
+ "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."
1116
1116
  );
1117
1117
  return conf;
1118
1118
  }, tokensMerged;
@@ -14709,7 +14709,9 @@ var require_Popper_native = __commonJS({
14709
14709
  React2.forwardRef(
14710
14710
  function(props, forwardedRef) {
14711
14711
  let { virtualRef, __scopePopper, ...anchorProps } = props, { anchorRef, getReferenceProps } = usePopperContext(__scopePopper), ref = React2.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref, anchorRef);
14712
- if (virtualRef)
14712
+ if (React2.useEffect(() => {
14713
+ anchorRef((virtualRef == null ? void 0 : virtualRef.current) || ref.current);
14714
+ }, [anchorRef, virtualRef]), virtualRef)
14713
14715
  return null;
14714
14716
  let stackProps = {
14715
14717
  ref: composedRefs,
@@ -14745,7 +14747,7 @@ var require_Popper_native = __commonJS({
14745
14747
  unstyled: process.env.TAMAGUI_HEADLESS === "1"
14746
14748
  }
14747
14749
  }), PopperContent = React2.forwardRef(function(props, forwardedRef) {
14748
- 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)(
14750
+ 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)(
14749
14751
  PopperContentFrame,
14750
14752
  {
14751
14753
  "data-placement": placement,
@@ -14755,8 +14757,10 @@ var require_Popper_native = __commonJS({
14755
14757
  ...rest
14756
14758
  },
14757
14759
  "popper-content-frame"
14758
- ), [placement, strategy, props]);
14759
- if ((0, import_constants22.useIsomorphicLayoutEffect)(() => {
14760
+ ), [placement, strategy, props]), [hasInitialPosition, setHasInitialPosition] = React2.useState(!0);
14761
+ if (React2.useEffect(() => {
14762
+ (x || y) && setHasInitialPosition(!1);
14763
+ }, [x, y]), (0, import_constants22.useIsomorphicLayoutEffect)(() => {
14760
14764
  isMounted && update();
14761
14765
  }, [isMounted]), !isMounted)
14762
14766
  return null;
@@ -14764,7 +14768,16 @@ var require_Popper_native = __commonJS({
14764
14768
  ref: contentRefs,
14765
14769
  x: x || 0,
14766
14770
  y: y || 0,
14767
- position: strategy
14771
+ position: strategy,
14772
+ ...enableAnimationForPositionChange && {
14773
+ // apply animation but disable it on initial render to avoid animating from 0 to the first position
14774
+ animation: rest.animation,
14775
+ animateOnly: ["none"]
14776
+ },
14777
+ ...enableAnimationForPositionChange && !hasInitialPosition && {
14778
+ animation: rest.animation,
14779
+ animateOnly: rest.animateOnly
14780
+ }
14768
14781
  };
14769
14782
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_stacks3.YStack, { ...getFloatingProps ? getFloatingProps(frameProps) : frameProps, children: contents });
14770
14783
  }), PopperArrowFrame = (0, import_core13.styled)(import_stacks3.YStack, {
@@ -14928,7 +14941,28 @@ var require_Popover_native = __commonJS({
14928
14941
  }
14929
14942
  );
14930
14943
  }), PopoverTrigger = React2.forwardRef(function(props, forwardedRef) {
14931
- let { __scopePopover, ...rest } = props, context = usePopoverContext(__scopePopover), composedTriggerRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.triggerRef), trigger = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
14944
+ let { __scopePopover, ...rest } = props, context = usePopoverContext(__scopePopover), anchorTo = context.anchorTo, composedTriggerRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.triggerRef);
14945
+ if (anchorTo) {
14946
+ let virtualRef = {
14947
+ current: {
14948
+ getBoundingClientRect: () => import_constants4.isWeb ? DOMRect.fromRect(anchorTo) : anchorTo,
14949
+ ...!import_constants4.isWeb && {
14950
+ 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),
14951
+ 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)
14952
+ }
14953
+ }
14954
+ };
14955
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
14956
+ import_popper.PopperAnchor,
14957
+ {
14958
+ virtualRef,
14959
+ __scopePopper: __scopePopover || POPOVER_SCOPE
14960
+ }
14961
+ );
14962
+ }
14963
+ if (!props.children)
14964
+ return null;
14965
+ let trigger = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
14932
14966
  import_core13.View,
14933
14967
  {
14934
14968
  "aria-haspopup": "dialog",
@@ -15110,47 +15144,62 @@ var require_Popover_native = __commonJS({
15110
15144
  }
15111
15145
  );
15112
15146
  }), Popover = (0, import_helpers.withStaticProperties)(
15113
- function(props) {
15114
- let {
15115
- children,
15116
- open: openProp,
15117
- defaultOpen,
15118
- onOpenChange,
15119
- __scopePopover,
15120
- keepChildrenMounted,
15121
- hoverable,
15122
- disableFocus,
15123
- ...restProps
15124
- } = props, id = React2.useId(), { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
15125
- Contents: React2.useCallback(() => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_portal2.PortalHost, { name: `${id}PopoverContents` }), [])
15126
- }), sheetBreakpoint = when, triggerRef = React2.useRef(null), [hasCustomAnchor, setHasCustomAnchor] = React2.useState(!1), [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
15127
- prop: openProp,
15128
- defaultProp: defaultOpen || !1,
15129
- onChange: onOpenChange
15130
- }), sheetActive = useSheetBreakpointActive(sheetBreakpoint), floatingContext = (0, import_useFloatingContext.useFloatingContext)({
15131
- open,
15132
- setOpen,
15133
- disable: sheetActive,
15134
- hoverable,
15135
- disableFocus
15136
- }), popoverContext = {
15137
- id,
15138
- sheetBreakpoint,
15139
- contentId: React2.useId(),
15140
- triggerRef,
15141
- open,
15142
- breakpointActive: sheetActive,
15143
- onOpenChange: setOpen,
15144
- onOpenToggle: (0, import_core13.useEvent)(() => {
15145
- open && sheetActive || setOpen(!open);
15146
- }),
15147
- hasCustomAnchor,
15148
- onCustomAnchorAdd: React2.useCallback(() => setHasCustomAnchor(!0), []),
15149
- onCustomAnchorRemove: React2.useCallback(() => setHasCustomAnchor(!1), []),
15150
- keepChildrenMounted
15151
- }, 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 }) }) });
15152
- 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 });
15153
- },
15147
+ React2.forwardRef(
15148
+ (props, forwardedRef) => {
15149
+ let {
15150
+ children,
15151
+ open: openProp,
15152
+ defaultOpen,
15153
+ onOpenChange,
15154
+ __scopePopover,
15155
+ keepChildrenMounted,
15156
+ hoverable,
15157
+ disableFocus,
15158
+ ...restProps
15159
+ } = props, id = React2.useId(), { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
15160
+ Contents: React2.useCallback(() => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_portal2.PortalHost, { name: `${id}PopoverContents` }), [])
15161
+ }), sheetBreakpoint = when, triggerRef = React2.useRef(null), [hasCustomAnchor, setHasCustomAnchor] = React2.useState(!1), [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
15162
+ prop: openProp,
15163
+ defaultProp: defaultOpen || !1,
15164
+ onChange: onOpenChange
15165
+ }), sheetActive = useSheetBreakpointActive(sheetBreakpoint), floatingContext = (0, import_useFloatingContext.useFloatingContext)({
15166
+ open,
15167
+ setOpen,
15168
+ disable: sheetActive,
15169
+ hoverable,
15170
+ disableFocus
15171
+ }), [anchorTo, setAnchorTo] = React2.useState();
15172
+ React2.useImperativeHandle(forwardedRef, () => ({
15173
+ anchorTo: setAnchorTo
15174
+ }));
15175
+ let popoverContext = {
15176
+ id,
15177
+ sheetBreakpoint,
15178
+ contentId: React2.useId(),
15179
+ triggerRef,
15180
+ open,
15181
+ breakpointActive: sheetActive,
15182
+ onOpenChange: setOpen,
15183
+ onOpenToggle: (0, import_core13.useEvent)(() => {
15184
+ open && sheetActive || setOpen(!open);
15185
+ }),
15186
+ hasCustomAnchor,
15187
+ anchorTo,
15188
+ onCustomAnchorAdd: React2.useCallback(() => setHasCustomAnchor(!0), []),
15189
+ onCustomAnchorRemove: React2.useCallback(() => setHasCustomAnchor(!1), []),
15190
+ keepChildrenMounted
15191
+ }, contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
15192
+ import_popper.Popper,
15193
+ {
15194
+ __scopePopper: __scopePopover || POPOVER_SCOPE,
15195
+ stayInFrame: !0,
15196
+ ...restProps,
15197
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverContext.Provider, { scope: __scopePopover, ...popoverContext, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverSheetController, { onOpenChange: setOpen, children }) })
15198
+ }
15199
+ );
15200
+ 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 });
15201
+ }
15202
+ ),
15154
15203
  {
15155
15204
  Anchor: PopoverAnchor,
15156
15205
  Arrow: PopoverArrow,