@fabio.caffarello/react-design-system 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -4
- package/dist/index.js +621 -431
- package/dist/ui/atoms/NavLink/NavLink.d.ts +5 -5
- package/dist/ui/atoms/NavLink/NavLink.stories.d.ts +1 -0
- package/dist/ui/atoms/SidebarItem/SidebarItem.d.ts +21 -0
- package/dist/ui/atoms/SidebarItem/SidebarItem.stories.d.ts +7 -0
- package/dist/ui/atoms/SidebarItem/SidebarItem.test.d.ts +1 -0
- package/dist/ui/atoms/index.d.ts +2 -0
- package/dist/ui/molecules/NavbarGroup/NavbarGroup.d.ts +23 -0
- package/dist/ui/molecules/NavbarGroup/NavbarGroup.stories.d.ts +8 -0
- package/dist/ui/molecules/NavbarGroup/NavbarGroup.test.d.ts +1 -0
- package/dist/ui/molecules/SidebarGroup/SidebarGroup.d.ts +20 -0
- package/dist/ui/molecules/SidebarHeader/SidebarHeader.d.ts +19 -0
- package/dist/ui/molecules/index.d.ts +6 -0
- package/dist/ui/organisms/Sidebar/Sidebar.d.ts +35 -0
- package/dist/ui/organisms/Sidebar/Sidebar.stories.d.ts +8 -0
- package/dist/ui/organisms/Sidebar/Sidebar.test.d.ts +1 -0
- package/dist/ui/organisms/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/ui/atoms/NavLink/NavLink.stories.tsx +12 -0
- package/src/ui/atoms/NavLink/NavLink.tsx +9 -5
- package/src/ui/atoms/SidebarItem/SidebarItem.stories.tsx +55 -0
- package/src/ui/atoms/SidebarItem/SidebarItem.test.tsx +25 -0
- package/src/ui/atoms/SidebarItem/SidebarItem.tsx +61 -0
- package/src/ui/atoms/index.ts +3 -0
- package/src/ui/molecules/EmptyState/EmptyState.tsx +2 -0
- package/src/ui/molecules/NavbarGroup/NavbarGroup.stories.tsx +62 -0
- package/src/ui/molecules/NavbarGroup/NavbarGroup.test.tsx +32 -0
- package/src/ui/molecules/NavbarGroup/NavbarGroup.tsx +71 -0
- package/src/ui/molecules/SidebarGroup/SidebarGroup.tsx +52 -0
- package/src/ui/molecules/SidebarHeader/SidebarHeader.tsx +80 -0
- package/src/ui/molecules/index.ts +9 -0
- package/src/ui/organisms/Sidebar/Sidebar.stories.tsx +117 -0
- package/src/ui/organisms/Sidebar/Sidebar.test.tsx +40 -0
- package/src/ui/organisms/Sidebar/Sidebar.tsx +83 -0
- package/src/ui/organisms/index.ts +3 -0
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),ue=require("react-dom");var L={exports:{}},T={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var J;function fe(){if(J)return T;J=1;var s=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(n,l,o){var i=null;if(o!==void 0&&(i=""+o),l.key!==void 0&&(i=""+l.key),"key"in l){o={};for(var c in l)c!=="key"&&(o[c]=l[c])}else o=l;return l=o.ref,{$$typeof:s,type:n,key:i,ref:l!==void 0?l:null,props:o}}return T.Fragment=t,T.jsx=a,T.jsxs=a,T}var S={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var H;function me(){return H||(H=1,process.env.NODE_ENV!=="production"&&(function(){function s(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===ie?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case f:return"Fragment";case p:return"Profiler";case E:return"StrictMode";case ae:return"Suspense";case ne:return"SuspenseList";case oe:return"Activity"}if(typeof r=="object")switch(typeof r.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),r.$$typeof){case k:return"Portal";case se:return r.displayName||"Context";case A:return(r._context.displayName||"Context")+".Consumer";case te:var u=r.render;return r=r.displayName,r||(r=u.displayName||u.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case le:return u=r.displayName||null,u!==null?u:s(r.type)||"Memo";case I:u=r._payload,r=r._init;try{return s(r(u))}catch{}}return null}function t(r){return""+r}function a(r){try{t(r);var u=!1}catch{u=!0}if(u){u=console;var h=u.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&r[Symbol.toStringTag]||r.constructor.name||"Object";return h.call(u,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",g),t(r)}}function n(r){if(r===f)return"<>";if(typeof r=="object"&&r!==null&&r.$$typeof===I)return"<...>";try{var u=s(r);return u?"<"+u+">":"<...>"}catch{return"<...>"}}function l(){var r=$.A;return r===null?null:r.getOwner()}function o(){return Error("react-stack-top-frame")}function i(r){if(W.call(r,"key")){var u=Object.getOwnPropertyDescriptor(r,"key").get;if(u&&u.isReactWarning)return!1}return r.key!==void 0}function c(r,u){function h(){P||(P=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",u))}h.isReactWarning=!0,Object.defineProperty(r,"key",{get:h,configurable:!0})}function d(){var r=s(this.type);return V[r]||(V[r]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),r=this.props.ref,r!==void 0?r:null}function b(r,u,h,g,O,Y){var v=h.ref;return r={$$typeof:N,type:r,key:u,props:h,_owner:g},(v!==void 0?v:null)!==null?Object.defineProperty(r,"ref",{enumerable:!1,get:d}):Object.defineProperty(r,"ref",{enumerable:!1,value:null}),r._store={},Object.defineProperty(r._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(r,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(r,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:O}),Object.defineProperty(r,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.freeze&&(Object.freeze(r.props),Object.freeze(r)),r}function j(r,u,h,g,O,Y){var v=u.children;if(v!==void 0)if(g)if(ce(v)){for(g=0;g<v.length;g++)m(v[g]);Object.freeze&&Object.freeze(v)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(v);if(W.call(u,"key")){v=s(r);var _=Object.keys(u).filter(function(de){return de!=="key"});g=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",U[v+g]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,g,v,C,v),q[v+g]=!0)}if(v=null,h!==void 0&&(a(h),v=""+h),i(d)&&(a(d.key),v=""+d.key),"key"in d){h={};for(var Y in d)Y!=="key"&&(h[Y]=d[Y])}else h=d;return v&&c(h,typeof e=="function"?e.displayName||e.name||"Unknown":e),p(e,v,h,l(),A,M)}function m(e){b(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===B&&(e._payload.status==="fulfilled"?b(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function b(e){return typeof e=="object"&&e!==null&&e.$$typeof===N}var j=w,N=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),Q=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),te=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),ae=Symbol.for("react.client.reference"),$=j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=Object.prototype.hasOwnProperty,ne=Array.isArray,I=console.createTask?console.createTask:function(){return null};j={react_stack_bottom_frame:function(e){return e()}};var F,W={},P=j.react_stack_bottom_frame.bind(j,o)(),V=I(n(o)),q={};T.Fragment=f,T.jsx=function(e,d,h){var g=1e4>$.recentlyCreatedOwnerStacks++;return y(e,d,h,!1,g?Error("react-stack-top-frame"):P,g?I(n(e)):V)},T.jsxs=function(e,d,h){var g=1e4>$.recentlyCreatedOwnerStacks++;return y(e,d,h,!0,g?Error("react-stack-top-frame"):P,g?I(n(e)):V)}})()),T}var G;function de(){return G||(G=1,process.env.NODE_ENV==="production"?O.exports=ie():O.exports=ce()),O.exports}var r=de();function ue({variant:t="info",className:s,...a}){const n=[s||""];switch(t){case"warning":{n.push("bg-yellow-100 text-yellow-800 border-yellow-500");break}case"error":{n.push("bg-red-100 text-red-800 border-red-500");break}default:case"info":{n.push("bg-blue-100 text-blue-800 border-blue-500");break}}return r.jsx("div",{role:"alert",className:`border px-4 py-2 rounded-lg ${n.join(" ")}`,...a})}function L({variant:t,bold:s,italic:a,className:n,as:l,color:o,...i}){const c=[n];let u;if(l)u=l;else switch(t){case"heading":u="h2";break;case"list":u="li";break;case"paragraph":default:u="p";break}return s&&c.push("font-bold"),a&&c.push("italic"),o&&c.push(`text-${o}`),r.jsx(u,{className:c.join(" "),...i})}function X({className:t,...s}){const a=[t,"px-large","border","border-1","border-grey-light","rounded","lh-form-element","h-form-element","text-base"];return r.jsx("input",{className:a.join(" "),...s})}function _({className:t,variant:s="regular",...a}){const n=[t,"rounded","h-form-element","lh-form-element","px-large","text-base"];switch(s){case"error":n.push("bg-red-light","text-red-dark","font-bold");break;case"secondary":n.push("bg-transparent","text-grey-minor","px-0");break;case"regular":default:n.push("bg-blue-light","text-blue-dark","font-bold");break}return r.jsx("button",{className:n.join(" "),...a})}function H({className:t,...s}){const a=[t,"p-large","bg-bg","rounded","shadow-card"];return r.jsx("div",{className:a.join(" "),...s})}function fe({variant:t="neutral",className:s="",children:a,...n}){const l=["inline-flex","items-center","px-2","py-1","rounded","text-xs","font-medium","border"],o={success:"bg-green-100 text-green-800 border-green-500",warning:"bg-yellow-100 text-yellow-800 border-yellow-500",error:"bg-red-100 text-red-800 border-red-500",info:"bg-blue-100 text-blue-800 border-blue-500",neutral:"bg-gray-100 text-gray-800 border-gray-500"},i=[...l,o[t],s].filter(Boolean).join(" ");return r.jsx("span",{role:"status","aria-label":typeof a=="string"?a:void 0,className:i,...n,children:a})}function me({options:t,placeholder:s,error:a=!1,className:n="",...l}){const o=["block","w-full","rounded","h-form-element","px-large","border","text-base","focus:outline-none","focus:ring-2","focus:ring-offset-2"],i=a?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-indigo-500",c=[...o,i,n].filter(Boolean).join(" ");return r.jsxs("select",{className:c,"aria-invalid":a,"aria-describedby":a?`${l.id}-error`:void 0,...l,children:[s&&r.jsx("option",{value:"",disabled:!0,children:s}),t.map(u=>r.jsx("option",{value:u.value,disabled:u.disabled,children:u.label},u.value))]})}function be({error:t=!1,resize:s="vertical",className:a="",...n}){const l=["block","w-full","rounded","px-large","py-medium","border","text-base","focus:outline-none","focus:ring-2","focus:ring-offset-2"],o={none:"resize-none",both:"resize",horizontal:"resize-x",vertical:"resize-y"},i=t?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-indigo-500",c=[...l,o[s],i,a].filter(Boolean).join(" ");return r.jsx("textarea",{className:c,"aria-invalid":t,"aria-describedby":t&&n.id?`${n.id}-error`:void 0,...n})}function xe({variant:t="default",className:s="",children:a,...n}){const l=["block","text-sm","font-medium","text-gray-700"],o={default:"",required:"after:content-['*'] after:ml-0.5 after:text-red-500",optional:"after:content-['(optional)'] after:ml-1 after:text-gray-400 after:font-normal"},i=[...l,o[t],s].filter(Boolean).join(" ");return r.jsx("label",{className:i,...n,children:a})}function pe({message:t,id:s,className:a="",...n}){const o=[...["mt-1","text-sm","text-red-600","flex","items-center","gap-1"],a].filter(Boolean).join(" ");return r.jsxs("div",{role:"alert",id:s,className:o,"aria-live":"polite",...n,children:[r.jsx("svg",{className:"h-4 w-4 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),r.jsx("span",{children:t})]})}function Z({variant:t="default",className:s="",children:a,...n}){const l=["inline-flex","items-center","px-1","pt-1","border-b-2","text-sm","font-medium","transition-colors"],o={default:"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700",active:"border-indigo-500 text-gray-900",disabled:"border-transparent text-gray-300 cursor-not-allowed pointer-events-none"},i=[...l,o[t],s].filter(Boolean).join(" ");return t==="disabled"?r.jsx("span",{className:i,"aria-disabled":"true",children:a}):r.jsx("a",{className:i,...n,children:a})}function he({content:t,children:s,position:a="top",delay:n=200,className:l="",...o}){const[i,c]=w.useState(!1),[u,p]=w.useState(null),y=()=>{const N=setTimeout(()=>{c(!0)},n);p(N)},m=()=>{u&&(clearTimeout(u),p(null)),c(!1)},b={top:"bottom-full left-1/2 transform -translate-x-1/2 mb-2",bottom:"top-full left-1/2 transform -translate-x-1/2 mt-2",left:"right-full top-1/2 transform -translate-y-1/2 mr-2",right:"left-full top-1/2 transform -translate-y-1/2 ml-2"},j={top:"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900",bottom:"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900",left:"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900",right:"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900"};return r.jsxs("div",{className:`relative inline-block ${l}`,onMouseEnter:y,onMouseLeave:m,...o,children:[s,i&&r.jsxs("div",{className:`absolute z-50 px-2 py-1 text-xs text-white bg-gray-900 rounded shadow-lg whitespace-nowrap ${b[a]}`,role:"tooltip",children:[t,r.jsx("div",{className:`absolute w-0 h-0 border-4 border-transparent ${j[a]}`})]})]})}function ge({variant:t="text",width:s,height:a,lines:n=1,className:l="",...o}){const i=["animate-pulse","bg-gray-200","rounded"],c={text:"h-4",card:"h-32",list:"h-12",circle:"rounded-full"},u=[...i,c[t],l].filter(Boolean).join(" "),p={};return s&&(p.width=s),a&&(p.height=a),t==="text"&&n>1?r.jsx("div",{className:"space-y-2",...o,children:Array.from({length:n}).map((y,m)=>r.jsx("div",{className:u,style:m===n-1?{width:"75%"}:p},m))}):r.jsx("div",{className:u,style:p,...o})}function z({label:t,...s}){return s.id||console.error("InputWithLabel component requires an id prop"),r.jsxs("div",{className:"mb-medium grid gap-small",children:[r.jsx(L,{as:"label",htmlFor:s.id,className:"cursor-pointer",children:t}),r.jsx(X,{...s})]})}function ve({variant:t="default",padding:s="medium",className:a="",children:n,...l}){const o=["bg-white","rounded-lg","border","border-gray-200","shadow-sm"],i={default:"",hover:"hover:shadow-md transition-shadow cursor-pointer",selected:"border-indigo-500 shadow-md"},c={none:"",small:"p-2",medium:"p-4",large:"p-6"},u=[...o,i[t],c[s],a].filter(Boolean).join(" ");return r.jsx("div",{className:u,...l,children:n})}function ye({children:t,onSubmit:s,loading:a=!1,error:n=null,success:l=null,className:o="",...i}){const u=[...["space-y-4"],o].filter(Boolean).join(" "),p=y=>{y.preventDefault(),s&&!a&&s(y)};return r.jsxs("form",{className:u,onSubmit:p,noValidate:!0,...i,children:[t,n&&r.jsx("div",{role:"alert",className:"p-3 text-sm text-red-800 bg-red-50 border border-red-200 rounded",children:n}),l&&r.jsx("div",{role:"alert",className:"p-3 text-sm text-green-800 bg-green-50 border border-green-200 rounded",children:l})]})}function je({items:t,separator:s="/",className:a="",...n}){const o=[...["flex","items-center","space-x-2","text-sm"],a].filter(Boolean).join(" ");return r.jsx("nav",{"aria-label":"Breadcrumb",className:o,...n,children:r.jsx("ol",{className:"flex items-center space-x-2",children:t.map((i,c)=>{const u=c===t.length-1;return r.jsxs("li",{className:"flex items-center",children:[c>0&&r.jsx("span",{className:"mx-2 text-gray-400","aria-hidden":"true",children:s}),u?r.jsx("span",{className:"text-gray-900 font-medium","aria-current":"page",children:i.label}):i.href?r.jsx(Z,{href:i.href,variant:"default",children:i.label}):r.jsx("span",{className:"text-gray-500",children:i.label})]},c)})})})}function Ne({currentPage:t,totalPages:s,onPageChange:a,totalItems:n,itemsPerPage:l,showPageInfo:o=!0,className:i="",...c}){const u=()=>{t>1&&a(t-1)},p=()=>{t<s&&a(t+1)},y=f=>{f>=1&&f<=s&&f!==t&&a(f)},m=()=>{const f=[];if(s<=5)for(let x=1;x<=s;x++)f.push(x);else if(t<=3){for(let x=1;x<=4;x++)f.push(x);f.push("ellipsis"),f.push(s)}else if(t>=s-2){f.push(1),f.push("ellipsis");for(let x=s-3;x<=s;x++)f.push(x)}else{f.push(1),f.push("ellipsis");for(let x=t-1;x<=t+1;x++)f.push(x);f.push("ellipsis"),f.push(s)}return f},b=n&&l?(t-1)*l+1:void 0,j=n&&l?Math.min(t*l,n):void 0,k=[...["flex","items-center","justify-between","px-4","py-3"],i].filter(Boolean).join(" ");return r.jsxs("nav",{className:k,"aria-label":"Pagination",...c,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(_,{variant:"secondary",onClick:u,disabled:t===1,className:"px-3 py-1 text-sm",children:"Previous"}),r.jsx("div",{className:"flex items-center gap-1",children:m().map((f,E)=>{if(f==="ellipsis")return r.jsx("span",{className:"px-2 text-gray-500",children:"..."},`ellipsis-${E}`);const x=f,S=x===t;return r.jsx("button",{onClick:()=>y(x),className:`px-3 py-1 text-sm rounded ${S?"bg-indigo-600 text-white":"text-gray-700 hover:bg-gray-100"}`,"aria-current":S?"page":void 0,"aria-label":`Go to page ${x}`,children:x},x)})}),r.jsx(_,{variant:"secondary",onClick:p,disabled:t===s,className:"px-3 py-1 text-sm",children:"Next"})]}),o&&n&&l&&r.jsxs("div",{className:"text-sm text-gray-700",children:["Showing ",b," to ",j," of ",n," results"]})]})}function we({title:t,message:s,actionLabel:a,onAction:n,illustration:l,variant:o="default",className:i="",...c}){const p=[...["flex","flex-col","items-center","justify-center","text-center","py-12","px-4"],i].filter(Boolean).join(" "),y=o==="withAction"||a&&n,m=o==="withIllustration"||l;return r.jsxs("div",{className:p,...c,children:[m&&l&&r.jsx("div",{className:"mb-4",children:l}),r.jsx(L,{as:"h3",className:"text-lg font-semibold text-gray-900 mb-2",children:t}),r.jsx(L,{as:"p",className:"text-sm text-gray-500 mb-6 max-w-sm",children:s}),y&&a&&n&&r.jsx(_,{variant:"regular",onClick:n,children:a})]})}function ke({trigger:t,items:s,align:a="right",variant:n="default",className:l="",...o}){const[i,c]=w.useState(!1),u=w.useRef(null);w.useEffect(()=>{const m=b=>{u.current&&!u.current.contains(b.target)&&c(!1)};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[i]);const p=m=>{m.disabled||(m.onClick(),c(!1))},y=a==="right"?"right-0":"left-0";return r.jsxs("div",{className:`relative inline-block ${l}`,ref:u,...o,children:[r.jsx("div",{onClick:()=>c(!i),children:t}),i&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>c(!1)}),r.jsx("div",{className:`absolute z-20 mt-2 w-48 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 ${y}`,role:"menu","aria-orientation":"vertical",children:r.jsx("div",{className:"py-1",role:"none",children:s.map((m,b)=>{const j=["block","px-4","py-2","text-sm","w-full","text-left",m.disabled?"text-gray-400 cursor-not-allowed":m.variant==="danger"?"text-red-700 hover:bg-red-50":"text-gray-700 hover:bg-gray-100"].filter(Boolean).join(" ");return r.jsx("button",{type:"button",className:j,onClick:()=>p(m),disabled:m.disabled,role:"menuitem",children:m.label},b)})})})]})]})}function Ee({onForgotPasswordClick:t,className:s,...a}){return r.jsx(H,{className:s,children:r.jsxs("form",{...a,onSubmit:n=>{n.preventDefault(),a.onSubmit&&a.onSubmit(n)},children:[r.jsx(z,{id:"login-email",label:"Your email",placeholder:"myname@email.com"}),r.jsx(z,{id:"login-password",label:"Your password",placeholder:"••••••••",type:"password"}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx(_,{variant:"secondary",type:"button",onClick:t,children:"Forgot password?"}),r.jsx(_,{variant:"regular",type:"submit",children:"Sign in"})]})]})})}function Ce({isOpen:t,onClose:s,title:a,children:n,variant:l="default",showCloseButton:o=!0,footer:i,className:c="",...u}){const p=w.useRef(null),y=w.useRef(null);if(w.useEffect(()=>{if(!t)return;y.current=document.activeElement;const f=setTimeout(()=>{p.current?.focus()},0),E=x=>{x.key==="Escape"&&s()};return document.addEventListener("keydown",E),()=>{clearTimeout(f),document.removeEventListener("keydown",E),y.current?.focus()}},[t,s]),w.useEffect(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),!t)return null;const m=["fixed","inset-0","z-50","overflow-y-auto"],b=["fixed","inset-0","bg-black","bg-opacity-50","transition-opacity"],N=["relative","bg-white","rounded-lg","shadow-xl","my-8","mx-auto",{default:"max-w-md",large:"max-w-2xl",fullscreen:"max-w-full h-full"}[l],"p-6",c].filter(Boolean).join(" "),k=r.jsxs("div",{className:m.join(" "),role:"dialog","aria-modal":"true","aria-labelledby":a?"modal-title":void 0,onClick:f=>{f.target===f.currentTarget&&s()},children:[r.jsx("div",{className:b.join(" "),"aria-hidden":"true"}),r.jsx("div",{className:"flex min-h-full items-center justify-center p-4",children:r.jsxs("div",{ref:p,tabIndex:-1,className:N,onClick:f=>f.stopPropagation(),...u,children:[a&&r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsx("h2",{id:"modal-title",className:"text-xl font-semibold text-gray-900",children:a}),o&&r.jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-500 focus:outline-none","aria-label":"Close modal",children:r.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),!a&&o&&r.jsx("div",{className:"flex justify-end mb-4",children:r.jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-500 focus:outline-none","aria-label":"Close modal",children:r.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})}),r.jsx("div",{className:"mb-4",children:n}),i&&r.jsx("div",{className:"flex justify-end gap-2 mt-4",children:i})]})})]});return typeof window<"u"?oe.createPortal(k,document.body):k}function _e({columns:t,data:s,loading:a=!1,onSort:n,sortColumn:l,sortDirection:o,emptyMessage:i="No data available",className:c="",...u}){const p=b=>{if(!n||!t.find(N=>N.key===b)?.sortable)return;n(b,l===b&&o==="asc"?"desc":"asc")},m=[...["min-w-full","divide-y","divide-gray-200"],c].filter(Boolean).join(" ");return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:m,...u,children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsx("tr",{children:t.map(b=>r.jsx("th",{scope:"col",className:`px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider ${b.sortable&&n?"cursor-pointer hover:bg-gray-100 select-none":""}`,onClick:()=>b.sortable&&p(b.key),children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:b.label}),b.sortable&&l===b.key&&r.jsx("span",{className:"text-gray-400",children:o==="asc"?"↑":"↓"})]})},b.key))})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:a?r.jsx("tr",{children:r.jsx("td",{colSpan:t.length,className:"px-6 py-4 text-center text-gray-500",children:"Loading..."})}):s.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:t.length,className:"px-6 py-4 text-center text-gray-500",children:i})}):s.map((b,j)=>r.jsx("tr",{className:"hover:bg-gray-50",children:t.map(N=>{const k=b[N.key];return r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:N.render?N.render(k,b):k},N.key)})},j))})]})})}exports.Badge=fe;exports.BoxWrapper=H;exports.Breadcrumb=je;exports.Button=_;exports.Card=ve;exports.Dropdown=ke;exports.EmptyState=we;exports.ErrorMessage=pe;exports.Form=ye;exports.Info=ue;exports.Input=X;exports.InputWithLabel=z;exports.Label=xe;exports.LoginBox=Ee;exports.Modal=Ce;exports.NavLink=Z;exports.Pagination=Ne;exports.Select=me;exports.Skeleton=ge;exports.Table=_e;exports.Text=L;exports.Textarea=be;exports.Tooltip=he;
|
|
22
|
+
<%s key={someKey} {...props} />`,g,v,_,v),U[v+g]=!0)}if(v=null,h!==void 0&&(a(h),v=""+h),i(u)&&(a(u.key),v=""+u.key),"key"in u){h={};for(var z in u)z!=="key"&&(h[z]=u[z])}else h=u;return v&&c(h,typeof r=="function"?r.displayName||r.name||"Unknown":r),b(r,v,h,l(),O,Y)}function m(r){x(r)?r._store&&(r._store.validated=1):typeof r=="object"&&r!==null&&r.$$typeof===I&&(r._payload.status==="fulfilled"?x(r._payload.value)&&r._payload.value._store&&(r._payload.value._store.validated=1):r._store&&(r._store.validated=1))}function x(r){return typeof r=="object"&&r!==null&&r.$$typeof===N}var y=w,N=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),se=Symbol.for("react.context"),te=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),le=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),ie=Symbol.for("react.client.reference"),$=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,ce=Array.isArray,M=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(r){return r()}};var P,V={},q=y.react_stack_bottom_frame.bind(y,o)(),G=M(n(o)),U={};S.Fragment=f,S.jsx=function(r,u,h){var g=1e4>$.recentlyCreatedOwnerStacks++;return j(r,u,h,!1,g?Error("react-stack-top-frame"):q,g?M(n(r)):G)},S.jsxs=function(r,u,h){var g=1e4>$.recentlyCreatedOwnerStacks++;return j(r,u,h,!0,g?Error("react-stack-top-frame"):q,g?M(n(r)):G)}})()),S}var X;function xe(){return X||(X=1,process.env.NODE_ENV==="production"?L.exports=fe():L.exports=me()),L.exports}var e=xe();function be({variant:s="info",className:t,...a}){const n=[t||""];switch(s){case"warning":{n.push("bg-yellow-100 text-yellow-800 border-yellow-500");break}case"error":{n.push("bg-red-100 text-red-800 border-red-500");break}default:case"info":{n.push("bg-blue-100 text-blue-800 border-blue-500");break}}return e.jsx("div",{role:"alert",className:`border px-4 py-2 rounded-lg ${n.join(" ")}`,...a})}function R({variant:s,bold:t,italic:a,className:n,as:l,color:o,...i}){const c=[n];let d;if(l)d=l;else switch(s){case"heading":d="h2";break;case"list":d="li";break;case"paragraph":default:d="p";break}return t&&c.push("font-bold"),a&&c.push("italic"),o&&c.push(`text-${o}`),e.jsx(d,{className:c.join(" "),...i})}function Z({className:s,...t}){const a=[s,"px-large","border","border-1","border-grey-light","rounded","lh-form-element","h-form-element","text-base"];return e.jsx("input",{className:a.join(" "),...t})}function C({className:s,variant:t="regular",...a}){const n=[s,"rounded","h-form-element","lh-form-element","px-large","text-base"];switch(t){case"error":n.push("bg-red-light","text-red-dark","font-bold");break;case"secondary":n.push("bg-transparent","text-grey-minor","px-0");break;case"regular":default:n.push("bg-blue-light","text-blue-dark","font-bold");break}return e.jsx("button",{className:n.join(" "),...a})}function Q({className:s,...t}){const a=[s,"p-large","bg-bg","rounded","shadow-card"];return e.jsx("div",{className:a.join(" "),...t})}function pe({variant:s="neutral",className:t="",children:a,...n}){const l=["inline-flex","items-center","px-2","py-1","rounded","text-xs","font-medium","border"],o={success:"bg-green-100 text-green-800 border-green-500",warning:"bg-yellow-100 text-yellow-800 border-yellow-500",error:"bg-red-100 text-red-800 border-red-500",info:"bg-blue-100 text-blue-800 border-blue-500",neutral:"bg-gray-100 text-gray-800 border-gray-500"},i=[...l,o[s],t].filter(Boolean).join(" ");return e.jsx("span",{role:"status","aria-label":typeof a=="string"?a:void 0,className:i,...n,children:a})}function he({options:s,placeholder:t,error:a=!1,className:n="",...l}){const o=["block","w-full","rounded","h-form-element","px-large","border","text-base","focus:outline-none","focus:ring-2","focus:ring-offset-2"],i=a?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-indigo-500",c=[...o,i,n].filter(Boolean).join(" ");return e.jsxs("select",{className:c,"aria-invalid":a,"aria-describedby":a?`${l.id}-error`:void 0,...l,children:[t&&e.jsx("option",{value:"",disabled:!0,children:t}),s.map(d=>e.jsx("option",{value:d.value,disabled:d.disabled,children:d.label},d.value))]})}function ge({error:s=!1,resize:t="vertical",className:a="",...n}){const l=["block","w-full","rounded","px-large","py-medium","border","text-base","focus:outline-none","focus:ring-2","focus:ring-offset-2"],o={none:"resize-none",both:"resize",horizontal:"resize-x",vertical:"resize-y"},i=s?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-indigo-500",c=[...l,o[t],i,a].filter(Boolean).join(" ");return e.jsx("textarea",{className:c,"aria-invalid":s,"aria-describedby":s&&n.id?`${n.id}-error`:void 0,...n})}function ve({variant:s="default",className:t="",children:a,...n}){const l=["block","text-sm","font-medium","text-gray-700"],o={default:"",required:"after:content-['*'] after:ml-0.5 after:text-red-500",optional:"after:content-['(optional)'] after:ml-1 after:text-gray-400 after:font-normal"},i=[...l,o[s],t].filter(Boolean).join(" ");return e.jsx("label",{className:i,...n,children:a})}function je({message:s,id:t,className:a="",...n}){const o=[...["mt-1","text-sm","text-red-600","flex","items-center","gap-1"],a].filter(Boolean).join(" ");return e.jsxs("div",{role:"alert",id:t,className:o,"aria-live":"polite",...n,children:[e.jsx("svg",{className:"h-4 w-4 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),e.jsx("span",{children:s})]})}function K({variant:s="default",icon:t,className:a="",children:n,...l}){const o=["inline-flex","items-center","px-1","pt-1","border-b-2","text-sm","font-medium","transition-colors"],i={default:"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700",active:"border-indigo-500 text-gray-900",disabled:"border-transparent text-gray-300 cursor-not-allowed pointer-events-none"},c=[...o,i[s],a].filter(Boolean).join(" ");return s==="disabled"?e.jsxs("span",{className:c,"aria-disabled":"true",children:[t&&e.jsx("span",{className:"flex-shrink-0",children:t}),n]}):e.jsxs("a",{className:c,...l,children:[t&&e.jsx("span",{className:"flex-shrink-0",children:t}),n]})}function ye({content:s,children:t,position:a="top",delay:n=200,className:l="",...o}){const[i,c]=w.useState(!1),[d,b]=w.useState(null),j=()=>{const N=setTimeout(()=>{c(!0)},n);b(N)},m=()=>{d&&(clearTimeout(d),b(null)),c(!1)},x={top:"bottom-full left-1/2 transform -translate-x-1/2 mb-2",bottom:"top-full left-1/2 transform -translate-x-1/2 mt-2",left:"right-full top-1/2 transform -translate-y-1/2 mr-2",right:"left-full top-1/2 transform -translate-y-1/2 ml-2"},y={top:"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900",bottom:"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900",left:"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900",right:"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900"};return e.jsxs("div",{className:`relative inline-block ${l}`,onMouseEnter:j,onMouseLeave:m,...o,children:[t,i&&e.jsxs("div",{className:`absolute z-50 px-2 py-1 text-xs text-white bg-gray-900 rounded shadow-lg whitespace-nowrap ${x[a]}`,role:"tooltip",children:[s,e.jsx("div",{className:`absolute w-0 h-0 border-4 border-transparent ${y[a]}`})]})]})}function Ne({variant:s="text",width:t,height:a,lines:n=1,className:l="",...o}){const i=["animate-pulse","bg-gray-200","rounded"],c={text:"h-4",card:"h-32",list:"h-12",circle:"rounded-full"},d=[...i,c[s],l].filter(Boolean).join(" "),b={};return t&&(b.width=t),a&&(b.height=a),s==="text"&&n>1?e.jsx("div",{className:"space-y-2",...o,children:Array.from({length:n}).map((j,m)=>e.jsx("div",{className:d,style:m===n-1?{width:"75%"}:b},m))}):e.jsx("div",{className:d,style:b,...o})}function ee({href:s,isActive:t=!1,icon:a,children:n,className:l="",...o}){const i=["flex","items-center","px-4","py-2","text-sm","font-medium","rounded-md","transition-colors","hover:bg-gray-100"],c=t?"bg-indigo-50 text-indigo-700 border-r-2 border-indigo-600":"text-gray-700 hover:text-gray-900",d=[...i,c,l].filter(Boolean).join(" ");return e.jsxs("a",{href:s,className:d,...o,children:[a&&e.jsx("span",{className:"mr-3 flex-shrink-0",children:a}),e.jsx("span",{children:n})]})}function D({label:s,...t}){return t.id||console.error("InputWithLabel component requires an id prop"),e.jsxs("div",{className:"mb-medium grid gap-small",children:[e.jsx(R,{as:"label",htmlFor:t.id,className:"cursor-pointer",children:s}),e.jsx(Z,{...t})]})}function we({variant:s="default",padding:t="medium",className:a="",children:n,...l}){const o=["bg-white","rounded-lg","border","border-gray-200","shadow-sm"],i={default:"",hover:"hover:shadow-md transition-shadow cursor-pointer",selected:"border-indigo-500 shadow-md"},c={none:"",small:"p-2",medium:"p-4",large:"p-6"},d=[...o,i[s],c[t],a].filter(Boolean).join(" ");return e.jsx("div",{className:d,...l,children:n})}function ke({children:s,onSubmit:t,loading:a=!1,error:n=null,success:l=null,className:o="",...i}){const d=[...["space-y-4"],o].filter(Boolean).join(" "),b=j=>{j.preventDefault(),t&&!a&&t(j)};return e.jsxs("form",{className:d,onSubmit:b,noValidate:!0,...i,children:[s,n&&e.jsx("div",{role:"alert",className:"p-3 text-sm text-red-800 bg-red-50 border border-red-200 rounded",children:n}),l&&e.jsx("div",{role:"alert",className:"p-3 text-sm text-green-800 bg-green-50 border border-green-200 rounded",children:l})]})}function Ee({items:s,separator:t="/",className:a="",...n}){const o=[...["flex","items-center","space-x-2","text-sm"],a].filter(Boolean).join(" ");return e.jsx("nav",{"aria-label":"Breadcrumb",className:o,...n,children:e.jsx("ol",{className:"flex items-center space-x-2",children:s.map((i,c)=>{const d=c===s.length-1;return e.jsxs("li",{className:"flex items-center",children:[c>0&&e.jsx("span",{className:"mx-2 text-gray-400","aria-hidden":"true",children:t}),d?e.jsx("span",{className:"text-gray-900 font-medium","aria-current":"page",children:i.label}):i.href?e.jsx(K,{href:i.href,variant:"default",children:i.label}):e.jsx("span",{className:"text-gray-500",children:i.label})]},c)})})})}function Ce({currentPage:s,totalPages:t,onPageChange:a,totalItems:n,itemsPerPage:l,showPageInfo:o=!0,className:i="",...c}){const d=()=>{s>1&&a(s-1)},b=()=>{s<t&&a(s+1)},j=f=>{f>=1&&f<=t&&f!==s&&a(f)},m=()=>{const f=[];if(t<=5)for(let p=1;p<=t;p++)f.push(p);else if(s<=3){for(let p=1;p<=4;p++)f.push(p);f.push("ellipsis"),f.push(t)}else if(s>=t-2){f.push(1),f.push("ellipsis");for(let p=t-3;p<=t;p++)f.push(p)}else{f.push(1),f.push("ellipsis");for(let p=s-1;p<=s+1;p++)f.push(p);f.push("ellipsis"),f.push(t)}return f},x=n&&l?(s-1)*l+1:void 0,y=n&&l?Math.min(s*l,n):void 0,k=[...["flex","items-center","justify-between","px-4","py-3"],i].filter(Boolean).join(" ");return e.jsxs("nav",{className:k,"aria-label":"Pagination",...c,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"secondary",onClick:d,disabled:s===1,className:"px-3 py-1 text-sm",children:"Previous"}),e.jsx("div",{className:"flex items-center gap-1",children:m().map((f,E)=>{if(f==="ellipsis")return e.jsx("span",{className:"px-2 text-gray-500",children:"..."},`ellipsis-${E}`);const p=f,A=p===s;return e.jsx("button",{onClick:()=>j(p),className:`px-3 py-1 text-sm rounded ${A?"bg-indigo-600 text-white":"text-gray-700 hover:bg-gray-100"}`,"aria-current":A?"page":void 0,"aria-label":`Go to page ${p}`,children:p},p)})}),e.jsx(C,{variant:"secondary",onClick:b,disabled:s===t,className:"px-3 py-1 text-sm",children:"Next"})]}),o&&n&&l&&e.jsxs("div",{className:"text-sm text-gray-700",children:["Showing ",x," to ",y," of ",n," results"]})]})}function _e({title:s,message:t,actionLabel:a,onAction:n,illustration:l,variant:o="default",className:i="",...c}){const b=[...["flex","flex-col","items-center","justify-center","text-center","py-12","px-4"],i].filter(Boolean).join(" "),j=o==="withAction"||a&&n,m=o==="withIllustration"||l;return e.jsxs("div",{className:b,...c,children:[m&&l&&e.jsx("div",{className:"mb-4",children:l}),e.jsx(R,{as:"h3",className:"text-lg font-semibold text-gray-900 mb-2",children:s}),e.jsx(R,{as:"p",className:"text-sm text-gray-500 mb-6 max-w-sm",children:t}),j&&a&&n&&e.jsx(C,{variant:"regular",onClick:n,children:a})]})}function Re({trigger:s,items:t,align:a="right",variant:n="default",className:l="",...o}){const[i,c]=w.useState(!1),d=w.useRef(null);w.useEffect(()=>{const m=x=>{d.current&&!d.current.contains(x.target)&&c(!1)};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[i]);const b=m=>{m.disabled||(m.onClick(),c(!1))},j=a==="right"?"right-0":"left-0";return e.jsxs("div",{className:`relative inline-block ${l}`,ref:d,...o,children:[e.jsx("div",{onClick:()=>c(!i),children:s}),i&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>c(!1)}),e.jsx("div",{className:`absolute z-20 mt-2 w-48 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 ${j}`,role:"menu","aria-orientation":"vertical",children:e.jsx("div",{className:"py-1",role:"none",children:t.map((m,x)=>{const y=["block","px-4","py-2","text-sm","w-full","text-left",m.disabled?"text-gray-400 cursor-not-allowed":m.variant==="danger"?"text-red-700 hover:bg-red-50":"text-gray-700 hover:bg-gray-100"].filter(Boolean).join(" ");return e.jsx("button",{type:"button",className:y,onClick:()=>b(m),disabled:m.disabled,role:"menuitem",children:m.label},x)})})})]})]})}function re({title:s,children:t,className:a="",...n}){const o=[...["space-y-1"],a].filter(Boolean).join(" ");return e.jsxs("div",{className:o,...n,children:[s&&e.jsx(R,{as:"h3",className:"px-4 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:s}),e.jsx("div",{className:"space-y-1",children:t})]})}function F({title:s,onClose:t,showCloseButton:a=!1,children:n,className:l="",...o}){const c=[...["flex","items-center","justify-between","px-4","py-4","border-b","border-gray-200"],l].filter(Boolean).join(" ");return e.jsxs("div",{className:c,...o,children:[e.jsx(R,{as:"h2",className:"text-lg font-semibold text-gray-900",children:s}),e.jsxs("div",{className:"flex items-center space-x-2",children:[n,a&&t&&e.jsx(C,{variant:"secondary",onClick:t,className:"p-1","aria-label":"Close sidebar",children:e.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]})}function Te({label:s,isActive:t=!1,icon:a,onClick:n,className:l="",children:o,...i}){const c=["inline-flex","items-center","px-3","py-2","text-sm","font-medium","rounded-md","transition-colors"],d=t?"bg-indigo-100 text-indigo-700 border-b-2 border-indigo-600":"text-gray-600 hover:bg-gray-100 hover:text-gray-900",b=[...c,d,l].filter(Boolean).join(" ");return e.jsxs("button",{type:"button",className:b,onClick:n,"aria-expanded":t,"aria-haspopup":"true",...i,children:[a&&e.jsx("span",{className:"mr-2",children:a}),e.jsx("span",{children:s}),o]})}function Se({onForgotPasswordClick:s,className:t,...a}){return e.jsx(Q,{className:t,children:e.jsxs("form",{...a,onSubmit:n=>{n.preventDefault(),a.onSubmit&&a.onSubmit(n)},children:[e.jsx(D,{id:"login-email",label:"Your email",placeholder:"myname@email.com"}),e.jsx(D,{id:"login-password",label:"Your password",placeholder:"••••••••",type:"password"}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx(C,{variant:"secondary",type:"button",onClick:s,children:"Forgot password?"}),e.jsx(C,{variant:"regular",type:"submit",children:"Sign in"})]})]})})}function Ae({isOpen:s,onClose:t,title:a,children:n,variant:l="default",showCloseButton:o=!0,footer:i,className:c="",...d}){const b=w.useRef(null),j=w.useRef(null);if(w.useEffect(()=>{if(!s)return;j.current=document.activeElement;const f=setTimeout(()=>{b.current?.focus()},0),E=p=>{p.key==="Escape"&&t()};return document.addEventListener("keydown",E),()=>{clearTimeout(f),document.removeEventListener("keydown",E),j.current?.focus()}},[s,t]),w.useEffect(()=>(s?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[s]),!s)return null;const m=["fixed","inset-0","z-50","overflow-y-auto"],x=["fixed","inset-0","bg-black","bg-opacity-50","transition-opacity"],N=["relative","bg-white","rounded-lg","shadow-xl","my-8","mx-auto",{default:"max-w-md",large:"max-w-2xl",fullscreen:"max-w-full h-full"}[l],"p-6",c].filter(Boolean).join(" "),k=e.jsxs("div",{className:m.join(" "),role:"dialog","aria-modal":"true","aria-labelledby":a?"modal-title":void 0,onClick:f=>{f.target===f.currentTarget&&t()},children:[e.jsx("div",{className:x.join(" "),"aria-hidden":"true"}),e.jsx("div",{className:"flex min-h-full items-center justify-center p-4",children:e.jsxs("div",{ref:b,tabIndex:-1,className:N,onClick:f=>f.stopPropagation(),...d,children:[a&&e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h2",{id:"modal-title",className:"text-xl font-semibold text-gray-900",children:a}),o&&e.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-500 focus:outline-none","aria-label":"Close modal",children:e.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),!a&&o&&e.jsx("div",{className:"flex justify-end mb-4",children:e.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-500 focus:outline-none","aria-label":"Close modal",children:e.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})}),e.jsx("div",{className:"mb-4",children:n}),i&&e.jsx("div",{className:"flex justify-end gap-2 mt-4",children:i})]})})]});return typeof window<"u"?ue.createPortal(k,document.body):k}function Oe({columns:s,data:t,loading:a=!1,onSort:n,sortColumn:l,sortDirection:o,emptyMessage:i="No data available",className:c="",...d}){const b=x=>{if(!n||!s.find(N=>N.key===x)?.sortable)return;n(x,l===x&&o==="asc"?"desc":"asc")},m=[...["min-w-full","divide-y","divide-gray-200"],c].filter(Boolean).join(" ");return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:m,...d,children:[e.jsx("thead",{className:"bg-gray-50",children:e.jsx("tr",{children:s.map(x=>e.jsx("th",{scope:"col",className:`px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider ${x.sortable&&n?"cursor-pointer hover:bg-gray-100 select-none":""}`,onClick:()=>x.sortable&&b(x.key),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:x.label}),x.sortable&&l===x.key&&e.jsx("span",{className:"text-gray-400",children:o==="asc"?"↑":"↓"})]})},x.key))})}),e.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:a?e.jsx("tr",{children:e.jsx("td",{colSpan:s.length,className:"px-6 py-4 text-center text-gray-500",children:"Loading..."})}):t.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:s.length,className:"px-6 py-4 text-center text-gray-500",children:i})}):t.map((x,y)=>e.jsx("tr",{className:"hover:bg-gray-50",children:s.map(N=>{const k=x[N.key];return e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:N.render?N.render(k,x):k},N.key)})},y))})]})})}function B({variant:s="default",title:t,showHeader:a=!0,onClose:n,children:l,className:o="",...i}){const c=["flex","flex-col","bg-white","border-r","border-gray-200","h-full"],d={default:"w-64",collapsed:"w-16"},b=[...c,d[s],o].filter(Boolean).join(" ");return e.jsxs("aside",{className:b,...i,children:[a&&t&&e.jsx(F,{title:t,onClose:n,showCloseButton:!!n}),e.jsx("nav",{className:"flex-1 overflow-y-auto py-4",children:l})]})}B.Group=re;B.Item=ee;B.Header=F;exports.Badge=pe;exports.BoxWrapper=Q;exports.Breadcrumb=Ee;exports.Button=C;exports.Card=we;exports.Dropdown=Re;exports.EmptyState=_e;exports.ErrorMessage=je;exports.Form=ke;exports.Info=be;exports.Input=Z;exports.InputWithLabel=D;exports.Label=ve;exports.LoginBox=Se;exports.Modal=Ae;exports.NavLink=K;exports.NavbarGroup=Te;exports.Pagination=Ce;exports.Select=he;exports.Sidebar=B;exports.SidebarGroup=re;exports.SidebarHeader=F;exports.SidebarItem=ee;exports.Skeleton=Ne;exports.Table=Oe;exports.Text=R;exports.Textarea=ge;exports.Tooltip=ye;
|