tamagui 1.123.9 → 1.123.11
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 +58 -109
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +58 -109
- package/dist/test.native.js.map +2 -2
- package/package.json +54 -54
package/dist/test.native.js
CHANGED
|
@@ -6472,7 +6472,7 @@ var require_propMapper_native = __commonJS({
|
|
|
6472
6472
|
return;
|
|
6473
6473
|
}
|
|
6474
6474
|
}
|
|
6475
|
-
if (styleProps.disableExpandShorthands || key in conf.shorthands && (key = conf.shorthands[key]), value != null && (value[0] === "$" ? value = getTokenForKey(key, value, styleProps
|
|
6475
|
+
if (styleProps.disableExpandShorthands || key in conf.shorthands && (key = conf.shorthands[key]), value != null && (value[0] === "$" ? value = getTokenForKey(key, value, styleProps, styleState) : (0, import_createVariable.isVariable)(value) && (value = resolveVariableValue(key, value, styleProps.resolveValues))), value != null) {
|
|
6476
6476
|
key === "fontFamily" && lastFontFamilyToken && (styleState.fontFamily = lastFontFamilyToken);
|
|
6477
6477
|
var expanded = styleProps.noExpand ? null : (0, import_expandStyle.expandStyle)(key, value);
|
|
6478
6478
|
if (expanded) for (var max2 = expanded.length, i = 0; i < max2; i++) {
|
|
@@ -6526,7 +6526,7 @@ var require_propMapper_native = __commonJS({
|
|
|
6526
6526
|
if (styleProps.noExpand) res[subKey] = val;
|
|
6527
6527
|
else if (variants && subKey in variants) {
|
|
6528
6528
|
if (parentVariantKey && parentVariantKey === key) res[subKey] = // SYNC WITH *1
|
|
6529
|
-
val[0] === "$" ? getTokenForKey(subKey, val, styleProps
|
|
6529
|
+
val[0] === "$" ? getTokenForKey(subKey, val, styleProps, styleState) : val;
|
|
6530
6530
|
else {
|
|
6531
6531
|
var variantOut = resolveVariants(subKey, val, styleProps, styleState, key);
|
|
6532
6532
|
if (variantOut) {
|
|
@@ -6559,7 +6559,7 @@ var require_propMapper_native = __commonJS({
|
|
|
6559
6559
|
if (typeof val == "string") {
|
|
6560
6560
|
var fVal = (
|
|
6561
6561
|
// SYNC WITH *1
|
|
6562
|
-
val[0] === "$" ? getTokenForKey(subKey, val, styleProps
|
|
6562
|
+
val[0] === "$" ? getTokenForKey(subKey, val, styleProps, styleState) : val
|
|
6563
6563
|
);
|
|
6564
6564
|
res[subKey] = fVal;
|
|
6565
6565
|
continue;
|
|
@@ -6615,16 +6615,18 @@ var require_propMapper_native = __commonJS({
|
|
|
6615
6615
|
var fontShorthand = {
|
|
6616
6616
|
fontSize: "size",
|
|
6617
6617
|
fontWeight: "weight"
|
|
6618
|
-
}, lastFontFamilyToken = null, getTokenForKey = function(key, value) {
|
|
6619
|
-
var resolveAs =
|
|
6618
|
+
}, lastFontFamilyToken = null, getTokenForKey = function(key, value, styleProps, styleState) {
|
|
6619
|
+
var _staticConfig_accept, resolveAs = styleProps.resolveValues || "none";
|
|
6620
6620
|
if (resolveAs === "none") return value;
|
|
6621
6621
|
var { theme, conf = (0, import_config.getConfig)(), context, fontFamily, staticConfig } = styleState, tokensParsed = conf.tokensParsed, valOrVar, hasSet = !1, customTokenAccept = staticConfig == null || (_staticConfig_accept = staticConfig.accept) === null || _staticConfig_accept === void 0 ? void 0 : _staticConfig_accept[key];
|
|
6622
6622
|
if (customTokenAccept) {
|
|
6623
6623
|
var _theme_value, val = (_theme_value = theme == null ? void 0 : theme[value]) !== null && _theme_value !== void 0 ? _theme_value : tokensParsed[customTokenAccept][value];
|
|
6624
6624
|
val != null && (resolveAs = "value", valOrVar = val, hasSet = !0);
|
|
6625
6625
|
}
|
|
6626
|
-
if (theme && value in theme)
|
|
6627
|
-
|
|
6626
|
+
if (theme && value in theme) {
|
|
6627
|
+
if (resolveAs === "except-theme") return value;
|
|
6628
|
+
valOrVar = theme[value], hasSet = !0;
|
|
6629
|
+
} else {
|
|
6628
6630
|
if (value in conf.specificTokens) hasSet = !0, valOrVar = conf.specificTokens[value];
|
|
6629
6631
|
else {
|
|
6630
6632
|
switch (key) {
|
|
@@ -7067,7 +7069,7 @@ var require_getSplitStyles_native = __commonJS({
|
|
|
7067
7069
|
}
|
|
7068
7070
|
});
|
|
7069
7071
|
};
|
|
7070
|
-
|
|
7072
|
+
conf = conf || (0, import_config.getConfig)(), import_constants4.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
|
|
7071
7073
|
var { shorthands } = conf, { isHOC, isText, isInput, variants, isReactNative, inlineProps, inlineWhenUnflattened, parentStaticConfig, acceptsClassName } = staticConfig, viewProps = {}, mediaState3 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants4.isWeb && !styleProps.noClass, rulesToInsert = void 0, classNames = {}, transforms = {}, pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, className = props.className || "", mediaStylesSeen = 0, validStyles = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? import_helpers.stylePropsText : import_helpers.validStyles), styleState = {
|
|
7072
7074
|
classNames,
|
|
7073
7075
|
conf,
|
|
@@ -7725,7 +7727,7 @@ var require_themeable_native = __commonJS({
|
|
|
7725
7727
|
module2.exports = __toCommonJS2(themeable_exports);
|
|
7726
7728
|
var import_jsx_runtime6 = require("react/jsx-runtime"), import_react3 = __toESM2(require("react")), import_Theme = require_Theme_native();
|
|
7727
7729
|
function themeable3(Component, staticConfig) {
|
|
7728
|
-
var
|
|
7730
|
+
var optimize = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, withThemeComponent = function(props, ref) {
|
|
7729
7731
|
var { themeInverse, theme, componentName, themeReset, ...rest } = props, overriddenContextProps, context = staticConfig == null ? void 0 : staticConfig.context;
|
|
7730
7732
|
if (context) for (var key in context.props) {
|
|
7731
7733
|
var val = props[key];
|
|
@@ -7738,10 +7740,8 @@ var require_themeable_native = __commonJS({
|
|
|
7738
7740
|
...rest,
|
|
7739
7741
|
"data-disable-theme": !0
|
|
7740
7742
|
})
|
|
7741
|
-
), filteredProps =
|
|
7742
|
-
|
|
7743
|
-
};
|
|
7744
|
-
"debug" in props && (filteredProps.debug = props.debug), "theme" in props && (filteredProps.name = props.theme), "themeInverse" in props && (filteredProps.inverse = props.themeInverse), "themeReset" in props && (filteredProps.reset = themeReset);
|
|
7743
|
+
), filteredProps = null, compName = componentName || (staticConfig == null ? void 0 : staticConfig.componentName);
|
|
7744
|
+
if (compName && (filteredProps || (filteredProps = {}), filteredProps.componentName = compName), "debug" in props && (filteredProps || (filteredProps = {}), filteredProps.debug = props.debug), "theme" in props && (filteredProps || (filteredProps = {}), filteredProps.name = props.theme), "themeInverse" in props && (filteredProps || (filteredProps = {}), filteredProps.inverse = props.themeInverse), "themeReset" in props && (filteredProps || (filteredProps = {}), filteredProps.reset = themeReset), optimize && !filteredProps) return element;
|
|
7745
7745
|
var contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Theme.Theme, {
|
|
7746
7746
|
"disable-child-theme": !0,
|
|
7747
7747
|
...filteredProps,
|
|
@@ -7756,8 +7756,8 @@ var require_themeable_native = __commonJS({
|
|
|
7756
7756
|
});
|
|
7757
7757
|
}
|
|
7758
7758
|
return contents;
|
|
7759
|
-
}
|
|
7760
|
-
return withTheme.displayName = `Themed(${(Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "Anonymous"})`, withTheme;
|
|
7759
|
+
}, withTheme = withThemeComponent;
|
|
7760
|
+
return withTheme.displayName = `Themed(${(Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "Anonymous"})`, optimize ? withTheme : /* @__PURE__ */ import_react3.default.forwardRef(withTheme);
|
|
7761
7761
|
}
|
|
7762
7762
|
}
|
|
7763
7763
|
});
|
|
@@ -8531,7 +8531,7 @@ var require_createComponent_native = __commonJS({
|
|
|
8531
8531
|
}
|
|
8532
8532
|
function styleable(Component2, options) {
|
|
8533
8533
|
var _Component_render, isForwardedRefAlready = ((_Component_render = Component2.render) === null || _Component_render === void 0 ? void 0 : _Component_render.length) === 2, out = isForwardedRefAlready ? Component2 : /* @__PURE__ */ import_react3.default.forwardRef(Component2), extendedConfig = extendStyledConfig(options == null ? void 0 : options.staticConfig);
|
|
8534
|
-
return out = options != null && options.disableTheme ? out : (0, import_themeable.themeable)(out, extendedConfig), process.env.TAMAGUI_MEMOIZE_STYLEABLE && (out = /* @__PURE__ */ import_react3.default.memo(out)), out.staticConfig = extendedConfig, out.styleable = styleable, out;
|
|
8534
|
+
return out = options != null && options.disableTheme ? out : (0, import_themeable.themeable)(out, extendedConfig, !0), process.env.TAMAGUI_MEMOIZE_STYLEABLE && (out = /* @__PURE__ */ import_react3.default.memo(out)), out.staticConfig = extendedConfig, out.styleable = styleable, out;
|
|
8535
8535
|
}
|
|
8536
8536
|
return res.extractable = extractable, res.styleable = styleable, res;
|
|
8537
8537
|
}
|
|
@@ -28655,80 +28655,20 @@ var require_useSwitch_native = __commonJS({
|
|
|
28655
28655
|
});
|
|
28656
28656
|
module2.exports = __toCommonJS2(useSwitch_exports);
|
|
28657
28657
|
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_label = require_index_native46(), import_use_previous = require_index_native47(), React4 = __toESM2(require("react"));
|
|
28658
|
-
function getState(checked) {
|
|
28659
|
-
return checked ? "checked" : "unchecked";
|
|
28660
|
-
}
|
|
28661
|
-
var BubbleInput = function(props) {
|
|
28662
|
-
var { control, checked, bubbles = !0, ...inputProps } = props, ref = React4.useRef(null), prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
28663
|
-
return React4.useEffect(function() {
|
|
28664
|
-
var input = ref.current, inputProto = window.HTMLInputElement.prototype, descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"), setChecked = descriptor.set;
|
|
28665
|
-
if (prevChecked !== checked && setChecked) {
|
|
28666
|
-
var event = new Event("click", {
|
|
28667
|
-
bubbles
|
|
28668
|
-
});
|
|
28669
|
-
setChecked.call(input, checked), input.dispatchEvent(event);
|
|
28670
|
-
}
|
|
28671
|
-
}, [
|
|
28672
|
-
prevChecked,
|
|
28673
|
-
checked,
|
|
28674
|
-
bubbles
|
|
28675
|
-
]), // @ts-ignore
|
|
28676
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", {
|
|
28677
|
-
type: "checkbox",
|
|
28678
|
-
"aria-hidden": !0,
|
|
28679
|
-
defaultChecked: checked,
|
|
28680
|
-
...inputProps,
|
|
28681
|
-
tabIndex: -1,
|
|
28682
|
-
ref,
|
|
28683
|
-
style: {
|
|
28684
|
-
...props.style,
|
|
28685
|
-
position: "absolute",
|
|
28686
|
-
pointerEvents: "none",
|
|
28687
|
-
opacity: 0,
|
|
28688
|
-
margin: 0
|
|
28689
|
-
}
|
|
28690
|
-
});
|
|
28691
|
-
};
|
|
28692
28658
|
function useSwitch(props, param, ref) {
|
|
28693
|
-
var [checked, setChecked] = param
|
|
28659
|
+
var [checked, setChecked] = param;
|
|
28694
28660
|
return {
|
|
28695
28661
|
switchProps: {
|
|
28696
|
-
|
|
28697
|
-
"aria-checked": checked,
|
|
28698
|
-
...import_constants4.isWeb ? {
|
|
28699
|
-
tabIndex: disabled ? void 0 : 0,
|
|
28700
|
-
"data-state": getState(checked),
|
|
28701
|
-
"data-disabled": disabled ? "" : void 0,
|
|
28702
|
-
disabled
|
|
28703
|
-
} : {},
|
|
28704
|
-
...props,
|
|
28705
|
-
"aria-labelledby": ariaLabelledBy,
|
|
28706
|
-
onPress: (0, import_helpers.composeEventHandlers)(props.onPress, function(event) {
|
|
28662
|
+
onPress() {
|
|
28707
28663
|
setChecked(function(prevChecked) {
|
|
28708
28664
|
return !prevChecked;
|
|
28709
|
-
})
|
|
28710
|
-
})
|
|
28711
|
-
},
|
|
28712
|
-
switchRef: composedRefs,
|
|
28713
|
-
/**
|
|
28714
|
-
* insert as a sibling of your switch (should not be inside the switch)
|
|
28715
|
-
*/
|
|
28716
|
-
bubbleInput: import_constants4.isWeb && isFormControl ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BubbleInput, {
|
|
28717
|
-
control: button,
|
|
28718
|
-
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
28719
|
-
name,
|
|
28720
|
-
value,
|
|
28721
|
-
checked,
|
|
28722
|
-
required,
|
|
28723
|
-
disabled,
|
|
28724
|
-
// We transform because the input is absolutely positioned but we have
|
|
28725
|
-
// rendered it **after** the button. This pulls it back to sit on top
|
|
28726
|
-
// of the button.
|
|
28727
|
-
style: {
|
|
28728
|
-
transform: "translateX(-100%)"
|
|
28665
|
+
});
|
|
28729
28666
|
}
|
|
28730
|
-
}
|
|
28667
|
+
},
|
|
28668
|
+
switchRef: ref,
|
|
28669
|
+
bubbleInput: null
|
|
28731
28670
|
};
|
|
28671
|
+
var disabled, name, value, required, hasConsumerStoppedPropagationRef, button, setButton, composedRefs, isFormControl, labelId, ariaLabelledBy;
|
|
28732
28672
|
}
|
|
28733
28673
|
}
|
|
28734
28674
|
});
|
|
@@ -29016,7 +28956,6 @@ var require_createSwitch_native = __commonJS({
|
|
|
29016
28956
|
},
|
|
29017
28957
|
alignSelf: initialChecked ? "flex-end" : "flex-start",
|
|
29018
28958
|
x,
|
|
29019
|
-
// TODO: remove ViewProps cast
|
|
29020
28959
|
onLayout: (0, import_core12.composeEventHandlers)(props.onLayout, function(e) {
|
|
29021
28960
|
return setThumbWidth(e.nativeEvent.layout.width);
|
|
29022
28961
|
}),
|
|
@@ -29031,17 +28970,9 @@ var require_createSwitch_native = __commonJS({
|
|
|
29031
28970
|
defaultProp: defaultChecked || !1,
|
|
29032
28971
|
onChange: onCheckedChange,
|
|
29033
28972
|
transition: !0
|
|
29034
|
-
}), styledContext = React4.useContext(import_StyledContext.SwitchStyledContext.context), [frameWidth, setFrameWidth] = React4.useState(0),
|
|
29035
|
-
noNormalize: !0,
|
|
29036
|
-
noExpand: !0,
|
|
29037
|
-
resolveValues: "none",
|
|
29038
|
-
forComponent: Frame
|
|
29039
|
-
}), _styledContext_size, _ref, _styledContext_unstyled, _ref1, { switchProps, bubbleInput, switchRef } = (0, import_switch_headless.useSwitch)(
|
|
28973
|
+
}), styledContext = React4.useContext(import_StyledContext.SwitchStyledContext.context), [frameWidth, setFrameWidth] = React4.useState(0), { switchProps, bubbleInput, switchRef } = (0, import_switch_headless.useSwitch)(
|
|
29040
28974
|
// @ts-ignore
|
|
29041
|
-
|
|
29042
|
-
size: (_ref = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref !== void 0 ? _ref : "$true",
|
|
29043
|
-
unstyled: (_ref1 = (_styledContext_unstyled = styledContext.unstyled) !== null && _styledContext_unstyled !== void 0 ? _styledContext_unstyled : props.unstyled) !== null && _ref1 !== void 0 ? _ref1 : !1
|
|
29044
|
-
}, propsActive),
|
|
28975
|
+
props,
|
|
29045
28976
|
[
|
|
29046
28977
|
checked,
|
|
29047
28978
|
setChecked
|
|
@@ -29051,8 +28982,8 @@ var require_createSwitch_native = __commonJS({
|
|
|
29051
28982
|
React4.useEffect(function() {
|
|
29052
28983
|
if (props.id && !props.disabled) return (0, import_focusable2.registerFocusable)(props.id, {
|
|
29053
28984
|
focusAndSelect: function() {
|
|
29054
|
-
setChecked == null || setChecked(function(
|
|
29055
|
-
return !
|
|
28985
|
+
setChecked == null || setChecked(function(value2) {
|
|
28986
|
+
return !value2;
|
|
29056
28987
|
});
|
|
29057
28988
|
},
|
|
29058
28989
|
focus: function() {
|
|
@@ -29063,16 +28994,28 @@ var require_createSwitch_native = __commonJS({
|
|
|
29063
28994
|
props.disabled
|
|
29064
28995
|
]);
|
|
29065
28996
|
var renderNative = (0, import_core12.shouldRenderNativePlatform)(native);
|
|
29066
|
-
|
|
28997
|
+
if (renderNative === "android" || renderNative === "ios") return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.Switch, {
|
|
29067
28998
|
value: checked,
|
|
29068
28999
|
onValueChange: setChecked,
|
|
29069
29000
|
...nativeProps
|
|
29070
|
-
})
|
|
29071
|
-
|
|
29001
|
+
});
|
|
29002
|
+
var disabled = props.disabled, value = React4.useMemo(function() {
|
|
29003
|
+
return {
|
|
29072
29004
|
checked,
|
|
29073
|
-
disabled
|
|
29005
|
+
disabled,
|
|
29074
29006
|
frameWidth
|
|
29075
|
-
}
|
|
29007
|
+
};
|
|
29008
|
+
}, [
|
|
29009
|
+
checked,
|
|
29010
|
+
disabled,
|
|
29011
|
+
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;
|
|
29017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(SwitchContext.Provider, {
|
|
29018
|
+
value,
|
|
29076
29019
|
children: [
|
|
29077
29020
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Frame, {
|
|
29078
29021
|
ref: switchRef,
|
|
@@ -29080,6 +29023,11 @@ var require_createSwitch_native = __commonJS({
|
|
|
29080
29023
|
...import_core12.isWeb && {
|
|
29081
29024
|
type: "button"
|
|
29082
29025
|
},
|
|
29026
|
+
...!unstyled && {
|
|
29027
|
+
size: (_ref1 = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref1 !== void 0 ? _ref1 : "$true"
|
|
29028
|
+
},
|
|
29029
|
+
unstyled,
|
|
29030
|
+
...props,
|
|
29083
29031
|
...switchProps,
|
|
29084
29032
|
...!disableActiveTheme && !props.unstyled && {
|
|
29085
29033
|
theme: checked ? "active" : null,
|
|
@@ -29087,14 +29035,11 @@ var require_createSwitch_native = __commonJS({
|
|
|
29087
29035
|
},
|
|
29088
29036
|
// expected variants
|
|
29089
29037
|
checked,
|
|
29090
|
-
disabled
|
|
29091
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
29092
|
-
|
|
29093
|
-
|
|
29094
|
-
|
|
29095
|
-
setFrameWidth(e.nativeEvent.layout.width);
|
|
29096
|
-
},
|
|
29097
|
-
children: switchProps.children
|
|
29038
|
+
disabled,
|
|
29039
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.View, {
|
|
29040
|
+
style: measureContainerStyle,
|
|
29041
|
+
onLayout: handleLayout,
|
|
29042
|
+
children: props.children
|
|
29098
29043
|
})
|
|
29099
29044
|
}),
|
|
29100
29045
|
bubbleInput
|
|
@@ -29107,6 +29052,10 @@ var require_createSwitch_native = __commonJS({
|
|
|
29107
29052
|
Thumb: SwitchThumbComponent
|
|
29108
29053
|
});
|
|
29109
29054
|
}
|
|
29055
|
+
var measureContainerStyle = {
|
|
29056
|
+
alignSelf: "stretch",
|
|
29057
|
+
flex: 1
|
|
29058
|
+
};
|
|
29110
29059
|
}
|
|
29111
29060
|
});
|
|
29112
29061
|
|