@bwp-web/components 0.11.3 → 0.11.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"BiampTable.d.ts","sourceRoot":"","sources":["../../src/BiampTable/BiampTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EAUd,MAAM,eAAe,CAAC;AAKvB,OAAO,EAAc,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG9C,OAAO,iBAAiB,CAAC;AAGzB,MAAM,MAAM,eAAe,CAAC,KAAK,IAAI,QAAQ,GAAG;IAC9C,6CAA6C;IAC7C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,qFAAqF;IACrF,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,CAAC;IACzC,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wKAAwK;IACxK,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;IACpC,6IAA6I;IAC7I,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,iGAAiG;IACjG,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gIAAgI;IAChI,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,MAAM,CAAC;CACtC,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,EAChC,KAAK,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,KAAK,EACL,KAAK,EACL,aAAa,EACb,WAAW,EACX,EAAE,EACF,GAAG,QAAQ,EACZ,EAAE,eAAe,CAAC,KAAK,CAAC,2CAmQxB"}
1
+ {"version":3,"file":"BiampTable.d.ts","sourceRoot":"","sources":["../../src/BiampTable/BiampTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EAUd,MAAM,eAAe,CAAC;AAKvB,OAAO,EAAc,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAc,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;AAG9E,OAAO,iBAAiB,CAAC;AAGzB,MAAM,MAAM,eAAe,CAAC,KAAK,IAAI,QAAQ,GAAG;IAC9C,6CAA6C;IAC7C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,qFAAqF;IACrF,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,CAAC;IACzC,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wKAAwK;IACxK,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;IACpC,6IAA6I;IAC7I,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,iGAAiG;IACjG,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gIAAgI;IAChI,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,MAAM,CAAC;CACtC,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,EAChC,KAAK,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,KAAK,EACL,KAAK,EACL,aAAa,EACb,WAAW,EACX,EAAE,EACF,GAAG,QAAQ,EACZ,EAAE,eAAe,CAAC,KAAK,CAAC,2CAgTxB"}
@@ -1,4 +1,4 @@
1
- import { Box, type TablePaginationProps } from '@mui/material';
1
+ import { type TablePaginationProps } from '@mui/material';
2
2
  import type { Table } from '@tanstack/react-table';
3
3
  export type BiampTablePaginationProps<TData> = {
4
4
  /** TanStack Table instance to connect to. */
@@ -9,6 +9,8 @@ export type BiampTablePaginationProps<TData> = {
9
9
  loading?: boolean;
10
10
  /** Hide pagination when all rows fit on one page. @default true */
11
11
  autoHide?: boolean;
12
- } & Omit<TablePaginationProps<typeof Box>, 'component' | 'count' | 'page' | 'rowsPerPage' | 'onPageChange' | 'onRowsPerPageChange' | 'rowsPerPageOptions'>;
13
- export declare function BiampTablePagination<TData>({ table, rowsPerPageOptions, loading, autoHide, sx, ...paginationProps }: BiampTablePaginationProps<TData>): import("react/jsx-runtime").JSX.Element | null;
12
+ /** Horizontal alignment of the pagination controls. @default 'center' */
13
+ position?: 'left' | 'center' | 'right';
14
+ } & Omit<TablePaginationProps<'div'>, 'component' | 'count' | 'page' | 'rowsPerPage' | 'onPageChange' | 'onRowsPerPageChange' | 'rowsPerPageOptions' | 'position'>;
15
+ export declare function BiampTablePagination<TData>({ table, rowsPerPageOptions, loading, autoHide, position, sx, ...paginationProps }: BiampTablePaginationProps<TData>): import("react/jsx-runtime").JSX.Element | null;
14
16
  //# sourceMappingURL=BiampTablePagination.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BiampTablePagination.d.ts","sourceRoot":"","sources":["../../src/BiampTable/BiampTablePagination.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAmB,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,MAAM,yBAAyB,CAAC,KAAK,IAAI;IAC7C,6CAA6C;IAC7C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CACN,oBAAoB,CAAC,OAAO,GAAG,CAAC,EAC9B,WAAW,GACX,OAAO,GACP,MAAM,GACN,aAAa,GACb,cAAc,GACd,qBAAqB,GACrB,oBAAoB,CACvB,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,EAC1C,KAAK,EACL,kBAAkB,EAClB,OAAO,EACP,QAAe,EACf,EAAE,EACF,GAAG,eAAe,EACnB,EAAE,yBAAyB,CAAC,KAAK,CAAC,kDAwClC"}
1
+ {"version":3,"file":"BiampTablePagination.d.ts","sourceRoot":"","sources":["../../src/BiampTable/BiampTablePagination.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,MAAM,yBAAyB,CAAC,KAAK,IAAI;IAC7C,6CAA6C;IAC7C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;CACxC,GAAG,IAAI,CACN,oBAAoB,CAAC,KAAK,CAAC,EACzB,WAAW,GACX,OAAO,GACP,MAAM,GACN,aAAa,GACb,cAAc,GACd,qBAAqB,GACrB,oBAAoB,GACpB,UAAU,CACb,CAAC;AAQF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,EAC1C,KAAK,EACL,kBAAkB,EAClB,OAAO,EACP,QAAe,EACf,QAAmB,EACnB,EAAE,EACF,GAAG,eAAe,EACnB,EAAE,yBAAyB,CAAC,KAAK,CAAC,kDA0ClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"BiampTableToolbarSearch.d.ts","sourceRoot":"","sources":["../../src/BiampTable/BiampTableToolbarSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AAQvB,MAAM,MAAM,4BAA4B,GAAG;IACzC,0EAA0E;IAC1E,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,mFAAmF;IACnF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uGAAuG;IACvG,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+GAA+G;IAC/G,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,GAAG,cAAc,CAAC,CAAC;AAShE,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,YAAiB,EACjB,aAA0C,EAC1C,SAAe,EACf,QAAc,EACd,WAAsB,EACtB,UAA2B,EAC3B,UAAkB,EAClB,WAAW,EACX,EAAE,EACF,GAAG,cAAc,EAClB,EAAE,4BAA4B,2CAmG9B"}
1
+ {"version":3,"file":"BiampTableToolbarSearch.d.ts","sourceRoot":"","sources":["../../src/BiampTable/BiampTableToolbarSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AAQvB,MAAM,MAAM,4BAA4B,GAAG;IACzC,0EAA0E;IAC1E,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,mFAAmF;IACnF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uGAAuG;IACvG,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+GAA+G;IAC/G,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,GAAG,cAAc,CAAC,CAAC;AAYhE,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,YAAiB,EACjB,aAA0C,EAC1C,SAAe,EACf,QAAc,EACd,WAAsB,EACtB,UAA2B,EAC3B,UAAkB,EAClB,WAAW,EACX,EAAE,EACF,GAAG,cAAc,EAClB,EAAE,4BAA4B,2CAmG9B"}
package/dist/index.cjs CHANGED
@@ -517,6 +517,7 @@ function BiampLayout({
517
517
  var import_material6 = require("@mui/material");
518
518
  var import_assets5 = require("@bwp-web/assets");
519
519
  var import_react_table = require("@tanstack/react-table");
520
+ var import_react3 = require("react");
520
521
 
521
522
  // src/BiampTable/BiampTableEmptyState.tsx
522
523
  var import_assets3 = require("@bwp-web/assets");
@@ -625,198 +626,242 @@ function BiampTable({
625
626
  },
626
627
  enableRowSelection ? 48 : 0
627
628
  );
628
- const totalColumns = table.getVisibleLeafColumns().length + (enableRowSelection ? 1 : 0);
629
+ const containerRef = (0, import_react3.useRef)(null);
630
+ const lastScrollLeftRef = (0, import_react3.useRef)(null);
631
+ const onContainerScroll = (0, import_react3.useCallback)((target) => {
632
+ const { scrollLeft, scrollWidth, clientWidth } = target;
633
+ if (!containerRef.current || lastScrollLeftRef.current === scrollLeft)
634
+ return;
635
+ containerRef.current.dataset["rightShadow"] = scrollWidth - clientWidth > scrollLeft ? "true" : "false";
636
+ lastScrollLeftRef.current = scrollLeft;
637
+ }, []);
638
+ (0, import_react3.useEffect)(() => {
639
+ if (!containerRef.current) return;
640
+ const observer = new ResizeObserver(
641
+ ([{ target }]) => onContainerScroll(target)
642
+ );
643
+ observer.observe(containerRef.current);
644
+ return () => observer.disconnect();
645
+ }, [onContainerScroll]);
629
646
  const showLoading = useLoadingDelay(!!loading);
630
647
  const rows = table.getRowModel().rows;
631
- const showError = !!error;
632
- const showEmpty = !showError && rows.length === 0;
633
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
648
+ const showError = !!error && !loading;
649
+ const showEmpty = !showError && !loading && rows.length === 0;
650
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
634
651
  import_material6.TableContainer,
635
652
  {
636
653
  component: import_material6.Box,
637
654
  ...boxProps,
655
+ ref: containerRef,
656
+ onScroll: (e) => onContainerScroll(e.currentTarget),
638
657
  sx: {
639
658
  display: "flex",
640
659
  flexDirection: "column",
641
660
  height: "100%",
642
661
  overflow: "auto",
643
662
  overscrollBehavior: "none",
663
+ position: "relative",
664
+ '& [data-sticky="right"]': {
665
+ transition: "box-shadow .2s"
666
+ },
667
+ '&[data-right-shadow="true"] [data-sticky="right"]': {
668
+ boxShadow: ({ palette }) => `-16px 0px 12px -2px ${palette.background.default}`
669
+ },
644
670
  ...sx
645
671
  },
646
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
647
- import_material6.Table,
648
- {
649
- "aria-busy": showLoading || void 0,
650
- sx: {
651
- minWidth: tableMinWidth,
652
- height: showError || showEmpty ? "100%" : void 0
653
- },
654
- children: [
655
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.TableRow, { children: [
656
- enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
657
- import_material6.TableCell,
658
- {
659
- padding: "checkbox",
660
- sx: {
661
- position: "sticky",
662
- left: 0,
663
- zIndex: 3,
664
- bgcolor: "background.paper"
665
- },
666
- children: !hideSelectAll && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
667
- import_material6.Checkbox,
668
- {
669
- checked: table.getIsAllPageRowsSelected(),
670
- indeterminate: table.getIsSomePageRowsSelected(),
671
- onChange: table.getToggleAllPageRowsSelectedHandler(),
672
- slotProps: { input: { "aria-label": "Select all rows" } }
673
- }
674
- )
675
- }
676
- ),
677
- headerGroup.headers.map((header) => {
678
- const sticky = header.column.columnDef.meta?.sticky;
679
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
672
+ children: [
673
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
674
+ import_material6.Table,
675
+ {
676
+ "aria-busy": showLoading || void 0,
677
+ sx: { minWidth: tableMinWidth },
678
+ children: [
679
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.TableRow, { children: [
680
+ enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
680
681
  import_material6.TableCell,
681
682
  {
682
- sortDirection: header.column.getIsSorted() || false,
683
- ...header.column.getCanSort() && {
684
- "aria-sort": header.column.getIsSorted() ? header.column.getIsSorted() === "asc" ? "ascending" : "descending" : "none"
685
- },
683
+ padding: "checkbox",
686
684
  sx: {
687
- minWidth: header.column.columnDef.meta?.minWidth ?? 40,
688
- ...sticky && {
689
- position: "sticky",
690
- [sticky]: 0,
691
- zIndex: 3,
692
- bgcolor: "background.paper"
693
- }
685
+ position: "sticky",
686
+ left: 0,
687
+ zIndex: 3,
688
+ bgcolor: "background.paper"
694
689
  },
695
- children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
696
- import_material6.TableSortLabel,
690
+ children: !hideSelectAll && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
691
+ import_material6.Checkbox,
697
692
  {
698
- active: !!header.column.getIsSorted(),
699
- direction: header.column.getIsSorted() || "asc",
700
- onClick: header.column.getToggleSortingHandler(),
701
- ...header.column.getIsSorted() && {
702
- IconComponent: header.column.getIsSorted() === "asc" ? import_assets5.DropdownChevronUpIcon : import_assets5.DropdownChevronDownIcon
703
- },
704
- children: (0, import_react_table.flexRender)(
705
- header.column.columnDef.header,
706
- header.getContext()
707
- )
693
+ checked: table.getIsAllPageRowsSelected(),
694
+ indeterminate: table.getIsSomePageRowsSelected(),
695
+ onChange: table.getToggleAllPageRowsSelectedHandler(),
696
+ slotProps: { input: { "aria-label": "Select all rows" } }
708
697
  }
709
- ) : (0, import_react_table.flexRender)(
710
- header.column.columnDef.header,
711
- header.getContext()
712
698
  )
713
- },
714
- header.id
715
- );
716
- })
717
- ] }, headerGroup.id)) }),
718
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableBody, { sx: { opacity: showLoading ? 0.3 : 1 }, children: showError ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
719
- import_material6.TableCell,
720
- {
721
- colSpan: totalColumns,
722
- sx: {
723
- textAlign: "center",
724
- verticalAlign: "middle",
725
- height: "100%"
726
- },
727
- children: error === true ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BiampTableErrorState, {}) : error instanceof Error ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BiampTableErrorState, { description: error.message }) : error
728
- }
729
- ) }) : showEmpty ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
730
- import_material6.TableCell,
731
- {
732
- colSpan: totalColumns,
733
- sx: {
734
- textAlign: "center",
735
- verticalAlign: "middle",
736
- height: "100%"
737
- },
738
- children: empty && empty !== true ? empty : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BiampTableEmptyState, {})
739
- }
740
- ) }) : rows.map((row) => {
741
- const clickable = onRowClick ? isRowClickable ? isRowClickable(row.original) : true : false;
742
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
743
- import_material6.TableRow,
744
- {
745
- hover: clickable,
746
- selected: enableRowSelection ? row.getIsSelected() : void 0,
747
- role: clickable ? "button" : void 0,
748
- tabIndex: clickable ? 0 : void 0,
749
- sx: { cursor: clickable ? "pointer" : void 0 },
750
- onClick: clickable && onRowClick ? () => onRowClick(row.original) : void 0,
751
- onKeyDown: clickable && onRowClick ? (e) => {
752
- if (e.key === "Enter" || e.key === " ") {
753
- e.preventDefault();
754
- onRowClick(row.original);
755
- }
756
- } : void 0,
757
- children: [
758
- enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
759
- import_material6.TableCell,
760
- {
761
- padding: "checkbox",
762
- sx: {
699
+ }
700
+ ),
701
+ headerGroup.headers.map((header) => {
702
+ const sticky = header.column.columnDef.meta?.sticky;
703
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
704
+ import_material6.TableCell,
705
+ {
706
+ "data-sticky": sticky || void 0,
707
+ sortDirection: header.column.getIsSorted() || false,
708
+ ...header.column.getCanSort() && {
709
+ "aria-sort": header.column.getIsSorted() ? header.column.getIsSorted() === "asc" ? "ascending" : "descending" : "none"
710
+ },
711
+ sx: {
712
+ minWidth: header.column.columnDef.meta?.minWidth ?? 40,
713
+ ...sticky && {
763
714
  position: "sticky",
764
- left: 0,
765
- zIndex: 2,
766
- bgcolor: "background.paper",
767
- ".MuiTableRow-hover:hover > &, .Mui-selected > &": {
768
- bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
769
- }
770
- },
771
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
772
- import_material6.Checkbox,
773
- {
774
- checked: row.getIsSelected(),
775
- disabled: !row.getCanSelect(),
776
- onChange: row.getToggleSelectedHandler(),
777
- onClick: (e) => e.stopPropagation(),
778
- slotProps: {
779
- input: {
780
- "aria-label": getRowLabel ? `Select ${getRowLabel(row.original)}` : `Select row ${row.index + 1}`
781
- }
782
- }
783
- }
784
- )
715
+ [sticky]: 0,
716
+ zIndex: 3,
717
+ bgcolor: "background.paper"
718
+ }
719
+ },
720
+ children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
721
+ import_material6.TableSortLabel,
722
+ {
723
+ active: !!header.column.getIsSorted(),
724
+ direction: header.column.getIsSorted() || "asc",
725
+ onClick: header.column.getToggleSortingHandler(),
726
+ ...header.column.getIsSorted() && {
727
+ IconComponent: header.column.getIsSorted() === "asc" ? import_assets5.DropdownChevronUpIcon : import_assets5.DropdownChevronDownIcon
728
+ },
729
+ children: (0, import_react_table.flexRender)(
730
+ header.column.columnDef.header,
731
+ header.getContext()
732
+ )
733
+ }
734
+ ) : (0, import_react_table.flexRender)(
735
+ header.column.columnDef.header,
736
+ header.getContext()
737
+ )
738
+ },
739
+ header.id
740
+ );
741
+ })
742
+ ] }, headerGroup.id)) }),
743
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableBody, { sx: { opacity: showLoading ? 0.3 : 1 }, children: !showError && rows.map((row) => {
744
+ const clickable = onRowClick ? isRowClickable ? isRowClickable(row.original) : true : false;
745
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
746
+ import_material6.TableRow,
747
+ {
748
+ hover: clickable,
749
+ selected: enableRowSelection ? row.getIsSelected() : void 0,
750
+ role: clickable ? "button" : void 0,
751
+ tabIndex: clickable ? 0 : void 0,
752
+ sx: { cursor: clickable ? "pointer" : void 0 },
753
+ onClick: clickable && onRowClick ? () => onRowClick(row.original) : void 0,
754
+ onKeyDown: clickable && onRowClick ? (e) => {
755
+ if (e.key === "Enter" || e.key === " ") {
756
+ e.preventDefault();
757
+ onRowClick(row.original);
785
758
  }
786
- ),
787
- row.getVisibleCells().map((cell) => {
788
- const sticky = cell.column.columnDef.meta?.sticky;
789
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
759
+ } : void 0,
760
+ children: [
761
+ enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
790
762
  import_material6.TableCell,
791
763
  {
764
+ padding: "checkbox",
792
765
  sx: {
793
- minWidth: cell.column.columnDef.meta?.minWidth ?? 40,
794
- ...sticky && {
795
- position: "sticky",
796
- [sticky]: 0,
797
- zIndex: 2,
798
- bgcolor: "background.paper",
799
- ".MuiTableRow-hover:hover > &, .Mui-selected > &": {
800
- bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
801
- }
766
+ position: "sticky",
767
+ left: 0,
768
+ zIndex: 2,
769
+ bgcolor: "background.paper",
770
+ ".MuiTableRow-hover:hover > &, .Mui-selected > &": {
771
+ bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
802
772
  }
803
773
  },
804
- children: (0, import_react_table.flexRender)(
805
- cell.column.columnDef.cell,
806
- cell.getContext()
774
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
775
+ import_material6.Checkbox,
776
+ {
777
+ checked: row.getIsSelected(),
778
+ disabled: !row.getCanSelect(),
779
+ onChange: row.getToggleSelectedHandler(),
780
+ onClick: (e) => e.stopPropagation(),
781
+ slotProps: {
782
+ input: {
783
+ "aria-label": getRowLabel ? `Select ${getRowLabel(row.original)}` : `Select row ${row.index + 1}`
784
+ }
785
+ }
786
+ }
807
787
  )
808
- },
809
- cell.id
810
- );
811
- })
812
- ]
813
- },
814
- row.id
815
- );
816
- }) })
817
- ]
818
- }
819
- )
788
+ }
789
+ ),
790
+ row.getVisibleCells().map((cell) => {
791
+ const sticky = cell.column.columnDef.meta?.sticky;
792
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
793
+ import_material6.TableCell,
794
+ {
795
+ "data-sticky": sticky || void 0,
796
+ sx: {
797
+ minWidth: cell.column.columnDef.meta?.minWidth ?? 40,
798
+ ...sticky && {
799
+ position: "sticky",
800
+ [sticky]: 0,
801
+ zIndex: 2,
802
+ bgcolor: "background.paper",
803
+ ".MuiTableRow-hover:hover > &, .Mui-selected > &": {
804
+ bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
805
+ }
806
+ }
807
+ },
808
+ children: (0, import_react_table.flexRender)(
809
+ cell.column.columnDef.cell,
810
+ cell.getContext()
811
+ )
812
+ },
813
+ cell.id
814
+ );
815
+ })
816
+ ]
817
+ },
818
+ row.id
819
+ );
820
+ }) })
821
+ ]
822
+ }
823
+ ),
824
+ showError && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
825
+ import_material6.Box,
826
+ {
827
+ sx: {
828
+ position: "absolute",
829
+ top: 0,
830
+ left: 0,
831
+ right: 0,
832
+ bottom: 0,
833
+ display: "flex",
834
+ alignItems: "center",
835
+ justifyContent: "center",
836
+ pointerEvents: "none"
837
+ },
838
+ children: error === true ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BiampTableErrorState, { sx: { pointerEvents: "auto" } }) : error instanceof Error ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
839
+ BiampTableErrorState,
840
+ {
841
+ description: error.message,
842
+ sx: { pointerEvents: "auto" }
843
+ }
844
+ ) : error
845
+ }
846
+ ),
847
+ showEmpty && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
848
+ import_material6.Box,
849
+ {
850
+ sx: {
851
+ position: "absolute",
852
+ top: 0,
853
+ left: 0,
854
+ right: 0,
855
+ bottom: 0,
856
+ display: "flex",
857
+ alignItems: "center",
858
+ justifyContent: "center",
859
+ pointerEvents: "none"
860
+ },
861
+ children: empty && empty !== true ? empty : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BiampTableEmptyState, { sx: { pointerEvents: "auto" } })
862
+ }
863
+ )
864
+ ]
820
865
  }
821
866
  );
822
867
  }
@@ -985,7 +1030,7 @@ function BiampTableColumnVisibility({
985
1030
 
986
1031
  // src/BiampTable/BiampTableToolbarColumnVisibility.tsx
987
1032
  var import_assets6 = require("@bwp-web/assets");
988
- var import_react3 = require("react");
1033
+ var import_react4 = require("react");
989
1034
 
990
1035
  // src/BiampTable/BiampTableToolbarActionButton.tsx
991
1036
  var import_material10 = require("@mui/material");
@@ -1035,7 +1080,7 @@ function BiampTableToolbarColumnVisibility({
1035
1080
  showAllLabel,
1036
1081
  ...actionButtonProps
1037
1082
  }) {
1038
- const [anchorEl, setAnchorEl] = (0, import_react3.useState)(null);
1083
+ const [anchorEl, setAnchorEl] = (0, import_react4.useState)(null);
1039
1084
  const defaults = defaultColumnVisibility ?? getDefaultColumnVisibility(table);
1040
1085
  const dirtyCount = getColumnVisibilityDirtyCount(table, defaults);
1041
1086
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
@@ -1062,19 +1107,25 @@ function BiampTableToolbarColumnVisibility({
1062
1107
  }
1063
1108
 
1064
1109
  // src/BiampTable/BiampTablePagination.tsx
1065
- var import_react4 = require("react");
1110
+ var import_react5 = require("react");
1066
1111
  var import_material11 = require("@mui/material");
1067
1112
  var import_jsx_runtime14 = require("react/jsx-runtime");
1113
+ var positionMap = {
1114
+ left: "flex-start",
1115
+ center: "center",
1116
+ right: "flex-end"
1117
+ };
1068
1118
  function BiampTablePagination({
1069
1119
  table,
1070
1120
  rowsPerPageOptions,
1071
1121
  loading,
1072
1122
  autoHide = true,
1123
+ position = "center",
1073
1124
  sx,
1074
1125
  ...paginationProps
1075
1126
  }) {
1076
1127
  const rowCount = table.getRowCount();
1077
- const lastRowCountRef = (0, import_react4.useRef)(rowCount);
1128
+ const lastRowCountRef = (0, import_react5.useRef)(rowCount);
1078
1129
  if (!loading && rowCount >= 0) {
1079
1130
  lastRowCountRef.current = rowCount;
1080
1131
  }
@@ -1084,7 +1135,7 @@ function BiampTablePagination({
1084
1135
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1085
1136
  import_material11.TablePagination,
1086
1137
  {
1087
- component: import_material11.Box,
1138
+ component: "div",
1088
1139
  count: stableCount,
1089
1140
  page: table.getState().pagination.pageIndex,
1090
1141
  rowsPerPage: table.getState().pagination.pageSize,
@@ -1097,6 +1148,8 @@ function BiampTablePagination({
1097
1148
  showFirstButton: true,
1098
1149
  showLastButton: true,
1099
1150
  sx: {
1151
+ display: "flex",
1152
+ justifyContent: positionMap[position],
1100
1153
  height: 40,
1101
1154
  minHeight: 40,
1102
1155
  "& .MuiToolbar-root": {
@@ -1172,7 +1225,7 @@ function BiampTableToolbarExport({
1172
1225
  // src/BiampTable/BiampTableToolbarFilters.tsx
1173
1226
  var import_material15 = require("@mui/material");
1174
1227
  var import_assets8 = require("@bwp-web/assets");
1175
- var import_react5 = require("react");
1228
+ var import_react6 = require("react");
1176
1229
  var import_jsx_runtime18 = require("react/jsx-runtime");
1177
1230
  function BiampTableToolbarFilters({
1178
1231
  activeFilterCount,
@@ -1187,8 +1240,8 @@ function BiampTableToolbarFilters({
1187
1240
  buttonLabel = "Filters",
1188
1241
  DrawerProps: drawerProps
1189
1242
  }) {
1190
- const [open, setOpen] = (0, import_react5.useState)(false);
1191
- const titleId = (0, import_react5.useId)();
1243
+ const [open, setOpen] = (0, import_react6.useState)(false);
1244
+ const titleId = (0, import_react6.useId)();
1192
1245
  function handleClose() {
1193
1246
  onApply?.();
1194
1247
  setOpen(false);
@@ -1305,21 +1358,21 @@ function BiampTableToolbarFilters({
1305
1358
  // src/BiampTable/BiampTableToolbarSearch.tsx
1306
1359
  var import_material16 = require("@mui/material");
1307
1360
  var import_assets9 = require("@bwp-web/assets");
1308
- var import_react7 = require("react");
1361
+ var import_react8 = require("react");
1309
1362
 
1310
1363
  // src/BiampTable/useDebouncedCallback.ts
1311
- var import_react6 = require("react");
1364
+ var import_react7 = require("react");
1312
1365
  var BIAMP_TABLE_DEBOUNCE_DELAY = 300;
1313
1366
  function useDebouncedCallback(callback, delay = BIAMP_TABLE_DEBOUNCE_DELAY) {
1314
- const timeoutRef = (0, import_react6.useRef)(null);
1315
- const callbackRef = (0, import_react6.useRef)(callback);
1367
+ const timeoutRef = (0, import_react7.useRef)(null);
1368
+ const callbackRef = (0, import_react7.useRef)(callback);
1316
1369
  callbackRef.current = callback;
1317
- (0, import_react6.useEffect)(() => {
1370
+ (0, import_react7.useEffect)(() => {
1318
1371
  return () => {
1319
1372
  if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
1320
1373
  };
1321
1374
  }, []);
1322
- return (0, import_react6.useCallback)(
1375
+ return (0, import_react7.useCallback)(
1323
1376
  (...args) => {
1324
1377
  if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
1325
1378
  timeoutRef.current = setTimeout(
@@ -1335,8 +1388,11 @@ function useDebouncedCallback(callback, delay = BIAMP_TABLE_DEBOUNCE_DELAY) {
1335
1388
  var import_jsx_runtime19 = require("react/jsx-runtime");
1336
1389
  var searchFieldSx = {
1337
1390
  "& .MuiInputBase-root": {
1338
- height: 36,
1339
- minHeight: 36
1391
+ height: "36px !important",
1392
+ minHeight: "36px !important"
1393
+ },
1394
+ "& .MuiOutlinedInput-notchedOutline": {
1395
+ height: "36px !important"
1340
1396
  }
1341
1397
  };
1342
1398
  function BiampTableToolbarSearch({
@@ -1352,10 +1408,10 @@ function BiampTableToolbarSearch({
1352
1408
  sx,
1353
1409
  ...textFieldProps
1354
1410
  }) {
1355
- const [inputValue, setInputValue] = (0, import_react7.useState)(defaultValue);
1356
- const [isExpanded, setIsExpanded] = (0, import_react7.useState)(false);
1411
+ const [inputValue, setInputValue] = (0, import_react8.useState)(defaultValue);
1412
+ const [isExpanded, setIsExpanded] = (0, import_react8.useState)(false);
1357
1413
  const debouncedOnChange = useDebouncedCallback(onChange, debounceDelay);
1358
- (0, import_react7.useEffect)(() => {
1414
+ (0, import_react8.useEffect)(() => {
1359
1415
  setInputValue(defaultValue);
1360
1416
  }, [defaultValue]);
1361
1417
  const handleChange = (e) => {