aravint-ui-form-controls 1.0.39 → 1.0.41
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.
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
scrollbar-color: #D1D5DB transparent;
|
|
69
69
|
}
|
|
70
70
|
`}),k.jsxs(Dd,{open:y,onOpenChange:i?void 0:_,children:[k.jsx(kd,{asChild:!0,children:k.jsxs("button",{type:"button",disabled:i,className:`flex w-full items-center justify-between rounded-lg border text-sm transition
|
|
71
|
-
${i?"bg-gray-100 cursor-not-allowed":"bg-white cursor-pointer"}`,style:{minHeight:f,height:"auto",
|
|
71
|
+
${i?"bg-gray-100 cursor-not-allowed":"bg-white cursor-pointer"}`,style:{minHeight:f,height:"auto",borderColor:o?"#ef4444":h,paddingLeft:"12px",paddingRight:"12px",paddingTop:"4px",paddingBottom:"4px"},children:[j.length===0?k.jsx("span",{className:"truncate text-left text-[12px] text-gray-400",children:e}):k.jsx("div",{className:"flex flex-1 flex-wrap items-center gap-1.5",children:j.map(R=>k.jsxs("span",{className:"flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] whitespace-nowrap",style:{backgroundColor:m,color:v},children:[R.label,k.jsx(gr.X,{size:12,className:"shrink-0 cursor-pointer opacity-60 hover:opacity-100",onClick:B=>E(B,R.value)})]},R.value))}),k.jsx(gr.ChevronDown,{size:16,className:`ml-2 shrink-0 text-gray-500 transition-transform ${y?"rotate-180":""}`})]})}),k.jsx(Cd,{children:k.jsxs(Sd,{ref:w,align:"start",side:"bottom",sideOffset:8,avoidCollisions:!0,collisionPadding:8,className:"rounded-xl p-2 box-border",style:{width:"var(--radix-popover-trigger-width)",backgroundColor:"#ffffff",border:`1px solid ${h}`,borderRadius:"12px",boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",zIndex:9999,overflow:"hidden"},onInteractOutside:()=>{_(!1)},onOpenAutoFocus:R=>{R.preventDefault()},children:[k.jsx("div",{className:"flex items-center justify-center w-full sticky top-0 z-10 px-2 pt-2 pb-1.5",style:{backgroundColor:"#ffffff"},children:k.jsxs("div",{className:"flex items-center gap-2 rounded-md border-[#eaebee] border-[1.5px] bg-[#f9f9f9] px-2 py-1 w-full mx-auto",children:[k.jsx(gr.Search,{size:14,className:"text-gray-400 shrink-0"}),k.jsx("input",{autoFocus:!0,value:D,onChange:R=>C(R.target.value),placeholder:a,className:"w-full bg-transparent text-xs outline-none placeholder:text-[#1f2937] text-[12px] placeholder:text-[12px]"})]})}),k.jsxs("div",{className:"multiselect-options-scroll overflow-y-auto flex flex-col gap-1 px-2",style:{height:"180px"},children:[k.jsx("div",{className:"flex items-center justify-center",children:I.length===0&&k.jsx("div",{className:"px-3 py-2 text-[12px] text-gray-400",children:"No results found"})}),I.map(R=>{const B=n.includes(R.value),A=S===R.value;let N="transparent";return B?N=s:A&&(N=l),k.jsxs("div",{onClick:()=>W(R.value),onMouseEnter:()=>P(R.value),onMouseLeave:()=>P(null),className:"flex w-full items-center gap-3 rounded-md px-3 py-2 cursor-pointer text-sm box-border",style:{backgroundColor:N,borderLeft:B?`4px solid ${c}`:"4px solid transparent",color:B?"#ffffff":"#1f2937",fontSize:"12px"},children:[k.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded border",style:B?{backgroundColor:"#059669",borderColor:"#059669"}:{borderColor:"#D1D5DB"},children:B&&k.jsx(gr.Check,{size:11,strokeWidth:3,color:u})}),k.jsx("span",{className:"truncate",children:R.label})]},R.value)})]})]})})]})]})}const Pd=({onFilesChange:r,onDrop:n,onDragOver:t,onDragLeave:e,onClick:a,inputRef:o,isDragging:i=!1,isUploading:s=!1,disabled:c=!1,accept:l="*",multiple:u=!0,title:d="Drag & Drop Files Here",subtitle:f="or",buttonText:p="Browse",uploadingText:h="Uploading files...",footerText:m="(File Size Max 10MB)",icon:v,containerClassName:y="",dropZoneClassName:x="",buttonClassName:D="",inputId:C="file-upload"})=>{const S=c||s,P=O=>{r(O.target.files),o&&o.current&&(o.current.value="")};return k.jsxs("div",{className:`
|
|
72
72
|
rounded text-center relative p-3 transition-all
|
|
73
73
|
${S?"opacity-60 pointer-events-none":""}
|
|
74
74
|
${i?"bg-blue-50 border-2 border-blue-400":""}
|
|
@@ -223,4 +223,4 @@
|
|
|
223
223
|
appearance: auto;
|
|
224
224
|
-webkit-appearance: menulist;
|
|
225
225
|
}
|
|
226
|
-
`}),k.jsx("div",{className:"w-full [&_.react-datepicker-wrapper]:w-full [&_.react-datepicker__input-container]:w-full",children:k.jsx(gm,{ref:O,...w?{selectsRange:!0}:{},dateFormat:I,placeholderText:i||_,formatWeekDay:A=>A.substring(0,3),selected:w?e??void 0:n??void 0,startDate:w?e??void 0:void 0,endDate:w?a??void 0:void 0,onChange:E,shouldCloseOnSelect:!w,calendarClassName:"cdp-calendar",minDate:c??void 0,maxDate:l??void 0,disabled:u,filterDate:R,showPopperArrow:!1,popperPlacement:"bottom-start",renderCustomHeader:({date:A,decreaseMonth:N,increaseMonth:M,changeYear:z,prevMonthButtonDisabled:q,nextMonthButtonDisabled:ve})=>{const Me=A.getFullYear();return k.jsxs("div",{className:"flex items-center justify-between px-1 relative",children:[k.jsx("button",{onClick:N,disabled:q,style:{width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"none",background:"transparent",cursor:"pointer",fontSize:"24px",lineHeight:1,color:"#4B5563",opacity:q?.3:1},children:"‹"}),k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("span",{className:"text-[14px] font-bold text-gray-900",children:xm[A.getMonth()]}),k.jsx("select",{className:"cdp-year-select",value:Me,onChange:ee=>z(Number(ee.target.value)),style:{fontSize:"13px",fontWeight:600,color:"#221f1f",border:`1px solid ${f}`,borderRadius:"6px",padding:"2px 6px",background:"#fff",cursor:"pointer",outline:"none"},children:B.map(ee=>k.jsx("option",{value:ee,children:ee},ee))})]}),k.jsx("button",{onClick:M,disabled:ve,style:{width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"none",background:"transparent",cursor:"pointer",fontSize:"24px",lineHeight:1,color:"#4B5563",opacity:ve?.3:1},children:"›"})]})},calendarContainer:({className:A,children:N})=>k.jsxs("div",{className:A,children:[N,w&&k.jsxs("div",{className:"border-t border-gray-100 mt-2 pl-1 py-2 text-[7px] text-gray-500",children:[k.jsx("span",{style:{fontSize:"11px"},className:"font-semibold text-gray-700 text-[9px]",children:"Note:"})," ",k.jsxs("span",{style:{fontSize:"11px"},className:"text-[9px] text-gray-500",children:["Date range selection is limited to ",s," year."]})]})]}),customInput:k.jsx(wm,{value:w?W:n?Ir(n):"",placeholder:i||_,onClear:j,showClear:w?!!e:!!n,className:m})},r)})]})});var Fs={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},No=g.createContext&&g.createContext(Fs),Cm=["attr","size","title"];function Sm(r,n){if(r==null)return{};var t,e,a=_m(r,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(e=0;e<o.length;e++)t=o[e],n.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(a[t]=r[t])}return a}function _m(r,n){if(r==null)return{};var t={};for(var e in r)if({}.hasOwnProperty.call(r,e)){if(n.indexOf(e)!==-1)continue;t[e]=r[e]}return t}function rn(){return rn=Object.assign?Object.assign.bind():function(r){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var e in t)({}).hasOwnProperty.call(t,e)&&(r[e]=t[e])}return r},rn.apply(null,arguments)}function To(r,n){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(r);n&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,e)}return t}function nn(r){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?To(Object(t),!0).forEach(function(e){Em(r,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):To(Object(t)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))})}return r}function Em(r,n,t){return(n=Mm(n))in r?Object.defineProperty(r,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[n]=t,r}function Mm(r){var n=Pm(r,"string");return typeof n=="symbol"?n:n+""}function Pm(r,n){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var e=t.call(r,n);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(r)}function Ls(r){return r&&r.map((n,t)=>g.createElement(n.tag,nn({key:t},n.attr),Ls(n.child)))}function mn(r){return n=>g.createElement(Om,rn({attr:nn({},r.attr)},n),Ls(r.child))}function Om(r){var n=t=>{var e=r.attr,a=r.size,o=r.title,i=Sm(r,Cm),s=a||t.size||"1em",c;return t.className&&(c=t.className),r.className&&(c=(c?c+" ":"")+r.className),g.createElement("svg",rn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,e,i,{className:c,style:nn(nn({color:r.color||t.color},t.style),r.style),height:s,width:s,xmlns:"http://www.w3.org/2000/svg"}),o&&g.createElement("title",null,o),r.children)};return No!==void 0?g.createElement(No.Consumer,null,t=>n(t)):n(Fs)}function Rm(r){return mn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 428 339.92 303.9a160.48 160.48 0 0 0 30.72-94.58C370.64 120.37 298.27 48 209.32 48S48 120.37 48 209.32s72.37 161.32 161.32 161.32a160.48 160.48 0 0 0 94.58-30.72L428 464zM209.32 319.69a110.38 110.38 0 1 1 110.37-110.37 110.5 110.5 0 0 1-110.37 110.37"},child:[]}]})(r)}function Nm(r){return mn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M400 145.49 366.51 112 256 222.51 145.49 112 112 145.49 222.51 256 112 366.51 145.49 400 256 289.49 366.51 400 400 366.51 289.49 256z"},child:[]}]})(r)}function Tm(r){return mn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"},child:[]}]})(r)}function Im(r){return mn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"},child:[]}]})(r)}const Am=Rm,Fm=Im,Lm=Tm,Ym=Nm,Wm=({label:r,options:n,value:t,placeholder:e="Select",onChange:a,disabled:o=!1,hoverOptionStyle:i={backgroundColor:"#BEFFDB",color:"#13785F"},selectedOptionStyle:s={backgroundColor:"#13785F",color:"#FFFFFF",fontWeight:500,borderLeftWidth:5,borderLeftColor:"#10B981",borderLeftStyle:"solid"},searchPlaceholder:c="Search...",showSearch:l=!0,ArrowDownIcon:u,ArrowUpIcon:d})=>{const[f,p]=g.useState(!1),[h,m]=g.useState(""),[v,y]=g.useState(null),x=g.useRef(null),D=n.find(w=>String(w.value)===String(t)),C=n.filter(w=>w.label.toLowerCase().includes(h.toLowerCase())),O=f?d||Lm:u||Fm;return g.useEffect(()=>{const w=_=>{x.current&&!x.current.contains(_.target)&&p(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[]),k.jsxs("div",{className:"relative w-full",ref:x,children:[r&&k.jsx("label",{children:r}),k.jsxs("div",{className:"h-8 w-full border-0 rounded-md px-2 flex items-center justify-between text-xs",style:{backgroundColor:o?"#F3F3F3":"#FFFFFF",cursor:o?"not-allowed":"pointer"},onClick:()=>!o&&p(!f),children:[k.jsx("span",{className:"truncate",style:{fontSize:"12px",fontWeight:400,color:D?"#1F2937":"#9CA3AF"},children:(D==null?void 0:D.label)||e}),k.jsx(O,{className:"transition duration-200 text-gray-500 text-[16px]"})]}),f&&!o&&k.jsxs("div",{className:" absolute left-0 top-full mt-1 w-full bg-white border border-[#9CA3AF] rounded-md shadow-lg",style:{zIndex:9999},children:[l&&k.jsx("div",{className:"p-2 border-b bg-white",children:k.jsxs("div",{className:"relative",children:[k.jsx("div",{className:"absolute flex items-center justify-center pointer-events-none",style:{left:8,top:6},children:k.jsx(Am,{className:"w-4 h-4 text-slate-400"})}),k.jsx("input",{type:"text",placeholder:c,value:h,onChange:w=>m(w.target.value),className:"w-full h-9 rounded-lg border border-[#D1D5DB] text-sm text-slate-700 placeholder:text-slate-400 outline-none transition focus:border-[#10B981] focus:ring-1 focus:ring-[#10B981]/20",style:{paddingLeft:28,paddingRight:h?26:16,fontSize:12,lineHeight:"16px",height:28,backgroundColor:"#F9F9F9"}}),h&&k.jsx("button",{type:"button",onClick:()=>m(""),className:"absolute flex items-center justify-center",style:{right:6,top:6,background:"none",border:"none",padding:0,cursor:"pointer"},children:k.jsx(Ym,{className:"w-4 h-4 text-slate-400 hover:text-slate-600"})})]})}),k.jsx("div",{className:"overflow-x-hidden bg-white",style:{maxHeight:208,overflowY:"auto"},children:C.map(w=>{const _=String(t)===String(w.value),I=v===w.value,E={transition:"all 150ms ease",boxShadow:"0px 1px 2px 0px #0000000D",..._?s:I?i:{},...I&&!_?{transform:"translateX(2px)",fontWeight:700}:{}};return k.jsx("div",{className:"px-3 py-2 text-xs cursor-pointer",style:E,onMouseEnter:()=>y(w.value),onMouseLeave:()=>y(null),onClick:()=>{a(w.value),p(!1),m("")},children:w.label},w.value)})})]})]})},jm=({value:r,icon:n})=>{const[t,e]=g.useState(!1);return k.jsxs("div",{className:"relative inline-flex items-center justify-center",onMouseEnter:()=>e(!0),onMouseLeave:()=>e(!1),children:[n,t&&k.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2 z-[99999]",style:{top:"calc(100% + 8px)",background:"#202124",color:"#FFFFFF",padding:"6px 10px",borderRadius:"4px",fontSize:"12px",fontWeight:500,whiteSpace:"nowrap",width:"max-content",boxShadow:"0 2px 8px rgba(0,0,0,0.25)"},children:[r,k.jsx("div",{style:{position:"absolute",top:"-5px",left:"50%",transform:"translateX(-50%)",width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderBottom:"5px solid #202124"}})]})]})},Hm=({onPaste:r,enabled:n=!0,ignoreInputs:t=!0,onNonImagePaste:e})=>{g.useEffect(()=>{if(!n)return;const a=o=>{var u,d;const i=o,s=document.activeElement;if(t&&(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||(s==null?void 0:s.getAttribute("contenteditable"))==="true"))return;const c=(u=i.clipboardData)==null?void 0:u.items;if(!c)return;const l=[];for(const f of c){if(!f.type.startsWith("image/"))continue;const p=f.getAsFile();p&&l.push(p)}if(!l.length){e==null||e();return}(d=i.preventDefault)==null||d.call(i),r(l)};return document.addEventListener("paste",a),()=>{document.removeEventListener("paste",a)}},[n,t,r,e])};exports.Checkbox=Qs;exports.CustomDatePicker=km;exports.DragDropUpload=Pd;exports.Input=ss;exports.MultiSelect=Md;exports.Radio=zs;exports.Select=Rd;exports.SingleSelect=Wm;exports.Textarea=Ko;exports.ToggleSwitch=Vs;exports.Tooltip=jm;exports.useClipboardImagePaste=Hm;
|
|
226
|
+
`}),k.jsx("div",{className:"w-full [&_.react-datepicker-wrapper]:w-full [&_.react-datepicker__input-container]:w-full",children:k.jsx(gm,{ref:O,...w?{selectsRange:!0}:{},dateFormat:I,placeholderText:i||_,formatWeekDay:A=>A.substring(0,3),selected:w?e??void 0:n??void 0,startDate:w?e??void 0:void 0,endDate:w?a??void 0:void 0,onChange:E,shouldCloseOnSelect:!w,calendarClassName:"cdp-calendar",minDate:c??void 0,maxDate:l??void 0,disabled:u,filterDate:R,showPopperArrow:!1,popperPlacement:"bottom-start",renderCustomHeader:({date:A,decreaseMonth:N,increaseMonth:M,changeYear:z,prevMonthButtonDisabled:q,nextMonthButtonDisabled:ve})=>{const Me=A.getFullYear();return k.jsxs("div",{className:"flex items-center justify-between px-1 relative",children:[k.jsx("button",{onClick:N,disabled:q,style:{width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"none",background:"transparent",cursor:"pointer",fontSize:"24px",lineHeight:1,color:"#4B5563",opacity:q?.3:1},children:"‹"}),k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("span",{className:"text-[14px] font-bold text-gray-900",children:xm[A.getMonth()]}),k.jsx("select",{className:"cdp-year-select",value:Me,onChange:ee=>z(Number(ee.target.value)),style:{fontSize:"13px",fontWeight:600,color:"#221f1f",border:`1px solid ${f}`,borderRadius:"6px",padding:"2px 6px",background:"#fff",cursor:"pointer",outline:"none"},children:B.map(ee=>k.jsx("option",{value:ee,children:ee},ee))})]}),k.jsx("button",{onClick:M,disabled:ve,style:{width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"none",background:"transparent",cursor:"pointer",fontSize:"24px",lineHeight:1,color:"#4B5563",opacity:ve?.3:1},children:"›"})]})},calendarContainer:({className:A,children:N})=>k.jsxs("div",{className:A,children:[N,w&&k.jsxs("div",{className:"border-t border-gray-100 mt-2 pl-1 py-2 text-[7px] text-gray-500",children:[k.jsx("span",{style:{fontSize:"11px"},className:"font-semibold text-gray-700 text-[9px]",children:"Note:"})," ",k.jsxs("span",{style:{fontSize:"11px"},className:"text-[9px] text-gray-500",children:["Date range selection is limited to ",s," year."]})]})]}),customInput:k.jsx(wm,{value:w?W:n?Ir(n):"",placeholder:i||_,onClear:j,showClear:w?!!e:!!n,className:m})},r)})]})});var Fs={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},No=g.createContext&&g.createContext(Fs),Cm=["attr","size","title"];function Sm(r,n){if(r==null)return{};var t,e,a=_m(r,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(e=0;e<o.length;e++)t=o[e],n.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(a[t]=r[t])}return a}function _m(r,n){if(r==null)return{};var t={};for(var e in r)if({}.hasOwnProperty.call(r,e)){if(n.indexOf(e)!==-1)continue;t[e]=r[e]}return t}function rn(){return rn=Object.assign?Object.assign.bind():function(r){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var e in t)({}).hasOwnProperty.call(t,e)&&(r[e]=t[e])}return r},rn.apply(null,arguments)}function To(r,n){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(r);n&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,e)}return t}function nn(r){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?To(Object(t),!0).forEach(function(e){Em(r,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):To(Object(t)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))})}return r}function Em(r,n,t){return(n=Mm(n))in r?Object.defineProperty(r,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[n]=t,r}function Mm(r){var n=Pm(r,"string");return typeof n=="symbol"?n:n+""}function Pm(r,n){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var e=t.call(r,n);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(r)}function Ls(r){return r&&r.map((n,t)=>g.createElement(n.tag,nn({key:t},n.attr),Ls(n.child)))}function mn(r){return n=>g.createElement(Om,rn({attr:nn({},r.attr)},n),Ls(r.child))}function Om(r){var n=t=>{var e=r.attr,a=r.size,o=r.title,i=Sm(r,Cm),s=a||t.size||"1em",c;return t.className&&(c=t.className),r.className&&(c=(c?c+" ":"")+r.className),g.createElement("svg",rn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,e,i,{className:c,style:nn(nn({color:r.color||t.color},t.style),r.style),height:s,width:s,xmlns:"http://www.w3.org/2000/svg"}),o&&g.createElement("title",null,o),r.children)};return No!==void 0?g.createElement(No.Consumer,null,t=>n(t)):n(Fs)}function Rm(r){return mn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 428 339.92 303.9a160.48 160.48 0 0 0 30.72-94.58C370.64 120.37 298.27 48 209.32 48S48 120.37 48 209.32s72.37 161.32 161.32 161.32a160.48 160.48 0 0 0 94.58-30.72L428 464zM209.32 319.69a110.38 110.38 0 1 1 110.37-110.37 110.5 110.5 0 0 1-110.37 110.37"},child:[]}]})(r)}function Nm(r){return mn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M400 145.49 366.51 112 256 222.51 145.49 112 112 145.49 222.51 256 112 366.51 145.49 400 256 289.49 366.51 400 400 366.51 289.49 256z"},child:[]}]})(r)}function Tm(r){return mn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"},child:[]}]})(r)}function Im(r){return mn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"},child:[]}]})(r)}const Am=Rm,Fm=Im,Lm=Tm,Ym=Nm,Wm=({label:r,options:n,value:t,placeholder:e="Select",onChange:a,disabled:o=!1,hoverOptionStyle:i={backgroundColor:"#BEFFDB",color:"#13785F"},selectedOptionStyle:s={backgroundColor:"#13785F",color:"#FFFFFF",fontWeight:500,borderLeftWidth:5,borderLeftColor:"#10B981",borderLeftStyle:"solid"},searchPlaceholder:c="Search...",showSearch:l=!0,ArrowDownIcon:u,ArrowUpIcon:d})=>{const[f,p]=g.useState(!1),[h,m]=g.useState(""),[v,y]=g.useState(null),x=g.useRef(null),D=n.find(w=>String(w.value)===String(t)),C=n.filter(w=>w.label.toLowerCase().includes(h.toLowerCase())),O=f?d||Lm:u||Fm;return g.useEffect(()=>{const w=_=>{x.current&&!x.current.contains(_.target)&&p(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[]),k.jsxs("div",{className:"relative w-full",ref:x,children:[r&&k.jsx("label",{children:r}),k.jsxs("div",{className:"h-8 w-full border-0 rounded-md px-2 flex items-center justify-between text-xs",style:{backgroundColor:o?"#F3F3F3":"#FFFFFF",cursor:o?"not-allowed":"pointer"},onClick:()=>!o&&p(!f),children:[k.jsx("span",{className:"truncate",style:{fontSize:"12px",fontWeight:400,color:D?"#1F2937":"#9CA3AF"},children:(D==null?void 0:D.label)||e}),k.jsx(O,{className:"transition duration-200 text-gray-500 text-[16px]"})]}),f&&!o&&k.jsxs("div",{className:" absolute left-0 top-full mt-1 w-full bg-white border border-[#9CA3AF] rounded-md shadow-lg",style:{zIndex:9999},children:[l&&k.jsx("div",{className:"p-2 border-b bg-white",children:k.jsxs("div",{className:"relative",children:[k.jsx("div",{className:"absolute flex items-center justify-center pointer-events-none",style:{left:8,top:6},children:k.jsx(Am,{className:"w-4 h-4 text-slate-400"})}),k.jsx("input",{type:"text",placeholder:c,value:h,onChange:w=>m(w.target.value),className:"w-full h-9 rounded-lg border border-[#D1D5DB] text-sm text-slate-700 placeholder:text-slate-400 outline-none transition focus:border-[#10B981] focus:ring-1 focus:ring-[#10B981]/20",style:{paddingLeft:28,paddingRight:h?26:16,fontSize:12,lineHeight:"16px",height:28,backgroundColor:"#F9F9F9"}}),h&&k.jsx("button",{type:"button",onClick:()=>m(""),className:"absolute flex items-center justify-center",style:{right:6,top:6,background:"none",border:"none",padding:0,cursor:"pointer"},children:k.jsx(Ym,{className:"w-4 h-4 text-slate-400 hover:text-slate-600"})})]})}),k.jsx("div",{className:"overflow-x-hidden bg-white",style:{maxHeight:208,overflowY:"auto",overflowX:"hidden"},children:C.map(w=>{const _=String(t)===String(w.value),I=v===w.value,E={transition:"all 150ms ease",boxShadow:"0px 1px 2px 0px #0000000D",..._?s:I?i:{},...I&&!_?{transform:"translateX(2px)",fontWeight:700}:{}};return k.jsx("div",{className:"px-3 py-2 text-xs cursor-pointer",style:E,onMouseEnter:()=>y(w.value),onMouseLeave:()=>y(null),onClick:()=>{a(w.value),p(!1),m("")},children:w.label},w.value)})})]})]})},jm=({value:r,icon:n})=>{const[t,e]=g.useState(!1);return k.jsxs("div",{className:"relative inline-flex items-center justify-center",onMouseEnter:()=>e(!0),onMouseLeave:()=>e(!1),children:[n,t&&k.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2 z-[99999]",style:{top:"calc(100% + 8px)",background:"#202124",color:"#FFFFFF",padding:"6px 10px",borderRadius:"4px",fontSize:"12px",fontWeight:500,whiteSpace:"nowrap",width:"max-content",boxShadow:"0 2px 8px rgba(0,0,0,0.25)"},children:[r,k.jsx("div",{style:{position:"absolute",top:"-5px",left:"50%",transform:"translateX(-50%)",width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderBottom:"5px solid #202124"}})]})]})},Hm=({onPaste:r,enabled:n=!0,ignoreInputs:t=!0,onNonImagePaste:e})=>{g.useEffect(()=>{if(!n)return;const a=o=>{var u,d;const i=o,s=document.activeElement;if(t&&(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||(s==null?void 0:s.getAttribute("contenteditable"))==="true"))return;const c=(u=i.clipboardData)==null?void 0:u.items;if(!c)return;const l=[];for(const f of c){if(!f.type.startsWith("image/"))continue;const p=f.getAsFile();p&&l.push(p)}if(!l.length){e==null||e();return}(d=i.preventDefault)==null||d.call(i),r(l)};return document.addEventListener("paste",a),()=>{document.removeEventListener("paste",a)}},[n,t,r,e])};exports.Checkbox=Qs;exports.CustomDatePicker=km;exports.DragDropUpload=Pd;exports.Input=ss;exports.MultiSelect=Md;exports.Radio=zs;exports.Select=Rd;exports.SingleSelect=Wm;exports.Textarea=Ko;exports.ToggleSwitch=Vs;exports.Tooltip=jm;exports.useClipboardImagePaste=Hm;
|
package/dist/form-controls.es.js
CHANGED
|
@@ -6164,7 +6164,7 @@ function nv({
|
|
|
6164
6164
|
style: {
|
|
6165
6165
|
minHeight: f,
|
|
6166
6166
|
height: "auto",
|
|
6167
|
-
|
|
6167
|
+
borderColor: o ? "#ef4444" : h,
|
|
6168
6168
|
paddingLeft: "12px",
|
|
6169
6169
|
paddingRight: "12px",
|
|
6170
6170
|
paddingTop: "4px",
|
|
@@ -13720,7 +13720,7 @@ const zm = Wm, Vm = $m, jm = Bm, Qm = Hm, sv = ({
|
|
|
13720
13720
|
"div",
|
|
13721
13721
|
{
|
|
13722
13722
|
className: "overflow-x-hidden bg-white",
|
|
13723
|
-
style: { maxHeight: 208, overflowY: "auto" },
|
|
13723
|
+
style: { maxHeight: 208, overflowY: "auto", overflowX: "hidden" },
|
|
13724
13724
|
children: k.map((y) => {
|
|
13725
13725
|
const S = String(t) === String(y.value), I = v === y.value, E = {
|
|
13726
13726
|
transition: "all 150ms ease",
|