@sito/dashboard 0.0.33 → 0.0.35

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.
@@ -2,7 +2,8 @@ import { HTMLProps } from 'react';
2
2
  import { BaseInputPropsType } from '../types';
3
3
  export type Option = {
4
4
  id: number | string;
5
- value: number | string;
5
+ value?: number | string;
6
+ name?: string;
6
7
  };
7
8
  export interface SelectInputPropsType extends Omit<HTMLProps<HTMLSelectElement>, "value" | "onChange">, BaseInputPropsType {
8
9
  options: Option[];
@@ -1,2 +1,3 @@
1
1
  import { TablePropsType } from './types';
2
- export declare function Table(props: TablePropsType): import("react/jsx-runtime").JSX.Element;
2
+ import { BaseDto } from '../../lib';
3
+ export declare function Table<TRow extends BaseDto>(props: TablePropsType<TRow>): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,8 @@
1
+ import { BaseDto } from '../../../lib';
1
2
  import { ColumnPropsType } from './types';
2
3
  /**
3
4
  * Columns component
4
5
  * @param {object} props properties for the columns
5
6
  * @returns Row of columns
6
7
  */
7
- export declare function Columns(props: ColumnPropsType): import("react/jsx-runtime").JSX.Element;
8
+ export declare function Columns<TRow extends BaseDto>(props: ColumnPropsType<TRow>): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,4 @@
1
1
  import { RowsPropsType } from './types';
2
- export declare const Rows: (props: RowsPropsType) => import("react/jsx-runtime").JSX.Element[];
2
+ import { BaseDto } from '../../../lib';
3
+ export declare const Rows: <TRow extends BaseDto>(props: RowsPropsType<TRow>) => import("react/jsx-runtime").JSX.Element[];
3
4
  export default Rows;
@@ -1,13 +1,14 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { Action } from '../types';
3
- import { FilterTypes, SortOrder } from '../../../lib';
4
- export type ColumnType = {
5
- key: string;
6
- label: string;
3
+ import { BaseDto, FilterTypes, SortOrder } from '../../../lib';
4
+ import { Option } from '../../Form/';
5
+ export type ColumnType<TRow extends BaseDto> = {
6
+ key: keyof TRow;
7
+ label?: string;
7
8
  /** if the column can be sorted */
8
9
  sortable?: boolean;
9
10
  /** only works if sortable has value true */
10
- sortOptions: {
11
+ sortOptions?: {
11
12
  icons: {
12
13
  className: string;
13
14
  asc: string;
@@ -25,20 +26,21 @@ export type ColumnType = {
25
26
  /** filter options */
26
27
  filterOptions?: ColumnFilterOptions;
27
28
  };
28
- export type ColumnPropsType = {
29
+ export type ColumnPropsType<TRow extends BaseDto> = {
29
30
  entity: string;
30
- columns: ColumnType[];
31
+ columns: ColumnType<TRow>[];
31
32
  hasAction: boolean;
32
- onSortCallback: (prop: string, sortOrder: SortOrder) => void;
33
+ onSortCallback?: (prop: string, sortOrder: SortOrder) => void;
33
34
  };
34
35
  export type ColumnFilterOptions = {
35
36
  type: FilterTypes;
36
- defaultValue: any;
37
+ defaultValue?: any;
37
38
  label?: string;
39
+ options?: Option[];
38
40
  };
39
- export type RowsPropsType = {
40
- data: any[];
41
- columns: ColumnType[];
42
- softDeleteProperty: string;
43
- actions: ((row: any) => Action[]) | undefined;
41
+ export type RowsPropsType<TRow extends BaseDto> = {
42
+ data: TRow[];
43
+ columns: ColumnType<TRow>[];
44
+ softDeleteProperty: keyof TRow;
45
+ actions: ((row: TRow) => Action<TRow>[]) | undefined;
44
46
  };
@@ -1,23 +1,24 @@
1
1
  import { ReactNode } from 'react';
2
- import { SortOrder } from '../../lib';
2
+ import { BaseDto, SortOrder } from '../../lib';
3
3
  import { ColumnType } from './components';
4
- export type Action = {
4
+ export type Action<TRow extends BaseDto> = {
5
5
  id: string;
6
- onClick: (entity: object) => void;
6
+ onClick: (entity: TRow) => void;
7
7
  icon: any;
8
8
  tooltip: string;
9
- hidden: (entity: object) => boolean;
9
+ disabled?: boolean;
10
+ hidden?: boolean;
10
11
  };
11
- export type TablePropsType = {
12
+ export type TablePropsType<TRow extends BaseDto> = {
12
13
  entity: string;
13
14
  title?: string;
14
- data: object[];
15
+ data: TRow[];
15
16
  isLoading?: boolean;
16
- actions?: (row: object) => Action[];
17
- columns?: ColumnType[];
17
+ actions?: (row: TRow) => Action<TRow>[];
18
+ columns?: ColumnType<TRow>[];
18
19
  contentClassName?: string;
19
20
  className?: string;
20
- softDeleteProperty?: string;
21
+ softDeleteProperty?: keyof TRow;
21
22
  toolbar?: ReactNode;
22
- onSort: (prop: string, sortOrder: SortOrder) => void;
23
+ onSort?: (prop: string, sortOrder: SortOrder) => void;
23
24
  };
@@ -1 +1 @@
1
- var $e=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 H(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 q(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 V=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 z=(t=>(t.error="error",t.good="good",t.default="default",t))(z||{});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:i="",labelClassName:c="",helperText:u="",helperTextClassName:x="",placeholder:d="",label:p="",name:v="",id:h="",state:m=z.default,...g}=t;return o.useEffect(()=>{var C;(!r||r==="")&&(a!=null&&a.length)&&s({target:{value:(C=a[0])==null?void 0:C.id}})},[s,a,r]),e.jsxs("div",{className:`select-input-container ${l}`,children:[e.jsx("select",{...g,id:h,ref:n,name:v,value:r,onChange:s,className:`select-input ${D(m)} peer ${i}`,children:a==null?void 0:a.map(C=>e.jsx("option",{value:C.id,children:C.value},C.id))}),e.jsx("label",{htmlFor:v,className:`select-input-label ${B(m)} ${c}`,children:p}),e.jsx("p",{className:`select-input-helper-text ${I(m)} ${x}`,children:m!=="error"&&m!=="good"?d:u})]})});const L=o.forwardRef(function(t,n){const{children:r,value:s,onChange:a,state:l=z.default,name:i="",id:c="",type:u="text",label:x="",required:d=!1,placeholder:p="",containerClassName:v="",inputClassName:h="",labelClassName:m="",helperText:g="",helperTextClassName:C="",...j}=t;return e.jsxs("div",{className:`text-input-container ${v}`,children:[e.jsx("input",{ref:n,type:u,name:i,id:c,className:`text-input ${D(l)} peer ${h}`,placeholder:"",required:d,value:s,onChange:a,...j}),e.jsxs("label",{htmlFor:i,className:`text-input-label ${B(l)} ${m}`,children:[x,d?" *":""]}),r,e.jsx("p",{className:`text-input-helper-text ${I(l)} ${C}`,children:l!=="error"&&l!=="good"?p:g})]})});const G=o.forwardRef(function(t,n){const{checked:r,onChange:s,state:a=z.default,name:l="",id:i="",type:c="text",label:u="",containerClassName:x="",inputClassName:d="",labelClassName:p="",helperText:v="",helperTextClassName:h="",...m}=t;return e.jsxs("label",{className:`input-check-container ${x}`,children:[e.jsx("input",{id:i,ref:n,name:l,type:"checkbox",checked:r,onChange:s,className:`input-check ${d}`,...m}),e.jsx("span",{className:`input-check-label ${p}`,children:u})]})});const K=o.forwardRef(function(t,n){const{state:r,value:s,onChange:a,options:l=[],name:i="",id:c="",label:u="",containerClassName:x="",inputContainerClassName:d="",helperText:p="",placeholder:v="",multiple:h=!1,...m}=t,[g,C]=o.useState(""),[j,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=O=>{E.current&&!E.current.contains(O.target)&&f(!1)},N=O=>{O.key==="Escape"&&f(!1)};return document.addEventListener("mousedown",b),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",N)}},[]);const M=b=>{C(b.target.value)},U=o.useCallback(b=>{C(""),b?h?Array.isArray(s)&&s.length?a([...s,b]):a([b]):a(b):a(null),f(!1)},[h,a,s]),he=o.useCallback(b=>{const N=s.filter((O,A)=>A!==b);N.length?a(N):a(null)},[a,s]);return e.jsxs("div",{className:`autocomplete-input-container ${x}`,ref:E,children:[e.jsx(L,{state:r,name:i,id:c,value:!h&&s?s:g,onChange:M,placeholder:v,helperText:p,onFocus:()=>f(!0),label:u,containerClassName:`autocomplete-text-input ${d}`,ref:n,...m,children:!h&&s&&e.jsx("button",{type:"button",className:"autocomplete-delete-button",onClick:b=>{U(),b.stopPropagation()},children:e.jsx(_,{})})}),j&&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.id))}),h&&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),onDelete:O=>{he(N),O.stopPropagation()}})},b.value))}):null]})});function Q(t){const{color:n="stroke-blue-800",loaderClass:r,strokeWidth:s="4",...a}=t;return e.jsx("div",{...a,className:`loading ${a.className}`,children:e.jsx("div",{className:"loader-container",children:e.jsx("div",{className:`loader ${r}`,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:s,strokeMiterlimit:"10"})})})})})}const X=o.createContext({});function xe(t){const{children:n,t:r}=t;return e.jsx(X.Provider,{value:{t:r},children:n})}const $=()=>{const t=o.useContext(X);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||{}),T=(t=>(t.ASC="ASC",t.DESC="DESC",t))(T||{});const be=[20,50,100],Y=o.createContext({}),ge=t=>{const{children:n}=t,[r,s]=o.useState(0),[a,l]=o.useState(20),[i,c]=o.useState(0),[u,x]=o.useState("id"),[d,p]=o.useState(T.DESC),[v,h]=o.useState({}),m=o.useCallback((j,f)=>{let w=d;if(u===j)switch(d){case T.ASC:w=T.DESC;break;default:w=T.ASC;break}x(j),p(w),f&&f(j,w)},[u,d]),g=o.useCallback(j=>{const f=Object.entries(j).reduce((w,[E,M])=>(M&&typeof M.value<"u"&&(w[E]=M.value),w),{});h(f)},[]),C={onSort:m,total:r,setTotal:s,sortingBy:u,setSortingBy:x,sortingOrder:d,setSortingOrder:p,pageSize:a,pageSizes:be,setPageSize:l,currentPage:i,setCurrentPage:c,filters:v,onFilterApply:g};return e.jsx(Y.Provider,{value:C,children:n})},P=()=>{const t=o.useContext(Y);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 Z=t=>{const n={},r=Object.keys(t);return r==null||r.forEach(s=>{n[s]={value:t[s]}}),n};function ee(t,n){const{type:r}=n;switch(r){case y.reset:{const{filters:s}=n,a={};return s==null||s.forEach(({propertyName:l,defaultValue:i})=>{a[l]={value:i}}),{...t,...a}}case y.update:{const{toUpdate:s}=n;return{...t,...s}}default:return t}}const te=o.createContext({}),se=t=>{const{children:n}=t,{filters:r}=P(),[s,a]=o.useReducer(ee,Z(r)),l={currentFilters:s,setCurrentFilters:a};return e.jsx(te.Provider,{value:l,children:n})},F=()=>{const t=o.useContext(te);if(t===void 0)throw new Error("tableOptionsContext must be used within a Provider");return t};function ne(t){const{t:n}=$(),{entity:r="",columns:s=[],hasAction:a=!0,onSortCallback:l}=t,{onSort:i,sortingOrder:c,sortingBy:u}=P(),x=o.useMemo(()=>{var d;return(d=s.sort((p,v)=>(v.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:[x.map(d=>{var p,v,h,m,g,C,j,f;return e.jsx("th",{scope:"col",className:`table-headers-column ${d.className}`,children:e.jsxs("button",{disabled:!d.sortable,onClick:()=>i(d.id,l),className:"table-headers-cell",children:[e.jsx("span",{className:"table-headers-label",children:d.label}),d.sortable&&e.jsx("span",{className:`${u===d.id?"table-headers-sort-on":"table-headers-sort"}`,children:c===T.ASC?((v=(p=d.sortOptions)==null?void 0:p.icons)==null?void 0:v.asc)??e.jsx(H,{className:((m=(h=d.sortOptions)==null?void 0:h.icons)==null?void 0:m.className)??"table-headers-sort-indicator"}):((C=(g=d.sortOptions)==null?void 0:g.icons)==null?void 0:C.desc)??e.jsx(W,{className:((f=(j=d.sortOptions)==null?void 0:j.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 ae(){const{t}=$();return e.jsx("div",{className:"table-empty",children:e.jsx("p",{children:t("_accessibility:components.table.empty")})})}const re=()=>{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(q,{className:"w-2.5"})})]})},le=()=>{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 oe(){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(l.target.value)})]})}function ve(){const{t}=$(),{total:n,pageSize:r,currentPage:s,setCurrentPage:a}=P(),l=o.useMemo(()=>{const i=Math.ceil(n/r);return Array.from({length:i},(c,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:i=>a(Number(i.target.value))})]})}function ce(){return e.jsxs("div",{className:"table-footer",children:[e.jsx(ve,{}),e.jsx(oe,{}),e.jsx(le,{}),e.jsx(re,{})]})}function Ce(t){const{propertyName:n,options:r,label:s}=t,{currentFilters:a,setCurrentFilters:l}=F(),i=o.useMemo(()=>{var u;return((u=a[n])==null?void 0:u.value)??r[0]},[a]),c=o.useCallback(u=>{l({type:y.update,toUpdate:{[n]:{value:u.target.value}}})},[]);return e.jsx(R,{value:i,label:s,options:r,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:c})}const je=t=>{const{propertyName:n,label:r}=t,{currentFilters:s,setCurrentFilters:a}=F(),l=o.useMemo(()=>{var c;return((c=s[n])==null?void 0:c.value)??""},[s]),i=o.useCallback(c=>{a({type:y.update,toUpdate:{[n]:{value:c.target.value}}})},[]);return e.jsx(L,{value:l??"",label:r,onChange:i,containerClassName:"input-widget-container",helperTextClassName:""})},fe=t=>{const{propertyName:n,label:r,min:s,max:a}=t,{currentFilters:l,setCurrentFilters:i}=F(),c=o.useMemo(()=>{var x;return((x=l[n])==null?void 0:x.value)??""},[l]),u=o.useCallback(x=>{i({type:y.update,toUpdate:{[n]:{value:x.target.value}}})},[c]);return e.jsx(L,{value:c??"",min:s,max:a,type:"number",label:r,containerClassName:"input-widget-container",onChange:u,helperTextClassName:""})},Ne=t=>{const{propertyName:n,label:r}=t,{currentFilters:s,setCurrentFilters:a}=F(),l=o.useMemo(()=>{var c;return((c=s[n])==null?void 0:c.value)??""},[s]),i=o.useCallback(c=>{a({type:y.update,toUpdate:{[n]:{value:c.target.checked}}})},[]);return e.jsx(G,{label:r,checked:l??!1,onChange:i})};function ye(t){const{propertyName:n,label:r,options:s,multiple:a=!0}=t,{currentFilters:l,setCurrentFilters:i}=F(),c=o.useMemo(()=>l[n]??s[0],[l]),u=o.useCallback(x=>{i({type:y.update,toUpdate:{[n]:{value:x}}})},[a]);return e.jsx(K,{value:c==null?void 0:c.value,label:r,options:s,multiple:a,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:u})}const we=t=>{const{propertyName:n,label:r}=t,{currentFilters:s,setCurrentFilters:a}=F(),l=o.useMemo(()=>{var c,u;return(c=s[n])!=null&&c.value?new Date(String((u=s[n])==null?void 0:u.value)).toISOString().slice(0,10):""},[s]),i=o.useCallback(c=>{a({type:y.update,toUpdate:{[n]:{value:c.target.value}}})},[]);return e.jsx(L,{value:l??"",label:r,type:"date",onChange:i,containerClassName:"input-widget-container",helperTextClassName:""})},ie=t=>{switch(t.type){case k.text:return e.jsx(je,{...t});case k.number:return e.jsx(fe,{...t});case k.select:return e.jsx(Ce,{...t});case k.autocomplete:return e.jsx(ye,{...t});case k.date:return e.jsx(we,{...t});case k.check:return e.jsx(Ne,{...t})}return e.jsx(e.Fragment,{})};const ue=t=>{const{align:n="right",filters:r=[],icon:s}=t,[a,l]=o.useState(!1),{onFilterApply:i,filters:c}=P(),{currentFilters:u,setCurrentFilters:x}=F(),{t:d}=$(),p=o.useRef(null),v=o.useRef(null);return o.useEffect(()=>{const h=({target:m})=>{var g,C;v.current&&(!a||(g=v.current)!=null&&g.contains(m)||(C=p==null?void 0:p.current)!=null&&C.contains(m)||l(!1))};return document.addEventListener("click",h),()=>document.removeEventListener("click",h)}),o.useEffect(()=>{const h=m=>{!a||m.code!=="Escape"||l(!1)};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)}),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(V,{className:"filter-dropdown-trigger-icon"})]}),e.jsx("div",{className:`filter-dropdown-transition ${a?"opened":"closed"} ${n==="right"?"right":"left"}`,children:e.jsxs("div",{ref:v,children:[e.jsx("div",{className:"filter-title",children:d("_accessibility:buttons.filters")}),e.jsx("ul",{className:"filter-container",children:r.map(h=>e.jsx("li",{className:"filter-container-item",children:ie(h)},h.propertyName))}),e.jsx("div",{className:"filter-footer",children:e.jsxs("ul",{className:"filter-buttons-row",children:[e.jsx("li",{children:e.jsx("button",{onClick:()=>x({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),i(u)},onBlur:()=>l(!1),children:d("_accessibility:buttons.applyFilters")})})]})})]})})]})},Se=t=>t,de=t=>{const{columns:n,softDeleteProperty:r="deleted",data:s,actions:a}=t,l=o.useMemo(()=>n.sort((i,c)=>(c.pos??0)-(i.pos??0)).filter(i=>i.display!=="none"),[n]);return s==null?void 0:s.map(i=>{var c;return e.jsxs("tr",{className:`table-row ${i[r]?"deleted-class":""}`,children:[l==null?void 0:l.map((u,x)=>e.jsx("td",{className:`table-row-cell ${x===0?"basic":""} ${u.className??""}`,children:u.renderBody?u.renderBody(i[u.key],i):Se(i[u.key])},u.key)),a?e.jsx("td",{children:e.jsx("div",{className:"table-row-cell-action",children:(c=a(i).filter(u=>!u.hidden))==null?void 0:c.map(u=>e.jsx(pe,{content:u.tooltip,children:e.jsx("button",{onClick:u.onClick,children:u.icon})},u.id))})}):null]},i.id)})};function ke(t){const{title:n="",data:r,onSort:s,entity:a="",isLoading:l=!1,actions:i,columns:c=[],contentClassName:u="",className:x="",toolbar:d=e.jsx(e.Fragment,{}),softDeleteProperty:p="deleted"}=t,v=o.useMemo(()=>c?c.sort((m,g)=>(g.pos??0)-(m.pos??0)).filter(m=>!!m.filterOptions).map(m=>{var g;return{...m.filterOptions,label:((g=m.filterOptions)==null?void 0:g.label)??m.label,propertyName:m.key}}):[],[c]),h=o.useMemo(()=>!(r!=null&&r.length),[r]);return e.jsx(se,{children:e.jsxs("div",{className:`${x} 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,e.jsx(ue,{filters:v})]})]}),l?e.jsx(Q,{className:"table-loading"}):e.jsx(e.Fragment,{children:h?e.jsx(ae,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`${u} table-body`,children:e.jsxs("table",{className:"table-content",children:[e.jsx(ne,{entity:a,columns:c,onSortCallback:s,hasAction:!!i}),e.jsx("tbody",{children:e.jsx(de,{data:r,actions:i,columns:c,softDeleteProperty:p})})]})}),e.jsx(ce,{})]})})]})})}function pe(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,i=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]),c=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 ${i} ${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:c})}):null]})}exports.AutocompleteInput=K;exports.CheckInput=G;exports.ChevronDown=W;exports.ChevronLeft=J;exports.ChevronRight=q;exports.ChevronUp=H;exports.Chip=me;exports.ChipVariant=S;exports.Close=_;exports.Columns=ne;exports.CountOfTotal=le;exports.Empty=ae;exports.FilterPopup=ue;exports.FilterTypes=k;exports.Filters=V;exports.FiltersActions=y;exports.FiltersProvider=se;exports.Footer=ce;exports.Loading=Q;exports.Navigation=re;exports.PageSize=oe;exports.Rows=de;exports.SelectInput=R;exports.SortOrder=T;exports.State=z;exports.Table=ke;exports.TableOptionsProvider=ge;exports.TextInput=L;exports.Tooltip=pe;exports.TranslationProvider=xe;exports.filtersReducer=ee;exports.helperTextStateClassName=I;exports.initializer=Z;exports.inputStateClassName=D;exports.labelStateClassName=B;exports.renderFilterComponent=ie;exports.useFilters=F;exports.useTableOptions=P;exports.useTranslation=$;
1
+ var $e=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 H(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 q(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 V=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 z=(t=>(t.error="error",t.good="good",t.default="default",t))(z||{});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:x="",placeholder:d="",label:p="",name:C="",id:h="",state:m=z.default,...g}=t;return o.useEffect(()=>{var v;(!r||r==="")&&(a!=null&&a.length)&&s({target:{value:(v=a[0])==null?void 0:v.id}})},[s,a,r]),e.jsxs("div",{className:`select-input-container ${l}`,children:[e.jsx("select",{...g,id:h,ref:n,name:C,value:r,onChange:s,className:`select-input ${D(m)} peer ${c}`,children:a==null?void 0:a.map(v=>e.jsx("option",{value:v.id,children:v.value??v.name??v.id},v.id))}),e.jsx("label",{htmlFor:C,className:`select-input-label ${B(m)} ${i}`,children:p}),e.jsx("p",{className:`select-input-helper-text ${I(m)} ${x}`,children:m!=="error"&&m!=="good"?d:u})]})});const L=o.forwardRef(function(t,n){const{children:r,value:s,onChange:a,state:l=z.default,name:c="",id:i="",type:u="text",label:x="",required:d=!1,placeholder:p="",containerClassName:C="",inputClassName:h="",labelClassName:m="",helperText:g="",helperTextClassName:v="",...j}=t;return e.jsxs("div",{className:`text-input-container ${C}`,children:[e.jsx("input",{ref:n,type:u,name:c,id:i,className:`text-input ${D(l)} peer ${h}`,placeholder:"",required:d,value:s,onChange:a,...j}),e.jsxs("label",{htmlFor:c,className:`text-input-label ${B(l)} ${m}`,children:[x,d?" *":""]}),r,e.jsx("p",{className:`text-input-helper-text ${I(l)} ${v}`,children:l!=="error"&&l!=="good"?p:g})]})});const G=o.forwardRef(function(t,n){const{checked:r,onChange:s,state:a=z.default,name:l="",id:c="",type:i="text",label:u="",containerClassName:x="",inputClassName:d="",labelClassName:p="",helperText:C="",helperTextClassName:h="",...m}=t;return e.jsxs("label",{className:`input-check-container ${x}`,children:[e.jsx("input",{id:c,ref:n,name:l,type:"checkbox",checked:r,onChange:s,className:`input-check ${d}`,...m}),e.jsx("span",{className:`input-check-label ${p}`,children:u})]})});const K=o.forwardRef(function(t,n){const{state:r,value:s,onChange:a,options:l=[],name:c="",id:i="",label:u="",containerClassName:x="",inputContainerClassName:d="",helperText:p="",placeholder:C="",multiple:h=!1,...m}=t,[g,v]=o.useState(""),[j,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=O=>{E.current&&!E.current.contains(O.target)&&f(!1)},N=O=>{O.key==="Escape"&&f(!1)};return document.addEventListener("mousedown",b),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",N)}},[]);const M=b=>{v(b.target.value)},U=o.useCallback(b=>{v(""),b?h?Array.isArray(s)&&s.length?a([...s,b]):a([b]):a(b):a(null),f(!1)},[h,a,s]),he=o.useCallback(b=>{const N=s.filter((O,A)=>A!==b);N.length?a(N):a(null)},[a,s]);return e.jsxs("div",{className:`autocomplete-input-container ${x}`,ref:E,children:[e.jsx(L,{state:r,name:c,id:i,value:!h&&s?s:g,onChange:M,placeholder:C,helperText:p,onFocus:()=>f(!0),label:u,containerClassName:`autocomplete-text-input ${d}`,ref:n,...m,children:!h&&s&&e.jsx("button",{type:"button",className:"autocomplete-delete-button",onClick:b=>{U(),b.stopPropagation()},children:e.jsx(_,{})})}),j&&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.id))}),h&&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),onDelete:O=>{he(N),O.stopPropagation()}})},b.value))}):null]})});function Q(t){const{color:n="stroke-blue-800",loaderClass:r,strokeWidth:s="4",...a}=t;return e.jsx("div",{...a,className:`loading ${a.className}`,children:e.jsx("div",{className:"loader-container",children:e.jsx("div",{className:`loader ${r}`,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:s,strokeMiterlimit:"10"})})})})})}const X=o.createContext({});function xe(t){const{children:n,t:r}=t;return e.jsx(X.Provider,{value:{t:r},children:n})}const $=()=>{const t=o.useContext(X);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||{}),T=(t=>(t.ASC="ASC",t.DESC="DESC",t))(T||{});const be=[20,50,100],Y=o.createContext({}),ge=t=>{const{children:n}=t,[r,s]=o.useState(0),[a,l]=o.useState(20),[c,i]=o.useState(0),[u,x]=o.useState("id"),[d,p]=o.useState(T.DESC),[C,h]=o.useState({}),m=o.useCallback((j,f)=>{let w=d;if(u===j)switch(d){case T.ASC:w=T.DESC;break;default:w=T.ASC;break}x(j),p(w),f&&f(j,w)},[u,d]),g=o.useCallback(j=>{const f=Object.entries(j).reduce((w,[E,M])=>(M&&typeof M.value<"u"&&(w[E]=M.value),w),{});h(f)},[]),v={onSort:m,total:r,setTotal:s,sortingBy:u,setSortingBy:x,sortingOrder:d,setSortingOrder:p,pageSize:a,pageSizes:be,setPageSize:l,currentPage:c,setCurrentPage:i,filters:C,onFilterApply:g};return e.jsx(Y.Provider,{value:v,children:n})},P=()=>{const t=o.useContext(Y);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 Z=t=>{const n={},r=Object.keys(t);return r==null||r.forEach(s=>{n[s]={value:t[s]}}),n};function ee(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 te=o.createContext({}),se=t=>{const{children:n}=t,{filters:r}=P(),[s,a]=o.useReducer(ee,Z(r)),l={currentFilters:s,setCurrentFilters:a};return e.jsx(te.Provider,{value:l,children:n})},F=()=>{const t=o.useContext(te);if(t===void 0)throw new Error("tableOptionsContext must be used within a Provider");return t};function ne(t){const{t:n}=$(),{entity:r="",columns:s=[],hasAction:a=!0,onSortCallback:l}=t,{onSort:c,sortingOrder:i,sortingBy:u}=P(),x=o.useMemo(()=>{var d;return(d=s.sort((p,C)=>(C.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:[x.map(d=>{var p,C,h,m,g,v,j,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:`${u===d.id?"table-headers-sort-on":"table-headers-sort"}`,children:i===T.ASC?((C=(p=d.sortOptions)==null?void 0:p.icons)==null?void 0:C.asc)??e.jsx(H,{className:((m=(h=d.sortOptions)==null?void 0:h.icons)==null?void 0:m.className)??"table-headers-sort-indicator"}):((v=(g=d.sortOptions)==null?void 0:g.icons)==null?void 0:v.desc)??e.jsx(W,{className:((f=(j=d.sortOptions)==null?void 0:j.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 ae(){const{t}=$();return e.jsx("div",{className:"table-empty",children:e.jsx("p",{children:t("_accessibility:components.table.empty")})})}const re=()=>{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(q,{className:"w-2.5"})})]})},le=()=>{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 oe(){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(l.target.value)})]})}function ve(){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 ce(){return e.jsxs("div",{className:"table-footer",children:[e.jsx(ve,{}),e.jsx(oe,{}),e.jsx(le,{}),e.jsx(re,{})]})}function Ce(t){const{propertyName:n,options:r,label:s}=t,{currentFilters:a,setCurrentFilters:l}=F(),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 je=t=>{const{propertyName:n,label:r}=t,{currentFilters:s,setCurrentFilters:a}=F(),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(L,{value:l??"",label:r,onChange:c,containerClassName:"input-widget-container",helperTextClassName:""})},fe=t=>{const{propertyName:n,label:r,min:s,max:a}=t,{currentFilters:l,setCurrentFilters:c}=F(),i=o.useMemo(()=>{var x;return((x=l[n])==null?void 0:x.value)??""},[l]),u=o.useCallback(x=>{c({type:y.update,toUpdate:{[n]:{value:x.target.value}}})},[i]);return e.jsx(L,{value:i??"",min:s,max:a,type:"number",label:r,containerClassName:"input-widget-container",onChange:u,helperTextClassName:""})},Ne=t=>{const{propertyName:n,label:r}=t,{currentFilters:s,setCurrentFilters:a}=F(),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(G,{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}=F(),i=o.useMemo(()=>l[n]??s[0],[l]),u=o.useCallback(x=>{c({type:y.update,toUpdate:{[n]:{value:x}}})},[a]);return e.jsx(K,{value:i==null?void 0:i.value,label:r,options:s,multiple:a,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:u})}const we=t=>{const{propertyName:n,label:r}=t,{currentFilters:s,setCurrentFilters:a}=F(),l=o.useMemo(()=>{var i,u;return(i=s[n])!=null&&i.value?new Date(String((u=s[n])==null?void 0:u.value)).toISOString().slice(0,10):""},[s]),c=o.useCallback(i=>{a({type:y.update,toUpdate:{[n]:{value:i.target.value}}})},[]);return e.jsx(L,{value:l??"",label:r,type:"date",onChange:c,containerClassName:"input-widget-container",helperTextClassName:""})},ie=t=>{switch(t.type){case k.text:return e.jsx(je,{...t});case k.number:return e.jsx(fe,{...t});case k.select:return e.jsx(Ce,{...t});case k.autocomplete:return e.jsx(ye,{...t});case k.date:return e.jsx(we,{...t});case k.check:return e.jsx(Ne,{...t})}return e.jsx(e.Fragment,{})};const ue=t=>{const{align:n="right",filters:r=[],icon:s}=t,[a,l]=o.useState(!1),{onFilterApply:c,filters:i}=P(),{currentFilters:u,setCurrentFilters:x}=F(),{t:d}=$(),p=o.useRef(null),C=o.useRef(null);return o.useEffect(()=>{const h=({target:m})=>{var g,v;C.current&&(!a||(g=C.current)!=null&&g.contains(m)||(v=p==null?void 0:p.current)!=null&&v.contains(m)||l(!1))};return document.addEventListener("click",h),()=>document.removeEventListener("click",h)}),o.useEffect(()=>{const h=m=>{!a||m.code!=="Escape"||l(!1)};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)}),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(V,{className:"filter-dropdown-trigger-icon"})]}),e.jsx("div",{className:`filter-dropdown-transition ${a?"opened":"closed"} ${n==="right"?"right":"left"}`,children:e.jsxs("div",{ref:C,children:[e.jsx("div",{className:"filter-title",children:d("_accessibility:buttons.filters")}),e.jsx("ul",{className:"filter-container",children:r.map(h=>e.jsx("li",{className:"filter-container-item",children:ie(h)},h.propertyName))}),e.jsx("div",{className:"filter-footer",children:e.jsxs("ul",{className:"filter-buttons-row",children:[e.jsx("li",{children:e.jsx("button",{onClick:()=>x({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(u)},onBlur:()=>l(!1),children:d("_accessibility:buttons.applyFilters")})})]})})]})})]})},Se=t=>t,de=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,x)=>e.jsx("td",{className:`table-row-cell ${x===0?"basic":""} ${u.className??""}`,children:u.renderBody?u.renderBody(c[u.key],c):Se(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(pe,{content:u.tooltip,children:e.jsx("button",{onClick:()=>u.onClick(c),children:u.icon})},u.id))})}):null]},c.id)})};function ke(t){const{title:n="",data:r,onSort:s,entity:a="",isLoading:l=!1,actions:c,columns:i=[],contentClassName:u="",className:x="",toolbar:d=e.jsx(e.Fragment,{}),softDeleteProperty:p="deleted"}=t,C=o.useMemo(()=>i?i.sort((m,g)=>(g.pos??0)-(m.pos??0)).filter(m=>!!m.filterOptions).map(m=>{var g;return{...m.filterOptions,label:((g=m.filterOptions)==null?void 0:g.label)??m.label,propertyName:m.key}}):[],[i]),h=o.useMemo(()=>!(r!=null&&r.length),[r]);return e.jsx(se,{children:e.jsxs("div",{className:`${x} 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,e.jsx(ue,{filters:C})]})]}),l?e.jsx(Q,{className:"table-loading"}):e.jsx(e.Fragment,{children:h?e.jsx(ae,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`${u} table-body`,children:e.jsxs("table",{className:"table-content",children:[e.jsx(ne,{entity:a,columns:i,onSortCallback:s,hasAction:!!c}),e.jsx("tbody",{children:e.jsx(de,{data:r,actions:c,columns:i,softDeleteProperty:p})})]})}),e.jsx(ce,{})]})})]})})}function pe(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=K;exports.CheckInput=G;exports.ChevronDown=W;exports.ChevronLeft=J;exports.ChevronRight=q;exports.ChevronUp=H;exports.Chip=me;exports.ChipVariant=S;exports.Close=_;exports.Columns=ne;exports.CountOfTotal=le;exports.Empty=ae;exports.FilterPopup=ue;exports.FilterTypes=k;exports.Filters=V;exports.FiltersActions=y;exports.FiltersProvider=se;exports.Footer=ce;exports.Loading=Q;exports.Navigation=re;exports.PageSize=oe;exports.Rows=de;exports.SelectInput=R;exports.SortOrder=T;exports.State=z;exports.Table=ke;exports.TableOptionsProvider=ge;exports.TextInput=L;exports.Tooltip=pe;exports.TranslationProvider=xe;exports.filtersReducer=ee;exports.helperTextStateClassName=I;exports.initializer=Z;exports.inputStateClassName=D;exports.labelStateClassName=B;exports.renderFilterComponent=ie;exports.useFilters=F;exports.useTableOptions=P;exports.useTranslation=$;
package/dist/dashboard.js CHANGED
@@ -14,7 +14,7 @@ function se(e) {
14
14
  }
15
15
  );
16
16
  }
17
- function re(e) {
17
+ function ae(e) {
18
18
  const { className: s = "" } = e;
19
19
  return /* @__PURE__ */ t(
20
20
  "svg",
@@ -27,7 +27,7 @@ function re(e) {
27
27
  }
28
28
  );
29
29
  }
30
- function ae(e) {
30
+ function re(e) {
31
31
  const { className: s = "" } = e;
32
32
  return /* @__PURE__ */ t(
33
33
  "svg",
@@ -101,43 +101,43 @@ const Q = (e) => {
101
101
  };
102
102
  const J = j(function(e, s) {
103
103
  const {
104
- value: a,
104
+ value: r,
105
105
  onChange: n,
106
- options: r,
106
+ options: a,
107
107
  containerClassName: l = "",
108
- inputClassName: c = "",
109
- labelClassName: o = "",
108
+ inputClassName: o = "",
109
+ labelClassName: c = "",
110
110
  helperText: i = "",
111
111
  helperTextClassName: m = "",
112
112
  placeholder: d = "",
113
113
  label: u = "",
114
- name: N = "",
114
+ name: f = "",
115
115
  id: h = "",
116
116
  state: p = R.default,
117
117
  ...v
118
118
  } = e;
119
119
  return M(() => {
120
- var f;
121
- (!a || a === "") && (r != null && r.length) && n({ target: { value: (f = r[0]) == null ? void 0 : f.id } });
122
- }, [n, r, a]), /* @__PURE__ */ b("div", { className: `select-input-container ${l}`, children: [
120
+ var N;
121
+ (!r || r === "") && (a != null && a.length) && n({ target: { value: (N = a[0]) == null ? void 0 : N.id } });
122
+ }, [n, a, r]), /* @__PURE__ */ b("div", { className: `select-input-container ${l}`, children: [
123
123
  /* @__PURE__ */ t(
124
124
  "select",
125
125
  {
126
126
  ...v,
127
127
  id: h,
128
128
  ref: s,
129
- name: N,
130
- value: a,
129
+ name: f,
130
+ value: r,
131
131
  onChange: n,
132
- className: `select-input ${Q(p)} peer ${c}`,
133
- children: r == null ? void 0 : r.map((f) => /* @__PURE__ */ t("option", { value: f.id, children: f.value }, f.id))
132
+ className: `select-input ${Q(p)} peer ${o}`,
133
+ children: a == null ? void 0 : a.map((N) => /* @__PURE__ */ t("option", { value: N.id, children: N.value ?? N.name ?? N.id }, N.id))
134
134
  }
135
135
  ),
136
136
  /* @__PURE__ */ t(
137
137
  "label",
138
138
  {
139
- htmlFor: N,
140
- className: `select-input-label ${V(p)} ${o}`,
139
+ htmlFor: f,
140
+ className: `select-input-label ${V(p)} ${c}`,
141
141
  children: u
142
142
  }
143
143
  ),
@@ -152,43 +152,43 @@ const J = j(function(e, s) {
152
152
  });
153
153
  const U = j(function(e, s) {
154
154
  const {
155
- children: a,
155
+ children: r,
156
156
  value: n,
157
- onChange: r,
157
+ onChange: a,
158
158
  state: l = R.default,
159
- name: c = "",
160
- id: o = "",
159
+ name: o = "",
160
+ id: c = "",
161
161
  type: i = "text",
162
162
  label: m = "",
163
163
  required: d = !1,
164
164
  placeholder: u = "",
165
- containerClassName: N = "",
165
+ containerClassName: f = "",
166
166
  inputClassName: h = "",
167
167
  labelClassName: p = "",
168
168
  helperText: v = "",
169
- helperTextClassName: f = "",
169
+ helperTextClassName: N = "",
170
170
  ...y
171
171
  } = e;
172
- return /* @__PURE__ */ b("div", { className: `text-input-container ${N}`, children: [
172
+ return /* @__PURE__ */ b("div", { className: `text-input-container ${f}`, children: [
173
173
  /* @__PURE__ */ t(
174
174
  "input",
175
175
  {
176
176
  ref: s,
177
177
  type: i,
178
- name: c,
179
- id: o,
178
+ name: o,
179
+ id: c,
180
180
  className: `text-input ${Q(l)} peer ${h}`,
181
181
  placeholder: "",
182
182
  required: d,
183
183
  value: n,
184
- onChange: r,
184
+ onChange: a,
185
185
  ...y
186
186
  }
187
187
  ),
188
188
  /* @__PURE__ */ b(
189
189
  "label",
190
190
  {
191
- htmlFor: c,
191
+ htmlFor: o,
192
192
  className: `text-input-label ${V(l)} ${p}`,
193
193
  children: [
194
194
  m,
@@ -196,11 +196,11 @@ const U = j(function(e, s) {
196
196
  ]
197
197
  }
198
198
  ),
199
- a,
199
+ r,
200
200
  /* @__PURE__ */ t(
201
201
  "p",
202
202
  {
203
- className: `text-input-helper-text ${X(l)} ${f}`,
203
+ className: `text-input-helper-text ${X(l)} ${N}`,
204
204
  children: l !== "error" && l !== "good" ? u : v
205
205
  }
206
206
  )
@@ -208,17 +208,17 @@ const U = j(function(e, s) {
208
208
  });
209
209
  const ce = j(function(e, s) {
210
210
  const {
211
- checked: a,
211
+ checked: r,
212
212
  onChange: n,
213
- state: r = R.default,
213
+ state: a = R.default,
214
214
  name: l = "",
215
- id: c = "",
216
- type: o = "text",
215
+ id: o = "",
216
+ type: c = "text",
217
217
  label: i = "",
218
218
  containerClassName: m = "",
219
219
  inputClassName: d = "",
220
220
  labelClassName: u = "",
221
- helperText: N = "",
221
+ helperText: f = "",
222
222
  helperTextClassName: h = "",
223
223
  ...p
224
224
  } = e;
@@ -226,11 +226,11 @@ const ce = j(function(e, s) {
226
226
  /* @__PURE__ */ t(
227
227
  "input",
228
228
  {
229
- id: c,
229
+ id: o,
230
230
  ref: s,
231
231
  name: l,
232
232
  type: "checkbox",
233
- checked: a,
233
+ checked: r,
234
234
  onChange: n,
235
235
  className: `input-check ${d}`,
236
236
  ...p
@@ -241,20 +241,20 @@ const ce = j(function(e, s) {
241
241
  });
242
242
  const ie = j(function(e, s) {
243
243
  const {
244
- state: a,
244
+ state: r,
245
245
  value: n,
246
- onChange: r,
246
+ onChange: a,
247
247
  options: l = [],
248
- name: c = "",
249
- id: o = "",
248
+ name: o = "",
249
+ id: c = "",
250
250
  label: i = "",
251
251
  containerClassName: m = "",
252
252
  inputContainerClassName: d = "",
253
253
  helperText: u = "",
254
- placeholder: N = "",
254
+ placeholder: f = "",
255
255
  multiple: h = !1,
256
256
  ...p
257
- } = e, [v, f] = P(""), [y, w] = P(!1), S = l.filter((g) => {
257
+ } = e, [v, N] = P(""), [y, w] = P(!1), S = l.filter((g) => {
258
258
  const x = String(g.value).toLowerCase().includes(v == null ? void 0 : v.toLowerCase());
259
259
  return n && n.length ? n != null && n.some ? !(n != null && n.some((I) => I.id === g.id)) : (n == null ? void 0 : n.id) !== g.id : x;
260
260
  }), A = W(null);
@@ -269,18 +269,18 @@ const ie = j(function(e, s) {
269
269
  };
270
270
  }, []);
271
271
  const B = (g) => {
272
- f(g.target.value);
272
+ N(g.target.value);
273
273
  }, G = k(
274
274
  (g) => {
275
- f(""), g ? h ? Array.isArray(n) && n.length ? r([...n, g]) : r([g]) : r(g) : r(null), w(!1);
275
+ N(""), g ? h ? Array.isArray(n) && n.length ? a([...n, g]) : a([g]) : a(g) : a(null), w(!1);
276
276
  },
277
- [h, r, n]
277
+ [h, a, n]
278
278
  ), te = k(
279
279
  (g) => {
280
280
  const x = n.filter((O, I) => I !== g);
281
- x.length ? r(x) : r(null);
281
+ x.length ? a(x) : a(null);
282
282
  },
283
- [r, n]
283
+ [a, n]
284
284
  );
285
285
  return /* @__PURE__ */ b(
286
286
  "div",
@@ -291,12 +291,12 @@ const ie = j(function(e, s) {
291
291
  /* @__PURE__ */ t(
292
292
  U,
293
293
  {
294
- state: a,
295
- name: c,
296
- id: o,
294
+ state: r,
295
+ name: o,
296
+ id: c,
297
297
  value: !h && n ? n : v,
298
298
  onChange: B,
299
- placeholder: N,
299
+ placeholder: f,
300
300
  helperText: u,
301
301
  onFocus: () => w(!0),
302
302
  label: i,
@@ -343,11 +343,11 @@ const ie = j(function(e, s) {
343
343
  function de(e) {
344
344
  const {
345
345
  color: s = "stroke-blue-800",
346
- loaderClass: a,
346
+ loaderClass: r,
347
347
  strokeWidth: n = "4",
348
- ...r
348
+ ...a
349
349
  } = e;
350
- return /* @__PURE__ */ t("div", { ...r, className: `loading ${r.className}`, children: /* @__PURE__ */ t("div", { className: "loader-container", children: /* @__PURE__ */ t("div", { className: `loader ${a}`, children: /* @__PURE__ */ t("svg", { className: "circular", viewBox: "25 25 50 50", children: /* @__PURE__ */ t(
350
+ return /* @__PURE__ */ t("div", { ...a, className: `loading ${a.className}`, children: /* @__PURE__ */ t("div", { className: "loader-container", children: /* @__PURE__ */ t("div", { className: `loader ${r}`, children: /* @__PURE__ */ t("svg", { className: "circular", viewBox: "25 25 50 50", children: /* @__PURE__ */ t(
351
351
  "circle",
352
352
  {
353
353
  className: `path ${s}`,
@@ -362,8 +362,8 @@ function de(e) {
362
362
  }
363
363
  const Y = H({});
364
364
  function De(e) {
365
- const { children: s, t: a } = e;
366
- return /* @__PURE__ */ t(Y.Provider, { value: { t: a }, children: s });
365
+ const { children: s, t: r } = e;
366
+ return /* @__PURE__ */ t(Y.Provider, { value: { t: r }, children: s });
367
367
  }
368
368
  const L = () => {
369
369
  const e = q(Y);
@@ -373,7 +373,7 @@ const L = () => {
373
373
  };
374
374
  var E = /* @__PURE__ */ ((e) => (e[e.text = 0] = "text", e[e.number = 1] = "number", e[e.select = 2] = "select", e[e.autocomplete = 3] = "autocomplete", e[e.date = 4] = "date", e[e.check = 5] = "check", e))(E || {}), _ = /* @__PURE__ */ ((e) => (e.ASC = "ASC", e.DESC = "DESC", e))(_ || {});
375
375
  const ue = [20, 50, 100], Z = H({}), Me = (e) => {
376
- const { children: s } = e, [a, n] = P(0), [r, l] = P(20), [c, o] = P(0), [i, m] = P("id"), [d, u] = P(_.DESC), [N, h] = P({}), p = k(
376
+ const { children: s } = e, [r, n] = P(0), [a, l] = P(20), [o, c] = P(0), [i, m] = P("id"), [d, u] = P(_.DESC), [f, h] = P({}), p = k(
377
377
  (y, w) => {
378
378
  let S = d;
379
379
  if (i === y)
@@ -394,23 +394,23 @@ const ue = [20, 50, 100], Z = H({}), Me = (e) => {
394
394
  {}
395
395
  );
396
396
  h(w);
397
- }, []), f = {
397
+ }, []), N = {
398
398
  onSort: p,
399
- total: a,
399
+ total: r,
400
400
  setTotal: n,
401
401
  sortingBy: i,
402
402
  setSortingBy: m,
403
403
  sortingOrder: d,
404
404
  setSortingOrder: u,
405
- pageSize: r,
405
+ pageSize: a,
406
406
  pageSizes: ue,
407
407
  setPageSize: l,
408
- currentPage: c,
409
- setCurrentPage: o,
410
- filters: N,
408
+ currentPage: o,
409
+ setCurrentPage: c,
410
+ filters: f,
411
411
  onFilterApply: v
412
412
  };
413
- return /* @__PURE__ */ t(Z.Provider, { value: f, children: s });
413
+ return /* @__PURE__ */ t(Z.Provider, { value: N, children: s });
414
414
  }, F = () => {
415
415
  const e = q(Z);
416
416
  if (e === void 0)
@@ -419,19 +419,19 @@ const ue = [20, 50, 100], Z = H({}), Me = (e) => {
419
419
  };
420
420
  var $ = /* @__PURE__ */ ((e) => (e[e.update = 0] = "update", e[e.reset = 1] = "reset", e))($ || {});
421
421
  const pe = (e) => {
422
- const s = {}, a = Object.keys(e);
423
- return a == null || a.forEach((n) => {
422
+ const s = {}, r = Object.keys(e);
423
+ return r == null || r.forEach((n) => {
424
424
  s[n] = { value: e[n] };
425
425
  }), s;
426
426
  };
427
427
  function he(e, s) {
428
- const { type: a } = s;
429
- switch (a) {
428
+ const { type: r } = s;
429
+ switch (r) {
430
430
  case $.reset: {
431
- const { filters: n } = s, r = {};
432
- return n == null || n.forEach(({ propertyName: l, defaultValue: c }) => {
433
- r[l] = { value: c };
434
- }), { ...e, ...r };
431
+ const { filters: n } = s, a = {};
432
+ return n == null || n.forEach(({ propertyName: l, defaultValue: o }) => {
433
+ a[l] = { value: o };
434
+ }), { ...e, ...a };
435
435
  }
436
436
  case $.update: {
437
437
  const { toUpdate: n } = s;
@@ -442,12 +442,12 @@ function he(e, s) {
442
442
  }
443
443
  }
444
444
  const ee = H({}), me = (e) => {
445
- const { children: s } = e, { filters: a } = F(), [n, r] = ne(
445
+ const { children: s } = e, { filters: r } = F(), [n, a] = ne(
446
446
  he,
447
- pe(a)
447
+ pe(r)
448
448
  ), l = {
449
449
  currentFilters: n,
450
- setCurrentFilters: r
450
+ setCurrentFilters: a
451
451
  };
452
452
  return /* @__PURE__ */ t(ee.Provider, { value: l, children: s });
453
453
  }, T = () => {
@@ -457,19 +457,19 @@ const ee = H({}), me = (e) => {
457
457
  return e;
458
458
  };
459
459
  function be(e) {
460
- const { t: s } = L(), { entity: a = "", columns: n = [], hasAction: r = !0, onSortCallback: l } = e, { onSort: c, sortingOrder: o, sortingBy: i } = F(), m = C(() => {
460
+ const { t: s } = L(), { entity: r = "", columns: n = [], hasAction: a = !0, onSortCallback: l } = e, { onSort: o, sortingOrder: c, sortingBy: i } = F(), m = C(() => {
461
461
  var d;
462
- return (d = n.sort((u, N) => (N.pos ?? 0) - (u.pos ?? 0)).filter((u) => u.display !== "none")) == null ? void 0 : d.map((u) => ({
462
+ return (d = n.sort((u, f) => (f.pos ?? 0) - (u.pos ?? 0)).filter((u) => u.display !== "none")) == null ? void 0 : d.map((u) => ({
463
463
  id: u.key,
464
464
  label: u.label,
465
465
  className: u.className ?? "",
466
466
  sortable: u.sortable ?? !0,
467
467
  sortOptions: u.sortOptions
468
468
  }));
469
- }, [n, a, s]);
469
+ }, [n, r, s]);
470
470
  return /* @__PURE__ */ t("thead", { className: "table-headers-row", children: /* @__PURE__ */ b("tr", { children: [
471
471
  m.map((d) => {
472
- var u, N, h, p, v, f, y, w;
472
+ var u, f, h, p, v, N, y, w;
473
473
  return /* @__PURE__ */ t(
474
474
  "th",
475
475
  {
@@ -479,7 +479,7 @@ function be(e) {
479
479
  "button",
480
480
  {
481
481
  disabled: !d.sortable,
482
- onClick: () => c(d.id, l),
482
+ onClick: () => o(d.id, l),
483
483
  className: "table-headers-cell",
484
484
  children: [
485
485
  /* @__PURE__ */ t("span", { className: "table-headers-label", children: d.label }),
@@ -487,12 +487,12 @@ function be(e) {
487
487
  "span",
488
488
  {
489
489
  className: `${i === d.id ? "table-headers-sort-on" : "table-headers-sort"}`,
490
- children: o === _.ASC ? ((N = (u = d.sortOptions) == null ? void 0 : u.icons) == null ? void 0 : N.asc) ?? /* @__PURE__ */ t(
491
- re,
490
+ children: c === _.ASC ? ((f = (u = d.sortOptions) == null ? void 0 : u.icons) == null ? void 0 : f.asc) ?? /* @__PURE__ */ t(
491
+ ae,
492
492
  {
493
493
  className: ((p = (h = d.sortOptions) == null ? void 0 : h.icons) == null ? void 0 : p.className) ?? "table-headers-sort-indicator"
494
494
  }
495
- ) : ((f = (v = d.sortOptions) == null ? void 0 : v.icons) == null ? void 0 : f.desc) ?? /* @__PURE__ */ t(
495
+ ) : ((N = (v = d.sortOptions) == null ? void 0 : v.icons) == null ? void 0 : N.desc) ?? /* @__PURE__ */ t(
496
496
  se,
497
497
  {
498
498
  className: ((w = (y = d.sortOptions) == null ? void 0 : y.icons) == null ? void 0 : w.className) ?? "table-headers-sort-indicator"
@@ -507,7 +507,7 @@ function be(e) {
507
507
  d.id
508
508
  );
509
509
  }),
510
- r && /* @__PURE__ */ t("th", { scope: "col", className: "table-headers-action", children: s("_accessibility:labels.actions") })
510
+ a && /* @__PURE__ */ t("th", { scope: "col", className: "table-headers-action", children: s("_accessibility:labels.actions") })
511
511
  ] }) });
512
512
  }
513
513
  function ge() {
@@ -515,7 +515,7 @@ function ge() {
515
515
  return /* @__PURE__ */ t("div", { className: "table-empty", children: /* @__PURE__ */ t("p", { children: e("_accessibility:components.table.empty") }) });
516
516
  }
517
517
  const ve = () => {
518
- const { t: e } = L(), { total: s, pageSize: a, currentPage: n, setCurrentPage: r } = F();
518
+ const { t: e } = L(), { total: s, pageSize: r, currentPage: n, setCurrentPage: a } = F();
519
519
  return /* @__PURE__ */ b("div", { className: "table-navigation-pages", children: [
520
520
  /* @__PURE__ */ t(
521
521
  "button",
@@ -524,27 +524,27 @@ const ve = () => {
524
524
  disabled: n === 0,
525
525
  "aria-label": e("_accessibility:buttons.previous"),
526
526
  name: e("_accessibility:buttons.previous"),
527
- onClick: () => r(n - 1),
527
+ onClick: () => a(n - 1),
528
528
  children: /* @__PURE__ */ t(le, { className: "w-2.5" })
529
529
  }
530
530
  ),
531
531
  /* @__PURE__ */ t(
532
532
  "button",
533
533
  {
534
- disabled: Math.floor(s / ((n + 1) * a)) === 0,
534
+ disabled: Math.floor(s / ((n + 1) * r)) === 0,
535
535
  className: "table-navigation-buttons",
536
536
  name: e("_accessibility:buttons.next"),
537
537
  "aria-label": e("_accessibility:buttons.next"),
538
- onClick: () => r(n + 1),
539
- children: /* @__PURE__ */ t(ae, { className: "w-2.5" })
538
+ onClick: () => a(n + 1),
539
+ children: /* @__PURE__ */ t(re, { className: "w-2.5" })
540
540
  }
541
541
  )
542
542
  ] });
543
543
  }, Ne = () => {
544
- const { t: e } = L(), { total: s, pageSize: a, pageSizes: n, currentPage: r } = F(), l = (r + 1) * a > s ? s : (r + 1) * a;
544
+ const { t: e } = L(), { total: s, pageSize: r, pageSizes: n, currentPage: a } = F(), l = (a + 1) * r > s ? s : (a + 1) * r;
545
545
  return /* @__PURE__ */ b("div", { className: "table-navigation-sizes", children: [
546
546
  n[0] < s && /* @__PURE__ */ t(D, { children: /* @__PURE__ */ b("p", { children: [
547
- r * a + 1,
547
+ a * r + 1,
548
548
  " - ",
549
549
  l,
550
550
  " ",
@@ -554,7 +554,7 @@ const ve = () => {
554
554
  ] });
555
555
  };
556
556
  function fe() {
557
- const { t: e } = L(), { pageSizes: s, pageSize: a, setPageSize: n } = F(), r = C(
557
+ const { t: e } = L(), { pageSizes: s, pageSize: r, setPageSize: n } = F(), a = C(
558
558
  () => s == null ? void 0 : s.map((l) => ({ id: l, value: l })),
559
559
  [s]
560
560
  );
@@ -563,8 +563,8 @@ function fe() {
563
563
  /* @__PURE__ */ t(
564
564
  J,
565
565
  {
566
- value: a,
567
- options: r,
566
+ value: r,
567
+ options: a,
568
568
  inputClassName: "page-size-input",
569
569
  containerClassName: "page-size-input-container",
570
570
  helperTextClassName: "hidden",
@@ -574,13 +574,13 @@ function fe() {
574
574
  ] });
575
575
  }
576
576
  function Ce() {
577
- const { t: e } = L(), { total: s, pageSize: a, currentPage: n, setCurrentPage: r } = F(), l = C(() => {
578
- const c = Math.ceil(s / a);
579
- return Array.from({ length: c }, (o, i) => ({
577
+ const { t: e } = L(), { total: s, pageSize: r, currentPage: n, setCurrentPage: a } = F(), l = C(() => {
578
+ const o = Math.ceil(s / r);
579
+ return Array.from({ length: o }, (c, i) => ({
580
580
  id: i,
581
581
  value: i + 1
582
582
  }));
583
- }, [s, a]);
583
+ }, [s, r]);
584
584
  return /* @__PURE__ */ b("div", { className: "jump-to-page", children: [
585
585
  /* @__PURE__ */ t("p", { children: e("_accessibility:components.table.jumpToPage") }),
586
586
  /* @__PURE__ */ t(
@@ -591,7 +591,7 @@ function Ce() {
591
591
  inputClassName: "jump-to-page-input",
592
592
  containerClassName: "jump-to-page-input-container",
593
593
  helperTextClassName: "hidden",
594
- onChange: (c) => r(Number(c.target.value))
594
+ onChange: (o) => a(Number(o.target.value))
595
595
  }
596
596
  )
597
597
  ] });
@@ -605,10 +605,10 @@ function ye() {
605
605
  ] });
606
606
  }
607
607
  function we(e) {
608
- const { propertyName: s, options: a, label: n } = e, { currentFilters: r, setCurrentFilters: l } = T(), c = C(() => {
608
+ const { propertyName: s, options: r, label: n } = e, { currentFilters: a, setCurrentFilters: l } = T(), o = C(() => {
609
609
  var i;
610
- return ((i = r[s]) == null ? void 0 : i.value) ?? a[0];
611
- }, [r]), o = k((i) => {
610
+ return ((i = a[s]) == null ? void 0 : i.value) ?? r[0];
611
+ }, [a]), c = k((i) => {
612
612
  l({
613
613
  type: $.update,
614
614
  toUpdate: { [s]: { value: i.target.value } }
@@ -617,79 +617,79 @@ function we(e) {
617
617
  return /* @__PURE__ */ t(
618
618
  J,
619
619
  {
620
- value: c,
620
+ value: o,
621
621
  label: n,
622
- options: a,
622
+ options: r,
623
623
  helperTextClassName: "hidden",
624
624
  containerClassName: "options-widget-container",
625
- onChange: o
625
+ onChange: c
626
626
  }
627
627
  );
628
628
  }
629
629
  const xe = (e) => {
630
- const { propertyName: s, label: a } = e, { currentFilters: n, setCurrentFilters: r } = T(), l = C(() => {
631
- var o;
632
- return ((o = n[s]) == null ? void 0 : o.value) ?? "";
633
- }, [n]), c = k((o) => {
634
- r({
630
+ const { propertyName: s, label: r } = e, { currentFilters: n, setCurrentFilters: a } = T(), l = C(() => {
631
+ var c;
632
+ return ((c = n[s]) == null ? void 0 : c.value) ?? "";
633
+ }, [n]), o = k((c) => {
634
+ a({
635
635
  type: $.update,
636
- toUpdate: { [s]: { value: o.target.value } }
636
+ toUpdate: { [s]: { value: c.target.value } }
637
637
  });
638
638
  }, []);
639
639
  return /* @__PURE__ */ t(
640
640
  U,
641
641
  {
642
642
  value: l ?? "",
643
- label: a,
644
- onChange: c,
643
+ label: r,
644
+ onChange: o,
645
645
  containerClassName: "input-widget-container",
646
646
  helperTextClassName: ""
647
647
  }
648
648
  );
649
649
  }, ke = (e) => {
650
- const { propertyName: s, label: a, min: n, max: r } = e, { currentFilters: l, setCurrentFilters: c } = T(), o = C(() => {
650
+ const { propertyName: s, label: r, min: n, max: a } = e, { currentFilters: l, setCurrentFilters: o } = T(), c = C(() => {
651
651
  var m;
652
652
  return ((m = l[s]) == null ? void 0 : m.value) ?? "";
653
653
  }, [l]), i = k(
654
654
  (m) => {
655
- c({
655
+ o({
656
656
  type: $.update,
657
657
  toUpdate: {
658
658
  [s]: { value: m.target.value }
659
659
  }
660
660
  });
661
661
  },
662
- [o]
662
+ [c]
663
663
  );
664
664
  return /* @__PURE__ */ t(
665
665
  U,
666
666
  {
667
- value: o ?? "",
667
+ value: c ?? "",
668
668
  min: n,
669
- max: r,
669
+ max: a,
670
670
  type: "number",
671
- label: a,
671
+ label: r,
672
672
  containerClassName: "input-widget-container",
673
673
  onChange: i,
674
674
  helperTextClassName: ""
675
675
  }
676
676
  );
677
677
  }, $e = (e) => {
678
- const { propertyName: s, label: a } = e, { currentFilters: n, setCurrentFilters: r } = T(), l = C(() => {
679
- var o;
680
- return ((o = n[s]) == null ? void 0 : o.value) ?? "";
681
- }, [n]), c = k((o) => {
682
- r({
678
+ const { propertyName: s, label: r } = e, { currentFilters: n, setCurrentFilters: a } = T(), l = C(() => {
679
+ var c;
680
+ return ((c = n[s]) == null ? void 0 : c.value) ?? "";
681
+ }, [n]), o = k((c) => {
682
+ a({
683
683
  type: $.update,
684
- toUpdate: { [s]: { value: o.target.checked } }
684
+ toUpdate: { [s]: { value: c.target.checked } }
685
685
  });
686
686
  }, []);
687
- return /* @__PURE__ */ t(ce, { label: a, checked: l ?? !1, onChange: c });
687
+ return /* @__PURE__ */ t(ce, { label: r, checked: l ?? !1, onChange: o });
688
688
  };
689
689
  function Se(e) {
690
- const { propertyName: s, label: a, options: n, multiple: r = !0 } = e, { currentFilters: l, setCurrentFilters: c } = T(), o = C(() => l[s] ?? n[0], [l]), i = k(
690
+ const { propertyName: s, label: r, options: n, multiple: a = !0 } = e, { currentFilters: l, setCurrentFilters: o } = T(), c = C(() => l[s] ?? n[0], [l]), i = k(
691
691
  (m) => {
692
- c({
692
+ o({
693
693
  type: $.update,
694
694
  toUpdate: {
695
695
  [s]: {
@@ -698,15 +698,15 @@ function Se(e) {
698
698
  }
699
699
  });
700
700
  },
701
- [r]
701
+ [a]
702
702
  );
703
703
  return /* @__PURE__ */ t(
704
704
  ie,
705
705
  {
706
- value: o == null ? void 0 : o.value,
707
- label: a,
706
+ value: c == null ? void 0 : c.value,
707
+ label: r,
708
708
  options: n,
709
- multiple: r,
709
+ multiple: a,
710
710
  helperTextClassName: "hidden",
711
711
  containerClassName: "options-widget-container",
712
712
  onChange: i
@@ -714,22 +714,22 @@ function Se(e) {
714
714
  );
715
715
  }
716
716
  const Pe = (e) => {
717
- const { propertyName: s, label: a } = e, { currentFilters: n, setCurrentFilters: r } = T(), l = C(() => {
718
- var o, i;
719
- return (o = n[s]) != null && o.value ? new Date(String((i = n[s]) == null ? void 0 : i.value)).toISOString().slice(0, 10) : "";
720
- }, [n]), c = k((o) => {
721
- r({
717
+ const { propertyName: s, label: r } = e, { currentFilters: n, setCurrentFilters: a } = T(), l = C(() => {
718
+ var c, i;
719
+ return (c = n[s]) != null && c.value ? new Date(String((i = n[s]) == null ? void 0 : i.value)).toISOString().slice(0, 10) : "";
720
+ }, [n]), o = k((c) => {
721
+ a({
722
722
  type: $.update,
723
- toUpdate: { [s]: { value: o.target.value } }
723
+ toUpdate: { [s]: { value: c.target.value } }
724
724
  });
725
725
  }, []);
726
726
  return /* @__PURE__ */ t(
727
727
  U,
728
728
  {
729
729
  value: l ?? "",
730
- label: a,
730
+ label: r,
731
731
  type: "date",
732
- onChange: c,
732
+ onChange: o,
733
733
  containerClassName: "input-widget-container",
734
734
  helperTextClassName: ""
735
735
  }
@@ -752,16 +752,16 @@ const Pe = (e) => {
752
752
  return /* @__PURE__ */ t(D, {});
753
753
  };
754
754
  const Oe = (e) => {
755
- const { align: s = "right", filters: a = [], icon: n } = e, [r, l] = P(!1), { onFilterApply: c, filters: o } = F(), { currentFilters: i, setCurrentFilters: m } = T(), { t: d } = L(), u = W(null), N = W(null);
755
+ const { align: s = "right", filters: r = [], icon: n } = e, [a, l] = P(!1), { onFilterApply: o, filters: c } = F(), { currentFilters: i, setCurrentFilters: m } = T(), { t: d } = L(), u = W(null), f = W(null);
756
756
  return M(() => {
757
757
  const h = ({ target: p }) => {
758
- var v, f;
759
- N.current && (!r || (v = N.current) != null && v.contains(p) || (f = u == null ? void 0 : u.current) != null && f.contains(p) || l(!1));
758
+ var v, N;
759
+ f.current && (!a || (v = f.current) != null && v.contains(p) || (N = u == null ? void 0 : u.current) != null && N.contains(p) || l(!1));
760
760
  };
761
761
  return document.addEventListener("click", h), () => document.removeEventListener("click", h);
762
762
  }), M(() => {
763
763
  const h = (p) => {
764
- !r || p.code !== "Escape" || l(!1);
764
+ !a || p.code !== "Escape" || l(!1);
765
765
  };
766
766
  return document.addEventListener("keydown", h), () => document.removeEventListener("keydown", h);
767
767
  }), /* @__PURE__ */ b("div", { className: "filter-dropdown-main", children: [
@@ -771,8 +771,8 @@ const Oe = (e) => {
771
771
  ref: u,
772
772
  className: "filter-dropdown-button normal filter-dropdown-trigger",
773
773
  "aria-haspopup": "true",
774
- onClick: () => l(!r),
775
- "aria-expanded": r,
774
+ onClick: () => l(!a),
775
+ "aria-expanded": a,
776
776
  children: [
777
777
  /* @__PURE__ */ t("span", { className: "sr-only", children: d("_accessibility:buttons.filters") }),
778
778
  /* @__PURE__ */ t("wbr", {}),
@@ -783,15 +783,15 @@ const Oe = (e) => {
783
783
  /* @__PURE__ */ t(
784
784
  "div",
785
785
  {
786
- className: `filter-dropdown-transition ${r ? "opened" : "closed"} ${s === "right" ? "right" : "left"}`,
787
- children: /* @__PURE__ */ b("div", { ref: N, children: [
786
+ className: `filter-dropdown-transition ${a ? "opened" : "closed"} ${s === "right" ? "right" : "left"}`,
787
+ children: /* @__PURE__ */ b("div", { ref: f, children: [
788
788
  /* @__PURE__ */ t("div", { className: "filter-title", children: d("_accessibility:buttons.filters") }),
789
- /* @__PURE__ */ t("ul", { className: "filter-container", children: a.map((h) => /* @__PURE__ */ t("li", { className: "filter-container-item", children: ze(h) }, h.propertyName)) }),
789
+ /* @__PURE__ */ t("ul", { className: "filter-container", children: r.map((h) => /* @__PURE__ */ t("li", { className: "filter-container-item", children: ze(h) }, h.propertyName)) }),
790
790
  /* @__PURE__ */ t("div", { className: "filter-footer", children: /* @__PURE__ */ b("ul", { className: "filter-buttons-row", children: [
791
791
  /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
792
792
  "button",
793
793
  {
794
- onClick: () => m({ type: $.reset, filters: a }),
794
+ onClick: () => m({ type: $.reset, filters: r }),
795
795
  className: "filter-dropdown-button small filter-dropdown-cancel",
796
796
  children: d("_accessibility:buttons.clear")
797
797
  }
@@ -801,7 +801,7 @@ const Oe = (e) => {
801
801
  {
802
802
  className: "filter-dropdown-button small filter-dropdown-submit bg-primary hover:bg-light-primary",
803
803
  onClick: () => {
804
- l(!1), c(i);
804
+ l(!1), o(i);
805
805
  },
806
806
  onBlur: () => l(!1),
807
807
  children: d("_accessibility:buttons.applyFilters")
@@ -813,59 +813,59 @@ const Oe = (e) => {
813
813
  )
814
814
  ] });
815
815
  }, Ee = (e) => e, Le = (e) => {
816
- const { columns: s, softDeleteProperty: a = "deleted", data: n, actions: r } = e, l = C(
817
- () => s.sort((c, o) => (o.pos ?? 0) - (c.pos ?? 0)).filter((c) => c.display !== "none"),
816
+ const { columns: s, softDeleteProperty: r = "deleted", data: n, actions: a } = e, l = C(
817
+ () => s.sort((o, c) => (c.pos ?? 0) - (o.pos ?? 0)).filter((o) => o.display !== "none"),
818
818
  [s]
819
819
  );
820
- return n == null ? void 0 : n.map((c) => {
821
- var o;
820
+ return n == null ? void 0 : n.map((o) => {
821
+ var c;
822
822
  return /* @__PURE__ */ b(
823
823
  "tr",
824
824
  {
825
- className: `table-row ${c[a] ? "deleted-class" : ""}`,
825
+ className: `table-row ${o[r] ? "deleted-class" : ""}`,
826
826
  children: [
827
827
  l == null ? void 0 : l.map((i, m) => /* @__PURE__ */ t(
828
828
  "td",
829
829
  {
830
830
  className: `table-row-cell ${m === 0 ? "basic" : ""} ${i.className ?? ""}`,
831
- children: i.renderBody ? i.renderBody(c[i.key], c) : Ee(c[i.key])
831
+ children: i.renderBody ? i.renderBody(o[i.key], o) : Ee(o[i.key])
832
832
  },
833
833
  i.key
834
834
  )),
835
- r ? /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("div", { className: "table-row-cell-action", children: (o = r(c).filter((i) => !i.hidden)) == null ? void 0 : o.map((i) => /* @__PURE__ */ t(Fe, { content: i.tooltip, children: /* @__PURE__ */ t("button", { onClick: i.onClick, children: i.icon }) }, i.id)) }) }) : null
835
+ a ? /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("div", { className: "table-row-cell-action", children: (c = a(o).filter((i) => !i.hidden)) == null ? void 0 : c.map((i) => /* @__PURE__ */ t(Fe, { content: i.tooltip, children: /* @__PURE__ */ t("button", { onClick: () => i.onClick(o), children: i.icon }) }, i.id)) }) }) : null
836
836
  ]
837
837
  },
838
- c.id
838
+ o.id
839
839
  );
840
840
  });
841
841
  };
842
842
  function je(e) {
843
843
  const {
844
844
  title: s = "",
845
- data: a,
845
+ data: r,
846
846
  onSort: n,
847
- entity: r = "",
847
+ entity: a = "",
848
848
  isLoading: l = !1,
849
- actions: c,
850
- columns: o = [],
849
+ actions: o,
850
+ columns: c = [],
851
851
  contentClassName: i = "",
852
852
  className: m = "",
853
853
  toolbar: d = /* @__PURE__ */ t(D, {}),
854
854
  softDeleteProperty: u = "deleted"
855
- } = e, N = C(() => o ? o.sort((p, v) => (v.pos ?? 0) - (p.pos ?? 0)).filter((p) => !!p.filterOptions).map((p) => {
855
+ } = e, f = C(() => c ? c.sort((p, v) => (v.pos ?? 0) - (p.pos ?? 0)).filter((p) => !!p.filterOptions).map((p) => {
856
856
  var v;
857
857
  return {
858
858
  ...p.filterOptions,
859
859
  label: ((v = p.filterOptions) == null ? void 0 : v.label) ?? p.label,
860
860
  propertyName: p.key
861
861
  };
862
- }) : [], [o]), h = C(() => !(a != null && a.length), [a]);
862
+ }) : [], [c]), h = C(() => !(r != null && r.length), [r]);
863
863
  return /* @__PURE__ */ t(me, { children: /* @__PURE__ */ b("div", { className: `${m} table-main`, children: [
864
864
  /* @__PURE__ */ b("div", { className: "table-header", children: [
865
865
  /* @__PURE__ */ t("h1", { className: "table-header-title", children: s }),
866
866
  l ? null : /* @__PURE__ */ b("div", { className: "table-header-right", children: [
867
867
  d,
868
- /* @__PURE__ */ t(Oe, { filters: N })
868
+ /* @__PURE__ */ t(Oe, { filters: f })
869
869
  ] })
870
870
  ] }),
871
871
  l ? /* @__PURE__ */ t(de, { className: "table-loading" }) : /* @__PURE__ */ t(D, { children: h ? /* @__PURE__ */ t(ge, {}) : /* @__PURE__ */ b(D, { children: [
@@ -873,18 +873,18 @@ function je(e) {
873
873
  /* @__PURE__ */ t(
874
874
  be,
875
875
  {
876
- entity: r,
877
- columns: o,
876
+ entity: a,
877
+ columns: c,
878
878
  onSortCallback: n,
879
- hasAction: !!c
879
+ hasAction: !!o
880
880
  }
881
881
  ),
882
882
  /* @__PURE__ */ t("tbody", { children: /* @__PURE__ */ t(
883
883
  Le,
884
884
  {
885
- data: a,
886
- actions: c,
887
- columns: o,
885
+ data: r,
886
+ actions: o,
887
+ columns: c,
888
888
  softDeleteProperty: u
889
889
  }
890
890
  ) })
@@ -894,9 +894,9 @@ function je(e) {
894
894
  ] }) });
895
895
  }
896
896
  function Fe(e) {
897
- const { content: s, children: a } = e;
897
+ const { content: s, children: r } = e;
898
898
  return /* @__PURE__ */ b("div", { className: "tooltip-container", children: [
899
- a,
899
+ r,
900
900
  /* @__PURE__ */ t("div", { className: "tooltip-text", children: s })
901
901
  ] });
902
902
  }
@@ -904,11 +904,11 @@ var z = /* @__PURE__ */ ((e) => (e.empty = "empty", e.outlined = "outlined", e.d
904
904
  function Te(e) {
905
905
  const {
906
906
  label: s,
907
- onDelete: a,
907
+ onDelete: r,
908
908
  className: n = "",
909
- spanClassName: r = "",
909
+ spanClassName: a = "",
910
910
  variant: l = z.default
911
- } = e, c = C(() => {
911
+ } = e, o = C(() => {
912
912
  switch (l) {
913
913
  case z.empty:
914
914
  return "text-primary bg-transparent";
@@ -918,7 +918,7 @@ function Te(e) {
918
918
  default:
919
919
  return "text-white bg-primary";
920
920
  }
921
- }, [l]), o = C(() => {
921
+ }, [l]), c = C(() => {
922
922
  switch (l) {
923
923
  case z.empty:
924
924
  case z.outlined:
@@ -928,9 +928,9 @@ function Te(e) {
928
928
  return "filled-chip-delete-button-svg";
929
929
  }
930
930
  }, [l]);
931
- return /* @__PURE__ */ b("div", { className: `chip-main ${c} ${n}`, children: [
932
- /* @__PURE__ */ t("span", { className: r, children: s }),
933
- a ? /* @__PURE__ */ t("button", { type: "button", className: "chip-delete-button", onClick: a, children: /* @__PURE__ */ t(K, { className: o }) }) : null
931
+ return /* @__PURE__ */ b("div", { className: `chip-main ${o} ${n}`, children: [
932
+ /* @__PURE__ */ t("span", { className: a, children: s }),
933
+ r ? /* @__PURE__ */ t("button", { type: "button", className: "chip-delete-button", onClick: r, children: /* @__PURE__ */ t(K, { className: c }) }) : null
934
934
  ] });
935
935
  }
936
936
  export {
@@ -938,8 +938,8 @@ export {
938
938
  ce as CheckInput,
939
939
  se as ChevronDown,
940
940
  le as ChevronLeft,
941
- ae as ChevronRight,
942
- re as ChevronUp,
941
+ re as ChevronRight,
942
+ ae as ChevronUp,
943
943
  Te as Chip,
944
944
  z as ChipVariant,
945
945
  K as Close,
@@ -1,2 +1,3 @@
1
1
  export * from './filters';
2
2
  export * from './query';
3
+ export * from './models';
@@ -0,0 +1,4 @@
1
+ export type BaseDto = {
2
+ id: number;
3
+ deleted: boolean;
4
+ };
@@ -0,0 +1 @@
1
+ export * from './BaseDto';
@@ -1,7 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { FiltersValue, SortOrder } from '../../lib';
3
3
  export type TableOptionsContextType = {
4
- onSort: (column: string, onSortCallback: (prop: string, sortOrder: SortOrder) => void) => void;
4
+ onSort: (column: string, onSortCallback?: (prop: string, sortOrder: SortOrder) => void) => void;
5
5
  total: number;
6
6
  setTotal: (total: number) => void;
7
7
  sortingBy: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sito/dashboard",
3
3
  "private": false,
4
- "version": "0.0.33",
4
+ "version": "0.0.35",
5
5
  "type": "module",
6
6
  "description": "UI library with custom components for dashboards",
7
7
  "main": "dist/dashboard.cjs",
@@ -10,10 +10,14 @@
10
10
  "files": [
11
11
  "dist/"
12
12
  ],
13
+ "homepage": "https://github.com/sito8943/-sito-dashboard#readme",
13
14
  "repository": {
14
15
  "type": "git",
15
16
  "url": "https://github.com/sito8943/-sito-dashboard.git"
16
17
  },
18
+ "bugs": {
19
+ "url": "https://github.com/sito8943/-sito-dashboard/issues"
20
+ },
17
21
  "exports": {
18
22
  ".": {
19
23
  "import": "./dist/dashboard.js",