@charlesgomes/leafcode-shared-lib-react 1.0.60 → 1.0.62

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.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
- className: `absolute ${isSelect ? isInvalid ? "right-[4.5rem]" : "right-11" : "right-2"} top-1/2 transform -translate-y-1/2 cursor-pointer z-20`,
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: "text-red-400" })
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: "max-w-[15rem] relative z-50 tooltip-content cursor-default",
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: "flex justify-between gap-1 items-center font-Roboto text-[13px] leading-[125%] transition-all", children: [
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: "text-white hover:text-black",
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)(false);
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: "absolute top-6 right-1", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TooltipErrorInput, { error, name }) })
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
  }
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
- className: `absolute ${isSelect ? isInvalid ? "right-[4.5rem]" : "right-11" : "right-2"} top-1/2 transform -translate-y-1/2 cursor-pointer z-20`,
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: "text-red-400" })
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: "max-w-[15rem] relative z-50 tooltip-content cursor-default",
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: "flex justify-between gap-1 items-center font-Roboto text-[13px] leading-[125%] transition-all", children: [
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: "text-white hover:text-black",
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(false);
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: "absolute top-6 right-1", children: /* @__PURE__ */ jsx5(TooltipErrorInput, { error, name }) })
405
+ /* @__PURE__ */ jsx5("div", { className: "errorTooltip", children: /* @__PURE__ */ jsx5(TooltipErrorInput, { error, name }) })
396
406
  ] })
397
407
  ]
398
408
  }
@@ -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.60",
3
+ "version": "1.0.62",
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"
@@ -37,6 +38,7 @@
37
38
  "peerDependencies": {
38
39
  "@tanstack/react-query": "^5.85.9",
39
40
  "primereact": "^10.9.7",
41
+ "react-hook-form": "^7.70.0",
40
42
  "react": ">=17",
41
43
  "react-dom": ">=17"
42
44
  },
@@ -48,6 +50,7 @@
48
50
  "@types/react": "^19.1.12",
49
51
  "@types/react-dom": "^19.1.9",
50
52
  "@vitejs/plugin-react": "^5.0.2",
53
+ "react-hook-form": "^7.70.0",
51
54
  "postcss": "^8.5.6",
52
55
  "react": "^19.1.1",
53
56
  "react-dom": "^19.1.1",
@@ -63,9 +66,8 @@
63
66
  "lodash.merge": "^4.6.2",
64
67
  "moment": "^2.30.1",
65
68
  "primereact": "^10.9.7",
66
- "react-hook-form": "^7.70.0",
67
69
  "react-select": "^5.10.2",
68
70
  "react-tooltip": "^5.29.1",
69
71
  "tailwind-merge": "^3.3.1"
70
72
  }
71
- }
73
+ }