@terreno/ui 0.29.0 → 0.30.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.
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useState } from "react";
3
- import { Pressable, View } from "react-native";
3
+ import { View } from "react-native";
4
4
  import { Button } from "./Button";
5
- import { Icon } from "./Icon";
6
5
  import { SparklesIcon } from "./icons/SparklesIcon";
7
6
  import { Text } from "./Text";
8
7
  import { useTheme } from "./Theme";
8
+ import { ThumbsUpDownFeedback } from "./ThumbsUpDownFeedback";
9
9
  /**
10
10
  * Inline AI suggestion box rendered inside TextField/TextArea via the `aiSuggestion` prop.
11
11
  *
@@ -84,19 +84,14 @@ export const AiSuggestionBox = ({ status, text, onAdd, onHide, onShow, onFeedbac
84
84
  onShow === null || onShow === void 0 ? void 0 : onShow();
85
85
  }
86
86
  }, [status, onShow]);
87
- const handleThumbsUp = useCallback(() => {
87
+ const handleFeedbackChange = useCallback((nextValue) => {
88
88
  if (!onFeedback) {
89
89
  return;
90
90
  }
91
- onFeedback(feedback === "like" ? null : "like");
92
- }, [onFeedback, feedback]);
93
- const handleThumbsDown = useCallback(() => {
94
- if (!onFeedback) {
95
- return;
96
- }
97
- onFeedback(feedback === "dislike" ? null : "dislike");
98
- }, [onFeedback, feedback]);
99
- const renderFeedback = () => (_jsxs(View, { style: { alignItems: "center", flexDirection: "row" }, testID: testID ? `${testID}-feedback` : undefined, children: [_jsx(Pressable, { accessibilityLabel: "Thumbs up", accessibilityRole: "button", onPress: handleThumbsUp, style: { alignItems: "center", height: 24, justifyContent: "center", width: 24 }, testID: testID ? `${testID}-thumbs-up` : undefined, children: _jsx(Icon, { color: feedback === "like" ? "secondaryDark" : "secondaryLight", iconName: "thumbs-up", size: "md", type: feedback === "like" ? "solid" : "regular" }) }), _jsx(Pressable, { accessibilityLabel: "Thumbs down", accessibilityRole: "button", onPress: handleThumbsDown, style: { alignItems: "center", height: 24, justifyContent: "center", width: 24 }, testID: testID ? `${testID}-thumbs-down` : undefined, children: _jsx(Icon, { color: feedback === "dislike" ? "secondaryDark" : "secondaryLight", iconName: "thumbs-down", size: "md", type: feedback === "dislike" ? "solid" : "regular" }) })] }));
91
+ // ThumbsUpDownFeedback already clears a repeated selection, so undefined means "no feedback".
92
+ onFeedback(nextValue === undefined ? null : nextValue === "positive" ? "like" : "dislike");
93
+ }, [onFeedback]);
94
+ const renderFeedback = () => (_jsx(ThumbsUpDownFeedback, { onChange: handleFeedbackChange, testID: testID ? `${testID}-feedback` : undefined, value: feedback === "like" ? "positive" : feedback === "dislike" ? "negative" : undefined }));
100
95
  if (status === "not-started" || status === "generating") {
101
96
  return (_jsx(View, { style: containerStyle, testID: testID, children: _jsxs(View, { style: { alignItems: "center", flexDirection: "row", gap: 4, width: "100%" }, children: [_jsx(SparklesIcon, { fill: theme.text.secondaryDark }), _jsx(View, { style: { flex: 1 }, children: _jsx(Text, { color: "secondaryDark", size: "sm", children: headingText }) })] }) }));
102
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AiSuggestionBox.js","sourceRoot":"","sources":["../src/AiSuggestionBox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAU,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAChE,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAMjC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAA6B,CAAC,EACxD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AC,EAAC,YACpB,KAAC,IAAI,IAAC,KAAK,EAAC,eAAe,EAAC,IAAI,EAAC,IAAI,YAClC,WAAW,GACP,GACF,EACN,cAAc,EAAE,IACZ,EAEN,OAAO,CAAC,IAAI,CAAC,IAAI,CAChB,KAAC,IAAI,IAAC,KAAK,EAAE,EAAC,aAAa,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAC,YAC5C,KAAC,IAAI,IAAC,IAAI,EAAC,IAAI,YAAE,IAAI,GAAQ,GACxB,CACR,EAED,MAAC,IAAI,IACH,KAAK,EAAE;oBACL,UAAU,EAAE,QAAQ;oBACpB,aAAa,EAAE,KAAK;oBACpB,GAAG,EAAE,CAAC;oBACN,cAAc,EAAE,UAAU;oBAC1B,KAAK,EAAE,MAAM;iBACd,aAED,KAAC,MAAM,IACL,OAAO,EAAE,UAAU,EACnB,IAAI,EAAC,IAAI,EACT,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,OAAO,CAAC,CAAC,CAAC,SAAS,EAC7C,IAAI,EAAC,MAAM,EACX,OAAO,EAAC,OAAO,GACf,EACD,OAAO,CAAC,KAAK,CAAC,IAAI,CACjB,KAAC,MAAM,IACL,OAAO,EAAE,KAAM,EACf,IAAI,EAAC,IAAI,EACT,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,MAAM,CAAC,CAAC,CAAC,SAAS,EAC5C,IAAI,EAAC,aAAa,EAClB,OAAO,EAAC,WAAW,GACnB,CACH,IACI,IACF,CACR,CAAC;AACJ,CAAC,CAAC"}
package/dist/Common.d.ts CHANGED
@@ -1205,6 +1205,32 @@ export interface BadgeProps extends WithTestID {
1205
1205
  */
1206
1206
  variant?: "iconOnly" | "numberOnly";
1207
1207
  }
1208
+ export type ThumbsUpDownFeedbackValue = "positive" | "negative";
1209
+ export interface ThumbsUpDownFeedbackProps extends WithTestID {
1210
+ /**
1211
+ * If true, both options are non-interactive and rendered in a muted color.
1212
+ * @default false
1213
+ */
1214
+ disabled?: boolean;
1215
+ /**
1216
+ * Accessibility label for the negative (thumbs down) option.
1217
+ * @default "Thumbs down"
1218
+ */
1219
+ negativeAccessibilityLabel?: string;
1220
+ /**
1221
+ * Called with the newly selected value, or undefined when the current value is deselected.
1222
+ */
1223
+ onChange: (value?: ThumbsUpDownFeedbackValue) => void | Promise<void>;
1224
+ /**
1225
+ * Accessibility label for the positive (thumbs up) option.
1226
+ * @default "Thumbs up"
1227
+ */
1228
+ positiveAccessibilityLabel?: string;
1229
+ /**
1230
+ * The currently selected feedback. Leave undefined for no selection.
1231
+ */
1232
+ value?: ThumbsUpDownFeedbackValue;
1233
+ }
1208
1234
  export interface SelectBadgeProps {
1209
1235
  /**
1210
1236
  * When status is "custom", determines the badge's background color.
@@ -1 +1 @@
1
- {"version":3,"file":"Common.js","sourceRoot":"","sources":["../src/Common.ts"],"names":[],"mappings":"AA6BA,OAAO,EACL,yBAAyB,EACzB,gCAAgC,EAChC,4BAA4B,EAC5B,4BAA4B,EAC5B,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,WAAW,GACZ,MAAM,yBAAyB,CAAC;AA0ZjC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;CACP,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAqB,EAAE,EAAE;IAClD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAmB,CAAC,GAAG,CAAC,C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BAAwB,GAAG;IACtC,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type FC } from "react";
2
+ import type { ThumbsUpDownFeedbackProps } from "./Common";
3
+ /**
4
+ * A pair of thumbs up / thumbs down options for collecting binary feedback, e.g. on an AI
5
+ * generated response. The selected option switches from an outlined to a filled thumb; pressing it
6
+ * again clears the selection and calls `onChange` with undefined.
7
+ */
8
+ export declare const ThumbsUpDownFeedback: FC<ThumbsUpDownFeedbackProps>;
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import MaterialIcons from "@expo/vector-icons/MaterialIcons";
3
+ import { useCallback } from "react";
4
+ import { Pressable } from "react-native";
5
+ import { Box } from "./Box";
6
+ import { useTheme } from "./Theme";
7
+ /**
8
+ * MaterialIcons pads its artwork inside the em box and the thumbs are wider than they are tall, so
9
+ * this font size is the one that paints a 16px wide thumb — the Figma bounding box.
10
+ */
11
+ const ICON_SIZE = 19.2;
12
+ const ICON_NAME_MAP = {
13
+ negative: { selected: "thumb-down-alt", unselected: "thumb-down-off-alt" },
14
+ positive: { selected: "thumb-up-alt", unselected: "thumb-up-off-alt" },
15
+ };
16
+ const TAP_TARGET_SIZE = 32;
17
+ /**
18
+ * A pair of thumbs up / thumbs down options for collecting binary feedback, e.g. on an AI
19
+ * generated response. The selected option switches from an outlined to a filled thumb; pressing it
20
+ * again clears the selection and calls `onChange` with undefined.
21
+ */
22
+ export const ThumbsUpDownFeedback = ({ disabled = false, negativeAccessibilityLabel = "Thumbs down", onChange, positiveAccessibilityLabel = "Thumbs up", testID, value, }) => {
23
+ const { theme } = useTheme();
24
+ const handlePress = useCallback(async (pressedValue) => {
25
+ if (disabled) {
26
+ return;
27
+ }
28
+ await onChange(value === pressedValue ? undefined : pressedValue);
29
+ }, [disabled, onChange, value]);
30
+ const handleKeyDown = useCallback(async (optionValue, event) => {
31
+ if (event.key !== " " && event.key !== "Spacebar") {
32
+ return;
33
+ }
34
+ event.preventDefault();
35
+ // A native button activates once per press, so ignore auto-repeat from a held spacebar.
36
+ if (event.repeat) {
37
+ return;
38
+ }
39
+ await handlePress(optionValue);
40
+ }, [handlePress]);
41
+ const renderOption = (optionValue) => {
42
+ const isSelected = value === optionValue;
43
+ const isPositive = optionValue === "positive";
44
+ const iconColor = disabled ? theme.surface.disabled : theme.surface.secondaryDark;
45
+ const iconName = ICON_NAME_MAP[isPositive ? "positive" : "negative"][isSelected ? "selected" : "unselected"];
46
+ const webKeyDownProps = {
47
+ onKeyDown: async (event) => handleKeyDown(optionValue, event),
48
+ };
49
+ return (_jsx(Pressable, Object.assign({}, webKeyDownProps, { accessibilityLabel: isPositive ? positiveAccessibilityLabel : negativeAccessibilityLabel, accessibilityRole: "checkbox", accessibilityState: { checked: isSelected, disabled, selected: isSelected }, "aria-checked": isSelected, "aria-disabled": disabled, disabled: disabled, onPress: async () => handlePress(optionValue), style: {
50
+ alignItems: "center",
51
+ backgroundColor: "transparent",
52
+ borderRadius: TAP_TARGET_SIZE / 2,
53
+ height: TAP_TARGET_SIZE,
54
+ justifyContent: "center",
55
+ width: TAP_TARGET_SIZE,
56
+ }, testID: testID ? `${testID}-${isPositive ? "positive" : "negative"}` : undefined, children: _jsx(MaterialIcons, { color: iconColor, name: iconName, selectable: undefined, size: ICON_SIZE }) })));
57
+ };
58
+ return (_jsxs(Box, { alignItems: "center", direction: "row", testID: testID, children: [renderOption("positive"), renderOption("negative")] }));
59
+ };
60
+ //# sourceMappingURL=ThumbsUpDownFeedback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThumbsUpDownFeedback.js","sourceRoot":"","sources":["../src/ThumbsUpDownFeedback.tsx"],"names":[],"mappings":";AAAA,OAAO,aAAa,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAU,WAAW,EAA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AAe;gBACvB,cAAc,EAAE,QAAQ;gBACxB,KAAK,EAAE,eAAe;aACvB,EACD,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,YAEhF,KAAC,aAAa,IAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAI,IACjF,CACb,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,MAAC,GAAG,IAAC,UAAU,EAAC,QAAQ,EAAC,SAAS,EAAC,KAAK,EAAC,MAAM,EAAE,MAAM,aACpD,YAAY,CAAC,UAAU,CAAC,EACxB,YAAY,CAAC,UAAU,CAAC,IACrB,CACP,CAAC;AACJ,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -93,6 +93,7 @@ export * from "./Text";
93
93
  export * from "./TextArea";
94
94
  export * from "./TextField";
95
95
  export * from "./Theme";
96
+ export * from "./ThumbsUpDownFeedback";
96
97
  export * from "./Toast";
97
98
  export { Tooltip } from "./Tooltip";
98
99
  export * from "./TypedSignatureField";
package/dist/index.js CHANGED
@@ -90,6 +90,7 @@ export * from "./Text";
90
90
  export * from "./TextArea";
91
91
  export * from "./TextField";
92
92
  export * from "./Theme";
93
+ export * from "./ThumbsUpDownFeedback";
93
94
  export * from "./Toast";
94
95
  export { Tooltip } from "./Tooltip";
95
96
  export * from "./TypedSignatureField";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc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CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC"}
package/package.json CHANGED
@@ -141,5 +141,5 @@
141
141
  "test:coverage": "TZ=America/New_York bun run ../scripts/check-coverage.ts",
142
142
  "types": "bun typedoc"
143
143
  },
144
- "version": "0.29.0"
144
+ "version": "0.30.0"
145
145
  }
@@ -458,8 +458,8 @@ describe("AiSuggestionBox in TextArea", () => {
458
458
  );
459
459
 
460
460
  expect(getByTestId("notes-ai-suggestion")).toBeTruthy();
461
- expect(getByTestId("notes-ai-suggestion-thumbs-up")).toBeTruthy();
462
- expect(getByTestId("notes-ai-suggestion-thumbs-down")).toBeTruthy();
461
+ expect(getByTestId("notes-ai-suggestion-feedback-positive")).toBeTruthy();
462
+ expect(getByTestId("notes-ai-suggestion-feedback-negative")).toBeTruthy();
463
463
  expect(getByTestId("notes-ai-suggestion-hide")).toBeTruthy();
464
464
  expect(getByTestId("notes-ai-suggestion-add")).toBeTruthy();
465
465
  });
@@ -1,12 +1,12 @@
1
1
  import {type FC, useCallback, useEffect, useState} from "react";
2
- import {Pressable, View} from "react-native";
2
+ import {View} from "react-native";
3
3
 
4
4
  import {Button} from "./Button";
5
- import type {AiSuggestionProps} from "./Common";
6
- import {Icon} from "./Icon";
5
+ import type {AiSuggestionProps, ThumbsUpDownFeedbackValue} from "./Common";
7
6
  import {SparklesIcon} from "./icons/SparklesIcon";
8
7
  import {Text} from "./Text";
9
8
  import {useTheme} from "./Theme";
9
+ import {ThumbsUpDownFeedback} from "./ThumbsUpDownFeedback";
10
10
 
11
11
  export interface AiSuggestionBoxProps extends AiSuggestionProps {
12
12
  testID?: string;
@@ -111,54 +111,23 @@ export const AiSuggestionBox: FC<AiSuggestionBoxProps> = ({
111
111
  }
112
112
  }, [status, onShow]);
113
113
 
114
- const handleThumbsUp = useCallback(() => {
115
- if (!onFeedback) {
116
- return;
117
- }
118
- onFeedback(feedback === "like" ? null : "like");
119
- }, [onFeedback, feedback]);
120
-
121
- const handleThumbsDown = useCallback(() => {
122
- if (!onFeedback) {
123
- return;
124
- }
125
- onFeedback(feedback === "dislike" ? null : "dislike");
126
- }, [onFeedback, feedback]);
114
+ const handleFeedbackChange = useCallback(
115
+ (nextValue?: ThumbsUpDownFeedbackValue) => {
116
+ if (!onFeedback) {
117
+ return;
118
+ }
119
+ // ThumbsUpDownFeedback already clears a repeated selection, so undefined means "no feedback".
120
+ onFeedback(nextValue === undefined ? null : nextValue === "positive" ? "like" : "dislike");
121
+ },
122
+ [onFeedback]
123
+ );
127
124
 
128
125
  const renderFeedback = () => (
129
- <View
130
- style={{alignItems: "center", flexDirection: "row"}}
126
+ <ThumbsUpDownFeedback
127
+ onChange={handleFeedbackChange}
131
128
  testID={testID ? `${testID}-feedback` : undefined}
132
- >
133
- <Pressable
134
- accessibilityLabel="Thumbs up"
135
- accessibilityRole="button"
136
- onPress={handleThumbsUp}
137
- style={{alignItems: "center", height: 24, justifyContent: "center", width: 24}}
138
- testID={testID ? `${testID}-thumbs-up` : undefined}
139
- >
140
- <Icon
141
- color={feedback === "like" ? "secondaryDark" : "secondaryLight"}
142
- iconName="thumbs-up"
143
- size="md"
144
- type={feedback === "like" ? "solid" : "regular"}
145
- />
146
- </Pressable>
147
- <Pressable
148
- accessibilityLabel="Thumbs down"
149
- accessibilityRole="button"
150
- onPress={handleThumbsDown}
151
- style={{alignItems: "center", height: 24, justifyContent: "center", width: 24}}
152
- testID={testID ? `${testID}-thumbs-down` : undefined}
153
- >
154
- <Icon
155
- color={feedback === "dislike" ? "secondaryDark" : "secondaryLight"}
156
- iconName="thumbs-down"
157
- size="md"
158
- type={feedback === "dislike" ? "solid" : "regular"}
159
- />
160
- </Pressable>
161
- </View>
129
+ value={feedback === "like" ? "positive" : feedback === "dislike" ? "negative" : undefined}
130
+ />
162
131
  );
163
132
 
164
133
  if (status === "not-started" || status === "generating") {
package/src/Common.ts CHANGED
@@ -1521,6 +1521,34 @@ export interface BadgeProps extends WithTestID {
1521
1521
  variant?: "iconOnly" | "numberOnly";
1522
1522
  }
1523
1523
 
1524
+ export type ThumbsUpDownFeedbackValue = "positive" | "negative";
1525
+
1526
+ export interface ThumbsUpDownFeedbackProps extends WithTestID {
1527
+ /**
1528
+ * If true, both options are non-interactive and rendered in a muted color.
1529
+ * @default false
1530
+ */
1531
+ disabled?: boolean;
1532
+ /**
1533
+ * Accessibility label for the negative (thumbs down) option.
1534
+ * @default "Thumbs down"
1535
+ */
1536
+ negativeAccessibilityLabel?: string;
1537
+ /**
1538
+ * Called with the newly selected value, or undefined when the current value is deselected.
1539
+ */
1540
+ onChange: (value?: ThumbsUpDownFeedbackValue) => void | Promise<void>;
1541
+ /**
1542
+ * Accessibility label for the positive (thumbs up) option.
1543
+ * @default "Thumbs up"
1544
+ */
1545
+ positiveAccessibilityLabel?: string;
1546
+ /**
1547
+ * The currently selected feedback. Leave undefined for no selection.
1548
+ */
1549
+ value?: ThumbsUpDownFeedbackValue;
1550
+ }
1551
+
1524
1552
  export interface SelectBadgeProps {
1525
1553
  /**
1526
1554
  * When status is "custom", determines the badge's background color.
@@ -0,0 +1,161 @@
1
+ import {describe, expect, it, mock} from "bun:test";
2
+ import {act, fireEvent, waitFor} from "@testing-library/react-native";
3
+
4
+ import {ConsentHistory} from "./ConsentHistory";
5
+ import {renderWithTheme} from "./test-utils";
6
+ import type {ConsentHistoryEntry} from "./useConsentHistory";
7
+
8
+ type ConsentHistoryApi = Parameters<typeof ConsentHistory>[0]["api"];
9
+
10
+ const makeEntry = (overrides: Partial<ConsentHistoryEntry> = {}): ConsentHistoryEntry => ({
11
+ _id: "entry-1",
12
+ agreed: true,
13
+ agreedAt: "2026-01-02T03:04:05.000Z",
14
+ form: {
15
+ captureSignature: true,
16
+ checkboxes: [{label: "I have read the terms", required: true}],
17
+ slug: "tos",
18
+ title: "Terms of Service",
19
+ type: "terms",
20
+ version: 3,
21
+ },
22
+ ...overrides,
23
+ });
24
+
25
+ const createApi = (state: {
26
+ data?: unknown;
27
+ error?: unknown;
28
+ isLoading?: boolean;
29
+ refetch?: () => void;
30
+ }): ConsentHistoryApi => {
31
+ const api = {
32
+ enhanceEndpoints: () => ({
33
+ injectEndpoints: () => ({
34
+ useGetMyConsentsQuery: () => ({
35
+ data: state.data,
36
+ error: state.error,
37
+ isLoading: state.isLoading ?? false,
38
+ refetch: state.refetch ?? (() => {}),
39
+ }),
40
+ }),
41
+ }),
42
+ };
43
+ return api as unknown as ConsentHistoryApi;
44
+ };
45
+
46
+ describe("ConsentHistory", () => {
47
+ it("renders a spinner while loading", () => {
48
+ const {queryByTestId} = renderWithTheme(
49
+ <ConsentHistory api={createApi({isLoading: true})} title="History" />
50
+ );
51
+ expect(queryByTestId("consent-history-list")).toBeNull();
52
+ });
53
+
54
+ it("renders an error state with a retry button", async () => {
55
+ const refetch = mock(() => {});
56
+ const {getByText} = renderWithTheme(
57
+ <ConsentHistory api={createApi({error: new Error("boom"), refetch})} />
58
+ );
59
+ expect(getByText("Failed to load consent history")).toBeTruthy();
60
+
61
+ await act(async () => {
62
+ fireEvent.press(getByText("Retry"));
63
+ // Button debounces presses.
64
+ await new Promise((resolve) => setTimeout(resolve, 100));
65
+ });
66
+
67
+ await waitFor(() => {
68
+ expect(refetch).toHaveBeenCalled();
69
+ });
70
+ });
71
+
72
+ it("renders an empty state when there are no entries", () => {
73
+ const {getByText} = renderWithTheme(<ConsentHistory api={createApi({data: []})} />);
74
+ expect(getByText("No consent records found.")).toBeTruthy();
75
+ });
76
+
77
+ it("renders each entry with its form title, type and agreed badge", () => {
78
+ const {getByTestId, getByText} = renderWithTheme(
79
+ <ConsentHistory api={createApi({data: [makeEntry()]})} />
80
+ );
81
+ expect(getByTestId("consent-history-list")).toBeTruthy();
82
+ expect(getByText("Terms of Service")).toBeTruthy();
83
+ expect(getByText("terms")).toBeTruthy();
84
+ expect(getByText("Agreed")).toBeTruthy();
85
+ });
86
+
87
+ it("falls back to placeholder text when the form is missing and shows declined entries", () => {
88
+ const {getByText} = renderWithTheme(
89
+ <ConsentHistory api={createApi({data: [makeEntry({agreed: false, form: null})]})} />
90
+ );
91
+ expect(getByText("Unknown Form")).toBeTruthy();
92
+ expect(getByText("Declined")).toBeTruthy();
93
+ });
94
+
95
+ it("expands and collapses the entry details when pressed", () => {
96
+ const {getByTestId, queryByTestId} = renderWithTheme(
97
+ <ConsentHistory api={createApi({data: [makeEntry()]})} />
98
+ );
99
+ expect(queryByTestId("consent-history-item-details-entry-1")).toBeNull();
100
+ fireEvent.press(getByTestId("consent-history-item-toggle-entry-1"));
101
+ expect(getByTestId("consent-history-item-details-entry-1")).toBeTruthy();
102
+ fireEvent.press(getByTestId("consent-history-item-toggle-entry-1"));
103
+ expect(queryByTestId("consent-history-item-details-entry-1")).toBeNull();
104
+ });
105
+
106
+ it("shows every optional detail when expanded", () => {
107
+ const entry = makeEntry({
108
+ checkboxValues: {"0": true, "1": false},
109
+ contentSnapshot: "# Snapshot",
110
+ ipAddress: "10.0.0.1",
111
+ locale: "en-US",
112
+ signature: "data:image/png;base64,abc",
113
+ signedAt: "2026-01-02T03:05:00.000Z",
114
+ });
115
+ const {getByTestId, getByText} = renderWithTheme(
116
+ <ConsentHistory api={createApi({data: [entry]})} />
117
+ );
118
+ fireEvent.press(getByTestId("consent-history-item-toggle-entry-1"));
119
+
120
+ expect(getByText("Version:")).toBeTruthy();
121
+ expect(getByText("3")).toBeTruthy();
122
+ expect(getByText("Locale:")).toBeTruthy();
123
+ expect(getByText("en-US")).toBeTruthy();
124
+ expect(getByText("Signed:")).toBeTruthy();
125
+ expect(getByText("IP Address:")).toBeTruthy();
126
+ expect(getByText("10.0.0.1")).toBeTruthy();
127
+ expect(getByText("Checkboxes")).toBeTruthy();
128
+ // Labelled from the form for index 0, generic fallback for index 1.
129
+ expect(getByText("I have read the terms")).toBeTruthy();
130
+ expect(getByText("Checkbox 1")).toBeTruthy();
131
+ expect(getByText("Yes")).toBeTruthy();
132
+ expect(getByText("No")).toBeTruthy();
133
+ expect(getByTestId("consent-history-signature-entry-1")).toBeTruthy();
134
+ expect(getByText("Form Content")).toBeTruthy();
135
+ });
136
+
137
+ it("renders raw date values that cannot be parsed and skips empty ones", () => {
138
+ const {getByTestId, getByText, queryByText} = renderWithTheme(
139
+ <ConsentHistory
140
+ api={createApi({data: [makeEntry({agreedAt: "not-a-date", signedAt: undefined})]})}
141
+ />
142
+ );
143
+ expect(getByText("not-a-date")).toBeTruthy();
144
+ fireEvent.press(getByTestId("consent-history-item-toggle-entry-1"));
145
+ expect(queryByText("Signed:")).toBeNull();
146
+ });
147
+
148
+ it("renders nothing for a blank date", () => {
149
+ const {getByTestId} = renderWithTheme(
150
+ <ConsentHistory api={createApi({data: [makeEntry({agreedAt: ""})]})} />
151
+ );
152
+ expect(getByTestId("consent-history-item-entry-1")).toBeTruthy();
153
+ });
154
+
155
+ it("unwraps a paginated response body", () => {
156
+ const {getByTestId} = renderWithTheme(
157
+ <ConsentHistory api={createApi({data: {data: [makeEntry()]}})} />
158
+ );
159
+ expect(getByTestId("consent-history-item-entry-1")).toBeTruthy();
160
+ });
161
+ });
@@ -91,6 +91,36 @@ describe("SignatureCaptureField", () => {
91
91
  expect(toJSON()).toMatchSnapshot();
92
92
  });
93
93
 
94
+ it("renders a placeholder box when disabled with a drawn value that has no image", () => {
95
+ const {toJSON} = renderWithTheme(
96
+ <SignatureCaptureField disabled onChange={() => {}} value={{image: "", mode: "draw"}} />
97
+ );
98
+ expect(toJSON()).toMatchSnapshot();
99
+ });
100
+
101
+ it("renders a read-only typed signature when disabled with a typed value", () => {
102
+ const {getByDisplayValue, queryByText} = renderWithTheme(
103
+ <SignatureCaptureField
104
+ disabled
105
+ helperText="Signed on Jan 1"
106
+ onChange={() => {}}
107
+ title="Signature"
108
+ value={{fontKey: "dancing-script", mode: "type", typedName: "Jane Doe"}}
109
+ />
110
+ );
111
+ expect(getByDisplayValue("Jane Doe")).toBeTruthy();
112
+ expect(queryByText("Draw")).toBeNull();
113
+ expect(queryByText("Type")).toBeNull();
114
+ });
115
+
116
+ it("renders the disabled typed field when disabled without a value", () => {
117
+ const {getByText, queryByText} = renderWithTheme(
118
+ <SignatureCaptureField disabled helperText="No signature captured" onChange={() => {}} />
119
+ );
120
+ expect(getByText("No signature captured")).toBeTruthy();
121
+ expect(queryByText("Draw")).toBeNull();
122
+ });
123
+
94
124
  it("forwards the resolved input test id to the typed name input in type mode", () => {
95
125
  const {UNSAFE_getAllByProps} = renderWithTheme(
96
126
  <SignatureCaptureField {...defaultProps} testID="sig" />
@@ -0,0 +1,100 @@
1
+ import {describe, expect, it, jest} from "bun:test";
2
+ import {fireEvent} from "@testing-library/react-native";
3
+
4
+ import {ThumbsUpDownFeedback} from "./ThumbsUpDownFeedback";
5
+ import {renderWithTheme} from "./test-utils";
6
+
7
+ describe("ThumbsUpDownFeedback", () => {
8
+ it("renders both options", () => {
9
+ const {getByTestId} = renderWithTheme(
10
+ <ThumbsUpDownFeedback onChange={jest.fn()} testID="feedback" />
11
+ );
12
+ expect(getByTestId("feedback-positive")).toBeTruthy();
13
+ expect(getByTestId("feedback-negative")).toBeTruthy();
14
+ });
15
+
16
+ it("calls onChange with the pressed value", () => {
17
+ const onChange = jest.fn();
18
+ const {getByTestId} = renderWithTheme(
19
+ <ThumbsUpDownFeedback onChange={onChange} testID="feedback" />
20
+ );
21
+ fireEvent.press(getByTestId("feedback-negative"));
22
+ expect(onChange).toHaveBeenCalledWith("negative");
23
+ });
24
+
25
+ it("clears the selection when pressing the selected option", () => {
26
+ const onChange = jest.fn();
27
+ const {getByTestId} = renderWithTheme(
28
+ <ThumbsUpDownFeedback onChange={onChange} testID="feedback" value="positive" />
29
+ );
30
+ fireEvent.press(getByTestId("feedback-positive"));
31
+ expect(onChange).toHaveBeenCalledWith(undefined);
32
+ });
33
+
34
+ it("exposes the selection and custom labels to assistive technology", () => {
35
+ const {getByTestId} = renderWithTheme(
36
+ <ThumbsUpDownFeedback
37
+ negativeAccessibilityLabel="Not helpful"
38
+ onChange={jest.fn()}
39
+ positiveAccessibilityLabel="Helpful"
40
+ testID="feedback"
41
+ value="negative"
42
+ />
43
+ );
44
+ const positive = getByTestId("feedback-positive");
45
+ const negative = getByTestId("feedback-negative");
46
+ expect(positive.props.accessibilityLabel).toBe("Helpful");
47
+ expect(negative.props.accessibilityLabel).toBe("Not helpful");
48
+ expect(positive.props.accessibilityState.selected).toBe(false);
49
+ expect(negative.props.accessibilityState.selected).toBe(true);
50
+ // react-native-web ignores accessibilityState, so the flat aria prop is what reaches the DOM.
51
+ expect(positive.props["aria-checked"]).toBe(false);
52
+ expect(negative.props["aria-checked"]).toBe(true);
53
+ });
54
+
55
+ it("activates on the spacebar, which react-native-web only handles for buttons", async () => {
56
+ const onChange = jest.fn();
57
+ const preventDefault = jest.fn();
58
+ const {getByTestId} = renderWithTheme(
59
+ <ThumbsUpDownFeedback onChange={onChange} testID="feedback" />
60
+ );
61
+ await getByTestId("feedback-positive").props.onKeyDown({key: " ", preventDefault});
62
+ expect(preventDefault).toHaveBeenCalled();
63
+ expect(onChange).toHaveBeenCalledWith("positive");
64
+ });
65
+
66
+ it("ignores auto-repeat from a held spacebar", async () => {
67
+ const onChange = jest.fn();
68
+ const preventDefault = jest.fn();
69
+ const {getByTestId} = renderWithTheme(
70
+ <ThumbsUpDownFeedback onChange={onChange} testID="feedback" />
71
+ );
72
+ await getByTestId("feedback-positive").props.onKeyDown({
73
+ key: " ",
74
+ preventDefault,
75
+ repeat: true,
76
+ });
77
+ expect(preventDefault).toHaveBeenCalled();
78
+ expect(onChange).not.toHaveBeenCalled();
79
+ });
80
+
81
+ it("ignores other keys so react-native-web keeps handling enter", async () => {
82
+ const onChange = jest.fn();
83
+ const preventDefault = jest.fn();
84
+ const {getByTestId} = renderWithTheme(
85
+ <ThumbsUpDownFeedback onChange={onChange} testID="feedback" />
86
+ );
87
+ await getByTestId("feedback-positive").props.onKeyDown({key: "Enter", preventDefault});
88
+ expect(preventDefault).not.toHaveBeenCalled();
89
+ expect(onChange).not.toHaveBeenCalled();
90
+ });
91
+
92
+ it("does not call onChange when disabled", () => {
93
+ const onChange = jest.fn();
94
+ const {getByTestId} = renderWithTheme(
95
+ <ThumbsUpDownFeedback disabled onChange={onChange} testID="feedback" />
96
+ );
97
+ fireEvent.press(getByTestId("feedback-positive"));
98
+ expect(onChange).not.toHaveBeenCalled();
99
+ });
100
+ });
@@ -0,0 +1,118 @@
1
+ import MaterialIcons from "@expo/vector-icons/MaterialIcons";
2
+ import {type FC, useCallback} from "react";
3
+ import {Pressable} from "react-native";
4
+
5
+ import {Box} from "./Box";
6
+ import type {ThumbsUpDownFeedbackProps, ThumbsUpDownFeedbackValue} from "./Common";
7
+ import {useTheme} from "./Theme";
8
+
9
+ /**
10
+ * MaterialIcons pads its artwork inside the em box and the thumbs are wider than they are tall, so
11
+ * this font size is the one that paints a 16px wide thumb — the Figma bounding box.
12
+ */
13
+ const ICON_SIZE = 19.2;
14
+
15
+ const ICON_NAME_MAP = {
16
+ negative: {selected: "thumb-down-alt", unselected: "thumb-down-off-alt"},
17
+ positive: {selected: "thumb-up-alt", unselected: "thumb-up-off-alt"},
18
+ } as const;
19
+
20
+ const TAP_TARGET_SIZE = 32;
21
+
22
+ /**
23
+ * react-native-web only activates a Pressable on the spacebar when the element is a native button or
24
+ * has role="button", so a checkbox needs its own spacebar handler (per ARIA, spacebar is the
25
+ * activation key for a checkbox). Not typed by react-native, so it is spread in separately.
26
+ */
27
+ interface WebKeyDownEvent {
28
+ key: string;
29
+ preventDefault: () => void;
30
+ repeat?: boolean;
31
+ }
32
+
33
+ interface WebKeyDownProps {
34
+ onKeyDown?: (event: WebKeyDownEvent) => void;
35
+ }
36
+
37
+ /**
38
+ * A pair of thumbs up / thumbs down options for collecting binary feedback, e.g. on an AI
39
+ * generated response. The selected option switches from an outlined to a filled thumb; pressing it
40
+ * again clears the selection and calls `onChange` with undefined.
41
+ */
42
+ export const ThumbsUpDownFeedback: FC<ThumbsUpDownFeedbackProps> = ({
43
+ disabled = false,
44
+ negativeAccessibilityLabel = "Thumbs down",
45
+ onChange,
46
+ positiveAccessibilityLabel = "Thumbs up",
47
+ testID,
48
+ value,
49
+ }) => {
50
+ const {theme} = useTheme();
51
+
52
+ const handlePress = useCallback(
53
+ async (pressedValue: ThumbsUpDownFeedbackValue) => {
54
+ if (disabled) {
55
+ return;
56
+ }
57
+ await onChange(value === pressedValue ? undefined : pressedValue);
58
+ },
59
+ [disabled, onChange, value]
60
+ );
61
+
62
+ const handleKeyDown = useCallback(
63
+ async (optionValue: ThumbsUpDownFeedbackValue, event: WebKeyDownEvent) => {
64
+ if (event.key !== " " && event.key !== "Spacebar") {
65
+ return;
66
+ }
67
+ event.preventDefault();
68
+ // A native button activates once per press, so ignore auto-repeat from a held spacebar.
69
+ if (event.repeat) {
70
+ return;
71
+ }
72
+ await handlePress(optionValue);
73
+ },
74
+ [handlePress]
75
+ );
76
+
77
+ const renderOption = (optionValue: ThumbsUpDownFeedbackValue) => {
78
+ const isSelected = value === optionValue;
79
+ const isPositive = optionValue === "positive";
80
+ const iconColor = disabled ? theme.surface.disabled : theme.surface.secondaryDark;
81
+ const iconName =
82
+ ICON_NAME_MAP[isPositive ? "positive" : "negative"][isSelected ? "selected" : "unselected"];
83
+ const webKeyDownProps: WebKeyDownProps = {
84
+ onKeyDown: async (event) => handleKeyDown(optionValue, event),
85
+ };
86
+
87
+ return (
88
+ <Pressable
89
+ {...webKeyDownProps}
90
+ accessibilityLabel={isPositive ? positiveAccessibilityLabel : negativeAccessibilityLabel}
91
+ accessibilityRole="checkbox"
92
+ accessibilityState={{checked: isSelected, disabled, selected: isSelected}}
93
+ aria-checked={isSelected}
94
+ aria-disabled={disabled}
95
+ disabled={disabled}
96
+ onPress={async () => handlePress(optionValue)}
97
+ style={{
98
+ alignItems: "center",
99
+ backgroundColor: "transparent",
100
+ borderRadius: TAP_TARGET_SIZE / 2,
101
+ height: TAP_TARGET_SIZE,
102
+ justifyContent: "center",
103
+ width: TAP_TARGET_SIZE,
104
+ }}
105
+ testID={testID ? `${testID}-${isPositive ? "positive" : "negative"}` : undefined}
106
+ >
107
+ <MaterialIcons color={iconColor} name={iconName} selectable={undefined} size={ICON_SIZE} />
108
+ </Pressable>
109
+ );
110
+ };
111
+
112
+ return (
113
+ <Box alignItems="center" direction="row" testID={testID}>
114
+ {renderOption("positive")}
115
+ {renderOption("negative")}
116
+ </Box>
117
+ );
118
+ };
@@ -444,15 +444,26 @@ exports[`AiSuggestionBox in TextArea snapshots should match snapshot for ready s
444
444
  "children": null,
445
445
  "props": {
446
446
  "accessibilityLabel": "Thumbs up",
447
- "accessibilityRole": "button",
448
- "onPress": [Function],
447
+ "accessibilityRole": "checkbox",
448
+ "accessibilityState": {
449
+ "checked": false,
450
+ "disabled": false,
451
+ "selected": false,
452
+ },
453
+ "aria-checked": false,
454
+ "aria-disabled": false,
455
+ "disabled": false,
456
+ "onKeyDown": [Function: AsyncFunction],
457
+ "onPress": [Function: AsyncFunction],
449
458
  "style": {
450
459
  "alignItems": "center",
451
- "height": 24,
460
+ "backgroundColor": "transparent",
461
+ "borderRadius": 16,
462
+ "height": 32,
452
463
  "justifyContent": "center",
453
- "width": 24,
464
+ "width": 32,
454
465
  },
455
- "testID": "test-ai-suggestion-thumbs-up",
466
+ "testID": "test-ai-suggestion-feedback-positive",
456
467
  },
457
468
  "type": "Pressable",
458
469
  },
@@ -461,23 +472,38 @@ exports[`AiSuggestionBox in TextArea snapshots should match snapshot for ready s
461
472
  "children": null,
462
473
  "props": {
463
474
  "accessibilityLabel": "Thumbs down",
464
- "accessibilityRole": "button",
465
- "onPress": [Function],
475
+ "accessibilityRole": "checkbox",
476
+ "accessibilityState": {
477
+ "checked": false,
478
+ "disabled": false,
479
+ "selected": false,
480
+ },
481
+ "aria-checked": false,
482
+ "aria-disabled": false,
483
+ "disabled": false,
484
+ "onKeyDown": [Function: AsyncFunction],
485
+ "onPress": [Function: AsyncFunction],
466
486
  "style": {
467
487
  "alignItems": "center",
468
- "height": 24,
488
+ "backgroundColor": "transparent",
489
+ "borderRadius": 16,
490
+ "height": 32,
469
491
  "justifyContent": "center",
470
- "width": 24,
492
+ "width": 32,
471
493
  },
472
- "testID": "test-ai-suggestion-thumbs-down",
494
+ "testID": "test-ai-suggestion-feedback-negative",
473
495
  },
474
496
  "type": "Pressable",
475
497
  },
476
498
  ],
477
499
  "props": {
500
+ "onPointerEnter": [Function: AsyncFunction],
501
+ "onPointerLeave": [Function: AsyncFunction],
478
502
  "style": {
479
503
  "alignItems": "center",
504
+ "display": "flex",
480
505
  "flexDirection": "row",
506
+ "testID": "test-ai-suggestion-feedback",
481
507
  },
482
508
  "testID": "test-ai-suggestion-feedback",
483
509
  },
@@ -939,15 +965,26 @@ exports[`AiSuggestionBox in TextArea snapshots should match snapshot for hidden
939
965
  "children": null,
940
966
  "props": {
941
967
  "accessibilityLabel": "Thumbs up",
942
- "accessibilityRole": "button",
943
- "onPress": [Function],
968
+ "accessibilityRole": "checkbox",
969
+ "accessibilityState": {
970
+ "checked": false,
971
+ "disabled": false,
972
+ "selected": false,
973
+ },
974
+ "aria-checked": false,
975
+ "aria-disabled": false,
976
+ "disabled": false,
977
+ "onKeyDown": [Function: AsyncFunction],
978
+ "onPress": [Function: AsyncFunction],
944
979
  "style": {
945
980
  "alignItems": "center",
946
- "height": 24,
981
+ "backgroundColor": "transparent",
982
+ "borderRadius": 16,
983
+ "height": 32,
947
984
  "justifyContent": "center",
948
- "width": 24,
985
+ "width": 32,
949
986
  },
950
- "testID": "test-ai-suggestion-thumbs-up",
987
+ "testID": "test-ai-suggestion-feedback-positive",
951
988
  },
952
989
  "type": "Pressable",
953
990
  },
@@ -956,23 +993,38 @@ exports[`AiSuggestionBox in TextArea snapshots should match snapshot for hidden
956
993
  "children": null,
957
994
  "props": {
958
995
  "accessibilityLabel": "Thumbs down",
959
- "accessibilityRole": "button",
960
- "onPress": [Function],
996
+ "accessibilityRole": "checkbox",
997
+ "accessibilityState": {
998
+ "checked": false,
999
+ "disabled": false,
1000
+ "selected": false,
1001
+ },
1002
+ "aria-checked": false,
1003
+ "aria-disabled": false,
1004
+ "disabled": false,
1005
+ "onKeyDown": [Function: AsyncFunction],
1006
+ "onPress": [Function: AsyncFunction],
961
1007
  "style": {
962
1008
  "alignItems": "center",
963
- "height": 24,
1009
+ "backgroundColor": "transparent",
1010
+ "borderRadius": 16,
1011
+ "height": 32,
964
1012
  "justifyContent": "center",
965
- "width": 24,
1013
+ "width": 32,
966
1014
  },
967
- "testID": "test-ai-suggestion-thumbs-down",
1015
+ "testID": "test-ai-suggestion-feedback-negative",
968
1016
  },
969
1017
  "type": "Pressable",
970
1018
  },
971
1019
  ],
972
1020
  "props": {
1021
+ "onPointerEnter": [Function: AsyncFunction],
1022
+ "onPointerLeave": [Function: AsyncFunction],
973
1023
  "style": {
974
1024
  "alignItems": "center",
1025
+ "display": "flex",
975
1026
  "flexDirection": "row",
1027
+ "testID": "test-ai-suggestion-feedback",
976
1028
  },
977
1029
  "testID": "test-ai-suggestion-feedback",
978
1030
  },
@@ -1253,15 +1305,26 @@ exports[`AiSuggestionBox in TextArea snapshots should match snapshot for added s
1253
1305
  "children": null,
1254
1306
  "props": {
1255
1307
  "accessibilityLabel": "Thumbs up",
1256
- "accessibilityRole": "button",
1257
- "onPress": [Function],
1308
+ "accessibilityRole": "checkbox",
1309
+ "accessibilityState": {
1310
+ "checked": true,
1311
+ "disabled": false,
1312
+ "selected": true,
1313
+ },
1314
+ "aria-checked": true,
1315
+ "aria-disabled": false,
1316
+ "disabled": false,
1317
+ "onKeyDown": [Function: AsyncFunction],
1318
+ "onPress": [Function: AsyncFunction],
1258
1319
  "style": {
1259
1320
  "alignItems": "center",
1260
- "height": 24,
1321
+ "backgroundColor": "transparent",
1322
+ "borderRadius": 16,
1323
+ "height": 32,
1261
1324
  "justifyContent": "center",
1262
- "width": 24,
1325
+ "width": 32,
1263
1326
  },
1264
- "testID": "test-ai-suggestion-thumbs-up",
1327
+ "testID": "test-ai-suggestion-feedback-positive",
1265
1328
  },
1266
1329
  "type": "Pressable",
1267
1330
  },
@@ -1270,23 +1333,38 @@ exports[`AiSuggestionBox in TextArea snapshots should match snapshot for added s
1270
1333
  "children": null,
1271
1334
  "props": {
1272
1335
  "accessibilityLabel": "Thumbs down",
1273
- "accessibilityRole": "button",
1274
- "onPress": [Function],
1336
+ "accessibilityRole": "checkbox",
1337
+ "accessibilityState": {
1338
+ "checked": false,
1339
+ "disabled": false,
1340
+ "selected": false,
1341
+ },
1342
+ "aria-checked": false,
1343
+ "aria-disabled": false,
1344
+ "disabled": false,
1345
+ "onKeyDown": [Function: AsyncFunction],
1346
+ "onPress": [Function: AsyncFunction],
1275
1347
  "style": {
1276
1348
  "alignItems": "center",
1277
- "height": 24,
1349
+ "backgroundColor": "transparent",
1350
+ "borderRadius": 16,
1351
+ "height": 32,
1278
1352
  "justifyContent": "center",
1279
- "width": 24,
1353
+ "width": 32,
1280
1354
  },
1281
- "testID": "test-ai-suggestion-thumbs-down",
1355
+ "testID": "test-ai-suggestion-feedback-negative",
1282
1356
  },
1283
1357
  "type": "Pressable",
1284
1358
  },
1285
1359
  ],
1286
1360
  "props": {
1361
+ "onPointerEnter": [Function: AsyncFunction],
1362
+ "onPointerLeave": [Function: AsyncFunction],
1287
1363
  "style": {
1288
1364
  "alignItems": "center",
1365
+ "display": "flex",
1289
1366
  "flexDirection": "row",
1367
+ "testID": "test-ai-suggestion-feedback",
1290
1368
  },
1291
1369
  "testID": "test-ai-suggestion-feedback",
1292
1370
  },
@@ -49,3 +49,48 @@ exports[`SignatureCaptureField renders a read-only drawn image when disabled wit
49
49
  "type": "View",
50
50
  }
51
51
  `;
52
+
53
+ exports[`SignatureCaptureField renders a placeholder box when disabled with a drawn value that has no image 1`] = `
54
+ {
55
+ "$$typeof": Symbol(react.test.json),
56
+ "children": [
57
+ {
58
+ "$$typeof": Symbol(react.test.json),
59
+ "children": [
60
+ "Signature",
61
+ ],
62
+ "props": {
63
+ "style": {
64
+ "color": "#1C1C1C",
65
+ "fontSize": 14,
66
+ "fontWeight": 600,
67
+ "lineHeight": 22.4,
68
+ },
69
+ },
70
+ "type": "Text",
71
+ },
72
+ {
73
+ "$$typeof": Symbol(react.test.json),
74
+ "children": null,
75
+ "props": {
76
+ "style": {
77
+ "backgroundColor": "#D9D9D9",
78
+ "height": 90,
79
+ "marginVertical": 8,
80
+ "width": 300,
81
+ },
82
+ "testID": undefined,
83
+ },
84
+ "type": "View",
85
+ },
86
+ ],
87
+ "props": {
88
+ "style": {
89
+ "flexDirection": "column",
90
+ "width": "100%",
91
+ },
92
+ "testID": undefined,
93
+ },
94
+ "type": "View",
95
+ }
96
+ `;
package/src/bunSetup.ts CHANGED
@@ -756,6 +756,11 @@ mock.module("@expo/vector-icons/FontAwesome6", () => ({
756
756
  default: mock(() => null),
757
757
  }));
758
758
 
759
+ // Mock @expo/vector-icons/MaterialIcons
760
+ mock.module("@expo/vector-icons/MaterialIcons", () => ({
761
+ default: mock(() => null),
762
+ }));
763
+
759
764
  // Mock linkify-it - need to mock the Hyperlink component directly instead
760
765
  mock.module("./Hyperlink", () => ({
761
766
  Hyperlink: ({children}: MockComponentProps) => React.createElement("View", {}, children),
package/src/index.tsx CHANGED
@@ -104,6 +104,7 @@ export * from "./Text";
104
104
  export * from "./TextArea";
105
105
  export * from "./TextField";
106
106
  export * from "./Theme";
107
+ export * from "./ThumbsUpDownFeedback";
107
108
  export * from "./Toast";
108
109
  export {Tooltip} from "./Tooltip";
109
110
  export * from "./TypedSignatureField";