@thecb/components 11.11.0-beta.1 → 11.11.0-beta.11

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.
Files changed (34) hide show
  1. package/README.md +8 -4
  2. package/dist/index.cjs.js +237 -124
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.esm.js +237 -124
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/components/atoms/card-type/CardType.js +10 -2
  8. package/src/components/atoms/form-layouts/FormInput.js +9 -16
  9. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.js +2 -2
  10. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.theme.js +2 -2
  11. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.js +12 -9
  12. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.theme.js +2 -2
  13. package/src/components/atoms/icons/AmExSmallIcon.js +2 -0
  14. package/src/components/atoms/icons/DiscoverSmallIcon.js +2 -0
  15. package/src/components/atoms/icons/GenericCardLarge.js +1 -1
  16. package/src/components/atoms/icons/GenericSmallIcon.js +2 -0
  17. package/src/components/atoms/icons/MasterCardSmallIcon.js +2 -0
  18. package/src/components/atoms/icons/VisaSmallIcon.js +2 -0
  19. package/src/components/molecules/editable-list/EditableList.js +3 -0
  20. package/src/components/molecules/email-form/EmailForm.js +2 -1
  21. package/src/components/molecules/email-form/EmailForm.stories.js +210 -0
  22. package/src/components/molecules/forgot-password-form/ForgotPasswordForm.js +2 -1
  23. package/src/components/molecules/login-form/LoginForm.js +2 -1
  24. package/src/components/molecules/radio-section/InnerRadioSection.js +3 -3
  25. package/src/components/molecules/radio-section/RadioSection.stories.js +142 -0
  26. package/src/components/molecules/registration-form/RegistrationForm.js +2 -1
  27. package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +1 -1
  28. package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.stories.js +110 -0
  29. package/src/components/molecules/tooltip/Tooltip.js +163 -96
  30. package/src/components/molecules/tooltip/Tooltip.mdx +12 -2
  31. package/src/components/molecules/tooltip/Tooltip.stories.js +113 -63
  32. package/src/components/molecules/tooltip/Tooltip.theme.js +13 -4
  33. package/src/components/molecules/tooltip/index.d.ts +8 -8
  34. package/src/util/formats.js +6 -3
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
- ### Version bumping and Publishing to NPM
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
- - Authors of PRs are responsible for bumping the version of the package prior to merging an approved PR to master. Once your pending PR has been approved, before merging to master, run `yarn build && yarn publish` in the main directory to create and publish a new build to NPM. This step should happen immediately before you merge your PR to master, to minimize conflicts between built versions.
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": "Card Payment"
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",
@@ -25936,7 +25946,8 @@ var FormInput = function FormInput(_ref15) {
25936
25946
  minWidth: "100%"
25937
25947
  }, /*#__PURE__*/React__default.createElement(Cluster, {
25938
25948
  justify: "space-between",
25939
- align: "center"
25949
+ align: "center",
25950
+ overflow: true
25940
25951
  }, labelDisplayOverride ? labelDisplayOverride : /*#__PURE__*/React__default.createElement(Text$1, {
25941
25952
  as: "label",
25942
25953
  color: themeValues.labelColor,
@@ -25944,22 +25955,16 @@ var FormInput = function FormInput(_ref15) {
25944
25955
  fontWeight: themeValues.fontWeight,
25945
25956
  extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
25946
25957
  id: createIdFromString(labelTextWhenNoError)
25947
- }, labelTextWhenNoError), type === "password" && /*#__PURE__*/React__default.createElement(Text$1, {
25948
- variant: labelTextVariant,
25949
- color: themeValues.linkColor,
25950
- weight: themeValues.fontWeight,
25951
- hoverStyles: themeValues.hoverFocusStyles,
25952
- extraStyles: "text-decoration: underline; cursor: pointer; &:focus { outline-offset: -2px; }",
25953
- onClick: function onClick() {
25958
+ }, labelTextWhenNoError), type === "password" && /*#__PURE__*/React__default.createElement(ButtonWithAction, {
25959
+ variant: "smallGhost",
25960
+ text: showPassword ? "Hide" : "Show",
25961
+ action: function action() {
25954
25962
  return setShowPassword(!showPassword);
25955
25963
  },
25956
- tabIndex: "0",
25957
25964
  "aria-label": showPassword ? "Hide Password" : "Show password",
25958
- "aria-live": "polite",
25959
- onKeyPress: function onKeyPress(e) {
25960
- return e.key === "Enter" && setShowPassword(!showPassword);
25961
- }
25962
- }, 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, {
25963
25968
  padding: "0 0 0 auto"
25964
25969
  }, decorator)))), /*#__PURE__*/React__default.createElement(Box, {
25965
25970
  padding: "0"
@@ -26299,7 +26304,7 @@ var FormattedAddress = function FormattedAddress(_ref) {
26299
26304
  var FormattedAddress$1 = themeComponent(FormattedAddress, "FormattedAddress", fallbackValues$n, "default");
26300
26305
 
26301
26306
  var textColor$1 = "".concat(CHARADE_GREY);
26302
- var autopayTextColor = "".concat(REGENT_GREY);
26307
+ var autopayTextColor = "".concat(SEA_GREEN);
26303
26308
  var fallbackValues$o = {
26304
26309
  textColor: textColor$1,
26305
26310
  autopayTextColor: autopayTextColor
@@ -26335,8 +26340,8 @@ var FormattedBankAccount = function FormattedBankAccount(_ref2) {
26335
26340
  }, "Savings Account ending in ", lastFour), autoPay && /*#__PURE__*/React__default.createElement(Text$1, {
26336
26341
  variant: "p",
26337
26342
  color: themeValues.autopayTextColor,
26338
- extraStyles: "font-style: italic;"
26339
- }, "Autopay Enabled")));
26343
+ extraStyles: "font-style: italic; font-size: .75rem;"
26344
+ }, "Autopay On")));
26340
26345
  };
26341
26346
  var FormattedBankAccount$1 = themeComponent(FormattedBankAccount, "FormattedBankAccount", fallbackValues$o);
26342
26347
 
@@ -26367,21 +26372,25 @@ var cardBrands = {
26367
26372
  large: GenericCardLarge
26368
26373
  }
26369
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
+ };
26370
26381
  var CardType = function CardType(_ref) {
26371
26382
  var type = _ref.type,
26372
26383
  _ref$size = _ref.size,
26373
26384
  size = _ref$size === void 0 ? "small" : _ref$size;
26374
- var _ref2 = cardBrands[type] || cardBrands["default"],
26385
+ var normalizedType = normalizeType(type);
26386
+ var _ref2 = cardBrands[normalizedType] || cardBrands["default"],
26375
26387
  label = _ref2.label,
26376
26388
  IconComponent = _ref2[size];
26377
- return /*#__PURE__*/React__default.createElement("span", {
26378
- role: "img",
26379
- "aria-label": label
26380
- }, /*#__PURE__*/React__default.createElement(IconComponent, null));
26389
+ return /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(IconComponent, null));
26381
26390
  };
26382
26391
 
26383
26392
  var textColor$2 = "".concat(CHARADE_GREY);
26384
- var autopayTextColor$1 = "".concat(REGENT_GREY);
26393
+ var autopayTextColor$1 = "".concat(SEA_GREEN);
26385
26394
  var fallbackValues$p = {
26386
26395
  textColor: textColor$2,
26387
26396
  autopayTextColor: autopayTextColor$1
@@ -26410,13 +26419,15 @@ var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
26410
26419
  return /*#__PURE__*/React__default.createElement(Text$1, {
26411
26420
  as: as,
26412
26421
  variant: "pXS",
26413
- color: ASH_GREY,
26422
+ fontSize: ".75rem",
26423
+ color: STORM_GREY,
26414
26424
  extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
26415
26425
  }, "Exp Date ", expireDate);
26416
26426
  case EXPIRING_SOON:
26417
26427
  return /*#__PURE__*/React__default.createElement(Text$1, {
26418
26428
  as: as,
26419
26429
  variant: "pXS",
26430
+ fontSize: ".75rem",
26420
26431
  color: FIRE_YELLOW,
26421
26432
  extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
26422
26433
  }, "Expiring Soon ", expireDate);
@@ -26424,7 +26435,8 @@ var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
26424
26435
  return /*#__PURE__*/React__default.createElement(Text$1, {
26425
26436
  as: as,
26426
26437
  variant: "pXS",
26427
- color: ASH_GREY,
26438
+ fontSize: ".75rem",
26439
+ color: STORM_GREY,
26428
26440
  extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
26429
26441
  }, "Expired");
26430
26442
  }
@@ -26451,7 +26463,7 @@ var CreditCardWrapper = styled__default.div.withConfig({
26451
26463
  var CCIconWrapper = styled__default.div.withConfig({
26452
26464
  displayName: "FormattedCreditCard__CCIconWrapper",
26453
26465
  componentId: "sc-s0ta5l-1"
26454
- })(["margin-right:16px;width:30px;height:auto;display:flex;"]);
26466
+ })(["margin-right:16px;width:36px;height:auto;display:flex;"]);
26455
26467
  var FormattedCreditCard = function FormattedCreditCard(_ref) {
26456
26468
  var lastFour = _ref.lastFour,
26457
26469
  type = _ref.type,
@@ -26459,23 +26471,26 @@ var FormattedCreditCard = function FormattedCreditCard(_ref) {
26459
26471
  expireDate = _ref.expireDate,
26460
26472
  expirationStatus = _ref.expirationStatus,
26461
26473
  themeValues = _ref.themeValues;
26474
+ var _useContext = React.useContext(styled.ThemeContext),
26475
+ isMobile = _useContext.isMobile;
26462
26476
  return /*#__PURE__*/React__default.createElement(CreditCardWrapper, null, /*#__PURE__*/React__default.createElement(CCIconWrapper, null, /*#__PURE__*/React__default.createElement(CardType, {
26463
- type: type
26477
+ type: type,
26478
+ size: isMobile ? "small" : "large"
26464
26479
  })), /*#__PURE__*/React__default.createElement(Stack, {
26465
26480
  childGap: "0"
26466
26481
  }, /*#__PURE__*/React__default.createElement(Box, {
26467
26482
  padding: "0"
26468
26483
  }, /*#__PURE__*/React__default.createElement(Text$1, {
26469
26484
  variant: "p",
26470
- padding: "0 0 0 8px",
26485
+ padding: "0",
26471
26486
  color: themeValues.textColor,
26472
26487
  textAlign: "left",
26473
26488
  extraStyles: "display: inline-block;"
26474
26489
  }, "Card ending in ".concat(lastFour)), expireDate && /*#__PURE__*/React__default.createElement(React.Fragment, null, renderCardStatus(expirationStatus, expireDate, "left", "p"))), autoPay && /*#__PURE__*/React__default.createElement(Text$1, {
26475
26490
  variant: "p",
26476
26491
  color: themeValues.autopayTextColor,
26477
- extraStyles: "font-style: italic;"
26478
- }, "Autopay Enabled")));
26492
+ extraStyles: "font-style: italic; font-size: .75rem;"
26493
+ }, "Autopay On")));
26479
26494
  };
26480
26495
  var FormattedCreditCard$1 = themeComponent(FormattedCreditCard, "FormattedCreditCard", fallbackValues$p);
26481
26496
 
@@ -40881,6 +40896,7 @@ var EditableList = function EditableList(_ref) {
40881
40896
  _ref$canAdd = _ref.canAdd,
40882
40897
  canAdd = _ref$canAdd === void 0 ? true : _ref$canAdd,
40883
40898
  addItem = _ref.addItem,
40899
+ addItemDestination = _ref.addItemDestination,
40884
40900
  removeItem = _ref.removeItem,
40885
40901
  editItem = _ref.editItem,
40886
40902
  itemName = _ref.itemName,
@@ -40988,6 +41004,8 @@ var EditableList = function EditableList(_ref) {
40988
41004
  padding: items.length === 0 ? "0" : "1rem 0 0"
40989
41005
  }, /*#__PURE__*/React__default.createElement(Placeholder$1, {
40990
41006
  text: addText,
41007
+ isLink: !!addItemDestination,
41008
+ destination: addItemDestination,
40991
41009
  action: addItem,
40992
41010
  dataQa: "Add " + qaPrefix,
40993
41011
  "aria-label": addText,
@@ -41158,7 +41176,7 @@ var EmailForm = function EmailForm(_ref) {
41158
41176
  }, []);
41159
41177
  }
41160
41178
  useConditionallyAddValidator(isRequired, required, actions.fields.email.addValidator, actions.fields.email.removeValidator);
41161
- var emailFieldErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "Invalid email address");
41179
+ var emailFieldErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "Please enter a valid email address in the format user@example.com");
41162
41180
  return /*#__PURE__*/React__default.createElement(FormContainer$1, {
41163
41181
  variant: variant,
41164
41182
  role: "form",
@@ -41250,7 +41268,7 @@ var ForgotPasswordForm = function ForgotPasswordForm(_ref) {
41250
41268
  };
41251
41269
  }, []);
41252
41270
  }
41253
- var EmailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "Email address is not valid");
41271
+ var EmailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "Please enter a valid email address in the format user@example.com");
41254
41272
  return /*#__PURE__*/React__default.createElement(FormInput$1, {
41255
41273
  labelTextWhenNoError: "Email address",
41256
41274
  errorMessages: EmailErrorMessages,
@@ -45949,7 +45967,7 @@ var LoginForm = function LoginForm(_ref) {
45949
45967
  };
45950
45968
  }, []);
45951
45969
  }
45952
- var emailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "Invalid email address");
45970
+ var emailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email address is required"), isProbablyEmail.error, "Please enter a valid email address in the format user@example.com");
45953
45971
  var passwordErrorMessages = _defineProperty({}, required.error, "Password is required");
45954
45972
  return /*#__PURE__*/React__default.createElement(FormInputColumn, {
45955
45973
  role: "form",
@@ -48077,7 +48095,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
48077
48095
  weight: themeValues.fontWeight,
48078
48096
  hoverStyles: themeValues.modalLinkHoverFocus,
48079
48097
  textDecoration: themeValues.modalLinkTextDecoration,
48080
- extraStyles: "display: inline-block; width: fit-content; cursor: pointer",
48098
+ extraStyles: "display: inline-block; width: fit-content; cursor: pointer; min-height: 24px; line-height: 24px;",
48081
48099
  role: "button" // This should always be a "button" since it opens a modal
48082
48100
  ,
48083
48101
  className: "modal-trigger"
@@ -48916,10 +48934,10 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
48916
48934
  componentId: "sc-1wtp6qc-0"
48917
48935
  })(["height:", ";width:", ";", " transition:opacity 0.3s ease;"], function (_ref2) {
48918
48936
  var isMobile = _ref2.isMobile;
48919
- return isMobile ? "14px" : "18px";
48937
+ return isMobile ? "16px" : "24px";
48920
48938
  }, function (_ref3) {
48921
48939
  var isMobile = _ref3.isMobile;
48922
- return isMobile ? "22px" : "28px";
48940
+ return isMobile ? "24px" : "36px";
48923
48941
  }, function (_ref4) {
48924
48942
  var fade = _ref4.fade;
48925
48943
  return fade && "opacity: 0.4;";
@@ -48991,7 +49009,7 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
48991
49009
  padding: section.titleIcon ? "0 0 0 8px" : "0"
48992
49010
  }, /*#__PURE__*/React__default.createElement(Text$1, {
48993
49011
  as: "label",
48994
- htmlFor: "radio-input-".concat(idString(section)),
49012
+ htmlFor: "radio-".concat(idString(section)),
48995
49013
  color: CHARADE_GREY
48996
49014
  }, section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
48997
49015
  id: "right-icons-".concat(idString(section)),
@@ -49322,7 +49340,7 @@ var RegistrationForm = function RegistrationForm(_ref) {
49322
49340
  }
49323
49341
  var firstNameErrorMessages = _defineProperty(_defineProperty({}, required.error, "First name is required"), validName.error, "First name contains invalid characters");
49324
49342
  var lastNameErrorMessages = _defineProperty(_defineProperty({}, required.error, "Last name is required"), validName.error, "Last name contains invalid characters");
49325
- var emailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email is required"), isProbablyEmail.error, "Invalid email address");
49343
+ var emailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email is required"), isProbablyEmail.error, "Please enter a valid email address in the format user@example.com");
49326
49344
  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 (!@#$%^&*.?)");
49327
49345
  var confirmPasswordErrorMessages = _defineProperty({}, matchesField.error, "Confirm password must match password");
49328
49346
  return /*#__PURE__*/React__default.createElement(FormInputColumn, {
@@ -51454,25 +51472,39 @@ var TurnstileWidget = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
51454
51472
  }, error)));
51455
51473
  });
51456
51474
 
51457
- var TOOLTIP_THEME_SOURCE = "Popover";
51475
+ var hoverColor$6 = ROYAL_BLUE;
51476
+ var activeColor$b = CONGRESS_BLUE;
51477
+ var linkColor$6 = ROYAL_BLUE_VIVID;
51478
+ var textColor$5 = CHARADE_GREY;
51458
51479
  var fallbackValues$12 = {
51459
- hoverColor: SAPPHIRE_BLUE,
51460
- activeColor: PEACOCK_BLUE,
51461
- popoverTriggerColor: MATISSE_BLUE,
51462
- borderColor: "rgba(255, 255, 255, 0.85)"
51480
+ linkColor: linkColor$6,
51481
+ hoverColor: hoverColor$6,
51482
+ activeColor: activeColor$b,
51483
+ textColor: textColor$5
51463
51484
  };
51485
+
51486
+ var TOOLTIP_THEME_SOURCE = "Popover";
51464
51487
  var Tooltip = function Tooltip(_ref) {
51465
51488
  var tooltipID = _ref.tooltipID,
51466
- _ref$hasIconTrigger = _ref.hasIconTrigger,
51467
- hasIconTrigger = _ref$hasIconTrigger === void 0 ? false : _ref$hasIconTrigger,
51468
- _ref$IconTrigger = _ref.IconTrigger,
51469
- IconTrigger = _ref$IconTrigger === void 0 ? WarningIconXS : _ref$IconTrigger,
51470
- _ref$iconHelpText = _ref.iconHelpText,
51471
- iconHelpText = _ref$iconHelpText === void 0 ? "Open the tooltip" : _ref$iconHelpText,
51489
+ children = _ref.children,
51490
+ _ref$hasCustomTrigger = _ref.hasCustomTrigger,
51491
+ hasCustomTrigger = _ref$hasCustomTrigger === void 0 ? false : _ref$hasCustomTrigger,
51472
51492
  _ref$triggerText = _ref.triggerText,
51473
- triggerText = _ref$triggerText === void 0 ? "Open the tooltip" : _ref$triggerText,
51474
- _ref$tooltipContent = _ref.tooltipContent,
51475
- tooltipContent = _ref$tooltipContent === void 0 ? "The contents of the tooltip go here." : _ref$tooltipContent,
51493
+ triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
51494
+ _ref$containerExtraSt = _ref.containerExtraStyles,
51495
+ containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
51496
+ _ref$triggerButtonVar = _ref.triggerButtonVariant,
51497
+ triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
51498
+ _ref$content = _ref.content,
51499
+ content = _ref$content === void 0 ? "" : _ref$content,
51500
+ _ref$contentExtraStyl = _ref.contentExtraStyles,
51501
+ contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
51502
+ _ref$minWidth = _ref.minWidth,
51503
+ minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
51504
+ _ref$maxWidth = _ref.maxWidth,
51505
+ maxWidth = _ref$maxWidth === void 0 ? "100%" : _ref$maxWidth,
51506
+ _ref$height = _ref.height,
51507
+ height = _ref$height === void 0 ? "auto" : _ref$height,
51476
51508
  _ref$contentPosition = _ref.contentPosition,
51477
51509
  contentPosition = _ref$contentPosition === void 0 ? {
51478
51510
  top: "-110px",
@@ -51489,33 +51521,23 @@ var Tooltip = function Tooltip(_ref) {
51489
51521
  arrowBottom: "-8px",
51490
51522
  arrowLeft: "auto"
51491
51523
  } : _ref$arrowPosition,
51492
- _ref$minWidth = _ref.minWidth,
51493
- minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
51494
- _ref$maxWidth = _ref.maxWidth,
51495
- maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
51496
- _ref$height = _ref.height,
51497
- height = _ref$height === void 0 ? "auto" : _ref$height,
51498
- _ref$containerExtraSt = _ref.containerExtraStyles,
51499
- containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
51500
- _ref$triggerExtraStyl = _ref.triggerExtraStyles,
51501
- triggerExtraStyles = _ref$triggerExtraStyl === void 0 ? "" : _ref$triggerExtraStyl,
51502
- _ref$triggerButtonVar = _ref.triggerButtonVariant,
51503
- triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
51504
- _ref$contentExtraStyl = _ref.contentExtraStyles,
51505
- contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
51506
- _ref$contentBackgroun = _ref.contentBackgroundColor,
51507
- contentBackgroundColor = _ref$contentBackgroun === void 0 ? WHITE : _ref$contentBackgroun;
51524
+ customTriggerRole = _ref.customTriggerRole,
51525
+ _ref$backgroundColor = _ref.backgroundColor,
51526
+ backgroundColor = _ref$backgroundColor === void 0 ? WHITE : _ref$backgroundColor;
51527
+ /**
51528
+ * closeTimeoutRef is used internally to store a timer ID for delaying tooltip close. It will have a `.current` property (the timer ID) when the effect or event handlers set it.
51529
+ */
51508
51530
  var closeTimeoutRef = React.useRef(null);
51531
+ /**
51532
+ * containerRef is used to store a reference to the container element. It will have a `.current` property (the container element) when the effect or event handlers set it.
51533
+ */
51534
+ var containerRef = React.useRef(null);
51509
51535
  var _useState = React.useState(false),
51510
51536
  _useState2 = _slicedToArray(_useState, 2),
51511
51537
  tooltipOpen = _useState2[0],
51512
51538
  setTooltipOpen = _useState2[1];
51513
51539
  var themeContext = React.useContext(styled.ThemeContext);
51514
51540
  var themeValues = createThemeValues(themeContext, fallbackValues$12, TOOLTIP_THEME_SOURCE);
51515
- var borderColor = themeValues.borderColor,
51516
- tooltipTriggerColor = themeValues.popoverTriggerColor,
51517
- hoverColor = themeValues.hoverColor,
51518
- activeColor = themeValues.activeColor;
51519
51541
  var top = contentPosition.top,
51520
51542
  right = contentPosition.right,
51521
51543
  bottom = contentPosition.bottom,
@@ -51524,16 +51546,109 @@ var Tooltip = function Tooltip(_ref) {
51524
51546
  arrowRight = arrowPosition.arrowRight,
51525
51547
  arrowBottom = arrowPosition.arrowBottom,
51526
51548
  arrowLeft = arrowPosition.arrowLeft;
51527
- var handleToggleTooltip = function handleToggleTooltip(desiredTooltipState) {
51528
- if (tooltipOpen !== desiredTooltipState) {
51529
- setTooltipOpen(desiredTooltipState);
51549
+ var handleToggleTooltip = function handleToggleTooltip(desiredState) {
51550
+ if (tooltipOpen !== desiredState) {
51551
+ setTooltipOpen(desiredState);
51530
51552
  }
51531
51553
  };
51532
- var handleKeyboardEvent = function handleKeyboardEvent(e) {
51554
+ var handleKeyDown = function handleKeyDown(e) {
51533
51555
  if (e.key === "Escape") {
51534
51556
  handleToggleTooltip(false);
51535
51557
  }
51536
51558
  };
51559
+
51560
+ /**
51561
+ * @function renderTrigger
51562
+ * Renders the tooltip trigger element.
51563
+ *
51564
+ * When `hasCustomTrigger` is true, the provided child element is cloned and
51565
+ * injected with the event handlers needed to control tooltip visibility:
51566
+ * - onFocus/onBlur: open and close for keyboard users
51567
+ * - onKeyDown: allows Escape to dismiss the tooltip
51568
+ * - onTouchStart: open on tap for touch/mobile users (onFocus is unreliable on touch)
51569
+ *
51570
+ * Mouse interactions (hover) are handled at the container level via
51571
+ * onMouseEnter/onMouseLeave, so they do not need to be injected here.
51572
+ *
51573
+ * Any existing event handlers on the child are preserved and called first,
51574
+ * so the child's own behavior is not overridden.
51575
+ *
51576
+ * When no custom trigger is provided, a default ButtonWithAction is rendered
51577
+ * using `triggerText` and `triggerButtonVariant`.
51578
+ */
51579
+ var renderTrigger = function renderTrigger() {
51580
+ if (hasCustomTrigger && !children) {
51581
+ console.warn("Tooltip: children prop is required when hasCustomTrigger is true");
51582
+ }
51583
+ if (hasCustomTrigger && children) {
51584
+ var _child$props, _child$props$tabIndex, _child$props2, _child$props3, _child$props4;
51585
+ var child = React__default.Children.only(children);
51586
+ /**
51587
+ * Capture the child's existing handlers before overwriting
51588
+ */
51589
+ var _ref2 = (_child$props = child.props) !== null && _child$props !== void 0 ? _child$props : {},
51590
+ childOnFocus = _ref2.onFocus,
51591
+ childOnBlur = _ref2.onBlur,
51592
+ childOnKeyDown = _ref2.onKeyDown,
51593
+ childOnTouchStart = _ref2.onTouchStart;
51594
+
51595
+ /**
51596
+ * Clone the child element and add the necessary event handlers
51597
+ */
51598
+ return /*#__PURE__*/React__default.cloneElement(child, {
51599
+ tabIndex: (_child$props$tabIndex = (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.tabIndex) !== null && _child$props$tabIndex !== void 0 ? _child$props$tabIndex : 0,
51600
+ ariaDescribedby: tooltipID,
51601
+ style: _objectSpread2({
51602
+ cursor: "pointer"
51603
+ }, (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.style),
51604
+ onFocus: function onFocus(e) {
51605
+ childOnFocus === null || childOnFocus === void 0 || childOnFocus(e);
51606
+ handleToggleTooltip(true);
51607
+ },
51608
+ onBlur: function onBlur(e) {
51609
+ childOnBlur === null || childOnBlur === void 0 || childOnBlur(e);
51610
+ handleToggleTooltip(false);
51611
+ },
51612
+ onKeyDown: function onKeyDown(e) {
51613
+ childOnKeyDown === null || childOnKeyDown === void 0 || childOnKeyDown(e);
51614
+ handleKeyDown(e);
51615
+ },
51616
+ onTouchStart: function onTouchStart(e) {
51617
+ childOnTouchStart === null || childOnTouchStart === void 0 || childOnTouchStart(e);
51618
+ handleToggleTooltip(true);
51619
+ },
51620
+ role: customTriggerRole || ((_child$props4 = child.props) === null || _child$props4 === void 0 ? void 0 : _child$props4.role),
51621
+ "aria-describedby": tooltipID,
51622
+ "data-qa": "tooltip-trigger-".concat(tooltipID)
51623
+ });
51624
+ } else {
51625
+ return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51626
+ action: noop$1,
51627
+ onKeyDown: handleKeyDown,
51628
+ variant: triggerButtonVariant,
51629
+ text: triggerText,
51630
+ tabIndex: 0,
51631
+ "aria-describedby": tooltipID,
51632
+ onFocus: function onFocus() {
51633
+ return handleToggleTooltip(true);
51634
+ },
51635
+ onBlur: function onBlur() {
51636
+ return handleToggleTooltip(false);
51637
+ },
51638
+ onTouchStart: function onTouchStart() {
51639
+ return handleToggleTooltip(true);
51640
+ },
51641
+ dataQa: "tooltip-trigger-".concat(tooltipID),
51642
+ extraStyles: "\n color: ".concat(themeValues.linkColor, ";\n &:hover { color: ").concat(themeValues.hoverColor, "; text-decoration: none;}\n &:active, &:focus { color: ").concat(themeValues.activeColor, ";text-decoration: none;}\n button, span, &:hover span { text-decoration: none; }\n ")
51643
+ });
51644
+ }
51645
+ };
51646
+
51647
+ /**
51648
+ * @function handleMouseEnter
51649
+ * Handles the mouse enter event for the tooltip container.
51650
+ * It clears any existing timeout and opens the tooltip.
51651
+ */
51537
51652
  var handleMouseEnter = function handleMouseEnter() {
51538
51653
  if (closeTimeoutRef.current) {
51539
51654
  clearTimeout(closeTimeoutRef.current);
@@ -51541,69 +51656,67 @@ var Tooltip = function Tooltip(_ref) {
51541
51656
  }
51542
51657
  handleToggleTooltip(true);
51543
51658
  };
51659
+
51660
+ /**
51661
+ * @function handleMouseLeave
51662
+ * Handles the mouse leave event for the tooltip container.
51663
+ * It sets a timeout to close the tooltip after 200ms.
51664
+ */
51544
51665
  var handleMouseLeave = function handleMouseLeave() {
51545
51666
  closeTimeoutRef.current = setTimeout(function () {
51546
51667
  handleToggleTooltip(false);
51547
- }, 300);
51668
+ }, 200);
51548
51669
  };
51670
+
51671
+ /**
51672
+ * Handles the touch start event for the tooltip container.
51673
+ * It closes the tooltip if the touch is outside the container.
51674
+ */
51549
51675
  React.useEffect(function () {
51550
- return function () {
51551
- if (closeTimeoutRef.current) {
51552
- clearTimeout(closeTimeoutRef.current);
51676
+ if (!tooltipOpen) return;
51677
+ var handleOutsideTouch = function handleOutsideTouch(e) {
51678
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
51679
+ setTooltipOpen(false);
51553
51680
  }
51554
51681
  };
51682
+ document.addEventListener("touchstart", handleOutsideTouch);
51683
+ return function () {
51684
+ return document.removeEventListener("touchstart", handleOutsideTouch);
51685
+ };
51686
+ }, [tooltipOpen]);
51687
+
51688
+ /**
51689
+ * Cleans up the timeout when the component unmounts.
51690
+ */
51691
+ React.useEffect(function () {
51692
+ return function () {
51693
+ if (closeTimeoutRef !== null && closeTimeoutRef !== void 0 && closeTimeoutRef.current) clearTimeout(closeTimeoutRef.current);
51694
+ };
51555
51695
  }, []);
51556
51696
  return /*#__PURE__*/React__default.createElement(Box, {
51557
- ref: closeTimeoutRef,
51697
+ ref: containerRef,
51558
51698
  padding: "0",
51559
51699
  extraStyles: "position: relative; ".concat(containerExtraStyles),
51560
- onMouseEnter: function onMouseEnter() {
51561
- return handleMouseEnter();
51562
- },
51563
- onMouseLeave: function onMouseLeave() {
51564
- return handleMouseLeave();
51565
- },
51566
- "data-qa": "tooltip-container"
51567
- }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51568
- "aria-describedby": tooltipID,
51569
- onKeyDown: handleKeyboardEvent,
51570
- variant: triggerButtonVariant,
51571
- onFocus: function onFocus() {
51572
- return handleToggleTooltip(true);
51573
- },
51574
- onBlur: function onBlur() {
51575
- return handleToggleTooltip(false);
51576
- },
51577
- onTouchStart: function onTouchStart() {
51578
- return handleToggleTooltip(true);
51579
- },
51580
- "data-qa": "tooltip-trigger",
51581
- contentOverride: true
51582
- }, hasIconTrigger === true && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
51583
- "aria-label": "Open tooltip"
51584
- }, /*#__PURE__*/React__default.createElement(IconTrigger, {
51585
- color: tooltipTriggerColor
51586
- })), /*#__PURE__*/React__default.createElement(Box, {
51587
- padding: "0",
51588
- srOnly: true
51589
- }, /*#__PURE__*/React__default.createElement(Text$1, null, iconHelpText))), hasIconTrigger === false && /*#__PURE__*/React__default.createElement(Text$1, {
51590
- color: tooltipTriggerColor,
51591
- extraStyles: "\n color: ".concat(tooltipTriggerColor, ";\n &:visited {\n color: ").concat(tooltipTriggerColor, ";\n }\n &:hover {\n color: ").concat(hoverColor, "; \n }\n &:active,\n &:focus {\n color: ").concat(activeColor, "; \n }\n ").concat(triggerExtraStyles, ";\n ")
51592
- }, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
51700
+ onMouseEnter: handleMouseEnter,
51701
+ onMouseLeave: handleMouseLeave,
51702
+ "data-qa": "".concat(tooltipID, "-container")
51703
+ }, renderTrigger(), /*#__PURE__*/React__default.createElement(Box, {
51593
51704
  role: "tooltip",
51594
51705
  id: tooltipID,
51595
51706
  "aria-hidden": !tooltipOpen,
51596
- background: contentBackgroundColor,
51707
+ background: backgroundColor,
51597
51708
  "data-qa": "tooltip-contents",
51598
- extraStyles: "\n position: absolute;\n display: ".concat(tooltipOpen ? "block" : "none", ";\n top: ").concat(top, "; \n right: ").concat(right, ";\n bottom: ").concat(bottom, ";\n left: ").concat(left, ";\n height: ").concat(height, ";\n ").concat(contentExtraStyles, "\n "),
51709
+ extraStyles: "\n position: absolute;\n display: ".concat(tooltipOpen ? "block" : "none", ";\n top: ").concat(top, ";\n right: ").concat(right, ";\n bottom: ").concat(bottom, ";\n left: ").concat(left, ";\n height: ").concat(height, ";\n color: ").concat(themeValues.textColor, ";\n ").concat(contentExtraStyles, "\n "),
51599
51710
  boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
51600
51711
  border: "1px solid transparent",
51601
51712
  borderRadius: "4px",
51602
51713
  minWidth: minWidth,
51603
51714
  maxWidth: maxWidth
51604
- }, /*#__PURE__*/React__default.createElement(Paragraph$1, null, tooltipContent), /*#__PURE__*/React__default.createElement(Box, {
51715
+ }, typeof content === "string" && content !== "" ? /*#__PURE__*/React__default.createElement(Text$1, {
51716
+ color: themeValues.textColor
51717
+ }, content) : content !== undefined && content !== null ? content : null, /*#__PURE__*/React__default.createElement(Box, {
51605
51718
  padding: "0",
51606
- extraStyles: "\n position: absolute;\n content: \"\";\n width: 0;\n height: 0;\n ".concat(arrowBorder(borderColor, arrowDirection, "8px"), ";\n filter: drop-shadow(2px 8px 14px black);\n bottom: ").concat(arrowBottom, ";\n right: ").concat(arrowRight, ";\n top: ").concat(arrowTop, ";\n left: ").concat(arrowLeft, ";\n ")
51719
+ extraStyles: "\n position: absolute;\n content: \"\";\n width: 0;\n height: 0;\n ".concat(arrowBorder(backgroundColor, arrowDirection, "8px"), ";\n filter: drop-shadow(2px 8px 14px black);\n bottom: ").concat(arrowBottom, ";\n right: ").concat(arrowRight, ";\n top: ").concat(arrowTop, ";\n left: ").concat(arrowLeft, ";\n ")
51607
51720
  })));
51608
51721
  };
51609
51722