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

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.
@@ -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] });
@@ -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] });