mainstack-design-system 1.16.7 → 1.17.1

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/index.d.ts CHANGED
@@ -1099,6 +1099,10 @@ declare type DatePickerContextType = {
1099
1099
  isDisabled?: boolean;
1100
1100
  isError?: boolean;
1101
1101
  isSuccess?: boolean;
1102
+ dateRange?: {
1103
+ from: Date;
1104
+ to?: Date | undefined;
1105
+ };
1102
1106
  onValueChange: (value: Date | undefined) => void;
1103
1107
  onOpenChange: Dispatch<SetStateAction<boolean>>;
1104
1108
  };
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("react"),k=require("./utils-s-0cOrOT.cjs"),m=require("./mainstack-design-system614.cjs"),p=require("./DayPickerExtended-BI8ETMuv.cjs"),n=require("./isValid-914h5Kof.cjs"),i=u.forwardRef(({className:r,...s},o)=>{const{value:e,isDisabled:c,onValueChange:a,onOpenChange:d}=m.useDatePickerContext();return t.jsx("div",{"data-slot":"date-picker-calendar",className:k.cn("@container",r),ref:o,children:t.jsx(p.DayPickerExtended,{animate:!0,mode:"single",captionLayout:"dropdown",numberOfMonths:1,navLayout:"around",disabled:c,defaultMonth:n.isValid(e)?e:void 0,className:"ms-single-date-picker",selected:n.isValid(e)?e:void 0,onSelect:(l=>{a&&a(l),d(!1)}),...s})})});i.displayName="DatePickerCalendar";exports.DatePickerCalendar=i;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),f=require("react"),k=require("./utils-s-0cOrOT.cjs"),p=require("./mainstack-design-system614.cjs"),D=require("./DayPickerExtended-BI8ETMuv.cjs"),t=require("./isValid-914h5Kof.cjs"),o=f.forwardRef(({className:s,...d},c)=>{const{dateRange:e,value:a,isDisabled:i,onValueChange:n,onOpenChange:l}=p.useDatePickerContext(),u=i||(e?{before:t.isValid(e?.from)?e?.from:new Date,after:t.isValid(e?.to)?e?.to:void 0}:void 0);return r.jsx("div",{"data-slot":"date-picker-calendar",className:k.cn("@container",s),ref:c,children:r.jsx(D.DayPickerExtended,{animate:!0,mode:"single",captionLayout:"dropdown",numberOfMonths:1,navLayout:"around",defaultMonth:t.isValid(a)?a:void 0,className:"ms-single-date-picker",selected:t.isValid(a)?a:void 0,onSelect:(m=>{n&&n(m),l(!1)}),disabled:u,...d})})});o.displayName="DatePickerCalendar";exports.DatePickerCalendar=o;
@@ -1,42 +1,45 @@
1
1
  'use client';
2
- import { jsx as o } from "react/jsx-runtime";
3
- import { forwardRef as m } from "react";
4
- import { c } from "./utils-Z5JtG_Bc.js";
5
- import { useDatePickerContext as p } from "./mainstack-design-system614.js";
6
- import { D as f } from "./DayPickerExtended-B8-AnC-D.js";
7
- import { i as r } from "./isValid-nnPUOITD.js";
8
- const u = m(
9
- ({ className: t, ...i }, n) => {
10
- const { value: e, isDisabled: d, onValueChange: a, onOpenChange: s } = p();
11
- return /* @__PURE__ */ o(
2
+ import { jsx as i } from "react/jsx-runtime";
3
+ import { forwardRef as f } from "react";
4
+ import { c as p } from "./utils-Z5JtG_Bc.js";
5
+ import { useDatePickerContext as u } from "./mainstack-design-system614.js";
6
+ import { D as v } from "./DayPickerExtended-B8-AnC-D.js";
7
+ import { i as o } from "./isValid-nnPUOITD.js";
8
+ const D = f(
9
+ ({ className: n, ...d }, s) => {
10
+ const { dateRange: e, value: a, isDisabled: t, onValueChange: r, onOpenChange: m } = u(), c = t || (e ? {
11
+ before: o(e?.from) ? e?.from : /* @__PURE__ */ new Date(),
12
+ after: o(e?.to) ? e?.to : void 0
13
+ } : void 0);
14
+ return /* @__PURE__ */ i(
12
15
  "div",
13
16
  {
14
17
  "data-slot": "date-picker-calendar",
15
- className: c("@container", t),
16
- ref: n,
17
- children: /* @__PURE__ */ o(
18
- f,
18
+ className: p("@container", n),
19
+ ref: s,
20
+ children: /* @__PURE__ */ i(
21
+ v,
19
22
  {
20
23
  animate: !0,
21
24
  mode: "single",
22
25
  captionLayout: "dropdown",
23
26
  numberOfMonths: 1,
24
27
  navLayout: "around",
25
- disabled: d,
26
- defaultMonth: r(e) ? e : void 0,
28
+ defaultMonth: o(a) ? a : void 0,
27
29
  className: "ms-single-date-picker",
28
- selected: r(e) ? e : void 0,
30
+ selected: o(a) ? a : void 0,
29
31
  onSelect: ((l) => {
30
- a && a(l), s(!1);
32
+ r && r(l), m(!1);
31
33
  }),
32
- ...i
34
+ disabled: c,
35
+ ...d
33
36
  }
34
37
  )
35
38
  }
36
39
  );
37
40
  }
38
41
  );
39
- u.displayName = "DatePickerCalendar";
42
+ D.displayName = "DatePickerCalendar";
40
43
  export {
41
- u as DatePickerCalendar
44
+ D as DatePickerCalendar
42
45
  };
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),k=require("react"),v=require("./mainstack-design-system614.cjs"),f=require("./index-4R9KShCu.cjs"),r=require("./index-C8aODXfJ.cjs"),a=k.forwardRef(({open:i,onOpenChange:c,value:s,onValueChange:l,isDisabled:u=!1,defaultValue:o,isError:p,isSuccess:d,children:P,...C},g)=>{const[t,n]=r.useControllableState({prop:i,defaultProp:!1,onChange:c}),[h,x]=r.useControllableState({prop:s,defaultProp:o,onChange:l});return e.jsx(v.DatePickerContext.Provider,{value:{open:t,isDisabled:u,isError:p,isSuccess:d,defaultValue:o,value:h,onValueChange:x,onOpenChange:n},children:e.jsx(f.Popover,{open:t,onOpenChange:n,children:e.jsx("div",{"data-slot":"date-picker-root",ref:g,...C,children:P})})})});a.displayName="DatePickerRoot";exports.DatePickerRoot=a;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react"),f=require("./mainstack-design-system614.cjs"),R=require("./index-4R9KShCu.cjs"),r=require("./index-C8aODXfJ.cjs"),a=v.forwardRef(({open:i,onOpenChange:c,value:s,onValueChange:l,isDisabled:u=!1,defaultValue:o,dateRange:p,isError:d,isSuccess:P,children:C,...g},h)=>{const[t,n]=r.useControllableState({prop:i,defaultProp:!1,onChange:c}),[x,k]=r.useControllableState({prop:s,defaultProp:o,onChange:l});return e.jsx(f.DatePickerContext.Provider,{value:{open:t,isDisabled:u,isError:d,isSuccess:P,defaultValue:o,value:x,dateRange:p,onValueChange:k,onOpenChange:n},children:e.jsx(R.Popover,{open:t,onOpenChange:n,children:e.jsx("div",{"data-slot":"date-picker-root",ref:h,...g,children:C})})})});a.displayName="DatePickerRoot";exports.DatePickerRoot=a;
@@ -1,10 +1,10 @@
1
1
  'use client';
2
2
  import { jsx as o } from "react/jsx-runtime";
3
- import { forwardRef as P } from "react";
4
- import { DatePickerContext as g } from "./mainstack-design-system614.js";
5
- import { P as v } from "./index-RoCFhqzC.js";
3
+ import { forwardRef as g } from "react";
4
+ import { DatePickerContext as v } from "./mainstack-design-system614.js";
5
+ import { P as k } from "./index-RoCFhqzC.js";
6
6
  import { u as t } from "./index-437EL2iq.js";
7
- const k = P(
7
+ const x = g(
8
8
  ({
9
9
  open: n,
10
10
  onOpenChange: p,
@@ -12,39 +12,41 @@ const k = P(
12
12
  onValueChange: l,
13
13
  isDisabled: m = !1,
14
14
  defaultValue: e,
15
- isError: s,
16
- isSuccess: f,
17
- children: c,
18
- ...d
19
- }, h) => {
15
+ dateRange: s,
16
+ isError: f,
17
+ isSuccess: c,
18
+ children: d,
19
+ ...h
20
+ }, u) => {
20
21
  const [r, a] = t({
21
22
  prop: n,
22
23
  defaultProp: !1,
23
24
  onChange: p
24
- }), [u, C] = t({
25
+ }), [C, P] = t({
25
26
  prop: i,
26
27
  defaultProp: e,
27
28
  onChange: l
28
29
  });
29
30
  return /* @__PURE__ */ o(
30
- g.Provider,
31
+ v.Provider,
31
32
  {
32
33
  value: {
33
34
  open: r,
34
35
  isDisabled: m,
35
- isError: s,
36
- isSuccess: f,
36
+ isError: f,
37
+ isSuccess: c,
37
38
  defaultValue: e,
38
- value: u,
39
- onValueChange: C,
39
+ value: C,
40
+ dateRange: s,
41
+ onValueChange: P,
40
42
  onOpenChange: a
41
43
  },
42
- children: /* @__PURE__ */ o(v, { open: r, onOpenChange: a, children: /* @__PURE__ */ o("div", { "data-slot": "date-picker-root", ref: h, ...d, children: c }) })
44
+ children: /* @__PURE__ */ o(k, { open: r, onOpenChange: a, children: /* @__PURE__ */ o("div", { "data-slot": "date-picker-root", ref: u, ...h, children: d }) })
43
45
  }
44
46
  );
45
47
  }
46
48
  );
47
- k.displayName = "DatePickerRoot";
49
+ x.displayName = "DatePickerRoot";
48
50
  export {
49
- k as DatePickerRoot
51
+ x as DatePickerRoot
50
52
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),g=require("react"),p=require("./utils-s-0cOrOT.cjs"),R=require("./mainstack-design-system612.cjs"),y=require("./mainstack-design-system399.cjs"),c=require("./DayPickerExtended-BI8ETMuv.cjs"),x=require("./mainstack-design-system400.cjs");function C(a,r,e){return c.addMonths(a,-1,e)}const u=g.forwardRef(({className:a,...r},e)=>{const[d]=x.useMatchMedia("(min-width: 900px)"),{ref:l,matches:m}=y.useContainerMatchMedia({query:{minWidth:660}}),{value:n,closeOnRangeSelect:f,setActiveMenu:h,onValueChange:o,onOpenChange:s}=R.useDateRangeContext();return i.jsx("div",{"data-slot":"date-range-calendar",ref:t=>{l.current=t,typeof e=="function"?e(t):typeof e=="object"&&e!==null&&(e.current=t)},className:p.cn("mds:@container mds:min-w-auto mds:min-[900px]:min-w-670",a),children:i.jsx(c.DayPickerExtended,{...r,animate:!0,mode:"range",captionLayout:"dropdown",numberOfMonths:d||m?2:1,navLayout:"around",className:"ms-date-range",selected:n,defaultMonth:n?.from||C(new Date),onSelect:((t,M)=>{o&&(n?.from&&n.to||!n?.from?o({from:M}):(o(t),f&&s&&s(!1))),h(null)})})})});u.displayName="DateRangeCalendar";exports.DateRangeCalendar=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),p=require("react"),R=require("./utils-s-0cOrOT.cjs"),y=require("./mainstack-design-system612.cjs"),q=require("./mainstack-design-system399.cjs"),d=require("./DayPickerExtended-BI8ETMuv.cjs"),x=require("./mainstack-design-system400.cjs"),c=require("./isValid-914h5Kof.cjs");function C(a,i,e){return d.addMonths(a,-1,e)}const u=p.forwardRef(({className:a,...i},e)=>{const[l]=x.useMatchMedia("(min-width: 900px)"),{ref:m,matches:f}=q.useContainerMatchMedia({query:{minWidth:660}}),{value:n,closeOnRangeSelect:h,setActiveMenu:M,onValueChange:o,onOpenChange:r}=y.useDateRangeContext();return s.jsx("div",{"data-slot":"date-range-calendar",ref:t=>{m.current=t,typeof e=="function"?e(t):typeof e=="object"&&e!==null&&(e.current=t)},className:R.cn("mds:@container mds:min-w-auto mds:min-[900px]:min-w-670",a),children:s.jsx(d.DayPickerExtended,{...i,animate:!0,mode:"range",captionLayout:"dropdown",numberOfMonths:l||f?2:1,navLayout:"around",className:"ms-date-range",selected:c.isValid(n)?n:void 0,defaultMonth:c.isValid(n?.from)?n?.from:C(new Date),onSelect:((t,g)=>{o&&(n?.from&&n.to||!n?.from?o({from:g}):(o(t),h&&r&&r(!1))),M(null)})})})});u.displayName="DateRangeCalendar";exports.DateRangeCalendar=u;
@@ -1,51 +1,52 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { forwardRef as p } from "react";
3
- import { c as h } from "./utils-Z5JtG_Bc.js";
4
- import { useDateRangeContext as M } from "./mainstack-design-system612.js";
5
- import { useContainerMatchMedia as g } from "./mainstack-design-system399.js";
6
- import { a as y, D } from "./DayPickerExtended-B8-AnC-D.js";
7
- import { useMatchMedia as w } from "./mainstack-design-system400.js";
8
- function x(n, r, e) {
9
- return y(n, -1, e);
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { forwardRef as h } from "react";
3
+ import { c as M } from "./utils-Z5JtG_Bc.js";
4
+ import { useDateRangeContext as g } from "./mainstack-design-system612.js";
5
+ import { useContainerMatchMedia as y } from "./mainstack-design-system399.js";
6
+ import { a as D, D as w } from "./DayPickerExtended-B8-AnC-D.js";
7
+ import { useMatchMedia as x } from "./mainstack-design-system400.js";
8
+ import { i as s } from "./isValid-nnPUOITD.js";
9
+ function C(o, r, e) {
10
+ return D(o, -1, e);
10
11
  }
11
- const C = p(
12
- ({ className: n, ...r }, e) => {
13
- const [s] = w("(min-width: 900px)"), { ref: d, matches: c } = g({
12
+ const R = h(
13
+ ({ className: o, ...r }, e) => {
14
+ const [d] = x("(min-width: 900px)"), { ref: c, matches: f } = y({
14
15
  query: { minWidth: 660 }
15
16
  }), {
16
- value: t,
17
- closeOnRangeSelect: f,
18
- setActiveMenu: u,
19
- onValueChange: o,
20
- onOpenChange: m
21
- } = M();
22
- return /* @__PURE__ */ i(
17
+ value: a,
18
+ closeOnRangeSelect: u,
19
+ setActiveMenu: l,
20
+ onValueChange: n,
21
+ onOpenChange: i
22
+ } = g();
23
+ return /* @__PURE__ */ m(
23
24
  "div",
24
25
  {
25
26
  "data-slot": "date-range-calendar",
26
- ref: (a) => {
27
- d.current = a, typeof e == "function" ? e(a) : typeof e == "object" && e !== null && (e.current = a);
27
+ ref: (t) => {
28
+ c.current = t, typeof e == "function" ? e(t) : typeof e == "object" && e !== null && (e.current = t);
28
29
  },
29
- className: h(
30
+ className: M(
30
31
  "mds:@container mds:min-w-auto mds:min-[900px]:min-w-670",
31
- n
32
+ o
32
33
  ),
33
- children: /* @__PURE__ */ i(
34
- D,
34
+ children: /* @__PURE__ */ m(
35
+ w,
35
36
  {
36
37
  ...r,
37
38
  animate: !0,
38
39
  mode: "range",
39
40
  captionLayout: "dropdown",
40
- numberOfMonths: s || c ? 2 : 1,
41
+ numberOfMonths: d || f ? 2 : 1,
41
42
  navLayout: "around",
42
43
  className: "ms-date-range",
43
- selected: t,
44
- defaultMonth: t?.from || x(/* @__PURE__ */ new Date()),
45
- onSelect: ((a, l) => {
46
- o && (t?.from && t.to || !t?.from ? o({
47
- from: l
48
- }) : (o(a), f && m && m(!1))), u(null);
44
+ selected: s(a) ? a : void 0,
45
+ defaultMonth: s(a?.from) ? a?.from : C(/* @__PURE__ */ new Date()),
46
+ onSelect: ((t, p) => {
47
+ n && (a?.from && a.to || !a?.from ? n({
48
+ from: p
49
+ }) : (n(t), u && i && i(!1))), l(null);
49
50
  })
50
51
  }
51
52
  )
@@ -53,7 +54,7 @@ const C = p(
53
54
  );
54
55
  }
55
56
  );
56
- C.displayName = "DateRangeCalendar";
57
+ R.displayName = "DateRangeCalendar";
57
58
  export {
58
- C as DateRangeCalendar
59
+ R as DateRangeCalendar
59
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mainstack-design-system",
3
- "version": "1.16.7",
3
+ "version": "1.17.1",
4
4
  "type": "module",
5
5
  "main": "./dist/mainstack-design-system.cjs",
6
6
  "module": "./dist/mainstack-design-system.js",