@thecb/components 6.1.4 → 6.2.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
@@ -14406,6 +14406,42 @@ var ErroredIcon = function ErroredIcon() {
14406
14406
  }))));
14407
14407
  };
14408
14408
 
14409
+ var ExternalLinkIcon = function ExternalLinkIcon(_ref) {
14410
+ var linkColor = _ref.linkColor,
14411
+ text = _ref.text;
14412
+ return /*#__PURE__*/React__default.createElement("svg", {
14413
+ width: "14",
14414
+ height: "14",
14415
+ viewBox: "0 0 14 14",
14416
+ fill: "none",
14417
+ xmlns: "http://www.w3.org/2000/svg"
14418
+ }, /*#__PURE__*/React__default.createElement("path", {
14419
+ fillRule: "evenodd",
14420
+ clipRule: "evenodd",
14421
+ d: "M1.86092 1.59483C1.92074 1.56953 1.98651 1.55554 2.05554 1.55554H2.6111H4.94443C5.22057 1.55554 5.44443 1.7794 5.44443 2.05554V2.6111C5.44443 2.88724 5.22057 3.1111 4.94443 3.1111H3.1111V10.8889H10.8889V9.05554C10.8889 8.7794 11.1127 8.55554 11.3889 8.55554H11.9444C12.2206 8.55554 12.4444 8.7794 12.4444 9.05554V11.9444C12.4444 12.2206 12.2206 12.4444 11.9444 12.4444H11.3889C11.3507 12.4444 11.3135 12.4401 11.2778 12.432C11.242 12.4401 11.2048 12.4444 11.1667 12.4444H2.6111H2.05554C1.7794 12.4444 1.55554 12.2206 1.55554 11.9444V11.3889V2.6111V2.05554C1.55554 2.05554 1.55554 2.05554 1.55554 2.05554C1.55554 2.01307 1.56084 1.97183 1.57081 1.93246C1.60944 1.77983 1.71826 1.65517 1.86092 1.59483ZM7.77776 2.05554C7.77776 1.7794 8.00162 1.55554 8.27776 1.55554H11.3889H11.9444C12.2206 1.55554 12.4444 1.7794 12.4444 2.05554V2.6111V5.72221C12.4444 5.99835 12.2206 6.22221 11.9444 6.22221H11.3889C11.1127 6.22221 10.8889 5.99835 10.8889 5.72221V4.26638L6.89793 8.25733C6.70267 8.45259 6.38608 8.45259 6.19082 8.25733L5.79798 7.8645C5.60272 7.66923 5.60272 7.35265 5.79798 7.15739L9.84428 3.1111H8.27776C8.00162 3.1111 7.77776 2.88724 7.77776 2.6111V2.05554Z",
14422
+ fill: "#292A33"
14423
+ }), /*#__PURE__*/React__default.createElement("mask", {
14424
+ id: "mask0_902_435-".concat(text),
14425
+ maskUnits: "userSpaceOnUse",
14426
+ x: "1",
14427
+ y: "1",
14428
+ width: "12",
14429
+ height: "12"
14430
+ }, /*#__PURE__*/React__default.createElement("path", {
14431
+ fillRule: "evenodd",
14432
+ clipRule: "evenodd",
14433
+ d: "M1.86092 1.59483C1.92074 1.56953 1.98651 1.55554 2.05554 1.55554H2.6111H4.94443C5.22057 1.55554 5.44443 1.7794 5.44443 2.05554V2.6111C5.44443 2.88724 5.22057 3.1111 4.94443 3.1111H3.1111V10.8889H10.8889V9.05554C10.8889 8.7794 11.1127 8.55554 11.3889 8.55554H11.9444C12.2206 8.55554 12.4444 8.7794 12.4444 9.05554V11.9444C12.4444 12.2206 12.2206 12.4444 11.9444 12.4444H11.3889C11.3507 12.4444 11.3135 12.4401 11.2778 12.432C11.242 12.4401 11.2048 12.4444 11.1667 12.4444H2.6111H2.05554C1.7794 12.4444 1.55554 12.2206 1.55554 11.9444V11.3889V2.6111V2.05554C1.55554 2.05554 1.55554 2.05554 1.55554 2.05554C1.55554 2.01307 1.56084 1.97183 1.57081 1.93246C1.60944 1.77983 1.71826 1.65517 1.86092 1.59483ZM7.77776 2.05554C7.77776 1.7794 8.00162 1.55554 8.27776 1.55554H11.3889H11.9444C12.2206 1.55554 12.4444 1.7794 12.4444 2.05554V2.6111V5.72221C12.4444 5.99835 12.2206 6.22221 11.9444 6.22221H11.3889C11.1127 6.22221 10.8889 5.99835 10.8889 5.72221V4.26638L6.89793 8.25733C6.70267 8.45259 6.38608 8.45259 6.19082 8.25733L5.79798 7.8645C5.60272 7.66923 5.60272 7.35265 5.79798 7.15739L9.84428 3.1111H8.27776C8.00162 3.1111 7.77776 2.88724 7.77776 2.6111V2.05554Z",
14434
+ fill: linkColor
14435
+ })), /*#__PURE__*/React__default.createElement("g", {
14436
+ mask: "url(#mask0_902_435-".concat(text, ")")
14437
+ }, /*#__PURE__*/React__default.createElement("rect", {
14438
+ x: "-0.0864258",
14439
+ width: "14",
14440
+ height: "14",
14441
+ fill: "#292A33"
14442
+ })));
14443
+ };
14444
+
14409
14445
  var FailedIcon = function FailedIcon() {
14410
14446
  return /*#__PURE__*/React__default.createElement("svg", {
14411
14447
  width: "32px",
@@ -22550,7 +22586,7 @@ var fallbackValues$i = {
22550
22586
  };
22551
22587
 
22552
22588
  var _excluded$p = ["showErrors", "themeValues"],
22553
- _excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocomplete", "extraStyles"];
22589
+ _excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocomplete", "extraStyles", "removeFromValue"];
22554
22590
  var InputField = styled__default.input.withConfig({
22555
22591
  displayName: "FormInput__InputField",
22556
22592
  componentId: "sc-l094r1-0"
@@ -22634,6 +22670,7 @@ var FormInput = function FormInput(_ref15) {
22634
22670
  customHeight = _ref15.customHeight,
22635
22671
  autocomplete = _ref15.autocomplete,
22636
22672
  extraStyles = _ref15.extraStyles,
22673
+ removeFromValue = _ref15.removeFromValue,
22637
22674
  props = _objectWithoutProperties(_ref15, _excluded2);
22638
22675
 
22639
22676
  var _useState = React.useState(false),
@@ -22644,6 +22681,14 @@ var FormInput = function FormInput(_ref15) {
22644
22681
  var _useContext = React.useContext(styled.ThemeContext),
22645
22682
  isMobile = _useContext.isMobile;
22646
22683
 
22684
+ var setValue = function setValue(value) {
22685
+ if (removeFromValue !== undefined) {
22686
+ return fieldActions.set(value.replace(removeFromValue, ""));
22687
+ }
22688
+
22689
+ return fieldActions.set(value);
22690
+ };
22691
+
22647
22692
  return /*#__PURE__*/React__default.createElement(Stack, {
22648
22693
  childGap: "0.25rem"
22649
22694
  }, /*#__PURE__*/React__default.createElement(Box, {
@@ -22697,8 +22742,8 @@ var FormInput = function FormInput(_ref15) {
22697
22742
  "aria-labelledby": createIdFromString(labelTextWhenNoError),
22698
22743
  "aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
22699
22744
  "aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
22700
- onChange: function onChange(e) {
22701
- return fieldActions.set(e);
22745
+ onChange: function onChange(value) {
22746
+ return setValue(value);
22702
22747
  },
22703
22748
  type: type,
22704
22749
  value: field.rawValue,
@@ -22717,7 +22762,7 @@ var FormInput = function FormInput(_ref15) {
22717
22762
  "aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
22718
22763
  "aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
22719
22764
  onChange: function onChange(e) {
22720
- return fieldActions.set(e.target.value);
22765
+ return setValue(e.target.value);
22721
22766
  },
22722
22767
  type: type === "password" && showPassword ? "text" : type,
22723
22768
  value: field.rawValue,
@@ -34730,6 +34775,24 @@ const ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
34730
34775
  const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
34731
34776
  validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
34732
34777
 
34778
+ /*
34779
+ 07/22: experimental expiration date constraint
34780
+ should allow entry of expiration date using "/" character
34781
+ to accommodate browser autofill
34782
+
34783
+ not tested as validation function
34784
+ to validate exp date instead use combo of:
34785
+ required(), hasLength(), isValidMonth(), dateAfterToday()
34786
+ */
34787
+ const ONLY_EXPIRATION_DATE = "validator/ONLY_EXPIRATION_DATE";
34788
+ const ONLY_EXPIRATION_DATE_ERROR = "error/ONLY_EXPIRATION_DATE";
34789
+ const onlyExpirationDate = createValidator(
34790
+ ONLY_EXPIRATION_DATE,
34791
+ ONLY_EXPIRATION_DATE_ERROR
34792
+ );
34793
+ validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
34794
+ /^(\d?\d?\/?\d?\d?)?$/.test(value);
34795
+
34733
34796
  const NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
34734
34797
  const NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
34735
34798
  const numberLessThan = createValidator(
@@ -42247,6 +42310,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
42247
42310
  return e.key === "Enter" && handleSubmit(e);
42248
42311
  },
42249
42312
  isNum: true,
42313
+ removeFromValue: /\// // removes "/" from browser autofill
42314
+ ,
42250
42315
  autocomplete: "cc-exp"
42251
42316
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
42252
42317
  labelTextWhenNoError: "CVV",
@@ -42299,7 +42364,7 @@ var formConfig$8 = {
42299
42364
  },
42300
42365
  expirationDate: {
42301
42366
  validators: [required(), hasLength(4, 4), isValidMonth(0), dateAfterToday("MMYY", "month", true)],
42302
- constraints: [onlyIntegers(), hasLength(0, 4)]
42367
+ constraints: [onlyExpirationDate(), hasLength(0, 4)]
42303
42368
  },
42304
42369
  cvv: {
42305
42370
  validators: [required(), hasLength(3, 4)],
@@ -43776,6 +43841,7 @@ exports.EmailForm = EmailForm;
43776
43841
  exports.EmptyCartIcon = EmptyCartIcon$1;
43777
43842
  exports.ErroredIcon = ErroredIcon;
43778
43843
  exports.ExternalLink = ExternalLink;
43844
+ exports.ExternalLinkIcon = ExternalLinkIcon;
43779
43845
  exports.FailedIcon = FailedIcon;
43780
43846
  exports.ForgotPasswordForm = ForgotPasswordForm;
43781
43847
  exports.ForgotPasswordIcon = ForgotPasswordIcon$1;