tamagui 1.91.4 → 1.92.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
@@ -7275,7 +7275,7 @@ var require_propMapper_native = __commonJS({
7275
7275
  get: function(_, k) {
7276
7276
  return k === "curProps" ? subProps : Reflect.get(_, k);
7277
7277
  }
7278
- }) : styleStateIn, conf = styleState.conf, styleProps = styleState.styleProps, fontFamily = styleState.fontFamily, staticConfig = styleState.staticConfig, variants = staticConfig.variants;
7278
+ }) : styleStateIn, conf = styleState.conf, styleProps = styleState.styleProps, fontFamily = styleState.fontFamily, staticConfig = styleState.staticConfig, skipThemeTokenResolution = styleState.skipThemeTokenResolution, variants = staticConfig.variants;
7279
7279
  if (process.env.NODE_ENV === "development" && fontFamily && fontFamily[0] === "$" && !(fontFamily in conf.fontsParsed) && console.warn('Warning: no fontFamily "'.concat(fontFamily, '" found in config: ').concat(Object.keys(conf.fontsParsed).join(", "))), !styleProps.noExpand && variants && key in variants) {
7280
7280
  styleState.curProps[key] = value;
7281
7281
  var variantValue = resolveVariants(key, value, styleProps, styleState, "");
@@ -7465,9 +7465,11 @@ var require_propMapper_native = __commonJS({
7465
7465
  var _theme_value, val = (_theme_value = theme == null ? void 0 : theme[value]) !== null && _theme_value !== void 0 ? _theme_value : tokensParsed[customTokenAccept][value];
7466
7466
  val != null && (resolveAs = "value", valOrVar = val, hasSet = !0);
7467
7467
  }
7468
- if (theme && value in theme)
7469
- valOrVar = theme[value], process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info(" - resolving ".concat(key, " to theme value ").concat(value, ": ").concat(valOrVar == null ? void 0 : valOrVar.val)), hasSet = !0;
7470
- else {
7468
+ if (theme && value in theme) {
7469
+ if (valOrVar = theme[value], styleState.skipThemeTokenResolution && valOrVar != null && valOrVar.val)
7470
+ return process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info(" - keep original value: ".concat(value, " for ").concat(key, " due to enableFlattenThemeOnNative: true")), value;
7471
+ process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info(" - resolving ".concat(key, " to theme value ").concat(value, ": ").concat(valOrVar == null ? void 0 : valOrVar.val)), hasSet = !0;
7472
+ } else {
7471
7473
  if (value in conf.specificTokens)
7472
7474
  hasSet = !0, valOrVar = conf.specificTokens[value];
7473
7475
  else {
@@ -7731,7 +7733,7 @@ var require_getSplitStyles_native = __commonJS({
7731
7733
  var _staticConfig_accept, validStyleProps = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? import_helpers.stylePropsText : import_helpers.validStyles);
7732
7734
  return validStyleProps[key] || ((_staticConfig_accept = staticConfig.accept) === null || _staticConfig_accept === void 0 ? void 0 : _staticConfig_accept[key]);
7733
7735
  }
7734
- var getSplitStyles = function(props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) {
7736
+ var getSplitStyles = function(props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug, skipThemeTokenResolution) {
7735
7737
  conf = conf || (0, import_config.getConfig)(), import_constants4.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
7736
7738
  var shorthands = conf.shorthands, isHOC = staticConfig.isHOC, isText = staticConfig.isText, isInput = staticConfig.isInput, variants = staticConfig.variants, isReactNative = staticConfig.isReactNative, inlineProps = staticConfig.inlineProps, inlineWhenUnflattened = staticConfig.inlineWhenUnflattened, parentStaticConfig = staticConfig.parentStaticConfig, acceptsClassName = staticConfig.acceptsClassName, viewProps = {}, mediaState3 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants4.isWeb && !styleProps.noClassNames, rulesToInsert = void 0, classNames = {}, transforms = {}, pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, className = props.className || "", mediaStylesSeen = 0, styleState = {
7737
7739
  curProps: {},
@@ -7746,7 +7748,8 @@ var require_getSplitStyles_native = __commonJS({
7746
7748
  usedKeys,
7747
7749
  viewProps,
7748
7750
  context,
7749
- debug
7751
+ debug,
7752
+ skipThemeTokenResolution
7750
7753
  };
7751
7754
  process.env.NODE_ENV === "development" && debug && debug !== "profile" && import_constants4.isClient && (console.groupCollapsed("getSplitStyles (collapsed)"), (0, import_log.log)({
7752
7755
  props,
@@ -7826,7 +7829,7 @@ var require_getSplitStyles_native = __commonJS({
7826
7829
  if (!(isStyleProp && (props.asChild === "except-style" || props.asChild === "except-style-web"))) {
7827
7830
  var shouldPassProp = !isStyleProp || // is in parent variants
7828
7831
  isHOC && (parentStaticConfig == null ? void 0 : parentStaticConfig.variants) && keyInit in parentStaticConfig.variants || (inlineProps == null ? void 0 : inlineProps.has(keyInit)), parentVariant = parentStaticConfig == null || (_parentStaticConfig_variants = parentStaticConfig.variants) === null || _parentStaticConfig_variants === void 0 ? void 0 : _parentStaticConfig_variants[keyInit], isHOCShouldPassThrough = !!(isHOC && (isShorthand || isValidStyleKeyInit || isMediaOrPseudo1 || parentVariant || keyInit in import_skipProps.skipProps)), shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
7829
- if (process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(" \u{1F511} ".concat(keyOg).concat(keyInit !== keyOg ? " (shorthand for ".concat(keyInit, ")") : "", " ").concat(shouldPassThrough ? "(pass)" : "")), (0, import_log.log)({
7832
+ if (process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupEnd(), console.groupEnd(), console.groupCollapsed(" \u{1F511} ".concat(keyOg).concat(keyInit !== keyOg ? " (shorthand for ".concat(keyInit, ")") : "", " ").concat(shouldPassThrough ? "(pass)" : "")), (0, import_log.log)({
7830
7833
  isVariant,
7831
7834
  valInit,
7832
7835
  shouldPassProp
@@ -9452,7 +9455,8 @@ var require_createComponent_native = __commonJS({
9452
9455
  props.accessibilityDisabled || !1;
9453
9456
  disabled != null && (initialState.disabled = disabled);
9454
9457
  var states = (0, import_react2.useState)(initialState), state = props.forceStyle ? _object_spread_props8(_object_spread9({}, states[0]), _define_property9({}, props.forceStyle, !0)) : states[0], setState = states[1];
9455
- disabled !== state.disabled && setState(_object_spread_props8(_object_spread9({}, state), {
9458
+ disabled !== state.disabled && setState(_object_spread_props8(_object_spread9({}, state, import_defaultComponentState.defaultComponentState), {
9459
+ // removes any stale press state etc
9456
9460
  disabled
9457
9461
  }));
9458
9462
  var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled, debugProp);
@@ -9844,7 +9848,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
9844
9848
  console.groupEnd();
9845
9849
  }
9846
9850
  } else {
9847
- (0, import_log.log)(title), import_isDevTools.isDevTools && (0, import_log.log)("viewProps", viewProps), (0, import_log.log)("final styles:");
9851
+ (0, import_log.log)(title), (0, import_log.log)("state: ", state), import_isDevTools.isDevTools && (0, import_log.log)("viewProps", viewProps), (0, import_log.log)("final styles:");
9848
9852
  for (var key2 in splitStylesStyle)
9849
9853
  (0, import_log.log)(key2, splitStylesStyle[key2]);
9850
9854
  }
@@ -19919,7 +19923,7 @@ var require_SheetImplementationCustom_native = __commonJS({
19919
19923
  }
19920
19924
  }
19921
19925
  var hiddenSize = 10000.1, SheetImplementationCustom = (0, import_core12.themeable)(/* @__PURE__ */ (0, import_react2.forwardRef)(function(props, forwardedRef) {
19922
- var parentSheet = (0, import_react2.useContext)(import_contexts.ParentSheetContext), animation = props.animation, animationConfigProp = props.animationConfig, _props_modal = props.modal, modal = _props_modal === void 0 ? !1 : _props_modal, _props_zIndex = props.zIndex, zIndex = _props_zIndex === void 0 ? parentSheet.zIndex + 1 : _props_zIndex, _props_moveOnKeyboardChange = props.moveOnKeyboardChange, moveOnKeyboardChange = _props_moveOnKeyboardChange === void 0 ? !1 : _props_moveOnKeyboardChange, _props_unmountChildrenWhenHidden = props.unmountChildrenWhenHidden, unmountChildrenWhenHidden = _props_unmountChildrenWhenHidden === void 0 ? !1 : _props_unmountChildrenWhenHidden, portalProps = props.portalProps, keyboardIsVisible = (0, import_use_keyboard_visible.useKeyboardVisible)(), state = (0, import_useSheetOpenState.useSheetOpenState)(props), _useState = _sliced_to_array((0, import_react2.useState)(null), 2), overlayComponent = _useState[0], setOverlayComponent = _useState[1], providerProps = (0, import_useSheetProviderProps.useSheetProviderProps)(props, state, {
19926
+ var parentSheet = (0, import_react2.useContext)(import_contexts.ParentSheetContext), animation = props.animation, animationConfigProp = props.animationConfig, _props_modal = props.modal, modal = _props_modal === void 0 ? !1 : _props_modal, _props_zIndex = props.zIndex, zIndex = _props_zIndex === void 0 ? parentSheet.zIndex + 1 : _props_zIndex, _props_moveOnKeyboardChange = props.moveOnKeyboardChange, moveOnKeyboardChange = _props_moveOnKeyboardChange === void 0 ? !1 : _props_moveOnKeyboardChange, _props_unmountChildrenWhenHidden = props.unmountChildrenWhenHidden, unmountChildrenWhenHidden = _props_unmountChildrenWhenHidden === void 0 ? !1 : _props_unmountChildrenWhenHidden, portalProps = props.portalProps, tmp = props.containerComponent, ContainerComponent = tmp === void 0 ? import_react2.Fragment : tmp, keyboardIsVisible = (0, import_use_keyboard_visible.useKeyboardVisible)(), state = (0, import_useSheetOpenState.useSheetOpenState)(props), _useState = _sliced_to_array((0, import_react2.useState)(null), 2), overlayComponent = _useState[0], setOverlayComponent = _useState[1], providerProps = (0, import_useSheetProviderProps.useSheetProviderProps)(props, state, {
19923
19927
  onOverlayComponent: setOverlayComponent
19924
19928
  }), frameSize = providerProps.frameSize, setFrameSize = providerProps.setFrameSize, snapPoints = providerProps.snapPoints, snapPointsMode = providerProps.snapPointsMode, hasFit = providerProps.hasFit, position = providerProps.position, setPosition = providerProps.setPosition, scrollBridge = providerProps.scrollBridge, screenSize = providerProps.screenSize, setMaxContentSize = providerProps.setMaxContentSize, maxSnapPoint = providerProps.maxSnapPoint, open = state.open, controller = state.controller, isHidden = state.isHidden, sheetRef = (0, import_react2.useRef)(null), ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, sheetRef), animationConfig = function() {
19925
19929
  var _ref = _sliced_to_array(animation ? Array.isArray(animation) ? animation : [
@@ -20156,12 +20160,14 @@ var require_SheetImplementationCustom_native = __commonJS({
20156
20160
  var modalContents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_portal2.Portal, _object_spread_props8(_object_spread9({
20157
20161
  zIndex
20158
20162
  }, portalProps), {
20159
- children: shouldMountChildren && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core12.Theme, {
20160
- forceClassName: !0,
20161
- name: themeName,
20162
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_adapt.AdaptParentContext.Provider, {
20163
- value: adaptContext,
20164
- children: contents
20163
+ children: shouldMountChildren && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ContainerComponent, {
20164
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core12.Theme, {
20165
+ forceClassName: !0,
20166
+ name: themeName,
20167
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_adapt.AdaptParentContext.Provider, {
20168
+ value: adaptContext,
20169
+ children: contents
20170
+ })
20165
20171
  })
20166
20172
  })
20167
20173
  }));
@@ -25481,7 +25487,7 @@ var require_createCheckbox_native = __commonJS({
25481
25487
  }
25482
25488
  });
25483
25489
  module2.exports = __toCommonJS2(createCheckbox_exports);
25484
- var import_jsx_runtime6 = require("react/jsx-runtime"), import_checkbox_headless = require_index_native47(), import_core12 = require_index_native16(), import_font_size = require_index_native40(), import_get_token2 = require_index_native18(), import_helpers_tamagui = require_index_native41(), import_use_controllable_state = require_index_native9(), import_react2 = __toESM2(require("react")), import_Checkbox = require_Checkbox_native(), import_CheckboxStyledContext = require_CheckboxStyledContext_native();
25490
+ var import_jsx_runtime6 = require("react/jsx-runtime"), import_focusable2 = require_index_native44(), import_checkbox_headless = require_index_native47(), import_core12 = require_index_native16(), import_font_size = require_index_native40(), import_get_token2 = require_index_native18(), import_helpers_tamagui = require_index_native41(), import_use_controllable_state = require_index_native9(), import_react2 = __toESM2(require("react")), import_Checkbox = require_Checkbox_native(), import_CheckboxStyledContext = require_CheckboxStyledContext_native();
25485
25491
  function _array_like_to_array2(arr, len) {
25486
25492
  (len == null || len > arr.length) && (len = arr.length);
25487
25493
  for (var i = 0, arr2 = new Array(len); i < len; i++)
@@ -25620,7 +25626,23 @@ var require_createCheckbox_native = __commonJS({
25620
25626
  setChecked
25621
25627
  ],
25622
25628
  forwardedRef
25623
- ), checkboxProps = _useCheckbox.checkboxProps, checkboxRef = _useCheckbox.checkboxRef, bubbleInput = _useCheckbox.bubbleInput, renderNative = (0, import_core12.shouldRenderNativePlatform)(native);
25629
+ ), checkboxProps = _useCheckbox.checkboxProps, checkboxRef = _useCheckbox.checkboxRef, bubbleInput = _useCheckbox.bubbleInput;
25630
+ import_react2.default.useEffect(function() {
25631
+ if (props.id && !props.disabled)
25632
+ return (0, import_focusable2.registerFocusable)(props.id, {
25633
+ focusAndSelect: function() {
25634
+ setChecked == null || setChecked(function(value) {
25635
+ return !value;
25636
+ });
25637
+ },
25638
+ focus: function() {
25639
+ }
25640
+ });
25641
+ }, [
25642
+ props.id,
25643
+ props.disabled
25644
+ ]);
25645
+ var renderNative = (0, import_core12.shouldRenderNativePlatform)(native);
25624
25646
  if (renderNative === "web")
25625
25647
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", {
25626
25648
  type: "checkbox",
@@ -33781,7 +33803,7 @@ var require_Select_native = __commonJS({
33781
33803
  }
33782
33804
  });
33783
33805
  module2.exports = __toCommonJS2(Select_exports);
33784
- var import_jsx_runtime6 = require("react/jsx-runtime"), import_adapt = require_index_native25(), import_compose_refs = require_index_native10(), import_constants4 = require_index_native6(), import_core12 = require_index_native16(), import_get_token2 = require_index_native18(), import_helpers = require_index_native7(), import_list_item = require_index_native54(), import_portal2 = require_index_native30(), import_separator = require_index_native62(), import_sheet = require_index_native34(), import_stacks3 = require_index_native20(), import_text2 = require_index_native22(), import_use_controllable_state = require_index_native9(), React2 = __toESM2(require("react")), import_use_debounce = require_index_native63(), import_constants22 = require_constants_native4(), import_context = require_context_native(), import_SelectContent = require_SelectContent_native(), import_SelectImpl = require_SelectImpl_native(), import_SelectItem = require_SelectItem_native(), import_SelectItemText = require_SelectItemText_native(), import_SelectScrollButton = require_SelectScrollButton_native(), import_SelectTrigger = require_SelectTrigger_native(), import_SelectViewport = require_SelectViewport_native(), import_useSelectBreakpointActive = require_useSelectBreakpointActive_native();
33806
+ var import_jsx_runtime6 = require("react/jsx-runtime"), import_adapt = require_index_native25(), import_compose_refs = require_index_native10(), import_constants4 = require_index_native6(), import_core12 = require_index_native16(), import_get_token2 = require_index_native18(), import_helpers = require_index_native7(), import_list_item = require_index_native54(), import_portal2 = require_index_native30(), import_separator = require_index_native62(), import_focusable2 = require_index_native44(), import_sheet = require_index_native34(), import_stacks3 = require_index_native20(), import_text2 = require_index_native22(), import_use_controllable_state = require_index_native9(), React2 = __toESM2(require("react")), import_use_debounce = require_index_native63(), import_constants22 = require_constants_native4(), import_context = require_context_native(), import_SelectContent = require_SelectContent_native(), import_SelectImpl = require_SelectImpl_native(), import_SelectItem = require_SelectItem_native(), import_SelectItemText = require_SelectItemText_native(), import_SelectScrollButton = require_SelectScrollButton_native(), import_SelectTrigger = require_SelectTrigger_native(), import_SelectViewport = require_SelectViewport_native(), import_useSelectBreakpointActive = require_useSelectBreakpointActive_native();
33785
33807
  function _array_like_to_array2(arr, len) {
33786
33808
  (len == null || len > arr.length) && (len = arr.length);
33787
33809
  for (var i = 0, arr2 = new Array(len); i < len; i++)
@@ -34083,6 +34105,19 @@ var require_Select_native = __commonJS({
34083
34105
  emitValue(value);
34084
34106
  }, [
34085
34107
  value
34108
+ ]), React2.useEffect(function() {
34109
+ if (props.id)
34110
+ return (0, import_focusable2.registerFocusable)(props.id, {
34111
+ focusAndSelect: function() {
34112
+ setOpen == null || setOpen(function(value2) {
34113
+ return !value2;
34114
+ });
34115
+ },
34116
+ focus: function() {
34117
+ }
34118
+ });
34119
+ }, [
34120
+ props.id
34086
34121
  ]);
34087
34122
  var _React_useState1 = _sliced_to_array(React2.useState(0), 2), activeIndex = _React_useState1[0], setActiveIndex = _React_useState1[1], _useEmitter = _sliced_to_array(useEmitter(), 2), emitValue = _useEmitter[0], valueSubscribe = _useEmitter[1], _useEmitter1 = _sliced_to_array(useEmitter(), 2), emitActiveIndex = _useEmitter1[0], activeIndexSubscribe = _useEmitter1[1], selectedIndexRef = React2.useRef(null), activeIndexRef = React2.useRef(null), listContentRef = React2.useRef([]), _React_useState2 = _sliced_to_array(React2.useState(0), 2), selectedIndex = _React_useState2[0], setSelectedIndex = _React_useState2[1], _React_useState3 = _sliced_to_array(React2.useState(null), 2), valueNode = _React_useState3[0], setValueNode = _React_useState3[1];
34088
34123
  (0, import_constants4.useIsomorphicLayoutEffect)(function() {
@@ -36119,13 +36154,12 @@ var require_createSwitch_native = __commonJS({
36119
36154
  noExpand: !0,
36120
36155
  resolveValues: "none",
36121
36156
  forComponent: Frame
36122
- }), _styledContext_size, _ref;
36123
- propsActive.size = (_ref = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref !== void 0 ? _ref : "$true";
36124
- var _styledContext_unstyled, _ref1;
36125
- propsActive.unstyled = (_ref1 = (_styledContext_unstyled = styledContext.unstyled) !== null && _styledContext_unstyled !== void 0 ? _styledContext_unstyled : props.unstyled) !== null && _ref1 !== void 0 ? _ref1 : !1;
36126
- var _useSwitch = (0, import_switch_headless.useSwitch)(
36157
+ }), _styledContext_size, _ref, _styledContext_unstyled, _ref1, _useSwitch = (0, import_switch_headless.useSwitch)(
36127
36158
  // @ts-ignore
36128
- propsActive,
36159
+ Object.assign({
36160
+ size: (_ref = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref !== void 0 ? _ref : "$true",
36161
+ unstyled: (_ref1 = (_styledContext_unstyled = styledContext.unstyled) !== null && _styledContext_unstyled !== void 0 ? _styledContext_unstyled : props.unstyled) !== null && _ref1 !== void 0 ? _ref1 : !1
36162
+ }, propsActive),
36129
36163
  [
36130
36164
  checked,
36131
36165
  setChecked