mui-tel-input 7.0.0 → 8.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/dist/components/Flag/Flag.d.ts +9 -0
- package/dist/components/Flag/Flag.styled.d.ts +4 -0
- package/dist/components/FlagButton/FlagButton.d.ts +16 -0
- package/dist/components/FlagButton/FlagButton.styled.d.ts +4 -0
- package/dist/components/FlagMenuItem/FlagMenuItem.d.ts +16 -0
- package/dist/components/FlagMenuItem/FlagsMenuItem.styled.d.ts +5 -0
- package/dist/components/FlagsMenu/FlagsMenu.d.ts +17 -0
- package/dist/index.types.d.ts +47 -0
- package/dist/mui-tel-input.es.js +764 -742
- package/dist/shared/constants/continents.d.ts +7 -0
- package/dist/shared/constants/countries.d.ts +5 -0
- package/dist/shared/constants/flags.d.ts +6 -0
- package/dist/shared/constants/lang.d.ts +1 -0
- package/dist/shared/helpers/__tests__/array.test.d.ts +1 -0
- package/dist/shared/helpers/__tests__/country.test.d.ts +1 -0
- package/dist/shared/helpers/__tests__/intl.test.d.ts +0 -0
- package/dist/shared/helpers/__tests__/string.test.d.ts +0 -0
- package/dist/shared/helpers/__tests__/valid-phone-number.test.d.ts +0 -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/flag.d.ts +14 -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/helpers/valid-phone-number.d.ts +7 -0
- package/dist/shared/hooks/__tests__/useMissmatch.test.d.ts +1 -0
- package/dist/shared/hooks/useAnchor.d.ts +10 -0
- package/dist/shared/hooks/useEvents.d.ts +10 -0
- package/dist/shared/hooks/useMissmatchProps.d.ts +2 -0
- package/dist/shared/hooks/usePhoneDigits.d.ts +34 -0
- package/dist/testUtils/index.d.ts +11 -0
- package/package.json +34 -34
- package/dist/index.d.ts +0 -770
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MuiTelInputCountry } from '../../shared/constants/countries';
|
|
3
|
+
export type FlagProps = {
|
|
4
|
+
isoCode: MuiTelInputCountry | null;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare const flagContainerClass = "MuiTelInput-Flag";
|
|
8
|
+
declare const Flag: ({ isoCode, children }: FlagProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default Flag;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const Styled: {
|
|
2
|
+
Flag: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
3
|
+
};
|
|
4
|
+
export { Styled };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MuiTelInputCountry } from '../../shared/constants/countries';
|
|
3
|
+
import { IconButtonProps } from '@mui/material/IconButton';
|
|
4
|
+
import { GetFlagElement } from '../../index.types';
|
|
5
|
+
export type FlagButtonProps = IconButtonProps & {
|
|
6
|
+
isoCode: MuiTelInputCountry | null;
|
|
7
|
+
forceCallingCode?: boolean;
|
|
8
|
+
isFlagsMenuOpened: boolean;
|
|
9
|
+
langOfCountryName?: string;
|
|
10
|
+
disableDropdown?: boolean;
|
|
11
|
+
getFlagElement: GetFlagElement;
|
|
12
|
+
unknownFlagElement: React.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export declare const flagButtonClass = "MuiTelInput-IconButton";
|
|
15
|
+
declare const FlagButton: ({ disableDropdown, forceCallingCode, langOfCountryName, isFlagsMenuOpened, getFlagElement, unknownFlagElement, isoCode, className, ...iconButtonProps }: FlagButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default FlagButton;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const Styled: {
|
|
2
|
+
CallingCodeSplitted: import('@emotion/styled').StyledComponent<import('@mui/material').TypographyOwnProps & import('@mui/material/OverridableComponent').CommonProps & Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxShadow" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "zIndex" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "children" | "className" | "classes" | "sx" | "variant" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, {}, {}>;
|
|
3
|
+
};
|
|
4
|
+
export { Styled };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MuiTelInputCountry } from '../../shared/constants/countries';
|
|
3
|
+
import { MenuItemProps } from '@mui/material/MenuItem';
|
|
4
|
+
import { GetFlagElement } from '../../index.types';
|
|
5
|
+
export type FlagMenuItemProps = MenuItemProps & {
|
|
6
|
+
isoCode: MuiTelInputCountry;
|
|
7
|
+
onSelectCountry: (isoCode: MuiTelInputCountry) => void;
|
|
8
|
+
countryName: string;
|
|
9
|
+
getFlagElement: GetFlagElement;
|
|
10
|
+
};
|
|
11
|
+
export declare const menuItemClass = "MuiTelInput-MenuItem";
|
|
12
|
+
export declare const listItemIconFlagClass = "MuiTelInput-ListItemIcon-flag";
|
|
13
|
+
export declare const listItemTextCountryClass = "MuiTelInput-ListItemText-country";
|
|
14
|
+
export declare const callingCodeClass = "MuiTelInput-Typography-calling-code";
|
|
15
|
+
declare const _default: React.MemoExoticComponent<({ isoCode, onSelectCountry, countryName, getFlagElement, ...restMenuItemProps }: FlagMenuItemProps) => import("react/jsx-runtime").JSX.Element>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const Styled: {
|
|
2
|
+
ListItemIcon: import('@emotion/styled').StyledComponent<import('@mui/material').ListItemIconProps & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, {}, {}>;
|
|
3
|
+
ListItemText: import('@emotion/styled').StyledComponent<import('@mui/material').ListItemTextProps<import('react').ElementType<any, keyof import("react").JSX.IntrinsicElements>, import('react').ElementType<any, keyof import("react").JSX.IntrinsicElements>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, {}, {}>;
|
|
4
|
+
};
|
|
5
|
+
export { Styled };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MuiTelInputContinent } from '../../shared/constants/continents';
|
|
2
|
+
import { MuiTelInputCountry } from '../../shared/constants/countries';
|
|
3
|
+
import { MenuProps } from '@mui/material/Menu';
|
|
4
|
+
import { GetFlagElement } from '../../index.types';
|
|
5
|
+
export type FlagsMenuProps = Partial<MenuProps> & {
|
|
6
|
+
isoCode: MuiTelInputCountry | null;
|
|
7
|
+
onlyCountries?: MuiTelInputCountry[];
|
|
8
|
+
excludedCountries?: MuiTelInputCountry[];
|
|
9
|
+
preferredCountries?: MuiTelInputCountry[];
|
|
10
|
+
langOfCountryName?: string;
|
|
11
|
+
continents?: MuiTelInputContinent[];
|
|
12
|
+
onSelectCountry: (isoCode: MuiTelInputCountry) => void;
|
|
13
|
+
getFlagElement: GetFlagElement;
|
|
14
|
+
};
|
|
15
|
+
export declare const menuClass = "MuiTelInput-Menu";
|
|
16
|
+
declare const FlagsMenu: ({ anchorEl, isoCode, onSelectCountry, excludedCountries, onlyCountries, langOfCountryName, continents, preferredCountries, className, getFlagElement, ...restMenuProps }: FlagsMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default FlagsMenu;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { NumberType } from 'libphonenumber-js';
|
|
2
|
+
import { MuiTelInputContinent } from './shared/constants/continents';
|
|
3
|
+
import { MuiTelInputCountry } from './shared/constants/countries';
|
|
4
|
+
import { IconButtonProps } from '@mui/material/IconButton';
|
|
5
|
+
import { MenuProps } from '@mui/material/Menu';
|
|
6
|
+
import { TextFieldProps } from '@mui/material/TextField';
|
|
7
|
+
type BaseTextFieldProps = Omit<TextFieldProps, 'onChange' | 'select' | 'type' | 'multiline' | 'defaultValue' | 'inputProps' | 'InputProps'>;
|
|
8
|
+
export type { MuiTelInputContinent, MuiTelInputCountry };
|
|
9
|
+
export type MuiTelInputReason = 'country' | 'input' | 'blur';
|
|
10
|
+
export type MuiTelInputFlagElement = React.ReactNode;
|
|
11
|
+
export type GetFlagElement = (isoCode: MuiTelInputCountry, { countryName, isSelected, imgProps }: {
|
|
12
|
+
countryName: string;
|
|
13
|
+
isSelected: boolean;
|
|
14
|
+
imgProps: React.ComponentPropsWithRef<'img'>;
|
|
15
|
+
}) => MuiTelInputFlagElement;
|
|
16
|
+
export interface MuiTelInputInfo {
|
|
17
|
+
countryCode: MuiTelInputCountry | null;
|
|
18
|
+
countryCallingCode: string | null;
|
|
19
|
+
nationalNumber: string | null;
|
|
20
|
+
numberType: Exclude<NumberType, undefined> | null;
|
|
21
|
+
numberValue: string | null;
|
|
22
|
+
reason: MuiTelInputReason;
|
|
23
|
+
}
|
|
24
|
+
type ForceCallingCodeWithDefaultCountry = {
|
|
25
|
+
forceCallingCode: true;
|
|
26
|
+
defaultCountry: MuiTelInputCountry;
|
|
27
|
+
} | {
|
|
28
|
+
forceCallingCode?: false | undefined;
|
|
29
|
+
defaultCountry?: MuiTelInputCountry;
|
|
30
|
+
};
|
|
31
|
+
export type MuiTelInputProps = BaseTextFieldProps & ForceCallingCodeWithDefaultCountry & {
|
|
32
|
+
excludedCountries?: MuiTelInputCountry[];
|
|
33
|
+
onlyCountries?: MuiTelInputCountry[];
|
|
34
|
+
preferredCountries?: MuiTelInputCountry[];
|
|
35
|
+
focusOnSelectCountry?: boolean;
|
|
36
|
+
disableDropdown?: boolean;
|
|
37
|
+
langOfCountryName?: string;
|
|
38
|
+
disableFormatting?: boolean;
|
|
39
|
+
continents?: MuiTelInputContinent[];
|
|
40
|
+
onChange?: (value: string, info: MuiTelInputInfo) => void;
|
|
41
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>, info: MuiTelInputInfo) => void;
|
|
42
|
+
value?: string | undefined;
|
|
43
|
+
MenuProps?: Partial<MenuProps>;
|
|
44
|
+
getFlagElement?: GetFlagElement;
|
|
45
|
+
unknownFlagElement?: MuiTelInputFlagElement;
|
|
46
|
+
FlagIconButtonProps?: Partial<IconButtonProps>;
|
|
47
|
+
};
|