tamagui 1.79.5 → 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
  );
@@ -17643,8 +17643,9 @@ var require_Slider_native = __commonJS({
17643
17643
  onSlideStart: disabled ? void 0 : (value2, target, event) => {
17644
17644
  if (target !== "thumb") {
17645
17645
  let closestIndex = (0, import_helpers2.getClosestValueIndex)(values, value2);
17646
- updateValues(value2, closestIndex), onSlideStart == null || onSlideStart(event, value2, target);
17646
+ updateValues(value2, closestIndex);
17647
17647
  }
17648
+ onSlideStart == null || onSlideStart(event, value2, target);
17648
17649
  },
17649
17650
  onSlideMove: disabled ? void 0 : handleSlideMove,
17650
17651
  onHomeKeyDown: () => !disabled && updateValues(min2, 0),
@@ -17878,109 +17879,103 @@ var require_createSwitch_native = __commonJS({
17878
17879
  ref: forwardedRef
17879
17880
  }
17880
17881
  );
17881
- }), SwitchComponent = Frame.extractable(
17882
- React2.forwardRef(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)(
17904
- forwardedRef,
17905
- // @ts-expect-error
17906
- setButton
17907
- ), 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)({
17908
- prop: checkedProp,
17909
- defaultProp: defaultChecked || !1,
17910
- onChange: onCheckedChange,
17911
- transition: !0
17912
- });
17913
- return shouldRenderMobileNative ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17914
- 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,
17915
17926
  {
17916
- value: checkedProp,
17917
- onValueChange: onCheckedChange,
17918
- ...nativeProps
17919
- }
17920
- ) : (import_core13.isWeb || React2.useEffect(() => {
17921
- if (props.id)
17922
- return (0, import_focusable2.registerFocusable)(props.id, {
17923
- focus: () => {
17924
- 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
17925
17960
  }
17926
- });
17927
- }, [props.id, setChecked]), /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
17928
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17929
- Frame,
17930
- {
17931
- tag: "button",
17932
- unstyled,
17933
- size: size2,
17934
- checked,
17935
- disabled,
17936
- frameWidth,
17937
- themeShallow: !0,
17938
- ...!disableActiveTheme && {
17939
- theme: checked ? "active" : null,
17940
- themeShallow: !0
17941
- },
17942
- role: "switch",
17943
- "aria-checked": checked,
17944
- "aria-labelledby": labelledBy,
17945
- "aria-required": required,
17946
- "data-state": getState(checked),
17947
- "data-disabled": disabled ? "" : void 0,
17948
- tabIndex: disabled ? void 0 : 0,
17949
- value,
17950
- ...switchProps,
17951
- ref: composedRefs,
17952
- onPress: (0, import_core13.composeEventHandlers)(props.onPress, (event) => {
17953
- setChecked((prevChecked) => !prevChecked), import_core13.isWeb && isFormControl && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
17954
- }),
17955
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17956
- import_stacks3.YStack,
17957
- {
17958
- alignSelf: "stretch",
17959
- flex: 1,
17960
- onLayout: (e) => {
17961
- setFrameWidth(e.nativeEvent.layout.width);
17962
- },
17963
- children: typeof children == "function" ? children(checked) : children
17964
- }
17965
- )
17966
- }
17967
- ),
17968
- import_core13.isWeb && isFormControl && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17969
- BubbleInput,
17970
- {
17971
- control: button,
17972
- bubbles: !hasConsumerStoppedPropagationRef.current,
17973
- name,
17974
- value,
17975
- checked,
17976
- required,
17977
- disabled,
17978
- style: { transform: "translateX(-100%)" }
17979
- }
17980
- )
17981
- ] }));
17982
- })
17983
- ), 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) => {
17984
17979
  let { control, checked, bubbles = !0, ...inputProps } = props, ref = React2.useRef(null), prevChecked = (0, import_use_previous.usePrevious)(checked);
17985
17980
  return React2.useEffect(() => {
17986
17981
  let input = ref.current, inputProto = window.HTMLInputElement.prototype, setChecked = Object.getOwnPropertyDescriptor(