@sito/dashboard 0.0.41 → 0.0.43

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.
@@ -1 +1 @@
1
- var ke=require("./main.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react");function W(t){const{className:n=""}=t;return e.jsx("svg",{className:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor",children:e.jsx("path",{d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})})}function q(t){const{className:n=""}=t;return e.jsx("svg",{className:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor",children:e.jsx("path",{d:"M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z"})})}function V(t){const{className:n=""}=t;return e.jsx("svg",{className:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",fill:"currentColor",children:e.jsx("path",{d:"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"})})}function J(t){const{className:n=""}=t;return e.jsx("svg",{className:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",fill:"currentColor",children:e.jsx("path",{d:"M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"})})}const G=t=>{const{className:n=""}=t;return e.jsx("svg",{className:n,viewBox:"0 0 16 16",children:e.jsx("path",{d:"M9 15H7a1 1 0 010-2h2a1 1 0 010 2zM11 11H5a1 1 0 010-2h6a1 1 0 010 2zM13 7H3a1 1 0 010-2h10a1 1 0 010 2zM15 3H1a1 1 0 010-2h14a1 1 0 010 2z"})})};function _(t){const{className:n=""}=t;return e.jsx("svg",{className:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",children:e.jsx("path",{d:"M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"})})}var L=(t=>(t.error="error",t.good="good",t.default="default",t))(L||{});const D=t=>{switch(t){case"error":return"input-error";case"good":return"input-good";default:return"input-normal"}},B=t=>{switch(t){case"error":return"input-label-error";case"good":return"input-label-good";default:return"input-label-normal"}},I=t=>{switch(t){case"error":return"input-helper-text-error";case"good":return"input-helper-text-good";default:return"input-helper-text-normal"}};const R=o.forwardRef(function(t,n){const{value:r,onChange:s,options:a,containerClassName:l="",inputClassName:c="",labelClassName:i="",helperText:u="",helperTextClassName:v="",placeholder:p="",label:m="",name:x="",id:d="",state:h=L.default,children:g,...j}=t;return e.jsxs("div",{className:`select-input-container ${l}`,children:[e.jsx("select",{...j,id:d,ref:n,name:x,value:r,onChange:s,className:`select-input ${D(h)} peer ${c}`,children:a==null?void 0:a.map(C=>e.jsx("option",{value:C.id,children:C.value??C.name??C.id},C.id))}),e.jsx("label",{htmlFor:x,className:`select-input-label ${B(h)} ${i}`,children:m}),g,e.jsx("p",{className:`select-input-helper-text ${I(h)} ${v}`,children:h!=="error"&&h!=="good"?p:u})]})});const z=o.forwardRef(function(t,n){const{children:r,value:s,onChange:a,state:l=L.default,name:c="",id:i="",type:u="text",label:v="",required:p=!1,placeholder:m="",containerClassName:x="",inputClassName:d="",labelClassName:h="",helperText:g="",helperTextClassName:j="",...C}=t;return e.jsxs("div",{className:`text-input-container ${x}`,children:[e.jsx("input",{ref:n,type:u,name:c,id:i,className:`text-input ${D(l)} peer ${d}`,placeholder:"",required:p,value:s,onChange:a,...C}),e.jsxs("label",{htmlFor:c,className:`text-input-label ${B(l)} ${h}`,children:[v,p?" *":""]}),r,e.jsx("p",{className:`text-input-helper-text ${I(l)} ${j}`,children:l!=="error"&&l!=="good"?m:g})]})});const K=o.forwardRef(function(t,n){const{checked:r,onChange:s,state:a=L.default,name:l="",id:c="",type:i="text",label:u="",containerClassName:v="",inputClassName:p="",labelClassName:m="",helperText:x="",helperTextClassName:d="",...h}=t;return e.jsxs("label",{className:`input-check-container ${v}`,children:[e.jsx("input",{id:c,ref:n,name:l,type:"checkbox",checked:r,onChange:s,className:`input-check ${p}`,...h}),e.jsx("span",{className:`input-check-label ${m}`,children:u})]})});const Q=o.forwardRef(function(t,n){const{state:r,value:s,onChange:a,options:l=[],name:c="",id:i="",label:u="",containerClassName:v="",inputContainerClassName:p="",helperText:m="",placeholder:x="",multiple:d=!1,...h}=t,[g,j]=o.useState(""),[C,f]=o.useState(!1),w=l.filter(b=>{const N=String(b.value).toLowerCase().includes(g==null?void 0:g.toLowerCase());return s&&s.length?s!=null&&s.some?!(s!=null&&s.some(A=>A.id===b.id)):(s==null?void 0:s.id)!==b.id:N}),E=o.useRef(null);o.useEffect(()=>{const b=F=>{E.current&&!E.current.contains(F.target)&&f(!1)},N=F=>{F.key==="Escape"&&f(!1)};return document.addEventListener("mousedown",b),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",N)}},[]);const M=b=>{j(b.target.value)},U=o.useCallback(b=>{j(""),b?d?Array.isArray(s)&&s.length?a([...s,b]):a([b]):a(b):a(null),f(!1)},[d,a,s]),xe=o.useCallback(b=>{const N=s.filter((F,A)=>A!==b);N.length?a(N):a(null)},[a,s]);return e.jsxs("div",{className:`autocomplete-input-container ${v}`,ref:E,children:[e.jsx(z,{state:r,name:c,id:i,value:!d&&s?s:g,onChange:M,placeholder:x,helperText:m,onFocus:()=>f(!0),label:u,containerClassName:`autocomplete-text-input ${p}`,ref:n,...h,children:!d&&s&&e.jsx("button",{type:"button",className:"autocomplete-delete-button",onClick:b=>{U(),b.stopPropagation()},children:e.jsx(_,{})})}),C&&e.jsx("ul",{className:"autocomplete-suggestions-container",children:w.map(b=>e.jsx("li",{className:"autocomplete-suggestion-item hover:bg-primary/20",onClick:N=>{U(b),N.stopPropagation()},children:b.value??b.name},b.id??b.value??b.name))}),d&&Array.isArray(s)&&s.length?e.jsx("ul",{className:"autocomplete-value-container",children:s.map((b,N)=>e.jsx("li",{children:e.jsx(me,{label:String(b.value??b.name),onDelete:F=>{xe(N),F.stopPropagation()}})},b.id??b.value??b.name))}):null]})});function X(t){const{color:n="stroke-blue-800",className:r="",loaderClass:s="",strokeWidth:a="4",...l}=t;return e.jsx("div",{...l,className:`loading ${r}`,children:e.jsx("div",{className:"loader-container",children:e.jsx("div",{className:`loader ${s}`,children:e.jsx("svg",{className:"circular",viewBox:"25 25 50 50",children:e.jsx("circle",{className:`path ${n}`,cx:"50",cy:"50",r:"20",fill:"none",strokeWidth:a,strokeMiterlimit:"10"})})})})})}const Y=o.createContext({});function be(t){const{children:n,t:r}=t;return e.jsx(Y.Provider,{value:{t:r},children:n})}const $=()=>{const t=o.useContext(Y);if(t===void 0)throw new Error("translationContext must be used within a Provider");return t};var k=(t=>(t[t.text=0]="text",t[t.number=1]="number",t[t.select=2]="select",t[t.autocomplete=3]="autocomplete",t[t.date=4]="date",t[t.check=5]="check",t))(k||{}),O=(t=>(t.ASC="ASC",t.DESC="DESC",t))(O||{});const ge=[20,50,100],Z=o.createContext({}),ve=t=>{const{children:n}=t,[r,s]=o.useState(0),[a,l]=o.useState(20),[c,i]=o.useState(0),[u,v]=o.useState("id"),[p,m]=o.useState(O.DESC),[x,d]=o.useState({}),h=o.useCallback((C,f)=>{let w=p;if(u===C)switch(p){case O.ASC:w=O.DESC;break;default:w=O.ASC;break}v(C),m(w),f&&f(C,w)},[u,p]),g=o.useCallback(C=>{const f=Object.entries(C).reduce((w,[E,M])=>(M&&typeof M.value<"u"&&(w[E]=M.value),w),{});d(f)},[]),j={onSort:h,total:r,setTotal:s,sortingBy:u,setSortingBy:v,sortingOrder:p,setSortingOrder:m,pageSize:a,pageSizes:ge,setPageSize:l,currentPage:c,setCurrentPage:i,filters:x,onFilterApply:g};return e.jsx(Z.Provider,{value:j,children:n})},P=()=>{const t=o.useContext(Z);if(t===void 0)throw new Error("tableOptionsContext must be used within a Provider");return t};var y=(t=>(t[t.update=0]="update",t[t.reset=1]="reset",t))(y||{});const ee=t=>{if(t){const n={},r=Object.keys(t);return r==null||r.forEach(s=>{n[s]={value:t[s]}}),n}return{}};function te(t,n){const{type:r}=n;switch(r){case y.reset:{const{filters:s}=n,a={};return s==null||s.forEach(({propertyName:l,defaultValue:c})=>{a[l]={value:c}}),{...t,...a}}case y.update:{const{toUpdate:s}=n;return{...t,...s}}default:return t}}const se=o.createContext({}),ne=t=>{const{children:n}=t,{filters:r}=P(),[s,a]=o.useReducer(te,ee(r)),l={currentFilters:s,setCurrentFilters:a};return e.jsx(se.Provider,{value:l,children:n})},T=()=>{const t=o.useContext(se);if(t===void 0)throw new Error("tableOptionsContext must be used within a Provider");return t};function ae(t){const{t:n}=$(),{entity:r="",columns:s=[],hasAction:a=!0,onSortCallback:l}=t,{onSort:c,sortingOrder:i,sortingBy:u}=P(),v=o.useMemo(()=>{var p;return(p=s.sort((m,x)=>(x.pos??0)-(m.pos??0)).filter(m=>m.display!=="none"))==null?void 0:p.map(m=>({id:m.key,label:m.label,className:m.className??"",sortable:m.sortable??!0,sortOptions:m.sortOptions}))},[s,r,n]);return e.jsx("thead",{className:"table-headers-row",children:e.jsxs("tr",{children:[v.map(p=>{var m,x,d,h,g,j,C,f;return e.jsx("th",{scope:"col",className:`table-headers-column ${p.className}`,children:e.jsxs("button",{disabled:!p.sortable,onClick:()=>c(p.id,l),className:"table-headers-cell",children:[e.jsx("span",{className:"table-headers-label",children:p.label}),p.sortable&&e.jsx("span",{className:`${u===p.id?"table-headers-sort-on":"table-headers-sort"}`,children:i===O.ASC?((x=(m=p.sortOptions)==null?void 0:m.icons)==null?void 0:x.asc)??e.jsx(q,{className:((h=(d=p.sortOptions)==null?void 0:d.icons)==null?void 0:h.className)??"table-headers-sort-indicator"}):((j=(g=p.sortOptions)==null?void 0:g.icons)==null?void 0:j.desc)??e.jsx(W,{className:((f=(C=p.sortOptions)==null?void 0:C.icons)==null?void 0:f.className)??"table-headers-sort-indicator"})})]})},p.id)}),a&&e.jsx("th",{scope:"col",className:"table-headers-action",children:n("_accessibility:labels.actions")})]})})}function re(){const{t}=$();return e.jsx("div",{className:"table-empty",children:e.jsx("p",{children:t("_accessibility:components.table.empty")})})}const le=()=>{const{t}=$(),{total:n,pageSize:r,currentPage:s,setCurrentPage:a}=P();return e.jsxs("div",{className:"table-navigation-pages",children:[e.jsx("button",{className:"table-navigation-buttons",disabled:s===0,"aria-label":t("_accessibility:buttons.previous"),name:t("_accessibility:buttons.previous"),onClick:()=>a(s-1),children:e.jsx(J,{className:"w-2.5"})}),e.jsx("button",{disabled:Math.floor(n/((s+1)*r))===0,className:"table-navigation-buttons",name:t("_accessibility:buttons.next"),"aria-label":t("_accessibility:buttons.next"),onClick:()=>a(s+1),children:e.jsx(V,{className:"w-2.5"})})]})},oe=()=>{const{t}=$(),{total:n,pageSize:r,pageSizes:s,currentPage:a}=P(),l=(a+1)*r>n?n:(a+1)*r;return e.jsxs("div",{className:"table-navigation-sizes",children:[s[0]<n&&e.jsx(e.Fragment,{children:e.jsxs("p",{children:[a*r+1," - ",l," ",t("_accessibility:components.table.of")]})}),e.jsx("p",{children:n})]})};function ce(){const{t}=$(),{pageSizes:n,pageSize:r,setPageSize:s}=P(),a=o.useMemo(()=>n==null?void 0:n.map(l=>({id:l,value:l})),[n]);return e.jsxs("div",{className:"page-size",children:[e.jsx("p",{children:t("_accessibility:components.table.pageSizes")}),e.jsx(R,{value:r,options:a,inputClassName:"page-size-input",containerClassName:"page-size-input-container",helperTextClassName:"hidden",onChange:l=>s(Number(l.target.value))})]})}function Ce(){const{t}=$(),{total:n,pageSize:r,currentPage:s,setCurrentPage:a}=P(),l=o.useMemo(()=>{const c=Math.ceil(n/r);return Array.from({length:c},(i,u)=>({id:u,value:u+1}))},[n,r]);return e.jsxs("div",{className:"jump-to-page",children:[e.jsx("p",{children:t("_accessibility:components.table.jumpToPage")}),e.jsx(R,{value:s,options:l,inputClassName:"jump-to-page-input",containerClassName:"jump-to-page-input-container",helperTextClassName:"hidden",onChange:c=>a(Number(c.target.value))})]})}function ie(){return e.jsxs("div",{className:"table-footer",children:[e.jsx(Ce,{}),e.jsx(ce,{}),e.jsx(oe,{}),e.jsx(le,{})]})}function je(t){const{propertyName:n,options:r,label:s}=t,{currentFilters:a,setCurrentFilters:l}=T(),c=o.useMemo(()=>{var u;return((u=a[n])==null?void 0:u.value)??r[0]},[a]),i=o.useCallback(u=>{l({type:y.update,toUpdate:{[n]:{value:u.target.value}}})},[]);return e.jsx(R,{value:c,label:s,options:r,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:i})}const fe=t=>{const{propertyName:n,label:r}=t,{currentFilters:s,setCurrentFilters:a}=T(),l=o.useMemo(()=>{var i;return((i=s[n])==null?void 0:i.value)??""},[s]),c=o.useCallback(i=>{a({type:y.update,toUpdate:{[n]:{value:i.target.value}}})},[]);return e.jsx(z,{value:l??"",label:r,onChange:c,containerClassName:"input-widget-container",helperTextClassName:""})},Ne=t=>{const{propertyName:n,label:r}=t,{currentFilters:s,setCurrentFilters:a}=T(),l=o.useMemo(()=>{var i;return((i=s[n])==null?void 0:i.value)??""},[s]),c=o.useCallback(i=>{a({type:y.update,toUpdate:{[n]:{value:i.target.checked}}})},[]);return e.jsx(K,{label:r,checked:l??!1,onChange:c})};function ye(t){const{propertyName:n,label:r,options:s,multiple:a=!0}=t,{currentFilters:l,setCurrentFilters:c}=T(),i=o.useMemo(()=>l[n]??s[0],[l]),u=o.useCallback(v=>{c({type:y.update,toUpdate:{[n]:{value:v}}})},[a]);return e.jsx(Q,{value:i==null?void 0:i.value,label:r,options:s,multiple:a,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:u})}const H=t=>{const{propertyName:n,label:r,inputType:s}=t,{currentFilters:a,setCurrentFilters:l}=T(),c=o.useRef(null),i=o.useRef(null),u=o.useMemo(()=>{var d,h,g;const x=(h=(d=a[n])==null?void 0:d.value)==null?void 0:h.start;return x?s==="date"?new Date(String(x)).toISOString().slice(0,10):(g=a[n])==null?void 0:g.value:""},[a]),v=o.useMemo(()=>{var d,h,g;const x=(h=(d=a[n])==null?void 0:d.value)==null?void 0:h.end;return x?s==="date"?new Date(String(x)).toISOString().slice(0,10):(g=a[n])==null?void 0:g.value:""},[a]),p=o.useCallback(x=>{var d;l({type:y.update,toUpdate:{[n]:{value:{end:((d=i==null?void 0:i.current)==null?void 0:d.value)??null,start:x.target.value}}}})},[]),m=o.useCallback(x=>{var d;l({type:y.update,toUpdate:{[n]:{value:{start:((d=c==null?void 0:c.current)==null?void 0:d.value)??null,end:x.target.value}}}})},[]);return e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(z,{value:u??"",label:r,type:s,ref:c,onChange:p,containerClassName:"input-widget-container",helperTextClassName:""}),e.jsx(z,{value:v??"",label:r,type:s,ref:i,onChange:m,containerClassName:"input-widget-container",helperTextClassName:""})]})},ue=t=>{switch(t.type){case k.text:return e.jsx(fe,{...t});case k.number:return e.jsx(H,{...t});case k.date:return e.jsx(H,{...t});case k.select:return e.jsx(je,{...t});case k.autocomplete:return e.jsx(ye,{...t});case k.check:return e.jsx(Ne,{...t})}return e.jsx(e.Fragment,{})};const de=t=>{const{align:n="right",filters:r=[],icon:s}=t,[a,l]=o.useState(!1),{onFilterApply:c,filters:i}=P(),{currentFilters:u,setCurrentFilters:v}=T(),{t:p}=$(),m=o.useRef(null),x=o.useRef(null);return o.useEffect(()=>{const d=({target:h})=>{var g,j;x.current&&(!a||(g=x.current)!=null&&g.contains(h)||(j=m==null?void 0:m.current)!=null&&j.contains(h)||l(!1))};return document.addEventListener("click",d),()=>document.removeEventListener("click",d)}),o.useEffect(()=>{const d=h=>{!a||h.code!=="Escape"||l(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)}),e.jsxs("div",{className:"filter-dropdown-main",children:[e.jsxs("button",{ref:m,className:"filter-dropdown-button normal filter-dropdown-trigger","aria-haspopup":"true",onClick:()=>l(!a),"aria-expanded":a,children:[e.jsx("span",{className:"sr-only",children:p("_accessibility:buttons.filters")}),e.jsx("wbr",{}),s??e.jsx(G,{className:"filter-dropdown-trigger-icon"})]}),e.jsx("div",{className:`filter-dropdown-transition ${a?"opened":"closed"} ${n==="right"?"right":"left"}`,children:e.jsxs("div",{ref:x,children:[e.jsx("div",{className:"filter-title",children:p("_accessibility:buttons.filters")}),e.jsx("ul",{className:"filter-container",children:r.map(d=>e.jsx("li",{className:"filter-container-item",children:ue(d)},d.propertyName))}),e.jsx("div",{className:"filter-footer",children:e.jsxs("ul",{className:"filter-buttons-row",children:[e.jsx("li",{children:e.jsx("button",{onClick:()=>v({type:y.reset,filters:r}),className:"filter-dropdown-button small filter-dropdown-cancel",children:p("_accessibility:buttons.clear")})}),e.jsx("li",{children:e.jsx("button",{className:"filter-dropdown-button small filter-dropdown-submit bg-primary hover:bg-light-primary",onClick:()=>{l(!1),c(u)},onBlur:()=>l(!1),children:p("_accessibility:buttons.applyFilters")})})]})})]})})]})},we=t=>t,pe=t=>{const{columns:n,softDeleteProperty:r="deleted",data:s,actions:a}=t,l=o.useMemo(()=>n.sort((c,i)=>(i.pos??0)-(c.pos??0)).filter(c=>c.display!=="none"),[n]);return s==null?void 0:s.map(c=>{var i;return e.jsxs("tr",{className:`table-row ${c[r]?"deleted-class":""}`,children:[l==null?void 0:l.map((u,v)=>e.jsx("td",{className:`table-row-cell ${v===0?"basic":""} ${u.className??""}`,children:u.renderBody?u.renderBody(c[u.key],c):we(c[u.key])},u.key)),a?e.jsx("td",{children:e.jsx("div",{className:"table-row-cell-action",children:(i=a(c).filter(u=>!u.hidden))==null?void 0:i.map(u=>e.jsx(he,{content:u.tooltip,children:e.jsx("button",{onClick:()=>u.onClick(c),children:u.icon})},u.id))})}):null]},c.id)})};function Se(t){const{title:n="",data:r,onSort:s,entity:a="",isLoading:l=!1,actions:c,columns:i=[],contentClassName:u="",className:v="",toolbar:p=e.jsx(e.Fragment,{}),softDeleteProperty:m="deleted"}=t,x=o.useMemo(()=>i?i.sort((h,g)=>(g.pos??0)-(h.pos??0)).filter(h=>!!h.filterOptions).map(h=>{var g;return{...h.filterOptions,label:((g=h.filterOptions)==null?void 0:g.label)??h.label,propertyName:h.key}}):[],[i]),d=o.useMemo(()=>!(r!=null&&r.length),[r]);return e.jsx(ne,{children:e.jsxs("div",{className:`${v} table-main`,children:[e.jsxs("div",{className:"table-header",children:[e.jsx("h1",{className:"table-header-title",children:n}),l?null:e.jsxs("div",{className:"table-header-right",children:[p,!!x&&!!x.length&&e.jsx(de,{filters:x})]})]}),l?e.jsx(X,{className:"table-loading"}):e.jsx(e.Fragment,{children:d?e.jsx(re,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`${u} table-body`,children:e.jsxs("table",{className:"table-content",children:[e.jsx(ae,{entity:a,columns:i,onSortCallback:s,hasAction:!!c}),e.jsx("tbody",{children:e.jsx(pe,{data:r,actions:c,columns:i,softDeleteProperty:m})})]})}),e.jsx(ie,{})]})})]})})}function he(t){const{content:n,children:r}=t;return e.jsxs("div",{className:"tooltip-container",children:[r,e.jsx("div",{className:"tooltip-text",children:n})]})}var S=(t=>(t.empty="empty",t.outlined="outlined",t.default="default",t))(S||{});function me(t){const{label:n,onDelete:r,className:s="",spanClassName:a="",variant:l=S.default}=t,c=o.useMemo(()=>{switch(l){case S.empty:return"text-primary bg-transparent";case S.outlined:return"border border-primary";case S.default:default:return"text-white bg-primary"}},[l]),i=o.useMemo(()=>{switch(l){case S.empty:case S.outlined:return"chip-delete-button-svg";case S.default:default:return"filled-chip-delete-button-svg"}},[l]);return e.jsxs("div",{className:`chip-main ${c} ${s}`,children:[e.jsx("span",{className:a,children:n}),r?e.jsx("button",{type:"button",className:"chip-delete-button",onClick:r,children:e.jsx(_,{className:i})}):null]})}exports.AutocompleteInput=Q;exports.CheckInput=K;exports.ChevronDown=W;exports.ChevronLeft=J;exports.ChevronRight=V;exports.ChevronUp=q;exports.Chip=me;exports.ChipVariant=S;exports.Close=_;exports.Columns=ae;exports.CountOfTotal=oe;exports.Empty=re;exports.FilterPopup=de;exports.FilterTypes=k;exports.Filters=G;exports.FiltersActions=y;exports.FiltersProvider=ne;exports.Footer=ie;exports.Loading=X;exports.Navigation=le;exports.PageSize=ce;exports.Rows=pe;exports.SelectInput=R;exports.SortOrder=O;exports.State=L;exports.Table=Se;exports.TableOptionsProvider=ve;exports.TextInput=z;exports.Tooltip=he;exports.TranslationProvider=be;exports.filtersReducer=te;exports.helperTextStateClassName=I;exports.initializer=ee;exports.inputStateClassName=D;exports.labelStateClassName=B;exports.renderFilterComponent=ue;exports.useFilters=T;exports.useTableOptions=P;exports.useTranslation=$;
1
+ var ke=require("./main.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react");function W(t){const{className:n=""}=t;return e.jsx("svg",{className:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor",children:e.jsx("path",{d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})})}function q(t){const{className:n=""}=t;return e.jsx("svg",{className:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor",children:e.jsx("path",{d:"M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z"})})}function J(t){const{className:n=""}=t;return e.jsx("svg",{className:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",fill:"currentColor",children:e.jsx("path",{d:"M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"})})}function V(t){const{className:n=""}=t;return e.jsx("svg",{className:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",fill:"currentColor",children:e.jsx("path",{d:"M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"})})}const G=t=>{const{className:n=""}=t;return e.jsx("svg",{className:n,viewBox:"0 0 16 16",children:e.jsx("path",{d:"M9 15H7a1 1 0 010-2h2a1 1 0 010 2zM11 11H5a1 1 0 010-2h6a1 1 0 010 2zM13 7H3a1 1 0 010-2h10a1 1 0 010 2zM15 3H1a1 1 0 010-2h14a1 1 0 010 2z"})})};function A(t){const{className:n=""}=t;return e.jsx("svg",{className:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",children:e.jsx("path",{d:"M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"})})}var L=(t=>(t.error="error",t.good="good",t.default="default",t))(L||{});const B=t=>{switch(t){case"error":return"input-error";case"good":return"input-good";default:return"input-normal"}},D=t=>{switch(t){case"error":return"input-label-error";case"good":return"input-label-good";default:return"input-label-normal"}},I=t=>{switch(t){case"error":return"input-helper-text-error";case"good":return"input-helper-text-good";default:return"input-helper-text-normal"}};const R=o.forwardRef(function(t,n){const{value:r,onChange:s,options:a,containerClassName:l="",inputClassName:c="",labelClassName:u="",helperText:i="",helperTextClassName:g="",placeholder:d="",label:p="",name:b="",id:x="",state:h=L.default,children:v,...j}=t;return e.jsxs("div",{className:`select-input-container ${l}`,children:[e.jsx("select",{...j,id:x,ref:n,name:b,value:r,onChange:s,className:`select-input ${B(h)} peer ${c}`,children:a==null?void 0:a.map(C=>e.jsx("option",{value:C.id,children:C.value??C.name??C.id},C.id))}),e.jsx("label",{htmlFor:b,className:`select-input-label ${D(h)} ${u}`,children:p}),v,e.jsx("p",{className:`select-input-helper-text ${I(h)} ${g}`,children:h!=="error"&&h!=="good"?d:i})]})});const M=o.forwardRef(function(t,n){const{children:r,state:s=L.default,label:a="",containerClassName:l="",inputClassName:c="",labelClassName:u="",helperText:i="",helperTextClassName:g="",value:d="",...p}=t;return e.jsxs("div",{className:`text-input-container ${l}`,children:[e.jsx("input",{ref:n,value:d,className:`text-input ${B(s)} peer ${c} ${d?"has-value":""} ${p.placeholder?"has-placeholder":""}`,...p}),!!a&&e.jsxs("label",{htmlFor:p.name,className:`text-input-label ${D(s)} ${u}`,children:[a,p.required?" *":""]}),r,!!i&&e.jsx("p",{className:`text-input-helper-text ${I(s)} ${g}`,children:i})]})});const K=o.forwardRef(function(t,n){const{checked:r,onChange:s,state:a=L.default,name:l="",id:c="",type:u="text",label:i="",containerClassName:g="",inputClassName:d="",labelClassName:p="",helperText:b="",helperTextClassName:x="",...h}=t;return e.jsxs("label",{className:`input-check-container ${g}`,children:[e.jsx("input",{id:c,ref:n,name:l,type:"checkbox",checked:r,onChange:s,className:`input-check ${d}`,...h}),e.jsx("span",{className:`input-check-label ${p}`,children:i})]})});const Q=o.forwardRef(function(t,n){const{state:r,value:s,onChange:a,options:l=[],name:c="",id:u="",label:i="",containerClassName:g="",inputContainerClassName:d="",helperText:p="",placeholder:b="",multiple:x=!1,...h}=t,[v,j]=o.useState(""),[C,f]=o.useState(!1),w=l.filter(m=>{const N=String(m.value).toLowerCase().includes(v==null?void 0:v.toLowerCase());return s&&s.length?s!=null&&s.some?!(s!=null&&s.some(_=>_.id===m.id)):(s==null?void 0:s.id)!==m.id:N}),E=o.useRef(null);o.useEffect(()=>{const m=T=>{E.current&&!E.current.contains(T.target)&&f(!1)},N=T=>{T.key==="Escape"&&f(!1)};return document.addEventListener("mousedown",m),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",N)}},[]);const z=m=>{j(m.target.value)},U=o.useCallback(m=>{j(""),m?x?Array.isArray(s)&&s.length?a([...s,m]):a([m]):a(m):a(null),f(!1)},[x,a,s]),xe=o.useCallback(m=>{const N=s.filter((T,_)=>_!==m);N.length?a(N):a(null)},[a,s]);return e.jsxs("div",{className:`autocomplete-input-container ${g}`,ref:E,children:[e.jsx(M,{state:r,name:c,id:u,value:!x&&s?s.value??s.name:v,onChange:z,placeholder:b,helperText:p,onFocus:()=>f(!0),label:i,containerClassName:`autocomplete-text-input ${d}`,ref:n,...h,children:!x&&s&&e.jsx("button",{type:"button",className:"autocomplete-delete-button",onClick:m=>{U(),m.stopPropagation()},children:e.jsx(A,{})})}),C&&e.jsx("ul",{className:"autocomplete-suggestions-container",children:w.map(m=>e.jsx("li",{className:"autocomplete-suggestion-item hover:bg-primary/20",onClick:N=>{U(m),N.stopPropagation()},children:m.value??m.name},m.id??m.value??m.name))}),x&&Array.isArray(s)&&s.length?e.jsx("ul",{className:"autocomplete-value-container",children:s.map((m,N)=>e.jsx("li",{children:e.jsx(me,{label:String(m.value??m.name),onDelete:T=>{xe(N),T.stopPropagation()}})},m.id??m.value??m.name))}):null]})});function X(t){const{color:n="stroke-blue-800",className:r="",loaderClass:s="",strokeWidth:a="4",...l}=t;return e.jsx("div",{...l,className:`loading ${r}`,children:e.jsx("div",{className:"loader-container",children:e.jsx("div",{className:`loader ${s}`,children:e.jsx("svg",{className:"circular",viewBox:"25 25 50 50",children:e.jsx("circle",{className:`path ${n}`,cx:"50",cy:"50",r:"20",fill:"none",strokeWidth:a,strokeMiterlimit:"10"})})})})})}const Y=o.createContext({});function be(t){const{children:n,t:r}=t;return e.jsx(Y.Provider,{value:{t:r},children:n})}const k=()=>{const t=o.useContext(Y);if(t===void 0)throw new Error("translationContext must be used within a Provider");return t};var $=(t=>(t[t.text=0]="text",t[t.number=1]="number",t[t.select=2]="select",t[t.autocomplete=3]="autocomplete",t[t.date=4]="date",t[t.check=5]="check",t))($||{}),F=(t=>(t.ASC="ASC",t.DESC="DESC",t))(F||{});const ve=[20,50,100],Z=o.createContext({}),ge=t=>{const{children:n}=t,[r,s]=o.useState(0),[a,l]=o.useState(20),[c,u]=o.useState(0),[i,g]=o.useState("id"),[d,p]=o.useState(F.DESC),[b,x]=o.useState({}),h=o.useCallback((C,f)=>{let w=d;if(i===C)switch(d){case F.ASC:w=F.DESC;break;default:w=F.ASC;break}g(C),p(w),f&&f(C,w)},[i,d]),v=o.useCallback(C=>{const f=Object.entries(C).reduce((w,[E,z])=>(z&&typeof z.value<"u"&&(w[E]=z.value),w),{});x(f)},[]),j={onSort:h,total:r,setTotal:s,sortingBy:i,setSortingBy:g,sortingOrder:d,setSortingOrder:p,pageSize:a,pageSizes:ve,setPageSize:l,currentPage:c,setCurrentPage:u,filters:b,onFilterApply:v};return e.jsx(Z.Provider,{value:j,children:n})},P=()=>{const t=o.useContext(Z);if(t===void 0)throw new Error("tableOptionsContext must be used within a Provider");return t};var y=(t=>(t[t.update=0]="update",t[t.reset=1]="reset",t))(y||{});const ee=t=>{if(t){const n={},r=Object.keys(t);return r==null||r.forEach(s=>{n[s]={value:t[s]}}),n}return{}};function te(t,n){const{type:r}=n;switch(r){case y.reset:{const{filters:s}=n,a={};return s==null||s.forEach(({propertyName:l,defaultValue:c})=>{a[l]={value:c}}),{...t,...a}}case y.update:{const{toUpdate:s}=n;return{...t,...s}}default:return t}}const se=o.createContext({}),ne=t=>{const{children:n}=t,{filters:r}=P(),[s,a]=o.useReducer(te,ee(r)),l={currentFilters:s,setCurrentFilters:a};return e.jsx(se.Provider,{value:l,children:n})},O=()=>{const t=o.useContext(se);if(t===void 0)throw new Error("tableOptionsContext must be used within a Provider");return t};function ae(t){const{t:n}=k(),{entity:r="",columns:s=[],hasAction:a=!0,onSortCallback:l}=t,{onSort:c,sortingOrder:u,sortingBy:i}=P(),g=o.useMemo(()=>{var d;return(d=s.sort((p,b)=>(b.pos??0)-(p.pos??0)).filter(p=>p.display!=="none"))==null?void 0:d.map(p=>({id:p.key,label:p.label,className:p.className??"",sortable:p.sortable??!0,sortOptions:p.sortOptions}))},[s,r,n]);return e.jsx("thead",{className:"table-headers-row",children:e.jsxs("tr",{children:[g.map(d=>{var p,b,x,h,v,j,C,f;return e.jsx("th",{scope:"col",className:`table-headers-column ${d.className}`,children:e.jsxs("button",{disabled:!d.sortable,onClick:()=>c(d.id,l),className:"table-headers-cell",children:[e.jsx("span",{className:"table-headers-label",children:d.label}),d.sortable&&e.jsx("span",{className:`${i===d.id?"table-headers-sort-on":"table-headers-sort"}`,children:u===F.ASC?((b=(p=d.sortOptions)==null?void 0:p.icons)==null?void 0:b.asc)??e.jsx(q,{className:((h=(x=d.sortOptions)==null?void 0:x.icons)==null?void 0:h.className)??"table-headers-sort-indicator"}):((j=(v=d.sortOptions)==null?void 0:v.icons)==null?void 0:j.desc)??e.jsx(W,{className:((f=(C=d.sortOptions)==null?void 0:C.icons)==null?void 0:f.className)??"table-headers-sort-indicator"})})]})},d.id)}),a&&e.jsx("th",{scope:"col",className:"table-headers-action",children:n("_accessibility:labels.actions")})]})})}function re(){const{t}=k();return e.jsx("div",{className:"table-empty",children:e.jsx("p",{children:t("_accessibility:components.table.empty")})})}const le=()=>{const{t}=k(),{total:n,pageSize:r,currentPage:s,setCurrentPage:a}=P();return e.jsxs("div",{className:"table-navigation-pages",children:[e.jsx("button",{className:"table-navigation-buttons",disabled:s===0,"aria-label":t("_accessibility:buttons.previous"),name:t("_accessibility:buttons.previous"),onClick:()=>a(s-1),children:e.jsx(V,{className:"w-2.5"})}),e.jsx("button",{disabled:Math.floor(n/((s+1)*r))===0,className:"table-navigation-buttons",name:t("_accessibility:buttons.next"),"aria-label":t("_accessibility:buttons.next"),onClick:()=>a(s+1),children:e.jsx(J,{className:"w-2.5"})})]})},oe=()=>{const{t}=k(),{total:n,pageSize:r,pageSizes:s,currentPage:a}=P(),l=(a+1)*r>n?n:(a+1)*r;return e.jsxs("div",{className:"table-navigation-sizes",children:[s[0]<n&&e.jsx(e.Fragment,{children:e.jsxs("p",{children:[a*r+1," - ",l," ",t("_accessibility:components.table.of")]})}),e.jsx("p",{children:n})]})};function ce(){const{t}=k(),{pageSizes:n,pageSize:r,setPageSize:s}=P(),a=o.useMemo(()=>n==null?void 0:n.map(l=>({id:l,value:l})),[n]);return e.jsxs("div",{className:"page-size",children:[e.jsx("p",{children:t("_accessibility:components.table.pageSizes")}),e.jsx(R,{value:r,options:a,inputClassName:"page-size-input",containerClassName:"page-size-input-container",helperTextClassName:"hidden",onChange:l=>s(Number(l.target.value))})]})}function je(){const{t}=k(),{total:n,pageSize:r,currentPage:s,setCurrentPage:a}=P(),l=o.useMemo(()=>{const c=Math.ceil(n/r);return Array.from({length:c},(u,i)=>({id:i,value:i+1}))},[n,r]);return e.jsxs("div",{className:"jump-to-page",children:[e.jsx("p",{children:t("_accessibility:components.table.jumpToPage")}),e.jsx(R,{value:s,options:l,inputClassName:"jump-to-page-input",containerClassName:"jump-to-page-input-container",helperTextClassName:"hidden",onChange:c=>a(Number(c.target.value))})]})}function ie(){return e.jsxs("div",{className:"table-footer",children:[e.jsx(je,{}),e.jsx(ce,{}),e.jsx(oe,{}),e.jsx(le,{})]})}function Ce(t){const{propertyName:n,options:r,label:s}=t,{currentFilters:a,setCurrentFilters:l}=O(),c=o.useMemo(()=>{var i;return((i=a[n])==null?void 0:i.value)??r[0]},[a]),u=o.useCallback(i=>{l({type:y.update,toUpdate:{[n]:{value:i.target.value}}})},[]);return e.jsx(R,{value:c,label:s,options:r,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:u})}const fe=t=>{const{propertyName:n,label:r}=t,{currentFilters:s,setCurrentFilters:a}=O(),l=o.useMemo(()=>{var u;return((u=s[n])==null?void 0:u.value)??""},[s]),c=o.useCallback(u=>{a({type:y.update,toUpdate:{[n]:{value:u.target.value}}})},[]);return e.jsx(M,{value:l??"",label:r,onChange:c,containerClassName:"input-widget-container",helperTextClassName:""})},Ne=t=>{const{propertyName:n,label:r}=t,{currentFilters:s,setCurrentFilters:a}=O(),l=o.useMemo(()=>{var u;return((u=s[n])==null?void 0:u.value)??""},[s]),c=o.useCallback(u=>{a({type:y.update,toUpdate:{[n]:{value:u.target.checked}}})},[]);return e.jsx(K,{label:r,checked:l??!1,onChange:c})};function ye(t){const{propertyName:n,label:r,options:s,multiple:a=!0}=t,{currentFilters:l,setCurrentFilters:c}=O(),u=o.useMemo(()=>l[n]??s[0],[l]),i=o.useCallback(g=>{c({type:y.update,toUpdate:{[n]:{value:g}}})},[a]);return e.jsx(Q,{value:u==null?void 0:u.value,label:r,options:s,multiple:a,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:i})}const H=t=>{var p,b,x,h;const{propertyName:n,label:r,inputType:s}=t,{t:a}=k(),{currentFilters:l,setCurrentFilters:c}=O(),u=o.useRef(null),i=o.useRef(null),g=o.useCallback(v=>{var j;c({type:y.update,toUpdate:{[n]:{value:{end:((j=i==null?void 0:i.current)==null?void 0:j.value)??null,start:v.target.value}}}})},[]),d=o.useCallback(v=>{var j;c({type:y.update,toUpdate:{[n]:{value:{start:((j=u==null?void 0:u.current)==null?void 0:j.value)??null,end:v.target.value}}}})},[]);return e.jsxs("div",{className:"relative",children:[e.jsx("p",{className:"text-input-label input-widget-label input-label-normal",children:r}),e.jsxs("div",{className:"range-widget-row",children:[e.jsx(M,{value:((b=(p=l[n])==null?void 0:p.value)==null?void 0:b.start)??"",placeholder:a("_accessibility:components.table.filters.range.start"),type:s,ref:u,onChange:g,containerClassName:"input-widget-container",helperTextClassName:""}),e.jsx(M,{value:((h=(x=l[n])==null?void 0:x.value)==null?void 0:h.end)??"",placeholder:a("_accessibility:components.table.filters.range.end"),type:s,ref:i,onChange:d,containerClassName:"input-widget-container",helperTextClassName:""})]})]})},ue=t=>{switch(t.type){case $.text:return e.jsx(fe,{...t});case $.number:return e.jsx(H,{...t,inputType:"number"});case $.date:return e.jsx(H,{...t,inputType:"date"});case $.select:return e.jsx(Ce,{...t});case $.autocomplete:return e.jsx(ye,{...t});case $.check:return e.jsx(Ne,{...t})}return e.jsx(e.Fragment,{})};const de=t=>{const{align:n="right",filters:r=[],icon:s}=t,[a,l]=o.useState(!1),{onFilterApply:c,filters:u}=P(),{currentFilters:i,setCurrentFilters:g}=O(),{t:d}=k(),p=o.useRef(null),b=o.useRef(null);return o.useEffect(()=>{const x=({target:h})=>{var v,j;b.current&&(!a||(v=b.current)!=null&&v.contains(h)||(j=p==null?void 0:p.current)!=null&&j.contains(h)||l(!1))};return document.addEventListener("click",x),()=>document.removeEventListener("click",x)}),o.useEffect(()=>{const x=h=>{!a||h.code!=="Escape"||l(!1)};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)}),e.jsxs("div",{className:"filter-dropdown-main",children:[e.jsxs("button",{ref:p,className:"filter-dropdown-button normal filter-dropdown-trigger","aria-haspopup":"true",onClick:()=>l(!a),"aria-expanded":a,children:[e.jsx("span",{className:"sr-only",children:d("_accessibility:buttons.filters")}),e.jsx("wbr",{}),s??e.jsx(G,{className:"filter-dropdown-trigger-icon"})]}),e.jsx("div",{className:`filter-dropdown-transition ${a?"opened":"closed"} ${n==="right"?"right":"left"}`,children:e.jsxs("div",{ref:b,children:[e.jsx("div",{className:"filter-title",children:d("_accessibility:buttons.filters")}),e.jsx("ul",{className:"filter-container",children:r.map(x=>e.jsx("li",{className:"filter-container-item",children:ue(x)},x.propertyName))}),e.jsx("div",{className:"filter-footer",children:e.jsxs("ul",{className:"filter-buttons-row",children:[e.jsx("li",{children:e.jsx("button",{onClick:()=>g({type:y.reset,filters:r}),className:"filter-dropdown-button small filter-dropdown-cancel",children:d("_accessibility:buttons.clear")})}),e.jsx("li",{children:e.jsx("button",{className:"filter-dropdown-button small filter-dropdown-submit bg-primary hover:bg-light-primary",onClick:()=>{l(!1),c(i)},onBlur:()=>l(!1),children:d("_accessibility:buttons.applyFilters")})})]})})]})})]})},we=t=>t,pe=t=>{const{columns:n,softDeleteProperty:r="deleted",data:s,actions:a}=t,l=o.useMemo(()=>n.sort((c,u)=>(u.pos??0)-(c.pos??0)).filter(c=>c.display!=="none"),[n]);return s==null?void 0:s.map(c=>{var u;return e.jsxs("tr",{className:`table-row ${c[r]?"deleted-class":""}`,children:[l==null?void 0:l.map((i,g)=>e.jsx("td",{className:`table-row-cell ${g===0?"basic":""} ${i.className??""}`,children:i.renderBody?i.renderBody(c[i.key],c):we(c[i.key])},i.key)),a?e.jsx("td",{children:e.jsx("div",{className:"table-row-cell-action",children:(u=a(c).filter(i=>!i.hidden))==null?void 0:u.map(i=>e.jsx(he,{content:i.tooltip,children:e.jsx("button",{onClick:()=>i.onClick(c),children:i.icon})},i.id))})}):null]},c.id)})};function Se(t){const{title:n="",data:r,onSort:s,entity:a="",isLoading:l=!1,actions:c,columns:u=[],contentClassName:i="",className:g="",toolbar:d=e.jsx(e.Fragment,{}),softDeleteProperty:p="deleted"}=t,b=o.useMemo(()=>u?u.sort((h,v)=>(v.pos??0)-(h.pos??0)).filter(h=>!!h.filterOptions).map(h=>{var v;return{...h.filterOptions,label:((v=h.filterOptions)==null?void 0:v.label)??h.label,propertyName:h.key}}):[],[u]),x=o.useMemo(()=>!(r!=null&&r.length),[r]);return e.jsx(ne,{children:e.jsxs("div",{className:`${g} table-main`,children:[e.jsxs("div",{className:"table-header",children:[e.jsx("h1",{className:"table-header-title",children:n}),l?null:e.jsxs("div",{className:"table-header-right",children:[d,!!b&&!!b.length&&e.jsx(de,{filters:b})]})]}),l?e.jsx(X,{className:"table-loading"}):e.jsx(e.Fragment,{children:x?e.jsx(re,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`${i} table-body`,children:e.jsxs("table",{className:"table-content",children:[e.jsx(ae,{entity:a,columns:u,onSortCallback:s,hasAction:!!c}),e.jsx("tbody",{children:e.jsx(pe,{data:r,actions:c,columns:u,softDeleteProperty:p})})]})}),e.jsx(ie,{})]})})]})})}function he(t){const{content:n,children:r}=t;return e.jsxs("div",{className:"tooltip-container",children:[r,e.jsx("div",{className:"tooltip-text",children:n})]})}var S=(t=>(t.empty="empty",t.outlined="outlined",t.default="default",t))(S||{});function me(t){const{label:n,onDelete:r,className:s="",spanClassName:a="",variant:l=S.default}=t,c=o.useMemo(()=>{switch(l){case S.empty:return"text-primary bg-transparent";case S.outlined:return"border border-primary";case S.default:default:return"text-white bg-primary"}},[l]),u=o.useMemo(()=>{switch(l){case S.empty:case S.outlined:return"chip-delete-button-svg";case S.default:default:return"filled-chip-delete-button-svg"}},[l]);return e.jsxs("div",{className:`chip-main ${c} ${s}`,children:[e.jsx("span",{className:a,children:n}),r?e.jsx("button",{type:"button",className:"chip-delete-button",onClick:r,children:e.jsx(A,{className:u})}):null]})}exports.AutocompleteInput=Q;exports.CheckInput=K;exports.ChevronDown=W;exports.ChevronLeft=V;exports.ChevronRight=J;exports.ChevronUp=q;exports.Chip=me;exports.ChipVariant=S;exports.Close=A;exports.Columns=ae;exports.CountOfTotal=oe;exports.Empty=re;exports.FilterPopup=de;exports.FilterTypes=$;exports.Filters=G;exports.FiltersActions=y;exports.FiltersProvider=ne;exports.Footer=ie;exports.Loading=X;exports.Navigation=le;exports.PageSize=ce;exports.Rows=pe;exports.SelectInput=R;exports.SortOrder=F;exports.State=L;exports.Table=Se;exports.TableOptionsProvider=ge;exports.TextInput=M;exports.Tooltip=he;exports.TranslationProvider=be;exports.filtersReducer=te;exports.helperTextStateClassName=I;exports.initializer=ee;exports.inputStateClassName=B;exports.labelStateClassName=D;exports.renderFilterComponent=ue;exports.useFilters=O;exports.useTableOptions=P;exports.useTranslation=k;