@thecb/components 9.2.13-beta.0 → 9.2.13-beta.2
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 +81 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +81 -23
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/button-with-action/ButtonWithAction.js +76 -70
- package/src/components/atoms/checkbox/Checkbox.js +10 -2
- package/src/components/atoms/checkbox/Checkbox.stories.js +1 -0
- package/src/components/atoms/dropdown/Dropdown.js +2 -1
- package/src/components/atoms/icons/KebabMenuIcon.d.ts +1 -0
- package/src/components/atoms/icons/KebabMenuIcon.js +38 -0
- package/src/components/atoms/icons/TrashIcon.js +42 -40
- package/src/components/atoms/icons/icons.stories.js +3 -1
- package/src/components/atoms/icons/index.d.ts +1 -0
- package/src/components/atoms/icons/index.js +3 -1
- package/src/components/atoms/toggle-switch/ToggleSwitch.js +2 -1
- package/src/components/molecules/collapsible-section/CollapsibleSection.js +2 -1
- package/src/components/molecules/popover/Popover.js +2 -1
- package/src/components/molecules/popup-menu/PopupMenu.js +152 -0
- package/src/components/molecules/popup-menu/PopupMenu.stories.js +40 -0
- package/src/components/molecules/popup-menu/PopupMenu.styled.js +20 -0
- package/src/components/molecules/popup-menu/PopupMenu.theme.js +11 -0
- package/src/components/molecules/popup-menu/index.d.ts +25 -0
- package/src/components/molecules/popup-menu/index.js +3 -0
- package/src/components/molecules/popup-menu/popup-menu-item/PopupMenuItem.js +79 -0
- package/src/components/molecules/popup-menu/popup-menu-item/PopupMenuItem.styled.js +27 -0
- package/src/components/molecules/popup-menu/popup-menu-item/PopupMenuItem.theme.js +23 -0
- package/src/components/molecules/radio-section/RadioSection.js +22 -9
- package/src/components/molecules/terms-and-conditions/TermsAndConditions.stories.js +3 -1
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +4 -0
- package/src/constants/keyboard.js +7 -0
- package/src/util/general.js +10 -0
package/dist/index.cjs.js
CHANGED
|
@@ -6371,6 +6371,15 @@ var titleCaseString = function titleCaseString(string) {
|
|
|
6371
6371
|
var kebabCaseString = function kebabCaseString(string) {
|
|
6372
6372
|
return string === null || string === void 0 ? void 0 : string.replaceAll(" ", "-").toLowerCase();
|
|
6373
6373
|
};
|
|
6374
|
+
var wrapIndex = function wrapIndex(index, length) {
|
|
6375
|
+
if (index <= -1) {
|
|
6376
|
+
return length - 1;
|
|
6377
|
+
} else if (index >= length) {
|
|
6378
|
+
return 0;
|
|
6379
|
+
} else {
|
|
6380
|
+
return index;
|
|
6381
|
+
}
|
|
6382
|
+
};
|
|
6374
6383
|
|
|
6375
6384
|
var general = /*#__PURE__*/Object.freeze({
|
|
6376
6385
|
__proto__: null,
|
|
@@ -6391,7 +6400,8 @@ var general = /*#__PURE__*/Object.freeze({
|
|
|
6391
6400
|
throttle: throttle,
|
|
6392
6401
|
titleCaseWord: titleCaseWord,
|
|
6393
6402
|
titleCaseString: titleCaseString,
|
|
6394
|
-
kebabCaseString: kebabCaseString
|
|
6403
|
+
kebabCaseString: kebabCaseString,
|
|
6404
|
+
wrapIndex: wrapIndex
|
|
6395
6405
|
});
|
|
6396
6406
|
|
|
6397
6407
|
var _excluded$1 = ["themeValues", "weight", "color", "textWrap", "extraStyles", "hoverStyles", "onClick", "onKeyPress", "as", "dataQa", "children", "variant"];
|
|
@@ -12927,7 +12937,7 @@ var Spinner = function Spinner(_ref) {
|
|
|
12927
12937
|
*/
|
|
12928
12938
|
|
|
12929
12939
|
|
|
12930
|
-
var ButtonWithAction = function
|
|
12940
|
+
var ButtonWithAction = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
12931
12941
|
var _ref2$action = _ref2.action,
|
|
12932
12942
|
action = _ref2$action === void 0 ? noop : _ref2$action,
|
|
12933
12943
|
_ref2$variant = _ref2.variant,
|
|
@@ -12958,6 +12968,7 @@ var ButtonWithAction = function ButtonWithAction(_ref2) {
|
|
|
12958
12968
|
var activeStyles = "\n outline: none;\n background-color: ".concat(themeValues.activeBackgroundColor, ";\n border-color: ").concat(themeValues.activeBorderColor, ";\n color: ").concat(themeValues.activeColor, ";\n text-decoration: ").concat(variant === "ghost" || variant === "smallGhost" ? "underline" : "none", ";\n ");
|
|
12959
12969
|
var disabledStyles = "\n background-color: #6D717E;\n border-color: #6D717E;\n color: #FFFFFF;\n cursor: default;\n &:focus {\n box-shadow: 0 0 10px #6D717E;\n outline: none;\n }\n ".concat(extraDisabledStyles, "\n ");
|
|
12960
12970
|
return /*#__PURE__*/React__default.createElement(Box, _extends({
|
|
12971
|
+
ref: ref,
|
|
12961
12972
|
variant: variant,
|
|
12962
12973
|
padding: themeValues.padding,
|
|
12963
12974
|
minHeight: themeValues.height,
|
|
@@ -12986,7 +12997,7 @@ var ButtonWithAction = function ButtonWithAction(_ref2) {
|
|
|
12986
12997
|
textWrap: textWrap,
|
|
12987
12998
|
extraStyles: textExtraStyles
|
|
12988
12999
|
}, text)));
|
|
12989
|
-
};
|
|
13000
|
+
});
|
|
12990
13001
|
|
|
12991
13002
|
var primaryColor = {
|
|
12992
13003
|
info: "".concat(WHITE),
|
|
@@ -15300,7 +15311,8 @@ var ShoppingCartIcon = function ShoppingCartIcon() {
|
|
|
15300
15311
|
};
|
|
15301
15312
|
|
|
15302
15313
|
var TrashIcon = function TrashIcon(_ref) {
|
|
15303
|
-
var themeValues = _ref.themeValues
|
|
15314
|
+
var themeValues = _ref.themeValues,
|
|
15315
|
+
iconFill = _ref.iconFill;
|
|
15304
15316
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
15305
15317
|
width: "20px",
|
|
15306
15318
|
height: "20px",
|
|
@@ -15324,12 +15336,12 @@ var TrashIcon = function TrashIcon(_ref) {
|
|
|
15324
15336
|
xlinkHref: "#trash-path-1"
|
|
15325
15337
|
})), /*#__PURE__*/React__default.createElement("use", {
|
|
15326
15338
|
id: "trash-Mask",
|
|
15327
|
-
fill: themeValues.singleIconColor,
|
|
15339
|
+
fill: iconFill !== null && iconFill !== void 0 ? iconFill : themeValues.singleIconColor,
|
|
15328
15340
|
fillRule: "nonzero",
|
|
15329
15341
|
xlinkHref: "#trash-path-1"
|
|
15330
15342
|
}), /*#__PURE__*/React__default.createElement("polygon", {
|
|
15331
15343
|
id: "trash-Path",
|
|
15332
|
-
fill: themeValues.singleIconColor,
|
|
15344
|
+
fill: iconFill !== null && iconFill !== void 0 ? iconFill : themeValues.singleIconColor,
|
|
15333
15345
|
fillRule: "nonzero",
|
|
15334
15346
|
mask: "url(#trash-mask-2)",
|
|
15335
15347
|
points: "0 0 20 0 20 20 0 20"
|
|
@@ -18260,6 +18272,34 @@ var PlusCircleIcon = function PlusCircleIcon(_ref) {
|
|
|
18260
18272
|
}));
|
|
18261
18273
|
};
|
|
18262
18274
|
|
|
18275
|
+
var KebabMenuIcon = function KebabMenuIcon() {
|
|
18276
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
18277
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18278
|
+
width: "21",
|
|
18279
|
+
height: "32",
|
|
18280
|
+
viewBox: "0 0 21 32",
|
|
18281
|
+
fill: "none"
|
|
18282
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
18283
|
+
d: "M0 4C0 1.79086 1.79086 0 4 0L17 0C19.2091 0 21 1.79086 21 4V28C21 30.2091 19.2091 32 17 32H4C1.79086 32 0 30.2091 0 28L0 4Z",
|
|
18284
|
+
fill: "none"
|
|
18285
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
18286
|
+
fillRule: "evenodd",
|
|
18287
|
+
clipRule: "evenodd",
|
|
18288
|
+
d: "M10.5 6C9.39333 6 8.5 6.89333 8.5 8C8.5 9.10667 9.39333 10 10.5 10C11.6067 10 12.5 9.10667 12.5 8C12.5 6.89333 11.6067 6 10.5 6Z",
|
|
18289
|
+
fill: "#3B5BDB"
|
|
18290
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
18291
|
+
fillRule: "evenodd",
|
|
18292
|
+
clipRule: "evenodd",
|
|
18293
|
+
d: "M10.5 14C9.39333 14 8.5 14.8933 8.5 16C8.5 17.1067 9.39333 18 10.5 18C11.6067 18 12.5 17.1067 12.5 16C12.5 14.8933 11.6067 14 10.5 14Z",
|
|
18294
|
+
fill: "#3B5BDB"
|
|
18295
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
18296
|
+
fillRule: "evenodd",
|
|
18297
|
+
clipRule: "evenodd",
|
|
18298
|
+
d: "M10.5 22C9.39333 22 8.5 22.9067 8.5 24C8.5 25.0933 9.40667 26 10.5 26C11.5933 26 12.5 25.0933 12.5 24C12.5 22.9067 11.6067 22 10.5 22Z",
|
|
18299
|
+
fill: "#3B5BDB"
|
|
18300
|
+
}));
|
|
18301
|
+
};
|
|
18302
|
+
|
|
18263
18303
|
var color$2 = "#15749D";
|
|
18264
18304
|
var hoverColor$1 = "#116285";
|
|
18265
18305
|
var activeColor$1 = "#0E506D";
|
|
@@ -22086,6 +22126,14 @@ var fallbackValues$d = {
|
|
|
22086
22126
|
disabledCheckedStyles: disabledCheckedStyles
|
|
22087
22127
|
};
|
|
22088
22128
|
|
|
22129
|
+
var ARROW_LEFT = 37;
|
|
22130
|
+
var ARROW_UP = 38;
|
|
22131
|
+
var ARROW_RIGHT = 39;
|
|
22132
|
+
var ARROW_DOWN = 40;
|
|
22133
|
+
var ENTER = 13;
|
|
22134
|
+
var ESCAPE = 27;
|
|
22135
|
+
var SPACEBAR = 32;
|
|
22136
|
+
|
|
22089
22137
|
var CheckboxContainer = styled__default.div.withConfig({
|
|
22090
22138
|
displayName: "Checkbox__CheckboxContainer",
|
|
22091
22139
|
componentId: "sc-36kqbv-0"
|
|
@@ -22146,6 +22194,7 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22146
22194
|
checkboxMargin = _ref4$checkboxMargin === void 0 ? "0 16px 0 0" : _ref4$checkboxMargin,
|
|
22147
22195
|
extraStyles = _ref4.extraStyles,
|
|
22148
22196
|
textExtraStyles = _ref4.textExtraStyles,
|
|
22197
|
+
labelledById = _ref4.labelledById,
|
|
22149
22198
|
_ref4$dataQa = _ref4.dataQa,
|
|
22150
22199
|
dataQa = _ref4$dataQa === void 0 ? null : _ref4$dataQa;
|
|
22151
22200
|
|
|
@@ -22155,11 +22204,14 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22155
22204
|
setFocused = _useState2[1];
|
|
22156
22205
|
|
|
22157
22206
|
var handleClick = function handleClick(e, func) {
|
|
22158
|
-
if (
|
|
22207
|
+
if (e.keyCode === ENTER) {
|
|
22159
22208
|
func();
|
|
22160
22209
|
}
|
|
22161
22210
|
};
|
|
22162
22211
|
|
|
22212
|
+
var titleId = title ? "checkboxlabel-".concat(name) : undefined;
|
|
22213
|
+
var ariaLabelledById = labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
|
|
22214
|
+
var ariaLabel = ariaLabelledById ? undefined : name;
|
|
22163
22215
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
22164
22216
|
padding: "0",
|
|
22165
22217
|
tabIndex: "0",
|
|
@@ -22183,7 +22235,8 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22183
22235
|
id: "checkbox-".concat(name),
|
|
22184
22236
|
disabled: disabled,
|
|
22185
22237
|
name: name,
|
|
22186
|
-
"aria-label":
|
|
22238
|
+
"aria-label": ariaLabel,
|
|
22239
|
+
"aria-labelledby": ariaLabelledById,
|
|
22187
22240
|
checked: checked,
|
|
22188
22241
|
onChange: onChange,
|
|
22189
22242
|
tabIndex: "-1",
|
|
@@ -22210,6 +22263,7 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22210
22263
|
}, /*#__PURE__*/React__default.createElement("polyline", {
|
|
22211
22264
|
points: "20 6 9 17 4 12"
|
|
22212
22265
|
})))), title && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
22266
|
+
id: titleId,
|
|
22213
22267
|
variant: "p",
|
|
22214
22268
|
weight: themeValues.textFontWeight,
|
|
22215
22269
|
color: themeValues.textColor,
|
|
@@ -24122,7 +24176,7 @@ var Dropdown = function Dropdown(_ref13) {
|
|
|
24122
24176
|
return handleItemSelection(e, choice, i);
|
|
24123
24177
|
},
|
|
24124
24178
|
onKeyDown: function onKeyDown(e) {
|
|
24125
|
-
if (e.keyCode ===
|
|
24179
|
+
if (e.keyCode === ENTER) {
|
|
24126
24180
|
handleItemSelection(e, choice, i);
|
|
24127
24181
|
}
|
|
24128
24182
|
},
|
|
@@ -25488,7 +25542,7 @@ var Popover = function Popover(_ref) {
|
|
|
25488
25542
|
handleTogglePopover(false);
|
|
25489
25543
|
},
|
|
25490
25544
|
onKeyDown: function onKeyDown(e) {
|
|
25491
|
-
if (e.keyCode ===
|
|
25545
|
+
if (e.keyCode === ESCAPE) {
|
|
25492
25546
|
handleTogglePopover(false);
|
|
25493
25547
|
}
|
|
25494
25548
|
},
|
|
@@ -38299,7 +38353,7 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
|
|
|
38299
38353
|
});
|
|
38300
38354
|
|
|
38301
38355
|
var handleKeyDown = function handleKeyDown(e) {
|
|
38302
|
-
if (e.keyCode ===
|
|
38356
|
+
if (e.keyCode === ENTER) {
|
|
38303
38357
|
onToggle();
|
|
38304
38358
|
}
|
|
38305
38359
|
};
|
|
@@ -39828,7 +39882,7 @@ var CollapsibleSection = function CollapsibleSection(_ref) {
|
|
|
39828
39882
|
extraStyles = _ref$extraStyles === void 0 ? "" : _ref$extraStyles;
|
|
39829
39883
|
|
|
39830
39884
|
var handleKeyDown = function handleKeyDown(e) {
|
|
39831
|
-
if (e.keyCode ===
|
|
39885
|
+
if (e.keyCode === ENTER) {
|
|
39832
39886
|
toggleSection();
|
|
39833
39887
|
}
|
|
39834
39888
|
};
|
|
@@ -47859,6 +47913,8 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
|
|
|
47859
47913
|
})))));
|
|
47860
47914
|
};
|
|
47861
47915
|
|
|
47916
|
+
var TermsAndConditionsTitleDivId = "terms-and-conditions-title";
|
|
47917
|
+
|
|
47862
47918
|
var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
47863
47919
|
var _ref$showCheckbox = _ref.showCheckbox,
|
|
47864
47920
|
showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
|
|
@@ -47921,7 +47977,8 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
47921
47977
|
checked: isChecked,
|
|
47922
47978
|
onChange: onCheck,
|
|
47923
47979
|
checkboxMargin: checkboxMargin,
|
|
47924
|
-
extraStyles: "align-self: flex-start;"
|
|
47980
|
+
extraStyles: "align-self: flex-start;",
|
|
47981
|
+
labelledById: TermsAndConditionsTitleDivId
|
|
47925
47982
|
}), /*#__PURE__*/React__default.createElement(Stack, {
|
|
47926
47983
|
childGap: "0.25rem",
|
|
47927
47984
|
fullHeight: true
|
|
@@ -47929,7 +47986,8 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
47929
47986
|
justify: "flex-start",
|
|
47930
47987
|
align: "center",
|
|
47931
47988
|
nowrap: true,
|
|
47932
|
-
extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
|
|
47989
|
+
extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };",
|
|
47990
|
+
id: TermsAndConditionsTitleDivId
|
|
47933
47991
|
}, description && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
47934
47992
|
color: CHARADE_GREY
|
|
47935
47993
|
}, description), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
|
|
@@ -48696,21 +48754,21 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
48696
48754
|
} // Allow Enter and Space to select a section
|
|
48697
48755
|
|
|
48698
48756
|
|
|
48699
|
-
if (
|
|
48757
|
+
if (e.keyCode === ENTER || e.keyCode === SPACEBAR) {
|
|
48700
48758
|
e.preventDefault();
|
|
48701
48759
|
toggleOpenSection(id);
|
|
48702
48760
|
} // Allow Up and Down arrow navigation between sections
|
|
48703
48761
|
|
|
48704
48762
|
|
|
48705
|
-
if (
|
|
48706
|
-
var _sections$
|
|
48763
|
+
if (e.keyCode == ARROW_UP || e.keyCode == ARROW_DOWN || e.keyCode == ARROW_LEFT || e.keyCode == ARROW_RIGHT) {
|
|
48764
|
+
var _sectionRefs$current$, _sectionRefs$current$2, _sections$nextIndex, _sections$nextIndex2;
|
|
48707
48765
|
|
|
48708
48766
|
e.preventDefault();
|
|
48709
|
-
var
|
|
48710
|
-
var
|
|
48711
|
-
sectionRefs.current[
|
|
48712
|
-
setFocused((_sections$
|
|
48713
|
-
toggleOpenSection((_sections$
|
|
48767
|
+
var indexIncrement = e.keyCode == ARROW_RIGHT || e.keyCode == ARROW_DOWN ? 1 : -1;
|
|
48768
|
+
var nextIndex = wrapIndex(i + indexIncrement, sections.length);
|
|
48769
|
+
sectionRefs === null || sectionRefs === void 0 ? void 0 : (_sectionRefs$current$ = sectionRefs.current[nextIndex]) === null || _sectionRefs$current$ === void 0 ? void 0 : (_sectionRefs$current$2 = _sectionRefs$current$.current) === null || _sectionRefs$current$2 === void 0 ? void 0 : _sectionRefs$current$2.focus();
|
|
48770
|
+
setFocused((_sections$nextIndex = sections[nextIndex]) === null || _sections$nextIndex === void 0 ? void 0 : _sections$nextIndex.id);
|
|
48771
|
+
toggleOpenSection((_sections$nextIndex2 = sections[nextIndex]) === null || _sections$nextIndex2 === void 0 ? void 0 : _sections$nextIndex2.id);
|
|
48714
48772
|
}
|
|
48715
48773
|
};
|
|
48716
48774
|
|
|
@@ -49888,6 +49946,7 @@ exports.ImageBox = ImageBox;
|
|
|
49888
49946
|
exports.Imposter = Imposter;
|
|
49889
49947
|
exports.InternalLink = InternalLink;
|
|
49890
49948
|
exports.Jumbo = Jumbo$1;
|
|
49949
|
+
exports.KebabMenuIcon = KebabMenuIcon;
|
|
49891
49950
|
exports.KioskImage = KioskImage;
|
|
49892
49951
|
exports.LabeledAmount = LabeledAmount$1;
|
|
49893
49952
|
exports.LineItem = LineItem$1;
|