@thecb/components 8.4.10-beta.5 → 8.4.10
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 +54 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.esm.js +54 -17
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/radio-button-with-label/RadioButtonWithLabel.js +49 -33
- package/src/components/atoms/solid-divider/SolidDivider.js +4 -4
- package/src/components/molecules/module/Module.js +16 -8
- package/src/components/molecules/radio-group/RadioGroup.js +2 -0
- package/src/components/molecules/radio-group/RadioGroup.stories.js +1 -1
- package/src/components/molecules/radio-section/RadioSection.js +2 -0
- package/src/constants/colors.js +2 -0
- package/src/types/common/Field.ts +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -380,9 +380,9 @@ declare const Card: React.FC<Expand<CardProps> &
|
|
|
380
380
|
React.HTMLAttributes<HTMLElement>>;
|
|
381
381
|
|
|
382
382
|
interface Field {
|
|
383
|
-
hasErrors
|
|
384
|
-
dirty
|
|
385
|
-
rawValue
|
|
383
|
+
hasErrors: boolean;
|
|
384
|
+
dirty: boolean;
|
|
385
|
+
rawValue: string;
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
interface ReduxAction<T = string, P = {}> {
|
package/dist/index.esm.js
CHANGED
|
@@ -4989,6 +4989,8 @@ var BLACK_SQUEEZE = "#EAF2F7";
|
|
|
4989
4989
|
var GREY_CHATEAU = "#959CA8"; // CBS-500
|
|
4990
4990
|
|
|
4991
4991
|
var COOL_GREY_05 = "#fbfcfd"; // CBS-050
|
|
4992
|
+
|
|
4993
|
+
var MANATEE_GREY = "#878E9B"; // CB-60 (cool)
|
|
4992
4994
|
// BLUE
|
|
4993
4995
|
|
|
4994
4996
|
var CLOUDBURST_BLUE = "#26395c";
|
|
@@ -5123,6 +5125,7 @@ var colors = /*#__PURE__*/Object.freeze({
|
|
|
5123
5125
|
CHARADE_GREY: CHARADE_GREY,
|
|
5124
5126
|
GRECIAN_GREY: GRECIAN_GREY,
|
|
5125
5127
|
COOL_GREY_05: COOL_GREY_05,
|
|
5128
|
+
MANATEE_GREY: MANATEE_GREY,
|
|
5126
5129
|
BLACK_SQUEEZE: BLACK_SQUEEZE,
|
|
5127
5130
|
GREY_CHATEAU: GREY_CHATEAU,
|
|
5128
5131
|
CLOUDBURST_BLUE: CLOUDBURST_BLUE,
|
|
@@ -27102,7 +27105,24 @@ var RadioButtonWithLabel = function RadioButtonWithLabel(_ref5) {
|
|
|
27102
27105
|
themeValues = _ref5.themeValues,
|
|
27103
27106
|
index = _ref5.index,
|
|
27104
27107
|
_ref5$handleChange = _ref5.handleChange,
|
|
27105
|
-
handleChange = _ref5$handleChange === void 0 ? noop : _ref5$handleChange
|
|
27108
|
+
handleChange = _ref5$handleChange === void 0 ? noop : _ref5$handleChange,
|
|
27109
|
+
field = _ref5.field,
|
|
27110
|
+
config = _ref5.config;
|
|
27111
|
+
|
|
27112
|
+
var getDefaultChecked = function getDefaultChecked(value, idx) {
|
|
27113
|
+
var selectionExistsInConfig = config.map(function (c) {
|
|
27114
|
+
return c.value;
|
|
27115
|
+
}).includes(field.rawValue);
|
|
27116
|
+
|
|
27117
|
+
if (selectionExistsInConfig) {
|
|
27118
|
+
// if exists, selection comes from the redux-freeform state
|
|
27119
|
+
return field.rawValue === value;
|
|
27120
|
+
} // fallback to first option as default selection
|
|
27121
|
+
|
|
27122
|
+
|
|
27123
|
+
return idx === 0;
|
|
27124
|
+
};
|
|
27125
|
+
|
|
27106
27126
|
return /*#__PURE__*/React.createElement(InputAndLabelContainer, {
|
|
27107
27127
|
align: "center",
|
|
27108
27128
|
childGap: "0.5rem",
|
|
@@ -27120,7 +27140,7 @@ var RadioButtonWithLabel = function RadioButtonWithLabel(_ref5) {
|
|
|
27120
27140
|
setValue(e.target.value);
|
|
27121
27141
|
handleChange(e);
|
|
27122
27142
|
},
|
|
27123
|
-
defaultChecked: index
|
|
27143
|
+
defaultChecked: getDefaultChecked(value, index)
|
|
27124
27144
|
}), /*#__PURE__*/React.createElement(Text$1, {
|
|
27125
27145
|
as: "label",
|
|
27126
27146
|
htmlFor: id,
|
|
@@ -27324,14 +27344,16 @@ var fallbackValues$x = {
|
|
|
27324
27344
|
};
|
|
27325
27345
|
|
|
27326
27346
|
var SolidDivider = function SolidDivider(_ref) {
|
|
27327
|
-
var
|
|
27347
|
+
var borderColor = _ref.borderColor,
|
|
27348
|
+
borderSize = _ref.borderSize,
|
|
27349
|
+
themeValues = _ref.themeValues;
|
|
27328
27350
|
return /*#__PURE__*/React.createElement(Box, {
|
|
27329
27351
|
padding: "0",
|
|
27330
27352
|
minWidth: "100%",
|
|
27331
27353
|
minHeight: "1px",
|
|
27332
|
-
borderColor: themeValues.borderColor,
|
|
27333
|
-
borderSize: themeValues.borderSize,
|
|
27334
|
-
borderWidthOverride: "0px 0px ".concat(themeValues.borderSize, " 0px")
|
|
27354
|
+
borderColor: borderColor || themeValues.borderColor,
|
|
27355
|
+
borderSize: borderSize || themeValues.borderSize,
|
|
27356
|
+
borderWidthOverride: "0px 0px ".concat(borderSize || themeValues.borderSize, " 0px")
|
|
27335
27357
|
});
|
|
27336
27358
|
};
|
|
27337
27359
|
|
|
@@ -46785,26 +46807,30 @@ var fallbackValues$J = {
|
|
|
46785
46807
|
*/
|
|
46786
46808
|
|
|
46787
46809
|
var Module = function Module(_ref) {
|
|
46788
|
-
var
|
|
46810
|
+
var _ref$variant = _ref.variant,
|
|
46811
|
+
variant = _ref$variant === void 0 ? "default" : _ref$variant,
|
|
46812
|
+
as = _ref.as,
|
|
46813
|
+
disabled = _ref.disabled,
|
|
46814
|
+
heading = _ref.heading,
|
|
46815
|
+
rightTitleContent = _ref.rightTitleContent,
|
|
46816
|
+
_ref$titleID = _ref.titleID,
|
|
46817
|
+
titleID = _ref$titleID === void 0 ? "" : _ref$titleID,
|
|
46789
46818
|
_ref$spacing = _ref.spacing,
|
|
46790
46819
|
spacing = _ref$spacing === void 0 ? "1rem" : _ref$spacing,
|
|
46791
46820
|
_ref$padding = _ref.padding,
|
|
46792
46821
|
padding = _ref$padding === void 0 ? "0" : _ref$padding,
|
|
46822
|
+
_ref$margin = _ref.margin,
|
|
46823
|
+
margin = _ref$margin === void 0 ? "0" : _ref$margin,
|
|
46793
46824
|
_ref$spacingBottom = _ref.spacingBottom,
|
|
46794
46825
|
spacingBottom = _ref$spacingBottom === void 0 ? "2.5rem" : _ref$spacingBottom,
|
|
46795
|
-
themeValues = _ref.themeValues,
|
|
46796
|
-
_ref$variant = _ref.variant,
|
|
46797
|
-
variant = _ref$variant === void 0 ? "default" : _ref$variant,
|
|
46798
46826
|
fontSize = _ref.fontSize,
|
|
46799
|
-
|
|
46800
|
-
_ref$titleID = _ref.titleID,
|
|
46801
|
-
titleID = _ref$titleID === void 0 ? "" : _ref$titleID,
|
|
46802
|
-
rightTitleContent = _ref.rightTitleContent,
|
|
46827
|
+
themeValues = _ref.themeValues,
|
|
46803
46828
|
children = _ref.children;
|
|
46804
46829
|
var themedFontSize = variant === "small" ? "1.25rem" : variant === "default" ? "1.375rem" : "2rem";
|
|
46805
46830
|
var computedFontSize = fontSize || themedFontSize;
|
|
46806
46831
|
var themedElemType = variant === "small" ? "h6" : variant === "default" ? "h5" : "h2";
|
|
46807
46832
|
var computedElemType = as || themedElemType;
|
|
46833
|
+
var disabledStyles = "opacity: 0.40;";
|
|
46808
46834
|
var headingText = /*#__PURE__*/React.createElement(Title$1, {
|
|
46809
46835
|
weight: themeValues.fontWeight,
|
|
46810
46836
|
color: themeValues.fontColor,
|
|
@@ -46814,12 +46840,18 @@ var Module = function Module(_ref) {
|
|
|
46814
46840
|
extraStyles: "font-size: ".concat(computedFontSize, ";"),
|
|
46815
46841
|
id: titleID
|
|
46816
46842
|
}, heading);
|
|
46817
|
-
return /*#__PURE__*/React.createElement(
|
|
46843
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
46844
|
+
"aria-disabled": disabled,
|
|
46845
|
+
extraStyles: disabled && disabledStyles,
|
|
46846
|
+
padding: "0",
|
|
46847
|
+
role: "group"
|
|
46848
|
+
}, heading && !rightTitleContent && headingText, heading && rightTitleContent && /*#__PURE__*/React.createElement(Cluster, {
|
|
46818
46849
|
justify: "space-between",
|
|
46819
46850
|
align: "center",
|
|
46820
46851
|
nowrap: true
|
|
46821
46852
|
}, headingText, rightTitleContent), /*#__PURE__*/React.createElement(Box, {
|
|
46822
|
-
padding: "0 0 ".concat(spacingBottom)
|
|
46853
|
+
padding: "0 0 ".concat(spacingBottom),
|
|
46854
|
+
extraStyles: "margin: ".concat(margin)
|
|
46823
46855
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
46824
46856
|
padding: padding,
|
|
46825
46857
|
background: themeValues.backgroundColor,
|
|
@@ -49376,6 +49408,8 @@ var RadioGroup = function RadioGroup(_ref) {
|
|
|
49376
49408
|
groupName: groupName,
|
|
49377
49409
|
setValue: setValue,
|
|
49378
49410
|
handleChange: handleChange,
|
|
49411
|
+
field: field,
|
|
49412
|
+
config: config,
|
|
49379
49413
|
"aria-invalid": field.dirty && field.hasErrors
|
|
49380
49414
|
}));
|
|
49381
49415
|
})));
|
|
@@ -49432,6 +49466,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
49432
49466
|
initiallyOpen = _ref$initiallyOpen === void 0 ? true : _ref$initiallyOpen,
|
|
49433
49467
|
_ref$openHeight = _ref.openHeight,
|
|
49434
49468
|
openHeight = _ref$openHeight === void 0 ? "auto" : _ref$openHeight,
|
|
49469
|
+
_ref$containerStyles = _ref.containerStyles,
|
|
49470
|
+
containerStyles = _ref$containerStyles === void 0 ? "" : _ref$containerStyles,
|
|
49435
49471
|
ariaDescribedBy = _ref.ariaDescribedBy;
|
|
49436
49472
|
|
|
49437
49473
|
var handleKeyDown = function handleKeyDown(id, e) {
|
|
@@ -49484,7 +49520,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
49484
49520
|
return /*#__PURE__*/React.createElement(Box, {
|
|
49485
49521
|
padding: "1px",
|
|
49486
49522
|
border: "1px solid ".concat(themeValues.borderColor),
|
|
49487
|
-
borderRadius: "4px"
|
|
49523
|
+
borderRadius: "4px",
|
|
49524
|
+
extraStyles: containerStyles
|
|
49488
49525
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
49489
49526
|
childGap: "0"
|
|
49490
49527
|
}, sections.filter(function (section) {
|