@tamagui/switch-headless 2.7.7 → 3.0.0-beta.637.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.
@@ -1,20 +1,19 @@
1
+
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
6
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
- get: () => from[key],
9
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
- });
11
- }
12
- return to;
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ }
13
+ return to;
13
14
  };
14
15
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: true
17
- }), mod);
16
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
17
  var index_exports = {};
19
18
  module.exports = __toCommonJS(index_exports);
20
- __reExport(index_exports, require("./useSwitch.cjs"), module.exports);
19
+ __reExport(index_exports, require("./useSwitch.cjs"), module.exports);
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
16
+ };
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ module.exports = __toCommonJS(index_exports);
21
+ __reExport(index_exports, require("./useSwitch.native.js"), module.exports);
@@ -1,23 +1,23 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  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;
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
15
16
  };
16
17
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
18
- value: true
19
- }), mod);
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
19
  var index_exports = {};
21
20
  module.exports = __toCommonJS(index_exports);
22
21
  __reExport(index_exports, require("./useSwitch.native.js"), module.exports);
22
+
23
23
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\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 = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./useSwitch\"), module.exports);\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,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,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,uBAAa,GAAG,OAAO,OAAO"}
@@ -1,3 +1,4 @@
1
+
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -5,36 +6,27 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
6
  var __getProtoOf = Object.getPrototypeOf;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
12
13
  };
13
14
  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;
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
21
22
  };
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: true
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
30
26
  }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
28
  var useSwitch_exports = {};
35
- __export(useSwitch_exports, {
36
- useSwitch: () => useSwitch
37
- });
29
+ __export(useSwitch_exports, { useSwitch: () => useSwitch });
38
30
  module.exports = __toCommonJS(useSwitch_exports);
39
31
  var import_compose_refs = require("@tamagui/compose-refs");
40
32
  var import_constants = require("@tamagui/constants");
@@ -44,91 +36,81 @@ var import_use_previous = require("@tamagui/use-previous");
44
36
  var React = __toESM(require("react"), 1);
45
37
  var import_jsx_runtime = require("react/jsx-runtime");
46
38
  function getState(checked) {
47
- return checked ? "checked" : "unchecked";
39
+ return checked ? "checked" : "unchecked";
48
40
  }
49
- const BubbleInput = props => {
50
- const {
51
- control,
52
- checked,
53
- bubbles = true,
54
- ...inputProps
55
- } = props;
56
- const ref = React.useRef(null);
57
- const prevChecked = (0, import_use_previous.usePrevious)(checked);
58
- React.useEffect(() => {
59
- const input = ref.current;
60
- const inputProto = window.HTMLInputElement.prototype;
61
- const setChecked = Object.getOwnPropertyDescriptor(inputProto, "checked").set;
62
- if (prevChecked !== checked && setChecked) {
63
- const event = new Event("click", {
64
- bubbles
65
- });
66
- setChecked.call(input, checked);
67
- input.dispatchEvent(event);
68
- }
69
- }, [prevChecked, checked, bubbles]);
70
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)("input", {
71
- type: "checkbox",
72
- "aria-hidden": true,
73
- defaultChecked: checked,
74
- ...inputProps,
75
- tabIndex: -1,
76
- ref,
77
- style: {
78
- ...props.style,
79
- position: "absolute",
80
- pointerEvents: "none",
81
- opacity: 0,
82
- margin: 0
83
- }
84
- });
41
+ const BubbleInput = (props) => {
42
+ const { control, checked, bubbles = true, ...inputProps } = props;
43
+ const ref = React.useRef(null);
44
+ const prevChecked = (0, import_use_previous.usePrevious)(checked);
45
+ React.useEffect(() => {
46
+ const input = ref.current;
47
+ const inputProto = window.HTMLInputElement.prototype;
48
+ const setChecked = Object.getOwnPropertyDescriptor(inputProto, "checked").set;
49
+ if (prevChecked !== checked && setChecked) {
50
+ const event = new Event("click", { bubbles });
51
+ setChecked.call(input, checked);
52
+ input.dispatchEvent(event);
53
+ }
54
+ }, [
55
+ prevChecked,
56
+ checked,
57
+ bubbles
58
+ ]);
59
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
60
+ type: "checkbox",
61
+ "aria-hidden": true,
62
+ defaultChecked: checked,
63
+ ...inputProps,
64
+ tabIndex: -1,
65
+ ref,
66
+ style: {
67
+ ...props.style,
68
+ position: "absolute",
69
+ pointerEvents: "none",
70
+ opacity: 0,
71
+ margin: 0
72
+ }
73
+ });
85
74
  };
86
75
  function useSwitch(props, [checked, setChecked], ref) {
87
- {
88
- const {
89
- disabled,
90
- name,
91
- value,
92
- required
93
- } = props;
94
- const hasConsumerStoppedPropagationRef = React.useRef(false);
95
- const [button, setButton] = React.useState(null);
96
- const composedRefs = (0, import_compose_refs.useComposedRefs)(ref, setButton);
97
- const isFormControl = import_constants.isWeb ? button ? Boolean(button.closest("form")) : true : false;
98
- const labelId = (0, import_label.useLabelContext)(button);
99
- const ariaLabelledBy = props["aria-labelledby"] || props.labeledBy || labelId;
100
- return {
101
- switchProps: {
102
- role: "switch",
103
- "aria-checked": checked,
104
- ...(import_constants.isWeb ? {
105
- tabIndex: disabled ? void 0 : 0,
106
- "data-state": getState(checked),
107
- "data-disabled": disabled ? "" : void 0,
108
- disabled
109
- } : {}),
110
- "aria-labelledby": ariaLabelledBy,
111
- onPress: (0, import_helpers.composeEventHandlers)(props.onPress, event => {
112
- setChecked(prevChecked => !prevChecked);
113
- if (import_constants.isWeb && isFormControl) {
114
- hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
115
- if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
116
- }
117
- })
118
- },
119
- switchRef: composedRefs,
120
- bubbleInput: import_constants.isWeb && isFormControl ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(BubbleInput, {
121
- control: button,
122
- bubbles: !hasConsumerStoppedPropagationRef.current,
123
- name,
124
- value,
125
- checked,
126
- required,
127
- disabled,
128
- style: {
129
- transform: "translateX(-100%)"
130
- }
131
- }) : null
132
- };
133
- }
134
- }
76
+ {
77
+ const { disabled, name, value, required } = props;
78
+ const hasConsumerStoppedPropagationRef = React.useRef(false);
79
+ const [button, setButton] = React.useState(null);
80
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(ref, setButton);
81
+ const isFormControl = import_constants.isWeb ? button ? Boolean(button.closest("form")) : true : false;
82
+ const labelId = (0, import_label.useLabelContext)(button);
83
+ const ariaLabelledBy = props["aria-labelledby"] || props.labeledBy || labelId;
84
+ return {
85
+ switchProps: {
86
+ role: "switch",
87
+ "aria-checked": checked,
88
+ ...import_constants.isWeb ? {
89
+ tabIndex: disabled ? void 0 : 0,
90
+ "data-state": getState(checked),
91
+ "data-disabled": disabled ? "" : void 0,
92
+ disabled
93
+ } : {},
94
+ "aria-labelledby": ariaLabelledBy,
95
+ onPress: (0, import_helpers.composeEventHandlers)(props.onPress, (event) => {
96
+ setChecked((prevChecked) => !prevChecked);
97
+ if (import_constants.isWeb && isFormControl) {
98
+ hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
99
+ if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
100
+ }
101
+ })
102
+ },
103
+ switchRef: composedRefs,
104
+ bubbleInput: import_constants.isWeb && isFormControl ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BubbleInput, {
105
+ control: button,
106
+ bubbles: !hasConsumerStoppedPropagationRef.current,
107
+ name,
108
+ value,
109
+ checked,
110
+ required,
111
+ disabled,
112
+ style: { transform: "translateX(-100%)" }
113
+ }) : null
114
+ };
115
+ }
116
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
28
+ }) : target, mod));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var useSwitch_exports = {};
31
+ __export(useSwitch_exports, { useSwitch: () => useSwitch });
32
+ module.exports = __toCommonJS(useSwitch_exports);
33
+ require("react/jsx-runtime");
34
+ require("@tamagui/compose-refs");
35
+ require("@tamagui/constants");
36
+ require("@tamagui/helpers");
37
+ require("@tamagui/label");
38
+ require("@tamagui/use-previous");
39
+ __toESM(require("react"), 1);
40
+ function useSwitch(props, param, ref) {
41
+ var [checked, setChecked] = param;
42
+ return {
43
+ switchProps: { onPress() {
44
+ setChecked(function(prevChecked) {
45
+ return !prevChecked;
46
+ });
47
+ } },
48
+ switchRef: ref,
49
+ bubbleInput: null
50
+ };
51
+ }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,36 +8,27 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
8
  var __getProtoOf = Object.getPrototypeOf;
8
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
10
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
14
15
  };
15
16
  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;
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
23
24
  };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
32
28
  }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
30
  var useSwitch_exports = {};
37
- __export(useSwitch_exports, {
38
- useSwitch: () => useSwitch
39
- });
31
+ __export(useSwitch_exports, { useSwitch: () => useSwitch });
40
32
  module.exports = __toCommonJS(useSwitch_exports);
41
33
  require("react/jsx-runtime");
42
34
  require("@tamagui/compose-refs");
@@ -46,17 +38,16 @@ require("@tamagui/label");
46
38
  require("@tamagui/use-previous");
47
39
  __toESM(require("react"), 1);
48
40
  function useSwitch(props, param, ref) {
49
- var [checked, setChecked] = param;
50
- return {
51
- switchProps: {
52
- onPress() {
53
- setChecked(function (prevChecked) {
54
- return !prevChecked;
55
- });
56
- }
57
- },
58
- switchRef: ref,
59
- bubbleInput: null
60
- };
41
+ var [checked, setChecked] = param;
42
+ return {
43
+ switchProps: { onPress() {
44
+ setChecked(function(prevChecked) {
45
+ return !prevChecked;
46
+ });
47
+ } },
48
+ switchRef: ref,
49
+ bubbleInput: null
50
+ };
61
51
  }
52
+
62
53
  //# sourceMappingURL=useSwitch.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isNodeMode","mod","__esModule","__defProp","target","value","enumerable","__toCommonJS","__copyProps","useSwitch_exports","__export","useSwitch","module","exports","require","__toESM","props","param","ref","checked","setChecked","switchProps","onPress","prevChecked","switchRef","bubbleInput"],"sources":["../../src/useSwitch.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,UAAA,KAAAC,GAAA,KAAAA,GAAA,CAAAC,UAAA,GAAAC,SAAA,CAAAC,MAAA;EAAAC,KAAA,EAAAJ,GAAA;EAAAK,UAAA;AAAA,KAAAF,MAAA,EAAAH,GAAA;AACA,IAAAM,YAAA,GAAAN,GAAsB,IAAAO,WAAA,CAAAL,SAAA;EAAAE,KAAA;AAAA,IAAAJ,GAAA;AACtB,IAAAQ,iBAAqC;AACrCC,QAAA,CAAAD,iBAAgC;EAAAE,SAAA,EAAAA,CAAA,KAAAA;AAAA;AAChCC,MAAA,CAAAC,OAAA,GAAAN,YAA4B,CAAAE,iBAAA;AAC5BK,OAAA,oBAAuB;AAuDnBA,OAAA;AAAAA,OAAA;AAAAA,OAAA;AAAAA,OAAA;AApCJA,OAAA,wBAAwC;AACtCC,OAAA,CAAAD,OAAO,QAAU;AACnB,SAAAH,UAAAK,KAAA,EAAAC,KAAA,EAAAC,GAAA;EAWA,KAAMC,OAAA,EAAAC,UAAe,IAAAH,KAA4B;EAC/C,OAAM;IACNI,WAAM,EAAM;MAAAC,OAAMA,CAAA,EAAyB;QAC3CF,UAAM,WAAAG,WAAc;UAGpB,OAAM,CAAAA,WAAU;QACd;MACA;IAAA;IACAC,SAAM,EAAAN,GAAA;IAAoBO,WACxB;EAAA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"useSwitch.native.js","names":[],"sources":["cjs/useSwitch.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\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n\t// If the importer is in node compatibility mode or this is not an ESM\n\t// file that has been converted to a CommonJS file using a Babel-\n\t// compatible transform (i.e. \"__esModule\" has not been set), then set\n\t// \"default\" to the CommonJS \"module.exports\" for node compatibility.\n\tisNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", {\n\t\tvalue: mod,\n\t\tenumerable: true\n\t}) : target,\n\tmod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar useSwitch_exports = {};\n__export(useSwitch_exports, { useSwitch: () => useSwitch });\nmodule.exports = __toCommonJS(useSwitch_exports);\nrequire(\"react/jsx-runtime\");\nrequire(\"@tamagui/compose-refs\");\nrequire(\"@tamagui/constants\");\nrequire(\"@tamagui/helpers\");\nrequire(\"@tamagui/label\");\nrequire(\"@tamagui/use-previous\");\n__toESM(require(\"react\"), 1);\nfunction useSwitch(props, param, ref) {\n\tvar [checked, setChecked] = param;\n\treturn {\n\t\tswitchProps: { onPress() {\n\t\t\tsetChecked(function(prevChecked) {\n\t\t\t\treturn !prevChecked;\n\t\t\t});\n\t\t} },\n\t\tswitchRef: ref,\n\t\tbubbleInput: null\n\t};\n}\n//# sourceMappingURL=useSwitch.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;CAC/B,KAAK,IAAI,QAAQ,KAAK,UAAU,QAAQ,MAAM;EAC7C,KAAK,IAAI;EACT,YAAY;CACb,CAAC;AACF;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC7C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EACnE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GAAG,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QAAQ,UAAU,IAAI,KAAK;GAC9G,WAAW,KAAK;GAChB,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAC3D,CAAC;CACF;CACA,OAAO;AACR;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKpG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CACpE,OAAO;CACP,YAAY;AACb,CAAC,IAAI,QACL,GACD;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,oBAAoB,CAAC;AACzB,SAAS,mBAAmB,EAAE,iBAAiB,UAAU,CAAC;AAC1D,OAAO,UAAU,aAAa,iBAAiB;AAC/C,QAAQ,mBAAmB;AAC3B,QAAQ,uBAAuB;AAC/B,QAAQ,oBAAoB;AAC5B,QAAQ,kBAAkB;AAC1B,QAAQ,gBAAgB;AACxB,QAAQ,uBAAuB;AAC/B,QAAQ,QAAQ,OAAO,GAAG,CAAC;AAC3B,SAAS,UAAU,OAAO,OAAO,KAAK;CACrC,IAAI,CAAC,SAAS,cAAc;CAC5B,OAAO;EACN,aAAa,EAAE,UAAU;GACxB,WAAW,SAAS,aAAa;IAChC,OAAO,CAAC;GACT,CAAC;EACF,EAAE;EACF,WAAW;EACX,aAAa;CACd;AACD"}
package/dist/esm/index.js CHANGED
@@ -1,2 +1 @@
1
- export * from "./useSwitch.mjs";
2
- //# sourceMappingURL=index.js.map
1
+ export * from "./useSwitch.mjs"
@@ -1,2 +1 @@
1
- export * from "./useSwitch.mjs";
2
- //# sourceMappingURL=index.mjs.map
1
+ export * from "./useSwitch.mjs"
@@ -1,2 +1 @@
1
- export * from "./useSwitch.native.js";
2
- //# sourceMappingURL=index.native.js.map
1
+ export * from "./useSwitch.native.js"