@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@northlight/ui",
3
- "version": "2.42.0",
3
+ "version": "2.42.2",
4
4
  "description": "Northlight UI library, based on Chakra-ui",
5
5
  "license": "MIT",
6
6
  "author": "Camphouse",
@@ -12,7 +12,10 @@
12
12
  "import": "./dist/es/northlight.js",
13
13
  "require": "./dist/umd/northlight.cjs"
14
14
  },
15
- "./sandbox": "./sandbox/lib/index.ts"
15
+ "./sandbox": {
16
+ "types": "./dist/sandbox/index.d.ts",
17
+ "import": "./dist/sandbox/index.js"
18
+ }
16
19
  },
17
20
  "bin": {
18
21
  "sandbox": "./sandbox/bin/sandbox.sh"
@@ -111,6 +114,7 @@
111
114
  "rollup": "^3.17.2",
112
115
  "rollup-plugin-dts": "^5.2.0",
113
116
  "rollup-plugin-esbuild": "^5.0.0",
117
+ "rollup-plugin-postcss": "^4.0.2",
114
118
  "sinon": "^15.2.0",
115
119
  "typescript": "^5.2.2",
116
120
  "vitest": "^2.0.0"
@@ -120,5 +124,5 @@
120
124
  "react-dom": ">=18.0.0",
121
125
  "react-router-dom": "^5.0.0"
122
126
  },
123
- "gitHead": "d31008fa6256e7145c086f5a2f826d8245b6ea4c"
127
+ "gitHead": "3c091316a421709cfffd946b6956b4ef9c4d578c"
124
128
  }
@@ -1,14 +1,11 @@
1
1
  /* eslint-disable no-restricted-syntax */
2
2
  import { existsSync } from 'node:fs'
3
- import { dirname, resolve } from 'node:path'
4
- import { fileURLToPath } from 'node:url'
3
+ import { resolve } from 'node:path'
5
4
  import react from '@vitejs/plugin-react'
6
5
  import { createServer } from 'vite'
7
6
 
8
7
  const DEFAULT_SCENARIOS_PATHS = [ 'sandbox/scenarios.ts', 'sandbox/scenarios.tsx' ]
9
8
 
10
- const __dirname = dirname(fileURLToPath(import.meta.url))
11
-
12
9
  function findScenariosFile (cwd: string, scenariosArg?: string): string | undefined {
13
10
  if (scenariosArg) {
14
11
  const absolutePath = resolve(cwd, scenariosArg)
@@ -36,8 +33,6 @@ async function main () {
36
33
  process.exit(1)
37
34
  }
38
35
 
39
- const sandboxPackageDir = resolve(__dirname, '..')
40
-
41
36
  const virtualEntryId = 'virtual:sandbox-entry.tsx'
42
37
  const resolvedVirtualEntryId = `\0${virtualEntryId}`
43
38
 
@@ -64,7 +59,7 @@ async function main () {
64
59
  return `
65
60
  import { createElement } from 'react'
66
61
  import { createRoot } from 'react-dom/client'
67
- import { SandboxViewer } from '${sandboxPackageDir}/lib/viewer/sandbox-viewer.tsx'
62
+ import { SandboxViewer } from '@northlight/ui/sandbox'
68
63
  import { scenarios } from '${absoluteScenariosPath}'
69
64
 
70
65
  const root = document.getElementById('root')
@@ -6,7 +6,8 @@ import { MediatoolThemeProvider, theme } from '../../lib'
6
6
  import type { ComponentScenarios, PlayContext } from './types.ts'
7
7
 
8
8
  declare const describe: (name: string, fn: () => void) => void
9
- declare const it: (name: string, fn: () => void | Promise<void>) => void
9
+ type TimeoutSetter = { timeout: (ms: number) => void }
10
+ declare const it: ((name: string, fn: () => void | Promise<void>) => TimeoutSetter)
10
11
 
11
12
  if (typeof window !== 'undefined' && !window.matchMedia) {
12
13
  window.matchMedia = (query: string) => ({
@@ -21,6 +22,8 @@ if (typeof window !== 'undefined' && !window.matchMedia) {
21
22
  })
22
23
  }
23
24
 
25
+ const CI_TIMEOUT_SAFETY_NET = 30_000
26
+
24
27
  function runScenarios (allScenarios: ComponentScenarios[]): void {
25
28
  for (const componentScenarios of allScenarios) {
26
29
  const { name: componentName, component: defaultComponent, scenarios } = componentScenarios
@@ -35,6 +38,7 @@ function runScenarios (allScenarios: ComponentScenarios[]): void {
35
38
  const { container } = render(
36
39
  createElement(
37
40
  MediatoolThemeProvider,
41
+ // @ts-expect-error children passed as 3rd arg to satisfy react/no-children-prop
38
42
  { theme },
39
43
  createElement(component, props as Record<string, unknown>)
40
44
  )
@@ -51,7 +55,7 @@ function runScenarios (allScenarios: ComponentScenarios[]): void {
51
55
  }
52
56
 
53
57
  cleanup()
54
- })
58
+ }).timeout(CI_TIMEOUT_SAFETY_NET)
55
59
  }
56
60
  })
57
61
  }
@@ -30,7 +30,6 @@ type ComponentScenarios<P = any> = {
30
30
  component: ComponentType<P>
31
31
  scenarios: Scenario<P>[]
32
32
  inline?: boolean
33
- layout?: 'stacked' | 'tabbed'
34
33
  }
35
34
 
36
35
  export type { PlayContext, Scenario, ComponentScenarios }
@@ -820,14 +820,7 @@ function SandboxViewerContent ({
820
820
  setPlayingScenario(null)
821
821
  }
822
822
 
823
- const getLayoutMode = (): 'stacked' | 'tabbed' => {
824
- if (!selectedComponent) return 'stacked'
825
- if (selectedComponent.layout) return selectedComponent.layout
826
- if (selectedComponent.name.toLowerCase() === 'tabs') return 'tabbed'
827
- return 'stacked'
828
- }
829
-
830
- const layoutMode = getLayoutMode()
823
+ const isInline = selectedComponent?.inline ?? false
831
824
 
832
825
  return (
833
826
  <div className="sandbox-viewer">
@@ -853,7 +846,7 @@ function SandboxViewerContent ({
853
846
  ) }
854
847
 
855
848
  { view.type === 'detail' && selectedComponent && (
856
- layoutMode === 'tabbed' ? (
849
+ !isInline ? (
857
850
  <TabbedDetailView
858
851
  component={ selectedComponent }
859
852
  onBack={ handleBack }
@@ -1,4 +1,4 @@
1
1
  {
2
- "main": "./lib/index.ts",
3
- "types": "./lib/index.ts"
2
+ "main": "../dist/sandbox/index.js",
3
+ "types": "../dist/sandbox/index.d.ts"
4
4
  }