altitude-design 0.2.1 → 0.3.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/README.md +41 -6
- package/dist/adapters/codemirror.cjs +88 -0
- package/dist/adapters/codemirror.cjs.map +7 -0
- package/dist/adapters/codemirror.js +67 -0
- package/dist/adapters/codemirror.js.map +7 -0
- package/dist/adapters/react-flow.css +102 -0
- package/dist/adapters/tiptap.css +71 -0
- package/dist/altitude.css +3121 -244
- package/dist/altitude.iife.js +33 -5
- package/dist/altitude.no-fonts.css +3121 -244
- package/dist/chart-themes.cjs +195 -0
- package/dist/chart-themes.cjs.map +7 -0
- package/dist/chart-themes.js +165 -0
- package/dist/chart-themes.js.map +7 -0
- package/dist/cli/altitude.mjs +134 -0
- package/dist/guidance/README.md +32 -0
- package/dist/guidance/agent-setup.md +22 -0
- package/dist/guidance/app-skeleton.md +17 -0
- package/dist/guidance/evidence.json +95 -0
- package/dist/guidance/index.json +493 -0
- package/dist/guidance/llms.txt +20 -0
- package/dist/guidance/manifest.json +92 -0
- package/dist/guidance/pattern.schema.json +181 -0
- package/dist/guidance/patterns/agent-action.json +77 -0
- package/dist/guidance/patterns/agent-action.md +39 -0
- package/dist/guidance/patterns/assistant-conversation.json +77 -0
- package/dist/guidance/patterns/assistant-conversation.md +50 -0
- package/dist/guidance/patterns/async-collection.json +71 -0
- package/dist/guidance/patterns/async-collection.md +29 -0
- package/dist/guidance/patterns/audit-log.json +75 -0
- package/dist/guidance/patterns/audit-log.md +27 -0
- package/dist/guidance/patterns/auth.json +86 -0
- package/dist/guidance/patterns/auth.md +29 -0
- package/dist/guidance/patterns/billing.json +80 -0
- package/dist/guidance/patterns/billing.md +29 -0
- package/dist/guidance/patterns/consequential-action.json +76 -0
- package/dist/guidance/patterns/consequential-action.md +27 -0
- package/dist/guidance/patterns/developer-settings.json +79 -0
- package/dist/guidance/patterns/developer-settings.md +29 -0
- package/dist/guidance/patterns/edit-record.json +74 -0
- package/dist/guidance/patterns/edit-record.md +51 -0
- package/dist/guidance/patterns/import.json +77 -0
- package/dist/guidance/patterns/import.md +31 -0
- package/dist/guidance/patterns/members.json +77 -0
- package/dist/guidance/patterns/members.md +27 -0
- package/dist/guidance/patterns/onboarding.json +78 -0
- package/dist/guidance/patterns/onboarding.md +31 -0
- package/dist/guidance/patterns/review-submit.json +72 -0
- package/dist/guidance/patterns/review-submit.md +27 -0
- package/dist/guidance/patterns/screen-layout.json +79 -0
- package/dist/guidance/patterns/screen-layout.md +40 -0
- package/dist/guidance/patterns/settings.json +78 -0
- package/dist/guidance/patterns/settings.md +32 -0
- package/dist/guidance/patterns/sync.json +77 -0
- package/dist/guidance/patterns/sync.md +31 -0
- package/dist/guidance/principles.md +23 -0
- package/dist/guidance/references/build/checks/agent-action-pattern.mjs +57 -0
- package/dist/guidance/references/build/checks/agent-setup.mjs +78 -0
- package/dist/guidance/references/build/checks/assistant-conversation-pattern.mjs +49 -0
- package/dist/guidance/references/build/checks/audit-log-pattern.mjs +63 -0
- package/dist/guidance/references/build/checks/auth-pattern.mjs +67 -0
- package/dist/guidance/references/build/checks/billing-pattern.mjs +63 -0
- package/dist/guidance/references/build/checks/developer-settings-pattern.mjs +76 -0
- package/dist/guidance/references/build/checks/guidance.mjs +71 -0
- package/dist/guidance/references/build/checks/import-pattern.mjs +69 -0
- package/dist/guidance/references/build/checks/members-pattern.mjs +71 -0
- package/dist/guidance/references/build/checks/onboarding-pattern.mjs +54 -0
- package/dist/guidance/references/build/checks/pattern-types.mjs +13 -0
- package/dist/guidance/references/build/checks/pattern-workflows.mjs +226 -0
- package/dist/guidance/references/build/checks/primary-scope.mjs +49 -0
- package/dist/guidance/references/build/checks/render-tells.mjs +72 -0
- package/dist/guidance/references/build/checks/screen-layout-pattern.mjs +111 -0
- package/dist/guidance/references/build/checks/semantics.mjs +72 -0
- package/dist/guidance/references/build/checks/settings-pattern.mjs +73 -0
- package/dist/guidance/references/build/checks/sync-pattern.mjs +62 -0
- package/dist/guidance/references/build/checks/tells-lint.mjs +164 -0
- package/dist/guidance/references/build/fixtures/pattern-workflows.tsx +83 -0
- package/dist/guidance/references/build/fixtures/patterns/agent-action.jsx +60 -0
- package/dist/guidance/references/build/fixtures/patterns/app-skeleton.jsx +94 -0
- package/dist/guidance/references/build/fixtures/patterns/assistant-conversation.jsx +79 -0
- package/dist/guidance/references/build/fixtures/patterns/audit-log.jsx +81 -0
- package/dist/guidance/references/build/fixtures/patterns/auth.jsx +150 -0
- package/dist/guidance/references/build/fixtures/patterns/billing.jsx +96 -0
- package/dist/guidance/references/build/fixtures/patterns/developer-settings.jsx +95 -0
- package/dist/guidance/references/build/fixtures/patterns/import.jsx +102 -0
- package/dist/guidance/references/build/fixtures/patterns/members.jsx +106 -0
- package/dist/guidance/references/build/fixtures/patterns/onboarding.jsx +70 -0
- package/dist/guidance/references/build/fixtures/patterns/screen-layout-decision.jsx +74 -0
- package/dist/guidance/references/build/fixtures/patterns/screen-layout-editor.jsx +56 -0
- package/dist/guidance/references/build/fixtures/patterns/screen-layout-report.jsx +42 -0
- package/dist/guidance/references/build/fixtures/patterns/settings.jsx +73 -0
- package/dist/guidance/references/build/fixtures/patterns/sync.jsx +78 -0
- package/dist/guidance/references/project/components/src/pattern-async-collection.tsx +57 -0
- package/dist/guidance/references/project/components/src/pattern-consequential-action.tsx +77 -0
- package/dist/guidance/references/project/components/src/pattern-edit-record.tsx +127 -0
- package/dist/guidance/references/project/components/src/pattern-review-submit.tsx +47 -0
- package/dist/guidance/references/project/components/src/settings.tsx +79 -0
- package/dist/guidance/references/scripts/build-framework-fixture.mjs +20 -0
- package/dist/guidance/rules.json +653 -0
- package/dist/guidance/visual/Elevation.md +194 -0
- package/dist/guidance/visual/Fundamentals.md +83 -0
- package/dist/guidance/visual/Research.md +1620 -0
- package/dist/index.cjs +18792 -1925
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +18792 -1925
- package/dist/index.js.map +4 -4
- package/dist/tokens.css +84 -84
- package/dist/tokens.json +301 -128
- package/dist/types/adapter-codemirror.d.ts +13 -0
- package/dist/types/agent-fleet.d.ts +166 -0
- package/dist/types/ai-label.d.ts +30 -0
- package/dist/types/app-shell.d.ts +83 -0
- package/dist/types/area-chart.d.ts +80 -0
- package/dist/types/artifact.d.ts +65 -0
- package/dist/types/bar-chart.d.ts +83 -0
- package/dist/types/bar-list.d.ts +35 -0
- package/dist/types/breadcrumb.d.ts +62 -0
- package/dist/types/chart-brush.d.ts +35 -0
- package/dist/types/chart-themes.d.ts +229 -0
- package/dist/types/chart.d.ts +570 -0
- package/dist/types/checklist.d.ts +71 -0
- package/dist/types/code-block.d.ts +32 -0
- package/dist/types/collections.d.ts +111 -4
- package/dist/types/color-picker.d.ts +38 -0
- package/dist/types/command.d.ts +6 -3
- package/dist/types/comment-thread.d.ts +48 -0
- package/dist/types/confirmation.d.ts +60 -0
- package/dist/types/context-menu.d.ts +17 -0
- package/dist/types/controls.d.ts +100 -17
- package/dist/types/conversation.d.ts +130 -0
- package/dist/types/copy-button.d.ts +19 -0
- package/dist/types/core.d.ts +139 -10
- package/dist/types/data-grid.d.ts +76 -0
- package/dist/types/date-picker.d.ts +96 -0
- package/dist/types/diff-view.d.ts +54 -0
- package/dist/types/dot-plot.d.ts +54 -0
- package/dist/types/edit-region.d.ts +121 -0
- package/dist/types/feature-gate.d.ts +22 -0
- package/dist/types/filter-bar.d.ts +65 -0
- package/dist/types/formatted-number.d.ts +38 -0
- package/dist/types/heatmap.d.ts +64 -0
- package/dist/types/in-place.d.ts +24 -0
- package/dist/types/index.d.ts +158 -15
- package/dist/types/inline-citation.d.ts +35 -0
- package/dist/types/inline-edit.d.ts +71 -0
- package/dist/types/input-otp.d.ts +37 -0
- package/dist/types/item-group.d.ts +104 -0
- package/dist/types/line-chart.d.ts +116 -0
- package/dist/types/link.d.ts +11 -0
- package/dist/types/markdown.d.ts +88 -0
- package/dist/types/meter.d.ts +43 -0
- package/dist/types/modal-state.d.ts +62 -0
- package/dist/types/nav.d.ts +8 -1
- package/dist/types/notifications.d.ts +42 -0
- package/dist/types/number-input.d.ts +30 -0
- package/dist/types/overlays.d.ts +51 -17
- package/dist/types/page-header.d.ts +27 -0
- package/dist/types/pagination.d.ts +29 -0
- package/dist/types/palette.d.ts +64 -0
- package/dist/types/password-input.d.ts +22 -0
- package/dist/types/pattern-assistant-conversation.d.ts +55 -0
- package/dist/types/pattern-async-collection.d.ts +34 -0
- package/dist/types/pattern-consequential-action.d.ts +53 -0
- package/dist/types/pattern-edit-record.d.ts +72 -0
- package/dist/types/pattern-review-submit.d.ts +43 -0
- package/dist/types/permission-matrix.d.ts +34 -0
- package/dist/types/plan-picker.d.ts +40 -0
- package/dist/types/prompt-input.d.ts +106 -0
- package/dist/types/property-list.d.ts +67 -0
- package/dist/types/question.d.ts +64 -0
- package/dist/types/relative-time.d.ts +21 -0
- package/dist/types/removal-receipt.d.ts +1180 -0
- package/dist/types/resizable.d.ts +48 -0
- package/dist/types/roving.d.ts +44 -0
- package/dist/types/save-bar.d.ts +38 -0
- package/dist/types/saved-views.d.ts +72 -0
- package/dist/types/scatter-chart.d.ts +60 -0
- package/dist/types/schedule.d.ts +80 -0
- package/dist/types/secret-field.d.ts +33 -0
- package/dist/types/select.d.ts +44 -2
- package/dist/types/separator.d.ts +11 -0
- package/dist/types/settings.d.ts +39 -0
- package/dist/types/sheet.d.ts +1 -1
- package/dist/types/sparkline.d.ts +46 -0
- package/dist/types/split-button.d.ts +21 -0
- package/dist/types/stat.d.ts +54 -0
- package/dist/types/stepper.d.ts +6 -3
- package/dist/types/suggestions.d.ts +29 -0
- package/dist/types/suspense.d.ts +12 -1
- package/dist/types/sync-indicator.d.ts +24 -0
- package/dist/types/tag-input.d.ts +65 -0
- package/dist/types/terminal.d.ts +33 -0
- package/dist/types/thread-list.d.ts +58 -0
- package/dist/types/time-input.d.ts +33 -0
- package/dist/types/timeline.d.ts +38 -0
- package/dist/types/toggle.d.ts +46 -0
- package/dist/types/toolbar.d.ts +34 -0
- package/dist/types/tour.d.ts +23 -0
- package/dist/types/trace.d.ts +65 -0
- package/dist/types/tree.d.ts +71 -0
- package/dist/types-cjs/adapter-codemirror.d.cts +13 -0
- package/dist/types-cjs/agent-fleet.d.cts +166 -0
- package/dist/types-cjs/ai-label.d.cts +30 -0
- package/dist/types-cjs/app-shell.d.cts +83 -0
- package/dist/types-cjs/area-chart.d.cts +80 -0
- package/dist/types-cjs/artifact.d.cts +65 -0
- package/dist/types-cjs/bar-chart.d.cts +83 -0
- package/dist/types-cjs/bar-list.d.cts +35 -0
- package/dist/types-cjs/breadcrumb.d.cts +62 -0
- package/dist/types-cjs/chart-brush.d.cts +35 -0
- package/dist/types-cjs/chart-themes.d.cts +229 -0
- package/dist/types-cjs/chart.d.cts +570 -0
- package/dist/types-cjs/checklist.d.cts +71 -0
- package/dist/types-cjs/code-block.d.cts +32 -0
- package/dist/types-cjs/collections.d.cts +246 -0
- package/dist/types-cjs/color-picker.d.cts +38 -0
- package/dist/types-cjs/command.d.cts +66 -0
- package/dist/types-cjs/comment-thread.d.cts +48 -0
- package/dist/types-cjs/confirmation.d.cts +60 -0
- package/dist/types-cjs/context-menu.d.cts +17 -0
- package/dist/types-cjs/controls.d.cts +360 -0
- package/dist/types-cjs/conversation.d.cts +130 -0
- package/dist/types-cjs/copy-button.d.cts +19 -0
- package/dist/types-cjs/core.d.cts +256 -0
- package/dist/types-cjs/data-grid.d.cts +76 -0
- package/dist/types-cjs/date-picker.d.cts +96 -0
- package/dist/types-cjs/diff-view.d.cts +54 -0
- package/dist/types-cjs/dot-plot.d.cts +54 -0
- package/dist/types-cjs/edit-region.d.cts +121 -0
- package/dist/types-cjs/empty.d.cts +24 -0
- package/dist/types-cjs/feature-gate.d.cts +22 -0
- package/dist/types-cjs/filter-bar.d.cts +65 -0
- package/dist/types-cjs/formatted-number.d.cts +38 -0
- package/dist/types-cjs/heatmap.d.cts +64 -0
- package/dist/types-cjs/in-place.d.cts +24 -0
- package/dist/types-cjs/index.d.cts +154 -0
- package/dist/types-cjs/inline-citation.d.cts +35 -0
- package/dist/types-cjs/inline-edit.d.cts +71 -0
- package/dist/types-cjs/input-otp.d.cts +37 -0
- package/dist/types-cjs/item-group.d.cts +104 -0
- package/dist/types-cjs/line-chart.d.cts +116 -0
- package/dist/types-cjs/link.d.cts +11 -0
- package/dist/types-cjs/markdown.d.cts +88 -0
- package/dist/types-cjs/meter.d.cts +43 -0
- package/dist/types-cjs/modal-state.d.cts +62 -0
- package/dist/types-cjs/nav.d.cts +25 -0
- package/dist/types-cjs/notifications.d.cts +42 -0
- package/dist/types-cjs/number-input.d.cts +30 -0
- package/dist/types-cjs/overlays.d.cts +170 -0
- package/dist/types-cjs/page-header.d.cts +27 -0
- package/dist/types-cjs/pagination.d.cts +29 -0
- package/dist/types-cjs/palette.d.cts +64 -0
- package/dist/types-cjs/password-input.d.cts +22 -0
- package/dist/types-cjs/pattern-assistant-conversation.d.cts +55 -0
- package/dist/types-cjs/pattern-async-collection.d.cts +34 -0
- package/dist/types-cjs/pattern-consequential-action.d.cts +53 -0
- package/dist/types-cjs/pattern-edit-record.d.cts +72 -0
- package/dist/types-cjs/pattern-review-submit.d.cts +43 -0
- package/dist/types-cjs/permission-matrix.d.cts +34 -0
- package/dist/types-cjs/pile.d.cts +27 -0
- package/dist/types-cjs/plan-picker.d.cts +40 -0
- package/dist/types-cjs/prompt-input.d.cts +106 -0
- package/dist/types-cjs/property-list.d.cts +67 -0
- package/dist/types-cjs/question.d.cts +64 -0
- package/dist/types-cjs/relative-time.d.cts +21 -0
- package/dist/types-cjs/removal-receipt.d.cts +1180 -0
- package/dist/types-cjs/resizable.d.cts +48 -0
- package/dist/types-cjs/roving.d.cts +44 -0
- package/dist/types-cjs/save-bar.d.cts +38 -0
- package/dist/types-cjs/saved-views.d.cts +72 -0
- package/dist/types-cjs/scatter-chart.d.cts +60 -0
- package/dist/types-cjs/schedule.d.cts +80 -0
- package/dist/types-cjs/secret-field.d.cts +33 -0
- package/dist/types-cjs/select.d.cts +109 -0
- package/dist/types-cjs/separator.d.cts +11 -0
- package/dist/types-cjs/settings.d.cts +39 -0
- package/dist/types-cjs/sheet.d.cts +27 -0
- package/dist/types-cjs/sparkline.d.cts +46 -0
- package/dist/types-cjs/split-button.d.cts +21 -0
- package/dist/types-cjs/stat.d.cts +54 -0
- package/dist/types-cjs/stepper.d.cts +26 -0
- package/dist/types-cjs/suggestions.d.cts +29 -0
- package/dist/types-cjs/suspense.d.cts +85 -0
- package/dist/types-cjs/sync-indicator.d.cts +24 -0
- package/dist/types-cjs/tag-input.d.cts +65 -0
- package/dist/types-cjs/terminal.d.cts +33 -0
- package/dist/types-cjs/thread-list.d.cts +58 -0
- package/dist/types-cjs/time-input.d.cts +33 -0
- package/dist/types-cjs/timeline.d.cts +38 -0
- package/dist/types-cjs/toggle.d.cts +46 -0
- package/dist/types-cjs/toolbar.d.cts +34 -0
- package/dist/types-cjs/tour.d.cts +23 -0
- package/dist/types-cjs/trace.d.cts +65 -0
- package/dist/types-cjs/tree.d.cts +71 -0
- package/package.json +89 -9
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type PromptStatus = 'ready' | 'submitted' | 'streaming' | 'error';
|
|
3
|
+
export interface PromptAttachment {
|
|
4
|
+
id: string;
|
|
5
|
+
file: File;
|
|
6
|
+
name: string;
|
|
7
|
+
status?: 'pending';
|
|
8
|
+
}
|
|
9
|
+
export interface PromptMention {
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
kind?: 'file' | 'record' | 'person';
|
|
13
|
+
description?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PromptCommand {
|
|
16
|
+
name: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface PromptMessage {
|
|
20
|
+
text: string;
|
|
21
|
+
files: File[];
|
|
22
|
+
/** What was pointed at with @ and is still in the text. */
|
|
23
|
+
mentions?: PromptMention[];
|
|
24
|
+
/** The command chosen with / at the start, without its slash; it's taken out of `text`. */
|
|
25
|
+
command?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface PromptInputProps extends Omit<React.FormHTMLAttributes<HTMLFormElement>, 'onSubmit'> {
|
|
28
|
+
/** Called with the text and attached files when sent. */
|
|
29
|
+
onSubmit: (message: PromptMessage) => void;
|
|
30
|
+
/** 'submitted' and 'streaming' turn Send into Stop, in the same slot. Default 'ready'. */
|
|
31
|
+
status?: PromptStatus;
|
|
32
|
+
onStop?: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Lets a person queue a message while the agent works (#276): Enter while 'submitted' or 'streaming' calls this
|
|
35
|
+
* instead of doing nothing; the button stays Stop, the composer empties and keeps focus. Show the queue with
|
|
36
|
+
* ConversationQueue and send the first one when the turn ends.
|
|
37
|
+
*/
|
|
38
|
+
onQueue?: (message: PromptMessage) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Things to point the agent at (#283): typing @ opens a list of what matches, filtered as you type. A chosen one is
|
|
41
|
+
* "@label" in the text and a plate above it; Backspace after it removes it whole. A promise shows "Searching…".
|
|
42
|
+
*/
|
|
43
|
+
mentionable?: (query: string) => PromptMention[] | Promise<PromptMention[]>;
|
|
44
|
+
/** Commands: typing / at the start of an empty composer opens them ("/review"). */
|
|
45
|
+
commands?: PromptCommand[];
|
|
46
|
+
/** Controlled text. */
|
|
47
|
+
value?: string;
|
|
48
|
+
onValueChange?: (text: string) => void;
|
|
49
|
+
/** Called when files are attached; a promise holds the chip as pending ("Uploading") until it settles, a rejection removes it. */
|
|
50
|
+
onAttach?: (files: File[]) => void | Promise<unknown>;
|
|
51
|
+
/** Accepted file types, as for an input. Leave out to turn attachments off for the picker and drop. */
|
|
52
|
+
accept?: string;
|
|
53
|
+
children: React.ReactNode;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Where a person writes to an agent. The whole composer is an opening, the Input well: empty it shows its back wall and
|
|
57
|
+
* deepens as the pointer nears, and once it holds text the floor rises flush. Send is the level-2 primary; while a
|
|
58
|
+
* response is generating it becomes Stop in the same slot and size, so nothing moves. Enter sends, Shift+Enter adds a
|
|
59
|
+
* line, and Enter during IME composition never sends.
|
|
60
|
+
*/
|
|
61
|
+
export declare function PromptInput({ onSubmit, status, onStop, onQueue, mentionable, commands, value, onValueChange, onAttach, accept, className, children, ...rest }: PromptInputProps): React.JSX.Element;
|
|
62
|
+
export interface PromptInputTextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'onChange'> {
|
|
63
|
+
/** The tallest it grows, in pixels, before it scrolls. Default 200. */
|
|
64
|
+
maxHeight?: number;
|
|
65
|
+
}
|
|
66
|
+
/** The text: it grows with what's written, up to maxHeight, then scrolls. */
|
|
67
|
+
export declare function PromptInputTextarea({ placeholder, maxHeight, className, onKeyDown, 'aria-label': label, ...rest }: PromptInputTextareaProps): React.JSX.Element;
|
|
68
|
+
/** The attached files as Tag plates; one being uploaded hovers as pending. */
|
|
69
|
+
export declare function PromptInputAttachments({ className }: {
|
|
70
|
+
className?: string;
|
|
71
|
+
}): React.JSX.Element | null;
|
|
72
|
+
/** The row under the text: tools and pickers on the left, Send on the right. */
|
|
73
|
+
export declare function PromptInputToolbar({ className, children }: {
|
|
74
|
+
className?: string;
|
|
75
|
+
children?: React.ReactNode;
|
|
76
|
+
}): React.JSX.Element;
|
|
77
|
+
/** Attach files (the picker); ⌘/Ctrl+U does the same from the text. Needs `accept` on PromptInput. */
|
|
78
|
+
export declare function PromptInputAttach({ label }: {
|
|
79
|
+
label?: string;
|
|
80
|
+
}): React.JSX.Element;
|
|
81
|
+
export interface PromptInputDictateProps {
|
|
82
|
+
/** Default 'idle'. 'denied' and 'unavailable' keep the button focusable and say why it can't listen. */
|
|
83
|
+
status?: 'idle' | 'listening' | 'denied' | 'unavailable';
|
|
84
|
+
onStart?: () => void;
|
|
85
|
+
onStop?: () => void;
|
|
86
|
+
/** Words heard but not final: a ghost under the text in ink-faint, never in the value. */
|
|
87
|
+
interim?: string;
|
|
88
|
+
/** Final words to insert at the caret; give each result a new id. */
|
|
89
|
+
final?: {
|
|
90
|
+
id: string | number;
|
|
91
|
+
text: string;
|
|
92
|
+
};
|
|
93
|
+
/** Default "Dictate". */
|
|
94
|
+
label?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Dictate a message (#284): a latched toggle. Listening is the Toggle's "on": a shallow well with accent-soft poured
|
|
98
|
+
* in, "Listening" and a steady lamp, with no pulse and no waveform. Interim words are a ghost like a suggestion; final
|
|
99
|
+
* words land at the caret. Blocked or unavailable stays focusable and says why. ⌘D / Ctrl+D toggles; Escape stops
|
|
100
|
+
* listening before it stops generating. Your app supplies the speech recognition.
|
|
101
|
+
*/
|
|
102
|
+
export declare function PromptInputDictate({ status, onStart, onStop, interim, final, label }: PromptInputDictateProps): React.JSX.Element;
|
|
103
|
+
/** Send, which becomes Stop in the same slot and size while a response is generating. */
|
|
104
|
+
export declare function PromptInputSubmit({ className }: {
|
|
105
|
+
className?: string;
|
|
106
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { InlineEditControl, InlineEditSaveResult } from './inline-edit.js';
|
|
3
|
+
import { EditRegionBinder, EditRegionSaveResult } from './edit-region.js';
|
|
4
|
+
export interface PropertyListEditAll<T extends Record<string, unknown>> {
|
|
5
|
+
/** The whole record, edited together (for cross-field rules such as start before end). */
|
|
6
|
+
value: T;
|
|
7
|
+
onValueChange: (canonical: T) => void;
|
|
8
|
+
onSave: (draft: T, context: {
|
|
9
|
+
previousValue: T;
|
|
10
|
+
changed: (keyof T)[];
|
|
11
|
+
}) => EditRegionSaveResult<T> | Promise<EditRegionSaveResult<T>>;
|
|
12
|
+
validate?: (draft: T) => Partial<Record<keyof T, string>> | undefined | Promise<Partial<Record<keyof T, string>> | undefined>;
|
|
13
|
+
renderEditor: (field: EditRegionBinder<T>) => React.ReactNode;
|
|
14
|
+
/** Names the region and its button: “Edit all <label>”. Default “details”. */
|
|
15
|
+
label?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface PropertyListProps<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
18
|
+
'aria-label'?: string;
|
|
19
|
+
'aria-labelledby'?: string;
|
|
20
|
+
/** stacked: label above value (a sidebar). inline: label beside value (a summary). Default 'stacked'. */
|
|
21
|
+
layout?: 'stacked' | 'inline';
|
|
22
|
+
/** Single-key shortcuts (an item's `shortcut`) while focus is in the list. Off by default (WCAG 2.1.4): offer a way to turn them on. */
|
|
23
|
+
shortcuts?: boolean;
|
|
24
|
+
/** An “Edit all” button that lifts the whole list into one EditRegion. */
|
|
25
|
+
editAll?: PropertyListEditAll<T>;
|
|
26
|
+
/** Who proposed the items' `proposed` values ("Assistant", "Maya"). Default "Assistant". */
|
|
27
|
+
proposedBy?: string;
|
|
28
|
+
className?: string;
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
export interface PropertyListItemProps<V> {
|
|
32
|
+
label: string;
|
|
33
|
+
value: V;
|
|
34
|
+
/** Read mode. Default: the value as text. */
|
|
35
|
+
renderValue?: (value: V) => React.ReactNode;
|
|
36
|
+
/** An empty value's words, shown in a small well. Default “Not set”. */
|
|
37
|
+
emptyLabel?: string;
|
|
38
|
+
/** Makes the item editable (InlineEdit's contract). Without it, the value is read-only text. */
|
|
39
|
+
onSave?: (draft: V, context: {
|
|
40
|
+
previousValue: V;
|
|
41
|
+
}) => InlineEditSaveResult<V> | Promise<InlineEditSaveResult<V>>;
|
|
42
|
+
onValueChange?: (canonical: V) => void;
|
|
43
|
+
editor?: (control: InlineEditControl<V>) => React.ReactNode;
|
|
44
|
+
commit?: 'explicit' | 'on-choose';
|
|
45
|
+
validate?: (draft: V) => string | undefined | Promise<string | undefined>;
|
|
46
|
+
required?: boolean;
|
|
47
|
+
isEqual?: (a: V, b: V) => boolean;
|
|
48
|
+
/** A single key that opens this item while focus is in the list (with `shortcuts` on the list). Case doesn't matter. */
|
|
49
|
+
shortcut?: string;
|
|
50
|
+
/**
|
|
51
|
+
* A change someone proposes (an agent reading an email, a teammate's suggested edit): the current value with the
|
|
52
|
+
* proposed one beside it, raised, with Accept and Reject. Nothing touches the record until it's accepted; accepting
|
|
53
|
+
* saves through onSave (hovering as pending, then settling).
|
|
54
|
+
*/
|
|
55
|
+
proposed?: V;
|
|
56
|
+
/** Called once the proposal is accepted (and saved) or rejected: clear `proposed` here. */
|
|
57
|
+
onProposalResolved?: (accepted: boolean, value: V) => void;
|
|
58
|
+
className?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* One record's properties as label–value pairs. The properties are the record, on the ground; an unset value is a
|
|
62
|
+
* small opening; an editable value is one plate that lifts when pointed at, because clicking it opens its editor
|
|
63
|
+
* (InlineEdit, with any control). “Edit all” lifts the whole list into one EditRegion for cross-field rules.
|
|
64
|
+
*/
|
|
65
|
+
export declare function PropertyList<T extends Record<string, unknown> = Record<string, unknown>>({ layout, shortcuts, editAll, proposedBy, className, children, ...aria }: PropertyListProps<T>): React.JSX.Element;
|
|
66
|
+
/** One property. With onSave its value is an editable plate (InlineEdit); without, read-only text. */
|
|
67
|
+
export declare function PropertyListItem<V>({ label, value, renderValue, emptyLabel, onSave, onValueChange, editor, commit, validate, required, isEqual, shortcut, proposed, onProposalResolved, className }: PropertyListItemProps<V>): React.JSX.Element;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type QuestionState = 'asking' | 'answered' | 'expired';
|
|
3
|
+
export interface QuestionAnswer {
|
|
4
|
+
values: string[];
|
|
5
|
+
other?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface QuestionOptionProps {
|
|
8
|
+
value: string;
|
|
9
|
+
label: React.ReactNode;
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/** One option of a Question. It renders nothing itself: the Question draws it as a radio or a checkbox. */
|
|
13
|
+
export declare function QuestionOption(_: QuestionOptionProps): null;
|
|
14
|
+
export interface QuestionProps {
|
|
15
|
+
/** The question, as its title: "Which environment should I deploy to?". */
|
|
16
|
+
title: string;
|
|
17
|
+
/** Default 'asking'. */
|
|
18
|
+
state?: QuestionState;
|
|
19
|
+
/** Several options may be chosen (checkboxes). Default false (a radio group). */
|
|
20
|
+
multiple?: boolean;
|
|
21
|
+
/** A one-line field for an answer of the person's own. */
|
|
22
|
+
allowOther?: boolean;
|
|
23
|
+
/** Default "Your own answer". */
|
|
24
|
+
otherLabel?: string;
|
|
25
|
+
/** Default "Answer". */
|
|
26
|
+
answerLabel?: string;
|
|
27
|
+
/** Shows a ghost button that lets the run go on without an answer: "Let the assistant decide". */
|
|
28
|
+
skipLabel?: string;
|
|
29
|
+
onSkip?: () => void;
|
|
30
|
+
onAnswer?: (answer: QuestionAnswer) => void;
|
|
31
|
+
/** What was answered, for the record once it's 'answered'. */
|
|
32
|
+
answer?: QuestionAnswer;
|
|
33
|
+
answeredAt?: Date | string | number;
|
|
34
|
+
/** Default "The assistant". */
|
|
35
|
+
requestedBy?: string;
|
|
36
|
+
/** Its key in a QuestionSet's answers. */
|
|
37
|
+
name?: string;
|
|
38
|
+
/** QuestionOptions. */
|
|
39
|
+
children: React.ReactNode;
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* An agent asks the person something before it carries on (#270): the elicitation half of human-in-the-loop. Nothing
|
|
44
|
+
* has been dispatched, so it's raised like a requested Confirmation, not pending. Options are a radio group (or
|
|
45
|
+
* checkboxes), "Your own answer" is a field, and Answer is the one primary; there's no default and nothing is focused
|
|
46
|
+
* for you. Answered, it presses to the ground as one line: "You chose: Staging · now".
|
|
47
|
+
*/
|
|
48
|
+
export declare function Question({ title, state: own, multiple, allowOther, otherLabel, answerLabel, skipLabel, onSkip, onAnswer, answer, answeredAt, requestedBy, name, children, className }: QuestionProps): React.JSX.Element;
|
|
49
|
+
export interface QuestionSetProps {
|
|
50
|
+
/** Names the set: "The assistant has 2 questions". */
|
|
51
|
+
'aria-label'?: string;
|
|
52
|
+
state?: QuestionState;
|
|
53
|
+
/** Called with every Question's answer, by its name, when Answer is pressed. Answer waits until each has one. */
|
|
54
|
+
onAnswer?: (answers: Record<string, QuestionAnswer>) => void;
|
|
55
|
+
answerLabel?: string;
|
|
56
|
+
skipLabel?: string;
|
|
57
|
+
onSkip?: () => void;
|
|
58
|
+
requestedBy?: string;
|
|
59
|
+
/** Questions, each with a name. */
|
|
60
|
+
children: React.ReactNode;
|
|
61
|
+
className?: string;
|
|
62
|
+
}
|
|
63
|
+
/** Several questions in one request (AskUserQuestion allows up to four), answered together by one button. */
|
|
64
|
+
export declare function QuestionSet({ 'aria-label': label, state, onAnswer, answerLabel, skipLabel, onSkip, requestedBy, children, className }: QuestionSetProps): React.JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface RelativeTimeOptions {
|
|
3
|
+
/** 'relative' (default) always says "3 minutes ago"; 'auto' is relative within `threshold`, then a date ("Mar 4"). */
|
|
4
|
+
format?: 'relative' | 'auto';
|
|
5
|
+
/** For format="auto": how far from now stays relative. An ISO 8601 duration ("P7D", "PT12H") or milliseconds. Default "P7D". */
|
|
6
|
+
threshold?: string | number;
|
|
7
|
+
/** 'past' never says "in 2 minutes" (a clock running ahead shows "now"); 'future' never says "ago". Default 'auto'. */
|
|
8
|
+
tense?: 'auto' | 'past' | 'future';
|
|
9
|
+
/** Default: the browser's. */
|
|
10
|
+
locale?: string;
|
|
11
|
+
}
|
|
12
|
+
/** A moment as words relative to `now`, the way RelativeTime shows it: "3 minutes ago", "yesterday", "in 2 hours", "Mar 4". */
|
|
13
|
+
export declare function formatRelativeTime(date: Date | string | number, now?: number, { format, threshold, tense, locale }?: RelativeTimeOptions): string;
|
|
14
|
+
export interface RelativeTimeProps extends RelativeTimeOptions, Omit<React.TimeHTMLAttributes<HTMLElement>, 'children' | 'dateTime'> {
|
|
15
|
+
/** The moment. When it changes (the record was edited again) it settles with the afterglow; time passing doesn't. */
|
|
16
|
+
date: Date | string | number;
|
|
17
|
+
/** Show the exact date, time and zone in a Tooltip on hover and focus (the element becomes focusable). Default true. */
|
|
18
|
+
tooltip?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** A moment as "3 minutes ago" in a <time>, refreshed on one shared timer, with its exact time on hand. Ticking isn't a change. */
|
|
21
|
+
export declare function RelativeTime({ date, format, threshold, tense, locale, tooltip, className, title, style, ...rest }: RelativeTimeProps): React.JSX.Element;
|