@pismo/marola 2.0.2 → 2.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.
Files changed (68) hide show
  1. package/dist/{Button-cCziLrIy.js → Button-Bh6rpTyY.js} +2 -2
  2. package/dist/{ClickAwayListener-CUayzVlD.js → ClickAwayListener-BjqhGzJh.js} +3 -3
  3. package/dist/DatePicker.module-CmT9Zbbu.js +45 -0
  4. package/dist/{Popup-C7AXLoP0.js → Popup-aWlctE1C.js} +3 -3
  5. package/dist/{Portal-CYV5TK_i.js → Portal-Dc9ej3DW.js} +2 -2
  6. package/dist/{RadioButton.module-B4kmS66R.js → RadioButton.module-VF7v9SuY.js} +1 -1
  7. package/dist/{Toggle-DEVeyo2f.js → Toggle-DeMSbC0N.js} +16 -15
  8. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  9. package/dist/assets/DatePicker.css +1 -0
  10. package/dist/{combineHooksSlotProps-BCXoX9Nx.js → combineHooksSlotProps-CNWfgylM.js} +1 -1
  11. package/dist/components/Autocomplete/Autocomplete.js +1 -1
  12. package/dist/components/Button/Button.js +1 -1
  13. package/dist/components/Chip/Chip.js +4 -3
  14. package/dist/components/DatePicker/DatePicker.d.ts +30 -0
  15. package/dist/components/DatePicker/DatePicker.js +1534 -0
  16. package/dist/components/DatePicker/DatePicker.stories.d.ts +45 -0
  17. package/dist/components/DatePicker/DatePicker.test.d.ts +1 -0
  18. package/dist/components/DatePicker/dateUtils.d.ts +96 -0
  19. package/dist/components/DatePicker/dateUtils.js +70 -0
  20. package/dist/components/DatePicker/dateUtils.test.d.ts +0 -0
  21. package/dist/components/DatePicker/keyboardNavigation.d.ts +14 -0
  22. package/dist/components/DatePicker/keyboardNavigation.js +26 -0
  23. package/dist/components/DatePicker/keyboardNavigation.test.d.ts +1 -0
  24. package/dist/components/DatePicker/renderCalendarDays.d.ts +25 -0
  25. package/dist/components/DatePicker/renderCalendarDays.js +85 -0
  26. package/dist/components/DatePicker/renderCalendarDays.test.d.ts +2 -0
  27. package/dist/components/DatePicker/renderDualCalendarHeader.d.ts +8 -0
  28. package/dist/components/DatePicker/renderDualCalendarHeader.js +51 -0
  29. package/dist/components/DatePicker/renderDualCalendarHeader.test.d.ts +0 -0
  30. package/dist/components/DatePicker/renderHeader.d.ts +11 -0
  31. package/dist/components/DatePicker/renderHeader.js +41 -0
  32. package/dist/components/DatePicker/renderHeader.test.d.ts +0 -0
  33. package/dist/components/DatePicker/renderNavigatorInput.d.ts +16 -0
  34. package/dist/components/DatePicker/renderNavigatorInput.js +73 -0
  35. package/dist/components/DatePicker/renderNavigatorInput.test.d.ts +1 -0
  36. package/dist/components/DatePicker/renderPeriodSelection.d.ts +17 -0
  37. package/dist/components/DatePicker/renderPeriodSelection.js +81 -0
  38. package/dist/components/DatePicker/renderPeriodSelection.test.d.ts +1 -0
  39. package/dist/components/Dialog/CloseIconButton.js +1 -1
  40. package/dist/components/Dialog/Dialog.js +4 -4
  41. package/dist/components/Icon/Icon.js +167 -163
  42. package/dist/components/Icon/types.d.ts +1 -1
  43. package/dist/components/IconButton/IconButton.js +1 -1
  44. package/dist/components/Input/Input.js +1 -1
  45. package/dist/components/Popover/Popover.js +2 -2
  46. package/dist/components/RadioButton/RadioButton.js +7 -6
  47. package/dist/components/RadioButton/RadioOption.js +7 -6
  48. package/dist/components/ResultWithChips/ResultWithChips.js +1 -1
  49. package/dist/components/RowItem/RowItem.js +4 -3
  50. package/dist/components/Select/Select.js +5 -5
  51. package/dist/components/Snackbar/Snackbar.js +3 -3
  52. package/dist/components/Tabs/Tab.js +3 -3
  53. package/dist/components/Tabs/TabPanel.js +1 -1
  54. package/dist/components/Tabs/Tabs.js +3 -3
  55. package/dist/components/Toggle/Toggle.js +1 -1
  56. package/dist/components/ToggleGroup/Toggle.js +3 -2
  57. package/dist/components/ToggleGroup/ToggleGroup.js +1 -1
  58. package/dist/components/Tooltip/Tooltip.js +3 -3
  59. package/dist/contexts/SnackbarProvider/SnackbarProvider.js +1 -1
  60. package/dist/dayjs.min-ClQKmc--.js +285 -0
  61. package/dist/{index-CATDT7fJ.js → index-Bppuplgd.js} +6 -5
  62. package/dist/main.d.ts +1 -0
  63. package/dist/main.js +106 -105
  64. package/dist/{ownerDocument-CAHSRRik.js → ownerDocument-CXvpb_nj.js} +2 -1
  65. package/dist/{useButton-eF8MXAli.js → useButton-B8Y1xR88.js} +1 -1
  66. package/dist/{useList-CPY2roI7.js → useList-9gbS2r78.js} +2 -2
  67. package/dist/{useSlotProps-DSnfx453.js → useSlotProps-C7dqSmdM.js} +109 -112
  68. package/package.json +1 -1
@@ -0,0 +1,45 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ import { default as dayjs } from 'dayjs';
3
+ declare const meta: {
4
+ title: string;
5
+ component: import('react').FC<{
6
+ mode: "range" | "single";
7
+ viewMode: "month" | "day" | "year";
8
+ locale?: string | undefined;
9
+ placeholder?: string | undefined;
10
+ format?: string | undefined;
11
+ minDate?: dayjs.Dayjs | undefined;
12
+ maxDate?: dayjs.Dayjs | undefined;
13
+ disableDates?: ((date: dayjs.Dayjs) => boolean) | undefined;
14
+ testid?: string | undefined;
15
+ onChange: (date: dayjs.Dayjs | [dayjs.Dayjs | null, dayjs.Dayjs | null]) => void;
16
+ placement?: "bottom" | "top" | "bottom-start" | "bottom-end" | "top-start" | "top-end" | undefined;
17
+ navigatorInput?: boolean | undefined;
18
+ }>;
19
+ tags: string[];
20
+ decorators: ((Story: import('@storybook/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
21
+ mode: "range" | "single";
22
+ viewMode: "month" | "day" | "year";
23
+ locale?: string | undefined;
24
+ placeholder?: string | undefined;
25
+ format?: string | undefined;
26
+ minDate?: dayjs.Dayjs | undefined;
27
+ maxDate?: dayjs.Dayjs | undefined;
28
+ disableDates?: ((date: dayjs.Dayjs) => boolean) | undefined;
29
+ testid?: string | undefined;
30
+ onChange: (date: dayjs.Dayjs | [dayjs.Dayjs | null, dayjs.Dayjs | null]) => void;
31
+ placement?: "bottom" | "top" | "bottom-start" | "bottom-end" | "top-start" | "top-end" | undefined;
32
+ navigatorInput?: boolean | undefined;
33
+ }>) => import("react/jsx-runtime").JSX.Element)[];
34
+ };
35
+ export default meta;
36
+ type Story = StoryObj<typeof meta>;
37
+ export declare const Default: Story;
38
+ export declare const RangePicker: Story;
39
+ export declare const MonthView: Story;
40
+ export declare const YearView: Story;
41
+ export declare const LocalizedPortuguese: Story;
42
+ export declare const MinMaxDate: Story;
43
+ export declare const DisabledDates: Story;
44
+ export declare const CustomDateFormat: Story;
45
+ export declare const NavigatorInput: Story;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,96 @@
1
+ import { Dayjs } from 'dayjs';
2
+ /**
3
+ * Get the first day of the next month.
4
+ * @param date - The current date as a Dayjs object.
5
+ * @returns A Dayjs object representing the first day of the next month.
6
+ */
7
+ export declare const getNextMonth: (date: Dayjs) => Dayjs;
8
+ /**
9
+ * Get the first day of the previous month.
10
+ * @param date - The current date as a Dayjs object.
11
+ * @returns A Dayjs object representing the first day of the previous month.
12
+ */
13
+ export declare const getPreviousMonth: (date: Dayjs) => Dayjs;
14
+ /**
15
+ * Format a Dayjs date object for input display.
16
+ * @param date - The date to format as a Dayjs object.
17
+ * @param locale - The locale to use for formatting.
18
+ * @param format - The format to use for formatting (optional).
19
+ * @returns A formatted date string.
20
+ */
21
+ export declare const formatDateForInput: (date: Dayjs | null, locale: string, format?: string) => string;
22
+ /**
23
+ * Check if a given date is the current day.
24
+ * @param date - The date to check as a Dayjs object.
25
+ * @returns `true` if the date is the current day, otherwise `false`.
26
+ */
27
+ export declare const isCurrentDay: (date: Dayjs | null) => boolean;
28
+ /**
29
+ * Check if a given date is disabled based on provided constraints.
30
+ * @param date - The date to check as a Dayjs object.
31
+ * @param minDate - The minimum selectable date (optional).
32
+ * @param maxDate - The maximum selectable date (optional).
33
+ * @param disableDates - A function to disable specific dates (optional).
34
+ * @param mode - The selection mode ('single' or 'range').
35
+ * @param selectedRange - The currently selected date range (optional).
36
+ * @returns `true` if the date is disabled, otherwise `false`.
37
+ */
38
+ export declare const isDisabled: (date: Dayjs | null, minDate?: Dayjs, maxDate?: Dayjs, disableDates?: (date: Dayjs) => boolean, mode?: 'single' | 'range', selectedRange?: [Dayjs | null, Dayjs | null]) => boolean;
39
+ /**
40
+ * Generate an array of dates representing a month grid.
41
+ * @param month - The month to display (as a Dayjs object).
42
+ * @param includeAdjacentMonths - Whether to include days from adjacent months to fill the grid.
43
+ * @returns Array of Dayjs objects representing all days to display.
44
+ */
45
+ export declare const getMonthGrid: (month: Dayjs, includeAdjacentMonths?: boolean) => Dayjs[];
46
+ /**
47
+ * Check if a date is within a selected range.
48
+ * @param date - The date to check.
49
+ * @param rangeStart - The start date of the range.
50
+ * @param rangeEnd - The end date of the range.
51
+ * @returns `true` if the date is within the range, otherwise `false`.
52
+ */
53
+ export declare const isDateInRange: (date: Dayjs | null, rangeStart: Dayjs | null, rangeEnd: Dayjs | null) => boolean;
54
+ /**
55
+ * Check if a date is the start of a selected range.
56
+ * @param date - The date to check.
57
+ * @param rangeStart - The start date of the range.
58
+ * @returns `true` if the date is the start of the range, otherwise `false`.
59
+ */
60
+ export declare const isRangeStart: (date: Dayjs | null, rangeStart: Dayjs | null) => boolean;
61
+ /**
62
+ * Check if a date is the end of a selected range.
63
+ * @param date - The date to check.
64
+ * @param rangeEnd - The end date of the range.
65
+ * @returns `true` if the date is the end of the range, otherwise `false`.
66
+ */
67
+ export declare const isRangeEnd: (date: Dayjs | null, rangeEnd: Dayjs | null) => boolean;
68
+ /**
69
+ * Get an array of weekday names based on locale.
70
+ * @param locale - The locale to use for weekday names.
71
+ * @param format - The format to use ('long', 'short', 'narrow', etc.).
72
+ * @returns Array of weekday names.
73
+ */
74
+ export declare const getWeekdayNames: (locale: string, format?: 'long' | 'short' | 'narrow') => string[];
75
+ /**
76
+ * Parse a date string to a Dayjs object.
77
+ * @param dateStr - The date string to parse.
78
+ * @param format - The expected format of the date string.
79
+ * @returns A Dayjs object or null if the date is invalid.
80
+ */
81
+ export declare const parseDate: (dateStr: string | null, format?: string) => Dayjs | null;
82
+ /**
83
+ * Check if two dates fall on the same day.
84
+ * @param date1 - The first date to compare.
85
+ * @param date2 - The second date to compare.
86
+ * @returns `true` if both dates fall on the same day, otherwise `false`.
87
+ */
88
+ export declare const isSameDay: (date1: Dayjs | null, date2: Dayjs | null) => boolean;
89
+ /**
90
+ * Parse a formatted input date back to the original Dayjs format.
91
+ * @param formattedDate - The formatted date string from the input.
92
+ * @param locale - The locale that was used for formatting.
93
+ * @param format - Optional specific format to use for parsing.
94
+ * @returns A Dayjs object representing the parsed date, or null if invalid.
95
+ */
96
+ export declare const parseFormattedInput: (formattedDate: string | null, locale: string, format?: string) => Dayjs | null;
@@ -0,0 +1,70 @@
1
+ import { d as u } from "../../dayjs.min-ClQKmc--.js";
2
+ const c = (r) => r.add(1, "month").startOf("month"), M = (r) => r.subtract(1, "month").startOf("month"), Y = (r, t, n) => r ? n ? r.locale(t).format(n) : r.locale(t).format("LL") : "", h = (r) => r ? r.isSame(u(), "day") : !1, D = (r, t, n, o, i, s) => {
3
+ if (!r) return !0;
4
+ const a = t && r.isBefore(t, "day"), f = n && r.isAfter(n, "day"), l = o && o(r), e = i === "range" && (s == null ? void 0 : s[0]) && !(s != null && s[1]) && r.isBefore(s[0], "day");
5
+ return !!(a || f || l || e);
6
+ }, m = (r, t = !0) => {
7
+ const n = r.startOf("month"), o = r.endOf("month");
8
+ if (!t) {
9
+ const l = o.date();
10
+ return Array.from({ length: l }, (e, d) => n.clone().date(d + 1));
11
+ }
12
+ const i = n.subtract(n.day(), "day"), s = o.add(6 - o.day(), "day"), a = [];
13
+ let f = i.clone();
14
+ for (; !f.isAfter(s, "day"); )
15
+ a.push(f), f = f.add(1, "day");
16
+ return a;
17
+ }, p = (r, t, n) => !r || !t || !n ? !1 : r.isBetween(t, n, "day", "[]"), O = (r, t) => r === null || t === null ? !1 : r.isSame(t, "day"), A = (r, t) => r === null || t === null ? !1 : r.isSame(t, "day"), I = (r, t = "short") => {
18
+ const n = [];
19
+ let o = u().locale(r).startOf("week");
20
+ for (let i = 0; i < 7; i++)
21
+ n.push(o.format(t === "long" ? "dddd" : t === "short" ? "ddd" : "dd")), o = o.add(1, "day");
22
+ return n;
23
+ }, L = (r, t) => {
24
+ if (!r) return null;
25
+ const n = t ? u(r, t) : u(r);
26
+ return n.isValid() ? n : null;
27
+ }, b = (r, t) => r === null || t === null ? !1 : r.isSame(t, "day"), k = (r, t, n) => {
28
+ if (!r) return null;
29
+ if (n) {
30
+ const s = u(r, n, t);
31
+ if (s.isValid()) return s;
32
+ }
33
+ const o = [
34
+ "LL",
35
+ // Default localized format
36
+ "L",
37
+ // Short localized format
38
+ "YYYY-MM-DD",
39
+ // ISO format
40
+ "MM/DD/YYYY",
41
+ // US format
42
+ "DD/MM/YYYY",
43
+ // European format
44
+ "D [de] MMMM [de] YYYY",
45
+ // Portuguese/Spanish style
46
+ "MMMM D, YYYY"
47
+ // English style
48
+ ];
49
+ for (const s of o) {
50
+ const a = u(r, s, t);
51
+ if (a.isValid()) return a;
52
+ }
53
+ const i = u(r);
54
+ return i.isValid() ? i : null;
55
+ };
56
+ export {
57
+ Y as formatDateForInput,
58
+ m as getMonthGrid,
59
+ c as getNextMonth,
60
+ M as getPreviousMonth,
61
+ I as getWeekdayNames,
62
+ h as isCurrentDay,
63
+ p as isDateInRange,
64
+ D as isDisabled,
65
+ A as isRangeEnd,
66
+ O as isRangeStart,
67
+ b as isSameDay,
68
+ L as parseDate,
69
+ k as parseFormattedInput
70
+ };
File without changes
@@ -0,0 +1,14 @@
1
+ import { Dayjs } from 'dayjs';
2
+ type ViewMode = 'day' | 'month' | 'year';
3
+ /**
4
+ * Handles keyboard navigation for the date picker
5
+ * @param event Keyboard event
6
+ * @param isOpen Whether the date picker is open
7
+ * @param viewMode Current view mode ('day', 'month', or 'year')
8
+ * @param currentMonth Current month displayed
9
+ * @param setCurrentMonth Function to update the current month
10
+ * @param mode DatePicker mode ('single' or 'range')
11
+ * @param handleSelect Function to select a date
12
+ */
13
+ export declare const handleDatePickerKeyDown: (event: React.KeyboardEvent, isOpen: boolean, viewMode: ViewMode, currentMonth: Dayjs, setCurrentMonth: (date: Dayjs) => void, mode: 'single' | 'range', handleSelect?: (date: Dayjs) => void, setIsOpen?: (isOpen: boolean) => void) => void;
14
+ export {};
@@ -0,0 +1,26 @@
1
+ const k = (s, l, d, a, y, i, f, b) => {
2
+ if (l)
3
+ switch (s.key) {
4
+ case "ArrowLeft":
5
+ y(d === "day" ? a.subtract(1, "day") : d === "month" ? a.subtract(1, "month") : a.subtract(1, "year"));
6
+ break;
7
+ case "ArrowRight":
8
+ y(d === "day" ? a.add(1, "day") : d === "month" ? a.add(1, "month") : a.add(1, "year"));
9
+ break;
10
+ case "ArrowUp":
11
+ y(d === "day" ? a.subtract(7, "day") : d === "month" ? a.subtract(3, "month") : a.subtract(4, "year"));
12
+ break;
13
+ case "ArrowDown":
14
+ y(d === "day" ? a.add(7, "day") : d === "month" ? a.add(3, "month") : a.add(4, "year"));
15
+ break;
16
+ case "Enter":
17
+ i === "single" && f && f(a);
18
+ break;
19
+ case "Escape":
20
+ b && b(!1);
21
+ break;
22
+ }
23
+ };
24
+ export {
25
+ k as handleDatePickerKeyDown
26
+ };
@@ -0,0 +1,25 @@
1
+ import { Dayjs } from 'dayjs';
2
+ type RenderDaysProps = {
3
+ currentMonth: Dayjs;
4
+ monthOffset?: number;
5
+ mode: 'single' | 'range';
6
+ locale: string;
7
+ minDate?: Dayjs;
8
+ maxDate?: Dayjs;
9
+ disableDates?: (date: Dayjs) => boolean;
10
+ selectedDate: Dayjs | null;
11
+ selectedRange: [Dayjs | null, Dayjs | null];
12
+ isSelectingRange: boolean;
13
+ hoverDate: Dayjs | null;
14
+ handleSelect: (date: Dayjs) => void;
15
+ setHoverDate: (date: Dayjs | null) => void;
16
+ };
17
+ /**
18
+ * Renders weekday names header
19
+ */
20
+ export declare const renderDayNames: (locale: string) => import("react/jsx-runtime").JSX.Element;
21
+ /**
22
+ * Renders the days of the calendar
23
+ */
24
+ export declare const renderCalendarDays: ({ currentMonth, monthOffset, mode, locale, minDate, maxDate, disableDates, selectedDate, selectedRange, isSelectingRange, hoverDate, handleSelect, setHoverDate, }: RenderDaysProps) => import("react/jsx-runtime").JSX.Element;
25
+ export {};
@@ -0,0 +1,85 @@
1
+ import { jsx as d, jsxs as Y } from "react/jsx-runtime";
2
+ import { d as x } from "../../dayjs.min-ClQKmc--.js";
3
+ import { s } from "../../DatePicker.module-CmT9Zbbu.js";
4
+ import { getWeekdayNames as E, getMonthGrid as I, isDateInRange as C, isRangeStart as p, isRangeEnd as c, isDisabled as y, isCurrentDay as W, formatDateForInput as h } from "./dateUtils.js";
5
+ const A = (a, n, i) => {
6
+ if (!n[0] || !i) return !1;
7
+ const u = n[0].isBefore(i) ? n[0] : i, m = n[0].isBefore(i) ? i : n[0];
8
+ return a.isAfter(u, "day") && a.isBefore(m, "day");
9
+ }, S = (a, n) => n !== null && a.isSame(n, "day"), H = (a, n, i) => !n[0] || !i || !a.isSame(i, "day") ? !1 : n[0].isAfter(i), F = (a, n, i) => !n[0] || !i || !a.isSame(i, "day") ? !1 : n[0].isBefore(i), G = (a) => /* @__PURE__ */ d("div", { className: s.weekdayNames, "data-testid": "calendar-weekday-names", children: E(a, "short").map((n) => /* @__PURE__ */ d("div", { className: s.weekdayName, "data-testid": `weekday-name-${n}`, children: n }, n)) }), K = ({
10
+ currentMonth: a,
11
+ monthOffset: n = 0,
12
+ mode: i,
13
+ locale: u,
14
+ minDate: m,
15
+ maxDate: N,
16
+ disableDates: l,
17
+ selectedDate: o,
18
+ selectedRange: t,
19
+ isSelectingRange: k,
20
+ hoverDate: f,
21
+ handleSelect: B,
22
+ setHoverDate: M
23
+ }) => {
24
+ const $ = a.add(n, "month"), j = I($, !0);
25
+ return /* @__PURE__ */ Y("div", { className: s.calendar, "data-testid": `calendar-month-${n}`, children: [
26
+ G(u),
27
+ /* @__PURE__ */ d("div", { className: s.days, "data-testid": "calendar-days-grid", children: j.map((r) => {
28
+ const w = r.month() === $.month(), b = r.format("YYYY-MM-DD"), T = [
29
+ s.day,
30
+ !w && s.faded,
31
+ (o == null ? void 0 : o.isSame(r, "day")) && s.selected,
32
+ C(r, t[0], t[1]) && s["range-selected"],
33
+ p(r, t[0]) && s["range-start"],
34
+ c(r, t[1]) && s["range-end"],
35
+ y(r, m, N, l, i, t) && s.disabled,
36
+ W(r) && s["current-day"],
37
+ // Hover range classes
38
+ A(r, t, f) && s["hovered-range"],
39
+ S(r, f) && s["hovered-date"],
40
+ H(r, t, f) && s["would-be-start-date"],
41
+ F(r, t, f) && s["would-be-end-date"]
42
+ ].filter(Boolean).join(" ");
43
+ return /* @__PURE__ */ d(
44
+ "button",
45
+ {
46
+ className: T,
47
+ onClick: () => B(r),
48
+ onMouseEnter: () => {
49
+ k && !y(r, m, N, l, i, t) && M(r);
50
+ },
51
+ onMouseLeave: () => {
52
+ k && M(null);
53
+ },
54
+ disabled: y(r, m, N, l, i, t),
55
+ "aria-label": `${h(r, u)}${p(r, t[0]) ? ", range start" : c(r, t[1]) ? ", range end" : C(r, t[0], t[1]) ? ", in selected range" : S(r, f) ? ", being hovered" : ""}`,
56
+ "aria-selected": (o == null ? void 0 : o.isSame(r, "day")) || p(r, t[0]) || c(r, t[1]),
57
+ "data-testid": `calendar-day-${b}`,
58
+ "data-date": b,
59
+ "data-current-month": w ? "true" : "false",
60
+ children: r.date()
61
+ },
62
+ `${n}-${b}`
63
+ );
64
+ }) }),
65
+ i === "single" && n === 0 && /* @__PURE__ */ d("div", { className: s["today-footer"], "data-testid": "today-footer", children: /* @__PURE__ */ d(
66
+ "button",
67
+ {
68
+ className: s["today-button"],
69
+ onClick: () => {
70
+ const r = x();
71
+ B(r);
72
+ },
73
+ "data-testid": "today-button",
74
+ children: {
75
+ en: "Today",
76
+ pt: "Hoje"
77
+ }[u.split("-")[0]] || "Today"
78
+ }
79
+ ) })
80
+ ] });
81
+ };
82
+ export {
83
+ K as renderCalendarDays,
84
+ G as renderDayNames
85
+ };
@@ -0,0 +1,2 @@
1
+ import { renderCalendarDays, renderDayNames } from './renderCalendarDays';
2
+ export { renderDayNames, renderCalendarDays };
@@ -0,0 +1,8 @@
1
+ import { Dayjs } from 'dayjs';
2
+ interface RenderDualCalendarHeaderProps {
3
+ currentMonth: Dayjs;
4
+ locale: string;
5
+ setCurrentMonth: (month: Dayjs) => void;
6
+ }
7
+ export declare const renderDualCalendarHeader: ({ currentMonth, locale, setCurrentMonth }: RenderDualCalendarHeaderProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,51 @@
1
+ import { jsxs as s, jsx as a } from "react/jsx-runtime";
2
+ import { Icon as o } from "../Icon/Icon.js";
3
+ import { s as t } from "../../DatePicker.module-CmT9Zbbu.js";
4
+ import { getPreviousMonth as d, getNextMonth as n } from "./dateUtils.js";
5
+ const v = ({ currentMonth: e, locale: r, setCurrentMonth: i }) => /* @__PURE__ */ s("div", { className: t["month-header-row"], "data-testid": "dual-calendar-header", children: [
6
+ /* @__PURE__ */ a(
7
+ "button",
8
+ {
9
+ onClick: () => i(e.subtract(1, "year")),
10
+ "aria-label": "Previous Year",
11
+ className: t["nav-button"],
12
+ "data-testid": "previous-year-button",
13
+ children: /* @__PURE__ */ a("div", { className: t.rotate, children: /* @__PURE__ */ a(o, { icon: "chevrons-right", size: 24 }) })
14
+ }
15
+ ),
16
+ /* @__PURE__ */ a(
17
+ "button",
18
+ {
19
+ onClick: () => i(d(e)),
20
+ "aria-label": "Previous Month",
21
+ className: t["nav-button"],
22
+ "data-testid": "previous-month-button",
23
+ children: /* @__PURE__ */ a("div", { className: t.rotate, children: /* @__PURE__ */ a(o, { icon: "chevron-right", size: 24 }) })
24
+ }
25
+ ),
26
+ /* @__PURE__ */ a("div", { className: t["month-header"], "data-testid": "current-month-display", children: e.locale(r).format("MMMM YYYY") }),
27
+ /* @__PURE__ */ a("div", { className: t["month-header"], "data-testid": "next-month-display", children: e.add(1, "month").locale(r).format("MMMM YYYY") }),
28
+ /* @__PURE__ */ a(
29
+ "button",
30
+ {
31
+ onClick: () => i(n(e)),
32
+ "aria-label": "Next Month",
33
+ className: t["nav-button"],
34
+ "data-testid": "next-month-button",
35
+ children: /* @__PURE__ */ a(o, { icon: "chevron-right", size: 24 })
36
+ }
37
+ ),
38
+ /* @__PURE__ */ a(
39
+ "button",
40
+ {
41
+ onClick: () => i(e.add(1, "year")),
42
+ "aria-label": "Next Year",
43
+ className: t["nav-button"],
44
+ "data-testid": "next-year-button",
45
+ children: /* @__PURE__ */ a(o, { icon: "chevrons-right", size: 24 })
46
+ }
47
+ )
48
+ ] });
49
+ export {
50
+ v as renderDualCalendarHeader
51
+ };
@@ -0,0 +1,11 @@
1
+ import { Dayjs } from 'dayjs';
2
+ interface RenderHeaderProps {
3
+ currentViewMode: 'day' | 'month' | 'year';
4
+ currentMonth: Dayjs;
5
+ locale: string;
6
+ navigateToPrevious: () => void;
7
+ navigateToNext: () => void;
8
+ setCurrentViewMode: (viewMode: 'day' | 'month' | 'year') => void;
9
+ }
10
+ export declare const renderHeader: ({ currentViewMode, currentMonth, locale, navigateToPrevious, navigateToNext, setCurrentViewMode, }: RenderHeaderProps) => import("react/jsx-runtime").JSX.Element | null;
11
+ export {};
@@ -0,0 +1,41 @@
1
+ import { jsxs as i, jsx as e, Fragment as n } from "react/jsx-runtime";
2
+ import { Icon as o } from "../Icon/Icon.js";
3
+ import { s as t } from "../../DatePicker.module-CmT9Zbbu.js";
4
+ const k = ({
5
+ currentViewMode: r,
6
+ currentMonth: a,
7
+ locale: d,
8
+ navigateToPrevious: s,
9
+ navigateToNext: c,
10
+ setCurrentViewMode: l
11
+ }) => r === "month" ? null : /* @__PURE__ */ i("div", { className: t.header, "data-testid": "datepicker-header", children: [
12
+ /* @__PURE__ */ e("button", { onClick: s, "aria-label": "Previous", "data-testid": "datepicker-previous-button", children: /* @__PURE__ */ e("div", { className: t.rotate, children: /* @__PURE__ */ e(o, { icon: "chevron-right", size: 24 }) }) }),
13
+ /* @__PURE__ */ i("span", { "data-testid": "datepicker-header-label", children: [
14
+ r === "day" && /* @__PURE__ */ i(n, { children: [
15
+ /* @__PURE__ */ e(
16
+ "button",
17
+ {
18
+ className: t["month-selector"],
19
+ onClick: () => l("month"),
20
+ "data-testid": "datepicker-month-selector",
21
+ children: a.locale(d).format("MMMM")
22
+ }
23
+ ),
24
+ " ",
25
+ /* @__PURE__ */ e(
26
+ "button",
27
+ {
28
+ className: t["year-selector"],
29
+ onClick: () => l("year"),
30
+ "data-testid": "datepicker-year-selector",
31
+ children: a.locale(d).format("YYYY")
32
+ }
33
+ )
34
+ ] }),
35
+ r === "year" && `${a.year() - 6} - ${a.year() + 5}`
36
+ ] }),
37
+ /* @__PURE__ */ e("button", { onClick: c, "aria-label": "Next", "data-testid": "datepicker-next-button", children: /* @__PURE__ */ e(o, { icon: "chevron-right", size: 24 }) })
38
+ ] });
39
+ export {
40
+ k as renderHeader
41
+ };
@@ -0,0 +1,16 @@
1
+ import { Dayjs } from 'dayjs';
2
+ type RenderNavigatorInputProps = {
3
+ navigateToPrevious: () => void;
4
+ navigateToNext: () => void;
5
+ currentMonth: Dayjs;
6
+ selectedDate: Dayjs | null;
7
+ locale: string;
8
+ currentViewMode: 'day' | 'month' | 'year';
9
+ mode: 'single' | 'range';
10
+ setCurrentViewMode: (viewMode: 'day' | 'month' | 'year') => void;
11
+ setIsOpen: (isOpen: boolean) => void;
12
+ setSelectedDate: (date: Dayjs) => void;
13
+ onChange: (date: Dayjs | [Dayjs | null, Dayjs | null]) => void;
14
+ };
15
+ export declare const renderNavigatorInput: ({ navigateToPrevious, navigateToNext, currentMonth, selectedDate, locale, currentViewMode, mode, setCurrentViewMode, setIsOpen, setSelectedDate, onChange, }: RenderNavigatorInputProps) => import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,73 @@
1
+ import { jsxs as f, jsx as n } from "react/jsx-runtime";
2
+ import { Icon as s } from "../Icon/Icon.js";
3
+ import { s as i } from "../../DatePicker.module-CmT9Zbbu.js";
4
+ const p = ({
5
+ navigateToPrevious: b,
6
+ navigateToNext: u,
7
+ currentMonth: m,
8
+ selectedDate: a,
9
+ locale: o,
10
+ currentViewMode: r,
11
+ mode: l,
12
+ setCurrentViewMode: h,
13
+ setIsOpen: v,
14
+ setSelectedDate: c,
15
+ onChange: d
16
+ }) => /* @__PURE__ */ f("div", { className: `${i["navigator-input"]} ${i["auto-width"]}`, "data-testid": "date-navigator", children: [
17
+ /* @__PURE__ */ n(
18
+ "button",
19
+ {
20
+ onClick: () => {
21
+ if (b(), l === "single" && a) {
22
+ let t;
23
+ r === "day" ? t = a.subtract(1, "month") : r === "month" ? t = a.subtract(1, "year") : t = a.subtract(12, "year"), c(t), d(t);
24
+ }
25
+ },
26
+ className: i["nav-button"],
27
+ "aria-label": "Previous month",
28
+ "data-testid": "nav-previous-button",
29
+ children: /* @__PURE__ */ n("div", { className: i.rotate, children: /* @__PURE__ */ n(s, { icon: "chevron-right", size: 24 }) })
30
+ }
31
+ ),
32
+ /* @__PURE__ */ n("span", { className: i["nav-calendar-static"], "data-testid": "nav-calendar-icon", children: /* @__PURE__ */ n(s, { icon: "calendar", size: 16 }) }),
33
+ /* @__PURE__ */ n(
34
+ "button",
35
+ {
36
+ className: i["nav-month-button"],
37
+ onClick: () => {
38
+ h("month"), v(!0);
39
+ },
40
+ "data-testid": "nav-month-button",
41
+ children: a ? a.locale(o).format("MMM") : m.locale(o).format("MMM")
42
+ }
43
+ ),
44
+ /* @__PURE__ */ n(
45
+ "button",
46
+ {
47
+ className: i["nav-year-button"],
48
+ onClick: () => {
49
+ h("year"), v(!0);
50
+ },
51
+ "data-testid": "nav-year-button",
52
+ children: a ? a.locale(o).format("YYYY") : m.locale(o).format("YYYY")
53
+ }
54
+ ),
55
+ /* @__PURE__ */ n(
56
+ "button",
57
+ {
58
+ onClick: () => {
59
+ if (u(), l === "single" && a) {
60
+ let t;
61
+ r === "day" ? t = a.add(1, "month") : r === "month" ? t = a.add(1, "year") : t = a.add(12, "year"), c(t), d(t);
62
+ }
63
+ },
64
+ className: i["nav-button"],
65
+ "aria-label": "Next month",
66
+ "data-testid": "nav-next-button",
67
+ children: /* @__PURE__ */ n(s, { icon: "chevron-right", size: 24 })
68
+ }
69
+ )
70
+ ] });
71
+ export {
72
+ p as renderNavigatorInput
73
+ };
@@ -0,0 +1,17 @@
1
+ import { Dayjs } from 'dayjs';
2
+ type RenderPeriodSelectionProps = {
3
+ currentViewMode: 'day' | 'month' | 'year';
4
+ currentMonth: Dayjs;
5
+ selectedDate: Dayjs | null;
6
+ locale: string;
7
+ mode: 'single' | 'range';
8
+ initialViewMode: 'day' | 'month' | 'year';
9
+ navigatorInput: boolean;
10
+ setCurrentMonth: (month: Dayjs) => void;
11
+ setSelectedDate: (date: Dayjs | null) => void;
12
+ onChange: (date: Dayjs | [Dayjs | null, Dayjs | null]) => void;
13
+ setCurrentViewMode: (viewMode: 'day' | 'month' | 'year') => void;
14
+ setIsOpen: (isOpen: boolean) => void;
15
+ };
16
+ export declare const renderPeriodSelection: ({ currentViewMode, currentMonth, selectedDate, locale, mode, initialViewMode, navigatorInput, setCurrentMonth, setSelectedDate, onChange, setCurrentViewMode, setIsOpen, }: RenderPeriodSelectionProps) => import("react/jsx-runtime").JSX.Element | null;
17
+ export {};