@popsure/dirty-swan 0.54.5 → 0.54.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.
Files changed (56) hide show
  1. package/dist/cjs/index.js +25 -20
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/lib/components/table/Table.d.ts +2 -1
  4. package/dist/cjs/lib/components/table/Table.stories.d.ts +7 -3
  5. package/dist/cjs/lib/components/table/components/TableCell/CardCell/CardCell.d.ts +10 -0
  6. package/dist/cjs/lib/components/table/components/TableCell/CardCell/CardCell.stories.d.ts +17 -0
  7. package/dist/cjs/lib/components/table/components/TableCell/TableCell.d.ts +2 -1
  8. package/dist/cjs/lib/components/table/components/TableContents/TableContents.d.ts +2 -1
  9. package/dist/cjs/lib/components/table/components/TableSection/TableSection.d.ts +2 -1
  10. package/dist/cjs/lib/components/table/types.d.ts +11 -4
  11. package/dist/esm/{TableSection-1d481798.js → TableSection-7ae32c28.js} +8 -7
  12. package/dist/esm/TableSection-7ae32c28.js.map +1 -0
  13. package/dist/esm/components/table/Table.js +9 -8
  14. package/dist/esm/components/table/Table.js.map +1 -1
  15. package/dist/esm/components/table/Table.stories.js +20 -6
  16. package/dist/esm/components/table/Table.stories.js.map +1 -1
  17. package/dist/esm/components/table/Table.test.js +4 -3
  18. package/dist/esm/components/table/Table.test.js.map +1 -1
  19. package/dist/esm/components/table/components/TableCell/CTACell/CTACell.js +1 -1
  20. package/dist/esm/components/table/components/TableCell/CardCell/CardCell.js +16 -0
  21. package/dist/esm/components/table/components/TableCell/CardCell/CardCell.js.map +1 -0
  22. package/dist/esm/components/table/components/TableCell/CardCell/CardCell.stories.js +31 -0
  23. package/dist/esm/components/table/components/TableCell/CardCell/CardCell.stories.js.map +1 -0
  24. package/dist/esm/components/table/components/TableCell/TableCell.js +7 -4
  25. package/dist/esm/components/table/components/TableCell/TableCell.js.map +1 -1
  26. package/dist/esm/components/table/components/TableCell/TableCell.test.js +3 -0
  27. package/dist/esm/components/table/components/TableCell/TableCell.test.js.map +1 -1
  28. package/dist/esm/components/table/components/TableContents/TableContents.js +6 -5
  29. package/dist/esm/components/table/components/TableContents/TableContents.js.map +1 -1
  30. package/dist/esm/components/table/components/TableContents/TableContents.test.js +4 -3
  31. package/dist/esm/components/table/components/TableContents/TableContents.test.js.map +1 -1
  32. package/dist/esm/components/table/components/TableSection/TableSection.js +5 -2
  33. package/dist/esm/components/table/components/TableSection/TableSection.js.map +1 -1
  34. package/dist/esm/components/table/components/TableSection/TableSection.test.js +4 -1
  35. package/dist/esm/components/table/components/TableSection/TableSection.test.js.map +1 -1
  36. package/dist/esm/index.js +2 -1
  37. package/dist/esm/index.js.map +1 -1
  38. package/dist/esm/lib/components/table/Table.d.ts +2 -1
  39. package/dist/esm/lib/components/table/Table.stories.d.ts +7 -3
  40. package/dist/esm/lib/components/table/components/TableCell/CardCell/CardCell.d.ts +10 -0
  41. package/dist/esm/lib/components/table/components/TableCell/CardCell/CardCell.stories.d.ts +17 -0
  42. package/dist/esm/lib/components/table/components/TableCell/TableCell.d.ts +2 -1
  43. package/dist/esm/lib/components/table/components/TableContents/TableContents.d.ts +2 -1
  44. package/dist/esm/lib/components/table/components/TableSection/TableSection.d.ts +2 -1
  45. package/dist/esm/lib/components/table/types.d.ts +11 -4
  46. package/package.json +1 -1
  47. package/src/lib/components/table/Table.stories.tsx +17 -1
  48. package/src/lib/components/table/Table.tsx +7 -2
  49. package/src/lib/components/table/components/TableCell/CTACell/CTACell.module.scss +1 -0
  50. package/src/lib/components/table/components/TableCell/CardCell/CardCell.stories.tsx +34 -0
  51. package/src/lib/components/table/components/TableCell/CardCell/CardCell.tsx +33 -0
  52. package/src/lib/components/table/components/TableCell/TableCell.tsx +6 -1
  53. package/src/lib/components/table/components/TableContents/TableContents.tsx +3 -0
  54. package/src/lib/components/table/components/TableSection/TableSection.tsx +48 -42
  55. package/src/lib/components/table/types.ts +8 -4
  56. package/dist/esm/TableSection-1d481798.js.map +0 -1
package/dist/cjs/index.js CHANGED
@@ -14321,7 +14321,7 @@ var BaseCell = function (_a) {
14321
14321
  } }) }))] }) }));
14322
14322
  };
14323
14323
 
14324
- var css_248z$5 = ".CTACell-module_narrow__1EPPT {\n height: 40px;\n}";
14324
+ var css_248z$5 = ".CTACell-module_narrow__1EPPT {\n height: 40px;\n padding: 8px !important;\n}";
14325
14325
  var styles$5 = {"narrow":"CTACell-module_narrow__1EPPT"};
14326
14326
  styleInject(css_248z$5);
14327
14327
 
@@ -14336,6 +14336,11 @@ var CTACell = function (_a) {
14336
14336
  _b)), href: href, target: "_blank", rel: "noopener noreferrer", children: buttonCaption })] }));
14337
14337
  };
14338
14338
 
14339
+ var CardCell = function (_a) {
14340
+ var title = _a.title, description = _a.description, icon = _a.icon, onClick = _a.onClick, href = _a.href;
14341
+ return (jsxRuntime.jsx("div", { className: "ta-left", children: jsxRuntime.jsx(Card, __assign({ title: title, description: description, density: 'balanced', icon: icon, onClick: onClick }, (href && { href: href, as: 'a' }), { actionIcon: null, showActionIcon: false })) }));
14342
+ };
14343
+
14339
14344
  var css_248z$4 = ".ButtonCell-module_buttonCell__x4NNi {\n color: #26262e;\n border: 1px solid #d2d2d8;\n transition: all 0.3s ease-in-out;\n}\n@media (max-width: 34rem) {\n .ButtonCell-module_buttonCell__x4NNi {\n max-width: calc(100% - 96px);\n }\n}\n.ButtonCell-module_buttonCell__x4NNi:disabled {\n border: none;\n background-color: #f5f6fb;\n color: #26262e;\n opacity: 1;\n cursor: default;\n}\n.ButtonCell-module_buttonCell__x4NNi:disabled:hover {\n background-color: #f5f6fb;\n}\n@media (max-width: 34rem) {\n .ButtonCell-module_buttonCell__x4NNi {\n pointer-events: none;\n }\n}\n\n.ButtonCell-module_withoutPrice__2rpe9 {\n height: 64px;\n}\n\n.ButtonCell-module_withPrice__3bd_t {\n height: 75px;\n}\n\n.ButtonCell-module_selected__22pF_ {\n transition: all 0.3 ease-in-out;\n border: 2px solid #8e8cee;\n background-color: #f7f7ff;\n}";
14340
14345
  var styles$4 = {"buttonCell":"ButtonCell-module_buttonCell__x4NNi","withoutPrice":"ButtonCell-module_withoutPrice__2rpe9","withPrice":"ButtonCell-module_withPrice__3bd_t","selected":"ButtonCell-module_selected__22pF_"};
14341
14346
  styleInject(css_248z$4);
@@ -14353,7 +14358,7 @@ var ButtonCell = function (_a) {
14353
14358
  var TableCell = require$$0__default['default'].memo(function (_a) {
14354
14359
  var _b;
14355
14360
  var _c;
14356
- var _d = _a.isFirstCellInRow, isFirstCellInRow = _d === void 0 ? false : _d, _e = _a.isHeader, isHeader = _e === void 0 ? false : _e, _f = _a.isNavigation, isNavigation = _f === void 0 ? false : _f, _g = _a.isTopLeftCell, isTopLeftCell = _g === void 0 ? false : _g, cellProps = __rest$1(_a, ["isFirstCellInRow", "isHeader", "isNavigation", "isTopLeftCell"]);
14361
+ var _d = _a.isFirstCellInRow, isFirstCellInRow = _d === void 0 ? false : _d, _e = _a.isHeader, isHeader = _e === void 0 ? false : _e, _f = _a.isNavigation, isNavigation = _f === void 0 ? false : _f, _g = _a.isTopLeftCell, isTopLeftCell = _g === void 0 ? false : _g, _h = _a.colSpan, colSpan = _h === void 0 ? 0 : _h, cellProps = __rest$1(_a, ["isFirstCellInRow", "isHeader", "isNavigation", "isTopLeftCell", "colSpan"]);
14357
14362
  // prettier-ignore
14358
14363
  var Tag = isNavigation
14359
14364
  ? 'div'
@@ -14368,11 +14373,11 @@ var TableCell = require$$0__default['default'].memo(function (_a) {
14368
14373
  return (jsxRuntime.jsxs(Tag, __assign({}, scope, { className: classNames$1('bg-white py24 px8', styles$8.th, (_b = {
14369
14374
  'ta-left': isFirstCellInRow
14370
14375
  },
14371
- _b[styles$8.fixedCell] = isFirstCellInRow,
14376
+ _b[styles$8.fixedCell] = isFirstCellInRow && colSpan < 1,
14372
14377
  _b.pl32 = isFirstCellInRow,
14373
- _b)), children: [!cellProps.type && (jsxRuntime.jsx(BaseCell, __assign({}, cellProps, { fontVariant: isTopLeftCell
14378
+ _b)), colSpan: colSpan, children: [!cellProps.type && (jsxRuntime.jsx(BaseCell, __assign({}, cellProps, { fontVariant: isTopLeftCell
14374
14379
  ? 'BIG_WITH_UNDERLINE'
14375
- : (_c = cellProps.fontVariant) !== null && _c !== void 0 ? _c : 'NORMAL' }))), cellProps.type === 'CTA' && jsxRuntime.jsx(CTACell, __assign({}, cellProps)), cellProps.type === 'BUTTON' && jsxRuntime.jsx(ButtonCell, __assign({}, cellProps))] })));
14380
+ : (_c = cellProps.fontVariant) !== null && _c !== void 0 ? _c : 'NORMAL' }))), cellProps.type === 'CTA' && jsxRuntime.jsx(CTACell, __assign({}, cellProps)), cellProps.type === 'BUTTON' && jsxRuntime.jsx(ButtonCell, __assign({}, cellProps)), cellProps.type === 'CARD' && jsxRuntime.jsx(CardCell, __assign({}, cellProps))] })));
14376
14381
  });
14377
14382
 
14378
14383
  var css_248z$3 = ".Table-module_wrapper__2MMNq {\n position: relative;\n}\n\n.Table-module_container__3VFLP {\n overflow-x: auto;\n overflow-y: hidden;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */\n -webkit-overflow-scrolling: touch;\n scroll-snap-type: x mandatory;\n}\n.Table-module_container__3VFLP::-webkit-scrollbar {\n display: none;\n}\n@media (min-width: 34rem) {\n .Table-module_container__3VFLP {\n scroll-snap-type: unset;\n }\n}\n\n.Table-module_stickyHeader__2uEpP {\n display: flex;\n position: sticky;\n z-index: 9;\n}";
@@ -14439,7 +14444,7 @@ var isBaseCell = function (tableCellData) {
14439
14444
  };
14440
14445
 
14441
14446
  var TableSection = function (_a) {
14442
- var className = _a.className, tableCellRows = _a.tableCellRows, hideHeader = _a.hideHeader, openModal = _a.openModal, title = _a.title, width = _a.width, cellReplacements = _a.cellReplacements;
14447
+ var className = _a.className, tableCellRows = _a.tableCellRows, _b = _a.hideColumns, hideColumns = _b === void 0 ? [] : _b, hideHeader = _a.hideHeader, openModal = _a.openModal, title = _a.title, width = _a.width, cellReplacements = _a.cellReplacements;
14443
14448
  var headerRow = tableCellRows === null || tableCellRows === void 0 ? void 0 : tableCellRows[0];
14444
14449
  var getModalTitleFromColumnHeader = function (cellIndex) {
14445
14450
  var _a;
@@ -14463,6 +14468,7 @@ var TableSection = function (_a) {
14463
14468
  var titleFromRow = (isBaseCell(firstCellInRow) && firstCellInRow.text) || '';
14464
14469
  return titleFromRow;
14465
14470
  };
14471
+ var isVisibleColumn = require$$0.useCallback(function (cellIndex) { return (!hideColumns.includes(cellIndex)); }, [hideColumns]);
14466
14472
  return (jsxRuntime.jsxs("table", { className: classNames$1(className, 'w100', styles$2.table), width: width, children: [jsxRuntime.jsx("caption", { className: "sr-only", children: title }), headerRow && (jsxRuntime.jsx("thead", { className: hideHeader ? 'sr-only' : '', children: jsxRuntime.jsx("tr", { children: headerRow.map(function (tableCellData, cellIndex) {
14467
14473
  var isFirstCellInRow = cellIndex === 0;
14468
14474
  var cellReplacementData = (tableCellData.cellId &&
@@ -14474,10 +14480,9 @@ var TableSection = function (_a) {
14474
14480
  getModalTitleFromColumnHeader(cellIndex),
14475
14481
  align: isFirstCellInRow ? 'left' : 'center',
14476
14482
  });
14477
- return (jsxRuntime.jsx(TableCell, __assign({ isHeader: true, isFirstCellInRow: isFirstCellInRow, isTopLeftCell: isFirstCellInRow }, cellProps), cellIndex));
14483
+ return isVisibleColumn(cellIndex) && (jsxRuntime.jsx(TableCell, __assign({ isHeader: true, isFirstCellInRow: isFirstCellInRow, isTopLeftCell: isFirstCellInRow }, cellProps), cellIndex));
14478
14484
  }) }) })), jsxRuntime.jsx("tbody", { children: tableCellRows.map(function (row, rowIndex) {
14479
- row.length === 1;
14480
- return (rowIndex > 0 && (jsxRuntime.jsx("tr", { className: styles$2.tr, children: row.map(function (tableCellData, cellIndex) {
14485
+ return rowIndex > 0 && (jsxRuntime.jsx("tr", { className: styles$2.tr, children: row.map(function (tableCellData, cellIndex) {
14481
14486
  var key = "".concat(rowIndex, "-").concat(cellIndex);
14482
14487
  var isFirstCellInRow = cellIndex === 0;
14483
14488
  var titleFromRow = getModalTitleFromRowHeader(row);
@@ -14493,8 +14498,8 @@ var TableSection = function (_a) {
14493
14498
  : titleFromColumnOrRow,
14494
14499
  align: isFirstCellInRow ? 'left' : 'center',
14495
14500
  });
14496
- return (jsxRuntime.jsx(TableCell, __assign({ isFirstCellInRow: isFirstCellInRow }, cellProps), key));
14497
- }) }, rowIndex)));
14501
+ return !hideColumns.includes(cellIndex) && (jsxRuntime.jsx(TableCell, __assign({ isFirstCellInRow: isFirstCellInRow }, cellProps), key));
14502
+ }) }, rowIndex));
14498
14503
  }) })] }));
14499
14504
  };
14500
14505
 
@@ -14513,8 +14518,8 @@ var Collapsible = function (_a) {
14513
14518
 
14514
14519
  var TableContents = function (_a) {
14515
14520
  var _b, _c;
14516
- var className = _a.className, collapsibleSections = _a.collapsibleSections, tableData = _a.tableData, hideDetails = _a.hideDetails, isMobile = _a.isMobile, openModal = _a.openModal, shouldHideDetails = _a.shouldHideDetails, title = _a.title, cellReplacements = _a.cellReplacements;
14517
- var _d = require$$0.useState(null), isSectionOpen = _d[0], setOpenSection = _d[1];
14521
+ var className = _a.className, collapsibleSections = _a.collapsibleSections, tableData = _a.tableData, _d = _a.hideColumns, hideColumns = _d === void 0 ? [] : _d, hideDetails = _a.hideDetails, isMobile = _a.isMobile, openModal = _a.openModal, shouldHideDetails = _a.shouldHideDetails, title = _a.title, cellReplacements = _a.cellReplacements;
14522
+ var _e = require$$0.useState(null), isSectionOpen = _e[0], setOpenSection = _e[1];
14518
14523
  var firstHeadRow = (_c = (_b = tableData === null || tableData === void 0 ? void 0 : tableData[0]) === null || _b === void 0 ? void 0 : _b.rows) === null || _c === void 0 ? void 0 : _c[0];
14519
14524
  var tableWidth = isMobile ? "".concat((firstHeadRow === null || firstHeadRow === void 0 ? void 0 : firstHeadRow.length) * 50, "%") : '';
14520
14525
  var handleToggleSection = function (index) {
@@ -14536,7 +14541,7 @@ var TableContents = function (_a) {
14536
14541
  ? {
14537
14542
  onClick: function () { return handleToggleSection(index); },
14538
14543
  }
14539
- : {}))) }) })), jsxRuntime.jsx(Collapsible, { isExpanded: isExpanded, isMobile: isMobile, children: jsxRuntime.jsx(TableSection, { className: classNames$1(className, 'mb24'), tableCellRows: isFirstSection ? rows : __spreadArray$1([firstHeadRow], rows, true), hideHeader: true, openModal: openModal, title: "".concat(title).concat((section === null || section === void 0 ? void 0 : section.title) ? " - ".concat(section.title) : ''), width: tableWidth, cellReplacements: cellReplacements }) })] }, index)));
14544
+ : {}))) }) })), jsxRuntime.jsx(Collapsible, { isExpanded: isExpanded, isMobile: isMobile, children: jsxRuntime.jsx(TableSection, { className: classNames$1(className, 'mb24'), tableCellRows: isFirstSection ? rows : __spreadArray$1([firstHeadRow], rows, true), hideColumns: hideColumns, hideHeader: true, openModal: openModal, title: "".concat(title).concat((section === null || section === void 0 ? void 0 : section.title) ? " - ".concat(section.title) : ''), width: tableWidth, cellReplacements: cellReplacements }) })] }, index)));
14540
14545
  }) }));
14541
14546
  };
14542
14547
 
@@ -14632,20 +14637,20 @@ var defaultTextOverrides = {
14632
14637
  };
14633
14638
  var Table = function (_a) {
14634
14639
  var _b, _c, _d, _e, _f;
14635
- var className = _a.className, cellReplacements = _a.cellReplacements, collapsibleSections = _a.collapsibleSections, tableData = _a.tableData, hideDetails = _a.hideDetails, onModalOpen = _a.onModalOpen, onSelectionChanged = _a.onSelectionChanged, _g = _a.stickyHeaderTopOffset, stickyHeaderTopOffset = _g === void 0 ? 0 : _g, definedTextOverrides = _a.textOverrides, title = _a.title;
14640
+ var className = _a.className, cellReplacements = _a.cellReplacements, collapsibleSections = _a.collapsibleSections, tableData = _a.tableData, _g = _a.hideColumns, hideColumns = _g === void 0 ? [] : _g, hideDetails = _a.hideDetails, onModalOpen = _a.onModalOpen, onSelectionChanged = _a.onSelectionChanged, _h = _a.stickyHeaderTopOffset, stickyHeaderTopOffset = _h === void 0 ? 0 : _h, definedTextOverrides = _a.textOverrides, title = _a.title;
14636
14641
  var textOverrides = __assign(__assign({}, defaultTextOverrides), definedTextOverrides);
14637
14642
  var isMobile = useMediaQuery('BELOW_MOBILE');
14638
- var _h = require$$0.useState(null), infoModalData = _h[0], setInfoModalData = _h[1];
14639
- var _j = require$$0.useState(true), shouldHideDetails = _j[0], setShouldHideDetails = _j[1];
14643
+ var _j = require$$0.useState(null), infoModalData = _j[0], setInfoModalData = _j[1];
14644
+ var _k = require$$0.useState(true), shouldHideDetails = _k[0], setShouldHideDetails = _k[1];
14640
14645
  var containerRef = require$$0.useRef(null);
14641
14646
  var headerRef = require$$0.useRef(null);
14642
14647
  var columnsLength = tableData[0].rows[0].length;
14643
14648
  useScrollSync(headerRef, containerRef, !isMobile);
14644
- var _k = useTableNavigation({
14649
+ var _l = useTableNavigation({
14645
14650
  enabled: isMobile,
14646
14651
  containerRef: containerRef,
14647
14652
  onSelectionChanged: onSelectionChanged,
14648
- }), activeSection = _k.activeSection, navigateTable = _k.navigateTable;
14653
+ }), activeSection = _l.activeSection, navigateTable = _l.navigateTable;
14649
14654
  var currentActiveSection = (_d = (_c = (_b = tableData === null || tableData === void 0 ? void 0 : tableData[0]) === null || _b === void 0 ? void 0 : _b.rows) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d[activeSection];
14650
14655
  var currentActiveSectionReplacements = (currentActiveSection.cellId &&
14651
14656
  (cellReplacements === null || cellReplacements === void 0 ? void 0 : cellReplacements[currentActiveSection.cellId])) ||
@@ -14665,7 +14670,7 @@ var Table = function (_a) {
14665
14670
  });
14666
14671
  },
14667
14672
  }
14668
- : {}), activeCellProps, { isNavigation: true })) })) : (jsxRuntime.jsx("div", { "aria-hidden": true, className: styles$3.stickyHeader, style: { top: "".concat(stickyHeaderTopOffset, "px") }, children: jsxRuntime.jsx("div", { className: styles$3.container, ref: headerRef, children: jsxRuntime.jsx(TableSection, { tableCellRows: [(_f = (_e = tableData === null || tableData === void 0 ? void 0 : tableData[0]) === null || _e === void 0 ? void 0 : _e.rows) === null || _f === void 0 ? void 0 : _f[0]], title: title, className: className, openModal: handleOpenModal }) }) })), jsxRuntime.jsx("div", { ref: containerRef, className: classNames$1(styles$3.container, 'pb8'), children: jsxRuntime.jsx(TableContents, { tableData: tableData, title: title, className: className, collapsibleSections: collapsibleSections, hideDetails: hideDetails, isMobile: isMobile, shouldHideDetails: shouldHideDetails, openModal: handleOpenModal, cellReplacements: cellReplacements }) }), hideDetails && (jsxRuntime.jsx(Card, { "data-testid": "show-hide-details", classNames: {
14673
+ : {}), activeCellProps, { isNavigation: true })) })) : (jsxRuntime.jsx("div", { "aria-hidden": true, className: styles$3.stickyHeader, style: { top: "".concat(stickyHeaderTopOffset, "px") }, children: jsxRuntime.jsx("div", { className: styles$3.container, ref: headerRef, children: jsxRuntime.jsx(TableSection, { cellReplacements: cellReplacements, className: className, hideColumns: hideColumns, openModal: handleOpenModal, tableCellRows: [(_f = (_e = tableData === null || tableData === void 0 ? void 0 : tableData[0]) === null || _e === void 0 ? void 0 : _e.rows) === null || _f === void 0 ? void 0 : _f[0]], title: title }) }) })), jsxRuntime.jsx("div", { ref: containerRef, className: classNames$1(styles$3.container, 'pb8'), children: jsxRuntime.jsx(TableContents, { tableData: tableData, title: title, className: className, collapsibleSections: collapsibleSections, hideColumns: hideColumns, hideDetails: hideDetails, isMobile: isMobile, shouldHideDetails: shouldHideDetails, openModal: handleOpenModal, cellReplacements: cellReplacements }) }), hideDetails && (jsxRuntime.jsx(Card, { "data-testid": "show-hide-details", classNames: {
14669
14674
  buttonWrapper: 'm8 mt32',
14670
14675
  title: 'd-flex gap8 ai-center jc-center',
14671
14676
  wrapper: 'bg-grey-200',