@popsure/dirty-swan 0.66.22 → 0.66.23

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 (23) hide show
  1. package/dist/cjs/index.js +28 -18
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/lib/components/table/Table.stories.d.ts +4 -0
  4. package/dist/cjs/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +1 -1
  5. package/dist/esm/components/table/Table.stories.js +134 -1
  6. package/dist/esm/components/table/Table.stories.js.map +1 -1
  7. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js +1 -1
  8. package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js.map +1 -1
  9. package/dist/esm/components/table/components/TableCell/TableCell.js +4 -5
  10. package/dist/esm/components/table/components/TableCell/TableCell.js.map +1 -1
  11. package/dist/esm/components/table/components/TableCell/TableCell.test.js +14 -0
  12. package/dist/esm/components/table/components/TableCell/TableCell.test.js.map +1 -1
  13. package/dist/esm/components/table/components/TableContents/Collapsible.js +23 -12
  14. package/dist/esm/components/table/components/TableContents/Collapsible.js.map +1 -1
  15. package/dist/esm/lib/components/table/Table.stories.d.ts +4 -0
  16. package/dist/esm/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +1 -1
  17. package/package.json +1 -1
  18. package/src/lib/components/table/Table.stories.tsx +158 -0
  19. package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx +10 -1
  20. package/src/lib/components/table/components/TableCell/TableCell.module.scss +4 -0
  21. package/src/lib/components/table/components/TableCell/TableCell.test.tsx +18 -0
  22. package/src/lib/components/table/components/TableCell/TableCell.tsx +3 -3
  23. package/src/lib/components/table/components/TableContents/Collapsible.tsx +23 -11
package/dist/cjs/index.js CHANGED
@@ -22625,8 +22625,8 @@ var Accordion = function (_a) {
22625
22625
  }) }));
22626
22626
  };
22627
22627
 
22628
- var css_248z$b = ".TableCell-module_th__2rjCU {\n vertical-align: middle;\n scroll-snap-align: end;\n width: 50%;\n padding: 28px 24px;\n}\n@media (min-width: 34rem) {\n .TableCell-module_th__2rjCU {\n width: auto;\n scroll-snap-align: unset;\n }\n}\n.TableCell-module_thNavigation__qZ2sY {\n width: 100%;\n}\n@media (min-width: 34rem) {\n .TableCell-module_thNavigation__qZ2sY {\n width: auto;\n }\n}\n\n.TableCell-module_navigationTitle__2FiRB {\n padding-left: 0;\n}\n\n.TableCell-module_headerCell__aVTIn {\n vertical-align: top;\n}\n\n.TableCell-module_fixedCell__cL3-m {\n position: sticky;\n left: 0;\n z-index: 2;\n padding-left: 0;\n}\n\n.TableCell-module_selectedColumnTop__1GcJz {\n border-radius: 16px 16px 0 0;\n}\n\n.TableCell-module_selectedColumnBottom__qiMke {\n border-radius: 0 0 16px 16px;\n}\n\n.TableCell-module_fixedCard__2LO8s {\n position: sticky;\n left: 0;\n right: 0;\n z-index: 2;\n width: 100%;\n}";
22629
- var styles$b = {"th":"TableCell-module_th__2rjCU","thNavigation":"TableCell-module_thNavigation__qZ2sY","navigationTitle":"TableCell-module_navigationTitle__2FiRB","headerCell":"TableCell-module_headerCell__aVTIn","fixedCell":"TableCell-module_fixedCell__cL3-m","selectedColumnTop":"TableCell-module_selectedColumnTop__1GcJz","selectedColumnBottom":"TableCell-module_selectedColumnBottom__qiMke","fixedCard":"TableCell-module_fixedCard__2LO8s"};
22628
+ var css_248z$b = ".TableCell-module_th__2rjCU {\n vertical-align: middle;\n scroll-snap-align: end;\n width: 50%;\n padding: 28px 24px;\n}\n@media (min-width: 34rem) {\n .TableCell-module_th__2rjCU {\n width: auto;\n scroll-snap-align: unset;\n }\n}\n.TableCell-module_thNavigation__qZ2sY {\n width: 100%;\n}\n@media (min-width: 34rem) {\n .TableCell-module_thNavigation__qZ2sY {\n width: auto;\n }\n}\n\n.TableCell-module_navigationTitle__2FiRB {\n padding-left: 0;\n}\n\n.TableCell-module_headerCell__aVTIn {\n vertical-align: top;\n}\n\n.TableCell-module_subtitleCell__1DzfG {\n vertical-align: middle;\n}\n\n.TableCell-module_fixedCell__cL3-m {\n position: sticky;\n left: 0;\n z-index: 2;\n padding-left: 0;\n}\n\n.TableCell-module_selectedColumnTop__1GcJz {\n border-radius: 16px 16px 0 0;\n}\n\n.TableCell-module_selectedColumnBottom__qiMke {\n border-radius: 0 0 16px 16px;\n}\n\n.TableCell-module_fixedCard__2LO8s {\n position: sticky;\n left: 0;\n right: 0;\n z-index: 2;\n width: 100%;\n}";
22629
+ var styles$b = {"th":"TableCell-module_th__2rjCU","thNavigation":"TableCell-module_thNavigation__qZ2sY","navigationTitle":"TableCell-module_navigationTitle__2FiRB","headerCell":"TableCell-module_headerCell__aVTIn","subtitleCell":"TableCell-module_subtitleCell__1DzfG","fixedCell":"TableCell-module_fixedCell__cL3-m","selectedColumnTop":"TableCell-module_selectedColumnTop__1GcJz","selectedColumnBottom":"TableCell-module_selectedColumnBottom__qiMke","fixedCard":"TableCell-module_fixedCard__2LO8s"};
22630
22630
  styleInject(css_248z$b);
22631
22631
 
22632
22632
  var css_248z$a = "@media (max-width: 34rem) {\n .BaseCell-module_maxWidth__14Cly {\n max-width: calc(100% - 64px);\n }\n}\n\n.BaseCell-module_icon__1775U {\n margin: 2px;\n}\n\n.BaseCell-module_description__3_kfe {\n word-break: break-word;\n}";
@@ -22671,7 +22671,7 @@ var BaseCell = function (_a) {
22671
22671
  'jc-center': align === 'center',
22672
22672
  }), children: jsxRuntime.jsxs("div", { className: classNames('d-flex fd-column', alignClassName, (_b = {},
22673
22673
  _b[styles$a.maxWidth] = modalContent && align === 'center',
22674
- _b)), children: [jsxRuntime.jsxs("div", { className: "d-flex ai-center", children: [(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) ? 'neutral-900' : 'neutral-400', className: styles$a.icon, size: (rating === null || rating === void 0 ? void 0 : rating.type) === 'zap' ? 16 : 14 }, value)); }) })), checkmarkValue !== undefined && (jsxRuntime.jsx("span", { className: 'd-inline-block mx8', title: checkmarkValue ? 'Yes' : 'No', children: checkmarkValue ? (jsxRuntime.jsx(CheckThickIcon, { noMargin: true, "data-testid": "table-cell-boolean-yes", size: 24, "aria-hidden": true, color: "neutral-900" })) : (jsxRuntime.jsx(XIcon, { noMargin: true, "data-testid": "table-cell-boolean-no", size: 24, "aria-hidden": true, color: "neutral-500" })) })), jsxRuntime.jsxs("div", { className: "d-flex ai-center", children: [text && fontVariant === 'NORMAL' && (jsxRuntime.jsx("div", { className: classNames("p-p d-inline", { 'ml8': align !== 'left' }), "data-testid": "table-cell-text", children: text })), text && fontVariant === 'PRICE' && (jsxRuntime.jsx("div", { className: "p-h2 tc-neutral-900", "data-testid": "table-cell-content", children: text })), text && fontVariant === 'TITLE' && (jsxRuntime.jsx("h2", { "aria-hidden": true, className: "tc-grey-800 p-h2 p--serif", children: text })), modalContent && openModal && (jsxRuntime.jsx("span", { className: "ml8", children: jsxRuntime.jsx(TableInfoButton, { onClick: function () {
22674
+ _b)), children: [jsxRuntime.jsxs("div", { className: "d-flex ai-center", children: [(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) ? 'neutral-900' : 'neutral-400', className: styles$a.icon, size: (rating === null || rating === void 0 ? void 0 : rating.type) === 'zap' ? 16 : 14 }, value)); }) })), checkmarkValue !== undefined && (jsxRuntime.jsx("span", { className: 'd-inline-block mx8', title: checkmarkValue ? 'Yes' : 'No', children: checkmarkValue ? (jsxRuntime.jsx(CheckThickIcon, { noMargin: true, "data-testid": "table-cell-boolean-yes", size: 24, "aria-hidden": true, color: "neutral-900" })) : (jsxRuntime.jsx(XIcon, { noMargin: true, "data-testid": "table-cell-boolean-no", size: 24, "aria-hidden": true, color: "neutral-500" })) })), jsxRuntime.jsxs("div", { className: "d-flex ai-center", children: [text && fontVariant === 'NORMAL' && (jsxRuntime.jsx("div", { className: classNames("p-p d-inline", { 'ml8': align !== 'left' }), "data-testid": "table-cell-text", children: text })), text && fontVariant === 'PRICE' && (jsxRuntime.jsx("div", { className: "p-h2 tc-neutral-900", "data-testid": "table-cell-content", children: text })), text && fontVariant === 'TITLE' && (jsxRuntime.jsx("h2", { "aria-hidden": true, className: "tc-grey-800 p-h2 p--serif", children: text })), text && fontVariant === 'SUBTITLE' && (jsxRuntime.jsx("h2", { "aria-hidden": true, className: "tc-grey-800 p-h4", children: text })), modalContent && openModal && (jsxRuntime.jsx("span", { className: "ml8", children: jsxRuntime.jsx(TableInfoButton, { onClick: function () {
22675
22675
  return openModal({
22676
22676
  title: modalTitle,
22677
22677
  body: modalContent,
@@ -22748,15 +22748,14 @@ var TableCell = React.memo(function (_a) {
22748
22748
  'ta-left': isFirstCellInRow
22749
22749
  },
22750
22750
  _b[styles$b.headerCell] = isHeader,
22751
+ _b[styles$b.subtitleCell] = !cellProps.type && cellProps.fontVariant === 'SUBTITLE',
22751
22752
  _b[styles$b.thNavigation] = isNavigation,
22752
22753
  _b[styles$b.navigationTitle] = isNavigation && isTopLeftCell,
22753
22754
  _b[styles$b.fixedCell] = isFirstCellInRow && colSpan < 1,
22754
22755
  _b[styles$b.fixedCard] = cellProps.type === 'CARD',
22755
22756
  _b[styles$b.selectedColumnTop] = selectedColumnPosition === 'top',
22756
22757
  _b[styles$b.selectedColumnBottom] = selectedColumnPosition === 'bottom',
22757
- _b)), colSpan: isBelowDesktop && cellProps.type === 'CARD' ? 2 : colSpan, children: [!cellProps.type && (jsxRuntime.jsx(BaseCell, __assign({}, cellProps, { fontVariant: isTopLeftCell
22758
- ? 'TITLE'
22759
- : (_c = cellProps.fontVariant) !== null && _c !== void 0 ? _c : 'NORMAL' }))), cellProps.type === 'CTA' && (jsxRuntime.jsx(CTACell, __assign({}, cellProps, { centered: isNavigation }))), cellProps.type === 'BUTTON' && jsxRuntime.jsx(ButtonCell, __assign({}, cellProps)), cellProps.type === 'CARD' && jsxRuntime.jsx(CardCell, __assign({}, cellProps))] })));
22758
+ _b)), colSpan: isBelowDesktop && cellProps.type === 'CARD' ? 2 : colSpan, children: [!cellProps.type && (jsxRuntime.jsx(BaseCell, __assign({}, cellProps, { fontVariant: (_c = cellProps.fontVariant) !== null && _c !== void 0 ? _c : (isTopLeftCell ? 'TITLE' : 'NORMAL') }))), cellProps.type === 'CTA' && (jsxRuntime.jsx(CTACell, __assign({}, cellProps, { centered: isNavigation }))), cellProps.type === 'BUTTON' && jsxRuntime.jsx(ButtonCell, __assign({}, cellProps)), cellProps.type === 'CARD' && jsxRuntime.jsx(CardCell, __assign({}, cellProps))] })));
22760
22759
  });
22761
22760
 
22762
22761
  var css_248z$6 = ".Table-module_wrapper__2MMNq {\n position: relative;\n border: 1px solid #f2f2f8;\n border-radius: 12px;\n padding: 24px;\n}\n\n.Table-module_container__3VFLP {\n overflow-x: auto;\n overflow-y: hidden;\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* 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_cardButton__3aMuL div {\n background-color: #FAF8F5;\n}\n.Table-module_cardButton__3aMuL:hover div {\n border-color: transparent !important;\n outline-color: transparent !important;\n box-shadow: none !important;\n background-color: #FCF7EF !important;\n}\n.Table-module_cardButton__3aMuL:focus-visible div {\n background-color: #FCF7EF !important;\n}\n\n.Table-module_stickyHeader__2uEpP {\n display: flex;\n position: sticky;\n z-index: 9;\n}\n\n@media (max-width: 34rem) {\n .Table-module_modalContent__1PNgv {\n min-width: initial;\n }\n}";
@@ -22856,6 +22855,18 @@ var css_248z$3 = ".Collapsible-module_collapsible__2wWKs {\n display: flow-root
22856
22855
  var styles$3 = {"collapsible":"Collapsible-module_collapsible__2wWKs"};
22857
22856
  styleInject(css_248z$3);
22858
22857
 
22858
+ var measureHeight = function (element) {
22859
+ var height = 0;
22860
+ for (var _i = 0, _a = Array.from(element.children); _i < _a.length; _i++) {
22861
+ var child = _a[_i];
22862
+ var childStyles = getComputedStyle(child);
22863
+ height +=
22864
+ child.getBoundingClientRect().height +
22865
+ (parseFloat(childStyles.marginTop) || 0) +
22866
+ (parseFloat(childStyles.marginBottom) || 0);
22867
+ }
22868
+ return Math.ceil(height);
22869
+ };
22859
22870
  var Collapsible = function (_a) {
22860
22871
  var _b;
22861
22872
  var children = _a.children, isExpanded = _a.isExpanded, onTransitionEnd = _a.onTransitionEnd;
@@ -22864,24 +22875,23 @@ var Collapsible = function (_a) {
22864
22875
  var containerRef = React.useRef(null);
22865
22876
  React.useEffect(function () {
22866
22877
  if (!observerRef.current) {
22867
- observerRef.current = new ResizeObserver(function (entries) {
22868
- entries.forEach(function (entry) {
22869
- var scrollheight = entry.target.scrollHeight;
22870
- setHeight(scrollheight);
22871
- });
22878
+ observerRef.current = new ResizeObserver(function () {
22879
+ if (containerRef.current) {
22880
+ setHeight(measureHeight(containerRef.current));
22881
+ }
22872
22882
  });
22873
22883
  }
22874
22884
  if (containerRef.current) {
22875
22885
  observerRef.current.observe(containerRef.current);
22876
- var scrollheight = containerRef.current.scrollHeight;
22877
- setHeight(scrollheight);
22886
+ Array.from(containerRef.current.children).forEach(function (child) {
22887
+ var _a;
22888
+ (_a = observerRef.current) === null || _a === void 0 ? void 0 : _a.observe(child);
22889
+ });
22890
+ setHeight(measureHeight(containerRef.current));
22878
22891
  }
22879
22892
  return function () {
22880
- var _a, _b;
22881
- if (containerRef.current) {
22882
- (_a = observerRef.current) === null || _a === void 0 ? void 0 : _a.unobserve(containerRef.current);
22883
- }
22884
- (_b = observerRef.current) === null || _b === void 0 ? void 0 : _b.disconnect();
22893
+ var _a;
22894
+ (_a = observerRef.current) === null || _a === void 0 ? void 0 : _a.disconnect();
22885
22895
  };
22886
22896
  }, [containerRef.current]);
22887
22897
  return (jsxRuntime.jsx("div", { className: classNames(styles$3.collapsible, (_b = {},