tamagui 1.69.2 → 1.70.0

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.
@@ -3365,12 +3365,12 @@ var require_getSplitStyles_native = __commonJS({
3365
3365
  case "accessibilityRequired":
3366
3366
  default:
3367
3367
  }
3368
- let isValidStyleKeyInit = keyInit in validStyleProps, isShorthand = keyInit in shorthands, isVariant = !isValidStyleKeyInit && variants && keyInit in variants, isStyleLikeKey = isShorthand || isValidStyleKeyInit || isVariant, isPseudo = keyInit in import_helpers.validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo && (0, import_useMedia.isMediaKey)(keyInit), isMediaOrPseudo = isMedia || isPseudo, isStyleProp = isMediaOrPseudo || isVariant || isValidStyleKeyInit || isShorthand;
3368
+ let isValidStyleKeyInit = keyInit in validStyleProps, isShorthand = keyInit in shorthands, isVariant = !isValidStyleKeyInit && variants && keyInit in variants, isStyleLikeKey = isShorthand || isValidStyleKeyInit || isVariant, isPseudo = keyInit in import_helpers.validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo && (0, import_useMedia.isMediaKey)(keyInit), isMediaOrPseudo = isMedia || isPseudo, isStyleProp = isMediaOrPseudo || isVariant && !styleProps.noExpand || isValidStyleKeyInit || isShorthand;
3369
3369
  if (isStyleProp && (props.asChild === "except-style" || props.asChild === "except-style-web"))
3370
3370
  continue;
3371
3371
  let shouldPassProp = !isStyleProp || // is in parent variants
3372
3372
  isHOC && (parentStaticConfig == null ? void 0 : parentStaticConfig.variants) && keyInit in parentStaticConfig.variants || (inlineProps == null ? void 0 : inlineProps.has(keyInit)), parentVariant = (_a = parentStaticConfig == null ? void 0 : parentStaticConfig.variants) == null ? void 0 : _a[keyInit], isHOCShouldPassThrough = !!(isHOC && (isShorthand || isValidStyleKeyInit || isMediaOrPseudo || parentVariant || keyInit in skipProps));
3373
- if ((shouldPassProp || isHOCShouldPassThrough) && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo), !isVariant) || keyInit in skipProps)
3373
+ if ((shouldPassProp || isHOCShouldPassThrough) && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo), !isVariant) || !styleProps.noSkip && keyInit in skipProps)
3374
3374
  continue;
3375
3375
  if (isText && valInit && (keyInit === fontFamilyKey || keyInit === shorthands[fontFamilyKey]) && valInit in conf.fontsParsed && (styleState.fontFamily = valInit), isValidStyleKeyInit && !variants && (valInitType === "number" || valInitType === "string" && valInit[0] !== "$")) {
3376
3376
  style[keyInit] = valInit;
@@ -3591,7 +3591,7 @@ var require_getSplitStyles_native = __commonJS({
3591
3591
  let val = styleIn[key];
3592
3592
  key = conf2.shorthands[key] || key;
3593
3593
  let expanded = (0, import_propMapper.propMapper)(key, val, styleState, { ...props, ...props[subKey] });
3594
- if (!(!expanded || !staticConfig.isHOC && key in skipProps))
3594
+ if (!(!expanded || !staticConfig.isHOC && key in skipProps && !styleProps.noSkip))
3595
3595
  for (let [skey, sval] of expanded)
3596
3596
  !avoidMergeTransform && skey in import_helpers.stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps.noNormalize ? sval : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(sval, key);
3597
3597
  }
@@ -5844,6 +5844,7 @@ var require_useProps_native = __commonJS({
5844
5844
  {
5845
5845
  isAnimated: !1,
5846
5846
  mediaState: media,
5847
+ noSkip: !0,
5847
5848
  noClassNames: !0,
5848
5849
  ...opts
5849
5850
  },
@@ -7370,6 +7371,8 @@ var require_getElevation_native = __commonJS({
7370
7371
  typeof val2 == "number" ? num = val2 : num = 10;
7371
7372
  } else
7372
7373
  num = +val;
7374
+ if (num === 0)
7375
+ return;
7373
7376
  let [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)];
7374
7377
  return {
7375
7378
  shadowColor: theme.shadowColor,
@@ -13236,7 +13239,7 @@ var require_Popper_native = __commonJS({
13236
13239
  unstyled: {
13237
13240
  false: {
13238
13241
  position: "absolute",
13239
- zIndex: -1,
13242
+ zIndex: 1e6,
13240
13243
  pointerEvents: "none",
13241
13244
  overflow: "hidden",
13242
13245
  alignItems: "center",
@@ -13263,7 +13266,7 @@ var require_Popper_native = __commonJS({
13263
13266
  if (primaryPlacement) {
13264
13267
  arrowStyle[isVertical ? "width" : "height"] = size * 2;
13265
13268
  let oppSide = opposites[primaryPlacement];
13266
- oppSide && (arrowStyle[oppSide] = -size, innerArrowStyle[oppSide] = size / 2), (oppSide === "top" || oppSide === "bottom") && (arrowStyle.left = 0), (oppSide === "left" || oppSide === "right") && (arrowStyle.top = 0), (0, import_core12.useIsomorphicLayoutEffect)(() => {
13269
+ oppSide && (arrowStyle[oppSide] = -size, innerArrowStyle[oppSide] = size / 2), oppSide === "bottom" && (arrowStyle[oppSide] += 1), (oppSide === "top" || oppSide === "bottom") && (arrowStyle.left = 0), (oppSide === "left" || oppSide === "right") && (arrowStyle.top = 0), (0, import_core12.useIsomorphicLayoutEffect)(() => {
13267
13270
  var _a2;
13268
13271
  (_a2 = context.onArrowSize) == null || _a2.call(context, size);
13269
13272
  }, [size, context.onArrowSize]);
@@ -14399,10 +14402,12 @@ var require_SelectItem_native = __commonJS({
14399
14402
  interactions,
14400
14403
  shouldRenderWebNative,
14401
14404
  size,
14405
+ onActiveChange,
14402
14406
  initialValue
14403
14407
  } = context, [isSelected, setSelected] = React2.useState(initialValue === value), [isActive, setActive] = React2.useState(!1);
14404
14408
  React2.useEffect(() => activeIndexSubscribe((i) => {
14405
- setActive(index === i);
14409
+ let isActive2 = index === i;
14410
+ setActive(isActive2), isActive2 && onActiveChange(value, index);
14406
14411
  }), [index]), React2.useEffect(() => valueSubscribe((val) => {
14407
14412
  setSelected(val === value);
14408
14413
  }), [value]);
@@ -14876,6 +14881,7 @@ var require_Select_native = __commonJS({
14876
14881
  onValueChange,
14877
14882
  disablePreventBodyScroll,
14878
14883
  size: sizeProp = "$true",
14884
+ onActiveChange,
14879
14885
  dir
14880
14886
  } = props, id = React2.useId(), scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? id : id, { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
14881
14887
  Contents: React2.useCallback(
@@ -14912,6 +14918,9 @@ var require_Select_native = __commonJS({
14912
14918
  onChange: React2.useCallback((val) => {
14913
14919
  setValue(val), emitValue(val);
14914
14920
  }, []),
14921
+ onActiveChange: (0, import_core12.useEvent)((...args) => {
14922
+ onActiveChange == null || onActiveChange(...args);
14923
+ }),
14915
14924
  setSelectedIndex,
14916
14925
  setValueAtIndex: React2.useCallback((index, value2) => {
14917
14926
  listContentRef.current[index] = value2;
@@ -14935,7 +14944,7 @@ var require_Select_native = __commonJS({
14935
14944
  activeIndex,
14936
14945
  selectedIndex,
14937
14946
  setActiveIndex: React2.useCallback((index) => {
14938
- setActiveIndex(index), typeof index == "number" && emitActiveIndex(index);
14947
+ setActiveIndex((prev) => prev !== index ? (typeof index == "number" && emitActiveIndex(index), index) : prev);
14939
14948
  }, []),
14940
14949
  value,
14941
14950
  open,
@@ -15717,6 +15726,9 @@ var require_Switch_native = __commonJS({
15717
15726
  borderRadius: 1e3
15718
15727
  }
15719
15728
  },
15729
+ checked: {
15730
+ true: {}
15731
+ },
15720
15732
  size: {
15721
15733
  "...size": (val) => {
15722
15734
  let size = getSwitchHeight(val);
@@ -15732,7 +15744,6 @@ var require_Switch_native = __commonJS({
15732
15744
  }
15733
15745
  }), getSwitchHeight = (val) => Math.round((0, import_core12.getVariableValue)((0, import_get_token2.getSize)(val)) * 0.65), getSwitchWidth = (val) => getSwitchHeight(val) * 2, SwitchFrame = (0, import_core12.styled)(import_stacks3.YStack, {
15734
15746
  name: "Switch",
15735
- tag: "button",
15736
15747
  context: import_SwitchContext.SwitchContext,
15737
15748
  variants: {
15738
15749
  unstyled: {
@@ -15827,6 +15838,7 @@ var require_createSwitch_native = __commonJS({
15827
15838
  "data-state": getState(checked),
15828
15839
  "data-disabled": disabled ? "" : void 0,
15829
15840
  alignSelf: initialChecked ? "flex-end" : "flex-start",
15841
+ checked,
15830
15842
  x,
15831
15843
  ...thumbProps,
15832
15844
  onLayout: (0, import_core12.composeEventHandlers)(
@@ -15841,7 +15853,12 @@ var require_createSwitch_native = __commonJS({
15841
15853
  );
15842
15854
  }), SwitchComponent = Frame.extractable(
15843
15855
  React2.forwardRef(function(propsIn, forwardedRef) {
15844
- let styledContext = React2.useContext(import_SwitchContext.SwitchContext), props = (0, import_core12.useProps)(propsIn), {
15856
+ let styledContext = React2.useContext(import_SwitchContext.SwitchContext), [props, style] = (0, import_core12.usePropsAndStyle)(propsIn, {
15857
+ noNormalize: !0,
15858
+ noExpand: !0,
15859
+ resolveValues: "none",
15860
+ forComponent: Frame
15861
+ }), {
15845
15862
  labeledBy: ariaLabelledby,
15846
15863
  name,
15847
15864
  checked: checkedProp,
@@ -15857,10 +15874,8 @@ var require_createSwitch_native = __commonJS({
15857
15874
  children,
15858
15875
  ...switchProps
15859
15876
  } = props, leftBorderWidth = (() => {
15860
- let _;
15861
- for (let key in switchProps)
15862
- (key === "borderWidth" || key === "borderLeftWidth") && (_ = switchProps[key]);
15863
- return Frame === import_Switch.SwitchFrame && acceptsUnstyled && _ == null && unstyled === !1 && (_ = 2), typeof _ == "string" && (_ = (0, import_core12.getVariableValue)((0, import_get_token2.getSize)(_))), typeof _ == "number" ? _ : 0;
15877
+ let _ = style.borderLeftWidth || style.borderWidth;
15878
+ return typeof _ == "string" && (_.endsWith("px") ? _ = +_.replace("px", "") : _ = (0, import_core12.getVariableValue)((0, import_get_token2.getSize)(_))), typeof _ == "number" ? _ : Frame === import_Switch.SwitchFrame && !unstyled ? 2 : 0;
15864
15879
  })(), native = Array.isArray(nativeProp) ? nativeProp : [nativeProp], shouldRenderMobileNative = !import_core12.isWeb && nativeProp === !0 || !import_core12.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, (node) => setButton(node)), labelId = (0, import_label.useLabelContext)(button), labelledBy = ariaLabelledby || labelId, hasConsumerStoppedPropagationRef = React2.useRef(!1), isFormControl = import_core12.isWeb ? button ? !!button.closest("form") : !0 : !1, [frameWidth, setFrameWidth] = React2.useState(0), [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
15865
15880
  prop: checkedProp,
15866
15881
  defaultProp: defaultChecked || !1,
@@ -16628,9 +16643,11 @@ var require_Toggle_native = __commonJS({
16628
16643
  onChange: onPressedChange,
16629
16644
  defaultProp: defaultPressed
16630
16645
  });
16631
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_web.Theme, { name: pressed ? "active" : null, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
16646
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
16632
16647
  ToggleFrame,
16633
16648
  {
16649
+ theme: pressed ? "active" : null,
16650
+ themeShallow: !0,
16634
16651
  active: props.unstyled ? void 0 : pressed,
16635
16652
  "aria-pressed": pressed,
16636
16653
  "data-state": pressed ? "on" : "off",
@@ -16641,7 +16658,7 @@ var require_Toggle_native = __commonJS({
16641
16658
  props.disabled || setPressed(!pressed);
16642
16659
  })
16643
16660
  }
16644
- ) });
16661
+ );
16645
16662
  })
16646
16663
  );
16647
16664
  Toggle.displayName = NAME;