tamagui 1.82.1 → 1.82.2
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 +151 -140
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +151 -140
- package/dist/test.native.js.map +2 -2
- package/package.json +52 -52
package/dist/native.js
CHANGED
|
@@ -3409,7 +3409,7 @@ var require_getSplitStyles_native = __commonJS({
|
|
|
3409
3409
|
}), console.groupEnd());
|
|
3410
3410
|
for (let keyOg in props) {
|
|
3411
3411
|
let keyInit = keyOg, valInit = props[keyOg];
|
|
3412
|
-
if (styleProps.disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || keyInit in skipProps && !isHOC)
|
|
3412
|
+
if (styleProps.disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || keyInit in skipProps && !styleProps.noSkip && !isHOC)
|
|
3413
3413
|
continue;
|
|
3414
3414
|
let valInitType = typeof valInit, isValidStyleKeyInit = isValidStyleKey(keyInit, staticConfig);
|
|
3415
3415
|
if (styleState.curProps[keyInit] = valInit, !import_constants4.isAndroid && keyInit === "elevationAndroid")
|
|
@@ -3956,7 +3956,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
3956
3956
|
module2.exports = __toCommonJS2(ThemeManager_exports);
|
|
3957
3957
|
var import_constants4 = require_index_native(), import_config = require_config_native(), import_constants22 = require_constants_native2(), emptyState = { name: "" };
|
|
3958
3958
|
function getHasThemeUpdatingProps(props) {
|
|
3959
|
-
return props.name || props.componentName || props.inverse || props.reset;
|
|
3959
|
+
return !!(props.name || props.componentName || props.inverse || props.reset);
|
|
3960
3960
|
}
|
|
3961
3961
|
var uid = 0, ThemeManager = class {
|
|
3962
3962
|
constructor(props = {}, parentManager) {
|
|
@@ -4026,7 +4026,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4026
4026
|
let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
|
|
4027
4027
|
isDirectParentAComponentTheme && allComponentThemes.shift();
|
|
4028
4028
|
let base = baseName.split(import_constants22.THEME_NAME_SEPARATOR), max2 = base.length, min2 = props.componentName && !nextName ? max2 : 0;
|
|
4029
|
-
process.env.NODE_ENV !== "production" &&
|
|
4029
|
+
process.env.NODE_ENV !== "production" && props.debug && typeof window < "u" && (console.groupCollapsed("ThemeManager.getState()"), console.info({ props, baseName, base, min: min2, max: max2 }));
|
|
4030
4030
|
for (let i = max2; i >= min2; i--) {
|
|
4031
4031
|
let prefix = base.slice(0, i).join(import_constants22.THEME_NAME_SEPARATOR);
|
|
4032
4032
|
props.inverse && (prefix = inverseThemeName(prefix));
|
|
@@ -4036,16 +4036,18 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4036
4036
|
lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
|
|
4037
4037
|
}
|
|
4038
4038
|
if (componentName && !props.reset) {
|
|
4039
|
-
let componentPotentials = [];
|
|
4040
|
-
if (nextName) {
|
|
4041
|
-
let beforeSeparator =
|
|
4039
|
+
let baseLen = base.length, componentPotentials = [];
|
|
4040
|
+
if (nextName && baseLen > 1) {
|
|
4041
|
+
let beforeSeparator = base[0];
|
|
4042
4042
|
componentPotentials.push(`${beforeSeparator}_${nextName}_${componentName}`);
|
|
4043
4043
|
}
|
|
4044
4044
|
if (componentPotentials.push(`${prefix}_${componentName}`), nextName) {
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4045
|
+
if (i > baseLen) {
|
|
4046
|
+
let prefixLessOne = base.slice(0, i - 1).join(import_constants22.THEME_NAME_SEPARATOR);
|
|
4047
|
+
if (prefixLessOne) {
|
|
4048
|
+
let lessSpecific = `${prefixLessOne}_${nextName}_${componentName}`;
|
|
4049
|
+
componentPotentials.unshift(lessSpecific);
|
|
4050
|
+
}
|
|
4049
4051
|
}
|
|
4050
4052
|
let moreSpecific = `${prefix}_${nextName}_${componentName}`;
|
|
4051
4053
|
componentPotentials.unshift(moreSpecific);
|
|
@@ -4054,6 +4056,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4054
4056
|
}
|
|
4055
4057
|
let found = potentials.find((t) => t in themes);
|
|
4056
4058
|
if (process.env.NODE_ENV !== "production" && typeof props.debug == "string" && console.info(" getState ", {
|
|
4059
|
+
props,
|
|
4057
4060
|
found,
|
|
4058
4061
|
potentials,
|
|
4059
4062
|
baseManager,
|
|
@@ -4302,7 +4305,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4302
4305
|
}
|
|
4303
4306
|
let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse), mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
|
|
4304
4307
|
state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
|
|
4305
|
-
let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed ? !1 : null, response = {
|
|
4308
|
+
let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed != null ? !1 : null, response = {
|
|
4306
4309
|
themeManager: themeManager2,
|
|
4307
4310
|
isNewTheme: isNewTheme2,
|
|
4308
4311
|
mounted: mounted2,
|
|
@@ -4381,40 +4384,40 @@ var require_Theme_native = __commonJS({
|
|
|
4381
4384
|
)), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Theme_exports = {};
|
|
4382
4385
|
__export2(Theme_exports, {
|
|
4383
4386
|
Theme: () => Theme2,
|
|
4384
|
-
|
|
4387
|
+
getThemedChildren: () => getThemedChildren
|
|
4385
4388
|
});
|
|
4386
4389
|
module2.exports = __toCommonJS2(Theme_exports);
|
|
4387
|
-
var import_constants4 = require_index_native(), import_react2 = __toESM2(require("react")), import_createVariable = require_createVariable_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_useTheme = require_useTheme_native(), import_ThemeDebug = require_ThemeDebug_native(), import_jsx_runtime6 = require("react/jsx-runtime"), Theme2 = (0, import_react2.forwardRef)(function(props, ref) {
|
|
4390
|
+
var import_constants4 = require_index_native(), import_react2 = __toESM2(require("react")), import_createVariable = require_createVariable_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_useTheme = require_useTheme_native(), import_ThemeDebug = require_ThemeDebug_native(), import_jsx_runtime6 = require("react/jsx-runtime"), Theme2 = (0, import_react2.forwardRef)(function({ children, ...props }, ref) {
|
|
4388
4391
|
if (props.disable)
|
|
4389
|
-
return
|
|
4390
|
-
let isRoot = !!props._isRoot,
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
return process.env.NODE_ENV === "development" && props.debug === "visualize" && (children2 = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ThemeDebug.ThemeDebug, { themeState, themeProps: props, children: children2 })), children2;
|
|
4401
|
-
}, [props.children, disableDirectChildTheme]);
|
|
4402
|
-
return useThemedChildren(themeState, children, props, isRoot);
|
|
4392
|
+
return children;
|
|
4393
|
+
let isRoot = !!props._isRoot, themeState = (0, import_useTheme.useChangeThemeEffect)(props, isRoot), finalChildren = props["disable-child-theme"] ? import_react2.Children.map(
|
|
4394
|
+
children,
|
|
4395
|
+
(child) => (0, import_react2.cloneElement)(child, { "data-disable-theme": !0 })
|
|
4396
|
+
) : children;
|
|
4397
|
+
if (ref)
|
|
4398
|
+
try {
|
|
4399
|
+
import_react2.default.Children.only(finalChildren), finalChildren = (0, import_react2.cloneElement)(finalChildren, { ref });
|
|
4400
|
+
} catch {
|
|
4401
|
+
}
|
|
4402
|
+
return process.env.NODE_ENV === "development" && props.debug === "visualize" && (finalChildren = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ThemeDebug.ThemeDebug, { themeState, themeProps: props, children: finalChildren })), getThemedChildren(themeState, finalChildren, props, isRoot);
|
|
4403
4403
|
});
|
|
4404
4404
|
Theme2.displayName = "Theme";
|
|
4405
4405
|
Theme2.avoidForwardRef = !0;
|
|
4406
|
-
function
|
|
4407
|
-
let { themeManager, isNewTheme } = themeState
|
|
4408
|
-
if (
|
|
4406
|
+
function getThemedChildren(themeState, children, props, isRoot = !1) {
|
|
4407
|
+
let { themeManager, isNewTheme } = themeState;
|
|
4408
|
+
if (!themeManager)
|
|
4409
|
+
throw "\u274C";
|
|
4410
|
+
let { shallow, forceClassName } = props, hasEverThemed = (0, import_react2.useRef)(!1), shouldRenderChildrenWithTheme = isNewTheme || props.inverse || hasEverThemed.current || forceClassName || isRoot;
|
|
4411
|
+
if (shouldRenderChildrenWithTheme && (hasEverThemed.current = !0), !shouldRenderChildrenWithTheme)
|
|
4409
4412
|
return children;
|
|
4410
4413
|
let next = children;
|
|
4411
|
-
shallow &&
|
|
4414
|
+
shallow && (next = import_react2.Children.toArray(children).map((child) => (0, import_react2.isValidElement)(child) ? (0, import_react2.cloneElement)(
|
|
4412
4415
|
child,
|
|
4413
4416
|
void 0,
|
|
4414
4417
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Theme2, { name: themeManager.state.parentName, children: child.props.children })
|
|
4415
4418
|
) : child));
|
|
4416
|
-
let elementsWithContext =
|
|
4417
|
-
return forceClassName === !1 ? elementsWithContext : import_constants4.isWeb
|
|
4419
|
+
let elementsWithContext = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ThemeManagerContext.ThemeManagerContext.Provider, { value: themeManager, children: next });
|
|
4420
|
+
return forceClassName === !1 ? elementsWithContext : import_constants4.isWeb ? wrapThemeElements({
|
|
4418
4421
|
children: elementsWithContext,
|
|
4419
4422
|
themeState,
|
|
4420
4423
|
forceClassName,
|
|
@@ -4430,18 +4433,18 @@ var require_Theme_native = __commonJS({
|
|
|
4430
4433
|
var _a;
|
|
4431
4434
|
if (isRoot && forceClassName === !1)
|
|
4432
4435
|
return children;
|
|
4433
|
-
let inverse = themeState.inversed, requiresExtraWrapper = inverse != null || forceClassName;
|
|
4434
|
-
if (!themeState.isNewTheme && !requiresExtraWrapper)
|
|
4435
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "_dsp_contents is_Theme", children });
|
|
4436
|
-
let { className, style } = getThemeClassNameAndStyle(themeState, isRoot), themedChildren = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: `${className} _dsp_contents is_Theme`, style, children });
|
|
4436
|
+
let inverse = themeState.inversed, requiresExtraWrapper = inverse != null || forceClassName, { className, style } = getThemeClassNameAndStyle(themeState, isRoot), themedChildren = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: `${className} _dsp_contents is_Theme`, style, children });
|
|
4437
4437
|
if (requiresExtraWrapper) {
|
|
4438
4438
|
let name = ((_a = themeState.state) == null ? void 0 : _a.name) || "", inverseClassName = name.startsWith("light") ? "t_light is_inversed" : name.startsWith("dark") ? "t_dark is_inversed" : "";
|
|
4439
4439
|
themedChildren = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: `${inverse ? inverseClassName : ""} _dsp_contents`, children: themedChildren });
|
|
4440
4440
|
}
|
|
4441
4441
|
return themedChildren;
|
|
4442
4442
|
}
|
|
4443
|
+
var emptyObj = {};
|
|
4443
4444
|
function getThemeClassNameAndStyle(themeState, isRoot = !1) {
|
|
4444
4445
|
var _a, _b;
|
|
4446
|
+
if (!themeState.isNewTheme)
|
|
4447
|
+
return { className: "", style: emptyObj };
|
|
4445
4448
|
let themeColor = (_a = themeState.state) != null && _a.theme && themeState.isNewTheme ? (0, import_createVariable.variableToString)(themeState.state.theme.color) : "", style = themeColor ? {
|
|
4446
4449
|
color: themeColor
|
|
4447
4450
|
} : void 0, className = ((_b = themeState.state) == null ? void 0 : _b.className) || "";
|
|
@@ -4467,7 +4470,10 @@ var require_themeable_native = __commonJS({
|
|
|
4467
4470
|
themeable: () => themeable3
|
|
4468
4471
|
});
|
|
4469
4472
|
module2.exports = __toCommonJS2(themeable_exports);
|
|
4470
|
-
var import_react2 = require("react"), import_Theme = require_Theme_native(), import_jsx_runtime6 =
|
|
4473
|
+
var import_react2 = require("react"), import_Theme = require_Theme_native(), import_jsx_runtime6 = (
|
|
4474
|
+
// @ts-expect-error its ok
|
|
4475
|
+
require("react/jsx-runtime")
|
|
4476
|
+
);
|
|
4471
4477
|
function themeable3(Component, staticConfig) {
|
|
4472
4478
|
let withTheme = (0, import_react2.forwardRef)(function(props, ref) {
|
|
4473
4479
|
let { themeInverse, theme, componentName, themeReset, ...rest } = props, element = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Component, { ref, ...rest, "data-disable-theme": !0 });
|
|
@@ -4745,7 +4751,7 @@ var require_createComponent_native = __commonJS({
|
|
|
4745
4751
|
isEntering && enterVariant ? (process.env.NODE_ENV === "development" && debugProp === "verbose" && console.warn(`Animating presence ENTER "${enterVariant}"`), props[enterVariant] = !0) : isExiting2 && exitVariant && (process.env.NODE_ENV === "development" && debugProp === "verbose" && console.warn(`Animating presence EXIT "${enterVariant}"`), props[exitVariant] = !enterExitVariant);
|
|
4746
4752
|
}
|
|
4747
4753
|
}
|
|
4748
|
-
let isAnimatedReactNative = hasAnimationProp && (animationsConfig == null ? void 0 : animationsConfig.isReactNative), isReactNative = !!(staticConfig.isReactNative || isAnimatedReactNative), shouldAvoidClasses = !!(!import_constants4.isWeb || isAnimated || !staticConfig.acceptsClassName || propsIn.disableClassName), shouldForcePseudo = !!propsIn.forceStyle, noClassNames = shouldAvoidClasses || shouldForcePseudo,
|
|
4754
|
+
let isAnimatedReactNative = hasAnimationProp && (animationsConfig == null ? void 0 : animationsConfig.isReactNative), isReactNative = !!(staticConfig.isReactNative || isAnimatedReactNative), shouldAvoidClasses = !!(!import_constants4.isWeb || isAnimated || !staticConfig.acceptsClassName || propsIn.disableClassName), shouldForcePseudo = !!propsIn.forceStyle, noClassNames = shouldAvoidClasses || shouldForcePseudo, disableTheme = isHOC;
|
|
4749
4755
|
process.env.NODE_ENV === "development" && time && time`theme-props`, props.themeShallow && (stateRef.current.themeShallow = !0);
|
|
4750
4756
|
let themeStateProps = {
|
|
4751
4757
|
name: props.theme,
|
|
@@ -5038,7 +5044,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
5038
5044
|
subscribe: groupState.subscribe
|
|
5039
5045
|
};
|
|
5040
5046
|
}, [groupName]);
|
|
5041
|
-
if (groupName && subGroupContext && (content = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ComponentContext.ComponentContext.Provider, { ...componentContext, groups: subGroupContext, children: content })), process.env.NODE_ENV === "development" && time && time`group-context`, content =
|
|
5047
|
+
if (groupName && subGroupContext && (content = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ComponentContext.ComponentContext.Provider, { ...componentContext, groups: subGroupContext, children: content })), process.env.NODE_ENV === "development" && time && time`group-context`, content = disableTheme ? content : (0, import_Theme.getThemedChildren)(themeState, content, themeStateProps, !1), process.env.NODE_ENV === "development" && time && time`themed-children`, process.env.NODE_ENV === "development" && props.debug === "visualize" && (content = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ThemeDebug.ThemeDebug, { themeState, themeProps: props, children: content })), staticConfig.context) {
|
|
5042
5048
|
let contextProps = staticConfig.context.props;
|
|
5043
5049
|
for (let key in contextProps)
|
|
5044
5050
|
(key in style || key in viewProps) && (overriddenContextProps ||= {}, overriddenContextProps[key] = style[key] ?? viewProps[key]);
|
|
@@ -15526,7 +15532,7 @@ var require_Popover_native = __commonJS({
|
|
|
15526
15532
|
context,
|
|
15527
15533
|
children: props.children
|
|
15528
15534
|
}
|
|
15529
|
-
)), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_portal2.Portal, { zIndex, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core13.Theme, { name: themeName, children: [
|
|
15535
|
+
)), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_portal2.Portal, { zIndex, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core13.Theme, { forceClassName: !0, name: themeName, children: [
|
|
15530
15536
|
!!context.open && !context.breakpointActive && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
15531
15537
|
import_stacks3.YStack,
|
|
15532
15538
|
{
|
|
@@ -18011,107 +18017,112 @@ var require_createSwitch_native = __commonJS({
|
|
|
18011
18017
|
ref: forwardedRef
|
|
18012
18018
|
}
|
|
18013
18019
|
);
|
|
18014
|
-
}), SwitchComponent = Frame.styleable(
|
|
18015
|
-
|
|
18016
|
-
|
|
18017
|
-
|
|
18018
|
-
|
|
18019
|
-
|
|
18020
|
-
|
|
18021
|
-
|
|
18022
|
-
|
|
18023
|
-
|
|
18024
|
-
|
|
18025
|
-
|
|
18026
|
-
|
|
18027
|
-
|
|
18028
|
-
|
|
18029
|
-
|
|
18030
|
-
|
|
18031
|
-
|
|
18032
|
-
|
|
18033
|
-
|
|
18034
|
-
|
|
18035
|
-
|
|
18036
|
-
|
|
18037
|
-
|
|
18038
|
-
|
|
18039
|
-
|
|
18040
|
-
|
|
18041
|
-
|
|
18042
|
-
|
|
18043
|
-
|
|
18044
|
-
|
|
18045
|
-
|
|
18046
|
-
|
|
18047
|
-
|
|
18048
|
-
|
|
18049
|
-
);
|
|
18050
|
-
import_constants4.isWeb || React2.useEffect(() => {
|
|
18051
|
-
if (props.id)
|
|
18052
|
-
return (0, import_focusable2.registerFocusable)(props.id, {
|
|
18053
|
-
focus: () => {
|
|
18054
|
-
setChecked((x) => !x);
|
|
18020
|
+
}), SwitchComponent = Frame.styleable(
|
|
18021
|
+
function(propsIn, forwardedRef) {
|
|
18022
|
+
let styledContext = React2.useContext(import_SwitchContext.SwitchContext), props = (0, import_core13.useProps)(propsIn, {
|
|
18023
|
+
noNormalize: !0,
|
|
18024
|
+
noExpand: !0,
|
|
18025
|
+
resolveValues: "none",
|
|
18026
|
+
forComponent: Frame
|
|
18027
|
+
}), {
|
|
18028
|
+
labeledBy: ariaLabelledby,
|
|
18029
|
+
name,
|
|
18030
|
+
checked: checkedProp,
|
|
18031
|
+
defaultChecked,
|
|
18032
|
+
required,
|
|
18033
|
+
disabled,
|
|
18034
|
+
value = "on",
|
|
18035
|
+
onCheckedChange,
|
|
18036
|
+
size: size2 = styledContext.size ?? "$true",
|
|
18037
|
+
unstyled = styledContext.unstyled ?? !1,
|
|
18038
|
+
native: nativeProp,
|
|
18039
|
+
nativeProps,
|
|
18040
|
+
children,
|
|
18041
|
+
...switchProps
|
|
18042
|
+
} = props, native = Array.isArray(nativeProp) ? nativeProp : [nativeProp], shouldRenderMobileNative = !import_constants4.isWeb && nativeProp === !0 || !import_constants4.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, setButton), labelId = (0, import_label.useLabelContext)(button), labelledBy = ariaLabelledby || labelId, hasConsumerStoppedPropagationRef = React2.useRef(!1), isFormControl = import_constants4.isWeb ? button ? !!button.closest("form") : !0 : !1, [frameWidth, setFrameWidth] = React2.useState(0), [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
18043
|
+
prop: checkedProp,
|
|
18044
|
+
defaultProp: defaultChecked || !1,
|
|
18045
|
+
onChange: onCheckedChange,
|
|
18046
|
+
transition: !0
|
|
18047
|
+
});
|
|
18048
|
+
if (shouldRenderMobileNative)
|
|
18049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18050
|
+
import_react_native4.Switch,
|
|
18051
|
+
{
|
|
18052
|
+
value: checkedProp,
|
|
18053
|
+
onValueChange: onCheckedChange,
|
|
18054
|
+
...nativeProps
|
|
18055
18055
|
}
|
|
18056
|
-
|
|
18057
|
-
|
|
18058
|
-
|
|
18059
|
-
|
|
18060
|
-
|
|
18061
|
-
|
|
18062
|
-
{
|
|
18063
|
-
tag: isInsideButton ? "span" : "button",
|
|
18064
|
-
unstyled,
|
|
18065
|
-
size: size2,
|
|
18066
|
-
checked,
|
|
18067
|
-
disabled,
|
|
18068
|
-
frameWidth,
|
|
18069
|
-
themeShallow: !0,
|
|
18070
|
-
...!disableActiveTheme && {
|
|
18071
|
-
theme: checked ? "active" : null,
|
|
18072
|
-
themeShallow: !0
|
|
18073
|
-
},
|
|
18074
|
-
role: "switch",
|
|
18075
|
-
"aria-checked": checked,
|
|
18076
|
-
"aria-labelledby": labelledBy,
|
|
18077
|
-
"aria-required": required,
|
|
18078
|
-
"data-state": getState(checked),
|
|
18079
|
-
"data-disabled": disabled ? "" : void 0,
|
|
18080
|
-
tabIndex: disabled ? void 0 : 0,
|
|
18081
|
-
value,
|
|
18082
|
-
...switchProps,
|
|
18083
|
-
ref: composedRefs,
|
|
18084
|
-
onPress: (0, import_helpers.composeEventHandlers)(props.onPress, (event) => {
|
|
18085
|
-
setChecked((prevChecked) => !prevChecked), import_constants4.isWeb && isFormControl && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
18086
|
-
}),
|
|
18087
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18088
|
-
import_stacks3.YStack,
|
|
18089
|
-
{
|
|
18090
|
-
alignSelf: "stretch",
|
|
18091
|
-
flex: 1,
|
|
18092
|
-
onLayout: (e) => {
|
|
18093
|
-
setFrameWidth(e.nativeEvent.layout.width);
|
|
18094
|
-
},
|
|
18095
|
-
children: typeof children == "function" ? children(checked) : children
|
|
18056
|
+
);
|
|
18057
|
+
import_constants4.isWeb || React2.useEffect(() => {
|
|
18058
|
+
if (props.id)
|
|
18059
|
+
return (0, import_focusable2.registerFocusable)(props.id, {
|
|
18060
|
+
focus: () => {
|
|
18061
|
+
setChecked((x) => !x);
|
|
18096
18062
|
}
|
|
18097
|
-
)
|
|
18098
|
-
|
|
18099
|
-
|
|
18100
|
-
|
|
18101
|
-
|
|
18102
|
-
|
|
18103
|
-
|
|
18104
|
-
|
|
18105
|
-
|
|
18106
|
-
|
|
18107
|
-
|
|
18108
|
-
|
|
18109
|
-
|
|
18110
|
-
|
|
18111
|
-
|
|
18112
|
-
|
|
18113
|
-
|
|
18114
|
-
|
|
18063
|
+
});
|
|
18064
|
+
}, [props.id, setChecked]);
|
|
18065
|
+
let isInsideButton = React2.useContext(import_stacks3.ButtonNestingContext);
|
|
18066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
18067
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_stacks3.ButtonNestingContext.Provider, { value: !0, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18068
|
+
Frame,
|
|
18069
|
+
{
|
|
18070
|
+
tag: isInsideButton ? "span" : "button",
|
|
18071
|
+
unstyled,
|
|
18072
|
+
size: size2,
|
|
18073
|
+
checked,
|
|
18074
|
+
disabled,
|
|
18075
|
+
frameWidth,
|
|
18076
|
+
themeShallow: !0,
|
|
18077
|
+
...!disableActiveTheme && {
|
|
18078
|
+
theme: checked ? "active" : null,
|
|
18079
|
+
themeShallow: !0
|
|
18080
|
+
},
|
|
18081
|
+
role: "switch",
|
|
18082
|
+
"aria-checked": checked,
|
|
18083
|
+
"aria-labelledby": labelledBy,
|
|
18084
|
+
"aria-required": required,
|
|
18085
|
+
"data-state": getState(checked),
|
|
18086
|
+
"data-disabled": disabled ? "" : void 0,
|
|
18087
|
+
tabIndex: disabled ? void 0 : 0,
|
|
18088
|
+
value,
|
|
18089
|
+
...switchProps,
|
|
18090
|
+
ref: composedRefs,
|
|
18091
|
+
onPress: (0, import_helpers.composeEventHandlers)(props.onPress, (event) => {
|
|
18092
|
+
setChecked((prevChecked) => !prevChecked), import_constants4.isWeb && isFormControl && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
18093
|
+
}),
|
|
18094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18095
|
+
import_stacks3.YStack,
|
|
18096
|
+
{
|
|
18097
|
+
alignSelf: "stretch",
|
|
18098
|
+
flex: 1,
|
|
18099
|
+
onLayout: (e) => {
|
|
18100
|
+
setFrameWidth(e.nativeEvent.layout.width);
|
|
18101
|
+
},
|
|
18102
|
+
children: typeof children == "function" ? children(checked) : children
|
|
18103
|
+
}
|
|
18104
|
+
)
|
|
18105
|
+
}
|
|
18106
|
+
) }),
|
|
18107
|
+
import_constants4.isWeb && isFormControl && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18108
|
+
BubbleInput,
|
|
18109
|
+
{
|
|
18110
|
+
control: button,
|
|
18111
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
18112
|
+
name,
|
|
18113
|
+
value,
|
|
18114
|
+
checked,
|
|
18115
|
+
required,
|
|
18116
|
+
disabled,
|
|
18117
|
+
style: { transform: "translateX(-100%)" }
|
|
18118
|
+
}
|
|
18119
|
+
)
|
|
18120
|
+
] });
|
|
18121
|
+
},
|
|
18122
|
+
{
|
|
18123
|
+
disableTheme: !0
|
|
18124
|
+
}
|
|
18125
|
+
), BubbleInput = (props) => {
|
|
18115
18126
|
let { control, checked, bubbles = !0, ...inputProps } = props, ref = React2.useRef(null), prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
18116
18127
|
return React2.useEffect(() => {
|
|
18117
18128
|
let input = ref.current, inputProto = window.HTMLInputElement.prototype, setChecked = Object.getOwnPropertyDescriptor(
|