@charlesgomes/leafcode-shared-lib-react 1.0.61 → 1.0.63
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/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +20 -8
- package/dist/index.mjs +20 -8
- package/dist/styles/input.css +6 -0
- package/dist/styles/tooltip.css +57 -0
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -102,8 +102,10 @@ interface PaginatedResponse$1 {
|
|
|
102
102
|
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
103
103
|
name: string;
|
|
104
104
|
label?: string;
|
|
105
|
-
|
|
105
|
+
value?: string;
|
|
106
|
+
onChange?: (value: any) => void;
|
|
106
107
|
onSelect: (item: any) => void;
|
|
108
|
+
error?: FieldError;
|
|
107
109
|
defaultValue?: any;
|
|
108
110
|
inputAutocompleteActive?: string;
|
|
109
111
|
queryKey: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -102,8 +102,10 @@ interface PaginatedResponse$1 {
|
|
|
102
102
|
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
103
103
|
name: string;
|
|
104
104
|
label?: string;
|
|
105
|
-
|
|
105
|
+
value?: string;
|
|
106
|
+
onChange?: (value: any) => void;
|
|
106
107
|
onSelect: (item: any) => void;
|
|
108
|
+
error?: FieldError;
|
|
107
109
|
defaultValue?: any;
|
|
108
110
|
inputAutocompleteActive?: string;
|
|
109
111
|
queryKey: string;
|
package/dist/index.js
CHANGED
|
@@ -227,6 +227,15 @@ function TooltipErrorInput({
|
|
|
227
227
|
isSelect = false,
|
|
228
228
|
isInvalid = false
|
|
229
229
|
}) {
|
|
230
|
+
const theme = useLeafcodeTheme();
|
|
231
|
+
const styleVars = {
|
|
232
|
+
"--input-font-family": theme.components.input.fonts.input,
|
|
233
|
+
"--input-font-weight": theme.components.input.fonts.inputWeight,
|
|
234
|
+
"--input-font-size": theme.components.input.fonts.inputSize,
|
|
235
|
+
"--input-text-color": theme.components.input.colors.text,
|
|
236
|
+
"--input-text-color-hover": theme.colors.light,
|
|
237
|
+
"--input-error-border": theme.components.input.colors.errorBorder
|
|
238
|
+
};
|
|
230
239
|
const [isTooltipOpen, setIsTooltipOpen] = (0, import_react3.useState)(true);
|
|
231
240
|
const handleClose = () => setIsTooltipOpen(false);
|
|
232
241
|
(0, import_react3.useEffect)(() => {
|
|
@@ -235,7 +244,8 @@ function TooltipErrorInput({
|
|
|
235
244
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
236
245
|
"div",
|
|
237
246
|
{
|
|
238
|
-
|
|
247
|
+
style: styleVars,
|
|
248
|
+
className: `tooltip-wrapper ${isSelect ? isInvalid ? "tooltip-right-select-invalid" : "tooltip-right-select" : "tooltip-right-default"}`,
|
|
239
249
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: error?.message && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
240
250
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
241
251
|
"a",
|
|
@@ -244,13 +254,13 @@ function TooltipErrorInput({
|
|
|
244
254
|
"data-tooltip-content": "",
|
|
245
255
|
"data-tooltip-place": "top-end",
|
|
246
256
|
onClick: () => setIsTooltipOpen(true),
|
|
247
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react2.WarningCircle, { size: 22, className: "
|
|
257
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react2.WarningCircle, { size: 22, className: "tooltip-icon" })
|
|
248
258
|
}
|
|
249
259
|
),
|
|
250
260
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
251
261
|
import_react_tooltip.Tooltip,
|
|
252
262
|
{
|
|
253
|
-
className: "
|
|
263
|
+
className: "tooltip-content",
|
|
254
264
|
id: name,
|
|
255
265
|
style: {
|
|
256
266
|
backgroundColor: "#f87171",
|
|
@@ -263,13 +273,13 @@ function TooltipErrorInput({
|
|
|
263
273
|
clickable: true,
|
|
264
274
|
openOnClick: true,
|
|
265
275
|
isOpen: isTooltipOpen,
|
|
266
|
-
children: isTooltipOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "
|
|
276
|
+
children: isTooltipOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "tooltip-inner", children: [
|
|
267
277
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: error?.message }),
|
|
268
278
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
269
279
|
"button",
|
|
270
280
|
{
|
|
271
281
|
onClick: handleClose,
|
|
272
|
-
className: "
|
|
282
|
+
className: "tooltip-close",
|
|
273
283
|
style: {
|
|
274
284
|
border: "none",
|
|
275
285
|
background: "transparent",
|
|
@@ -337,7 +347,7 @@ var InputBase = ({
|
|
|
337
347
|
e.target.value = val;
|
|
338
348
|
onChange?.(e);
|
|
339
349
|
};
|
|
340
|
-
const [show, setShow] = (0, import_react4.useState)(
|
|
350
|
+
const [show, setShow] = (0, import_react4.useState)(true);
|
|
341
351
|
const handleClick = () => setShow(!show);
|
|
342
352
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
343
353
|
"div",
|
|
@@ -373,7 +383,7 @@ var InputBase = ({
|
|
|
373
383
|
showPasswordToggle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
374
384
|
"div",
|
|
375
385
|
{
|
|
376
|
-
onClick: handleClick,
|
|
386
|
+
onClick: () => handleClick(),
|
|
377
387
|
className: `password-toggle ${error ? "error" : "no-error"}`,
|
|
378
388
|
children: show ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Eye, { size: 21 }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.EyeSlash, { size: 21 })
|
|
379
389
|
}
|
|
@@ -450,7 +460,7 @@ var TextAreaBase = ({
|
|
|
450
460
|
...rest
|
|
451
461
|
}
|
|
452
462
|
),
|
|
453
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "
|
|
463
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "errorTooltip", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TooltipErrorInput, { error, name }) })
|
|
454
464
|
] })
|
|
455
465
|
]
|
|
456
466
|
}
|
|
@@ -703,6 +713,7 @@ var InputBase3 = ({
|
|
|
703
713
|
name,
|
|
704
714
|
label,
|
|
705
715
|
error,
|
|
716
|
+
onChange,
|
|
706
717
|
onSelect,
|
|
707
718
|
defaultValue,
|
|
708
719
|
inputAutocompleteActive,
|
|
@@ -818,6 +829,7 @@ var InputBase3 = ({
|
|
|
818
829
|
value,
|
|
819
830
|
onChange: (e) => {
|
|
820
831
|
setValue(e.target.value);
|
|
832
|
+
onChange?.(e.target.value);
|
|
821
833
|
setIsOpen(true);
|
|
822
834
|
},
|
|
823
835
|
onFocus: () => setIsOpen(true),
|
package/dist/index.mjs
CHANGED
|
@@ -169,6 +169,15 @@ function TooltipErrorInput({
|
|
|
169
169
|
isSelect = false,
|
|
170
170
|
isInvalid = false
|
|
171
171
|
}) {
|
|
172
|
+
const theme = useLeafcodeTheme();
|
|
173
|
+
const styleVars = {
|
|
174
|
+
"--input-font-family": theme.components.input.fonts.input,
|
|
175
|
+
"--input-font-weight": theme.components.input.fonts.inputWeight,
|
|
176
|
+
"--input-font-size": theme.components.input.fonts.inputSize,
|
|
177
|
+
"--input-text-color": theme.components.input.colors.text,
|
|
178
|
+
"--input-text-color-hover": theme.colors.light,
|
|
179
|
+
"--input-error-border": theme.components.input.colors.errorBorder
|
|
180
|
+
};
|
|
172
181
|
const [isTooltipOpen, setIsTooltipOpen] = useState(true);
|
|
173
182
|
const handleClose = () => setIsTooltipOpen(false);
|
|
174
183
|
useEffect(() => {
|
|
@@ -177,7 +186,8 @@ function TooltipErrorInput({
|
|
|
177
186
|
return /* @__PURE__ */ jsx3(
|
|
178
187
|
"div",
|
|
179
188
|
{
|
|
180
|
-
|
|
189
|
+
style: styleVars,
|
|
190
|
+
className: `tooltip-wrapper ${isSelect ? isInvalid ? "tooltip-right-select-invalid" : "tooltip-right-select" : "tooltip-right-default"}`,
|
|
181
191
|
children: /* @__PURE__ */ jsx3(Fragment, { children: error?.message && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
182
192
|
/* @__PURE__ */ jsx3(
|
|
183
193
|
"a",
|
|
@@ -186,13 +196,13 @@ function TooltipErrorInput({
|
|
|
186
196
|
"data-tooltip-content": "",
|
|
187
197
|
"data-tooltip-place": "top-end",
|
|
188
198
|
onClick: () => setIsTooltipOpen(true),
|
|
189
|
-
children: /* @__PURE__ */ jsx3(WarningCircle, { size: 22, className: "
|
|
199
|
+
children: /* @__PURE__ */ jsx3(WarningCircle, { size: 22, className: "tooltip-icon" })
|
|
190
200
|
}
|
|
191
201
|
),
|
|
192
202
|
/* @__PURE__ */ jsx3(
|
|
193
203
|
Tooltip,
|
|
194
204
|
{
|
|
195
|
-
className: "
|
|
205
|
+
className: "tooltip-content",
|
|
196
206
|
id: name,
|
|
197
207
|
style: {
|
|
198
208
|
backgroundColor: "#f87171",
|
|
@@ -205,13 +215,13 @@ function TooltipErrorInput({
|
|
|
205
215
|
clickable: true,
|
|
206
216
|
openOnClick: true,
|
|
207
217
|
isOpen: isTooltipOpen,
|
|
208
|
-
children: isTooltipOpen && /* @__PURE__ */ jsxs2("div", { className: "
|
|
218
|
+
children: isTooltipOpen && /* @__PURE__ */ jsxs2("div", { className: "tooltip-inner", children: [
|
|
209
219
|
/* @__PURE__ */ jsx3("span", { children: error?.message }),
|
|
210
220
|
/* @__PURE__ */ jsx3(
|
|
211
221
|
"button",
|
|
212
222
|
{
|
|
213
223
|
onClick: handleClose,
|
|
214
|
-
className: "
|
|
224
|
+
className: "tooltip-close",
|
|
215
225
|
style: {
|
|
216
226
|
border: "none",
|
|
217
227
|
background: "transparent",
|
|
@@ -279,7 +289,7 @@ var InputBase = ({
|
|
|
279
289
|
e.target.value = val;
|
|
280
290
|
onChange?.(e);
|
|
281
291
|
};
|
|
282
|
-
const [show, setShow] = useState2(
|
|
292
|
+
const [show, setShow] = useState2(true);
|
|
283
293
|
const handleClick = () => setShow(!show);
|
|
284
294
|
return /* @__PURE__ */ jsxs3(
|
|
285
295
|
"div",
|
|
@@ -315,7 +325,7 @@ var InputBase = ({
|
|
|
315
325
|
showPasswordToggle && /* @__PURE__ */ jsx4(
|
|
316
326
|
"div",
|
|
317
327
|
{
|
|
318
|
-
onClick: handleClick,
|
|
328
|
+
onClick: () => handleClick(),
|
|
319
329
|
className: `password-toggle ${error ? "error" : "no-error"}`,
|
|
320
330
|
children: show ? /* @__PURE__ */ jsx4(Eye, { size: 21 }) : /* @__PURE__ */ jsx4(EyeSlash, { size: 21 })
|
|
321
331
|
}
|
|
@@ -392,7 +402,7 @@ var TextAreaBase = ({
|
|
|
392
402
|
...rest
|
|
393
403
|
}
|
|
394
404
|
),
|
|
395
|
-
/* @__PURE__ */ jsx5("div", { className: "
|
|
405
|
+
/* @__PURE__ */ jsx5("div", { className: "errorTooltip", children: /* @__PURE__ */ jsx5(TooltipErrorInput, { error, name }) })
|
|
396
406
|
] })
|
|
397
407
|
]
|
|
398
408
|
}
|
|
@@ -654,6 +664,7 @@ var InputBase3 = ({
|
|
|
654
664
|
name,
|
|
655
665
|
label,
|
|
656
666
|
error,
|
|
667
|
+
onChange,
|
|
657
668
|
onSelect,
|
|
658
669
|
defaultValue,
|
|
659
670
|
inputAutocompleteActive,
|
|
@@ -769,6 +780,7 @@ var InputBase3 = ({
|
|
|
769
780
|
value,
|
|
770
781
|
onChange: (e) => {
|
|
771
782
|
setValue(e.target.value);
|
|
783
|
+
onChange?.(e.target.value);
|
|
772
784
|
setIsOpen(true);
|
|
773
785
|
},
|
|
774
786
|
onFocus: () => setIsOpen(true),
|
package/dist/styles/input.css
CHANGED
|
@@ -128,6 +128,12 @@ input:-webkit-autofill:focus {
|
|
|
128
128
|
height: var(--input-height-text-area, 6rem);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
.textArea .errorTooltip {
|
|
132
|
+
position: absolute;
|
|
133
|
+
top: 1.5rem;
|
|
134
|
+
right: 0.25rem;
|
|
135
|
+
}
|
|
136
|
+
|
|
131
137
|
/* REACT SELECT */
|
|
132
138
|
.react-select-container.has-error .react-select__control {
|
|
133
139
|
border: 1px solid var(--input-error-border, #f87171) !important;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.tooltip-wrapper {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 50%;
|
|
4
|
+
transform: translateY(-50%);
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
z-index: 20;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.tooltip-right-default {
|
|
10
|
+
right: 0.5rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.tooltip-right-select {
|
|
14
|
+
right: 2.75rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.tooltip-right-select-invalid {
|
|
18
|
+
right: 4.5rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.tooltip-icon {
|
|
22
|
+
color: var(--input-error-border, #f87171);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.tooltip-content {
|
|
26
|
+
max-width: 15rem;
|
|
27
|
+
position: relative;
|
|
28
|
+
z-index: 50;
|
|
29
|
+
cursor: default;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.tooltip-inner {
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: 0.25rem;
|
|
37
|
+
font-family: var(--input-font-family, "Roboto", sans-serif);
|
|
38
|
+
font-weight: var(--input-font-weight, 400);
|
|
39
|
+
font-size: var(--input-font-size, 1px);
|
|
40
|
+
line-height: 125%;
|
|
41
|
+
transition: all 0.2s ease-in-out;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.tooltip-close {
|
|
45
|
+
background: transparent;
|
|
46
|
+
border: none;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
color: var(--input-text-color, #ffffff);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.tooltip-close:hover {
|
|
52
|
+
color: var(--input-text-color-hover, #ffffff) !important;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.tooltip-close:hover {
|
|
56
|
+
color: #000000;
|
|
57
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charlesgomes/leafcode-shared-lib-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.63",
|
|
4
4
|
"description": "Lib de componentes react",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"./table.css": "./dist/styles/table.css",
|
|
16
16
|
"./button.css": "./dist/styles/button.css",
|
|
17
17
|
"./input.css": "./dist/styles/input.css",
|
|
18
|
-
"./modalBase.css": "./dist/styles/modalBase.css"
|
|
18
|
+
"./modalBase.css": "./dist/styles/modalBase.css",
|
|
19
|
+
"./tooltip.css": "./dist/styles/tooltip.css"
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
21
22
|
"dist"
|