@thecb/components 9.0.3-beta.4 → 9.0.3-beta.5
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 +35 -32
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +35 -32
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/module/Module.js +1 -2
- package/src/components/molecules/radio-section/RadioSection.js +16 -19
- package/src/components/molecules/radio-section/radio-button/RadioButton.js +11 -4
package/dist/index.esm.js
CHANGED
|
@@ -27211,7 +27211,11 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
27211
27211
|
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
27212
27212
|
_ref2$ariaDescribedBy = _ref2.ariaDescribedBy,
|
|
27213
27213
|
ariaDescribedBy = _ref2$ariaDescribedBy === void 0 ? "" : _ref2$ariaDescribedBy,
|
|
27214
|
-
themeValues = _ref2.themeValues
|
|
27214
|
+
themeValues = _ref2.themeValues,
|
|
27215
|
+
_ref2$ariaLabelledBy = _ref2.ariaLabelledBy,
|
|
27216
|
+
ariaLabelledBy = _ref2$ariaLabelledBy === void 0 ? "" : _ref2$ariaLabelledBy,
|
|
27217
|
+
_ref2$ariaLabel = _ref2.ariaLabel,
|
|
27218
|
+
ariaLabel = _ref2$ariaLabel === void 0 ? null : _ref2$ariaLabel;
|
|
27215
27219
|
var buttonBorder = {
|
|
27216
27220
|
onFocused: {
|
|
27217
27221
|
borderColor: themeValues.activeColor,
|
|
@@ -27252,20 +27256,27 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
27252
27256
|
width: "0px"
|
|
27253
27257
|
}
|
|
27254
27258
|
};
|
|
27259
|
+
var extraProps = {};
|
|
27260
|
+
|
|
27261
|
+
if (ariaLabelledBy && ariaLabelledBy.length) {
|
|
27262
|
+
extraProps["aria-labelledby"] = ariaLabelledBy;
|
|
27263
|
+
} else if (ariaLabel && ariaLabel !== null) {
|
|
27264
|
+
extraProps["aria-label"] = ariaLabel;
|
|
27265
|
+
}
|
|
27266
|
+
|
|
27255
27267
|
return /*#__PURE__*/React.createElement(Motion, {
|
|
27256
27268
|
position: "relative",
|
|
27257
27269
|
padding: "0",
|
|
27258
27270
|
initial: "off",
|
|
27259
27271
|
animate: radioOn ? radioFocused ? "onFocused" : "on" : radioFocused ? "offFocused" : "off"
|
|
27260
|
-
}, /*#__PURE__*/React.createElement(HiddenRadioButton, {
|
|
27261
|
-
id: "radio-".concat(name),
|
|
27272
|
+
}, /*#__PURE__*/React.createElement(HiddenRadioButton, _extends({
|
|
27262
27273
|
type: "radio",
|
|
27263
|
-
"
|
|
27274
|
+
id: "radio-".concat(name),
|
|
27264
27275
|
disabled: disabled,
|
|
27265
27276
|
onClick: toggleRadio,
|
|
27266
27277
|
"aria-describedby": ariaDescribedBy,
|
|
27267
27278
|
tabIndex: "-1"
|
|
27268
|
-
}), /*#__PURE__*/React.createElement(Motion, {
|
|
27279
|
+
}, extraProps)), /*#__PURE__*/React.createElement(Motion, {
|
|
27269
27280
|
borderWidth: "1px",
|
|
27270
27281
|
borderStyle: "solid",
|
|
27271
27282
|
borderRadius: "12px",
|
|
@@ -45776,8 +45787,6 @@ var Module = function Module(_ref) {
|
|
|
45776
45787
|
spacingBottom = _ref$spacingBottom === void 0 ? "2.5rem" : _ref$spacingBottom,
|
|
45777
45788
|
fontSize = _ref.fontSize,
|
|
45778
45789
|
themeValues = _ref.themeValues,
|
|
45779
|
-
_ref$ariaRole = _ref.ariaRole,
|
|
45780
|
-
ariaRole = _ref$ariaRole === void 0 ? null : _ref$ariaRole,
|
|
45781
45790
|
children = _ref.children;
|
|
45782
45791
|
var themedFontSize = variant === "small" ? "1.25rem" : variant === "default" ? "1.375rem" : "2rem";
|
|
45783
45792
|
var computedFontSize = fontSize || themedFontSize;
|
|
@@ -45793,13 +45802,12 @@ var Module = function Module(_ref) {
|
|
|
45793
45802
|
extraStyles: "font-size: ".concat(computedFontSize, ";"),
|
|
45794
45803
|
id: titleID
|
|
45795
45804
|
}, heading);
|
|
45796
|
-
return /*#__PURE__*/React.createElement(Box,
|
|
45805
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
45797
45806
|
"aria-disabled": disabled,
|
|
45798
45807
|
extraStyles: disabled && disabledStyles,
|
|
45799
|
-
padding: "0"
|
|
45800
|
-
|
|
45801
|
-
|
|
45802
|
-
} : {}), heading && !rightTitleContent && headingText, heading && rightTitleContent && /*#__PURE__*/React.createElement(Cluster, {
|
|
45808
|
+
padding: "0",
|
|
45809
|
+
role: "group"
|
|
45810
|
+
}, heading && !rightTitleContent && headingText, heading && rightTitleContent && /*#__PURE__*/React.createElement(Cluster, {
|
|
45803
45811
|
justify: "space-between",
|
|
45804
45812
|
align: "center",
|
|
45805
45813
|
nowrap: true
|
|
@@ -48470,6 +48478,10 @@ var fallbackValues$Q = {
|
|
|
48470
48478
|
|
|
48471
48479
|
*/
|
|
48472
48480
|
|
|
48481
|
+
var computeSectionId = function computeSectionId(section) {
|
|
48482
|
+
return typeof section.title === "string" ? createIdFromString(section.title) : section.id;
|
|
48483
|
+
};
|
|
48484
|
+
|
|
48473
48485
|
var RadioSection = function RadioSection(_ref) {
|
|
48474
48486
|
var themeValues = _ref.themeValues,
|
|
48475
48487
|
isMobile = _ref.isMobile,
|
|
@@ -48487,12 +48499,9 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48487
48499
|
openHeight = _ref$openHeight === void 0 ? "auto" : _ref$openHeight,
|
|
48488
48500
|
_ref$containerStyles = _ref.containerStyles,
|
|
48489
48501
|
containerStyles = _ref$containerStyles === void 0 ? "" : _ref$containerStyles,
|
|
48490
|
-
ariaDescribedBy = _ref.ariaDescribedBy
|
|
48491
|
-
_ref$groupLabel = _ref.groupLabel;
|
|
48502
|
+
ariaDescribedBy = _ref.ariaDescribedBy;
|
|
48492
48503
|
|
|
48493
48504
|
var handleKeyDown = function handleKeyDown(id, e) {
|
|
48494
|
-
// The expected keyboard shortcut for activating a radio is the Space key
|
|
48495
|
-
// Below covers both Enter or Space key presses
|
|
48496
48505
|
if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 || (e === null || e === void 0 ? void 0 : e.keyCode) === 32) {
|
|
48497
48506
|
toggleOpenSection(id);
|
|
48498
48507
|
}
|
|
@@ -48539,18 +48548,14 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48539
48548
|
focused = _useState2[0],
|
|
48540
48549
|
setFocused = _useState2[1];
|
|
48541
48550
|
|
|
48542
|
-
var computeId = function computeId(string) {
|
|
48543
|
-
var fallbackString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
48544
|
-
return typeof string === "string" ? createIdFromString(string) : fallbackString;
|
|
48545
|
-
};
|
|
48546
|
-
|
|
48547
48551
|
return /*#__PURE__*/React.createElement(Box, {
|
|
48548
48552
|
padding: "1px",
|
|
48549
48553
|
border: "1px solid ".concat(themeValues.borderColor),
|
|
48550
48554
|
borderRadius: "4px",
|
|
48551
48555
|
extraStyles: containerStyles
|
|
48552
48556
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
48553
|
-
childGap: "0"
|
|
48557
|
+
childGap: "0",
|
|
48558
|
+
role: "radiogroup"
|
|
48554
48559
|
}, sections.filter(function (section) {
|
|
48555
48560
|
return !section.hidden;
|
|
48556
48561
|
}).map(function (section) {
|
|
@@ -48570,12 +48575,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48570
48575
|
initial: initiallyOpen ? "open" : "closed",
|
|
48571
48576
|
key: "item-".concat(section.id),
|
|
48572
48577
|
extraStyles: borderStyles,
|
|
48573
|
-
disabled: section.disabled,
|
|
48574
|
-
"aria-disabled": section.disabled,
|
|
48575
48578
|
role: "radio",
|
|
48576
|
-
"aria-checked":
|
|
48577
|
-
"aria-labelledby": computeId(section.title, section.id),
|
|
48578
|
-
id: createIdFromString(typeof section.title === "string" ? section.title : section.id)
|
|
48579
|
+
"aria-checked": openSection === section.id
|
|
48579
48580
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
48580
48581
|
childGap: "0"
|
|
48581
48582
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -48605,22 +48606,24 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48605
48606
|
}, !section.hideRadioButton && /*#__PURE__*/React.createElement(Box, {
|
|
48606
48607
|
padding: "0"
|
|
48607
48608
|
}, /*#__PURE__*/React.createElement(RadioButton$2, {
|
|
48608
|
-
id:
|
|
48609
|
-
name:
|
|
48609
|
+
id: computeSectionId(section),
|
|
48610
|
+
name: computeSectionId(section),
|
|
48610
48611
|
ariaDescribedBy: ariaDescribedBy,
|
|
48612
|
+
ariaLabelledBy: "radio-input-".concat(computeSectionId(section)),
|
|
48611
48613
|
radioOn: openSection === section.id,
|
|
48612
48614
|
radioFocused: focused === section.id,
|
|
48613
48615
|
toggleRadio: section.disabled ? noop : function () {
|
|
48614
48616
|
return toggleOpenSection(section.id);
|
|
48615
|
-
}
|
|
48617
|
+
},
|
|
48618
|
+
tabIndex: "-1"
|
|
48616
48619
|
})), section.titleIcon && /*#__PURE__*/React.createElement(Cluster, {
|
|
48617
48620
|
align: "center"
|
|
48618
48621
|
}, section.titleIcon), /*#__PURE__*/React.createElement(Box, {
|
|
48619
48622
|
padding: section.titleIcon ? "0 0 0 8px" : "0"
|
|
48620
48623
|
}, /*#__PURE__*/React.createElement(Text$1, {
|
|
48621
48624
|
as: "label",
|
|
48622
|
-
|
|
48623
|
-
|
|
48625
|
+
color: CHARADE_GREY,
|
|
48626
|
+
htmlFor: "radio-input-".concat(computeSectionId(section))
|
|
48624
48627
|
}, section.title))), section.rightIcons && /*#__PURE__*/React.createElement(Cluster, {
|
|
48625
48628
|
childGap: "0.5rem"
|
|
48626
48629
|
}, section.rightIcons.map(function (icon) {
|