@marimo-team/islands 0.23.7-dev47 → 0.23.7-dev48

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.
Files changed (27) hide show
  1. package/dist/{chat-ui-CufH8sfF.js → chat-ui-D8ZxPNTR.js} +3 -3
  2. package/dist/{code-visibility-C4KEMmUK.js → code-visibility-An0P9cL_.js} +1265 -935
  3. package/dist/{glide-data-editor-BK9s_dqy.js → glide-data-editor-DucgdjRo.js} +1 -1
  4. package/dist/{html-to-image-DxWM1HVj.js → html-to-image-DaPPaVDP.js} +1 -1
  5. package/dist/{input-Cc1Vvw9A.js → input-D4kjoQUB.js} +2 -0
  6. package/dist/main.js +8 -8
  7. package/dist/{process-output-DBYxXdrN.js → process-output-n0RJTxcC.js} +1 -1
  8. package/dist/{reveal-component-Dx7r_prC.js → reveal-component-B23qYh6r.js} +3 -3
  9. package/dist/style.css +1 -1
  10. package/package.json +1 -1
  11. package/src/components/data-table/__tests__/column-header.test.ts +3 -1
  12. package/src/components/data-table/__tests__/column-header.test.tsx +203 -0
  13. package/src/components/data-table/__tests__/filter-by-values-picker.test.tsx +112 -0
  14. package/src/components/data-table/__tests__/filter-pill-editor.test.tsx +175 -0
  15. package/src/components/data-table/__tests__/filters.test.ts +112 -36
  16. package/src/components/data-table/column-header.tsx +210 -157
  17. package/src/components/data-table/filter-by-values-picker.tsx +70 -9
  18. package/src/components/data-table/filter-pill-editor.tsx +289 -144
  19. package/src/components/data-table/filter-pills.tsx +49 -8
  20. package/src/components/data-table/filters.ts +131 -36
  21. package/src/components/data-table/header-items.tsx +8 -1
  22. package/src/components/data-table/operator-labels.ts +25 -0
  23. package/src/components/data-table/regex-input.tsx +61 -0
  24. package/src/components/ui/combobox.tsx +3 -2
  25. package/src/components/ui/number-field.tsx +2 -0
  26. package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +24 -24
  27. package/src/plugins/impl/data-frames/schema.ts +4 -1
@@ -24,7 +24,6 @@ describe("filterToFilterCondition", () => {
24
24
  {
25
25
  column_id: "col",
26
26
  operator: "is_null",
27
- value: undefined,
28
27
  type: "condition",
29
28
  negate: false,
30
29
  },
@@ -40,45 +39,53 @@ describe("filterToFilterCondition", () => {
40
39
  {
41
40
  column_id: "col",
42
41
  operator: "is_not_null",
43
- value: undefined,
44
42
  type: "condition",
45
43
  negate: false,
46
44
  },
47
45
  ]);
48
46
  });
49
47
 
50
- it("handles number filter with min only", () => {
51
- const result = filterToFilterCondition("age", Filter.number({ min: 18 }));
52
- expect(result).toHaveLength(1);
53
- expect(result[0]).toMatchObject({
54
- column_id: "age",
55
- operator: ">=",
56
- value: 18,
57
- type: "condition",
58
- negate: false,
59
- });
48
+ it("handles number filter with == operator", () => {
49
+ const result = filterToFilterCondition(
50
+ "age",
51
+ Filter.number({ operator: "==", value: 42 }),
52
+ );
53
+ expect(result).toEqual([
54
+ {
55
+ column_id: "age",
56
+ operator: "==",
57
+ value: 42,
58
+ type: "condition",
59
+ negate: false,
60
+ },
61
+ ]);
60
62
  });
61
63
 
62
- it("handles number filter with max only", () => {
63
- const result = filterToFilterCondition("age", Filter.number({ max: 65 }));
64
- expect(result).toHaveLength(1);
65
- expect(result[0]).toMatchObject({
66
- column_id: "age",
67
- operator: "<=",
68
- value: 65,
69
- type: "condition",
70
- negate: false,
71
- });
64
+ it("handles number filter with all comparison operators", () => {
65
+ for (const op of ["==", "!=", ">", ">=", "<", "<="] as const) {
66
+ const result = filterToFilterCondition(
67
+ "x",
68
+ Filter.number({ operator: op, value: 5 }),
69
+ );
70
+ expect(result).toHaveLength(1);
71
+ expect(result[0]).toMatchObject({ operator: op, value: 5 });
72
+ }
72
73
  });
73
74
 
74
- it("handles number filter with min and max", () => {
75
+ it("number / between emits a single between condition", () => {
75
76
  const result = filterToFilterCondition(
76
77
  "age",
77
- Filter.number({ min: 18, max: 65 }),
78
+ Filter.number({ operator: "between", min: 18, max: 65 }),
78
79
  );
79
- expect(result).toHaveLength(2);
80
- expect(result[0]).toMatchObject({ operator: ">=", value: 18 });
81
- expect(result[1]).toMatchObject({ operator: "<=", value: 65 });
80
+ expect(result).toEqual([
81
+ {
82
+ column_id: "age",
83
+ operator: "between",
84
+ value: { min: 18, max: 65 },
85
+ type: "condition",
86
+ negate: false,
87
+ },
88
+ ]);
82
89
  });
83
90
 
84
91
  it("handles text filter", () => {
@@ -97,6 +104,71 @@ describe("filterToFilterCondition", () => {
97
104
  ]);
98
105
  });
99
106
 
107
+ it("handles text filter with all single-string operators", () => {
108
+ for (const op of [
109
+ "contains",
110
+ "equals",
111
+ "does_not_equal",
112
+ "regex",
113
+ "starts_with",
114
+ "ends_with",
115
+ ] as const) {
116
+ const result = filterToFilterCondition(
117
+ "col",
118
+ Filter.text({ operator: op, text: "x" }),
119
+ );
120
+ expect(result).toHaveLength(1);
121
+ expect(result[0]).toMatchObject({ operator: op, value: "x" });
122
+ }
123
+ });
124
+
125
+ it("handles text filter with in operator", () => {
126
+ const result = filterToFilterCondition(
127
+ "name",
128
+ Filter.text({ operator: "in", values: ["alice", "bob"] }),
129
+ );
130
+ expect(result).toEqual([
131
+ {
132
+ column_id: "name",
133
+ operator: "in",
134
+ value: ["alice", "bob"],
135
+ type: "condition",
136
+ negate: false,
137
+ },
138
+ ]);
139
+ });
140
+
141
+ it("handles text filter with not_in operator", () => {
142
+ const result = filterToFilterCondition(
143
+ "name",
144
+ Filter.text({ operator: "not_in", values: ["alice"] }),
145
+ );
146
+ expect(result).toEqual([
147
+ {
148
+ column_id: "name",
149
+ operator: "not_in",
150
+ value: ["alice"],
151
+ type: "condition",
152
+ negate: false,
153
+ },
154
+ ]);
155
+ });
156
+
157
+ it("handles text filter with is_empty operator", () => {
158
+ const result = filterToFilterCondition(
159
+ "name",
160
+ Filter.text({ operator: "is_empty" }),
161
+ );
162
+ expect(result).toEqual([
163
+ {
164
+ column_id: "name",
165
+ operator: "is_empty",
166
+ type: "condition",
167
+ negate: false,
168
+ },
169
+ ]);
170
+ });
171
+
100
172
  it("handles boolean true filter", () => {
101
173
  const result = filterToFilterCondition(
102
174
  "active",
@@ -106,7 +178,6 @@ describe("filterToFilterCondition", () => {
106
178
  {
107
179
  column_id: "active",
108
180
  operator: "is_true",
109
- value: undefined,
110
181
  type: "condition",
111
182
  negate: false,
112
183
  },
@@ -122,7 +193,6 @@ describe("filterToFilterCondition", () => {
122
193
  {
123
194
  column_id: "active",
124
195
  operator: "is_false",
125
- value: undefined,
126
196
  type: "condition",
127
197
  negate: false,
128
198
  },
@@ -166,7 +236,7 @@ describe("filterToFilterCondition", () => {
166
236
  it("every condition has type and negate fields", () => {
167
237
  const result = filterToFilterCondition(
168
238
  "col",
169
- Filter.number({ min: 1, max: 10 }),
239
+ Filter.number({ operator: "between", min: 1, max: 10 }),
170
240
  );
171
241
  for (const condition of result) {
172
242
  expect(condition).toHaveProperty("type", "condition");
@@ -188,7 +258,7 @@ describe("filtersToFilterGroup", () => {
188
258
 
189
259
  it("wraps single filter in AND group", () => {
190
260
  const result = filtersToFilterGroup([
191
- { id: "age", value: Filter.number({ min: 18 }) },
261
+ { id: "age", value: Filter.number({ operator: ">=", value: 18 }) },
192
262
  ]);
193
263
  expect(result.type).toBe("group");
194
264
  expect(result.operator).toBe("and");
@@ -198,19 +268,25 @@ describe("filtersToFilterGroup", () => {
198
268
 
199
269
  it("wraps multiple filters in AND group", () => {
200
270
  const result = filtersToFilterGroup([
201
- { id: "age", value: Filter.number({ min: 18 }) },
271
+ { id: "age", value: Filter.number({ operator: ">=", value: 18 }) },
202
272
  { id: "name", value: Filter.text({ text: "foo", operator: "contains" }) },
203
273
  ]);
204
274
  expect(result.children).toHaveLength(2);
205
275
  expect(result.operator).toBe("and");
206
276
  });
207
277
 
208
- it("flattens multi-condition filters", () => {
278
+ it("between filter emits a single between condition", () => {
209
279
  const result = filtersToFilterGroup([
210
- { id: "age", value: Filter.number({ min: 18, max: 65 }) },
280
+ {
281
+ id: "age",
282
+ value: Filter.number({ operator: "between", min: 18, max: 65 }),
283
+ },
211
284
  ]);
212
- // min + max = 2 conditions
213
- expect(result.children).toHaveLength(2);
285
+ expect(result.children).toHaveLength(1);
286
+ expect(result.children[0]).toMatchObject({
287
+ operator: "between",
288
+ value: { min: 18, max: 65 },
289
+ });
214
290
  });
215
291
  });
216
292