mainstack-design-system 1.17.1 → 1.17.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),R=require("react"),y=require("./utils-s-0cOrOT.cjs"),q=require("./mainstack-design-system612.cjs"),x=require("./mainstack-design-system399.cjs"),c=require("./DayPickerExtended-BI8ETMuv.cjs"),C=require("./mainstack-design-system400.cjs"),i=require("./isValid-914h5Kof.cjs");function D(a,r,t){return c.addMonths(a,-1,t)}const u=R.forwardRef(({className:a,...r},t)=>{const[l]=C.useMatchMedia("(min-width: 900px)"),{ref:m,matches:f}=x.useContainerMatchMedia({query:{minWidth:660}}),{value:e,closeOnRangeSelect:h,setActiveMenu:M,onValueChange:o,onOpenChange:s}=q.useDateRangeContext(),g={from:i.isValid(e?.from)?e?.from:void 0,to:i.isValid(e?.to)?e?.to:void 0};return d.jsx("div",{"data-slot":"date-range-calendar",ref:n=>{m.current=n,typeof t=="function"?t(n):typeof t=="object"&&t!==null&&(t.current=n)},className:y.cn("mds:@container mds:min-w-auto mds:min-[900px]:min-w-670",a),children:d.jsx(c.DayPickerExtended,{...r,animate:!0,mode:"range",captionLayout:"dropdown",numberOfMonths:l||f?2:1,navLayout:"around",className:"ms-date-range",selected:g,defaultMonth:i.isValid(e?.from)?e?.from:D(new Date),onSelect:((n,p)=>{o&&(e?.from&&e.to||!e?.from?o({from:p}):(o(n),h&&s&&s(!1))),M(null)})})})});u.displayName="DateRangeCalendar";exports.DateRangeCalendar=u;
|
|
@@ -1,52 +1,55 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useDateRangeContext as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as M } from "react";
|
|
3
|
+
import { c as g } from "./utils-Z5JtG_Bc.js";
|
|
4
|
+
import { useDateRangeContext as v } from "./mainstack-design-system612.js";
|
|
5
5
|
import { useContainerMatchMedia as y } from "./mainstack-design-system399.js";
|
|
6
6
|
import { a as D, D as w } from "./DayPickerExtended-B8-AnC-D.js";
|
|
7
7
|
import { useMatchMedia as x } from "./mainstack-design-system400.js";
|
|
8
|
-
import { i as
|
|
9
|
-
function C(
|
|
10
|
-
return D(
|
|
8
|
+
import { i as r } from "./isValid-nnPUOITD.js";
|
|
9
|
+
function C(a, m, o) {
|
|
10
|
+
return D(a, -1, o);
|
|
11
11
|
}
|
|
12
|
-
const R =
|
|
13
|
-
({ className:
|
|
14
|
-
const [d] = x("(min-width: 900px)"), { ref:
|
|
12
|
+
const R = M(
|
|
13
|
+
({ className: a, ...m }, o) => {
|
|
14
|
+
const [d] = x("(min-width: 900px)"), { ref: f, matches: c } = y({
|
|
15
15
|
query: { minWidth: 660 }
|
|
16
16
|
}), {
|
|
17
|
-
value:
|
|
18
|
-
closeOnRangeSelect:
|
|
19
|
-
setActiveMenu:
|
|
17
|
+
value: e,
|
|
18
|
+
closeOnRangeSelect: l,
|
|
19
|
+
setActiveMenu: u,
|
|
20
20
|
onValueChange: n,
|
|
21
21
|
onOpenChange: i
|
|
22
|
-
} =
|
|
23
|
-
|
|
22
|
+
} = v(), p = {
|
|
23
|
+
from: r(e?.from) ? e?.from : void 0,
|
|
24
|
+
to: r(e?.to) ? e?.to : void 0
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ s(
|
|
24
27
|
"div",
|
|
25
28
|
{
|
|
26
29
|
"data-slot": "date-range-calendar",
|
|
27
30
|
ref: (t) => {
|
|
28
|
-
|
|
31
|
+
f.current = t, typeof o == "function" ? o(t) : typeof o == "object" && o !== null && (o.current = t);
|
|
29
32
|
},
|
|
30
|
-
className:
|
|
33
|
+
className: g(
|
|
31
34
|
"mds:@container mds:min-w-auto mds:min-[900px]:min-w-670",
|
|
32
|
-
|
|
35
|
+
a
|
|
33
36
|
),
|
|
34
|
-
children: /* @__PURE__ */
|
|
37
|
+
children: /* @__PURE__ */ s(
|
|
35
38
|
w,
|
|
36
39
|
{
|
|
37
|
-
...
|
|
40
|
+
...m,
|
|
38
41
|
animate: !0,
|
|
39
42
|
mode: "range",
|
|
40
43
|
captionLayout: "dropdown",
|
|
41
|
-
numberOfMonths: d ||
|
|
44
|
+
numberOfMonths: d || c ? 2 : 1,
|
|
42
45
|
navLayout: "around",
|
|
43
46
|
className: "ms-date-range",
|
|
44
|
-
selected:
|
|
45
|
-
defaultMonth:
|
|
46
|
-
onSelect: ((t,
|
|
47
|
-
n && (
|
|
48
|
-
from:
|
|
49
|
-
}) : (n(t),
|
|
47
|
+
selected: p,
|
|
48
|
+
defaultMonth: r(e?.from) ? e?.from : C(/* @__PURE__ */ new Date()),
|
|
49
|
+
onSelect: ((t, h) => {
|
|
50
|
+
n && (e?.from && e.to || !e?.from ? n({
|
|
51
|
+
from: h
|
|
52
|
+
}) : (n(t), l && i && i(!1))), u(null);
|
|
50
53
|
})
|
|
51
54
|
}
|
|
52
55
|
)
|