@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.
@@ -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. */
@@ -68,11 +71,17 @@ export type DatePickerProps = {
68
71
  * When false or omitted, reset reverts to the last confirmed value.
69
72
  */
70
73
  shouldResetToDefaultValue?: boolean;
71
- /** Marks the field as required, displaying an asterisk on the label. */
74
+ /** When true, every calendar click calls onChange immediately. Buttons remain visible. Reset reverts to value when popover opened. */
75
+ immediateCommit?: boolean;
76
+ /** Range mode only. Replicates react-day-picker v8 range behavior (no longer natively supported in v9): first click sets start, second click sets end (same-day allowed). Clicking the same day again cycles back — when `required` is false the cycle is: selected → one-day range → cleared → selected; otherwise: selected → one-day range → selected. */
77
+ allowOneDayRange?: boolean;
78
+ /** Marks the field as required, displaying an asterisk on the label. Also passed to the underlying Calendar — when explicitly set to `false`, allows deselecting dates by clicking the selected date again. */
72
79
  required?: boolean;
73
80
  /** Hides the required asterisk even when `required` is true. @default false */
74
81
  disableRequiredAsterisk?: boolean;
75
- } & Omit<CalendarBaseProps, 'numberOfMonths' | 'onConfirm' | 'onReset' | 'isExpanded' | 'leftPanelChildren' | 'bottomTextDefault' | 'dateFormatter' | 'dateRangeFormatter'> & (DatePickerRangeProps | DatePickerSingleProps);
82
+ /** Number of months to display side by side. @default 2 on desktop, 1 on mobile */
83
+ numberOfMonths?: 1 | 2;
84
+ } & Omit<CalendarBaseProps, 'numberOfMonths' | 'onConfirm' | 'onReset' | 'isExpanded' | 'leftPanelChildren' | 'bottomTextDefault' | 'dateFormatter' | 'dateRangeFormatter' | 'required'> & (DatePickerRangeProps | DatePickerSingleProps);
76
85
  /** Props for date range selection mode. */
77
86
  export type DatePickerRangeProps = {
78
87
  /** Enables date range selection with start and end dates. */
@@ -81,8 +90,8 @@ export type DatePickerRangeProps = {
81
90
  value?: DateRange | undefined;
82
91
  /** Initial date range for uncontrolled usage. */
83
92
  defaultValue?: DateRange | undefined;
84
- /** Fires when a date range selection is confirmed. */
85
- onChange?: (date: DateRange) => void;
93
+ /** Fires when a date range selection is confirmed, or `undefined` when deselected (`required={false}`). */
94
+ onChange?: (date: DateRange | undefined) => void;
86
95
  /** Custom function to format the displayed date range string. */
87
96
  dateFormatter?: (date: DateRange) => string;
88
97
  };
@@ -94,8 +103,8 @@ export type DatePickerSingleProps = {
94
103
  value?: Date | undefined;
95
104
  /** Initial date for uncontrolled usage. */
96
105
  defaultValue?: Date | undefined;
97
- /** Fires when a single date selection is confirmed. */
98
- onChange?: (date: Date) => void;
106
+ /** Fires when a single date selection is confirmed, or `undefined` when deselected (`required={false}`). */
107
+ onChange?: (date: Date | undefined) => void;
99
108
  /** Custom function to format the displayed date string. */
100
109
  dateFormatter?: (date: Date) => string;
101
110
  };
@@ -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,EAAE,KAAK,OAAO,EAAgB,MAAM,sBAAsB,CAAA;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,qFAAqF;IACrF,aAAa,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,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e, jsxs as W } from "react/jsx-runtime";
2
- import { forwardRef as X, useState as l, useEffect as Z } from "react";
3
- import { useIsDesktop as _ } from "../../hooks/use-is-desktop.js";
4
- import { useIsMobile as $ } from "../../hooks/use-is-mobile.js";
5
- import { Popover as w, PopoverTrigger as T, PopoverContent as a } from "../Popover/Popover.js";
6
- import { getDateRange as s } from "./utils/getDateRange.js";
7
- import { Input as V } from "../Input/Input.js";
8
- import { formatDate as O } from "../Calendar/utils/formatDate.js";
9
- import { formatDateRange as h } from "../Calendar/utils/formatDateRange.js";
10
- import { Calendar as R } from "../Calendar/Calendar.js";
11
- import { cn as b } from "../../utils/cn.js";
12
- import { typographyVariants as C } from "../Typography/Typography.js";
13
- import { CalendarBold as N } from "@solar-icons/react-perf";
14
- const tt = X(
1
+ import { jsx as n, jsxs as tt } from "react/jsx-runtime";
2
+ import { forwardRef as rt, useState as k, useRef as E, useEffect as ot } from "react";
3
+ import { useIsDesktop as et } from "../../hooks/use-is-desktop.js";
4
+ import { useIsMobile as it } from "../../hooks/use-is-mobile.js";
5
+ import { Popover as ft, PopoverTrigger as pt, PopoverContent as ct } from "../Popover/Popover.js";
6
+ import { getDateRange as nt } from "./utils/getDateRange.js";
7
+ import { resolveOneDayRange as dt } from "./utils/resolveOneDayRange.js";
8
+ import { Input as ut } from "../Input/Input.js";
9
+ import { formatDate as bt } from "../Calendar/utils/formatDate.js";
10
+ import { formatDateRange as st } from "../Calendar/utils/formatDateRange.js";
11
+ import { Calendar as Y } from "../Calendar/Calendar.js";
12
+ import { cn as l } from "../../utils/cn.js";
13
+ import { typographyVariants as xt } from "../Typography/Typography.js";
14
+ import { CalendarBold as lt } from "@solar-icons/react-perf";
15
+ const mt = rt(
15
16
  ({
16
- alignCalendar: j,
17
- mode: v,
18
- allowedPresets: x,
19
- dateFormatter: z,
20
- value: n,
21
- defaultValue: p,
22
- open: d,
23
- onOpenChange: r,
24
- onChange: f,
25
- classNames: t,
26
- error: B,
27
- disabled: S,
28
- hint: A,
29
- label: E,
30
- placeholder: P,
31
- avoidCollisions: Y = !0,
32
- side: g = "bottom",
33
- renderCustomTrigger: I,
34
- shouldResetToDefaultValue: c,
35
- required: q,
36
- disableRequiredAsterisk: G,
37
- ...M
38
- }, H) => {
39
- const F = _(), J = $(), [K, y] = l(!1), L = typeof d == "boolean" ? d : K, [u, k] = l(
40
- n ?? p
41
- ), [o, m] = l(n ?? p);
42
- Z(() => {
43
- k(n), m(n);
44
- }, [n]);
45
- const Q = x == null ? void 0 : x.map((i) => /* @__PURE__ */ e(
17
+ alignCalendar: G,
18
+ mode: m,
19
+ allowedPresets: y,
20
+ dateFormatter: H,
21
+ value: e,
22
+ defaultValue: b,
23
+ open: s,
24
+ onOpenChange: d,
25
+ onChange: r,
26
+ classNames: o,
27
+ error: J,
28
+ disabled: R,
29
+ hint: K,
30
+ label: L,
31
+ placeholder: Q,
32
+ avoidCollisions: T = !0,
33
+ side: U = "bottom",
34
+ renderCustomTrigger: S,
35
+ immediateCommit: f,
36
+ allowOneDayRange: I,
37
+ shouldResetToDefaultValue: M,
38
+ required: x,
39
+ disableRequiredAsterisk: W,
40
+ numberOfMonths: X,
41
+ hideNavigation: Z,
42
+ hideCaption: _,
43
+ hideWeekdays: $,
44
+ showOutsideDays: V,
45
+ hideBottomText: q,
46
+ hideResetButton: w,
47
+ ...O
48
+ }, g) => {
49
+ const a = et(), N = it(), [h, P] = k(!1), F = typeof s == "boolean" ? s : h, [j, p] = k(
50
+ e ?? b
51
+ ), [i, u] = k(e ?? b), z = E(!1), v = E(
52
+ e ?? b
53
+ );
54
+ ot(() => {
55
+ if (!z.current) {
56
+ z.current = !0;
57
+ return;
58
+ }
59
+ p(e), u(e), F || (v.current = e);
60
+ }, [e]);
61
+ const C = y == null ? void 0 : y.map((t) => /* @__PURE__ */ n(
46
62
  "button",
47
63
  {
48
- className: b(
49
- C({
64
+ className: l(
65
+ xt({
50
66
  variant: "cta",
51
67
  weight: "medium",
52
68
  size: "sm",
@@ -56,94 +72,107 @@ const tt = X(
56
72
  "hover:bg-surface-brand-brand-tertiary hover:text-comp-button-tertiary-text-def",
57
73
  "outline-none focus-visible:bg-surface-brand-brand-tertiary focus-visible:text-comp-button-tertiary-text-def",
58
74
  "cursor-pointer",
59
- t == null ? void 0 : t.leftPanelButton
75
+ o == null ? void 0 : o.leftPanelButton
60
76
  ),
61
77
  onClick: () => {
62
- const U = s(i.type);
63
- m(U);
78
+ const c = nt(t.type);
79
+ u(c), f && (p(c), r == null || r(c));
64
80
  },
65
- children: i.name
81
+ children: t.name
66
82
  },
67
- i.type
68
- )), D = z ?? (v === "single" ? O : h);
69
- return /* @__PURE__ */ W(
70
- w,
83
+ t.type
84
+ )), D = H ?? (m === "single" ? bt : st), B = f ? e !== void 0 ? e : i : j, A = {
85
+ ...O,
86
+ numberOfMonths: X ?? (a ? 2 : 1),
87
+ hideNavigation: Z,
88
+ hideCaption: _,
89
+ hideWeekdays: $,
90
+ showOutsideDays: V,
91
+ hideBottomText: q,
92
+ hideResetButton: w,
93
+ required: x,
94
+ onReset: () => {
95
+ const t = M ? b : f ? v.current : j;
96
+ u(t), f && (p(t), r == null || r(t));
97
+ },
98
+ onConfirm: () => {
99
+ f ? p(i) : (i !== void 0 || M || x === !1) && (p(i), r == null || r(i)), s === void 0 && P(!1), d == null || d(!1);
100
+ }
101
+ };
102
+ return /* @__PURE__ */ tt(
103
+ ft,
71
104
  {
72
- open: L,
73
- onOpenChange: (i) => {
74
- d === void 0 && y(i), r == null || r(i);
105
+ open: F,
106
+ onOpenChange: (t) => {
107
+ t && (v.current = e ?? i), s === void 0 && P(t), d == null || d(t);
75
108
  },
76
109
  children: [
77
- /* @__PURE__ */ e(
78
- T,
110
+ /* @__PURE__ */ n(
111
+ pt,
79
112
  {
80
- className: b(
113
+ className: l(
81
114
  "group cursor-pointer rounded-full text-left outline-0",
82
- t == null ? void 0 : t.popoverTrigger
115
+ o == null ? void 0 : o.popoverTrigger
83
116
  ),
84
- disabled: S,
85
- children: I ? I() : /* @__PURE__ */ e(
86
- V,
117
+ disabled: R,
118
+ children: S ? S() : /* @__PURE__ */ n(
119
+ ut,
87
120
  {
88
- ref: H,
89
- value: u ? D(u) : "",
90
- placeholder: P,
91
- error: B,
92
- disabled: S,
93
- label: E,
94
- hint: A,
121
+ ref: g,
122
+ value: B ? D(B) : "",
123
+ placeholder: Q,
124
+ error: J,
125
+ disabled: R,
126
+ label: L,
127
+ hint: K,
95
128
  tabIndex: -1,
96
- required: q,
97
- disableRequiredAsterisk: G,
98
- className: b(
129
+ required: x,
130
+ disableRequiredAsterisk: W,
131
+ className: l(
99
132
  "pointer-events-none",
100
- t == null ? void 0 : t.input,
133
+ o == null ? void 0 : o.input,
101
134
  "group-hover:border-comp-input-stroke-hover group-focus-visible:border-comp-input-stroke-focused"
102
135
  ),
103
- suffix: /* @__PURE__ */ e(N, { className: "size-icon-medium text-icon-dark-secondary-def" })
136
+ suffix: /* @__PURE__ */ n(lt, { className: "size-icon-medium text-icon-dark-secondary-def" })
104
137
  }
105
138
  )
106
139
  }
107
140
  ),
108
- /* @__PURE__ */ e(
109
- a,
141
+ /* @__PURE__ */ n(
142
+ ct,
110
143
  {
111
- className: b("flex w-auto p-0", t == null ? void 0 : t.popoverContent),
112
- align: j,
113
- side: g,
114
- avoidCollisions: Y,
115
- onOpenAutoFocus: (i) => i.preventDefault(),
116
- children: v === "single" ? /* @__PURE__ */ e(
117
- R,
144
+ className: l("flex w-auto p-0", o == null ? void 0 : o.popoverContent),
145
+ align: G,
146
+ side: U,
147
+ avoidCollisions: T,
148
+ onOpenAutoFocus: (t) => t.preventDefault(),
149
+ children: m === "single" ? /* @__PURE__ */ n(
150
+ Y,
118
151
  {
119
- ...M,
152
+ ...A,
120
153
  mode: "single",
121
- selected: o,
122
- onReset: () => m(
123
- c ? p : u
124
- ),
125
- onSelect: m,
126
- onConfirm: () => {
127
- (o !== void 0 || c) && (k(o), f == null || f(o)), d === void 0 && y(!1), r == null || r(!1);
128
- },
129
- numberOfMonths: F ? 2 : 1,
154
+ selected: i,
155
+ onSelect: f ? (t) => {
156
+ u(t), p(t), r == null || r(t);
157
+ } : u,
130
158
  dateFormatter: D
131
159
  }
132
- ) : /* @__PURE__ */ e(
133
- R,
160
+ ) : /* @__PURE__ */ n(
161
+ Y,
134
162
  {
135
- ...M,
163
+ ...A,
136
164
  mode: "range",
137
- selected: o,
138
- onReset: () => m(
139
- c ? p : u
140
- ),
141
- onSelect: m,
142
- onConfirm: () => {
143
- (o !== void 0 || c) && (k(o), f == null || f(o)), d === void 0 && y(!1), r == null || r(!1);
165
+ min: I ? 1 : void 0,
166
+ selected: i,
167
+ onSelect: (t) => {
168
+ const c = I ? dt(
169
+ i,
170
+ t,
171
+ x
172
+ ) : t;
173
+ u(c), f && (p(c), r == null || r(c));
144
174
  },
145
- numberOfMonths: F ? 2 : 1,
146
- leftPanelChildren: v === "range" && !J && Q,
175
+ leftPanelChildren: m === "range" && !N && C,
147
176
  dateRangeFormatter: D
148
177
  }
149
178
  )
@@ -154,7 +183,7 @@ const tt = X(
154
183
  );
155
184
  }
156
185
  );
157
- tt.displayName = "DatePicker";
186
+ mt.displayName = "DatePicker";
158
187
  export {
159
- tt as DatePicker
188
+ mt as DatePicker
160
189
  };
@@ -15,4 +15,10 @@ export declare const ControlledDatePickerWithCustomTrigger: Story;
15
15
  export declare const ResetButtonResetsToUndefined: Story;
16
16
  export declare const ResetButtonResetsToStoryDate: Story;
17
17
  export declare const Required: Story;
18
+ export declare const SingleMonth: Story;
19
+ export declare const ImmediateCommitRange: Story;
20
+ export declare const AllowOneDayRange: Story;
21
+ export declare const NotRequired: Story;
22
+ export declare const MonthlyView: Story;
23
+ export declare const YearlyView: Story;
18
24
  //# sourceMappingURL=DatePicker.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.stories.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QA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,CAAA;AAED,eAAO,MAAM,0BAA0B,EAAE,KAuBxC,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KA0B7B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAwBtB,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KAwBnB,CAAA;AAED,eAAO,MAAM,0BAA0B,EAAE,KAyBxC,CAAA;AAED,eAAO,MAAM,2BAA2B,EAAE,KAmCzC,CAAA;AAED,eAAO,MAAM,qCAAqC,EAAE,KA8CnD,CAAA;AAED,eAAO,MAAM,4BAA4B,EAAE,KAyB1C,CAAA;AAED,eAAO,MAAM,4BAA4B,EAAE,KAyB1C,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KA0BtB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAwBzB,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE,KAkClC,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAkC9B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAoCzB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAqCzB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KA6CxB,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { DateRange } from 'react-day-picker';
2
+ /**
3
+ * Resolves same-day range selection cycling for `allowOneDayRange` mode.
4
+ *
5
+ * Replicates react-day-picker v8 behavior where same-day ranges are allowed.
6
+ * In v9, `min={1}` prevents same-day completion, so this function intercepts
7
+ * the raw rdp output and forces the correct result.
8
+ *
9
+ * Cycle with `required`: `{from}` → `{from,to=from}` → `{from}` → …
10
+ * Cycle with `!required`: `{from}` → `{from,to=from}` → `undefined` → …
11
+ */
12
+ export declare const resolveOneDayRange: (prev: DateRange | undefined, newRange: DateRange | undefined, required: boolean | undefined) => DateRange | undefined;
13
+ //# sourceMappingURL=resolveOneDayRange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveOneDayRange.d.ts","sourceRoot":"","sources":["../../../../src/components/DatePicker/utils/resolveOneDayRange.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,SAAS,GAAG,SAAS,EAC3B,UAAU,SAAS,GAAG,SAAS,EAC/B,UAAU,OAAO,GAAG,SAAS,KAC5B,SAAS,GAAG,SAqCd,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { isSameDay as m } from "date-fns";
2
+ const u = (o, f, t) => o != null && o.from && !(o != null && o.to) && !f ? { from: o.from, to: o.from } : o != null && o.from && !(o != null && o.to) && (f != null && f.from) && !(f != null && f.to) && m(o.from, f.from) ? { from: o.from, to: o.from } : o != null && o.from && (o != null && o.to) && m(o.from, o.to) && (f != null && f.from) && m(o.from, f.from) && (!(f != null && f.to) || m(o.from, f.to)) ? t === !1 ? void 0 : { from: o.from, to: void 0 } : f;
3
+ export {
4
+ u as resolveOneDayRange
5
+ };