@bwp-web/components 0.13.4 → 0.13.6

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
@@ -467,6 +467,7 @@ function BiampLayout({
467
467
  import {
468
468
  Box as Box4,
469
469
  Checkbox,
470
+ IconButton,
470
471
  Table as MuiTable,
471
472
  TableBody,
472
473
  TableCell,
@@ -476,6 +477,7 @@ import {
476
477
  TableSortLabel
477
478
  } from "@mui/material";
478
479
  import {
480
+ ChevronDownIcon,
479
481
  ChevronRightIcon,
480
482
  DropdownChevronDownIcon,
481
483
  DropdownChevronUpIcon
@@ -566,6 +568,7 @@ function BiampTableTruncatedCell({
566
568
  children: /* @__PURE__ */ jsx7(
567
569
  Box3,
568
570
  {
571
+ "data-truncate": true,
569
572
  ref: textRef,
570
573
  onMouseEnter: handleMouseEnter,
571
574
  onMouseLeave: handleMouseLeave,
@@ -645,7 +648,11 @@ function cellSx(sticky, minWidth, zIndex) {
645
648
  };
646
649
  }
647
650
  const mw = minWidth ?? 40;
648
- return { minWidth: mw, maxWidth: mw };
651
+ return {
652
+ minWidth: mw,
653
+ whiteSpace: "nowrap",
654
+ "&:has([data-truncate])": { maxWidth: mw, whiteSpace: "normal" }
655
+ };
649
656
  }
650
657
  var rowCursorPointerSx = { cursor: "pointer" };
651
658
  var selectionCellSx = {
@@ -659,25 +666,9 @@ var checkboxHiddenSx = { visibility: "hidden" };
659
666
  var expandCellBaseSx = {
660
667
  display: "flex",
661
668
  alignItems: "center",
662
- gap: 1
663
- };
664
- var chevronExpandedSx = {
665
- color: ({ palette }) => palette.text.secondary,
666
- transition: "transform 150ms ease",
667
- transform: "rotate(90deg)",
668
- width: 16,
669
- height: 16,
670
- cursor: "pointer"
671
- };
672
- var chevronCollapsedSx = {
673
- color: ({ palette }) => palette.text.secondary,
674
- transition: "transform 150ms ease",
675
- transform: "rotate(0deg)",
676
- width: 16,
677
- height: 16,
678
- cursor: "pointer"
669
+ gap: "2px"
679
670
  };
680
- var expandPlaceholderSx = { width: 16 };
671
+ var expandPlaceholderSx = { width: 28 };
681
672
  var headerSelectionCellSx = {
682
673
  position: "sticky",
683
674
  left: 0,
@@ -687,6 +678,8 @@ var headerSelectionCellSx = {
687
678
  var checkboxHiddenHeaderSx = { visibility: "hidden" };
688
679
  function BiampTableRowInner({
689
680
  row,
681
+ isExpanded,
682
+ isSelected,
690
683
  onRowClick,
691
684
  isRowClickable,
692
685
  enableRowSelection,
@@ -700,7 +693,7 @@ function BiampTableRowInner({
700
693
  TableRow,
701
694
  {
702
695
  hover: clickable,
703
- selected: enableRowSelection ? row.getIsSelected() : void 0,
696
+ selected: enableRowSelection ? isSelected : void 0,
704
697
  role: clickable ? "button" : void 0,
705
698
  tabIndex: clickable ? 0 : void 0,
706
699
  sx: clickable ? rowCursorPointerSx : void 0,
@@ -715,7 +708,7 @@ function BiampTableRowInner({
715
708
  enableRowSelection && /* @__PURE__ */ jsx8(TableCell, { padding: "checkbox", sx: selectionCellSx, children: /* @__PURE__ */ jsx8(
716
709
  Checkbox,
717
710
  {
718
- checked: row.getIsSelected(),
711
+ checked: isSelected,
719
712
  disabled: !row.getCanSelect(),
720
713
  onChange: (e) => row.toggleSelected(e.target.checked, {
721
714
  selectChildren: selectChildrenWithParent
@@ -732,19 +725,22 @@ function BiampTableRowInner({
732
725
  row.getVisibleCells().map((cell, cellIndex, cells) => {
733
726
  const sticky = cell.column.columnDef.meta?.sticky;
734
727
  const isExpandCell = enableExpanding && !sticky && cellIndex === cells.findIndex((c) => !c.column.columnDef.meta?.sticky);
728
+ const content = flexRender(
729
+ cell.column.columnDef.cell,
730
+ cell.getContext()
731
+ );
735
732
  return /* @__PURE__ */ jsx8(
736
733
  TableCell,
737
734
  {
738
735
  "data-sticky": sticky || void 0,
739
- sx: cellSx(sticky, cell.column.columnDef.meta?.minWidth, 2),
736
+ sx: {
737
+ ...cellSx(sticky, cell.column.columnDef.meta?.minWidth, 2),
738
+ pl: isExpandCell ? "6px" : "12px"
739
+ },
740
740
  children: (() => {
741
- const content = flexRender(
742
- cell.column.columnDef.cell,
743
- cell.getContext()
744
- );
745
741
  if (sticky) return content;
746
- const isText = typeof content === "string" || typeof content === "number" || typeof content === "bigint";
747
- const truncated = isText ? /* @__PURE__ */ jsx8(BiampTableTruncatedCell, { children: content }) : content;
742
+ const truncate = cell.column.columnDef.meta?.truncate ?? true;
743
+ const truncated = truncate ? /* @__PURE__ */ jsx8(BiampTableTruncatedCell, { children: content }) : content;
748
744
  if (!isExpandCell) return truncated;
749
745
  const rowLabel = getRowLabel ? getRowLabel(row.original) : `row ${row.index + 1}`;
750
746
  return /* @__PURE__ */ jsxs5(
@@ -753,16 +749,32 @@ function BiampTableRowInner({
753
749
  sx: row.depth > 0 ? { ...expandCellBaseSx, pl: `${row.depth * 12}px` } : expandCellBaseSx,
754
750
  children: [
755
751
  row.getCanExpand() ? /* @__PURE__ */ jsx8(
756
- ChevronRightIcon,
752
+ IconButton,
757
753
  {
754
+ variant: "none",
758
755
  onClick: (e) => {
759
756
  e.stopPropagation();
760
757
  row.toggleExpanded();
761
758
  },
762
- "aria-label": row.getIsExpanded() ? `Collapse ${rowLabel}` : `Expand ${rowLabel}`,
763
- "aria-expanded": row.getIsExpanded(),
764
- variant: "xs",
765
- sx: row.getIsExpanded() ? chevronExpandedSx : chevronCollapsedSx
759
+ "aria-label": isExpanded ? `Collapse ${rowLabel}` : `Expand ${rowLabel}`,
760
+ "aria-expanded": isExpanded,
761
+ children: isExpanded ? /* @__PURE__ */ jsx8(
762
+ ChevronDownIcon,
763
+ {
764
+ variant: "xs",
765
+ sx: {
766
+ color: ({ palette }) => palette.text.secondary
767
+ }
768
+ }
769
+ ) : /* @__PURE__ */ jsx8(
770
+ ChevronRightIcon,
771
+ {
772
+ variant: "xs",
773
+ sx: {
774
+ color: ({ palette }) => palette.text.secondary
775
+ }
776
+ }
777
+ )
766
778
  }
767
779
  ) : hasExpandableRows ? /* @__PURE__ */ jsx8(Box4, { sx: expandPlaceholderSx }) : null,
768
780
  truncated
@@ -780,7 +792,7 @@ function BiampTableRowInner({
780
792
  );
781
793
  }
782
794
  function biampTableRowPropsAreEqual(prev, next) {
783
- return prev.row.id === next.row.id && prev.row.original === next.row.original && prev.row.getIsSelected() === next.row.getIsSelected() && prev.row.getIsExpanded() === next.row.getIsExpanded() && prev.row.getVisibleCells().length === next.row.getVisibleCells().length && prev.enableRowSelection === next.enableRowSelection && prev.enableExpanding === next.enableExpanding && prev.hasExpandableRows === next.hasExpandableRows && prev.selectChildrenWithParent === next.selectChildrenWithParent && prev.onRowClick === next.onRowClick && prev.isRowClickable === next.isRowClickable && prev.getRowLabel === next.getRowLabel;
795
+ return prev.row.id === next.row.id && prev.row.original === next.row.original && prev.isSelected === next.isSelected && prev.isExpanded === next.isExpanded && prev.row.getVisibleCells().length === next.row.getVisibleCells().length && prev.enableRowSelection === next.enableRowSelection && prev.enableExpanding === next.enableExpanding && prev.hasExpandableRows === next.hasExpandableRows && prev.selectChildrenWithParent === next.selectChildrenWithParent && prev.onRowClick === next.onRowClick && prev.isRowClickable === next.isRowClickable && prev.getRowLabel === next.getRowLabel;
784
796
  }
785
797
  var BiampTableRow = React2.memo(
786
798
  BiampTableRowInner,
@@ -824,8 +836,6 @@ function BiampTable({
824
836
  display: "flex",
825
837
  flexDirection: "column",
826
838
  height: "100%",
827
- overflow: "auto",
828
- overscrollBehavior: "none",
829
839
  position: "relative",
830
840
  ...sx
831
841
  },
@@ -889,6 +899,8 @@ function BiampTable({
889
899
  BiampTableRow,
890
900
  {
891
901
  row,
902
+ isExpanded: row.getIsExpanded(),
903
+ isSelected: row.getIsSelected(),
892
904
  onRowClick,
893
905
  isRowClickable,
894
906
  enableRowSelection,
@@ -944,7 +956,7 @@ function BiampTableContainer({
944
956
  }
945
957
 
946
958
  // src/BiampTable/BiampTableCellActionButton.tsx
947
- import { IconButton, Tooltip as Tooltip2 } from "@mui/material";
959
+ import { IconButton as IconButton2, Tooltip as Tooltip2 } from "@mui/material";
948
960
  import { jsx as jsx10 } from "react/jsx-runtime";
949
961
  function BiampTableCellActionButton({ label, icon, ...props }) {
950
962
  return /* @__PURE__ */ jsx10(
@@ -955,7 +967,7 @@ function BiampTableCellActionButton({ label, icon, ...props }) {
955
967
  enterDelay: 500,
956
968
  enterNextDelay: 500,
957
969
  disableInteractive: true,
958
- children: /* @__PURE__ */ jsx10("span", { children: /* @__PURE__ */ jsx10(IconButton, { "aria-label": label, ...props, children: icon }) })
970
+ children: /* @__PURE__ */ jsx10("span", { children: /* @__PURE__ */ jsx10(IconButton2, { "aria-label": label, ...props, children: icon }) })
959
971
  }
960
972
  );
961
973
  }
@@ -1098,7 +1110,7 @@ import { useState as useState3 } from "react";
1098
1110
  // src/BiampTable/BiampTableToolbarActionButton.tsx
1099
1111
  import {
1100
1112
  Badge,
1101
- IconButton as IconButton2
1113
+ IconButton as IconButton3
1102
1114
  } from "@mui/material";
1103
1115
  import { jsx as jsx12 } from "react/jsx-runtime";
1104
1116
  function BiampTableToolbarActionButton({
@@ -1109,7 +1121,7 @@ function BiampTableToolbarActionButton({
1109
1121
  }) {
1110
1122
  const showBadge = badgeContent != null && badgeContent !== 0;
1111
1123
  return /* @__PURE__ */ jsx12(
1112
- IconButton2,
1124
+ IconButton3,
1113
1125
  {
1114
1126
  "aria-label": showBadge ? `${label} (${badgeContent})` : label,
1115
1127
  ...props,
@@ -1312,7 +1324,7 @@ import {
1312
1324
  Button,
1313
1325
  Divider as Divider2,
1314
1326
  Drawer,
1315
- IconButton as IconButton3,
1327
+ IconButton as IconButton4,
1316
1328
  Typography as Typography4
1317
1329
  } from "@mui/material";
1318
1330
  import { CloseIcon, FilterIcon } from "@bwp-web/assets";
@@ -1389,7 +1401,7 @@ function BiampTableToolbarFilters({
1389
1401
  )
1390
1402
  ] }),
1391
1403
  /* @__PURE__ */ jsx18(
1392
- IconButton3,
1404
+ IconButton4,
1393
1405
  {
1394
1406
  size: "medium",
1395
1407
  onClick: handleClose,
@@ -1450,7 +1462,7 @@ function BiampTableToolbarFilters({
1450
1462
  import {
1451
1463
  Box as Box9,
1452
1464
  Collapse,
1453
- IconButton as IconButton4,
1465
+ IconButton as IconButton5,
1454
1466
  InputAdornment as InputAdornment2,
1455
1467
  InputBase,
1456
1468
  TextField as TextField2,
@@ -1529,7 +1541,7 @@ function BiampTableToolbarSearch({
1529
1541
  }
1530
1542
  };
1531
1543
  const clearButton = inputValue ? /* @__PURE__ */ jsx19(InputAdornment2, { position: "end", children: /* @__PURE__ */ jsx19(
1532
- IconButton4,
1544
+ IconButton5,
1533
1545
  {
1534
1546
  size: "small",
1535
1547
  onClick: handleClear,
@@ -1599,7 +1611,7 @@ function BiampTableToolbarSearch({
1599
1611
  if (expandable) {
1600
1612
  return /* @__PURE__ */ jsxs9(Box9, { display: "flex", alignItems: "center", minWidth: 28, children: [
1601
1613
  /* @__PURE__ */ jsx19(
1602
- IconButton4,
1614
+ IconButton5,
1603
1615
  {
1604
1616
  "aria-label": expandLabel ?? placeholder,
1605
1617
  onClick: () => setIsExpanded(true),