@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.cjs.js CHANGED
@@ -27246,7 +27246,11 @@ var RadioButton$1 = function RadioButton(_ref2) {
27246
27246
  disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
27247
27247
  _ref2$ariaDescribedBy = _ref2.ariaDescribedBy,
27248
27248
  ariaDescribedBy = _ref2$ariaDescribedBy === void 0 ? "" : _ref2$ariaDescribedBy,
27249
- themeValues = _ref2.themeValues;
27249
+ themeValues = _ref2.themeValues,
27250
+ _ref2$ariaLabelledBy = _ref2.ariaLabelledBy,
27251
+ ariaLabelledBy = _ref2$ariaLabelledBy === void 0 ? "" : _ref2$ariaLabelledBy,
27252
+ _ref2$ariaLabel = _ref2.ariaLabel,
27253
+ ariaLabel = _ref2$ariaLabel === void 0 ? null : _ref2$ariaLabel;
27250
27254
  var buttonBorder = {
27251
27255
  onFocused: {
27252
27256
  borderColor: themeValues.activeColor,
@@ -27287,19 +27291,27 @@ var RadioButton$1 = function RadioButton(_ref2) {
27287
27291
  width: "0px"
27288
27292
  }
27289
27293
  };
27294
+ var extraProps = {};
27295
+
27296
+ if (ariaLabelledBy && ariaLabelledBy.length) {
27297
+ extraProps["aria-labelledby"] = ariaLabelledBy;
27298
+ } else if (ariaLabel && ariaLabel !== null) {
27299
+ extraProps["aria-label"] = ariaLabel;
27300
+ }
27301
+
27290
27302
  return /*#__PURE__*/React__default.createElement(Motion, {
27291
27303
  position: "relative",
27292
27304
  padding: "0",
27293
27305
  initial: "off",
27294
27306
  animate: radioOn ? radioFocused ? "onFocused" : "on" : radioFocused ? "offFocused" : "off"
27295
- }, /*#__PURE__*/React__default.createElement(HiddenRadioButton, {
27296
- id: "#radio-".concat(name),
27297
- "aria-label": name,
27307
+ }, /*#__PURE__*/React__default.createElement(HiddenRadioButton, _extends({
27308
+ type: "radio",
27309
+ id: "radio-".concat(name),
27298
27310
  disabled: disabled,
27299
27311
  onClick: toggleRadio,
27300
27312
  "aria-describedby": ariaDescribedBy,
27301
27313
  tabIndex: "-1"
27302
- }), /*#__PURE__*/React__default.createElement(Motion, {
27314
+ }, extraProps)), /*#__PURE__*/React__default.createElement(Motion, {
27303
27315
  borderWidth: "1px",
27304
27316
  borderStyle: "solid",
27305
27317
  borderRadius: "12px",
@@ -49599,6 +49611,10 @@ var fallbackValues$Q = {
49599
49611
 
49600
49612
  */
49601
49613
 
49614
+ var idString = function idString(section) {
49615
+ return typeof section.title === "string" ? createIdFromString(section.title) : section.id;
49616
+ };
49617
+
49602
49618
  var RadioSection = function RadioSection(_ref) {
49603
49619
  var themeValues = _ref.themeValues,
49604
49620
  isMobile = _ref.isMobile,
@@ -49619,7 +49635,7 @@ var RadioSection = function RadioSection(_ref) {
49619
49635
  ariaDescribedBy = _ref.ariaDescribedBy;
49620
49636
 
49621
49637
  var handleKeyDown = function handleKeyDown(id, e) {
49622
- if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13) {
49638
+ if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 || (e === null || e === void 0 ? void 0 : e.keyCode) === 32) {
49623
49639
  toggleOpenSection(id);
49624
49640
  }
49625
49641
  };
@@ -49671,7 +49687,8 @@ var RadioSection = function RadioSection(_ref) {
49671
49687
  borderRadius: "4px",
49672
49688
  extraStyles: containerStyles
49673
49689
  }, /*#__PURE__*/React__default.createElement(Stack, {
49674
- childGap: "0"
49690
+ childGap: "0",
49691
+ role: "radiogroup"
49675
49692
  }, sections.filter(function (section) {
49676
49693
  return !section.hidden;
49677
49694
  }).map(function (section) {
@@ -49690,7 +49707,10 @@ var RadioSection = function RadioSection(_ref) {
49690
49707
  animate: openSection === section.id ? "open" : "closed",
49691
49708
  initial: initiallyOpen ? "open" : "closed",
49692
49709
  key: "item-".concat(section.id),
49693
- extraStyles: borderStyles
49710
+ extraStyles: borderStyles,
49711
+ role: "radio",
49712
+ "aria-checked": openSection === section.id,
49713
+ "aria-disabled": section.disabled
49694
49714
  }, /*#__PURE__*/React__default.createElement(Stack, {
49695
49715
  childGap: "0"
49696
49716
  }, /*#__PURE__*/React__default.createElement(Box, {
@@ -49720,7 +49740,8 @@ var RadioSection = function RadioSection(_ref) {
49720
49740
  }, !section.hideRadioButton && /*#__PURE__*/React__default.createElement(Box, {
49721
49741
  padding: "0"
49722
49742
  }, /*#__PURE__*/React__default.createElement(RadioButton$2, {
49723
- name: typeof section.title === "string" ? createIdFromString(section.title) : section.id,
49743
+ id: "radio-input-".concat(idString(section)),
49744
+ name: idString(section),
49724
49745
  ariaDescribedBy: ariaDescribedBy,
49725
49746
  radioOn: openSection === section.id,
49726
49747
  radioFocused: focused === section.id,
@@ -49733,17 +49754,21 @@ var RadioSection = function RadioSection(_ref) {
49733
49754
  }, section.titleIcon), /*#__PURE__*/React__default.createElement(Box, {
49734
49755
  padding: section.titleIcon ? "0 0 0 8px" : "0"
49735
49756
  }, /*#__PURE__*/React__default.createElement(Text$1, {
49736
- variant: "p",
49757
+ as: "label",
49758
+ htmlFor: "radio-input-".concat(idString(section)),
49737
49759
  color: CHARADE_GREY
49738
49760
  }, section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
49739
- childGap: "0.5rem"
49761
+ childGap: "0.5rem",
49762
+ "aria-label": (section === null || section === void 0 ? void 0 : section.rightIconsLabel) || null,
49763
+ role: (section === null || section === void 0 ? void 0 : section.rightIconsRole) || null
49740
49764
  }, section.rightIcons.map(function (icon) {
49741
49765
  return /*#__PURE__*/React__default.createElement(RightIcon, {
49742
49766
  src: icon.img,
49743
49767
  key: icon.img,
49744
49768
  fade: !icon.enabled,
49745
49769
  isMobile: isMobile,
49746
- alt: icon.altText
49770
+ alt: icon.altText,
49771
+ "aria-disabled": !icon.enabled
49747
49772
  });
49748
49773
  })), section.rightTitleContent && /*#__PURE__*/React__default.createElement(React.Fragment, null, section.rightTitleContent))), /*#__PURE__*/React__default.createElement(AnimatePresence, {
49749
49774
  initial: false