@tamagui/checkbox 2.7.7 → 3.0.0-beta.1091.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.
Files changed (67) hide show
  1. package/dist/cjs/Checkbox.cjs +97 -101
  2. package/dist/cjs/Checkbox.native.cjs +128 -0
  3. package/dist/cjs/Checkbox.native.js +111 -100
  4. package/dist/cjs/Checkbox.native.js.map +1 -1
  5. package/dist/cjs/CheckboxStyledContext.cjs +17 -23
  6. package/dist/cjs/CheckboxStyledContext.native.cjs +31 -0
  7. package/dist/cjs/CheckboxStyledContext.native.js +17 -22
  8. package/dist/cjs/CheckboxStyledContext.native.js.map +1 -1
  9. package/dist/cjs/index.cjs +8 -26
  10. package/dist/cjs/index.native.cjs +21 -0
  11. package/dist/cjs/index.native.js +9 -26
  12. package/dist/cjs/index.native.js.map +1 -1
  13. package/dist/esm/Checkbox.mjs +75 -86
  14. package/dist/esm/Checkbox.mjs.map +1 -1
  15. package/dist/esm/Checkbox.native.js +90 -86
  16. package/dist/esm/Checkbox.native.js.map +1 -1
  17. package/dist/esm/CheckboxStyledContext.mjs +5 -5
  18. package/dist/esm/CheckboxStyledContext.mjs.map +1 -1
  19. package/dist/esm/CheckboxStyledContext.native.js +5 -5
  20. package/dist/esm/CheckboxStyledContext.native.js.map +1 -1
  21. package/dist/esm/index.js +3 -11
  22. package/dist/esm/index.mjs +3 -11
  23. package/dist/esm/index.native.js +3 -11
  24. package/dist/jsx/Checkbox.mjs +75 -86
  25. package/dist/jsx/Checkbox.mjs.map +1 -1
  26. package/dist/jsx/Checkbox.native.cjs +128 -0
  27. package/dist/jsx/Checkbox.native.js +111 -100
  28. package/dist/jsx/Checkbox.native.js.map +1 -1
  29. package/dist/jsx/CheckboxStyledContext.mjs +5 -5
  30. package/dist/jsx/CheckboxStyledContext.mjs.map +1 -1
  31. package/dist/jsx/CheckboxStyledContext.native.cjs +31 -0
  32. package/dist/jsx/CheckboxStyledContext.native.js +17 -22
  33. package/dist/jsx/CheckboxStyledContext.native.js.map +1 -1
  34. package/dist/jsx/index.js +3 -11
  35. package/dist/jsx/index.mjs +3 -11
  36. package/dist/jsx/index.native.cjs +21 -0
  37. package/dist/jsx/index.native.js +9 -26
  38. package/dist/jsx/index.native.js.map +1 -1
  39. package/package.json +8 -17
  40. package/src/Checkbox.tsx +188 -106
  41. package/src/CheckboxStyledContext.tsx +2 -6
  42. package/src/index.ts +0 -9
  43. package/types/Checkbox.d.ts +129 -37
  44. package/types/Checkbox.d.ts.map +1 -1
  45. package/types/CheckboxStyledContext.d.ts +2 -4
  46. package/types/CheckboxStyledContext.d.ts.map +1 -1
  47. package/types/index.d.ts +0 -320
  48. package/types/index.d.ts.map +1 -1
  49. package/dist/cjs/createCheckbox.cjs +0 -194
  50. package/dist/cjs/createCheckbox.native.js +0 -213
  51. package/dist/cjs/createCheckbox.native.js.map +0 -1
  52. package/dist/esm/createCheckbox.mjs +0 -150
  53. package/dist/esm/createCheckbox.mjs.map +0 -1
  54. package/dist/esm/createCheckbox.native.js +0 -167
  55. package/dist/esm/createCheckbox.native.js.map +0 -1
  56. package/dist/esm/index.js.map +0 -1
  57. package/dist/esm/index.mjs.map +0 -1
  58. package/dist/esm/index.native.js.map +0 -1
  59. package/dist/jsx/createCheckbox.mjs +0 -150
  60. package/dist/jsx/createCheckbox.mjs.map +0 -1
  61. package/dist/jsx/createCheckbox.native.js +0 -213
  62. package/dist/jsx/createCheckbox.native.js.map +0 -1
  63. package/dist/jsx/index.js.map +0 -1
  64. package/dist/jsx/index.mjs.map +0 -1
  65. package/src/createCheckbox.tsx +0 -280
  66. package/types/createCheckbox.d.ts +0 -196
  67. package/types/createCheckbox.d.ts.map +0 -1
@@ -3,33 +3,27 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
10
  };
11
11
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
19
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
21
  var CheckboxStyledContext_exports = {};
24
- __export(CheckboxStyledContext_exports, {
25
- CheckboxStyledContext: () => CheckboxStyledContext
26
- });
22
+ __export(CheckboxStyledContext_exports, { CheckboxStyledContext: () => CheckboxStyledContext });
27
23
  module.exports = __toCommonJS(CheckboxStyledContext_exports);
28
24
  var import_core = require("@tamagui/core");
29
25
  const CheckboxStyledContext = (0, import_core.createStyledContext)({
30
- size: "$true",
31
- scaleIcon: 1,
32
- unstyled: process.env.TAMAGUI_HEADLESS === "1",
33
- active: false,
34
- disabled: false
35
- });
26
+ size: true,
27
+ active: false,
28
+ disabled: false
29
+ });
@@ -0,0 +1,31 @@
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var CheckboxStyledContext_exports = {};
24
+ __export(CheckboxStyledContext_exports, { CheckboxStyledContext: () => CheckboxStyledContext });
25
+ module.exports = __toCommonJS(CheckboxStyledContext_exports);
26
+ var import_core = require("@tamagui/core");
27
+ var CheckboxStyledContext = (0, import_core.createStyledContext)({
28
+ size: true,
29
+ active: false,
30
+ disabled: false
31
+ });
@@ -5,34 +5,29 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
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: true
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
- 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;
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
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
23
  var CheckboxStyledContext_exports = {};
26
- __export(CheckboxStyledContext_exports, {
27
- CheckboxStyledContext: () => CheckboxStyledContext
28
- });
24
+ __export(CheckboxStyledContext_exports, { CheckboxStyledContext: () => CheckboxStyledContext });
29
25
  module.exports = __toCommonJS(CheckboxStyledContext_exports);
30
26
  var import_core = require("@tamagui/core");
31
27
  var CheckboxStyledContext = (0, import_core.createStyledContext)({
32
- size: "$true",
33
- scaleIcon: 1,
34
- unstyled: process.env.TAMAGUI_HEADLESS === "1",
35
- active: false,
36
- disabled: false
28
+ size: true,
29
+ active: false,
30
+ disabled: false
37
31
  });
32
+
38
33
  //# sourceMappingURL=CheckboxStyledContext.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","CheckboxStyledContext_exports","__export","CheckboxStyledContext","module","exports","import_core","require","createStyledContext","size","scaleIcon","unstyled","process","env","TAMAGUI_HEADLESS","active","disabled"],"sources":["../../src/CheckboxStyledContext.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,6BAAA;AAAAC,QAAA,CAAAD,6BAAA;EAAAE,qBAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAT,YAAoC,CAAAK,6BAAA;AAE7B,IAAAK,WAAM,GAAAC,OAAA,gBAAwB;AAMlC,IACDJ,qBAAM,OAAAG,WAAA,CAAAE,mBAAA;EACNC,IAAA,SAAW;EACXC,SAAA,EAAU;EACVC,QAAQ,EAAAC,OAAA,CAAAC,GAAA,CAAAC,gBAAA;EACRC,MAAA,OAAU;EACXC,QAAA","ignoreList":[]}
1
+ {"version":3,"file":"CheckboxStyledContext.native.js","names":[],"sources":["cjs/CheckboxStyledContext.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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar CheckboxStyledContext_exports = {};\n__export(CheckboxStyledContext_exports, {\n CheckboxStyledContext: () => CheckboxStyledContext\n});\nmodule.exports = __toCommonJS(CheckboxStyledContext_exports);\nvar import_core = require(\"@tamagui/core\");\nvar CheckboxStyledContext = (0, import_core.createStyledContext)({\n size: true,\n active: false,\n disabled: false\n});\n//# sourceMappingURL=CheckboxStyledContext.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,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gCAAgC,CAAC;AACrC,SAAS,+BAA+B,EACtC,6BAA6B,sBAC/B,CAAC;AACD,OAAO,UAAU,aAAa,6BAA6B;AAC3D,IAAI,cAAc,QAAQ,eAAe;AACzC,IAAI,yBAAyB,GAAG,YAAY,oBAAmB,CAAE;CAC/D,MAAM;CACN,QAAQ;CACR,UAAU;AACZ,CAAC"}
@@ -2,36 +2,18 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
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: true
9
- });
10
- };
11
5
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
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;
19
13
  };
20
14
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
22
- value: true
23
- }), mod);
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
16
  var index_exports = {};
25
- __export(index_exports, {
26
- Checkbox: () => Checkbox
27
- });
28
17
  module.exports = __toCommonJS(index_exports);
29
- var import_Checkbox = require("./Checkbox.cjs");
30
- var import_createCheckbox = require("./createCheckbox.cjs");
31
- __reExport(index_exports, require("./createCheckbox.cjs"), module.exports);
32
18
  __reExport(index_exports, require("./Checkbox.cjs"), module.exports);
33
19
  __reExport(index_exports, require("./CheckboxStyledContext.cjs"), module.exports);
34
- const Checkbox = (0, import_createCheckbox.createCheckbox)({
35
- Frame: import_Checkbox.CheckboxFrame,
36
- Indicator: import_Checkbox.CheckboxIndicatorFrame
37
- });
@@ -0,0 +1,21 @@
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var index_exports = {};
19
+ module.exports = __toCommonJS(index_exports);
20
+ __reExport(index_exports, require("./Checkbox.native.js"), module.exports);
21
+ __reExport(index_exports, require("./CheckboxStyledContext.native.js"), module.exports);
@@ -4,37 +4,20 @@ var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
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
7
  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;
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;
21
15
  };
22
16
  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);
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
18
  var index_exports = {};
27
- __export(index_exports, {
28
- Checkbox: () => Checkbox
29
- });
30
19
  module.exports = __toCommonJS(index_exports);
31
- var import_Checkbox = require("./Checkbox.native.js");
32
- var import_createCheckbox = require("./createCheckbox.native.js");
33
- __reExport(index_exports, require("./createCheckbox.native.js"), module.exports);
34
20
  __reExport(index_exports, require("./Checkbox.native.js"), module.exports);
35
21
  __reExport(index_exports, require("./CheckboxStyledContext.native.js"), module.exports);
36
- var Checkbox = (0, import_createCheckbox.createCheckbox)({
37
- Frame: import_Checkbox.CheckboxFrame,
38
- Indicator: import_Checkbox.CheckboxIndicatorFrame
39
- });
22
+
40
23
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","Checkbox","module","exports","import_Checkbox","require","import_createCheckbox","__reExport","createCheckbox","Frame","CheckboxFrame","Indicator","CheckboxIndicatorFrame"],"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,QAAA,CAAAD,aAAA;EAAAE,QAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAsD,CAAAK,aAAA;AACtD,IAAAK,eAAA,GAAAC,OAA+B;AAE/B,IAAAC,qBAAA,GAAcD,OAAA,8BAHd;AAIAE,UAAA,CAAAR,aAAA,EAAcM,OAAA,6BAJd,GAAAH,MAAA,CAAAC,OAAA;AAKAI,UAAA,CAAAR,aAAA,EAAcM,OAAA,0BAAAH,MAAA,CAAAC,OALd;AAQOI,UAAM,CAAAR,aAAW,EAAAM,OAAA,oCAAe,GAAAH,MAAA,CAAAC,OAAA;AAAA,IACrCF,QAAO,OAAAK,qBAAA,CAAAE,cAAA;EACPC,KAAA,EAAAL,eAAW,CAAAM,aAAA;EACZC,SAAA,EAAAP,eAAA,CAAAQ","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(\"./Checkbox\"), module.exports);\n__reExport(index_exports, require(\"./CheckboxStyledContext\"), 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,sBAAY,GAAG,OAAO,OAAO;AAC/D,WAAW,eAAe,QAAQ,mCAAyB,GAAG,OAAO,OAAO"}
@@ -1,90 +1,79 @@
1
- import { getVariableValue, styled } from "@tamagui/core";
2
- import { getSize } from "@tamagui/get-token";
3
- import { YStack } from "@tamagui/stacks";
1
+ import { isIndeterminate, useCheckbox } from "@tamagui/checkbox-headless";
2
+ import { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled, withStaticProperties } from "@tamagui/core";
3
+ import { useControllableState } from "@tamagui/use-controllable-state";
4
+ import React, { useMemo } from "react";
4
5
  import { CheckboxStyledContext } from "./CheckboxStyledContext.mjs";
5
- const INDICATOR_NAME = "CheckboxIndicator";
6
- const CheckboxIndicatorFrame = styled(YStack, {
7
- // use Checkbox for easier themes
8
- name: INDICATOR_NAME,
9
- context: CheckboxStyledContext,
10
- variants: {
11
- unstyled: {
12
- false: {}
13
- }
14
- },
15
- defaultVariants: {
16
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
17
- }
18
- }, {
19
- accept: {
20
- activeStyle: "style"
21
- }
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+
8
+ const CheckboxIndicatorFrame = styled(View, {
9
+ displayName: "CheckboxIndicator",
10
+ context: CheckboxStyledContext
22
11
  });
23
- const CHECKBOX_NAME = "Checkbox";
24
- const CheckboxFrame = styled(YStack, {
25
- name: CHECKBOX_NAME,
26
- render: "button",
27
- context: CheckboxStyledContext,
28
- variants: {
29
- unstyled: {
30
- false: {
31
- size: "$true",
32
- backgroundColor: "$background",
33
- alignItems: "center",
34
- justifyContent: "center",
35
- borderWidth: 1,
36
- borderColor: "$borderColor",
37
- hoverStyle: {
38
- borderColor: "$borderColorHover"
39
- },
40
- pressStyle: {
41
- backgroundColor: "$backgroundPress",
42
- borderColor: "$borderColorPress"
43
- },
44
- focusStyle: {
45
- borderColor: "$borderColorFocus"
46
- },
47
- focusVisibleStyle: {
48
- outlineStyle: "solid",
49
- outlineWidth: 2,
50
- outlineColor: "$outlineColor"
51
- }
52
- }
53
- },
54
- disabled: {
55
- true: {
56
- pointerEvents: "none",
57
- userSelect: "none",
58
- cursor: "not-allowed",
59
- hoverStyle: {
60
- borderColor: "$borderColor",
61
- backgroundColor: "$background"
62
- },
63
- pressStyle: {
64
- borderColor: "$borderColor",
65
- backgroundColor: "$background"
66
- },
67
- focusStyle: {
68
- outlineWidth: 0
69
- }
70
- }
71
- },
72
- size: {
73
- "...size": val => {
74
- const radiusToken = getVariableValue(getSize(val)) / 8;
75
- return {
76
- borderRadius: radiusToken
77
- };
78
- }
79
- }
80
- },
81
- defaultVariants: {
82
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
83
- }
84
- }, {
85
- accept: {
86
- activeStyle: "style"
87
- }
12
+ const CheckboxFrame = styled(View, {
13
+ displayName: "Checkbox",
14
+ render: "button",
15
+ context: CheckboxStyledContext,
16
+ alignItems: "center",
17
+ justifyContent: "center",
18
+ variants: { disabled: { true: {
19
+ pointerEvents: "none",
20
+ userSelect: "none"
21
+ } } }
88
22
  });
89
- export { CheckboxFrame, CheckboxIndicatorFrame };
23
+ const CheckboxContext = React.createContext({
24
+ checked: false,
25
+ disabled: false
26
+ });
27
+ const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {
28
+ const { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;
29
+ const [checked = false, setChecked] = useControllableState({
30
+ prop: checkedProp,
31
+ defaultProp: defaultChecked,
32
+ onChange: onCheckedChange
33
+ });
34
+ const { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(props, [checked, setChecked], forwardedRef);
35
+ if (shouldRenderNativePlatform(native) === "web") return /* @__PURE__ */ jsx("input", {
36
+ type: "checkbox",
37
+ defaultChecked: isIndeterminate(checked) ? false : checked,
38
+ tabIndex: -1,
39
+ ref: checkboxRef,
40
+ disabled: checkboxProps.disabled,
41
+ style: checkboxProps.style
42
+ });
43
+ const memoizedContext = useMemo(() => ({
44
+ checked,
45
+ disabled: checkboxProps.disabled
46
+ }), [checked, checkboxProps.disabled]);
47
+ const isActive = !!checked;
48
+ const disabled = checkboxProps.disabled;
49
+ return /* @__PURE__ */ jsxs(CheckboxContext.Provider, {
50
+ value: memoizedContext,
51
+ children: [/* @__PURE__ */ jsx(CheckboxFrame, {
52
+ render: "button",
53
+ ref: checkboxRef,
54
+ theme: activeTheme ?? null,
55
+ ...isWeb && { type: "button" },
56
+ checked,
57
+ ...checkboxProps,
58
+ style: [checkboxProps.style, isActive && activeStyle],
59
+ active: isActive,
60
+ disabled,
61
+ children: props.children
62
+ }), bubbleInput]
63
+ });
64
+ }), { Indicator: createStyledHOC(CheckboxIndicatorFrame, (props, forwardedRef) => {
65
+ const { children, forceMount, activeStyle, ...indicatorProps } = props;
66
+ const { active } = CheckboxStyledContext.useStyledContext();
67
+ const context = React.useContext(CheckboxContext);
68
+ if (forceMount || isIndeterminate(context.checked) || context.checked === true) return /* @__PURE__ */ jsx(CheckboxIndicatorFrame, {
69
+ pointerEvents: "none",
70
+ ...indicatorProps,
71
+ style: [indicatorProps.style, active && activeStyle],
72
+ ref: forwardedRef,
73
+ children
74
+ });
75
+ return null;
76
+ }) });
77
+
78
+ export { Checkbox2 as Checkbox, CheckboxContext, CheckboxFrame, CheckboxIndicatorFrame };
90
79
  //# sourceMappingURL=Checkbox.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["getVariableValue","styled","getSize","YStack","CheckboxStyledContext","INDICATOR_NAME","CheckboxIndicatorFrame","name","context","variants","unstyled","false","defaultVariants","process","env","TAMAGUI_HEADLESS","accept","activeStyle","CHECKBOX_NAME","CheckboxFrame","render","size","backgroundColor","alignItems","justifyContent","borderWidth","borderColor","hoverStyle","pressStyle","focusStyle","focusVisibleStyle","outlineStyle","outlineWidth","outlineColor","disabled","true","pointerEvents","userSelect","cursor","val","radiusToken","borderRadius"],"sources":["../../src/Checkbox.tsx"],"sourcesContent":[null],"mappings":"AAGA,SAASA,gBAAA,EAAkBC,MAAA,QAAc;AACzC,SAASC,OAAA,QAAe;AACxB,SAASC,MAAA,QAAc;AAEvB,SAASC,qBAAA,QAA6B;AAKtC,MAAMC,cAAA,GAAiB;AAEhB,MAAMC,sBAAA,GAAyBL,MAAA,CACpCE,MAAA,EACA;EAAA;EAEEI,IAAA,EAAMF,cAAA;EACNG,OAAA,EAASJ,qBAAA;EACTK,QAAA,EAA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fF,QAAA,EAAUG,OAAA,CAAQC,GAAA,CAAIC,gBAAA,KAAqB;EAC7C;AACF,GACA;EACEC,MAAA,EAAQ;IACNC,WAAA,EAAa;EACf;AACF,CACF","ignoreList":[]}
1
+ {"version":3,"file":"Checkbox.js","names":[],"sources":["esm/Checkbox.js"],"sourcesContent":["import { isIndeterminate, useCheckbox } from \"@tamagui/checkbox-headless\";\nimport { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled, withStaticProperties } from \"@tamagui/core\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport React, { useMemo } from \"react\";\nimport { CheckboxStyledContext } from \"./CheckboxStyledContext\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\n\nconst CheckboxIndicatorFrame = styled(View, {\n\tdisplayName: \"CheckboxIndicator\",\n\tcontext: CheckboxStyledContext\n});\nconst CheckboxFrame = styled(View, {\n\tdisplayName: \"Checkbox\",\n\trender: \"button\",\n\tcontext: CheckboxStyledContext,\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tvariants: { disabled: { true: {\n\t\tpointerEvents: \"none\",\n\t\tuserSelect: \"none\"\n\t} } }\n});\nconst CheckboxContext = React.createContext({\n\tchecked: false,\n\tdisabled: false\n});\nconst Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {\n\tconst { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;\n\tconst [checked = false, setChecked] = useControllableState({\n\t\tprop: checkedProp,\n\t\tdefaultProp: defaultChecked,\n\t\tonChange: onCheckedChange\n\t});\n\tconst { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(props, [checked, setChecked], forwardedRef);\n\tif (shouldRenderNativePlatform(native) === \"web\") return /* @__PURE__ */ jsx(\"input\", {\n\t\ttype: \"checkbox\",\n\t\tdefaultChecked: isIndeterminate(checked) ? false : checked,\n\t\ttabIndex: -1,\n\t\tref: checkboxRef,\n\t\tdisabled: checkboxProps.disabled,\n\t\tstyle: checkboxProps.style\n\t});\n\tconst memoizedContext = useMemo(() => ({\n\t\tchecked,\n\t\tdisabled: checkboxProps.disabled\n\t}), [checked, checkboxProps.disabled]);\n\tconst isActive = !!checked;\n\tconst disabled = checkboxProps.disabled;\n\treturn /* @__PURE__ */ jsxs(CheckboxContext.Provider, {\n\t\tvalue: memoizedContext,\n\t\tchildren: [/* @__PURE__ */ jsx(CheckboxFrame, {\n\t\t\trender: \"button\",\n\t\t\tref: checkboxRef,\n\t\t\ttheme: activeTheme ?? null,\n\t\t\t...isWeb && { type: \"button\" },\n\t\t\tchecked,\n\t\t\t...checkboxProps,\n\t\t\tstyle: [checkboxProps.style, isActive && activeStyle],\n\t\t\tactive: isActive,\n\t\t\tdisabled,\n\t\t\tchildren: props.children\n\t\t}), bubbleInput]\n\t});\n}), { Indicator: createStyledHOC(CheckboxIndicatorFrame, (props, forwardedRef) => {\n\tconst { children, forceMount, activeStyle, ...indicatorProps } = props;\n\tconst { active } = CheckboxStyledContext.useStyledContext();\n\tconst context = React.useContext(CheckboxContext);\n\tif (forceMount || isIndeterminate(context.checked) || context.checked === true) return /* @__PURE__ */ jsx(CheckboxIndicatorFrame, {\n\t\tpointerEvents: \"none\",\n\t\t...indicatorProps,\n\t\tstyle: [indicatorProps.style, active && activeStyle],\n\t\tref: forwardedRef,\n\t\tchildren\n\t});\n\treturn null;\n}) });\n\nexport { Checkbox2 as Checkbox, CheckboxContext, CheckboxFrame, CheckboxIndicatorFrame };"],"mappings":";;;;;;;;AAOA,MAAM,yBAAyB,OAAO,MAAM;CAC3C,aAAa;CACb,SAAS;AACV,CAAC;AACD,MAAM,gBAAgB,OAAO,MAAM;CAClC,aAAa;CACb,QAAQ;CACR,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,UAAU,EAAE,UAAU,EAAE,MAAM;EAC7B,eAAe;EACf,YAAY;CACb,EAAE,EAAE;AACL,CAAC;AACD,MAAM,kBAAkB,MAAM,cAAc;CAC3C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