@popsure/dirty-swan 0.54.4 → 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.
- package/dist/cjs/index.js +76 -59
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/table/Table.d.ts +4 -2
- package/dist/cjs/lib/components/table/Table.stories.d.ts +7 -3
- package/dist/cjs/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +7 -3
- package/dist/cjs/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.d.ts +2 -2
- package/dist/cjs/lib/components/table/components/TableCell/ButtonCell/ButtonCell.d.ts +1 -0
- package/dist/cjs/lib/components/table/components/TableCell/CTACell/CTACell.d.ts +3 -1
- package/dist/cjs/lib/components/table/components/TableCell/CTACell/CTACell.stories.d.ts +3 -2
- package/dist/cjs/lib/components/table/components/TableCell/CardCell/CardCell.d.ts +10 -0
- package/dist/cjs/lib/components/table/components/TableCell/CardCell/CardCell.stories.d.ts +17 -0
- package/dist/cjs/lib/components/table/components/TableCell/TableCell.d.ts +5 -3
- package/dist/cjs/lib/components/table/components/TableContents/TableContents.d.ts +4 -2
- package/dist/cjs/lib/components/table/components/TableSection/TableSection.d.ts +4 -2
- package/dist/cjs/lib/components/table/types.d.ts +12 -7
- package/dist/esm/{TableSection-f6d0028e.js → TableSection-7ae32c28.js} +30 -33
- package/dist/esm/TableSection-7ae32c28.js.map +1 -0
- package/dist/esm/components/table/Table.js +17 -12
- package/dist/esm/components/table/Table.js.map +1 -1
- package/dist/esm/components/table/Table.stories.js +44 -8
- package/dist/esm/components/table/Table.stories.js.map +1 -1
- package/dist/esm/components/table/Table.test.js +18 -4
- package/dist/esm/components/table/Table.test.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js +19 -7
- package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.stories.js +2 -2
- package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.stories.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/CTACell/CTACell.js +3 -3
- package/dist/esm/components/table/components/TableCell/CTACell/CTACell.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/CTACell/CTACell.stories.js +8 -3
- package/dist/esm/components/table/components/TableCell/CTACell/CTACell.stories.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/CardCell/CardCell.js +16 -0
- package/dist/esm/components/table/components/TableCell/CardCell/CardCell.js.map +1 -0
- package/dist/esm/components/table/components/TableCell/CardCell/CardCell.stories.js +31 -0
- package/dist/esm/components/table/components/TableCell/CardCell/CardCell.stories.js.map +1 -0
- package/dist/esm/components/table/components/TableCell/TableCell.js +10 -7
- package/dist/esm/components/table/components/TableCell/TableCell.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/TableCell.test.js +7 -1
- package/dist/esm/components/table/components/TableCell/TableCell.test.js.map +1 -1
- package/dist/esm/components/table/components/TableContents/TableContents.js +6 -5
- package/dist/esm/components/table/components/TableContents/TableContents.js.map +1 -1
- package/dist/esm/components/table/components/TableContents/TableContents.test.js +4 -3
- package/dist/esm/components/table/components/TableContents/TableContents.test.js.map +1 -1
- package/dist/esm/components/table/components/TableSection/TableSection.js +5 -2
- package/dist/esm/components/table/components/TableSection/TableSection.js.map +1 -1
- package/dist/esm/components/table/components/TableSection/TableSection.test.js +4 -1
- package/dist/esm/components/table/components/TableSection/TableSection.test.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/components/table/Table.d.ts +4 -2
- package/dist/esm/lib/components/table/Table.stories.d.ts +7 -3
- package/dist/esm/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +7 -3
- package/dist/esm/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.d.ts +2 -2
- package/dist/esm/lib/components/table/components/TableCell/ButtonCell/ButtonCell.d.ts +1 -0
- package/dist/esm/lib/components/table/components/TableCell/CTACell/CTACell.d.ts +3 -1
- package/dist/esm/lib/components/table/components/TableCell/CTACell/CTACell.stories.d.ts +3 -2
- package/dist/esm/lib/components/table/components/TableCell/CardCell/CardCell.d.ts +10 -0
- package/dist/esm/lib/components/table/components/TableCell/CardCell/CardCell.stories.d.ts +17 -0
- package/dist/esm/lib/components/table/components/TableCell/TableCell.d.ts +5 -3
- package/dist/esm/lib/components/table/components/TableContents/TableContents.d.ts +4 -2
- package/dist/esm/lib/components/table/components/TableSection/TableSection.d.ts +4 -2
- package/dist/esm/lib/components/table/types.d.ts +12 -7
- package/package.json +1 -1
- package/src/lib/components/table/Table.stories.tsx +65 -12
- package/src/lib/components/table/Table.test.tsx +23 -1
- package/src/lib/components/table/Table.tsx +32 -8
- package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.module.scss +7 -5
- package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.stories.tsx +2 -0
- package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx +71 -32
- package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.tsx +1 -0
- package/src/lib/components/table/components/TableCell/CTACell/CTACell.module.scss +1 -0
- package/src/lib/components/table/components/TableCell/CTACell/CTACell.stories.tsx +5 -1
- package/src/lib/components/table/components/TableCell/CTACell/CTACell.tsx +13 -6
- package/src/lib/components/table/components/TableCell/CardCell/CardCell.stories.tsx +34 -0
- package/src/lib/components/table/components/TableCell/CardCell/CardCell.tsx +33 -0
- package/src/lib/components/table/components/TableCell/TableCell.test.tsx +4 -1
- package/src/lib/components/table/components/TableCell/TableCell.tsx +49 -41
- package/src/lib/components/table/components/TableContents/TableContents.tsx +7 -1
- package/src/lib/components/table/components/TableSection/TableSection.tsx +70 -55
- package/src/lib/components/table/types.ts +10 -4
- package/dist/esm/TableSection-f6d0028e.js.map +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -14269,8 +14269,8 @@ var css_248z$8 = ".TableCell-module_th__2rjCU {\n vertical-align: middle;\n sc
|
|
|
14269
14269
|
var styles$8 = {"th":"TableCell-module_th__2rjCU","fixedCell":"TableCell-module_fixedCell__cL3-m"};
|
|
14270
14270
|
styleInject(css_248z$8);
|
|
14271
14271
|
|
|
14272
|
-
var css_248z$7 = ".BaseCell-
|
|
14273
|
-
var styles$7 = {"
|
|
14272
|
+
var css_248z$7 = ".BaseCell-module_relative__1v2X0 {\n position: relative;\n}\n\n.BaseCell-module_infoButtonAbsolute__Mpjrz {\n position: absolute;\n right: -32px;\n}\n\n.BaseCell-module_icon__1775U {\n margin: 2px;\n}\n\n.BaseCell-module_bigWithUnderline__2xx5X {\n position: relative;\n display: none;\n}\n.BaseCell-module_bigWithUnderline__2xx5X:after {\n content: \"\";\n display: block;\n position: absolute;\n top: calc( 50% + 16px );\n height: 4px;\n width: 100%;\n max-width: 140px;\n background-color: #8e8cee;\n}\n@media (min-width: 34rem) {\n .BaseCell-module_bigWithUnderline__2xx5X {\n display: flex;\n }\n}";
|
|
14273
|
+
var styles$7 = {"relative":"BaseCell-module_relative__1v2X0","infoButtonAbsolute":"BaseCell-module_infoButtonAbsolute__Mpjrz","icon":"BaseCell-module_icon__1775U","bigWithUnderline":"BaseCell-module_bigWithUnderline__2xx5X"};
|
|
14274
14274
|
styleInject(css_248z$7);
|
|
14275
14275
|
|
|
14276
14276
|
var css_248z$6 = ".MiniProgressBar-module_progressBar__2K07F {\n margin-bottom: 4px;\n}\n.MiniProgressBar-module_progressBar__2K07F rect {\n fill: #ebebff;\n}\n\n.MiniProgressBar-module_filledBars1__ZhQbV rect:first-child {\n fill: #91919c;\n}\n\n.MiniProgressBar-module_filledBars2__2lH_z rect:nth-child(-n+2) {\n fill: #91919c;\n}\n\n.MiniProgressBar-module_filledBars3__1OKUj rect:nth-child(-n+3) {\n fill: #b0cdf3;\n}\n\n.MiniProgressBar-module_filledBars4__T9kuj rect:nth-child(-n+4) {\n fill: #b0cdf3;\n}\n\n.MiniProgressBar-module_filledBars5__WxVpb rect {\n fill: #8e8cee;\n}";
|
|
@@ -14295,7 +14295,7 @@ var progressLookup = {
|
|
|
14295
14295
|
'100%': 5,
|
|
14296
14296
|
};
|
|
14297
14297
|
var BaseCell = function (_a) {
|
|
14298
|
-
var _b = _a.align, align = _b === void 0 ? 'center' : _b, checkmarkValue = _a.checkmarkValue, _c = _a.
|
|
14298
|
+
var _b = _a.align, align = _b === void 0 ? 'center' : _b, checkmarkValue = _a.checkmarkValue, _c = _a.description, description = _c === void 0 ? '' : _c, _d = _a.fontVariant, fontVariant = _d === void 0 ? 'NORMAL' : _d, _e = _a.hideProgressBar, hideProgressBar = _e === void 0 ? false : _e, _f = _a.modalTitle, modalTitle = _f === void 0 ? '' : _f, _g = _a.modalContent, modalContent = _g === void 0 ? '' : _g, openModal = _a.openModal, rating = _a.rating, _h = _a.text, text = _h === void 0 ? '' : _h;
|
|
14299
14299
|
var alignClassName = {
|
|
14300
14300
|
center: 'ta-center jc-center ai-center',
|
|
14301
14301
|
left: 'ta-left jc-start',
|
|
@@ -14303,20 +14303,32 @@ var BaseCell = function (_a) {
|
|
|
14303
14303
|
}[align];
|
|
14304
14304
|
var validRatingValues = [1, 2, 3];
|
|
14305
14305
|
var SelectedIcon = (rating === null || rating === void 0 ? void 0 : rating.type) === 'zap' ? ZapFilledIcon : StarFilledIcon;
|
|
14306
|
-
var progressBarValue = typeof text === 'string'
|
|
14307
|
-
|
|
14306
|
+
var progressBarValue = !hideProgressBar && typeof text === 'string'
|
|
14307
|
+
? progressLookup[text]
|
|
14308
|
+
: undefined;
|
|
14309
|
+
return (jsxRuntime.jsx("div", { className: classNames$1('d-flex gap8 ai-center', {
|
|
14308
14310
|
'jc-center': align === 'center',
|
|
14309
|
-
}), children:
|
|
14311
|
+
}), children: jsxRuntime.jsxs("div", { className: classNames$1('d-flex fd-column', alignClassName, styles$7.relative), children: [progressBarValue !== undefined && (jsxRuntime.jsx(MiniProgressBar, { nFilledBars: progressBarValue })), (rating === null || rating === void 0 ? void 0 : rating.value) && (jsxRuntime.jsx("span", { "data-testid": "table-cell-rating", title: "".concat(rating === null || rating === void 0 ? void 0 : rating.value, " out of 3"), children: validRatingValues.map(function (value) { return (jsxRuntime.jsx(SelectedIcon, { "aria-hidden": "true", color: value <= (rating === null || rating === void 0 ? void 0 : rating.value) ? 'primary-500' : 'grey-400', className: styles$7.icon }, value)); }) })), jsxRuntime.jsxs("div", { className: "d-flex ai-center", children: [checkmarkValue !== undefined && (jsxRuntime.jsx("span", { title: checkmarkValue ? 'Yes' : 'No', children: checkmarkValue ? (jsxRuntime.jsx(CheckIcon, { "data-testid": "table-cell-boolean-yes", size: 24, "aria-hidden": true, color: "primary-500" })) : (jsxRuntime.jsx(XIcon, { "data-testid": "table-cell-boolean-no", size: 24, "aria-hidden": true, color: "grey-400" })) })), jsxRuntime.jsxs("div", { className: "d-inline", children: [text && fontVariant === 'NORMAL' && (jsxRuntime.jsx("div", { className: "p-p d-inline", "data-testid": "table-cell-text", children: text })), text && fontVariant === 'PRICE' && (jsxRuntime.jsx("div", { className: "p-h1 p--serif tc-primary-500", "data-testid": "table-cell-content", children: text })), text && fontVariant === 'BIG_WITH_UNDERLINE' && (jsxRuntime.jsx("div", { "aria-hidden": true, className: classNames$1('tc-grey-800 p-h2 p--serif', styles$7.bigWithUnderline), children: text })), modalContent && openModal && align == 'left' && (jsxRuntime.jsx("span", { className: "ml8", children: jsxRuntime.jsx(TableInfoButton, { onClick: function () {
|
|
14312
|
+
return openModal({
|
|
14313
|
+
title: modalTitle,
|
|
14314
|
+
body: modalContent,
|
|
14315
|
+
});
|
|
14316
|
+
} }) }))] })] }), description && (jsxRuntime.jsx("div", { className: classNames$1('d-flex p-p--small tc-grey-500', alignClassName), children: description })), modalContent && openModal && align == 'center' && (jsxRuntime.jsx("span", { className: styles$7.infoButtonAbsolute, children: jsxRuntime.jsx(TableInfoButton, { onClick: function () {
|
|
14317
|
+
return openModal({
|
|
14318
|
+
title: modalTitle,
|
|
14319
|
+
body: modalContent,
|
|
14320
|
+
});
|
|
14321
|
+
} }) }))] }) }));
|
|
14310
14322
|
};
|
|
14311
14323
|
|
|
14312
|
-
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}";
|
|
14313
14325
|
var styles$5 = {"narrow":"CTACell-module_narrow__1EPPT"};
|
|
14314
14326
|
styleInject(css_248z$5);
|
|
14315
14327
|
|
|
14316
14328
|
var CTACell = function (_a) {
|
|
14317
14329
|
var _b;
|
|
14318
|
-
var title = _a.title, price = _a.price, grey = _a.grey, narrow = _a.narrow, href = _a.href, buttonCaption = _a.buttonCaption;
|
|
14319
|
-
return (jsxRuntime.jsxs("div", { className: "
|
|
14330
|
+
var title = _a.title, price = _a.price, icon = _a.icon, grey = _a.grey, narrow = _a.narrow, href = _a.href, buttonCaption = _a.buttonCaption;
|
|
14331
|
+
return (jsxRuntime.jsxs("div", { className: "ta-center", children: [jsxRuntime.jsxs("div", { className: "d-flex jc-center ai-center gap8", children: [icon, jsxRuntime.jsxs("p", { className: "p-h3", children: [title, price && jsxRuntime.jsxs("span", { className: "tc-purple-500", children: [" ", price] })] })] }), jsxRuntime.jsx("a", { className: classNames$1('mt16 w100 wmx3', (_b = {
|
|
14320
14332
|
'p-btn--primary': !grey,
|
|
14321
14333
|
'p-btn--secondary-grey': grey
|
|
14322
14334
|
},
|
|
@@ -14324,6 +14336,11 @@ var CTACell = function (_a) {
|
|
|
14324
14336
|
_b)), href: href, target: "_blank", rel: "noopener noreferrer", children: buttonCaption })] }));
|
|
14325
14337
|
};
|
|
14326
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
|
+
|
|
14327
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}";
|
|
14328
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_"};
|
|
14329
14346
|
styleInject(css_248z$4);
|
|
@@ -14338,10 +14355,10 @@ var ButtonCell = function (_a) {
|
|
|
14338
14355
|
_b)), variant: "filledWhite", type: "submit", onClick: onClick, disabled: disabled, children: [buttonCaption, price && jsxRuntime.jsx("span", { className: "p-p tc-purple-500", children: price })] }) }));
|
|
14339
14356
|
};
|
|
14340
14357
|
|
|
14341
|
-
var TableCell = function (_a) {
|
|
14358
|
+
var TableCell = require$$0__default['default'].memo(function (_a) {
|
|
14342
14359
|
var _b;
|
|
14343
14360
|
var _c;
|
|
14344
|
-
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"]);
|
|
14345
14362
|
// prettier-ignore
|
|
14346
14363
|
var Tag = isNavigation
|
|
14347
14364
|
? 'div'
|
|
@@ -14356,12 +14373,12 @@ var TableCell = function (_a) {
|
|
|
14356
14373
|
return (jsxRuntime.jsxs(Tag, __assign({}, scope, { className: classNames$1('bg-white py24 px8', styles$8.th, (_b = {
|
|
14357
14374
|
'ta-left': isFirstCellInRow
|
|
14358
14375
|
},
|
|
14359
|
-
_b[styles$8.fixedCell] = isFirstCellInRow,
|
|
14376
|
+
_b[styles$8.fixedCell] = isFirstCellInRow && colSpan < 1,
|
|
14360
14377
|
_b.pl32 = isFirstCellInRow,
|
|
14361
|
-
_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
|
|
14362
14379
|
? 'BIG_WITH_UNDERLINE'
|
|
14363
|
-
: (_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))] })));
|
|
14364
|
-
};
|
|
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))] })));
|
|
14381
|
+
});
|
|
14365
14382
|
|
|
14366
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}";
|
|
14367
14384
|
var styles$3 = {"wrapper":"Table-module_wrapper__2MMNq","container":"Table-module_container__3VFLP","stickyHeader":"Table-module_stickyHeader__2uEpP"};
|
|
@@ -14427,7 +14444,7 @@ var isBaseCell = function (tableCellData) {
|
|
|
14427
14444
|
};
|
|
14428
14445
|
|
|
14429
14446
|
var TableSection = function (_a) {
|
|
14430
|
-
var className = _a.className, tableCellRows = _a.tableCellRows, hideHeader = _a.hideHeader, openModal = _a.openModal, title = _a.title, width = _a.width;
|
|
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;
|
|
14431
14448
|
var headerRow = tableCellRows === null || tableCellRows === void 0 ? void 0 : tableCellRows[0];
|
|
14432
14449
|
var getModalTitleFromColumnHeader = function (cellIndex) {
|
|
14433
14450
|
var _a;
|
|
@@ -14451,42 +14468,38 @@ var TableSection = function (_a) {
|
|
|
14451
14468
|
var titleFromRow = (isBaseCell(firstCellInRow) && firstCellInRow.text) || '';
|
|
14452
14469
|
return titleFromRow;
|
|
14453
14470
|
};
|
|
14471
|
+
var isVisibleColumn = require$$0.useCallback(function (cellIndex) { return (!hideColumns.includes(cellIndex)); }, [hideColumns]);
|
|
14454
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) {
|
|
14455
14473
|
var isFirstCellInRow = cellIndex === 0;
|
|
14456
|
-
|
|
14457
|
-
?
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
|
|
14462
|
-
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
}
|
|
14467
|
-
: {})), cellIndex));
|
|
14474
|
+
var cellReplacementData = (tableCellData.cellId &&
|
|
14475
|
+
(cellReplacements === null || cellReplacements === void 0 ? void 0 : cellReplacements[tableCellData.cellId])) ||
|
|
14476
|
+
{};
|
|
14477
|
+
var cellProps = __assign(__assign(__assign({}, tableCellData), cellReplacementData), {
|
|
14478
|
+
openModal: openModal,
|
|
14479
|
+
modalTitle: (isBaseCell(tableCellData) && tableCellData.text) ||
|
|
14480
|
+
getModalTitleFromColumnHeader(cellIndex),
|
|
14481
|
+
align: isFirstCellInRow ? 'left' : 'center',
|
|
14482
|
+
});
|
|
14483
|
+
return isVisibleColumn(cellIndex) && (jsxRuntime.jsx(TableCell, __assign({ isHeader: true, isFirstCellInRow: isFirstCellInRow, isTopLeftCell: isFirstCellInRow }, cellProps), cellIndex));
|
|
14468
14484
|
}) }) })), jsxRuntime.jsx("tbody", { children: tableCellRows.map(function (row, rowIndex) {
|
|
14469
|
-
row.
|
|
14470
|
-
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) {
|
|
14471
14486
|
var key = "".concat(rowIndex, "-").concat(cellIndex);
|
|
14472
14487
|
var isFirstCellInRow = cellIndex === 0;
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
: {})), key));
|
|
14489
|
-
}) }, rowIndex)));
|
|
14488
|
+
var titleFromRow = getModalTitleFromRowHeader(row);
|
|
14489
|
+
var titleFromColumnOrRow = getModalTitleFromColumnHeader(cellIndex) ||
|
|
14490
|
+
getModalTitleFromRowHeader(row);
|
|
14491
|
+
var cellReplacementData = (tableCellData.cellId &&
|
|
14492
|
+
(cellReplacements === null || cellReplacements === void 0 ? void 0 : cellReplacements[tableCellData.cellId])) ||
|
|
14493
|
+
{};
|
|
14494
|
+
var cellProps = __assign(__assign(__assign({}, tableCellData), cellReplacementData), {
|
|
14495
|
+
openModal: openModal,
|
|
14496
|
+
modalTitle: isFirstCellInRow
|
|
14497
|
+
? titleFromRow
|
|
14498
|
+
: titleFromColumnOrRow,
|
|
14499
|
+
align: isFirstCellInRow ? 'left' : 'center',
|
|
14500
|
+
});
|
|
14501
|
+
return !hideColumns.includes(cellIndex) && (jsxRuntime.jsx(TableCell, __assign({ isFirstCellInRow: isFirstCellInRow }, cellProps), key));
|
|
14502
|
+
}) }, rowIndex));
|
|
14490
14503
|
}) })] }));
|
|
14491
14504
|
};
|
|
14492
14505
|
|
|
@@ -14505,8 +14518,8 @@ var Collapsible = function (_a) {
|
|
|
14505
14518
|
|
|
14506
14519
|
var TableContents = function (_a) {
|
|
14507
14520
|
var _b, _c;
|
|
14508
|
-
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;
|
|
14509
|
-
var
|
|
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];
|
|
14510
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];
|
|
14511
14524
|
var tableWidth = isMobile ? "".concat((firstHeadRow === null || firstHeadRow === void 0 ? void 0 : firstHeadRow.length) * 50, "%") : '';
|
|
14512
14525
|
var handleToggleSection = function (index) {
|
|
@@ -14528,7 +14541,7 @@ var TableContents = function (_a) {
|
|
|
14528
14541
|
? {
|
|
14529
14542
|
onClick: function () { return handleToggleSection(index); },
|
|
14530
14543
|
}
|
|
14531
|
-
: {}))) }) })), 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 }) })] }, 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)));
|
|
14532
14545
|
}) }));
|
|
14533
14546
|
};
|
|
14534
14547
|
|
|
@@ -14624,27 +14637,31 @@ var defaultTextOverrides = {
|
|
|
14624
14637
|
};
|
|
14625
14638
|
var Table = function (_a) {
|
|
14626
14639
|
var _b, _c, _d, _e, _f;
|
|
14627
|
-
var className = _a.className, collapsibleSections = _a.collapsibleSections, tableData = _a.tableData, hideDetails = _a.hideDetails, onModalOpen = _a.onModalOpen, onSelectionChanged = _a.onSelectionChanged,
|
|
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;
|
|
14628
14641
|
var textOverrides = __assign(__assign({}, defaultTextOverrides), definedTextOverrides);
|
|
14629
14642
|
var isMobile = useMediaQuery('BELOW_MOBILE');
|
|
14630
|
-
var
|
|
14631
|
-
var
|
|
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];
|
|
14632
14645
|
var containerRef = require$$0.useRef(null);
|
|
14633
14646
|
var headerRef = require$$0.useRef(null);
|
|
14634
14647
|
var columnsLength = tableData[0].rows[0].length;
|
|
14635
14648
|
useScrollSync(headerRef, containerRef, !isMobile);
|
|
14636
|
-
var
|
|
14649
|
+
var _l = useTableNavigation({
|
|
14637
14650
|
enabled: isMobile,
|
|
14638
14651
|
containerRef: containerRef,
|
|
14639
14652
|
onSelectionChanged: onSelectionChanged,
|
|
14640
|
-
}), activeSection =
|
|
14653
|
+
}), activeSection = _l.activeSection, navigateTable = _l.navigateTable;
|
|
14641
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];
|
|
14642
|
-
var
|
|
14655
|
+
var currentActiveSectionReplacements = (currentActiveSection.cellId &&
|
|
14656
|
+
(cellReplacements === null || cellReplacements === void 0 ? void 0 : cellReplacements[currentActiveSection.cellId])) ||
|
|
14657
|
+
{};
|
|
14658
|
+
var activeCellProps = __assign(__assign({}, currentActiveSection), currentActiveSectionReplacements);
|
|
14659
|
+
var handleOpenModal = require$$0.useCallback(function (_a) {
|
|
14643
14660
|
var body = _a.body, title = _a.title;
|
|
14644
14661
|
onModalOpen === null || onModalOpen === void 0 ? void 0 : onModalOpen({ body: body, title: title });
|
|
14645
14662
|
setInfoModalData({ body: body, title: title });
|
|
14646
|
-
};
|
|
14647
|
-
return (jsxRuntime.jsxs("div", { className: classNames$1(styles$3.wrapper, 'bg-white'), children: [isMobile ? (jsxRuntime.jsx(TableControls, { activeSection: activeSection, columnsLength: columnsLength, navigateTable: navigateTable, stickyHeaderTopOffset: stickyHeaderTopOffset, children: jsxRuntime.jsx(TableCell, __assign({},
|
|
14663
|
+
}, []);
|
|
14664
|
+
return (jsxRuntime.jsxs("div", { className: classNames$1(styles$3.wrapper, 'bg-white'), children: [isMobile ? (jsxRuntime.jsx(TableControls, { activeSection: activeSection, columnsLength: columnsLength, navigateTable: navigateTable, stickyHeaderTopOffset: stickyHeaderTopOffset, children: jsxRuntime.jsx(TableCell, __assign({}, (isBaseCell(currentActiveSection)
|
|
14648
14665
|
? {
|
|
14649
14666
|
openModal: function (body) {
|
|
14650
14667
|
return handleOpenModal({
|
|
@@ -14653,7 +14670,7 @@ var Table = function (_a) {
|
|
|
14653
14670
|
});
|
|
14654
14671
|
},
|
|
14655
14672
|
}
|
|
14656
|
-
: {}), { 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
|
|
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: {
|
|
14657
14674
|
buttonWrapper: 'm8 mt32',
|
|
14658
14675
|
title: 'd-flex gap8 ai-center jc-center',
|
|
14659
14676
|
wrapper: 'bg-grey-200',
|