@thecb/components 5.3.3-beta.0 → 5.4.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.esm.js CHANGED
@@ -12158,7 +12158,7 @@ var ReelStyled = styled.div.withConfig({
12158
12158
  return childWidth;
12159
12159
  });
12160
12160
 
12161
- var _excluded$g = ["childGap", "height", "childWidth", "padding", "justifyContent", "disableScroll", "children"];
12161
+ var _excluded$g = ["childGap", "height", "childWidth", "padding", "justifyContent", "disableScroll", "useOrderedList", "useUnorderedList", "children"];
12162
12162
 
12163
12163
  var Reel = function Reel(_ref) {
12164
12164
  var _ref$childGap = _ref.childGap,
@@ -12173,16 +12173,22 @@ var Reel = function Reel(_ref) {
12173
12173
  justifyContent = _ref$justifyContent === void 0 ? "flex-start" : _ref$justifyContent,
12174
12174
  _ref$disableScroll = _ref.disableScroll,
12175
12175
  disableScroll = _ref$disableScroll === void 0 ? false : _ref$disableScroll,
12176
+ _ref$useOrderedList = _ref.useOrderedList,
12177
+ useOrderedList = _ref$useOrderedList === void 0 ? false : _ref$useOrderedList,
12178
+ _ref$useUnorderedList = _ref.useUnorderedList,
12179
+ useUnorderedList = _ref$useUnorderedList === void 0 ? false : _ref$useUnorderedList,
12176
12180
  children = _ref.children,
12177
12181
  rest = _objectWithoutProperties(_ref, _excluded$g);
12178
12182
 
12183
+ var elementType = useOrderedList ? "ol" : useUnorderedList ? "ul" : "div";
12179
12184
  return /*#__PURE__*/React.createElement(ReelStyled, _extends({
12180
12185
  childGap: childGap,
12181
12186
  height: height,
12182
12187
  childWidth: childWidth,
12183
12188
  padding: padding,
12184
12189
  justifyContent: justifyContent,
12185
- disableScroll: disableScroll
12190
+ disableScroll: disableScroll,
12191
+ as: elementType
12186
12192
  }, rest), safeChildren(children, /*#__PURE__*/React.createElement(Fragment, null)));
12187
12193
  };
12188
12194
 
@@ -35180,6 +35186,8 @@ var fallbackValues$v = {
35180
35186
  };
35181
35187
 
35182
35188
  var CollapsibleSection = function CollapsibleSection(_ref) {
35189
+ var _label$replaceAll;
35190
+
35183
35191
  var isOpen = _ref.isOpen,
35184
35192
  toggleSection = _ref.toggleSection,
35185
35193
  themeValues = _ref.themeValues,
@@ -35198,7 +35206,11 @@ var CollapsibleSection = function CollapsibleSection(_ref) {
35198
35206
  stackTitle = _ref$stackTitle === void 0 ? false : _ref$stackTitle,
35199
35207
  stackTitleContent = _ref.stackTitleContent,
35200
35208
  _ref$sectionGap = _ref.sectionGap,
35201
- sectionGap = _ref$sectionGap === void 0 ? "0.5rem" : _ref$sectionGap;
35209
+ sectionGap = _ref$sectionGap === void 0 ? "0.5rem" : _ref$sectionGap,
35210
+ _ref$name = _ref.name,
35211
+ name = _ref$name === void 0 ? "" : _ref$name,
35212
+ _ref$index = _ref.index,
35213
+ index = _ref$index === void 0 ? 1 : _ref$index;
35202
35214
 
35203
35215
  var handleKeyDown = function handleKeyDown(e) {
35204
35216
  if (e.keyCode === 13) {
@@ -35207,6 +35219,8 @@ var CollapsibleSection = function CollapsibleSection(_ref) {
35207
35219
  };
35208
35220
 
35209
35221
  var numChildren = typeof children === "Array" ? children.length : 1;
35222
+ var label = name !== "" ? name : !customTitle ? title : "collapsible section";
35223
+ var id = "".concat(label === null || label === void 0 ? void 0 : (_label$replaceAll = label.replaceAll(" ", "-")) === null || _label$replaceAll === void 0 ? void 0 : _label$replaceAll.toLowerCase(), "-").concat(index);
35210
35224
  var wrapper = {
35211
35225
  open: {
35212
35226
  height: openHeight,
@@ -35242,6 +35256,11 @@ var CollapsibleSection = function CollapsibleSection(_ref) {
35242
35256
  positionTransition: true
35243
35257
  }, stackTitle && /*#__PURE__*/React.createElement(Fragment, null, stackTitleContent), /*#__PURE__*/React.createElement(Stack, {
35244
35258
  childGap: isOpen && !isMobile ? sectionGap : "0rem"
35259
+ }, /*#__PURE__*/React.createElement(Box, {
35260
+ padding: "0",
35261
+ role: "heading",
35262
+ "aria-label": label,
35263
+ "aria-level": 3
35245
35264
  }, /*#__PURE__*/React.createElement(Box, {
35246
35265
  padding: customPadding ? customPadding : "0",
35247
35266
  background: themeValues.headingBackgroundColor,
@@ -35251,7 +35270,11 @@ var CollapsibleSection = function CollapsibleSection(_ref) {
35251
35270
  hoverStyles: "cursor: pointer;",
35252
35271
  tabIndex: "0",
35253
35272
  onKeyDown: handleKeyDown,
35254
- extraStyles: "z-index: 25;"
35273
+ extraStyles: "z-index: 25;",
35274
+ role: "button",
35275
+ "aria-expanded": isOpen.toString(),
35276
+ "aria-controls": id,
35277
+ id: "".concat(id, "-button")
35255
35278
  }, /*#__PURE__*/React.createElement(Cluster, {
35256
35279
  justify: "space-between",
35257
35280
  align: "center"
@@ -35266,7 +35289,7 @@ var CollapsibleSection = function CollapsibleSection(_ref) {
35266
35289
  }, title), /*#__PURE__*/React.createElement(Motion, {
35267
35290
  variants: icon,
35268
35291
  extraStyles: "display: flex; align-items: center;"
35269
- }, /*#__PURE__*/React.createElement(ChevronIcon$1, null)))), /*#__PURE__*/React.createElement(AnimatePresence, {
35292
+ }, /*#__PURE__*/React.createElement(ChevronIcon$1, null))))), /*#__PURE__*/React.createElement(AnimatePresence, {
35270
35293
  initial: false
35271
35294
  }, isOpen && /*#__PURE__*/React.createElement(Motion, {
35272
35295
  padding: "0",
@@ -35276,7 +35299,10 @@ var CollapsibleSection = function CollapsibleSection(_ref) {
35276
35299
  initial: initiallyOpen ? "open" : "closed",
35277
35300
  exit: "closed",
35278
35301
  variants: wrapper,
35279
- extraStyles: "transform-origin: 100% 0; overflow-y: hidden;"
35302
+ extraStyles: "transform-origin: 100% 0; overflow-y: hidden;",
35303
+ id: "".concat(id, "-content"),
35304
+ role: "region",
35305
+ "aria-labelledby": "".concat(id, "-button")
35280
35306
  }, children))));
35281
35307
  };
35282
35308
 
@@ -35387,18 +35413,23 @@ var EditableList = function EditableList(_ref) {
35387
35413
  Modal = _ref.modal,
35388
35414
  modalProps = _ref.modalProps,
35389
35415
  autoPayMethods = _ref.autoPayMethods,
35416
+ _ref$as = _ref.as,
35417
+ as = _ref$as === void 0 ? "p" : _ref$as,
35390
35418
  qaPrefix = _ref.qaPrefix;
35419
+ var addText = "Add a".concat(itemName[0].match(/[aieouAIEOU]/) ? "n" : "", " ").concat(itemName);
35391
35420
  return /*#__PURE__*/React.createElement(Box, {
35392
- padding: "0rem 0rem 1.5rem 0rem"
35421
+ padding: "0rem 0rem 1.5rem 0rem",
35422
+ as: "section",
35423
+ "aria-labelledby": "li"
35393
35424
  }, /*#__PURE__*/React.createElement(Stack, {
35394
35425
  childGap: "0rem"
35395
35426
  }, title !== "" && /*#__PURE__*/React.createElement(Box, {
35396
35427
  padding: "0rem 0rem 0.5rem 0rem"
35397
- }, /*#__PURE__*/React.createElement(Paragraph$1, {
35398
- variant: "pL",
35428
+ }, /*#__PURE__*/React.createElement(Title$1, {
35429
+ as: as,
35399
35430
  weight: titleWeight,
35400
35431
  color: CHARADE_GREY,
35401
- extraStyles: "letter-spacing: 0.29px;"
35432
+ extraStyles: "letter-spacing: 0.29px; font-size: 1.125rem;"
35402
35433
  }, title)), /*#__PURE__*/React.createElement(Box, {
35403
35434
  padding: "0",
35404
35435
  borderRadius: "4px",
@@ -35443,7 +35474,8 @@ var EditableList = function EditableList(_ref) {
35443
35474
  action: function action() {
35444
35475
  return removeItem(item.id);
35445
35476
  },
35446
- extraStyles: "min-width: 0;"
35477
+ extraStyles: "min-width: 0;",
35478
+ "aria-label": "Remove ".concat(itemName, " ").concat(title)
35447
35479
  })), canEdit && /*#__PURE__*/React.createElement(Box, {
35448
35480
  padding: "0 0.5rem",
35449
35481
  border: "2px solid transparent",
@@ -35456,14 +35488,16 @@ var EditableList = function EditableList(_ref) {
35456
35488
  action: function action() {
35457
35489
  return editItem(item.id);
35458
35490
  },
35459
- extraStyles: "min-width: 0;"
35491
+ extraStyles: "min-width: 0;",
35492
+ "aria-label": "Edit ".concat(itemName, " ").concat(title)
35460
35493
  }))));
35461
35494
  })), canAdd && (!maxItems || items.length < maxItems) && /*#__PURE__*/React.createElement(Box, {
35462
35495
  padding: items.length === 0 ? "0" : "1rem 0 0"
35463
35496
  }, /*#__PURE__*/React.createElement(Placeholder$1, {
35464
- text: "Add a".concat(itemName[0].match(/[aieouAIEOU]/) ? "n" : "", " ").concat(itemName),
35497
+ text: addText,
35465
35498
  action: addItem,
35466
- dataQa: "Add " + qaPrefix
35499
+ dataQa: "Add " + qaPrefix,
35500
+ "aria-label": addText
35467
35501
  }))));
35468
35502
  };
35469
35503
 
@@ -35730,7 +35764,11 @@ var HighlightTabRow = function HighlightTabRow(_ref) {
35730
35764
  var tabs = _ref.tabs,
35731
35765
  highlightIndex = _ref.highlightIndex,
35732
35766
  themeValues = _ref.themeValues,
35733
- isMobile = _ref.isMobile;
35767
+ isMobile = _ref.isMobile,
35768
+ _ref$useOrderedList = _ref.useOrderedList,
35769
+ useOrderedList = _ref$useOrderedList === void 0 ? true : _ref$useOrderedList,
35770
+ _ref$useUnorderedList = _ref.useUnorderedList,
35771
+ useUnorderedList = _ref$useUnorderedList === void 0 ? false : _ref$useUnorderedList;
35734
35772
  var itemsAfterIndex = tabs.slice(highlightIndex).length - 1;
35735
35773
  var itemsBeforeIndex = tabs.slice(0, highlightIndex).length;
35736
35774
  var boxesBefore = itemsAfterIndex > itemsBeforeIndex && isMobile ? itemsAfterIndex - itemsBeforeIndex : 0;
@@ -35749,14 +35787,17 @@ var HighlightTabRow = function HighlightTabRow(_ref) {
35749
35787
  childGap: "4.5rem",
35750
35788
  childWidth: "11rem",
35751
35789
  justifyContent: "space-evenly",
35752
- disableScroll: true
35790
+ disableScroll: true,
35791
+ useOrderedList: useOrderedList,
35792
+ useUnorderedList: useUnorderedList
35753
35793
  }, repeat( /*#__PURE__*/React.createElement(Box, null), boxesBefore), tabs.map(function (t, i) {
35754
35794
  return /*#__PURE__*/React.createElement(Box, {
35755
35795
  key: t,
35756
35796
  borderSize: "3px",
35757
35797
  borderColor: highlightIndex == i ? themeValues.textColor : "transparent",
35758
35798
  borderWidthOverride: "0 0 3px 0",
35759
- extraStyles: "text-align: center;"
35799
+ extraStyles: "text-align: center;",
35800
+ as: "li"
35760
35801
  }, /*#__PURE__*/React.createElement(Text$1, {
35761
35802
  variant: "p",
35762
35803
  textAlign: "center",
@@ -38909,6 +38950,17 @@ var fallbackValues$x = {
38909
38950
  backgroundColor: backgroundColor$6
38910
38951
  };
38911
38952
 
38953
+ /*
38954
+ New (01/22) - updated <Module /> to use <Title /> atom
38955
+ Because <Title /> decouples size from element, also gave <Module />
38956
+ two new props: "as" and "fontSize"
38957
+
38958
+ When present, <Module /> will use those values to dictate element type and font size.
38959
+
38960
+ For backwards compatability, <Module /> still computes a themed font size and element type based on old
38961
+ <Heading /> variants. If "fontSize" or "as" is undefined, <Module /> will use themed values.
38962
+ */
38963
+
38912
38964
  var Module = function Module(_ref) {
38913
38965
  var heading = _ref.heading,
38914
38966
  _ref$spacing = _ref.spacing,
@@ -38920,13 +38972,20 @@ var Module = function Module(_ref) {
38920
38972
  themeValues = _ref.themeValues,
38921
38973
  _ref$variant = _ref.variant,
38922
38974
  variant = _ref$variant === void 0 ? "default" : _ref$variant,
38975
+ fontSize = _ref.fontSize,
38976
+ as = _ref.as,
38923
38977
  children = _ref.children;
38924
- return /*#__PURE__*/React.createElement(Fragment, null, heading && /*#__PURE__*/React.createElement(Heading$1, {
38925
- variant: variant === "small" ? "h6" : variant === "default" ? "h5" : "h2",
38978
+ var themedFontSize = variant === "small" ? "1.25rem" : variant === "default" ? "1.375rem" : "2rem";
38979
+ var computedFontSize = fontSize || themedFontSize;
38980
+ var themedElemType = variant === "small" ? "h6" : variant === "default" ? "h5" : "h2";
38981
+ var computedElemType = as || themedElemType;
38982
+ return /*#__PURE__*/React.createElement(Fragment, null, heading && /*#__PURE__*/React.createElement(Title$1, {
38926
38983
  weight: themeValues.fontWeight,
38927
38984
  color: themeValues.fontColor,
38928
38985
  margin: "".concat(spacing, " 0 ").concat(themeValues.titleSpacing, " 0"),
38929
- textAlign: themeValues.textAlign
38986
+ textAlign: themeValues.textAlign,
38987
+ as: computedElemType,
38988
+ extraStyles: "font-size: ".concat(computedFontSize, ";")
38930
38989
  }, heading), /*#__PURE__*/React.createElement(Box, {
38931
38990
  padding: "0 0 ".concat(spacingBottom)
38932
38991
  }, /*#__PURE__*/React.createElement(Box, {
@@ -39798,7 +39857,8 @@ var Collapsible = function Collapsible(_ref2) {
39798
39857
  toggleSection: function toggleSection() {
39799
39858
  return setIsOpen(!isOpen);
39800
39859
  },
39801
- customTitle: true
39860
+ customTitle: true,
39861
+ name: "Collapsed Payment Details"
39802
39862
  }, /*#__PURE__*/React.createElement(Motion, {
39803
39863
  variants: {
39804
39864
  open: {
@@ -39907,19 +39967,21 @@ var PaymentDetails = function PaymentDetails(_ref4) {
39907
39967
  }, /*#__PURE__*/React.createElement(Cluster, {
39908
39968
  justify: "space-between",
39909
39969
  align: "center"
39910
- }, /*#__PURE__*/React.createElement(Heading$1, {
39911
- variant: "h5",
39912
- weight: "700",
39913
- as: "h1"
39914
- }, titleText), /*#__PURE__*/React.createElement(Heading$1, {
39915
- variant: "h5",
39916
- weight: "700",
39917
- as: "h1"
39918
- }, displayCurrency(total)))) : /*#__PURE__*/React.createElement(Heading$1, {
39970
+ }, /*#__PURE__*/React.createElement(Title$1, {
39971
+ weight: FONT_WEIGHT_BOLD,
39919
39972
  as: "h1",
39920
- variant: "h3",
39921
- weight: "700",
39922
- margin: "1rem 0 0 0"
39973
+ extraStyles: "font-size: 1.375rem;",
39974
+ id: "payment-details-title"
39975
+ }, titleText), /*#__PURE__*/React.createElement(Title$1, {
39976
+ weight: FONT_WEIGHT_BOLD,
39977
+ as: "p",
39978
+ extraStyles: "font-size: 1.375rem;"
39979
+ }, displayCurrency(total)))) : /*#__PURE__*/React.createElement(Title$1, {
39980
+ as: "h1",
39981
+ weight: FONT_WEIGHT_BOLD,
39982
+ margin: "1rem 0 0 0",
39983
+ extraStyles: "font-size: 1.75rem;",
39984
+ id: "payment-details-title"
39923
39985
  }, titleText);
39924
39986
  return isCollapsible ? /*#__PURE__*/React.createElement(Collapsible, {
39925
39987
  title: title,
@@ -41169,7 +41231,8 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
41169
41231
  tabIndex: "0",
41170
41232
  color: themeValues.linkColor,
41171
41233
  weight: themeValues.fontWeight,
41172
- hoverStyles: themeValues.modalLinkHoverFocus
41234
+ hoverStyles: themeValues.modalLinkHoverFocus,
41235
+ extraStyles: "display: inline-block; width: fit-content;"
41173
41236
  }, link));
41174
41237
  };
41175
41238