@thecb/components 9.1.0-beta.2 → 9.1.0-beta.3

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
@@ -27238,7 +27238,11 @@ var RadioButton$1 = function RadioButton(_ref2) {
27238
27238
  disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
27239
27239
  _ref2$ariaDescribedBy = _ref2.ariaDescribedBy,
27240
27240
  ariaDescribedBy = _ref2$ariaDescribedBy === void 0 ? "" : _ref2$ariaDescribedBy,
27241
- themeValues = _ref2.themeValues;
27241
+ themeValues = _ref2.themeValues,
27242
+ _ref2$ariaLabelledBy = _ref2.ariaLabelledBy,
27243
+ ariaLabelledBy = _ref2$ariaLabelledBy === void 0 ? "" : _ref2$ariaLabelledBy,
27244
+ _ref2$ariaLabel = _ref2.ariaLabel,
27245
+ ariaLabel = _ref2$ariaLabel === void 0 ? null : _ref2$ariaLabel;
27242
27246
  var buttonBorder = {
27243
27247
  onFocused: {
27244
27248
  borderColor: themeValues.activeColor,
@@ -27279,19 +27283,27 @@ var RadioButton$1 = function RadioButton(_ref2) {
27279
27283
  width: "0px"
27280
27284
  }
27281
27285
  };
27286
+ var extraProps = {};
27287
+
27288
+ if (ariaLabelledBy && ariaLabelledBy.length) {
27289
+ extraProps["aria-labelledby"] = ariaLabelledBy;
27290
+ } else if (ariaLabel && ariaLabel !== null) {
27291
+ extraProps["aria-label"] = ariaLabel;
27292
+ }
27293
+
27282
27294
  return /*#__PURE__*/React.createElement(Motion, {
27283
27295
  position: "relative",
27284
27296
  padding: "0",
27285
27297
  initial: "off",
27286
27298
  animate: radioOn ? radioFocused ? "onFocused" : "on" : radioFocused ? "offFocused" : "off"
27287
- }, /*#__PURE__*/React.createElement(HiddenRadioButton, {
27288
- id: "#radio-".concat(name),
27289
- "aria-label": name,
27299
+ }, /*#__PURE__*/React.createElement(HiddenRadioButton, _extends({
27300
+ type: "radio",
27301
+ id: "radio-".concat(name),
27290
27302
  disabled: disabled,
27291
27303
  onClick: toggleRadio,
27292
27304
  "aria-describedby": ariaDescribedBy,
27293
27305
  tabIndex: "-1"
27294
- }), /*#__PURE__*/React.createElement(Motion, {
27306
+ }, extraProps)), /*#__PURE__*/React.createElement(Motion, {
27295
27307
  borderWidth: "1px",
27296
27308
  borderStyle: "solid",
27297
27309
  borderRadius: "12px",
@@ -49591,6 +49603,10 @@ var fallbackValues$Q = {
49591
49603
 
49592
49604
  */
49593
49605
 
49606
+ var idString = function idString(section) {
49607
+ return typeof section.title === "string" ? createIdFromString(section.title) : section.id;
49608
+ };
49609
+
49594
49610
  var RadioSection = function RadioSection(_ref) {
49595
49611
  var themeValues = _ref.themeValues,
49596
49612
  isMobile = _ref.isMobile,
@@ -49611,7 +49627,7 @@ var RadioSection = function RadioSection(_ref) {
49611
49627
  ariaDescribedBy = _ref.ariaDescribedBy;
49612
49628
 
49613
49629
  var handleKeyDown = function handleKeyDown(id, e) {
49614
- if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13) {
49630
+ if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 || (e === null || e === void 0 ? void 0 : e.keyCode) === 32) {
49615
49631
  toggleOpenSection(id);
49616
49632
  }
49617
49633
  };
@@ -49663,7 +49679,8 @@ var RadioSection = function RadioSection(_ref) {
49663
49679
  borderRadius: "4px",
49664
49680
  extraStyles: containerStyles
49665
49681
  }, /*#__PURE__*/React.createElement(Stack, {
49666
- childGap: "0"
49682
+ childGap: "0",
49683
+ role: "radiogroup"
49667
49684
  }, sections.filter(function (section) {
49668
49685
  return !section.hidden;
49669
49686
  }).map(function (section) {
@@ -49682,7 +49699,10 @@ var RadioSection = function RadioSection(_ref) {
49682
49699
  animate: openSection === section.id ? "open" : "closed",
49683
49700
  initial: initiallyOpen ? "open" : "closed",
49684
49701
  key: "item-".concat(section.id),
49685
- extraStyles: borderStyles
49702
+ extraStyles: borderStyles,
49703
+ role: "radio",
49704
+ "aria-checked": openSection === section.id,
49705
+ "aria-disabled": section.disabled
49686
49706
  }, /*#__PURE__*/React.createElement(Stack, {
49687
49707
  childGap: "0"
49688
49708
  }, /*#__PURE__*/React.createElement(Box, {
@@ -49712,7 +49732,8 @@ var RadioSection = function RadioSection(_ref) {
49712
49732
  }, !section.hideRadioButton && /*#__PURE__*/React.createElement(Box, {
49713
49733
  padding: "0"
49714
49734
  }, /*#__PURE__*/React.createElement(RadioButton$2, {
49715
- name: typeof section.title === "string" ? createIdFromString(section.title) : section.id,
49735
+ id: "radio-input-".concat(idString(section)),
49736
+ name: idString(section),
49716
49737
  ariaDescribedBy: ariaDescribedBy,
49717
49738
  radioOn: openSection === section.id,
49718
49739
  radioFocused: focused === section.id,
@@ -49725,17 +49746,21 @@ var RadioSection = function RadioSection(_ref) {
49725
49746
  }, section.titleIcon), /*#__PURE__*/React.createElement(Box, {
49726
49747
  padding: section.titleIcon ? "0 0 0 8px" : "0"
49727
49748
  }, /*#__PURE__*/React.createElement(Text$1, {
49728
- variant: "p",
49749
+ as: "label",
49750
+ htmlFor: "radio-input-".concat(idString(section)),
49729
49751
  color: CHARADE_GREY
49730
49752
  }, section.title))), section.rightIcons && /*#__PURE__*/React.createElement(Cluster, {
49731
- childGap: "0.5rem"
49753
+ childGap: "0.5rem",
49754
+ "aria-label": (section === null || section === void 0 ? void 0 : section.rightIconsLabel) || null,
49755
+ role: (section === null || section === void 0 ? void 0 : section.rightIconsRole) || null
49732
49756
  }, section.rightIcons.map(function (icon) {
49733
49757
  return /*#__PURE__*/React.createElement(RightIcon, {
49734
49758
  src: icon.img,
49735
49759
  key: icon.img,
49736
49760
  fade: !icon.enabled,
49737
49761
  isMobile: isMobile,
49738
- alt: icon.altText
49762
+ alt: icon.altText,
49763
+ "aria-disabled": !icon.enabled
49739
49764
  });
49740
49765
  })), section.rightTitleContent && /*#__PURE__*/React.createElement(Fragment$1, null, section.rightTitleContent))), /*#__PURE__*/React.createElement(AnimatePresence, {
49741
49766
  initial: false