Build 545032stable
Module 395515
2,752 characters · in no known chunkDependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{T:()=>S});var i=n(627968),r=n(64700),s=n(503698),a=n.n(s),o=n(873174),l=n(661531),u=n(717421),c=n(603392),d=n(844222),_=n(187322),f=n(452027),h=n(180846);let p={mass:1,tension:250},E="M5.13231 6.72963L6.7233 5.13864L14.855 13.2704L13.264 14.8614L5.13231 6.72963Z",m="M13.2704 5.13864L14.8614 6.72963L6.72963 14.8614L5.13864 13.2704L13.2704 5.13864Z",g="M6.56666 11.0013L6.56666 8.96683L13.5667 8.96683L13.5667 11.0013L6.56666 11.0013Z",A="M13.5582 8.96683L13.5582 11.0013L6.56192 11.0013L6.56192 8.96683L13.5582 8.96683Z",I="M7.89561 14.8538L6.30462 13.2629L14.3099 5.25755L15.9009 6.84854L7.89561 14.8538Z",T="M4.08643 11.0903L5.67742 9.49929L9.4485 13.2704L7.85751 14.8614L4.08643 11.0903Z";function S(e){let{onChange:t,checked:n,disabled:s,focusProps:S,innerRef:N,...y}=e,{reducedMotion:C}=r.useContext(d.C),v=r.useRef(null),[O,R]=r.useState(!1),b=(0,c.r)(l.A.colors.SLIDER_TRACK_BACKGROUND).spring(),D=(0,c.r)(l.A.colors.BACKGROUND_BRAND).spring(),{state:L}=(0,u.z)({config:p,state:O?n?.7:.3:+!!n},"animate-always");function w(e){R(!1),e.stopPropagation(),t?.(e.currentTarget.checked)}function M(e){s||e.repeat||(" "===e.key||"Enter"===e.key)&&R(!0)}function P(e){s||!O||e.repeat||(R(!1),"Enter"===e.key&&v.current?.click())}return(0,i.jsx)(f.D,{...y,disabled:s,layout:"horizontal",layoutConfig:{horizontalControlColumnWidth:"auto"},auxiliaryContentPosition:"under-label",children:e=>{var t;let r,l,u;return(0,i.jsx)(_.vN,{...S,within:!0,offset:-2,children:(0,i.jsxs)(o.animated.div,{"data-toggleable-component":"switch",className:a()(h.kL,{[h.KD]:n,[h.r9]:s}),onMouseDown:()=>!s&&R(!0),onMouseUp:()=>R(!1),onMouseLeave:()=>R(!1),style:{backgroundColor:L.to({output:[b,D]})},children:[(0,i.jsxs)(o.animated.svg,{className:h.aw,viewBox:"0 0 28 20",preserveAspectRatio:"xMinYMid meet",style:{left:L.to({range:[0,.3,.7,1],output:[-4,1,8,12]})},"aria-hidden":!0,children:[(0,i.jsx)(o.animated.rect,{fill:"white",x:L.to({range:[0,.3,.7,1],output:[4,0,0,4]}),y:L.to({range:[0,.3,.7,1],output:[0,1,1,0]}),height:L.to({range:[0,.3,.7,1],output:[20,18,18,20]}),width:L.to({range:[0,.3,.7,1],output:[20,28,28,20]}),rx:"10"}),(t=C.enabled,r=L.to({output:[b,D]}),l=t?[E,E,I,I]:[E,g,g,I],u=t?[m,m,T,T]:[m,A,A,T],(0,i.jsxs)("svg",{viewBox:"0 0 20 20",fill:"none",children:[(0,i.jsx)(o.animated.path,{fill:r,d:L.to({range:[0,.3,.7,1],output:l})}),(0,i.jsx)(o.animated.path,{fill:r,d:L.to({range:[0,.3,.7,1],output:u})})]}))]}),(0,i.jsx)("input",{id:e.controlId,"aria-describedby":e.describedById,"aria-errormessage":e.errorMessageId,"aria-invalid":null!=e.errorMessageId,type:"checkbox",ref:e=>{v.current=e,null!=N&&(N.current=e)},className:h.hF,tabIndex:s?-1:0,onKeyDown:M,onKeyUp:P,onChange:w,checked:n,disabled:s})]})})}})}}