@evervault/react-native 2.2.1 → 2.4.0
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/build/Card/Cvc.d.ts +9 -2
- package/build/Card/Cvc.d.ts.map +1 -1
- package/build/Card/Number.d.ts +9 -2
- package/build/Card/Number.d.ts.map +1 -1
- package/build/Card/index.d.ts +2 -2
- package/build/Card/types.d.ts +1 -1
- package/build/Card/types.d.ts.map +1 -1
- package/build/Input.d.ts +1 -0
- package/build/Input.d.ts.map +1 -1
- package/build/index.cjs.js +98 -92
- package/build/index.cjs.js.map +1 -1
- package/build/index.esm.js +98 -92
- package/package.json +2 -2
- package/src/Card/Cvc.tsx +10 -3
- package/src/Card/Number.test.tsx +24 -3
- package/src/Card/Number.tsx +11 -4
- package/src/Card/types.ts +1 -0
- package/src/Input.test.tsx +84 -0
- package/src/Input.tsx +73 -47
package/build/Card/Cvc.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { BaseEvervaultInputProps, EvervaultInput } from "../Input";
|
|
2
|
-
export
|
|
2
|
+
export interface CardCvcProps extends BaseEvervaultInputProps {
|
|
3
|
+
/**
|
|
4
|
+
* Whether to obfuscate the entire CVC value.
|
|
5
|
+
*
|
|
6
|
+
* If a string is provided, it will be used to obfuscate the value.
|
|
7
|
+
*/
|
|
8
|
+
obfuscateValue?: boolean | string;
|
|
9
|
+
}
|
|
3
10
|
export type CardCvc = EvervaultInput;
|
|
4
|
-
export declare const CardCvc: import("react").ForwardRefExoticComponent<
|
|
11
|
+
export declare const CardCvc: import("react").ForwardRefExoticComponent<CardCvcProps & import("react").RefAttributes<EvervaultInput>>;
|
|
5
12
|
//# sourceMappingURL=Cvc.d.ts.map
|
package/build/Card/Cvc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cvc.d.ts","sourceRoot":"","sources":["../../src/Card/Cvc.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAQ,MAAM,UAAU,CAAC;AAazE,MAAM,
|
|
1
|
+
{"version":3,"file":"Cvc.d.ts","sourceRoot":"","sources":["../../src/Card/Cvc.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAQ,MAAM,UAAU,CAAC;AAazE,MAAM,WAAW,YAAa,SAAQ,uBAAuB;IAC3D;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACnC;AAED,MAAM,MAAM,OAAO,GAAG,cAAc,CAAC;AAErC,eAAO,MAAM,OAAO,yGAgClB,CAAC"}
|
package/build/Card/Number.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { BaseEvervaultInputProps, EvervaultInput } from "../Input";
|
|
2
|
-
export
|
|
2
|
+
export interface CardNumberProps extends BaseEvervaultInputProps {
|
|
3
|
+
/**
|
|
4
|
+
* Whether to obfuscate the card number value (excluding the last 4 digits).
|
|
5
|
+
*
|
|
6
|
+
* If a string is provided, it will be used to obfuscate the value.
|
|
7
|
+
*/
|
|
8
|
+
obfuscateValue?: boolean | string;
|
|
9
|
+
}
|
|
3
10
|
export type CardNumber = EvervaultInput;
|
|
4
|
-
export declare const CardNumber: import("react").ForwardRefExoticComponent<
|
|
11
|
+
export declare const CardNumber: import("react").ForwardRefExoticComponent<CardNumberProps & import("react").RefAttributes<EvervaultInput>>;
|
|
5
12
|
//# sourceMappingURL=Number.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Number.d.ts","sourceRoot":"","sources":["../../src/Card/Number.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAQ,MAAM,UAAU,CAAC;AAazE,MAAM,
|
|
1
|
+
{"version":3,"file":"Number.d.ts","sourceRoot":"","sources":["../../src/Card/Number.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAQ,MAAM,UAAU,CAAC;AAazE,MAAM,WAAW,eAAgB,SAAQ,uBAAuB;IAC9D;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACnC;AAED,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC;AAExC,eAAO,MAAM,UAAU,4GA4BtB,CAAC"}
|
package/build/Card/index.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export type Card = CardRef;
|
|
|
8
8
|
export declare const Card: import("react").ForwardRefExoticComponent<import("./Root").CardProps & import("react").RefAttributes<CardRoot>> & {
|
|
9
9
|
Holder: import("react").ForwardRefExoticComponent<import("..").EvervaultInputProps & import("react").RefAttributes<import("..").EvervaultInput>>;
|
|
10
10
|
Expiry: import("react").ForwardRefExoticComponent<import("..").EvervaultInputProps & import("react").RefAttributes<import("..").EvervaultInput>>;
|
|
11
|
-
Cvc: import("react").ForwardRefExoticComponent<import("
|
|
12
|
-
Number: import("react").ForwardRefExoticComponent<import("
|
|
11
|
+
Cvc: import("react").ForwardRefExoticComponent<import("./Cvc").CardCvcProps & import("react").RefAttributes<import("..").EvervaultInput>>;
|
|
12
|
+
Number: import("react").ForwardRefExoticComponent<import("./Number").CardNumberProps & import("react").RefAttributes<import("..").EvervaultInput>>;
|
|
13
13
|
};
|
|
14
14
|
export type { CardHolderProps } from "./Holder";
|
|
15
15
|
export { CardHolder };
|
package/build/Card/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const CARD_BRAND_NAMES: readonly ["american-express", "visa", "mastercard", "discover", "jcb", "diners-club", "unionpay", "maestro", "mir", "elo", "hipercard", "hiper", "szep", "uatp"];
|
|
1
|
+
export declare const CARD_BRAND_NAMES: readonly ["american-express", "visa", "mastercard", "discover", "jcb", "diners-club", "unionpay", "maestro", "mir", "elo", "hipercard", "hiper", "szep", "uatp", "rupay"];
|
|
2
2
|
export type CardBrandName = (typeof CARD_BRAND_NAMES)[number];
|
|
3
3
|
export interface CardConfig {
|
|
4
4
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Card/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Card/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,2KAgBnB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;QAC5B,WAAW,EAAE,aAAa,EAAE,CAAC;QAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QACnB,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;QAC1B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;KACpB,CAAC;IACF,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACH"}
|
package/build/Input.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare function mask(format: string): MaskArray;
|
|
|
11
11
|
export interface EvervaultInputProps<Values extends Record<string, unknown>> extends BaseEvervaultInputProps {
|
|
12
12
|
name: keyof Values;
|
|
13
13
|
mask?: Mask;
|
|
14
|
+
obfuscateValue?: boolean | string;
|
|
14
15
|
}
|
|
15
16
|
export declare const EvervaultInput: <Values extends Record<string, unknown>>(props: EvervaultInputProps<Values> & {
|
|
16
17
|
ref?: Ref<EvervaultInput>;
|
package/build/Input.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../src/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EACT,GAAG,
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../src/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EACT,GAAG,EAQJ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGzD,OAAkB,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,WAAW,0BAA0B;IACzC,cAAc,EAAE,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;CAC7D;AAED,eAAO,MAAM,qBAAqB,qDAEhC,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,SAAS,EACP,WAAW,GACX,OAAO,GACP,MAAM,GACN,OAAO,GACP,SAAS,GACT,iBAAiB,GACjB,eAAe,CAClB,CAAC;AA4CF,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,cAAc,EACd,UAAU,GAAG,cAAc,GAAG,OAAO,GAAG,cAAc,CACvD,CAAC;AAEF,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAqB9C;AAED,MAAM,WAAW,mBAAmB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CACzE,SAAQ,uBAAuB;IAC/B,IAAI,EAAE,MAAM,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACnC;AAED,eAAO,MAAM,cAAc,EAgErB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3C,KAAK,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAA;CAAE,KAC/D,SAAS,CAAC"}
|
package/build/index.cjs.js
CHANGED
|
@@ -608,50 +608,6 @@ function useController(props) {
|
|
|
608
608
|
}), [field, formState, fieldState]);
|
|
609
609
|
}
|
|
610
610
|
|
|
611
|
-
/**
|
|
612
|
-
* Component based on `useController` hook to work with controlled component.
|
|
613
|
-
*
|
|
614
|
-
* @remarks
|
|
615
|
-
* [API](https://react-hook-form.com/docs/usecontroller/controller) • [Demo](https://codesandbox.io/s/react-hook-form-v6-controller-ts-jwyzw) • [Video](https://www.youtube.com/watch?v=N2UNk_UCVyA)
|
|
616
|
-
*
|
|
617
|
-
* @param props - the path name to the form field value, and validation rules.
|
|
618
|
-
*
|
|
619
|
-
* @returns provide field handler functions, field and form state.
|
|
620
|
-
*
|
|
621
|
-
* @example
|
|
622
|
-
* ```tsx
|
|
623
|
-
* function App() {
|
|
624
|
-
* const { control } = useForm<FormValues>({
|
|
625
|
-
* defaultValues: {
|
|
626
|
-
* test: ""
|
|
627
|
-
* }
|
|
628
|
-
* });
|
|
629
|
-
*
|
|
630
|
-
* return (
|
|
631
|
-
* <form>
|
|
632
|
-
* <Controller
|
|
633
|
-
* control={control}
|
|
634
|
-
* name="test"
|
|
635
|
-
* render={({ field: { onChange, onBlur, value, ref }, formState, fieldState }) => (
|
|
636
|
-
* <>
|
|
637
|
-
* <input
|
|
638
|
-
* onChange={onChange} // send value to hook form
|
|
639
|
-
* onBlur={onBlur} // notify when input is touched
|
|
640
|
-
* value={value} // return updated value
|
|
641
|
-
* ref={ref} // set ref for focus management
|
|
642
|
-
* />
|
|
643
|
-
* <p>{formState.isSubmitted ? "submitted" : ""}</p>
|
|
644
|
-
* <p>{fieldState.isTouched ? "touched" : ""}</p>
|
|
645
|
-
* </>
|
|
646
|
-
* )}
|
|
647
|
-
* />
|
|
648
|
-
* </form>
|
|
649
|
-
* );
|
|
650
|
-
* }
|
|
651
|
-
* ```
|
|
652
|
-
*/
|
|
653
|
-
const Controller = (props) => props.render(useController(props));
|
|
654
|
-
|
|
655
611
|
var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria
|
|
656
612
|
? {
|
|
657
613
|
...errors[name],
|
|
@@ -6794,7 +6750,7 @@ const h = [
|
|
|
6794
6750
|
isLocal: false,
|
|
6795
6751
|
numberValidationRules: {
|
|
6796
6752
|
luhnCheck: true,
|
|
6797
|
-
ranges: [[300, 305], 36, 38, 39],
|
|
6753
|
+
ranges: [[300, 305], 3095, 36, 38, 39],
|
|
6798
6754
|
lengths: [14, 16, 19]
|
|
6799
6755
|
},
|
|
6800
6756
|
securityCodeValidationRules: {
|
|
@@ -6806,7 +6762,7 @@ const h = [
|
|
|
6806
6762
|
isLocal: false,
|
|
6807
6763
|
numberValidationRules: {
|
|
6808
6764
|
luhnCheck: true,
|
|
6809
|
-
ranges: [6011, [644, 649],
|
|
6765
|
+
ranges: [6011, [644, 649], [65e4, 651999], [653150, 659999], 622],
|
|
6810
6766
|
lengths: [16, 19]
|
|
6811
6767
|
},
|
|
6812
6768
|
securityCodeValidationRules: {
|
|
@@ -6818,7 +6774,16 @@ const h = [
|
|
|
6818
6774
|
isLocal: false,
|
|
6819
6775
|
numberValidationRules: {
|
|
6820
6776
|
luhnCheck: true,
|
|
6821
|
-
ranges: [
|
|
6777
|
+
ranges: [
|
|
6778
|
+
2131,
|
|
6779
|
+
1800,
|
|
6780
|
+
[3088, 3094],
|
|
6781
|
+
[3096, 3102],
|
|
6782
|
+
[3112, 3120],
|
|
6783
|
+
[3158, 3159],
|
|
6784
|
+
[3337, 3349],
|
|
6785
|
+
[3528, 3589]
|
|
6786
|
+
],
|
|
6822
6787
|
lengths: [16, 17, 18, 19]
|
|
6823
6788
|
},
|
|
6824
6789
|
securityCodeValidationRules: {
|
|
@@ -6866,16 +6831,20 @@ const h = [
|
|
|
6866
6831
|
numberValidationRules: {
|
|
6867
6832
|
luhnCheck: true,
|
|
6868
6833
|
ranges: [
|
|
6834
|
+
5018,
|
|
6835
|
+
5020,
|
|
6836
|
+
5038,
|
|
6837
|
+
5893,
|
|
6838
|
+
6101,
|
|
6839
|
+
6304,
|
|
6840
|
+
6759,
|
|
6841
|
+
6761,
|
|
6842
|
+
6762,
|
|
6843
|
+
6763,
|
|
6869
6844
|
493698,
|
|
6870
6845
|
[5e5, 504174],
|
|
6871
6846
|
[504176, 506698],
|
|
6872
6847
|
[506779, 508999],
|
|
6873
|
-
[56, 59],
|
|
6874
|
-
60,
|
|
6875
|
-
61,
|
|
6876
|
-
63,
|
|
6877
|
-
64,
|
|
6878
|
-
67,
|
|
6879
6848
|
69
|
|
6880
6849
|
],
|
|
6881
6850
|
lengths: [12, 13, 14, 15, 16, 17, 18, 19]
|
|
@@ -6981,6 +6950,18 @@ const h = [
|
|
|
6981
6950
|
securityCodeValidationRules: {
|
|
6982
6951
|
lengths: [0]
|
|
6983
6952
|
}
|
|
6953
|
+
},
|
|
6954
|
+
{
|
|
6955
|
+
name: "rupay",
|
|
6956
|
+
isLocal: false,
|
|
6957
|
+
numberValidationRules: {
|
|
6958
|
+
luhnCheck: true,
|
|
6959
|
+
ranges: [60, 81, 82, 508, [652100, 653149], [817200, 819899]],
|
|
6960
|
+
lengths: [16]
|
|
6961
|
+
},
|
|
6962
|
+
securityCodeValidationRules: {
|
|
6963
|
+
lengths: [3]
|
|
6964
|
+
}
|
|
6984
6965
|
}
|
|
6985
6966
|
];
|
|
6986
6967
|
function g(n, e, t) {
|
|
@@ -7047,7 +7028,7 @@ function C(n, e) {
|
|
|
7047
7028
|
isValid: l
|
|
7048
7029
|
};
|
|
7049
7030
|
}
|
|
7050
|
-
function
|
|
7031
|
+
function R(n) {
|
|
7051
7032
|
var r;
|
|
7052
7033
|
const e = /^(0[1-9]|1[[0-2]).*$/, t = n.match(e), s = t ? parseInt(t[1].toString(), 10) : null, l = /^(0[1-9]|1[[0-2])(\d{2})$/, i = n.match(l), a = i ? parseInt(i[2].toString(), 10) : null;
|
|
7053
7034
|
if (s) {
|
|
@@ -7113,7 +7094,7 @@ function areValuesComplete(values) {
|
|
|
7113
7094
|
if ("number" in values && !f(values.number ?? "").isValid) {
|
|
7114
7095
|
return false;
|
|
7115
7096
|
}
|
|
7116
|
-
if ("expiry" in values && !
|
|
7097
|
+
if ("expiry" in values && !R(values.expiry ?? "").isValid) {
|
|
7117
7098
|
return false;
|
|
7118
7099
|
}
|
|
7119
7100
|
if ("cvc" in values &&
|
|
@@ -7134,7 +7115,7 @@ function isAcceptedBrand(acceptedBrands, cardNumberValidationResult) {
|
|
|
7134
7115
|
return isBrandAccepted || isLocalBrandAccepted;
|
|
7135
7116
|
}
|
|
7136
7117
|
function formatExpiry(expiry) {
|
|
7137
|
-
const parsedExpiry =
|
|
7118
|
+
const parsedExpiry = R(expiry);
|
|
7138
7119
|
if (!parsedExpiry.isValid) {
|
|
7139
7120
|
return null;
|
|
7140
7121
|
}
|
|
@@ -7157,7 +7138,7 @@ function getCardFormSchema(acceptedBrands) {
|
|
|
7157
7138
|
expiry: z
|
|
7158
7139
|
.string()
|
|
7159
7140
|
.min(1, "Required")
|
|
7160
|
-
.refine((value) =>
|
|
7141
|
+
.refine((value) => R(value).isValid, {
|
|
7161
7142
|
message: "Invalid expiry",
|
|
7162
7143
|
}),
|
|
7163
7144
|
cvc: z
|
|
@@ -7403,44 +7384,69 @@ function useForwardedInputRef(ref) {
|
|
|
7403
7384
|
return inputRef;
|
|
7404
7385
|
}
|
|
7405
7386
|
function mask(format) {
|
|
7406
|
-
|
|
7387
|
+
const maskArray = [];
|
|
7388
|
+
let isObfuscated = false;
|
|
7389
|
+
format.split("").forEach((char) => {
|
|
7390
|
+
if (char === "[") {
|
|
7391
|
+
isObfuscated = true;
|
|
7392
|
+
return;
|
|
7393
|
+
}
|
|
7394
|
+
else if (char === "]") {
|
|
7395
|
+
isObfuscated = false;
|
|
7396
|
+
return;
|
|
7397
|
+
}
|
|
7398
|
+
let value = char;
|
|
7407
7399
|
if (char === "9") {
|
|
7408
|
-
|
|
7400
|
+
value = isObfuscated ? [/\d/] : /\d/;
|
|
7409
7401
|
}
|
|
7410
|
-
|
|
7402
|
+
maskArray.push(value);
|
|
7411
7403
|
});
|
|
7404
|
+
return maskArray;
|
|
7412
7405
|
}
|
|
7413
|
-
const EvervaultInput = React.forwardRef(function EvervaultInput({ name, mask, ...props }, ref) {
|
|
7406
|
+
const EvervaultInput = React.forwardRef(function EvervaultInput({ name, mask, obfuscateValue, ...props }, ref) {
|
|
7414
7407
|
const { validationMode } = React.useContext(EvervaultInputContext);
|
|
7415
7408
|
const inputRef = useForwardedInputRef(ref);
|
|
7416
7409
|
const methods = useFormContext();
|
|
7417
|
-
|
|
7410
|
+
const { field, fieldState } = useController({
|
|
7411
|
+
control: methods.control,
|
|
7412
|
+
name,
|
|
7413
|
+
shouldUnregister: true,
|
|
7414
|
+
});
|
|
7415
|
+
const obfuscationCharacter = React.useMemo(() => {
|
|
7416
|
+
if (typeof obfuscateValue === "string") {
|
|
7417
|
+
return obfuscateValue;
|
|
7418
|
+
}
|
|
7419
|
+
else {
|
|
7420
|
+
return "•";
|
|
7421
|
+
}
|
|
7422
|
+
}, [obfuscateValue]);
|
|
7423
|
+
return (jsxRuntime.jsx(MaskInput
|
|
7424
|
+
// Overridable props
|
|
7425
|
+
, {
|
|
7418
7426
|
// Overridable props
|
|
7419
|
-
,
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
// Remove unwanted props
|
|
7443
|
-
defaultValue: undefined, onChange: undefined })) }));
|
|
7427
|
+
id: field.name, ...props,
|
|
7428
|
+
// Strict props
|
|
7429
|
+
ref: mergeRefs(inputRef, field.ref), editable: !field.disabled && (props.editable ?? true), onBlur: (evt) => {
|
|
7430
|
+
const shouldValidate = validationMode === "onBlur" ||
|
|
7431
|
+
validationMode === "onTouched" ||
|
|
7432
|
+
validationMode === "all";
|
|
7433
|
+
methods.setValue(field.name, field.value, {
|
|
7434
|
+
shouldDirty: true,
|
|
7435
|
+
shouldTouch: true,
|
|
7436
|
+
shouldValidate,
|
|
7437
|
+
});
|
|
7438
|
+
props.onBlur?.(evt);
|
|
7439
|
+
}, mask: mask, maskAutoComplete: !!mask, obfuscationCharacter: obfuscationCharacter, showObfuscatedValue: !!obfuscateValue, value: field.value, onChangeText: (masked, unmasked) => {
|
|
7440
|
+
const shouldValidate = (validationMode === "onTouched" && fieldState.isTouched) ||
|
|
7441
|
+
((validationMode === "onChange" || validationMode === "all") &&
|
|
7442
|
+
(!!fieldState.error || fieldState.isTouched));
|
|
7443
|
+
methods.setValue(field.name, unmasked, {
|
|
7444
|
+
shouldDirty: true,
|
|
7445
|
+
shouldValidate,
|
|
7446
|
+
});
|
|
7447
|
+
},
|
|
7448
|
+
// Remove unwanted props
|
|
7449
|
+
defaultValue: undefined, onChange: undefined }));
|
|
7444
7450
|
});
|
|
7445
7451
|
|
|
7446
7452
|
const DEFAULT_ACCEPTED_BRANDS = [];
|
|
@@ -7513,9 +7519,9 @@ const CardExpiry = React.forwardRef(function CardExpiry(props, ref) {
|
|
|
7513
7519
|
return (jsxRuntime.jsx(EvervaultInput, { placeholder: "MM / YY", ...props, ref: ref, name: "expiry", mask: CARD_EXPIRY_MASK, inputMode: "numeric", autoComplete: "cc-exp", keyboardType: "number-pad" }));
|
|
7514
7520
|
});
|
|
7515
7521
|
|
|
7516
|
-
const DEFAULT_CARD_CVC_MASK = mask("999");
|
|
7522
|
+
const DEFAULT_CARD_CVC_MASK = mask("[999]");
|
|
7517
7523
|
const CARD_CVC_MASKS = {
|
|
7518
|
-
"american-express": mask("9999"),
|
|
7524
|
+
"american-express": mask("[9999]"),
|
|
7519
7525
|
};
|
|
7520
7526
|
const CardCvc = React.forwardRef(function CardCvc(props, ref) {
|
|
7521
7527
|
const methods = useFormContext();
|
|
@@ -7533,10 +7539,10 @@ const CardCvc = React.forwardRef(function CardCvc(props, ref) {
|
|
|
7533
7539
|
return (jsxRuntime.jsx(EvervaultInput, { placeholder: "CVC", ...props, ref: ref, name: "cvc", mask: mask, inputMode: "numeric", autoComplete: "cc-csc", keyboardType: "number-pad" }));
|
|
7534
7540
|
});
|
|
7535
7541
|
|
|
7536
|
-
const DEFAULT_CARD_NUMBER_MASK = mask("9999
|
|
7542
|
+
const DEFAULT_CARD_NUMBER_MASK = mask("9999 99[99 9999 9999]");
|
|
7537
7543
|
const CARD_NUMBER_MASKS = {
|
|
7538
|
-
unionpay: mask("9999
|
|
7539
|
-
"american-express": mask("9999
|
|
7544
|
+
unionpay: mask("9999 99[99 9999 9999 999]"),
|
|
7545
|
+
"american-express": mask("9999 99[9999 99999]"),
|
|
7540
7546
|
};
|
|
7541
7547
|
const CardNumber = React.forwardRef(function CardNumber(props, ref) {
|
|
7542
7548
|
const mask = React.useCallback((text) => {
|