@vkzstudio/muza-ui 1.0.22 → 1.0.25

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.
@@ -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
- /** Shared props for the Calendar component, common to both single and range modes. */
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,28 @@ 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;
70
+ /** Minimum number of days in a range selection. Passed directly to react-day-picker. */
71
+ min?: number;
72
+ /** When true, a selection is always required and the calendar cannot be deselected. @default true */
73
+ required?: boolean;
48
74
  };
49
75
  /** Props for date range selection mode. */
50
76
  export type CalendarRangeProps = {
@@ -52,8 +78,8 @@ export type CalendarRangeProps = {
52
78
  mode: 'range';
53
79
  /** Currently selected date range. */
54
80
  selected?: DateRange | undefined;
55
- /** Fires when the selected range changes. */
56
- onSelect?: (range: DateRange) => void;
81
+ /** Fires when the selected range changes, or `undefined` when deselected (requires `required={false}`). */
82
+ onSelect?: (range: DateRange | undefined) => void;
57
83
  };
58
84
  /** Props for single date selection mode. */
59
85
  export type CalendarSingleProps = {
@@ -61,11 +87,14 @@ export type CalendarSingleProps = {
61
87
  mode: 'single';
62
88
  /** Currently selected date. */
63
89
  selected?: Date | undefined;
64
- /** Fires when a single date is selected. */
65
- onSelect?: (date: Date) => void;
90
+ /** Fires when a single date is selected, or `undefined` when deselected (requires `required={false}`). */
91
+ onSelect?: (date: Date | undefined) => void;
66
92
  };
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>) => import("react/jsx-runtime").JSX.Element;
93
+ 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, min, required, }: CalendarProps) => import("react/jsx-runtime").JSX.Element;
94
+ declare const CalendarBase: ({ className, classNames, showOutsideDays, captionLayout, formatters, components, locale, hideCaption, hideWeekdays, ...props }: React.ComponentProps<typeof DayPicker> & {
95
+ hideCaption?: boolean;
96
+ hideWeekdays?: boolean;
97
+ }) => import("react/jsx-runtime").JSX.Element;
69
98
  declare const CalendarDayButton: ({ className, day, modifiers, children, disabled, ...props }: React.ComponentProps<typeof DayButton>) => import("react/jsx-runtime").JSX.Element;
70
99
  export { Calendar, CalendarBase, CalendarDayButton };
71
100
  //# 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,sFAAsF;AACtF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,+CAA+C;IAC/C,cAAc,EAAE,CAAC,GAAG,CAAC,CAAA;IACrB,0EAA0E;IAC1E,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACnC,wDAAwD;IACxD,YAAY,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;IAC/B,gDAAgD;IAChD,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAA;IACzC,iFAAiF;IACjF,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,gEAAgE;IAChE,mBAAmB,CAAC,EAAE,MAAM,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ACd,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;IAC3B,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAA;CAC5C,CAAA;AAED,QAAA,MAAM,QAAQ,GAAI,qeA8Bf,aAAa,4CAsHf,CAAA;AAED,QAAA,MAAM,YAAY,GAAI,gIAWnB,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG;IAC1C,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,4CA0QA,CAAA;AAED,QAAA,MAAM,iBAAiB,GAAI,6DAOxB,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,4CAqDxC,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAA"}
@@ -1,121 +1,165 @@
1
- import { jsxs as g, jsx as r } from "react/jsx-runtime";
2
- import * as _ from "react";
3
- import { formatDate as L } from "./utils/formatDate.js";
4
- import { formatDateRange as R } from "./utils/formatDateRange.js";
5
- import { useMuzaTranslationContext as S } from "../../translations/TranslationContext.js";
6
- import { Button as k } from "../Button/Button.js";
7
- import { getDefaultClassNames as N } from "../../node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js";
8
- import { DayPicker as q } from "../../node_modules/react-day-picker/dist/esm/DayPicker.js";
1
+ import { jsxs as p, jsx as r } from "react/jsx-runtime";
2
+ import * as R from "react";
3
+ import { formatDate as I } from "./utils/formatDate.js";
4
+ import { formatDateRange as J } from "./utils/formatDateRange.js";
5
+ import { useMuzaTranslationContext as K } from "../../translations/TranslationContext.js";
6
+ import { Button as W } from "../Button/Button.js";
7
+ import { getDefaultClassNames as E } from "../../node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js";
8
+ import { DayPicker as P } from "../../node_modules/react-day-picker/dist/esm/DayPicker.js";
9
9
  import { cn as e } from "../../utils/cn.js";
10
- import { Typography as p, typographyVariants as y } from "../Typography/Typography.js";
11
- import { AltArrowLeftOutline as W, AltArrowRightOutline as Y, AltArrowDownOutline as E } from "@solar-icons/react-perf";
12
- const U = ({
13
- leftPanelChildren: u,
14
- defaultMonth: c,
15
- numberOfMonths: o,
16
- mode: l,
17
- selected: a,
18
- onSelect: m,
19
- onReset: s,
20
- onConfirm: f,
21
- resetButtonText: t,
22
- confirmButtonText: b,
23
- renderResetButton: n,
24
- renderConfirmButton: d,
25
- bottomTextDefault: i,
26
- dateFormatter: D = L,
27
- dateRangeFormatter: j = R,
28
- disabledDates: w,
29
- weekStartsOn: h = 1,
30
- excludeDisabled: C
10
+ import { Typography as x, typographyVariants as v } from "../Typography/Typography.js";
11
+ import { AltArrowLeftOutline as Q, AltArrowRightOutline as U, AltArrowDownOutline as X } from "@solar-icons/react-perf";
12
+ const se = ({
13
+ leftPanelChildren: m,
14
+ defaultMonth: f,
15
+ numberOfMonths: n,
16
+ mode: i,
17
+ selected: d,
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: o = I,
27
+ dateRangeFormatter: s = J,
28
+ disabledDates: h,
29
+ weekStartsOn: _ = 1,
30
+ excludeDisabled: F,
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,
40
+ min: G,
41
+ required: L = !0
31
42
  }) => {
32
- const { translations: x, dateFnsLocale: v } = S(), T = t ?? x.calendar.resetButton, B = b ?? x.calendar.confirmButton, A = i ?? x.calendar.bottomTextDefault;
33
- return /* @__PURE__ */ g("div", { className: "flex", children: [
34
- u && /* @__PURE__ */ r("div", { className: "flex flex-col border-r border-stroke-base-primary py-sm", children: u }),
35
- /* @__PURE__ */ g("div", { className: "mt-2xl flex flex-col justify-between", children: [
36
- l === "range" ? /* @__PURE__ */ r(
37
- z,
43
+ const { translations: w, dateFnsLocale: S } = K(), V = u ?? w.calendar.resetButton, q = y ?? w.calendar.confirmButton, H = a ?? w.calendar.bottomTextDefault;
44
+ return /* @__PURE__ */ p("div", { className: "flex", children: [
45
+ m && /* @__PURE__ */ r("div", { className: "flex flex-col border-r border-stroke-base-primary py-sm", children: m }),
46
+ /* @__PURE__ */ p("div", { className: "mt-2xl flex flex-col justify-between", children: [
47
+ i === "range" ? /* @__PURE__ */ r(
48
+ Y,
38
49
  {
39
- numberOfMonths: o,
40
- defaultMonth: c,
50
+ numberOfMonths: n,
51
+ defaultMonth: f,
41
52
  mode: "range",
42
- selected: a,
43
- onSelect: m,
44
- required: !0,
45
- weekStartsOn: h,
46
- disabled: w,
47
- excludeDisabled: C,
48
- locale: v
53
+ selected: d,
54
+ onSelect: g,
55
+ required: L,
56
+ weekStartsOn: _,
57
+ disabled: h,
58
+ excludeDisabled: F,
59
+ locale: S,
60
+ hideNavigation: k,
61
+ hideCaption: N,
62
+ hideWeekdays: j,
63
+ showOutsideDays: D,
64
+ formatters: z,
65
+ startMonth: A,
66
+ endMonth: B,
67
+ min: G
49
68
  }
50
69
  ) : /* @__PURE__ */ r(
51
- z,
70
+ Y,
52
71
  {
53
- numberOfMonths: o,
54
- defaultMonth: c,
72
+ numberOfMonths: n,
73
+ defaultMonth: f,
55
74
  mode: "single",
56
- selected: a,
57
- onSelect: m,
58
- required: !0,
59
- weekStartsOn: h,
60
- disabled: w,
61
- locale: v
75
+ selected: d,
76
+ onSelect: g,
77
+ required: L,
78
+ weekStartsOn: _,
79
+ disabled: h,
80
+ locale: S,
81
+ hideNavigation: k,
82
+ hideCaption: N,
83
+ hideWeekdays: j,
84
+ showOutsideDays: D,
85
+ startMonth: A,
86
+ endMonth: B,
87
+ formatters: z
62
88
  }
63
89
  ),
64
- /* @__PURE__ */ g(
90
+ /* @__PURE__ */ p(
65
91
  "div",
66
92
  {
67
93
  className: e(
68
94
  "mx-xl mt-lg mb-4 flex items-center justify-between",
69
- "max-lg:flex-col max-lg:items-start max-lg:border-t max-lg:border-stroke-base-primary max-lg:pt-lg"
95
+ {
96
+ "flex-col items-start border-t border-stroke-base-primary pt-lg": n === 1
97
+ },
98
+ {
99
+ "max-lg:flex-col max-lg:items-start max-lg:border-t max-lg:border-stroke-base-primary max-lg:pt-lg": n !== 1
100
+ }
70
101
  ),
71
102
  children: [
72
- /* @__PURE__ */ r(
73
- p,
103
+ !C && /* @__PURE__ */ r(
104
+ x,
74
105
  {
75
106
  component: "span",
76
107
  variant: "body",
77
108
  weight: "medium",
78
109
  size: "base",
79
- children: l === "range" && (a != null && a.from) && (a != null && a.to) ? j(a) : l === "single" && a ? D(a) : A
110
+ children: i === "range" && (d != null && d.from) ? s(d) : i === "single" && d ? o(d) : H
80
111
  }
81
112
  ),
82
- /* @__PURE__ */ g("div", { className: "flex gap-2xl max-lg:w-full max-lg:justify-between max-lg:gap-0 max-lg:pt-lg", children: [
83
- n ? n() : /* @__PURE__ */ r(k, { variant: "link", onClick: s, children: T }),
84
- d ? d() : /* @__PURE__ */ r(k, { variant: "primary", size: "sm", onClick: f, children: B })
85
- ] })
113
+ /* @__PURE__ */ p(
114
+ "div",
115
+ {
116
+ className: e("flex gap-2xl", {
117
+ "w-full justify-between gap-0": n === 1,
118
+ "pt-lg": n === 1 && !C,
119
+ "max-lg:w-full max-lg:justify-between max-lg:gap-0 max-lg:pt-lg": n !== 1,
120
+ "justify-end": T
121
+ }),
122
+ children: [
123
+ !T && (t ? t() : /* @__PURE__ */ r(W, { variant: "link", onClick: l, children: V })),
124
+ b ? b() : /* @__PURE__ */ r(W, { variant: "primary", size: "sm", onClick: c, children: q })
125
+ ]
126
+ }
127
+ )
86
128
  ]
87
129
  }
88
130
  )
89
131
  ] })
90
132
  ] });
91
- }, z = ({
92
- className: u,
93
- classNames: c,
94
- showOutsideDays: o = !0,
95
- captionLayout: l = "label",
96
- formatters: a,
97
- components: m,
98
- locale: s,
99
- ...f
133
+ }, Y = ({
134
+ className: m,
135
+ classNames: f,
136
+ showOutsideDays: n = !0,
137
+ captionLayout: i = "label",
138
+ formatters: d,
139
+ components: g,
140
+ locale: l,
141
+ hideCaption: c,
142
+ hideWeekdays: u,
143
+ ...y
100
144
  }) => {
101
- const t = N(), b = (s == null ? void 0 : s.code) ?? "default";
145
+ const t = E(), b = (l == null ? void 0 : l.code) ?? "default";
102
146
  return /* @__PURE__ */ r(
103
- q,
147
+ P,
104
148
  {
105
- showOutsideDays: o,
106
- locale: s,
149
+ showOutsideDays: n,
150
+ locale: l,
107
151
  className: e(
108
152
  "[[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
109
153
  String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
110
154
  String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
111
- u
155
+ m
112
156
  ),
113
- captionLayout: l,
157
+ captionLayout: i,
114
158
  formatters: {
115
- formatMonthDropdown: (n) => n.toLocaleString(b, { month: "short" }),
116
- formatWeekdayName: (n) => n.toLocaleString(b, { weekday: "short" }),
117
- formatCaption: (n) => n.toLocaleString(b, { month: "long", year: "numeric" }),
118
- ...a
159
+ formatMonthDropdown: (a) => a.toLocaleString(b, { month: "short" }),
160
+ formatWeekdayName: (a) => a.toLocaleString(b, { weekday: "short" }),
161
+ formatCaption: (a) => a.toLocaleString(b, { month: "long", year: "numeric" }),
162
+ ...d
119
163
  },
120
164
  classNames: {
121
165
  root: e("w-fit", t.root),
@@ -125,7 +169,8 @@ const U = ({
125
169
  ),
126
170
  month: e("flex flex-col w-full gap-lg px-lg", t.month),
127
171
  nav: e(
128
- "flex px-lg items-center gap-1 w-full absolute top-0 inset-x-0 justify-between pb-md border-b border-stroke-base-primary",
172
+ "flex px-lg items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
173
+ !c && "pb-md border-b border-stroke-base-primary",
129
174
  t.nav
130
175
  ),
131
176
  button_previous: e(
@@ -138,6 +183,7 @@ const U = ({
138
183
  ),
139
184
  month_caption: e(
140
185
  "flex items-center justify-center pb-md w-full",
186
+ c && "hidden",
141
187
  t.month_caption
142
188
  ),
143
189
  dropdowns: e(
@@ -153,7 +199,7 @@ const U = ({
153
199
  t.dropdown
154
200
  ),
155
201
  caption_label: e(
156
- y({
202
+ v({
157
203
  variant: "title",
158
204
  weight: "medium",
159
205
  size: "md",
@@ -163,9 +209,13 @@ const U = ({
163
209
  t.caption_label
164
210
  ),
165
211
  table: "w-full border-collapse",
166
- weekdays: e("flex mb-sm", t.weekdays),
212
+ weekdays: e(
213
+ "flex mb-sm",
214
+ u && "hidden",
215
+ t.weekdays
216
+ ),
167
217
  weekday: e(
168
- y({
218
+ v({
169
219
  variant: "body",
170
220
  weight: "medium",
171
221
  size: "caption"
@@ -186,7 +236,7 @@ const U = ({
186
236
  t.week_number
187
237
  ),
188
238
  day: e(
189
- y({
239
+ v({
190
240
  variant: "body",
191
241
  weight: "regular",
192
242
  size: "base"
@@ -215,98 +265,126 @@ const U = ({
215
265
  t.disabled
216
266
  ),
217
267
  hidden: e("invisible", t.hidden),
218
- ...c
268
+ ...f
219
269
  },
220
270
  components: {
221
271
  Root: ({
222
- className: n,
223
- rootRef: d,
224
- ...i
272
+ className: a,
273
+ rootRef: o,
274
+ ...s
225
275
  }) => /* @__PURE__ */ r(
226
276
  "div",
227
277
  {
228
278
  "data-slot": "calendar",
229
- ref: d,
230
- className: n,
231
- ...i
279
+ ref: o,
280
+ className: a,
281
+ ...s
232
282
  }
233
283
  ),
234
284
  Chevron: ({
235
- className: n,
236
- orientation: d,
237
- ...i
238
- }) => d === "left" ? /* @__PURE__ */ r(
239
- p,
285
+ className: a,
286
+ orientation: o,
287
+ ...s
288
+ }) => o === "left" ? /* @__PURE__ */ r(
289
+ x,
240
290
  {
241
291
  component: "span",
242
292
  variant: "title",
243
293
  weight: "medium",
244
294
  size: "md",
245
295
  children: /* @__PURE__ */ r(
246
- W,
296
+ Q,
247
297
  {
248
298
  className: e(
249
299
  "inline size-comp-calendar-ico-size text-comp-select-icon-brand-def",
250
- n
300
+ a
251
301
  ),
252
- ...i
302
+ ...s
253
303
  }
254
304
  )
255
305
  }
256
- ) : d === "right" ? /* @__PURE__ */ r(
257
- p,
306
+ ) : o === "right" ? /* @__PURE__ */ r(
307
+ x,
258
308
  {
259
309
  component: "span",
260
310
  variant: "title",
261
311
  weight: "medium",
262
312
  size: "md",
263
313
  children: /* @__PURE__ */ r(
264
- Y,
314
+ U,
265
315
  {
266
316
  className: e(
267
317
  "inline size-comp-calendar-ico-size text-comp-select-icon-brand-def",
268
- n
318
+ a
269
319
  ),
270
- ...i
320
+ ...s
271
321
  }
272
322
  )
273
323
  }
274
324
  ) : /* @__PURE__ */ r(
275
- E,
325
+ X,
276
326
  {
277
- className: e("size-comp-calendar-ico-size", n),
278
- ...i
327
+ className: e("size-comp-calendar-ico-size", a),
328
+ ...s
279
329
  }
280
330
  ),
281
- DayButton: F,
282
- WeekNumber: ({ children: n, ...d }) => /* @__PURE__ */ r("td", { ...d, children: /* @__PURE__ */ r("div", { className: "flex items-center justify-center text-center", children: n }) }),
283
- ...m
331
+ DayButton: Z,
332
+ WeekNumber: ({ children: a, ...o }) => /* @__PURE__ */ r("td", { ...o, children: /* @__PURE__ */ r("div", { className: "flex items-center justify-center text-center", children: a }) }),
333
+ ...g,
334
+ // When weekdays are hidden, replace the table-based layout (table > tbody > tr > td)
335
+ // with a CSS Grid to create a continuous day flow. Without this, months starting
336
+ // mid-week have invisible gap cells from outside days. The grid approach:
337
+ // - MonthGrid: table → div (keeps className for DayPicker styling)
338
+ // - Weeks: tbody → 7-column CSS grid (discards original className)
339
+ // - Week: tr → display:contents (children flow directly into parent grid)
340
+ // - Day: td → div, outside days hidden via display:none (no gap cells)
341
+ // Spread after `...components` so the grid layout always takes effect.
342
+ ...u && {
343
+ MonthGrid: ({
344
+ className: a,
345
+ ...o
346
+ }) => /* @__PURE__ */ r("div", { className: a, role: "grid", ...o }),
347
+ Weeks: ({
348
+ className: a,
349
+ ...o
350
+ }) => /* @__PURE__ */ r("div", { className: "grid grid-cols-7", ...o }),
351
+ Week: ({
352
+ week: a,
353
+ className: o,
354
+ ...s
355
+ }) => /* @__PURE__ */ r("div", { className: "contents", ...s }),
356
+ Day: ({
357
+ day: a,
358
+ modifiers: o,
359
+ ...s
360
+ }) => a.outside ? /* @__PURE__ */ r("div", { className: "hidden" }) : /* @__PURE__ */ r("div", { ...s })
361
+ }
284
362
  },
285
- ...f
363
+ ...y
286
364
  }
287
365
  );
288
- }, F = ({
289
- className: u,
290
- day: c,
291
- modifiers: o,
292
- children: l,
293
- disabled: a,
294
- ...m
366
+ }, Z = ({
367
+ className: m,
368
+ day: f,
369
+ modifiers: n,
370
+ children: i,
371
+ disabled: d,
372
+ ...g
295
373
  }) => {
296
- const s = N(), f = _.useRef(null);
297
- return _.useEffect(() => {
298
- var t;
299
- o.focused && ((t = f.current) == null || t.focus());
300
- }, [o.focused]), /* @__PURE__ */ r(
374
+ const l = E(), c = R.useRef(null);
375
+ return R.useEffect(() => {
376
+ var u;
377
+ n.focused && ((u = c.current) == null || u.focus());
378
+ }, [n.focused]), /* @__PURE__ */ r(
301
379
  "button",
302
380
  {
303
- ref: f,
304
- "data-day": c.date.toLocaleDateString(),
305
- "data-selected-single": o.selected && !o.range_start && !o.range_end && !o.range_middle,
306
- "data-range-start": o.range_start,
307
- "data-range-end": o.range_end,
308
- "data-range-middle": o.range_middle,
309
- disabled: a,
381
+ ref: c,
382
+ "data-day": f.date.toLocaleDateString(),
383
+ "data-selected-single": n.selected && !n.range_start && !n.range_end && !n.range_middle,
384
+ "data-range-start": n.range_start,
385
+ "data-range-end": n.range_end,
386
+ "data-range-middle": n.range_middle,
387
+ disabled: d,
310
388
  className: e(
311
389
  "relative size-full",
312
390
  'before:absolute before:inset-0 before:rounded-full before:transition-colors before:content-[""]',
@@ -318,14 +396,14 @@ const U = ({
318
396
  "group-data-[focused=true]/day:z-10",
319
397
  "outline-0",
320
398
  {
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": !a
399
+ "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": !d
322
400
  },
323
- s.day,
324
- u
401
+ l.day,
402
+ m
325
403
  ),
326
- ...m,
404
+ ...g,
327
405
  children: /* @__PURE__ */ r(
328
- p,
406
+ x,
329
407
  {
330
408
  variant: "body",
331
409
  weight: "regular",
@@ -333,14 +411,14 @@ const U = ({
333
411
  component: "span",
334
412
  fixY: !0,
335
413
  className: "relative z-1 block transition-colors",
336
- children: l
414
+ children: i
337
415
  }
338
416
  )
339
417
  }
340
418
  );
341
419
  };
342
420
  export {
343
- U as Calendar,
344
- z as CalendarBase,
345
- F as CalendarDayButton
421
+ se as Calendar,
422
+ Y as CalendarBase,
423
+ Z as CalendarDayButton
346
424
  };
@@ -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,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAKzC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAyEnC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAA;AAE1C,eAAO,MAAM,eAAe,EAAE,KAwB7B,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KA2BnB,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,KA6BhC,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,KA4BtC,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAiC3B,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KA8B/B,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,KAyBtC,CAAA"}
1
+ {"version":3,"file":"CalendarBase.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Calendar/CalendarBase.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAKzC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAyEnC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAA;AAE1C,eAAO,MAAM,eAAe,EAAE,KAwB7B,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KA2BnB,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,KA6BhC,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,KA4BtC,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAiC3B,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KA8B/B,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,KAyBtC,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KA0B9B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KA6BzB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"formatDateRange.d.ts","sourceRoot":"","sources":["../../../../src/components/Calendar/utils/formatDateRange.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,WAE/C,CAAA"}
1
+ {"version":3,"file":"formatDateRange.d.ts","sourceRoot":"","sources":["../../../../src/components/Calendar/utils/formatDateRange.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,WAI/C,CAAA"}
@@ -1,8 +1,5 @@
1
- import { format as y } from "date-fns";
2
- const e = (t) => {
3
- var o, r;
4
- return `${y(t.from ?? "", ((o = t.from) == null ? void 0 : o.getFullYear()) === ((r = t.to) == null ? void 0 : r.getFullYear()) ? "d. M." : "d. M. yyyy")} - ${y(t.to ?? "", "d. M. yyyy")}`;
5
- };
1
+ import { format as o } from "date-fns";
2
+ const r = (t) => t.from ? t.to ? `${o(t.from, t.from.getFullYear() === t.to.getFullYear() ? "d. M." : "d. M. yyyy")} - ${o(t.to, "d. M. yyyy")}` : o(t.from, "d. M. yyyy") : "";
6
3
  export {
7
- e as formatDateRange
4
+ r as formatDateRange
8
5
  };