@sito/dashboard 0.0.66 → 0.0.68

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 (70) hide show
  1. package/README.md +3 -2
  2. package/dist/{Chip-JDQqzO9I.js → Chip-C5ogKbFn.js} +4 -4
  3. package/dist/{Chip-a2z-338_.cjs → Chip-D17UJHW6.cjs} +1 -1
  4. package/dist/Chip.cjs +1 -1
  5. package/dist/Chip.js +1 -1
  6. package/dist/{FileInput-B--eBQVa.js → FileInput-DNoJELoS.js} +19 -19
  7. package/dist/FileInput-YvKQ-wok.cjs +1 -0
  8. package/dist/{Filters-BivtNVS3.js → Filters-DL5jd8ps.js} +30 -16
  9. package/dist/{Filters-C5XEbF3V.cjs → Filters-Dyee8QYH.cjs} +1 -1
  10. package/dist/FiltersProvider-BlHv12dU.cjs +1 -0
  11. package/dist/{FiltersProvider-CY2fsw_F.js → FiltersProvider-gfC9gS8u.js} +5 -5
  12. package/dist/FiltersProvider.cjs +1 -1
  13. package/dist/FiltersProvider.js +1 -1
  14. package/dist/Form.cjs +1 -1
  15. package/dist/Form.js +2 -2
  16. package/dist/SvgIcons.cjs +1 -1
  17. package/dist/SvgIcons.js +7 -6
  18. package/dist/Table-B5vsXjAq.js +1080 -0
  19. package/dist/Table-DgFzKIJZ.cjs +1 -0
  20. package/dist/Table.cjs +1 -1
  21. package/dist/Table.css +1 -1
  22. package/dist/Table.js +1 -1
  23. package/dist/TableOptions.cjs +1 -1
  24. package/dist/TableOptions.js +1 -1
  25. package/dist/TableOptionsProvider-CDLZ4TXE.cjs +1 -0
  26. package/dist/TableOptionsProvider-HHCDcRbO.js +55 -0
  27. package/dist/TextInput-C27RFuya.cjs +1 -0
  28. package/dist/TextInput-DPYxzgm3.js +335 -0
  29. package/dist/TextInput.css +1 -1
  30. package/dist/Translation.cjs +1 -1
  31. package/dist/Translation.js +1 -1
  32. package/dist/{TranslationProvider-COebIyxr.js → TranslationProvider-BR4s--Vu.js} +2 -2
  33. package/dist/TranslationProvider-Czr0WIDH.cjs +1 -0
  34. package/dist/components/Actions/Action.d.ts +18 -0
  35. package/dist/components/Actions/Actions.d.ts +14 -0
  36. package/dist/components/Actions/Actions.stories.d.ts +20 -0
  37. package/dist/components/Actions/Actions.test.d.ts +1 -0
  38. package/dist/components/Actions/ActionsDropdown.d.ts +10 -0
  39. package/dist/components/Actions/ActionsDropdown.stories.d.ts +17 -0
  40. package/dist/components/Actions/ActionsDropdown.test.d.ts +1 -0
  41. package/dist/components/Actions/index.d.ts +4 -0
  42. package/dist/components/Actions/types.d.ts +17 -0
  43. package/dist/components/Form/CheckInput/CheckInput.stories.d.ts +2 -0
  44. package/dist/components/Form/CheckInput/CheckInput.test.d.ts +1 -0
  45. package/dist/components/Form/SelectInput/SelectInput.stories.d.ts +1 -0
  46. package/dist/components/Form/TextInput/TextInput.stories.d.ts +3 -0
  47. package/dist/components/SvgIcons/Ellipsis.d.ts +7 -0
  48. package/dist/components/SvgIcons/index.d.ts +1 -0
  49. package/dist/components/Table/Table.stories.d.ts +3 -0
  50. package/dist/components/Table/components/Footer/Navigation.test.d.ts +1 -0
  51. package/dist/components/Table/components/TableHeader/TableHeader.test.d.ts +1 -0
  52. package/dist/components/Table/types.d.ts +1 -0
  53. package/dist/components/index.d.ts +1 -0
  54. package/dist/index.cjs +1 -1
  55. package/dist/index.css +1 -1
  56. package/dist/index.js +69 -65
  57. package/dist/providers/FiltersProvider/FiltersProvider.test.d.ts +1 -0
  58. package/dist/providers/Translation/TranslationProvider.d.ts +5 -4
  59. package/dist/providers/Translation/TranslationProvider.test.d.ts +1 -0
  60. package/dist/setupTests.d.ts +0 -0
  61. package/package.json +5 -2
  62. package/dist/FileInput-5tMOO7mb.cjs +0 -1
  63. package/dist/FiltersProvider-CYqLFEI9.cjs +0 -1
  64. package/dist/Table-CH9HYQ2I.js +0 -946
  65. package/dist/Table-CWss4TW5.cjs +0 -1
  66. package/dist/TableOptionsProvider-BchUDA3B.cjs +0 -1
  67. package/dist/TableOptionsProvider-BfQS8l1N.js +0 -50
  68. package/dist/TextInput-BLfTozZ9.js +0 -320
  69. package/dist/TextInput-Bn8zsDnU.cjs +0 -1
  70. package/dist/TranslationProvider-51Pc9Xrr.cjs +0 -1
@@ -1 +0,0 @@
1
- var Re=require("./Table.css");const e=require("react/jsx-runtime"),a=require("react"),T=require("./FiltersProvider-CYqLFEI9.cjs"),pe=require("./Badge-Z78MlGoQ.cjs"),V=require("./Filters-C5XEbF3V.cjs"),B=require("./lib.cjs"),F=require("./TranslationProvider-51Pc9Xrr.cjs"),_=require("./TextInput-Bn8zsDnU.cjs"),P=require("./TableOptionsProvider-BchUDA3B.cjs"),J=require("./Chip-a2z-338_.cjs"),U=require("./IconButton-CVnmT2E9.cjs"),G=require("./Tooltip-BSKAgRkc.cjs"),me=require("./query-81BrXp3i.cjs"),he=require("./Button-BlYa3uPc.cjs"),be=require("./Loading-CNECRan-.cjs");function K(n){return[...n].sort((t,i)=>(i.pos??0)-(t.pos??0)).filter(t=>t.display!=="none")}function Q(n){const{t}=F.useTranslation(),{entity:i="",columns:s=[],hasAction:l=!0,onSortCallback:r,selectionState:h,onToggleAllRows:o}=n,p=a.useRef(null);a.useEffect(()=>{p.current&&(p.current.indeterminate=!!(h?.hasSomeSelected&&!h?.allSelected))},[h]);const{onSort:c,sortingOrder:m,sortingBy:b}=P.useTableOptions(),x=a.useMemo(()=>K(s).map(u=>({id:u.key,label:u.label,className:u.className??"",sortable:u.sortable??!0,sortOptions:u.sortOptions})),[s,i,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:o?e.jsx("input",{type:"checkbox",ref:p,checked:h?.allSelected??!1,onChange:o,"aria-label":t("_accessibility:components.table.selectAllRows")}):null}),x.map(u=>e.jsx("th",{scope:"col",className:`table-headers-column ${u.className}`,children:e.jsxs(he.Button,{disabled:!u.sortable,onClick:()=>c(u.id,r),className:"table-headers-cell",children:[e.jsx("span",{className:"table-headers-label",children:u.label}),u.sortable&&b===u.id&&e.jsx("span",{children:m===me.SortOrder.ASC?u.sortOptions?.icons?.asc??e.jsx(V.ChevronUp,{className:u.sortOptions?.icons?.className??"table-headers-sort-indicator"}):u.sortOptions?.icons?.desc??e.jsx(V.ChevronDown,{className:u.sortOptions?.icons?.className??"table-headers-sort-indicator"})})]})},u.id)),l&&e.jsx("th",{scope:"col",className:"table-headers-action",children:e.jsx("span",{className:"button text default disabled",children:t("_accessibility:labels.actions")})})]})})}const Y=n=>{const{items:t,text:i,id:s,onClearFilter:l}=n;return e.jsx(J.Chip,{text:`${i}: ${t.map(r=>r.value??r.name).join(", ")}`,onDelete:()=>l(s)})},Z=n=>{const{end:t,start:i,text:s,id:l,onClearFilter:r}=n;return e.jsx(J.Chip,{text:`${s}: ${i||"♾️"} - ${t||"♾️"}`,onDelete:()=>r(l)})},ee=n=>{const{filtersDefinition:t}=n,i=a.useMemo(()=>{const o={};return t.forEach(p=>{o[p.propertyName]=p.label??p.propertyName}),o},[t]),{filters:s,clearFilters:l}=P.useTableOptions(),r=a.useMemo(()=>Object.keys(s),[s]),h=a.useCallback(o=>s[o]?.end||s[o]?.start?e.jsx(Z,{id:o,text:i[o],start:s[o].start,end:s[o].end,onClearFilter:l}):Array.isArray(s[o])?e.jsx(Y,{id:o,text:i[o],items:s[o],onClearFilter:l}):e.jsx(J.Chip,{text:`${i[o]}: ${s[o]?.value??s[o]?.name??s[o]}`,onDelete:()=>l(o)}),[s,i]);return e.jsx("ul",{className:"active-filters-main",children:r?.map(o=>e.jsx("li",{children:h(o)},o))})};function xe(n){const{propertyName:t,label:i,placeholder:s,options:l,multiple:r=!0}=n,{currentFilters:h,setCurrentFilters:o}=T.useFilters(),p=a.useMemo(()=>h[t]??l[0],[h]),c=a.useCallback(m=>{o({type:T.FiltersActions.update,toUpdate:{[t]:{value:m}}})},[r]);return e.jsx(_.AutocompleteInput,{value:p?.value,label:i,options:l,multiple:r,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:c,placeholder:s})}const fe=n=>{const{propertyName:t,label:i}=n,{currentFilters:s,setCurrentFilters:l}=T.useFilters(),r=a.useMemo(()=>s[t]?.value??"",[s]),h=a.useCallback(o=>{l({type:T.FiltersActions.update,toUpdate:{[t]:{value:o.target.checked}}})},[]);return e.jsx(_.CheckInput,{label:i,checked:r??!1,onChange:h})};function ge(n){const{propertyName:t,options:i,label:s,placeholder:l}=n,{currentFilters:r,setCurrentFilters:h}=T.useFilters(),o=a.useMemo(()=>r[t]?.value??i[0],[r]),p=a.useCallback(c=>{h({type:T.FiltersActions.update,toUpdate:{[t]:{value:c.target.value}}})},[]);return e.jsx(_.SelectInput,{value:o,label:s,options:i,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:p,placeholder:l})}const je=n=>{const{propertyName:t,label:i,placeholder:s}=n,{currentFilters:l,setCurrentFilters:r}=T.useFilters(),h=a.useMemo(()=>l[t]?.value??"",[l]),o=a.useCallback(p=>{r({type:T.FiltersActions.update,toUpdate:{[t]:{value:p.target.value}}})},[]);return e.jsx(_.TextInput,{value:h??"",label:i,onChange:o,containerClassName:"input-widget-container",helperTextClassName:"",placeholder:s})},X=n=>{const{propertyName:t,label:i,inputType:s}=n,{t:l}=F.useTranslation(),{currentFilters:r,setCurrentFilters:h}=T.useFilters(),o=a.useRef(null),p=a.useRef(null),c=a.useCallback(b=>{h({type:T.FiltersActions.update,toUpdate:{[t]:{value:{end:p?.current?.value??null,start:b.target.value}}}})},[]),m=a.useCallback(b=>{h({type:T.FiltersActions.update,toUpdate:{[t]:{value:{start:o?.current?.value??null,end:b.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:i}),e.jsxs("div",{className:"range-widget-row",children:[e.jsx(_.TextInput,{value:r[t]?.value?.start??"",placeholder:l("_accessibility:components.table.filters.range.start"),type:s,ref:o,onChange:c,containerClassName:"input-widget-container",helperTextClassName:""}),e.jsx(_.TextInput,{value:r[t]?.value?.end??"",placeholder:l("_accessibility:components.table.filters.range.end"),type:s,ref:p,onChange:m,containerClassName:"input-widget-container",helperTextClassName:""})]})]})},te=n=>{switch(n.type){case B.FilterTypes.text:return e.jsx(je,{...n});case B.FilterTypes.number:return e.jsx(X,{...n,inputType:"number"});case B.FilterTypes.date:return e.jsx(X,{...n,inputType:"date"});case B.FilterTypes.select:return e.jsx(ge,{...n});case B.FilterTypes.autocomplete:return e.jsx(xe,{...n});case B.FilterTypes.check:return e.jsx(fe,{...n})}return e.jsx(e.Fragment,{})},ne=n=>{const{filters:t=[],show:i,handleShow:s}=n,{onFilterApply:l}=P.useTableOptions(),{currentFilters:r,setCurrentFilters:h}=T.useFilters(),{t:o}=F.useTranslation(),p=a.useRef(null);return a.useEffect(()=>{const c=({target:b})=>{p.current&&(b?.closest(".filter-dropdown-trigger")||!i||p.current.contains(b)||s(!1))},m=({code:b})=>{!i||b!=="Escape"||s(!1)};return document.addEventListener("click",c),document.addEventListener("keydown",m),()=>{document.removeEventListener("click",c),document.removeEventListener("keydown",m)}},[s,i]),e.jsx("div",{className:`filter-dropdown-backdrop ${i?"opened":"closed"}`,children:e.jsxs("div",{className:"filter-popup",ref:p,children:[e.jsx("div",{className:"filter-title",children:o("_accessibility:buttons.filters")}),e.jsx("ul",{className:"filter-container",children:t.map(c=>e.jsx("li",{className:"filter-container-item",children:te(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:()=>h({type:T.FiltersActions.reset,filters:t}),className:"filter-dropdown-button small filter-dropdown-cancel",children:o("_accessibility:buttons.clear")})}),e.jsx("li",{children:e.jsx("button",{className:"filter-dropdown-button small filter-dropdown-submit",onClick:()=>{s(!1),l(r)},children:o("_accessibility:buttons.applyFilters")})})]})})]})})},se=()=>{const{t:n}=F.useTranslation(),{total:t,pageSize:i,pageSizes:s,currentPage:l}=P.useTableOptions(),r=(l+1)*i>t?t:(l+1)*i;return e.jsxs("div",{className:"table-navigation-sizes",children:[s[0]<t&&e.jsx(e.Fragment,{children:e.jsxs("p",{children:[l*i+1," - ",r," ",n("_accessibility:components.table.of")]})}),e.jsx("p",{children:t})]})};function Ce(){const{t:n}=F.useTranslation(),{total:t,pageSize:i,currentPage:s,setCurrentPage:l}=P.useTableOptions(),r=a.useMemo(()=>{const h=Math.ceil(t/i);return Array.from({length:h},(o,p)=>({id:p,value:p+1}))},[t,i]);return e.jsxs("div",{className:"jump-to-page",children:[e.jsx("p",{children:n("_accessibility:components.table.jumpToPage")}),e.jsx(_.SelectInput,{value:s,options:r,inputClassName:"jump-to-page-input",containerClassName:"jump-to-page-input-container",helperTextClassName:"hidden",onChange:h=>l(Number(h.target.value))})]})}const le=()=>{const{t:n}=F.useTranslation(),{total:t,pageSize:i,currentPage:s,setCurrentPage:l}=P.useTableOptions();return e.jsxs("div",{className:"table-navigation-pages",children:[e.jsx(U.IconButton,{icon:e.jsx(V.ChevronLeft,{className:"table-navigation-icon"}),className:"table-navigation-buttons",disabled:s===0,"aria-label":n("_accessibility:buttons.previous"),name:n("_accessibility:buttons.previous"),onClick:()=>l(s-1)}),e.jsx(U.IconButton,{icon:e.jsx(V.ChevronRight,{className:"table-navigation-icon"}),disabled:Math.floor(t/((s+1)*i))===0,className:"table-navigation-buttons",name:n("_accessibility:buttons.next"),"aria-label":n("_accessibility:buttons.next"),onClick:()=>l(s+1)})]})};function re(){const{t:n}=F.useTranslation(),{pageSizes:t,pageSize:i,setPageSize:s}=P.useTableOptions(),l=a.useMemo(()=>t?.map(r=>({id:r,value:r})),[t]);return e.jsxs("div",{className:"page-size",children:[e.jsx("p",{children:n("_accessibility:components.table.pageSizes")}),e.jsx(_.SelectInput,{value:i,options:l,inputClassName:"page-size-input",containerClassName:"page-size-input-container",helperTextClassName:"hidden",onChange:r=>s(Number(r.target.value))})]})}function ae(){return e.jsxs("div",{className:"table-footer",children:[e.jsx(Ce,{}),e.jsx(re,{}),e.jsx(se,{}),e.jsx(le,{})]})}const Ne=n=>n,ie=n=>{const{t}=F.useTranslation(),{columns:i,softDeleteProperty:s="deletedAt",data:l,actions:r,selectedRows:h,expandedRows:o=[],onRowSelectionChange:p,onRowExpand:c}=n,m=a.useMemo(()=>K(i),[i]),b=a.useMemo(()=>new Map(o.map(x=>[x.rowId,x])),[o]);return l?.map(x=>{const u=h.has(x.id),N=b.get(x.id),S=!!N,$=m.length+1+(r?1:0);return e.jsxs(a.Fragment,{children:[e.jsxs("tr",{className:`table-row ${c?"expandable":""} ${x[s]?"deleted-class":""} ${u?"selected":""} ${S?"expanded":""}`,onClick:()=>c?.(x),children:[e.jsx("td",{className:"table-row-cell table-row-checkbox",children:e.jsx("input",{type:"checkbox",checked:u,onClick:g=>g.stopPropagation(),onChange:()=>p(x),"aria-label":t("_accessibility:components.table.selectRow")})}),m?.map((g,M)=>e.jsx("td",{className:`table-row-cell ${M===0?"basic":""} ${g.className??""}`,children:g.renderBody?g.renderBody(x[g.key],x):Ne(x[g.key])},g.key)),r?e.jsx("td",{children:e.jsx("div",{className:"table-row-cell-action",children:r(x).filter(g=>!g.hidden)?.map(g=>e.jsx(G.Tooltip,{content:g.tooltip,children:e.jsx(U.IconButton,{icon:g.icon,className:"row-table-action",onClick:M=>{M.stopPropagation(),g.onClick(x)}})},g.id))})}):null]}),S&&N?.content!==null&&typeof N?.content<"u"&&e.jsx("tr",{className:"table-row-expanded",children:e.jsx("td",{className:"table-row-expanded-cell",colSpan:$,children:e.jsx("div",{className:`table-row-expanded-content ${N.isVisible?"open":"closed"}`,children:e.jsx("div",{className:"table-row-expanded-inner",children:N.content})})})})]},x.id)})};function oe(){const{t:n}=F.useTranslation();return e.jsx("div",{className:"table-empty",children:e.jsx("p",{children:n("_accessibility:components.table.empty")})})}const ce=n=>{const{columns:t,title:i,isLoading:s,toolbar:l,filterOptions:r}=n,{countOfFilters:h}=P.useTableOptions(),{t:o}=F.useTranslation(),p=a.useMemo(()=>t?t.sort((u,N)=>(N.pos??0)-(u.pos??0)).filter(u=>!!u.filterOptions).map(u=>({...u.filterOptions,label:u.filterOptions?.label??u.label,propertyName:u.key})):[],[t]),[c,m]=a.useState(!1),b=a.useCallback(u=>{r?.dropdown?.setOpened?r.dropdown.setOpened(u??!1):m(u??!1)},[r]),x=a.useMemo(()=>r?.dropdown?.opened??c,[r,c]);return e.jsxs("div",{className:`table-header ${x?"showing-filters":""}`,children:[e.jsxs("div",{children:[i&&e.jsx("h1",{className:"table-header-title",children:i}),s?null:e.jsxs("div",{className:"table-header-content",children:[l,r?.button?.hide!==!0&&e.jsxs(U.IconButton,{icon:r?.button?.icon??e.jsx(V.Filters,{className:"filter-dropdown-trigger-icon"}),className:"filter-dropdown-button normal filter-dropdown-trigger","aria-haspopup":"true",onClick:()=>b(!x),"aria-expanded":x,children:[e.jsx(pe.Badge,{count:h,className:`${h>0?"show":"hide"} `}),e.jsx("span",{className:"table-header-sr",children:o("_accessibility:buttons.filters")}),e.jsx("wbr",{})]})]})]}),!!p&&!!p.length&&e.jsx(ne,{filters:p,show:x,handleShow:b,options:r}),e.jsx(ee,{filtersDefinition:p})]})};function ue({count:n,multiActions:t,onActionClick:i}){const{t:s}=F.useTranslation();return e.jsxs("div",{className:"table-selection-bar",children:[e.jsx("p",{className:"table-selection-bar-count",children:s("_accessibility:components.table.selectedCount",{count:n})}),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(U.IconButton,{icon:l.icon,className:"multi-table-action",onClick:()=>i(l),disabled:l.disabled})},l.id))})]})}const H=220;function ve({data:n,allowMultipleExpandedRows:t,controlledExpandedRowId:i,onExpandedRowChange:s,onRowExpand:l,findRowById:r}){const[h,o]=a.useState(null),[p,c]=a.useState(null),[m,b]=a.useState(null),[x,u]=a.useState(null),[N,S]=a.useState(!1),[$,g]=a.useState(new Set),[M,O]=a.useState([]),E=a.useRef(null),k=a.useRef(null),I=a.useRef(new Map),w=typeof i<"u",R=t&&!w,C=w?i??null:h,z=a.useCallback(()=>{k.current&&(clearTimeout(k.current),k.current=null)},[]),y=a.useCallback(d=>{if(typeof d<"u"){const f=I.current.get(d);if(!f)return;clearTimeout(f),I.current.delete(d);return}I.current.forEach(f=>clearTimeout(f)),I.current.clear()},[]),D=a.useCallback(d=>{y(d),O(f=>f.some(v=>v.rowId===d)?f.map(v=>v.rowId===d?{...v,isVisible:!1}:v):f),I.current.set(d,setTimeout(()=>{O(f=>f.filter(j=>j.rowId!==d)),I.current.delete(d)},H))},[y]),W=a.useCallback((d,f)=>{y(d),O(j=>j.some(A=>A.rowId===d)?j.map(A=>A.rowId===d?{...A,content:f,isVisible:!1}:A):[...j,{rowId:d,content:f,isVisible:!1}]),requestAnimationFrame(()=>{O(j=>j.map(v=>v.rowId===d?{...v,isVisible:!0}:v))})},[y]);a.useEffect(()=>{if(!R)return;const d=new Set(n.map(f=>f.id));g(f=>{const j=new Set;return f.forEach(v=>{if(d.has(v)){j.add(v);return}y(v)}),j}),O(f=>(f.forEach(j=>{d.has(j.rowId)||y(j.rowId)}),f.filter(j=>d.has(j.rowId))))},[n,R,y]),a.useEffect(()=>{if(R)return;if(C===null){c(null),w&&(E.current=null);return}r(C)||(w||o(null),c(null),w&&(E.current=null))},[n,C,r,w,R]),a.useEffect(()=>{if(!R){if(z(),C===null||p===null){if(m===null){S(!1),u(null);return}S(!1),k.current=setTimeout(()=>{b(null),u(null),k.current=null},H);return}if(m===null){b(C),u(p),requestAnimationFrame(()=>S(!0));return}if(m===C){u(p),requestAnimationFrame(()=>S(!0));return}S(!1),k.current=setTimeout(()=>{b(C),u(p),requestAnimationFrame(()=>S(!0)),k.current=null},H)}},[z,p,C,R,m]),a.useEffect(()=>()=>{z(),y()},[z,y]),a.useEffect(()=>{if(!w)return;if(C===null){c(null),E.current=null;return}const d=r(C);if(!d){c(null),E.current=null;return}const f=E.current;c(l?.(d,f)??null),E.current=d},[C,r,w,l]);const de=a.useCallback(d=>{if(R){if($.has(d.id)){g(L=>{const q=new Set(L);return q.delete(d.id),q}),D(d.id),s?.(null,d);return}g(L=>{const q=new Set(L);return q.add(d.id),q});const A=l?.(d,null)??null;A!==null&&typeof A<"u"?W(d.id,A):(y(d.id),O(L=>L.filter(q=>q.rowId!==d.id))),s?.(d,null);return}const f=C===d.id,j=f?d:r(C);if(w){s?.(f?null:d,j);return}if(f){o(null),c(null),s?.(null,d);return}o(d.id),c(l?.(d,j)??null),s?.(d,j)},[C,D,y,W,r,$,w,R,s,l]);return{expandedRowsToRender:a.useMemo(()=>R?M:m===null||x===null||typeof x>"u"?[]:[{rowId:m,content:x,isVisible:N}],[N,R,x,m,M]),onRowExpandChange:de}}function Te({actions:n,selectedRowsData:t}){const i=a.useMemo(()=>!n||!t.length?[]:t.reduce((l,r,h)=>{const o=n(r).filter(c=>c.multiple&&!c.hidden);if(h===0)return o;const p=new Map(l.map(c=>[c.id,c]));return o.reduce((c,m)=>{const b=p.get(m.id);return b&&c.push({...b,...m,disabled:m.disabled||b.disabled}),c},[])},[]),[n,t]),s=a.useCallback(l=>{if(t.length){if(l.onMultipleClick){l.onMultipleClick(t);return}t.forEach(r=>l.onClick(r))}},[t]);return{multiActions:i,handleMultipleActionClick:s}}function ye({data:n,onRowSelect:t,onSelectedRowsChange:i}){const[s,l]=a.useState(new Set),r=a.useMemo(()=>n?.filter(c=>s.has(c.id))??[],[n,s]);a.useEffect(()=>{if(!n?.length){l(new Set);return}l(c=>{const m=new Set,b=new Set(n.map(x=>x.id));return c.forEach(x=>{b.has(x)&&m.add(x)}),m})},[n]),a.useEffect(()=>{i&&i(r)},[r,i]);const h=a.useCallback(c=>{l(m=>{const b=new Set(m);return b.has(c.id)?(b.delete(c.id),t?.(c,!1)):(b.add(c.id),t?.(c,!0)),b})},[t]),o=a.useCallback(()=>{l(c=>{const m=new Set(c),b=n??[],x=b.every(u=>m.has(u.id));return b.forEach(u=>{const N=m.has(u.id);x?N&&(m.delete(u.id),t?.(u,!1)):N||(m.add(u.id),t?.(u,!0))}),m})},[n,t]),p=a.useMemo(()=>{if(!n?.length)return{allSelected:!1,hasSomeSelected:!1};const c=n.every(b=>s.has(b.id)),m=n.some(b=>s.has(b.id));return{allSelected:c,hasSomeSelected:m}},[n,s]);return{selectedRows:s,selectedRowsData:r,selectionState:p,onRowSelectionChange:h,onToggleAllRows:o}}function Se(n){const{data:t,onSort:i,entity:s="",isLoading:l=!1,actions:r,columns:h=[],contentClassName:o="",className:p="",softDeleteProperty:c="deletedAt",onRowSelect:m,onSelectedRowsChange:b,allowMultipleExpandedRows:x=!1,expandedRowId:u,onExpandedRowChange:N,onRowExpand:S,...$}=n,g=a.useMemo(()=>!t?.length,[t]),M=a.useCallback(D=>D===null?null:t.find(W=>W.id===D)??null,[t]),{selectedRows:O,selectedRowsData:E,selectionState:k,onRowSelectionChange:I,onToggleAllRows:w}=ye({data:t,onRowSelect:m,onSelectedRowsChange:b}),{expandedRowsToRender:R,onRowExpandChange:C}=ve({data:t,allowMultipleExpandedRows:x,controlledExpandedRowId:u,onExpandedRowChange:N,onRowExpand:S,findRowById:M}),{multiActions:z,handleMultipleActionClick:y}=Te({actions:r,selectedRowsData:E});return e.jsx(T.FiltersProvider,{children:e.jsxs("div",{className:`${p} table-main`,children:[e.jsx(ce,{columns:h,isLoading:l,...$}),l?e.jsx(be.Loading,{className:"table-loading"}):e.jsx(e.Fragment,{children:g?e.jsx(oe,{}):e.jsxs(e.Fragment,{children:[!!E.length&&e.jsx(ue,{count:E.length,multiActions:z,onActionClick:y}),e.jsx("div",{className:`${o} table-body`,children:e.jsxs("table",{className:"table-content",children:[e.jsx(Q,{entity:s,columns:h,onSortCallback:i,hasAction:!!r,selectionState:k,onToggleAllRows:w}),e.jsx("tbody",{children:e.jsx(ie,{data:t,actions:r,columns:h,softDeleteProperty:c,selectedRows:O,expandedRows:R,onRowSelectionChange:I,onRowExpand:S?C:void 0})})]})}),e.jsx(ae,{})]})})]})})}exports.ActiveFilters=ee;exports.ArrayChip=Y;exports.Columns=Q;exports.CountOfTotal=se;exports.FilterDropdown=ne;exports.Footer=ae;exports.Navigation=le;exports.PageSize=re;exports.RangeChip=Z;exports.Rows=ie;exports.Table=Se;exports.TableEmpty=oe;exports.TableHeader=ce;exports.TableSelectionBar=ue;exports.renderFilterComponent=te;
@@ -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-JDQqzO9I.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-a2z-338_.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;