@thecb/components 12.0.1-beta.1 → 12.0.1

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 CHANGED
@@ -22119,7 +22119,7 @@ var ENTER = 13;
22119
22119
  var ESCAPE = 27;
22120
22120
  var SPACEBAR = 32;
22121
22121
 
22122
- var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon"];
22122
+ var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "isRequired", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon"];
22123
22123
  var CheckboxContainer = styled__default.span.withConfig({
22124
22124
  displayName: "Checkbox__CheckboxContainer",
22125
22125
  componentId: "sc-36kqbv-0"
@@ -22178,6 +22178,8 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22178
22178
  hidden = _ref5$hidden === void 0 ? false : _ref5$hidden,
22179
22179
  _ref5$error = _ref5.error,
22180
22180
  error = _ref5$error === void 0 ? false : _ref5$error,
22181
+ _ref5$isRequired = _ref5.isRequired,
22182
+ isRequired = _ref5$isRequired === void 0 ? false : _ref5$isRequired,
22181
22183
  _ref5$checkboxMargin = _ref5.checkboxMargin,
22182
22184
  checkboxMargin = _ref5$checkboxMargin === void 0 ? "0 16px 0 0" : _ref5$checkboxMargin,
22183
22185
  extraStyles = _ref5.extraStyles,
@@ -22206,6 +22208,13 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22206
22208
  ref: ref,
22207
22209
  padding: "0",
22208
22210
  tabIndex: "0",
22211
+ role: "checkbox",
22212
+ "aria-checked": checked,
22213
+ "aria-required": isRequired || undefined,
22214
+ "aria-invalid": error,
22215
+ "aria-label": ariaLabel,
22216
+ "aria-labelledby": ariaLabelledById,
22217
+ "aria-describedby": error ? "".concat(name, "-error-message") : undefined,
22209
22218
  onFocus: function onFocus() {
22210
22219
  return setFocused(true);
22211
22220
  },
@@ -22226,19 +22235,16 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22226
22235
  id: "checkbox-".concat(name),
22227
22236
  disabled: disabled,
22228
22237
  name: name,
22229
- "aria-label": ariaLabel,
22230
- "aria-labelledby": ariaLabelledById,
22231
22238
  checked: checked,
22232
22239
  onChange: onChange,
22233
22240
  tabIndex: "-1",
22234
- "aria-invalid": error,
22235
- "aria-describedby": error ? "".concat(name, "-error-message") : ""
22241
+ required: isRequired,
22242
+ "aria-hidden": "true"
22236
22243
  }), /*#__PURE__*/React__default.createElement(StyledCheckbox, {
22237
- role: "checkbox",
22244
+ "aria-hidden": "true",
22238
22245
  error: error,
22239
22246
  disabled: disabled,
22240
22247
  checked: checked,
22241
- "aria-checked": checked,
22242
22248
  focused: focused,
22243
22249
  defaultStyles: themeValues.defaultStyles,
22244
22250
  checkedStyles: themeValues.checkedStyles,
@@ -25975,6 +25981,7 @@ var FormInput = function FormInput(_ref15) {
25975
25981
  "aria-labelledby": ariaLabelledBy === undefined ? createIdFromString(labelTextWhenNoError) : ariaLabelledBy,
25976
25982
  "aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
25977
25983
  "aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
25984
+ "aria-required": isRequired,
25978
25985
  onChange: function onChange(value) {
25979
25986
  return setValue(value);
25980
25987
  },
@@ -26007,6 +26014,7 @@ var FormInput = function FormInput(_ref15) {
26007
26014
  "aria-labelledby": ariaLabelledBy === undefined ? createIdFromString(labelTextWhenNoError) : ariaLabelledBy,
26008
26015
  "aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
26009
26016
  "aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
26017
+ "aria-required": isRequired,
26010
26018
  onChange: function onChange(e) {
26011
26019
  return setValue(e.target.value);
26012
26020
  },
@@ -45839,34 +45847,37 @@ var fallbackValues$L = {
45839
45847
  textColor: textColor$5
45840
45848
  };
45841
45849
 
45842
- var getCardBaseStyles = function getCardBaseStyles(theme, disabled, extraStyles) {
45843
- return "\n flex-direction: column;\n align-items: flex-start;\n gap: 40px;\n flex-shrink: 0;\n padding: 24px;\n align-self: stretch;\n border-radius: 8px;\n text-decoration: none;\n font-size: inherit;\n color: inherit;\n font-weight: inherit;\n line-height: inherit;\n background-color: ".concat(disabled ? theme.disabledBackgroundColor : theme.backgroundColor, ";\n border: 1px solid\n ").concat(disabled ? theme.disabledBorderColor : theme.borderColor, ";\n transition: all 0.2s ease-in-out;\n ").concat(disabled ? "pointer-events: none;" : "", "\n ").concat(extraStyles || "", "\n");
45844
- };
45845
- var getCardHoverActiveStyles = function getCardHoverActiveStyles(theme, disabled, hoverStyles, activeStyles) {
45846
- if (disabled) {
45847
- return "\n &:hover,\n &:active {\n cursor: default;\n box-shadow: none;\n border: 1px solid ".concat(theme.disabledBorderColor, ";\n }\n ");
45848
- }
45849
- return "\n &:hover,\n &:active {\n cursor: pointer;\n box-shadow: 0px 0px 0px 0px rgba(41, 42, 51, 0.1),\n 0px 5px 11px 0px rgba(41, 42, 51, 0.1),\n 0px 4px 19px 0px rgba(41, 42, 51, 0.09),\n 0px 27px 26px 0px rgba(41, 42, 51, 0.05),\n 0px 56px 31px 0px rgba(41, 42, 51, 0.01),\n 0px 80px 33px 0px rgba(41, 42, 51, 0);\n }\n ".concat(hoverStyles || "", "\n\n &:hover:not(:active) {\n border: 1px solid ").concat(theme.borderColor, ";\n }\n\n &:active {\n background-color: ").concat(theme.activeBackgroundColor, ";\n border: 1px solid ").concat(theme.borderColor, ";\n ").concat(activeStyles || "", "\n }\n ");
45850
- };
45851
- var Title$2 = styled__default(Heading$1).withConfig({
45852
- displayName: "LinkCardstyled__Title",
45850
+ var StyledAnchor = styled__default("a").withConfig({
45851
+ displayName: "LinkCardstyled__StyledAnchor",
45853
45852
  componentId: "sc-l5q1h2-0"
45854
- })(["display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;align-self:stretch;overflow:hidden;text-overflow:ellipsis;font-size:16px;line-height:150%;background-color:transparent;font-weight:", ";color:", ";"], FONT_WEIGHT_SEMIBOLD, function (_ref) {
45853
+ })(["", ""], function (_ref) {
45855
45854
  var disabled = _ref.$disabled,
45856
- theme = _ref.$theme;
45857
- return disabled ? theme.disabledColor : theme.color;
45855
+ theme = _ref.$theme,
45856
+ extraStyles = _ref.$extraStyles,
45857
+ disabledStyles = _ref.$disabledStyles,
45858
+ hoverStyles = _ref.$hoverStyles,
45859
+ activeStyles = _ref.$activeStyles;
45860
+ return "\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 40px;\n flex-shrink: 0;\n padding: 24px;\n align-self: stretch;\n border-radius: 8px;\n text-decoration: none;\n background-color: ".concat(disabled ? theme.disabledBackgroundColor : theme.backgroundColor, ";\n border: 1px solid\n ").concat(disabled ? theme.disabledBorderColor : theme.borderColor, ";\n transition: all 0.2s ease-in-out;\n ").concat(extraStyles || "", "\n\n ").concat(disabled ? "\n &:hover,\n &:active {\n cursor: default;\n box-shadow: none;\n border: 1px solid ".concat(theme.disabledBorderColor, ";\n ").concat(disabledStyles || "", "\n }\n ") : "\n &:hover,\n &:active {\n cursor: pointer;\n box-shadow: 0px 0px 0px 0px rgba(41, 42, 51, 0.1),\n 0px 5px 11px 0px rgba(41, 42, 51, 0.1),\n 0px 4px 19px 0px rgba(41, 42, 51, 0.09),\n 0px 27px 26px 0px rgba(41, 42, 51, 0.05),\n 0px 56px 31px 0px rgba(41, 42, 51, 0.01),\n 0px 80px 33px 0px rgba(41, 42, 51, 0);\n }\n ".concat(hoverStyles || "", "\n\n &:hover:not(:active) {\n border: 1px solid ").concat(theme.borderColor, ";\n }\n\n &:active {\n background-color: ").concat(theme.activeBackgroundColor, ";\n border: 1px solid ").concat(theme.borderColor, ";\n ").concat(activeStyles || "", "\n }\n "), "\n ");
45858
45861
  });
45859
- var Subtitle = styled__default(Paragraph$1).withConfig({
45860
- displayName: "LinkCardstyled__Subtitle",
45862
+ var Title$2 = styled__default(Heading$1).withConfig({
45863
+ displayName: "LinkCardstyled__Title",
45861
45864
  componentId: "sc-l5q1h2-1"
45862
- })(["overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;align-self:stretch;font-size:14px;line-height:150%;letter-spacing:0.14px;font-weight:", ";color:", ";"], FONT_WEIGHT_REGULAR, function (_ref2) {
45865
+ })(["display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;align-self:stretch;overflow:hidden;text-overflow:ellipsis;font-size:16px;line-height:150%;background-color:transparent;font-weight:", ";color:", ";"], FONT_WEIGHT_SEMIBOLD, function (_ref2) {
45863
45866
  var disabled = _ref2.$disabled,
45864
45867
  theme = _ref2.$theme;
45868
+ return disabled ? theme.disabledColor : theme.color;
45869
+ });
45870
+ var Subtitle = styled__default(Paragraph$1).withConfig({
45871
+ displayName: "LinkCardstyled__Subtitle",
45872
+ componentId: "sc-l5q1h2-2"
45873
+ })(["overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;align-self:stretch;font-size:14px;line-height:150%;letter-spacing:0.14px;font-weight:", ";color:", ";"], FONT_WEIGHT_REGULAR, function (_ref3) {
45874
+ var disabled = _ref3.$disabled,
45875
+ theme = _ref3.$theme;
45865
45876
  return disabled ? theme.disabledColor : theme.textColor;
45866
45877
  });
45867
45878
  var Footer = styled__default(Stack).withConfig({
45868
45879
  displayName: "LinkCardstyled__Footer",
45869
- componentId: "sc-l5q1h2-2"
45880
+ componentId: "sc-l5q1h2-3"
45870
45881
  })(["align-items:center;width:100%;"]);
45871
45882
 
45872
45883
  var LinkCard = function LinkCard(_ref) {
@@ -45897,9 +45908,21 @@ var LinkCard = function LinkCard(_ref) {
45897
45908
  isExternalLink = _ref$isExternalLink === void 0 ? false : _ref$isExternalLink;
45898
45909
  var regex = /\W/g;
45899
45910
  var locatorSlug = title === null || title === void 0 || (_title$toLowerCase = title.toLowerCase) === null || _title$toLowerCase === void 0 || (_title$toLowerCase = _title$toLowerCase.call(title)) === null || _title$toLowerCase === void 0 || (_title$toLowerCase$re = _title$toLowerCase.replaceAll) === null || _title$toLowerCase$re === void 0 ? void 0 : _title$toLowerCase$re.call(_title$toLowerCase, regex, "-");
45900
- var baseStyles = getCardBaseStyles(themeValues, disabled, extraStyles);
45901
- var hoverActiveStyles = getCardHoverActiveStyles(themeValues, disabled, extraHoverStyles, extraActiveStyles);
45902
- var cardContent = /*#__PURE__*/React__default.createElement(Stack, {
45911
+ return /*#__PURE__*/React__default.createElement(StyledAnchor, {
45912
+ key: "link-card-".concat(locatorSlug),
45913
+ href: disabled ? undefined : href,
45914
+ rel: isExternalLink ? "noopener noreferrer" : undefined,
45915
+ target: isExternalLink ? "_blank" : undefined,
45916
+ tabIndex: disabled ? -1 : 0,
45917
+ "aria-disabled": disabled,
45918
+ $disabled: disabled,
45919
+ "aria-label": "".concat(title, ", ").concat(subtitle),
45920
+ "data-qa": "link-card-".concat(locatorSlug),
45921
+ $theme: themeValues,
45922
+ $extraStyles: disabled ? "pointer-events: none; ".concat(extraStyles) : extraStyles,
45923
+ $hoverStyles: extraHoverStyles,
45924
+ $activeStyles: extraActiveStyles
45925
+ }, /*#__PURE__*/React__default.createElement(Stack, {
45903
45926
  childGap: 0,
45904
45927
  bottomItem: 3,
45905
45928
  justify: "space-between",
@@ -45941,30 +45964,7 @@ var LinkCard = function LinkCard(_ref) {
45941
45964
  justify: "space-between"
45942
45965
  }, showLeft && !!leftContent ? leftContent : /*#__PURE__*/React__default.createElement(Box, {
45943
45966
  extraStyles: "margin-right: auto;"
45944
- }), showRight && !!rightContent && rightContent)));
45945
- if (isExternalLink) {
45946
- return /*#__PURE__*/React__default.createElement(ExternalLink, {
45947
- key: "link-card-".concat(locatorSlug),
45948
- href: disabled ? "" : href,
45949
- newTab: true,
45950
- isUnderlined: false,
45951
- tabIndex: disabled ? "-1" : "0",
45952
- ariaLabel: "".concat(title, ", ").concat(subtitle),
45953
- dataQa: "link-card-".concat(locatorSlug),
45954
- extraStyles: "".concat(baseStyles, " ").concat(hoverActiveStyles)
45955
- }, cardContent);
45956
- }
45957
- return /*#__PURE__*/React__default.createElement(InternalLink, {
45958
- key: "link-card-".concat(locatorSlug),
45959
- to: disabled ? "" : href,
45960
- isUnderlined: false,
45961
- hoverUnderline: false,
45962
- tabIndex: disabled ? "-1" : "0",
45963
- "aria-label": "".concat(title, ", ").concat(subtitle),
45964
- "aria-disabled": disabled,
45965
- "data-qa": "link-card-".concat(locatorSlug),
45966
- extraStyles: "".concat(baseStyles, " ").concat(hoverActiveStyles)
45967
- }, cardContent);
45967
+ }), showRight && !!rightContent && rightContent))));
45968
45968
  };
45969
45969
  var LinkCard$1 = themeComponent(LinkCard, "LinkCard", fallbackValues$L, "primary");
45970
45970
 
@@ -48177,7 +48177,9 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48177
48177
  _ref$modalTitle = _ref.modalTitle,
48178
48178
  modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle,
48179
48179
  _ref$initialFocusSele = _ref.initialFocusSelector,
48180
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
48180
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele,
48181
+ _ref$isRequired = _ref.isRequired,
48182
+ isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
48181
48183
  var _useState = React.useState(false),
48182
48184
  _useState2 = _slicedToArray(_useState, 2),
48183
48185
  showTerms = _useState2[0],
@@ -48210,7 +48212,8 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48210
48212
  onChange: onCheck,
48211
48213
  checkboxMargin: checkboxMargin,
48212
48214
  extraStyles: "align-self: flex-start;",
48213
- labelledById: TermsAndConditionsTitleDivId
48215
+ labelledById: TermsAndConditionsTitleDivId,
48216
+ isRequired: isRequired
48214
48217
  }), /*#__PURE__*/React__default.createElement(Stack, {
48215
48218
  childGap: "0.25rem",
48216
48219
  fullHeight: true
@@ -49368,7 +49371,8 @@ var RegistrationForm = function RegistrationForm(_ref) {
49368
49371
  return e.key === "Enter" && handleSubmit(e);
49369
49372
  },
49370
49373
  autocompleteValue: "given-name",
49371
- dataQa: "First name"
49374
+ dataQa: "First name",
49375
+ isRequired: true
49372
49376
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
49373
49377
  labelTextWhenNoError: "Last name",
49374
49378
  errorMessages: lastNameErrorMessages,
@@ -49379,7 +49383,8 @@ var RegistrationForm = function RegistrationForm(_ref) {
49379
49383
  return e.key === "Enter" && handleSubmit(e);
49380
49384
  },
49381
49385
  autocompleteValue: "family-name",
49382
- dataQa: "Last name"
49386
+ dataQa: "Last name",
49387
+ isRequired: true
49383
49388
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
49384
49389
  labelTextWhenNoError: "Email address",
49385
49390
  errorMessages: emailErrorMessages,
@@ -49392,7 +49397,8 @@ var RegistrationForm = function RegistrationForm(_ref) {
49392
49397
  type: "email",
49393
49398
  isEmail: true,
49394
49399
  autocompleteValue: "email",
49395
- dataQa: "Email address"
49400
+ dataQa: "Email address",
49401
+ isRequired: true
49396
49402
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
49397
49403
  labelTextWhenNoError: "Password",
49398
49404
  errorMessages: passwordErrorMessages,
@@ -49404,7 +49410,8 @@ var RegistrationForm = function RegistrationForm(_ref) {
49404
49410
  },
49405
49411
  type: "password",
49406
49412
  autocompleteValue: "new-password",
49407
- dataQa: "Password"
49413
+ dataQa: "Password",
49414
+ isRequired: true
49408
49415
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
49409
49416
  labelTextWhenNoError: "Confirm password",
49410
49417
  errorMessages: confirmPasswordErrorMessages,
@@ -49416,7 +49423,8 @@ var RegistrationForm = function RegistrationForm(_ref) {
49416
49423
  },
49417
49424
  type: "password",
49418
49425
  autocompleteValue: "new-password",
49419
- dataQa: "Confirm password"
49426
+ dataQa: "Confirm password",
49427
+ isRequired: true
49420
49428
  }), /*#__PURE__*/React__default.createElement(Box, {
49421
49429
  padding: isMobile ? "0" : "0.5rem 0 0"
49422
49430
  }, /*#__PURE__*/React__default.createElement(PasswordRequirements, {