@react-aria/textfield
Advanced tools
Comparing version 3.0.0-rc.1 to 3.0.0-rc.2
@@ -1,2 +0,2 @@ | ||
var _babelRuntimeHelpersEsmObjectSpread = $parcel$interopDefault(require("@babel/runtime/helpers/esm/objectSpread2")); | ||
var _babelRuntimeHelpersObjectSpread = $parcel$interopDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
@@ -11,3 +11,3 @@ var useFocusable = require("@react-aria/focus").useFocusable; | ||
function useTextField(props) { | ||
function useTextField(props, ref) { | ||
var _props$isDisabled = props.isDisabled, | ||
@@ -19,4 +19,2 @@ isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled, | ||
isReadOnly = _props$isReadOnly === void 0 ? false : _props$isReadOnly, | ||
_props$autoFocus = props.autoFocus, | ||
autoFocus = _props$autoFocus === void 0 ? false : _props$autoFocus, | ||
validationState = props.validationState, | ||
@@ -28,3 +26,3 @@ _props$type = props.type, | ||
var _useFocusable = useFocusable(props), | ||
var _useFocusable = useFocusable(props, ref), | ||
focusableProps = _useFocusable.focusableProps; | ||
@@ -38,3 +36,3 @@ | ||
labelProps: labelProps, | ||
textFieldProps: _babelRuntimeHelpersEsmObjectSpread({ | ||
textFieldProps: _babelRuntimeHelpersObjectSpread({ | ||
type: type, | ||
@@ -47,4 +45,3 @@ disabled: isDisabled, | ||
return _onChange(e.target.value); | ||
}, | ||
autoFocus: autoFocus | ||
} | ||
}, focusableProps, {}, fieldProps) | ||
@@ -51,0 +48,0 @@ }; |
import _babelRuntimeHelpersEsmObjectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import { useFocusable } from "@react-aria/focus"; | ||
import { useLabel } from "@react-aria/label"; | ||
export function useTextField(props) { | ||
export function useTextField(props, ref) { | ||
let { | ||
@@ -9,3 +9,2 @@ isDisabled = false, | ||
isReadOnly = false, | ||
autoFocus = false, | ||
validationState, | ||
@@ -17,3 +16,3 @@ type = 'text', | ||
focusableProps | ||
} = useFocusable(props); | ||
} = useFocusable(props, ref); | ||
let { | ||
@@ -31,6 +30,5 @@ labelProps, | ||
'aria-invalid': validationState === 'invalid' || undefined, | ||
onChange: e => _onChange(e.target.value), | ||
autoFocus | ||
onChange: e => _onChange(e.target.value) | ||
}, focusableProps, {}, fieldProps) | ||
}; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { InputHTMLAttributes, LabelHTMLAttributes } from "react"; | ||
import { InputHTMLAttributes, LabelHTMLAttributes, RefObject } from "react"; | ||
import { TextFieldProps } from "@react-types/textfield"; | ||
@@ -8,4 +8,4 @@ import { TextInputDOMProps } from "@react-types/shared"; | ||
} | ||
export function useTextField(props: TextFieldProps & TextInputDOMProps): TextFieldAria; | ||
export function useTextField(props: TextFieldProps & TextInputDOMProps, ref: RefObject<HTMLElement>): TextFieldAria; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@react-aria/textfield", | ||
"version": "3.0.0-rc.1", | ||
"version": "3.0.0-rc.2", | ||
"description": "Spectrum UI components in React", | ||
@@ -20,6 +20,6 @@ "license": "Apache-2.0", | ||
"@babel/runtime": "^7.6.2", | ||
"@react-aria/focus": "^3.0.0-rc.1", | ||
"@react-aria/label": "^3.0.0-rc.1", | ||
"@react-types/shared": "^3.0.0-rc.1", | ||
"@react-types/textfield": "^3.0.0-rc.1" | ||
"@react-aria/focus": "^3.0.0-rc.2", | ||
"@react-aria/label": "^3.0.0-rc.2", | ||
"@react-types/shared": "^3.0.0-rc.2", | ||
"@react-types/textfield": "^3.0.0-rc.2" | ||
}, | ||
@@ -32,3 +32,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "5a9784f0bb6c25af7422215efb31ef72caeb9600" | ||
"gitHead": "207e6ee9076905c96638a7f81a367758872e1410" | ||
} |
Sorry, the diff of this file is not supported yet
15706
7
76