@thecb/components 11.11.0-beta.3 → 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/src/components/molecules/tooltip/Tooltip.stories.js +22 -5
- package/src/components/molecules/tooltip/index.d.ts +3 -1
package/README.md
CHANGED
|
@@ -11,8 +11,6 @@ This library contains CityBase React components for use across all current and f
|
|
|
11
11
|
- [Storybook deployment](#storybook-deployment)
|
|
12
12
|
- [Adding new components](#adding-new-components)
|
|
13
13
|
- [Version bumping and publishing](#version-bumping-and-publishing)
|
|
14
|
-
- [Version bumping](#version-bumping)
|
|
15
|
-
- [Publishing new versions to NPM](#publishing-new-versions-to-npm)
|
|
16
14
|
- [Consuming in your application](#consuming-in-your-application)
|
|
17
15
|
|
|
18
16
|
- [Adding to existing application](#adding-to-existing-application)
|
|
@@ -104,9 +102,15 @@ export * from "./button-with-action";
|
|
|
104
102
|
|
|
105
103
|
## Version bumping and publishing
|
|
106
104
|
|
|
107
|
-
|
|
105
|
+
Publishing to NPM is automated. When a PR is merged to master, the package will automatically be built and published to NPM using the version specified in `package.json`. **Developers no longer need to manually run `yarn build && yarn publish`.**
|
|
108
106
|
|
|
109
|
-
|
|
107
|
+
### How it works
|
|
108
|
+
|
|
109
|
+
1. Before merging your PR, bump the version in `package.json` to an appropriate new version following semantic versioning (see below).
|
|
110
|
+
2. Ensure the version you set has **not already been published** to NPM. If you merge a PR with a version that has already been published, the automated publish will fail and you will need to create a follow-up PR that bumps the version to an unpublished one.
|
|
111
|
+
3. Merge your PR to master. The CI pipeline will automatically build and publish the new version.
|
|
112
|
+
|
|
113
|
+
### Semantic versioning
|
|
110
114
|
|
|
111
115
|
- CB Components follows semantic versioning practices, which divides version upgrades into three categories: "Patch" (e.g., `6.0.1` -> `6.0.2`), "Minor" (e.g., `6.0.2` -> `6.1.0`), and "Major" (e.g., `6.1.0` -> `7.0.0`)
|
|
112
116
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -15822,7 +15822,7 @@ var GenericCardLarge = function GenericCardLarge() {
|
|
|
15822
15822
|
fill: "none",
|
|
15823
15823
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15824
15824
|
role: "img",
|
|
15825
|
-
"aria-label": "
|
|
15825
|
+
"aria-label": "Credit card"
|
|
15826
15826
|
}, /*#__PURE__*/React__default.createElement("rect", {
|
|
15827
15827
|
width: "36",
|
|
15828
15828
|
height: "24",
|
|
@@ -18700,7 +18700,9 @@ var VisaSmallIcon = function VisaSmallIcon() {
|
|
|
18700
18700
|
height: "16",
|
|
18701
18701
|
viewBox: "0 0 24 16",
|
|
18702
18702
|
fill: "none",
|
|
18703
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18703
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18704
|
+
role: "img",
|
|
18705
|
+
"aria-label": "Visa"
|
|
18704
18706
|
}, /*#__PURE__*/React__default.createElement("path", {
|
|
18705
18707
|
fillRule: "evenodd",
|
|
18706
18708
|
clipRule: "evenodd",
|
|
@@ -18727,7 +18729,9 @@ var AmExSmallIcon = function AmExSmallIcon() {
|
|
|
18727
18729
|
height: "16",
|
|
18728
18730
|
viewBox: "0 0 24 16",
|
|
18729
18731
|
fill: "none",
|
|
18730
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18732
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18733
|
+
role: "img",
|
|
18734
|
+
"aria-label": "American Express"
|
|
18731
18735
|
}, /*#__PURE__*/React__default.createElement("g", {
|
|
18732
18736
|
clipPath: "url(#clip0_3693_1095)"
|
|
18733
18737
|
}, /*#__PURE__*/React__default.createElement("g", {
|
|
@@ -18826,7 +18830,9 @@ var DiscoverSmallIcon = function DiscoverSmallIcon() {
|
|
|
18826
18830
|
height: "16",
|
|
18827
18831
|
viewBox: "0 0 24 16",
|
|
18828
18832
|
fill: "none",
|
|
18829
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18833
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18834
|
+
role: "img",
|
|
18835
|
+
"aria-label": "Discover"
|
|
18830
18836
|
}, /*#__PURE__*/React__default.createElement("g", {
|
|
18831
18837
|
clipPath: "url(#clip0_3818_267)"
|
|
18832
18838
|
}, /*#__PURE__*/React__default.createElement("path", {
|
|
@@ -18951,7 +18957,9 @@ var GenericSmallIcon = function GenericSmallIcon() {
|
|
|
18951
18957
|
height: "16",
|
|
18952
18958
|
viewBox: "0 0 24 16",
|
|
18953
18959
|
fill: "none",
|
|
18954
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18960
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18961
|
+
role: "img",
|
|
18962
|
+
"aria-label": "Credit card"
|
|
18955
18963
|
}, /*#__PURE__*/React__default.createElement("rect", {
|
|
18956
18964
|
width: "24",
|
|
18957
18965
|
height: "16",
|
|
@@ -18972,7 +18980,9 @@ var MasterCardSmallIcon = function MasterCardSmallIcon() {
|
|
|
18972
18980
|
height: "16",
|
|
18973
18981
|
viewBox: "0 0 24 16",
|
|
18974
18982
|
fill: "none",
|
|
18975
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18983
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18984
|
+
role: "img",
|
|
18985
|
+
"aria-label": "Mastercard"
|
|
18976
18986
|
}, /*#__PURE__*/React__default.createElement("rect", {
|
|
18977
18987
|
width: "24",
|
|
18978
18988
|
height: "16",
|
|
@@ -22623,6 +22633,7 @@ var SortableTableHeading$1 = themeComponent(SortableTableHeading, "SortableTable
|
|
|
22623
22633
|
|
|
22624
22634
|
var DropdownIcon = function DropdownIcon() {
|
|
22625
22635
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
22636
|
+
"aria-hidden": "true",
|
|
22626
22637
|
version: "1.2",
|
|
22627
22638
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22628
22639
|
overflow: "visible",
|
|
@@ -23972,7 +23983,7 @@ var IconWrapper = styled__default.div.withConfig({
|
|
|
23972
23983
|
var DropdownContentWrapper = styled__default.div.withConfig({
|
|
23973
23984
|
displayName: "Dropdown__DropdownContentWrapper",
|
|
23974
23985
|
componentId: "sc-pn6m0h-1"
|
|
23975
|
-
})(["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;}"],
|
|
23986
|
+
})(["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) {
|
|
23976
23987
|
var widthFitOptions = _ref2.widthFitOptions;
|
|
23977
23988
|
return widthFitOptions ? "fit-content" : "100%";
|
|
23978
23989
|
}, function (_ref3) {
|
|
@@ -24277,7 +24288,7 @@ var Dropdown = function Dropdown(_ref13) {
|
|
|
24277
24288
|
background: isOpen ? themeValues.hoverColor : WHITE,
|
|
24278
24289
|
borderRadius: "2px",
|
|
24279
24290
|
borderSize: "1px",
|
|
24280
|
-
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor :
|
|
24291
|
+
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : STORM_GREY,
|
|
24281
24292
|
dataQa: placeholder,
|
|
24282
24293
|
extraStyles: disabled ? "".concat(inputPlaceholderTextStyle).concat(inputDisabledStyle) : inputPlaceholderTextStyle,
|
|
24283
24294
|
hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
|
|
@@ -25935,7 +25946,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
25935
25946
|
minWidth: "100%"
|
|
25936
25947
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
25937
25948
|
justify: "space-between",
|
|
25938
|
-
align: "center"
|
|
25949
|
+
align: "center",
|
|
25950
|
+
overflow: true
|
|
25939
25951
|
}, labelDisplayOverride ? labelDisplayOverride : /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25940
25952
|
as: "label",
|
|
25941
25953
|
color: themeValues.labelColor,
|
|
@@ -25943,22 +25955,16 @@ var FormInput = function FormInput(_ref15) {
|
|
|
25943
25955
|
fontWeight: themeValues.fontWeight,
|
|
25944
25956
|
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
|
|
25945
25957
|
id: createIdFromString(labelTextWhenNoError)
|
|
25946
|
-
}, labelTextWhenNoError), type === "password" && /*#__PURE__*/React__default.createElement(
|
|
25947
|
-
variant:
|
|
25948
|
-
|
|
25949
|
-
|
|
25950
|
-
hoverStyles: themeValues.hoverFocusStyles,
|
|
25951
|
-
extraStyles: "text-decoration: underline; cursor: pointer; &:focus { outline-offset: -2px; }",
|
|
25952
|
-
onClick: function onClick() {
|
|
25958
|
+
}, labelTextWhenNoError), type === "password" && /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
25959
|
+
variant: "smallGhost",
|
|
25960
|
+
text: showPassword ? "Hide" : "Show",
|
|
25961
|
+
action: function action() {
|
|
25953
25962
|
return setShowPassword(!showPassword);
|
|
25954
25963
|
},
|
|
25955
|
-
tabIndex: "0",
|
|
25956
25964
|
"aria-label": showPassword ? "Hide Password" : "Show password",
|
|
25957
|
-
"
|
|
25958
|
-
|
|
25959
|
-
|
|
25960
|
-
}
|
|
25961
|
-
}, showPassword ? "Hide" : "Show"), isMobile && decorator && /*#__PURE__*/React__default.createElement(Box, {
|
|
25965
|
+
extraStyles: "margin: 0; min-width: auto;",
|
|
25966
|
+
textExtraStyles: "color: ".concat(themeValues.linkColor, ";")
|
|
25967
|
+
}), isMobile && decorator && /*#__PURE__*/React__default.createElement(Box, {
|
|
25962
25968
|
padding: "0 0 0 auto"
|
|
25963
25969
|
}, decorator)))), /*#__PURE__*/React__default.createElement(Box, {
|
|
25964
25970
|
padding: "0"
|
|
@@ -26366,17 +26372,21 @@ var cardBrands = {
|
|
|
26366
26372
|
large: GenericCardLarge
|
|
26367
26373
|
}
|
|
26368
26374
|
};
|
|
26375
|
+
var normalizeType = function normalizeType(type) {
|
|
26376
|
+
if (!type) return undefined;
|
|
26377
|
+
var lower = type.toLowerCase();
|
|
26378
|
+
if (lower === "mastercard") return "master_card";
|
|
26379
|
+
return lower;
|
|
26380
|
+
};
|
|
26369
26381
|
var CardType = function CardType(_ref) {
|
|
26370
26382
|
var type = _ref.type,
|
|
26371
26383
|
_ref$size = _ref.size,
|
|
26372
26384
|
size = _ref$size === void 0 ? "small" : _ref$size;
|
|
26373
|
-
var
|
|
26385
|
+
var normalizedType = normalizeType(type);
|
|
26386
|
+
var _ref2 = cardBrands[normalizedType] || cardBrands["default"],
|
|
26374
26387
|
label = _ref2.label,
|
|
26375
26388
|
IconComponent = _ref2[size];
|
|
26376
|
-
return /*#__PURE__*/React__default.createElement("span",
|
|
26377
|
-
role: "img",
|
|
26378
|
-
"aria-label": label
|
|
26379
|
-
}, /*#__PURE__*/React__default.createElement(IconComponent, null));
|
|
26389
|
+
return /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(IconComponent, null));
|
|
26380
26390
|
};
|
|
26381
26391
|
|
|
26382
26392
|
var textColor$2 = "".concat(CHARADE_GREY);
|
|
@@ -26450,7 +26460,7 @@ var CreditCardWrapper = styled__default.div.withConfig({
|
|
|
26450
26460
|
var CCIconWrapper = styled__default.div.withConfig({
|
|
26451
26461
|
displayName: "FormattedCreditCard__CCIconWrapper",
|
|
26452
26462
|
componentId: "sc-s0ta5l-1"
|
|
26453
|
-
})(["margin-right:16px;width:
|
|
26463
|
+
})(["margin-right:16px;width:36px;height:auto;display:flex;"]);
|
|
26454
26464
|
var FormattedCreditCard = function FormattedCreditCard(_ref) {
|
|
26455
26465
|
var lastFour = _ref.lastFour,
|
|
26456
26466
|
type = _ref.type,
|
|
@@ -26458,15 +26468,18 @@ var FormattedCreditCard = function FormattedCreditCard(_ref) {
|
|
|
26458
26468
|
expireDate = _ref.expireDate,
|
|
26459
26469
|
expirationStatus = _ref.expirationStatus,
|
|
26460
26470
|
themeValues = _ref.themeValues;
|
|
26471
|
+
var _useContext = React.useContext(styled.ThemeContext),
|
|
26472
|
+
isMobile = _useContext.isMobile;
|
|
26461
26473
|
return /*#__PURE__*/React__default.createElement(CreditCardWrapper, null, /*#__PURE__*/React__default.createElement(CCIconWrapper, null, /*#__PURE__*/React__default.createElement(CardType, {
|
|
26462
|
-
type: type
|
|
26474
|
+
type: type,
|
|
26475
|
+
size: isMobile ? "small" : "large"
|
|
26463
26476
|
})), /*#__PURE__*/React__default.createElement(Stack, {
|
|
26464
26477
|
childGap: "0"
|
|
26465
26478
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
26466
26479
|
padding: "0"
|
|
26467
26480
|
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26468
26481
|
variant: "p",
|
|
26469
|
-
padding: "0
|
|
26482
|
+
padding: "0",
|
|
26470
26483
|
color: themeValues.textColor,
|
|
26471
26484
|
textAlign: "left",
|
|
26472
26485
|
extraStyles: "display: inline-block;"
|
|
@@ -41157,7 +41170,7 @@ var EmailForm = function EmailForm(_ref) {
|
|
|
41157
41170
|
}, []);
|
|
41158
41171
|
}
|
|
41159
41172
|
useConditionallyAddValidator(isRequired, required, actions.fields.email.addValidator, actions.fields.email.removeValidator);
|
|
41160
|
-
var emailFieldErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "
|
|
41173
|
+
var emailFieldErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "Please enter a valid email address in the format user@example.com");
|
|
41161
41174
|
return /*#__PURE__*/React__default.createElement(FormContainer$1, {
|
|
41162
41175
|
variant: variant,
|
|
41163
41176
|
role: "form",
|
|
@@ -41249,7 +41262,7 @@ var ForgotPasswordForm = function ForgotPasswordForm(_ref) {
|
|
|
41249
41262
|
};
|
|
41250
41263
|
}, []);
|
|
41251
41264
|
}
|
|
41252
|
-
var EmailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "
|
|
41265
|
+
var EmailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "Please enter a valid email address in the format user@example.com");
|
|
41253
41266
|
return /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
41254
41267
|
labelTextWhenNoError: "Email address",
|
|
41255
41268
|
errorMessages: EmailErrorMessages,
|
|
@@ -45948,7 +45961,7 @@ var LoginForm = function LoginForm(_ref) {
|
|
|
45948
45961
|
};
|
|
45949
45962
|
}, []);
|
|
45950
45963
|
}
|
|
45951
|
-
var emailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "
|
|
45964
|
+
var emailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "Please enter a valid email address in the format user@example.com");
|
|
45952
45965
|
var passwordErrorMessages = _defineProperty({}, required.error, "Password is required");
|
|
45953
45966
|
return /*#__PURE__*/React__default.createElement(FormInputColumn, {
|
|
45954
45967
|
role: "form",
|
|
@@ -48915,10 +48928,10 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
|
|
|
48915
48928
|
componentId: "sc-1wtp6qc-0"
|
|
48916
48929
|
})(["height:", ";width:", ";", " transition:opacity 0.3s ease;"], function (_ref2) {
|
|
48917
48930
|
var isMobile = _ref2.isMobile;
|
|
48918
|
-
return isMobile ? "
|
|
48931
|
+
return isMobile ? "16px" : "24px";
|
|
48919
48932
|
}, function (_ref3) {
|
|
48920
48933
|
var isMobile = _ref3.isMobile;
|
|
48921
|
-
return isMobile ? "
|
|
48934
|
+
return isMobile ? "24px" : "36px";
|
|
48922
48935
|
}, function (_ref4) {
|
|
48923
48936
|
var fade = _ref4.fade;
|
|
48924
48937
|
return fade && "opacity: 0.4;";
|
|
@@ -49321,7 +49334,7 @@ var RegistrationForm = function RegistrationForm(_ref) {
|
|
|
49321
49334
|
}
|
|
49322
49335
|
var firstNameErrorMessages = _defineProperty(_defineProperty({}, required.error, "First name is required"), validName.error, "First name contains invalid characters");
|
|
49323
49336
|
var lastNameErrorMessages = _defineProperty(_defineProperty({}, required.error, "Last name is required"), validName.error, "Last name contains invalid characters");
|
|
49324
|
-
var emailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email is required"), isProbablyEmail.error, "
|
|
49337
|
+
var emailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email is required"), isProbablyEmail.error, "Please enter a valid email address in the format user@example.com");
|
|
49325
49338
|
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 (!@#$%^&*.?)");
|
|
49326
49339
|
var confirmPasswordErrorMessages = _defineProperty({}, matchesField.error, "Confirm password must match password");
|
|
49327
49340
|
return /*#__PURE__*/React__default.createElement(FormInputColumn, {
|
|
@@ -50270,6 +50283,7 @@ var DropdownIconV2 = function DropdownIconV2(_ref) {
|
|
|
50270
50283
|
color = _ref$color === void 0 ? "#292A33" : _ref$color,
|
|
50271
50284
|
props = _objectWithoutProperties(_ref, _excluded$Q);
|
|
50272
50285
|
return /*#__PURE__*/React__default.createElement("svg", _extends({
|
|
50286
|
+
"aria-hidden": "true",
|
|
50273
50287
|
width: width,
|
|
50274
50288
|
height: height,
|
|
50275
50289
|
viewBox: "0 0 ".concat(width, " ").concat(height),
|