@thecb/components 7.8.3-beta.2 → 7.8.4

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.d.ts CHANGED
@@ -259,6 +259,7 @@ interface ClusterProps {
259
259
  justifySelf?: string;
260
260
  alignSelf?: string;
261
261
  flexGrow?: string;
262
+ innerWrapperAs?: string;
262
263
  }
263
264
 
264
265
  declare const Cluster: React.FC<Expand<ClusterProps> &
package/dist/index.esm.js CHANGED
@@ -6665,7 +6665,7 @@ var ClusterInnerWrapper = styled.div.withConfig({
6665
6665
  return childGap;
6666
6666
  });
6667
6667
 
6668
- var _excluded$6 = ["justify", "align", "childGap", "minHeight", "minWidth", "nowrap", "overflow", "justifySelf", "alignSelf", "flexGrow", "extraStyles", "children"];
6668
+ var _excluded$6 = ["justify", "align", "childGap", "minHeight", "minWidth", "nowrap", "overflow", "justifySelf", "alignSelf", "flexGrow", "extraStyles", "children", "innerWrapperAs"];
6669
6669
  /*
6670
6670
  Cluster components suit any groups of elements that differ in
6671
6671
  length and are liable to wrap. Buttons that appear together at the
@@ -6689,6 +6689,8 @@ var Cluster = function Cluster(_ref) {
6689
6689
  flexGrow = _ref.flexGrow,
6690
6690
  extraStyles = _ref.extraStyles,
6691
6691
  children = _ref.children,
6692
+ _ref$innerWrapperAs = _ref.innerWrapperAs,
6693
+ innerWrapperAs = _ref$innerWrapperAs === void 0 ? "div" : _ref$innerWrapperAs,
6692
6694
  rest = _objectWithoutProperties(_ref, _excluded$6);
6693
6695
 
6694
6696
  return /*#__PURE__*/React.createElement(ClusterWrapper, _extends({
@@ -6704,7 +6706,8 @@ var Cluster = function Cluster(_ref) {
6704
6706
  childGap: childGap,
6705
6707
  minHeight: minHeight,
6706
6708
  minWidth: minWidth,
6707
- $nowrap: nowrap
6709
+ $nowrap: nowrap,
6710
+ as: innerWrapperAs
6708
6711
  }, safeChildren(children, /*#__PURE__*/React.createElement(Fragment$1, null))));
6709
6712
  };
6710
6713
 
@@ -46550,6 +46553,7 @@ var PrevNextPlaceholder = function PrevNextPlaceholder(_ref) {
46550
46553
 
46551
46554
  var PrevNextButton = function PrevNextButton(_ref2) {
46552
46555
  var action = _ref2.action,
46556
+ ariaLabel = _ref2.ariaLabel,
46553
46557
  arrowColor = _ref2.arrowColor,
46554
46558
  borderRadius = _ref2.borderRadius,
46555
46559
  buttonHeight = _ref2.buttonHeight,
@@ -46559,12 +46563,14 @@ var PrevNextButton = function PrevNextButton(_ref2) {
46559
46563
  return /*#__PURE__*/React.createElement(Box, {
46560
46564
  padding: "0",
46561
46565
  minHeight: buttonHeight,
46562
- extraStyles: "max-height: ".concat(buttonHeight, ";")
46566
+ extraStyles: "max-height: ".concat(buttonHeight, ";"),
46567
+ as: "li"
46563
46568
  }, /*#__PURE__*/React.createElement(ButtonWithAction, {
46564
46569
  action: action,
46565
46570
  contentOverride: true,
46566
46571
  dataQa: type,
46567
- extraStyles: "\n background-color: ".concat(numberColor, ";\n border-color: ").concat(numberColor, ";\n border-radius: ").concat(borderRadius, ";\n margin: 0;\n max-height: ").concat(buttonHeight, ";\n min-height: 100%;\n min-width: ").concat(buttonWidth, ";\n padding: 0;\n &:focus {\n outline: none\n }\n ")
46572
+ "aria-label": ariaLabel,
46573
+ extraStyles: "\n background-color: ".concat(numberColor, ";\n border-color: ").concat(numberColor, ";\n border-radius: ").concat(borderRadius, ";\n margin: 0;\n max-height: ").concat(buttonHeight, ";\n min-height: 100%;\n min-width: ").concat(buttonWidth, ";\n padding: 0;\n ")
46568
46574
  }, /*#__PURE__*/React.createElement(Box, {
46569
46575
  padding: "0",
46570
46576
  extraStyles: type === "prev" && "transform: scaleX(-1)"
@@ -46588,26 +46594,30 @@ var getPagesPanel = function getPagesPanel(page, pagesCount) {
46588
46594
 
46589
46595
  if (page > space + 1) {
46590
46596
  pages.push({
46591
- isDelimiter: true
46597
+ isDelimiter: true,
46598
+ id: "first-delimiter"
46592
46599
  });
46593
46600
  }
46594
46601
 
46595
46602
  for (var j = Math.max(1, page - space) + 1; j < Math.min(lastPageNumber, page + space); j++) {
46596
46603
  pages.push({
46597
46604
  index: j,
46598
- isButton: true
46605
+ isButton: true,
46606
+ id: "page-".concat(j)
46599
46607
  });
46600
46608
  }
46601
46609
 
46602
46610
  if (page < lastPageNumber - space) {
46603
46611
  pages.push({
46604
- isDelimiter: true
46612
+ isDelimiter: true,
46613
+ id: "last-delimiter"
46605
46614
  });
46606
46615
  }
46607
46616
 
46608
46617
  pages.push({
46609
46618
  index: lastPageNumber,
46610
- isButton: true
46619
+ isButton: true,
46620
+ id: "page-".concat(lastPageNumber)
46611
46621
  });
46612
46622
  var activePage = pages.find(function (p) {
46613
46623
  return p.index === page;
@@ -46642,18 +46652,26 @@ var Pagination = function Pagination(_ref3) {
46642
46652
  pageNext = _ref3.pageNext,
46643
46653
  pagePrevious = _ref3.pagePrevious,
46644
46654
  setCurrentPage = _ref3.setCurrentPage,
46655
+ ariaLabel = _ref3.ariaLabel,
46645
46656
  themeValues = _ref3.themeValues;
46646
46657
 
46647
46658
  var _useContext = useContext(ThemeContext),
46648
46659
  isMobile = _useContext.isMobile;
46649
46660
 
46650
- var extraStyles = "\n min-width: ".concat(buttonWidth, "; min-height: 100%; padding: 0;\n border-radius: ").concat(borderRadius, ";\n &:hover, &:focus {\n text-decoration: none;\n > * > span {\n text-decoration: none;\n }\n }\n > * > span {\n color: ").concat(numberColor !== null && numberColor !== void 0 ? numberColor : themeValues.numberColor, "\n }\n margin: 0;\n &:hover {\n background-color: ").concat(themeValues.hoverBackgroundColor, "\n }\n &:focus {\n outline: none\n }\n ");
46651
- var extraDisabledStyles = "\n border: ".concat(activeBorderWidth, " solid ").concat(numberColor !== null && numberColor !== void 0 ? numberColor : themeValues.numberColor, ";\n color: ").concat(numberColor !== null && numberColor !== void 0 ? numberColor : themeValues.activeColor, ";\n background-color: ").concat(themeValues.activeBackgroundColor, ";\n &:focus {\n box-shadow: none;\n }\n &:hover {\n background-color: initial;\n }\n ");
46661
+ var extraStyles = "\n min-width: ".concat(buttonWidth, "; min-height: 100%; padding: 0;\n border-radius: ").concat(borderRadius, ";\n &:hover, &:focus {\n text-decoration: none;\n > * > span {\n text-decoration: none;\n }\n }\n > * > span {\n color: ").concat(numberColor !== null && numberColor !== void 0 ? numberColor : themeValues.numberColor, "\n }\n margin: 0;\n &:hover {\n background-color: ").concat(themeValues.hoverBackgroundColor, "\n }\n ");
46662
+ var currentPageStyles = "\n border: ".concat(activeBorderWidth, " solid ").concat(numberColor !== null && numberColor !== void 0 ? numberColor : themeValues.numberColor, ";\n color: ").concat(numberColor !== null && numberColor !== void 0 ? numberColor : themeValues.activeColor, ";\n background-color: ").concat(themeValues.activeBackgroundColor, ";\n &:focus {\n box-shadow: none;\n }\n &:hover {\n background-color: initial;\n border: ").concat(activeBorderWidth, " solid ").concat(numberColor !== null && numberColor !== void 0 ? numberColor : themeValues.numberColor, ";\n background-color: ").concat(themeValues.activeBackgroundColor, ";\n }\n ");
46652
46663
  return /*#__PURE__*/React.createElement(Cluster, {
46653
46664
  justify: "center",
46654
- childGap: childGap
46665
+ childGap: childGap,
46666
+ overflow: true,
46667
+ as: "nav",
46668
+ role: "navigation",
46669
+ innerWrapperAs: "ul",
46670
+ "aria-label": ariaLabel,
46671
+ extraStyles: "> ul { padding: 0px; > li { list-style-type: none; } };"
46655
46672
  }, currentPage > 1 ? /*#__PURE__*/React.createElement(PrevNextButton, {
46656
46673
  action: pagePrevious,
46674
+ ariaLabel: "Previous Page",
46657
46675
  arrowColor: arrowColor !== null && arrowColor !== void 0 ? arrowColor : themeValues.arrowColor,
46658
46676
  borderRadius: borderRadius,
46659
46677
  buttonHeight: buttonHeight,
@@ -46675,33 +46693,37 @@ var Pagination = function Pagination(_ref3) {
46675
46693
  }, "".concat(currentPage, " of ").concat(pageCount)))) : getPagesPanel(currentPage, pageCount).map(function (item, index) {
46676
46694
  return item.isButton ? /*#__PURE__*/React.createElement(Box, {
46677
46695
  padding: "0",
46678
- extraStyles: "max-height: ".concat(buttonHeight, ";")
46696
+ extraStyles: "max-height: ".concat(buttonHeight, ";"),
46697
+ as: "li",
46698
+ key: item.id
46679
46699
  }, /*#__PURE__*/React.createElement(ButtonWithAction, {
46680
46700
  variant: "ghost",
46681
- key: item.index,
46682
46701
  text: item.index,
46683
- disabled: item.active,
46684
- extraDisabledStyles: extraDisabledStyles,
46702
+ "aria-current": item.active ? "page" : undefined,
46703
+ "aria-label": "".concat(item.index == pageCount ? "Last Page, " : "", "page ").concat(item.index),
46685
46704
  action: !item.active ? function () {
46686
46705
  return setCurrentPage({
46687
46706
  pageNumber: item.index
46688
46707
  });
46689
46708
  } : noop,
46690
46709
  textExtraStyles: "font-size: ".concat(fontSize, "; font-weight: ").concat(fontWeight, ";"),
46691
- extraStyles: extraStyles,
46710
+ extraStyles: "".concat(extraStyles).concat(item.active ? currentPageStyles : ""),
46692
46711
  dataQa: index
46693
46712
  }, item.index)) : /*#__PURE__*/React.createElement(Box, {
46694
- padding: "0 10px"
46713
+ padding: "0 10px",
46714
+ as: "li",
46715
+ key: item.id
46695
46716
  }, /*#__PURE__*/React.createElement(Cluster, {
46696
46717
  justify: "flex-end"
46697
46718
  }, /*#__PURE__*/React.createElement(Text$1, {
46698
- key: index,
46699
46719
  variant: "pXL",
46700
46720
  weight: fontWeight,
46701
- color: numberColor !== null && numberColor !== void 0 ? numberColor : themeValues.numberColor
46702
- }, "...")));
46721
+ color: numberColor !== null && numberColor !== void 0 ? numberColor : themeValues.numberColor,
46722
+ role: "presentation"
46723
+ }, "…")));
46703
46724
  }), currentPage < pageCount ? /*#__PURE__*/React.createElement(PrevNextButton, {
46704
46725
  action: pageNext,
46726
+ ariaLabel: "Next Page",
46705
46727
  arrowColor: arrowColor !== null && arrowColor !== void 0 ? arrowColor : themeValues.arrowColor,
46706
46728
  borderRadius: borderRadius,
46707
46729
  buttonHeight: buttonHeight,