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