@tamagui/switch 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 (97) hide show
  1. package/dist/cjs/StyledContext.cjs +19 -23
  2. package/dist/cjs/StyledContext.native.cjs +33 -0
  3. package/dist/cjs/StyledContext.native.js +19 -22
  4. package/dist/cjs/StyledContext.native.js.map +1 -1
  5. package/dist/cjs/Switch.cjs +140 -86
  6. package/dist/cjs/Switch.native.cjs +163 -0
  7. package/dist/cjs/Switch.native.js +147 -90
  8. package/dist/cjs/Switch.native.js.map +1 -1
  9. package/dist/cjs/index.cjs +14 -25
  10. package/dist/cjs/index.native.cjs +31 -0
  11. package/dist/cjs/index.native.js +15 -25
  12. package/dist/cjs/index.native.js.map +1 -1
  13. package/dist/cjs/types.cjs +10 -11
  14. package/dist/cjs/types.native.cjs +19 -0
  15. package/dist/cjs/types.native.js +10 -10
  16. package/dist/cjs/types.native.js.map +1 -1
  17. package/dist/cjs/useSwitchNative.cjs +16 -19
  18. package/dist/cjs/useSwitchNative.native.cjs +65 -0
  19. package/dist/cjs/useSwitchNative.native.js +44 -54
  20. package/dist/cjs/useSwitchNative.native.js.map +1 -1
  21. package/dist/esm/StyledContext.mjs +6 -5
  22. package/dist/esm/StyledContext.mjs.map +1 -1
  23. package/dist/esm/StyledContext.native.js +6 -5
  24. package/dist/esm/StyledContext.native.js.map +1 -1
  25. package/dist/esm/Switch.mjs +119 -71
  26. package/dist/esm/Switch.mjs.map +1 -1
  27. package/dist/esm/Switch.native.js +126 -76
  28. package/dist/esm/Switch.native.js.map +1 -1
  29. package/dist/esm/index.js +8 -12
  30. package/dist/esm/index.mjs +8 -12
  31. package/dist/esm/index.native.js +8 -12
  32. package/dist/esm/types.mjs +0 -2
  33. package/dist/esm/types.native.js +0 -2
  34. package/dist/esm/useSwitchNative.mjs +2 -1
  35. package/dist/esm/useSwitchNative.mjs.map +1 -1
  36. package/dist/esm/useSwitchNative.native.js +30 -31
  37. package/dist/esm/useSwitchNative.native.js.map +1 -1
  38. package/dist/jsx/StyledContext.mjs +6 -5
  39. package/dist/jsx/StyledContext.mjs.map +1 -1
  40. package/dist/jsx/StyledContext.native.cjs +33 -0
  41. package/dist/jsx/StyledContext.native.js +19 -22
  42. package/dist/jsx/StyledContext.native.js.map +1 -1
  43. package/dist/jsx/Switch.mjs +119 -71
  44. package/dist/jsx/Switch.mjs.map +1 -1
  45. package/dist/jsx/Switch.native.cjs +163 -0
  46. package/dist/jsx/Switch.native.js +147 -90
  47. package/dist/jsx/Switch.native.js.map +1 -1
  48. package/dist/jsx/index.js +8 -12
  49. package/dist/jsx/index.mjs +8 -12
  50. package/dist/jsx/index.native.cjs +31 -0
  51. package/dist/jsx/index.native.js +15 -25
  52. package/dist/jsx/index.native.js.map +1 -1
  53. package/dist/jsx/types.mjs +0 -2
  54. package/dist/jsx/types.native.cjs +19 -0
  55. package/dist/jsx/types.native.js +10 -10
  56. package/dist/jsx/types.native.js.map +1 -1
  57. package/dist/jsx/useSwitchNative.mjs +2 -1
  58. package/dist/jsx/useSwitchNative.mjs.map +1 -1
  59. package/dist/jsx/useSwitchNative.native.cjs +65 -0
  60. package/dist/jsx/useSwitchNative.native.js +44 -54
  61. package/dist/jsx/useSwitchNative.native.js.map +1 -1
  62. package/package.json +7 -14
  63. package/src/StyledContext.tsx +1 -3
  64. package/src/Switch.tsx +190 -89
  65. package/src/index.ts +0 -20
  66. package/src/types.ts +3 -5
  67. package/types/StyledContext.d.ts +2 -3
  68. package/types/StyledContext.d.ts.map +1 -1
  69. package/types/Switch.d.ts +209 -37
  70. package/types/Switch.d.ts.map +1 -1
  71. package/types/index.d.ts +0 -146
  72. package/types/index.d.ts.map +1 -1
  73. package/types/types.d.ts +3 -4
  74. package/types/types.d.ts.map +1 -1
  75. package/dist/cjs/createSwitch.cjs +0 -186
  76. package/dist/cjs/createSwitch.native.js +0 -194
  77. package/dist/cjs/createSwitch.native.js.map +0 -1
  78. package/dist/esm/createSwitch.mjs +0 -150
  79. package/dist/esm/createSwitch.mjs.map +0 -1
  80. package/dist/esm/createSwitch.native.js +0 -155
  81. package/dist/esm/createSwitch.native.js.map +0 -1
  82. package/dist/esm/index.js.map +0 -1
  83. package/dist/esm/index.mjs.map +0 -1
  84. package/dist/esm/index.native.js.map +0 -1
  85. package/dist/esm/types.mjs.map +0 -1
  86. package/dist/esm/types.native.js.map +0 -1
  87. package/dist/jsx/createSwitch.mjs +0 -150
  88. package/dist/jsx/createSwitch.mjs.map +0 -1
  89. package/dist/jsx/createSwitch.native.js +0 -194
  90. package/dist/jsx/createSwitch.native.js.map +0 -1
  91. package/dist/jsx/index.js.map +0 -1
  92. package/dist/jsx/index.mjs.map +0 -1
  93. package/dist/jsx/types.mjs.map +0 -1
  94. package/src/Switch.draggable-tmp +0 -340
  95. package/src/createSwitch.tsx +0 -201
  96. package/types/createSwitch.d.ts +0 -141
  97. package/types/createSwitch.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","Switch_exports","SwitchFrame","SwitchThumb","module","exports","import_core","require","import_get_token","import_stacks","styled","YStack","variants","unstyled","false","size","backgroundColor","borderRadius","...size","val","getSwitchHeight","height","width","defaultVariants","process","env","TAMAGUI_HEADLESS","accept","activeStyle","Math","round","getVariableValue","getSize","getSwitchWidth","render","tabIndex","focusVisibleStyle","outlineColor","outlineStyle","outlineWidth"],"sources":["../../src/Switch.tsx"],"sourcesContent":[null],"mappings":"AACA,YAAS;;AACT,IAAAA,SAAS,GAAAC,MAAA,CAAAC,cAAe;AACxB,IAAAC,gBAAS,GAAcF,MAAA,CAAAG,wBAAA;AAEhB,IAAAC,iBAAoB,GAAAJ,MAAA,CAAAK,mBAAA;A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C,IAAA;QACFC,eAAA;QACFC,YAAA;MAEM;IAGN;IAEOF,IAAM;MACX,oBAAAG,CAAAC,GAAA;QACA,IAAAJ,IAAA,GAAAK,eAAA,CAAAD,GAAA;QACE,OAAM;UACNE,MAAQ,EAAAN,IAAA;UACRO,KAAU,EAAAP;QAEV;MACE;IAAU;EACD;EACSQ,eACd;IAAiBV,QAEjB,EAAAW,OAAA,CAAAC,GAAA,CAAAC,gBAAmB;EAAA;AACH;EACAC,MAAA;IACAC,WAChB;EAAA;AACF;AACF,IAAAR,eAEM,YAAAA,CAAAD,GAAA;EAAA,OACJU,IAAA,CAAAC,KAAW,CAAC,IAAAxB,WAAa,CAAAyB,gBAAM,MAAAvB,gBAAA,CAAAwB,OAAA,EAAAb,GAAA;AAC7B;AACA,IAAAc,cAAM,YAAAA,CAASd,GAAA;EACf,OAAAC,eAAc,CAAAD,GAAA;AACd;AAAO,IAAAjB,WACL,OAAAI,WAAA,CAAAI,MAAA,EAAAD,aAAA,CAAAE,MAAA;EAAAvB,IAAA,UACA;EAAW8C,MAAA,UACX;EAAAC,QACF;EAAAvB,QACF;IAAAC,QACF;MACFC,KAAA;QAEAG,YAAA,EAAiB;QACfD,eAAU,EAAQ,aAAI;QACxBoB,iBAAA;UACFC,YAAA;UACAC,YAAA;UACEC,YAAQ;QACN;MACF;IACF;IACFxB,IAAA","ignoreList":[]}
1
+ {"version":3,"file":"Switch.native.js","names":[],"sources":["jsx/Switch.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n 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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Switch_exports = {};\n__export(Switch_exports, {\n Switch: () => Switch,\n SwitchFrame: () => SwitchFrame,\n SwitchThumb: () => SwitchThumb,\n SwitchThumbFrame: () => SwitchThumbFrame,\n createSwitch: () => createSwitch\n});\nmodule.exports = __toCommonJS(Switch_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_core = require(\"@tamagui/core\");\nvar import_switch_headless = require(\"@tamagui/switch-headless\");\nvar import_use_controllable_state = require(\"@tamagui/use-controllable-state\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_StyledContext = require(\"./StyledContext\");\nvar import_useSwitchNative = require(\"./useSwitchNative\");\nvar SwitchThumbFrame = (0, import_core.styled)(import_core.View, {\n displayName: \"SwitchThumb\",\n context: import_StyledContext.SwitchStyledContext\n});\nvar SwitchFrame = (0, import_core.styled)(import_core.View, {\n displayName: \"Switch\",\n context: import_StyledContext.SwitchStyledContext,\n render: \"button\",\n tabIndex: 0\n});\nfunction createSwitch(createProps) {\n var _createProps_Frame;\n var Frame = (_createProps_Frame = createProps.Frame) !== null && _createProps_Frame !== void 0 ? _createProps_Frame : SwitchFrame;\n var _createProps_Thumb;\n var Thumb = (_createProps_Thumb = createProps.Thumb) !== null && _createProps_Thumb !== void 0 ? _createProps_Thumb : SwitchThumbFrame;\n Frame.staticConfig.context = import_StyledContext.SwitchStyledContext;\n Thumb.staticConfig.context = import_StyledContext.SwitchStyledContext;\n var SwitchThumbComponent = (0, import_core.createStyledHOC)(Thumb, function SwitchThumb2(props, forwardedRef) {\n var _createProps_componentThemes;\n var { size: sizeProp, activeStyle, theme, ...thumbProps } = props;\n var styledContext = import_StyledContext.SwitchStyledContext.useStyledContext();\n var { size: sizeContext, active, disabled, frameWidth = 0 } = styledContext;\n var _ref;\n var size = (_ref = sizeProp !== null && sizeProp !== void 0 ? sizeProp : sizeContext) !== null && _ref !== void 0 ? _ref : true;\n var initialChecked = React.useRef(active).current;\n var initialWidth = (0, import_core.getVariableValue)(props.width, \"size\");\n var [thumbWidth, setThumbWidth] = React.useState(typeof initialWidth === \"number\" ? initialWidth : 0);\n var distance = frameWidth - thumbWidth;\n var x = initialChecked ? active ? 0 : -distance : active ? distance : 0;\n var thumb = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Thumb, {\n ref: forwardedRef,\n size,\n alignSelf: initialChecked ? \"flex-end\" : \"flex-start\",\n x,\n onLayout: (0, import_core.composeEventHandlers)(props.onLayout, function(event) {\n setThumbWidth(event.nativeEvent.layout.width);\n }),\n disabled,\n ...thumbProps,\n ...active && activeStyle\n });\n var themeName = theme !== null && theme !== void 0 ? theme : (_createProps_componentThemes = createProps.componentThemes) === null || _createProps_componentThemes === void 0 ? void 0 : _createProps_componentThemes.thumb;\n return themeName ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {\n name: themeName,\n children: thumb\n }) : thumb;\n });\n var SwitchComponent = (0, import_core.createStyledHOC)(Frame, function Switch2(_props, forwardedRef) {\n var _createProps_componentThemes;\n var { native, nativeProps, checked: checkedProp, defaultChecked, onCheckedChange, activeStyle, activeTheme, theme, ...props } = _props;\n var [checked, setChecked] = (0, import_use_controllable_state.useControllableState)({\n prop: checkedProp,\n defaultProp: defaultChecked || false,\n onChange: onCheckedChange,\n transition: true\n });\n var styledContext = React.useContext(import_StyledContext.SwitchStyledContext.context);\n var [frameWidth, setFrameInnerWidth] = React.useState(0);\n var { switchProps, bubbleInput, switchRef } = (0, import_switch_headless.useSwitch)(\n props,\n [\n checked,\n setChecked\n ],\n // @ts-ignore TODO tamagui react 19 type error\n forwardedRef\n );\n var nativeSwitch = (0, import_useSwitchNative.useSwitchNative)({\n id: props.id,\n disabled: props.disabled,\n native,\n nativeProps,\n checked,\n setChecked\n });\n if (nativeSwitch) {\n return nativeSwitch;\n }\n var disabled = props.disabled;\n var _styledContext_size, _ref;\n var size = (_ref = (_styledContext_size = styledContext.size) !== null && _styledContext_size !== void 0 ? _styledContext_size : props.size) !== null && _ref !== void 0 ? _ref : true;\n var handleLayout = function(event) {\n var next = event.nativeEvent.layout.width;\n if (next !== frameWidth) {\n setFrameInnerWidth(next);\n }\n };\n var frame = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Frame, {\n ref: switchRef,\n render: \"button\",\n ...import_core.isWeb && {\n type: \"button\"\n },\n size,\n ...props,\n ...switchProps,\n disabled,\n ...checked && activeStyle,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.View, {\n alignSelf: \"stretch\",\n flex: 1,\n onLayout: handleLayout,\n children: props.children\n })\n });\n var _ref1, _ref2;\n var frameTheme = (_ref2 = (_ref1 = checked ? activeTheme : void 0) !== null && _ref1 !== void 0 ? _ref1 : theme) !== null && _ref2 !== void 0 ? _ref2 : (_createProps_componentThemes = createProps.componentThemes) === null || _createProps_componentThemes === void 0 ? void 0 : _createProps_componentThemes.frame;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {\n children: [\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StyledContext.SwitchStyledContext.Provider, {\n size,\n active: checked,\n disabled,\n frameWidth,\n children: frameTheme ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {\n name: frameTheme,\n children: frame\n }) : frame\n }),\n bubbleInput\n ]\n });\n }, {\n disableTheme: true\n });\n return (0, import_core.withStaticProperties)(SwitchComponent, {\n Frame,\n Thumb: SwitchThumbComponent\n });\n}\nvar Switch = createSwitch({\n Frame: SwitchFrame,\n Thumb: SwitchThumbFrame\n});\nvar SwitchThumb = Switch.Thumb;\n//# sourceMappingURL=Switch.js.map\n"],"mappings":";;;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;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,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,iBAAiB,CAAC;AACtB,SAAS,gBAAgB;CACvB,cAAc;CACd,mBAAmB;CACnB,mBAAmB;CACnB,w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iB;EAC5D;EACA,OAAO;CACT,CAAC;AACH;AACA,IAAI,SAAS,aAAa;CACxB,OAAO;CACP,OAAO;AACT,CAAC;AACD,IAAI,cAAc,OAAO"}
package/dist/jsx/index.js CHANGED
@@ -1,13 +1,9 @@
1
- import { createSwitch } from "./createSwitch.mjs";
2
- import { SwitchFrame, SwitchThumb } from "./Switch.mjs";
3
- export * from "./createSwitch.mjs";
4
- export * from "./StyledContext.mjs";
5
- export * from "./Switch.mjs";
6
- export * from "./types.mjs";
7
1
  import { useSwitchNative } from "./useSwitchNative.mjs";
8
- const Switch = createSwitch({
9
- Frame: SwitchFrame,
10
- Thumb: SwitchThumb
11
- });
12
- export { Switch, useSwitchNative };
13
- //# sourceMappingURL=index.js.map
2
+
3
+ export * from "./StyledContext.mjs"
4
+
5
+ export * from "./Switch.mjs"
6
+
7
+ export * from "./types.mjs"
8
+
9
+ export { useSwitchNative };
@@ -1,13 +1,9 @@
1
- import { createSwitch } from "./createSwitch.mjs";
2
- import { SwitchFrame, SwitchThumb } from "./Switch.mjs";
3
- export * from "./createSwitch.mjs";
4
- export * from "./StyledContext.mjs";
5
- export * from "./Switch.mjs";
6
- export * from "./types.mjs";
7
1
  import { useSwitchNative } from "./useSwitchNative.mjs";
8
- const Switch = createSwitch({
9
- Frame: SwitchFrame,
10
- Thumb: SwitchThumb
11
- });
12
- export { Switch, useSwitchNative };
13
- //# sourceMappingURL=index.mjs.map
2
+
3
+ export * from "./StyledContext.mjs"
4
+
5
+ export * from "./Switch.mjs"
6
+
7
+ export * from "./types.mjs"
8
+
9
+ export { useSwitchNative };
@@ -0,0 +1,31 @@
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, { useSwitchNative: () => import_useSwitchNative.useSwitchNative });
27
+ module.exports = __toCommonJS(index_exports);
28
+ __reExport(index_exports, require("./StyledContext.native.js"), module.exports);
29
+ __reExport(index_exports, require("./Switch.native.js"), module.exports);
30
+ __reExport(index_exports, require("./types.native.js"), module.exports);
31
+ var import_useSwitchNative = require("./useSwitchNative.native.js");
@@ -1,43 +1,33 @@
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
- Switch: () => Switch,
29
- useSwitchNative: () => import_useSwitchNative.useSwitchNative
30
- });
26
+ __export(index_exports, { useSwitchNative: () => import_useSwitchNative.useSwitchNative });
31
27
  module.exports = __toCommonJS(index_exports);
32
- var import_createSwitch = require("./createSwitch.native.js");
33
- var import_Switch = require("./Switch.native.js");
34
- __reExport(index_exports, require("./createSwitch.native.js"), module.exports);
35
28
  __reExport(index_exports, require("./StyledContext.native.js"), module.exports);
36
29
  __reExport(index_exports, require("./Switch.native.js"), module.exports);
37
30
  __reExport(index_exports, require("./types.native.js"), module.exports);
38
31
  var import_useSwitchNative = require("./useSwitchNative.native.js");
39
- var Switch = (0, import_createSwitch.createSwitch)({
40
- Frame: import_Switch.SwitchFrame,
41
- Thumb: import_Switch.SwitchThumb
42
- });
32
+
43
33
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AACT,IAAAA,SAAS,GAAAC,MAAa,CAAAC,cAAA;AAEtB,IAAAC,gBAAc,GAAAF,MAAA,CAAAG,wBAAA;AACd,IAAAC,iBAAc,GAAAJ,MAAA,CAAAK,mBAAA;AACd,IAAAC,YAAc,GAAAN,MAAA,CAAAO,SAAA,CAAAC,cAAA;AACd,IAAAC,QAAA,GAAcA,CAAAC,MAAA,EAAAC,GAAA;EACd,SAASC,IAAA,IAAAD,GAAA,EAaFZ,SAAM,CAAAW,MAAS,EAAAE,IAAA,EAAa;IAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;IAAAE,UAAA;EAAA;AAAA;AAC1B,IACPC,WAAO,GAAAA,CAAAC,EAAA,EAAAC,IAAA,EAAAC,MAAA,EAAAC,IAAA;EACR,IAAAF,IAAA,WAAAA,IAAA,wBAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["jsx/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 useSwitchNative: () => import_useSwitchNative.useSwitchNative\n});\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./StyledContext\"), module.exports);\n__reExport(index_exports, require(\"./Switch\"), module.exports);\n__reExport(index_exports, require(\"./types\"), module.exports);\nvar import_useSwitchNative = require(\"./useSwitchNative\");\n//# sourceMappingURL=index.js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Descriptor;
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":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.native.js","names":[],"sources":["jsx/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,5 +1,6 @@
1
1
  function useSwitchNative(_props) {
2
- return null;
2
+ return null;
3
3
  }
4
+
4
5
  export { useSwitchNative };
5
6
  //# sourceMappingURL=useSwitchNative.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["useSwitchNative","_props"],"sources":["../../src/useSwitchNative.tsx"],"sourcesContent":[null],"mappings":"AAKO,SAASA,gBAAgBC,MAAA,EAAsD;EACpF,OAAO;AACT","ignoreList":[]}
1
+ {"version":3,"file":"useSwitchNative.js","names":[],"sources":["jsx/useSwitchNative.js"],"sourcesContent":["function useSwitchNative(_props) {\n return null;\n}\nexport {\n useSwitchNative\n};\n//# sourceMappingURL=useSwitchNative.js.map\n"],"mappings":";AAAA,SAAS,gBAAgB,QAAQ;CAC/B,OAAO;AACT"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
28
+ }) : target, mod));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var useSwitchNative_native_exports = {};
31
+ __export(useSwitchNative_native_exports, { useSwitchNative: () => useSwitchNative });
32
+ module.exports = __toCommonJS(useSwitchNative_native_exports);
33
+ var import_jsx_runtime = require("react/jsx-runtime");
34
+ var import_core = require("@tamagui/core");
35
+ var import_focusable = require("@tamagui/focusable");
36
+ var React = __toESM(require("react"), 1);
37
+ var import_react_native = require("react-native");
38
+ function useSwitchNative(props) {
39
+ var { id, disabled, native, nativeProps, checked, setChecked } = props;
40
+ React.useEffect(function() {
41
+ if (!id) return;
42
+ if (disabled) return;
43
+ return (0, import_focusable.registerFocusable)(id, {
44
+ focusAndSelect: function() {
45
+ setChecked(function(value) {
46
+ return !value;
47
+ });
48
+ },
49
+ focus: function() {}
50
+ });
51
+ }, [
52
+ id,
53
+ disabled,
54
+ setChecked
55
+ ]);
56
+ var renderNative = (0, import_core.shouldRenderNativePlatform)(native);
57
+ if (renderNative === "android" || renderNative === "ios") {
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Switch, {
59
+ value: checked,
60
+ onValueChange: setChecked,
61
+ ...nativeProps
62
+ });
63
+ }
64
+ return null;
65
+ }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,36 +8,27 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
8
  var __getProtoOf = Object.getPrototypeOf;
8
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
10
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
14
15
  };
15
16
  var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: () => from[key],
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
23
24
  };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
32
28
  }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
30
  var useSwitchNative_native_exports = {};
37
- __export(useSwitchNative_native_exports, {
38
- useSwitchNative: () => useSwitchNative
39
- });
31
+ __export(useSwitchNative_native_exports, { useSwitchNative: () => useSwitchNative });
40
32
  module.exports = __toCommonJS(useSwitchNative_native_exports);
41
33
  var import_jsx_runtime = require("react/jsx-runtime");
42
34
  var import_core = require("@tamagui/core");
@@ -44,34 +36,32 @@ var import_focusable = require("@tamagui/focusable");
44
36
  var React = __toESM(require("react"), 1);
45
37
  var import_react_native = require("react-native");
46
38
  function useSwitchNative(props) {
47
- var {
48
- id,
49
- disabled,
50
- native,
51
- nativeProps,
52
- checked,
53
- setChecked
54
- } = props;
55
- React.useEffect(function () {
56
- if (!id) return;
57
- if (disabled) return;
58
- return (0, import_focusable.registerFocusable)(id, {
59
- focusAndSelect: function () {
60
- setChecked(function (value) {
61
- return !value;
62
- });
63
- },
64
- focus: function () {}
65
- });
66
- }, [id, disabled, setChecked]);
67
- var renderNative = (0, import_core.shouldRenderNativePlatform)(native);
68
- if (renderNative === "android" || renderNative === "ios") {
69
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.Switch, {
70
- value: checked,
71
- onValueChange: setChecked,
72
- ...nativeProps
73
- });
74
- }
75
- return null;
39
+ var { id, disabled, native, nativeProps, checked, setChecked } = props;
40
+ React.useEffect(function() {
41
+ if (!id) return;
42
+ if (disabled) return;
43
+ return (0, import_focusable.registerFocusable)(id, {
44
+ focusAndSelect: function() {
45
+ setChecked(function(value) {
46
+ return !value;
47
+ });
48
+ },
49
+ focus: function() {}
50
+ });
51
+ }, [
52
+ id,
53
+ disabled,
54
+ setChecked
55
+ ]);
56
+ var renderNative = (0, import_core.shouldRenderNativePlatform)(native);
57
+ if (renderNative === "android" || renderNative === "ios") {
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Switch, {
59
+ value: checked,
60
+ onValueChange: setChecked,
61
+ ...nativeProps
62
+ });
63
+ }
64
+ return null;
76
65
  }
66
+
77
67
  //# sourceMappingURL=useSwitchNative.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useSwitchNative_native_exports","__export","useSwitchNative","module","exports","__toCommonJS","import_jsx_runtime","require","import_core","import_focusable","React","__toESM","import_react_native","props","id","disabled","native","nativeProps","checked","setChecked","useEffect","registerFocusable","focusAndSelect","value","focus","renderNative","shouldRenderNativePlatform","jsx","Switch","onValueChange"],"sources":["../../src/useSwitchNative.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,8BAAA;AAAAC,QAAA,CAAAD,8BAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,8BAAA;AAAA,IAAAM,kBAAA,GAA4BC,OAAA;AAC5B,IAAAC,WAAA,GAA2CD,OAAA;AAC3C,IAAAE,gBAAA,GAAkCF,OAAA;AAClC,IAAAG,KAAA,GAAuBC,OAAA,CAAAJ,OAAA;AACvB,IAAAK,mBAAA,GAAuCL,OAAA;AAG5B,SAASL,gBAAgBW,KAAA,EAAO;EACvC,IAAI;IAAEC,EAAA;IAAIC,QAAA;IAAUC,MAAA;IAAQC,WAAA;IAAaC,OAAA;IAASC;EAAW,IAAIN,KAAA;EACjEH,KAAA,CAAMU,SAAA,CAAU,YAAW;IACvB,IAAI,CAACN,EAAA,EAAI;IACT,IAAIC,QAAA,EAAU;IACd,WAAON,gBAAA,CAAAY,iBAAA,EAAkBP,EAAA,EAAI;MACzBQ,cAAA,EAAgB,SAAAA,CAAA,EAAW;QACvBH,UAAA,CAAW,UAASI,KAAA,EAAO;UACvB,OAAO,CAACA,KAAA;QACZ,CAAC;MACL;MACAC,KAAA,EAAO,SAAAA,CAAA,EAAW,CAAC;IACvB,CAAC;EACL,GAAG,CACCV,EAAA,EACAC,QAAA,EACAI,UAAA,CACH;EACD,IAAIM,YAAA,OAAejB,WAAA,CAAAkB,0BAAA,EAA2BV,MAAM;EACpD,IAAIS,YAAA,KAAiB,aAAaA,YAAA,KAAiB,OAAO;IACtD,OAAqB,mBAAAnB,kBAAA,CAAAqB,GAAA,EAAKf,mBAAA,CAAAgB,MAAA,EAAc;MACpCL,KAAA,EAAOL,OAAA;MACPW,aAAA,EAAeV,UAAA;MACf,GAAGF;IACP,CAAC;EACL;EACA,OAAO;AACX","ignoreList":[]}
1
+ {"version":3,"file":"useSwitchNative.native.js","names":[],"sources":["jsx/useSwitchNative.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n 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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar useSwitchNative_native_exports = {};\n__export(useSwitchNative_native_exports, {\n useSwitchNative: () => useSwitchNative\n});\nmodule.exports = __toCommonJS(useSwitchNative_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_core = require(\"@tamagui/core\");\nvar import_focusable = require(\"@tamagui/focusable\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_react_native = require(\"react-native\");\nfunction useSwitchNative(props) {\n var { id, disabled, native, nativeProps, checked, setChecked } = props;\n React.useEffect(function() {\n if (!id) return;\n if (disabled) return;\n return (0, import_focusable.registerFocusable)(id, {\n focusAndSelect: function() {\n setChecked(function(value) {\n return !value;\n });\n },\n focus: function() {\n }\n });\n }, [\n id,\n disabled,\n setChecked\n ]);\n var renderNative = (0, import_core.shouldRenderNativePlatform)(native);\n if (renderNative === \"android\" || renderNative === \"ios\") {\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Switch, {\n value: checked,\n onValueChange: setChecked,\n ...nativeProps\n });\n }\n return null;\n}\n//# s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sBAAsB,QAAQ,cAAc;AAChD,SAAS,gBAAgB,OAAO;CAC9B,IAAI,EAAE,IAAI,UAAU,QAAQ,aAAa,SAAS,eAAe;CACjE,MAAM,UAAU,WAAW;EACzB,IAAI,CAAC,IAAI;EACT,IAAI,UAAU;EACd,QAAQ,GAAG,iBAAiB,mBAAmB,IAAI;GACjD,gBAAgB,WAAW;IACzB,WAAW,SAAS,OAAO;KACzB,OAAO,CAAC;IACV,CAAC;GACH;GACA,OAAO,WAAW,CAClB;EACF,CAAC;CACH,GAAG;EACD;EACA;EACA;CACF,CAAC;CACD,IAAI,gBAAgB,GAAG,YAAY,4BAA4B,MAAM;CACrE,IAAI,iBAAiB,aAAa,iBAAiB,OAAO;EACxD,OAAuB,iBAAC,GAAG,mBAAmB,KAAK,oBAAoB,QAAQ;GAC7E,OAAO;GACP,eAAe;GACf,GAAG;EACL,CAAC;CACH;CACA,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/switch",
3
- "version": "2.7.7",
3
+ "version": "3.0.0-beta.643.1",
4
4
  "source": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -34,22 +34,15 @@
34
34
  "clean:build": "tamagui-build clean:build"
35
35
  },
36
36
  "dependencies": {
37
- "@tamagui/compose-refs": "2.7.7",
38
- "@tamagui/constants": "2.7.7",
39
- "@tamagui/core": "2.7.7",
40
- "@tamagui/focusable": "2.7.7",
41
- "@tamagui/get-token": "2.7.7",
42
- "@tamagui/helpers": "2.7.7",
43
- "@tamagui/label": "2.7.7",
44
- "@tamagui/stacks": "2.7.7",
45
- "@tamagui/switch-headless": "2.7.7",
46
- "@tamagui/use-controllable-state": "2.7.7",
47
- "@tamagui/use-previous": "2.7.7"
37
+ "@tamagui/core": "3.0.0-beta.643.1",
38
+ "@tamagui/focusable": "3.0.0-beta.643.1",
39
+ "@tamagui/switch-headless": "3.0.0-beta.643.1",
40
+ "@tamagui/use-controllable-state": "3.0.0-beta.643.1"
48
41
  },
49
42
  "devDependencies": {
50
- "@tamagui/build": "2.7.7",
43
+ "@tamagui/build": "3.0.0-beta.643.1",
51
44
  "react": ">=19",
52
- "react-native": "0.83.2"
45
+ "react-native": "0.86.2"
53
46
  },
54
47
  "peerDependencies": {
55
48
  "react": ">=19"
@@ -5,12 +5,10 @@ export const SwitchStyledContext = createStyledContext<{
5
5
  active?: boolean
6
6
  disabled?: boolean
7
7
  frameWidth?: number
8
- size?: SizeTokens
9
- unstyled?: boolean
8
+ size?: SizeTokens | number | true
10
9
  }>({
11
10
  active: false,
12
11
  disabled: false,
13
12
  frameWidth: undefined,
14
13
  size: undefined,
15
- unstyled: process.env.TAMAGUI_HEADLESS === '1',
16
14
  })