@entur/datepicker 11.2.1-beta.9 → 11.2.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.
@@ -0,0 +1,1243 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const utils = require("@entur/utils");
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const React = require("react");
6
+ const datepicker$1 = require("@react-stately/datepicker");
7
+ const datepicker = require("@react-aria/datepicker");
8
+ const i18n = require("@react-aria/i18n");
9
+ const classNames = require("classnames");
10
+ const form = require("@entur/form");
11
+ const date = require("@internationalized/date");
12
+ const calendar = require("@react-aria/calendar");
13
+ const calendar$1 = require("@react-stately/calendar");
14
+ const icons = require("@entur/icons");
15
+ const button = require("@react-aria/button");
16
+ const button$1 = require("@entur/button");
17
+ const a11y = require("@entur/a11y");
18
+ const reactDom = require("@floating-ui/react-dom");
19
+ const FocusLock = require("react-focus-lock");
20
+ const tokens = require("@entur/tokens");
21
+ const modal = require("@entur/modal");
22
+ const FieldSegment = ({ segment, state, ...rest }) => {
23
+ const ref = React.useRef(null);
24
+ const { segmentProps } = datepicker.useDateSegment(segment, state, ref);
25
+ return /* @__PURE__ */ jsxRuntime.jsx(
26
+ "div",
27
+ {
28
+ ...segmentProps,
29
+ ref,
30
+ className: classNames("eds-date-and-time-field__segment", {
31
+ "eds-date-and-time-field__segment--placeholder": segment.isPlaceholder,
32
+ "eds-date-and-time-field__segment--dot-separator": segment.text === "." || segment.text === ":"
33
+ }),
34
+ tabIndex: state.isDisabled ? -1 : segmentProps.tabIndex,
35
+ ...rest,
36
+ children: segment.text
37
+ }
38
+ );
39
+ };
40
+ const nativeDateToDateTime = (date$1, timeZone, offset) => {
41
+ if (timeZone) {
42
+ if (offset) {
43
+ return new date.ZonedDateTime(
44
+ date$1.getFullYear(),
45
+ date$1.getMonth() + 1,
46
+ date$1.getDate(),
47
+ timeZone,
48
+ offset,
49
+ date$1.getHours(),
50
+ date$1.getMinutes(),
51
+ date$1.getSeconds(),
52
+ date$1.getMilliseconds()
53
+ );
54
+ }
55
+ return date.parseAbsolute(date$1.toISOString(), timeZone);
56
+ }
57
+ return new date.CalendarDateTime(
58
+ date$1.getFullYear(),
59
+ date$1.getMonth() + 1,
60
+ date$1.getDate(),
61
+ date$1.getHours(),
62
+ date$1.getMinutes(),
63
+ date$1.getSeconds(),
64
+ date$1.getMilliseconds()
65
+ );
66
+ };
67
+ function nativeDateToDateValue(date$1, noTimeOnlyDate = false, timeZone, offset) {
68
+ if (date$1 === null) return null;
69
+ if (noTimeOnlyDate)
70
+ return new date.CalendarDate(
71
+ date$1.getFullYear(),
72
+ date$1.getMonth() + 1,
73
+ date$1.getDate()
74
+ );
75
+ return nativeDateToDateTime(date$1, timeZone, offset);
76
+ }
77
+ function nativeDateToTimeValue(date$1, noDateOnlyTime = false, timeZone, offset) {
78
+ if (date$1 === null) return null;
79
+ if (noDateOnlyTime)
80
+ return new date.Time(
81
+ date$1.getHours(),
82
+ date$1.getMinutes(),
83
+ date$1.getSeconds(),
84
+ date$1.getMilliseconds()
85
+ );
86
+ return nativeDateToDateTime(date$1, timeZone, offset);
87
+ }
88
+ function timeOrDateValueToNativeDate(value, timeZoneForCalendarDateTime) {
89
+ if (value === null) return null;
90
+ if (!("day" in value)) {
91
+ const date2 = /* @__PURE__ */ new Date();
92
+ date2.setHours(value.hour);
93
+ date2.setMinutes(value.minute);
94
+ date2.setSeconds(value.second);
95
+ date2.setMilliseconds(value.millisecond);
96
+ return date2;
97
+ }
98
+ if (!("hour" in value)) {
99
+ return value.toDate(timeZoneForCalendarDateTime ?? date.getLocalTimeZone());
100
+ }
101
+ if (!("timeZone" in value)) {
102
+ if (timeZoneForCalendarDateTime)
103
+ return value.toDate(timeZoneForCalendarDateTime);
104
+ return value.toDate(date.getLocalTimeZone());
105
+ }
106
+ return value.toDate();
107
+ }
108
+ const createCalendar = (identifier = "gregory") => {
109
+ switch (identifier) {
110
+ case "gregory":
111
+ return new date.GregorianCalendar();
112
+ default:
113
+ throw new Error(`Unsupported calendar ${identifier}`);
114
+ }
115
+ };
116
+ const ariaLabelIfNorwegian = (norwegianAriaLabel, locale, propsCollection) => {
117
+ if (locale.toLowerCase() !== "no-no") return propsCollection["aria-label"];
118
+ return norwegianAriaLabel;
119
+ };
120
+ const lastMillisecondOfDay = (dateValue) => date.toCalendarDateTime(dateValue.add({ days: 1 })).add({
121
+ milliseconds: -1
122
+ });
123
+ const convertValueToType = ({
124
+ value,
125
+ type,
126
+ timezone = "Europe/Oslo"
127
+ }) => {
128
+ if (value === null) return null;
129
+ switch (type) {
130
+ case "CalendarDate":
131
+ if (!("day" in value)) return date.today(timezone);
132
+ return date.toCalendarDate(value);
133
+ case "CalendarDateTime":
134
+ if (!("day" in value)) return date.toCalendarDateTime(date.today(timezone), value);
135
+ return date.toCalendarDateTime(value);
136
+ case "ZonedDateTime":
137
+ if (!("day" in value))
138
+ return date.toZoned(date.toCalendarDateTime(date.today(timezone), value), timezone);
139
+ return date.toZoned(value, timezone);
140
+ case "Time":
141
+ if (!("hour" in value)) return date.toTime(date.now(timezone));
142
+ if (!("day" in value)) return value;
143
+ return date.toTime(value);
144
+ default:
145
+ return value;
146
+ }
147
+ };
148
+ const modulo = (a, b) => (a % b + b) % b;
149
+ const focusSegment = (ref, segment) => {
150
+ if (ref.current) {
151
+ const segments = ref.current.querySelectorAll(
152
+ ".eds-date-and-time-field__segment"
153
+ );
154
+ const firstSegment = segments[0];
155
+ const lastSegment = segments[segments.length - 1];
156
+ switch (segment) {
157
+ case "first":
158
+ return firstSegment.focus();
159
+ case "last":
160
+ return lastSegment.focus();
161
+ }
162
+ }
163
+ };
164
+ function getWeekNumberForDate(date$1) {
165
+ if (date$1 === null) return -1;
166
+ const calendarDate = convertValueToType({
167
+ value: date$1,
168
+ type: "CalendarDate"
169
+ });
170
+ const firstDayOfWeek = date.startOfWeek(calendarDate, "no-NO");
171
+ const thursdayOfWeek = firstDayOfWeek.add({ days: 3 });
172
+ const firstDayOfYearForThursday = date.startOfYear(thursdayOfWeek);
173
+ const weekNumber = Math.ceil(
174
+ (thursdayOfWeek.compare(firstDayOfYearForThursday) + 1) / 7
175
+ );
176
+ return weekNumber;
177
+ }
178
+ function handleOnChange({
179
+ value,
180
+ selectedDate,
181
+ forcedReturnType,
182
+ onChange
183
+ }) {
184
+ if (forcedReturnType !== void 0 || !selectedDate) {
185
+ return onChange?.(
186
+ convertValueToType({
187
+ value,
188
+ type: forcedReturnType ?? "ZonedDateTime",
189
+ timezone: value !== null && "timezone" in value ? value.timezone : void 0
190
+ })
191
+ );
192
+ }
193
+ onChange?.(value);
194
+ }
195
+ const DateField = ({
196
+ selectedDate,
197
+ onChange,
198
+ label,
199
+ locale: customLocale,
200
+ showTimeZone,
201
+ showTime,
202
+ granularity = showTime ? "minute" : "day",
203
+ disabled,
204
+ readOnly,
205
+ isDisabled,
206
+ variant,
207
+ feedback,
208
+ validationVariant = "negative",
209
+ validationFeedback = "Ugyldig dato",
210
+ labelTooltip,
211
+ minDate,
212
+ maxDate,
213
+ forcedReturnType,
214
+ style,
215
+ className,
216
+ labelProps: parentLabelProps,
217
+ append,
218
+ prepend,
219
+ onValidate,
220
+ dateFieldRef: ref,
221
+ ...rest
222
+ }) => {
223
+ const { locale } = i18n.useLocale();
224
+ const _props = {
225
+ ...rest,
226
+ label,
227
+ locale: customLocale ?? locale,
228
+ createCalendar,
229
+ value: selectedDate,
230
+ onChange: (value) => handleOnChange({
231
+ value,
232
+ selectedDate,
233
+ forcedReturnType,
234
+ onChange
235
+ }),
236
+ hideTimeZone: !showTimeZone,
237
+ granularity,
238
+ minValue: minDate,
239
+ // this weird logic makes sure the entire day is included if no time is provided in maxDate
240
+ maxValue: "hour" in (maxDate ?? {}) ? maxDate : maxDate !== void 0 ? lastMillisecondOfDay(maxDate) : void 0,
241
+ isDisabled: isDisabled || disabled || readOnly,
242
+ shouldForceLeadingZeros: true
243
+ };
244
+ const state = datepicker$1.useDateFieldState(_props);
245
+ const dateFieldRef = React.useRef(null);
246
+ const { labelProps, fieldProps } = datepicker.useDateField(_props, state, dateFieldRef);
247
+ React.useEffect(() => onValidate?.(!state.isInvalid), [state.isInvalid]);
248
+ const id = utils.useRandomId("datefield");
249
+ return /* @__PURE__ */ jsxRuntime.jsx(
250
+ utils.ConditionalWrapper,
251
+ {
252
+ condition: customLocale !== void 0,
253
+ wrapper: (child) => /* @__PURE__ */ jsxRuntime.jsx(i18n.I18nProvider, { locale: customLocale, children: child }),
254
+ children: /* @__PURE__ */ jsxRuntime.jsx(
255
+ form.BaseFormControl,
256
+ {
257
+ append,
258
+ ariaAlertOnFeedback: true,
259
+ className: classNames("eds-datefield", className, {
260
+ "eds-datefield--has-tooltip": labelTooltip !== void 0
261
+ }),
262
+ disabled: isDisabled || disabled,
263
+ readOnly,
264
+ disableLabelAnimation: true,
265
+ feedback: feedback ?? (state.validationState === "invalid" ? validationFeedback : void 0),
266
+ label,
267
+ labelId: id,
268
+ labelProps: parentLabelProps ?? labelProps,
269
+ labelTooltip,
270
+ prepend,
271
+ ref: utils.mergeRefs(ref, dateFieldRef),
272
+ style,
273
+ variant: variant ?? (state.isInvalid ? validationVariant : void 0),
274
+ ...fieldProps,
275
+ children: state.segments.map((segment, i) => /* @__PURE__ */ jsxRuntime.jsx(FieldSegment, { segment, state }, i))
276
+ }
277
+ )
278
+ }
279
+ );
280
+ };
281
+ const CalendarButton = ({
282
+ children,
283
+ className,
284
+ style,
285
+ ...props
286
+ }) => {
287
+ const ref = React.useRef(null);
288
+ const { buttonProps } = button.useButton(props, ref);
289
+ return /* @__PURE__ */ jsxRuntime.jsx(button$1.IconButton, { ...buttonProps, ref, className, style, children });
290
+ };
291
+ const CalendarCell = ({
292
+ state,
293
+ date: date$1,
294
+ onSelectedCellClick = () => {
295
+ return;
296
+ },
297
+ onCellClick = () => {
298
+ return;
299
+ },
300
+ weekNumberString,
301
+ classNameForDate,
302
+ ariaLabelForDate,
303
+ ...rest
304
+ }) => {
305
+ const cellRef = React.useRef(null);
306
+ const {
307
+ cellProps,
308
+ buttonProps,
309
+ isSelected,
310
+ isOutsideVisibleRange,
311
+ isDisabled,
312
+ isUnavailable,
313
+ formattedDate
314
+ } = calendar.useCalendarCell({ date: date$1 }, state, cellRef);
315
+ const ariaLabel = `${buttonProps["aria-label"]}${weekNumberString} ${ariaLabelForDate?.(date$1) ?? ""}`;
316
+ const cellCanBeSelected = !(isOutsideVisibleRange || isDisabled || isUnavailable);
317
+ return /* @__PURE__ */ jsxRuntime.jsx("td", { ...cellProps, className: "eds-datepicker__calendar__grid__cell__td", children: /* @__PURE__ */ jsxRuntime.jsx(
318
+ "div",
319
+ {
320
+ ...buttonProps,
321
+ "aria-label": ariaLabel,
322
+ "aria-hidden": isOutsideVisibleRange,
323
+ ref: cellRef,
324
+ hidden: isOutsideVisibleRange,
325
+ className: classNames("eds-datepicker__calendar__grid__cell", {
326
+ [classNameForDate?.(date$1) ?? ""]: !isOutsideVisibleRange,
327
+ "eds-datepicker__calendar__grid__cell--selected": isSelected,
328
+ "eds-datepicker__calendar__grid__cell--disabled": isDisabled || isUnavailable,
329
+ "eds-datepicker__calendar__grid__cell--outside-month": isOutsideVisibleRange,
330
+ "eds-datepicker__calendar__grid__cell--today": date.isEqualDay(
331
+ date$1,
332
+ date.now(state.timeZone ?? date.getLocalTimeZone())
333
+ )
334
+ }),
335
+ ...rest,
336
+ onClick: (e) => {
337
+ buttonProps.onClick && buttonProps.onClick(e);
338
+ isSelected && onSelectedCellClick();
339
+ cellCanBeSelected && onCellClick();
340
+ },
341
+ onKeyUp: (e) => {
342
+ buttonProps.onKeyUp && buttonProps.onKeyUp(e);
343
+ if (e.key === "Enter") {
344
+ isSelected && onSelectedCellClick();
345
+ cellCanBeSelected && onCellClick();
346
+ }
347
+ },
348
+ children: formattedDate
349
+ }
350
+ ) });
351
+ };
352
+ const CalendarGrid = ({
353
+ state,
354
+ navigationDescription,
355
+ onSelectedCellClick = () => {
356
+ return;
357
+ },
358
+ onCellClick = () => {
359
+ return;
360
+ },
361
+ showWeekNumbers,
362
+ weekNumberHeader,
363
+ classNameForDate,
364
+ ariaLabelForDate,
365
+ ...rest
366
+ }) => {
367
+ const calendarGridId = utils.useRandomId("eds-calendar");
368
+ const { locale } = i18n.useLocale();
369
+ const { gridProps, headerProps, weekDays } = calendar.useCalendarGrid(rest, state);
370
+ const weeksInMonth = date.getWeeksInMonth(state.visibleRange.start, locale);
371
+ const weeksArray = Array.from(Array(weeksInMonth).keys());
372
+ const weekDaysMapped = () => {
373
+ if (locale.toLowerCase().includes("no"))
374
+ return ["ma", "ti", "on", "to", "fr", "lø", "sø"];
375
+ if (locale.toLowerCase().includes("en")) {
376
+ if (weekDays[0] === "M")
377
+ return ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"];
378
+ if (weekDays[0] === "S")
379
+ return ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
380
+ }
381
+ return weekDays.map((day) => day.toLowerCase());
382
+ };
383
+ const getNavigationDescription = () => {
384
+ if (navigationDescription) return navigationDescription;
385
+ if (locale.toLowerCase().includes("en"))
386
+ return "Use the arrow keys to navigate between dates";
387
+ return "Bruk piltastene til å navigere mellom datoer";
388
+ };
389
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
390
+ /* @__PURE__ */ jsxRuntime.jsxs(
391
+ "table",
392
+ {
393
+ ...gridProps,
394
+ cellSpacing: "0",
395
+ className: "eds-datepicker__calendar__grid",
396
+ children: [
397
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { ...headerProps, children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
398
+ showWeekNumbers && /* @__PURE__ */ jsxRuntime.jsx("th", { className: "eds-datepicker__calendar__grid__weeknumber-header", children: weekNumberHeader }),
399
+ weekDaysMapped().map((day) => /* @__PURE__ */ jsxRuntime.jsx("th", { children: day }, day))
400
+ ] }) }),
401
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: weeksArray.map((weekIndex) => {
402
+ const weekNumber = getWeekNumberForDate(
403
+ state.getDatesInWeek(weekIndex)[0]
404
+ );
405
+ return /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
406
+ showWeekNumbers && /* @__PURE__ */ jsxRuntime.jsx(
407
+ "th",
408
+ {
409
+ "aria-hidden": true,
410
+ className: "eds-datepicker__calendar__grid__weeknumber",
411
+ children: weekNumber
412
+ }
413
+ ),
414
+ state.getDatesInWeek(weekIndex).map(
415
+ (date2, i) => date2 ? /* @__PURE__ */ jsxRuntime.jsx(
416
+ CalendarCell,
417
+ {
418
+ state,
419
+ date: date2,
420
+ "aria-describedby": calendarGridId + "description",
421
+ weekNumberString: showWeekNumbers ? `, ${weekNumberHeader} ${weekNumber},` : "",
422
+ onSelectedCellClick,
423
+ onCellClick,
424
+ classNameForDate,
425
+ ariaLabelForDate
426
+ },
427
+ `${date2.month}.${date2.day}`
428
+ ) : /* @__PURE__ */ jsxRuntime.jsx("td", {}, i)
429
+ )
430
+ ] }, weekIndex);
431
+ }) })
432
+ ]
433
+ }
434
+ ),
435
+ /* @__PURE__ */ jsxRuntime.jsx(a11y.VisuallyHidden, { id: calendarGridId + "description", children: getNavigationDescription() })
436
+ ] });
437
+ };
438
+ const Calendar = ({
439
+ locale: localOverride,
440
+ ...rest
441
+ }) => {
442
+ const props = { isDisabled: rest.disabled, ...rest };
443
+ const { locale } = i18n.useLocale();
444
+ return /* @__PURE__ */ jsxRuntime.jsx(i18n.I18nProvider, { locale: localOverride ?? locale, children: /* @__PURE__ */ jsxRuntime.jsx(CalendarBase, { ...props }) });
445
+ };
446
+ const CalendarBase = ({
447
+ selectedDate,
448
+ onChange,
449
+ minDate,
450
+ maxDate,
451
+ showWeekNumbers = false,
452
+ weekNumberHeader = "uke",
453
+ forcedReturnType,
454
+ style,
455
+ className,
456
+ navigationDescription,
457
+ onSelectedCellClick = () => {
458
+ return;
459
+ },
460
+ onCellClick = () => {
461
+ return;
462
+ },
463
+ classNameForDate,
464
+ ariaLabelForDate,
465
+ calendarRef,
466
+ ...rest
467
+ }) => {
468
+ const { locale } = i18n.useLocale();
469
+ const _props = {
470
+ ...rest,
471
+ value: selectedDate,
472
+ onChange: (value) => handleOnChange({
473
+ value,
474
+ selectedDate,
475
+ forcedReturnType,
476
+ onChange
477
+ }),
478
+ locale,
479
+ createCalendar,
480
+ minValue: minDate,
481
+ maxValue: maxDate
482
+ };
483
+ const state = calendar$1.useCalendarState(_props);
484
+ const { calendarProps, prevButtonProps, nextButtonProps, title } = calendar.useCalendar(_props, state);
485
+ React.useEffect(
486
+ () => rest.onValidate?.(!state.isValueInvalid),
487
+ [state.isValueInvalid]
488
+ );
489
+ return /* @__PURE__ */ jsxRuntime.jsxs(
490
+ "div",
491
+ {
492
+ ...calendarProps,
493
+ ref: calendarRef,
494
+ className: classNames("eds-datepicker__calendar", className),
495
+ style,
496
+ children: [
497
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "eds-datepicker__calendar__header", children: [
498
+ /* @__PURE__ */ jsxRuntime.jsx(
499
+ CalendarButton,
500
+ {
501
+ ...prevButtonProps,
502
+ "aria-label": ariaLabelIfNorwegian(
503
+ "Forrige måned",
504
+ locale,
505
+ prevButtonProps
506
+ ),
507
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.LeftArrowIcon, { size: 20 })
508
+ }
509
+ ),
510
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { children: title }),
511
+ /* @__PURE__ */ jsxRuntime.jsx(
512
+ CalendarButton,
513
+ {
514
+ ...nextButtonProps,
515
+ "aria-label": ariaLabelIfNorwegian(
516
+ "Neste måned",
517
+ locale,
518
+ nextButtonProps
519
+ ),
520
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.RightArrowIcon, { size: 20 })
521
+ }
522
+ )
523
+ ] }),
524
+ /* @__PURE__ */ jsxRuntime.jsx(
525
+ CalendarGrid,
526
+ {
527
+ ...rest,
528
+ state,
529
+ navigationDescription,
530
+ onSelectedCellClick,
531
+ onCellClick,
532
+ classNameForDate,
533
+ ariaLabelForDate,
534
+ showWeekNumbers,
535
+ weekNumberHeader
536
+ }
537
+ )
538
+ ]
539
+ }
540
+ );
541
+ };
542
+ const DatePicker = ({
543
+ selectedDate,
544
+ locale,
545
+ disabled,
546
+ readOnly,
547
+ showTime,
548
+ showTimeZone = false,
549
+ classNameForDate,
550
+ className,
551
+ variant,
552
+ feedback,
553
+ validationVariant,
554
+ validationFeedback,
555
+ showWeekNumbers,
556
+ weekNumberHeader,
557
+ disableModal = false,
558
+ labelTooltip,
559
+ navigationDescription,
560
+ minDate,
561
+ maxDate,
562
+ modalTreshold = 1e3,
563
+ ariaLabelForDate,
564
+ append,
565
+ prepend,
566
+ granularity = showTime ? "minute" : "day",
567
+ ...rest
568
+ }) => {
569
+ const CALENDAR_MODAL_MAX_SCREEN_WIDTH = modalTreshold;
570
+ const datePickerRef = React.useRef(null);
571
+ const calendarRef = React.useRef(null);
572
+ const { width } = utils.useWindowDimensions();
573
+ const _props = {
574
+ ...rest,
575
+ onChange: (value) => handleOnChange({
576
+ value,
577
+ selectedDate,
578
+ forcedReturnType: rest.forcedReturnType,
579
+ onChange: rest.onChange
580
+ }),
581
+ minValue: minDate,
582
+ // this weird logic makes sure the entire day is included if no time is provided in maxDate
583
+ maxValue: "hour" in (maxDate ?? {}) ? maxDate : maxDate !== void 0 ? lastMillisecondOfDay(maxDate) : void 0,
584
+ value: selectedDate,
585
+ granularity,
586
+ isDisabled: disabled || readOnly
587
+ };
588
+ const state = datepicker$1.useDatePickerState(_props);
589
+ const {
590
+ groupProps,
591
+ labelProps,
592
+ fieldProps,
593
+ buttonProps,
594
+ dialogProps,
595
+ calendarProps
596
+ } = datepicker.useDatePicker(_props, state, datePickerRef);
597
+ const { refs, floatingStyles, update } = reactDom.useFloating({
598
+ whileElementsMounted: (ref, float, update2) => reactDom.autoUpdate(ref, float, update2, { elementResize: false }),
599
+ placement: "bottom-start",
600
+ middleware: [
601
+ reactDom.offset(tokens.space.extraSmall2),
602
+ reactDom.flip(),
603
+ reactDom.shift({ padding: tokens.space.extraSmall })
604
+ ]
605
+ });
606
+ utils.useOnClickOutside([calendarRef], () => state.setOpen(false));
607
+ utils.useOnEscape(calendarRef, () => state.setOpen(false));
608
+ const calendarSharedProps = {
609
+ ...dialogProps,
610
+ ...calendarProps,
611
+ // We don't use handleOnChange here since it's handled internally by Calendar
612
+ onChange: rest.onChange,
613
+ forcedReturnType: rest.forcedReturnType,
614
+ disabled,
615
+ navigationDescription,
616
+ onSelectedCellClick: () => state.setOpen(false),
617
+ // onCellClick is a temporary fix solving an issue where the
618
+ // calendar sometimes doesn't close on date selection
619
+ onCellClick: () => state.setOpen(false),
620
+ selectedDate,
621
+ minDate,
622
+ maxDate,
623
+ calendarRef,
624
+ classNameForDate,
625
+ ariaLabelForDate,
626
+ showWeekNumbers,
627
+ weekNumberHeader
628
+ };
629
+ const isModal = typeof width !== "undefined" && width <= CALENDAR_MODAL_MAX_SCREEN_WIDTH && !disableModal;
630
+ const popoverCalendar = /* @__PURE__ */ jsxRuntime.jsx(
631
+ "div",
632
+ {
633
+ style: { ...floatingStyles, zIndex: tokens.zIndexes.popover },
634
+ ref: refs.setFloating,
635
+ children: /* @__PURE__ */ jsxRuntime.jsx(FocusLock, { disabled: !state.isOpen || isModal, returnFocus: true, children: state.isOpen && /* @__PURE__ */ jsxRuntime.jsx(Calendar, { ...calendarSharedProps }) })
636
+ }
637
+ );
638
+ const modalCalendar = /* @__PURE__ */ jsxRuntime.jsx(
639
+ modal.Modal,
640
+ {
641
+ size: "small",
642
+ title: "",
643
+ open: state.isOpen,
644
+ onDismiss: () => state.setOpen(false),
645
+ className: "eds-datepicker__calendar-modal",
646
+ children: /* @__PURE__ */ jsxRuntime.jsx(Calendar, { ...calendarSharedProps })
647
+ }
648
+ );
649
+ return /* @__PURE__ */ jsxRuntime.jsxs(
650
+ utils.ConditionalWrapper,
651
+ {
652
+ condition: locale !== void 0,
653
+ wrapper: (child) => /* @__PURE__ */ jsxRuntime.jsx(i18n.I18nProvider, { locale, children: child }),
654
+ children: [
655
+ /* @__PURE__ */ jsxRuntime.jsx(
656
+ DateField,
657
+ {
658
+ ...groupProps,
659
+ ...fieldProps,
660
+ ...rest,
661
+ append: !disabled && !readOnly && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [
662
+ append,
663
+ /* @__PURE__ */ jsxRuntime.jsx(
664
+ CalendarButton,
665
+ {
666
+ ...buttonProps,
667
+ onPress: () => {
668
+ state.setOpen(!state.isOpen);
669
+ update();
670
+ },
671
+ className: "eds-datepicker__open-calendar-button",
672
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.CalendarIcon, {})
673
+ }
674
+ )
675
+ ] }),
676
+ prepend,
677
+ className: classNames("eds-datepicker", className, {
678
+ "eds-datepicker--disabled": disabled
679
+ }),
680
+ disabled,
681
+ readOnly,
682
+ feedback,
683
+ labelProps,
684
+ labelTooltip,
685
+ maxDate,
686
+ minDate,
687
+ dateFieldRef: (node) => {
688
+ refs.setReference(node);
689
+ datePickerRef.current = node;
690
+ },
691
+ selectedDate,
692
+ showTime,
693
+ showTimeZone,
694
+ validationFeedback,
695
+ validationVariant,
696
+ variant
697
+ }
698
+ ),
699
+ isModal ? modalCalendar : popoverCalendar
700
+ ]
701
+ }
702
+ );
703
+ };
704
+ const NativeDatePicker = React.forwardRef(
705
+ ({
706
+ className,
707
+ style,
708
+ label,
709
+ onChange,
710
+ feedback,
711
+ variant,
712
+ disableLabelAnimation,
713
+ prepend = /* @__PURE__ */ jsxRuntime.jsx(icons.DateIcon, { inline: true }),
714
+ ...rest
715
+ }, ref) => {
716
+ const nativedatepickerId = utils.useRandomId("eds-nativetimepicker");
717
+ return /* @__PURE__ */ jsxRuntime.jsx(
718
+ form.BaseFormControl,
719
+ {
720
+ style,
721
+ className,
722
+ prepend,
723
+ label,
724
+ feedback,
725
+ variant,
726
+ labelId: nativedatepickerId,
727
+ disableLabelAnimation,
728
+ isFilled: true,
729
+ children: /* @__PURE__ */ jsxRuntime.jsx(
730
+ NativeDatePickerBase,
731
+ {
732
+ onChange,
733
+ "aria-labelledby": nativedatepickerId,
734
+ ref,
735
+ variant,
736
+ ...rest
737
+ }
738
+ )
739
+ }
740
+ );
741
+ }
742
+ );
743
+ const NativeDatePickerBase = React.forwardRef(({ onChange, variant, value, ...rest }, ref) => {
744
+ const contextVariant = form.useVariant();
745
+ const currentVariant = variant || contextVariant;
746
+ const { isFilled: isDatepickerFilled, setFilled: setFiller } = form.useInputGroupContext();
747
+ utils.useOnMount(() => {
748
+ setFiller && !isDatepickerFilled && setFiller(true);
749
+ });
750
+ React.useEffect(() => {
751
+ if (value) {
752
+ setFiller && !isDatepickerFilled && setFiller(true);
753
+ } else {
754
+ setFiller && isDatepickerFilled && setFiller(false);
755
+ }
756
+ }, [value, setFiller, isDatepickerFilled]);
757
+ const handleChange = (event) => {
758
+ if (form.isFilled(event.target)) {
759
+ setFiller && !isDatepickerFilled && setFiller(true);
760
+ } else {
761
+ setFiller && isDatepickerFilled && setFiller(false);
762
+ }
763
+ if (onChange) {
764
+ onChange(event);
765
+ }
766
+ };
767
+ return /* @__PURE__ */ jsxRuntime.jsx(
768
+ "input",
769
+ {
770
+ ref,
771
+ "aria-invalid": currentVariant === "error",
772
+ type: "date",
773
+ className: "eds-form-control eds-native-date-picker",
774
+ onChange: handleChange,
775
+ value,
776
+ ...rest
777
+ }
778
+ );
779
+ });
780
+ const TimePickerArrowButton = ({
781
+ direction,
782
+ onClick,
783
+ disabled,
784
+ readonly,
785
+ "aria-label": ariaLabel,
786
+ ...rest
787
+ }) => {
788
+ return /* @__PURE__ */ jsxRuntime.jsx(
789
+ button$1.IconButton,
790
+ {
791
+ className: classNames(
792
+ "eds-timepicker__arrowbutton",
793
+ `eds-timepicker__arrowbutton--${direction}`,
794
+ { "eds-timepicker__arrowbutton--disabled": disabled }
795
+ ),
796
+ type: "button",
797
+ tabIndex: -1,
798
+ onClick,
799
+ "aria-label": ariaLabel,
800
+ disabled,
801
+ ...rest,
802
+ children: direction === "left" ? /* @__PURE__ */ jsxRuntime.jsx(icons.LeftArrowIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(icons.RightArrowIcon, {})
803
+ }
804
+ );
805
+ };
806
+ const TimePicker = ({
807
+ selectedTime,
808
+ onChange,
809
+ disabled,
810
+ readOnly,
811
+ className,
812
+ style,
813
+ label,
814
+ labelTooltip,
815
+ feedback,
816
+ granularity,
817
+ variant,
818
+ locale: customLocale,
819
+ showTimeZone,
820
+ showSeconds = false,
821
+ minuteIncrementForArrowButtons = 30,
822
+ leftArrowButtonAriaLabel = `Trekk fra ${minuteIncrementForArrowButtons} minutter`,
823
+ rightArrowButtonAriaLabel = `Legg til ${minuteIncrementForArrowButtons} minutter`,
824
+ inputRef,
825
+ forcedReturnType,
826
+ forcedTimeZone,
827
+ append,
828
+ prepend,
829
+ ...rest
830
+ }) => {
831
+ let { locale } = i18n.useLocale();
832
+ if (customLocale) locale = customLocale;
833
+ const timePickerId = utils.useRandomId("eds-timepicker");
834
+ const timeZone = forcedTimeZone ?? (selectedTime !== null && "timezone" in selectedTime ? selectedTime.timezone : "Europe/Oslo");
835
+ const handleOnChange2 = (value) => {
836
+ if (forcedReturnType !== void 0 || !selectedTime) {
837
+ return onChange(
838
+ convertValueToType({
839
+ value,
840
+ type: forcedReturnType ?? "ZonedDateTime",
841
+ timezone: timeZone
842
+ })
843
+ );
844
+ }
845
+ onChange(value);
846
+ };
847
+ const state = datepicker$1.useTimeFieldState({
848
+ onChange: handleOnChange2,
849
+ label,
850
+ locale,
851
+ value: selectedTime,
852
+ granularity: granularity ?? showSeconds ? "second" : "minute",
853
+ hideTimeZone: !showTimeZone,
854
+ isDisabled: disabled || readOnly,
855
+ shouldForceLeadingZeros: true,
856
+ ...rest
857
+ });
858
+ const timeFieldRef = React.useRef(null);
859
+ const { labelProps, fieldProps } = datepicker.useTimeField(
860
+ { ...rest, label },
861
+ state,
862
+ timeFieldRef
863
+ );
864
+ const id = utils.useRandomId("timepicker");
865
+ const getCurrentTime = () => {
866
+ const getCurrentTimeWithCorrectType = convertValueToType({
867
+ value: date.now(timeZone),
868
+ type: forcedReturnType ?? "ZonedDateTime"
869
+ });
870
+ return getCurrentTimeWithCorrectType;
871
+ };
872
+ const handleOnClickArrowButton = (operation) => {
873
+ if (selectedTime === null) return handleOnChange2(getCurrentTime());
874
+ switch (operation) {
875
+ case "add":
876
+ return handleOnChange2(
877
+ selectedTime.add({
878
+ minutes: minuteIncrementForArrowButtons - modulo(selectedTime.minute, minuteIncrementForArrowButtons)
879
+ })
880
+ );
881
+ case "subtract":
882
+ return handleOnChange2(
883
+ selectedTime.subtract({
884
+ minutes: modulo(selectedTime.minute - 1, minuteIncrementForArrowButtons) + 1
885
+ })
886
+ );
887
+ }
888
+ };
889
+ return /* @__PURE__ */ jsxRuntime.jsx(i18n.I18nProvider, { locale, children: /* @__PURE__ */ jsxRuntime.jsxs(
890
+ form.BaseFormControl,
891
+ {
892
+ append: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [
893
+ append,
894
+ /* @__PURE__ */ jsxRuntime.jsx(
895
+ TimePickerArrowButton,
896
+ {
897
+ direction: "right",
898
+ disabled: disabled || readOnly,
899
+ "aria-label": rightArrowButtonAriaLabel,
900
+ onClick: () => handleOnClickArrowButton("add"),
901
+ onFocus: () => focusSegment(timeFieldRef, "last")
902
+ }
903
+ )
904
+ ] }),
905
+ ariaAlertOnFeedback: true,
906
+ "aria-describedby": timePickerId + "description",
907
+ className: classNames("eds-timepicker", className, {
908
+ "eds-timepicker--disabled": disabled,
909
+ "eds-timepicker--has-tooltip": labelTooltip !== void 0,
910
+ "eds-timepicker--readonly": readOnly
911
+ }),
912
+ disabled,
913
+ readOnly,
914
+ disableLabelAnimation: true,
915
+ feedback,
916
+ label,
917
+ labelId: id,
918
+ labelProps: {
919
+ ...labelProps,
920
+ "aria-describedby": timePickerId + "description"
921
+ },
922
+ labelTooltip,
923
+ prepend: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [
924
+ /* @__PURE__ */ jsxRuntime.jsx(
925
+ TimePickerArrowButton,
926
+ {
927
+ direction: "left",
928
+ disabled: disabled || readOnly,
929
+ "aria-label": leftArrowButtonAriaLabel,
930
+ onClick: () => handleOnClickArrowButton("subtract"),
931
+ onFocus: () => focusSegment(timeFieldRef, "first")
932
+ }
933
+ ),
934
+ prepend
935
+ ] }),
936
+ ref: inputRef,
937
+ style,
938
+ variant,
939
+ children: [
940
+ /* @__PURE__ */ jsxRuntime.jsx(
941
+ "span",
942
+ {
943
+ ref: timeFieldRef,
944
+ ...fieldProps,
945
+ style: { display: "contents" },
946
+ children: state.segments.map((segment, i) => /* @__PURE__ */ jsxRuntime.jsx(
947
+ FieldSegment,
948
+ {
949
+ segment,
950
+ state,
951
+ "aria-describedby": timePickerId + "description"
952
+ },
953
+ i
954
+ ))
955
+ }
956
+ ),
957
+ /* @__PURE__ */ jsxRuntime.jsx(a11y.VisuallyHidden, { id: timePickerId + "description", children: selectedTime !== null ? "valgt tid: " + selectedTime.hour.toString().padStart(2, "0") + ":" + selectedTime.minute.toString().padStart(2, "0") + (showSeconds ? ":" + selectedTime.second.toString().padStart(2, "0") : "") : "" })
958
+ ]
959
+ }
960
+ ) });
961
+ };
962
+ const NativeTimePicker = React.forwardRef(
963
+ ({ className, style, onChange, label, feedback, variant, prepend, ...rest }, ref) => {
964
+ const nativetimepickerId = utils.useRandomId("eds-native-timepicker");
965
+ return /* @__PURE__ */ jsxRuntime.jsx(
966
+ form.BaseFormControl,
967
+ {
968
+ style,
969
+ className: classNames(className, "eds-native-timepicker"),
970
+ prepend,
971
+ label,
972
+ feedback,
973
+ variant,
974
+ labelId: nativetimepickerId,
975
+ disableLabelAnimation: true,
976
+ children: /* @__PURE__ */ jsxRuntime.jsx(
977
+ NativeTimePickerBase,
978
+ {
979
+ onChange,
980
+ "aria-labelledby": nativetimepickerId,
981
+ ref,
982
+ ...rest
983
+ }
984
+ )
985
+ }
986
+ );
987
+ }
988
+ );
989
+ const NativeTimePickerBase = React.forwardRef(({ onChange, value, ...rest }, ref) => {
990
+ const contextVariant = form.useVariant();
991
+ const currentVariant = rest.variant || contextVariant;
992
+ const { isFilled: isTimepickerFilled, setFilled: setFiller } = form.useInputGroupContext();
993
+ utils.useOnMount(() => {
994
+ setFiller && !isTimepickerFilled && setFiller(true);
995
+ });
996
+ React.useEffect(() => {
997
+ if (value) {
998
+ setFiller && !isTimepickerFilled && setFiller(true);
999
+ } else {
1000
+ setFiller && isTimepickerFilled && setFiller(false);
1001
+ }
1002
+ }, [value, setFiller, isTimepickerFilled]);
1003
+ const handleChange = (event) => {
1004
+ if (form.isFilled(event.target)) {
1005
+ setFiller && !isTimepickerFilled && setFiller(true);
1006
+ } else {
1007
+ setFiller && isTimepickerFilled && setFiller(false);
1008
+ }
1009
+ if (onChange) {
1010
+ onChange(event);
1011
+ }
1012
+ };
1013
+ return /* @__PURE__ */ jsxRuntime.jsx(
1014
+ "input",
1015
+ {
1016
+ ref,
1017
+ "aria-invalid": currentVariant === "error",
1018
+ type: "time",
1019
+ className: "eds-form-control",
1020
+ onChange: handleChange,
1021
+ value,
1022
+ ...rest
1023
+ }
1024
+ );
1025
+ });
1026
+ const SimpleTimePicker = ({
1027
+ append,
1028
+ className,
1029
+ disabled,
1030
+ feedback,
1031
+ showClockIcon = "right",
1032
+ inputRef,
1033
+ label,
1034
+ labelTooltip,
1035
+ onChange,
1036
+ padding = "default",
1037
+ prepend,
1038
+ readOnly,
1039
+ selectedTime,
1040
+ showSeconds,
1041
+ style,
1042
+ variant,
1043
+ ...rest
1044
+ }) => {
1045
+ const [inputText, setInputText] = React.useState("");
1046
+ const timeFieldRef = React.useRef(null);
1047
+ const [lastValidSelectedTime, setLastValidSelectedTime] = React.useState(null);
1048
+ const { locale } = i18n.useLocale();
1049
+ const state = datepicker$1.useTimeFieldState({
1050
+ onChange,
1051
+ label,
1052
+ locale,
1053
+ value: selectedTime,
1054
+ hideTimeZone: true,
1055
+ isDisabled: disabled,
1056
+ isReadOnly: readOnly,
1057
+ ...rest
1058
+ });
1059
+ const { labelProps, fieldProps } = datepicker.useTimeField(
1060
+ { ...rest, label },
1061
+ state,
1062
+ timeFieldRef
1063
+ );
1064
+ React.useEffect(() => {
1065
+ updateInputWithSelectedTime();
1066
+ if (selectedTime !== null) setLastValidSelectedTime(selectedTime);
1067
+ }, [selectedTime?.toString()]);
1068
+ const updateInputWithSelectedTime = () => {
1069
+ const selectedTimeString = getStringFromTimeValue(selectedTime);
1070
+ setInputText(selectedTimeString);
1071
+ const timeFieldIsFocused = document.activeElement === timeFieldRef?.current;
1072
+ if (selectedTimeString === "" && !timeFieldIsFocused)
1073
+ addPlaceholderToInput();
1074
+ };
1075
+ const getStringFromTimeValue = (timeValue) => {
1076
+ if (timeValue === null) return "";
1077
+ const timeObject = "day" in timeValue ? date.toTime(timeValue) : timeValue;
1078
+ if (showSeconds) return timeObject.toString().slice(0, 8);
1079
+ return timeObject.toString().slice(0, 5);
1080
+ };
1081
+ const addPlaceholderToInput = () => {
1082
+ if (showSeconds) setInputText("–– : –– : ––");
1083
+ else setInputText("–– : ––");
1084
+ };
1085
+ const handleChangeTime = () => {
1086
+ const newTime = getValueForOnChangeFromInput();
1087
+ if (newTime === 1) {
1088
+ return updateInputWithSelectedTime();
1089
+ }
1090
+ if (newTime?.toString() !== selectedTime?.toString()) onChange?.(newTime);
1091
+ };
1092
+ const getValueForOnChangeFromInput = () => {
1093
+ const formatedTimeString = formatTimeString(inputText);
1094
+ const newTimeObject = formatedTimeStringToTimeObject(formatedTimeString);
1095
+ if (newTimeObject === 1) {
1096
+ return 1;
1097
+ }
1098
+ if (newTimeObject === 0) {
1099
+ return null;
1100
+ }
1101
+ const updatedSelectedTime = getSelectedTimeWithTimeFromObject(newTimeObject);
1102
+ return updatedSelectedTime;
1103
+ };
1104
+ const formatTimeString = (timeString) => {
1105
+ if (timeString.length === 0) return 0;
1106
+ if (timeString.length < 3 || timeString.length > 8)
1107
+ return 1;
1108
+ const numberOfColons = (timeString.match(new RegExp(":", "g")) || []).length;
1109
+ const stringLength = timeString.length;
1110
+ if (numberOfColons === 2 && stringLength >= 7) {
1111
+ return timeString.padStart(8, "0");
1112
+ }
1113
+ if (numberOfColons === 1) {
1114
+ return timeString.padStart(5, "0");
1115
+ }
1116
+ if (stringLength > 6) return 1;
1117
+ const stringLengthIsEven = stringLength % 2 == 0;
1118
+ const hourString = stringLengthIsEven ? timeString.slice(0, 2) : timeString.slice(0, 1);
1119
+ const minuteString = stringLengthIsEven ? timeString.slice(2, 4) : timeString.slice(1, 3);
1120
+ const secondString = (() => {
1121
+ const stringSlice = stringLengthIsEven ? timeString.slice(4, 6) : timeString.slice(3, 5);
1122
+ if (stringSlice === "") return "00";
1123
+ return stringSlice;
1124
+ })();
1125
+ const timeStringWithColon = hourString.padStart(2, "0") + ":" + minuteString + (showSeconds ? ":" + secondString : "");
1126
+ return timeStringWithColon;
1127
+ };
1128
+ const formatedTimeStringToTimeObject = (formatedTimeString) => {
1129
+ if (formatedTimeString === 1) return 1;
1130
+ if (formatedTimeString === 0)
1131
+ return 0;
1132
+ const isNumberTest = /^\d+$/;
1133
+ const hourString = formatedTimeString.slice(0, 2);
1134
+ const minuteString = formatedTimeString.slice(3, 5);
1135
+ const secondString = formatedTimeString.slice(6, 8);
1136
+ if (hourString.match(isNumberTest) && minuteString.match(isNumberTest) && (secondString === "" || secondString.match(isNumberTest))) {
1137
+ try {
1138
+ const timeObject = date.parseTime(formatedTimeString);
1139
+ return timeObject;
1140
+ } catch (e) {
1141
+ return 1;
1142
+ }
1143
+ }
1144
+ return 1;
1145
+ };
1146
+ const getSelectedTimeWithTimeFromObject = (newTime) => {
1147
+ const selectedTimeWithUpdateTime = (lastValidSelectedTime ?? new date.Time()).set({
1148
+ hour: newTime.hour,
1149
+ minute: newTime.minute,
1150
+ second: newTime.second
1151
+ });
1152
+ return selectedTimeWithUpdateTime;
1153
+ };
1154
+ const {
1155
+ onBlur,
1156
+ onClick,
1157
+ onDragStart,
1158
+ onFocus,
1159
+ onKeyDown,
1160
+ onKeyUp,
1161
+ onMouseDown,
1162
+ onPointerDown,
1163
+ onPointerUp,
1164
+ ...usedFieldProps
1165
+ } = fieldProps;
1166
+ return /* @__PURE__ */ jsxRuntime.jsx(i18n.I18nProvider, { locale, children: /* @__PURE__ */ jsxRuntime.jsx(
1167
+ form.TextField,
1168
+ {
1169
+ append: append || (showClockIcon === true || showClockIcon === "right" ? /* @__PURE__ */ jsxRuntime.jsx(icons.ClockIcon, { onClick: () => timeFieldRef?.current?.focus(), inline: true }) : void 0),
1170
+ className: classNames("eds-simple-timepicker", {
1171
+ "eds-simple-timepicker--padding-large": padding === "large",
1172
+ "eds-simple-timepicker--show-seconds": showSeconds,
1173
+ "eds-simple-timepicker--hide-clock": !showClockIcon,
1174
+ "eds-simple-timepicker--has-tooltip": labelTooltip !== void 0
1175
+ }),
1176
+ disabled,
1177
+ disableLabelAnimation: true,
1178
+ feedback,
1179
+ label,
1180
+ labelProps,
1181
+ labelTooltip,
1182
+ onBlur: () => {
1183
+ handleChangeTime();
1184
+ if (selectedTime === null) {
1185
+ addPlaceholderToInput();
1186
+ }
1187
+ },
1188
+ onChange: (e) => setInputText(e.target.value),
1189
+ onFocus: () => {
1190
+ if (selectedTime === null) {
1191
+ setInputText("");
1192
+ }
1193
+ },
1194
+ onKeyDown: ({ key }) => {
1195
+ if (key === "Enter") handleChangeTime();
1196
+ },
1197
+ placeholder: showSeconds ? "–– : –– : ––" : "–– : ––",
1198
+ prepend: prepend || (showClockIcon === "left" ? /* @__PURE__ */ jsxRuntime.jsx(icons.ClockIcon, { onClick: () => timeFieldRef?.current?.focus() }) : void 0),
1199
+ readOnly,
1200
+ ref: utils.mergeRefs(timeFieldRef, inputRef),
1201
+ style,
1202
+ value: inputText,
1203
+ variant,
1204
+ ...usedFieldProps
1205
+ }
1206
+ ) });
1207
+ };
1208
+ utils.warnAboutMissingStyles("datepicker", "form", "icons");
1209
+ Object.defineProperty(exports, "CalendarDate", {
1210
+ enumerable: true,
1211
+ get: () => date.CalendarDate
1212
+ });
1213
+ Object.defineProperty(exports, "CalendarDateTime", {
1214
+ enumerable: true,
1215
+ get: () => date.CalendarDateTime
1216
+ });
1217
+ Object.defineProperty(exports, "Time", {
1218
+ enumerable: true,
1219
+ get: () => date.Time
1220
+ });
1221
+ Object.defineProperty(exports, "ZonedDateTime", {
1222
+ enumerable: true,
1223
+ get: () => date.ZonedDateTime
1224
+ });
1225
+ exports.Calendar = Calendar;
1226
+ exports.DateField = DateField;
1227
+ exports.DatePicker = DatePicker;
1228
+ exports.NativeDatePicker = NativeDatePicker;
1229
+ exports.NativeTimePicker = NativeTimePicker;
1230
+ exports.SimpleTimePicker = SimpleTimePicker;
1231
+ exports.TimePicker = TimePicker;
1232
+ exports.ariaLabelIfNorwegian = ariaLabelIfNorwegian;
1233
+ exports.convertValueToType = convertValueToType;
1234
+ exports.createCalendar = createCalendar;
1235
+ exports.focusSegment = focusSegment;
1236
+ exports.getWeekNumberForDate = getWeekNumberForDate;
1237
+ exports.handleOnChange = handleOnChange;
1238
+ exports.lastMillisecondOfDay = lastMillisecondOfDay;
1239
+ exports.modulo = modulo;
1240
+ exports.nativeDateToDateValue = nativeDateToDateValue;
1241
+ exports.nativeDateToTimeValue = nativeDateToTimeValue;
1242
+ exports.timeOrDateValueToNativeDate = timeOrDateValueToNativeDate;
1243
+ //# sourceMappingURL=datepicker.cjs.js.map