@purpurds/checkbox 7.5.0 → 7.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LICENSE.txt +11 -4
- package/dist/checkbox.cjs.js +11 -7
- package/dist/checkbox.cjs.js.map +1 -1
- package/dist/checkbox.d.ts +8 -0
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.es.js +518 -444
- package/dist/checkbox.es.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +7 -6
- package/src/checkbox.module.scss +6 -2
- package/src/checkbox.stories.tsx +5 -2
- package/src/checkbox.test.tsx +10 -0
- package/src/checkbox.tsx +31 -14
package/dist/LICENSE.txt
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
Name: @purpurds/field-error-text
|
|
2
|
-
Version: 7.
|
|
2
|
+
Version: 7.5.1
|
|
3
|
+
License: AGPL-3.0-only
|
|
4
|
+
Private: false
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Name: @purpurds/field-helper-text
|
|
9
|
+
Version: 7.5.1
|
|
3
10
|
License: AGPL-3.0-only
|
|
4
11
|
Private: false
|
|
5
12
|
|
|
6
13
|
---
|
|
7
14
|
|
|
8
15
|
Name: @purpurds/icon
|
|
9
|
-
Version: 7.
|
|
16
|
+
Version: 7.5.1
|
|
10
17
|
License: AGPL-3.0-only
|
|
11
18
|
Private: false
|
|
12
19
|
|
|
13
20
|
---
|
|
14
21
|
|
|
15
22
|
Name: @purpurds/label
|
|
16
|
-
Version: 7.
|
|
23
|
+
Version: 7.5.1
|
|
17
24
|
License: AGPL-3.0-only
|
|
18
25
|
Private: false
|
|
19
26
|
|
|
20
27
|
---
|
|
21
28
|
|
|
22
29
|
Name: @purpurds/paragraph
|
|
23
|
-
Version: 7.
|
|
30
|
+
Version: 7.5.1
|
|
24
31
|
License: AGPL-3.0-only
|
|
25
32
|
Private: false
|
|
26
33
|
|
package/dist/checkbox.cjs.js
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),ie=require("react");require("react-dom");function we(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const s=we(ie);function $e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var z={exports:{}};/*!
|
|
2
2
|
Copyright (c) 2018 Jed Watson.
|
|
3
3
|
Licensed under the MIT License (MIT), see
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
5
|
-
*/var W;function
|
|
5
|
+
*/var W;function Se(){return W||(W=1,function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",o=0;o<arguments.length;o++){var u=arguments[o];u&&(r=a(r,i.call(this,u)))}return r}function i(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var o="";for(var u in r)n.call(r,u)&&r[u]&&(o=a(o,this&&this[u]||u));return o}function a(r,o){return o?r?r+" "+o:r+o:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()}(z)),z.exports}var Ce=Se();const Ne=$e(Ce),je={"purpur-icon":"_purpur-icon_8u1lq_1","purpur-icon--xxs":"_purpur-icon--xxs_8u1lq_4","purpur-icon--xs":"_purpur-icon--xs_8u1lq_8","purpur-icon--sm":"_purpur-icon--sm_8u1lq_12","purpur-icon--md":"_purpur-icon--md_8u1lq_16","purpur-icon--lg":"_purpur-icon--lg_8u1lq_20","purpur-icon--xl":"_purpur-icon--xl_8u1lq_24"},ke=Ne.bind(je),B="purpur-icon",Oe="md",Pe=e=>e.filter(n=>Object.keys(n).length>=1).map(n=>`${n.name}="${n.value}"`).join(" "),Ae=({content:e="",title:n}={})=>{const t=[{name:"xmlns",value:"http://www.w3.org/2000/svg"},{name:"fill",value:"currentColor"},{name:"viewBox",value:"0 0 24 24"},n?{name:"role",value:"img"}:{name:"aria-hidden",value:"true"}],i=n?`<title>${n}</title>`:"";return`<svg ${Pe(t)}>${i}${e}</svg>`},Re=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),ae=({["data-testid"]:e,svg:n,allyTitle:t,className:i,size:a=Oe,...r})=>{const o=Ae({content:Re(n.svg),title:t}),u=ke(i,B,`${B}--${a}`);return l.jsx("span",{className:u,"data-testid":e,dangerouslySetInnerHTML:{__html:o},...r})};ae.displayName="Icon";const Ee={name:"error-filled",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 24" fill="currentColor"><path fill-rule="evenodd" d="M14.268 3.5c-.77-1.333-2.694-1.333-3.464 0l-8.66 15c-.77 1.333.192 3 1.732 3h17.32c1.54 0 2.502-1.667 1.733-3l-8.66-15Zm-.694 5.067-.247 6.876h-1.566l-.247-6.876a1.03 1.03 0 1 1 2.06 0Zm.212 8.917c0 .649-.585 1.234-1.25 1.234-.648 0-1.25-.585-1.25-1.234 0-.633.602-1.234 1.25-1.234.665 0 1.25.601 1.25 1.234Z" clip-rule="evenodd"/></svg>',keywords:["error-filled"],category:"status"};function Me(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var I={exports:{}};/*!
|
|
6
6
|
Copyright (c) 2018 Jed Watson.
|
|
7
7
|
Licensed under the MIT License (MIT), see
|
|
8
8
|
http://jedwatson.github.io/classnames
|
|
9
|
-
*/var
|
|
9
|
+
*/var L;function qe(){return L||(L=1,function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",o=0;o<arguments.length;o++){var u=arguments[o];u&&(r=a(r,i(u)))}return r}function i(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var o="";for(var u in r)n.call(r,u)&&r[u]&&(o=a(o,u));return o}function a(r,o){return o?r?r+" "+o:r+o:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()}(I)),I.exports}var De=qe();const ze=Me(De),U={"purpur-field-error-text":"_purpur-field-error-text_1lj7e_1","purpur-field-error-text__icon":"_purpur-field-error-text__icon_1lj7e_11"},F="purpur-field-error-text",We=({children:e,className:n,["aria-relevant"]:t="additions text",...i})=>l.jsxs("div",{className:ze([n,U[F]]),"aria-live":"assertive","aria-relevant":t,...i,children:[l.jsx(ae,{svg:Ee,size:"xs",className:U[`${F}__icon`]}),e]});function Be(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var T={exports:{}};/*!
|
|
10
10
|
Copyright (c) 2018 Jed Watson.
|
|
11
11
|
Licensed under the MIT License (MIT), see
|
|
12
12
|
http://jedwatson.github.io/classnames
|
|
13
|
-
*/var V;function
|
|
13
|
+
*/var V;function Ie(){return V||(V=1,function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",o=0;o<arguments.length;o++){var u=arguments[o];u&&(r=a(r,i(u)))}return r}function i(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var o="";for(var u in r)n.call(r,u)&&r[u]&&(o=a(o,u));return o}function a(r,o){return o?r?r+" "+o:r+o:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()}(T)),T.exports}var Le=Ie();const Ue=Be(Le),Z={"purpur-field-helper-text":"_purpur-field-helper-text_atw6b_1","purpur-field-helper-text--disabled":"_purpur-field-helper-text--disabled_atw6b_9"},H="purpur-field-helper-text",Fe=({children:e,className:n,disabled:t,id:i,...a})=>{const r=Ue([n,Z[H],{[Z[`${H}--disabled`]]:t}]);return l.jsx("span",{id:i,className:r,...a,children:e})};function Te(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var K={exports:{}};/*!
|
|
14
14
|
Copyright (c) 2018 Jed Watson.
|
|
15
15
|
Licensed under the MIT License (MIT), see
|
|
16
16
|
http://jedwatson.github.io/classnames
|
|
17
|
-
*/var G;function
|
|
17
|
+
*/var G;function Ve(){return G||(G=1,function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",o=0;o<arguments.length;o++){var u=arguments[o];u&&(r=a(r,i.call(this,u)))}return r}function i(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var o="";for(var u in r)n.call(r,u)&&r[u]&&(o=a(o,this&&this[u]||u));return o}function a(r,o){return o?r?r+" "+o:r+o:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()}(K)),K.exports}var Ze=Ve();const He=Te(Ze),Ke={"purpur-icon":"_purpur-icon_8u1lq_1","purpur-icon--xxs":"_purpur-icon--xxs_8u1lq_4","purpur-icon--xs":"_purpur-icon--xs_8u1lq_8","purpur-icon--sm":"_purpur-icon--sm_8u1lq_12","purpur-icon--md":"_purpur-icon--md_8u1lq_16","purpur-icon--lg":"_purpur-icon--lg_8u1lq_20","purpur-icon--xl":"_purpur-icon--xl_8u1lq_24"},Ge=He.bind(Ke),X="purpur-icon",Xe="md",Je=e=>e.filter(n=>Object.keys(n).length>=1).map(n=>`${n.name}="${n.value}"`).join(" "),Qe=({content:e="",title:n}={})=>{const t=[{name:"xmlns",value:"http://www.w3.org/2000/svg"},{name:"fill",value:"currentColor"},{name:"viewBox",value:"0 0 24 24"},n?{name:"role",value:"img"}:{name:"aria-hidden",value:"true"}],i=n?`<title>${n}</title>`:"";return`<svg ${Je(t)}>${i}${e}</svg>`},Ye=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),R=({["data-testid"]:e,svg:n,allyTitle:t,className:i,size:a=Xe,...r})=>{const o=Qe({content:Ye(n.svg),title:t}),u=Ge(i,X,`${X}--${a}`);return l.jsx("span",{className:u,"data-testid":e,dangerouslySetInnerHTML:{__html:o},...r})};R.displayName="Icon";const er={name:"checkmark-bold",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M21.243 4.176a2 2 0 0 1 .324 2.81l-10.45 13.176a2.092 2.092 0 0 1-3.118.18l-5.413-5.413A2 2 0 1 1 5.414 12.1l3.9 3.9 9.118-11.5a2 2 0 0 1 2.81-.324Z" clip-rule="evenodd"/></svg>',keywords:["checkmark-bold"],category:"utility"},rr={name:"minus-bold",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M3 12c0-1.105.711-2 1.588-2h14.824c.877 0 1.588.895 1.588 2s-.711 2-1.588 2H4.588C3.711 14 3 13.105 3 12Z" clip-rule="evenodd"/></svg>',keywords:["minus-bold"],category:"utility"};function J(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function tr(...e){return n=>{let t=!1;const i=e.map(a=>{const r=J(a,n);return!t&&typeof r=="function"&&(t=!0),r});if(t)return()=>{for(let a=0;a<i.length;a++){const r=i[a];typeof r=="function"?r():J(e[a],null)}}}}var ue=s.forwardRef((e,n)=>{const{children:t,...i}=e,a=s.Children.toArray(t),r=a.find(or);if(r){const o=r.props.children,u=a.map(c=>c===r?s.Children.count(o)>1?s.Children.only(null):s.isValidElement(o)?o.props.children:null:c);return l.jsx(E,{...i,ref:n,children:s.isValidElement(o)?s.cloneElement(o,void 0,u):null})}return l.jsx(E,{...i,ref:n,children:t})});ue.displayName="Slot";var E=s.forwardRef((e,n)=>{const{children:t,...i}=e;if(s.isValidElement(t)){const a=ar(t),r=ir(i,t.props);return t.type!==s.Fragment&&(r.ref=n?tr(n,a):a),s.cloneElement(t,r)}return s.Children.count(t)>1?s.Children.only(null):null});E.displayName="SlotClone";var nr=({children:e})=>l.jsx(l.Fragment,{children:e});function or(e){return s.isValidElement(e)&&e.type===nr}function ir(e,n){const t={...n};for(const i in n){const a=e[i],r=n[i];/^on[A-Z]/.test(i)?a&&r?t[i]=(...o)=>{r(...o),a(...o)}:a&&(t[i]=a):i==="style"?t[i]={...a,...r}:i==="className"&&(t[i]=[a,r].filter(Boolean).join(" "))}return{...e,...t}}function ar(e){var n,t;let i=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,a=i&&"isReactWarning"in i&&i.isReactWarning;return a?e.ref:(i=(t=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:t.get,a=i&&"isReactWarning"in i&&i.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}var ur=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],sr=ur.reduce((e,n)=>{const t=s.forwardRef((i,a)=>{const{asChild:r,...o}=i,u=r?ue:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(u,{...o,ref:a})});return t.displayName=`Primitive.${n}`,{...e,[n]:t}},{}),cr="Label",se=s.forwardRef((e,n)=>l.jsx(sr.label,{...e,ref:n,onMouseDown:t=>{var i;t.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));se.displayName=cr;var lr=se;function pr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Q={exports:{}};/*!
|
|
18
18
|
Copyright (c) 2018 Jed Watson.
|
|
19
19
|
Licensed under the MIT License (MIT), see
|
|
20
20
|
http://jedwatson.github.io/classnames
|
|
21
|
-
*/var J;function sr(){return J||(J=1,function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",i=0;i<arguments.length;i++){var u=arguments[i];u&&(r=a(r,o(u)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var i="";for(var u in r)n.call(r,u)&&r[u]&&(i=a(i,u));return i}function a(r,i){return i?r?r+" "+i:r+i:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()}(X)),X.exports}var cr=sr();const lr=ur(cr),$={"purpur-paragraph":"_purpur-paragraph_1rh57_1","purpur-paragraph--disabled":"_purpur-paragraph--disabled_1rh57_7","purpur-paragraph--hyphens":"_purpur-paragraph--hyphens_1rh57_10","purpur-paragraph--negative":"_purpur-paragraph--negative_1rh57_13","purpur-paragraph--paragraph-100":"_purpur-paragraph--paragraph-100_1rh57_16","purpur-paragraph--paragraph-100-medium":"_purpur-paragraph--paragraph-100-medium_1rh57_22","purpur-paragraph--paragraph-100-bold":"_purpur-paragraph--paragraph-100-bold_1rh57_29","purpur-paragraph--paragraph-200":"_purpur-paragraph--paragraph-200_1rh57_36","purpur-paragraph--preamble-100":"_purpur-paragraph--preamble-100_1rh57_42","purpur-paragraph--preamble-200":"_purpur-paragraph--preamble-200_1rh57_48","purpur-paragraph--additional-100":"_purpur-paragraph--additional-100_1rh57_54","purpur-paragraph--additional-100-medium":"_purpur-paragraph--additional-100-medium_1rh57_60","purpur-paragraph--overline-100":"_purpur-paragraph--overline-100_1rh57_67","purpur-paragraph--overline-200":"_purpur-paragraph--overline-200_1rh57_75"},pr={PARAGRAPH100:"paragraph-100"},N="purpur-paragraph",ie=({["data-testid"]:e,children:n,className:t,disabled:o,enableHyphenation:a=!1,negative:r=!1,variant:i=pr.PARAGRAPH100,...u})=>{const c=lr([t,$[N],$[`${N}--${i}`],{[$[`${N}--hyphens`]]:a,[$[`${N}--disabled`]]:o,[$[`${N}--negative`]]:r}]);return l.jsx("p",{...u,className:c,"data-testid":e,children:n})};ie.displayName="Paragraph";function Q(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function ae(...e){return n=>{let t=!1;const o=e.map(a=>{const r=Q(a,n);return!t&&typeof r=="function"&&(t=!0),r});if(t)return()=>{for(let a=0;a<o.length;a++){const r=o[a];typeof r=="function"?r():Q(e[a],null)}}}}function ue(...e){return s.useCallback(ae(...e),e)}function dr(e,n=[]){let t=[];function o(r,i){const u=s.createContext(i),c=t.length;t=[...t,i];const p=h=>{var b;const{scope:d,children:m,...g}=h,_=((b=d==null?void 0:d[e])==null?void 0:b[c])||u,w=s.useMemo(()=>g,Object.values(g));return l.jsx(_.Provider,{value:w,children:m})};p.displayName=r+"Provider";function f(h,d){var _;const m=((_=d==null?void 0:d[e])==null?void 0:_[c])||u,g=s.useContext(m);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${r}\``)}return[p,f]}const a=()=>{const r=t.map(i=>s.createContext(i));return function(u){const c=(u==null?void 0:u[e])||r;return s.useMemo(()=>({[`__scope${e}`]:{...u,[e]:c}}),[u,c])}};return a.scopeName=e,[o,fr(a,...n)]}function fr(...e){const n=e[0];if(e.length===1)return n;const t=()=>{const o=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(r){const i=o.reduce((u,{useScope:c,scopeName:p})=>{const h=c(r)[`__scope${p}`];return{...u,...h}},{});return s.useMemo(()=>({[`__scope${n.scopeName}`]:i}),[i])}};return t.scopeName=n.scopeName,t}function Y(e,n,{checkForDefaultPrevented:t=!0}={}){return function(a){if(e==null||e(a),t===!1||!a.defaultPrevented)return n==null?void 0:n(a)}}function se(e){const n=s.useRef(e);return s.useEffect(()=>{n.current=e}),s.useMemo(()=>(...t)=>{var o;return(o=n.current)==null?void 0:o.call(n,...t)},[])}function hr({prop:e,defaultProp:n,onChange:t=()=>{}}){const[o,a]=mr({defaultProp:n,onChange:t}),r=e!==void 0,i=r?e:o,u=se(t),c=s.useCallback(p=>{if(r){const h=typeof p=="function"?p(e):p;h!==e&&u(h)}else a(p)},[r,e,a,u]);return[i,c]}function mr({defaultProp:e,onChange:n}){const t=s.useState(e),[o]=t,a=s.useRef(o),r=se(n);return s.useEffect(()=>{a.current!==o&&(r(o),a.current=o)},[o,a,r]),t}function gr(e){const n=s.useRef({value:e,previous:e});return s.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}var M=globalThis!=null&&globalThis.document?s.useLayoutEffect:()=>{};function vr(e){const[n,t]=s.useState(void 0);return M(()=>{if(e){t({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const r=a[0];let i,u;if("borderBoxSize"in r){const c=r.borderBoxSize,p=Array.isArray(c)?c[0]:c;i=p.inlineSize,u=p.blockSize}else i=e.offsetWidth,u=e.offsetHeight;t({width:i,height:u})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else t(void 0)},[e]),n}function _r(e,n){return s.useReducer((t,o)=>n[t][o]??t,e)}var ce=e=>{const{present:n,children:t}=e,o=br(n),a=typeof t=="function"?t({present:o.isPresent}):s.Children.only(t),r=ue(o.ref,xr(a));return typeof t=="function"||o.isPresent?s.cloneElement(a,{ref:r}):null};ce.displayName="Presence";function br(e){const[n,t]=s.useState(),o=s.useRef({}),a=s.useRef(e),r=s.useRef("none"),i=e?"mounted":"unmounted",[u,c]=_r(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{const p=j(o.current);r.current=u==="mounted"?p:"none"},[u]),M(()=>{const p=o.current,f=a.current;if(f!==e){const d=r.current,m=j(p);e?c("MOUNT"):m==="none"||(p==null?void 0:p.display)==="none"?c("UNMOUNT"):c(f&&d!==m?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),M(()=>{if(n){let p;const f=n.ownerDocument.defaultView??window,h=m=>{const _=j(o.current).includes(m.animationName);if(m.target===n&&_&&(c("ANIMATION_END"),!a.current)){const w=n.style.animationFillMode;n.style.animationFillMode="forwards",p=f.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=w)})}},d=m=>{m.target===n&&(r.current=j(o.current))};return n.addEventListener("animationstart",d),n.addEventListener("animationcancel",h),n.addEventListener("animationend",h),()=>{f.clearTimeout(p),n.removeEventListener("animationstart",d),n.removeEventListener("animationcancel",h),n.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[n,c]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:s.useCallback(p=>{p&&(o.current=getComputedStyle(p)),t(p)},[])}}function j(e){return(e==null?void 0:e.animationName)||"none"}function xr(e){var o,a;let n=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,t=n&&"isReactWarning"in n&&n.isReactWarning;return t?e.ref:(n=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var le=s.forwardRef((e,n)=>{const{children:t,...o}=e,a=s.Children.toArray(t),r=a.find(wr);if(r){const i=r.props.children,u=a.map(c=>c===r?s.Children.count(i)>1?s.Children.only(null):s.isValidElement(i)?i.props.children:null:c);return l.jsx(q,{...o,ref:n,children:s.isValidElement(i)?s.cloneElement(i,void 0,u):null})}return l.jsx(q,{...o,ref:n,children:t})});le.displayName="Slot";var q=s.forwardRef((e,n)=>{const{children:t,...o}=e;if(s.isValidElement(t)){const a=Cr(t),r=Sr(o,t.props);return t.type!==s.Fragment&&(r.ref=n?ae(n,a):a),s.cloneElement(t,r)}return s.Children.count(t)>1?s.Children.only(null):null});q.displayName="SlotClone";var yr=({children:e})=>l.jsx(l.Fragment,{children:e});function wr(e){return s.isValidElement(e)&&e.type===yr}function Sr(e,n){const t={...n};for(const o in n){const a=e[o],r=n[o];/^on[A-Z]/.test(o)?a&&r?t[o]=(...u)=>{r(...u),a(...u)}:a&&(t[o]=a):o==="style"?t[o]={...a,...r}:o==="className"&&(t[o]=[a,r].filter(Boolean).join(" "))}return{...e,...t}}function Cr(e){var o,a;let n=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,t=n&&"isReactWarning"in n&&n.isReactWarning;return t?e.ref:(n=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var $r=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],pe=$r.reduce((e,n)=>{const t=s.forwardRef((o,a)=>{const{asChild:r,...i}=o,u=r?le:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(u,{...i,ref:a})});return t.displayName=`Primitive.${n}`,{...e,[n]:t}},{}),D="Checkbox",[Nr,Br]=dr(D),[jr,kr]=Nr(D),de=s.forwardRef((e,n)=>{const{__scopeCheckbox:t,name:o,checked:a,defaultChecked:r,required:i,disabled:u,value:c="on",onCheckedChange:p,form:f,...h}=e,[d,m]=s.useState(null),g=ue(n,v=>m(v)),_=s.useRef(!1),w=d?f||!!d.closest("form"):!0,[b=!1,k]=hr({prop:a,defaultProp:r,onChange:p}),ve=s.useRef(b);return s.useEffect(()=>{const v=d==null?void 0:d.form;if(v){const C=()=>k(ve.current);return v.addEventListener("reset",C),()=>v.removeEventListener("reset",C)}},[d,k]),l.jsxs(jr,{scope:t,state:b,disabled:u,children:[l.jsx(pe.button,{type:"button",role:"checkbox","aria-checked":y(b)?"mixed":b,"aria-required":i,"data-state":me(b),"data-disabled":u?"":void 0,disabled:u,value:c,...h,ref:g,onKeyDown:Y(e.onKeyDown,v=>{v.key==="Enter"&&v.preventDefault()}),onClick:Y(e.onClick,v=>{k(C=>y(C)?!0:!C),w&&(_.current=v.isPropagationStopped(),_.current||v.stopPropagation())})}),w&&l.jsx(Or,{control:d,bubbles:!_.current,name:o,value:c,checked:b,required:i,disabled:u,form:f,style:{transform:"translateX(-100%)"},defaultChecked:y(r)?!1:r})]})});de.displayName=D;var fe="CheckboxIndicator",he=s.forwardRef((e,n)=>{const{__scopeCheckbox:t,forceMount:o,...a}=e,r=kr(fe,t);return l.jsx(ce,{present:o||y(r.state)||r.state===!0,children:l.jsx(pe.span,{"data-state":me(r.state),"data-disabled":r.disabled?"":void 0,...a,ref:n,style:{pointerEvents:"none",...e.style}})})});he.displayName=fe;var Or=e=>{const{control:n,checked:t,bubbles:o=!0,defaultChecked:a,...r}=e,i=s.useRef(null),u=gr(t),c=vr(n);s.useEffect(()=>{const f=i.current,h=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(h,"checked").set;if(u!==t&&m){const g=new Event("click",{bubbles:o});f.indeterminate=y(t),m.call(f,y(t)?!1:t),f.dispatchEvent(g)}},[u,t,o]);const p=s.useRef(y(t)?!1:t);return l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a??p.current,...r,tabIndex:-1,ref:i,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function y(e){return e==="indeterminate"}function me(e){return y(e)?"indeterminate":e?"checked":"unchecked"}var Pr=de,Rr=he;function Ar(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var R={exports:{}};/*!
|
|
21
|
+
*/var Y;function dr(){return Y||(Y=1,function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",o=0;o<arguments.length;o++){var u=arguments[o];u&&(r=a(r,i(u)))}return r}function i(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var o="";for(var u in r)n.call(r,u)&&r[u]&&(o=a(o,u));return o}function a(r,o){return o?r?r+" "+o:r+o:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()}(Q)),Q.exports}var fr=dr();const hr=pr(fr),O={"purpur-label":"_purpur-label_1jndl_1","purpur-label--negative":"_purpur-label--negative_1jndl_8","purpur-label--disabled":"_purpur-label--disabled_1jndl_11"},P="purpur-label",mr=({children:e,className:n,disabled:t,negative:i=!1,...a})=>{const r=hr([n,O[P],{[O[`${P}--disabled`]]:t,[O[`${P}--negative`]]:i}]);return l.jsx(lr,{className:r,...a,children:e})};function gr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ee={exports:{}};/*!
|
|
22
22
|
Copyright (c) 2018 Jed Watson.
|
|
23
23
|
Licensed under the MIT License (MIT), see
|
|
24
24
|
http://jedwatson.github.io/classnames
|
|
25
|
-
*/var ee;function Er(){return ee||(ee=1,function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",i=0;i<arguments.length;i++){var u=arguments[i];u&&(r=a(r,o.call(this,u)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var i="";for(var u in r)n.call(r,u)&&r[u]&&(i=a(i,this&&this[u]||u));return i}function a(r,i){return i?r?r+" "+i:r+i:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()}(R)),R.exports}var Mr=Er();const qr=Ar(Mr),Dr={"purpur-checkbox":"_purpur-checkbox_m4999_1","purpur-checkbox__box":"_purpur-checkbox__box_m4999_7","purpur-checkbox--error":"_purpur-checkbox--error_m4999_16","purpur-checkbox--error-checkbox":"_purpur-checkbox--error-checkbox_m4999_16","purpur-checkbox__indicator":"_purpur-checkbox__indicator_m4999_59","purpur-checkbox__label":"_purpur-checkbox__label_m4999_70","purpur-checkbox__wrapper":"_purpur-checkbox__wrapper_m4999_73","purpur-checkbox__container":"_purpur-checkbox__container_m4999_79"},S=qr.bind(Dr),zr=["indeterminate",!0,!1],x="purpur-checkbox",Wr=({["data-testid"]:e,checked:n,className:t,error:o=!1,errorText:a,label:r,onChange:i,...u},c)=>{const p=a&&!n,f=o&&!n;return l.jsxs("div",{className:S([t,`${x}__wrapper`]),children:[l.jsxs("div",{className:S([t,`${x}__container`]),children:[l.jsx(Pr,{...u,checked:n,className:S([x,{[`${x}--error`]:p,[`${x}--error-checkbox`]:f}]),"data-testid":e,onCheckedChange:i,ref:c,children:l.jsx("span",{className:S(`${x}__box`),children:l.jsx(Rr,{className:S(`${x}__indicator`),children:n==="indeterminate"?l.jsx(A,{"data-testid":e&&`${e}-checked-icon`,size:"xs",svg:Ze}):l.jsx(A,{"data-testid":e&&`${e}-indeterminate-icon`,size:"xs",svg:Ve})})})}),r&&l.jsx(ar,{htmlFor:u.id,"data-testid":e&&`${e}-label`,disabled:u.disabled,className:S(`${x}__label`),children:l.jsxs(ie,{variant:"paragraph-100",disabled:u.disabled,children:[u.required&&l.jsx("span",{"aria-hidden":!0,children:"* "}),r]})})]}),p&&l.jsx(Me,{"data-testid":e&&`${e}-error-text`,children:a})]})},ge=re.forwardRef(Wr);ge.displayName="Checkbox";exports.Checkbox=ge;exports.checkedState=zr;
|
|
25
|
+
*/var re;function vr(){return re||(re=1,function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",o=0;o<arguments.length;o++){var u=arguments[o];u&&(r=a(r,i(u)))}return r}function i(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var o="";for(var u in r)n.call(r,u)&&r[u]&&(o=a(o,u));return o}function a(r,o){return o?r?r+" "+o:r+o:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()}(ee)),ee.exports}var _r=vr();const br=gr(_r),C={"purpur-paragraph":"_purpur-paragraph_1rh57_1","purpur-paragraph--disabled":"_purpur-paragraph--disabled_1rh57_7","purpur-paragraph--hyphens":"_purpur-paragraph--hyphens_1rh57_10","purpur-paragraph--negative":"_purpur-paragraph--negative_1rh57_13","purpur-paragraph--paragraph-100":"_purpur-paragraph--paragraph-100_1rh57_16","purpur-paragraph--paragraph-100-medium":"_purpur-paragraph--paragraph-100-medium_1rh57_22","purpur-paragraph--paragraph-100-bold":"_purpur-paragraph--paragraph-100-bold_1rh57_29","purpur-paragraph--paragraph-200":"_purpur-paragraph--paragraph-200_1rh57_36","purpur-paragraph--preamble-100":"_purpur-paragraph--preamble-100_1rh57_42","purpur-paragraph--preamble-200":"_purpur-paragraph--preamble-200_1rh57_48","purpur-paragraph--additional-100":"_purpur-paragraph--additional-100_1rh57_54","purpur-paragraph--additional-100-medium":"_purpur-paragraph--additional-100-medium_1rh57_60","purpur-paragraph--overline-100":"_purpur-paragraph--overline-100_1rh57_67","purpur-paragraph--overline-200":"_purpur-paragraph--overline-200_1rh57_75"},xr={PARAGRAPH100:"paragraph-100"},N="purpur-paragraph",ce=({["data-testid"]:e,children:n,className:t,disabled:i,enableHyphenation:a=!1,negative:r=!1,variant:o=xr.PARAGRAPH100,...u})=>{const c=br([t,C[N],C[`${N}--${o}`],{[C[`${N}--hyphens`]]:a,[C[`${N}--disabled`]]:i,[C[`${N}--negative`]]:r}]);return l.jsx("p",{...u,className:c,"data-testid":e,children:n})};ce.displayName="Paragraph";function te(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function le(...e){return n=>{let t=!1;const i=e.map(a=>{const r=te(a,n);return!t&&typeof r=="function"&&(t=!0),r});if(t)return()=>{for(let a=0;a<i.length;a++){const r=i[a];typeof r=="function"?r():te(e[a],null)}}}}function pe(...e){return s.useCallback(le(...e),e)}function yr(e,n=[]){let t=[];function i(r,o){const u=s.createContext(o),c=t.length;t=[...t,o];const p=f=>{var b;const{scope:d,children:m,...g}=f,_=((b=d==null?void 0:d[e])==null?void 0:b[c])||u,$=s.useMemo(()=>g,Object.values(g));return l.jsx(_.Provider,{value:$,children:m})};p.displayName=r+"Provider";function h(f,d){var _;const m=((_=d==null?void 0:d[e])==null?void 0:_[c])||u,g=s.useContext(m);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${r}\``)}return[p,h]}const a=()=>{const r=t.map(o=>s.createContext(o));return function(u){const c=(u==null?void 0:u[e])||r;return s.useMemo(()=>({[`__scope${e}`]:{...u,[e]:c}}),[u,c])}};return a.scopeName=e,[i,wr(a,...n)]}function wr(...e){const n=e[0];if(e.length===1)return n;const t=()=>{const i=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(r){const o=i.reduce((u,{useScope:c,scopeName:p})=>{const f=c(r)[`__scope${p}`];return{...u,...f}},{});return s.useMemo(()=>({[`__scope${n.scopeName}`]:o}),[o])}};return t.scopeName=n.scopeName,t}function ne(e,n,{checkForDefaultPrevented:t=!0}={}){return function(a){if(e==null||e(a),t===!1||!a.defaultPrevented)return n==null?void 0:n(a)}}function de(e){const n=s.useRef(e);return s.useEffect(()=>{n.current=e}),s.useMemo(()=>(...t)=>{var i;return(i=n.current)==null?void 0:i.call(n,...t)},[])}function $r({prop:e,defaultProp:n,onChange:t=()=>{}}){const[i,a]=Sr({defaultProp:n,onChange:t}),r=e!==void 0,o=r?e:i,u=de(t),c=s.useCallback(p=>{if(r){const f=typeof p=="function"?p(e):p;f!==e&&u(f)}else a(p)},[r,e,a,u]);return[o,c]}function Sr({defaultProp:e,onChange:n}){const t=s.useState(e),[i]=t,a=s.useRef(i),r=de(n);return s.useEffect(()=>{a.current!==i&&(r(i),a.current=i)},[i,a,r]),t}function Cr(e){const n=s.useRef({value:e,previous:e});return s.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}var M=globalThis!=null&&globalThis.document?s.useLayoutEffect:()=>{};function Nr(e){const[n,t]=s.useState(void 0);return M(()=>{if(e){t({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const r=a[0];let o,u;if("borderBoxSize"in r){const c=r.borderBoxSize,p=Array.isArray(c)?c[0]:c;o=p.inlineSize,u=p.blockSize}else o=e.offsetWidth,u=e.offsetHeight;t({width:o,height:u})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else t(void 0)},[e]),n}function jr(e,n){return s.useReducer((t,i)=>n[t][i]??t,e)}var fe=e=>{const{present:n,children:t}=e,i=kr(n),a=typeof t=="function"?t({present:i.isPresent}):s.Children.only(t),r=pe(i.ref,Or(a));return typeof t=="function"||i.isPresent?s.cloneElement(a,{ref:r}):null};fe.displayName="Presence";function kr(e){const[n,t]=s.useState(),i=s.useRef({}),a=s.useRef(e),r=s.useRef("none"),o=e?"mounted":"unmounted",[u,c]=jr(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{const p=j(i.current);r.current=u==="mounted"?p:"none"},[u]),M(()=>{const p=i.current,h=a.current;if(h!==e){const d=r.current,m=j(p);e?c("MOUNT"):m==="none"||(p==null?void 0:p.display)==="none"?c("UNMOUNT"):c(h&&d!==m?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),M(()=>{if(n){let p;const h=n.ownerDocument.defaultView??window,f=m=>{const _=j(i.current).includes(m.animationName);if(m.target===n&&_&&(c("ANIMATION_END"),!a.current)){const $=n.style.animationFillMode;n.style.animationFillMode="forwards",p=h.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=$)})}},d=m=>{m.target===n&&(r.current=j(i.current))};return n.addEventListener("animationstart",d),n.addEventListener("animationcancel",f),n.addEventListener("animationend",f),()=>{h.clearTimeout(p),n.removeEventListener("animationstart",d),n.removeEventListener("animationcancel",f),n.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[n,c]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:s.useCallback(p=>{p&&(i.current=getComputedStyle(p)),t(p)},[])}}function j(e){return(e==null?void 0:e.animationName)||"none"}function Or(e){var i,a;let n=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,t=n&&"isReactWarning"in n&&n.isReactWarning;return t?e.ref:(n=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var he=s.forwardRef((e,n)=>{const{children:t,...i}=e,a=s.Children.toArray(t),r=a.find(Ar);if(r){const o=r.props.children,u=a.map(c=>c===r?s.Children.count(o)>1?s.Children.only(null):s.isValidElement(o)?o.props.children:null:c);return l.jsx(q,{...i,ref:n,children:s.isValidElement(o)?s.cloneElement(o,void 0,u):null})}return l.jsx(q,{...i,ref:n,children:t})});he.displayName="Slot";var q=s.forwardRef((e,n)=>{const{children:t,...i}=e;if(s.isValidElement(t)){const a=Er(t),r=Rr(i,t.props);return t.type!==s.Fragment&&(r.ref=n?le(n,a):a),s.cloneElement(t,r)}return s.Children.count(t)>1?s.Children.only(null):null});q.displayName="SlotClone";var Pr=({children:e})=>l.jsx(l.Fragment,{children:e});function Ar(e){return s.isValidElement(e)&&e.type===Pr}function Rr(e,n){const t={...n};for(const i in n){const a=e[i],r=n[i];/^on[A-Z]/.test(i)?a&&r?t[i]=(...u)=>{r(...u),a(...u)}:a&&(t[i]=a):i==="style"?t[i]={...a,...r}:i==="className"&&(t[i]=[a,r].filter(Boolean).join(" "))}return{...e,...t}}function Er(e){var i,a;let n=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,t=n&&"isReactWarning"in n&&n.isReactWarning;return t?e.ref:(n=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var Mr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],me=Mr.reduce((e,n)=>{const t=s.forwardRef((i,a)=>{const{asChild:r,...o}=i,u=r?he:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(u,{...o,ref:a})});return t.displayName=`Primitive.${n}`,{...e,[n]:t}},{}),D="Checkbox",[qr,Kr]=yr(D),[Dr,zr]=qr(D),ge=s.forwardRef((e,n)=>{const{__scopeCheckbox:t,name:i,checked:a,defaultChecked:r,required:o,disabled:u,value:c="on",onCheckedChange:p,form:h,...f}=e,[d,m]=s.useState(null),g=pe(n,v=>m(v)),_=s.useRef(!1),$=d?h||!!d.closest("form"):!0,[b=!1,k]=$r({prop:a,defaultProp:r,onChange:p}),ye=s.useRef(b);return s.useEffect(()=>{const v=d==null?void 0:d.form;if(v){const S=()=>k(ye.current);return v.addEventListener("reset",S),()=>v.removeEventListener("reset",S)}},[d,k]),l.jsxs(Dr,{scope:t,state:b,disabled:u,children:[l.jsx(me.button,{type:"button",role:"checkbox","aria-checked":y(b)?"mixed":b,"aria-required":o,"data-state":be(b),"data-disabled":u?"":void 0,disabled:u,value:c,...f,ref:g,onKeyDown:ne(e.onKeyDown,v=>{v.key==="Enter"&&v.preventDefault()}),onClick:ne(e.onClick,v=>{k(S=>y(S)?!0:!S),$&&(_.current=v.isPropagationStopped(),_.current||v.stopPropagation())})}),$&&l.jsx(Wr,{control:d,bubbles:!_.current,name:i,value:c,checked:b,required:o,disabled:u,form:h,style:{transform:"translateX(-100%)"},defaultChecked:y(r)?!1:r})]})});ge.displayName=D;var ve="CheckboxIndicator",_e=s.forwardRef((e,n)=>{const{__scopeCheckbox:t,forceMount:i,...a}=e,r=zr(ve,t);return l.jsx(fe,{present:i||y(r.state)||r.state===!0,children:l.jsx(me.span,{"data-state":be(r.state),"data-disabled":r.disabled?"":void 0,...a,ref:n,style:{pointerEvents:"none",...e.style}})})});_e.displayName=ve;var Wr=e=>{const{control:n,checked:t,bubbles:i=!0,defaultChecked:a,...r}=e,o=s.useRef(null),u=Cr(t),c=Nr(n);s.useEffect(()=>{const h=o.current,f=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(f,"checked").set;if(u!==t&&m){const g=new Event("click",{bubbles:i});h.indeterminate=y(t),m.call(h,y(t)?!1:t),h.dispatchEvent(g)}},[u,t,i]);const p=s.useRef(y(t)?!1:t);return l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a??p.current,...r,tabIndex:-1,ref:o,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function y(e){return e==="indeterminate"}function be(e){return y(e)?"indeterminate":e?"checked":"unchecked"}var Br=ge,Ir=_e;function Lr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var A={exports:{}};/*!
|
|
26
|
+
Copyright (c) 2018 Jed Watson.
|
|
27
|
+
Licensed under the MIT License (MIT), see
|
|
28
|
+
http://jedwatson.github.io/classnames
|
|
29
|
+
*/var oe;function Ur(){return oe||(oe=1,function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",o=0;o<arguments.length;o++){var u=arguments[o];u&&(r=a(r,i.call(this,u)))}return r}function i(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var o="";for(var u in r)n.call(r,u)&&r[u]&&(o=a(o,this&&this[u]||u));return o}function a(r,o){return o?r?r+" "+o:r+o:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()}(A)),A.exports}var Fr=Ur();const Tr=Lr(Fr),Vr={"purpur-checkbox":"_purpur-checkbox_150ck_1","purpur-checkbox__box":"_purpur-checkbox__box_150ck_7","purpur-checkbox--error":"_purpur-checkbox--error_150ck_16","purpur-checkbox--error-checkbox":"_purpur-checkbox--error-checkbox_150ck_16","purpur-checkbox__indicator":"_purpur-checkbox__indicator_150ck_59","purpur-checkbox__label-container":"_purpur-checkbox__label-container_150ck_70","purpur-checkbox__wrapper":"_purpur-checkbox__wrapper_150ck_76","purpur-checkbox__container":"_purpur-checkbox__container_150ck_82"},w=Tr.bind(Vr),Zr=["indeterminate",!0,!1],x="purpur-checkbox",Hr=({["data-testid"]:e,checked:n,className:t,error:i=!1,errorText:a,label:r,helperText:o,onChange:u,...c},p)=>{const h=a&&!n,f=i&&!n;return l.jsxs("div",{className:w([t,`${x}__wrapper`]),children:[l.jsxs("div",{className:w([t,`${x}__container`]),children:[l.jsx(Br,{...c,checked:n,className:w([x,{[`${x}--error`]:h,[`${x}--error-checkbox`]:f}]),"data-testid":e,onCheckedChange:u,ref:p,children:l.jsx("span",{className:w(`${x}__box`),children:l.jsx(Ir,{className:w(`${x}__indicator`),children:n==="indeterminate"?l.jsx(R,{"data-testid":e&&`${e}-checked-icon`,size:"xs",svg:rr}):l.jsx(R,{"data-testid":e&&`${e}-indeterminate-icon`,size:"xs",svg:er})})})}),l.jsxs("span",{className:w(`${x}__label-container`),children:[r&&l.jsx(mr,{htmlFor:c.id,"data-testid":e&&`${e}-label`,disabled:c.disabled,children:l.jsxs(ce,{variant:"paragraph-100",disabled:c.disabled,children:[c.required&&l.jsx("span",{"aria-hidden":!0,children:"* "}),r]})}),o&&l.jsx(Fe,{className:w(`${x}__helper`),"data-testid":e&&`${e}-helper-text`,disabled:c.disabled,id:`${c.id}-helper-text`,children:o})]})]}),h&&l.jsx(We,{"data-testid":e&&`${e}-error-text`,children:a})]})},xe=ie.forwardRef(Hr);xe.displayName="Checkbox";exports.Checkbox=xe;exports.checkedState=Zr;
|
|
26
30
|
//# sourceMappingURL=checkbox.cjs.js.map
|