import { __rest } from "tslib";
import { jsx as _jsx } from "react/jsx-runtime";
import MuiSwitch from '@mui/material/Switch';
import clsx from 'clsx';
import { forwardRef } from 'react';

/**
 * The Switch toggles the state of a single setting on or off.
 *
 * Demos:
 *
 * - [Switch (Oxygen UI)](https://wso2.github.io/oxygen-ui/react/?path=/docs/inputs-switch)
 * - [Switch (MUI)](https://mui.com/material-ui/react-switch/)
 * - [Transfer List (Oxygen UI)](TODO: Add a link after implementing: Tracker: https://github.com/wso2/oxygen-ui/issues/2)
 * - [Transfer List (MUI)](https://mui.com/material-ui/react-transfer-list/)
 *
 * API:
 *
 * - [Switch API](https://mui.com/material-ui/api/switch/)
 * - inherits [IconButton API](https://mui.com/material-ui/api/icon-button/)
 *
 * @remarks
 * - ✔️ Props of the [IconButton](https://mui.com/material-ui/api/icon-button/) component are also available.
 * - ✅ `component` prop is supported.
 * - ✅ The `ref` is forwarded to the root element.
 *
 * @template C - The type of the component.
 * @param props - The props for the Switch component.
 * @param ref - The ref to be forwarded to the MuiSwitch component.
 * @returns The rendered Switch component.
 */
const Switch = forwardRef((_a, ref) => {
    var { className } = _a, rest = __rest(_a, ["className"]);
    return (_jsx(MuiSwitch, Object.assign({ ref: ref, className: clsx(
        /* @deprecated Use the PascalCase classname instead. https://github.com/wso2/oxygen-ui/issues/274 */
        'oxygen-switch', 'OxygenSwitch-root', className) }, rest)));
});
export default Switch;
function addCSS(css){var head = document.getElementsByTagName('head')[0];var s = document.createElement('style');s.setAttribute('type', 'text/css');s.appendChild(document.createTextNode(css));head.appendChild(s);}
addCSS("/**\n * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n:root {\n  --oxygen-switch-width: 3.9rem;\n  --oxygen-switch-height: 2.5rem;\n  --oxygen-switch-track-height: 1rem;\n  --oxygen-switch-track-width: 2rem;\n  --oxygen-switch-thumb-height: 1.5rem;\n  --oxygen-switch-thumb-width: 1.5rem;\n  --oxygen-switch-small-width: 2.8rem;\n  --oxygen-switch-small-height: 1.8rem;\n  --oxygen-switch-small-track-height: 0.8rem;\n  --oxygen-switch-small-track-width: 1.5rem;\n  --oxygen-switch-small-thumb-height: 1.2rem;\n  --oxygen-switch-small-thumb-width: 1.2rem;\n}\n\n.oxygen-switch {\n  width: var(--oxygen-switch-width);\n  height: var(--oxygen-switch-height);\n}\n.oxygen-switch .MuiSwitch-thumb {\n  background: var(--oxygen-palette-common-white);\n  width: var(--oxygen-switch-thumb-width);\n  height: var(--oxygen-switch-thumb-width);\n  border-width: 0.125rem;\n  border-style: solid;\n  border-image: initial;\n  border-color: var(--oxygen-palette-divider);\n}\n.oxygen-switch .MuiSwitch-track {\n  height: var(--oxygen-switch-track-height);\n  width: var(--oxygen-switch-track-width);\n  opacity: 0.25;\n  margin-top: 1px;\n}\n.oxygen-switch .Mui-checked.MuiSwitch-switchBase {\n  --transform-x-thumb-offset: calc(var(--oxygen-switch-thumb-width)/2);\n  --transform-x-offset: calc(var(--oxygen-switch-track-width) + var(--transform-x-thumb-offset));\n  transform: translateX(calc(var(--oxygen-switch-width) - var(--transform-x-offset)));\n}\n.oxygen-switch .Mui-checked .MuiSwitch-thumb {\n  box-shadow: var(--oxygen-shadows-3);\n  background: var(--oxygen-palette-primary-main);\n  border-color: var(--oxygen-palette-common-white);\n}\n.oxygen-switch.MuiSwitch-sizeSmall {\n  width: var(--oxygen-switch-small-width);\n  height: var(--oxygen-switch-small-height);\n}\n.oxygen-switch.MuiSwitch-sizeSmall .MuiSwitch-thumb {\n  width: var(--oxygen-switch-small-thumb-width);\n  height: var(--oxygen-switch-small-thumb-height);\n}\n.oxygen-switch.MuiSwitch-sizeSmall .MuiSwitch-track {\n  height: var(--oxygen-switch-small-track-height);\n  width: var(--oxygen-switch-small-track-width);\n}\n.oxygen-switch.MuiSwitch-sizeSmall .Mui-checked.MuiSwitch-switchBase {\n  --transform-x-thumb-offset: calc(var(--oxygen-switch-small-thumb-width)/2);\n  --transform-x-offset: calc(var(--oxygen-switch-small-track-width) + var(--transform-x-thumb-offset));\n  transform: translateX(calc(var(--oxygen-switch-small-width) - var(--transform-x-offset)));\n}\n.oxygen-switch :not(.Mui-checked) .MuiSwitch-track {\n  opacity: 0.08;\n}");