{"version":3,"file":"Switch.js","names":["SwitchBehaviorFrame","SwitchBehaviorThumbFrame"],"sources":["jsx/components/Switch.js"],"sourcesContent":["import {\n  createSwitch,\n  SwitchFrame as SwitchBehaviorFrame,\n  SwitchThumbFrame as SwitchBehaviorThumbFrame\n} from \"@tamagui/switch\";\nimport { resolveSizing, styled } from \"@tamagui/core\";\nconst THUMB_INSET = 2;\nconst getSwitchTrackSize = styled.dynamic((val, env) => {\n  const sizing = resolveSizing(val, env);\n  if (!sizing) return;\n  return {\n    width: Math.round(sizing.square * 1.9),\n    height: sizing.square,\n    minHeight: sizing.square\n  };\n});\nconst getSwitchThumbSize = styled.dynamic((val, env) => {\n  const sizing = resolveSizing(val, env);\n  if (!sizing) return;\n  const side = sizing.square - THUMB_INSET * 2;\n  return {\n    width: side,\n    height: side\n  };\n});\nconst SwitchFrame = styled(SwitchBehaviorFrame, {\n  displayName: \"Switch\",\n  borderRadius: 1e3,\n  padding: THUMB_INSET,\n  outlineColor: \"focus-visible:outline-color\",\n  outlineStyle: \"focus-visible:solid\",\n  outlineWidth: \"focus-visible:2px\",\n  variants: {\n    size: getSwitchTrackSize,\n    // off is a low-contrast trough the page barely registers. on swaps the whole\n    // control onto the brand theme, so `background` here is the inverse fill and\n    // the thumb's `color` is the matching foreground.\n    active: {\n      true: { backgroundColor: \"background\" },\n      false: { backgroundColor: \"color-4 hover:color-5\" }\n    },\n    disabled: {\n      true: { cursor: \"not-allowed\", opacity: 0.45 }\n    }\n  },\n  defaultVariants: {\n    size: \"md\"\n  }\n});\nconst SwitchThumbFrame = styled(SwitchBehaviorThumbFrame, {\n  displayName: \"SwitchThumb\",\n  borderRadius: 1e3,\n  boxShadow: \"0 1px 2px rgba(0,0,0,0.18)\",\n  variants: {\n    size: getSwitchThumbSize,\n    // the knob stays the light one against the trough in both schemes, and\n    // becomes the brand foreground once the track flips to the brand fill.\n    active: {\n      true: { backgroundColor: \"color\" },\n      false: { backgroundColor: \"white\" }\n    }\n  },\n  defaultVariants: {\n    size: \"md\"\n  }\n});\nconst Switch = createSwitch({\n  Frame: SwitchFrame,\n  Thumb: SwitchThumbFrame,\n  activeTheme: \"brand\"\n});\nconst SwitchThumb = Switch.Thumb;\nexport {\n  Switch,\n  SwitchFrame,\n  SwitchThumb,\n  SwitchThumbFrame\n};\n//# sourceMappingURL=Switch.js.map\n"],"mappings":";;;;AAMA,MAAM,cAAc;AACpB,MAAM,qBAAqB,OAAO,SAAS,KAAK,QAAQ;CACtD,MAAM,SAAS,cAAc,KAAK,GAAG;CACrC,IAAI,CAAC,QAAQ;CACb,OAAO;EACL,OAAO,KAAK,MAAM,OAAO,SAAS,GAAG;EACrC,QAAQ,OAAO;EACf,WAAW,OAAO;CACpB;AACF,CAAC;AACD,MAAM,qBAAqB,OAAO,SAAS,KAAK,QAAQ;CACtD,MAAM,SAAS,cAAc,KAAK,GAAG;CACrC,IAAI,CAAC,QAAQ;CACb,MAAM,OAAO,OAAO,SAAS,cAAc;CAC3C,OAAO;EACL,OAAO;EACP,QAAQ;CACV;AACF,CAAC;AACD,MAAM,cAAc,OAAOA,eAAqB;CAC9C,aAAa;CACb,cAAc;CACd,SAAS;CACT,cAAc;CACd,cAAc;CACd,cAAc;CACd,UAAU;EACR,MAAM;EAIN,QAAQ;GACN,MAAM,EAAE,iBAAiB,aAAa;GACtC,OAAO,EAAE,iBAAiB,wBAAwB;EACpD;EACA,UAAU,EACR,MAAM;GAAE,QAAQ;GAAe,SAAS;EAAK,EAC/C;CACF;CACA,iBAAiB,EACf,MAAM,KACR;AACF,CAAC;AACD,MAAM,mBAAmB,OAAOC,oBAA0B;CACxD,aAAa;CACb,cAAc;CACd,WAAW;CACX,UAAU;EACR,MAAM;EAGN,QAAQ;GACN,MAAM,EAAE,iBAAiB,QAAQ;GACjC,OAAO,EAAE,iBAAiB,QAAQ;EACpC;CACF;CACA,iBAAiB,EACf,MAAM,KACR;AACF,CAAC;AACD,MAAM,SAAS,aAAa;CAC1B,OAAO;CACP,OAAO;CACP,aAAa;AACf,CAAC;AACD,MAAM,cAAc,OAAO"}