@terreno/ui 56.0.0-beta.2 → 57.0.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.
Files changed (72) hide show
  1. package/dist/Badge.d.ts +1 -1
  2. package/dist/Badge.js +37 -1
  3. package/dist/Badge.js.map +1 -1
  4. package/dist/Common.d.ts +110 -3
  5. package/dist/Common.js.map +1 -1
  6. package/dist/Filter.d.ts +13 -0
  7. package/dist/Filter.js +120 -0
  8. package/dist/Filter.js.map +1 -0
  9. package/dist/FilterAccordion.d.ts +8 -0
  10. package/dist/FilterAccordion.js +59 -0
  11. package/dist/FilterAccordion.js.map +1 -0
  12. package/dist/FilterBoolean.d.ts +8 -0
  13. package/dist/FilterBoolean.js +74 -0
  14. package/dist/FilterBoolean.js.map +1 -0
  15. package/dist/FilterChangesBadge.d.ts +8 -0
  16. package/dist/FilterChangesBadge.js +11 -0
  17. package/dist/FilterChangesBadge.js.map +1 -0
  18. package/dist/FilterSelectMenu.d.ts +8 -0
  19. package/dist/FilterSelectMenu.js +37 -0
  20. package/dist/FilterSelectMenu.js.map +1 -0
  21. package/dist/IconRegistry.js +11 -6
  22. package/dist/IconRegistry.js.map +1 -1
  23. package/dist/PickerSelect.d.ts +8 -1
  24. package/dist/PickerSelect.js +2 -2
  25. package/dist/PickerSelect.js.map +1 -1
  26. package/dist/SelectField.js +2 -2
  27. package/dist/SelectField.js.map +1 -1
  28. package/dist/TapToEdit.js +2 -5
  29. package/dist/TapToEdit.js.map +1 -1
  30. package/dist/Theme.js +2 -0
  31. package/dist/Theme.js.map +1 -1
  32. package/dist/WebDropdownMenu.d.ts +5 -1
  33. package/dist/WebDropdownMenu.js +24 -10
  34. package/dist/WebDropdownMenu.js.map +1 -1
  35. package/dist/icons/BarsFilterIcon.d.ts +9 -0
  36. package/dist/icons/BarsFilterIcon.js +12 -0
  37. package/dist/icons/BarsFilterIcon.js.map +1 -0
  38. package/dist/index.d.ts +6 -0
  39. package/dist/index.js +6 -0
  40. package/dist/index.js.map +1 -1
  41. package/package.json +23 -23
  42. package/src/Badge.test.tsx +22 -1
  43. package/src/Badge.tsx +43 -0
  44. package/src/Common.ts +120 -5
  45. package/src/DateTimeField.test.tsx +16 -18
  46. package/src/Filter.test.tsx +94 -0
  47. package/src/Filter.tsx +257 -0
  48. package/src/FilterAccordion.test.tsx +58 -0
  49. package/src/FilterAccordion.tsx +113 -0
  50. package/src/FilterBoolean.test.tsx +65 -0
  51. package/src/FilterBoolean.tsx +130 -0
  52. package/src/FilterChangesBadge.test.tsx +16 -0
  53. package/src/FilterChangesBadge.tsx +13 -0
  54. package/src/FilterSelectMenu.test.tsx +56 -0
  55. package/src/FilterSelectMenu.tsx +76 -0
  56. package/src/IconRegistry.test.tsx +6 -4
  57. package/src/IconRegistry.tsx +13 -8
  58. package/src/PickerSelect.test.tsx +20 -0
  59. package/src/PickerSelect.tsx +10 -0
  60. package/src/SelectField.tsx +2 -0
  61. package/src/TapToEdit.tsx +6 -5
  62. package/src/Theme.tsx +2 -0
  63. package/src/WebDropdownMenu.test.tsx +86 -1
  64. package/src/WebDropdownMenu.tsx +43 -21
  65. package/src/__snapshots__/Filter.test.tsx.snap +161 -0
  66. package/src/__snapshots__/FilterAccordion.test.tsx.snap +83 -0
  67. package/src/__snapshots__/FilterBoolean.test.tsx.snap +109 -0
  68. package/src/__snapshots__/FilterChangesBadge.test.tsx.snap +18 -0
  69. package/src/__snapshots__/FilterSelectMenu.test.tsx.snap +359 -0
  70. package/src/conflictFieldDiff.test.ts +43 -0
  71. package/src/icons/BarsFilterIcon.tsx +18 -0
  72. package/src/index.tsx +6 -0
@@ -0,0 +1,359 @@
1
+ // Bun Snapshot v1, https://bun.sh/docs/test/snapshots
2
+
3
+ exports[`FilterSelectMenu renders correctly with default props 1`] = `
4
+ {
5
+ "$$typeof": Symbol(react.test.json),
6
+ "children": [
7
+ {
8
+ "$$typeof": Symbol(react.test.json),
9
+ "children": [
10
+ {
11
+ "$$typeof": Symbol(react.test.json),
12
+ "children": [
13
+ {
14
+ "$$typeof": Symbol(react.test.json),
15
+ "children": [
16
+ "Due date",
17
+ ],
18
+ "props": {
19
+ "numberOfLines": 0,
20
+ "selectable": undefined,
21
+ "style": {
22
+ "color": "#1C1C1C",
23
+ "fontFamily": "text-regular",
24
+ "fontSize": 14,
25
+ "textAlign": "left",
26
+ },
27
+ "testID": undefined,
28
+ },
29
+ "type": "Text",
30
+ },
31
+ ],
32
+ "props": {},
33
+ "type": "View",
34
+ },
35
+ ],
36
+ "props": {
37
+ "style": {
38
+ "alignItems": "center",
39
+ "flex": 1,
40
+ "flexDirection": "row",
41
+ "gap": 6,
42
+ },
43
+ "testID": undefined,
44
+ },
45
+ "type": "View",
46
+ },
47
+ {
48
+ "$$typeof": Symbol(react.test.json),
49
+ "children": [
50
+ {
51
+ "$$typeof": Symbol(react.test.json),
52
+ "children": [
53
+ {
54
+ "$$typeof": Symbol(react.test.json),
55
+ "children": [
56
+ {
57
+ "$$typeof": Symbol(react.test.json),
58
+ "children": [
59
+ {
60
+ "$$typeof": Symbol(react.test.json),
61
+ "children": [
62
+ {
63
+ "$$typeof": Symbol(react.test.json),
64
+ "children": [
65
+ {
66
+ "$$typeof": Symbol(react.test.json),
67
+ "children": null,
68
+ "props": {
69
+ "editable": false,
70
+ "multiline": true,
71
+ "style": {
72
+ "color": "#1C1C1C",
73
+ "flex": 1,
74
+ },
75
+ "testID": "text_input",
76
+ "value": "Please select an option.",
77
+ },
78
+ "type": "TextInput",
79
+ },
80
+ {
81
+ "$$typeof": Symbol(react.test.json),
82
+ "children": null,
83
+ "props": {
84
+ "style": {
85
+ "pointerEvents": "none",
86
+ },
87
+ "testID": "icon_container",
88
+ },
89
+ "type": "View",
90
+ },
91
+ ],
92
+ "props": {
93
+ "style": {
94
+ "alignItems": "center",
95
+ "flexDirection": "row",
96
+ "pointerEvents": "box-only",
97
+ "width": "100%",
98
+ },
99
+ "testID": undefined,
100
+ },
101
+ "type": "View",
102
+ },
103
+ ],
104
+ "props": {
105
+ "disabled": false,
106
+ "onPress": [Function],
107
+ "style": {
108
+ "alignItems": "center",
109
+ "flexDirection": "row",
110
+ "justifyContent": "center",
111
+ "minHeight": 40,
112
+ "paddingHorizontal": 8,
113
+ "width": "100%",
114
+ },
115
+ "testID": "ios_touchable_wrapper",
116
+ },
117
+ "type": "Pressable",
118
+ },
119
+ {
120
+ "$$typeof": Symbol(react.test.json),
121
+ "children": [
122
+ {
123
+ "$$typeof": Symbol(react.test.json),
124
+ "children": null,
125
+ "props": {
126
+ "aria-role": "button",
127
+ "onPress": [Function],
128
+ "style": {
129
+ "flex": 1,
130
+ },
131
+ "testID": "ios_modal_top",
132
+ },
133
+ "type": "Pressable",
134
+ },
135
+ {
136
+ "$$typeof": Symbol(react.test.json),
137
+ "children": [
138
+ {
139
+ "$$typeof": Symbol(react.test.json),
140
+ "children": null,
141
+ "props": {
142
+ "style": {
143
+ "flexDirection": "row",
144
+ },
145
+ "testID": undefined,
146
+ },
147
+ "type": "View",
148
+ },
149
+ {
150
+ "$$typeof": Symbol(react.test.json),
151
+ "children": [
152
+ {
153
+ "$$typeof": Symbol(react.test.json),
154
+ "children": [
155
+ {
156
+ "$$typeof": Symbol(react.test.json),
157
+ "children": [
158
+ "Done",
159
+ ],
160
+ "props": {
161
+ "allowFontScaling": false,
162
+ "style": [
163
+ {
164
+ "color": "#007aff",
165
+ "fontSize": 17,
166
+ "fontWeight": "600",
167
+ "paddingRight": 11,
168
+ "paddingTop": 1,
169
+ },
170
+ {},
171
+ ],
172
+ "testID": "done_text",
173
+ },
174
+ "type": "Text",
175
+ },
176
+ ],
177
+ "props": {
178
+ "style": undefined,
179
+ "testID": "needed_for_touchable",
180
+ },
181
+ "type": "View",
182
+ },
183
+ ],
184
+ "props": {
185
+ "hitSlop": {
186
+ "bottom": 4,
187
+ "left": 4,
188
+ "right": 4,
189
+ "top": 4,
190
+ },
191
+ "onPress": [Function],
192
+ "onPressIn": [Function],
193
+ "onPressOut": [Function],
194
+ "testID": "done_button",
195
+ },
196
+ "type": "Pressable",
197
+ },
198
+ ],
199
+ "props": {
200
+ "style": {
201
+ "alignItems": "center",
202
+ "backgroundColor": "#f8f8f8",
203
+ "borderTopColor": "#dedede",
204
+ "borderTopWidth": 1,
205
+ "flexDirection": "row",
206
+ "height": 45,
207
+ "justifyContent": "space-between",
208
+ "paddingHorizontal": 10,
209
+ "zIndex": 2,
210
+ },
211
+ "testID": "input_accessory_view",
212
+ },
213
+ "type": "View",
214
+ },
215
+ {
216
+ "$$typeof": Symbol(react.test.json),
217
+ "children": [
218
+ {
219
+ "$$typeof": Symbol(react.test.json),
220
+ "children": [
221
+ {
222
+ "$$typeof": Symbol(react.test.json),
223
+ "children": null,
224
+ "props": {
225
+ "color": undefined,
226
+ "label": "Please select an option.",
227
+ "value": "",
228
+ },
229
+ "type": "Picker.Item",
230
+ },
231
+ {
232
+ "$$typeof": Symbol(react.test.json),
233
+ "children": null,
234
+ "props": {
235
+ "color": undefined,
236
+ "label": "All",
237
+ "value": "all",
238
+ },
239
+ "type": "Picker.Item",
240
+ },
241
+ {
242
+ "$$typeof": Symbol(react.test.json),
243
+ "children": null,
244
+ "props": {
245
+ "color": undefined,
246
+ "label": "Today",
247
+ "value": "today",
248
+ },
249
+ "type": "Picker.Item",
250
+ },
251
+ ],
252
+ "props": {
253
+ "onValueChange": [Function],
254
+ "selectedValue": "",
255
+ "testID": "ios_picker",
256
+ },
257
+ "type": "Picker",
258
+ },
259
+ ],
260
+ "props": {
261
+ "style": [
262
+ {
263
+ "backgroundColor": "#d0d4da",
264
+ "justifyContent": "center",
265
+ },
266
+ {
267
+ "height": 215,
268
+ },
269
+ ],
270
+ "testID": undefined,
271
+ },
272
+ "type": "View",
273
+ },
274
+ ],
275
+ "props": {
276
+ "animationType": undefined,
277
+ "onOrientationChange": [Function],
278
+ "supportedOrientations": [
279
+ "portrait",
280
+ "landscape",
281
+ ],
282
+ "testID": "ios_modal",
283
+ "transparent": true,
284
+ "visible": false,
285
+ },
286
+ "type": "Modal",
287
+ },
288
+ ],
289
+ "props": {
290
+ "style": [
291
+ {
292
+ "alignItems": "center",
293
+ "alignSelf": "stretch",
294
+ "borderRadius": 4,
295
+ "borderWidth": 1,
296
+ "flexDirection": "row",
297
+ "justifyContent": "flex-start",
298
+ "minHeight": 40,
299
+ "width": "100%",
300
+ },
301
+ {
302
+ "backgroundColor": "#FFFFFF",
303
+ "borderColor": "#9A9A9A",
304
+ },
305
+ false,
306
+ ],
307
+ "testID": undefined,
308
+ },
309
+ "type": "View",
310
+ },
311
+ ],
312
+ "props": {
313
+ "style": {
314
+ "alignSelf": "stretch",
315
+ "minWidth": 0,
316
+ "width": "100%",
317
+ },
318
+ "testID": undefined,
319
+ },
320
+ "type": "View",
321
+ },
322
+ ],
323
+ "props": {
324
+ "style": {
325
+ "minWidth": 0,
326
+ "width": "100%",
327
+ },
328
+ "testID": undefined,
329
+ },
330
+ "type": "View",
331
+ },
332
+ ],
333
+ "props": {
334
+ "onHoverIn": [Function],
335
+ "onHoverOut": [Function],
336
+ "style": {
337
+ "overflow": "hidden",
338
+ "width": 138,
339
+ },
340
+ "testID": undefined,
341
+ },
342
+ "type": "Pressable",
343
+ },
344
+ ],
345
+ "props": {
346
+ "style": {
347
+ "alignItems": "center",
348
+ "backgroundColor": "#FFFFFF",
349
+ "borderRadius": 4,
350
+ "flexDirection": "row",
351
+ "gap": 8,
352
+ "paddingHorizontal": 8,
353
+ "paddingVertical": 12,
354
+ },
355
+ "testID": undefined,
356
+ },
357
+ "type": "View",
358
+ }
359
+ `;
@@ -4,7 +4,9 @@ import {
4
4
  formatConflictFieldLabel,
5
5
  formatConflictFieldValue,
6
6
  getChangedConflictFields,
7
+ NO_CONFLICT_DIFF_FIELDS,
7
8
  parseConflictPayload,
9
+ summarizeConflictSide,
8
10
  } from "./conflictFieldDiff";
9
11
 
10
12
  describe("conflictFieldDiff", () => {
@@ -23,4 +25,45 @@ describe("conflictFieldDiff", () => {
23
25
  it("parses invalid JSON payloads as empty objects", () => {
24
26
  expect(parseConflictPayload("not-json")).toEqual({});
25
27
  });
28
+
29
+ it("ignores sync metadata fields when diffing", () => {
30
+ const local = {__v: 1, _syncSeq: 5, title: "same", updated: "2024-01-01"};
31
+ const server = {__v: 2, _syncSeq: 9, title: "same", updated: "2024-02-02"};
32
+ expect(getChangedConflictFields({local, server})).toEqual([]);
33
+ });
34
+
35
+ it("parses object payloads and rejects non-object JSON", () => {
36
+ expect(parseConflictPayload('{"title":"local"}')).toEqual({title: "local"});
37
+ expect(parseConflictPayload("42")).toEqual({});
38
+ expect(parseConflictPayload("null")).toEqual({});
39
+ });
40
+
41
+ it("formats snake case and leading capital labels", () => {
42
+ expect(formatConflictFieldLabel("due_date")).toBe("Due date");
43
+ expect(formatConflictFieldLabel("assignedUserId")).toBe("Assigned User Id");
44
+ });
45
+
46
+ it("formats every value shape", () => {
47
+ expect(formatConflictFieldValue(null)).toBe("None");
48
+ expect(formatConflictFieldValue("plain")).toBe("plain");
49
+ expect(formatConflictFieldValue(12)).toBe("12");
50
+ expect(formatConflictFieldValue({nested: true})).toBe('{"nested":true}');
51
+
52
+ const truncated = formatConflictFieldValue({long: "x".repeat(200)});
53
+ expect(truncated).toHaveLength(121);
54
+ expect(truncated.endsWith("…")).toBe(true);
55
+ });
56
+
57
+ it("summarizes a conflict side by title, field count, or empty diff", () => {
58
+ expect(summarizeConflictSide({changedFields: ["completed"], data: {title: "Buy milk"}})).toBe(
59
+ "Buy milk"
60
+ );
61
+ expect(summarizeConflictSide({changedFields: [], data: {title: ""}})).toBe(
62
+ NO_CONFLICT_DIFF_FIELDS
63
+ );
64
+ expect(summarizeConflictSide({changedFields: ["completed"], data: {}})).toBe("1 changed field");
65
+ expect(summarizeConflictSide({changedFields: ["completed", "title"], data: {}})).toBe(
66
+ "2 changed fields"
67
+ );
68
+ });
26
69
  });
@@ -0,0 +1,18 @@
1
+ import type React from "react";
2
+ import Svg, {Rect, type SvgProps} from "react-native-svg";
3
+
4
+ /**
5
+ * Solid "bars-filter" icon (FontAwesome Classic Solid, E0AD). FontAwesome 6 free
6
+ * has no `bars-filter` glyph (it is a Pro icon), so it is composed locally from
7
+ * three centered, rounded horizontal bars of decreasing width. Defaults to
8
+ * 16x16 — pass `height`/`width` to resize and `fill` to recolor.
9
+ */
10
+ export const BarsFilterIcon = (props: SvgProps): React.ReactElement => {
11
+ return (
12
+ <Svg fill="currentColor" height={16} viewBox="0 0 512 512" width={16} {...props}>
13
+ <Rect height={56} rx={28} width={512} x={0} y={120} />
14
+ <Rect height={56} rx={28} width={320} x={96} y={228} />
15
+ <Rect height={56} rx={28} width={160} x={176} y={336} />
16
+ </Svg>
17
+ );
18
+ };
package/src/index.tsx CHANGED
@@ -36,6 +36,11 @@ export * from "./ErrorBoundary";
36
36
  export * from "./ErrorPage";
37
37
  export * from "./Field";
38
38
  export * from "./FilePickerButton";
39
+ export * from "./Filter";
40
+ export * from "./FilterAccordion";
41
+ export * from "./FilterBoolean";
42
+ export * from "./FilterChangesBadge";
43
+ export * from "./FilterSelectMenu";
39
44
  export * from "./FlatList";
40
45
  export * from "./GPTChat";
41
46
  export * from "./GPTMemoryModal";
@@ -49,6 +54,7 @@ export * from "./Image";
49
54
  export * from "./ImageBackground";
50
55
  export * from "./InfoModalIcon";
51
56
  export * from "./InfoTooltipButton";
57
+ export * from "./icons/BarsFilterIcon";
52
58
  export * from "./Link";
53
59
  export * from "./login/LoginScreen";
54
60
  export type {LoginFieldConfig, LoginScreenProps} from "./login/loginTypes";