@react-aria/searchfield
Advanced tools
Comparing version 3.7.5 to 3.7.6
import { AriaButtonProps } from "@react-types/button"; | ||
import { AriaSearchFieldProps } from "@react-types/searchfield"; | ||
import { DOMAttributes, ValidationResult } from "@react-types/shared"; | ||
import { InputHTMLAttributes, LabelHTMLAttributes, RefObject } from "react"; | ||
import { DOMAttributes, RefObject, ValidationResult } from "@react-types/shared"; | ||
import { InputHTMLAttributes, LabelHTMLAttributes } from "react"; | ||
import { SearchFieldState } from "@react-stately/searchfield"; | ||
@@ -24,5 +24,5 @@ export interface SearchFieldAria extends ValidationResult { | ||
*/ | ||
export function useSearchField(props: AriaSearchFieldProps, state: SearchFieldState, inputRef: RefObject<HTMLInputElement>): SearchFieldAria; | ||
export function useSearchField(props: AriaSearchFieldProps, state: SearchFieldState, inputRef: RefObject<HTMLInputElement | null>): SearchFieldAria; | ||
export type { AriaSearchFieldProps } from '@react-types/searchfield'; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -32,8 +32,13 @@ var $8e80a08ea739bb00$exports = require("./intlStrings.main.js"); | ||
let stringFormatter = (0, $2KtRb$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($8e80a08ea739bb00$exports))), '@react-aria/searchfield'); | ||
let { isDisabled: isDisabled, isReadOnly: isReadOnly, onSubmit: onSubmit = ()=>{}, onClear: onClear, type: type = 'search' } = props; | ||
let { isDisabled: isDisabled, isReadOnly: isReadOnly, onSubmit: onSubmit, onClear: onClear, type: type = 'search' } = props; | ||
let onKeyDown = (e)=>{ | ||
const key = e.key; | ||
if (key === 'Enter') e.preventDefault(); | ||
if (key === 'Enter' && (isDisabled || isReadOnly)) e.preventDefault(); | ||
if (isDisabled || isReadOnly) return; | ||
if (key === 'Enter') onSubmit(state.value); | ||
// for backward compatibility; | ||
// otherwise, "Enter" on an input would trigger a form submit, the default browser behavior | ||
if (key === 'Enter' && onSubmit) { | ||
e.preventDefault(); | ||
onSubmit(state.value); | ||
} | ||
if (key === 'Escape') { | ||
@@ -40,0 +45,0 @@ if (state.value === '') e.continuePropagation(); |
@@ -26,8 +26,13 @@ import $kTEqN$intlStringsmodulejs from "./intlStrings.module.js"; | ||
let stringFormatter = (0, $kTEqN$useLocalizedStringFormatter)((0, ($parcel$interopDefault($kTEqN$intlStringsmodulejs))), '@react-aria/searchfield'); | ||
let { isDisabled: isDisabled, isReadOnly: isReadOnly, onSubmit: onSubmit = ()=>{}, onClear: onClear, type: type = 'search' } = props; | ||
let { isDisabled: isDisabled, isReadOnly: isReadOnly, onSubmit: onSubmit, onClear: onClear, type: type = 'search' } = props; | ||
let onKeyDown = (e)=>{ | ||
const key = e.key; | ||
if (key === 'Enter') e.preventDefault(); | ||
if (key === 'Enter' && (isDisabled || isReadOnly)) e.preventDefault(); | ||
if (isDisabled || isReadOnly) return; | ||
if (key === 'Enter') onSubmit(state.value); | ||
// for backward compatibility; | ||
// otherwise, "Enter" on an input would trigger a form submit, the default browser behavior | ||
if (key === 'Enter' && onSubmit) { | ||
e.preventDefault(); | ||
onSubmit(state.value); | ||
} | ||
if (key === 'Escape') { | ||
@@ -34,0 +39,0 @@ if (state.value === '') e.continuePropagation(); |
{ | ||
"name": "@react-aria/searchfield", | ||
"version": "3.7.5", | ||
"version": "3.7.6", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,13 +25,13 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/i18n": "^3.11.1", | ||
"@react-aria/textfield": "^3.14.5", | ||
"@react-aria/utils": "^3.24.1", | ||
"@react-stately/searchfield": "^3.5.3", | ||
"@react-types/button": "^3.9.4", | ||
"@react-types/searchfield": "^3.5.5", | ||
"@react-types/shared": "^3.23.1", | ||
"@react-aria/i18n": "^3.12.0", | ||
"@react-aria/textfield": "^3.14.6", | ||
"@react-aria/utils": "^3.25.0", | ||
"@react-stately/searchfield": "^3.5.4", | ||
"@react-types/button": "^3.9.5", | ||
"@react-types/searchfield": "^3.5.6", | ||
"@react-types/shared": "^3.24.0", | ||
"@swc/helpers": "^0.5.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0" | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0" | ||
}, | ||
@@ -41,3 +41,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433" | ||
"gitHead": "86d80e3216bc32e75108831cf3a5a720bc849206" | ||
} |
@@ -16,4 +16,4 @@ /* | ||
import {chain} from '@react-aria/utils'; | ||
import {DOMAttributes, ValidationResult} from '@react-types/shared'; | ||
import {InputHTMLAttributes, LabelHTMLAttributes, RefObject} from 'react'; | ||
import {DOMAttributes, RefObject, ValidationResult} from '@react-types/shared'; | ||
import {InputHTMLAttributes, LabelHTMLAttributes} from 'react'; | ||
// @ts-ignore | ||
@@ -47,3 +47,3 @@ import intlMessages from '../intl/*.json'; | ||
state: SearchFieldState, | ||
inputRef: RefObject<HTMLInputElement> | ||
inputRef: RefObject<HTMLInputElement | null> | ||
): SearchFieldAria { | ||
@@ -54,3 +54,3 @@ let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/searchfield'); | ||
isReadOnly, | ||
onSubmit = () => {}, | ||
onSubmit, | ||
onClear, | ||
@@ -63,3 +63,3 @@ type = 'search' | ||
if (key === 'Enter') { | ||
if (key === 'Enter' && (isDisabled || isReadOnly)) { | ||
e.preventDefault(); | ||
@@ -72,3 +72,6 @@ } | ||
if (key === 'Enter') { | ||
// for backward compatibility; | ||
// otherwise, "Enter" on an input would trigger a form submit, the default browser behavior | ||
if (key === 'Enter' && onSubmit) { | ||
e.preventDefault(); | ||
onSubmit(state.value); | ||
@@ -75,0 +78,0 @@ } |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
98659
3
80
1202
Updated@react-aria/i18n@^3.12.0
Updated@react-aria/utils@^3.25.0
Updated@react-types/button@^3.9.5
Updated@react-types/shared@^3.24.0