@tamagui/switch 1.144.2 → 1.144.4

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.
Files changed (38) hide show
  1. package/dist/cjs/types.cjs +16 -0
  2. package/dist/cjs/types.js +14 -0
  3. package/dist/cjs/types.js.map +6 -0
  4. package/dist/cjs/types.native.js +19 -0
  5. package/dist/cjs/types.native.js.map +1 -0
  6. package/dist/cjs/useSwitchNative.cjs +28 -0
  7. package/dist/cjs/useSwitchNative.js +23 -0
  8. package/dist/cjs/useSwitchNative.js.map +6 -0
  9. package/dist/cjs/useSwitchNative.native.js +70 -0
  10. package/dist/cjs/useSwitchNative.native.js.map +1 -0
  11. package/dist/esm/types.js +1 -0
  12. package/dist/esm/types.js.map +6 -0
  13. package/dist/esm/types.mjs +2 -0
  14. package/dist/esm/types.mjs.map +1 -0
  15. package/dist/esm/types.native.js +2 -0
  16. package/dist/esm/types.native.js.map +1 -0
  17. package/dist/esm/useSwitchNative.js +7 -0
  18. package/dist/esm/useSwitchNative.js.map +6 -0
  19. package/dist/esm/useSwitchNative.mjs +5 -0
  20. package/dist/esm/useSwitchNative.mjs.map +1 -0
  21. package/dist/esm/useSwitchNative.native.js +33 -0
  22. package/dist/esm/useSwitchNative.native.js.map +1 -0
  23. package/dist/jsx/types.js +1 -0
  24. package/dist/jsx/types.js.map +6 -0
  25. package/dist/jsx/types.mjs +2 -0
  26. package/dist/jsx/types.mjs.map +1 -0
  27. package/dist/jsx/types.native.js +19 -0
  28. package/dist/jsx/types.native.js.map +1 -0
  29. package/dist/jsx/useSwitchNative.js +7 -0
  30. package/dist/jsx/useSwitchNative.js.map +6 -0
  31. package/dist/jsx/useSwitchNative.mjs +5 -0
  32. package/dist/jsx/useSwitchNative.mjs.map +1 -0
  33. package/dist/jsx/useSwitchNative.native.js +70 -0
  34. package/dist/jsx/useSwitchNative.native.js.map +1 -0
  35. package/package.json +13 -13
  36. package/types/types.d.ts.map +1 -0
  37. package/types/useSwitchNative.d.ts.map +1 -0
  38. package/types/useSwitchNative.native.d.ts.map +1 -0
@@ -0,0 +1,16 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ };
12
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
13
+ value: !0
14
+ }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,14 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function")
7
+ for (let key of __getOwnPropNames(from))
8
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
+ return to;
10
+ };
11
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
+ var types_exports = {};
13
+ module.exports = __toCommonJS(types_exports);
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/types.ts"],
4
+ "mappings": ";;;;;;;;;;;AAAA;AAAA;",
5
+ "names": []
6
+ }
@@ -0,0 +1,19 @@
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") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ return to;
13
+ };
14
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
+ value: !0
16
+ }), mod);
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
19
+ //# sourceMappingURL=types.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../src/types.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var useSwitchNative_exports = {};
22
+ __export(useSwitchNative_exports, {
23
+ useSwitchNative: () => useSwitchNative
24
+ });
25
+ module.exports = __toCommonJS(useSwitchNative_exports);
26
+ function useSwitchNative(_props) {
27
+ return null;
28
+ }
@@ -0,0 +1,23 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var useSwitchNative_exports = {};
16
+ __export(useSwitchNative_exports, {
17
+ useSwitchNative: () => useSwitchNative
18
+ });
19
+ module.exports = __toCommonJS(useSwitchNative_exports);
20
+ function useSwitchNative(_props) {
21
+ return null;
22
+ }
23
+ //# sourceMappingURL=useSwitchNative.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/useSwitchNative.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,SAAS,gBAAgB,QAAsD;AACpF,SAAO;AACT;",
5
+ "names": []
6
+ }
@@ -0,0 +1,70 @@
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
+ __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
34
+ var useSwitchNative_native_exports = {};
35
+ __export(useSwitchNative_native_exports, {
36
+ useSwitchNative: () => useSwitchNative
37
+ });
38
+ module.exports = __toCommonJS(useSwitchNative_native_exports);
39
+ var import_jsx_runtime = require("react/jsx-runtime"),
40
+ import_core = require("@tamagui/core"),
41
+ import_focusable = require("@tamagui/focusable"),
42
+ React = __toESM(require("react"), 1),
43
+ import_react_native = require("react-native");
44
+ function useSwitchNative(props) {
45
+ var {
46
+ id,
47
+ disabled,
48
+ native,
49
+ nativeProps,
50
+ checked,
51
+ setChecked
52
+ } = props;
53
+ React.useEffect(function () {
54
+ if (id && !disabled) return (0, import_focusable.registerFocusable)(id, {
55
+ focusAndSelect: function () {
56
+ setChecked(function (value) {
57
+ return !value;
58
+ });
59
+ },
60
+ focus: function () {}
61
+ });
62
+ }, [id, disabled, setChecked]);
63
+ var renderNative = (0, import_core.shouldRenderNativePlatform)(native);
64
+ return renderNative === "android" || renderNative === "ios" ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.Switch, {
65
+ value: checked,
66
+ onValueChange: setChecked,
67
+ ...nativeProps
68
+ }) : null;
69
+ }
70
+ //# sourceMappingURL=useSwitchNative.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useSwitchNative_native_exports","__export","useSwitchNative","module","exports","__toCommonJS","import_jsx_runtime","require","import_core","import_focusable","React","__toESM","import_react_native","props","id","disabled","native","nativeProps","checked","setChecked","useEffect","registerFocusable","focusAndSelect","value","focus","renderNative","shouldRenderNativePlatform","jsx","Switch","onValueChange"],"sources":["../../src/useSwitchNative.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,8BAAA;AAAAC,QAAA,CAAAD,8BAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,8BAAA;AAAA,IAAAM,kBAAA,GAA4BC,OAAA;EAC5BC,WAAA,GAA2CD,OAAA;EAC3CE,gBAAA,GAAkCF,OAAA;EAClCG,KAAA,GAAuBC,OAAA,CAAAJ,OAAA;EACvBK,mBAAA,GAAuCL,OAAA;AAG5B,SAASL,gBAAgBW,KAAA,EAAO;EACvC,IAAI;IAAEC,EAAA;IAAIC,QAAA;IAAUC,MAAA;IAAQC,WAAA;IAAaC,OAAA;IAASC;EAAW,IAAIN,KAAA;EACjEH,KAAA,CAAMU,SAAA,CAAU,YAAW;IACvB,IAAKN,EAAA,IACD,CAAAC,QAAA,EACJ,WAAON,gBAAA,CAAAY,iBAAA,EAAkBP,EAAA,EAAI;MACzBQ,cAAA,EAAgB,SAAAA,CAAA,EAAW;QACvBH,UAAA,CAAW,UAASI,KAAA,EAAO;UACvB,OAAO,CAACA,KAAA;QACZ,CAAC;MACL;MACAC,KAAA,EAAO,SAAAA,CAAA,EAAW,CAAC;IACvB,CAAC;EACL,GAAG,CACCV,EAAA,EACAC,QAAA,EACAI,UAAA,CACH;EACD,IAAIM,YAAA,OAAejB,WAAA,CAAAkB,0BAAA,EAA2BV,MAAM;EACpD,OAAIS,YAAA,KAAiB,aAAaA,YAAA,KAAiB,QAC1B,mBAAAnB,kBAAA,CAAAqB,GAAA,EAAKf,mBAAA,CAAAgB,MAAA,EAAc;IACpCL,KAAA,EAAOL,OAAA;IACPW,aAAA,EAAeV,UAAA;IACf,GAAGF;EACP,CAAC,IAEE;AACX","ignoreList":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "mappings": "",
5
+ "names": []
6
+ }
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ function useSwitchNative(_props) {
2
+ return null;
3
+ }
4
+ export {
5
+ useSwitchNative
6
+ };
7
+ //# sourceMappingURL=useSwitchNative.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/useSwitchNative.tsx"],
4
+ "mappings": "AAKO,SAAS,gBAAgB,QAAsD;AACpF,SAAO;AACT;",
5
+ "names": []
6
+ }
@@ -0,0 +1,5 @@
1
+ function useSwitchNative(_props) {
2
+ return null;
3
+ }
4
+ export { useSwitchNative };
5
+ //# sourceMappingURL=useSwitchNative.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useSwitchNative","_props"],"sources":["../../src/useSwitchNative.tsx"],"sourcesContent":[null],"mappings":"AAKO,SAASA,gBAAgBC,MAAA,EAAsD;EACpF,OAAO;AACT","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { shouldRenderNativePlatform } from "@tamagui/core";
3
+ import { registerFocusable } from "@tamagui/focusable";
4
+ import * as React from "react";
5
+ import { Switch as NativeSwitch } from "react-native";
6
+ function useSwitchNative(props) {
7
+ var {
8
+ id,
9
+ disabled,
10
+ native,
11
+ nativeProps,
12
+ checked,
13
+ setChecked
14
+ } = props;
15
+ React.useEffect(function () {
16
+ if (id && !disabled) return registerFocusable(id, {
17
+ focusAndSelect: function () {
18
+ setChecked(function (value) {
19
+ return !value;
20
+ });
21
+ },
22
+ focus: function () {}
23
+ });
24
+ }, [id, disabled, setChecked]);
25
+ var renderNative = shouldRenderNativePlatform(native);
26
+ return renderNative === "android" || renderNative === "ios" ? /* @__PURE__ */_jsx(NativeSwitch, {
27
+ value: checked,
28
+ onValueChange: setChecked,
29
+ ...nativeProps
30
+ }) : null;
31
+ }
32
+ export { useSwitchNative };
33
+ //# sourceMappingURL=useSwitchNative.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["jsx","_jsx","shouldRenderNativePlatform","registerFocusable","React","Switch","NativeSwitch","useSwitchNative","props","id","disabled","native","nativeProps","checked","setChecked","useEffect","focusAndSelect","value","focus","renderNative","onValueChange"],"sources":["../../src/useSwitchNative.native.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAOC,IAAA,QAAY;AAC5B,SAASC,0BAAA,QAAkC;AAC3C,SAASC,iBAAA,QAAyB;AAClC,YAAYC,KAAA,MAAW;AACvB,SAASC,MAAA,IAAUC,YAAA,QAAoB;AAG5B,SAASC,gBAAgBC,KAAA,EAAO;EACvC,IAAI;IAAEC,EAAA;IAAIC,QAAA;IAAUC,MAAA;IAAQC,WAAA;IAAaC,OAAA;IAASC;EAAW,IAAIN,KAAA;EACjEJ,KAAA,CAAMW,SAAA,CAAU,YAAW;IACvB,IAAKN,EAAA,IACD,CAAAC,QAAA,EACJ,OAAOP,iBAAA,CAAkBM,EAAA,EAAI;MACzBO,cAAA,EAAgB,SAAAA,CAAA,EAAW;QACvBF,UAAA,CAAW,UAASG,KAAA,EAAO;UACvB,OAAO,CAACA,KAAA;QACZ,CAAC;MACL;MACAC,KAAA,EAAO,SAAAA,CAAA,EAAW,CAAC;IACvB,CAAC;EACL,GAAG,CACCT,EAAA,EACAC,QAAA,EACAI,UAAA,CACH;EACD,IAAIK,YAAA,GAAejB,0BAAA,CAA2BS,MAAM;EACpD,OAAIQ,YAAA,KAAiB,aAAaA,YAAA,KAAiB,QAC1B,eAAAlB,IAAA,CAAKK,YAAA,EAAc;IACpCW,KAAA,EAAOJ,OAAA;IACPO,aAAA,EAAeN,UAAA;IACf,GAAGF;EACP,CAAC,IAEE;AACX","ignoreList":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "mappings": "",
5
+ "names": []
6
+ }
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -0,0 +1,19 @@
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") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ return to;
13
+ };
14
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
+ value: !0
16
+ }), mod);
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
19
+ //# sourceMappingURL=types.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ function useSwitchNative(_props) {
2
+ return null;
3
+ }
4
+ export {
5
+ useSwitchNative
6
+ };
7
+ //# sourceMappingURL=useSwitchNative.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/useSwitchNative.tsx"],
4
+ "mappings": "AAKO,SAAS,gBAAgB,QAAsD;AACpF,SAAO;AACT;",
5
+ "names": []
6
+ }
@@ -0,0 +1,5 @@
1
+ function useSwitchNative(_props) {
2
+ return null;
3
+ }
4
+ export { useSwitchNative };
5
+ //# sourceMappingURL=useSwitchNative.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useSwitchNative","_props"],"sources":["../../src/useSwitchNative.tsx"],"sourcesContent":[null],"mappings":"AAKO,SAASA,gBAAgBC,MAAA,EAAsD;EACpF,OAAO;AACT","ignoreList":[]}
@@ -0,0 +1,70 @@
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
+ __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
34
+ var useSwitchNative_native_exports = {};
35
+ __export(useSwitchNative_native_exports, {
36
+ useSwitchNative: () => useSwitchNative
37
+ });
38
+ module.exports = __toCommonJS(useSwitchNative_native_exports);
39
+ var import_jsx_runtime = require("react/jsx-runtime"),
40
+ import_core = require("@tamagui/core"),
41
+ import_focusable = require("@tamagui/focusable"),
42
+ React = __toESM(require("react"), 1),
43
+ import_react_native = require("react-native");
44
+ function useSwitchNative(props) {
45
+ var {
46
+ id,
47
+ disabled,
48
+ native,
49
+ nativeProps,
50
+ checked,
51
+ setChecked
52
+ } = props;
53
+ React.useEffect(function () {
54
+ if (id && !disabled) return (0, import_focusable.registerFocusable)(id, {
55
+ focusAndSelect: function () {
56
+ setChecked(function (value) {
57
+ return !value;
58
+ });
59
+ },
60
+ focus: function () {}
61
+ });
62
+ }, [id, disabled, setChecked]);
63
+ var renderNative = (0, import_core.shouldRenderNativePlatform)(native);
64
+ return renderNative === "android" || renderNative === "ios" ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.Switch, {
65
+ value: checked,
66
+ onValueChange: setChecked,
67
+ ...nativeProps
68
+ }) : null;
69
+ }
70
+ //# sourceMappingURL=useSwitchNative.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useSwitchNative_native_exports","__export","useSwitchNative","module","exports","__toCommonJS","import_jsx_runtime","require","import_core","import_focusable","React","__toESM","import_react_native","props","id","disabled","native","nativeProps","checked","setChecked","useEffect","registerFocusable","focusAndSelect","value","focus","renderNative","shouldRenderNativePlatform","jsx","Switch","onValueChange"],"sources":["../../src/useSwitchNative.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,8BAAA;AAAAC,QAAA,CAAAD,8BAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,8BAAA;AAAA,IAAAM,kBAAA,GAA4BC,OAAA;EAC5BC,WAAA,GAA2CD,OAAA;EAC3CE,gBAAA,GAAkCF,OAAA;EAClCG,KAAA,GAAuBC,OAAA,CAAAJ,OAAA;EACvBK,mBAAA,GAAuCL,OAAA;AAG5B,SAASL,gBAAgBW,KAAA,EAAO;EACvC,IAAI;IAAEC,EAAA;IAAIC,QAAA;IAAUC,MAAA;IAAQC,WAAA;IAAaC,OAAA;IAASC;EAAW,IAAIN,KAAA;EACjEH,KAAA,CAAMU,SAAA,CAAU,YAAW;IACvB,IAAKN,EAAA,IACD,CAAAC,QAAA,EACJ,WAAON,gBAAA,CAAAY,iBAAA,EAAkBP,EAAA,EAAI;MACzBQ,cAAA,EAAgB,SAAAA,CAAA,EAAW;QACvBH,UAAA,CAAW,UAASI,KAAA,EAAO;UACvB,OAAO,CAACA,KAAA;QACZ,CAAC;MACL;MACAC,KAAA,EAAO,SAAAA,CAAA,EAAW,CAAC;IACvB,CAAC;EACL,GAAG,CACCV,EAAA,EACAC,QAAA,EACAI,UAAA,CACH;EACD,IAAIM,YAAA,OAAejB,WAAA,CAAAkB,0BAAA,EAA2BV,MAAM;EACpD,OAAIS,YAAA,KAAiB,aAAaA,YAAA,KAAiB,QAC1B,mBAAAnB,kBAAA,CAAAqB,GAAA,EAAKf,mBAAA,CAAAgB,MAAA,EAAc;IACpCL,KAAA,EAAOL,OAAA;IACPW,aAAA,EAAeV,UAAA;IACf,GAAGF;EACP,CAAC,IAEE;AACX","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/switch",
3
- "version": "1.144.2",
3
+ "version": "1.144.4",
4
4
  "type": "module",
5
5
  "removeSideEffects": true,
6
6
  "sideEffects": [
@@ -40,24 +40,24 @@
40
40
  }
41
41
  },
42
42
  "dependencies": {
43
- "@tamagui/compose-refs": "1.144.2",
44
- "@tamagui/constants": "1.144.2",
45
- "@tamagui/core": "1.144.2",
46
- "@tamagui/focusable": "1.144.2",
47
- "@tamagui/get-token": "1.144.2",
48
- "@tamagui/helpers": "1.144.2",
49
- "@tamagui/label": "1.144.2",
50
- "@tamagui/stacks": "1.144.2",
51
- "@tamagui/switch-headless": "1.144.2",
52
- "@tamagui/use-controllable-state": "1.144.2",
53
- "@tamagui/use-previous": "1.144.2"
43
+ "@tamagui/compose-refs": "1.144.4",
44
+ "@tamagui/constants": "1.144.4",
45
+ "@tamagui/core": "1.144.4",
46
+ "@tamagui/focusable": "1.144.4",
47
+ "@tamagui/get-token": "1.144.4",
48
+ "@tamagui/helpers": "1.144.4",
49
+ "@tamagui/label": "1.144.4",
50
+ "@tamagui/stacks": "1.144.4",
51
+ "@tamagui/switch-headless": "1.144.4",
52
+ "@tamagui/use-controllable-state": "1.144.4",
53
+ "@tamagui/use-previous": "1.144.4"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "react": "*",
57
57
  "react-native": "*"
58
58
  },
59
59
  "devDependencies": {
60
- "@tamagui/build": "1.144.2",
60
+ "@tamagui/build": "1.144.4",
61
61
  "react": "*",
62
62
  "react-native": "0.81.5"
63
63
  },
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAClF,OAAO,KAAK,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,MAAM,0BAA0B,CAAA;AAC5F,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,iBAAiB,CAAA;AAE5D,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,CAAC,EAAE,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,wBAAwB,GAAG;IACxD,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC,CAAA;IAClD,WAAW,CAAC,EAAE,iBAAiB,CAAA;CAChC,GAAG,2BAA2B,CAAA;AAE/B,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,gBAAgB,CAAA;AAE5D,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAA;AAE7C,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GACjD,iBAAiB,GACjB,2BAA2B,CAAA;AAG7B,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAA;AACjD,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAA;AAEtD,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC,CAAA;IAClD,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,KAAK,IAAI,CAAA;CACpE,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSwitchNative.d.ts","sourceRoot":"","sources":["../src/useSwitchNative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,oBAAoB,GAAG,KAAK,CAAC,SAAS,GAAG,IAAI,CAEpF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSwitchNative.native.d.ts","sourceRoot":"","sources":["../src/useSwitchNative.native.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,KAAK,CAAC,SAAS,GAAG,IAAI,CAqBnF"}