@gooddata/sdk-ui-filters 11.53.0-alpha.6 → 11.53.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-filters",
3
- "version": "11.53.0-alpha.6",
3
+ "version": "11.53.0",
4
4
  "description": "GoodData.UI SDK - Filter Components",
5
5
  "license": "MIT",
6
6
  "author": "GoodData Corporation",
@@ -46,11 +46,11 @@
46
46
  "ts-invariant": "0.10.3",
47
47
  "tslib": "2.8.1",
48
48
  "uuid": "11.1.1",
49
- "@gooddata/sdk-backend-spi": "11.53.0-alpha.6",
50
- "@gooddata/sdk-model": "11.53.0-alpha.6",
51
- "@gooddata/sdk-ui": "11.53.0-alpha.6",
52
- "@gooddata/util": "11.53.0-alpha.6",
53
- "@gooddata/sdk-ui-kit": "11.53.0-alpha.6"
49
+ "@gooddata/sdk-model": "11.53.0",
50
+ "@gooddata/sdk-backend-spi": "11.53.0",
51
+ "@gooddata/sdk-ui-kit": "11.53.0",
52
+ "@gooddata/sdk-ui": "11.53.0",
53
+ "@gooddata/util": "11.53.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@microsoft/api-documenter": "^7.17.0",
@@ -92,12 +92,12 @@
92
92
  "typescript": "5.9.3",
93
93
  "vitest": "4.1.8",
94
94
  "vitest-dom": "0.1.1",
95
- "@gooddata/oxlint-config": "11.53.0-alpha.6",
96
- "@gooddata/eslint-config": "11.53.0-alpha.6",
97
- "@gooddata/reference-workspace": "11.53.0-alpha.6",
98
- "@gooddata/sdk-backend-mockingbird": "11.53.0-alpha.6",
99
- "@gooddata/sdk-ui-theme-provider": "11.53.0-alpha.6",
100
- "@gooddata/stylelint-config": "11.53.0-alpha.6"
95
+ "@gooddata/eslint-config": "11.53.0",
96
+ "@gooddata/oxlint-config": "11.53.0",
97
+ "@gooddata/reference-workspace": "11.53.0",
98
+ "@gooddata/sdk-backend-mockingbird": "11.53.0",
99
+ "@gooddata/sdk-ui-theme-provider": "11.53.0",
100
+ "@gooddata/stylelint-config": "11.53.0"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "react": "^18.0.0 || ^19.0.0",
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=utils.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../../src/RankingFilter/ValueDropdown/utils.test.ts"],"names":[],"mappings":""}
@@ -1,140 +0,0 @@
1
- // (C) 2020-2025 GoodData Corporation
2
- import { createIntl, createIntlCache } from "react-intl";
3
- import { describe, expect, it } from "vitest";
4
- import { sanitizeCustomInput, sanitizeInput } from "./utils.js";
5
- const intlCache = createIntlCache();
6
- const intl = createIntl({
7
- locale: "en-US",
8
- messages: {
9
- "rankingFilter.valueTooSmall": "Input value should be a positive number.",
10
- "rankingFilter.valueTooLarge": "Input value too large.",
11
- },
12
- }, intlCache);
13
- describe("RankingFilter ValueDropdown utils", () => {
14
- describe("sanitizeCustomInput", () => {
15
- it("should return false for empty input", () => {
16
- expect(sanitizeCustomInput("")).toBe(false);
17
- });
18
- it("should return false for null-like input", () => {
19
- expect(sanitizeCustomInput(null)).toBe(false);
20
- expect(sanitizeCustomInput(undefined)).toBe(false);
21
- });
22
- it("should return true for valid positive numbers", () => {
23
- expect(sanitizeCustomInput("1")).toBe(true);
24
- expect(sanitizeCustomInput("42")).toBe(true);
25
- expect(sanitizeCustomInput("100")).toBe(true);
26
- expect(sanitizeCustomInput("99999")).toBe(true);
27
- });
28
- it("should return false for zero", () => {
29
- expect(sanitizeCustomInput("0")).toBe(false);
30
- });
31
- it("should return false for negative numbers", () => {
32
- expect(sanitizeCustomInput("-1")).toBe(false);
33
- expect(sanitizeCustomInput("-100")).toBe(false);
34
- });
35
- it("should return false for values exceeding MAX_VALUE (99999)", () => {
36
- expect(sanitizeCustomInput("100000")).toBe(false);
37
- expect(sanitizeCustomInput("999999")).toBe(false);
38
- });
39
- it("should return false for non-numeric input", () => {
40
- expect(sanitizeCustomInput("abc")).toBe(false);
41
- expect(sanitizeCustomInput("test")).toBe(false);
42
- });
43
- it("should handle input with leading/trailing text and extract numbers", () => {
44
- expect(sanitizeCustomInput("top 10")).toBe(true);
45
- expect(sanitizeCustomInput("value: 42")).toBe(true);
46
- });
47
- it("should handle input with whitespace", () => {
48
- expect(sanitizeCustomInput(" 10 ")).toBe(true);
49
- expect(sanitizeCustomInput(" 100 ")).toBe(true);
50
- });
51
- });
52
- describe("sanitizeInput", () => {
53
- it("should return default items when input is empty", () => {
54
- const result = sanitizeInput("", intl);
55
- expect(result).toHaveLength(8);
56
- expect(result.every((item) => item.type === "option")).toBe(true);
57
- expect(result.map((item) => item.value)).toEqual([
58
- 3, 5, 10, 15, 20, 25, 50, 100,
59
- ]);
60
- });
61
- it("should return default items when input is null-like", () => {
62
- const result = sanitizeInput(null, intl);
63
- expect(result).toHaveLength(8);
64
- });
65
- it("should return filtered items matching the input value", () => {
66
- const result = sanitizeInput("10", intl);
67
- expect(result).toHaveLength(2);
68
- expect(result.map((item) => item.label)).toEqual(["10", "100"]);
69
- });
70
- it("should return filtered items for partial match", () => {
71
- const result = sanitizeInput("1", intl);
72
- // Should match: 10, 15, 100
73
- expect(result).toHaveLength(3);
74
- expect(result.map((item) => item.label)).toEqual(["10", "15", "100"]);
75
- });
76
- it("should return filtered items for value 5", () => {
77
- const result = sanitizeInput("5", intl);
78
- // Should match: 5, 15, 25, 50
79
- expect(result).toHaveLength(4);
80
- expect(result.map((item) => item.label)).toEqual(["5", "15", "25", "50"]);
81
- });
82
- it("should return error for value less than 1", () => {
83
- const result = sanitizeInput("0", intl);
84
- expect(result).toHaveLength(1);
85
- expect(result[0]).toEqual({
86
- type: "error",
87
- label: "Input value should be a positive number.",
88
- });
89
- });
90
- it("should return error for negative values", () => {
91
- const result = sanitizeInput("-10", intl);
92
- expect(result).toHaveLength(1);
93
- expect(result[0]).toEqual({
94
- type: "error",
95
- label: "Input value should be a positive number.",
96
- });
97
- });
98
- it("should return error for values exceeding MAX_VALUE (99999)", () => {
99
- const result = sanitizeInput("100000", intl);
100
- expect(result).toHaveLength(1);
101
- expect(result[0]).toEqual({
102
- type: "error",
103
- label: "Input value too large.",
104
- });
105
- });
106
- it("should return error for non-numeric input", () => {
107
- const result = sanitizeInput("abc", intl);
108
- expect(result).toHaveLength(1);
109
- expect(result[0]).toEqual({
110
- type: "error",
111
- label: "Input value should be a positive number.",
112
- });
113
- });
114
- it("should handle input with whitespace", () => {
115
- const result = sanitizeInput(" 10 ", intl);
116
- expect(result).toHaveLength(2);
117
- expect(result.map((item) => item.label)).toEqual(["10", "100"]);
118
- });
119
- it("should extract numeric value from mixed input", () => {
120
- const result = sanitizeInput("top 10", intl);
121
- expect(result).toHaveLength(2);
122
- expect(result.map((item) => item.label)).toEqual(["10", "100"]);
123
- });
124
- it("should return empty filtered list for valid value not in defaults", () => {
125
- const result = sanitizeInput("42", intl);
126
- // 42 is valid but doesn't match any default item
127
- expect(result).toHaveLength(0);
128
- });
129
- it("should handle boundary value at MAX_VALUE", () => {
130
- const result = sanitizeInput("99999", intl);
131
- // Valid value but no match in defaults
132
- expect(result).toHaveLength(0);
133
- });
134
- it("should handle value just above MAX_VALUE", () => {
135
- const result = sanitizeInput("100000", intl);
136
- expect(result).toHaveLength(1);
137
- expect(result[0].type).toBe("error");
138
- });
139
- });
140
- });