meticulous-ui 1.8.6 → 1.8.7
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,73 +1,74 @@
|
|
|
1
1
|
import { j as o } from "../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
2
|
+
import { useState as h, useRef as g, useEffect as k, useLayoutEffect as y, createElement as z } from "react";
|
|
3
|
+
import H from "../../node_modules/lodash-es/get.js";
|
|
4
4
|
import p from "../../colors/grey.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { DropdownWrapper as
|
|
5
|
+
import L from "../MenuItem/MenuItem.js";
|
|
6
|
+
import P from "../../colors/index.js";
|
|
7
|
+
import I from "../../colors/blue.js";
|
|
8
|
+
import M from "../Spinner/Spinner.js";
|
|
9
|
+
import { DropdownWrapper as q, Box as A, PWrapper as F, ChevronDownWrapper as G, OptionWrapper as J, SpinnerWrapper as K } from "./styles.js";
|
|
10
10
|
const oe = ({
|
|
11
11
|
options: l,
|
|
12
|
-
onChange:
|
|
12
|
+
onChange: b,
|
|
13
13
|
value: r,
|
|
14
14
|
width: n = "20rem",
|
|
15
|
-
menuHeight:
|
|
16
|
-
placeholder:
|
|
17
|
-
theme:
|
|
15
|
+
menuHeight: x = "20rem",
|
|
16
|
+
placeholder: $,
|
|
17
|
+
theme: w = "blue",
|
|
18
18
|
isLoading: f,
|
|
19
|
-
isDisabled:
|
|
20
|
-
loaderColor:
|
|
19
|
+
isDisabled: j,
|
|
20
|
+
loaderColor: C
|
|
21
21
|
}) => {
|
|
22
|
-
const [i, c] =
|
|
22
|
+
const [i, c] = h(!1), [R, u] = h("bottom"), s = g(null), m = g(null), O = () => {
|
|
23
23
|
c((e) => !e);
|
|
24
|
-
},
|
|
25
|
-
e !== r && (
|
|
24
|
+
}, E = (e) => {
|
|
25
|
+
e !== r && (b(e), c(!1));
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
k(() => {
|
|
28
28
|
const e = (t) => {
|
|
29
29
|
s.current && !s.current.contains(t.target) && c(!1);
|
|
30
30
|
};
|
|
31
31
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
32
|
-
}, []),
|
|
32
|
+
}, []), y(() => {
|
|
33
33
|
if (i && m.current && s.current) {
|
|
34
|
-
const e = m.current.getBoundingClientRect(), t = s.current.getBoundingClientRect(),
|
|
35
|
-
|
|
34
|
+
const e = m.current.getBoundingClientRect(), t = s.current.getBoundingClientRect(), a = window.innerHeight - t.bottom;
|
|
35
|
+
a < e.height + 8 && t.top > a ? u("top") : u("bottom");
|
|
36
36
|
}
|
|
37
37
|
}, [i]);
|
|
38
38
|
const {
|
|
39
|
-
m50:
|
|
39
|
+
m50: D,
|
|
40
40
|
m100: S,
|
|
41
41
|
m200: W,
|
|
42
42
|
m500: v
|
|
43
|
-
} =
|
|
44
|
-
|
|
43
|
+
} = H(P, w, I), B = ({ value: e, label: t, disabled: d }) => /* @__PURE__ */ z(
|
|
44
|
+
L,
|
|
45
45
|
{
|
|
46
46
|
value: e,
|
|
47
47
|
label: t,
|
|
48
|
-
|
|
48
|
+
isDisabled: d,
|
|
49
|
+
onSelect: E,
|
|
49
50
|
isSelected: e === r,
|
|
50
51
|
key: e,
|
|
51
52
|
width: n,
|
|
52
53
|
selectedColor: W,
|
|
53
|
-
hoverColor:
|
|
54
|
+
hoverColor: D,
|
|
54
55
|
activeColor: S
|
|
55
56
|
}
|
|
56
57
|
);
|
|
57
58
|
return /* @__PURE__ */ o.jsxs(
|
|
58
|
-
|
|
59
|
+
q,
|
|
59
60
|
{
|
|
60
61
|
ref: s,
|
|
61
62
|
$width: n,
|
|
62
63
|
$isLoading: f,
|
|
63
|
-
$isDisabled:
|
|
64
|
+
$isDisabled: j,
|
|
64
65
|
children: [
|
|
65
|
-
/* @__PURE__ */ o.jsxs(
|
|
66
|
-
/* @__PURE__ */ o.jsx(
|
|
67
|
-
/* @__PURE__ */ o.jsx(
|
|
66
|
+
/* @__PURE__ */ o.jsxs(A, { $width: n, onClick: O, $isOpen: i, $border: v, children: [
|
|
67
|
+
/* @__PURE__ */ o.jsx(F, { $width: n, color: r ? p.m700 : p.m500, size: "1.2rem", children: r ? l.find(({ value: e }) => r === e)?.label : $ }),
|
|
68
|
+
/* @__PURE__ */ o.jsx(G, { color: p.m500, size: 22, $isOpen: i })
|
|
68
69
|
] }),
|
|
69
|
-
i && /* @__PURE__ */ o.jsx(
|
|
70
|
-
f && /* @__PURE__ */ o.jsx(
|
|
70
|
+
i && /* @__PURE__ */ o.jsx(J, { ref: m, $width: n, $height: x, $top: R === "top", children: l.map(B) }),
|
|
71
|
+
f && /* @__PURE__ */ o.jsx(K, { children: /* @__PURE__ */ o.jsx(M, { size: "small", color: C }) })
|
|
71
72
|
]
|
|
72
73
|
}
|
|
73
74
|
);
|
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Wrapper as
|
|
6
|
-
const
|
|
7
|
-
value:
|
|
8
|
-
label:
|
|
9
|
-
width:
|
|
10
|
-
isSelected:
|
|
11
|
-
defaultColor: p =
|
|
12
|
-
selectedColor: c =
|
|
13
|
-
hoverColor:
|
|
14
|
-
activeColor:
|
|
15
|
-
size:
|
|
16
|
-
onSelect:
|
|
1
|
+
import { j as n } from "../../_virtual/jsx-runtime.js";
|
|
2
|
+
import e from "../../colors/grey.js";
|
|
3
|
+
import t from "../../colors/blue.js";
|
|
4
|
+
import d from "../../colors/white.js";
|
|
5
|
+
import { Wrapper as C, PWrapper as h } from "./styles.js";
|
|
6
|
+
const x = ({ isSelected: o, isDisabled: r }) => o ? e.m700 : r ? e.m300 : e.m500, W = ({
|
|
7
|
+
value: o,
|
|
8
|
+
label: r,
|
|
9
|
+
width: m = "20rem",
|
|
10
|
+
isSelected: i,
|
|
11
|
+
defaultColor: p = d,
|
|
12
|
+
selectedColor: c = t.m200,
|
|
13
|
+
hoverColor: s = t.m50,
|
|
14
|
+
activeColor: f = t.m100,
|
|
15
|
+
size: u = "1.2rem",
|
|
16
|
+
onSelect: $,
|
|
17
|
+
isDisabled: l
|
|
17
18
|
}) => {
|
|
18
|
-
const
|
|
19
|
-
|
|
19
|
+
const a = () => {
|
|
20
|
+
$(o);
|
|
20
21
|
};
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
|
|
22
|
+
return /* @__PURE__ */ n.jsx(
|
|
23
|
+
C,
|
|
23
24
|
{
|
|
24
|
-
$isSelected:
|
|
25
|
-
$width:
|
|
25
|
+
$isSelected: i,
|
|
26
|
+
$width: m,
|
|
26
27
|
$defaultColor: p,
|
|
27
28
|
$selectedColor: c,
|
|
28
|
-
$hoverColor:
|
|
29
|
-
$activeColor:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
$hoverColor: s,
|
|
30
|
+
$activeColor: f,
|
|
31
|
+
$isDisabled: l,
|
|
32
|
+
onClick: a,
|
|
33
|
+
title: r,
|
|
34
|
+
children: /* @__PURE__ */ n.jsx(h, { size: u, color: x({ isSelected: i, isDisabled: l }), $width: m, children: r })
|
|
33
35
|
}
|
|
34
36
|
);
|
|
35
37
|
};
|
|
36
38
|
export {
|
|
37
|
-
|
|
39
|
+
W as default
|
|
38
40
|
};
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import t from "../../node_modules/styled-components/dist/styled-components.browser.esm.js";
|
|
2
2
|
import a from "../Typography/P/P.js";
|
|
3
3
|
const p = t.div`
|
|
4
|
-
width: ${({ $width:
|
|
5
|
-
background-color: ${({ $isSelected:
|
|
6
|
-
cursor: ${({ $isSelected:
|
|
4
|
+
width: ${({ $width: o }) => o};
|
|
5
|
+
background-color: ${({ $isSelected: o, $defaultColor: r, $selectedColor: e }) => o ? e : r};
|
|
6
|
+
cursor: ${({ $isSelected: o }) => o ? "auto" : "pointer"};
|
|
7
7
|
padding: 0.6rem 0 0.8rem 1rem;
|
|
8
8
|
margin-top: 0.1rem;
|
|
9
|
+
pointer-events: ${({ $isDisabled: o }) => o ? "none" : "auto"};
|
|
9
10
|
|
|
10
11
|
&:hover {
|
|
11
|
-
background-color: ${({ $isSelected:
|
|
12
|
+
background-color: ${({ $isSelected: o, $hoverColor: r, $selectedColor: e }) => o ? e : r};
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
&:active {
|
|
15
|
-
background-color: ${({ $isSelected:
|
|
16
|
+
background-color: ${({ $isSelected: o, $activeColor: r, $selectedColor: e }) => o ? e : r};
|
|
16
17
|
}
|
|
17
|
-
`,
|
|
18
|
+
`, c = t(a)`
|
|
18
19
|
overflow: hidden;
|
|
19
20
|
white-space: nowrap;
|
|
20
21
|
text-overflow: ellipsis;
|
|
21
|
-
max-width: calc(${({ $width:
|
|
22
|
+
max-width: calc(${({ $width: o }) => o} - 2rem);
|
|
22
23
|
`;
|
|
23
24
|
export {
|
|
24
|
-
|
|
25
|
+
c as PWrapper,
|
|
25
26
|
p as Wrapper
|
|
26
27
|
};
|