@tanstack/cta-ui-base 0.20.0 → 0.21.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/app.d.ts CHANGED
@@ -1 +1,10 @@
1
- export default function RootComponent(): import("react/jsx-runtime").JSX.Element;
1
+ export interface RootComponentProps {
2
+ slots?: Partial<{
3
+ header: React.ReactNode;
4
+ sidebar: React.ReactNode;
5
+ fileNavigator: React.ReactNode;
6
+ startupDialog: React.ReactNode;
7
+ }>;
8
+ }
9
+ export declare const defaultSlots: RootComponentProps['slots'];
10
+ export default function RootComponent(props: RootComponentProps): import("react/jsx-runtime").JSX.Element;
package/dist/app.js CHANGED
@@ -5,6 +5,13 @@ import { BackgroundAnimation } from './components/background-animation';
5
5
  import FileNavigator from './components/file-navigator';
6
6
  import StartupDialog from './components/startup-dialog';
7
7
  import { CTAProvider } from './components/cta-provider';
8
- export default function RootComponent() {
9
- return (_jsx(CTAProvider, { children: _jsxs("main", { className: "min-w-[1280px]", children: [_jsx(BackgroundAnimation, {}), _jsxs("div", { className: "min-h-dvh p-2 sm:p-4 space-y-2 sm:space-y-4 @container", children: [_jsx(AppHeader, {}), _jsxs("div", { className: "flex flex-row", children: [_jsx("div", { className: "w-1/3 @8xl:w-1/4 pr-2", children: _jsx(AppSidebar, {}) }), _jsx("div", { className: "w-2/3 @8xl:w-3/4 pl-2", children: _jsx(FileNavigator, {}) })] })] }), _jsx(StartupDialog, {})] }) }));
8
+ export const defaultSlots = {
9
+ header: _jsx(AppHeader, {}),
10
+ sidebar: _jsx(AppSidebar, {}),
11
+ fileNavigator: _jsx(FileNavigator, {}),
12
+ startupDialog: _jsx(StartupDialog, {}),
13
+ };
14
+ export default function RootComponent(props) {
15
+ const slots = Object.assign({}, defaultSlots, props.slots);
16
+ return (_jsx(CTAProvider, { children: _jsxs("main", { className: "min-w-[1280px]", children: [_jsx(BackgroundAnimation, {}), _jsxs("div", { className: "min-h-dvh p-2 sm:p-4 space-y-2 sm:space-y-4 @container", children: [slots.header, _jsxs("div", { className: "flex flex-row", children: [_jsx("div", { className: "w-1/3 @8xl:w-1/4 pr-2", children: slots.sidebar }), _jsx("div", { className: "w-2/3 @8xl:w-3/4 pl-2", children: slots.fileNavigator })] })] }), slots.startupDialog] }) }));
10
17
  }
@@ -1 +1,7 @@
1
- export declare function AppSidebar(): import("react/jsx-runtime").JSX.Element;
1
+ export interface SidebarProps {
2
+ slots?: {
3
+ actions: React.ReactNode;
4
+ };
5
+ }
6
+ export declare const DefaultAppSidebarActions: () => import("react/jsx-runtime").JSX.Element;
7
+ export declare function AppSidebar(props: SidebarProps): import("react/jsx-runtime").JSX.Element;
@@ -8,8 +8,13 @@ import ModeSelector from './sidebar-items/mode-selector';
8
8
  import TypescriptSwitch from './sidebar-items/typescript-switch';
9
9
  import StarterDialog from './sidebar-items/starter';
10
10
  import SidebarGroup from './sidebar-items/sidebar-group';
11
- export function AppSidebar() {
11
+ export const DefaultAppSidebarActions = () => (_jsxs("div", { className: "mt-5", children: [_jsx(RunAddOns, {}), _jsx(RunCreateApp, {})] }));
12
+ const defaultSlots = {
13
+ actions: _jsx(DefaultAppSidebarActions, {}),
14
+ };
15
+ export function AppSidebar(props) {
12
16
  const ready = useReady();
13
17
  const mode = useApplicationMode();
14
- return (_jsxs("div", { className: "flex flex-col gap-2", children: [ready && (_jsxs(_Fragment, { children: [mode === 'setup' && (_jsxs(SidebarGroup, { children: [_jsx(ProjectName, {}), _jsx(ModeSelector, {}), _jsx(TypescriptSwitch, {})] })), _jsx(SidebarGroup, { children: _jsx(SelectedAddOns, {}) }), mode === 'setup' && (_jsx(SidebarGroup, { children: _jsx(StarterDialog, {}) }))] })), _jsxs("div", { className: "mt-5", children: [_jsx(RunAddOns, {}), _jsx(RunCreateApp, {})] })] }));
18
+ const slots = Object.assign({}, defaultSlots, props.slots);
19
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [ready && (_jsxs(_Fragment, { children: [mode === 'setup' && (_jsxs(SidebarGroup, { children: [_jsx(ProjectName, {}), _jsx(ModeSelector, {}), _jsx(TypescriptSwitch, {})] })), _jsx(SidebarGroup, { children: _jsx(SelectedAddOns, {}) }), mode === 'setup' && (_jsx(SidebarGroup, { children: _jsx(StarterDialog, {}) }))] })), slots.actions] }));
15
20
  }
package/package.json CHANGED
@@ -45,6 +45,6 @@
45
45
  "vite-tsconfig-paths": "^5.1.4",
46
46
  "vitest": "^3.1.4"
47
47
  },
48
- "version": "0.20.0",
48
+ "version": "0.21.0",
49
49
  "scripts": {}
50
50
  }
package/src/app.tsx CHANGED
@@ -5,23 +5,41 @@ import FileNavigator from './components/file-navigator'
5
5
  import StartupDialog from './components/startup-dialog'
6
6
  import { CTAProvider } from './components/cta-provider'
7
7
 
8
- export default function RootComponent() {
8
+ export interface RootComponentProps {
9
+ slots?: Partial<{
10
+ header: React.ReactNode
11
+ sidebar: React.ReactNode
12
+ fileNavigator: React.ReactNode
13
+ startupDialog: React.ReactNode
14
+ }>
15
+ }
16
+
17
+ export const defaultSlots: RootComponentProps['slots'] = {
18
+ header: <AppHeader />,
19
+ sidebar: <AppSidebar />,
20
+ fileNavigator: <FileNavigator />,
21
+ startupDialog: <StartupDialog />,
22
+ }
23
+
24
+ export default function RootComponent(props: RootComponentProps) {
25
+ const slots = Object.assign({}, defaultSlots, props.slots)
26
+
9
27
  return (
10
28
  <CTAProvider>
11
29
  <main className="min-w-[1280px]">
12
30
  <BackgroundAnimation />
13
31
  <div className="min-h-dvh p-2 sm:p-4 space-y-2 sm:space-y-4 @container">
14
- <AppHeader />
32
+ {slots.header}
15
33
  <div className="flex flex-row">
16
34
  <div className="w-1/3 @8xl:w-1/4 pr-2">
17
- <AppSidebar />
35
+ {slots.sidebar}
18
36
  </div>
19
37
  <div className="w-2/3 @8xl:w-3/4 pl-2">
20
- <FileNavigator />
38
+ {slots.fileNavigator}
21
39
  </div>
22
40
  </div>
23
41
  </div>
24
- <StartupDialog />
42
+ {slots.startupDialog}
25
43
  </main>
26
44
  </CTAProvider>
27
45
  )
@@ -9,9 +9,27 @@ import TypescriptSwitch from './sidebar-items/typescript-switch'
9
9
  import StarterDialog from './sidebar-items/starter'
10
10
  import SidebarGroup from './sidebar-items/sidebar-group'
11
11
 
12
- export function AppSidebar() {
12
+ export interface SidebarProps {
13
+ slots?: {
14
+ actions: React.ReactNode
15
+ }
16
+ }
17
+
18
+ export const DefaultAppSidebarActions = () => (
19
+ <div className="mt-5">
20
+ <RunAddOns />
21
+ <RunCreateApp />
22
+ </div>
23
+ )
24
+
25
+ const defaultSlots: SidebarProps['slots'] = {
26
+ actions: <DefaultAppSidebarActions />,
27
+ }
28
+
29
+ export function AppSidebar(props: SidebarProps) {
13
30
  const ready = useReady()
14
31
  const mode = useApplicationMode()
32
+ const slots = Object.assign({}, defaultSlots, props.slots)
15
33
 
16
34
  return (
17
35
  <div className="flex flex-col gap-2">
@@ -34,10 +52,7 @@ export function AppSidebar() {
34
52
  )}
35
53
  </>
36
54
  )}
37
- <div className="mt-5">
38
- <RunAddOns />
39
- <RunCreateApp />
40
- </div>
55
+ {slots.actions}
41
56
  </div>
42
57
  )
43
58
  }
@@ -20,6 +20,7 @@ import {
20
20
  import StatusList from '../status-list'
21
21
  import { createAppStreaming, shutdown } from '../../lib/api'
22
22
 
23
+
23
24
  export default function RunCreateApp() {
24
25
  const [isRunning, setIsRunning] = useState(false)
25
26
  const { streamItems, monitorStream, finished } = useStreamingStatus()
package/src/index.ts CHANGED
@@ -41,4 +41,4 @@ export {
41
41
  useReady,
42
42
  }
43
43
 
44
- export default RootComponent
44
+ export default RootComponent