tamagui 1.79.6 → 1.79.7

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
@@ -1261,7 +1261,7 @@ var require_useMedia_native = __commonJS({
1261
1261
  return listeners.add(subscriber), () => listeners.delete(subscriber);
1262
1262
  }
1263
1263
  function useMedia3(uid, componentContext) {
1264
- let internal = (0, import_react2.useRef)(), initialState = ((componentContext ? (0, import_useDisableSSR.getDisableSSR)(componentContext) : (0, import_useDisableSSR.useDisableSSR)()) ? mediaState3 : initState) || {}, state = (0, import_react2.useSyncExternalStore)(
1264
+ let internal = (0, import_react2.useRef)(), initialState = ((componentContext ? (0, import_useDisableSSR.getDisableSSR)(componentContext) : (0, import_useDisableSSR.useDisableSSR)()) || !import_constants.isWeb ? mediaState3 : initState) || {}, state = (0, import_react2.useSyncExternalStore)(
1265
1265
  subscribe,
1266
1266
  () => {
1267
1267
  if (!internal.current)
@@ -3761,7 +3761,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3761
3761
  if (forceShouldChange || next && !(forceUpdate !== !0 && !manager.getStateShouldChange(next, prevState)))
3762
3762
  return next;
3763
3763
  }
3764
- if (import_constants.isServer || ((0, import_react2.useLayoutEffect)(() => {
3764
+ if (import_constants.isServer || ((0, import_react2.useEffect)(() => {
3765
3765
  if (!themeManager)
3766
3766
  return;
3767
3767
  if (props.inverse && !mounted) {
@@ -3777,7 +3777,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3777
3777
  }), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(
3778
3778
  (name, manager, forced) => {
3779
3779
  let force = forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"], shouldTryUpdate = force ?? !!(keys != null && keys.length || isNewTheme);
3780
- process.env.NODE_ENV === "development" && props.debug === "verbose" && console.info(" \u{1F538} onChange", themeManager.id, { force, shouldTryUpdate, props, name, manager, keys }), shouldTryUpdate && setThemeState(createState);
3780
+ process.env.NODE_ENV === "development" && props.debug === "verbose" && console.info(" \u{1F538} onChange", themeManager.id, { force, shouldTryUpdate, props, name, manager, keys }), shouldTryUpdate && setThemeState((prev) => createState(prev, force));
3781
3781
  },
3782
3782
  themeManager.id
3783
3783
  );
@@ -17879,109 +17879,103 @@ var require_createSwitch_native = __commonJS({
17879
17879
  ref: forwardedRef
17880
17880
  }
17881
17881
  );
17882
- }), SwitchComponent = Frame.extractable(
17883
- React2.forwardRef(function(propsIn, forwardedRef) {
17884
- let styledContext = React2.useContext(import_SwitchContext.SwitchContext), props = (0, import_core13.useProps)(propsIn, {
17885
- noNormalize: !0,
17886
- noExpand: !0,
17887
- resolveValues: "none",
17888
- forComponent: Frame
17889
- }), {
17890
- labeledBy: ariaLabelledby,
17891
- name,
17892
- checked: checkedProp,
17893
- defaultChecked,
17894
- required,
17895
- disabled,
17896
- value = "on",
17897
- onCheckedChange,
17898
- size: size2 = styledContext.size ?? "$true",
17899
- unstyled = styledContext.unstyled ?? !1,
17900
- native: nativeProp,
17901
- nativeProps,
17902
- children,
17903
- ...switchProps
17904
- } = props, native = Array.isArray(nativeProp) ? nativeProp : [nativeProp], shouldRenderMobileNative = !import_core13.isWeb && nativeProp === !0 || !import_core13.isWeb && native.includes("mobile") || native.includes("android") && import_react_native4.Platform.OS === "android" || native.includes("ios") && import_react_native4.Platform.OS === "ios", [button, setButton] = React2.useState(null), composedRefs = (0, import_compose_refs.useComposedRefs)(
17905
- forwardedRef,
17906
- // @ts-expect-error
17907
- setButton
17908
- ), labelId = (0, import_label.useLabelContext)(button), labelledBy = ariaLabelledby || labelId, hasConsumerStoppedPropagationRef = React2.useRef(!1), isFormControl = import_core13.isWeb ? button ? !!button.closest("form") : !0 : !1, [frameWidth, setFrameWidth] = React2.useState(0), [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
17909
- prop: checkedProp,
17910
- defaultProp: defaultChecked || !1,
17911
- onChange: onCheckedChange,
17912
- transition: !0
17913
- });
17914
- return shouldRenderMobileNative ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17915
- import_react_native4.Switch,
17882
+ }), SwitchComponent = Frame.styleable(function(propsIn, forwardedRef) {
17883
+ let styledContext = React2.useContext(import_SwitchContext.SwitchContext), props = (0, import_core13.useProps)(propsIn, {
17884
+ noNormalize: !0,
17885
+ noExpand: !0,
17886
+ resolveValues: "none",
17887
+ forComponent: Frame
17888
+ }), {
17889
+ labeledBy: ariaLabelledby,
17890
+ name,
17891
+ checked: checkedProp,
17892
+ defaultChecked,
17893
+ required,
17894
+ disabled,
17895
+ value = "on",
17896
+ onCheckedChange,
17897
+ size: size2 = styledContext.size ?? "$true",
17898
+ unstyled = styledContext.unstyled ?? !1,
17899
+ native: nativeProp,
17900
+ nativeProps,
17901
+ children,
17902
+ ...switchProps
17903
+ } = props, native = Array.isArray(nativeProp) ? nativeProp : [nativeProp], shouldRenderMobileNative = !import_core13.isWeb && nativeProp === !0 || !import_core13.isWeb && native.includes("mobile") || native.includes("android") && import_react_native4.Platform.OS === "android" || native.includes("ios") && import_react_native4.Platform.OS === "ios", [button, setButton] = React2.useState(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, setButton), labelId = (0, import_label.useLabelContext)(button), labelledBy = ariaLabelledby || labelId, hasConsumerStoppedPropagationRef = React2.useRef(!1), isFormControl = import_core13.isWeb ? button ? !!button.closest("form") : !0 : !1, [frameWidth, setFrameWidth] = React2.useState(0), [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
17904
+ prop: checkedProp,
17905
+ defaultProp: defaultChecked || !1,
17906
+ onChange: onCheckedChange,
17907
+ transition: !0
17908
+ });
17909
+ return shouldRenderMobileNative ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17910
+ import_react_native4.Switch,
17911
+ {
17912
+ value: checkedProp,
17913
+ onValueChange: onCheckedChange,
17914
+ ...nativeProps
17915
+ }
17916
+ ) : (import_core13.isWeb || React2.useEffect(() => {
17917
+ if (props.id)
17918
+ return (0, import_focusable2.registerFocusable)(props.id, {
17919
+ focus: () => {
17920
+ setChecked((x) => !x);
17921
+ }
17922
+ });
17923
+ }, [props.id, setChecked]), /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
17924
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17925
+ Frame,
17916
17926
  {
17917
- value: checkedProp,
17918
- onValueChange: onCheckedChange,
17919
- ...nativeProps
17920
- }
17921
- ) : (import_core13.isWeb || React2.useEffect(() => {
17922
- if (props.id)
17923
- return (0, import_focusable2.registerFocusable)(props.id, {
17924
- focus: () => {
17925
- setChecked((x) => !x);
17927
+ tag: "button",
17928
+ unstyled,
17929
+ size: size2,
17930
+ checked,
17931
+ disabled,
17932
+ frameWidth,
17933
+ themeShallow: !0,
17934
+ ...!disableActiveTheme && {
17935
+ theme: checked ? "active" : null,
17936
+ themeShallow: !0
17937
+ },
17938
+ role: "switch",
17939
+ "aria-checked": checked,
17940
+ "aria-labelledby": labelledBy,
17941
+ "aria-required": required,
17942
+ "data-state": getState(checked),
17943
+ "data-disabled": disabled ? "" : void 0,
17944
+ tabIndex: disabled ? void 0 : 0,
17945
+ value,
17946
+ ...switchProps,
17947
+ ref: composedRefs,
17948
+ onPress: (0, import_core13.composeEventHandlers)(props.onPress, (event) => {
17949
+ setChecked((prevChecked) => !prevChecked), import_core13.isWeb && isFormControl && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
17950
+ }),
17951
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17952
+ import_stacks3.YStack,
17953
+ {
17954
+ alignSelf: "stretch",
17955
+ flex: 1,
17956
+ onLayout: (e) => {
17957
+ setFrameWidth(e.nativeEvent.layout.width);
17958
+ },
17959
+ children: typeof children == "function" ? children(checked) : children
17926
17960
  }
17927
- });
17928
- }, [props.id, setChecked]), /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
17929
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17930
- Frame,
17931
- {
17932
- tag: "button",
17933
- unstyled,
17934
- size: size2,
17935
- checked,
17936
- disabled,
17937
- frameWidth,
17938
- themeShallow: !0,
17939
- ...!disableActiveTheme && {
17940
- theme: checked ? "active" : null,
17941
- themeShallow: !0
17942
- },
17943
- role: "switch",
17944
- "aria-checked": checked,
17945
- "aria-labelledby": labelledBy,
17946
- "aria-required": required,
17947
- "data-state": getState(checked),
17948
- "data-disabled": disabled ? "" : void 0,
17949
- tabIndex: disabled ? void 0 : 0,
17950
- value,
17951
- ...switchProps,
17952
- ref: composedRefs,
17953
- onPress: (0, import_core13.composeEventHandlers)(props.onPress, (event) => {
17954
- setChecked((prevChecked) => !prevChecked), import_core13.isWeb && isFormControl && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
17955
- }),
17956
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17957
- import_stacks3.YStack,
17958
- {
17959
- alignSelf: "stretch",
17960
- flex: 1,
17961
- onLayout: (e) => {
17962
- setFrameWidth(e.nativeEvent.layout.width);
17963
- },
17964
- children: typeof children == "function" ? children(checked) : children
17965
- }
17966
- )
17967
- }
17968
- ),
17969
- import_core13.isWeb && isFormControl && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17970
- BubbleInput,
17971
- {
17972
- control: button,
17973
- bubbles: !hasConsumerStoppedPropagationRef.current,
17974
- name,
17975
- value,
17976
- checked,
17977
- required,
17978
- disabled,
17979
- style: { transform: "translateX(-100%)" }
17980
- }
17981
- )
17982
- ] }));
17983
- })
17984
- ), BubbleInput = (props) => {
17961
+ )
17962
+ }
17963
+ ),
17964
+ import_core13.isWeb && isFormControl && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17965
+ BubbleInput,
17966
+ {
17967
+ control: button,
17968
+ bubbles: !hasConsumerStoppedPropagationRef.current,
17969
+ name,
17970
+ value,
17971
+ checked,
17972
+ required,
17973
+ disabled,
17974
+ style: { transform: "translateX(-100%)" }
17975
+ }
17976
+ )
17977
+ ] }));
17978
+ }), BubbleInput = (props) => {
17985
17979
  let { control, checked, bubbles = !0, ...inputProps } = props, ref = React2.useRef(null), prevChecked = (0, import_use_previous.usePrevious)(checked);
17986
17980
  return React2.useEffect(() => {
17987
17981
  let input = ref.current, inputProto = window.HTMLInputElement.prototype, setChecked = Object.getOwnPropertyDescriptor(