@umami/react-zen 0.154.0 → 0.156.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.js CHANGED
@@ -30853,19 +30853,22 @@ function DataTable({ data = [], className, children, ...props }) {
30853
30853
  const items = data.length && data?.[0]?.id === void 0 ? data.map((row, id) => ({ ...row, id })) : data;
30854
30854
  const widths = [];
30855
30855
  const columns = import_react178.Children.map(children, (child) => {
30856
- widths.push(child?.props?.width || "1fr");
30857
- return { ...child.props };
30858
- });
30856
+ if (child) {
30857
+ widths.push(child?.props?.width || "1fr");
30858
+ return { ...child?.props };
30859
+ }
30860
+ return null;
30861
+ })?.filter((n) => n);
30859
30862
  const gridTemplateColumns2 = widths.join(" ");
30860
30863
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Table2, { ...props, className: (0, import_classnames25.default)(DataTable_default.datatable, className), children: [
30861
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns.filter((n) => n).map(({ id, label, as, hidden, width, ...columnProps }) => {
30864
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns?.map(({ id, label, as, hidden, width, ...columnProps }) => {
30862
30865
  if (hidden) {
30863
30866
  return null;
30864
30867
  }
30865
30868
  return /* @__PURE__ */ (0, import_react179.createElement)(TableColumn, { ...columnProps, key: id, id }, label);
30866
30869
  }) }),
30867
30870
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableBody, { children: items.map((row, index) => {
30868
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableRow, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns.map(({ id, as, hidden, className: className2, children: children2, ...cellProps }) => {
30871
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableRow, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns?.map(({ id, as, hidden, className: className2, children: children2, ...cellProps }) => {
30869
30872
  if (hidden) {
30870
30873
  return null;
30871
30874
  }
@@ -31465,7 +31468,7 @@ function NavMenu({
31465
31468
  }
31466
31469
  function NavMenuGroup({
31467
31470
  title,
31468
- allowMinimize,
31471
+ allowMinimize = true,
31469
31472
  isMinimized,
31470
31473
  className,
31471
31474
  children,
@@ -31473,22 +31476,30 @@ function NavMenuGroup({
31473
31476
  ...props
31474
31477
  }) {
31475
31478
  const [minimized, setMinimized] = (0, import_react185.useState)(!!isMinimized);
31476
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Column, { ...props, gap, className: (0, import_classnames38.default)(className, minimized && NavMenu_default.minimized), children: [
31477
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
31478
- Row,
31479
- {
31480
- className: NavMenu_default.item,
31481
- alignItems: "center",
31482
- justifyContent: "space-between",
31483
- onClick: () => setMinimized(!minimized),
31484
- children: [
31485
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Text, { className: NavMenu_default.title, children: title }),
31486
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Icon2, { rotate: minimized ? 0 : 90, color: "muted", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ChevronRight, {}) })
31487
- ]
31488
- }
31489
- ),
31490
- !minimized && children
31491
- ] });
31479
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
31480
+ Column,
31481
+ {
31482
+ ...props,
31483
+ gap,
31484
+ className: (0, import_classnames38.default)(className, allowMinimize && minimized && NavMenu_default.minimized),
31485
+ children: [
31486
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
31487
+ Row,
31488
+ {
31489
+ className: NavMenu_default.item,
31490
+ alignItems: "center",
31491
+ justifyContent: "space-between",
31492
+ onClick: () => setMinimized(!minimized),
31493
+ children: [
31494
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Text, { className: NavMenu_default.title, children: title }),
31495
+ allowMinimize && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Icon2, { rotate: minimized ? 0 : 90, color: "muted", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ChevronRight, {}) })
31496
+ ]
31497
+ }
31498
+ ),
31499
+ !minimized && children
31500
+ ]
31501
+ }
31502
+ );
31492
31503
  }
31493
31504
  function NavMenuItem({ isSelected, className, children, ...props }) {
31494
31505
  const { itemBackgroundColor } = (0, import_react185.useContext)(NavMenuContext);
package/dist/index.mjs CHANGED
@@ -30737,19 +30737,22 @@ function DataTable({ data = [], className, children, ...props }) {
30737
30737
  const items = data.length && data?.[0]?.id === void 0 ? data.map((row, id) => ({ ...row, id })) : data;
30738
30738
  const widths = [];
30739
30739
  const columns = Children2.map(children, (child) => {
30740
- widths.push(child?.props?.width || "1fr");
30741
- return { ...child.props };
30742
- });
30740
+ if (child) {
30741
+ widths.push(child?.props?.width || "1fr");
30742
+ return { ...child?.props };
30743
+ }
30744
+ return null;
30745
+ })?.filter((n) => n);
30743
30746
  const gridTemplateColumns2 = widths.join(" ");
30744
30747
  return /* @__PURE__ */ jsxs20(Table2, { ...props, className: (0, import_classnames25.default)(DataTable_default.datatable, className), children: [
30745
- /* @__PURE__ */ jsx39(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns.filter((n) => n).map(({ id, label, as, hidden, width, ...columnProps }) => {
30748
+ /* @__PURE__ */ jsx39(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns?.map(({ id, label, as, hidden, width, ...columnProps }) => {
30746
30749
  if (hidden) {
30747
30750
  return null;
30748
30751
  }
30749
30752
  return /* @__PURE__ */ createElement8(TableColumn, { ...columnProps, key: id, id }, label);
30750
30753
  }) }),
30751
30754
  /* @__PURE__ */ jsx39(TableBody, { children: items.map((row, index) => {
30752
- return /* @__PURE__ */ jsx39(TableRow, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns.map(({ id, as, hidden, className: className2, children: children2, ...cellProps }) => {
30755
+ return /* @__PURE__ */ jsx39(TableRow, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns?.map(({ id, as, hidden, className: className2, children: children2, ...cellProps }) => {
30753
30756
  if (hidden) {
30754
30757
  return null;
30755
30758
  }
@@ -31353,7 +31356,7 @@ function NavMenu({
31353
31356
  }
31354
31357
  function NavMenuGroup({
31355
31358
  title,
31356
- allowMinimize,
31359
+ allowMinimize = true,
31357
31360
  isMinimized,
31358
31361
  className,
31359
31362
  children,
@@ -31361,22 +31364,30 @@ function NavMenuGroup({
31361
31364
  ...props
31362
31365
  }) {
31363
31366
  const [minimized, setMinimized] = useState15(!!isMinimized);
31364
- return /* @__PURE__ */ jsxs29(Column, { ...props, gap, className: (0, import_classnames38.default)(className, minimized && NavMenu_default.minimized), children: [
31365
- /* @__PURE__ */ jsxs29(
31366
- Row,
31367
- {
31368
- className: NavMenu_default.item,
31369
- alignItems: "center",
31370
- justifyContent: "space-between",
31371
- onClick: () => setMinimized(!minimized),
31372
- children: [
31373
- /* @__PURE__ */ jsx53(Text, { className: NavMenu_default.title, children: title }),
31374
- /* @__PURE__ */ jsx53(Icon2, { rotate: minimized ? 0 : 90, color: "muted", children: /* @__PURE__ */ jsx53(ChevronRight, {}) })
31375
- ]
31376
- }
31377
- ),
31378
- !minimized && children
31379
- ] });
31367
+ return /* @__PURE__ */ jsxs29(
31368
+ Column,
31369
+ {
31370
+ ...props,
31371
+ gap,
31372
+ className: (0, import_classnames38.default)(className, allowMinimize && minimized && NavMenu_default.minimized),
31373
+ children: [
31374
+ /* @__PURE__ */ jsxs29(
31375
+ Row,
31376
+ {
31377
+ className: NavMenu_default.item,
31378
+ alignItems: "center",
31379
+ justifyContent: "space-between",
31380
+ onClick: () => setMinimized(!minimized),
31381
+ children: [
31382
+ /* @__PURE__ */ jsx53(Text, { className: NavMenu_default.title, children: title }),
31383
+ allowMinimize && /* @__PURE__ */ jsx53(Icon2, { rotate: minimized ? 0 : 90, color: "muted", children: /* @__PURE__ */ jsx53(ChevronRight, {}) })
31384
+ ]
31385
+ }
31386
+ ),
31387
+ !minimized && children
31388
+ ]
31389
+ }
31390
+ );
31380
31391
  }
31381
31392
  function NavMenuItem({ isSelected, className, children, ...props }) {
31382
31393
  const { itemBackgroundColor } = useContext6(NavMenuContext);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umami/react-zen",
3
- "version": "0.154.0",
3
+ "version": "0.156.0",
4
4
  "description": "Modern, minimalist React component library",
5
5
  "author": "Umami <hello@umami.is>",
6
6
  "license": "MIT",