"use strict";var k=Object.create;var a=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var N=Object.getPrototypeOf;var T=Object.prototype.hasOwnProperty;var l=(e,t)=>a(e,"name",{value:t,configurable:true});var W=(e,t)=>{for(var o in t)a(e,o,{get:t[o],enumerable:true})};var m=(e,t,o,s)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let r of H(t))if(!T.call(e,r)&&r!==o)a(e,r,{get:()=>t[r],enumerable:!(s=x(t,r))||s.enumerable})}return e};var n=(e,t,o)=>(o=e!=null?k(N(e)):{},m(t||!e||!e.__esModule?a(o,"default",{value:e,enumerable:true}):o,e));var A=e=>m(a({},"__esModule",{value:true}),e);var M={};W(M,{default:()=>E});module.exports=A(M);var i=require("react/jsx-runtime");var p=n(require("classnames"));var b=require("lodash");var f=require("react");var y=n(require("react-jss"));var h=n(require("../error"));var L=n(require("../label"));var P=n(require("../wrapper"));const F=window?.matchMedia("(prefers-reduced-motion: no-preference)")?"all .5s":"none";const R=l(e=>({toggle:{background:e.toggleBackground,borderRadius:e.borderRadius,height:e.toggleHeight,position:"relative",width:e.toggleWidth},button:{background:e.toggleButton,borderRadius:"100%",boxShadow:"0 1px 4px rgba(0, 0, 0, .3)",width:e.toggleHeight-2,height:e.toggleHeight-2,left:1,top:1,position:"absolute",transition:F},buttonActive:{background:e.toggleButtonActive,left:e.toggleWidth-e.toggleHeight+1},input:{visibility:"hidden"},disabled:{opacity:e.inputDisabledOpacity},toggleLabel:{display:"flex",alignItems:"center","& > span":{order:1,marginLeft:15}}}),"styles");class u extends f.Component{render(){const{classes:t,className:o,id:s="",name:r="",label:v="",error:g="",checked:d=false,showLabel:w=true,disabled:c=false,onChange:I=b.noop}=this.props;return(0,i.jsxs)(P.default,{className:o,identifier:"franz-toggle",children:[(0,i.jsx)(L.default,{title:v,showLabel:w,htmlFor:s,className:t.toggleLabel,children:(0,i.jsxs)("div",{className:(0,p.default)({[`${t.toggle}`]:true,[`${t.disabled}`]:c}),children:[(0,i.jsx)("div",{className:(0,p.default)({[`${t.button}`]:true,[`${t.buttonActive}`]:d})}),(0,i.jsx)("input",{type:"checkbox",id:s,name:r,checked:d,className:t.input,onChange:I,disabled:c})]})}),g?(0,i.jsx)(h.default,{message:g}):null]})}}l(u,"Toggle");var E=(0,y.default)(R,{injectTheme:true})(u);
