@transferwise/components 0.0.0-experimental-778ee44 → 0.0.0-experimental-ae2a4e7
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/index.esm.js +226 -327
- package/build/index.esm.js.map +1 -1
- package/build/index.js +227 -328
- package/build/index.js.map +1 -1
- package/build/types/common/locale/index.d.ts +26 -43
- package/build/types/common/locale/index.d.ts.map +1 -1
- package/build/types/common/textFormat/formatWithPattern/formatWithPattern.d.ts +1 -1
- package/build/types/common/textFormat/formatWithPattern/formatWithPattern.d.ts.map +1 -1
- package/build/types/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.d.ts +2 -3
- package/build/types/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.d.ts.map +1 -1
- package/build/types/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.d.ts +1 -5
- package/build/types/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.d.ts.map +1 -1
- package/build/types/common/textFormat/unformatWithPattern/unformatWithPattern.d.ts +1 -1
- package/build/types/common/textFormat/unformatWithPattern/unformatWithPattern.d.ts.map +1 -1
- package/build/types/index.d.ts +0 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts +11 -5
- package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts.map +1 -1
- package/build/types/inputWithDisplayFormat/index.d.ts +1 -2
- package/build/types/inputWithDisplayFormat/index.d.ts.map +1 -1
- package/build/types/inputs/Input.d.ts +6 -8
- package/build/types/inputs/Input.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts +30 -27
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/phoneNumberInput/data/countries.d.ts +5 -10
- package/build/types/phoneNumberInput/data/countries.d.ts.map +1 -1
- package/build/types/phoneNumberInput/index.d.ts +1 -1
- package/build/types/phoneNumberInput/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/cleanNumber/cleanNumber.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/cleanNumber/cleanNumber.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/cleanNumber/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/cleanNumber/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/excludeCountries/excludeCountries.d.ts +8 -1
- package/build/types/phoneNumberInput/utils/excludeCountries/excludeCountries.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/excludeCountries/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/excludeCountries/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/explodeNumberModel/index.d.ts +8 -4
- package/build/types/phoneNumberInput/utils/explodeNumberModel/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/findCountryByCode/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/findCountryByCode/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/findCountryByPrefix/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/findCountryByPrefix/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.d.ts +2 -1
- package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/index.d.ts +11 -13
- package/build/types/phoneNumberInput/utils/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/isStringNumeric/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/isStringNumeric/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/isStringNumeric/isStringNumeric.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/isStringNumeric/isStringNumeric.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/isValidPhoneNumber/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/isValidPhoneNumber/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.d.ts +6 -1
- package/build/types/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/longestMatchingPrefix/index.d.ts +2 -1
- package/build/types/phoneNumberInput/utils/longestMatchingPrefix/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/setDefaultPrefix/index.d.ts +7 -1
- package/build/types/phoneNumberInput/utils/setDefaultPrefix/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/sortArrayByProperty/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/sortArrayByProperty/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.d.ts.map +1 -1
- package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts +11 -5
- package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts.map +1 -1
- package/build/types/textareaWithDisplayFormat/index.d.ts +1 -2
- package/build/types/textareaWithDisplayFormat/index.d.ts.map +1 -1
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts +82 -55
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
- package/build/types/withDisplayFormat/index.d.ts +1 -2
- package/build/types/withDisplayFormat/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/locale/{index.spec.js → index.spec.ts} +0 -4
- package/src/common/locale/index.ts +96 -0
- package/src/common/textFormat/formatWithPattern/{formatWithPattern.ts → formatWithPattern.js} +4 -8
- package/src/common/textFormat/getCursorPositionAfterKeystroke/{getCursorPositionAfterKeystroke.ts → getCursorPositionAfterKeystroke.js} +8 -9
- package/src/common/textFormat/getSymbolsInPatternWithPosition/{getSymbolsInPatternWithPosition.ts → getSymbolsInPatternWithPosition.js} +2 -7
- package/src/common/textFormat/unformatWithPattern/{unformatWithPattern.ts → unformatWithPattern.js} +2 -3
- package/src/index.ts +0 -2
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.js +14 -0
- package/src/inputWithDisplayFormat/index.js +1 -0
- package/src/inputs/Input.tsx +11 -6
- package/src/phoneNumberInput/PhoneNumberInput.spec.js +18 -22
- package/src/phoneNumberInput/PhoneNumberInput.tsx +201 -0
- package/src/phoneNumberInput/data/{countries.js → countries.ts} +9 -1
- package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.ts +3 -0
- package/src/phoneNumberInput/utils/excludeCountries/{excludeCountries.spec.js → excludeCountries.spec.ts} +1 -1
- package/src/phoneNumberInput/utils/excludeCountries/{excludeCountries.js → excludeCountries.ts} +6 -5
- package/src/phoneNumberInput/utils/explodeNumberModel/{explodeNumberModel.spec.js → explodeNumberModel.spec.ts} +1 -1
- package/src/phoneNumberInput/utils/explodeNumberModel/index.ts +25 -0
- package/src/phoneNumberInput/utils/findCountryByCode/{findCountryByCode.spec.js → findCountryByCode.spec.ts} +0 -1
- package/src/phoneNumberInput/utils/findCountryByCode/index.ts +12 -0
- package/src/phoneNumberInput/utils/findCountryByPrefix/index.ts +12 -0
- package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.spec.ts +102 -0
- package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.ts +12 -0
- package/src/phoneNumberInput/utils/{index.js → index.ts} +0 -2
- package/src/phoneNumberInput/utils/isStringNumeric/{isStringNumeric.spec.js → isStringNumeric.spec.ts} +0 -1
- package/src/phoneNumberInput/utils/isStringNumeric/isStringNumeric.ts +1 -0
- package/src/phoneNumberInput/utils/isValidPhoneNumber/{isValidPhoneNumber.spec.js → isValidPhoneNumber.spec.ts} +1 -1
- package/src/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.ts +7 -0
- package/src/phoneNumberInput/utils/longestMatchingPrefix/index.ts +4 -0
- package/src/phoneNumberInput/utils/setDefaultPrefix/index.ts +20 -0
- package/src/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.ts +6 -0
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.js +14 -0
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.spec.js +1 -3
- package/src/textareaWithDisplayFormat/index.js +1 -0
- package/src/withDisplayFormat/{WithDisplayFormat.tsx → WithDisplayFormat.js} +104 -111
- package/src/withDisplayFormat/index.js +1 -0
- package/build/types/phoneNumberInput/utils/filterOptionsForQuery/index.d.ts +0 -2
- package/build/types/phoneNumberInput/utils/filterOptionsForQuery/index.d.ts.map +0 -1
- package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/index.d.ts +0 -2
- package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/index.d.ts.map +0 -1
- package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.d.ts +0 -3
- package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.d.ts.map +0 -1
- package/src/common/locale/index.js +0 -139
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.tsx +0 -11
- package/src/inputWithDisplayFormat/index.ts +0 -2
- package/src/phoneNumberInput/PhoneNumberInput.js +0 -210
- package/src/phoneNumberInput/data/countries.spec.js +0 -12
- package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.js +0 -4
- package/src/phoneNumberInput/utils/explodeNumberModel/index.js +0 -27
- package/src/phoneNumberInput/utils/filterOptionsForQuery/filterOptionsForQuery.spec.js +0 -36
- package/src/phoneNumberInput/utils/filterOptionsForQuery/index.js +0 -11
- package/src/phoneNumberInput/utils/findCountryByCode/index.js +0 -10
- package/src/phoneNumberInput/utils/findCountryByPrefix/index.js +0 -11
- package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.js +0 -26
- package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.spec.js +0 -67
- package/src/phoneNumberInput/utils/isOptionAndFitsQuery/index.js +0 -1
- package/src/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.js +0 -25
- package/src/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.spec.js +0 -66
- package/src/phoneNumberInput/utils/isStringNumeric/isStringNumeric.js +0 -1
- package/src/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.js +0 -10
- package/src/phoneNumberInput/utils/longestMatchingPrefix/index.js +0 -2
- package/src/phoneNumberInput/utils/setDefaultPrefix/index.js +0 -25
- package/src/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.js +0 -3
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +0 -32
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.tsx +0 -11
- package/src/textareaWithDisplayFormat/index.ts +0 -2
- package/src/withDisplayFormat/index.ts +0 -2
- /package/src/phoneNumberInput/{PhoneNumberInput.story.js → PhoneNumberInput.story.tsx} +0 -0
- /package/src/phoneNumberInput/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/cleanNumber/{cleanNumber.spec.js → cleanNumber.spec.ts} +0 -0
- /package/src/phoneNumberInput/utils/cleanNumber/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/excludeCountries/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/findCountryByPrefix/{findCountryByPrefix.spec.js → findCountryByPrefix.spec.ts} +0 -0
- /package/src/phoneNumberInput/utils/groupCountriesByPrefix/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/isStringNumeric/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/isValidPhoneNumber/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/longestMatchingPrefix/{longestMatchingPrefix.spec.js → longestMatchingPrefix.spec.ts} +0 -0
- /package/src/phoneNumberInput/utils/setDefaultPrefix/{setDefaultPrefix.spec.js → setDefaultPrefix.spec.ts} +0 -0
- /package/src/phoneNumberInput/utils/sortArrayByProperty/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/sortArrayByProperty/{sortArrayByProperty.spec.js → sortArrayByProperty.spec.ts} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { sortArrayByProperty } from
|
|
1
|
+
export { sortArrayByProperty } from './sortArrayByProperty';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/sortArrayByProperty/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/sortArrayByProperty/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function sortArrayByProperty(arrayToSort:
|
|
1
|
+
export declare function sortArrayByProperty<T extends Record<PropertyKey, string>>(arrayToSort: T[], property: keyof T): T[];
|
|
2
2
|
//# sourceMappingURL=sortArrayByProperty.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortArrayByProperty.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.
|
|
1
|
+
{"version":3,"file":"sortArrayByProperty.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,EACvE,WAAW,EAAE,CAAC,EAAE,EAChB,QAAQ,EAAE,MAAM,CAAC,OAGlB"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface TextareaWithDisplayFormatProps {
|
|
4
|
+
displayPattern: string;
|
|
5
|
+
onChange: (...args: any[])=>any;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare const TextareaWithDisplayFormat: React.FC<TextareaWithDisplayFormatProps>;
|
|
9
|
+
|
|
10
|
+
export default TextareaWithDisplayFormat;
|
|
11
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextareaWithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/TextareaWithDisplayFormat.
|
|
1
|
+
{"version":3,"file":"TextareaWithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/TextareaWithDisplayFormat.js"],"names":[],"mappings":";AAIA,oFAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/index.js"],"names":[],"mappings":""}
|
|
@@ -1,63 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export type TextInputProps = Merge<InputProps, {
|
|
7
|
-
value?: string;
|
|
8
|
-
displayPattern: string;
|
|
9
|
-
/**
|
|
10
|
-
* autocomplete hides our form help so we need to disable it when help text
|
|
11
|
-
* is present. Chrome ignores autocomplete=off, the only way to disable it is
|
|
12
|
-
* to provide an 'invalid' value, for which 'disabled' serves.
|
|
13
|
-
*/
|
|
14
|
-
autoComplete?: InputProps['autoComplete'] | 'disabled';
|
|
15
|
-
onChange?: (value: string) => void;
|
|
16
|
-
onBlur?: (value: string) => void;
|
|
17
|
-
onFocus?: (value: string) => void;
|
|
18
|
-
}>;
|
|
19
|
-
export type Props = typeof WithDisplayFormat.defaultProps & {
|
|
20
|
-
render: (renderProps: InputProps | TextAreaProps) => JSX.Element;
|
|
21
|
-
} & TextInputProps;
|
|
22
|
-
export type EventType = 'KeyDown' | 'Paste' | 'Cut' | 'Undo' | 'Redo' | 'Backspace' | 'Delete' | null;
|
|
23
|
-
type State = {
|
|
24
|
-
value: string;
|
|
25
|
-
historyNavigator: HistoryNavigator;
|
|
26
|
-
prevDisplayPattern?: string;
|
|
27
|
-
triggerType?: EventType;
|
|
28
|
-
triggerEvent?: KeyboardEvent<HTMLInputElement> | null;
|
|
29
|
-
pastedLength?: number;
|
|
30
|
-
selectionStart?: HTMLInputElement['selectionStart'];
|
|
31
|
-
selectionEnd?: HTMLInputElement['selectionEnd'];
|
|
32
|
-
};
|
|
33
|
-
declare class WithDisplayFormat extends Component<Props, State> {
|
|
34
|
-
static defaultProps: {
|
|
35
|
-
autoComplete: string;
|
|
36
|
-
displayPattern: string;
|
|
37
|
-
type: string;
|
|
38
|
-
value: string;
|
|
39
|
-
};
|
|
40
|
-
constructor(props: Props);
|
|
41
|
-
static getDerivedStateFromProps({ displayPattern }: Props, { prevDisplayPattern, value, historyNavigator }: State): {
|
|
42
|
-
prevDisplayPattern: string;
|
|
43
|
-
value: string;
|
|
1
|
+
export default WithDisplayFormat;
|
|
2
|
+
declare class WithDisplayFormat extends Component<any, any, any> {
|
|
3
|
+
static getDerivedStateFromProps(nextProps: any, previousState: any): {
|
|
4
|
+
prevDisplayPattern: any;
|
|
5
|
+
value: any;
|
|
44
6
|
triggerType: null;
|
|
45
7
|
triggerEvent: null;
|
|
46
8
|
pastedLength: number;
|
|
47
9
|
} | null;
|
|
48
|
-
|
|
10
|
+
constructor(props: any);
|
|
11
|
+
state: {
|
|
12
|
+
value: any;
|
|
13
|
+
historyNavigator: HistoryNavigator;
|
|
14
|
+
prevDisplayPattern: any;
|
|
15
|
+
triggerType: null;
|
|
16
|
+
triggerEvent: null;
|
|
17
|
+
};
|
|
18
|
+
getUserAction: (unformattedValue: any) => any;
|
|
49
19
|
resetEvent: () => void;
|
|
50
|
-
detectUndoRedo: (event:
|
|
51
|
-
handleOnKeyDown: (event:
|
|
52
|
-
handleOnPaste: (event:
|
|
20
|
+
detectUndoRedo: (event: any) => "Redo" | "Undo" | null;
|
|
21
|
+
handleOnKeyDown: (event: any) => void;
|
|
22
|
+
handleOnPaste: (event: any) => void;
|
|
53
23
|
handleOnCut: () => void;
|
|
54
|
-
isKeyAllowed: (action:
|
|
55
|
-
handleOnChange: (event:
|
|
56
|
-
handleOnBlur: (event:
|
|
57
|
-
handleOnFocus: (event:
|
|
58
|
-
handleDelete: (unformattedValue:
|
|
59
|
-
handleCursorPositioning: (action:
|
|
60
|
-
render():
|
|
24
|
+
isKeyAllowed: (action: any) => boolean;
|
|
25
|
+
handleOnChange: (event: any) => void;
|
|
26
|
+
handleOnBlur: (event: any) => void;
|
|
27
|
+
handleOnFocus: (event: any) => void;
|
|
28
|
+
handleDelete: (unformattedValue: any, action: any) => string;
|
|
29
|
+
handleCursorPositioning: (action: any) => void;
|
|
30
|
+
render(): any;
|
|
61
31
|
}
|
|
62
|
-
|
|
32
|
+
declare namespace WithDisplayFormat {
|
|
33
|
+
namespace propTypes {
|
|
34
|
+
const autoComplete: any;
|
|
35
|
+
const className: any;
|
|
36
|
+
const disabled: any;
|
|
37
|
+
const id: any;
|
|
38
|
+
const maxLength: any;
|
|
39
|
+
const minLength: any;
|
|
40
|
+
const name: any;
|
|
41
|
+
const onFocus: any;
|
|
42
|
+
const onBlur: any;
|
|
43
|
+
const onChange: any;
|
|
44
|
+
const placeholder: any;
|
|
45
|
+
const readOnly: any;
|
|
46
|
+
const render: any;
|
|
47
|
+
const required: any;
|
|
48
|
+
const displayPattern: any;
|
|
49
|
+
const type: any;
|
|
50
|
+
const inputMode: any;
|
|
51
|
+
const value: any;
|
|
52
|
+
}
|
|
53
|
+
namespace defaultProps {
|
|
54
|
+
const autoComplete_1: string;
|
|
55
|
+
export { autoComplete_1 as autoComplete };
|
|
56
|
+
const className_1: null;
|
|
57
|
+
export { className_1 as className };
|
|
58
|
+
const disabled_1: boolean;
|
|
59
|
+
export { disabled_1 as disabled };
|
|
60
|
+
const id_1: null;
|
|
61
|
+
export { id_1 as id };
|
|
62
|
+
const maxLength_1: null;
|
|
63
|
+
export { maxLength_1 as maxLength };
|
|
64
|
+
const minLength_1: null;
|
|
65
|
+
export { minLength_1 as minLength };
|
|
66
|
+
const name_1: null;
|
|
67
|
+
export { name_1 as name };
|
|
68
|
+
const placeholder_1: null;
|
|
69
|
+
export { placeholder_1 as placeholder };
|
|
70
|
+
const readOnly_1: boolean;
|
|
71
|
+
export { readOnly_1 as readOnly };
|
|
72
|
+
const required_1: boolean;
|
|
73
|
+
export { required_1 as required };
|
|
74
|
+
const displayPattern_1: string;
|
|
75
|
+
export { displayPattern_1 as displayPattern };
|
|
76
|
+
const type_1: string;
|
|
77
|
+
export { type_1 as type };
|
|
78
|
+
const inputMode_1: null;
|
|
79
|
+
export { inputMode_1 as inputMode };
|
|
80
|
+
const value_1: string;
|
|
81
|
+
export { value_1 as value };
|
|
82
|
+
const onFocus_1: null;
|
|
83
|
+
export { onFocus_1 as onFocus };
|
|
84
|
+
const onBlur_1: null;
|
|
85
|
+
export { onBlur_1 as onBlur };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
import { Component } from "react";
|
|
89
|
+
import { HistoryNavigator } from "../common";
|
|
63
90
|
//# sourceMappingURL=WithDisplayFormat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/WithDisplayFormat.
|
|
1
|
+
{"version":3,"file":"WithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/WithDisplayFormat.js"],"names":[],"mappings":";AAaA;IAcE;;;;;;aAkBC;IA/BD,wBAWC;IAPC;;;;;;MAMC;IAuBH,8CA0BE;IAEF,uBAME;IAEF,uDAME;IAEF,sCAuBE;IAEF,oCAQE;IAEF,wBAEE;IAEF,uCAKE;IAEF,qCA0BE;IAEF,mCAKE;IAEF,oCAME;IAEF,6DAuBE;IAEF,+CAkBE;IAEF,cAsCC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/index.js"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -24,8 +24,6 @@ describe('locale utils', () => {
|
|
|
24
24
|
['zh_HK', 'zh'],
|
|
25
25
|
['ja-JP', 'ja'],
|
|
26
26
|
['zhHK', null],
|
|
27
|
-
[null, null],
|
|
28
|
-
[undefined, null],
|
|
29
27
|
['', null],
|
|
30
28
|
[' ', null],
|
|
31
29
|
['ar-dz', null],
|
|
@@ -51,8 +49,6 @@ describe('locale utils', () => {
|
|
|
51
49
|
['zh_HK', 'zh-HK'],
|
|
52
50
|
['ja-JP', 'ja-JP'],
|
|
53
51
|
['zhHK', null],
|
|
54
|
-
[null, null],
|
|
55
|
-
[undefined, null],
|
|
56
52
|
['', null],
|
|
57
53
|
[' ', null],
|
|
58
54
|
['ar-dz', 'ar-DZ'],
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Direction } from '..';
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_LANG = 'en';
|
|
4
|
+
export const DEFAULT_LOCALE = 'en-GB';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Languages written right-to-left.
|
|
8
|
+
*/
|
|
9
|
+
export const RTL_LANGUAGES = ['ar', 'he'];
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated The source of truth for supported languages lives in Crab.
|
|
13
|
+
*/
|
|
14
|
+
export const SUPPORTED_LANGUAGES = [
|
|
15
|
+
DEFAULT_LANG,
|
|
16
|
+
'de',
|
|
17
|
+
'es',
|
|
18
|
+
'fr',
|
|
19
|
+
'hu',
|
|
20
|
+
'id',
|
|
21
|
+
'it',
|
|
22
|
+
'ja',
|
|
23
|
+
'pl',
|
|
24
|
+
'pt',
|
|
25
|
+
'ro',
|
|
26
|
+
'ru',
|
|
27
|
+
'th',
|
|
28
|
+
'tr',
|
|
29
|
+
'uk',
|
|
30
|
+
'zh',
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Verifies and adjusts locale, replacing `_` with `-`.
|
|
35
|
+
*
|
|
36
|
+
* @param locale `es`, `es_ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.
|
|
37
|
+
* @returns `null` if locale is unrecognized by `Intl.Locale`.
|
|
38
|
+
*/
|
|
39
|
+
export function adjustLocale(locale: string) {
|
|
40
|
+
const localeTrimmed = locale?.trim();
|
|
41
|
+
if (localeTrimmed) {
|
|
42
|
+
try {
|
|
43
|
+
return new Intl.Locale(localeTrimmed.replace('_', '-')).baseName;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
// eslint-disable-next-line no-console
|
|
46
|
+
console.error(error);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Provides corresponding lang (iso2) for provided locale.
|
|
54
|
+
*
|
|
55
|
+
* @deprecated The use of this function almost always breaks language variants
|
|
56
|
+
* e.g. Simplified and Traditional Chinese.
|
|
57
|
+
* There should be no use case for this function.
|
|
58
|
+
* To select the correct translations from a translations object, pass the
|
|
59
|
+
* locale directly into Crab's getLocalisedMessages.
|
|
60
|
+
* @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.
|
|
61
|
+
* @returns Two-letter ISO 639-1 language code, falling back to `null` if locale is invalid or language is unsupported.
|
|
62
|
+
*/
|
|
63
|
+
export function getLangFromLocale(locale: string) {
|
|
64
|
+
const adjustedLocale = adjustLocale(locale);
|
|
65
|
+
if (adjustedLocale != null) {
|
|
66
|
+
const { language } = new Intl.Locale(adjustedLocale);
|
|
67
|
+
if (SUPPORTED_LANGUAGES.includes(language)) {
|
|
68
|
+
return language;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Provides corresponding country code (iso2) for locales code with explicit region value.
|
|
76
|
+
*
|
|
77
|
+
* @param locale `es-ES`, `en-GB`, `ja-JP`, etc.
|
|
78
|
+
* @returns `null` if the locale is invalid or the region can‘t be identified.
|
|
79
|
+
*/
|
|
80
|
+
export function getCountryFromLocale(locale: string) {
|
|
81
|
+
const adjustedLocale = adjustLocale(locale);
|
|
82
|
+
return adjustedLocale != null ? new Intl.Locale(adjustedLocale).region ?? null : null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Provides the layout direction for a given locale.
|
|
87
|
+
*
|
|
88
|
+
* @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.
|
|
89
|
+
* @returns The layout direction based on the locale, falling back to `Direction.LTR` if the locale is invalid or unsupported.
|
|
90
|
+
*/
|
|
91
|
+
export function getDirectionFromLocale(locale: string) {
|
|
92
|
+
const adjustedLocale = adjustLocale(locale);
|
|
93
|
+
return adjustedLocale != null && RTL_LANGUAGES.includes(new Intl.Locale(adjustedLocale).language)
|
|
94
|
+
? Direction.RTL
|
|
95
|
+
: Direction.LTR;
|
|
96
|
+
}
|
package/src/common/textFormat/formatWithPattern/{formatWithPattern.ts → formatWithPattern.js}
RENAMED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import getSymbolsInPatternWithPosition from '../getSymbolsInPatternWithPosition';
|
|
2
|
-
import type { SymbolWithPosition } from '../getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition';
|
|
3
2
|
|
|
4
|
-
const formatWithPattern = (value
|
|
3
|
+
const formatWithPattern = (value, pattern) => {
|
|
5
4
|
if (!value || value === '') {
|
|
6
5
|
return '';
|
|
7
6
|
}
|
|
@@ -10,16 +9,13 @@ const formatWithPattern = (value: string, pattern: string): string => {
|
|
|
10
9
|
|
|
11
10
|
const patternWithSymbolsPosition = getSymbolsInPatternWithPosition(pattern);
|
|
12
11
|
|
|
13
|
-
let patternSymbol
|
|
12
|
+
let patternSymbol = [];
|
|
14
13
|
// valueArray.length increments during the cycle cause we are adding new elements.
|
|
15
14
|
for (let index = 0; index < valueArray.length; index += 1) {
|
|
16
|
-
patternSymbol = patternWithSymbolsPosition.filter((
|
|
15
|
+
patternSymbol = patternWithSymbolsPosition.filter((symbol) => symbol.index === index);
|
|
17
16
|
// Add pattern's symbol at n position
|
|
18
17
|
if (patternSymbol.length === 1) {
|
|
19
|
-
|
|
20
|
-
if (last) {
|
|
21
|
-
valueArray.splice(index, 0, last.symbol);
|
|
22
|
-
}
|
|
18
|
+
valueArray.splice(index, 0, patternSymbol.pop().symbol);
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
21
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type { EventType } from '../../../withDisplayFormat/WithDisplayFormat';
|
|
2
1
|
import getCountOfSymbolsInSelection from '../getCountOfSymbolsInSelection';
|
|
3
2
|
import { getDistanceToNextSymbol, getDistanceToPreviousSymbol } from '../getDistanceToSymbol';
|
|
4
3
|
|
|
5
|
-
const
|
|
6
|
-
action
|
|
7
|
-
selectionStart
|
|
8
|
-
selectionEnd
|
|
9
|
-
pattern
|
|
10
|
-
pastedLength
|
|
11
|
-
)
|
|
4
|
+
const getCursorPositionAfteractionstroke = (
|
|
5
|
+
action,
|
|
6
|
+
selectionStart,
|
|
7
|
+
selectionEnd,
|
|
8
|
+
pattern,
|
|
9
|
+
pastedLength,
|
|
10
|
+
) => {
|
|
12
11
|
let cursorPosition = selectionStart;
|
|
13
12
|
|
|
14
13
|
switch (action) {
|
|
@@ -39,4 +38,4 @@ const getCursorPositionAfterActionStroke = (
|
|
|
39
38
|
return cursorPosition;
|
|
40
39
|
};
|
|
41
40
|
|
|
42
|
-
export default
|
|
41
|
+
export default getCursorPositionAfteractionstroke;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
symbol: string;
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
const getSymbolsInPatternWithPosition = (pattern: string): SymbolWithPosition[] => {
|
|
7
|
-
const patternWithSymbolsPosition: SymbolWithPosition[] = [];
|
|
1
|
+
const getSymbolsInPatternWithPosition = (pattern) => {
|
|
2
|
+
const patternWithSymbolsPosition = [];
|
|
8
3
|
const patternArray = pattern.split('');
|
|
9
4
|
patternArray.forEach((symbol, index) => {
|
|
10
5
|
if (symbol !== '*') {
|
package/src/common/textFormat/unformatWithPattern/{unformatWithPattern.ts → unformatWithPattern.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const unformatWithPattern = (value
|
|
1
|
+
const unformatWithPattern = (value, pattern) => {
|
|
2
2
|
let valueArray = [''];
|
|
3
3
|
if (value && value.length > 0) {
|
|
4
4
|
valueArray = value.toString().split('');
|
|
@@ -8,7 +8,6 @@ const unformatWithPattern = (value: string, pattern: string): string => {
|
|
|
8
8
|
return valueArray.join('');
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const getSymbolsInPattern = (pattern
|
|
12
|
-
pattern.split('').filter((symbol) => symbol !== '*');
|
|
11
|
+
const getSymbolsInPattern = (pattern) => pattern.split('').filter((symbol) => symbol !== '*');
|
|
13
12
|
|
|
14
13
|
export default unformatWithPattern;
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Types
|
|
3
3
|
*/
|
|
4
4
|
export type { InputProps } from './inputs/Input';
|
|
5
|
-
export type { InputWithDisplayFormatProps } from './inputWithDisplayFormat';
|
|
6
5
|
export type { InputGroupProps } from './inputs/InputGroup';
|
|
7
6
|
export type { SearchInputProps } from './inputs/SearchInput';
|
|
8
7
|
export type {
|
|
@@ -15,7 +14,6 @@ export type {
|
|
|
15
14
|
SelectInputTriggerButtonProps,
|
|
16
15
|
} from './inputs/SelectInput';
|
|
17
16
|
export type { TextAreaProps } from './inputs/TextArea';
|
|
18
|
-
export type { TextareaWithDisplayFormatProps } from './textareaWithDisplayFormat';
|
|
19
17
|
export type { UploadedFile, UploadError, UploadResponse } from './uploadInput/types';
|
|
20
18
|
export type { ModalProps } from './modal';
|
|
21
19
|
export type {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
|
|
3
|
+
import WithDisplayFormat from '../withDisplayFormat';
|
|
4
|
+
|
|
5
|
+
const InputWithDisplayFormat = (props) => (
|
|
6
|
+
<WithDisplayFormat {...props} render={(renderProps) => <input {...renderProps} />} />
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
InputWithDisplayFormat.propTypes = {
|
|
10
|
+
displayPattern: PropTypes.string.isRequired,
|
|
11
|
+
onChange: PropTypes.func.isRequired,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default InputWithDisplayFormat;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './InputWithDisplayFormat';
|
package/src/inputs/Input.tsx
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import {
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { SizeLarge, SizeMedium, SizeSmall } from '../common';
|
|
5
|
+
import { Merge } from '../utils';
|
|
5
6
|
|
|
6
7
|
import { useInputPaddings } from './InputGroup';
|
|
7
8
|
import { formControlClassNameBase } from './_common';
|
|
8
9
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
export interface InputProps
|
|
11
|
+
extends Merge<
|
|
12
|
+
React.ComponentPropsWithRef<'input'>,
|
|
13
|
+
{
|
|
14
|
+
size?: 'auto' | SizeSmall | SizeMedium | SizeLarge;
|
|
15
|
+
shape?: 'rectangle' | 'pill';
|
|
16
|
+
'aria-invalid'?: boolean;
|
|
17
|
+
}
|
|
18
|
+
> {}
|
|
14
19
|
|
|
15
20
|
export const Input = forwardRef(function Input(
|
|
16
21
|
{ size = 'auto', shape = 'rectangle', className, ...restProps }: InputProps,
|
|
@@ -37,11 +37,7 @@ describe('Given a telephone number component', () => {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
it('should set prefix control to default UK value', () => {
|
|
40
|
-
expect(select.props().value).
|
|
41
|
-
value: '+44',
|
|
42
|
-
note: 'GBR, GGY, IMN, JEY',
|
|
43
|
-
label: '+44',
|
|
44
|
-
});
|
|
40
|
+
expect(select.props().value).toBe('+44');
|
|
45
41
|
});
|
|
46
42
|
|
|
47
43
|
it('should set number control to empty', () => {
|
|
@@ -49,11 +45,11 @@ describe('Given a telephone number component', () => {
|
|
|
49
45
|
});
|
|
50
46
|
|
|
51
47
|
it('should not disable the select', () => {
|
|
52
|
-
expect(select.prop('disabled')).
|
|
48
|
+
expect(select.prop('disabled')).toBeFalsy();
|
|
53
49
|
});
|
|
54
50
|
|
|
55
51
|
it('should not disable the input', () => {
|
|
56
|
-
expect(input.prop('disabled')).
|
|
52
|
+
expect(input.prop('disabled')).toBeFalsy();
|
|
57
53
|
});
|
|
58
54
|
});
|
|
59
55
|
|
|
@@ -65,7 +61,7 @@ describe('Given a telephone number component', () => {
|
|
|
65
61
|
});
|
|
66
62
|
|
|
67
63
|
it('should set control values correctly', () => {
|
|
68
|
-
expect(select.props().value
|
|
64
|
+
expect(select.props().value).toBe('+39');
|
|
69
65
|
expect(input.prop('value')).toBe('123456789');
|
|
70
66
|
});
|
|
71
67
|
});
|
|
@@ -92,8 +88,8 @@ describe('Given a telephone number component', () => {
|
|
|
92
88
|
input = component.find(NUMBER_SELECTOR);
|
|
93
89
|
});
|
|
94
90
|
|
|
95
|
-
it('should render input with
|
|
96
|
-
expect(input.prop('id')).
|
|
91
|
+
it('should render input with unspecified id', () => {
|
|
92
|
+
expect(input.prop('id')).toBeUndefined();
|
|
97
93
|
});
|
|
98
94
|
});
|
|
99
95
|
|
|
@@ -118,7 +114,7 @@ describe('Given a telephone number component', () => {
|
|
|
118
114
|
it(`${number} code should update the value properly`, () => {
|
|
119
115
|
simulatePaste(component.find('input'), number);
|
|
120
116
|
|
|
121
|
-
expect(select().props().value
|
|
117
|
+
expect(select().props().value).toBe(countryCode);
|
|
122
118
|
expect(input().prop('value')).toBe(localNumber);
|
|
123
119
|
expect(props.onChange).toHaveBeenCalledWith(number.replace(/(\s|-)+/g, ''), countryCode);
|
|
124
120
|
});
|
|
@@ -126,28 +122,28 @@ describe('Given a telephone number component', () => {
|
|
|
126
122
|
|
|
127
123
|
it('should not paste invalid characters', () => {
|
|
128
124
|
simulatePaste(component.find('input'), '+36asdasdasd');
|
|
129
|
-
expect(select().props().value
|
|
125
|
+
expect(select().props().value).toBe('+39');
|
|
130
126
|
expect(input().prop('value')).toBe('123456789');
|
|
131
127
|
expect(props.onChange).not.toHaveBeenCalled();
|
|
132
128
|
});
|
|
133
129
|
|
|
134
130
|
it('should not paste countries which are not in the select', () => {
|
|
135
131
|
simulatePaste(component.find('input'), '+9992342343423');
|
|
136
|
-
expect(select().props().value
|
|
132
|
+
expect(select().props().value).toBe('+39');
|
|
137
133
|
expect(input().prop('value')).toBe('123456789');
|
|
138
134
|
expect(props.onChange).not.toHaveBeenCalled();
|
|
139
135
|
});
|
|
140
136
|
|
|
141
137
|
it("should not paste numbers which doesn't start with the country code", () => {
|
|
142
138
|
simulatePaste(component.find('input'), '0+36303932551');
|
|
143
|
-
expect(select().props().value
|
|
139
|
+
expect(select().props().value).toBe('+39');
|
|
144
140
|
expect(input().prop('value')).toBe('123456789');
|
|
145
141
|
expect(props.onChange).not.toHaveBeenCalled();
|
|
146
142
|
});
|
|
147
143
|
|
|
148
144
|
it("should not paste numbers which doesn't contain a country code", () => {
|
|
149
145
|
simulatePaste(component.find('input'), '06303932551');
|
|
150
|
-
expect(select().props().value
|
|
146
|
+
expect(select().props().value).toBe('+39');
|
|
151
147
|
expect(input().prop('value')).toBe('123456789');
|
|
152
148
|
expect(props.onChange).not.toHaveBeenCalled();
|
|
153
149
|
});
|
|
@@ -161,7 +157,7 @@ describe('Given a telephone number component', () => {
|
|
|
161
157
|
});
|
|
162
158
|
|
|
163
159
|
it('should set the select to the longest matching prefix', () => {
|
|
164
|
-
expect(select.props().value
|
|
160
|
+
expect(select.props().value).toBe('+1868');
|
|
165
161
|
});
|
|
166
162
|
|
|
167
163
|
it('should set the number input to the rest of the number', () => {
|
|
@@ -177,7 +173,7 @@ describe('Given a telephone number component', () => {
|
|
|
177
173
|
});
|
|
178
174
|
|
|
179
175
|
it('should empty the select', () => {
|
|
180
|
-
expect(select.props().value).
|
|
176
|
+
expect(select.props().value).toBeNull();
|
|
181
177
|
});
|
|
182
178
|
|
|
183
179
|
it('should put the whole value in the input without the plus', () => {
|
|
@@ -191,7 +187,7 @@ describe('Given a telephone number component', () => {
|
|
|
191
187
|
select = component.find(PREFIX_SELECT_SELECTOR);
|
|
192
188
|
input = component.find(NUMBER_SELECTOR);
|
|
193
189
|
|
|
194
|
-
expect(select.props().value
|
|
190
|
+
expect(select.props().value).toBe('+44');
|
|
195
191
|
expect(input.prop('value')).toBe('');
|
|
196
192
|
});
|
|
197
193
|
});
|
|
@@ -254,7 +250,7 @@ describe('Given a telephone number component', () => {
|
|
|
254
250
|
});
|
|
255
251
|
|
|
256
252
|
it('should use the prefix of the supplied value', () => {
|
|
257
|
-
expect(select.props().value
|
|
253
|
+
expect(select.props().value).toBe('+1');
|
|
258
254
|
});
|
|
259
255
|
});
|
|
260
256
|
|
|
@@ -268,7 +264,7 @@ describe('Given a telephone number component', () => {
|
|
|
268
264
|
});
|
|
269
265
|
|
|
270
266
|
it('should default the prefix to the local country', () => {
|
|
271
|
-
expect(select.props().value
|
|
267
|
+
expect(select.props().value).toBe('+34');
|
|
272
268
|
});
|
|
273
269
|
});
|
|
274
270
|
|
|
@@ -281,7 +277,7 @@ describe('Given a telephone number component', () => {
|
|
|
281
277
|
});
|
|
282
278
|
|
|
283
279
|
it('should override locale prefix with country specific prefix', () => {
|
|
284
|
-
expect(select.props().value
|
|
280
|
+
expect(select.props().value).toBe('+1');
|
|
285
281
|
});
|
|
286
282
|
});
|
|
287
283
|
});
|
|
@@ -349,7 +345,7 @@ describe('Given a telephone number component', () => {
|
|
|
349
345
|
|
|
350
346
|
it('renders Select component with expected props', () => {
|
|
351
347
|
const select = component.find(PREFIX_SELECT_SELECTOR);
|
|
352
|
-
expect(select.prop('className')).
|
|
348
|
+
expect(select.prop('className')).toBe('custom-class');
|
|
353
349
|
});
|
|
354
350
|
});
|
|
355
351
|
});
|