@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.esm.js CHANGED
@@ -22111,7 +22111,7 @@ var ENTER = 13;
22111
22111
  var ESCAPE = 27;
22112
22112
  var SPACEBAR = 32;
22113
22113
 
22114
- var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon"];
22114
+ var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "isRequired", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon"];
22115
22115
  var CheckboxContainer = styled.span.withConfig({
22116
22116
  displayName: "Checkbox__CheckboxContainer",
22117
22117
  componentId: "sc-36kqbv-0"
@@ -22170,6 +22170,8 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref5, ref) {
22170
22170
  hidden = _ref5$hidden === void 0 ? false : _ref5$hidden,
22171
22171
  _ref5$error = _ref5.error,
22172
22172
  error = _ref5$error === void 0 ? false : _ref5$error,
22173
+ _ref5$isRequired = _ref5.isRequired,
22174
+ isRequired = _ref5$isRequired === void 0 ? false : _ref5$isRequired,
22173
22175
  _ref5$checkboxMargin = _ref5.checkboxMargin,
22174
22176
  checkboxMargin = _ref5$checkboxMargin === void 0 ? "0 16px 0 0" : _ref5$checkboxMargin,
22175
22177
  extraStyles = _ref5.extraStyles,
@@ -22198,6 +22200,13 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref5, ref) {
22198
22200
  ref: ref,
22199
22201
  padding: "0",
22200
22202
  tabIndex: "0",
22203
+ role: "checkbox",
22204
+ "aria-checked": checked,
22205
+ "aria-required": isRequired || undefined,
22206
+ "aria-invalid": error,
22207
+ "aria-label": ariaLabel,
22208
+ "aria-labelledby": ariaLabelledById,
22209
+ "aria-describedby": error ? "".concat(name, "-error-message") : undefined,
22201
22210
  onFocus: function onFocus() {
22202
22211
  return setFocused(true);
22203
22212
  },
@@ -22218,19 +22227,16 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref5, ref) {
22218
22227
  id: "checkbox-".concat(name),
22219
22228
  disabled: disabled,
22220
22229
  name: name,
22221
- "aria-label": ariaLabel,
22222
- "aria-labelledby": ariaLabelledById,
22223
22230
  checked: checked,
22224
22231
  onChange: onChange,
22225
22232
  tabIndex: "-1",
22226
- "aria-invalid": error,
22227
- "aria-describedby": error ? "".concat(name, "-error-message") : ""
22233
+ required: isRequired,
22234
+ "aria-hidden": "true"
22228
22235
  }), /*#__PURE__*/React__default.createElement(StyledCheckbox, {
22229
- role: "checkbox",
22236
+ "aria-hidden": "true",
22230
22237
  error: error,
22231
22238
  disabled: disabled,
22232
22239
  checked: checked,
22233
- "aria-checked": checked,
22234
22240
  focused: focused,
22235
22241
  defaultStyles: themeValues.defaultStyles,
22236
22242
  checkedStyles: themeValues.checkedStyles,
@@ -25967,6 +25973,7 @@ var FormInput = function FormInput(_ref15) {
25967
25973
  "aria-labelledby": ariaLabelledBy === undefined ? createIdFromString(labelTextWhenNoError) : ariaLabelledBy,
25968
25974
  "aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
25969
25975
  "aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
25976
+ "aria-required": isRequired,
25970
25977
  onChange: function onChange(value) {
25971
25978
  return setValue(value);
25972
25979
  },
@@ -25999,6 +26006,7 @@ var FormInput = function FormInput(_ref15) {
25999
26006
  "aria-labelledby": ariaLabelledBy === undefined ? createIdFromString(labelTextWhenNoError) : ariaLabelledBy,
26000
26007
  "aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
26001
26008
  "aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
26009
+ "aria-required": isRequired,
26002
26010
  onChange: function onChange(e) {
26003
26011
  return setValue(e.target.value);
26004
26012
  },
@@ -45831,34 +45839,37 @@ var fallbackValues$L = {
45831
45839
  textColor: textColor$5
45832
45840
  };
45833
45841
 
45834
- var getCardBaseStyles = function getCardBaseStyles(theme, disabled, extraStyles) {
45835
- 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");
45836
- };
45837
- var getCardHoverActiveStyles = function getCardHoverActiveStyles(theme, disabled, hoverStyles, activeStyles) {
45838
- if (disabled) {
45839
- return "\n &:hover,\n &:active {\n cursor: default;\n box-shadow: none;\n border: 1px solid ".concat(theme.disabledBorderColor, ";\n }\n ");
45840
- }
45841
- 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 ");
45842
- };
45843
- var Title$2 = styled(Heading$1).withConfig({
45844
- displayName: "LinkCardstyled__Title",
45842
+ var StyledAnchor = styled("a").withConfig({
45843
+ displayName: "LinkCardstyled__StyledAnchor",
45845
45844
  componentId: "sc-l5q1h2-0"
45846
- })(["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) {
45845
+ })(["", ""], function (_ref) {
45847
45846
  var disabled = _ref.$disabled,
45848
- theme = _ref.$theme;
45849
- return disabled ? theme.disabledColor : theme.color;
45847
+ theme = _ref.$theme,
45848
+ extraStyles = _ref.$extraStyles,
45849
+ disabledStyles = _ref.$disabledStyles,
45850
+ hoverStyles = _ref.$hoverStyles,
45851
+ activeStyles = _ref.$activeStyles;
45852
+ 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 ");
45850
45853
  });
45851
- var Subtitle = styled(Paragraph$1).withConfig({
45852
- displayName: "LinkCardstyled__Subtitle",
45854
+ var Title$2 = styled(Heading$1).withConfig({
45855
+ displayName: "LinkCardstyled__Title",
45853
45856
  componentId: "sc-l5q1h2-1"
45854
- })(["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) {
45857
+ })(["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) {
45855
45858
  var disabled = _ref2.$disabled,
45856
45859
  theme = _ref2.$theme;
45860
+ return disabled ? theme.disabledColor : theme.color;
45861
+ });
45862
+ var Subtitle = styled(Paragraph$1).withConfig({
45863
+ displayName: "LinkCardstyled__Subtitle",
45864
+ componentId: "sc-l5q1h2-2"
45865
+ })(["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) {
45866
+ var disabled = _ref3.$disabled,
45867
+ theme = _ref3.$theme;
45857
45868
  return disabled ? theme.disabledColor : theme.textColor;
45858
45869
  });
45859
45870
  var Footer = styled(Stack).withConfig({
45860
45871
  displayName: "LinkCardstyled__Footer",
45861
- componentId: "sc-l5q1h2-2"
45872
+ componentId: "sc-l5q1h2-3"
45862
45873
  })(["align-items:center;width:100%;"]);
45863
45874
 
45864
45875
  var LinkCard = function LinkCard(_ref) {
@@ -45889,9 +45900,21 @@ var LinkCard = function LinkCard(_ref) {
45889
45900
  isExternalLink = _ref$isExternalLink === void 0 ? false : _ref$isExternalLink;
45890
45901
  var regex = /\W/g;
45891
45902
  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, "-");
45892
- var baseStyles = getCardBaseStyles(themeValues, disabled, extraStyles);
45893
- var hoverActiveStyles = getCardHoverActiveStyles(themeValues, disabled, extraHoverStyles, extraActiveStyles);
45894
- var cardContent = /*#__PURE__*/React__default.createElement(Stack, {
45903
+ return /*#__PURE__*/React__default.createElement(StyledAnchor, {
45904
+ key: "link-card-".concat(locatorSlug),
45905
+ href: disabled ? undefined : href,
45906
+ rel: isExternalLink ? "noopener noreferrer" : undefined,
45907
+ target: isExternalLink ? "_blank" : undefined,
45908
+ tabIndex: disabled ? -1 : 0,
45909
+ "aria-disabled": disabled,
45910
+ $disabled: disabled,
45911
+ "aria-label": "".concat(title, ", ").concat(subtitle),
45912
+ "data-qa": "link-card-".concat(locatorSlug),
45913
+ $theme: themeValues,
45914
+ $extraStyles: disabled ? "pointer-events: none; ".concat(extraStyles) : extraStyles,
45915
+ $hoverStyles: extraHoverStyles,
45916
+ $activeStyles: extraActiveStyles
45917
+ }, /*#__PURE__*/React__default.createElement(Stack, {
45895
45918
  childGap: 0,
45896
45919
  bottomItem: 3,
45897
45920
  justify: "space-between",
@@ -45933,30 +45956,7 @@ var LinkCard = function LinkCard(_ref) {
45933
45956
  justify: "space-between"
45934
45957
  }, showLeft && !!leftContent ? leftContent : /*#__PURE__*/React__default.createElement(Box, {
45935
45958
  extraStyles: "margin-right: auto;"
45936
- }), showRight && !!rightContent && rightContent)));
45937
- if (isExternalLink) {
45938
- return /*#__PURE__*/React__default.createElement(ExternalLink, {
45939
- key: "link-card-".concat(locatorSlug),
45940
- href: disabled ? "" : href,
45941
- newTab: true,
45942
- isUnderlined: false,
45943
- tabIndex: disabled ? "-1" : "0",
45944
- ariaLabel: "".concat(title, ", ").concat(subtitle),
45945
- dataQa: "link-card-".concat(locatorSlug),
45946
- extraStyles: "".concat(baseStyles, " ").concat(hoverActiveStyles)
45947
- }, cardContent);
45948
- }
45949
- return /*#__PURE__*/React__default.createElement(InternalLink, {
45950
- key: "link-card-".concat(locatorSlug),
45951
- to: disabled ? "" : href,
45952
- isUnderlined: false,
45953
- hoverUnderline: false,
45954
- tabIndex: disabled ? "-1" : "0",
45955
- "aria-label": "".concat(title, ", ").concat(subtitle),
45956
- "aria-disabled": disabled,
45957
- "data-qa": "link-card-".concat(locatorSlug),
45958
- extraStyles: "".concat(baseStyles, " ").concat(hoverActiveStyles)
45959
- }, cardContent);
45959
+ }), showRight && !!rightContent && rightContent))));
45960
45960
  };
45961
45961
  var LinkCard$1 = themeComponent(LinkCard, "LinkCard", fallbackValues$L, "primary");
45962
45962
 
@@ -48169,7 +48169,9 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48169
48169
  _ref$modalTitle = _ref.modalTitle,
48170
48170
  modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle,
48171
48171
  _ref$initialFocusSele = _ref.initialFocusSelector,
48172
- initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele;
48172
+ initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele,
48173
+ _ref$isRequired = _ref.isRequired,
48174
+ isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
48173
48175
  var _useState = useState(false),
48174
48176
  _useState2 = _slicedToArray(_useState, 2),
48175
48177
  showTerms = _useState2[0],
@@ -48202,7 +48204,8 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48202
48204
  onChange: onCheck,
48203
48205
  checkboxMargin: checkboxMargin,
48204
48206
  extraStyles: "align-self: flex-start;",
48205
- labelledById: TermsAndConditionsTitleDivId
48207
+ labelledById: TermsAndConditionsTitleDivId,
48208
+ isRequired: isRequired
48206
48209
  }), /*#__PURE__*/React__default.createElement(Stack, {
48207
48210
  childGap: "0.25rem",
48208
48211
  fullHeight: true
@@ -49360,7 +49363,8 @@ var RegistrationForm = function RegistrationForm(_ref) {
49360
49363
  return e.key === "Enter" && handleSubmit(e);
49361
49364
  },
49362
49365
  autocompleteValue: "given-name",
49363
- dataQa: "First name"
49366
+ dataQa: "First name",
49367
+ isRequired: true
49364
49368
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
49365
49369
  labelTextWhenNoError: "Last name",
49366
49370
  errorMessages: lastNameErrorMessages,
@@ -49371,7 +49375,8 @@ var RegistrationForm = function RegistrationForm(_ref) {
49371
49375
  return e.key === "Enter" && handleSubmit(e);
49372
49376
  },
49373
49377
  autocompleteValue: "family-name",
49374
- dataQa: "Last name"
49378
+ dataQa: "Last name",
49379
+ isRequired: true
49375
49380
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
49376
49381
  labelTextWhenNoError: "Email address",
49377
49382
  errorMessages: emailErrorMessages,
@@ -49384,7 +49389,8 @@ var RegistrationForm = function RegistrationForm(_ref) {
49384
49389
  type: "email",
49385
49390
  isEmail: true,
49386
49391
  autocompleteValue: "email",
49387
- dataQa: "Email address"
49392
+ dataQa: "Email address",
49393
+ isRequired: true
49388
49394
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
49389
49395
  labelTextWhenNoError: "Password",
49390
49396
  errorMessages: passwordErrorMessages,
@@ -49396,7 +49402,8 @@ var RegistrationForm = function RegistrationForm(_ref) {
49396
49402
  },
49397
49403
  type: "password",
49398
49404
  autocompleteValue: "new-password",
49399
- dataQa: "Password"
49405
+ dataQa: "Password",
49406
+ isRequired: true
49400
49407
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
49401
49408
  labelTextWhenNoError: "Confirm password",
49402
49409
  errorMessages: confirmPasswordErrorMessages,
@@ -49408,7 +49415,8 @@ var RegistrationForm = function RegistrationForm(_ref) {
49408
49415
  },
49409
49416
  type: "password",
49410
49417
  autocompleteValue: "new-password",
49411
- dataQa: "Confirm password"
49418
+ dataQa: "Confirm password",
49419
+ isRequired: true
49412
49420
  }), /*#__PURE__*/React__default.createElement(Box, {
49413
49421
  padding: isMobile ? "0" : "0.5rem 0 0"
49414
49422
  }, /*#__PURE__*/React__default.createElement(PasswordRequirements, {