@react-aria/textfield
Advanced tools
Comparing version 3.0.0-nightly.2912 to 3.0.0-nightly.2917
@@ -25,4 +25,4 @@ var $9076f978e02df845$exports = require("./useTextField.main.js"); | ||
function $56b68c3dab9bf16c$var$supportsNativeBeforeInputEvent() { | ||
return typeof window !== "undefined" && window.InputEvent && // @ts-ignore | ||
typeof InputEvent.prototype.getTargetRanges === "function"; | ||
return typeof window !== 'undefined' && window.InputEvent && // @ts-ignore | ||
typeof InputEvent.prototype.getTargetRanges === 'function'; | ||
} | ||
@@ -42,16 +42,16 @@ function $56b68c3dab9bf16c$export$4f384c9210e583c3(props, state, inputRef) { | ||
switch(e.inputType){ | ||
case "historyUndo": | ||
case "historyRedo": | ||
case 'historyUndo': | ||
case 'historyRedo': | ||
// Explicitly allow undo/redo. e.data is null in this case, but there's no need to validate, | ||
// because presumably the input would have already been validated previously. | ||
return; | ||
case "insertLineBreak": | ||
case 'insertLineBreak': | ||
// Explicitly allow "insertLineBreak" event, to allow onSubmit for "enter" key. e.data is null in this case. | ||
return; | ||
case "deleteContent": | ||
case "deleteByCut": | ||
case "deleteByDrag": | ||
case 'deleteContent': | ||
case 'deleteByCut': | ||
case 'deleteByDrag': | ||
nextValue = input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd); | ||
break; | ||
case "deleteContentForward": | ||
case 'deleteContentForward': | ||
// This is potentially incorrect, since the browser may actually delete more than a single UTF-16 | ||
@@ -63,7 +63,7 @@ // character. In reality, a full Unicode grapheme cluster consisting of multiple UTF-16 characters | ||
break; | ||
case "deleteContentBackward": | ||
case 'deleteContentBackward': | ||
nextValue = input.selectionEnd === input.selectionStart ? input.value.slice(0, input.selectionStart - 1) + input.value.slice(input.selectionStart) : input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd); | ||
break; | ||
case "deleteSoftLineBackward": | ||
case "deleteHardLineBackward": | ||
case 'deleteSoftLineBackward': | ||
case 'deleteHardLineBackward': | ||
nextValue = input.value.slice(input.selectionStart); | ||
@@ -83,5 +83,5 @@ break; | ||
let input = inputRef.current; | ||
input.addEventListener("beforeinput", onBeforeInputFallback, false); | ||
input.addEventListener('beforeinput', onBeforeInputFallback, false); | ||
return ()=>{ | ||
input.removeEventListener("beforeinput", onBeforeInputFallback, false); | ||
input.removeEventListener('beforeinput', onBeforeInputFallback, false); | ||
}; | ||
@@ -88,0 +88,0 @@ }, [ |
@@ -19,4 +19,4 @@ import {useTextField as $2d73ec29415bd339$export$712718f7aec83d5} from "./useTextField.module.js"; | ||
function $d841c8010a73d545$var$supportsNativeBeforeInputEvent() { | ||
return typeof window !== "undefined" && window.InputEvent && // @ts-ignore | ||
typeof InputEvent.prototype.getTargetRanges === "function"; | ||
return typeof window !== 'undefined' && window.InputEvent && // @ts-ignore | ||
typeof InputEvent.prototype.getTargetRanges === 'function'; | ||
} | ||
@@ -36,16 +36,16 @@ function $d841c8010a73d545$export$4f384c9210e583c3(props, state, inputRef) { | ||
switch(e.inputType){ | ||
case "historyUndo": | ||
case "historyRedo": | ||
case 'historyUndo': | ||
case 'historyRedo': | ||
// Explicitly allow undo/redo. e.data is null in this case, but there's no need to validate, | ||
// because presumably the input would have already been validated previously. | ||
return; | ||
case "insertLineBreak": | ||
case 'insertLineBreak': | ||
// Explicitly allow "insertLineBreak" event, to allow onSubmit for "enter" key. e.data is null in this case. | ||
return; | ||
case "deleteContent": | ||
case "deleteByCut": | ||
case "deleteByDrag": | ||
case 'deleteContent': | ||
case 'deleteByCut': | ||
case 'deleteByDrag': | ||
nextValue = input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd); | ||
break; | ||
case "deleteContentForward": | ||
case 'deleteContentForward': | ||
// This is potentially incorrect, since the browser may actually delete more than a single UTF-16 | ||
@@ -57,7 +57,7 @@ // character. In reality, a full Unicode grapheme cluster consisting of multiple UTF-16 characters | ||
break; | ||
case "deleteContentBackward": | ||
case 'deleteContentBackward': | ||
nextValue = input.selectionEnd === input.selectionStart ? input.value.slice(0, input.selectionStart - 1) + input.value.slice(input.selectionStart) : input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd); | ||
break; | ||
case "deleteSoftLineBackward": | ||
case "deleteHardLineBackward": | ||
case 'deleteSoftLineBackward': | ||
case 'deleteHardLineBackward': | ||
nextValue = input.value.slice(input.selectionStart); | ||
@@ -77,5 +77,5 @@ break; | ||
let input = inputRef.current; | ||
input.addEventListener("beforeinput", onBeforeInputFallback, false); | ||
input.addEventListener('beforeinput', onBeforeInputFallback, false); | ||
return ()=>{ | ||
input.removeEventListener("beforeinput", onBeforeInputFallback, false); | ||
input.removeEventListener('beforeinput', onBeforeInputFallback, false); | ||
}; | ||
@@ -82,0 +82,0 @@ }, [ |
@@ -33,4 +33,4 @@ var $4Z7CR$react = require("react"); | ||
function $9076f978e02df845$export$712718f7aec83d5(props, ref) { | ||
let { inputElementType: inputElementType = "input", isDisabled: isDisabled = false, isRequired: isRequired = false, isReadOnly: isReadOnly = false, type: type = "text", validationBehavior: validationBehavior = "aria" } = props; | ||
let [value, setValue] = (0, $4Z7CR$reactstatelyutils.useControlledState)(props.value, props.defaultValue || "", props.onChange); | ||
let { inputElementType: inputElementType = 'input', isDisabled: isDisabled = false, isRequired: isRequired = false, isReadOnly: isReadOnly = false, type: type = 'text', validationBehavior: validationBehavior = 'aria' } = props; | ||
let [value, setValue] = (0, $4Z7CR$reactstatelyutils.useControlledState)(props.value, props.defaultValue || '', props.onChange); | ||
let { focusableProps: focusableProps } = (0, $4Z7CR$reactariafocus.useFocusable)(props, ref); | ||
@@ -66,3 +66,3 @@ let validationState = (0, $4Z7CR$reactstatelyform.useFormValidationState)({ | ||
let input = ref.current; | ||
Object.defineProperty(input, "defaultValue", { | ||
Object.defineProperty(input, 'defaultValue', { | ||
get: ()=>input.value, | ||
@@ -78,12 +78,12 @@ set: ()=>{}, | ||
labelProps: labelProps, | ||
inputProps: (0, $4Z7CR$reactariautils.mergeProps)(domProps, inputElementType === "input" && inputOnlyProps, { | ||
inputProps: (0, $4Z7CR$reactariautils.mergeProps)(domProps, inputElementType === 'input' && inputOnlyProps, { | ||
disabled: isDisabled, | ||
readOnly: isReadOnly, | ||
required: isRequired && validationBehavior === "native", | ||
"aria-required": isRequired && validationBehavior === "aria" || undefined, | ||
"aria-invalid": isInvalid || undefined, | ||
"aria-errormessage": props["aria-errormessage"], | ||
"aria-activedescendant": props["aria-activedescendant"], | ||
"aria-autocomplete": props["aria-autocomplete"], | ||
"aria-haspopup": props["aria-haspopup"], | ||
required: isRequired && validationBehavior === 'native', | ||
'aria-required': isRequired && validationBehavior === 'aria' || undefined, | ||
'aria-invalid': isInvalid || undefined, | ||
'aria-errormessage': props['aria-errormessage'], | ||
'aria-activedescendant': props['aria-activedescendant'], | ||
'aria-autocomplete': props['aria-autocomplete'], | ||
'aria-haspopup': props['aria-haspopup'], | ||
value: value, | ||
@@ -90,0 +90,0 @@ onChange: (e)=>setValue(e.target.value), |
@@ -27,4 +27,4 @@ import {useEffect as $ig234$useEffect} from "react"; | ||
function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) { | ||
let { inputElementType: inputElementType = "input", isDisabled: isDisabled = false, isRequired: isRequired = false, isReadOnly: isReadOnly = false, type: type = "text", validationBehavior: validationBehavior = "aria" } = props; | ||
let [value, setValue] = (0, $ig234$useControlledState)(props.value, props.defaultValue || "", props.onChange); | ||
let { inputElementType: inputElementType = 'input', isDisabled: isDisabled = false, isRequired: isRequired = false, isReadOnly: isReadOnly = false, type: type = 'text', validationBehavior: validationBehavior = 'aria' } = props; | ||
let [value, setValue] = (0, $ig234$useControlledState)(props.value, props.defaultValue || '', props.onChange); | ||
let { focusableProps: focusableProps } = (0, $ig234$useFocusable)(props, ref); | ||
@@ -60,3 +60,3 @@ let validationState = (0, $ig234$useFormValidationState)({ | ||
let input = ref.current; | ||
Object.defineProperty(input, "defaultValue", { | ||
Object.defineProperty(input, 'defaultValue', { | ||
get: ()=>input.value, | ||
@@ -72,12 +72,12 @@ set: ()=>{}, | ||
labelProps: labelProps, | ||
inputProps: (0, $ig234$mergeProps)(domProps, inputElementType === "input" && inputOnlyProps, { | ||
inputProps: (0, $ig234$mergeProps)(domProps, inputElementType === 'input' && inputOnlyProps, { | ||
disabled: isDisabled, | ||
readOnly: isReadOnly, | ||
required: isRequired && validationBehavior === "native", | ||
"aria-required": isRequired && validationBehavior === "aria" || undefined, | ||
"aria-invalid": isInvalid || undefined, | ||
"aria-errormessage": props["aria-errormessage"], | ||
"aria-activedescendant": props["aria-activedescendant"], | ||
"aria-autocomplete": props["aria-autocomplete"], | ||
"aria-haspopup": props["aria-haspopup"], | ||
required: isRequired && validationBehavior === 'native', | ||
'aria-required': isRequired && validationBehavior === 'aria' || undefined, | ||
'aria-invalid': isInvalid || undefined, | ||
'aria-errormessage': props['aria-errormessage'], | ||
'aria-activedescendant': props['aria-activedescendant'], | ||
'aria-autocomplete': props['aria-autocomplete'], | ||
'aria-haspopup': props['aria-haspopup'], | ||
value: value, | ||
@@ -84,0 +84,0 @@ onChange: (e)=>setValue(e.target.value), |
{ | ||
"name": "@react-aria/textfield", | ||
"version": "3.0.0-nightly.2912+d80999e89", | ||
"version": "3.0.0-nightly.2917+c34886769", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,10 +25,10 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/focus": "3.0.0-nightly.2912+d80999e89", | ||
"@react-aria/form": "3.0.5-nightly.4624+d80999e89", | ||
"@react-aria/label": "3.0.0-nightly.2912+d80999e89", | ||
"@react-aria/utils": "3.0.0-nightly.2912+d80999e89", | ||
"@react-stately/form": "3.0.3-nightly.4624+d80999e89", | ||
"@react-stately/utils": "3.0.0-nightly.2912+d80999e89", | ||
"@react-types/shared": "3.0.0-nightly.2912+d80999e89", | ||
"@react-types/textfield": "3.0.0-nightly.2912+d80999e89", | ||
"@react-aria/focus": "3.0.0-nightly.2917+c34886769", | ||
"@react-aria/form": "3.0.6-nightly.4629+c34886769", | ||
"@react-aria/label": "3.0.0-nightly.2917+c34886769", | ||
"@react-aria/utils": "3.0.0-nightly.2917+c34886769", | ||
"@react-stately/form": "3.0.4-nightly.4629+c34886769", | ||
"@react-stately/utils": "3.0.0-nightly.2917+c34886769", | ||
"@react-types/shared": "3.0.0-nightly.2917+c34886769", | ||
"@react-types/textfield": "3.0.0-nightly.2917+c34886769", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -42,3 +42,3 @@ }, | ||
}, | ||
"gitHead": "d80999e897b4d4db9fcfb4e9b8fcdc9fdd700882" | ||
"gitHead": "c34886769d3e69bb56553a02eead6a0fd877e754" | ||
} |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package