@sakura-ui/forms 0.4.0-beta.0 → 0.4.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/index.cjs.js +23 -39
- package/dist/index.es.js +193 -213
- package/package.json +6 -6
package/dist/index.cjs.js
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var G;function ye(){if(G)return k;G=1;var r=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function c(n,o,s){var a=null;if(s!==void 0&&(a=""+s),o.key!==void 0&&(a=""+o.key),"key"in o){s={};for(var u in o)u!=="key"&&(s[u]=o[u])}else s=o;return o=s.ref,{$$typeof:r,type:n,key:a,ref:o!==void 0?o:null,props:s}}return k.Fragment=i,k.jsx=c,k.jsxs=c,k}var w={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var J;function Re(){return J||(J=1,process.env.NODE_ENV!=="production"&&function(){function r(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ge?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case P:return"Fragment";case de:return"Profiler";case ne:return"StrictMode";case be:return"Suspense";case pe:return"SuspenseList";case me:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case ie:return"Portal";case ue:return(e.displayName||"Context")+".Provider";case ce:return(e._context.displayName||"Context")+".Consumer";case fe:var l=e.render;return e=e.displayName,e||(e=l.displayName||l.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case xe:return l=e.displayName||null,l!==null?l:r(e.type)||"Memo";case Y:l=e._payload,e=e._init;try{return r(e(l))}catch{}}return null}function i(e){return""+e}function c(e){try{i(e);var l=!1}catch{l=!0}if(l){l=console;var b=l.error,m=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return b.call(l,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",m),i(e)}}function n(e){if(e===P)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===Y)return"<...>";try{var l=r(e);return l?"<"+l+">":"<...>"}catch{return"<...>"}}function o(){var e=S.A;return e===null?null:e.getOwner()}function s(){return Error("react-stack-top-frame")}function a(e){if(z.call(e,"key")){var l=Object.getOwnPropertyDescriptor(e,"key").get;if(l&&l.isReactWarning)return!1}return e.key!==void 0}function u(e,l){function b(){L||(L=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",l))}b.isReactWarning=!0,Object.defineProperty(e,"key",{get:b,configurable:!0})}function d(){var e=r(this.type);return D[e]||(D[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function p(e,l,b,m,T,N,A,$){return b=N.ref,e={$$typeof:R,type:e,key:l,props:N,_owner:T},(b!==void 0?b:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:d}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:$}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function f(e,l,b,m,T,N,A,$){var g=l.children;if(g!==void 0)if(m)if(he(g)){for(m=0;m<g.length;m++)h(g[m]);Object.freeze&&Object.freeze(g)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(g);if(z.call(l,"key")){g=r(e);var I=Object.keys(l).filter(function(ve){return ve!=="key"});m=0<I.length?"{key: someKey, "+I.join(": ..., ")+": ...}":"{key: someKey}",U[g+m]||(I=0<I.length?"{"+I.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react");var k={exports:{}},E={};var U;function ve(){if(U)return E;U=1;var r=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function c(n,a,t){var o=null;if(t!==void 0&&(o=""+t),a.key!==void 0&&(o=""+a.key),"key"in a){t={};for(var u in a)u!=="key"&&(t[u]=a[u])}else t=a;return a=t.ref,{$$typeof:r,type:n,key:o,ref:a!==void 0?a:null,props:t}}return E.Fragment=i,E.jsx=c,E.jsxs=c,E}var _={};var G;function ye(){return G||(G=1,process.env.NODE_ENV!=="production"&&function(){function r(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===me?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case ne:return"Profiler";case ie:return"StrictMode";case fe:return"Suspense";case pe:return"SuspenseList";case xe:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case oe:return"Portal";case ce:return e.displayName||"Context";case de:return(e._context.displayName||"Context")+".Consumer";case ue:var l=e.render;return e=e.displayName,e||(e=l.displayName||l.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case be:return l=e.displayName||null,l!==null?l:r(e.type)||"Memo";case P:l=e._payload,e=e._init;try{return r(e(l))}catch{}}return null}function i(e){return""+e}function c(e){try{i(e);var l=!1}catch{l=!0}if(l){l=console;var p=l.error,b=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return p.call(l,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",b),i(e)}}function n(e){if(e===C)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===P)return"<...>";try{var l=r(e);return l?"<"+l+">":"<...>"}catch{return"<...>"}}function a(){var e=S.A;return e===null?null:e.getOwner()}function t(){return Error("react-stack-top-frame")}function o(e){if(Y.call(e,"key")){var l=Object.getOwnPropertyDescriptor(e,"key").get;if(l&&l.isReactWarning)return!1}return e.key!==void 0}function u(e,l){function p(){z||(z=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",l))}p.isReactWarning=!0,Object.defineProperty(e,"key",{get:p,configurable:!0})}function d(){var e=r(this.type);return L[e]||(L[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function m(e,l,p,b,I,A){var x=p.ref;return e={$$typeof:F,type:e,key:l,props:p,_owner:b},(x!==void 0?x:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:d}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:I}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function f(e,l,p,b,I,A){var x=l.children;if(x!==void 0)if(b)if(ge(x)){for(b=0;b<x.length;b++)g(x[b]);Object.freeze&&Object.freeze(x)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else g(x);if(Y.call(l,"key")){x=r(e);var j=Object.keys(l).filter(function(he){return he!=="key"});b=0<j.length?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}",B[x+b]||(j=0<j.length?"{"+j.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
2
|
let props = %s;
|
|
19
3
|
<%s {...props} />
|
|
20
4
|
React keys must be passed directly to JSX without using spread:
|
|
21
5
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,
|
|
6
|
+
<%s key={someKey} {...props} />`,b,x,j,x),B[x+b]=!0)}if(x=null,p!==void 0&&(c(p),x=""+p),o(l)&&(c(l.key),x=""+l.key),"key"in l){p={};for(var $ in l)$!=="key"&&(p[$]=l[$])}else p=l;return x&&u(p,typeof e=="function"?e.displayName||e.name||"Unknown":e),m(e,x,p,a(),I,A)}function g(e){h(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===P&&(e._payload.status==="fulfilled"?h(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function h(e){return typeof e=="object"&&e!==null&&e.$$typeof===F}var v=R,F=Symbol.for("react.transitional.element"),oe=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),ie=Symbol.for("react.strict_mode"),ne=Symbol.for("react.profiler"),de=Symbol.for("react.consumer"),ce=Symbol.for("react.context"),ue=Symbol.for("react.forward_ref"),fe=Symbol.for("react.suspense"),pe=Symbol.for("react.suspense_list"),be=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),xe=Symbol.for("react.activity"),me=Symbol.for("react.client.reference"),S=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,ge=Array.isArray,O=console.createTask?console.createTask:function(){return null};v={react_stack_bottom_frame:function(e){return e()}};var z,L={},D=v.react_stack_bottom_frame.bind(v,t)(),W=O(n(t)),B={};_.Fragment=C,_.jsx=function(e,l,p){var b=1e4>S.recentlyCreatedOwnerStacks++;return f(e,l,p,!1,b?Error("react-stack-top-frame"):D,b?O(n(e)):W)},_.jsxs=function(e,l,p){var b=1e4>S.recentlyCreatedOwnerStacks++;return f(e,l,p,!0,b?Error("react-stack-top-frame"):D,b?O(n(e)):W)}}()),_}var V;function Re(){return V||(V=1,process.env.NODE_ENV==="production"?k.exports=ve():k.exports=ye()),k.exports}var s=Re();const y=(...r)=>r.filter(Boolean).join(" ");var N;(r=>{r.clickable=`
|
|
23
7
|
px-2
|
|
24
8
|
min-h-[calc(44/16*1rem)]
|
|
25
9
|
border
|
|
@@ -96,7 +80,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
96
80
|
${c.focus}
|
|
97
81
|
peer-focus-visible:outline-offset-[calc(2/16*1rem)]
|
|
98
82
|
peer-focus-visible:ring-[calc(2/16*1rem)]
|
|
99
|
-
`})(r.Peer||(r.Peer={}))})(
|
|
83
|
+
`})(r.Peer||(r.Peer={}))})(N||(N={}));const T=R.createContext({helperTextId:"",errorMessageId:"",isInvalid:!1,isRequired:!1}),J=`
|
|
100
84
|
bg-white
|
|
101
85
|
border
|
|
102
86
|
border-solid
|
|
@@ -105,8 +89,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
105
89
|
disabled:text-solid-gray-500
|
|
106
90
|
disabled:border-solid-gray-500
|
|
107
91
|
aria-invalid:border-red-800
|
|
108
|
-
${
|
|
109
|
-
`,
|
|
92
|
+
${N.focusRect}
|
|
93
|
+
`,H={lg:`
|
|
110
94
|
p-4
|
|
111
95
|
text-label
|
|
112
96
|
rounded-lg
|
|
@@ -123,13 +107,13 @@ React keys must be passed directly to JSX without using spread:
|
|
|
123
107
|
text-label
|
|
124
108
|
rounded-md
|
|
125
109
|
leading-snug
|
|
126
|
-
`},
|
|
110
|
+
`},X=`
|
|
127
111
|
inline-block
|
|
128
112
|
cursor-pointer
|
|
129
113
|
border
|
|
130
114
|
border-solid
|
|
131
115
|
border-transparent
|
|
132
|
-
`,
|
|
116
|
+
`,Z={lg:`
|
|
133
117
|
pr-8
|
|
134
118
|
py-4
|
|
135
119
|
text-label
|
|
@@ -144,10 +128,10 @@ React keys must be passed directly to JSX without using spread:
|
|
|
144
128
|
py-2
|
|
145
129
|
text-label
|
|
146
130
|
leading-snug
|
|
147
|
-
`},
|
|
131
|
+
`},Q={lg:"w-[22px] h-[22px] mr-2",md:"w-[18px] h-[18px] mr-1.5",sm:"w-[18px] h-[18px] mr-1"},q=r=>{const{id:i,className:c,size:n="lg",children:a,...t}=r,o=R.useId(),u=i||o,d=R.useContext(T);d.isRequired&&(t.required=!0),d.groupName&&(t.name=d.groupName);const m={lg:22/24,md:18/24,sm:18/24},f=`
|
|
148
132
|
peer
|
|
149
133
|
sr-only
|
|
150
|
-
`,
|
|
134
|
+
`,g=`
|
|
151
135
|
bg-clip-content
|
|
152
136
|
rounded-sm
|
|
153
137
|
border
|
|
@@ -158,8 +142,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
158
142
|
peer-checked:bg-blue-600
|
|
159
143
|
peer-checked:border-none
|
|
160
144
|
peer-disabled:border-solid-gray-500
|
|
161
|
-
${
|
|
162
|
-
`;return
|
|
145
|
+
${N.Peer.focusRect}
|
|
146
|
+
`;return s.jsx("label",{htmlFor:u,className:y(X,Z[n],c),children:s.jsxs("span",{className:"flex items-center",children:[s.jsx("input",{id:u,className:f,type:"checkbox","aria-describedby":d.helperTextId,"aria-errormessage":d.errorMessageId,"aria-invalid":d.isInvalid??!1,"aria-required":d.isRequired??!1,...t}),s.jsx("span",{className:y(g,Q[n]),children:s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,width:"24",height:"24",viewBox:"0 0 24 24",children:s.jsx("g",{transform:`scale(${m[n]} ${m[n]})`,children:s.jsx("path",{d:"m9.55 17.65-5.325-5.325 1.05-1.075 4.275 4.275 9.175-9.175 1.05 1.075Z"})})})}),s.jsx("span",{className:"peer-disabled:text-solid-gray-500",children:a})]})})};q.displayName="Checkbox";const M=r=>{const{id:i,className:c,size:n="lg",children:a,...t}=r,o=R.useId(),u=i||o,d=R.useContext(T);d.isRequired&&(t.required=!0),d.groupName&&(t.name=d.groupName);const m=`
|
|
163
147
|
peer
|
|
164
148
|
sr-only
|
|
165
149
|
`,f=`
|
|
@@ -171,13 +155,13 @@ React keys must be passed directly to JSX without using spread:
|
|
|
171
155
|
peer-checked:bg-blue-600
|
|
172
156
|
peer-checked:border-blue-600
|
|
173
157
|
peer-disabled:border-solid-gray-500
|
|
174
|
-
${
|
|
175
|
-
`,
|
|
158
|
+
${N.Peer.focusRect}
|
|
159
|
+
`,g={lg:"p-1",md:"p-[3px]",sm:"p-[3px]"};return s.jsx("label",{htmlFor:u,className:y(X,Z[n],c),children:s.jsxs("span",{className:"flex items-center",children:[s.jsx("input",{id:u,className:m,type:"radio","aria-describedby":d.helperTextId,"aria-errormessage":d.errorMessageId,"aria-invalid":d.isInvalid??!1,"aria-required":d.isRequired??!1,...t}),s.jsx("span",{"aria-hidden":!0,className:y(f,g[n],Q[n])}),s.jsx("span",{className:"peer-disabled:text-solid-gray-500",children:a})]})})};M.displayName="Radio";const K=r=>{const{id:i,className:c,size:n="lg",children:a,...t}=r,o=R.useContext(T);return o.isRequired&&(t.required=!0),s.jsxs("div",{className:"inline-block relative",children:[s.jsx("select",{id:i||o.id,className:y(`
|
|
176
160
|
!pr-8
|
|
177
161
|
peer
|
|
178
162
|
cursor-pointer
|
|
179
163
|
appearance-none
|
|
180
|
-
`,H
|
|
164
|
+
`,J,H[n],c),"aria-describedby":o.helperTextId,"aria-errormessage":o.errorMessageId,"aria-invalid":o.isInvalid??!1,"aria-required":o.isRequired??!1,...t,children:a}),s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,className:`
|
|
181
165
|
pointer-events-none
|
|
182
166
|
absolute
|
|
183
167
|
right-4
|
|
@@ -185,7 +169,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
185
169
|
-translate-y-1/2
|
|
186
170
|
text-solid-gray-900
|
|
187
171
|
peer-disabled:text-solid-gray-500
|
|
188
|
-
`,fill:"none",width:"16",height:"16",viewBox:"0 0 16 16",children:[
|
|
172
|
+
`,fill:"none",width:"16",height:"16",viewBox:"0 0 16 16",children:[s.jsx("title",{children:"arrow down"}),s.jsx("path",{d:"M12 15.05 6.35 9.4 7.4 8.35l4.6 4.6 4.6-4.6 1.05 1.05Z",fill:"currentColor"})]})]})};K.displayName="Select";const ee=r=>{const{id:i,className:c,size:n="lg",...a}=r,t=R.useContext(T);t.isRequired&&(a.required=!0);const o=`
|
|
189
173
|
file:mr-2
|
|
190
174
|
file:inline-block
|
|
191
175
|
file:text-button
|
|
@@ -216,9 +200,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
216
200
|
rounded-lg
|
|
217
201
|
outline-offset-2
|
|
218
202
|
aria-invalid:text-red-800
|
|
219
|
-
${
|
|
220
|
-
${
|
|
221
|
-
`,
|
|
203
|
+
${N.hoverUnderline}
|
|
204
|
+
${N.focusRounded}
|
|
205
|
+
`,m={lg:`
|
|
222
206
|
file:p-4
|
|
223
207
|
file:text-button
|
|
224
208
|
file:rounded-lg
|
|
@@ -235,7 +219,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
235
219
|
file:text-button
|
|
236
220
|
file:rounded-md
|
|
237
221
|
file:leading-snug
|
|
238
|
-
`};return
|
|
222
|
+
`};return s.jsx("input",{type:"file",id:i||t.id,className:y(o,u,m[n],d,c),"aria-describedby":t.helperTextId,"aria-errormessage":t.errorMessageId,"aria-invalid":t.isInvalid??!1,"aria-required":t.isRequired??!1,role:"button","aria-label":"File Upload",...a})};ee.displayName="FileInput";const re=r=>{const{id:i,className:c,size:n="lg",...a}=r,t=R.useContext(T);return t.isRequired&&(a.required=!0),s.jsx("input",{type:"text",id:i||t.id,className:y(J,H[n],c),"aria-describedby":t.helperTextId,"aria-errormessage":t.errorMessageId,"aria-invalid":t.isInvalid??!1,"aria-required":t.isRequired??!1,...a})};re.displayName="Input";const te=r=>{const{id:i,className:c,children:n,onChange:a,maxLength:t,...o}=r,[u,d]=R.useState(0),m=v=>{a&&a(v),d(v.target.value.length)},f=R.useContext(T);f.isRequired&&(o.required=!0);const g=u>(t||0)?"text-red-800":"text-solid-gray-700",h=`
|
|
239
223
|
p-4
|
|
240
224
|
text-label
|
|
241
225
|
rounded-lg
|
|
@@ -246,9 +230,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
246
230
|
disabled:text-solid-gray-500
|
|
247
231
|
disabled:border-solid-gray-500
|
|
248
232
|
aria-invalid:border-red-800
|
|
249
|
-
${
|
|
250
|
-
`;return
|
|
233
|
+
${N.focusRect}
|
|
234
|
+
`;return s.jsxs(s.Fragment,{children:[s.jsx("textarea",{id:i||f.id,className:y(h,c),"aria-describedby":f.helperTextId,"aria-errormessage":f.errorMessageId,"aria-invalid":f.isInvalid??!1,"aria-required":f.isRequired??!1,onChange:m,...o,children:n}),t?s.jsxs("p",{className:"text-label text-solid-gray-700",children:[s.jsx("span",{className:g,children:u}),"/",s.jsx("span",{children:t})]}):""]})};te.displayName="Textarea";const se=r=>{const i=R.useId(),{labelText:c,className:n,helperText:a,errorMessage:t,isInvalid:o,isRequired:u,children:d,...m}=r,f={id:r.htmlFor??`input-${i}`,helperTextId:`helper-text-${i}`,errorMessageId:`error-message-${i}`,isInvalid:o??!1,isRequired:u??!1};return s.jsx(T.Provider,{value:f,children:s.jsxs("div",{className:y("flex flex-col items-start gap-2",n),children:[s.jsxs("label",{className:y("block text-label",o&&"text-red-800"),htmlFor:f.id,...m,children:[c,u&&s.jsx("span",{className:"text-label text-red-800",children:" *"})]}),a&&s.jsx("p",{id:f.helperTextId,className:`
|
|
251
235
|
text-label text-solid-gray-700
|
|
252
|
-
`,children:
|
|
236
|
+
`,children:a}),d,o&&s.jsx("p",{id:f.errorMessageId,className:`
|
|
253
237
|
text-label text-red-800
|
|
254
|
-
`,children:
|
|
238
|
+
`,children:t})]})})};se.displayName="LabelControl";const w=r=>{const i=R.useId(),{labelText:c,className:n,helperText:a,errorMessage:t,isInvalid:o,isRequired:u,direction:d,children:m,...f}=r,h={groupName:f.name??`group-${i}`,helperTextId:`helper-text-${i}`,errorMessageId:`error-message-${i}`,isInvalid:o??!1,isRequired:u??!1},v=d??"flex-col";return s.jsx(T.Provider,{value:h,children:s.jsxs("fieldset",{className:y("flex flex-col items-start gap-2",n),...f,children:[s.jsx("legend",{children:s.jsxs("p",{className:y("block text-label",o&&"text-red-800"),children:[c,u&&s.jsx("span",{className:"text-red-800",children:" *"})]})}),s.jsx("div",{className:y("inline-flex",v),children:m}),a&&s.jsx("p",{id:h.helperTextId,className:"text-sup text-solid-gray-700",children:a}),o&&s.jsx("p",{id:h.errorMessageId,className:"text-label text-red-800",children:t})]})})};w.displayName="FieldsetControl";const le=r=>{const{items:i,onChange:c,className:n,labelText:a,helperText:t,errorMessage:o,isInvalid:u,isRequired:d,size:m,...f}=r;return s.jsx(w,{className:n,labelText:a,helperText:t,errorMessage:o,isInvalid:u,isRequired:d,...f,children:i.map(({label:g,value:h})=>s.jsx(q,{size:m,value:h,onChange:c,children:g},`${g}-${h}`))})};le.displayName="CheckboxGroup";const ae=r=>{const{items:i,onChange:c,className:n,labelText:a,helperText:t,errorMessage:o,isInvalid:u,isRequired:d,defaultValue:m,size:f,...g}=r;return s.jsx(w,{className:n,labelText:a,helperText:t,errorMessage:o,isInvalid:u,isRequired:d,...g,children:i.map(({label:h,value:v})=>s.jsx(M,{size:f,value:v,onChange:c,defaultChecked:m===v,children:h},`${h}-${v}`))})};ae.displayName="RadioGroup";exports.Checkbox=q;exports.CheckboxGroup=le;exports.FieldsetControl=w;exports.FileInput=ee;exports.Input=re;exports.LabelControl=se;exports.Radio=M;exports.RadioGroup=ae;exports.Select=K;exports.Textarea=te;
|
package/dist/index.es.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/
|
|
12
|
-
var B;
|
|
13
|
-
function pe() {
|
|
14
|
-
if (B) return I;
|
|
15
|
-
B = 1;
|
|
1
|
+
import R from "react";
|
|
2
|
+
var I = { exports: {} }, E = {};
|
|
3
|
+
var W;
|
|
4
|
+
function fe() {
|
|
5
|
+
if (W) return E;
|
|
6
|
+
W = 1;
|
|
16
7
|
var r = Symbol.for("react.transitional.element"), i = Symbol.for("react.fragment");
|
|
17
8
|
function c(n, a, s) {
|
|
18
9
|
var o = null;
|
|
@@ -29,56 +20,47 @@ function pe() {
|
|
|
29
20
|
props: s
|
|
30
21
|
};
|
|
31
22
|
}
|
|
32
|
-
return
|
|
23
|
+
return E.Fragment = i, E.jsx = c, E.jsxs = c, E;
|
|
33
24
|
}
|
|
34
25
|
var _ = {};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
40
|
-
*
|
|
41
|
-
* This source code is licensed under the MIT license found in the
|
|
42
|
-
* LICENSE file in the root directory of this source tree.
|
|
43
|
-
*/
|
|
44
|
-
var U;
|
|
45
|
-
function be() {
|
|
46
|
-
return U || (U = 1, process.env.NODE_ENV !== "production" && function() {
|
|
26
|
+
var B;
|
|
27
|
+
function pe() {
|
|
28
|
+
return B || (B = 1, process.env.NODE_ENV !== "production" && function() {
|
|
47
29
|
function r(e) {
|
|
48
30
|
if (e == null) return null;
|
|
49
31
|
if (typeof e == "function")
|
|
50
|
-
return e.$$typeof ===
|
|
32
|
+
return e.$$typeof === de ? null : e.displayName || e.name || null;
|
|
51
33
|
if (typeof e == "string") return e;
|
|
52
34
|
switch (e) {
|
|
53
|
-
case
|
|
35
|
+
case k:
|
|
54
36
|
return "Fragment";
|
|
55
|
-
case se:
|
|
56
|
-
return "Profiler";
|
|
57
37
|
case re:
|
|
38
|
+
return "Profiler";
|
|
39
|
+
case ee:
|
|
58
40
|
return "StrictMode";
|
|
59
|
-
case
|
|
41
|
+
case ae:
|
|
60
42
|
return "Suspense";
|
|
61
|
-
case
|
|
43
|
+
case oe:
|
|
62
44
|
return "SuspenseList";
|
|
63
|
-
case
|
|
45
|
+
case ne:
|
|
64
46
|
return "Activity";
|
|
65
47
|
}
|
|
66
48
|
if (typeof e == "object")
|
|
67
49
|
switch (typeof e.tag == "number" && console.error(
|
|
68
50
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
51
|
), e.$$typeof) {
|
|
70
|
-
case
|
|
52
|
+
case K:
|
|
71
53
|
return "Portal";
|
|
72
|
-
case le:
|
|
73
|
-
return (e.displayName || "Context") + ".Provider";
|
|
74
54
|
case te:
|
|
55
|
+
return e.displayName || "Context";
|
|
56
|
+
case se:
|
|
75
57
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
|
-
case
|
|
58
|
+
case le:
|
|
77
59
|
var l = e.render;
|
|
78
60
|
return e = e.displayName, e || (e = l.displayName || l.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
-
case
|
|
61
|
+
case ie:
|
|
80
62
|
return l = e.displayName || null, l !== null ? l : r(e.type) || "Memo";
|
|
81
|
-
case
|
|
63
|
+
case P:
|
|
82
64
|
l = e._payload, e = e._init;
|
|
83
65
|
try {
|
|
84
66
|
return r(e(l));
|
|
@@ -99,17 +81,17 @@ function be() {
|
|
|
99
81
|
}
|
|
100
82
|
if (l) {
|
|
101
83
|
l = console;
|
|
102
|
-
var p = l.error,
|
|
84
|
+
var p = l.error, b = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
103
85
|
return p.call(
|
|
104
86
|
l,
|
|
105
87
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
-
|
|
88
|
+
b
|
|
107
89
|
), i(e);
|
|
108
90
|
}
|
|
109
91
|
}
|
|
110
92
|
function n(e) {
|
|
111
|
-
if (e ===
|
|
112
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
93
|
+
if (e === k) return "<>";
|
|
94
|
+
if (typeof e == "object" && e !== null && e.$$typeof === P)
|
|
113
95
|
return "<...>";
|
|
114
96
|
try {
|
|
115
97
|
var l = r(e);
|
|
@@ -126,7 +108,7 @@ function be() {
|
|
|
126
108
|
return Error("react-stack-top-frame");
|
|
127
109
|
}
|
|
128
110
|
function o(e) {
|
|
129
|
-
if (
|
|
111
|
+
if (M.call(e, "key")) {
|
|
130
112
|
var l = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
131
113
|
if (l && l.isReactWarning) return !1;
|
|
132
114
|
}
|
|
@@ -134,7 +116,7 @@ function be() {
|
|
|
134
116
|
}
|
|
135
117
|
function u(e, l) {
|
|
136
118
|
function p() {
|
|
137
|
-
|
|
119
|
+
F || (F = !0, console.error(
|
|
138
120
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
121
|
l
|
|
140
122
|
));
|
|
@@ -146,18 +128,19 @@ function be() {
|
|
|
146
128
|
}
|
|
147
129
|
function d() {
|
|
148
130
|
var e = r(this.type);
|
|
149
|
-
return
|
|
131
|
+
return Y[e] || (Y[e] = !0, console.error(
|
|
150
132
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
133
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
152
134
|
}
|
|
153
|
-
function
|
|
154
|
-
|
|
155
|
-
|
|
135
|
+
function x(e, l, p, b, w, A) {
|
|
136
|
+
var m = p.ref;
|
|
137
|
+
return e = {
|
|
138
|
+
$$typeof: q,
|
|
156
139
|
type: e,
|
|
157
140
|
key: l,
|
|
158
|
-
props:
|
|
159
|
-
_owner:
|
|
160
|
-
}, (
|
|
141
|
+
props: p,
|
|
142
|
+
_owner: b
|
|
143
|
+
}, (m !== void 0 ? m : null) !== null ? Object.defineProperty(e, "ref", {
|
|
161
144
|
enumerable: !1,
|
|
162
145
|
get: d
|
|
163
146
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
@@ -174,113 +157,110 @@ function be() {
|
|
|
174
157
|
configurable: !1,
|
|
175
158
|
enumerable: !1,
|
|
176
159
|
writable: !0,
|
|
177
|
-
value:
|
|
160
|
+
value: w
|
|
178
161
|
}), Object.defineProperty(e, "_debugTask", {
|
|
179
162
|
configurable: !1,
|
|
180
163
|
enumerable: !1,
|
|
181
164
|
writable: !0,
|
|
182
|
-
value:
|
|
165
|
+
value: A
|
|
183
166
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
184
167
|
}
|
|
185
|
-
function f(e, l, p,
|
|
186
|
-
var
|
|
187
|
-
if (
|
|
188
|
-
if (
|
|
189
|
-
if (
|
|
190
|
-
for (
|
|
191
|
-
|
|
192
|
-
Object.freeze && Object.freeze(
|
|
168
|
+
function f(e, l, p, b, w, A) {
|
|
169
|
+
var m = l.children;
|
|
170
|
+
if (m !== void 0)
|
|
171
|
+
if (b)
|
|
172
|
+
if (ce(m)) {
|
|
173
|
+
for (b = 0; b < m.length; b++)
|
|
174
|
+
g(m[b]);
|
|
175
|
+
Object.freeze && Object.freeze(m);
|
|
193
176
|
} else
|
|
194
177
|
console.error(
|
|
195
178
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
196
179
|
);
|
|
197
|
-
else
|
|
198
|
-
if (
|
|
199
|
-
|
|
200
|
-
var
|
|
201
|
-
return
|
|
180
|
+
else g(m);
|
|
181
|
+
if (M.call(l, "key")) {
|
|
182
|
+
m = r(e);
|
|
183
|
+
var j = Object.keys(l).filter(function(ue) {
|
|
184
|
+
return ue !== "key";
|
|
202
185
|
});
|
|
203
|
-
|
|
186
|
+
b = 0 < j.length ? "{key: someKey, " + j.join(": ..., ") + ": ...}" : "{key: someKey}", L[m + b] || (j = 0 < j.length ? "{" + j.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
204
187
|
`A props object containing a "key" prop is being spread into JSX:
|
|
205
188
|
let props = %s;
|
|
206
189
|
<%s {...props} />
|
|
207
190
|
React keys must be passed directly to JSX without using spread:
|
|
208
191
|
let props = %s;
|
|
209
192
|
<%s key={someKey} {...props} />`,
|
|
193
|
+
b,
|
|
210
194
|
m,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
), W[g + m] = !0);
|
|
195
|
+
j,
|
|
196
|
+
m
|
|
197
|
+
), L[m + b] = !0);
|
|
215
198
|
}
|
|
216
|
-
if (
|
|
199
|
+
if (m = null, p !== void 0 && (c(p), m = "" + p), o(l) && (c(l.key), m = "" + l.key), "key" in l) {
|
|
217
200
|
p = {};
|
|
218
|
-
for (var
|
|
219
|
-
|
|
201
|
+
for (var O in l)
|
|
202
|
+
O !== "key" && (p[O] = l[O]);
|
|
220
203
|
} else p = l;
|
|
221
|
-
return
|
|
204
|
+
return m && u(
|
|
222
205
|
p,
|
|
223
206
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
224
|
-
),
|
|
207
|
+
), x(
|
|
225
208
|
e,
|
|
226
|
-
|
|
227
|
-
N,
|
|
228
|
-
j,
|
|
229
|
-
a(),
|
|
209
|
+
m,
|
|
230
210
|
p,
|
|
231
|
-
|
|
232
|
-
|
|
211
|
+
a(),
|
|
212
|
+
w,
|
|
213
|
+
A
|
|
233
214
|
);
|
|
234
215
|
}
|
|
216
|
+
function g(e) {
|
|
217
|
+
h(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === P && (e._payload.status === "fulfilled" ? h(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
218
|
+
}
|
|
235
219
|
function h(e) {
|
|
236
|
-
typeof e == "object" && e !== null && e.$$typeof ===
|
|
220
|
+
return typeof e == "object" && e !== null && e.$$typeof === q;
|
|
237
221
|
}
|
|
238
|
-
var
|
|
222
|
+
var v = R, q = Symbol.for("react.transitional.element"), K = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), ee = Symbol.for("react.strict_mode"), re = Symbol.for("react.profiler"), se = Symbol.for("react.consumer"), te = Symbol.for("react.context"), le = Symbol.for("react.forward_ref"), ae = Symbol.for("react.suspense"), oe = Symbol.for("react.suspense_list"), ie = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), ne = Symbol.for("react.activity"), de = Symbol.for("react.client.reference"), C = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, ce = Array.isArray, S = console.createTask ? console.createTask : function() {
|
|
239
223
|
return null;
|
|
240
224
|
};
|
|
241
|
-
|
|
225
|
+
v = {
|
|
242
226
|
react_stack_bottom_frame: function(e) {
|
|
243
227
|
return e();
|
|
244
228
|
}
|
|
245
229
|
};
|
|
246
|
-
var
|
|
247
|
-
|
|
230
|
+
var F, Y = {}, z = v.react_stack_bottom_frame.bind(
|
|
231
|
+
v,
|
|
248
232
|
s
|
|
249
|
-
)(),
|
|
250
|
-
_.Fragment =
|
|
251
|
-
var
|
|
233
|
+
)(), D = S(n(s)), L = {};
|
|
234
|
+
_.Fragment = k, _.jsx = function(e, l, p) {
|
|
235
|
+
var b = 1e4 > C.recentlyCreatedOwnerStacks++;
|
|
252
236
|
return f(
|
|
253
237
|
e,
|
|
254
238
|
l,
|
|
255
239
|
p,
|
|
256
240
|
!1,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
N ? Error("react-stack-top-frame") : D,
|
|
260
|
-
N ? S(n(e)) : L
|
|
241
|
+
b ? Error("react-stack-top-frame") : z,
|
|
242
|
+
b ? S(n(e)) : D
|
|
261
243
|
);
|
|
262
|
-
}, _.jsxs = function(e, l, p
|
|
263
|
-
var
|
|
244
|
+
}, _.jsxs = function(e, l, p) {
|
|
245
|
+
var b = 1e4 > C.recentlyCreatedOwnerStacks++;
|
|
264
246
|
return f(
|
|
265
247
|
e,
|
|
266
248
|
l,
|
|
267
249
|
p,
|
|
268
250
|
!0,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
N ? Error("react-stack-top-frame") : D,
|
|
272
|
-
N ? S(n(e)) : L
|
|
251
|
+
b ? Error("react-stack-top-frame") : z,
|
|
252
|
+
b ? S(n(e)) : D
|
|
273
253
|
);
|
|
274
254
|
};
|
|
275
255
|
}()), _;
|
|
276
256
|
}
|
|
277
|
-
var
|
|
278
|
-
function
|
|
279
|
-
return
|
|
257
|
+
var U;
|
|
258
|
+
function be() {
|
|
259
|
+
return U || (U = 1, process.env.NODE_ENV === "production" ? I.exports = fe() : I.exports = pe()), I.exports;
|
|
280
260
|
}
|
|
281
|
-
var t =
|
|
282
|
-
const
|
|
283
|
-
var
|
|
261
|
+
var t = be();
|
|
262
|
+
const y = (...r) => r.filter(Boolean).join(" ");
|
|
263
|
+
var N;
|
|
284
264
|
((r) => {
|
|
285
265
|
r.clickable = `
|
|
286
266
|
px-2
|
|
@@ -364,13 +344,13 @@ var T;
|
|
|
364
344
|
peer-focus-visible:ring-[calc(2/16*1rem)]
|
|
365
345
|
`;
|
|
366
346
|
})(r.Peer || (r.Peer = {}));
|
|
367
|
-
})(
|
|
368
|
-
const
|
|
347
|
+
})(N || (N = {}));
|
|
348
|
+
const T = R.createContext({
|
|
369
349
|
helperTextId: "",
|
|
370
350
|
errorMessageId: "",
|
|
371
351
|
isInvalid: !1,
|
|
372
352
|
isRequired: !1
|
|
373
|
-
}),
|
|
353
|
+
}), G = `
|
|
374
354
|
bg-white
|
|
375
355
|
border
|
|
376
356
|
border-solid
|
|
@@ -379,7 +359,7 @@ const E = y.createContext({
|
|
|
379
359
|
disabled:text-solid-gray-500
|
|
380
360
|
disabled:border-solid-gray-500
|
|
381
361
|
aria-invalid:border-red-800
|
|
382
|
-
${
|
|
362
|
+
${N.focusRect}
|
|
383
363
|
`, V = {
|
|
384
364
|
// 16(p-4) * 2 + 22(text-label * leading-snug) + boader * 2 = 56px
|
|
385
365
|
lg: `
|
|
@@ -404,13 +384,13 @@ const E = y.createContext({
|
|
|
404
384
|
rounded-md
|
|
405
385
|
leading-snug
|
|
406
386
|
`
|
|
407
|
-
},
|
|
387
|
+
}, J = `
|
|
408
388
|
inline-block
|
|
409
389
|
cursor-pointer
|
|
410
390
|
border
|
|
411
391
|
border-solid
|
|
412
392
|
border-transparent
|
|
413
|
-
`,
|
|
393
|
+
`, H = {
|
|
414
394
|
// 16(p-4) * 2 + 22(text-label * leading-snug) + boader(transparent) * 2 = 56px
|
|
415
395
|
lg: `
|
|
416
396
|
pr-8
|
|
@@ -432,21 +412,21 @@ const E = y.createContext({
|
|
|
432
412
|
text-label
|
|
433
413
|
leading-snug
|
|
434
414
|
`
|
|
435
|
-
},
|
|
415
|
+
}, X = {
|
|
436
416
|
lg: "w-[22px] h-[22px] mr-2",
|
|
437
417
|
md: "w-[18px] h-[18px] mr-1.5",
|
|
438
418
|
sm: "w-[18px] h-[18px] mr-1"
|
|
439
|
-
},
|
|
440
|
-
const { id: i, className: c, size: n = "lg", children: a, ...s } = r, o =
|
|
419
|
+
}, Z = (r) => {
|
|
420
|
+
const { id: i, className: c, size: n = "lg", children: a, ...s } = r, o = R.useId(), u = i || o, d = R.useContext(T);
|
|
441
421
|
d.isRequired && (s.required = !0), d.groupName && (s.name = d.groupName);
|
|
442
|
-
const
|
|
422
|
+
const x = {
|
|
443
423
|
lg: 22 / 24,
|
|
444
424
|
md: 18 / 24,
|
|
445
425
|
sm: 18 / 24
|
|
446
426
|
}, f = `
|
|
447
427
|
peer
|
|
448
428
|
sr-only
|
|
449
|
-
`,
|
|
429
|
+
`, g = `
|
|
450
430
|
bg-clip-content
|
|
451
431
|
rounded-sm
|
|
452
432
|
border
|
|
@@ -457,15 +437,15 @@ const E = y.createContext({
|
|
|
457
437
|
peer-checked:bg-blue-600
|
|
458
438
|
peer-checked:border-none
|
|
459
439
|
peer-disabled:border-solid-gray-500
|
|
460
|
-
${
|
|
440
|
+
${N.Peer.focusRect}
|
|
461
441
|
`;
|
|
462
442
|
return /* @__PURE__ */ t.jsx(
|
|
463
443
|
"label",
|
|
464
444
|
{
|
|
465
445
|
htmlFor: u,
|
|
466
|
-
className:
|
|
467
|
-
|
|
468
|
-
|
|
446
|
+
className: y(
|
|
447
|
+
J,
|
|
448
|
+
H[n],
|
|
469
449
|
c
|
|
470
450
|
),
|
|
471
451
|
children: /* @__PURE__ */ t.jsxs("span", { className: "flex items-center", children: [
|
|
@@ -482,7 +462,7 @@ const E = y.createContext({
|
|
|
482
462
|
...s
|
|
483
463
|
}
|
|
484
464
|
),
|
|
485
|
-
/* @__PURE__ */ t.jsx("span", { className:
|
|
465
|
+
/* @__PURE__ */ t.jsx("span", { className: y(g, X[n]), children: /* @__PURE__ */ t.jsx(
|
|
486
466
|
"svg",
|
|
487
467
|
{
|
|
488
468
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -490,7 +470,7 @@ const E = y.createContext({
|
|
|
490
470
|
width: "24",
|
|
491
471
|
height: "24",
|
|
492
472
|
viewBox: "0 0 24 24",
|
|
493
|
-
children: /* @__PURE__ */ t.jsx("g", { transform: `scale(${
|
|
473
|
+
children: /* @__PURE__ */ t.jsx("g", { transform: `scale(${x[n]} ${x[n]})`, children: /* @__PURE__ */ t.jsx("path", { d: "m9.55 17.65-5.325-5.325 1.05-1.075 4.275 4.275 9.175-9.175 1.05 1.075Z" }) })
|
|
494
474
|
}
|
|
495
475
|
) }),
|
|
496
476
|
/* @__PURE__ */ t.jsx("span", { className: "peer-disabled:text-solid-gray-500", children: a })
|
|
@@ -498,11 +478,11 @@ const E = y.createContext({
|
|
|
498
478
|
}
|
|
499
479
|
);
|
|
500
480
|
};
|
|
501
|
-
|
|
502
|
-
const
|
|
503
|
-
const { id: i, className: c, size: n = "lg", children: a, ...s } = r, o =
|
|
481
|
+
Z.displayName = "Checkbox";
|
|
482
|
+
const Q = (r) => {
|
|
483
|
+
const { id: i, className: c, size: n = "lg", children: a, ...s } = r, o = R.useId(), u = i || o, d = R.useContext(T);
|
|
504
484
|
d.isRequired && (s.required = !0), d.groupName && (s.name = d.groupName);
|
|
505
|
-
const
|
|
485
|
+
const x = `
|
|
506
486
|
peer
|
|
507
487
|
sr-only
|
|
508
488
|
`, f = `
|
|
@@ -514,8 +494,8 @@ const K = (r) => {
|
|
|
514
494
|
peer-checked:bg-blue-600
|
|
515
495
|
peer-checked:border-blue-600
|
|
516
496
|
peer-disabled:border-solid-gray-500
|
|
517
|
-
${
|
|
518
|
-
`,
|
|
497
|
+
${N.Peer.focusRect}
|
|
498
|
+
`, g = {
|
|
519
499
|
lg: "p-1",
|
|
520
500
|
md: "p-[3px]",
|
|
521
501
|
sm: "p-[3px]"
|
|
@@ -524,9 +504,9 @@ const K = (r) => {
|
|
|
524
504
|
"label",
|
|
525
505
|
{
|
|
526
506
|
htmlFor: u,
|
|
527
|
-
className:
|
|
528
|
-
|
|
529
|
-
|
|
507
|
+
className: y(
|
|
508
|
+
J,
|
|
509
|
+
H[n],
|
|
530
510
|
c
|
|
531
511
|
),
|
|
532
512
|
children: /* @__PURE__ */ t.jsxs("span", { className: "flex items-center", children: [
|
|
@@ -534,7 +514,7 @@ const K = (r) => {
|
|
|
534
514
|
"input",
|
|
535
515
|
{
|
|
536
516
|
id: u,
|
|
537
|
-
className:
|
|
517
|
+
className: x,
|
|
538
518
|
type: "radio",
|
|
539
519
|
"aria-describedby": d.helperTextId,
|
|
540
520
|
"aria-errormessage": d.errorMessageId,
|
|
@@ -547,7 +527,7 @@ const K = (r) => {
|
|
|
547
527
|
"span",
|
|
548
528
|
{
|
|
549
529
|
"aria-hidden": !0,
|
|
550
|
-
className:
|
|
530
|
+
className: y(f, g[n], X[n])
|
|
551
531
|
}
|
|
552
532
|
),
|
|
553
533
|
/* @__PURE__ */ t.jsx("span", { className: "peer-disabled:text-solid-gray-500", children: a })
|
|
@@ -555,22 +535,22 @@ const K = (r) => {
|
|
|
555
535
|
}
|
|
556
536
|
);
|
|
557
537
|
};
|
|
558
|
-
|
|
538
|
+
Q.displayName = "Radio";
|
|
559
539
|
const me = (r) => {
|
|
560
|
-
const { id: i, className: c, size: n = "lg", children: a, ...s } = r, o =
|
|
540
|
+
const { id: i, className: c, size: n = "lg", children: a, ...s } = r, o = R.useContext(T);
|
|
561
541
|
return o.isRequired && (s.required = !0), /* @__PURE__ */ t.jsxs("div", { className: "inline-block relative", children: [
|
|
562
542
|
/* @__PURE__ */ t.jsx(
|
|
563
543
|
"select",
|
|
564
544
|
{
|
|
565
545
|
id: i || o.id,
|
|
566
|
-
className:
|
|
546
|
+
className: y(
|
|
567
547
|
`
|
|
568
548
|
!pr-8
|
|
569
549
|
peer
|
|
570
550
|
cursor-pointer
|
|
571
551
|
appearance-none
|
|
572
552
|
`,
|
|
573
|
-
|
|
553
|
+
G,
|
|
574
554
|
V[n],
|
|
575
555
|
c
|
|
576
556
|
),
|
|
@@ -615,8 +595,8 @@ const me = (r) => {
|
|
|
615
595
|
] });
|
|
616
596
|
};
|
|
617
597
|
me.displayName = "Select";
|
|
618
|
-
const
|
|
619
|
-
const { id: i, className: c, size: n = "lg", ...a } = r, s =
|
|
598
|
+
const xe = (r) => {
|
|
599
|
+
const { id: i, className: c, size: n = "lg", ...a } = r, s = R.useContext(T);
|
|
620
600
|
s.isRequired && (a.required = !0);
|
|
621
601
|
const o = `
|
|
622
602
|
file:mr-2
|
|
@@ -649,9 +629,9 @@ const ge = (r) => {
|
|
|
649
629
|
rounded-lg
|
|
650
630
|
outline-offset-2
|
|
651
631
|
aria-invalid:text-red-800
|
|
652
|
-
${
|
|
653
|
-
${
|
|
654
|
-
`,
|
|
632
|
+
${N.hoverUnderline}
|
|
633
|
+
${N.focusRounded}
|
|
634
|
+
`, x = {
|
|
655
635
|
// 16(p-4) * 2 + 22(text-button * leading-snug) + boader * 2 = 56px
|
|
656
636
|
lg: `
|
|
657
637
|
file:p-4
|
|
@@ -681,7 +661,7 @@ const ge = (r) => {
|
|
|
681
661
|
{
|
|
682
662
|
type: "file",
|
|
683
663
|
id: i || s.id,
|
|
684
|
-
className:
|
|
664
|
+
className: y(o, u, x[n], d, c),
|
|
685
665
|
"aria-describedby": s.helperTextId,
|
|
686
666
|
"aria-errormessage": s.errorMessageId,
|
|
687
667
|
"aria-invalid": s.isInvalid ?? !1,
|
|
@@ -692,16 +672,16 @@ const ge = (r) => {
|
|
|
692
672
|
}
|
|
693
673
|
);
|
|
694
674
|
};
|
|
695
|
-
|
|
696
|
-
const
|
|
697
|
-
const { id: i, className: c, size: n = "lg", ...a } = r, s =
|
|
675
|
+
xe.displayName = "FileInput";
|
|
676
|
+
const ge = (r) => {
|
|
677
|
+
const { id: i, className: c, size: n = "lg", ...a } = r, s = R.useContext(T);
|
|
698
678
|
return s.isRequired && (a.required = !0), /* @__PURE__ */ t.jsx(
|
|
699
679
|
"input",
|
|
700
680
|
{
|
|
701
681
|
type: "text",
|
|
702
682
|
id: i || s.id,
|
|
703
|
-
className:
|
|
704
|
-
|
|
683
|
+
className: y(
|
|
684
|
+
G,
|
|
705
685
|
V[n],
|
|
706
686
|
c
|
|
707
687
|
),
|
|
@@ -713,13 +693,13 @@ const he = (r) => {
|
|
|
713
693
|
}
|
|
714
694
|
);
|
|
715
695
|
};
|
|
716
|
-
|
|
717
|
-
const
|
|
718
|
-
const { id: i, className: c, children: n, onChange: a, maxLength: s, ...o } = r, [u, d] =
|
|
719
|
-
a && a(
|
|
720
|
-
}, f =
|
|
696
|
+
ge.displayName = "Input";
|
|
697
|
+
const he = (r) => {
|
|
698
|
+
const { id: i, className: c, children: n, onChange: a, maxLength: s, ...o } = r, [u, d] = R.useState(0), x = (v) => {
|
|
699
|
+
a && a(v), d(v.target.value.length);
|
|
700
|
+
}, f = R.useContext(T);
|
|
721
701
|
f.isRequired && (o.required = !0);
|
|
722
|
-
const
|
|
702
|
+
const g = u > (s || 0) ? "text-red-800" : "text-solid-gray-700", h = `
|
|
723
703
|
p-4
|
|
724
704
|
text-label
|
|
725
705
|
rounded-lg
|
|
@@ -730,33 +710,33 @@ const ve = (r) => {
|
|
|
730
710
|
disabled:text-solid-gray-500
|
|
731
711
|
disabled:border-solid-gray-500
|
|
732
712
|
aria-invalid:border-red-800
|
|
733
|
-
${
|
|
713
|
+
${N.focusRect}
|
|
734
714
|
`;
|
|
735
715
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
736
716
|
/* @__PURE__ */ t.jsx(
|
|
737
717
|
"textarea",
|
|
738
718
|
{
|
|
739
719
|
id: i || f.id,
|
|
740
|
-
className:
|
|
720
|
+
className: y(h, c),
|
|
741
721
|
"aria-describedby": f.helperTextId,
|
|
742
722
|
"aria-errormessage": f.errorMessageId,
|
|
743
723
|
"aria-invalid": f.isInvalid ?? !1,
|
|
744
724
|
"aria-required": f.isRequired ?? !1,
|
|
745
|
-
onChange:
|
|
725
|
+
onChange: x,
|
|
746
726
|
...o,
|
|
747
727
|
children: n
|
|
748
728
|
}
|
|
749
729
|
),
|
|
750
730
|
s ? /* @__PURE__ */ t.jsxs("p", { className: "text-label text-solid-gray-700", children: [
|
|
751
|
-
/* @__PURE__ */ t.jsx("span", { className:
|
|
731
|
+
/* @__PURE__ */ t.jsx("span", { className: g, children: u }),
|
|
752
732
|
"/",
|
|
753
733
|
/* @__PURE__ */ t.jsx("span", { children: s })
|
|
754
734
|
] }) : ""
|
|
755
735
|
] });
|
|
756
736
|
};
|
|
757
|
-
|
|
758
|
-
const
|
|
759
|
-
const i =
|
|
737
|
+
he.displayName = "Textarea";
|
|
738
|
+
const ve = (r) => {
|
|
739
|
+
const i = R.useId(), {
|
|
760
740
|
labelText: c,
|
|
761
741
|
className: n,
|
|
762
742
|
helperText: a,
|
|
@@ -764,7 +744,7 @@ const ye = (r) => {
|
|
|
764
744
|
isInvalid: o,
|
|
765
745
|
isRequired: u,
|
|
766
746
|
children: d,
|
|
767
|
-
...
|
|
747
|
+
...x
|
|
768
748
|
} = r, f = {
|
|
769
749
|
id: r.htmlFor ?? `input-${i}`,
|
|
770
750
|
helperTextId: `helper-text-${i}`,
|
|
@@ -772,13 +752,13 @@ const ye = (r) => {
|
|
|
772
752
|
isInvalid: o ?? !1,
|
|
773
753
|
isRequired: u ?? !1
|
|
774
754
|
};
|
|
775
|
-
return /* @__PURE__ */ t.jsx(
|
|
755
|
+
return /* @__PURE__ */ t.jsx(T.Provider, { value: f, children: /* @__PURE__ */ t.jsxs("div", { className: y("flex flex-col items-start gap-2", n), children: [
|
|
776
756
|
/* @__PURE__ */ t.jsxs(
|
|
777
757
|
"label",
|
|
778
758
|
{
|
|
779
|
-
className:
|
|
759
|
+
className: y("block text-label", o && "text-red-800"),
|
|
780
760
|
htmlFor: f.id,
|
|
781
|
-
...
|
|
761
|
+
...x,
|
|
782
762
|
children: [
|
|
783
763
|
c,
|
|
784
764
|
u && /* @__PURE__ */ t.jsx("span", { className: "text-label text-red-800", children: " *" })
|
|
@@ -794,9 +774,9 @@ const ye = (r) => {
|
|
|
794
774
|
`, children: s })
|
|
795
775
|
] }) });
|
|
796
776
|
};
|
|
797
|
-
|
|
798
|
-
const
|
|
799
|
-
const i =
|
|
777
|
+
ve.displayName = "LabelControl";
|
|
778
|
+
const $ = (r) => {
|
|
779
|
+
const i = R.useId(), {
|
|
800
780
|
labelText: c,
|
|
801
781
|
className: n,
|
|
802
782
|
helperText: a,
|
|
@@ -804,34 +784,34 @@ const q = (r) => {
|
|
|
804
784
|
isInvalid: o,
|
|
805
785
|
isRequired: u,
|
|
806
786
|
direction: d,
|
|
807
|
-
children:
|
|
787
|
+
children: x,
|
|
808
788
|
...f
|
|
809
|
-
} = r,
|
|
789
|
+
} = r, h = {
|
|
810
790
|
groupName: f.name ?? `group-${i}`,
|
|
811
791
|
helperTextId: `helper-text-${i}`,
|
|
812
792
|
errorMessageId: `error-message-${i}`,
|
|
813
793
|
isInvalid: o ?? !1,
|
|
814
794
|
isRequired: u ?? !1
|
|
815
|
-
},
|
|
816
|
-
return /* @__PURE__ */ t.jsx(
|
|
795
|
+
}, v = d ?? "flex-col";
|
|
796
|
+
return /* @__PURE__ */ t.jsx(T.Provider, { value: h, children: /* @__PURE__ */ t.jsxs(
|
|
817
797
|
"fieldset",
|
|
818
798
|
{
|
|
819
|
-
className:
|
|
799
|
+
className: y("flex flex-col items-start gap-2", n),
|
|
820
800
|
...f,
|
|
821
801
|
children: [
|
|
822
|
-
/* @__PURE__ */ t.jsx("legend", { children: /* @__PURE__ */ t.jsxs("p", { className:
|
|
802
|
+
/* @__PURE__ */ t.jsx("legend", { children: /* @__PURE__ */ t.jsxs("p", { className: y("block text-label", o && "text-red-800"), children: [
|
|
823
803
|
c,
|
|
824
804
|
u && /* @__PURE__ */ t.jsx("span", { className: "text-red-800", children: " *" })
|
|
825
805
|
] }) }),
|
|
826
|
-
/* @__PURE__ */ t.jsx("div", { className:
|
|
827
|
-
a && /* @__PURE__ */ t.jsx("p", { id:
|
|
828
|
-
o && /* @__PURE__ */ t.jsx("p", { id:
|
|
806
|
+
/* @__PURE__ */ t.jsx("div", { className: y("inline-flex", v), children: x }),
|
|
807
|
+
a && /* @__PURE__ */ t.jsx("p", { id: h.helperTextId, className: "text-sup text-solid-gray-700", children: a }),
|
|
808
|
+
o && /* @__PURE__ */ t.jsx("p", { id: h.errorMessageId, className: "text-label text-red-800", children: s })
|
|
829
809
|
]
|
|
830
810
|
}
|
|
831
811
|
) });
|
|
832
812
|
};
|
|
833
|
-
|
|
834
|
-
const
|
|
813
|
+
$.displayName = "FieldsetControl";
|
|
814
|
+
const ye = (r) => {
|
|
835
815
|
const {
|
|
836
816
|
items: i,
|
|
837
817
|
onChange: c,
|
|
@@ -841,11 +821,11 @@ const Re = (r) => {
|
|
|
841
821
|
errorMessage: o,
|
|
842
822
|
isInvalid: u,
|
|
843
823
|
isRequired: d,
|
|
844
|
-
size:
|
|
824
|
+
size: x,
|
|
845
825
|
...f
|
|
846
826
|
} = r;
|
|
847
827
|
return /* @__PURE__ */ t.jsx(
|
|
848
|
-
|
|
828
|
+
$,
|
|
849
829
|
{
|
|
850
830
|
className: n,
|
|
851
831
|
labelText: a,
|
|
@@ -854,21 +834,21 @@ const Re = (r) => {
|
|
|
854
834
|
isInvalid: u,
|
|
855
835
|
isRequired: d,
|
|
856
836
|
...f,
|
|
857
|
-
children: i.map(({ label:
|
|
858
|
-
|
|
837
|
+
children: i.map(({ label: g, value: h }) => /* @__PURE__ */ t.jsx(
|
|
838
|
+
Z,
|
|
859
839
|
{
|
|
860
|
-
size:
|
|
861
|
-
value:
|
|
840
|
+
size: x,
|
|
841
|
+
value: h,
|
|
862
842
|
onChange: c,
|
|
863
|
-
children:
|
|
843
|
+
children: g
|
|
864
844
|
},
|
|
865
|
-
`${
|
|
845
|
+
`${g}-${h}`
|
|
866
846
|
))
|
|
867
847
|
}
|
|
868
848
|
);
|
|
869
849
|
};
|
|
870
|
-
|
|
871
|
-
const
|
|
850
|
+
ye.displayName = "CheckboxGroup";
|
|
851
|
+
const Re = (r) => {
|
|
872
852
|
const {
|
|
873
853
|
items: i,
|
|
874
854
|
onChange: c,
|
|
@@ -878,12 +858,12 @@ const Ne = (r) => {
|
|
|
878
858
|
errorMessage: o,
|
|
879
859
|
isInvalid: u,
|
|
880
860
|
isRequired: d,
|
|
881
|
-
defaultValue:
|
|
861
|
+
defaultValue: x,
|
|
882
862
|
size: f,
|
|
883
|
-
...
|
|
863
|
+
...g
|
|
884
864
|
} = r;
|
|
885
865
|
return /* @__PURE__ */ t.jsx(
|
|
886
|
-
|
|
866
|
+
$,
|
|
887
867
|
{
|
|
888
868
|
className: n,
|
|
889
869
|
labelText: a,
|
|
@@ -891,31 +871,31 @@ const Ne = (r) => {
|
|
|
891
871
|
errorMessage: o,
|
|
892
872
|
isInvalid: u,
|
|
893
873
|
isRequired: d,
|
|
894
|
-
...
|
|
895
|
-
children: i.map(({ label:
|
|
896
|
-
|
|
874
|
+
...g,
|
|
875
|
+
children: i.map(({ label: h, value: v }) => /* @__PURE__ */ t.jsx(
|
|
876
|
+
Q,
|
|
897
877
|
{
|
|
898
878
|
size: f,
|
|
899
|
-
value:
|
|
879
|
+
value: v,
|
|
900
880
|
onChange: c,
|
|
901
|
-
defaultChecked:
|
|
902
|
-
children:
|
|
881
|
+
defaultChecked: x === v,
|
|
882
|
+
children: h
|
|
903
883
|
},
|
|
904
|
-
`${
|
|
884
|
+
`${h}-${v}`
|
|
905
885
|
))
|
|
906
886
|
}
|
|
907
887
|
);
|
|
908
888
|
};
|
|
909
|
-
|
|
889
|
+
Re.displayName = "RadioGroup";
|
|
910
890
|
export {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
891
|
+
Z as Checkbox,
|
|
892
|
+
ye as CheckboxGroup,
|
|
893
|
+
$ as FieldsetControl,
|
|
894
|
+
xe as FileInput,
|
|
895
|
+
ge as Input,
|
|
896
|
+
ve as LabelControl,
|
|
897
|
+
Q as Radio,
|
|
898
|
+
Re as RadioGroup,
|
|
919
899
|
me as Select,
|
|
920
|
-
|
|
900
|
+
he as Textarea
|
|
921
901
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sakura-ui/forms",
|
|
3
|
-
"version": "0.4.0
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "glassonion1",
|
|
@@ -39,19 +39,19 @@
|
|
|
39
39
|
"test": "vitest"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"react": "^19.
|
|
43
|
-
"react-dom": "^19.
|
|
44
|
-
"tailwindcss": "^4.1.
|
|
42
|
+
"react": "^19.2.1",
|
|
43
|
+
"react-dom": "^19.2.1",
|
|
44
|
+
"tailwindcss": "^4.1.17"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@sakura-ui/helper": "0.0.
|
|
47
|
+
"@sakura-ui/helper": "0.0.6"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@testing-library/jest-dom": "catalog:",
|
|
51
51
|
"@testing-library/react": "catalog:",
|
|
52
52
|
"@types/react": "catalog:",
|
|
53
53
|
"@types/react-dom": "catalog:",
|
|
54
|
-
"@tailwindcss/vite": "
|
|
54
|
+
"@tailwindcss/vite": "catalog:",
|
|
55
55
|
"autoprefixer": "catalog:",
|
|
56
56
|
"happy-dom": "catalog:",
|
|
57
57
|
"postcss": "catalog:",
|