@sito/dashboard 0.0.73 → 0.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Badge-DSSlox-y.cjs +1 -0
- package/dist/Badge-DW9i2Rh6.js +10 -0
- package/dist/Badge.cjs +1 -1
- package/dist/Badge.js +1 -1
- package/dist/Button-BxyXUUMe.cjs +1 -0
- package/dist/Button-C6icqzyN.js +25 -0
- package/dist/Button.cjs +1 -1
- package/dist/Button.js +1 -1
- package/dist/Chip-6bEZ7uwv.js +43 -0
- package/dist/Chip-N4r2Xf9l.cjs +1 -0
- package/dist/Chip.cjs +1 -1
- package/dist/Chip.js +1 -1
- package/dist/FileInput-C7ZYKt_i.js +100 -0
- package/dist/FileInput-Cz2R3z3k.cjs +1 -0
- package/dist/Form.cjs +1 -1
- package/dist/Form.js +2 -2
- package/dist/{IconButton-BpsTEj0z.js → IconButton-CqPk_OXG.js} +9 -8
- package/dist/IconButton-DVZCHIHB.cjs +1 -0
- package/dist/IconButton.cjs +1 -1
- package/dist/IconButton.js +1 -1
- package/dist/Loading-BTwXNOEv.js +27 -0
- package/dist/Loading-C70yH2dC.cjs +1 -0
- package/dist/Loading.cjs +1 -1
- package/dist/Loading.js +1 -1
- package/dist/SelectInput--rJuMO4C.cjs +1 -0
- package/dist/SelectInput-2oVsA3EU.js +567 -0
- package/dist/{Table-BiqQ3QxX.js → Table-BfD01_pj.js} +311 -281
- package/dist/Table-CDjW3u13.cjs +1 -0
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/Tooltip-B7LXJBLs.cjs +1 -0
- package/dist/Tooltip-p-nQtZ5Y.js +38 -0
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/classNames-DDRjbGA1.js +20 -0
- package/dist/classNames-DHAzUjfZ.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +76 -74
- package/dist/lib/classNames.d.ts +7 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +4 -2
- package/package.json +1 -1
- package/dist/Badge-CIeYthEy.js +0 -9
- package/dist/Badge-Z78MlGoQ.cjs +0 -1
- package/dist/Button-BlYa3uPc.cjs +0 -1
- package/dist/Button-D73-swfo.js +0 -24
- package/dist/Chip-C5ogKbFn.js +0 -37
- package/dist/Chip-D17UJHW6.cjs +0 -1
- package/dist/FileInput-CqzVk1gQ.cjs +0 -1
- package/dist/FileInput-Cr4TxWUg.js +0 -93
- package/dist/IconButton-CVnmT2E9.cjs +0 -1
- package/dist/Loading-B_c_4XLr.js +0 -26
- package/dist/Loading-CNECRan-.cjs +0 -1
- package/dist/SelectInput-B9EEu-h1.cjs +0 -1
- package/dist/SelectInput-H421nC22.js +0 -525
- package/dist/Table-Bfq-ASnl.cjs +0 -1
- package/dist/Tooltip-B4E-FRwY.js +0 -37
- package/dist/Tooltip-BSKAgRkc.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Ie=require("./Table.css");const e=require("react/jsx-runtime"),A=require("./classNames-DHAzUjfZ.cjs"),r=require("react"),k=require("./FiltersProvider-CnrF3xWV.cjs"),I=require("./TableColumns-BjTNomZf.cjs"),B=require("./SelectInput--rJuMO4C.cjs"),_=require("./TableOptionsProvider-bPNtpa4V.cjs"),E=require("./TranslationProvider-Czr0WIDH.cjs"),z=require("./IconButton-DVZCHIHB.cjs"),je=require("./Badge-DSSlox-y.cjs"),H=require("./lib.cjs"),J=require("./Button-BxyXUUMe.cjs"),X=require("./Chip-N4r2Xf9l.cjs"),Z=require("./Tooltip-B7LXJBLs.cjs"),ge=require("./query-81BrXp3i.cjs"),Ce=require("./Dropdown-CR8mco5s.cjs"),Ne=require("./Loading-C70yH2dC.cjs");function K(s){const{id:t,icon:a,tooltip:n,onClick:l,children:i,hidden:p=!1,disabled:c=!1,showText:u=!1,showTooltips:o=!0,className:m=""}=s;return p?null:e.jsxs("button",{type:"button",id:t,className:A.classNames("action",u?"text-action":"icon-action",m),disabled:c,"aria-label":n,onClick:d=>{d.stopPropagation(),l?.()},"aria-disabled":c,"data-tooltip-id":"tooltip","data-tooltip-content":o?n:"",children:[a," ",u&&n,i]})}function ee(s){const{actions:t=[],className:a="",itemClassName:n="",actionClassName:l="",showTooltips:i=!0,showActionTexts:p=!1}=s;return e.jsx("ul",{className:A.classNames("actions-container",a),children:t.map(c=>e.jsx("li",{className:A.classNames("actions-container-item",n),children:e.jsx(K,{showTooltips:i,showText:p,className:l,...c})},c.id))})}const te=s=>{const{actions:t=[],className:a=""}=s,{t:n}=E.useTranslation(),[l,i]=r.useState(!1),[p,c]=r.useState(null);return e.jsxs("div",{className:A.classNames("actions-dropdown",a),children:[e.jsx(z.IconButton,{icon:e.jsx(I.Ellipsis,{}),onClick:u=>{u.stopPropagation(),c(u.currentTarget),i(o=>!o)},onMouseDown:u=>u.stopPropagation(),className:"actions-dropdown-trigger","aria-label":n("_accessibility:buttons.openActions"),name:n("_accessibility:buttons.openActions"),"data-tooltip-id":"tooltip","data-tooltip-content":n("_accessibility:buttons.openActions")}),e.jsx(Ce.Dropdown,{open:l,onClose:()=>i(!1),anchorEl:p,children:e.jsx(ee,{showActionTexts:!0,actions:t,itemClassName:"w-full",actionClassName:"action-dropdown-item",className:"actions-dropdown-list",showTooltips:!1})})]})};function Q(s,t=[]){return[...s].sort((a,n)=>(n.pos??0)-(a.pos??0)).filter(a=>a.display!=="none"&&!t.includes(a.key))}function se(s){const{t}=E.useTranslation(),{entity:a="",columns:n=[],hasAction:l=!0,onSortCallback:i,selectionState:p,onToggleAllRows:c}=s,u=r.useRef(null);r.useEffect(()=>{u.current&&(u.current.indeterminate=!!(p?.hasSomeSelected&&!p?.allSelected))},[p]);const{onSort:o,sortingOrder:m,sortingBy:d,hiddenColumns:C}=_.useTableOptions(),x=r.useMemo(()=>Q(n,C).map(b=>({id:b.key,label:b.label,renderHead:b.renderHead,className:b.className??"",sortable:b.sortable??!0,sortOptions:b.sortOptions})),[n,a,t,C]);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:c?e.jsx("input",{type:"checkbox",ref:u,checked:p?.allSelected??!1,onChange:c,"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")})}),x.map(b=>e.jsx("th",{scope:"col",className:A.classNames("table-headers-column",b.className),children:e.jsxs(J.Button,{disabled:!b.sortable,onClick:()=>o(b.id,i),className:"table-headers-cell",children:[b.renderHead?b.renderHead():e.jsx("span",{className:"table-headers-label",children:b.label}),b.sortable&&d===b.id&&e.jsx("span",{children:m===ge.SortOrder.ASC?b.sortOptions?.icons?.asc??e.jsx(I.ChevronUp,{className:b.sortOptions?.icons?.className??"table-headers-sort-indicator"}):b.sortOptions?.icons?.desc??e.jsx(I.ChevronDown,{className:b.sortOptions?.icons?.className??"table-headers-sort-indicator"})})]})},b.id))]})})}function ne(s){const{columns:t}=s,{hiddenColumns:a,toggleColumn:n}=_.useTableOptions(),{t:l}=E.useTranslation(),[i,p]=r.useState(!1),c=r.useRef(null),u=r.useMemo(()=>Q(t.filter(d=>d.hideable!==!1&&d.display!=="none"),[]),[t]),o=r.useCallback(()=>{p(d=>!d)},[]),m=r.useCallback(d=>{n(d)},[n]);return u.length===0?null:e.jsxs("div",{className:"column-visibility-menu",ref:c,children:[e.jsx(z.IconButton,{icon:e.jsx(I.TableColumns,{className:"column-visibility-icon"}),className:"normal column-visibility-trigger","aria-haspopup":"true","aria-expanded":i,onClick:o,children:e.jsx("span",{className:"table-header-sr",children:l("_accessibility:buttons.columns")})}),i&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"column-visibility-backdrop",onClick:()=>p(!1)}),e.jsx("div",{className:"column-visibility-dropdown",role:"menu",children:u.map(d=>e.jsx(B.CheckInput,{checked:!a.includes(d.key),onChange:()=>m(d.key),label:d.label??d.key,containerClassName:"column-visibility-item"},d.key))})]})]})}const le=s=>{const{items:t,text:a,id:n,onClearFilter:l}=s;return e.jsx(X.Chip,{text:`${a}: ${t.map(i=>i.value??i.name).join(", ")}`,onDelete:()=>l(n)})},ae=s=>{const{end:t,start:a,text:n,id:l,onClearFilter:i}=s,p=c=>c!==null&&typeof c<"u"&&c!=="";return e.jsx(X.Chip,{text:`${n}: ${p(a)?a:"♾️"} - ${p(t)?t:"♾️"}`,onDelete:()=>i(l)})},ye=s=>typeof s=="object"&&s!==null&&!Array.isArray(s)&&("start"in s||"end"in s),ie=s=>{const{filtersDefinition:t}=s,a=r.useMemo(()=>{const c={};return t.forEach(u=>{c[u.propertyName]=u.label??u.propertyName}),c},[t]),{filters:n,clearFilters:l}=_.useTableOptions(),i=r.useMemo(()=>Object.keys(n),[n]),p=r.useCallback(c=>{const u=n[c];return ye(u)?e.jsx(ae,{id:c,text:a[c],start:u.start,end:u.end,onClearFilter:l}):Array.isArray(u)?e.jsx(le,{id:c,text:a[c],items:u,onClearFilter:l}):e.jsx(X.Chip,{text:`${a[c]}: ${u?.value??u?.name??u}`,onDelete:()=>l(c)})},[n,a,l]);return e.jsx("ul",{className:"active-filters-main",children:i?.map(c=>e.jsx("li",{children:p(c)},c))})};function ve(s){const{propertyName:t,label:a,placeholder:n,options:l,multiple:i=!0}=s,{currentFilters:p,setCurrentFilters:c}=k.useFilters(),u=r.useMemo(()=>{const m=p[t]?.value;return typeof m>"u"?null:m},[p,t]),o=r.useCallback(m=>{c({type:k.FiltersActions.update,toUpdate:{[t]:{value:m}}})},[t,c]);return e.jsx(B.AutocompleteInput,{value:u,label:a,options:l,multiple:i,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:o,placeholder:n})}const we=s=>{const{propertyName:t,label:a}=s,{currentFilters:n,setCurrentFilters:l}=k.useFilters(),i=r.useMemo(()=>n[t]?.value??"",[n]),p=r.useCallback(c=>{l({type:k.FiltersActions.update,toUpdate:{[t]:{value:c.target.checked}}})},[]);return e.jsx(B.CheckInput,{label:a,checked:i??!1,onChange:p})};function Te(s){const{propertyName:t,options:a,label:n,placeholder:l}=s,{currentFilters:i,setCurrentFilters:p}=k.useFilters(),c=r.useMemo(()=>{const o=i[t]?.value;if(o===null||typeof o>"u")return a[0]?.id??"";if(typeof o=="object"&&!Array.isArray(o)){const m=o;return m.id??m.value??""}return o},[i,a,t]),u=r.useCallback(o=>{const m=a.find(d=>String(d.id)===o.target.value);p({type:k.FiltersActions.update,toUpdate:{[t]:{value:m?.id??o.target.value}}})},[a,t,p]);return e.jsx(B.SelectInput,{value:c,label:n,options:a,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:u,placeholder:l})}const Se=s=>{const{propertyName:t,label:a,placeholder:n}=s,{currentFilters:l,setCurrentFilters:i}=k.useFilters(),p=r.useMemo(()=>l[t]?.value??"",[l]),c=r.useCallback(u=>{i({type:k.FiltersActions.update,toUpdate:{[t]:{value:u.target.value}}})},[]);return e.jsx(B.TextInput,{value:p??"",label:a,onChange:c,containerClassName:"input-widget-container",helperTextClassName:"",placeholder:n})},Y=s=>{const{propertyName:t,label:a,inputType:n}=s,{t:l}=E.useTranslation(),{currentFilters:i,setCurrentFilters:p}=k.useFilters(),c=r.useRef(null),u=r.useRef(null),o=r.useCallback(d=>{p({type:k.FiltersActions.update,toUpdate:{[t]:{value:{end:u?.current?.value??null,start:d.target.value}}}})},[]),m=r.useCallback(d=>{p({type:k.FiltersActions.update,toUpdate:{[t]:{value:{start:c?.current?.value??null,end:d.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:a}),e.jsxs("div",{className:"range-widget-row",children:[e.jsx(B.TextInput,{value:i[t]?.value?.start??"",placeholder:l("_accessibility:components.table.filters.range.start"),type:n,ref:c,onChange:o,containerClassName:"input-widget-container",helperTextClassName:""}),e.jsx(B.TextInput,{value:i[t]?.value?.end??"",placeholder:l("_accessibility:components.table.filters.range.end"),type:n,ref:u,onChange:m,containerClassName:"input-widget-container",helperTextClassName:""})]})]})},re=s=>{switch(s.type){case H.FilterTypes.text:return e.jsx(Se,{...s});case H.FilterTypes.number:return e.jsx(Y,{...s,inputType:"number"});case H.FilterTypes.date:return e.jsx(Y,{...s,inputType:"date"});case H.FilterTypes.select:return e.jsx(Te,{...s});case H.FilterTypes.autocomplete:return e.jsx(ve,{...s});case H.FilterTypes.check:return e.jsx(we,{...s})}return e.jsx(e.Fragment,{})},oe=s=>{const{filters:t=[],show:a,handleShow:n}=s,{onFilterApply:l}=_.useTableOptions(),{currentFilters:i,setCurrentFilters:p}=k.useFilters(),{t:c}=E.useTranslation(),u=r.useRef(null);return r.useEffect(()=>{const o=({target:d})=>{u.current&&(d?.closest(".filter-dropdown-trigger")||!a||u.current.contains(d)||n(!1))},m=({code:d})=>{!a||d!=="Escape"||n(!1)};return document.addEventListener("click",o),document.addEventListener("keydown",m),()=>{document.removeEventListener("click",o),document.removeEventListener("keydown",m)}},[n,a]),e.jsx("div",{className:A.classNames("filter-dropdown-backdrop",a?"opened":"closed"),children:e.jsxs("div",{className:"filter-popup",ref:u,children:[e.jsx("div",{className:"filter-title",children:c("_accessibility:buttons.filters")}),e.jsx("ul",{className:"filter-container",children:t.map(o=>e.jsx("li",{className:"filter-container-item",children:re(o)},o.propertyName))}),e.jsx("div",{className:"filter-footer",children:e.jsxs("ul",{className:"filter-buttons-row",children:[e.jsx("li",{children:e.jsx(J.Button,{type:"button",variant:"submit",onClick:()=>p({type:k.FiltersActions.reset,filters:t}),className:"filter-dropdown-button filter-dropdown-cancel",children:c("_accessibility:buttons.clear")})}),e.jsx("li",{children:e.jsx(J.Button,{type:"button",variant:"submit",color:"primary",className:"filter-dropdown-button filter-dropdown-submit",onClick:()=>{n(!1),l(i)},children:c("_accessibility:buttons.applyFilters")})})]})})]})})},ce=()=>{const{t:s}=E.useTranslation(),{total:t,pageSize:a,pageSizes:n,currentPage:l}=_.useTableOptions(),i=(l+1)*a>t?t:(l+1)*a;return e.jsxs("div",{className:"table-navigation-sizes",children:[n[0]<t&&e.jsx(e.Fragment,{children:e.jsxs("p",{children:[l*a+1," - ",i," ",s("_accessibility:components.table.of")]})}),e.jsx("p",{children:t})]})};function ke(){const{t:s}=E.useTranslation(),{total:t,pageSize:a,currentPage:n,setCurrentPage:l}=_.useTableOptions(),i=r.useMemo(()=>{const p=Math.ceil(t/a);return Array.from({length:p},(c,u)=>({id:u,value:u+1}))},[t,a]);return e.jsxs("div",{className:"jump-to-page",children:[e.jsx("p",{children:s("_accessibility:components.table.jumpToPage")}),e.jsx(B.SelectInput,{value:n,options:i,inputClassName:"jump-to-page-input",containerClassName:"jump-to-page-input-container",helperTextClassName:"hidden",onChange:p=>l(Number(p.target.value))})]})}const ue=()=>{const{t:s}=E.useTranslation(),{total:t,pageSize:a,currentPage:n,setCurrentPage:l}=_.useTableOptions(),i=Math.ceil(t/a),p=n<i-1;return e.jsxs("div",{className:"table-navigation-pages",children:[e.jsx(z.IconButton,{icon:e.jsx(I.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(z.IconButton,{icon:e.jsx(I.ChevronRight,{className:"table-navigation-icon"}),disabled:!p,className:"table-navigation-buttons",name:s("_accessibility:buttons.next"),"aria-label":s("_accessibility:buttons.next"),onClick:()=>{p&&l(n+1)}})]})};function de(){const{t:s}=E.useTranslation(),{pageSizes:t,pageSize:a,setPageSize:n}=_.useTableOptions(),l=r.useMemo(()=>t?.map(i=>({id:i,value:i})),[t]);return e.jsxs("div",{className:"page-size",children:[e.jsx("p",{children:s("_accessibility:components.table.pageSizes")}),e.jsx(B.SelectInput,{value:a,options:l,inputClassName:"page-size-input",containerClassName:"page-size-input-container",helperTextClassName:"hidden",onChange:i=>n(Number(i.target.value))})]})}function pe(){return e.jsxs("div",{className:"table-footer",children:[e.jsx(ke,{}),e.jsx(de,{}),e.jsx(ce,{}),e.jsx(ue,{})]})}const Re=s=>s,me=s=>{const{t}=E.useTranslation(),{hiddenColumns:a}=_.useTableOptions(),{columns:n,softDeleteProperty:l="deletedAt",data:i,actions:p,selectedRows:c,expandedRows:u=[],onRowSelectionChange:o,onRowExpand:m}=s,d=r.useMemo(()=>Q(n,a),[n,a]),C=r.useMemo(()=>new Map(u.map(x=>[x.rowId,x])),[u]);return i?.map(x=>{const b=c.has(x.id),y=C.get(x.id),R=!!y,P=d.length+1+(p?1:0);return e.jsxs(r.Fragment,{children:[e.jsxs("tr",{className:A.classNames("table-row",m?"expandable":"",x[l]?"deleted-class":"",b?"selected":"",R?"expanded":""),onClick:()=>m?.(x),children:[e.jsx("td",{className:"table-row-cell table-row-checkbox",children:e.jsx("input",{type:"checkbox",checked:b,onClick:v=>v.stopPropagation(),onChange:()=>o(x),"aria-label":t("_accessibility:components.table.selectRow")})}),p?e.jsx("td",{className:"w-px",children:e.jsx("div",{className:"table-row-cell-action",children:(()=>{const v=p(x).filter(g=>!g.hidden),j=v.filter(g=>g.sticky),w=v.filter(g=>!g.sticky);return e.jsxs(e.Fragment,{children:[j.map(g=>e.jsx(Z.Tooltip,{content:g.tooltip,children:e.jsx(K,{...g,onClick:()=>g.onClick(x),className:"row-table-action"})},g.id)),w.length>0&&e.jsx(te,{actions:w})]})})()})}):null,d?.map((v,j)=>{const w=x[v.key],g=v.renderBody?v.renderBody(w,x):Re(w);return e.jsx("td",{className:A.classNames("table-row-cell",j===0?"basic":"",v.className??""),children:m&&j===0?e.jsxs("div",{className:"table-row-expand-content",children:[e.jsx("span",{className:"table-row-expand-indicator","aria-hidden":!0,"data-state":R?"expanded":"collapsed",children:R?e.jsx(I.ChevronUp,{className:"table-row-expand-chevron"}):e.jsx(I.ChevronDown,{className:"table-row-expand-chevron"})}),e.jsx("div",{className:"table-row-expand-value",children:g})]}):g},v.key)})]}),R&&y?.content!==null&&typeof y?.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:A.classNames("table-row-expanded-content",y.isVisible?"open":"closed"),children:e.jsx("div",{className:"table-row-expanded-inner",children:y.content})})})})]},x.id)})};function he(){const{t:s}=E.useTranslation();return e.jsx("div",{className:"table-empty",children:e.jsx("p",{children:s("_accessibility:components.table.empty")})})}const be=s=>{const{columns:t,title:a,isLoading:n,toolbar:l,filterOptions:i,canHideColumns:p=!1,canReset:c=!1}=s,{countOfFilters:u,resetTableOptions:o}=_.useTableOptions(),{t:m}=E.useTranslation(),d=r.useMemo(()=>t?[...t].sort((j,w)=>(w.pos??0)-(j.pos??0)).filter(j=>!!j.filterOptions).map(j=>({...j.filterOptions,label:j.filterOptions?.label??j.label,propertyName:j.key})):[],[t]),[C,x]=r.useState(!1),b=r.useCallback(j=>{i?.dropdown?.setOpened?i.dropdown.setOpened(j??!1):x(j??!1)},[i]),y=r.useMemo(()=>i?.dropdown?.opened??C,[i,C]),R=d.length>0,P=R&&i?.button?.hide!==!0,v=R&&y;return e.jsxs("div",{className:A.classNames("table-header",v?"showing-filters":""),children:[e.jsxs("div",{children:[a&&e.jsx("h1",{className:"table-header-title",children:a}),n?null:e.jsxs("div",{className:"table-header-content",children:[l,p&&t&&e.jsx(ne,{columns:t}),c&&e.jsx(z.IconButton,{icon:e.jsx(I.BarsStaggered,{className:"reset-table-icon"}),className:"normal",onClick:o,children:e.jsx("span",{className:"table-header-sr",children:m("_accessibility:buttons.reset")})}),P&&e.jsxs(z.IconButton,{icon:i?.button?.icon??e.jsx(I.Filters,{className:"filter-dropdown-trigger-icon"}),className:"filter-dropdown-button normal filter-dropdown-trigger","aria-haspopup":"true",onClick:()=>b(!y),"aria-expanded":y,children:[e.jsx(je.Badge,{count:u,className:A.classNames(u>0?"show":"hide")}),e.jsx("span",{className:"table-header-sr",children:m("_accessibility:buttons.filters")}),e.jsx("wbr",{})]})]})]}),R&&e.jsx(oe,{filters:d,show:v,handleShow:b,options:i}),e.jsx(ie,{filtersDefinition:d})]})};function xe({count:s,multiActions:t,onActionClick:a}){const{t:n}=E.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(Z.Tooltip,{content:l.tooltip,children:e.jsx(z.IconButton,{icon:l.icon,className:"multi-table-action",onClick:()=>a(l),disabled:l.disabled,"aria-label":l.tooltip})},l.id))})]})}const G=220;function Fe({data:s,allowMultipleExpandedRows:t,controlledExpandedRowId:a,onExpandedRowChange:n,onRowExpand:l,findRowById:i}){const[p,c]=r.useState(null),[u,o]=r.useState(null),[m,d]=r.useState(null),[C,x]=r.useState(null),[b,y]=r.useState(!1),[R,P]=r.useState(new Set),[v,j]=r.useState([]),w=r.useRef(null),g=r.useRef(null),D=r.useRef(new Map),M=typeof a<"u",O=t&&!M,T=M?a??null:p,L=r.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null)},[]),F=r.useCallback(h=>{if(typeof h<"u"){const f=D.current.get(h);if(!f)return;clearTimeout(f),D.current.delete(h);return}D.current.forEach(f=>clearTimeout(f)),D.current.clear()},[]),U=r.useCallback(h=>{F(h),j(f=>f.some(S=>S.rowId===h)?f.map(S=>S.rowId===h?{...S,isVisible:!1}:S):f),D.current.set(h,setTimeout(()=>{j(f=>f.filter(N=>N.rowId!==h)),D.current.delete(h)},G))},[F]),W=r.useCallback((h,f)=>{F(h),j(N=>N.some(q=>q.rowId===h)?N.map(q=>q.rowId===h?{...q,content:f,isVisible:!1}:q):[...N,{rowId:h,content:f,isVisible:!1}]),requestAnimationFrame(()=>{j(N=>N.map(S=>S.rowId===h?{...S,isVisible:!0}:S))})},[F]);r.useEffect(()=>{if(!O)return;const h=new Set(s.map(f=>f.id));P(f=>{const N=new Set;return f.forEach(S=>{if(h.has(S)){N.add(S);return}F(S)}),N}),j(f=>(f.forEach(N=>{h.has(N.rowId)||F(N.rowId)}),f.filter(N=>h.has(N.rowId))))},[s,O,F]),r.useEffect(()=>{if(O)return;if(T===null){o(null),M&&(w.current=null);return}i(T)||(M||c(null),o(null),M&&(w.current=null))},[s,T,i,M,O]),r.useEffect(()=>{if(!O){if(L(),T===null||u===null){if(m===null){y(!1),x(null);return}y(!1),g.current=setTimeout(()=>{d(null),x(null),g.current=null},G);return}if(m===null){d(T),x(u),requestAnimationFrame(()=>y(!0));return}if(m===T){x(u),requestAnimationFrame(()=>y(!0));return}y(!1),g.current=setTimeout(()=>{d(T),x(u),requestAnimationFrame(()=>y(!0)),g.current=null},G)}},[L,u,T,O,m]),r.useEffect(()=>()=>{L(),F()},[L,F]),r.useEffect(()=>{if(!M)return;if(T===null){o(null),w.current=null;return}const h=i(T);if(!h){o(null),w.current=null;return}const f=w.current;o(l?.(h,f)??null),w.current=h},[T,i,M,l]);const fe=r.useCallback(h=>{if(O){if(R.has(h.id)){P($=>{const V=new Set($);return V.delete(h.id),V}),U(h.id),n?.(null,h);return}P($=>{const V=new Set($);return V.add(h.id),V});const q=l?.(h,null)??null;q!==null&&typeof q<"u"?W(h.id,q):(F(h.id),j($=>$.filter(V=>V.rowId!==h.id))),n?.(h,null);return}const f=T===h.id,N=f?h:i(T);if(M){n?.(f?null:h,N);return}if(f){c(null),o(null),n?.(null,h);return}c(h.id),o(l?.(h,N)??null),n?.(h,N)},[T,U,F,W,i,R,M,O,n,l]);return{expandedRowsToRender:r.useMemo(()=>O?v:m===null||C===null||typeof C>"u"?[]:[{rowId:m,content:C,isVisible:b}],[b,O,C,m,v]),onRowExpandChange:fe}}function Ae({actions:s,selectedRowsData:t}){const a=r.useMemo(()=>!s||!t.length?[]:t.reduce((l,i,p)=>{const c=s(i).filter(o=>o.multiple&&!o.hidden);if(p===0)return c;const u=new Map(l.map(o=>[o.id,o]));return c.reduce((o,m)=>{const d=u.get(m.id);return d&&o.push({...d,...m,disabled:m.disabled||d.disabled}),o},[])},[]),[s,t]),n=r.useCallback(l=>{if(t.length){if(l.onMultipleClick){l.onMultipleClick(t);return}t.forEach(i=>l.onClick(i))}},[t]);return{multiActions:a,handleMultipleActionClick:n}}function Ee({data:s,onRowSelect:t,onSelectedRowsChange:a}){const[n,l]=r.useState(new Set),i=r.useMemo(()=>s?.filter(o=>n.has(o.id))??[],[s,n]);r.useEffect(()=>{if(!s?.length){l(new Set);return}l(o=>{const m=new Set,d=new Set(s.map(C=>C.id));return o.forEach(C=>{d.has(C)&&m.add(C)}),m})},[s]),r.useEffect(()=>{a&&a(i)},[i,a]);const p=r.useCallback(o=>{l(m=>{const d=new Set(m);return d.has(o.id)?(d.delete(o.id),t?.(o,!1)):(d.add(o.id),t?.(o,!0)),d})},[t]),c=r.useCallback(()=>{l(o=>{const m=new Set(o),d=s??[],C=d.every(x=>m.has(x.id));return d.forEach(x=>{const b=m.has(x.id);C?b&&(m.delete(x.id),t?.(x,!1)):b||(m.add(x.id),t?.(x,!0))}),m})},[s,t]),u=r.useMemo(()=>{if(!s?.length)return{allSelected:!1,hasSomeSelected:!1};const o=s.every(d=>n.has(d.id)),m=s.some(d=>n.has(d.id));return{allSelected:o,hasSomeSelected:m}},[s,n]);return{selectedRows:n,selectedRowsData:i,selectionState:u,onRowSelectionChange:p,onToggleAllRows:c}}function Me(s){const{data:t,onSort:a,entity:n="",isLoading:l=!1,actions:i,columns:p=[],contentClassName:c="",className:u="",softDeleteProperty:o="deletedAt",onRowSelect:m,onSelectedRowsChange:d,allowMultipleExpandedRows:C=!1,expandedRowId:x,onExpandedRowChange:b,onRowExpand:y,...R}=s,P=r.useMemo(()=>!t?.length,[t]),v=r.useCallback(U=>U===null?null:t.find(W=>W.id===U)??null,[t]),{selectedRows:j,selectedRowsData:w,selectionState:g,onRowSelectionChange:D,onToggleAllRows:M}=Ee({data:t,onRowSelect:m,onSelectedRowsChange:d}),{expandedRowsToRender:O,onRowExpandChange:T}=Fe({data:t,allowMultipleExpandedRows:C,controlledExpandedRowId:x,onExpandedRowChange:b,onRowExpand:y,findRowById:v}),{multiActions:L,handleMultipleActionClick:F}=Ae({actions:i,selectedRowsData:w});return e.jsx(k.FiltersProvider,{children:e.jsxs("div",{className:A.classNames("table-main",u),children:[e.jsx(be,{columns:p,isLoading:l,...R}),l?e.jsx(Ne.Loading,{className:"table-loading"}):e.jsx(e.Fragment,{children:P?e.jsx(he,{}):e.jsxs(e.Fragment,{children:[!!w.length&&e.jsx(xe,{count:w.length,multiActions:L,onActionClick:F}),e.jsx("div",{className:A.classNames("table-body",c),children:e.jsxs("table",{className:"table-content",children:[e.jsx(se,{entity:n,columns:p,onSortCallback:a,hasAction:!!i,selectionState:g,onToggleAllRows:M}),e.jsx("tbody",{children:e.jsx(me,{data:t,actions:i,columns:p,softDeleteProperty:o,selectedRows:j,expandedRows:O,onRowSelectionChange:D,onRowExpand:y?T:void 0})})]})}),e.jsx(pe,{})]})})]})})}exports.Action=K;exports.Actions=ee;exports.ActionsDropdown=te;exports.ActiveFilters=ie;exports.ArrayChip=le;exports.ColumnVisibilityMenu=ne;exports.Columns=se;exports.CountOfTotal=ce;exports.FilterDropdown=oe;exports.Footer=pe;exports.Navigation=ue;exports.PageSize=de;exports.RangeChip=ae;exports.Rows=me;exports.Table=Me;exports.TableEmpty=he;exports.TableHeader=be;exports.TableSelectionBar=xe;exports.renderFilterComponent=re;
|
package/dist/Table.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Table-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Table-CDjW3u13.cjs");exports.ActiveFilters=e.ActiveFilters;exports.ArrayChip=e.ArrayChip;exports.ColumnVisibilityMenu=e.ColumnVisibilityMenu;exports.Columns=e.Columns;exports.CountOfTotal=e.CountOfTotal;exports.FilterDropdown=e.FilterDropdown;exports.Footer=e.Footer;exports.Navigation=e.Navigation;exports.PageSize=e.PageSize;exports.RangeChip=e.RangeChip;exports.Rows=e.Rows;exports.Table=e.Table;exports.TableEmpty=e.TableEmpty;exports.TableHeader=e.TableHeader;exports.TableSelectionBar=e.TableSelectionBar;exports.renderFilterComponent=e.renderFilterComponent;
|
package/dist/Table.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as s, b as o, a as i, C as r, c as t, F as l, d as n, N as C, P as b, R as p, e as T, h as m, T as F, f as d, g, r as u } from "./Table-
|
|
1
|
+
import { A as s, b as o, a as i, C as r, c as t, F as l, d as n, N as C, P as b, R as p, e as T, h as m, T as F, f as d, g, r as u } from "./Table-BfD01_pj.js";
|
|
2
2
|
export {
|
|
3
3
|
s as ActiveFilters,
|
|
4
4
|
o as ArrayChip,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var h=require("./Tooltip.css");const l=require("react/jsx-runtime"),m=require("./classNames-DHAzUjfZ.cjs"),e=require("react");function p(c){const{content:a,children:n,className:d=""}=c,o=e.useId(),i=e.useRef(null),u=e.useCallback(()=>{const t=i.current;if(!t)return;t.style.transform="";const s=t.getBoundingClientRect(),r=window.innerWidth;s.left<0?t.style.transform=`translateX(calc(-50% + ${Math.ceil(-s.left)}px))`:s.right>r&&(t.style.transform=`translateX(calc(-50% - ${Math.ceil(s.right-r)}px))`)},[]),f=e.isValidElement(n)?e.cloneElement(n,{"aria-describedby":o}):n;return l.jsxs("div",{className:m.classNames("tooltip-container",d),onMouseEnter:u,children:[f,l.jsx("div",{id:o,role:"tooltip",className:"tooltip-text",ref:i,children:a})]})}exports.Tooltip=p;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import "./Tooltip.css";
|
|
2
|
+
import { jsxs as m, jsx as f } from "react/jsx-runtime";
|
|
3
|
+
import { c as p } from "./classNames-DDRjbGA1.js";
|
|
4
|
+
import { useId as u, useRef as h, useCallback as g, isValidElement as x, cloneElement as y } from "react";
|
|
5
|
+
function v(s) {
|
|
6
|
+
const { content: l, children: o, className: c = "" } = s, n = u(), r = h(null), a = g(() => {
|
|
7
|
+
const t = r.current;
|
|
8
|
+
if (!t) return;
|
|
9
|
+
t.style.transform = "";
|
|
10
|
+
const e = t.getBoundingClientRect(), i = window.innerWidth;
|
|
11
|
+
e.left < 0 ? t.style.transform = `translateX(calc(-50% + ${Math.ceil(-e.left)}px))` : e.right > i && (t.style.transform = `translateX(calc(-50% - ${Math.ceil(e.right - i)}px))`);
|
|
12
|
+
}, []), d = x(o) ? y(o, {
|
|
13
|
+
"aria-describedby": n
|
|
14
|
+
}) : o;
|
|
15
|
+
return /* @__PURE__ */ m(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
className: p("tooltip-container", c),
|
|
19
|
+
onMouseEnter: a,
|
|
20
|
+
children: [
|
|
21
|
+
d,
|
|
22
|
+
/* @__PURE__ */ f(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
id: n,
|
|
26
|
+
role: "tooltip",
|
|
27
|
+
className: "tooltip-text",
|
|
28
|
+
ref: r,
|
|
29
|
+
children: l
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
v as T
|
|
38
|
+
};
|
package/dist/Tooltip.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./Tooltip-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./Tooltip-B7LXJBLs.cjs");exports.Tooltip=o.Tooltip;
|
package/dist/Tooltip.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const i = (r, t) => {
|
|
2
|
+
if (!r) return;
|
|
3
|
+
if (Array.isArray(r)) {
|
|
4
|
+
r.forEach(
|
|
5
|
+
(o) => i(o, t)
|
|
6
|
+
);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (typeof r != "string") return;
|
|
10
|
+
const n = r.trim();
|
|
11
|
+
n && t.push(n);
|
|
12
|
+
}, f = (...r) => {
|
|
13
|
+
const t = [];
|
|
14
|
+
return r.forEach(
|
|
15
|
+
(n) => i(n, t)
|
|
16
|
+
), t.join(" ").trim();
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
f as c
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=(r,t)=>{if(!r)return;if(Array.isArray(r)){r.forEach(s=>i(s,t));return}if(typeof r!="string")return;const n=r.trim();n&&t.push(n)},o=(...r)=>{const t=[];return r.forEach(n=>i(n,t)),t.join(" ").trim()};exports.classNames=o;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var h=require("./index.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./lib.cjs"),
|
|
1
|
+
var h=require("./index.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./classNames-DHAzUjfZ.cjs"),l=require("./lib.cjs"),a=require("./query-81BrXp3i.cjs"),e=require("./Table-CDjW3u13.cjs"),u=require("./Badge-DSSlox-y.cjs"),p=require("./Button-BxyXUUMe.cjs"),c=require("./Chip-N4r2Xf9l.cjs"),C=require("./Dropdown-CR8mco5s.cjs"),t=require("./SelectInput--rJuMO4C.cjs"),d=require("./FileInput-Cz2R3z3k.cjs"),T=require("./IconButton-DVZCHIHB.cjs"),F=require("./Loading-C70yH2dC.cjs"),r=require("./TableColumns-BjTNomZf.cjs"),b=require("./Close-O9P7wJGf.cjs"),m=require("./File-_Hjw2d3F.cjs"),v=require("./Tooltip-B7LXJBLs.cjs"),o=require("./FiltersProvider-CnrF3xWV.cjs"),i=require("./TableOptionsProvider-bPNtpa4V.cjs"),n=require("./TranslationProvider-Czr0WIDH.cjs");exports.classNames=s.classNames;exports.FilterTypes=l.FilterTypes;exports.SortOrder=a.SortOrder;exports.Action=e.Action;exports.Actions=e.Actions;exports.ActionsDropdown=e.ActionsDropdown;exports.ActiveFilters=e.ActiveFilters;exports.ArrayChip=e.ArrayChip;exports.ColumnVisibilityMenu=e.ColumnVisibilityMenu;exports.Columns=e.Columns;exports.CountOfTotal=e.CountOfTotal;exports.FilterDropdown=e.FilterDropdown;exports.Footer=e.Footer;exports.Navigation=e.Navigation;exports.PageSize=e.PageSize;exports.RangeChip=e.RangeChip;exports.Rows=e.Rows;exports.Table=e.Table;exports.TableEmpty=e.TableEmpty;exports.TableHeader=e.TableHeader;exports.TableSelectionBar=e.TableSelectionBar;exports.renderFilterComponent=e.renderFilterComponent;exports.Badge=u.Badge;exports.Button=p.Button;exports.Chip=c.Chip;exports.Dropdown=C.Dropdown;exports.AutocompleteInput=t.AutocompleteInput;exports.CheckInput=t.CheckInput;exports.SelectInput=t.SelectInput;exports.State=t.State;exports.TextInput=t.TextInput;exports.helperTextStateClassName=t.helperTextStateClassName;exports.inputStateClassName=t.inputStateClassName;exports.labelStateClassName=t.labelStateClassName;exports.FileInput=d.FileInput;exports.IconButton=T.IconButton;exports.Loading=F.Loading;exports.BarsStaggered=r.BarsStaggered;exports.ChevronDown=r.ChevronDown;exports.ChevronLeft=r.ChevronLeft;exports.ChevronRight=r.ChevronRight;exports.ChevronUp=r.ChevronUp;exports.Ellipsis=r.Ellipsis;exports.Filters=r.Filters;exports.TableColumns=r.TableColumns;exports.Close=b.Close;exports.File=m.File;exports.Tooltip=v.Tooltip;exports.FiltersActions=o.FiltersActions;exports.FiltersProvider=o.FiltersProvider;exports.filtersReducer=o.filtersReducer;exports.initializer=o.initializer;exports.useFilters=o.useFilters;exports.TableOptionsProvider=i.TableOptionsProvider;exports.useTableOptions=i.useTableOptions;exports.TranslationProvider=n.TranslationProvider;exports.useTranslation=n.useTranslation;
|
package/dist/index.js
CHANGED
|
@@ -1,77 +1,79 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { B as
|
|
6
|
-
import { B as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { C as ta } from "./
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { T as
|
|
2
|
+
import { c as o } from "./classNames-DDRjbGA1.js";
|
|
3
|
+
import { FilterTypes as t } from "./lib.js";
|
|
4
|
+
import { S as p } from "./query-CwuehjY1.js";
|
|
5
|
+
import { i as n, j as m, k as f, A as C, b as u, a as x, C as T, c as F, F as c, d, N as h, P as b, R as S, e as g, h as v, T as A, f as B, g as I, r as N } from "./Table-BfD01_pj.js";
|
|
6
|
+
import { B as D } from "./Badge-DW9i2Rh6.js";
|
|
7
|
+
import { B as R } from "./Button-C6icqzyN.js";
|
|
8
|
+
import { C as O } from "./Chip-6bEZ7uwv.js";
|
|
9
|
+
import { D as L } from "./Dropdown-D-fYEGo2.js";
|
|
10
|
+
import { A as z, C as j, S as H, a as M, T as U, h as V, i as q, l as G } from "./SelectInput-2oVsA3EU.js";
|
|
11
|
+
import { F as K } from "./FileInput-C7ZYKt_i.js";
|
|
12
|
+
import { I as W } from "./IconButton-CqPk_OXG.js";
|
|
13
|
+
import { L as Y } from "./Loading-BTwXNOEv.js";
|
|
14
|
+
import { B as _, C as $, a as aa, b as sa, c as ea, E as oa, F as ra, T as ta } from "./TableColumns-CIddkosX.js";
|
|
15
|
+
import { C as pa } from "./Close-rKC9AcNX.js";
|
|
16
|
+
import { F as na } from "./File-BuJndWMv.js";
|
|
17
|
+
import { T as fa } from "./Tooltip-p-nQtZ5Y.js";
|
|
18
|
+
import { a as ua, F as xa, f as Ta, i as Fa, u as ca } from "./FiltersProvider-iOkSYSFZ.js";
|
|
19
|
+
import { T as ha, u as ba } from "./TableOptionsProvider-Dzq4dOu8.js";
|
|
20
|
+
import { T as ga, u as va } from "./TranslationProvider-BR4s--Vu.js";
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
ca as
|
|
76
|
-
|
|
22
|
+
n as Action,
|
|
23
|
+
m as Actions,
|
|
24
|
+
f as ActionsDropdown,
|
|
25
|
+
C as ActiveFilters,
|
|
26
|
+
u as ArrayChip,
|
|
27
|
+
z as AutocompleteInput,
|
|
28
|
+
D as Badge,
|
|
29
|
+
_ as BarsStaggered,
|
|
30
|
+
R as Button,
|
|
31
|
+
j as CheckInput,
|
|
32
|
+
$ as ChevronDown,
|
|
33
|
+
aa as ChevronLeft,
|
|
34
|
+
sa as ChevronRight,
|
|
35
|
+
ea as ChevronUp,
|
|
36
|
+
O as Chip,
|
|
37
|
+
pa as Close,
|
|
38
|
+
x as ColumnVisibilityMenu,
|
|
39
|
+
T as Columns,
|
|
40
|
+
F as CountOfTotal,
|
|
41
|
+
L as Dropdown,
|
|
42
|
+
oa as Ellipsis,
|
|
43
|
+
na as File,
|
|
44
|
+
K as FileInput,
|
|
45
|
+
c as FilterDropdown,
|
|
46
|
+
t as FilterTypes,
|
|
47
|
+
ra as Filters,
|
|
48
|
+
ua as FiltersActions,
|
|
49
|
+
xa as FiltersProvider,
|
|
50
|
+
d as Footer,
|
|
51
|
+
W as IconButton,
|
|
52
|
+
Y as Loading,
|
|
53
|
+
h as Navigation,
|
|
54
|
+
b as PageSize,
|
|
55
|
+
S as RangeChip,
|
|
56
|
+
g as Rows,
|
|
57
|
+
H as SelectInput,
|
|
58
|
+
p as SortOrder,
|
|
59
|
+
M as State,
|
|
60
|
+
v as Table,
|
|
61
|
+
ta as TableColumns,
|
|
62
|
+
A as TableEmpty,
|
|
63
|
+
B as TableHeader,
|
|
64
|
+
ha as TableOptionsProvider,
|
|
65
|
+
I as TableSelectionBar,
|
|
66
|
+
U as TextInput,
|
|
67
|
+
fa as Tooltip,
|
|
68
|
+
ga as TranslationProvider,
|
|
69
|
+
o as classNames,
|
|
70
|
+
Ta as filtersReducer,
|
|
71
|
+
V as helperTextStateClassName,
|
|
72
|
+
Fa as initializer,
|
|
73
|
+
q as inputStateClassName,
|
|
74
|
+
G as labelStateClassName,
|
|
75
|
+
N as renderFilterComponent,
|
|
76
|
+
ca as useFilters,
|
|
77
|
+
ba as useTableOptions,
|
|
78
|
+
va as useTranslation
|
|
77
79
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type ClassNameValue = string | null | undefined | boolean | ClassNameValue[];
|
|
2
|
+
/**
|
|
3
|
+
* Joins class names while ignoring falsy values and trimming whitespace.
|
|
4
|
+
* @param classNamesList - Class names or nested class name arrays.
|
|
5
|
+
* @returns Final normalized className string.
|
|
6
|
+
*/
|
|
7
|
+
export declare const classNames: (...classNamesList: ClassNameValue[]) => string;
|
package/dist/lib/index.d.ts
CHANGED
package/dist/lib.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./classNames-DHAzUjfZ.cjs"),t=require("./query-81BrXp3i.cjs");var e=(c=>(c[c.text=0]="text",c[c.number=1]="number",c[c.select=2]="select",c[c.autocomplete=3]="autocomplete",c[c.date=4]="date",c[c.check=5]="check",c))(e||{});exports.classNames=a.classNames;exports.SortOrder=t.SortOrder;exports.FilterTypes=e;
|
package/dist/lib.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as t } from "./classNames-DDRjbGA1.js";
|
|
2
|
+
import { S as x } from "./query-CwuehjY1.js";
|
|
2
3
|
var o = /* @__PURE__ */ ((c) => (c[c.text = 0] = "text", c[c.number = 1] = "number", c[c.select = 2] = "select", c[c.autocomplete = 3] = "autocomplete", c[c.date = 4] = "date", c[c.check = 5] = "check", c))(o || {});
|
|
3
4
|
export {
|
|
4
5
|
o as FilterTypes,
|
|
5
|
-
|
|
6
|
+
x as SortOrder,
|
|
7
|
+
t as classNames
|
|
6
8
|
};
|
package/package.json
CHANGED
package/dist/Badge-CIeYthEy.js
DELETED
package/dist/Badge-Z78MlGoQ.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var c=require("./Badge.css");const n=require("react/jsx-runtime"),t=s=>{const{count:e,className:a=""}=s;return n.jsx("span",{className:`${a} badge-main`,children:e})};exports.Badge=t;
|
package/dist/Button-BlYa3uPc.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var i=require("./Button.css");const c=require("react/jsx-runtime"),a=t=>{const{children:e,type:n="button",variant:s="text",color:o="default",className:r="",...u}=t;return c.jsx("button",{type:n,className:`button ${s} ${o} ${r}`,...u,children:e})};exports.Button=a;
|
package/dist/Button-D73-swfo.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import "./Button.css";
|
|
2
|
-
import { jsx as c } from "react/jsx-runtime";
|
|
3
|
-
const m = (t) => {
|
|
4
|
-
const {
|
|
5
|
-
children: o,
|
|
6
|
-
type: r = "button",
|
|
7
|
-
variant: e = "text",
|
|
8
|
-
color: n = "default",
|
|
9
|
-
className: s = "",
|
|
10
|
-
...a
|
|
11
|
-
} = t;
|
|
12
|
-
return /* @__PURE__ */ c(
|
|
13
|
-
"button",
|
|
14
|
-
{
|
|
15
|
-
type: r,
|
|
16
|
-
className: `button ${e} ${n} ${s}`,
|
|
17
|
-
...a,
|
|
18
|
-
children: o
|
|
19
|
-
}
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
m as B
|
|
24
|
-
};
|
package/dist/Chip-C5ogKbFn.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import "./Chip.css";
|
|
2
|
-
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
3
|
-
import { C as p } from "./Close-rKC9AcNX.js";
|
|
4
|
-
import { I as d } from "./IconButton-BpsTEj0z.js";
|
|
5
|
-
function N(a) {
|
|
6
|
-
const {
|
|
7
|
-
text: s,
|
|
8
|
-
onDelete: e,
|
|
9
|
-
children: i,
|
|
10
|
-
icon: n,
|
|
11
|
-
variant: o = "default",
|
|
12
|
-
iconClassName: l = "",
|
|
13
|
-
className: c = "",
|
|
14
|
-
textClassName: m = ""
|
|
15
|
-
} = a;
|
|
16
|
-
return /* @__PURE__ */ r(
|
|
17
|
-
"div",
|
|
18
|
-
{
|
|
19
|
-
className: `chip-main ${o} ${e ? "deletable" : ""} ${c}`,
|
|
20
|
-
children: [
|
|
21
|
-
/* @__PURE__ */ t("span", { className: `chip-main-text ${m}`, children: s }),
|
|
22
|
-
i,
|
|
23
|
-
e ? /* @__PURE__ */ t(
|
|
24
|
-
d,
|
|
25
|
-
{
|
|
26
|
-
icon: n ?? /* @__PURE__ */ t(p, {}),
|
|
27
|
-
className: `chip-delete-button ${l}`,
|
|
28
|
-
onClick: e
|
|
29
|
-
}
|
|
30
|
-
) : null
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
N as C
|
|
37
|
-
};
|
package/dist/Chip-D17UJHW6.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var x=require("./Chip.css");const e=require("react/jsx-runtime"),u=require("./Close-O9P7wJGf.cjs"),m=require("./IconButton-CVnmT2E9.cjs");function h(t){const{text:n,onDelete:s,children:i,icon:c,variant:a="default",iconClassName:l="",className:o="",textClassName:r=""}=t;return e.jsxs("div",{className:`chip-main ${a} ${s?"deletable":""} ${o}`,children:[e.jsx("span",{className:`chip-main-text ${r}`,children:n}),i,s?e.jsx(m.IconButton,{icon:c??e.jsx(u.Close,{}),className:`chip-delete-button ${l}`,onClick:s}):null]})}exports.Chip=h;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var D=require("./FileInput.css");const e=require("react/jsx-runtime"),i=require("react"),j=require("./Tooltip-BSKAgRkc.cjs"),T=require("./File-_Hjw2d3F.cjs"),w=require("./Chip-D17UJHW6.cjs"),y=require("./IconButton-CVnmT2E9.cjs"),R=require("./Close-O9P7wJGf.cjs");function N(s,c=25){if(s.length<=c)return s;const a=s.lastIndexOf(".");if(a===-1)return s.slice(0,c-3)+"...";const h=s.slice(0,a),r=s.slice(a),d=c-r.length-3;return h.slice(0,d)+"..."+r}const B=i.forwardRef(function(s,c){const{children:a,label:h,containerClassName:r="",inputClassName:d="",labelClassName:g="",helperText:C="",helperTextClassName:b="",iconClassName:q="",multiple:p=!1,onChange:m,onClear:o,...f}=s,[t,x]=i.useState([]),k=i.useCallback(l=>{if(l.target.files){const n=Array.from(l.target.files);x(u=>p?[...u,...n]:n.slice(0,1))}m?.(l)},[p,m]),v=i.useCallback(l=>{x(n=>{const u=n.filter((A,$)=>$!==l);return u.length===0&&o?.(),u})},[o]),F=i.useCallback(()=>{x([]),o?.()},[o]),I=i.useCallback(l=>{l.currentTarget.value=""},[]);return e.jsxs("div",{className:`file-input-container ${r}`,children:[t.length===0&&e.jsxs("label",{htmlFor:f.id,className:`${g}`,children:[h,e.jsx("input",{type:"file",ref:c,multiple:p,onClick:I,onChange:k,className:`file-input ${d}`,...f}),f.required?" *":""]}),t.length>1&&e.jsx("ul",{className:"file-preview-list",children:t.map((l,n)=>e.jsx("li",{children:e.jsx(j.Tooltip,{content:l.name,children:e.jsx(w.Chip,{text:N(l.name,25),onDelete:()=>v(n)})})},`${l.name}-${l.lastModified}`))}),t.length===1&&e.jsxs("div",{className:"file-preview",children:[e.jsx(T.File,{className:`file-icon ${q}`}),e.jsx(j.Tooltip,{content:t[0]?.name??"",children:e.jsx("span",{className:"file-preview-name",children:N(t[0]?.name??"",25)})}),e.jsx(y.IconButton,{icon:e.jsx(R.Close,{}),onClick:F,type:"button"})]}),a,!!C&&e.jsx("p",{className:`file-input-helper-text ${b}`,children:C})]})});exports.FileInput=B;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import "./FileInput.css";
|
|
2
|
-
import { jsxs as C, jsx as l } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef as j, useState as R, useCallback as m } from "react";
|
|
4
|
-
import { T as x } from "./Tooltip-B4E-FRwY.js";
|
|
5
|
-
import { F as q } from "./File-BuJndWMv.js";
|
|
6
|
-
import { C as A } from "./Chip-C5ogKbFn.js";
|
|
7
|
-
import { I as B } from "./IconButton-BpsTEj0z.js";
|
|
8
|
-
import { C as D } from "./Close-rKC9AcNX.js";
|
|
9
|
-
function v(t, s = 25) {
|
|
10
|
-
if (t.length <= s) return t;
|
|
11
|
-
const a = t.lastIndexOf(".");
|
|
12
|
-
if (a === -1)
|
|
13
|
-
return t.slice(0, s - 3) + "...";
|
|
14
|
-
const p = t.slice(0, a), r = t.slice(a), f = s - r.length - 3;
|
|
15
|
-
return p.slice(0, f) + "..." + r;
|
|
16
|
-
}
|
|
17
|
-
const K = j(function(t, s) {
|
|
18
|
-
const {
|
|
19
|
-
children: a,
|
|
20
|
-
label: p,
|
|
21
|
-
containerClassName: r = "",
|
|
22
|
-
inputClassName: f = "",
|
|
23
|
-
labelClassName: F = "",
|
|
24
|
-
helperText: N = "",
|
|
25
|
-
helperTextClassName: $ = "",
|
|
26
|
-
iconClassName: b = "",
|
|
27
|
-
multiple: d = !1,
|
|
28
|
-
onChange: g,
|
|
29
|
-
onClear: o,
|
|
30
|
-
...h
|
|
31
|
-
} = t, [n, u] = R([]), I = m(
|
|
32
|
-
(e) => {
|
|
33
|
-
if (e.target.files) {
|
|
34
|
-
const i = Array.from(e.target.files);
|
|
35
|
-
u(
|
|
36
|
-
(c) => d ? [...c, ...i] : i.slice(0, 1)
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
g?.(e);
|
|
40
|
-
},
|
|
41
|
-
[d, g]
|
|
42
|
-
), w = m(
|
|
43
|
-
(e) => {
|
|
44
|
-
u((i) => {
|
|
45
|
-
const c = i.filter((M, y) => y !== e);
|
|
46
|
-
return c.length === 0 && o?.(), c;
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
[o]
|
|
50
|
-
), T = m(() => {
|
|
51
|
-
u([]), o?.();
|
|
52
|
-
}, [o]), k = m(
|
|
53
|
-
(e) => {
|
|
54
|
-
e.currentTarget.value = "";
|
|
55
|
-
},
|
|
56
|
-
[]
|
|
57
|
-
);
|
|
58
|
-
return /* @__PURE__ */ C("div", { className: `file-input-container ${r}`, children: [
|
|
59
|
-
n.length === 0 && /* @__PURE__ */ C("label", { htmlFor: h.id, className: `${F}`, children: [
|
|
60
|
-
p,
|
|
61
|
-
/* @__PURE__ */ l(
|
|
62
|
-
"input",
|
|
63
|
-
{
|
|
64
|
-
type: "file",
|
|
65
|
-
ref: s,
|
|
66
|
-
multiple: d,
|
|
67
|
-
onClick: k,
|
|
68
|
-
onChange: I,
|
|
69
|
-
className: `file-input ${f}`,
|
|
70
|
-
...h
|
|
71
|
-
}
|
|
72
|
-
),
|
|
73
|
-
h.required ? " *" : ""
|
|
74
|
-
] }),
|
|
75
|
-
n.length > 1 && /* @__PURE__ */ l("ul", { className: "file-preview-list", children: n.map((e, i) => /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(x, { content: e.name, children: /* @__PURE__ */ l(
|
|
76
|
-
A,
|
|
77
|
-
{
|
|
78
|
-
text: v(e.name, 25),
|
|
79
|
-
onDelete: () => w(i)
|
|
80
|
-
}
|
|
81
|
-
) }) }, `${e.name}-${e.lastModified}`)) }),
|
|
82
|
-
n.length === 1 && /* @__PURE__ */ C("div", { className: "file-preview", children: [
|
|
83
|
-
/* @__PURE__ */ l(q, { className: `file-icon ${b}` }),
|
|
84
|
-
/* @__PURE__ */ l(x, { content: n[0]?.name ?? "", children: /* @__PURE__ */ l("span", { className: "file-preview-name", children: v(n[0]?.name ?? "", 25) }) }),
|
|
85
|
-
/* @__PURE__ */ l(B, { icon: /* @__PURE__ */ l(D, {}), onClick: T, type: "button" })
|
|
86
|
-
] }),
|
|
87
|
-
a,
|
|
88
|
-
!!N && /* @__PURE__ */ l("p", { className: `file-input-helper-text ${$}`, children: N })
|
|
89
|
-
] });
|
|
90
|
-
});
|
|
91
|
-
export {
|
|
92
|
-
K as F
|
|
93
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var m=require("./IconButton.css");const t=require("react/jsx-runtime"),l=n=>{const{children:s,icon:c,type:e="button",className:o="",variant:a="text",color:r="default",iconClassName:i="",...u}=n;return t.jsxs("button",{type:e,className:`icon-button ${o} ${a} ${r}`,...u,children:[t.jsx("span",{className:i,children:c}),s]})};exports.IconButton=l;
|
package/dist/Loading-B_c_4XLr.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import "./Loading.css";
|
|
2
|
-
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
-
function n(r) {
|
|
4
|
-
const {
|
|
5
|
-
color: a = "stroke-blue-800",
|
|
6
|
-
className: l = "",
|
|
7
|
-
loaderClass: s = "",
|
|
8
|
-
strokeWidth: i = "4",
|
|
9
|
-
...c
|
|
10
|
-
} = r;
|
|
11
|
-
return /* @__PURE__ */ e("div", { ...c, className: `loading ${l}`, children: /* @__PURE__ */ e("div", { className: "loader-container", children: /* @__PURE__ */ e("div", { className: `loader ${s}`, children: /* @__PURE__ */ e("svg", { className: "circular", viewBox: "25 25 50 50", children: /* @__PURE__ */ e(
|
|
12
|
-
"circle",
|
|
13
|
-
{
|
|
14
|
-
className: `path ${a}`,
|
|
15
|
-
cx: "50",
|
|
16
|
-
cy: "50",
|
|
17
|
-
r: "20",
|
|
18
|
-
fill: "none",
|
|
19
|
-
strokeWidth: i,
|
|
20
|
-
strokeMiterlimit: "10"
|
|
21
|
-
}
|
|
22
|
-
) }) }) }) });
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
n as L
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n=require("./Loading.css");const s=require("react/jsx-runtime");function o(e){const{color:i="stroke-blue-800",className:r="",loaderClass:a="",strokeWidth:c="4",...l}=e;return s.jsx("div",{...l,className:`loading ${r}`,children:s.jsx("div",{className:"loader-container",children:s.jsx("div",{className:`loader ${a}`,children:s.jsx("svg",{className:"circular",viewBox:"25 25 50 50",children:s.jsx("circle",{className:`path ${i}`,cx:"50",cy:"50",r:"20",fill:"none",strokeWidth:c,strokeMiterlimit:"10"})})})})})}exports.Loading=o;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var X=require("./SelectInput.css");const l=require("react/jsx-runtime"),r=require("react"),K=require("./Chip-D17UJHW6.cjs"),_=require("./IconButton-CVnmT2E9.cjs"),z=require("./Close-O9P7wJGf.cjs"),G=r.forwardRef(function(s,p){const{state:f,value:t,onChange:a,options:j=[],name:$="",id:S="",label:k="",containerClassName:A="",inputContainerClassName:v="",helperText:I="",placeholder:T="",multiple:h=!1,...D}=s,[u,m]=r.useState("");r.useEffect(()=>{if(!h&&t&&!Array.isArray(t)){m(String(t.value??t.name??""));return}m("")},[h,t]);const[g,x]=r.useState(!1),[C,y]=r.useState(-1),o=r.useMemo(()=>j.filter(e=>{const n=String(e.value??e.name).toLowerCase().includes(u?.toLowerCase());return Array.isArray(t)&&t.length?n&&!t.some(d=>d.id===e.id):t&&!Array.isArray(t)?n&&t.id!==e.id:n}),[j,t,u]);r.useEffect(()=>{if(!g||!o.length){y(-1);return}y(0)},[g,o]);const c=r.useRef(null),N=r.useRef(null),[E,w]=r.useState(!1),i=r.useRef(null);r.useEffect(()=>{const e=d=>{c.current&&!c.current.contains(d.target)&&x(!1)},n=d=>{d.key==="Escape"&&x(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",n),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",n)}},[]);const b=r.useCallback(e=>{m(e.target.value)},[]),R=r.useCallback(e=>{e?h?(m(""),Array.isArray(t)&&t.length?a([...t,e]):a([e])):(m(String(e.name??e.value??"")),a(e)):a(null),x(!1)},[h,a,t]),B=r.useCallback(e=>{if(!o.length){e.key==="Escape"&&x(!1);return}if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(e.preventDefault(),!g){x(!0),y(0);return}y(n=>{const d=n>=0?n:0;return e.key==="ArrowDown"?(d+1+o.length)%o.length:(d-1+o.length)%o.length});return}if(e.key==="Enter"&&g){e.preventDefault();const n=C>=0?C:0;R(o[n]);return}e.key==="Escape"&&g&&(e.preventDefault(),x(!1))},[R,C,g,o]),F=r.useCallback(e=>{if(!Array.isArray(t)){a(null);return}const n=t.filter((d,P)=>P!==e);n.length?a(n):a(null)},[a,t]),H=r.useCallback(()=>{Array.isArray(t)&&a([t[0]])},[a,t]);return r.useLayoutEffect(()=>{const e=i.current?.offsetWidth??0,n=c.current?.offsetWidth??0;w(e>n*.4)},[t]),l.jsxs("div",{className:`autocomplete-input-container ${A}`,ref:c,children:[l.jsxs("div",{className:"autocomplete-value-input-container",children:[l.jsx(U,{state:f,name:$,id:S,value:u,onChange:b,placeholder:T,helperText:I,onFocus:()=>x(!0),onKeyDown:B,label:k,containerClassName:`autocomplete-text-input ${v}`,ref:p??N,...D,children:!h&&t&&!Array.isArray(t)&&(t.value||t.name)&&l.jsx(_.IconButton,{icon:l.jsx(z.Close,{}),className:"autocomplete-delete-button",onClick:e=>{R(),e.stopPropagation()}})}),h&&Array.isArray(t)&&t.length?l.jsx("ul",{ref:i,className:"autocomplete-value-container",children:E?l.jsxs(l.Fragment,{children:[l.jsx("li",{children:l.jsx(K.Chip,{text:t[0]?.value??t[0]?.name,onDelete:e=>{F(0),e.stopPropagation()}})}),t.length>1&&l.jsx("li",{children:l.jsx(K.Chip,{text:`+${t.length-1}`,onDelete:e=>{H(),e.stopPropagation()}})})]}):t.map((e,n)=>l.jsx("li",{children:l.jsx(K.Chip,{text:String(e.value??e.name),onDelete:d=>{F(n),d.stopPropagation()}})},e.id??e.value??e.name))}):null]}),g&&l.jsx("ul",{className:"autocomplete-suggestions-container",style:{width:c.current?.offsetWidth},children:o.map(e=>l.jsx("li",{className:`autocomplete-suggestion-item ${e.id===o[C]?.id?"highlighted":""}`,onMouseEnter:()=>y(o.findIndex(n=>n.id===e.id)),onClick:n=>{R(e),n.stopPropagation()},children:e.value??e.name},e.id??e.value??e.name))})]})});var L=(s=>(s.error="error",s.good="good",s.default="default",s))(L||{});const q=s=>{switch(s){case"error":return"input-error";case"good":return"input-good";default:return"input-normal"}},O=s=>{switch(s){case"error":return"input-label-error";case"good":return"input-label-good";default:return"input-label-normal"}},M=s=>{switch(s){case"error":return"input-helper-text-error";case"good":return"input-helper-text-good";default:return"input-helper-text-normal"}},J=r.forwardRef(function(s,p){const{checked:f,onChange:t,name:a="",id:j="",label:$="",state:S=L.default,containerClassName:k="",inputClassName:A="",labelClassName:v="",...I}=s;return l.jsxs("label",{className:`input-check-container ${k}`,children:[l.jsx("input",{id:j,ref:p,name:a,type:"checkbox",checked:f,onChange:t,className:`input-check ${q(S)} ${A}`,...I}),l.jsx("span",{className:`input-check-label ${O(S)} ${v}`,children:$})]})}),W=s=>s==null?!1:Array.isArray(s)?s.length>0:`${s}`.length>0,U=r.forwardRef(function(s,p){const{children:f,state:t=L.default,label:a="",containerClassName:j="",inputClassName:$="",labelClassName:S="",helperText:k="",helperTextClassName:A="",value:v,defaultValue:I,onChange:T,onFocus:h,onBlur:D,...u}=s,m=v!==void 0,[g,x]=r.useState(()=>W(I)),[C,y]=r.useState(!1),o=m?W(v):g,c=u.type==="date",N=!!u.placeholder||C||c,E=b=>{m||x(b.currentTarget.value.length>0),T?.(b)},w=b=>{C||y(!0),h?.(b)},i=b=>{C||y(!0),D?.(b)};return l.jsxs("div",{className:`text-input-container ${j}`,children:[l.jsx("input",{ref:p,defaultValue:I,onChange:E,onFocus:w,onBlur:i,...m?{value:v}:{},className:`text-input ${q(t)} ${$} ${o?"has-value":""} ${u.placeholder?"has-placeholder":""} ${N?"keep-label-up":""}`,...u}),!!a&&l.jsxs("label",{htmlFor:u.id,className:`text-input-label ${O(t)} ${S}`,children:[a,u.required?" *":""]}),f,!!k&&l.jsx("p",{className:`text-input-helper-text ${M(t)} ${A}`,children:k})]})}),Q=r.forwardRef(function(s,p){const{value:f,onChange:t,options:a,containerClassName:j="",inputClassName:$="",labelClassName:S="",helperText:k="",helperTextClassName:A="",label:v="",placeholder:I="",name:T="",id:h="",state:D=L.default,native:u=!0,disabled:m,required:g,autoFocus:x,children:C,...y}=s,o=r.useRef(null),[c,N]=r.useState(!1),[E,w]=r.useState(-1),i=r.useMemo(()=>a.findIndex(e=>String(e.id)===String(f??a[0]?.id??"")),[a,f]),b=r.useMemo(()=>i>=0?a[i]:void 0,[a,i]);r.useEffect(()=>{if(!(u||!c)){if(!a.length){w(-1);return}w(i>=0?i:0)}},[u,a.length,i,c]),r.useEffect(()=>{if(u)return;const e=n=>{o.current&&!o.current.contains(n.target)&&N(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[u]);const R=r.useCallback(e=>{p&&(typeof p=="function"?p(e):p.current=e)},[p]),B=r.useCallback(e=>{if(!t)return;const n={target:{value:String(e)},currentTarget:{value:String(e)}};t(n)},[t]),F=r.useCallback(e=>{const n=a[e];n&&(B(n.id),N(!1))},[B,a]),H=r.useCallback(e=>{if(a.length){if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(e.preventDefault(),!c){N(!0);const n=i>=0?i:0;w(n);return}w(n=>{const d=n>=0?n:i;return e.key==="ArrowDown"?(d+1+a.length)%a.length:(d-1+a.length)%a.length});return}if(e.key==="Enter"){if(!c){e.preventDefault(),N(!0),w(i>=0?i:0);return}e.preventDefault(),F(E>=0?E:0);return}e.key==="Escape"&&c&&(e.preventDefault(),N(!1))}},[E,a,F,i,c]);return u?l.jsxs("div",{className:`select-input-container ${j}`,children:[l.jsx("select",{...y,id:h,ref:R,name:T,value:f,onChange:t,className:`select-input ${q(D)} peer ${$}`,children:a?.map(e=>l.jsx("option",{value:e.id,children:e.value??e.name??e.id},e.id))}),l.jsx("label",{htmlFor:h,className:`select-input-label ${O(D)} ${S}`,children:v}),C,k&&l.jsx("p",{className:`select-input-helper-text ${M(D)} ${A}`,children:k})]}):l.jsxs("div",{ref:o,className:`select-input-container ${j}`,children:[l.jsx("select",{...y,ref:R,name:T,id:h,value:f,onChange:t,className:"select-input-native-hidden",tabIndex:-1,"aria-hidden":!0,children:a?.map(e=>l.jsx("option",{value:e.id,children:e.value??e.name??e.id},e.id))}),l.jsx(U,{id:h,name:T,state:D,value:String(b?.value??b?.name??""),readOnly:!0,label:v,helperText:k,containerClassName:"select-input-text-container",inputClassName:`select-input-text ${$}`,labelClassName:S,helperTextClassName:A,placeholder:I,disabled:m,required:g,autoFocus:x,onClick:()=>N(e=>!e),onKeyDown:H,onFocus:()=>N(!0),role:"combobox","aria-expanded":c,"aria-haspopup":"listbox",children:C}),c&&l.jsx("ul",{className:"select-input-options-container",role:"listbox",children:a.map((e,n)=>{const d=String(e.id)===String(f),P=n===E;return l.jsx("li",{role:"option","aria-selected":d,className:`select-input-option-item ${P?"highlighted":""}`,onMouseEnter:()=>w(n),onClick:V=>{F(n),V.stopPropagation()},children:e.value??e.name??e.id},e.id)})})]})});exports.AutocompleteInput=G;exports.CheckInput=J;exports.SelectInput=Q;exports.State=L;exports.TextInput=U;exports.helperTextStateClassName=M;exports.inputStateClassName=q;exports.labelStateClassName=O;
|