@vkzstudio/muza-ui 1.0.23 → 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 +9 -5
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.js +61 -58
- 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 +10 -6
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +136 -126
- package/dist/components/DatePicker/DatePicker.stories.d.ts +3 -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/package.json +1 -1
|
@@ -67,6 +67,10 @@ export type CalendarBaseProps = {
|
|
|
67
67
|
startMonth?: Date;
|
|
68
68
|
/** Latest month for navigation. Navigation arrows are disabled after this month. */
|
|
69
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;
|
|
70
74
|
};
|
|
71
75
|
/** Props for date range selection mode. */
|
|
72
76
|
export type CalendarRangeProps = {
|
|
@@ -74,8 +78,8 @@ export type CalendarRangeProps = {
|
|
|
74
78
|
mode: 'range';
|
|
75
79
|
/** Currently selected date range. */
|
|
76
80
|
selected?: DateRange | undefined;
|
|
77
|
-
/** Fires when the selected range changes. */
|
|
78
|
-
onSelect?: (range: DateRange) => void;
|
|
81
|
+
/** Fires when the selected range changes, or `undefined` when deselected (requires `required={false}`). */
|
|
82
|
+
onSelect?: (range: DateRange | undefined) => void;
|
|
79
83
|
};
|
|
80
84
|
/** Props for single date selection mode. */
|
|
81
85
|
export type CalendarSingleProps = {
|
|
@@ -83,10 +87,10 @@ export type CalendarSingleProps = {
|
|
|
83
87
|
mode: 'single';
|
|
84
88
|
/** Currently selected date. */
|
|
85
89
|
selected?: Date | undefined;
|
|
86
|
-
/** Fires when a single date is selected. */
|
|
87
|
-
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;
|
|
88
92
|
};
|
|
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;
|
|
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;
|
|
90
94
|
declare const CalendarBase: ({ className, classNames, showOutsideDays, captionLayout, formatters, components, locale, hideCaption, hideWeekdays, ...props }: React.ComponentProps<typeof DayPicker> & {
|
|
91
95
|
hideCaption?: boolean;
|
|
92
96
|
hideWeekdays?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar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Date as
|
|
4
|
-
import { formatDateRange as
|
|
5
|
-
import { useMuzaTranslationContext as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { getDefaultClassNames as
|
|
8
|
-
import { DayPicker as
|
|
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
10
|
import { Typography as x, typographyVariants as v } from "../Typography/Typography.js";
|
|
11
|
-
import { AltArrowLeftOutline as
|
|
12
|
-
const
|
|
11
|
+
import { AltArrowLeftOutline as Q, AltArrowRightOutline as U, AltArrowDownOutline as X } from "@solar-icons/react-perf";
|
|
12
|
+
const se = ({
|
|
13
13
|
leftPanelChildren: m,
|
|
14
14
|
defaultMonth: f,
|
|
15
15
|
numberOfMonths: n,
|
|
16
16
|
mode: i,
|
|
17
|
-
selected:
|
|
17
|
+
selected: d,
|
|
18
18
|
onSelect: g,
|
|
19
19
|
onReset: l,
|
|
20
20
|
onConfirm: c,
|
|
@@ -23,11 +23,11 @@ const oe = ({
|
|
|
23
23
|
renderResetButton: t,
|
|
24
24
|
renderConfirmButton: b,
|
|
25
25
|
bottomTextDefault: a,
|
|
26
|
-
dateFormatter:
|
|
27
|
-
dateRangeFormatter: s =
|
|
26
|
+
dateFormatter: o = I,
|
|
27
|
+
dateRangeFormatter: s = J,
|
|
28
28
|
disabledDates: h,
|
|
29
29
|
weekStartsOn: _ = 1,
|
|
30
|
-
excludeDisabled:
|
|
30
|
+
excludeDisabled: F,
|
|
31
31
|
hideNavigation: k,
|
|
32
32
|
hideCaption: N,
|
|
33
33
|
formatters: z,
|
|
@@ -36,45 +36,48 @@ const oe = ({
|
|
|
36
36
|
hideBottomText: C,
|
|
37
37
|
hideResetButton: T,
|
|
38
38
|
startMonth: A,
|
|
39
|
-
endMonth: B
|
|
39
|
+
endMonth: B,
|
|
40
|
+
min: G,
|
|
41
|
+
required: L = !0
|
|
40
42
|
}) => {
|
|
41
|
-
const { translations: w, dateFnsLocale:
|
|
43
|
+
const { translations: w, dateFnsLocale: S } = K(), V = u ?? w.calendar.resetButton, q = y ?? w.calendar.confirmButton, H = a ?? w.calendar.bottomTextDefault;
|
|
42
44
|
return /* @__PURE__ */ p("div", { className: "flex", children: [
|
|
43
45
|
m && /* @__PURE__ */ r("div", { className: "flex flex-col border-r border-stroke-base-primary py-sm", children: m }),
|
|
44
46
|
/* @__PURE__ */ p("div", { className: "mt-2xl flex flex-col justify-between", children: [
|
|
45
47
|
i === "range" ? /* @__PURE__ */ r(
|
|
46
|
-
|
|
48
|
+
Y,
|
|
47
49
|
{
|
|
48
50
|
numberOfMonths: n,
|
|
49
51
|
defaultMonth: f,
|
|
50
52
|
mode: "range",
|
|
51
|
-
selected:
|
|
53
|
+
selected: d,
|
|
52
54
|
onSelect: g,
|
|
53
|
-
required:
|
|
55
|
+
required: L,
|
|
54
56
|
weekStartsOn: _,
|
|
55
57
|
disabled: h,
|
|
56
|
-
excludeDisabled:
|
|
57
|
-
locale:
|
|
58
|
+
excludeDisabled: F,
|
|
59
|
+
locale: S,
|
|
58
60
|
hideNavigation: k,
|
|
59
61
|
hideCaption: N,
|
|
60
62
|
hideWeekdays: j,
|
|
61
63
|
showOutsideDays: D,
|
|
62
64
|
formatters: z,
|
|
63
65
|
startMonth: A,
|
|
64
|
-
endMonth: B
|
|
66
|
+
endMonth: B,
|
|
67
|
+
min: G
|
|
65
68
|
}
|
|
66
69
|
) : /* @__PURE__ */ r(
|
|
67
|
-
|
|
70
|
+
Y,
|
|
68
71
|
{
|
|
69
72
|
numberOfMonths: n,
|
|
70
73
|
defaultMonth: f,
|
|
71
74
|
mode: "single",
|
|
72
|
-
selected:
|
|
75
|
+
selected: d,
|
|
73
76
|
onSelect: g,
|
|
74
|
-
required:
|
|
77
|
+
required: L,
|
|
75
78
|
weekStartsOn: _,
|
|
76
79
|
disabled: h,
|
|
77
|
-
locale:
|
|
80
|
+
locale: S,
|
|
78
81
|
hideNavigation: k,
|
|
79
82
|
hideCaption: N,
|
|
80
83
|
hideWeekdays: j,
|
|
@@ -104,7 +107,7 @@ const oe = ({
|
|
|
104
107
|
variant: "body",
|
|
105
108
|
weight: "medium",
|
|
106
109
|
size: "base",
|
|
107
|
-
children: i === "range" && (
|
|
110
|
+
children: i === "range" && (d != null && d.from) ? s(d) : i === "single" && d ? o(d) : H
|
|
108
111
|
}
|
|
109
112
|
),
|
|
110
113
|
/* @__PURE__ */ p(
|
|
@@ -117,8 +120,8 @@ const oe = ({
|
|
|
117
120
|
"justify-end": T
|
|
118
121
|
}),
|
|
119
122
|
children: [
|
|
120
|
-
!T && (t ? t() : /* @__PURE__ */ r(
|
|
121
|
-
b ? b() : /* @__PURE__ */ r(
|
|
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 })
|
|
122
125
|
]
|
|
123
126
|
}
|
|
124
127
|
)
|
|
@@ -127,21 +130,21 @@ const oe = ({
|
|
|
127
130
|
)
|
|
128
131
|
] })
|
|
129
132
|
] });
|
|
130
|
-
},
|
|
133
|
+
}, Y = ({
|
|
131
134
|
className: m,
|
|
132
135
|
classNames: f,
|
|
133
136
|
showOutsideDays: n = !0,
|
|
134
137
|
captionLayout: i = "label",
|
|
135
|
-
formatters:
|
|
138
|
+
formatters: d,
|
|
136
139
|
components: g,
|
|
137
140
|
locale: l,
|
|
138
141
|
hideCaption: c,
|
|
139
142
|
hideWeekdays: u,
|
|
140
143
|
...y
|
|
141
144
|
}) => {
|
|
142
|
-
const t =
|
|
145
|
+
const t = E(), b = (l == null ? void 0 : l.code) ?? "default";
|
|
143
146
|
return /* @__PURE__ */ r(
|
|
144
|
-
|
|
147
|
+
P,
|
|
145
148
|
{
|
|
146
149
|
showOutsideDays: n,
|
|
147
150
|
locale: l,
|
|
@@ -156,7 +159,7 @@ const oe = ({
|
|
|
156
159
|
formatMonthDropdown: (a) => a.toLocaleString(b, { month: "short" }),
|
|
157
160
|
formatWeekdayName: (a) => a.toLocaleString(b, { weekday: "short" }),
|
|
158
161
|
formatCaption: (a) => a.toLocaleString(b, { month: "long", year: "numeric" }),
|
|
159
|
-
...
|
|
162
|
+
...d
|
|
160
163
|
},
|
|
161
164
|
classNames: {
|
|
162
165
|
root: e("w-fit", t.root),
|
|
@@ -267,22 +270,22 @@ const oe = ({
|
|
|
267
270
|
components: {
|
|
268
271
|
Root: ({
|
|
269
272
|
className: a,
|
|
270
|
-
rootRef:
|
|
273
|
+
rootRef: o,
|
|
271
274
|
...s
|
|
272
275
|
}) => /* @__PURE__ */ r(
|
|
273
276
|
"div",
|
|
274
277
|
{
|
|
275
278
|
"data-slot": "calendar",
|
|
276
|
-
ref:
|
|
279
|
+
ref: o,
|
|
277
280
|
className: a,
|
|
278
281
|
...s
|
|
279
282
|
}
|
|
280
283
|
),
|
|
281
284
|
Chevron: ({
|
|
282
285
|
className: a,
|
|
283
|
-
orientation:
|
|
286
|
+
orientation: o,
|
|
284
287
|
...s
|
|
285
|
-
}) =>
|
|
288
|
+
}) => o === "left" ? /* @__PURE__ */ r(
|
|
286
289
|
x,
|
|
287
290
|
{
|
|
288
291
|
component: "span",
|
|
@@ -290,7 +293,7 @@ const oe = ({
|
|
|
290
293
|
weight: "medium",
|
|
291
294
|
size: "md",
|
|
292
295
|
children: /* @__PURE__ */ r(
|
|
293
|
-
|
|
296
|
+
Q,
|
|
294
297
|
{
|
|
295
298
|
className: e(
|
|
296
299
|
"inline size-comp-calendar-ico-size text-comp-select-icon-brand-def",
|
|
@@ -300,7 +303,7 @@ const oe = ({
|
|
|
300
303
|
}
|
|
301
304
|
)
|
|
302
305
|
}
|
|
303
|
-
) :
|
|
306
|
+
) : o === "right" ? /* @__PURE__ */ r(
|
|
304
307
|
x,
|
|
305
308
|
{
|
|
306
309
|
component: "span",
|
|
@@ -308,7 +311,7 @@ const oe = ({
|
|
|
308
311
|
weight: "medium",
|
|
309
312
|
size: "md",
|
|
310
313
|
children: /* @__PURE__ */ r(
|
|
311
|
-
|
|
314
|
+
U,
|
|
312
315
|
{
|
|
313
316
|
className: e(
|
|
314
317
|
"inline size-comp-calendar-ico-size text-comp-select-icon-brand-def",
|
|
@@ -319,14 +322,14 @@ const oe = ({
|
|
|
319
322
|
)
|
|
320
323
|
}
|
|
321
324
|
) : /* @__PURE__ */ r(
|
|
322
|
-
|
|
325
|
+
X,
|
|
323
326
|
{
|
|
324
327
|
className: e("size-comp-calendar-ico-size", a),
|
|
325
328
|
...s
|
|
326
329
|
}
|
|
327
330
|
),
|
|
328
|
-
DayButton:
|
|
329
|
-
WeekNumber: ({ children: a, ...
|
|
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 }) }),
|
|
330
333
|
...g,
|
|
331
334
|
// When weekdays are hidden, replace the table-based layout (table > tbody > tr > td)
|
|
332
335
|
// with a CSS Grid to create a continuous day flow. Without this, months starting
|
|
@@ -339,20 +342,20 @@ const oe = ({
|
|
|
339
342
|
...u && {
|
|
340
343
|
MonthGrid: ({
|
|
341
344
|
className: a,
|
|
342
|
-
...
|
|
343
|
-
}) => /* @__PURE__ */ r("div", { className: a, role: "grid", ...
|
|
345
|
+
...o
|
|
346
|
+
}) => /* @__PURE__ */ r("div", { className: a, role: "grid", ...o }),
|
|
344
347
|
Weeks: ({
|
|
345
348
|
className: a,
|
|
346
|
-
...
|
|
347
|
-
}) => /* @__PURE__ */ r("div", { className: "grid grid-cols-7", ...
|
|
349
|
+
...o
|
|
350
|
+
}) => /* @__PURE__ */ r("div", { className: "grid grid-cols-7", ...o }),
|
|
348
351
|
Week: ({
|
|
349
352
|
week: a,
|
|
350
|
-
className:
|
|
353
|
+
className: o,
|
|
351
354
|
...s
|
|
352
355
|
}) => /* @__PURE__ */ r("div", { className: "contents", ...s }),
|
|
353
356
|
Day: ({
|
|
354
357
|
day: a,
|
|
355
|
-
modifiers:
|
|
358
|
+
modifiers: o,
|
|
356
359
|
...s
|
|
357
360
|
}) => a.outside ? /* @__PURE__ */ r("div", { className: "hidden" }) : /* @__PURE__ */ r("div", { ...s })
|
|
358
361
|
}
|
|
@@ -360,16 +363,16 @@ const oe = ({
|
|
|
360
363
|
...y
|
|
361
364
|
}
|
|
362
365
|
);
|
|
363
|
-
},
|
|
366
|
+
}, Z = ({
|
|
364
367
|
className: m,
|
|
365
368
|
day: f,
|
|
366
369
|
modifiers: n,
|
|
367
370
|
children: i,
|
|
368
|
-
disabled:
|
|
371
|
+
disabled: d,
|
|
369
372
|
...g
|
|
370
373
|
}) => {
|
|
371
|
-
const l =
|
|
372
|
-
return
|
|
374
|
+
const l = E(), c = R.useRef(null);
|
|
375
|
+
return R.useEffect(() => {
|
|
373
376
|
var u;
|
|
374
377
|
n.focused && ((u = c.current) == null || u.focus());
|
|
375
378
|
}, [n.focused]), /* @__PURE__ */ r(
|
|
@@ -381,7 +384,7 @@ const oe = ({
|
|
|
381
384
|
"data-range-start": n.range_start,
|
|
382
385
|
"data-range-end": n.range_end,
|
|
383
386
|
"data-range-middle": n.range_middle,
|
|
384
|
-
disabled:
|
|
387
|
+
disabled: d,
|
|
385
388
|
className: e(
|
|
386
389
|
"relative size-full",
|
|
387
390
|
'before:absolute before:inset-0 before:rounded-full before:transition-colors before:content-[""]',
|
|
@@ -393,7 +396,7 @@ const oe = ({
|
|
|
393
396
|
"group-data-[focused=true]/day:z-10",
|
|
394
397
|
"outline-0",
|
|
395
398
|
{
|
|
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": !
|
|
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
|
|
397
400
|
},
|
|
398
401
|
l.day,
|
|
399
402
|
m
|
|
@@ -415,7 +418,7 @@ const oe = ({
|
|
|
415
418
|
);
|
|
416
419
|
};
|
|
417
420
|
export {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
+
se as Calendar,
|
|
422
|
+
Y as CalendarBase,
|
|
423
|
+
Z as CalendarDayButton
|
|
421
424
|
};
|
|
@@ -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,
|
|
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
|
|
2
|
-
const
|
|
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
|
-
|
|
4
|
+
r as formatDateRange
|
|
8
5
|
};
|
|
@@ -71,13 +71,17 @@ export type DatePickerProps = {
|
|
|
71
71
|
* When false or omitted, reset reverts to the last confirmed value.
|
|
72
72
|
*/
|
|
73
73
|
shouldResetToDefaultValue?: boolean;
|
|
74
|
-
/**
|
|
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. */
|
|
75
79
|
required?: boolean;
|
|
76
80
|
/** Hides the required asterisk even when `required` is true. @default false */
|
|
77
81
|
disableRequiredAsterisk?: boolean;
|
|
78
82
|
/** Number of months to display side by side. @default 2 on desktop, 1 on mobile */
|
|
79
83
|
numberOfMonths?: 1 | 2;
|
|
80
|
-
} & Omit<CalendarBaseProps, 'numberOfMonths' | 'onConfirm' | 'onReset' | 'isExpanded' | 'leftPanelChildren' | 'bottomTextDefault' | 'dateFormatter' | 'dateRangeFormatter'> & (DatePickerRangeProps | DatePickerSingleProps);
|
|
84
|
+
} & Omit<CalendarBaseProps, 'numberOfMonths' | 'onConfirm' | 'onReset' | 'isExpanded' | 'leftPanelChildren' | 'bottomTextDefault' | 'dateFormatter' | 'dateRangeFormatter' | 'required'> & (DatePickerRangeProps | DatePickerSingleProps);
|
|
81
85
|
/** Props for date range selection mode. */
|
|
82
86
|
export type DatePickerRangeProps = {
|
|
83
87
|
/** Enables date range selection with start and end dates. */
|
|
@@ -86,8 +90,8 @@ export type DatePickerRangeProps = {
|
|
|
86
90
|
value?: DateRange | undefined;
|
|
87
91
|
/** Initial date range for uncontrolled usage. */
|
|
88
92
|
defaultValue?: DateRange | undefined;
|
|
89
|
-
/** Fires when a date range selection is confirmed. */
|
|
90
|
-
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;
|
|
91
95
|
/** Custom function to format the displayed date range string. */
|
|
92
96
|
dateFormatter?: (date: DateRange) => string;
|
|
93
97
|
};
|
|
@@ -99,8 +103,8 @@ export type DatePickerSingleProps = {
|
|
|
99
103
|
value?: Date | undefined;
|
|
100
104
|
/** Initial date for uncontrolled usage. */
|
|
101
105
|
defaultValue?: Date | undefined;
|
|
102
|
-
/** Fires when a single date selection is confirmed. */
|
|
103
|
-
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;
|
|
104
108
|
/** Custom function to format the displayed date string. */
|
|
105
109
|
dateFormatter?: (date: Date) => string;
|
|
106
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":"AAEA,OAAO,EAAE,KAAK,SAAS,EAA2C,MAAM,OAAO,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAIjD,OAAO,EAEL,KAAK,iBAAiB,EAGvB,M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AM,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,UAAU,8GA0PtB,CAAA"}
|
|
@@ -1,59 +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:
|
|
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,
|
|
32
33
|
side: U = "bottom",
|
|
33
|
-
renderCustomTrigger:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
), [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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(
|
|
53
62
|
"button",
|
|
54
63
|
{
|
|
55
|
-
className:
|
|
56
|
-
|
|
64
|
+
className: l(
|
|
65
|
+
xt({
|
|
57
66
|
variant: "cta",
|
|
58
67
|
weight: "medium",
|
|
59
68
|
size: "sm",
|
|
@@ -63,106 +72,107 @@ const pt = a(
|
|
|
63
72
|
"hover:bg-surface-brand-brand-tertiary hover:text-comp-button-tertiary-text-def",
|
|
64
73
|
"outline-none focus-visible:bg-surface-brand-brand-tertiary focus-visible:text-comp-button-tertiary-text-def",
|
|
65
74
|
"cursor-pointer",
|
|
66
|
-
|
|
75
|
+
o == null ? void 0 : o.leftPanelButton
|
|
67
76
|
),
|
|
68
77
|
onClick: () => {
|
|
69
|
-
const
|
|
70
|
-
|
|
78
|
+
const c = nt(t.type);
|
|
79
|
+
u(c), f && (p(c), r == null || r(c));
|
|
71
80
|
},
|
|
72
|
-
children:
|
|
81
|
+
children: t.name
|
|
73
82
|
},
|
|
74
|
-
|
|
75
|
-
)), D =
|
|
76
|
-
|
|
77
|
-
|
|
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,
|
|
78
104
|
{
|
|
79
|
-
open:
|
|
80
|
-
onOpenChange: (
|
|
81
|
-
|
|
105
|
+
open: F,
|
|
106
|
+
onOpenChange: (t) => {
|
|
107
|
+
t && (v.current = e ?? i), s === void 0 && P(t), d == null || d(t);
|
|
82
108
|
},
|
|
83
109
|
children: [
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
110
|
+
/* @__PURE__ */ n(
|
|
111
|
+
pt,
|
|
86
112
|
{
|
|
87
|
-
className:
|
|
113
|
+
className: l(
|
|
88
114
|
"group cursor-pointer rounded-full text-left outline-0",
|
|
89
|
-
|
|
115
|
+
o == null ? void 0 : o.popoverTrigger
|
|
90
116
|
),
|
|
91
|
-
disabled:
|
|
92
|
-
children:
|
|
93
|
-
|
|
117
|
+
disabled: R,
|
|
118
|
+
children: S ? S() : /* @__PURE__ */ n(
|
|
119
|
+
ut,
|
|
94
120
|
{
|
|
95
|
-
ref:
|
|
96
|
-
value:
|
|
97
|
-
placeholder:
|
|
98
|
-
error:
|
|
99
|
-
disabled:
|
|
100
|
-
label:
|
|
101
|
-
hint:
|
|
121
|
+
ref: g,
|
|
122
|
+
value: B ? D(B) : "",
|
|
123
|
+
placeholder: Q,
|
|
124
|
+
error: J,
|
|
125
|
+
disabled: R,
|
|
126
|
+
label: L,
|
|
127
|
+
hint: K,
|
|
102
128
|
tabIndex: -1,
|
|
103
|
-
required:
|
|
104
|
-
disableRequiredAsterisk:
|
|
105
|
-
className:
|
|
129
|
+
required: x,
|
|
130
|
+
disableRequiredAsterisk: W,
|
|
131
|
+
className: l(
|
|
106
132
|
"pointer-events-none",
|
|
107
|
-
|
|
133
|
+
o == null ? void 0 : o.input,
|
|
108
134
|
"group-hover:border-comp-input-stroke-hover group-focus-visible:border-comp-input-stroke-focused"
|
|
109
135
|
),
|
|
110
|
-
suffix: /* @__PURE__ */
|
|
136
|
+
suffix: /* @__PURE__ */ n(lt, { className: "size-icon-medium text-icon-dark-secondary-def" })
|
|
111
137
|
}
|
|
112
138
|
)
|
|
113
139
|
}
|
|
114
140
|
),
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
|
|
141
|
+
/* @__PURE__ */ n(
|
|
142
|
+
ct,
|
|
117
143
|
{
|
|
118
|
-
className:
|
|
119
|
-
align:
|
|
144
|
+
className: l("flex w-auto p-0", o == null ? void 0 : o.popoverContent),
|
|
145
|
+
align: G,
|
|
120
146
|
side: U,
|
|
121
|
-
avoidCollisions:
|
|
122
|
-
onOpenAutoFocus: (
|
|
123
|
-
children:
|
|
124
|
-
|
|
147
|
+
avoidCollisions: T,
|
|
148
|
+
onOpenAutoFocus: (t) => t.preventDefault(),
|
|
149
|
+
children: m === "single" ? /* @__PURE__ */ n(
|
|
150
|
+
Y,
|
|
125
151
|
{
|
|
126
|
-
...
|
|
152
|
+
...A,
|
|
127
153
|
mode: "single",
|
|
128
|
-
selected:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
onSelect: m,
|
|
133
|
-
onConfirm: () => {
|
|
134
|
-
(o !== void 0 || d) && (k(o), f == null || f(o)), n === void 0 && y(!1), r == null || r(!1);
|
|
135
|
-
},
|
|
136
|
-
numberOfMonths: F ?? (Y ? 2 : 1),
|
|
137
|
-
hideNavigation: M,
|
|
138
|
-
hideCaption: j,
|
|
139
|
-
hideWeekdays: z,
|
|
140
|
-
showOutsideDays: R,
|
|
141
|
-
hideBottomText: A,
|
|
142
|
-
hideResetButton: E,
|
|
154
|
+
selected: i,
|
|
155
|
+
onSelect: f ? (t) => {
|
|
156
|
+
u(t), p(t), r == null || r(t);
|
|
157
|
+
} : u,
|
|
143
158
|
dateFormatter: D
|
|
144
159
|
}
|
|
145
|
-
) : /* @__PURE__ */
|
|
146
|
-
|
|
160
|
+
) : /* @__PURE__ */ n(
|
|
161
|
+
Y,
|
|
147
162
|
{
|
|
148
|
-
...
|
|
163
|
+
...A,
|
|
149
164
|
mode: "range",
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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));
|
|
157
174
|
},
|
|
158
|
-
|
|
159
|
-
hideNavigation: M,
|
|
160
|
-
hideCaption: j,
|
|
161
|
-
hideWeekdays: z,
|
|
162
|
-
showOutsideDays: R,
|
|
163
|
-
hideBottomText: A,
|
|
164
|
-
hideResetButton: E,
|
|
165
|
-
leftPanelChildren: v === "range" && !$ && w,
|
|
175
|
+
leftPanelChildren: m === "range" && !N && C,
|
|
166
176
|
dateRangeFormatter: D
|
|
167
177
|
}
|
|
168
178
|
)
|
|
@@ -173,7 +183,7 @@ const pt = a(
|
|
|
173
183
|
);
|
|
174
184
|
}
|
|
175
185
|
);
|
|
176
|
-
|
|
186
|
+
mt.displayName = "DatePicker";
|
|
177
187
|
export {
|
|
178
|
-
|
|
188
|
+
mt as DatePicker
|
|
179
189
|
};
|
|
@@ -16,6 +16,9 @@ export declare const ResetButtonResetsToUndefined: Story;
|
|
|
16
16
|
export declare const ResetButtonResetsToStoryDate: Story;
|
|
17
17
|
export declare const Required: Story;
|
|
18
18
|
export declare const SingleMonth: Story;
|
|
19
|
+
export declare const ImmediateCommitRange: Story;
|
|
20
|
+
export declare const AllowOneDayRange: Story;
|
|
21
|
+
export declare const NotRequired: Story;
|
|
19
22
|
export declare const MonthlyView: Story;
|
|
20
23
|
export declare const YearlyView: Story;
|
|
21
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,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,WAAW,EAAE,KAqCzB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,
|
|
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
|
+
};
|