{"version":3,"file":"Toggle.cjs","names":[],"sources":["../../../../../src/components/Form/Controls/Toggle/Toggle.tsx"],"sourcesContent":["/*\nCopyright 2025 New Vector Ltd.\nCopyright 2023 The Matrix.org Foundation C.I.C.\nCopyright 2023 New Vector Ltd\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, {\n  type ComponentProps,\n  type ComponentRef,\n  forwardRef,\n  type PropsWithChildren,\n} from \"react\";\nimport styles from \"./Toggle.module.css\";\nimport { Control } from \"@radix-ui/react-form\";\n\ntype ToggleProps = {\n  /**\n   * The CSS class name.\n   */\n  className?: string;\n} & Omit<ComponentProps<\"input\">, \"type\">;\n\n/**\n * A toggle component.\n */\nexport const ToggleInput = forwardRef<\n  HTMLInputElement,\n  PropsWithChildren<ToggleProps>\n>(function Toggle({ className, ...props }, ref) {\n  const classes = classnames(styles.container, className);\n  return (\n    <div className={classes}>\n      <input\n        role=\"switch\"\n        ref={ref}\n        className={styles.input}\n        {...props}\n        type=\"checkbox\"\n      />\n      <div className={styles.ui} />\n    </div>\n  );\n});\n\n/**\n * A styled checkbox input wrapped in a `Control` component, for use in Radix forms.\n */\nexport const ToggleControl = forwardRef<\n  ComponentRef<typeof ToggleInput>,\n  ComponentProps<typeof ToggleInput>\n>(function ToggleControl(props, ref) {\n  return (\n    <Control asChild>\n      <ToggleInput ref={ref} {...props} />\n    </Control>\n  );\n});\n"],"mappings":";;;;;;;;;;;;AA6BA,IAAa,eAAA,GAAA,MAAA,YAGX,SAAS,OAAO,EAAE,WAAW,GAAG,SAAS,KAAK;AAE9C,QACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EAAK,YAAA,GAAA,WAAA,SAFoB,sBAAA,QAAO,WAAW,UAAU;YAErD,CACE,iBAAA,GAAA,kBAAA,KAAC,SAAD;GACE,MAAK;GACA;GACL,WAAW,sBAAA,QAAO;GAClB,GAAI;GACJ,MAAK;GACL,CAAA,EACF,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAK,WAAW,sBAAA,QAAO,IAAM,CAAA,CACzB;;EAER;;;;AAKF,IAAa,iBAAA,GAAA,MAAA,YAGX,SAAS,cAAc,OAAO,KAAK;AACnC,QACE,iBAAA,GAAA,kBAAA,KAAC,qBAAA,SAAD;EAAS,SAAA;YACP,iBAAA,GAAA,kBAAA,KAAC,aAAD;GAAkB;GAAK,GAAI;GAAS,CAAA;EAC5B,CAAA;EAEZ"}