@react-stately/datepicker 3.8.0 → 3.9.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/ar-AE.main.js +9 -0
- package/dist/ar-AE.main.js.map +1 -0
- package/dist/ar-AE.mjs +11 -0
- package/dist/ar-AE.module.js +11 -0
- package/dist/ar-AE.module.js.map +1 -0
- package/dist/bg-BG.main.js +9 -0
- package/dist/bg-BG.main.js.map +1 -0
- package/dist/bg-BG.mjs +11 -0
- package/dist/bg-BG.module.js +11 -0
- package/dist/bg-BG.module.js.map +1 -0
- package/dist/cs-CZ.main.js +9 -0
- package/dist/cs-CZ.main.js.map +1 -0
- package/dist/cs-CZ.mjs +11 -0
- package/dist/cs-CZ.module.js +11 -0
- package/dist/cs-CZ.module.js.map +1 -0
- package/dist/da-DK.main.js +9 -0
- package/dist/da-DK.main.js.map +1 -0
- package/dist/da-DK.mjs +11 -0
- package/dist/da-DK.module.js +11 -0
- package/dist/da-DK.module.js.map +1 -0
- package/dist/de-DE.main.js +9 -0
- package/dist/de-DE.main.js.map +1 -0
- package/dist/de-DE.mjs +11 -0
- package/dist/de-DE.module.js +11 -0
- package/dist/de-DE.module.js.map +1 -0
- package/dist/el-GR.main.js +9 -0
- package/dist/el-GR.main.js.map +1 -0
- package/dist/el-GR.mjs +11 -0
- package/dist/el-GR.module.js +11 -0
- package/dist/el-GR.module.js.map +1 -0
- package/dist/en-US.main.js +9 -0
- package/dist/en-US.main.js.map +1 -0
- package/dist/en-US.mjs +11 -0
- package/dist/en-US.module.js +11 -0
- package/dist/en-US.module.js.map +1 -0
- package/dist/es-ES.main.js +9 -0
- package/dist/es-ES.main.js.map +1 -0
- package/dist/es-ES.mjs +11 -0
- package/dist/es-ES.module.js +11 -0
- package/dist/es-ES.module.js.map +1 -0
- package/dist/et-EE.main.js +9 -0
- package/dist/et-EE.main.js.map +1 -0
- package/dist/et-EE.mjs +11 -0
- package/dist/et-EE.module.js +11 -0
- package/dist/et-EE.module.js.map +1 -0
- package/dist/fi-FI.main.js +9 -0
- package/dist/fi-FI.main.js.map +1 -0
- package/dist/fi-FI.mjs +11 -0
- package/dist/fi-FI.module.js +11 -0
- package/dist/fi-FI.module.js.map +1 -0
- package/dist/fr-FR.main.js +9 -0
- package/dist/fr-FR.main.js.map +1 -0
- package/dist/fr-FR.mjs +11 -0
- package/dist/fr-FR.module.js +11 -0
- package/dist/fr-FR.module.js.map +1 -0
- package/dist/he-IL.main.js +9 -0
- package/dist/he-IL.main.js.map +1 -0
- package/dist/he-IL.mjs +11 -0
- package/dist/he-IL.module.js +11 -0
- package/dist/he-IL.module.js.map +1 -0
- package/dist/hr-HR.main.js +9 -0
- package/dist/hr-HR.main.js.map +1 -0
- package/dist/hr-HR.mjs +11 -0
- package/dist/hr-HR.module.js +11 -0
- package/dist/hr-HR.module.js.map +1 -0
- package/dist/hu-HU.main.js +9 -0
- package/dist/hu-HU.main.js.map +1 -0
- package/dist/hu-HU.mjs +11 -0
- package/dist/hu-HU.module.js +11 -0
- package/dist/hu-HU.module.js.map +1 -0
- package/dist/import.mjs +361 -98
- package/dist/it-IT.main.js +9 -0
- package/dist/it-IT.main.js.map +1 -0
- package/dist/it-IT.mjs +11 -0
- package/dist/it-IT.module.js +11 -0
- package/dist/it-IT.module.js.map +1 -0
- package/dist/ja-JP.main.js +9 -0
- package/dist/ja-JP.main.js.map +1 -0
- package/dist/ja-JP.mjs +11 -0
- package/dist/ja-JP.module.js +11 -0
- package/dist/ja-JP.module.js.map +1 -0
- package/dist/ko-KR.main.js +9 -0
- package/dist/ko-KR.main.js.map +1 -0
- package/dist/ko-KR.mjs +11 -0
- package/dist/ko-KR.module.js +11 -0
- package/dist/ko-KR.module.js.map +1 -0
- package/dist/lt-LT.main.js +9 -0
- package/dist/lt-LT.main.js.map +1 -0
- package/dist/lt-LT.mjs +11 -0
- package/dist/lt-LT.module.js +11 -0
- package/dist/lt-LT.module.js.map +1 -0
- package/dist/lv-LV.main.js +9 -0
- package/dist/lv-LV.main.js.map +1 -0
- package/dist/lv-LV.mjs +11 -0
- package/dist/lv-LV.module.js +11 -0
- package/dist/lv-LV.module.js.map +1 -0
- package/dist/main.js +360 -96
- package/dist/main.js.map +1 -1
- package/dist/module.js +361 -98
- package/dist/module.js.map +1 -1
- package/dist/nb-NO.main.js +9 -0
- package/dist/nb-NO.main.js.map +1 -0
- package/dist/nb-NO.mjs +11 -0
- package/dist/nb-NO.module.js +11 -0
- package/dist/nb-NO.module.js.map +1 -0
- package/dist/nl-NL.main.js +9 -0
- package/dist/nl-NL.main.js.map +1 -0
- package/dist/nl-NL.mjs +11 -0
- package/dist/nl-NL.module.js +11 -0
- package/dist/nl-NL.module.js.map +1 -0
- package/dist/pl-PL.main.js +9 -0
- package/dist/pl-PL.main.js.map +1 -0
- package/dist/pl-PL.mjs +11 -0
- package/dist/pl-PL.module.js +11 -0
- package/dist/pl-PL.module.js.map +1 -0
- package/dist/pt-BR.main.js +9 -0
- package/dist/pt-BR.main.js.map +1 -0
- package/dist/pt-BR.mjs +11 -0
- package/dist/pt-BR.module.js +11 -0
- package/dist/pt-BR.module.js.map +1 -0
- package/dist/pt-PT.main.js +9 -0
- package/dist/pt-PT.main.js.map +1 -0
- package/dist/pt-PT.mjs +11 -0
- package/dist/pt-PT.module.js +11 -0
- package/dist/pt-PT.module.js.map +1 -0
- package/dist/ro-RO.main.js +9 -0
- package/dist/ro-RO.main.js.map +1 -0
- package/dist/ro-RO.mjs +11 -0
- package/dist/ro-RO.module.js +11 -0
- package/dist/ro-RO.module.js.map +1 -0
- package/dist/ru-RU.main.js +9 -0
- package/dist/ru-RU.main.js.map +1 -0
- package/dist/ru-RU.mjs +11 -0
- package/dist/ru-RU.module.js +11 -0
- package/dist/ru-RU.module.js.map +1 -0
- package/dist/sk-SK.main.js +9 -0
- package/dist/sk-SK.main.js.map +1 -0
- package/dist/sk-SK.mjs +11 -0
- package/dist/sk-SK.module.js +11 -0
- package/dist/sk-SK.module.js.map +1 -0
- package/dist/sl-SI.main.js +9 -0
- package/dist/sl-SI.main.js.map +1 -0
- package/dist/sl-SI.mjs +11 -0
- package/dist/sl-SI.module.js +11 -0
- package/dist/sl-SI.module.js.map +1 -0
- package/dist/sr-SP.main.js +9 -0
- package/dist/sr-SP.main.js.map +1 -0
- package/dist/sr-SP.mjs +11 -0
- package/dist/sr-SP.module.js +11 -0
- package/dist/sr-SP.module.js.map +1 -0
- package/dist/sv-SE.main.js +9 -0
- package/dist/sv-SE.main.js.map +1 -0
- package/dist/sv-SE.mjs +11 -0
- package/dist/sv-SE.module.js +11 -0
- package/dist/sv-SE.module.js.map +1 -0
- package/dist/tr-TR.main.js +9 -0
- package/dist/tr-TR.main.js.map +1 -0
- package/dist/tr-TR.mjs +11 -0
- package/dist/tr-TR.module.js +11 -0
- package/dist/tr-TR.module.js.map +1 -0
- package/dist/types.d.ts +4 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/uk-UA.main.js +9 -0
- package/dist/uk-UA.main.js.map +1 -0
- package/dist/uk-UA.mjs +11 -0
- package/dist/uk-UA.module.js +11 -0
- package/dist/uk-UA.module.js.map +1 -0
- package/dist/zh-CN.main.js +9 -0
- package/dist/zh-CN.main.js.map +1 -0
- package/dist/zh-CN.mjs +11 -0
- package/dist/zh-CN.module.js +11 -0
- package/dist/zh-CN.module.js.map +1 -0
- package/dist/zh-TW.main.js +9 -0
- package/dist/zh-TW.main.js.map +1 -0
- package/dist/zh-TW.mjs +11 -0
- package/dist/zh-TW.module.js +11 -0
- package/dist/zh-TW.module.js.map +1 -0
- package/package.json +9 -8
- package/src/useDateFieldState.ts +23 -5
- package/src/useDatePickerState.ts +36 -16
- package/src/useDateRangePickerState.ts +35 -12
- package/src/useTimeFieldState.ts +5 -3
- package/src/utils.ts +104 -5
package/dist/module.js
CHANGED
|
@@ -1,9 +1,48 @@
|
|
|
1
|
+
import $b3427c06585c22a0$exports from "./ar-AE.module.js";
|
|
2
|
+
import $d282528f459122b9$exports from "./bg-BG.module.js";
|
|
3
|
+
import $2d5eecd634a9ca45$exports from "./cs-CZ.module.js";
|
|
4
|
+
import $c8e2288226c24a67$exports from "./da-DK.module.js";
|
|
5
|
+
import $6f5745e389c346d7$exports from "./de-DE.module.js";
|
|
6
|
+
import $8c882ccf4300d1da$exports from "./el-GR.module.js";
|
|
7
|
+
import $22195056771860be$exports from "./en-US.module.js";
|
|
8
|
+
import $cedfa43b4e2a5906$exports from "./es-ES.module.js";
|
|
9
|
+
import $eeeaa8daee3601c7$exports from "./et-EE.module.js";
|
|
10
|
+
import $35e0614a49b3bb40$exports from "./fi-FI.module.js";
|
|
11
|
+
import $929bc63f7705a78f$exports from "./fr-FR.module.js";
|
|
12
|
+
import $9a28d073b034d183$exports from "./he-IL.module.js";
|
|
13
|
+
import $7743e79780ebcca3$exports from "./hr-HR.module.js";
|
|
14
|
+
import $3351817a04898858$exports from "./hu-HU.module.js";
|
|
15
|
+
import $4120bdb1d03484db$exports from "./it-IT.module.js";
|
|
16
|
+
import $65e5e1569f34ea4f$exports from "./ja-JP.module.js";
|
|
17
|
+
import $d34552a7550967e7$exports from "./ko-KR.module.js";
|
|
18
|
+
import $8f855bffe63f6eca$exports from "./lt-LT.module.js";
|
|
19
|
+
import $ce40f46d09034645$exports from "./lv-LV.module.js";
|
|
20
|
+
import $dd1a9a73340c793e$exports from "./nb-NO.module.js";
|
|
21
|
+
import $4ee1fb3f0cbe6f59$exports from "./nl-NL.module.js";
|
|
22
|
+
import $c85829aebb0bc94b$exports from "./pl-PL.module.js";
|
|
23
|
+
import $27f5cd2291ca8a02$exports from "./pt-BR.module.js";
|
|
24
|
+
import $e046fdccd69bea8e$exports from "./pt-PT.module.js";
|
|
25
|
+
import $fa5f88e804986547$exports from "./ro-RO.module.js";
|
|
26
|
+
import $28e4714602d1b568$exports from "./ru-RU.module.js";
|
|
27
|
+
import $4e3bc8cf783ad569$exports from "./sk-SK.module.js";
|
|
28
|
+
import $bee07513333bdc15$exports from "./sl-SI.module.js";
|
|
29
|
+
import $7ed9c6fad16a15ec$exports from "./sr-SP.module.js";
|
|
30
|
+
import $8bef6d5a236de86c$exports from "./sv-SE.module.js";
|
|
31
|
+
import $098b9a2d2340cfc5$exports from "./tr-TR.module.js";
|
|
32
|
+
import $54a862ea7fad7419$exports from "./uk-UA.module.js";
|
|
33
|
+
import $e6cc491d590dfda5$exports from "./zh-CN.module.js";
|
|
34
|
+
import $9aebf53181a474bd$exports from "./zh-TW.module.js";
|
|
1
35
|
import {toCalendarDate as $7UzoM$toCalendarDate, toCalendarDateTime as $7UzoM$toCalendarDateTime, DateFormatter as $7UzoM$DateFormatter, Time as $7UzoM$Time, toCalendar as $7UzoM$toCalendar, now as $7UzoM$now, GregorianCalendar as $7UzoM$GregorianCalendar, getMinimumMonthInYear as $7UzoM$getMinimumMonthInYear, getMinimumDayInMonth as $7UzoM$getMinimumDayInMonth, toZoned as $7UzoM$toZoned, toTime as $7UzoM$toTime, today as $7UzoM$today, getLocalTimeZone as $7UzoM$getLocalTimeZone} from "@internationalized/date";
|
|
36
|
+
import {useFormValidationState as $7UzoM$useFormValidationState, mergeValidation as $7UzoM$mergeValidation, VALID_VALIDITY_STATE as $7UzoM$VALID_VALIDITY_STATE} from "@react-stately/form";
|
|
2
37
|
import {useOverlayTriggerState as $7UzoM$useOverlayTriggerState} from "@react-stately/overlays";
|
|
3
38
|
import {useControlledState as $7UzoM$useControlledState} from "@react-stately/utils";
|
|
4
|
-
import {useState as $7UzoM$useState, useMemo as $7UzoM$useMemo, useRef as $7UzoM$useRef, useEffect as $7UzoM$useEffect} from "react";
|
|
5
|
-
import {LocalizedStringDictionary as $7UzoM$LocalizedStringDictionary} from "@internationalized/string";
|
|
39
|
+
import {useState as $7UzoM$useState, useMemo as $7UzoM$useMemo, useRef as $7UzoM$useRef, useEffect as $7UzoM$useEffect, useCallback as $7UzoM$useCallback} from "react";
|
|
40
|
+
import {LocalizedStringDictionary as $7UzoM$LocalizedStringDictionary, LocalizedStringFormatter as $7UzoM$LocalizedStringFormatter} from "@internationalized/string";
|
|
6
41
|
|
|
42
|
+
|
|
43
|
+
function $parcel$interopDefault(a) {
|
|
44
|
+
return a && a.__esModule ? a.default : a;
|
|
45
|
+
}
|
|
7
46
|
/*
|
|
8
47
|
* Copyright 2020 Adobe. All rights reserved.
|
|
9
48
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -36,9 +75,144 @@ import {LocalizedStringDictionary as $7UzoM$LocalizedStringDictionary} from "@in
|
|
|
36
75
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
37
76
|
* governing permissions and limitations under the License.
|
|
38
77
|
*/
|
|
78
|
+
var $452ac34de8c2444e$exports = {};
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
39
105
|
|
|
40
|
-
|
|
41
|
-
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
$452ac34de8c2444e$exports = {
|
|
114
|
+
"ar-AE": $b3427c06585c22a0$exports,
|
|
115
|
+
"bg-BG": $d282528f459122b9$exports,
|
|
116
|
+
"cs-CZ": $2d5eecd634a9ca45$exports,
|
|
117
|
+
"da-DK": $c8e2288226c24a67$exports,
|
|
118
|
+
"de-DE": $6f5745e389c346d7$exports,
|
|
119
|
+
"el-GR": $8c882ccf4300d1da$exports,
|
|
120
|
+
"en-US": $22195056771860be$exports,
|
|
121
|
+
"es-ES": $cedfa43b4e2a5906$exports,
|
|
122
|
+
"et-EE": $eeeaa8daee3601c7$exports,
|
|
123
|
+
"fi-FI": $35e0614a49b3bb40$exports,
|
|
124
|
+
"fr-FR": $929bc63f7705a78f$exports,
|
|
125
|
+
"he-IL": $9a28d073b034d183$exports,
|
|
126
|
+
"hr-HR": $7743e79780ebcca3$exports,
|
|
127
|
+
"hu-HU": $3351817a04898858$exports,
|
|
128
|
+
"it-IT": $4120bdb1d03484db$exports,
|
|
129
|
+
"ja-JP": $65e5e1569f34ea4f$exports,
|
|
130
|
+
"ko-KR": $d34552a7550967e7$exports,
|
|
131
|
+
"lt-LT": $8f855bffe63f6eca$exports,
|
|
132
|
+
"lv-LV": $ce40f46d09034645$exports,
|
|
133
|
+
"nb-NO": $dd1a9a73340c793e$exports,
|
|
134
|
+
"nl-NL": $4ee1fb3f0cbe6f59$exports,
|
|
135
|
+
"pl-PL": $c85829aebb0bc94b$exports,
|
|
136
|
+
"pt-BR": $27f5cd2291ca8a02$exports,
|
|
137
|
+
"pt-PT": $e046fdccd69bea8e$exports,
|
|
138
|
+
"ro-RO": $fa5f88e804986547$exports,
|
|
139
|
+
"ru-RU": $28e4714602d1b568$exports,
|
|
140
|
+
"sk-SK": $4e3bc8cf783ad569$exports,
|
|
141
|
+
"sl-SI": $bee07513333bdc15$exports,
|
|
142
|
+
"sr-SP": $7ed9c6fad16a15ec$exports,
|
|
143
|
+
"sv-SE": $8bef6d5a236de86c$exports,
|
|
144
|
+
"tr-TR": $098b9a2d2340cfc5$exports,
|
|
145
|
+
"uk-UA": $54a862ea7fad7419$exports,
|
|
146
|
+
"zh-CN": $e6cc491d590dfda5$exports,
|
|
147
|
+
"zh-TW": $9aebf53181a474bd$exports
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
const $35a22f14a1f04b11$var$dictionary = new (0, $7UzoM$LocalizedStringDictionary)((0, (/*@__PURE__*/$parcel$interopDefault($452ac34de8c2444e$exports))));
|
|
155
|
+
function $35a22f14a1f04b11$var$getLocale() {
|
|
156
|
+
// Match browser language setting here, NOT react-aria's I18nProvider, so that we match other browser-provided
|
|
157
|
+
// validation messages, which to not respect our provider's language.
|
|
158
|
+
// @ts-ignore
|
|
159
|
+
return typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
|
|
160
|
+
}
|
|
161
|
+
function $35a22f14a1f04b11$export$f18627323ab57ac0(value, minValue, maxValue, isDateUnavailable, options) {
|
|
162
|
+
let rangeOverflow = value != null && maxValue != null && value.compare(maxValue) > 0;
|
|
163
|
+
let rangeUnderflow = value != null && minValue != null && value.compare(minValue) < 0;
|
|
164
|
+
let isUnavailable = value != null && (isDateUnavailable === null || isDateUnavailable === void 0 ? void 0 : isDateUnavailable(value)) || false;
|
|
165
|
+
let isInvalid = rangeOverflow || rangeUnderflow || isUnavailable;
|
|
166
|
+
let errors = [];
|
|
167
|
+
if (isInvalid) {
|
|
168
|
+
let locale = $35a22f14a1f04b11$var$getLocale();
|
|
169
|
+
let strings = (0, $7UzoM$LocalizedStringDictionary).getGlobalDictionaryForPackage("@react-stately/datepicker") || $35a22f14a1f04b11$var$dictionary;
|
|
170
|
+
let formatter = new (0, $7UzoM$LocalizedStringFormatter)(locale, strings);
|
|
171
|
+
let dateFormatter = new (0, $7UzoM$DateFormatter)(locale, $35a22f14a1f04b11$export$7e319ea407e63bc0({}, options));
|
|
172
|
+
let timeZone = dateFormatter.resolvedOptions().timeZone;
|
|
173
|
+
if (rangeUnderflow) errors.push(formatter.format("rangeUnderflow", {
|
|
174
|
+
minValue: dateFormatter.format(minValue.toDate(timeZone))
|
|
175
|
+
}));
|
|
176
|
+
if (rangeOverflow) errors.push(formatter.format("rangeOverflow", {
|
|
177
|
+
maxValue: dateFormatter.format(maxValue.toDate(timeZone))
|
|
178
|
+
}));
|
|
179
|
+
if (isUnavailable) errors.push(formatter.format("unavailableDate"));
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
isInvalid: isInvalid,
|
|
183
|
+
validationErrors: errors,
|
|
184
|
+
validationDetails: {
|
|
185
|
+
badInput: isUnavailable,
|
|
186
|
+
customError: false,
|
|
187
|
+
patternMismatch: false,
|
|
188
|
+
rangeOverflow: rangeOverflow,
|
|
189
|
+
rangeUnderflow: rangeUnderflow,
|
|
190
|
+
stepMismatch: false,
|
|
191
|
+
tooLong: false,
|
|
192
|
+
tooShort: false,
|
|
193
|
+
typeMismatch: false,
|
|
194
|
+
valueMissing: false,
|
|
195
|
+
valid: !isInvalid
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function $35a22f14a1f04b11$export$80ff8fc0ae339c13(value, minValue, maxValue, isDateUnavailable, options) {
|
|
200
|
+
let startValidation = $35a22f14a1f04b11$export$f18627323ab57ac0(value === null || value === void 0 ? void 0 : value.start, minValue, maxValue, isDateUnavailable, options);
|
|
201
|
+
let endValidation = $35a22f14a1f04b11$export$f18627323ab57ac0(value === null || value === void 0 ? void 0 : value.end, minValue, maxValue, isDateUnavailable, options);
|
|
202
|
+
let result = (0, $7UzoM$mergeValidation)(startValidation, endValidation);
|
|
203
|
+
if (value.end != null && value.start != null && value.end.compare(value.start) < 0) result = (0, $7UzoM$mergeValidation)(result, {
|
|
204
|
+
isInvalid: true,
|
|
205
|
+
validationErrors: [
|
|
206
|
+
$35a22f14a1f04b11$var$dictionary.getStringForLocale("rangeReversed", $35a22f14a1f04b11$var$getLocale())
|
|
207
|
+
],
|
|
208
|
+
validationDetails: {
|
|
209
|
+
...(0, $7UzoM$VALID_VALIDITY_STATE),
|
|
210
|
+
rangeUnderflow: true,
|
|
211
|
+
rangeOverflow: true,
|
|
212
|
+
valid: false
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
return result;
|
|
42
216
|
}
|
|
43
217
|
const $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS = {
|
|
44
218
|
year: "numeric",
|
|
@@ -129,8 +303,8 @@ function $35a22f14a1f04b11$export$2440da353cedad43(v, granularity) {
|
|
|
129
303
|
|
|
130
304
|
|
|
131
305
|
|
|
306
|
+
|
|
132
307
|
function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
|
|
133
|
-
var _props_isDateUnavailable;
|
|
134
308
|
let overlayState = (0, $7UzoM$useOverlayTriggerState)(props);
|
|
135
309
|
let [value, setValue] = (0, $7UzoM$useControlledState)(props.value, props.defaultValue || null, props.onChange);
|
|
136
310
|
let v = value || props.placeholderValue;
|
|
@@ -147,10 +321,42 @@ function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
|
|
|
147
321
|
}
|
|
148
322
|
// props.granularity must actually exist in the value if one is provided.
|
|
149
323
|
if (v && !(granularity in v)) throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
|
|
324
|
+
let showEra = (value === null || value === void 0 ? void 0 : value.calendar.identifier) === "gregory" && value.era === "BC";
|
|
325
|
+
let formatOpts = (0, $7UzoM$useMemo)(()=>({
|
|
326
|
+
granularity: granularity,
|
|
327
|
+
timeZone: defaultTimeZone,
|
|
328
|
+
hideTimeZone: props.hideTimeZone,
|
|
329
|
+
hourCycle: props.hourCycle,
|
|
330
|
+
shouldForceLeadingZeros: props.shouldForceLeadingZeros,
|
|
331
|
+
showEra: showEra
|
|
332
|
+
}), [
|
|
333
|
+
granularity,
|
|
334
|
+
props.hourCycle,
|
|
335
|
+
props.shouldForceLeadingZeros,
|
|
336
|
+
defaultTimeZone,
|
|
337
|
+
props.hideTimeZone,
|
|
338
|
+
showEra
|
|
339
|
+
]);
|
|
340
|
+
let { minValue: minValue, maxValue: maxValue, isDateUnavailable: isDateUnavailable } = props;
|
|
341
|
+
let builtinValidation = (0, $7UzoM$useMemo)(()=>(0, $35a22f14a1f04b11$export$f18627323ab57ac0)(value, minValue, maxValue, isDateUnavailable, formatOpts), [
|
|
342
|
+
value,
|
|
343
|
+
minValue,
|
|
344
|
+
maxValue,
|
|
345
|
+
isDateUnavailable,
|
|
346
|
+
formatOpts
|
|
347
|
+
]);
|
|
348
|
+
let validation = (0, $7UzoM$useFormValidationState)({
|
|
349
|
+
...props,
|
|
350
|
+
value: value,
|
|
351
|
+
builtinValidation: builtinValidation
|
|
352
|
+
});
|
|
353
|
+
let isValueInvalid = validation.displayValidation.isInvalid;
|
|
354
|
+
let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
|
|
150
355
|
let commitValue = (date, time)=>{
|
|
151
356
|
setValue("timeZone" in time ? time.set((0, $7UzoM$toCalendarDate)(date)) : (0, $7UzoM$toCalendarDateTime)(date, time));
|
|
152
357
|
setSelectedDate(null);
|
|
153
358
|
setSelectedTime(null);
|
|
359
|
+
validation.commitValidation();
|
|
154
360
|
};
|
|
155
361
|
// Intercept setValue to make sure the Time section is not changed by date selection in Calendar
|
|
156
362
|
let selectDate = (newValue)=>{
|
|
@@ -158,16 +364,18 @@ function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
|
|
|
158
364
|
if (hasTime) {
|
|
159
365
|
if (selectedTime || shouldClose) commitValue(newValue, selectedTime || (0, $35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue));
|
|
160
366
|
else setSelectedDate(newValue);
|
|
161
|
-
} else
|
|
367
|
+
} else {
|
|
368
|
+
setValue(newValue);
|
|
369
|
+
validation.commitValidation();
|
|
370
|
+
}
|
|
162
371
|
if (shouldClose) overlayState.setOpen(false);
|
|
163
372
|
};
|
|
164
373
|
let selectTime = (newValue)=>{
|
|
165
374
|
if (selectedDate && newValue) commitValue(selectedDate, newValue);
|
|
166
375
|
else setSelectedTime(newValue);
|
|
167
376
|
};
|
|
168
|
-
let isValueInvalid = props.isInvalid || props.validationState === "invalid" || (0, $35a22f14a1f04b11$export$eac50920cf2fd59a)(value, props.minValue, props.maxValue) || value && ((_props_isDateUnavailable = props.isDateUnavailable) === null || _props_isDateUnavailable === void 0 ? void 0 : _props_isDateUnavailable.call(props, value));
|
|
169
|
-
let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
|
|
170
377
|
return {
|
|
378
|
+
...validation,
|
|
171
379
|
value: value,
|
|
172
380
|
setValue: setValue,
|
|
173
381
|
dateValue: selectedDate,
|
|
@@ -188,13 +396,7 @@ function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
|
|
|
188
396
|
isInvalid: isValueInvalid,
|
|
189
397
|
formatValue (locale, fieldOptions) {
|
|
190
398
|
if (!dateValue) return "";
|
|
191
|
-
let formatOptions = (0, $35a22f14a1f04b11$export$7e319ea407e63bc0)(fieldOptions,
|
|
192
|
-
granularity: granularity,
|
|
193
|
-
timeZone: defaultTimeZone,
|
|
194
|
-
hideTimeZone: props.hideTimeZone,
|
|
195
|
-
hourCycle: props.hourCycle,
|
|
196
|
-
showEra: value.calendar.identifier === "gregory" && value.era === "BC"
|
|
197
|
-
});
|
|
399
|
+
let formatOptions = (0, $35a22f14a1f04b11$export$7e319ea407e63bc0)(fieldOptions, formatOpts);
|
|
198
400
|
let formatter = new (0, $7UzoM$DateFormatter)(locale, formatOptions);
|
|
199
401
|
return formatter.format(dateValue);
|
|
200
402
|
}
|
|
@@ -214,6 +416,7 @@ function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
|
|
|
214
416
|
* governing permissions and limitations under the License.
|
|
215
417
|
*/
|
|
216
418
|
|
|
419
|
+
|
|
217
420
|
/*
|
|
218
421
|
* Copyright 2020 Adobe. All rights reserved.
|
|
219
422
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -240,9 +443,9 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
240
443
|
day: "dd"
|
|
241
444
|
},
|
|
242
445
|
am: {
|
|
243
|
-
year: "
|
|
244
|
-
month: "
|
|
245
|
-
day: "
|
|
446
|
+
year: "\u12D3\u12D3\u12D3\u12D3",
|
|
447
|
+
month: "\u121A\u121C",
|
|
448
|
+
day: "\u1240\u1240"
|
|
246
449
|
},
|
|
247
450
|
an: {
|
|
248
451
|
year: "aaaa",
|
|
@@ -250,9 +453,9 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
250
453
|
day: "dd"
|
|
251
454
|
},
|
|
252
455
|
ar: {
|
|
253
|
-
year: "
|
|
254
|
-
month: "
|
|
255
|
-
day: "
|
|
456
|
+
year: "\u0633\u0646\u0629",
|
|
457
|
+
month: "\u0634\u0647\u0631",
|
|
458
|
+
day: "\u064A\u0648\u0645"
|
|
256
459
|
},
|
|
257
460
|
ast: {
|
|
258
461
|
year: "aaaa",
|
|
@@ -265,18 +468,18 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
265
468
|
day: "gg"
|
|
266
469
|
},
|
|
267
470
|
be: {
|
|
268
|
-
year: "
|
|
269
|
-
month: "
|
|
270
|
-
day: "
|
|
471
|
+
year: "\u0433\u0433\u0433\u0433",
|
|
472
|
+
month: "\u043C\u043C",
|
|
473
|
+
day: "\u0434\u0434"
|
|
271
474
|
},
|
|
272
475
|
bg: {
|
|
273
|
-
year: "
|
|
274
|
-
month: "
|
|
275
|
-
day: "
|
|
476
|
+
year: "\u0433\u0433\u0433\u0433",
|
|
477
|
+
month: "\u043C\u043C",
|
|
478
|
+
day: "\u0434\u0434"
|
|
276
479
|
},
|
|
277
480
|
bn: {
|
|
278
481
|
year: "yyyy",
|
|
279
|
-
month: "
|
|
482
|
+
month: "\u09AE\u09BF\u09AE\u09BF",
|
|
280
483
|
day: "dd"
|
|
281
484
|
},
|
|
282
485
|
br: {
|
|
@@ -300,9 +503,9 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
300
503
|
day: "q'q'"
|
|
301
504
|
},
|
|
302
505
|
ckb: {
|
|
303
|
-
year: "
|
|
304
|
-
month: "
|
|
305
|
-
day: "
|
|
506
|
+
year: "\u0633\u0627\u06B5",
|
|
507
|
+
month: "\u0645\u0627\u0646\u06AF",
|
|
508
|
+
day: "\u0695\u06C6\u0698"
|
|
306
509
|
},
|
|
307
510
|
cs: {
|
|
308
511
|
year: "rrrr",
|
|
@@ -327,12 +530,12 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
327
530
|
dsb: {
|
|
328
531
|
year: "llll",
|
|
329
532
|
month: "mm",
|
|
330
|
-
day: "
|
|
533
|
+
day: "\u017A\u017A"
|
|
331
534
|
},
|
|
332
535
|
el: {
|
|
333
|
-
year: "
|
|
334
|
-
month: "
|
|
335
|
-
day: "
|
|
536
|
+
year: "\u03B5\u03B5\u03B5\u03B5",
|
|
537
|
+
month: "\u03BC\u03BC",
|
|
538
|
+
day: "\u03B7\u03B7"
|
|
336
539
|
},
|
|
337
540
|
en: {
|
|
338
541
|
year: "yyyy",
|
|
@@ -360,9 +563,9 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
360
563
|
day: "ee"
|
|
361
564
|
},
|
|
362
565
|
fa: {
|
|
363
|
-
year: "
|
|
364
|
-
month: "
|
|
365
|
-
day: "
|
|
566
|
+
year: "\u0633\u0627\u0644",
|
|
567
|
+
month: "\u0645\u0627\u0647",
|
|
568
|
+
day: "\u0631\u0648\u0632"
|
|
366
569
|
},
|
|
367
570
|
ff: {
|
|
368
571
|
year: "hhhh",
|
|
@@ -400,9 +603,9 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
400
603
|
day: "dd"
|
|
401
604
|
},
|
|
402
605
|
he: {
|
|
403
|
-
year: "
|
|
404
|
-
month: "
|
|
405
|
-
day: "
|
|
606
|
+
year: "\u05E9\u05E0\u05D4",
|
|
607
|
+
month: "\u05D7\u05D5\u05D3\u05E9",
|
|
608
|
+
day: "\u05D9\u05D5\u05DD"
|
|
406
609
|
},
|
|
407
610
|
hr: {
|
|
408
611
|
year: "gggg",
|
|
@@ -435,29 +638,29 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
435
638
|
day: "gg"
|
|
436
639
|
},
|
|
437
640
|
ja: {
|
|
438
|
-
year: "
|
|
439
|
-
month: "
|
|
440
|
-
day: "
|
|
641
|
+
year: " \u5E74 ",
|
|
642
|
+
month: "\u6708",
|
|
643
|
+
day: "\u65E5"
|
|
441
644
|
},
|
|
442
645
|
ka: {
|
|
443
|
-
year: "
|
|
444
|
-
month: "
|
|
445
|
-
day: "
|
|
646
|
+
year: "\u10EC\u10EC\u10EC\u10EC",
|
|
647
|
+
month: "\u10D7\u10D7",
|
|
648
|
+
day: "\u10E0\u10E0"
|
|
446
649
|
},
|
|
447
650
|
kk: {
|
|
448
|
-
year: "
|
|
449
|
-
month: "
|
|
450
|
-
day: "
|
|
651
|
+
year: "\u0436\u0436\u0436\u0436",
|
|
652
|
+
month: "\u0430\u0430",
|
|
653
|
+
day: "\u043A\u043A"
|
|
451
654
|
},
|
|
452
655
|
kn: {
|
|
453
|
-
year: "
|
|
454
|
-
month: "
|
|
455
|
-
day: "
|
|
656
|
+
year: "\u0CB5\u0CB5\u0CB5\u0CB5",
|
|
657
|
+
month: "\u0CAE\u0CBF\u0CAE\u0CC0",
|
|
658
|
+
day: "\u0CA6\u0CBF\u0CA6\u0CBF"
|
|
456
659
|
},
|
|
457
660
|
ko: {
|
|
458
|
-
year: "
|
|
459
|
-
month: "
|
|
460
|
-
day: "
|
|
661
|
+
year: "\uC5F0\uB3C4",
|
|
662
|
+
month: "\uC6D4",
|
|
663
|
+
day: "\uC77C"
|
|
461
664
|
},
|
|
462
665
|
lb: {
|
|
463
666
|
year: "jjjj",
|
|
@@ -465,9 +668,9 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
465
668
|
day: "dd"
|
|
466
669
|
},
|
|
467
670
|
lo: {
|
|
468
|
-
year: "
|
|
469
|
-
month: "
|
|
470
|
-
day: "
|
|
671
|
+
year: "\u0E9B\u0E9B\u0E9B\u0E9B",
|
|
672
|
+
month: "\u0E94\u0E94",
|
|
673
|
+
day: "\u0EA7\u0EA7"
|
|
471
674
|
},
|
|
472
675
|
lt: {
|
|
473
676
|
year: "mmmm",
|
|
@@ -485,9 +688,9 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
485
688
|
day: "dd"
|
|
486
689
|
},
|
|
487
690
|
ml: {
|
|
488
|
-
year: "
|
|
489
|
-
month: "
|
|
490
|
-
day: "
|
|
691
|
+
year: "\u0D35\u0D7C\u0D37\u0D02",
|
|
692
|
+
month: "\u0D2E\u0D3E\u0D38\u0D02",
|
|
693
|
+
day: "\u0D24\u0D40\u0D2F\u0D24\u0D3F"
|
|
491
694
|
},
|
|
492
695
|
ms: {
|
|
493
696
|
year: "tttt",
|
|
@@ -535,9 +738,9 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
535
738
|
day: "zz"
|
|
536
739
|
},
|
|
537
740
|
ru: {
|
|
538
|
-
year: "
|
|
539
|
-
month: "
|
|
540
|
-
day: "
|
|
741
|
+
year: "\u0433\u0433\u0433\u0433",
|
|
742
|
+
month: "\u043C\u043C",
|
|
743
|
+
day: "\u0434\u0434"
|
|
541
744
|
},
|
|
542
745
|
sc: {
|
|
543
746
|
year: "aaaa",
|
|
@@ -560,9 +763,9 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
560
763
|
day: "dd"
|
|
561
764
|
},
|
|
562
765
|
sr: {
|
|
563
|
-
year: "
|
|
564
|
-
month: "
|
|
565
|
-
day: "
|
|
766
|
+
year: "\u0433\u0433\u0433\u0433",
|
|
767
|
+
month: "\u043C\u043C",
|
|
768
|
+
day: "\u0434\u0434"
|
|
566
769
|
},
|
|
567
770
|
sv: {
|
|
568
771
|
year: "\xe5\xe5\xe5\xe5",
|
|
@@ -575,14 +778,14 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
575
778
|
day: "dd"
|
|
576
779
|
},
|
|
577
780
|
tg: {
|
|
578
|
-
year: "
|
|
579
|
-
month: "
|
|
580
|
-
day: "
|
|
781
|
+
year: "\u0441\u0441\u0441\u0441",
|
|
782
|
+
month: "\u043C\u043C",
|
|
783
|
+
day: "\u0440\u0440"
|
|
581
784
|
},
|
|
582
785
|
th: {
|
|
583
|
-
year: "
|
|
584
|
-
month: "
|
|
585
|
-
day: "
|
|
786
|
+
year: "\u0E1B\u0E1B\u0E1B\u0E1B",
|
|
787
|
+
month: "\u0E14\u0E14",
|
|
788
|
+
day: "\u0E27\u0E27"
|
|
586
789
|
},
|
|
587
790
|
tr: {
|
|
588
791
|
year: "yyyy",
|
|
@@ -590,19 +793,19 @@ const $3e3ed55ab2966714$var$placeholders = new (0, $7UzoM$LocalizedStringDiction
|
|
|
590
793
|
day: "gg"
|
|
591
794
|
},
|
|
592
795
|
uk: {
|
|
593
|
-
year: "
|
|
594
|
-
month: "
|
|
595
|
-
day: "
|
|
796
|
+
year: "\u0440\u0440\u0440\u0440",
|
|
797
|
+
month: "\u043C\u043C",
|
|
798
|
+
day: "\u0434\u0434"
|
|
596
799
|
},
|
|
597
800
|
"zh-CN": {
|
|
598
|
-
year: "
|
|
599
|
-
month: "
|
|
600
|
-
day: "
|
|
801
|
+
year: "\u5E74",
|
|
802
|
+
month: "\u6708",
|
|
803
|
+
day: "\u65E5"
|
|
601
804
|
},
|
|
602
805
|
"zh-TW": {
|
|
603
|
-
year: "
|
|
604
|
-
month: "
|
|
605
|
-
day: "
|
|
806
|
+
year: "\u5E74",
|
|
807
|
+
month: "\u6708",
|
|
808
|
+
day: "\u65E5"
|
|
606
809
|
}
|
|
607
810
|
}, "en");
|
|
608
811
|
function $3e3ed55ab2966714$export$d3f5c5e0a5023fa0(field, value, locale) {
|
|
@@ -610,7 +813,7 @@ function $3e3ed55ab2966714$export$d3f5c5e0a5023fa0(field, value, locale) {
|
|
|
610
813
|
if (field === "era" || field === "dayPeriod") return value;
|
|
611
814
|
if (field === "year" || field === "month" || field === "day") return $3e3ed55ab2966714$var$placeholders.getStringForLocale(field, locale);
|
|
612
815
|
// For time fields (e.g. hour, minute, etc.), use two dashes as the placeholder.
|
|
613
|
-
return "
|
|
816
|
+
return "\u2013\u2013";
|
|
614
817
|
}
|
|
615
818
|
|
|
616
819
|
|
|
@@ -639,7 +842,7 @@ const $3c0fc76039f1c516$var$TYPE_MAPPING = {
|
|
|
639
842
|
dayperiod: "dayPeriod"
|
|
640
843
|
};
|
|
641
844
|
function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
|
|
642
|
-
let { locale: locale, createCalendar: createCalendar, hideTimeZone: hideTimeZone, isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired } = props;
|
|
845
|
+
let { locale: locale, createCalendar: createCalendar, hideTimeZone: hideTimeZone, isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, minValue: minValue, maxValue: maxValue, isDateUnavailable: isDateUnavailable } = props;
|
|
643
846
|
let v = props.value || props.defaultValue || props.placeholderValue;
|
|
644
847
|
let [granularity, defaultTimeZone] = (0, $35a22f14a1f04b11$export$2440da353cedad43)(v, props.granularity);
|
|
645
848
|
let timeZone = defaultTimeZone || "UTC";
|
|
@@ -664,8 +867,9 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
|
|
|
664
867
|
let [placeholderDate, setPlaceholderDate] = (0, $7UzoM$useState)(()=>(0, $35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
|
|
665
868
|
let val = calendarValue || placeholderDate;
|
|
666
869
|
let showEra = calendar.identifier === "gregory" && val.era === "BC";
|
|
667
|
-
|
|
668
|
-
|
|
870
|
+
let formatOpts = (0, $7UzoM$useMemo)(()=>{
|
|
871
|
+
var _props_maxGranularity;
|
|
872
|
+
return {
|
|
669
873
|
granularity: granularity,
|
|
670
874
|
maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : "year",
|
|
671
875
|
timeZone: defaultTimeZone,
|
|
@@ -673,7 +877,8 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
|
|
|
673
877
|
hourCycle: props.hourCycle,
|
|
674
878
|
showEra: showEra,
|
|
675
879
|
shouldForceLeadingZeros: props.shouldForceLeadingZeros
|
|
676
|
-
}
|
|
880
|
+
};
|
|
881
|
+
}, [
|
|
677
882
|
props.maxGranularity,
|
|
678
883
|
granularity,
|
|
679
884
|
props.hourCycle,
|
|
@@ -801,10 +1006,23 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
|
|
|
801
1006
|
if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod) setValue(displayValue);
|
|
802
1007
|
} else setValue($3c0fc76039f1c516$var$addSegment(displayValue, type, amount, resolvedOptions));
|
|
803
1008
|
};
|
|
804
|
-
let
|
|
1009
|
+
let builtinValidation = (0, $7UzoM$useMemo)(()=>(0, $35a22f14a1f04b11$export$f18627323ab57ac0)(value, minValue, maxValue, isDateUnavailable, formatOpts), [
|
|
1010
|
+
value,
|
|
1011
|
+
minValue,
|
|
1012
|
+
maxValue,
|
|
1013
|
+
isDateUnavailable,
|
|
1014
|
+
formatOpts
|
|
1015
|
+
]);
|
|
1016
|
+
let validation = (0, $7UzoM$useFormValidationState)({
|
|
1017
|
+
...props,
|
|
1018
|
+
value: value,
|
|
1019
|
+
builtinValidation: builtinValidation
|
|
1020
|
+
});
|
|
1021
|
+
let isValueInvalid = validation.displayValidation.isInvalid;
|
|
805
1022
|
let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
|
|
806
|
-
var
|
|
1023
|
+
var _props_maxGranularity;
|
|
807
1024
|
return {
|
|
1025
|
+
...validation,
|
|
808
1026
|
value: calendarValue,
|
|
809
1027
|
dateValue: dateValue,
|
|
810
1028
|
calendar: calendar,
|
|
@@ -814,7 +1032,7 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
|
|
|
814
1032
|
validationState: validationState,
|
|
815
1033
|
isInvalid: isValueInvalid,
|
|
816
1034
|
granularity: granularity,
|
|
817
|
-
maxGranularity: (
|
|
1035
|
+
maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : "year",
|
|
818
1036
|
isDisabled: isDisabled,
|
|
819
1037
|
isReadOnly: isReadOnly,
|
|
820
1038
|
isRequired: isRequired,
|
|
@@ -1027,8 +1245,9 @@ function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
|
|
|
1027
1245
|
|
|
1028
1246
|
|
|
1029
1247
|
|
|
1248
|
+
|
|
1030
1249
|
function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
|
|
1031
|
-
var
|
|
1250
|
+
var _value_start, _value_end;
|
|
1032
1251
|
let overlayState = (0, $7UzoM$useOverlayTriggerState)(props);
|
|
1033
1252
|
let [controlledValue, setControlledValue] = (0, $7UzoM$useControlledState)(props.value, props.defaultValue || null, props.onChange);
|
|
1034
1253
|
let [placeholderValue, setPlaceholderValue] = (0, $7UzoM$useState)(()=>controlledValue || {
|
|
@@ -1053,7 +1272,7 @@ function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
|
|
|
1053
1272
|
else setControlledValue(null);
|
|
1054
1273
|
};
|
|
1055
1274
|
let v = (value === null || value === void 0 ? void 0 : value.start) || (value === null || value === void 0 ? void 0 : value.end) || props.placeholderValue;
|
|
1056
|
-
let [granularity] = (0, $35a22f14a1f04b11$export$2440da353cedad43)(v, props.granularity);
|
|
1275
|
+
let [granularity, defaultTimeZone] = (0, $35a22f14a1f04b11$export$2440da353cedad43)(v, props.granularity);
|
|
1057
1276
|
let hasTime = granularity === "hour" || granularity === "minute" || granularity === "second";
|
|
1058
1277
|
var _props_shouldCloseOnSelect;
|
|
1059
1278
|
let shouldCloseOnSelect = (_props_shouldCloseOnSelect = props.shouldCloseOnSelect) !== null && _props_shouldCloseOnSelect !== void 0 ? _props_shouldCloseOnSelect : true;
|
|
@@ -1070,6 +1289,7 @@ function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
|
|
|
1070
1289
|
});
|
|
1071
1290
|
setSelectedDateRange(null);
|
|
1072
1291
|
setSelectedTimeRange(null);
|
|
1292
|
+
validation.commitValidation();
|
|
1073
1293
|
};
|
|
1074
1294
|
// Intercept setValue to make sure the Time section is not changed by date selection in Calendar
|
|
1075
1295
|
let setDateRange = (range)=>{
|
|
@@ -1080,17 +1300,56 @@ function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
|
|
|
1080
1300
|
end: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.end) || (0, $35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue)
|
|
1081
1301
|
});
|
|
1082
1302
|
else setSelectedDateRange(range);
|
|
1083
|
-
} else if (range.start && range.end)
|
|
1084
|
-
|
|
1303
|
+
} else if (range.start && range.end) {
|
|
1304
|
+
setValue(range);
|
|
1305
|
+
validation.commitValidation();
|
|
1306
|
+
} else setSelectedDateRange(range);
|
|
1085
1307
|
if (shouldClose) overlayState.setOpen(false);
|
|
1086
1308
|
};
|
|
1087
1309
|
let setTimeRange = (range)=>{
|
|
1088
1310
|
if ((dateRange === null || dateRange === void 0 ? void 0 : dateRange.start) && (dateRange === null || dateRange === void 0 ? void 0 : dateRange.end) && range.start && range.end) commitValue(dateRange, range);
|
|
1089
1311
|
else setSelectedTimeRange(range);
|
|
1090
1312
|
};
|
|
1091
|
-
let
|
|
1313
|
+
let showEra = (value === null || value === void 0 ? void 0 : (_value_start = value.start) === null || _value_start === void 0 ? void 0 : _value_start.calendar.identifier) === "gregory" && value.start.era === "BC" || (value === null || value === void 0 ? void 0 : (_value_end = value.end) === null || _value_end === void 0 ? void 0 : _value_end.calendar.identifier) === "gregory" && value.end.era === "BC";
|
|
1314
|
+
let formatOpts = (0, $7UzoM$useMemo)(()=>({
|
|
1315
|
+
granularity: granularity,
|
|
1316
|
+
timeZone: defaultTimeZone,
|
|
1317
|
+
hideTimeZone: props.hideTimeZone,
|
|
1318
|
+
hourCycle: props.hourCycle,
|
|
1319
|
+
shouldForceLeadingZeros: props.shouldForceLeadingZeros,
|
|
1320
|
+
showEra: showEra
|
|
1321
|
+
}), [
|
|
1322
|
+
granularity,
|
|
1323
|
+
props.hourCycle,
|
|
1324
|
+
props.shouldForceLeadingZeros,
|
|
1325
|
+
defaultTimeZone,
|
|
1326
|
+
props.hideTimeZone,
|
|
1327
|
+
showEra
|
|
1328
|
+
]);
|
|
1329
|
+
let { minValue: minValue, maxValue: maxValue, isDateUnavailable: isDateUnavailable } = props;
|
|
1330
|
+
let builtinValidation = (0, $7UzoM$useMemo)(()=>(0, $35a22f14a1f04b11$export$80ff8fc0ae339c13)(value, minValue, maxValue, isDateUnavailable, formatOpts), [
|
|
1331
|
+
value,
|
|
1332
|
+
minValue,
|
|
1333
|
+
maxValue,
|
|
1334
|
+
isDateUnavailable,
|
|
1335
|
+
formatOpts
|
|
1336
|
+
]);
|
|
1337
|
+
let validation = (0, $7UzoM$useFormValidationState)({
|
|
1338
|
+
...props,
|
|
1339
|
+
value: controlledValue,
|
|
1340
|
+
name: (0, $7UzoM$useMemo)(()=>[
|
|
1341
|
+
props.startName,
|
|
1342
|
+
props.endName
|
|
1343
|
+
], [
|
|
1344
|
+
props.startName,
|
|
1345
|
+
props.endName
|
|
1346
|
+
]),
|
|
1347
|
+
builtinValidation: builtinValidation
|
|
1348
|
+
});
|
|
1349
|
+
let isValueInvalid = validation.displayValidation.isInvalid;
|
|
1092
1350
|
let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
|
|
1093
1351
|
return {
|
|
1352
|
+
...validation,
|
|
1094
1353
|
value: value,
|
|
1095
1354
|
setValue: setValue,
|
|
1096
1355
|
dateRange: dateRange,
|
|
@@ -1209,7 +1468,7 @@ function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
|
|
|
1209
1468
|
|
|
1210
1469
|
|
|
1211
1470
|
function $eff5d8ee529ac4bb$export$fd53cef0cc796101(props) {
|
|
1212
|
-
let { placeholderValue: placeholderValue = new (0, $7UzoM$Time)(), minValue: minValue, maxValue: maxValue, granularity: granularity } = props;
|
|
1471
|
+
let { placeholderValue: placeholderValue = new (0, $7UzoM$Time)(), minValue: minValue, maxValue: maxValue, granularity: granularity, validate: validate } = props;
|
|
1213
1472
|
let [value, setValue] = (0, $7UzoM$useControlledState)(props.value, props.defaultValue, props.onChange);
|
|
1214
1473
|
let v = value || placeholderValue;
|
|
1215
1474
|
let day = v && "day" in v ? v : undefined;
|
|
@@ -1250,7 +1509,11 @@ function $eff5d8ee529ac4bb$export$fd53cef0cc796101(props) {
|
|
|
1250
1509
|
maxGranularity: "hour",
|
|
1251
1510
|
placeholderValue: placeholderDate,
|
|
1252
1511
|
// Calendar should not matter for time fields.
|
|
1253
|
-
createCalendar: ()=>new (0, $7UzoM$GregorianCalendar)()
|
|
1512
|
+
createCalendar: ()=>new (0, $7UzoM$GregorianCalendar)(),
|
|
1513
|
+
validate: (0, $7UzoM$useCallback)(()=>validate === null || validate === void 0 ? void 0 : validate(value), [
|
|
1514
|
+
validate,
|
|
1515
|
+
value
|
|
1516
|
+
])
|
|
1254
1517
|
});
|
|
1255
1518
|
return {
|
|
1256
1519
|
...state,
|