@tamagui/toggle-group 2.7.7 → 3.0.0-beta.643.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 (78) hide show
  1. package/dist/cjs/Toggle.cjs +65 -130
  2. package/dist/cjs/Toggle.native.cjs +100 -0
  3. package/dist/cjs/Toggle.native.js +75 -136
  4. package/dist/cjs/Toggle.native.js.map +1 -1
  5. package/dist/cjs/ToggleGroup.cjs +158 -211
  6. package/dist/cjs/ToggleGroup.native.cjs +208 -0
  7. package/dist/cjs/ToggleGroup.native.js +173 -225
  8. package/dist/cjs/ToggleGroup.native.js.map +1 -1
  9. package/dist/cjs/context.cjs +19 -20
  10. package/dist/cjs/context.native.cjs +37 -0
  11. package/dist/cjs/context.native.js +20 -20
  12. package/dist/cjs/context.native.js.map +1 -1
  13. package/dist/cjs/index.cjs +15 -18
  14. package/dist/cjs/index.native.cjs +29 -0
  15. package/dist/cjs/index.native.js +15 -17
  16. package/dist/cjs/index.native.js.map +1 -1
  17. package/dist/cjs/types.cjs +10 -11
  18. package/dist/cjs/types.native.cjs +19 -0
  19. package/dist/cjs/types.native.js +10 -10
  20. package/dist/cjs/types.native.js.map +1 -1
  21. package/dist/esm/Toggle.mjs +53 -104
  22. package/dist/esm/Toggle.mjs.map +1 -1
  23. package/dist/esm/Toggle.native.js +61 -115
  24. package/dist/esm/Toggle.native.js.map +1 -1
  25. package/dist/esm/ToggleGroup.mjs +145 -188
  26. package/dist/esm/ToggleGroup.mjs.map +1 -1
  27. package/dist/esm/ToggleGroup.native.js +160 -203
  28. package/dist/esm/ToggleGroup.native.js.map +1 -1
  29. package/dist/esm/context.mjs +5 -3
  30. package/dist/esm/context.mjs.map +1 -1
  31. package/dist/esm/context.native.js +6 -4
  32. package/dist/esm/context.native.js.map +1 -1
  33. package/dist/esm/index.js +4 -3
  34. package/dist/esm/index.mjs +4 -3
  35. package/dist/esm/index.native.js +4 -3
  36. package/dist/esm/types.mjs +0 -2
  37. package/dist/esm/types.native.js +0 -2
  38. package/dist/jsx/Toggle.mjs +53 -104
  39. package/dist/jsx/Toggle.mjs.map +1 -1
  40. package/dist/jsx/Toggle.native.cjs +100 -0
  41. package/dist/jsx/Toggle.native.js +75 -136
  42. package/dist/jsx/Toggle.native.js.map +1 -1
  43. package/dist/jsx/ToggleGroup.mjs +145 -188
  44. package/dist/jsx/ToggleGroup.mjs.map +1 -1
  45. package/dist/jsx/ToggleGroup.native.cjs +208 -0
  46. package/dist/jsx/ToggleGroup.native.js +173 -225
  47. package/dist/jsx/ToggleGroup.native.js.map +1 -1
  48. package/dist/jsx/context.mjs +5 -3
  49. package/dist/jsx/context.mjs.map +1 -1
  50. package/dist/jsx/context.native.cjs +37 -0
  51. package/dist/jsx/context.native.js +20 -20
  52. package/dist/jsx/context.native.js.map +1 -1
  53. package/dist/jsx/index.js +4 -3
  54. package/dist/jsx/index.mjs +4 -3
  55. package/dist/jsx/index.native.cjs +29 -0
  56. package/dist/jsx/index.native.js +15 -17
  57. package/dist/jsx/index.native.js.map +1 -1
  58. package/dist/jsx/types.mjs +0 -2
  59. package/dist/jsx/types.native.cjs +19 -0
  60. package/dist/jsx/types.native.js +10 -10
  61. package/dist/jsx/types.native.js.map +1 -1
  62. package/package.json +16 -15
  63. package/src/Toggle.tsx +27 -66
  64. package/src/ToggleGroup.tsx +13 -10
  65. package/types/Toggle.d.ts +45 -49
  66. package/types/Toggle.d.ts.map +1 -1
  67. package/types/ToggleGroup.d.ts +26 -87
  68. package/types/ToggleGroup.d.ts.map +1 -1
  69. package/types/context.d.ts +1 -1
  70. package/types/context.d.ts.map +1 -1
  71. package/dist/esm/index.js.map +0 -1
  72. package/dist/esm/index.mjs.map +0 -1
  73. package/dist/esm/index.native.js.map +0 -1
  74. package/dist/esm/types.mjs.map +0 -1
  75. package/dist/esm/types.native.js.map +0 -1
  76. package/dist/jsx/index.js.map +0 -1
  77. package/dist/jsx/index.mjs.map +0 -1
  78. package/dist/jsx/types.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","context_exports","__export","context","useToggleGroupItem","module","exports","import_web","require","createStyledContext","color","active","useStyledContext"],"sources":["../../src/context.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,eAAA;AAAAC,QAAA,CAAAD,eAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAA,OAAA;EAAAC,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAoCV,YAAA,CAAAK,eAAA;AAE7B,IAAAM,UAAM,GAAAC,OAAU;AAAoB,IACzCL,OAAO,OAAAI,UAAA,CAAAE,mBAAA;EACPC,KAAA,IAAQ;EACTC,MAAA;AAEM;AACL,IAAAP,kBAAe,YAAAA,CAAA,EAAiB;EAClC,OAAAD,OAAA,CAAAS,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"context.native.js","names":[],"sources":["cjs/context.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 context_exports = {};\n__export(context_exports, {\n context: () => context,\n useToggleGroupItem: () => useToggleGroupItem\n});\nmodule.exports = __toCommonJS(context_exports);\nvar import_web = require(\"@tamagui/web\");\nvar context = (0, import_web.createStyledContext)({\n color: \"\",\n active: false\n});\nvar useToggleGroupItem = function() {\n return context.useStyledContext();\n};\n//# sourceMappingURL=context.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,kBAAkB,CAAC;AACvB,SAAS,iBAAiB;CACxB,eAAe;CACf,0BAA0B;AAC5B,CAAC;AACD,OAAO,UAAU,aAAa,eAAe;AAC7C,IAAI,aAAa,QAAQ,cAAc;AACvC,IAAI,WAAW,GAAG,WAAW,qBAAqB;CAChD,OAAO;CACP,QAAQ;AACV,CAAC;AACD,IAAI,qBAAqB,WAAW;CAClC,OAAO,QAAQ,iBAAiB;AAClC"}
@@ -1,30 +1,27 @@
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 __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
10
11
  };
11
12
  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;
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
19
20
  };
20
21
  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);
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
23
  var index_exports = {};
25
- __export(index_exports, {
26
- useToggleGroupItem: () => import_context.useToggleGroupItem
27
- });
24
+ __export(index_exports, { useToggleGroupItem: () => import_context.useToggleGroupItem });
28
25
  module.exports = __toCommonJS(index_exports);
29
26
  __reExport(index_exports, require("./ToggleGroup.cjs"), module.exports);
30
- var import_context = require("./context.cjs");
27
+ var import_context = require("./context.cjs");
@@ -0,0 +1,29 @@
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 __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
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;
22
+ };
23
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var index_exports = {};
26
+ __export(index_exports, { useToggleGroupItem: () => import_context.useToggleGroupItem });
27
+ module.exports = __toCommonJS(index_exports);
28
+ __reExport(index_exports, require("./ToggleGroup.native.js"), module.exports);
29
+ var import_context = require("./context.native.js");
@@ -1,33 +1,31 @@
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 __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
23
  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);
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
25
  var index_exports = {};
27
- __export(index_exports, {
28
- useToggleGroupItem: () => import_context.useToggleGroupItem
29
- });
26
+ __export(index_exports, { useToggleGroupItem: () => import_context.useToggleGroupItem });
30
27
  module.exports = __toCommonJS(index_exports);
31
28
  __reExport(index_exports, require("./ToggleGroup.native.js"), module.exports);
32
29
  var import_context = require("./context.native.js");
30
+
33
31
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","useToggleGroupItem","import_context","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,QAAA,CAAAD,aAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAC,cAAA,CAAAD;AAAA;AAAAE,MAAA,CAAAC,OAAA,GAAAV,YAAc,CAAAK,aAAA;AACdM,UAAA,CAAAN,aAAmC,EAAAO,OAAA,6BAAAH,MAAA,CAAAC,OAAA","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 __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n useToggleGroupItem: () => import_context.useToggleGroupItem\n});\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./ToggleGroup\"), module.exports);\nvar import_context = require(\"./context\");\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,SAAS,eAAe,EACtB,0BAA0B,eAAe,mBAC3C,CAAC;AACD,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,yBAAe,GAAG,OAAO,OAAO;AAClE,IAAI,iBAAiB,QAAQ,qBAAW"}
@@ -1,18 +1,17 @@
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
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
- value: true
16
- }), mod);
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
17
16
  var types_exports = {};
18
- module.exports = __toCommonJS(types_exports);
17
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,19 @@
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var types_exports = {};
19
+ module.exports = __toCommonJS(types_exports);
@@ -1,21 +1,21 @@
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
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
17
- value: true
18
- }), mod);
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
18
  var types_exports = {};
20
19
  module.exports = __toCommonJS(types_exports);
20
+
21
21
  //# sourceMappingURL=types.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../src/types.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"types.native.js","names":[],"sources":["cjs/types.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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar types_exports = {};\nmodule.exports = __toCommonJS(types_exports);\n//# sourceMappingURL=types.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,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa"}
@@ -1,113 +1,62 @@
1
+ import { createRefComponent } from "@tamagui/compose-refs";
1
2
  import { composeEventHandlers } from "@tamagui/helpers";
3
+ import { resolveSizeToken } from "@tamagui/size";
2
4
  import { useControllableState } from "@tamagui/use-controllable-state";
3
- import { styled, View } from "@tamagui/web";
4
- import * as React from "react";
5
+ import { View, styled } from "@tamagui/web";
5
6
  import { context } from "./context.mjs";
6
7
  import { jsx } from "react/jsx-runtime";
8
+
7
9
  const NAME = "Toggle";
8
10
  const ToggleFrame = styled(View, {
9
- name: NAME,
10
- render: "button",
11
- context,
12
- variants: {
13
- unstyled: {
14
- false: {
15
- size: "$true",
16
- alignItems: "center",
17
- justifyContent: "center",
18
- display: "flex",
19
- backgroundColor: "$background",
20
- borderColor: "$borderColor",
21
- borderWidth: 1,
22
- margin: -1,
23
- hoverStyle: {
24
- backgroundColor: "$backgroundHover",
25
- borderColor: "$borderColorHover"
26
- },
27
- pressStyle: {
28
- backgroundColor: "$backgroundPress",
29
- borderColor: "$borderColorPress"
30
- },
31
- focusVisibleStyle: {
32
- outlineColor: "$outlineColor",
33
- outlineWidth: 2,
34
- outlineStyle: "solid",
35
- zIndex: 10
36
- }
37
- }
38
- },
39
- size: {
40
- "...size": (val, {
41
- tokens
42
- }) => {
43
- if (!val) return;
44
- return {
45
- width: tokens.size[val],
46
- height: tokens.size[val]
47
- };
48
- },
49
- ":number": val => ({
50
- width: val,
51
- height: val
52
- })
53
- },
54
- defaultActiveStyle: {
55
- true: {
56
- backgroundColor: "$backgroundActive",
57
- hoverStyle: {
58
- backgroundColor: "$backgroundActive"
59
- },
60
- focusStyle: {
61
- backgroundColor: "$backgroundActive"
62
- }
63
- }
64
- }
65
- },
66
- defaultVariants: {
67
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
68
- }
69
- }, {
70
- accept: {
71
- activeStyle: "style"
72
- }
73
- });
74
- const Toggle = React.forwardRef(function Toggle2(props, forwardedRef) {
75
- const {
76
- active: activeProp,
77
- activeStyle,
78
- defaultActive = false,
79
- onActiveChange,
80
- activeTheme,
81
- unstyled = false,
82
- ...buttonProps
83
- } = props;
84
- const [active = false, setActive] = useControllableState({
85
- prop: activeProp,
86
- onChange: onActiveChange,
87
- defaultProp: defaultActive
88
- });
89
- return /* @__PURE__ */jsx(ToggleFrame, {
90
- theme: activeTheme ?? null,
91
- "aria-pressed": active,
92
- "data-state": active ? "on" : "off",
93
- "data-disabled": props.disabled ? "" : void 0,
94
- unstyled,
95
- ...(active && !activeStyle && !unstyled && {
96
- defaultActiveStyle: true
97
- }),
98
- ...buttonProps,
99
- ...(active && activeStyle && {
100
- ...activeStyle,
101
- hoverStyle: activeStyle,
102
- focusStyle: activeStyle
103
- }),
104
- ref: forwardedRef,
105
- onPress: composeEventHandlers(props.onPress ?? void 0, () => {
106
- if (!props.disabled) {
107
- setActive(prev => !prev);
108
- }
109
- })
110
- });
11
+ displayName: NAME,
12
+ render: "button",
13
+ context,
14
+ size: true,
15
+ alignItems: "center",
16
+ justifyContent: "center",
17
+ display: "flex",
18
+ variants: {
19
+ size: {
20
+ number: (val) => ({
21
+ width: val,
22
+ height: val
23
+ }),
24
+ Size: (val, { tokens }) => {
25
+ if (!val) return;
26
+ const sizeToken = resolveSizeToken(val, "size");
27
+ const size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
28
+ return {
29
+ width: size,
30
+ height: size
31
+ };
32
+ }
33
+ },
34
+ defaultActiveStyle: { true: {} }
35
+ }
36
+ }, { accept: { activeStyle: "style" } });
37
+ const Toggle = createRefComponent(function Toggle2(props, forwardedRef) {
38
+ const { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
39
+ const [active = false, setActive] = useControllableState({
40
+ prop: activeProp,
41
+ onChange: onActiveChange,
42
+ defaultProp: defaultActive
43
+ });
44
+ return /* @__PURE__ */ jsx(ToggleFrame, {
45
+ theme: activeTheme ?? null,
46
+ "aria-pressed": active,
47
+ "data-state": active ? "on" : "off",
48
+ "data-disabled": props.disabled ? "" : void 0,
49
+ ...active && !activeStyle && { defaultActiveStyle: true },
50
+ ...buttonProps,
51
+ ...active && activeStyle ? activeStyle : void 0,
52
+ ref: forwardedRef,
53
+ onPress: composeEventHandlers(props.onPress ?? void 0, () => {
54
+ if (!props.disabled) {
55
+ setActive((prev) => !prev);
56
+ }
57
+ })
58
+ });
111
59
  });
60
+
112
61
  export { Toggle, ToggleFrame };
113
62
  //# sourceMappingURL=Toggle.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["composeEventHandlers","useControllableState","styled","View","React","context","jsx","NAME","ToggleFrame","name","render","variants","unstyled","false","size","alignItems","justifyContent","display","backgroundColor","borderColor","borderWidth","margin","hoverStyle","pressStyle","focusVisibleStyle","outlineColor","outlineWidth","outlineStyle","zIndex","...size","val","tokens","width","height","defaultActiveStyle","true","focusStyle","defaultVariants","process","env","TAMAGUI_HEADLESS","accept","activeStyle","Toggle","forwardRef","props","forwardedRef","active","activeProp","defaultActive","onActiveChange","activeTheme","buttonProps","setActive","prop","onChange","defaultProp","theme","disabled","ref","onPress","prev"],"sources":["../../src/Toggle.tsx"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"Toggle.js","names":[],"sources":["esm/Toggle.js"],"sourcesContent":["import { createRefComponent } from \"@tamagui/compose-refs\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\nimport { resolveSizeToken } from \"@tamagui/size\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport { styled, View } from \"@tamagui/web\";\nimport { context } from \"./context\";\nimport { jsx } from \"react/jsx-runtime\";\nconst NAME = \"Toggle\";\nconst ToggleFrame = styled(\n View,\n {\n displayName: NAME,\n render: \"button\",\n context,\n size: true,\n alignItems: \"center\",\n justifyContent: \"center\",\n display: \"flex\",\n variants: {\n size: {\n number: (val) => ({\n width: val,\n height: val\n }),\n Size: (val, { tokens }) => {\n if (!val) return;\n const sizeToken = resolveSizeToken(val, \"size\");\n const size = typeof sizeToken === \"number\" ? sizeToken : tokens.size[sizeToken];\n return {\n width: size,\n height: size\n };\n }\n },\n defaultActiveStyle: {\n true: {}\n }\n }\n },\n {\n accept: {\n activeStyle: \"style\"\n }\n }\n);\nconst Toggle = createRefComponent(\n function Toggle2(props, forwardedRef) {\n const {\n active: activeProp,\n activeStyle,\n defaultActive = false,\n onActiveChange,\n activeTheme,\n ...buttonProps\n } = props;\n const [active = false, setActive] = useControllableState({\n prop: activeProp,\n onChange: onActiveChange,\n defaultProp: defaultActive\n });\n return /* @__PURE__ */ jsx(\n ToggleFrame,\n {\n theme: activeTheme ?? null,\n \"aria-pressed\": active,\n \"data-state\": active ? \"on\" : \"off\",\n \"data-disabled\": props.disabled ? \"\" : void 0,\n ...active && !activeStyle && { defaultActiveStyle: true },\n ...buttonProps,\n ...active && activeStyle ? activeStyle : void 0,\n ref: forwardedRef,\n onPress: composeEventHandlers(props.onPress ?? void 0, () => {\n if (!props.disabled) {\n setActive((prev) => !prev);\n }\n })\n }\n );\n }\n);\nexport {\n Toggle,\n ToggleFrame\n};\n//# sourceMappingURL=Toggle.js.map\n"],"mappings":";;;;;;;;;AAOA,MAAM,OAAO;AACb,MAAM,cAAc,OAClB,MACA;CACE,aAAa;CACb,QAAQ;CACR;CACA,MAAM;CACN,YAAY;CACZ,gBAAgB;CAChB,SAAS;CACT,UAAU;EACR,MAAM;GACJ,SAAS,SAAS;IAChB,OAAO;IACP,QAAQ;GACV;GACA,OAAO,KAAK,EAAE,aAAa;IACzB,IAAI,CAAC,KAAK;IACV,MAAM,YAAY,iBAAiB,KAAK,MAAM;IAC9C,MAAM,OAAO,OAAO,cAAc,WAAW,YAAY,OAAO,KAAK;IACrE,OAAO;KACL,OAAO;KACP,QAAQ;IACV;GACF;EACF;EACA,oBAAoB,EAClB,MAAM,CAAC,EACT;CACF;AACF,GACA,EACE,QAAQ,EACN,aAAa,QACf,EACF,CACF;AACA,MAAM,SAAS,mBACb,SAAS,QAAQ,OAAO,cAAc;CACpC,MAAM,EACJ,QAAQ,YACR,aACA,gBAAgB,OAChB,gBACA,aACA,GAAG,gBACD;CACJ,MAAM,CAAC,SAAS,OAAO,aAAa,qBAAqB;EACvD,MAAM;EACN,UAAU;EACV,aAAa;CACf,CAAC;CACD,OAAuB,oBACrB,aACA;EACE,OAAO,eAAe;EACtB,gBAAgB;EAChB,cAAc,SAAS,OAAO;EAC9B,iBAAiB,MAAM,WAAW,KAAK,KAAK;EAC5C,GAAG,UAAU,CAAC,eAAe,EAAE,oBAAoB,KAAK;EACxD,GAAG;EACH,GAAG,UAAU,cAAc,cAAc,KAAK;EAC9C,KAAK;EACL,SAAS,qBAAqB,MAAM,WAAW,KAAK,SAAS;GAC3D,IAAI,CAAC,MAAM,UAAU;IACnB,WAAW,SAAS,CAAC,IAAI;GAC3B;EACF,CAAC;CACH,CACF;AACF,CACF"}
@@ -1,123 +1,69 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createRefComponent } from "@tamagui/compose-refs";
2
3
  import { composeEventHandlers } from "@tamagui/helpers";
4
+ import { resolveSizeToken } from "@tamagui/size";
3
5
  import { useControllableState } from "@tamagui/use-controllable-state";
4
- import { styled, View } from "@tamagui/web";
5
- import * as React from "react";
6
+ import { View, styled } from "@tamagui/web";
7
+ import "react";
6
8
  import { context } from "./context.native.js";
9
+
7
10
  var NAME = "Toggle";
8
11
  var ToggleFrame = styled(View, {
9
- name: NAME,
10
- render: "button",
11
- context,
12
- variants: {
13
- unstyled: {
14
- false: {
15
- size: "$true",
16
- alignItems: "center",
17
- justifyContent: "center",
18
- display: "flex",
19
- backgroundColor: "$background",
20
- borderColor: "$borderColor",
21
- borderWidth: 1,
22
- margin: -1,
23
- hoverStyle: {
24
- backgroundColor: "$backgroundHover",
25
- borderColor: "$borderColorHover"
26
- },
27
- pressStyle: {
28
- backgroundColor: "$backgroundPress",
29
- borderColor: "$borderColorPress"
30
- },
31
- focusVisibleStyle: {
32
- outlineColor: "$outlineColor",
33
- outlineWidth: 2,
34
- outlineStyle: "solid",
35
- zIndex: 10
36
- }
37
- }
38
- },
39
- size: {
40
- "...size": function (val, param) {
41
- var {
42
- tokens
43
- } = param;
44
- if (!val) return;
45
- return {
46
- width: tokens.size[val],
47
- height: tokens.size[val]
48
- };
49
- },
50
- ":number": function (val) {
51
- return {
52
- width: val,
53
- height: val
54
- };
55
- }
56
- },
57
- defaultActiveStyle: {
58
- true: {
59
- backgroundColor: "$backgroundActive",
60
- hoverStyle: {
61
- backgroundColor: "$backgroundActive"
62
- },
63
- focusStyle: {
64
- backgroundColor: "$backgroundActive"
65
- }
66
- }
67
- }
68
- },
69
- defaultVariants: {
70
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
71
- }
72
- }, {
73
- accept: {
74
- activeStyle: "style"
75
- }
76
- });
77
- var Toggle = /* @__PURE__ */React.forwardRef(function Toggle2(props, forwardedRef) {
78
- var {
79
- active: activeProp,
80
- activeStyle,
81
- defaultActive = false,
82
- onActiveChange,
83
- activeTheme,
84
- unstyled = false,
85
- ...buttonProps
86
- } = props;
87
- var [active = false, setActive] = useControllableState({
88
- prop: activeProp,
89
- onChange: onActiveChange,
90
- defaultProp: defaultActive
91
- });
92
- var _props_onPress;
93
- return /* @__PURE__ */_jsx(ToggleFrame, {
94
- theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,
95
- "aria-pressed": active,
96
- "data-state": active ? "on" : "off",
97
- "data-disabled": props.disabled ? "" : void 0,
98
- unstyled,
99
- ...(active && !activeStyle && !unstyled && {
100
- defaultActiveStyle: true
101
- }),
102
- ...buttonProps,
103
- // spread activeStyle after buttonProps so it wins when active: a styled()
104
- // variant (e.g. a resting `backgroundColor`) forwards that value as a plain
105
- // prop into buttonProps, which would otherwise clobber the activeStyle merge
106
- // on overlapping keys and leave the active item stuck at its resting style.
107
- ...(active && activeStyle && {
108
- ...activeStyle,
109
- hoverStyle: activeStyle,
110
- focusStyle: activeStyle
111
- }),
112
- ref: forwardedRef,
113
- onPress: composeEventHandlers((_props_onPress = props.onPress) !== null && _props_onPress !== void 0 ? _props_onPress : void 0, function () {
114
- if (!props.disabled) {
115
- setActive(function (prev) {
116
- return !prev;
117
- });
118
- }
119
- })
120
- });
12
+ displayName: NAME,
13
+ render: "button",
14
+ context,
15
+ size: true,
16
+ alignItems: "center",
17
+ justifyContent: "center",
18
+ display: "flex",
19
+ variants: {
20
+ size: {
21
+ number: function(val) {
22
+ return {
23
+ width: val,
24
+ height: val
25
+ };
26
+ },
27
+ Size: function(val, param) {
28
+ var { tokens } = param;
29
+ if (!val) return;
30
+ var sizeToken = resolveSizeToken(val, "size");
31
+ var size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
32
+ return {
33
+ width: size,
34
+ height: size
35
+ };
36
+ }
37
+ },
38
+ defaultActiveStyle: { true: {} }
39
+ }
40
+ }, { accept: { activeStyle: "style" } });
41
+ var Toggle = createRefComponent(function Toggle2(props, forwardedRef) {
42
+ var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
43
+ var [active = false, setActive] = useControllableState({
44
+ prop: activeProp,
45
+ onChange: onActiveChange,
46
+ defaultProp: defaultActive
47
+ });
48
+ var _props_onPress;
49
+ return /* @__PURE__ */ jsx(ToggleFrame, {
50
+ theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,
51
+ "aria-pressed": active,
52
+ "data-state": active ? "on" : "off",
53
+ "data-disabled": props.disabled ? "" : void 0,
54
+ ...active && !activeStyle && { defaultActiveStyle: true },
55
+ ...buttonProps,
56
+ ...active && activeStyle ? activeStyle : void 0,
57
+ ref: forwardedRef,
58
+ onPress: composeEventHandlers((_props_onPress = props.onPress) !== null && _props_onPress !== void 0 ? _props_onPress : void 0, function() {
59
+ if (!props.disabled) {
60
+ setActive(function(prev) {
61
+ return !prev;
62
+ });
63
+ }
64
+ })
65
+ });
121
66
  });
67
+
122
68
  export { Toggle, ToggleFrame };
123
69
  //# sourceMappingURL=Toggle.native.js.map