@flywire/react-headlessui
Advanced tools
Comparing version 0.0.12 to 0.0.13-1
@@ -10,7 +10,7 @@ "use strict"; | ||
const NO_VALUE = ''; | ||
function useMaskInput({ initialValue = NO_VALUE, mask, onChange = () => { | ||
function useMaskInput({ mask, onChange = () => { | ||
// does nothing | ||
}, ...rest }) { | ||
const inputRef = (0, react_1.useRef)(null); | ||
const [value, setValue] = (0, react_1.useState)(initialValue); | ||
const [value, setValue] = (0, react_1.useState)(NO_VALUE); | ||
const runAfterUpdate = (0, useRunAfterUpdate_1.default)(); | ||
@@ -17,0 +17,0 @@ function handleInputChange(evt) { |
@@ -6,3 +6,3 @@ "use strict"; | ||
const afterPaintRef = (0, react_1.useRef)(); | ||
(0, react_1.useEffect)(() => { | ||
(0, react_1.useLayoutEffect)(() => { | ||
var _a; | ||
@@ -9,0 +9,0 @@ if (afterPaintRef.current) { |
import { ChangeEvent, InputHTMLAttributes } from 'react'; | ||
interface Props extends InputHTMLAttributes<HTMLInputElement> { | ||
initialValue?: string; | ||
mask: string; | ||
} | ||
declare function useMaskInput({ initialValue, mask, onChange, ...rest }: Props): { | ||
declare function useMaskInput({ mask, onChange, ...rest }: Props): { | ||
inputProps: { | ||
@@ -8,0 +7,0 @@ accept?: string | undefined; |
@@ -5,7 +5,7 @@ import { useRef, useState } from 'react'; | ||
const NO_VALUE = ''; | ||
function useMaskInput({ initialValue = NO_VALUE, mask, onChange = () => { | ||
function useMaskInput({ mask, onChange = () => { | ||
// does nothing | ||
}, ...rest }) { | ||
const inputRef = useRef(null); | ||
const [value, setValue] = useState(initialValue); | ||
const [value, setValue] = useState(NO_VALUE); | ||
const runAfterUpdate = useRunAfterUpdate(); | ||
@@ -12,0 +12,0 @@ function handleInputChange(evt) { |
@@ -1,5 +0,5 @@ | ||
import { useRef, useEffect } from 'react'; | ||
import { useRef, useLayoutEffect } from 'react'; | ||
function useRunAfterUpdate() { | ||
const afterPaintRef = useRef(); | ||
useEffect(() => { | ||
useLayoutEffect(() => { | ||
var _a; | ||
@@ -6,0 +6,0 @@ if (afterPaintRef.current) { |
import { ChangeEvent, InputHTMLAttributes } from 'react'; | ||
interface Props extends InputHTMLAttributes<HTMLInputElement> { | ||
initialValue?: string; | ||
mask: string; | ||
} | ||
declare function useMaskInput({ initialValue, mask, onChange, ...rest }: Props): { | ||
declare function useMaskInput({ mask, onChange, ...rest }: Props): { | ||
inputProps: { | ||
@@ -8,0 +7,0 @@ accept?: string | undefined; |
@@ -19,7 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
const NO_VALUE = ''; | ||
function useMaskInput({ initialValue = NO_VALUE, mask, onChange = () => { | ||
function useMaskInput({ mask, onChange = () => { | ||
// does nothing | ||
}, ...rest }) { | ||
const inputRef = (0, react_1.useRef)(null); | ||
const [value, setValue] = (0, react_1.useState)(initialValue); | ||
const [value, setValue] = (0, react_1.useState)(NO_VALUE); | ||
const runAfterUpdate = (0, useRunAfterUpdate_1.default)(); | ||
@@ -26,0 +26,0 @@ function handleInputChange(evt) { |
@@ -15,3 +15,3 @@ (function (factory) { | ||
const afterPaintRef = (0, react_1.useRef)(); | ||
(0, react_1.useEffect)(() => { | ||
(0, react_1.useLayoutEffect)(() => { | ||
var _a; | ||
@@ -18,0 +18,0 @@ if (afterPaintRef.current) { |
import { ChangeEvent, InputHTMLAttributes } from 'react'; | ||
interface Props extends InputHTMLAttributes<HTMLInputElement> { | ||
initialValue?: string; | ||
mask: string; | ||
} | ||
declare function useMaskInput({ initialValue, mask, onChange, ...rest }: Props): { | ||
declare function useMaskInput({ mask, onChange, ...rest }: Props): { | ||
inputProps: { | ||
@@ -8,0 +7,0 @@ accept?: string | undefined; |
{ | ||
"name": "@flywire/react-headlessui", | ||
"version": "0.0.12", | ||
"version": "0.0.13-1", | ||
"description": "Headless UI components", | ||
@@ -5,0 +5,0 @@ "main": "./dist/umd/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
299155
4813