@tamagui/switch 1.113.1 → 1.114.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/esm/StyledContext.native.js +4 -2
- package/dist/esm/StyledContext.native.js.map +6 -1
- package/dist/esm/Switch.native.js +62 -63
- package/dist/esm/Switch.native.js.map +6 -1
- package/dist/esm/createSwitch.native.js +89 -121
- package/dist/esm/createSwitch.native.js.map +6 -1
- package/dist/esm/index.native.js +9 -7
- package/dist/esm/index.native.js.map +6 -1
- package/package.json +13 -13
|
@@ -3,5 +3,7 @@ var SwitchStyledContext = createStyledContext({
|
|
|
3
3
|
size: void 0,
|
|
4
4
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
5
5
|
});
|
|
6
|
-
export {
|
|
7
|
-
|
|
6
|
+
export {
|
|
7
|
+
SwitchStyledContext
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=StyledContext.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/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
|
+
}
|
|
@@ -2,74 +2,73 @@ import { getVariableValue, styled } from "@tamagui/core";
|
|
|
2
2
|
import { getSize } from "@tamagui/get-token";
|
|
3
3
|
import { ThemeableStack, YStack } from "@tamagui/stacks";
|
|
4
4
|
var SwitchThumb = styled(ThemeableStack, {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
checked: {
|
|
15
|
-
true: {}
|
|
16
|
-
},
|
|
17
|
-
size: {
|
|
18
|
-
"...size": function (val) {
|
|
19
|
-
var size = getSwitchHeight(val);
|
|
20
|
-
return {
|
|
21
|
-
height: size,
|
|
22
|
-
width: size
|
|
23
|
-
};
|
|
24
|
-
}
|
|
5
|
+
name: "SwitchThumb",
|
|
6
|
+
variants: {
|
|
7
|
+
unstyled: {
|
|
8
|
+
false: {
|
|
9
|
+
size: "$true",
|
|
10
|
+
backgroundColor: "$background",
|
|
11
|
+
borderRadius: 1e3
|
|
25
12
|
}
|
|
26
13
|
},
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
checked: {
|
|
15
|
+
true: {}
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
"...size": function(val) {
|
|
19
|
+
var size = getSwitchHeight(val);
|
|
20
|
+
return {
|
|
21
|
+
height: size,
|
|
22
|
+
width: size
|
|
23
|
+
};
|
|
24
|
+
}
|
|
29
25
|
}
|
|
30
|
-
}),
|
|
31
|
-
getSwitchHeight = function (val) {
|
|
32
|
-
return Math.round(getVariableValue(getSize(val)) * 0.65);
|
|
33
|
-
},
|
|
34
|
-
getSwitchWidth = function (val) {
|
|
35
|
-
return getSwitchHeight(val) * 2;
|
|
36
26
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"...size": function (val) {
|
|
60
|
-
var height = getSwitchHeight(val) + 4,
|
|
61
|
-
width = getSwitchWidth(val) + 4;
|
|
62
|
-
return {
|
|
63
|
-
height,
|
|
64
|
-
minHeight: height,
|
|
65
|
-
width
|
|
66
|
-
};
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
29
|
+
}
|
|
30
|
+
}), getSwitchHeight = function(val) {
|
|
31
|
+
return Math.round(getVariableValue(getSize(val)) * 0.65);
|
|
32
|
+
}, getSwitchWidth = function(val) {
|
|
33
|
+
return getSwitchHeight(val) * 2;
|
|
34
|
+
}, SwitchFrame = styled(YStack, {
|
|
35
|
+
name: "Switch",
|
|
36
|
+
tag: "button",
|
|
37
|
+
tabIndex: 0,
|
|
38
|
+
variants: {
|
|
39
|
+
unstyled: {
|
|
40
|
+
false: {
|
|
41
|
+
borderRadius: 1e3,
|
|
42
|
+
backgroundColor: "$background",
|
|
43
|
+
borderWidth: 2,
|
|
44
|
+
borderColor: "$background",
|
|
45
|
+
focusVisibleStyle: {
|
|
46
|
+
outlineColor: "$outlineColor",
|
|
47
|
+
outlineStyle: "solid",
|
|
48
|
+
outlineWidth: 2
|
|
67
49
|
}
|
|
68
50
|
}
|
|
69
51
|
},
|
|
70
|
-
|
|
71
|
-
|
|
52
|
+
checked: {
|
|
53
|
+
true: {}
|
|
54
|
+
},
|
|
55
|
+
size: {
|
|
56
|
+
"...size": function(val) {
|
|
57
|
+
var height = getSwitchHeight(val) + 4, width = getSwitchWidth(val) + 4;
|
|
58
|
+
return {
|
|
59
|
+
height,
|
|
60
|
+
minHeight: height,
|
|
61
|
+
width
|
|
62
|
+
};
|
|
63
|
+
}
|
|
72
64
|
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
},
|
|
66
|
+
defaultVariants: {
|
|
67
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export {
|
|
71
|
+
SwitchFrame,
|
|
72
|
+
SwitchThumb
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=Switch.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/switch/src/Switch.tsx"],
|
|
4
|
+
"mappings": "AACA,SAASA,kBAAkBC,cAAc;AACzC,SAASC,eAAe;AACxB,SAASC,gBAAgBC,cAAc;AAEhC,IAAMC,cAAcJ,OAAOE,gBAAgB;EAChDG,MAAM;EAENC,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,MAAMxB,iBAAiBE,QAAQa,GAAAA,CAAAA,IAAQ,IAAA;GAExCU,iBAAiB,SAACV,KAAAA;SAAoBC,gBAAgBD,GAAAA,IAAO;GAEtDW,cAAczB,OAAOG,QAAQ;EACxCE,MAAM;EACNqB,KAAK;EACLC,UAAU;EAEVrB,UAAU;IACRC,UAAU;MACRC,OAAO;QACLG,cAAc;QACdD,iBAAiB;QACjBkB,aAAa;QACbC,aAAa;QAEbC,mBAAmB;UACjBC,cAAc;UACdC,cAAc;UACdC,cAAc;QAChB;MACF;IACF;IAEArB,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;UACAkB,WAAWlB;UACXC;QACF;MACF;IACF;EACF;EAEAC,iBAAiB;IACfX,UAAUY,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA;",
|
|
5
|
+
"names": ["getVariableValue", "styled", "getSize", "ThemeableStack", "YStack", "SwitchThumb", "name", "variants", "unstyled", "false", "size", "backgroundColor", "borderRadius", "checked", "true", "val", "getSwitchHeight", "height", "width", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "Math", "round", "getSwitchWidth", "SwitchFrame", "tag", "tabIndex", "borderWidth", "borderColor", "focusVisibleStyle", "outlineColor", "outlineStyle", "outlineWidth", "minHeight"]
|
|
6
|
+
}
|
|
@@ -5,155 +5,123 @@ import { useSwitch } from "@tamagui/switch-headless";
|
|
|
5
5
|
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { Switch as NativeSwitch } from "react-native";
|
|
8
|
-
import { SwitchStyledContext } from "./StyledContext
|
|
9
|
-
import { SwitchFrame as DefaultSwitchFrame, SwitchThumb } from "./Switch
|
|
10
|
-
var SwitchContext = /* @__PURE__ */React.createContext({
|
|
8
|
+
import { SwitchStyledContext } from "./StyledContext";
|
|
9
|
+
import { SwitchFrame as DefaultSwitchFrame, SwitchThumb } from "./Switch";
|
|
10
|
+
var SwitchContext = /* @__PURE__ */ React.createContext({
|
|
11
11
|
checked: !1,
|
|
12
12
|
disabled: !1,
|
|
13
13
|
frameWidth: 0
|
|
14
14
|
});
|
|
15
15
|
function createSwitch(createProps) {
|
|
16
|
-
var {
|
|
17
|
-
disableActiveTheme,
|
|
18
|
-
Frame = DefaultSwitchFrame,
|
|
19
|
-
Thumb = SwitchThumb
|
|
20
|
-
} = createProps;
|
|
16
|
+
var { disableActiveTheme, Frame = DefaultSwitchFrame, Thumb = SwitchThumb } = createProps;
|
|
21
17
|
process.env.NODE_ENV === "development" && (Frame !== DefaultSwitchFrame && Frame.staticConfig.context && Frame.staticConfig.context !== SwitchStyledContext || Thumb !== SwitchThumb && Thumb.staticConfig.context && Thumb.staticConfig.context !== SwitchStyledContext) && 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;
|
|
22
|
-
var SwitchThumbComponent = Thumb.styleable(function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}),
|
|
63
|
-
// expected variants
|
|
18
|
+
var SwitchThumbComponent = Thumb.styleable(function(props, forwardedRef) {
|
|
19
|
+
var { size: sizeProp, unstyled: unstyledProp, nativeID, ...thumbProps } = props, context = React.useContext(SwitchContext), { checked, disabled, frameWidth } = context, styledContext = SwitchStyledContext.useStyledContext(), { unstyled: unstyledContext, size: sizeContext } = styledContext, _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, [thumbWidth, setThumbWidth] = React.useState(0), distance = frameWidth - thumbWidth, x = initialChecked ? checked ? 0 : -distance : checked ? distance : 0;
|
|
20
|
+
return /* @__PURE__ */ _jsx(Thumb, {
|
|
21
|
+
ref: forwardedRef,
|
|
22
|
+
unstyled,
|
|
23
|
+
...unstyled === !1 && {
|
|
24
|
+
size,
|
|
25
|
+
...!disableActiveTheme && {
|
|
26
|
+
theme: checked ? "active" : null
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
alignSelf: initialChecked ? "flex-end" : "flex-start",
|
|
30
|
+
x,
|
|
31
|
+
// TODO: remove ViewProps cast
|
|
32
|
+
onLayout: composeEventHandlers(props.onLayout, function(e) {
|
|
33
|
+
return setThumbWidth(e.nativeEvent.layout.width);
|
|
34
|
+
}),
|
|
35
|
+
// expected variants
|
|
36
|
+
checked,
|
|
37
|
+
disabled,
|
|
38
|
+
...thumbProps
|
|
39
|
+
});
|
|
40
|
+
}), SwitchComponent = Frame.styleable(function(_props, forwardedRef) {
|
|
41
|
+
var { native, nativeProps, checked: checkedProp, defaultChecked, onCheckedChange, ...props } = _props, [checked, setChecked] = useControllableState({
|
|
42
|
+
prop: checkedProp,
|
|
43
|
+
defaultProp: defaultChecked || !1,
|
|
44
|
+
onChange: onCheckedChange,
|
|
45
|
+
transition: !0
|
|
46
|
+
}), styledContext = React.useContext(SwitchStyledContext.context), [frameWidth, setFrameWidth] = React.useState(0), propsActive = useProps(props, {
|
|
47
|
+
noNormalize: !0,
|
|
48
|
+
noExpand: !0,
|
|
49
|
+
resolveValues: "none",
|
|
50
|
+
forComponent: Frame
|
|
51
|
+
}), _styledContext_size, _ref, _styledContext_unstyled, _ref1, { switchProps, bubbleInput, switchRef } = useSwitch(
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
Object.assign({
|
|
54
|
+
size: (_ref = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref !== void 0 ? _ref : "$true",
|
|
55
|
+
unstyled: (_ref1 = (_styledContext_unstyled = styledContext.unstyled) !== null && _styledContext_unstyled !== void 0 ? _styledContext_unstyled : props.unstyled) !== null && _ref1 !== void 0 ? _ref1 : !1
|
|
56
|
+
}, propsActive),
|
|
57
|
+
[
|
|
64
58
|
checked,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
defaultChecked,
|
|
75
|
-
onCheckedChange,
|
|
76
|
-
...props
|
|
77
|
-
} = _props,
|
|
78
|
-
[checked, setChecked] = useControllableState({
|
|
79
|
-
prop: checkedProp,
|
|
80
|
-
defaultProp: defaultChecked || !1,
|
|
81
|
-
onChange: onCheckedChange,
|
|
82
|
-
transition: !0
|
|
83
|
-
}),
|
|
84
|
-
styledContext = React.useContext(SwitchStyledContext.context),
|
|
85
|
-
[frameWidth, setFrameWidth] = React.useState(0),
|
|
86
|
-
propsActive = useProps(props, {
|
|
87
|
-
noNormalize: !0,
|
|
88
|
-
noExpand: !0,
|
|
89
|
-
resolveValues: "none",
|
|
90
|
-
forComponent: Frame
|
|
91
|
-
}),
|
|
92
|
-
_styledContext_size,
|
|
93
|
-
_ref,
|
|
94
|
-
_styledContext_unstyled,
|
|
95
|
-
_ref1,
|
|
96
|
-
{
|
|
97
|
-
switchProps,
|
|
98
|
-
bubbleInput,
|
|
99
|
-
switchRef
|
|
100
|
-
} = useSwitch(
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
Object.assign({
|
|
103
|
-
size: (_ref = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref !== void 0 ? _ref : "$true",
|
|
104
|
-
unstyled: (_ref1 = (_styledContext_unstyled = styledContext.unstyled) !== null && _styledContext_unstyled !== void 0 ? _styledContext_unstyled : props.unstyled) !== null && _ref1 !== void 0 ? _ref1 : !1
|
|
105
|
-
}, propsActive), [checked, setChecked], forwardedRef);
|
|
106
|
-
React.useEffect(function () {
|
|
107
|
-
if (props.id && !props.disabled) return registerFocusable(props.id, {
|
|
108
|
-
focusAndSelect: function () {
|
|
109
|
-
setChecked?.(function (value) {
|
|
59
|
+
setChecked
|
|
60
|
+
],
|
|
61
|
+
forwardedRef
|
|
62
|
+
);
|
|
63
|
+
React.useEffect(function() {
|
|
64
|
+
if (props.id && !props.disabled)
|
|
65
|
+
return registerFocusable(props.id, {
|
|
66
|
+
focusAndSelect: function() {
|
|
67
|
+
setChecked?.(function(value) {
|
|
110
68
|
return !value;
|
|
111
69
|
});
|
|
112
70
|
},
|
|
113
|
-
focus: function
|
|
71
|
+
focus: function() {
|
|
72
|
+
}
|
|
114
73
|
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
74
|
+
}, [
|
|
75
|
+
props.id,
|
|
76
|
+
props.disabled
|
|
77
|
+
]);
|
|
78
|
+
var renderNative = shouldRenderNativePlatform(native);
|
|
79
|
+
return renderNative === "android" || renderNative === "ios" ? /* @__PURE__ */ _jsx(NativeSwitch, {
|
|
80
|
+
value: checked,
|
|
81
|
+
onValueChange: setChecked,
|
|
82
|
+
...nativeProps
|
|
83
|
+
}) : /* @__PURE__ */ _jsxs(SwitchContext.Provider, {
|
|
84
|
+
value: {
|
|
85
|
+
checked,
|
|
86
|
+
disabled: switchProps.disabled,
|
|
87
|
+
frameWidth
|
|
88
|
+
},
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ _jsx(Frame, {
|
|
128
91
|
ref: switchRef,
|
|
129
92
|
tag: "button",
|
|
130
|
-
...
|
|
93
|
+
...isWeb && {
|
|
131
94
|
type: "button"
|
|
132
|
-
}
|
|
95
|
+
},
|
|
133
96
|
...switchProps,
|
|
134
|
-
|
|
97
|
+
...!disableActiveTheme && {
|
|
135
98
|
theme: checked ? "active" : null,
|
|
136
99
|
themeShallow: !0
|
|
137
|
-
}
|
|
100
|
+
},
|
|
138
101
|
// expected variants
|
|
139
102
|
checked,
|
|
140
103
|
disabled: switchProps.disabled,
|
|
141
|
-
children: /* @__PURE__ */_jsx(Stack, {
|
|
104
|
+
children: /* @__PURE__ */ _jsx(Stack, {
|
|
142
105
|
alignSelf: "stretch",
|
|
143
106
|
flex: 1,
|
|
144
|
-
onLayout: function
|
|
107
|
+
onLayout: function(e) {
|
|
145
108
|
setFrameWidth(e.nativeEvent.layout.width);
|
|
146
109
|
},
|
|
147
110
|
children: switchProps.children
|
|
148
111
|
})
|
|
149
|
-
}),
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
disableTheme: !0
|
|
112
|
+
}),
|
|
113
|
+
bubbleInput
|
|
114
|
+
]
|
|
153
115
|
});
|
|
116
|
+
}, {
|
|
117
|
+
disableTheme: !0
|
|
118
|
+
});
|
|
154
119
|
return withStaticProperties(SwitchComponent, {
|
|
155
120
|
Thumb: SwitchThumbComponent
|
|
156
121
|
});
|
|
157
122
|
}
|
|
158
|
-
export {
|
|
159
|
-
|
|
123
|
+
export {
|
|
124
|
+
SwitchContext,
|
|
125
|
+
createSwitch
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=createSwitch.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/switch/src/createSwitch.tsx"],
|
|
4
|
+
"mappings": ";AACA,SACEA,OACAC,sBACAC,OACAC,4BACAC,UACAC,4BACK;AAKP,SAASC,yBAAyB;AAClC,SAASC,iBAAiB;AAC1B,SAASC,4BAA4B;AACrC,YAAYC,WAAW;AAEvB,SAASC,UAAUC,oBAAoB;AAEvC,SAASC,2BAA2B;AACpC,SAASC,eAAeC,oBAAoBC,mBAAmB;AAoBxD,IAAMC,gBAAgBP,sBAAMQ,cAIhC;EACDC,SAAS;EACTC,UAAU;EACVC,YAAY;AACd,CAAA;AAKO,SAASC,aAGdC,aAAmE;AACnE,MAAM,EACJC,oBACAC,QAAQV,oBACRW,QAAQV,YAAW,IACjBO;AAMJ,EAAII,QAAQC,IAAIC,aAAa,kBAExBJ,UAAUV,sBACTU,M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AA;MAAagF,OAAOzE;MAAS4E,eAAetB;MAAa,GAAGJ;SAK/D,sBAACpD,cAAc+E,UAAQ;MACrBJ,OAAO;QAAEzE;QAASC,UAAUgE,YAAYhE;QAAUC;MAAW;;QAE7D,qBAACI,OAAAA;UACCiC,KAAK4B;UACLW,KAAI;UACH,GAAI9F,SAAS;YAAE+F,MAAM;UAAS;UAC9B,GAAId;UACJ,GAAI,CAAC5D,sBAAsB;YAC1BmC,OAAOxC,UAAU,WAAW;YAC5BgF,cAAc;UAChB;;UAEAhF;UACAC,UAAUgE,YAAYhE;oBAEtB,qBAACnB,OAAAA;YACC2D,WAAU;YACVwC,MAAM;YACNvC,UAAU,SAACC,GAAAA;AACTgB,4BAAchB,EAAEC,YAAYC,OAAOC,KAAK;YAC1C;sBAECmB,YAAYiB;;;QAIhBhB;;;EAGP,GACA;IACEiB,cAAc;EAChB,CAAA;AAGF,SAAOhG,qBAAqB4D,iBAAiB;IAC3CxC,OAAOQ;EACT,CAAA;AACF;",
|
|
5
|
+
"names": ["Stack", "composeEventHandlers", "isWeb", "shouldRenderNativePlatform", "useProps", "withStaticProperties", "registerFocusable", "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", "size", "sizeProp", "unstyled", "unstyledProp", "nativeID", "thumbProps", "useContext", "styledContext", "useStyledContext", "unstyledContext", "sizeContext", "TAMAGUI_HEADLESS", "initialChecked", "useRef", "current", "thumbWidth", "setThumbWidth", "useState", "distance", "x", "ref", "theme", "alignSelf", "onLayout", "e", "nativeEvent", "layout", "width", "SwitchComponent", "_props", "native", "nativeProps", "checkedProp", "defaultChecked", "onCheckedChange", "setChecked", "prop", "defaultProp", "onChange", "transition", "setFrameWidth", "propsActive", "noNormalize", "noExpand", "resolveValues", "forComponent", "switchProps", "bubbleInput", "switchRef", "Object", "assign", "useEffect", "id", "focusAndSelect", "value", "focus", "renderNative", "onValueChange", "Provider", "tag", "type", "themeShallow", "flex", "children", "disableTheme"]
|
|
6
|
+
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { createSwitch } from "./createSwitch
|
|
2
|
-
import { SwitchFrame, SwitchThumb } from "./Switch
|
|
3
|
-
export * from "./createSwitch
|
|
4
|
-
export * from "./StyledContext
|
|
5
|
-
export * from "./Switch
|
|
1
|
+
import { createSwitch } from "./createSwitch";
|
|
2
|
+
import { SwitchFrame, SwitchThumb } from "./Switch";
|
|
3
|
+
export * from "./createSwitch";
|
|
4
|
+
export * from "./StyledContext";
|
|
5
|
+
export * from "./Switch";
|
|
6
6
|
var Switch = createSwitch({
|
|
7
7
|
Frame: SwitchFrame,
|
|
8
8
|
Thumb: SwitchThumb
|
|
9
9
|
});
|
|
10
|
-
export {
|
|
11
|
-
|
|
10
|
+
export {
|
|
11
|
+
Switch
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/switch",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.114.0",
|
|
4
4
|
"removeSideEffects": true,
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css"
|
|
@@ -34,23 +34,23 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@tamagui/compose-refs": "1.
|
|
38
|
-
"@tamagui/constants": "1.
|
|
39
|
-
"@tamagui/core": "1.
|
|
40
|
-
"@tamagui/focusable": "1.
|
|
41
|
-
"@tamagui/get-token": "1.
|
|
42
|
-
"@tamagui/helpers": "1.
|
|
43
|
-
"@tamagui/label": "1.
|
|
44
|
-
"@tamagui/stacks": "1.
|
|
45
|
-
"@tamagui/switch-headless": "1.
|
|
46
|
-
"@tamagui/use-controllable-state": "1.
|
|
47
|
-
"@tamagui/use-previous": "1.
|
|
37
|
+
"@tamagui/compose-refs": "1.114.0",
|
|
38
|
+
"@tamagui/constants": "1.114.0",
|
|
39
|
+
"@tamagui/core": "1.114.0",
|
|
40
|
+
"@tamagui/focusable": "1.114.0",
|
|
41
|
+
"@tamagui/get-token": "1.114.0",
|
|
42
|
+
"@tamagui/helpers": "1.114.0",
|
|
43
|
+
"@tamagui/label": "1.114.0",
|
|
44
|
+
"@tamagui/stacks": "1.114.0",
|
|
45
|
+
"@tamagui/switch-headless": "1.114.0",
|
|
46
|
+
"@tamagui/use-controllable-state": "1.114.0",
|
|
47
|
+
"@tamagui/use-previous": "1.114.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"react": "*"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@tamagui/build": "1.
|
|
53
|
+
"@tamagui/build": "1.114.0",
|
|
54
54
|
"react": "^18.2.0 || ^19.0.0"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|