PageSourceSearch

https://infosec.exchange/packs/toggle_field-B83uTBxb.js

js infosec.exchange collected 2026-09-24 07:27:19 UTC 4,110 bytes, 2 lines download raw bytes

1import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-D3F0h15I.js";import{a as r}from"./react-intl-CZJDGRhA.js";import{E as i}from"./chevron_right-D7sFWRVh.js";import{t as a}from"./classnames-CfLRLWYq.js";import{t as o}from"./a11y_live_region-DRkDyPsY.js";import{V as s}from"./poll-CiSbVnkU.js";import{t as c}from"./error-DhX5veYg.js";import{t as l}from"./info-BnsNWy2K.js";import{w as u}from"./bookmark-CtUZgtUD.js";var d=e(t()),f=e(a()),p={wrapper:`_comp_callout_inline__wrapper`,icon:`_comp_callout_inline__icon`},m=n(),h={error:c,warning:u,info:l,success:i},g=({variant:e=`error`,message:t,className:n,children:r,...i})=>(0,m.jsxs)(`div`,{...i,className:(0,f.default)(n,p.wrapper),"data-variant":e,children:[(0,m.jsx)(s,{id:e,icon:h[e],className:p.icon}),t??r]}),_={fieldset:`_comp_form_fields_fieldset__fieldset`,fieldsWrapper:`_comp_form_fields_fieldset__fieldsWrapper`,status:`_comp_form_fields_fieldset__status`},v={wrapper:`_comp_form_fields_form_field_wrapper__wrapper`,labelWrapper:`_comp_form_fields_form_field_wrapper__labelWrapper`,label:`_comp_form_fields_form_field_wrapper__label`,hint:`_comp_form_fields_form_field_wrapper__hint`,status:`_comp_form_fields_form_field_wrapper__status`,inputWrapper:`_comp_form_fields_form_field_wrapper__inputWrapper`},y=({inputId:e,label:t,hint:n,describedById:r,required:i,status:a,inputPlacement:s,children:c,className:l})=>{let u=(0,d.useId)(),p=e||`${u}-input`,h=`${e||u}-status`,_=`${e||u}-hint`,y=!!n,C=x(a),w=!!C?.message,T=!!(0,d.useContext)(S),E={required:i,id:p,"aria-describedby":[y?_:``,w?h:``,r].filter(e=>!!e).join(` `)||void 0},D=(0,m.jsx)(`div`,{className:v.inputWrapper,"data-input":!0,children:c(E)});return(0,m.jsxs)(`div`,{className:(0,f.default)(v.wrapper,l),"data-has-error":C?.variant===`error`,"data-input-placement":s,children:[s===`inline-start`&&D,(0,m.jsxs)(`div`,{className:v.labelWrapper,children:[(0,m.jsxs)(`label`,{htmlFor:p,className:v.label,"data-has-parent-fieldset":T,children:[t,i!==void 0&&(0,m.jsx)(b,{required:i})]}),y&&(0,m.jsx)(`span`,{className:v.hint,id:_,"data-hint":!0,children:n})]}),s!==`inline-start`&&D,(0,m.jsx)(o,{className:v.status,id:h,children:w&&(0,m.jsx)(g,{...C})})]})},b=({required:e})=>e?(0,m.jsxs)(m.Fragment,{children:[` `,(0,m.jsx)(`abbr`,{"aria-hidden":`true`,children:`*`})]}):(0,m.jsxs)(m.Fragment,{children:[` `,(0,m.jsx)(r,{id:`form_field.optional`,defaultMessage:`(optional)`})]});function x(e){return e?typeof e==`string`?{variant:e,message:``}:e:null}var S=(0,d.createContext)(void 0),C=({legend:e,hint:t,name:n,status:r,layout:i,className:a,children:s})=>{let c=(0,d.useId)(),l=`${c}-label`,u=`${c}-hint`,p=`${c}-status`,h=n||`${c}-fieldset-name`,y=!!t,b=x(r),C=!!b?.message,w=[y?u:``,C?p:``].filter(e=>!!e).join(` `);return(0,m.jsxs)(`fieldset`,{className:(0,f.default)(_.fieldset,a),"data-has-error":r===`error`,"aria-labelledby":l,"aria-describedby":w,children:[(0,m.jsxs)(`div`,{className:v.labelWrapper,children:[(0,m.jsx)(`div`,{id:l,className:v.label,"data-label":!0,children:e}),y&&(0,m.jsx)(`p`,{id:u,className:v.hint,"data-hint":!0,children:t})]}),(0,m.jsx)(`div`,{className:_.fieldsWrapper,"data-layout":i,"data-fields":!0,children:(0,m.jsx)(S.Provider,{value:h,children:s})}),(0,m.jsx)(o,{className:_.status,id:p,children:C&&(0,m.jsx)(g,{...b})})]})},w={wrapper:`_comp_form_fields_toggle__wrapper`,input:`_comp_form_fields_toggle__input`,toggle:`_comp_form_fields_toggle__toggle`},T=(0,d.forwardRef)(({id:e,label:t,hint:n,status:r,required:i,wrapperClassName:a,...o},s)=>(0,m.jsx)(y,{label:t,hint:n,required:i,status:r,inputId:e,inputPlacement:`inline-end`,className:a,children:e=>(0,m.jsx)(E,{...o,...e,ref:s})}));T.displayName=`ToggleField`;var E=(0,d.forwardRef)(({className:e,size:t,...n},r)=>(0,m.jsxs)(`span`,{className:(0,f.default)(w.wrapper,e),style:{"--diameter":t?`${t}px`:void 0},children:[(0,m.jsx)(`input`,{...n,type:`checkbox`,className:w.input,ref:r}),(0,m.jsx)(`span`,{className:w.toggle,hidden:!0})]}));E.displayName=`Toggle`;export{y as a,S as i,T as n,C as r,E as t};
2//# sourceMappingURL=toggle_field-B83uTBxb.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.