@uxf/datepicker 14.0.0 → 14.1.0

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/hooks/use-day.js CHANGED
@@ -1,80 +1,242 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useDay = useDay;
4
+ const compiler_runtime_1 = require("react/compiler-runtime");
4
5
  const empty_array_1 = require("@uxf/core/constants/empty-array");
5
6
  const react_1 = require("react");
6
7
  const date_string_1 = require("../utils/date-string");
7
8
  const get_date_invervals_1 = require("../utils/get-date-invervals");
8
- function useDay({ date, datesConfig, dayRef, focusedDate, isDateBlocked, isDateFocused, isDateHovered, isDateInsideRange, isDateSelected, onDateFocus, onDateHover, onDateSelect, preventScroll, unavailableDates, }) {
9
+ function useDay(t0) {
9
10
  var _a;
10
- const disabledDatesFromConfig = (_a = datesConfig === null || datesConfig === void 0 ? void 0 : datesConfig.filter((config) => config.isDisabled).flatMap((config) => config.dates)) !== null && _a !== void 0 ? _a : empty_array_1.EMPTY_ARRAY;
11
- // merge and filter duplicates
12
- const disabledDates = [...unavailableDates, ...disabledDatesFromConfig].filter((day, index, self) => index === self.findIndex((d) => d.getTime() === day.getTime()));
13
- const onClick = (0, react_1.useCallback)(() => onDateSelect(date), [date, onDateSelect]);
14
- const onMouseEnter = (0, react_1.useCallback)(() => onDateHover(date), [date, onDateHover]);
15
- const isToday = (0, date_string_1.todayDateString)() === (0, date_string_1.toDateString)(date);
16
- (0, react_1.useEffect)(() => {
17
- if (dayRef && dayRef.current && isDateFocused(date)) {
18
- dayRef.current.focus({
19
- preventScroll,
20
- });
21
- }
22
- }, [dayRef, date, isDateFocused, preventScroll]);
23
- const onKeyDown = (0, react_1.useCallback)((e) => {
24
- if (["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"].includes(e.key)) {
25
- e.preventDefault();
26
- switch (e.key) {
27
- case "ArrowRight":
28
- onDateFocus((0, date_string_1.fromDateString)((0, date_string_1.addDays)((0, date_string_1.toDateString)(date), 1)));
29
- break;
30
- case "ArrowLeft":
31
- onDateFocus((0, date_string_1.fromDateString)((0, date_string_1.addDays)((0, date_string_1.toDateString)(date), -1)));
32
- break;
33
- case "ArrowUp":
34
- onDateFocus((0, date_string_1.fromDateString)((0, date_string_1.addDays)((0, date_string_1.toDateString)(date), -7)));
35
- break;
36
- case "ArrowDown":
37
- onDateFocus((0, date_string_1.fromDateString)((0, date_string_1.addDays)((0, date_string_1.toDateString)(date), 7)));
38
- break;
11
+ const $ = (0, compiler_runtime_1.c)(49);
12
+ const { date, datesConfig, dayRef, focusedDate, isDateBlocked, isDateFocused, isDateHovered, isDateInsideRange, isDateSelected, onDateFocus, onDateHover, onDateSelect, preventScroll, unavailableDates } = t0;
13
+ const disabledDatesFromConfig = (_a = datesConfig === null || datesConfig === void 0 ? void 0 : datesConfig.filter(_temp).flatMap(_temp2)) !== null && _a !== void 0 ? _a : empty_array_1.EMPTY_ARRAY;
14
+ const disabledDates = [...unavailableDates, ...disabledDatesFromConfig].filter(_temp3);
15
+ let t1;
16
+ if ($[0] !== date || $[1] !== onDateSelect) {
17
+ t1 = () => onDateSelect(date);
18
+ $[0] = date;
19
+ $[1] = onDateSelect;
20
+ $[2] = t1;
21
+ }
22
+ else {
23
+ t1 = $[2];
24
+ }
25
+ const onClick = t1;
26
+ let t2;
27
+ if ($[3] !== date || $[4] !== onDateHover) {
28
+ t2 = () => onDateHover(date);
29
+ $[3] = date;
30
+ $[4] = onDateHover;
31
+ $[5] = t2;
32
+ }
33
+ else {
34
+ t2 = $[5];
35
+ }
36
+ const onMouseEnter = t2;
37
+ let t3;
38
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
39
+ t3 = (0, date_string_1.todayDateString)();
40
+ $[6] = t3;
41
+ }
42
+ else {
43
+ t3 = $[6];
44
+ }
45
+ let t4;
46
+ if ($[7] !== date) {
47
+ t4 = (0, date_string_1.toDateString)(date);
48
+ $[7] = date;
49
+ $[8] = t4;
50
+ }
51
+ else {
52
+ t4 = $[8];
53
+ }
54
+ const isToday = t3 === t4;
55
+ let t5;
56
+ let t6;
57
+ if ($[9] !== date || $[10] !== dayRef || $[11] !== isDateFocused || $[12] !== preventScroll) {
58
+ t5 = () => {
59
+ if (dayRef && dayRef.current && isDateFocused(date)) {
60
+ dayRef.current.focus({
61
+ preventScroll
62
+ });
63
+ }
64
+ };
65
+ t6 = [dayRef, date, isDateFocused, preventScroll];
66
+ $[9] = date;
67
+ $[10] = dayRef;
68
+ $[11] = isDateFocused;
69
+ $[12] = preventScroll;
70
+ $[13] = t5;
71
+ $[14] = t6;
72
+ }
73
+ else {
74
+ t5 = $[13];
75
+ t6 = $[14];
76
+ }
77
+ (0, react_1.useEffect)(t5, t6);
78
+ let t7;
79
+ if ($[15] !== date || $[16] !== onDateFocus) {
80
+ t7 = e => {
81
+ if (["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"].includes(e.key)) {
82
+ e.preventDefault();
83
+ bb44: switch (e.key) {
84
+ case "ArrowRight":
85
+ {
86
+ onDateFocus((0, date_string_1.fromDateString)((0, date_string_1.addDays)((0, date_string_1.toDateString)(date), 1)));
87
+ break bb44;
88
+ }
89
+ case "ArrowLeft":
90
+ {
91
+ onDateFocus((0, date_string_1.fromDateString)((0, date_string_1.addDays)((0, date_string_1.toDateString)(date), -1)));
92
+ break bb44;
93
+ }
94
+ case "ArrowUp":
95
+ {
96
+ onDateFocus((0, date_string_1.fromDateString)((0, date_string_1.addDays)((0, date_string_1.toDateString)(date), -7)));
97
+ break bb44;
98
+ }
99
+ case "ArrowDown":
100
+ {
101
+ onDateFocus((0, date_string_1.fromDateString)((0, date_string_1.addDays)((0, date_string_1.toDateString)(date), 7)));
102
+ }
103
+ }
39
104
  }
40
- }
41
- }, [date, onDateFocus]);
105
+ };
106
+ $[15] = date;
107
+ $[16] = onDateFocus;
108
+ $[17] = t7;
109
+ }
110
+ else {
111
+ t7 = $[17];
112
+ }
113
+ const onKeyDown = t7;
42
114
  const dateIntervals = (0, get_date_invervals_1.getDateIntervals)(disabledDates);
43
- const dateStr = (0, date_string_1.toDateString)(date);
44
- const _isFirstUnavailableDate = () => {
45
- return dateIntervals.some((interval) => (0, date_string_1.toDateString)(interval.start) === dateStr);
46
- };
47
- const _isLastUnavailableDate = () => {
48
- return dateIntervals.some((interval) => (0, date_string_1.toDateString)(interval.end) === dateStr);
49
- };
50
- const applicableDatesConfigs = datesConfig === null || datesConfig === void 0 ? void 0 : datesConfig.filter((config) => config.dates.some((configDay) => (0, date_string_1.toDateString)(configDay) === dateStr));
51
- const flags = applicableDatesConfigs === null || applicableDatesConfigs === void 0 ? void 0 : applicableDatesConfigs.reduce((acc, curr) => {
52
- if (!curr.flag) {
115
+ let t8;
116
+ if ($[18] !== date) {
117
+ t8 = (0, date_string_1.toDateString)(date);
118
+ $[18] = date;
119
+ $[19] = t8;
120
+ }
121
+ else {
122
+ t8 = $[19];
123
+ }
124
+ const dateStr = t8;
125
+ const _isFirstUnavailableDate = () => dateIntervals.some(interval => (0, date_string_1.toDateString)(interval.start) === dateStr);
126
+ const _isLastUnavailableDate = () => dateIntervals.some(interval_0 => (0, date_string_1.toDateString)(interval_0.end) === dateStr);
127
+ let t9;
128
+ if ($[20] !== dateStr || $[21] !== datesConfig) {
129
+ const applicableDatesConfigs = datesConfig === null || datesConfig === void 0 ? void 0 : datesConfig.filter(config_1 => config_1.dates.some(configDay => (0, date_string_1.toDateString)(configDay) === dateStr));
130
+ t9 = applicableDatesConfigs === null || applicableDatesConfigs === void 0 ? void 0 : applicableDatesConfigs.reduce((acc, curr) => {
131
+ if (!curr.flag) {
132
+ return acc;
133
+ }
134
+ const intervals = (0, get_date_invervals_1.getDateIntervals)(curr.dates);
135
+ acc.push({
136
+ flag: curr.flag,
137
+ isFirst: intervals.some(interval_1 => (0, date_string_1.toDateString)(interval_1.start) === dateStr),
138
+ isLast: intervals.some(interval_2 => (0, date_string_1.toDateString)(interval_2.end) === dateStr)
139
+ });
53
140
  return acc;
54
- }
55
- const intervals = (0, get_date_invervals_1.getDateIntervals)(curr.dates);
56
- acc.push({
57
- flag: curr.flag,
58
- isFirst: intervals.some((interval) => (0, date_string_1.toDateString)(interval.start) === dateStr),
59
- isLast: intervals.some((interval) => (0, date_string_1.toDateString)(interval.end) === dateStr),
60
- });
61
- return acc;
62
- }, []);
63
- const isHovered = isDateHovered(date);
64
- const isDisabled = isDateBlocked(date) && !isHovered;
65
- return {
66
- flags: flags !== null && flags !== void 0 ? flags : empty_array_1.EMPTY_ARRAY,
67
- disabledDate: isDisabled,
68
- isFirstDisabled: _isFirstUnavailableDate(),
69
- isHovered: isHovered,
70
- isInsideRange: isDateInsideRange ? isDateInsideRange(date) : false,
71
- isLastDisabled: _isLastUnavailableDate(),
72
- isSelected: isDateSelected(date),
73
- isToday,
74
- isWithinHoverRange: isHovered,
75
- onClick: !isDisabled ? onClick : undefined,
76
- onKeyDown,
77
- onMouseEnter,
78
- tabIndex: focusedDate === null || isDateFocused(date) ? 0 : -1,
79
- };
141
+ }, []);
142
+ $[20] = dateStr;
143
+ $[21] = datesConfig;
144
+ $[22] = t9;
145
+ }
146
+ else {
147
+ t9 = $[22];
148
+ }
149
+ const flags = t9;
150
+ let t10;
151
+ if ($[23] !== date || $[24] !== isDateHovered) {
152
+ t10 = isDateHovered(date);
153
+ $[23] = date;
154
+ $[24] = isDateHovered;
155
+ $[25] = t10;
156
+ }
157
+ else {
158
+ t10 = $[25];
159
+ }
160
+ const isHovered = t10;
161
+ let t11;
162
+ if ($[26] !== date || $[27] !== isDateBlocked || $[28] !== isHovered) {
163
+ t11 = isDateBlocked(date) && !isHovered;
164
+ $[26] = date;
165
+ $[27] = isDateBlocked;
166
+ $[28] = isHovered;
167
+ $[29] = t11;
168
+ }
169
+ else {
170
+ t11 = $[29];
171
+ }
172
+ const isDisabled = t11;
173
+ const t12 = flags !== null && flags !== void 0 ? flags : empty_array_1.EMPTY_ARRAY;
174
+ const t13 = _isFirstUnavailableDate();
175
+ let t14;
176
+ if ($[30] !== date || $[31] !== isDateInsideRange) {
177
+ t14 = isDateInsideRange ? isDateInsideRange(date) : false;
178
+ $[30] = date;
179
+ $[31] = isDateInsideRange;
180
+ $[32] = t14;
181
+ }
182
+ else {
183
+ t14 = $[32];
184
+ }
185
+ const t15 = _isLastUnavailableDate();
186
+ let t16;
187
+ if ($[33] !== date || $[34] !== isDateSelected) {
188
+ t16 = isDateSelected(date);
189
+ $[33] = date;
190
+ $[34] = isDateSelected;
191
+ $[35] = t16;
192
+ }
193
+ else {
194
+ t16 = $[35];
195
+ }
196
+ const t17 = !isDisabled ? onClick : undefined;
197
+ const t18 = focusedDate === null || isDateFocused(date) ? 0 : -1;
198
+ let t19;
199
+ if ($[36] !== isDisabled || $[37] !== isHovered || $[38] !== isToday || $[39] !== onKeyDown || $[40] !== onMouseEnter || $[41] !== t12 || $[42] !== t13 || $[43] !== t14 || $[44] !== t15 || $[45] !== t16 || $[46] !== t17 || $[47] !== t18) {
200
+ t19 = {
201
+ flags: t12,
202
+ disabledDate: isDisabled,
203
+ isFirstDisabled: t13,
204
+ isHovered,
205
+ isInsideRange: t14,
206
+ isLastDisabled: t15,
207
+ isSelected: t16,
208
+ isToday,
209
+ isWithinHoverRange: isHovered,
210
+ onClick: t17,
211
+ onKeyDown,
212
+ onMouseEnter,
213
+ tabIndex: t18
214
+ };
215
+ $[36] = isDisabled;
216
+ $[37] = isHovered;
217
+ $[38] = isToday;
218
+ $[39] = onKeyDown;
219
+ $[40] = onMouseEnter;
220
+ $[41] = t12;
221
+ $[42] = t13;
222
+ $[43] = t14;
223
+ $[44] = t15;
224
+ $[45] = t16;
225
+ $[46] = t17;
226
+ $[47] = t18;
227
+ $[48] = t19;
228
+ }
229
+ else {
230
+ t19 = $[48];
231
+ }
232
+ return t19;
233
+ }
234
+ function _temp3(day, index, self) {
235
+ return index === self.findIndex(d => d.getTime() === day.getTime());
236
+ }
237
+ function _temp2(config_0) {
238
+ return config_0.dates;
239
+ }
240
+ function _temp(config) {
241
+ return config.isDisabled;
80
242
  }
@@ -2,22 +2,66 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.decadeLabelFormatFn = exports.yearLabelFormatFn = void 0;
4
4
  exports.useDecade = useDecade;
5
- const react_1 = require("react");
5
+ const compiler_runtime_1 = require("react/compiler-runtime");
6
6
  const create_date_string_1 = require("../utils/create-date-string");
7
7
  const dayjs_utils_1 = require("../utils/dayjs-utils");
8
8
  const get_years_1 = require("../utils/get-years");
9
- const yearLabelFormatFn = (date) => (0, dayjs_utils_1.dayjsEnWithTz)(date).format("YYYY");
9
+ const yearLabelFormatFn = date => (0, dayjs_utils_1.dayjsEnWithTz)(date).format("YYYY");
10
10
  exports.yearLabelFormatFn = yearLabelFormatFn;
11
11
  const decadeLabelFormatFn = (start, end) => `${(0, dayjs_utils_1.dayjsEnWithTz)(start).format("YYYY")} \u2013 ${(0, dayjs_utils_1.dayjsEnWithTz)(end).format("YYYY")}`;
12
12
  exports.decadeLabelFormatFn = decadeLabelFormatFn;
13
- function useDecade({ yearLabelFormat = exports.yearLabelFormatFn, decadeLabelFormat = exports.decadeLabelFormatFn, year, }) {
14
- const { years, decadeLabel } = (0, react_1.useMemo)(() => {
13
+ function useDecade(t0) {
14
+ const $ = (0, compiler_runtime_1.c)(11);
15
+ const { yearLabelFormat: t1, decadeLabelFormat: t2, year } = t0;
16
+ const yearLabelFormat = t1 === undefined ? exports.yearLabelFormatFn : t1;
17
+ const decadeLabelFormat = t2 === undefined ? exports.decadeLabelFormatFn : t2;
18
+ let t3;
19
+ let t4;
20
+ if ($[0] !== decadeLabelFormat || $[1] !== year || $[2] !== yearLabelFormat) {
15
21
  const startYear = new Date((0, create_date_string_1.createDateString)(year - 4, 0));
16
22
  const endYear = new Date((0, create_date_string_1.createDateString)(year + 4, 0));
17
- return {
18
- years: (0, get_years_1.getYears)({ startYear, endYear, yearLabelFormat }),
19
- decadeLabel: decadeLabelFormat(startYear, endYear),
23
+ t3 = (0, get_years_1.getYears)({
24
+ startYear,
25
+ endYear,
26
+ yearLabelFormat
27
+ });
28
+ t4 = decadeLabelFormat(startYear, endYear);
29
+ $[0] = decadeLabelFormat;
30
+ $[1] = year;
31
+ $[2] = yearLabelFormat;
32
+ $[3] = t3;
33
+ $[4] = t4;
34
+ }
35
+ else {
36
+ t3 = $[3];
37
+ t4 = $[4];
38
+ }
39
+ let t5;
40
+ if ($[5] !== t3 || $[6] !== t4) {
41
+ t5 = {
42
+ years: t3,
43
+ decadeLabel: t4
20
44
  };
21
- }, [year, yearLabelFormat, decadeLabelFormat]);
22
- return { years, decadeLabel };
45
+ $[5] = t3;
46
+ $[6] = t4;
47
+ $[7] = t5;
48
+ }
49
+ else {
50
+ t5 = $[7];
51
+ }
52
+ const { years, decadeLabel } = t5;
53
+ let t6;
54
+ if ($[8] !== decadeLabel || $[9] !== years) {
55
+ t6 = {
56
+ years,
57
+ decadeLabel
58
+ };
59
+ $[8] = decadeLabel;
60
+ $[9] = years;
61
+ $[10] = t6;
62
+ }
63
+ else {
64
+ t6 = $[10];
65
+ }
66
+ return t6;
23
67
  }
package/hooks/use-hour.js CHANGED
@@ -1,39 +1,108 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useHour = useHour;
4
+ const compiler_runtime_1 = require("react/compiler-runtime");
4
5
  const react_1 = require("react");
5
- function useHour({ hour, hourRef, focusedHour, isHourFocused, isHourSelected, onHourFocus, onHourSelect, preventScroll, }) {
6
- const onClick = (0, react_1.useCallback)(() => onHourSelect(hour), [hour, onHourSelect]);
7
- (0, react_1.useEffect)(() => {
8
- if (hourRef && hourRef.current && isHourFocused(hour)) {
9
- hourRef.current.focus({
10
- preventScroll,
11
- });
12
- }
13
- }, [hourRef, hour, isHourFocused, preventScroll]);
14
- const onKeyDown = (0, react_1.useCallback)((e) => {
15
- if (["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"].includes(e.key)) {
16
- e.preventDefault();
17
- switch (e.key) {
18
- case "ArrowRight":
19
- onHourFocus(hour + 1);
20
- break;
21
- case "ArrowLeft":
22
- onHourFocus(hour - 1);
23
- break;
24
- case "ArrowUp":
25
- onHourFocus(hour - 4);
26
- break;
27
- case "ArrowDown":
28
- onHourFocus(hour + 4);
29
- break;
6
+ function useHour(t0) {
7
+ const $ = (0, compiler_runtime_1.c)(20);
8
+ const { hour, hourRef, focusedHour, isHourFocused, isHourSelected, onHourFocus, onHourSelect, preventScroll } = t0;
9
+ let t1;
10
+ if ($[0] !== hour || $[1] !== onHourSelect) {
11
+ t1 = () => onHourSelect(hour);
12
+ $[0] = hour;
13
+ $[1] = onHourSelect;
14
+ $[2] = t1;
15
+ }
16
+ else {
17
+ t1 = $[2];
18
+ }
19
+ const onClick = t1;
20
+ let t2;
21
+ let t3;
22
+ if ($[3] !== hour || $[4] !== hourRef || $[5] !== isHourFocused || $[6] !== preventScroll) {
23
+ t2 = () => {
24
+ if (hourRef && hourRef.current && isHourFocused(hour)) {
25
+ hourRef.current.focus({
26
+ preventScroll
27
+ });
30
28
  }
31
- }
32
- }, [hour, onHourFocus]);
33
- return {
34
- isSelected: isHourSelected(hour),
35
- onClick: onClick,
36
- onKeyDown,
37
- tabIndex: focusedHour === null || isHourFocused(hour) ? 0 : -1,
38
- };
29
+ };
30
+ t3 = [hourRef, hour, isHourFocused, preventScroll];
31
+ $[3] = hour;
32
+ $[4] = hourRef;
33
+ $[5] = isHourFocused;
34
+ $[6] = preventScroll;
35
+ $[7] = t2;
36
+ $[8] = t3;
37
+ }
38
+ else {
39
+ t2 = $[7];
40
+ t3 = $[8];
41
+ }
42
+ (0, react_1.useEffect)(t2, t3);
43
+ let t4;
44
+ if ($[9] !== hour || $[10] !== onHourFocus) {
45
+ t4 = e => {
46
+ if (["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"].includes(e.key)) {
47
+ e.preventDefault();
48
+ bb17: switch (e.key) {
49
+ case "ArrowRight":
50
+ {
51
+ onHourFocus(hour + 1);
52
+ break bb17;
53
+ }
54
+ case "ArrowLeft":
55
+ {
56
+ onHourFocus(hour - 1);
57
+ break bb17;
58
+ }
59
+ case "ArrowUp":
60
+ {
61
+ onHourFocus(hour - 4);
62
+ break bb17;
63
+ }
64
+ case "ArrowDown":
65
+ {
66
+ onHourFocus(hour + 4);
67
+ }
68
+ }
69
+ }
70
+ };
71
+ $[9] = hour;
72
+ $[10] = onHourFocus;
73
+ $[11] = t4;
74
+ }
75
+ else {
76
+ t4 = $[11];
77
+ }
78
+ const onKeyDown = t4;
79
+ let t5;
80
+ if ($[12] !== hour || $[13] !== isHourSelected) {
81
+ t5 = isHourSelected(hour);
82
+ $[12] = hour;
83
+ $[13] = isHourSelected;
84
+ $[14] = t5;
85
+ }
86
+ else {
87
+ t5 = $[14];
88
+ }
89
+ const t6 = focusedHour === null || isHourFocused(hour) ? 0 : -1;
90
+ let t7;
91
+ if ($[15] !== onClick || $[16] !== onKeyDown || $[17] !== t5 || $[18] !== t6) {
92
+ t7 = {
93
+ isSelected: t5,
94
+ onClick,
95
+ onKeyDown,
96
+ tabIndex: t6
97
+ };
98
+ $[15] = onClick;
99
+ $[16] = onKeyDown;
100
+ $[17] = t5;
101
+ $[18] = t6;
102
+ $[19] = t7;
103
+ }
104
+ else {
105
+ t7 = $[19];
106
+ }
107
+ return t7;
39
108
  }
@@ -2,14 +2,36 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.labelFormatFn = void 0;
4
4
  exports.useHours = useHours;
5
- const react_1 = require("react");
6
- const labelFormatFn = (hour) => hour.toString().padStart(2, "0");
5
+ const compiler_runtime_1 = require("react/compiler-runtime");
6
+ const labelFormatFn = hour => hour.toString().padStart(2, "0");
7
7
  exports.labelFormatFn = labelFormatFn;
8
- function useHours({ labelFormat = exports.labelFormatFn }) {
9
- const hours = (0, react_1.useMemo)(() => Array(24)
10
- .fill(0)
11
- .map((_, i) => ({ value: i, label: labelFormat(i) })), [labelFormat]);
12
- return {
13
- hours,
14
- };
8
+ function useHours(t0) {
9
+ const $ = (0, compiler_runtime_1.c)(4);
10
+ const { labelFormat: t1 } = t0;
11
+ const labelFormat = t1 === undefined ? exports.labelFormatFn : t1;
12
+ let t2;
13
+ if ($[0] !== labelFormat) {
14
+ t2 = Array(24).fill(0).map((_, i) => ({
15
+ value: i,
16
+ label: labelFormat(i)
17
+ }));
18
+ $[0] = labelFormat;
19
+ $[1] = t2;
20
+ }
21
+ else {
22
+ t2 = $[1];
23
+ }
24
+ const hours = t2;
25
+ let t3;
26
+ if ($[2] !== hours) {
27
+ t3 = {
28
+ hours
29
+ };
30
+ $[2] = hours;
31
+ $[3] = t3;
32
+ }
33
+ else {
34
+ t3 = $[3];
35
+ }
36
+ return t3;
15
37
  }