@react-aria/datepicker 3.9.0 → 3.9.2
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 +12 -10
- package/dist/main.js +11 -9
- package/dist/main.js.map +1 -1
- package/dist/module.js +12 -10
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/useDateField.ts +1 -1
- package/src/useDatePicker.ts +2 -1
- package/src/useDateRangePicker.ts +2 -1
- package/src/useDisplayNames.ts +6 -5
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AC2BA,sCAAsC,CAAC,SAAS,SAAS,CAAE,SAAQ,IAAI,CAAC,mBAAuB,CAAC,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,kBAAkB,GAAG,UAAU,CAAC;IACnM,mEAAmE;IACnE,QAAQ,CAAC,EAAE,UAAU,gBAAgB,CAAC,CAAA;CACvC;AAED,8BAA+B,SAAQ,gBAAgB;IACpD,2DAA2D;IAC5D,UAAU,EAAE,aAAa,CAAC;IACzB,4CAA4C;IAC7C,UAAU,EAAE,kBAAkB,CAAC;IAC/B,mEAAmE;IACnE,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,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,CA8H/I;AAED,+BAAsC,CAAC,SAAS,SAAS,CAAE,SAAQ,mBAAmB,CAAC,CAAC;IACtF,mEAAmE;IACnE,QAAQ,CAAC,EAAE,UAAU,gBAAgB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EAAE,KAAK,GAAG,MAAM,CAAA;CACzB;AAED,eAAe;AACf,mCAAmC,YAAY,CAa9C;ACdD;IACE,qCAAqC;IACrC,YAAY,EAAE,aAAa,CAAA;CAC5B;AAED;;;;GAIG;AACH,+BAA+B,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC,GAAG,eAAe,CAwWxH;AC3WD,oCAAqC,SAAQ,gBAAgB;IAC3D,uEAAuE;IACvE,UAAU,EAAE,aAAa,CAAC;IAC1B,4EAA4E;IAC5E,UAAU,EAAE,kBAAkB,CAAC;IAC/B,sCAAsC;IACtC,eAAe,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,CAsKrK;AC5MD,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.9.
|
|
3
|
+
"version": "3.9.2",
|
|
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.5.
|
|
26
|
-
"@internationalized/number": "^3.
|
|
27
|
-
"@internationalized/string": "^3.
|
|
28
|
-
"@react-aria/focus": "^3.
|
|
29
|
-
"@react-aria/form": "^3.0.
|
|
30
|
-
"@react-aria/i18n": "^3.
|
|
31
|
-
"@react-aria/interactions": "^3.
|
|
32
|
-
"@react-aria/label": "^3.7.
|
|
33
|
-
"@react-aria/spinbutton": "^3.6.
|
|
34
|
-
"@react-aria/utils": "^3.
|
|
35
|
-
"@react-stately/datepicker": "^3.9.
|
|
25
|
+
"@internationalized/date": "^3.5.1",
|
|
26
|
+
"@internationalized/number": "^3.5.0",
|
|
27
|
+
"@internationalized/string": "^3.2.0",
|
|
28
|
+
"@react-aria/focus": "^3.16.1",
|
|
29
|
+
"@react-aria/form": "^3.0.2",
|
|
30
|
+
"@react-aria/i18n": "^3.10.1",
|
|
31
|
+
"@react-aria/interactions": "^3.21.0",
|
|
32
|
+
"@react-aria/label": "^3.7.5",
|
|
33
|
+
"@react-aria/spinbutton": "^3.6.2",
|
|
34
|
+
"@react-aria/utils": "^3.23.1",
|
|
35
|
+
"@react-stately/datepicker": "^3.9.1",
|
|
36
36
|
"@react-stately/form": "^3.0.0",
|
|
37
37
|
"@react-types/button": "^3.9.1",
|
|
38
|
-
"@react-types/calendar": "^3.4.
|
|
39
|
-
"@react-types/datepicker": "^3.7.
|
|
38
|
+
"@react-types/calendar": "^3.4.3",
|
|
39
|
+
"@react-types/datepicker": "^3.7.1",
|
|
40
40
|
"@react-types/dialog": "^3.5.7",
|
|
41
41
|
"@react-types/shared": "^3.22.0",
|
|
42
42
|
"@swc/helpers": "^0.5.0"
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "f040ff62678e6a31375b96c05396df0bae660350"
|
|
52
52
|
}
|
package/src/useDateField.ts
CHANGED
|
@@ -89,7 +89,7 @@ export function useDateField<T extends DateValue>(props: AriaDateFieldOptions<T>
|
|
|
89
89
|
onFocusWithinChange: props.onFocusChange
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
let stringFormatter = useLocalizedStringFormatter(intlMessages);
|
|
92
|
+
let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');
|
|
93
93
|
let message = state.maxGranularity === 'hour' ? 'selectedTimeDescription' : 'selectedDateDescription';
|
|
94
94
|
let field = state.maxGranularity === 'hour' ? 'time' : 'date';
|
|
95
95
|
let description = state.value ? stringFormatter.format(message, {[field]: state.formatValue({month: 'long'})}) : '';
|
package/src/useDatePicker.ts
CHANGED
|
@@ -55,7 +55,7 @@ export function useDatePicker<T extends DateValue>(props: AriaDatePickerProps<T>
|
|
|
55
55
|
let buttonId = useId();
|
|
56
56
|
let dialogId = useId();
|
|
57
57
|
let fieldId = useId();
|
|
58
|
-
let stringFormatter = useLocalizedStringFormatter(intlMessages);
|
|
58
|
+
let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');
|
|
59
59
|
|
|
60
60
|
let {isInvalid, validationErrors, validationDetails} = state.displayValidation;
|
|
61
61
|
let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({
|
|
@@ -147,6 +147,7 @@ export function useDatePicker<T extends DateValue>(props: AriaDatePickerProps<T>
|
|
|
147
147
|
'aria-labelledby': `${buttonId} ${labelledBy}`,
|
|
148
148
|
'aria-describedby': ariaDescribedBy,
|
|
149
149
|
'aria-expanded': state.isOpen,
|
|
150
|
+
isDisabled: props.isDisabled || props.isReadOnly,
|
|
150
151
|
onPress: () => state.setOpen(true)
|
|
151
152
|
},
|
|
152
153
|
dialogProps: {
|
|
@@ -55,7 +55,7 @@ export interface DateRangePickerAria extends ValidationResult {
|
|
|
55
55
|
* users to enter or select a date and time range.
|
|
56
56
|
*/
|
|
57
57
|
export function useDateRangePicker<T extends DateValue>(props: AriaDateRangePickerProps<T>, state: DateRangePickerState, ref: RefObject<Element>): DateRangePickerAria {
|
|
58
|
-
let stringFormatter = useLocalizedStringFormatter(intlMessages);
|
|
58
|
+
let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');
|
|
59
59
|
let {isInvalid, validationErrors, validationDetails} = state.displayValidation;
|
|
60
60
|
let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({
|
|
61
61
|
...props,
|
|
@@ -158,6 +158,7 @@ export function useDateRangePicker<T extends DateValue>(props: AriaDateRangePick
|
|
|
158
158
|
'aria-labelledby': `${buttonId} ${labelledBy}`,
|
|
159
159
|
'aria-describedby': ariaDescribedBy,
|
|
160
160
|
'aria-expanded': state.isOpen,
|
|
161
|
+
isDisabled: props.isDisabled || props.isReadOnly,
|
|
161
162
|
onPress: () => state.setOpen(true)
|
|
162
163
|
},
|
|
163
164
|
dialogProps: {
|
package/src/useDisplayNames.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// @ts-ignore
|
|
14
14
|
import intlMessages from '../intl/*.json';
|
|
15
15
|
import {LocalizedStringDictionary} from '@internationalized/string';
|
|
16
|
-
import {useLocale} from '@react-aria/i18n';
|
|
16
|
+
import {useLocale, useLocalizedStringDictionary} from '@react-aria/i18n';
|
|
17
17
|
import {useMemo} from 'react';
|
|
18
18
|
|
|
19
19
|
type Field = Intl.DateTimeFormatPartTypes;
|
|
@@ -24,6 +24,7 @@ interface DisplayNames {
|
|
|
24
24
|
/** @private */
|
|
25
25
|
export function useDisplayNames(): DisplayNames {
|
|
26
26
|
let {locale} = useLocale();
|
|
27
|
+
let dictionary = useLocalizedStringDictionary(intlMessages, '@react-aria/datepicker');
|
|
27
28
|
return useMemo(() => {
|
|
28
29
|
// Try to use Intl.DisplayNames if possible. It may be supported in browsers, but not support the dateTimeField
|
|
29
30
|
// type as that was only added in v2. https://github.com/tc39/intl-displaynames-v2
|
|
@@ -31,18 +32,18 @@ export function useDisplayNames(): DisplayNames {
|
|
|
31
32
|
// @ts-ignore
|
|
32
33
|
return new Intl.DisplayNames(locale, {type: 'dateTimeField'});
|
|
33
34
|
} catch (err) {
|
|
34
|
-
return new DisplayNamesPolyfill(locale);
|
|
35
|
+
return new DisplayNamesPolyfill(locale, dictionary);
|
|
35
36
|
}
|
|
36
|
-
}, [locale]);
|
|
37
|
+
}, [locale, dictionary]);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
class DisplayNamesPolyfill implements DisplayNames {
|
|
40
41
|
private locale: string;
|
|
41
42
|
private dictionary: LocalizedStringDictionary<Field, string>;
|
|
42
43
|
|
|
43
|
-
constructor(locale: string) {
|
|
44
|
+
constructor(locale: string, dictionary: LocalizedStringDictionary<Field, string>) {
|
|
44
45
|
this.locale = locale;
|
|
45
|
-
this.dictionary =
|
|
46
|
+
this.dictionary = dictionary;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
of(field: Field): string {
|