@mithrl/design-system 0.2.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.
@@ -1,21 +1,39 @@
1
1
  import { type HTMLAttributes, type ReactNode } from "react";
2
2
  import { type GlobalAppBarProjectSelector, type GlobalAppBarProps } from "../../components/global-app-bar/GlobalAppBar";
3
3
  import { type ResizablePanelGroupProps, type ResizablePanelMinimum } from "../../components/resizable-panels/ResizablePanels";
4
- import { type WorkspaceNavigationProps } from "../../components/workspace-navigation/WorkspaceNavigation";
4
+ import { type WorkspaceNavigationPresentation, type WorkspaceNavigationProps } from "../../components/workspace-navigation/WorkspaceNavigation";
5
5
  import type { ThemeMode } from "../../components/switch/Switch";
6
6
 
7
7
  export type WorkspaceAppShellLayout = "expanded" | "condensed" | "single";
8
8
  type NativeWorkspaceAppShellProps = Omit<HTMLAttributes<HTMLDivElement>, "children">;
9
9
  type WorkspaceAppBarConfiguration = Omit<GlobalAppBarProps, "defaultTheme" | "onThemeChange" | "theme" | "workspaceControls">;
10
- type WorkspaceNavigationConfiguration = Omit<WorkspaceNavigationProps, "presentation">;
10
+ export type WorkspaceNavigationConfiguration = Omit<WorkspaceNavigationProps, "presentation">;
11
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;
12
25
  export type WorkspaceAppShellProps = NativeWorkspaceAppShellProps & {
13
26
  /** Global App Bar account, brand, and native attributes. */
14
27
  appBar: WorkspaceAppBarConfiguration;
15
28
  /** Project context rendered by the approved Global App Bar selector. */
16
29
  projectSelector: WorkspaceProjectSelectorConfiguration;
17
30
  /** Workspace Navigation content; App Shell selects Inline or Overlay. */
18
- navigation: WorkspaceNavigationConfiguration;
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;
19
37
  /** Product-owned Primary Panel content. */
20
38
  primary: ReactNode;
21
39
  /** Product-owned Secondary Panel content. */
@@ -46,6 +64,14 @@ export type WorkspaceAppShellProps = NativeWorkspaceAppShellProps & {
46
64
  onSplitChange?: ResizablePanelGroupProps["onValueChange"];
47
65
  /** Reports the final pointer value or each committed keyboard step. */
48
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"];
49
75
  /** Primary minimum-size policy. Defaults to Standard. */
50
76
  primaryMinSize?: ResizablePanelMinimum;
51
77
  /** Secondary minimum in pixels. Defaults to 280px. */
@@ -64,7 +90,12 @@ export declare const WorkspaceAppShell: import("react").ForwardRefExoticComponen
64
90
  /** Project context rendered by the approved Global App Bar selector. */
65
91
  projectSelector: WorkspaceProjectSelectorConfiguration;
66
92
  /** Workspace Navigation content; App Shell selects Inline or Overlay. */
67
- navigation: WorkspaceNavigationConfiguration;
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;
68
99
  /** Product-owned Primary Panel content. */
69
100
  primary: ReactNode;
70
101
  /** Product-owned Secondary Panel content. */
@@ -95,6 +126,14 @@ export declare const WorkspaceAppShell: import("react").ForwardRefExoticComponen
95
126
  onSplitChange?: ResizablePanelGroupProps["onValueChange"];
96
127
  /** Reports the final pointer value or each committed keyboard step. */
97
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"];
98
137
  /** Primary minimum-size policy. Defaults to Standard. */
99
138
  primaryMinSize?: ResizablePanelMinimum;
100
139
  /** Secondary minimum in pixels. Defaults to 280px. */
@@ -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 {};