@oneplatformdev/ui 0.0.1-beta.45 → 0.0.1-beta.46
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/Select/Select.mjs +48 -46
- package/package.json +1 -1
package/Select/Select.mjs
CHANGED
@@ -1,65 +1,67 @@
|
|
1
|
-
import { jsxs as d, jsx as
|
2
|
-
import {
|
1
|
+
import { jsxs as d, jsx as c } from "react/jsx-runtime";
|
2
|
+
import { createElement as f } from "react";
|
3
|
+
import { Button as g } from "../Button/Button.mjs";
|
3
4
|
import "../Button/buttonVariants.mjs";
|
4
|
-
import { SelectRoot as
|
5
|
-
import { isValidReactElement as
|
6
|
-
const
|
7
|
-
const { placeholder: l, renderTrigger: e, slotProps:
|
8
|
-
return e && typeof e == "function" &&
|
9
|
-
},
|
10
|
-
const { renderOption: l, option: e, index:
|
11
|
-
return l && typeof l == "function" &&
|
5
|
+
import { SelectRoot as p, SelectContent as h, SelectTrigger as v, SelectValue as S, SelectItem as u } from "./SelectRoot.mjs";
|
6
|
+
import { isValidReactElement as i } from "@oneplatformdev/utils";
|
7
|
+
const C = (r) => {
|
8
|
+
const { placeholder: l, renderTrigger: e, slotProps: n } = r, t = /* @__PURE__ */ c(v, { ...(n == null ? void 0 : n.triggerProps) || {}, children: /* @__PURE__ */ c(S, { placeholder: l }) });
|
9
|
+
return e && typeof e == "function" && i(e(r, t)) ? e(r, t) : t;
|
10
|
+
}, x = (r) => {
|
11
|
+
const { renderOption: l, option: e, index: n, options: t, ...a } = r, o = /* @__PURE__ */ c(u, { value: e.value, children: e.label }, e.value);
|
12
|
+
return l && typeof l == "function" && i(l(
|
12
13
|
e,
|
13
|
-
t,
|
14
14
|
n,
|
15
|
-
{ ...i, options: n },
|
16
|
-
r
|
17
|
-
)) ? c(l(
|
18
|
-
e,
|
19
15
|
t,
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
), u) ? c(l(
|
16
|
+
{ ...a, options: t },
|
17
|
+
o
|
18
|
+
)) ? i(l(
|
24
19
|
e,
|
25
|
-
t,
|
26
20
|
n,
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
t,
|
22
|
+
{ ...a, options: t },
|
23
|
+
o
|
24
|
+
), u) ? i(l(
|
30
25
|
e,
|
26
|
+
n,
|
31
27
|
t,
|
28
|
+
{ ...a, options: t },
|
29
|
+
o
|
30
|
+
)) : /* @__PURE__ */ c(u, { value: e.value, children: l(
|
31
|
+
e,
|
32
32
|
n,
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
},
|
33
|
+
t,
|
34
|
+
{ ...a, options: t },
|
35
|
+
o
|
36
|
+
) }, e.value) : o;
|
37
|
+
}, j = (r) => {
|
37
38
|
const {
|
38
39
|
value: l,
|
39
40
|
options: e,
|
40
|
-
onChange:
|
41
|
-
nullable:
|
42
|
-
clearLabel:
|
43
|
-
disabled:
|
44
|
-
} =
|
41
|
+
onChange: n,
|
42
|
+
nullable: t = !1,
|
43
|
+
clearLabel: a = "Clear",
|
44
|
+
disabled: o
|
45
|
+
} = r;
|
45
46
|
return /* @__PURE__ */ d(
|
46
|
-
|
47
|
+
p,
|
47
48
|
{
|
48
49
|
value: l,
|
49
|
-
onValueChange:
|
50
|
-
disabled:
|
50
|
+
onValueChange: n,
|
51
|
+
disabled: o,
|
51
52
|
children: [
|
52
|
-
/* @__PURE__ */
|
53
|
-
/* @__PURE__ */ d(
|
54
|
-
|
55
|
-
|
56
|
-
}, children:
|
57
|
-
e.map((
|
58
|
-
|
53
|
+
/* @__PURE__ */ c(C, { ...r }),
|
54
|
+
/* @__PURE__ */ d(h, { children: [
|
55
|
+
t && /* @__PURE__ */ c(g, { className: "w-full px-2", variant: "secondary", size: "sm", onClick: () => {
|
56
|
+
n("");
|
57
|
+
}, children: a }),
|
58
|
+
e.map((m, s) => /* @__PURE__ */ f(
|
59
|
+
x,
|
59
60
|
{
|
60
|
-
...
|
61
|
-
|
62
|
-
|
61
|
+
...r,
|
62
|
+
key: m.value,
|
63
|
+
option: m,
|
64
|
+
index: s
|
63
65
|
}
|
64
66
|
))
|
65
67
|
] })
|
@@ -68,5 +70,5 @@ const S = (o) => {
|
|
68
70
|
);
|
69
71
|
};
|
70
72
|
export {
|
71
|
-
|
73
|
+
j as Select
|
72
74
|
};
|