tamagui 1.123.15 → 1.123.17

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.
@@ -4439,6 +4439,57 @@ var require_defaultComponentState_native = __commonJS({
4439
4439
  }
4440
4440
  });
4441
4441
 
4442
+ // ../../core/web/dist/cjs/helpers/getShorthandValue.native.js
4443
+ var require_getShorthandValue_native = __commonJS({
4444
+ "../../core/web/dist/cjs/helpers/getShorthandValue.native.js"(exports2, module2) {
4445
+ "use strict";
4446
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = function(target, all) {
4447
+ for (var name in all) __defProp2(target, name, {
4448
+ get: all[name],
4449
+ enumerable: !0
4450
+ });
4451
+ }, __copyProps2 = function(to, from, except, desc) {
4452
+ var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
4453
+ if (from && typeof from == "object" || typeof from == "function") try {
4454
+ for (var _loop = function() {
4455
+ var key = _step.value;
4456
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, {
4457
+ get: function() {
4458
+ return from[key];
4459
+ },
4460
+ enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable
4461
+ });
4462
+ }, _iterator = __getOwnPropNames2(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) _loop();
4463
+ } catch (err) {
4464
+ _didIteratorError = !0, _iteratorError = err;
4465
+ } finally {
4466
+ try {
4467
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
4468
+ } finally {
4469
+ if (_didIteratorError)
4470
+ throw _iteratorError;
4471
+ }
4472
+ }
4473
+ return to;
4474
+ }, __toCommonJS2 = function(mod) {
4475
+ return __copyProps2(__defProp2({}, "__esModule", {
4476
+ value: !0
4477
+ }), mod);
4478
+ }, getShorthandValue_exports = {};
4479
+ __export2(getShorthandValue_exports, {
4480
+ getShorthandValue: function() {
4481
+ return getShorthandValue;
4482
+ }
4483
+ });
4484
+ module2.exports = __toCommonJS2(getShorthandValue_exports);
4485
+ var import_config = require_config_native(), inverseShorthands = null, getShorthandValue = function(props, key) {
4486
+ inverseShorthands || (inverseShorthands = (0, import_config.getConfig)().inverseShorthands);
4487
+ var _props_key;
4488
+ return (_props_key = props[key]) !== null && _props_key !== void 0 ? _props_key : inverseShorthands ? props[inverseShorthands[key]] : void 0;
4489
+ };
4490
+ }
4491
+ });
4492
+
4442
4493
  // ../../core/web/dist/cjs/constants/accessibilityDirectMap.native.js
4443
4494
  var require_accessibilityDirectMap_native = __commonJS({
4444
4495
  "../../core/web/dist/cjs/constants/accessibilityDirectMap.native.js"(exports2, module2) {
@@ -8171,7 +8222,7 @@ var require_createComponent_native = __commonJS({
8171
8222
  }
8172
8223
  });
8173
8224
  module2.exports = __toCommonJS2(createComponent_exports);
8174
- var import_jsx_runtime6 = require("react/jsx-runtime"), import_compose_refs = require_index_native12(), import_constants4 = require_index_native6(), import_helpers = require_index_native7(), import_react3 = __toESM2(require("react")), import_config = require_config_native(), import_constants22 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_ComponentContext = require_ComponentContext_native(), import_createVariable = require_createVariable_native(), import_defaultComponentState = require_defaultComponentState_native(), import_getSplitStyles = require_getSplitStyles_native(), import_log = require_log_native(), import_mergeProps = require_mergeProps_native(), import_setElementProps = require_setElementProps_native(), import_subscribeToContextGroup = require_subscribeToContextGroup_native(), import_themeable = require_themeable_native(), import_wrapStyleTags = require_wrapStyleTags_native(), import_useComponentState = require_useComponentState_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native(), import_setupHooks = require_setupHooks_native(), import_Slot = require_Slot_native(), import_Theme = require_Theme_native(), import_ThemeDebug = require_ThemeDebug_native(), componentSetStates = /* @__PURE__ */ new Set();
8225
+ var import_jsx_runtime6 = require("react/jsx-runtime"), import_compose_refs = require_index_native12(), import_constants4 = require_index_native6(), import_helpers = require_index_native7(), import_react3 = __toESM2(require("react")), import_config = require_config_native(), import_constants22 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_ComponentContext = require_ComponentContext_native(), import_createVariable = require_createVariable_native(), import_defaultComponentState = require_defaultComponentState_native(), import_getShorthandValue = require_getShorthandValue_native(), import_getSplitStyles = require_getSplitStyles_native(), import_log = require_log_native(), import_mergeProps = require_mergeProps_native(), import_setElementProps = require_setElementProps_native(), import_subscribeToContextGroup = require_subscribeToContextGroup_native(), import_themeable = require_themeable_native(), import_wrapStyleTags = require_wrapStyleTags_native(), import_useComponentState = require_useComponentState_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native(), import_setupHooks = require_setupHooks_native(), import_Slot = require_Slot_native(), import_Theme = require_Theme_native(), import_ThemeDebug = require_ThemeDebug_native(), componentSetStates = /* @__PURE__ */ new Set();
8175
8226
  typeof document < "u" && (cancelTouches = function() {
8176
8227
  componentSetStates.forEach(function(setState) {
8177
8228
  return setState(function(prev) {
@@ -8217,10 +8268,9 @@ var require_createComponent_native = __commonJS({
8217
8268
  (_ = (_propsIn_datatestrenders = propsIn["data-test-renders"])[_current = "current"]) !== null && _ !== void 0 || (_propsIn_datatestrenders[_current] = 0), propsIn["data-test-renders"].current += 1;
8218
8269
  }
8219
8270
  var componentContext = import_react3.default.useContext(import_ComponentContext.ComponentContext), styledContextProps, overriddenContextProps, contextValue, { context, isReactNative } = staticConfig;
8220
- if (context && (contextValue = import_react3.default.useContext(context), contextValue)) {
8221
- var shorthands = config == null ? void 0 : config.shorthands;
8271
+ if (context && (contextValue = import_react3.default.useContext(context), contextValue))
8222
8272
  for (var key in context.props) {
8223
- var propVal = propsIn[key] || propsIn[shorthands == null ? void 0 : shorthands[propsIn]];
8273
+ var propVal = (0, import_getShorthandValue.getShorthandValue)(propsIn, key);
8224
8274
  if (propVal === void 0) {
8225
8275
  var val = contextValue == null ? void 0 : contextValue[key];
8226
8276
  val !== void 0 && (styledContextProps || (styledContextProps = {}), styledContextProps[key] = val);
@@ -8228,7 +8278,6 @@ var require_createComponent_native = __commonJS({
8228
8278
  var finalVal = propVal ?? (defaultProps == null ? void 0 : defaultProps[key]);
8229
8279
  finalVal !== void 0 && (overriddenContextProps || (overriddenContextProps = {}), overriddenContextProps[key] = finalVal);
8230
8280
  }
8231
- }
8232
8281
  var curDefaultProps = styledContextProps ? {
8233
8282
  ...defaultProps,
8234
8283
  ...styledContextProps
@@ -10456,9 +10505,12 @@ var require_useProps_native = __commonJS({
10456
10505
  componentName: staticConfig.componentName,
10457
10506
  name: "theme" in props ? props.theme : void 0,
10458
10507
  inverse: "themeInverse" in props ? props.themeInverse : void 0
10459
- }), componentContext = import_react3.default.useContext(import_ComponentContext.ComponentContext), { state, disabled, setStateShallow } = (0, import_useComponentState.useComponentState)(props, componentContext, staticConfig, (0, import_config.getConfig)()), mediaState3 = (0, import_useMedia.useMedia)(), splitStyles = (0, import_getSplitStyles.useSplitStyles)(props, staticConfig, theme, ((_themeState_state = themeState.state) === null || _themeState_state === void 0 ? void 0 : _themeState_state.name) || "", state, {
10508
+ }), componentContext = import_react3.default.useContext(import_ComponentContext.ComponentContext), { state, disabled, setStateShallow } = (0, import_useComponentState.useComponentState)(props, componentContext, staticConfig, (0, import_config.getConfig)()), mediaStateNow = opts != null && opts.noMedia ? (
10509
+ // not safe to use mediaState but really marginal to hit this
10510
+ import_useMedia.mediaState
10511
+ ) : (0, import_useMedia.useMedia)(), splitStyles = (0, import_getSplitStyles.useSplitStyles)(props, staticConfig, theme, ((_themeState_state = themeState.state) === null || _themeState_state === void 0 ? void 0 : _themeState_state.name) || "", state, {
10460
10512
  isAnimated: !1,
10461
- mediaState: mediaState3,
10513
+ mediaState: mediaStateNow,
10462
10514
  noSkip: !0,
10463
10515
  noMergeStyle: !0,
10464
10516
  noClass: !0,
@@ -10494,7 +10546,7 @@ var require_useProps_native = __commonJS({
10494
10546
  splitStyles.viewProps,
10495
10547
  splitStyles.style || {},
10496
10548
  theme,
10497
- mediaState3
10549
+ import_useMedia.mediaState
10498
10550
  ];
10499
10551
  }
10500
10552
  }
@@ -11061,6 +11113,7 @@ var require_index_native14 = __commonJS({
11061
11113
  __reExport2(index_exports2, require_ComponentContext_native(), module2.exports);
11062
11114
  __reExport2(index_exports2, require_withStableStyle_native(), module2.exports);
11063
11115
  __reExport2(index_exports2, require_createMediaStyle_native(), module2.exports);
11116
+ __reExport2(index_exports2, require_getShorthandValue_native(), module2.exports);
11064
11117
  __reExport2(index_exports2, require_createShallowSetState_native(), module2.exports);
11065
11118
  __reExport2(index_exports2, require_createStyledContext_native(), module2.exports);
11066
11119
  __reExport2(index_exports2, require_expandStyles_native(), module2.exports);
@@ -28944,7 +28997,7 @@ var require_createSwitch_native = __commonJS({
28944
28997
  var { disableActiveTheme, Frame = import_Switch.SwitchFrame, Thumb = import_Switch.SwitchThumb } = createProps;
28945
28998
  Frame.staticConfig.context = import_StyledContext.SwitchStyledContext, Thumb.staticConfig.context = import_StyledContext.SwitchStyledContext;
28946
28999
  var SwitchThumbComponent = Thumb.styleable(function(props, forwardedRef) {
28947
- var { size: sizeProp, unstyled: unstyledProp, nativeID, ...thumbProps } = props, context = React4.useContext(SwitchContext), { checked, disabled, frameWidth } = context, styledContext = import_StyledContext.SwitchStyledContext.useStyledContext(), { unstyled: unstyledContext, size: sizeContext } = styledContext, _ref, unstyled = process.env.TAMAGUI_HEADLESS === "1" ? !0 : (_ref = unstyledProp ?? unstyledContext) !== null && _ref !== void 0 ? _ref : !1, _ref1, size4 = (_ref1 = sizeProp ?? sizeContext) !== null && _ref1 !== void 0 ? _ref1 : "$true", initialChecked = React4.useRef(checked).current, [thumbWidth, setThumbWidth] = React4.useState(0), distance = frameWidth - thumbWidth, x = initialChecked ? checked ? 0 : -distance : checked ? distance : 0;
29000
+ var { size: sizeProp, unstyled: unstyledProp, nativeID, ...thumbProps } = props, context = React4.useContext(SwitchContext), { checked, disabled, frameWidth } = context, styledContext = import_StyledContext.SwitchStyledContext.useStyledContext(), { unstyled: unstyledContext, size: sizeContext } = styledContext, _ref, unstyled = process.env.TAMAGUI_HEADLESS === "1" ? !0 : (_ref = unstyledProp ?? unstyledContext) !== null && _ref !== void 0 ? _ref : !1, _ref1, size4 = (_ref1 = sizeProp ?? sizeContext) !== null && _ref1 !== void 0 ? _ref1 : "$true", initialChecked = React4.useRef(checked).current, initialWidth = (0, import_core12.getVariableValue)(props.width, "size"), [thumbWidth, setThumbWidth] = React4.useState(typeof initialWidth == "number" ? initialWidth : 0), distance = frameWidth - thumbWidth, x = initialChecked ? checked ? 0 : -distance : checked ? distance : 0;
28948
29001
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Thumb, {
28949
29002
  ref: forwardedRef,
28950
29003
  unstyled,
@@ -28957,7 +29010,8 @@ var require_createSwitch_native = __commonJS({
28957
29010
  alignSelf: initialChecked ? "flex-end" : "flex-start",
28958
29011
  x,
28959
29012
  onLayout: (0, import_core12.composeEventHandlers)(props.onLayout, function(e) {
28960
- return setThumbWidth(e.nativeEvent.layout.width);
29013
+ var next = e.nativeEvent.layout.width;
29014
+ next !== thumbWidth && setThumbWidth(next);
28961
29015
  }),
28962
29016
  // expected variants
28963
29017
  checked,
@@ -28970,7 +29024,12 @@ var require_createSwitch_native = __commonJS({
28970
29024
  defaultProp: defaultChecked || !1,
28971
29025
  onChange: onCheckedChange,
28972
29026
  transition: !0
28973
- }), styledContext = React4.useContext(import_StyledContext.SwitchStyledContext.context), [frameWidth, setFrameWidth] = React4.useState(0), { switchProps, bubbleInput, switchRef } = (0, import_switch_headless.useSwitch)(
29027
+ }), styledContext = React4.useContext(import_StyledContext.SwitchStyledContext.context), estimatedInitialWidth = 0, estWidth = (0, import_core12.getVariableValue)((0, import_core12.getShorthandValue)(props, "width"), "size");
29028
+ if (estWidth) {
29029
+ var _getShorthandValue, _ref, estPad = (_ref = (_getShorthandValue = (0, import_core12.getShorthandValue)(props, "paddingHorizontal")) !== null && _getShorthandValue !== void 0 ? _getShorthandValue : (0, import_core12.getShorthandValue)(props, "padding")) !== null && _ref !== void 0 ? _ref : 0, _getShorthandValue1, _ref1, estLeftPad = (_ref1 = (_getShorthandValue1 = (0, import_core12.getShorthandValue)(props, "paddingLeft")) !== null && _getShorthandValue1 !== void 0 ? _getShorthandValue1 : estPad) !== null && _ref1 !== void 0 ? _ref1 : 0, _getShorthandValue2, _ref2, estRightPad = (_ref2 = (_getShorthandValue2 = (0, import_core12.getShorthandValue)(props, "paddingRight")) !== null && _getShorthandValue2 !== void 0 ? _getShorthandValue2 : estPad) !== null && _ref2 !== void 0 ? _ref2 : 0;
29030
+ estimatedInitialWidth = estWidth - (estLeftPad ? (0, import_core12.getVariableValue)(estLeftPad, "size") : 0) - (estRightPad ? (0, import_core12.getVariableValue)(estRightPad, "size") : 0);
29031
+ }
29032
+ var [frameWidth, setFrameInnerWidth] = React4.useState(estimatedInitialWidth), { switchProps, bubbleInput, switchRef } = (0, import_switch_headless.useSwitch)(
28974
29033
  // @ts-ignore
28975
29034
  props,
28976
29035
  [
@@ -29009,11 +29068,10 @@ var require_createSwitch_native = __commonJS({
29009
29068
  checked,
29010
29069
  disabled,
29011
29070
  frameWidth
29012
- ]), handleLayout = React4.useCallback(function(e) {
29013
- setFrameWidth(e.nativeEvent.layout.width);
29014
- }, [
29015
- setFrameWidth
29016
- ]), _styledContext_unstyled, _ref, unstyled = (_ref = (_styledContext_unstyled = styledContext.unstyled) !== null && _styledContext_unstyled !== void 0 ? _styledContext_unstyled : props.unstyled) !== null && _ref !== void 0 ? _ref : !1, _styledContext_size, _ref1;
29071
+ ]), handleLayout = function(e) {
29072
+ var next = e.nativeEvent.layout.width;
29073
+ next !== frameWidth && setFrameInnerWidth(next);
29074
+ }, _styledContext_unstyled, _ref3, unstyled = (_ref3 = (_styledContext_unstyled = styledContext.unstyled) !== null && _styledContext_unstyled !== void 0 ? _styledContext_unstyled : props.unstyled) !== null && _ref3 !== void 0 ? _ref3 : !1, _styledContext_size, _ref4;
29017
29075
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(SwitchContext.Provider, {
29018
29076
  value,
29019
29077
  children: [
@@ -29024,7 +29082,7 @@ var require_createSwitch_native = __commonJS({
29024
29082
  type: "button"
29025
29083
  },
29026
29084
  ...!unstyled && {
29027
- size: (_ref1 = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref1 !== void 0 ? _ref1 : "$true"
29085
+ size: (_ref4 = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref4 !== void 0 ? _ref4 : "$true"
29028
29086
  },
29029
29087
  unstyled,
29030
29088
  ...props,
@@ -29039,7 +29097,7 @@ var require_createSwitch_native = __commonJS({
29039
29097
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.View, {
29040
29098
  style: measureContainerStyle,
29041
29099
  onLayout: handleLayout,
29042
- children: props.children
29100
+ children: frameWidth ? props.children : null
29043
29101
  })
29044
29102
  }),
29045
29103
  bubbleInput