@loja-integrada/admin-components 0.16.1 → 0.16.2
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/Forms/InputMask/InputMask.stories.d.ts +7 -0
- package/dist/Forms/InputMask/utils.d.ts +40 -0
- package/dist/admin-components.cjs.development.js +57 -2
- package/dist/admin-components.cjs.development.js.map +1 -1
- package/dist/admin-components.cjs.production.min.js +1 -1
- package/dist/admin-components.cjs.production.min.js.map +1 -1
- package/dist/admin-components.esm.js +57 -2
- package/dist/admin-components.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/Forms/InputMask/InputMask.spec.tsx +71 -6
- package/src/Forms/InputMask/InputMask.stories.tsx +63 -0
- package/src/Forms/InputMask/InputMask.tsx +1 -1
- package/src/Forms/InputMask/utils.ts +119 -1
|
@@ -5,6 +5,13 @@ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("
|
|
|
5
5
|
export declare const Date: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputMaskProps>;
|
|
6
6
|
export declare const OnlyNumbers: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputMaskProps>;
|
|
7
7
|
export declare const OnlyText: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputMaskProps>;
|
|
8
|
+
export declare const ZipCode: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputMaskProps>;
|
|
9
|
+
export declare const Nfe: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputMaskProps>;
|
|
10
|
+
export declare const Phone: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputMaskProps>;
|
|
11
|
+
export declare const Cellphone: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputMaskProps>;
|
|
12
|
+
export declare const PhoneOrCellphone: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputMaskProps>;
|
|
13
|
+
export declare const CPF: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputMaskProps>;
|
|
14
|
+
export declare const CNPJ: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputMaskProps>;
|
|
8
15
|
export declare const DateWithStartAdornment: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputMaskProps>;
|
|
9
16
|
export declare const DateWithEndAdornment: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputMaskProps>;
|
|
10
17
|
export declare const DateWithEndAdornmentError: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, InputMaskProps>;
|
|
@@ -21,5 +21,45 @@ export declare const formatValuePatterns: {
|
|
|
21
21
|
};
|
|
22
22
|
keepCharPositions: boolean;
|
|
23
23
|
inputMode: string;
|
|
24
|
+
placeholder: string;
|
|
25
|
+
};
|
|
26
|
+
zipCode: {
|
|
27
|
+
mask: (string | RegExp)[];
|
|
28
|
+
keepCharPositions: boolean;
|
|
29
|
+
inputMode: string;
|
|
30
|
+
placeholder: string;
|
|
31
|
+
};
|
|
32
|
+
nfe: {
|
|
33
|
+
mask: () => (string | RegExp)[];
|
|
34
|
+
keepCharPositions: boolean;
|
|
35
|
+
inputMode: string;
|
|
36
|
+
placeholder: string;
|
|
37
|
+
};
|
|
38
|
+
phone: {
|
|
39
|
+
mask: (string | RegExp)[];
|
|
40
|
+
inputMode: string;
|
|
41
|
+
placeholder: string;
|
|
42
|
+
};
|
|
43
|
+
cellphone: {
|
|
44
|
+
mask: (string | RegExp)[];
|
|
45
|
+
inputMode: string;
|
|
46
|
+
placeholder: string;
|
|
47
|
+
};
|
|
48
|
+
phoneOrCellphone: {
|
|
49
|
+
mask: (rawValue: any) => (string | RegExp)[];
|
|
50
|
+
inputMode: string;
|
|
51
|
+
placeholder: string;
|
|
52
|
+
};
|
|
53
|
+
cpf: {
|
|
54
|
+
mask: (string | RegExp)[];
|
|
55
|
+
keepCharPositions: boolean;
|
|
56
|
+
inputMode: string;
|
|
57
|
+
placeholder: string;
|
|
58
|
+
};
|
|
59
|
+
cnpj: {
|
|
60
|
+
mask: (string | RegExp)[];
|
|
61
|
+
keepCharPositions: boolean;
|
|
62
|
+
inputMode: string;
|
|
63
|
+
placeholder: string;
|
|
24
64
|
};
|
|
25
65
|
};
|
|
@@ -1037,6 +1037,8 @@ function createAutoCorrectedDatePipe(dateFormat, _temp) {
|
|
|
1037
1037
|
};
|
|
1038
1038
|
}
|
|
1039
1039
|
|
|
1040
|
+
/* docs: https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md */
|
|
1041
|
+
|
|
1040
1042
|
var formatValuePatterns = {
|
|
1041
1043
|
"default": {},
|
|
1042
1044
|
onlyNumber: {
|
|
@@ -1076,7 +1078,60 @@ var formatValuePatterns = {
|
|
|
1076
1078
|
mask: [/\d/, /\d/, '/', /\d/, /\d/, '/', /\d/, /\d/, /\d/, /\d/],
|
|
1077
1079
|
pipe: /*#__PURE__*/createAutoCorrectedDatePipe('dd/mm/yyyy'),
|
|
1078
1080
|
keepCharPositions: true,
|
|
1079
|
-
inputMode: '
|
|
1081
|
+
inputMode: 'decimal',
|
|
1082
|
+
placeholder: '__/__/____'
|
|
1083
|
+
},
|
|
1084
|
+
zipCode: {
|
|
1085
|
+
mask: [/\d/, /\d/, /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/],
|
|
1086
|
+
keepCharPositions: true,
|
|
1087
|
+
inputMode: 'decimal',
|
|
1088
|
+
placeholder: '_____-___'
|
|
1089
|
+
},
|
|
1090
|
+
nfe: {
|
|
1091
|
+
mask: function mask() {
|
|
1092
|
+
var maxLength = 44;
|
|
1093
|
+
var mask = [];
|
|
1094
|
+
|
|
1095
|
+
for (var i = 1; i <= maxLength; i++) {
|
|
1096
|
+
mask.push(/\d/);
|
|
1097
|
+
if (i % 4 === 0 && i !== maxLength) mask.push(' ');
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
return mask;
|
|
1101
|
+
},
|
|
1102
|
+
keepCharPositions: true,
|
|
1103
|
+
inputMode: 'decimal',
|
|
1104
|
+
placeholder: '____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____'
|
|
1105
|
+
},
|
|
1106
|
+
phone: {
|
|
1107
|
+
mask: ['(', /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/],
|
|
1108
|
+
inputMode: 'decimal',
|
|
1109
|
+
placeholder: '(__) ____-____'
|
|
1110
|
+
},
|
|
1111
|
+
cellphone: {
|
|
1112
|
+
mask: ['(', /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/],
|
|
1113
|
+
inputMode: 'decimal',
|
|
1114
|
+
placeholder: '(__) _____-____'
|
|
1115
|
+
},
|
|
1116
|
+
phoneOrCellphone: {
|
|
1117
|
+
mask: function mask(rawValue) {
|
|
1118
|
+
var cleanedText = rawValue.replace(/[^\d]/g, '');
|
|
1119
|
+
if (cleanedText.length > 10) return formatValuePatterns.cellphone.mask;else return formatValuePatterns.phone.mask;
|
|
1120
|
+
},
|
|
1121
|
+
inputMode: 'decimal',
|
|
1122
|
+
placeholder: '(__) _____-____'
|
|
1123
|
+
},
|
|
1124
|
+
cpf: {
|
|
1125
|
+
mask: [/\d/, /\d/, /\d/, '.', /\d/, /\d/, /\d/, '.', /\d/, /\d/, /\d/, '-', /\d/, /\d/],
|
|
1126
|
+
keepCharPositions: true,
|
|
1127
|
+
inputMode: 'decimal',
|
|
1128
|
+
placeholder: '___.___.___-__'
|
|
1129
|
+
},
|
|
1130
|
+
cnpj: {
|
|
1131
|
+
mask: [/\d/, /\d/, '.', /\d/, /\d/, /\d/, '.', /\d/, /\d/, /\d/, '/', /\d/, /\d/, /\d/, /\d/, '-', /\d/, /\d/],
|
|
1132
|
+
keepCharPositions: true,
|
|
1133
|
+
inputMode: 'decimal',
|
|
1134
|
+
placeholder: '___.___.___-__'
|
|
1080
1135
|
}
|
|
1081
1136
|
};
|
|
1082
1137
|
|
|
@@ -1094,7 +1149,7 @@ function InputMaskComponent(_ref, inputRef) {
|
|
|
1094
1149
|
|
|
1095
1150
|
var formatValueProps = formatValuePatterns[formatValue] || {};
|
|
1096
1151
|
|
|
1097
|
-
var mergedProps = _extends({},
|
|
1152
|
+
var mergedProps = _extends({}, formatValueProps, props);
|
|
1098
1153
|
|
|
1099
1154
|
if (!mergedProps.mask) {
|
|
1100
1155
|
mergedProps.mask = false;
|