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