@react-spectrum/datepicker 3.10.3 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/DateField.main.js +5 -9
  2. package/dist/DateField.main.js.map +1 -1
  3. package/dist/DateField.mjs +5 -9
  4. package/dist/DateField.module.js +5 -9
  5. package/dist/DateField.module.js.map +1 -1
  6. package/dist/DatePicker.main.js +9 -11
  7. package/dist/DatePicker.main.js.map +1 -1
  8. package/dist/DatePicker.mjs +9 -11
  9. package/dist/DatePicker.module.js +9 -11
  10. package/dist/DatePicker.module.js.map +1 -1
  11. package/dist/DatePickerField.main.js +3 -3
  12. package/dist/DatePickerField.main.js.map +1 -1
  13. package/dist/DatePickerField.mjs +3 -3
  14. package/dist/DatePickerField.module.js +3 -3
  15. package/dist/DatePickerField.module.js.map +1 -1
  16. package/dist/DatePickerSegment.main.js +2 -2
  17. package/dist/DatePickerSegment.main.js.map +1 -1
  18. package/dist/DatePickerSegment.mjs +2 -2
  19. package/dist/DatePickerSegment.module.js +2 -2
  20. package/dist/DatePickerSegment.module.js.map +1 -1
  21. package/dist/DateRangePicker.main.js +8 -11
  22. package/dist/DateRangePicker.main.js.map +1 -1
  23. package/dist/DateRangePicker.mjs +8 -11
  24. package/dist/DateRangePicker.module.js +8 -11
  25. package/dist/DateRangePicker.module.js.map +1 -1
  26. package/dist/Input.main.js +5 -6
  27. package/dist/Input.main.js.map +1 -1
  28. package/dist/Input.mjs +5 -6
  29. package/dist/Input.module.js +5 -6
  30. package/dist/Input.module.js.map +1 -1
  31. package/dist/TimeField.main.js +4 -8
  32. package/dist/TimeField.main.js.map +1 -1
  33. package/dist/TimeField.mjs +4 -8
  34. package/dist/TimeField.module.js +4 -8
  35. package/dist/TimeField.module.js.map +1 -1
  36. package/dist/inputgroup_vars_css.main.js.map +1 -1
  37. package/dist/inputgroup_vars_css.module.js.map +1 -1
  38. package/dist/{styles.4bf108e6.css → styles.d49f4d83.css} +5 -5
  39. package/dist/{styles.4bf108e6.css.map → styles.d49f4d83.css.map} +1 -1
  40. package/dist/textfield_vars_css.main.js.map +1 -1
  41. package/dist/textfield_vars_css.module.js.map +1 -1
  42. package/dist/types.d.ts.map +1 -1
  43. package/dist/utils.main.js +1 -1
  44. package/dist/utils.main.js.map +1 -1
  45. package/dist/utils.mjs +1 -1
  46. package/dist/utils.module.js +1 -1
  47. package/dist/utils.module.js.map +1 -1
  48. package/dist/{vars.61240e3b.css → vars.ba84240a.css} +3 -3
  49. package/dist/{vars.61240e3b.css.map → vars.ba84240a.css.map} +1 -1
  50. package/dist/{vars.6aae6db6.css → vars.cf48e391.css} +2 -2
  51. package/dist/{vars.6aae6db6.css.map → vars.cf48e391.css.map} +1 -1
  52. package/package.json +23 -23
  53. package/src/DateField.tsx +10 -13
  54. package/src/DatePicker.tsx +11 -12
  55. package/src/DatePickerField.tsx +2 -2
  56. package/src/DatePickerSegment.tsx +1 -1
  57. package/src/DateRangePicker.tsx +12 -13
  58. package/src/Input.tsx +6 -9
  59. package/src/TimeField.tsx +9 -12
  60. package/src/utils.ts +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/datepicker",
3
- "version": "3.10.3",
3
+ "version": "3.12.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -36,25 +36,25 @@
36
36
  "url": "https://github.com/adobe/react-spectrum"
37
37
  },
38
38
  "dependencies": {
39
- "@internationalized/date": "^3.5.6",
40
- "@react-aria/datepicker": "^3.11.4",
41
- "@react-aria/focus": "^3.18.4",
42
- "@react-aria/i18n": "^3.12.3",
43
- "@react-aria/interactions": "^3.22.4",
44
- "@react-aria/utils": "^3.25.3",
45
- "@react-spectrum/button": "^3.16.8",
46
- "@react-spectrum/calendar": "^3.4.13",
47
- "@react-spectrum/dialog": "^3.8.15",
48
- "@react-spectrum/form": "^3.7.9",
49
- "@react-spectrum/label": "^3.16.9",
50
- "@react-spectrum/layout": "^3.6.9",
51
- "@react-spectrum/utils": "^3.11.11",
52
- "@react-spectrum/view": "^3.6.13",
53
- "@react-stately/datepicker": "^3.10.3",
54
- "@react-types/datepicker": "^3.8.3",
55
- "@react-types/shared": "^3.25.0",
56
- "@spectrum-icons/ui": "^3.6.10",
57
- "@spectrum-icons/workflow": "^4.2.15",
39
+ "@internationalized/date": "^3.7.0",
40
+ "@react-aria/datepicker": "^3.13.0",
41
+ "@react-aria/focus": "^3.19.1",
42
+ "@react-aria/i18n": "^3.12.5",
43
+ "@react-aria/interactions": "^3.23.0",
44
+ "@react-aria/utils": "^3.27.0",
45
+ "@react-spectrum/button": "^3.16.10",
46
+ "@react-spectrum/calendar": "^3.6.0",
47
+ "@react-spectrum/dialog": "^3.8.17",
48
+ "@react-spectrum/form": "^3.7.11",
49
+ "@react-spectrum/label": "^3.16.11",
50
+ "@react-spectrum/layout": "^3.6.11",
51
+ "@react-spectrum/utils": "^3.12.1",
52
+ "@react-spectrum/view": "^3.6.15",
53
+ "@react-stately/datepicker": "^3.12.0",
54
+ "@react-types/datepicker": "^3.10.0",
55
+ "@react-types/shared": "^3.27.0",
56
+ "@spectrum-icons/ui": "^3.6.12",
57
+ "@spectrum-icons/workflow": "^4.2.17",
58
58
  "@swc/helpers": "^0.5.0"
59
59
  },
60
60
  "devDependencies": {
@@ -63,11 +63,11 @@
63
63
  },
64
64
  "peerDependencies": {
65
65
  "@react-spectrum/provider": "^3.0.0",
66
- "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
67
- "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
66
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
67
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
68
68
  },
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "gitHead": "8e0a28d188cdbdbd2b32296fa034b1b02ddde229"
72
+ "gitHead": "09e7f44bebdc9d89122926b2b439a0a38a2814ea"
73
73
  }
package/src/DateField.tsx CHANGED
@@ -26,7 +26,11 @@ import {useFormProps} from '@react-spectrum/form';
26
26
  import {useLocale} from '@react-aria/i18n';
27
27
  import {useProviderProps} from '@react-spectrum/provider';
28
28
 
29
- function DateField<T extends DateValue>(props: SpectrumDateFieldProps<T>, ref: FocusableRef<HTMLElement>) {
29
+ /**
30
+ * DateFields allow users to enter and edit date and time values using a keyboard.
31
+ * Each part of a date value is displayed in an individually editable segment.
32
+ */
33
+ export const DateField = React.forwardRef(function DateField<T extends DateValue>(props: SpectrumDateFieldProps<T>, ref: FocusableRef<HTMLElement>) {
30
34
  props = useProviderProps(props);
31
35
  props = useFormProps(props);
32
36
  let {
@@ -45,8 +49,8 @@ function DateField<T extends DateValue>(props: SpectrumDateFieldProps<T>, ref: F
45
49
  createCalendar
46
50
  });
47
51
 
48
- let fieldRef = useRef(null);
49
- let inputRef = useRef(null);
52
+ let fieldRef = useRef<HTMLElement | null>(null);
53
+ let inputRef = useRef<HTMLInputElement | null>(null);
50
54
  let {labelProps, fieldProps, inputProps, descriptionProps, errorMessageProps, isInvalid, validationErrors, validationDetails} = useDateField({
51
55
  ...props,
52
56
  inputRef
@@ -56,7 +60,7 @@ function DateField<T extends DateValue>(props: SpectrumDateFieldProps<T>, ref: F
56
60
  // The format help text is unnecessary for screen reader users because each segment already has a label.
57
61
  let description = useFormatHelpText(props);
58
62
  if (description && !props.description) {
59
- descriptionProps.id = null;
63
+ descriptionProps.id = undefined;
60
64
  }
61
65
 
62
66
  let validationState = state.validationState || (isInvalid ? 'invalid' : null);
@@ -72,7 +76,7 @@ function DateField<T extends DateValue>(props: SpectrumDateFieldProps<T>, ref: F
72
76
  labelProps={labelProps}
73
77
  descriptionProps={descriptionProps}
74
78
  errorMessageProps={errorMessageProps}
75
- validationState={validationState}
79
+ validationState={validationState ?? undefined}
76
80
  isInvalid={isInvalid}
77
81
  validationErrors={validationErrors}
78
82
  validationDetails={validationDetails}
@@ -99,11 +103,4 @@ function DateField<T extends DateValue>(props: SpectrumDateFieldProps<T>, ref: F
99
103
  </Input>
100
104
  </Field>
101
105
  );
102
- }
103
-
104
- /**
105
- * DateFields allow users to enter and edit date and time values using a keyboard.
106
- * Each part of a date value is displayed in an individually editable segment.
107
- */
108
- const _DateField = React.forwardRef(DateField) as <T extends DateValue>(props: SpectrumDateFieldProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
109
- export {_DateField as DateField};
106
+ }) as <T extends DateValue>(props: SpectrumDateFieldProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
@@ -38,7 +38,10 @@ import {useHover} from '@react-aria/interactions';
38
38
  import {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';
39
39
  import {useProviderProps} from '@react-spectrum/provider';
40
40
 
41
- function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref: FocusableRef<HTMLElement>) {
41
+ /**
42
+ * DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.
43
+ */
44
+ export const DatePicker = React.forwardRef(function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref: FocusableRef<HTMLElement>) {
42
45
  props = useProviderProps(props);
43
46
  props = useFormProps(props);
44
47
  let {
@@ -47,10 +50,11 @@ function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref:
47
50
  isDisabled,
48
51
  placeholderValue,
49
52
  maxVisibleMonths = 1,
50
- pageBehavior
53
+ pageBehavior,
54
+ firstDayOfWeek
51
55
  } = props;
52
56
  let {hoverProps, isHovered} = useHover({isDisabled});
53
- let targetRef = useRef<HTMLDivElement>(undefined);
57
+ let targetRef = useRef<HTMLDivElement | null>(null);
54
58
  let state = useDatePickerState({
55
59
  ...props,
56
60
  shouldCloseOnSelect: () => !state.hasTime
@@ -99,10 +103,10 @@ function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref:
99
103
  // The format help text is unnecessary for screen reader users because each segment already has a label.
100
104
  let description = useFormatHelpText(props);
101
105
  if (description && !props.description) {
102
- descriptionProps.id = null;
106
+ descriptionProps.id = undefined;
103
107
  }
104
108
 
105
- let placeholder: DateValue = placeholderValue;
109
+ let placeholder: DateValue | null | undefined = placeholderValue;
106
110
  let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;
107
111
  let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;
108
112
  let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;
@@ -168,6 +172,7 @@ function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref:
168
172
  {...calendarProps}
169
173
  visibleMonths={visibleMonths}
170
174
  pageBehavior={pageBehavior}
175
+ firstDayOfWeek={firstDayOfWeek}
171
176
  UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': isInvalid})} />
172
177
  {showTimeField &&
173
178
  <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>
@@ -191,10 +196,4 @@ function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref:
191
196
  </div>
192
197
  </Field>
193
198
  );
194
- }
195
-
196
- /**
197
- * DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.
198
- */
199
- const _DatePicker = React.forwardRef(DatePicker) as <T extends DateValue>(props: SpectrumDatePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
200
- export {_DatePicker as DatePicker};
199
+ }) as <T extends DateValue>(props: SpectrumDatePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
@@ -33,7 +33,7 @@ export function DatePickerField<T extends DateValue>(props: DatePickerFieldProps
33
33
  isRequired,
34
34
  inputClassName
35
35
  } = props;
36
- let ref = useRef(undefined);
36
+ let ref = useRef<HTMLDivElement | null>(null);
37
37
  let {locale} = useLocale();
38
38
  let state = useDateFieldState({
39
39
  ...props,
@@ -41,7 +41,7 @@ export function DatePickerField<T extends DateValue>(props: DatePickerFieldProps
41
41
  createCalendar
42
42
  });
43
43
 
44
- let inputRef = useRef(undefined);
44
+ let inputRef = useRef<HTMLInputElement | null>(null);
45
45
  let {fieldProps, inputProps} = useDateField({...props, inputRef}, state, ref);
46
46
 
47
47
  return (
@@ -50,7 +50,7 @@ function LiteralSegment({segment}: LiteralSegmentProps) {
50
50
  }
51
51
 
52
52
  function EditableSegment({segment, state}: DatePickerSegmentProps) {
53
- let ref = useRef(undefined);
53
+ let ref = useRef<HTMLDivElement | null>(null);
54
54
  let {segmentProps} = useDateSegment(segment, state, ref);
55
55
 
56
56
  return (
@@ -38,7 +38,11 @@ import {useHover} from '@react-aria/interactions';
38
38
  import {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';
39
39
  import {useProviderProps} from '@react-spectrum/provider';
40
40
 
41
- function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProps<T>, ref: FocusableRef<HTMLElement>) {
41
+ /**
42
+ * DateRangePickers combine two DateFields and a RangeCalendar popover to allow users
43
+ * to enter or select a date and time range.
44
+ */
45
+ export const DateRangePicker = React.forwardRef(function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProps<T>, ref: FocusableRef<HTMLElement>) {
42
46
  props = useProviderProps(props);
43
47
  props = useFormProps(props);
44
48
  let {
@@ -47,10 +51,11 @@ function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProp
47
51
  autoFocus,
48
52
  placeholderValue,
49
53
  maxVisibleMonths = 1,
50
- pageBehavior
54
+ pageBehavior,
55
+ firstDayOfWeek
51
56
  } = props;
52
57
  let {hoverProps, isHovered} = useHover({isDisabled});
53
- let targetRef = useRef<HTMLDivElement>(undefined);
58
+ let targetRef = useRef<HTMLDivElement | null>(null);
54
59
  let state = useDateRangePickerState({
55
60
  ...props,
56
61
  shouldCloseOnSelect: () => !state.hasTime
@@ -99,10 +104,10 @@ function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProp
99
104
  // The format help text is unnecessary for screen reader users because each segment already has a label.
100
105
  let description = useFormatHelpText(props);
101
106
  if (description && !props.description) {
102
- descriptionProps.id = null;
107
+ descriptionProps.id = undefined;
103
108
  }
104
109
 
105
- let placeholder: DateValue = placeholderValue;
110
+ let placeholder: DateValue | null | undefined = placeholderValue;
106
111
  let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;
107
112
  let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;
108
113
  let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;
@@ -183,6 +188,7 @@ function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProp
183
188
  {...calendarProps}
184
189
  visibleMonths={visibleMonths}
185
190
  pageBehavior={pageBehavior}
191
+ firstDayOfWeek={firstDayOfWeek}
186
192
  UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': validationState === 'invalid'})} />
187
193
  {showTimeField &&
188
194
  <Flex gap="size-100" marginTop="size-100" UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>
@@ -217,7 +223,7 @@ function DateRangePicker<T extends DateValue>(props: SpectrumDateRangePickerProp
217
223
  </div>
218
224
  </Field>
219
225
  );
220
- }
226
+ }) as <T extends DateValue>(props: SpectrumDateRangePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
221
227
 
222
228
  function DateRangeDash() {
223
229
  return (
@@ -227,10 +233,3 @@ function DateRangeDash() {
227
233
  className={classNames(datepickerStyles, 'react-spectrum-Datepicker-rangeDash')} />
228
234
  );
229
235
  }
230
-
231
- /**
232
- * DateRangePickers combine two DateFields and a RangeCalendar popover to allow users
233
- * to enter or select a date and time range.
234
- */
235
- const _DateRangePicker = React.forwardRef(DateRangePicker) as <T extends DateValue>(props: SpectrumDateRangePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
236
- export {_DateRangePicker as DateRangePicker};
package/src/Input.tsx CHANGED
@@ -15,12 +15,12 @@ import Checkmark from '@spectrum-icons/ui/CheckmarkMedium';
15
15
  import {classNames, useValueEffect} from '@react-spectrum/utils';
16
16
  import datepickerStyles from './styles.css';
17
17
  import {mergeProps, mergeRefs, useEvent, useLayoutEffect, useResizeObserver} from '@react-aria/utils';
18
- import React, {useCallback, useRef} from 'react';
18
+ import React, {ReactElement, useCallback, useRef} from 'react';
19
19
  import textfieldStyles from '@adobe/spectrum-css-temp/components/textfield/vars.css';
20
20
  import {useFocusRing} from '@react-aria/focus';
21
21
 
22
- function Input(props, ref) {
23
- let inputRef = useRef(null);
22
+ export const Input = React.forwardRef(function Input(props: any, ref: any) {
23
+ let inputRef = useRef<HTMLInputElement | null>(null);
24
24
  let {
25
25
  isDisabled,
26
26
  isQuiet,
@@ -38,7 +38,7 @@ function Input(props, ref) {
38
38
  // not cause a layout shift.
39
39
  let [reservePadding, setReservePadding] = useValueEffect(false);
40
40
  let onResize = useCallback(() => setReservePadding(function *(reservePadding) {
41
- if (inputRef.current) {
41
+ if (inputRef.current && inputRef.current.parentElement) {
42
42
  if (reservePadding) {
43
43
  // Try to collapse padding if the content is clipped.
44
44
  if (inputRef.current.scrollWidth > inputRef.current.offsetWidth) {
@@ -114,7 +114,7 @@ function Input(props, ref) {
114
114
  'spectrum-Textfield-validationIcon'
115
115
  );
116
116
 
117
- let validationIcon = null;
117
+ let validationIcon: ReactElement | null = null;
118
118
  if (validationState === 'invalid' && !isDisabled) {
119
119
  validationIcon = <Alert data-testid="invalid-icon" UNSAFE_className={iconClass} />;
120
120
  } else if (validationState === 'valid' && !isDisabled) {
@@ -139,7 +139,4 @@ function Input(props, ref) {
139
139
  {validationIcon}
140
140
  </div>
141
141
  );
142
- }
143
-
144
- const _Input = React.forwardRef(Input);
145
- export {_Input as Input};
142
+ });
package/src/TimeField.tsx CHANGED
@@ -25,7 +25,11 @@ import {useProviderProps} from '@react-spectrum/provider';
25
25
  import {useTimeField} from '@react-aria/datepicker';
26
26
  import {useTimeFieldState} from '@react-stately/datepicker';
27
27
 
28
- function TimeField<T extends TimeValue>(props: SpectrumTimeFieldProps<T>, ref: FocusableRef<HTMLElement>) {
28
+ /**
29
+ * TimeFields allow users to enter and edit time values using a keyboard.
30
+ * Each part of the time is displayed in an individually editable segment.
31
+ */
32
+ export const TimeField = React.forwardRef(function TimeField<T extends TimeValue>(props: SpectrumTimeFieldProps<T>, ref: FocusableRef<HTMLElement>) {
29
33
  props = useProviderProps(props);
30
34
  props = useFormProps(props);
31
35
  let {
@@ -43,8 +47,8 @@ function TimeField<T extends TimeValue>(props: SpectrumTimeFieldProps<T>, ref: F
43
47
  locale
44
48
  });
45
49
 
46
- let fieldRef = useRef(null);
47
- let inputRef = useRef(null);
50
+ let fieldRef = useRef<HTMLDivElement | null>(null);
51
+ let inputRef = useRef<HTMLInputElement | null>(null);
48
52
  let {labelProps, fieldProps, inputProps, descriptionProps, errorMessageProps, isInvalid, validationErrors, validationDetails} = useTimeField({
49
53
  ...props,
50
54
  inputRef
@@ -62,7 +66,7 @@ function TimeField<T extends TimeValue>(props: SpectrumTimeFieldProps<T>, ref: F
62
66
  labelProps={labelProps}
63
67
  descriptionProps={descriptionProps}
64
68
  errorMessageProps={errorMessageProps}
65
- validationState={validationState}
69
+ validationState={validationState ?? undefined}
66
70
  isInvalid={isInvalid}
67
71
  validationErrors={validationErrors}
68
72
  validationDetails={validationDetails}
@@ -89,11 +93,4 @@ function TimeField<T extends TimeValue>(props: SpectrumTimeFieldProps<T>, ref: F
89
93
  </Input>
90
94
  </Field>
91
95
  );
92
- }
93
-
94
- /**
95
- * TimeFields allow users to enter and edit time values using a keyboard.
96
- * Each part of the time is displayed in an individually editable segment.
97
- */
98
- const _TimeField = React.forwardRef(TimeField) as <T extends TimeValue>(props: SpectrumTimeFieldProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
99
- export {_TimeField as TimeField};
96
+ }) as <T extends TimeValue>(props: SpectrumTimeFieldProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
package/src/utils.ts CHANGED
@@ -42,7 +42,7 @@ export function useFormatHelpText(props: Pick<SpectrumDatePickerBase<any>, 'desc
42
42
  }
43
43
 
44
44
  export function useVisibleMonths(maxVisibleMonths: number) {
45
- let {scale} = useProvider();
45
+ let {scale} = useProvider()!;
46
46
  let [visibleMonths, setVisibleMonths] = useState(getVisibleMonths(scale));
47
47
  useLayoutEffect(() => {
48
48
  let onResize = () => setVisibleMonths(getVisibleMonths(scale));
@@ -68,7 +68,7 @@ function getVisibleMonths(scale) {
68
68
  }
69
69
 
70
70
  export function useFocusManagerRef(ref: FocusableRef<HTMLElement>) {
71
- let domRef = useRef(undefined);
71
+ let domRef = useRef<HTMLElement | null>(null);
72
72
  useImperativeHandle(ref, () => ({
73
73
  ...createDOMRef(domRef),
74
74
  focus() {