tailwind-ux-kit 1.0.61 → 1.0.63
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.
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
type BoxSize = "xs" | "sm" | "md" | "lg";
|
|
3
|
+
type Shape = "flat" | "rounded" | "pill";
|
|
4
|
+
type Variant = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "dark" | "light";
|
|
5
|
+
interface RadioButtonProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
6
|
+
label?: React.ReactNode;
|
|
7
|
+
boxSize?: BoxSize;
|
|
8
|
+
shape?: Shape;
|
|
9
|
+
variant?: Variant;
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
onSelectionChange?: (value: string) => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}
|
|
17
|
+
declare const Radio: React.FC<RadioButtonProps>;
|
|
18
|
+
export default Radio;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
${M} ${L} ${m} ${d}`}),y&&e&&b&&l.jsx("label",{htmlFor:S,className:`ms-1 ${or[b]} ${d}`,children:e})]}),p&&l.jsx("p",{className:`mt-1 text-xs ${x==="invalid"?"text-red-600 dark:text-red-500":"text-green-600 dark:text-green-500"}`,role:x==="invalid"?"alert":void 0,children:p})]})});q.displayName="Input";const tr={xs:"text-xs px-2 py-1",sm:"text-sm px-3 py-1.5",md:"text-sm px-3 py-3",lg:"text-lg px-5 py-3"},lr={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full"},nr={filled:"rounded-t-lg px-2.5 pb-2.5 pt-5 bg-gray-50 border-b-2",outlined:"rounded-lg px-2.5 pb-2.5 pt-4 bg-transparent border",standard:"px-0 py-2.5 bg-transparent border-0 border-b-2"},ar={filled:"absolute duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",outlined:"absolute duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-white px-2 peer-placeholder-shown:scale-100 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",standard:"absolute duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 peer-focus:text-blue-600"},cr=(r,t,e)=>{if(e)return"border-red-500 bg-red-50 text-red-900 focus:ring-red-500 focus:border-red-500";if(t)return"border-green-500 bg-green-50 text-green-900 focus:ring-green-500 focus:border-green-500";const o="focus:ring focus:border";switch(r){case"error":return`${o}-red-500 border-red-500 bg-red-50`;case"warning":return`${o}-yellow-500 border-yellow-500 bg-yellow-50`;case"success":return`${o}-green-500 border-green-500 bg-green-50`;default:return"border-gray-300 focus:ring-blue-500"}},K=n.forwardRef((r,t)=>{const{label:e,id:o,inputSize:a="md",shape:u="rounded",validate:s,onValidatedChange:h,className:d="",icon:i,iconPosition:c="left",floatingLabelStyle:b,onChange:f,isValid:v,isInvalid:g,feedback:p,feedbackType:x="invalid",children:k,...N}=r,[$,C]=n.useState("default"),S=n.useId(),y=n.useMemo(()=>o||(typeof e=="string"?`select-${e.toLowerCase().replace(/\s+/g,"-")}`:S),[o,e,S]),E=j=>{const H=j.target.value,R=(s==null?void 0:s(H))??"default";C(R),h==null||h(j,R),f==null||f(j)},L=!!b,m=tr[a],O=lr[u],M=cr($,v,g),P=i&&(c==="start"||c==="left")?"ps-10":i?"pe-10":"",I=c==="start"||c==="left"?"left-0 ps-3.5":"right-0 pe-3.5";return l.jsxs("div",{className:`w-full relative ${L?"z-0":""}`,children:[!L&&e&&l.jsx("label",{htmlFor:y,className:`block mb-1 text-sm ${v?"text-green-700":g?"text-red-700":"text-gray-700"}`,children:e}),l.jsxs("div",{className:"relative w-full",children:[i&&l.jsx("div",{className:`absolute inset-y-0 flex items-center ${I}`,children:l.jsx("span",{className:"text-gray-500",children:i})}),l.jsx("select",{...N,id:y,ref:t,onChange:E,className:`border peer w-full block font-normal appearance-none focus:outline-none focus:ring-0 transition text-gray-600 placeholder-[#798ba5] border-gray-400
|
|
6
6
|
${m} ${P}
|
|
7
7
|
${L&&b&&nr[b]}
|
|
8
|
-
${O} ${M} ${d}`,children:k}),L&&e&&b&&l.jsx("label",{htmlFor:y,className:`ms-1 ${ar[b]} ${d}`,children:e})]}),p&&l.jsx("p",{className:`mt-1 text-xs ${x==="invalid"?"text-red-600":"text-green-600"}`,children:p})]})});K.displayName="Select";const sr={primary:"btn-primary",secondary:"btn-secondary",success:"btn-success",danger:"btn-danger",warning:"btn-warning",info:"btn-info",dark:"btn-dark",light:"btn-light",link:"btn-link","outline-primary":"btn-outline-primary","outline-secondary":"btn-outline-secondary","outline-success":"btn-outline-success","outline-danger":"btn-outline-danger","outline-warning":"btn-outline-warning","outline-info":"btn-outline-info","outline-dark":"btn-outline-dark","outline-light":"btn-outline-light","soft-primary":"btn-soft-primary","soft-secondary":"btn-soft-secondary","soft-success":"btn-soft-success","soft-danger":"btn-soft-danger","soft-warning":"btn-soft-warning","soft-info":"btn-soft-info","soft-dark":"btn-soft-dark","soft-light":"btn-soft-light"},ir={xs:"px-3 py-2 text-xs",sm:"px-3 py-2 text-sm",md:"px-5 py-2.5 text-sm",lg:"px-5 py-3 text-base",xl:"px-6 py-3.5 text-base"},dr={flat:"shadow-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full w-10 h-10 p-0 flex items-center justify-center"},hr=({children:r,variant:t="primary",size:e="md",type:o="button",shape:a="rounded",className:u="",isLoading:s=!1,disabled:h=!1,...d})=>{const i=h||s,c=["inline-flex items-center justify-center font-normal transition duration-150",sr[t],ir[e],dr[a],a==="flat"?"shadow-none":"shadow-sm",i?"opacity-50 cursor-not-allowed":"cursor-pointer",u].filter(Boolean).join(" ");return l.jsxs("button",{type:o,className:c,disabled:i,...d,children:[s&&l.jsxs("svg",{"aria-hidden":"true",role:"status",className:"inline w-4 h-4 me-3 text-gray-200 animate-spin dark:text-gray-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),l.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"#1C64F2"})]}),r]})};var U={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},X=n.createContext&&n.createContext(U),ur=["attr","size","title"];function br(r,t){if(r==null)return{};var e=fr(r,t),o,a;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(r);for(a=0;a<u.length;a++)o=u[a],!(t.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(r,o)&&(e[o]=r[o])}return e}function fr(r,t){if(r==null)return{};var e={};for(var o in r)if(Object.prototype.hasOwnProperty.call(r,o)){if(t.indexOf(o)>=0)continue;e[o]=r[o]}return e}function z(){return z=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o])}return r},z.apply(this,arguments)}function Y(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);t&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),e.push.apply(e,o)}return e}function T(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Y(Object(e),!0).forEach(function(o){gr(r,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):Y(Object(e)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(e,o))})}return r}function gr(r,t,e){return t=vr(t),t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function vr(r){var t=pr(r,"string");return typeof t=="symbol"?t:t+""}function pr(r,t){if(typeof r!="object"||!r)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var o=e.call(r,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function J(r){return r&&r.map((t,e)=>n.createElement(t.tag,T({key:e},t.attr),J(t.child)))}function A(r){return t=>n.createElement(yr,z({attr:T({},r.attr)},t),J(r.child))}function yr(r){var t=e=>{var{attr:o,size:a,title:u}=r,s=br(r,ur),h=a||e.size||"1em",d;return e.className&&(d=e.className),r.className&&(d=(d?d+" ":"")+r.className),n.createElement("svg",z({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},e.attr,o,s,{className:d,style:T(T({color:r.color||e.color},e.style),r.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),u&&n.createElement("title",null,u),r.children)};return X!==void 0?n.createElement(X.Consumer,null,e=>t(e)):t(U)}function wr(r){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"},child:[]}]})(r)}const kr={xs:"w-3 h-3 text-[10px]",sm:"w-4 h-4 text-xs",md:"w-5 h-5 text-sm",lg:"w-6 h-6 text-base"},mr={flat:"rounded-none",rounded:"rounded-md",pill:"rounded-full"},xr={primary:"primary",secondary:"secondary",success:"success",danger:"danger",warning:"warning",info:"info",dark:"dark",light:"light",link:"link","outline-primary":"outline-primary","outline-secondary":"outline-secondary","outline-success":"outline-success","outline-danger":"outline-danger","outline-warning":"outline-warning","outline-info":"outline-info","outline-dark":"outline-dark","outline-light":"outline-light","soft-primary":"soft-primary","soft-secondary":"soft-secondary","soft-success":"soft-success","soft-danger":"soft-danger","soft-warning":"soft-warning","soft-info":"soft-info","soft-dark":"soft-dark","soft-light":"soft-light"},Cr=({label:r,boxSize:t="md",shape:e="rounded",variant:o="success",checked:a=!1,onSelectionChange:u,disabled:s=!1,className:h="",id:d,value:i,icon:c,children:b,...f})=>{const v=L=>{!s&&u&&u(L.target.checked)},g="mr-2 border flex items-center justify-center transition-all",p=kr[t],x=mr[e],k=xr[o]??"",N=o.startsWith("outline"),$=o.startsWith("soft"),y=`${g} ${p} ${x} ${k} ${a&&(N||$||o==="link")?"peer-checked:bg-current peer-checked:text-white":a?"peer-checked:bg-current":""}`,E={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5"};return l.jsxs("label",{className:`flex items-center ${s?"opacity-50 cursor-not-allowed":"cursor-pointer"} me-4 ${h}`,children:[l.jsx("input",{type:"checkbox",className:"peer hidden",checked:a,onChange:v,disabled:s,id:d,value:i,...f}),l.jsx("span",{className:y.trim(),children:a&&(c??l.jsx(wr,{className:`${E[t]}`}))}),r||b?l.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-300",children:r??b}):null]})},Sr=({label:r,header:t,items:e=[],onSelect:o,renderItem:a,position:u="right",className:s="",menuClassName:h="",width:d="w-48",closeOnSelect:i=!1,transition:c=!0,ariaLabel:b="Dropdown menu",...f})=>{const[v,g]=n.useState(!1),[p,x]=n.useState(!1),k=n.useRef(null),N=n.useRef(null),$=n.useMemo(()=>({left:"left-0",center:"left-1/2 transform -translate-x-1/2",right:"right-0"})[u],[u]),C=n.useCallback(()=>{const m=N.current,O=k.current;if(!m||!O)return;const{top:M,bottom:P}=m.getBoundingClientRect(),I=O.offsetHeight,j=window.innerHeight-P,H=M;x(j<I&&H>I)},[]),S=n.useCallback(m=>{var O,M;!((O=k.current)!=null&&O.contains(m.target))&&!((M=N.current)!=null&&M.contains(m.target))&&g(!1)},[]),y=n.useCallback(()=>g(m=>!m),[]),E=n.useCallback(()=>g(!1),[]);n.useEffect(()=>{if(v)return C(),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[v,C]),n.useEffect(()=>(document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)),[S]);const L=n.useMemo(()=>["absolute z-50 bg-white rounded shadow-lg overflow-hidden",p?"bottom-full mb-2":"top-full mt-2",$,d,c&&"transition-all duration-200 ease-out",h].filter(Boolean).join(" "),[p,$,d,c,h]);return l.jsxs("div",{className:`relative inline-block ${s}`,...f,children:[l.jsx("button",{ref:N,onClick:y,"aria-expanded":v,"aria-label":b,className:"focus:outline-none",children:r}),v&&l.jsxs("div",{ref:k,role:"menu",className:L,children:[t&&t,e.map((m,O)=>{const M=()=>{o&&o(m),i&&E()};return l.jsx("div",{children:a?a(m,M):l.jsx("div",{onClick:M,className:"px-4 py-2 text-sm text-gray-800 hover:bg-gray-100 cursor-pointer",role:"menuitem",children:m.label})},O)})]})]})},Nr=({children:r,content:t,position:e="top",className:o="",tooltipClass:a="",tooltipStyle:u={}})=>{const s=n.useRef(null),h=n.useRef(null);n.useEffect(()=>{const i=s.current,c=h.current;if(!i||!c)return;const b=()=>{c.style.opacity="1",c.style.visibility="visible"},f=()=>{c.style.opacity="0",c.style.visibility="hidden"};return i.addEventListener("mouseenter",b),i.addEventListener("mouseleave",f),()=>{i.removeEventListener("mouseenter",b),i.removeEventListener("mouseleave",f)}},[]);const d=i=>{const c={position:"absolute",opacity:0,visibility:"hidden",transition:"opacity 0.2s ease",maxWidth:"240px",whiteSpace:"normal",wordBreak:"break-word",padding:"8px 12px",fontSize:"0.875rem",backgroundColor:"black",color:"white",borderRadius:"4px",boxShadow:"0px 4px 12px rgba(0, 0, 0, 0.15)",zIndex:9999,width:"max-content"};switch(i){case"top":return{...c,bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};case"bottom":return{...c,top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"left":return{...c,right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"right":return{...c,left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};default:return c}};return l.jsxs("div",{ref:s,className:`relative inline-block ${o}`,children:[r,l.jsx("div",{ref:h,role:"tooltip",className:a,style:{...d(e),...u},children:t})]})},$r={primary:"bg-blue-500 text-white",secondary:"bg-gray-500 text-white",success:"bg-green-500 text-white",danger:"bg-red-500 text-white",warning:"bg-yellow-400 text-black",info:"bg-cyan-500 text-white",dark:"bg-black text-white",light:"bg-gray-100 text-gray-800",link:"bg-transparent text-blue-500 underline","outline-primary":"border border-blue-500 text-blue-500 bg-transparent","outline-secondary":"border border-gray-500 text-gray-500 bg-transparent","outline-success":"border border-green-500 text-green-500 bg-transparent","outline-danger":"border border-red-500 text-red-500 bg-transparent","outline-warning":"border border-yellow-400 text-yellow-500 bg-transparent","outline-info":"border border-cyan-500 text-cyan-500 bg-transparent","outline-dark":"border border-black text-black bg-transparent","outline-light":"border border-gray-100 text-gray-800 bg-transparent"},Er={xs:"text-xs px-2 py-0.5",sm:"text-sm px-2.5 py-0.5",md:"text-base px-3 py-1",lg:"text-lg px-3.5 py-1.5",xl:"text-xl px-4 py-2"},Lr={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full p-2 w-8 h-8 justify-center"},Or=({label:r,variant:t="primary",size:e="sm",shape:o="rounded",icon:a,dismissible:u,onDismiss:s,className:h="",...d})=>{const i=!r&&!!a,c=`inline-flex items-center font-medium ${$r[t]||""} ${Er[e]||""} ${Lr[o]||""} ${i?"justify-center p-2 w-8 h-8":""} `+h;return l.jsxs("span",{className:c.trim(),...d,children:[a&&l.jsx("span",{className:r?"mr-1":"",children:a}),r,u&&l.jsx("button",{type:"button",onClick:s,className:"ml-2 text-xs font-bold leading-none focus:outline-none",children:"×"})]})};function Mr(r){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z"},child:[]}]})(r)}const jr=({items:r,allowMultipleOpen:t=!1,className:e="",tileClasses:o="",open:a,onChange:u,renderTitle:s,renderContent:h,showArrowIcon:d=!0,panelClasses:i=""})=>{const[c,b]=n.useState(new Set),f=n.useMemo(()=>a?new Set(a):c,[a,c]),v=n.useCallback(g=>{const p=new Set(f);p.has(g)?p.delete(g):(t||p.clear(),p.add(g)),a&&u?u(Array.from(p)):b(p)},[f,a,u,t]);return l.jsx("div",{className:"accordion",role:"region","aria-multiselectable":t,children:r.map(g=>{const p=f.has(g.id),x=`accordion-heading-${g.id}`,k=`accordion-panel-${g.id}`;return l.jsxs("div",{className:`accordion-item border rounded border-gray-300 dark:border-gray-700 ${e}`,children:[l.jsxs("button",{id:x,type:"button","aria-expanded":p,"aria-controls":k,onClick:()=>v(g.id),className:`flex justify-between items-center w-full p-1.5 text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none gap-3 ${o}`,children:[s?s(g,p):g.title,d?l.jsx(Mr,{}):null]}),l.jsx("div",{id:k,role:"region","aria-labelledby":x,hidden:!p,className:`p-4 border-t border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 ${i}`,children:h?h(g,p):g.content})]},g.id)})})},Q=n.createContext(null),D=()=>{const r=n.useContext(Q);if(!r)throw new Error("useModalActions must be used within a ModalActionProvider");return r},V=n.createContext(null),_=()=>n.useContext(V);function Pr({id:r,title:t,children:e,standalone:o=!1,showFloatingClose:a=!1,containerClasses:u="",onClose:s,disableEscapeClose:h=!1}){const d=_(),i=D(),c=!o&&!!d&&!!i,[b,f]=n.useState(!1),v=c?d.isOpen(r):b,g=c?d.getModalData(r):null,p=n.useCallback(()=>{c?i.closeModal(r):f(!1),s==null||s()},[c,i,r,s]);return n.useEffect(()=>{const x=document.activeElement;console.log(r);const k=document.getElementById(r);console.log("modalEl=",k);const N=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'],$=()=>{if(!k)return[];const y=k.querySelectorAll(N.join(","));return Array.from(y).filter(E=>E.offsetParent!==null)},C=y=>{if(y.key==="Tab"){const E=$();if(E.length===0)return;const L=E[0],m=E[E.length-1];y.shiftKey?document.activeElement===L&&(y.preventDefault(),m.focus()):document.activeElement===m&&(y.preventDefault(),L.focus())}},S=y=>{y.key==="Escape"&&!h&&p(),C(y)};return v&&(document.body.style.overflow="hidden",setTimeout(()=>{const y=$();y.length&&y[0].focus()},0),window.addEventListener("keydown",S)),()=>{document.body.style.overflow="",x&&x.focus(),window.removeEventListener("keydown",S)}},[v,h,p,r]),v?l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]",id:r,children:l.jsxs("div",{className:`bg-white rounded-lg shadow-lg w-full max-w-md p-4 transform transition-all duration-300 scale-100 ${u}`,children:[l.jsxs("div",{className:"flex justify-between items-center relative",children:[t&&l.jsx("h2",{className:"text-lg font-semibold",children:t}),a&&l.jsx("button",{onClick:p,className:"text-gray-500 hover:text-black absolute top-2 right-3 hover:bg-gray-200 rounded-full aspect-square w-8","aria-label":"Close modal",children:"✕"})]}),l.jsx("div",{className:"mt-3 text-sm text-gray-700",children:typeof e=="function"?e({modalData:g}):e})]})}):null}function Ir({children:r}){const[t,e]=n.useState({}),[o,a]=n.useState({}),u=n.useCallback((b,f)=>{e(v=>({...v,[b]:!0})),f&&a(v=>({...v,[b]:f}))},[]),s=n.useCallback(b=>{e(f=>({...f,[b]:!1})),a(f=>{const v={...f};return delete v[b],v})},[]),h=n.useCallback(b=>!!t[b],[t]),d=n.useCallback(b=>o[b],[o]),i=n.useMemo(()=>({openModal:u,closeModal:s}),[u,s]),c=n.useMemo(()=>({isOpen:h,getModalData:d}),[h,d]);return l.jsx(Q.Provider,{value:i,children:l.jsx(V.Provider,{value:c,children:r})})}function zr(r){const{openModal:t,closeModal:e}=D(),{isOpen:o,getModalData:a}=_();return{open:u=>t(r,u),close:()=>e(r),isOpen:o(r),data:a(r)}}let B=null,F={};function Tr(r){B=r}function Ar(r){F={...F,...r}}function Dr(){return F}function _r(r,t,e=3e3,o){B?B(r,t,e,o):console.warn("Toast system is not mounted")}function Br(r){return A({attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor"},child:[]}]})(r)}const Fr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){const t=Math.random()*16|0;return(r==="x"?t:t&3|8).toString(16)}),Hr=()=>{const[r,t]=n.useState([]);n.useEffect(()=>{Tr((o,a,u,s)=>{const h=Fr();t(d=>[...d,{id:h,type:o,message:a,config:s}]),setTimeout(()=>{t(d=>d.filter(i=>i.id!==h))},u)})},[]);const e=Dr();return l.jsx("div",{className:"fixed top-5 right-5 z-[9999] flex flex-col gap-2",children:r.map(o=>{var d,i,c,b,f,v,g,p,x,k,N,$,C;const a=((d=o.config)==null?void 0:d.icon)||((i=e.icons)==null?void 0:i[o.type])||Wr(o.type),u=((c=o.config)==null?void 0:c.bgColor)||((f=(b=e.colors)==null?void 0:b[o.type])==null?void 0:f.bg)||"bg-white dark:bg-gray-800",s=((v=o.config)==null?void 0:v.textColor)||((p=(g=e.colors)==null?void 0:g[o.type])==null?void 0:p.text)||"text-gray-700 dark:text-gray-300",h=((x=o.config)==null?void 0:x.iconContainerClass)||"w-8 h-8 mr-3 text-xl flex items-center justify-center";return l.jsxs("div",{className:`flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${u} ${s}`,children:[l.jsx("div",{className:h,children:a}),l.jsxs("div",{className:"flex-1 me-3",children:[((k=o.config)==null?void 0:k.title)&&l.jsx("div",{className:"font-semibold text-black",children:o.config.title}),((N=o.config)==null?void 0:N.description)&&l.jsx("div",{className:"text-sm text-gray-500",children:o.config.description}),!(($=o.config)!=null&&$.title)&&!((C=o.config)!=null&&C.description)&&l.jsx("div",{className:"text-sm",children:o.message})]}),l.jsx("button",{onClick:()=>t(S=>S.filter(y=>y.id!==o.id)),className:"ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white","aria-label":"Close",children:l.jsx(Br,{size:18})})]},o.id)})})};function Wr(r){switch(r){case"success":return"✅";case"error":return"❌";case"warning":return"⚠️";case"info":return"ℹ️"}}w.Accordion=jr,w.Badge=Or,w.Button=hr,w.Checkbox=Cr,w.Dropdown=Sr,w.Input=q,w.Modal=Pr,w.ModalProvider=Ir,w.Select=K,w.Toast=Hr,w.Tooltip=Nr,w.setToastDefaults=Ar,w.showToast=_r,w.useModalActions=D,w.useModalInstance=zr,w.useModalState=_,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|
|
8
|
+
${O} ${M} ${d}`,children:k}),L&&e&&b&&l.jsx("label",{htmlFor:y,className:`ms-1 ${ar[b]} ${d}`,children:e})]}),p&&l.jsx("p",{className:`mt-1 text-xs ${x==="invalid"?"text-red-600":"text-green-600"}`,children:p})]})});K.displayName="Select";const sr={primary:"btn-primary",secondary:"btn-secondary",success:"btn-success",danger:"btn-danger",warning:"btn-warning",info:"btn-info",dark:"btn-dark",light:"btn-light",link:"btn-link","outline-primary":"btn-outline-primary","outline-secondary":"btn-outline-secondary","outline-success":"btn-outline-success","outline-danger":"btn-outline-danger","outline-warning":"btn-outline-warning","outline-info":"btn-outline-info","outline-dark":"btn-outline-dark","outline-light":"btn-outline-light","soft-primary":"btn-soft-primary","soft-secondary":"btn-soft-secondary","soft-success":"btn-soft-success","soft-danger":"btn-soft-danger","soft-warning":"btn-soft-warning","soft-info":"btn-soft-info","soft-dark":"btn-soft-dark","soft-light":"btn-soft-light"},ir={xs:"px-3 py-2 text-xs",sm:"px-3 py-2 text-sm",md:"px-5 py-2.5 text-sm",lg:"px-5 py-3 text-base",xl:"px-6 py-3.5 text-base"},dr={flat:"shadow-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full w-10 h-10 p-0 flex items-center justify-center"},hr=({children:r,variant:t="primary",size:e="md",type:o="button",shape:a="rounded",className:u="",isLoading:s=!1,disabled:h=!1,...d})=>{const i=h||s,c=["inline-flex items-center justify-center font-normal transition duration-150",sr[t],ir[e],dr[a],a==="flat"?"shadow-none":"shadow-sm",i?"opacity-50 cursor-not-allowed":"cursor-pointer",u].filter(Boolean).join(" ");return l.jsxs("button",{type:o,className:c,disabled:i,...d,children:[s&&l.jsxs("svg",{"aria-hidden":"true",role:"status",className:"inline w-4 h-4 me-3 text-gray-200 animate-spin dark:text-gray-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),l.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"#1C64F2"})]}),r]})};var U={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},X=n.createContext&&n.createContext(U),ur=["attr","size","title"];function br(r,t){if(r==null)return{};var e=fr(r,t),o,a;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(r);for(a=0;a<u.length;a++)o=u[a],!(t.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(r,o)&&(e[o]=r[o])}return e}function fr(r,t){if(r==null)return{};var e={};for(var o in r)if(Object.prototype.hasOwnProperty.call(r,o)){if(t.indexOf(o)>=0)continue;e[o]=r[o]}return e}function z(){return z=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o])}return r},z.apply(this,arguments)}function Y(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);t&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),e.push.apply(e,o)}return e}function T(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Y(Object(e),!0).forEach(function(o){gr(r,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):Y(Object(e)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(e,o))})}return r}function gr(r,t,e){return t=vr(t),t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function vr(r){var t=pr(r,"string");return typeof t=="symbol"?t:t+""}function pr(r,t){if(typeof r!="object"||!r)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var o=e.call(r,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function J(r){return r&&r.map((t,e)=>n.createElement(t.tag,T({key:e},t.attr),J(t.child)))}function A(r){return t=>n.createElement(yr,z({attr:T({},r.attr)},t),J(r.child))}function yr(r){var t=e=>{var{attr:o,size:a,title:u}=r,s=br(r,ur),h=a||e.size||"1em",d;return e.className&&(d=e.className),r.className&&(d=(d?d+" ":"")+r.className),n.createElement("svg",z({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},e.attr,o,s,{className:d,style:T(T({color:r.color||e.color},e.style),r.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),u&&n.createElement("title",null,u),r.children)};return X!==void 0?n.createElement(X.Consumer,null,e=>t(e)):t(U)}function wr(r){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"},child:[]}]})(r)}const kr={xs:"w-3 h-3 text-[10px]",sm:"w-4 h-4 text-xs",md:"w-5 h-5 text-sm",lg:"w-6 h-6 text-base"},mr={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full"},xr={primary:"primary",secondary:"secondary",success:"success",danger:"danger",warning:"warning",info:"info",dark:"dark",light:"light",link:"link","outline-primary":"outline-primary","outline-secondary":"outline-secondary","outline-success":"outline-success","outline-danger":"outline-danger","outline-warning":"outline-warning","outline-info":"outline-info","outline-dark":"outline-dark","outline-light":"outline-light","soft-primary":"soft-primary","soft-secondary":"soft-secondary","soft-success":"soft-success","soft-danger":"soft-danger","soft-warning":"soft-warning","soft-info":"soft-info","soft-dark":"soft-dark","soft-light":"soft-light"},Cr=({label:r,boxSize:t="md",shape:e="rounded",variant:o="success",checked:a=!1,onSelectionChange:u,disabled:s=!1,className:h="",id:d,value:i,icon:c,children:b,...f})=>{const v=L=>{!s&&u&&u(L.target.checked)},g="mr-2 border flex items-center justify-center transition-all",p=kr[t],x=mr[e],k=xr[o]??"",N=o.startsWith("outline"),$=o.startsWith("soft"),y=`${g} ${p} ${x} ${k} ${a&&(N||$||o==="link")?"peer-checked:bg-current peer-checked:text-white":a?"peer-checked:bg-current":""}`,E={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5"};return l.jsxs("label",{className:`flex items-center ${s?"opacity-50 cursor-not-allowed":"cursor-pointer"} me-4 ${h}`,children:[l.jsx("input",{type:"checkbox",className:"peer hidden",checked:a,onChange:v,disabled:s,id:d,value:i,...f}),l.jsx("span",{className:y.trim(),children:a&&(c??l.jsx(wr,{className:`${E[t]}`}))}),r||b?l.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-300",children:r??b}):null]})},Sr=({label:r,header:t,items:e=[],onSelect:o,renderItem:a,position:u="right",className:s="",menuClassName:h="",width:d="w-48",closeOnSelect:i=!1,transition:c=!0,ariaLabel:b="Dropdown menu",...f})=>{const[v,g]=n.useState(!1),[p,x]=n.useState(!1),k=n.useRef(null),N=n.useRef(null),$=n.useMemo(()=>({left:"left-0",center:"left-1/2 transform -translate-x-1/2",right:"right-0"})[u],[u]),C=n.useCallback(()=>{const m=N.current,O=k.current;if(!m||!O)return;const{top:M,bottom:P}=m.getBoundingClientRect(),I=O.offsetHeight,j=window.innerHeight-P,H=M;x(j<I&&H>I)},[]),S=n.useCallback(m=>{var O,M;!((O=k.current)!=null&&O.contains(m.target))&&!((M=N.current)!=null&&M.contains(m.target))&&g(!1)},[]),y=n.useCallback(()=>g(m=>!m),[]),E=n.useCallback(()=>g(!1),[]);n.useEffect(()=>{if(v)return C(),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[v,C]),n.useEffect(()=>(document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)),[S]);const L=n.useMemo(()=>["absolute z-50 bg-white rounded shadow-lg overflow-hidden",p?"bottom-full mb-2":"top-full mt-2",$,d,c&&"transition-all duration-200 ease-out",h].filter(Boolean).join(" "),[p,$,d,c,h]);return l.jsxs("div",{className:`relative inline-block ${s}`,...f,children:[l.jsx("button",{ref:N,onClick:y,"aria-expanded":v,"aria-label":b,className:"focus:outline-none",children:r}),v&&l.jsxs("div",{ref:k,role:"menu",className:L,children:[t&&t,e.map((m,O)=>{const M=()=>{o&&o(m),i&&E()};return l.jsx("div",{children:a?a(m,M):l.jsx("div",{onClick:M,className:"px-4 py-2 text-sm text-gray-800 hover:bg-gray-100 cursor-pointer",role:"menuitem",children:m.label})},O)})]})]})},Nr=({children:r,content:t,position:e="top",className:o="",tooltipClass:a="",tooltipStyle:u={}})=>{const s=n.useRef(null),h=n.useRef(null);n.useEffect(()=>{const i=s.current,c=h.current;if(!i||!c)return;const b=()=>{c.style.opacity="1",c.style.visibility="visible"},f=()=>{c.style.opacity="0",c.style.visibility="hidden"};return i.addEventListener("mouseenter",b),i.addEventListener("mouseleave",f),()=>{i.removeEventListener("mouseenter",b),i.removeEventListener("mouseleave",f)}},[]);const d=i=>{const c={position:"absolute",opacity:0,visibility:"hidden",transition:"opacity 0.2s ease",maxWidth:"240px",whiteSpace:"normal",wordBreak:"break-word",padding:"8px 12px",fontSize:"0.875rem",backgroundColor:"black",color:"white",borderRadius:"4px",boxShadow:"0px 4px 12px rgba(0, 0, 0, 0.15)",zIndex:9999,width:"max-content"};switch(i){case"top":return{...c,bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};case"bottom":return{...c,top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"left":return{...c,right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"right":return{...c,left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};default:return c}};return l.jsxs("div",{ref:s,className:`relative inline-block ${o}`,children:[r,l.jsx("div",{ref:h,role:"tooltip",className:a,style:{...d(e),...u},children:t})]})},$r={primary:"bg-blue-500 text-white",secondary:"bg-gray-500 text-white",success:"bg-green-500 text-white",danger:"bg-red-500 text-white",warning:"bg-yellow-400 text-black",info:"bg-cyan-500 text-white",dark:"bg-black text-white",light:"bg-gray-100 text-gray-800",link:"bg-transparent text-blue-500 underline","outline-primary":"border border-blue-500 text-blue-500 bg-transparent","outline-secondary":"border border-gray-500 text-gray-500 bg-transparent","outline-success":"border border-green-500 text-green-500 bg-transparent","outline-danger":"border border-red-500 text-red-500 bg-transparent","outline-warning":"border border-yellow-400 text-yellow-500 bg-transparent","outline-info":"border border-cyan-500 text-cyan-500 bg-transparent","outline-dark":"border border-black text-black bg-transparent","outline-light":"border border-gray-100 text-gray-800 bg-transparent"},Er={xs:"text-xs px-2 py-0.5",sm:"text-sm px-2.5 py-0.5",md:"text-base px-3 py-1",lg:"text-lg px-3.5 py-1.5",xl:"text-xl px-4 py-2"},Lr={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full p-2 w-8 h-8 justify-center"},Or=({label:r,variant:t="primary",size:e="sm",shape:o="rounded",icon:a,dismissible:u,onDismiss:s,className:h="",...d})=>{const i=!r&&!!a,c=`inline-flex items-center font-medium ${$r[t]||""} ${Er[e]||""} ${Lr[o]||""} ${i?"justify-center p-2 w-8 h-8":""} `+h;return l.jsxs("span",{className:c.trim(),...d,children:[a&&l.jsx("span",{className:r?"mr-1":"",children:a}),r,u&&l.jsx("button",{type:"button",onClick:s,className:"ml-2 text-xs font-bold leading-none focus:outline-none",children:"×"})]})};function Mr(r){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z"},child:[]}]})(r)}const jr=({items:r,allowMultipleOpen:t=!1,className:e="",tileClasses:o="",open:a,onChange:u,renderTitle:s,renderContent:h,showArrowIcon:d=!0,panelClasses:i=""})=>{const[c,b]=n.useState(new Set),f=n.useMemo(()=>a?new Set(a):c,[a,c]),v=n.useCallback(g=>{const p=new Set(f);p.has(g)?p.delete(g):(t||p.clear(),p.add(g)),a&&u?u(Array.from(p)):b(p)},[f,a,u,t]);return l.jsx("div",{className:"accordion",role:"region","aria-multiselectable":t,children:r.map(g=>{const p=f.has(g.id),x=`accordion-heading-${g.id}`,k=`accordion-panel-${g.id}`;return l.jsxs("div",{className:`accordion-item border rounded border-gray-300 dark:border-gray-700 ${e}`,children:[l.jsxs("button",{id:x,type:"button","aria-expanded":p,"aria-controls":k,onClick:()=>v(g.id),className:`flex justify-between items-center w-full p-1.5 text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none gap-3 ${o}`,children:[s?s(g,p):g.title,d?l.jsx(Mr,{}):null]}),l.jsx("div",{id:k,role:"region","aria-labelledby":x,hidden:!p,className:`p-4 border-t border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 ${i}`,children:h?h(g,p):g.content})]},g.id)})})},Q=n.createContext(null),D=()=>{const r=n.useContext(Q);if(!r)throw new Error("useModalActions must be used within a ModalActionProvider");return r},V=n.createContext(null),_=()=>n.useContext(V);function Pr({id:r,title:t,children:e,standalone:o=!1,showFloatingClose:a=!1,containerClasses:u="",onClose:s,disableEscapeClose:h=!1}){const d=_(),i=D(),c=!o&&!!d&&!!i,[b,f]=n.useState(!1),v=c?d.isOpen(r):b,g=c?d.getModalData(r):null,p=n.useCallback(()=>{c?i.closeModal(r):f(!1),s==null||s()},[c,i,r,s]);return n.useEffect(()=>{const x=document.activeElement;console.log(r);const k=document.getElementById(r);console.log("modalEl=",k);const N=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'],$=()=>{if(!k)return[];const y=k.querySelectorAll(N.join(","));return Array.from(y).filter(E=>E.offsetParent!==null)},C=y=>{if(y.key==="Tab"){const E=$();if(E.length===0)return;const L=E[0],m=E[E.length-1];y.shiftKey?document.activeElement===L&&(y.preventDefault(),m.focus()):document.activeElement===m&&(y.preventDefault(),L.focus())}},S=y=>{y.key==="Escape"&&!h&&p(),C(y)};return v&&(document.body.style.overflow="hidden",setTimeout(()=>{const y=$();y.length&&y[0].focus()},0),window.addEventListener("keydown",S)),()=>{document.body.style.overflow="",x&&x.focus(),window.removeEventListener("keydown",S)}},[v,h,p,r]),v?l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]",id:r,children:l.jsxs("div",{className:`bg-white rounded-lg shadow-lg w-full max-w-md p-4 transform transition-all duration-300 scale-100 ${u}`,children:[l.jsxs("div",{className:"flex justify-between items-center relative",children:[t&&l.jsx("h2",{className:"text-lg font-semibold",children:t}),a&&l.jsx("button",{onClick:p,className:"text-gray-500 hover:text-black absolute top-2 right-3 hover:bg-gray-200 rounded-full aspect-square w-8","aria-label":"Close modal",children:"✕"})]}),l.jsx("div",{className:"mt-3 text-sm text-gray-700",children:typeof e=="function"?e({modalData:g}):e})]})}):null}function Ir({children:r}){const[t,e]=n.useState({}),[o,a]=n.useState({}),u=n.useCallback((b,f)=>{e(v=>({...v,[b]:!0})),f&&a(v=>({...v,[b]:f}))},[]),s=n.useCallback(b=>{e(f=>({...f,[b]:!1})),a(f=>{const v={...f};return delete v[b],v})},[]),h=n.useCallback(b=>!!t[b],[t]),d=n.useCallback(b=>o[b],[o]),i=n.useMemo(()=>({openModal:u,closeModal:s}),[u,s]),c=n.useMemo(()=>({isOpen:h,getModalData:d}),[h,d]);return l.jsx(Q.Provider,{value:i,children:l.jsx(V.Provider,{value:c,children:r})})}function zr(r){const{openModal:t,closeModal:e}=D(),{isOpen:o,getModalData:a}=_();return{open:u=>t(r,u),close:()=>e(r),isOpen:o(r),data:a(r)}}let B=null,F={};function Tr(r){B=r}function Ar(r){F={...F,...r}}function Dr(){return F}function _r(r,t,e=3e3,o){B?B(r,t,e,o):console.warn("Toast system is not mounted")}function Br(r){return A({attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor"},child:[]}]})(r)}const Fr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){const t=Math.random()*16|0;return(r==="x"?t:t&3|8).toString(16)}),Hr=()=>{const[r,t]=n.useState([]);n.useEffect(()=>{Tr((o,a,u,s)=>{const h=Fr();t(d=>[...d,{id:h,type:o,message:a,config:s}]),setTimeout(()=>{t(d=>d.filter(i=>i.id!==h))},u)})},[]);const e=Dr();return l.jsx("div",{className:"fixed top-5 right-5 z-[9999] flex flex-col gap-2",children:r.map(o=>{var d,i,c,b,f,v,g,p,x,k,N,$,C;const a=((d=o.config)==null?void 0:d.icon)||((i=e.icons)==null?void 0:i[o.type])||Wr(o.type),u=((c=o.config)==null?void 0:c.bgColor)||((f=(b=e.colors)==null?void 0:b[o.type])==null?void 0:f.bg)||"bg-white dark:bg-gray-800",s=((v=o.config)==null?void 0:v.textColor)||((p=(g=e.colors)==null?void 0:g[o.type])==null?void 0:p.text)||"text-gray-700 dark:text-gray-300",h=((x=o.config)==null?void 0:x.iconContainerClass)||"w-8 h-8 mr-3 text-xl flex items-center justify-center";return l.jsxs("div",{className:`flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${u} ${s}`,children:[l.jsx("div",{className:h,children:a}),l.jsxs("div",{className:"flex-1 me-3",children:[((k=o.config)==null?void 0:k.title)&&l.jsx("div",{className:"font-semibold text-black",children:o.config.title}),((N=o.config)==null?void 0:N.description)&&l.jsx("div",{className:"text-sm text-gray-500",children:o.config.description}),!(($=o.config)!=null&&$.title)&&!((C=o.config)!=null&&C.description)&&l.jsx("div",{className:"text-sm",children:o.message})]}),l.jsx("button",{onClick:()=>t(S=>S.filter(y=>y.id!==o.id)),className:"ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white","aria-label":"Close",children:l.jsx(Br,{size:18})})]},o.id)})})};function Wr(r){switch(r){case"success":return"✅";case"error":return"❌";case"warning":return"⚠️";case"info":return"ℹ️"}}w.Accordion=jr,w.Badge=Or,w.Button=hr,w.Checkbox=Cr,w.Dropdown=Sr,w.Input=q,w.Modal=Pr,w.ModalProvider=Ir,w.Select=K,w.Toast=Hr,w.Tooltip=Nr,w.setToastDefaults=Ar,w.showToast=_r,w.useModalActions=D,w.useModalInstance=zr,w.useModalState=_,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|