@mithrl/design-system 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/approval-card/ApprovalCard.d.ts +70 -0
- package/dist/components/button/Button.d.ts +4 -0
- package/dist/components/code-block/CodeBlock.d.ts +64 -0
- package/dist/components/command-search/CommandSearch.d.ts +57 -0
- package/dist/components/composer/ComposerAttachmentView.d.ts +48 -0
- package/dist/components/context-cards/ContextCards.d.ts +53 -0
- package/dist/components/disclosure/Disclosure.d.ts +38 -0
- package/dist/components/explorer/Explorer.d.ts +99 -0
- package/dist/components/field-message/FieldMessage.d.ts +12 -0
- package/dist/components/filter-table/FilterTable.d.ts +61 -0
- package/dist/components/flap-text/FlapText.d.ts +68 -0
- package/dist/components/flowchart/Flowchart.d.ts +140 -0
- package/dist/components/global-app-bar/GlobalAppBar.d.ts +14 -4
- package/dist/components/icon-swap/IconSwap.d.ts +30 -0
- package/dist/components/insight-cards/InsightCards.d.ts +97 -0
- package/dist/components/navigation-item/NavigationItem.d.ts +2 -0
- package/dist/components/number-flow/NumberFlow.d.ts +93 -0
- package/dist/components/panel-tabs/PanelTabs.d.ts +2 -0
- package/dist/components/progress-indicator/ProgressIndicator.d.ts +9 -1
- package/dist/components/prompt-bar/PromptBar.d.ts +103 -0
- package/dist/components/recommendation-card/RecommendationCard.d.ts +77 -0
- package/dist/components/records-table/RecordsTable.d.ts +87 -0
- package/dist/components/resizable-panels/ResizablePanels.d.ts +38 -0
- package/dist/components/secondary-panel/SecondaryPanel.d.ts +69 -0
- package/dist/components/selection-actions/SelectionActions.d.ts +72 -0
- package/dist/components/skeleton-reveal/SkeletonReveal.d.ts +33 -0
- package/dist/components/status-orb/StatusOrb.d.ts +51 -0
- package/dist/components/streaming-text/StreamingText.d.ts +85 -0
- package/dist/components/task-rows/TaskRows.d.ts +77 -0
- package/dist/components/upload-queue/UploadQueue.d.ts +10 -0
- package/dist/components/workspace-navigation/WorkspaceNavigation.d.ts +22 -1
- package/dist/index.d.ts +52 -2
- package/dist/index.js +5693 -1787
- package/dist/internal/useStaggerBatch.d.ts +22 -0
- package/dist/patterns/notifications/Notifications.d.ts +159 -0
- package/dist/patterns/workspace-app-shell/WorkspaceAppShell.d.ts +93 -4
- package/dist/patterns/workspace-app-shell/WorkspaceNewQuestionDialog.d.ts +24 -0
- package/dist/patterns/workspace-app-shell/WorkspaceQuestionSurface.d.ts +49 -0
- package/dist/styles.css +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
/** One selectable answer on an approval question. */
|
|
4
|
+
export interface ApprovalOption {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
/** Short clarifier shown under the label. Keep it to one plain sentence. */
|
|
8
|
+
description?: string;
|
|
9
|
+
}
|
|
10
|
+
/** A single question the agent asks before it acts. */
|
|
11
|
+
export interface ApprovalQuestion {
|
|
12
|
+
id: string;
|
|
13
|
+
/** The question itself, phrased the way a colleague would ask it. */
|
|
14
|
+
prompt: string;
|
|
15
|
+
/** Optional context sentence shown under the prompt. */
|
|
16
|
+
helpText?: ReactNode;
|
|
17
|
+
options: ApprovalOption[];
|
|
18
|
+
/** Allow more than one option. Defaults to single choice. */
|
|
19
|
+
multiSelect?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Selected option ids keyed by question id. */
|
|
22
|
+
export type ApprovalAnswers = Record<string, string[]>;
|
|
23
|
+
type RestrictedApprovalCardAttribute = "children" | "onSubmit" | "role";
|
|
24
|
+
export type ApprovalCardProps = Omit<HTMLAttributes<HTMLElement>, RestrictedApprovalCardAttribute> & {
|
|
25
|
+
/** Ordered questions. The card pages through them one at a time. */
|
|
26
|
+
questions: ApprovalQuestion[];
|
|
27
|
+
/** Optional heading above the question, e.g. the run the agent is planning. */
|
|
28
|
+
eyebrow?: ReactNode;
|
|
29
|
+
/** Controlled answers. Pair with `onAnswersChange`. */
|
|
30
|
+
answers?: ApprovalAnswers;
|
|
31
|
+
/** Initial answers when the card owns its own state. */
|
|
32
|
+
defaultAnswers?: ApprovalAnswers;
|
|
33
|
+
onAnswersChange?: (answers: ApprovalAnswers) => void;
|
|
34
|
+
/** Fired once the last question is confirmed. */
|
|
35
|
+
onComplete?: (answers: ApprovalAnswers) => void;
|
|
36
|
+
/** Fired when the scientist declines to answer and lets the agent decide. */
|
|
37
|
+
onSkip?: (answers: ApprovalAnswers) => void;
|
|
38
|
+
skipLabel?: string;
|
|
39
|
+
continueLabel?: string;
|
|
40
|
+
/** Label for the final page's primary action. */
|
|
41
|
+
completeLabel?: string;
|
|
42
|
+
/** Require a selection before the primary action enables. @default true */
|
|
43
|
+
requireAnswer?: boolean;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Human-in-the-loop approval. The agent pauses, asks what it should do, and
|
|
47
|
+
* waits: one question per page, a clear way out, and no hidden defaults.
|
|
48
|
+
*/
|
|
49
|
+
export declare const ApprovalCard: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLElement>, RestrictedApprovalCardAttribute> & {
|
|
50
|
+
/** Ordered questions. The card pages through them one at a time. */
|
|
51
|
+
questions: ApprovalQuestion[];
|
|
52
|
+
/** Optional heading above the question, e.g. the run the agent is planning. */
|
|
53
|
+
eyebrow?: ReactNode;
|
|
54
|
+
/** Controlled answers. Pair with `onAnswersChange`. */
|
|
55
|
+
answers?: ApprovalAnswers;
|
|
56
|
+
/** Initial answers when the card owns its own state. */
|
|
57
|
+
defaultAnswers?: ApprovalAnswers;
|
|
58
|
+
onAnswersChange?: (answers: ApprovalAnswers) => void;
|
|
59
|
+
/** Fired once the last question is confirmed. */
|
|
60
|
+
onComplete?: (answers: ApprovalAnswers) => void;
|
|
61
|
+
/** Fired when the scientist declines to answer and lets the agent decide. */
|
|
62
|
+
onSkip?: (answers: ApprovalAnswers) => void;
|
|
63
|
+
skipLabel?: string;
|
|
64
|
+
continueLabel?: string;
|
|
65
|
+
/** Label for the final page's primary action. */
|
|
66
|
+
completeLabel?: string;
|
|
67
|
+
/** Require a selection before the primary action enables. @default true */
|
|
68
|
+
requireAnswer?: boolean;
|
|
69
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
|
70
|
+
export {};
|
|
@@ -10,6 +10,8 @@ export type ButtonSize = NonNullable<VariantProps<typeof buttonVariants>["size"]
|
|
|
10
10
|
export type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> & VariantProps<typeof buttonVariants> & {
|
|
11
11
|
children: ReactNode;
|
|
12
12
|
loading?: boolean;
|
|
13
|
+
/** Keeps async-action focus while guarding repeat activation with aria-disabled. */
|
|
14
|
+
preserveFocusWhileLoading?: boolean;
|
|
13
15
|
leadingIcon?: ReactNode;
|
|
14
16
|
trailingIcon?: ReactNode;
|
|
15
17
|
};
|
|
@@ -23,6 +25,8 @@ export declare const Button: import("react").ForwardRefExoticComponent<Omit<Butt
|
|
|
23
25
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
|
24
26
|
children: ReactNode;
|
|
25
27
|
loading?: boolean;
|
|
28
|
+
/** Keeps async-action focus while guarding repeat activation with aria-disabled. */
|
|
29
|
+
preserveFocusWhileLoading?: boolean;
|
|
26
30
|
leadingIcon?: ReactNode;
|
|
27
31
|
trailingIcon?: ReactNode;
|
|
28
32
|
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export type CodeBlockVariant = "code" | "diff";
|
|
4
|
+
export type CodeLineKind = "context" | "added" | "removed";
|
|
5
|
+
export type CodeLine = {
|
|
6
|
+
/** Raw line text. Rendered verbatim in the mono column. */
|
|
7
|
+
content: string;
|
|
8
|
+
/** Diff classification. Ignored by the `code` variant. */
|
|
9
|
+
kind?: CodeLineKind;
|
|
10
|
+
};
|
|
11
|
+
export type CodeBlockRenderLineArgs = {
|
|
12
|
+
/** Raw line text. */
|
|
13
|
+
content: string;
|
|
14
|
+
/** Resolved diff classification. */
|
|
15
|
+
kind: CodeLineKind;
|
|
16
|
+
/** One-based line number as shown in the gutter. */
|
|
17
|
+
number: number;
|
|
18
|
+
/** Variant the line is being rendered for. */
|
|
19
|
+
variant: CodeBlockVariant;
|
|
20
|
+
};
|
|
21
|
+
export type CodeBlockLabels = {
|
|
22
|
+
copy: string;
|
|
23
|
+
copied: string;
|
|
24
|
+
copyFailed: string;
|
|
25
|
+
codeTab: string;
|
|
26
|
+
diffTab: string;
|
|
27
|
+
listing: string;
|
|
28
|
+
};
|
|
29
|
+
type CodeBlockOwnProps = {
|
|
30
|
+
/** Source text. Split on newlines into the listing. */
|
|
31
|
+
code?: string;
|
|
32
|
+
/** Pre-split lines, required for diff rendering. Wins over `code`. */
|
|
33
|
+
lines?: readonly CodeLine[];
|
|
34
|
+
/** Language label rendered as a Tag in the header. */
|
|
35
|
+
language?: string;
|
|
36
|
+
/** File path or name rendered as the header title. */
|
|
37
|
+
fileName?: string;
|
|
38
|
+
/** Listing mode. Ignored when `tabs` is enabled. */
|
|
39
|
+
variant?: CodeBlockVariant;
|
|
40
|
+
/** Renders a Code/Diff segmented control. Requires `code` and `lines`. */
|
|
41
|
+
tabs?: boolean;
|
|
42
|
+
/** Controlled tab value when `tabs` is enabled. */
|
|
43
|
+
activeTab?: CodeBlockVariant;
|
|
44
|
+
/** Called when the Code/Diff segmented control changes. */
|
|
45
|
+
onTabChange?: (variant: CodeBlockVariant) => void;
|
|
46
|
+
/** Hides the line-number column. */
|
|
47
|
+
hideLineNumbers?: boolean;
|
|
48
|
+
/** Called with the text placed on the clipboard. */
|
|
49
|
+
onCopy?: (text: string) => void;
|
|
50
|
+
/** Injects highlighted nodes for a line. Defaults to plain mono text. */
|
|
51
|
+
renderLine?: (line: CodeBlockRenderLineArgs) => ReactNode;
|
|
52
|
+
labels?: Partial<CodeBlockLabels>;
|
|
53
|
+
className?: string;
|
|
54
|
+
};
|
|
55
|
+
export type CodeBlockProps = Omit<HTMLAttributes<HTMLDivElement>, keyof CodeBlockOwnProps | "children"> & CodeBlockOwnProps;
|
|
56
|
+
/**
|
|
57
|
+
* A notebook-tier code surface: a titled header rail with an optional
|
|
58
|
+
* language Tag and copy action, and a line-numbered, horizontally scrolling
|
|
59
|
+
* listing. The `diff` variant renders unified diff lines with semantic
|
|
60
|
+
* tinting. CodeBlock ships no syntax highlighting engine — pass `renderLine`
|
|
61
|
+
* to inject already-highlighted nodes.
|
|
62
|
+
*/
|
|
63
|
+
export declare const CodeBlock: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children" | keyof CodeBlockOwnProps> & CodeBlockOwnProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export type CommandSearchItem = {
|
|
4
|
+
/** Stable identity used for keys and active-descendant wiring. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Visible command label; match highlighting applies to this text. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Optional group heading the item is filed under. */
|
|
9
|
+
group?: string;
|
|
10
|
+
/** Optional trailing hint such as a shortcut or destination. */
|
|
11
|
+
hint?: string;
|
|
12
|
+
/** Invoked on Enter or click. */
|
|
13
|
+
onSelect?: (item: CommandSearchItem) => void;
|
|
14
|
+
/** Removes the item from keyboard navigation and selection. */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type CommandSearchProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "onSelect"> & {
|
|
18
|
+
items: readonly CommandSearchItem[];
|
|
19
|
+
/** Required accessible name for the search field. */
|
|
20
|
+
label: string;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
/** Controlled query. Omit for uncontrolled use. */
|
|
23
|
+
query?: string;
|
|
24
|
+
defaultQuery?: string;
|
|
25
|
+
onQueryChange?: (query: string) => void;
|
|
26
|
+
/** Called after any item is chosen, in addition to the item's own handler. */
|
|
27
|
+
onSelect?: (item: CommandSearchItem) => void;
|
|
28
|
+
/** Called when Escape is pressed on a field that is already empty. */
|
|
29
|
+
onEscape?: () => void;
|
|
30
|
+
/** Renders group headings when items carry a `group`. */
|
|
31
|
+
grouped?: boolean;
|
|
32
|
+
/** Secondary line shown under the empty-state title. */
|
|
33
|
+
emptyHint?: ReactNode;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* A command palette search surface. CommandSearch renders inline as an
|
|
37
|
+
* embedded panel and can be composed inside a Dialog by the consumer; it owns
|
|
38
|
+
* filtering, match highlighting, and roving keyboard selection only.
|
|
39
|
+
*/
|
|
40
|
+
export declare const CommandSearch: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children" | "onSelect"> & {
|
|
41
|
+
items: readonly CommandSearchItem[];
|
|
42
|
+
/** Required accessible name for the search field. */
|
|
43
|
+
label: string;
|
|
44
|
+
placeholder?: string;
|
|
45
|
+
/** Controlled query. Omit for uncontrolled use. */
|
|
46
|
+
query?: string;
|
|
47
|
+
defaultQuery?: string;
|
|
48
|
+
onQueryChange?: (query: string) => void;
|
|
49
|
+
/** Called after any item is chosen, in addition to the item's own handler. */
|
|
50
|
+
onSelect?: (item: CommandSearchItem) => void;
|
|
51
|
+
/** Called when Escape is pressed on a field that is already empty. */
|
|
52
|
+
onEscape?: () => void;
|
|
53
|
+
/** Renders group headings when items carry a `group`. */
|
|
54
|
+
grouped?: boolean;
|
|
55
|
+
/** Secondary line shown under the empty-state title. */
|
|
56
|
+
emptyHint?: ReactNode;
|
|
57
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
type NativeComposerAttachmentViewProps = Omit<HTMLAttributes<HTMLElement>, "children" | "title">;
|
|
4
|
+
export type ComposerAttachmentViewProps = NativeComposerAttachmentViewProps & {
|
|
5
|
+
/** Accessible and visible view heading. */
|
|
6
|
+
heading?: ReactNode;
|
|
7
|
+
/** Short file-acquisition instruction below the heading. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** Product-owned browse-file and browse-folder controls. */
|
|
10
|
+
acquisitionActions: ReactNode;
|
|
11
|
+
/** Product-owned selection or drop status. */
|
|
12
|
+
acquisitionStatus?: ReactNode;
|
|
13
|
+
/** Product-owned selected resources, queue, progress, or empty state. */
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/** Product-owned Clear, Upload, retry, or equivalent actions. */
|
|
16
|
+
footerActions: ReactNode;
|
|
17
|
+
/** Reports the explicit request to return to the Composer. */
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
/** Accessible name for the close action. */
|
|
20
|
+
closeLabel?: string;
|
|
21
|
+
/** Applies the approved active drop surface without owning drag events. */
|
|
22
|
+
dragging?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Controlled visual shell for the Composer attachment view. File selection,
|
|
26
|
+
* queues, transport, retries, and persistence remain product-owned slots.
|
|
27
|
+
*/
|
|
28
|
+
export declare const ComposerAttachmentView: import("react").ForwardRefExoticComponent<NativeComposerAttachmentViewProps & {
|
|
29
|
+
/** Accessible and visible view heading. */
|
|
30
|
+
heading?: ReactNode;
|
|
31
|
+
/** Short file-acquisition instruction below the heading. */
|
|
32
|
+
description?: ReactNode;
|
|
33
|
+
/** Product-owned browse-file and browse-folder controls. */
|
|
34
|
+
acquisitionActions: ReactNode;
|
|
35
|
+
/** Product-owned selection or drop status. */
|
|
36
|
+
acquisitionStatus?: ReactNode;
|
|
37
|
+
/** Product-owned selected resources, queue, progress, or empty state. */
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
/** Product-owned Clear, Upload, retry, or equivalent actions. */
|
|
40
|
+
footerActions: ReactNode;
|
|
41
|
+
/** Reports the explicit request to return to the Composer. */
|
|
42
|
+
onClose: () => void;
|
|
43
|
+
/** Accessible name for the close action. */
|
|
44
|
+
closeLabel?: string;
|
|
45
|
+
/** Applies the approved active drop surface without owning drag events. */
|
|
46
|
+
dragging?: boolean;
|
|
47
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
/** File types a retrieved chunk can come from. */
|
|
4
|
+
export type ContextFileType = "PDF" | "CSV" | "XLSX" | "TXT";
|
|
5
|
+
export interface FileTypeChipProps {
|
|
6
|
+
/** The chunk's source file type. */
|
|
7
|
+
fileType: ContextFileType;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A tinted three-or-four letter file-type marker. Each type gets a distinct
|
|
11
|
+
* semantic tint so a mixed list is scannable at a glance without reading
|
|
12
|
+
* filenames.
|
|
13
|
+
*/
|
|
14
|
+
export declare function FileTypeChip({ fileType }: FileTypeChipProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export interface ContextCardProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
16
|
+
/** Chunk heading — usually the section or table it was taken from. */
|
|
17
|
+
title: ReactNode;
|
|
18
|
+
/** Retrieved text. Clamped to three lines and faded, never truncated mid-word with an ellipsis. */
|
|
19
|
+
excerpt: ReactNode;
|
|
20
|
+
/** Character count of the full chunk, shown as retrieval metadata. */
|
|
21
|
+
characterCount?: number;
|
|
22
|
+
/** File the chunk came from. */
|
|
23
|
+
fileName: string;
|
|
24
|
+
/** File type of `fileName`. */
|
|
25
|
+
fileType: ContextFileType;
|
|
26
|
+
/**
|
|
27
|
+
* Optional page or row provenance, e.g. `"p. 4"` or `"rows 120–184"`.
|
|
28
|
+
*/
|
|
29
|
+
locator?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One retrieved knowledge chunk. Presentational: the card is not a control, so
|
|
33
|
+
* it carries no role or tab stop. Wrap it in a button or link at the call site
|
|
34
|
+
* if opening the source is supported there.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ContextCard: import("react").ForwardRefExoticComponent<ContextCardProps & import("react").RefAttributes<HTMLElement>>;
|
|
37
|
+
export interface ContextCardListProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
38
|
+
/** Group heading. @default "All chunks" */
|
|
39
|
+
title?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Number shown in the count Tag. Defaults to the number of rendered cards,
|
|
42
|
+
* so pass it explicitly only when the list is paged or virtualised.
|
|
43
|
+
*/
|
|
44
|
+
count?: number;
|
|
45
|
+
/** `ContextCard` children. */
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A labelled group of retrieved chunks. Rendered as a `<section>` with its
|
|
50
|
+
* heading wired through `aria-labelledby`, and the cards themselves in a
|
|
51
|
+
* `<ul>` so assistive technology announces the group size.
|
|
52
|
+
*/
|
|
53
|
+
export declare const ContextCardList: import("react").ForwardRefExoticComponent<ContextCardListProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export type DisclosureProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
4
|
+
/** Whether the region is expanded. Disclosure is always controlled. */
|
|
5
|
+
open: boolean;
|
|
6
|
+
/** Region content. Padding belongs on the content, never on Disclosure. */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* An animated, controlled disclosure region.
|
|
11
|
+
*
|
|
12
|
+
* Disclosure animates its own height between collapsed and expanded using the
|
|
13
|
+
* `grid-template-rows: 0fr -> 1fr` technique, so content of any size animates
|
|
14
|
+
* without JavaScript measurement. Open animates over
|
|
15
|
+
* `--motion-duration-moderate` on `--motion-easing-enter`; close animates over
|
|
16
|
+
* the shorter `--motion-duration-standard` on `--motion-easing-exit`, matching
|
|
17
|
+
* the foundations asymmetry rule and the Dialog precedent.
|
|
18
|
+
*
|
|
19
|
+
* Boundary — Disclosure is presentational and owns the region only. It does
|
|
20
|
+
* **not** own the trigger, the chevron, focus management, `aria-expanded`, or
|
|
21
|
+
* `aria-controls`; the caller already owns those and keeps them on its own
|
|
22
|
+
* trigger. Pass `id` here and reference it from the trigger's `aria-controls`.
|
|
23
|
+
*
|
|
24
|
+
* While closed the content is hidden from the accessibility tree and from the
|
|
25
|
+
* tab order twice over: `visibility: hidden` is deferred behind the collapse
|
|
26
|
+
* transition (the pattern already used by `secondary-panel.css` and
|
|
27
|
+
* `workspace-app-shell.css`), and `inert` is applied immediately so nothing
|
|
28
|
+
* inside can be focused during the closing transition.
|
|
29
|
+
*
|
|
30
|
+
* Under `prefers-reduced-motion: reduce` the height animation is dropped
|
|
31
|
+
* entirely and the region crossfades at `--motion-duration-fast`.
|
|
32
|
+
*/
|
|
33
|
+
export declare const Disclosure: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
34
|
+
/** Whether the region is expanded. Disclosure is always controlled. */
|
|
35
|
+
open: boolean;
|
|
36
|
+
/** Region content. Padding belongs on the content, never on Disclosure. */
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type HTMLAttributes, type MouseEvent, type MouseEventHandler, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export type ExplorerUploadFileType = "data" | "structured-data" | "document" | "code" | "notebook" | "image" | "scientific-data" | "archive" | "generic";
|
|
4
|
+
export type ExplorerScientificOutputType = "dataset" | "report" | "figure" | "plot" | "code" | "generic";
|
|
5
|
+
type ExplorerResourceBase = {
|
|
6
|
+
/** Stable owner-defined identity. IDs are unique across the whole Explorer. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Visible single-line resource name. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Native destination. When omitted, the matching activation callback may own selection. */
|
|
11
|
+
href?: string;
|
|
12
|
+
};
|
|
13
|
+
export type ExplorerUploadFile = ExplorerResourceBase & {
|
|
14
|
+
type: "file";
|
|
15
|
+
fileType: ExplorerUploadFileType;
|
|
16
|
+
};
|
|
17
|
+
export type ExplorerUploadFolder = ExplorerResourceBase & {
|
|
18
|
+
type: "folder";
|
|
19
|
+
children: readonly ExplorerUploadNode[];
|
|
20
|
+
};
|
|
21
|
+
export type ExplorerUploadNode = ExplorerUploadFile | ExplorerUploadFolder;
|
|
22
|
+
export type ExplorerScientificOutput = ExplorerResourceBase & {
|
|
23
|
+
type: "output";
|
|
24
|
+
outputType: ExplorerScientificOutputType;
|
|
25
|
+
};
|
|
26
|
+
export type ExplorerScientificOutputFolder = ExplorerResourceBase & {
|
|
27
|
+
type: "folder";
|
|
28
|
+
children: readonly ExplorerScientificOutputNode[];
|
|
29
|
+
};
|
|
30
|
+
export type ExplorerScientificOutputNode = ExplorerScientificOutput | ExplorerScientificOutputFolder;
|
|
31
|
+
export type ExplorerQuestion = {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
children: readonly ExplorerScientificOutputNode[];
|
|
35
|
+
};
|
|
36
|
+
export type ExplorerLabels = {
|
|
37
|
+
panel: string;
|
|
38
|
+
tab: string;
|
|
39
|
+
panelActions: string;
|
|
40
|
+
uploads: string;
|
|
41
|
+
uploadsCount: (count: number) => string;
|
|
42
|
+
noUploadsTitle: ReactNode;
|
|
43
|
+
noUploadsDescription: ReactNode;
|
|
44
|
+
scientificOutputs: string;
|
|
45
|
+
questionsCount: (count: number) => string;
|
|
46
|
+
noScientificOutputsTitle: ReactNode;
|
|
47
|
+
noScientificOutputsDescription: ReactNode;
|
|
48
|
+
download: (name: string) => string;
|
|
49
|
+
};
|
|
50
|
+
type ResourceClick = MouseEvent<HTMLAnchorElement | HTMLButtonElement>;
|
|
51
|
+
export type ExplorerProps = Omit<HTMLAttributes<HTMLElement>, "children" | "onSelect"> & {
|
|
52
|
+
uploads?: readonly ExplorerUploadNode[];
|
|
53
|
+
questions?: readonly ExplorerQuestion[];
|
|
54
|
+
/** Controlled expanded folder and Question identities. */
|
|
55
|
+
expandedIds?: readonly string[];
|
|
56
|
+
/** Initial expanded identities for uncontrolled use. */
|
|
57
|
+
defaultExpandedIds?: readonly string[];
|
|
58
|
+
onExpandedIdsChange?: (ids: readonly string[]) => void;
|
|
59
|
+
onUploadActivate?: (upload: ExplorerUploadFile, event: ResourceClick) => void;
|
|
60
|
+
onScientificOutputActivate?: (output: ExplorerScientificOutput, event: ResourceClick) => void;
|
|
61
|
+
/** Independent download action revealed on hover or keyboard focus. */
|
|
62
|
+
onUploadDownload?: (upload: ExplorerUploadFile, event: MouseEvent<HTMLButtonElement>) => void;
|
|
63
|
+
/** Independent download action revealed on hover or keyboard focus. */
|
|
64
|
+
onScientificOutputDownload?: (output: ExplorerScientificOutput, event: MouseEvent<HTMLButtonElement>) => void;
|
|
65
|
+
onPanelAction?: MouseEventHandler<HTMLButtonElement>;
|
|
66
|
+
/**
|
|
67
|
+
* Renders Explorer's standalone Panel Tab header. Set false when the owning
|
|
68
|
+
* SecondaryPanel supplies the shared tab collection and panel actions.
|
|
69
|
+
*/
|
|
70
|
+
showHeader?: boolean;
|
|
71
|
+
labels?: Partial<ExplorerLabels>;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Secondary Workspace panel for uploaded files and generated scientific
|
|
75
|
+
* outputs. Product code owns loading, navigation, previews, and persistence.
|
|
76
|
+
*/
|
|
77
|
+
export declare const Explorer: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLElement>, "children" | "onSelect"> & {
|
|
78
|
+
uploads?: readonly ExplorerUploadNode[];
|
|
79
|
+
questions?: readonly ExplorerQuestion[];
|
|
80
|
+
/** Controlled expanded folder and Question identities. */
|
|
81
|
+
expandedIds?: readonly string[];
|
|
82
|
+
/** Initial expanded identities for uncontrolled use. */
|
|
83
|
+
defaultExpandedIds?: readonly string[];
|
|
84
|
+
onExpandedIdsChange?: (ids: readonly string[]) => void;
|
|
85
|
+
onUploadActivate?: (upload: ExplorerUploadFile, event: ResourceClick) => void;
|
|
86
|
+
onScientificOutputActivate?: (output: ExplorerScientificOutput, event: ResourceClick) => void;
|
|
87
|
+
/** Independent download action revealed on hover or keyboard focus. */
|
|
88
|
+
onUploadDownload?: (upload: ExplorerUploadFile, event: MouseEvent<HTMLButtonElement>) => void;
|
|
89
|
+
/** Independent download action revealed on hover or keyboard focus. */
|
|
90
|
+
onScientificOutputDownload?: (output: ExplorerScientificOutput, event: MouseEvent<HTMLButtonElement>) => void;
|
|
91
|
+
onPanelAction?: MouseEventHandler<HTMLButtonElement>;
|
|
92
|
+
/**
|
|
93
|
+
* Renders Explorer's standalone Panel Tab header. Set false when the owning
|
|
94
|
+
* SecondaryPanel supplies the shared tab collection and panel actions.
|
|
95
|
+
*/
|
|
96
|
+
showHeader?: boolean;
|
|
97
|
+
labels?: Partial<ExplorerLabels>;
|
|
98
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
|
99
|
+
export {};
|
|
@@ -13,6 +13,18 @@ export type FieldMessageProps = Omit<HTMLAttributes<HTMLParagraphElement>, "chil
|
|
|
13
13
|
/**
|
|
14
14
|
* Supporting or validation text for one form control. The consumer owns the
|
|
15
15
|
* ID, ARIA relationship, live-region policy, and validation behavior.
|
|
16
|
+
*
|
|
17
|
+
* The message reveals itself on mount rather than popping in: an outer grid
|
|
18
|
+
* wrapper animates `grid-template-rows: 0fr -> 1fr` from a CSS
|
|
19
|
+
* `@starting-style` rule, so surrounding layout eases open instead of jumping.
|
|
20
|
+
* The wrapper is purely presentational — every prop, the `className`, the
|
|
21
|
+
* forwarded ref, `role="alert"`, and the ARIA relationship stay on the same
|
|
22
|
+
* `<p>` element they were on before, so nothing about the announcement is
|
|
23
|
+
* delayed, duplicated, or moved. Browsers without `@starting-style` simply
|
|
24
|
+
* show the message immediately.
|
|
25
|
+
*
|
|
26
|
+
* Exit is owned by the consumer, because the consumer owns the unmount. Wrap
|
|
27
|
+
* FieldMessage in `Disclosure` and keep it mounted to animate it away.
|
|
16
28
|
*/
|
|
17
29
|
export declare const FieldMessage: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLParagraphElement>, "children" | "className"> & VariantProps<(props?: ({
|
|
18
30
|
tone?: "error" | "helper" | "warning" | null | undefined;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
|
|
3
|
+
export declare const filterTableStatuses: readonly ["to-do", "in-progress", "completed"];
|
|
4
|
+
export type FilterTableStatus = (typeof filterTableStatuses)[number];
|
|
5
|
+
export type FilterTableRow = {
|
|
6
|
+
/** Stable row identity. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Primary task name. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Preformatted date string; rendered with tabular figures. */
|
|
11
|
+
date: string;
|
|
12
|
+
status: FilterTableStatus;
|
|
13
|
+
/** Person or team accountable for the task. */
|
|
14
|
+
owner: string;
|
|
15
|
+
/** Optional secondary line under the task name. */
|
|
16
|
+
detail?: string;
|
|
17
|
+
};
|
|
18
|
+
export type FilterTableProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & {
|
|
19
|
+
rows: readonly FilterTableRow[];
|
|
20
|
+
/** Required accessible name for the table. */
|
|
21
|
+
caption: string;
|
|
22
|
+
/** Controlled filter. `null` shows every row. */
|
|
23
|
+
filter?: FilterTableStatus | null;
|
|
24
|
+
/** Initial filter for uncontrolled use. */
|
|
25
|
+
defaultFilter?: FilterTableStatus | null;
|
|
26
|
+
onFilterChange?: (filter: FilterTableStatus | null) => void;
|
|
27
|
+
/** Label used on the "show everything" chip. */
|
|
28
|
+
allLabel?: string;
|
|
29
|
+
/** Column headers, in render order. */
|
|
30
|
+
headers?: {
|
|
31
|
+
name: string;
|
|
32
|
+
date: string;
|
|
33
|
+
status: string;
|
|
34
|
+
owner: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A light task table whose status chips reorganize the visible rows in place.
|
|
39
|
+
* Row movement is animated with a FLIP pass that only touches `transform`.
|
|
40
|
+
*/
|
|
41
|
+
export declare const FilterTable: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & {
|
|
42
|
+
rows: readonly FilterTableRow[];
|
|
43
|
+
/** Required accessible name for the table. */
|
|
44
|
+
caption: string;
|
|
45
|
+
/** Controlled filter. `null` shows every row. */
|
|
46
|
+
filter?: FilterTableStatus | null;
|
|
47
|
+
/** Initial filter for uncontrolled use. */
|
|
48
|
+
defaultFilter?: FilterTableStatus | null;
|
|
49
|
+
onFilterChange?: (filter: FilterTableStatus | null) => void;
|
|
50
|
+
/** Label used on the "show everything" chip. */
|
|
51
|
+
allLabel?: string;
|
|
52
|
+
/** Column headers, in render order. */
|
|
53
|
+
headers?: {
|
|
54
|
+
name: string;
|
|
55
|
+
date: string;
|
|
56
|
+
status: string;
|
|
57
|
+
owner: string;
|
|
58
|
+
};
|
|
59
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
60
|
+
export type FilterTableStatusLabelMap = Record<FilterTableStatus, string>;
|
|
61
|
+
export declare const filterTableStatusLabels: FilterTableStatusLabelMap;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type CSSProperties } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Milliseconds one cell spends flipping. Mirrors `--motion-duration-moderate`;
|
|
5
|
+
* the CSS reads the token directly and only falls back to this number when the
|
|
6
|
+
* caller overrides `flapDuration`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const FLAP_TEXT_DEFAULT_DURATION_MS = 220;
|
|
9
|
+
/** Milliseconds each successive cell waits before it starts flipping. */
|
|
10
|
+
export declare const FLAP_TEXT_DEFAULT_STAGGER_MS = 18;
|
|
11
|
+
export type FlapTextElement = "span" | "div" | "p" | "strong" | "em";
|
|
12
|
+
export type FlapTextAlign = "start" | "center" | "end";
|
|
13
|
+
export interface FlapTextProps {
|
|
14
|
+
/** The string to display. Changing it flips the characters that differ. */
|
|
15
|
+
text: string;
|
|
16
|
+
/** Host element. @default "span" */
|
|
17
|
+
as?: FlapTextElement;
|
|
18
|
+
/** Per-character delay, in milliseconds. @default 18 */
|
|
19
|
+
stagger?: number;
|
|
20
|
+
/** Flip duration, in milliseconds. @default `--motion-duration-moderate` */
|
|
21
|
+
flapDuration?: number;
|
|
22
|
+
/** Horizontal alignment of the rendered line. @default "start" */
|
|
23
|
+
align?: FlapTextAlign;
|
|
24
|
+
className?: string;
|
|
25
|
+
style?: CSSProperties;
|
|
26
|
+
}
|
|
27
|
+
export type FlapCell = {
|
|
28
|
+
/** Glyph shown once the cell settles. */
|
|
29
|
+
char: string;
|
|
30
|
+
/** Glyph rotating out, or `null` when the cell is new or settled. */
|
|
31
|
+
previous: string | null;
|
|
32
|
+
/** Whether this cell is mid-flip. */
|
|
33
|
+
flap: boolean;
|
|
34
|
+
/** Trailing cell that disappears when the text got shorter. */
|
|
35
|
+
exiting: boolean;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A Solari board only moves the cells whose glyph actually changed. Identical
|
|
39
|
+
* characters at the same index stay perfectly still, which is both faithful and
|
|
40
|
+
* far calmer to read.
|
|
41
|
+
*/
|
|
42
|
+
export declare function flapTextCells(previous: string, next: string): FlapCell[];
|
|
43
|
+
/**
|
|
44
|
+
* Split-flap text.
|
|
45
|
+
*
|
|
46
|
+
* Each character is its own cell. When `text` changes, only the cells whose
|
|
47
|
+
* glyph differs flip: the old glyph rotates away around the horizontal midline
|
|
48
|
+
* while the new one rotates in behind it, staggered left to right.
|
|
49
|
+
*
|
|
50
|
+
* Sharpness: cells are inline-block with `preserve-3d` and hidden backfaces,
|
|
51
|
+
* `will-change: transform` is present only while a cell is actually flipping,
|
|
52
|
+
* and settled cells carry `transform: none` exactly — never an identity matrix
|
|
53
|
+
* — so the browser re-rasterises the glyph at full fidelity. No scale is ever
|
|
54
|
+
* applied, and the component sets no font property, so text metrics are the
|
|
55
|
+
* caller's.
|
|
56
|
+
*
|
|
57
|
+
* Accessibility: cells are `aria-hidden`, the host carries `aria-label={text}`,
|
|
58
|
+
* and a visually hidden polite live region announces one clean string.
|
|
59
|
+
*
|
|
60
|
+
* Reduced motion: no 3D at all — a fast opacity crossfade swaps the glyph.
|
|
61
|
+
*/
|
|
62
|
+
export declare function FlapText({ text, as, stagger, flapDuration, align, className, style, }: FlapTextProps): import("react").DetailedReactHTMLElement<{
|
|
63
|
+
className: string;
|
|
64
|
+
style: CSSProperties | undefined;
|
|
65
|
+
"aria-label": string;
|
|
66
|
+
"data-align": FlapTextAlign;
|
|
67
|
+
"data-flapping": string;
|
|
68
|
+
}, HTMLElement>;
|