@gustavo-valsechi/client 1.4.78 → 1.4.80

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.
@@ -50,9 +50,9 @@ const TargetProviderContainer = ({ children }) => {
50
50
  const element = (_a = target.ref) == null ? void 0 : _a.current;
51
51
  if (!element) return;
52
52
  element.addEventListener("click", () => {
53
- var _a2, _b;
54
53
  const targetElement = import_lodash.default.find(containerRef.current, (data, i) => i === index);
55
54
  if (!targetElement) return;
55
+ console.log(index, "onClick");
56
56
  if (targetElement.style.opacity === "1") {
57
57
  targetElement.style.opacity = "0";
58
58
  targetElement.style.zIndex = "-1";
@@ -63,10 +63,10 @@ const TargetProviderContainer = ({ children }) => {
63
63
  targetElement.style.left = `${coords.left}px`;
64
64
  targetElement.style.opacity = "1";
65
65
  targetElement.style.zIndex = "10";
66
- (_b = (_a2 = inputRef.current) == null ? void 0 : _a2[index]) == null ? void 0 : _b.focus();
66
+ inputRef.current[index].focus();
67
67
  });
68
68
  });
69
- }, [targets]);
69
+ }, [targets, inputRef, containerRef]);
70
70
  const getCoords = (target) => {
71
71
  const rect = target.getBoundingClientRect();
72
72
  const targetTop = rect.top + window.scrollY;
@@ -123,11 +123,15 @@ const TargetProviderContainer = ({ children }) => {
123
123
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
124
124
  "input",
125
125
  {
126
- hidden: true,
126
+ style: { zIndex: "-1", position: "fixed", opacity: "0" },
127
127
  ref: (element) => inputRef.current[index] = element,
128
128
  onBlur: () => {
129
- var _a;
130
- return !inside && ((_a = containerRef.current[index]) == null ? void 0 : _a.click());
129
+ if (inside) return;
130
+ console.log(index, "onBlur");
131
+ containerRef.current[index].click();
132
+ },
133
+ onFocus: () => {
134
+ console.log(index, "onFocus");
131
135
  }
132
136
  }
133
137
  )
@@ -16,9 +16,9 @@ const TargetProviderContainer = ({ children }) => {
16
16
  const element = (_a = target.ref) == null ? void 0 : _a.current;
17
17
  if (!element) return;
18
18
  element.addEventListener("click", () => {
19
- var _a2, _b;
20
19
  const targetElement = _.find(containerRef.current, (data, i) => i === index);
21
20
  if (!targetElement) return;
21
+ console.log(index, "onClick");
22
22
  if (targetElement.style.opacity === "1") {
23
23
  targetElement.style.opacity = "0";
24
24
  targetElement.style.zIndex = "-1";
@@ -29,10 +29,10 @@ const TargetProviderContainer = ({ children }) => {
29
29
  targetElement.style.left = `${coords.left}px`;
30
30
  targetElement.style.opacity = "1";
31
31
  targetElement.style.zIndex = "10";
32
- (_b = (_a2 = inputRef.current) == null ? void 0 : _a2[index]) == null ? void 0 : _b.focus();
32
+ inputRef.current[index].focus();
33
33
  });
34
34
  });
35
- }, [targets]);
35
+ }, [targets, inputRef, containerRef]);
36
36
  const getCoords = (target) => {
37
37
  const rect = target.getBoundingClientRect();
38
38
  const targetTop = rect.top + window.scrollY;
@@ -89,11 +89,15 @@ const TargetProviderContainer = ({ children }) => {
89
89
  /* @__PURE__ */ jsx(
90
90
  "input",
91
91
  {
92
- hidden: true,
92
+ style: { zIndex: "-1", position: "fixed", opacity: "0" },
93
93
  ref: (element) => inputRef.current[index] = element,
94
94
  onBlur: () => {
95
- var _a;
96
- return !inside && ((_a = containerRef.current[index]) == null ? void 0 : _a.click());
95
+ if (inside) return;
96
+ console.log(index, "onBlur");
97
+ containerRef.current[index].click();
98
+ },
99
+ onFocus: () => {
100
+ console.log(index, "onFocus");
97
101
  }
98
102
  }
99
103
  )
@@ -1 +1 @@
1
- export {};
1
+ import "./setup.mts";
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.78",
3
+ "version": "1.4.80",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "build:assets": "node scripts/assets.js",
17
17
  "build": "npm run clean && npm run build:js && npm run build:types && npm run build:assets && npm run build:remodel",
18
18
  "commit": "npm run build && npm version patch --no-git-tag-version && npm publish --access public",
19
- "dev": "vite --open test/index.html"
19
+ "dev": "vite"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "react": "18.3.1",
@@ -59,7 +59,8 @@
59
59
  "styled-components": "6.1.12",
60
60
  "tsc-alias": "1.8.16",
61
61
  "typescript": "5.5.4",
62
- "vite": "^7.2.1"
62
+ "vite": "^7.2.1",
63
+ "vitest": "^4.0.8"
63
64
  },
64
65
  "publishConfig": {
65
66
  "access": "public"