@tamagui/switch 1.89.26 → 1.89.27-1708113113238

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.
@@ -1,125 +1,203 @@
1
- import {
2
- Stack,
3
- composeEventHandlers,
4
- isWeb,
5
- shouldRenderNativePlatform,
6
- useProps,
7
- withStaticProperties
8
- } from "@tamagui/core";
1
+ import { Stack, composeEventHandlers, isWeb, shouldRenderNativePlatform, useProps, withStaticProperties } from "@tamagui/core";
9
2
  import { useSwitch } from "@tamagui/switch-headless";
10
3
  import { useControllableState } from "@tamagui/use-controllable-state";
11
4
  import * as React from "react";
12
5
  import { Switch as NativeSwitch } from "react-native";
13
6
  import { SwitchStyledContext } from "./StyledContext";
14
7
  import { SwitchFrame as DefaultSwitchFrame, SwitchThumb } from "./Switch";
15
- import { jsx, jsxs } from "react/jsx-runtime";
16
- const SwitchContext = React.createContext({
8
+ function _array_like_to_array(arr, len) {
9
+ (len == null || len > arr.length) && (len = arr.length);
10
+ for (var i = 0, arr2 = new Array(len); i < len; i++)
11
+ arr2[i] = arr[i];
12
+ return arr2;
13
+ }
14
+ function _array_with_holes(arr) {
15
+ if (Array.isArray(arr))
16
+ return arr;
17
+ }
18
+ function _define_property(obj, key, value) {
19
+ return key in obj ? Object.defineProperty(obj, key, {
20
+ value,
21
+ enumerable: !0,
22
+ configurable: !0,
23
+ writable: !0
24
+ }) : obj[key] = value, obj;
25
+ }
26
+ function _iterable_to_array_limit(arr, i) {
27
+ var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
28
+ if (_i != null) {
29
+ var _arr = [], _n = !0, _d = !1, _s, _e;
30
+ try {
31
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
32
+ ;
33
+ } catch (err) {
34
+ _d = !0, _e = err;
35
+ } finally {
36
+ try {
37
+ !_n && _i.return != null && _i.return();
38
+ } finally {
39
+ if (_d)
40
+ throw _e;
41
+ }
42
+ }
43
+ return _arr;
44
+ }
45
+ }
46
+ function _non_iterable_rest() {
47
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
48
+ }
49
+ function _object_spread(target) {
50
+ for (var i = 1; i < arguments.length; i++) {
51
+ var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
52
+ typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
53
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
54
+ }))), ownKeys2.forEach(function(key) {
55
+ _define_property(target, key, source[key]);
56
+ });
57
+ }
58
+ return target;
59
+ }
60
+ function ownKeys(object, enumerableOnly) {
61
+ var keys = Object.keys(object);
62
+ if (Object.getOwnPropertySymbols) {
63
+ var symbols = Object.getOwnPropertySymbols(object);
64
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
65
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
66
+ })), keys.push.apply(keys, symbols);
67
+ }
68
+ return keys;
69
+ }
70
+ function _object_spread_props(target, source) {
71
+ return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
72
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
73
+ }), target;
74
+ }
75
+ function _object_without_properties(source, excluded) {
76
+ if (source == null)
77
+ return {};
78
+ var target = _object_without_properties_loose(source, excluded), key, i;
79
+ if (Object.getOwnPropertySymbols) {
80
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
81
+ for (i = 0; i < sourceSymbolKeys.length; i++)
82
+ key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
83
+ }
84
+ return target;
85
+ }
86
+ function _object_without_properties_loose(source, excluded) {
87
+ if (source == null)
88
+ return {};
89
+ var target = {}, sourceKeys = Object.keys(source), key, i;
90
+ for (i = 0; i < sourceKeys.length; i++)
91
+ key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
92
+ return target;
93
+ }
94
+ function _sliced_to_array(arr, i) {
95
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
96
+ }
97
+ function _unsupported_iterable_to_array(o, minLen) {
98
+ if (o) {
99
+ if (typeof o == "string")
100
+ return _array_like_to_array(o, minLen);
101
+ var n = Object.prototype.toString.call(o).slice(8, -1);
102
+ if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
103
+ return Array.from(n);
104
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
105
+ return _array_like_to_array(o, minLen);
106
+ }
107
+ }
108
+ var SwitchContext = /* @__PURE__ */ React.createContext({
17
109
  checked: !1,
18
110
  disabled: !1,
19
111
  frameWidth: 0
20
112
  });
21
113
  function createSwitch(createProps) {
22
- const {
23
- disableActiveTheme,
24
- Frame = DefaultSwitchFrame,
25
- Thumb = SwitchThumb
26
- } = createProps;
27
- process.env.NODE_ENV === "development" && (Frame !== DefaultSwitchFrame && Frame.staticConfig.context || Thumb !== SwitchThumb && Thumb.staticConfig.context) && console.warn(
28
- "Warning: createSwitch() needs to control context to pass checked state from Frame to Thumb, any custom context passed will be overridden."
29
- ), Frame.staticConfig.context = SwitchStyledContext, Thumb.staticConfig.context = SwitchStyledContext;
30
- const SwitchThumbComponent = Thumb.styleable(
31
- function(props, forwardedRef) {
32
- const { size: sizeProp, unstyled: unstyledProp, nativeID, ...thumbProps } = props, context = React.useContext(SwitchContext), { checked, disabled, frameWidth } = context, styledContext = SwitchStyledContext.useStyledContext(), { unstyled: unstyledContext, size: sizeContext } = styledContext, unstyled = process.env.TAMAGUI_HEADLESS === "1" ? !0 : unstyledProp ?? unstyledContext ?? !1, size = sizeProp ?? sizeContext ?? "$true", initialChecked = React.useRef(checked).current, [thumbWidth, setThumbWidth] = React.useState(0), distance = frameWidth - thumbWidth, x = initialChecked ? checked ? 0 : -distance : checked ? distance : 0;
33
- return /* @__PURE__ */ jsx(
34
- Thumb,
35
- {
36
- ref: forwardedRef,
37
- unstyled,
38
- ...unstyled === !1 && {
39
- size,
40
- ...!disableActiveTheme && {
41
- theme: checked ? "active" : null
42
- }
43
- },
44
- alignSelf: initialChecked ? "flex-end" : "flex-start",
45
- x,
46
- onLayout: composeEventHandlers(
47
- props.onLayout,
48
- (e) => setThumbWidth(e.nativeEvent.layout.width)
49
- ),
50
- checked,
51
- disabled,
52
- ...thumbProps
53
- }
54
- );
55
- }
56
- ), SwitchComponent = Frame.styleable(
57
- function(_props, forwardedRef) {
58
- const {
59
- native,
60
- nativeProps,
61
- checked: checkedProp,
62
- defaultChecked,
63
- onCheckedChange,
64
- ...props
65
- } = _props, [checked, setChecked] = useControllableState({
66
- prop: checkedProp,
67
- defaultProp: defaultChecked || !1,
68
- onChange: onCheckedChange,
69
- transition: !0
70
- }), styledContext = React.useContext(SwitchStyledContext.context), [frameWidth, setFrameWidth] = React.useState(0), propsActive = useProps(props, {
71
- noNormalize: !0,
72
- noExpand: !0,
73
- resolveValues: "none",
74
- forComponent: Frame
75
- });
76
- propsActive.size = styledContext.size ?? props.size ?? "$true", propsActive.unstyled = styledContext.unstyled ?? props.unstyled ?? !1;
77
- const { switchProps, bubbleInput, switchRef } = useSwitch(
78
- // @ts-ignore
79
- propsActive,
80
- [checked, setChecked],
81
- forwardedRef
82
- ), renderNative = shouldRenderNativePlatform(native);
83
- return renderNative === "android" || renderNative === "ios" ? /* @__PURE__ */ jsx(NativeSwitch, { value: checked, onValueChange: setChecked, ...nativeProps }) : /* @__PURE__ */ jsxs(
84
- SwitchContext.Provider,
85
- {
86
- value: { checked, disabled: switchProps.disabled, frameWidth },
87
- children: [
88
- /* @__PURE__ */ jsx(
89
- Frame,
90
- {
91
- ref: switchRef,
92
- tag: "button",
93
- ...isWeb && { type: "button" },
94
- ...switchProps,
95
- ...!disableActiveTheme && {
96
- theme: checked ? "active" : null,
97
- themeShallow: !0
98
- },
99
- checked,
100
- disabled: switchProps.disabled,
101
- children: /* @__PURE__ */ jsx(
102
- Stack,
103
- {
104
- alignSelf: "stretch",
105
- flex: 1,
106
- onLayout: (e) => {
107
- setFrameWidth(e.nativeEvent.layout.width);
108
- },
109
- children: switchProps.children
110
- }
111
- )
112
- }
113
- ),
114
- bubbleInput
115
- ]
116
- }
117
- );
118
- },
119
- {
120
- disableTheme: !0
121
- }
122
- );
114
+ var disableActiveTheme = createProps.disableActiveTheme, _createProps_Frame = createProps.Frame, Frame = _createProps_Frame === void 0 ? DefaultSwitchFrame : _createProps_Frame, _createProps_Thumb = createProps.Thumb, Thumb = _createProps_Thumb === void 0 ? SwitchThumb : _createProps_Thumb;
115
+ process.env.NODE_ENV === "development" && (Frame !== DefaultSwitchFrame && Frame.staticConfig.context || Thumb !== SwitchThumb && Thumb.staticConfig.context) && console.warn("Warning: createSwitch() needs to control context to pass checked state from Frame to Thumb, any custom context passed will be overridden."), Frame.staticConfig.context = SwitchStyledContext, Thumb.staticConfig.context = SwitchStyledContext;
116
+ var SwitchThumbComponent = Thumb.styleable(function(props, forwardedRef) {
117
+ var sizeProp = props.size, unstyledProp = props.unstyled, nativeID = props.nativeID, thumbProps = _object_without_properties(props, [
118
+ "size",
119
+ "unstyled",
120
+ "nativeID"
121
+ ]), context = React.useContext(SwitchContext), checked = context.checked, disabled = context.disabled, frameWidth = context.frameWidth, styledContext = SwitchStyledContext.useStyledContext(), unstyledContext = styledContext.unstyled, sizeContext = styledContext.size, _ref, unstyled = process.env.TAMAGUI_HEADLESS === "1" ? !0 : (_ref = unstyledProp ?? unstyledContext) !== null && _ref !== void 0 ? _ref : !1, _ref1, size = (_ref1 = sizeProp ?? sizeContext) !== null && _ref1 !== void 0 ? _ref1 : "$true", initialChecked = React.useRef(checked).current, _React_useState = _sliced_to_array(React.useState(0), 2), thumbWidth = _React_useState[0], setThumbWidth = _React_useState[1], distance = frameWidth - thumbWidth, x = initialChecked ? checked ? 0 : -distance : checked ? distance : 0;
122
+ return /* @__PURE__ */ React.createElement(Thumb, _object_spread(_object_spread_props(_object_spread({
123
+ ref: forwardedRef,
124
+ unstyled
125
+ }, unstyled === !1 && _object_spread({
126
+ size
127
+ }, !disableActiveTheme && {
128
+ theme: checked ? "active" : null
129
+ })), {
130
+ alignSelf: initialChecked ? "flex-end" : "flex-start",
131
+ x,
132
+ // TODO: remove ViewProps cast
133
+ onLayout: composeEventHandlers(props.onLayout, function(e) {
134
+ return setThumbWidth(e.nativeEvent.layout.width);
135
+ }),
136
+ // expected variants
137
+ checked,
138
+ disabled
139
+ }), thumbProps));
140
+ }), SwitchComponent = Frame.styleable(function(_props, forwardedRef) {
141
+ var native = _props.native, nativeProps = _props.nativeProps, checkedProp = _props.checked, defaultChecked = _props.defaultChecked, onCheckedChange = _props.onCheckedChange, props = _object_without_properties(_props, [
142
+ "native",
143
+ "nativeProps",
144
+ "checked",
145
+ "defaultChecked",
146
+ "onCheckedChange"
147
+ ]), _useControllableState = _sliced_to_array(useControllableState({
148
+ prop: checkedProp,
149
+ defaultProp: defaultChecked || !1,
150
+ onChange: onCheckedChange,
151
+ transition: !0
152
+ }), 2), checked = _useControllableState[0], setChecked = _useControllableState[1], styledContext = React.useContext(SwitchStyledContext.context), _React_useState = _sliced_to_array(React.useState(0), 2), frameWidth = _React_useState[0], setFrameWidth = _React_useState[1], propsActive = useProps(props, {
153
+ noNormalize: !0,
154
+ noExpand: !0,
155
+ resolveValues: "none",
156
+ forComponent: Frame
157
+ }), _styledContext_size, _ref;
158
+ propsActive.size = (_ref = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref !== void 0 ? _ref : "$true";
159
+ var _styledContext_unstyled, _ref1;
160
+ propsActive.unstyled = (_ref1 = (_styledContext_unstyled = styledContext.unstyled) !== null && _styledContext_unstyled !== void 0 ? _styledContext_unstyled : props.unstyled) !== null && _ref1 !== void 0 ? _ref1 : !1;
161
+ var _useSwitch = useSwitch(
162
+ // @ts-ignore
163
+ propsActive,
164
+ [
165
+ checked,
166
+ setChecked
167
+ ],
168
+ forwardedRef
169
+ ), switchProps = _useSwitch.switchProps, bubbleInput = _useSwitch.bubbleInput, switchRef = _useSwitch.switchRef, renderNative = shouldRenderNativePlatform(native);
170
+ return renderNative === "android" || renderNative === "ios" ? /* @__PURE__ */ React.createElement(NativeSwitch, _object_spread({
171
+ value: checked,
172
+ onValueChange: setChecked
173
+ }, nativeProps)) : /* @__PURE__ */ React.createElement(SwitchContext.Provider, {
174
+ value: {
175
+ checked,
176
+ disabled: switchProps.disabled,
177
+ frameWidth
178
+ }
179
+ }, /* @__PURE__ */ React.createElement(Frame, _object_spread_props(_object_spread({
180
+ ref: switchRef,
181
+ tag: "button"
182
+ }, isWeb && {
183
+ type: "button"
184
+ }, switchProps, !disableActiveTheme && {
185
+ theme: checked ? "active" : null,
186
+ themeShallow: !0
187
+ }), {
188
+ // expected variants
189
+ checked,
190
+ disabled: switchProps.disabled
191
+ }), /* @__PURE__ */ React.createElement(Stack, {
192
+ alignSelf: "stretch",
193
+ flex: 1,
194
+ onLayout: function(e) {
195
+ setFrameWidth(e.nativeEvent.layout.width);
196
+ }
197
+ }, switchProps.children)), bubbleInput);
198
+ }, {
199
+ disableTheme: !0
200
+ });
123
201
  return withStaticProperties(SwitchComponent, {
124
202
  Thumb: SwitchThumbComponent
125
203
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/createSwitch.tsx"],
4
- "mappings": "AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,YAAY,WAAW;AAEvB,SAAS,U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AA2B7E,WAA3B6E,aAAaC,YAAc9E,WAAd8E,WAO5BC,eAAelF,2BAA2B+D,MAAAA;AAChD,WAAImB,iBAAiB,aAAaA,iBAAiB,QAE/C,sBAAA,cAAC3E,cAAAA,eAAAA;MAAa4E,OAAOrE;MAASsE,eAAeZ;OAAgBR,WAAAA,CAAAA,IAK/D,sBAAA,cAACpD,cAAcyE,UAAQ;MACrBF,OAAO;QAAErE;QAASC,UAAUgE,YAAYhE;QAAUC;MAAW;OAE7D,sBAAA,cAACI,OAAAA,qBAAAA,eAAAA;MACCiC,KAAK4B;MACLK,KAAI;OACCvF,SAAS;MAAEwF,MAAM;IAAS,GAC1BR,aACA,CAAC5D,sBAAsB;MAC1BmC,OAAOxC,UAAU,WAAW;MAC5B0E,cAAc;IAChB,CAAA,GAAA;;MAEA1E;MACAC,UAAUgE,YAAYhE;QAEtB,sBAAA,cAAClB,OAAAA;MACC0D,WAAU;MACVkC,MAAM;MACNjC,UAAU,SAACC,GAAAA;AACTgB,sBAAchB,EAAEC,YAAYC,OAAOC,KAAK;MAC1C;OAECmB,YAAYW,QAAQ,CAAA,GAIxBV,WAAAA;EAGP,GACA;IACEW,cAAc;EAChB,CAAA;AAGF,SAAOzF,qBAAqB2D,iBAAiB;IAC3CxC,OAAOQ;EACT,CAAA;AACF;",
5
+ "names": ["Stack", "composeEventHandlers", "isWeb", "shouldRenderNativePlatform", "useProps", "withStaticProperties", "useSwitch", "useControllableState", "React", "Switch", "NativeSwitch", "SwitchStyledContext", "SwitchFrame", "DefaultSwitchFrame", "SwitchThumb", "SwitchContext", "createContext", "checked", "disabled", "frameWidth", "createSwitch", "createProps", "disableActiveTheme", "Frame", "Thumb", "process", "env", "NODE_ENV", "staticConfig", "context", "console", "warn", "SwitchThumbComponent", "styleable", "props", "forwardedRef", "sizeProp", "size", "unstyledProp", "unstyled", "nativeID", "thumbProps", "useContext", "styledContext", "useStyledContext", "unstyledContext", "sizeContext", "TAMAGUI_HEADLESS", "initialChecked", "useRef", "current", "useState", "thumbWidth", "setThumbWidth", "distance", "x", "ref", "theme", "alignSelf", "onLayout", "e", "nativeEvent", "layout", "width", "SwitchComponent", "_props", "native", "nativeProps", "checkedProp", "defaultChecked", "onCheckedChange", "prop", "defaultProp", "onChange", "transition", "setChecked", "setFrameWidth", "propsActive", "noNormalize", "noExpand", "resolveValues", "forComponent", "switchProps", "bubbleInput", "switchRef", "renderNative", "value", "onValueChange", "Provider", "tag", "type", "themeShallow", "flex", "children", "disableTheme"]
6
6
  }
@@ -3,7 +3,7 @@ import { SwitchFrame, SwitchThumb } from "./Switch";
3
3
  export * from "./createSwitch";
4
4
  export * from "./StyledContext";
5
5
  export * from "./Switch";
6
- const Switch = createSwitch({
6
+ var Switch = createSwitch({
7
7
  Frame: SwitchFrame,
8
8
  Thumb: SwitchThumb
9
9
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,aAAa,mBAAmB;AAEzC,cAAc;AACd,cAAc;AACd,cAAc;AAEP,MAAM,SAAS,aAAa;AAAA,EACjC,OAAO;AAAA,EACP,OAAO;AACT,CAAC;",
5
- "names": []
3
+ "sources": ["../../src/Users/n8/tamagui/packages/switch/src/index.ts"],
4
+ "mappings": "AAAA,SAASA,oBAAoB;AAC7B,SAASC,aAAaC,mBAAmB;AAEzC,cAAc;AACd,cAAc;AACd,cAAc;AAEP,IAAMC,SAASH,aAAa;EACjCI,OAAOH;EACPI,OAAOH;AACT,CAAA;",
5
+ "names": ["createSwitch", "SwitchFrame", "SwitchThumb", "Switch", "Frame", "Thumb"]
6
6
  }
@@ -1,5 +1,5 @@
1
1
  import { createStyledContext } from "@tamagui/core";
2
- const SwitchStyledContext = createStyledContext({
2
+ var SwitchStyledContext = createStyledContext({
3
3
  size: void 0,
4
4
  unstyled: process.env.TAMAGUI_HEADLESS === "1"
5
5
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/StyledContext.tsx"],
4
- "mappings": "AACA,SAAS,2BAA2B;AAE7B,MAAM,sBAAsB,oBAGhC;AAAA,EACD,MAAM;AAAA,EACN,UAAU,QAAQ,IAAI,qBAAqB;AAC7C,CAAC;",
5
- "names": []
3
+ "sources": ["../../src/Users/n8/tamagui/packages/switch/src/StyledContext.tsx"],
4
+ "mappings": "AACA,SAASA,2BAA2B;AAE7B,IAAMC,sBAAsBD,oBAGhC;EACDE,MAAMC;EACNC,UAAUC,QAAQC,IAAIC,qBAAqB;AAC7C,CAAA;",
5
+ "names": ["createStyledContext", "SwitchStyledContext", "size", "undefined", "unstyled", "process", "env", "TAMAGUI_HEADLESS"]
6
6
  }
@@ -2,7 +2,7 @@ import { getVariableValue, styled } from "@tamagui/core";
2
2
  import { getSize } from "@tamagui/get-token";
3
3
  import { ThemeableStack, YStack } from "@tamagui/stacks";
4
4
  import { SwitchStyledContext } from "./StyledContext";
5
- const SwitchThumb = styled(ThemeableStack, {
5
+ var SwitchThumb = styled(ThemeableStack, {
6
6
  name: "SwitchThumb",
7
7
  context: SwitchStyledContext,
8
8
  variants: {
@@ -17,8 +17,8 @@ const SwitchThumb = styled(ThemeableStack, {
17
17
  true: {}
18
18
  },
19
19
  size: {
20
- "...size": (val) => {
21
- const size = getSwitchHeight(val);
20
+ "...size": function(val) {
21
+ var size = getSwitchHeight(val);
22
22
  return {
23
23
  height: size,
24
24
  width: size
@@ -29,7 +29,11 @@ const SwitchThumb = styled(ThemeableStack, {
29
29
  defaultVariants: {
30
30
  unstyled: process.env.TAMAGUI_HEADLESS === "1"
31
31
  }
32
- }), getSwitchHeight = (val) => Math.round(getVariableValue(getSize(val)) * 0.65), getSwitchWidth = (val) => getSwitchHeight(val) * 2, SwitchFrame = styled(YStack, {
32
+ }), getSwitchHeight = function(val) {
33
+ return Math.round(getVariableValue(getSize(val)) * 0.65);
34
+ }, getSwitchWidth = function(val) {
35
+ return getSwitchHeight(val) * 2;
36
+ }, SwitchFrame = styled(YStack, {
33
37
  name: "Switch",
34
38
  tag: "button",
35
39
  context: SwitchStyledContext,
@@ -51,8 +55,8 @@ const SwitchThumb = styled(ThemeableStack, {
51
55
  true: {}
52
56
  },
53
57
  size: {
54
- "...size": (val) => {
55
- const height = getSwitchHeight(val) + 4, width = getSwitchWidth(val) + 4;
58
+ "...size": function(val) {
59
+ var height = getSwitchHeight(val) + 4, width = getSwitchWidth(val) + 4;
56
60
  return {
57
61
  height,
58
62
  minHeight: height,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/Switch.tsx"],
4
- "mappings": "AACA,SAAS,kBAAkB,cAAc;AACzC,SAAS,eAAe;AACxB,SAAS,gBAAgB,cAAc;AAEvC,SAAS,2BAA2B;AAE7B,MAAM,cAAc,OAAO,gBAAgB;AAAA,EAChD,MAAM;AAAA,EACN,SAAS;AAAA,EAET,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,MAAM;AAAA,QACN,iBAAiB;AAAA,QACjB,cAAc;AAAA,MAChB;AAAA,IACF;AAAA,IAEA,SAAS;AAAA,MACP,MAAM,CAAC;AAAA,IACT;AAAA,IAEA,MAAM;AAAA,MACJ,WAAW,CAAC,QAAQ;AAClB,cAAM,OAAO,gBAAgB,GAAG;AAChC,eAAO;AAAA,UACL,QAAQ;AAAA,UACR,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,UAAU,QAAQ,IAAI,qBAAqB;AAAA,EAC7C;AACF,CAAC,GAEK,kBAAkB,CAAC,QACvB,KAAK,MAAM,iBAAiB,QAAQ,GAAG,CAAC,IAAI,IAAI,GAE5C,iBAAiB,CAAC,QAAoB,gBAAgB,GAAG,IAAI,GAEtD,cAAc,OAAO,QAAQ;AAAA,EACxC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,SAAS;AAAA,EAET,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,cAAc;AAAA,QACd,iBAAiB;AAAA,QACjB,aAAa;AAAA,QACb,aAAa;AAAA,QAEb,YAAY;AAAA,UACV,cAAc;AAAA,UACd,cAAc;AAAA,UACd,cAAc;AAAA,QAChB;AAAA,MACF;AAAA,IACF;AAAA,IAEA,SAAS;AAAA,MACP,MAAM,CAAC;AAAA,IACT;AAAA,IAEA,MAAM;AAAA,MACJ,WAAW,CAAC,QAAQ;AAClB,cAAM,SAAS,gBAAgB,GAAG,IAAI,GAChC,QAAQ,eAAe,GAAG,IAAI;AACpC,eAAO;AAAA,UACL;AAAA,UACA,WAAW;AAAA,UACX;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,UAAU,QAAQ,IAAI,qBAAqB;AAAA,EAC7C;AACF,CAAC;",
5
- "names": []
3
+ "sources": ["../../src/Users/n8/tamagui/packages/switch/src/Switch.tsx"],
4
+ "mappings": "AACA,SAASA,kBAAkBC,cAAc;AACzC,SAASC,eAAe;AACxB,SAASC,gBAAgBC,cAAc;AAEvC,SAASC,2BAA2B;AAE7B,IAAMC,cAAcL,OAAOE,gBAAgB;EAChDI,MAAM;EACNC,SAASH;EAETI,UAAU;IACRC,UAAU;MACRC,OAAO;QACLC,MAAM;QACNC,iBAAiB;QACjBC,cAAc;MAChB;IACF;IAEAC,SAAS;MACPC,MAAM,CAAC;IACT;IAEAJ,MAAM;MACJ,WAAW,SAACK,KAAAA;AACV,YAAML,OAAOM,gBAAgBD,GAAAA;AAC7B,eAAO;UACLE,QAAQP;UACRQ,OAAOR;QACT;MACF;IACF;EACF;EAEAS,iBAAiB;IACfX,UAAUY,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA,GAEMN,kBAAkB,SAACD,KAAAA;SACvBQ,KAAKC,MAAM1B,iBAAiBE,QAAQe,GAAAA,CAAAA,IAAQ,IAAA;GAExCU,iBAAiB,SAACV,KAAAA;SAAoBC,gBAAgBD,GAAAA,IAAO;GAEtDW,cAAc3B,OAAOG,QAAQ;EACxCG,MAAM;EACNsB,KAAK;EACLrB,SAASH;EAETI,UAAU;IACRC,UAAU;MACRC,OAAO;QACLG,cAAc;QACdD,iBAAiB;QACjBiB,aAAa;QACbC,aAAa;QAEbC,YAAY;UACVC,cAAc;UACdC,cAAc;UACdC,cAAc;QAChB;MACF;IACF;IAEApB,SAAS;MACPC,MAAM,CAAC;IACT;IAEAJ,MAAM;MACJ,WAAW,SAACK,KAAAA;AACV,YAAME,SAASD,gBAAgBD,GAAAA,IAAO,GAChCG,QAAQO,eAAeV,GAAAA,IAAO;AACpC,eAAO;UACLE;UACAiB,WAAWjB;UACXC;QACF;MACF;IACF;EACF;EAEAC,iBAAiB;IACfX,UAAUY,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA;",
5
+ "names": ["getVariableValue", "styled", "getSize", "ThemeableStack", "YStack", "SwitchStyledContext", "SwitchThumb", "name", "context", "variants", "unstyled", "false", "size", "backgroundColor", "borderRadius", "checked", "true", "val", "getSwitchHeight", "height", "width", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "Math", "round", "getSwitchWidth", "SwitchFrame", "tag", "borderWidth", "borderColor", "focusStyle", "outlineColor", "outlineStyle", "outlineWidth", "minHeight"]
6
6
  }