meticulous-ui 3.12.1 → 3.12.2
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,28 +1,31 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as d, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import { useState as v } from "react";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import n from "prop-types";
|
|
4
|
+
import i, { keyframes as w } from "styled-components";
|
|
5
5
|
import c from "../../colors/grey.js";
|
|
6
6
|
import { black as l } from "../../colors/black.js";
|
|
7
7
|
import B from "../Icons/ChevronDown.js";
|
|
8
8
|
const O = w`
|
|
9
9
|
from { opacity: 0; transform: translateY(-6px); }
|
|
10
10
|
to { opacity: 1; transform: translateY(0); }
|
|
11
|
-
`, S =
|
|
11
|
+
`, S = i.div`
|
|
12
12
|
width: 100%;
|
|
13
13
|
display: flex;
|
|
14
14
|
flex-direction: column;
|
|
15
15
|
gap: 12px;
|
|
16
|
-
`, T =
|
|
16
|
+
`, T = i.div`
|
|
17
17
|
border: 1.5px solid
|
|
18
|
-
${({ $isOpen: o, $activeBackground:
|
|
18
|
+
${({ $isOpen: o, $activeBackground: e, $itemBorderColor: s }) => o && e ? "transparent" : s || c.m200};
|
|
19
19
|
border-radius: 12px;
|
|
20
20
|
overflow: hidden;
|
|
21
|
-
background: ${({ $isOpen: o, $activeBackground:
|
|
21
|
+
background: ${({ $isOpen: o, $activeBackground: e, $itemBackground: s }) => o && e ? e : s};
|
|
22
22
|
transition:
|
|
23
23
|
background 0.22s ease,
|
|
24
24
|
border-color 0.22s ease;
|
|
25
|
-
`, I =
|
|
25
|
+
`, I = i.h3`
|
|
26
|
+
margin: 0;
|
|
27
|
+
font: inherit;
|
|
28
|
+
`, R = i.button`
|
|
26
29
|
width: 100%;
|
|
27
30
|
display: flex;
|
|
28
31
|
align-items: center;
|
|
@@ -38,32 +41,32 @@ const O = w`
|
|
|
38
41
|
outline-offset: -2px;
|
|
39
42
|
border-radius: 12px;
|
|
40
43
|
}
|
|
41
|
-
`,
|
|
44
|
+
`, j = i.div`
|
|
42
45
|
flex-shrink: 0;
|
|
43
46
|
width: 40px;
|
|
44
47
|
height: 40px;
|
|
45
48
|
border: 1.5px solid
|
|
46
|
-
${({ $iconBackground: o, $borderColor:
|
|
49
|
+
${({ $iconBackground: o, $borderColor: e }) => o ? "transparent" : e || c.m200};
|
|
47
50
|
border-radius: 10px;
|
|
48
51
|
display: flex;
|
|
49
52
|
align-items: center;
|
|
50
53
|
justify-content: center;
|
|
51
54
|
color: ${({ $iconColor: o }) => o};
|
|
52
55
|
background: ${({ $iconBackground: o }) => o || "none"};
|
|
53
|
-
`,
|
|
56
|
+
`, q = i.span`
|
|
54
57
|
flex: 1;
|
|
55
58
|
font-size: 15px;
|
|
56
59
|
font-weight: 600;
|
|
57
60
|
color: ${({ $titleColor: o }) => o || l.m700};
|
|
58
61
|
line-height: 1.4;
|
|
59
|
-
`,
|
|
62
|
+
`, z = i.div`
|
|
60
63
|
flex-shrink: 0;
|
|
61
64
|
display: flex;
|
|
62
65
|
align-items: center;
|
|
63
66
|
color: ${({ $chevronColor: o }) => o || c.m600};
|
|
64
67
|
transform: rotate(${({ $isOpen: o }) => o ? "180deg" : "0deg"});
|
|
65
68
|
transition: transform 0.22s ease;
|
|
66
|
-
`,
|
|
69
|
+
`, A = i.div`
|
|
67
70
|
padding: 0 20px 18px calc(20px + 40px + 16px);
|
|
68
71
|
font-size: 14px;
|
|
69
72
|
line-height: 1.65;
|
|
@@ -74,109 +77,110 @@ const O = w`
|
|
|
74
77
|
color: ${({ $bodyColor: o }) => o || l.m700};
|
|
75
78
|
text-decoration: underline;
|
|
76
79
|
}
|
|
77
|
-
`,
|
|
80
|
+
`, D = l.m700, H = ({
|
|
78
81
|
items: o = [],
|
|
79
|
-
allowMultiple:
|
|
82
|
+
allowMultiple: e = !1,
|
|
80
83
|
activeBackground: s,
|
|
81
|
-
iconColor:
|
|
84
|
+
iconColor: u,
|
|
82
85
|
iconBackground: m,
|
|
83
86
|
itemBackground: $ = "#fff",
|
|
84
87
|
itemBorderColor: p,
|
|
85
88
|
titleColor: g,
|
|
86
89
|
bodyColor: b
|
|
87
90
|
}) => {
|
|
88
|
-
const [y, k] = v(/* @__PURE__ */ new Set()), C = (
|
|
89
|
-
k((
|
|
90
|
-
const
|
|
91
|
-
return
|
|
91
|
+
const [y, k] = v(/* @__PURE__ */ new Set()), C = (r) => {
|
|
92
|
+
k((t) => {
|
|
93
|
+
const a = e ? new Set(t) : /* @__PURE__ */ new Set();
|
|
94
|
+
return t.has(r) ? a.delete(r) : a.add(r), a;
|
|
92
95
|
});
|
|
93
96
|
};
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
var
|
|
96
|
-
const
|
|
97
|
-
return /* @__PURE__ */
|
|
97
|
+
return /* @__PURE__ */ d(S, { children: o.map((r) => {
|
|
98
|
+
var a, f, x;
|
|
99
|
+
const t = y.has(r.id);
|
|
100
|
+
return /* @__PURE__ */ h(
|
|
98
101
|
T,
|
|
99
102
|
{
|
|
100
|
-
$isOpen:
|
|
103
|
+
$isOpen: t,
|
|
101
104
|
$activeBackground: s,
|
|
102
105
|
$itemBackground: $,
|
|
103
106
|
$itemBorderColor: p,
|
|
104
107
|
children: [
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
|
|
108
|
+
/* @__PURE__ */ d(I, { children: /* @__PURE__ */ h(
|
|
109
|
+
R,
|
|
107
110
|
{
|
|
108
111
|
type: "button",
|
|
109
|
-
"aria-expanded":
|
|
110
|
-
"aria-controls": `accordion-body-${
|
|
111
|
-
id: `accordion-header-${
|
|
112
|
-
onClick: () => C(
|
|
112
|
+
"aria-expanded": t,
|
|
113
|
+
"aria-controls": `accordion-body-${r.id}`,
|
|
114
|
+
id: `accordion-header-${r.id}`,
|
|
115
|
+
onClick: () => C(r.id),
|
|
113
116
|
children: [
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
r.icon && /* @__PURE__ */ d(
|
|
118
|
+
j,
|
|
116
119
|
{
|
|
117
120
|
"aria-hidden": "true",
|
|
118
|
-
$iconColor: (f = (
|
|
119
|
-
$iconBackground: (x =
|
|
121
|
+
$iconColor: (f = (a = r.iconColor) != null ? a : u) != null ? f : D,
|
|
122
|
+
$iconBackground: (x = r.iconBackground) != null ? x : m,
|
|
120
123
|
$borderColor: p,
|
|
121
|
-
children:
|
|
124
|
+
children: r.icon
|
|
122
125
|
}
|
|
123
126
|
),
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ d(q, { $titleColor: g, children: r.title }),
|
|
128
|
+
/* @__PURE__ */ d(z, { "aria-hidden": "true", $isOpen: t, $chevronColor: g, children: /* @__PURE__ */ d(B, { size: 18 }) })
|
|
126
129
|
]
|
|
127
130
|
}
|
|
128
|
-
),
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
) }),
|
|
132
|
+
/* @__PURE__ */ d(
|
|
133
|
+
A,
|
|
131
134
|
{
|
|
132
|
-
id: `accordion-body-${
|
|
135
|
+
id: `accordion-body-${r.id}`,
|
|
133
136
|
role: "region",
|
|
134
|
-
"aria-labelledby": `accordion-header-${
|
|
137
|
+
"aria-labelledby": `accordion-header-${r.id}`,
|
|
138
|
+
hidden: !t,
|
|
135
139
|
$bodyColor: b,
|
|
136
|
-
children:
|
|
140
|
+
children: r.content
|
|
137
141
|
}
|
|
138
142
|
)
|
|
139
143
|
]
|
|
140
144
|
},
|
|
141
|
-
|
|
145
|
+
r.id
|
|
142
146
|
);
|
|
143
147
|
}) });
|
|
144
148
|
};
|
|
145
|
-
|
|
149
|
+
H.propTypes = {
|
|
146
150
|
/** Array of accordion items */
|
|
147
|
-
items:
|
|
148
|
-
|
|
151
|
+
items: n.arrayOf(
|
|
152
|
+
n.shape({
|
|
149
153
|
/** Unique identifier for the item */
|
|
150
|
-
id:
|
|
154
|
+
id: n.oneOfType([n.string, n.number]).isRequired,
|
|
151
155
|
/** Question / heading text */
|
|
152
|
-
title:
|
|
156
|
+
title: n.node.isRequired,
|
|
153
157
|
/** Answer / expanded content (string or JSX) */
|
|
154
|
-
content:
|
|
158
|
+
content: n.node.isRequired,
|
|
155
159
|
/** Optional icon node rendered in the icon box */
|
|
156
|
-
icon:
|
|
160
|
+
icon: n.node,
|
|
157
161
|
/** Color applied to the icon — defaults to black.m700 */
|
|
158
|
-
iconColor:
|
|
162
|
+
iconColor: n.string,
|
|
159
163
|
/** Background color of the icon box for this item — overrides accordion-level iconBackground */
|
|
160
|
-
iconBackground:
|
|
164
|
+
iconBackground: n.string
|
|
161
165
|
})
|
|
162
166
|
),
|
|
163
167
|
/** When true, multiple items can be open simultaneously */
|
|
164
|
-
allowMultiple:
|
|
168
|
+
allowMultiple: n.bool,
|
|
165
169
|
/** Background color applied to the expanded item — use a token from the colors palette e.g. blue.m50 */
|
|
166
|
-
activeBackground:
|
|
170
|
+
activeBackground: n.string,
|
|
167
171
|
/** Default icon color for all items — overridden per-item via item.iconColor. Defaults to black.m700 */
|
|
168
|
-
iconColor:
|
|
172
|
+
iconColor: n.string,
|
|
169
173
|
/** Default icon box background for all items — overridden per-item via item.iconBackground */
|
|
170
|
-
iconBackground:
|
|
174
|
+
iconBackground: n.string,
|
|
171
175
|
/** Background color for resting (closed) items. Defaults to '#fff' — use a palette token e.g. blueGray.m800 for dark mode */
|
|
172
|
-
itemBackground:
|
|
176
|
+
itemBackground: n.string,
|
|
173
177
|
/** Border color for all items — use a palette token e.g. blueGray.m600 for dark mode */
|
|
174
|
-
itemBorderColor:
|
|
178
|
+
itemBorderColor: n.string,
|
|
175
179
|
/** Title and chevron text color — use a light palette token e.g. blueGray.m100 for dark mode */
|
|
176
|
-
titleColor:
|
|
180
|
+
titleColor: n.string,
|
|
177
181
|
/** Body content text color — use a muted light token e.g. blueGray.m300 for dark mode */
|
|
178
|
-
bodyColor:
|
|
182
|
+
bodyColor: n.string
|
|
179
183
|
};
|
|
180
184
|
export {
|
|
181
|
-
|
|
185
|
+
H as default
|
|
182
186
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as H, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useState as K, useRef as Q } from "react";
|
|
3
3
|
import U from "../../../colors/white.js";
|
|
4
|
-
import
|
|
4
|
+
import m from "../../../colors/grey.js";
|
|
5
5
|
import B from "./SvgIcon.js";
|
|
6
|
-
import n, { css as
|
|
6
|
+
import n, { css as a } from "styled-components";
|
|
7
7
|
import { black as L } from "../../../colors/black.js";
|
|
8
8
|
import v from "../../../colors/red.js";
|
|
9
9
|
import { blue as V } from "../../../colors/blue.js";
|
|
@@ -21,15 +21,15 @@ const ie = {
|
|
|
21
21
|
yellow: Y.m500,
|
|
22
22
|
orange: Z.m500,
|
|
23
23
|
black: L.m500,
|
|
24
|
-
grey:
|
|
24
|
+
grey: m.m500,
|
|
25
25
|
violet: ee.m500,
|
|
26
26
|
teal: oe.m500,
|
|
27
27
|
purple: re.m500,
|
|
28
28
|
pink: te.m500
|
|
29
29
|
}, ne = (e) => {
|
|
30
30
|
var o;
|
|
31
|
-
return (o = ie[e]) != null ? o :
|
|
32
|
-
}, x = ({ $hasError: e, $shade: o, $isFocused: r, value:
|
|
31
|
+
return (o = ie[e]) != null ? o : m.m500;
|
|
32
|
+
}, x = ({ $hasError: e, $shade: o, $isFocused: r, value: s, $onlyPh: d }) => e ? typeof s == "string" && !s && !r ? m.m500 : v.m400 : r && !d ? o : m.m500, se = n.textarea`
|
|
33
33
|
border-radius: 0.64rem;
|
|
34
34
|
font-size: 2.24rem;
|
|
35
35
|
border: 2px solid ${({ $hasError: e }) => e ? v.m400 : L.m200};
|
|
@@ -40,11 +40,19 @@ const ie = {
|
|
|
40
40
|
min-height: 2.24rem;
|
|
41
41
|
min-width: 4.8rem;
|
|
42
42
|
|
|
43
|
-
${({ $
|
|
43
|
+
${({ $hasLeftIcon: e }) => e && a`
|
|
44
|
+
padding-left: 3.52rem;
|
|
45
|
+
`}
|
|
46
|
+
|
|
47
|
+
${({ $hasRightIcon: e }) => e && a`
|
|
48
|
+
padding-right: 3.52rem;
|
|
49
|
+
`}
|
|
50
|
+
|
|
51
|
+
${({ $isResizeNone: e }) => e && a`
|
|
44
52
|
resize: none;
|
|
45
53
|
`}
|
|
46
54
|
|
|
47
|
-
${({ $isDynamic: e }) => e &&
|
|
55
|
+
${({ $isDynamic: e }) => e && a`
|
|
48
56
|
resize: none;
|
|
49
57
|
`}
|
|
50
58
|
|
|
@@ -58,7 +66,7 @@ const ie = {
|
|
|
58
66
|
}
|
|
59
67
|
|
|
60
68
|
&::placeholder {
|
|
61
|
-
color: ${
|
|
69
|
+
color: ${m.m500};
|
|
62
70
|
font-weight: 300;
|
|
63
71
|
font-size: 2.24rem;
|
|
64
72
|
background-color: ${({ $background: e }) => e};
|
|
@@ -97,14 +105,14 @@ const ie = {
|
|
|
97
105
|
max-width: -webkit-fill-available; /* Chrome, Safari, Edge */
|
|
98
106
|
max-width: stretch; /* Modern Standard */
|
|
99
107
|
|
|
100
|
-
${({ $isFocused: e, $value: o, $onlyPh: r }) => !r && (e || o) ?
|
|
108
|
+
${({ $isFocused: e, $value: o, $onlyPh: r }) => !r && (e || o) ? a`
|
|
101
109
|
top: -0.64rem;
|
|
102
110
|
left: 0.8rem;
|
|
103
111
|
padding: 0 0.64rem;
|
|
104
112
|
margin: 0;
|
|
105
|
-
` :
|
|
113
|
+
` : a`
|
|
106
114
|
top: 1.28rem;
|
|
107
|
-
left: 0.8rem;
|
|
115
|
+
left: ${({ $hasLeftIcon: s }) => s ? "3.52rem" : "0.8rem"};
|
|
108
116
|
font-size: 2.24rem;
|
|
109
117
|
`}
|
|
110
118
|
`, ce = n.div`
|
|
@@ -121,7 +129,7 @@ const ie = {
|
|
|
121
129
|
label: e,
|
|
122
130
|
onChange: o,
|
|
123
131
|
value: r,
|
|
124
|
-
type:
|
|
132
|
+
type: s,
|
|
125
133
|
hasError: d,
|
|
126
134
|
name: k = "textarea",
|
|
127
135
|
color: j = "blue",
|
|
@@ -137,7 +145,7 @@ const ie = {
|
|
|
137
145
|
placeholder: u,
|
|
138
146
|
...W
|
|
139
147
|
}) => {
|
|
140
|
-
const [
|
|
148
|
+
const [l, C] = K(!1), g = ne(j), b = Q(null), M = (t) => {
|
|
141
149
|
t.style.height = "";
|
|
142
150
|
const R = t.scrollHeight - t.clientHeight;
|
|
143
151
|
if (R > 0) {
|
|
@@ -146,16 +154,16 @@ const ie = {
|
|
|
146
154
|
}
|
|
147
155
|
}, T = () => C(!0), _ = () => C(!1), D = (t) => {
|
|
148
156
|
z && b.current && M(b.current), o(t);
|
|
149
|
-
}, S = { color:
|
|
157
|
+
}, S = { color: m.m500, size: 20 }, w = !!f, F = !!h, c = d, N = z, q = y, G = { rows: O }, $ = `textarea-${k}`, I = p ? `${$}-helper` : void 0;
|
|
150
158
|
return /* @__PURE__ */ H(me, { children: [
|
|
151
159
|
/* @__PURE__ */ i(
|
|
152
160
|
se,
|
|
153
161
|
{
|
|
154
|
-
type:
|
|
162
|
+
type: s,
|
|
155
163
|
name: k,
|
|
156
|
-
$hasError:
|
|
164
|
+
$hasError: c,
|
|
157
165
|
value: r,
|
|
158
|
-
$isFocused:
|
|
166
|
+
$isFocused: l,
|
|
159
167
|
$shade: g,
|
|
160
168
|
$isDynamic: N,
|
|
161
169
|
$background: q,
|
|
@@ -165,7 +173,7 @@ const ie = {
|
|
|
165
173
|
$isResizeNone: E,
|
|
166
174
|
...G,
|
|
167
175
|
id: $,
|
|
168
|
-
"aria-invalid":
|
|
176
|
+
"aria-invalid": c ? !0 : void 0,
|
|
169
177
|
"aria-describedby": I,
|
|
170
178
|
ref: b,
|
|
171
179
|
onFocus: T,
|
|
@@ -182,18 +190,18 @@ const ie = {
|
|
|
182
190
|
{
|
|
183
191
|
as: "label",
|
|
184
192
|
htmlFor: $,
|
|
185
|
-
$hasError:
|
|
186
|
-
$isFocused:
|
|
193
|
+
$hasError: c,
|
|
194
|
+
$isFocused: l,
|
|
187
195
|
$shade: g,
|
|
188
196
|
$value: r,
|
|
189
|
-
$outerBackground:
|
|
197
|
+
$outerBackground: l || r ? A : y,
|
|
190
198
|
$hasLeftIcon: w,
|
|
191
199
|
$hasRightIcon: F,
|
|
192
200
|
$onlyPh: u && !e,
|
|
193
201
|
children: e || u
|
|
194
202
|
}
|
|
195
203
|
),
|
|
196
|
-
p && /* @__PURE__ */ i(ae, { id: I, $hasError:
|
|
204
|
+
p && /* @__PURE__ */ i(ae, { id: I, $hasError: c, $isFocused: l, $shade: g, $hasLeftIcon: w, children: p })
|
|
197
205
|
] })
|
|
198
206
|
] });
|
|
199
207
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meticulous-ui",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.2",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"description": "A comprehensive React UI component library with a wide range of customizable components, icons, colors, and utilities for building modern web applications.",
|
|
6
6
|
"types": "./index.d.ts",
|