umwd-components 0.1.281 → 0.1.282

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.
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@mui/material/Box"),a=require("@mui/material/Table"),r=require("@mui/material/TableBody"),l=require("@mui/material/TableCell"),n=require("@mui/material/TableContainer"),i=require("@mui/material/TablePagination"),o=require("@mui/material/TableRow"),u=require("@mui/material/Paper"),c=require("@mui/material/FormControlLabel"),d=require("@mui/material/Switch"),s=require("./EnhancedTableHead.js"),m=require("./EnhancedTableToolbar.js"),g=require("./EnhancedTableRow.js"),b=require("next/navigation");function h(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}var p=h(e);exports.default=function(e){var h,v,f,S,P;const{data:w,meta:E,headCells:q,subHeadCells:C,withSelection:T,title:y,subTitle:j}=e,{replace:O}=b.useRouter(),x=b.usePathname(),R=b.useSearchParams(),[k,B]=p.useState("asc"),[H,z]=p.useState("id"),[D,L]=p.useState([]),[_,A]=p.useState(0),[F,I]=p.useState(!1),[M,N]=p.useState(5),U=_+1===(null==E||null===(h=E.pagination)||void 0===h?void 0:h.pageCount)?(null==E||null===(v=E.pagination)||void 0===v?void 0:v.total)-(null==E||null===(f=E.pagination)||void 0===f?void 0:f.pageCount)*M:0;return p.useEffect((()=>{if(R){const e=new URLSearchParams(R);k?e.set("order",k):e.delete("order"),H?e.set("orderBy",H):e.delete("orderBy"),_?e.set("page",_.toString()):e.delete("page"),M?e.set("rowsPerPage",M.toString()):e.delete("rowsPerPage"),O("".concat(x,"?").concat(e.toString()))}}),[k,H,_,M]),p.createElement(t,{sx:{width:"100%"}},p.createElement(u,{sx:{width:"100%",mb:2}},p.createElement(m.default,{numSelected:D.length,title:y}),p.createElement(n,null,p.createElement(a,{sx:{minWidth:750},"aria-labelledby":"tableTitle",size:F?"small":"medium"},p.createElement(s.default,{numSelected:D.length,order:k,orderBy:H,onSelectAllClick:e=>{if(e.target.checked){const e=w.map((e=>e.id));L(e)}else L([])},onRequestSort:(e,t)=>{B(H===t&&"asc"===k?"desc":"asc"),z(t)},rowCount:null==E||null===(S=E.pagination)||void 0===S?void 0:S.total,headCells:q,withSelection:T,withSubRows:C&&C.length>0}),p.createElement(r,null,w&&w.map(((e,t)=>{const a=(r=Number(e.id),-1!==D.indexOf(r));var r;return p.createElement(g.default,{key:"".concat((null==e?void 0:e.id)+t),row:e,headCells:q,subHeadCells:C,selected:a,subTitle:j})})),U>0&&p.createElement(o,{style:{height:(F?33:53)*U}},p.createElement(l,{colSpan:6}))))),p.createElement(i,{rowsPerPageOptions:[5,10,25],component:"div",count:null==E||null===(P=E.pagination)||void 0===P?void 0:P.total,rowsPerPage:M,page:_,onPageChange:(e,t)=>{A(t)},onRowsPerPageChange:e=>{N(parseInt(e.target.value,10)),A(0)}})),p.createElement(c,{control:p.createElement(d,{checked:F,onChange:e=>{I(e.target.checked)}}),label:"Dense padding"}))};
7
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@mui/material/Box"),a=require("@mui/material/Table"),l=require("@mui/material/TableBody"),r=require("@mui/material/TableCell"),i=require("@mui/material/TableContainer"),n=require("@mui/material/TablePagination"),o=require("@mui/material/TableRow"),u=require("@mui/material/Paper"),s=require("@mui/material/FormControlLabel"),d=require("@mui/material/Switch"),c=require("./EnhancedTableHead.js"),m=require("./EnhancedTableToolbar.js"),g=require("./EnhancedTableRow.js"),h=require("next/navigation");exports.default=function(b){var p,S,v,w,E;const{data:P,meta:q,headCells:C,subHeadCells:T,withSelection:f,title:x,subTitle:y}=b,{replace:R}=h.useRouter(),k=h.usePathname(),B=h.useSearchParams(),[j,H]=e.useState("asc"),[O,L]=e.useState("id"),[_,z]=e.useState([]),[A,D]=e.useState(0),[F,I]=e.useState(!1),[M,N]=e.useState(5),U=A+1===(null==q||null===(p=q.pagination)||void 0===p?void 0:p.pageCount)?(null==q||null===(S=q.pagination)||void 0===S?void 0:S.total)-(null==q||null===(v=q.pagination)||void 0===v?void 0:v.pageCount)*M:0;return e.useEffect((()=>{if(B){const e=new URLSearchParams(B);j?e.set("order",j):e.delete("order"),O?e.set("orderBy",O):e.delete("orderBy"),A?e.set("page",A.toString()):e.delete("page"),M?e.set("rowsPerPage",M.toString()):e.delete("rowsPerPage"),R("".concat(k,"?").concat(e.toString()))}}),[j,O,A,M]),e.createElement(t,{sx:{width:"100%"}},e.createElement(u,{sx:{width:"100%",mb:2}},e.createElement(m.default,{numSelected:_.length,title:x}),e.createElement(i,null,e.createElement(a,{sx:{minWidth:750},"aria-labelledby":"tableTitle",size:F?"small":"medium"},e.createElement(c.default,{numSelected:_.length,order:j,orderBy:O,onSelectAllClick:e=>{if(e.target.checked){const e=P.map((e=>e.id));z(e)}else z([])},onRequestSort:(e,t)=>{H(O===t&&"asc"===j?"desc":"asc"),L(t)},rowCount:null==q||null===(w=q.pagination)||void 0===w?void 0:w.total,headCells:C,withSelection:f,withSubRows:T&&T.length>0}),e.createElement(l,null,P&&P.map(((t,a)=>{const l=(r=Number(t.id),-1!==_.indexOf(r));var r;return e.createElement(g.default,{key:"".concat((null==t?void 0:t.id)+a),row:t,headCells:C,subHeadCells:T,selected:l,subTitle:y})})),U>0&&e.createElement(o,{style:{height:(F?33:53)*U}},e.createElement(r,{colSpan:6}))))),e.createElement(n,{rowsPerPageOptions:[5,10,25],component:"div",count:null==q||null===(E=q.pagination)||void 0===E?void 0:E.total,rowsPerPage:M,page:A,onPageChange:(e,t)=>{D(t)},onRowsPerPageChange:e=>{N(parseInt(e.target.value,10)),D(0)}})),e.createElement(s,{control:e.createElement(d,{checked:F,onChange:e=>{I(e.target.checked)}}),label:"Dense padding"}))};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("@mui/material/Box"),t=require("@mui/material/Checkbox"),l=require("@mui/material/TableCell"),a=require("@mui/material/TableHead"),i=require("@mui/material/TableRow"),n=require("@mui/material/TableSortLabel"),u=require("../../../../node_modules/@mui/utils/esm/visuallyHidden/visuallyHidden.js");function c(e){var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var l=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,l.get?l:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var o=c(e);exports.default=function(e){const{onSelectAllClick:c,order:d,orderBy:m,numSelected:s,rowCount:b,onRequestSort:f,headCells:p,withSelection:g,withSubRows:E}=e;return o.createElement(a,null,o.createElement(i,null,E&&o.createElement(l,null),g&&o.createElement(l,{padding:"checkbox"},o.createElement(t,{color:"primary",indeterminate:s>0&&s<b,checked:b>0&&s===b,onChange:c,inputProps:{"aria-label":"select all desserts"}})),p.map((e=>{return o.createElement(l,{key:e.id,align:e.numeric?"right":"left",padding:e.disablePadding?"none":"normal",sortDirection:m===e.id&&d},!1!==e.sortable?o.createElement(n,{active:m===e.id,direction:m===e.id?d:"asc",onClick:(t=e.id,e=>{f(e,t)})},e.label,m===e.id?o.createElement(r,{component:"span",sx:u.default},"desc"===d?"sorted descending":"sorted ascending"):null):o.createElement(o.Fragment,null,e.label));var t}))))};
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("@mui/material/Box"),l=require("@mui/material/Checkbox"),t=require("@mui/material/TableCell"),i=require("@mui/material/TableHead"),a=require("@mui/material/TableRow"),n=require("@mui/material/TableSortLabel"),d=require("../../../../node_modules/@mui/utils/esm/visuallyHidden/visuallyHidden.js");exports.default=function(u){const{onSelectAllClick:o,order:c,orderBy:m,numSelected:s,rowCount:b,onRequestSort:p,headCells:g,withSelection:q,withSubRows:E}=u;return e.createElement(i,null,e.createElement(a,null,E&&e.createElement(t,null),q&&e.createElement(t,{padding:"checkbox"},e.createElement(l,{color:"primary",indeterminate:s>0&&s<b,checked:b>0&&s===b,onChange:o,inputProps:{"aria-label":"select all desserts"}})),g.map((l=>{return e.createElement(t,{key:l.id,align:l.numeric?"right":"left",padding:l.disablePadding?"none":"normal",sortDirection:m===l.id&&c},!1!==l.sortable?e.createElement(n,{active:m===l.id,direction:m===l.id?c:"asc",onClick:(i=l.id,e=>{p(e,i)})},l.label,m===l.id?e.createElement(r,{component:"span",sx:d.default},"desc"===c?"sorted descending":"sorted ascending"):null):e.createElement(e.Fragment,null,l.label));var i}))))};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),l=require("@mui/material"),t=require("@mui/icons-material/KeyboardArrowUp"),a=require("@mui/icons-material/KeyboardArrowDown");function n(e){var l=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(l,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}})),l.default=e,Object.freeze(l)}var r=n(e);exports.default=function(e,n){const{row:i,headCells:o,subHeadCells:c,withSelection:m,selected:d,handleClick:u,subTitle:b}=e,{subRows:s}=i,[p,E]=r.useState(!1),g="enhanced-table-checkbox-".concat(n);return r.createElement(r.Fragment,null,r.createElement(l.TableRow,{sx:{"& > *":{borderBottom:"unset"}}},m&&r.createElement(l.TableCell,{padding:"checkbox"},r.createElement(l.Checkbox,{color:"primary",checked:d,inputProps:{"aria-labelledby":g}})),s&&c&&r.createElement(l.TableCell,null,r.createElement(l.IconButton,{"aria-label":"expand row",size:"small",onClick:()=>E(!p)},p?r.createElement(t,null):r.createElement(a,null))),o.map((e=>r.createElement(l.TableCell,{key:e.id,align:e.numeric?"right":"left",padding:e.disablePadding?"none":"normal"},i[e.id])))),s&&c&&r.createElement(l.TableRow,null,r.createElement(l.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:6},r.createElement(l.Collapse,{in:p,timeout:"auto",unmountOnExit:!0},r.createElement(l.Box,{sx:{margin:1}},r.createElement(l.Typography,{variant:"h6",gutterBottom:!0,component:"div"},b),r.createElement(l.Table,{size:"small","aria-label":"purchases"},r.createElement(l.TableHead,null,r.createElement(l.TableRow,null,c.map((e=>r.createElement(l.TableCell,{key:e.id,align:e.numeric?"right":"left",padding:e.disablePadding?"none":"normal"},e.label))))),r.createElement(l.TableBody,null,s.map((e=>r.createElement(l.TableRow,{key:e.key},c.map((t=>r.createElement(l.TableCell,{key:t.id,align:t.numeric?"right":"left",padding:t.disablePadding?"none":"normal"},e[t.id])))))))))))))};
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),a=require("@mui/material/Box"),l=require("@mui/material/TableRow"),r=require("@mui/material/TableCell"),t=require("@mui/material/IconButton"),i=require("@mui/material/Collapse"),n=require("@mui/material/Typography"),m=require("@mui/material/Table"),u=require("@mui/material/TableHead"),o=require("@mui/material/TableBody"),c=require("@mui/material/Checkbox"),d=require("@mui/icons-material/KeyboardArrowUp"),s=require("@mui/icons-material/KeyboardArrowDown");exports.default=function(p,b){const{row:E,headCells:g,subHeadCells:h,withSelection:y,selected:q,handleClick:k,subTitle:x}=p,{subRows:w}=E,[T,C]=e.useState(!1),f="enhanced-table-checkbox-".concat(b);return e.createElement(e.Fragment,null,e.createElement(l,{sx:{"& > *":{borderBottom:"unset"}}},y&&e.createElement(r,{padding:"checkbox"},e.createElement(c,{color:"primary",checked:q,inputProps:{"aria-labelledby":f}})),w&&h&&e.createElement(r,null,e.createElement(t,{"aria-label":"expand row",size:"small",onClick:()=>C(!T)},T?e.createElement(d,null):e.createElement(s,null))),g.map((a=>e.createElement(r,{key:a.id,align:a.numeric?"right":"left",padding:a.disablePadding?"none":"normal"},E[a.id])))),w&&h&&e.createElement(l,null,e.createElement(r,{style:{paddingBottom:0,paddingTop:0},colSpan:6},e.createElement(i,{in:T,timeout:"auto",unmountOnExit:!0},e.createElement(a,{sx:{margin:1}},e.createElement(n,{variant:"h6",gutterBottom:!0,component:"div"},x),e.createElement(m,{size:"small","aria-label":"purchases"},e.createElement(u,null,e.createElement(l,null,h.map((a=>e.createElement(r,{key:a.id,align:a.numeric?"right":"left",padding:a.disablePadding?"none":"normal"},a.label))))),e.createElement(o,null,w.map((a=>e.createElement(l,{key:a.key},h.map((l=>e.createElement(r,{key:l.id,align:l.numeric?"right":"left",padding:l.disablePadding?"none":"normal"},a[l.id])))))))))))))};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@mui/material/Toolbar"),r=require("@mui/material/Typography"),l=require("@mui/material/IconButton"),i=require("@mui/material/Tooltip"),a=require("@mui/icons-material/Delete"),n=require("@mui/icons-material/FilterList"),c=require("@mui/material/styles");function u(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var l=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,l.get?l:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var m=u(e);exports.default=function(e){const{title:u,numSelected:o}=e;return m.createElement(t,{sx:{pl:{sm:2},pr:{xs:1,sm:1},...o>0&&{bgcolor:e=>c.alpha(e.palette.primary.main,e.palette.action.activatedOpacity)}}},o>0?m.createElement(r,{sx:{flex:"1 1 100%"},color:"inherit",variant:"subtitle1",component:"div"},o," selected"):m.createElement(r,{sx:{flex:"1 1 100%"},variant:"h6",id:"tableTitle",component:"div"},u),o>0?m.createElement(i,{title:"Delete"},m.createElement(l,null,m.createElement(a,null))):m.createElement(i,{title:"Filter list"},m.createElement(l,null,m.createElement(n,null))))};
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@mui/material/Toolbar"),r=require("@mui/material/Typography"),l=require("@mui/material/IconButton"),i=require("@mui/material/Tooltip"),a=require("@mui/icons-material/Delete"),n=require("@mui/icons-material/FilterList"),m=require("@mui/material/styles");exports.default=function(u){const{title:c,numSelected:o}=u;return e.createElement(t,{sx:{pl:{sm:2},pr:{xs:1,sm:1},...o>0&&{bgcolor:e=>m.alpha(e.palette.primary.main,e.palette.action.activatedOpacity)}}},o>0?e.createElement(r,{sx:{flex:"1 1 100%"},color:"inherit",variant:"subtitle1",component:"div"},o," selected"):e.createElement(r,{sx:{flex:"1 1 100%"},variant:"h6",id:"tableTitle",component:"div"},c),o>0?e.createElement(i,{title:"Delete"},e.createElement(l,null,e.createElement(a,null))):e.createElement(i,{title:"Filter list"},e.createElement(l,null,e.createElement(n,null))))};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import*as e from"react";import t from"@mui/material/Box";import a from"@mui/material/Table";import l from"@mui/material/TableBody";import o from"@mui/material/TableCell";import r from"@mui/material/TableContainer";import i from"@mui/material/TablePagination";import n from"@mui/material/TableRow";import m from"@mui/material/Paper";import c from"@mui/material/FormControlLabel";import d from"@mui/material/Switch";import s from"./EnhancedTableHead.js";import u from"./EnhancedTableToolbar.js";import p from"./EnhancedTableRow.js";import{useRouter as g,usePathname as h,useSearchParams as b}from"next/navigation";function f(f){var S,w,E,v,C;const{data:P,meta:T,headCells:x,subHeadCells:y,withSelection:R,title:k,subTitle:B}=f,{replace:j}=g(),H=h(),L=b(),[O,q]=e.useState("asc"),[z,A]=e.useState("id"),[D,F]=e.useState([]),[I,N]=e.useState(0),[U,W]=e.useState(!1),[G,J]=e.useState(5),K=I+1===(null==T||null===(S=T.pagination)||void 0===S?void 0:S.pageCount)?(null==T||null===(w=T.pagination)||void 0===w?void 0:w.total)-(null==T||null===(E=T.pagination)||void 0===E?void 0:E.pageCount)*G:0;return e.useEffect((()=>{if(L){const e=new URLSearchParams(L);O?e.set("order",O):e.delete("order"),z?e.set("orderBy",z):e.delete("orderBy"),I?e.set("page",I.toString()):e.delete("page"),G?e.set("rowsPerPage",G.toString()):e.delete("rowsPerPage"),j("".concat(H,"?").concat(e.toString()))}}),[O,z,I,G]),e.createElement(t,{sx:{width:"100%"}},e.createElement(m,{sx:{width:"100%",mb:2}},e.createElement(u,{numSelected:D.length,title:k}),e.createElement(r,null,e.createElement(a,{sx:{minWidth:750},"aria-labelledby":"tableTitle",size:U?"small":"medium"},e.createElement(s,{numSelected:D.length,order:O,orderBy:z,onSelectAllClick:e=>{if(e.target.checked){const e=P.map((e=>e.id));F(e)}else F([])},onRequestSort:(e,t)=>{q(z===t&&"asc"===O?"desc":"asc"),A(t)},rowCount:null==T||null===(v=T.pagination)||void 0===v?void 0:v.total,headCells:x,withSelection:R,withSubRows:y&&y.length>0}),e.createElement(l,null,P&&P.map(((t,a)=>{const l=(o=Number(t.id),-1!==D.indexOf(o));var o;return e.createElement(p,{key:"".concat((null==t?void 0:t.id)+a),row:t,headCells:x,subHeadCells:y,selected:l,subTitle:B})})),K>0&&e.createElement(n,{style:{height:(U?33:53)*K}},e.createElement(o,{colSpan:6}))))),e.createElement(i,{rowsPerPageOptions:[5,10,25],component:"div",count:null==T||null===(C=T.pagination)||void 0===C?void 0:C.total,rowsPerPage:G,page:I,onPageChange:(e,t)=>{N(t)},onRowsPerPageChange:e=>{J(parseInt(e.target.value,10)),N(0)}})),e.createElement(c,{control:e.createElement(d,{checked:U,onChange:e=>{W(e.target.checked)}}),label:"Dense padding"}))}export{f as default};
7
+ import e,{useState as t,useEffect as a}from"react";import l from"@mui/material/Box";import o from"@mui/material/Table";import r from"@mui/material/TableBody";import i from"@mui/material/TableCell";import n from"@mui/material/TableContainer";import m from"@mui/material/TablePagination";import d from"@mui/material/TableRow";import c from"@mui/material/Paper";import s from"@mui/material/FormControlLabel";import u from"@mui/material/Switch";import p from"./EnhancedTableHead.js";import g from"./EnhancedTableToolbar.js";import h from"./EnhancedTableRow.js";import{useRouter as b,usePathname as f,useSearchParams as w}from"next/navigation";function v(v){var E,C,P,S,T;const{data:x,meta:y,headCells:R,subHeadCells:k,withSelection:B,title:j,subTitle:H}=v,{replace:L}=b(),O=f(),q=w(),[z,A]=t("asc"),[D,F]=t("id"),[I,N]=t([]),[U,W]=t(0),[G,J]=t(!1),[K,M]=t(5),Q=U+1===(null==y||null===(E=y.pagination)||void 0===E?void 0:E.pageCount)?(null==y||null===(C=y.pagination)||void 0===C?void 0:C.total)-(null==y||null===(P=y.pagination)||void 0===P?void 0:P.pageCount)*K:0;return a((()=>{if(q){const e=new URLSearchParams(q);z?e.set("order",z):e.delete("order"),D?e.set("orderBy",D):e.delete("orderBy"),U?e.set("page",U.toString()):e.delete("page"),K?e.set("rowsPerPage",K.toString()):e.delete("rowsPerPage"),L("".concat(O,"?").concat(e.toString()))}}),[z,D,U,K]),e.createElement(l,{sx:{width:"100%"}},e.createElement(c,{sx:{width:"100%",mb:2}},e.createElement(g,{numSelected:I.length,title:j}),e.createElement(n,null,e.createElement(o,{sx:{minWidth:750},"aria-labelledby":"tableTitle",size:G?"small":"medium"},e.createElement(p,{numSelected:I.length,order:z,orderBy:D,onSelectAllClick:e=>{if(e.target.checked){const e=x.map((e=>e.id));N(e)}else N([])},onRequestSort:(e,t)=>{A(D===t&&"asc"===z?"desc":"asc"),F(t)},rowCount:null==y||null===(S=y.pagination)||void 0===S?void 0:S.total,headCells:R,withSelection:B,withSubRows:k&&k.length>0}),e.createElement(r,null,x&&x.map(((t,a)=>{const l=(o=Number(t.id),-1!==I.indexOf(o));var o;return e.createElement(h,{key:"".concat((null==t?void 0:t.id)+a),row:t,headCells:R,subHeadCells:k,selected:l,subTitle:H})})),Q>0&&e.createElement(d,{style:{height:(G?33:53)*Q}},e.createElement(i,{colSpan:6}))))),e.createElement(m,{rowsPerPageOptions:[5,10,25],component:"div",count:null==y||null===(T=y.pagination)||void 0===T?void 0:T.total,rowsPerPage:K,page:U,onPageChange:(e,t)=>{W(t)},onRowsPerPageChange:e=>{M(parseInt(e.target.value,10)),W(0)}})),e.createElement(s,{control:e.createElement(u,{checked:G,onChange:e=>{J(e.target.checked)}}),label:"Dense padding"}))}export{v as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import*as e from"react";import t from"@mui/material/Box";import l from"@mui/material/Checkbox";import r from"@mui/material/TableCell";import a from"@mui/material/TableHead";import i from"@mui/material/TableRow";import n from"@mui/material/TableSortLabel";import o from"../../../../node_modules/@mui/utils/esm/visuallyHidden/visuallyHidden.js";function m(m){const{onSelectAllClick:d,order:c,orderBy:s,numSelected:u,rowCount:p,onRequestSort:b,headCells:f,withSelection:g,withSubRows:E}=m;return e.createElement(a,null,e.createElement(i,null,E&&e.createElement(r,null),g&&e.createElement(r,{padding:"checkbox"},e.createElement(l,{color:"primary",indeterminate:u>0&&u<p,checked:p>0&&u===p,onChange:d,inputProps:{"aria-label":"select all desserts"}})),f.map((l=>{return e.createElement(r,{key:l.id,align:l.numeric?"right":"left",padding:l.disablePadding?"none":"normal",sortDirection:s===l.id&&c},!1!==l.sortable?e.createElement(n,{active:s===l.id,direction:s===l.id?c:"asc",onClick:(a=l.id,e=>{b(e,a)})},l.label,s===l.id?e.createElement(t,{component:"span",sx:o},"desc"===c?"sorted descending":"sorted ascending"):null):e.createElement(e.Fragment,null,l.label));var a}))))}export{m as default};
6
+ import e from"react";import t from"@mui/material/Box";import l from"@mui/material/Checkbox";import r from"@mui/material/TableCell";import i from"@mui/material/TableHead";import a from"@mui/material/TableRow";import n from"@mui/material/TableSortLabel";import o from"../../../../node_modules/@mui/utils/esm/visuallyHidden/visuallyHidden.js";function m(m){const{onSelectAllClick:d,order:c,orderBy:s,numSelected:u,rowCount:p,onRequestSort:b,headCells:f,withSelection:g,withSubRows:E}=m;return e.createElement(i,null,e.createElement(a,null,E&&e.createElement(r,null),g&&e.createElement(r,{padding:"checkbox"},e.createElement(l,{color:"primary",indeterminate:u>0&&u<p,checked:p>0&&u===p,onChange:d,inputProps:{"aria-label":"select all desserts"}})),f.map((l=>{return e.createElement(r,{key:l.id,align:l.numeric?"right":"left",padding:l.disablePadding?"none":"normal",sortDirection:s===l.id&&c},!1!==l.sortable?e.createElement(n,{active:s===l.id,direction:s===l.id?c:"asc",onClick:(i=l.id,e=>{b(e,i)})},l.label,s===l.id?e.createElement(t,{component:"span",sx:o},"desc"===c?"sorted descending":"sorted ascending"):null):e.createElement(e.Fragment,null,l.label));var i}))))}export{m as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import*as e from"react";import{TableRow as t,TableCell as a,Checkbox as l,IconButton as n,Collapse as r,Box as i,Typography as m,Table as o,TableHead as c,TableBody as d}from"@mui/material";import u from"@mui/icons-material/KeyboardArrowUp";import s from"@mui/icons-material/KeyboardArrowDown";function p(p,E){const{row:g,headCells:b,subHeadCells:h,withSelection:k,selected:y,handleClick:f,subTitle:w}=p,{subRows:x}=g,[C,P]=e.useState(!1),B="enhanced-table-checkbox-".concat(E);return e.createElement(e.Fragment,null,e.createElement(t,{sx:{"& > *":{borderBottom:"unset"}}},k&&e.createElement(a,{padding:"checkbox"},e.createElement(l,{color:"primary",checked:y,inputProps:{"aria-labelledby":B}})),x&&h&&e.createElement(a,null,e.createElement(n,{"aria-label":"expand row",size:"small",onClick:()=>P(!C)},C?e.createElement(u,null):e.createElement(s,null))),b.map((t=>e.createElement(a,{key:t.id,align:t.numeric?"right":"left",padding:t.disablePadding?"none":"normal"},g[t.id])))),x&&h&&e.createElement(t,null,e.createElement(a,{style:{paddingBottom:0,paddingTop:0},colSpan:6},e.createElement(r,{in:C,timeout:"auto",unmountOnExit:!0},e.createElement(i,{sx:{margin:1}},e.createElement(m,{variant:"h6",gutterBottom:!0,component:"div"},w),e.createElement(o,{size:"small","aria-label":"purchases"},e.createElement(c,null,e.createElement(t,null,h.map((t=>e.createElement(a,{key:t.id,align:t.numeric?"right":"left",padding:t.disablePadding?"none":"normal"},t.label))))),e.createElement(d,null,x.map((l=>e.createElement(t,{key:l.key},h.map((t=>e.createElement(a,{key:t.id,align:t.numeric?"right":"left",padding:t.disablePadding?"none":"normal"},l[t.id])))))))))))))}export{p as default};
6
+ import e,{Fragment as a}from"react";import t from"@mui/material/Box";import l from"@mui/material/TableRow";import r from"@mui/material/TableCell";import m from"@mui/material/IconButton";import i from"@mui/material/Collapse";import n from"@mui/material/Typography";import o from"@mui/material/Table";import c from"@mui/material/TableHead";import d from"@mui/material/TableBody";import u from"@mui/material/Checkbox";import p from"@mui/icons-material/KeyboardArrowUp";import s from"@mui/icons-material/KeyboardArrowDown";function b(b,E){const{row:f,headCells:g,subHeadCells:h,withSelection:y,selected:k,handleClick:x,subTitle:w}=b,{subRows:T}=f,[C,B]=e.useState(!1),P="enhanced-table-checkbox-".concat(E);return e.createElement(a,null,e.createElement(l,{sx:{"& > *":{borderBottom:"unset"}}},y&&e.createElement(r,{padding:"checkbox"},e.createElement(u,{color:"primary",checked:k,inputProps:{"aria-labelledby":P}})),T&&h&&e.createElement(r,null,e.createElement(m,{"aria-label":"expand row",size:"small",onClick:()=>B(!C)},C?e.createElement(p,null):e.createElement(s,null))),g.map((a=>e.createElement(r,{key:a.id,align:a.numeric?"right":"left",padding:a.disablePadding?"none":"normal"},f[a.id])))),T&&h&&e.createElement(l,null,e.createElement(r,{style:{paddingBottom:0,paddingTop:0},colSpan:6},e.createElement(i,{in:C,timeout:"auto",unmountOnExit:!0},e.createElement(t,{sx:{margin:1}},e.createElement(n,{variant:"h6",gutterBottom:!0,component:"div"},w),e.createElement(o,{size:"small","aria-label":"purchases"},e.createElement(c,null,e.createElement(l,null,h.map((a=>e.createElement(r,{key:a.id,align:a.numeric?"right":"left",padding:a.disablePadding?"none":"normal"},a.label))))),e.createElement(d,null,T.map((a=>e.createElement(l,{key:a.key},h.map((t=>e.createElement(r,{key:t.id,align:t.numeric?"right":"left",padding:t.disablePadding?"none":"normal"},a[t.id])))))))))))))}export{b as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import*as e from"react";import t from"@mui/material/Toolbar";import l from"@mui/material/Typography";import r from"@mui/material/IconButton";import i from"@mui/material/Tooltip";import m from"@mui/icons-material/Delete";import a from"@mui/icons-material/FilterList";import{alpha as o}from"@mui/material/styles";function n(n){const{title:c,numSelected:p}=n;return e.createElement(t,{sx:{pl:{sm:2},pr:{xs:1,sm:1},...p>0&&{bgcolor:e=>o(e.palette.primary.main,e.palette.action.activatedOpacity)}}},p>0?e.createElement(l,{sx:{flex:"1 1 100%"},color:"inherit",variant:"subtitle1",component:"div"},p," selected"):e.createElement(l,{sx:{flex:"1 1 100%"},variant:"h6",id:"tableTitle",component:"div"},c),p>0?e.createElement(i,{title:"Delete"},e.createElement(r,null,e.createElement(m,null))):e.createElement(i,{title:"Filter list"},e.createElement(r,null,e.createElement(a,null))))}export{n as default};
6
+ import e from"react";import t from"@mui/material/Toolbar";import l from"@mui/material/Typography";import r from"@mui/material/IconButton";import i from"@mui/material/Tooltip";import m from"@mui/icons-material/Delete";import a from"@mui/icons-material/FilterList";import{alpha as o}from"@mui/material/styles";function n(n){const{title:c,numSelected:p}=n;return e.createElement(t,{sx:{pl:{sm:2},pr:{xs:1,sm:1},...p>0&&{bgcolor:e=>o(e.palette.primary.main,e.palette.action.activatedOpacity)}}},p>0?e.createElement(l,{sx:{flex:"1 1 100%"},color:"inherit",variant:"subtitle1",component:"div"},p," selected"):e.createElement(l,{sx:{flex:"1 1 100%"},variant:"h6",id:"tableTitle",component:"div"},c),p>0?e.createElement(i,{title:"Delete"},e.createElement(r,null,e.createElement(m,null))):e.createElement(i,{title:"Filter list"},e.createElement(r,null,e.createElement(a,null))))}export{n as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.281",
3
+ "version": "0.1.282",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/cjs/src/index.js",
6
6
  "module": "dist/esm/src/index.js",
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import * as React from "react";
3
+ import React, { useState, useEffect } from "react";
4
4
  import Box from "@mui/material/Box";
5
5
  import Table from "@mui/material/Table";
6
6
  import TableBody from "@mui/material/TableBody";
@@ -18,7 +18,7 @@ import EnhancedTableRow from "./EnhancedTableRow.tsx";
18
18
  import { usePathname, useRouter, useSearchParams } from "next/navigation";
19
19
  import { EnhancedTableProps } from "./types";
20
20
 
21
- export default function EnhancedTable(props: EnhancedTableProps) {
21
+ function EnhancedTable(props: EnhancedTableProps) {
22
22
  const {
23
23
  data,
24
24
  meta,
@@ -33,12 +33,12 @@ export default function EnhancedTable(props: EnhancedTableProps) {
33
33
  const pathname = usePathname();
34
34
  const searchParams = useSearchParams();
35
35
 
36
- const [order, setOrder] = React.useState<Order>("asc");
37
- const [orderBy, setOrderBy] = React.useState<string>("id");
38
- const [selected, setSelected] = React.useState<readonly number[]>([]);
39
- const [page, setPage] = React.useState(0);
40
- const [dense, setDense] = React.useState(false);
41
- const [rowsPerPage, setRowsPerPage] = React.useState(5);
36
+ const [order, setOrder] = useState<Order>("asc");
37
+ const [orderBy, setOrderBy] = useState<string>("id");
38
+ const [selected, setSelected] = useState<readonly number[]>([]);
39
+ const [page, setPage] = useState(0);
40
+ const [dense, setDense] = useState(false);
41
+ const [rowsPerPage, setRowsPerPage] = useState(5);
42
42
 
43
43
  const handleRequestSort = (
44
44
  event: React.MouseEvent<unknown>,
@@ -100,7 +100,7 @@ export default function EnhancedTable(props: EnhancedTableProps) {
100
100
  ? meta?.pagination?.total - meta?.pagination?.pageCount * rowsPerPage
101
101
  : 0;
102
102
 
103
- React.useEffect(() => {
103
+ useEffect(() => {
104
104
  if (searchParams) {
105
105
  const params = new URLSearchParams(searchParams);
106
106
  if (order) {
@@ -194,3 +194,5 @@ export default function EnhancedTable(props: EnhancedTableProps) {
194
194
  </Box>
195
195
  );
196
196
  }
197
+
198
+ export default EnhancedTable;
@@ -1,14 +1,15 @@
1
- import * as React from "react";
1
+ import React from "react";
2
2
  import Box from "@mui/material/Box";
3
3
  import Checkbox from "@mui/material/Checkbox";
4
4
  import TableCell from "@mui/material/TableCell";
5
5
  import TableHead from "@mui/material/TableHead";
6
6
  import TableRow from "@mui/material/TableRow";
7
7
  import TableSortLabel from "@mui/material/TableSortLabel";
8
+ // import { visuallyHidden } from "@mui/utils";
8
9
  import { visuallyHidden } from "@mui/utils";
9
10
  import { EnhancedTableHeadProps } from "./types";
10
11
 
11
- export default function EnhancedTableHead(props: EnhancedTableHeadProps) {
12
+ function EnhancedTableHead(props: EnhancedTableHeadProps) {
12
13
  const {
13
14
  onSelectAllClick,
14
15
  order,
@@ -74,3 +75,5 @@ export default function EnhancedTableHead(props: EnhancedTableHeadProps) {
74
75
  </TableHead>
75
76
  );
76
77
  }
78
+
79
+ export default EnhancedTableHead;
@@ -1,24 +1,19 @@
1
- import * as React from "react";
2
- import {
3
- Box,
4
- TableRow,
5
- TableCell,
6
- IconButton,
7
- Collapse,
8
- Typography,
9
- Table,
10
- TableHead,
11
- TableBody,
12
- Checkbox,
13
- } from "@mui/material";
1
+ import React, { Fragment } from "react";
2
+ import Box from "@mui/material/Box";
3
+ import TableRow from "@mui/material/TableRow";
4
+ import TableCell from "@mui/material/TableCell";
5
+ import IconButton from "@mui/material/IconButton";
6
+ import Collapse from "@mui/material/Collapse";
7
+ import Typography from "@mui/material/Typography";
8
+ import Table from "@mui/material/Table";
9
+ import TableHead from "@mui/material/TableHead";
10
+ import TableBody from "@mui/material/TableBody";
11
+ import Checkbox from "@mui/material/Checkbox";
14
12
  import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
15
13
  import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
16
14
  import { EnhancedTableRowProps } from "./types";
17
15
 
18
- export default function EnhancedTableRow(
19
- props: EnhancedTableRowProps,
20
- index: number
21
- ) {
16
+ function EnhancedTableRow(props: EnhancedTableRowProps, index: number) {
22
17
  const {
23
18
  row,
24
19
  headCells,
@@ -36,7 +31,7 @@ export default function EnhancedTableRow(
36
31
  const labelId = `enhanced-table-checkbox-${index}`;
37
32
 
38
33
  return (
39
- <React.Fragment>
34
+ <Fragment>
40
35
  <TableRow sx={{ "& > *": { borderBottom: "unset" } }}>
41
36
  {withSelection && (
42
37
  <TableCell padding="checkbox">
@@ -113,6 +108,8 @@ export default function EnhancedTableRow(
113
108
  </TableCell>
114
109
  </TableRow>
115
110
  )}
116
- </React.Fragment>
111
+ </Fragment>
117
112
  );
118
113
  }
114
+
115
+ export default EnhancedTableRow;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import React from "react";
2
2
  import Toolbar from "@mui/material/Toolbar";
3
3
  import Typography from "@mui/material/Typography";
4
4
  import IconButton from "@mui/material/IconButton";
@@ -8,7 +8,7 @@ import FilterListIcon from "@mui/icons-material/FilterList";
8
8
  import { alpha } from "@mui/material/styles";
9
9
  import { EnhancedTableToolbarProps } from "./types";
10
10
 
11
- export default function EnhancedTableToolbar(props: EnhancedTableToolbarProps) {
11
+ function EnhancedTableToolbar(props: EnhancedTableToolbarProps) {
12
12
  const { title, numSelected } = props;
13
13
 
14
14
  return (
@@ -60,3 +60,5 @@ export default function EnhancedTableToolbar(props: EnhancedTableToolbarProps) {
60
60
  </Toolbar>
61
61
  );
62
62
  }
63
+
64
+ export default EnhancedTableToolbar;