react-imask
Advanced tools
Comparing version 6.4.0 to 6.4.1-alpha.0
import IMask from 'imask'; | ||
import { Dispatch } from 'react'; | ||
import type { MutableRefObject } from 'react'; | ||
import type { ReactMaskProps, MaskedElement, Falsy } from './mixin'; | ||
export default function useIMask<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue']>(opts: Opts, { onAccept, onComplete }?: Pick<ReactMaskProps<Opts, Unmask, Value>, 'onAccept' | 'onComplete'>): { | ||
ref: MutableRefObject<MaskedElement>; | ||
import type { ReactMaskProps, Falsy, ReactElement } from './mixin'; | ||
export default function useIMask<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue'], MaskElement extends ReactElement = ReactElement>(opts: Opts, { onAccept, onComplete }?: Pick<ReactMaskProps<Opts, Unmask, Value, MaskElement>, 'onAccept' | 'onComplete'>): { | ||
ref: MutableRefObject<MaskElement>; | ||
maskRef: MutableRefObject<IMask.InputMask<Opts>>; | ||
@@ -8,0 +8,0 @@ value: IMask.InputMask<Opts>['value']; |
import React from 'react'; | ||
import IMask from 'imask'; | ||
export declare type Falsy = false | 0 | "" | null | undefined; | ||
export declare type MaskedElement = HTMLInputElement | HTMLTextAreaElement; | ||
export declare type ReactMaskedElement = React.HTMLProps<HTMLInputElement | HTMLTextAreaElement>; | ||
export declare type ReactMaskProps<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue']> = { | ||
export declare type ReactElement = IMask.MaskElement | HTMLTextAreaElement | HTMLInputElement; | ||
export declare type ReactElementProps<MaskElement extends ReactElement = ReactElement> = React.HTMLProps<MaskElement>; | ||
export declare type ReactMaskProps<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue'], MaskElement extends ReactElement = ReactElement> = { | ||
onAccept?: (value: Value, maskRef: IMask.InputMask<Opts>, e?: InputEvent) => void; | ||
@@ -11,6 +11,10 @@ onComplete?: (value: Value, maskRef: IMask.InputMask<Opts>, e?: InputEvent) => void; | ||
value?: Value; | ||
inputRef?: (el: MaskedElement) => void; | ||
inputRef?: React.RefCallback<MaskElement>; | ||
ref?: React.Ref<React.ComponentType<IMaskInputProps<Opts, Unmask, Value, MaskElement>>>; | ||
}; | ||
export declare type IMaskMixinProps<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue']> = Opts & ReactMaskProps<Opts, Unmask, Value>; | ||
export declare type IMaskInputProps<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue']> = ReactMaskedElement & IMaskMixinProps<Opts, Unmask, Value>; | ||
export default function IMaskMixin<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue']>(ComposedComponent: React.ComponentType<ReactMaskedElement>): React.ComponentType<IMaskInputProps<Opts, Unmask, Value>>; | ||
export declare type ReactMixinComponent<MaskElement extends ReactElement = ReactElement> = React.ComponentType<ReactElementProps<MaskElement> & { | ||
inputRef: React.RefCallback<MaskElement>; | ||
}>; | ||
export declare type IMaskMixinProps<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue'], MaskElement extends ReactElement = ReactElement> = Opts & ReactMaskProps<Opts, Unmask, Value, MaskElement>; | ||
export declare type IMaskInputProps<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue'], MaskElement extends ReactElement = ReactElement> = ReactElementProps<MaskElement> & IMaskMixinProps<Opts, Unmask, Value, MaskElement>; | ||
export default function IMaskMixin<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue'], MaskElement extends ReactElement = ReactElement>(ComposedComponent: ReactMixinComponent<MaskElement>): React.ComponentType<IMaskInputProps<Opts, Unmask, Value, MaskElement>>; |
@@ -394,4 +394,3 @@ (function (global, factory) { | ||
var _excluded = ["inputRef"]; | ||
var InputComponent = function InputComponent(_ref) { | ||
var IMaskInputClass = IMaskMixin(function (_ref) { | ||
var inputRef = _ref.inputRef, | ||
@@ -403,10 +402,12 @@ props = _objectWithoutProperties(_ref, _excluded); | ||
})); | ||
}); | ||
var IMaskInputFn = function IMaskInputFn(props, ref) { | ||
return React__default["default"].createElement(IMaskInputClass, Object.assign({}, props, { | ||
ref: ref | ||
})); | ||
}; | ||
var IMaskInputClass = IMaskMixin(InputComponent); | ||
var IMaskInput = React__default["default"].forwardRef(IMaskInputFn); | ||
var IMaskInput = function IMaskInput(props) { | ||
return React__default["default"].createElement(IMaskInputClass, props); | ||
}; | ||
function useIMask(opts) { | ||
@@ -413,0 +414,0 @@ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, |
import IMask from 'imask'; | ||
import { Dispatch } from 'react'; | ||
import type { MutableRefObject } from 'react'; | ||
import type { ReactMaskProps, MaskedElement, Falsy } from './mixin'; | ||
export default function useIMask<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue']>(opts: Opts, { onAccept, onComplete }?: Pick<ReactMaskProps<Opts, Unmask, Value>, 'onAccept' | 'onComplete'>): { | ||
ref: MutableRefObject<MaskedElement>; | ||
import type { ReactMaskProps, Falsy, ReactElement } from './mixin'; | ||
export default function useIMask<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue'], MaskElement extends ReactElement = ReactElement>(opts: Opts, { onAccept, onComplete }?: Pick<ReactMaskProps<Opts, Unmask, Value, MaskElement>, 'onAccept' | 'onComplete'>): { | ||
ref: MutableRefObject<MaskElement>; | ||
maskRef: MutableRefObject<IMask.InputMask<Opts>>; | ||
@@ -8,0 +8,0 @@ value: IMask.InputMask<Opts>['value']; |
@@ -8,4 +8,3 @@ import { f as _objectWithoutProperties } from './_rollupPluginBabelHelpers-9b6cc24f.js'; | ||
var _excluded = ["inputRef"]; | ||
var InputComponent = function InputComponent(_ref) { | ||
var IMaskInputClass = IMaskMixin(function (_ref) { | ||
var inputRef = _ref.inputRef, | ||
@@ -17,10 +16,12 @@ props = _objectWithoutProperties(_ref, _excluded); | ||
})); | ||
}); | ||
var IMaskInputFn = function IMaskInputFn(props, ref) { | ||
return React.createElement(IMaskInputClass, Object.assign({}, props, { | ||
ref: ref | ||
})); | ||
}; | ||
var IMaskInputClass = IMaskMixin(InputComponent); | ||
var IMaskInput = React.forwardRef(IMaskInputFn); | ||
var IMaskInput = function IMaskInput(props) { | ||
return React.createElement(IMaskInputClass, props); | ||
}; | ||
export { IMaskInput as default }; |
import React from 'react'; | ||
import IMask from 'imask'; | ||
export declare type Falsy = false | 0 | "" | null | undefined; | ||
export declare type MaskedElement = HTMLInputElement | HTMLTextAreaElement; | ||
export declare type ReactMaskedElement = React.HTMLProps<HTMLInputElement | HTMLTextAreaElement>; | ||
export declare type ReactMaskProps<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue']> = { | ||
export declare type ReactElement = IMask.MaskElement | HTMLTextAreaElement | HTMLInputElement; | ||
export declare type ReactElementProps<MaskElement extends ReactElement = ReactElement> = React.HTMLProps<MaskElement>; | ||
export declare type ReactMaskProps<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue'], MaskElement extends ReactElement = ReactElement> = { | ||
onAccept?: (value: Value, maskRef: IMask.InputMask<Opts>, e?: InputEvent) => void; | ||
@@ -11,6 +11,10 @@ onComplete?: (value: Value, maskRef: IMask.InputMask<Opts>, e?: InputEvent) => void; | ||
value?: Value; | ||
inputRef?: (el: MaskedElement) => void; | ||
inputRef?: React.RefCallback<MaskElement>; | ||
ref?: React.Ref<React.ComponentType<IMaskInputProps<Opts, Unmask, Value, MaskElement>>>; | ||
}; | ||
export declare type IMaskMixinProps<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue']> = Opts & ReactMaskProps<Opts, Unmask, Value>; | ||
export declare type IMaskInputProps<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue']> = ReactMaskedElement & IMaskMixinProps<Opts, Unmask, Value>; | ||
export default function IMaskMixin<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue']>(ComposedComponent: React.ComponentType<ReactMaskedElement>): React.ComponentType<IMaskInputProps<Opts, Unmask, Value>>; | ||
export declare type ReactMixinComponent<MaskElement extends ReactElement = ReactElement> = React.ComponentType<ReactElementProps<MaskElement> & { | ||
inputRef: React.RefCallback<MaskElement>; | ||
}>; | ||
export declare type IMaskMixinProps<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue'], MaskElement extends ReactElement = ReactElement> = Opts & ReactMaskProps<Opts, Unmask, Value, MaskElement>; | ||
export declare type IMaskInputProps<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue'], MaskElement extends ReactElement = ReactElement> = ReactElementProps<MaskElement> & IMaskMixinProps<Opts, Unmask, Value, MaskElement>; | ||
export default function IMaskMixin<Opts extends IMask.AnyMaskedOptions = IMask.AnyMaskedOptions, Unmask extends ('typed' | boolean) = false, Value = Unmask extends 'typed' ? IMask.InputMask<Opts>['typedValue'] : Unmask extends Falsy ? IMask.InputMask<Opts>['value'] : IMask.InputMask<Opts>['unmaskedValue'], MaskElement extends ReactElement = ReactElement>(ComposedComponent: ReactMixinComponent<MaskElement>): React.ComponentType<IMaskInputProps<Opts, Unmask, Value, MaskElement>>; |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "6.4.0", | ||
"version": "6.4.1-alpha.0", | ||
"homepage": "https://imask.js.org/", | ||
@@ -24,3 +24,3 @@ "description": "React input mask", | ||
"dependencies": { | ||
"imask": "^6.4.0", | ||
"imask": "^6.4.1-alpha.0", | ||
"prop-types": "^15.7.2" | ||
@@ -34,3 +34,3 @@ }, | ||
}, | ||
"gitHead": "14e1666a9796c439e55a1e6dfa8710f72c9ecf8d", | ||
"gitHead": "52eb25edb42b436fe2c66c74fddbda82f110429f", | ||
"devDependencies": { | ||
@@ -37,0 +37,0 @@ "@types/react": "^17.0.15", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
255356
1689
1
Updatedimask@^6.4.1-alpha.0