@tamagui/switch 1.88.22 → 1.88.23
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/Switch.native.js +10 -29
- package/dist/esm/Switch.native.js.map +1 -1
- package/dist/esm/SwitchContext.native.js +4 -25
- package/dist/esm/SwitchContext.native.js.map +1 -1
- package/dist/esm/createSwitch.native.js +67 -83
- package/dist/esm/createSwitch.native.js.map +2 -2
- package/dist/esm/index.native.js +11 -34
- package/dist/esm/index.native.js.map +1 -1
- package/dist/jsx/Switch.native.js +10 -29
- package/dist/jsx/Switch.native.js.map +1 -1
- package/dist/jsx/SwitchContext.native.js +4 -25
- package/dist/jsx/SwitchContext.native.js.map +1 -1
- package/dist/jsx/createSwitch.native.js +67 -83
- package/dist/jsx/createSwitch.native.js.map +2 -2
- package/dist/jsx/index.native.js +11 -34
- package/dist/jsx/index.native.js.map +1 -1
- package/package.json +12 -12
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
-
var Switch_exports = {};
|
|
17
|
-
__export(Switch_exports, {
|
|
18
|
-
SwitchFrame: () => SwitchFrame,
|
|
19
|
-
SwitchThumb: () => SwitchThumb
|
|
20
|
-
});
|
|
21
|
-
module.exports = __toCommonJS(Switch_exports);
|
|
22
|
-
var import_core = require("@tamagui/core"), import_get_token = require("@tamagui/get-token"), import_stacks = require("@tamagui/stacks"), import_SwitchContext = require("./SwitchContext");
|
|
23
|
-
const SwitchThumb = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
1
|
+
import { getVariableValue, styled } from "@tamagui/core";
|
|
2
|
+
import { getSize } from "@tamagui/get-token";
|
|
3
|
+
import { ThemeableStack, YStack } from "@tamagui/stacks";
|
|
4
|
+
import { SwitchContext } from "./SwitchContext";
|
|
5
|
+
const SwitchThumb = styled(ThemeableStack, {
|
|
24
6
|
name: "SwitchThumb",
|
|
25
|
-
context:
|
|
7
|
+
context: SwitchContext,
|
|
26
8
|
variants: {
|
|
27
9
|
unstyled: {
|
|
28
10
|
false: {
|
|
@@ -47,9 +29,9 @@ const SwitchThumb = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
47
29
|
defaultVariants: {
|
|
48
30
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
49
31
|
}
|
|
50
|
-
}), getSwitchHeight = (val) => Math.round(
|
|
32
|
+
}), getSwitchHeight = (val) => Math.round(getVariableValue(getSize(val)) * 0.65), getSwitchWidth = (val) => getSwitchHeight(val) * 2, SwitchFrame = styled(YStack, {
|
|
51
33
|
name: "Switch",
|
|
52
|
-
context:
|
|
34
|
+
context: SwitchContext,
|
|
53
35
|
variants: {
|
|
54
36
|
unstyled: {
|
|
55
37
|
false: {
|
|
@@ -86,9 +68,8 @@ const SwitchThumb = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
86
68
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
87
69
|
}
|
|
88
70
|
});
|
|
89
|
-
|
|
90
|
-
0 && (module.exports = {
|
|
71
|
+
export {
|
|
91
72
|
SwitchFrame,
|
|
92
73
|
SwitchThumb
|
|
93
|
-
}
|
|
74
|
+
};
|
|
94
75
|
//# sourceMappingURL=Switch.js.map
|
|
@@ -1,6 +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MAAM;AAAA,IACnB;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
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,33 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
-
var SwitchContext_exports = {};
|
|
17
|
-
__export(SwitchContext_exports, {
|
|
18
|
-
SwitchContext: () => SwitchContext
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(SwitchContext_exports);
|
|
21
|
-
var import_core = require("@tamagui/core");
|
|
22
|
-
const SwitchContext = (0, import_core.createStyledContext)({
|
|
1
|
+
import { createStyledContext } from "@tamagui/core";
|
|
2
|
+
const SwitchContext = createStyledContext({
|
|
23
3
|
checked: !1,
|
|
24
4
|
disabled: !1,
|
|
25
5
|
size: void 0,
|
|
26
6
|
frameWidth: 0,
|
|
27
7
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
28
8
|
});
|
|
29
|
-
|
|
30
|
-
0 && (module.exports = {
|
|
9
|
+
export {
|
|
31
10
|
SwitchContext
|
|
32
|
-
}
|
|
11
|
+
};
|
|
33
12
|
//# sourceMappingURL=SwitchContext.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SwitchContext.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AACA,SAAS,2BAA2B;AAE7B,MAAM,gBAAgB,oBAM1B;AAAA,EACD,SAAS;AAAA,EACT,UAAU;AAAA,EACV,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,UAAU,QAAQ,IAAI,qBAAqB;AAC7C,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,83 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
-
mod
|
|
23
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
24
|
-
var createSwitch_exports = {};
|
|
25
|
-
__export(createSwitch_exports, {
|
|
26
|
-
createSwitch: () => createSwitch
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(createSwitch_exports);
|
|
29
|
-
var import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_focusable = require("@tamagui/focusable"), import_helpers = require("@tamagui/helpers"), import_label = require("@tamagui/label"), import_stacks = require("@tamagui/stacks"), import_use_controllable_state = require("@tamagui/use-controllable-state"), import_use_previous = require("@tamagui/use-previous"), React = __toESM(require("react")), import_react_native = require("react-native"), import_Switch = require("./Switch"), import_SwitchContext = require("./SwitchContext"), import_jsx_runtime = (
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
require("react/jsx-runtime")
|
|
32
|
-
);
|
|
1
|
+
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
2
|
+
import { isWeb } from "@tamagui/constants";
|
|
3
|
+
import { useProps } from "@tamagui/core";
|
|
4
|
+
import { registerFocusable } from "@tamagui/focusable";
|
|
5
|
+
import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
|
|
6
|
+
import { useLabelContext } from "@tamagui/label";
|
|
7
|
+
import { ButtonNestingContext, YStack } from "@tamagui/stacks";
|
|
8
|
+
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
9
|
+
import { usePrevious } from "@tamagui/use-previous";
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { Switch as NativeSwitch, Platform } from "react-native";
|
|
12
|
+
import { SwitchFrame as DefaultSwitchFrame, SwitchThumb } from "./Switch";
|
|
13
|
+
import { SwitchContext } from "./SwitchContext";
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
33
15
|
function createSwitch(createProps) {
|
|
34
16
|
const {
|
|
35
17
|
disableActiveTheme,
|
|
36
|
-
Frame =
|
|
37
|
-
Thumb =
|
|
18
|
+
Frame = DefaultSwitchFrame,
|
|
19
|
+
Thumb = SwitchThumb
|
|
38
20
|
} = createProps;
|
|
39
|
-
process.env.NODE_ENV === "development" && (Frame !==
|
|
21
|
+
process.env.NODE_ENV === "development" && (Frame !== DefaultSwitchFrame && Frame.staticConfig.context && console.warn(
|
|
40
22
|
"Warning: createSwitch() needs to control context to pass checked state from Frame to Thumb, any custom context passed will be overridden."
|
|
41
|
-
), Thumb !==
|
|
23
|
+
), Thumb !== SwitchThumb && Thumb.staticConfig.context && console.warn(
|
|
42
24
|
"Warning: createSwitch() needs to control context to pass checked state from Frame to Thumb, any custom context passed will be overridden."
|
|
43
|
-
)), Frame.staticConfig.context =
|
|
25
|
+
)), Frame.staticConfig.context = SwitchContext, Thumb.staticConfig.context = SwitchContext;
|
|
44
26
|
const SwitchThumbComponent = Thumb.styleable(function(props, forwardedRef) {
|
|
45
|
-
const { size: sizeProp, unstyled: unstyledProp, ...thumbProps } = props, context = React.useContext(
|
|
27
|
+
const { size: sizeProp, unstyled: unstyledProp, ...thumbProps } = props, context = React.useContext(SwitchContext), {
|
|
46
28
|
disabled,
|
|
47
29
|
checked,
|
|
48
30
|
unstyled: unstyledContext,
|
|
49
31
|
frameWidth,
|
|
50
32
|
size: sizeContext
|
|
51
33
|
} = context, [thumbWidth, setThumbWidth] = React.useState(0), initialChecked = React.useRef(checked).current, distance = frameWidth - thumbWidth, x = initialChecked ? checked ? 0 : -distance : checked ? distance : 0;
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
34
|
+
return (
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
Thumb,
|
|
38
|
+
{
|
|
39
|
+
...(unstyledProp ?? unstyledContext ?? !1) === !1 && {
|
|
40
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
41
|
+
size: sizeProp ?? sizeContext ?? "$true",
|
|
42
|
+
...!disableActiveTheme && {
|
|
43
|
+
theme: checked ? "active" : null
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"data-state": getState(checked),
|
|
47
|
+
"data-disabled": disabled ? "" : void 0,
|
|
48
|
+
alignSelf: initialChecked ? "flex-end" : "flex-start",
|
|
49
|
+
checked,
|
|
50
|
+
x,
|
|
51
|
+
...thumbProps,
|
|
52
|
+
onLayout: composeEventHandlers(
|
|
53
|
+
props.onLayout,
|
|
54
|
+
(e) => (
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
setThumbWidth(e.nativeEvent.layout.width)
|
|
57
|
+
)
|
|
58
|
+
),
|
|
59
|
+
ref: forwardedRef
|
|
60
|
+
}
|
|
61
|
+
)
|
|
77
62
|
);
|
|
78
63
|
}), SwitchComponent = Frame.styleable(
|
|
79
64
|
function(propsIn, forwardedRef) {
|
|
80
|
-
const styledContext = React.useContext(
|
|
65
|
+
const styledContext = React.useContext(SwitchContext), props = useProps(propsIn, {
|
|
81
66
|
noNormalize: !0,
|
|
82
67
|
noExpand: !0,
|
|
83
68
|
resolveValues: "none",
|
|
@@ -97,32 +82,32 @@ function createSwitch(createProps) {
|
|
|
97
82
|
nativeProps,
|
|
98
83
|
children,
|
|
99
84
|
...switchProps
|
|
100
|
-
} = props, native = Array.isArray(nativeProp) ? nativeProp : [nativeProp], shouldRenderMobileNative = !
|
|
85
|
+
} = props, native = Array.isArray(nativeProp) ? nativeProp : [nativeProp], shouldRenderMobileNative = !isWeb && nativeProp === !0 || !isWeb && native.includes("mobile") || native.includes("android") && Platform.OS === "android" || native.includes("ios") && Platform.OS === "ios", [button, setButton] = React.useState(null), composedRefs = useComposedRefs(forwardedRef, setButton), labelId = useLabelContext(button), labelledBy = ariaLabelledby || labelId, hasConsumerStoppedPropagationRef = React.useRef(!1), isFormControl = isWeb ? button ? !!button.closest("form") : !0 : !1, [frameWidth, setFrameWidth] = React.useState(0), [checked = !1, setChecked] = useControllableState({
|
|
101
86
|
prop: checkedProp,
|
|
102
87
|
defaultProp: defaultChecked || !1,
|
|
103
88
|
onChange: onCheckedChange,
|
|
104
89
|
transition: !0
|
|
105
90
|
});
|
|
106
91
|
if (shouldRenderMobileNative)
|
|
107
|
-
return /* @__PURE__ */
|
|
108
|
-
|
|
92
|
+
return /* @__PURE__ */ jsx(
|
|
93
|
+
NativeSwitch,
|
|
109
94
|
{
|
|
110
95
|
value: checkedProp,
|
|
111
96
|
onValueChange: onCheckedChange,
|
|
112
97
|
...nativeProps
|
|
113
98
|
}
|
|
114
99
|
);
|
|
115
|
-
|
|
100
|
+
isWeb || React.useEffect(() => {
|
|
116
101
|
if (props.id)
|
|
117
|
-
return
|
|
102
|
+
return registerFocusable(props.id, {
|
|
118
103
|
focus: () => {
|
|
119
104
|
setChecked((x) => !x);
|
|
120
105
|
}
|
|
121
106
|
});
|
|
122
107
|
}, [props.id, setChecked]);
|
|
123
|
-
const isInsideButton = React.useContext(
|
|
124
|
-
return /* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */
|
|
108
|
+
const isInsideButton = React.useContext(ButtonNestingContext);
|
|
109
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
110
|
+
/* @__PURE__ */ jsx(ButtonNestingContext.Provider, { value: !0, children: /* @__PURE__ */ jsx(
|
|
126
111
|
Frame,
|
|
127
112
|
{
|
|
128
113
|
tag: isInsideButton ? "span" : "button",
|
|
@@ -146,11 +131,11 @@ function createSwitch(createProps) {
|
|
|
146
131
|
value,
|
|
147
132
|
...switchProps,
|
|
148
133
|
ref: composedRefs,
|
|
149
|
-
onPress:
|
|
150
|
-
setChecked((prevChecked) => !prevChecked),
|
|
134
|
+
onPress: composeEventHandlers(props.onPress, (event) => {
|
|
135
|
+
setChecked((prevChecked) => !prevChecked), isWeb && isFormControl && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
151
136
|
}),
|
|
152
|
-
children: /* @__PURE__ */
|
|
153
|
-
|
|
137
|
+
children: /* @__PURE__ */ jsx(
|
|
138
|
+
YStack,
|
|
154
139
|
{
|
|
155
140
|
alignSelf: "stretch",
|
|
156
141
|
flex: 1,
|
|
@@ -162,7 +147,7 @@ function createSwitch(createProps) {
|
|
|
162
147
|
)
|
|
163
148
|
}
|
|
164
149
|
) }),
|
|
165
|
-
|
|
150
|
+
isWeb && isFormControl && /* @__PURE__ */ jsx(
|
|
166
151
|
BubbleInput,
|
|
167
152
|
{
|
|
168
153
|
control: button,
|
|
@@ -181,7 +166,7 @@ function createSwitch(createProps) {
|
|
|
181
166
|
disableTheme: !0
|
|
182
167
|
}
|
|
183
168
|
), BubbleInput = (props) => {
|
|
184
|
-
const { control, checked, bubbles = !0, ...inputProps } = props, ref = React.useRef(null), prevChecked =
|
|
169
|
+
const { control, checked, bubbles = !0, ...inputProps } = props, ref = React.useRef(null), prevChecked = usePrevious(checked);
|
|
185
170
|
return React.useEffect(() => {
|
|
186
171
|
const input = ref.current, inputProto = window.HTMLInputElement.prototype, setChecked = Object.getOwnPropertyDescriptor(
|
|
187
172
|
inputProto,
|
|
@@ -192,7 +177,7 @@ function createSwitch(createProps) {
|
|
|
192
177
|
setChecked.call(input, checked), input.dispatchEvent(event);
|
|
193
178
|
}
|
|
194
179
|
}, [prevChecked, checked, bubbles]), // @ts-ignore
|
|
195
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ jsx(
|
|
196
181
|
"input",
|
|
197
182
|
{
|
|
198
183
|
type: "checkbox",
|
|
@@ -215,12 +200,11 @@ function createSwitch(createProps) {
|
|
|
215
200
|
function getState(checked) {
|
|
216
201
|
return checked ? "checked" : "unchecked";
|
|
217
202
|
}
|
|
218
|
-
return
|
|
203
|
+
return withStaticProperties(SwitchComponent, {
|
|
219
204
|
Thumb: SwitchThumbComponent
|
|
220
205
|
});
|
|
221
206
|
}
|
|
222
|
-
|
|
223
|
-
0 && (module.exports = {
|
|
207
|
+
export {
|
|
224
208
|
createSwitch
|
|
225
|
-
}
|
|
209
|
+
};
|
|
226
210
|
//# sourceMappingURL=createSwitch.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createSwitch.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": [
|
|
4
|
+
"mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,aAAa;AAEtB,SAA4C,gBAAgB;AAC5D,SAAS,yBAAyB;AAClC,SAAS,sBAAsB,4BAA4B;AAC3D,SAAS,uBAAuB;AAChC,SAAS,sBAAsB,cAAc;AAC7C,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,YAAY,WAAW;AAEvB,SAAS,UAAU,cAAc,gBAAgB;AAEjD,SAAS,eAAe,oBAAoB,mBAAmB;AAC/D,SAAS,qBAAqB;AAkFxB,SAuGE,UAvGF,KAuGE,YAvGF;AAtDC,SAAS,aAGd,aAIC;AACD,QAAM;AAAA,IACJ;AAAA,IACA,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV,IAAI;AAMJ,EAAI,QAAQ,IAAI,aAAa,kBAEvB,UAAU,sBAAsB,MAAM,aAAa,WACrD,QAAQ;AAAA,IACN;AAAA,EACF,GAGE,UAAU,eAAe,MAAM,aAAa,WAC9C,QAAQ;AAAA,IACN;AAAA,EACF,IAIJ,MAAM,aAAa,UAAU,eAC7B,MAAM,aAAa,UAAU;AAE7B,QAAM,uBAAuB,MAAM,UAAU,SAAqB,OAAO,cAAc;AACrF,UAAM,EAAE,MAAM,UAAU,UAAU,cAAc,GAAG,WAAW,IAAI,OAC5D,UAAU,MAAM,WAAW,aAAa,GACxC;AAAA,MACJ;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AAAA,QACxB;AAAA,QACA;AAAA,MACF,EAC8B;AAC9B,UAAI,gBAAgB,WAAW,YAAY;AACzC,cAAM,QAAQ,IAAI,MAAM,SAAS,EAAE,QAAQ,CAAC;AAC5C,mBAAW,KAAK,OAAO,OAAO,GAC9B,MAAM,cAAc,KAAK;AAAA,MAC3B;AAAA,IACF,GAAG,CAAC,aAAa,SAAS,OAAO,CAAC;AAAA,IAIhC;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,eAAW;AAAA,QACX,gBAAgB;AAAA,QACf,GAAG;AAAA,QACJ,UAAU;AAAA,QACV;AAAA,QACA,OAAO;AAAA,UACL,GAAG,MAAM;AAAA;AAAA,UAET,UAAU;AAAA,UACV,eAAe;AAAA,UACf,SAAS;AAAA,UACT,QAAQ;AAAA,QACV;AAAA;AAAA,IACF;AAAA,EAEJ;AAEA,WAAS,SAAS,SAAkB;AAClC,WAAO,UAAU,YAAY;AAAA,EAC/B;AAMA,SAJe,qBAAqB,iBAAiB;AAAA,IACnD,OAAO;AAAA,EACT,CAAC;AAGH;",
|
|
5
|
+
"names": []
|
|
6
6
|
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,36 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
-
var src_exports = {};
|
|
17
|
-
__export(src_exports, {
|
|
18
|
-
Switch: () => Switch
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(src_exports);
|
|
21
|
-
var import_createSwitch = require("./createSwitch"), import_Switch = require("./Switch");
|
|
22
|
-
__reExport(src_exports, require("./Switch"), module.exports);
|
|
23
|
-
__reExport(src_exports, require("./SwitchContext"), module.exports);
|
|
24
|
-
__reExport(src_exports, require("./createSwitch"), module.exports);
|
|
25
|
-
const Switch = (0, import_createSwitch.createSwitch)({
|
|
26
|
-
Frame: import_Switch.SwitchFrame,
|
|
27
|
-
Thumb: import_Switch.SwitchThumb
|
|
28
|
-
});
|
|
29
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
-
0 && (module.exports = {
|
|
31
|
-
Switch,
|
|
32
|
-
...require("./Switch"),
|
|
33
|
-
...require("./SwitchContext"),
|
|
34
|
-
...require("./createSwitch")
|
|
1
|
+
import { createSwitch } from "./createSwitch";
|
|
2
|
+
import { SwitchFrame, SwitchThumb } from "./Switch";
|
|
3
|
+
export * from "./Switch";
|
|
4
|
+
export * from "./SwitchContext";
|
|
5
|
+
export * from "./createSwitch";
|
|
6
|
+
const Switch = createSwitch({
|
|
7
|
+
Frame: SwitchFrame,
|
|
8
|
+
Thumb: SwitchThumb
|
|
35
9
|
});
|
|
10
|
+
export {
|
|
11
|
+
Switch
|
|
12
|
+
};
|
|
36
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "
|
|
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
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
-
var Switch_exports = {};
|
|
17
|
-
__export(Switch_exports, {
|
|
18
|
-
SwitchFrame: () => SwitchFrame,
|
|
19
|
-
SwitchThumb: () => SwitchThumb
|
|
20
|
-
});
|
|
21
|
-
module.exports = __toCommonJS(Switch_exports);
|
|
22
|
-
var import_core = require("@tamagui/core"), import_get_token = require("@tamagui/get-token"), import_stacks = require("@tamagui/stacks"), import_SwitchContext = require("./SwitchContext");
|
|
23
|
-
const SwitchThumb = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
1
|
+
import { getVariableValue, styled } from "@tamagui/core";
|
|
2
|
+
import { getSize } from "@tamagui/get-token";
|
|
3
|
+
import { ThemeableStack, YStack } from "@tamagui/stacks";
|
|
4
|
+
import { SwitchContext } from "./SwitchContext";
|
|
5
|
+
const SwitchThumb = styled(ThemeableStack, {
|
|
24
6
|
name: "SwitchThumb",
|
|
25
|
-
context:
|
|
7
|
+
context: SwitchContext,
|
|
26
8
|
variants: {
|
|
27
9
|
unstyled: {
|
|
28
10
|
false: {
|
|
@@ -47,9 +29,9 @@ const SwitchThumb = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
47
29
|
defaultVariants: {
|
|
48
30
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
49
31
|
}
|
|
50
|
-
}), getSwitchHeight = (val) => Math.round(
|
|
32
|
+
}), getSwitchHeight = (val) => Math.round(getVariableValue(getSize(val)) * 0.65), getSwitchWidth = (val) => getSwitchHeight(val) * 2, SwitchFrame = styled(YStack, {
|
|
51
33
|
name: "Switch",
|
|
52
|
-
context:
|
|
34
|
+
context: SwitchContext,
|
|
53
35
|
variants: {
|
|
54
36
|
unstyled: {
|
|
55
37
|
false: {
|
|
@@ -86,9 +68,8 @@ const SwitchThumb = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
86
68
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
87
69
|
}
|
|
88
70
|
});
|
|
89
|
-
|
|
90
|
-
0 && (module.exports = {
|
|
71
|
+
export {
|
|
91
72
|
SwitchFrame,
|
|
92
73
|
SwitchThumb
|
|
93
|
-
}
|
|
74
|
+
};
|
|
94
75
|
//# sourceMappingURL=Switch.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Switch.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AACA,SAAS,kBAAkB,cAAc;AACzC,SAAS,eAAe;AACxB,SAAS,gBAAgB,cAAc;AAEvC,SAAS,qBAAqB;AAEvB,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,SAAS;AAAA,EAET,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,MAAM;AAAA,QACN,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,YAAY;AAAA,MACV,WAAW,MAAM;AAAA,IACnB;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
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,33 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
-
var SwitchContext_exports = {};
|
|
17
|
-
__export(SwitchContext_exports, {
|
|
18
|
-
SwitchContext: () => SwitchContext
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(SwitchContext_exports);
|
|
21
|
-
var import_core = require("@tamagui/core");
|
|
22
|
-
const SwitchContext = (0, import_core.createStyledContext)({
|
|
1
|
+
import { createStyledContext } from "@tamagui/core";
|
|
2
|
+
const SwitchContext = createStyledContext({
|
|
23
3
|
checked: !1,
|
|
24
4
|
disabled: !1,
|
|
25
5
|
size: void 0,
|
|
26
6
|
frameWidth: 0,
|
|
27
7
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
28
8
|
});
|
|
29
|
-
|
|
30
|
-
0 && (module.exports = {
|
|
9
|
+
export {
|
|
31
10
|
SwitchContext
|
|
32
|
-
}
|
|
11
|
+
};
|
|
33
12
|
//# sourceMappingURL=SwitchContext.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SwitchContext.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AACA,SAAS,2BAA2B;AAE7B,MAAM,gBAAgB,oBAM1B;AAAA,EACD,SAAS;AAAA,EACT,UAAU;AAAA,EACV,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,UAAU,QAAQ,IAAI,qBAAqB;AAC7C,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,83 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
-
mod
|
|
23
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
24
|
-
var createSwitch_exports = {};
|
|
25
|
-
__export(createSwitch_exports, {
|
|
26
|
-
createSwitch: () => createSwitch
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(createSwitch_exports);
|
|
29
|
-
var import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_focusable = require("@tamagui/focusable"), import_helpers = require("@tamagui/helpers"), import_label = require("@tamagui/label"), import_stacks = require("@tamagui/stacks"), import_use_controllable_state = require("@tamagui/use-controllable-state"), import_use_previous = require("@tamagui/use-previous"), React = __toESM(require("react")), import_react_native = require("react-native"), import_Switch = require("./Switch"), import_SwitchContext = require("./SwitchContext"), import_jsx_runtime = (
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
require("react/jsx-runtime")
|
|
32
|
-
);
|
|
1
|
+
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
2
|
+
import { isWeb } from "@tamagui/constants";
|
|
3
|
+
import { useProps } from "@tamagui/core";
|
|
4
|
+
import { registerFocusable } from "@tamagui/focusable";
|
|
5
|
+
import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
|
|
6
|
+
import { useLabelContext } from "@tamagui/label";
|
|
7
|
+
import { ButtonNestingContext, YStack } from "@tamagui/stacks";
|
|
8
|
+
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
9
|
+
import { usePrevious } from "@tamagui/use-previous";
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { Switch as NativeSwitch, Platform } from "react-native";
|
|
12
|
+
import { SwitchFrame as DefaultSwitchFrame, SwitchThumb } from "./Switch";
|
|
13
|
+
import { SwitchContext } from "./SwitchContext";
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
33
15
|
function createSwitch(createProps) {
|
|
34
16
|
const {
|
|
35
17
|
disableActiveTheme,
|
|
36
|
-
Frame =
|
|
37
|
-
Thumb =
|
|
18
|
+
Frame = DefaultSwitchFrame,
|
|
19
|
+
Thumb = SwitchThumb
|
|
38
20
|
} = createProps;
|
|
39
|
-
process.env.NODE_ENV === "development" && (Frame !==
|
|
21
|
+
process.env.NODE_ENV === "development" && (Frame !== DefaultSwitchFrame && Frame.staticConfig.context && console.warn(
|
|
40
22
|
"Warning: createSwitch() needs to control context to pass checked state from Frame to Thumb, any custom context passed will be overridden."
|
|
41
|
-
), Thumb !==
|
|
23
|
+
), Thumb !== SwitchThumb && Thumb.staticConfig.context && console.warn(
|
|
42
24
|
"Warning: createSwitch() needs to control context to pass checked state from Frame to Thumb, any custom context passed will be overridden."
|
|
43
|
-
)), Frame.staticConfig.context =
|
|
25
|
+
)), Frame.staticConfig.context = SwitchContext, Thumb.staticConfig.context = SwitchContext;
|
|
44
26
|
const SwitchThumbComponent = Thumb.styleable(function(props, forwardedRef) {
|
|
45
|
-
const { size: sizeProp, unstyled: unstyledProp, ...thumbProps } = props, context = React.useContext(
|
|
27
|
+
const { size: sizeProp, unstyled: unstyledProp, ...thumbProps } = props, context = React.useContext(SwitchContext), {
|
|
46
28
|
disabled,
|
|
47
29
|
checked,
|
|
48
30
|
unstyled: unstyledContext,
|
|
49
31
|
frameWidth,
|
|
50
32
|
size: sizeContext
|
|
51
33
|
} = context, [thumbWidth, setThumbWidth] = React.useState(0), initialChecked = React.useRef(checked).current, distance = frameWidth - thumbWidth, x = initialChecked ? checked ? 0 : -distance : checked ? distance : 0;
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
34
|
+
return (
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
Thumb,
|
|
38
|
+
{
|
|
39
|
+
...(unstyledProp ?? unstyledContext ?? !1) === !1 && {
|
|
40
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
41
|
+
size: sizeProp ?? sizeContext ?? "$true",
|
|
42
|
+
...!disableActiveTheme && {
|
|
43
|
+
theme: checked ? "active" : null
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"data-state": getState(checked),
|
|
47
|
+
"data-disabled": disabled ? "" : void 0,
|
|
48
|
+
alignSelf: initialChecked ? "flex-end" : "flex-start",
|
|
49
|
+
checked,
|
|
50
|
+
x,
|
|
51
|
+
...thumbProps,
|
|
52
|
+
onLayout: composeEventHandlers(
|
|
53
|
+
props.onLayout,
|
|
54
|
+
(e) => (
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
setThumbWidth(e.nativeEvent.layout.width)
|
|
57
|
+
)
|
|
58
|
+
),
|
|
59
|
+
ref: forwardedRef
|
|
60
|
+
}
|
|
61
|
+
)
|
|
77
62
|
);
|
|
78
63
|
}), SwitchComponent = Frame.styleable(
|
|
79
64
|
function(propsIn, forwardedRef) {
|
|
80
|
-
const styledContext = React.useContext(
|
|
65
|
+
const styledContext = React.useContext(SwitchContext), props = useProps(propsIn, {
|
|
81
66
|
noNormalize: !0,
|
|
82
67
|
noExpand: !0,
|
|
83
68
|
resolveValues: "none",
|
|
@@ -97,32 +82,32 @@ function createSwitch(createProps) {
|
|
|
97
82
|
nativeProps,
|
|
98
83
|
children,
|
|
99
84
|
...switchProps
|
|
100
|
-
} = props, native = Array.isArray(nativeProp) ? nativeProp : [nativeProp], shouldRenderMobileNative = !
|
|
85
|
+
} = props, native = Array.isArray(nativeProp) ? nativeProp : [nativeProp], shouldRenderMobileNative = !isWeb && nativeProp === !0 || !isWeb && native.includes("mobile") || native.includes("android") && Platform.OS === "android" || native.includes("ios") && Platform.OS === "ios", [button, setButton] = React.useState(null), composedRefs = useComposedRefs(forwardedRef, setButton), labelId = useLabelContext(button), labelledBy = ariaLabelledby || labelId, hasConsumerStoppedPropagationRef = React.useRef(!1), isFormControl = isWeb ? button ? !!button.closest("form") : !0 : !1, [frameWidth, setFrameWidth] = React.useState(0), [checked = !1, setChecked] = useControllableState({
|
|
101
86
|
prop: checkedProp,
|
|
102
87
|
defaultProp: defaultChecked || !1,
|
|
103
88
|
onChange: onCheckedChange,
|
|
104
89
|
transition: !0
|
|
105
90
|
});
|
|
106
91
|
if (shouldRenderMobileNative)
|
|
107
|
-
return /* @__PURE__ */
|
|
108
|
-
|
|
92
|
+
return /* @__PURE__ */ jsx(
|
|
93
|
+
NativeSwitch,
|
|
109
94
|
{
|
|
110
95
|
value: checkedProp,
|
|
111
96
|
onValueChange: onCheckedChange,
|
|
112
97
|
...nativeProps
|
|
113
98
|
}
|
|
114
99
|
);
|
|
115
|
-
|
|
100
|
+
isWeb || React.useEffect(() => {
|
|
116
101
|
if (props.id)
|
|
117
|
-
return
|
|
102
|
+
return registerFocusable(props.id, {
|
|
118
103
|
focus: () => {
|
|
119
104
|
setChecked((x) => !x);
|
|
120
105
|
}
|
|
121
106
|
});
|
|
122
107
|
}, [props.id, setChecked]);
|
|
123
|
-
const isInsideButton = React.useContext(
|
|
124
|
-
return /* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */
|
|
108
|
+
const isInsideButton = React.useContext(ButtonNestingContext);
|
|
109
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
110
|
+
/* @__PURE__ */ jsx(ButtonNestingContext.Provider, { value: !0, children: /* @__PURE__ */ jsx(
|
|
126
111
|
Frame,
|
|
127
112
|
{
|
|
128
113
|
tag: isInsideButton ? "span" : "button",
|
|
@@ -146,11 +131,11 @@ function createSwitch(createProps) {
|
|
|
146
131
|
value,
|
|
147
132
|
...switchProps,
|
|
148
133
|
ref: composedRefs,
|
|
149
|
-
onPress:
|
|
150
|
-
setChecked((prevChecked) => !prevChecked),
|
|
134
|
+
onPress: composeEventHandlers(props.onPress, (event) => {
|
|
135
|
+
setChecked((prevChecked) => !prevChecked), isWeb && isFormControl && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
151
136
|
}),
|
|
152
|
-
children: /* @__PURE__ */
|
|
153
|
-
|
|
137
|
+
children: /* @__PURE__ */ jsx(
|
|
138
|
+
YStack,
|
|
154
139
|
{
|
|
155
140
|
alignSelf: "stretch",
|
|
156
141
|
flex: 1,
|
|
@@ -162,7 +147,7 @@ function createSwitch(createProps) {
|
|
|
162
147
|
)
|
|
163
148
|
}
|
|
164
149
|
) }),
|
|
165
|
-
|
|
150
|
+
isWeb && isFormControl && /* @__PURE__ */ jsx(
|
|
166
151
|
BubbleInput,
|
|
167
152
|
{
|
|
168
153
|
control: button,
|
|
@@ -181,7 +166,7 @@ function createSwitch(createProps) {
|
|
|
181
166
|
disableTheme: !0
|
|
182
167
|
}
|
|
183
168
|
), BubbleInput = (props) => {
|
|
184
|
-
const { control, checked, bubbles = !0, ...inputProps } = props, ref = React.useRef(null), prevChecked =
|
|
169
|
+
const { control, checked, bubbles = !0, ...inputProps } = props, ref = React.useRef(null), prevChecked = usePrevious(checked);
|
|
185
170
|
return React.useEffect(() => {
|
|
186
171
|
const input = ref.current, inputProto = window.HTMLInputElement.prototype, setChecked = Object.getOwnPropertyDescriptor(
|
|
187
172
|
inputProto,
|
|
@@ -192,7 +177,7 @@ function createSwitch(createProps) {
|
|
|
192
177
|
setChecked.call(input, checked), input.dispatchEvent(event);
|
|
193
178
|
}
|
|
194
179
|
}, [prevChecked, checked, bubbles]), // @ts-ignore
|
|
195
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ jsx(
|
|
196
181
|
"input",
|
|
197
182
|
{
|
|
198
183
|
type: "checkbox",
|
|
@@ -215,12 +200,11 @@ function createSwitch(createProps) {
|
|
|
215
200
|
function getState(checked) {
|
|
216
201
|
return checked ? "checked" : "unchecked";
|
|
217
202
|
}
|
|
218
|
-
return
|
|
203
|
+
return withStaticProperties(SwitchComponent, {
|
|
219
204
|
Thumb: SwitchThumbComponent
|
|
220
205
|
});
|
|
221
206
|
}
|
|
222
|
-
|
|
223
|
-
0 && (module.exports = {
|
|
207
|
+
export {
|
|
224
208
|
createSwitch
|
|
225
|
-
}
|
|
209
|
+
};
|
|
226
210
|
//# sourceMappingURL=createSwitch.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createSwitch.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": [
|
|
4
|
+
"mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,aAAa;AAEtB,SAA4C,gBAAgB;AAC5D,SAAS,yBAAyB;AAClC,SAAS,sBAAsB,4BAA4B;AAC3D,SAAS,uBAAuB;AAChC,SAAS,sBAAsB,cAAc;AAC7C,SAAS,4BAA4B;AACrC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AA,EAC/B;AAMA,SAJe,qBAAqB,iBAAiB;AAAA,IACnD,OAAO;AAAA,EACT,CAAC;AAGH;",
|
|
5
|
+
"names": []
|
|
6
6
|
}
|
package/dist/jsx/index.native.js
CHANGED
|
@@ -1,36 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
-
var src_exports = {};
|
|
17
|
-
__export(src_exports, {
|
|
18
|
-
Switch: () => Switch
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(src_exports);
|
|
21
|
-
var import_createSwitch = require("./createSwitch"), import_Switch = require("./Switch");
|
|
22
|
-
__reExport(src_exports, require("./Switch"), module.exports);
|
|
23
|
-
__reExport(src_exports, require("./SwitchContext"), module.exports);
|
|
24
|
-
__reExport(src_exports, require("./createSwitch"), module.exports);
|
|
25
|
-
const Switch = (0, import_createSwitch.createSwitch)({
|
|
26
|
-
Frame: import_Switch.SwitchFrame,
|
|
27
|
-
Thumb: import_Switch.SwitchThumb
|
|
28
|
-
});
|
|
29
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
-
0 && (module.exports = {
|
|
31
|
-
Switch,
|
|
32
|
-
...require("./Switch"),
|
|
33
|
-
...require("./SwitchContext"),
|
|
34
|
-
...require("./createSwitch")
|
|
1
|
+
import { createSwitch } from "./createSwitch";
|
|
2
|
+
import { SwitchFrame, SwitchThumb } from "./Switch";
|
|
3
|
+
export * from "./Switch";
|
|
4
|
+
export * from "./SwitchContext";
|
|
5
|
+
export * from "./createSwitch";
|
|
6
|
+
const Switch = createSwitch({
|
|
7
|
+
Frame: SwitchFrame,
|
|
8
|
+
Thumb: SwitchThumb
|
|
35
9
|
});
|
|
10
|
+
export {
|
|
11
|
+
Switch
|
|
12
|
+
};
|
|
36
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "
|
|
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
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/switch",
|
|
3
|
-
"version": "1.88.
|
|
3
|
+
"version": "1.88.23",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -32,23 +32,23 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@tamagui/compose-refs": "1.88.
|
|
36
|
-
"@tamagui/constants": "1.88.
|
|
37
|
-
"@tamagui/core": "1.88.
|
|
38
|
-
"@tamagui/focusable": "1.88.
|
|
39
|
-
"@tamagui/get-token": "1.88.
|
|
40
|
-
"@tamagui/helpers": "1.88.
|
|
41
|
-
"@tamagui/label": "1.88.
|
|
42
|
-
"@tamagui/stacks": "1.88.
|
|
43
|
-
"@tamagui/use-controllable-state": "1.88.
|
|
44
|
-
"@tamagui/use-previous": "1.88.
|
|
35
|
+
"@tamagui/compose-refs": "1.88.23",
|
|
36
|
+
"@tamagui/constants": "1.88.23",
|
|
37
|
+
"@tamagui/core": "1.88.23",
|
|
38
|
+
"@tamagui/focusable": "1.88.23",
|
|
39
|
+
"@tamagui/get-token": "1.88.23",
|
|
40
|
+
"@tamagui/helpers": "1.88.23",
|
|
41
|
+
"@tamagui/label": "1.88.23",
|
|
42
|
+
"@tamagui/stacks": "1.88.23",
|
|
43
|
+
"@tamagui/use-controllable-state": "1.88.23",
|
|
44
|
+
"@tamagui/use-previous": "1.88.23"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "*",
|
|
48
48
|
"react-native": "*"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@tamagui/build": "1.88.
|
|
51
|
+
"@tamagui/build": "1.88.23",
|
|
52
52
|
"react": "^18.2.0",
|
|
53
53
|
"react-native": "^0.72.6"
|
|
54
54
|
},
|