tamagui 1.69.3 → 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.
package/dist/native.js CHANGED
@@ -3462,7 +3462,7 @@ var require_getSplitStyles_native = __commonJS({
3462
3462
  case "accessibilityRequired":
3463
3463
  default:
3464
3464
  }
3465
- 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;
3465
+ 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;
3466
3466
  if (isStyleProp && (props.asChild === "except-style" || props.asChild === "except-style-web"))
3467
3467
  continue;
3468
3468
  let shouldPassProp = !isStyleProp || // is in parent variants
@@ -3476,7 +3476,7 @@ var require_getSplitStyles_native = __commonJS({
3476
3476
  isHOCShouldPassThrough,
3477
3477
  curProps: { ...styleState.curProps },
3478
3478
  parentStaticConfig
3479
- }), console.groupEnd()), shouldPassThrough && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo), !isVariant) || keyInit in skipProps)
3479
+ }), console.groupEnd()), shouldPassThrough && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo), !isVariant) || !styleProps.noSkip && keyInit in skipProps)
3480
3480
  continue;
3481
3481
  if (isText && valInit && (keyInit === fontFamilyKey || keyInit === shorthands[fontFamilyKey]) && valInit in conf.fontsParsed && (styleState.fontFamily = valInit), isValidStyleKeyInit && !variants && (valInitType === "number" || valInitType === "string" && valInit[0] !== "$")) {
3482
3482
  style[keyInit] = valInit;
@@ -3523,7 +3523,8 @@ current`, {
3523
3523
  styleProps.noClassNames
3524
3524
  ), descriptor = import_pseudoDescriptors.pseudoDescriptors[key], isEnter = key === "enterStyle", isExit = key === "exitStyle";
3525
3525
  if (process.env.NODE_ENV === "development" && !styleProps.isAnimated && !componentState.unmounted && (isEnter || isExit) && console.warn(
3526
- `No animation prop given to component ${staticConfig.componentName || ""} with enterStyle / exitStyle, these styles will be ignore.`
3526
+ `No animation prop given to component ${staticConfig.componentName || ""} ${props["data-at"] || ""} with enterStyle / exitStyle, these styles will be ignored`,
3527
+ { props }
3527
3528
  ), !descriptor || isExit && !styleProps.isExiting)
3528
3529
  continue;
3529
3530
  if ((!shouldDoClasses || IS_STATIC) && (pseudos ||= {}, pseudos[key] ||= {}, IS_STATIC)) {
@@ -3762,7 +3763,7 @@ current`, {
3762
3763
  let val = styleIn[key];
3763
3764
  key = conf2.shorthands[key] || key;
3764
3765
  let expanded = (0, import_propMapper.propMapper)(key, val, styleState, { ...props, ...props[subKey] });
3765
- if (!(!expanded || !staticConfig.isHOC && key in skipProps))
3766
+ if (!(!expanded || !staticConfig.isHOC && key in skipProps && !styleProps.noSkip))
3766
3767
  for (let [skey, sval] of expanded)
3767
3768
  !avoidMergeTransform && skey in import_helpers.stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps.noNormalize ? sval : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(sval, key);
3768
3769
  }
@@ -6225,6 +6226,7 @@ var require_useProps_native = __commonJS({
6225
6226
  {
6226
6227
  isAnimated: !1,
6227
6228
  mediaState: media,
6229
+ noSkip: !0,
6228
6230
  noClassNames: !0,
6229
6231
  ...opts
6230
6232
  },
@@ -7751,6 +7753,8 @@ var require_getElevation_native = __commonJS({
7751
7753
  typeof val2 == "number" ? num = val2 : num = 10;
7752
7754
  } else
7753
7755
  num = +val;
7756
+ if (num === 0)
7757
+ return;
7754
7758
  let [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)];
7755
7759
  return {
7756
7760
  shadowColor: theme.shadowColor,
@@ -13787,7 +13791,7 @@ var require_Popper_native = __commonJS({
13787
13791
  unstyled: {
13788
13792
  false: {
13789
13793
  position: "absolute",
13790
- zIndex: -1,
13794
+ zIndex: 1e6,
13791
13795
  pointerEvents: "none",
13792
13796
  overflow: "hidden",
13793
13797
  alignItems: "center",
@@ -13814,7 +13818,7 @@ var require_Popper_native = __commonJS({
13814
13818
  if (primaryPlacement) {
13815
13819
  arrowStyle[isVertical ? "width" : "height"] = size * 2;
13816
13820
  let oppSide = opposites[primaryPlacement];
13817
- 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)(() => {
13821
+ 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)(() => {
13818
13822
  var _a2;
13819
13823
  (_a2 = context.onArrowSize) == null || _a2.call(context, size);
13820
13824
  }, [size, context.onArrowSize]);
@@ -14950,10 +14954,12 @@ var require_SelectItem_native = __commonJS({
14950
14954
  interactions,
14951
14955
  shouldRenderWebNative,
14952
14956
  size,
14957
+ onActiveChange,
14953
14958
  initialValue
14954
14959
  } = context, [isSelected, setSelected] = React2.useState(initialValue === value), [isActive, setActive] = React2.useState(!1);
14955
14960
  React2.useEffect(() => activeIndexSubscribe((i) => {
14956
- setActive(index === i);
14961
+ let isActive2 = index === i;
14962
+ setActive(isActive2), isActive2 && onActiveChange(value, index);
14957
14963
  }), [index]), React2.useEffect(() => valueSubscribe((val) => {
14958
14964
  setSelected(val === value);
14959
14965
  }), [value]);
@@ -15427,6 +15433,7 @@ var require_Select_native = __commonJS({
15427
15433
  onValueChange,
15428
15434
  disablePreventBodyScroll,
15429
15435
  size: sizeProp = "$true",
15436
+ onActiveChange,
15430
15437
  dir
15431
15438
  } = props, id = React2.useId(), scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? id : id, { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
15432
15439
  Contents: React2.useCallback(
@@ -15463,6 +15470,9 @@ var require_Select_native = __commonJS({
15463
15470
  onChange: React2.useCallback((val) => {
15464
15471
  setValue(val), emitValue(val);
15465
15472
  }, []),
15473
+ onActiveChange: (0, import_core12.useEvent)((...args) => {
15474
+ onActiveChange == null || onActiveChange(...args);
15475
+ }),
15466
15476
  setSelectedIndex,
15467
15477
  setValueAtIndex: React2.useCallback((index, value2) => {
15468
15478
  listContentRef.current[index] = value2;
@@ -15486,7 +15496,7 @@ var require_Select_native = __commonJS({
15486
15496
  activeIndex,
15487
15497
  selectedIndex,
15488
15498
  setActiveIndex: React2.useCallback((index) => {
15489
- setActiveIndex(index), typeof index == "number" && emitActiveIndex(index);
15499
+ setActiveIndex((prev) => prev !== index ? (typeof index == "number" && emitActiveIndex(index), index) : prev);
15490
15500
  }, []),
15491
15501
  value,
15492
15502
  open,
@@ -16268,6 +16278,9 @@ var require_Switch_native = __commonJS({
16268
16278
  borderRadius: 1e3
16269
16279
  }
16270
16280
  },
16281
+ checked: {
16282
+ true: {}
16283
+ },
16271
16284
  size: {
16272
16285
  "...size": (val) => {
16273
16286
  let size = getSwitchHeight(val);
@@ -16283,7 +16296,6 @@ var require_Switch_native = __commonJS({
16283
16296
  }
16284
16297
  }), 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, {
16285
16298
  name: "Switch",
16286
- tag: "button",
16287
16299
  context: import_SwitchContext.SwitchContext,
16288
16300
  variants: {
16289
16301
  unstyled: {
@@ -16382,6 +16394,7 @@ var require_createSwitch_native = __commonJS({
16382
16394
  "data-state": getState(checked),
16383
16395
  "data-disabled": disabled ? "" : void 0,
16384
16396
  alignSelf: initialChecked ? "flex-end" : "flex-start",
16397
+ checked,
16385
16398
  x,
16386
16399
  ...thumbProps,
16387
16400
  onLayout: (0, import_core12.composeEventHandlers)(
@@ -16396,7 +16409,12 @@ var require_createSwitch_native = __commonJS({
16396
16409
  );
16397
16410
  }), SwitchComponent = Frame.extractable(
16398
16411
  React2.forwardRef(function(propsIn, forwardedRef) {
16399
- let styledContext = React2.useContext(import_SwitchContext.SwitchContext), props = (0, import_core12.useProps)(propsIn), {
16412
+ let styledContext = React2.useContext(import_SwitchContext.SwitchContext), [props, style] = (0, import_core12.usePropsAndStyle)(propsIn, {
16413
+ noNormalize: !0,
16414
+ noExpand: !0,
16415
+ resolveValues: "none",
16416
+ forComponent: Frame
16417
+ }), {
16400
16418
  labeledBy: ariaLabelledby,
16401
16419
  name,
16402
16420
  checked: checkedProp,
@@ -16412,10 +16430,8 @@ var require_createSwitch_native = __commonJS({
16412
16430
  children,
16413
16431
  ...switchProps
16414
16432
  } = props, leftBorderWidth = (() => {
16415
- let _;
16416
- for (let key in switchProps)
16417
- (key === "borderWidth" || key === "borderLeftWidth") && (_ = switchProps[key]);
16418
- return Frame === import_Switch.SwitchFrame && acceptsUnstyled && _ == null && unstyled === !1 && (_ = 2), typeof _ == "string" && (_ = (0, import_core12.getVariableValue)((0, import_get_token2.getSize)(_))), typeof _ == "number" ? _ : 0;
16433
+ let _ = style.borderLeftWidth || style.borderWidth;
16434
+ 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;
16419
16435
  })(), 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)({
16420
16436
  prop: checkedProp,
16421
16437
  defaultProp: defaultChecked || !1,
@@ -17195,9 +17211,11 @@ var require_Toggle_native = __commonJS({
17195
17211
  onChange: onPressedChange,
17196
17212
  defaultProp: defaultPressed
17197
17213
  });
17198
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_web.Theme, { name: pressed ? "active" : null, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17214
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17199
17215
  ToggleFrame,
17200
17216
  {
17217
+ theme: pressed ? "active" : null,
17218
+ themeShallow: !0,
17201
17219
  active: props.unstyled ? void 0 : pressed,
17202
17220
  "aria-pressed": pressed,
17203
17221
  "data-state": pressed ? "on" : "off",
@@ -17208,7 +17226,7 @@ var require_Toggle_native = __commonJS({
17208
17226
  props.disabled || setPressed(!pressed);
17209
17227
  })
17210
17228
  }
17211
- ) });
17229
+ );
17212
17230
  })
17213
17231
  );
17214
17232
  Toggle.displayName = NAME;