@fabio.caffarello/react-design-system 1.3.2 → 1.4.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 +535 -352
- package/dist/ui/atoms/Skeleton/Skeleton.d.ts +20 -0
- package/dist/ui/atoms/Skeleton/Skeleton.stories.d.ts +24 -0
- package/dist/ui/atoms/Skeleton/Skeleton.test.d.ts +1 -0
- package/dist/ui/atoms/Tooltip/Tooltip.d.ts +21 -0
- package/dist/ui/atoms/Tooltip/Tooltip.stories.d.ts +23 -0
- package/dist/ui/atoms/Tooltip/Tooltip.test.d.ts +1 -0
- package/dist/ui/atoms/index.d.ts +4 -0
- package/dist/ui/molecules/Dropdown/Dropdown.d.ts +31 -0
- package/dist/ui/molecules/Dropdown/Dropdown.stories.d.ts +25 -0
- package/dist/ui/molecules/Dropdown/Dropdown.test.d.ts +1 -0
- package/dist/ui/molecules/EmptyState/EmptyState.d.ts +26 -0
- package/dist/ui/molecules/EmptyState/EmptyState.stories.d.ts +21 -0
- package/dist/ui/molecules/EmptyState/EmptyState.test.d.ts +1 -0
- package/dist/ui/molecules/index.d.ts +4 -0
- package/package.json +1 -1
- package/src/ui/atoms/Skeleton/Skeleton.stories.tsx +61 -0
- package/src/ui/atoms/Skeleton/Skeleton.test.tsx +40 -0
- package/src/ui/atoms/Skeleton/Skeleton.tsx +70 -0
- package/src/ui/atoms/Tooltip/Tooltip.stories.tsx +60 -0
- package/src/ui/atoms/Tooltip/Tooltip.test.tsx +53 -0
- package/src/ui/atoms/Tooltip/Tooltip.tsx +87 -0
- package/src/ui/atoms/index.ts +6 -0
- package/src/ui/molecules/Dropdown/Dropdown.stories.tsx +58 -0
- package/src/ui/molecules/Dropdown/Dropdown.test.tsx +73 -0
- package/src/ui/molecules/Dropdown/Dropdown.tsx +125 -0
- package/src/ui/molecules/EmptyState/EmptyState.stories.tsx +63 -0
- package/src/ui/molecules/EmptyState/EmptyState.test.tsx +55 -0
- package/src/ui/molecules/EmptyState/EmptyState.tsx +81 -0
- package/src/ui/molecules/index.ts +6 -0
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),oe=require("react-dom");var O={exports:{}},R={};/**
|
|
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 U;function ie(){if(U)return R;U=1;var t=Symbol.for("react.transitional.element"),s=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:t,type:n,key:i,ref:l!==void 0?l:null,props:o}}return R.Fragment=s,R.jsx=a,R.jsxs=a,R}var T={};/**
|
|
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 J;function ce(){return J||(J=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case f:return"Fragment";case x:return"Profiler";case E:return"StrictMode";case ee:return"Suspense";case re:return"SuspenseList";case se:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case k:return"Portal";case Q:return e.displayName||"Context";case S:return(e._context.displayName||"Context")+".Consumer";case K:var d=e.render;return e=e.displayName,e||(e=d.displayName||d.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case te:return d=e.displayName||null,d!==null?d:t(e.type)||"Memo";case B:d=e._payload,e=e._init;try{return t(e(d))}catch{}}return null}function s(e){return""+e}function a(e){try{s(e);var d=!1}catch{d=!0}if(d){d=console;var h=d.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return h.call(d,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",g),s(e)}}function n(e){if(e===f)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===B)return"<...>";try{var d=t(e);return d?"<"+d+">":"<...>"}catch{return"<...>"}}function l(){var e=$.A;return e===null?null:e.getOwner()}function o(){return Error("react-stack-top-frame")}function i(e){if(D.call(e,"key")){var d=Object.getOwnPropertyDescriptor(e,"key").get;if(d&&d.isReactWarning)return!1}return e.key!==void 0}function c(e,d){function h(){F||(F=!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)",d))}h.isReactWarning=!0,Object.defineProperty(e,"key",{get:h,configurable:!0})}function u(){var e=t(this.type);return W[e]||(W[e]=!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.")),e=this.props.ref,e!==void 0?e:null}function p(e,d,h,g,A,M){var v=h.ref;return e={$$typeof:N,type:e,key:d,props:h,_owner:g},(v!==void 0?v:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:u}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function y(e,d,h,g,A,M){var v=d.children;if(v!==void 0)if(g)if(ne(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(D.call(d,"key")){v=t(e);var C=Object.keys(d).filter(function(le){return le!=="key"});g=0<C.length?"{key: someKey, "+C.join(": ..., ")+": ...}":"{key: someKey}",q[v+g]||(C=0<C.length?"{"+C.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} />`,p,h,E,h),q[h+p]=!0)}if(h=null,b!==void 0&&(a(b),h=""+b),c(i)&&(a(i.key),h=""+i.key),"key"in i){b={};for(var Y in i)Y!=="key"&&(b[Y]=i[Y])}else b=i;return h&&u(b,typeof e=="function"?e.displayName||e.name||"Unknown":e),j(e,h,b,l(),A,M)}function k(e){x(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===L&&(e._payload.status==="fulfilled"?x(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function x(e){return typeof e=="object"&&e!==null&&e.$$typeof===v}var y=T,v=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),f=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"),se=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),te=Symbol.for("react.activity"),ae=Symbol.for("react.client.reference"),B=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=Object.prototype.hasOwnProperty,ne=Array.isArray,$=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(e){return e()}};var F,W={},D=y.react_stack_bottom_frame.bind(y,o)(),P=$(n(o)),q={};R.Fragment=d,R.jsx=function(e,i,b){var p=1e4>B.recentlyCreatedOwnerStacks++;return g(e,i,b,!1,p?Error("react-stack-top-frame"):D,p?$(n(e)):P)},R.jsxs=function(e,i,b){var p=1e4>B.recentlyCreatedOwnerStacks++;return g(e,i,b,!0,p?Error("react-stack-top-frame"):D,p?$(n(e)):P)}})()),R}var J;function de(){return J||(J=1,process.env.NODE_ENV==="production"?O.exports=ie():O.exports=ce()),O.exports}var r=de();function ue({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 r.jsx("div",{role:"alert",className:`border px-4 py-2 rounded-lg ${n.join(" ")}`,...a})}function G({variant:s,bold:t,italic:a,className:n,as:l,color:o,...c}){const u=[n];let m;if(l)m=l;else switch(s){case"heading":m="h2";break;case"list":m="li";break;case"paragraph":default:m="p";break}return t&&u.push("font-bold"),a&&u.push("italic"),o&&u.push(`text-${o}`),r.jsx(m,{className:u.join(" "),...c})}function X({className:s,...t}){const a=[s,"px-large","border","border-1","border-grey-light","rounded","lh-form-element","h-form-element","text-base"];return r.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 r.jsx("button",{className:n.join(" "),...a})}function H({className:s,...t}){const a=[s,"p-large","bg-bg","rounded","shadow-card"];return r.jsx("div",{className:a.join(" "),...t})}function fe({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"},c=[...l,o[s],t].filter(Boolean).join(" ");return r.jsx("span",{role:"status","aria-label":typeof a=="string"?a:void 0,className:c,...n,children:a})}function me({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"],c=a?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-indigo-500",u=[...o,c,n].filter(Boolean).join(" ");return r.jsxs("select",{className:u,"aria-invalid":a,"aria-describedby":a?`${l.id}-error`:void 0,...l,children:[t&&r.jsx("option",{value:"",disabled:!0,children:t}),s.map(m=>r.jsx("option",{value:m.value,disabled:m.disabled,children:m.label},m.value))]})}function be({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"},c=s?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-indigo-500",u=[...l,o[t],c,a].filter(Boolean).join(" ");return r.jsx("textarea",{className:u,"aria-invalid":s,"aria-describedby":s&&n.id?`${n.id}-error`:void 0,...n})}function xe({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"},c=[...l,o[s],t].filter(Boolean).join(" ");return r.jsx("label",{className:c,...n,children:a})}function pe({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 r.jsxs("div",{role:"alert",id:t,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:s})]})}function Z({variant:s="default",className:t="",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"},c=[...l,o[s],t].filter(Boolean).join(" ");return s==="disabled"?r.jsx("span",{className:c,"aria-disabled":"true",children:a}):r.jsx("a",{className:c,...n,children:a})}function I({label:s,...t}){return t.id||console.error("InputWithLabel component requires an id prop"),r.jsxs("div",{className:"mb-medium grid gap-small",children:[r.jsx(G,{as:"label",htmlFor:t.id,className:"cursor-pointer",children:s}),r.jsx(X,{...t})]})}function he({variant:s="default",padding:t="medium",className:a="",children:n,...l}){const o=["bg-white","rounded-lg","border","border-gray-200","shadow-sm"],c={default:"",hover:"hover:shadow-md transition-shadow cursor-pointer",selected:"border-indigo-500 shadow-md"},u={none:"",small:"p-2",medium:"p-4",large:"p-6"},m=[...o,c[s],u[t],a].filter(Boolean).join(" ");return r.jsx("div",{className:m,...l,children:n})}function ve({children:s,onSubmit:t,loading:a=!1,error:n=null,success:l=null,className:o="",...c}){const m=[...["space-y-4"],o].filter(Boolean).join(" "),j=g=>{g.preventDefault(),t&&!a&&t(g)};return r.jsxs("form",{className:m,onSubmit:j,noValidate:!0,...c,children:[s,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 ge({items:s,separator:t="/",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:s.map((c,u)=>{const m=u===s.length-1;return r.jsxs("li",{className:"flex items-center",children:[u>0&&r.jsx("span",{className:"mx-2 text-gray-400","aria-hidden":"true",children:t}),m?r.jsx("span",{className:"text-gray-900 font-medium","aria-current":"page",children:c.label}):c.href?r.jsx(Z,{href:c.href,variant:"default",children:c.label}):r.jsx("span",{className:"text-gray-500",children:c.label})]},u)})})})}function je({currentPage:s,totalPages:t,onPageChange:a,totalItems:n,itemsPerPage:l,showPageInfo:o=!0,className:c="",...u}){const m=()=>{s>1&&a(s-1)},j=()=>{s<t&&a(s+1)},g=d=>{d>=1&&d<=t&&d!==s&&a(d)},k=()=>{const d=[];if(t<=5)for(let f=1;f<=t;f++)d.push(f);else if(s<=3){for(let f=1;f<=4;f++)d.push(f);d.push("ellipsis"),d.push(t)}else if(s>=t-2){d.push(1),d.push("ellipsis");for(let f=t-3;f<=t;f++)d.push(f)}else{d.push(1),d.push("ellipsis");for(let f=s-1;f<=s+1;f++)d.push(f);d.push("ellipsis"),d.push(t)}return d},x=n&&l?(s-1)*l+1:void 0,y=n&&l?Math.min(s*l,n):void 0,N=[...["flex","items-center","justify-between","px-4","py-3"],c].filter(Boolean).join(" ");return r.jsxs("nav",{className:N,"aria-label":"Pagination",...u,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(C,{variant:"secondary",onClick:m,disabled:s===1,className:"px-3 py-1 text-sm",children:"Previous"}),r.jsx("div",{className:"flex items-center gap-1",children:k().map((d,w)=>{if(d==="ellipsis")return r.jsx("span",{className:"px-2 text-gray-500",children:"..."},`ellipsis-${w}`);const f=d,S=f===s;return r.jsx("button",{onClick:()=>g(f),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 ${f}`,children:f},f)})}),r.jsx(C,{variant:"secondary",onClick:j,disabled:s===t,className:"px-3 py-1 text-sm",children:"Next"})]}),o&&n&&l&&r.jsxs("div",{className:"text-sm text-gray-700",children:["Showing ",x," to ",y," of ",n," results"]})]})}function ye({onForgotPasswordClick:s,className:t,...a}){return r.jsx(H,{className:t,children:r.jsxs("form",{...a,onSubmit:n=>{n.preventDefault(),a.onSubmit&&a.onSubmit(n)},children:[r.jsx(I,{id:"login-email",label:"Your email",placeholder:"myname@email.com"}),r.jsx(I,{id:"login-password",label:"Your password",placeholder:"••••••••",type:"password"}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx(C,{variant:"secondary",type:"button",onClick:s,children:"Forgot password?"}),r.jsx(C,{variant:"regular",type:"submit",children:"Sign in"})]})]})})}function Ne({isOpen:s,onClose:t,title:a,children:n,variant:l="default",showCloseButton:o=!0,footer:c,className:u="",...m}){const j=T.useRef(null),g=T.useRef(null);if(T.useEffect(()=>{if(!s)return;g.current=document.activeElement;const d=setTimeout(()=>{j.current?.focus()},0),w=f=>{f.key==="Escape"&&t()};return document.addEventListener("keydown",w),()=>{clearTimeout(d),document.removeEventListener("keydown",w),g.current?.focus()}},[s,t]),T.useEffect(()=>(s?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[s]),!s)return null;const k=["fixed","inset-0","z-50","overflow-y-auto"],x=["fixed","inset-0","bg-black","bg-opacity-50","transition-opacity"],v=["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",u].filter(Boolean).join(" "),N=r.jsxs("div",{className:k.join(" "),role:"dialog","aria-modal":"true","aria-labelledby":a?"modal-title":void 0,onClick:d=>{d.target===d.currentTarget&&t()},children:[r.jsx("div",{className:x.join(" "),"aria-hidden":"true"}),r.jsx("div",{className:"flex min-h-full items-center justify-center p-4",children:r.jsxs("div",{ref:j,tabIndex:-1,className:v,onClick:d=>d.stopPropagation(),...m,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:t,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:t,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}),c&&r.jsx("div",{className:"flex justify-end gap-2 mt-4",children:c})]})})]});return typeof window<"u"?oe.createPortal(N,document.body):N}function ke({columns:s,data:t,loading:a=!1,onSort:n,sortColumn:l,sortDirection:o,emptyMessage:c="No data available",className:u="",...m}){const j=x=>{if(!n||!s.find(v=>v.key===x)?.sortable)return;n(x,l===x&&o==="asc"?"desc":"asc")},k=[...["min-w-full","divide-y","divide-gray-200"],u].filter(Boolean).join(" ");return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:k,...m,children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsx("tr",{children:s.map(x=>r.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&&j(x.key),children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:x.label}),x.sortable&&l===x.key&&r.jsx("span",{className:"text-gray-400",children:o==="asc"?"↑":"↓"})]})},x.key))})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:a?r.jsx("tr",{children:r.jsx("td",{colSpan:s.length,className:"px-6 py-4 text-center text-gray-500",children:"Loading..."})}):t.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:s.length,className:"px-6 py-4 text-center text-gray-500",children:c})}):t.map((x,y)=>r.jsx("tr",{className:"hover:bg-gray-50",children:s.map(v=>{const N=x[v.key];return r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:v.render?v.render(N,x):N},v.key)})},y))})]})})}exports.Badge=fe;exports.BoxWrapper=H;exports.Breadcrumb=ge;exports.Button=C;exports.Card=he;exports.ErrorMessage=pe;exports.Form=ve;exports.Info=ue;exports.Input=X;exports.InputWithLabel=I;exports.Label=xe;exports.LoginBox=ye;exports.Modal=Ne;exports.NavLink=Z;exports.Pagination=je;exports.Select=me;exports.Table=ke;exports.Text=G;exports.Textarea=be;
|
|
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;
|