@terreno/ui 57.11.0 → 57.13.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.
- package/dist/AiSuggestionBox.js +9 -9
- package/dist/AiSuggestionBox.js.map +1 -1
- package/dist/Banner.js +1 -1
- package/dist/Banner.js.map +1 -1
- package/dist/Box.d.ts.map +1 -1
- package/dist/Box.js +36 -3
- package/dist/Box.js.map +1 -1
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +7 -0
- package/dist/Button.js.map +1 -1
- package/dist/Common.d.ts +34 -4
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/DataTable.d.ts.map +1 -1
- package/dist/DataTable.js +50 -3
- package/dist/DataTable.js.map +1 -1
- package/dist/Image.d.ts.map +1 -1
- package/dist/Image.js +1 -1
- package/dist/Image.js.map +1 -1
- package/dist/MarkdownView.d.ts.map +1 -1
- package/dist/MarkdownView.js +67 -5
- package/dist/MarkdownView.js.map +1 -1
- package/dist/Modal.js +1 -1
- package/dist/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl.js +15 -11
- package/dist/SegmentedControl.js.map +1 -1
- package/dist/SelectField.d.ts.map +1 -1
- package/dist/SelectField.js +4 -1
- package/dist/SelectField.js.map +1 -1
- package/dist/SplitPage.d.ts.map +1 -1
- package/dist/SplitPage.js +145 -55
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.js +1 -1
- package/dist/SplitPage.native.js.map +1 -1
- package/dist/TerrenoProvider.d.ts +7 -3
- package/dist/TerrenoProvider.d.ts.map +1 -1
- package/dist/TerrenoProvider.js +2 -2
- package/dist/TerrenoProvider.js.map +1 -1
- package/dist/Theme.d.ts +19 -85
- package/dist/Theme.d.ts.map +1 -1
- package/dist/Theme.js +149 -33
- package/dist/Theme.js.map +1 -1
- package/dist/Toast.d.ts.map +1 -1
- package/dist/Toast.js +21 -12
- package/dist/Toast.js.map +1 -1
- package/dist/ToastNotifications.d.ts.map +1 -1
- package/dist/ToastNotifications.js +5 -2
- package/dist/ToastNotifications.js.map +1 -1
- package/dist/Tooltip.d.ts +1 -0
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js +84 -37
- package/dist/Tooltip.js.map +1 -1
- package/dist/blocks/BlocksView.d.ts.map +1 -1
- package/dist/blocks/BlocksView.js +5 -1
- package/dist/blocks/BlocksView.js.map +1 -1
- package/dist/blocks/blockRenderers.d.ts +10 -1
- package/dist/blocks/blockRenderers.d.ts.map +1 -1
- package/dist/blocks/blockRenderers.js +330 -9
- package/dist/blocks/blockRenderers.js.map +1 -1
- package/dist/blocks/useChecklistState.d.ts +18 -0
- package/dist/blocks/useChecklistState.d.ts.map +1 -0
- package/dist/blocks/useChecklistState.js +29 -0
- package/dist/blocks/useChecklistState.js.map +1 -0
- package/dist/blocks/useResolvedImages.d.ts.map +1 -1
- package/dist/blocks/useResolvedImages.js +16 -0
- package/dist/blocks/useResolvedImages.js.map +1 -1
- package/dist/colorContrast.d.ts +9 -0
- package/dist/colorContrast.d.ts.map +1 -0
- package/dist/colorContrast.js +47 -0
- package/dist/colorContrast.js.map +1 -0
- package/dist/icons/OfflineIcon.js +1 -1
- package/dist/table/TableDate.d.ts.map +1 -1
- package/dist/table/TableDate.js +3 -1
- package/dist/table/TableDate.js.map +1 -1
- package/package.json +2 -2
- package/src/AiSuggestionBox.tsx +10 -10
- package/src/Banner.tsx +1 -1
- package/src/Box.test.tsx +80 -0
- package/src/Box.tsx +52 -0
- package/src/Button.test.tsx +39 -1
- package/src/Button.tsx +9 -0
- package/src/Common.ts +35 -4
- package/src/DataTable.test.tsx +133 -1
- package/src/DataTable.tsx +78 -3
- package/src/Image.tsx +1 -0
- package/src/MarkdownView.test.tsx +165 -2
- package/src/MarkdownView.tsx +100 -5
- package/src/Modal.tsx +1 -1
- package/src/SegmentedControl.test.tsx +7 -0
- package/src/SegmentedControl.tsx +22 -11
- package/src/SelectField.tsx +4 -1
- package/src/SplitPage.native.tsx +1 -1
- package/src/SplitPage.test.tsx +473 -5
- package/src/SplitPage.tsx +266 -132
- package/src/TerrenoProvider.tsx +15 -5
- package/src/Theme.test.tsx +212 -3
- package/src/Theme.tsx +184 -39
- package/src/Toast.test.tsx +7 -0
- package/src/Toast.tsx +22 -12
- package/src/ToastNotifications.test.tsx +36 -0
- package/src/ToastNotifications.tsx +5 -2
- package/src/Tooltip.test.tsx +232 -1
- package/src/Tooltip.tsx +128 -67
- package/src/__snapshots__/AddressField.test.tsx.snap +7 -7
- package/src/__snapshots__/AiSuggestionBox.test.tsx.snap +23 -23
- package/src/__snapshots__/Banner.test.tsx.snap +3 -0
- package/src/__snapshots__/BooleanField.test.tsx.snap +3 -3
- package/src/__snapshots__/Button.test.tsx.snap +16 -16
- package/src/__snapshots__/Card.test.tsx.snap +0 -1
- package/src/__snapshots__/CustomSelectField.test.tsx.snap +23 -23
- package/src/__snapshots__/DataTable.test.tsx.snap +30 -30
- package/src/__snapshots__/DecimalRangeActionSheet.test.tsx.snap +2 -2
- package/src/__snapshots__/DropdownPanel.test.tsx.snap +2 -2
- package/src/__snapshots__/EmailField.test.tsx.snap +2 -2
- package/src/__snapshots__/ErrorPage.test.tsx.snap +1 -1
- package/src/__snapshots__/Field.test.tsx.snap +37 -37
- package/src/__snapshots__/FilterSelectMenu.test.tsx.snap +2 -1
- package/src/__snapshots__/HeightActionSheet.test.tsx.snap +2 -2
- package/src/__snapshots__/HeightField.test.tsx.snap +8 -8
- package/src/__snapshots__/HeightFieldDesktop.test.tsx.snap +6 -6
- package/src/__snapshots__/InfoModalIcon.test.tsx.snap +2 -2
- package/src/__snapshots__/MarkdownView.test.tsx.snap +2 -2
- package/src/__snapshots__/MobileAddressAutoComplete.test.tsx.snap +1 -1
- package/src/__snapshots__/Modal.test.tsx.snap +10 -10
- package/src/__snapshots__/NumberField.test.tsx.snap +1 -1
- package/src/__snapshots__/NumberPickerActionSheet.test.tsx.snap +2 -2
- package/src/__snapshots__/Page.test.tsx.snap +1 -1
- package/src/__snapshots__/PhoneNumberField.test.tsx.snap +4 -4
- package/src/__snapshots__/PickerSelect.test.tsx.snap +8 -8
- package/src/__snapshots__/SectionDivider.test.tsx.snap +2 -2
- package/src/__snapshots__/SegmentedControl.test.tsx.snap +183 -0
- package/src/__snapshots__/SelectBadge.test.tsx.snap +9 -9
- package/src/__snapshots__/SelectField.test.tsx.snap +19 -19
- package/src/__snapshots__/Signature.test.tsx.snap +1 -1
- package/src/__snapshots__/SignatureCaptureField.test.tsx.snap +2 -2
- package/src/__snapshots__/SignatureField.test.tsx.snap +2 -2
- package/src/__snapshots__/SplitPage.test.tsx.snap +165 -67
- package/src/__snapshots__/TapToEdit.test.tsx.snap +1 -1
- package/src/__snapshots__/TerrenoProvider.test.tsx.snap +20 -4
- package/src/__snapshots__/TextArea.test.tsx.snap +4 -4
- package/src/__snapshots__/TextField.test.tsx.snap +3 -3
- package/src/__snapshots__/TimezonePicker.test.tsx.snap +18 -18
- package/src/__snapshots__/Toast.test.tsx.snap +224 -154
- package/src/__snapshots__/TypedSignatureField.test.tsx.snap +3 -3
- package/src/__snapshots__/UnifiedAddressAutoComplete.test.tsx.snap +6 -6
- package/src/__snapshots__/WebAddressAutocomplete.test.tsx.snap +4 -4
- package/src/blocks/BlocksView.test.tsx +1101 -2
- package/src/blocks/BlocksView.tsx +5 -1
- package/src/blocks/blockRenderers.tsx +730 -22
- package/src/blocks/useChecklistState.ts +46 -0
- package/src/blocks/useResolvedImages.ts +16 -0
- package/src/bunSetup.ts +3 -0
- package/src/colorContrast.test.ts +27 -0
- package/src/colorContrast.ts +55 -0
- package/src/icons/OfflineIcon.tsx +2 -2
- package/src/icons/__snapshots__/OfflineIcon.test.tsx.snap +4 -4
- package/src/login/__snapshots__/LoginScreen.test.tsx.snap +7 -7
- package/src/signUp/__snapshots__/OAuthButtons.test.tsx.snap +3 -3
- package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +7 -7
- package/src/table/TableDate.tsx +3 -1
- package/src/table/__snapshots__/Table.test.tsx.snap +5 -5
- package/src/table/__snapshots__/TableBadge.test.tsx.snap +3 -3
- package/src/table/__snapshots__/TableDate.test.tsx.snap +4 -0
- package/src/table/__snapshots__/TableHeader.test.tsx.snap +4 -4
- package/src/table/__snapshots__/TableHeaderCell.test.tsx.snap +7 -7
- package/src/table/__snapshots__/TableRow.test.tsx.snap +6 -6
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const WCAG_NORMAL_TEXT_CONTRAST = 4.5;
|
|
2
|
+
const srgbChannel = (value) => {
|
|
3
|
+
const srgb = value / 255;
|
|
4
|
+
return srgb <= 0.03928 ? srgb / 12.92 : ((srgb + 0.055) / 1.055) ** 2.4;
|
|
5
|
+
};
|
|
6
|
+
const parseHex = (hex) => {
|
|
7
|
+
const match = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
|
|
8
|
+
const value = match?.[1];
|
|
9
|
+
if (!value) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
b: Number.parseInt(value.slice(4, 6), 16),
|
|
14
|
+
g: Number.parseInt(value.slice(2, 4), 16),
|
|
15
|
+
r: Number.parseInt(value.slice(0, 2), 16),
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const luminance = (rgb) => {
|
|
19
|
+
return 0.2126 * srgbChannel(rgb.r) + 0.7152 * srgbChannel(rgb.g) + 0.0722 * srgbChannel(rgb.b);
|
|
20
|
+
};
|
|
21
|
+
/** WCAG contrast ratio, from 1 (identical) to 21 (black on white). Unparsed colors return 1. */
|
|
22
|
+
export const contrastRatio = (foreground, background) => {
|
|
23
|
+
const fg = parseHex(foreground);
|
|
24
|
+
const bg = parseHex(background);
|
|
25
|
+
if (!fg || !bg) {
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
const lighter = Math.max(luminance(fg), luminance(bg));
|
|
29
|
+
const darker = Math.min(luminance(fg), luminance(bg));
|
|
30
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Text role that meets WCAG AA for normal text on `background`.
|
|
34
|
+
* Prefers `primary` so unchanged surfaces keep their current color.
|
|
35
|
+
*/
|
|
36
|
+
export const readableTextColor = (primary, inverted, background) => {
|
|
37
|
+
const primaryRatio = contrastRatio(primary, background);
|
|
38
|
+
if (primaryRatio >= WCAG_NORMAL_TEXT_CONTRAST) {
|
|
39
|
+
return "primary";
|
|
40
|
+
}
|
|
41
|
+
const invertedRatio = contrastRatio(inverted, background);
|
|
42
|
+
if (invertedRatio > primaryRatio) {
|
|
43
|
+
return "inverted";
|
|
44
|
+
}
|
|
45
|
+
return "primary";
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=colorContrast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorContrast.js","sourceRoot":"","sources":["../src/colorContrast.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C,MAAM,WAAW,GAAG,CAAC,KAAa,EAAU,EAAE;IAC5C,MAAM,IAAI,GAAG,KAAK,GAAG,GAAG,CAAC;IACzB,OAAO,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC;AAC1E,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAiD,EAAE;IAC9E,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IACzB,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO;QACL,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;QACzC,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;QACzC,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;KAC1C,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,GAAsC,EAAU,EAAE;IACnE,OAAO,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjG,CAAC,CAAC;AAEF,gGAAgG;AAChG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAkB,EAAE,UAAkB,EAAU,EAAE;IAC9E,MAAM,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;IAChC,MAAM,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;IACtD,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,OAAe,EACf,QAAgB,EAChB,UAAkB,EACM,EAAE;IAC1B,MAAM,YAAY,GAAG,aAAa,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACxD,IAAI,YAAY,IAAI,yBAAyB,EAAE,CAAC;QAC9C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,aAAa,GAAG,aAAa,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC1D,IAAI,aAAa,GAAG,YAAY,EAAE,CAAC;QACjC,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Svg, { Path } from "react-native-svg";
|
|
3
|
-
export const OfflineIcon = ({ doNotDisturb, ...props }) => (_jsxs(Svg, { fill: "none", height: 33, width: 30, ...props, children: [_jsx(Path, { d: "M28.5 18c0 7.456-6.044 13.5-13.5 13.5S1.5 25.456 1.5 18 7.544 4.5 15 4.5 28.5 10.544 28.5 18Z", fill: "#2B6072", stroke: "#fff", strokeWidth: 3 }), _jsx(Path, { d: "M24.5 18a9.5 9.5 0 1 1-19 0 9.5 9.5 0 0 1 19 0Z", fill: "#fff", stroke: "#
|
|
3
|
+
export const OfflineIcon = ({ doNotDisturb, ...props }) => (_jsxs(Svg, { fill: "none", height: 33, width: 30, ...props, children: [_jsx(Path, { d: "M28.5 18c0 7.456-6.044 13.5-13.5 13.5S1.5 25.456 1.5 18 7.544 4.5 15 4.5 28.5 10.544 28.5 18Z", fill: "#2B6072", stroke: "#fff", strokeWidth: 3 }), _jsx(Path, { d: "M24.5 18a9.5 9.5 0 1 1-19 0 9.5 9.5 0 0 1 19 0Z", fill: "#fff", stroke: "#949494", strokeWidth: 5 }), doNotDisturb && (_jsxs(_Fragment, { children: [_jsx(Path, { d: "M18 4h8l-8 6.857h8", stroke: "#fff", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 8 }), _jsx(Path, { d: "M18 4h8l-8 6.857h8", stroke: "#949494", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3 })] }))] }));
|
|
4
4
|
//# sourceMappingURL=OfflineIcon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableDate.d.ts","sourceRoot":"","sources":["../../src/table/TableDate.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAE,EAAW,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"TableDate.d.ts","sourceRoot":"","sources":["../../src/table/TableDate.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAE,EAAW,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAG9C,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CA8BxC,CAAC"}
|
package/dist/table/TableDate.js
CHANGED
|
@@ -2,9 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { DateTime } from "luxon";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { Text } from "react-native";
|
|
5
|
+
import { useTheme } from "../Theme";
|
|
5
6
|
export const TableDate = ({ value, annotated = false }) => {
|
|
6
7
|
const initialDate = typeof value === "string" ? DateTime.fromISO(value) : DateTime.fromJSDate(value);
|
|
7
8
|
const [dateVal] = useState(initialDate);
|
|
9
|
+
const { theme } = useTheme();
|
|
8
10
|
// TODO: Formatting date with annotations should be in DateUtilities and tested.
|
|
9
11
|
const formatDate = (date) => {
|
|
10
12
|
const now = DateTime.now();
|
|
@@ -21,7 +23,7 @@ export const TableDate = ({ value, annotated = false }) => {
|
|
|
21
23
|
}
|
|
22
24
|
return `${date.toFormat("MM/dd/yyyy")} (${diffString.trim()})`;
|
|
23
25
|
};
|
|
24
|
-
return (_jsx(Text, { style: { fontSize: 16 }, children: annotated ? formatDate(dateVal) : dateVal.toFormat("MM/dd/yyyy") }));
|
|
26
|
+
return (_jsx(Text, { style: { color: theme.text.primary, fontSize: 16 }, children: annotated ? formatDate(dateVal) : dateVal.toFormat("MM/dd/yyyy") }));
|
|
25
27
|
};
|
|
26
28
|
TableDate.displayName = "TableDate";
|
|
27
29
|
//# sourceMappingURL=TableDate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableDate.js","sourceRoot":"","sources":["../../src/table/TableDate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAU,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"TableDate.js","sourceRoot":"","sources":["../../src/table/TableDate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAU,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAGlC,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAC;AAElC,MAAM,CAAC,MAAM,SAAS,GAAuB,CAAC,EAAC,KAAK,EAAE,SAAS,GAAG,KAAK,EAAC,EAAE,EAAE;IAC1E,MAAM,WAAW,GACf,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACnF,MAAM,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;IACxC,MAAM,EAAC,KAAK,EAAC,GAAG,QAAQ,EAAE,CAAC;IAE3B,gFAAgF;IAChF,MAAM,UAAU,GAAG,CAAC,IAAc,EAAE,EAAE;QACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAEpE,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,UAAU,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;QAC1F,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,UAAU,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;QAC1F,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,UAAU,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACtF,CAAC;QAED,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC;IACjE,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,IAAI,IAAC,KAAK,EAAE,EAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAC,YACnD,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,GAC5D,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@react-native-picker/picker": "2.11.4",
|
|
27
27
|
"@react-navigation/native": "^7.1.8",
|
|
28
28
|
"@shopify/react-native-skia": "2.6.5",
|
|
29
|
-
"@terreno/blocks": "57.
|
|
29
|
+
"@terreno/blocks": "57.13.0",
|
|
30
30
|
"d3-scale": "^4.0.2",
|
|
31
31
|
"d3-shape": "^3.2.0",
|
|
32
32
|
"emoji-datasource": "^16.0.0",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"test:coverage": "TZ=America/New_York bun run ../scripts/check-coverage.ts",
|
|
164
164
|
"types": "bun typedoc"
|
|
165
165
|
},
|
|
166
|
-
"version": "57.
|
|
166
|
+
"version": "57.13.0",
|
|
167
167
|
"bugs": {
|
|
168
168
|
"url": "https://github.com/TerrenoLabs/terreno/issues"
|
|
169
169
|
},
|
package/src/AiSuggestionBox.tsx
CHANGED
|
@@ -61,14 +61,14 @@ export const AiSuggestionBox: FC<AiSuggestionBoxProps> = ({
|
|
|
61
61
|
const backgroundColor = isAdded
|
|
62
62
|
? theme.surface.successLight
|
|
63
63
|
: status === "not-started"
|
|
64
|
-
? theme.
|
|
65
|
-
: theme.
|
|
64
|
+
? theme.surface.baseAlternate
|
|
65
|
+
: theme.surface.ai;
|
|
66
66
|
|
|
67
67
|
const borderColor = isAdded
|
|
68
|
-
?
|
|
68
|
+
? theme.border.success
|
|
69
69
|
: status === "not-started"
|
|
70
|
-
? theme.
|
|
71
|
-
: theme.
|
|
70
|
+
? theme.border.default
|
|
71
|
+
: theme.border.ai;
|
|
72
72
|
|
|
73
73
|
const containerStyle = {
|
|
74
74
|
backgroundColor,
|
|
@@ -136,7 +136,7 @@ export const AiSuggestionBox: FC<AiSuggestionBoxProps> = ({
|
|
|
136
136
|
<View style={{alignItems: "center", flexDirection: "row", gap: 4, width: "100%"}}>
|
|
137
137
|
<SparklesIcon fill={theme.text.secondaryDark} />
|
|
138
138
|
<View style={{flex: 1}}>
|
|
139
|
-
<Text color="secondaryDark" size="sm">
|
|
139
|
+
<Text color={isAdded ? "primary" : "secondaryDark"} size="sm">
|
|
140
140
|
{headingText}
|
|
141
141
|
</Text>
|
|
142
142
|
</View>
|
|
@@ -151,7 +151,7 @@ export const AiSuggestionBox: FC<AiSuggestionBoxProps> = ({
|
|
|
151
151
|
<View style={{alignItems: "center", flexDirection: "row", gap: 4, width: "100%"}}>
|
|
152
152
|
<SparklesIcon fill={theme.text.secondaryDark} />
|
|
153
153
|
<View style={{flex: 1}}>
|
|
154
|
-
<Text color="secondaryDark" size="sm">
|
|
154
|
+
<Text color={isAdded ? "primary" : "secondaryDark"} size="sm">
|
|
155
155
|
{headingText}
|
|
156
156
|
</Text>
|
|
157
157
|
</View>
|
|
@@ -161,7 +161,7 @@ export const AiSuggestionBox: FC<AiSuggestionBoxProps> = ({
|
|
|
161
161
|
size="sm"
|
|
162
162
|
testID={testID ? `${testID}-show` : undefined}
|
|
163
163
|
text="Show"
|
|
164
|
-
variant="
|
|
164
|
+
variant="outline"
|
|
165
165
|
/>
|
|
166
166
|
{renderFeedback()}
|
|
167
167
|
</View>
|
|
@@ -175,7 +175,7 @@ export const AiSuggestionBox: FC<AiSuggestionBoxProps> = ({
|
|
|
175
175
|
<View style={{alignItems: "center", flexDirection: "row", gap: 4, width: "100%"}}>
|
|
176
176
|
<SparklesIcon fill={theme.text.secondaryDark} />
|
|
177
177
|
<View style={{flex: 1}}>
|
|
178
|
-
<Text color="secondaryDark" size="sm">
|
|
178
|
+
<Text color={isAdded ? "primary" : "secondaryDark"} size="sm">
|
|
179
179
|
{headingText}
|
|
180
180
|
</Text>
|
|
181
181
|
</View>
|
|
@@ -202,7 +202,7 @@ export const AiSuggestionBox: FC<AiSuggestionBoxProps> = ({
|
|
|
202
202
|
size="sm"
|
|
203
203
|
testID={testID ? `${testID}-hide` : undefined}
|
|
204
204
|
text="Hide"
|
|
205
|
-
variant="
|
|
205
|
+
variant="outline"
|
|
206
206
|
/>
|
|
207
207
|
{Boolean(onAdd) && (
|
|
208
208
|
<Button
|
package/src/Banner.tsx
CHANGED
|
@@ -74,7 +74,7 @@ export const BannerButton = ({
|
|
|
74
74
|
<Icon iconName={buttonIconName as IconName} type="solid" />
|
|
75
75
|
</View>
|
|
76
76
|
)}
|
|
77
|
-
<NativeText style={{fontSize: 12}}>{buttonText}</NativeText>
|
|
77
|
+
<NativeText style={{color: theme.text.primary, fontSize: 12}}>{buttonText}</NativeText>
|
|
78
78
|
</View>
|
|
79
79
|
{Boolean(loading) && (
|
|
80
80
|
<Box marginLeft={2}>
|
package/src/Box.test.tsx
CHANGED
|
@@ -585,6 +585,86 @@ describe("Box", () => {
|
|
|
585
585
|
});
|
|
586
586
|
});
|
|
587
587
|
|
|
588
|
+
describe("accessibility state", () => {
|
|
589
|
+
it("forwards checked and disabled to a clickable Box", () => {
|
|
590
|
+
const {getByTestId} = renderWithTheme(
|
|
591
|
+
<Box
|
|
592
|
+
accessibilityHint="Toggles the item"
|
|
593
|
+
accessibilityLabel="Preheat the oven"
|
|
594
|
+
accessibilityRole="checkbox"
|
|
595
|
+
accessibilityState={{checked: true, disabled: false}}
|
|
596
|
+
onClick={() => {}}
|
|
597
|
+
testID="row"
|
|
598
|
+
/>
|
|
599
|
+
);
|
|
600
|
+
const pressable = getByTestId("row-clickable");
|
|
601
|
+
expect(pressable.props.accessibilityState).toEqual({checked: true, disabled: false});
|
|
602
|
+
expect(pressable.props["aria-checked"]).toBe(true);
|
|
603
|
+
expect(pressable.props["aria-disabled"]).toBe(false);
|
|
604
|
+
expect(pressable.props.accessibilityRole).toBe("checkbox");
|
|
605
|
+
expect(pressable.props.style.accessibilityState).toBeUndefined();
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
it("keeps a disabled clickable Box labelled but does not call onClick", async () => {
|
|
609
|
+
const onClick = mock(() => {});
|
|
610
|
+
const {getByTestId} = renderWithTheme(
|
|
611
|
+
<Box
|
|
612
|
+
accessibilityHint="Toggles the item"
|
|
613
|
+
accessibilityLabel="Preheat the oven"
|
|
614
|
+
accessibilityRole="checkbox"
|
|
615
|
+
accessibilityState={{checked: false, disabled: true}}
|
|
616
|
+
onClick={onClick}
|
|
617
|
+
testID="row"
|
|
618
|
+
/>
|
|
619
|
+
);
|
|
620
|
+
const pressable = getByTestId("row-clickable");
|
|
621
|
+
expect(pressable.props["aria-label"]).toBe("Preheat the oven");
|
|
622
|
+
expect(pressable.props.accessibilityState.disabled).toBe(true);
|
|
623
|
+
await act(async () => {
|
|
624
|
+
fireEvent.press(pressable);
|
|
625
|
+
});
|
|
626
|
+
expect(onClick).not.toHaveBeenCalled();
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
it("forwards checked to a Box without onClick", () => {
|
|
630
|
+
const {getByTestId} = renderWithTheme(
|
|
631
|
+
<Box accessibilityState={{checked: false}} testID="plain" />
|
|
632
|
+
);
|
|
633
|
+
const view = getByTestId("plain");
|
|
634
|
+
expect(view.props.accessibilityState).toEqual({checked: false});
|
|
635
|
+
expect(view.props["aria-checked"]).toBe(false);
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
it("makes a Box a polite live region without putting it in the style", () => {
|
|
639
|
+
const {getByTestId} = renderWithTheme(
|
|
640
|
+
<Box accessibilityLiveRegion="polite" testID="status" />
|
|
641
|
+
);
|
|
642
|
+
const view = getByTestId("status");
|
|
643
|
+
expect(view.props["aria-live"]).toBe("polite");
|
|
644
|
+
expect(view.props.style.accessibilityLiveRegion).toBeUndefined();
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
it("toggles a checkbox Box with Space on web", async () => {
|
|
648
|
+
const onClick = mock(() => {});
|
|
649
|
+
const preventDefault = mock(() => {});
|
|
650
|
+
const {getByTestId} = renderWithTheme(
|
|
651
|
+
<Box
|
|
652
|
+
accessibilityHint="Toggles the item"
|
|
653
|
+
accessibilityLabel="Preheat the oven"
|
|
654
|
+
accessibilityRole="checkbox"
|
|
655
|
+
onClick={onClick}
|
|
656
|
+
testID="row"
|
|
657
|
+
/>
|
|
658
|
+
);
|
|
659
|
+
await act(async () => {
|
|
660
|
+
getByTestId("row-clickable").props.onKeyDown({key: " ", preventDefault});
|
|
661
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
662
|
+
});
|
|
663
|
+
expect(onClick).toHaveBeenCalledTimes(1);
|
|
664
|
+
expect(preventDefault).toHaveBeenCalledTimes(1);
|
|
665
|
+
});
|
|
666
|
+
});
|
|
667
|
+
|
|
588
668
|
describe("scroll behavior", () => {
|
|
589
669
|
it("should render ScrollView when scroll is enabled", () => {
|
|
590
670
|
const {root} = renderWithTheme(<Box scroll />);
|
package/src/Box.tsx
CHANGED
|
@@ -60,6 +60,18 @@ const ALIGN_SELF = {
|
|
|
60
60
|
|
|
61
61
|
const BORDER_WIDTH = 1;
|
|
62
62
|
|
|
63
|
+
// react-native's Pressable does not type the web `onKeyDown` event, but React Native Web
|
|
64
|
+
// forwards it.
|
|
65
|
+
interface WebKeyDownEvent {
|
|
66
|
+
key: string;
|
|
67
|
+
preventDefault: () => void;
|
|
68
|
+
repeat?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface WebKeyDownProps {
|
|
72
|
+
onKeyDown?: (event: WebKeyDownEvent) => void;
|
|
73
|
+
}
|
|
74
|
+
|
|
63
75
|
const isValidPercentage = (value: string): boolean => {
|
|
64
76
|
return /^\d+(\.\d+)?%$/.test(value);
|
|
65
77
|
};
|
|
@@ -78,7 +90,9 @@ const isValidWidthHeight = (value: number | string): boolean => {
|
|
|
78
90
|
const NON_STYLE_BOX_PROPS = new Set<string>([
|
|
79
91
|
"accessibilityHint",
|
|
80
92
|
"accessibilityLabel",
|
|
93
|
+
"accessibilityLiveRegion",
|
|
81
94
|
"accessibilityRole",
|
|
95
|
+
"accessibilityState",
|
|
82
96
|
"avoidKeyboard",
|
|
83
97
|
"children",
|
|
84
98
|
"dangerouslySetInlineStyle",
|
|
@@ -392,24 +406,60 @@ const BoxComponent = React.forwardRef((props: BoxProps, ref) => {
|
|
|
392
406
|
|
|
393
407
|
let box: React.ReactElement;
|
|
394
408
|
|
|
409
|
+
const accessibilityState = props.accessibilityState;
|
|
410
|
+
const accessibilityStateProps = accessibilityState
|
|
411
|
+
? {
|
|
412
|
+
accessibilityState,
|
|
413
|
+
...(accessibilityState.checked !== undefined
|
|
414
|
+
? {"aria-checked": accessibilityState.checked}
|
|
415
|
+
: {}),
|
|
416
|
+
...(accessibilityState.disabled !== undefined
|
|
417
|
+
? {"aria-disabled": accessibilityState.disabled}
|
|
418
|
+
: {}),
|
|
419
|
+
}
|
|
420
|
+
: {};
|
|
421
|
+
|
|
395
422
|
// Adding the accessibilityRole of button throws a warning in React Native since we nest buttons
|
|
396
423
|
// within Box and RN does not support nested buttons — so this stays on `aria-role` (which RN
|
|
397
424
|
// itself translates to accessibilityRole under the hood) by default; an explicit
|
|
398
425
|
// `accessibilityRole` prop is only forwarded literally when the caller opts in.
|
|
399
426
|
if (props.onClick) {
|
|
400
427
|
const explicitAccessibilityRole = (props as AccessibilityProps).accessibilityRole;
|
|
428
|
+
const isDisabled = accessibilityState?.disabled === true;
|
|
429
|
+
// Per ARIA, Space toggles a checkbox or switch; react-native-web only maps Space to buttons.
|
|
430
|
+
const toggleKeyDownProps: WebKeyDownProps =
|
|
431
|
+
explicitAccessibilityRole === "checkbox" || explicitAccessibilityRole === "switch"
|
|
432
|
+
? {
|
|
433
|
+
onKeyDown: (event) => {
|
|
434
|
+
if (event.key !== " " && event.key !== "Spacebar") {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
event.preventDefault();
|
|
438
|
+
if (isDisabled || event.repeat) {
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
void props.onClick?.();
|
|
442
|
+
},
|
|
443
|
+
}
|
|
444
|
+
: {};
|
|
401
445
|
box = (
|
|
402
446
|
<Pressable
|
|
447
|
+
{...toggleKeyDownProps}
|
|
403
448
|
accessibilityHint={(props as AccessibilityProps).accessibilityHint}
|
|
404
449
|
{...(explicitAccessibilityRole
|
|
405
450
|
? {accessibilityRole: explicitAccessibilityRole as never}
|
|
406
451
|
: {})}
|
|
452
|
+
{...accessibilityStateProps}
|
|
407
453
|
aria-label={(props as AccessibilityProps).accessibilityLabel}
|
|
408
454
|
aria-role="button"
|
|
455
|
+
{...(isDisabled ? {disabled: true} : {})}
|
|
409
456
|
onLayout={props.onLayout}
|
|
410
457
|
onPointerEnter={onHoverIn}
|
|
411
458
|
onPointerLeave={onHoverOut}
|
|
412
459
|
onPress={async () => {
|
|
460
|
+
if (isDisabled) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
413
463
|
await Unifier.utils.haptic();
|
|
414
464
|
await props.onClick?.();
|
|
415
465
|
}}
|
|
@@ -426,6 +476,8 @@ const BoxComponent = React.forwardRef((props: BoxProps, ref) => {
|
|
|
426
476
|
<View
|
|
427
477
|
{...(accessibilityHint ? {accessibilityHint} : {})}
|
|
428
478
|
{...(accessibilityLabel ? {accessibilityLabel} : {})}
|
|
479
|
+
{...(props.accessibilityLiveRegion ? {"aria-live": props.accessibilityLiveRegion} : {})}
|
|
480
|
+
{...accessibilityStateProps}
|
|
429
481
|
{...(props.onLayout ? {onLayout: props.onLayout} : {})}
|
|
430
482
|
onPointerEnter={onHoverIn}
|
|
431
483
|
onPointerLeave={onHoverOut}
|
package/src/Button.test.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {describe, expect, it, mock, spyOn} from "bun:test";
|
|
2
2
|
import {act, fireEvent, render, waitFor} from "@testing-library/react-native";
|
|
3
3
|
import {assert} from "chai";
|
|
4
|
+
import {type FC, type ReactNode, useEffect} from "react";
|
|
4
5
|
import type {ReactTestInstance} from "react-test-renderer";
|
|
5
6
|
|
|
6
7
|
import {Button} from "./Button";
|
|
@@ -136,6 +137,43 @@ describe("Button", () => {
|
|
|
136
137
|
expect(toJSON()).toMatchSnapshot();
|
|
137
138
|
});
|
|
138
139
|
|
|
140
|
+
it("uses accessible Figma text colors for primary buttons in both modes", () => {
|
|
141
|
+
const light = renderWithTheme(
|
|
142
|
+
<Button onClick={() => {}} text="Light primary" variant="primary" />
|
|
143
|
+
);
|
|
144
|
+
const dark = render(
|
|
145
|
+
<ThemeModule.ThemeProvider colorScheme="dark">
|
|
146
|
+
<Button onClick={() => {}} text="Dark primary" variant="primary" />
|
|
147
|
+
</ThemeModule.ThemeProvider>
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
assert.equal(light.getByText("Light primary").props.style.color, "#092E3A");
|
|
151
|
+
assert.equal(dark.getByText("Dark primary").props.style.color, "#353535");
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("keeps primary text readable when dark tokens are applied in light colorScheme", async () => {
|
|
155
|
+
const DarkTokens: FC<{children: ReactNode}> = ({children}) => {
|
|
156
|
+
const {setTheme} = ThemeModule.useTheme();
|
|
157
|
+
// Apply darkThemeConfig without changing colorScheme, the theme-story path.
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
setTheme(ThemeModule.darkThemeConfig);
|
|
160
|
+
}, [setTheme]);
|
|
161
|
+
return children;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const {getByText} = render(
|
|
165
|
+
<ThemeModule.ThemeProvider>
|
|
166
|
+
<DarkTokens>
|
|
167
|
+
<Button onClick={() => {}} text="Dark tokens" variant="primary" />
|
|
168
|
+
</DarkTokens>
|
|
169
|
+
</ThemeModule.ThemeProvider>
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
await waitFor(() => {
|
|
173
|
+
assert.equal(getByText("Dark tokens").props.style.color, "#353535");
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
139
177
|
it("renders secondary variant", () => {
|
|
140
178
|
const {toJSON} = renderWithTheme(
|
|
141
179
|
<Button onClick={() => {}} text="Secondary" variant="secondary" />
|
|
@@ -234,7 +272,7 @@ describe("Button", () => {
|
|
|
234
272
|
/>
|
|
235
273
|
);
|
|
236
274
|
|
|
237
|
-
expect(getByTestId("disabled-active")).toHaveStyle({backgroundColor: "#
|
|
275
|
+
expect(getByTestId("disabled-active")).toHaveStyle({backgroundColor: "#949494"});
|
|
238
276
|
});
|
|
239
277
|
|
|
240
278
|
it("defaults to scale press animation", () => {
|
package/src/Button.tsx
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
|
|
21
21
|
import {Box} from "./Box";
|
|
22
22
|
import type {ButtonPressAnimation, ButtonProps} from "./Common";
|
|
23
|
+
import {contrastRatio, WCAG_NORMAL_TEXT_CONTRAST} from "./colorContrast";
|
|
23
24
|
import {useCustomIcon} from "./IconRegistry";
|
|
24
25
|
import {isNarrowViewport} from "./MediaQuery";
|
|
25
26
|
import {useTheme} from "./Theme";
|
|
@@ -115,7 +116,15 @@ const ButtonVisual: React.FC<ButtonVisualProps> = ({
|
|
|
115
116
|
let bgColor = theme.surface.primary;
|
|
116
117
|
let bColor: string | undefined;
|
|
117
118
|
let bWidth: number | undefined;
|
|
119
|
+
// secondaryDark is the light-mode on-primary label. Dark tokens make that
|
|
120
|
+
// role too light for the primary fill, so fall back to inverted.
|
|
118
121
|
let textColor = theme.text.inverted;
|
|
122
|
+
if (
|
|
123
|
+
variant === "primary" &&
|
|
124
|
+
contrastRatio(theme.text.secondaryDark, theme.surface.primary) >= WCAG_NORMAL_TEXT_CONTRAST
|
|
125
|
+
) {
|
|
126
|
+
textColor = theme.text.secondaryDark;
|
|
127
|
+
}
|
|
119
128
|
|
|
120
129
|
if (disabled) {
|
|
121
130
|
bgColor = theme.surface.disabled;
|
package/src/Common.ts
CHANGED
|
@@ -167,14 +167,17 @@ export interface ThemePrimitiveColors {
|
|
|
167
167
|
accent900: string;
|
|
168
168
|
|
|
169
169
|
error000: string;
|
|
170
|
+
error050: string;
|
|
170
171
|
error100: string;
|
|
171
172
|
error200: string;
|
|
172
173
|
|
|
173
174
|
warning000: string;
|
|
175
|
+
warning050: string;
|
|
174
176
|
warning100: string;
|
|
175
177
|
warning200: string;
|
|
176
178
|
|
|
177
179
|
success000: string;
|
|
180
|
+
success050: string;
|
|
178
181
|
success100: string;
|
|
179
182
|
success200: string;
|
|
180
183
|
}
|
|
@@ -223,6 +226,7 @@ export interface TextThemeConfig {
|
|
|
223
226
|
export interface SurfaceThemeConfig {
|
|
224
227
|
base: keyof ThemePrimitiveColors;
|
|
225
228
|
baseAlternate: keyof ThemePrimitiveColors;
|
|
229
|
+
ai: keyof ThemePrimitiveColors;
|
|
226
230
|
baseHover: keyof ThemePrimitiveColors;
|
|
227
231
|
primary: keyof ThemePrimitiveColors;
|
|
228
232
|
secondaryExtraLight: keyof ThemePrimitiveColors;
|
|
@@ -230,6 +234,7 @@ export interface SurfaceThemeConfig {
|
|
|
230
234
|
secondaryDark: keyof ThemePrimitiveColors;
|
|
231
235
|
secondaryExtraDark: keyof ThemePrimitiveColors;
|
|
232
236
|
neutral: keyof ThemePrimitiveColors;
|
|
237
|
+
neutralExtraLight: keyof ThemePrimitiveColors;
|
|
233
238
|
neutralLight: keyof ThemePrimitiveColors;
|
|
234
239
|
neutralDark: keyof ThemePrimitiveColors;
|
|
235
240
|
disabled: keyof ThemePrimitiveColors;
|
|
@@ -246,6 +251,7 @@ export interface BorderThemeConfig {
|
|
|
246
251
|
dark: keyof ThemePrimitiveColors;
|
|
247
252
|
activeNeutral: keyof ThemePrimitiveColors;
|
|
248
253
|
activeAccent: keyof ThemePrimitiveColors;
|
|
254
|
+
ai: keyof ThemePrimitiveColors;
|
|
249
255
|
hover: keyof ThemePrimitiveColors;
|
|
250
256
|
focus: keyof ThemePrimitiveColors;
|
|
251
257
|
error: keyof ThemePrimitiveColors;
|
|
@@ -294,6 +300,7 @@ export interface TextTheme {
|
|
|
294
300
|
export interface SurfaceTheme {
|
|
295
301
|
base: string;
|
|
296
302
|
baseAlternate: string;
|
|
303
|
+
ai: string;
|
|
297
304
|
baseHover: string;
|
|
298
305
|
primary: string;
|
|
299
306
|
secondaryExtraLight: string;
|
|
@@ -301,6 +308,7 @@ export interface SurfaceTheme {
|
|
|
301
308
|
secondaryDark: string;
|
|
302
309
|
secondaryExtraDark: string;
|
|
303
310
|
neutral: string;
|
|
311
|
+
neutralExtraLight: string;
|
|
304
312
|
neutralLight: string;
|
|
305
313
|
neutralDark: string;
|
|
306
314
|
disabled: string;
|
|
@@ -317,6 +325,7 @@ export interface BorderTheme {
|
|
|
317
325
|
dark: string;
|
|
318
326
|
activeNeutral: string;
|
|
319
327
|
activeAccent: string;
|
|
328
|
+
ai: string;
|
|
320
329
|
hover: string;
|
|
321
330
|
focus: string;
|
|
322
331
|
error: string;
|
|
@@ -674,7 +683,24 @@ export interface AccessibilityProps {
|
|
|
674
683
|
accessibilityRole?: string;
|
|
675
684
|
}
|
|
676
685
|
|
|
686
|
+
/** Checked and disabled state a `Box` reports to screen readers. */
|
|
687
|
+
export interface BoxAccessibilityState {
|
|
688
|
+
checked?: boolean;
|
|
689
|
+
disabled?: boolean;
|
|
690
|
+
}
|
|
691
|
+
|
|
677
692
|
export interface BoxPropsBase extends WithTestID {
|
|
693
|
+
/**
|
|
694
|
+
* Checked and disabled state for screen readers, sent as `accessibilityState` and as
|
|
695
|
+
* `aria-checked` / `aria-disabled`. On a clickable Box, `disabled: true` also stops presses.
|
|
696
|
+
*/
|
|
697
|
+
accessibilityState?: BoxAccessibilityState;
|
|
698
|
+
/**
|
|
699
|
+
* Makes a non-clickable Box a live region, sent as `aria-live`: screen readers announce
|
|
700
|
+
* changes to its contents (`polite` waits for a pause). It works on web and Android;
|
|
701
|
+
* VoiceOver on iOS does not announce React Native live regions.
|
|
702
|
+
*/
|
|
703
|
+
accessibilityLiveRegion?: "polite" | "assertive";
|
|
678
704
|
alignContent?: AlignContent;
|
|
679
705
|
alignItems?: AlignItems;
|
|
680
706
|
alignSelf?: AlignSelf;
|
|
@@ -918,7 +944,8 @@ export interface SegmentedControlBadgeConfig {
|
|
|
918
944
|
export interface SegmentedControlProps extends WithTestID {
|
|
919
945
|
testIDs?: SegmentedControlTestIDs;
|
|
920
946
|
items: string[];
|
|
921
|
-
|
|
947
|
+
/** `sm` is 28px and hugs its labels. `md` (default, 36px) and `lg` (44px) stretch. */
|
|
948
|
+
size?: "sm" | "md" | "lg";
|
|
922
949
|
onChange: (activeIndex: number) => void;
|
|
923
950
|
selectedIndex?: number;
|
|
924
951
|
maxItems?: number;
|
|
@@ -1282,8 +1309,9 @@ export interface SplitPageProps<TItem extends SplitPageListItem = SplitPageListI
|
|
|
1282
1309
|
narrowViewportListButtonLabel?: string;
|
|
1283
1310
|
/**
|
|
1284
1311
|
* Web only. The native SplitPage ignores this prop.
|
|
1285
|
-
* Border radius applied to each detail child
|
|
1286
|
-
*
|
|
1312
|
+
* Border radius applied to each desktop detail child pane. The list column is excluded.
|
|
1313
|
+
* The pane clips to this radius; the column ScrollView inside it does not, so the column
|
|
1314
|
+
* still scrolls. Uses the same rounding scale as `Box` (`md` is 4px). Defaults to `md`.
|
|
1287
1315
|
*/
|
|
1288
1316
|
childColumnRounding?: Rounding;
|
|
1289
1317
|
}
|
|
@@ -2022,7 +2050,10 @@ export interface BlocksViewProps extends WithTestID {
|
|
|
2022
2050
|
hostActions?: readonly string[];
|
|
2023
2051
|
/** Hostnames allowed on https image sources. Empty rejects every https image. */
|
|
2024
2052
|
imageHosts?: readonly string[];
|
|
2025
|
-
/**
|
|
2053
|
+
/**
|
|
2054
|
+
* Called for reply, open, select, and callback. Select also updates the target chart locally.
|
|
2055
|
+
* A copy button writes the clipboard itself and never calls this.
|
|
2056
|
+
*/
|
|
2026
2057
|
onAction?: (event: {action: BlockAction; blockId: string; elementId: string}) => void;
|
|
2027
2058
|
/** Block ids replaced in place. The key is the original block id. */
|
|
2028
2059
|
overrides?: Record<string, Block>;
|