@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.
- package/dist/components/Calendar/Calendar.d.ts +36 -7
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.js +219 -141
- package/dist/components/Calendar/CalendarBase.stories.d.ts +2 -0
- package/dist/components/Calendar/CalendarBase.stories.d.ts.map +1 -1
- package/dist/components/Calendar/utils/formatDateRange.d.ts.map +1 -1
- package/dist/components/Calendar/utils/formatDateRange.js +3 -6
- package/dist/components/DatePicker/DatePicker.d.ts +15 -6
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +138 -109
- package/dist/components/DatePicker/DatePicker.stories.d.ts +6 -0
- package/dist/components/DatePicker/DatePicker.stories.d.ts.map +1 -1
- package/dist/components/DatePicker/utils/resolveOneDayRange.d.ts +13 -0
- package/dist/components/DatePicker/utils/resolveOneDayRange.d.ts.map +1 -0
- package/dist/components/DatePicker/utils/resolveOneDayRange.js +5 -0
- package/dist/muza-ui.css +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
/**
|
|
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
|
-
|
|
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,
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,52 +1,68 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { useIsDesktop as
|
|
4
|
-
import { useIsMobile as
|
|
5
|
-
import { Popover as
|
|
6
|
-
import { getDateRange as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
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:
|
|
17
|
-
mode:
|
|
18
|
-
allowedPresets:
|
|
19
|
-
dateFormatter:
|
|
20
|
-
value:
|
|
21
|
-
defaultValue:
|
|
22
|
-
open:
|
|
23
|
-
onOpenChange:
|
|
24
|
-
onChange:
|
|
25
|
-
classNames:
|
|
26
|
-
error:
|
|
27
|
-
disabled:
|
|
28
|
-
hint:
|
|
29
|
-
label:
|
|
30
|
-
placeholder:
|
|
31
|
-
avoidCollisions:
|
|
32
|
-
side:
|
|
33
|
-
renderCustomTrigger:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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:
|
|
49
|
-
|
|
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
|
-
|
|
75
|
+
o == null ? void 0 : o.leftPanelButton
|
|
60
76
|
),
|
|
61
77
|
onClick: () => {
|
|
62
|
-
const
|
|
63
|
-
|
|
78
|
+
const c = nt(t.type);
|
|
79
|
+
u(c), f && (p(c), r == null || r(c));
|
|
64
80
|
},
|
|
65
|
-
children:
|
|
81
|
+
children: t.name
|
|
66
82
|
},
|
|
67
|
-
|
|
68
|
-
)), D =
|
|
69
|
-
|
|
70
|
-
|
|
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:
|
|
73
|
-
onOpenChange: (
|
|
74
|
-
|
|
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__ */
|
|
78
|
-
|
|
110
|
+
/* @__PURE__ */ n(
|
|
111
|
+
pt,
|
|
79
112
|
{
|
|
80
|
-
className:
|
|
113
|
+
className: l(
|
|
81
114
|
"group cursor-pointer rounded-full text-left outline-0",
|
|
82
|
-
|
|
115
|
+
o == null ? void 0 : o.popoverTrigger
|
|
83
116
|
),
|
|
84
|
-
disabled:
|
|
85
|
-
children:
|
|
86
|
-
|
|
117
|
+
disabled: R,
|
|
118
|
+
children: S ? S() : /* @__PURE__ */ n(
|
|
119
|
+
ut,
|
|
87
120
|
{
|
|
88
|
-
ref:
|
|
89
|
-
value:
|
|
90
|
-
placeholder:
|
|
91
|
-
error:
|
|
92
|
-
disabled:
|
|
93
|
-
label:
|
|
94
|
-
hint:
|
|
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:
|
|
97
|
-
disableRequiredAsterisk:
|
|
98
|
-
className:
|
|
129
|
+
required: x,
|
|
130
|
+
disableRequiredAsterisk: W,
|
|
131
|
+
className: l(
|
|
99
132
|
"pointer-events-none",
|
|
100
|
-
|
|
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__ */
|
|
136
|
+
suffix: /* @__PURE__ */ n(lt, { className: "size-icon-medium text-icon-dark-secondary-def" })
|
|
104
137
|
}
|
|
105
138
|
)
|
|
106
139
|
}
|
|
107
140
|
),
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
|
|
141
|
+
/* @__PURE__ */ n(
|
|
142
|
+
ct,
|
|
110
143
|
{
|
|
111
|
-
className:
|
|
112
|
-
align:
|
|
113
|
-
side:
|
|
114
|
-
avoidCollisions:
|
|
115
|
-
onOpenAutoFocus: (
|
|
116
|
-
children:
|
|
117
|
-
|
|
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
|
-
...
|
|
152
|
+
...A,
|
|
120
153
|
mode: "single",
|
|
121
|
-
selected:
|
|
122
|
-
|
|
123
|
-
|
|
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__ */
|
|
133
|
-
|
|
160
|
+
) : /* @__PURE__ */ n(
|
|
161
|
+
Y,
|
|
134
162
|
{
|
|
135
|
-
...
|
|
163
|
+
...A,
|
|
136
164
|
mode: "range",
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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
|
-
|
|
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
|
-
|
|
186
|
+
mt.displayName = "DatePicker";
|
|
158
187
|
export {
|
|
159
|
-
|
|
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,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAI3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAKzC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,
|
|
1
|
+
{"version":3,"file":"DatePicker.stories.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAI3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAKzC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CA2LjC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAA;AAExC,eAAO,MAAM,iBAAiB,EAAE,KAoC/B,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAsB9B,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
|
+
};
|