@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/import.mjs
CHANGED
|
@@ -4,12 +4,11 @@ import {privateValidationStateProp as $cIPI0$privateValidationStateProp, DEFAULT
|
|
|
4
4
|
import $cIPI0$react, {useMemo as $cIPI0$useMemo, useRef as $cIPI0$useRef, useEffect as $cIPI0$useEffect} from "react";
|
|
5
5
|
import {useField as $cIPI0$useField} from "@react-aria/label";
|
|
6
6
|
import {useFocusWithin as $cIPI0$useFocusWithin, usePress as $cIPI0$usePress} from "@react-aria/interactions";
|
|
7
|
-
import {useLocalizedStringFormatter as $cIPI0$useLocalizedStringFormatter, useLocale as $cIPI0$useLocale, useDateFormatter as $cIPI0$useDateFormatter, useFilter as $cIPI0$useFilter} from "@react-aria/i18n";
|
|
7
|
+
import {useLocalizedStringFormatter as $cIPI0$useLocalizedStringFormatter, useLocale as $cIPI0$useLocale, useDateFormatter as $cIPI0$useDateFormatter, useFilter as $cIPI0$useFilter, useLocalizedStringDictionary as $cIPI0$useLocalizedStringDictionary} from "@react-aria/i18n";
|
|
8
8
|
import {useFormValidation as $cIPI0$useFormValidation} from "@react-aria/form";
|
|
9
9
|
import {toCalendar as $cIPI0$toCalendar, CalendarDate as $cIPI0$CalendarDate} from "@internationalized/date";
|
|
10
10
|
import {NumberParser as $cIPI0$NumberParser} from "@internationalized/number";
|
|
11
11
|
import {useSpinButton as $cIPI0$useSpinButton} from "@react-aria/spinbutton";
|
|
12
|
-
import {LocalizedStringDictionary as $cIPI0$LocalizedStringDictionary} from "@internationalized/string";
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
function $parcel$interopDefault(a) {
|
|
@@ -916,7 +915,7 @@ function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
|
916
915
|
},
|
|
917
916
|
onFocusWithinChange: props.onFocusChange
|
|
918
917
|
});
|
|
919
|
-
let stringFormatter = (0, $cIPI0$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($dfb4eba373ed9493$exports))));
|
|
918
|
+
let stringFormatter = (0, $cIPI0$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($dfb4eba373ed9493$exports))), "@react-aria/datepicker");
|
|
920
919
|
let message = state.maxGranularity === "hour" ? "selectedTimeDescription" : "selectedDateDescription";
|
|
921
920
|
let field = state.maxGranularity === "hour" ? "time" : "date";
|
|
922
921
|
let description = state.value ? stringFormatter.format(message, {
|
|
@@ -1028,7 +1027,7 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
1028
1027
|
let buttonId = (0, $cIPI0$useId)();
|
|
1029
1028
|
let dialogId = (0, $cIPI0$useId)();
|
|
1030
1029
|
let fieldId = (0, $cIPI0$useId)();
|
|
1031
|
-
let stringFormatter = (0, $cIPI0$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($dfb4eba373ed9493$exports))));
|
|
1030
|
+
let stringFormatter = (0, $cIPI0$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($dfb4eba373ed9493$exports))), "@react-aria/datepicker");
|
|
1032
1031
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
1033
1032
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $cIPI0$useField)({
|
|
1034
1033
|
...props,
|
|
@@ -1113,6 +1112,7 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
1113
1112
|
"aria-labelledby": `${buttonId} ${labelledBy}`,
|
|
1114
1113
|
"aria-describedby": ariaDescribedBy,
|
|
1115
1114
|
"aria-expanded": state.isOpen,
|
|
1115
|
+
isDisabled: props.isDisabled || props.isReadOnly,
|
|
1116
1116
|
onPress: ()=>state.setOpen(true)
|
|
1117
1117
|
},
|
|
1118
1118
|
dialogProps: {
|
|
@@ -1169,9 +1169,9 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
1169
1169
|
|
|
1170
1170
|
|
|
1171
1171
|
|
|
1172
|
-
|
|
1173
1172
|
function $3aeceb3a64eb8358$export$d42c60378c8168f8() {
|
|
1174
1173
|
let { locale: locale } = (0, $cIPI0$useLocale)();
|
|
1174
|
+
let dictionary = (0, $cIPI0$useLocalizedStringDictionary)((0, (/*@__PURE__*/$parcel$interopDefault($dfb4eba373ed9493$exports))), "@react-aria/datepicker");
|
|
1175
1175
|
return (0, $cIPI0$useMemo)(()=>{
|
|
1176
1176
|
// Try to use Intl.DisplayNames if possible. It may be supported in browsers, but not support the dateTimeField
|
|
1177
1177
|
// type as that was only added in v2. https://github.com/tc39/intl-displaynames-v2
|
|
@@ -1181,19 +1181,20 @@ function $3aeceb3a64eb8358$export$d42c60378c8168f8() {
|
|
|
1181
1181
|
type: "dateTimeField"
|
|
1182
1182
|
});
|
|
1183
1183
|
} catch (err) {
|
|
1184
|
-
return new $3aeceb3a64eb8358$var$DisplayNamesPolyfill(locale);
|
|
1184
|
+
return new $3aeceb3a64eb8358$var$DisplayNamesPolyfill(locale, dictionary);
|
|
1185
1185
|
}
|
|
1186
1186
|
}, [
|
|
1187
|
-
locale
|
|
1187
|
+
locale,
|
|
1188
|
+
dictionary
|
|
1188
1189
|
]);
|
|
1189
1190
|
}
|
|
1190
1191
|
class $3aeceb3a64eb8358$var$DisplayNamesPolyfill {
|
|
1191
1192
|
of(field) {
|
|
1192
1193
|
return this.dictionary.getStringForLocale(field, this.locale);
|
|
1193
1194
|
}
|
|
1194
|
-
constructor(locale){
|
|
1195
|
+
constructor(locale, dictionary){
|
|
1195
1196
|
this.locale = locale;
|
|
1196
|
-
this.dictionary =
|
|
1197
|
+
this.dictionary = dictionary;
|
|
1197
1198
|
}
|
|
1198
1199
|
}
|
|
1199
1200
|
|
|
@@ -1548,7 +1549,7 @@ function $32489daedd52963e$var$commonPrefixLength(strings) {
|
|
|
1548
1549
|
|
|
1549
1550
|
function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
1550
1551
|
var _state_value, _state_value1;
|
|
1551
|
-
let stringFormatter = (0, $cIPI0$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($dfb4eba373ed9493$exports))));
|
|
1552
|
+
let stringFormatter = (0, $cIPI0$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($dfb4eba373ed9493$exports))), "@react-aria/datepicker");
|
|
1552
1553
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
1553
1554
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $cIPI0$useField)({
|
|
1554
1555
|
...props,
|
|
@@ -1640,6 +1641,7 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
1640
1641
|
"aria-labelledby": `${buttonId} ${labelledBy}`,
|
|
1641
1642
|
"aria-describedby": ariaDescribedBy,
|
|
1642
1643
|
"aria-expanded": state.isOpen,
|
|
1644
|
+
isDisabled: props.isDisabled || props.isReadOnly,
|
|
1643
1645
|
onPress: ()=>state.setOpen(true)
|
|
1644
1646
|
},
|
|
1645
1647
|
dialogProps: {
|
package/dist/main.js
CHANGED
|
@@ -9,7 +9,6 @@ var $IwcIq$reactariaform = require("@react-aria/form");
|
|
|
9
9
|
var $IwcIq$internationalizeddate = require("@internationalized/date");
|
|
10
10
|
var $IwcIq$internationalizednumber = require("@internationalized/number");
|
|
11
11
|
var $IwcIq$reactariaspinbutton = require("@react-aria/spinbutton");
|
|
12
|
-
var $IwcIq$internationalizedstring = require("@internationalized/string");
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
function $parcel$export(e, n, v, s) {
|
|
@@ -927,7 +926,7 @@ function $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref) {
|
|
|
927
926
|
},
|
|
928
927
|
onFocusWithinChange: props.onFocusChange
|
|
929
928
|
});
|
|
930
|
-
let stringFormatter = (0, $IwcIq$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($c1905b78f6d2f5bf$exports))));
|
|
929
|
+
let stringFormatter = (0, $IwcIq$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($c1905b78f6d2f5bf$exports))), "@react-aria/datepicker");
|
|
931
930
|
let message = state.maxGranularity === "hour" ? "selectedTimeDescription" : "selectedDateDescription";
|
|
932
931
|
let field = state.maxGranularity === "hour" ? "time" : "date";
|
|
933
932
|
let description = state.value ? stringFormatter.format(message, {
|
|
@@ -1039,7 +1038,7 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
1039
1038
|
let buttonId = (0, $IwcIq$reactariautils.useId)();
|
|
1040
1039
|
let dialogId = (0, $IwcIq$reactariautils.useId)();
|
|
1041
1040
|
let fieldId = (0, $IwcIq$reactariautils.useId)();
|
|
1042
|
-
let stringFormatter = (0, $IwcIq$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($c1905b78f6d2f5bf$exports))));
|
|
1041
|
+
let stringFormatter = (0, $IwcIq$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($c1905b78f6d2f5bf$exports))), "@react-aria/datepicker");
|
|
1043
1042
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
1044
1043
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $IwcIq$reactarialabel.useField)({
|
|
1045
1044
|
...props,
|
|
@@ -1124,6 +1123,7 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
1124
1123
|
"aria-labelledby": `${buttonId} ${labelledBy}`,
|
|
1125
1124
|
"aria-describedby": ariaDescribedBy,
|
|
1126
1125
|
"aria-expanded": state.isOpen,
|
|
1126
|
+
isDisabled: props.isDisabled || props.isReadOnly,
|
|
1127
1127
|
onPress: ()=>state.setOpen(true)
|
|
1128
1128
|
},
|
|
1129
1129
|
dialogProps: {
|
|
@@ -1180,9 +1180,9 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
1180
1180
|
|
|
1181
1181
|
|
|
1182
1182
|
|
|
1183
|
-
|
|
1184
1183
|
function $934ac650a0aceb4b$export$d42c60378c8168f8() {
|
|
1185
1184
|
let { locale: locale } = (0, $IwcIq$reactariai18n.useLocale)();
|
|
1185
|
+
let dictionary = (0, $IwcIq$reactariai18n.useLocalizedStringDictionary)((0, (/*@__PURE__*/$parcel$interopDefault($c1905b78f6d2f5bf$exports))), "@react-aria/datepicker");
|
|
1186
1186
|
return (0, $IwcIq$react.useMemo)(()=>{
|
|
1187
1187
|
// Try to use Intl.DisplayNames if possible. It may be supported in browsers, but not support the dateTimeField
|
|
1188
1188
|
// type as that was only added in v2. https://github.com/tc39/intl-displaynames-v2
|
|
@@ -1192,19 +1192,20 @@ function $934ac650a0aceb4b$export$d42c60378c8168f8() {
|
|
|
1192
1192
|
type: "dateTimeField"
|
|
1193
1193
|
});
|
|
1194
1194
|
} catch (err) {
|
|
1195
|
-
return new $934ac650a0aceb4b$var$DisplayNamesPolyfill(locale);
|
|
1195
|
+
return new $934ac650a0aceb4b$var$DisplayNamesPolyfill(locale, dictionary);
|
|
1196
1196
|
}
|
|
1197
1197
|
}, [
|
|
1198
|
-
locale
|
|
1198
|
+
locale,
|
|
1199
|
+
dictionary
|
|
1199
1200
|
]);
|
|
1200
1201
|
}
|
|
1201
1202
|
class $934ac650a0aceb4b$var$DisplayNamesPolyfill {
|
|
1202
1203
|
of(field) {
|
|
1203
1204
|
return this.dictionary.getStringForLocale(field, this.locale);
|
|
1204
1205
|
}
|
|
1205
|
-
constructor(locale){
|
|
1206
|
+
constructor(locale, dictionary){
|
|
1206
1207
|
this.locale = locale;
|
|
1207
|
-
this.dictionary =
|
|
1208
|
+
this.dictionary = dictionary;
|
|
1208
1209
|
}
|
|
1209
1210
|
}
|
|
1210
1211
|
|
|
@@ -1559,7 +1560,7 @@ function $5c015c6316d1904d$var$commonPrefixLength(strings) {
|
|
|
1559
1560
|
|
|
1560
1561
|
function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
1561
1562
|
var _state_value, _state_value1;
|
|
1562
|
-
let stringFormatter = (0, $IwcIq$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($c1905b78f6d2f5bf$exports))));
|
|
1563
|
+
let stringFormatter = (0, $IwcIq$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($c1905b78f6d2f5bf$exports))), "@react-aria/datepicker");
|
|
1563
1564
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
1564
1565
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $IwcIq$reactarialabel.useField)({
|
|
1565
1566
|
...props,
|
|
@@ -1651,6 +1652,7 @@ function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
1651
1652
|
"aria-labelledby": `${buttonId} ${labelledBy}`,
|
|
1652
1653
|
"aria-describedby": ariaDescribedBy,
|
|
1653
1654
|
"aria-expanded": state.isOpen,
|
|
1655
|
+
isDisabled: props.isDisabled || props.isReadOnly,
|
|
1654
1656
|
onPress: ()=>state.setOpen(true)
|
|
1655
1657
|
},
|
|
1656
1658
|
dialogProps: {
|