mui-tel-input 3.1.2 → 3.2.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/dist/index.d.ts +6 -0
- package/dist/index.types.d.ts +33 -0
- package/dist/mui-tel-input.es.js +1750 -1518
- package/dist/mui-tel-input.umd.js +16 -18
- package/dist/shared/constants/continents.d.ts +7 -0
- package/dist/shared/constants/countries.d.ts +4 -0
- package/dist/shared/constants/flags.d.ts +6 -0
- package/dist/shared/constants/lang.d.ts +1 -0
- package/dist/shared/helpers/array.d.ts +2 -0
- package/dist/shared/helpers/country.d.ts +18 -0
- package/dist/shared/helpers/dom.d.ts +1 -0
- package/dist/shared/helpers/intl.d.ts +1 -0
- package/dist/shared/helpers/log.d.ts +1 -0
- package/dist/shared/helpers/object.d.ts +2 -0
- package/dist/shared/helpers/ref.d.ts +2 -0
- package/dist/shared/helpers/string.d.ts +1 -0
- package/dist/shared/hooks/useMissmatchProps.d.ts +2 -0
- package/dist/shared/hooks/usePhoneDigits.d.ts +33 -0
- package/package.json +39 -37
|
@@ -0,0 +1,7 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,4 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEFAULT_LANG = "en";
|
|
@@ -0,0 +1,18 @@
|
|
|
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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function putCursorAtEndOfInput(inputElement: HTMLInputElement): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDisplayNames(lang?: string): Intl.DisplayNames;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function log(...args: Parameters<Console['error']>): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function removeOccurrence(text: string, part: string | RegExp): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
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 {};
|
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": "3.
|
|
10
|
+
"version": "3.2.0",
|
|
11
11
|
"files": [
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"build": "vite build",
|
|
42
42
|
"lint": "tsc && eslint . --ext .js,.jsx,.ts,.tsx",
|
|
43
43
|
"lint:fix": "npm run lint -- --fix",
|
|
44
|
-
"storybook": "
|
|
45
|
-
"build-storybook": "build
|
|
44
|
+
"storybook": "storybook dev -p 6006",
|
|
45
|
+
"build-storybook": "storybook build",
|
|
46
46
|
"test": "vitest",
|
|
47
47
|
"release": "standard-version",
|
|
48
48
|
"coverage": "vitest run --coverage",
|
|
@@ -71,51 +71,53 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"
|
|
74
|
+
"@types/node": "^20.2.5",
|
|
75
|
+
"libphonenumber-js": "^1.10.30"
|
|
75
76
|
},
|
|
76
77
|
"devDependencies": {
|
|
77
|
-
"@babel/core": "^7.
|
|
78
|
-
"@emotion/react": "^11.
|
|
79
|
-
"@emotion/styled": "^11.
|
|
80
|
-
"@mui/material": "^5.
|
|
81
|
-
"@storybook/addon-actions": "^
|
|
82
|
-
"@storybook/addon-essentials": "^
|
|
83
|
-
"@storybook/addon-interactions": "^
|
|
84
|
-
"@storybook/addon-links": "^
|
|
85
|
-
"@storybook/react": "^
|
|
86
|
-
"@storybook/
|
|
78
|
+
"@babel/core": "^7.22.1",
|
|
79
|
+
"@emotion/react": "^11.11.0",
|
|
80
|
+
"@emotion/styled": "^11.11.0",
|
|
81
|
+
"@mui/material": "^5.13.2",
|
|
82
|
+
"@storybook/addon-actions": "^7.0.18",
|
|
83
|
+
"@storybook/addon-essentials": "^7.0.18",
|
|
84
|
+
"@storybook/addon-interactions": "^7.0.18",
|
|
85
|
+
"@storybook/addon-links": "^7.0.18",
|
|
86
|
+
"@storybook/react": "^7.0.18",
|
|
87
|
+
"@storybook/react-vite": "^7.0.18",
|
|
88
|
+
"@storybook/testing-library": "^0.1.0",
|
|
87
89
|
"@testing-library/jest-dom": "^5.16.5",
|
|
88
|
-
"@testing-library/react": "^
|
|
90
|
+
"@testing-library/react": "^14.0.0",
|
|
89
91
|
"@testing-library/user-event": "^14.4.3",
|
|
90
|
-
"@types/
|
|
91
|
-
"@
|
|
92
|
-
"@typescript-eslint/
|
|
93
|
-
"@
|
|
94
|
-
"@
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"eslint": "^8.24.0",
|
|
92
|
+
"@types/react": "^18.2.7",
|
|
93
|
+
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
|
94
|
+
"@typescript-eslint/parser": "^5.59.7",
|
|
95
|
+
"@viclafouch/eslint-config-viclafouch": "^3.9.2",
|
|
96
|
+
"@vitejs/plugin-react": "^4.0.0",
|
|
97
|
+
"babel-loader": "^9.1.2",
|
|
98
|
+
"eslint": "^8.41.0",
|
|
98
99
|
"eslint-config-airbnb": "^19.0.4",
|
|
99
100
|
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
100
|
-
"eslint-config-prettier": "^8.
|
|
101
|
-
"eslint-plugin-import": "^2.
|
|
102
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
101
|
+
"eslint-config-prettier": "^8.8.0",
|
|
102
|
+
"eslint-plugin-import": "^2.27.5",
|
|
103
|
+
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
103
104
|
"eslint-plugin-prettier": "^4.2.1",
|
|
104
|
-
"eslint-plugin-react": "^7.
|
|
105
|
+
"eslint-plugin-react": "^7.32.2",
|
|
105
106
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
106
|
-
"eslint-plugin-simple-import-sort": "^
|
|
107
|
-
"eslint-plugin-testing-library": "^5.
|
|
108
|
-
"husky": "^8.0.
|
|
109
|
-
"jsdom": "^
|
|
110
|
-
"prettier": "^2.
|
|
107
|
+
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
108
|
+
"eslint-plugin-testing-library": "^5.11.0",
|
|
109
|
+
"husky": "^8.0.3",
|
|
110
|
+
"jsdom": "^22.1.0",
|
|
111
|
+
"prettier": "^2.8.8",
|
|
111
112
|
"react": "^18.2.0",
|
|
112
113
|
"react-dom": "^18.2.0",
|
|
113
114
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
114
115
|
"standard-version": "^9.5.0",
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"vite
|
|
118
|
-
"vite-
|
|
119
|
-
"
|
|
116
|
+
"storybook": "^7.0.18",
|
|
117
|
+
"typescript": "^5.0.4",
|
|
118
|
+
"vite": "^4.3.9",
|
|
119
|
+
"vite-aliases": "^0.11.2",
|
|
120
|
+
"vite-plugin-dts": "^2.3.0",
|
|
121
|
+
"vitest": "^0.31.1"
|
|
120
122
|
}
|
|
121
123
|
}
|