@pismo/marola 2.1.26 → 2.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RadioOption-DCTydlPv.js +720 -0
- package/dist/components/DatePicker/DatePicker.d.ts +6 -2
- package/dist/components/DatePicker/DatePicker.js +649 -647
- package/dist/components/DatePicker/DatePicker.stories.d.ts +4 -2
- package/dist/components/DatePicker/dateUtils.d.ts +1 -1
- package/dist/components/DatePicker/dateUtils.js +34 -33
- package/dist/components/DatePicker/renderCalendarDays.d.ts +2 -1
- package/dist/components/DatePicker/renderCalendarDays.js +48 -47
- package/dist/components/RadioButton/RadioButton.d.ts +1 -0
- package/dist/components/RadioButton/RadioButton.js +4 -2
- package/dist/components/RadioButton/RadioOption.js +7 -422
- package/dist/main.js +18 -16
- package/package.json +3 -1
- package/dist/RadioButton.module-RTKWJmma.js +0 -292
- /package/dist/assets/{RadioButton.css → RadioOption.css} +0 -0
- /package/dist/components/Typography/{Typography.test.d.ts → typography.test.d.ts} +0 -0
|
@@ -8,7 +8,6 @@ declare const meta: {
|
|
|
8
8
|
decorators: ((Story: import('@storybook/core/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
|
|
9
9
|
viewMode: "month" | "day" | "year";
|
|
10
10
|
locale?: string | undefined;
|
|
11
|
-
placeholder?: string | undefined;
|
|
12
11
|
format?: string | undefined;
|
|
13
12
|
minDate?: dayjs.Dayjs | undefined;
|
|
14
13
|
maxDate?: dayjs.Dayjs | undefined;
|
|
@@ -20,10 +19,10 @@ declare const meta: {
|
|
|
20
19
|
'data-testid'?: string | undefined;
|
|
21
20
|
mode: "single";
|
|
22
21
|
value?: Date | undefined;
|
|
22
|
+
placeholder?: string | undefined;
|
|
23
23
|
} | {
|
|
24
24
|
viewMode: "month" | "day" | "year";
|
|
25
25
|
locale?: string | undefined;
|
|
26
|
-
placeholder?: string | undefined;
|
|
27
26
|
format?: string | undefined;
|
|
28
27
|
minDate?: dayjs.Dayjs | undefined;
|
|
29
28
|
maxDate?: dayjs.Dayjs | undefined;
|
|
@@ -35,6 +34,8 @@ declare const meta: {
|
|
|
35
34
|
'data-testid'?: string | undefined;
|
|
36
35
|
mode: "range";
|
|
37
36
|
values?: [Date, Date] | undefined;
|
|
37
|
+
placeholders?: [string, string] | undefined;
|
|
38
|
+
limit?: number | undefined;
|
|
38
39
|
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
39
40
|
};
|
|
40
41
|
export default meta;
|
|
@@ -43,6 +44,7 @@ export declare const Single: Story;
|
|
|
43
44
|
export declare const SingleWithValue: Story;
|
|
44
45
|
export declare const RangePicker: Story;
|
|
45
46
|
export declare const RangeWithValues: Story;
|
|
47
|
+
export declare const RangeWithLimit: Story;
|
|
46
48
|
export declare const MonthView: Story;
|
|
47
49
|
export declare const YearView: Story;
|
|
48
50
|
export declare const LocalizedPortuguese: Story;
|
|
@@ -35,7 +35,7 @@ export declare const isCurrentDay: (date: Dayjs | null) => boolean;
|
|
|
35
35
|
* @param selectedRange - The currently selected date range (optional).
|
|
36
36
|
* @returns `true` if the date is disabled, otherwise `false`.
|
|
37
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;
|
|
38
|
+
export declare const isDisabled: (date: Dayjs | null, minDate?: Dayjs, maxDate?: Dayjs, disableDates?: (date: Dayjs) => boolean, mode?: 'single' | 'range', selectedRange?: [Dayjs | null, Dayjs | null], limit?: number) => boolean;
|
|
39
39
|
/**
|
|
40
40
|
* Generate an array of dates representing a month grid.
|
|
41
41
|
* @param month - The month to display (as a Dayjs object).
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import { d as u } from "../../dayjs.min-ClQKmc--.js";
|
|
2
|
-
const
|
|
2
|
+
const D = (r) => r.add(1, "month").startOf("month"), m = (r) => r.subtract(1, "month").startOf("month"), e = (r, n, t) => r ? t ? r.locale(n).format(t) : r.locale(n).format("LL") : "", p = (r) => r ? r.isSame(u(), "day") : !1, O = (r, n, t, o, i, s, a) => {
|
|
3
|
+
var M;
|
|
3
4
|
if (!r) return !0;
|
|
4
|
-
const
|
|
5
|
-
return !!(
|
|
6
|
-
},
|
|
7
|
-
const
|
|
8
|
-
if (!
|
|
9
|
-
const
|
|
10
|
-
return Array.from({ length:
|
|
5
|
+
const f = n && r.isBefore(n, "day"), y = t && r.isAfter(t, "day"), d = o && o(r), l = i === "range" && (s == null ? void 0 : s[0]) && !(s != null && s[1]) && r.isBefore(s[0], "day"), c = i === "range" && a && ((M = s == null ? void 0 : s[0]) == null ? void 0 : M.add(a, "day")), Y = c && r.isAfter(c, "day");
|
|
6
|
+
return !!(f || y || d || l || Y);
|
|
7
|
+
}, A = (r, n = !0) => {
|
|
8
|
+
const t = r.startOf("month"), o = r.endOf("month");
|
|
9
|
+
if (!n) {
|
|
10
|
+
const y = o.date();
|
|
11
|
+
return Array.from({ length: y }, (d, l) => t.clone().date(l + 1));
|
|
11
12
|
}
|
|
12
|
-
const i =
|
|
13
|
+
const i = t.subtract(t.day(), "day"), s = o.add(6 - o.day(), "day"), a = [];
|
|
13
14
|
let f = i.clone();
|
|
14
15
|
for (; !f.isAfter(s, "day"); )
|
|
15
16
|
a.push(f), f = f.add(1, "day");
|
|
16
17
|
return a;
|
|
17
|
-
},
|
|
18
|
-
const
|
|
18
|
+
}, L = (r, n, t) => !r || !n || !t ? !1 : r.isBetween(n, t, "day", "[]"), I = (r, n) => r === null || n === null ? !1 : r.isSame(n, "day"), b = (r, n) => r === null || n === null ? !1 : r.isSame(n, "day"), k = (r, n = "short") => {
|
|
19
|
+
const t = [];
|
|
19
20
|
let o = u().locale(r).startOf("week");
|
|
20
21
|
for (let i = 0; i < 7; i++)
|
|
21
|
-
|
|
22
|
-
return
|
|
23
|
-
},
|
|
22
|
+
t.push(o.format(n === "long" ? "dddd" : n === "short" ? "ddd" : "dd")), o = o.add(1, "day");
|
|
23
|
+
return t;
|
|
24
|
+
}, w = (r, n) => {
|
|
24
25
|
if (!r) return null;
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
-
},
|
|
26
|
+
const t = n ? u(r, n) : u(r);
|
|
27
|
+
return t.isValid() ? t : null;
|
|
28
|
+
}, B = (r, n) => r === null || n === null ? !1 : r.isSame(n, "day"), V = (r, n, t) => {
|
|
28
29
|
if (!r) return null;
|
|
29
|
-
if (
|
|
30
|
-
const s = u(r,
|
|
30
|
+
if (t) {
|
|
31
|
+
const s = u(r, t, n);
|
|
31
32
|
if (s.isValid()) return s;
|
|
32
33
|
}
|
|
33
34
|
const o = [
|
|
@@ -47,24 +48,24 @@ const c = (r) => r.add(1, "month").startOf("month"), M = (r) => r.subtract(1, "m
|
|
|
47
48
|
// English style
|
|
48
49
|
];
|
|
49
50
|
for (const s of o) {
|
|
50
|
-
const a = u(r, s,
|
|
51
|
+
const a = u(r, s, n);
|
|
51
52
|
if (a.isValid()) return a;
|
|
52
53
|
}
|
|
53
54
|
const i = u(r);
|
|
54
55
|
return i.isValid() ? i : null;
|
|
55
56
|
};
|
|
56
57
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
e as formatDateForInput,
|
|
59
|
+
A as getMonthGrid,
|
|
60
|
+
D as getNextMonth,
|
|
61
|
+
m as getPreviousMonth,
|
|
62
|
+
k as getWeekdayNames,
|
|
63
|
+
p as isCurrentDay,
|
|
64
|
+
L as isDateInRange,
|
|
65
|
+
O as isDisabled,
|
|
66
|
+
b as isRangeEnd,
|
|
67
|
+
I as isRangeStart,
|
|
68
|
+
B as isSameDay,
|
|
69
|
+
w as parseDate,
|
|
70
|
+
V as parseFormattedInput
|
|
70
71
|
};
|
|
@@ -13,6 +13,7 @@ type RenderDaysProps = {
|
|
|
13
13
|
hoverDate: Dayjs | null;
|
|
14
14
|
handleSelect: (date: Dayjs) => void;
|
|
15
15
|
setHoverDate: (date: Dayjs | null) => void;
|
|
16
|
+
limit?: number;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
19
|
* Renders weekday names header
|
|
@@ -21,5 +22,5 @@ export declare const renderDayNames: (locale: string) => import("react/jsx-runti
|
|
|
21
22
|
/**
|
|
22
23
|
* Renders the days of the calendar
|
|
23
24
|
*/
|
|
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 declare const renderCalendarDays: ({ currentMonth, monthOffset, mode, locale, minDate, maxDate, disableDates, selectedDate, selectedRange, isSelectingRange, hoverDate, handleSelect, setHoverDate, limit, }: RenderDaysProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
export {};
|
|
@@ -1,74 +1,75 @@
|
|
|
1
|
-
import { jsx as d, jsxs as
|
|
2
|
-
import { d as
|
|
3
|
-
import { s } from "../../DatePicker.module-CnuDEiKF.js";
|
|
4
|
-
import { getWeekdayNames as
|
|
5
|
-
const
|
|
6
|
-
if (!n[0] || !
|
|
7
|
-
const u = n[0].isBefore(
|
|
1
|
+
import { jsx as d, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import { d as E } from "../../dayjs.min-ClQKmc--.js";
|
|
3
|
+
import { s as i } from "../../DatePicker.module-CnuDEiKF.js";
|
|
4
|
+
import { getWeekdayNames as I, getMonthGrid as W, isDateInRange as S, isRangeStart as c, isRangeEnd as y, isDisabled as k, isCurrentDay as h, formatDateForInput as A } from "./dateUtils.js";
|
|
5
|
+
const H = (a, n, s) => {
|
|
6
|
+
if (!n[0] || !s) return !1;
|
|
7
|
+
const u = n[0].isBefore(s) ? n[0] : s, m = n[0].isBefore(s) ? s : n[0];
|
|
8
8
|
return a.isAfter(u, "day") && a.isBefore(m, "day");
|
|
9
|
-
},
|
|
9
|
+
}, j = (a, n) => n !== null && a.isSame(n, "day"), F = (a, n, s) => !n[0] || !s || !a.isSame(s, "day") ? !1 : n[0].isAfter(s), G = (a, n, s) => !n[0] || !s || !a.isSame(s, "day") ? !1 : n[0].isBefore(s), L = (a) => /* @__PURE__ */ d("div", { className: i.weekdayNames, "data-testid": "calendar-weekday-names", children: I(a, "short").map((n) => /* @__PURE__ */ d("div", { className: i.weekdayName, "data-testid": `weekday-name-${n}`, children: n }, n)) }), P = ({
|
|
10
10
|
currentMonth: a,
|
|
11
11
|
monthOffset: n = 0,
|
|
12
|
-
mode:
|
|
12
|
+
mode: s,
|
|
13
13
|
locale: u,
|
|
14
14
|
minDate: m,
|
|
15
15
|
maxDate: N,
|
|
16
|
-
disableDates:
|
|
16
|
+
disableDates: b,
|
|
17
17
|
selectedDate: o,
|
|
18
18
|
selectedRange: t,
|
|
19
|
-
isSelectingRange:
|
|
19
|
+
isSelectingRange: B,
|
|
20
20
|
hoverDate: f,
|
|
21
|
-
handleSelect:
|
|
22
|
-
setHoverDate:
|
|
21
|
+
handleSelect: M,
|
|
22
|
+
setHoverDate: $,
|
|
23
|
+
limit: p
|
|
23
24
|
}) => {
|
|
24
|
-
const
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
/* @__PURE__ */ d("div", { className:
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
!
|
|
31
|
-
(o == null ? void 0 : o.isSame(r, "day")) &&
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
const w = a.add(n, "month"), T = W(w, !0);
|
|
26
|
+
return /* @__PURE__ */ x("div", { className: i.calendar, "data-testid": `calendar-month-${n}`, children: [
|
|
27
|
+
L(u),
|
|
28
|
+
/* @__PURE__ */ d("div", { className: i.days, "data-testid": "calendar-days-grid", children: T.map((r) => {
|
|
29
|
+
const C = r.month() === w.month(), l = r.format("YYYY-MM-DD"), Y = [
|
|
30
|
+
i.day,
|
|
31
|
+
!C && i.faded,
|
|
32
|
+
(o == null ? void 0 : o.isSame(r, "day")) && i.selected,
|
|
33
|
+
S(r, t[0], t[1]) && i["range-selected"],
|
|
34
|
+
c(r, t[0]) && i["range-start"],
|
|
35
|
+
y(r, t[1]) && i["range-end"],
|
|
36
|
+
k(r, m, N, b, s, t, p) && i.disabled,
|
|
37
|
+
h(r) && i["current-day"],
|
|
37
38
|
// Hover range classes
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
H(r, t, f) && i["hovered-range"],
|
|
40
|
+
j(r, f) && i["hovered-date"],
|
|
41
|
+
F(r, t, f) && i["would-be-start-date"],
|
|
42
|
+
G(r, t, f) && i["would-be-end-date"]
|
|
42
43
|
].filter(Boolean).join(" ");
|
|
43
44
|
return /* @__PURE__ */ d(
|
|
44
45
|
"button",
|
|
45
46
|
{
|
|
46
|
-
className:
|
|
47
|
-
onClick: () =>
|
|
47
|
+
className: Y,
|
|
48
|
+
onClick: () => M(r),
|
|
48
49
|
onMouseEnter: () => {
|
|
49
|
-
|
|
50
|
+
B && !k(r, m, N, b, s, t, p) && $(r);
|
|
50
51
|
},
|
|
51
52
|
onMouseLeave: () => {
|
|
52
|
-
|
|
53
|
+
B && $(null);
|
|
53
54
|
},
|
|
54
|
-
disabled:
|
|
55
|
-
"aria-label": `${
|
|
56
|
-
"aria-selected": (o == null ? void 0 : o.isSame(r, "day")) ||
|
|
57
|
-
"data-testid": `calendar-day-${
|
|
58
|
-
"data-date":
|
|
59
|
-
"data-current-month":
|
|
55
|
+
disabled: k(r, m, N, b, s, t, p),
|
|
56
|
+
"aria-label": `${A(r, u)}${c(r, t[0]) ? ", range start" : y(r, t[1]) ? ", range end" : S(r, t[0], t[1]) ? ", in selected range" : j(r, f) ? ", being hovered" : ""}`,
|
|
57
|
+
"aria-selected": (o == null ? void 0 : o.isSame(r, "day")) || c(r, t[0]) || y(r, t[1]),
|
|
58
|
+
"data-testid": `calendar-day-${l}`,
|
|
59
|
+
"data-date": l,
|
|
60
|
+
"data-current-month": C ? "true" : "false",
|
|
60
61
|
children: r.date()
|
|
61
62
|
},
|
|
62
|
-
`${n}-${
|
|
63
|
+
`${n}-${l}`
|
|
63
64
|
);
|
|
64
65
|
}) }),
|
|
65
|
-
|
|
66
|
+
s === "single" && n === 0 && /* @__PURE__ */ d("div", { className: i["today-footer"], "data-testid": "today-footer", children: /* @__PURE__ */ d(
|
|
66
67
|
"button",
|
|
67
68
|
{
|
|
68
|
-
className:
|
|
69
|
+
className: i["today-button"],
|
|
69
70
|
onClick: () => {
|
|
70
|
-
const r =
|
|
71
|
-
|
|
71
|
+
const r = E();
|
|
72
|
+
M(r);
|
|
72
73
|
},
|
|
73
74
|
"data-testid": "today-button",
|
|
74
75
|
children: {
|
|
@@ -80,6 +81,6 @@ const A = (a, n, i) => {
|
|
|
80
81
|
] });
|
|
81
82
|
};
|
|
82
83
|
export {
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
P as renderCalendarDays,
|
|
85
|
+
L as renderDayNames
|
|
85
86
|
};
|
|
@@ -21,7 +21,8 @@ import "../Tabs/Tabs.js";
|
|
|
21
21
|
import "../../Group-DJz1rK2n.js";
|
|
22
22
|
import "../../contexts/SnackbarProvider/SnackbarProvider.js";
|
|
23
23
|
import "../../utils/iconsList.js";
|
|
24
|
-
import { u as ne, C as xe,
|
|
24
|
+
import { u as ne, C as xe, a as Y, b as oe, m as G, D as _e, c as Ae, d as Pe, e as ce, f as ke, r as ve, g as He, h as Ke, s as P } from "../../RadioOption-DCTydlPv.js";
|
|
25
|
+
import { R as Ut } from "../../RadioOption-DCTydlPv.js";
|
|
25
26
|
import { P as d } from "../../useSlotProps-CYHDC4TN.js";
|
|
26
27
|
const Le = Object.is;
|
|
27
28
|
function Ge(e, t) {
|
|
@@ -917,5 +918,6 @@ const zt = ({
|
|
|
917
918
|
] });
|
|
918
919
|
};
|
|
919
920
|
export {
|
|
920
|
-
zt as RadioButton
|
|
921
|
+
zt as RadioButton,
|
|
922
|
+
Ut as RadioOption
|
|
921
923
|
};
|