@tamagui/switch 2.7.7 → 3.0.0-beta.1093.1
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/cjs/StyledContext.cjs +18 -23
- package/dist/cjs/StyledContext.native.cjs +32 -0
- package/dist/cjs/StyledContext.native.js +18 -22
- package/dist/cjs/StyledContext.native.js.map +1 -1
- package/dist/cjs/Switch.cjs +139 -86
- package/dist/cjs/Switch.native.cjs +162 -0
- package/dist/cjs/Switch.native.js +146 -90
- package/dist/cjs/Switch.native.js.map +1 -1
- package/dist/cjs/index.cjs +13 -25
- package/dist/cjs/index.native.cjs +30 -0
- package/dist/cjs/index.native.js +14 -25
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/types.cjs +9 -11
- package/dist/cjs/types.native.cjs +18 -0
- package/dist/cjs/types.native.js +9 -10
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/useSwitchNative.cjs +15 -19
- package/dist/cjs/useSwitchNative.native.cjs +64 -0
- package/dist/cjs/useSwitchNative.native.js +43 -54
- package/dist/cjs/useSwitchNative.native.js.map +1 -1
- package/dist/esm/StyledContext.mjs +6 -5
- package/dist/esm/StyledContext.mjs.map +1 -1
- package/dist/esm/StyledContext.native.js +6 -5
- package/dist/esm/StyledContext.native.js.map +1 -1
- package/dist/esm/Switch.mjs +119 -71
- package/dist/esm/Switch.mjs.map +1 -1
- package/dist/esm/Switch.native.js +126 -76
- package/dist/esm/Switch.native.js.map +1 -1
- package/dist/esm/index.js +8 -12
- package/dist/esm/index.mjs +8 -12
- package/dist/esm/index.native.js +8 -12
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.native.js +0 -2
- package/dist/esm/useSwitchNative.mjs +2 -1
- package/dist/esm/useSwitchNative.mjs.map +1 -1
- package/dist/esm/useSwitchNative.native.js +30 -31
- package/dist/esm/useSwitchNative.native.js.map +1 -1
- package/dist/jsx/StyledContext.mjs +6 -5
- package/dist/jsx/StyledContext.mjs.map +1 -1
- package/dist/jsx/StyledContext.native.cjs +32 -0
- package/dist/jsx/StyledContext.native.js +18 -22
- package/dist/jsx/StyledContext.native.js.map +1 -1
- package/dist/jsx/Switch.mjs +119 -71
- package/dist/jsx/Switch.mjs.map +1 -1
- package/dist/jsx/Switch.native.cjs +162 -0
- package/dist/jsx/Switch.native.js +146 -90
- package/dist/jsx/Switch.native.js.map +1 -1
- package/dist/jsx/index.js +8 -12
- package/dist/jsx/index.mjs +8 -12
- package/dist/jsx/index.native.cjs +30 -0
- package/dist/jsx/index.native.js +14 -25
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/types.mjs +0 -2
- package/dist/jsx/types.native.cjs +18 -0
- package/dist/jsx/types.native.js +9 -10
- package/dist/jsx/types.native.js.map +1 -1
- package/dist/jsx/useSwitchNative.mjs +2 -1
- package/dist/jsx/useSwitchNative.mjs.map +1 -1
- package/dist/jsx/useSwitchNative.native.cjs +64 -0
- package/dist/jsx/useSwitchNative.native.js +43 -54
- package/dist/jsx/useSwitchNative.native.js.map +1 -1
- package/package.json +10 -15
- package/src/StyledContext.tsx +1 -3
- package/src/Switch.tsx +190 -89
- package/src/index.ts +0 -20
- package/src/types.ts +7 -6
- package/types/StyledContext.d.ts +2 -3
- package/types/StyledContext.d.ts.map +1 -1
- package/types/Switch.d.ts +209 -37
- package/types/Switch.d.ts.map +1 -1
- package/types/index.d.ts +0 -146
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +4 -5
- package/types/types.d.ts.map +1 -1
- package/dist/cjs/createSwitch.cjs +0 -186
- package/dist/cjs/createSwitch.native.js +0 -194
- package/dist/cjs/createSwitch.native.js.map +0 -1
- package/dist/esm/createSwitch.mjs +0 -150
- package/dist/esm/createSwitch.mjs.map +0 -1
- package/dist/esm/createSwitch.native.js +0 -155
- package/dist/esm/createSwitch.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js.map +0 -1
- package/dist/jsx/createSwitch.mjs +0 -150
- package/dist/jsx/createSwitch.mjs.map +0 -1
- package/dist/jsx/createSwitch.native.js +0 -194
- package/dist/jsx/createSwitch.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
- package/dist/jsx/types.mjs.map +0 -1
- package/src/Switch.draggable-tmp +0 -340
- package/src/createSwitch.tsx +0 -201
- package/types/createSwitch.d.ts +0 -141
- package/types/createSwitch.d.ts.map +0 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
27
|
+
}) : target, mod));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Switch_exports = {};
|
|
30
|
+
__export(Switch_exports, {
|
|
31
|
+
Switch: () => Switch,
|
|
32
|
+
SwitchFrame: () => SwitchFrame,
|
|
33
|
+
SwitchThumb: () => SwitchThumb,
|
|
34
|
+
SwitchThumbFrame: () => SwitchThumbFrame,
|
|
35
|
+
createSwitch: () => createSwitch
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(Switch_exports);
|
|
38
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
+
var import_core = require("@tamagui/core");
|
|
40
|
+
var import_switch_headless = require("@tamagui/switch-headless");
|
|
41
|
+
var import_use_controllable_state = require("@tamagui/use-controllable-state");
|
|
42
|
+
var React = __toESM(require("react"), 1);
|
|
43
|
+
var import_StyledContext = require("./StyledContext.native.js");
|
|
44
|
+
var import_useSwitchNative = require("./useSwitchNative.native.js");
|
|
45
|
+
var SwitchThumbFrame = (0, import_core.styled)(import_core.View, {
|
|
46
|
+
displayName: "SwitchThumb",
|
|
47
|
+
context: import_StyledContext.SwitchStyledContext
|
|
48
|
+
});
|
|
49
|
+
var SwitchFrame = (0, import_core.styled)(import_core.View, {
|
|
50
|
+
displayName: "Switch",
|
|
51
|
+
context: import_StyledContext.SwitchStyledContext,
|
|
52
|
+
render: "button",
|
|
53
|
+
tabIndex: 0
|
|
54
|
+
});
|
|
55
|
+
function createSwitch(createProps) {
|
|
56
|
+
var _createProps_Frame;
|
|
57
|
+
var Frame = (_createProps_Frame = createProps.Frame) !== null && _createProps_Frame !== void 0 ? _createProps_Frame : SwitchFrame;
|
|
58
|
+
var _createProps_Thumb;
|
|
59
|
+
var Thumb = (_createProps_Thumb = createProps.Thumb) !== null && _createProps_Thumb !== void 0 ? _createProps_Thumb : SwitchThumbFrame;
|
|
60
|
+
Frame.staticConfig.context = import_StyledContext.SwitchStyledContext;
|
|
61
|
+
Thumb.staticConfig.context = import_StyledContext.SwitchStyledContext;
|
|
62
|
+
var SwitchThumbComponent = (0, import_core.createStyledHOC)(Thumb, function SwitchThumb2(props, forwardedRef) {
|
|
63
|
+
var _createProps_componentThemes;
|
|
64
|
+
var { size: sizeProp, activeStyle, theme, ...thumbProps } = props;
|
|
65
|
+
var styledContext = import_StyledContext.SwitchStyledContext.useStyledContext();
|
|
66
|
+
var { size: sizeContext, active, disabled, frameWidth = 0 } = styledContext;
|
|
67
|
+
var _ref;
|
|
68
|
+
var size = (_ref = sizeProp !== null && sizeProp !== void 0 ? sizeProp : sizeContext) !== null && _ref !== void 0 ? _ref : true;
|
|
69
|
+
var initialChecked = React.useRef(active).current;
|
|
70
|
+
var initialWidth = (0, import_core.getVariableValue)(props.width, "size");
|
|
71
|
+
var [thumbWidth, setThumbWidth] = React.useState(typeof initialWidth === "number" ? initialWidth : 0);
|
|
72
|
+
var distance = frameWidth - thumbWidth;
|
|
73
|
+
var x = initialChecked ? active ? 0 : -distance : active ? distance : 0;
|
|
74
|
+
var thumb = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Thumb, {
|
|
75
|
+
ref: forwardedRef,
|
|
76
|
+
size,
|
|
77
|
+
alignSelf: initialChecked ? "flex-end" : "flex-start",
|
|
78
|
+
x,
|
|
79
|
+
onLayout: (0, import_core.composeEventHandlers)(props.onLayout, function(event) {
|
|
80
|
+
setThumbWidth(event.nativeEvent.layout.width);
|
|
81
|
+
}),
|
|
82
|
+
disabled,
|
|
83
|
+
...thumbProps,
|
|
84
|
+
...active && activeStyle
|
|
85
|
+
});
|
|
86
|
+
var themeName = theme !== null && theme !== void 0 ? theme : (_createProps_componentThemes = createProps.componentThemes) === null || _createProps_componentThemes === void 0 ? void 0 : _createProps_componentThemes.thumb;
|
|
87
|
+
return themeName ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {
|
|
88
|
+
name: themeName,
|
|
89
|
+
children: thumb
|
|
90
|
+
}) : thumb;
|
|
91
|
+
});
|
|
92
|
+
var SwitchComponent = (0, import_core.createStyledHOC)(Frame, function Switch2(_props, forwardedRef) {
|
|
93
|
+
var _createProps_componentThemes;
|
|
94
|
+
var { native, nativeProps, checked: checkedProp, defaultChecked, onCheckedChange, activeStyle, activeTheme, theme, ...props } = _props;
|
|
95
|
+
var [checked, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
96
|
+
prop: checkedProp,
|
|
97
|
+
defaultProp: defaultChecked || false,
|
|
98
|
+
onChange: onCheckedChange,
|
|
99
|
+
transition: true
|
|
100
|
+
});
|
|
101
|
+
var styledContext = React.useContext(import_StyledContext.SwitchStyledContext.context);
|
|
102
|
+
var [frameWidth, setFrameInnerWidth] = React.useState(0);
|
|
103
|
+
var { switchProps, bubbleInput, switchRef } = (0, import_switch_headless.useSwitch)(props, [checked, setChecked], forwardedRef);
|
|
104
|
+
var nativeSwitch = (0, import_useSwitchNative.useSwitchNative)({
|
|
105
|
+
id: props.id,
|
|
106
|
+
disabled: props.disabled,
|
|
107
|
+
native,
|
|
108
|
+
nativeProps,
|
|
109
|
+
checked,
|
|
110
|
+
setChecked
|
|
111
|
+
});
|
|
112
|
+
if (nativeSwitch) {
|
|
113
|
+
return nativeSwitch;
|
|
114
|
+
}
|
|
115
|
+
var disabled = props.disabled;
|
|
116
|
+
var _styledContext_size, _ref;
|
|
117
|
+
var size = (_ref = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref !== void 0 ? _ref : true;
|
|
118
|
+
var handleLayout = function(event) {
|
|
119
|
+
var next = event.nativeEvent.layout.width;
|
|
120
|
+
if (next !== frameWidth) {
|
|
121
|
+
setFrameInnerWidth(next);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var frame = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Frame, {
|
|
125
|
+
ref: switchRef,
|
|
126
|
+
render: "button",
|
|
127
|
+
...import_core.isWeb && { type: "button" },
|
|
128
|
+
size,
|
|
129
|
+
...props,
|
|
130
|
+
...switchProps,
|
|
131
|
+
disabled,
|
|
132
|
+
...checked && activeStyle,
|
|
133
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.View, {
|
|
134
|
+
alignSelf: "stretch",
|
|
135
|
+
flex: 1,
|
|
136
|
+
onLayout: handleLayout,
|
|
137
|
+
children: props.children
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
var _ref1, _ref2;
|
|
141
|
+
var frameTheme = (_ref2 = (_ref1 = checked ? activeTheme : void 0) !== null && _ref1 !== void 0 ? _ref1 : theme) !== null && _ref2 !== void 0 ? _ref2 : (_createProps_componentThemes = createProps.componentThemes) === null || _createProps_componentThemes === void 0 ? void 0 : _createProps_componentThemes.frame;
|
|
142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StyledContext.SwitchStyledContext.Provider, {
|
|
143
|
+
size,
|
|
144
|
+
active: checked,
|
|
145
|
+
disabled,
|
|
146
|
+
frameWidth,
|
|
147
|
+
children: frameTheme ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {
|
|
148
|
+
name: frameTheme,
|
|
149
|
+
children: frame
|
|
150
|
+
}) : frame
|
|
151
|
+
}), bubbleInput] });
|
|
152
|
+
}, { disableTheme: true });
|
|
153
|
+
return (0, import_core.withStaticProperties)(SwitchComponent, {
|
|
154
|
+
Frame,
|
|
155
|
+
Thumb: SwitchThumbComponent
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
var Switch = createSwitch({
|
|
159
|
+
Frame: SwitchFrame,
|
|
160
|
+
Thumb: SwitchThumbFrame
|
|
161
|
+
});
|
|
162
|
+
var SwitchThumb = Switch.Thumb;
|
|
@@ -1,108 +1,164 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
9
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
12
14
|
};
|
|
13
15
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
21
23
|
};
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
27
|
+
}) : target, mod));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
29
|
var Switch_exports = {};
|
|
26
30
|
__export(Switch_exports, {
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
Switch: () => Switch,
|
|
32
|
+
SwitchFrame: () => SwitchFrame,
|
|
33
|
+
SwitchThumb: () => SwitchThumb,
|
|
34
|
+
SwitchThumbFrame: () => SwitchThumbFrame,
|
|
35
|
+
createSwitch: () => createSwitch
|
|
29
36
|
});
|
|
30
37
|
module.exports = __toCommonJS(Switch_exports);
|
|
38
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
39
|
var import_core = require("@tamagui/core");
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
backgroundColor: "$background",
|
|
41
|
-
borderRadius: 1e3
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
size: {
|
|
45
|
-
"...size": function (val) {
|
|
46
|
-
var size = getSwitchHeight(val);
|
|
47
|
-
return {
|
|
48
|
-
height: size,
|
|
49
|
-
width: size
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
defaultVariants: {
|
|
55
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
56
|
-
}
|
|
57
|
-
}, {
|
|
58
|
-
accept: {
|
|
59
|
-
activeStyle: "style"
|
|
60
|
-
}
|
|
40
|
+
var import_switch_headless = require("@tamagui/switch-headless");
|
|
41
|
+
var import_use_controllable_state = require("@tamagui/use-controllable-state");
|
|
42
|
+
var React = __toESM(require("react"), 1);
|
|
43
|
+
var import_StyledContext = require("./StyledContext.native.js");
|
|
44
|
+
var import_useSwitchNative = require("./useSwitchNative.native.js");
|
|
45
|
+
var SwitchThumbFrame = (0, import_core.styled)(import_core.View, {
|
|
46
|
+
displayName: "SwitchThumb",
|
|
47
|
+
context: import_StyledContext.SwitchStyledContext
|
|
61
48
|
});
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
var SwitchFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
69
|
-
name: "Switch",
|
|
70
|
-
render: "button",
|
|
71
|
-
tabIndex: 0,
|
|
72
|
-
variants: {
|
|
73
|
-
unstyled: {
|
|
74
|
-
false: {
|
|
75
|
-
borderRadius: 1e3,
|
|
76
|
-
backgroundColor: "$background",
|
|
77
|
-
focusVisibleStyle: {
|
|
78
|
-
outlineColor: "$outlineColor",
|
|
79
|
-
outlineStyle: "solid",
|
|
80
|
-
outlineWidth: 2
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
size: {
|
|
85
|
-
"...size": function (val, param) {
|
|
86
|
-
var {
|
|
87
|
-
props
|
|
88
|
-
} = param;
|
|
89
|
-
if (props["unstyled"]) return;
|
|
90
|
-
var height = getSwitchHeight(val);
|
|
91
|
-
var width = getSwitchWidth(val);
|
|
92
|
-
return {
|
|
93
|
-
height,
|
|
94
|
-
minHeight: height,
|
|
95
|
-
width
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
defaultVariants: {
|
|
101
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
102
|
-
}
|
|
103
|
-
}, {
|
|
104
|
-
accept: {
|
|
105
|
-
activeStyle: "style"
|
|
106
|
-
}
|
|
49
|
+
var SwitchFrame = (0, import_core.styled)(import_core.View, {
|
|
50
|
+
displayName: "Switch",
|
|
51
|
+
context: import_StyledContext.SwitchStyledContext,
|
|
52
|
+
render: "button",
|
|
53
|
+
tabIndex: 0
|
|
107
54
|
});
|
|
55
|
+
function createSwitch(createProps) {
|
|
56
|
+
var _createProps_Frame;
|
|
57
|
+
var Frame = (_createProps_Frame = createProps.Frame) !== null && _createProps_Frame !== void 0 ? _createProps_Frame : SwitchFrame;
|
|
58
|
+
var _createProps_Thumb;
|
|
59
|
+
var Thumb = (_createProps_Thumb = createProps.Thumb) !== null && _createProps_Thumb !== void 0 ? _createProps_Thumb : SwitchThumbFrame;
|
|
60
|
+
Frame.staticConfig.context = import_StyledContext.SwitchStyledContext;
|
|
61
|
+
Thumb.staticConfig.context = import_StyledContext.SwitchStyledContext;
|
|
62
|
+
var SwitchThumbComponent = (0, import_core.createStyledHOC)(Thumb, function SwitchThumb2(props, forwardedRef) {
|
|
63
|
+
var _createProps_componentThemes;
|
|
64
|
+
var { size: sizeProp, activeStyle, theme, ...thumbProps } = props;
|
|
65
|
+
var styledContext = import_StyledContext.SwitchStyledContext.useStyledContext();
|
|
66
|
+
var { size: sizeContext, active, disabled, frameWidth = 0 } = styledContext;
|
|
67
|
+
var _ref;
|
|
68
|
+
var size = (_ref = sizeProp !== null && sizeProp !== void 0 ? sizeProp : sizeContext) !== null && _ref !== void 0 ? _ref : true;
|
|
69
|
+
var initialChecked = React.useRef(active).current;
|
|
70
|
+
var initialWidth = (0, import_core.getVariableValue)(props.width, "size");
|
|
71
|
+
var [thumbWidth, setThumbWidth] = React.useState(typeof initialWidth === "number" ? initialWidth : 0);
|
|
72
|
+
var distance = frameWidth - thumbWidth;
|
|
73
|
+
var x = initialChecked ? active ? 0 : -distance : active ? distance : 0;
|
|
74
|
+
var thumb = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Thumb, {
|
|
75
|
+
ref: forwardedRef,
|
|
76
|
+
size,
|
|
77
|
+
alignSelf: initialChecked ? "flex-end" : "flex-start",
|
|
78
|
+
x,
|
|
79
|
+
onLayout: (0, import_core.composeEventHandlers)(props.onLayout, function(event) {
|
|
80
|
+
setThumbWidth(event.nativeEvent.layout.width);
|
|
81
|
+
}),
|
|
82
|
+
disabled,
|
|
83
|
+
...thumbProps,
|
|
84
|
+
...active && activeStyle
|
|
85
|
+
});
|
|
86
|
+
var themeName = theme !== null && theme !== void 0 ? theme : (_createProps_componentThemes = createProps.componentThemes) === null || _createProps_componentThemes === void 0 ? void 0 : _createProps_componentThemes.thumb;
|
|
87
|
+
return themeName ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {
|
|
88
|
+
name: themeName,
|
|
89
|
+
children: thumb
|
|
90
|
+
}) : thumb;
|
|
91
|
+
});
|
|
92
|
+
var SwitchComponent = (0, import_core.createStyledHOC)(Frame, function Switch2(_props, forwardedRef) {
|
|
93
|
+
var _createProps_componentThemes;
|
|
94
|
+
var { native, nativeProps, checked: checkedProp, defaultChecked, onCheckedChange, activeStyle, activeTheme, theme, ...props } = _props;
|
|
95
|
+
var [checked, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
96
|
+
prop: checkedProp,
|
|
97
|
+
defaultProp: defaultChecked || false,
|
|
98
|
+
onChange: onCheckedChange,
|
|
99
|
+
transition: true
|
|
100
|
+
});
|
|
101
|
+
var styledContext = React.useContext(import_StyledContext.SwitchStyledContext.context);
|
|
102
|
+
var [frameWidth, setFrameInnerWidth] = React.useState(0);
|
|
103
|
+
var { switchProps, bubbleInput, switchRef } = (0, import_switch_headless.useSwitch)(props, [checked, setChecked], forwardedRef);
|
|
104
|
+
var nativeSwitch = (0, import_useSwitchNative.useSwitchNative)({
|
|
105
|
+
id: props.id,
|
|
106
|
+
disabled: props.disabled,
|
|
107
|
+
native,
|
|
108
|
+
nativeProps,
|
|
109
|
+
checked,
|
|
110
|
+
setChecked
|
|
111
|
+
});
|
|
112
|
+
if (nativeSwitch) {
|
|
113
|
+
return nativeSwitch;
|
|
114
|
+
}
|
|
115
|
+
var disabled = props.disabled;
|
|
116
|
+
var _styledContext_size, _ref;
|
|
117
|
+
var size = (_ref = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref !== void 0 ? _ref : true;
|
|
118
|
+
var handleLayout = function(event) {
|
|
119
|
+
var next = event.nativeEvent.layout.width;
|
|
120
|
+
if (next !== frameWidth) {
|
|
121
|
+
setFrameInnerWidth(next);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var frame = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Frame, {
|
|
125
|
+
ref: switchRef,
|
|
126
|
+
render: "button",
|
|
127
|
+
...import_core.isWeb && { type: "button" },
|
|
128
|
+
size,
|
|
129
|
+
...props,
|
|
130
|
+
...switchProps,
|
|
131
|
+
disabled,
|
|
132
|
+
...checked && activeStyle,
|
|
133
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.View, {
|
|
134
|
+
alignSelf: "stretch",
|
|
135
|
+
flex: 1,
|
|
136
|
+
onLayout: handleLayout,
|
|
137
|
+
children: props.children
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
var _ref1, _ref2;
|
|
141
|
+
var frameTheme = (_ref2 = (_ref1 = checked ? activeTheme : void 0) !== null && _ref1 !== void 0 ? _ref1 : theme) !== null && _ref2 !== void 0 ? _ref2 : (_createProps_componentThemes = createProps.componentThemes) === null || _createProps_componentThemes === void 0 ? void 0 : _createProps_componentThemes.frame;
|
|
142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StyledContext.SwitchStyledContext.Provider, {
|
|
143
|
+
size,
|
|
144
|
+
active: checked,
|
|
145
|
+
disabled,
|
|
146
|
+
frameWidth,
|
|
147
|
+
children: frameTheme ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {
|
|
148
|
+
name: frameTheme,
|
|
149
|
+
children: frame
|
|
150
|
+
}) : frame
|
|
151
|
+
}), bubbleInput] });
|
|
152
|
+
}, { disableTheme: true });
|
|
153
|
+
return (0, import_core.withStaticProperties)(SwitchComponent, {
|
|
154
|
+
Frame,
|
|
155
|
+
Thumb: SwitchThumbComponent
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
var Switch = createSwitch({
|
|
159
|
+
Frame: SwitchFrame,
|
|
160
|
+
Thumb: SwitchThumbFrame
|
|
161
|
+
});
|
|
162
|
+
var SwitchThumb = Switch.Thumb;
|
|
163
|
+
|
|
108
164
|
//# sourceMappingURL=Switch.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","Switch_exports","SwitchFrame","SwitchThumb","module","exports","import_core","require","import_get_token","import_stacks","styled","YStack","variants","unstyled","false","size","backgroundColor","borderRadius","...size","val","getSwitchHeight","height","width","defaultVariants","process","env","TAMAGUI_HEADLESS","accept","activeStyle","Math","round","getVariableValue","getSize","getSwitchWidth","render","tabIndex","focusVisibleStyle","outlineColor","outlineStyle","outlineWidth"],"sources":["../../src/Switch.tsx"],"sourcesContent":[null],"mappings":"AACA,YAAS;;AACT,IAAAA,SAAS,GAAAC,MAAA,CAAAC,cAAe;AACxB,IAAAC,gBAAS,GAAcF,MAAA,CAAAG,wBAAA;AAEhB,IAAAC,iBAAoB,GAAAJ,MAAA,CAAAK,mBAAA;AAAA,IACzBC,YAAA,GAAAN,MAAA,CAAAO,SAAA,CAAAC,cAAA;AAAA,IACAC,QAAA,GAAAA,CAAAC,MAAA,EAAAC,GAAA;EAAA,KACE,IAAMC,IAAA,IAAAD,GAAA,EAENZ,SAAA,CAAUW,MAAA,EAAAE,IAAA;IAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;IAAAE,UAAA;EAAA;AAAA;AACE,IAAAC,WACD,GAAAA,CAAAC,EAAA,EAAAC,IAAA,EAAAC,MAAA,EAAAC,IAAA;EAAA,IAAAF,IACL,WAAMA,IAAA,wBAAAA,IAAA;IAAA,SACNG,GAAA,IAAAhB,iBAAiB,CAAAa,IAAA,OACjB,CAAAX,YAAA,CAAce,IAAA,CAAAL,EAAA,EAAAI,GAAA,KAAAA,GAAA,KAAAF,MAAA,EAChBnB,SAAA,CAAAiB,EAAA,EAAAI,GAAA;MAAAP,GAAA,EAAAA,CAAA,KAAAI,IAAA,CAAAG,GAAA;MAAAN,UAAA,IAAAK,IAAA,GAAAjB,gBAAA,CAAAe,IAAA,EAAAG,GAAA,MAAAD,IAAA,CAAAL;IAAA;EAAA;E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FC,KAAA;QAEAG,YAAA,EAAiB;QACfD,eAAU,EAAQ,aAAI;QACxBoB,iBAAA;UACFC,YAAA;UACAC,YAAA;UACEC,YAAQ;QACN;MACF;IACF;IACFxB,IAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Switch.native.js","names":[],"sources":["jsx/Switch.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Switch_exports = {};\n__export(Switch_exports, {\n Switch: () => Switch,\n SwitchFrame: () => SwitchFrame,\n SwitchThumb: () => SwitchThumb,\n SwitchThumbFrame: () => SwitchThumbFrame,\n createSwitch: () => createSwitch\n});\nmodule.exports = __toCommonJS(Switch_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_core = require(\"@tamagui/core\");\nvar import_switch_headless = require(\"@tamagui/switch-headless\");\nvar import_use_controllable_state = require(\"@tamagui/use-controllable-state\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_StyledContext = require(\"./StyledContext\");\nvar import_useSwitchNative = require(\"./useSwitchNative\");\nvar SwitchThumbFrame = (0, import_core.styled)(import_core.View, {\n displayName: \"SwitchThumb\",\n context: import_StyledContext.SwitchStyledContext\n});\nvar SwitchFrame = (0, import_core.styled)(import_core.View, {\n displayName: \"Switch\",\n context: import_StyledContext.SwitchStyledContext,\n render: \"button\",\n tabIndex: 0\n});\nfunction createSwitch(createProps) {\n var _createProps_Frame;\n var Frame = (_createProps_Frame = createProps.Frame) !== null && _createProps_Frame !== void 0 ? _createProps_Frame : SwitchFrame;\n var _createProps_Thumb;\n var Thumb = (_createProps_Thumb = createProps.Thumb) !== null && _createProps_Thumb !== void 0 ? _createProps_Thumb : SwitchThumbFrame;\n Frame.staticConfig.context = import_StyledContext.SwitchStyledContext;\n Thumb.staticConfig.context = import_StyledContext.SwitchStyledContext;\n var SwitchThumbComponent = (0, import_core.createStyledHOC)(Thumb, function SwitchThumb2(props, forwardedRef) {\n var _createProps_componentThemes;\n var { size: sizeProp, activeStyle, theme, ...thumbProps } = props;\n var styledContext = import_StyledContext.SwitchStyledContext.useStyledContext();\n var { size: sizeContext, active, disabled, frameWidth = 0 } = styledContext;\n var _ref;\n var size = (_ref = sizeProp !== null && sizeProp !== void 0 ? sizeProp : sizeContext) !== null && _ref !== void 0 ? _ref : true;\n var initialChecked = React.useRef(active).current;\n var initialWidth = (0, import_core.getVariableValue)(props.width, \"size\");\n var [thumbWidth, setThumbWidth] = React.useState(typeof initialWidth === \"number\" ? initialWidth : 0);\n var distance = frameWidth - thumbWidth;\n var x = initialChecked ? active ? 0 : -distance : active ? distance : 0;\n var thumb = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Thumb, {\n ref: forwardedRef,\n size,\n alignSelf: initialChecked ? \"flex-end\" : \"flex-start\",\n x,\n onLayout: (0, import_core.composeEventHandlers)(props.onLayout, function(event) {\n setThumbWidth(event.nativeEvent.layout.width);\n }),\n disabled,\n ...thumbProps,\n ...active && activeStyle\n });\n var themeName = theme !== null && theme !== void 0 ? theme : (_createProps_componentThemes = createProps.componentThemes) === null || _createProps_componentThemes === void 0 ? void 0 : _createProps_componentThemes.thumb;\n return themeName ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {\n name: themeName,\n children: thumb\n }) : thumb;\n });\n var SwitchComponent = (0, import_core.createStyledHOC)(Frame, function Switch2(_props, forwardedRef) {\n var _createProps_componentThemes;\n var { native, nativeProps, checked: checkedProp, defaultChecked, onCheckedChange, activeStyle, activeTheme, theme, ...props } = _props;\n var [checked, setChecked] = (0, import_use_controllable_state.useControllableState)({\n prop: checkedProp,\n defaultProp: defaultChecked || false,\n onChange: onCheckedChange,\n transition: true\n });\n var styledContext = React.useContext(import_StyledContext.SwitchStyledContext.context);\n var [frameWidth, setFrameInnerWidth] = React.useState(0);\n var { switchProps, bubbleInput, switchRef } = (0, import_switch_headless.useSwitch)(\n props,\n [\n checked,\n setChecked\n ],\n // @ts-ignore TODO tamagui react 19 type error\n forwardedRef\n );\n var nativeSwitch = (0, import_useSwitchNative.useSwitchNative)({\n id: props.id,\n disabled: props.disabled,\n native,\n nativeProps,\n checked,\n setChecked\n });\n if (nativeSwitch) {\n return nativeSwitch;\n }\n var disabled = props.disabled;\n var _styledContext_size, _ref;\n var size = (_ref = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref !== void 0 ? _ref : true;\n var handleLayout = function(event) {\n var next = event.nativeEvent.layout.width;\n if (next !== frameWidth) {\n setFrameInnerWidth(next);\n }\n };\n var frame = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Frame, {\n ref: switchRef,\n render: \"button\",\n ...import_core.isWeb && {\n type: \"button\"\n },\n size,\n ...props,\n ...switchProps,\n disabled,\n ...checked && activeStyle,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.View, {\n alignSelf: \"stretch\",\n flex: 1,\n onLayout: handleLayout,\n children: props.children\n })\n });\n var _ref1, _ref2;\n var frameTheme = (_ref2 = (_ref1 = checked ? activeTheme : void 0) !== null && _ref1 !== void 0 ? _ref1 : theme) !== null && _ref2 !== void 0 ? _ref2 : (_createProps_componentThemes = createProps.componentThemes) === null || _createProps_componentThemes === void 0 ? void 0 : _createProps_componentThemes.frame;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {\n children: [\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StyledContext.SwitchStyledContext.Provider, {\n size,\n active: checked,\n disabled,\n frameWidth,\n children: frameTheme ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {\n name: frameTheme,\n children: frame\n }) : frame\n }),\n bubbleInput\n ]\n });\n }, {\n disableTheme: true\n });\n return (0, import_core.withStaticProperties)(SwitchComponent, {\n Frame,\n Thumb: SwitchThumbComponent\n });\n}\nvar Switch = createSwitch({\n Frame: SwitchFrame,\n Thumb: SwitchThumbFrame\n});\nvar SwitchThumb = Switch.Thumb;\n//# sourceMappingURL=Switch.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QA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UAAU;IACV,UAAU,MAAM;GAClB,CAAC;EACH,CAAC;EACD,IAAI,OAAO;EACX,IAAI,cAAc,SAAS,QAAQ,UAAU,cAAc,KAAK,OAAO,QAAQ,UAAU,KAAK,IAAI,QAAQ,WAAW,QAAQ,UAAU,KAAK,IAAI,SAAS,+BAA+B,YAAY,qBAAqB,QAAQ,iCAAiC,KAAK,IAAI,KAAK,IAAI,6BAA6B;EACjT,OAAuB,iBAAC,GAAG,mBAAmB,KAAI,CAAE,mBAAmB,UAAU,EAC/E,UAAU,CACQ,iBAAC,GAAG,mBAAmB,IAAG,CAAE,qBAAqB,oBAAoB,UAAU;GAC7F;GACA,QAAQ;GACR;GACA;GACA,UAAU,aAA6B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,YAAY,OAAO;IACpF,MAAM;IACN,UAAU;GACZ,CAAC,IAAI;EACP,CAAC,GACD,WACF,EACF,CAAC;CACH,GAAG,EACD,cAAc,KAChB,CAAC;CACD,QAAQ,GAAG,YAAY,qBAAoB,CAAE,iBAAiB;EAC5D;EACA,OAAO;CACT,CAAC;AACH;AACA,IAAI,SAAS,aAAa;CACxB,OAAO;CACP,OAAO;AACT,CAAC;AACD,IAAI,cAAc,OAAO"}
|
package/dist/jsx/index.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { createSwitch } from "./createSwitch.mjs";
|
|
2
|
-
import { SwitchFrame, SwitchThumb } from "./Switch.mjs";
|
|
3
|
-
export * from "./createSwitch.mjs";
|
|
4
|
-
export * from "./StyledContext.mjs";
|
|
5
|
-
export * from "./Switch.mjs";
|
|
6
|
-
export * from "./types.mjs";
|
|
7
1
|
import { useSwitchNative } from "./useSwitchNative.mjs";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
|
|
3
|
+
export * from "./StyledContext.mjs"
|
|
4
|
+
|
|
5
|
+
export * from "./Switch.mjs"
|
|
6
|
+
|
|
7
|
+
export * from "./types.mjs"
|
|
8
|
+
|
|
9
|
+
export { useSwitchNative };
|
package/dist/jsx/index.mjs
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { createSwitch } from "./createSwitch.mjs";
|
|
2
|
-
import { SwitchFrame, SwitchThumb } from "./Switch.mjs";
|
|
3
|
-
export * from "./createSwitch.mjs";
|
|
4
|
-
export * from "./StyledContext.mjs";
|
|
5
|
-
export * from "./Switch.mjs";
|
|
6
|
-
export * from "./types.mjs";
|
|
7
1
|
import { useSwitchNative } from "./useSwitchNative.mjs";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
|
|
3
|
+
export * from "./StyledContext.mjs"
|
|
4
|
+
|
|
5
|
+
export * from "./Switch.mjs"
|
|
6
|
+
|
|
7
|
+
export * from "./types.mjs"
|
|
8
|
+
|
|
9
|
+
export { useSwitchNative };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var index_exports = {};
|
|
25
|
+
__export(index_exports, { useSwitchNative: () => import_useSwitchNative.useSwitchNative });
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
__reExport(index_exports, require("./StyledContext.native.js"), module.exports);
|
|
28
|
+
__reExport(index_exports, require("./Switch.native.js"), module.exports);
|
|
29
|
+
__reExport(index_exports, require("./types.native.js"), module.exports);
|
|
30
|
+
var import_useSwitchNative = require("./useSwitchNative.native.js");
|
package/dist/jsx/index.native.js
CHANGED
|
@@ -5,39 +5,28 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
12
|
};
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
21
|
};
|
|
22
22
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
24
|
-
value: true
|
|
25
|
-
}), mod);
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
24
|
var index_exports = {};
|
|
27
|
-
__export(index_exports, {
|
|
28
|
-
Switch: () => Switch,
|
|
29
|
-
useSwitchNative: () => import_useSwitchNative.useSwitchNative
|
|
30
|
-
});
|
|
25
|
+
__export(index_exports, { useSwitchNative: () => import_useSwitchNative.useSwitchNative });
|
|
31
26
|
module.exports = __toCommonJS(index_exports);
|
|
32
|
-
var import_createSwitch = require("./createSwitch.native.js");
|
|
33
|
-
var import_Switch = require("./Switch.native.js");
|
|
34
|
-
__reExport(index_exports, require("./createSwitch.native.js"), module.exports);
|
|
35
27
|
__reExport(index_exports, require("./StyledContext.native.js"), module.exports);
|
|
36
28
|
__reExport(index_exports, require("./Switch.native.js"), module.exports);
|
|
37
29
|
__reExport(index_exports, require("./types.native.js"), module.exports);
|
|
38
30
|
var import_useSwitchNative = require("./useSwitchNative.native.js");
|
|
39
|
-
|
|
40
|
-
Frame: import_Switch.SwitchFrame,
|
|
41
|
-
Thumb: import_Switch.SwitchThumb
|
|
42
|
-
});
|
|
31
|
+
|
|
43
32
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["jsx/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n useSwitchNative: () => import_useSwitchNative.useSwitchNative\n});\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./StyledContext\"), module.exports);\n__reExport(index_exports, require(\"./Switch\"), module.exports);\n__reExport(index_exports, require(\"./types\"), module.exports);\nvar import_useSwitchNative = require(\"./useSwitchNative\");\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,SAAS,eAAe,EACtB,uBAAuB,uBAAuB,gBAChD,CAAC;AACD,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,2BAAiB,GAAG,OAAO,OAAO;AACpE,WAAW,eAAe,QAAQ,oBAAU,GAAG,OAAO,OAAO;AAC7D,WAAW,eAAe,QAAQ,mBAAS,GAAG,OAAO,OAAO;AAC5D,IAAI,yBAAyB,QAAQ,6BAAmB"}
|
package/dist/jsx/types.mjs
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
10
|
+
get: () => from[key],
|
|
11
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
17
|
+
var types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(types_exports);
|
package/dist/jsx/types.native.js
CHANGED
|
@@ -5,17 +5,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
10
|
+
get: () => from[key],
|
|
11
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
15
|
};
|
|
16
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
17
|
-
value: true
|
|
18
|
-
}), mod);
|
|
16
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
17
|
var types_exports = {};
|
|
20
18
|
module.exports = __toCommonJS(types_exports);
|
|
19
|
+
|
|
21
20
|
//# sourceMappingURL=types.native.js.map
|