Skip to content

Commit 49ae0be

Browse files
authored
Merge pull request #252 from objectstack-ai/copilot/add-stories-for-missing-components
2 parents 656f584 + 95dcd10 commit 49ae0be

File tree

73 files changed

+4640
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+4640
-568
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Storybook Tests
2+
on:
3+
push:
4+
branches: [main, develop]
5+
pull_request:
6+
branches: [main, develop]
7+
8+
jobs:
9+
test-storybook:
10+
timeout-minutes: 60
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: '20'
17+
- name: Setup pnpm
18+
uses: pnpm/action-setup@v4
19+
with:
20+
version: 10
21+
- name: Install dependencies
22+
run: pnpm install
23+
- name: Install Playwright Browsers
24+
run: pnpm exec playwright install --with-deps
25+
- name: Run Storybook tests
26+
run: pnpm test:storybook:ci

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ node_modules
66
dist
77
build
88
out
9+
storybook-static
910

1011
# Misc
1112
.DS_Store

.storybook/main.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import type { StorybookConfig } from "@storybook/react-vite";
2+
import { mergeConfig } from 'vite';
3+
import path from 'path';
4+
5+
const config: StorybookConfig = {
6+
stories: ["../packages/**/src/**/*.mdx", "../packages/**/src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
7+
addons: [
8+
"@storybook/addon-links",
9+
"@storybook/addon-essentials",
10+
"@storybook/addon-interactions",
11+
],
12+
framework: {
13+
name: "@storybook/react-vite",
14+
options: {},
15+
},
16+
docs: {
17+
autodocs: "tag",
18+
},
19+
async viteFinal(config) {
20+
return mergeConfig(config, {
21+
resolve: {
22+
alias: {
23+
// Alias components package to source to avoid circular dependency during build
24+
'@object-ui/core': path.resolve(__dirname, '../packages/core/src/index.ts'),
25+
'@object-ui/react': path.resolve(__dirname, '../packages/react/src/index.ts'),
26+
'@object-ui/components': path.resolve(__dirname, '../packages/components/src/index.ts'),
27+
'@object-ui/fields': path.resolve(__dirname, '../packages/fields/src/index.tsx'),
28+
'@object-ui/layout': path.resolve(__dirname, '../packages/layout/src/index.ts'),
29+
// Alias plugin packages for Storybook to resolve them from workspace
30+
'@object-ui/plugin-aggrid': path.resolve(__dirname, '../packages/plugin-aggrid/src/index.tsx'),
31+
'@object-ui/plugin-calendar': path.resolve(__dirname, '../packages/plugin-calendar/src/index.tsx'),
32+
'@object-ui/plugin-charts': path.resolve(__dirname, '../packages/plugin-charts/src/index.tsx'),
33+
'@object-ui/plugin-chatbot': path.resolve(__dirname, '../packages/plugin-chatbot/src/index.tsx'),
34+
'@object-ui/plugin-dashboard': path.resolve(__dirname, '../packages/plugin-dashboard/src/index.tsx'),
35+
'@object-ui/plugin-editor': path.resolve(__dirname, '../packages/plugin-editor/src/index.tsx'),
36+
'@object-ui/plugin-form': path.resolve(__dirname, '../packages/plugin-form/src/index.tsx'),
37+
'@object-ui/plugin-gantt': path.resolve(__dirname, '../packages/plugin-gantt/src/index.tsx'),
38+
'@object-ui/plugin-grid': path.resolve(__dirname, '../packages/plugin-grid/src/index.tsx'),
39+
'@object-ui/plugin-kanban': path.resolve(__dirname, '../packages/plugin-kanban/src/index.tsx'),
40+
'@object-ui/plugin-map': path.resolve(__dirname, '../packages/plugin-map/src/index.tsx'),
41+
'@object-ui/plugin-markdown': path.resolve(__dirname, '../packages/plugin-markdown/src/index.tsx'),
42+
'@object-ui/plugin-timeline': path.resolve(__dirname, '../packages/plugin-timeline/src/index.tsx'),
43+
'@object-ui/plugin-view': path.resolve(__dirname, '../packages/plugin-view/src/index.tsx'),
44+
},
45+
},
46+
});
47+
},
48+
};
49+
export default config;

.storybook/preview.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import type { Preview } from '@storybook/react-vite'
2+
import '../packages/components/src/index.css';
3+
import { ComponentRegistry } from '@object-ui/core';
4+
import * as components from '../packages/components/src/index';
5+
6+
// Register all base components for Storybook
7+
Object.values(components);
8+
9+
// Import and register all plugin components for Storybook
10+
// This ensures plugin components are available for the plugin stories
11+
import '@object-ui/plugin-aggrid';
12+
import '@object-ui/plugin-calendar';
13+
import '@object-ui/plugin-charts';
14+
import '@object-ui/plugin-chatbot';
15+
import '@object-ui/plugin-dashboard';
16+
import '@object-ui/plugin-editor';
17+
import '@object-ui/plugin-form';
18+
import '@object-ui/plugin-gantt';
19+
import '@object-ui/plugin-grid';
20+
import '@object-ui/plugin-kanban';
21+
import '@object-ui/plugin-map';
22+
import '@object-ui/plugin-markdown';
23+
import '@object-ui/plugin-timeline';
24+
import '@object-ui/plugin-view';
25+
26+
const preview: Preview = {
27+
parameters: {
28+
options: {
29+
storySort: {
30+
method: 'alphabetical',
31+
order: [
32+
'Introduction',
33+
'Guide',
34+
'Primitives',
35+
'Schema',
36+
['Actions', 'Inputs', 'Layout', 'Data Display', 'Navigation', 'Feedback', 'Plugins']
37+
],
38+
},
39+
},
40+
controls: {
41+
matchers: {
42+
color: /(background|color)$/i,
43+
date: /Date$/i,
44+
},
45+
},
46+
},
47+
};
48+
49+
export default preview;

package.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
"lint": "pnpm -r lint",
2929
"cli": "node packages/cli/dist/cli.js",
3030
"objectui": "node packages/cli/dist/cli.js",
31-
"build:storybook": "pnpm --filter @object-ui/components build-storybook",
31+
"storybook": "storybook dev -p 6006",
32+
"build:storybook": "storybook build",
33+
"test:storybook": "test-storybook --testTimeout=90000",
34+
"test:storybook:ci": "concurrently -k -s first \"pnpm storybook --no-open\" \"wait-on tcp:6006 && pnpm test:storybook\"",
3235
"doctor": "node packages/cli/dist/cli.js doctor",
3336
"studio": "node packages/cli/dist/cli.js studio",
3437
"check": "node packages/cli/dist/cli.js check",
@@ -47,6 +50,13 @@
4750
"devDependencies": {
4851
"@changesets/cli": "^2.29.8",
4952
"@eslint/js": "^9.39.1",
53+
"@storybook/addon-essentials": "^8.6.14",
54+
"@storybook/addon-interactions": "^8.6.14",
55+
"@storybook/addon-links": "^8.6.15",
56+
"@storybook/blocks": "^8.6.14",
57+
"@storybook/react": "^8.6.15",
58+
"@storybook/react-vite": "^8.6.15",
59+
"@storybook/test-runner": "^0.24.2",
5060
"@testing-library/dom": "^10.4.1",
5161
"@testing-library/jest-dom": "^6.9.1",
5262
"@testing-library/react": "^16.3.2",
@@ -57,22 +67,26 @@
5767
"@vitest/coverage-v8": "^4.0.18",
5868
"@vitest/ui": "^4.0.18",
5969
"autoprefixer": "^10.4.23",
70+
"concurrently": "^9.2.1",
6071
"eslint": "^9.39.2",
6172
"eslint-plugin-react-hooks": "^7.0.1",
6273
"eslint-plugin-react-refresh": "^0.4.24",
6374
"globals": "^17.1.0",
6475
"happy-dom": "^20.3.9",
6576
"jsdom": "^27.4.0",
77+
"playwright": "^1.58.0",
6678
"prettier": "^3.8.1",
6779
"react": "19.2.3",
6880
"react-dom": "19.2.3",
6981
"react-router-dom": "^7.13.0",
82+
"storybook": "^8.6.15",
7083
"tailwindcss": "^4.1.18",
7184
"tslib": "^2.6.0",
7285
"turbo": "^2.7.6",
7386
"typescript": "^5.9.3",
7487
"typescript-eslint": "^8.53.1",
75-
"vitest": "^4.0.18"
88+
"vitest": "^4.0.18",
89+
"wait-on": "^9.0.3"
7690
},
7791
"pnpm": {
7892
"overrides": {

packages/components/.storybook/main.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/components/.storybook/preview.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/components/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@
3131
"pretest": "pnpm run prebuild",
3232
"test": "vitest run",
3333
"type-check": "tsc --noEmit",
34-
"lint": "eslint .",
35-
"storybook": "storybook dev -p 6006",
36-
"prebuild-storybook": "pnpm run prebuild",
37-
"build-storybook": "storybook build"
34+
"lint": "eslint ."
3835
},
3936
"dependencies": {
4037
"@object-ui/core": "workspace:*",

packages/components/src/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import 'tailwindcss';
22

33
/* Scan sources for Tailwind classes */
4-
@source './src/**/*.{ts,tsx}';
4+
@source '../src/**/*.{ts,tsx}';
55

66
/* Tailwind plugin for animations */
77
@plugin 'tailwindcss-animate';

packages/components/src/renderers/disclosure/toggle-group.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ ComponentRegistry.register('toggle-group',
1616
'data-obj-id': dataObjId,
1717
'data-obj-type': dataObjType,
1818
style,
19+
type, // Extract type to prevent overriding the one we set below
1920
...toggleGroupProps
2021
} = props;
2122

0 commit comments

Comments
 (0)