@popsure/dirty-swan 0.49.1 → 0.49.2
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 +43 -43
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/comparisonTable/hooks/useComparisonTable.d.ts +0 -1
- package/dist/cjs/lib/components/dateSelector/index.d.ts +2 -0
- package/dist/esm/components/comparisonTable/components/TableArrows/index.js +6 -4
- package/dist/esm/components/comparisonTable/components/TableArrows/index.js.map +1 -1
- package/dist/esm/components/comparisonTable/index.js +14 -25
- package/dist/esm/components/comparisonTable/index.js.map +1 -1
- package/dist/esm/components/dateSelector/index.js +23 -15
- package/dist/esm/components/dateSelector/index.js.map +1 -1
- package/dist/esm/components/dateSelector/index.test.js +36 -2
- package/dist/esm/components/dateSelector/index.test.js.map +1 -1
- package/dist/esm/lib/components/comparisonTable/hooks/useComparisonTable.d.ts +0 -1
- package/dist/esm/lib/components/dateSelector/index.d.ts +2 -0
- package/package.json +3 -3
- package/src/lib/components/comparisonTable/components/TableArrows/index.tsx +2 -2
- package/src/lib/components/comparisonTable/components/TableArrows/style.module.scss +4 -6
- package/src/lib/components/comparisonTable/hooks/useComparisonTable.ts +0 -19
- package/src/lib/components/comparisonTable/index.tsx +3 -4
- package/src/lib/components/dateSelector/index.test.tsx +32 -2
- package/src/lib/components/dateSelector/index.tsx +40 -21
|
@@ -4,7 +4,6 @@ export declare const useComparisonTable: ({ onSelectionChanged, }: {
|
|
|
4
4
|
onSelectionChanged?: ((selectedIndex: number) => void) | undefined;
|
|
5
5
|
}) => {
|
|
6
6
|
headerWidth: number;
|
|
7
|
-
headerId: string;
|
|
8
7
|
contentContainerRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
9
8
|
selectedSection: string;
|
|
10
9
|
setSelectedSection: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
@@ -22,6 +22,8 @@ export interface DateSelectorProps {
|
|
|
22
22
|
year?: string;
|
|
23
23
|
yearFormat?: string;
|
|
24
24
|
error?: string;
|
|
25
|
+
errorBeforeMinYear?: string;
|
|
26
|
+
errorAfterMaxYear?: string;
|
|
25
27
|
};
|
|
26
28
|
firstDayOfWeek?: number;
|
|
27
29
|
inputProps?: (key: keyof CalendarDate) => Partial<DateSelectorInputProps>;
|
|
@@ -4,8 +4,8 @@ import { c as classNames } from '../../../../index-6ea95111.js';
|
|
|
4
4
|
import ArrowIcon from './Arrow.js';
|
|
5
5
|
import { s as styleInject } from '../../../../style-inject.es-1f59c1d0.js';
|
|
6
6
|
|
|
7
|
-
var css_248z = ".style-module_container__3BxOi {\n position: absolute;\n width: 100%;\n height: 100%;\n padding: 0 16px;\n justify-content: space-between;\n align-items: center;\n display: flex;\n}\n@media (min-width: 34rem) {\n .style-module_container__3BxOi {\n display: none;\n }\n}\n\n.style-module_next__3yJsi {\n transform: rotate(-90deg);\n}\n\n.style-module_prev__3rIR_ {\n transform: rotate(90deg);\n}\n\n.style-module_arrow__1tlbD {\n width: 32px;\n height: 32px;\n z-index: 3;\n padding: 0;\n border-radius: 50%;\n background-color: #f5f6fb;\n justify-content: center;\n align-items: center;\n stroke: #ebebff;\n}\n.style-module_arrow__1tlbD:hover, .style-module_arrow__1tlbD:focus {\n background-color: #f5f6fb;\n cursor: not-allowed;\n}\n
|
|
8
|
-
var styles = {"container":"style-module_container__3BxOi","next":"style-module_next__3yJsi","prev":"style-module_prev__3rIR_","arrow":"style-module_arrow__1tlbD","active":"style-module_active__2kklB"};
|
|
7
|
+
var css_248z = ".style-module_container__3BxOi {\n position: absolute;\n width: 100%;\n height: 100%;\n padding: 0 16px;\n justify-content: space-between;\n align-items: center;\n display: flex;\n}\n@media (min-width: 34rem) {\n .style-module_container__3BxOi {\n display: none;\n }\n}\n\n.style-module_next__3yJsi {\n transform: rotate(-90deg);\n}\n\n.style-module_prev__3rIR_ {\n transform: rotate(90deg);\n}\n\n.style-module_arrow__1tlbD {\n width: 32px;\n height: 32px;\n z-index: 3;\n padding: 0;\n border-radius: 50%;\n background-color: #f5f6fb;\n justify-content: center;\n align-items: center;\n stroke: #ebebff;\n}\n.style-module_arrow__1tlbD:hover, .style-module_arrow__1tlbD:focus {\n background-color: #f5f6fb;\n cursor: not-allowed;\n}\n\n.style-module_active__2kklB {\n stroke: #8e8cee;\n}\n.style-module_active__2kklB:hover, .style-module_active__2kklB:focus {\n background-color: #f5f6fb;\n cursor: pointer;\n}\n\n.style-module_noPointerEvents__21KuB {\n pointer-events: none;\n}";
|
|
8
|
+
var styles = {"container":"style-module_container__3BxOi","next":"style-module_next__3yJsi","prev":"style-module_prev__3rIR_","arrow":"style-module_arrow__1tlbD","active":"style-module_active__2kklB","noPointerEvents":"style-module_noPointerEvents__21KuB"};
|
|
9
9
|
styleInject(css_248z);
|
|
10
10
|
|
|
11
11
|
var TableArrows = function (props) {
|
|
@@ -14,10 +14,12 @@ var TableArrows = function (props) {
|
|
|
14
14
|
var handleButtonClick = function (value) { return function () { return onClick(value); }; };
|
|
15
15
|
return (jsxs("div", __assign({ className: styles.container }, { children: [jsx("button", __assign({ onClick: handleButtonClick('prev'), className: classNames("p-btn--secondary d-flex", styles.prev, styles.arrow, (_a = {},
|
|
16
16
|
_a[styles.active] = active.left,
|
|
17
|
-
_a
|
|
17
|
+
_a[styles.noPointerEvents] = !active.left,
|
|
18
|
+
_a)) }, { children: jsx(ArrowIcon, {}, void 0) }), void 0),
|
|
18
19
|
jsx("button", __assign({ onClick: handleButtonClick('next'), className: classNames("p-btn--secondary d-flex", styles.next, styles.arrow, (_b = {},
|
|
19
20
|
_b[styles.active] = active.right,
|
|
20
|
-
_b
|
|
21
|
+
_b[styles.noPointerEvents] = !active.right,
|
|
22
|
+
_b)) }, { children: jsx(ArrowIcon, {}, void 0) }), void 0)] }), void 0));
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
export default TableArrows;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../src/lib/components/comparisonTable/components/TableArrows/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\n\nimport ArrowIcon from './Arrow';\nimport styles from './style.module.scss';\n\nexport type ArrowValues = 'prev' | 'next';\n\ninterface TableArrowsProps {\n onClick: (value: ArrowValues) => void;\n active: { left: boolean; right: boolean };\n}\n\nconst TableArrows = (props: TableArrowsProps) => {\n const { active, onClick } = props;\n const handleButtonClick = (value: ArrowValues) => () => onClick(value);\n\n return (\n <div className={styles.container}>\n <button\n onClick={handleButtonClick('prev')}\n className={classNames(\n `p-btn--secondary d-flex`,\n styles.prev,\n styles.arrow,\n {\n [styles.active]: active.left,\n }\n )}\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../src/lib/components/comparisonTable/components/TableArrows/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\n\nimport ArrowIcon from './Arrow';\nimport styles from './style.module.scss';\n\nexport type ArrowValues = 'prev' | 'next';\n\ninterface TableArrowsProps {\n onClick: (value: ArrowValues) => void;\n active: { left: boolean; right: boolean };\n}\n\nconst TableArrows = (props: TableArrowsProps) => {\n const { active, onClick } = props;\n const handleButtonClick = (value: ArrowValues) => () => onClick(value);\n\n return (\n <div className={styles.container}>\n <button\n onClick={handleButtonClick('prev')}\n className={classNames(\n `p-btn--secondary d-flex`,\n styles.prev,\n styles.arrow,\n {\n [styles.active]: active.left,\n [styles.noPointerEvents]: !active.left,\n }\n )}\n >\n <ArrowIcon />\n </button>\n <button\n onClick={handleButtonClick('next')}\n className={classNames(\n `p-btn--secondary d-flex`,\n styles.next,\n styles.arrow,\n {\n [styles.active]: active.right,\n [styles.noPointerEvents]: !active.right,\n }\n )}\n >\n <ArrowIcon />\n </button>\n </div>\n );\n};\n\nexport default TableArrows;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;IAaM,WAAW,GAAG,UAAC,KAAuB;;IAClC,IAAA,MAAM,GAAc,KAAK,OAAnB,EAAE,OAAO,GAAK,KAAK,QAAV,CAAW;IAClC,IAAM,iBAAiB,GAAG,UAAC,KAAkB,IAAK,OAAA,cAAM,OAAA,OAAO,CAAC,KAAK,CAAC,GAAA,GAAA,CAAC;IAEvE,QACEA,uBAAK,SAAS,EAAE,MAAM,CAAC,SAAS,iBAC9BC,yBACE,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAClC,SAAS,EAAE,UAAU,CACnB,yBAAyB,EACzB,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,KAAK;oBAEV,GAAC,MAAM,CAAC,MAAM,IAAG,MAAM,CAAC,IAAI;oBAC5B,GAAC,MAAM,CAAC,eAAe,IAAG,CAAC,MAAM,CAAC,IAAI;wBAEzC,gBAEDA,IAAC,SAAS,aAAG,YACN;YACTA,yBACE,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAClC,SAAS,EAAE,UAAU,CACnB,yBAAyB,EACzB,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,KAAK;oBAEV,GAAC,MAAM,CAAC,MAAM,IAAG,MAAM,CAAC,KAAK;oBAC7B,GAAC,MAAM,CAAC,eAAe,IAAG,CAAC,MAAM,CAAC,KAAK;wBAE1C,gBAEDA,IAAC,SAAS,aAAG,YACN,aACL,EACN;AACJ;;;;"}
|
|
@@ -12,7 +12,6 @@ export { default as TableRating } from './components/TableRating/index.js';
|
|
|
12
12
|
export { default as TableRowHeader } from './components/TableRowHeader/index.js';
|
|
13
13
|
export { default as TableTrueFalse } from './components/TableTrueFalse.js';
|
|
14
14
|
import { l as lodash_debounce } from '../../index-1463d5e9.js';
|
|
15
|
-
import { g as generateId } from '../../index-fb46adf9.js';
|
|
16
15
|
import { s as styleInject } from '../../style-inject.es-1f59c1d0.js';
|
|
17
16
|
import { AccordionItem } from './components/AccordionItem/AccordionItem.js';
|
|
18
17
|
import './components/TableArrows/Arrow.js';
|
|
@@ -788,7 +787,7 @@ var ScrollSyncPane = function (_Component) {
|
|
|
788
787
|
}
|
|
789
788
|
};
|
|
790
789
|
|
|
791
|
-
_this.childRef = (0, _react.createRef)();
|
|
790
|
+
_this.childRef = props.innerRef ? props.innerRef : (0, _react.createRef)();
|
|
792
791
|
return _this;
|
|
793
792
|
}
|
|
794
793
|
|
|
@@ -839,7 +838,9 @@ var ScrollSyncPane = function (_Component) {
|
|
|
839
838
|
if (this.props.attachTo) {
|
|
840
839
|
return this.props.children;
|
|
841
840
|
}
|
|
842
|
-
return (0, _react.cloneElement)(_react.Children.only(this.props.children), {
|
|
841
|
+
return (0, _react.cloneElement)(_react.Children.only(this.props.children), {
|
|
842
|
+
ref: this.childRef
|
|
843
|
+
});
|
|
843
844
|
}
|
|
844
845
|
}]);
|
|
845
846
|
|
|
@@ -851,7 +852,9 @@ ScrollSyncPane.propTypes = {
|
|
|
851
852
|
children: _propTypes2.default.node.isRequired,
|
|
852
853
|
attachTo: _propTypes2.default.oneOfType([_propTypes2.default.func, _propTypes2.default.shape({ current: _propTypes2.default.any })]),
|
|
853
854
|
group: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.arrayOf(_propTypes2.default.string)]),
|
|
854
|
-
enabled: _propTypes2.default.bool
|
|
855
|
+
enabled: _propTypes2.default.bool,
|
|
856
|
+
innerRef: _propTypes2.default.oneOfType([// Either a function
|
|
857
|
+
_propTypes2.default.func, _propTypes2.default.shape({ current: _propTypes2.default.any })])
|
|
855
858
|
};
|
|
856
859
|
ScrollSyncPane.defaultProps = {
|
|
857
860
|
group: 'default',
|
|
@@ -1546,9 +1549,8 @@ var useComparisonTable = function (_a) {
|
|
|
1546
1549
|
var onSelectionChanged = _a.onSelectionChanged;
|
|
1547
1550
|
var _b = useState(false), showMore = _b[0], setShowMore = _b[1];
|
|
1548
1551
|
var _c = useState(1400), headerWidth = _c[0], setHeaderWidth = _c[1];
|
|
1549
|
-
var _d = useState(
|
|
1550
|
-
var _e = useState(
|
|
1551
|
-
var _f = useState(''), selectedSection = _f[0], setSelectedSection = _f[1];
|
|
1552
|
+
var _d = useState(0), selectedTabIndex = _d[0], setSelectedTabIndex = _d[1];
|
|
1553
|
+
var _e = useState(''), selectedSection = _e[0], setSelectedSection = _e[1];
|
|
1552
1554
|
var headerRef = useRef(null);
|
|
1553
1555
|
var contentContainerRef = useRef(null);
|
|
1554
1556
|
var observerRef = useRef(null);
|
|
@@ -1631,25 +1633,12 @@ var useComparisonTable = function (_a) {
|
|
|
1631
1633
|
return [2 /*return*/];
|
|
1632
1634
|
});
|
|
1633
1635
|
}); };
|
|
1634
|
-
useEffect(function () {
|
|
1635
|
-
if (headerRef.current) {
|
|
1636
|
-
return;
|
|
1637
|
-
}
|
|
1638
|
-
var headerById = document.getElementById(headerId);
|
|
1639
|
-
if (headerById) {
|
|
1640
|
-
scrollContainerCallbackRef(headerById);
|
|
1641
|
-
}
|
|
1642
|
-
}, [headerId, scrollContainerCallbackRef]);
|
|
1643
|
-
useEffect(function () {
|
|
1644
|
-
setHeaderId(generateId());
|
|
1645
|
-
}, []);
|
|
1646
1636
|
useEffect(function () {
|
|
1647
1637
|
onSelectionChanged === null || onSelectionChanged === void 0 ? void 0 : onSelectionChanged(selectedTabIndex);
|
|
1648
1638
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1649
1639
|
}, [selectedTabIndex]);
|
|
1650
1640
|
return {
|
|
1651
1641
|
headerWidth: headerWidth,
|
|
1652
|
-
headerId: headerId,
|
|
1653
1642
|
contentContainerRef: contentContainerRef,
|
|
1654
1643
|
selectedSection: selectedSection,
|
|
1655
1644
|
setSelectedSection: setSelectedSection,
|
|
@@ -1669,20 +1658,20 @@ styleInject(css_248z);
|
|
|
1669
1658
|
var ComparisonTable = function (props) {
|
|
1670
1659
|
var _a;
|
|
1671
1660
|
var headers = props.headers, data = props.data, hideDetails = props.hideDetails, _b = props.hideDetailsCaption, hideDetailsCaption = _b === void 0 ? 'Hide details' : _b, _c = props.showDetailsCaption, showDetailsCaption = _c === void 0 ? 'Show details' : _c, classNameOverrides = props.classNameOverrides, hideScrollBars = props.hideScrollBars, hideScrollBarsMobile = props.hideScrollBarsMobile, collapsibleSections = props.collapsibleSections, cellWidth = props.cellWidth, firstColumnWidth = props.firstColumnWidth, stickyHeaderTopOffset = props.stickyHeaderTopOffset, growContent = props.growContent, onSelectionChanged = props.onSelectionChanged;
|
|
1672
|
-
var _d = useComparisonTable({ onSelectionChanged: onSelectionChanged }), headerWidth = _d.headerWidth, contentContainerRef = _d.contentContainerRef, selectedSection = _d.selectedSection, setSelectedSection = _d.setSelectedSection, selectedTabIndex = _d.selectedTabIndex, scrollContainerCallbackRef = _d.scrollContainerCallbackRef, handleArrowsClick = _d.handleArrowsClick, toggleMoreRows = _d.toggleMoreRows, showMore = _d.showMore
|
|
1661
|
+
var _d = useComparisonTable({ onSelectionChanged: onSelectionChanged }), headerWidth = _d.headerWidth, contentContainerRef = _d.contentContainerRef, selectedSection = _d.selectedSection, setSelectedSection = _d.setSelectedSection, selectedTabIndex = _d.selectedTabIndex, scrollContainerCallbackRef = _d.scrollContainerCallbackRef, handleArrowsClick = _d.handleArrowsClick, toggleMoreRows = _d.toggleMoreRows, showMore = _d.showMore;
|
|
1673
1662
|
var cssVariablesStyle = __assign(__assign(__assign(__assign({ '--tableWidth': headerWidth + "px" }, (cellWidth ? { '--cellWidth': cellWidth + "px" } : {})), (firstColumnWidth
|
|
1674
1663
|
? { '--firstColumnWidth': firstColumnWidth + "px" }
|
|
1675
1664
|
: {})), (stickyHeaderTopOffset
|
|
1676
1665
|
? { '--stickyHeaderTopOffset': stickyHeaderTopOffset + "px" }
|
|
1677
1666
|
: {})), (growContent ? { '--growContent': '100%' } : {}));
|
|
1678
|
-
return (jsx(dist.exports.ScrollSync,
|
|
1667
|
+
return (jsx(dist.exports.ScrollSync, { children: jsxs("div", __assign({ style: cssVariablesStyle, className: classNames((_a = {},
|
|
1679
1668
|
_a[baseStyles.noScrollBars] = hideScrollBars,
|
|
1680
1669
|
_a[baseStyles.noScrollBarsMobile] = hideScrollBarsMobile,
|
|
1681
|
-
_a)) }, { children: [jsx("div", __assign({ className: classNames(baseStyles.header, classNameOverrides === null || classNameOverrides === void 0 ? void 0 : classNameOverrides.header) }, { children: jsx(dist.exports.ScrollSyncPane, { children: jsx("div", __assign({
|
|
1670
|
+
_a)) }, { children: [jsx("div", __assign({ className: classNames(baseStyles.header, classNameOverrides === null || classNameOverrides === void 0 ? void 0 : classNameOverrides.header) }, { children: jsx(dist.exports.ScrollSyncPane, __assign({ innerRef: scrollContainerCallbackRef }, { children: jsx("div", __assign({ className: classNames(baseStyles.container) }, { children: jsx("div", __assign({ className: classNames(baseStyles['overflow-container']) }, { children: jsxs("div", __assign({ className: baseStyles['group-container'] }, { children: [jsx(TableArrows, { onClick: handleArrowsClick, active: {
|
|
1682
1671
|
left: selectedTabIndex > 0,
|
|
1683
1672
|
right: selectedTabIndex < data.length - 1,
|
|
1684
1673
|
} }, void 0),
|
|
1685
|
-
jsx(Row, { rowId: "table-header-row", cell: headers[0].cells[0], data: data, isRowHeader: true, cellClassName: classNameOverrides === null || classNameOverrides === void 0 ? void 0 : classNameOverrides.headerCell }, "table-header-row")] }), void 0) }), void 0) }), void 0) }, void 0) }), void 0),
|
|
1674
|
+
jsx(Row, { rowId: "table-header-row", cell: headers[0].cells[0], data: data, isRowHeader: true, cellClassName: classNameOverrides === null || classNameOverrides === void 0 ? void 0 : classNameOverrides.headerCell }, "table-header-row")] }), void 0) }), void 0) }), void 0) }), void 0) }), void 0),
|
|
1686
1675
|
jsxs("div", __assign({ ref: contentContainerRef }, { children: [Array.isArray(headers) &&
|
|
1687
1676
|
headers
|
|
1688
1677
|
.filter(function (headerGroup) { return !hideDetails || showMore || headerGroup.default; })
|
|
@@ -1708,7 +1697,7 @@ var ComparisonTable = function (props) {
|
|
|
1708
1697
|
*/
|
|
1709
1698
|
headerGroup.label && !collapsibleSections && (jsx("div", __assign({ className: baseStyles['group-title'] }, { children: jsx("h4", __assign({ className: "p-h4 " + baseStyles.sticky }, { children: headerGroup.label }), void 0) }), void 0)), content] }), void 0) }), void 0) }), void 0) }, void 0) }), idString)) }, idString));
|
|
1710
1699
|
}),
|
|
1711
|
-
hideDetails && (jsx("div", __assign({ className: classNames(baseStyles['show-details-container'], baseStyles.sticky, 'mt48') }, { children: jsx("div", { children: jsxs("button", __assign({ className: classNames('w100 d-flex p-a p-h4 c-pointer', baseStyles['show-details-button'], classNameOverrides === null || classNameOverrides === void 0 ? void 0 : classNameOverrides.hideDetailsButton), onClick: toggleMoreRows, type: "button" }, { children: [showMore ? hideDetailsCaption : showDetailsCaption, jsx(Chevron, { className: showMore ? '' : baseStyles['icon-inverted'] }, void 0)] }), void 0) }, void 0) }), void 0))] }), void 0)] }), void 0) }
|
|
1700
|
+
hideDetails && (jsx("div", __assign({ className: classNames(baseStyles['show-details-container'], baseStyles.sticky, 'mt48') }, { children: jsx("div", { children: jsxs("button", __assign({ className: classNames('w100 d-flex p-a p-h4 c-pointer', baseStyles['show-details-button'], classNameOverrides === null || classNameOverrides === void 0 ? void 0 : classNameOverrides.hideDetailsButton), onClick: toggleMoreRows, type: "button" }, { children: [showMore ? hideDetailsCaption : showDetailsCaption, jsx(Chevron, { className: showMore ? '' : baseStyles['icon-inverted'] }, void 0)] }), void 0) }, void 0) }), void 0))] }), void 0)] }), void 0) }, void 0));
|
|
1712
1701
|
};
|
|
1713
1702
|
|
|
1714
1703
|
export { ComparisonTable };
|