@northlight/ui 2.42.0 → 2.42.2
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/sandbox/index.d.ts +44 -0
- package/dist/sandbox/index.js +10626 -0
- package/dist/sandbox/index.js.map +1 -0
- package/package.json +7 -3
- package/sandbox/bin/sandbox.ts +2 -7
- package/sandbox/lib/run-scenarios.ts +6 -2
- package/sandbox/lib/types.ts +0 -1
- package/sandbox/lib/viewer/sandbox-viewer.tsx +2 -9
- package/sandbox/package.json +2 -2
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { within, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { ComponentType } from 'react';
|
|
4
|
+
|
|
5
|
+
type PlayContext = {
|
|
6
|
+
screen: ReturnType<typeof within>;
|
|
7
|
+
documentScreen: typeof screen;
|
|
8
|
+
user: ReturnType<typeof userEvent.setup>;
|
|
9
|
+
container: HTMLElement;
|
|
10
|
+
};
|
|
11
|
+
type Scenario<P> = {
|
|
12
|
+
name: string;
|
|
13
|
+
props: P;
|
|
14
|
+
component?: undefined;
|
|
15
|
+
play?: (context: PlayContext) => Promise<void>;
|
|
16
|
+
code?: string;
|
|
17
|
+
} | {
|
|
18
|
+
name: string;
|
|
19
|
+
props: Record<string, unknown>;
|
|
20
|
+
component: ComponentType<any>;
|
|
21
|
+
play?: (context: PlayContext) => Promise<void>;
|
|
22
|
+
code?: string;
|
|
23
|
+
};
|
|
24
|
+
type ComponentScenarios<P = any> = {
|
|
25
|
+
name: string;
|
|
26
|
+
component: ComponentType<P>;
|
|
27
|
+
scenarios: Scenario<P>[];
|
|
28
|
+
inline?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
declare function runScenarios(allScenarios: ComponentScenarios[]): void;
|
|
32
|
+
|
|
33
|
+
type SandboxViewerProps = {
|
|
34
|
+
scenarios: ComponentScenarios[];
|
|
35
|
+
/** Custom title for the landing page */
|
|
36
|
+
title?: string;
|
|
37
|
+
/** Custom description for the landing page */
|
|
38
|
+
description?: string;
|
|
39
|
+
/** Whether to show the hero section (default: true) */
|
|
40
|
+
showHero?: boolean;
|
|
41
|
+
};
|
|
42
|
+
declare function SandboxViewer({ scenarios, title, description, showHero }: SandboxViewerProps): JSX.Element;
|
|
43
|
+
|
|
44
|
+
export { ComponentScenarios, PlayContext, SandboxViewer, Scenario, runScenarios };
|