@terreno/ui 57.0.0 → 57.2.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 (56) hide show
  1. package/dist/DateTimeField.js +6 -2
  2. package/dist/DateTimeField.js.map +1 -1
  3. package/dist/DraggableList.js +7 -4
  4. package/dist/DraggableList.js.map +1 -1
  5. package/dist/Filter.js +14 -9
  6. package/dist/Filter.js.map +1 -1
  7. package/dist/GPTChat.d.ts +7 -1
  8. package/dist/GPTChat.js +26 -16
  9. package/dist/GPTChat.js.map +1 -1
  10. package/dist/ModalSheet.js +1 -1
  11. package/dist/ModalSheet.js.map +1 -1
  12. package/dist/PortalHost.d.ts +24 -0
  13. package/dist/PortalHost.js +52 -0
  14. package/dist/PortalHost.js.map +1 -0
  15. package/dist/SidebarNavigation.native.js +2 -1
  16. package/dist/SidebarNavigation.native.js.map +1 -1
  17. package/dist/TerrenoProvider.js +1 -1
  18. package/dist/TerrenoProvider.js.map +1 -1
  19. package/dist/ToastNotifications.js +8 -5
  20. package/dist/ToastNotifications.js.map +1 -1
  21. package/dist/Tooltip.js +1 -1
  22. package/dist/Tooltip.js.map +1 -1
  23. package/dist/Utilities.d.ts +24 -0
  24. package/dist/Utilities.js +51 -0
  25. package/dist/Utilities.js.map +1 -1
  26. package/dist/WebDropdownMenu.js +11 -15
  27. package/dist/WebDropdownMenu.js.map +1 -1
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.js +1 -0
  30. package/dist/index.js.map +1 -1
  31. package/package.json +3 -3
  32. package/src/DateTimeField.tsx +6 -3
  33. package/src/DraggableList.tsx +7 -4
  34. package/src/Filter.test.tsx +154 -1
  35. package/src/Filter.tsx +16 -7
  36. package/src/GPTChat.tsx +89 -16
  37. package/src/ModalSheet.tsx +2 -1
  38. package/src/PortalHost.tsx +105 -0
  39. package/src/SidebarNavigation.native.tsx +1 -1
  40. package/src/TerrenoProvider.tsx +1 -1
  41. package/src/ToastNotifications.tsx +4 -5
  42. package/src/Tooltip.tsx +1 -1
  43. package/src/Utilities.test.tsx +47 -0
  44. package/src/Utilities.tsx +78 -0
  45. package/src/WebDropdownMenu.test.tsx +54 -0
  46. package/src/WebDropdownMenu.tsx +11 -10
  47. package/src/__snapshots__/AddressField.test.tsx.snap +1 -7
  48. package/src/__snapshots__/CustomSelectField.test.tsx.snap +7 -49
  49. package/src/__snapshots__/Field.test.tsx.snap +9 -51
  50. package/src/__snapshots__/SelectField.test.tsx.snap +6 -42
  51. package/src/__snapshots__/TerrenoProvider.test.tsx.snap +4 -4
  52. package/src/__snapshots__/TimezonePicker.test.tsx.snap +6 -42
  53. package/src/bunSetup.ts +2 -2
  54. package/src/index.tsx +1 -0
  55. package/src/shadowStyleProps.test.ts +30 -0
  56. package/src/table/__snapshots__/TableBadge.test.tsx.snap +1 -7
@@ -280,18 +280,12 @@ exports[`SelectField renders correctly with default props 1`] = `
280
280
  "borderColor": "#9A9A9A",
281
281
  "borderRadius": 4,
282
282
  "borderWidth": 1,
283
+ "boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
283
284
  "left": 0,
284
285
  "maxHeight": 300,
285
286
  "minWidth": undefined,
286
287
  "overflow": "hidden",
287
288
  "position": "absolute",
288
- "shadowColor": "#000",
289
- "shadowOffset": {
290
- "height": 2,
291
- "width": 0,
292
- },
293
- "shadowOpacity": 0.15,
294
- "shadowRadius": 8,
295
289
  "top": 4,
296
290
  "width": 0,
297
291
  "zIndex": 1,
@@ -654,18 +648,12 @@ exports[`SelectField renders with title 1`] = `
654
648
  "borderColor": "#9A9A9A",
655
649
  "borderRadius": 4,
656
650
  "borderWidth": 1,
651
+ "boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
657
652
  "left": 0,
658
653
  "maxHeight": 300,
659
654
  "minWidth": undefined,
660
655
  "overflow": "hidden",
661
656
  "position": "absolute",
662
- "shadowColor": "#000",
663
- "shadowOffset": {
664
- "height": 2,
665
- "width": 0,
666
- },
667
- "shadowOpacity": 0.15,
668
- "shadowRadius": 8,
669
657
  "top": 4,
670
658
  "width": 0,
671
659
  "zIndex": 1,
@@ -1013,18 +1001,12 @@ exports[`SelectField renders with selected value 1`] = `
1013
1001
  "borderColor": "#9A9A9A",
1014
1002
  "borderRadius": 4,
1015
1003
  "borderWidth": 1,
1004
+ "boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
1016
1005
  "left": 0,
1017
1006
  "maxHeight": 300,
1018
1007
  "minWidth": undefined,
1019
1008
  "overflow": "hidden",
1020
1009
  "position": "absolute",
1021
- "shadowColor": "#000",
1022
- "shadowOffset": {
1023
- "height": 2,
1024
- "width": 0,
1025
- },
1026
- "shadowOpacity": 0.15,
1027
- "shadowRadius": 8,
1028
1010
  "top": 4,
1029
1011
  "width": 0,
1030
1012
  "zIndex": 1,
@@ -1372,18 +1354,12 @@ exports[`SelectField renders with custom placeholder 1`] = `
1372
1354
  "borderColor": "#9A9A9A",
1373
1355
  "borderRadius": 4,
1374
1356
  "borderWidth": 1,
1357
+ "boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
1375
1358
  "left": 0,
1376
1359
  "maxHeight": 300,
1377
1360
  "minWidth": undefined,
1378
1361
  "overflow": "hidden",
1379
1362
  "position": "absolute",
1380
- "shadowColor": "#000",
1381
- "shadowOffset": {
1382
- "height": 2,
1383
- "width": 0,
1384
- },
1385
- "shadowOpacity": 0.15,
1386
- "shadowRadius": 8,
1387
1363
  "top": 4,
1388
1364
  "width": 0,
1389
1365
  "zIndex": 1,
@@ -1731,18 +1707,12 @@ exports[`SelectField renders disabled state 1`] = `
1731
1707
  "borderColor": "#9A9A9A",
1732
1708
  "borderRadius": 4,
1733
1709
  "borderWidth": 1,
1710
+ "boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
1734
1711
  "left": 0,
1735
1712
  "maxHeight": 300,
1736
1713
  "minWidth": undefined,
1737
1714
  "overflow": "hidden",
1738
1715
  "position": "absolute",
1739
- "shadowColor": "#000",
1740
- "shadowOffset": {
1741
- "height": 2,
1742
- "width": 0,
1743
- },
1744
- "shadowOpacity": 0.15,
1745
- "shadowRadius": 8,
1746
1716
  "top": 4,
1747
1717
  "width": 0,
1748
1718
  "zIndex": 1,
@@ -2054,18 +2024,12 @@ exports[`SelectField renders with requireValue (no clear option) 1`] = `
2054
2024
  "borderColor": "#9A9A9A",
2055
2025
  "borderRadius": 4,
2056
2026
  "borderWidth": 1,
2027
+ "boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
2057
2028
  "left": 0,
2058
2029
  "maxHeight": 300,
2059
2030
  "minWidth": undefined,
2060
2031
  "overflow": "hidden",
2061
2032
  "position": "absolute",
2062
- "shadowColor": "#000",
2063
- "shadowOffset": {
2064
- "height": 2,
2065
- "width": 0,
2066
- },
2067
- "shadowOpacity": 0.15,
2068
- "shadowRadius": 8,
2069
2033
  "top": 4,
2070
2034
  "width": 0,
2071
2035
  "zIndex": 1,
@@ -43,13 +43,13 @@ exports[`TerrenoProvider renders correctly with default props 1`] = `
43
43
  ],
44
44
  "props": {
45
45
  "behavior": "position",
46
- "pointerEvents": "box-none",
47
46
  "style": [
48
47
  {
49
48
  "alignSelf": "center",
50
49
  "elevation": 999999,
51
50
  "flex": 0,
52
51
  "maxWidth": "100%",
52
+ "pointerEvents": "box-none",
53
53
  "position": "absolute",
54
54
  "zIndex": 999999,
55
55
  },
@@ -75,13 +75,13 @@ exports[`TerrenoProvider renders correctly with default props 1`] = `
75
75
  ],
76
76
  "props": {
77
77
  "behavior": "position",
78
- "pointerEvents": "box-none",
79
78
  "style": [
80
79
  {
81
80
  "alignSelf": "center",
82
81
  "elevation": 999999,
83
82
  "flex": 0,
84
83
  "maxWidth": "100%",
84
+ "pointerEvents": "box-none",
85
85
  "position": "absolute",
86
86
  "zIndex": 999999,
87
87
  },
@@ -131,13 +131,13 @@ exports[`TerrenoProvider renders with openAPISpecUrl 1`] = `
131
131
  ],
132
132
  "props": {
133
133
  "behavior": "position",
134
- "pointerEvents": "box-none",
135
134
  "style": [
136
135
  {
137
136
  "alignSelf": "center",
138
137
  "elevation": 999999,
139
138
  "flex": 0,
140
139
  "maxWidth": "100%",
140
+ "pointerEvents": "box-none",
141
141
  "position": "absolute",
142
142
  "zIndex": 999999,
143
143
  },
@@ -163,13 +163,13 @@ exports[`TerrenoProvider renders with openAPISpecUrl 1`] = `
163
163
  ],
164
164
  "props": {
165
165
  "behavior": "position",
166
- "pointerEvents": "box-none",
167
166
  "style": [
168
167
  {
169
168
  "alignSelf": "center",
170
169
  "elevation": 999999,
171
170
  "flex": 0,
172
171
  "maxWidth": "100%",
172
+ "pointerEvents": "box-none",
173
173
  "position": "absolute",
174
174
  "zIndex": 999999,
175
175
  },
@@ -447,18 +447,12 @@ exports[`TimezonePicker renders correctly with default props 1`] = `
447
447
  "borderColor": "#9A9A9A",
448
448
  "borderRadius": 4,
449
449
  "borderWidth": 1,
450
+ "boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
450
451
  "left": 0,
451
452
  "maxHeight": 300,
452
453
  "minWidth": undefined,
453
454
  "overflow": "hidden",
454
455
  "position": "absolute",
455
- "shadowColor": "#000",
456
- "shadowOffset": {
457
- "height": 2,
458
- "width": 0,
459
- },
460
- "shadowOpacity": 0.15,
461
- "shadowRadius": 8,
462
456
  "top": 4,
463
457
  "width": 0,
464
458
  "zIndex": 1,
@@ -958,18 +952,12 @@ exports[`TimezonePicker hides title when hideTitle is true 1`] = `
958
952
  "borderColor": "#9A9A9A",
959
953
  "borderRadius": 4,
960
954
  "borderWidth": 1,
955
+ "boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
961
956
  "left": 0,
962
957
  "maxHeight": 300,
963
958
  "minWidth": undefined,
964
959
  "overflow": "hidden",
965
960
  "position": "absolute",
966
- "shadowColor": "#000",
967
- "shadowOffset": {
968
- "height": 2,
969
- "width": 0,
970
- },
971
- "shadowOpacity": 0.15,
972
- "shadowRadius": 8,
973
961
  "top": 4,
974
962
  "width": 0,
975
963
  "zIndex": 1,
@@ -1484,18 +1472,12 @@ exports[`TimezonePicker renders with selected timezone 1`] = `
1484
1472
  "borderColor": "#9A9A9A",
1485
1473
  "borderRadius": 4,
1486
1474
  "borderWidth": 1,
1475
+ "boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
1487
1476
  "left": 0,
1488
1477
  "maxHeight": 300,
1489
1478
  "minWidth": undefined,
1490
1479
  "overflow": "hidden",
1491
1480
  "position": "absolute",
1492
- "shadowColor": "#000",
1493
- "shadowOffset": {
1494
- "height": 2,
1495
- "width": 0,
1496
- },
1497
- "shadowOpacity": 0.15,
1498
- "shadowRadius": 8,
1499
1481
  "top": 4,
1500
1482
  "width": 0,
1501
1483
  "zIndex": 1,
@@ -2010,18 +1992,12 @@ exports[`TimezonePicker renders USA timezones by default 1`] = `
2010
1992
  "borderColor": "#9A9A9A",
2011
1993
  "borderRadius": 4,
2012
1994
  "borderWidth": 1,
1995
+ "boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
2013
1996
  "left": 0,
2014
1997
  "maxHeight": 300,
2015
1998
  "minWidth": undefined,
2016
1999
  "overflow": "hidden",
2017
2000
  "position": "absolute",
2018
- "shadowColor": "#000",
2019
- "shadowOffset": {
2020
- "height": 2,
2021
- "width": 0,
2022
- },
2023
- "shadowOpacity": 0.15,
2024
- "shadowRadius": 8,
2025
2001
  "top": 4,
2026
2002
  "width": 0,
2027
2003
  "zIndex": 1,
@@ -2536,18 +2512,12 @@ exports[`TimezonePicker renders with short timezone labels 1`] = `
2536
2512
  "borderColor": "#9A9A9A",
2537
2513
  "borderRadius": 4,
2538
2514
  "borderWidth": 1,
2515
+ "boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
2539
2516
  "left": 0,
2540
2517
  "maxHeight": 300,
2541
2518
  "minWidth": undefined,
2542
2519
  "overflow": "hidden",
2543
2520
  "position": "absolute",
2544
- "shadowColor": "#000",
2545
- "shadowOffset": {
2546
- "height": 2,
2547
- "width": 0,
2548
- },
2549
- "shadowOpacity": 0.15,
2550
- "shadowRadius": 8,
2551
2521
  "top": 4,
2552
2522
  "width": 0,
2553
2523
  "zIndex": 1,
@@ -3062,18 +3032,12 @@ exports[`TimezonePicker calls onChange when timezone is selected 1`] = `
3062
3032
  "borderColor": "#9A9A9A",
3063
3033
  "borderRadius": 4,
3064
3034
  "borderWidth": 1,
3035
+ "boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
3065
3036
  "left": 0,
3066
3037
  "maxHeight": 300,
3067
3038
  "minWidth": undefined,
3068
3039
  "overflow": "hidden",
3069
3040
  "position": "absolute",
3070
- "shadowColor": "#000",
3071
- "shadowOffset": {
3072
- "height": 2,
3073
- "width": 0,
3074
- },
3075
- "shadowOpacity": 0.15,
3076
- "shadowRadius": 8,
3077
3041
  "top": 4,
3078
3042
  "width": 0,
3079
3043
  "zIndex": 1,
package/src/bunSetup.ts CHANGED
@@ -570,12 +570,12 @@ mock.module("@react-native-async-storage/async-storage", () => ({
570
570
  setItem: mock(() => Promise.resolve()),
571
571
  }));
572
572
 
573
- // Mock react-native-portalize. The real `Host` wraps children in an extra View
573
+ // Mock the portal host. The real `Host` wraps children in an extra View
574
574
  // whose presence makes snapshots brittle, and individual tests already mock
575
575
  // this to render inline; hoisting the mock to setup keeps test ordering from
576
576
  // leaking different shapes into other test files. Shape matches the per-file
577
577
  // mock used by Tooltip.test.tsx so the two don't disagree.
578
- mock.module("react-native-portalize", () => ({
578
+ mock.module("./PortalHost", () => ({
579
579
  Host: ({children}: MockComponentProps) =>
580
580
  React.createElement("View", {testID: "portal-host"}, children),
581
581
  Portal: ({children}: MockComponentProps) =>
package/src/index.tsx CHANGED
@@ -74,6 +74,7 @@ export * from "./Page";
74
74
  export * from "./Pagination";
75
75
  export * from "./PasswordField";
76
76
  export * from "./PhoneNumberField";
77
+ export * from "./PortalHost";
77
78
  export * from "./pdfHtmlTemplate";
78
79
  export * from "./Radio";
79
80
  export * from "./RadioField";
@@ -0,0 +1,30 @@
1
+ import {describe, expect, it} from "bun:test";
2
+ import {readFileSync} from "node:fs";
3
+ import {join} from "node:path";
4
+ import {Glob} from "bun";
5
+
6
+ // react-native-web drops shadowColor / shadowOffset / shadowOpacity / shadowRadius
7
+ // and warns once per app: '"shadow*" style props are deprecated. Use "boxShadow".'
8
+ // Use `boxShadow` (see `createBoxShadow` in Utilities) instead, plus `elevation`
9
+ // for Android's legacy renderer.
10
+ const DEPRECATED_SHADOW_PROPS = /\bshadow(Color|Offset|Opacity|Radius)\b/;
11
+
12
+ describe("deprecated shadow style props", () => {
13
+ it("are not used anywhere in @terreno/ui source", () => {
14
+ const sourceRoot = join(import.meta.dir);
15
+ const glob = new Glob("**/*.{ts,tsx}");
16
+ const offenders: string[] = [];
17
+
18
+ for (const relativePath of glob.scanSync({cwd: sourceRoot, onlyFiles: true})) {
19
+ if (relativePath.endsWith(".test.ts") || relativePath.endsWith(".test.tsx")) {
20
+ continue;
21
+ }
22
+ const contents = readFileSync(join(sourceRoot, relativePath), "utf8");
23
+ if (DEPRECATED_SHADOW_PROPS.test(contents)) {
24
+ offenders.push(relativePath);
25
+ }
26
+ }
27
+
28
+ expect(offenders).toEqual([]);
29
+ });
30
+ });
@@ -676,18 +676,12 @@ exports[`TableBadge renders select field when editing 1`] = `
676
676
  "borderColor": "#9A9A9A",
677
677
  "borderRadius": 4,
678
678
  "borderWidth": 1,
679
+ "boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
679
680
  "left": 0,
680
681
  "maxHeight": 300,
681
682
  "minWidth": undefined,
682
683
  "overflow": "hidden",
683
684
  "position": "absolute",
684
- "shadowColor": "#000",
685
- "shadowOffset": {
686
- "height": 2,
687
- "width": 0,
688
- },
689
- "shadowOpacity": 0.15,
690
- "shadowRadius": 8,
691
685
  "top": 4,
692
686
  "width": 0,
693
687
  "zIndex": 1,