klip-components 0.18.1 → 0.19.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.d.ts CHANGED
@@ -18,22 +18,20 @@ export declare interface BorderRadius {
18
18
  * Supports all standard HTML button attributes and provides additional customization through props.
19
19
  *
20
20
  * @example
21
- * // New API - filled primary button
21
+ * // Filled primary button
22
22
  * <Button variant="filled" color="primary">Click me</Button>
23
23
  *
24
24
  * @example
25
- * // New API - outline danger button
25
+ * // Outline danger button
26
26
  * <Button variant="outline" color="danger">Delete</Button>
27
27
  *
28
28
  * @example
29
- * // New API - ghost button
29
+ * // Ghost button
30
30
  * <Button variant="ghost" color="secondary">Cancel</Button>
31
31
  *
32
32
  * @example
33
- * // Legacy API (deprecated but still supported)
34
- * <Button variant="primary">Click me</Button>
35
- * <Button variant="outline">Outline</Button>
36
- * <Button variant="danger">Delete</Button>
33
+ * // Link button
34
+ * <Button variant="link" color="primary">Learn more</Button>
37
35
  */
38
36
  export declare const Button: default_2.FC<ButtonProps>;
39
37
 
@@ -47,13 +45,11 @@ export declare type ButtonColor = 'primary' | 'secondary' | 'success' | 'danger'
47
45
  export declare interface ButtonProps extends default_2.ButtonHTMLAttributes<HTMLButtonElement> {
48
46
  /**
49
47
  * Visual style variant of the button.
50
- * Use 'filled', 'outline', 'ghost', or 'link' for new API.
51
48
  * @default 'filled'
52
49
  */
53
- variant?: ButtonVariantNew | ButtonVariant;
50
+ variant?: ButtonVariantNew;
54
51
  /**
55
52
  * Color scheme for the button.
56
- * Only applies when using new variant API ('filled', 'outline', 'ghost').
57
53
  * @default 'primary'
58
54
  */
59
55
  color?: ButtonColor;
@@ -96,12 +92,6 @@ export declare type ButtonShape = 'rectangle' | 'pill' | 'square' | 'circle';
96
92
 
97
93
  export declare type ButtonSize = 'sm' | 'md' | 'lg';
98
94
 
99
- /**
100
- * @deprecated Use ButtonVariantNew instead. This type will be removed in a future version.
101
- * Old variant type that combined both visual style and color.
102
- */
103
- export declare type ButtonVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'link' | 'outline' | 'ghost' | 'icon';
104
-
105
95
  /** New variant type that represents only the visual style */
106
96
  export declare type ButtonVariantNew = 'filled' | 'outline' | 'ghost' | 'link';
107
97
 
@@ -357,7 +347,9 @@ export declare interface PaginationProps {
357
347
  /** Size of the pagination buttons */
358
348
  size?: 'sm' | 'md' | 'lg';
359
349
  /** Variant of the pagination buttons */
360
- variant?: 'primary' | 'secondary' | 'outline' | 'ghost';
350
+ variant?: 'filled' | 'outline' | 'ghost';
351
+ /** Color of the pagination buttons */
352
+ color?: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
361
353
  /** Additional CSS class */
362
354
  className?: string;
363
355
  /** Whether pagination buttons should be disabled */
@@ -1 +1 @@
1
- "use strict";var e=Object.defineProperty,t=Object.defineProperties,r=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,l=(t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,i=(e,t)=>{for(var r in t||(t={}))a.call(t,r)&&l(e,r,t[r]);if(n)for(var r of n(t))s.call(t,r)&&l(e,r,t[r]);return e},o=(e,n)=>t(e,r(n)),c=(e,t)=>{var r={};for(var l in e)a.call(e,l)&&t.indexOf(l)<0&&(r[l]=e[l]);if(null!=e&&n)for(var l of n(e))t.indexOf(l)<0&&s.call(e,l)&&(r[l]=e[l]);return r};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),h=require("react");function u(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=u(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function p(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=u(e))&&(n&&(n+=" "),n+=t);return n}function m(...e){const t=e.join(" ").split(" ").filter(Boolean);return[...new Set(t)].join(" ")}function x(...e){return m(p(...e))}const f=({width:e=24,height:t=24})=>d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 24 24",children:d.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m15 6l-6 6l6 6"})}),g=({width:e=24,height:t=24})=>d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 24 24",children:d.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 6l6 6l-6 6"})}),b=({color:e="currentColor",size:t=24})=>d.jsxs("svg",{width:t,height:t,stroke:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("style",{children:"\n .spinner_V8m1{transform-origin:center;animation:spinner_zKoa 2s linear infinite}\n .spinner_V8m1 circle{stroke-linecap:round;animation:spinner_YpZS 1.5s ease-in-out infinite}\n @keyframes spinner_zKoa{100%{transform:rotate(360deg)}}\n @keyframes spinner_YpZS{\n 0%{stroke-dasharray:0 150;stroke-dashoffset:0}\n 47.5%{stroke-dasharray:42 150;stroke-dashoffset:-16}\n 95%,100%{stroke-dasharray:42 150;stroke-dashoffset:-59}\n }\n "}),d.jsx("g",{className:"spinner_V8m1",children:d.jsx("circle",{cx:"12",cy:"12",r:"9.5",fill:"none",strokeWidth:"3"})})]}),v={primary:{variant:"filled",color:"primary"},secondary:{variant:"filled",color:"secondary"},success:{variant:"filled",color:"success"},danger:{variant:"filled",color:"danger"},warning:{variant:"filled",color:"warning"},info:{variant:"filled",color:"info"},link:{variant:"link",color:"primary"},outline:{variant:"outline",color:"primary"},ghost:{variant:"ghost",color:"primary"}},y=e=>{var t=e,{variant:r="filled",color:n="primary",size:a="md",shape:s="rectangle",startIcon:l,endIcon:h,className:u="",children:p,loading:m,disabled:f,hover:g=!0}=t,y=c(t,["variant","color","size","shape","startIcon","endIcon","className","children","loading","disabled","hover"]);let j=r,w=n;if((e=>Object.keys(v).includes(e))(r)){process.env.NODE_ENV;const e=v[r];j=e.variant,w=e.color}const N="filled"===j?`btn-${w}`:`btn-${j}-${w}`;return d.jsx("button",o(i({className:x("btn",N,`btn-${a}`,`btn-${s}`,{"btn-loading":m,"btn-no-hover":!g},u),disabled:f||m},y),{children:m?d.jsx(b,{}):d.jsxs(d.Fragment,{children:[l&&d.jsx("span",{className:"btn-icon-start",children:l}),p,h&&d.jsx("span",{className:"btn-icon-end",children:h})]})}))},j=d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",children:d.jsx("path",{fill:"currentColor",d:"M12 14.975q-.2 0-.375-.062T11.3 14.7l-4.6-4.6q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275l3.9 3.9l3.9-3.9q.275-.275.7-.275t.7.275t.275.7t-.275.7l-4.6 4.6q-.15.15-.325.213t-.375.062"})}),w="...",N=({currentPage:e,totalPages:t,siblingCount:r=1})=>h.useMemo(()=>{if(t<=7)return Array.from({length:t},(e,t)=>t+1);const n=Math.max(e-r,1),a=Math.min(e+r,t),s=n>2,l=a<t-1;if(!s&&!l)return Array.from({length:t},(e,t)=>t+1);if(!s&&l){const e=3+2*r;return[...Array.from({length:e},(e,t)=>t+1),w,t]}if(s&&!l){const e=3+2*r;return[1,w,...Array.from({length:e},(r,n)=>t-e+n+1)]}return[1,w,...Array.from({length:a-n+1},(e,t)=>n+t),w,t]},[e,t,r]),k=e=>{var t=e,{className:r="",children:n}=t,a=c(t,["className","children"]);return d.jsx("thead",o(i({className:x("table-header",r)},a),{children:n}))},C=e=>{var t=e,{className:r="",children:n}=t,a=c(t,["className","children"]);return d.jsx("tbody",o(i({className:x("table-body",r)},a),{children:n}))},M=e=>{var t=e,{className:r="",children:n}=t,a=c(t,["className","children"]);return d.jsx("tfoot",o(i({className:x("table-footer",r)},a),{children:n}))},T=e=>{var t=e,{className:r="",selected:n=!1,children:a}=t,s=c(t,["className","selected","children"]);return d.jsx("tr",o(i({className:x("table-row",{"table-row-selected":n},r)},s),{children:a}))},P=e=>{var t=e,{className:r="",header:n=!1,align:a="left",minWidth:s,maxWidth:l,width:h,children:u,style:p}=t,m=c(t,["className","header","align","minWidth","maxWidth","width","children","style"]);const f=n?"th":"td",g=i(i(i(i({},s&&{minWidth:s}),l&&{maxWidth:l}),h&&{width:h}),p);return d.jsx(f,o(i({className:x("table-cell",`table-cell-${a}`,{"table-cell-header":n},r),style:Object.keys(g).length>0?g:p},m),{children:u}))},E=e=>{var t=e,{className:r="",variant:n="default",dense:a=!1,children:s}=t,l=c(t,["className","variant","dense","children"]);const h=d.jsx("table",o(i({className:x("table",`table-${n}`,{"table-dense":a},r)},l),{children:s}));return d.jsx("div",{className:"table-responsive",children:h})};E.Header=k,E.Body=C,E.Footer=M,E.Row=T,E.Cell=P;const O=h.createContext(void 0),S=()=>{const e=h.useContext(O);if(void 0===e)throw new Error("useMenuContext must be used within a MenuContextProvider");return e},z=({children:e,menuPosition:t="bottom-left"})=>{const[r,n]=h.useState(!1),[a,s]=h.useState({x:0,y:0}),l=h.useRef(null),i=h.useRef(null),o=h.useCallback((e,r)=>{const n=10,a=(null==r?void 0:r.width)||200,s=(null==r?void 0:r.height)||150,l=window.innerWidth,i=window.innerHeight;let o=0,c=0;switch(t){case"bottom-left":default:o=e.left,c=e.bottom+n;break;case"bottom-right":o=e.right-a,c=e.bottom+n;break;case"bottom-center":o=e.left+e.width/2-a/2,c=e.bottom+n;break;case"top-left":o=e.left,c=e.top-15-s;break;case"top-right":o=e.right-a,c=e.top-15-s;break;case"top-center":o=e.left+e.width/2-a/2,c=e.top-15-s;break;case"left-top":o=e.left-15-a,c=e.top;break;case"left-bottom":o=e.left-15-a,c=e.bottom-s;break;case"left-center":o=e.left-15-a,c=e.top+e.height/2-s/2;break;case"right-top":o=e.right+n,c=e.top;break;case"right-bottom":o=e.right+n,c=e.bottom-s;break;case"right-center":o=e.right+n,c=e.top+e.height/2-s/2}return o=Math.max(n,Math.min(o,l-a-n)),c=Math.max(n,Math.min(c,i-s-n)),{x:o,y:c}},[t]),c=h.useCallback(()=>{var e;if(!l.current)return;const t=l.current.getBoundingClientRect(),r=null==(e=i.current)?void 0:e.getBoundingClientRect();s(o(t,r))},[o]),u=()=>n(!1);return h.useEffect(()=>{if(r&&l.current){const e=()=>{var e;const t=l.current.getBoundingClientRect(),r=null==(e=i.current)?void 0:e.getBoundingClientRect();s(o(t,r))};e();const t=setTimeout(e,50);return()=>clearTimeout(t)}},[r,o]),h.useEffect(()=>{const e=e=>{i.current&&i.current.contains(e.target)||l.current&&l.current.contains(e.target)||u()};if(r)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r]),h.useEffect(()=>{const e=e=>{"Escape"===e.key&&r&&u()};if(r)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[r]),d.jsx(O.Provider,{value:{isOpen:r,position:a,menuPosition:t,triggerRef:l,contentRef:i,openMenu:()=>{l.current&&n(!0)},closeMenu:u,repositionMenu:c},children:e})},A=({children:e,className:t,style:r={}})=>{const{isOpen:n,position:a,contentRef:s,closeMenu:l}=S(),[o,c]=h.useState(!1),[u,p]=h.useState(!1);h.useEffect(()=>{if(n){p(!0);const e=setTimeout(()=>{if(c(!0),s.current){const e=s.current.querySelector('[role="menuitem"]:not([disabled])');e&&e.focus()}},10);return()=>clearTimeout(e)}c(!1);const e=setTimeout(()=>p(!1),150);return()=>clearTimeout(e)},[n,s]);return u?d.jsx("article",{ref:s,className:x("menu-content",{"menu-content--open":o},t),style:i({left:`${a.x}px`,top:`${a.y}px`,opacity:o?1:0,transition:"opacity 0.15s ease-in-out"},r),role:"menu","aria-orientation":"vertical",onKeyDown:e=>{var t,r;if(!s.current)return;const n=Array.from(s.current.querySelectorAll('[role="menuitem"]:not([disabled])')),a=n.findIndex(e=>e===document.activeElement);switch(e.key){case"ArrowDown":e.preventDefault();null==(t=n[a<n.length-1?a+1:0])||t.focus();break;case"ArrowUp":e.preventDefault();null==(r=n[a>0?a-1:n.length-1])||r.focus();break;case"Escape":e.preventDefault(),l()}},tabIndex:-1,children:h.Children.map(e,e=>h.isValidElement(e)?h.cloneElement(e,{closeMenu:l}):e)}):null},B=({children:e,onClick:t,closeMenu:r,disabled:n=!1,className:a,style:s={}})=>{const l=()=>{n||(t&&t(),r&&r())};return d.jsx("button",{onClick:l,onKeyDown:e=>{n||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),l())},disabled:n,className:x("menu-item",{"menu-item--disabled":n},a),style:s,role:"menuitem",type:"button",tabIndex:n?-1:0,"aria-disabled":n,children:e})},$=({children:e,className:t,style:r={}})=>{const{triggerRef:n,isOpen:a,openMenu:s,closeMenu:l}=S();return d.jsx("section",{ref:n,onClick:()=>{a?l():s()},className:x("menu-trigger",t),style:r,children:h.cloneElement(e,{isOpen:a})})},q=Object.assign(({children:e,className:t,style:r={},position:n="bottom-left"})=>d.jsx(z,{menuPosition:n,children:d.jsx("div",{className:x("menu-container",t),style:r,children:e})}),{Trigger:$,Content:A,Item:B});exports.Button=y,exports.ButtonSelect=({options:e,value:t,onChange:r,disabled:n=!1,multiple:a=!1})=>{const s=e=>Array.isArray(t)?t.includes(e):e===t;return d.jsx("div",{className:"button-select "+(n?"disabled":""),children:e.map(({value:e,child:l})=>d.jsx("button",{className:"button-select-option "+(s(e)?"selected":""),onClick:()=>(e=>{if(n)return;if(!a)return void r(e);const s=Array.isArray(t)?t:[],l=s.includes(e)?s.filter(t=>t!==e):[...s,e];r(l)})(e),disabled:n,type:"button",children:l},e))})},exports.ChevronLeft=f,exports.ChevronRight=g,exports.DOTS=w,exports.Input=e=>{var t=e,{variant:r="primary",type:n="text",label:a,prefix:s,suffix:l,helperText:o,className:u,labelClass:p,helperTextClass:m,onChange:f,id:g,hasError:v,loading:y=!1,disabled:j}=t,w=c(t,["variant","type","label","prefix","suffix","helperText","className","labelClass","helperTextClass","onChange","id","hasError","loading","disabled"]);const N=h.useId(),k=g||`input-${N}`,C=x("form-field",{"has-prefix":!!s,"has-suffix":!!l},{[`variant-${r}`]:r},{loading:y},u);return d.jsxs("article",{className:"input-container",children:[a&&d.jsx("label",{htmlFor:k,className:x("input-label",p),children:a}),d.jsxs("section",{className:x("input-wrapper",{loading:y}),children:[s&&d.jsx("article",{className:"input-prefix",children:s}),d.jsx("input",i({id:k,type:n,className:C,onChange:e=>null==f?void 0:f(e.target.value),disabled:j||y},w)),y?d.jsx("article",{className:"input-suffix",children:d.jsx(b,{})}):l&&d.jsx("article",{className:"input-suffix",children:l})]}),o&&d.jsx("small",{className:x("input-helper-text",m),style:{color:v?"var(--color-danger)":"inherit"},children:o})]})},exports.Menu=q,exports.MenuContent=A,exports.MenuContextProvider=z,exports.MenuItem=B,exports.MenuTrigger=$,exports.Pagination=({currentPage:e,totalPages:t,onPageChange:r,siblingCount:n=1,hidePrevButton:a=!1,hideNextButton:s=!1,size:l="md",variant:i="secondary",className:o="",disabled:c=!1,mobile:h=!1})=>{const u=N({currentPage:e,totalPages:t,siblingCount:n});if(0===e||0===t)return null;const p=()=>{e<t&&!c&&r(e+1)},m=()=>{e>1&&!c&&r(e-1)},b=u[u.length-1];return h?d.jsxs("article",{className:x("pagination","pagination--mobile",o),"aria-label":"pagination navigation",children:[!a&&d.jsx(y,{variant:i,size:l,onClick:m,disabled:1===e||c,"aria-label":"Go to previous page",shape:"square",children:d.jsx(f,{})}),d.jsxs("span",{className:"pagination__page-indicator","aria-live":"polite",children:[e," / ",t," pages"]}),!s&&d.jsx(y,{variant:i,size:l,onClick:p,disabled:e===b||c,"aria-label":"Go to next page",shape:"square",children:d.jsx(g,{})})]}):d.jsxs("article",{className:x("pagination",o),"aria-label":"pagination navigation",children:[!a&&d.jsx(y,{variant:i,size:l,onClick:m,disabled:1===e||c,"aria-label":"Go to previous page",shape:"square",children:d.jsx(f,{})}),u.map((n,a)=>n===w?d.jsx(y,{variant:i,size:l,"aria-label":"More pages",shape:"square",disabled:c,hover:!1,children:"…"},a):d.jsx(y,{variant:n===e?"primary":i,size:l,onClick:()=>!c&&r(n),disabled:c||1===t,"aria-label":n===e?`Current page, page ${n}`:`Go to page ${n}`,"aria-current":n===e?"page":void 0,shape:"square",children:n},a)),!s&&d.jsx(y,{variant:i,size:l,onClick:p,disabled:e===b||c,"aria-label":"Go to next page",shape:"square",children:d.jsx(g,{})})]})},exports.Select=e=>{var t=e,{variant:r="primary",label:n,prefix:a,suffix:s,helperText:l,className:u,labelClass:p,helperTextClass:m,onChange:f,id:g,hasError:v,loading:y=!1,disabled:w,options:N=[],placeholder:k,children:C}=t,M=c(t,["variant","label","prefix","suffix","helperText","className","labelClass","helperTextClass","onChange","id","hasError","loading","disabled","options","placeholder","children"]);const T=h.useId(),P=g||`select-${T}`,E=x("form-field",{"has-prefix":!!a,"has-suffix":!!s||!y},{[`variant-${r}`]:r},{loading:y},u);return d.jsxs("article",{className:"select-container",children:[n&&d.jsx("label",{htmlFor:P,className:x("select-label",p),children:n}),d.jsxs("section",{className:x("select-wrapper",{loading:y}),children:[a&&d.jsx("article",{className:"select-prefix",children:a}),d.jsxs("select",o(i({id:P,className:E,onChange:e=>null==f?void 0:f(e.target.value),disabled:w||y},M),{children:[k&&d.jsx("option",{value:"",disabled:!0,hidden:!0,children:k}),N.length>0?N.map(e=>d.jsx("option",{value:e.value,disabled:e.disabled,children:e.label},e.value)):C]})),y?d.jsx("article",{className:"select-suffix",children:d.jsx(b,{})}):d.jsx("article",{className:"select-suffix",children:s||j})]}),l&&d.jsx("small",{className:x("select-helper-text",m),style:{color:v?"var(--color-danger)":"inherit"},children:l})]})},exports.Spinner=b,exports.Table=E,exports.TableBody=C,exports.TableCell=P,exports.TableFooter=M,exports.TableHeader=k,exports.TableRow=T,exports.Toggle=e=>{var t=e,{color:r="var(--color-primary)",size:n="3.75rem",checked:a=!1,onChange:s,label:l,labelPosition:o="right",className:h}=t,u=c(t,["color","size","checked","onChange","label","labelPosition","className"]);return d.jsxs("label",{className:x("switch-container",o,h),children:[d.jsxs("div",{className:"toggle-switch",style:{"--switch-size":n,"--switch-color":r},children:[d.jsx("input",i({type:"checkbox",role:"switch",checked:a,onChange:e=>null==s?void 0:s(e.target.checked)},u)),d.jsx("span",{className:"slider"})]}),l&&d.jsx("span",{className:"switch-label",children:l})]})},exports.clsx=p,exports.cn=x,exports.mergeClasses=m,exports.useMenuContext=S,exports.usePagination=N;
1
+ "use strict";var e=Object.defineProperty,t=Object.defineProperties,r=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,l=(t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,i=(e,t)=>{for(var r in t||(t={}))a.call(t,r)&&l(e,r,t[r]);if(n)for(var r of n(t))s.call(t,r)&&l(e,r,t[r]);return e},o=(e,n)=>t(e,r(n)),c=(e,t)=>{var r={};for(var l in e)a.call(e,l)&&t.indexOf(l)<0&&(r[l]=e[l]);if(null!=e&&n)for(var l of n(e))t.indexOf(l)<0&&s.call(e,l)&&(r[l]=e[l]);return r};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),h=require("react");function u(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=u(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function p(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=u(e))&&(n&&(n+=" "),n+=t);return n}function m(...e){const t=e.join(" ").split(" ").filter(Boolean);return[...new Set(t)].join(" ")}function x(...e){return m(p(...e))}const f=({width:e=24,height:t=24})=>d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 24 24",children:d.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m15 6l-6 6l6 6"})}),b=({width:e=24,height:t=24})=>d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 24 24",children:d.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 6l6 6l-6 6"})}),g=({color:e="currentColor",size:t=24})=>d.jsxs("svg",{width:t,height:t,stroke:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("style",{children:"\n .spinner_V8m1{transform-origin:center;animation:spinner_zKoa 2s linear infinite}\n .spinner_V8m1 circle{stroke-linecap:round;animation:spinner_YpZS 1.5s ease-in-out infinite}\n @keyframes spinner_zKoa{100%{transform:rotate(360deg)}}\n @keyframes spinner_YpZS{\n 0%{stroke-dasharray:0 150;stroke-dashoffset:0}\n 47.5%{stroke-dasharray:42 150;stroke-dashoffset:-16}\n 95%,100%{stroke-dasharray:42 150;stroke-dashoffset:-59}\n }\n "}),d.jsx("g",{className:"spinner_V8m1",children:d.jsx("circle",{cx:"12",cy:"12",r:"9.5",fill:"none",strokeWidth:"3"})})]}),v=e=>{var t=e,{variant:r="filled",color:n="primary",size:a="md",shape:s="rectangle",startIcon:l,endIcon:h,className:u="",children:p,loading:m,disabled:f,hover:b=!0}=t,v=c(t,["variant","color","size","shape","startIcon","endIcon","className","children","loading","disabled","hover"]);const j="filled"===r?`btn-${n}`:`btn-${r}-${n}`;return d.jsx("button",o(i({className:x("btn",j,`btn-${a}`,`btn-${s}`,{"btn-loading":m,"btn-no-hover":!b},u),disabled:f||m},v),{children:m?d.jsx(g,{}):d.jsxs(d.Fragment,{children:[l&&d.jsx("span",{className:"btn-icon-start",children:l}),p,h&&d.jsx("span",{className:"btn-icon-end",children:h})]})}))},j=d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",children:d.jsx("path",{fill:"currentColor",d:"M12 14.975q-.2 0-.375-.062T11.3 14.7l-4.6-4.6q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275l3.9 3.9l3.9-3.9q.275-.275.7-.275t.7.275t.275.7t-.275.7l-4.6 4.6q-.15.15-.325.213t-.375.062"})}),y="...",w=({currentPage:e,totalPages:t,siblingCount:r=1})=>h.useMemo(()=>{if(t<=7)return Array.from({length:t},(e,t)=>t+1);const n=Math.max(e-r,1),a=Math.min(e+r,t),s=n>2,l=a<t-1;if(!s&&!l)return Array.from({length:t},(e,t)=>t+1);if(!s&&l){const e=3+2*r;return[...Array.from({length:e},(e,t)=>t+1),y,t]}if(s&&!l){const e=3+2*r;return[1,y,...Array.from({length:e},(r,n)=>t-e+n+1)]}return[1,y,...Array.from({length:a-n+1},(e,t)=>n+t),y,t]},[e,t,r]),N=e=>{var t=e,{className:r="",children:n}=t,a=c(t,["className","children"]);return d.jsx("thead",o(i({className:x("table-header",r)},a),{children:n}))},C=e=>{var t=e,{className:r="",children:n}=t,a=c(t,["className","children"]);return d.jsx("tbody",o(i({className:x("table-body",r)},a),{children:n}))},k=e=>{var t=e,{className:r="",children:n}=t,a=c(t,["className","children"]);return d.jsx("tfoot",o(i({className:x("table-footer",r)},a),{children:n}))},M=e=>{var t=e,{className:r="",selected:n=!1,children:a}=t,s=c(t,["className","selected","children"]);return d.jsx("tr",o(i({className:x("table-row",{"table-row-selected":n},r)},s),{children:a}))},T=e=>{var t=e,{className:r="",header:n=!1,align:a="left",minWidth:s,maxWidth:l,width:h,children:u,style:p}=t,m=c(t,["className","header","align","minWidth","maxWidth","width","children","style"]);const f=n?"th":"td",b=i(i(i(i({},s&&{minWidth:s}),l&&{maxWidth:l}),h&&{width:h}),p);return d.jsx(f,o(i({className:x("table-cell",`table-cell-${a}`,{"table-cell-header":n},r),style:Object.keys(b).length>0?b:p},m),{children:u}))},P=e=>{var t=e,{className:r="",variant:n="default",dense:a=!1,children:s}=t,l=c(t,["className","variant","dense","children"]);const h=d.jsx("table",o(i({className:x("table",`table-${n}`,{"table-dense":a},r)},l),{children:s}));return d.jsx("div",{className:"table-responsive",children:h})};P.Header=N,P.Body=C,P.Footer=k,P.Row=M,P.Cell=T;const E=h.createContext(void 0),O=()=>{const e=h.useContext(E);if(void 0===e)throw new Error("useMenuContext must be used within a MenuContextProvider");return e},S=({children:e,menuPosition:t="bottom-left"})=>{const[r,n]=h.useState(!1),[a,s]=h.useState({x:0,y:0}),l=h.useRef(null),i=h.useRef(null),o=h.useCallback((e,r)=>{const n=10,a=(null==r?void 0:r.width)||200,s=(null==r?void 0:r.height)||150,l=window.innerWidth,i=window.innerHeight;let o=0,c=0;switch(t){case"bottom-left":default:o=e.left,c=e.bottom+n;break;case"bottom-right":o=e.right-a,c=e.bottom+n;break;case"bottom-center":o=e.left+e.width/2-a/2,c=e.bottom+n;break;case"top-left":o=e.left,c=e.top-15-s;break;case"top-right":o=e.right-a,c=e.top-15-s;break;case"top-center":o=e.left+e.width/2-a/2,c=e.top-15-s;break;case"left-top":o=e.left-15-a,c=e.top;break;case"left-bottom":o=e.left-15-a,c=e.bottom-s;break;case"left-center":o=e.left-15-a,c=e.top+e.height/2-s/2;break;case"right-top":o=e.right+n,c=e.top;break;case"right-bottom":o=e.right+n,c=e.bottom-s;break;case"right-center":o=e.right+n,c=e.top+e.height/2-s/2}return o=Math.max(n,Math.min(o,l-a-n)),c=Math.max(n,Math.min(c,i-s-n)),{x:o,y:c}},[t]),c=h.useCallback(()=>{var e;if(!l.current)return;const t=l.current.getBoundingClientRect(),r=null==(e=i.current)?void 0:e.getBoundingClientRect();s(o(t,r))},[o]),u=()=>n(!1);return h.useEffect(()=>{if(r&&l.current){const e=()=>{var e;const t=l.current.getBoundingClientRect(),r=null==(e=i.current)?void 0:e.getBoundingClientRect();s(o(t,r))};e();const t=setTimeout(e,50);return()=>clearTimeout(t)}},[r,o]),h.useEffect(()=>{const e=e=>{i.current&&i.current.contains(e.target)||l.current&&l.current.contains(e.target)||u()};if(r)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r]),h.useEffect(()=>{const e=e=>{"Escape"===e.key&&r&&u()};if(r)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[r]),d.jsx(E.Provider,{value:{isOpen:r,position:a,menuPosition:t,triggerRef:l,contentRef:i,openMenu:()=>{l.current&&n(!0)},closeMenu:u,repositionMenu:c},children:e})},z=({children:e,className:t,style:r={}})=>{const{isOpen:n,position:a,contentRef:s,closeMenu:l}=O(),[o,c]=h.useState(!1),[u,p]=h.useState(!1);h.useEffect(()=>{if(n){p(!0);const e=setTimeout(()=>{if(c(!0),s.current){const e=s.current.querySelector('[role="menuitem"]:not([disabled])');e&&e.focus()}},10);return()=>clearTimeout(e)}c(!1);const e=setTimeout(()=>p(!1),150);return()=>clearTimeout(e)},[n,s]);return u?d.jsx("article",{ref:s,className:x("menu-content",{"menu-content--open":o},t),style:i({left:`${a.x}px`,top:`${a.y}px`,opacity:o?1:0,transition:"opacity 0.15s ease-in-out"},r),role:"menu","aria-orientation":"vertical",onKeyDown:e=>{var t,r;if(!s.current)return;const n=Array.from(s.current.querySelectorAll('[role="menuitem"]:not([disabled])')),a=n.findIndex(e=>e===document.activeElement);switch(e.key){case"ArrowDown":e.preventDefault();null==(t=n[a<n.length-1?a+1:0])||t.focus();break;case"ArrowUp":e.preventDefault();null==(r=n[a>0?a-1:n.length-1])||r.focus();break;case"Escape":e.preventDefault(),l()}},tabIndex:-1,children:h.Children.map(e,e=>h.isValidElement(e)?h.cloneElement(e,{closeMenu:l}):e)}):null},A=({children:e,onClick:t,closeMenu:r,disabled:n=!1,className:a,style:s={}})=>{const l=()=>{n||(t&&t(),r&&r())};return d.jsx("button",{onClick:l,onKeyDown:e=>{n||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),l())},disabled:n,className:x("menu-item",{"menu-item--disabled":n},a),style:s,role:"menuitem",type:"button",tabIndex:n?-1:0,"aria-disabled":n,children:e})},B=({children:e,className:t,style:r={}})=>{const{triggerRef:n,isOpen:a,openMenu:s,closeMenu:l}=O();return d.jsx("section",{ref:n,onClick:()=>{a?l():s()},className:x("menu-trigger",t),style:r,children:h.cloneElement(e,{isOpen:a})})},$=Object.assign(({children:e,className:t,style:r={},position:n="bottom-left"})=>d.jsx(S,{menuPosition:n,children:d.jsx("div",{className:x("menu-container",t),style:r,children:e})}),{Trigger:B,Content:z,Item:A});exports.Button=v,exports.ButtonSelect=({options:e,value:t,onChange:r,disabled:n=!1,multiple:a=!1})=>{const s=e=>Array.isArray(t)?t.includes(e):e===t;return d.jsx("div",{className:"button-select "+(n?"disabled":""),children:e.map(({value:e,child:l})=>d.jsx("button",{className:"button-select-option "+(s(e)?"selected":""),onClick:()=>(e=>{if(n)return;if(!a)return void r(e);const s=Array.isArray(t)?t:[],l=s.includes(e)?s.filter(t=>t!==e):[...s,e];r(l)})(e),disabled:n,type:"button",children:l},e))})},exports.ChevronLeft=f,exports.ChevronRight=b,exports.DOTS=y,exports.Input=e=>{var t=e,{variant:r="primary",type:n="text",label:a,prefix:s,suffix:l,helperText:o,className:u,labelClass:p,helperTextClass:m,onChange:f,id:b,hasError:v,loading:j=!1,disabled:y}=t,w=c(t,["variant","type","label","prefix","suffix","helperText","className","labelClass","helperTextClass","onChange","id","hasError","loading","disabled"]);const N=h.useId(),C=b||`input-${N}`,k=x("form-field",{"has-prefix":!!s,"has-suffix":!!l},{[`variant-${r}`]:r},{loading:j},u);return d.jsxs("article",{className:"input-container",children:[a&&d.jsx("label",{htmlFor:C,className:x("input-label",p),children:a}),d.jsxs("section",{className:x("input-wrapper",{loading:j}),children:[s&&d.jsx("article",{className:"input-prefix",children:s}),d.jsx("input",i({id:C,type:n,className:k,onChange:e=>null==f?void 0:f(e.target.value),disabled:y||j},w)),j?d.jsx("article",{className:"input-suffix",children:d.jsx(g,{})}):l&&d.jsx("article",{className:"input-suffix",children:l})]}),o&&d.jsx("small",{className:x("input-helper-text",m),style:{color:v?"var(--color-danger)":"inherit"},children:o})]})},exports.Menu=$,exports.MenuContent=z,exports.MenuContextProvider=S,exports.MenuItem=A,exports.MenuTrigger=B,exports.Pagination=({currentPage:e,totalPages:t,onPageChange:r,siblingCount:n=1,hidePrevButton:a=!1,hideNextButton:s=!1,size:l="md",variant:i="ghost",color:o="secondary",className:c="",disabled:h=!1,mobile:u=!1})=>{const p=w({currentPage:e,totalPages:t,siblingCount:n});if(0===e||0===t)return null;const m=()=>{e<t&&!h&&r(e+1)},g=()=>{e>1&&!h&&r(e-1)},j=p[p.length-1];return u?d.jsxs("article",{className:x("pagination","pagination--mobile",c),"aria-label":"pagination navigation",children:[!a&&d.jsx(v,{variant:i,color:o,size:l,onClick:g,disabled:1===e||h,"aria-label":"Go to previous page",shape:"square",children:d.jsx(f,{})}),d.jsxs("span",{className:"pagination__page-indicator","aria-live":"polite",children:[e," / ",t," pages"]}),!s&&d.jsx(v,{variant:i,color:o,size:l,onClick:m,disabled:e===j||h,"aria-label":"Go to next page",shape:"square",children:d.jsx(b,{})})]}):d.jsxs("article",{className:x("pagination",c),"aria-label":"pagination navigation",children:[!a&&d.jsx(v,{variant:i,color:o,size:l,onClick:g,disabled:1===e||h,"aria-label":"Go to previous page",shape:"square",children:d.jsx(f,{})}),p.map((n,a)=>n===y?d.jsx(v,{variant:i,color:o,size:l,"aria-label":"More pages",shape:"square",disabled:h,hover:!1,children:"…"},a):d.jsx(v,{variant:n===e?"filled":i,color:n===e?"primary":o,size:l,onClick:()=>!h&&r(n),disabled:h||1===t,"aria-label":n===e?`Current page, page ${n}`:`Go to page ${n}`,"aria-current":n===e?"page":void 0,shape:"square",children:n},a)),!s&&d.jsx(v,{variant:i,color:o,size:l,onClick:m,disabled:e===j||h,"aria-label":"Go to next page",shape:"square",children:d.jsx(b,{})})]})},exports.Select=e=>{var t=e,{variant:r="primary",label:n,prefix:a,suffix:s,helperText:l,className:u,labelClass:p,helperTextClass:m,onChange:f,id:b,hasError:v,loading:y=!1,disabled:w,options:N=[],placeholder:C,children:k}=t,M=c(t,["variant","label","prefix","suffix","helperText","className","labelClass","helperTextClass","onChange","id","hasError","loading","disabled","options","placeholder","children"]);const T=h.useId(),P=b||`select-${T}`,E=x("form-field",{"has-prefix":!!a,"has-suffix":!!s||!y},{[`variant-${r}`]:r},{loading:y},u);return d.jsxs("article",{className:"select-container",children:[n&&d.jsx("label",{htmlFor:P,className:x("select-label",p),children:n}),d.jsxs("section",{className:x("select-wrapper",{loading:y}),children:[a&&d.jsx("article",{className:"select-prefix",children:a}),d.jsxs("select",o(i({id:P,className:E,onChange:e=>null==f?void 0:f(e.target.value),disabled:w||y},M),{children:[C&&d.jsx("option",{value:"",disabled:!0,hidden:!0,children:C}),N.length>0?N.map(e=>d.jsx("option",{value:e.value,disabled:e.disabled,children:e.label},e.value)):k]})),y?d.jsx("article",{className:"select-suffix",children:d.jsx(g,{})}):d.jsx("article",{className:"select-suffix",children:s||j})]}),l&&d.jsx("small",{className:x("select-helper-text",m),style:{color:v?"var(--color-danger)":"inherit"},children:l})]})},exports.Spinner=g,exports.Table=P,exports.TableBody=C,exports.TableCell=T,exports.TableFooter=k,exports.TableHeader=N,exports.TableRow=M,exports.Toggle=e=>{var t=e,{color:r="var(--color-primary)",size:n="3.75rem",checked:a=!1,onChange:s,label:l,labelPosition:o="right",className:h}=t,u=c(t,["color","size","checked","onChange","label","labelPosition","className"]);return d.jsxs("label",{className:x("switch-container",o,h),children:[d.jsxs("div",{className:"toggle-switch",style:{"--switch-size":n,"--switch-color":r},children:[d.jsx("input",i({type:"checkbox",role:"switch",checked:a,onChange:e=>null==s?void 0:s(e.target.checked)},u)),d.jsx("span",{className:"slider"})]}),l&&d.jsx("span",{className:"switch-label",children:l})]})},exports.clsx=p,exports.cn=x,exports.mergeClasses=m,exports.useMenuContext=O,exports.usePagination=w;