@tecsinapse/cortex-react 1.9.19 → 1.9.20

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.
@@ -37,9 +37,14 @@ const Badge = React.forwardRef((props, ref) => {
37
37
  value
38
38
  );
39
39
  });
40
+ function getDisplayValue(value) {
41
+ const number = Number(value);
42
+ if (isNaN(number)) return value;
43
+ return number > 99 ? "99+" : number;
44
+ }
40
45
  const BadgeAnchor = React.forwardRef((props, ref) => {
41
46
  const { value, variants, children, ...rest } = props;
42
- return /* @__PURE__ */ React__namespace.createElement("div", { className: cortexCore.containerBadge() }, children, /* @__PURE__ */ React__namespace.createElement("div", { ref, className: cortexCore.badge(variants), ...rest }, value));
47
+ return /* @__PURE__ */ React__namespace.createElement("div", { className: cortexCore.containerBadge() }, children, /* @__PURE__ */ React__namespace.createElement("div", { ref, className: cortexCore.badge(variants), ...rest }, getDisplayValue(value)));
43
48
  });
44
49
 
45
50
  exports.Badge = Badge;
@@ -7,7 +7,7 @@ const useOutsideClickListener = ({
7
7
  onClickOutside
8
8
  }) => {
9
9
  const handleClickOutside = React.useCallback((event) => {
10
- if (ref.current && !ref.current.contains(event.target)) {
10
+ if (ref.current && !ref.current.contains(event.composedPath()[0])) {
11
11
  onClickOutside?.();
12
12
  }
13
13
  }, []);
@@ -17,9 +17,14 @@ const Badge = forwardRef((props, ref) => {
17
17
  value
18
18
  );
19
19
  });
20
+ function getDisplayValue(value) {
21
+ const number = Number(value);
22
+ if (isNaN(number)) return value;
23
+ return number > 99 ? "99+" : number;
24
+ }
20
25
  const BadgeAnchor = forwardRef((props, ref) => {
21
26
  const { value, variants, children, ...rest } = props;
22
- return /* @__PURE__ */ React.createElement("div", { className: containerBadge() }, children, /* @__PURE__ */ React.createElement("div", { ref, className: badge(variants), ...rest }, value));
27
+ return /* @__PURE__ */ React.createElement("div", { className: containerBadge() }, children, /* @__PURE__ */ React.createElement("div", { ref, className: badge(variants), ...rest }, getDisplayValue(value)));
23
28
  });
24
29
 
25
30
  export { Badge, BadgeAnchor };
@@ -5,7 +5,7 @@ const useOutsideClickListener = ({
5
5
  onClickOutside
6
6
  }) => {
7
7
  const handleClickOutside = useCallback((event) => {
8
- if (ref.current && !ref.current.contains(event.target)) {
8
+ if (ref.current && !ref.current.contains(event.composedPath()[0])) {
9
9
  onClickOutside?.();
10
10
  }
11
11
  }, []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tecsinapse/cortex-react",
3
- "version": "1.9.19",
3
+ "version": "1.9.20",
4
4
  "description": "React components based in @tecsinapse/cortex-core",
5
5
  "license": "MIT",
6
6
  "main": "dist/esm/index.js",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@floating-ui/react": "^0.26.18",
22
22
  "@internationalized/date": "*",
23
- "@tecsinapse/cortex-core": "0.4.7",
23
+ "@tecsinapse/cortex-core": "0.4.8",
24
24
  "clsx": "*",
25
25
  "currency.js": "~2.0.4",
26
26
  "react-aria": "^3.33.1",
@@ -48,5 +48,5 @@
48
48
  "react-dom": ">=18.0.0",
49
49
  "tailwind": ">=3.3.0"
50
50
  },
51
- "gitHead": "56265c4e49e362349a4b93bef75555e0d6b25d64"
51
+ "gitHead": "ab2f8c9d26b485333c68e1f9016099cb0e7eca4b"
52
52
  }