@hxtos/hx-components 0.27.3 → 0.28.1

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/index.es.js CHANGED
@@ -24514,7 +24514,7 @@ const Pte = ({ children: e, tooltip: t }) => /* @__PURE__ */ y.jsxs("div", { cla
24514
24514
  "group-hover:visible",
24515
24515
  "opacity-0",
24516
24516
  "group-hover:opacity-100",
24517
- "z-0",
24517
+ "z-[99999]",
24518
24518
  "group-hover:z-50",
24519
24519
  "transition",
24520
24520
  "transform",
@@ -24564,14 +24564,16 @@ const Pte = ({ children: e, tooltip: t }) => /* @__PURE__ */ y.jsxs("div", { cla
24564
24564
  fileName: n,
24565
24565
  disabled: r,
24566
24566
  onChange: i,
24567
- accept: a = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
24567
+ multiple: a = !1,
24568
+ // Valor padrão é false
24569
+ accept: l = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
24568
24570
  }) => {
24569
- const l = gt(null), u = () => {
24570
- var f;
24571
- return (f = l.current) == null ? void 0 : f.click();
24572
- }, c = (f) => {
24573
- const h = f.target;
24574
- h.value = "";
24571
+ const u = gt(null), c = () => {
24572
+ var h;
24573
+ return (h = u.current) == null ? void 0 : h.click();
24574
+ }, f = (h) => {
24575
+ const p = h.target;
24576
+ p.value = "";
24575
24577
  };
24576
24578
  return /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
24577
24579
  /* @__PURE__ */ y.jsx(
@@ -24579,7 +24581,7 @@ const Pte = ({ children: e, tooltip: t }) => /* @__PURE__ */ y.jsxs("div", { cla
24579
24581
  {
24580
24582
  type: "button",
24581
24583
  disabled: r,
24582
- onClick: u,
24584
+ onClick: c,
24583
24585
  fileName: n,
24584
24586
  children: t
24585
24587
  }
@@ -24587,13 +24589,14 @@ const Pte = ({ children: e, tooltip: t }) => /* @__PURE__ */ y.jsxs("div", { cla
24587
24589
  /* @__PURE__ */ y.jsx(
24588
24590
  "input",
24589
24591
  {
24590
- ref: l,
24592
+ ref: u,
24591
24593
  type: "file",
24592
24594
  className: "hidden",
24593
- accept: a,
24594
- onClick: c,
24595
- onChange: (f) => {
24596
- i(f.target.files[0]);
24595
+ accept: l,
24596
+ multiple: a,
24597
+ onClick: f,
24598
+ onChange: (h) => {
24599
+ h.target.files && i(a ? Array.from(h.target.files) : h.target.files[0]);
24597
24600
  }
24598
24601
  }
24599
24602
  )
package/dist/index.umd.js CHANGED
@@ -187,7 +187,7 @@ You should wrap it with \`css\` like this:
187
187
  * LICENSE.md file in the root directory of this source tree.
188
188
  *
189
189
  * @license MIT
190
- */function v6(e,t){return e?Yz(e)?ne.createElement(e,t):e:null}function Yz(e){return Jz(e)||typeof e=="function"||Kz(e)}function Jz(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Kz(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function b6(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=ne.useState(()=>({current:Wz(t)})),[r,i]=ne.useState(()=>n.current.initialState);return n.current.setOptions(a=>({...a,...e,state:{...r,...e.state},onStateChange:l=>{i(l),e.onStateChange==null||e.onStateChange(l)}})),n.current}function C6({children:e}){return x.jsx("div",{className:"text-black dark:text-white",children:e})}function y6({itemsPerPageMessage:e,pageSeparatorMessage:t,totalRecords:n,size:r,pageIndex:i,canNextPage:a,canPreviousPage:l,onPageSizeChange:u,onGoFirstPage:c,onGoPreviousPage:f,onGoLastPage:h,onGoNextPage:p}){return x.jsxs("div",{className:"flex items-center justify-end gap-2 px-2 py-2 my-2 text-sm text-brand-text dark:text-white",children:[x.jsx("p",{children:e}),x.jsx("select",{className:Je("w-20 border-0 border-b border-brand-disabled focus:outline-none focus:ring-0 focus:border-l-0 focus:border-b focus:border-brand-primary","bg-brand-light-gray dark:bg-brand-dark-gray-dark","text-brand-secondary-text dark:text-brand-gray"),value:r,onChange:u,children:[5,10,25,50].map(m=>x.jsx("option",{value:m,children:m},`page-size-option-${m}`))}),x.jsxs("span",{children:[i+1," ",t," ",n]}),x.jsx("button",{onClick:c,disabled:!l,className:"text-gray-500 disabled:text-gray-300 hover:text-gray-700",children:x.jsx(bb,{})}),x.jsx("button",{onClick:f,disabled:!l,className:"text-gray-500 disabled:text-gray-300 hover:text-gray-700",children:x.jsx(ih,{})}),x.jsx("button",{onClick:p,disabled:!a,className:"text-gray-500 disabled:text-gray-300 hover:text-gray-700",children:x.jsx(oh,{})}),x.jsx("button",{onClick:h,disabled:!a,className:"text-gray-500 disabled:text-gray-300 hover:text-gray-700",children:x.jsx(Cb,{})})]})}function x6({noRecordsMessage:e}){return x.jsx("p",{className:"text-sm text-center",children:e})}function w6(e){var t,n,r,i,a,l,u;return((r=(n=(t=e==null?void 0:e.column)==null?void 0:t.parent)==null?void 0:n.columns)==null?void 0:r.length)&&((l=(a=(i=e==null?void 0:e.column)==null?void 0:i.parent)==null?void 0:a.columns[0])==null?void 0:l.id)===((u=e==null?void 0:e.column)==null?void 0:u.id)}function S6(e){var t,n,r,i,a,l,u;return((r=(n=(t=e==null?void 0:e.column)==null?void 0:t.parent)==null?void 0:n.columns)==null?void 0:r.length)&&((l=(a=(i=e==null?void 0:e.column)==null?void 0:i.parent)==null?void 0:a.columns[e.column.parent.columns.length-1])==null?void 0:l.id)===((u=e==null?void 0:e.column)==null?void 0:u.id)}function ru(e){var t;return((t=e==null?void 0:e.subHeaders)==null?void 0:t.length)>0}function I6({headerGroup:e,isPagination:t=!0,onSort:n,onColumn:r}){function i(l){return l.id==="select"?50:l.getSize()}function a(l,u){function c(){const h=l.column.getIsSorted();return h?h==="desc"?x.jsx(wb,{}):x.jsx(xb,{}):x.jsx(Sb,{})}function f(h){const p=h.column.getIsSorted();n(typeof p=="boolean"?"":p),r(h.id)}return x.jsx(x.Fragment,{children:x.jsx("th",{className:Je("px-2 py-3 text-xs text-left select-none border-b border-brand-disabled",{"border-r":ru(l)||S6(l),"border-l":ru(l)||w6(l)}),colSpan:l.colSpan,style:{width:i(l)},children:x.jsxs("div",{className:"flex items-center justify-between",children:[ru(l)&&x.jsx("div",{}),x.jsxs("div",{className:"flex flex-row items-center space-x-4 text-sm font-bold text-brand-primary",children:[x.jsx("span",{className:"w-full",children:v6(l.column.columnDef.header,l.getContext())}),l.column.columnDef.sortingFn&&!ru(l)&&x.jsx("span",{className:`px-2 ${l.column.getCanSort()?"cursor-pointer":""}`,onClick:async h=>{await l.column.getToggleSortingHandler()(h),t&&f(l)},children:c()})]}),l.id!=="select"&&x.jsx("div",{onMouseDown:l.getResizeHandler(),onTouchStart:l.getResizeHandler(),className:"w-3 h-full text-brand-gray cursor-col-resize",children:x.jsx(yb,{})})]})},`thead-th-${l.id}-${u}`)})}return x.jsx("tr",{className:"mx-auto",children:e.headers.map(a)},`thead-tr-${e.id}`)}function E6({row:e,index:t,renderSubComponent:n}){function r(i,a){return x.jsx("td",{className:Je("px-2 children:align-middle overflow-ellipsis whitespace-nowrap border-brand-disabled",{"border-r":S6(i),"border-l":w6(i)}),children:v6(i.column.columnDef.cell,i.getContext())},`tbody-td-${i.id}-${a}`)}return x.jsxs(b.Fragment,{children:[x.jsx("tr",{className:"mx-auto children:text-sm children:py-3 children:text-brand-text dark:children:text-white children:last-of-type:border-b children:last-of-type:border-brand-disabled",children:e.getVisibleCells().map(r)},`tbody-tr-${e.id}-${t}`),e.getIsExpanded()?x.jsx("tr",{children:x.jsx("td",{colSpan:e.getVisibleCells().length,children:n({row:e})})}):null]},`tbody-fragmment-${e.id}-${t}`)}function A6({spinnerMessage:e}){return x.jsx("div",{className:"flex items-center justify-center mt-10",children:x.jsx(v1,{size:50,children:e})})}function _6({indeterminate:e,className:t="w-5 h-5 rounded-md border-brand-primary border-1 text-brand-primary focus:ring-0",...n}){const r=b.useRef(null);return b.useEffect(()=>{typeof e=="boolean"&&(r.current.indeterminate=!n.checked&&e)},[r,e]),x.jsx("input",{type:"checkbox",ref:r,className:t+" cursor-pointer",...n})}function P6(e,t){return e?[{id:"select",sortingFn:!1,header:({table:r})=>x.jsx(_6,{checked:r.getIsAllRowsSelected(),indeterminate:r.getIsSomeRowsSelected(),onChange:r.getToggleAllRowsSelectedHandler()}),cell:({row:r})=>x.jsx("div",{className:"px-1",children:x.jsx(_6,{checked:r.getIsSelected(),disabled:!r.getCanSelect(),indeterminate:r.getIsSomeSelected(),onChange:r.getToggleSelectedHandler()})})},...t]:t}function qz({setFilter:e,placeholder:t}){let n=0;function r(i){clearTimeout(n),n=setTimeout(()=>{e(i.target.value||void 0)},500)}return x.jsxs("div",{className:"flex items-center gap-2 px-2 my-2 bg-gray-100 border-b-2 border-gray-200 rounded-sm focus-within:border-0 focus-within:border-b focus-within:border-brand-primary focus-within:ring-brand-primary dark:bg-gray-700",children:[x.jsx(Ju,{className:"text-brand-secondary-text dark:text-brand-gray"}),x.jsx("input",{className:"flex-1 py-2 bg-transparent text-sm border-none appearance-none focus:outline-none focus:ring-0",placeholder:t,onChange:r})]})}function Qz({data:e,columns:t,isFetching:n,searchable:r=!0,isRowSelection:i=!1,totalRecords:a,spinnerMessage:l="Carregando...",noRecordsMessage:u="Nenhuma entrada encontrada.",searchPlaceholder:c="Buscar...",itemsPerPageMessage:f="Itens por página:",pageSeparatorMessage:h="de",onRowSelection:p,renderSubComponent:m,getRowCanExpand:v,onSearch:w,onSize:I,onPage:A,onColumn:P,onSort:O}){const L="onChange",[N,D]=b.useState([]),[z,X]=b.useState(0),[Y,fe]=b.useState(!1),[Te,He]=b.useState(!1),[Xe,pe]=b.useState({}),xe=b6({data:e,columns:P6(i,t),columnResizeMode:L,initialState:{pagination:{pageSize:5}},defaultColumn:{minSize:100,size:150,maxSize:1e3},state:{rowSelection:Xe,sorting:N},getRowCanExpand:v,onRowSelectionChange:pe,getCoreRowModel:f6(),getFilteredRowModel:d6(),getPaginationRowModel:m6(),onSortingChange:D,getSortedRowModel:h6(),getExpandedRowModel:p6()}),be=xe.getState().pagination.pageSize;function Ee(k){A(k),X(k)}function $e(k){Ee(0),I(Number(k.target.value)),xe.setPageSize(Number(k.target.value))}function Ke(k){Ee(0),w(k)}function M(){Ee(0)}function T(){const k=z-1;Ee(k)}function R(){const k=z+1;Ee(k)}function F(){const k=Math.ceil(a/be)-1;Ee(k)}function C(){return p(xe.getSelectedRowModel().flatRows)}return b.useEffect(()=>{function k(){if(z===0){fe(!1);return}fe(!0)}function ee(){const ae=Math.ceil(a/be);z>=ae-1?He(!1):He(!0)}k(),ee()},[z,a,be]),x.jsxs(C6,{children:[r&&x.jsx(qz,{setFilter:Ke,placeholder:c}),n&&x.jsx(A6,{spinnerMessage:l}),e.length===0&&!n&&x.jsx(x6,{noRecordsMessage:u}),e.length>0&&!n&&x.jsx("div",{className:"flex justify-center items-center",children:x.jsx("div",{className:"overflow-x-auto",children:x.jsxs("table",{style:{width:xe.getCenterTotalSize()},children:[x.jsx("thead",{children:xe.getHeaderGroups().map(k=>x.jsx(I6,{headerGroup:k,onColumn:P,onSort:O}))}),x.jsx("tbody",{className:"divide-y divide-brand-disabled",children:xe.getRowModel().rows.map((k,ee)=>x.jsx(E6,{index:ee,row:k,renderSubComponent:m},k.id))})]})})}),x.jsx(y6,{itemsPerPageMessage:f,pageSeparatorMessage:h,totalRecords:Math.ceil(a/be),size:be,pageIndex:z,canNextPage:Te,canPreviousPage:Y,onPageSizeChange:$e,onGoFirstPage:M,onGoPreviousPage:T,onGoLastPage:F,onGoNextPage:R}),i&&p&&C()]})}function eU({value:e,onChange:t,placeholder:n,debounce:r=500,...i}){const[a,l]=b.useState(e);return b.useEffect(()=>{l(e)},[e]),b.useEffect(()=>{const u=setTimeout(()=>{t(a)},r);return()=>clearTimeout(u)},[a]),x.jsxs("div",{className:"flex items-center gap-2 px-2 my-2 bg-gray-100 border-b-2 border-gray-200 rounded-sm focus-within:border-0 focus-within:border-b focus-within:border-brand-primary focus-within:ring-brand-primary dark:bg-gray-700",children:[x.jsx(Ju,{className:"text-brand-secondary-text dark:text-brand-gray"}),x.jsx("input",{...i,value:a,className:"flex-1 py-2 bg-transparent text-sm border-none appearance-none focus:outline-none focus:ring-0",placeholder:n,onChange:u=>l(u.target.value)})]})}function tU({data:e,columns:t,isFetching:n,searchable:r=!0,isRowSelection:i=!1,spinnerMessage:a="Carregando...",noRecordsMessage:l="Nenhuma entrada encontrada.",searchPlaceholder:u="Buscar...",itemsPerPageMessage:c="Itens por página:",pageSeparatorMessage:f="de",onRowSelection:h,renderSubComponent:p,getRowCanExpand:m}){const v="onChange",[w,I]=b.useState([]),[A,P]=b.useState({}),[O,L]=b.useState(""),N=b6({data:e,columns:P6(i,t),columnResizeMode:v,initialState:{pagination:{pageSize:5}},defaultColumn:{minSize:100,size:150,maxSize:1e3},state:{rowSelection:A,sorting:w,globalFilter:O},getRowCanExpand:m,onGlobalFilterChange:L,onRowSelectionChange:P,getCoreRowModel:f6(),getFilteredRowModel:d6(),getPaginationRowModel:m6(),onSortingChange:I,getSortedRowModel:h6(),getExpandedRowModel:p6()}),D=N.getState().pagination.pageSize;function z(Y){N.setPageSize(Number(Y.target.value))}function X(){return h(N.getSelectedRowModel().flatRows)}return x.jsxs(C6,{children:[r&&x.jsx(eU,{value:O??"",onChange:Y=>L(String(Y)),placeholder:u}),n&&x.jsx(A6,{spinnerMessage:a}),e.length===0&&!n&&x.jsx(x6,{noRecordsMessage:l}),e.length>0&&!n&&x.jsx("div",{className:"flex justify-center items-center",children:x.jsx("div",{className:"overflow-x-auto",children:x.jsxs("table",{style:{width:N.getCenterTotalSize()},children:[x.jsx("thead",{children:N.getHeaderGroups().map(Y=>x.jsx(I6,{headerGroup:Y,isPagination:!1,onColumn:()=>null,onSort:()=>null}))}),x.jsx("tbody",{className:"divide-y divide-brand-disabled",children:N.getRowModel().rows.map((Y,fe)=>x.jsx(E6,{index:fe,row:Y,renderSubComponent:p},Y.id))})]})})}),x.jsx(y6,{itemsPerPageMessage:c,pageSeparatorMessage:f,totalRecords:N.getPageCount(),size:D,pageIndex:N.getState().pagination.pageIndex,canNextPage:N.getCanNextPage(),canPreviousPage:N.getCanPreviousPage(),onPageSizeChange:z,onGoFirstPage:()=>N.setPageIndex(0),onGoPreviousPage:()=>N.previousPage(),onGoLastPage:()=>N.setPageIndex(N.getPageCount()-1),onGoNextPage:()=>N.nextPage()}),i&&h&&X()]})}const T6=({children:e,tooltip:t})=>x.jsxs("div",{className:"relative inline-block group",children:[e,x.jsx("span",{className:`${Je("invisible","group-hover:visible","opacity-0","group-hover:opacity-100","z-0","group-hover:z-50","transition","transform","left-1/2","text-xs","-top-9","-translate-x-1/2","bg-brand-text","text-white","p-2","rounded","absolute","whitespace-nowrap")}`,children:t})]}),nU=({children:e,className:t,id:n,tooltip:r,variant:i,...a})=>x.jsx(x.Fragment,{children:x.jsx(T6,{tooltip:r,children:x.jsx("button",{className:`${Je("w-8 h-8 rounded","flex items-center justify-center","transition outline-none outline-2","shadow-action-button hover:shadow-action-button-hover","hover:bg-brand-secondary hover:text-white disabled:bg-brand-disabled disabled:text-white","disabled:shadow-none disabled:hover:cursor-not-allowed",{"bg-brand-primary text-white":i==="primary","bg-brand-tertiary-light text-brand-primary":i==="secondary"},t)}`,...a,children:e})},n)}),$d=({Container:e,children:t,fileName:n,disabled:r,onChange:i,accept:a="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"})=>{const l=b.useRef(null),u=()=>{var f;return(f=l.current)==null?void 0:f.click()},c=f=>{const h=f.target;h.value=""};return x.jsxs(x.Fragment,{children:[x.jsx(e,{type:"button",disabled:r,onClick:u,fileName:n,children:t}),x.jsx("input",{ref:l,type:"file",className:"hidden",accept:a,onClick:c,onChange:f=>{i(f.target.files[0])}})]})},rU=e=>x.jsx(Ki,{variant:"primary",...e}),iU=e=>x.jsx(Ki,{variant:"secondary",...e}),oU=({children:e,disabled:t,fileName:n,...r})=>x.jsx("button",{disabled:t,className:`relative ${t?"bg-gray-300 text-white cursor-not-allowed border-2 border-gray-900 border-dashed":"bg-white text-primary-500 hover:bg-primary-100 hover:mb-0 border-2 border-gray-800 border-dashed cursor-pointer"}
190
+ */function v6(e,t){return e?Yz(e)?ne.createElement(e,t):e:null}function Yz(e){return Jz(e)||typeof e=="function"||Kz(e)}function Jz(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Kz(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function b6(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=ne.useState(()=>({current:Wz(t)})),[r,i]=ne.useState(()=>n.current.initialState);return n.current.setOptions(a=>({...a,...e,state:{...r,...e.state},onStateChange:l=>{i(l),e.onStateChange==null||e.onStateChange(l)}})),n.current}function C6({children:e}){return x.jsx("div",{className:"text-black dark:text-white",children:e})}function y6({itemsPerPageMessage:e,pageSeparatorMessage:t,totalRecords:n,size:r,pageIndex:i,canNextPage:a,canPreviousPage:l,onPageSizeChange:u,onGoFirstPage:c,onGoPreviousPage:f,onGoLastPage:h,onGoNextPage:p}){return x.jsxs("div",{className:"flex items-center justify-end gap-2 px-2 py-2 my-2 text-sm text-brand-text dark:text-white",children:[x.jsx("p",{children:e}),x.jsx("select",{className:Je("w-20 border-0 border-b border-brand-disabled focus:outline-none focus:ring-0 focus:border-l-0 focus:border-b focus:border-brand-primary","bg-brand-light-gray dark:bg-brand-dark-gray-dark","text-brand-secondary-text dark:text-brand-gray"),value:r,onChange:u,children:[5,10,25,50].map(m=>x.jsx("option",{value:m,children:m},`page-size-option-${m}`))}),x.jsxs("span",{children:[i+1," ",t," ",n]}),x.jsx("button",{onClick:c,disabled:!l,className:"text-gray-500 disabled:text-gray-300 hover:text-gray-700",children:x.jsx(bb,{})}),x.jsx("button",{onClick:f,disabled:!l,className:"text-gray-500 disabled:text-gray-300 hover:text-gray-700",children:x.jsx(ih,{})}),x.jsx("button",{onClick:p,disabled:!a,className:"text-gray-500 disabled:text-gray-300 hover:text-gray-700",children:x.jsx(oh,{})}),x.jsx("button",{onClick:h,disabled:!a,className:"text-gray-500 disabled:text-gray-300 hover:text-gray-700",children:x.jsx(Cb,{})})]})}function x6({noRecordsMessage:e}){return x.jsx("p",{className:"text-sm text-center",children:e})}function w6(e){var t,n,r,i,a,l,u;return((r=(n=(t=e==null?void 0:e.column)==null?void 0:t.parent)==null?void 0:n.columns)==null?void 0:r.length)&&((l=(a=(i=e==null?void 0:e.column)==null?void 0:i.parent)==null?void 0:a.columns[0])==null?void 0:l.id)===((u=e==null?void 0:e.column)==null?void 0:u.id)}function S6(e){var t,n,r,i,a,l,u;return((r=(n=(t=e==null?void 0:e.column)==null?void 0:t.parent)==null?void 0:n.columns)==null?void 0:r.length)&&((l=(a=(i=e==null?void 0:e.column)==null?void 0:i.parent)==null?void 0:a.columns[e.column.parent.columns.length-1])==null?void 0:l.id)===((u=e==null?void 0:e.column)==null?void 0:u.id)}function ru(e){var t;return((t=e==null?void 0:e.subHeaders)==null?void 0:t.length)>0}function I6({headerGroup:e,isPagination:t=!0,onSort:n,onColumn:r}){function i(l){return l.id==="select"?50:l.getSize()}function a(l,u){function c(){const h=l.column.getIsSorted();return h?h==="desc"?x.jsx(wb,{}):x.jsx(xb,{}):x.jsx(Sb,{})}function f(h){const p=h.column.getIsSorted();n(typeof p=="boolean"?"":p),r(h.id)}return x.jsx(x.Fragment,{children:x.jsx("th",{className:Je("px-2 py-3 text-xs text-left select-none border-b border-brand-disabled",{"border-r":ru(l)||S6(l),"border-l":ru(l)||w6(l)}),colSpan:l.colSpan,style:{width:i(l)},children:x.jsxs("div",{className:"flex items-center justify-between",children:[ru(l)&&x.jsx("div",{}),x.jsxs("div",{className:"flex flex-row items-center space-x-4 text-sm font-bold text-brand-primary",children:[x.jsx("span",{className:"w-full",children:v6(l.column.columnDef.header,l.getContext())}),l.column.columnDef.sortingFn&&!ru(l)&&x.jsx("span",{className:`px-2 ${l.column.getCanSort()?"cursor-pointer":""}`,onClick:async h=>{await l.column.getToggleSortingHandler()(h),t&&f(l)},children:c()})]}),l.id!=="select"&&x.jsx("div",{onMouseDown:l.getResizeHandler(),onTouchStart:l.getResizeHandler(),className:"w-3 h-full text-brand-gray cursor-col-resize",children:x.jsx(yb,{})})]})},`thead-th-${l.id}-${u}`)})}return x.jsx("tr",{className:"mx-auto",children:e.headers.map(a)},`thead-tr-${e.id}`)}function E6({row:e,index:t,renderSubComponent:n}){function r(i,a){return x.jsx("td",{className:Je("px-2 children:align-middle overflow-ellipsis whitespace-nowrap border-brand-disabled",{"border-r":S6(i),"border-l":w6(i)}),children:v6(i.column.columnDef.cell,i.getContext())},`tbody-td-${i.id}-${a}`)}return x.jsxs(b.Fragment,{children:[x.jsx("tr",{className:"mx-auto children:text-sm children:py-3 children:text-brand-text dark:children:text-white children:last-of-type:border-b children:last-of-type:border-brand-disabled",children:e.getVisibleCells().map(r)},`tbody-tr-${e.id}-${t}`),e.getIsExpanded()?x.jsx("tr",{children:x.jsx("td",{colSpan:e.getVisibleCells().length,children:n({row:e})})}):null]},`tbody-fragmment-${e.id}-${t}`)}function A6({spinnerMessage:e}){return x.jsx("div",{className:"flex items-center justify-center mt-10",children:x.jsx(v1,{size:50,children:e})})}function _6({indeterminate:e,className:t="w-5 h-5 rounded-md border-brand-primary border-1 text-brand-primary focus:ring-0",...n}){const r=b.useRef(null);return b.useEffect(()=>{typeof e=="boolean"&&(r.current.indeterminate=!n.checked&&e)},[r,e]),x.jsx("input",{type:"checkbox",ref:r,className:t+" cursor-pointer",...n})}function P6(e,t){return e?[{id:"select",sortingFn:!1,header:({table:r})=>x.jsx(_6,{checked:r.getIsAllRowsSelected(),indeterminate:r.getIsSomeRowsSelected(),onChange:r.getToggleAllRowsSelectedHandler()}),cell:({row:r})=>x.jsx("div",{className:"px-1",children:x.jsx(_6,{checked:r.getIsSelected(),disabled:!r.getCanSelect(),indeterminate:r.getIsSomeSelected(),onChange:r.getToggleSelectedHandler()})})},...t]:t}function qz({setFilter:e,placeholder:t}){let n=0;function r(i){clearTimeout(n),n=setTimeout(()=>{e(i.target.value||void 0)},500)}return x.jsxs("div",{className:"flex items-center gap-2 px-2 my-2 bg-gray-100 border-b-2 border-gray-200 rounded-sm focus-within:border-0 focus-within:border-b focus-within:border-brand-primary focus-within:ring-brand-primary dark:bg-gray-700",children:[x.jsx(Ju,{className:"text-brand-secondary-text dark:text-brand-gray"}),x.jsx("input",{className:"flex-1 py-2 bg-transparent text-sm border-none appearance-none focus:outline-none focus:ring-0",placeholder:t,onChange:r})]})}function Qz({data:e,columns:t,isFetching:n,searchable:r=!0,isRowSelection:i=!1,totalRecords:a,spinnerMessage:l="Carregando...",noRecordsMessage:u="Nenhuma entrada encontrada.",searchPlaceholder:c="Buscar...",itemsPerPageMessage:f="Itens por página:",pageSeparatorMessage:h="de",onRowSelection:p,renderSubComponent:m,getRowCanExpand:v,onSearch:w,onSize:I,onPage:A,onColumn:P,onSort:O}){const L="onChange",[N,D]=b.useState([]),[z,X]=b.useState(0),[Y,fe]=b.useState(!1),[Te,He]=b.useState(!1),[Xe,pe]=b.useState({}),xe=b6({data:e,columns:P6(i,t),columnResizeMode:L,initialState:{pagination:{pageSize:5}},defaultColumn:{minSize:100,size:150,maxSize:1e3},state:{rowSelection:Xe,sorting:N},getRowCanExpand:v,onRowSelectionChange:pe,getCoreRowModel:f6(),getFilteredRowModel:d6(),getPaginationRowModel:m6(),onSortingChange:D,getSortedRowModel:h6(),getExpandedRowModel:p6()}),be=xe.getState().pagination.pageSize;function Ee(k){A(k),X(k)}function $e(k){Ee(0),I(Number(k.target.value)),xe.setPageSize(Number(k.target.value))}function Ke(k){Ee(0),w(k)}function M(){Ee(0)}function T(){const k=z-1;Ee(k)}function R(){const k=z+1;Ee(k)}function F(){const k=Math.ceil(a/be)-1;Ee(k)}function C(){return p(xe.getSelectedRowModel().flatRows)}return b.useEffect(()=>{function k(){if(z===0){fe(!1);return}fe(!0)}function ee(){const ae=Math.ceil(a/be);z>=ae-1?He(!1):He(!0)}k(),ee()},[z,a,be]),x.jsxs(C6,{children:[r&&x.jsx(qz,{setFilter:Ke,placeholder:c}),n&&x.jsx(A6,{spinnerMessage:l}),e.length===0&&!n&&x.jsx(x6,{noRecordsMessage:u}),e.length>0&&!n&&x.jsx("div",{className:"flex justify-center items-center",children:x.jsx("div",{className:"overflow-x-auto",children:x.jsxs("table",{style:{width:xe.getCenterTotalSize()},children:[x.jsx("thead",{children:xe.getHeaderGroups().map(k=>x.jsx(I6,{headerGroup:k,onColumn:P,onSort:O}))}),x.jsx("tbody",{className:"divide-y divide-brand-disabled",children:xe.getRowModel().rows.map((k,ee)=>x.jsx(E6,{index:ee,row:k,renderSubComponent:m},k.id))})]})})}),x.jsx(y6,{itemsPerPageMessage:f,pageSeparatorMessage:h,totalRecords:Math.ceil(a/be),size:be,pageIndex:z,canNextPage:Te,canPreviousPage:Y,onPageSizeChange:$e,onGoFirstPage:M,onGoPreviousPage:T,onGoLastPage:F,onGoNextPage:R}),i&&p&&C()]})}function eU({value:e,onChange:t,placeholder:n,debounce:r=500,...i}){const[a,l]=b.useState(e);return b.useEffect(()=>{l(e)},[e]),b.useEffect(()=>{const u=setTimeout(()=>{t(a)},r);return()=>clearTimeout(u)},[a]),x.jsxs("div",{className:"flex items-center gap-2 px-2 my-2 bg-gray-100 border-b-2 border-gray-200 rounded-sm focus-within:border-0 focus-within:border-b focus-within:border-brand-primary focus-within:ring-brand-primary dark:bg-gray-700",children:[x.jsx(Ju,{className:"text-brand-secondary-text dark:text-brand-gray"}),x.jsx("input",{...i,value:a,className:"flex-1 py-2 bg-transparent text-sm border-none appearance-none focus:outline-none focus:ring-0",placeholder:n,onChange:u=>l(u.target.value)})]})}function tU({data:e,columns:t,isFetching:n,searchable:r=!0,isRowSelection:i=!1,spinnerMessage:a="Carregando...",noRecordsMessage:l="Nenhuma entrada encontrada.",searchPlaceholder:u="Buscar...",itemsPerPageMessage:c="Itens por página:",pageSeparatorMessage:f="de",onRowSelection:h,renderSubComponent:p,getRowCanExpand:m}){const v="onChange",[w,I]=b.useState([]),[A,P]=b.useState({}),[O,L]=b.useState(""),N=b6({data:e,columns:P6(i,t),columnResizeMode:v,initialState:{pagination:{pageSize:5}},defaultColumn:{minSize:100,size:150,maxSize:1e3},state:{rowSelection:A,sorting:w,globalFilter:O},getRowCanExpand:m,onGlobalFilterChange:L,onRowSelectionChange:P,getCoreRowModel:f6(),getFilteredRowModel:d6(),getPaginationRowModel:m6(),onSortingChange:I,getSortedRowModel:h6(),getExpandedRowModel:p6()}),D=N.getState().pagination.pageSize;function z(Y){N.setPageSize(Number(Y.target.value))}function X(){return h(N.getSelectedRowModel().flatRows)}return x.jsxs(C6,{children:[r&&x.jsx(eU,{value:O??"",onChange:Y=>L(String(Y)),placeholder:u}),n&&x.jsx(A6,{spinnerMessage:a}),e.length===0&&!n&&x.jsx(x6,{noRecordsMessage:l}),e.length>0&&!n&&x.jsx("div",{className:"flex justify-center items-center",children:x.jsx("div",{className:"overflow-x-auto",children:x.jsxs("table",{style:{width:N.getCenterTotalSize()},children:[x.jsx("thead",{children:N.getHeaderGroups().map(Y=>x.jsx(I6,{headerGroup:Y,isPagination:!1,onColumn:()=>null,onSort:()=>null}))}),x.jsx("tbody",{className:"divide-y divide-brand-disabled",children:N.getRowModel().rows.map((Y,fe)=>x.jsx(E6,{index:fe,row:Y,renderSubComponent:p},Y.id))})]})})}),x.jsx(y6,{itemsPerPageMessage:c,pageSeparatorMessage:f,totalRecords:N.getPageCount(),size:D,pageIndex:N.getState().pagination.pageIndex,canNextPage:N.getCanNextPage(),canPreviousPage:N.getCanPreviousPage(),onPageSizeChange:z,onGoFirstPage:()=>N.setPageIndex(0),onGoPreviousPage:()=>N.previousPage(),onGoLastPage:()=>N.setPageIndex(N.getPageCount()-1),onGoNextPage:()=>N.nextPage()}),i&&h&&X()]})}const T6=({children:e,tooltip:t})=>x.jsxs("div",{className:"relative inline-block group",children:[e,x.jsx("span",{className:`${Je("invisible","group-hover:visible","opacity-0","group-hover:opacity-100","z-[99999]","group-hover:z-50","transition","transform","left-1/2","text-xs","-top-9","-translate-x-1/2","bg-brand-text","text-white","p-2","rounded","absolute","whitespace-nowrap")}`,children:t})]}),nU=({children:e,className:t,id:n,tooltip:r,variant:i,...a})=>x.jsx(x.Fragment,{children:x.jsx(T6,{tooltip:r,children:x.jsx("button",{className:`${Je("w-8 h-8 rounded","flex items-center justify-center","transition outline-none outline-2","shadow-action-button hover:shadow-action-button-hover","hover:bg-brand-secondary hover:text-white disabled:bg-brand-disabled disabled:text-white","disabled:shadow-none disabled:hover:cursor-not-allowed",{"bg-brand-primary text-white":i==="primary","bg-brand-tertiary-light text-brand-primary":i==="secondary"},t)}`,...a,children:e})},n)}),$d=({Container:e,children:t,fileName:n,disabled:r,onChange:i,multiple:a=!1,accept:l="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"})=>{const u=b.useRef(null),c=()=>{var h;return(h=u.current)==null?void 0:h.click()},f=h=>{const p=h.target;p.value=""};return x.jsxs(x.Fragment,{children:[x.jsx(e,{type:"button",disabled:r,onClick:c,fileName:n,children:t}),x.jsx("input",{ref:u,type:"file",className:"hidden",accept:l,multiple:a,onClick:f,onChange:h=>{h.target.files&&i(a?Array.from(h.target.files):h.target.files[0])}})]})},rU=e=>x.jsx(Ki,{variant:"primary",...e}),iU=e=>x.jsx(Ki,{variant:"secondary",...e}),oU=({children:e,disabled:t,fileName:n,...r})=>x.jsx("button",{disabled:t,className:`relative ${t?"bg-gray-300 text-white cursor-not-allowed border-2 border-gray-900 border-dashed":"bg-white text-primary-500 hover:bg-primary-100 hover:mb-0 border-2 border-gray-800 border-dashed cursor-pointer"}
191
191
  flex items-center justify-center w-full h-full p-2 overflow-hidden transition-all duration-300 ease-out transform focus:outline-none rounded-2xl border-opacity-20 dark:bg-brand-dark-gray-dark`,...r,children:x.jsxs("div",{className:`flex ${n?"flex-row":"flex-col"} items-center justify-center`,children:[x.jsx("div",{children:n?x.jsx(ub,{}):x.jsx(Fb,{})}),x.jsx("div",{children:x.jsx("span",{className:"w-full text-sm text-center text-gray-900 dark:text-brand-secondary-text",children:e})})]})}),aU={PrimaryButton:e=>x.jsx($d,{...e,Container:rU}),OutlineButton:e=>x.jsx($d,{...e,Container:iU}),BoxButton:e=>x.jsx($d,{...e,Container:oU})};var iu={exports:{}};/**
192
192
  * @license
193
193
  * Lodash <https://lodash.com/>
@@ -6,6 +6,7 @@ export interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
6
6
  name: string;
7
7
  disabled?: boolean | undefined;
8
8
  fileName?: string;
9
+ multiple?: boolean;
9
10
  }
10
11
  export declare const UploadFile: {
11
12
  PrimaryButton: (props: any) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Hxtos"
5
5
  },
6
6
  "private": false,
7
- "version": "0.27.3",
7
+ "version": "0.28.1",
8
8
  "license": "MIT",
9
9
  "description": "Biblioteca de componentes Hxtos",
10
10
  "type": "module",