@selfcommunity/react-ui 0.11.0-alpha.35 → 0.11.0-alpha.37

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.
@@ -36,6 +36,8 @@ class HashtagNode extends lexical_1.TextNode {
36
36
  if (inner === null) {
37
37
  return true;
38
38
  }
39
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
40
+ // @ts-ignore
39
41
  super.updateDOM(prevNode, inner, config);
40
42
  return false;
41
43
  }
@@ -50,6 +50,8 @@ class MentionNode extends lexical_1.TextNode {
50
50
  if (inner === null) {
51
51
  return true;
52
52
  }
53
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
54
+ // @ts-ignore
53
55
  super.updateDOM(prevNode, inner, config);
54
56
  return false;
55
57
  }
@@ -1 +1,2 @@
1
+ export declare const DEFAULT_COUNTERS_LIMIT = 3;
1
2
  export declare function numberFormatter(num: number): JSX.Element;
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.numberFormatter = void 0;
3
+ exports.numberFormatter = exports.DEFAULT_COUNTERS_LIMIT = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ exports.DEFAULT_COUNTERS_LIMIT = 3;
5
6
  function numberFormatter(num) {
6
- const surplus = num - 3;
7
+ const surplus = num === exports.DEFAULT_COUNTERS_LIMIT ? 1 : num < exports.DEFAULT_COUNTERS_LIMIT ? num : num - exports.DEFAULT_COUNTERS_LIMIT;
7
8
  if (surplus > 999999) {
8
9
  return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["+", (Math.abs(surplus) / 1000000).toFixed(1), "M"] });
9
10
  }
10
- else if (num > 999) {
11
+ else if (surplus > 999) {
11
12
  return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["+", (Math.abs(surplus) / 1000).toFixed(1), "K"] });
12
13
  }
13
14
  return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["+", surplus] });
@@ -33,6 +33,8 @@ export class HashtagNode extends TextNode {
33
33
  if (inner === null) {
34
34
  return true;
35
35
  }
36
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
37
+ // @ts-ignore
36
38
  super.updateDOM(prevNode, inner, config);
37
39
  return false;
38
40
  }
@@ -47,6 +47,8 @@ export class MentionNode extends TextNode {
47
47
  if (inner === null) {
48
48
  return true;
49
49
  }
50
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
51
+ // @ts-ignore
50
52
  super.updateDOM(prevNode, inner, config);
51
53
  return false;
52
54
  }
@@ -1 +1,2 @@
1
+ export declare const DEFAULT_COUNTERS_LIMIT = 3;
1
2
  export declare function numberFormatter(num: number): JSX.Element;
@@ -1,10 +1,11 @@
1
1
  import { Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const DEFAULT_COUNTERS_LIMIT = 3;
2
3
  export function numberFormatter(num) {
3
- const surplus = num - 3;
4
+ const surplus = num === DEFAULT_COUNTERS_LIMIT ? 1 : num < DEFAULT_COUNTERS_LIMIT ? num : num - DEFAULT_COUNTERS_LIMIT;
4
5
  if (surplus > 999999) {
5
6
  return _jsxs(_Fragment, { children: ["+", (Math.abs(surplus) / 1000000).toFixed(1), "M"] });
6
7
  }
7
- else if (num > 999) {
8
+ else if (surplus > 999) {
8
9
  return _jsxs(_Fragment, { children: ["+", (Math.abs(surplus) / 1000).toFixed(1), "K"] });
9
10
  }
10
11
  return _jsxs(_Fragment, { children: ["+", surplus] });