@hxtos/hx-components 0.3.0 → 0.4.0
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 +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -23211,7 +23211,7 @@ function Zee({
|
|
|
23211
23211
|
isFetching: n,
|
|
23212
23212
|
searchable: r = !0,
|
|
23213
23213
|
isRowSelection: i = !1,
|
|
23214
|
-
totalRecords: a
|
|
23214
|
+
totalRecords: a,
|
|
23215
23215
|
spinnerMessage: u = "Carregando...",
|
|
23216
23216
|
noRecordsMessage: l = "Nenhuma entrada encontrada.",
|
|
23217
23217
|
searchPlaceholder: c = "Buscar...",
|
package/dist/index.umd.js
CHANGED
|
@@ -187,7 +187,7 @@ Check the top-level render call using <`+W+">.")}return V}}function _i(x,V){{if(
|
|
|
187
187
|
* LICENSE.md file in the root directory of this source tree.
|
|
188
188
|
*
|
|
189
189
|
* @license MIT
|
|
190
|
-
*/function Zx(e,t){return e?MX(e)?re.createElement(e,t):e:null}function MX(e){return $X(e)||typeof e=="function"||LX(e)}function $X(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function LX(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function DX(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=re.useState(()=>({current:SX(t)})),[r,i]=re.useState(()=>n.current.initialState);return n.current.setOptions(a=>({...a,...e,state:{...r,...e.state},onStateChange:u=>{i(u),e.onStateChange==null||e.onStateChange(u)}})),n.current}function NX({setFilter:e,placeholder:t}){let n=0;function r(i){clearTimeout(n),n=setTimeout(()=>{e(i.target.value||void 0)},500)}return $.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:[$.jsx(dW,{className:"text-brand-secondary-text dark:text-brand-gray"}),$.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 VX(e,t){return e?[{id:"select",sortingFn:!1,header:({table:r})=>$.jsx(Xx,{checked:r.getIsAllRowsSelected(),indeterminate:r.getIsSomeRowsSelected(),onChange:r.getToggleAllRowsSelectedHandler()}),cell:({row:r})=>$.jsx("div",{className:"px-1",children:$.jsx(Xx,{checked:r.getIsSelected(),disabled:!r.getCanSelect(),indeterminate:r.getIsSomeSelected(),onChange:r.getToggleSelectedHandler()})})},...t]:t}function Xx({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]),$.jsx("input",{type:"checkbox",ref:r,className:t+" cursor-pointer",...n})}function BX({data:e,columns:t,isFetching:n,searchable:r=!0,isRowSelection:i=!1,totalRecords:a
|
|
190
|
+
*/function Zx(e,t){return e?MX(e)?re.createElement(e,t):e:null}function MX(e){return $X(e)||typeof e=="function"||LX(e)}function $X(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function LX(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function DX(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=re.useState(()=>({current:SX(t)})),[r,i]=re.useState(()=>n.current.initialState);return n.current.setOptions(a=>({...a,...e,state:{...r,...e.state},onStateChange:u=>{i(u),e.onStateChange==null||e.onStateChange(u)}})),n.current}function NX({setFilter:e,placeholder:t}){let n=0;function r(i){clearTimeout(n),n=setTimeout(()=>{e(i.target.value||void 0)},500)}return $.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:[$.jsx(dW,{className:"text-brand-secondary-text dark:text-brand-gray"}),$.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 VX(e,t){return e?[{id:"select",sortingFn:!1,header:({table:r})=>$.jsx(Xx,{checked:r.getIsAllRowsSelected(),indeterminate:r.getIsSomeRowsSelected(),onChange:r.getToggleAllRowsSelectedHandler()}),cell:({row:r})=>$.jsx("div",{className:"px-1",children:$.jsx(Xx,{checked:r.getIsSelected(),disabled:!r.getCanSelect(),indeterminate:r.getIsSomeSelected(),onChange:r.getToggleSelectedHandler()})})},...t]:t}function Xx({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]),$.jsx("input",{type:"checkbox",ref:r,className:t+" cursor-pointer",...n})}function BX({data:e,columns:t,isFetching:n,searchable:r=!0,isRowSelection:i=!1,totalRecords:a,spinnerMessage:u="Carregando...",noRecordsMessage:l="Nenhuma entrada encontrada.",searchPlaceholder:c="Buscar...",itemsPerPageMessage:f="Itens por página:",pageSeparatorMessage:p="de",onRowSelection:h,renderSubComponent:m,getRowCanExpand:v,onSearch:S,onSize:w,onPage:E,onColumn:P,onSort:R}){const L="onChange",[B,N]=b.useState([]),[U,X]=b.useState(0),[Q,ce]=b.useState(!1),[Oe,Xe]=b.useState(!1),[He,he]=b.useState({}),be=DX({data:e,columns:VX(i,t),columnResizeMode:L,initialState:{pagination:{pageSize:5}},defaultColumn:{minSize:100,size:150,maxSize:1e3},state:{rowSelection:He,sorting:B},getRowCanExpand:v,onRowSelectionChange:he,getCoreRowModel:EX(),getFilteredRowModel:TX(),getPaginationRowModel:RX(),onSortingChange:N,getSortedRowModel:OX(),getExpandedRowModel:FX()});function we(k,z){function ee(){const ae=k.column.getIsSorted();return ae?ae==="desc"?$.jsx(hW,{}):$.jsx(pW,{}):$.jsx(gW,{})}function te(ae){const Y=ae.column.getIsSorted();R(typeof Y=="boolean"?"":Y),P(ae.id)}return $.jsx($.Fragment,{children:$.jsx("th",{className:"px-2 py-3 text-xs text-left border-b select-none border-b-brand-disabled",colSpan:k.colSpan,style:{width:_e(k)},children:$.jsxs("div",{className:"flex items-center justify-between",children:[$.jsxs("div",{className:"flex flex-row items-center space-x-4 text-sm font-bold text-brand-primary",children:[$.jsx("span",{className:"w-full",children:Zx(k.column.columnDef.header,k.getContext())}),k.column.columnDef.sortingFn&&$.jsx("span",{className:`px-2 ${k.column.getCanSort()?"cursor-pointer":""}`,onClick:async ae=>{await k.column.getToggleSortingHandler()(ae),te(k)},children:ee()})]}),k.id!=="select"&&$.jsx("div",{onMouseDown:k.getResizeHandler(),onTouchStart:k.getResizeHandler(),className:"w-3 h-full text-brand-gray cursor-col-resize",children:$.jsx(fW,{})})]})},`thead-th-${k.id}-${z}`)})}function _e(k){return k.id==="select"?50:k.getSize()}function De(k){return $.jsx("tr",{className:"mx-auto",children:k.headers.map(we)},`thead-tr-${k.id}`)}function Ye(k,z){return $.jsx("td",{className:"px-2 children:align-middle overflow-ellipsis whitespace-nowrap",children:Zx(k.column.columnDef.cell,k.getContext())},`tbody-td-${k.id}-${z}`)}function T(k,z){return $.jsxs(b.Fragment,{children:[$.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:k.getVisibleCells().map(Ye)},`tbody-tr-${k.id}-${z}`),k.getIsExpanded()?$.jsx("tr",{children:$.jsx("td",{colSpan:k.getVisibleCells().length,children:m({row:k})})}):null]},`tbody-fragmment-${k.id}-${z}`)}function _(k){w(Number(k.target.value)),be.setPageSize(Number(k.target.value))}function F(k){S(k)}function O(){E(0),X(0)}function y(){const k=U-1;E(k),X(k)}function H(){const k=U+1;E(k),X(k)}function q(){const k=Math.ceil(a/be.getState().pagination.pageSize)-1;E(k),X(k)}function oe(){return h(be.getSelectedRowModel().flatRows)}return b.useEffect(()=>{function k(){if(U===0){ce(!1);return}ce(!0)}function z(){if(U>=Math.ceil(a/be.getState().pagination.pageSize)-1){Xe(!1);return}Xe(!0)}k(),z()},[U]),$.jsxs("div",{className:"text-black dark:text-white",children:[r&&$.jsx(NX,{setFilter:F,placeholder:c}),n&&$.jsx("div",{className:"flex items-center justify-center mt-10",children:$.jsx(yx,{size:50,children:u})}),e.length===0&&!n&&$.jsx("p",{className:"text-sm text-center",children:l}),e.length>0&&!n&&$.jsx("div",{className:"flex justify-center items-center",children:$.jsx("div",{className:"overflow-x-auto",children:$.jsxs("table",{style:{width:be.getCenterTotalSize()},children:[$.jsx("thead",{children:be.getHeaderGroups().map(De)}),$.jsx("tbody",{className:"divide-y divide-brand-disabled",children:be.getRowModel().rows.map(T)})]})})}),$.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:[$.jsx("p",{children:f}),$.jsx("select",{className:rt("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:be.getState().pagination.pageSize,onChange:_,children:[5,10,25,50].map(k=>$.jsx("option",{value:k,children:k},`page-size-option-${k}`))}),$.jsxs("span",{children:[U+1," ",p," ",Math.ceil(a/be.getState().pagination.pageSize)]}),$.jsx("button",{onClick:O,disabled:!Q,className:"text-gray-500 disabled:text-gray-300 hover:text-gray-700",children:$.jsx(lW,{})}),$.jsx("button",{onClick:y,disabled:!Q,className:"text-gray-500 disabled:text-gray-300 hover:text-gray-700",children:$.jsx(sW,{})}),$.jsx("button",{onClick:H,disabled:!Oe,className:"text-gray-500 disabled:text-gray-300 hover:text-gray-700",children:$.jsx(uW,{})}),$.jsx("button",{onClick:q,disabled:!Oe,className:"text-gray-500 disabled:text-gray-300 hover:text-gray-700",children:$.jsx(cW,{})})]}),i&&h&&oe()]})}const kX=({children:e,tooltip:t})=>$.jsxs("div",{className:"relative inline-block group",children:[e,$.jsx("span",{className:`${rt("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})]}),GX=e=>$.jsx("svg",{width:"20",height:"14",viewBox:"0 0 20 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:$.jsx("path",{d:"M16.125 5.36665C15.8451 3.94808 15.0813 2.6707 13.9642 1.75268C12.8471 0.834674 11.4459 0.332986 10 0.333313C7.59167 0.333313 5.5 1.69998 4.45833 3.69998C3.23353 3.83234 2.10084 4.41265 1.27791 5.32941C0.454976 6.24617 -0.000143085 7.43471 3.3744e-08 8.66665C3.3744e-08 11.425 2.24167 13.6666 5 13.6666H15.8333C18.1333 13.6666 20 11.8 20 9.49998C20 7.29998 18.2917 5.51665 16.125 5.36665ZM11.6667 7.83331V11.1666H8.33333V7.83331H5.83333L10 3.66665L14.1667 7.83331H11.6667Z",fill:"#02C6F2"})}),jX=e=>$.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-8 text-center text-primary-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",...e,children:$.jsx("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),Pp=({Container:e,children:t,fileName:n,disabled:r,onChange:i,accept:a="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"})=>{const u=b.useRef(null),l=()=>{var f;return(f=u.current)==null?void 0:f.click()},c=f=>{const p=f.target;p.value=""};return $.jsxs($.Fragment,{children:[$.jsx(e,{type:"button",disabled:r,onClick:l,fileName:n,children:t}),$.jsx("input",{ref:u,type:"file",className:"hidden",accept:a,onClick:c,onChange:f=>{i(f.target.files[0])}})]})},HX=e=>$.jsx(Ls,{variant:"primary",...e}),WX=e=>$.jsx(Ls,{variant:"secondary",...e}),ZX=({children:e,disabled:t,fileName:n,...r})=>$.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:$.jsxs("div",{className:`flex ${n?"flex-row":"flex-col"} items-center justify-center`,children:[$.jsx("div",{children:n?$.jsx(jX,{className:"h-8 w-aut0 "}):$.jsx(GX,{})}),$.jsx("div",{children:$.jsx("span",{className:"w-full text-sm text-center text-gray-900 dark:text-brand-secondary-text",children:e})})]})}),XX={PrimaryButton:e=>$.jsx(Pp,{...e,Container:HX}),OutlineButton:e=>$.jsx(Pp,{...e,Container:WX}),BoxButton:e=>$.jsx(Pp,{...e,Container:ZX})};var Yu={exports:{}};/**
|
|
192
192
|
* @license
|
|
193
193
|
* Lodash <https://lodash.com/>
|