@react-stately/datepicker 3.0.0-alpha.4 → 3.0.0-nightly-641446f65-240905

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.
Files changed (221) hide show
  1. package/dist/ar-AE.main.js +9 -0
  2. package/dist/ar-AE.main.js.map +1 -0
  3. package/dist/ar-AE.mjs +11 -0
  4. package/dist/ar-AE.module.js +11 -0
  5. package/dist/ar-AE.module.js.map +1 -0
  6. package/dist/bg-BG.main.js +9 -0
  7. package/dist/bg-BG.main.js.map +1 -0
  8. package/dist/bg-BG.mjs +11 -0
  9. package/dist/bg-BG.module.js +11 -0
  10. package/dist/bg-BG.module.js.map +1 -0
  11. package/dist/cs-CZ.main.js +9 -0
  12. package/dist/cs-CZ.main.js.map +1 -0
  13. package/dist/cs-CZ.mjs +11 -0
  14. package/dist/cs-CZ.module.js +11 -0
  15. package/dist/cs-CZ.module.js.map +1 -0
  16. package/dist/da-DK.main.js +9 -0
  17. package/dist/da-DK.main.js.map +1 -0
  18. package/dist/da-DK.mjs +11 -0
  19. package/dist/da-DK.module.js +11 -0
  20. package/dist/da-DK.module.js.map +1 -0
  21. package/dist/de-DE.main.js +9 -0
  22. package/dist/de-DE.main.js.map +1 -0
  23. package/dist/de-DE.mjs +11 -0
  24. package/dist/de-DE.module.js +11 -0
  25. package/dist/de-DE.module.js.map +1 -0
  26. package/dist/el-GR.main.js +9 -0
  27. package/dist/el-GR.main.js.map +1 -0
  28. package/dist/el-GR.mjs +11 -0
  29. package/dist/el-GR.module.js +11 -0
  30. package/dist/el-GR.module.js.map +1 -0
  31. package/dist/en-US.main.js +9 -0
  32. package/dist/en-US.main.js.map +1 -0
  33. package/dist/en-US.mjs +11 -0
  34. package/dist/en-US.module.js +11 -0
  35. package/dist/en-US.module.js.map +1 -0
  36. package/dist/es-ES.main.js +9 -0
  37. package/dist/es-ES.main.js.map +1 -0
  38. package/dist/es-ES.mjs +11 -0
  39. package/dist/es-ES.module.js +11 -0
  40. package/dist/es-ES.module.js.map +1 -0
  41. package/dist/et-EE.main.js +9 -0
  42. package/dist/et-EE.main.js.map +1 -0
  43. package/dist/et-EE.mjs +11 -0
  44. package/dist/et-EE.module.js +11 -0
  45. package/dist/et-EE.module.js.map +1 -0
  46. package/dist/fi-FI.main.js +9 -0
  47. package/dist/fi-FI.main.js.map +1 -0
  48. package/dist/fi-FI.mjs +11 -0
  49. package/dist/fi-FI.module.js +11 -0
  50. package/dist/fi-FI.module.js.map +1 -0
  51. package/dist/fr-FR.main.js +9 -0
  52. package/dist/fr-FR.main.js.map +1 -0
  53. package/dist/fr-FR.mjs +11 -0
  54. package/dist/fr-FR.module.js +11 -0
  55. package/dist/fr-FR.module.js.map +1 -0
  56. package/dist/he-IL.main.js +9 -0
  57. package/dist/he-IL.main.js.map +1 -0
  58. package/dist/he-IL.mjs +11 -0
  59. package/dist/he-IL.module.js +11 -0
  60. package/dist/he-IL.module.js.map +1 -0
  61. package/dist/hr-HR.main.js +9 -0
  62. package/dist/hr-HR.main.js.map +1 -0
  63. package/dist/hr-HR.mjs +11 -0
  64. package/dist/hr-HR.module.js +11 -0
  65. package/dist/hr-HR.module.js.map +1 -0
  66. package/dist/hu-HU.main.js +9 -0
  67. package/dist/hu-HU.main.js.map +1 -0
  68. package/dist/hu-HU.mjs +11 -0
  69. package/dist/hu-HU.module.js +11 -0
  70. package/dist/hu-HU.module.js.map +1 -0
  71. package/dist/import.mjs +23 -0
  72. package/dist/intlStrings.main.js +108 -0
  73. package/dist/intlStrings.main.js.map +1 -0
  74. package/dist/intlStrings.mjs +110 -0
  75. package/dist/intlStrings.module.js +110 -0
  76. package/dist/intlStrings.module.js.map +1 -0
  77. package/dist/it-IT.main.js +9 -0
  78. package/dist/it-IT.main.js.map +1 -0
  79. package/dist/it-IT.mjs +11 -0
  80. package/dist/it-IT.module.js +11 -0
  81. package/dist/it-IT.module.js.map +1 -0
  82. package/dist/ja-JP.main.js +9 -0
  83. package/dist/ja-JP.main.js.map +1 -0
  84. package/dist/ja-JP.mjs +11 -0
  85. package/dist/ja-JP.module.js +11 -0
  86. package/dist/ja-JP.module.js.map +1 -0
  87. package/dist/ko-KR.main.js +9 -0
  88. package/dist/ko-KR.main.js.map +1 -0
  89. package/dist/ko-KR.mjs +11 -0
  90. package/dist/ko-KR.module.js +11 -0
  91. package/dist/ko-KR.module.js.map +1 -0
  92. package/dist/lt-LT.main.js +9 -0
  93. package/dist/lt-LT.main.js.map +1 -0
  94. package/dist/lt-LT.mjs +11 -0
  95. package/dist/lt-LT.module.js +11 -0
  96. package/dist/lt-LT.module.js.map +1 -0
  97. package/dist/lv-LV.main.js +9 -0
  98. package/dist/lv-LV.main.js.map +1 -0
  99. package/dist/lv-LV.mjs +11 -0
  100. package/dist/lv-LV.module.js +11 -0
  101. package/dist/lv-LV.module.js.map +1 -0
  102. package/dist/main.js +19 -765
  103. package/dist/main.js.map +1 -1
  104. package/dist/module.js +16 -751
  105. package/dist/module.js.map +1 -1
  106. package/dist/nb-NO.main.js +9 -0
  107. package/dist/nb-NO.main.js.map +1 -0
  108. package/dist/nb-NO.mjs +11 -0
  109. package/dist/nb-NO.module.js +11 -0
  110. package/dist/nb-NO.module.js.map +1 -0
  111. package/dist/nl-NL.main.js +9 -0
  112. package/dist/nl-NL.main.js.map +1 -0
  113. package/dist/nl-NL.mjs +11 -0
  114. package/dist/nl-NL.module.js +11 -0
  115. package/dist/nl-NL.module.js.map +1 -0
  116. package/dist/pl-PL.main.js +9 -0
  117. package/dist/pl-PL.main.js.map +1 -0
  118. package/dist/pl-PL.mjs +11 -0
  119. package/dist/pl-PL.module.js +11 -0
  120. package/dist/pl-PL.module.js.map +1 -0
  121. package/dist/placeholders.main.js +409 -0
  122. package/dist/placeholders.main.js.map +1 -0
  123. package/dist/placeholders.mjs +404 -0
  124. package/dist/placeholders.module.js +404 -0
  125. package/dist/placeholders.module.js.map +1 -0
  126. package/dist/pt-BR.main.js +9 -0
  127. package/dist/pt-BR.main.js.map +1 -0
  128. package/dist/pt-BR.mjs +11 -0
  129. package/dist/pt-BR.module.js +11 -0
  130. package/dist/pt-BR.module.js.map +1 -0
  131. package/dist/pt-PT.main.js +9 -0
  132. package/dist/pt-PT.main.js.map +1 -0
  133. package/dist/pt-PT.mjs +11 -0
  134. package/dist/pt-PT.module.js +11 -0
  135. package/dist/pt-PT.module.js.map +1 -0
  136. package/dist/ro-RO.main.js +9 -0
  137. package/dist/ro-RO.main.js.map +1 -0
  138. package/dist/ro-RO.mjs +11 -0
  139. package/dist/ro-RO.module.js +11 -0
  140. package/dist/ro-RO.module.js.map +1 -0
  141. package/dist/ru-RU.main.js +9 -0
  142. package/dist/ru-RU.main.js.map +1 -0
  143. package/dist/ru-RU.mjs +11 -0
  144. package/dist/ru-RU.module.js +11 -0
  145. package/dist/ru-RU.module.js.map +1 -0
  146. package/dist/sk-SK.main.js +9 -0
  147. package/dist/sk-SK.main.js.map +1 -0
  148. package/dist/sk-SK.mjs +11 -0
  149. package/dist/sk-SK.module.js +11 -0
  150. package/dist/sk-SK.module.js.map +1 -0
  151. package/dist/sl-SI.main.js +9 -0
  152. package/dist/sl-SI.main.js.map +1 -0
  153. package/dist/sl-SI.mjs +11 -0
  154. package/dist/sl-SI.module.js +11 -0
  155. package/dist/sl-SI.module.js.map +1 -0
  156. package/dist/sr-SP.main.js +9 -0
  157. package/dist/sr-SP.main.js.map +1 -0
  158. package/dist/sr-SP.mjs +11 -0
  159. package/dist/sr-SP.module.js +11 -0
  160. package/dist/sr-SP.module.js.map +1 -0
  161. package/dist/sv-SE.main.js +9 -0
  162. package/dist/sv-SE.main.js.map +1 -0
  163. package/dist/sv-SE.mjs +11 -0
  164. package/dist/sv-SE.module.js +11 -0
  165. package/dist/sv-SE.module.js.map +1 -0
  166. package/dist/tr-TR.main.js +9 -0
  167. package/dist/tr-TR.main.js.map +1 -0
  168. package/dist/tr-TR.mjs +11 -0
  169. package/dist/tr-TR.module.js +11 -0
  170. package/dist/tr-TR.module.js.map +1 -0
  171. package/dist/types.d.ts +70 -29
  172. package/dist/types.d.ts.map +1 -1
  173. package/dist/uk-UA.main.js +9 -0
  174. package/dist/uk-UA.main.js.map +1 -0
  175. package/dist/uk-UA.mjs +11 -0
  176. package/dist/uk-UA.module.js +11 -0
  177. package/dist/uk-UA.module.js.map +1 -0
  178. package/dist/useDateFieldState.main.js +449 -0
  179. package/dist/useDateFieldState.main.js.map +1 -0
  180. package/dist/useDateFieldState.mjs +444 -0
  181. package/dist/useDateFieldState.module.js +444 -0
  182. package/dist/useDateFieldState.module.js.map +1 -0
  183. package/dist/useDatePickerState.main.js +138 -0
  184. package/dist/useDatePickerState.main.js.map +1 -0
  185. package/dist/useDatePickerState.mjs +133 -0
  186. package/dist/useDatePickerState.module.js +133 -0
  187. package/dist/useDatePickerState.module.js.map +1 -0
  188. package/dist/useDateRangePickerState.main.js +245 -0
  189. package/dist/useDateRangePickerState.main.js.map +1 -0
  190. package/dist/useDateRangePickerState.mjs +240 -0
  191. package/dist/useDateRangePickerState.module.js +240 -0
  192. package/dist/useDateRangePickerState.module.js.map +1 -0
  193. package/dist/useTimeFieldState.main.js +86 -0
  194. package/dist/useTimeFieldState.main.js.map +1 -0
  195. package/dist/useTimeFieldState.mjs +81 -0
  196. package/dist/useTimeFieldState.module.js +81 -0
  197. package/dist/useTimeFieldState.module.js.map +1 -0
  198. package/dist/utils.main.js +190 -0
  199. package/dist/utils.main.js.map +1 -0
  200. package/dist/utils.mjs +179 -0
  201. package/dist/utils.module.js +179 -0
  202. package/dist/utils.module.js.map +1 -0
  203. package/dist/zh-CN.main.js +9 -0
  204. package/dist/zh-CN.main.js.map +1 -0
  205. package/dist/zh-CN.mjs +11 -0
  206. package/dist/zh-CN.module.js +11 -0
  207. package/dist/zh-CN.module.js.map +1 -0
  208. package/dist/zh-TW.main.js +9 -0
  209. package/dist/zh-TW.main.js.map +1 -0
  210. package/dist/zh-TW.mjs +11 -0
  211. package/dist/zh-TW.module.js +11 -0
  212. package/dist/zh-TW.module.js.map +1 -0
  213. package/package.json +17 -10
  214. package/src/index.ts +9 -4
  215. package/src/placeholders.ts +108 -0
  216. package/src/useDateFieldState.ts +124 -52
  217. package/src/useDatePickerState.ts +64 -27
  218. package/src/useDateRangePickerState.ts +103 -47
  219. package/src/useTimeFieldState.ts +27 -9
  220. package/src/utils.ts +140 -18
  221. package/LICENSE +0 -201
package/dist/module.js CHANGED
@@ -1,755 +1,20 @@
1
- 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, toTime as $7UzoM$toTime, today as $7UzoM$today, getLocalTimeZone as $7UzoM$getLocalTimeZone} from "@internationalized/date";
2
- import {useControlledState as $7UzoM$useControlledState} from "@react-stately/utils";
3
- import {useState as $7UzoM$useState, useRef as $7UzoM$useRef, useMemo as $7UzoM$useMemo, useEffect as $7UzoM$useEffect} from "react";
1
+ import {useDatePickerState as $ab5bf3f618090389$export$87194bb378cc3ac2} from "./useDatePickerState.module.js";
2
+ import {useDateFieldState as $3c0fc76039f1c516$export$60e84778edff6d26} from "./useDateFieldState.module.js";
3
+ import {useDateRangePickerState as $93c38a5e28be6249$export$e50a61c1de9f574} from "./useDateRangePickerState.module.js";
4
+ import {useTimeFieldState as $eff5d8ee529ac4bb$export$fd53cef0cc796101} from "./useTimeFieldState.module.js";
5
+
6
+ /*
7
+ * Copyright 2020 Adobe. All rights reserved.
8
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License. You may obtain a copy
10
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software distributed under
13
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
+ * OF ANY KIND, either express or implied. See the License for the specific language
15
+ * governing permissions and limitations under the License.
16
+ */
4
17
 
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
- }
8
- var $ab5bf3f618090389$exports = {};
9
-
10
- $parcel$export($ab5bf3f618090389$exports, "useDatePickerState", () => $ab5bf3f618090389$export$87194bb378cc3ac2);
11
-
12
-
13
-
14
- function $35a22f14a1f04b11$export$eac50920cf2fd59a(value, minValue, maxValue) {
15
- return value != null && (minValue != null && value.compare(minValue) < 0 || maxValue != null && value.compare(maxValue) > 0);
16
- }
17
- const $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS = {
18
- year: 'numeric',
19
- month: 'numeric',
20
- day: 'numeric',
21
- hour: 'numeric',
22
- minute: '2-digit',
23
- second: '2-digit'
24
- };
25
- function $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, options) {
26
- fieldOptions = {
27
- ...$35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS,
28
- ...fieldOptions
29
- };
30
- let granularity = options.granularity || 'minute';
31
- let keys = Object.keys(fieldOptions);
32
- var _maxGranularity;
33
- let startIdx = keys.indexOf((_maxGranularity = options.maxGranularity) !== null && _maxGranularity !== void 0 ? _maxGranularity : 'year');
34
- if (startIdx < 0) startIdx = 0;
35
- let endIdx = keys.indexOf(granularity);
36
- if (endIdx < 0) endIdx = 2;
37
- if (startIdx > endIdx) throw new Error('maxGranularity must be greater than granularity');
38
- let opts1 = keys.slice(startIdx, endIdx + 1).reduce((opts, key)=>{
39
- opts[key] = fieldOptions[key];
40
- return opts;
41
- }, {
42
- });
43
- if (options.hourCycle != null) opts1.hour12 = options.hourCycle === 12;
44
- opts1.timeZone = options.timeZone || 'UTC';
45
- let hasTime = granularity === 'hour' || granularity === 'minute' || granularity === 'second';
46
- if (hasTime && options.timeZone && !options.hideTimeZone) opts1.timeZoneName = 'short';
47
- return opts1;
48
- }
49
- function $35a22f14a1f04b11$export$c5221a78ef73c5e9(placeholderValue) {
50
- if (placeholderValue && 'hour' in placeholderValue) return placeholderValue;
51
- return new $7UzoM$Time();
52
- }
53
- function $35a22f14a1f04b11$export$61a490a80c552550(value, calendar) {
54
- if (value === null) return null;
55
- if (!value) return undefined;
56
- return $7UzoM$toCalendar(value, calendar);
57
- }
58
- function $35a22f14a1f04b11$export$66aa2b09de4b1ea5(placeholderValue, granularity, calendar, timeZone) {
59
- if (placeholderValue) return $35a22f14a1f04b11$export$61a490a80c552550(placeholderValue, calendar);
60
- let date = $7UzoM$toCalendar($7UzoM$now(timeZone).set({
61
- hour: 0,
62
- minute: 0,
63
- second: 0,
64
- millisecond: 0
65
- }), calendar);
66
- if (granularity === 'year' || granularity === 'month' || granularity === 'day') return $7UzoM$toCalendarDate(date);
67
- if (!timeZone) return $7UzoM$toCalendarDateTime(date);
68
- return date;
69
- }
70
- function $35a22f14a1f04b11$export$2440da353cedad43(v, granularity) {
71
- // Compute default granularity and time zone from the value. If the value becomes null, keep the last values.
72
- let lastValue = $7UzoM$useRef(v);
73
- if (v) lastValue.current = v;
74
- v = lastValue.current;
75
- let defaultTimeZone = v && 'timeZone' in v ? v.timeZone : undefined;
76
- granularity = granularity || (v && 'minute' in v ? 'minute' : 'day');
77
- // props.granularity must actually exist in the value if one is provided.
78
- if (v && !(granularity in v)) throw new Error('Invalid granularity ' + granularity + ' for value ' + v.toString());
79
- return [
80
- granularity,
81
- defaultTimeZone
82
- ];
83
- }
84
-
85
-
86
-
87
-
88
-
89
- function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
90
- var ref;
91
- let [isOpen1, setOpen] = $7UzoM$useState(false);
92
- let [value, setValue] = $7UzoM$useControlledState(props.value, props.defaultValue || null, props.onChange);
93
- let v = value || props.placeholderValue;
94
- let [granularity, defaultTimeZone] = $35a22f14a1f04b11$export$2440da353cedad43(v, props.granularity);
95
- let dateValue = value != null ? value.toDate(defaultTimeZone !== null && defaultTimeZone !== void 0 ? defaultTimeZone : 'UTC') : null;
96
- let hasTime = granularity === 'hour' || granularity === 'minute' || granularity === 'second' || granularity === 'millisecond';
97
- var _shouldCloseOnSelect;
98
- let shouldCloseOnSelect = (_shouldCloseOnSelect = props.shouldCloseOnSelect) !== null && _shouldCloseOnSelect !== void 0 ? _shouldCloseOnSelect : true;
99
- let [selectedDate, setSelectedDate] = $7UzoM$useState(null);
100
- let [selectedTime, setSelectedTime] = $7UzoM$useState(null);
101
- if (value) {
102
- selectedDate = value;
103
- if ('hour' in value) selectedTime = value;
104
- }
105
- // props.granularity must actually exist in the value if one is provided.
106
- if (v && !(granularity in v)) throw new Error('Invalid granularity ' + granularity + ' for value ' + v.toString());
107
- let commitValue = (date, time)=>{
108
- setValue('timeZone' in time ? time.set($7UzoM$toCalendarDate(date)) : $7UzoM$toCalendarDateTime(date, time));
109
- };
110
- // Intercept setValue to make sure the Time section is not changed by date selection in Calendar
111
- let selectDate = (newValue)=>{
112
- let shouldClose = typeof shouldCloseOnSelect === 'function' ? shouldCloseOnSelect() : shouldCloseOnSelect;
113
- if (hasTime) {
114
- if (selectedTime || shouldClose) commitValue(newValue, selectedTime || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue));
115
- else setSelectedDate(newValue);
116
- } else setValue(newValue);
117
- if (shouldClose) setOpen(false);
118
- };
119
- let selectTime = (newValue)=>{
120
- if (selectedDate) commitValue(selectedDate, newValue);
121
- else setSelectedTime(newValue);
122
- };
123
- let validationState = props.validationState || ($35a22f14a1f04b11$export$eac50920cf2fd59a(value, props.minValue, props.maxValue) ? 'invalid' : null) || (value && ((ref = props.isDateUnavailable) === null || ref === void 0 ? void 0 : ref.call(props, value)) ? 'invalid' : null);
124
- return {
125
- value: value,
126
- setValue: setValue,
127
- dateValue: selectedDate,
128
- timeValue: selectedTime,
129
- setDateValue: selectDate,
130
- setTimeValue: selectTime,
131
- granularity: granularity,
132
- hasTime: hasTime,
133
- isOpen: isOpen1,
134
- setOpen (isOpen) {
135
- // Commit the selected date when the calendar is closed. Use a placeholder time if one wasn't set.
136
- // If only the time was set and not the date, don't commit. The state will be preserved until
137
- // the user opens the popover again.
138
- if (!isOpen && !value && selectedDate && hasTime) commitValue(selectedDate, selectedTime || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue));
139
- setOpen(isOpen);
140
- },
141
- validationState: validationState,
142
- formatValue (locale, fieldOptions) {
143
- if (!dateValue) return '';
144
- let formatOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, {
145
- granularity: granularity,
146
- timeZone: defaultTimeZone,
147
- hideTimeZone: props.hideTimeZone,
148
- hourCycle: props.hourCycle
149
- });
150
- let formatter = new $7UzoM$DateFormatter(locale, formatOptions);
151
- return formatter.format(dateValue);
152
- }
153
- };
154
- }
155
-
156
-
157
- var $3c0fc76039f1c516$exports = {};
158
-
159
- $parcel$export($3c0fc76039f1c516$exports, "useDateFieldState", () => $3c0fc76039f1c516$export$60e84778edff6d26);
160
-
161
-
162
-
163
-
164
- const $3c0fc76039f1c516$var$EDITABLE_SEGMENTS = {
165
- year: true,
166
- month: true,
167
- day: true,
168
- hour: true,
169
- minute: true,
170
- second: true,
171
- dayPeriod: true,
172
- era: true
173
- };
174
- const $3c0fc76039f1c516$var$PAGE_STEP = {
175
- year: 5,
176
- month: 2,
177
- day: 7,
178
- hour: 2,
179
- minute: 15,
180
- second: 15
181
- };
182
- // Node seems to convert everything to lowercase...
183
- const $3c0fc76039f1c516$var$TYPE_MAPPING = {
184
- dayperiod: 'dayPeriod'
185
- };
186
- function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
187
- let { locale: locale , createCalendar: createCalendar , hideTimeZone: hideTimeZone , isDisabled: isDisabled , isReadOnly: isReadOnly , isRequired: isRequired } = props;
188
- let v1 = props.value || props.defaultValue || props.placeholderValue;
189
- let [granularity, defaultTimeZone] = $35a22f14a1f04b11$export$2440da353cedad43(v1, props.granularity);
190
- let timeZone = defaultTimeZone || 'UTC';
191
- // props.granularity must actually exist in the value if one is provided.
192
- if (v1 && !(granularity in v1)) throw new Error('Invalid granularity ' + granularity + ' for value ' + v1.toString());
193
- var _maxGranularity;
194
- let formatOpts = $7UzoM$useMemo(()=>({
195
- granularity: granularity,
196
- maxGranularity: (_maxGranularity = props.maxGranularity) !== null && _maxGranularity !== void 0 ? _maxGranularity : 'year',
197
- timeZone: defaultTimeZone,
198
- hideTimeZone: hideTimeZone,
199
- hourCycle: props.hourCycle
200
- })
201
- , [
202
- props.maxGranularity,
203
- granularity,
204
- props.hourCycle,
205
- defaultTimeZone,
206
- hideTimeZone
207
- ]);
208
- let opts = $7UzoM$useMemo(()=>$35a22f14a1f04b11$export$7e319ea407e63bc0({
209
- }, formatOpts)
210
- , [
211
- formatOpts
212
- ]);
213
- let dateFormatter = $7UzoM$useMemo(()=>new $7UzoM$DateFormatter(locale, opts)
214
- , [
215
- locale,
216
- opts
217
- ]);
218
- let resolvedOptions = $7UzoM$useMemo(()=>dateFormatter.resolvedOptions()
219
- , [
220
- dateFormatter
221
- ]);
222
- let calendar = $7UzoM$useMemo(()=>createCalendar(resolvedOptions.calendar)
223
- , [
224
- createCalendar,
225
- resolvedOptions.calendar
226
- ]);
227
- // Determine how many editable segments there are for validation purposes.
228
- // The result is cached for performance.
229
- let allSegments = $7UzoM$useMemo(()=>dateFormatter.formatToParts(new Date()).filter((seg)=>$3c0fc76039f1c516$var$EDITABLE_SEGMENTS[seg.type]
230
- ).reduce((p, seg)=>(p[seg.type] = true, p)
231
- , {
232
- })
233
- , [
234
- dateFormatter
235
- ]);
236
- let [validSegments, setValidSegments] = $7UzoM$useState(()=>props.value || props.defaultValue ? {
237
- ...allSegments
238
- } : {
239
- }
240
- );
241
- // We keep track of the placeholder date separately in state so that onChange is not called
242
- // until all segments are set. If the value === null (not undefined), then assume the component
243
- // is controlled, so use the placeholder as the value until all segments are entered so it doesn't
244
- // change from uncontrolled to controlled and emit a warning.
245
- let [placeholderDate, setPlaceholderDate] = $7UzoM$useState(()=>$35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar, defaultTimeZone)
246
- );
247
- // Reset placeholder when calendar changes
248
- let lastCalendarIdentifier = $7UzoM$useRef(calendar.identifier);
249
- $7UzoM$useEffect(()=>{
250
- if (calendar.identifier !== lastCalendarIdentifier.current) {
251
- lastCalendarIdentifier.current = calendar.identifier;
252
- setPlaceholderDate((placeholder)=>Object.keys(validSegments).length > 0 ? $7UzoM$toCalendar(placeholder, calendar) : $35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar, defaultTimeZone)
253
- );
254
- }
255
- }, [
256
- calendar,
257
- granularity,
258
- validSegments,
259
- defaultTimeZone,
260
- props.placeholderValue
261
- ]);
262
- let [value1, setDate] = $7UzoM$useControlledState(props.value, props.defaultValue, props.onChange);
263
- let calendarValue = $7UzoM$useMemo(()=>$35a22f14a1f04b11$export$61a490a80c552550(value1, calendar)
264
- , [
265
- value1,
266
- calendar
267
- ]);
268
- // If there is a value prop, and some segments were previously placeholders, mark them all as valid.
269
- if (value1 && Object.keys(validSegments).length < Object.keys(allSegments).length) {
270
- validSegments = {
271
- ...allSegments
272
- };
273
- setValidSegments(validSegments);
274
- }
275
- // If the value is set to null and all segments are valid, reset the placeholder.
276
- if (value1 == null && Object.keys(validSegments).length === Object.keys(allSegments).length) {
277
- validSegments = {
278
- };
279
- setValidSegments(validSegments);
280
- setPlaceholderDate($35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar, defaultTimeZone));
281
- }
282
- // If all segments are valid, use the date from state, otherwise use the placeholder date.
283
- let displayValue = calendarValue && Object.keys(validSegments).length >= Object.keys(allSegments).length ? calendarValue : placeholderDate;
284
- let setValue = (newValue)=>{
285
- if (props.isDisabled || props.isReadOnly) return;
286
- if (Object.keys(validSegments).length >= Object.keys(allSegments).length) {
287
- // The display calendar should not have any effect on the emitted value.
288
- // Emit dates in the same calendar as the original value, if any, otherwise gregorian.
289
- newValue = $7UzoM$toCalendar(newValue, (v1 === null || v1 === void 0 ? void 0 : v1.calendar) || new $7UzoM$GregorianCalendar());
290
- setDate(newValue);
291
- } else setPlaceholderDate(newValue);
292
- };
293
- let dateValue = $7UzoM$useMemo(()=>displayValue.toDate(timeZone)
294
- , [
295
- displayValue,
296
- timeZone
297
- ]);
298
- let segments = $7UzoM$useMemo(()=>dateFormatter.formatToParts(dateValue).map((segment)=>{
299
- let isEditable = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type];
300
- if (segment.type === 'era' && calendar.getEras().length === 1) isEditable = false;
301
- return {
302
- type: $3c0fc76039f1c516$var$TYPE_MAPPING[segment.type] || segment.type,
303
- text: segment.value,
304
- ...$3c0fc76039f1c516$var$getSegmentLimits(displayValue, segment.type, resolvedOptions),
305
- isPlaceholder: $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type] && !validSegments[segment.type],
306
- isEditable: isEditable
307
- };
308
- })
309
- , [
310
- dateValue,
311
- validSegments,
312
- dateFormatter,
313
- resolvedOptions,
314
- displayValue,
315
- calendar
316
- ]);
317
- let hasEra = $7UzoM$useMemo(()=>segments.some((s)=>s.type === 'era'
318
- )
319
- , [
320
- segments
321
- ]);
322
- let markValid = (part)=>{
323
- validSegments[part] = true;
324
- if (part === 'year' && hasEra) validSegments.era = true;
325
- setValidSegments({
326
- ...validSegments
327
- });
328
- };
329
- let adjustSegment = (type, amount)=>{
330
- markValid(type);
331
- setValue($3c0fc76039f1c516$var$addSegment(displayValue, type, amount, resolvedOptions));
332
- };
333
- let validationState = props.validationState || ($35a22f14a1f04b11$export$eac50920cf2fd59a(calendarValue, props.minValue, props.maxValue) ? 'invalid' : null);
334
- return {
335
- value: calendarValue,
336
- dateValue: dateValue,
337
- setValue: setValue,
338
- segments: segments,
339
- dateFormatter: dateFormatter,
340
- validationState: validationState,
341
- granularity: granularity,
342
- isDisabled: isDisabled,
343
- isReadOnly: isReadOnly,
344
- isRequired: isRequired,
345
- increment (part) {
346
- adjustSegment(part, 1);
347
- },
348
- decrement (part) {
349
- adjustSegment(part, -1);
350
- },
351
- incrementPage (part) {
352
- adjustSegment(part, $3c0fc76039f1c516$var$PAGE_STEP[part] || 1);
353
- },
354
- decrementPage (part) {
355
- adjustSegment(part, -($3c0fc76039f1c516$var$PAGE_STEP[part] || 1));
356
- },
357
- setSegment (part, v) {
358
- markValid(part);
359
- setValue($3c0fc76039f1c516$var$setSegment(displayValue, part, v, resolvedOptions));
360
- },
361
- confirmPlaceholder (part) {
362
- if (props.isDisabled || props.isReadOnly) return;
363
- if (!part) {
364
- // Confirm the rest of the placeholder if any of the segments are valid.
365
- let numValid = Object.keys(validSegments).length;
366
- if (numValid > 0 && numValid < Object.keys(allSegments).length) {
367
- validSegments = {
368
- ...allSegments
369
- };
370
- setValidSegments(validSegments);
371
- setValue(displayValue.copy());
372
- }
373
- } else if (!validSegments[part]) {
374
- markValid(part);
375
- setValue(displayValue.copy());
376
- }
377
- },
378
- clearSegment (part) {
379
- delete validSegments[part];
380
- setValidSegments({
381
- ...validSegments
382
- });
383
- let placeholder = $35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar, defaultTimeZone);
384
- let value = displayValue;
385
- // Reset day period to default without changing the hour.
386
- if (part === 'dayPeriod' && 'hour' in displayValue && 'hour' in placeholder) {
387
- let isPM = displayValue.hour >= 12;
388
- let shouldBePM = placeholder.hour >= 12;
389
- if (isPM && !shouldBePM) value = displayValue.set({
390
- hour: displayValue.hour - 12
391
- });
392
- else if (!isPM && shouldBePM) value = displayValue.set({
393
- hour: displayValue.hour + 12
394
- });
395
- } else if (part in displayValue) value = displayValue.set({
396
- [part]: placeholder[part]
397
- });
398
- setDate(null);
399
- setValue(value);
400
- },
401
- formatValue (fieldOptions) {
402
- if (!calendarValue) return '';
403
- let formatOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, formatOpts);
404
- let formatter = new $7UzoM$DateFormatter(locale, formatOptions);
405
- return formatter.format(dateValue);
406
- }
407
- };
408
- }
409
- function $3c0fc76039f1c516$var$getSegmentLimits(date, type, options) {
410
- switch(type){
411
- case 'era':
412
- {
413
- let eras = date.calendar.getEras();
414
- return {
415
- value: eras.indexOf(date.era),
416
- minValue: 0,
417
- maxValue: eras.length - 1
418
- };
419
- }
420
- case 'year':
421
- return {
422
- value: date.year,
423
- minValue: 1,
424
- maxValue: date.calendar.getYearsInEra(date)
425
- };
426
- case 'month':
427
- return {
428
- value: date.month,
429
- minValue: $7UzoM$getMinimumMonthInYear(date),
430
- maxValue: date.calendar.getMonthsInYear(date)
431
- };
432
- case 'day':
433
- return {
434
- value: date.day,
435
- minValue: $7UzoM$getMinimumDayInMonth(date),
436
- maxValue: date.calendar.getDaysInMonth(date)
437
- };
438
- }
439
- if ('hour' in date) switch(type){
440
- case 'dayPeriod':
441
- return {
442
- value: date.hour >= 12 ? 12 : 0,
443
- minValue: 0,
444
- maxValue: 12
445
- };
446
- case 'hour':
447
- if (options.hour12) {
448
- let isPM = date.hour >= 12;
449
- return {
450
- value: date.hour,
451
- minValue: isPM ? 12 : 0,
452
- maxValue: isPM ? 23 : 11
453
- };
454
- }
455
- return {
456
- value: date.hour,
457
- minValue: 0,
458
- maxValue: 23
459
- };
460
- case 'minute':
461
- return {
462
- value: date.minute,
463
- minValue: 0,
464
- maxValue: 59
465
- };
466
- case 'second':
467
- return {
468
- value: date.second,
469
- minValue: 0,
470
- maxValue: 59
471
- };
472
- }
473
- return {
474
- };
475
- }
476
- function $3c0fc76039f1c516$var$addSegment(value, part, amount, options) {
477
- switch(part){
478
- case 'era':
479
- case 'year':
480
- case 'month':
481
- case 'day':
482
- return value.cycle(part, amount, {
483
- round: part === 'year'
484
- });
485
- }
486
- if ('hour' in value) switch(part){
487
- case 'dayPeriod':
488
- {
489
- let hours = value.hour;
490
- let isPM = hours >= 12;
491
- return value.set({
492
- hour: isPM ? hours - 12 : hours + 12
493
- });
494
- }
495
- case 'hour':
496
- case 'minute':
497
- case 'second':
498
- return value.cycle(part, amount, {
499
- round: part !== 'hour',
500
- hourCycle: options.hour12 ? 12 : 24
501
- });
502
- }
503
- }
504
- function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
505
- switch(part){
506
- case 'day':
507
- case 'month':
508
- case 'year':
509
- return value.set({
510
- [part]: segmentValue
511
- });
512
- }
513
- if ('hour' in value) switch(part){
514
- case 'dayPeriod':
515
- {
516
- let hours = value.hour;
517
- let wasPM = hours >= 12;
518
- let isPM = segmentValue >= 12;
519
- if (isPM === wasPM) return value;
520
- return value.set({
521
- hour: wasPM ? hours - 12 : hours + 12
522
- });
523
- }
524
- case 'hour':
525
- // In 12 hour time, ensure that AM/PM does not change
526
- if (options.hour12) {
527
- let hours = value.hour;
528
- let wasPM = hours >= 12;
529
- if (!wasPM && segmentValue === 12) segmentValue = 0;
530
- if (wasPM && segmentValue < 12) segmentValue += 12;
531
- }
532
- // fallthrough
533
- case 'minute':
534
- case 'second':
535
- return value.set({
536
- [part]: segmentValue
537
- });
538
- }
539
- }
540
-
541
-
542
- var $93c38a5e28be6249$exports = {};
543
-
544
- $parcel$export($93c38a5e28be6249$exports, "useDateRangePickerState", () => $93c38a5e28be6249$export$e50a61c1de9f574);
545
-
546
-
547
-
548
-
549
- function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
550
- var ref, ref1;
551
- let [isOpen1, setOpen] = $7UzoM$useState(false);
552
- let [controlledValue, setControlledValue] = $7UzoM$useControlledState(props.value, props.defaultValue || null, props.onChange);
553
- let [placeholderValue, setPlaceholderValue] = $7UzoM$useState(()=>controlledValue || {
554
- start: null,
555
- end: null
556
- }
557
- );
558
- // Reset the placeholder if the value prop is set to null.
559
- if (controlledValue == null && placeholderValue.start && placeholderValue.end) {
560
- placeholderValue = {
561
- start: null,
562
- end: null
563
- };
564
- setPlaceholderValue(placeholderValue);
565
- }
566
- let value1 = controlledValue || placeholderValue;
567
- let valueRef = $7UzoM$useRef(value1);
568
- valueRef.current = value1;
569
- let setValue = (value)=>{
570
- valueRef.current = value;
571
- setPlaceholderValue(value);
572
- if ((value === null || value === void 0 ? void 0 : value.start) && value.end) setControlledValue(value);
573
- else setControlledValue(null);
574
- };
575
- let v = (value1 === null || value1 === void 0 ? void 0 : value1.start) || (value1 === null || value1 === void 0 ? void 0 : value1.end) || props.placeholderValue;
576
- let [granularity, defaultTimeZone] = $35a22f14a1f04b11$export$2440da353cedad43(v, props.granularity);
577
- let hasTime = granularity === 'hour' || granularity === 'minute' || granularity === 'second' || granularity === 'millisecond';
578
- var _shouldCloseOnSelect;
579
- let shouldCloseOnSelect = (_shouldCloseOnSelect = props.shouldCloseOnSelect) !== null && _shouldCloseOnSelect !== void 0 ? _shouldCloseOnSelect : true;
580
- let [dateRange1, setSelectedDateRange] = $7UzoM$useState(null);
581
- let [timeRange1, setSelectedTimeRange] = $7UzoM$useState(null);
582
- if (value1 && value1.start && value1.end) {
583
- dateRange1 = value1;
584
- if ('hour' in value1.start) timeRange1 = value1;
585
- }
586
- let commitValue = (dateRange, timeRange)=>{
587
- setValue({
588
- start: 'timeZone' in timeRange.start ? timeRange.start.set($7UzoM$toCalendarDate(dateRange.start)) : $7UzoM$toCalendarDateTime(dateRange.start, timeRange.start),
589
- end: 'timeZone' in timeRange.end ? timeRange.end.set($7UzoM$toCalendarDate(dateRange.end)) : $7UzoM$toCalendarDateTime(dateRange.end, timeRange.end)
590
- });
591
- };
592
- // Intercept setValue to make sure the Time section is not changed by date selection in Calendar
593
- let setDateRange = (range)=>{
594
- let shouldClose = typeof shouldCloseOnSelect === 'function' ? shouldCloseOnSelect() : shouldCloseOnSelect;
595
- if (hasTime) {
596
- if (shouldClose || range.start && range.end && (timeRange1 === null || timeRange1 === void 0 ? void 0 : timeRange1.start) && (timeRange1 === null || timeRange1 === void 0 ? void 0 : timeRange1.end)) commitValue(range, {
597
- start: (timeRange1 === null || timeRange1 === void 0 ? void 0 : timeRange1.start) || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue),
598
- end: (timeRange1 === null || timeRange1 === void 0 ? void 0 : timeRange1.end) || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue)
599
- });
600
- else setSelectedDateRange(range);
601
- } else if (range.start && range.end) setValue(range);
602
- else setSelectedDateRange(range);
603
- if (shouldClose) setOpen(false);
604
- };
605
- let setTimeRange = (range)=>{
606
- if ((dateRange1 === null || dateRange1 === void 0 ? void 0 : dateRange1.start) && (dateRange1 === null || dateRange1 === void 0 ? void 0 : dateRange1.end) && range.start && range.end) commitValue(dateRange1, range);
607
- else setSelectedTimeRange(range);
608
- };
609
- let validationState = props.validationState || (value1 != null && ($35a22f14a1f04b11$export$eac50920cf2fd59a(value1.start, props.minValue, props.maxValue) || $35a22f14a1f04b11$export$eac50920cf2fd59a(value1.end, props.minValue, props.maxValue) || value1.end != null && value1.start != null && value1.end.compare(value1.start) < 0 || (value1 === null || value1 === void 0 ? void 0 : value1.start) && ((ref = props.isDateUnavailable) === null || ref === void 0 ? void 0 : ref.call(props, value1.start)) || (value1 === null || value1 === void 0 ? void 0 : value1.end) && ((ref1 = props.isDateUnavailable) === null || ref1 === void 0 ? void 0 : ref1.call(props, value1.end))) ? 'invalid' : null);
610
- return {
611
- value: value1,
612
- setValue: setValue,
613
- dateRange: dateRange1,
614
- timeRange: timeRange1,
615
- granularity: granularity,
616
- hasTime: hasTime,
617
- setDate (part, date) {
618
- setDateRange({
619
- ...dateRange1,
620
- [part]: date
621
- });
622
- },
623
- setTime (part, time) {
624
- setTimeRange({
625
- ...timeRange1,
626
- [part]: time
627
- });
628
- },
629
- setDateTime (part, dateTime) {
630
- setValue({
631
- ...value1,
632
- [part]: dateTime
633
- });
634
- },
635
- setDateRange: setDateRange,
636
- setTimeRange: setTimeRange,
637
- isOpen: isOpen1,
638
- setOpen (isOpen) {
639
- // Commit the selected date range when the calendar is closed. Use a placeholder time if one wasn't set.
640
- // If only the time range was set and not the date range, don't commit. The state will be preserved until
641
- // the user opens the popover again.
642
- if (!isOpen && !((value1 === null || value1 === void 0 ? void 0 : value1.start) && (value1 === null || value1 === void 0 ? void 0 : value1.end)) && (dateRange1 === null || dateRange1 === void 0 ? void 0 : dateRange1.start) && (dateRange1 === null || dateRange1 === void 0 ? void 0 : dateRange1.end) && hasTime) commitValue(dateRange1, {
643
- start: (timeRange1 === null || timeRange1 === void 0 ? void 0 : timeRange1.start) || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue),
644
- end: (timeRange1 === null || timeRange1 === void 0 ? void 0 : timeRange1.end) || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue)
645
- });
646
- setOpen(isOpen);
647
- },
648
- validationState: validationState,
649
- formatValue (locale, fieldOptions) {
650
- if (!value1 || !value1.start || !value1.end) return '';
651
- let startTimeZone = 'timeZone' in value1.start ? value1.start.timeZone : undefined;
652
- let startGranularity = props.granularity || (value1.start && 'minute' in value1.start ? 'minute' : 'day');
653
- let endTimeZone = 'timeZone' in value1.end ? value1.end.timeZone : undefined;
654
- let endGranularity = props.granularity || (value1.end && 'minute' in value1.end ? 'minute' : 'day');
655
- let startOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, {
656
- granularity: startGranularity,
657
- timeZone: startTimeZone,
658
- hideTimeZone: props.hideTimeZone,
659
- hourCycle: props.hourCycle
660
- });
661
- let startFormatter = new $7UzoM$DateFormatter(locale, startOptions);
662
- let endFormatter;
663
- if (startTimeZone === endTimeZone && startGranularity === endGranularity) {
664
- // Use formatRange, as it results in shorter output when some of the fields
665
- // are shared between the start and end dates (e.g. the same month).
666
- // Formatting will fail if the end date is before the start date. Fall back below when that happens.
667
- try {
668
- return startFormatter.formatRange(value1.start.toDate(startTimeZone), value1.end.toDate(endTimeZone));
669
- } catch (e) {
670
- // ignore
671
- }
672
- endFormatter = startFormatter;
673
- } else {
674
- let endOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, {
675
- granularity: endGranularity,
676
- timeZone: endTimeZone,
677
- hideTimeZone: props.hideTimeZone,
678
- hourCycle: props.hourCycle
679
- });
680
- endFormatter = new $7UzoM$DateFormatter(locale, endOptions);
681
- }
682
- return `${startFormatter.format(value1.start.toDate(startTimeZone))} – ${endFormatter.format(value1.end.toDate(endTimeZone))}`;
683
- },
684
- confirmPlaceholder () {
685
- // Need to use ref value here because the value can be set in the same tick as
686
- // a blur, which means the component won't have re-rendered yet.
687
- let value = valueRef.current;
688
- if (value && Boolean(value.start) !== Boolean(value.end)) {
689
- let calendar = (value.start || value.end).calendar;
690
- let placeholder = $35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar, defaultTimeZone);
691
- setValue({
692
- start: value.start || placeholder,
693
- end: value.end || placeholder
694
- });
695
- }
696
- }
697
- };
698
- }
699
-
700
-
701
- var $eff5d8ee529ac4bb$exports = {};
702
-
703
- $parcel$export($eff5d8ee529ac4bb$exports, "useTimeFieldState", () => $eff5d8ee529ac4bb$export$fd53cef0cc796101);
704
-
705
-
706
-
707
-
708
- function $eff5d8ee529ac4bb$export$fd53cef0cc796101(props) {
709
- let { placeholderValue: placeholderValue = new $7UzoM$Time() , minValue: minValue , maxValue: maxValue , granularity: granularity } = props;
710
- let [value, setValue] = $7UzoM$useControlledState(props.value, props.defaultValue, props.onChange);
711
- let v = value || placeholderValue;
712
- let day = v && 'day' in v ? v : undefined;
713
- let placeholderDate = $7UzoM$useMemo(()=>$eff5d8ee529ac4bb$var$convertValue(placeholderValue)
714
- , [
715
- placeholderValue
716
- ]);
717
- let minDate = $7UzoM$useMemo(()=>$eff5d8ee529ac4bb$var$convertValue(minValue, day)
718
- , [
719
- minValue,
720
- day
721
- ]);
722
- let maxDate = $7UzoM$useMemo(()=>$eff5d8ee529ac4bb$var$convertValue(maxValue, day)
723
- , [
724
- maxValue,
725
- day
726
- ]);
727
- let dateTime = $7UzoM$useMemo(()=>value == null ? null : $eff5d8ee529ac4bb$var$convertValue(value)
728
- , [
729
- value
730
- ]);
731
- let onChange = (newValue)=>{
732
- setValue(v && 'day' in v ? newValue : newValue && $7UzoM$toTime(newValue));
733
- };
734
- return $3c0fc76039f1c516$export$60e84778edff6d26({
735
- ...props,
736
- value: dateTime,
737
- defaultValue: undefined,
738
- minValue: minDate,
739
- maxValue: maxDate,
740
- onChange: onChange,
741
- granularity: granularity || 'minute',
742
- maxGranularity: 'hour',
743
- placeholderValue: placeholderDate,
744
- // Calendar should not matter for time fields.
745
- createCalendar: ()=>new $7UzoM$GregorianCalendar()
746
- });
747
- }
748
- function $eff5d8ee529ac4bb$var$convertValue(value, date = $7UzoM$today($7UzoM$getLocalTimeZone())) {
749
- if (!value) return null;
750
- if ('day' in value) return value;
751
- return $7UzoM$toCalendarDateTime(date, value);
752
- }
753
18
 
754
19
 
755
20