| 1 |
import { j as jsxRuntimeExports } from "./react-vendor-xzSqHjRF.js"; |
| 2 |
const Toggle = ({ |
| 3 |
checked, |
| 4 |
onChange, |
| 5 |
disabled = false |
| 6 |
}) => { |
| 7 |
return /* @__PURE__ */ jsxRuntimeExports.jsx( |
| 8 |
"button", |
| 9 |
{ |
| 10 |
type: "button", |
| 11 |
role: "switch", |
| 12 |
"aria-checked": checked, |
| 13 |
disabled, |
| 14 |
onClick: () => !disabled && onChange(!checked), |
| 15 |
className: ` |
| 16 |
relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 |
| 17 |
${checked ? "bg-blue-600" : "bg-gray-300 dark:bg-gray-600"} |
| 18 |
${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"} |
| 19 |
`, |
| 20 |
children: /* @__PURE__ */ jsxRuntimeExports.jsx( |
| 21 |
"span", |
| 22 |
{ |
| 23 |
className: ` |
| 24 |
inline-block h-5 w-5 transform rounded-full bg-white transition-transform |
| 25 |
${checked ? "translate-x-5" : "translate-x-0.5"} |
| 26 |
` |
| 27 |
} |
| 28 |
) |
| 29 |
} |
| 30 |
); |
| 31 |
}; |
| 32 |
export { |
| 33 |
Toggle as T |
| 34 |
}; |
| 35 |
//# sourceMappingURL=toggle-DUbJsrWf.js.map |
| 36 |
|