@purpurds/checkbox 3.0.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 +204 -0
- package/dist/checkbox.cjs.js +26 -0
- package/dist/checkbox.cjs.js.map +1 -0
- package/dist/checkbox.d.ts +56 -0
- package/dist/checkbox.d.ts.map +1 -0
- package/dist/checkbox.es.js +1063 -0
- package/dist/checkbox.es.js.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +65 -0
- package/readme.mdx +168 -0
- package/src/checkbox.module.scss +125 -0
- package/src/checkbox.stories.tsx +93 -0
- package/src/checkbox.test.tsx +78 -0
- package/src/checkbox.tsx +135 -0
- package/src/global.d.ts +4 -0
package/dist/LICENSE.txt
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Name: @purpurds/field-error-text
|
|
2
|
+
Version: 2.8.0
|
|
3
|
+
License: AGPL-3.0-only
|
|
4
|
+
Private: false
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Name: @purpurds/icon
|
|
9
|
+
Version: 2.8.0
|
|
10
|
+
License: AGPL-3.0-only
|
|
11
|
+
Private: false
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
Name: @purpurds/label
|
|
16
|
+
Version: 2.8.0
|
|
17
|
+
License: AGPL-3.0-only
|
|
18
|
+
Private: false
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
Name: @purpurds/paragraph
|
|
23
|
+
Version: 2.8.0
|
|
24
|
+
License: AGPL-3.0-only
|
|
25
|
+
Private: false
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
Name: @babel/runtime
|
|
30
|
+
Version: 7.22.15
|
|
31
|
+
License: MIT
|
|
32
|
+
Private: false
|
|
33
|
+
Description: babel's modular runtime helpers
|
|
34
|
+
Repository: https://github.com/babel/babel.git
|
|
35
|
+
Homepage: https://babel.dev/docs/en/next/babel-runtime
|
|
36
|
+
Author: The Babel Team (https://babel.dev/team)
|
|
37
|
+
License Copyright:
|
|
38
|
+
===
|
|
39
|
+
|
|
40
|
+
MIT License
|
|
41
|
+
|
|
42
|
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
|
43
|
+
|
|
44
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
45
|
+
a copy of this software and associated documentation files (the
|
|
46
|
+
"Software"), to deal in the Software without restriction, including
|
|
47
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
48
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
49
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
50
|
+
the following conditions:
|
|
51
|
+
|
|
52
|
+
The above copyright notice and this permission notice shall be
|
|
53
|
+
included in all copies or substantial portions of the Software.
|
|
54
|
+
|
|
55
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
56
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
57
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
58
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
59
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
60
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
61
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
Name: @radix-ui/react-compose-refs
|
|
67
|
+
Version: 1.0.1
|
|
68
|
+
License: MIT
|
|
69
|
+
Private: false
|
|
70
|
+
Repository: git+https://github.com/radix-ui/primitives.git
|
|
71
|
+
Homepage: https://radix-ui.com/primitives
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
Name: @radix-ui/react-context
|
|
76
|
+
Version: 1.0.1
|
|
77
|
+
License: MIT
|
|
78
|
+
Private: false
|
|
79
|
+
Repository: git+https://github.com/radix-ui/primitives.git
|
|
80
|
+
Homepage: https://radix-ui.com/primitives
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
Name: @radix-ui/primitive
|
|
85
|
+
Version: 1.0.1
|
|
86
|
+
License: MIT
|
|
87
|
+
Private: false
|
|
88
|
+
Repository: git+https://github.com/radix-ui/primitives.git
|
|
89
|
+
Homepage: https://radix-ui.com/primitives
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
Name: @radix-ui/react-use-callback-ref
|
|
94
|
+
Version: 1.0.1
|
|
95
|
+
License: MIT
|
|
96
|
+
Private: false
|
|
97
|
+
Repository: git+https://github.com/radix-ui/primitives.git
|
|
98
|
+
Homepage: https://radix-ui.com/primitives
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
Name: @radix-ui/react-use-controllable-state
|
|
103
|
+
Version: 1.0.1
|
|
104
|
+
License: MIT
|
|
105
|
+
Private: false
|
|
106
|
+
Repository: git+https://github.com/radix-ui/primitives.git
|
|
107
|
+
Homepage: https://radix-ui.com/primitives
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
Name: @radix-ui/react-use-previous
|
|
112
|
+
Version: 1.0.1
|
|
113
|
+
License: MIT
|
|
114
|
+
Private: false
|
|
115
|
+
Repository: git+https://github.com/radix-ui/primitives.git
|
|
116
|
+
Homepage: https://radix-ui.com/primitives
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
Name: @radix-ui/react-use-layout-effect
|
|
121
|
+
Version: 1.0.1
|
|
122
|
+
License: MIT
|
|
123
|
+
Private: false
|
|
124
|
+
Repository: git+https://github.com/radix-ui/primitives.git
|
|
125
|
+
Homepage: https://radix-ui.com/primitives
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
Name: @radix-ui/react-use-size
|
|
130
|
+
Version: 1.0.1
|
|
131
|
+
License: MIT
|
|
132
|
+
Private: false
|
|
133
|
+
Repository: git+https://github.com/radix-ui/primitives.git
|
|
134
|
+
Homepage: https://radix-ui.com/primitives
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
Name: @radix-ui/react-presence
|
|
139
|
+
Version: 1.0.1
|
|
140
|
+
License: MIT
|
|
141
|
+
Private: false
|
|
142
|
+
Repository: git+https://github.com/radix-ui/primitives.git
|
|
143
|
+
Homepage: https://radix-ui.com/primitives
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
Name: @radix-ui/react-slot
|
|
148
|
+
Version: 1.0.2
|
|
149
|
+
License: MIT
|
|
150
|
+
Private: false
|
|
151
|
+
Repository: git+https://github.com/radix-ui/primitives.git
|
|
152
|
+
Homepage: https://radix-ui.com/primitives
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
Name: @radix-ui/react-primitive
|
|
157
|
+
Version: 1.0.3
|
|
158
|
+
License: MIT
|
|
159
|
+
Private: false
|
|
160
|
+
Repository: git+https://github.com/radix-ui/primitives.git
|
|
161
|
+
Homepage: https://radix-ui.com/primitives
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
Name: @radix-ui/react-checkbox
|
|
166
|
+
Version: 1.0.4
|
|
167
|
+
License: MIT
|
|
168
|
+
Private: false
|
|
169
|
+
Repository: git+https://github.com/radix-ui/primitives.git
|
|
170
|
+
Homepage: https://radix-ui.com/primitives
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
Name: classnames
|
|
175
|
+
Version: 2.5.1
|
|
176
|
+
License: MIT
|
|
177
|
+
Private: false
|
|
178
|
+
Description: A simple utility for conditionally joining classNames together
|
|
179
|
+
Repository: git+https://github.com/JedWatson/classnames.git
|
|
180
|
+
Author: Jed Watson
|
|
181
|
+
License Copyright:
|
|
182
|
+
===
|
|
183
|
+
|
|
184
|
+
The MIT License (MIT)
|
|
185
|
+
|
|
186
|
+
Copyright (c) 2018 Jed Watson
|
|
187
|
+
|
|
188
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
189
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
190
|
+
in the Software without restriction, including without limitation the rights
|
|
191
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
192
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
193
|
+
furnished to do so, subject to the following conditions:
|
|
194
|
+
|
|
195
|
+
The above copyright notice and this permission notice shall be included in all
|
|
196
|
+
copies or substantial portions of the Software.
|
|
197
|
+
|
|
198
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
199
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
200
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
201
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
202
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
203
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
204
|
+
SOFTWARE.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),c=require("react"),ie=require("react-dom");function ce(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var H={exports:{}};/*!
|
|
2
|
+
Copyright (c) 2018 Jed Watson.
|
|
3
|
+
Licensed under the MIT License (MIT), see
|
|
4
|
+
http://jedwatson.github.io/classnames
|
|
5
|
+
*/(function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",o=0;o<arguments.length;o++){var i=arguments[o];i&&(r=u(r,a.call(this,i)))}return r}function a(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 i in r)n.call(r,i)&&r[i]&&(o=u(o,this&&this[i]||i));return o}function u(r,o){return o?r?r+" "+o:r+o:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()})(H);var se=H.exports;const le=ce(se),pe={"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"},de={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"},fe=le.bind(pe),D="purpur-icon",he="md",me=e=>e.filter(n=>Object.keys(n).length>=1).map(n=>`${n.name}="${n.value}"`).join(" "),ve=({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"}],a=n?`<title>${n}</title>`:"";return`<svg ${me(t)}>${a}${e}</svg>`},be=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),ge=({["data-testid"]:e,svg:n,allyTitle:t,className:a="",size:u=he,...r})=>{const o=ve({content:be(n.svg),title:t}),i=fe(a,D,`${D}--${u}`);return d.jsx("span",{"aria-label":t,className:i,"data-testid":e,dangerouslySetInnerHTML:{__html:o},...r})};function _e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var F={exports:{}};/*!
|
|
6
|
+
Copyright (c) 2018 Jed Watson.
|
|
7
|
+
Licensed under the MIT License (MIT), see
|
|
8
|
+
http://jedwatson.github.io/classnames
|
|
9
|
+
*/(function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",o=0;o<arguments.length;o++){var i=arguments[o];i&&(r=u(r,a(i)))}return r}function a(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 i in r)n.call(r,i)&&r[i]&&(o=u(o,i));return o}function u(r,o){return o?r?r+" "+o:r+o:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()})(F);var $e=F.exports;const xe=_e($e),I={"purpur-field-error-text":"_purpur-field-error-text_1h4gy_1","purpur-field-error-text__icon":"_purpur-field-error-text__icon_1h4gy_12"},B="purpur-field-error-text",ye=({["data-testid"]:e,children:n,className:t,relevant:a="additions text",...u})=>d.jsxs("div",{className:xe([t,I[B]]),"data-testid":e,"aria-live":"assertive","aria-relevant":a,...u,children:[d.jsx(ge,{svg:de,size:"xs",className:I[`${B}__icon`]}),n]});function we(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z={exports:{}};/*!
|
|
10
|
+
Copyright (c) 2018 Jed Watson.
|
|
11
|
+
Licensed under the MIT License (MIT), see
|
|
12
|
+
http://jedwatson.github.io/classnames
|
|
13
|
+
*/(function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",o=0;o<arguments.length;o++){var i=arguments[o];i&&(r=u(r,a.call(this,i)))}return r}function a(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 i in r)n.call(r,i)&&r[i]&&(o=u(o,this&&this[i]||i));return o}function u(r,o){return o?r?r+" "+o:r+o:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()})(Z);var Ce=Z.exports;const Ne=we(Ce),Se={"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"},Ee={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"},je={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"},Oe=Ne.bind(Se),L="purpur-icon",Ae="md",Pe=e=>e.filter(n=>Object.keys(n).length>=1).map(n=>`${n.name}="${n.value}"`).join(" "),ke=({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"}],a=n?`<title>${n}</title>`:"";return`<svg ${Pe(t)}>${a}${e}</svg>`},Re=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),z=({["data-testid"]:e,svg:n,allyTitle:t,className:a="",size:u=Ae,...r})=>{const o=ke({content:Re(n.svg),title:t}),i=Oe(a,L,`${L}--${u}`);return d.jsx("span",{"aria-label":t,className:i,"data-testid":e,dangerouslySetInnerHTML:{__html:o},...r})};function k(){return k=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},k.apply(this,arguments)}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},w.apply(this,arguments)}function Me(e,n){typeof e=="function"?e(n):e!=null&&(e.current=n)}function qe(...e){return n=>e.forEach(t=>Me(t,n))}const G=c.forwardRef((e,n)=>{const{children:t,...a}=e,u=c.Children.toArray(t),r=u.find(Ie);if(r){const o=r.props.children,i=u.map(s=>s===r?c.Children.count(o)>1?c.Children.only(null):c.isValidElement(o)?o.props.children:null:s);return c.createElement(R,w({},a,{ref:n}),c.isValidElement(o)?c.cloneElement(o,void 0,i):null)}return c.createElement(R,w({},a,{ref:n}),t)});G.displayName="Slot";const R=c.forwardRef((e,n)=>{const{children:t,...a}=e;return c.isValidElement(t)?c.cloneElement(t,{...Be(a,t.props),ref:n?qe(n,t.ref):t.ref}):c.Children.count(t)>1?c.Children.only(null):null});R.displayName="SlotClone";const De=({children:e})=>c.createElement(c.Fragment,null,e);function Ie(e){return c.isValidElement(e)&&e.type===De}function Be(e,n){const t={...n};for(const a in n){const u=e[a],r=n[a];/^on[A-Z]/.test(a)?u&&r?t[a]=(...o)=>{r(...o),u(...o)}:u&&(t[a]=u):a==="style"?t[a]={...u,...r}:a==="className"&&(t[a]=[u,r].filter(Boolean).join(" "))}return{...e,...t}}const Le=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ze=Le.reduce((e,n)=>{const t=c.forwardRef((a,u)=>{const{asChild:r,...o}=a,i=r?G:n;return c.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),c.createElement(i,w({},o,{ref:u}))});return t.displayName=`Primitive.${n}`,{...e,[n]:t}},{}),Te=c.forwardRef((e,n)=>c.createElement(ze.label,k({},e,{ref:n,onMouseDown:t=>{var a;(a=e.onMouseDown)===null||a===void 0||a.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault()}}))),Ue=Te;function Ve(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var K={exports:{}};/*!
|
|
14
|
+
Copyright (c) 2018 Jed Watson.
|
|
15
|
+
Licensed under the MIT License (MIT), see
|
|
16
|
+
http://jedwatson.github.io/classnames
|
|
17
|
+
*/(function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",o=0;o<arguments.length;o++){var i=arguments[o];i&&(r=u(r,a(i)))}return r}function a(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 i in r)n.call(r,i)&&r[i]&&(o=u(o,i));return o}function u(r,o){return o?r?r+" "+o:r+o:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()})(K);var He=K.exports;const Fe=Ve(He),T={"purpur-label":"_purpur-label_1jub8_1","purpur-label--disabled":"_purpur-label--disabled_1jub8_9"},U="purpur-label",Ze=({children:e,className:n,htmlFor:t,"data-testid":a,disabled:u,...r})=>{const o=Fe([n,T[U],{[T[`${U}--disabled`]]:u}]);return d.jsx(Ue,{className:o,"data-testid":a,htmlFor:t,...r,children:e})};function Ge(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W={exports:{}};/*!
|
|
18
|
+
Copyright (c) 2018 Jed Watson.
|
|
19
|
+
Licensed under the MIT License (MIT), see
|
|
20
|
+
http://jedwatson.github.io/classnames
|
|
21
|
+
*/(function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",o=0;o<arguments.length;o++){var i=arguments[o];i&&(r=u(r,a(i)))}return r}function a(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 i in r)n.call(r,i)&&r[i]&&(o=u(o,i));return o}function u(r,o){return o?r?r+" "+o:r+o:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()})(W);var Ke=W.exports;const We=Ge(Ke),E={"purpur-paragraph":"_purpur-paragraph_hwaj6_1","purpur-paragraph--disabled":"_purpur-paragraph--disabled_hwaj6_7","purpur-paragraph--hyphens":"_purpur-paragraph--hyphens_hwaj6_10","purpur-paragraph--paragraph-100":"_purpur-paragraph--paragraph-100_hwaj6_13","purpur-paragraph--paragraph-100-medium":"_purpur-paragraph--paragraph-100-medium_hwaj6_19","purpur-paragraph--paragraph-100-bold":"_purpur-paragraph--paragraph-100-bold_hwaj6_26","purpur-paragraph--paragraph-200":"_purpur-paragraph--paragraph-200_hwaj6_33","purpur-paragraph--preamble-100":"_purpur-paragraph--preamble-100_hwaj6_39","purpur-paragraph--preamble-200":"_purpur-paragraph--preamble-200_hwaj6_45","purpur-paragraph--additional-100":"_purpur-paragraph--additional-100_hwaj6_51","purpur-paragraph--additional-100-medium":"_purpur-paragraph--additional-100-medium_hwaj6_57","purpur-paragraph--overline-100":"_purpur-paragraph--overline-100_hwaj6_64","purpur-paragraph--overline-200":"_purpur-paragraph--overline-200_hwaj6_71"},Xe={PARAGRAPH100:"paragraph-100",PARAGRAPH100MEDIUM:"paragraph-100-medium",PARAGRAPH100BOLD:"paragraph-100-bold",PARAGRAPH200:"paragraph-200",PREAMBLE100:"preamble-100",PREAMBLE200:"preamble-200",ADDITIONAL100:"additional-100",ADDITIONAL100MEDIUM:"additional-100-medium",OVERLINE100:"overline-100",OVERLINE200:"overline-200"},j="purpur-paragraph",Je=({["data-testid"]:e,children:n,className:t="",disabled:a,enableHyphenation:u=!1,variant:r=Xe.PARAGRAPH100,...o})=>{const i=We([t,E[j],E[`${j}--${r}`],{[E[`${j}--hyphens`]]:u,[E[`${j}--disabled`]]:a}]);return d.jsx("p",{...o,className:i,"data-testid":e,children:n})};function C(){return C=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},C.apply(this,arguments)}function Qe(e,n){typeof e=="function"?e(n):e!=null&&(e.current=n)}function X(...e){return n=>e.forEach(t=>Qe(t,n))}function J(...e){return c.useCallback(X(...e),e)}function Ye(e,n=[]){let t=[];function a(r,o){const i=c.createContext(o),s=t.length;t=[...t,o];function l(p){const{scope:f,children:v,...b}=p,S=(f==null?void 0:f[e][s])||i,g=c.useMemo(()=>b,Object.values(b));return c.createElement(S.Provider,{value:g},v)}function h(p,f){const v=(f==null?void 0:f[e][s])||i,b=c.useContext(v);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${p}\` must be used within \`${r}\``)}return l.displayName=r+"Provider",[l,h]}const u=()=>{const r=t.map(o=>c.createContext(o));return function(i){const s=(i==null?void 0:i[e])||r;return c.useMemo(()=>({[`__scope${e}`]:{...i,[e]:s}}),[i,s])}};return u.scopeName=e,[a,er(u,...n)]}function er(...e){const n=e[0];if(e.length===1)return n;const t=()=>{const a=e.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(r){const o=a.reduce((i,{useScope:s,scopeName:l})=>{const p=s(r)[`__scope${l}`];return{...i,...p}},{});return c.useMemo(()=>({[`__scope${n.scopeName}`]:o}),[o])}};return t.scopeName=n.scopeName,t}function V(e,n,{checkForDefaultPrevented:t=!0}={}){return function(u){if(e==null||e(u),t===!1||!u.defaultPrevented)return n==null?void 0:n(u)}}function Q(e){const n=c.useRef(e);return c.useEffect(()=>{n.current=e}),c.useMemo(()=>(...t)=>{var a;return(a=n.current)===null||a===void 0?void 0:a.call(n,...t)},[])}function rr({prop:e,defaultProp:n,onChange:t=()=>{}}){const[a,u]=tr({defaultProp:n,onChange:t}),r=e!==void 0,o=r?e:a,i=Q(t),s=c.useCallback(l=>{if(r){const p=typeof l=="function"?l(e):l;p!==e&&i(p)}else u(l)},[r,e,u,i]);return[o,s]}function tr({defaultProp:e,onChange:n}){const t=c.useState(e),[a]=t,u=c.useRef(a),r=Q(n);return c.useEffect(()=>{u.current!==a&&(r(a),u.current=a)},[a,u,r]),t}function nr(e){const n=c.useRef({value:e,previous:e});return c.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}const M=globalThis!=null&&globalThis.document?c.useLayoutEffect:()=>{};function or(e){const[n,t]=c.useState(void 0);return M(()=>{if(e){t({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const r=u[0];let o,i;if("borderBoxSize"in r){const s=r.borderBoxSize,l=Array.isArray(s)?s[0]:s;o=l.inlineSize,i=l.blockSize}else o=e.offsetWidth,i=e.offsetHeight;t({width:o,height:i})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}else t(void 0)},[e]),n}function ar(e,n){return c.useReducer((t,a)=>{const u=n[t][a];return u??t},e)}const Y=e=>{const{present:n,children:t}=e,a=ur(n),u=typeof t=="function"?t({present:a.isPresent}):c.Children.only(t),r=J(a.ref,u.ref);return typeof t=="function"||a.isPresent?c.cloneElement(u,{ref:r}):null};Y.displayName="Presence";function ur(e){const[n,t]=c.useState(),a=c.useRef({}),u=c.useRef(e),r=c.useRef("none"),o=e?"mounted":"unmounted",[i,s]=ar(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return c.useEffect(()=>{const l=O(a.current);r.current=i==="mounted"?l:"none"},[i]),M(()=>{const l=a.current,h=u.current;if(h!==e){const f=r.current,v=O(l);e?s("MOUNT"):v==="none"||(l==null?void 0:l.display)==="none"?s("UNMOUNT"):s(h&&f!==v?"ANIMATION_OUT":"UNMOUNT"),u.current=e}},[e,s]),M(()=>{if(n){const l=p=>{const v=O(a.current).includes(p.animationName);p.target===n&&v&&ie.flushSync(()=>s("ANIMATION_END"))},h=p=>{p.target===n&&(r.current=O(a.current))};return n.addEventListener("animationstart",h),n.addEventListener("animationcancel",l),n.addEventListener("animationend",l),()=>{n.removeEventListener("animationstart",h),n.removeEventListener("animationcancel",l),n.removeEventListener("animationend",l)}}else s("ANIMATION_END")},[n,s]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:c.useCallback(l=>{l&&(a.current=getComputedStyle(l)),t(l)},[])}}function O(e){return(e==null?void 0:e.animationName)||"none"}function N(){return N=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},N.apply(this,arguments)}const ee=c.forwardRef((e,n)=>{const{children:t,...a}=e,u=c.Children.toArray(t),r=u.find(cr);if(r){const o=r.props.children,i=u.map(s=>s===r?c.Children.count(o)>1?c.Children.only(null):c.isValidElement(o)?o.props.children:null:s);return c.createElement(q,N({},a,{ref:n}),c.isValidElement(o)?c.cloneElement(o,void 0,i):null)}return c.createElement(q,N({},a,{ref:n}),t)});ee.displayName="Slot";const q=c.forwardRef((e,n)=>{const{children:t,...a}=e;return c.isValidElement(t)?c.cloneElement(t,{...sr(a,t.props),ref:n?X(n,t.ref):t.ref}):c.Children.count(t)>1?c.Children.only(null):null});q.displayName="SlotClone";const ir=({children:e})=>c.createElement(c.Fragment,null,e);function cr(e){return c.isValidElement(e)&&e.type===ir}function sr(e,n){const t={...n};for(const a in n){const u=e[a],r=n[a];/^on[A-Z]/.test(a)?u&&r?t[a]=(...i)=>{r(...i),u(...i)}:u&&(t[a]=u):a==="style"?t[a]={...u,...r}:a==="className"&&(t[a]=[u,r].filter(Boolean).join(" "))}return{...e,...t}}const lr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],re=lr.reduce((e,n)=>{const t=c.forwardRef((a,u)=>{const{asChild:r,...o}=a,i=r?ee:n;return c.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),c.createElement(i,N({},o,{ref:u}))});return t.displayName=`Primitive.${n}`,{...e,[n]:t}},{}),te="Checkbox",[pr,wr]=Ye(te),[dr,fr]=pr(te),hr=c.forwardRef((e,n)=>{const{__scopeCheckbox:t,name:a,checked:u,defaultChecked:r,required:o,disabled:i,value:s="on",onCheckedChange:l,...h}=e,[p,f]=c.useState(null),v=J(n,m=>f(m)),b=c.useRef(!1),S=p?!!p.closest("form"):!0,[g=!1,A]=rr({prop:u,defaultProp:r,onChange:l}),ue=c.useRef(g);return c.useEffect(()=>{const m=p==null?void 0:p.form;if(m){const y=()=>A(ue.current);return m.addEventListener("reset",y),()=>m.removeEventListener("reset",y)}},[p,A]),c.createElement(dr,{scope:t,state:g,disabled:i},c.createElement(re.button,C({type:"button",role:"checkbox","aria-checked":x(g)?"mixed":g,"aria-required":o,"data-state":ne(g),"data-disabled":i?"":void 0,disabled:i,value:s},h,{ref:v,onKeyDown:V(e.onKeyDown,m=>{m.key==="Enter"&&m.preventDefault()}),onClick:V(e.onClick,m=>{A(y=>x(y)?!0:!y),S&&(b.current=m.isPropagationStopped(),b.current||m.stopPropagation())})})),S&&c.createElement(br,{control:p,bubbles:!b.current,name:a,value:s,checked:g,required:o,disabled:i,style:{transform:"translateX(-100%)"}}))}),mr="CheckboxIndicator",vr=c.forwardRef((e,n)=>{const{__scopeCheckbox:t,forceMount:a,...u}=e,r=fr(mr,t);return c.createElement(Y,{present:a||x(r.state)||r.state===!0},c.createElement(re.span,C({"data-state":ne(r.state),"data-disabled":r.disabled?"":void 0},u,{ref:n,style:{pointerEvents:"none",...e.style}})))}),br=e=>{const{control:n,checked:t,bubbles:a=!0,...u}=e,r=c.useRef(null),o=nr(t),i=or(n);return c.useEffect(()=>{const s=r.current,l=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(l,"checked").set;if(o!==t&&p){const f=new Event("click",{bubbles:a});s.indeterminate=x(t),p.call(s,x(t)?!1:t),s.dispatchEvent(f)}},[o,t,a]),c.createElement("input",C({type:"checkbox","aria-hidden":!0,defaultChecked:x(t)?!1:t},u,{tabIndex:-1,ref:r,style:{...e.style,...i,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function x(e){return e==="indeterminate"}function ne(e){return x(e)?"indeterminate":e?"checked":"unchecked"}const gr=hr,_r=vr;function $r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oe={exports:{}};/*!
|
|
22
|
+
Copyright (c) 2018 Jed Watson.
|
|
23
|
+
Licensed under the MIT License (MIT), see
|
|
24
|
+
http://jedwatson.github.io/classnames
|
|
25
|
+
*/(function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",o=0;o<arguments.length;o++){var i=arguments[o];i&&(r=u(r,a(i)))}return r}function a(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 i in r)n.call(r,i)&&r[i]&&(o=u(o,i));return o}function u(r,o){return o?r?r+" "+o:r+o:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()})(oe);var xr=oe.exports;const P=$r(xr),_={"purpur-checkbox":"_purpur-checkbox_10fl8_1","purpur-checkbox__box":"_purpur-checkbox__box_10fl8_7","purpur-checkbox--error":"_purpur-checkbox--error_10fl8_16","purpur-checkbox__indicator":"_purpur-checkbox__indicator_10fl8_59","purpur-checkbox__label":"_purpur-checkbox__label_10fl8_70","purpur-checkbox__wrapper":"_purpur-checkbox__wrapper_10fl8_73","purpur-checkbox__container":"_purpur-checkbox__container_10fl8_79"},$="purpur-checkbox",yr=({["data-testid"]:e,checked:n,className:t,errorText:a,label:u,onChange:r,...o},i)=>{const s=a&&!n;return d.jsxs("div",{className:P([t,_[`${$}__wrapper`]]),children:[d.jsxs("div",{className:P([t,_[`${$}__container`]]),children:[d.jsx(gr,{...o,checked:n,className:P(_[$],{[_[`${$}--error`]]:s}),"data-testid":e,onCheckedChange:r,ref:i,children:d.jsx("span",{className:_[`${$}__box`],children:d.jsx(_r,{className:_[`${$}__indicator`],children:n==="indeterminate"?d.jsx(z,{"data-testid":e&&`${e}-checked-icon`,size:"xs",svg:je}):d.jsx(z,{"data-testid":e&&`${e}-indeterminate-icon`,size:"xs",svg:Ee})})})}),u&&d.jsx(Ze,{htmlFor:o.id,"data-testid":e&&`${e}-label`,disabled:o.disabled,className:_[`${$}__label`],children:d.jsx(Je,{variant:"paragraph-100",disabled:o.disabled,children:`${o.required?"* ":""}${u}`})})]}),s&&d.jsx(ye,{"data-testid":e&&`${e}-error-text`,children:a})]})},ae=c.forwardRef(yr);ae.displayName="Checkbox";exports.Checkbox=ae;
|
|
26
|
+
//# sourceMappingURL=checkbox.cjs.js.map
|