@thecb/components 11.11.0-beta.4 → 11.11.0-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/README.md +8 -4
- package/dist/index.cjs.js +50 -36
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +50 -36
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/card-type/CardType.js +10 -2
- package/src/components/atoms/dropdown/Dropdown.js +2 -3
- package/src/components/atoms/dropdown/DropdownIcon.js +1 -0
- package/src/components/atoms/dropdown/DropdownIconV2.js +1 -0
- package/src/components/atoms/form-layouts/FormInput.js +9 -16
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.js +10 -7
- package/src/components/atoms/icons/AmExSmallIcon.js +2 -0
- package/src/components/atoms/icons/DiscoverSmallIcon.js +2 -0
- package/src/components/atoms/icons/GenericCardLarge.js +1 -1
- package/src/components/atoms/icons/GenericSmallIcon.js +2 -0
- package/src/components/atoms/icons/MasterCardSmallIcon.js +2 -0
- package/src/components/atoms/icons/VisaSmallIcon.js +2 -0
- package/src/components/molecules/email-form/EmailForm.js +2 -1
- package/src/components/molecules/email-form/EmailForm.stories.js +210 -0
- package/src/components/molecules/forgot-password-form/ForgotPasswordForm.js +2 -1
- package/src/components/molecules/login-form/LoginForm.js +2 -1
- package/src/components/molecules/radio-section/InnerRadioSection.js +2 -2
- package/src/components/molecules/registration-form/RegistrationForm.js +2 -1
package/dist/index.esm.js
CHANGED
|
@@ -15814,7 +15814,7 @@ var GenericCardLarge = function GenericCardLarge() {
|
|
|
15814
15814
|
fill: "none",
|
|
15815
15815
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15816
15816
|
role: "img",
|
|
15817
|
-
"aria-label": "
|
|
15817
|
+
"aria-label": "Credit card"
|
|
15818
15818
|
}, /*#__PURE__*/React__default.createElement("rect", {
|
|
15819
15819
|
width: "36",
|
|
15820
15820
|
height: "24",
|
|
@@ -18692,7 +18692,9 @@ var VisaSmallIcon = function VisaSmallIcon() {
|
|
|
18692
18692
|
height: "16",
|
|
18693
18693
|
viewBox: "0 0 24 16",
|
|
18694
18694
|
fill: "none",
|
|
18695
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18695
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18696
|
+
role: "img",
|
|
18697
|
+
"aria-label": "Visa"
|
|
18696
18698
|
}, /*#__PURE__*/React__default.createElement("path", {
|
|
18697
18699
|
fillRule: "evenodd",
|
|
18698
18700
|
clipRule: "evenodd",
|
|
@@ -18719,7 +18721,9 @@ var AmExSmallIcon = function AmExSmallIcon() {
|
|
|
18719
18721
|
height: "16",
|
|
18720
18722
|
viewBox: "0 0 24 16",
|
|
18721
18723
|
fill: "none",
|
|
18722
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18724
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18725
|
+
role: "img",
|
|
18726
|
+
"aria-label": "American Express"
|
|
18723
18727
|
}, /*#__PURE__*/React__default.createElement("g", {
|
|
18724
18728
|
clipPath: "url(#clip0_3693_1095)"
|
|
18725
18729
|
}, /*#__PURE__*/React__default.createElement("g", {
|
|
@@ -18818,7 +18822,9 @@ var DiscoverSmallIcon = function DiscoverSmallIcon() {
|
|
|
18818
18822
|
height: "16",
|
|
18819
18823
|
viewBox: "0 0 24 16",
|
|
18820
18824
|
fill: "none",
|
|
18821
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18825
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18826
|
+
role: "img",
|
|
18827
|
+
"aria-label": "Discover"
|
|
18822
18828
|
}, /*#__PURE__*/React__default.createElement("g", {
|
|
18823
18829
|
clipPath: "url(#clip0_3818_267)"
|
|
18824
18830
|
}, /*#__PURE__*/React__default.createElement("path", {
|
|
@@ -18943,7 +18949,9 @@ var GenericSmallIcon = function GenericSmallIcon() {
|
|
|
18943
18949
|
height: "16",
|
|
18944
18950
|
viewBox: "0 0 24 16",
|
|
18945
18951
|
fill: "none",
|
|
18946
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18952
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18953
|
+
role: "img",
|
|
18954
|
+
"aria-label": "Credit card"
|
|
18947
18955
|
}, /*#__PURE__*/React__default.createElement("rect", {
|
|
18948
18956
|
width: "24",
|
|
18949
18957
|
height: "16",
|
|
@@ -18964,7 +18972,9 @@ var MasterCardSmallIcon = function MasterCardSmallIcon() {
|
|
|
18964
18972
|
height: "16",
|
|
18965
18973
|
viewBox: "0 0 24 16",
|
|
18966
18974
|
fill: "none",
|
|
18967
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18975
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18976
|
+
role: "img",
|
|
18977
|
+
"aria-label": "Mastercard"
|
|
18968
18978
|
}, /*#__PURE__*/React__default.createElement("rect", {
|
|
18969
18979
|
width: "24",
|
|
18970
18980
|
height: "16",
|
|
@@ -22615,6 +22625,7 @@ var SortableTableHeading$1 = themeComponent(SortableTableHeading, "SortableTable
|
|
|
22615
22625
|
|
|
22616
22626
|
var DropdownIcon = function DropdownIcon() {
|
|
22617
22627
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
22628
|
+
"aria-hidden": "true",
|
|
22618
22629
|
version: "1.2",
|
|
22619
22630
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22620
22631
|
overflow: "visible",
|
|
@@ -23964,7 +23975,7 @@ var IconWrapper = styled.div.withConfig({
|
|
|
23964
23975
|
var DropdownContentWrapper = styled.div.withConfig({
|
|
23965
23976
|
displayName: "Dropdown__DropdownContentWrapper",
|
|
23966
23977
|
componentId: "sc-pn6m0h-1"
|
|
23967
|
-
})(["transform-origin:0 0;border:1px solid ", ";border-radius:2px;background-color:", ";padding:8px 0 8px;position:absolute;width:", ";min-width:100%;max-height:", ";overflow-y:scroll;z-index:1;box-sizing:border-box;&:focus{outline:none;}ul{padding-left:0;}"],
|
|
23978
|
+
})(["transform-origin:0 0;border:1px solid ", ";border-radius:2px;background-color:", ";padding:8px 0 8px;position:absolute;width:", ";min-width:100%;max-height:", ";overflow-y:scroll;z-index:1;box-sizing:border-box;&:focus{outline:none;}ul{padding-left:0;}"], STORM_GREY, WHITE, function (_ref2) {
|
|
23968
23979
|
var widthFitOptions = _ref2.widthFitOptions;
|
|
23969
23980
|
return widthFitOptions ? "fit-content" : "100%";
|
|
23970
23981
|
}, function (_ref3) {
|
|
@@ -24269,7 +24280,7 @@ var Dropdown = function Dropdown(_ref13) {
|
|
|
24269
24280
|
background: isOpen ? themeValues.hoverColor : WHITE,
|
|
24270
24281
|
borderRadius: "2px",
|
|
24271
24282
|
borderSize: "1px",
|
|
24272
|
-
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor :
|
|
24283
|
+
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : STORM_GREY,
|
|
24273
24284
|
dataQa: placeholder,
|
|
24274
24285
|
extraStyles: disabled ? "".concat(inputPlaceholderTextStyle).concat(inputDisabledStyle) : inputPlaceholderTextStyle,
|
|
24275
24286
|
hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
|
|
@@ -25927,7 +25938,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
25927
25938
|
minWidth: "100%"
|
|
25928
25939
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
25929
25940
|
justify: "space-between",
|
|
25930
|
-
align: "center"
|
|
25941
|
+
align: "center",
|
|
25942
|
+
overflow: true
|
|
25931
25943
|
}, labelDisplayOverride ? labelDisplayOverride : /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25932
25944
|
as: "label",
|
|
25933
25945
|
color: themeValues.labelColor,
|
|
@@ -25935,22 +25947,16 @@ var FormInput = function FormInput(_ref15) {
|
|
|
25935
25947
|
fontWeight: themeValues.fontWeight,
|
|
25936
25948
|
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
|
|
25937
25949
|
id: createIdFromString(labelTextWhenNoError)
|
|
25938
|
-
}, labelTextWhenNoError), type === "password" && /*#__PURE__*/React__default.createElement(
|
|
25939
|
-
variant:
|
|
25940
|
-
|
|
25941
|
-
|
|
25942
|
-
hoverStyles: themeValues.hoverFocusStyles,
|
|
25943
|
-
extraStyles: "text-decoration: underline; cursor: pointer; &:focus { outline-offset: -2px; }",
|
|
25944
|
-
onClick: function onClick() {
|
|
25950
|
+
}, labelTextWhenNoError), type === "password" && /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
25951
|
+
variant: "smallGhost",
|
|
25952
|
+
text: showPassword ? "Hide" : "Show",
|
|
25953
|
+
action: function action() {
|
|
25945
25954
|
return setShowPassword(!showPassword);
|
|
25946
25955
|
},
|
|
25947
|
-
tabIndex: "0",
|
|
25948
25956
|
"aria-label": showPassword ? "Hide Password" : "Show password",
|
|
25949
|
-
"
|
|
25950
|
-
|
|
25951
|
-
|
|
25952
|
-
}
|
|
25953
|
-
}, showPassword ? "Hide" : "Show"), isMobile && decorator && /*#__PURE__*/React__default.createElement(Box, {
|
|
25957
|
+
extraStyles: "margin: 0; min-width: auto;",
|
|
25958
|
+
textExtraStyles: "color: ".concat(themeValues.linkColor, ";")
|
|
25959
|
+
}), isMobile && decorator && /*#__PURE__*/React__default.createElement(Box, {
|
|
25954
25960
|
padding: "0 0 0 auto"
|
|
25955
25961
|
}, decorator)))), /*#__PURE__*/React__default.createElement(Box, {
|
|
25956
25962
|
padding: "0"
|
|
@@ -26358,17 +26364,21 @@ var cardBrands = {
|
|
|
26358
26364
|
large: GenericCardLarge
|
|
26359
26365
|
}
|
|
26360
26366
|
};
|
|
26367
|
+
var normalizeType = function normalizeType(type) {
|
|
26368
|
+
if (!type) return undefined;
|
|
26369
|
+
var lower = type.toLowerCase();
|
|
26370
|
+
if (lower === "mastercard") return "master_card";
|
|
26371
|
+
return lower;
|
|
26372
|
+
};
|
|
26361
26373
|
var CardType = function CardType(_ref) {
|
|
26362
26374
|
var type = _ref.type,
|
|
26363
26375
|
_ref$size = _ref.size,
|
|
26364
26376
|
size = _ref$size === void 0 ? "small" : _ref$size;
|
|
26365
|
-
var
|
|
26377
|
+
var normalizedType = normalizeType(type);
|
|
26378
|
+
var _ref2 = cardBrands[normalizedType] || cardBrands["default"],
|
|
26366
26379
|
label = _ref2.label,
|
|
26367
26380
|
IconComponent = _ref2[size];
|
|
26368
|
-
return /*#__PURE__*/React__default.createElement("span",
|
|
26369
|
-
role: "img",
|
|
26370
|
-
"aria-label": label
|
|
26371
|
-
}, /*#__PURE__*/React__default.createElement(IconComponent, null));
|
|
26381
|
+
return /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(IconComponent, null));
|
|
26372
26382
|
};
|
|
26373
26383
|
|
|
26374
26384
|
var textColor$2 = "".concat(CHARADE_GREY);
|
|
@@ -26442,7 +26452,7 @@ var CreditCardWrapper = styled.div.withConfig({
|
|
|
26442
26452
|
var CCIconWrapper = styled.div.withConfig({
|
|
26443
26453
|
displayName: "FormattedCreditCard__CCIconWrapper",
|
|
26444
26454
|
componentId: "sc-s0ta5l-1"
|
|
26445
|
-
})(["margin-right:16px;width:
|
|
26455
|
+
})(["margin-right:16px;width:36px;height:auto;display:flex;"]);
|
|
26446
26456
|
var FormattedCreditCard = function FormattedCreditCard(_ref) {
|
|
26447
26457
|
var lastFour = _ref.lastFour,
|
|
26448
26458
|
type = _ref.type,
|
|
@@ -26450,15 +26460,18 @@ var FormattedCreditCard = function FormattedCreditCard(_ref) {
|
|
|
26450
26460
|
expireDate = _ref.expireDate,
|
|
26451
26461
|
expirationStatus = _ref.expirationStatus,
|
|
26452
26462
|
themeValues = _ref.themeValues;
|
|
26463
|
+
var _useContext = useContext(ThemeContext),
|
|
26464
|
+
isMobile = _useContext.isMobile;
|
|
26453
26465
|
return /*#__PURE__*/React__default.createElement(CreditCardWrapper, null, /*#__PURE__*/React__default.createElement(CCIconWrapper, null, /*#__PURE__*/React__default.createElement(CardType, {
|
|
26454
|
-
type: type
|
|
26466
|
+
type: type,
|
|
26467
|
+
size: isMobile ? "small" : "large"
|
|
26455
26468
|
})), /*#__PURE__*/React__default.createElement(Stack, {
|
|
26456
26469
|
childGap: "0"
|
|
26457
26470
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
26458
26471
|
padding: "0"
|
|
26459
26472
|
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26460
26473
|
variant: "p",
|
|
26461
|
-
padding: "0
|
|
26474
|
+
padding: "0",
|
|
26462
26475
|
color: themeValues.textColor,
|
|
26463
26476
|
textAlign: "left",
|
|
26464
26477
|
extraStyles: "display: inline-block;"
|
|
@@ -41149,7 +41162,7 @@ var EmailForm = function EmailForm(_ref) {
|
|
|
41149
41162
|
}, []);
|
|
41150
41163
|
}
|
|
41151
41164
|
useConditionallyAddValidator(isRequired, required, actions.fields.email.addValidator, actions.fields.email.removeValidator);
|
|
41152
|
-
var emailFieldErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "
|
|
41165
|
+
var emailFieldErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "Please enter a valid email address in the format user@example.com");
|
|
41153
41166
|
return /*#__PURE__*/React__default.createElement(FormContainer$1, {
|
|
41154
41167
|
variant: variant,
|
|
41155
41168
|
role: "form",
|
|
@@ -41241,7 +41254,7 @@ var ForgotPasswordForm = function ForgotPasswordForm(_ref) {
|
|
|
41241
41254
|
};
|
|
41242
41255
|
}, []);
|
|
41243
41256
|
}
|
|
41244
|
-
var EmailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "
|
|
41257
|
+
var EmailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "Please enter a valid email address in the format user@example.com");
|
|
41245
41258
|
return /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
41246
41259
|
labelTextWhenNoError: "Email address",
|
|
41247
41260
|
errorMessages: EmailErrorMessages,
|
|
@@ -45940,7 +45953,7 @@ var LoginForm = function LoginForm(_ref) {
|
|
|
45940
45953
|
};
|
|
45941
45954
|
}, []);
|
|
45942
45955
|
}
|
|
45943
|
-
var emailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "
|
|
45956
|
+
var emailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "Please enter a valid email address in the format user@example.com");
|
|
45944
45957
|
var passwordErrorMessages = _defineProperty({}, required.error, "Password is required");
|
|
45945
45958
|
return /*#__PURE__*/React__default.createElement(FormInputColumn, {
|
|
45946
45959
|
role: "form",
|
|
@@ -48907,10 +48920,10 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
|
|
|
48907
48920
|
componentId: "sc-1wtp6qc-0"
|
|
48908
48921
|
})(["height:", ";width:", ";", " transition:opacity 0.3s ease;"], function (_ref2) {
|
|
48909
48922
|
var isMobile = _ref2.isMobile;
|
|
48910
|
-
return isMobile ? "
|
|
48923
|
+
return isMobile ? "16px" : "24px";
|
|
48911
48924
|
}, function (_ref3) {
|
|
48912
48925
|
var isMobile = _ref3.isMobile;
|
|
48913
|
-
return isMobile ? "
|
|
48926
|
+
return isMobile ? "24px" : "36px";
|
|
48914
48927
|
}, function (_ref4) {
|
|
48915
48928
|
var fade = _ref4.fade;
|
|
48916
48929
|
return fade && "opacity: 0.4;";
|
|
@@ -49313,7 +49326,7 @@ var RegistrationForm = function RegistrationForm(_ref) {
|
|
|
49313
49326
|
}
|
|
49314
49327
|
var firstNameErrorMessages = _defineProperty(_defineProperty({}, required.error, "First name is required"), validName.error, "First name contains invalid characters");
|
|
49315
49328
|
var lastNameErrorMessages = _defineProperty(_defineProperty({}, required.error, "Last name is required"), validName.error, "Last name contains invalid characters");
|
|
49316
|
-
var emailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email is required"), isProbablyEmail.error, "
|
|
49329
|
+
var emailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email is required"), isProbablyEmail.error, "Please enter a valid email address in the format user@example.com");
|
|
49317
49330
|
var passwordErrorMessages = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, required.error, "Password is required"), hasLength.error, "Password must have at least 8 characters"), hasNumber.error, "Password must contain at least one number"), hasLowercaseLetter.error, "Password must contain at least one lowercase letter"), hasUppercaseLetter.error, "Password must contain at least one uppercase letter"), hasSpecialCharacter.error, "Password must contain at least one special character (!@#$%^&*.?)");
|
|
49318
49331
|
var confirmPasswordErrorMessages = _defineProperty({}, matchesField.error, "Confirm password must match password");
|
|
49319
49332
|
return /*#__PURE__*/React__default.createElement(FormInputColumn, {
|
|
@@ -50262,6 +50275,7 @@ var DropdownIconV2 = function DropdownIconV2(_ref) {
|
|
|
50262
50275
|
color = _ref$color === void 0 ? "#292A33" : _ref$color,
|
|
50263
50276
|
props = _objectWithoutProperties(_ref, _excluded$Q);
|
|
50264
50277
|
return /*#__PURE__*/React__default.createElement("svg", _extends({
|
|
50278
|
+
"aria-hidden": "true",
|
|
50265
50279
|
width: width,
|
|
50266
50280
|
height: height,
|
|
50267
50281
|
viewBox: "0 0 ".concat(width, " ").concat(height),
|