mainstack-design-system 1.17.1 → 1.17.3

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,2 +1,2 @@
1
1
  'use client';
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),m=require("./index-C8aODXfJ.cjs"),D=require("./index-4R9KShCu.cjs"),n=require("react"),I=require("./mainstack-design-system606.cjs"),y=require("./mainstack-design-system607.cjs"),b=n.forwardRef(({isDisabled:x,isError:C,isMultiSelect:s=!1,isSuccess:d,children:h,value:e,defaultValue:i,inputReadOnly:j,isCreatableSelect:q,options:a=[],isOptionOpen:A,onOptionOpenChange:P,onValueChange:u,onOptionSelect:R},r)=>{const f=n.useRef(null),[t,_]=n.useState(y.parseSelectOptions(a)),[p,v]=m.useControllableState({prop:e,defaultProp:y.mapDefaultValuesToSelectedOption({isMultiSelect:s,defaultValue:i,options:a}),onChange:u}),[E,c]=n.useState(()=>typeof e=="string"?t.map.get(e)?.label||"":typeof i=="string"&&t.map.get(i)?.label||""),[O,S]=m.useControllableState({prop:A,defaultProp:!1,onChange:P}),[T,g]=n.useState("idle");return n.useEffect(()=>{s||Array.isArray(e)||c(t.map.get(e)?.label||"")},[s,t.map,e]),l.jsx(I.SelectContext.Provider,{value:{defaultValue:i,options:t,selectedOption:p,isOptionOpen:O,isDisabled:x,isError:C,isMultiSelect:s,isSuccess:d,inputValue:E,inputReadOnly:j,previousAction:T,isCreatableSelect:q,rootElementRef:f,setOptions:_,setPreviousAction:g,setInputValue:c,setSelectedOption:v,onOptionOpenChange:S,onValueChange:u,onOptionSelect:R},children:l.jsx(D.Popover,{open:O,onOpenChange:o=>{S(o),p&&!Array.isArray(p)&&!o&&(c(t.map.get(p)?.label||""),g("selection"))},children:l.jsx("div",{ref:o=>{f.current=o,typeof r=="function"?r(o):typeof r=="object"&&r?.current&&(r.current=o)},"data-slot":"select-root",children:h})})})});b.displayName="SelectRoot";exports.SelectRoot=b;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),m=require("./index-C8aODXfJ.cjs"),D=require("./index-4R9KShCu.cjs"),o=require("react"),I=require("./mainstack-design-system606.cjs"),y=require("./mainstack-design-system607.cjs"),b=o.forwardRef(({isDisabled:x,isError:C,isMultiSelect:s=!1,isSuccess:d,children:h,value:e,defaultValue:p,inputReadOnly:j,isCreatableSelect:q,options:u=[],isOptionOpen:A,onOptionOpenChange:P,onValueChange:f,onOptionSelect:R},n)=>{const O=o.useRef(null),[t,_]=o.useState(y.parseSelectOptions(u)),[i,v]=m.useControllableState({prop:e,defaultProp:y.mapDefaultValuesToSelectedOption({isMultiSelect:s,defaultValue:p,options:u}),onChange:f}),[E,c]=o.useState(()=>typeof e=="string"?t.map.get(e)?.label||"":typeof p=="string"&&t.map.get(p)?.label||""),[l,S]=m.useControllableState({prop:A,defaultProp:!1,onChange:P}),[T,g]=o.useState("idle");return o.useEffect(()=>{s||Array.isArray(e)||c(t.map.get(e)?.label||"")},[s,t.map,e]),a.jsx(I.SelectContext.Provider,{value:{defaultValue:p,options:t,selectedOption:i,isOptionOpen:l,isDisabled:x,isError:C,isMultiSelect:s,isSuccess:d,inputValue:E,inputReadOnly:j,previousAction:T,isCreatableSelect:q,rootElementRef:O,setOptions:_,setPreviousAction:g,setInputValue:c,setSelectedOption:v,onOptionOpenChange:S,onValueChange:f,onOptionSelect:R},children:a.jsx(D.Popover,{open:l,onOpenChange:r=>{S(l),i&&!Array.isArray(i)&&!r&&(c(t.map.get(i)?.label||""),g("selection"))},children:a.jsx("div",{ref:r=>{O.current=r,typeof n=="function"?n(r):typeof n=="object"&&n?.current&&(n.current=r)},"data-slot":"select-root",children:h})})})});b.displayName="SelectRoot";exports.SelectRoot=b;
@@ -1,8 +1,8 @@
1
1
  'use client';
2
- import { jsx as a } from "react/jsx-runtime";
2
+ import { jsx as c } from "react/jsx-runtime";
3
3
  import { u as y } from "./index-437EL2iq.js";
4
4
  import { P as I } from "./index-RoCFhqzC.js";
5
- import { forwardRef as N, useRef as T, useState as c, useEffect as k } from "react";
5
+ import { forwardRef as N, useRef as T, useState as l, useEffect as k } from "react";
6
6
  import { SelectContext as q } from "./mainstack-design-system606.js";
7
7
  import { parseSelectOptions as z, mapDefaultValuesToSelectedOption as B } from "./mainstack-design-system607.js";
8
8
  const F = N(
@@ -12,41 +12,41 @@ const F = N(
12
12
  isMultiSelect: r = !1,
13
13
  isSuccess: A,
14
14
  children: C,
15
- value: t,
15
+ value: o,
16
16
  defaultValue: p,
17
17
  inputReadOnly: P,
18
18
  isCreatableSelect: S,
19
- options: l = [],
19
+ options: m = [],
20
20
  isOptionOpen: x,
21
21
  onOptionOpenChange: d,
22
- onValueChange: m,
22
+ onValueChange: f,
23
23
  onOptionSelect: j
24
- }, n) => {
25
- const f = T(null), [o, E] = c(
26
- z(l)
24
+ }, e) => {
25
+ const O = T(null), [t, E] = l(
26
+ z(m)
27
27
  ), [i, R] = y({
28
- prop: t,
28
+ prop: o,
29
29
  defaultProp: B({
30
30
  isMultiSelect: r,
31
31
  defaultValue: p,
32
- options: l
32
+ options: m
33
33
  }),
34
- onChange: m
35
- }), [v, s] = c(() => typeof t == "string" ? o.map.get(t)?.label || "" : typeof p == "string" && o.map.get(p)?.label || ""), [O, u] = y({
34
+ onChange: f
35
+ }), [v, s] = l(() => typeof o == "string" ? t.map.get(o)?.label || "" : typeof p == "string" && t.map.get(p)?.label || ""), [a, u] = y({
36
36
  prop: x,
37
37
  defaultProp: !1,
38
38
  onChange: d
39
- }), [D, g] = c("idle");
39
+ }), [D, g] = l("idle");
40
40
  return k(() => {
41
- r || Array.isArray(t) || s(o.map.get(t)?.label || "");
42
- }, [r, o.map, t]), /* @__PURE__ */ a(
41
+ r || Array.isArray(o) || s(t.map.get(o)?.label || "");
42
+ }, [r, t.map, o]), /* @__PURE__ */ c(
43
43
  q.Provider,
44
44
  {
45
45
  value: {
46
46
  defaultValue: p,
47
- options: o,
47
+ options: t,
48
48
  selectedOption: i,
49
- isOptionOpen: O,
49
+ isOptionOpen: a,
50
50
  isDisabled: b,
51
51
  isError: h,
52
52
  isMultiSelect: r,
@@ -55,27 +55,27 @@ const F = N(
55
55
  inputReadOnly: P,
56
56
  previousAction: D,
57
57
  isCreatableSelect: S,
58
- rootElementRef: f,
58
+ rootElementRef: O,
59
59
  setOptions: E,
60
60
  setPreviousAction: g,
61
61
  setInputValue: s,
62
62
  setSelectedOption: R,
63
63
  onOptionOpenChange: u,
64
- onValueChange: m,
64
+ onValueChange: f,
65
65
  onOptionSelect: j
66
66
  },
67
- children: /* @__PURE__ */ a(
67
+ children: /* @__PURE__ */ c(
68
68
  I,
69
69
  {
70
- open: O,
71
- onOpenChange: (e) => {
72
- u(e), i && !Array.isArray(i) && !e && (s(o.map.get(i)?.label || ""), g("selection"));
70
+ open: a,
71
+ onOpenChange: (n) => {
72
+ u(a), i && !Array.isArray(i) && !n && (s(t.map.get(i)?.label || ""), g("selection"));
73
73
  },
74
- children: /* @__PURE__ */ a(
74
+ children: /* @__PURE__ */ c(
75
75
  "div",
76
76
  {
77
- ref: (e) => {
78
- f.current = e, typeof n == "function" ? n(e) : typeof n == "object" && n?.current && (n.current = e);
77
+ ref: (n) => {
78
+ O.current = n, typeof e == "function" ? e(n) : typeof e == "object" && e?.current && (e.current = n);
79
79
  },
80
80
  "data-slot": "select-root",
81
81
  children: C
@@ -1 +1 @@
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
+ "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 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";
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 s } from "./isValid-nnPUOITD.js";
9
- function C(o, r, e) {
10
- return D(o, -1, e);
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 = h(
13
- ({ className: o, ...r }, e) => {
14
- const [d] = x("(min-width: 900px)"), { ref: c, matches: f } = y({
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: a,
18
- closeOnRangeSelect: u,
19
- setActiveMenu: l,
17
+ value: e,
18
+ closeOnRangeSelect: l,
19
+ setActiveMenu: u,
20
20
  onValueChange: n,
21
21
  onOpenChange: i
22
- } = g();
23
- return /* @__PURE__ */ m(
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
- c.current = t, typeof e == "function" ? e(t) : typeof e == "object" && e !== null && (e.current = t);
31
+ f.current = t, typeof o == "function" ? o(t) : typeof o == "object" && o !== null && (o.current = t);
29
32
  },
30
- className: M(
33
+ className: g(
31
34
  "mds:@container mds:min-w-auto mds:min-[900px]:min-w-670",
32
- o
35
+ a
33
36
  ),
34
- children: /* @__PURE__ */ m(
37
+ children: /* @__PURE__ */ s(
35
38
  w,
36
39
  {
37
- ...r,
40
+ ...m,
38
41
  animate: !0,
39
42
  mode: "range",
40
43
  captionLayout: "dropdown",
41
- numberOfMonths: d || f ? 2 : 1,
44
+ numberOfMonths: d || c ? 2 : 1,
42
45
  navLayout: "around",
43
46
  className: "ms-date-range",
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);
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
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mainstack-design-system",
3
- "version": "1.17.1",
3
+ "version": "1.17.3",
4
4
  "type": "module",
5
5
  "main": "./dist/mainstack-design-system.cjs",
6
6
  "module": "./dist/mainstack-design-system.js",