@activecollab/components 1.0.401 → 1.0.403

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,4 +1,4 @@
1
- import { formatCurrency } from "./currencyUtils";
1
+ import { formatCurrency, numberWithSeparator } from "./currencyUtils";
2
2
  describe("format currency with thousandseparator set to ',' and decimalSeparator to '.'", function () {
3
3
  it.each([["", ""], ["10", "10"], ["1000", "1K"], ["1000.00", "1K"], ["1200.50", "1.2K"], ["1,200.00", "1.2K"], ["2,240.00", "2.2K"], ["22,240.00", "22.2K"], ["50,000,000.00", "50M"]])("should format currency", function (value, expected) {
4
4
  expect(formatCurrency(value, ",")).toEqual(expected);
@@ -9,4 +9,34 @@ describe("format currency with thousandseparator set to '.' and decimalSeparator
9
9
  expect(formatCurrency(value, ".")).toEqual(expected);
10
10
  });
11
11
  });
12
+ describe("numberWithSeparator", function () {
13
+ test("should format number with thousand separator", function () {
14
+ var result = numberWithSeparator(1000, ",");
15
+ expect(result).toBe("1,000");
16
+ });
17
+ test("should format string number with thousand separator", function () {
18
+ var result = numberWithSeparator("1000", ",");
19
+ expect(result).toBe("1,000");
20
+ });
21
+ test("should format decimal number with thousand separator and keep decimal part", function () {
22
+ var result = numberWithSeparator(12345.67, ",");
23
+ expect(result).toBe("12,345.67");
24
+ });
25
+ test("should not format when format is set to false", function () {
26
+ var result = numberWithSeparator(1000, ",", false);
27
+ expect(result).toBe(1000);
28
+ });
29
+ test("should handle zero with thousand separator", function () {
30
+ var result = numberWithSeparator(0, ",");
31
+ expect(result).toBe("0");
32
+ });
33
+ test("should handle negative number with thousand separator", function () {
34
+ var result = numberWithSeparator(-123456789, ",");
35
+ expect(result).toBe("-123,456,789");
36
+ });
37
+ test("should not format", function () {
38
+ var result = numberWithSeparator(123456789, ",", false);
39
+ expect(result).toBe(123456789);
40
+ });
41
+ });
12
42
  //# sourceMappingURL=currencyUtils.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"currencyUtils.test.js","names":["formatCurrency","describe","it","each","value","expected","expect","toEqual"],"sources":["../../../src/utils/currencyUtils.test.ts"],"sourcesContent":["import { formatCurrency } from \"./currencyUtils\";\n\ndescribe(\"format currency with thousandseparator set to ',' and decimalSeparator to '.'\", () => {\n it.each([\n [\"\", \"\"],\n [\"10\", \"10\"],\n [\"1000\", \"1K\"],\n [\"1000.00\", \"1K\"],\n [\"1200.50\", \"1.2K\"],\n [\"1,200.00\", \"1.2K\"],\n [\"2,240.00\", \"2.2K\"],\n [\"22,240.00\", \"22.2K\"],\n [\"50,000,000.00\", \"50M\"],\n ])(\"should format currency\", (value, expected) => {\n expect(formatCurrency(value, \",\")).toEqual(expected);\n });\n});\n\ndescribe(\"format currency with thousandseparator set to '.' and decimalSeparator to ','\", () => {\n it.each([\n [\"\", \"\"],\n [\"10\", \"10\"],\n [\"1000\", \"1K\"],\n [\"1000,00\", \"1K\"],\n [\"1200,50\", \"1.2K\"],\n [\"1.200,00\", \"1.2K\"],\n [\"2.240,00\", \"2.2K\"],\n [\"22.240,00\", \"22.2K\"],\n [\"50.000.000,00\", \"50M\"],\n ])(\"should format currency\", (value, expected) => {\n expect(formatCurrency(value, \".\")).toEqual(expected);\n });\n});\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,iBAAiB;AAEhDC,QAAQ,CAAC,+EAA+E,EAAE,YAAM;EAC9FC,EAAE,CAACC,IAAI,CAAC,CACN,CAAC,EAAE,EAAE,EAAE,CAAC,EACR,CAAC,IAAI,EAAE,IAAI,CAAC,EACZ,CAAC,MAAM,EAAE,IAAI,CAAC,EACd,CAAC,SAAS,EAAE,IAAI,CAAC,EACjB,CAAC,SAAS,EAAE,MAAM,CAAC,EACnB,CAAC,UAAU,EAAE,MAAM,CAAC,EACpB,CAAC,UAAU,EAAE,MAAM,CAAC,EACpB,CAAC,WAAW,EAAE,OAAO,CAAC,EACtB,CAAC,eAAe,EAAE,KAAK,CAAC,CACzB,CAAC,CAAC,wBAAwB,EAAE,UAACC,KAAK,EAAEC,QAAQ,EAAK;IAChDC,MAAM,CAACN,cAAc,CAACI,KAAK,EAAE,GAAG,CAAC,CAAC,CAACG,OAAO,CAACF,QAAQ,CAAC;EACtD,CAAC,CAAC;AACJ,CAAC,CAAC;AAEFJ,QAAQ,CAAC,+EAA+E,EAAE,YAAM;EAC9FC,EAAE,CAACC,IAAI,CAAC,CACN,CAAC,EAAE,EAAE,EAAE,CAAC,EACR,CAAC,IAAI,EAAE,IAAI,CAAC,EACZ,CAAC,MAAM,EAAE,IAAI,CAAC,EACd,CAAC,SAAS,EAAE,IAAI,CAAC,EACjB,CAAC,SAAS,EAAE,MAAM,CAAC,EACnB,CAAC,UAAU,EAAE,MAAM,CAAC,EACpB,CAAC,UAAU,EAAE,MAAM,CAAC,EACpB,CAAC,WAAW,EAAE,OAAO,CAAC,EACtB,CAAC,eAAe,EAAE,KAAK,CAAC,CACzB,CAAC,CAAC,wBAAwB,EAAE,UAACC,KAAK,EAAEC,QAAQ,EAAK;IAChDC,MAAM,CAACN,cAAc,CAACI,KAAK,EAAE,GAAG,CAAC,CAAC,CAACG,OAAO,CAACF,QAAQ,CAAC;EACtD,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"currencyUtils.test.js","names":["formatCurrency","numberWithSeparator","describe","it","each","value","expected","expect","toEqual","test","result","toBe"],"sources":["../../../src/utils/currencyUtils.test.ts"],"sourcesContent":["import { formatCurrency, numberWithSeparator } from \"./currencyUtils\";\n\ndescribe(\"format currency with thousandseparator set to ',' and decimalSeparator to '.'\", () => {\n it.each([\n [\"\", \"\"],\n [\"10\", \"10\"],\n [\"1000\", \"1K\"],\n [\"1000.00\", \"1K\"],\n [\"1200.50\", \"1.2K\"],\n [\"1,200.00\", \"1.2K\"],\n [\"2,240.00\", \"2.2K\"],\n [\"22,240.00\", \"22.2K\"],\n [\"50,000,000.00\", \"50M\"],\n ])(\"should format currency\", (value, expected) => {\n expect(formatCurrency(value, \",\")).toEqual(expected);\n });\n});\n\ndescribe(\"format currency with thousandseparator set to '.' and decimalSeparator to ','\", () => {\n it.each([\n [\"\", \"\"],\n [\"10\", \"10\"],\n [\"1000\", \"1K\"],\n [\"1000,00\", \"1K\"],\n [\"1200,50\", \"1.2K\"],\n [\"1.200,00\", \"1.2K\"],\n [\"2.240,00\", \"2.2K\"],\n [\"22.240,00\", \"22.2K\"],\n [\"50.000.000,00\", \"50M\"],\n ])(\"should format currency\", (value, expected) => {\n expect(formatCurrency(value, \".\")).toEqual(expected);\n });\n});\n\ndescribe(\"numberWithSeparator\", () => {\n test(\"should format number with thousand separator\", () => {\n const result = numberWithSeparator(1000, \",\");\n expect(result).toBe(\"1,000\");\n });\n\n test(\"should format string number with thousand separator\", () => {\n const result = numberWithSeparator(\"1000\", \",\");\n expect(result).toBe(\"1,000\");\n });\n\n test(\"should format decimal number with thousand separator and keep decimal part\", () => {\n const result = numberWithSeparator(12345.67, \",\");\n expect(result).toBe(\"12,345.67\");\n });\n\n test(\"should not format when format is set to false\", () => {\n const result = numberWithSeparator(1000, \",\", false);\n expect(result).toBe(1000);\n });\n\n test(\"should handle zero with thousand separator\", () => {\n const result = numberWithSeparator(0, \",\");\n expect(result).toBe(\"0\");\n });\n\n test(\"should handle negative number with thousand separator\", () => {\n const result = numberWithSeparator(-123456789, \",\");\n expect(result).toBe(\"-123,456,789\");\n });\n\n test(\"should not format\", () => {\n const result = numberWithSeparator(123456789, \",\", false);\n expect(result).toBe(123456789);\n });\n});\n"],"mappings":"AAAA,SAASA,cAAc,EAAEC,mBAAmB,QAAQ,iBAAiB;AAErEC,QAAQ,CAAC,+EAA+E,EAAE,YAAM;EAC9FC,EAAE,CAACC,IAAI,CAAC,CACN,CAAC,EAAE,EAAE,EAAE,CAAC,EACR,CAAC,IAAI,EAAE,IAAI,CAAC,EACZ,CAAC,MAAM,EAAE,IAAI,CAAC,EACd,CAAC,SAAS,EAAE,IAAI,CAAC,EACjB,CAAC,SAAS,EAAE,MAAM,CAAC,EAC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C,MAAM,EAAE,GAAG,CAAC;IAC/CM,MAAM,CAACG,MAAM,CAAC,CAACC,IAAI,CAAC,OAAO,CAAC;EAC9B,CAAC,CAAC;EAEFF,IAAI,CAAC,4EAA4E,EAAE,YAAM;IACvF,IAAMC,MAAM,GAAGT,mBAAmB,CAAC,QAAQ,EAAE,GAAG,CAAC;IACjDM,MAAM,CAACG,MAAM,CAAC,CAACC,IAAI,CAAC,WAAW,CAAC;EAClC,CAAC,CAAC;EAEFF,IAAI,CAAC,+CAA+C,EAAE,YAAM;IAC1D,IAAMC,MAAM,GAAGT,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC;IACpDM,MAAM,CAACG,MAAM,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;EAC3B,CAAC,CAAC;EAEFF,IAAI,CAAC,4CAA4C,EAAE,YAAM;IACvD,IAAMC,MAAM,GAAGT,mBAAmB,CAAC,CAAC,EAAE,GAAG,CAAC;IAC1CM,MAAM,CAACG,MAAM,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;EAC1B,CAAC,CAAC;EAEFF,IAAI,CAAC,uDAAuD,EAAE,YAAM;IAClE,IAAMC,MAAM,GAAGT,mBAAmB,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC;IACnDM,MAAM,CAACG,MAAM,CAAC,CAACC,IAAI,CAAC,cAAc,CAAC;EACrC,CAAC,CAAC;EAEFF,IAAI,CAAC,mBAAmB,EAAE,YAAM;IAC9B,IAAMC,MAAM,GAAGT,mBAAmB,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC;IACzDM,MAAM,CAACG,MAAM,CAAC,CAACC,IAAI,CAAC,SAAS,CAAC;EAChC,CAAC,CAAC;AACJ,CAAC,CAAC"}
package/dist/index.js CHANGED
@@ -3300,6 +3300,44 @@
3300
3300
  DependencyIcon.displayName = "DependencyIcon";
3301
3301
  var DependencyIcon$1 = DependencyIcon;
3302
3302
 
3303
+ /**
3304
+ * @component DescriptionSmallIcon
3305
+ * @description
3306
+ *
3307
+ * The React Icon component is a visual element that displays an icon to represent a concept, object, or action.
3308
+ * The Icon component is
3309
+ * customizable, allowing for variations in size, color, and style to fit the needs of the application.
3310
+ *
3311
+ *
3312
+ * @example
3313
+ * return (
3314
+ * <DescriptionSmallIcon className="mr-2" />
3315
+ * )
3316
+ *
3317
+ * @see
3318
+ * https://system.activecollab.com/?path=/story/foundation-icons-icons--icons
3319
+ * @see
3320
+ * https://design.activecollab.com/docs/foundations/icons
3321
+ */
3322
+ var DescriptionSmallIcon = /*#__PURE__*/React__default["default"].forwardRef(function (props, svgRef) {
3323
+ return /*#__PURE__*/React__default["default"].createElement("svg", _extends({
3324
+ width: 18,
3325
+ height: 18,
3326
+ viewBox: "0 0 18 18",
3327
+ xmlns: "http://www.w3.org/2000/svg",
3328
+ "data-testid": "DescriptionSmallIcon",
3329
+ fill: "var(--color-theme-600)",
3330
+ focusable: false,
3331
+ ref: svgRef
3332
+ }, props), /*#__PURE__*/React__default["default"].createElement("path", {
3333
+ fillRule: "evenodd",
3334
+ clipRule: "evenodd",
3335
+ d: "M15 15H3a1.5 1.5 0 01-1.5-1.5v-9A1.5 1.5 0 013 3h12a1.5 1.5 0 011.5 1.5v9A1.5 1.5 0 0115 15zM3 4.5v9h12v-9H3zm1.5 2.25h9v1.5h-9v-1.5zm0 3H12v1.5H4.5v-1.5z"
3336
+ }));
3337
+ });
3338
+ DescriptionSmallIcon.displayName = "DescriptionSmallIcon";
3339
+ var DescriptionSmallIcon$1 = DescriptionSmallIcon;
3340
+
3303
3341
  /**
3304
3342
  * @component DescriptionIcon
3305
3343
  * @description
@@ -18005,6 +18043,7 @@
18005
18043
  exports.DependencyIcon = DependencyIcon$1;
18006
18044
  exports.DependencySmallIcon = DependencySmallIcon$1;
18007
18045
  exports.DescriptionIcon = DescriptionIcon$1;
18046
+ exports.DescriptionSmallIcon = DescriptionSmallIcon$1;
18008
18047
  exports.Dialog = Dialog;
18009
18048
  exports.DiscussionAddIcon = DiscussionAddIcon$1;
18010
18049
  exports.DiscussionIcon = DiscussionIcon$1;