@tamagui/switch 3.0.0-beta.669.1 → 3.0.0-beta.719.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 (39) hide show
  1. package/dist/cjs/StyledContext.cjs +0 -1
  2. package/dist/cjs/StyledContext.native.cjs +0 -1
  3. package/dist/cjs/StyledContext.native.js +0 -1
  4. package/dist/cjs/StyledContext.native.js.map +1 -1
  5. package/dist/cjs/Switch.cjs +0 -1
  6. package/dist/cjs/Switch.native.cjs +0 -1
  7. package/dist/cjs/Switch.native.js +0 -1
  8. package/dist/cjs/Switch.native.js.map +1 -1
  9. package/dist/cjs/index.cjs +0 -1
  10. package/dist/cjs/index.native.cjs +0 -1
  11. package/dist/cjs/index.native.js +0 -1
  12. package/dist/cjs/index.native.js.map +1 -1
  13. package/dist/cjs/types.cjs +0 -1
  14. package/dist/cjs/types.native.cjs +0 -1
  15. package/dist/cjs/types.native.js +0 -1
  16. package/dist/cjs/types.native.js.map +1 -1
  17. package/dist/cjs/useSwitchNative.cjs +0 -1
  18. package/dist/cjs/useSwitchNative.native.cjs +0 -1
  19. package/dist/cjs/useSwitchNative.native.js +0 -1
  20. package/dist/cjs/useSwitchNative.native.js.map +1 -1
  21. package/dist/esm/Switch.mjs.map +1 -1
  22. package/dist/esm/Switch.native.js.map +1 -1
  23. package/dist/jsx/StyledContext.native.cjs +0 -1
  24. package/dist/jsx/StyledContext.native.js +0 -1
  25. package/dist/jsx/StyledContext.native.js.map +1 -1
  26. package/dist/jsx/Switch.mjs.map +1 -1
  27. package/dist/jsx/Switch.native.cjs +0 -1
  28. package/dist/jsx/Switch.native.js +0 -1
  29. package/dist/jsx/Switch.native.js.map +1 -1
  30. package/dist/jsx/index.native.cjs +0 -1
  31. package/dist/jsx/index.native.js +0 -1
  32. package/dist/jsx/index.native.js.map +1 -1
  33. package/dist/jsx/types.native.cjs +0 -1
  34. package/dist/jsx/types.native.js +0 -1
  35. package/dist/jsx/types.native.js.map +1 -1
  36. package/dist/jsx/useSwitchNative.native.cjs +0 -1
  37. package/dist/jsx/useSwitchNative.native.js +0 -1
  38. package/dist/jsx/useSwitchNative.native.js.map +1 -1
  39. package/package.json +7 -7
@@ -1,4 +1,3 @@
1
-
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1 +1 @@
1
- {"version":3,"file":"StyledContext.native.js","names":[],"sources":["cjs/StyledContext.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 StyledContext_exports = {};\n__export(StyledContext_exports, {\n SwitchStyledContext: () => SwitchStyledContext\n});\nmodule.exports = __toCommonJS(StyledContext_exports);\nvar import_core = require(\"@tamagui/core\");\nvar SwitchStyledContext = (0, import_core.createStyledContext)({\n active: false,\n disabled: false,\n frameWidth: void 0,\n size: void 0\n});\n//# sourceMappingURL=StyledContext.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,wBAAwB,CAAC;AAC7B,SAAS,uBAAuB,EAC9B,2BAA2B,oBAC7B,CAAC;AACD,OAAO,UAAU,aAAa,qBAAqB;AACnD,IAAI,cAAc,QAAQ,eAAe;AACzC,IAAI,uBAAuB,GAAG,YAAY,qBAAqB;CAC7D,QAAQ;CACR,UAAU;CACV,YAAY,KAAK;CACjB,MAAM,KAAK;AACb,CAAC"}
1
+ {"version":3,"file":"StyledContext.native.js","names":[],"sources":["cjs/StyledContext.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 StyledContext_exports = {};\n__export(StyledContext_exports, {\n SwitchStyledContext: () => SwitchStyledContext\n});\nmodule.exports = __toCommonJS(StyledContext_exports);\nvar import_core = require(\"@tamagui/core\");\nvar SwitchStyledContext = (0, import_core.createStyledContext)({\n active: false,\n disabled: false,\n frameWidth: void 0,\n size: void 0\n});\n//# sourceMappingURL=StyledContext.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,wBAAwB,CAAC;AAC7B,SAAS,uBAAuB,EAC9B,2BAA2B,oBAC7B,CAAC;AACD,OAAO,UAAU,aAAa,qBAAqB;AACnD,IAAI,cAAc,QAAQ,eAAe;AACzC,IAAI,uBAAuB,GAAG,YAAY,oBAAmB,CAAE;CAC7D,QAAQ;CACR,UAAU;CACV,YAAY,KAAK;CACjB,MAAM,KAAK;AACb,CAAC"}
@@ -1,4 +1,3 @@
1
-
2
1
  var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __create = Object.create;
5
4
  var __defProp = Object.defineProperty;
6
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __create = Object.create;
5
4
  var __defProp = Object.defineProperty;
6
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.native.js","names":[],"sources":["cjs/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,WA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,KAAK,IAAI,OAAO;EAClL,IAAI,eAAe,SAAS,OAAO;GACjC,IAAI,OAAO,MAAM,YAAY,OAAO;GACpC,IAAI,SAAS,YAAY;IACvB,mBAAmB,IAAI;GACzB;EACF;EACA,IAAI,QAAwB,iBAAC,GAAG,mBAAmB,KAAK,OAAO;GAC7D,KAAK;GACL,QAAQ;GACR,GAAG,YAAY,SAAS,EACtB,MAAM,SACR;GACA;GACA,GAAG;GACH,GAAG;GACH;GACA,GAAG,WAAW;GACd,UAA0B,iBAAC,GAAG,mBAAmB,KAAK,YAAY,MAAM;IACtE,WAAW;IACX,MAAM;IACN,UAAU;IACV,UAAU,MAAM;GAClB,CAAC;EACH,CAAC;EACD,IAAI,OAAO;EACX,IAAI,cAAc,SAAS,QAAQ,UAAU,cAAc,KAAK,OAAO,QAAQ,UAAU,KAAK,IAAI,QAAQ,WAAW,QAAQ,UAAU,KAAK,IAAI,SAAS,+BAA+B,YAAY,qBAAqB,QAAQ,iCAAiC,KAAK,IAAI,KAAK,IAAI,6BAA6B;EACjT,OAAuB,iBAAC,GAAG,mBAAmB,MAAM,mBAAmB,UAAU,EAC/E,UAAU,CACQ,iBAAC,GAAG,mBAAmB,KAAK,qBAAqB,oBAAoB,UAAU;GAC7F;GACA,QAAQ;GACR;GACA;GACA,UAAU,aAA6B,iBAAC,GAAG,mBAAmB,KAAK,YAAY,OAAO;IACpF,MAAM;IACN,UAAU;GACZ,CAAC,IAAI;EACP,CAAC,GACD,WACF,EACF,CAAC;CACH,GAAG,EACD,cAAc,KAChB,CAAC;CACD,QAAQ,GAAG,YAAY,sBAAsB,iBAAiB;EAC5D;EACA,OAAO;CACT,CAAC;AACH;AACA,IAAI,SAAS,aAAa;CACxB,OAAO;CACP,OAAO;AACT,CAAC;AACD,IAAI,cAAc,OAAO"}
1
+ {"version":3,"file":"Switch.native.js","names":[],"sources":["cjs/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,a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iBAAC,GAAG,mBAAmB,KAAI,CAAE,mBAAmB,UAAU,EAC/E,UAAU,CACQ,iBAAC,GAAG,mBAAmB,IAAG,CAAE,qBAAqB,oBAAoB,UAAU;GAC7F;GACA,QAAQ;GACR;GACA;GACA,UAAU,aAA6B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,YAAY,OAAO;IACpF,MAAM;IACN,UAAU;GACZ,CAAC,IAAI;EACP,CAAC,GACD,WACF,EACF,CAAC;CACH,GAAG,EACD,cAAc,KAChB,CAAC;CACD,QAAQ,GAAG,YAAY,qBAAoB,CAAE,iBAAiB;EAC5D;EACA,OAAO;CACT,CAAC;AACH;AACA,IAAI,SAAS,aAAa;CACxB,OAAO;CACP,OAAO;AACT,CAAC;AACD,IAAI,cAAc,OAAO"}
@@ -1,4 +1,3 @@
1
-
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1 +1 @@
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 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.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,uBAAuB,uBAAuB,gBAChD,CAAC;AACD,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,2BAAiB,GAAG,OAAO,OAAO;AACpE,WAAW,eAAe,QAAQ,oBAAU,GAAG,OAAO,OAAO;AAC7D,WAAW,eAAe,QAAQ,mBAAS,GAAG,OAAO,OAAO;AAC5D,IAAI,yBAAyB,QAAQ,6BAAmB"}
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 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.map\n"],"mappings":";;;AAC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3
-
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1 +1 @@
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
+ {"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,4 +1,3 @@
1
-
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __create = Object.create;
5
4
  var __defProp = Object.defineProperty;
6
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __create = Object.create;
5
4
  var __defProp = Object.defineProperty;
6
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1 +1 @@
1
- {"version":3,"file":"useSwitchNative.native.js","names":[],"sources":["cjs/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//# sourceMappingURL=useSwitchNative.native.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;GA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"}
1
+ {"version":3,"file":"useSwitchNative.native.js","names":[],"sources":["cjs/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//# sourceMappingURL=useSwitchNative.native.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,iCAAiC,CAAC;AACtC,SAAS,gCAAgC,EACvC,uBAAuB,gBACzB,CAAC;AACD,OAAO,UAAU,aAAa,8BAA8B;AAC5D,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,cAAc,QAAQ,eAAe;AACzC,IAAI,mBAAmB,QAAQ,oBAAoB;AACnD,IAAI,QAAQ,QAAQ,QAAQ,OAAO,GAAG,CAAC;AACvC,IAAI,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,kBAAiB,CAAE,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,2BAA0B,CAAE,MAAM;CACrE,IAAI,iBAAiB,aAAa,iBAAiB,OAAO;EACxD,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,oBAAoB,QAAQ;GAC7E,OAAO;GACP,eAAe;GACf,GAAG;EACL,CAAC;CACH;CACA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","names":[],"sources":["esm/Switch.js"],"sourcesContent":["import {\n composeEventHandlers,\n createStyledHOC,\n getVariableValue,\n isWeb,\n styled,\n Theme,\n View,\n withStaticProperties\n} from \"@tamagui/core\";\nimport { useSwitch } from \"@tamagui/switch-headless\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { SwitchStyledContext } from \"./StyledContext\";\nimport { useSwitchNative } from \"./useSwitchNative\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nconst SwitchThumbFrame = styled(View, {\n displayName: \"SwitchThumb\",\n context: SwitchStyledContext\n});\nconst SwitchFrame = styled(View, {\n displayName: \"Switch\",\n context: SwitchStyledContext,\n render: \"button\",\n tabIndex: 0\n});\nfunction createSwitch(createProps) {\n const Frame = createProps.Frame ?? SwitchFrame;\n const Thumb = createProps.Thumb ?? SwitchThumbFrame;\n Frame.staticConfig.context = SwitchStyledContext;\n Thumb.staticConfig.context = SwitchStyledContext;\n const SwitchThumbComponent = createStyledHOC(\n Thumb,\n function SwitchThumb2(props, forwardedRef) {\n const { size: sizeProp, activeStyle, theme, ...thumbProps } = props;\n const styledContext = SwitchStyledContext.useStyledContext();\n const { size: sizeContext, active, disabled, frameWidth = 0 } = styledContext;\n const size = sizeProp ?? sizeContext ?? true;\n const initialChecked = React.useRef(active).current;\n const initialWidth = getVariableValue(props.width, \"size\");\n const [thumbWidth, setThumbWidth] = React.useState(\n typeof initialWidth === \"number\" ? initialWidth : 0\n );\n const distance = frameWidth - thumbWidth;\n const x = initialChecked ? active ? 0 : -distance : active ? distance : 0;\n const thumb = /* @__PURE__ */ jsx(\n Thumb,\n {\n ref: forwardedRef,\n size,\n alignSelf: initialChecked ? \"flex-end\" : \"flex-start\",\n x,\n onLayout: composeEventHandlers(props.onLayout, (event) => {\n setThumbWidth(event.nativeEvent.layout.width);\n }),\n disabled,\n ...thumbProps,\n ...active && activeStyle\n }\n );\n const themeName = theme ?? createProps.componentThemes?.thumb;\n return themeName ? /* @__PURE__ */ jsx(Theme, { name: themeName, children: thumb }) : thumb;\n }\n );\n const SwitchComponent = createStyledHOC(\n Frame,\n function Switch2(_props, forwardedRef) {\n const {\n native,\n nativeProps,\n checked: checkedProp,\n defaultChecked,\n onCheckedChange,\n activeStyle,\n activeTheme,\n theme,\n ...props\n } = _props;\n const [checked, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked || false,\n onChange: onCheckedChange,\n transition: true\n });\n const styledContext = React.useContext(SwitchStyledContext.context);\n const [frameWidth, setFrameInnerWidth] = React.useState(0);\n const { switchProps, bubbleInput, switchRef } = useSwitch(\n props,\n [checked, setChecked],\n // @ts-ignore TODO tamagui react 19 type error\n forwardedRef\n );\n const nativeSwitch = 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 const disabled = props.disabled;\n const size = styledContext.size ?? props.size ?? true;\n const handleLayout = (event) => {\n const next = event.nativeEvent.layout.width;\n if (next !== frameWidth) {\n setFrameInnerWidth(next);\n }\n };\n const frame = /* @__PURE__ */ jsx(\n Frame,\n {\n ref: switchRef,\n render: \"button\",\n ...isWeb && { type: \"button\" },\n size,\n ...props,\n ...switchProps,\n disabled,\n ...checked && activeStyle,\n children: /* @__PURE__ */ jsx(View, { alignSelf: \"stretch\", flex: 1, onLayout: handleLayout, children: props.children })\n }\n );\n const frameTheme = (checked ? activeTheme : void 0) ?? theme ?? createProps.componentThemes?.frame;\n return /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\n SwitchStyledContext.Provider,\n {\n size,\n active: checked,\n disabled,\n frameWidth,\n children: frameTheme ? /* @__PURE__ */ jsx(Theme, { name: frameTheme, children: frame }) : frame\n }\n ),\n bubbleInput\n ] });\n },\n {\n disableTheme: true\n }\n );\n return withStaticProperties(SwitchComponent, {\n Frame,\n Thumb: SwitchThumbComponent\n });\n}\nconst Switch = createSwitch({\n Frame: SwitchFrame,\n Thumb: SwitchThumbFrame\n});\nconst SwitchThumb = Switch.Thumb;\nexport {\n Switch,\n SwitchFrame,\n SwitchThumb,\n SwitchThumbFrame,\n createSwitch\n};\n//# sourceMappingURL=Switch.js.map\n"],"mappings":";;;;;;;;;AAgBA,MAAM,mBAAmB,OAAO,MAAM;CACpC,aAAa;CACb,SAAS;AACX,CAAC;AACD,MAAM,cAAc,OAAO,MAAM;CAC/B,aAAa;CACb,SAAS;CACT,QAAQ;CACR,UAAU;AACZ,CAAC;AACD,SAAS,aAAa,aAAa;CACjC,MAAM,QAAQ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B,MAAM,SAAS,CAAC;EACzD,MAAM,EAAE,aAAa,aAAa,cAAc,UAC9C,OACA,CAAC,SAAS,UAAU,GAEpB,YACF;EACA,MAAM,eAAe,gBAAgB;GACnC,IAAI,MAAM;GACV,UAAU,MAAM;GAChB;GACA;GACA;GACA;EACF,CAAC;EACD,IAAI,cAAc;GAChB,OAAO;EACT;EACA,MAAM,WAAW,MAAM;EACvB,MAAM,OAAO,cAAc,QAAQ,MAAM,QAAQ;EACjD,MAAM,gBAAgB,UAAU;GAC9B,MAAM,OAAO,MAAM,YAAY,OAAO;GACtC,IAAI,SAAS,YAAY;IACvB,mBAAmB,IAAI;GACzB;EACF;EACA,MAAM,QAAwB,oBAC5B,OACA;GACE,KAAK;GACL,QAAQ;GACR,GAAG,SAAS,EAAE,MAAM,SAAS;GAC7B;GACA,GAAG;GACH,GAAG;GACH;GACA,GAAG,WAAW;GACd,UAA0B,oBAAI,MAAM;IAAE,WAAW;IAAW,MAAM;IAAG,UAAU;IAAc,UAAU,MAAM;GAAS,CAAC;EACzH,CACF;EACA,MAAM,cAAc,UAAU,cAAc,KAAK,MAAM,SAAS,YAAY,iBAAiB;EAC7F,OAAuB,qBAAK,UAAU,EAAE,UAAU,CAChC,oBACd,oBAAoB,UACpB;GACE;GACA,QAAQ;GACR;GACA;GACA,UAAU,aAA6B,oBAAI,OAAO;IAAE,MAAM;IAAY,UAAU;GAAM,CAAC,IAAI;EAC7F,CACF,GACA,WACF,EAAE,CAAC;CACL,GACA,EACE,cAAc,KAChB,CACF;CACA,OAAO,qBAAqB,iBAAiB;EAC3C;EACA,OAAO;CACT,CAAC;AACH;AACA,MAAM,SAAS,aAAa;CAC1B,OAAO;CACP,OAAO;AACT,CAAC;AACD,MAAM,cAAc,OAAO"}
1
+ {"version":3,"file":"Switch.js","names":[],"sources":["esm/Switch.js"],"sourcesContent":["import {\n composeEventHandlers,\n createStyledHOC,\n getVariableValue,\n isWeb,\n styled,\n Theme,\n View,\n withStaticProperties\n} from \"@tamagui/core\";\nimport { useSwitch } from \"@tamagui/switch-headless\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { SwitchStyledContext } from \"./StyledContext\";\nimport { useSwitchNative } from \"./useSwitchNative\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nconst SwitchThumbFrame = styled(View, {\n displayName: \"SwitchThumb\",\n context: SwitchStyledContext\n});\nconst SwitchFrame = styled(View, {\n displayName: \"Switch\",\n context: SwitchStyledContext,\n render: \"button\",\n tabIndex: 0\n});\nfunction createSwitch(createProps) {\n const Frame = createProps.Frame ?? SwitchFrame;\n const Thumb = createProps.Thumb ?? SwitchThumbFrame;\n Frame.staticConfig.context = SwitchStyledContext;\n Thumb.staticConfig.context = SwitchStyledContext;\n const SwitchThumbComponent = createStyledHOC(\n Thumb,\n function SwitchThumb2(props, forwardedRef) {\n const { size: sizeProp, activeStyle, theme, ...thumbProps } = props;\n const styledContext = SwitchStyledContext.useStyledContext();\n const { size: sizeContext, active, disabled, frameWidth = 0 } = styledContext;\n const size = sizeProp ?? sizeContext ?? true;\n const initialChecked = React.useRef(active).current;\n const initialWidth = getVariableValue(props.width, \"size\");\n const [thumbWidth, setThumbWidth] = React.useState(\n typeof initialWidth === \"number\" ? initialWidth : 0\n );\n const distance = frameWidth - thumbWidth;\n const x = initialChecked ? active ? 0 : -distance : active ? distance : 0;\n const thumb = /* @__PURE__ */ jsx(\n Thumb,\n {\n ref: forwardedRef,\n size,\n alignSelf: initialChecked ? \"flex-end\" : \"flex-start\",\n x,\n onLayout: composeEventHandlers(props.onLayout, (event) => {\n setThumbWidth(event.nativeEvent.layout.width);\n }),\n disabled,\n ...thumbProps,\n ...active && activeStyle\n }\n );\n const themeName = theme ?? createProps.componentThemes?.thumb;\n return themeName ? /* @__PURE__ */ jsx(Theme, { name: themeName, children: thumb }) : thumb;\n }\n );\n const SwitchComponent = createStyledHOC(\n Frame,\n function Switch2(_props, forwardedRef) {\n const {\n native,\n nativeProps,\n checked: checkedProp,\n defaultChecked,\n onCheckedChange,\n activeStyle,\n activeTheme,\n theme,\n ...props\n } = _props;\n const [checked, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked || false,\n onChange: onCheckedChange,\n transition: true\n });\n const styledContext = React.useContext(SwitchStyledContext.context);\n const [frameWidth, setFrameInnerWidth] = React.useState(0);\n const { switchProps, bubbleInput, switchRef } = useSwitch(\n props,\n [checked, setChecked],\n // @ts-ignore TODO tamagui react 19 type error\n forwardedRef\n );\n const nativeSwitch = 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 const disabled = props.disabled;\n const size = styledContext.size ?? props.size ?? true;\n const handleLayout = (event) => {\n const next = event.nativeEvent.layout.width;\n if (next !== frameWidth) {\n setFrameInnerWidth(next);\n }\n };\n const frame = /* @__PURE__ */ jsx(\n Frame,\n {\n ref: switchRef,\n render: \"button\",\n ...isWeb && { type: \"button\" },\n size,\n ...props,\n ...switchProps,\n disabled,\n ...checked && activeStyle,\n children: /* @__PURE__ */ jsx(View, { alignSelf: \"stretch\", flex: 1, onLayout: handleLayout, children: props.children })\n }\n );\n const frameTheme = (checked ? activeTheme : void 0) ?? theme ?? createProps.componentThemes?.frame;\n return /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\n SwitchStyledContext.Provider,\n {\n size,\n active: checked,\n disabled,\n frameWidth,\n children: frameTheme ? /* @__PURE__ */ jsx(Theme, { name: frameTheme, children: frame }) : frame\n }\n ),\n bubbleInput\n ] });\n },\n {\n disableTheme: true\n }\n );\n return withStaticProperties(SwitchComponent, {\n Frame,\n Thumb: SwitchThumbComponent\n });\n}\nconst Switch = createSwitch({\n Frame: SwitchFrame,\n Thumb: SwitchThumbFrame\n});\nconst SwitchThumb = Switch.Thumb;\nexport {\n Switch,\n SwitchFrame,\n SwitchThumb,\n SwitchThumbFrame,\n createSw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EACA,OAAO;CACT,CAAC;AACH;AACA,MAAM,SAAS,aAAa;CAC1B,OAAO;CACP,OAAO;AACT,CAAC;AACD,MAAM,cAAc,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.native.js","names":["_Fragment"],"sources":["esm/Switch.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { composeEventHandlers, createStyledHOC, getVariableValue, isWeb, styled, Theme, View, withStaticProperties } from \"@tamagui/core\";\nimport { useSwitch } from \"@tamagui/switch-headless\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { SwitchStyledContext } from \"./StyledContext\";\nimport { useSwitchNative } from \"./useSwitchNative\";\nvar SwitchThumbFrame = styled(View, {\n displayName: \"SwitchThumb\",\n context: SwitchStyledContext\n});\nvar SwitchFrame = styled(View, {\n displayName: \"Switch\",\n context: 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 = SwitchStyledContext;\n Thumb.staticConfig.context = SwitchStyledContext;\n var SwitchThumbComponent = createStyledHOC(Thumb, function SwitchThumb2(props, forwardedRef) {\n var _createProps_componentThemes;\n var { size: sizeProp, activeStyle, theme, ...thumbProps } = props;\n var 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 = 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__ */ _jsx(Thumb, {\n ref: forwardedRef,\n size,\n alignSelf: initialChecked ? \"flex-end\" : \"flex-start\",\n x,\n onLayout: 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__ */ _jsx(Theme, {\n name: themeName,\n children: thumb\n }) : thumb;\n });\n var SwitchComponent = 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] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked || false,\n onChange: onCheckedChange,\n transition: true\n });\n var styledContext = React.useContext(SwitchStyledContext.context);\n var [frameWidth, setFrameInnerWidth] = React.useState(0);\n var { switchProps, bubbleInput, switchRef } = useSwitch(\n props,\n [\n checked,\n setChecked\n ],\n // @ts-ignore TODO tamagui react 19 type error\n forwardedRef\n );\n var nativeSwitch = 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__ */ _jsx(Frame, {\n ref: switchRef,\n render: \"button\",\n ...isWeb && {\n type: \"button\"\n },\n size,\n ...props,\n ...switchProps,\n disabled,\n ...checked && activeStyle,\n children: /* @__PURE__ */ _jsx(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__ */ _jsxs(_Fragment, {\n children: [\n /* @__PURE__ */ _jsx(SwitchStyledContext.Provider, {\n size,\n active: checked,\n disabled,\n frameWidth,\n children: frameTheme ? /* @__PURE__ */ _jsx(Theme, {\n name: frameTheme,\n children: frame\n }) : frame\n }),\n bubbleInput\n ]\n });\n }, {\n disableTheme: true\n });\n return withStaticProperties(SwitchComponent, {\n Frame,\n Thumb: SwitchThumbComponent\n });\n}\nvar Switch = createSwitch({\n Frame: SwitchFrame,\n Thumb: SwitchThumbFrame\n});\nvar SwitchThumb = Switch.Thumb;\nexport {\n Switch,\n SwitchFrame,\n SwitchThumb,\n SwitchThumbFrame,\n createSwitch\n};\n//# sourceMappingURL=Switch.js.map\n"],"mappings":";;;;;;;;;AAOA,IAAI,mBAAmB,OAAO,MAAM;CAClC,aAAa;CACb,SAAS;AACX,CAAC;AACD,IAAI,cAAc,OAAO,MAAM;CAC7B,aAAa;CACb,SAAS;CACT,QAAQ;CACR,UAAU;AACZ,CAAC;AACD,SAAS,aAAa,aAAa;CACjC,IAAI;CACJ,IAAI,SAAS,qBAAqB,YAAY,WAAW,QAAQ,uBAAuB,KAAK,IAAI,qBAAqB;CACtH,IAAI;CACJ,IAAI,SAAS,qBAAqB,YAAY,WAAW,QAAQ,uBAAuB,KAAK,IAAI,qBAAqB;CACtH,MAAM,aAAa,UAAU;CAC7B,MAAM,aAAa,UAAU;CAC7B,IAA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,CAAC,IAAI;EACP,CAAC,GACD,WACF,EACF,CAAC;CACH,GAAG,EACD,cAAc,KAChB,CAAC;CACD,OAAO,qBAAqB,iBAAiB;EAC3C;EACA,OAAO;CACT,CAAC;AACH;AACA,IAAI,SAAS,aAAa;CACxB,OAAO;CACP,OAAO;AACT,CAAC;AACD,IAAI,cAAc,OAAO"}
1
+ {"version":3,"file":"Switch.native.js","names":["_Fragment"],"sources":["esm/Switch.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { composeEventHandlers, createStyledHOC, getVariableValue, isWeb, styled, Theme, View, withStaticProperties } from \"@tamagui/core\";\nimport { useSwitch } from \"@tamagui/switch-headless\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { SwitchStyledContext } from \"./StyledContext\";\nimport { useSwitchNative } from \"./useSwitchNative\";\nvar SwitchThumbFrame = styled(View, {\n displayName: \"SwitchThumb\",\n context: SwitchStyledContext\n});\nvar SwitchFrame = styled(View, {\n displayName: \"Switch\",\n context: 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 = SwitchStyledContext;\n Thumb.staticConfig.context = SwitchStyledContext;\n var SwitchThumbComponent = createStyledHOC(Thumb, function SwitchThumb2(props, forwardedRef) {\n var _createProps_componentThemes;\n var { size: sizeProp, activeStyle, theme, ...thumbProps } = props;\n var 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 = 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__ */ _jsx(Thumb, {\n ref: forwardedRef,\n size,\n alignSelf: initialChecked ? \"flex-end\" : \"flex-start\",\n x,\n onLayout: 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__ */ _jsx(Theme, {\n name: themeName,\n children: thumb\n }) : thumb;\n });\n var SwitchComponent = 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] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked || false,\n onChange: onCheckedChange,\n transition: true\n });\n var styledContext = React.useContext(SwitchStyledContext.context);\n var [frameWidth, setFrameInnerWidth] = React.useState(0);\n var { switchProps, bubbleInput, switchRef } = useSwitch(\n props,\n [\n checked,\n setChecked\n ],\n // @ts-ignore TODO tamagui react 19 type error\n forwardedRef\n );\n var nativeSwitch = 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__ */ _jsx(Frame, {\n ref: switchRef,\n render: \"button\",\n ...isWeb && {\n type: \"button\"\n },\n size,\n ...props,\n ...switchProps,\n disabled,\n ...checked && activeStyle,\n children: /* @__PURE__ */ _jsx(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__ */ _jsxs(_Fragment, {\n children: [\n /* @__PURE__ */ _jsx(SwitchStyledContext.Provider, {\n size,\n active: checked,\n disabled,\n frameWidth,\n children: frameTheme ? /* @__PURE__ */ _jsx(Theme, {\n name: frameTheme,\n children: frame\n }) : frame\n }),\n bubbleInput\n ]\n });\n }, {\n disableTheme: true\n });\n return withStaticProperties(SwitchComponent, {\n Frame,\n Thumb: SwitchThumbComponent\n });\n}\nvar Switch = createSwitch({\n Frame: SwitchFrame,\n Thumb: SwitchThumbFrame\n});\nvar SwitchThumb = Switch.Thumb;\nexport {\n Switch,\n SwitchFrame,\n SwitchThumb,\n SwitchThumbFrame,\n createSwitch\n};\n//# sourceMappingURL=Switch.js.map\n"],"mappings":";;;;;;;;;AAOA,IAAI,mBAAmB,OAAO,MAAM;CAClC,aAAa;CACb,SAAS;AACX,CAAC;AACD,IAAI,cAAc,OAAO,MAAM;CAC7B,aAAa;CACb,SAAS;CACT,QAAQ;CACR,UAAU;AACZ,CAAC;AACD,SAAS,aAAa,aAAa;CACjC,IAAI;CACJ,IAAI,SAAS,qBAAqB,YAAY,WAAW,QAAQ,uBAAuB,KAAK,IAAI,qBAAqB;CACtH,IAAI;CACJ,IAAI,SAAS,qBAAqB,YAAY,WA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BAAK,oBAAoB,UAAU;GACjD;GACA,QAAQ;GACR;GACA;GACA,UAAU,aAA6B,oBAAK,OAAO;IACjD,MAAM;IACN,UAAU;GACZ,CAAC,IAAI;EACP,CAAC,GACD,WACF,EACF,CAAC;CACH,GAAG,EACD,cAAc,KAChB,CAAC;CACD,OAAO,qBAAqB,iBAAiB;EAC3C;EACA,OAAO;CACT,CAAC;AACH;AACA,IAAI,SAAS,aAAa;CACxB,OAAO;CACP,OAAO;AACT,CAAC;AACD,IAAI,cAAc,OAAO"}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1 +1 @@
1
- {"version":3,"file":"StyledContext.native.js","names":[],"sources":["jsx/StyledContext.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 StyledContext_exports = {};\n__export(StyledContext_exports, {\n SwitchStyledContext: () => SwitchStyledContext\n});\nmodule.exports = __toCommonJS(StyledContext_exports);\nvar import_core = require(\"@tamagui/core\");\nvar SwitchStyledContext = (0, import_core.createStyledContext)({\n active: false,\n disabled: false,\n frameWidth: void 0,\n size: void 0\n});\n//# sourceMappingURL=StyledContext.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,wBAAwB,CAAC;AAC7B,SAAS,uBAAuB,EAC9B,2BAA2B,oBAC7B,CAAC;AACD,OAAO,UAAU,aAAa,qBAAqB;AACnD,IAAI,cAAc,QAAQ,eAAe;AACzC,IAAI,uBAAuB,GAAG,YAAY,qBAAqB;CAC7D,QAAQ;CACR,UAAU;CACV,YAAY,KAAK;CACjB,MAAM,KAAK;AACb,CAAC"}
1
+ {"version":3,"file":"StyledContext.native.js","names":[],"sources":["jsx/StyledContext.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 StyledContext_exports = {};\n__export(StyledContext_exports, {\n SwitchStyledContext: () => SwitchStyledContext\n});\nmodule.exports = __toCommonJS(StyledContext_exports);\nvar import_core = require(\"@tamagui/core\");\nvar SwitchStyledContext = (0, import_core.createStyledContext)({\n active: false,\n disabled: false,\n frameWidth: void 0,\n size: void 0\n});\n//# sourceMappingURL=StyledContext.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,wBAAwB,CAAC;AAC7B,SAAS,uBAAuB,EAC9B,2BAA2B,oBAC7B,CAAC;AACD,OAAO,UAAU,aAAa,qBAAqB;AACnD,IAAI,cAAc,QAAQ,eAAe;AACzC,IAAI,uBAAuB,GAAG,YAAY,oBAAmB,CAAE;CAC7D,QAAQ;CACR,UAAU;CACV,YAAY,KAAK;CACjB,MAAM,KAAK;AACb,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","names":[],"sources":["jsx/Switch.js"],"sourcesContent":["import {\n composeEventHandlers,\n createStyledHOC,\n getVariableValue,\n isWeb,\n styled,\n Theme,\n View,\n withStaticProperties\n} from \"@tamagui/core\";\nimport { useSwitch } from \"@tamagui/switch-headless\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { SwitchStyledContext } from \"./StyledContext\";\nimport { useSwitchNative } from \"./useSwitchNative\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nconst SwitchThumbFrame = styled(View, {\n displayName: \"SwitchThumb\",\n context: SwitchStyledContext\n});\nconst SwitchFrame = styled(View, {\n displayName: \"Switch\",\n context: SwitchStyledContext,\n render: \"button\",\n tabIndex: 0\n});\nfunction createSwitch(createProps) {\n const Frame = createProps.Frame ?? SwitchFrame;\n const Thumb = createProps.Thumb ?? SwitchThumbFrame;\n Frame.staticConfig.context = SwitchStyledContext;\n Thumb.staticConfig.context = SwitchStyledContext;\n const SwitchThumbComponent = createStyledHOC(\n Thumb,\n function SwitchThumb2(props, forwardedRef) {\n const { size: sizeProp, activeStyle, theme, ...thumbProps } = props;\n const styledContext = SwitchStyledContext.useStyledContext();\n const { size: sizeContext, active, disabled, frameWidth = 0 } = styledContext;\n const size = sizeProp ?? sizeContext ?? true;\n const initialChecked = React.useRef(active).current;\n const initialWidth = getVariableValue(props.width, \"size\");\n const [thumbWidth, setThumbWidth] = React.useState(\n typeof initialWidth === \"number\" ? initialWidth : 0\n );\n const distance = frameWidth - thumbWidth;\n const x = initialChecked ? active ? 0 : -distance : active ? distance : 0;\n const thumb = /* @__PURE__ */ jsx(\n Thumb,\n {\n ref: forwardedRef,\n size,\n alignSelf: initialChecked ? \"flex-end\" : \"flex-start\",\n x,\n onLayout: composeEventHandlers(props.onLayout, (event) => {\n setThumbWidth(event.nativeEvent.layout.width);\n }),\n disabled,\n ...thumbProps,\n ...active && activeStyle\n }\n );\n const themeName = theme ?? createProps.componentThemes?.thumb;\n return themeName ? /* @__PURE__ */ jsx(Theme, { name: themeName, children: thumb }) : thumb;\n }\n );\n const SwitchComponent = createStyledHOC(\n Frame,\n function Switch2(_props, forwardedRef) {\n const {\n native,\n nativeProps,\n checked: checkedProp,\n defaultChecked,\n onCheckedChange,\n activeStyle,\n activeTheme,\n theme,\n ...props\n } = _props;\n const [checked, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked || false,\n onChange: onCheckedChange,\n transition: true\n });\n const styledContext = React.useContext(SwitchStyledContext.context);\n const [frameWidth, setFrameInnerWidth] = React.useState(0);\n const { switchProps, bubbleInput, switchRef } = useSwitch(\n props,\n [checked, setChecked],\n // @ts-ignore TODO tamagui react 19 type error\n forwardedRef\n );\n const nativeSwitch = 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 const disabled = props.disabled;\n const size = styledContext.size ?? props.size ?? true;\n const handleLayout = (event) => {\n const next = event.nativeEvent.layout.width;\n if (next !== frameWidth) {\n setFrameInnerWidth(next);\n }\n };\n const frame = /* @__PURE__ */ jsx(\n Frame,\n {\n ref: switchRef,\n render: \"button\",\n ...isWeb && { type: \"button\" },\n size,\n ...props,\n ...switchProps,\n disabled,\n ...checked && activeStyle,\n children: /* @__PURE__ */ jsx(View, { alignSelf: \"stretch\", flex: 1, onLayout: handleLayout, children: props.children })\n }\n );\n const frameTheme = (checked ? activeTheme : void 0) ?? theme ?? createProps.componentThemes?.frame;\n return /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\n SwitchStyledContext.Provider,\n {\n size,\n active: checked,\n disabled,\n frameWidth,\n children: frameTheme ? /* @__PURE__ */ jsx(Theme, { name: frameTheme, children: frame }) : frame\n }\n ),\n bubbleInput\n ] });\n },\n {\n disableTheme: true\n }\n );\n return withStaticProperties(SwitchComponent, {\n Frame,\n Thumb: SwitchThumbComponent\n });\n}\nconst Switch = createSwitch({\n Frame: SwitchFrame,\n Thumb: SwitchThumbFrame\n});\nconst SwitchThumb = Switch.Thumb;\nexport {\n Switch,\n SwitchFrame,\n SwitchThumb,\n SwitchThumbFrame,\n createSwitch\n};\n//# sourceMappingURL=Switch.js.map\n"],"mappings":";;;;;;;;;AAgBA,MAAM,mBAAmB,OAAO,MAAM;CACpC,aAAa;CACb,SAAS;AACX,CAAC;AACD,MAAM,cAAc,OAAO,MAAM;CAC/B,aAAa;CACb,SAAS;CACT,QAAQ;CACR,UAAU;AACZ,CAAC;AACD,SAAS,aAAa,aAAa;CACjC,MAAM,QAAQ,YAAY,SAAS;CACnC,MAAM,QAAQ,YAAY,SAAS;CACnC,MAAM,aAAa,UAAU;CAC7B,MAAM,aAAa,UAAU;CAC7B,MAAM,uBAAuB,gBAC3B,OACA,SAAS,aAAa,OAAO,cAAc;EACzC,MAAM,EAAE,MAAM,UAAU,aAAa,OAAO,GAAG,eAAe;EAC9D,MAAM,gBAAgB,oBAAoB,iBAAiB;EAC3D,MAAM,EAAE,MAAM,aAAa,QAAQ,UAAU,aAAa,MAAM;EAChE,MAAM,OAAO,YAAY,eAAe;EACxC,MAAM,iBAAiB,MAAM,OAAO,MAAM,EAAE;EAC5C,MAAM,eAAe,iBAAiB,MAAM,OAAO,MAAM;EACzD,MAAM,CAAC,YAAY,iBAAiB,MAAM,SACxC,OAAO,iBAAiB,WAAW,eAAe,CACpD;EACA,MAAM,WAAW,aAAa;EAC9B,M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;GACA,GAAG,WAAW;GACd,UAA0B,oBAAI,MAAM;IAAE,WAAW;IAAW,MAAM;IAAG,UAAU;IAAc,UAAU,MAAM;GAAS,CAAC;EACzH,CACF;EACA,MAAM,cAAc,UAAU,cAAc,KAAK,MAAM,SAAS,YAAY,iBAAiB;EAC7F,OAAuB,qBAAK,UAAU,EAAE,UAAU,CAChC,oBACd,oBAAoB,UACpB;GACE;GACA,QAAQ;GACR;GACA;GACA,UAAU,aAA6B,oBAAI,OAAO;IAAE,MAAM;IAAY,UAAU;GAAM,CAAC,IAAI;EAC7F,CACF,GACA,WACF,EAAE,CAAC;CACL,GACA,EACE,cAAc,KAChB,CACF;CACA,OAAO,qBAAqB,iBAAiB;EAC3C;EACA,OAAO;CACT,CAAC;AACH;AACA,MAAM,SAAS,aAAa;CAC1B,OAAO;CACP,OAAO;AACT,CAAC;AACD,MAAM,cAAc,OAAO"}
1
+ {"version":3,"file":"Switch.js","names":[],"sources":["jsx/Switch.js"],"sourcesContent":["import {\n composeEventHandlers,\n createStyledHOC,\n getVariableValue,\n isWeb,\n styled,\n Theme,\n View,\n withStaticProperties\n} from \"@tamagui/core\";\nimport { useSwitch } from \"@tamagui/switch-headless\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { SwitchStyledContext } from \"./StyledContext\";\nimport { useSwitchNative } from \"./useSwitchNative\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nconst SwitchThumbFrame = styled(View, {\n displayName: \"SwitchThumb\",\n context: SwitchStyledContext\n});\nconst SwitchFrame = styled(View, {\n displayName: \"Switch\",\n context: SwitchStyledContext,\n render: \"button\",\n tabIndex: 0\n});\nfunction createSwitch(createProps) {\n const Frame = createProps.Frame ?? SwitchFrame;\n const Thumb = createProps.Thumb ?? SwitchThumbFrame;\n Frame.staticConfig.context = SwitchStyledContext;\n Thumb.staticConfig.context = SwitchStyledContext;\n const SwitchThumbComponent = createStyledHOC(\n Thumb,\n function SwitchThumb2(props, forwardedRef) {\n const { size: sizeProp, activeStyle, theme, ...thumbProps } = props;\n const styledContext = SwitchStyledContext.useStyledContext();\n const { size: sizeContext, active, disabled, frameWidth = 0 } = styledContext;\n const size = sizeProp ?? sizeContext ?? true;\n const initialChecked = React.useRef(active).current;\n const initialWidth = getVariableValue(props.width, \"size\");\n const [thumbWidth, setThumbWidth] = React.useState(\n typeof initialWidth === \"number\" ? initialWidth : 0\n );\n const distance = frameWidth - thumbWidth;\n const x = initialChecked ? active ? 0 : -distance : active ? distance : 0;\n const thumb = /* @__PURE__ */ jsx(\n Thumb,\n {\n ref: forwardedRef,\n size,\n alignSelf: initialChecked ? \"flex-end\" : \"flex-start\",\n x,\n onLayout: composeEventHandlers(props.onLayout, (event) => {\n setThumbWidth(event.nativeEvent.layout.width);\n }),\n disabled,\n ...thumbProps,\n ...active && activeStyle\n }\n );\n const themeName = theme ?? createProps.componentThemes?.thumb;\n return themeName ? /* @__PURE__ */ jsx(Theme, { name: themeName, children: thumb }) : thumb;\n }\n );\n const SwitchComponent = createStyledHOC(\n Frame,\n function Switch2(_props, forwardedRef) {\n const {\n native,\n nativeProps,\n checked: checkedProp,\n defaultChecked,\n onCheckedChange,\n activeStyle,\n activeTheme,\n theme,\n ...props\n } = _props;\n const [checked, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked || false,\n onChange: onCheckedChange,\n transition: true\n });\n const styledContext = React.useContext(SwitchStyledContext.context);\n const [frameWidth, setFrameInnerWidth] = React.useState(0);\n const { switchProps, bubbleInput, switchRef } = useSwitch(\n props,\n [checked, setChecked],\n // @ts-ignore TODO tamagui react 19 type error\n forwardedRef\n );\n const nativeSwitch = 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 const disabled = props.disabled;\n const size = styledContext.size ?? props.size ?? true;\n const handleLayout = (event) => {\n const next = event.nativeEvent.layout.width;\n if (next !== frameWidth) {\n setFrameInnerWidth(next);\n }\n };\n const frame = /* @__PURE__ */ jsx(\n Frame,\n {\n ref: switchRef,\n render: \"button\",\n ...isWeb && { type: \"button\" },\n size,\n ...props,\n ...switchProps,\n disabled,\n ...checked && activeStyle,\n children: /* @__PURE__ */ jsx(View, { alignSelf: \"stretch\", flex: 1, onLayout: handleLayout, children: props.children })\n }\n );\n const frameTheme = (checked ? activeTheme : void 0) ?? theme ?? createProps.componentThemes?.frame;\n return /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\n SwitchStyledContext.Provider,\n {\n size,\n active: checked,\n disabled,\n frameWidth,\n children: frameTheme ? /* @__PURE__ */ jsx(Theme, { name: frameTheme, children: frame }) : frame\n }\n ),\n bubbleInput\n ] });\n },\n {\n disableTheme: true\n }\n );\n return withStaticProperties(SwitchComponent, {\n Frame,\n Thumb: SwitchThumbComponent\n });\n}\nconst Switch = createSwitch({\n Frame: SwitchFrame,\n Thumb: SwitchThumbFrame\n});\nconst SwitchThumb = Switch.Thumb;\nexport {\n Switch,\n SwitchFrame,\n SwitchThumb,\n SwitchThumbFrame,\n createSwitch\n};\n//# sourceMappingURL=Switch.js.map\n"],"mappings":";;;;;;;;;AAgBA,MAAM,mBAAmB,OAAO,MAAM;CACpC,aAAa;CACb,SAAS;AACX,CAAC;AACD,MAAM,cAAc,OAAO,MAAM;CAC/B,aAAa;CACb,SAAS;CACT,QAAQ;CACR,UAAU;AACZ,CAAC;AACD,SAAS,aAAa,aAAa;CACjC,MAAM,QAAQ,YAAY,SAAS;CACnC,MAAM,QAAQ,YAAY,SAAS;CACnC,MAAM,aAAa,UAAU;CAC7B,MAAM,aAAa,UAAU;CAC7B,MAAM,uBAAuB,gBAC3B,OACA,SAAS,aAAa,OAAO,cAAc;EACzC,MAAM,EAAE,MAAM,UAAU,aAAa,OAAO,GAAG,eAAe;EAC9D,MAAM,gBAAgB,oBAAoB,iBAAiB;EAC3D,MAAM,EAAE,MAAM,aAAa,QAAQ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MAAM,QAAQ;EACjD,MAAM,gBAAgB,UAAU;GAC9B,MAAM,OAAO,MAAM,YAAY,OAAO;GACtC,IAAI,SAAS,YAAY;IACvB,mBAAmB,IAAI;GACzB;EACF;EACA,MAAM,QAAwB,oBAC5B,OACA;GACE,KAAK;GACL,QAAQ;GACR,GAAG,SAAS,EAAE,MAAM,SAAS;GAC7B;GACA,GAAG;GACH,GAAG;GACH;GACA,GAAG,WAAW;GACd,UAA0B,oBAAI,MAAM;IAAE,WAAW;IAAW,MAAM;IAAG,UAAU;IAAc,UAAU,MAAM;GAAS,CAAC;EACzH,CACF;EACA,MAAM,cAAc,UAAU,cAAc,KAAK,MAAM,SAAS,YAAY,iBAAiB;EAC7F,OAAuB,qBAAK,UAAU,EAAE,UAAU,CAChC,oBACd,oBAAoB,UACpB;GACE;GACA,QAAQ;GACR;GACA;GACA,UAAU,aAA6B,oBAAI,OAAO;IAAE,MAAM;IAAY,UAAU;GAAM,CAAC,IAAI;EAC7F,CACF,GACA,WACF,EAAE,CAAC;CACL,GACA,EACE,cAAc,KAChB,CACF;CACA,OAAO,qBAAqB,iBAAiB;EAC3C;EACA,OAAO;CACT,CAAC;AACH;AACA,MAAM,SAAS,aAAa;CAC1B,OAAO;CACP,OAAO;AACT,CAAC;AACD,MAAM,cAAc,OAAO"}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __create = Object.create;
5
4
  var __defProp = Object.defineProperty;
6
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __create = Object.create;
5
4
  var __defProp = Object.defineProperty;
6
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1 +1 @@
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,O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U;GAC7F;GACA,QAAQ;GACR;GACA;GACA,UAAU,aAA6B,iBAAC,GAAG,mBAAmB,KAAK,YAAY,OAAO;IACpF,MAAM;IACN,UAAU;GACZ,CAAC,IAAI;EACP,CAAC,GACD,WACF,EACF,CAAC;CACH,GAAG,EACD,cAAc,KAChB,CAAC;CACD,QAAQ,GAAG,YAAY,sBAAsB,iBAAiB;EAC5D;EACA,OAAO;CACT,CAAC;AACH;AACA,IAAI,SAAS,aAAa;CACxB,OAAO;CACP,OAAO;AACT,CAAC;AACD,IAAI,cAAc,OAAO"}
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,CAA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C7D,KAAK;GACL,QAAQ;GACR,GAAG,YAAY,SAAS,EACtB,MAAM,SACR;GACA;GACA,GAAG;GACH,GAAG;GACH;GACA,GAAG,WAAW;GACd,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,YAAY,MAAM;IACtE,WAAW;IACX,MAAM;IACN,UAAU;IACV,UAAU,MAAM;GAClB,CAAC;EACH,CAAC;EACD,IAAI,OAAO;EACX,IAAI,cAAc,SAAS,QAAQ,UAAU,cAAc,KAAK,OAAO,QAAQ,UAAU,KAAK,IAAI,QAAQ,WAAW,QAAQ,UAAU,KAAK,IAAI,SAAS,+BAA+B,YAAY,qBAAqB,QAAQ,iCAAiC,KAAK,IAAI,KAAK,IAAI,6BAA6B;EACjT,OAAuB,iBAAC,GAAG,mBAAmB,KAAI,CAAE,mBAAmB,UAAU,EAC/E,UAAU,CACQ,iBAAC,GAAG,mBAAmB,IAAG,CAAE,qBAAqB,oBAAoB,UAAU;GAC7F;GACA,QAAQ;GACR;GACA;GACA,UAAU,aAA6B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,YAAY,OAAO;IACpF,MAAM;IACN,UAAU;GACZ,CAAC,IAAI;EACP,CAAC,GACD,WACF,EACF,CAAC;CACH,GAAG,EACD,cAAc,KAChB,CAAC;CACD,QAAQ,GAAG,YAAY,qBAAoB,CAAE,iBAAiB;EAC5D;EACA,OAAO;CACT,CAAC;AACH;AACA,IAAI,SAAS,aAAa;CACxB,OAAO;CACP,OAAO;AACT,CAAC;AACD,IAAI,cAAc,OAAO"}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1 +1 @@
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.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,uBAAuB,uBAAuB,gBAChD,CAAC;AACD,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,2BAAiB,GAAG,OAAO,OAAO;AACpE,WAAW,eAAe,QAAQ,oBAAU,GAAG,OAAO,OAAO;AAC7D,WAAW,eAAe,QAAQ,mBAAS,GAAG,OAAO,OAAO;AAC5D,IAAI,yBAAyB,QAAQ,6BAAmB"}
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.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,uBAAuB,uBAAuB,gBAChD,CAAC;AACD,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,2BAAiB,GAAG,OAAO,OAAO;AACpE,WAAW,eAAe,QAAQ,oBAAU,GAAG,OAAO,OAAO;AAC7D,WAAW,eAAe,QAAQ,mBAAS,GAAG,OAAO,OAAO;AAC5D,IAAI,yBAAyB,QAAQ,6BAAmB"}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1 +1 @@
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
+ {"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,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __create = Object.create;
5
4
  var __defProp = Object.defineProperty;
6
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
-
4
3
  var __create = Object.create;
5
4
  var __defProp = Object.defineProperty;
6
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1 +1 @@
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//# sourceMappingURL=useSwitchNative.native.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,a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oBAAoB,QAAQ;GAC7E,OAAO;GACP,eAAe;GACf,GAAG;EACL,CAAC;CACH;CACA,OAAO;AACT"}
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//# sourceMappingURL=useSwitchNative.native.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,iCAAiC,CAAC;AACtC,SAAS,gCAAgC,EACvC,uBAAuB,gBACzB,CAAC;AACD,OAAO,UAAU,aAAa,8BAA8B;AAC5D,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,cAAc,QAAQ,eAAe;AACzC,IAAI,mBAAmB,QAAQ,oBAAoB;AACnD,IAAI,QAAQ,QAAQ,QAAQ,OAAO,GAAG,CAAC;AACvC,IAAI,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,kBAAiB,CAAE,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,2BAA0B,CAAE,MAAM;CACrE,IAAI,iBAAiB,aAAa,iBAAiB,OAAO;EACxD,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,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": "3.0.0-beta.669.1",
3
+ "version": "3.0.0-beta.719.1",
4
4
  "source": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -34,14 +34,14 @@
34
34
  "clean:build": "tamagui-build clean:build"
35
35
  },
36
36
  "dependencies": {
37
- "@tamagui/core": "3.0.0-beta.669.1",
38
- "@tamagui/focusable": "3.0.0-beta.669.1",
39
- "@tamagui/switch-headless": "3.0.0-beta.669.1",
40
- "@tamagui/use-controllable-state": "3.0.0-beta.669.1"
37
+ "@tamagui/core": "3.0.0-beta.719.1",
38
+ "@tamagui/focusable": "3.0.0-beta.719.1",
39
+ "@tamagui/switch-headless": "3.0.0-beta.719.1",
40
+ "@tamagui/use-controllable-state": "3.0.0-beta.719.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@tamagui/build": "3.0.0-beta.669.1",
44
- "react": ">=19",
43
+ "@tamagui/build": "3.0.0-beta.719.1",
44
+ "react": "19.2.3",
45
45
  "react-native": "0.86.2"
46
46
  },
47
47
  "peerDependencies": {