@sito/dashboard 0.0.67 → 0.0.69

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.
Files changed (78) hide show
  1. package/README.md +7 -0
  2. package/dist/{Dropdown-CAxauIXt.cjs → Dropdown-CR8mco5s.cjs} +1 -1
  3. package/dist/{Dropdown-CbaxuMbk.js → Dropdown-D-fYEGo2.js} +13 -14
  4. package/dist/Dropdown.cjs +1 -1
  5. package/dist/Dropdown.css +1 -1
  6. package/dist/Dropdown.js +1 -1
  7. package/dist/FileInput-CqzVk1gQ.cjs +1 -0
  8. package/dist/{FileInput-DCR_Pyqe.js → FileInput-Cr4TxWUg.js} +34 -32
  9. package/dist/FiltersProvider-BoCTMqk8.js +60 -0
  10. package/dist/FiltersProvider-Bxge43VS.cjs +1 -0
  11. package/dist/FiltersProvider.cjs +1 -1
  12. package/dist/FiltersProvider.js +1 -1
  13. package/dist/Form.cjs +1 -1
  14. package/dist/Form.js +2 -2
  15. package/dist/Table-BLhy0EYJ.cjs +1 -0
  16. package/dist/Table-CeD0yXGZ.js +1113 -0
  17. package/dist/Table.cjs +1 -1
  18. package/dist/Table.css +1 -1
  19. package/dist/Table.js +1 -1
  20. package/dist/TableOptions.cjs +1 -1
  21. package/dist/TableOptions.js +1 -1
  22. package/dist/TableOptionsProvider-BJdeNIQj.cjs +1 -0
  23. package/dist/TableOptionsProvider-DBr-FW53.js +106 -0
  24. package/dist/TextInput-C27RFuya.cjs +1 -0
  25. package/dist/TextInput-DPYxzgm3.js +335 -0
  26. package/dist/TextInput.css +1 -1
  27. package/dist/Translation.cjs +1 -1
  28. package/dist/Translation.js +1 -1
  29. package/dist/{TranslationProvider-COebIyxr.js → TranslationProvider-BR4s--Vu.js} +2 -2
  30. package/dist/TranslationProvider-Czr0WIDH.cjs +1 -0
  31. package/dist/components/Dropdown/Dropdown.d.ts +1 -1
  32. package/dist/components/Form/FileInput/types.d.ts +1 -1
  33. package/dist/components/Table/components/types.d.ts +1 -1
  34. package/dist/components/Table/types.d.ts +1 -1
  35. package/dist/index.cjs +1 -1
  36. package/dist/index.css +1 -1
  37. package/dist/index.js +7 -7
  38. package/dist/providers/Translation/TranslationProvider.d.ts +5 -4
  39. package/package.json +1 -1
  40. package/dist/FileInput-Ch-GCxrS.cjs +0 -1
  41. package/dist/FiltersProvider-CY2fsw_F.js +0 -57
  42. package/dist/FiltersProvider-CYqLFEI9.cjs +0 -1
  43. package/dist/Table-BtZGG0d7.js +0 -1056
  44. package/dist/Table-DjIhOMXQ.cjs +0 -1
  45. package/dist/TableOptionsProvider-BchUDA3B.cjs +0 -1
  46. package/dist/TableOptionsProvider-BfQS8l1N.js +0 -50
  47. package/dist/TextInput-BqW5YX-3.js +0 -320
  48. package/dist/TextInput-CY1fh4mf.cjs +0 -1
  49. package/dist/TranslationProvider-51Pc9Xrr.cjs +0 -1
  50. package/dist/components/Actions/Actions.stories.d.ts +0 -20
  51. package/dist/components/Actions/Actions.test.d.ts +0 -1
  52. package/dist/components/Actions/ActionsDropdown.stories.d.ts +0 -17
  53. package/dist/components/Actions/ActionsDropdown.test.d.ts +0 -1
  54. package/dist/components/Badge/Badge.stories.d.ts +0 -8
  55. package/dist/components/Button/Button.stories.d.ts +0 -29
  56. package/dist/components/Chip/Chip.stories.d.ts +0 -9
  57. package/dist/components/Dropdown/Dropdown.stories.d.ts +0 -8
  58. package/dist/components/Dropdown/Dropdown.test.d.ts +0 -1
  59. package/dist/components/Form/AutocompleteInput/AutocompleteInput.stories.d.ts +0 -8
  60. package/dist/components/Form/CheckInput/CheckInput.stories.d.ts +0 -6
  61. package/dist/components/Form/FileInput/FileInput.stories.d.ts +0 -7
  62. package/dist/components/Form/FileInput/FileInput.test.d.ts +0 -1
  63. package/dist/components/Form/FileInput/utils.test.d.ts +0 -1
  64. package/dist/components/Form/SelectInput/SelectInput.stories.d.ts +0 -7
  65. package/dist/components/Form/TextInput/TextInput.stories.d.ts +0 -10
  66. package/dist/components/Form/TextInput/TextInput.test.d.ts +0 -1
  67. package/dist/components/Form/utils.test.d.ts +0 -1
  68. package/dist/components/IconButton/IconButton.stories.d.ts +0 -30
  69. package/dist/components/Loading/Loading.stories.d.ts +0 -7
  70. package/dist/components/Table/Table.expandable.test.d.ts +0 -1
  71. package/dist/components/Table/Table.selection.test.d.ts +0 -1
  72. package/dist/components/Table/Table.stories.d.ts +0 -18
  73. package/dist/components/Table/components/Filters/FilterDropdown/FilterDropdown.test.d.ts +0 -1
  74. package/dist/components/Table/components/TableSelectionBar.test.d.ts +0 -1
  75. package/dist/components/Table/utils.test.d.ts +0 -1
  76. package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -6
  77. package/dist/providers/FiltersProvider/utils.test.d.ts +0 -1
  78. package/dist/providers/TableOptions/TableOptionsProvider.test.d.ts +0 -1
@@ -1 +0,0 @@
1
- var Ee=require("./Table.css");const e=require("react/jsx-runtime"),o=require("react"),w=require("./FiltersProvider-CYqLFEI9.cjs"),xe=require("./Badge-Z78MlGoQ.cjs"),B=require("./Filters-Dyee8QYH.cjs"),z=require("./lib.cjs"),A=require("./TranslationProvider-51Pc9Xrr.cjs"),$=require("./TextInput-CY1fh4mf.cjs"),_=require("./TableOptionsProvider-BchUDA3B.cjs"),J=require("./Chip-D17UJHW6.cjs"),L=require("./IconButton-CVnmT2E9.cjs"),G=require("./Tooltip-BSKAgRkc.cjs"),be=require("./query-81BrXp3i.cjs"),fe=require("./Button-BlYa3uPc.cjs"),je=require("./Dropdown-CAxauIXt.cjs"),ge=require("./Loading-CNECRan-.cjs");function K(s){const{id:t,icon:r,tooltip:n,onClick:l,children:a,hidden:p=!1,disabled:i=!1,showText:d=!1,showTooltips:c=!0,className:h=""}=s;return p?null:e.jsxs("button",{id:t,className:`action ${d?"text-action":"icon-action"} ${h}`,disabled:i,onClick:()=>l?.(),"aria-disabled":i,"data-tooltip-id":"tooltip","data-tooltip-content":c?n:"",children:[r," ",d&&n,a]})}function Q(s){const{actions:t=[],className:r="",itemClassName:n="",actionClassName:l="",showTooltips:a=!0,showActionTexts:p=!1}=s;return e.jsx("ul",{className:`actions-container ${r}`,children:t.map(i=>e.jsx("li",{className:`actions-container-item ${n}`,children:e.jsx(K,{showTooltips:a,showText:p,className:l,...i})},i.id))})}const Y=s=>{const{actions:t=[],className:r=""}=s,{t:n}=A.useTranslation(),[l,a]=o.useState(!1),[p,i]=o.useState(null);return e.jsxs("div",{className:`actions-dropdown ${r}`,children:[e.jsx(L.IconButton,{icon:e.jsx(B.Ellipsis,{}),onClick:d=>{i(d.currentTarget),a(c=>!c)},className:"actions-dropdown-trigger","data-tooltip-id":"tooltip","data-tooltip-content":n("_accessibility:buttons.openActions")}),e.jsx(je.Dropdown,{open:l,onClose:()=>a(!1),anchorEl:p,children:e.jsx(Q,{showActionTexts:!0,actions:t,itemClassName:"w-full",actionClassName:"action-dropdown-item",className:"actions-dropdown-list",showTooltips:!1})})]})};function Z(s){return[...s].sort((t,r)=>(r.pos??0)-(t.pos??0)).filter(t=>t.display!=="none")}function ee(s){const{t}=A.useTranslation(),{entity:r="",columns:n=[],hasAction:l=!0,onSortCallback:a,selectionState:p,onToggleAllRows:i}=s,d=o.useRef(null);o.useEffect(()=>{d.current&&(d.current.indeterminate=!!(p?.hasSomeSelected&&!p?.allSelected))},[p]);const{onSort:c,sortingOrder:h,sortingBy:x}=_.useTableOptions(),b=o.useMemo(()=>Z(n).map(u=>({id:u.key,label:u.label,className:u.className??"",sortable:u.sortable??!0,sortOptions:u.sortOptions})),[n,r,t]);return e.jsx("thead",{className:"table-headers-row",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"table-headers-column table-headers-checkbox",children:i?e.jsx("input",{type:"checkbox",ref:d,checked:p?.allSelected??!1,onChange:i,"aria-label":t("_accessibility:components.table.selectAllRows")}):null}),l&&e.jsx("th",{scope:"col",className:"table-headers-action",children:e.jsx("span",{children:t("_accessibility:labels.actions")})}),b.map(u=>e.jsx("th",{scope:"col",className:`table-headers-column ${u.className}`,children:e.jsxs(fe.Button,{disabled:!u.sortable,onClick:()=>c(u.id,a),className:"table-headers-cell",children:[e.jsx("span",{className:"table-headers-label",children:u.label}),u.sortable&&x===u.id&&e.jsx("span",{children:h===be.SortOrder.ASC?u.sortOptions?.icons?.asc??e.jsx(B.ChevronUp,{className:u.sortOptions?.icons?.className??"table-headers-sort-indicator"}):u.sortOptions?.icons?.desc??e.jsx(B.ChevronDown,{className:u.sortOptions?.icons?.className??"table-headers-sort-indicator"})})]})},u.id))]})})}const te=s=>{const{items:t,text:r,id:n,onClearFilter:l}=s;return e.jsx(J.Chip,{text:`${r}: ${t.map(a=>a.value??a.name).join(", ")}`,onDelete:()=>l(n)})},se=s=>{const{end:t,start:r,text:n,id:l,onClearFilter:a}=s;return e.jsx(J.Chip,{text:`${n}: ${r||"♾️"} - ${t||"♾️"}`,onDelete:()=>a(l)})},ne=s=>{const{filtersDefinition:t}=s,r=o.useMemo(()=>{const i={};return t.forEach(d=>{i[d.propertyName]=d.label??d.propertyName}),i},[t]),{filters:n,clearFilters:l}=_.useTableOptions(),a=o.useMemo(()=>Object.keys(n),[n]),p=o.useCallback(i=>n[i]?.end||n[i]?.start?e.jsx(se,{id:i,text:r[i],start:n[i].start,end:n[i].end,onClearFilter:l}):Array.isArray(n[i])?e.jsx(te,{id:i,text:r[i],items:n[i],onClearFilter:l}):e.jsx(J.Chip,{text:`${r[i]}: ${n[i]?.value??n[i]?.name??n[i]}`,onDelete:()=>l(i)}),[n,r]);return e.jsx("ul",{className:"active-filters-main",children:a?.map(i=>e.jsx("li",{children:p(i)},i))})};function Ce(s){const{propertyName:t,label:r,placeholder:n,options:l,multiple:a=!0}=s,{currentFilters:p,setCurrentFilters:i}=w.useFilters(),d=o.useMemo(()=>p[t]??l[0],[p]),c=o.useCallback(h=>{i({type:w.FiltersActions.update,toUpdate:{[t]:{value:h}}})},[a]);return e.jsx($.AutocompleteInput,{value:d?.value,label:r,options:l,multiple:a,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:c,placeholder:n})}const Ne=s=>{const{propertyName:t,label:r}=s,{currentFilters:n,setCurrentFilters:l}=w.useFilters(),a=o.useMemo(()=>n[t]?.value??"",[n]),p=o.useCallback(i=>{l({type:w.FiltersActions.update,toUpdate:{[t]:{value:i.target.checked}}})},[]);return e.jsx($.CheckInput,{label:r,checked:a??!1,onChange:p})};function Te(s){const{propertyName:t,options:r,label:n,placeholder:l}=s,{currentFilters:a,setCurrentFilters:p}=w.useFilters(),i=o.useMemo(()=>a[t]?.value??r[0],[a]),d=o.useCallback(c=>{p({type:w.FiltersActions.update,toUpdate:{[t]:{value:c.target.value}}})},[]);return e.jsx($.SelectInput,{value:i,label:n,options:r,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:d,placeholder:l})}const ve=s=>{const{propertyName:t,label:r,placeholder:n}=s,{currentFilters:l,setCurrentFilters:a}=w.useFilters(),p=o.useMemo(()=>l[t]?.value??"",[l]),i=o.useCallback(d=>{a({type:w.FiltersActions.update,toUpdate:{[t]:{value:d.target.value}}})},[]);return e.jsx($.TextInput,{value:p??"",label:r,onChange:i,containerClassName:"input-widget-container",helperTextClassName:"",placeholder:n})},X=s=>{const{propertyName:t,label:r,inputType:n}=s,{t:l}=A.useTranslation(),{currentFilters:a,setCurrentFilters:p}=w.useFilters(),i=o.useRef(null),d=o.useRef(null),c=o.useCallback(x=>{p({type:w.FiltersActions.update,toUpdate:{[t]:{value:{end:d?.current?.value??null,start:x.target.value}}}})},[]),h=o.useCallback(x=>{p({type:w.FiltersActions.update,toUpdate:{[t]:{value:{start:i?.current?.value??null,end:x.target.value}}}})},[]);return e.jsxs("div",{className:"range-widget-container",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($.TextInput,{value:a[t]?.value?.start??"",placeholder:l("_accessibility:components.table.filters.range.start"),type:n,ref:i,onChange:c,containerClassName:"input-widget-container",helperTextClassName:""}),e.jsx($.TextInput,{value:a[t]?.value?.end??"",placeholder:l("_accessibility:components.table.filters.range.end"),type:n,ref:d,onChange:h,containerClassName:"input-widget-container",helperTextClassName:""})]})]})},le=s=>{switch(s.type){case z.FilterTypes.text:return e.jsx(ve,{...s});case z.FilterTypes.number:return e.jsx(X,{...s,inputType:"number"});case z.FilterTypes.date:return e.jsx(X,{...s,inputType:"date"});case z.FilterTypes.select:return e.jsx(Te,{...s});case z.FilterTypes.autocomplete:return e.jsx(Ce,{...s});case z.FilterTypes.check:return e.jsx(Ne,{...s})}return e.jsx(e.Fragment,{})},ae=s=>{const{filters:t=[],show:r,handleShow:n}=s,{onFilterApply:l}=_.useTableOptions(),{currentFilters:a,setCurrentFilters:p}=w.useFilters(),{t:i}=A.useTranslation(),d=o.useRef(null);return o.useEffect(()=>{const c=({target:x})=>{d.current&&(x?.closest(".filter-dropdown-trigger")||!r||d.current.contains(x)||n(!1))},h=({code:x})=>{!r||x!=="Escape"||n(!1)};return document.addEventListener("click",c),document.addEventListener("keydown",h),()=>{document.removeEventListener("click",c),document.removeEventListener("keydown",h)}},[n,r]),e.jsx("div",{className:`filter-dropdown-backdrop ${r?"opened":"closed"}`,children:e.jsxs("div",{className:"filter-popup",ref:d,children:[e.jsx("div",{className:"filter-title",children:i("_accessibility:buttons.filters")}),e.jsx("ul",{className:"filter-container",children:t.map(c=>e.jsx("li",{className:"filter-container-item",children:le(c)},c.propertyName))}),e.jsx("div",{className:"filter-footer",children:e.jsxs("ul",{className:"filter-buttons-row",children:[e.jsx("li",{children:e.jsx("button",{onClick:()=>p({type:w.FiltersActions.reset,filters:t}),className:"filter-dropdown-button small filter-dropdown-cancel",children:i("_accessibility:buttons.clear")})}),e.jsx("li",{children:e.jsx("button",{className:"filter-dropdown-button small filter-dropdown-submit",onClick:()=>{n(!1),l(a)},children:i("_accessibility:buttons.applyFilters")})})]})})]})})},re=()=>{const{t:s}=A.useTranslation(),{total:t,pageSize:r,pageSizes:n,currentPage:l}=_.useTableOptions(),a=(l+1)*r>t?t:(l+1)*r;return e.jsxs("div",{className:"table-navigation-sizes",children:[n[0]<t&&e.jsx(e.Fragment,{children:e.jsxs("p",{children:[l*r+1," - ",a," ",s("_accessibility:components.table.of")]})}),e.jsx("p",{children:t})]})};function we(){const{t:s}=A.useTranslation(),{total:t,pageSize:r,currentPage:n,setCurrentPage:l}=_.useTableOptions(),a=o.useMemo(()=>{const p=Math.ceil(t/r);return Array.from({length:p},(i,d)=>({id:d,value:d+1}))},[t,r]);return e.jsxs("div",{className:"jump-to-page",children:[e.jsx("p",{children:s("_accessibility:components.table.jumpToPage")}),e.jsx($.SelectInput,{value:n,options:a,inputClassName:"jump-to-page-input",containerClassName:"jump-to-page-input-container",helperTextClassName:"hidden",onChange:p=>l(Number(p.target.value))})]})}const ie=()=>{const{t:s}=A.useTranslation(),{total:t,pageSize:r,currentPage:n,setCurrentPage:l}=_.useTableOptions();return e.jsxs("div",{className:"table-navigation-pages",children:[e.jsx(L.IconButton,{icon:e.jsx(B.ChevronLeft,{className:"table-navigation-icon"}),className:"table-navigation-buttons",disabled:n===0,"aria-label":s("_accessibility:buttons.previous"),name:s("_accessibility:buttons.previous"),onClick:()=>l(n-1)}),e.jsx(L.IconButton,{icon:e.jsx(B.ChevronRight,{className:"table-navigation-icon"}),disabled:Math.floor(t/((n+1)*r))===0,className:"table-navigation-buttons",name:s("_accessibility:buttons.next"),"aria-label":s("_accessibility:buttons.next"),onClick:()=>l(n+1)})]})};function oe(){const{t:s}=A.useTranslation(),{pageSizes:t,pageSize:r,setPageSize:n}=_.useTableOptions(),l=o.useMemo(()=>t?.map(a=>({id:a,value:a})),[t]);return e.jsxs("div",{className:"page-size",children:[e.jsx("p",{children:s("_accessibility:components.table.pageSizes")}),e.jsx($.SelectInput,{value:r,options:l,inputClassName:"page-size-input",containerClassName:"page-size-input-container",helperTextClassName:"hidden",onChange:a=>n(Number(a.target.value))})]})}function ce(){return e.jsxs("div",{className:"table-footer",children:[e.jsx(we,{}),e.jsx(oe,{}),e.jsx(re,{}),e.jsx(ie,{})]})}const ye=s=>s,ue=s=>{const{t}=A.useTranslation(),{columns:r,softDeleteProperty:n="deletedAt",data:l,actions:a,selectedRows:p,expandedRows:i=[],onRowSelectionChange:d,onRowExpand:c}=s,h=o.useMemo(()=>Z(r),[r]),x=o.useMemo(()=>new Map(i.map(b=>[b.rowId,b])),[i]);return l?.map(b=>{const u=p.has(b.id),T=x.get(b.id),S=!!T,P=h.length+1+(a?1:0);return e.jsxs(o.Fragment,{children:[e.jsxs("tr",{className:`table-row ${c?"expandable":""} ${b[n]?"deleted-class":""} ${u?"selected":""} ${S?"expanded":""}`,onClick:()=>c?.(b),children:[e.jsx("td",{className:"table-row-cell table-row-checkbox",children:e.jsx("input",{type:"checkbox",checked:u,onClick:C=>C.stopPropagation(),onChange:()=>d(b),"aria-label":t("_accessibility:components.table.selectRow")})}),a?e.jsx("td",{className:"w-px",children:e.jsx("div",{className:"table-row-cell-action",children:(()=>{const C=a(b).filter(j=>!j.hidden),O=C.filter(j=>j.sticky),k=C.filter(j=>!j.sticky);return e.jsxs(e.Fragment,{children:[O.map(j=>e.jsx(G.Tooltip,{content:j.tooltip,children:e.jsx(L.IconButton,{icon:j.icon,className:"row-table-action",onClick:E=>{E.stopPropagation(),j.onClick(b)}})},j.id)),k.length>0&&e.jsx(Y,{actions:k})]})})()})}):null,h?.map((C,O)=>e.jsx("td",{className:`table-row-cell ${O===0?"basic":""} ${C.className??""}`,children:C.renderBody?C.renderBody(b[C.key],b):ye(b[C.key])},C.key))]}),S&&T?.content!==null&&typeof T?.content<"u"&&e.jsx("tr",{className:"table-row-expanded",children:e.jsx("td",{className:"table-row-expanded-cell",colSpan:P,children:e.jsx("div",{className:`table-row-expanded-content ${T.isVisible?"open":"closed"}`,children:e.jsx("div",{className:"table-row-expanded-inner",children:T.content})})})})]},b.id)})};function de(){const{t:s}=A.useTranslation();return e.jsx("div",{className:"table-empty",children:e.jsx("p",{children:s("_accessibility:components.table.empty")})})}const pe=s=>{const{columns:t,title:r,isLoading:n,toolbar:l,filterOptions:a}=s,{countOfFilters:p}=_.useTableOptions(),{t:i}=A.useTranslation(),d=o.useMemo(()=>t?t.sort((u,T)=>(T.pos??0)-(u.pos??0)).filter(u=>!!u.filterOptions).map(u=>({...u.filterOptions,label:u.filterOptions?.label??u.label,propertyName:u.key})):[],[t]),[c,h]=o.useState(!1),x=o.useCallback(u=>{a?.dropdown?.setOpened?a.dropdown.setOpened(u??!1):h(u??!1)},[a]),b=o.useMemo(()=>a?.dropdown?.opened??c,[a,c]);return e.jsxs("div",{className:`table-header ${b?"showing-filters":""}`,children:[e.jsxs("div",{children:[r&&e.jsx("h1",{className:"table-header-title",children:r}),n?null:e.jsxs("div",{className:"table-header-content",children:[l,a?.button?.hide!==!0&&e.jsxs(L.IconButton,{icon:a?.button?.icon??e.jsx(B.Filters,{className:"filter-dropdown-trigger-icon"}),className:"filter-dropdown-button normal filter-dropdown-trigger","aria-haspopup":"true",onClick:()=>x(!b),"aria-expanded":b,children:[e.jsx(xe.Badge,{count:p,className:`${p>0?"show":"hide"} `}),e.jsx("span",{className:"table-header-sr",children:i("_accessibility:buttons.filters")}),e.jsx("wbr",{})]})]})]}),!!d&&!!d.length&&e.jsx(ae,{filters:d,show:b,handleShow:x,options:a}),e.jsx(ne,{filtersDefinition:d})]})};function me({count:s,multiActions:t,onActionClick:r}){const{t:n}=A.useTranslation();return e.jsxs("div",{className:"table-selection-bar",children:[e.jsx("p",{className:"table-selection-bar-count",children:n("_accessibility:components.table.selectedCount",{count:s})}),t.length>0&&e.jsx("div",{className:"table-selection-bar-actions",children:t.map(l=>e.jsx(G.Tooltip,{content:l.tooltip,children:e.jsx(L.IconButton,{icon:l.icon,className:"multi-table-action",onClick:()=>r(l),disabled:l.disabled})},l.id))})]})}const H=220;function Se({data:s,allowMultipleExpandedRows:t,controlledExpandedRowId:r,onExpandedRowChange:n,onRowExpand:l,findRowById:a}){const[p,i]=o.useState(null),[d,c]=o.useState(null),[h,x]=o.useState(null),[b,u]=o.useState(null),[T,S]=o.useState(!1),[P,C]=o.useState(new Set),[O,k]=o.useState([]),j=o.useRef(null),E=o.useRef(null),I=o.useRef(new Map),F=typeof r<"u",R=t&&!F,N=F?r??null:p,D=o.useCallback(()=>{E.current&&(clearTimeout(E.current),E.current=null)},[]),y=o.useCallback(m=>{if(typeof m<"u"){const f=I.current.get(m);if(!f)return;clearTimeout(f),I.current.delete(m);return}I.current.forEach(f=>clearTimeout(f)),I.current.clear()},[]),V=o.useCallback(m=>{y(m),k(f=>f.some(v=>v.rowId===m)?f.map(v=>v.rowId===m?{...v,isVisible:!1}:v):f),I.current.set(m,setTimeout(()=>{k(f=>f.filter(g=>g.rowId!==m)),I.current.delete(m)},H))},[y]),W=o.useCallback((m,f)=>{y(m),k(g=>g.some(M=>M.rowId===m)?g.map(M=>M.rowId===m?{...M,content:f,isVisible:!1}:M):[...g,{rowId:m,content:f,isVisible:!1}]),requestAnimationFrame(()=>{k(g=>g.map(v=>v.rowId===m?{...v,isVisible:!0}:v))})},[y]);o.useEffect(()=>{if(!R)return;const m=new Set(s.map(f=>f.id));C(f=>{const g=new Set;return f.forEach(v=>{if(m.has(v)){g.add(v);return}y(v)}),g}),k(f=>(f.forEach(g=>{m.has(g.rowId)||y(g.rowId)}),f.filter(g=>m.has(g.rowId))))},[s,R,y]),o.useEffect(()=>{if(R)return;if(N===null){c(null),F&&(j.current=null);return}a(N)||(F||i(null),c(null),F&&(j.current=null))},[s,N,a,F,R]),o.useEffect(()=>{if(!R){if(D(),N===null||d===null){if(h===null){S(!1),u(null);return}S(!1),E.current=setTimeout(()=>{x(null),u(null),E.current=null},H);return}if(h===null){x(N),u(d),requestAnimationFrame(()=>S(!0));return}if(h===N){u(d),requestAnimationFrame(()=>S(!0));return}S(!1),E.current=setTimeout(()=>{x(N),u(d),requestAnimationFrame(()=>S(!0)),E.current=null},H)}},[D,d,N,R,h]),o.useEffect(()=>()=>{D(),y()},[D,y]),o.useEffect(()=>{if(!F)return;if(N===null){c(null),j.current=null;return}const m=a(N);if(!m){c(null),j.current=null;return}const f=j.current;c(l?.(m,f)??null),j.current=m},[N,a,F,l]);const he=o.useCallback(m=>{if(R){if(P.has(m.id)){C(U=>{const q=new Set(U);return q.delete(m.id),q}),V(m.id),n?.(null,m);return}C(U=>{const q=new Set(U);return q.add(m.id),q});const M=l?.(m,null)??null;M!==null&&typeof M<"u"?W(m.id,M):(y(m.id),k(U=>U.filter(q=>q.rowId!==m.id))),n?.(m,null);return}const f=N===m.id,g=f?m:a(N);if(F){n?.(f?null:m,g);return}if(f){i(null),c(null),n?.(null,m);return}i(m.id),c(l?.(m,g)??null),n?.(m,g)},[N,V,y,W,a,P,F,R,n,l]);return{expandedRowsToRender:o.useMemo(()=>R?O:h===null||b===null||typeof b>"u"?[]:[{rowId:h,content:b,isVisible:T}],[T,R,b,h,O]),onRowExpandChange:he}}function Fe({actions:s,selectedRowsData:t}){const r=o.useMemo(()=>!s||!t.length?[]:t.reduce((l,a,p)=>{const i=s(a).filter(c=>c.multiple&&!c.hidden);if(p===0)return i;const d=new Map(l.map(c=>[c.id,c]));return i.reduce((c,h)=>{const x=d.get(h.id);return x&&c.push({...x,...h,disabled:h.disabled||x.disabled}),c},[])},[]),[s,t]),n=o.useCallback(l=>{if(t.length){if(l.onMultipleClick){l.onMultipleClick(t);return}t.forEach(a=>l.onClick(a))}},[t]);return{multiActions:r,handleMultipleActionClick:n}}function Re({data:s,onRowSelect:t,onSelectedRowsChange:r}){const[n,l]=o.useState(new Set),a=o.useMemo(()=>s?.filter(c=>n.has(c.id))??[],[s,n]);o.useEffect(()=>{if(!s?.length){l(new Set);return}l(c=>{const h=new Set,x=new Set(s.map(b=>b.id));return c.forEach(b=>{x.has(b)&&h.add(b)}),h})},[s]),o.useEffect(()=>{r&&r(a)},[a,r]);const p=o.useCallback(c=>{l(h=>{const x=new Set(h);return x.has(c.id)?(x.delete(c.id),t?.(c,!1)):(x.add(c.id),t?.(c,!0)),x})},[t]),i=o.useCallback(()=>{l(c=>{const h=new Set(c),x=s??[],b=x.every(u=>h.has(u.id));return x.forEach(u=>{const T=h.has(u.id);b?T&&(h.delete(u.id),t?.(u,!1)):T||(h.add(u.id),t?.(u,!0))}),h})},[s,t]),d=o.useMemo(()=>{if(!s?.length)return{allSelected:!1,hasSomeSelected:!1};const c=s.every(x=>n.has(x.id)),h=s.some(x=>n.has(x.id));return{allSelected:c,hasSomeSelected:h}},[s,n]);return{selectedRows:n,selectedRowsData:a,selectionState:d,onRowSelectionChange:p,onToggleAllRows:i}}function Ae(s){const{data:t,onSort:r,entity:n="",isLoading:l=!1,actions:a,columns:p=[],contentClassName:i="",className:d="",softDeleteProperty:c="deletedAt",onRowSelect:h,onSelectedRowsChange:x,allowMultipleExpandedRows:b=!1,expandedRowId:u,onExpandedRowChange:T,onRowExpand:S,...P}=s,C=o.useMemo(()=>!t?.length,[t]),O=o.useCallback(V=>V===null?null:t.find(W=>W.id===V)??null,[t]),{selectedRows:k,selectedRowsData:j,selectionState:E,onRowSelectionChange:I,onToggleAllRows:F}=Re({data:t,onRowSelect:h,onSelectedRowsChange:x}),{expandedRowsToRender:R,onRowExpandChange:N}=Se({data:t,allowMultipleExpandedRows:b,controlledExpandedRowId:u,onExpandedRowChange:T,onRowExpand:S,findRowById:O}),{multiActions:D,handleMultipleActionClick:y}=Fe({actions:a,selectedRowsData:j});return e.jsx(w.FiltersProvider,{children:e.jsxs("div",{className:`${d} table-main`,children:[e.jsx(pe,{columns:p,isLoading:l,...P}),l?e.jsx(ge.Loading,{className:"table-loading"}):e.jsx(e.Fragment,{children:C?e.jsx(de,{}):e.jsxs(e.Fragment,{children:[!!j.length&&e.jsx(me,{count:j.length,multiActions:D,onActionClick:y}),e.jsx("div",{className:`${i} table-body`,children:e.jsxs("table",{className:"table-content",children:[e.jsx(ee,{entity:n,columns:p,onSortCallback:r,hasAction:!!a,selectionState:E,onToggleAllRows:F}),e.jsx("tbody",{children:e.jsx(ue,{data:t,actions:a,columns:p,softDeleteProperty:c,selectedRows:k,expandedRows:R,onRowSelectionChange:I,onRowExpand:S?N:void 0})})]})}),e.jsx(ce,{})]})})]})})}exports.Action=K;exports.Actions=Q;exports.ActionsDropdown=Y;exports.ActiveFilters=ne;exports.ArrayChip=te;exports.Columns=ee;exports.CountOfTotal=re;exports.FilterDropdown=ae;exports.Footer=ce;exports.Navigation=ie;exports.PageSize=oe;exports.RangeChip=se;exports.Rows=ue;exports.Table=Ae;exports.TableEmpty=de;exports.TableHeader=pe;exports.TableSelectionBar=me;exports.renderFilterComponent=le;
@@ -1 +0,0 @@
1
- "use strict";const j=require("react/jsx-runtime"),c=require("./query-81BrXp3i.cjs"),e=require("react"),k=[20,50,100],O=e.createContext({}),q=o=>{const{children:p}=o,[C,b]=e.useState(0),[g,v]=e.useState(20),[f,x]=e.useState(0),[u,d]=e.useState("id"),[n,S]=e.useState(c.SortOrder.DESC),[r,l]=e.useState({}),P=e.useCallback((t,i)=>{let s=n;u===t&&(n===c.SortOrder.ASC?s=c.SortOrder.DESC:s=c.SortOrder.ASC),d(t),S(s),i&&i(t,s)},[u,n]),T=e.useCallback(t=>{const i=Object.entries(t).reduce((s,[F,a])=>(a&&typeof a.value<"u"&&a.value!==null&&(s[F]=a.value),s),{});l(i)},[]),h=e.useCallback(t=>{t?(delete r[t.toLowerCase()],l({...r})):l({})},[r]),w=e.useMemo(()=>Object.keys(r).length,[r]),y={onSort:P,total:C,setTotal:b,sortingBy:u,setSortingBy:d,sortingOrder:n,setSortingOrder:S,pageSize:g,pageSizes:k,setPageSize:v,currentPage:f,setCurrentPage:x,filters:r,onFilterApply:T,clearFilters:h,countOfFilters:w};return j.jsx(O.Provider,{value:y,children:p})},m=()=>{const o=e.useContext(O);if(o===void 0)throw new Error("tableOptionsContext must be used within a Provider");return o};exports.TableOptionsProvider=q;exports.useTableOptions=m;
@@ -1,50 +0,0 @@
1
- import { jsx as j } from "react/jsx-runtime";
2
- import { S as a } from "./query-CwuehjY1.js";
3
- import { useState as s, useCallback as d, useMemo as z, createContext as A, useContext as E } from "react";
4
- const k = [20, 50, 100], g = A({}), M = (r) => {
5
- const { children: O } = r, [f, C] = s(0), [m, v] = s(20), [b, x] = s(0), [l, p] = s("id"), [n, S] = s(a.DESC), [o, u] = s({}), P = d(
6
- (e, i) => {
7
- let t = n;
8
- l === e && (n === a.ASC ? t = a.DESC : t = a.ASC), p(e), S(t), i && i(e, t);
9
- },
10
- [l, n]
11
- ), h = d((e) => {
12
- const i = Object.entries(e).reduce(
13
- (t, [y, c]) => (c && typeof c.value < "u" && c.value !== null && (t[y] = c.value), t),
14
- {}
15
- );
16
- u(i);
17
- }, []), w = d(
18
- (e) => {
19
- e ? (delete o[e.toLowerCase()], u({ ...o })) : u({});
20
- },
21
- [o]
22
- ), F = z(() => Object.keys(o).length, [o]), T = {
23
- onSort: P,
24
- total: f,
25
- setTotal: C,
26
- sortingBy: l,
27
- setSortingBy: p,
28
- sortingOrder: n,
29
- setSortingOrder: S,
30
- pageSize: m,
31
- pageSizes: k,
32
- setPageSize: v,
33
- currentPage: b,
34
- setCurrentPage: x,
35
- filters: o,
36
- onFilterApply: h,
37
- clearFilters: w,
38
- countOfFilters: F
39
- };
40
- return /* @__PURE__ */ j(g.Provider, { value: T, children: O });
41
- }, q = () => {
42
- const r = E(g);
43
- if (r === void 0)
44
- throw new Error("tableOptionsContext must be used within a Provider");
45
- return r;
46
- };
47
- export {
48
- M as T,
49
- q as u
50
- };
@@ -1,320 +0,0 @@
1
- import "./TextInput.css";
2
- import { jsxs as g, jsx as n, Fragment as z } from "react/jsx-runtime";
3
- import { forwardRef as S, useState as w, useEffect as R, useMemo as G, useRef as I, useCallback as k, useLayoutEffect as J } from "react";
4
- import { C as E } from "./Chip-C5ogKbFn.js";
5
- import { I as K } from "./IconButton-BpsTEj0z.js";
6
- import { C as Q } from "./Close-rKC9AcNX.js";
7
- const le = S(function(a, m) {
8
- const {
9
- state: h,
10
- value: e,
11
- onChange: l,
12
- options: u = [],
13
- name: p = "",
14
- id: f = "",
15
- label: i = "",
16
- containerClassName: C = "",
17
- inputContainerClassName: c = "",
18
- helperText: x = "",
19
- placeholder: y = "",
20
- multiple: r = !1,
21
- ...N
22
- } = a, [v, o] = w("");
23
- R(() => {
24
- if (!r && e && !Array.isArray(e)) {
25
- o(String(e.value ?? e.name ?? ""));
26
- return;
27
- }
28
- o("");
29
- }, [r, e]);
30
- const [T, $] = w(!1), A = G(
31
- () => u.filter((t) => {
32
- const s = String(t.value ?? t.name).toLowerCase().includes(v?.toLowerCase());
33
- return Array.isArray(e) && e.length ? s && !e.some((d) => d.id === t.id) : e && !Array.isArray(e) ? s && e.id !== t.id : s;
34
- }),
35
- [u, e, v]
36
- ), b = I(null), q = I(null), [B, M] = w(!1), D = I(null);
37
- R(() => {
38
- const t = (d) => {
39
- b.current && !b.current.contains(d.target) && $(!1);
40
- }, s = (d) => {
41
- d.key === "Escape" && $(!1);
42
- };
43
- return document.addEventListener("mousedown", t), document.addEventListener("keydown", s), () => {
44
- document.removeEventListener("mousedown", t), document.removeEventListener("keydown", s);
45
- };
46
- }, []);
47
- const O = k((t) => {
48
- o(t.target.value);
49
- }, []), F = k(
50
- (t) => {
51
- t ? r ? (o(""), Array.isArray(e) && e.length ? l([...e, t]) : l([t])) : (o(String(t.name ?? t.value ?? "")), l(t)) : l(null), $(!1);
52
- },
53
- [r, l, e]
54
- ), P = k(
55
- (t) => {
56
- if (!Array.isArray(e)) {
57
- l(null);
58
- return;
59
- }
60
- const s = e.filter((d, _) => _ !== t);
61
- s.length ? l(s) : l(null);
62
- },
63
- [l, e]
64
- ), U = k(() => {
65
- Array.isArray(e) && l([e[0]]);
66
- }, [l, e]);
67
- return J(() => {
68
- const t = D.current?.offsetWidth ?? 0, s = b.current?.offsetWidth ?? 0;
69
- M(t > s * 0.4);
70
- }, [e]), /* @__PURE__ */ g(
71
- "div",
72
- {
73
- className: `autocomplete-input-container ${C}`,
74
- ref: b,
75
- children: [
76
- /* @__PURE__ */ g("div", { className: "autocomplete-value-input-container", children: [
77
- /* @__PURE__ */ n(
78
- X,
79
- {
80
- state: h,
81
- name: p,
82
- id: f,
83
- value: v,
84
- onChange: O,
85
- placeholder: y,
86
- helperText: x,
87
- onFocus: () => $(!0),
88
- label: i,
89
- containerClassName: `autocomplete-text-input ${c}`,
90
- ref: m ?? q,
91
- ...N,
92
- children: !r && e && !Array.isArray(e) && (e.value || e.name) && /* @__PURE__ */ n(
93
- K,
94
- {
95
- icon: /* @__PURE__ */ n(Q, {}),
96
- className: "autocomplete-delete-button",
97
- onClick: (t) => {
98
- F(), t.stopPropagation();
99
- }
100
- }
101
- )
102
- }
103
- ),
104
- r && Array.isArray(e) && e.length ? /* @__PURE__ */ n("ul", { ref: D, className: "autocomplete-value-container", children: B ? /* @__PURE__ */ g(z, { children: [
105
- /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
106
- E,
107
- {
108
- text: e[0]?.value ?? e[0]?.name,
109
- onDelete: (t) => {
110
- P(0), t.stopPropagation();
111
- }
112
- }
113
- ) }),
114
- e.length > 1 && /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
115
- E,
116
- {
117
- text: `+${e.length - 1}`,
118
- onDelete: (t) => {
119
- U(), t.stopPropagation();
120
- }
121
- }
122
- ) })
123
- ] }) : e.map((t, s) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
124
- E,
125
- {
126
- text: String(t.value ?? t.name),
127
- onDelete: (d) => {
128
- P(s), d.stopPropagation();
129
- }
130
- }
131
- ) }, t.id ?? t.value ?? t.name)) }) : null
132
- ] }),
133
- T && /* @__PURE__ */ n(
134
- "ul",
135
- {
136
- className: "autocomplete-suggestions-container",
137
- style: { width: b.current?.offsetWidth },
138
- children: A.map((t) => /* @__PURE__ */ n(
139
- "li",
140
- {
141
- className: "autocomplete-suggestion-item",
142
- onClick: (s) => {
143
- F(t), s.stopPropagation();
144
- },
145
- children: t.value ?? t.name
146
- },
147
- t.id ?? t.value ?? t.name
148
- ))
149
- }
150
- )
151
- ]
152
- }
153
- );
154
- }), re = S(function(a, m) {
155
- const {
156
- checked: h,
157
- onChange: e,
158
- name: l = "",
159
- id: u = "",
160
- label: p = "",
161
- containerClassName: f = "",
162
- inputClassName: i = "",
163
- labelClassName: C = "",
164
- ...c
165
- } = a;
166
- return /* @__PURE__ */ g("label", { className: `input-check-container ${f}`, children: [
167
- /* @__PURE__ */ n(
168
- "input",
169
- {
170
- id: u,
171
- ref: m,
172
- name: l,
173
- type: "checkbox",
174
- checked: h,
175
- onChange: e,
176
- className: `input-check ${i}`,
177
- ...c
178
- }
179
- ),
180
- /* @__PURE__ */ n("span", { className: `input-check-label ${C}`, children: p })
181
- ] });
182
- });
183
- var L = /* @__PURE__ */ ((a) => (a.error = "error", a.good = "good", a.default = "default", a))(L || {});
184
- const W = (a) => {
185
- switch (a) {
186
- case "error":
187
- return "input-error";
188
- case "good":
189
- return "input-good";
190
- default:
191
- return "input-normal";
192
- }
193
- }, j = (a) => {
194
- switch (a) {
195
- case "error":
196
- return "input-label-error";
197
- case "good":
198
- return "input-label-good";
199
- default:
200
- return "input-label-normal";
201
- }
202
- }, H = (a) => {
203
- switch (a) {
204
- case "error":
205
- return "input-helper-text-error";
206
- case "good":
207
- return "input-helper-text-good";
208
- default:
209
- return "input-helper-text-normal";
210
- }
211
- }, se = S(function(a, m) {
212
- const {
213
- value: h,
214
- onChange: e,
215
- options: l,
216
- containerClassName: u = "",
217
- inputClassName: p = "",
218
- labelClassName: f = "",
219
- helperText: i = "",
220
- helperTextClassName: C = "",
221
- label: c = "",
222
- name: x = "",
223
- id: y = "",
224
- state: r = L.default,
225
- children: N,
226
- ...v
227
- } = a;
228
- return /* @__PURE__ */ g("div", { className: `select-input-container ${u}`, children: [
229
- /* @__PURE__ */ n(
230
- "select",
231
- {
232
- ...v,
233
- id: y,
234
- ref: m,
235
- name: x,
236
- value: h,
237
- onChange: e,
238
- className: `select-input ${W(r)} peer ${p}`,
239
- children: l?.map((o) => /* @__PURE__ */ n("option", { value: o.id, children: o.value ?? o.name ?? o.id }, o.id))
240
- }
241
- ),
242
- /* @__PURE__ */ n(
243
- "label",
244
- {
245
- htmlFor: y,
246
- className: `select-input-label ${j(r)} ${f}`,
247
- children: c
248
- }
249
- ),
250
- N,
251
- i && /* @__PURE__ */ n(
252
- "p",
253
- {
254
- className: `select-input-helper-text ${H(r)} ${C}`,
255
- children: i
256
- }
257
- )
258
- ] });
259
- }), V = (a) => a == null ? !1 : Array.isArray(a) ? a.length > 0 : `${a}`.length > 0, X = S(function(a, m) {
260
- const {
261
- children: h,
262
- state: e = L.default,
263
- label: l = "",
264
- containerClassName: u = "",
265
- inputClassName: p = "",
266
- labelClassName: f = "",
267
- helperText: i = "",
268
- helperTextClassName: C = "",
269
- value: c,
270
- defaultValue: x,
271
- onChange: y,
272
- ...r
273
- } = a, N = c !== void 0, [v, o] = w(
274
- () => V(x)
275
- ), T = N ? V(c) : v, $ = (A) => {
276
- N || o(A.currentTarget.value.length > 0), y?.(A);
277
- };
278
- return /* @__PURE__ */ g("div", { className: `text-input-container ${u}`, children: [
279
- /* @__PURE__ */ n(
280
- "input",
281
- {
282
- ref: m,
283
- defaultValue: x,
284
- onChange: $,
285
- ...N ? { value: c } : {},
286
- className: `text-input ${W(e)} ${p} ${T ? "has-value" : ""} ${r.placeholder ? "has-placeholder" : ""}`,
287
- ...r
288
- }
289
- ),
290
- !!l && /* @__PURE__ */ g(
291
- "label",
292
- {
293
- htmlFor: r.id,
294
- className: `text-input-label ${j(e)} ${f}`,
295
- children: [
296
- l,
297
- r.required ? " *" : ""
298
- ]
299
- }
300
- ),
301
- h,
302
- !!i && /* @__PURE__ */ n(
303
- "p",
304
- {
305
- className: `text-input-helper-text ${H(e)} ${C}`,
306
- children: i
307
- }
308
- )
309
- ] });
310
- });
311
- export {
312
- le as A,
313
- re as C,
314
- se as S,
315
- X as T,
316
- L as a,
317
- H as h,
318
- W as i,
319
- j as l
320
- };
@@ -1 +0,0 @@
1
- var G=require("./TextInput.css");const a=require("react/jsx-runtime"),l=require("react"),k=require("./Chip-D17UJHW6.cjs"),M=require("./IconButton-CVnmT2E9.cjs"),O=require("./Close-O9P7wJGf.cjs"),U=l.forwardRef(function(n,p){const{state:m,value:e,onChange:r,options:d=[],name:f="",id:x="",label:u="",containerClassName:C="",inputContainerClassName:i="",helperText:g="",placeholder:j="",multiple:s=!1,...N}=n,[v,c]=l.useState("");l.useEffect(()=>{if(!s&&e&&!Array.isArray(e)){c(String(e.value??e.name??""));return}c("")},[s,e]);const[S,b]=l.useState(!1),$=l.useMemo(()=>d.filter(t=>{const o=String(t.value??t.name).toLowerCase().includes(v?.toLowerCase());return Array.isArray(e)&&e.length?o&&!e.some(h=>h.id===t.id):e&&!Array.isArray(e)?o&&e.id!==t.id:o}),[d,e,v]),y=l.useRef(null),F=l.useRef(null),[P,V]=l.useState(!1),R=l.useRef(null);l.useEffect(()=>{const t=h=>{y.current&&!y.current.contains(h.target)&&b(!1)},o=h=>{h.key==="Escape"&&b(!1)};return document.addEventListener("mousedown",t),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("keydown",o)}},[]);const W=l.useCallback(t=>{c(t.target.value)},[]),E=l.useCallback(t=>{t?s?(c(""),Array.isArray(e)&&e.length?r([...e,t]):r([t])):(c(String(t.name??t.value??"")),r(t)):r(null),b(!1)},[s,r,e]),L=l.useCallback(t=>{if(!Array.isArray(e)){r(null);return}const o=e.filter((h,H)=>H!==t);o.length?r(o):r(null)},[r,e]),B=l.useCallback(()=>{Array.isArray(e)&&r([e[0]])},[r,e]);return l.useLayoutEffect(()=>{const t=R.current?.offsetWidth??0,o=y.current?.offsetWidth??0;V(t>o*.4)},[e]),a.jsxs("div",{className:`autocomplete-input-container ${C}`,ref:y,children:[a.jsxs("div",{className:"autocomplete-value-input-container",children:[a.jsx(D,{state:m,name:f,id:x,value:v,onChange:W,placeholder:j,helperText:g,onFocus:()=>b(!0),label:u,containerClassName:`autocomplete-text-input ${i}`,ref:p??F,...N,children:!s&&e&&!Array.isArray(e)&&(e.value||e.name)&&a.jsx(M.IconButton,{icon:a.jsx(O.Close,{}),className:"autocomplete-delete-button",onClick:t=>{E(),t.stopPropagation()}})}),s&&Array.isArray(e)&&e.length?a.jsx("ul",{ref:R,className:"autocomplete-value-container",children:P?a.jsxs(a.Fragment,{children:[a.jsx("li",{children:a.jsx(k.Chip,{text:e[0]?.value??e[0]?.name,onDelete:t=>{L(0),t.stopPropagation()}})}),e.length>1&&a.jsx("li",{children:a.jsx(k.Chip,{text:`+${e.length-1}`,onDelete:t=>{B(),t.stopPropagation()}})})]}):e.map((t,o)=>a.jsx("li",{children:a.jsx(k.Chip,{text:String(t.value??t.name),onDelete:h=>{L(o),h.stopPropagation()}})},t.id??t.value??t.name))}):null]}),S&&a.jsx("ul",{className:"autocomplete-suggestions-container",style:{width:y.current?.offsetWidth},children:$.map(t=>a.jsx("li",{className:"autocomplete-suggestion-item",onClick:o=>{E(t),o.stopPropagation()},children:t.value??t.name},t.id??t.value??t.name))})]})}),_=l.forwardRef(function(n,p){const{checked:m,onChange:e,name:r="",id:d="",label:f="",containerClassName:x="",inputClassName:u="",labelClassName:C="",...i}=n;return a.jsxs("label",{className:`input-check-container ${x}`,children:[a.jsx("input",{id:d,ref:p,name:r,type:"checkbox",checked:m,onChange:e,className:`input-check ${u}`,...i}),a.jsx("span",{className:`input-check-label ${C}`,children:f})]})});var A=(n=>(n.error="error",n.good="good",n.default="default",n))(A||{});const w=n=>{switch(n){case"error":return"input-error";case"good":return"input-good";default:return"input-normal"}},I=n=>{switch(n){case"error":return"input-label-error";case"good":return"input-label-good";default:return"input-label-normal"}},T=n=>{switch(n){case"error":return"input-helper-text-error";case"good":return"input-helper-text-good";default:return"input-helper-text-normal"}},z=l.forwardRef(function(n,p){const{value:m,onChange:e,options:r,containerClassName:d="",inputClassName:f="",labelClassName:x="",helperText:u="",helperTextClassName:C="",label:i="",name:g="",id:j="",state:s=A.default,children:N,...v}=n;return a.jsxs("div",{className:`select-input-container ${d}`,children:[a.jsx("select",{...v,id:j,ref:p,name:g,value:m,onChange:e,className:`select-input ${w(s)} peer ${f}`,children:r?.map(c=>a.jsx("option",{value:c.id,children:c.value??c.name??c.id},c.id))}),a.jsx("label",{htmlFor:j,className:`select-input-label ${I(s)} ${x}`,children:i}),N,u&&a.jsx("p",{className:`select-input-helper-text ${T(s)} ${C}`,children:u})]})}),q=n=>n==null?!1:Array.isArray(n)?n.length>0:`${n}`.length>0,D=l.forwardRef(function(n,p){const{children:m,state:e=A.default,label:r="",containerClassName:d="",inputClassName:f="",labelClassName:x="",helperText:u="",helperTextClassName:C="",value:i,defaultValue:g,onChange:j,...s}=n,N=i!==void 0,[v,c]=l.useState(()=>q(g)),S=N?q(i):v,b=$=>{N||c($.currentTarget.value.length>0),j?.($)};return a.jsxs("div",{className:`text-input-container ${d}`,children:[a.jsx("input",{ref:p,defaultValue:g,onChange:b,...N?{value:i}:{},className:`text-input ${w(e)} ${f} ${S?"has-value":""} ${s.placeholder?"has-placeholder":""}`,...s}),!!r&&a.jsxs("label",{htmlFor:s.id,className:`text-input-label ${I(e)} ${x}`,children:[r,s.required?" *":""]}),m,!!u&&a.jsx("p",{className:`text-input-helper-text ${T(e)} ${C}`,children:u})]})});exports.AutocompleteInput=U;exports.CheckInput=_;exports.SelectInput=z;exports.State=A;exports.TextInput=D;exports.helperTextStateClassName=T;exports.inputStateClassName=w;exports.labelStateClassName=I;
@@ -1 +0,0 @@
1
- "use strict";const i=require("react/jsx-runtime"),n=require("react"),r=n.createContext({});function a(t){const{children:e,t:o,language:s}=t;return i.jsx(r.Provider,{value:{t:o,language:s},children:e})}const u=()=>{const t=n.useContext(r);if(t===void 0)throw new Error("translationContext must be used within a Provider");return t};exports.TranslationProvider=a;exports.useTranslation=u;
@@ -1,20 +0,0 @@
1
- import { StoryObj } from '@storybook/react';
2
- import { Actions } from './Actions';
3
- declare const meta: {
4
- title: string;
5
- component: typeof Actions;
6
- tags: string[];
7
- args: {
8
- showActionTexts: false;
9
- actions: {
10
- id: string;
11
- tooltip: string;
12
- icon: import("react/jsx-runtime").JSX.Element;
13
- onClick: () => void;
14
- }[];
15
- };
16
- };
17
- export default meta;
18
- type Story = StoryObj<typeof meta>;
19
- export declare const Basic: Story;
20
- export declare const WithText: Story;
@@ -1 +0,0 @@
1
- export {};
@@ -1,17 +0,0 @@
1
- import { StoryObj } from '@storybook/react';
2
- declare const meta: {
3
- title: string;
4
- component: <TRow extends import('../../lib').BaseDto>(props: import('./types').ActionsContainerPropsType<TRow>) => import("react/jsx-runtime").JSX.Element;
5
- tags: string[];
6
- args: {
7
- actions: {
8
- id: string;
9
- tooltip: string;
10
- icon: import("react/jsx-runtime").JSX.Element;
11
- onClick: () => void;
12
- }[];
13
- };
14
- };
15
- export default meta;
16
- type Story = StoryObj<typeof meta>;
17
- export declare const Basic: Story;
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { Badge } from '..';
3
- declare const meta: Meta<typeof Badge>;
4
- export default meta;
5
- type Story = StoryObj<typeof Badge>;
6
- export declare const Zero: Story;
7
- export declare const Small: Story;
8
- export declare const Large: Story;
@@ -1,29 +0,0 @@
1
- import { StoryObj } from '@storybook/react';
2
- declare const meta: {
3
- title: string;
4
- component: (props: import('..').ButtonPropsType) => import("react/jsx-runtime").JSX.Element;
5
- tags: string[];
6
- args: {
7
- children: string;
8
- };
9
- argTypes: {
10
- variant: {
11
- control: {
12
- type: "select";
13
- };
14
- options: string[];
15
- };
16
- color: {
17
- control: {
18
- type: "select";
19
- };
20
- options: string[];
21
- };
22
- };
23
- };
24
- export default meta;
25
- type Story = StoryObj<typeof meta>;
26
- export declare const Text: Story;
27
- export declare const Outlined: Story;
28
- export declare const Submit: Story;
29
- export declare const AllVariants: Story;
@@ -1,9 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { Chip } from '..';
3
- declare const meta: Meta<typeof Chip>;
4
- export default meta;
5
- type Story = StoryObj<typeof Chip>;
6
- export declare const Default: Story;
7
- export declare const Deletable: Story;
8
- export declare const RangeChip: Story;
9
- export declare const ArrayChip: Story;
@@ -1,8 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { Dropdown } from '..';
3
- declare const meta: Meta<typeof Dropdown>;
4
- export default meta;
5
- type Story = StoryObj<typeof Dropdown>;
6
- export declare const Basic: Story;
7
- export declare const ActionDropdown: Story;
8
- export declare const EdgeDetection: Story;
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { AutocompleteInput } from '../..';
3
- declare const meta: Meta<typeof AutocompleteInput>;
4
- export default meta;
5
- type Story = StoryObj<typeof AutocompleteInput>;
6
- export declare const Single: Story;
7
- export declare const Multiple: Story;
8
- export declare const Default: Story;
@@ -1,6 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { CheckInput } from '../..';
3
- declare const meta: Meta<typeof CheckInput>;
4
- export default meta;
5
- type Story = StoryObj<typeof CheckInput>;
6
- export declare const Default: Story;
@@ -1,7 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { FileInput } from '../..';
3
- declare const meta: Meta<typeof FileInput>;
4
- export default meta;
5
- type Story = StoryObj<typeof FileInput>;
6
- export declare const Default: Story;
7
- export declare const MultipleFiles: Story;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { SelectInput } from '../..';
3
- declare const meta: Meta<typeof SelectInput>;
4
- export default meta;
5
- type Story = StoryObj<typeof SelectInput>;
6
- export declare const Default: Story;
7
- export declare const ErrorState: Story;
@@ -1,10 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { TextInput } from '../..';
3
- declare const meta: Meta<typeof TextInput>;
4
- export default meta;
5
- type Story = StoryObj<typeof TextInput>;
6
- export declare const Default: Story;
7
- export declare const WithHelperText: Story;
8
- export declare const ErrorState: Story;
9
- export declare const WithController: Story;
10
- export declare const Controlled: Story;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,30 +0,0 @@
1
- import { StoryObj } from '@storybook/react';
2
- declare const meta: {
3
- title: string;
4
- component: (props: import('..').IconButtonPropsType) => import("react/jsx-runtime").JSX.Element;
5
- tags: string[];
6
- args: {
7
- icon: import("react/jsx-runtime").JSX.Element;
8
- };
9
- argTypes: {
10
- variant: {
11
- control: {
12
- type: "select";
13
- };
14
- options: string[];
15
- };
16
- color: {
17
- control: {
18
- type: "select";
19
- };
20
- options: string[];
21
- };
22
- };
23
- };
24
- export default meta;
25
- type Story = StoryObj<typeof meta>;
26
- export declare const Default: Story;
27
- export declare const WithFilters: Story;
28
- export declare const WithChevron: Story;
29
- export declare const ErrorOnHover: Story;
30
- export declare const AllVariants: Story;
@@ -1,7 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { Loading } from '..';
3
- declare const meta: Meta<typeof Loading>;
4
- export default meta;
5
- type Story = StoryObj<typeof Loading>;
6
- export declare const Default: Story;
7
- export declare const ThickStroke: Story;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};