@vlrc-fe/components 1.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/README.md +193 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +42 -0
- package/dist/index10.cjs +1 -0
- package/dist/index10.js +85 -0
- package/dist/index100.cjs +1 -0
- package/dist/index100.js +65 -0
- package/dist/index101.cjs +1 -0
- package/dist/index101.js +48 -0
- package/dist/index102.cjs +1 -0
- package/dist/index102.js +67 -0
- package/dist/index103.cjs +1 -0
- package/dist/index103.js +151 -0
- package/dist/index104.cjs +1 -0
- package/dist/index104.js +23 -0
- package/dist/index105.cjs +1 -0
- package/dist/index105.js +27 -0
- package/dist/index106.cjs +1 -0
- package/dist/index106.js +53 -0
- package/dist/index107.cjs +1 -0
- package/dist/index107.js +161 -0
- package/dist/index108.cjs +1 -0
- package/dist/index108.js +16 -0
- package/dist/index109.cjs +1 -0
- package/dist/index11.cjs +1 -0
- package/dist/index11.js +86 -0
- package/dist/index12.cjs +1 -0
- package/dist/index12.js +122 -0
- package/dist/index13.cjs +1 -0
- package/dist/index13.js +14 -0
- package/dist/index14.cjs +1 -0
- package/dist/index14.js +16 -0
- package/dist/index15.cjs +1 -0
- package/dist/index15.js +115 -0
- package/dist/index16.cjs +1 -0
- package/dist/index16.js +727 -0
- package/dist/index17.cjs +1 -0
- package/dist/index17.js +348 -0
- package/dist/index18.cjs +1 -0
- package/dist/index18.js +76 -0
- package/dist/index19.cjs +1 -0
- package/dist/index19.js +14 -0
- package/dist/index2.cjs +1 -0
- package/dist/index2.js +122 -0
- package/dist/index20.cjs +1 -0
- package/dist/index20.js +116 -0
- package/dist/index21.cjs +1 -0
- package/dist/index21.js +35 -0
- package/dist/index22.cjs +1 -0
- package/dist/index22.js +18 -0
- package/dist/index23.cjs +1 -0
- package/dist/index23.js +27 -0
- package/dist/index24.cjs +1 -0
- package/dist/index24.js +35 -0
- package/dist/index25.cjs +1 -0
- package/dist/index25.js +97 -0
- package/dist/index26.cjs +1 -0
- package/dist/index26.js +28 -0
- package/dist/index27.cjs +1 -0
- package/dist/index27.js +14 -0
- package/dist/index28.cjs +1 -0
- package/dist/index28.js +67 -0
- package/dist/index29.cjs +1 -0
- package/dist/index29.js +13 -0
- package/dist/index3.cjs +1 -0
- package/dist/index3.js +8 -0
- package/dist/index30.cjs +1 -0
- package/dist/index30.js +35 -0
- package/dist/index31.cjs +1 -0
- package/dist/index31.js +43 -0
- package/dist/index32.cjs +1 -0
- package/dist/index32.js +14 -0
- package/dist/index33.cjs +1 -0
- package/dist/index33.js +64 -0
- package/dist/index34.cjs +1 -0
- package/dist/index34.js +23 -0
- package/dist/index35.cjs +1 -0
- package/dist/index35.js +34 -0
- package/dist/index36.cjs +1 -0
- package/dist/index36.js +27 -0
- package/dist/index37.cjs +1 -0
- package/dist/index37.js +26 -0
- package/dist/index38.cjs +1 -0
- package/dist/index38.js +157 -0
- package/dist/index39.cjs +1 -0
- package/dist/index39.js +34 -0
- package/dist/index4.cjs +1 -0
- package/dist/index4.js +43 -0
- package/dist/index40.cjs +1 -0
- package/dist/index40.js +46 -0
- package/dist/index41.cjs +1 -0
- package/dist/index41.js +118 -0
- package/dist/index42.cjs +1 -0
- package/dist/index42.js +125 -0
- package/dist/index43.cjs +1 -0
- package/dist/index43.js +26 -0
- package/dist/index44.cjs +1 -0
- package/dist/index44.js +88 -0
- package/dist/index45.cjs +1 -0
- package/dist/index45.js +221 -0
- package/dist/index46.cjs +1 -0
- package/dist/index46.js +166 -0
- package/dist/index47.cjs +1 -0
- package/dist/index47.js +126 -0
- package/dist/index48.cjs +1 -0
- package/dist/index48.js +15 -0
- package/dist/index49.cjs +1 -0
- package/dist/index49.js +9 -0
- package/dist/index5.cjs +1 -0
- package/dist/index5.js +24 -0
- package/dist/index50.cjs +1 -0
- package/dist/index50.js +17 -0
- package/dist/index51.cjs +1 -0
- package/dist/index51.js +22 -0
- package/dist/index52.cjs +1 -0
- package/dist/index52.js +18 -0
- package/dist/index53.cjs +1 -0
- package/dist/index53.js +6 -0
- package/dist/index54.cjs +1 -0
- package/dist/index54.js +7 -0
- package/dist/index55.cjs +1 -0
- package/dist/index55.js +8 -0
- package/dist/index56.cjs +1 -0
- package/dist/index56.js +7 -0
- package/dist/index57.cjs +1 -0
- package/dist/index57.js +7 -0
- package/dist/index58.cjs +1 -0
- package/dist/index58.js +9 -0
- package/dist/index59.cjs +1 -0
- package/dist/index59.js +69 -0
- package/dist/index6.cjs +1 -0
- package/dist/index6.js +51 -0
- package/dist/index60.cjs +1 -0
- package/dist/index60.js +11 -0
- package/dist/index61.cjs +1 -0
- package/dist/index61.js +202 -0
- package/dist/index62.cjs +1 -0
- package/dist/index62.js +124 -0
- package/dist/index63.cjs +1 -0
- package/dist/index63.js +32 -0
- package/dist/index64.cjs +1 -0
- package/dist/index64.js +20 -0
- package/dist/index65.cjs +1 -0
- package/dist/index65.js +69 -0
- package/dist/index66.cjs +1 -0
- package/dist/index66.js +32 -0
- package/dist/index67.cjs +1 -0
- package/dist/index67.js +11 -0
- package/dist/index68.cjs +1 -0
- package/dist/index68.js +280 -0
- package/dist/index69.cjs +1 -0
- package/dist/index69.js +157 -0
- package/dist/index7.cjs +1 -0
- package/dist/index7.js +88 -0
- package/dist/index70.cjs +1 -0
- package/dist/index70.js +20 -0
- package/dist/index71.cjs +1 -0
- package/dist/index71.js +10 -0
- package/dist/index72.cjs +1 -0
- package/dist/index72.js +14 -0
- package/dist/index73.cjs +1 -0
- package/dist/index73.js +8 -0
- package/dist/index74.cjs +1 -0
- package/dist/index74.js +8 -0
- package/dist/index75.cjs +1 -0
- package/dist/index75.js +11 -0
- package/dist/index76.cjs +1 -0
- package/dist/index76.js +10 -0
- package/dist/index77.cjs +1 -0
- package/dist/index77.js +6 -0
- package/dist/index78.cjs +1 -0
- package/dist/index78.js +8 -0
- package/dist/index79.cjs +1 -0
- package/dist/index79.js +8 -0
- package/dist/index8.cjs +1 -0
- package/dist/index8.js +68 -0
- package/dist/index80.cjs +1 -0
- package/dist/index80.js +10 -0
- package/dist/index81.cjs +1 -0
- package/dist/index81.js +11 -0
- package/dist/index82.cjs +1 -0
- package/dist/index82.js +15 -0
- package/dist/index83.cjs +1 -0
- package/dist/index83.js +11 -0
- package/dist/index84.cjs +1 -0
- package/dist/index84.js +11 -0
- package/dist/index85.cjs +1 -0
- package/dist/index85.js +6 -0
- package/dist/index86.cjs +1 -0
- package/dist/index86.js +43 -0
- package/dist/index87.cjs +1 -0
- package/dist/index87.js +382 -0
- package/dist/index88.cjs +1 -0
- package/dist/index88.js +40 -0
- package/dist/index89.cjs +1 -0
- package/dist/index89.js +23 -0
- package/dist/index9.cjs +1 -0
- package/dist/index9.js +20 -0
- package/dist/index90.cjs +1 -0
- package/dist/index90.js +59 -0
- package/dist/index91.cjs +1 -0
- package/dist/index91.js +55 -0
- package/dist/index92.cjs +1 -0
- package/dist/index92.js +54 -0
- package/dist/index93.cjs +1 -0
- package/dist/index93.js +57 -0
- package/dist/index94.cjs +1 -0
- package/dist/index94.js +57 -0
- package/dist/index95.cjs +1 -0
- package/dist/index95.js +88 -0
- package/dist/index96.cjs +1 -0
- package/dist/index96.js +66 -0
- package/dist/index97.cjs +1 -0
- package/dist/index97.js +594 -0
- package/dist/index98.cjs +9 -0
- package/dist/index98.js +30 -0
- package/dist/index99.cjs +1 -0
- package/dist/index99.js +50 -0
- package/package.json +82 -0
package/dist/index17.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("./index2.cjs"),t=require("./index4.cjs");let n=require("lucide-react"),r=require("react");r=e.__toESM(r,1);let i=require("react/jsx-runtime"),a=require("@radix-ui/react-slot"),o=require("@radix-ui/react-direction");var s=`FileUpload`,c=`FileUploadDropzone`,l=`FileUploadTrigger`,u=`FileUploadList`,d=`FileUploadItem`,f=`FileUploadItemPreview`,p=`FileUploadItemMetadata`,m=`FileUploadItemProgress`,h=`FileUploadItemDelete`,g=`FileUploadClear`;function _(e){let t=r.useRef(null);return t.current===null&&(t.current=e()),t}function v(e,t,n,r,i){let a={files:t,dragOver:!1,invalid:r};function o(e,r){switch(r.type){case`ADD_FILES`:for(let e of r.files)t.set(e,{file:e,progress:0,status:`idle`});return i&&i(Array.from(t.values()).map(e=>e.file)),{...e,files:t};case`SET_FILES`:{let n=new Set(r.files);for(let e of t.keys())n.has(e)||t.delete(e);for(let e of r.files)t.get(e)||t.set(e,{file:e,progress:0,status:`idle`});return{...e,files:t}}case`SET_PROGRESS`:{let n=t.get(r.file);return n&&t.set(r.file,{...n,progress:r.progress,status:`uploading`}),{...e,files:t}}case`SET_SUCCESS`:{let n=t.get(r.file);return n&&t.set(r.file,{...n,progress:100,status:`success`}),{...e,files:t}}case`SET_ERROR`:{let n=t.get(r.file);return n&&t.set(r.file,{...n,error:r.error,status:`error`}),{...e,files:t}}case`REMOVE_FILE`:if(n){let e=n.get(r.file);e&&(URL.revokeObjectURL(e),n.delete(r.file))}return t.delete(r.file),i&&i(Array.from(t.values()).map(e=>e.file)),{...e,files:t};case`SET_DRAG_OVER`:return{...e,dragOver:r.dragOver};case`SET_INVALID`:return{...e,invalid:r.invalid};case`CLEAR`:if(n)for(let e of t.keys()){let t=n.get(e);t&&(URL.revokeObjectURL(t),n.delete(e))}return t.clear(),i&&i([]),{...e,files:t,invalid:!1};default:return e}}function s(){return a}function c(t){a=o(a,t);for(let t of e)t()}function l(t){return e.add(t),()=>e.delete(t)}return{getState:s,dispatch:c,subscribe:l}}var y=r.createContext(null);function b(e){let t=r.useContext(y);if(!t)throw Error(`\`${e}\` must be used within \`${s}\``);return t}function x(e){let t=b(`useStore`),n=_(()=>null),i=r.useCallback(()=>{let r=t.getState(),i=n.current;if(i&&i.state===r)return i.value;let a=e(r);return n.current={value:a,state:r},a},[t,e,n]);return r.useSyncExternalStore(t.subscribe,i,i)}var S=r.createContext(null);function C(e){let t=r.useContext(S);if(!t)throw Error(`\`${e}\` must be used within \`${s}\``);return t}function w(e){let{value:n,defaultValue:s,onValueChange:c,onAccept:l,onFileAccept:u,onFileReject:d,onFileValidate:f,onUpload:p,accept:m,maxFiles:h,maxSize:g,dir:b,label:x,name:C,asChild:w,disabled:T=!1,invalid:E=!1,multiple:D=!1,required:O=!1,children:k,className:A,...j}=e,M=r.useId(),N=r.useId(),P=r.useId(),F=r.useId(),I=(0,o.useDirection)(b),L=_(()=>new Set).current,R=_(()=>new Map).current,z=_(()=>new WeakMap).current,B=r.useRef(null),V=n!==void 0,H=r.useMemo(()=>v(L,R,z,E,c),[L,R,E,c,z]),U=r.useMemo(()=>m?.split(`,`).map(e=>e.trim())??null,[m]),W=_(()=>{let e=0;return(t,n)=>{e||=requestAnimationFrame(()=>{e=0,H.dispatch({type:`SET_PROGRESS`,file:t,progress:Math.min(Math.max(0,n),100)})})}}).current;r.useEffect(()=>{V?H.dispatch({type:`SET_FILES`,files:n}):s&&s.length>0&&!H.getState().files.size&&H.dispatch({type:`SET_FILES`,files:s})},[n,s,V,H]),r.useEffect(()=>()=>{for(let e of R.keys()){let t=z.get(e);t&&URL.revokeObjectURL(t)}},[R,z]);let G=r.useCallback(async e=>{try{for(let t of e)H.dispatch({type:`SET_PROGRESS`,file:t,progress:0});if(p)await p(e,{onProgress:W,onSuccess:e=>{H.dispatch({type:`SET_SUCCESS`,file:e})},onError:(e,t)=>{H.dispatch({type:`SET_ERROR`,file:e,error:t.message??`Upload failed`})}});else for(let t of e)H.dispatch({type:`SET_SUCCESS`,file:t})}catch(t){let n=t instanceof Error?t.message:`Upload failed`;for(let t of e)H.dispatch({type:`SET_ERROR`,file:t,error:n})}},[H,p,W]),K=r.useCallback(e=>{if(T)return;let t=[...e],n=!1;if(h){let e=H.getState().files.size;if(h===1&&e>0&&t.length>0)H.dispatch({type:`CLEAR`});else{let r=Math.max(0,h-e);if(r<t.length){let e=t.slice(r);n=!0,t=t.slice(0,r);for(let t of e){let e=`Maximum ${h} files allowed`;if(f){let n=f(t);n&&(e=n)}d?.(t,e)}}}}let r=[],i=[];for(let e of t){let t=!1,a=``;if(f){let r=f(e);if(r){a=r,d?.(e,a),t=!0,n=!0;continue}}if(U){let r=e.type,i=`.${e.name.split(`.`).pop()}`;U.some(e=>e===r||e===i||e.includes(`/*`)&&r.startsWith(e.replace(`/*`,`/`)))||(a=`File type not accepted`,d?.(e,a),t=!0,n=!0)}g&&e.size>g&&(a=`File too large`,d?.(e,a),t=!0,n=!0),t?i.push({file:e,message:a}):r.push(e)}if(n&&(H.dispatch({type:`SET_INVALID`,invalid:n}),setTimeout(()=>{H.dispatch({type:`SET_INVALID`,invalid:!1})},2e3)),r.length>0){H.dispatch({type:`ADD_FILES`,files:r}),V&&c&&c([...Array.from(H.getState().files.values()).map(e=>e.file)]),l&&l(r);for(let e of r)u?.(e);p&&requestAnimationFrame(()=>{G(r)})}},[H,V,c,l,u,p,G,h,f,d,U,g,T]),q=r.useCallback(e=>{K(Array.from(e.target.files??[])),e.target.value=``},[K]),J=r.useMemo(()=>({dropzoneId:N,inputId:M,listId:P,labelId:F,dir:I,disabled:T,inputRef:B,urlCache:z}),[N,M,P,F,I,T,z]),Y=w?a.Slot:`div`;return(0,i.jsx)(y.Provider,{value:H,children:(0,i.jsx)(S.Provider,{value:J,children:(0,i.jsxs)(Y,{"data-disabled":T?``:void 0,"data-slot":`file-upload`,dir:I,...j,className:t.cn(`relative flex flex-col gap-2`,A),children:[k,(0,i.jsx)(`input`,{type:`file`,id:M,"aria-labelledby":F,"aria-describedby":N,ref:B,tabIndex:-1,accept:m,name:C,className:`sr-only`,disabled:T,multiple:D,required:O,onChange:q}),(0,i.jsx)(`span`,{id:F,className:`sr-only`,children:x??`File upload`})]})})})}function T(e){let{asChild:n,className:o,onClick:s,onDragOver:l,onDragEnter:u,onDragLeave:d,onDrop:f,onPaste:p,onKeyDown:m,...h}=e,g=C(c),_=b(c),v=x(e=>e.dragOver),y=x(e=>e.invalid),S=r.useCallback(e=>{if(s?.(e),e.defaultPrevented)return;let t=e.target;t instanceof HTMLElement&&t.closest(`[data-slot="file-upload-trigger"]`)||g.inputRef.current?.click()},[g.inputRef,s]),w=r.useCallback(e=>{l?.(e),!e.defaultPrevented&&(e.preventDefault(),_.dispatch({type:`SET_DRAG_OVER`,dragOver:!0}))},[_,l]),T=r.useCallback(e=>{u?.(e),!e.defaultPrevented&&(e.preventDefault(),_.dispatch({type:`SET_DRAG_OVER`,dragOver:!0}))},[_,u]),E=r.useCallback(e=>{if(d?.(e),e.defaultPrevented)return;let t=e.relatedTarget;t&&t instanceof Node&&e.currentTarget.contains(t)||(e.preventDefault(),_.dispatch({type:`SET_DRAG_OVER`,dragOver:!1}))},[_,d]),D=r.useCallback(e=>{if(f?.(e),e.defaultPrevented)return;e.preventDefault(),_.dispatch({type:`SET_DRAG_OVER`,dragOver:!1});let t=Array.from(e.dataTransfer.files),n=g.inputRef.current;if(!n)return;let r=new DataTransfer;for(let e of t)r.items.add(e);n.files=r.files,n.dispatchEvent(new Event(`change`,{bubbles:!0}))},[_,g.inputRef,f]),O=r.useCallback(e=>{if(p?.(e),e.defaultPrevented)return;e.preventDefault(),_.dispatch({type:`SET_DRAG_OVER`,dragOver:!1});let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r?.kind===`file`){let e=r.getAsFile();e&&n.push(e)}}if(n.length===0)return;let r=g.inputRef.current;if(!r)return;let i=new DataTransfer;for(let e of n)i.items.add(e);r.files=i.files,r.dispatchEvent(new Event(`change`,{bubbles:!0}))},[_,g.inputRef,p]),k=r.useCallback(e=>{m?.(e),!e.defaultPrevented&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),g.inputRef.current?.click())},[g.inputRef,m]);return(0,i.jsx)(n?a.Slot:`div`,{role:`region`,id:g.dropzoneId,"aria-controls":`${g.inputId} ${g.listId}`,"aria-disabled":g.disabled,"aria-invalid":y,"data-disabled":g.disabled?``:void 0,"data-dragging":v?``:void 0,"data-invalid":y?``:void 0,"data-slot":`file-upload-dropzone`,dir:g.dir,tabIndex:g.disabled?void 0:0,...h,className:t.cn(`relative flex select-none flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-6 outline-none transition-colors hover:bg-accent/30 focus-visible:border-ring/50 data-disabled:pointer-events-none data-dragging:border-primary/30 data-invalid:border-destructive data-dragging:bg-accent/30 data-invalid:ring-destructive/20`,o),onClick:S,onDragEnter:T,onDragLeave:E,onDragOver:w,onDrop:D,onKeyDown:k,onPaste:O})}function E(e){let{asChild:t,onClick:n,...o}=e,s=C(l),c=r.useCallback(e=>{n?.(e),!e.defaultPrevented&&s.inputRef.current?.click()},[s.inputRef,n]);return(0,i.jsx)(t?a.Slot:`button`,{type:`button`,"aria-controls":s.inputId,"data-disabled":s.disabled?``:void 0,"data-slot":`file-upload-trigger`,...o,disabled:s.disabled,onClick:c})}function D(e){let{className:n,orientation:r=`vertical`,asChild:o,forceMount:s,...c}=e,l=C(u),d=x(e=>e.files.size),f=s||d>0;return f?(0,i.jsx)(o?a.Slot:`div`,{role:`list`,id:l.listId,"aria-orientation":r,"data-orientation":r,"data-slot":`file-upload-list`,"data-state":f?`active`:`inactive`,dir:l.dir,...c,className:t.cn(`data-[state=inactive]:fade-out-0 data-[state=active]:fade-in-0 data-[state=inactive]:slide-out-to-top-2 data-[state=active]:slide-in-from-top-2 flex flex-col gap-2 data-[state=active]:animate-in data-[state=inactive]:animate-out`,r===`horizontal`&&`flex-row overflow-x-auto p-1.5`,n)}):null}var O=r.createContext(null);function k(e){let t=r.useContext(O);if(!t)throw Error(`\`${e}\` must be used within \`${d}\``);return t}function A(e){let{value:n,asChild:o,className:s,...c}=e,l=r.useId(),u=`${l}-status`,f=`${l}-name`,p=`${l}-size`,m=`${l}-message`,h=C(d),g=x(e=>e.files.get(n)),_=x(e=>e.files.size),v=x(e=>Array.from(e.files.keys()).indexOf(n)+1),y=r.useMemo(()=>({id:l,fileState:g,nameId:f,sizeId:p,statusId:u,messageId:m}),[l,g,u,f,p,m]);if(!g)return null;let b=g.error?`Error: ${g.error}`:g.status===`uploading`?`Uploading: ${g.progress}% complete`:g.status===`success`?`Upload complete`:`Ready to upload`,S=o?a.Slot:`div`;return(0,i.jsx)(O.Provider,{value:y,children:(0,i.jsxs)(S,{role:`listitem`,id:l,"aria-setsize":_,"aria-posinset":v,"aria-describedby":`${f} ${p} ${u} ${g.error?m:``}`,"aria-labelledby":f,"data-slot":`file-upload-item`,dir:h.dir,...c,className:t.cn(`relative flex items-center gap-2.5 rounded-md border p-3`,s),children:[e.children,(0,i.jsx)(`span`,{id:u,className:`sr-only`,children:b})]})})}function j(e){if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**n).toFixed(+!!n)} ${t[n]}`}function M(e){let t=e.type,r=e.name.split(`.`).pop()?.toLowerCase()??``;return t.startsWith(`video/`)?(0,i.jsx)(n.FileVideoIcon,{}):t.startsWith(`audio/`)?(0,i.jsx)(n.FileAudioIcon,{}):t.startsWith(`text/`)||[`txt`,`md`,`rtf`,`pdf`].includes(r)?(0,i.jsx)(n.FileTextIcon,{}):[`html`,`css`,`js`,`jsx`,`ts`,`tsx`,`json`,`xml`,`php`,`py`,`rb`,`java`,`c`,`cpp`,`cs`].includes(r)?(0,i.jsx)(n.FileCodeIcon,{}):[`zip`,`rar`,`7z`,`tar`,`gz`,`bz2`].includes(r)?(0,i.jsx)(n.FileArchiveIcon,{}):[`exe`,`msi`,`app`,`apk`,`deb`,`rpm`].includes(r)||t.startsWith(`application/`)?(0,i.jsx)(n.FileCogIcon,{}):(0,i.jsx)(n.FileIcon,{})}function N(e){let{render:n,asChild:o,children:s,className:c,...l}=e,u=k(f),d=C(f),p=r.useCallback(e=>{if(u.fileState?.file.type.startsWith(`image/`)){let t=d.urlCache.get(e);return t||(t=URL.createObjectURL(e),d.urlCache.set(e,t)),(0,i.jsx)(`img`,{src:t,alt:e.name,className:`size-full object-cover`})}return M(e)},[u.fileState?.file.type,d.urlCache]),m=r.useCallback(e=>n?n(e,()=>p(e)):p(e),[n,p]);return u.fileState?(0,i.jsxs)(o?a.Slot:`div`,{"aria-labelledby":u.nameId,"data-slot":`file-upload-preview`,...l,className:t.cn(`relative flex size-10 shrink-0 items-center justify-center overflow-hidden rounded border bg-accent/50 [&>svg]:size-10`,c),children:[m(u.fileState.file),s]}):null}function P(e){let{asChild:n,size:r=`default`,children:o,className:s,...c}=e,l=C(p),u=k(p);return u.fileState?(0,i.jsx)(n?a.Slot:`div`,{"data-slot":`file-upload-metadata`,dir:l.dir,...c,className:t.cn(`flex min-w-0 flex-1 flex-col`,s),children:o??(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{id:u.nameId,className:t.cn(`truncate font-medium text-sm`,r===`sm`&&`font-normal text-[13px] leading-snug`),children:u.fileState.file.name}),(0,i.jsx)(`span`,{id:u.sizeId,className:t.cn(`truncate text-muted-foreground text-xs`,r===`sm`&&`text-[11px] leading-snug`),children:j(u.fileState.file.size)}),u.fileState.error&&(0,i.jsx)(`span`,{id:u.messageId,className:`text-destructive text-xs`,children:u.fileState.error})]})}):null}function F(e){let{variant:n=`linear`,size:r=40,asChild:o,forceMount:s,className:c,...l}=e,u=k(m);if(!u.fileState||!(s||u.fileState.progress!==100))return null;let d=o?a.Slot:`div`;switch(n){case`circular`:{let e=2*Math.PI*((r-4)/2),n=e-u.fileState.progress/100*e;return(0,i.jsx)(d,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":u.fileState.progress,"aria-valuetext":`${u.fileState.progress}%`,"aria-labelledby":u.nameId,"data-slot":`file-upload-progress`,...l,className:t.cn(`-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2`,c),children:(0,i.jsxs)(`svg`,{className:`-rotate-90 transform`,width:r,height:r,viewBox:`0 0 ${r} ${r}`,fill:`none`,stroke:`currentColor`,children:[(0,i.jsx)(`circle`,{className:`text-primary/20`,strokeWidth:`2`,cx:r/2,cy:r/2,r:(r-4)/2}),(0,i.jsx)(`circle`,{className:`text-primary transition-[stroke-dashoffset] duration-300 ease-linear`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:e,strokeDashoffset:n,cx:r/2,cy:r/2,r:(r-4)/2})]})})}case`fill`:{let e=u.fileState.progress,n=100-e;return(0,i.jsx)(d,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e,"aria-valuetext":`${e}%`,"aria-labelledby":u.nameId,"data-slot":`file-upload-progress`,...l,className:t.cn(`absolute inset-0 bg-primary/50 transition-[clip-path] duration-300 ease-linear`,c),style:{clipPath:`inset(${n}% 0% 0% 0%)`}})}default:return(0,i.jsx)(d,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":u.fileState.progress,"aria-valuetext":`${u.fileState.progress}%`,"aria-labelledby":u.nameId,"data-slot":`file-upload-progress`,...l,className:t.cn(`relative h-1.5 w-full overflow-hidden rounded-full bg-primary/20`,c),children:(0,i.jsx)(`div`,{className:`h-full w-full flex-1 bg-primary transition-transform duration-300 ease-linear`,style:{transform:`translateX(-${100-u.fileState.progress}%)`}})})}}function I(e){let{asChild:t,onClick:n,...o}=e,s=b(h),c=k(h),l=r.useCallback(e=>{n?.(e),!(!c.fileState||e.defaultPrevented)&&s.dispatch({type:`REMOVE_FILE`,file:c.fileState.file})},[s,c.fileState,n]);return c.fileState?(0,i.jsx)(t?a.Slot:`button`,{type:`button`,"aria-controls":c.id,"aria-describedby":c.nameId,"data-slot":`file-upload-item-delete`,...o,onClick:l}):null}function L(e){let{asChild:t,forceMount:n,disabled:o,onClick:s,...c}=e,l=C(g),u=b(g),d=x(e=>e.files.size),f=o||l.disabled,p=r.useCallback(e=>{s?.(e),!e.defaultPrevented&&u.dispatch({type:`CLEAR`})},[u,s]);return n||d>0?(0,i.jsx)(t?a.Slot:`button`,{type:`button`,"aria-controls":l.listId,"data-slot":`file-upload-clear`,"data-disabled":f?``:void 0,...c,disabled:f,onClick:p}):null}exports.FileUploadClear=L,exports.FileUploadDropzone=T,exports.FileUploadItem=A,exports.FileUploadItemDelete=I,exports.FileUploadItemMetadata=P,exports.FileUploadItemPreview=N,exports.FileUploadItemProgress=F,exports.FileUploadList=D,exports.FileUploadRoot=w,exports.FileUploadTrigger=E,exports.useStore=x;
|
package/dist/index17.js
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
//#region ../../node_modules/.pnpm/react-hook-form@7.83.0_react@19.2.8/node_modules/react-hook-form/dist/index.esm.mjs
|
|
3
|
+
var t = (e) => e.type === "checkbox", n = (e) => e.type === "file", r = (e) => e instanceof Date, i = (e) => e == null, a = (e) => typeof e == "object", o = (e) => !i(e) && !Array.isArray(e) && a(e) && !r(e), s = (e) => o(e) && e.target ? t(e.target) ? e.target.checked : n(e.target) ? e.target.files : e.target.value : e, c = (e, t) => t.split(".").some((t, n, r) => !isNaN(Number(t)) && e.has(r.slice(0, n).join("."))), l = (e) => {
|
|
4
|
+
let t = e.constructor && e.constructor.prototype;
|
|
5
|
+
return o(t) && t.hasOwnProperty("isPrototypeOf");
|
|
6
|
+
}, u = typeof window < "u" && window.HTMLElement !== void 0 && typeof document < "u";
|
|
7
|
+
function d(e) {
|
|
8
|
+
if (e instanceof Date) return new Date(e);
|
|
9
|
+
let t = typeof FileList < "u" && e instanceof FileList;
|
|
10
|
+
if (u && (e instanceof Blob || t)) return e;
|
|
11
|
+
let n = Array.isArray(e);
|
|
12
|
+
if (!n && !(o(e) && l(e))) return e;
|
|
13
|
+
let r = n ? [] : Object.create(Object.getPrototypeOf(e));
|
|
14
|
+
for (let t in e) Object.prototype.hasOwnProperty.call(e, t) && (r[t] = d(e[t]));
|
|
15
|
+
return r;
|
|
16
|
+
}
|
|
17
|
+
var f = {
|
|
18
|
+
BLUR: "blur",
|
|
19
|
+
FOCUS_OUT: "focusout",
|
|
20
|
+
CHANGE: "change",
|
|
21
|
+
SUBMIT: "submit",
|
|
22
|
+
TRIGGER: "trigger",
|
|
23
|
+
VALID: "valid"
|
|
24
|
+
}, p = {
|
|
25
|
+
onBlur: "onBlur",
|
|
26
|
+
onChange: "onChange",
|
|
27
|
+
onSubmit: "onSubmit",
|
|
28
|
+
onTouched: "onTouched",
|
|
29
|
+
all: "all"
|
|
30
|
+
}, m = [
|
|
31
|
+
"__proto__",
|
|
32
|
+
"constructor",
|
|
33
|
+
"prototype"
|
|
34
|
+
], h = /^\w*$/, g = (e) => h.test(e), _ = (e) => e === void 0, v = /[.[\]'"]/, y = (e) => e.split(v).filter(Boolean), b = (e, t, n) => {
|
|
35
|
+
if (!t || !o(e)) return n;
|
|
36
|
+
let r = g(t) ? [t] : y(t);
|
|
37
|
+
if (r.some((e) => m.includes(e))) return n;
|
|
38
|
+
let a = r.reduce((e, t) => i(e) ? void 0 : e[t], e);
|
|
39
|
+
return _(a) || a === e ? _(e[t]) ? n : e[t] : a;
|
|
40
|
+
}, x = (e) => typeof e == "boolean", S = (e) => typeof e == "function", C = (e, t, n) => {
|
|
41
|
+
let r = -1, i = g(t) ? [t] : y(t), a = i.length, s = a - 1;
|
|
42
|
+
for (; ++r < a;) {
|
|
43
|
+
let t = i[r], a = n;
|
|
44
|
+
if (r !== s) {
|
|
45
|
+
let n = e[t];
|
|
46
|
+
a = o(n) || Array.isArray(n) ? n : isNaN(+i[r + 1]) ? {} : [];
|
|
47
|
+
}
|
|
48
|
+
if (m.includes(t)) return;
|
|
49
|
+
e[t] = a, e = e[t];
|
|
50
|
+
}
|
|
51
|
+
}, w = e.createContext(null);
|
|
52
|
+
w.displayName = "HookFormControlContext";
|
|
53
|
+
var T = () => e.useContext(w), E = (e, t, n, r = !0) => {
|
|
54
|
+
let i = {};
|
|
55
|
+
for (let a in e) Object.defineProperty(i, a, { get: () => {
|
|
56
|
+
let i = a;
|
|
57
|
+
return t._proxyFormState[i] !== p.all && (t._proxyFormState[i] = !r || p.all), n && (n[i] = !0), e[i];
|
|
58
|
+
} });
|
|
59
|
+
return i;
|
|
60
|
+
}, D = u ? e.useLayoutEffect : e.useEffect;
|
|
61
|
+
function O(t) {
|
|
62
|
+
let n = T(), { control: r = n, disabled: i, name: a, exact: o } = t || {}, [s, c] = e.useState(() => ({
|
|
63
|
+
...r._formState,
|
|
64
|
+
defaultValues: r._defaultValues
|
|
65
|
+
})), l = e.useRef({
|
|
66
|
+
isDirty: !1,
|
|
67
|
+
isLoading: !1,
|
|
68
|
+
dirtyFields: !1,
|
|
69
|
+
touchedFields: !1,
|
|
70
|
+
validatingFields: !1,
|
|
71
|
+
isValidating: !1,
|
|
72
|
+
isValid: !1,
|
|
73
|
+
errors: !1
|
|
74
|
+
});
|
|
75
|
+
return D(() => r._subscribe({
|
|
76
|
+
name: a,
|
|
77
|
+
formState: l.current,
|
|
78
|
+
exact: o,
|
|
79
|
+
callback: (e) => {
|
|
80
|
+
!i && c({
|
|
81
|
+
...r._formState,
|
|
82
|
+
...e,
|
|
83
|
+
defaultValues: r._defaultValues
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}), [
|
|
87
|
+
a,
|
|
88
|
+
i,
|
|
89
|
+
o
|
|
90
|
+
]), e.useEffect(() => {
|
|
91
|
+
l.current.isValid && r._setValid(!0);
|
|
92
|
+
}, [r]), e.useMemo(() => E(s, r, l.current, !1), [s, r]);
|
|
93
|
+
}
|
|
94
|
+
var k = (e) => typeof e == "string", A = (e, t, n, r, i) => k(e) ? (r && t.watch.add(e), b(n, e, i)) : Array.isArray(e) ? e.map((e) => (r && t.watch.add(e), b(n, e))) : (r && (t.watchAll = !0), n), j = (e) => i(e) || !a(e), M = (e, t) => t.length === 0 && !Array.isArray(e) && !l(e);
|
|
95
|
+
function N(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
96
|
+
if (e === t) return !0;
|
|
97
|
+
if (j(e) || j(t)) return Object.is(e, t);
|
|
98
|
+
if (r(e) && r(t)) return Object.is(e.getTime(), t.getTime());
|
|
99
|
+
let i = Object.keys(e), a = Object.keys(t);
|
|
100
|
+
if (i.length !== a.length) return !1;
|
|
101
|
+
if (M(e, i) || M(t, a)) return Object.is(e, t);
|
|
102
|
+
if (!i.length && Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
103
|
+
let s = n.get(e);
|
|
104
|
+
if (s && s.has(t)) return !0;
|
|
105
|
+
if (s) s.add(t);
|
|
106
|
+
else {
|
|
107
|
+
let r = /* @__PURE__ */ new WeakSet();
|
|
108
|
+
r.add(t), n.set(e, r);
|
|
109
|
+
}
|
|
110
|
+
for (let a of i) {
|
|
111
|
+
let i = e[a];
|
|
112
|
+
if (!(a in t)) return !1;
|
|
113
|
+
if (a !== "ref") {
|
|
114
|
+
let e = t[a];
|
|
115
|
+
if (r(i) && r(e) || (o(i) || Array.isArray(i)) && (o(e) || Array.isArray(e)) ? !N(i, e, n) : !Object.is(i, e)) return !1;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return !0;
|
|
119
|
+
}
|
|
120
|
+
function P(t) {
|
|
121
|
+
let n = T(), { control: r = n, name: i, defaultValue: a, disabled: o, exact: s, compute: c } = t || {}, l = e.useRef(a), u = e.useRef(c), d = e.useRef(void 0), f = e.useRef(r), p = e.useRef(i);
|
|
122
|
+
u.current = c;
|
|
123
|
+
let [m, h] = e.useState(() => {
|
|
124
|
+
let e = r._getWatch(i, l.current);
|
|
125
|
+
return u.current ? u.current(e) : e;
|
|
126
|
+
}), g = e.useCallback((e) => {
|
|
127
|
+
let t = A(i, r._names, e || r._formValues, !1, l.current);
|
|
128
|
+
return u.current ? u.current(t) : t;
|
|
129
|
+
}, [
|
|
130
|
+
r._formValues,
|
|
131
|
+
r._names,
|
|
132
|
+
i
|
|
133
|
+
]), _ = e.useCallback((e) => {
|
|
134
|
+
if (!o) {
|
|
135
|
+
let t = A(i, r._names, e || r._formValues, !1, l.current);
|
|
136
|
+
if (u.current) {
|
|
137
|
+
let e = u.current(t);
|
|
138
|
+
N(e, d.current) || (h(e), d.current = e);
|
|
139
|
+
} else h(t);
|
|
140
|
+
}
|
|
141
|
+
}, [
|
|
142
|
+
r._formValues,
|
|
143
|
+
r._names,
|
|
144
|
+
o,
|
|
145
|
+
i
|
|
146
|
+
]);
|
|
147
|
+
D(() => ((f.current !== r || !N(p.current, i)) && (f.current = r, p.current = i, _()), r._subscribe({
|
|
148
|
+
name: i,
|
|
149
|
+
formState: { values: !0 },
|
|
150
|
+
exact: s,
|
|
151
|
+
callback: (e) => {
|
|
152
|
+
_(e.values);
|
|
153
|
+
}
|
|
154
|
+
})), [
|
|
155
|
+
r,
|
|
156
|
+
s,
|
|
157
|
+
i,
|
|
158
|
+
_
|
|
159
|
+
]), e.useEffect(() => r._removeUnmounted());
|
|
160
|
+
let v = f.current !== r, y = p.current, b = e.useMemo(() => {
|
|
161
|
+
if (o) return null;
|
|
162
|
+
let e = !v && !N(y, i);
|
|
163
|
+
return v || e ? g() : null;
|
|
164
|
+
}, [
|
|
165
|
+
o,
|
|
166
|
+
v,
|
|
167
|
+
i,
|
|
168
|
+
y,
|
|
169
|
+
g
|
|
170
|
+
]);
|
|
171
|
+
return b === null ? m : b;
|
|
172
|
+
}
|
|
173
|
+
function F(t) {
|
|
174
|
+
let n = T(), { name: r, disabled: i, control: a = n, shouldUnregister: o, defaultValue: l, exact: u = !0 } = t, p = c(a._names.array, r), m = P({
|
|
175
|
+
control: a,
|
|
176
|
+
name: r,
|
|
177
|
+
defaultValue: e.useMemo(() => b(a._formValues, r, b(a._defaultValues, r, l)), [
|
|
178
|
+
a,
|
|
179
|
+
r,
|
|
180
|
+
l
|
|
181
|
+
]),
|
|
182
|
+
exact: u
|
|
183
|
+
}), h = O({
|
|
184
|
+
control: a,
|
|
185
|
+
name: r,
|
|
186
|
+
exact: u
|
|
187
|
+
}), g = e.useRef(t), v = e.useRef(null), y = e.useRef(a.register(r, {
|
|
188
|
+
...t.rules,
|
|
189
|
+
value: m,
|
|
190
|
+
...x(t.disabled) ? { disabled: t.disabled } : {}
|
|
191
|
+
}));
|
|
192
|
+
g.current = t;
|
|
193
|
+
let w = e.useMemo(() => Object.defineProperties({}, {
|
|
194
|
+
invalid: {
|
|
195
|
+
enumerable: !0,
|
|
196
|
+
get: () => !!b(h.errors, r)
|
|
197
|
+
},
|
|
198
|
+
isDirty: {
|
|
199
|
+
enumerable: !0,
|
|
200
|
+
get: () => !!b(h.dirtyFields, r)
|
|
201
|
+
},
|
|
202
|
+
isTouched: {
|
|
203
|
+
enumerable: !0,
|
|
204
|
+
get: () => !!b(h.touchedFields, r)
|
|
205
|
+
},
|
|
206
|
+
isValidating: {
|
|
207
|
+
enumerable: !0,
|
|
208
|
+
get: () => !!b(h.validatingFields, r)
|
|
209
|
+
},
|
|
210
|
+
error: {
|
|
211
|
+
enumerable: !0,
|
|
212
|
+
get: () => b(h.errors, r)
|
|
213
|
+
}
|
|
214
|
+
}), [h, r]), E = e.useCallback((e) => {
|
|
215
|
+
let t = s(e);
|
|
216
|
+
return b(a._fields, r) || (y.current = a.register(r, {
|
|
217
|
+
...g.current.rules,
|
|
218
|
+
value: t
|
|
219
|
+
})), y.current.onChange({
|
|
220
|
+
target: {
|
|
221
|
+
value: s(e),
|
|
222
|
+
name: r
|
|
223
|
+
},
|
|
224
|
+
type: f.CHANGE
|
|
225
|
+
});
|
|
226
|
+
}, [r, a]), D = e.useCallback(() => y.current.onBlur({
|
|
227
|
+
target: {
|
|
228
|
+
value: b(a._formValues, r),
|
|
229
|
+
name: r
|
|
230
|
+
},
|
|
231
|
+
type: f.BLUR
|
|
232
|
+
}), [r, a._formValues]), k = e.useCallback((e) => {
|
|
233
|
+
e && (v.current = {
|
|
234
|
+
focus: () => S(e.focus) && e.focus(),
|
|
235
|
+
select: () => S(e.select) && e.select(),
|
|
236
|
+
setCustomValidity: (t) => S(e.setCustomValidity) && e.setCustomValidity(t),
|
|
237
|
+
reportValidity: () => S(e.reportValidity) && e.reportValidity()
|
|
238
|
+
});
|
|
239
|
+
let t = b(a._fields, r);
|
|
240
|
+
t && t._f && e && (t._f.ref = v.current);
|
|
241
|
+
}, [a._fields, r]), A = e.useMemo(() => ({
|
|
242
|
+
name: r,
|
|
243
|
+
value: m,
|
|
244
|
+
...x(i) || h.disabled ? { disabled: h.disabled || i } : {},
|
|
245
|
+
onChange: E,
|
|
246
|
+
onBlur: D,
|
|
247
|
+
ref: k
|
|
248
|
+
}), [
|
|
249
|
+
r,
|
|
250
|
+
i,
|
|
251
|
+
h.disabled,
|
|
252
|
+
E,
|
|
253
|
+
D,
|
|
254
|
+
k,
|
|
255
|
+
m
|
|
256
|
+
]);
|
|
257
|
+
return e.useEffect(() => {
|
|
258
|
+
let e = a._options.shouldUnregister || o;
|
|
259
|
+
y.current = a.register(r, {
|
|
260
|
+
...g.current.rules,
|
|
261
|
+
...x(g.current.disabled) ? { disabled: g.current.disabled } : {}
|
|
262
|
+
});
|
|
263
|
+
let t = (e, t) => {
|
|
264
|
+
let n = b(a._fields, e);
|
|
265
|
+
n && n._f && (n._f.mount = t);
|
|
266
|
+
};
|
|
267
|
+
if (t(r, !0), e) {
|
|
268
|
+
let e = d(b(o ? a._defaultValues : a._options.values || a._defaultValues, r, b(a._options.defaultValues, r, g.current.defaultValue)));
|
|
269
|
+
C(a._defaultValues, r, e), _(b(a._formValues, r)) && C(a._formValues, r, e);
|
|
270
|
+
}
|
|
271
|
+
if (!p && a.register(r), v.current) {
|
|
272
|
+
let e = b(a._fields, r);
|
|
273
|
+
e && e._f && (e._f.ref = v.current);
|
|
274
|
+
}
|
|
275
|
+
return () => {
|
|
276
|
+
(p ? e && !a._state.action : e) ? a.unregister(r) : t(r, !1);
|
|
277
|
+
};
|
|
278
|
+
}, [
|
|
279
|
+
r,
|
|
280
|
+
a,
|
|
281
|
+
p,
|
|
282
|
+
o
|
|
283
|
+
]), e.useEffect(() => {
|
|
284
|
+
a._setDisabledField({
|
|
285
|
+
disabled: i,
|
|
286
|
+
name: r
|
|
287
|
+
});
|
|
288
|
+
}, [
|
|
289
|
+
i,
|
|
290
|
+
r,
|
|
291
|
+
a
|
|
292
|
+
]), e.useMemo(() => ({
|
|
293
|
+
field: A,
|
|
294
|
+
formState: h,
|
|
295
|
+
fieldState: w
|
|
296
|
+
}), [
|
|
297
|
+
A,
|
|
298
|
+
h,
|
|
299
|
+
w
|
|
300
|
+
]);
|
|
301
|
+
}
|
|
302
|
+
var I = (e) => e.render(F(e)), L = e.createContext(null);
|
|
303
|
+
L.displayName = "HookFormContext";
|
|
304
|
+
var R = () => e.useContext(L), z = ({ children: t, watch: n, getValues: r, getFieldState: i, setError: a, clearErrors: o, setValue: s, setValues: c, trigger: l, formState: u, resetField: d, reset: f, resetDefaultValues: p, handleSubmit: m, unregister: h, control: g, register: _, setFocus: v, subscribe: y }) => {
|
|
305
|
+
let b = e.useMemo(() => ({
|
|
306
|
+
watch: n,
|
|
307
|
+
getValues: r,
|
|
308
|
+
getFieldState: i,
|
|
309
|
+
setError: a,
|
|
310
|
+
clearErrors: o,
|
|
311
|
+
setValue: s,
|
|
312
|
+
setValues: c,
|
|
313
|
+
trigger: l,
|
|
314
|
+
formState: u,
|
|
315
|
+
resetField: d,
|
|
316
|
+
reset: f,
|
|
317
|
+
resetDefaultValues: p,
|
|
318
|
+
handleSubmit: m,
|
|
319
|
+
unregister: h,
|
|
320
|
+
control: g,
|
|
321
|
+
register: _,
|
|
322
|
+
setFocus: v,
|
|
323
|
+
subscribe: y
|
|
324
|
+
}), [
|
|
325
|
+
o,
|
|
326
|
+
g,
|
|
327
|
+
u,
|
|
328
|
+
i,
|
|
329
|
+
r,
|
|
330
|
+
m,
|
|
331
|
+
_,
|
|
332
|
+
f,
|
|
333
|
+
p,
|
|
334
|
+
d,
|
|
335
|
+
a,
|
|
336
|
+
v,
|
|
337
|
+
s,
|
|
338
|
+
c,
|
|
339
|
+
y,
|
|
340
|
+
l,
|
|
341
|
+
h,
|
|
342
|
+
n
|
|
343
|
+
]);
|
|
344
|
+
return e.createElement(L.Provider, { value: b }, e.createElement(w.Provider, { value: b.control }, t));
|
|
345
|
+
};
|
|
346
|
+
p.onSubmit, p.onChange;
|
|
347
|
+
//#endregion
|
|
348
|
+
export { I as Controller, z as FormProvider, R as useFormContext, O as useFormState };
|
package/dist/index18.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./index2.cjs");let t=require("react");t=e.__toESM(t,1);var n=e=>e.type===`checkbox`,r=e=>e.type===`file`,i=e=>e instanceof Date,a=e=>e==null,o=e=>typeof e==`object`,s=e=>!a(e)&&!Array.isArray(e)&&o(e)&&!i(e),c=e=>s(e)&&e.target?n(e.target)?e.target.checked:r(e.target)?e.target.files:e.target.value:e,l=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),u=e=>{let t=e.constructor&&e.constructor.prototype;return s(t)&&t.hasOwnProperty(`isPrototypeOf`)},d=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function f(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(d&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(s(e)&&u(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=f(e[t]));return r}var p={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},m={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},h=[`__proto__`,`constructor`,`prototype`],g=/^\w*$/,_=e=>g.test(e),v=e=>e===void 0,y=/[.[\]'"]/,b=e=>e.split(y).filter(Boolean),x=(e,t,n)=>{if(!t||!s(e))return n;let r=_(t)?[t]:b(t);if(r.some(e=>h.includes(e)))return n;let i=r.reduce((e,t)=>a(e)?void 0:e[t],e);return v(i)||i===e?v(e[t])?n:e[t]:i},S=e=>typeof e==`boolean`,C=e=>typeof e==`function`,w=(e,t,n)=>{let r=-1,i=_(t)?[t]:b(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=s(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(h.includes(t))return;e[t]=a,e=e[t]}},T=t.default.createContext(null);T.displayName=`HookFormControlContext`;var E=()=>t.default.useContext(T),D=(e,t,n,r=!0)=>{let i={};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==m.all&&(t._proxyFormState[i]=!r||m.all),n&&(n[i]=!0),e[i]}});return i},O=d?t.default.useLayoutEffect:t.default.useEffect;function k(e){let n=E(),{control:r=n,disabled:i,name:a,exact:o}=e||{},[s,c]=t.default.useState(()=>({...r._formState,defaultValues:r._defaultValues})),l=t.default.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return O(()=>r._subscribe({name:a,formState:l.current,exact:o,callback:e=>{!i&&c({...r._formState,...e,defaultValues:r._defaultValues})}}),[a,i,o]),t.default.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),t.default.useMemo(()=>D(s,r,l.current,!1),[s,r])}var A=e=>typeof e==`string`,j=(e,t,n,r,i)=>A(e)?(r&&t.watch.add(e),x(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),x(n,e))):(r&&(t.watchAll=!0),n),M=e=>a(e)||!o(e),N=(e,t)=>t.length===0&&!Array.isArray(e)&&!u(e);function P(e,t,n=new WeakMap){if(e===t)return!0;if(M(e)||M(t))return Object.is(e,t);if(i(e)&&i(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;if(N(e,r)||N(t,a))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;let o=n.get(e);if(o&&o.has(t))return!0;if(o)o.add(t);else{let r=new WeakSet;r.add(t),n.set(e,r)}for(let a of r){let r=e[a];if(!(a in t))return!1;if(a!==`ref`){let e=t[a];if(i(r)&&i(e)||(s(r)||Array.isArray(r))&&(s(e)||Array.isArray(e))?!P(r,e,n):!Object.is(r,e))return!1}}return!0}function F(e){let n=E(),{control:r=n,name:i,defaultValue:a,disabled:o,exact:s,compute:c}=e||{},l=t.default.useRef(a),u=t.default.useRef(c),d=t.default.useRef(void 0),f=t.default.useRef(r),p=t.default.useRef(i);u.current=c;let[m,h]=t.default.useState(()=>{let e=r._getWatch(i,l.current);return u.current?u.current(e):e}),g=t.default.useCallback(e=>{let t=j(i,r._names,e||r._formValues,!1,l.current);return u.current?u.current(t):t},[r._formValues,r._names,i]),_=t.default.useCallback(e=>{if(!o){let t=j(i,r._names,e||r._formValues,!1,l.current);if(u.current){let e=u.current(t);P(e,d.current)||(h(e),d.current=e)}else h(t)}},[r._formValues,r._names,o,i]);O(()=>((f.current!==r||!P(p.current,i))&&(f.current=r,p.current=i,_()),r._subscribe({name:i,formState:{values:!0},exact:s,callback:e=>{_(e.values)}})),[r,s,i,_]),t.default.useEffect(()=>r._removeUnmounted());let v=f.current!==r,y=p.current,b=t.default.useMemo(()=>{if(o)return null;let e=!v&&!P(y,i);return v||e?g():null},[o,v,i,y,g]);return b===null?m:b}function I(e){let n=E(),{name:r,disabled:i,control:a=n,shouldUnregister:o,defaultValue:s,exact:u=!0}=e,d=l(a._names.array,r),m=F({control:a,name:r,defaultValue:t.default.useMemo(()=>x(a._formValues,r,x(a._defaultValues,r,s)),[a,r,s]),exact:u}),h=k({control:a,name:r,exact:u}),g=t.default.useRef(e),_=t.default.useRef(null),y=t.default.useRef(a.register(r,{...e.rules,value:m,...S(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;let b=t.default.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!x(h.errors,r)},isDirty:{enumerable:!0,get:()=>!!x(h.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!x(h.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!x(h.validatingFields,r)},error:{enumerable:!0,get:()=>x(h.errors,r)}}),[h,r]),T=t.default.useCallback(e=>{let t=c(e);return x(a._fields,r)||(y.current=a.register(r,{...g.current.rules,value:t})),y.current.onChange({target:{value:c(e),name:r},type:p.CHANGE})},[r,a]),D=t.default.useCallback(()=>y.current.onBlur({target:{value:x(a._formValues,r),name:r},type:p.BLUR}),[r,a._formValues]),O=t.default.useCallback(e=>{e&&(_.current={focus:()=>C(e.focus)&&e.focus(),select:()=>C(e.select)&&e.select(),setCustomValidity:t=>C(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>C(e.reportValidity)&&e.reportValidity()});let t=x(a._fields,r);t&&t._f&&e&&(t._f.ref=_.current)},[a._fields,r]),A=t.default.useMemo(()=>({name:r,value:m,...S(i)||h.disabled?{disabled:h.disabled||i}:{},onChange:T,onBlur:D,ref:O}),[r,i,h.disabled,T,D,O,m]);return t.default.useEffect(()=>{let e=a._options.shouldUnregister||o;y.current=a.register(r,{...g.current.rules,...S(g.current.disabled)?{disabled:g.current.disabled}:{}});let t=(e,t)=>{let n=x(a._fields,e);n&&n._f&&(n._f.mount=t)};if(t(r,!0),e){let e=f(x(o?a._defaultValues:a._options.values||a._defaultValues,r,x(a._options.defaultValues,r,g.current.defaultValue)));w(a._defaultValues,r,e),v(x(a._formValues,r))&&w(a._formValues,r,e)}if(!d&&a.register(r),_.current){let e=x(a._fields,r);e&&e._f&&(e._f.ref=_.current)}return()=>{(d?e&&!a._state.action:e)?a.unregister(r):t(r,!1)}},[r,a,d,o]),t.default.useEffect(()=>{a._setDisabledField({disabled:i,name:r})},[i,r,a]),t.default.useMemo(()=>({field:A,formState:h,fieldState:b}),[A,h,b])}var L=e=>e.render(I(e)),R=t.default.createContext(null);R.displayName=`HookFormContext`;var z=()=>t.default.useContext(R),B=({children:e,watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,setValues:c,trigger:l,formState:u,resetField:d,reset:f,resetDefaultValues:p,handleSubmit:m,unregister:h,control:g,register:_,setFocus:v,subscribe:y})=>{let b=t.default.useMemo(()=>({watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,setValues:c,trigger:l,formState:u,resetField:d,reset:f,resetDefaultValues:p,handleSubmit:m,unregister:h,control:g,register:_,setFocus:v,subscribe:y}),[o,g,u,i,r,m,_,f,p,d,a,v,s,c,y,l,h,n]);return t.default.createElement(R.Provider,{value:b},t.default.createElement(T.Provider,{value:b.control},e))};m.onSubmit,m.onChange,exports.Controller=L,exports.FormProvider=B,exports.useFormContext=z,exports.useFormState=k;
|
package/dist/index18.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "./index3.js";
|
|
3
|
+
import { Label as t } from "./index13.js";
|
|
4
|
+
import { Controller as n, FormProvider as r, useFormContext as i, useFormState as a } from "./index17.js";
|
|
5
|
+
import * as o from "react";
|
|
6
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
7
|
+
import { Slot as c } from "@radix-ui/react-slot";
|
|
8
|
+
//#region src/ui/form.tsx
|
|
9
|
+
var l = r, u = o.createContext({}), d = ({ ...e }) => /* @__PURE__ */ s(u.Provider, {
|
|
10
|
+
value: { name: e.name },
|
|
11
|
+
children: /* @__PURE__ */ s(n, { ...e })
|
|
12
|
+
}), f = () => {
|
|
13
|
+
let e = o.useContext(u), t = o.useContext(p), { getFieldState: n } = i(), r = a({ name: e.name }), s = n(e.name, r);
|
|
14
|
+
if (!e) throw Error("useFormField should be used within <FormField>");
|
|
15
|
+
let { id: c } = t;
|
|
16
|
+
return {
|
|
17
|
+
id: c,
|
|
18
|
+
name: e.name,
|
|
19
|
+
formItemId: `${c}-form-item`,
|
|
20
|
+
formDescriptionId: `${c}-form-item-description`,
|
|
21
|
+
formMessageId: `${c}-form-item-message`,
|
|
22
|
+
...s
|
|
23
|
+
};
|
|
24
|
+
}, p = o.createContext({});
|
|
25
|
+
function m({ className: t, ...n }) {
|
|
26
|
+
let r = o.useId();
|
|
27
|
+
return /* @__PURE__ */ s(p.Provider, {
|
|
28
|
+
value: { id: r },
|
|
29
|
+
children: /* @__PURE__ */ s("div", {
|
|
30
|
+
"data-slot": "form-item",
|
|
31
|
+
className: e("grid gap-2", t),
|
|
32
|
+
...n
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function h({ className: n, ...r }) {
|
|
37
|
+
let { error: i, formItemId: a } = f();
|
|
38
|
+
return /* @__PURE__ */ s(t, {
|
|
39
|
+
"data-slot": "form-label",
|
|
40
|
+
"data-error": !!i,
|
|
41
|
+
className: e("data-[error=true]:text-destructive", n),
|
|
42
|
+
htmlFor: a,
|
|
43
|
+
...r
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function g({ ...e }) {
|
|
47
|
+
let { error: t, formItemId: n, formDescriptionId: r, formMessageId: i } = f();
|
|
48
|
+
return /* @__PURE__ */ s(c, {
|
|
49
|
+
"data-slot": "form-control",
|
|
50
|
+
id: n,
|
|
51
|
+
"aria-describedby": t ? `${r} ${i}` : `${r}`,
|
|
52
|
+
"aria-invalid": !!t,
|
|
53
|
+
...e
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function _({ className: t, ...n }) {
|
|
57
|
+
let { formDescriptionId: r } = f();
|
|
58
|
+
return /* @__PURE__ */ s("p", {
|
|
59
|
+
"data-slot": "form-description",
|
|
60
|
+
id: r,
|
|
61
|
+
className: e("text-muted-foreground text-sm", t),
|
|
62
|
+
...n
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function v({ className: t, ...n }) {
|
|
66
|
+
let { error: r, formMessageId: i } = f(), a = r ? String(r?.message ?? "") : n.children;
|
|
67
|
+
return a ? /* @__PURE__ */ s("p", {
|
|
68
|
+
"data-slot": "form-message",
|
|
69
|
+
id: i,
|
|
70
|
+
className: e("text-destructive text-sm", t),
|
|
71
|
+
...n,
|
|
72
|
+
children: a
|
|
73
|
+
}) : null;
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { l as Form, g as FormControl, _ as FormDescription, d as FormField, m as FormItem, h as FormLabel, v as FormMessage, f as useFormField };
|
package/dist/index19.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("./index2.cjs"),t=require("./index4.cjs"),n=require("./index14.cjs"),r=require("./index18.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime"),o=require("@radix-ui/react-slot");var s=r.FormProvider,c=i.createContext({}),l=({...e})=>(0,a.jsx)(c.Provider,{value:{name:e.name},children:(0,a.jsx)(r.Controller,{...e})}),u=()=>{let e=i.useContext(c),t=i.useContext(d),{getFieldState:n}=r.useFormContext(),a=r.useFormState({name:e.name}),o=n(e.name,a);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...o}},d=i.createContext({});function f({className:e,...n}){let r=i.useId();return(0,a.jsx)(d.Provider,{value:{id:r},children:(0,a.jsx)(`div`,{"data-slot":`form-item`,className:t.cn(`grid gap-2`,e),...n})})}function p({className:e,...r}){let{error:i,formItemId:o}=u();return(0,a.jsx)(n.Label,{"data-slot":`form-label`,"data-error":!!i,className:t.cn(`data-[error=true]:text-destructive`,e),htmlFor:o,...r})}function m({...e}){let{error:t,formItemId:n,formDescriptionId:r,formMessageId:i}=u();return(0,a.jsx)(o.Slot,{"data-slot":`form-control`,id:n,"aria-describedby":t?`${r} ${i}`:`${r}`,"aria-invalid":!!t,...e})}function h({className:e,...n}){let{formDescriptionId:r}=u();return(0,a.jsx)(`p`,{"data-slot":`form-description`,id:r,className:t.cn(`text-muted-foreground text-sm`,e),...n})}function g({className:e,...n}){let{error:r,formMessageId:i}=u(),o=r?String(r?.message??``):n.children;return o?(0,a.jsx)(`p`,{"data-slot":`form-message`,id:i,className:t.cn(`text-destructive text-sm`,e),...n,children:o}):null}exports.Form=s,exports.FormControl=m,exports.FormDescription=h,exports.FormField=l,exports.FormItem=f,exports.FormLabel=p,exports.FormMessage=g,exports.useFormField=u;
|
package/dist/index19.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cn as e } from "./index3.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
//#region src/ui/input.tsx
|
|
5
|
+
function n({ className: n, type: r, ...i }) {
|
|
6
|
+
return /* @__PURE__ */ t("input", {
|
|
7
|
+
type: r,
|
|
8
|
+
"data-slot": "input",
|
|
9
|
+
className: e("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", n),
|
|
10
|
+
...i
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { n as Input };
|
package/dist/index2.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
|
package/dist/index2.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { AlertTriangleIcon as e, CheckCircleIcon as t, InfoIcon as n, XCircleIcon as r, XIcon as i } from "lucide-react";
|
|
2
|
+
import { useEffect as a, useRef as o, useState as s } from "react";
|
|
3
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
4
|
+
//#region src/ConfirmModal.tsx
|
|
5
|
+
function u({ isOpen: u, onClose: d, onConfirm: f, title: p, message: m, confirmText: h = "Xác nhận", cancelText: g = "Hủy", closeLabel: _ = "Đóng", processingText: v = "Đang xử lý...", type: y = "warning", isLoading: b = !1 }) {
|
|
6
|
+
let [x, S] = s(u), C = o(null), w = o(null);
|
|
7
|
+
a(() => {
|
|
8
|
+
u && S(!0);
|
|
9
|
+
}, [u]), a(() => {
|
|
10
|
+
if (!x || u) return;
|
|
11
|
+
let e = window.setTimeout(() => S(!1), 200);
|
|
12
|
+
return () => window.clearTimeout(e);
|
|
13
|
+
}, [u, x]);
|
|
14
|
+
let T = () => {
|
|
15
|
+
b || d();
|
|
16
|
+
}, E = () => {
|
|
17
|
+
b || f();
|
|
18
|
+
}, D = (e) => {
|
|
19
|
+
e.target === e.currentTarget && !b && d();
|
|
20
|
+
};
|
|
21
|
+
if (a(() => {
|
|
22
|
+
let e = (e) => {
|
|
23
|
+
e.key === "Escape" && u && !b && d();
|
|
24
|
+
};
|
|
25
|
+
return u && document.addEventListener("keydown", e), () => {
|
|
26
|
+
document.removeEventListener("keydown", e);
|
|
27
|
+
};
|
|
28
|
+
}, [
|
|
29
|
+
u,
|
|
30
|
+
d,
|
|
31
|
+
b
|
|
32
|
+
]), a(() => (u ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
33
|
+
document.body.style.overflow = "";
|
|
34
|
+
}), [u]), a(() => {
|
|
35
|
+
if (!u) return;
|
|
36
|
+
let e = w.current;
|
|
37
|
+
if (!e) return;
|
|
38
|
+
let t = e.querySelectorAll("button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled])"), n = t[0], r = t[t.length - 1], i = (e) => {
|
|
39
|
+
e.key === "Tab" && (e.shiftKey && document.activeElement === n ? (e.preventDefault(), r?.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n?.focus()));
|
|
40
|
+
};
|
|
41
|
+
e.addEventListener("keydown", i);
|
|
42
|
+
let a = window.setTimeout(() => n?.focus(), 100);
|
|
43
|
+
return () => {
|
|
44
|
+
e.removeEventListener("keydown", i), window.clearTimeout(a);
|
|
45
|
+
};
|
|
46
|
+
}, [u]), !x) return null;
|
|
47
|
+
let O = {
|
|
48
|
+
warning: e,
|
|
49
|
+
info: n,
|
|
50
|
+
success: t,
|
|
51
|
+
danger: r
|
|
52
|
+
}[y], k = {
|
|
53
|
+
warning: "text-yellow-500",
|
|
54
|
+
info: "text-blue-500",
|
|
55
|
+
success: "text-green-500",
|
|
56
|
+
danger: "text-red-500"
|
|
57
|
+
}[y], A = {
|
|
58
|
+
warning: "bg-yellow-500 hover:bg-yellow-600 focus:ring-yellow-500",
|
|
59
|
+
info: "bg-blue-500 hover:bg-blue-600 focus:ring-blue-500",
|
|
60
|
+
success: "bg-green-500 hover:bg-green-600 focus:ring-green-500",
|
|
61
|
+
danger: "bg-red-500 hover:bg-red-600 focus:ring-red-500"
|
|
62
|
+
}[y];
|
|
63
|
+
return /* @__PURE__ */ l("div", {
|
|
64
|
+
ref: C,
|
|
65
|
+
className: "fixed inset-0 z-10000 flex items-center justify-center",
|
|
66
|
+
children: [/* @__PURE__ */ c("div", {
|
|
67
|
+
className: `absolute inset-0 bg-black/50 transition-opacity duration-200 ${u ? "opacity-100" : "opacity-0"}`,
|
|
68
|
+
onClick: D
|
|
69
|
+
}), /* @__PURE__ */ l("div", {
|
|
70
|
+
ref: w,
|
|
71
|
+
className: `relative z-10000 mx-4 w-full max-w-md rounded-lg bg-white p-6 shadow-xl transition-all duration-200 ${u ? "translate-y-0 scale-100 opacity-100" : "translate-y-5 scale-95 opacity-0"}`,
|
|
72
|
+
onClick: (e) => e.stopPropagation(),
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ c("button", {
|
|
75
|
+
type: "button",
|
|
76
|
+
onClick: T,
|
|
77
|
+
disabled: b,
|
|
78
|
+
className: "absolute right-4 top-4 rounded-full p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 disabled:cursor-not-allowed disabled:opacity-50",
|
|
79
|
+
"aria-label": _,
|
|
80
|
+
children: /* @__PURE__ */ c(i, { className: "h-5 w-5" })
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ l("div", {
|
|
83
|
+
className: "flex items-start space-x-4 pr-8",
|
|
84
|
+
children: [/* @__PURE__ */ c("div", {
|
|
85
|
+
className: "mt-1 flex-shrink-0",
|
|
86
|
+
children: /* @__PURE__ */ c(O, { className: `h-6 w-6 ${k}` })
|
|
87
|
+
}), /* @__PURE__ */ l("div", {
|
|
88
|
+
className: "min-w-0 flex-1",
|
|
89
|
+
children: [/* @__PURE__ */ c("h3", {
|
|
90
|
+
className: "mb-2 text-lg font-medium text-gray-900",
|
|
91
|
+
children: p
|
|
92
|
+
}), /* @__PURE__ */ c("p", {
|
|
93
|
+
className: "text-sm leading-relaxed text-gray-500",
|
|
94
|
+
children: m
|
|
95
|
+
})]
|
|
96
|
+
})]
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ l("div", {
|
|
99
|
+
className: "mt-6 flex justify-end space-x-3",
|
|
100
|
+
children: [/* @__PURE__ */ c("button", {
|
|
101
|
+
type: "button",
|
|
102
|
+
onClick: T,
|
|
103
|
+
disabled: b,
|
|
104
|
+
className: "rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
105
|
+
children: g
|
|
106
|
+
}), /* @__PURE__ */ c("button", {
|
|
107
|
+
type: "button",
|
|
108
|
+
onClick: E,
|
|
109
|
+
disabled: b,
|
|
110
|
+
className: `rounded-md px-4 py-2 text-sm font-medium text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ${A}`,
|
|
111
|
+
children: b ? /* @__PURE__ */ l("span", {
|
|
112
|
+
className: "flex items-center",
|
|
113
|
+
children: [/* @__PURE__ */ c("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }), v]
|
|
114
|
+
}) : h
|
|
115
|
+
})]
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
export { u as default };
|
package/dist/index20.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./index2.cjs"),t=require("./index4.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("react/jsx-runtime");function i({className:e,type:n,...i}){return(0,r.jsx)(`input`,{type:n,"data-slot":`input`,className:t.cn(`file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,`aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive`,e),...i})}exports.Input=i;
|