@tamagui/checkbox-headless 2.0.0-rc.9 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/cjs/BubbleInput.cjs +47 -41
  2. package/dist/cjs/BubbleInput.native.js +74 -69
  3. package/dist/cjs/BubbleInput.native.js.map +1 -1
  4. package/dist/cjs/index.cjs +7 -5
  5. package/dist/cjs/index.native.js +7 -5
  6. package/dist/cjs/index.native.js.map +1 -1
  7. package/dist/cjs/useCheckbox.cjs +58 -52
  8. package/dist/cjs/useCheckbox.native.js +65 -59
  9. package/dist/cjs/useCheckbox.native.js.map +1 -1
  10. package/dist/cjs/utils.cjs +12 -10
  11. package/dist/cjs/utils.native.js +12 -10
  12. package/dist/cjs/utils.native.js.map +1 -1
  13. package/dist/esm/BubbleInput.mjs +19 -15
  14. package/dist/esm/BubbleInput.mjs.map +1 -1
  15. package/dist/esm/BubbleInput.native.js +19 -16
  16. package/dist/esm/BubbleInput.native.js.map +1 -1
  17. package/dist/esm/index.js +2 -2
  18. package/dist/esm/index.js.map +1 -6
  19. package/dist/esm/useCheckbox.mjs +26 -22
  20. package/dist/esm/useCheckbox.mjs.map +1 -1
  21. package/dist/esm/useCheckbox.native.js +33 -29
  22. package/dist/esm/useCheckbox.native.js.map +1 -1
  23. package/dist/jsx/BubbleInput.mjs +19 -15
  24. package/dist/jsx/BubbleInput.mjs.map +1 -1
  25. package/dist/jsx/BubbleInput.native.js +74 -69
  26. package/dist/jsx/BubbleInput.native.js.map +1 -1
  27. package/dist/jsx/index.js +2 -2
  28. package/dist/jsx/index.js.map +1 -6
  29. package/dist/jsx/index.native.js +7 -5
  30. package/dist/jsx/useCheckbox.mjs +26 -22
  31. package/dist/jsx/useCheckbox.mjs.map +1 -1
  32. package/dist/jsx/useCheckbox.native.js +65 -59
  33. package/dist/jsx/useCheckbox.native.js.map +1 -1
  34. package/dist/jsx/utils.native.js +12 -10
  35. package/package.json +15 -15
  36. package/dist/cjs/BubbleInput.js +0 -65
  37. package/dist/cjs/BubbleInput.js.map +0 -6
  38. package/dist/cjs/index.js +0 -16
  39. package/dist/cjs/index.js.map +0 -6
  40. package/dist/cjs/useCheckbox.js +0 -81
  41. package/dist/cjs/useCheckbox.js.map +0 -6
  42. package/dist/cjs/utils.js +0 -27
  43. package/dist/cjs/utils.js.map +0 -6
  44. package/dist/esm/BubbleInput.js +0 -44
  45. package/dist/esm/BubbleInput.js.map +0 -6
  46. package/dist/esm/useCheckbox.js +0 -64
  47. package/dist/esm/useCheckbox.js.map +0 -6
  48. package/dist/esm/utils.js +0 -11
  49. package/dist/esm/utils.js.map +0 -6
  50. package/dist/jsx/BubbleInput.js +0 -44
  51. package/dist/jsx/BubbleInput.js.map +0 -6
  52. package/dist/jsx/useCheckbox.js +0 -64
  53. package/dist/jsx/useCheckbox.js.map +0 -6
  54. package/dist/jsx/utils.js +0 -11
  55. package/dist/jsx/utils.js.map +0 -6
@@ -2,65 +2,71 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
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
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var BubbleInput_exports = {};
33
35
  __export(BubbleInput_exports, {
34
36
  BubbleInput: () => BubbleInput
35
37
  });
36
38
  module.exports = __toCommonJS(BubbleInput_exports);
37
- var import_use_previous = require("@tamagui/use-previous"),
38
- React = __toESM(require("react"), 1),
39
- import_utils = require("./utils.cjs"),
40
- import_jsx_runtime = require("react/jsx-runtime");
39
+ var import_use_previous = require("@tamagui/use-previous");
40
+ var React = __toESM(require("react"), 1);
41
+ var import_utils = require("./utils.cjs");
42
+ var import_jsx_runtime = require("react/jsx-runtime");
41
43
  const BubbleInput = props => {
42
44
  const {
43
- checked,
44
- bubbles = !0,
45
- control,
46
- isHidden,
47
- ...inputProps
48
- } = props,
49
- ref = React.useRef(null),
50
- prevChecked = (0, import_use_previous.usePrevious)(checked);
51
- return React.useEffect(() => {
52
- const input = ref.current,
53
- inputProto = window.HTMLInputElement.prototype,
54
- setChecked = Object.getOwnPropertyDescriptor(inputProto, "checked").set;
45
+ checked,
46
+ bubbles = true,
47
+ control,
48
+ isHidden,
49
+ ...inputProps
50
+ } = props;
51
+ const ref = React.useRef(null);
52
+ const prevChecked = (0, import_use_previous.usePrevious)(checked);
53
+ React.useEffect(() => {
54
+ const input = ref.current;
55
+ const inputProto = window.HTMLInputElement.prototype;
56
+ const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
57
+ const setChecked = descriptor.set;
55
58
  if (prevChecked !== checked && setChecked) {
56
59
  const event = new Event("click", {
57
60
  bubbles
58
61
  });
59
- input.indeterminate = (0, import_utils.isIndeterminate)(checked), setChecked.call(input, (0, import_utils.isIndeterminate)(checked) ? !1 : checked), input.dispatchEvent(event);
62
+ input.indeterminate = (0, import_utils.isIndeterminate)(checked);
63
+ setChecked.call(input, (0, import_utils.isIndeterminate)(checked) ? false : checked);
64
+ input.dispatchEvent(event);
60
65
  }
61
- }, [prevChecked, checked, bubbles]), /* @__PURE__ */(0, import_jsx_runtime.jsx)("input", {
66
+ }, [prevChecked, checked, bubbles]);
67
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)("input", {
62
68
  type: "checkbox",
63
- defaultChecked: (0, import_utils.isIndeterminate)(checked) ? !1 : checked,
69
+ defaultChecked: (0, import_utils.isIndeterminate)(checked) ? false : checked,
64
70
  ...inputProps,
65
71
  tabIndex: -1,
66
72
  ref,
@@ -4,83 +4,88 @@ var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf,
8
- __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
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, {
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, {
17
18
  get: () => from[key],
18
19
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
20
  });
20
- return to;
21
- };
21
+ }
22
+ return to;
23
+ };
22
24
  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);
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
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
34
36
  var BubbleInput_exports = {};
35
37
  __export(BubbleInput_exports, {
36
38
  BubbleInput: () => BubbleInput
37
39
  });
38
40
  module.exports = __toCommonJS(BubbleInput_exports);
39
- var import_jsx_runtime = require("react/jsx-runtime"),
40
- import_use_previous = require("@tamagui/use-previous"),
41
- React = __toESM(require("react"), 1),
42
- import_utils = require("./utils.native.js"),
43
- BubbleInput = function (props) {
44
- var {
45
- checked,
46
- bubbles = !0,
47
- control,
48
- isHidden,
49
- ...inputProps
50
- } = props,
51
- ref = React.useRef(null),
52
- prevChecked = (0, import_use_previous.usePrevious)(checked);
53
- return React.useEffect(function () {
54
- var input = ref.current,
55
- inputProto = window.HTMLInputElement.prototype,
56
- descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"),
57
- setChecked = descriptor.set;
58
- if (prevChecked !== checked && setChecked) {
59
- var event = new Event("click", {
60
- bubbles
61
- });
62
- input.indeterminate = (0, import_utils.isIndeterminate)(checked), setChecked.call(input, (0, import_utils.isIndeterminate)(checked) ? !1 : checked), input.dispatchEvent(event);
63
- }
64
- }, [prevChecked, checked, bubbles]), /* @__PURE__ */(0, import_jsx_runtime.jsx)("input", {
65
- type: "checkbox",
66
- defaultChecked: (0, import_utils.isIndeterminate)(checked) ? !1 : checked,
67
- ...inputProps,
68
- tabIndex: -1,
69
- ref,
70
- "aria-hidden": isHidden,
71
- style: {
72
- ...(isHidden ? {
73
- // ...controlSize,
74
- position: "absolute",
75
- pointerEvents: "none",
76
- opacity: 0,
77
- margin: 0
78
- } : {
79
- appearance: "auto",
80
- accentColor: "var(--color6)"
81
- }),
82
- ...props.style
83
- }
84
- });
85
- };
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ var import_use_previous = require("@tamagui/use-previous");
43
+ var React = __toESM(require("react"), 1);
44
+ var import_utils = require("./utils.native.js");
45
+ var BubbleInput = function (props) {
46
+ var {
47
+ checked,
48
+ bubbles = true,
49
+ control,
50
+ isHidden,
51
+ ...inputProps
52
+ } = props;
53
+ var ref = React.useRef(null);
54
+ var prevChecked = (0, import_use_previous.usePrevious)(checked);
55
+ React.useEffect(function () {
56
+ var input = ref.current;
57
+ var inputProto = window.HTMLInputElement.prototype;
58
+ var descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
59
+ var setChecked = descriptor.set;
60
+ if (prevChecked !== checked && setChecked) {
61
+ var event = new Event("click", {
62
+ bubbles
63
+ });
64
+ input.indeterminate = (0, import_utils.isIndeterminate)(checked);
65
+ setChecked.call(input, (0, import_utils.isIndeterminate)(checked) ? false : checked);
66
+ input.dispatchEvent(event);
67
+ }
68
+ }, [prevChecked, checked, bubbles]);
69
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)("input", {
70
+ type: "checkbox",
71
+ defaultChecked: (0, import_utils.isIndeterminate)(checked) ? false : checked,
72
+ ...inputProps,
73
+ tabIndex: -1,
74
+ ref,
75
+ "aria-hidden": isHidden,
76
+ style: {
77
+ ...(isHidden ? {
78
+ // ...controlSize,
79
+ position: "absolute",
80
+ pointerEvents: "none",
81
+ opacity: 0,
82
+ margin: 0
83
+ } : {
84
+ appearance: "auto",
85
+ accentColor: "var(--color6)"
86
+ }),
87
+ ...props.style
88
+ }
89
+ });
90
+ };
86
91
  //# sourceMappingURL=BubbleInput.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","BubbleInput_exports","__export","BubbleInput","module","exports","import_jsx_runtime","require","import_use_previous","React","__toESM","import_utils","props","checked","bubbles","control","isHidden","inputProps","ref","useRef","prevChecked","usePrevious","useEffect","input","current","inputProto","window","HTMLInputElement","prototype","descriptor","Object","getOwnPropertyDescriptor","setChecked","set","event","Event","indeterminate","isIndeterminate","call","dispatchEvent","jsx","type","defaultChecked","tabIndex","style","position","pointerEvents","opacity","margin","appearance","accentColor"],"sources":["../../src/BubbleInput.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA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B,OAAA,SAAAA,OAAA;MAAA,GACJI,UAAU;MAAA0B,QACV;MAAAzB,GACA;MAAa,aACN,EAAAF,QAAA;MAAA4B,KACL,EAAI;QACA,IAAA5B,QAAA;UAAA;UAEY6B,QACV,YAAe;UAAAC,aACN;UAAAC,OACT,GAAQ;UACVC,MACA;QAAA,IACE;UAAYC,UACZ,QAAa;UACfC,WAAA;QAAA;QAGN,GAAAtC,KAAA,CAAAgC;MAAA;IACF;EAEJ","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","BubbleInput_exports","__export","BubbleInput","module","exports","import_jsx_runtime","require","import_use_previous","React","__toESM","import_utils","props","checked","bubbles","control","isHidden","inputProps","ref","useRef","prevChecked","usePrevious","useEffect","input","current","inputProto","window","HTMLInputElement","prototype","descriptor","Object","getOwnPropertyDescriptor","setChecked","set","event","Event","indeterminate","isIndeterminate","call","dispatchEvent","jsx","type","defaultChecked","tabIndex","style","position","pointerEvents","opacity","margin","appearance","accentColor"],"sources":["../../src/BubbleInput.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,mBAAA;AAAAC,QAAA,CAAAD,mBAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAA4B,CAAAK,mBAAA;AAC5B,IAAAK,kBAAuB,GAAAC,OAAA;AAGvB,IAAAC,mBAAgC,GAAAD,OAAA;AAkC5B,IAAAE,KAAA,GAAAC,OAAA,CAAAH,OAAA;AAxBG,IAAAI,YAAM,GAAAJ,OAAe,oBAA4B;AACtD,IAAAJ,WAAQ,YAAAA,CAASS,KAAU;EAC3B;IAAMC,OAAM;IAAAC,OAAM,GAAyB,IAAI;IAAAC,OAAA;IAAAC,QAAA;IAAA,GAA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__getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
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, {
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, {
7
8
  get: () => from[key],
8
9
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
10
  });
10
- return to;
11
- },
12
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
15
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
- value: !0
16
+ value: true
15
17
  }), mod);
16
18
  var index_exports = {};
17
19
  module.exports = __toCommonJS(index_exports);
@@ -5,15 +5,17 @@ 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
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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, {
9
10
  get: () => from[key],
10
11
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
12
  });
12
- return to;
13
- },
14
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ }
14
+ return to;
15
+ };
16
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
17
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: !0
18
+ value: true
17
19
  }), mod);
18
20
  var index_exports = {};
19
21
  module.exports = __toCommonJS(index_exports);
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"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;AACdG,UAAA,CAAAH,aAAA,EAAcI,OAAA,0BADd,GAAAH,MAAA,CAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"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;AACdG,UAAA,CAAAH,aAAA,EAAcI,OAAA,0BADd,GAAAH,MAAA,CAAAC,OAAA","ignoreList":[]}
@@ -2,72 +2,78 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
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
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var useCheckbox_exports = {};
33
35
  __export(useCheckbox_exports, {
34
36
  useCheckbox: () => useCheckbox
35
37
  });
36
38
  module.exports = __toCommonJS(useCheckbox_exports);
37
- var import_compose_refs = require("@tamagui/compose-refs"),
38
- import_constants = require("@tamagui/constants"),
39
- import_helpers = require("@tamagui/helpers"),
40
- import_label = require("@tamagui/label"),
41
- import_react = __toESM(require("react"), 1),
42
- import_BubbleInput = require("./BubbleInput.cjs"),
43
- import_utils = require("./utils.cjs"),
44
- import_jsx_runtime = require("react/jsx-runtime");
39
+ var import_compose_refs = require("@tamagui/compose-refs");
40
+ var import_constants = require("@tamagui/constants");
41
+ var import_helpers = require("@tamagui/helpers");
42
+ var import_label = require("@tamagui/label");
43
+ var import_react = __toESM(require("react"), 1);
44
+ var import_BubbleInput = require("./BubbleInput.cjs");
45
+ var import_utils = require("./utils.cjs");
46
+ var import_jsx_runtime = require("react/jsx-runtime");
45
47
  function useCheckbox(props, [checked, setChecked], ref) {
46
48
  const {
47
- labelledBy: ariaLabelledby,
48
- name,
49
- required,
50
- disabled,
51
- value = "on",
52
- onCheckedChange,
53
- ...checkboxProps
54
- } = props,
55
- [button, setButton] = import_react.default.useState(null),
56
- composedRefs = (0, import_compose_refs.useComposedRefs)(ref, setButton),
57
- hasConsumerStoppedPropagationRef = import_react.default.useRef(!1),
58
- isFormControl = import_constants.isWeb ? button ? !!button.closest("form") : !0 : !1,
59
- labelId = (0, import_label.useLabelContext)(button),
60
- labelledBy = ariaLabelledby || labelId,
61
- parentKeyDown = props.onKeyDown,
62
- handleKeyDown = (0, import_react.useMemo)(() => (0, import_helpers.composeEventHandlers)(parentKeyDown, event => {
63
- event.key === "Enter" && event.preventDefault();
64
- }), [parentKeyDown]),
65
- handlePress = (0, import_react.useMemo)(() => (0, import_helpers.composeEventHandlers)(props.onPress, event => {
66
- setChecked(prevChecked => (0, import_utils.isIndeterminate)(prevChecked) ? !0 : !prevChecked), isFormControl && "isPropagationStopped" in event && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
67
- }), [isFormControl]);
49
+ labelledBy: ariaLabelledby,
50
+ name,
51
+ required,
52
+ disabled,
53
+ value = "on",
54
+ onCheckedChange,
55
+ ...checkboxProps
56
+ } = props;
57
+ const [button, setButton] = import_react.default.useState(null);
58
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(ref, setButton);
59
+ const hasConsumerStoppedPropagationRef = import_react.default.useRef(false);
60
+ const isFormControl = import_constants.isWeb ? button ? Boolean(button.closest("form")) : true : false;
61
+ const labelId = (0, import_label.useLabelContext)(button);
62
+ const labelledBy = ariaLabelledby || labelId;
63
+ const parentKeyDown = props.onKeyDown;
64
+ const handleKeyDown = (0, import_react.useMemo)(() => (0, import_helpers.composeEventHandlers)(parentKeyDown, event => {
65
+ if (event.key === "Enter") event.preventDefault();
66
+ }), [parentKeyDown]);
67
+ const handlePress = (0, import_react.useMemo)(() => (0, import_helpers.composeEventHandlers)(props.onPress, event => {
68
+ setChecked(prevChecked => (0, import_utils.isIndeterminate)(prevChecked) ? true : !prevChecked);
69
+ if (isFormControl && "isPropagationStopped" in event) {
70
+ hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
71
+ if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
72
+ }
73
+ }), [isFormControl]);
68
74
  return {
69
75
  bubbleInput: import_constants.isWeb && isFormControl ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_BubbleInput.BubbleInput, {
70
- isHidden: !0,
76
+ isHidden: true,
71
77
  control: button,
72
78
  bubbles: !hasConsumerStoppedPropagationRef.current,
73
79
  name,
@@ -4,79 +4,85 @@ var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf,
8
- __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
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, {
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, {
17
18
  get: () => from[key],
18
19
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
20
  });
20
- return to;
21
- };
21
+ }
22
+ return to;
23
+ };
22
24
  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);
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
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
34
36
  var useCheckbox_exports = {};
35
37
  __export(useCheckbox_exports, {
36
38
  useCheckbox: () => useCheckbox
37
39
  });
38
40
  module.exports = __toCommonJS(useCheckbox_exports);
39
- var import_jsx_runtime = require("react/jsx-runtime"),
40
- import_compose_refs = require("@tamagui/compose-refs"),
41
- import_constants = require("@tamagui/constants"),
42
- import_helpers = require("@tamagui/helpers"),
43
- import_label = require("@tamagui/label"),
44
- import_react = __toESM(require("react"), 1),
45
- import_BubbleInput = require("./BubbleInput.native.js"),
46
- import_utils = require("./utils.native.js");
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ var import_compose_refs = require("@tamagui/compose-refs");
43
+ var import_constants = require("@tamagui/constants");
44
+ var import_helpers = require("@tamagui/helpers");
45
+ var import_label = require("@tamagui/label");
46
+ var import_react = __toESM(require("react"), 1);
47
+ var import_BubbleInput = require("./BubbleInput.native.js");
48
+ var import_utils = require("./utils.native.js");
47
49
  function useCheckbox(props, param, ref) {
48
- var [checked, setChecked] = param,
49
- {
50
- labelledBy: ariaLabelledby,
51
- name,
52
- required,
53
- disabled,
54
- value = "on",
55
- onCheckedChange,
56
- ...checkboxProps
57
- } = props,
58
- [button, setButton] = import_react.default.useState(null),
59
- composedRefs = (0, import_compose_refs.useComposedRefs)(ref, setButton),
60
- hasConsumerStoppedPropagationRef = import_react.default.useRef(!1),
61
- isFormControl = import_constants.isWeb ? button ? !!button.closest("form") : !0 : !1,
62
- labelId = (0, import_label.useLabelContext)(button),
63
- labelledBy = ariaLabelledby || labelId,
64
- parentKeyDown = props.onKeyDown,
65
- handleKeyDown = (0, import_react.useMemo)(function () {
66
- return (0, import_helpers.composeEventHandlers)(parentKeyDown, function (event) {
67
- event.key === "Enter" && event.preventDefault();
68
- });
69
- }, [parentKeyDown]),
70
- handlePress = (0, import_react.useMemo)(function () {
71
- return (0, import_helpers.composeEventHandlers)(props.onPress, function (event) {
72
- setChecked(function (prevChecked) {
73
- return (0, import_utils.isIndeterminate)(prevChecked) ? !0 : !prevChecked;
74
- }), isFormControl && "isPropagationStopped" in event && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
50
+ var [checked, setChecked] = param;
51
+ var {
52
+ labelledBy: ariaLabelledby,
53
+ name,
54
+ required,
55
+ disabled,
56
+ value = "on",
57
+ onCheckedChange,
58
+ ...checkboxProps
59
+ } = props;
60
+ var [button, setButton] = import_react.default.useState(null);
61
+ var composedRefs = (0, import_compose_refs.useComposedRefs)(ref, setButton);
62
+ var hasConsumerStoppedPropagationRef = import_react.default.useRef(false);
63
+ var isFormControl = import_constants.isWeb ? button ? Boolean(button.closest("form")) : true : false;
64
+ var labelId = (0, import_label.useLabelContext)(button);
65
+ var labelledBy = ariaLabelledby || labelId;
66
+ var parentKeyDown = props.onKeyDown;
67
+ var handleKeyDown = (0, import_react.useMemo)(function () {
68
+ return (0, import_helpers.composeEventHandlers)(parentKeyDown, function (event) {
69
+ if (event.key === "Enter") event.preventDefault();
70
+ });
71
+ }, [parentKeyDown]);
72
+ var handlePress = (0, import_react.useMemo)(function () {
73
+ return (0, import_helpers.composeEventHandlers)(props.onPress, function (event) {
74
+ setChecked(function (prevChecked) {
75
+ return (0, import_utils.isIndeterminate)(prevChecked) ? true : !prevChecked;
75
76
  });
76
- }, [isFormControl]);
77
+ if (isFormControl && "isPropagationStopped" in event) {
78
+ hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
79
+ if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
80
+ }
81
+ });
82
+ }, [isFormControl]);
77
83
  return {
78
84
  bubbleInput: import_constants.isWeb && isFormControl ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_BubbleInput.BubbleInput, {
79
- isHidden: !0,
85
+ isHidden: true,
80
86
  control: button,
81
87
  bubbles: !hasConsumerStoppedPropagationRef.current,
82
88
  name,