@react-aria/datepicker
Advanced tools
Comparing version 3.0.0-nightly-0ddbe6f95-241021 to 3.0.0-nightly-101d0772b-250111
@@ -65,3 +65,3 @@ import { AriaDateFieldProps, AriaTimeFieldProps, DateValue, TimeValue, AriaDatePickerProps, AriaDateRangePickerProps } from "@react-types/datepicker"; | ||
interface DisplayNames { | ||
of(field: Field): string; | ||
of(field: Field): string | undefined; | ||
} | ||
@@ -68,0 +68,0 @@ /** @private */ |
@@ -50,2 +50,3 @@ var $19S5E$reactariafocus = require("@react-aria/focus"); | ||
var _window_event; | ||
if (!ref.current) return; | ||
// Try to find the segment prior to the element that was clicked on. | ||
@@ -52,0 +53,0 @@ let target = (_window_event = window.event) === null || _window_event === void 0 ? void 0 : _window_event.target; |
@@ -44,2 +44,3 @@ import {createFocusManager as $7CEvq$createFocusManager, getFocusableTreeWalker as $7CEvq$getFocusableTreeWalker} from "@react-aria/focus"; | ||
var _window_event; | ||
if (!ref.current) return; | ||
// Try to find the segment prior to the element that was clicked on. | ||
@@ -46,0 +47,0 @@ let target = (_window_event = window.event) === null || _window_event === void 0 ? void 0 : _window_event.target; |
@@ -43,3 +43,3 @@ var $4acc2f407c169e55$exports = require("./useDateField.main.js"); | ||
function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) { | ||
var _state_value, _state_value1; | ||
var _state_value, _state_value1, _state_dateRange; | ||
let stringFormatter = (0, $Xt1Bd$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($c1905b78f6d2f5bf$exports))), '@react-aria/datepicker'); | ||
@@ -109,2 +109,3 @@ let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation; | ||
let endFieldValidation = (0, $Xt1Bd$react.useRef)((0, $Xt1Bd$reactstatelyform.DEFAULT_VALIDATION_RESULT)); | ||
var _state_value_start, _state_value_end; | ||
return { | ||
@@ -148,3 +149,3 @@ groupProps: (0, $Xt1Bd$reactariautils.mergeProps)(domProps, groupProps, fieldProps, descProps, focusWithinProps, { | ||
...commonFieldProps, | ||
value: (_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.start, | ||
value: (_state_value_start = (_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.start) !== null && _state_value_start !== void 0 ? _state_value_start : null, | ||
onChange: (start)=>state.setDateTime('start', start), | ||
@@ -167,3 +168,3 @@ autoFocus: props.autoFocus, | ||
...commonFieldProps, | ||
value: (_state_value1 = state.value) === null || _state_value1 === void 0 ? void 0 : _state_value1.end, | ||
value: (_state_value_end = (_state_value1 = state.value) === null || _state_value1 === void 0 ? void 0 : _state_value1.end) !== null && _state_value_end !== void 0 ? _state_value_end : null, | ||
onChange: (end)=>state.setDateTime('end', end), | ||
@@ -186,3 +187,3 @@ name: props.endName, | ||
autoFocus: true, | ||
value: state.dateRange, | ||
value: ((_state_dateRange = state.dateRange) === null || _state_dateRange === void 0 ? void 0 : _state_dateRange.start) && state.dateRange.end ? state.dateRange : null, | ||
onChange: state.setDateRange, | ||
@@ -189,0 +190,0 @@ minValue: props.minValue, |
@@ -37,3 +37,3 @@ import {focusManagerSymbol as $16f0b7bb276bc17e$export$7b3062cd49e80452, roleSymbol as $16f0b7bb276bc17e$export$300019f83c56d282} from "./useDateField.module.js"; | ||
function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) { | ||
var _state_value, _state_value1; | ||
var _state_value, _state_value1, _state_dateRange; | ||
let stringFormatter = (0, $eIQ1H$useLocalizedStringFormatter)((0, ($parcel$interopDefault($eIQ1H$intlStringsmodulejs))), '@react-aria/datepicker'); | ||
@@ -103,2 +103,3 @@ let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation; | ||
let endFieldValidation = (0, $eIQ1H$useRef)((0, $eIQ1H$DEFAULT_VALIDATION_RESULT)); | ||
var _state_value_start, _state_value_end; | ||
return { | ||
@@ -142,3 +143,3 @@ groupProps: (0, $eIQ1H$mergeProps)(domProps, groupProps, fieldProps, descProps, focusWithinProps, { | ||
...commonFieldProps, | ||
value: (_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.start, | ||
value: (_state_value_start = (_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.start) !== null && _state_value_start !== void 0 ? _state_value_start : null, | ||
onChange: (start)=>state.setDateTime('start', start), | ||
@@ -161,3 +162,3 @@ autoFocus: props.autoFocus, | ||
...commonFieldProps, | ||
value: (_state_value1 = state.value) === null || _state_value1 === void 0 ? void 0 : _state_value1.end, | ||
value: (_state_value_end = (_state_value1 = state.value) === null || _state_value1 === void 0 ? void 0 : _state_value1.end) !== null && _state_value_end !== void 0 ? _state_value_end : null, | ||
onChange: (end)=>state.setDateTime('end', end), | ||
@@ -180,3 +181,3 @@ name: props.endName, | ||
autoFocus: true, | ||
value: state.dateRange, | ||
value: ((_state_dateRange = state.dateRange) === null || _state_dateRange === void 0 ? void 0 : _state_dateRange.start) && state.dateRange.end ? state.dateRange : null, | ||
onChange: state.setDateRange, | ||
@@ -183,0 +184,0 @@ minValue: props.minValue, |
@@ -89,7 +89,7 @@ var $4acc2f407c169e55$exports = require("./useDateField.main.js"); | ||
enteredKeys.current = ''; | ||
state.setSegment(segment.type, segment.maxValue); | ||
if (segment.maxValue !== undefined) state.setSegment(segment.type, segment.maxValue); | ||
}, | ||
onDecrementToMin: ()=>{ | ||
enteredKeys.current = ''; | ||
state.setSegment(segment.type, segment.minValue); | ||
if (segment.minValue !== undefined) state.setSegment(segment.type, segment.minValue); | ||
} | ||
@@ -224,8 +224,8 @@ }); | ||
} | ||
if (segment.value >= 12 && numberValue > 1) numberValue += 12; | ||
} else if (numberValue > segment.maxValue) segmentValue = parser.parse(key); | ||
if (segment.value !== undefined && segment.value >= 12 && numberValue > 1) numberValue += 12; | ||
} else if (segment.maxValue !== undefined && numberValue > segment.maxValue) segmentValue = parser.parse(key); | ||
if (isNaN(numberValue)) return; | ||
let shouldSetValue = segmentValue !== 0 || allowsZero; | ||
if (shouldSetValue) state.setSegment(segment.type, segmentValue); | ||
if (Number(numberValue + '0') > segment.maxValue || newValue.length >= String(segment.maxValue).length) { | ||
if (segment.maxValue !== undefined && (Number(numberValue + '0') > segment.maxValue || newValue.length >= String(segment.maxValue).length)) { | ||
enteredKeys.current = ''; | ||
@@ -240,3 +240,3 @@ if (shouldSetValue) focusManager.focusNext(); | ||
enteredKeys.current = ''; | ||
(0, $5Tgzj$reactariautils.scrollIntoViewport)(ref.current, { | ||
if (ref.current) (0, $5Tgzj$reactariautils.scrollIntoViewport)(ref.current, { | ||
containingElement: (0, $5Tgzj$reactariautils.getScrollParent)(ref.current) | ||
@@ -246,6 +246,7 @@ }); | ||
let selection = window.getSelection(); | ||
selection.collapse(ref.current); | ||
selection === null || selection === void 0 ? void 0 : selection.collapse(ref.current); | ||
}; | ||
let documentRef = (0, $5Tgzj$react.useRef)(typeof document !== 'undefined' ? document : null); | ||
(0, $5Tgzj$reactariautils.useEvent)(documentRef, 'selectionchange', ()=>{ | ||
var _ref_current; | ||
// Enforce that the selection is collapsed when inside a date segment. | ||
@@ -255,7 +256,7 @@ // Otherwise, when tapping on a segment in Android Chrome and then entering text, | ||
let selection = window.getSelection(); | ||
if (ref.current && ref.current.contains(selection.anchorNode)) selection.collapse(ref.current); | ||
if ((selection === null || selection === void 0 ? void 0 : selection.anchorNode) && ((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(selection === null || selection === void 0 ? void 0 : selection.anchorNode))) selection.collapse(ref.current); | ||
}); | ||
let compositionRef = (0, $5Tgzj$react.useRef)(''); | ||
// @ts-ignore - TODO: possibly old TS version? doesn't fail in my editor... | ||
(0, $5Tgzj$reactariautils.useEvent)(ref, 'beforeinput', (e)=>{ | ||
if (!ref.current) return; | ||
e.preventDefault(); | ||
@@ -285,6 +286,6 @@ switch(e.inputType){ | ||
// Reset the DOM to how it was in the beforeinput event. | ||
ref.current.textContent = compositionRef.current; | ||
if (ref.current) ref.current.textContent = compositionRef.current; | ||
// Android sometimes fires key presses of letters as composition events. Need to handle am/pm keys here too. | ||
// Can also happen e.g. with Pinyin keyboard on iOS. | ||
if (startsWith(am, data) || startsWith(pm, data)) onInput(data); | ||
if (data != null && (startsWith(am, data) || startsWith(pm, data))) onInput(data); | ||
break; | ||
@@ -291,0 +292,0 @@ } |
@@ -79,7 +79,7 @@ import {hookData as $16f0b7bb276bc17e$export$653eddfc964b0f8a} from "./useDateField.module.js"; | ||
enteredKeys.current = ''; | ||
state.setSegment(segment.type, segment.maxValue); | ||
if (segment.maxValue !== undefined) state.setSegment(segment.type, segment.maxValue); | ||
}, | ||
onDecrementToMin: ()=>{ | ||
enteredKeys.current = ''; | ||
state.setSegment(segment.type, segment.minValue); | ||
if (segment.minValue !== undefined) state.setSegment(segment.type, segment.minValue); | ||
} | ||
@@ -214,8 +214,8 @@ }); | ||
} | ||
if (segment.value >= 12 && numberValue > 1) numberValue += 12; | ||
} else if (numberValue > segment.maxValue) segmentValue = parser.parse(key); | ||
if (segment.value !== undefined && segment.value >= 12 && numberValue > 1) numberValue += 12; | ||
} else if (segment.maxValue !== undefined && numberValue > segment.maxValue) segmentValue = parser.parse(key); | ||
if (isNaN(numberValue)) return; | ||
let shouldSetValue = segmentValue !== 0 || allowsZero; | ||
if (shouldSetValue) state.setSegment(segment.type, segmentValue); | ||
if (Number(numberValue + '0') > segment.maxValue || newValue.length >= String(segment.maxValue).length) { | ||
if (segment.maxValue !== undefined && (Number(numberValue + '0') > segment.maxValue || newValue.length >= String(segment.maxValue).length)) { | ||
enteredKeys.current = ''; | ||
@@ -230,3 +230,3 @@ if (shouldSetValue) focusManager.focusNext(); | ||
enteredKeys.current = ''; | ||
(0, $4d1jn$scrollIntoViewport)(ref.current, { | ||
if (ref.current) (0, $4d1jn$scrollIntoViewport)(ref.current, { | ||
containingElement: (0, $4d1jn$getScrollParent)(ref.current) | ||
@@ -236,6 +236,7 @@ }); | ||
let selection = window.getSelection(); | ||
selection.collapse(ref.current); | ||
selection === null || selection === void 0 ? void 0 : selection.collapse(ref.current); | ||
}; | ||
let documentRef = (0, $4d1jn$useRef)(typeof document !== 'undefined' ? document : null); | ||
(0, $4d1jn$useEvent)(documentRef, 'selectionchange', ()=>{ | ||
var _ref_current; | ||
// Enforce that the selection is collapsed when inside a date segment. | ||
@@ -245,7 +246,7 @@ // Otherwise, when tapping on a segment in Android Chrome and then entering text, | ||
let selection = window.getSelection(); | ||
if (ref.current && ref.current.contains(selection.anchorNode)) selection.collapse(ref.current); | ||
if ((selection === null || selection === void 0 ? void 0 : selection.anchorNode) && ((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(selection === null || selection === void 0 ? void 0 : selection.anchorNode))) selection.collapse(ref.current); | ||
}); | ||
let compositionRef = (0, $4d1jn$useRef)(''); | ||
// @ts-ignore - TODO: possibly old TS version? doesn't fail in my editor... | ||
(0, $4d1jn$useEvent)(ref, 'beforeinput', (e)=>{ | ||
if (!ref.current) return; | ||
e.preventDefault(); | ||
@@ -275,6 +276,6 @@ switch(e.inputType){ | ||
// Reset the DOM to how it was in the beforeinput event. | ||
ref.current.textContent = compositionRef.current; | ||
if (ref.current) ref.current.textContent = compositionRef.current; | ||
// Android sometimes fires key presses of letters as composition events. Need to handle am/pm keys here too. | ||
// Can also happen e.g. with Pinyin keyboard on iOS. | ||
if (startsWith(am, data) || startsWith(pm, data)) onInput(data); | ||
if (data != null && (startsWith(am, data) || startsWith(pm, data))) onInput(data); | ||
break; | ||
@@ -281,0 +282,0 @@ } |
@@ -36,3 +36,2 @@ var $c1905b78f6d2f5bf$exports = require("./intlStrings.main.js"); | ||
try { | ||
// @ts-ignore | ||
return new Intl.DisplayNames(locale, { | ||
@@ -39,0 +38,0 @@ type: 'dateTimeField' |
@@ -30,3 +30,2 @@ import $jR5iF$intlStringsmodulejs from "./intlStrings.module.js"; | ||
try { | ||
// @ts-ignore | ||
return new Intl.DisplayNames(locale, { | ||
@@ -33,0 +32,0 @@ type: 'dateTimeField' |
{ | ||
"name": "@react-aria/datepicker", | ||
"version": "3.0.0-nightly-0ddbe6f95-241021", | ||
"version": "3.0.0-nightly-101d0772b-250111", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,29 +25,28 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@internationalized/date": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@internationalized/number": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@internationalized/string": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-aria/focus": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-aria/form": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-aria/i18n": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-aria/interactions": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-aria/label": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-aria/spinbutton": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-aria/utils": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-stately/datepicker": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-stately/form": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-types/button": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-types/calendar": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-types/datepicker": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-types/dialog": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@react-types/shared": "^3.0.0-nightly-0ddbe6f95-241021", | ||
"@internationalized/date": "3.0.0-nightly-101d0772b-250111", | ||
"@internationalized/number": "3.0.0-nightly-101d0772b-250111", | ||
"@internationalized/string": "3.0.0-nightly-101d0772b-250111", | ||
"@react-aria/focus": "3.0.0-nightly-101d0772b-250111", | ||
"@react-aria/form": "3.0.0-nightly-101d0772b-250111", | ||
"@react-aria/i18n": "3.0.0-nightly-101d0772b-250111", | ||
"@react-aria/interactions": "3.0.0-nightly-101d0772b-250111", | ||
"@react-aria/label": "3.0.0-nightly-101d0772b-250111", | ||
"@react-aria/spinbutton": "3.0.0-nightly-101d0772b-250111", | ||
"@react-aria/utils": "3.0.0-nightly-101d0772b-250111", | ||
"@react-stately/datepicker": "3.0.0-nightly-101d0772b-250111", | ||
"@react-stately/form": "3.0.0-nightly-101d0772b-250111", | ||
"@react-types/button": "3.0.0-nightly-101d0772b-250111", | ||
"@react-types/calendar": "3.0.0-nightly-101d0772b-250111", | ||
"@react-types/datepicker": "3.0.0-nightly-101d0772b-250111", | ||
"@react-types/dialog": "3.0.0-nightly-101d0772b-250111", | ||
"@react-types/shared": "3.0.0-nightly-101d0772b-250111", | ||
"@swc/helpers": "^0.5.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0", | ||
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0" | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", | ||
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"stableVersion": "3.11.4" | ||
} | ||
} |
@@ -48,5 +48,5 @@ /* | ||
interface HookData { | ||
ariaLabel: string, | ||
ariaLabelledBy: string, | ||
ariaDescribedBy: string, | ||
ariaLabel?: string, | ||
ariaLabelledBy?: string, | ||
ariaDescribedBy?: string, | ||
focusManager: FocusManager | ||
@@ -53,0 +53,0 @@ } |
@@ -53,2 +53,5 @@ import {createFocusManager, getFocusableTreeWalker} from '@react-aria/focus'; | ||
let focusLast = () => { | ||
if (!ref.current) { | ||
return; | ||
} | ||
// Try to find the segment prior to the element that was clicked on. | ||
@@ -55,0 +58,0 @@ let target = window.event?.target as FocusableElement; |
@@ -17,2 +17,3 @@ /* | ||
import {createFocusManager} from '@react-aria/focus'; | ||
import {DateRange, RangeCalendarProps} from '@react-types/calendar'; | ||
import {DateRangePickerState} from '@react-stately/datepicker'; | ||
@@ -25,3 +26,2 @@ import {DEFAULT_VALIDATION_RESULT, mergeValidation, privateValidationStateProp} from '@react-stately/form'; | ||
import intlMessages from '../intl/*.json'; | ||
import {RangeCalendarProps} from '@react-types/calendar'; | ||
import {useDatePickerGroup} from './useDatePickerGroup'; | ||
@@ -173,3 +173,3 @@ import {useField} from '@react-aria/label'; | ||
...commonFieldProps, | ||
value: state.value?.start, | ||
value: state.value?.start ?? null, | ||
onChange: start => state.setDateTime('start', start), | ||
@@ -192,3 +192,3 @@ autoFocus: props.autoFocus, | ||
...commonFieldProps, | ||
value: state.value?.end, | ||
value: state.value?.end ?? null, | ||
onChange: end => state.setDateTime('end', end), | ||
@@ -211,3 +211,3 @@ name: props.endName, | ||
autoFocus: true, | ||
value: state.dateRange, | ||
value: state.dateRange?.start && state.dateRange.end ? state.dateRange as DateRange : null, | ||
onChange: state.setDateRange, | ||
@@ -214,0 +214,0 @@ minValue: props.minValue, |
@@ -38,3 +38,3 @@ /* | ||
let displayNames = useDisplayNames(); | ||
let {ariaLabel, ariaLabelledBy, ariaDescribedBy, focusManager} = hookData.get(state); | ||
let {ariaLabel, ariaLabelledBy, ariaDescribedBy, focusManager} = hookData.get(state)!; | ||
@@ -86,7 +86,11 @@ let textValue = segment.isPlaceholder ? '' : segment.text; | ||
enteredKeys.current = ''; | ||
state.setSegment(segment.type, segment.maxValue); | ||
if (segment.maxValue !== undefined) { | ||
state.setSegment(segment.type, segment.maxValue); | ||
} | ||
}, | ||
onDecrementToMin: () => { | ||
enteredKeys.current = ''; | ||
state.setSegment(segment.type, segment.minValue); | ||
if (segment.minValue !== undefined) { | ||
state.setSegment(segment.type, segment.minValue); | ||
} | ||
} | ||
@@ -145,3 +149,3 @@ }); | ||
date.setHours(0); | ||
return amPmFormatter.formatToParts(date).find(part => part.type === 'dayPeriod').value; | ||
return amPmFormatter.formatToParts(date).find(part => part.type === 'dayPeriod')!.value; | ||
}, [amPmFormatter]); | ||
@@ -152,3 +156,3 @@ | ||
date.setHours(12); | ||
return amPmFormatter.formatToParts(date).find(part => part.type === 'dayPeriod').value; | ||
return amPmFormatter.formatToParts(date).find(part => part.type === 'dayPeriod')!.value; | ||
}, [amPmFormatter]); | ||
@@ -167,3 +171,3 @@ | ||
let parts = eraFormatter.formatToParts(eraDate); | ||
let formatted = parts.find(p => p.type === 'era').value; | ||
let formatted = parts.find(p => p.type === 'era')!.value; | ||
return {era, formatted}; | ||
@@ -239,6 +243,6 @@ }); | ||
if (segment.value >= 12 && numberValue > 1) { | ||
if (segment.value !== undefined && segment.value >= 12 && numberValue > 1) { | ||
numberValue += 12; | ||
} | ||
} else if (numberValue > segment.maxValue) { | ||
} else if (segment.maxValue !== undefined && numberValue > segment.maxValue) { | ||
segmentValue = parser.parse(key); | ||
@@ -256,3 +260,3 @@ } | ||
if (Number(numberValue + '0') > segment.maxValue || newValue.length >= String(segment.maxValue).length) { | ||
if (segment.maxValue !== undefined && (Number(numberValue + '0') > segment.maxValue || newValue.length >= String(segment.maxValue).length)) { | ||
enteredKeys.current = ''; | ||
@@ -272,7 +276,9 @@ if (shouldSetValue) { | ||
enteredKeys.current = ''; | ||
scrollIntoViewport(ref.current, {containingElement: getScrollParent(ref.current)}); | ||
if (ref.current) { | ||
scrollIntoViewport(ref.current, {containingElement: getScrollParent(ref.current)}); | ||
} | ||
// Collapse selection to start or Chrome won't fire input events. | ||
let selection = window.getSelection(); | ||
selection.collapse(ref.current); | ||
selection?.collapse(ref.current); | ||
}; | ||
@@ -286,3 +292,3 @@ | ||
let selection = window.getSelection(); | ||
if (ref.current && ref.current.contains(selection.anchorNode)) { | ||
if (selection?.anchorNode && ref.current?.contains(selection?.anchorNode)) { | ||
selection.collapse(ref.current); | ||
@@ -292,5 +298,7 @@ } | ||
let compositionRef = useRef(''); | ||
// @ts-ignore - TODO: possibly old TS version? doesn't fail in my editor... | ||
let compositionRef = useRef<string | null>(''); | ||
useEvent(ref, 'beforeinput', e => { | ||
if (!ref.current) { | ||
return; | ||
} | ||
e.preventDefault(); | ||
@@ -322,12 +330,14 @@ | ||
useEvent(ref, 'input', (e: InputEvent) => { | ||
let {inputType, data} = e; | ||
useEvent(ref, 'input', e => { | ||
let {inputType, data} = e as InputEvent; | ||
switch (inputType) { | ||
case 'insertCompositionText': | ||
// Reset the DOM to how it was in the beforeinput event. | ||
ref.current.textContent = compositionRef.current; | ||
if (ref.current) { | ||
ref.current.textContent = compositionRef.current; | ||
} | ||
// Android sometimes fires key presses of letters as composition events. Need to handle am/pm keys here too. | ||
// Can also happen e.g. with Pinyin keyboard on iOS. | ||
if (startsWith(am, data) || startsWith(pm, data)) { | ||
if (data != null && (startsWith(am, data) || startsWith(pm, data))) { | ||
onInput(data); | ||
@@ -334,0 +344,0 @@ } |
@@ -21,3 +21,3 @@ /* | ||
interface DisplayNames { | ||
of(field: Field): string | ||
of(field: Field): string | undefined | ||
} | ||
@@ -33,3 +33,2 @@ | ||
try { | ||
// @ts-ignore | ||
return new Intl.DisplayNames(locale, {type: 'dateTimeField'}); | ||
@@ -36,0 +35,0 @@ } catch { |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Sorry, the diff of this file is not supported yet
537065
6481
+ Added@internationalized/date@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@internationalized/message@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@internationalized/number@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@internationalized/string@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-aria/focus@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-aria/form@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-aria/i18n@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-aria/interactions@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-aria/label@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-aria/live-announcer@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-aria/spinbutton@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-aria/ssr@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-aria/utils@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-stately/datepicker@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-stately/form@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-stately/overlays@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-stately/utils@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-types/button@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-types/calendar@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-types/datepicker@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-types/dialog@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-types/overlays@3.0.0-nightly-101d0772b-250111(transitive)
+ Added@react-types/shared@3.0.0-nightly-101d0772b-250111(transitive)
- Removed@internationalized/date@3.7.0(transitive)
- Removed@internationalized/message@3.1.6(transitive)
- Removed@internationalized/number@3.6.0(transitive)
- Removed@internationalized/string@3.2.5(transitive)
- Removed@react-aria/focus@3.19.1(transitive)
- Removed@react-aria/form@3.0.12(transitive)
- Removed@react-aria/i18n@3.12.5(transitive)
- Removed@react-aria/interactions@3.23.0(transitive)
- Removed@react-aria/label@3.7.14(transitive)
- Removed@react-aria/live-announcer@3.4.1(transitive)
- Removed@react-aria/spinbutton@3.6.11(transitive)
- Removed@react-aria/ssr@3.9.7(transitive)
- Removed@react-aria/utils@3.27.0(transitive)
- Removed@react-stately/datepicker@3.12.0(transitive)
- Removed@react-stately/form@3.1.1(transitive)
- Removed@react-stately/overlays@3.6.13(transitive)
- Removed@react-stately/utils@3.10.5(transitive)
- Removed@react-types/button@3.10.2(transitive)
- Removed@react-types/calendar@3.6.0(transitive)
- Removed@react-types/datepicker@3.10.0(transitive)
- Removed@react-types/dialog@3.5.15(transitive)
- Removed@react-types/overlays@3.8.12(transitive)
- Removed@react-types/shared@3.27.0(transitive)
Updated@internationalized/date@3.0.0-nightly-101d0772b-250111
Updated@internationalized/number@3.0.0-nightly-101d0772b-250111
Updated@internationalized/string@3.0.0-nightly-101d0772b-250111
Updated@react-aria/interactions@3.0.0-nightly-101d0772b-250111
Updated@react-aria/spinbutton@3.0.0-nightly-101d0772b-250111
Updated@react-stately/datepicker@3.0.0-nightly-101d0772b-250111
Updated@react-types/datepicker@3.0.0-nightly-101d0772b-250111