@mithrl/design-system 0.1.0 → 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.
@@ -0,0 +1,144 @@
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
+ import { type GlobalAppBarProjectSelector, type GlobalAppBarProps } from "../../components/global-app-bar/GlobalAppBar";
3
+ import { type ResizablePanelGroupProps, type ResizablePanelMinimum } from "../../components/resizable-panels/ResizablePanels";
4
+ import { type WorkspaceNavigationPresentation, type WorkspaceNavigationProps } from "../../components/workspace-navigation/WorkspaceNavigation";
5
+ import type { ThemeMode } from "../../components/switch/Switch";
6
+
7
+ export type WorkspaceAppShellLayout = "expanded" | "condensed" | "single";
8
+ type NativeWorkspaceAppShellProps = Omit<HTMLAttributes<HTMLDivElement>, "children">;
9
+ type WorkspaceAppBarConfiguration = Omit<GlobalAppBarProps, "defaultTheme" | "onThemeChange" | "theme" | "workspaceControls">;
10
+ export type WorkspaceNavigationConfiguration = Omit<WorkspaceNavigationProps, "presentation">;
11
+ type WorkspaceProjectSelectorConfiguration = Omit<GlobalAppBarProjectSelector, "presentation">;
12
+ export type WorkspaceAppShellNavigationRenderContext = {
13
+ /** Active structural layout selected from the shell's rendered width. */
14
+ layout: WorkspaceAppShellLayout;
15
+ /** Inline on persistent layouts and Overlay in the single-region layout. */
16
+ presentation: WorkspaceNavigationPresentation;
17
+ /** Current controlled or uncontrolled Navigation visibility. */
18
+ open: boolean;
19
+ /** Stable App Bar toggle identity for focus return from compact overlays. */
20
+ navigationToggleId: string;
21
+ /** Requests dismissal after safely relocating focus through the shell. */
22
+ requestClose: () => void;
23
+ };
24
+ export type WorkspaceAppShellNavigationRenderer = (context: WorkspaceAppShellNavigationRenderContext) => ReactNode;
25
+ export type WorkspaceAppShellProps = NativeWorkspaceAppShellProps & {
26
+ /** Global App Bar account, brand, and native attributes. */
27
+ appBar: WorkspaceAppBarConfiguration;
28
+ /** Project context rendered by the approved Global App Bar selector. */
29
+ projectSelector: WorkspaceProjectSelectorConfiguration;
30
+ /** Workspace Navigation content; App Shell selects Inline or Overlay. */
31
+ navigation?: WorkspaceNavigationConfiguration;
32
+ /**
33
+ * Product-navigation adapter for domain-specific status and nested artifacts.
34
+ * Use instead of `navigation`; the shell still owns visibility and focus.
35
+ */
36
+ renderNavigation?: WorkspaceAppShellNavigationRenderer;
37
+ /** Product-owned Primary Panel content. */
38
+ primary: ReactNode;
39
+ /** Product-owned Secondary Panel content. */
40
+ secondary: ReactNode;
41
+ /** Controlled active theme for the entire shell. */
42
+ theme?: ThemeMode;
43
+ /** Initial active theme for uncontrolled use. */
44
+ defaultTheme?: ThemeMode;
45
+ /** Reports a theme request from the Global App Bar. */
46
+ onThemeChange?: (theme: ThemeMode) => void;
47
+ /** Controlled Navigation visibility. */
48
+ navigationOpen?: boolean;
49
+ /** Initial Navigation visibility. Defaults to open. */
50
+ defaultNavigationOpen?: boolean;
51
+ /** Reports explicit Navigation toggle or compact-overlay dismissal. */
52
+ onNavigationOpenChange?: (open: boolean) => void;
53
+ /** Controlled Secondary Panel visibility. */
54
+ secondaryOpen?: boolean;
55
+ /** Initial Secondary visibility. Defaults to collapsed. */
56
+ defaultSecondaryOpen?: boolean;
57
+ /** Reports explicit Secondary toggle requests. */
58
+ onSecondaryOpenChange?: (open: boolean) => void;
59
+ /** Controlled Primary share for the persistent desktop split. */
60
+ split?: number;
61
+ /** Initial Primary share. Defaults to the approved 60%. */
62
+ defaultSplit?: number;
63
+ /** Reports every pointer or keyboard resize. */
64
+ onSplitChange?: ResizablePanelGroupProps["onValueChange"];
65
+ /** Reports the final pointer value or each committed keyboard step. */
66
+ onSplitCommit?: ResizablePanelGroupProps["onValueCommit"];
67
+ /** Controlled Secondary width in pixels. Use for product `rightWidth`. */
68
+ secondaryWidth?: number;
69
+ /** Initial Secondary width for uncontrolled pixel-based persistence. */
70
+ defaultSecondaryWidth?: number;
71
+ /** Reports every resize in Secondary pixels. */
72
+ onSecondaryWidthChange?: ResizablePanelGroupProps["onSecondarySizeChange"];
73
+ /** Reports the final pointer value or each keyboard step in pixels. */
74
+ onSecondaryWidthCommit?: ResizablePanelGroupProps["onSecondarySizeCommit"];
75
+ /** Primary minimum-size policy. Defaults to Standard. */
76
+ primaryMinSize?: ResizablePanelMinimum;
77
+ /** Secondary minimum in pixels. Defaults to 280px. */
78
+ secondaryMinSize?: number;
79
+ /** Accessible splitter label when the Primary region has no visible label. */
80
+ resizeLabel?: string;
81
+ };
82
+ /**
83
+ * Complete Workspace layout pattern. It composes the approved Global App Bar,
84
+ * Workspace Navigation, and Resizable Panels contracts while product code
85
+ * retains routing, content, data fetching, and persistence ownership.
86
+ */
87
+ export declare const WorkspaceAppShell: import("react").ForwardRefExoticComponent<NativeWorkspaceAppShellProps & {
88
+ /** Global App Bar account, brand, and native attributes. */
89
+ appBar: WorkspaceAppBarConfiguration;
90
+ /** Project context rendered by the approved Global App Bar selector. */
91
+ projectSelector: WorkspaceProjectSelectorConfiguration;
92
+ /** Workspace Navigation content; App Shell selects Inline or Overlay. */
93
+ navigation?: WorkspaceNavigationConfiguration;
94
+ /**
95
+ * Product-navigation adapter for domain-specific status and nested artifacts.
96
+ * Use instead of `navigation`; the shell still owns visibility and focus.
97
+ */
98
+ renderNavigation?: WorkspaceAppShellNavigationRenderer;
99
+ /** Product-owned Primary Panel content. */
100
+ primary: ReactNode;
101
+ /** Product-owned Secondary Panel content. */
102
+ secondary: ReactNode;
103
+ /** Controlled active theme for the entire shell. */
104
+ theme?: ThemeMode;
105
+ /** Initial active theme for uncontrolled use. */
106
+ defaultTheme?: ThemeMode;
107
+ /** Reports a theme request from the Global App Bar. */
108
+ onThemeChange?: (theme: ThemeMode) => void;
109
+ /** Controlled Navigation visibility. */
110
+ navigationOpen?: boolean;
111
+ /** Initial Navigation visibility. Defaults to open. */
112
+ defaultNavigationOpen?: boolean;
113
+ /** Reports explicit Navigation toggle or compact-overlay dismissal. */
114
+ onNavigationOpenChange?: (open: boolean) => void;
115
+ /** Controlled Secondary Panel visibility. */
116
+ secondaryOpen?: boolean;
117
+ /** Initial Secondary visibility. Defaults to collapsed. */
118
+ defaultSecondaryOpen?: boolean;
119
+ /** Reports explicit Secondary toggle requests. */
120
+ onSecondaryOpenChange?: (open: boolean) => void;
121
+ /** Controlled Primary share for the persistent desktop split. */
122
+ split?: number;
123
+ /** Initial Primary share. Defaults to the approved 60%. */
124
+ defaultSplit?: number;
125
+ /** Reports every pointer or keyboard resize. */
126
+ onSplitChange?: ResizablePanelGroupProps["onValueChange"];
127
+ /** Reports the final pointer value or each committed keyboard step. */
128
+ onSplitCommit?: ResizablePanelGroupProps["onValueCommit"];
129
+ /** Controlled Secondary width in pixels. Use for product `rightWidth`. */
130
+ secondaryWidth?: number;
131
+ /** Initial Secondary width for uncontrolled pixel-based persistence. */
132
+ defaultSecondaryWidth?: number;
133
+ /** Reports every resize in Secondary pixels. */
134
+ onSecondaryWidthChange?: ResizablePanelGroupProps["onSecondarySizeChange"];
135
+ /** Reports the final pointer value or each keyboard step in pixels. */
136
+ onSecondaryWidthCommit?: ResizablePanelGroupProps["onSecondarySizeCommit"];
137
+ /** Primary minimum-size policy. Defaults to Standard. */
138
+ primaryMinSize?: ResizablePanelMinimum;
139
+ /** Secondary minimum in pixels. Defaults to 280px. */
140
+ secondaryMinSize?: number;
141
+ /** Accessible splitter label when the Primary region has no visible label. */
142
+ resizeLabel?: string;
143
+ } & import("react").RefAttributes<HTMLDivElement>>;
144
+ export {};
@@ -0,0 +1,24 @@
1
+ import { type ReactNode } from "react";
2
+ import { type DialogContentProps } from "../../components/dialog/Dialog";
3
+
4
+ export type WorkspaceNewQuestionDraft = {
5
+ question: string;
6
+ };
7
+ export type WorkspaceNewQuestionDialogProps = {
8
+ open?: boolean;
9
+ defaultOpen?: boolean;
10
+ onOpenChange?: (open: boolean) => void;
11
+ /** Associates the controlled Dialog with the Navigation action. */
12
+ triggerId?: string;
13
+ initialQuestion?: string;
14
+ onStart: (draft: WorkspaceNewQuestionDraft) => void | Promise<void>;
15
+ submitting?: boolean;
16
+ submitError?: ReactNode;
17
+ portalContainer?: DialogContentProps["portalContainer"];
18
+ className?: string;
19
+ };
20
+ /**
21
+ * Controlled Workspace entry pattern. Session creation, routing, persistence,
22
+ * authorization, and analytics remain owned by the product.
23
+ */
24
+ export declare function WorkspaceNewQuestionDialog({ open, defaultOpen, onOpenChange, triggerId, initialQuestion, onStart, submitting, submitError, portalContainer, className, }: WorkspaceNewQuestionDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,49 @@
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
+
3
+ export type WorkspaceQuestionSurfacePanel = "primary" | "secondary";
4
+ export type WorkspaceQuestionSurfaceScroll = "consumer" | "surface";
5
+ type NativeWorkspaceQuestionSurfaceProps = Omit<HTMLAttributes<HTMLElement>, "children" | "title">;
6
+ export type WorkspaceQuestionSurfaceProps = NativeWorkspaceQuestionSurfaceProps & {
7
+ /** Panel that owns this mounted Question. Ownership remains product state. */
8
+ panel: WorkspaceQuestionSurfacePanel;
9
+ /** Full Question name used by the Primary header and region label. */
10
+ questionTitle: string;
11
+ /** Product-owned Question content inside the approved panel containment. */
12
+ children: ReactNode;
13
+ /** Product-owned Composer or ComposerViewTransition for this session. */
14
+ composer: ReactNode;
15
+ /**
16
+ * Scroll owner. Defaults to the consumer so existing Chat viewport logic,
17
+ * streaming follow, and minimaps remain unchanged.
18
+ */
19
+ contentScroll?: WorkspaceQuestionSurfaceScroll;
20
+ /** Product actions shown beside the Primary Question title. */
21
+ headerActions?: ReactNode;
22
+ /** Shows the contextual header. Defaults to true only in Primary. */
23
+ showHeader?: boolean;
24
+ };
25
+ /**
26
+ * Session-bound Question layout for either Workspace owner panel. The product
27
+ * supplies Chat and Composer behavior; this pattern owns the approved header,
28
+ * scroll containment, bottom anchoring, and adaptive fade.
29
+ */
30
+ export declare const WorkspaceQuestionSurface: import("react").ForwardRefExoticComponent<NativeWorkspaceQuestionSurfaceProps & {
31
+ /** Panel that owns this mounted Question. Ownership remains product state. */
32
+ panel: WorkspaceQuestionSurfacePanel;
33
+ /** Full Question name used by the Primary header and region label. */
34
+ questionTitle: string;
35
+ /** Product-owned Question content inside the approved panel containment. */
36
+ children: ReactNode;
37
+ /** Product-owned Composer or ComposerViewTransition for this session. */
38
+ composer: ReactNode;
39
+ /**
40
+ * Scroll owner. Defaults to the consumer so existing Chat viewport logic,
41
+ * streaming follow, and minimaps remain unchanged.
42
+ */
43
+ contentScroll?: WorkspaceQuestionSurfaceScroll;
44
+ /** Product actions shown beside the Primary Question title. */
45
+ headerActions?: ReactNode;
46
+ /** Shows the contextual header. Defaults to true only in Primary. */
47
+ showHeader?: boolean;
48
+ } & import("react").RefAttributes<HTMLElement>>;
49
+ export {};