@react-aria/datepicker 3.3.0 → 3.4.1
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.
- package/dist/import.mjs +2 -0
- package/dist/main.js +2 -0
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -0
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +4 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/index.ts +2 -2
- package/src/useDateField.ts +3 -3
- package/src/useDatePicker.ts +1 -0
- package/src/useDateRangePicker.ts +1 -0
package/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AriaDateFieldProps, AriaTimeFieldProps, DateValue, TimeValue, AriaDatePickerProps, AriaDateRangePickerProps } from "@react-types/datepicker";
|
|
2
2
|
import { DateFieldState, DatePickerState, DateSegment, DateRangePickerState } from "@react-stately/datepicker";
|
|
3
3
|
import { DOMAttributes } from "@react-types/shared";
|
|
4
4
|
import { RefObject } from "react";
|
|
5
5
|
import { AriaButtonProps } from "@react-types/button";
|
|
6
6
|
import { AriaDialogProps } from "@react-types/dialog";
|
|
7
7
|
import { CalendarProps, RangeCalendarProps } from "@react-types/calendar";
|
|
8
|
-
export interface
|
|
8
|
+
export interface AriaDateFieldOptions<T extends DateValue> extends Omit<AriaDateFieldProps<T>, 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue'> {
|
|
9
9
|
}
|
|
10
10
|
export interface DateFieldAria {
|
|
11
11
|
/** Props for the field's visible label element, if any. */
|
|
@@ -22,7 +22,7 @@ export interface DateFieldAria {
|
|
|
22
22
|
* A date field allows users to enter and edit date and time values using a keyboard.
|
|
23
23
|
* Each part of a date value is displayed in an individually editable segment.
|
|
24
24
|
*/
|
|
25
|
-
export function useDateField<T extends DateValue>(props:
|
|
25
|
+
export function useDateField<T extends DateValue>(props: AriaDateFieldOptions<T>, state: DateFieldState, ref: RefObject<Element>): DateFieldAria;
|
|
26
26
|
/**
|
|
27
27
|
* Provides the behavior and accessibility implementation for a time field component.
|
|
28
28
|
* A time field allows users to enter and edit time values using a keyboard.
|
|
@@ -94,7 +94,7 @@ export interface DateRangePickerAria {
|
|
|
94
94
|
* users to enter or select a date and time range.
|
|
95
95
|
*/
|
|
96
96
|
export function useDateRangePicker<T extends DateValue>(props: AriaDateRangePickerProps<T>, state: DateRangePickerState, ref: RefObject<Element>): DateRangePickerAria;
|
|
97
|
-
export type { AriaDatePickerProps, AriaDateRangePickerProps } from '@react-types/datepicker';
|
|
97
|
+
export type { AriaDateFieldProps, AriaDatePickerProps, AriaDateRangePickerProps, DateRange, DateValue, TimeValue } from '@react-types/datepicker';
|
|
98
98
|
export type { AriaTimeFieldProps } from '@react-types/datepicker';
|
|
99
99
|
|
|
100
100
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AC0BA,
|
|
1
|
+
{"mappings":";;;;;;;AC0BA,sCAAsC,CAAC,SAAS,SAAS,CAAE,SAAQ,IAAI,CAAC,mBAAuB,CAAC,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,kBAAkB,CAAC;CAAG;AAE3L;IACG,2DAA2D;IAC5D,UAAU,EAAE,aAAa,CAAC;IACzB,4CAA4C;IAC7C,UAAU,EAAE,aAAa,CAAC;IAC1B,iDAAiD;IACjD,gBAAgB,EAAE,aAAa,CAAC;IAChC,mDAAmD;IACnD,iBAAiB,EAAE,aAAa,CAAA;CACjC;AAiBD;;;;GAIG;AACH,6BAA6B,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,qBAAqB,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,UAAU,OAAO,CAAC,GAAG,aAAa,CA2F/I;AAED;;;;GAIG;AACH,6BAA6B,CAAC,SAAS,SAA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AAe,EAAE,oBAAoB,SAAS,CAAC,CAAC;IAChD,oCAAoC;IACpC,aAAa,EAAE,oBAAoB,SAAS,CAAC,CAAC;IAC9C,4CAA4C;IAC5C,WAAW,EAAE,eAAe,CAAC;IAC7B,iDAAiD;IACjD,gBAAgB,EAAE,aAAa,CAAC;IAChC,mDAAmD;IACnD,iBAAiB,EAAE,aAAa,CAAC;IACjC,oCAAoC;IACpC,WAAW,EAAE,eAAe,CAAC;IAC7B,8DAA8D;IAC9D,aAAa,EAAE,mBAAmB,SAAS,CAAC,CAAA;CAC7C;AAED;;;;GAIG;AACH,mCAAmC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,yBAAyB,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,EAAE,GAAG,EAAE,UAAU,OAAO,CAAC,GAAG,mBAAmB,CAuIrK;AC5KD,YAAY,EAAC,kBAAkB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAKhJ,YAAY,EAAC,kBAAkB,EAAC,MAAM,yBAAyB,CAAC","sources":["packages/@react-aria/datepicker/src/packages/@react-aria/datepicker/src/useDatePickerGroup.ts","packages/@react-aria/datepicker/src/packages/@react-aria/datepicker/src/useDateField.ts","packages/@react-aria/datepicker/src/packages/@react-aria/datepicker/src/useDatePicker.ts","packages/@react-aria/datepicker/src/packages/@react-aria/datepicker/src/useDisplayNames.ts","packages/@react-aria/datepicker/src/packages/@react-aria/datepicker/src/useDateSegment.ts","packages/@react-aria/datepicker/src/packages/@react-aria/datepicker/src/useDateRangePicker.ts","packages/@react-aria/datepicker/src/packages/@react-aria/datepicker/src/index.ts","packages/@react-aria/datepicker/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useDatePicker} from './useDatePicker';\nexport {useDateSegment} from './useDateSegment';\nexport {useDateField, useTimeField} from './useDateField';\nexport {useDateRangePicker} from './useDateRangePicker';\nexport {useDisplayNames} from './useDisplayNames';\n\nexport type {AriaDateFieldProps, AriaDatePickerProps, AriaDateRangePickerProps, DateRange, DateValue, TimeValue} from '@react-types/datepicker';\nexport type {AriaDateFieldOptions, DateFieldAria} from './useDateField';\nexport type {DatePickerAria} from './useDatePicker';\nexport type {DateRangePickerAria} from './useDateRangePicker';\nexport type {DateSegmentAria} from './useDateSegment';\nexport type {AriaTimeFieldProps} from '@react-types/datepicker';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/datepicker",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,21 +22,21 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@internationalized/date": "^3.
|
|
25
|
+
"@internationalized/date": "^3.2.0",
|
|
26
26
|
"@internationalized/number": "^3.2.0",
|
|
27
27
|
"@internationalized/string": "^3.1.0",
|
|
28
|
-
"@react-aria/focus": "^3.
|
|
29
|
-
"@react-aria/i18n": "^3.7.
|
|
30
|
-
"@react-aria/interactions": "^3.
|
|
31
|
-
"@react-aria/label": "^3.5.
|
|
32
|
-
"@react-aria/spinbutton": "^3.
|
|
33
|
-
"@react-aria/utils": "^3.
|
|
34
|
-
"@react-stately/datepicker": "^3.
|
|
35
|
-
"@react-types/button": "^3.7.
|
|
36
|
-
"@react-types/calendar": "^3.1
|
|
37
|
-
"@react-types/datepicker": "^3.
|
|
38
|
-
"@react-types/dialog": "^3.5.
|
|
39
|
-
"@react-types/shared": "^3.
|
|
28
|
+
"@react-aria/focus": "^3.12.1",
|
|
29
|
+
"@react-aria/i18n": "^3.7.2",
|
|
30
|
+
"@react-aria/interactions": "^3.15.1",
|
|
31
|
+
"@react-aria/label": "^3.5.2",
|
|
32
|
+
"@react-aria/spinbutton": "^3.4.1",
|
|
33
|
+
"@react-aria/utils": "^3.17.0",
|
|
34
|
+
"@react-stately/datepicker": "^3.4.1",
|
|
35
|
+
"@react-types/button": "^3.7.3",
|
|
36
|
+
"@react-types/calendar": "^3.2.1",
|
|
37
|
+
"@react-types/datepicker": "^3.3.1",
|
|
38
|
+
"@react-types/dialog": "^3.5.2",
|
|
39
|
+
"@react-types/shared": "^3.18.1",
|
|
40
40
|
"@swc/helpers": "^0.4.14"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "5911ed21de4b76d66f6254c02302519e02d50e16"
|
|
50
50
|
}
|
package/src/index.ts
CHANGED
|
@@ -16,8 +16,8 @@ export {useDateField, useTimeField} from './useDateField';
|
|
|
16
16
|
export {useDateRangePicker} from './useDateRangePicker';
|
|
17
17
|
export {useDisplayNames} from './useDisplayNames';
|
|
18
18
|
|
|
19
|
-
export type {AriaDatePickerProps, AriaDateRangePickerProps} from '@react-types/datepicker';
|
|
20
|
-
export type {
|
|
19
|
+
export type {AriaDateFieldProps, AriaDatePickerProps, AriaDateRangePickerProps, DateRange, DateValue, TimeValue} from '@react-types/datepicker';
|
|
20
|
+
export type {AriaDateFieldOptions, DateFieldAria} from './useDateField';
|
|
21
21
|
export type {DatePickerAria} from './useDatePicker';
|
|
22
22
|
export type {DateRangePickerAria} from './useDateRangePicker';
|
|
23
23
|
export type {DateSegmentAria} from './useDateSegment';
|
package/src/useDateField.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import {AriaDateFieldProps as AriaDateFieldPropsBase, AriaTimeFieldProps, DateValue, TimeValue} from '@react-types/datepicker';
|
|
14
14
|
import {createFocusManager, FocusManager} from '@react-aria/focus';
|
|
15
15
|
import {DateFieldState} from '@react-stately/datepicker';
|
|
16
16
|
import {DOMAttributes, KeyboardEvent} from '@react-types/shared';
|
|
@@ -24,7 +24,7 @@ import {useFocusWithin} from '@react-aria/interactions';
|
|
|
24
24
|
import {useLocalizedStringFormatter} from '@react-aria/i18n';
|
|
25
25
|
|
|
26
26
|
// Allows this hook to also be used with TimeField
|
|
27
|
-
export interface
|
|
27
|
+
export interface AriaDateFieldOptions<T extends DateValue> extends Omit<AriaDateFieldPropsBase<T>, 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue'> {}
|
|
28
28
|
|
|
29
29
|
export interface DateFieldAria {
|
|
30
30
|
/** Props for the field's visible label element, if any. */
|
|
@@ -57,7 +57,7 @@ export const focusManagerSymbol = '__focusManager_' + Date.now();
|
|
|
57
57
|
* A date field allows users to enter and edit date and time values using a keyboard.
|
|
58
58
|
* Each part of a date value is displayed in an individually editable segment.
|
|
59
59
|
*/
|
|
60
|
-
export function useDateField<T extends DateValue>(props:
|
|
60
|
+
export function useDateField<T extends DateValue>(props: AriaDateFieldOptions<T>, state: DateFieldState, ref: RefObject<Element>): DateFieldAria {
|
|
61
61
|
let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({
|
|
62
62
|
...props,
|
|
63
63
|
labelElementType: 'span'
|
package/src/useDatePicker.ts
CHANGED
|
@@ -140,6 +140,7 @@ export function useDatePicker<T extends DateValue>(props: AriaDatePickerProps<T>
|
|
|
140
140
|
'aria-label': stringFormatter.format('calendar'),
|
|
141
141
|
'aria-labelledby': `${labelledBy} ${buttonId}`,
|
|
142
142
|
'aria-describedby': ariaDescribedBy,
|
|
143
|
+
'aria-expanded': state.isOpen || undefined,
|
|
143
144
|
onPress: () => state.setOpen(true)
|
|
144
145
|
},
|
|
145
146
|
dialogProps: {
|
|
@@ -151,6 +151,7 @@ export function useDateRangePicker<T extends DateValue>(props: AriaDateRangePick
|
|
|
151
151
|
'aria-label': stringFormatter.format('calendar'),
|
|
152
152
|
'aria-labelledby': `${labelledBy} ${buttonId}`,
|
|
153
153
|
'aria-describedby': ariaDescribedBy,
|
|
154
|
+
'aria-expanded': state.isOpen || undefined,
|
|
154
155
|
onPress: () => state.setOpen(true)
|
|
155
156
|
},
|
|
156
157
|
dialogProps: {
|