@terreno/ui 57.9.0 → 57.11.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/LICENSE +1 -0
- package/README.md +2 -0
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +20 -5
- package/dist/Button.js.map +1 -1
- package/dist/Common.d.ts +74 -1
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/DataTable.js +1 -1
- package/dist/DataTable.js.map +1 -1
- package/dist/DateTimeActionSheet.js +1 -1
- package/dist/DateTimeActionSheet.js.map +1 -1
- package/dist/DateTimeField.d.ts.map +1 -1
- package/dist/DateTimeField.js +91 -18
- 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/SplitPage.d.ts +2 -2
- package/dist/SplitPage.d.ts.map +1 -1
- package/dist/SplitPage.js +17 -5
- package/dist/SplitPage.js.map +1 -1
- 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/dist/table/TableHeaderCell.js +1 -1
- package/dist/table/TableHeaderCell.js.map +1 -1
- package/package.json +2 -1
- package/src/Button.test.tsx +101 -0
- package/src/Button.tsx +35 -5
- package/src/Common.ts +73 -0
- package/src/DataTable.tsx +1 -1
- package/src/DateTimeActionSheet.tsx +1 -1
- package/src/DateTimeField.test.tsx +185 -2
- package/src/DateTimeField.tsx +107 -17
- 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/SplitPage.test.tsx +55 -0
- package/src/SplitPage.tsx +13 -7
- package/src/Text.test.tsx +22 -0
- package/src/Text.tsx +10 -1
- package/src/__snapshots__/Button.test.tsx.snap +1 -1
- package/src/__snapshots__/SplitPage.test.tsx.snap +14 -0
- 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/bunSetup.ts +0 -6
- 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
- package/src/table/TableHeaderCell.tsx +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import { type AskControlProps } from "./askControls";
|
|
3
|
+
import type { ChatAsk } from "./askTypes";
|
|
4
|
+
/** Answers longer than this show a preview in the transcript until the user expands them. */
|
|
5
|
+
export declare const MARKDOWN_ANSWER_PREVIEW_LENGTH = 280;
|
|
6
|
+
export interface AskMarkdownProps extends AskControlProps {
|
|
7
|
+
ask: Extract<ChatAsk, {
|
|
8
|
+
kind: "markdown";
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Edit a markdown draft and send it back. The editor starts from the ask's `initial` draft, and
|
|
13
|
+
* Submit is enabled once the text meets the ask's length rules. The answer's `changed` says whether
|
|
14
|
+
* the text differs from the draft.
|
|
15
|
+
*/
|
|
16
|
+
export declare const AskMarkdown: React.FC<AskMarkdownProps>;
|
|
17
|
+
/**
|
|
18
|
+
* The text an answered `markdown` ask sent back, under its summary line. A long answer shows a
|
|
19
|
+
* preview with Show all, so it does not push the rest of the transcript out of view.
|
|
20
|
+
*/
|
|
21
|
+
export declare const AskMarkdownAnswer: ({ markdown, testID, }: {
|
|
22
|
+
markdown: string;
|
|
23
|
+
testID: string;
|
|
24
|
+
}) => React.ReactElement | null;
|
|
25
|
+
//# sourceMappingURL=AskMarkdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AskMarkdown.d.ts","sourceRoot":"","sources":["../../src/asks/AskMarkdown.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAC,KAAK,eAAe,EAAyC,MAAM,eAAe,CAAC;AAE3F,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AAIxC,6FAA6F;AAC7F,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAIlD,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE;QAAC,IAAI,EAAE,UAAU,CAAA;KAAC,CAAC,CAAC;CAC3C;AAyBD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAqElD,CAAC;AAYF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,uBAG/B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,KAAG,KAAK,CAAC,YAAY,GAAG,IA2BxB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { markdownLengthBounds, validateAskResponse, } from "@terreno/blocks";
|
|
3
|
+
import { useCallback, useMemo, useState } from "react";
|
|
4
|
+
import { Box } from "../Box";
|
|
5
|
+
import { Button } from "../Button";
|
|
6
|
+
import { MarkdownEditorField } from "../MarkdownEditorField";
|
|
7
|
+
import { MarkdownView } from "../MarkdownView";
|
|
8
|
+
import { AskErrors, SkipButton, useAnswerButton } from "./askControls";
|
|
9
|
+
import { formatCount } from "./askSummary";
|
|
10
|
+
const SUBMIT_ACTION_ID = "submit";
|
|
11
|
+
/** Answers longer than this show a preview in the transcript until the user expands them. */
|
|
12
|
+
export const MARKDOWN_ANSWER_PREVIEW_LENGTH = 280;
|
|
13
|
+
const WORD_BOUNDARY = /\s\S*$/;
|
|
14
|
+
/** "120 / 2,000 characters. At least 20." from the draft's length and the ask's bounds. */
|
|
15
|
+
const lengthHint = (input, markdown) => {
|
|
16
|
+
const { max, min } = markdownLengthBounds(input);
|
|
17
|
+
const count = `${formatCount(markdown.length)} / ${formatCount(max)} characters.`;
|
|
18
|
+
return min > 0 ? `${count} At least ${formatCount(min)}.` : count;
|
|
19
|
+
};
|
|
20
|
+
const editorErrorText = ({ errors, input, markdown, }) => {
|
|
21
|
+
const { max } = markdownLengthBounds(input);
|
|
22
|
+
if (markdown.length > max) {
|
|
23
|
+
return `Keep this to ${formatCount(max)} characters or fewer.`;
|
|
24
|
+
}
|
|
25
|
+
return errors?.find((error) => error.path === "content.markdown")?.message;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Edit a markdown draft and send it back. The editor starts from the ask's `initial` draft, and
|
|
29
|
+
* Submit is enabled once the text meets the ask's length rules. The answer's `changed` says whether
|
|
30
|
+
* the text differs from the draft.
|
|
31
|
+
*/
|
|
32
|
+
export const AskMarkdown = ({ ask, errors, isDisabled, onAnswer, pendingActionId, testID, }) => {
|
|
33
|
+
const { input } = ask;
|
|
34
|
+
const initial = input.initial ?? "";
|
|
35
|
+
const [markdown, setMarkdown] = useState(initial);
|
|
36
|
+
const isAnswering = pendingActionId !== undefined;
|
|
37
|
+
const renderButton = useAnswerButton({ isDisabled, onAnswer, pendingActionId, testID });
|
|
38
|
+
const draft = useMemo(() => ({ action: "accept", content: { changed: markdown !== initial, markdown } }), [initial, markdown]);
|
|
39
|
+
const isDraftValid = useMemo(() => validateAskResponse({ input, kind: "markdown", response: draft }).length === 0, [draft, input]);
|
|
40
|
+
const handleChange = useCallback((value) => {
|
|
41
|
+
if (isDisabled || isAnswering) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
setMarkdown(value);
|
|
45
|
+
}, [isAnswering, isDisabled]);
|
|
46
|
+
const handleSubmit = useCallback(() => onAnswer({ actionId: SUBMIT_ACTION_ID, response: draft }), [draft, onAnswer]);
|
|
47
|
+
return (_jsxs(Box, { gap: 3, children: [_jsx(MarkdownEditorField, { disabled: isDisabled || isAnswering, errorText: editorErrorText({ errors, input, markdown }), helperText: lengthHint(input, markdown), maxHeight: 320, onChange: handleChange, placeholder: input.placeholder, testID: `${testID}-editor`, value: markdown }), _jsx(AskErrors, { errors: errors?.filter((error) => error.path !== "content.markdown"), testID: `${testID}-errors` }), _jsxs(Box, { direction: "row", gap: 2, wrap: true, children: [_jsx(Button, { disabled: isDisabled || !isDraftValid || (isAnswering && pendingActionId !== SUBMIT_ACTION_ID), loading: pendingActionId === SUBMIT_ACTION_ID, onClick: handleSubmit, testID: `${testID}-submit`, text: input.submitLabel ?? "Submit", wrapText: true }), _jsx(SkipButton, { ask: ask, renderButton: renderButton })] })] }));
|
|
48
|
+
};
|
|
49
|
+
/** The start of a long answer, cut at a word boundary when one falls in its second half. */
|
|
50
|
+
const previewOf = (markdown) => {
|
|
51
|
+
let kept = markdown.slice(0, MARKDOWN_ANSWER_PREVIEW_LENGTH);
|
|
52
|
+
const boundary = kept.search(WORD_BOUNDARY);
|
|
53
|
+
if (boundary >= MARKDOWN_ANSWER_PREVIEW_LENGTH / 2) {
|
|
54
|
+
kept = kept.slice(0, boundary);
|
|
55
|
+
}
|
|
56
|
+
return `${kept.trimEnd()}…`;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The text an answered `markdown` ask sent back, under its summary line. A long answer shows a
|
|
60
|
+
* preview with Show all, so it does not push the rest of the transcript out of view.
|
|
61
|
+
*/
|
|
62
|
+
export const AskMarkdownAnswer = ({ markdown, testID, }) => {
|
|
63
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
64
|
+
const isLong = markdown.length > MARKDOWN_ANSWER_PREVIEW_LENGTH;
|
|
65
|
+
const handleToggle = useCallback(() => {
|
|
66
|
+
setIsExpanded((wasExpanded) => !wasExpanded);
|
|
67
|
+
}, []);
|
|
68
|
+
if (markdown.trim() === "") {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return (_jsxs(Box, { border: "default", gap: 2, padding: 3, rounding: "md", testID: `${testID}-answer`, children: [_jsx(MarkdownView, { children: isLong && !isExpanded ? previewOf(markdown) : markdown }), isLong ? (_jsx(Box, { alignSelf: "start", children: _jsx(Button, { iconName: isExpanded ? "chevron-up" : "chevron-down", onClick: handleToggle, testID: `${testID}-answer-toggle`, text: isExpanded ? "Show less" : "Show all", variant: "ghost" }) })) : null] }));
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=AskMarkdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AskMarkdown.js","sourceRoot":"","sources":["../../src/asks/AskMarkdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAErD,OAAO,EAAC,GAAG,EAAC,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAuB,SAAS,EAAE,UAAU,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AAGzC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC,6FAA6F;AAC7F,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAElD,MAAM,aAAa,GAAG,QAAQ,CAAC;AAM/B,2FAA2F;AAC3F,MAAM,UAAU,GAAG,CAAC,KAAuB,EAAE,QAAgB,EAA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aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,GAAG,8BAA8B,CAAC;IAEhE,MAAM,YAAY,GAAG,WAAW,CAAC,GAAS,EAAE;QAC1C,aAAa,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC;IAC/C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,MAAC,GAAG,IAAC,MAAM,EAAC,SAAS,EAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAC,IAAI,EAAC,MAAM,EAAE,GAAG,MAAM,SAAS,aAChF,KAAC,YAAY,cAAE,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAgB,EACpF,MAAM,CAAC,CAAC,CAAC,CACR,KAAC,GAAG,IAAC,SAAS,EAAC,OAAO,YACpB,KAAC,MAAM,IACL,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,EACpD,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,GAAG,MAAM,gBAAgB,EACjC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,EAC3C,OAAO,EAAC,OAAO,GACf,GACE,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SimpleCard, SimpleCardButton } from "@terreno/blocks";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export interface SimpleAskCardProps {
|
|
4
|
+
/** The ask's simple card: `pendingAsk.simple` from the server, or `simple` on an `{ask}` event. */
|
|
5
|
+
card: SimpleCard;
|
|
6
|
+
/**
|
|
7
|
+
* Called with the pressed button. Send `{toolCallId: card.toolCallId, buttonId: button.id}` to
|
|
8
|
+
* the history's `turn` action; the server answers with that button's stored `response`.
|
|
9
|
+
*/
|
|
10
|
+
onPress: (button: SimpleCardButton) => void | Promise<void>;
|
|
11
|
+
/** The button whose answer is still sending. It shows a spinner and the other buttons are disabled. */
|
|
12
|
+
pendingButtonId?: string;
|
|
13
|
+
testID?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Any ask as a small-screen card: its title, its question, and up to three buttons that each send an
|
|
17
|
+
* exact answer. For watch-sized and other narrow layouts; it renders every kind the same way. A
|
|
18
|
+
* `handoff` card cannot offer every answer, so it tells the user to continue on their phone ("Edit
|
|
19
|
+
* on your phone" for a `markdown` card, "Fill it in on your phone" for a `form` card, "Upload on your
|
|
20
|
+
* phone" for a `files` card).
|
|
21
|
+
*/
|
|
22
|
+
export declare const SimpleAskCard: React.FC<SimpleAskCardProps>;
|
|
23
|
+
//# sourceMappingURL=SimpleAskCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleAskCard.d.ts","sourceRoot":"","sources":["../../src/asks/SimpleAskCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,UAAU,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B,MAAM,WAAW,kBAAkB;IACjC,mGAAmG;IACnG,IAAI,EAAE,UAAU,CAAC;IACjB;;;OAGG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,uGAAuG;IACvG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA0CtD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { Box } from "../Box";
|
|
4
|
+
import { Button } from "../Button";
|
|
5
|
+
import { Heading } from "../Heading";
|
|
6
|
+
import { Text } from "../Text";
|
|
7
|
+
import { SIMPLE_CARD_BUTTON_VARIANTS } from "./simpleCardButtonVariants";
|
|
8
|
+
const DEFAULT_HANDOFF_TEXT = "Continue on your phone";
|
|
9
|
+
/** A handoff line that names what the phone is for, where the card's kind says so. */
|
|
10
|
+
const HANDOFF_TEXT_BY_KIND = {
|
|
11
|
+
files: "Upload on your phone",
|
|
12
|
+
form: "Fill it in on your phone",
|
|
13
|
+
markdown: "Edit on your phone",
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Any ask as a small-screen card: its title, its question, and up to three buttons that each send an
|
|
17
|
+
* exact answer. For watch-sized and other narrow layouts; it renders every kind the same way. A
|
|
18
|
+
* `handoff` card cannot offer every answer, so it tells the user to continue on their phone ("Edit
|
|
19
|
+
* on your phone" for a `markdown` card, "Fill it in on your phone" for a `form` card, "Upload on your
|
|
20
|
+
* phone" for a `files` card).
|
|
21
|
+
*/
|
|
22
|
+
export const SimpleAskCard = ({ card, onPress, pendingButtonId, testID = "simple-ask-card", }) => {
|
|
23
|
+
const isSending = pendingButtonId !== undefined;
|
|
24
|
+
const handlePress = useCallback((button) => {
|
|
25
|
+
if (isSending) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
return onPress(button);
|
|
29
|
+
}, [isSending, onPress]);
|
|
30
|
+
return (_jsxs(Box, { gap: 2, testID: testID, children: [card.title === undefined ? null : _jsx(Heading, { size: "sm", children: card.title }), _jsx(Text, { children: card.text }), card.handoff ? (_jsx(Text, { color: "secondaryDark", size: "sm", testID: `${testID}-handoff`, children: HANDOFF_TEXT_BY_KIND[card.kind] ?? DEFAULT_HANDOFF_TEXT })) : null, card.buttons.map((button) => (_jsx(Button, { disabled: isSending && pendingButtonId !== button.id, fullWidth: true, loading: pendingButtonId === button.id, onClick: () => handlePress(button), testID: `${testID}-button-${button.id}`, text: button.label, variant: SIMPLE_CARD_BUTTON_VARIANTS[button.style], wrapText: true }, button.id)))] }));
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=SimpleAskCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleAskCard.js","sourceRoot":"","sources":["../../src/asks/SimpleAskCard.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,WAAW,EAAC,MAAM,OAAO,CAAC;AAElC,OAAO,EAAC,GAAG,EAAC,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,2BAA2B,EAAC,MAAM,4BAA4B,CAAC;AAEvE,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAEtD,sFAAsF;AACtF,MAAM,oBAAoB,GAAqC;IAC7D,KAAK,EAAE,sBAAsB;IAC7B,IAAI,EAAE,0BAA0B;IAChC,QAAQ,EAAE,oBAAoB;CAC/B,CAAC;AAeF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAC1D,IAAI,EACJ,OAAO,EACP,eAAe,EACf,MAAM,GAAG,iBAAiB,GAC3B,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,eAAe,KAAK,SAAS,CAAC;IAEhD,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,MAAwB,EAAwB,EAAE;QACjD,IAAI,SAAS,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,EACD,CAAC,SAAS,EAAE,OAAO,CAAC,CACrB,CAAC;IAEF,OAAO,CACL,MAAC,GAAG,IAAC,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,aACxB,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,IAAI,EAAC,IAAI,YAAE,IAAI,CAAC,KAAK,GAAW,EAC5E,KAAC,IAAI,cAAE,IAAI,CAAC,IAAI,GAAQ,EACvB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CACd,KAAC,IAAI,IAAC,KAAK,EAAC,eAAe,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,EAAE,GAAG,MAAM,UAAU,YAC9D,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,oBAAoB,GACnD,CACR,CAAC,CAAC,CAAC,IAAI,EACP,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC5B,KAAC,MAAM,IACL,QAAQ,EAAE,SAAS,IAAI,eAAe,KAAK,MAAM,CAAC,EAAE,EACpD,SAAS,QAET,OAAO,EAAE,eAAe,KAAK,MAAM,CAAC,EAAE,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,EAClC,MAAM,EAAE,GAAG,MAAM,WAAW,MAAM,CAAC,EAAE,EAAE,EACvC,IAAI,EAAE,MAAM,CAAC,KAAK,EAClB,OAAO,EAAE,2BAA2B,CAAC,MAAM,CAAC,KAAK,CAAC,EAClD,QAAQ,UANH,MAAM,CAAC,EAAE,CAOd,CACH,CAAC,IACE,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Ask, type AskResponse, type AskValidationError, type SimpleCardButton } from "@terreno/blocks";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export declare const SKIP_BUTTON: SimpleCardButton;
|
|
4
|
+
/** An answer from one of the card's controls, named so the card can show that control loading. */
|
|
5
|
+
export interface AskAction {
|
|
6
|
+
actionId: string;
|
|
7
|
+
response: AskResponse;
|
|
8
|
+
}
|
|
9
|
+
/** The props every kind's controls receive from `AskCard`. */
|
|
10
|
+
export interface AskControlProps {
|
|
11
|
+
errors?: AskValidationError[];
|
|
12
|
+
/** True when the host takes no answers: buttons are disabled and radio options are plain text. */
|
|
13
|
+
isDisabled: boolean;
|
|
14
|
+
onAnswer: (action: AskAction) => void | Promise<void>;
|
|
15
|
+
/** The control whose answer the host is still handling. */
|
|
16
|
+
pendingActionId?: string;
|
|
17
|
+
testID: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const AskErrors: ({ errors, testID, }: {
|
|
20
|
+
errors?: AskValidationError[];
|
|
21
|
+
testID: string;
|
|
22
|
+
}) => React.ReactElement | null;
|
|
23
|
+
/** Skip, for an ask that accepts a decline. */
|
|
24
|
+
export declare const SkipButton: ({ ask, renderButton, }: {
|
|
25
|
+
ask: Ask;
|
|
26
|
+
renderButton: (button: SimpleCardButton) => React.ReactElement;
|
|
27
|
+
}) => React.ReactElement | null;
|
|
28
|
+
/**
|
|
29
|
+
* Renders a simple-card button that answers on press. While one answer is sending, that button
|
|
30
|
+
* shows a spinner and the others are disabled.
|
|
31
|
+
*/
|
|
32
|
+
export declare const useAnswerButton: ({ isDisabled, onAnswer, pendingActionId, testID, }: Pick<AskControlProps, "isDisabled" | "onAnswer" | "pendingActionId" | "testID">) => ((button: SimpleCardButton) => React.ReactElement);
|
|
33
|
+
//# sourceMappingURL=askControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"askControls.d.ts","sourceRoot":"","sources":["../../src/asks/askControls.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,kBAAkB,EAEvB,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,eAAO,MAAM,WAAW,EAAE,gBAKzB,CAAC;AAEF,kGAAkG;AAClG,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,WAAW,CAAC;CACvB;AAED,8DAA8D;AAC9D,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC9B,kGAAkG;IAClG,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,SAAS,GAAI,qBAGvB;IACD,MAAM,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB,KAAG,KAAK,CAAC,YAAY,GAAG,IAaxB,CAAC;AAEF,+CAA+C;AAC/C,eAAO,MAAM,UAAU,GAAI,wBAGxB;IACD,GAAG,EAAE,GAAG,CAAC;IACT,YAAY,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,KAAK,CAAC,YAAY,CAAC;CAChE,KAAG,KAAK,CAAC,YAAY,GAAG,IAAkE,CAAC;AAE5F;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,oDAK7B,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,UAAU,GAAG,iBAAiB,GAAG,QAAQ,CAAC,KAAG,CAAC,CACpF,MAAM,EAAE,gBAAgB,KACrB,KAAK,CAAC,YAAY,CAiBtB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { askAllowsDecline, } from "@terreno/blocks";
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { Box } from "../Box";
|
|
5
|
+
import { Button } from "../Button";
|
|
6
|
+
import { Text } from "../Text";
|
|
7
|
+
import { SIMPLE_CARD_BUTTON_VARIANTS } from "./simpleCardButtonVariants";
|
|
8
|
+
export const SKIP_BUTTON = {
|
|
9
|
+
id: "skip",
|
|
10
|
+
label: "Skip",
|
|
11
|
+
response: { action: "decline" },
|
|
12
|
+
style: "cancel",
|
|
13
|
+
};
|
|
14
|
+
export const AskErrors = ({ errors, testID, }) => {
|
|
15
|
+
if (!errors || errors.length === 0) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return (_jsx(Box, { gap: 1, testID: testID, children: errors.map((error) => (_jsx(Text, { color: "error", size: "sm", children: error.message }, `${error.path}:${error.code}`))) }));
|
|
19
|
+
};
|
|
20
|
+
/** Skip, for an ask that accepts a decline. */
|
|
21
|
+
export const SkipButton = ({ ask, renderButton, }) => (askAllowsDecline(ask) ? renderButton(SKIP_BUTTON) : null);
|
|
22
|
+
/**
|
|
23
|
+
* Renders a simple-card button that answers on press. While one answer is sending, that button
|
|
24
|
+
* shows a spinner and the others are disabled.
|
|
25
|
+
*/
|
|
26
|
+
export const useAnswerButton = ({ isDisabled, onAnswer, pendingActionId, testID, }) => {
|
|
27
|
+
const isAnswering = pendingActionId !== undefined;
|
|
28
|
+
return useCallback((button) => (_jsx(Button, { disabled: isDisabled || (isAnswering && pendingActionId !== button.id), loading: pendingActionId === button.id, onClick: () => onAnswer({ actionId: button.id, response: button.response }), testID: `${testID}-button-${button.id}`, text: button.label, variant: SIMPLE_CARD_BUTTON_VARIANTS[button.style], wrapText: true }, button.id)), [isAnswering, isDisabled, onAnswer, pendingActionId, testID]);
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=askControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"askControls.js","sourceRoot":"","sources":["../../src/asks/askControls.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,gBAAgB,GAEjB,MAAM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,GAAG,CAAC,EAC9B,UAAU,EACV,QAAQ,EACR,eAAe,EACf,MAAM,GAC0E,EAEzD,EAAE;IACzB,MAAM,WAAW,GAAG,eAAe,KAAK,SAAS,CAAC;IAClD,OAAO,WAAW,CAChB,CAAC,MAAwB,EAAsB,EAAE,CAAC,CAChD,KAAC,MAAM,IACL,QAAQ,EAAE,UAAU,IAAI,CAAC,WAAW,IAAI,eAAe,KAAK,MAAM,CAAC,EAAE,CAAC,EAEtE,OAAO,EAAE,eAAe,KAAK,MAAM,CAAC,EAAE,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAC,CAAC,EACzE,MAAM,EAAE,GAAG,MAAM,WAAW,MAAM,CAAC,EAAE,EAAE,EACvC,IAAI,EAAE,MAAM,CAAC,KAAK,EAClB,OAAO,EAAE,2BAA2B,CAAC,MAAM,CAAC,KAAK,CAAC,EAClD,QAAQ,UANH,MAAM,CAAC,EAAE,CAOd,CACH,EACD,CAAC,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,CAAC,CAC7D,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AskFileRef } from "@terreno/blocks";
|
|
2
|
+
import type { SelectedFile } from "../FilePickerButton";
|
|
3
|
+
/**
|
|
4
|
+
* Turns the files a user picked for a `files` ask into the refs its answer sends. Hosts with file
|
|
5
|
+
* storage upload each file and return `{fileId}` refs; others encode `{url}` data URLs. Throw to
|
|
6
|
+
* keep the ask open: the card shows that the files could not be sent.
|
|
7
|
+
*/
|
|
8
|
+
export type AskFilesResolver = (files: SelectedFile[]) => Promise<AskFileRef[]>;
|
|
9
|
+
/** The MIME type without parameters, lowercased: "Text/CSV; charset=utf-8" becomes "text/csv". */
|
|
10
|
+
export declare const normalizeMimeType: (mimeType: string) => string;
|
|
11
|
+
/**
|
|
12
|
+
* A picked file's MIME type, normalized. When the picker reports no type or a generic one, the
|
|
13
|
+
* type of the file's extension, if a `files` ask can accept that extension.
|
|
14
|
+
*/
|
|
15
|
+
export declare const selectedFileMimeType: (file: {
|
|
16
|
+
mimeType: string;
|
|
17
|
+
name: string;
|
|
18
|
+
}) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Reads a picked file into a `{url}` ref: a base64 data URL whose media type is the file's
|
|
21
|
+
* `selectedFileMimeType`, with the size of its bytes.
|
|
22
|
+
*/
|
|
23
|
+
export declare const selectedFileToDataUrlRef: (file: SelectedFile) => Promise<AskFileRef>;
|
|
24
|
+
/** The default `AskFilesResolver`: every file as a data URL, for hosts without file storage. */
|
|
25
|
+
export declare const resolveAskFilesAsDataUrls: AskFilesResolver;
|
|
26
|
+
//# sourceMappingURL=askFileRefs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"askFileRefs.d.ts","sourceRoot":"","sources":["../../src/asks/askFileRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;AAEhF,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,KAAG,MACA,CAAC;AAyBtD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,KAAG,MAO7E,CAAC;AA+BF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAU,MAAM,YAAY,KAAG,OAAO,CAAC,UAAU,CASrF,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,yBAAyB,EAAE,gBACU,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** The MIME type without parameters, lowercased: "Text/CSV; charset=utf-8" becomes "text/csv". */
|
|
2
|
+
export const normalizeMimeType = (mimeType) => (mimeType.split(";")[0] ?? "").trim().toLowerCase();
|
|
3
|
+
/**
|
|
4
|
+
* Types pickers report when they do not know the file's type. Windows browsers report a CSV as
|
|
5
|
+
* `application/vnd.ms-excel` when Excel is installed.
|
|
6
|
+
*/
|
|
7
|
+
const GENERIC_MIME_TYPES = [
|
|
8
|
+
"",
|
|
9
|
+
"application/octet-stream",
|
|
10
|
+
"application/vnd.ms-excel",
|
|
11
|
+
];
|
|
12
|
+
/** The type of each extension a `files` ask can accept. */
|
|
13
|
+
const MIME_TYPE_BY_EXTENSION = {
|
|
14
|
+
csv: "text/csv",
|
|
15
|
+
gif: "image/gif",
|
|
16
|
+
jpeg: "image/jpeg",
|
|
17
|
+
jpg: "image/jpeg",
|
|
18
|
+
json: "application/json",
|
|
19
|
+
pdf: "application/pdf",
|
|
20
|
+
png: "image/png",
|
|
21
|
+
txt: "text/plain",
|
|
22
|
+
webp: "image/webp",
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A picked file's MIME type, normalized. When the picker reports no type or a generic one, the
|
|
26
|
+
* type of the file's extension, if a `files` ask can accept that extension.
|
|
27
|
+
*/
|
|
28
|
+
export const selectedFileMimeType = (file) => {
|
|
29
|
+
const reported = normalizeMimeType(file.mimeType);
|
|
30
|
+
if (!GENERIC_MIME_TYPES.includes(reported)) {
|
|
31
|
+
return reported;
|
|
32
|
+
}
|
|
33
|
+
const extension = file.name.includes(".") ? file.name.split(".").pop()?.toLowerCase() : "";
|
|
34
|
+
return MIME_TYPE_BY_EXTENSION[extension ?? ""] ?? reported;
|
|
35
|
+
};
|
|
36
|
+
const readViaFileReader = (blob) => new Promise((resolve, reject) => {
|
|
37
|
+
const reader = new FileReader();
|
|
38
|
+
reader.onload = () => {
|
|
39
|
+
const result = String(reader.result ?? "");
|
|
40
|
+
resolve(result.slice(result.indexOf(",") + 1));
|
|
41
|
+
};
|
|
42
|
+
reader.onerror = () => reject(reader.error ?? new Error("The file could not be read."));
|
|
43
|
+
reader.readAsDataURL(blob);
|
|
44
|
+
});
|
|
45
|
+
const readViaArrayBuffer = async (blob) => {
|
|
46
|
+
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
47
|
+
let binary = "";
|
|
48
|
+
for (const byte of bytes) {
|
|
49
|
+
binary += String.fromCharCode(byte);
|
|
50
|
+
}
|
|
51
|
+
return btoa(binary);
|
|
52
|
+
};
|
|
53
|
+
const base64Of = async (uri) => {
|
|
54
|
+
const response = await fetch(uri);
|
|
55
|
+
const blob = await response.blob();
|
|
56
|
+
return typeof FileReader === "undefined" ? readViaArrayBuffer(blob) : readViaFileReader(blob);
|
|
57
|
+
};
|
|
58
|
+
const decodedLength = (base64) => Math.floor((base64.length * 3) / 4) - (base64.endsWith("==") ? 2 : base64.endsWith("=") ? 1 : 0);
|
|
59
|
+
/**
|
|
60
|
+
* Reads a picked file into a `{url}` ref: a base64 data URL whose media type is the file's
|
|
61
|
+
* `selectedFileMimeType`, with the size of its bytes.
|
|
62
|
+
*/
|
|
63
|
+
export const selectedFileToDataUrlRef = async (file) => {
|
|
64
|
+
const mimeType = selectedFileMimeType(file);
|
|
65
|
+
const base64 = await base64Of(file.uri);
|
|
66
|
+
return {
|
|
67
|
+
filename: file.name,
|
|
68
|
+
mimeType,
|
|
69
|
+
size: decodedLength(base64),
|
|
70
|
+
url: `data:${mimeType};base64,${base64}`,
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
/** The default `AskFilesResolver`: every file as a data URL, for hosts without file storage. */
|
|
74
|
+
export const resolveAskFilesAsDataUrls = (files) => Promise.all(files.map(selectedFileToDataUrlRef));
|
|
75
|
+
//# sourceMappingURL=askFileRefs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"askF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,CAAC;AAChG,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,MAAc,EAAU,EAAE,CAC/C,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnG;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EAAE,IAAkB,EAAuB,EAAE;IACxF,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxC,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,IAAI;QACnB,QAAQ;QACR,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC;QAC3B,GAAG,EAAE,QAAQ,QAAQ,WAAW,MAAM,EAAE;KACzC,CAAC;AACJ,CAAC,CAAC;AAEF,gGAAgG;AAChG,MAAM,CAAC,MAAM,yBAAyB,GAAqB,CAAC,KAAK,EAAE,EAAE,CACnE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type AskValidationError, type FormAskInput, type FormField, type FormValue } from "@terreno/blocks";
|
|
2
|
+
/**
|
|
3
|
+
* What each form control edits: text for text-like, number, and date fields (dates in the answer's
|
|
4
|
+
* ISO format), a boolean for checkboxes, and option ids for selects.
|
|
5
|
+
*/
|
|
6
|
+
export type FormDraftValue = boolean | string | string[];
|
|
7
|
+
export type FormDraft = Record<string, FormDraftValue>;
|
|
8
|
+
type DateFieldType = "date" | "datetime" | "time";
|
|
9
|
+
/**
|
|
10
|
+
* Field ids whose date control holds an unfinished or invalid entry, such as "0 / 5 / 026". The
|
|
11
|
+
* draft cannot hold such an entry, so these block Submit until the user finishes or clears them.
|
|
12
|
+
*/
|
|
13
|
+
export type UnfinishedEntries = Record<string, true>;
|
|
14
|
+
/** What a date field says while its control holds an unfinished entry; undefined for other types. */
|
|
15
|
+
export declare const unfinishedEntryText: (field: FormField) => string | undefined;
|
|
16
|
+
/** The draft a form starts from: each field's default, or empty. Checkboxes start unchecked. */
|
|
17
|
+
export declare const initialFormDraft: (input: FormAskInput) => FormDraft;
|
|
18
|
+
/**
|
|
19
|
+
* The answer's `values` for a draft. Blank fields are left out; checkboxes are always sent, since
|
|
20
|
+
* unchecked is an answer. Text that does not parse stays text so validation can say why.
|
|
21
|
+
*/
|
|
22
|
+
export declare const formDraftValues: ({ draft, input, }: {
|
|
23
|
+
draft: FormDraft;
|
|
24
|
+
input: FormAskInput;
|
|
25
|
+
}) => Record<string, FormValue>;
|
|
26
|
+
/** The UTC ISO value `DateTimeField` shows for an answer-format date, time, or datetime. */
|
|
27
|
+
export declare const toPickerValue: ({ timezone, type, value, }: {
|
|
28
|
+
timezone: string;
|
|
29
|
+
type: DateFieldType;
|
|
30
|
+
value: string;
|
|
31
|
+
}) => string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* The answer-format value for what `DateTimeField` emitted: YYYY-MM-DD, 24-hour HH:mm in the
|
|
34
|
+
* picker's timezone, or an ISO datetime with the picker timezone's offset.
|
|
35
|
+
*/
|
|
36
|
+
export declare const fromPickerValue: ({ iso, timezone, type, }: {
|
|
37
|
+
iso: string;
|
|
38
|
+
timezone: string;
|
|
39
|
+
type: DateFieldType;
|
|
40
|
+
}) => string;
|
|
41
|
+
/** Whether an error's path points at a field's value or one of its items. */
|
|
42
|
+
export declare const isFormFieldError: (error: AskValidationError, field: FormField) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Plain words for the first error on a field, such as "Enter a number from 1 to 500.", or the
|
|
45
|
+
* error's own message when no plainer text fits.
|
|
46
|
+
*/
|
|
47
|
+
export declare const formFieldErrorText: ({ errors, field, }: {
|
|
48
|
+
errors: AskValidationError[];
|
|
49
|
+
field: FormField;
|
|
50
|
+
}) => string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* One answered value as the user would read it: Yes or No, option labels, a readable date or
|
|
53
|
+
* time, or text shortened to one line.
|
|
54
|
+
*/
|
|
55
|
+
export declare const formatFormValue: ({ field, value }: {
|
|
56
|
+
field: FormField;
|
|
57
|
+
value: unknown;
|
|
58
|
+
}) => string;
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=askFormDraft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"askFormDraft.d.ts","sourceRoot":"","sources":["../../src/asks/askFormDraft.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EAEf,MAAM,iBAAiB,CAAC;AAMzB;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAEzD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAEvD,KAAK,aAAa,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;AAclD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAErD,qGAAqG;AACrG,eAAO,MAAM,mBAAmB,GAAI,OAAO,SAAS,KAAG,MAAM,GAAG,SAGjD,CAAC;AAEhB,gGAAgG;AAChG,eAAO,MAAM,gBAAgB,GAAI,OAAO,YAAY,KAAG,SAcpD,CAAC;AAyBJ;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,mBAG7B;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,E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