mui-tel-input 3.1.2 → 3.1.3
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/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/dist/vite-env.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MuiTelInputContinent, MuiTelInputCountry, MuiTelInputInfo, MuiTelInputProps, MuiTelInputReason } from './index.types';
|
|
3
|
+
export { isValidPhoneNumber as matchIsValidTel, AsYouType, getNumberType } from 'libphonenumber-js';
|
|
4
|
+
export type { MuiTelInputProps, MuiTelInputReason, MuiTelInputInfo, MuiTelInputCountry, MuiTelInputContinent };
|
|
5
|
+
declare const MuiTelInput: React.ForwardRefExoticComponent<Pick<MuiTelInputProps, "onChange" | "classes" | "className" | "style" | "children" | "color" | "disabled" | "error" | "fullWidth" | "focused" | "hiddenLabel" | "margin" | "required" | "size" | "sx" | "variant" | "label" | "slot" | "title" | "key" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "InputProps" | "autoComplete" | "autoFocus" | "FormHelperTextProps" | "helperText" | "InputLabelProps" | "inputProps" | "inputRef" | "name" | "rows" | "maxRows" | "minRows" | "SelectProps" | "value" | "disableDropdown" | "excludedCountries" | "onlyCountries" | "preferredCountries" | "defaultCountry" | "forceCallingCode" | "focusOnSelectCountry" | "flagSize" | "langOfCountryName" | "disableFormatting" | "continents" | "MenuProps"> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export { MuiTelInput };
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
declare type BaseTextFieldProps = Omit<TextFieldProps, 'onChange' | 'select' | 'type' | 'multiline' | 'defaultValue'>;
|
|
7
|
+
export type { MuiTelInputContinent, MuiTelInputCountry };
|
|
8
|
+
export declare type FlagSize = `small` | 'medium';
|
|
9
|
+
export declare 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
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MuiTelInputCountry } from '../constants/countries';
|
|
2
|
+
export declare type MuiTelInputContinent = 'EU' | 'AS' | 'NA' | 'SA' | 'OC' | 'AF';
|
|
3
|
+
declare 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 declare 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
|
+
declare 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
|
+
declare 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
|
+
declare type State = {
|
|
16
|
+
inputValue: string;
|
|
17
|
+
isoCode: MuiTelInputCountry | null;
|
|
18
|
+
};
|
|
19
|
+
declare 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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|