@thecb/components 10.5.0-beta.5 → 10.5.0
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 +60 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +17 -9
- package/dist/index.esm.js +60 -33
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/icons/IconQuitLarge.js +0 -1
- package/src/components/molecules/modal/Modal.stories.js +2 -2
- package/src/components/molecules/modal/ModalControlV2.js +20 -14
- package/src/components/molecules/modal/__private__/ButtonLayoutWrapper.js +2 -2
- package/src/components/molecules/modal/__private__/CancelButton.js +9 -4
- package/src/components/molecules/modal/__private__/CloseButton.js +9 -4
- package/src/components/molecules/modal/__private__/ContinueButton.js +10 -5
- package/src/components/molecules/toast-notification/ToastNotification.js +16 -12
- package/src/components/molecules/toast-notification/ToastNotification.stories.js +38 -0
- package/src/constants/style_constants.d.ts +11 -3
- package/src/constants/style_constants.js +13 -3
- package/src/hooks/use-toast-notification/index.js +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -4908,8 +4908,19 @@ var themeUtils = /*#__PURE__*/Object.freeze({
|
|
|
4908
4908
|
|
|
4909
4909
|
/* These are constants used by nav frontend components */
|
|
4910
4910
|
|
|
4911
|
+
var BORDER_RADIUS = {
|
|
4912
|
+
MD: "4px" // Figma: Corners/Standard Corner
|
|
4913
|
+
};
|
|
4911
4914
|
var BORDER_THIN = "1px";
|
|
4912
|
-
var
|
|
4915
|
+
var FONT_SIZE = {
|
|
4916
|
+
XS: "0.750rem",
|
|
4917
|
+
// 12px
|
|
4918
|
+
SM: "0.875rem",
|
|
4919
|
+
// 14px
|
|
4920
|
+
MD: "1.000rem",
|
|
4921
|
+
// 16px
|
|
4922
|
+
LG: "1.125rem" // 18px
|
|
4923
|
+
};
|
|
4913
4924
|
var FONT_WEIGHT_REGULAR = "400";
|
|
4914
4925
|
var FONT_WEIGHT_SEMIBOLD = "600";
|
|
4915
4926
|
var FONT_WEIGHT_BOLD = "700";
|
|
@@ -4919,13 +4930,17 @@ var COMPACT_JUMBO_HEIGHT = "65px";
|
|
|
4919
4930
|
var JUMBO_HEIGHT = "300px";
|
|
4920
4931
|
var SPACER_HEIGHT = "65px";
|
|
4921
4932
|
var LINK_TEXT_DECORATION = "underline solid 1px";
|
|
4922
|
-
var
|
|
4923
|
-
|
|
4933
|
+
var SPACING = {
|
|
4934
|
+
XS: "1.0rem",
|
|
4935
|
+
// Figma: Spacing/XS
|
|
4936
|
+
MD: "1.5rem" // Figma: Spacing/Normal
|
|
4937
|
+
};
|
|
4924
4938
|
|
|
4925
4939
|
var style_constants = /*#__PURE__*/Object.freeze({
|
|
4926
4940
|
__proto__: null,
|
|
4941
|
+
BORDER_RADIUS: BORDER_RADIUS,
|
|
4927
4942
|
BORDER_THIN: BORDER_THIN,
|
|
4928
|
-
|
|
4943
|
+
FONT_SIZE: FONT_SIZE,
|
|
4929
4944
|
FONT_WEIGHT_REGULAR: FONT_WEIGHT_REGULAR,
|
|
4930
4945
|
FONT_WEIGHT_SEMIBOLD: FONT_WEIGHT_SEMIBOLD,
|
|
4931
4946
|
FONT_WEIGHT_BOLD: FONT_WEIGHT_BOLD,
|
|
@@ -4935,8 +4950,7 @@ var style_constants = /*#__PURE__*/Object.freeze({
|
|
|
4935
4950
|
JUMBO_HEIGHT: JUMBO_HEIGHT,
|
|
4936
4951
|
SPACER_HEIGHT: SPACER_HEIGHT,
|
|
4937
4952
|
LINK_TEXT_DECORATION: LINK_TEXT_DECORATION,
|
|
4938
|
-
|
|
4939
|
-
SPACING_NORMAL: SPACING_NORMAL
|
|
4953
|
+
SPACING: SPACING
|
|
4940
4954
|
});
|
|
4941
4955
|
|
|
4942
4956
|
/*
|
|
@@ -14191,7 +14205,7 @@ var IconQuitLarge = function IconQuitLarge(_ref) {
|
|
|
14191
14205
|
version: "1.1",
|
|
14192
14206
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14193
14207
|
xmlnsXlink: "http://www.w3.org/1999/xlink"
|
|
14194
|
-
}, /*#__PURE__*/React__default.createElement("
|
|
14208
|
+
}, /*#__PURE__*/React__default.createElement("defs", null, /*#__PURE__*/React__default.createElement("polygon", {
|
|
14195
14209
|
id: "quit-large-path-1",
|
|
14196
14210
|
points: "18.9999989 6.40999946 17.589999 4.9999997 11.9999993 10.5899995 6.40999946 4.9999997 4.9999997 6.40999946 10.5899995 11.9999993 4.9999997 17.589999 6.40999946 18.9999989 11.9999993 13.409999 17.589999 18.9999989 18.9999989 17.589999 13.409999 11.9999993"
|
|
14197
14211
|
})), /*#__PURE__*/React__default.createElement("g", {
|
|
@@ -26005,7 +26019,7 @@ var useToastNotification = function useToastNotification() {
|
|
|
26005
26019
|
toastState = _useState2[0],
|
|
26006
26020
|
setToastState = _useState2[1];
|
|
26007
26021
|
React.useEffect(function () {
|
|
26008
|
-
if (toastState.isOpen) {
|
|
26022
|
+
if (toastState.isOpen && timeout > 0) {
|
|
26009
26023
|
setTimeout(function () {
|
|
26010
26024
|
setToastState(initialToastState);
|
|
26011
26025
|
}, timeout);
|
|
@@ -46462,7 +46476,7 @@ var ButtonLayoutWrapper = function ButtonLayoutWrapper(_ref) {
|
|
|
46462
46476
|
var safeChildren = Array.isArray(children) ? children : [children];
|
|
46463
46477
|
var flexGrow = isMobile ? "flex-grow: 1;" : "";
|
|
46464
46478
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
46465
|
-
padding:
|
|
46479
|
+
padding: SPACING.MD
|
|
46466
46480
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
46467
46481
|
childGap: "1rem",
|
|
46468
46482
|
direction: "row",
|
|
@@ -46487,16 +46501,18 @@ var CancelButton = function CancelButton(_ref) {
|
|
|
46487
46501
|
hideModal = _ref$hideModal === void 0 ? noop : _ref$hideModal,
|
|
46488
46502
|
_ref$isMobile = _ref.isMobile,
|
|
46489
46503
|
isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile;
|
|
46490
|
-
var
|
|
46504
|
+
var fontSize = "font-size: ".concat(isMobile ? FONT_SIZE.XS : FONT_SIZE.SM, ";");
|
|
46505
|
+
var width = isMobile ? "width: 100%;" : "";
|
|
46491
46506
|
return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
46492
46507
|
action: cancelAction ? cancelAction : hideModal,
|
|
46493
|
-
borderRadius:
|
|
46508
|
+
borderRadius: BORDER_RADIUS.MD,
|
|
46494
46509
|
className: "modal-cancel-button",
|
|
46495
46510
|
dataQa: cancelButtonText,
|
|
46496
|
-
extraStyles: "".concat(buttonExtraStyles, "; margin: 0; ").concat(
|
|
46511
|
+
extraStyles: "".concat(buttonExtraStyles, "; margin: 0; ").concat(width),
|
|
46497
46512
|
name: cancelButtonText,
|
|
46498
46513
|
role: "button",
|
|
46499
46514
|
text: cancelButtonText,
|
|
46515
|
+
textExtraStyles: "".concat(fontSize),
|
|
46500
46516
|
variant: "secondary"
|
|
46501
46517
|
});
|
|
46502
46518
|
};
|
|
@@ -46510,16 +46526,18 @@ var CloseButton = function CloseButton(_ref) {
|
|
|
46510
46526
|
hideModal = _ref$hideModal === void 0 ? noop : _ref$hideModal,
|
|
46511
46527
|
_ref$isMobile = _ref.isMobile,
|
|
46512
46528
|
isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile;
|
|
46513
|
-
var
|
|
46529
|
+
var fontSize = "font-size: ".concat(isMobile ? FONT_SIZE.XS : FONT_SIZE.SM, ";");
|
|
46530
|
+
var width = isMobile ? "width: 100%;" : "";
|
|
46514
46531
|
return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
46515
46532
|
action: hideModal,
|
|
46516
|
-
borderRadius:
|
|
46533
|
+
borderRadius: BORDER_RADIUS.MD,
|
|
46517
46534
|
className: "modal-close-button",
|
|
46518
46535
|
dataQa: closeButtonText,
|
|
46519
|
-
extraStyles: "".concat(buttonExtraStyles, "; margin: 0; ").concat(
|
|
46536
|
+
extraStyles: "".concat(buttonExtraStyles, "; margin: 0; ").concat(width),
|
|
46520
46537
|
name: closeButtonText,
|
|
46521
46538
|
role: "button",
|
|
46522
46539
|
text: closeButtonText,
|
|
46540
|
+
textExtraStyles: "".concat(fontSize),
|
|
46523
46541
|
variant: "primary"
|
|
46524
46542
|
});
|
|
46525
46543
|
};
|
|
@@ -46542,19 +46560,21 @@ var ContinueButton = function ContinueButton(_ref) {
|
|
|
46542
46560
|
_ref$useDangerButton = _ref.useDangerButton,
|
|
46543
46561
|
useDangerButton = _ref$useDangerButton === void 0 ? false : _ref$useDangerButton;
|
|
46544
46562
|
var ContinueButtonAtom = continueURL ? ButtonWithLink : ButtonWithAction;
|
|
46545
|
-
var
|
|
46563
|
+
var fontSize = "font-size: ".concat(isMobile ? FONT_SIZE.XS : FONT_SIZE.SM, ";");
|
|
46564
|
+
var width = isMobile ? "width: 100%;" : "";
|
|
46546
46565
|
return /*#__PURE__*/React__default.createElement(ContinueButtonAtom, {
|
|
46547
46566
|
action: continueAction,
|
|
46548
|
-
borderRadius:
|
|
46567
|
+
borderRadius: BORDER_RADIUS.MD,
|
|
46549
46568
|
className: "modal-continue-button",
|
|
46550
46569
|
dataQa: continueButtonText,
|
|
46551
46570
|
disabled: isContinueActionDisabled,
|
|
46552
|
-
extraStyles: "".concat(buttonExtraStyles, "; margin: 0; ").concat(
|
|
46571
|
+
extraStyles: "".concat(buttonExtraStyles, "; margin: 0; ").concat(width),
|
|
46553
46572
|
isLoading: isLoading,
|
|
46554
|
-
linkExtraStyles: "display: inline-block; ".concat(
|
|
46573
|
+
linkExtraStyles: "display: inline-block; ".concat(width),
|
|
46555
46574
|
name: continueButtonText,
|
|
46556
46575
|
role: "button",
|
|
46557
46576
|
text: continueButtonText,
|
|
46577
|
+
textExtraStyles: "".concat(fontSize),
|
|
46558
46578
|
url: continueURL,
|
|
46559
46579
|
variant: useDangerButton ? "danger" : "primary"
|
|
46560
46580
|
});
|
|
@@ -46609,11 +46629,11 @@ var Modal$2 = function Modal(_ref) {
|
|
|
46609
46629
|
_ref$maxHeight = _ref.maxHeight,
|
|
46610
46630
|
maxHeight = _ref$maxHeight === void 0 ? "" : _ref$maxHeight,
|
|
46611
46631
|
_ref$modalBodyBg = _ref.modalBodyBg,
|
|
46612
|
-
modalBodyBg = _ref$modalBodyBg === void 0 ?
|
|
46632
|
+
modalBodyBg = _ref$modalBodyBg === void 0 ? "" : _ref$modalBodyBg,
|
|
46613
46633
|
_ref$modalBodyText = _ref.modalBodyText,
|
|
46614
46634
|
modalBodyText = _ref$modalBodyText === void 0 ? "" : _ref$modalBodyText,
|
|
46615
46635
|
_ref$modalHeaderBg = _ref.modalHeaderBg,
|
|
46616
|
-
modalHeaderBg = _ref$modalHeaderBg === void 0 ?
|
|
46636
|
+
modalHeaderBg = _ref$modalHeaderBg === void 0 ? "" : _ref$modalHeaderBg,
|
|
46617
46637
|
_ref$modalHeaderText = _ref.modalHeaderText,
|
|
46618
46638
|
modalHeaderText = _ref$modalHeaderText === void 0 ? "" : _ref$modalHeaderText,
|
|
46619
46639
|
_ref$modalOpen = _ref.modalOpen,
|
|
@@ -46671,8 +46691,8 @@ var Modal$2 = function Modal(_ref) {
|
|
|
46671
46691
|
WebkitBackdropFilter: blurUnderlay ? "blur(4px)" : "none"
|
|
46672
46692
|
},
|
|
46673
46693
|
dialogStyle: {
|
|
46674
|
-
borderRadius:
|
|
46675
|
-
margin:
|
|
46694
|
+
borderRadius: BORDER_RADIUS.MD,
|
|
46695
|
+
margin: SPACING.XS,
|
|
46676
46696
|
overflow: "auto",
|
|
46677
46697
|
width: isMobile ? "" : customWidth || "615px"
|
|
46678
46698
|
},
|
|
@@ -46684,29 +46704,29 @@ var Modal$2 = function Modal(_ref) {
|
|
|
46684
46704
|
padding: "0",
|
|
46685
46705
|
boxShadow: "inset 0px -2px 0px 0px rgb(0, 80, 149)"
|
|
46686
46706
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
46687
|
-
background: modalHeaderBg,
|
|
46707
|
+
background: modalHeaderBg || WHITE,
|
|
46688
46708
|
borderColor: SILVER_GREY,
|
|
46689
46709
|
borderWidthOverride: "0 0 ".concat(BORDER_THIN, " 0"),
|
|
46690
|
-
padding: "".concat(
|
|
46710
|
+
padding: "".concat(SPACING.XS, " ").concat(SPACING.MD)
|
|
46691
46711
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
46692
46712
|
justify: "flex-start",
|
|
46693
46713
|
align: "center"
|
|
46694
46714
|
}, /*#__PURE__*/React__default.createElement(Title$1, {
|
|
46695
46715
|
as: "h2",
|
|
46696
46716
|
weight: FONT_WEIGHT_SEMIBOLD,
|
|
46697
|
-
fontSize:
|
|
46717
|
+
fontSize: isMobile ? FONT_SIZE.MD : FONT_SIZE.LG
|
|
46698
46718
|
}, modalHeaderText))), /*#__PURE__*/React__default.createElement(Box, {
|
|
46699
|
-
background: modalBodyBg,
|
|
46719
|
+
background: modalBodyBg || ATHENS_GREY,
|
|
46700
46720
|
padding: "0"
|
|
46701
46721
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
46702
|
-
padding:
|
|
46722
|
+
padding: SPACING.MD,
|
|
46703
46723
|
borderWidthOverride: !noButtons && "0 0 ".concat(BORDER_THIN, " 0"),
|
|
46704
46724
|
borderColor: !noButtons && SILVER_GREY,
|
|
46705
46725
|
extraStyles: maxHeight ? "max-height: ".concat(maxHeight, "; overflow: auto;") : ""
|
|
46706
46726
|
}, defaultWrapper ? /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
46707
|
-
variant: "p"
|
|
46727
|
+
variant: isMobile ? "pS" : "p"
|
|
46708
46728
|
}, modalBodyText) : /*#__PURE__*/React__default.createElement(Box, {
|
|
46709
|
-
padding: maxHeight ? "0 0 ".concat(
|
|
46729
|
+
padding: maxHeight ? "0 0 ".concat(SPACING.XS, " 0") : "0"
|
|
46710
46730
|
}, modalBodyText)), noButtons ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null) : /*#__PURE__*/React__default.createElement(ButtonLayoutWrapper, {
|
|
46711
46731
|
isMobile: isMobile
|
|
46712
46732
|
}, [hasCancelButton && /*#__PURE__*/React__default.createElement(CancelButton, {
|
|
@@ -50238,7 +50258,9 @@ var ToastNotification = function ToastNotification(_ref) {
|
|
|
50238
50258
|
height = _ref$height === void 0 ? "56px" : _ref$height,
|
|
50239
50259
|
_ref$childGap = _ref.childGap,
|
|
50240
50260
|
childGap = _ref$childGap === void 0 ? "1rem" : _ref$childGap,
|
|
50241
|
-
backgroundColor = _ref.backgroundColor
|
|
50261
|
+
backgroundColor = _ref.backgroundColor,
|
|
50262
|
+
_ref$role = _ref.role,
|
|
50263
|
+
role = _ref$role === void 0 ? "alert" : _ref$role;
|
|
50242
50264
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
50243
50265
|
onClick: closeToastNotification,
|
|
50244
50266
|
background: backgroundColor ? backgroundColor : variant === VARIANTS.SUCCESS ? HINT_GREEN : variant === VARIANTS.ERROR ? ERROR_BACKGROUND_COLOR : WHITE,
|
|
@@ -50249,7 +50271,12 @@ var ToastNotification = function ToastNotification(_ref) {
|
|
|
50249
50271
|
padding: "0rem 1rem",
|
|
50250
50272
|
borderRadius: "4px",
|
|
50251
50273
|
boxShadow: generateShadows().standard.base,
|
|
50252
|
-
extraStyles: "\n display: ".concat(toastOpen ? "block" : "none", ";\n position: fixed; bottom: 4rem; left: 4rem;\n ").concat(extraStyles, ";\n cursor: pointer;\n ")
|
|
50274
|
+
extraStyles: "\n display: ".concat(toastOpen ? "block" : "none", ";\n position: fixed; bottom: 4rem; left: 4rem;\n ").concat(extraStyles, ";\n cursor: pointer;\n "),
|
|
50275
|
+
role: role
|
|
50276
|
+
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
50277
|
+
align: "center",
|
|
50278
|
+
childGap: childGap,
|
|
50279
|
+
justify: "space-between"
|
|
50253
50280
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
50254
50281
|
align: "center",
|
|
50255
50282
|
childGap: childGap
|
|
@@ -50259,7 +50286,7 @@ var ToastNotification = function ToastNotification(_ref) {
|
|
|
50259
50286
|
}, /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
50260
50287
|
weight: FONT_WEIGHT_SEMIBOLD,
|
|
50261
50288
|
extraStyles: "word-break: break-word;"
|
|
50262
|
-
}, message)), /*#__PURE__*/React__default.createElement(IconQuitLarge, null)));
|
|
50289
|
+
}, message))), /*#__PURE__*/React__default.createElement(IconQuitLarge, null)));
|
|
50263
50290
|
};
|
|
50264
50291
|
|
|
50265
50292
|
var fontWeight$9 = "600";
|