meticulous-ui 2.0.1 → 2.0.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.
- package/components/Dropdown/Dropdown.js +55 -46
- package/components/Dropdown/styles.js +25 -18
- package/components/Input/Input/Input.js +7 -7
- package/components/Input/Input/styles.js +1 -1
- package/components/Input/Textarea/Textarea.js +24 -24
- package/components/Input/Textarea/styles.js +2 -2
- package/package.json +2 -1
|
@@ -1,74 +1,83 @@
|
|
|
1
1
|
import { j as o } from "../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { DropdownWrapper as
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import { useState as g, useRef as b, useEffect as F, useLayoutEffect as k, createElement as B } from "react";
|
|
3
|
+
import L from "../../node_modules/lodash-es/get.js";
|
|
4
|
+
import d from "../../colors/grey.js";
|
|
5
|
+
import P from "../MenuItem/MenuItem.js";
|
|
6
|
+
import M from "../../colors/index.js";
|
|
7
|
+
import V from "../../colors/blue.js";
|
|
8
|
+
import H from "../Spinner/Spinner.js";
|
|
9
|
+
import { DropdownWrapper as I, Box as q, PWrapper as A, ChevronDownWrapper as G, OptionWrapper as J, SpinnerWrapper as K } from "./styles.js";
|
|
10
|
+
const N = (t) => {
|
|
11
|
+
if (typeof t != "string") return t;
|
|
12
|
+
if (t.endsWith("px"))
|
|
13
|
+
return parseFloat(t);
|
|
14
|
+
if (t.endsWith("rem")) {
|
|
15
|
+
const p = parseFloat(t), r = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
16
|
+
return p * r;
|
|
17
|
+
}
|
|
18
|
+
return parseFloat(t);
|
|
19
|
+
}, oe = ({
|
|
20
|
+
options: t,
|
|
21
|
+
onChange: p,
|
|
13
22
|
value: r,
|
|
14
23
|
width: n = "20rem",
|
|
15
|
-
menuHeight:
|
|
24
|
+
menuHeight: m = "20rem",
|
|
16
25
|
placeholder: $,
|
|
17
|
-
theme:
|
|
18
|
-
isLoading:
|
|
19
|
-
isDisabled:
|
|
26
|
+
theme: j = "blue",
|
|
27
|
+
isLoading: a,
|
|
28
|
+
isDisabled: w,
|
|
20
29
|
loaderColor: C
|
|
21
30
|
}) => {
|
|
22
|
-
const [
|
|
23
|
-
|
|
31
|
+
const [s, l] = g(!1), [O, u] = g("bottom"), i = b(null), h = b(null), S = () => {
|
|
32
|
+
l((e) => !e);
|
|
24
33
|
}, E = (e) => {
|
|
25
|
-
e !== r && (
|
|
34
|
+
e !== r && (p(e), l(!1));
|
|
26
35
|
};
|
|
27
|
-
|
|
28
|
-
const e = (
|
|
29
|
-
|
|
36
|
+
F(() => {
|
|
37
|
+
const e = (c) => {
|
|
38
|
+
i.current && !i.current.contains(c.target) && l(!1);
|
|
30
39
|
};
|
|
31
40
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
32
|
-
}, []),
|
|
33
|
-
if (
|
|
34
|
-
const e =
|
|
35
|
-
|
|
41
|
+
}, []), k(() => {
|
|
42
|
+
if (s && h.current && i.current) {
|
|
43
|
+
const e = i.current.getBoundingClientRect(), c = window.innerHeight, f = N(m), x = c - e.bottom;
|
|
44
|
+
x < f + 8 && e.top > x ? u("top") : u("bottom");
|
|
36
45
|
}
|
|
37
|
-
}, [
|
|
46
|
+
}, [s, m]);
|
|
38
47
|
const {
|
|
39
|
-
m50:
|
|
40
|
-
m100:
|
|
41
|
-
m200:
|
|
42
|
-
m500:
|
|
43
|
-
} =
|
|
44
|
-
|
|
48
|
+
m50: W,
|
|
49
|
+
m100: R,
|
|
50
|
+
m200: y,
|
|
51
|
+
m500: z
|
|
52
|
+
} = L(M, j, V), D = ({ value: e, label: c, disabled: f }) => /* @__PURE__ */ B(
|
|
53
|
+
P,
|
|
45
54
|
{
|
|
46
55
|
value: e,
|
|
47
|
-
label:
|
|
48
|
-
isDisabled:
|
|
56
|
+
label: c,
|
|
57
|
+
isDisabled: f,
|
|
49
58
|
onSelect: E,
|
|
50
59
|
isSelected: e === r,
|
|
51
60
|
key: e,
|
|
52
61
|
width: n,
|
|
53
|
-
selectedColor:
|
|
54
|
-
hoverColor:
|
|
55
|
-
activeColor:
|
|
62
|
+
selectedColor: y,
|
|
63
|
+
hoverColor: W,
|
|
64
|
+
activeColor: R
|
|
56
65
|
}
|
|
57
66
|
);
|
|
58
67
|
return /* @__PURE__ */ o.jsxs(
|
|
59
|
-
|
|
68
|
+
I,
|
|
60
69
|
{
|
|
61
|
-
ref:
|
|
70
|
+
ref: i,
|
|
62
71
|
$width: n,
|
|
63
|
-
$isLoading:
|
|
64
|
-
$isDisabled:
|
|
72
|
+
$isLoading: a,
|
|
73
|
+
$isDisabled: w,
|
|
65
74
|
children: [
|
|
66
|
-
/* @__PURE__ */ o.jsxs(
|
|
67
|
-
/* @__PURE__ */ o.jsx(
|
|
68
|
-
/* @__PURE__ */ o.jsx(G, { color:
|
|
75
|
+
/* @__PURE__ */ o.jsxs(q, { $width: n, onClick: S, $isOpen: s, $border: z, children: [
|
|
76
|
+
/* @__PURE__ */ o.jsx(A, { $width: n, color: r ? d.m700 : d.m500, size: "1.2rem", children: r ? t.find(({ value: e }) => r === e)?.label : $ }),
|
|
77
|
+
/* @__PURE__ */ o.jsx(G, { color: d.m500, size: 22, $isOpen: s })
|
|
69
78
|
] }),
|
|
70
|
-
|
|
71
|
-
|
|
79
|
+
/* @__PURE__ */ o.jsx(J, { $isOpen: s, $width: n, $height: m, $top: O === "top", children: /* @__PURE__ */ o.jsx("div", { ref: h, children: t.map(D) }) }),
|
|
80
|
+
a && /* @__PURE__ */ o.jsx(K, { children: /* @__PURE__ */ o.jsx(H, { size: "small", color: C }) })
|
|
72
81
|
]
|
|
73
82
|
}
|
|
74
83
|
);
|
|
@@ -1,70 +1,77 @@
|
|
|
1
|
-
import o, { css as
|
|
1
|
+
import o, { css as t, keyframes as i } from "../../node_modules/styled-components/dist/styled-components.browser.esm.js";
|
|
2
2
|
import n from "../../colors/grey.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import a from "../Typography/P/P.js";
|
|
4
|
+
import m from "../Icons/ChevronDown/ChevronDown.js";
|
|
5
5
|
import { DEFAULT_BORDER as s } from "./constants.js";
|
|
6
6
|
import p from "../../colors/white.js";
|
|
7
|
-
const d =
|
|
7
|
+
const d = i`
|
|
8
8
|
from {
|
|
9
9
|
transform: rotate(0deg);
|
|
10
10
|
}
|
|
11
11
|
to {
|
|
12
12
|
transform: rotate(180deg);
|
|
13
13
|
}
|
|
14
|
-
`,
|
|
14
|
+
`, c = i`
|
|
15
15
|
from {
|
|
16
16
|
transform: rotate(180deg);
|
|
17
17
|
}
|
|
18
18
|
to {
|
|
19
19
|
transform: rotate(0deg);
|
|
20
20
|
}
|
|
21
|
-
`,
|
|
21
|
+
`, $ = o.div`
|
|
22
22
|
max-width: ${({ $width: r }) => r};
|
|
23
23
|
position: relative;
|
|
24
24
|
|
|
25
|
-
${({ $isLoading: r }) => r &&
|
|
25
|
+
${({ $isLoading: r }) => r && t`
|
|
26
26
|
pointer-events: none;
|
|
27
27
|
opacity: 0.8;
|
|
28
28
|
`}
|
|
29
29
|
|
|
30
|
-
${({ $isDisabled: r }) => r &&
|
|
30
|
+
${({ $isDisabled: r }) => r && t`
|
|
31
31
|
pointer-events: none;
|
|
32
32
|
`}
|
|
33
33
|
`, v = o.div`
|
|
34
34
|
height: 2rem;
|
|
35
35
|
width: ${({ $width: r }) => r};
|
|
36
36
|
border-radius: 0.6rem;
|
|
37
|
-
border: ${({ $isOpen: r, $border:
|
|
37
|
+
border: ${({ $isOpen: r, $border: e }) => r ? `2px solid ${e}` : `1px solid ${s}`};
|
|
38
38
|
padding: 0.4rem 0.6rem 0.4rem;
|
|
39
39
|
display: flex;
|
|
40
40
|
align-items: center;
|
|
41
41
|
justify-content: space-between;
|
|
42
42
|
cursor: pointer;
|
|
43
|
-
`,
|
|
43
|
+
`, x = o(a)`
|
|
44
44
|
overflow: hidden;
|
|
45
45
|
white-space: nowrap;
|
|
46
46
|
text-overflow: ellipsis;
|
|
47
47
|
max-width: calc(${({ $width: r }) => r} - 2rem);
|
|
48
48
|
pointer-events: none;
|
|
49
|
-
`,
|
|
50
|
-
animation: ${({ $isOpen: r }) => r ? d :
|
|
49
|
+
`, u = o(m)`
|
|
50
|
+
animation: ${({ $isOpen: r }) => r ? d : c} 0.15s linear;
|
|
51
51
|
transform: rotate(${({ $isOpen: r }) => r ? 180 : 0}deg);
|
|
52
52
|
`, y = o.div`
|
|
53
53
|
border: 1px solid ${n.m700};
|
|
54
54
|
width: calc(${({ $width: r }) => r} + 1rem);
|
|
55
|
-
max-height: ${({ $height: r }) => r};
|
|
56
55
|
overflow: auto;
|
|
57
56
|
position: absolute;
|
|
58
57
|
z-index: 1000;
|
|
59
58
|
background-color: ${p};
|
|
60
59
|
left: 0.15rem;
|
|
60
|
+
max-height: 0;
|
|
61
|
+
transition: max-height 0.15s ease-out;
|
|
62
|
+
opacity: 0;
|
|
63
|
+
|
|
64
|
+
${({ $isOpen: r }) => r && t`
|
|
65
|
+
max-height: ${({ $height: e }) => e};
|
|
66
|
+
opacity: 1;
|
|
67
|
+
`};
|
|
61
68
|
|
|
62
|
-
${({ $top: r }) => r ?
|
|
69
|
+
${({ $top: r }) => r ? t`
|
|
63
70
|
bottom: 100%;
|
|
64
71
|
border-top-right-radius: 0.6rem;
|
|
65
72
|
border-top-left-radius: 0.6rem;
|
|
66
73
|
border-bottom-width: 0;
|
|
67
|
-
` :
|
|
74
|
+
` : t`
|
|
68
75
|
top: 100%;
|
|
69
76
|
border-bottom-right-radius: 0.6rem;
|
|
70
77
|
border-bottom-left-radius: 0.6rem;
|
|
@@ -77,9 +84,9 @@ const d = t`
|
|
|
77
84
|
`;
|
|
78
85
|
export {
|
|
79
86
|
v as Box,
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
u as ChevronDownWrapper,
|
|
88
|
+
$ as DropdownWrapper,
|
|
82
89
|
y as OptionWrapper,
|
|
83
|
-
|
|
90
|
+
x as PWrapper,
|
|
84
91
|
D as SpinnerWrapper
|
|
85
92
|
};
|
|
@@ -7,10 +7,10 @@ import M from "../../../colors/white.js";
|
|
|
7
7
|
import N from "../../../colors/grey.js";
|
|
8
8
|
const Z = ({
|
|
9
9
|
label: r,
|
|
10
|
-
onChange:
|
|
10
|
+
onChange: $,
|
|
11
11
|
value: t,
|
|
12
|
-
type:
|
|
13
|
-
hasError:
|
|
12
|
+
type: g,
|
|
13
|
+
hasError: F,
|
|
14
14
|
name: B = "input",
|
|
15
15
|
color: C = "blue",
|
|
16
16
|
size: y = "20",
|
|
@@ -23,13 +23,13 @@ const Z = ({
|
|
|
23
23
|
...d
|
|
24
24
|
}) => {
|
|
25
25
|
const [n, u] = H(!1), e = K(C), W = () => u(!0), E = () => u(!1), S = (w) => {
|
|
26
|
-
|
|
27
|
-
}, { placeholder: c } = d, x = { color: N.m500, size: 22 }, i = I(a), p = I(f), h = !!(a && i), j = !!(f && p), l =
|
|
26
|
+
$(w);
|
|
27
|
+
}, { placeholder: c } = d, x = { color: N.m500, size: 22 }, i = I(a), p = I(f), h = !!(a && i), j = !!(f && p), l = F;
|
|
28
28
|
return /* @__PURE__ */ o.jsxs(P, { children: [
|
|
29
29
|
/* @__PURE__ */ o.jsx(
|
|
30
30
|
q,
|
|
31
31
|
{
|
|
32
|
-
type:
|
|
32
|
+
type: g,
|
|
33
33
|
name: B,
|
|
34
34
|
$hasError: l,
|
|
35
35
|
size: y,
|
|
@@ -56,7 +56,7 @@ const Z = ({
|
|
|
56
56
|
$shade: e,
|
|
57
57
|
value: t,
|
|
58
58
|
background: s,
|
|
59
|
-
outerBackground: n || t ? R : s,
|
|
59
|
+
$outerBackground: n || t ? R : s,
|
|
60
60
|
$hasLeftIcon: h,
|
|
61
61
|
$hasRightIcon: j,
|
|
62
62
|
$onlyPh: c && !r,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import
|
|
3
|
-
import { useState as
|
|
4
|
-
import { Wrapper as
|
|
5
|
-
import { getColor as
|
|
6
|
-
import
|
|
2
|
+
import z from "../../../node_modules/lodash-es/omit.js";
|
|
3
|
+
import { useState as A, useRef as I } from "react";
|
|
4
|
+
import { Wrapper as L, TextareaBox as N, Parent as O, Label as S, HelperText as W } from "./styles.js";
|
|
5
|
+
import { getColor as q } from "./helpers.js";
|
|
6
|
+
import G from "../../../colors/white.js";
|
|
7
7
|
const X = ({
|
|
8
8
|
label: s,
|
|
9
9
|
onChange: m,
|
|
@@ -11,17 +11,17 @@ const X = ({
|
|
|
11
11
|
type: d,
|
|
12
12
|
hasError: u,
|
|
13
13
|
name: j = "textarea",
|
|
14
|
-
color:
|
|
15
|
-
helperText:
|
|
14
|
+
color: $ = "blue",
|
|
15
|
+
helperText: a = "",
|
|
16
16
|
background: n = "transparent",
|
|
17
|
-
outerBackground:
|
|
17
|
+
outerBackground: g = G,
|
|
18
18
|
isDynamic: c,
|
|
19
19
|
isResizeNone: B,
|
|
20
20
|
rows: F = "2",
|
|
21
|
-
cols:
|
|
21
|
+
cols: R = "20",
|
|
22
22
|
...x
|
|
23
23
|
}) => {
|
|
24
|
-
const [o, f] =
|
|
24
|
+
const [o, f] = A(!1), l = q($), p = I(null), C = () => f(!0), H = () => f(!1), w = (P) => {
|
|
25
25
|
if (c) {
|
|
26
26
|
const r = p.current;
|
|
27
27
|
if (r) {
|
|
@@ -31,44 +31,44 @@ const X = ({
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
m(P);
|
|
34
|
-
}, { placeholder: h } = x,
|
|
35
|
-
return /* @__PURE__ */ e.jsxs(
|
|
34
|
+
}, { placeholder: h } = x, i = u, y = c, E = c ? {} : { rows: F };
|
|
35
|
+
return /* @__PURE__ */ e.jsxs(L, { children: [
|
|
36
36
|
/* @__PURE__ */ e.jsx(
|
|
37
|
-
|
|
37
|
+
N,
|
|
38
38
|
{
|
|
39
39
|
type: d,
|
|
40
40
|
name: j,
|
|
41
|
-
$hasError:
|
|
41
|
+
$hasError: i,
|
|
42
42
|
value: t,
|
|
43
43
|
$isFocused: o,
|
|
44
44
|
$shade: l,
|
|
45
45
|
$isDynamic: y,
|
|
46
46
|
background: n,
|
|
47
|
-
cols:
|
|
48
|
-
isResizeNone: B,
|
|
47
|
+
cols: R,
|
|
48
|
+
$isResizeNone: B,
|
|
49
49
|
...E,
|
|
50
50
|
ref: p,
|
|
51
|
-
onFocus:
|
|
52
|
-
onBlur:
|
|
51
|
+
onFocus: C,
|
|
52
|
+
onBlur: H,
|
|
53
53
|
onChange: w,
|
|
54
|
-
...
|
|
54
|
+
...z(x, "placeholder")
|
|
55
55
|
}
|
|
56
56
|
),
|
|
57
|
-
/* @__PURE__ */ e.jsxs(
|
|
57
|
+
/* @__PURE__ */ e.jsxs(O, { children: [
|
|
58
58
|
(s || h && !t) && /* @__PURE__ */ e.jsx(
|
|
59
|
-
|
|
59
|
+
S,
|
|
60
60
|
{
|
|
61
|
-
$hasError:
|
|
61
|
+
$hasError: i,
|
|
62
62
|
$isFocused: o,
|
|
63
63
|
$shade: l,
|
|
64
64
|
value: t,
|
|
65
65
|
background: n,
|
|
66
|
-
outerBackground: o || t ?
|
|
66
|
+
$outerBackground: o || t ? g : n,
|
|
67
67
|
$onlyPh: h && !s,
|
|
68
68
|
children: s || h
|
|
69
69
|
}
|
|
70
70
|
),
|
|
71
|
-
|
|
71
|
+
a && /* @__PURE__ */ e.jsx(W, { $hasError: i, $isFocused: o, $shade: l, children: a })
|
|
72
72
|
] })
|
|
73
73
|
] });
|
|
74
74
|
};
|
|
@@ -14,7 +14,7 @@ const b = o.textarea`
|
|
|
14
14
|
min-height: 1.4rem;
|
|
15
15
|
min-width: 3rem;
|
|
16
16
|
|
|
17
|
-
${({ isResizeNone: e }) => e && r`
|
|
17
|
+
${({ $isResizeNone: e }) => e && r`
|
|
18
18
|
resize: none;
|
|
19
19
|
`}
|
|
20
20
|
|
|
@@ -59,7 +59,7 @@ const b = o.textarea`
|
|
|
59
59
|
top: -0.4rem;
|
|
60
60
|
left: 0.5rem;
|
|
61
61
|
font-size: 0.8rem;
|
|
62
|
-
background-color: ${({ outerBackground: e }) => e};
|
|
62
|
+
background-color: ${({ $outerBackground: e }) => e};
|
|
63
63
|
border-radius: 0.4rem;
|
|
64
64
|
margin: 0 0.4rem;
|
|
65
65
|
transition: 0.25s;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meticulous-ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"toasts",
|
|
36
36
|
"button",
|
|
37
37
|
"input",
|
|
38
|
+
"textarea",
|
|
38
39
|
"notification",
|
|
39
40
|
"dropdown",
|
|
40
41
|
"spinner",
|