@bwp-web/components 1.1.2 → 1.3.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
@@ -509,7 +509,7 @@ import {
509
509
  TextField,
510
510
  Typography
511
511
  } from "@mui/material";
512
- import { BiampRedLogo, SearchIcon } from "@bwp-web/assets";
512
+ import { BiampRedLogo, ExternalLinkIcon, SearchIcon } from "@bwp-web/assets";
513
513
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
514
514
  function BiampHeader({ children, sx, ...props }) {
515
515
  return /* @__PURE__ */ jsx3(
@@ -659,6 +659,7 @@ function BiampHeaderButton({
659
659
  }
660
660
  );
661
661
  }
662
+ var POPOVER_MAX_WIDTH = 530;
662
663
  function BiampAppPopover({
663
664
  children,
664
665
  open,
@@ -669,9 +670,9 @@ function BiampAppPopover({
669
670
  Popover,
670
671
  {
671
672
  open,
672
- anchorOrigin: { vertical: "bottom", horizontal: "left" },
673
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
674
+ transformOrigin: { vertical: -8, horizontal: POPOVER_MAX_WIDTH - 4 },
673
675
  sx: { ...sx },
674
- transformOrigin: { vertical: -4, horizontal: 150 },
675
676
  slotProps: {
676
677
  paper: {
677
678
  sx: {
@@ -680,7 +681,13 @@ function BiampAppPopover({
680
681
  outlineWidth: "0.6px",
681
682
  outlineStyle: "solid",
682
683
  outlineColor: ({ palette }) => palette.divider,
683
- boxShadow: ({ palette }) => `0px 4px 24px 0px ${alpha(palette.common.black, 0.15)};`
684
+ boxShadow: ({ palette }) => `0px 4px 24px 0px ${alpha(palette.common.black, 0.15)};`,
685
+ maxWidth: POPOVER_MAX_WIDTH,
686
+ width: "100%",
687
+ p: 2,
688
+ display: "flex",
689
+ flexDirection: "column",
690
+ gap: 2
684
691
  }
685
692
  }
686
693
  },
@@ -689,7 +696,7 @@ function BiampAppPopover({
689
696
  }
690
697
  );
691
698
  }
692
- function BiampAppDialog({
699
+ function BiampBuildAppContent({
693
700
  children,
694
701
  sx,
695
702
  ...props
@@ -698,13 +705,9 @@ function BiampAppDialog({
698
705
  Box2,
699
706
  {
700
707
  sx: {
701
- p: 2,
702
- display: "inline-flex",
703
- flexWrap: "wrap",
708
+ display: "grid",
709
+ gridTemplateColumns: "1fr 1fr",
704
710
  gap: 1.5,
705
- maxWidth: "284px",
706
- borderRadius: "16px",
707
- backgroundColor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.common.white,
708
711
  ...sx
709
712
  },
710
713
  ...props,
@@ -712,64 +715,92 @@ function BiampAppDialog({
712
715
  }
713
716
  );
714
717
  }
715
- function BiampAppDialogItem({
718
+ function BiampBuildAppContentItem({
719
+ image,
720
+ name,
721
+ description,
722
+ button,
723
+ sx,
724
+ ...props
725
+ }) {
726
+ return /* @__PURE__ */ jsxs2(
727
+ Stack3,
728
+ {
729
+ direction: "column",
730
+ position: "relative",
731
+ sx: {
732
+ p: 1.5,
733
+ borderRadius: 1.5,
734
+ outlineWidth: "1px",
735
+ outlineStyle: "solid",
736
+ outlineColor: ({ palette }) => palette.divider,
737
+ ...sx
738
+ },
739
+ ...props,
740
+ children: [
741
+ /* @__PURE__ */ jsx3(Box2, { sx: { width: 54, height: 54 }, mb: 0.5, children: image }),
742
+ /* @__PURE__ */ jsx3(Typography, { variant: "caption", fontWeight: 600, mb: 0.5, children: name }),
743
+ /* @__PURE__ */ jsx3(Typography, { variant: "caption", color: "text.secondary", children: description }),
744
+ button && /* @__PURE__ */ jsx3(Box2, { position: "absolute", top: "12px", right: "12px", children: button })
745
+ ]
746
+ }
747
+ );
748
+ }
749
+ function BiampEndUserAppContent({
716
750
  children,
751
+ sx,
752
+ ...props
753
+ }) {
754
+ return /* @__PURE__ */ jsx3(
755
+ Stack3,
756
+ {
757
+ direction: "column",
758
+ sx: {
759
+ gap: 1.5,
760
+ ...sx
761
+ },
762
+ ...props,
763
+ children
764
+ }
765
+ );
766
+ }
767
+ function BiampEndUserAppContentItem({
768
+ image,
717
769
  name,
770
+ description,
771
+ href,
772
+ target,
718
773
  sx,
719
774
  ...props
720
775
  }) {
721
776
  return /* @__PURE__ */ jsxs2(
722
- Box2,
777
+ Stack3,
723
778
  {
779
+ component: href ? "a" : "div",
780
+ href,
781
+ target,
782
+ direction: "row",
783
+ alignItems: "center",
724
784
  sx: {
725
- width: "76px",
726
- height: "89px",
727
- display: "flex",
728
- flexDirection: "column",
729
- alignItems: "center",
730
- cursor: "pointer",
731
- justifyContent: "center",
732
- gap: "4px",
733
- borderRadius: "12px",
734
- border: "0.6px solid transparent",
735
- transition: "background-color 0.2s ease, border-color 0.2s ease",
736
- ":hover": {
737
- backgroundColor: ({ palette }) => alpha(palette.info.main, 0.1),
738
- borderColor: ({ palette }) => palette.info.main
739
- },
785
+ gap: 1.5,
786
+ p: 1.5,
787
+ borderRadius: 1.5,
788
+ outlineWidth: "1px",
789
+ outlineStyle: "solid",
790
+ outlineColor: ({ palette }) => palette.divider,
791
+ textDecoration: "none",
792
+ color: "inherit",
793
+ cursor: href ? "pointer" : void 0,
740
794
  ...sx
741
795
  },
742
796
  ...props,
743
797
  children: [
744
- /* @__PURE__ */ jsx3(
745
- Box2,
746
- {
747
- sx: {
748
- mt: "8px",
749
- width: "54px",
750
- height: "54px",
751
- display: "flex",
752
- alignItems: "center",
753
- justifyContent: "center"
754
- },
755
- children
756
- }
757
- ),
758
- /* @__PURE__ */ jsx3(
759
- Typography,
760
- {
761
- variant: "caption",
762
- fontWeight: 600,
763
- sx: {
764
- textAlign: "center",
765
- overflow: "hidden",
766
- textOverflow: "ellipsis",
767
- whiteSpace: "nowrap",
768
- maxWidth: "100%"
769
- },
770
- children: name
771
- }
772
- )
798
+ /* @__PURE__ */ jsx3(Box2, { sx: { width: 32, height: 32 }, children: image }),
799
+ /* @__PURE__ */ jsxs2(Stack3, { direction: "column", children: [
800
+ /* @__PURE__ */ jsx3(Typography, { variant: "caption", fontWeight: 600, children: name }),
801
+ /* @__PURE__ */ jsx3(Typography, { variant: "caption", color: "text.secondary", children: description })
802
+ ] }),
803
+ /* @__PURE__ */ jsx3(ExternalLinkIcon, { sx: { width: 16, height: 16, ml: "auto" } })
773
804
  ]
774
805
  }
775
806
  );
@@ -878,7 +909,9 @@ import {
878
909
  DropdownChevronDownIcon,
879
910
  DropdownChevronUpIcon
880
911
  } from "@bwp-web/assets";
881
- import { flexRender } from "@tanstack/react-table";
912
+ import {
913
+ flexRender
914
+ } from "@tanstack/react-table";
882
915
  import React2, { useRef as useRef3 } from "react";
883
916
 
884
917
  // src/BiampTable/BiampTableEmptyState.tsx
@@ -1012,6 +1045,15 @@ function useLoadingDelay(loading, { delay = 150, minDuration = 500 } = {}) {
1012
1045
  return status === "loading" || status === "ending";
1013
1046
  }
1014
1047
 
1048
+ // src/BiampTable/slotProps.ts
1049
+ function resolveSlot(slot, ctx) {
1050
+ if (!slot) return void 0;
1051
+ return typeof slot === "function" ? slot(ctx) : slot;
1052
+ }
1053
+ function mergeSx(...inputs) {
1054
+ return inputs.filter((v) => Boolean(v)).flatMap((v) => Array.isArray(v) ? v : [v]);
1055
+ }
1056
+
1015
1057
  // src/BiampTable/BiampTable.tsx
1016
1058
  import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1017
1059
  var overlaySx = {
@@ -1082,24 +1124,38 @@ function BiampTableRowInner({
1082
1124
  enableExpanding,
1083
1125
  selectChildrenWithParent,
1084
1126
  getRowLabel,
1085
- hasExpandableRows
1127
+ hasExpandableRows,
1128
+ rowSlotProps,
1129
+ cellSlotProps
1086
1130
  }) {
1087
1131
  const clickable = onRowClick ? isRowClickable ? isRowClickable(row.original) : true : false;
1132
+ const resolvedRow = resolveSlot(rowSlotProps, { row });
1133
+ const {
1134
+ sx: userRowSx,
1135
+ onClick: userRowOnClick,
1136
+ onKeyDown: userRowOnKeyDown,
1137
+ ...restRowProps
1138
+ } = resolvedRow ?? {};
1088
1139
  return /* @__PURE__ */ jsxs5(
1089
1140
  TableRow,
1090
1141
  {
1142
+ ...restRowProps,
1091
1143
  hover: clickable,
1092
1144
  selected: enableRowSelection ? isSelected : void 0,
1093
1145
  role: clickable ? "button" : void 0,
1094
1146
  tabIndex: clickable ? 0 : void 0,
1095
- sx: clickable ? rowCursorPointerSx : void 0,
1096
- onClick: clickable && onRowClick ? () => onRowClick(row.original) : void 0,
1147
+ sx: mergeSx(clickable && rowCursorPointerSx, userRowSx),
1148
+ onClick: clickable && onRowClick ? (e) => {
1149
+ onRowClick(row.original);
1150
+ userRowOnClick?.(e);
1151
+ } : userRowOnClick,
1097
1152
  onKeyDown: clickable && onRowClick ? (e) => {
1098
1153
  if (e.key === "Enter" || e.key === " ") {
1099
1154
  e.preventDefault();
1100
1155
  onRowClick(row.original);
1101
1156
  }
1102
- } : void 0,
1157
+ userRowOnKeyDown?.(e);
1158
+ } : userRowOnKeyDown,
1103
1159
  children: [
1104
1160
  enableRowSelection && /* @__PURE__ */ jsx8(TableCell, { padding: "checkbox", sx: selectionCellSx, children: /* @__PURE__ */ jsx8(
1105
1161
  Checkbox,
@@ -1125,14 +1181,18 @@ function BiampTableRowInner({
1125
1181
  cell.column.columnDef.cell,
1126
1182
  cell.getContext()
1127
1183
  );
1184
+ const resolvedCell = resolveSlot(cellSlotProps, { cell });
1185
+ const { sx: userCellSx, ...restCellProps } = resolvedCell ?? {};
1128
1186
  return /* @__PURE__ */ jsx8(
1129
1187
  TableCell,
1130
1188
  {
1189
+ ...restCellProps,
1131
1190
  "data-sticky": sticky || void 0,
1132
- sx: {
1133
- ...cellSx(sticky, cell.column.columnDef.meta?.minWidth, 2),
1134
- pl: isExpandCell ? "6px" : "12px"
1135
- },
1191
+ sx: mergeSx(
1192
+ cellSx(sticky, cell.column.columnDef.meta?.minWidth, 2),
1193
+ { pl: isExpandCell ? "6px" : "12px" },
1194
+ userCellSx
1195
+ ),
1136
1196
  children: (() => {
1137
1197
  if (sticky) return content;
1138
1198
  const truncate = cell.column.columnDef.meta?.truncate ?? true;
@@ -1188,7 +1248,7 @@ function BiampTableRowInner({
1188
1248
  );
1189
1249
  }
1190
1250
  function biampTableRowPropsAreEqual(prev, next) {
1191
- 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;
1251
+ 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 && prev.rowSlotProps === next.rowSlotProps && prev.cellSlotProps === next.cellSlotProps;
1192
1252
  }
1193
1253
  var BiampTableRow = React2.memo(
1194
1254
  BiampTableRowInner,
@@ -1206,9 +1266,14 @@ function BiampTable({
1206
1266
  hideSelectAll,
1207
1267
  selectChildrenWithParent = false,
1208
1268
  getRowLabel,
1269
+ slotProps,
1209
1270
  sx,
1210
1271
  ...boxProps
1211
1272
  }) {
1273
+ const { sx: userTableSx, ...restTableSlotProps } = slotProps?.table ?? {};
1274
+ const { sx: userHeadSx, ...restHeadSlotProps } = slotProps?.head ?? {};
1275
+ const { sx: userBodySx, ...restBodySlotProps } = slotProps?.body ?? {};
1276
+ const { sx: userHeaderRowSx, ...restHeaderRowSlotProps } = slotProps?.headerRow ?? {};
1212
1277
  const tableMinWidth = table.getVisibleLeafColumns().reduce(
1213
1278
  (sum, col) => {
1214
1279
  const mw = col.columnDef.meta?.minWidth;
@@ -1240,73 +1305,98 @@ function BiampTable({
1240
1305
  MuiTable,
1241
1306
  {
1242
1307
  "aria-busy": showLoading || void 0,
1243
- sx: { minWidth: tableMinWidth, tableLayout: "auto" },
1308
+ ...restTableSlotProps,
1309
+ sx: mergeSx(
1310
+ { minWidth: tableMinWidth, tableLayout: "auto" },
1311
+ userTableSx
1312
+ ),
1244
1313
  children: [
1245
- /* @__PURE__ */ jsx8(TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxs5(TableRow, { children: [
1246
- enableRowSelection && /* @__PURE__ */ jsx8(TableCell, { padding: "checkbox", sx: headerSelectionCellSx, children: !hideSelectAll && /* @__PURE__ */ jsx8(
1247
- Checkbox,
1248
- {
1249
- checked: table.getIsAllPageRowsSelected(),
1250
- indeterminate: table.getIsSomePageRowsSelected(),
1251
- onChange: table.getToggleAllPageRowsSelectedHandler(),
1252
- sx: rows.length === 0 ? checkboxHiddenHeaderSx : void 0,
1253
- slotProps: { input: { "aria-label": "Select all rows" } }
1254
- }
1255
- ) }),
1256
- headerGroup.headers.map((header) => {
1257
- const sticky = header.column.columnDef.meta?.sticky;
1258
- return /* @__PURE__ */ jsx8(
1259
- TableCell,
1260
- {
1261
- "data-sticky": sticky || void 0,
1262
- sortDirection: header.column.getIsSorted() || false,
1263
- ...header.column.getCanSort() && {
1264
- "aria-sort": header.column.getIsSorted() ? header.column.getIsSorted() === "asc" ? "ascending" : "descending" : "none"
1265
- },
1266
- sx: cellSx(
1267
- sticky,
1268
- header.column.columnDef.meta?.minWidth,
1269
- 3
1270
- ),
1271
- children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ jsx8(
1272
- TableSortLabel,
1314
+ /* @__PURE__ */ jsx8(TableHead, { ...restHeadSlotProps, sx: mergeSx(userHeadSx), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxs5(
1315
+ TableRow,
1316
+ {
1317
+ ...restHeaderRowSlotProps,
1318
+ sx: mergeSx(userHeaderRowSx),
1319
+ children: [
1320
+ enableRowSelection && /* @__PURE__ */ jsx8(TableCell, { padding: "checkbox", sx: headerSelectionCellSx, children: !hideSelectAll && /* @__PURE__ */ jsx8(
1321
+ Checkbox,
1322
+ {
1323
+ checked: table.getIsAllPageRowsSelected(),
1324
+ indeterminate: table.getIsSomePageRowsSelected(),
1325
+ onChange: table.getToggleAllPageRowsSelectedHandler(),
1326
+ sx: rows.length === 0 ? checkboxHiddenHeaderSx : void 0,
1327
+ slotProps: { input: { "aria-label": "Select all rows" } }
1328
+ }
1329
+ ) }),
1330
+ headerGroup.headers.map((header) => {
1331
+ const sticky = header.column.columnDef.meta?.sticky;
1332
+ const resolvedHeaderCell = resolveSlot(slotProps?.headerCell, {
1333
+ header
1334
+ });
1335
+ const { sx: userHeaderCellSx, ...restHeaderCellProps } = resolvedHeaderCell ?? {};
1336
+ return /* @__PURE__ */ jsx8(
1337
+ TableCell,
1273
1338
  {
1274
- active: !!header.column.getIsSorted(),
1275
- direction: header.column.getIsSorted() || "asc",
1276
- onClick: header.column.getToggleSortingHandler(),
1277
- ...header.column.getIsSorted() && {
1278
- IconComponent: header.column.getIsSorted() === "asc" ? DropdownChevronUpIcon : DropdownChevronDownIcon
1339
+ ...restHeaderCellProps,
1340
+ "data-sticky": sticky || void 0,
1341
+ sortDirection: header.column.getIsSorted() || false,
1342
+ ...header.column.getCanSort() && {
1343
+ "aria-sort": header.column.getIsSorted() ? header.column.getIsSorted() === "asc" ? "ascending" : "descending" : "none"
1279
1344
  },
1280
- children: flexRender(
1345
+ sx: mergeSx(
1346
+ cellSx(sticky, header.column.columnDef.meta?.minWidth, 3),
1347
+ userHeaderCellSx
1348
+ ),
1349
+ children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ jsx8(
1350
+ TableSortLabel,
1351
+ {
1352
+ active: !!header.column.getIsSorted(),
1353
+ direction: header.column.getIsSorted() || "asc",
1354
+ onClick: header.column.getToggleSortingHandler(),
1355
+ ...header.column.getIsSorted() && {
1356
+ IconComponent: header.column.getIsSorted() === "asc" ? DropdownChevronUpIcon : DropdownChevronDownIcon
1357
+ },
1358
+ children: flexRender(
1359
+ header.column.columnDef.header,
1360
+ header.getContext()
1361
+ )
1362
+ }
1363
+ ) : flexRender(
1281
1364
  header.column.columnDef.header,
1282
1365
  header.getContext()
1283
1366
  )
1284
- }
1285
- ) : flexRender(
1286
- header.column.columnDef.header,
1287
- header.getContext()
1288
- )
1289
- },
1290
- header.id
1291
- );
1292
- })
1293
- ] }, headerGroup.id)) }),
1294
- /* @__PURE__ */ jsx8(TableBody, { sx: { opacity: showLoading ? 0.3 : 1 }, children: !showError && rows.map((row) => /* @__PURE__ */ jsx8(
1295
- BiampTableRow,
1296
- {
1297
- row,
1298
- isExpanded: row.getIsExpanded(),
1299
- isSelected: row.getIsSelected(),
1300
- onRowClick,
1301
- isRowClickable,
1302
- enableRowSelection,
1303
- enableExpanding,
1304
- selectChildrenWithParent,
1305
- getRowLabel,
1306
- hasExpandableRows
1367
+ },
1368
+ header.id
1369
+ );
1370
+ })
1371
+ ]
1307
1372
  },
1308
- row.id
1309
- )) })
1373
+ headerGroup.id
1374
+ )) }),
1375
+ /* @__PURE__ */ jsx8(
1376
+ TableBody,
1377
+ {
1378
+ ...restBodySlotProps,
1379
+ sx: mergeSx({ opacity: showLoading ? 0.3 : 1 }, userBodySx),
1380
+ children: !showError && rows.map((row) => /* @__PURE__ */ jsx8(
1381
+ BiampTableRow,
1382
+ {
1383
+ row,
1384
+ isExpanded: row.getIsExpanded(),
1385
+ isSelected: row.getIsSelected(),
1386
+ onRowClick,
1387
+ isRowClickable,
1388
+ enableRowSelection,
1389
+ enableExpanding,
1390
+ selectChildrenWithParent,
1391
+ getRowLabel,
1392
+ hasExpandableRows,
1393
+ rowSlotProps: slotProps?.row,
1394
+ cellSlotProps: slotProps?.cell
1395
+ },
1396
+ row.id
1397
+ ))
1398
+ }
1399
+ )
1310
1400
  ]
1311
1401
  }
1312
1402
  ),
@@ -2922,13 +3012,15 @@ function DynamicSvgIcon({
2922
3012
  }
2923
3013
  export {
2924
3014
  BIAMP_TABLE_DEBOUNCE_DELAY,
2925
- BiampAppDialog,
2926
- BiampAppDialogItem,
2927
3015
  BiampAppPopover,
2928
3016
  BiampBanner,
2929
3017
  BiampBannerActions,
2930
3018
  BiampBannerContent,
2931
3019
  BiampBannerIcon,
3020
+ BiampBuildAppContent,
3021
+ BiampBuildAppContentItem,
3022
+ BiampEndUserAppContent,
3023
+ BiampEndUserAppContentItem,
2932
3024
  BiampGlobalSearch,
2933
3025
  BiampHeader,
2934
3026
  BiampHeaderActions,