@vkzstudio/muza-ui 1.0.22 → 1.0.23
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/components/Calendar/Calendar.d.ts +28 -3
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.js +209 -134
- package/dist/components/Calendar/CalendarBase.stories.d.ts +2 -0
- package/dist/components/Calendar/CalendarBase.stories.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +5 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +96 -77
- package/dist/components/DatePicker/DatePicker.stories.d.ts +3 -0
- package/dist/components/DatePicker/DatePicker.stories.d.ts.map +1 -1
- package/dist/muza-ui.css +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,11 @@ import * as React from 'react';
|
|
|
5
5
|
* Discriminated union on `mode`: `'single'` for picking one date, `'range'` for a start-end range.
|
|
6
6
|
*/
|
|
7
7
|
export type CalendarProps = CalendarBaseProps & (CalendarSingleProps | CalendarRangeProps);
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Shared props for the Calendar component, common to both single and range modes.
|
|
10
|
+
*
|
|
11
|
+
* These props are also inherited by {@link DatePickerProps} — see DatePicker for wrapper-specific props.
|
|
12
|
+
*/
|
|
9
13
|
export type CalendarBaseProps = {
|
|
10
14
|
/** Number of months displayed side by side. */
|
|
11
15
|
numberOfMonths: 1 | 2;
|
|
@@ -45,6 +49,24 @@ export type CalendarBaseProps = {
|
|
|
45
49
|
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
46
50
|
/** Excludes disabled dates from range selections. */
|
|
47
51
|
excludeDisabled?: boolean;
|
|
52
|
+
/** Hides the previous/next month navigation arrows. @default false */
|
|
53
|
+
hideNavigation?: boolean;
|
|
54
|
+
/** Hides the month/year caption header entirely. @default false */
|
|
55
|
+
hideCaption?: boolean;
|
|
56
|
+
/** Custom formatters for DayPicker elements (month caption, weekday names, etc.). */
|
|
57
|
+
formatters?: React.ComponentProps<typeof DayPicker>['formatters'];
|
|
58
|
+
/** Hides the weekday name headers (Mo, Tu, We…). @default false */
|
|
59
|
+
hideWeekdays?: boolean;
|
|
60
|
+
/** Shows days from adjacent months to fill the grid. @default true */
|
|
61
|
+
showOutsideDays?: boolean;
|
|
62
|
+
/** Hides the date/placeholder text in the bottom bar. @default false */
|
|
63
|
+
hideBottomText?: boolean;
|
|
64
|
+
/** Hides the reset button in the bottom bar. @default false */
|
|
65
|
+
hideResetButton?: boolean;
|
|
66
|
+
/** Earliest month for navigation. Navigation arrows are disabled before this month. */
|
|
67
|
+
startMonth?: Date;
|
|
68
|
+
/** Latest month for navigation. Navigation arrows are disabled after this month. */
|
|
69
|
+
endMonth?: Date;
|
|
48
70
|
};
|
|
49
71
|
/** Props for date range selection mode. */
|
|
50
72
|
export type CalendarRangeProps = {
|
|
@@ -64,8 +86,11 @@ export type CalendarSingleProps = {
|
|
|
64
86
|
/** Fires when a single date is selected. */
|
|
65
87
|
onSelect?: (date: Date) => void;
|
|
66
88
|
};
|
|
67
|
-
declare const Calendar: ({ leftPanelChildren, defaultMonth, numberOfMonths, mode, selected, onSelect, onReset, onConfirm, resetButtonText: resetButtonTextProp, confirmButtonText: confirmButtonTextProp, renderResetButton, renderConfirmButton, bottomTextDefault: bottomTextDefaultProp, dateFormatter, dateRangeFormatter, disabledDates, weekStartsOn, excludeDisabled, }: CalendarProps) => import("react/jsx-runtime").JSX.Element;
|
|
68
|
-
declare const CalendarBase: ({ className, classNames, showOutsideDays, captionLayout, formatters, components, locale, ...props }: React.ComponentProps<typeof DayPicker>
|
|
89
|
+
declare const Calendar: ({ leftPanelChildren, defaultMonth, numberOfMonths, mode, selected, onSelect, onReset, onConfirm, resetButtonText: resetButtonTextProp, confirmButtonText: confirmButtonTextProp, renderResetButton, renderConfirmButton, bottomTextDefault: bottomTextDefaultProp, dateFormatter, dateRangeFormatter, disabledDates, weekStartsOn, excludeDisabled, hideNavigation, hideCaption, formatters, hideWeekdays, showOutsideDays, hideBottomText, hideResetButton, startMonth, endMonth, }: CalendarProps) => import("react/jsx-runtime").JSX.Element;
|
|
90
|
+
declare const CalendarBase: ({ className, classNames, showOutsideDays, captionLayout, formatters, components, locale, hideCaption, hideWeekdays, ...props }: React.ComponentProps<typeof DayPicker> & {
|
|
91
|
+
hideCaption?: boolean;
|
|
92
|
+
hideWeekdays?: boolean;
|
|
93
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
69
94
|
declare const CalendarDayButton: ({ className, day, modifiers, children, disabled, ...props }: React.ComponentProps<typeof DayButton>) => import("react/jsx-runtime").JSX.Element;
|
|
70
95
|
export { Calendar, CalendarBase, CalendarDayButton };
|
|
71
96
|
//# sourceMappingURL=Calendar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../src/components/Calendar/Calendar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,KAAK,SAAS,EACd,SAAS,EACT,SAAS,EACT,KAAK,OAAO,EAEb,MAAM,kBAAkB,CAAA;AAazB;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,CAAA;AAE5C
|
|
1
|
+
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../src/components/Calendar/Calendar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,KAAK,SAAS,EACd,SAAS,EACT,SAAS,EACT,KAAK,OAAO,EAEb,MAAM,kBAAkB,CAAA;AAazB;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,CAAA;AAE5C;;;;G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,EAAE,CAAA"}
|
|
@@ -1,121 +1,162 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { formatDate as
|
|
4
|
-
import { formatDateRange as
|
|
5
|
-
import { useMuzaTranslationContext as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { getDefaultClassNames as
|
|
8
|
-
import { DayPicker as
|
|
1
|
+
import { jsxs as p, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as S from "react";
|
|
3
|
+
import { formatDate as V } from "./utils/formatDate.js";
|
|
4
|
+
import { formatDateRange as H } from "./utils/formatDateRange.js";
|
|
5
|
+
import { useMuzaTranslationContext as I } from "../../translations/TranslationContext.js";
|
|
6
|
+
import { Button as q } from "../Button/Button.js";
|
|
7
|
+
import { getDefaultClassNames as W } from "../../node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js";
|
|
8
|
+
import { DayPicker as J } from "../../node_modules/react-day-picker/dist/esm/DayPicker.js";
|
|
9
9
|
import { cn as e } from "../../utils/cn.js";
|
|
10
|
-
import { Typography as
|
|
11
|
-
import { AltArrowLeftOutline as
|
|
12
|
-
const
|
|
13
|
-
leftPanelChildren:
|
|
14
|
-
defaultMonth:
|
|
15
|
-
numberOfMonths:
|
|
16
|
-
mode:
|
|
17
|
-
selected:
|
|
18
|
-
onSelect:
|
|
19
|
-
onReset:
|
|
20
|
-
onConfirm:
|
|
21
|
-
resetButtonText:
|
|
22
|
-
confirmButtonText:
|
|
23
|
-
renderResetButton:
|
|
24
|
-
renderConfirmButton:
|
|
25
|
-
bottomTextDefault:
|
|
26
|
-
dateFormatter:
|
|
27
|
-
dateRangeFormatter:
|
|
28
|
-
disabledDates:
|
|
29
|
-
weekStartsOn:
|
|
30
|
-
excludeDisabled:
|
|
10
|
+
import { Typography as x, typographyVariants as v } from "../Typography/Typography.js";
|
|
11
|
+
import { AltArrowLeftOutline as K, AltArrowRightOutline as P, AltArrowDownOutline as Q } from "@solar-icons/react-perf";
|
|
12
|
+
const oe = ({
|
|
13
|
+
leftPanelChildren: m,
|
|
14
|
+
defaultMonth: f,
|
|
15
|
+
numberOfMonths: n,
|
|
16
|
+
mode: i,
|
|
17
|
+
selected: o,
|
|
18
|
+
onSelect: g,
|
|
19
|
+
onReset: l,
|
|
20
|
+
onConfirm: c,
|
|
21
|
+
resetButtonText: u,
|
|
22
|
+
confirmButtonText: y,
|
|
23
|
+
renderResetButton: t,
|
|
24
|
+
renderConfirmButton: b,
|
|
25
|
+
bottomTextDefault: a,
|
|
26
|
+
dateFormatter: d = V,
|
|
27
|
+
dateRangeFormatter: s = H,
|
|
28
|
+
disabledDates: h,
|
|
29
|
+
weekStartsOn: _ = 1,
|
|
30
|
+
excludeDisabled: Y,
|
|
31
|
+
hideNavigation: k,
|
|
32
|
+
hideCaption: N,
|
|
33
|
+
formatters: z,
|
|
34
|
+
hideWeekdays: j,
|
|
35
|
+
showOutsideDays: D,
|
|
36
|
+
hideBottomText: C,
|
|
37
|
+
hideResetButton: T,
|
|
38
|
+
startMonth: A,
|
|
39
|
+
endMonth: B
|
|
31
40
|
}) => {
|
|
32
|
-
const { translations:
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
const { translations: w, dateFnsLocale: L } = I(), E = u ?? w.calendar.resetButton, F = y ?? w.calendar.confirmButton, G = a ?? w.calendar.bottomTextDefault;
|
|
42
|
+
return /* @__PURE__ */ p("div", { className: "flex", children: [
|
|
43
|
+
m && /* @__PURE__ */ r("div", { className: "flex flex-col border-r border-stroke-base-primary py-sm", children: m }),
|
|
44
|
+
/* @__PURE__ */ p("div", { className: "mt-2xl flex flex-col justify-between", children: [
|
|
45
|
+
i === "range" ? /* @__PURE__ */ r(
|
|
46
|
+
R,
|
|
38
47
|
{
|
|
39
|
-
numberOfMonths:
|
|
40
|
-
defaultMonth:
|
|
48
|
+
numberOfMonths: n,
|
|
49
|
+
defaultMonth: f,
|
|
41
50
|
mode: "range",
|
|
42
|
-
selected:
|
|
43
|
-
onSelect:
|
|
51
|
+
selected: o,
|
|
52
|
+
onSelect: g,
|
|
44
53
|
required: !0,
|
|
45
|
-
weekStartsOn:
|
|
46
|
-
disabled:
|
|
47
|
-
excludeDisabled:
|
|
48
|
-
locale:
|
|
54
|
+
weekStartsOn: _,
|
|
55
|
+
disabled: h,
|
|
56
|
+
excludeDisabled: Y,
|
|
57
|
+
locale: L,
|
|
58
|
+
hideNavigation: k,
|
|
59
|
+
hideCaption: N,
|
|
60
|
+
hideWeekdays: j,
|
|
61
|
+
showOutsideDays: D,
|
|
62
|
+
formatters: z,
|
|
63
|
+
startMonth: A,
|
|
64
|
+
endMonth: B
|
|
49
65
|
}
|
|
50
66
|
) : /* @__PURE__ */ r(
|
|
51
|
-
|
|
67
|
+
R,
|
|
52
68
|
{
|
|
53
|
-
numberOfMonths:
|
|
54
|
-
defaultMonth:
|
|
69
|
+
numberOfMonths: n,
|
|
70
|
+
defaultMonth: f,
|
|
55
71
|
mode: "single",
|
|
56
|
-
selected:
|
|
57
|
-
onSelect:
|
|
72
|
+
selected: o,
|
|
73
|
+
onSelect: g,
|
|
58
74
|
required: !0,
|
|
59
|
-
weekStartsOn:
|
|
60
|
-
disabled:
|
|
61
|
-
locale:
|
|
75
|
+
weekStartsOn: _,
|
|
76
|
+
disabled: h,
|
|
77
|
+
locale: L,
|
|
78
|
+
hideNavigation: k,
|
|
79
|
+
hideCaption: N,
|
|
80
|
+
hideWeekdays: j,
|
|
81
|
+
showOutsideDays: D,
|
|
82
|
+
startMonth: A,
|
|
83
|
+
endMonth: B,
|
|
84
|
+
formatters: z
|
|
62
85
|
}
|
|
63
86
|
),
|
|
64
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ p(
|
|
65
88
|
"div",
|
|
66
89
|
{
|
|
67
90
|
className: e(
|
|
68
91
|
"mx-xl mt-lg mb-4 flex items-center justify-between",
|
|
69
|
-
|
|
92
|
+
{
|
|
93
|
+
"flex-col items-start border-t border-stroke-base-primary pt-lg": n === 1
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"max-lg:flex-col max-lg:items-start max-lg:border-t max-lg:border-stroke-base-primary max-lg:pt-lg": n !== 1
|
|
97
|
+
}
|
|
70
98
|
),
|
|
71
99
|
children: [
|
|
72
|
-
/* @__PURE__ */ r(
|
|
73
|
-
|
|
100
|
+
!C && /* @__PURE__ */ r(
|
|
101
|
+
x,
|
|
74
102
|
{
|
|
75
103
|
component: "span",
|
|
76
104
|
variant: "body",
|
|
77
105
|
weight: "medium",
|
|
78
106
|
size: "base",
|
|
79
|
-
children:
|
|
107
|
+
children: i === "range" && (o != null && o.from) && (o != null && o.to) ? s(o) : i === "single" && o ? d(o) : G
|
|
80
108
|
}
|
|
81
109
|
),
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
110
|
+
/* @__PURE__ */ p(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
className: e("flex gap-2xl", {
|
|
114
|
+
"w-full justify-between gap-0": n === 1,
|
|
115
|
+
"pt-lg": n === 1 && !C,
|
|
116
|
+
"max-lg:w-full max-lg:justify-between max-lg:gap-0 max-lg:pt-lg": n !== 1,
|
|
117
|
+
"justify-end": T
|
|
118
|
+
}),
|
|
119
|
+
children: [
|
|
120
|
+
!T && (t ? t() : /* @__PURE__ */ r(q, { variant: "link", onClick: l, children: E })),
|
|
121
|
+
b ? b() : /* @__PURE__ */ r(q, { variant: "primary", size: "sm", onClick: c, children: F })
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
)
|
|
86
125
|
]
|
|
87
126
|
}
|
|
88
127
|
)
|
|
89
128
|
] })
|
|
90
129
|
] });
|
|
91
|
-
},
|
|
92
|
-
className:
|
|
93
|
-
classNames:
|
|
94
|
-
showOutsideDays:
|
|
95
|
-
captionLayout:
|
|
96
|
-
formatters:
|
|
97
|
-
components:
|
|
98
|
-
locale:
|
|
99
|
-
|
|
130
|
+
}, R = ({
|
|
131
|
+
className: m,
|
|
132
|
+
classNames: f,
|
|
133
|
+
showOutsideDays: n = !0,
|
|
134
|
+
captionLayout: i = "label",
|
|
135
|
+
formatters: o,
|
|
136
|
+
components: g,
|
|
137
|
+
locale: l,
|
|
138
|
+
hideCaption: c,
|
|
139
|
+
hideWeekdays: u,
|
|
140
|
+
...y
|
|
100
141
|
}) => {
|
|
101
|
-
const t =
|
|
142
|
+
const t = W(), b = (l == null ? void 0 : l.code) ?? "default";
|
|
102
143
|
return /* @__PURE__ */ r(
|
|
103
|
-
|
|
144
|
+
J,
|
|
104
145
|
{
|
|
105
|
-
showOutsideDays:
|
|
106
|
-
locale:
|
|
146
|
+
showOutsideDays: n,
|
|
147
|
+
locale: l,
|
|
107
148
|
className: e(
|
|
108
149
|
"[[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
109
150
|
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
110
151
|
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
111
|
-
|
|
152
|
+
m
|
|
112
153
|
),
|
|
113
|
-
captionLayout:
|
|
154
|
+
captionLayout: i,
|
|
114
155
|
formatters: {
|
|
115
|
-
formatMonthDropdown: (
|
|
116
|
-
formatWeekdayName: (
|
|
117
|
-
formatCaption: (
|
|
118
|
-
...
|
|
156
|
+
formatMonthDropdown: (a) => a.toLocaleString(b, { month: "short" }),
|
|
157
|
+
formatWeekdayName: (a) => a.toLocaleString(b, { weekday: "short" }),
|
|
158
|
+
formatCaption: (a) => a.toLocaleString(b, { month: "long", year: "numeric" }),
|
|
159
|
+
...o
|
|
119
160
|
},
|
|
120
161
|
classNames: {
|
|
121
162
|
root: e("w-fit", t.root),
|
|
@@ -125,7 +166,8 @@ const U = ({
|
|
|
125
166
|
),
|
|
126
167
|
month: e("flex flex-col w-full gap-lg px-lg", t.month),
|
|
127
168
|
nav: e(
|
|
128
|
-
"flex px-lg items-center gap-1 w-full absolute top-0 inset-x-0 justify-between
|
|
169
|
+
"flex px-lg items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
|
|
170
|
+
!c && "pb-md border-b border-stroke-base-primary",
|
|
129
171
|
t.nav
|
|
130
172
|
),
|
|
131
173
|
button_previous: e(
|
|
@@ -138,6 +180,7 @@ const U = ({
|
|
|
138
180
|
),
|
|
139
181
|
month_caption: e(
|
|
140
182
|
"flex items-center justify-center pb-md w-full",
|
|
183
|
+
c && "hidden",
|
|
141
184
|
t.month_caption
|
|
142
185
|
),
|
|
143
186
|
dropdowns: e(
|
|
@@ -153,7 +196,7 @@ const U = ({
|
|
|
153
196
|
t.dropdown
|
|
154
197
|
),
|
|
155
198
|
caption_label: e(
|
|
156
|
-
|
|
199
|
+
v({
|
|
157
200
|
variant: "title",
|
|
158
201
|
weight: "medium",
|
|
159
202
|
size: "md",
|
|
@@ -163,9 +206,13 @@ const U = ({
|
|
|
163
206
|
t.caption_label
|
|
164
207
|
),
|
|
165
208
|
table: "w-full border-collapse",
|
|
166
|
-
weekdays: e(
|
|
209
|
+
weekdays: e(
|
|
210
|
+
"flex mb-sm",
|
|
211
|
+
u && "hidden",
|
|
212
|
+
t.weekdays
|
|
213
|
+
),
|
|
167
214
|
weekday: e(
|
|
168
|
-
|
|
215
|
+
v({
|
|
169
216
|
variant: "body",
|
|
170
217
|
weight: "medium",
|
|
171
218
|
size: "caption"
|
|
@@ -186,7 +233,7 @@ const U = ({
|
|
|
186
233
|
t.week_number
|
|
187
234
|
),
|
|
188
235
|
day: e(
|
|
189
|
-
|
|
236
|
+
v({
|
|
190
237
|
variant: "body",
|
|
191
238
|
weight: "regular",
|
|
192
239
|
size: "base"
|
|
@@ -215,98 +262,126 @@ const U = ({
|
|
|
215
262
|
t.disabled
|
|
216
263
|
),
|
|
217
264
|
hidden: e("invisible", t.hidden),
|
|
218
|
-
...
|
|
265
|
+
...f
|
|
219
266
|
},
|
|
220
267
|
components: {
|
|
221
268
|
Root: ({
|
|
222
|
-
className:
|
|
269
|
+
className: a,
|
|
223
270
|
rootRef: d,
|
|
224
|
-
...
|
|
271
|
+
...s
|
|
225
272
|
}) => /* @__PURE__ */ r(
|
|
226
273
|
"div",
|
|
227
274
|
{
|
|
228
275
|
"data-slot": "calendar",
|
|
229
276
|
ref: d,
|
|
230
|
-
className:
|
|
231
|
-
...
|
|
277
|
+
className: a,
|
|
278
|
+
...s
|
|
232
279
|
}
|
|
233
280
|
),
|
|
234
281
|
Chevron: ({
|
|
235
|
-
className:
|
|
282
|
+
className: a,
|
|
236
283
|
orientation: d,
|
|
237
|
-
...
|
|
284
|
+
...s
|
|
238
285
|
}) => d === "left" ? /* @__PURE__ */ r(
|
|
239
|
-
|
|
286
|
+
x,
|
|
240
287
|
{
|
|
241
288
|
component: "span",
|
|
242
289
|
variant: "title",
|
|
243
290
|
weight: "medium",
|
|
244
291
|
size: "md",
|
|
245
292
|
children: /* @__PURE__ */ r(
|
|
246
|
-
|
|
293
|
+
K,
|
|
247
294
|
{
|
|
248
295
|
className: e(
|
|
249
296
|
"inline size-comp-calendar-ico-size text-comp-select-icon-brand-def",
|
|
250
|
-
|
|
297
|
+
a
|
|
251
298
|
),
|
|
252
|
-
...
|
|
299
|
+
...s
|
|
253
300
|
}
|
|
254
301
|
)
|
|
255
302
|
}
|
|
256
303
|
) : d === "right" ? /* @__PURE__ */ r(
|
|
257
|
-
|
|
304
|
+
x,
|
|
258
305
|
{
|
|
259
306
|
component: "span",
|
|
260
307
|
variant: "title",
|
|
261
308
|
weight: "medium",
|
|
262
309
|
size: "md",
|
|
263
310
|
children: /* @__PURE__ */ r(
|
|
264
|
-
|
|
311
|
+
P,
|
|
265
312
|
{
|
|
266
313
|
className: e(
|
|
267
314
|
"inline size-comp-calendar-ico-size text-comp-select-icon-brand-def",
|
|
268
|
-
|
|
315
|
+
a
|
|
269
316
|
),
|
|
270
|
-
...
|
|
317
|
+
...s
|
|
271
318
|
}
|
|
272
319
|
)
|
|
273
320
|
}
|
|
274
321
|
) : /* @__PURE__ */ r(
|
|
275
|
-
|
|
322
|
+
Q,
|
|
276
323
|
{
|
|
277
|
-
className: e("size-comp-calendar-ico-size",
|
|
278
|
-
...
|
|
324
|
+
className: e("size-comp-calendar-ico-size", a),
|
|
325
|
+
...s
|
|
279
326
|
}
|
|
280
327
|
),
|
|
281
|
-
DayButton:
|
|
282
|
-
WeekNumber: ({ children:
|
|
283
|
-
...
|
|
328
|
+
DayButton: U,
|
|
329
|
+
WeekNumber: ({ children: a, ...d }) => /* @__PURE__ */ r("td", { ...d, children: /* @__PURE__ */ r("div", { className: "flex items-center justify-center text-center", children: a }) }),
|
|
330
|
+
...g,
|
|
331
|
+
// When weekdays are hidden, replace the table-based layout (table > tbody > tr > td)
|
|
332
|
+
// with a CSS Grid to create a continuous day flow. Without this, months starting
|
|
333
|
+
// mid-week have invisible gap cells from outside days. The grid approach:
|
|
334
|
+
// - MonthGrid: table → div (keeps className for DayPicker styling)
|
|
335
|
+
// - Weeks: tbody → 7-column CSS grid (discards original className)
|
|
336
|
+
// - Week: tr → display:contents (children flow directly into parent grid)
|
|
337
|
+
// - Day: td → div, outside days hidden via display:none (no gap cells)
|
|
338
|
+
// Spread after `...components` so the grid layout always takes effect.
|
|
339
|
+
...u && {
|
|
340
|
+
MonthGrid: ({
|
|
341
|
+
className: a,
|
|
342
|
+
...d
|
|
343
|
+
}) => /* @__PURE__ */ r("div", { className: a, role: "grid", ...d }),
|
|
344
|
+
Weeks: ({
|
|
345
|
+
className: a,
|
|
346
|
+
...d
|
|
347
|
+
}) => /* @__PURE__ */ r("div", { className: "grid grid-cols-7", ...d }),
|
|
348
|
+
Week: ({
|
|
349
|
+
week: a,
|
|
350
|
+
className: d,
|
|
351
|
+
...s
|
|
352
|
+
}) => /* @__PURE__ */ r("div", { className: "contents", ...s }),
|
|
353
|
+
Day: ({
|
|
354
|
+
day: a,
|
|
355
|
+
modifiers: d,
|
|
356
|
+
...s
|
|
357
|
+
}) => a.outside ? /* @__PURE__ */ r("div", { className: "hidden" }) : /* @__PURE__ */ r("div", { ...s })
|
|
358
|
+
}
|
|
284
359
|
},
|
|
285
|
-
...
|
|
360
|
+
...y
|
|
286
361
|
}
|
|
287
362
|
);
|
|
288
|
-
},
|
|
289
|
-
className:
|
|
290
|
-
day:
|
|
291
|
-
modifiers:
|
|
292
|
-
children:
|
|
293
|
-
disabled:
|
|
294
|
-
...
|
|
363
|
+
}, U = ({
|
|
364
|
+
className: m,
|
|
365
|
+
day: f,
|
|
366
|
+
modifiers: n,
|
|
367
|
+
children: i,
|
|
368
|
+
disabled: o,
|
|
369
|
+
...g
|
|
295
370
|
}) => {
|
|
296
|
-
const
|
|
297
|
-
return
|
|
298
|
-
var
|
|
299
|
-
|
|
300
|
-
}, [
|
|
371
|
+
const l = W(), c = S.useRef(null);
|
|
372
|
+
return S.useEffect(() => {
|
|
373
|
+
var u;
|
|
374
|
+
n.focused && ((u = c.current) == null || u.focus());
|
|
375
|
+
}, [n.focused]), /* @__PURE__ */ r(
|
|
301
376
|
"button",
|
|
302
377
|
{
|
|
303
|
-
ref:
|
|
304
|
-
"data-day":
|
|
305
|
-
"data-selected-single":
|
|
306
|
-
"data-range-start":
|
|
307
|
-
"data-range-end":
|
|
308
|
-
"data-range-middle":
|
|
309
|
-
disabled:
|
|
378
|
+
ref: c,
|
|
379
|
+
"data-day": f.date.toLocaleDateString(),
|
|
380
|
+
"data-selected-single": n.selected && !n.range_start && !n.range_end && !n.range_middle,
|
|
381
|
+
"data-range-start": n.range_start,
|
|
382
|
+
"data-range-end": n.range_end,
|
|
383
|
+
"data-range-middle": n.range_middle,
|
|
384
|
+
disabled: o,
|
|
310
385
|
className: e(
|
|
311
386
|
"relative size-full",
|
|
312
387
|
'before:absolute before:inset-0 before:rounded-full before:transition-colors before:content-[""]',
|
|
@@ -318,14 +393,14 @@ const U = ({
|
|
|
318
393
|
"group-data-[focused=true]/day:z-10",
|
|
319
394
|
"outline-0",
|
|
320
395
|
{
|
|
321
|
-
"hover:text-text-brand-def hover:before:bg-surface-brand-brand-tertiary focus-visible:text-text-brand-def focus-visible:focus-default focus-visible:before:bg-surface-brand-brand-tertiary": !
|
|
396
|
+
"hover:text-text-brand-def hover:before:bg-surface-brand-brand-tertiary focus-visible:text-text-brand-def focus-visible:focus-default focus-visible:before:bg-surface-brand-brand-tertiary": !o
|
|
322
397
|
},
|
|
323
|
-
|
|
324
|
-
|
|
398
|
+
l.day,
|
|
399
|
+
m
|
|
325
400
|
),
|
|
326
|
-
...
|
|
401
|
+
...g,
|
|
327
402
|
children: /* @__PURE__ */ r(
|
|
328
|
-
|
|
403
|
+
x,
|
|
329
404
|
{
|
|
330
405
|
variant: "body",
|
|
331
406
|
weight: "regular",
|
|
@@ -333,14 +408,14 @@ const U = ({
|
|
|
333
408
|
component: "span",
|
|
334
409
|
fixY: !0,
|
|
335
410
|
className: "relative z-1 block transition-colors",
|
|
336
|
-
children:
|
|
411
|
+
children: i
|
|
337
412
|
}
|
|
338
413
|
)
|
|
339
414
|
}
|
|
340
415
|
);
|
|
341
416
|
};
|
|
342
417
|
export {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
418
|
+
oe as Calendar,
|
|
419
|
+
R as CalendarBase,
|
|
420
|
+
U as CalendarDayButton
|
|
346
421
|
};
|
|
@@ -10,4 +10,6 @@ export declare const RangeCrossMonthSelection: Story;
|
|
|
10
10
|
export declare const DisabledDates: Story;
|
|
11
11
|
export declare const DisabledDateRange: Story;
|
|
12
12
|
export declare const CustomWeekStartsOnMonday: Story;
|
|
13
|
+
export declare const HiddenNavigation: Story;
|
|
14
|
+
export declare const DayGridOnly: Story;
|
|
13
15
|
//# sourceMappingURL=CalendarBase.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarBase.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Calendar/CalendarBase.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KA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MAAM,wBAAwB,EAAE,KAyBtC,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KA0B9B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KA6BzB,CAAA"}
|
|
@@ -7,6 +7,9 @@ import { Presets } from './utils/getDateRange';
|
|
|
7
7
|
*
|
|
8
8
|
* Uses a discriminated union on `mode` to type `value`, `defaultValue`,
|
|
9
9
|
* `onChange`, and `dateFormatter` for either single date or date range selection.
|
|
10
|
+
*
|
|
11
|
+
* Also inherits calendar layout/visibility props from {@link CalendarBaseProps}
|
|
12
|
+
* (e.g. `hideNavigation`, `hideCaption`, `showOutsideDays`, etc.).
|
|
10
13
|
*/
|
|
11
14
|
export type DatePickerProps = {
|
|
12
15
|
/** Controls horizontal alignment of the calendar popover relative to the trigger. */
|
|
@@ -72,6 +75,8 @@ export type DatePickerProps = {
|
|
|
72
75
|
required?: boolean;
|
|
73
76
|
/** Hides the required asterisk even when `required` is true. @default false */
|
|
74
77
|
disableRequiredAsterisk?: boolean;
|
|
78
|
+
/** Number of months to display side by side. @default 2 on desktop, 1 on mobile */
|
|
79
|
+
numberOfMonths?: 1 | 2;
|
|
75
80
|
} & Omit<CalendarBaseProps, 'numberOfMonths' | 'onConfirm' | 'onReset' | 'isExpanded' | 'leftPanelChildren' | 'bottomTextDefault' | 'dateFormatter' | 'dateRangeFormatter'> & (DatePickerRangeProps | DatePickerSingleProps);
|
|
76
81
|
/** Props for date range selection mode. */
|
|
77
82
|
export type DatePickerRangeProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAmC,MAAM,OAAO,CAAA;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAIjD,OAAO,EAEL,KAAK,iBAAiB,EAGvB,MAAM,aAAa,CAAA;AAKpB,OAAO,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