mui-tel-input 3.2.2 → 4.0.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.d.ts +56 -6
- package/dist/mui-tel-input.es.js +818 -828
- package/package.json +31 -43
- package/dist/index.stories.d.ts +0 -6
- package/dist/index.test.d.ts +0 -0
- package/dist/index.types.d.ts +0 -33
- package/dist/shared/constants/continents.d.ts +0 -7
- package/dist/shared/constants/countries.d.ts +0 -4
- package/dist/shared/constants/flags.d.ts +0 -6
- package/dist/shared/constants/lang.d.ts +0 -1
- package/dist/shared/helpers/__tests__/array.test.d.ts +0 -1
- package/dist/shared/helpers/__tests__/country.test.d.ts +0 -1
- package/dist/shared/helpers/__tests__/dom.test.d.ts +0 -0
- package/dist/shared/helpers/__tests__/intl.test.d.ts +0 -0
- package/dist/shared/helpers/__tests__/ref.test.d.ts +0 -0
- package/dist/shared/helpers/__tests__/string.test.d.ts +0 -0
- package/dist/shared/helpers/array.d.ts +0 -2
- package/dist/shared/helpers/country.d.ts +0 -18
- package/dist/shared/helpers/dom.d.ts +0 -1
- package/dist/shared/helpers/intl.d.ts +0 -1
- package/dist/shared/helpers/log.d.ts +0 -1
- package/dist/shared/helpers/object.d.ts +0 -2
- package/dist/shared/helpers/ref.d.ts +0 -2
- package/dist/shared/helpers/string.d.ts +0 -1
- package/dist/shared/hooks/__tests__/useMissmatch.test.d.ts +0 -1
- package/dist/shared/hooks/useMissmatchProps.d.ts +0 -2
- package/dist/shared/hooks/usePhoneDigits.d.ts +0 -33
- package/dist/testUtils/index.d.ts +0 -11
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"url": "https://github.com/viclafouch/mui-tel-input/issues"
|
|
8
8
|
},
|
|
9
9
|
"homepage": "https://viclafouch.github.io/mui-tel-input",
|
|
10
|
-
"version": "
|
|
10
|
+
"version": "4.0.1",
|
|
11
11
|
"files": [
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
18
|
"import": "./dist/mui-tel-input.es.js",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/mui-tel-input.es.js"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"@emotion/react": "^11.5.0",
|
|
62
62
|
"@emotion/styled": "^11.3.0",
|
|
63
63
|
"@mui/material": "^5.0.0",
|
|
64
|
-
"@types/react": "^
|
|
65
|
-
"react": "^
|
|
66
|
-
"react-dom": "^
|
|
64
|
+
"@types/react": "^18.0.0",
|
|
65
|
+
"react": "^18.0.0",
|
|
66
|
+
"react-dom": "^18.0.0"
|
|
67
67
|
},
|
|
68
68
|
"peerDependenciesMeta": {
|
|
69
69
|
"@types/react": {
|
|
@@ -71,53 +71,41 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@types/node": "^20.
|
|
75
|
-
"libphonenumber-js": "^1.10.
|
|
74
|
+
"@types/node": "^20.8.4",
|
|
75
|
+
"libphonenumber-js": "^1.10.47"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@babel/core": "^7.
|
|
78
|
+
"@babel/core": "^7.23.0",
|
|
79
79
|
"@emotion/react": "^11.11.1",
|
|
80
80
|
"@emotion/styled": "^11.11.0",
|
|
81
|
-
"@mui/material": "^5.13
|
|
82
|
-
"@storybook/addon-actions": "^7.
|
|
83
|
-
"@storybook/addon-essentials": "^7.
|
|
84
|
-
"@storybook/addon-interactions": "^7.
|
|
85
|
-
"@storybook/addon-links": "^7.
|
|
86
|
-
"@storybook/react": "^7.
|
|
87
|
-
"@storybook/react-vite": "^7.
|
|
88
|
-
"@storybook/testing-library": "^0.2.
|
|
89
|
-
"@testing-library/jest-dom": "^5.
|
|
81
|
+
"@mui/material": "^5.14.13",
|
|
82
|
+
"@storybook/addon-actions": "^7.4.6",
|
|
83
|
+
"@storybook/addon-essentials": "^7.4.6",
|
|
84
|
+
"@storybook/addon-interactions": "^7.4.6",
|
|
85
|
+
"@storybook/addon-links": "^7.4.6",
|
|
86
|
+
"@storybook/react": "^7.4.6",
|
|
87
|
+
"@storybook/react-vite": "^7.4.6",
|
|
88
|
+
"@storybook/testing-library": "^0.2.2",
|
|
89
|
+
"@testing-library/jest-dom": "^5.17.0",
|
|
90
90
|
"@testing-library/react": "^14.0.0",
|
|
91
|
-
"@testing-library/user-event": "^14.
|
|
92
|
-
"@types/react": "^18.2.
|
|
93
|
-
"@
|
|
94
|
-
"@
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"babel-loader": "^9.1.2",
|
|
98
|
-
"eslint": "^8.44.0",
|
|
99
|
-
"eslint-config-airbnb": "^19.0.4",
|
|
100
|
-
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
101
|
-
"eslint-config-prettier": "^8.8.0",
|
|
102
|
-
"eslint-plugin-import": "^2.27.5",
|
|
103
|
-
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
104
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
105
|
-
"eslint-plugin-react": "^7.32.2",
|
|
106
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
107
|
-
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
108
|
-
"eslint-plugin-testing-library": "^5.11.0",
|
|
91
|
+
"@testing-library/user-event": "^14.5.1",
|
|
92
|
+
"@types/react": "^18.2.28",
|
|
93
|
+
"@viclafouch/eslint-config-viclafouch": "^4.3.0",
|
|
94
|
+
"@vitejs/plugin-react": "^4.1.0",
|
|
95
|
+
"babel-loader": "^9.1.3",
|
|
96
|
+
"eslint": "^8.51.0",
|
|
109
97
|
"husky": "^8.0.3",
|
|
110
98
|
"jsdom": "^22.1.0",
|
|
111
|
-
"prettier": "^
|
|
99
|
+
"prettier": "^3.0.3",
|
|
112
100
|
"react": "^18.2.0",
|
|
113
101
|
"react-dom": "^18.2.0",
|
|
114
102
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
115
103
|
"standard-version": "^9.5.0",
|
|
116
|
-
"storybook": "^7.
|
|
117
|
-
"typescript": "^5.
|
|
118
|
-
"vite": "^4.
|
|
119
|
-
"vite-aliases": "^0.11.
|
|
120
|
-
"vite-plugin-dts": "^3.0
|
|
121
|
-
"vitest": "^0.
|
|
104
|
+
"storybook": "^7.4.6",
|
|
105
|
+
"typescript": "^5.2.2",
|
|
106
|
+
"vite": "^4.4.11",
|
|
107
|
+
"vite-aliases": "^0.11.3",
|
|
108
|
+
"vite-plugin-dts": "^3.6.0",
|
|
109
|
+
"vitest": "^0.34.6"
|
|
122
110
|
}
|
|
123
111
|
}
|
package/dist/index.stories.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentStory } from '@storybook/react';
|
|
3
|
-
import { MuiTelInput, MuiTelInputProps } from './index';
|
|
4
|
-
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, Omit<MuiTelInputProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
-
export default _default;
|
|
6
|
-
export declare const Primary: ComponentStory<typeof MuiTelInput>;
|
package/dist/index.test.d.ts
DELETED
|
File without changes
|
package/dist/index.types.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { NumberType } from 'libphonenumber-js';
|
|
2
|
-
import type { MenuProps } from '@mui/material/Menu';
|
|
3
|
-
import type { TextFieldProps } from '@mui/material/TextField';
|
|
4
|
-
import type { MuiTelInputContinent } from './shared/constants/continents';
|
|
5
|
-
import type { MuiTelInputCountry } from './shared/constants/countries';
|
|
6
|
-
type BaseTextFieldProps = Omit<TextFieldProps, 'onChange' | 'select' | 'type' | 'multiline' | 'defaultValue'>;
|
|
7
|
-
export type { MuiTelInputContinent, MuiTelInputCountry };
|
|
8
|
-
export type FlagSize = `small` | 'medium';
|
|
9
|
-
export type MuiTelInputReason = 'country' | 'input';
|
|
10
|
-
export interface MuiTelInputInfo {
|
|
11
|
-
countryCode: MuiTelInputCountry | null;
|
|
12
|
-
countryCallingCode: string | null;
|
|
13
|
-
nationalNumber: string | null;
|
|
14
|
-
numberType: Exclude<NumberType, undefined> | null;
|
|
15
|
-
numberValue: string | null;
|
|
16
|
-
reason: MuiTelInputReason;
|
|
17
|
-
}
|
|
18
|
-
export interface MuiTelInputProps extends BaseTextFieldProps {
|
|
19
|
-
excludedCountries?: MuiTelInputCountry[];
|
|
20
|
-
onlyCountries?: MuiTelInputCountry[];
|
|
21
|
-
preferredCountries?: MuiTelInputCountry[];
|
|
22
|
-
defaultCountry?: MuiTelInputCountry;
|
|
23
|
-
forceCallingCode?: boolean;
|
|
24
|
-
focusOnSelectCountry?: boolean;
|
|
25
|
-
disableDropdown?: boolean;
|
|
26
|
-
flagSize?: FlagSize;
|
|
27
|
-
langOfCountryName?: string;
|
|
28
|
-
disableFormatting?: boolean;
|
|
29
|
-
continents?: MuiTelInputContinent[];
|
|
30
|
-
onChange?: (value: string, info: MuiTelInputInfo) => void;
|
|
31
|
-
value?: string | undefined;
|
|
32
|
-
MenuProps?: Partial<MenuProps>;
|
|
33
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { MuiTelInputCountry } from '../constants/countries';
|
|
2
|
-
export type MuiTelInputContinent = 'EU' | 'AS' | 'NA' | 'SA' | 'OC' | 'AF';
|
|
3
|
-
type Continents = {
|
|
4
|
-
[key in MuiTelInputContinent]: MuiTelInputCountry[];
|
|
5
|
-
};
|
|
6
|
-
export declare const CONTINENTS: Continents;
|
|
7
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const COUNTRIES: import("libphonenumber-js/types").Countries;
|
|
2
|
-
export declare const ISO_CODES: import("libphonenumber-js").CountryCode[];
|
|
3
|
-
export type MuiTelInputCountry = (typeof ISO_CODES)[number];
|
|
4
|
-
export declare const DEFAULT_ISO_CODE: MuiTelInputCountry;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_LANG = "en";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { MuiTelInputContinent } from '../constants/continents';
|
|
2
|
-
import { MuiTelInputCountry } from '../constants/countries';
|
|
3
|
-
type FilterCountriesOptions = {
|
|
4
|
-
onlyCountries?: readonly MuiTelInputCountry[];
|
|
5
|
-
excludedCountries?: readonly MuiTelInputCountry[];
|
|
6
|
-
preferredCountries?: readonly MuiTelInputCountry[];
|
|
7
|
-
continents?: readonly MuiTelInputContinent[];
|
|
8
|
-
};
|
|
9
|
-
export declare function getCallingCodeOfCountry(isoCode: MuiTelInputCountry): string;
|
|
10
|
-
export declare function getValidCountry(country?: MuiTelInputCountry): MuiTelInputCountry;
|
|
11
|
-
export declare function sortedPreferredCountries(countries: readonly MuiTelInputCountry[], preferredCountries: readonly MuiTelInputCountry[]): readonly MuiTelInputCountry[];
|
|
12
|
-
export declare function getCountriesOfContinents(continents: readonly MuiTelInputContinent[]): readonly MuiTelInputCountry[];
|
|
13
|
-
export declare function getOnlyCountries(countries: readonly MuiTelInputCountry[], onlyCountries: readonly MuiTelInputCountry[]): readonly MuiTelInputCountry[];
|
|
14
|
-
export declare function excludeCountries(countries: readonly MuiTelInputCountry[], excludedCountries?: readonly MuiTelInputCountry[]): readonly MuiTelInputCountry[];
|
|
15
|
-
export declare function filterCountries(countries: readonly MuiTelInputCountry[], options: FilterCountriesOptions): readonly MuiTelInputCountry[];
|
|
16
|
-
export declare function matchContinentsIncludeCountry(continents: MuiTelInputContinent[], isoCode: MuiTelInputCountry): boolean;
|
|
17
|
-
export declare function sortAlphabeticallyCountryCodes(countryCodes: readonly MuiTelInputCountry[], displayNames: Intl.DisplayNames): readonly MuiTelInputCountry[];
|
|
18
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function putCursorAtEndOfInput(inputElement: HTMLInputElement): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getDisplayNames(lang?: string): Intl.DisplayNames;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function log(...args: Parameters<Console['error']>): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function removeOccurrence(text: string, part: string | RegExp): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MuiTelInputContinent } from '../constants/continents';
|
|
3
|
-
import { MuiTelInputCountry } from '../constants/countries';
|
|
4
|
-
import { MuiTelInputInfo } from '../../index.types';
|
|
5
|
-
type UsePhoneDigitsParams = {
|
|
6
|
-
value: string;
|
|
7
|
-
onChange?: (value: string, info: MuiTelInputInfo) => void;
|
|
8
|
-
defaultCountry?: MuiTelInputCountry;
|
|
9
|
-
forceCallingCode?: boolean;
|
|
10
|
-
disableFormatting?: boolean;
|
|
11
|
-
excludedCountries?: MuiTelInputCountry[];
|
|
12
|
-
onlyCountries?: MuiTelInputCountry[];
|
|
13
|
-
continents?: MuiTelInputContinent[];
|
|
14
|
-
};
|
|
15
|
-
type State = {
|
|
16
|
-
inputValue: string;
|
|
17
|
-
isoCode: MuiTelInputCountry | null;
|
|
18
|
-
};
|
|
19
|
-
type GetInitialStateParams = {
|
|
20
|
-
defaultCountry?: MuiTelInputCountry;
|
|
21
|
-
initialValue: string;
|
|
22
|
-
forceCallingCode?: boolean;
|
|
23
|
-
disableFormatting?: boolean;
|
|
24
|
-
};
|
|
25
|
-
export declare function getInitialState(params: GetInitialStateParams): State;
|
|
26
|
-
export default function usePhoneDigits({ value, onChange, defaultCountry, onlyCountries, excludedCountries, continents, disableFormatting, forceCallingCode }: UsePhoneDigitsParams): {
|
|
27
|
-
inputValue: string;
|
|
28
|
-
isoCode: import("libphonenumber-js").CountryCode | null;
|
|
29
|
-
onInputChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
30
|
-
onCountryChange: (newCountry: MuiTelInputCountry) => void;
|
|
31
|
-
inputRef: React.RefObject<HTMLInputElement>;
|
|
32
|
-
};
|
|
33
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { MuiTelInputCountry } from '../shared/constants/countries';
|
|
2
|
-
export declare function getInputElement(): HTMLInputElement;
|
|
3
|
-
export declare function getButtonElement(): HTMLButtonElement;
|
|
4
|
-
export declare function expectButtonIsFlagOf(isoCode: MuiTelInputCountry): void;
|
|
5
|
-
export declare function expectButtonContainsCallingCode(callingCode: string): void;
|
|
6
|
-
export declare function expectButtonNotIsFlagOf(isoCode: MuiTelInputCountry): void;
|
|
7
|
-
export declare function typeInInputElement(value: string): Promise<{
|
|
8
|
-
result: string;
|
|
9
|
-
}>;
|
|
10
|
-
export declare function selectCountry(isoCode: MuiTelInputCountry): void;
|
|
11
|
-
export declare function closeFlagsMenu(): Promise<void>;
|