tailwind-ux-kit 1.0.113 → 1.0.114

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.
@@ -143,7 +143,7 @@ const oe = {
143
143
  "label",
144
144
  {
145
145
  htmlFor: T,
146
- className: `ms-1 ${$e[u]} ${p}`,
146
+ className: `ms-1 ${$e[u]} ${w}`,
147
147
  children: t
148
148
  }
149
149
  )
@@ -2,7 +2,7 @@
2
2
  /*$vite$:1*/`,document.head.appendChild(R);const ee={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"},oe={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full"},be={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"},ve={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"},pe=(e,r,o)=>{if(o)return"border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";if(r)return"border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:ring-green-500 focus:border-green-500";switch(e){case"error":return"border-red-500 bg-red-50 focus:ring-red-500";case"warning":return"border-yellow-500 bg-yellow-50 focus:ring-yellow-500";case"success":return"border-green-500 bg-green-50 focus:ring-green-500";default:return"border-gray-300 focus:ring-blue-500"}},re=l.forwardRef((e,r)=>{const{label:o,id:t,inputSize:n="md",shape:i="rounded",validate:f,onValidatedChange:u,className:g="",icon:c,iconPosition:s="left",floatingLabelStyle:h,onChange:b,isValid:p,isInvalid:d,feedback:k,feedbackType:O="invalid",labelClasses:m="",inputType:$="",inputPattern:E,leftIcon:w,rightIcon:x,...y}=e,[T,L]=l.useState("default"),D=l.useCallback(S=>{const P=S.target.value,z=(f==null?void 0:f(P))??"default";L(z),u==null||u(S,z),b==null||b(S)},[f,u,b]),B=l.useMemo(()=>t||(typeof o=="string"?`input-${o.toLowerCase().replace(/\s+/g,"-")}`:`input-${Math.random().toString(36).slice(2)}`),[t,o]),v=!!h,N=ee[n]||ee.md,M=oe[i]||oe.flat,I=l.useMemo(()=>pe(T,p,d),[T,p,d]),j=l.useMemo(()=>c?s==="start"||s==="left"?"ps-10":"pe-10":"",[c,s]),A=S=>{var F;const P=S.key;!(S.ctrlKey||S.metaKey||P.length!==1||["Backspace","ArrowLeft","ArrowRight","Delete","Tab"].includes(P))&&(()=>{const _=/^\d$/,V=/^[a-zA-Z]$/;switch($){case"numeric":case"number":case"integer":return!_.test(P);case"decimal":return!_.test(P)&&P!=="."&&P!=="Backspace"&&P!=="Tab";case"alphabetic":return!V.test(P);case"custom":return E?!E.test(P):!1;default:return!1}})()&&S.preventDefault(),(F=y.onKeyDown)==null||F.call(y,S)},K=S=>{var Y;const P=S.clipboardData.getData("Text");(()=>{const F=/^\d+$/,_=/^\d*\.?\d*$/,V=/^[a-zA-Z]+$/;switch($){case"numeric":case"number":case"integer":return!F.test(P);case"decimal":return!_.test(P);case"alphabetic":return!V.test(P);case"custom":return E?!E.test(P):!1;default:return!1}})()&&S.preventDefault(),(Y=y.onPaste)==null||Y.call(y,S)},J=!!w,Q=!!x;return a.jsxs("div",{className:`w-full relative ${v?"z-0":""} tailwind-ux-input`,children:[!v&&o&&a.jsx("label",{htmlFor:B,className:`block mb-1 text-sm ${p?"text-green-700 dark:text-green-500":d?"text-red-700 dark:text-red-500":"text-gray-700"} ${m}`,children:o}),a.jsxs("div",{className:"relative w-full",children:[J&&a.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3.5",children:w}),Q&&a.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3.5",children:x}),a.jsx("input",{...y,id:B,ref:r,placeholder:v?" ":y.placeholder,onChange:D,onKeyDown:A,onPaste:K,className:`border peer w-full block font-normal appearance-none focus:outline-none focus:ring-0 transition text-gray-900 placeholder-gray-600 border-gray-400
3
3
  ${N}
4
4
  ${v&&h&&be[h]}
5
- ${j} ${M} ${I} ${g}`}),v&&o&&h&&a.jsx("label",{htmlFor:B,className:`ms-1 ${ve[h]} ${g}`,children:o})]}),k&&a.jsx("p",{className:`mt-1 text-xs ${O==="invalid"?"text-red-600 dark:text-red-500":"text-green-600 dark:text-green-500"}`,role:O==="invalid"?"alert":void 0,children:k})]})});re.displayName="Input";const ye={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"},we={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full"},ke={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"},me={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"},xe=(e,r,o)=>{if(o)return"border-red-500 bg-red-50 text-red-900 focus:ring-red-500 focus:border-red-500";if(r)return"border-green-500 bg-green-50 text-green-900 focus:ring-green-500 focus:border-green-500";const t="focus:ring focus:border";switch(e){case"error":return`${t}-red-500 border-red-500 bg-red-50`;case"warning":return`${t}-yellow-500 border-yellow-500 bg-yellow-50`;case"success":return`${t}-green-500 border-green-500 bg-green-50`;default:return"border-gray-300 focus:ring-blue-500"}},te=l.forwardRef((e,r)=>{const{label:o,id:t,inputSize:n="md",shape:i="rounded",validate:f,onValidatedChange:u,className:g="",icon:c,iconPosition:s="left",floatingLabelStyle:h,onChange:b,isValid:p,isInvalid:d,feedback:k,feedbackType:O="invalid",children:m,...$}=e,[E,w]=l.useState("default"),x=l.useId(),y=l.useMemo(()=>t||(typeof o=="string"?`select-${o.toLowerCase().replace(/\s+/g,"-")}`:x),[t,o,x]),T=I=>{const j=I.target.value,A=(f==null?void 0:f(j))??"default";w(A),u==null||u(I,A),b==null||b(I)},L=!!h,D=ye[n],B=we[i],v=xe(E,p,d),N=c&&(s==="start"||s==="left")?"ps-10":c?"pe-10":"",M=s==="start"||s==="left"?"left-0 ps-3.5":"right-0 pe-3.5";return a.jsxs("div",{className:`w-full relative ${L?"z-0":""}`,children:[!L&&o&&a.jsx("label",{htmlFor:y,className:`block mb-1 text-sm ${p?"text-green-700":d?"text-red-700":"text-gray-700"}`,children:o}),a.jsxs("div",{className:"relative w-full",children:[c&&a.jsx("div",{className:`absolute inset-y-0 flex items-center ${M}`,children:a.jsx("span",{className:"text-gray-500",children:c})}),a.jsx("select",{...$,id:y,ref:r,onChange:T,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
5
+ ${j} ${M} ${I} ${g}`}),v&&o&&h&&a.jsx("label",{htmlFor:B,className:`ms-1 ${ve[h]} ${m}`,children:o})]}),k&&a.jsx("p",{className:`mt-1 text-xs ${O==="invalid"?"text-red-600 dark:text-red-500":"text-green-600 dark:text-green-500"}`,role:O==="invalid"?"alert":void 0,children:k})]})});re.displayName="Input";const ye={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"},we={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full"},ke={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"},me={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"},xe=(e,r,o)=>{if(o)return"border-red-500 bg-red-50 text-red-900 focus:ring-red-500 focus:border-red-500";if(r)return"border-green-500 bg-green-50 text-green-900 focus:ring-green-500 focus:border-green-500";const t="focus:ring focus:border";switch(e){case"error":return`${t}-red-500 border-red-500 bg-red-50`;case"warning":return`${t}-yellow-500 border-yellow-500 bg-yellow-50`;case"success":return`${t}-green-500 border-green-500 bg-green-50`;default:return"border-gray-300 focus:ring-blue-500"}},te=l.forwardRef((e,r)=>{const{label:o,id:t,inputSize:n="md",shape:i="rounded",validate:f,onValidatedChange:u,className:g="",icon:c,iconPosition:s="left",floatingLabelStyle:h,onChange:b,isValid:p,isInvalid:d,feedback:k,feedbackType:O="invalid",children:m,...$}=e,[E,w]=l.useState("default"),x=l.useId(),y=l.useMemo(()=>t||(typeof o=="string"?`select-${o.toLowerCase().replace(/\s+/g,"-")}`:x),[t,o,x]),T=I=>{const j=I.target.value,A=(f==null?void 0:f(j))??"default";w(A),u==null||u(I,A),b==null||b(I)},L=!!h,D=ye[n],B=we[i],v=xe(E,p,d),N=c&&(s==="start"||s==="left")?"ps-10":c?"pe-10":"",M=s==="start"||s==="left"?"left-0 ps-3.5":"right-0 pe-3.5";return a.jsxs("div",{className:`w-full relative ${L?"z-0":""}`,children:[!L&&o&&a.jsx("label",{htmlFor:y,className:`block mb-1 text-sm ${p?"text-green-700":d?"text-red-700":"text-gray-700"}`,children:o}),a.jsxs("div",{className:"relative w-full",children:[c&&a.jsx("div",{className:`absolute inset-y-0 flex items-center ${M}`,children:a.jsx("span",{className:"text-gray-500",children:c})}),a.jsx("select",{...$,id:y,ref:r,onChange:T,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
  ${D} ${N}
7
7
  ${L&&h&&ke[h]}
8
8
  ${B} ${v} ${g}`,children:m}),L&&o&&h&&a.jsx("label",{htmlFor:y,className:`ms-1 ${me[h]} ${g}`,children:o})]}),k&&a.jsx("p",{className:`mt-1 text-xs ${O==="invalid"?"text-red-600":"text-green-600"}`,children:k})]})});te.displayName="Select";const Ce={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"},Se={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"},$e={flat:"shadow-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full w-10 h-10 p-0 flex items-center justify-center"},Ne=({children:e,variant:r="primary",size:o="md",type:t="button",shape:n="rounded",className:i="",isLoading:f=!1,disabled:u=!1,...g})=>{const c=u||f,s=["inline-flex items-center justify-center font-normal transition duration-150",Ce[r],Se[o],$e[n],n==="flat"?"shadow-none":"shadow-sm",c?"opacity-50 cursor-not-allowed":"cursor-pointer",i].filter(Boolean).join(" ");return a.jsxs("button",{type:t,className:s,disabled:c,...g,children:[f&&a.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:[a.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"}),a.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"})]}),e]})};var le={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ne=l.createContext&&l.createContext(le),Ee=["attr","size","title"];function Le(e,r){if(e==null)return{};var o=Me(e,r),t,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],!(r.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function Me(e,r){if(e==null)return{};var o={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if(r.indexOf(t)>=0)continue;o[t]=e[t]}return o}function H(){return H=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},H.apply(this,arguments)}function ae(e,r){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),o.push.apply(o,t)}return o}function W(e){for(var r=1;r<arguments.length;r++){var o=arguments[r]!=null?arguments[r]:{};r%2?ae(Object(o),!0).forEach(function(t){Pe(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ae(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function Pe(e,r,o){return r=Oe(r),r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function Oe(e){var r=Te(e,"string");return typeof r=="symbol"?r:r+""}function Te(e,r){if(typeof e!="object"||!e)return e;var o=e[Symbol.toPrimitive];if(o!==void 0){var t=o.call(e,r);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function ce(e){return e&&e.map((r,o)=>l.createElement(r.tag,W({key:o},r.attr),ce(r.child)))}function Z(e){return r=>l.createElement(De,H({attr:W({},e.attr)},r),ce(e.child))}function De(e){var r=o=>{var{attr:t,size:n,title:i}=e,f=Le(e,Ee),u=n||o.size||"1em",g;return o.className&&(g=o.className),e.className&&(g=(g?g+" ":"")+e.className),l.createElement("svg",H({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},o.attr,t,f,{className:g,style:W(W({color:e.color||o.color},o.style),e.style),height:u,width:u,xmlns:"http://www.w3.org/2000/svg"}),i&&l.createElement("title",null,i),e.children)};return ne!==void 0?l.createElement(ne.Consumer,null,o=>r(o)):r(le)}function Be(e){return Z({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:[]}]})(e)}const Ie={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"},je={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full"},Ae={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"},se=l.forwardRef(({label:e,boxSize:r="md",shape:o="rounded",variant:t="success",onSelectionChange:n,disabled:i=!1,className:f="",id:u,value:g,icon:c,children:s,checked:h,...b},p)=>{const d=D=>{!i&&n&&n(D.target.checked),b.onChange&&b.onChange(D)},k="mr-2 border flex items-center justify-center transition-all",O=Ie[r],m=je[o],$=Ae[t]??"",E=t.startsWith("outline"),w=t.startsWith("soft"),T=`${k} ${O} ${m} ${$} ${h&&(E||w||t==="link")?"peer-checked:bg-current peer-checked:text-white":h?"peer-checked:bg-current":""}`,L={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 a.jsxs("label",{className:`flex items-center ${i?"opacity-50 cursor-not-allowed":"cursor-pointer"} me-4 ${f}`,children:[a.jsx("input",{type:"checkbox",className:"peer hidden",checked:h,onChange:d,disabled:i,id:u,value:g,ref:p,...b}),a.jsx("span",{className:T.trim(),children:(h||b.defaultChecked)&&(c??a.jsx(Be,{className:`${L[r]}`}))}),e||s?a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-300",children:e??s}):null]})});se.displayName="Checkbox";const ze=({label:e,header:r,items:o=[],onSelect:t,renderItem:n,position:i="right",className:f="",menuClassName:u="",width:g="w-48",closeOnSelect:c=!1,transition:s=!0,ariaLabel:h="Dropdown menu",forceCloseDropdown:b,...p})=>{const[d,k]=l.useState(!1),[O,m]=l.useState(!1),$=l.useRef(null),E=l.useRef(null),w=l.useMemo(()=>({left:"left-0",center:"left-1/2 transform -translate-x-1/2",right:"right-0"})[i],[i]),x=l.useCallback(()=>{const v=E.current,N=$.current;if(!v||!N)return;const{top:M,bottom:I}=v.getBoundingClientRect(),j=N.offsetHeight,A=window.innerHeight-I,K=M;m(A<j&&K>j)},[]),y=l.useCallback(v=>{var N,M;!((N=$.current)!=null&&N.contains(v.target))&&!((M=E.current)!=null&&M.contains(v.target))&&k(!1)},[]),T=l.useCallback(()=>k(v=>!v),[]),L=l.useCallback(()=>k(!1),[]);l.useEffect(()=>{if(d)return x(),window.addEventListener("resize",x),window.addEventListener("scroll",x,!0),()=>{window.removeEventListener("resize",x),window.removeEventListener("scroll",x,!0)}},[d,x]);const D=l.useRef(d);l.useEffect(()=>{D.current=d},[d]),l.useEffect(()=>{const v=N=>{var M;N.key==="Escape"&&D.current&&(k(!1),(M=E.current)==null||M.focus())};return document.addEventListener("keydown",v),()=>{document.removeEventListener("keydown",v)}},[]),l.useEffect(()=>(document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)),[y]);const B=l.useMemo(()=>["absolute z-50 bg-white rounded shadow-lg overflow-hidden w-auto",O?"bottom-full mb-2":"top-full mt-2",w,g,s&&"transition-all duration-200 ease-out",u].filter(Boolean).join(" "),[O,w,g,s,u]);return a.jsxs("div",{className:`relative inline-block ${f}`,...p,children:[a.jsx("button",{type:"button",ref:E,onClick:T,"aria-expanded":d,"aria-label":h,className:"focus:outline-none",children:e}),d&&a.jsxs("div",{ref:$,role:"menu",className:B,children:[r&&r,o.map((v,N)=>{const M=()=>{t&&t(v),c&&L()};return a.jsx("div",{children:n?n(v,M):a.jsx("div",{onClick:M,className:"px-4 py-2 text-sm text-gray-800 hover:bg-gray-100 cursor-pointer",role:"menuitem",children:v.label})},N)})]})]})},_e=({children:e,content:r,position:o="top",className:t="",tooltipClass:n="",tooltipStyle:i={}})=>{const f=l.useRef(null),u=l.useRef(null);l.useEffect(()=>{const c=f.current,s=u.current;if(!c||!s)return;const h=()=>{s.style.opacity="1",s.style.visibility="visible"},b=()=>{s.style.opacity="0",s.style.visibility="hidden"};return c.addEventListener("mouseenter",h),c.addEventListener("mouseleave",b),()=>{c.removeEventListener("mouseenter",h),c.removeEventListener("mouseleave",b)}},[]);const g=c=>{const s={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(c){case"top":return{...s,bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};case"bottom":return{...s,top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"left":return{...s,right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"right":return{...s,left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};default:return s}};return a.jsxs("div",{ref:f,className:`relative inline-block ${t}`,children:[e,a.jsx("div",{ref:u,role:"tooltip",className:n,style:{...g(o),...i},children:r})]})},Fe={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"},Ke={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"},He={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full p-2 w-8 h-8 justify-center"},We=({label:e,variant:r="primary",size:o="sm",shape:t="rounded",icon:n,dismissible:i,onDismiss:f,className:u="",...g})=>{const c=!e&&!!n,s=`inline-flex items-center font-medium ${Fe[r]||""} ${Ke[o]||""} ${He[t]||""} ${c?"justify-center p-2 w-8 h-8":""} `+u;return a.jsxs("span",{className:s.trim(),...g,children:[n&&a.jsx("span",{className:e?"mr-1":"",children:n}),e,i&&a.jsx("button",{type:"button",onClick:f,className:"ml-2 text-xs font-bold leading-none focus:outline-none",children:"×"})]})},Ye={rounded:"rounded-md",pill:"rounded-full",flat:"rounded-none"},Ze={xs:"px-2 py-1 text-xs",sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-5 py-3 text-base",xl:"px-6 py-4 text-lg"};function Ue({option:e,selected:r,disabled:o,variant:t,sizeClass:n,classNames:i,onSelect:f,renderOption:u,buttonRef:g}){const c=l.useCallback(()=>{o||f(e.value)},[o,f,e.value]),s=l.useCallback(h=>{(h.key==="Enter"||h.key===" ")&&!o&&(h.preventDefault(),f(e.value))},[o,f,e.value]);return a.jsx("button",{ref:g,type:"button",role:"radio","aria-checked":r,disabled:o,onClick:c,onKeyDown:s,className:`relative z-10 transition-colors duration-200 focus:outline-none w-full ${n}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-ux-kit",
3
- "version": "1.0.113",
3
+ "version": "1.0.114",
4
4
  "main": "lib/tailwind-ux-kit.es.js",
5
5
  "module": "lib/tailwind-ux-kit.umd.js",
6
6
  "types": "lib/tailwind-ux-kit.es.d.ts",