@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.cjs.js CHANGED
@@ -6673,7 +6673,7 @@ var ClusterInnerWrapper = styled__default.div.withConfig({
6673
6673
  return childGap;
6674
6674
  });
6675
6675
 
6676
- var _excluded$6 = ["justify", "align", "childGap", "minHeight", "minWidth", "nowrap", "overflow", "justifySelf", "alignSelf", "flexGrow", "extraStyles", "children"];
6676
+ var _excluded$6 = ["justify", "align", "childGap", "minHeight", "minWidth", "nowrap", "overflow", "justifySelf", "alignSelf", "flexGrow", "extraStyles", "children", "innerWrapperAs"];
6677
6677
  /*
6678
6678
  Cluster components suit any groups of elements that differ in
6679
6679
  length and are liable to wrap. Buttons that appear together at the
@@ -6697,6 +6697,8 @@ var Cluster = function Cluster(_ref) {
6697
6697
  flexGrow = _ref.flexGrow,
6698
6698
  extraStyles = _ref.extraStyles,
6699
6699
  children = _ref.children,
6700
+ _ref$innerWrapperAs = _ref.innerWrapperAs,
6701
+ innerWrapperAs = _ref$innerWrapperAs === void 0 ? "div" : _ref$innerWrapperAs,
6700
6702
  rest = _objectWithoutProperties(_ref, _excluded$6);
6701
6703
 
6702
6704
  return /*#__PURE__*/React__default.createElement(ClusterWrapper, _extends({
@@ -6712,7 +6714,8 @@ var Cluster = function Cluster(_ref) {
6712
6714
  childGap: childGap,
6713
6715
  minHeight: minHeight,
6714
6716
  minWidth: minWidth,
6715
- $nowrap: nowrap
6717
+ $nowrap: nowrap,
6718
+ as: innerWrapperAs
6716
6719
  }, safeChildren(children, /*#__PURE__*/React__default.createElement(React.Fragment, null))));
6717
6720
  };
6718
6721
 
@@ -46558,6 +46561,7 @@ var PrevNextPlaceholder = function PrevNextPlaceholder(_ref) {
46558
46561
 
46559
46562
  var PrevNextButton = function PrevNextButton(_ref2) {
46560
46563
  var action = _ref2.action,
46564
+ ariaLabel = _ref2.ariaLabel,
46561
46565
  arrowColor = _ref2.arrowColor,
46562
46566
  borderRadius = _ref2.borderRadius,
46563
46567
  buttonHeight = _ref2.buttonHeight,
@@ -46567,12 +46571,14 @@ var PrevNextButton = function PrevNextButton(_ref2) {
46567
46571
  return /*#__PURE__*/React__default.createElement(Box, {
46568
46572
  padding: "0",
46569
46573
  minHeight: buttonHeight,
46570
- extraStyles: "max-height: ".concat(buttonHeight, ";")
46574
+ extraStyles: "max-height: ".concat(buttonHeight, ";"),
46575
+ as: "li"
46571
46576
  }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
46572
46577
  action: action,
46573
46578
  contentOverride: true,
46574
46579
  dataQa: type,
46575
- 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 ")
46580
+ "aria-label": ariaLabel,
46581
+ 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 ")
46576
46582
  }, /*#__PURE__*/React__default.createElement(Box, {
46577
46583
  padding: "0",
46578
46584
  extraStyles: type === "prev" && "transform: scaleX(-1)"
@@ -46596,26 +46602,30 @@ var getPagesPanel = function getPagesPanel(page, pagesCount) {
46596
46602
 
46597
46603
  if (page > space + 1) {
46598
46604
  pages.push({
46599
- isDelimiter: true
46605
+ isDelimiter: true,
46606
+ id: "first-delimiter"
46600
46607
  });
46601
46608
  }
46602
46609
 
46603
46610
  for (var j = Math.max(1, page - space) + 1; j < Math.min(lastPageNumber, page + space); j++) {
46604
46611
  pages.push({
46605
46612
  index: j,
46606
- isButton: true
46613
+ isButton: true,
46614
+ id: "page-".concat(j)
46607
46615
  });
46608
46616
  }
46609
46617
 
46610
46618
  if (page < lastPageNumber - space) {
46611
46619
  pages.push({
46612
- isDelimiter: true
46620
+ isDelimiter: true,
46621
+ id: "last-delimiter"
46613
46622
  });
46614
46623
  }
46615
46624
 
46616
46625
  pages.push({
46617
46626
  index: lastPageNumber,
46618
- isButton: true
46627
+ isButton: true,
46628
+ id: "page-".concat(lastPageNumber)
46619
46629
  });
46620
46630
  var activePage = pages.find(function (p) {
46621
46631
  return p.index === page;
@@ -46650,18 +46660,26 @@ var Pagination = function Pagination(_ref3) {
46650
46660
  pageNext = _ref3.pageNext,
46651
46661
  pagePrevious = _ref3.pagePrevious,
46652
46662
  setCurrentPage = _ref3.setCurrentPage,
46663
+ ariaLabel = _ref3.ariaLabel,
46653
46664
  themeValues = _ref3.themeValues;
46654
46665
 
46655
46666
  var _useContext = React.useContext(styled.ThemeContext),
46656
46667
  isMobile = _useContext.isMobile;
46657
46668
 
46658
- 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 ");
46659
- 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 ");
46669
+ 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 ");
46670
+ 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 ");
46660
46671
  return /*#__PURE__*/React__default.createElement(Cluster, {
46661
46672
  justify: "center",
46662
- childGap: childGap
46673
+ childGap: childGap,
46674
+ overflow: true,
46675
+ as: "nav",
46676
+ role: "navigation",
46677
+ innerWrapperAs: "ul",
46678
+ "aria-label": ariaLabel,
46679
+ extraStyles: "> ul { padding: 0px; > li { list-style-type: none; } };"
46663
46680
  }, currentPage > 1 ? /*#__PURE__*/React__default.createElement(PrevNextButton, {
46664
46681
  action: pagePrevious,
46682
+ ariaLabel: "Previous Page",
46665
46683
  arrowColor: arrowColor !== null && arrowColor !== void 0 ? arrowColor : themeValues.arrowColor,
46666
46684
  borderRadius: borderRadius,
46667
46685
  buttonHeight: buttonHeight,
@@ -46683,33 +46701,37 @@ var Pagination = function Pagination(_ref3) {
46683
46701
  }, "".concat(currentPage, " of ").concat(pageCount)))) : getPagesPanel(currentPage, pageCount).map(function (item, index) {
46684
46702
  return item.isButton ? /*#__PURE__*/React__default.createElement(Box, {
46685
46703
  padding: "0",
46686
- extraStyles: "max-height: ".concat(buttonHeight, ";")
46704
+ extraStyles: "max-height: ".concat(buttonHeight, ";"),
46705
+ as: "li",
46706
+ key: item.id
46687
46707
  }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
46688
46708
  variant: "ghost",
46689
- key: item.index,
46690
46709
  text: item.index,
46691
- disabled: item.active,
46692
- extraDisabledStyles: extraDisabledStyles,
46710
+ "aria-current": item.active ? "page" : undefined,
46711
+ "aria-label": "".concat(item.index == pageCount ? "Last Page, " : "", "page ").concat(item.index),
46693
46712
  action: !item.active ? function () {
46694
46713
  return setCurrentPage({
46695
46714
  pageNumber: item.index
46696
46715
  });
46697
46716
  } : noop,
46698
46717
  textExtraStyles: "font-size: ".concat(fontSize, "; font-weight: ").concat(fontWeight, ";"),
46699
- extraStyles: extraStyles,
46718
+ extraStyles: "".concat(extraStyles).concat(item.active ? currentPageStyles : ""),
46700
46719
  dataQa: index
46701
46720
  }, item.index)) : /*#__PURE__*/React__default.createElement(Box, {
46702
- padding: "0 10px"
46721
+ padding: "0 10px",
46722
+ as: "li",
46723
+ key: item.id
46703
46724
  }, /*#__PURE__*/React__default.createElement(Cluster, {
46704
46725
  justify: "flex-end"
46705
46726
  }, /*#__PURE__*/React__default.createElement(Text$1, {
46706
- key: index,
46707
46727
  variant: "pXL",
46708
46728
  weight: fontWeight,
46709
- color: numberColor !== null && numberColor !== void 0 ? numberColor : themeValues.numberColor
46710
- }, "...")));
46729
+ color: numberColor !== null && numberColor !== void 0 ? numberColor : themeValues.numberColor,
46730
+ role: "presentation"
46731
+ }, "…")));
46711
46732
  }), currentPage < pageCount ? /*#__PURE__*/React__default.createElement(PrevNextButton, {
46712
46733
  action: pageNext,
46734
+ ariaLabel: "Next Page",
46713
46735
  arrowColor: arrowColor !== null && arrowColor !== void 0 ? arrowColor : themeValues.arrowColor,
46714
46736
  borderRadius: borderRadius,
46715
46737
  buttonHeight: buttonHeight,