@sito/dashboard 0.0.65 → 0.0.67
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/README.md +3 -2
- package/dist/Badge-CIeYthEy.js +9 -0
- package/dist/Badge-Z78MlGoQ.cjs +1 -0
- package/dist/Badge.cjs +1 -0
- package/dist/Badge.css +1 -0
- package/dist/Badge.d.ts +2 -0
- package/dist/Badge.js +4 -0
- package/dist/Button-BlYa3uPc.cjs +1 -0
- package/dist/Button-D73-swfo.js +24 -0
- package/dist/Button.cjs +1 -0
- package/dist/Button.css +1 -0
- package/dist/Button.d.ts +2 -0
- package/dist/Button.js +4 -0
- package/dist/Chip-C5ogKbFn.js +37 -0
- package/dist/Chip-D17UJHW6.cjs +1 -0
- package/dist/Chip.cjs +1 -0
- package/dist/Chip.css +1 -0
- package/dist/Chip.d.ts +2 -0
- package/dist/Chip.js +4 -0
- package/dist/Close-O9P7wJGf.cjs +1 -0
- package/dist/Close-rKC9AcNX.js +17 -0
- package/dist/Dropdown-CAxauIXt.cjs +1 -0
- package/dist/Dropdown-CbaxuMbk.js +63 -0
- package/dist/Dropdown.cjs +1 -0
- package/dist/Dropdown.css +1 -0
- package/dist/Dropdown.d.ts +2 -0
- package/dist/Dropdown.js +4 -0
- package/dist/File-BuJndWMv.js +17 -0
- package/dist/File-_Hjw2d3F.cjs +1 -0
- package/dist/FileInput-Ch-GCxrS.cjs +1 -0
- package/dist/FileInput-DCR_Pyqe.js +91 -0
- package/dist/FileInput.css +1 -0
- package/dist/Filters-DL5jd8ps.js +78 -0
- package/dist/Filters-Dyee8QYH.cjs +1 -0
- package/dist/FiltersProvider-CY2fsw_F.js +57 -0
- package/dist/FiltersProvider-CYqLFEI9.cjs +1 -0
- package/dist/FiltersProvider.cjs +1 -0
- package/dist/FiltersProvider.d.ts +2 -0
- package/dist/FiltersProvider.js +8 -0
- package/dist/Form.cjs +1 -0
- package/dist/Form.d.ts +2 -0
- package/dist/Form.js +13 -0
- package/dist/IconButton-BpsTEj0z.js +29 -0
- package/dist/IconButton-CVnmT2E9.cjs +1 -0
- package/dist/IconButton.cjs +1 -0
- package/dist/IconButton.css +1 -0
- package/dist/IconButton.d.ts +2 -0
- package/dist/IconButton.js +4 -0
- package/dist/Loading-B_c_4XLr.js +26 -0
- package/dist/Loading-CNECRan-.cjs +1 -0
- package/dist/Loading.cjs +1 -0
- package/dist/Loading.css +1 -0
- package/dist/Loading.d.ts +2 -0
- package/dist/Loading.js +4 -0
- package/dist/SvgIcons.cjs +1 -0
- package/dist/SvgIcons.d.ts +2 -0
- package/dist/SvgIcons.js +13 -0
- package/dist/Table-BtZGG0d7.js +1056 -0
- package/dist/Table-DjIhOMXQ.cjs +1 -0
- package/dist/Table.cjs +1 -0
- package/dist/Table.css +1 -0
- package/dist/Table.d.ts +2 -0
- package/dist/Table.js +18 -0
- package/dist/TableOptions.cjs +1 -0
- package/dist/TableOptions.d.ts +2 -0
- package/dist/TableOptions.js +5 -0
- package/dist/TableOptionsProvider-BchUDA3B.cjs +1 -0
- package/dist/TableOptionsProvider-BfQS8l1N.js +50 -0
- package/dist/TextInput-BqW5YX-3.js +320 -0
- package/dist/TextInput-CY1fh4mf.cjs +1 -0
- package/dist/TextInput.css +1 -0
- package/dist/Tooltip-B4E-FRwY.js +37 -0
- package/dist/Tooltip-BSKAgRkc.cjs +1 -0
- package/dist/Tooltip.cjs +1 -0
- package/dist/Tooltip.css +1 -0
- package/dist/Tooltip.d.ts +2 -0
- package/dist/Tooltip.js +4 -0
- package/dist/Translation.cjs +1 -0
- package/dist/Translation.d.ts +2 -0
- package/dist/Translation.js +5 -0
- package/dist/TranslationProvider-51Pc9Xrr.cjs +1 -0
- package/dist/TranslationProvider-COebIyxr.js +19 -0
- package/dist/components/Actions/Action.d.ts +18 -0
- package/dist/components/Actions/Actions.d.ts +14 -0
- package/dist/components/Actions/Actions.stories.d.ts +20 -0
- package/dist/components/Actions/Actions.test.d.ts +1 -0
- package/dist/components/Actions/ActionsDropdown.d.ts +10 -0
- package/dist/components/Actions/ActionsDropdown.stories.d.ts +17 -0
- package/dist/components/Actions/ActionsDropdown.test.d.ts +1 -0
- package/dist/components/Actions/index.d.ts +4 -0
- package/dist/components/Actions/types.d.ts +17 -0
- package/dist/components/Button/Button.stories.d.ts +1 -0
- package/dist/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.stories.d.ts +1 -0
- package/dist/components/Dropdown/types.d.ts +1 -0
- package/dist/components/Form/FileInput/FileInput.test.d.ts +1 -0
- package/dist/components/Form/TextInput/TextInput.stories.d.ts +1 -0
- package/dist/components/Form/TextInput/TextInput.test.d.ts +1 -0
- package/dist/components/IconButton/IconButton.stories.d.ts +1 -0
- package/dist/components/SvgIcons/Ellipsis.d.ts +7 -0
- package/dist/components/SvgIcons/index.d.ts +1 -0
- package/dist/components/Table/Table.stories.d.ts +1 -0
- package/dist/components/Table/types.d.ts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.css +1 -0
- package/dist/index.js +74 -0
- package/dist/lib.cjs +1 -0
- package/dist/lib.d.ts +2 -0
- package/dist/lib.js +6 -0
- package/dist/query-81BrXp3i.cjs +1 -0
- package/dist/query-CwuehjY1.js +4 -0
- package/dist/setupTests.d.ts +0 -0
- package/package.json +83 -9
- package/dist/dashboard.cjs +0 -1
- package/dist/dashboard.js +0 -1661
- package/dist/main.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Ee=require("./Table.css");const e=require("react/jsx-runtime"),o=require("react"),w=require("./FiltersProvider-CYqLFEI9.cjs"),xe=require("./Badge-Z78MlGoQ.cjs"),B=require("./Filters-Dyee8QYH.cjs"),z=require("./lib.cjs"),A=require("./TranslationProvider-51Pc9Xrr.cjs"),$=require("./TextInput-CY1fh4mf.cjs"),_=require("./TableOptionsProvider-BchUDA3B.cjs"),J=require("./Chip-D17UJHW6.cjs"),L=require("./IconButton-CVnmT2E9.cjs"),G=require("./Tooltip-BSKAgRkc.cjs"),be=require("./query-81BrXp3i.cjs"),fe=require("./Button-BlYa3uPc.cjs"),je=require("./Dropdown-CAxauIXt.cjs"),ge=require("./Loading-CNECRan-.cjs");function K(s){const{id:t,icon:r,tooltip:n,onClick:l,children:a,hidden:p=!1,disabled:i=!1,showText:d=!1,showTooltips:c=!0,className:h=""}=s;return p?null:e.jsxs("button",{id:t,className:`action ${d?"text-action":"icon-action"} ${h}`,disabled:i,onClick:()=>l?.(),"aria-disabled":i,"data-tooltip-id":"tooltip","data-tooltip-content":c?n:"",children:[r," ",d&&n,a]})}function Q(s){const{actions:t=[],className:r="",itemClassName:n="",actionClassName:l="",showTooltips:a=!0,showActionTexts:p=!1}=s;return e.jsx("ul",{className:`actions-container ${r}`,children:t.map(i=>e.jsx("li",{className:`actions-container-item ${n}`,children:e.jsx(K,{showTooltips:a,showText:p,className:l,...i})},i.id))})}const Y=s=>{const{actions:t=[],className:r=""}=s,{t:n}=A.useTranslation(),[l,a]=o.useState(!1),[p,i]=o.useState(null);return e.jsxs("div",{className:`actions-dropdown ${r}`,children:[e.jsx(L.IconButton,{icon:e.jsx(B.Ellipsis,{}),onClick:d=>{i(d.currentTarget),a(c=>!c)},className:"actions-dropdown-trigger","data-tooltip-id":"tooltip","data-tooltip-content":n("_accessibility:buttons.openActions")}),e.jsx(je.Dropdown,{open:l,onClose:()=>a(!1),anchorEl:p,children:e.jsx(Q,{showActionTexts:!0,actions:t,itemClassName:"w-full",actionClassName:"action-dropdown-item",className:"actions-dropdown-list",showTooltips:!1})})]})};function Z(s){return[...s].sort((t,r)=>(r.pos??0)-(t.pos??0)).filter(t=>t.display!=="none")}function ee(s){const{t}=A.useTranslation(),{entity:r="",columns:n=[],hasAction:l=!0,onSortCallback:a,selectionState:p,onToggleAllRows:i}=s,d=o.useRef(null);o.useEffect(()=>{d.current&&(d.current.indeterminate=!!(p?.hasSomeSelected&&!p?.allSelected))},[p]);const{onSort:c,sortingOrder:h,sortingBy:x}=_.useTableOptions(),b=o.useMemo(()=>Z(n).map(u=>({id:u.key,label:u.label,className:u.className??"",sortable:u.sortable??!0,sortOptions:u.sortOptions})),[n,r,t]);return e.jsx("thead",{className:"table-headers-row",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"table-headers-column table-headers-checkbox",children:i?e.jsx("input",{type:"checkbox",ref:d,checked:p?.allSelected??!1,onChange:i,"aria-label":t("_accessibility:components.table.selectAllRows")}):null}),l&&e.jsx("th",{scope:"col",className:"table-headers-action",children:e.jsx("span",{children:t("_accessibility:labels.actions")})}),b.map(u=>e.jsx("th",{scope:"col",className:`table-headers-column ${u.className}`,children:e.jsxs(fe.Button,{disabled:!u.sortable,onClick:()=>c(u.id,a),className:"table-headers-cell",children:[e.jsx("span",{className:"table-headers-label",children:u.label}),u.sortable&&x===u.id&&e.jsx("span",{children:h===be.SortOrder.ASC?u.sortOptions?.icons?.asc??e.jsx(B.ChevronUp,{className:u.sortOptions?.icons?.className??"table-headers-sort-indicator"}):u.sortOptions?.icons?.desc??e.jsx(B.ChevronDown,{className:u.sortOptions?.icons?.className??"table-headers-sort-indicator"})})]})},u.id))]})})}const te=s=>{const{items:t,text:r,id:n,onClearFilter:l}=s;return e.jsx(J.Chip,{text:`${r}: ${t.map(a=>a.value??a.name).join(", ")}`,onDelete:()=>l(n)})},se=s=>{const{end:t,start:r,text:n,id:l,onClearFilter:a}=s;return e.jsx(J.Chip,{text:`${n}: ${r||"♾️"} - ${t||"♾️"}`,onDelete:()=>a(l)})},ne=s=>{const{filtersDefinition:t}=s,r=o.useMemo(()=>{const i={};return t.forEach(d=>{i[d.propertyName]=d.label??d.propertyName}),i},[t]),{filters:n,clearFilters:l}=_.useTableOptions(),a=o.useMemo(()=>Object.keys(n),[n]),p=o.useCallback(i=>n[i]?.end||n[i]?.start?e.jsx(se,{id:i,text:r[i],start:n[i].start,end:n[i].end,onClearFilter:l}):Array.isArray(n[i])?e.jsx(te,{id:i,text:r[i],items:n[i],onClearFilter:l}):e.jsx(J.Chip,{text:`${r[i]}: ${n[i]?.value??n[i]?.name??n[i]}`,onDelete:()=>l(i)}),[n,r]);return e.jsx("ul",{className:"active-filters-main",children:a?.map(i=>e.jsx("li",{children:p(i)},i))})};function Ce(s){const{propertyName:t,label:r,placeholder:n,options:l,multiple:a=!0}=s,{currentFilters:p,setCurrentFilters:i}=w.useFilters(),d=o.useMemo(()=>p[t]??l[0],[p]),c=o.useCallback(h=>{i({type:w.FiltersActions.update,toUpdate:{[t]:{value:h}}})},[a]);return e.jsx($.AutocompleteInput,{value:d?.value,label:r,options:l,multiple:a,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:c,placeholder:n})}const Ne=s=>{const{propertyName:t,label:r}=s,{currentFilters:n,setCurrentFilters:l}=w.useFilters(),a=o.useMemo(()=>n[t]?.value??"",[n]),p=o.useCallback(i=>{l({type:w.FiltersActions.update,toUpdate:{[t]:{value:i.target.checked}}})},[]);return e.jsx($.CheckInput,{label:r,checked:a??!1,onChange:p})};function Te(s){const{propertyName:t,options:r,label:n,placeholder:l}=s,{currentFilters:a,setCurrentFilters:p}=w.useFilters(),i=o.useMemo(()=>a[t]?.value??r[0],[a]),d=o.useCallback(c=>{p({type:w.FiltersActions.update,toUpdate:{[t]:{value:c.target.value}}})},[]);return e.jsx($.SelectInput,{value:i,label:n,options:r,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:d,placeholder:l})}const ve=s=>{const{propertyName:t,label:r,placeholder:n}=s,{currentFilters:l,setCurrentFilters:a}=w.useFilters(),p=o.useMemo(()=>l[t]?.value??"",[l]),i=o.useCallback(d=>{a({type:w.FiltersActions.update,toUpdate:{[t]:{value:d.target.value}}})},[]);return e.jsx($.TextInput,{value:p??"",label:r,onChange:i,containerClassName:"input-widget-container",helperTextClassName:"",placeholder:n})},X=s=>{const{propertyName:t,label:r,inputType:n}=s,{t:l}=A.useTranslation(),{currentFilters:a,setCurrentFilters:p}=w.useFilters(),i=o.useRef(null),d=o.useRef(null),c=o.useCallback(x=>{p({type:w.FiltersActions.update,toUpdate:{[t]:{value:{end:d?.current?.value??null,start:x.target.value}}}})},[]),h=o.useCallback(x=>{p({type:w.FiltersActions.update,toUpdate:{[t]:{value:{start:i?.current?.value??null,end:x.target.value}}}})},[]);return e.jsxs("div",{className:"range-widget-container",children:[e.jsx("p",{className:"text-input-label input-widget-label input-label-normal",children:r}),e.jsxs("div",{className:"range-widget-row",children:[e.jsx($.TextInput,{value:a[t]?.value?.start??"",placeholder:l("_accessibility:components.table.filters.range.start"),type:n,ref:i,onChange:c,containerClassName:"input-widget-container",helperTextClassName:""}),e.jsx($.TextInput,{value:a[t]?.value?.end??"",placeholder:l("_accessibility:components.table.filters.range.end"),type:n,ref:d,onChange:h,containerClassName:"input-widget-container",helperTextClassName:""})]})]})},le=s=>{switch(s.type){case z.FilterTypes.text:return e.jsx(ve,{...s});case z.FilterTypes.number:return e.jsx(X,{...s,inputType:"number"});case z.FilterTypes.date:return e.jsx(X,{...s,inputType:"date"});case z.FilterTypes.select:return e.jsx(Te,{...s});case z.FilterTypes.autocomplete:return e.jsx(Ce,{...s});case z.FilterTypes.check:return e.jsx(Ne,{...s})}return e.jsx(e.Fragment,{})},ae=s=>{const{filters:t=[],show:r,handleShow:n}=s,{onFilterApply:l}=_.useTableOptions(),{currentFilters:a,setCurrentFilters:p}=w.useFilters(),{t:i}=A.useTranslation(),d=o.useRef(null);return o.useEffect(()=>{const c=({target:x})=>{d.current&&(x?.closest(".filter-dropdown-trigger")||!r||d.current.contains(x)||n(!1))},h=({code:x})=>{!r||x!=="Escape"||n(!1)};return document.addEventListener("click",c),document.addEventListener("keydown",h),()=>{document.removeEventListener("click",c),document.removeEventListener("keydown",h)}},[n,r]),e.jsx("div",{className:`filter-dropdown-backdrop ${r?"opened":"closed"}`,children:e.jsxs("div",{className:"filter-popup",ref:d,children:[e.jsx("div",{className:"filter-title",children:i("_accessibility:buttons.filters")}),e.jsx("ul",{className:"filter-container",children:t.map(c=>e.jsx("li",{className:"filter-container-item",children:le(c)},c.propertyName))}),e.jsx("div",{className:"filter-footer",children:e.jsxs("ul",{className:"filter-buttons-row",children:[e.jsx("li",{children:e.jsx("button",{onClick:()=>p({type:w.FiltersActions.reset,filters:t}),className:"filter-dropdown-button small filter-dropdown-cancel",children:i("_accessibility:buttons.clear")})}),e.jsx("li",{children:e.jsx("button",{className:"filter-dropdown-button small filter-dropdown-submit",onClick:()=>{n(!1),l(a)},children:i("_accessibility:buttons.applyFilters")})})]})})]})})},re=()=>{const{t:s}=A.useTranslation(),{total:t,pageSize:r,pageSizes:n,currentPage:l}=_.useTableOptions(),a=(l+1)*r>t?t:(l+1)*r;return e.jsxs("div",{className:"table-navigation-sizes",children:[n[0]<t&&e.jsx(e.Fragment,{children:e.jsxs("p",{children:[l*r+1," - ",a," ",s("_accessibility:components.table.of")]})}),e.jsx("p",{children:t})]})};function we(){const{t:s}=A.useTranslation(),{total:t,pageSize:r,currentPage:n,setCurrentPage:l}=_.useTableOptions(),a=o.useMemo(()=>{const p=Math.ceil(t/r);return Array.from({length:p},(i,d)=>({id:d,value:d+1}))},[t,r]);return e.jsxs("div",{className:"jump-to-page",children:[e.jsx("p",{children:s("_accessibility:components.table.jumpToPage")}),e.jsx($.SelectInput,{value:n,options:a,inputClassName:"jump-to-page-input",containerClassName:"jump-to-page-input-container",helperTextClassName:"hidden",onChange:p=>l(Number(p.target.value))})]})}const ie=()=>{const{t:s}=A.useTranslation(),{total:t,pageSize:r,currentPage:n,setCurrentPage:l}=_.useTableOptions();return e.jsxs("div",{className:"table-navigation-pages",children:[e.jsx(L.IconButton,{icon:e.jsx(B.ChevronLeft,{className:"table-navigation-icon"}),className:"table-navigation-buttons",disabled:n===0,"aria-label":s("_accessibility:buttons.previous"),name:s("_accessibility:buttons.previous"),onClick:()=>l(n-1)}),e.jsx(L.IconButton,{icon:e.jsx(B.ChevronRight,{className:"table-navigation-icon"}),disabled:Math.floor(t/((n+1)*r))===0,className:"table-navigation-buttons",name:s("_accessibility:buttons.next"),"aria-label":s("_accessibility:buttons.next"),onClick:()=>l(n+1)})]})};function oe(){const{t:s}=A.useTranslation(),{pageSizes:t,pageSize:r,setPageSize:n}=_.useTableOptions(),l=o.useMemo(()=>t?.map(a=>({id:a,value:a})),[t]);return e.jsxs("div",{className:"page-size",children:[e.jsx("p",{children:s("_accessibility:components.table.pageSizes")}),e.jsx($.SelectInput,{value:r,options:l,inputClassName:"page-size-input",containerClassName:"page-size-input-container",helperTextClassName:"hidden",onChange:a=>n(Number(a.target.value))})]})}function ce(){return e.jsxs("div",{className:"table-footer",children:[e.jsx(we,{}),e.jsx(oe,{}),e.jsx(re,{}),e.jsx(ie,{})]})}const ye=s=>s,ue=s=>{const{t}=A.useTranslation(),{columns:r,softDeleteProperty:n="deletedAt",data:l,actions:a,selectedRows:p,expandedRows:i=[],onRowSelectionChange:d,onRowExpand:c}=s,h=o.useMemo(()=>Z(r),[r]),x=o.useMemo(()=>new Map(i.map(b=>[b.rowId,b])),[i]);return l?.map(b=>{const u=p.has(b.id),T=x.get(b.id),S=!!T,P=h.length+1+(a?1:0);return e.jsxs(o.Fragment,{children:[e.jsxs("tr",{className:`table-row ${c?"expandable":""} ${b[n]?"deleted-class":""} ${u?"selected":""} ${S?"expanded":""}`,onClick:()=>c?.(b),children:[e.jsx("td",{className:"table-row-cell table-row-checkbox",children:e.jsx("input",{type:"checkbox",checked:u,onClick:C=>C.stopPropagation(),onChange:()=>d(b),"aria-label":t("_accessibility:components.table.selectRow")})}),a?e.jsx("td",{className:"w-px",children:e.jsx("div",{className:"table-row-cell-action",children:(()=>{const C=a(b).filter(j=>!j.hidden),O=C.filter(j=>j.sticky),k=C.filter(j=>!j.sticky);return e.jsxs(e.Fragment,{children:[O.map(j=>e.jsx(G.Tooltip,{content:j.tooltip,children:e.jsx(L.IconButton,{icon:j.icon,className:"row-table-action",onClick:E=>{E.stopPropagation(),j.onClick(b)}})},j.id)),k.length>0&&e.jsx(Y,{actions:k})]})})()})}):null,h?.map((C,O)=>e.jsx("td",{className:`table-row-cell ${O===0?"basic":""} ${C.className??""}`,children:C.renderBody?C.renderBody(b[C.key],b):ye(b[C.key])},C.key))]}),S&&T?.content!==null&&typeof T?.content<"u"&&e.jsx("tr",{className:"table-row-expanded",children:e.jsx("td",{className:"table-row-expanded-cell",colSpan:P,children:e.jsx("div",{className:`table-row-expanded-content ${T.isVisible?"open":"closed"}`,children:e.jsx("div",{className:"table-row-expanded-inner",children:T.content})})})})]},b.id)})};function de(){const{t:s}=A.useTranslation();return e.jsx("div",{className:"table-empty",children:e.jsx("p",{children:s("_accessibility:components.table.empty")})})}const pe=s=>{const{columns:t,title:r,isLoading:n,toolbar:l,filterOptions:a}=s,{countOfFilters:p}=_.useTableOptions(),{t:i}=A.useTranslation(),d=o.useMemo(()=>t?t.sort((u,T)=>(T.pos??0)-(u.pos??0)).filter(u=>!!u.filterOptions).map(u=>({...u.filterOptions,label:u.filterOptions?.label??u.label,propertyName:u.key})):[],[t]),[c,h]=o.useState(!1),x=o.useCallback(u=>{a?.dropdown?.setOpened?a.dropdown.setOpened(u??!1):h(u??!1)},[a]),b=o.useMemo(()=>a?.dropdown?.opened??c,[a,c]);return e.jsxs("div",{className:`table-header ${b?"showing-filters":""}`,children:[e.jsxs("div",{children:[r&&e.jsx("h1",{className:"table-header-title",children:r}),n?null:e.jsxs("div",{className:"table-header-content",children:[l,a?.button?.hide!==!0&&e.jsxs(L.IconButton,{icon:a?.button?.icon??e.jsx(B.Filters,{className:"filter-dropdown-trigger-icon"}),className:"filter-dropdown-button normal filter-dropdown-trigger","aria-haspopup":"true",onClick:()=>x(!b),"aria-expanded":b,children:[e.jsx(xe.Badge,{count:p,className:`${p>0?"show":"hide"} `}),e.jsx("span",{className:"table-header-sr",children:i("_accessibility:buttons.filters")}),e.jsx("wbr",{})]})]})]}),!!d&&!!d.length&&e.jsx(ae,{filters:d,show:b,handleShow:x,options:a}),e.jsx(ne,{filtersDefinition:d})]})};function me({count:s,multiActions:t,onActionClick:r}){const{t:n}=A.useTranslation();return e.jsxs("div",{className:"table-selection-bar",children:[e.jsx("p",{className:"table-selection-bar-count",children:n("_accessibility:components.table.selectedCount",{count:s})}),t.length>0&&e.jsx("div",{className:"table-selection-bar-actions",children:t.map(l=>e.jsx(G.Tooltip,{content:l.tooltip,children:e.jsx(L.IconButton,{icon:l.icon,className:"multi-table-action",onClick:()=>r(l),disabled:l.disabled})},l.id))})]})}const H=220;function Se({data:s,allowMultipleExpandedRows:t,controlledExpandedRowId:r,onExpandedRowChange:n,onRowExpand:l,findRowById:a}){const[p,i]=o.useState(null),[d,c]=o.useState(null),[h,x]=o.useState(null),[b,u]=o.useState(null),[T,S]=o.useState(!1),[P,C]=o.useState(new Set),[O,k]=o.useState([]),j=o.useRef(null),E=o.useRef(null),I=o.useRef(new Map),F=typeof r<"u",R=t&&!F,N=F?r??null:p,D=o.useCallback(()=>{E.current&&(clearTimeout(E.current),E.current=null)},[]),y=o.useCallback(m=>{if(typeof m<"u"){const f=I.current.get(m);if(!f)return;clearTimeout(f),I.current.delete(m);return}I.current.forEach(f=>clearTimeout(f)),I.current.clear()},[]),V=o.useCallback(m=>{y(m),k(f=>f.some(v=>v.rowId===m)?f.map(v=>v.rowId===m?{...v,isVisible:!1}:v):f),I.current.set(m,setTimeout(()=>{k(f=>f.filter(g=>g.rowId!==m)),I.current.delete(m)},H))},[y]),W=o.useCallback((m,f)=>{y(m),k(g=>g.some(M=>M.rowId===m)?g.map(M=>M.rowId===m?{...M,content:f,isVisible:!1}:M):[...g,{rowId:m,content:f,isVisible:!1}]),requestAnimationFrame(()=>{k(g=>g.map(v=>v.rowId===m?{...v,isVisible:!0}:v))})},[y]);o.useEffect(()=>{if(!R)return;const m=new Set(s.map(f=>f.id));C(f=>{const g=new Set;return f.forEach(v=>{if(m.has(v)){g.add(v);return}y(v)}),g}),k(f=>(f.forEach(g=>{m.has(g.rowId)||y(g.rowId)}),f.filter(g=>m.has(g.rowId))))},[s,R,y]),o.useEffect(()=>{if(R)return;if(N===null){c(null),F&&(j.current=null);return}a(N)||(F||i(null),c(null),F&&(j.current=null))},[s,N,a,F,R]),o.useEffect(()=>{if(!R){if(D(),N===null||d===null){if(h===null){S(!1),u(null);return}S(!1),E.current=setTimeout(()=>{x(null),u(null),E.current=null},H);return}if(h===null){x(N),u(d),requestAnimationFrame(()=>S(!0));return}if(h===N){u(d),requestAnimationFrame(()=>S(!0));return}S(!1),E.current=setTimeout(()=>{x(N),u(d),requestAnimationFrame(()=>S(!0)),E.current=null},H)}},[D,d,N,R,h]),o.useEffect(()=>()=>{D(),y()},[D,y]),o.useEffect(()=>{if(!F)return;if(N===null){c(null),j.current=null;return}const m=a(N);if(!m){c(null),j.current=null;return}const f=j.current;c(l?.(m,f)??null),j.current=m},[N,a,F,l]);const he=o.useCallback(m=>{if(R){if(P.has(m.id)){C(U=>{const q=new Set(U);return q.delete(m.id),q}),V(m.id),n?.(null,m);return}C(U=>{const q=new Set(U);return q.add(m.id),q});const M=l?.(m,null)??null;M!==null&&typeof M<"u"?W(m.id,M):(y(m.id),k(U=>U.filter(q=>q.rowId!==m.id))),n?.(m,null);return}const f=N===m.id,g=f?m:a(N);if(F){n?.(f?null:m,g);return}if(f){i(null),c(null),n?.(null,m);return}i(m.id),c(l?.(m,g)??null),n?.(m,g)},[N,V,y,W,a,P,F,R,n,l]);return{expandedRowsToRender:o.useMemo(()=>R?O:h===null||b===null||typeof b>"u"?[]:[{rowId:h,content:b,isVisible:T}],[T,R,b,h,O]),onRowExpandChange:he}}function Fe({actions:s,selectedRowsData:t}){const r=o.useMemo(()=>!s||!t.length?[]:t.reduce((l,a,p)=>{const i=s(a).filter(c=>c.multiple&&!c.hidden);if(p===0)return i;const d=new Map(l.map(c=>[c.id,c]));return i.reduce((c,h)=>{const x=d.get(h.id);return x&&c.push({...x,...h,disabled:h.disabled||x.disabled}),c},[])},[]),[s,t]),n=o.useCallback(l=>{if(t.length){if(l.onMultipleClick){l.onMultipleClick(t);return}t.forEach(a=>l.onClick(a))}},[t]);return{multiActions:r,handleMultipleActionClick:n}}function Re({data:s,onRowSelect:t,onSelectedRowsChange:r}){const[n,l]=o.useState(new Set),a=o.useMemo(()=>s?.filter(c=>n.has(c.id))??[],[s,n]);o.useEffect(()=>{if(!s?.length){l(new Set);return}l(c=>{const h=new Set,x=new Set(s.map(b=>b.id));return c.forEach(b=>{x.has(b)&&h.add(b)}),h})},[s]),o.useEffect(()=>{r&&r(a)},[a,r]);const p=o.useCallback(c=>{l(h=>{const x=new Set(h);return x.has(c.id)?(x.delete(c.id),t?.(c,!1)):(x.add(c.id),t?.(c,!0)),x})},[t]),i=o.useCallback(()=>{l(c=>{const h=new Set(c),x=s??[],b=x.every(u=>h.has(u.id));return x.forEach(u=>{const T=h.has(u.id);b?T&&(h.delete(u.id),t?.(u,!1)):T||(h.add(u.id),t?.(u,!0))}),h})},[s,t]),d=o.useMemo(()=>{if(!s?.length)return{allSelected:!1,hasSomeSelected:!1};const c=s.every(x=>n.has(x.id)),h=s.some(x=>n.has(x.id));return{allSelected:c,hasSomeSelected:h}},[s,n]);return{selectedRows:n,selectedRowsData:a,selectionState:d,onRowSelectionChange:p,onToggleAllRows:i}}function Ae(s){const{data:t,onSort:r,entity:n="",isLoading:l=!1,actions:a,columns:p=[],contentClassName:i="",className:d="",softDeleteProperty:c="deletedAt",onRowSelect:h,onSelectedRowsChange:x,allowMultipleExpandedRows:b=!1,expandedRowId:u,onExpandedRowChange:T,onRowExpand:S,...P}=s,C=o.useMemo(()=>!t?.length,[t]),O=o.useCallback(V=>V===null?null:t.find(W=>W.id===V)??null,[t]),{selectedRows:k,selectedRowsData:j,selectionState:E,onRowSelectionChange:I,onToggleAllRows:F}=Re({data:t,onRowSelect:h,onSelectedRowsChange:x}),{expandedRowsToRender:R,onRowExpandChange:N}=Se({data:t,allowMultipleExpandedRows:b,controlledExpandedRowId:u,onExpandedRowChange:T,onRowExpand:S,findRowById:O}),{multiActions:D,handleMultipleActionClick:y}=Fe({actions:a,selectedRowsData:j});return e.jsx(w.FiltersProvider,{children:e.jsxs("div",{className:`${d} table-main`,children:[e.jsx(pe,{columns:p,isLoading:l,...P}),l?e.jsx(ge.Loading,{className:"table-loading"}):e.jsx(e.Fragment,{children:C?e.jsx(de,{}):e.jsxs(e.Fragment,{children:[!!j.length&&e.jsx(me,{count:j.length,multiActions:D,onActionClick:y}),e.jsx("div",{className:`${i} table-body`,children:e.jsxs("table",{className:"table-content",children:[e.jsx(ee,{entity:n,columns:p,onSortCallback:r,hasAction:!!a,selectionState:E,onToggleAllRows:F}),e.jsx("tbody",{children:e.jsx(ue,{data:t,actions:a,columns:p,softDeleteProperty:c,selectedRows:k,expandedRows:R,onRowSelectionChange:I,onRowExpand:S?N:void 0})})]})}),e.jsx(ce,{})]})})]})})}exports.Action=K;exports.Actions=Q;exports.ActionsDropdown=Y;exports.ActiveFilters=ne;exports.ArrayChip=te;exports.Columns=ee;exports.CountOfTotal=re;exports.FilterDropdown=ae;exports.Footer=ce;exports.Navigation=ie;exports.PageSize=oe;exports.RangeChip=se;exports.Rows=ue;exports.Table=Ae;exports.TableEmpty=de;exports.TableHeader=pe;exports.TableSelectionBar=me;exports.renderFilterComponent=le;
|
package/dist/Table.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Table-DjIhOMXQ.cjs");exports.ActiveFilters=e.ActiveFilters;exports.ArrayChip=e.ArrayChip;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.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.actions-container{justify-content:flex-end;align-items:center;gap:calc(var(--spacing,.25rem) * 1);width:100%;display:flex}.actions-dropdown .action{width:100%;padding-inline:calc(var(--spacing,.25rem) * 2);justify-content:flex-start}.actions-dropdown .actions-container li{width:100%}.action{justify-content:center;align-items:center;gap:calc(var(--spacing,.25rem) * 2);background-color:var(--color-base,#f2f2f2);color:var(--color-text,#0d0d0d);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration,var(--default-transition-duration,.15s));display:flex}@media(hover:hover){.action:hover{background-color:var(--color-base-light,#fff)}}.icon-action{height:calc(var(--spacing,.25rem) * 9);width:calc(var(--spacing,.25rem) * 9);border-radius:3.40282e38px}.text-action{border-radius:var(--radius-4xl,2rem);padding-inline:calc(var(--spacing,.25rem) * 4);padding-block:calc(var(--spacing,.25rem) * 2)}.actions-dropdown-list{flex-direction:column}.action-dropdown-item{justify-content:flex-start;width:100%}.actions-dropdown-trigger svg{height:calc(var(--spacing,.25rem) * 5);width:calc(var(--spacing,.25rem) * 5)}.active-filters-main{justify-content:flex-start;align-items:center;gap:calc(var(--spacing,.25rem) * 2);flex-wrap:wrap;display:flex}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-border-style:solid}}}.filter-dropdown-button{font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)))}.filter-dropdown-button.normal{padding-inline:calc(var(--spacing,.25rem) * 3);padding-block:calc(var(--spacing,.25rem) * 2)}.filter-dropdown-button.small{padding-inline:calc(var(--spacing,.25rem) * 2);padding-block:calc(var(--spacing,.25rem) * .5)}.filter-dropdown-trigger-icon{height:calc(var(--spacing,.25rem) * 4);width:calc(var(--spacing,.25rem) * 4);fill:currentColor}.filter-dropdown-backdrop{width:100%;transition:grid-template-rows .5s;display:grid;overflow:hidden}.filter-dropdown-backdrop.opened{grid-template-rows:1fr}.filter-dropdown-backdrop.closed{grid-template-rows:0fr}.filter-popup{min-height:0;overflow:auto}.filter-title{margin-bottom:calc(var(--spacing,.25rem) * 3);padding-inline:calc(var(--spacing,.25rem) * 3);padding-top:calc(var(--spacing,.25rem) * 1.5);padding-bottom:calc(var(--spacing,.25rem) * 2);font-size:var(--text-xs,.75rem);line-height:var(--tw-leading,var(--text-xs--line-height,calc(1 / .75)));--tw-font-weight:var(--font-weight-semibold,600);font-weight:var(--font-weight-semibold,600);text-transform:uppercase}.filter-container{margin-bottom:calc(var(--spacing,.25rem) * 4);column-gap:calc(var(--spacing,.25rem) * 6);row-gap:calc(var(--spacing,.25rem) * 8);padding:calc(var(--spacing,.25rem) * 3);grid-template-columns:repeat(4,minmax(0,1fr));display:grid}.filter-container-item{align-items:center;display:flex}.filter-footer{border-top-style:var(--tw-border-style);padding-inline:calc(var(--spacing,.25rem) * 3);padding-block:calc(var(--spacing,.25rem) * 2);border-top-width:1px}.filter-buttons-row{justify-content:space-between;align-items:center;display:flex}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-duration:initial;--tw-border-style:solid}}}.table-main{height:100%;min-height:calc(var(--spacing,.25rem) * 0);flex-direction:column;width:100%;display:flex}.table-header{gap:calc(var(--spacing,.25rem) * 2);grid-template-columns:repeat(1,minmax(0,1fr));display:grid}.table-header.showing-filters{margin-bottom:calc(var(--spacing,.25rem) * 5)}.table-header-content{justify-content:flex-end;align-items:center;gap:calc(var(--spacing,.25rem) * 2);justify-self:flex-end;width:100%;display:flex}.table-header-title{font-size:var(--text-2xl,1.5rem);line-height:var(--tw-leading,var(--text-2xl--line-height,calc(2 / 1.5)));--tw-font-weight:var(--font-weight-bold,700);font-weight:var(--font-weight-bold,700)}@media(min-width:48rem){.table-header-title{font-size:var(--text-3xl,1.875rem);line-height:var(--tw-leading,var(--text-3xl--line-height, 1.2 ))}}.table-body{min-height:calc(var(--spacing,.25rem) * 0);flex:1;width:100%;overflow:auto}.table-content{border-collapse:separate;--tw-border-spacing-x:calc(var(--spacing,.25rem) * 0);--tw-border-spacing-y:calc(var(--spacing,.25rem) * 0);width:100%;height:100%;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);text-align:left;font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)))}.table-loading{top:calc(var(--spacing,.25rem) * 0);left:calc(var(--spacing,.25rem) * 0);width:100%;height:100%}.table-row-cell{padding-inline:calc(var(--spacing,.25rem) * 6);padding-block:calc(var(--spacing,.25rem) * 4);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500)}.table-row-cell.basic{white-space:nowrap}.table-row-cell-action{justify-content:center;align-items:center;gap:calc(var(--spacing,.25rem) * 3);display:flex}.table-row{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration,var(--default-transition-duration,.15s));--tw-duration:.15s;transition-duration:.15s}.table-row.expandable{cursor:pointer}@media(hover:hover){.table-row.expandable:hover{background-color:var(--color-base,#f2f2f2)}}.table-row.selected,.table-row.expanded{background-color:var(--color-base,#f2f2f2)}.table-row-checkbox{width:calc(var(--spacing,.25rem) * 12);padding-inline:calc(var(--spacing,.25rem) * 3);text-align:center}.table-row-checkbox input{cursor:pointer}.table-row-expanded-cell{border-style:var(--tw-border-style);padding:calc(var(--spacing,.25rem) * 0);background-color:#0000;border-width:0}.table-row-expanded-content{opacity:0;grid-template-rows:0fr;transition:grid-template-rows .22s,opacity .22s;display:grid}.table-row-expanded-content.open{opacity:1;grid-template-rows:1fr}.table-row-expanded-content.closed{opacity:0;grid-template-rows:0fr}.table-row-expanded-inner{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-border,#ccc);background-color:var(--color-base,#f2f2f2);padding-inline:calc(var(--spacing,.25rem) * 6);padding-block:calc(var(--spacing,.25rem) * 4);overflow:hidden}.table-selection-bar{margin-bottom:calc(var(--spacing,.25rem) * 3);justify-content:space-between;align-items:center;gap:calc(var(--spacing,.25rem) * 4);background-color:var(--color-base,#f2f2f2);padding-inline:calc(var(--spacing,.25rem) * 4);padding-block:calc(var(--spacing,.25rem) * 2);color:var(--color-text,#0d0d0d);border-radius:.25rem;display:flex}.table-selection-bar-count{font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));--tw-font-weight:var(--font-weight-semibold,600);font-weight:var(--font-weight-semibold,600)}.table-selection-bar-actions{align-items:center;gap:calc(var(--spacing,.25rem) * 2);display:flex}.multi-table-action{height:calc(var(--spacing,.25rem) * 8);width:calc(var(--spacing,.25rem) * 8);justify-content:center;align-items:center;display:flex}.multi-table-action:disabled{cursor:not-allowed;opacity:.5}@property --tw-border-spacing-x{syntax:"<length>";inherits:false;initial-value:0}@property --tw-border-spacing-y{syntax:"<length>";inherits:false;initial-value:0}@property --tw-duration{syntax:"*";inherits:false}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-border-style:solid}}}.jump-to-page,.page-size{justify-content:flex-start;align-items:center;gap:calc(var(--spacing,.25rem) * 2);display:flex}.jump-to-page-input,.page-size-input{--tw-font-weight:var(--font-weight-bold,700);font-weight:var(--font-weight-bold,700);--tw-border-style:none!important;padding-block:calc(var(--spacing,.25rem) * 0)!important;padding-right:calc(var(--spacing,.25rem) * 7)!important;padding-left:calc(var(--spacing,.25rem) * 2)!important;border-style:none!important}.jump-to-page-input-container,.page-size-input-container{margin-bottom:calc(var(--spacing,.25rem) * 0)!important;--tw-border-style:none!important;border-style:none!important;width:auto!important}.table-headers-column{top:calc(var(--spacing,.25rem) * 0);z-index:20;background-color:var(--color-base,#f2f2f2);padding-inline:calc(var(--spacing,.25rem) * 3);padding-block:calc(var(--spacing,.25rem) * 2);position:sticky}.table-headers-checkbox{width:calc(var(--spacing,.25rem) * 12);text-align:center}.table-headers-checkbox input{cursor:pointer}.table-headers-label{white-space:nowrap}.table-headers-sort-indicator{width:calc(var(--spacing,.25rem) * 3)}.table-headers-action{top:calc(var(--spacing,.25rem) * 0);z-index:20;background-color:var(--color-base,#f2f2f2);width:1px;padding-inline:calc(var(--spacing,.25rem) * 6);padding-block:calc(var(--spacing,.25rem) * 3);text-align:center;--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);color:var(--color-text,#0d0d0d);white-space:nowrap;position:sticky}.table-empty{border-top-style:var(--tw-border-style);width:100%;padding-block:calc(var(--spacing,.25rem) * 2);border-top-width:1px;justify-content:center;align-items:center;display:flex}.table-footer{margin-top:calc(var(--spacing,.25rem) * 5);justify-content:flex-end;align-items:center;gap:calc(var(--spacing,.25rem) * 5);width:100%;padding-inline:calc(var(--spacing,.25rem) * 5);display:flex}.table-navigation-sizes{justify-content:flex-start;align-items:center;gap:calc(var(--spacing,.25rem) * 1);display:flex}.table-navigation-pages{justify-content:flex-end;align-items:center;gap:calc(var(--spacing,.25rem) * 5);display:flex}.table-navigation-icon{width:calc(var(--spacing,.25rem) * 2.5)}.table-header-sr{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}.options-widget-container{margin-bottom:calc(var(--spacing,.25rem) * 0);padding-bottom:calc(var(--spacing,.25rem) * 2)}.input-widget-container{margin-bottom:calc(var(--spacing,.25rem) * 0);width:100%}.input-widget-label{top:calc(var(--spacing,.25rem) * 0);--tw-translate-y:calc(var(--spacing,.25rem) * -4);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y)}.range-widget-row{align-items:center;gap:calc(var(--spacing,.25rem) * 6);display:flex}.range-widget-container{width:100%;position:relative}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}
|
package/dist/Table.d.ts
ADDED
package/dist/Table.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { A as s, a as o, C as r, b as t, F as i, c as l, N as n, P as p, R as C, d as T, g as b, T as F, e as d, f as g, r as m } from "./Table-BtZGG0d7.js";
|
|
2
|
+
export {
|
|
3
|
+
s as ActiveFilters,
|
|
4
|
+
o as ArrayChip,
|
|
5
|
+
r as Columns,
|
|
6
|
+
t as CountOfTotal,
|
|
7
|
+
i as FilterDropdown,
|
|
8
|
+
l as Footer,
|
|
9
|
+
n as Navigation,
|
|
10
|
+
p as PageSize,
|
|
11
|
+
C as RangeChip,
|
|
12
|
+
T as Rows,
|
|
13
|
+
b as Table,
|
|
14
|
+
F as TableEmpty,
|
|
15
|
+
d as TableHeader,
|
|
16
|
+
g as TableSelectionBar,
|
|
17
|
+
m as renderFilterComponent
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./TableOptionsProvider-BchUDA3B.cjs");exports.TableOptionsProvider=e.TableOptionsProvider;exports.useTableOptions=e.useTableOptions;
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import "./TextInput.css";
|
|
2
|
+
import { jsxs as g, jsx as n, Fragment as z } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as S, useState as w, useEffect as R, useMemo as G, useRef as I, useCallback as k, useLayoutEffect as J } from "react";
|
|
4
|
+
import { C as E } from "./Chip-C5ogKbFn.js";
|
|
5
|
+
import { I as K } from "./IconButton-BpsTEj0z.js";
|
|
6
|
+
import { C as Q } from "./Close-rKC9AcNX.js";
|
|
7
|
+
const le = S(function(a, m) {
|
|
8
|
+
const {
|
|
9
|
+
state: h,
|
|
10
|
+
value: e,
|
|
11
|
+
onChange: l,
|
|
12
|
+
options: u = [],
|
|
13
|
+
name: p = "",
|
|
14
|
+
id: f = "",
|
|
15
|
+
label: i = "",
|
|
16
|
+
containerClassName: C = "",
|
|
17
|
+
inputContainerClassName: c = "",
|
|
18
|
+
helperText: x = "",
|
|
19
|
+
placeholder: y = "",
|
|
20
|
+
multiple: r = !1,
|
|
21
|
+
...N
|
|
22
|
+
} = a, [v, o] = w("");
|
|
23
|
+
R(() => {
|
|
24
|
+
if (!r && e && !Array.isArray(e)) {
|
|
25
|
+
o(String(e.value ?? e.name ?? ""));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
o("");
|
|
29
|
+
}, [r, e]);
|
|
30
|
+
const [T, $] = w(!1), A = G(
|
|
31
|
+
() => u.filter((t) => {
|
|
32
|
+
const s = String(t.value ?? t.name).toLowerCase().includes(v?.toLowerCase());
|
|
33
|
+
return Array.isArray(e) && e.length ? s && !e.some((d) => d.id === t.id) : e && !Array.isArray(e) ? s && e.id !== t.id : s;
|
|
34
|
+
}),
|
|
35
|
+
[u, e, v]
|
|
36
|
+
), b = I(null), q = I(null), [B, M] = w(!1), D = I(null);
|
|
37
|
+
R(() => {
|
|
38
|
+
const t = (d) => {
|
|
39
|
+
b.current && !b.current.contains(d.target) && $(!1);
|
|
40
|
+
}, s = (d) => {
|
|
41
|
+
d.key === "Escape" && $(!1);
|
|
42
|
+
};
|
|
43
|
+
return document.addEventListener("mousedown", t), document.addEventListener("keydown", s), () => {
|
|
44
|
+
document.removeEventListener("mousedown", t), document.removeEventListener("keydown", s);
|
|
45
|
+
};
|
|
46
|
+
}, []);
|
|
47
|
+
const O = k((t) => {
|
|
48
|
+
o(t.target.value);
|
|
49
|
+
}, []), F = k(
|
|
50
|
+
(t) => {
|
|
51
|
+
t ? r ? (o(""), Array.isArray(e) && e.length ? l([...e, t]) : l([t])) : (o(String(t.name ?? t.value ?? "")), l(t)) : l(null), $(!1);
|
|
52
|
+
},
|
|
53
|
+
[r, l, e]
|
|
54
|
+
), P = k(
|
|
55
|
+
(t) => {
|
|
56
|
+
if (!Array.isArray(e)) {
|
|
57
|
+
l(null);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const s = e.filter((d, _) => _ !== t);
|
|
61
|
+
s.length ? l(s) : l(null);
|
|
62
|
+
},
|
|
63
|
+
[l, e]
|
|
64
|
+
), U = k(() => {
|
|
65
|
+
Array.isArray(e) && l([e[0]]);
|
|
66
|
+
}, [l, e]);
|
|
67
|
+
return J(() => {
|
|
68
|
+
const t = D.current?.offsetWidth ?? 0, s = b.current?.offsetWidth ?? 0;
|
|
69
|
+
M(t > s * 0.4);
|
|
70
|
+
}, [e]), /* @__PURE__ */ g(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
className: `autocomplete-input-container ${C}`,
|
|
74
|
+
ref: b,
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ g("div", { className: "autocomplete-value-input-container", children: [
|
|
77
|
+
/* @__PURE__ */ n(
|
|
78
|
+
X,
|
|
79
|
+
{
|
|
80
|
+
state: h,
|
|
81
|
+
name: p,
|
|
82
|
+
id: f,
|
|
83
|
+
value: v,
|
|
84
|
+
onChange: O,
|
|
85
|
+
placeholder: y,
|
|
86
|
+
helperText: x,
|
|
87
|
+
onFocus: () => $(!0),
|
|
88
|
+
label: i,
|
|
89
|
+
containerClassName: `autocomplete-text-input ${c}`,
|
|
90
|
+
ref: m ?? q,
|
|
91
|
+
...N,
|
|
92
|
+
children: !r && e && !Array.isArray(e) && (e.value || e.name) && /* @__PURE__ */ n(
|
|
93
|
+
K,
|
|
94
|
+
{
|
|
95
|
+
icon: /* @__PURE__ */ n(Q, {}),
|
|
96
|
+
className: "autocomplete-delete-button",
|
|
97
|
+
onClick: (t) => {
|
|
98
|
+
F(), t.stopPropagation();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
r && Array.isArray(e) && e.length ? /* @__PURE__ */ n("ul", { ref: D, className: "autocomplete-value-container", children: B ? /* @__PURE__ */ g(z, { children: [
|
|
105
|
+
/* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
106
|
+
E,
|
|
107
|
+
{
|
|
108
|
+
text: e[0]?.value ?? e[0]?.name,
|
|
109
|
+
onDelete: (t) => {
|
|
110
|
+
P(0), t.stopPropagation();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
) }),
|
|
114
|
+
e.length > 1 && /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
115
|
+
E,
|
|
116
|
+
{
|
|
117
|
+
text: `+${e.length - 1}`,
|
|
118
|
+
onDelete: (t) => {
|
|
119
|
+
U(), t.stopPropagation();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
) })
|
|
123
|
+
] }) : e.map((t, s) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
124
|
+
E,
|
|
125
|
+
{
|
|
126
|
+
text: String(t.value ?? t.name),
|
|
127
|
+
onDelete: (d) => {
|
|
128
|
+
P(s), d.stopPropagation();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
) }, t.id ?? t.value ?? t.name)) }) : null
|
|
132
|
+
] }),
|
|
133
|
+
T && /* @__PURE__ */ n(
|
|
134
|
+
"ul",
|
|
135
|
+
{
|
|
136
|
+
className: "autocomplete-suggestions-container",
|
|
137
|
+
style: { width: b.current?.offsetWidth },
|
|
138
|
+
children: A.map((t) => /* @__PURE__ */ n(
|
|
139
|
+
"li",
|
|
140
|
+
{
|
|
141
|
+
className: "autocomplete-suggestion-item",
|
|
142
|
+
onClick: (s) => {
|
|
143
|
+
F(t), s.stopPropagation();
|
|
144
|
+
},
|
|
145
|
+
children: t.value ?? t.name
|
|
146
|
+
},
|
|
147
|
+
t.id ?? t.value ?? t.name
|
|
148
|
+
))
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}), re = S(function(a, m) {
|
|
155
|
+
const {
|
|
156
|
+
checked: h,
|
|
157
|
+
onChange: e,
|
|
158
|
+
name: l = "",
|
|
159
|
+
id: u = "",
|
|
160
|
+
label: p = "",
|
|
161
|
+
containerClassName: f = "",
|
|
162
|
+
inputClassName: i = "",
|
|
163
|
+
labelClassName: C = "",
|
|
164
|
+
...c
|
|
165
|
+
} = a;
|
|
166
|
+
return /* @__PURE__ */ g("label", { className: `input-check-container ${f}`, children: [
|
|
167
|
+
/* @__PURE__ */ n(
|
|
168
|
+
"input",
|
|
169
|
+
{
|
|
170
|
+
id: u,
|
|
171
|
+
ref: m,
|
|
172
|
+
name: l,
|
|
173
|
+
type: "checkbox",
|
|
174
|
+
checked: h,
|
|
175
|
+
onChange: e,
|
|
176
|
+
className: `input-check ${i}`,
|
|
177
|
+
...c
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
/* @__PURE__ */ n("span", { className: `input-check-label ${C}`, children: p })
|
|
181
|
+
] });
|
|
182
|
+
});
|
|
183
|
+
var L = /* @__PURE__ */ ((a) => (a.error = "error", a.good = "good", a.default = "default", a))(L || {});
|
|
184
|
+
const W = (a) => {
|
|
185
|
+
switch (a) {
|
|
186
|
+
case "error":
|
|
187
|
+
return "input-error";
|
|
188
|
+
case "good":
|
|
189
|
+
return "input-good";
|
|
190
|
+
default:
|
|
191
|
+
return "input-normal";
|
|
192
|
+
}
|
|
193
|
+
}, j = (a) => {
|
|
194
|
+
switch (a) {
|
|
195
|
+
case "error":
|
|
196
|
+
return "input-label-error";
|
|
197
|
+
case "good":
|
|
198
|
+
return "input-label-good";
|
|
199
|
+
default:
|
|
200
|
+
return "input-label-normal";
|
|
201
|
+
}
|
|
202
|
+
}, H = (a) => {
|
|
203
|
+
switch (a) {
|
|
204
|
+
case "error":
|
|
205
|
+
return "input-helper-text-error";
|
|
206
|
+
case "good":
|
|
207
|
+
return "input-helper-text-good";
|
|
208
|
+
default:
|
|
209
|
+
return "input-helper-text-normal";
|
|
210
|
+
}
|
|
211
|
+
}, se = S(function(a, m) {
|
|
212
|
+
const {
|
|
213
|
+
value: h,
|
|
214
|
+
onChange: e,
|
|
215
|
+
options: l,
|
|
216
|
+
containerClassName: u = "",
|
|
217
|
+
inputClassName: p = "",
|
|
218
|
+
labelClassName: f = "",
|
|
219
|
+
helperText: i = "",
|
|
220
|
+
helperTextClassName: C = "",
|
|
221
|
+
label: c = "",
|
|
222
|
+
name: x = "",
|
|
223
|
+
id: y = "",
|
|
224
|
+
state: r = L.default,
|
|
225
|
+
children: N,
|
|
226
|
+
...v
|
|
227
|
+
} = a;
|
|
228
|
+
return /* @__PURE__ */ g("div", { className: `select-input-container ${u}`, children: [
|
|
229
|
+
/* @__PURE__ */ n(
|
|
230
|
+
"select",
|
|
231
|
+
{
|
|
232
|
+
...v,
|
|
233
|
+
id: y,
|
|
234
|
+
ref: m,
|
|
235
|
+
name: x,
|
|
236
|
+
value: h,
|
|
237
|
+
onChange: e,
|
|
238
|
+
className: `select-input ${W(r)} peer ${p}`,
|
|
239
|
+
children: l?.map((o) => /* @__PURE__ */ n("option", { value: o.id, children: o.value ?? o.name ?? o.id }, o.id))
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
/* @__PURE__ */ n(
|
|
243
|
+
"label",
|
|
244
|
+
{
|
|
245
|
+
htmlFor: y,
|
|
246
|
+
className: `select-input-label ${j(r)} ${f}`,
|
|
247
|
+
children: c
|
|
248
|
+
}
|
|
249
|
+
),
|
|
250
|
+
N,
|
|
251
|
+
i && /* @__PURE__ */ n(
|
|
252
|
+
"p",
|
|
253
|
+
{
|
|
254
|
+
className: `select-input-helper-text ${H(r)} ${C}`,
|
|
255
|
+
children: i
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
] });
|
|
259
|
+
}), V = (a) => a == null ? !1 : Array.isArray(a) ? a.length > 0 : `${a}`.length > 0, X = S(function(a, m) {
|
|
260
|
+
const {
|
|
261
|
+
children: h,
|
|
262
|
+
state: e = L.default,
|
|
263
|
+
label: l = "",
|
|
264
|
+
containerClassName: u = "",
|
|
265
|
+
inputClassName: p = "",
|
|
266
|
+
labelClassName: f = "",
|
|
267
|
+
helperText: i = "",
|
|
268
|
+
helperTextClassName: C = "",
|
|
269
|
+
value: c,
|
|
270
|
+
defaultValue: x,
|
|
271
|
+
onChange: y,
|
|
272
|
+
...r
|
|
273
|
+
} = a, N = c !== void 0, [v, o] = w(
|
|
274
|
+
() => V(x)
|
|
275
|
+
), T = N ? V(c) : v, $ = (A) => {
|
|
276
|
+
N || o(A.currentTarget.value.length > 0), y?.(A);
|
|
277
|
+
};
|
|
278
|
+
return /* @__PURE__ */ g("div", { className: `text-input-container ${u}`, children: [
|
|
279
|
+
/* @__PURE__ */ n(
|
|
280
|
+
"input",
|
|
281
|
+
{
|
|
282
|
+
ref: m,
|
|
283
|
+
defaultValue: x,
|
|
284
|
+
onChange: $,
|
|
285
|
+
...N ? { value: c } : {},
|
|
286
|
+
className: `text-input ${W(e)} ${p} ${T ? "has-value" : ""} ${r.placeholder ? "has-placeholder" : ""}`,
|
|
287
|
+
...r
|
|
288
|
+
}
|
|
289
|
+
),
|
|
290
|
+
!!l && /* @__PURE__ */ g(
|
|
291
|
+
"label",
|
|
292
|
+
{
|
|
293
|
+
htmlFor: r.id,
|
|
294
|
+
className: `text-input-label ${j(e)} ${f}`,
|
|
295
|
+
children: [
|
|
296
|
+
l,
|
|
297
|
+
r.required ? " *" : ""
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
),
|
|
301
|
+
h,
|
|
302
|
+
!!i && /* @__PURE__ */ n(
|
|
303
|
+
"p",
|
|
304
|
+
{
|
|
305
|
+
className: `text-input-helper-text ${H(e)} ${C}`,
|
|
306
|
+
children: i
|
|
307
|
+
}
|
|
308
|
+
)
|
|
309
|
+
] });
|
|
310
|
+
});
|
|
311
|
+
export {
|
|
312
|
+
le as A,
|
|
313
|
+
re as C,
|
|
314
|
+
se as S,
|
|
315
|
+
X as T,
|
|
316
|
+
L as a,
|
|
317
|
+
H as h,
|
|
318
|
+
W as i,
|
|
319
|
+
j as l
|
|
320
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var G=require("./TextInput.css");const a=require("react/jsx-runtime"),l=require("react"),k=require("./Chip-D17UJHW6.cjs"),M=require("./IconButton-CVnmT2E9.cjs"),O=require("./Close-O9P7wJGf.cjs"),U=l.forwardRef(function(n,p){const{state:m,value:e,onChange:r,options:d=[],name:f="",id:x="",label:u="",containerClassName:C="",inputContainerClassName:i="",helperText:g="",placeholder:j="",multiple:s=!1,...N}=n,[v,c]=l.useState("");l.useEffect(()=>{if(!s&&e&&!Array.isArray(e)){c(String(e.value??e.name??""));return}c("")},[s,e]);const[S,b]=l.useState(!1),$=l.useMemo(()=>d.filter(t=>{const o=String(t.value??t.name).toLowerCase().includes(v?.toLowerCase());return Array.isArray(e)&&e.length?o&&!e.some(h=>h.id===t.id):e&&!Array.isArray(e)?o&&e.id!==t.id:o}),[d,e,v]),y=l.useRef(null),F=l.useRef(null),[P,V]=l.useState(!1),R=l.useRef(null);l.useEffect(()=>{const t=h=>{y.current&&!y.current.contains(h.target)&&b(!1)},o=h=>{h.key==="Escape"&&b(!1)};return document.addEventListener("mousedown",t),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("keydown",o)}},[]);const W=l.useCallback(t=>{c(t.target.value)},[]),E=l.useCallback(t=>{t?s?(c(""),Array.isArray(e)&&e.length?r([...e,t]):r([t])):(c(String(t.name??t.value??"")),r(t)):r(null),b(!1)},[s,r,e]),L=l.useCallback(t=>{if(!Array.isArray(e)){r(null);return}const o=e.filter((h,H)=>H!==t);o.length?r(o):r(null)},[r,e]),B=l.useCallback(()=>{Array.isArray(e)&&r([e[0]])},[r,e]);return l.useLayoutEffect(()=>{const t=R.current?.offsetWidth??0,o=y.current?.offsetWidth??0;V(t>o*.4)},[e]),a.jsxs("div",{className:`autocomplete-input-container ${C}`,ref:y,children:[a.jsxs("div",{className:"autocomplete-value-input-container",children:[a.jsx(D,{state:m,name:f,id:x,value:v,onChange:W,placeholder:j,helperText:g,onFocus:()=>b(!0),label:u,containerClassName:`autocomplete-text-input ${i}`,ref:p??F,...N,children:!s&&e&&!Array.isArray(e)&&(e.value||e.name)&&a.jsx(M.IconButton,{icon:a.jsx(O.Close,{}),className:"autocomplete-delete-button",onClick:t=>{E(),t.stopPropagation()}})}),s&&Array.isArray(e)&&e.length?a.jsx("ul",{ref:R,className:"autocomplete-value-container",children:P?a.jsxs(a.Fragment,{children:[a.jsx("li",{children:a.jsx(k.Chip,{text:e[0]?.value??e[0]?.name,onDelete:t=>{L(0),t.stopPropagation()}})}),e.length>1&&a.jsx("li",{children:a.jsx(k.Chip,{text:`+${e.length-1}`,onDelete:t=>{B(),t.stopPropagation()}})})]}):e.map((t,o)=>a.jsx("li",{children:a.jsx(k.Chip,{text:String(t.value??t.name),onDelete:h=>{L(o),h.stopPropagation()}})},t.id??t.value??t.name))}):null]}),S&&a.jsx("ul",{className:"autocomplete-suggestions-container",style:{width:y.current?.offsetWidth},children:$.map(t=>a.jsx("li",{className:"autocomplete-suggestion-item",onClick:o=>{E(t),o.stopPropagation()},children:t.value??t.name},t.id??t.value??t.name))})]})}),_=l.forwardRef(function(n,p){const{checked:m,onChange:e,name:r="",id:d="",label:f="",containerClassName:x="",inputClassName:u="",labelClassName:C="",...i}=n;return a.jsxs("label",{className:`input-check-container ${x}`,children:[a.jsx("input",{id:d,ref:p,name:r,type:"checkbox",checked:m,onChange:e,className:`input-check ${u}`,...i}),a.jsx("span",{className:`input-check-label ${C}`,children:f})]})});var A=(n=>(n.error="error",n.good="good",n.default="default",n))(A||{});const w=n=>{switch(n){case"error":return"input-error";case"good":return"input-good";default:return"input-normal"}},I=n=>{switch(n){case"error":return"input-label-error";case"good":return"input-label-good";default:return"input-label-normal"}},T=n=>{switch(n){case"error":return"input-helper-text-error";case"good":return"input-helper-text-good";default:return"input-helper-text-normal"}},z=l.forwardRef(function(n,p){const{value:m,onChange:e,options:r,containerClassName:d="",inputClassName:f="",labelClassName:x="",helperText:u="",helperTextClassName:C="",label:i="",name:g="",id:j="",state:s=A.default,children:N,...v}=n;return a.jsxs("div",{className:`select-input-container ${d}`,children:[a.jsx("select",{...v,id:j,ref:p,name:g,value:m,onChange:e,className:`select-input ${w(s)} peer ${f}`,children:r?.map(c=>a.jsx("option",{value:c.id,children:c.value??c.name??c.id},c.id))}),a.jsx("label",{htmlFor:j,className:`select-input-label ${I(s)} ${x}`,children:i}),N,u&&a.jsx("p",{className:`select-input-helper-text ${T(s)} ${C}`,children:u})]})}),q=n=>n==null?!1:Array.isArray(n)?n.length>0:`${n}`.length>0,D=l.forwardRef(function(n,p){const{children:m,state:e=A.default,label:r="",containerClassName:d="",inputClassName:f="",labelClassName:x="",helperText:u="",helperTextClassName:C="",value:i,defaultValue:g,onChange:j,...s}=n,N=i!==void 0,[v,c]=l.useState(()=>q(g)),S=N?q(i):v,b=$=>{N||c($.currentTarget.value.length>0),j?.($)};return a.jsxs("div",{className:`text-input-container ${d}`,children:[a.jsx("input",{ref:p,defaultValue:g,onChange:b,...N?{value:i}:{},className:`text-input ${w(e)} ${f} ${S?"has-value":""} ${s.placeholder?"has-placeholder":""}`,...s}),!!r&&a.jsxs("label",{htmlFor:s.id,className:`text-input-label ${I(e)} ${x}`,children:[r,s.required?" *":""]}),m,!!u&&a.jsx("p",{className:`text-input-helper-text ${T(e)} ${C}`,children:u})]})});exports.AutocompleteInput=U;exports.CheckInput=_;exports.SelectInput=z;exports.State=A;exports.TextInput=D;exports.helperTextStateClassName=T;exports.inputStateClassName=w;exports.labelStateClassName=I;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}.autocomplete-input-container{margin-bottom:calc(var(--spacing,.25rem) * 5);width:100%}.autocomplete-value-input-container{width:100%;position:relative}.autocomplete-text-input{margin-bottom:calc(var(--spacing,.25rem) * 0)!important}.autocomplete-delete-button{top:50%;right:calc(var(--spacing,.25rem) * 2);--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y);justify-content:center;align-items:center;display:flex;position:absolute}.autocomplete-delete-button svg{height:calc(var(--spacing,.25rem) * 3);width:calc(var(--spacing,.25rem) * 3)}.autocomplete-suggestions-container{z-index:10;margin:calc(var(--spacing,.25rem) * 0);max-height:calc(var(--spacing,.25rem) * 44);width:100%;padding:calc(var(--spacing,.25rem) * 0);--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);position:absolute;overflow:auto}.autocomplete-suggestion-item{cursor:pointer;padding:calc(var(--spacing,.25rem) * 2)}.autocomplete-value-container{top:50%;right:calc(var(--spacing,.25rem) * 2);justify-content:flex-start;align-items:center;gap:calc(var(--spacing,.25rem) * 2);flex-wrap:wrap;display:flex;position:absolute;transform:translateY(-50%)}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-font-weight:initial}}}.input-check-container{align-items:center;display:flex}.input-check{border-style:var(--tw-border-style);border-width:1px;border-radius:.25rem}.input-check:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.input-check-label{margin-left:calc(var(--spacing,.25rem) * 2);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500)}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-duration:initial;--tw-font-weight:initial}}}.select-input-container{z-index:0;margin-bottom:calc(var(--spacing,.25rem) * 5);width:100%;position:relative}.select-input{appearance:none;border-style:var(--tw-border-style);border-width:0;border-bottom-style:var(--tw-border-style);width:100%;padding-inline:calc(var(--spacing,.25rem) * 0);padding-block:calc(var(--spacing,.25rem) * 2.5);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));background-color:#0000;border-bottom-width:2px;display:block}.select-input:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-outline-style:none;outline-style:none}.select-input-label{top:calc(var(--spacing,.25rem) * 3);z-index:-10;transform-origin:0;--tw-translate-y:calc(var(--spacing,.25rem) * -6);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y);transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));--tw-duration:.3s;transition-duration:.3s;position:absolute}.select-input-label:is(:where(.peer):placeholder-shown~*){--tw-translate-y:calc(var(--spacing,.25rem) * 0);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.select-input-label:is(:where(.peer):focus~*){--tw-translate-y:calc(var(--spacing,.25rem) * -6);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);inset-inline-start:calc(var(--spacing,.25rem) * 0)}.select-input-label:where(:dir(rtl),[dir=rtl],[dir=rtl] *):is(:where(.peer):focus~*){--tw-translate-x: 25% ;translate:var(--tw-translate-x) var(--tw-translate-y);left:auto}.select-input-helper-text{margin-top:calc(var(--spacing,.25rem) * 2);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)))}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-duration:initial;--tw-font-weight:initial}}}.text-input-container{z-index:0;margin-bottom:calc(var(--spacing,.25rem) * 5);width:100%;position:relative}.text-input{appearance:none;border-style:var(--tw-border-style);border-width:0;border-bottom-style:var(--tw-border-style);width:100%;padding-inline:calc(var(--spacing,.25rem) * 0);padding-block:calc(var(--spacing,.25rem) * 2.5);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));background-color:#0000;border-bottom-width:2px;display:block}.text-input:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-outline-style:none;outline-style:none}.text-input-label{top:calc(var(--spacing,.25rem) * 3);transform-origin:0;--tw-translate-y:calc(var(--spacing,.25rem) * 0);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y);transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));--tw-duration:.3s;transition-duration:.3s;position:absolute}.text-input:focus~.text-input-label{--tw-translate-y:calc(var(--spacing,.25rem) * -7);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);inset-inline-start:calc(var(--spacing,.25rem) * 0)}[dir=rtl] .text-input:focus~.text-input-label{--tw-translate-x: 25% ;translate:var(--tw-translate-x) var(--tw-translate-y);left:auto}.text-input.has-placeholder~.text-input-label,.text-input.has-value~.text-input-label{--tw-translate-y:calc(var(--spacing,.25rem) * -7);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y)}.text-input-helper-text{margin-top:calc(var(--spacing,.25rem) * 2);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)))}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import "./Tooltip.css";
|
|
2
|
+
import { jsxs as f, jsx as p } from "react/jsx-runtime";
|
|
3
|
+
import { useId as m, useRef as u, useCallback as h, isValidElement as g, cloneElement as x } from "react";
|
|
4
|
+
function b(l) {
|
|
5
|
+
const { content: s, children: o, className: c = "" } = l, n = m(), i = u(null), a = h(() => {
|
|
6
|
+
const t = i.current;
|
|
7
|
+
if (!t) return;
|
|
8
|
+
t.style.transform = "";
|
|
9
|
+
const e = t.getBoundingClientRect(), r = window.innerWidth;
|
|
10
|
+
e.left < 0 ? t.style.transform = `translateX(calc(-50% + ${Math.ceil(-e.left)}px))` : e.right > r && (t.style.transform = `translateX(calc(-50% - ${Math.ceil(e.right - r)}px))`);
|
|
11
|
+
}, []), d = g(o) ? x(o, {
|
|
12
|
+
"aria-describedby": n
|
|
13
|
+
}) : o;
|
|
14
|
+
return /* @__PURE__ */ f(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
className: `tooltip-container ${c}`,
|
|
18
|
+
onMouseEnter: a,
|
|
19
|
+
children: [
|
|
20
|
+
d,
|
|
21
|
+
/* @__PURE__ */ p(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
id: n,
|
|
25
|
+
role: "tooltip",
|
|
26
|
+
className: "tooltip-text",
|
|
27
|
+
ref: i,
|
|
28
|
+
children: s
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
b as T
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var h=require("./Tooltip.css");const l=require("react/jsx-runtime"),e=require("react");function p(c){const{content:a,children:o,className:d=""}=c,i=e.useId(),r=e.useRef(null),u=e.useCallback(()=>{const t=r.current;if(!t)return;t.style.transform="";const n=t.getBoundingClientRect(),s=window.innerWidth;n.left<0?t.style.transform=`translateX(calc(-50% + ${Math.ceil(-n.left)}px))`:n.right>s&&(t.style.transform=`translateX(calc(-50% - ${Math.ceil(n.right-s)}px))`)},[]),f=e.isValidElement(o)?e.cloneElement(o,{"aria-describedby":i}):o;return l.jsxs("div",{className:`tooltip-container ${d}`,onMouseEnter:u,children:[f,l.jsx("div",{id:i,role:"tooltip",className:"tooltip-text",ref:r,children:a})]})}exports.Tooltip=p;
|
package/dist/Tooltip.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./Tooltip-BSKAgRkc.cjs");exports.Tooltip=o.Tooltip;
|
package/dist/Tooltip.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.tooltip-container{position:relative;display:inline-block;cursor:pointer}.tooltip-text{visibility:hidden;background-color:#000;color:#fff;text-align:center;padding:5px 10px;border-radius:5px;position:absolute;z-index:9999;bottom:125%;left:50%;transform:translate(-50%);opacity:0;transition:opacity .3s}.tooltip-container:hover .tooltip-text{visibility:visible;opacity:1}
|
package/dist/Tooltip.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./TranslationProvider-51Pc9Xrr.cjs");exports.TranslationProvider=r.TranslationProvider;exports.useTranslation=r.useTranslation;
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as i, useContext as s } from "react";
|
|
3
|
+
const n = i(
|
|
4
|
+
{}
|
|
5
|
+
);
|
|
6
|
+
function l(t) {
|
|
7
|
+
const { children: o, t: r, language: e } = t;
|
|
8
|
+
return /* @__PURE__ */ a(n.Provider, { value: { t: r, language: e }, children: o });
|
|
9
|
+
}
|
|
10
|
+
const x = () => {
|
|
11
|
+
const t = s(n);
|
|
12
|
+
if (t === void 0)
|
|
13
|
+
throw new Error("translationContext must be used within a Provider");
|
|
14
|
+
return t;
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
l as T,
|
|
18
|
+
x as u
|
|
19
|
+
};
|