@thecb/components 6.1.4 → 6.1.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/dist/index.cjs.js +36 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +36 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/.DS_Store +0 -0
- package/src/components/atoms/form-layouts/FormInput.js +9 -2
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +1 -0
- package/src/components/molecules/payment-form-card/PaymentFormCard.state.js +3 -2
- package/src/components/molecules/periscope-dashboard-iframe/PeriscopeDashboardIframe.js +2 -3
package/dist/index.esm.js
CHANGED
|
@@ -22542,7 +22542,7 @@ var fallbackValues$i = {
|
|
|
22542
22542
|
};
|
|
22543
22543
|
|
|
22544
22544
|
var _excluded$p = ["showErrors", "themeValues"],
|
|
22545
|
-
_excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocomplete", "extraStyles"];
|
|
22545
|
+
_excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocomplete", "extraStyles", "removeFromValue"];
|
|
22546
22546
|
var InputField = styled.input.withConfig({
|
|
22547
22547
|
displayName: "FormInput__InputField",
|
|
22548
22548
|
componentId: "sc-l094r1-0"
|
|
@@ -22626,6 +22626,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22626
22626
|
customHeight = _ref15.customHeight,
|
|
22627
22627
|
autocomplete = _ref15.autocomplete,
|
|
22628
22628
|
extraStyles = _ref15.extraStyles,
|
|
22629
|
+
removeFromValue = _ref15.removeFromValue,
|
|
22629
22630
|
props = _objectWithoutProperties(_ref15, _excluded2);
|
|
22630
22631
|
|
|
22631
22632
|
var _useState = useState(false),
|
|
@@ -22636,6 +22637,14 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22636
22637
|
var _useContext = useContext(ThemeContext),
|
|
22637
22638
|
isMobile = _useContext.isMobile;
|
|
22638
22639
|
|
|
22640
|
+
var setValue = function setValue(value) {
|
|
22641
|
+
if (removeFromValue !== undefined) {
|
|
22642
|
+
return fieldActions.set(value.replace(removeFromValue, ""));
|
|
22643
|
+
}
|
|
22644
|
+
|
|
22645
|
+
return fieldActions.set(value);
|
|
22646
|
+
};
|
|
22647
|
+
|
|
22639
22648
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
22640
22649
|
childGap: "0.25rem"
|
|
22641
22650
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -22689,8 +22698,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22689
22698
|
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
22690
22699
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
22691
22700
|
"aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
|
|
22692
|
-
onChange: function onChange(
|
|
22693
|
-
return
|
|
22701
|
+
onChange: function onChange(value) {
|
|
22702
|
+
return setValue(value);
|
|
22694
22703
|
},
|
|
22695
22704
|
type: type,
|
|
22696
22705
|
value: field.rawValue,
|
|
@@ -22709,7 +22718,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22709
22718
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
22710
22719
|
"aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
|
|
22711
22720
|
onChange: function onChange(e) {
|
|
22712
|
-
return
|
|
22721
|
+
return setValue(e.target.value);
|
|
22713
22722
|
},
|
|
22714
22723
|
type: type === "password" && showPassword ? "text" : type,
|
|
22715
22724
|
value: field.rawValue,
|
|
@@ -34722,6 +34731,24 @@ const ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
|
|
|
34722
34731
|
const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
34723
34732
|
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
34724
34733
|
|
|
34734
|
+
/*
|
|
34735
|
+
07/22: experimental expiration date constraint
|
|
34736
|
+
should allow entry of expiration date using "/" character
|
|
34737
|
+
to accommodate browser autofill
|
|
34738
|
+
|
|
34739
|
+
not tested as validation function
|
|
34740
|
+
to validate exp date instead use combo of:
|
|
34741
|
+
required(), hasLength(), isValidMonth(), dateAfterToday()
|
|
34742
|
+
*/
|
|
34743
|
+
const ONLY_EXPIRATION_DATE = "validator/ONLY_EXPIRATION_DATE";
|
|
34744
|
+
const ONLY_EXPIRATION_DATE_ERROR = "error/ONLY_EXPIRATION_DATE";
|
|
34745
|
+
const onlyExpirationDate = createValidator(
|
|
34746
|
+
ONLY_EXPIRATION_DATE,
|
|
34747
|
+
ONLY_EXPIRATION_DATE_ERROR
|
|
34748
|
+
);
|
|
34749
|
+
validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
|
|
34750
|
+
/^(\d?\d?\/?\d?\d?)?$/.test(value);
|
|
34751
|
+
|
|
34725
34752
|
const NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
|
|
34726
34753
|
const NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
|
|
34727
34754
|
const numberLessThan = createValidator(
|
|
@@ -42239,6 +42266,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
42239
42266
|
return e.key === "Enter" && handleSubmit(e);
|
|
42240
42267
|
},
|
|
42241
42268
|
isNum: true,
|
|
42269
|
+
removeFromValue: /\// // removes "/" from browser autofill
|
|
42270
|
+
,
|
|
42242
42271
|
autocomplete: "cc-exp"
|
|
42243
42272
|
}), /*#__PURE__*/React.createElement(FormInput$1, {
|
|
42244
42273
|
labelTextWhenNoError: "CVV",
|
|
@@ -42291,7 +42320,7 @@ var formConfig$8 = {
|
|
|
42291
42320
|
},
|
|
42292
42321
|
expirationDate: {
|
|
42293
42322
|
validators: [required(), hasLength(4, 4), isValidMonth(0), dateAfterToday("MMYY", "month", true)],
|
|
42294
|
-
constraints: [
|
|
42323
|
+
constraints: [onlyExpirationDate(), hasLength(0, 4)]
|
|
42295
42324
|
},
|
|
42296
42325
|
cvv: {
|
|
42297
42326
|
validators: [required(), hasLength(3, 4)],
|
|
@@ -43335,9 +43364,7 @@ var PeriscopeDashboardIframe = function PeriscopeDashboardIframe(_ref) {
|
|
|
43335
43364
|
periscopeDataSuccess = _ref.periscopeDataSuccess,
|
|
43336
43365
|
periscopeDataFailure = _ref.periscopeDataFailure,
|
|
43337
43366
|
periscopeDataRequestSuccess = _ref.periscopeDataRequestSuccess,
|
|
43338
|
-
periscopeDataRequestFailure = _ref.periscopeDataRequestFailure
|
|
43339
|
-
_ref$timerMS = _ref.timerMS,
|
|
43340
|
-
timerMS = _ref$timerMS === void 0 ? 20000 : _ref$timerMS;
|
|
43367
|
+
periscopeDataRequestFailure = _ref.periscopeDataRequestFailure;
|
|
43341
43368
|
|
|
43342
43369
|
var _useState = useState(0),
|
|
43343
43370
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -43352,7 +43379,7 @@ var PeriscopeDashboardIframe = function PeriscopeDashboardIframe(_ref) {
|
|
|
43352
43379
|
if (!periscopeDataSuccess) {
|
|
43353
43380
|
periscopeDataRequestFailure();
|
|
43354
43381
|
}
|
|
43355
|
-
},
|
|
43382
|
+
}, 10000);
|
|
43356
43383
|
return function () {
|
|
43357
43384
|
return clearTimeout(time.timer);
|
|
43358
43385
|
};
|