@terreno/ui 56.0.0-beta.0 → 57.0.0-beta.1
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/LICENSE +21 -203
- package/dist/Badge.d.ts +1 -1
- package/dist/Badge.js +37 -1
- package/dist/Badge.js.map +1 -1
- package/dist/Common.d.ts +149 -3
- package/dist/Common.js.map +1 -1
- package/dist/DateTimeField.js +5 -21
- package/dist/DateTimeField.js.map +1 -1
- package/dist/EditableCard.d.ts +3 -0
- package/dist/EditableCard.js +23 -0
- package/dist/EditableCard.js.map +1 -0
- package/dist/Filter.d.ts +13 -0
- package/dist/Filter.js +120 -0
- package/dist/Filter.js.map +1 -0
- package/dist/FilterAccordion.d.ts +8 -0
- package/dist/FilterAccordion.js +59 -0
- package/dist/FilterAccordion.js.map +1 -0
- package/dist/FilterBoolean.d.ts +8 -0
- package/dist/FilterBoolean.js +74 -0
- package/dist/FilterBoolean.js.map +1 -0
- package/dist/FilterChangesBadge.d.ts +8 -0
- package/dist/FilterChangesBadge.js +11 -0
- package/dist/FilterChangesBadge.js.map +1 -0
- package/dist/FilterSelectMenu.d.ts +8 -0
- package/dist/FilterSelectMenu.js +37 -0
- package/dist/FilterSelectMenu.js.map +1 -0
- package/dist/IconRegistry.js +11 -6
- package/dist/IconRegistry.js.map +1 -1
- package/dist/Page.d.ts +2 -1
- package/dist/Page.js +0 -2
- package/dist/Page.js.map +1 -1
- package/dist/PickerSelect.d.ts +8 -1
- package/dist/PickerSelect.js +2 -2
- package/dist/PickerSelect.js.map +1 -1
- package/dist/SelectField.js +2 -2
- package/dist/SelectField.js.map +1 -1
- package/dist/Theme.js +3 -0
- package/dist/Theme.js.map +1 -1
- package/dist/WebDropdownMenu.d.ts +5 -1
- package/dist/WebDropdownMenu.js +24 -10
- package/dist/WebDropdownMenu.js.map +1 -1
- package/dist/icons/BarsFilterIcon.d.ts +9 -0
- package/dist/icons/BarsFilterIcon.js +12 -0
- package/dist/icons/BarsFilterIcon.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +26 -25
- package/src/ActionSheet.test.tsx +202 -172
- package/src/Badge.test.tsx +22 -1
- package/src/Badge.tsx +43 -0
- package/src/Box.test.tsx +31 -23
- package/src/Common.ts +167 -5
- package/src/ConsentFormScreen.test.tsx +22 -0
- package/src/ConsentNavigator.test.tsx +6 -8
- package/src/DateTimeField.test.tsx +66 -18
- package/src/DateTimeField.tsx +5 -19
- package/src/DraggableList.test.tsx +377 -0
- package/src/EditableCard.test.tsx +69 -0
- package/src/EditableCard.tsx +73 -0
- package/src/Filter.test.tsx +94 -0
- package/src/Filter.tsx +257 -0
- package/src/FilterAccordion.test.tsx +58 -0
- package/src/FilterAccordion.tsx +113 -0
- package/src/FilterBoolean.test.tsx +65 -0
- package/src/FilterBoolean.tsx +130 -0
- package/src/FilterChangesBadge.test.tsx +16 -0
- package/src/FilterChangesBadge.tsx +13 -0
- package/src/FilterSelectMenu.test.tsx +56 -0
- package/src/FilterSelectMenu.tsx +76 -0
- package/src/IconRegistry.test.tsx +6 -4
- package/src/IconRegistry.tsx +13 -8
- package/src/Page.tsx +2 -3
- package/src/PickerSelect.test.tsx +43 -12
- package/src/PickerSelect.tsx +10 -0
- package/src/SelectField.tsx +2 -0
- package/src/SidebarNavigation.test.tsx +339 -0
- package/src/Theme.tsx +3 -0
- package/src/WebDropdownMenu.test.tsx +214 -1
- package/src/WebDropdownMenu.tsx +43 -21
- package/src/__snapshots__/Card.test.tsx.snap +1 -0
- package/src/__snapshots__/EditableCard.test.tsx.snap +242 -0
- package/src/__snapshots__/Filter.test.tsx.snap +161 -0
- package/src/__snapshots__/FilterAccordion.test.tsx.snap +83 -0
- package/src/__snapshots__/FilterBoolean.test.tsx.snap +109 -0
- package/src/__snapshots__/FilterChangesBadge.test.tsx.snap +18 -0
- package/src/__snapshots__/FilterSelectMenu.test.tsx.snap +359 -0
- package/src/bunSetup.ts +6 -2
- package/src/conflictFieldDiff.test.ts +43 -0
- package/src/icons/BarsFilterIcon.tsx +18 -0
- package/src/index.tsx +7 -0
package/src/Badge.test.tsx
CHANGED
|
@@ -40,8 +40,29 @@ describe("Badge", () => {
|
|
|
40
40
|
expect(getByTestId("number-badge")).toHaveStyle({minWidth: 20});
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
+
it("renders the status variant as an 8px dot", () => {
|
|
44
|
+
const {getByTestId} = renderWithTheme(
|
|
45
|
+
<Badge color="bold" status="active" testID="dot" variant="status" />
|
|
46
|
+
);
|
|
47
|
+
const dot = getByTestId("dot");
|
|
48
|
+
expect(dot).toHaveStyle({height: 8, width: 8});
|
|
49
|
+
expect(dot).toHaveStyle({backgroundColor: expect.any(String)});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("uses distinct bold and subtle tones for the status dot", () => {
|
|
53
|
+
const bold = renderWithTheme(
|
|
54
|
+
<Badge color="bold" status="active" testID="dot" variant="status" />
|
|
55
|
+
).getByTestId("dot");
|
|
56
|
+
const subtle = renderWithTheme(
|
|
57
|
+
<Badge color="subtle" status="active" testID="dot" variant="status" />
|
|
58
|
+
).getByTestId("dot");
|
|
59
|
+
const boldBg = bold.props.style.backgroundColor;
|
|
60
|
+
const subtleBg = subtle.props.style.backgroundColor;
|
|
61
|
+
expect(boldBg).not.toBe(subtleBg);
|
|
62
|
+
});
|
|
63
|
+
|
|
43
64
|
it("applies correct status colors", () => {
|
|
44
|
-
const statuses = ["error", "warning", "info", "success", "neutral"] as const;
|
|
65
|
+
const statuses = ["error", "warning", "info", "success", "neutral", "active"] as const;
|
|
45
66
|
|
|
46
67
|
statuses.forEach((status) => {
|
|
47
68
|
let {getByTestId} = renderWithTheme(
|
package/src/Badge.tsx
CHANGED
|
@@ -5,12 +5,33 @@ import type {BadgeProps, SurfaceTheme, TextTheme} from "./Common";
|
|
|
5
5
|
import {Icon} from "./Icon";
|
|
6
6
|
import {useTheme} from "./Theme";
|
|
7
7
|
|
|
8
|
+
const STATUS_DOT_SIZE = 8;
|
|
9
|
+
|
|
10
|
+
// Surface tokens for the "status" dot variant, per bold vs subtle tone.
|
|
11
|
+
const STATUS_DOT_BOLD: Record<string, keyof SurfaceTheme> = {
|
|
12
|
+
active: "primary",
|
|
13
|
+
error: "error",
|
|
14
|
+
info: "secondaryDark",
|
|
15
|
+
neutral: "neutralDark",
|
|
16
|
+
success: "success",
|
|
17
|
+
warning: "warning",
|
|
18
|
+
};
|
|
19
|
+
const STATUS_DOT_SUBTLE: Record<string, keyof SurfaceTheme> = {
|
|
20
|
+
active: "secondaryLight",
|
|
21
|
+
error: "errorLight",
|
|
22
|
+
info: "secondaryLight",
|
|
23
|
+
neutral: "neutralLight",
|
|
24
|
+
success: "successLight",
|
|
25
|
+
warning: "warningLight",
|
|
26
|
+
};
|
|
27
|
+
|
|
8
28
|
export const Badge = ({
|
|
9
29
|
value,
|
|
10
30
|
iconName,
|
|
11
31
|
status = "info",
|
|
12
32
|
secondary = false,
|
|
13
33
|
variant,
|
|
34
|
+
color = "bold",
|
|
14
35
|
maxValue = 100,
|
|
15
36
|
customBackgroundColor,
|
|
16
37
|
customTextColor,
|
|
@@ -22,10 +43,28 @@ export const Badge = ({
|
|
|
22
43
|
const {theme} = useTheme();
|
|
23
44
|
const isIconOnly = variant === "iconOnly";
|
|
24
45
|
|
|
46
|
+
if (variant === "status") {
|
|
47
|
+
const dotSurface =
|
|
48
|
+
(color === "subtle" ? STATUS_DOT_SUBTLE : STATUS_DOT_BOLD)[status] ?? "primary";
|
|
49
|
+
const dotColor = status === "custom" ? customBackgroundColor : theme.surface[dotSurface];
|
|
50
|
+
return (
|
|
51
|
+
<View
|
|
52
|
+
style={{
|
|
53
|
+
backgroundColor: dotColor,
|
|
54
|
+
borderRadius: STATUS_DOT_SIZE,
|
|
55
|
+
height: STATUS_DOT_SIZE,
|
|
56
|
+
width: STATUS_DOT_SIZE,
|
|
57
|
+
}}
|
|
58
|
+
testID={testID}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
25
63
|
let badgeColor: keyof TextTheme = "inverted";
|
|
26
64
|
|
|
27
65
|
// TODO: Move to theme
|
|
28
66
|
const secondaryBorderColors = {
|
|
67
|
+
active: "#8FC1D2",
|
|
29
68
|
custom: "#AAAAAA",
|
|
30
69
|
error: "#F39E9E",
|
|
31
70
|
info: "#8FC1D2",
|
|
@@ -45,6 +84,8 @@ export const Badge = ({
|
|
|
45
84
|
badgeColor = "success";
|
|
46
85
|
} else if (status === "neutral") {
|
|
47
86
|
badgeColor = "primary";
|
|
87
|
+
} else if (status === "active") {
|
|
88
|
+
badgeColor = "link";
|
|
48
89
|
}
|
|
49
90
|
}
|
|
50
91
|
|
|
@@ -60,6 +101,8 @@ export const Badge = ({
|
|
|
60
101
|
badgeBgColor = secondary ? "successLight" : "success";
|
|
61
102
|
} else if (status === "neutral") {
|
|
62
103
|
badgeBgColor = secondary ? "neutralLight" : "neutralDark";
|
|
104
|
+
} else if (status === "active") {
|
|
105
|
+
badgeBgColor = secondary ? "secondaryLight" : "primary";
|
|
63
106
|
}
|
|
64
107
|
|
|
65
108
|
const backgroundColor = status === "custom" ? customBackgroundColor : theme.surface[badgeBgColor];
|
package/src/Box.test.tsx
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
// noExplicitAny: test mock typing
|
|
2
|
-
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
1
|
import {describe, expect, it, mock, spyOn} from "bun:test";
|
|
4
2
|
import {act, fireEvent} from "@testing-library/react-native";
|
|
5
3
|
import React from "react";
|
|
4
|
+
import type {ScrollView} from "react-native";
|
|
6
5
|
|
|
7
6
|
import {Box} from "./Box";
|
|
8
7
|
import {Text} from "./Text";
|
|
9
8
|
import {renderWithTheme} from "./test-utils";
|
|
10
9
|
|
|
10
|
+
/** Imperative handle exposed by Box's forwarded ref. */
|
|
11
|
+
interface BoxScrollHandle {
|
|
12
|
+
scrollTo: (y: number) => void;
|
|
13
|
+
scrollToEnd: () => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
describe("Box", () => {
|
|
12
17
|
describe("basic rendering", () => {
|
|
13
18
|
it("should render with default props", () => {
|
|
@@ -507,14 +512,15 @@ describe("Box", () => {
|
|
|
507
512
|
// values: a ref object in style is cyclical (host instance points back at the
|
|
508
513
|
// node) and gets dev-frozen, so React throws when detaching it on unmount.
|
|
509
514
|
it("should keep behavior props out of the ScrollView style", () => {
|
|
510
|
-
const scrollRef = React.createRef<
|
|
515
|
+
const scrollRef = React.createRef<ScrollView>();
|
|
511
516
|
const {root} = renderWithTheme(
|
|
512
517
|
<Box onScroll={mock(() => {})} scroll scrollRef={scrollRef}>
|
|
513
518
|
<Text>Scrollable</Text>
|
|
514
519
|
</Box>
|
|
515
520
|
);
|
|
516
521
|
|
|
517
|
-
|
|
522
|
+
// RN Testing Library resolves host ScrollView by display name, not the JS class.
|
|
523
|
+
const scrollView = root.findByType("ScrollView");
|
|
518
524
|
expect(scrollView.props.style).not.toHaveProperty("scrollRef");
|
|
519
525
|
expect(scrollView.props.style).not.toHaveProperty("scroll");
|
|
520
526
|
expect(scrollView.props.style).not.toHaveProperty("onScroll");
|
|
@@ -578,7 +584,7 @@ describe("Box", () => {
|
|
|
578
584
|
|
|
579
585
|
describe("ref forwarding", () => {
|
|
580
586
|
it("should expose scrollToEnd method", () => {
|
|
581
|
-
const ref = React.createRef<
|
|
587
|
+
const ref = React.createRef<BoxScrollHandle>();
|
|
582
588
|
renderWithTheme(<Box ref={ref} scroll />);
|
|
583
589
|
|
|
584
590
|
expect(ref.current).toBeTruthy();
|
|
@@ -586,7 +592,7 @@ describe("Box", () => {
|
|
|
586
592
|
});
|
|
587
593
|
|
|
588
594
|
it("should expose scrollTo method", () => {
|
|
589
|
-
const ref = React.createRef<
|
|
595
|
+
const ref = React.createRef<BoxScrollHandle>();
|
|
590
596
|
renderWithTheme(<Box ref={ref} scroll />);
|
|
591
597
|
|
|
592
598
|
expect(ref.current).toBeTruthy();
|
|
@@ -596,8 +602,10 @@ describe("Box", () => {
|
|
|
596
602
|
it("scrollTo forwards to the underlying scroll ref after the delay", async () => {
|
|
597
603
|
const scrollTo = mock(() => {});
|
|
598
604
|
const scrollToEnd = mock(() => {});
|
|
599
|
-
const scrollRef = {
|
|
600
|
-
|
|
605
|
+
const scrollRef = {
|
|
606
|
+
current: {scrollTo, scrollToEnd},
|
|
607
|
+
} as unknown as React.RefObject<ScrollView>;
|
|
608
|
+
const ref = React.createRef<BoxScrollHandle>();
|
|
601
609
|
// Intentionally omit `scroll` so the ScrollView does not claim `scrollRef`
|
|
602
610
|
// and overwrite `.current`; the imperative handle still reads it.
|
|
603
611
|
renderWithTheme(
|
|
@@ -723,54 +731,54 @@ describe("Box", () => {
|
|
|
723
731
|
|
|
724
732
|
describe("edge case warnings and fallbacks", () => {
|
|
725
733
|
it("returns empty style when border prop is falsy", () => {
|
|
726
|
-
const {root} = renderWithTheme(<Box border={undefined
|
|
734
|
+
const {root} = renderWithTheme(<Box border={undefined} />);
|
|
727
735
|
expect(root).toBeTruthy();
|
|
728
736
|
});
|
|
729
737
|
|
|
730
738
|
it("returns empty style when borderBottom prop is falsy", () => {
|
|
731
|
-
const {root} = renderWithTheme(<Box borderBottom={undefined
|
|
739
|
+
const {root} = renderWithTheme(<Box borderBottom={undefined} />);
|
|
732
740
|
expect(root).toBeTruthy();
|
|
733
741
|
});
|
|
734
742
|
|
|
735
743
|
it("returns empty style when borderLeft prop is falsy", () => {
|
|
736
|
-
const {root} = renderWithTheme(<Box borderLeft={undefined
|
|
744
|
+
const {root} = renderWithTheme(<Box borderLeft={undefined} />);
|
|
737
745
|
expect(root).toBeTruthy();
|
|
738
746
|
});
|
|
739
747
|
|
|
740
748
|
it("returns empty style when borderRight prop is falsy", () => {
|
|
741
|
-
const {root} = renderWithTheme(<Box borderRight={undefined
|
|
749
|
+
const {root} = renderWithTheme(<Box borderRight={undefined} />);
|
|
742
750
|
expect(root).toBeTruthy();
|
|
743
751
|
});
|
|
744
752
|
|
|
745
753
|
it("returns empty style when borderTop prop is falsy", () => {
|
|
746
|
-
const {root} = renderWithTheme(<Box borderTop={undefined
|
|
754
|
+
const {root} = renderWithTheme(<Box borderTop={undefined} />);
|
|
747
755
|
expect(root).toBeTruthy();
|
|
748
756
|
});
|
|
749
757
|
|
|
750
758
|
it("warns when invalid height value is provided", () => {
|
|
751
759
|
const warnSpy = spyOn(console, "warn").mockImplementation(() => {});
|
|
752
|
-
renderWithTheme(<Box height={"abc"
|
|
760
|
+
renderWithTheme(<Box height={"abc"} />);
|
|
753
761
|
expect(warnSpy).toHaveBeenCalled();
|
|
754
762
|
warnSpy.mockRestore();
|
|
755
763
|
});
|
|
756
764
|
|
|
757
765
|
it("warns when invalid maxHeight value is provided", () => {
|
|
758
766
|
const warnSpy = spyOn(console, "warn").mockImplementation(() => {});
|
|
759
|
-
renderWithTheme(<Box maxHeight={"xyz"
|
|
767
|
+
renderWithTheme(<Box maxHeight={"xyz"} />);
|
|
760
768
|
expect(warnSpy).toHaveBeenCalled();
|
|
761
769
|
warnSpy.mockRestore();
|
|
762
770
|
});
|
|
763
771
|
|
|
764
772
|
it("warns when invalid maxWidth value is provided", () => {
|
|
765
773
|
const warnSpy = spyOn(console, "warn").mockImplementation(() => {});
|
|
766
|
-
renderWithTheme(<Box maxWidth={"abc"
|
|
774
|
+
renderWithTheme(<Box maxWidth={"abc"} />);
|
|
767
775
|
expect(warnSpy).toHaveBeenCalled();
|
|
768
776
|
warnSpy.mockRestore();
|
|
769
777
|
});
|
|
770
778
|
|
|
771
779
|
it("warns when invalid minHeight value is provided", () => {
|
|
772
780
|
const warnSpy = spyOn(console, "warn").mockImplementation(() => {});
|
|
773
|
-
renderWithTheme(<Box minHeight={"abc"
|
|
781
|
+
renderWithTheme(<Box minHeight={"abc"} />);
|
|
774
782
|
expect(warnSpy).toHaveBeenCalled();
|
|
775
783
|
warnSpy.mockRestore();
|
|
776
784
|
});
|
|
@@ -782,7 +790,7 @@ describe("Box", () => {
|
|
|
782
790
|
});
|
|
783
791
|
|
|
784
792
|
it("applies a valid minHeight value", () => {
|
|
785
|
-
const {root} = renderWithTheme(<Box minHeight={"50%"
|
|
793
|
+
const {root} = renderWithTheme(<Box minHeight={"50%"} />);
|
|
786
794
|
const view = root.findByType("View");
|
|
787
795
|
expect(view.props.style).toMatchObject({minHeight: "50%"});
|
|
788
796
|
});
|
|
@@ -794,21 +802,21 @@ describe("Box", () => {
|
|
|
794
802
|
});
|
|
795
803
|
|
|
796
804
|
it("applies a valid minWidth value", () => {
|
|
797
|
-
const {root} = renderWithTheme(<Box minWidth={"25%"
|
|
805
|
+
const {root} = renderWithTheme(<Box minWidth={"25%"} />);
|
|
798
806
|
const view = root.findByType("View");
|
|
799
807
|
expect(view.props.style).toMatchObject({minWidth: "25%"});
|
|
800
808
|
});
|
|
801
809
|
|
|
802
810
|
it("warns when invalid minWidth value is provided", () => {
|
|
803
811
|
const warnSpy = spyOn(console, "warn").mockImplementation(() => {});
|
|
804
|
-
renderWithTheme(<Box minWidth={"abc"
|
|
812
|
+
renderWithTheme(<Box minWidth={"abc"} />);
|
|
805
813
|
expect(warnSpy).toHaveBeenCalled();
|
|
806
814
|
warnSpy.mockRestore();
|
|
807
815
|
});
|
|
808
816
|
|
|
809
817
|
it("warns when invalid width value is provided", () => {
|
|
810
818
|
const warnSpy = spyOn(console, "warn").mockImplementation(() => {});
|
|
811
|
-
renderWithTheme(<Box width={"abc"
|
|
819
|
+
renderWithTheme(<Box width={"abc"} />);
|
|
812
820
|
expect(warnSpy).toHaveBeenCalled();
|
|
813
821
|
warnSpy.mockRestore();
|
|
814
822
|
});
|
|
@@ -911,7 +919,7 @@ describe("Box", () => {
|
|
|
911
919
|
<Text>Scrollable</Text>
|
|
912
920
|
</Box>
|
|
913
921
|
);
|
|
914
|
-
const scrollView = root.findByType("ScrollView"
|
|
922
|
+
const scrollView = root.findByType("ScrollView");
|
|
915
923
|
await act(async () => {
|
|
916
924
|
scrollView.props.onScroll?.({nativeEvent: {contentOffset: {y: 100}}});
|
|
917
925
|
});
|
|
@@ -938,7 +946,7 @@ describe("Box", () => {
|
|
|
938
946
|
});
|
|
939
947
|
|
|
940
948
|
it("exposes scrollTo and scrollToEnd through ref", () => {
|
|
941
|
-
const ref = React.createRef<
|
|
949
|
+
const ref = React.createRef<BoxScrollHandle>();
|
|
942
950
|
renderWithTheme(
|
|
943
951
|
<Box ref={ref} scroll>
|
|
944
952
|
<Text>Content</Text>
|
package/src/Common.ts
CHANGED
|
@@ -218,7 +218,10 @@ export interface TextThemeConfig {
|
|
|
218
218
|
|
|
219
219
|
export interface SurfaceThemeConfig {
|
|
220
220
|
base: keyof ThemePrimitiveColors;
|
|
221
|
+
baseAlternate: keyof ThemePrimitiveColors;
|
|
222
|
+
baseHover: keyof ThemePrimitiveColors;
|
|
221
223
|
primary: keyof ThemePrimitiveColors;
|
|
224
|
+
secondaryExtraLight: keyof ThemePrimitiveColors;
|
|
222
225
|
secondaryLight: keyof ThemePrimitiveColors;
|
|
223
226
|
secondaryDark: keyof ThemePrimitiveColors;
|
|
224
227
|
secondaryExtraDark: keyof ThemePrimitiveColors;
|
|
@@ -286,7 +289,10 @@ export interface TextTheme {
|
|
|
286
289
|
|
|
287
290
|
export interface SurfaceTheme {
|
|
288
291
|
base: string;
|
|
292
|
+
baseAlternate: string;
|
|
293
|
+
baseHover: string;
|
|
289
294
|
primary: string;
|
|
295
|
+
secondaryExtraLight: string;
|
|
290
296
|
secondaryLight: string;
|
|
291
297
|
secondaryDark: string;
|
|
292
298
|
secondaryExtraDark: string;
|
|
@@ -395,8 +401,10 @@ export type OnChangeCallback = (result: string) => void;
|
|
|
395
401
|
* }
|
|
396
402
|
* ```
|
|
397
403
|
*/
|
|
398
|
-
|
|
399
|
-
|
|
404
|
+
export interface CustomIconRegistry {
|
|
405
|
+
/** Built-in "bars-filter" glyph (FontAwesome Classic Solid, E0AD). */
|
|
406
|
+
"bars-filter": true;
|
|
407
|
+
}
|
|
400
408
|
|
|
401
409
|
/** The set of custom icon names registered via {@link CustomIconRegistry}. */
|
|
402
410
|
export type CustomIconName = keyof CustomIconRegistry & string;
|
|
@@ -425,6 +433,97 @@ export type CustomIconComponent = FC<CustomIconProps>;
|
|
|
425
433
|
*/
|
|
426
434
|
export type IconRegistryMap = Record<string, CustomIconComponent>;
|
|
427
435
|
|
|
436
|
+
export interface FilterOption {
|
|
437
|
+
label: string;
|
|
438
|
+
value: string;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/** Small blue dot that signals a filter control differs from its default. */
|
|
442
|
+
export type FilterChangesBadgeProps = WithTestID;
|
|
443
|
+
|
|
444
|
+
export interface FilterSelectMenuProps extends WithTestID {
|
|
445
|
+
/** Label shown to the left of the select control. */
|
|
446
|
+
title: string;
|
|
447
|
+
/** Selectable options for the single-select control. */
|
|
448
|
+
options: FilterOption[];
|
|
449
|
+
/** Currently selected value. */
|
|
450
|
+
value?: string;
|
|
451
|
+
/** Called with the newly selected value. */
|
|
452
|
+
onChange: (value: string) => void;
|
|
453
|
+
/** Text shown when no value is selected. */
|
|
454
|
+
placeholder?: string;
|
|
455
|
+
/** When true, shows the blue changes dot next to the title. */
|
|
456
|
+
showChangesBadge?: boolean;
|
|
457
|
+
/** Disables the control. */
|
|
458
|
+
disabled?: boolean;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
export interface FilterBooleanProps extends WithTestID {
|
|
462
|
+
/** Label shown to the left of the toggle. */
|
|
463
|
+
title: string;
|
|
464
|
+
/** Whether the toggle is on. */
|
|
465
|
+
value: boolean;
|
|
466
|
+
/** Called with the next toggle value. The entire row is the click zone. */
|
|
467
|
+
onChange: (value: boolean) => void;
|
|
468
|
+
/** When true, shows the blue changes dot next to the title. */
|
|
469
|
+
showChangesBadge?: boolean;
|
|
470
|
+
/** Disables the toggle and the row click zone. */
|
|
471
|
+
disabled?: boolean;
|
|
472
|
+
/** Renders the toggle in a focused (keyboard) state. */
|
|
473
|
+
focused?: boolean;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export interface FilterAccordionProps extends WithTestID {
|
|
477
|
+
/** Label shown in the always-visible header row. */
|
|
478
|
+
title: string;
|
|
479
|
+
/** Custom content revealed when expanded. Empty by default. */
|
|
480
|
+
children?: React.ReactNode;
|
|
481
|
+
/** Controlled expanded state. Omit to use `defaultExpanded`. */
|
|
482
|
+
expanded?: boolean;
|
|
483
|
+
/** Initial expanded state when uncontrolled. */
|
|
484
|
+
defaultExpanded?: boolean;
|
|
485
|
+
/** Called with the next expanded state when the header row is pressed. */
|
|
486
|
+
onToggle?: (expanded: boolean) => void;
|
|
487
|
+
/** When true, shows the blue changes dot next to the title. */
|
|
488
|
+
showChangesBadge?: boolean;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export interface FilterProps extends WithTestID {
|
|
492
|
+
/** Composed filter controls rendered inside the dropdown panel. */
|
|
493
|
+
children: React.ReactNode;
|
|
494
|
+
/** Trigger button label. */
|
|
495
|
+
label?: string;
|
|
496
|
+
/** Trigger button icon. Defaults to the built-in `bars-filter` glyph. */
|
|
497
|
+
iconName?: IconName;
|
|
498
|
+
/** Controlled open state. Omit to use `defaultOpen`. */
|
|
499
|
+
isOpen?: boolean;
|
|
500
|
+
/** Initial open state when uncontrolled. */
|
|
501
|
+
defaultOpen?: boolean;
|
|
502
|
+
/** Called whenever the dropdown opens or closes. */
|
|
503
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
504
|
+
/** Master toggle for the Apply/Clear/Cancel footer. */
|
|
505
|
+
showActionButtons?: boolean;
|
|
506
|
+
/** Show the Apply button in the footer. */
|
|
507
|
+
showApplyButton?: boolean;
|
|
508
|
+
/** Show the Clear hyperlink in the footer. */
|
|
509
|
+
showClearButton?: boolean;
|
|
510
|
+
/** Show the Cancel button in the footer. */
|
|
511
|
+
showCancelButton?: boolean;
|
|
512
|
+
applyButtonText?: string;
|
|
513
|
+
clearButtonText?: string;
|
|
514
|
+
cancelButtonText?: string;
|
|
515
|
+
/** Called when Apply is pressed. The dropdown then closes. */
|
|
516
|
+
onApply?: () => void;
|
|
517
|
+
/** Called when Clear is pressed. The dropdown then closes. */
|
|
518
|
+
onClear?: () => void;
|
|
519
|
+
/** Called when Cancel or a click-outside closes the dropdown. */
|
|
520
|
+
onCancel?: () => void;
|
|
521
|
+
/** Primary theming for the trigger and Apply button. */
|
|
522
|
+
variant?: "primary" | "secondary";
|
|
523
|
+
/** Panel width in pixels. Defaults to 320 per the design spec. */
|
|
524
|
+
width?: number;
|
|
525
|
+
}
|
|
526
|
+
|
|
428
527
|
export type AlignContent = "start" | "end" | "center" | "between" | "around" | "stretch";
|
|
429
528
|
export type AlignSelf = "auto" | "start" | "end" | "center" | "baseline" | "stretch";
|
|
430
529
|
export type AlignItems = "start" | "end" | "center" | "baseline" | "stretch";
|
|
@@ -692,6 +791,51 @@ export type CardProps = BoxProps & {
|
|
|
692
791
|
imageHeight?: number;
|
|
693
792
|
};
|
|
694
793
|
|
|
794
|
+
export type EditableCardProps = BoxProps & {
|
|
795
|
+
/**
|
|
796
|
+
* The name of an icon shown before the title.
|
|
797
|
+
*/
|
|
798
|
+
iconName?: IconName;
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* The title of the summarized information.
|
|
802
|
+
*/
|
|
803
|
+
title?: string;
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Props for a badge rendered next to the title.
|
|
807
|
+
*/
|
|
808
|
+
badge?: BadgeProps;
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* The summarized information itself, displayed below the title.
|
|
812
|
+
*/
|
|
813
|
+
description?: string;
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Secondary text displayed below the description, in a muted style.
|
|
817
|
+
*/
|
|
818
|
+
helperText?: string;
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Callback invoked when the edit button is pressed. The edit button is only rendered when this
|
|
822
|
+
* is provided.
|
|
823
|
+
*/
|
|
824
|
+
onEdit?: () => void | Promise<void>;
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Accessibility label for the edit button.
|
|
828
|
+
* @default "Edit"
|
|
829
|
+
*/
|
|
830
|
+
editAccessibilityLabel?: string;
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* If true, the card is highlighted to draw attention to it, e.g. for content that needs review.
|
|
834
|
+
* @default false
|
|
835
|
+
*/
|
|
836
|
+
attention?: boolean;
|
|
837
|
+
};
|
|
838
|
+
|
|
695
839
|
export interface ErrorBoundaryProps {
|
|
696
840
|
onError?: (error: Error, stack: string) => void;
|
|
697
841
|
children?: ReactNode;
|
|
@@ -1515,7 +1659,14 @@ export interface BadgeProps extends WithTestID {
|
|
|
1515
1659
|
* The status of the badge. Determines its color and appearance.
|
|
1516
1660
|
* @default "info"
|
|
1517
1661
|
*/
|
|
1518
|
-
status?: "info" | "error" | "warning" | "success" | "neutral" | "custom";
|
|
1662
|
+
status?: "info" | "error" | "warning" | "success" | "neutral" | "active" | "custom";
|
|
1663
|
+
|
|
1664
|
+
/**
|
|
1665
|
+
* For the "status" variant, whether the dot uses the bold (saturated) or
|
|
1666
|
+
* subtle (light) tone.
|
|
1667
|
+
* @default "bold"
|
|
1668
|
+
*/
|
|
1669
|
+
color?: "bold" | "subtle";
|
|
1519
1670
|
|
|
1520
1671
|
/**
|
|
1521
1672
|
* The text or number to display inside the badge.
|
|
@@ -1523,9 +1674,10 @@ export interface BadgeProps extends WithTestID {
|
|
|
1523
1674
|
value?: number | string;
|
|
1524
1675
|
|
|
1525
1676
|
/**
|
|
1526
|
-
* The variant of the badge.
|
|
1677
|
+
* The variant of the badge. "status" renders a small colored dot (no text)
|
|
1678
|
+
* used to indicate an active/modified state.
|
|
1527
1679
|
*/
|
|
1528
|
-
variant?: "iconOnly" | "numberOnly";
|
|
1680
|
+
variant?: "iconOnly" | "numberOnly" | "status";
|
|
1529
1681
|
}
|
|
1530
1682
|
|
|
1531
1683
|
export type ThumbsUpDownFeedbackValue = "positive" | "negative";
|
|
@@ -3018,6 +3170,16 @@ export interface SelectFieldPropsBase extends WithTestID {
|
|
|
3018
3170
|
*/
|
|
3019
3171
|
disableSearch?: boolean;
|
|
3020
3172
|
|
|
3173
|
+
/**
|
|
3174
|
+
* Web only. When true, the dropdown menu renders in a fixed portal on
|
|
3175
|
+
* `document.body` (zIndex 9999) instead of a React Native `Modal`. Use this
|
|
3176
|
+
* when the select lives inside another portaled/high-zIndex overlay (e.g. the
|
|
3177
|
+
* `Filter` panel) where a `Modal` would stack behind the overlay and be
|
|
3178
|
+
* invisible and unclickable.
|
|
3179
|
+
* @default false
|
|
3180
|
+
*/
|
|
3181
|
+
renderMenuInBodyPortal?: boolean;
|
|
3182
|
+
|
|
3021
3183
|
/**
|
|
3022
3184
|
* The title of the select field.
|
|
3023
3185
|
*/
|
|
@@ -351,6 +351,28 @@ describe("ConsentFormScreen", () => {
|
|
|
351
351
|
expect(queryByTestId("consent-footer-checkboxes-hint")).toBeNull();
|
|
352
352
|
});
|
|
353
353
|
|
|
354
|
+
it("toggles scrolling with the signature touch handlers on iOS", () => {
|
|
355
|
+
const form: ConsentFormPublic = {
|
|
356
|
+
...baseForm,
|
|
357
|
+
captureSignature: true,
|
|
358
|
+
};
|
|
359
|
+
const {getByTestId} = renderWithTheme(
|
|
360
|
+
<ConsentFormScreen form={form} locale="en" onAgree={() => {}} />
|
|
361
|
+
);
|
|
362
|
+
const signature = getByTestId("consent-form-signature");
|
|
363
|
+
const scroll = getByTestId("consent-form-scroll-view");
|
|
364
|
+
|
|
365
|
+
act(() => {
|
|
366
|
+
fireEvent(signature, "touchStart");
|
|
367
|
+
});
|
|
368
|
+
expect(scroll.props.scrollEnabled).toBe(false);
|
|
369
|
+
|
|
370
|
+
act(() => {
|
|
371
|
+
fireEvent(signature, "touchEnd");
|
|
372
|
+
});
|
|
373
|
+
expect(scroll.props.scrollEnabled).toBe(true);
|
|
374
|
+
});
|
|
375
|
+
|
|
354
376
|
it("exercises SignatureField onChange, onStart, and onEnd callbacks", () => {
|
|
355
377
|
const form: ConsentFormPublic = {
|
|
356
378
|
...baseForm,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// noExplicitAny: test mock typing
|
|
2
|
-
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
1
|
import {describe, expect, it, mock} from "bun:test";
|
|
4
2
|
import React from "react";
|
|
5
3
|
import {Pressable} from "react-native";
|
|
@@ -186,7 +184,7 @@ describe("ConsentNavigator", () => {
|
|
|
186
184
|
};
|
|
187
185
|
|
|
188
186
|
const {getByText} = renderWithTheme(
|
|
189
|
-
<ConsentNavigator api={api
|
|
187
|
+
<ConsentNavigator api={api}>
|
|
190
188
|
<Text>App Content</Text>
|
|
191
189
|
</ConsentNavigator>
|
|
192
190
|
);
|
|
@@ -212,7 +210,7 @@ describe("ConsentNavigator", () => {
|
|
|
212
210
|
};
|
|
213
211
|
|
|
214
212
|
const {getByText} = renderWithTheme(
|
|
215
|
-
<ConsentNavigator api={api
|
|
213
|
+
<ConsentNavigator api={api}>
|
|
216
214
|
<Text>App Content</Text>
|
|
217
215
|
</ConsentNavigator>
|
|
218
216
|
);
|
|
@@ -239,7 +237,7 @@ describe("ConsentNavigator", () => {
|
|
|
239
237
|
};
|
|
240
238
|
|
|
241
239
|
const {getByTestId, getByText} = renderWithTheme(
|
|
242
|
-
<ConsentNavigator api={api
|
|
240
|
+
<ConsentNavigator api={api} onError={onError}>
|
|
243
241
|
<Text>App Content</Text>
|
|
244
242
|
</ConsentNavigator>
|
|
245
243
|
);
|
|
@@ -284,7 +282,7 @@ describe("ConsentNavigator", () => {
|
|
|
284
282
|
};
|
|
285
283
|
|
|
286
284
|
const {getByTestId} = renderWithTheme(
|
|
287
|
-
<ConsentNavigator api={api
|
|
285
|
+
<ConsentNavigator api={api}>
|
|
288
286
|
<Text>App Content</Text>
|
|
289
287
|
</ConsentNavigator>
|
|
290
288
|
);
|
|
@@ -321,7 +319,7 @@ describe("ConsentNavigator", () => {
|
|
|
321
319
|
};
|
|
322
320
|
|
|
323
321
|
const {getByTestId} = renderWithTheme(
|
|
324
|
-
<ConsentNavigator api={api
|
|
322
|
+
<ConsentNavigator api={api} onError={onError}>
|
|
325
323
|
<Text>App Content</Text>
|
|
326
324
|
</ConsentNavigator>
|
|
327
325
|
);
|
|
@@ -361,7 +359,7 @@ describe("ConsentNavigator", () => {
|
|
|
361
359
|
};
|
|
362
360
|
|
|
363
361
|
const {getByTestId} = renderWithTheme(
|
|
364
|
-
<ConsentNavigator api={api
|
|
362
|
+
<ConsentNavigator api={api}>
|
|
365
363
|
<Text>App Content</Text>
|
|
366
364
|
</ConsentNavigator>
|
|
367
365
|
);
|