@react-stately/datepicker 3.9.3 → 3.9.4
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/ar-AE.mjs +1 -1
- package/dist/bg-BG.mjs +1 -1
- package/dist/cs-CZ.mjs +1 -1
- package/dist/da-DK.mjs +1 -1
- package/dist/de-DE.mjs +1 -1
- package/dist/el-GR.mjs +1 -1
- package/dist/en-US.mjs +1 -1
- package/dist/es-ES.mjs +1 -1
- package/dist/et-EE.mjs +1 -1
- package/dist/fi-FI.mjs +1 -1
- package/dist/fr-FR.mjs +1 -1
- package/dist/he-IL.mjs +1 -1
- package/dist/hr-HR.mjs +1 -1
- package/dist/hu-HU.mjs +1 -1
- package/dist/intlStrings.mjs +1 -1
- package/dist/it-IT.mjs +1 -1
- package/dist/ja-JP.mjs +1 -1
- package/dist/ko-KR.mjs +1 -1
- package/dist/lt-LT.mjs +1 -1
- package/dist/lv-LV.mjs +1 -1
- package/dist/nb-NO.mjs +1 -1
- package/dist/nl-NL.mjs +1 -1
- package/dist/pl-PL.mjs +1 -1
- package/dist/placeholders.main.js +155 -155
- package/dist/placeholders.mjs +156 -156
- package/dist/placeholders.module.js +155 -155
- package/dist/pt-BR.mjs +1 -1
- package/dist/pt-PT.mjs +1 -1
- package/dist/ro-RO.mjs +1 -1
- package/dist/ru-RU.mjs +1 -1
- package/dist/sk-SK.mjs +1 -1
- package/dist/sl-SI.mjs +1 -1
- package/dist/sr-SP.mjs +1 -1
- package/dist/sv-SE.mjs +1 -1
- package/dist/tr-TR.mjs +1 -1
- package/dist/uk-UA.mjs +1 -1
- package/dist/useDateFieldState.main.js +41 -41
- package/dist/useDateFieldState.mjs +42 -42
- package/dist/useDateFieldState.module.js +41 -41
- package/dist/useDatePickerState.main.js +9 -9
- package/dist/useDatePickerState.mjs +10 -10
- package/dist/useDatePickerState.module.js +9 -9
- package/dist/useDateRangePickerState.main.js +18 -18
- package/dist/useDateRangePickerState.mjs +19 -19
- package/dist/useDateRangePickerState.module.js +18 -18
- package/dist/useTimeFieldState.main.js +7 -7
- package/dist/useTimeFieldState.mjs +8 -8
- package/dist/useTimeFieldState.module.js +7 -7
- package/dist/utils.main.js +31 -31
- package/dist/utils.mjs +32 -32
- package/dist/utils.module.js +31 -31
- package/dist/zh-CN.mjs +1 -1
- package/dist/zh-TW.mjs +1 -1
- package/package.json +9 -9
package/dist/utils.module.js
CHANGED
|
@@ -28,7 +28,7 @@ function $35a22f14a1f04b11$var$getLocale() {
|
|
|
28
28
|
// Match browser language setting here, NOT react-aria's I18nProvider, so that we match other browser-provided
|
|
29
29
|
// validation messages, which to not respect our provider's language.
|
|
30
30
|
// @ts-ignore
|
|
31
|
-
return typeof navigator !==
|
|
31
|
+
return typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
|
|
32
32
|
}
|
|
33
33
|
function $35a22f14a1f04b11$export$f18627323ab57ac0(value, minValue, maxValue, isDateUnavailable, options) {
|
|
34
34
|
let rangeOverflow = value != null && maxValue != null && value.compare(maxValue) > 0;
|
|
@@ -38,17 +38,17 @@ function $35a22f14a1f04b11$export$f18627323ab57ac0(value, minValue, maxValue, is
|
|
|
38
38
|
let errors = [];
|
|
39
39
|
if (isInvalid) {
|
|
40
40
|
let locale = $35a22f14a1f04b11$var$getLocale();
|
|
41
|
-
let strings = (0, $bUJMr$LocalizedStringDictionary).getGlobalDictionaryForPackage(
|
|
41
|
+
let strings = (0, $bUJMr$LocalizedStringDictionary).getGlobalDictionaryForPackage('@react-stately/datepicker') || $35a22f14a1f04b11$var$dictionary;
|
|
42
42
|
let formatter = new (0, $bUJMr$LocalizedStringFormatter)(locale, strings);
|
|
43
43
|
let dateFormatter = new (0, $bUJMr$DateFormatter)(locale, $35a22f14a1f04b11$export$7e319ea407e63bc0({}, options));
|
|
44
44
|
let timeZone = dateFormatter.resolvedOptions().timeZone;
|
|
45
|
-
if (rangeUnderflow) errors.push(formatter.format(
|
|
45
|
+
if (rangeUnderflow) errors.push(formatter.format('rangeUnderflow', {
|
|
46
46
|
minValue: dateFormatter.format(minValue.toDate(timeZone))
|
|
47
47
|
}));
|
|
48
|
-
if (rangeOverflow) errors.push(formatter.format(
|
|
48
|
+
if (rangeOverflow) errors.push(formatter.format('rangeOverflow', {
|
|
49
49
|
maxValue: dateFormatter.format(maxValue.toDate(timeZone))
|
|
50
50
|
}));
|
|
51
|
-
if (isUnavailable) errors.push(formatter.format(
|
|
51
|
+
if (isUnavailable) errors.push(formatter.format('unavailableDate'));
|
|
52
52
|
}
|
|
53
53
|
return {
|
|
54
54
|
isInvalid: isInvalid,
|
|
@@ -73,11 +73,11 @@ function $35a22f14a1f04b11$export$80ff8fc0ae339c13(value, minValue, maxValue, is
|
|
|
73
73
|
let endValidation = $35a22f14a1f04b11$export$f18627323ab57ac0(value === null || value === void 0 ? void 0 : value.end, minValue, maxValue, isDateUnavailable, options);
|
|
74
74
|
let result = (0, $bUJMr$mergeValidation)(startValidation, endValidation);
|
|
75
75
|
if (value.end != null && value.start != null && value.end.compare(value.start) < 0) {
|
|
76
|
-
let strings = (0, $bUJMr$LocalizedStringDictionary).getGlobalDictionaryForPackage(
|
|
76
|
+
let strings = (0, $bUJMr$LocalizedStringDictionary).getGlobalDictionaryForPackage('@react-stately/datepicker') || $35a22f14a1f04b11$var$dictionary;
|
|
77
77
|
result = (0, $bUJMr$mergeValidation)(result, {
|
|
78
78
|
isInvalid: true,
|
|
79
79
|
validationErrors: [
|
|
80
|
-
strings.getStringForLocale(
|
|
80
|
+
strings.getStringForLocale('rangeReversed', $35a22f14a1f04b11$var$getLocale())
|
|
81
81
|
],
|
|
82
82
|
validationDetails: {
|
|
83
83
|
...(0, $bUJMr$VALID_VALIDITY_STATE),
|
|
@@ -90,20 +90,20 @@ function $35a22f14a1f04b11$export$80ff8fc0ae339c13(value, minValue, maxValue, is
|
|
|
90
90
|
return result;
|
|
91
91
|
}
|
|
92
92
|
const $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS = {
|
|
93
|
-
year:
|
|
94
|
-
month:
|
|
95
|
-
day:
|
|
96
|
-
hour:
|
|
97
|
-
minute:
|
|
98
|
-
second:
|
|
93
|
+
year: 'numeric',
|
|
94
|
+
month: 'numeric',
|
|
95
|
+
day: 'numeric',
|
|
96
|
+
hour: 'numeric',
|
|
97
|
+
minute: '2-digit',
|
|
98
|
+
second: '2-digit'
|
|
99
99
|
};
|
|
100
100
|
const $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS = {
|
|
101
|
-
year:
|
|
102
|
-
month:
|
|
103
|
-
day:
|
|
104
|
-
hour:
|
|
105
|
-
minute:
|
|
106
|
-
second:
|
|
101
|
+
year: 'numeric',
|
|
102
|
+
month: '2-digit',
|
|
103
|
+
day: '2-digit',
|
|
104
|
+
hour: '2-digit',
|
|
105
|
+
minute: '2-digit',
|
|
106
|
+
second: '2-digit'
|
|
107
107
|
};
|
|
108
108
|
function $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, options) {
|
|
109
109
|
let defaultFieldOptions = options.shouldForceLeadingZeros ? $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS : $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS;
|
|
@@ -111,27 +111,27 @@ function $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, options) {
|
|
|
111
111
|
...defaultFieldOptions,
|
|
112
112
|
...fieldOptions
|
|
113
113
|
};
|
|
114
|
-
let granularity = options.granularity ||
|
|
114
|
+
let granularity = options.granularity || 'minute';
|
|
115
115
|
let keys = Object.keys(fieldOptions);
|
|
116
116
|
var _options_maxGranularity;
|
|
117
|
-
let startIdx = keys.indexOf((_options_maxGranularity = options.maxGranularity) !== null && _options_maxGranularity !== void 0 ? _options_maxGranularity :
|
|
117
|
+
let startIdx = keys.indexOf((_options_maxGranularity = options.maxGranularity) !== null && _options_maxGranularity !== void 0 ? _options_maxGranularity : 'year');
|
|
118
118
|
if (startIdx < 0) startIdx = 0;
|
|
119
119
|
let endIdx = keys.indexOf(granularity);
|
|
120
120
|
if (endIdx < 0) endIdx = 2;
|
|
121
|
-
if (startIdx > endIdx) throw new Error(
|
|
121
|
+
if (startIdx > endIdx) throw new Error('maxGranularity must be greater than granularity');
|
|
122
122
|
let opts = keys.slice(startIdx, endIdx + 1).reduce((opts, key)=>{
|
|
123
123
|
opts[key] = fieldOptions[key];
|
|
124
124
|
return opts;
|
|
125
125
|
}, {});
|
|
126
126
|
if (options.hourCycle != null) opts.hour12 = options.hourCycle === 12;
|
|
127
|
-
opts.timeZone = options.timeZone ||
|
|
128
|
-
let hasTime = granularity ===
|
|
129
|
-
if (hasTime && options.timeZone && !options.hideTimeZone) opts.timeZoneName =
|
|
130
|
-
if (options.showEra && startIdx === 0) opts.era =
|
|
127
|
+
opts.timeZone = options.timeZone || 'UTC';
|
|
128
|
+
let hasTime = granularity === 'hour' || granularity === 'minute' || granularity === 'second';
|
|
129
|
+
if (hasTime && options.timeZone && !options.hideTimeZone) opts.timeZoneName = 'short';
|
|
130
|
+
if (options.showEra && startIdx === 0) opts.era = 'short';
|
|
131
131
|
return opts;
|
|
132
132
|
}
|
|
133
133
|
function $35a22f14a1f04b11$export$c5221a78ef73c5e9(placeholderValue) {
|
|
134
|
-
if (placeholderValue &&
|
|
134
|
+
if (placeholderValue && 'hour' in placeholderValue) return placeholderValue;
|
|
135
135
|
return new (0, $bUJMr$Time)();
|
|
136
136
|
}
|
|
137
137
|
function $35a22f14a1f04b11$export$61a490a80c552550(value, calendar) {
|
|
@@ -147,16 +147,16 @@ function $35a22f14a1f04b11$export$66aa2b09de4b1ea5(placeholderValue, granularity
|
|
|
147
147
|
second: 0,
|
|
148
148
|
millisecond: 0
|
|
149
149
|
}), calendar);
|
|
150
|
-
if (granularity ===
|
|
150
|
+
if (granularity === 'year' || granularity === 'month' || granularity === 'day') return (0, $bUJMr$toCalendarDate)(date);
|
|
151
151
|
if (!timeZone) return (0, $bUJMr$toCalendarDateTime)(date);
|
|
152
152
|
return date;
|
|
153
153
|
}
|
|
154
154
|
function $35a22f14a1f04b11$export$2440da353cedad43(v, granularity) {
|
|
155
155
|
// Compute default granularity and time zone from the value. If the value becomes null, keep the last values.
|
|
156
|
-
let defaultTimeZone = v &&
|
|
157
|
-
let defaultGranularity = v &&
|
|
156
|
+
let defaultTimeZone = v && 'timeZone' in v ? v.timeZone : undefined;
|
|
157
|
+
let defaultGranularity = v && 'minute' in v ? 'minute' : 'day';
|
|
158
158
|
// props.granularity must actually exist in the value if one is provided.
|
|
159
|
-
if (v && granularity && !(granularity in v)) throw new Error(
|
|
159
|
+
if (v && granularity && !(granularity in v)) throw new Error('Invalid granularity ' + granularity + ' for value ' + v.toString());
|
|
160
160
|
let [lastValue, setLastValue] = (0, $bUJMr$useState)([
|
|
161
161
|
defaultGranularity,
|
|
162
162
|
defaultTimeZone
|
package/dist/zh-CN.mjs
CHANGED
package/dist/zh-TW.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-stately/datepicker",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.4",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@internationalized/date": "^3.5.
|
|
26
|
-
"@internationalized/string": "^3.2.
|
|
27
|
-
"@react-stately/form": "^3.0.
|
|
28
|
-
"@react-stately/overlays": "^3.6.
|
|
29
|
-
"@react-stately/utils": "^3.10.
|
|
30
|
-
"@react-types/datepicker": "^3.7.
|
|
31
|
-
"@react-types/shared": "^3.23.
|
|
25
|
+
"@internationalized/date": "^3.5.4",
|
|
26
|
+
"@internationalized/string": "^3.2.3",
|
|
27
|
+
"@react-stately/form": "^3.0.3",
|
|
28
|
+
"@react-stately/overlays": "^3.6.7",
|
|
29
|
+
"@react-stately/utils": "^3.10.1",
|
|
30
|
+
"@react-types/datepicker": "^3.7.4",
|
|
31
|
+
"@react-types/shared": "^3.23.1",
|
|
32
32
|
"@swc/helpers": "^0.5.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
|
|
41
41
|
}
|