@terreno/ui 57.9.0 → 57.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +19 -4
- package/dist/Button.js.map +1 -1
- package/dist/Common.d.ts +68 -1
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/DateTimeField.d.ts.map +1 -1
- package/dist/DateTimeField.js +90 -17
- package/dist/DateTimeField.js.map +1 -1
- package/dist/FilePickerButton.d.ts +15 -1
- package/dist/FilePickerButton.d.ts.map +1 -1
- package/dist/FilePickerButton.js +26 -9
- package/dist/FilePickerButton.js.map +1 -1
- package/dist/GPTChat.d.ts +57 -1
- package/dist/GPTChat.d.ts.map +1 -1
- package/dist/GPTChat.js +199 -7
- package/dist/GPTChat.js.map +1 -1
- package/dist/HtmlFrame.d.ts +11 -0
- package/dist/HtmlFrame.d.ts.map +1 -0
- package/dist/HtmlFrame.js +29 -0
- package/dist/HtmlFrame.js.map +1 -0
- package/dist/Text.d.ts +1 -1
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +2 -2
- package/dist/Text.js.map +1 -1
- package/dist/asks/AskCard.d.ts +34 -0
- package/dist/asks/AskCard.d.ts.map +1 -0
- package/dist/asks/AskCard.js +91 -0
- package/dist/asks/AskCard.js.map +1 -0
- package/dist/asks/AskChoice.d.ts +11 -0
- package/dist/asks/AskChoice.d.ts.map +1 -0
- package/dist/asks/AskChoice.js +146 -0
- package/dist/asks/AskChoice.js.map +1 -0
- package/dist/asks/AskConfirm.d.ts +15 -0
- package/dist/asks/AskConfirm.d.ts.map +1 -0
- package/dist/asks/AskConfirm.js +17 -0
- package/dist/asks/AskConfirm.js.map +1 -0
- package/dist/asks/AskFiles.d.ts +18 -0
- package/dist/asks/AskFiles.d.ts.map +1 -0
- package/dist/asks/AskFiles.js +149 -0
- package/dist/asks/AskFiles.js.map +1 -0
- package/dist/asks/AskForm.d.ts +27 -0
- package/dist/asks/AskForm.d.ts.map +1 -0
- package/dist/asks/AskForm.js +146 -0
- package/dist/asks/AskForm.js.map +1 -0
- package/dist/asks/AskMarkdown.d.ts +25 -0
- package/dist/asks/AskMarkdown.d.ts.map +1 -0
- package/dist/asks/AskMarkdown.js +73 -0
- package/dist/asks/AskMarkdown.js.map +1 -0
- package/dist/asks/SimpleAskCard.d.ts +23 -0
- package/dist/asks/SimpleAskCard.d.ts.map +1 -0
- package/dist/asks/SimpleAskCard.js +32 -0
- package/dist/asks/SimpleAskCard.js.map +1 -0
- package/dist/asks/askControls.d.ts +33 -0
- package/dist/asks/askControls.d.ts.map +1 -0
- package/dist/asks/askControls.js +30 -0
- package/dist/asks/askControls.js.map +1 -0
- package/dist/asks/askFileRefs.d.ts +26 -0
- package/dist/asks/askFileRefs.d.ts.map +1 -0
- package/dist/asks/askFileRefs.js +75 -0
- package/dist/asks/askFileRefs.js.map +1 -0
- package/dist/asks/askFormDraft.d.ts +60 -0
- package/dist/asks/askFormDraft.d.ts.map +1 -0
- package/dist/asks/askFormDraft.js +224 -0
- package/dist/asks/askFormDraft.js.map +1 -0
- package/dist/asks/askSummary.d.ts +10 -0
- package/dist/asks/askSummary.d.ts.map +1 -0
- package/dist/asks/askSummary.js +138 -0
- package/dist/asks/askSummary.js.map +1 -0
- package/dist/asks/askTypes.d.ts +21 -0
- package/dist/asks/askTypes.d.ts.map +1 -0
- package/dist/asks/askTypes.js +2 -0
- package/dist/asks/askTypes.js.map +1 -0
- package/dist/asks/simpleCardButtonVariants.d.ts +5 -0
- package/dist/asks/simpleCardButtonVariants.d.ts.map +1 -0
- package/dist/asks/simpleCardButtonVariants.js +8 -0
- package/dist/asks/simpleCardButtonVariants.js.map +1 -0
- package/dist/blocks/BlocksError.d.ts +8 -0
- package/dist/blocks/BlocksError.d.ts.map +1 -0
- package/dist/blocks/BlocksError.js +14 -0
- package/dist/blocks/BlocksError.js.map +1 -0
- package/dist/blocks/BlocksView.d.ts +10 -0
- package/dist/blocks/BlocksView.d.ts.map +1 -0
- package/dist/blocks/BlocksView.js +90 -0
- package/dist/blocks/BlocksView.js.map +1 -0
- package/dist/blocks/blockRenderers.d.ts +25 -0
- package/dist/blocks/blockRenderers.d.ts.map +1 -0
- package/dist/blocks/blockRenderers.js +136 -0
- package/dist/blocks/blockRenderers.js.map +1 -0
- package/dist/blocks/datasetToPoints.d.ts +22 -0
- package/dist/blocks/datasetToPoints.d.ts.map +1 -0
- package/dist/blocks/datasetToPoints.js +28 -0
- package/dist/blocks/datasetToPoints.js.map +1 -0
- package/dist/blocks/useBlockSelections.d.ts +6 -0
- package/dist/blocks/useBlockSelections.d.ts.map +1 -0
- package/dist/blocks/useBlockSelections.js +10 -0
- package/dist/blocks/useBlockSelections.js.map +1 -0
- package/dist/blocks/useResolvedDatasets.d.ts +18 -0
- package/dist/blocks/useResolvedDatasets.d.ts.map +1 -0
- package/dist/blocks/useResolvedDatasets.js +59 -0
- package/dist/blocks/useResolvedDatasets.js.map +1 -0
- package/dist/blocks/useResolvedImages.d.ts +15 -0
- package/dist/blocks/useResolvedImages.d.ts.map +1 -0
- package/dist/blocks/useResolvedImages.js +66 -0
- package/dist/blocks/useResolvedImages.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/lazyBoundaries/heavyOptionalExports.d.ts +6 -0
- package/dist/lazyBoundaries/heavyOptionalExports.d.ts.map +1 -1
- package/dist/lazyBoundaries/heavyOptionalExports.js +4 -0
- package/dist/lazyBoundaries/heavyOptionalExports.js.map +1 -1
- package/package.json +2 -1
- package/src/Button.test.tsx +72 -0
- package/src/Button.tsx +34 -4
- package/src/Common.ts +67 -0
- package/src/DateTimeField.test.tsx +185 -2
- package/src/DateTimeField.tsx +106 -16
- package/src/DonutChart.test.tsx +5 -10
- package/src/FilePickerButton.test.tsx +56 -3
- package/src/FilePickerButton.tsx +83 -17
- package/src/GPTChat.test.tsx +758 -2
- package/src/GPTChat.tsx +517 -7
- package/src/HtmlFrame.tsx +60 -0
- package/src/LineChart.test.tsx +5 -10
- package/src/Text.test.tsx +22 -0
- package/src/Text.tsx +10 -1
- package/src/asks/AskCard.test.tsx +1428 -0
- package/src/asks/AskCard.tsx +240 -0
- package/src/asks/AskChoice.tsx +368 -0
- package/src/asks/AskConfirm.tsx +42 -0
- package/src/asks/AskFiles.test.tsx +347 -0
- package/src/asks/AskFiles.tsx +246 -0
- package/src/asks/AskForm.tsx +334 -0
- package/src/asks/AskMarkdown.tsx +176 -0
- package/src/asks/SimpleAskCard.test.tsx +253 -0
- package/src/asks/SimpleAskCard.tsx +82 -0
- package/src/asks/askControls.tsx +98 -0
- package/src/asks/askFileRefs.test.ts +155 -0
- package/src/asks/askFileRefs.ts +98 -0
- package/src/asks/askFormDraft.test.ts +347 -0
- package/src/asks/askFormDraft.ts +309 -0
- package/src/asks/askSummary.test.ts +255 -0
- package/src/asks/askSummary.ts +160 -0
- package/src/asks/askTypes.ts +25 -0
- package/src/asks/asksUseTerrenoComponents.test.ts +55 -0
- package/src/asks/simpleCardButtonVariants.ts +14 -0
- package/src/blocks/BlocksError.tsx +28 -0
- package/src/blocks/BlocksView.test.tsx +607 -0
- package/src/blocks/BlocksView.tsx +125 -0
- package/src/blocks/blockRenderers.tsx +288 -0
- package/src/blocks/datasetToPoints.test.ts +31 -0
- package/src/blocks/datasetToPoints.ts +48 -0
- package/src/blocks/useBlockSelections.ts +13 -0
- package/src/blocks/useResolvedDatasets.ts +78 -0
- package/src/blocks/useResolvedImages.ts +81 -0
- package/src/index.tsx +7 -0
- package/src/isolated/HtmlFrame.isolated.tsx +54 -0
- package/src/lazyBoundaries/heavyOptionalExports.test.tsx +2 -0
- package/src/lazyBoundaries/heavyOptionalExports.tsx +14 -0
|
@@ -2,7 +2,9 @@ import type { AIRequestExplorer as AIRequestExplorerComponent } from "../AIReque
|
|
|
2
2
|
import type { AiSuggestionBox as AiSuggestionBoxComponent } from "../AiSuggestionBox";
|
|
3
3
|
import type { AreaChart as AreaChartComponent } from "../AreaChart";
|
|
4
4
|
import type { AttachmentPreview as AttachmentPreviewComponent } from "../AttachmentPreview";
|
|
5
|
+
import type { AskCard as AskCardComponent } from "../asks/AskCard";
|
|
5
6
|
import type { BarChart as BarChartComponent } from "../BarChart";
|
|
7
|
+
import type { BlocksView as BlocksViewComponent } from "../blocks/BlocksView";
|
|
6
8
|
import type { ChartCard as ChartCardComponent } from "../ChartCard";
|
|
7
9
|
import type { ConflictSheet as ConflictSheetComponent } from "../ConflictSheet";
|
|
8
10
|
import type { ConsentFormScreen as ConsentFormScreenComponent } from "../ConsentFormScreen";
|
|
@@ -22,8 +24,10 @@ export declare const heavyOptionalModuleFactories: {
|
|
|
22
24
|
readonly AIRequestExplorer: () => Promise<typeof import("../AIRequestExplorer")>;
|
|
23
25
|
readonly AiSuggestionBox: () => Promise<typeof import("../AiSuggestionBox")>;
|
|
24
26
|
readonly AreaChart: () => Promise<typeof import("../AreaChart")>;
|
|
27
|
+
readonly AskCard: () => Promise<typeof import("../asks/AskCard")>;
|
|
25
28
|
readonly AttachmentPreview: () => Promise<typeof import("../AttachmentPreview")>;
|
|
26
29
|
readonly BarChart: () => Promise<typeof import("../BarChart")>;
|
|
30
|
+
readonly BlocksView: () => Promise<typeof import("../blocks/BlocksView")>;
|
|
27
31
|
readonly ChartCard: () => Promise<typeof import("../ChartCard")>;
|
|
28
32
|
readonly ConflictSheet: () => Promise<typeof import("../ConflictSheet")>;
|
|
29
33
|
readonly ConsentFormScreen: () => Promise<typeof import("../ConsentFormScreen")>;
|
|
@@ -43,8 +47,10 @@ export declare const heavyOptionalModuleFactories: {
|
|
|
43
47
|
export declare const AIRequestExplorer: typeof AIRequestExplorerComponent;
|
|
44
48
|
export declare const AreaChart: typeof AreaChartComponent;
|
|
45
49
|
export declare const AiSuggestionBox: typeof AiSuggestionBoxComponent;
|
|
50
|
+
export declare const AskCard: typeof AskCardComponent;
|
|
46
51
|
export declare const AttachmentPreview: typeof AttachmentPreviewComponent;
|
|
47
52
|
export declare const BarChart: typeof BarChartComponent;
|
|
53
|
+
export declare const BlocksView: typeof BlocksViewComponent;
|
|
48
54
|
export declare const ChartCard: typeof ChartCardComponent;
|
|
49
55
|
export declare const ConflictSheet: typeof ConflictSheetComponent;
|
|
50
56
|
export declare const ConsentFormScreen: typeof ConsentFormScreenComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heavyOptionalExports.d.ts","sourceRoot":"","sources":["../../src/lazyBoundaries/heavyOptionalExports.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,IAAI,0BAA0B,EAAC,MAAM,sBAAsB,CAAC;AAC1F,OAAO,KAAK,EAAC,eAAe,IAAI,wBAAwB,EAAC,MAAM,oBAAoB,CAAC;AACpF,OAAO,KAAK,EAAC,SAAS,IAAI,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EAAC,iBAAiB,IAAI,0BAA0B,EAAC,MAAM,sBAAsB,CAAC;AAC1F,OAAO,KAAK,EAAC,QAAQ,IAAI,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAC,SAAS,IAAI,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EAAC,aAAa,IAAI,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAC,iBAAiB,IAAI,0BAA0B,EAAC,MAAM,sBAAsB,CAAC;AAC1F,OAAO,KAAK,EAAC,gBAAgB,IAAI,yBAAyB,EAAC,MAAM,qBAAqB,CAAC;AACvF,OAAO,KAAK,EAAC,UAAU,IAAI,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAC,aAAa,IAAI,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,sBAAsB,MAAM,kBAAkB,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wBAAwB,CAAC;AAEhD,eAAO,MAAM,OAAO,EAGJ,OAAO,gBAAgB,CAAC;AAExC,eAAO,MAAM,iBAAiB,EAGd,OAAO,0BAA0B,CAAC;AAElD,eAAO,MAAM,QAAQ,EAGL,OAAO,iBAAiB,CAAC;AAEzC,eAAO,MAAM,UAAU,EAGP,OAAO,mBAAmB,CAAC;AAE3C,eAAO,MAAM,SAAS,EAGN,OAAO,kBAAkB,CAAC;AAE1C,eAAO,MAAM,aAAa,EAGV,OAAO,sBAAsB,CAAC;AAE9C,eAAO,MAAM,iBAAiB,EAGd,OAAO,0BAA0B,CAAC;AAElD,eAAO,MAAM,gBAAgB,EAGb,OAAO,yBAAyB,CAAC;AAEjD,eAAO,MAAM,UAAU,EAGP,OAAO,mBAAmB,CAAC;AAE3C,eAAO,MAAM,aAAa,EAGV,OAAO,sBAAsB,CAAC;AAE9C,eAAO,MAAM,aAAa,EAET,OAAO,sBAAsB,CAAC;AAE/C,eAAO,MAAM,OAAO,EAGJ,OAAO,gBAAgB,CAAC;AAExC,eAAO,MAAM,SAAS,EAGN,OAAO,kBAAkB,CAAC;AAE1C,eAAO,MAAM,cAAc,EAGX,OAAO,uBAAuB,CAAC;AAE/C,eAAO,MAAM,cAAc,EAGX,OAAO,uBAAuB,CAAC;AAE/C,eAAO,MAAM,mBAAmB,EAGhB,OAAO,4BAA4B,CAAC;AAEpD,eAAO,MAAM,SAAS,EAGN,OAAO,kBAAkB,CAAC;AAE1C,eAAO,MAAM,cAAc,EAGX,OAAO,uBAAuB,CAAC;AAE/C,eAAO,MAAM,qBAAqB,EAGlB,OAAO,8BAA8B,CAAC"}
|
|
@@ -4,8 +4,10 @@ export const heavyOptionalModuleFactories = {
|
|
|
4
4
|
AIRequestExplorer: () => import("../AIRequestExplorer"),
|
|
5
5
|
AiSuggestionBox: () => import("../AiSuggestionBox"),
|
|
6
6
|
AreaChart: () => import("../AreaChart"),
|
|
7
|
+
AskCard: () => import("../asks/AskCard"),
|
|
7
8
|
AttachmentPreview: () => import("../AttachmentPreview"),
|
|
8
9
|
BarChart: () => import("../BarChart"),
|
|
10
|
+
BlocksView: () => import("../blocks/BlocksView"),
|
|
9
11
|
ChartCard: () => import("../ChartCard"),
|
|
10
12
|
ConflictSheet: () => import("../ConflictSheet"),
|
|
11
13
|
ConsentFormScreen: () => import("../ConsentFormScreen"),
|
|
@@ -35,8 +37,10 @@ const EMOJI_SELECTOR_DEFAULT_PROPS = {
|
|
|
35
37
|
export const AIRequestExplorer = createLazyNamedExport(heavyOptionalModuleFactories.AIRequestExplorer, "AIRequestExplorer");
|
|
36
38
|
export const AreaChart = createLazyNamedExport(heavyOptionalModuleFactories.AreaChart, "AreaChart");
|
|
37
39
|
export const AiSuggestionBox = createLazyNamedExport(heavyOptionalModuleFactories.AiSuggestionBox, "AiSuggestionBox");
|
|
40
|
+
export const AskCard = createLazyNamedExport(heavyOptionalModuleFactories.AskCard, "AskCard");
|
|
38
41
|
export const AttachmentPreview = createLazyNamedExport(heavyOptionalModuleFactories.AttachmentPreview, "AttachmentPreview");
|
|
39
42
|
export const BarChart = createLazyNamedExport(heavyOptionalModuleFactories.BarChart, "BarChart");
|
|
43
|
+
export const BlocksView = createLazyNamedExport(heavyOptionalModuleFactories.BlocksView, "BlocksView");
|
|
40
44
|
export const ChartCard = createLazyNamedExport(heavyOptionalModuleFactories.ChartCard, "ChartCard");
|
|
41
45
|
export const ConflictSheet = createLazyNamedExport(heavyOptionalModuleFactories.ConflictSheet, "ConflictSheet");
|
|
42
46
|
export const ConsentFormScreen = createLazyNamedExport(heavyOptionalModuleFactories.ConsentFormScreen, "ConsentFormScreen");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heavyOptionalExports.js","sourceRoot":"","sources":["../../src/lazyBoundaries/heavyOptionalExports.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"heavyOptionalExports.js","sourceRoot":"","sources":["../../src/lazyBoundaries/heavyOptionalExports.tsx"],"names":[],"mappings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CAAC,mBAAmB,EAChD,qBAAqB,CAC4B,CAAC;AAEpD,MAAM,CAAC,MAAM,SAAS,GAAG,qBAAqB,CAC5C,4BAA4B,CAAC,SAAS,EACtC,WAAW,CAC4B,CAAC;AAE1C,MAAM,CAAC,MAAM,cAAc,GAAG,qBAAqB,CACjD,4BAA4B,CAAC,cAAc,EAC3C,gBAAgB,CAC4B,CAAC;AAE/C,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CACxD,4BAA4B,CAAC,qBAAqB,EAClD,uBAAuB,CAC4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -26,6 +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.10.1",
|
|
29
30
|
"d3-scale": "^4.0.2",
|
|
30
31
|
"d3-shape": "^3.2.0",
|
|
31
32
|
"emoji-datasource": "^16.0.0",
|
|
@@ -162,7 +163,7 @@
|
|
|
162
163
|
"test:coverage": "TZ=America/New_York bun run ../scripts/check-coverage.ts",
|
|
163
164
|
"types": "bun typedoc"
|
|
164
165
|
},
|
|
165
|
-
"version": "57.
|
|
166
|
+
"version": "57.10.1",
|
|
166
167
|
"bugs": {
|
|
167
168
|
"url": "https://github.com/TerrenoLabs/terreno/issues"
|
|
168
169
|
},
|
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 {ReactTestInstance} from "react-test-renderer";
|
|
4
5
|
|
|
5
6
|
import {Button} from "./Button";
|
|
6
7
|
import type {ButtonProps} from "./Common";
|
|
@@ -31,6 +32,22 @@ interface CancelablePress {
|
|
|
31
32
|
cancel: () => void;
|
|
32
33
|
}
|
|
33
34
|
|
|
35
|
+
const LONG_LABEL = "Go team 🎉🎉🎉🎉🎉…";
|
|
36
|
+
|
|
37
|
+
const hostParentOf = (node: ReactTestInstance | null): ReactTestInstance | null => {
|
|
38
|
+
let parent = node?.parent ?? null;
|
|
39
|
+
while (parent && typeof parent.type !== "string") {
|
|
40
|
+
parent = parent.parent;
|
|
41
|
+
}
|
|
42
|
+
return parent;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** The label and the icon and spinner rows around it, innermost first. */
|
|
46
|
+
const labelAndRows = (label: ReactTestInstance): (ReactTestInstance | null)[] => {
|
|
47
|
+
const iconRow = hostParentOf(label);
|
|
48
|
+
return [label, iconRow, hostParentOf(iconRow)];
|
|
49
|
+
};
|
|
50
|
+
|
|
34
51
|
describe("Button", () => {
|
|
35
52
|
it("renders correctly with default props", () => {
|
|
36
53
|
const {toJSON} = renderWithTheme(<Button onClick={() => {}} text="Click me" />);
|
|
@@ -49,6 +66,61 @@ describe("Button", () => {
|
|
|
49
66
|
expect(getByTestId("test-button")).toBeTruthy();
|
|
50
67
|
});
|
|
51
68
|
|
|
69
|
+
it("keeps a long label on one line by default", () => {
|
|
70
|
+
const {getByTestId, getByText} = renderWithTheme(
|
|
71
|
+
<Button onClick={() => {}} size="sm" testID="one-line" text={LONG_LABEL} />
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const [label, iconRow, spinnerRow] = labelAndRows(getByText(LONG_LABEL));
|
|
75
|
+
for (const node of [label, iconRow, spinnerRow]) {
|
|
76
|
+
expect(node?.props.style).not.toHaveProperty("flexShrink");
|
|
77
|
+
}
|
|
78
|
+
expect(label?.props.style).not.toHaveProperty("textAlign");
|
|
79
|
+
const style = getByTestId("one-line").props.style;
|
|
80
|
+
expect(style).toMatchObject({height: 28, paddingVertical: 0});
|
|
81
|
+
expect(style).not.toHaveProperty("maxWidth");
|
|
82
|
+
expect(style).not.toHaveProperty("minHeight");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("fits its container and wraps a long label onto centered lines with wrapText", () => {
|
|
86
|
+
const {getByTestId, getByText} = renderWithTheme(
|
|
87
|
+
<Button onClick={() => {}} testID="wrapping" text={LONG_LABEL} wrapText />
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const [label, iconRow, spinnerRow] = labelAndRows(getByText(LONG_LABEL));
|
|
91
|
+
expect(label?.props.style).toMatchObject({flexShrink: 1, textAlign: "center"});
|
|
92
|
+
for (const row of [iconRow, spinnerRow]) {
|
|
93
|
+
expect(row?.props.style).toMatchObject({flexShrink: 1});
|
|
94
|
+
}
|
|
95
|
+
const style = getByTestId("wrapping").props.style;
|
|
96
|
+
expect(style).toMatchObject({maxWidth: "100%", paddingVertical: 8});
|
|
97
|
+
expect(style.height).toBeUndefined();
|
|
98
|
+
expect(style).not.toHaveProperty("minHeight");
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
for (const {paddingVertical, variant} of [
|
|
102
|
+
{paddingVertical: 4, variant: "primary"},
|
|
103
|
+
{paddingVertical: 2, variant: "outline"},
|
|
104
|
+
] as const) {
|
|
105
|
+
it(`grows a sm ${variant} button from 28px instead of clipping a wrapped label`, () => {
|
|
106
|
+
const {getByTestId, getByText} = renderWithTheme(
|
|
107
|
+
<Button
|
|
108
|
+
onClick={() => {}}
|
|
109
|
+
size="sm"
|
|
110
|
+
testID="sm-wrap"
|
|
111
|
+
text={LONG_LABEL}
|
|
112
|
+
variant={variant}
|
|
113
|
+
wrapText
|
|
114
|
+
/>
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const style = getByTestId("sm-wrap").props.style;
|
|
118
|
+
expect(style.height).toBeUndefined();
|
|
119
|
+
expect(style).toMatchObject({maxWidth: "100%", minHeight: 28, paddingVertical});
|
|
120
|
+
expect(getByText(LONG_LABEL).props.style).toMatchObject({flexShrink: 1, fontSize: 14});
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
52
124
|
it("supports an accessible name distinct from visible text", () => {
|
|
53
125
|
const {getByTestId} = renderWithTheme(
|
|
54
126
|
<Button accessibilityLabel="Filter Name" onClick={() => {}} testID="filter-button" text="" />
|
package/src/Button.tsx
CHANGED
|
@@ -8,7 +8,15 @@ import {
|
|
|
8
8
|
} from "pressto";
|
|
9
9
|
import type React from "react";
|
|
10
10
|
import {lazy, memo, Suspense, useCallback, useEffect, useMemo, useRef, useState} from "react";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
ActivityIndicator,
|
|
13
|
+
Pressable,
|
|
14
|
+
type PressableProps,
|
|
15
|
+
Text,
|
|
16
|
+
type TextStyle,
|
|
17
|
+
View,
|
|
18
|
+
type ViewStyle,
|
|
19
|
+
} from "react-native";
|
|
12
20
|
|
|
13
21
|
import {Box} from "./Box";
|
|
14
22
|
import type {ButtonPressAnimation, ButtonProps} from "./Common";
|
|
@@ -95,6 +103,7 @@ const ButtonVisual: React.FC<ButtonVisualProps> = ({
|
|
|
95
103
|
text,
|
|
96
104
|
variant = "primary",
|
|
97
105
|
withConfirmation = false,
|
|
106
|
+
wrapText = false,
|
|
98
107
|
}) => {
|
|
99
108
|
const {theme} = useTheme();
|
|
100
109
|
const CustomIcon = useCustomIcon(iconName);
|
|
@@ -157,6 +166,20 @@ const ButtonVisual: React.FC<ButtonVisualProps> = ({
|
|
|
157
166
|
isPressDisabled ? Pressable : PRESSABLE_BY_ANIMATION[pressAnimation]
|
|
158
167
|
) as React.ComponentType<ButtonPressableProps>;
|
|
159
168
|
const pressableInteractionProps = isPressDisabled ? {disabled: true} : {enabled: true};
|
|
169
|
+
// `maxWidth` lets a button in a row fit the row instead of its one-line label. The fixed `sm`
|
|
170
|
+
// height would clip a wrapped second line, so a wrapping `sm` button grows from 28px instead.
|
|
171
|
+
const wrapBoxStyle: ViewStyle | undefined = wrapText
|
|
172
|
+
? {
|
|
173
|
+
maxWidth: "100%",
|
|
174
|
+
...(size === "sm"
|
|
175
|
+
? {height: undefined, minHeight: 28, paddingVertical: 4 - (borderWidth ?? 0)}
|
|
176
|
+
: undefined),
|
|
177
|
+
}
|
|
178
|
+
: undefined;
|
|
179
|
+
const wrapRowStyle: ViewStyle | undefined = wrapText ? {flexShrink: 1} : undefined;
|
|
180
|
+
const wrapLabelStyle: TextStyle | undefined = wrapText
|
|
181
|
+
? {flexShrink: 1, textAlign: "center"}
|
|
182
|
+
: undefined;
|
|
160
183
|
|
|
161
184
|
return (
|
|
162
185
|
<PressableComponent
|
|
@@ -181,11 +204,14 @@ const ButtonVisual: React.FC<ButtonVisualProps> = ({
|
|
|
181
204
|
paddingHorizontal: size === "sm" ? 16 : 20,
|
|
182
205
|
paddingVertical: size === "sm" ? 0 : 8 - (borderWidth ?? 0),
|
|
183
206
|
width: fullWidth ? "100%" : "auto",
|
|
207
|
+
...wrapBoxStyle,
|
|
184
208
|
}}
|
|
185
209
|
testID={testID}
|
|
186
210
|
>
|
|
187
|
-
<View style={{flexDirection: "row"}}>
|
|
188
|
-
<View
|
|
211
|
+
<View style={{flexDirection: "row", ...wrapRowStyle}}>
|
|
212
|
+
<View
|
|
213
|
+
style={{flexDirection: iconPosition === "left" ? "row" : "row-reverse", ...wrapRowStyle}}
|
|
214
|
+
>
|
|
189
215
|
{Boolean(iconName) && (
|
|
190
216
|
<View
|
|
191
217
|
style={{
|
|
@@ -201,7 +227,11 @@ const ButtonVisual: React.FC<ButtonVisualProps> = ({
|
|
|
201
227
|
)}
|
|
202
228
|
</View>
|
|
203
229
|
)}
|
|
204
|
-
<Text
|
|
230
|
+
<Text
|
|
231
|
+
style={{color, fontSize: size === "sm" ? 14 : 16, fontWeight: "700", ...wrapLabelStyle}}
|
|
232
|
+
>
|
|
233
|
+
{text}
|
|
234
|
+
</Text>
|
|
205
235
|
</View>
|
|
206
236
|
{isLoading && (
|
|
207
237
|
<Box marginLeft={2}>
|
package/src/Common.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type {Block, BlockAction, BlocksDocument, InlineDataset} from "@terreno/blocks";
|
|
1
2
|
import type {CountryCode} from "libphonenumber-js";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
import type {FC, ReactElement, ReactNode} from "react";
|
|
4
5
|
import type {
|
|
5
6
|
ImageStyle,
|
|
6
7
|
ListRenderItemInfo,
|
|
8
|
+
Text as NativeText,
|
|
7
9
|
ScrollView,
|
|
8
10
|
StyleProp,
|
|
9
11
|
TextInput,
|
|
@@ -1022,10 +1024,22 @@ export interface NumberRangeFieldProps extends BaseFieldProps, HelperTextProps,
|
|
|
1022
1024
|
max: number;
|
|
1023
1025
|
}
|
|
1024
1026
|
|
|
1027
|
+
/**
|
|
1028
|
+
* What the typed parts of a {@link DateTimeFieldProps | DateTimeField} hold: nothing, an unfinished
|
|
1029
|
+
* or invalid entry, or a complete value.
|
|
1030
|
+
*/
|
|
1031
|
+
export type DateTimeEntryStatus = "empty" | "invalid" | "valid";
|
|
1032
|
+
|
|
1025
1033
|
export interface DateTimeFieldProps extends BaseFieldProps, HelperTextProps, ErrorTextProps {
|
|
1026
1034
|
type: "date" | "datetime" | "time";
|
|
1027
1035
|
value?: string; // ISO string always
|
|
1028
1036
|
onChange: (date: string) => void;
|
|
1037
|
+
/**
|
|
1038
|
+
* Called after each typed change and picker selection with what the field now holds.
|
|
1039
|
+
* `onChange` only fires for complete values, so use this to refuse an unfinished entry
|
|
1040
|
+
* (such as "0 / 5 / 026") or to notice the user cleared the field.
|
|
1041
|
+
*/
|
|
1042
|
+
onEntryStatusChange?: (status: DateTimeEntryStatus) => void;
|
|
1029
1043
|
onTimezoneChange?: (timezone: string) => void;
|
|
1030
1044
|
dateFormat?: string;
|
|
1031
1045
|
pickerType?: "default" | "compact" | "inline" | "spinner";
|
|
@@ -1107,6 +1121,15 @@ export interface HeadingProps extends WithTestID {
|
|
|
1107
1121
|
truncate?: boolean; // default false
|
|
1108
1122
|
}
|
|
1109
1123
|
|
|
1124
|
+
export interface HtmlFrameProps {
|
|
1125
|
+
/** Frame height. `sm` is 240px, `md` is 400px, and `lg` is 640px. */
|
|
1126
|
+
height?: "lg" | "md" | "sm";
|
|
1127
|
+
/** Sanitized HTML. The frame prepends a Content-Security-Policy meta tag. */
|
|
1128
|
+
html: string;
|
|
1129
|
+
/** Accessible name for the frame. Defaults to Agent-generated preview. */
|
|
1130
|
+
title?: string;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1110
1133
|
export interface MetaProps {
|
|
1111
1134
|
itemProp?: string;
|
|
1112
1135
|
content?: string;
|
|
@@ -1984,6 +2007,36 @@ export type BannerProps =
|
|
|
1984
2007
|
| (BannerPropsBase & {buttonOnClick?: undefined})
|
|
1985
2008
|
| (BannerPropsBase & {buttonOnClick: () => void | Promise<void>} & BannerButtonProps);
|
|
1986
2009
|
|
|
2010
|
+
export interface BlocksViewProps extends WithTestID {
|
|
2011
|
+
/** When true, an `html` block renders in a sandboxed frame. Otherwise it stays a placeholder. */
|
|
2012
|
+
allowHtml?: boolean;
|
|
2013
|
+
/** A whole-reply YAML or JSON string, or a document that already parsed. */
|
|
2014
|
+
document: string | BlocksDocument;
|
|
2015
|
+
/** Names the host will run. A callback outside this list is disabled. Omit to leave callbacks enabled. */
|
|
2016
|
+
hostActions?: readonly string[];
|
|
2017
|
+
/** Hostnames allowed on https image sources. Empty rejects every https image. */
|
|
2018
|
+
imageHosts?: readonly string[];
|
|
2019
|
+
/** Called for reply, open, select, and callback. Select also updates the target chart locally. */
|
|
2020
|
+
onAction?: (event: {action: BlockAction; blockId: string; elementId: string}) => void;
|
|
2021
|
+
/** Block ids replaced in place. The key is the original block id. */
|
|
2022
|
+
overrides?: Record<string, Block>;
|
|
2023
|
+
/** Element ids whose buttons show a loading state. */
|
|
2024
|
+
pendingElementIds?: readonly string[];
|
|
2025
|
+
/** Loads a `ref` dataset. Inline datasets do not call this. */
|
|
2026
|
+
resolveDataset?: (ref: {
|
|
2027
|
+
grain?: "day" | "hour" | "month" | "week";
|
|
2028
|
+
id: string;
|
|
2029
|
+
limit?: number;
|
|
2030
|
+
}) => Promise<InlineDataset | undefined>;
|
|
2031
|
+
/**
|
|
2032
|
+
* Turns a `file:` image id into a URL. Until it resolves, the image is omitted and the alt
|
|
2033
|
+
* text stays. Data and https sources do not call this.
|
|
2034
|
+
*/
|
|
2035
|
+
resolveImage?: (fileId: string) => Promise<string | undefined>;
|
|
2036
|
+
/** While a reply is still streaming, `html` stays a placeholder. */
|
|
2037
|
+
streaming?: boolean;
|
|
2038
|
+
}
|
|
2039
|
+
|
|
1987
2040
|
export interface BodyProps {
|
|
1988
2041
|
scroll?: boolean;
|
|
1989
2042
|
loading?: boolean;
|
|
@@ -2077,6 +2130,13 @@ export interface ButtonProps extends WithTestID {
|
|
|
2077
2130
|
* If true, a confirmation modal will be shown before the onClick action.
|
|
2078
2131
|
*/
|
|
2079
2132
|
withConfirmation?: boolean;
|
|
2133
|
+
/**
|
|
2134
|
+
* If true, the button is never wider than its container, and a label that does not fit wraps
|
|
2135
|
+
* onto centered lines while the button grows taller. A small button grows from its 28px height.
|
|
2136
|
+
* If false, the label stays on one line.
|
|
2137
|
+
* @default false
|
|
2138
|
+
*/
|
|
2139
|
+
wrapText?: boolean;
|
|
2080
2140
|
/**
|
|
2081
2141
|
* The function to call when the button is clicked.
|
|
2082
2142
|
*/
|
|
@@ -3030,6 +3090,8 @@ export interface TableContextProviderProps extends TableContextType {
|
|
|
3030
3090
|
}
|
|
3031
3091
|
|
|
3032
3092
|
export interface TextProps extends WithTestID {
|
|
3093
|
+
/** `"header"` marks the text as a heading, so screen readers announce it and can jump to it. */
|
|
3094
|
+
accessibilityRole?: "header";
|
|
3033
3095
|
align?: "left" | "right" | "center" | "justify"; // default "left"
|
|
3034
3096
|
children?: React.ReactNode;
|
|
3035
3097
|
bold?: boolean; // default false
|
|
@@ -3039,6 +3101,11 @@ export interface TextProps extends WithTestID {
|
|
|
3039
3101
|
truncate?: boolean; // default false
|
|
3040
3102
|
underline?: boolean;
|
|
3041
3103
|
numberOfLines?: number;
|
|
3104
|
+
/**
|
|
3105
|
+
* The native text, for example to move screen reader focus to it with
|
|
3106
|
+
* `AccessibilityInfo.setAccessibilityFocus`.
|
|
3107
|
+
*/
|
|
3108
|
+
ref?: React.Ref<NativeText>;
|
|
3042
3109
|
skipLinking?: boolean;
|
|
3043
3110
|
}
|
|
3044
3111
|
|
|
@@ -8,14 +8,24 @@ import {
|
|
|
8
8
|
type mock as MockType,
|
|
9
9
|
mock,
|
|
10
10
|
} from "bun:test";
|
|
11
|
-
import {act, userEvent} from "@testing-library/react-native";
|
|
11
|
+
import {act, fireEvent, userEvent} from "@testing-library/react-native";
|
|
12
12
|
import {assert} from "chai";
|
|
13
13
|
import {DateTime} from "luxon";
|
|
14
|
+
import {useState} from "react";
|
|
14
15
|
import type {ReactTestInstance} from "react-test-renderer";
|
|
15
|
-
|
|
16
|
+
import type {DateTimeFieldProps} from "./Common";
|
|
16
17
|
import {DateTimeField} from "./DateTimeField";
|
|
17
18
|
import {renderWithTheme, setupComponentTest, teardownComponentTest} from "./test-utils";
|
|
18
19
|
|
|
20
|
+
/** A parent that passes every emitted value back, as a form does. */
|
|
21
|
+
const ControlledDateTimeField = ({
|
|
22
|
+
initialValue,
|
|
23
|
+
...props
|
|
24
|
+
}: Omit<DateTimeFieldProps, "onChange" | "value"> & {initialValue: string}): React.ReactElement => {
|
|
25
|
+
const [value, setValue] = useState(initialValue);
|
|
26
|
+
return <DateTimeField {...props} onChange={setValue} value={value} />;
|
|
27
|
+
};
|
|
28
|
+
|
|
19
29
|
const setDesktop = () => {
|
|
20
30
|
mock.module("./MediaQuery", () => ({
|
|
21
31
|
isNarrowViewport: () => false,
|
|
@@ -460,6 +470,179 @@ describe("DateTimeField", () => {
|
|
|
460
470
|
});
|
|
461
471
|
});
|
|
462
472
|
|
|
473
|
+
describe("onEntryStatusChange", () => {
|
|
474
|
+
it("reports an unfinished date as invalid, a complete one as valid, and a cleared one as empty", async () => {
|
|
475
|
+
const user = userEvent.setup();
|
|
476
|
+
const onEntryStatusChange = mock((_status: string) => {});
|
|
477
|
+
const {getByPlaceholderText} = renderWithTheme(
|
|
478
|
+
<DateTimeField
|
|
479
|
+
onChange={mockOnChange}
|
|
480
|
+
onEntryStatusChange={onEntryStatusChange}
|
|
481
|
+
type="date"
|
|
482
|
+
value=""
|
|
483
|
+
/>
|
|
484
|
+
);
|
|
485
|
+
await user.type(getByPlaceholderText("MM"), "0");
|
|
486
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("invalid");
|
|
487
|
+
|
|
488
|
+
await user.clear(getByPlaceholderText("MM"));
|
|
489
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("empty");
|
|
490
|
+
|
|
491
|
+
await user.type(getByPlaceholderText("MM"), "10");
|
|
492
|
+
await user.type(getByPlaceholderText("DD"), "15");
|
|
493
|
+
await user.type(getByPlaceholderText("YYYY"), "202");
|
|
494
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("invalid");
|
|
495
|
+
await user.type(getByPlaceholderText("YYYY"), "6");
|
|
496
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("valid");
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
it("reports a datetime whose hour is cleared as invalid without throwing", async () => {
|
|
500
|
+
const user = userEvent.setup();
|
|
501
|
+
const onEntryStatusChange = mock((_status: string) => {});
|
|
502
|
+
const {getByPlaceholderText} = renderWithTheme(
|
|
503
|
+
<DateTimeField
|
|
504
|
+
onChange={mockOnChange}
|
|
505
|
+
onEntryStatusChange={onEntryStatusChange}
|
|
506
|
+
timezone="America/New_York"
|
|
507
|
+
type="datetime"
|
|
508
|
+
value="2023-05-15T15:30:00.000Z"
|
|
509
|
+
/>
|
|
510
|
+
);
|
|
511
|
+
await user.clear(getByPlaceholderText("hh"));
|
|
512
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("invalid");
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
it("reports a single-digit hour typed into an empty datetime hour as valid", async () => {
|
|
516
|
+
const user = userEvent.setup();
|
|
517
|
+
const onEntryStatusChange = mock((_status: string) => {});
|
|
518
|
+
const {getByPlaceholderText} = renderWithTheme(
|
|
519
|
+
<DateTimeField
|
|
520
|
+
onChange={mockOnChange}
|
|
521
|
+
onEntryStatusChange={onEntryStatusChange}
|
|
522
|
+
timezone="America/New_York"
|
|
523
|
+
type="datetime"
|
|
524
|
+
value=""
|
|
525
|
+
/>
|
|
526
|
+
);
|
|
527
|
+
await user.type(getByPlaceholderText("MM"), "10");
|
|
528
|
+
await user.type(getByPlaceholderText("DD"), "15");
|
|
529
|
+
await user.type(getByPlaceholderText("YYYY"), "2026");
|
|
530
|
+
await user.type(getByPlaceholderText("mm"), "30");
|
|
531
|
+
act(() => {
|
|
532
|
+
fireEvent.changeText(getByPlaceholderText("hh"), "4");
|
|
533
|
+
});
|
|
534
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("valid");
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
it("reports a time without an hour as invalid", async () => {
|
|
538
|
+
const user = userEvent.setup();
|
|
539
|
+
const onEntryStatusChange = mock((_status: string) => {});
|
|
540
|
+
const {getByPlaceholderText} = renderWithTheme(
|
|
541
|
+
<DateTimeField
|
|
542
|
+
onChange={mockOnChange}
|
|
543
|
+
onEntryStatusChange={onEntryStatusChange}
|
|
544
|
+
timezone="America/New_York"
|
|
545
|
+
type="time"
|
|
546
|
+
value="2023-05-15T15:30:00.000Z"
|
|
547
|
+
/>
|
|
548
|
+
);
|
|
549
|
+
await user.clear(getByPlaceholderText("hh"));
|
|
550
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("invalid");
|
|
551
|
+
await user.type(getByPlaceholderText("hh"), "4");
|
|
552
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("valid");
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
it("reports an on-the-hour time whose hour is cleared as invalid until the minute is cleared too", async () => {
|
|
556
|
+
const user = userEvent.setup();
|
|
557
|
+
const onEntryStatusChange = mock((_status: string) => {});
|
|
558
|
+
const {getByPlaceholderText} = renderWithTheme(
|
|
559
|
+
<DateTimeField
|
|
560
|
+
onChange={mockOnChange}
|
|
561
|
+
onEntryStatusChange={onEntryStatusChange}
|
|
562
|
+
timezone="America/New_York"
|
|
563
|
+
type="time"
|
|
564
|
+
value="2023-05-15T13:00:00.000Z"
|
|
565
|
+
/>
|
|
566
|
+
);
|
|
567
|
+
expect(getByPlaceholderText("mm").props.value).toBe("00");
|
|
568
|
+
await user.clear(getByPlaceholderText("hh"));
|
|
569
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("invalid");
|
|
570
|
+
await user.clear(getByPlaceholderText("mm"));
|
|
571
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("empty");
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
it("reports a noon datetime cleared except for its minute as invalid until the minute is cleared too", async () => {
|
|
575
|
+
const user = userEvent.setup();
|
|
576
|
+
const onEntryStatusChange = mock((_status: string) => {});
|
|
577
|
+
const {getByPlaceholderText} = renderWithTheme(
|
|
578
|
+
<DateTimeField
|
|
579
|
+
onChange={mockOnChange}
|
|
580
|
+
onEntryStatusChange={onEntryStatusChange}
|
|
581
|
+
timezone="America/New_York"
|
|
582
|
+
type="datetime"
|
|
583
|
+
value="2023-05-15T16:00:00.000Z"
|
|
584
|
+
/>
|
|
585
|
+
);
|
|
586
|
+
expect(getByPlaceholderText("hh").props.value).toBe("12");
|
|
587
|
+
for (const placeholder of ["MM", "DD", "YYYY", "hh"]) {
|
|
588
|
+
await user.clear(getByPlaceholderText(placeholder));
|
|
589
|
+
}
|
|
590
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("invalid");
|
|
591
|
+
await user.clear(getByPlaceholderText("mm"));
|
|
592
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("empty");
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
it("reports a controlled time cleared minute first, then hour, as empty", async () => {
|
|
596
|
+
const user = userEvent.setup();
|
|
597
|
+
const onEntryStatusChange = mock((_status: string) => {});
|
|
598
|
+
const {getByPlaceholderText} = renderWithTheme(
|
|
599
|
+
<ControlledDateTimeField
|
|
600
|
+
initialValue="2023-05-15T13:30:00.000Z"
|
|
601
|
+
onEntryStatusChange={onEntryStatusChange}
|
|
602
|
+
timezone="America/New_York"
|
|
603
|
+
type="time"
|
|
604
|
+
/>
|
|
605
|
+
);
|
|
606
|
+
await user.clear(getByPlaceholderText("mm"));
|
|
607
|
+
expect(getByPlaceholderText("mm").props.value).toBe("00");
|
|
608
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("valid");
|
|
609
|
+
await user.clear(getByPlaceholderText("hh"));
|
|
610
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("empty");
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
it("reports a controlled datetime cleared minute first, then the rest, as empty", async () => {
|
|
614
|
+
const user = userEvent.setup();
|
|
615
|
+
const onEntryStatusChange = mock((_status: string) => {});
|
|
616
|
+
const {getByPlaceholderText} = renderWithTheme(
|
|
617
|
+
<ControlledDateTimeField
|
|
618
|
+
initialValue="2026-10-01T13:30:00.000Z"
|
|
619
|
+
onEntryStatusChange={onEntryStatusChange}
|
|
620
|
+
timezone="America/New_York"
|
|
621
|
+
type="datetime"
|
|
622
|
+
/>
|
|
623
|
+
);
|
|
624
|
+
for (const placeholder of ["mm", "MM", "DD", "YYYY", "hh"]) {
|
|
625
|
+
await user.clear(getByPlaceholderText(placeholder));
|
|
626
|
+
}
|
|
627
|
+
expect(onEntryStatusChange).toHaveBeenLastCalledWith("empty");
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
it("emits nothing when the hour of an on-the-hour time is cleared without onEntryStatusChange", async () => {
|
|
631
|
+
const user = userEvent.setup();
|
|
632
|
+
const onChange = mock((_value: string) => {});
|
|
633
|
+
const {getByPlaceholderText} = renderWithTheme(
|
|
634
|
+
<DateTimeField
|
|
635
|
+
onChange={onChange}
|
|
636
|
+
timezone="America/New_York"
|
|
637
|
+
type="time"
|
|
638
|
+
value="2023-05-15T13:00:00.000Z"
|
|
639
|
+
/>
|
|
640
|
+
);
|
|
641
|
+
await user.clear(getByPlaceholderText("hh"));
|
|
642
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
|
|
463
646
|
describe("time type field validation", () => {
|
|
464
647
|
it("should validate hour fields for time type", async () => {
|
|
465
648
|
const user = userEvent.setup();
|