mui-tel-input 3.2.2 → 4.0.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/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.2.2",
10
+ "version": "4.0.0",
11
11
  "files": [
12
12
  "dist"
13
13
  ],
@@ -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": "^17.0.0 || ^18.0.0",
65
- "react": "^17.0.0 || ^18.0.0",
66
- "react-dom": "^17.0.0 || ^18.0.0"
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.3.3",
75
- "libphonenumber-js": "^1.10.37"
74
+ "@types/node": "^20.4.7",
75
+ "libphonenumber-js": "^1.10.39"
76
76
  },
77
77
  "devDependencies": {
78
- "@babel/core": "^7.22.5",
78
+ "@babel/core": "^7.22.9",
79
79
  "@emotion/react": "^11.11.1",
80
80
  "@emotion/styled": "^11.11.0",
81
- "@mui/material": "^5.13.6",
82
- "@storybook/addon-actions": "^7.0.24",
83
- "@storybook/addon-essentials": "^7.0.24",
84
- "@storybook/addon-interactions": "^7.0.24",
85
- "@storybook/addon-links": "^7.0.24",
86
- "@storybook/react": "^7.0.24",
87
- "@storybook/react-vite": "^7.0.24",
81
+ "@mui/material": "^5.14.3",
82
+ "@storybook/addon-actions": "^7.2.1",
83
+ "@storybook/addon-essentials": "^7.2.1",
84
+ "@storybook/addon-interactions": "^7.2.1",
85
+ "@storybook/addon-links": "^7.2.1",
86
+ "@storybook/react": "^7.2.1",
87
+ "@storybook/react-vite": "^7.2.1",
88
88
  "@storybook/testing-library": "^0.2.0",
89
- "@testing-library/jest-dom": "^5.16.5",
89
+ "@testing-library/jest-dom": "^5.17.0",
90
90
  "@testing-library/react": "^14.0.0",
91
91
  "@testing-library/user-event": "^14.4.3",
92
- "@types/react": "^18.2.14",
93
- "@typescript-eslint/eslint-plugin": "^5.60.1",
94
- "@typescript-eslint/parser": "^5.60.1",
95
- "@viclafouch/eslint-config-viclafouch": "^3.9.2",
96
- "@vitejs/plugin-react": "^4.0.1",
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",
92
+ "@types/react": "^18.2.18",
93
+ "@viclafouch/eslint-config-viclafouch": "^4.1.1",
94
+ "@vitejs/plugin-react": "^4.0.4",
95
+ "babel-loader": "^9.1.3",
96
+ "eslint": "^8.46.0",
109
97
  "husky": "^8.0.3",
110
98
  "jsdom": "^22.1.0",
111
- "prettier": "^2.8.8",
99
+ "prettier": "^3.0.1",
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.0.24",
104
+ "storybook": "^7.2.1",
117
105
  "typescript": "^5.1.6",
118
- "vite": "^4.3.9",
106
+ "vite": "^4.4.8",
119
107
  "vite-aliases": "^0.11.2",
120
- "vite-plugin-dts": "^3.0.2",
121
- "vitest": "^0.32.2"
108
+ "vite-plugin-dts": "^3.5.0",
109
+ "vitest": "^0.34.1"
122
110
  }
123
111
  }
@@ -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>;
File without changes
@@ -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,6 +0,0 @@
1
- type Flags = {
2
- AC: string;
3
- TA: string;
4
- };
5
- export declare const FLAGS_SVG: Flags;
6
- export {};
@@ -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,2 +0,0 @@
1
- export declare function matchIsArray(value: unknown, filled?: boolean): value is unknown[];
2
- export declare function getFirstIntersection<T extends unknown[]>(arrayA: T, arrayB: T): T[number] | null;
@@ -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,2 +0,0 @@
1
- export declare function matchIsObject(value: unknown): value is object;
2
- export declare const getKeys: <T>(object: T) => (keyof T)[];
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare function assocRefToPropRef(ref: unknown, propRef: React.Ref<unknown> | undefined): void;
@@ -1 +0,0 @@
1
- export declare function removeOccurrence(text: string, part: string | RegExp): string;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { MuiTelInputProps } from '../../index.types';
2
- export declare function useMismatchProps(props: MuiTelInputProps): void;
@@ -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>;