@terreno/ui 57.10.1 → 57.12.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 +1 @@
1
- {"version":3,"file":"TableHeaderCell.js","sourceRoot":"","sources":["../../src/table/TableHeaderCell.tsx"],"names":[],"mappings":";AAAA,sBAAsB;AACtB,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAoB,WAAW,EAAC,MAAM,OAAO,CAAC;AAErD,OAAO,EAAC,GAAG,EAAC,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAC;AAClC,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,KAAK,GAAG,MAAM,EACd,KAAK,EACL,YAAY,GACS,EAAgB,EAAE;IACvC,MAAM,EAAC,KAAK,EAAC,GAAG,QAAQ,EAAE,CAAC;IAE3B,MAAM,EAAC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAC,GAAG,eAAe,EAAE,CAAC;IAC/D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,CAAC,+BAA+B,KAAK,qBAAqB,CAAC,CAAC;IAC1E,CAAC;IACD,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;IACjG,CAAC;IACD,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,IAAI,GAAG,UAAU,EA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
28
  "@shopify/react-native-skia": "2.6.5",
29
- "@terreno/blocks": "57.10.1",
29
+ "@terreno/blocks": "57.12.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.10.1",
166
+ "version": "57.12.0",
167
167
  "bugs": {
168
168
  "url": "https://github.com/TerrenoLabs/terreno/issues"
169
169
  },
@@ -194,6 +194,35 @@ describe("Button", () => {
194
194
  expect(getByTestId("outline-active").props.style.borderWidth).toBeUndefined();
195
195
  });
196
196
 
197
+ for (const size of ["default", "sm"] as const) {
198
+ it(`renders ${size} outline button with the same outer box as solid buttons`, () => {
199
+ const {getByTestId} = renderWithTheme(
200
+ <>
201
+ <Button onClick={() => {}} size={size} testID="solid" text="Solid" />
202
+ <Button
203
+ onClick={() => {}}
204
+ size={size}
205
+ testID="outline"
206
+ text="Outline"
207
+ variant="outline"
208
+ />
209
+ </>
210
+ );
211
+ const outerBox = (style: Record<string, number | undefined>): Record<string, number> => {
212
+ const border = style.borderWidth ?? 0;
213
+ return {
214
+ height: style.height ?? 0,
215
+ horizontal: (style.paddingHorizontal ?? 0) + border,
216
+ vertical: style.height === undefined ? (style.paddingVertical ?? 0) + border : 0,
217
+ };
218
+ };
219
+
220
+ expect(outerBox(getByTestId("outline").props.style)).toEqual(
221
+ outerBox(getByTestId("solid").props.style)
222
+ );
223
+ });
224
+ }
225
+
197
226
  it("keeps disabled styling when state is active", () => {
198
227
  const {getByTestId} = renderWithTheme(
199
228
  <Button
package/src/Button.tsx CHANGED
@@ -201,7 +201,7 @@ const ButtonVisual: React.FC<ButtonVisualProps> = ({
201
201
  flexDirection: "column",
202
202
  height: size === "sm" ? 28 : undefined,
203
203
  justifyContent: "center",
204
- paddingHorizontal: size === "sm" ? 16 : 20,
204
+ paddingHorizontal: (size === "sm" ? 16 : 20) - (borderWidth ?? 0),
205
205
  paddingVertical: size === "sm" ? 0 : 8 - (borderWidth ?? 0),
206
206
  width: fullWidth ? "100%" : "auto",
207
207
  ...wrapBoxStyle,
package/src/Common.ts CHANGED
@@ -1280,6 +1280,13 @@ export interface SplitPageProps<TItem extends SplitPageListItem = SplitPageListI
1280
1280
  * When omitted, that button is not rendered.
1281
1281
  */
1282
1282
  narrowViewportListButtonLabel?: string;
1283
+ /**
1284
+ * Web only. The native SplitPage ignores this prop.
1285
+ * Border radius applied to each desktop detail child pane. The list column is excluded.
1286
+ * The pane clips to this radius; the column ScrollView inside it does not, so the column
1287
+ * still scrolls. Uses the same rounding scale as `Box` (`md` is 4px). Defaults to `md`.
1288
+ */
1289
+ childColumnRounding?: Rounding;
1283
1290
  }
1284
1291
 
1285
1292
  export type PermissionKind =
package/src/DataTable.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import {FontAwesome6} from "@expo/vector-icons";
1
+ import FontAwesome6 from "@expo/vector-icons/FontAwesome6";
2
2
  import type React from "react";
3
3
  import {
4
4
  type FC,
@@ -1,4 +1,4 @@
1
- import {FontAwesome6} from "@expo/vector-icons";
1
+ import FontAwesome6 from "@expo/vector-icons/FontAwesome6";
2
2
  import {Picker} from "@react-native-picker/picker";
3
3
  import {getCalendars} from "expo-localization";
4
4
  import range from "lodash/range";
@@ -1,4 +1,4 @@
1
- import {FontAwesome6} from "@expo/vector-icons";
1
+ import FontAwesome6 from "@expo/vector-icons/FontAwesome6";
2
2
  import {DateTime} from "luxon";
3
3
  import React, {type FC, useCallback, useEffect, useMemo, useRef, useState} from "react";
4
4
  import {Pressable, TextInput, View} from "react-native";
@@ -1,9 +1,10 @@
1
1
  import {afterAll, afterEach, beforeEach, describe, expect, it, mock, spyOn} from "bun:test";
2
2
  import {act, fireEvent} from "@testing-library/react-native";
3
- import {forwardRef, type ReactNode, type Ref, useImperativeHandle} from "react";
4
- import {type ScaledSize, StyleSheet, useWindowDimensions, View} from "react-native";
3
+ import {forwardRef, type ReactElement, type ReactNode, type Ref, useImperativeHandle} from "react";
4
+ import {type ScaledSize, ScrollView, StyleSheet, useWindowDimensions, View} from "react-native";
5
5
  import type {ReactTestInstance} from "react-test-renderer";
6
6
 
7
+ import {getRounding, getSpacing} from "./Common";
7
8
  import {SplitPage} from "./SplitPage";
8
9
  import {renderWithTheme} from "./test-utils";
9
10
 
@@ -19,11 +20,15 @@ const swiperScrollToIndex = mock((_options?: PagerScrollOptions) => {});
19
20
  mock.module("react-native-swiper-flatlist", () => ({
20
21
  SwiperFlatList: forwardRef(
21
22
  (
22
- {children}: {children?: ReactNode},
23
+ {children, style}: {children?: ReactNode; style?: object},
23
24
  ref: Ref<{scrollToIndex: (options: PagerScrollOptions) => void}>
24
25
  ) => {
25
26
  useImperativeHandle(ref, () => ({scrollToIndex: swiperScrollToIndex}));
26
- return <View testID="swiper-flatlist">{children}</View>;
27
+ return (
28
+ <View style={style} testID="swiper-flatlist">
29
+ {children}
30
+ </View>
31
+ );
27
32
  }
28
33
  ),
29
34
  }));
@@ -50,6 +55,12 @@ const setWindowWidth = (width: number): (() => void) => {
50
55
 
51
56
  const styleWidth = (style: unknown): unknown => StyleSheet.flatten(style)?.width;
52
57
 
58
+ const styleBorderRadius = (style: unknown): unknown => StyleSheet.flatten(style)?.borderRadius;
59
+
60
+ const flattenedStyle = (style: unknown): ReturnType<typeof StyleSheet.flatten> => {
61
+ return StyleSheet.flatten(style) ?? {};
62
+ };
63
+
53
64
  const setDesktop = () => {
54
65
  mock.module("./MediaQuery", () => ({
55
66
  isNarrowViewport: () => false,
@@ -1018,5 +1029,517 @@ describe("SplitPage", () => {
1018
1029
  expect(paginated.length).toBeGreaterThan(0);
1019
1030
  warnSpy.mockRestore();
1020
1031
  });
1032
+
1033
+ it("applies the default md border radius to desktop child columns but not the list column", () => {
1034
+ setDesktop();
1035
+ const {getByTestId, UNSAFE_root} = renderWithTheme(
1036
+ <SplitPage {...defaultProps} desktopChildrenMinWidth={200}>
1037
+ <View testID="child-1" />
1038
+ <View testID="child-2" />
1039
+ </SplitPage>
1040
+ );
1041
+ expect(styleBorderRadius(getByTestId("split-page-desktop-child-0").props.style)).toBe(
1042
+ getRounding("md")
1043
+ );
1044
+ expect(styleBorderRadius(getByTestId("split-page-desktop-child-1").props.style)).toBe(
1045
+ getRounding("md")
1046
+ );
1047
+ const listColumn = UNSAFE_root.findAll(
1048
+ (node: ReactTestInstance) =>
1049
+ styleWidth(node.props?.style) === 300 && node.props?.style?.maxWidth === 300
1050
+ )[0];
1051
+ expect(listColumn).toBeTruthy();
1052
+ expect(styleBorderRadius(listColumn?.props?.style)).toBeUndefined();
1053
+ });
1054
+
1055
+ it("allows childColumnRounding to override the desktop child column border radius", () => {
1056
+ setDesktop();
1057
+ const {getByTestId} = renderWithTheme(
1058
+ <SplitPage {...defaultProps} childColumnRounding="lg" desktopChildrenMinWidth={200}>
1059
+ <View testID="child-1" />
1060
+ <View testID="child-2" />
1061
+ </SplitPage>
1062
+ );
1063
+ expect(styleBorderRadius(getByTestId("split-page-desktop-child-0").props.style)).toBe(
1064
+ getRounding("lg")
1065
+ );
1066
+ });
1067
+
1068
+ it("applies child column border radius on the labeled narrow pager child containers", async () => {
1069
+ setMobile();
1070
+ const {getAllByLabelText, getByTestId} = renderWithTheme(
1071
+ <SplitPage {...defaultProps} narrowViewportChildLabels={["Summary", "Notes"]}>
1072
+ <View testID="child-1" />
1073
+ <View testID="child-2" />
1074
+ </SplitPage>
1075
+ );
1076
+ await selectFirst(getAllByLabelText);
1077
+ expect(styleBorderRadius(getByTestId("split-page-mobile-child-0").props.style)).toBe(
1078
+ getRounding("md")
1079
+ );
1080
+ expect(styleBorderRadius(getByTestId("split-page-mobile-child-1").props.style)).toBe(
1081
+ getRounding("md")
1082
+ );
1083
+ });
1084
+ });
1085
+
1086
+ describe("desktop child column scrolling", () => {
1087
+ const tallChild = (testID: string): ReactElement => {
1088
+ return <View style={{height: 4000}} testID={testID} />;
1089
+ };
1090
+
1091
+ const renderFullHeightChild = (): ReactElement => {
1092
+ return (
1093
+ <View style={{height: "100%"}} testID="bounded-child">
1094
+ <View style={{height: 48}} testID="fixed-section" />
1095
+ <ScrollView testID="internal-scroll">
1096
+ <View style={{height: 4000}} testID="internal-tall" />
1097
+ </ScrollView>
1098
+ </View>
1099
+ );
1100
+ };
1101
+
1102
+ const expectClippingPane = (
1103
+ pane: ReactTestInstance,
1104
+ borderRadius: number,
1105
+ width: number | string
1106
+ ): void => {
1107
+ const style = flattenedStyle(pane.props.style);
1108
+ expect(style.borderRadius).toBe(borderRadius);
1109
+ expect(style.height).toBe("100%");
1110
+ expect(style.overflow).toBe("hidden");
1111
+ expect(style.width).toBe(width);
1112
+ };
1113
+
1114
+ const expectVerticalChildScroll = (scroll: ReactTestInstance, tallTestID: string): void => {
1115
+ const style = flattenedStyle(scroll.props.style);
1116
+ expect(style.overflow).toBeUndefined();
1117
+ expect(style.flex).toBe(1);
1118
+ expect(style.height).toBe("100%");
1119
+ expect(scroll.props.horizontal).toBeFalsy();
1120
+ expect(scroll.props.contentContainerStyle).toEqual({flex: 1});
1121
+ expect(scroll.findByProps({testID: tallTestID})).toBeTruthy();
1122
+ };
1123
+
1124
+ const expectBoundedFullHeightChild = (scroll: ReactTestInstance): void => {
1125
+ const child = scroll.findByProps({testID: "bounded-child"});
1126
+ const childStyle = flattenedStyle(child.props.style);
1127
+ expect(childStyle.height).toBe("100%");
1128
+ expect(childStyle.position).toBeUndefined();
1129
+ expect(scroll.props.contentContainerStyle).toEqual({flex: 1});
1130
+ expect(child.findByProps({testID: "fixed-section"})).toBeTruthy();
1131
+ expect(child.findByProps({testID: "internal-scroll"})).toBeTruthy();
1132
+ expect(child.findByProps({testID: "internal-tall"})).toBeTruthy();
1133
+ };
1134
+
1135
+ it("scrolls ordinary tall content in desktopChildrenMinWidth columns and keeps the pane clipped", () => {
1136
+ setDesktop();
1137
+ const {getByTestId} = renderWithTheme(
1138
+ <SplitPage {...defaultProps} desktopChildrenMinWidth={200}>
1139
+ {tallChild("tall-0")}
1140
+ {tallChild("tall-1")}
1141
+ </SplitPage>
1142
+ );
1143
+
1144
+ expectClippingPane(getByTestId("split-page-desktop-child-0"), getRounding("md"), 200);
1145
+ expectClippingPane(getByTestId("split-page-desktop-child-1"), getRounding("md"), 200);
1146
+ expectVerticalChildScroll(getByTestId("split-page-desktop-child-scroll-0"), "tall-0");
1147
+ expectVerticalChildScroll(getByTestId("split-page-desktop-child-scroll-1"), "tall-1");
1148
+ expect(
1149
+ flattenedStyle(getByTestId("split-page-desktop-children-scroll").props.style).overflow
1150
+ ).toBeUndefined();
1151
+ });
1152
+
1153
+ it("scrolls ordinary tall content in the default one and two child row", () => {
1154
+ setDesktop();
1155
+ const {getByTestId} = renderWithTheme(
1156
+ <SplitPage {...defaultProps}>
1157
+ {tallChild("tall-0")}
1158
+ {tallChild("tall-1")}
1159
+ </SplitPage>
1160
+ );
1161
+
1162
+ expectClippingPane(getByTestId("split-page-desktop-row-child-0"), getRounding("md"), "60%");
1163
+ expectClippingPane(getByTestId("split-page-desktop-row-child-1"), getRounding("md"), "60%");
1164
+ expect(flattenedStyle(getByTestId("split-page-desktop-row-child-0").props.style).flex).toBe(
1165
+ 1
1166
+ );
1167
+ expectVerticalChildScroll(getByTestId("split-page-desktop-child-scroll-0"), "tall-0");
1168
+ expectVerticalChildScroll(getByTestId("split-page-desktop-child-scroll-1"), "tall-1");
1169
+ });
1170
+
1171
+ it("scrolls ordinary tall content in the segmented layout", () => {
1172
+ setDesktop();
1173
+ const {getByTestId} = renderWithTheme(
1174
+ <SplitPage {...defaultProps} tabs={["One", "Two", "Three"]}>
1175
+ {tallChild("tall-0")}
1176
+ {tallChild("tall-1")}
1177
+ {tallChild("tall-2")}
1178
+ </SplitPage>
1179
+ );
1180
+
1181
+ expectClippingPane(
1182
+ getByTestId("split-page-desktop-segment-child-0"),
1183
+ getRounding("md"),
1184
+ "60%"
1185
+ );
1186
+ expectClippingPane(
1187
+ getByTestId("split-page-desktop-segment-child-1"),
1188
+ getRounding("md"),
1189
+ "60%"
1190
+ );
1191
+ expect(
1192
+ flattenedStyle(getByTestId("split-page-desktop-segment-child-0").props.style).paddingRight
1193
+ ).toBe(16);
1194
+ expect(
1195
+ flattenedStyle(getByTestId("split-page-desktop-segment-child-1").props.style).paddingLeft
1196
+ ).toBe(16);
1197
+ expectVerticalChildScroll(getByTestId("split-page-desktop-child-scroll-0"), "tall-0");
1198
+ expectVerticalChildScroll(getByTestId("split-page-desktop-child-scroll-1"), "tall-1");
1199
+ });
1200
+
1201
+ it("preserves a custom childColumnRounding on every desktop child layout", () => {
1202
+ setDesktop();
1203
+ const minWidth = renderWithTheme(
1204
+ <SplitPage {...defaultProps} childColumnRounding="lg" desktopChildrenMinWidth={220}>
1205
+ <View testID="child-1" />
1206
+ <View testID="child-2" />
1207
+ </SplitPage>
1208
+ );
1209
+ expect(
1210
+ styleBorderRadius(minWidth.getByTestId("split-page-desktop-child-0").props.style)
1211
+ ).toBe(getRounding("lg"));
1212
+
1213
+ const row = renderWithTheme(
1214
+ <SplitPage {...defaultProps} childColumnRounding="sm">
1215
+ <View testID="child-1" />
1216
+ </SplitPage>
1217
+ );
1218
+ expect(styleBorderRadius(row.getByTestId("split-page-desktop-row-child-0").props.style)).toBe(
1219
+ getRounding("sm")
1220
+ );
1221
+
1222
+ const segmented = renderWithTheme(
1223
+ <SplitPage {...defaultProps} childColumnRounding="xl" tabs={["One", "Two", "Three"]}>
1224
+ <View testID="child-1" />
1225
+ <View testID="child-2" />
1226
+ <View testID="child-3" />
1227
+ </SplitPage>
1228
+ );
1229
+ expect(
1230
+ styleBorderRadius(segmented.getByTestId("split-page-desktop-segment-child-0").props.style)
1231
+ ).toBe(getRounding("xl"));
1232
+ });
1233
+
1234
+ it("keeps a height 100% child bounded to the pane with its own scroll view", () => {
1235
+ setDesktop();
1236
+ const minWidth = renderWithTheme(
1237
+ <SplitPage {...defaultProps} desktopChildrenMinWidth={240}>
1238
+ {renderFullHeightChild()}
1239
+ <View testID="other-child" />
1240
+ </SplitPage>
1241
+ );
1242
+ const minWidthPane = minWidth.getByTestId("split-page-desktop-child-0");
1243
+ expect(flattenedStyle(minWidthPane.props.style).height).toBe("100%");
1244
+ expect(flattenedStyle(minWidthPane.props.style).overflow).toBe("hidden");
1245
+ expectBoundedFullHeightChild(minWidth.getByTestId("split-page-desktop-child-scroll-0"));
1246
+
1247
+ const row = renderWithTheme(
1248
+ <SplitPage {...defaultProps}>{renderFullHeightChild()}</SplitPage>
1249
+ );
1250
+ expectBoundedFullHeightChild(row.getByTestId("split-page-desktop-child-scroll-0"));
1251
+ expect(
1252
+ flattenedStyle(row.getByTestId("split-page-desktop-row-child-0").props.style).height
1253
+ ).toBe("100%");
1254
+
1255
+ const segmented = renderWithTheme(
1256
+ <SplitPage {...defaultProps} tabs={["One", "Two", "Three"]}>
1257
+ {renderFullHeightChild()}
1258
+ <View testID="child-2" />
1259
+ <View testID="child-3" />
1260
+ </SplitPage>
1261
+ );
1262
+ expectBoundedFullHeightChild(segmented.getByTestId("split-page-desktop-child-scroll-0"));
1263
+ expect(
1264
+ flattenedStyle(segmented.getByTestId("split-page-desktop-segment-child-0").props.style)
1265
+ .overflow
1266
+ ).toBe("hidden");
1267
+ });
1268
+ });
1269
+
1270
+ describe("narrow child column scrolling", () => {
1271
+ const renderFullHeightChild = (): ReactElement => {
1272
+ return (
1273
+ <View style={{height: "100%"}} testID="bounded-child">
1274
+ <View style={{height: 48}} testID="fixed-section" />
1275
+ <ScrollView testID="internal-scroll">
1276
+ <View style={{height: 4000}} testID="internal-tall" />
1277
+ </ScrollView>
1278
+ </View>
1279
+ );
1280
+ };
1281
+
1282
+ const selectFirst = async (
1283
+ getAllByLabelText: (label: string) => ReactTestInstance[]
1284
+ ): Promise<void> => {
1285
+ const boxes = getAllByLabelText("Select");
1286
+ await act(async () => {
1287
+ fireEvent.press(boxes[0]);
1288
+ });
1289
+ };
1290
+
1291
+ const layoutPager = (node: ReactTestInstance, height: number, width: number): void => {
1292
+ act(() => {
1293
+ node.props.onLayout({
1294
+ nativeEvent: {layout: {height, width, x: 0, y: 0}},
1295
+ });
1296
+ });
1297
+ };
1298
+
1299
+ const expectBoundedNarrowChild = (page: ReactTestInstance): void => {
1300
+ const child = page.findByProps({testID: "bounded-child"});
1301
+ const childStyle = flattenedStyle(child.props.style);
1302
+ expect(childStyle.height).toBe("100%");
1303
+ expect(childStyle.position).toBeUndefined();
1304
+ expect(page.findByProps({testID: "fixed-section"})).toBeTruthy();
1305
+ expect(page.findByProps({testID: "internal-scroll"})).toBeTruthy();
1306
+ expect(page.findByProps({testID: "internal-tall"})).toBeTruthy();
1307
+ };
1308
+
1309
+ it("bounds a labeled narrow page to the measured pane so a height 100% child can scroll inside it", async () => {
1310
+ setMobile();
1311
+ const {getAllByLabelText, getByTestId, UNSAFE_root} = renderWithTheme(
1312
+ <SplitPage
1313
+ {...defaultProps}
1314
+ bottomNavBarHeight={24}
1315
+ narrowViewportChildLabels={["Summary", "Notes"]}
1316
+ narrowViewportListButtonLabel="Back to list"
1317
+ >
1318
+ {renderFullHeightChild()}
1319
+ <View testID="other-child" />
1320
+ </SplitPage>
1321
+ );
1322
+ await selectFirst(getAllByLabelText);
1323
+ const pageBeforeLayout = getByTestId("split-page-mobile-child-0");
1324
+ expect(flattenedStyle(pageBeforeLayout.props.style).height).toBe("100%");
1325
+
1326
+ layoutPager(getByTestId("split-page-mobile-children"), 360, 320);
1327
+
1328
+ const page = getByTestId("split-page-mobile-child-0");
1329
+ const style = flattenedStyle(page.props.style);
1330
+ const edge = getSpacing(2);
1331
+ const navButton = 32;
1332
+ const bottomNav = 24;
1333
+ const columnHeight = 360 - (edge + edge + navButton + edge + bottomNav);
1334
+ expect(style.height).toBe(columnHeight);
1335
+ expect(style.overflow).toBe("hidden");
1336
+ expect(style.borderRadius).toBe(getRounding("md"));
1337
+ expect(style.paddingBottom).toBeUndefined();
1338
+ expect(style.width).toBe(320);
1339
+ expect(style.position).toBeUndefined();
1340
+ expectBoundedNarrowChild(page);
1341
+ expect(flattenedStyle(getByTestId("split-page-mobile-child-1").props.style).height).toBe(
1342
+ columnHeight
1343
+ );
1344
+ const swiper = flattenedStyle(getByTestId("swiper-flatlist").props.style);
1345
+ expect(swiper.height).toBe(columnHeight);
1346
+ expect(swiper.overflow).toBeUndefined();
1347
+ expect(flattenedStyle(getByTestId("split-page-column-top-space").props.style).height).toBe(
1348
+ edge
1349
+ );
1350
+
1351
+ const nav = getByTestId("split-page-column-nav");
1352
+ const navStyle = flattenedStyle(nav.props.style);
1353
+ expect(navStyle.position).toBeUndefined();
1354
+ expect(navStyle.flexDirection).toBe("row");
1355
+ expect(navStyle.justifyContent).toBe("space-between");
1356
+ expect(navStyle.height).toBe(navButton);
1357
+ expect(navStyle.marginTop).toBe(edge);
1358
+ expect(navStyle.paddingBottom).toBeUndefined();
1359
+ expect(navStyle.paddingHorizontal).toBe(getSpacing(4));
1360
+ expect(flattenedStyle(getByTestId("split-page-column-bottom-space").props.style).height).toBe(
1361
+ edge + bottomNav
1362
+ );
1363
+ expect(page.findAll((node) => node.props?.testID === "split-page-column-nav")).toHaveLength(
1364
+ 0
1365
+ );
1366
+
1367
+ const previousSlot = getByTestId("split-page-column-previous-slot");
1368
+ const nextSlot = getByTestId("split-page-column-next-slot");
1369
+ const slotStyle = {height: navButton, width: navButton};
1370
+ expect(flattenedStyle(previousSlot.props.style)).toMatchObject(slotStyle);
1371
+ expect(flattenedStyle(nextSlot.props.style)).toMatchObject(slotStyle);
1372
+ expect(previousSlot.props.accessible).toBe(false);
1373
+ expect(nextSlot.props.accessible).toBe(false);
1374
+ expect(queryIconButtonByTestId(UNSAFE_root, "split-page-column-previous")).toBeUndefined();
1375
+ expect(
1376
+ previousSlot.findAll((node) => node.props?.testID === "split-page-column-previous")
1377
+ ).toHaveLength(0);
1378
+ const next = getIconButtonByTestId(UNSAFE_root, "split-page-column-next");
1379
+ expect(next.props.accessibilityLabel).toBe("Show next column: Notes");
1380
+ expect(next.props.iconName).toBe("chevron-right");
1381
+ expect(
1382
+ nextSlot.findAll((node) => node.props?.testID === "split-page-column-next")
1383
+ ).toHaveLength(1);
1384
+ const back = getIconButtonByTestId(UNSAFE_root, "split-page-back-to-list");
1385
+ expect(
1386
+ findAncestor(back, (node) => flattenedStyle(node.props.style).position === "absolute")
1387
+ ).toBeUndefined();
1388
+ expect(findAncestor(back, (node) => node.props?.testID === "split-page-column-nav")).toBe(
1389
+ nav
1390
+ );
1391
+ expect(flattenedStyle(getByTestId("split-page-column-back-slot").props.style)).toMatchObject(
1392
+ slotStyle
1393
+ );
1394
+
1395
+ await act(async () => {
1396
+ next.props.onClick();
1397
+ });
1398
+ expect(queryIconButtonByTestId(UNSAFE_root, "split-page-column-next")).toBeUndefined();
1399
+ expect(
1400
+ getByTestId("split-page-column-next-slot").findAll(
1401
+ (node) => node.props?.testID === "split-page-column-next"
1402
+ )
1403
+ ).toHaveLength(0);
1404
+ const previous = getIconButtonByTestId(UNSAFE_root, "split-page-column-previous");
1405
+ expect(previous.props.accessibilityLabel).toBe("Show previous column: Summary");
1406
+ expect(previous.props.iconName).toBe("chevron-left");
1407
+ expect(
1408
+ getByTestId("split-page-column-previous-slot").findAll(
1409
+ (node) => node.props?.testID === "split-page-column-previous"
1410
+ )
1411
+ ).toHaveLength(1);
1412
+ expect(
1413
+ flattenedStyle(getByTestId("split-page-column-previous-slot").props.style)
1414
+ ).toMatchObject(slotStyle);
1415
+ expect(flattenedStyle(getByTestId("split-page-column-next-slot").props.style)).toMatchObject(
1416
+ slotStyle
1417
+ );
1418
+ expect(flattenedStyle(getByTestId("split-page-column-nav").props.style).height).toBe(
1419
+ navButton
1420
+ );
1421
+ expect(flattenedStyle(getByTestId("split-page-mobile-child-0").props.style).height).toBe(
1422
+ columnHeight
1423
+ );
1424
+ expect(flattenedStyle(getByTestId("split-page-mobile-child-1").props.style).height).toBe(
1425
+ columnHeight
1426
+ );
1427
+ });
1428
+
1429
+ it("keeps labeled nav slots stationary across the first, middle, and last columns", async () => {
1430
+ setMobile();
1431
+ const {getAllByLabelText, getByTestId, UNSAFE_root} = renderWithTheme(
1432
+ <SplitPage
1433
+ {...defaultProps}
1434
+ bottomNavBarHeight={20}
1435
+ narrowViewportChildLabels={["Summary", "Notes", "History"]}
1436
+ narrowViewportListButtonLabel="Back to list"
1437
+ tabs={["Summary", "Notes", "History"]}
1438
+ >
1439
+ <View testID="child-1" />
1440
+ <View testID="child-2" />
1441
+ <View testID="child-3" />
1442
+ </SplitPage>
1443
+ );
1444
+ await selectFirst(getAllByLabelText);
1445
+ layoutPager(getByTestId("split-page-mobile-children"), 500, 340);
1446
+
1447
+ const edge = getSpacing(2);
1448
+ const columnHeight = 500 - (edge + edge + 32 + edge + 20);
1449
+ const slotStyle = {height: 32, width: 32};
1450
+ const expectStationaryChrome = (): void => {
1451
+ expect(flattenedStyle(getByTestId("split-page-mobile-child-0").props.style).height).toBe(
1452
+ columnHeight
1453
+ );
1454
+ expect(flattenedStyle(getByTestId("split-page-mobile-child-1").props.style).height).toBe(
1455
+ columnHeight
1456
+ );
1457
+ expect(flattenedStyle(getByTestId("split-page-mobile-child-2").props.style).height).toBe(
1458
+ columnHeight
1459
+ );
1460
+ expect(flattenedStyle(getByTestId("split-page-column-nav").props.style)).toMatchObject({
1461
+ height: 32,
1462
+ marginTop: edge,
1463
+ });
1464
+ expect(
1465
+ flattenedStyle(getByTestId("split-page-column-previous-slot").props.style)
1466
+ ).toMatchObject(slotStyle);
1467
+ expect(
1468
+ flattenedStyle(getByTestId("split-page-column-next-slot").props.style)
1469
+ ).toMatchObject(slotStyle);
1470
+ expect(
1471
+ flattenedStyle(getByTestId("split-page-column-back-slot").props.style)
1472
+ ).toMatchObject(slotStyle);
1473
+ expect(
1474
+ flattenedStyle(getByTestId("split-page-column-bottom-space").props.style).height
1475
+ ).toBe(edge + 20);
1476
+ };
1477
+
1478
+ expectStationaryChrome();
1479
+ expect(queryIconButtonByTestId(UNSAFE_root, "split-page-column-previous")).toBeUndefined();
1480
+ expect(getIconButtonByTestId(UNSAFE_root, "split-page-column-next").props.iconName).toBe(
1481
+ "chevron-right"
1482
+ );
1483
+
1484
+ await act(async () => {
1485
+ getIconButtonByTestId(UNSAFE_root, "split-page-column-next").props.onClick();
1486
+ });
1487
+ expectStationaryChrome();
1488
+ expect(getIconButtonByTestId(UNSAFE_root, "split-page-column-previous").props.iconName).toBe(
1489
+ "chevron-left"
1490
+ );
1491
+ expect(
1492
+ getIconButtonByTestId(UNSAFE_root, "split-page-column-next").props.accessibilityLabel
1493
+ ).toBe("Show next column: History");
1494
+
1495
+ await act(async () => {
1496
+ getIconButtonByTestId(UNSAFE_root, "split-page-column-next").props.onClick();
1497
+ });
1498
+ expectStationaryChrome();
1499
+ expect(queryIconButtonByTestId(UNSAFE_root, "split-page-column-next")).toBeUndefined();
1500
+ expect(
1501
+ getIconButtonByTestId(UNSAFE_root, "split-page-column-previous").props.accessibilityLabel
1502
+ ).toBe("Show previous column: Notes");
1503
+ });
1504
+
1505
+ it("bounds dotted narrow pages to the measured pane and keeps pagination room", async () => {
1506
+ setMobile();
1507
+ const {getAllByLabelText, getByTestId} = renderWithTheme(
1508
+ <SplitPage {...defaultProps} bottomNavBarHeight={16} childColumnRounding="lg">
1509
+ {renderFullHeightChild()}
1510
+ <View testID="other-child" />
1511
+ </SplitPage>
1512
+ );
1513
+ await selectFirst(getAllByLabelText);
1514
+ expect(flattenedStyle(getByTestId("split-page-dotted-child-0").props.style).height).toBe(
1515
+ "90%"
1516
+ );
1517
+
1518
+ layoutPager(getByTestId("split-page-dotted-pager"), 400, 300);
1519
+
1520
+ const page = getByTestId("split-page-dotted-child-0");
1521
+ const style = flattenedStyle(page.props.style);
1522
+ expect(style.height).toBe(360);
1523
+ expect(style.overflow).toBe("hidden");
1524
+ expect(style.borderRadius).toBe(getRounding("lg"));
1525
+ expect(style.paddingBottom).toBe(16);
1526
+ expect(style.padding).toBe(4);
1527
+ expect(style.width).toBe(367);
1528
+ expectBoundedNarrowChild(page);
1529
+ const swiper = flattenedStyle(getByTestId("swiper-flatlist").props.style);
1530
+ expect(swiper.height).toBe("100%");
1531
+ expect(swiper.overflow).toBeUndefined();
1532
+ });
1533
+
1534
+ it("bounds a single dotted page to the full measured height", async () => {
1535
+ setMobile();
1536
+ const {getAllByLabelText, getByTestId} = renderWithTheme(
1537
+ <SplitPage {...defaultProps}>{renderFullHeightChild()}</SplitPage>
1538
+ );
1539
+ await selectFirst(getAllByLabelText);
1540
+ layoutPager(getByTestId("split-page-dotted-pager"), 410, 300);
1541
+ expect(flattenedStyle(getByTestId("split-page-dotted-child-0").props.style).height).toBe(410);
1542
+ expectBoundedNarrowChild(getByTestId("split-page-dotted-child-0"));
1543
+ });
1021
1544
  });
1022
1545
  });