Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
34f639d
Replace eslint-config-react-app
alexdunae May 15, 2026
a69f63b
Change files
alexdunae May 15, 2026
af299c1
less diff noise
alexdunae May 15, 2026
01c11ec
remove change strings
alexdunae May 15, 2026
8e7be25
Switch to `none`
alexdunae May 19, 2026
8999d95
Update to Typescript 6 / Jest 29
alexdunae May 13, 2026
bf20547
Change files
alexdunae May 13, 2026
3460226
.
alexdunae May 15, 2026
1f30c8e
tsconfig jest
alexdunae May 15, 2026
c48acf2
allowJS
alexdunae May 15, 2026
3542e11
change files
alexdunae May 19, 2026
e700db9
"eslint": "^8.57.0"
alexdunae May 19, 2026
9ecba32
add ts to storybook pkg
alexdunae May 19, 2026
ead8657
revert
alexdunae May 19, 2026
db6eb1d
rollup-plugin-typescript2": "^0.37.0"
alexdunae May 22, 2026
113c663
Spike
alexdunae May 22, 2026
ba6f276
Working iTwin selection
alexdunae May 22, 2026
020c2cb
working
alexdunae May 22, 2026
5d5133e
Merge branch 'main' into alex/typescript6
alexdunae May 28, 2026
82bae4c
Merge branch 'alex/typescript6' into alex/storybook-update
alexdunae May 28, 2026
3d971f3
SB10
alexdunae May 28, 2026
42ace36
tidy
alexdunae May 28, 2026
cf59267
"@typescript-eslint/parser": "^8.57.0"
alexdunae May 28, 2026
247de36
argTypes
alexdunae May 28, 2026
4d116f5
fileURLToPath
alexdunae May 28, 2026
c4cd2fa
Merge branch 'alex/typescript6' into alex/storybook-update
alexdunae May 28, 2026
373d4f9
.
alexdunae May 29, 2026
e8e4f74
Update to Typescript 6 / Jest 29 (#202)
alexdunae May 29, 2026
f545fb2
Merge branch 'main' into alex/storybook-update
alexdunae May 29, 2026
08d730e
Remove stray file
alexdunae May 29, 2026
3acecfc
Revert "."
alexdunae May 29, 2026
5e22eb0
Merge branch 'main' into alex/storybook-update
alexdunae May 29, 2026
04ef293
tidy and arg type improvements
alexdunae May 29, 2026
0f94dca
CSF3 refactor
alexdunae May 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7,666 changes: 1,476 additions & 6,190 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/apps/storybook/.storybook/itwinTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import { create } from "@storybook/theming/create";
import { create } from "storybook/theming";

export const lightTheme = create({
base: "light",
Expand Down
85 changes: 0 additions & 85 deletions packages/apps/storybook/.storybook/main.js

This file was deleted.

98 changes: 98 additions & 0 deletions packages/apps/storybook/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import type { StorybookConfig } from "@storybook/react-webpack5";
import path from "path";
import { fileURLToPath } from "url";

const __dirname = path.dirname(fileURLToPath(import.meta.url));

const config: StorybookConfig = {
core: {
disableTelemetry: true,
disableWhatsNewNotifications: true,
},
stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-webpack5-compiler-swc",
"storybook-dark-mode",
"../../../modules/storybook-auth-addon",
"../src/addon",
],
framework: {
name: "@storybook/react-webpack5",
options: {},
},
typescript: {
reactDocgen: "react-docgen-typescript",
},
staticDirs: ["../../../modules/storybook-auth-addon/build"],
webpackFinal: async (config, { configType }) => {
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// You can change the configuration based on that.
// 'PRODUCTION' is used when building the static version of storybook.

config.resolve = config.resolve || {};
config.resolve.mainFields = ["module", "main"];

const packagePaths: Record<string, string> = {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fun

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resisted the urge to ditch webpack for vite...

"@itwin/imodel-browser-react": path.resolve(
__dirname,
"../../../modules/imodel-browser/src"
),
"@itwin/create-imodel-react": path.resolve(
__dirname,
"../../../modules/create-imodel/src"
),
"@itwin/delete-imodel-react": path.resolve(
__dirname,
"../../../modules/delete-imodel/src"
),
"@itwin/delete-itwin-react": path.resolve(
__dirname,
"../../../modules/delete-itwin/src"
),
"@itwin/manage-versions-react": path.resolve(
__dirname,
"../../../modules/manage-versions/src"
),
};

// Alias local packages to source directories for both dev and production builds
config.resolve.alias = {
...config.resolve.alias,
...packagePaths,
};

// Enable HMR for local packages in development by aliasing to source directories
if (configType === "DEVELOPMENT") {
// Use full source maps to allow VS Code Chrome debugger to map back to TS/TSX sources
config.devtool = "source-map";
config.output = config.output || {};
config.output.devtoolModuleFilenameTemplate = (info: {
absoluteResourcePath: string;
}) => {
// Derive repo root (four levels up from .storybook: ../../../../)
const repoRoot = path.resolve(__dirname, "../../../../");
const relPath = path
.relative(repoRoot, info.absoluteResourcePath)
.replace(/\\/g, "/");
return `webpack:///${relPath}`;
};
}

// Handle SCSS files from source directories
config.module = config.module || {};
config.module.rules = config.module.rules || [];
config.module.rules.push({
test: /\.scss$/,
include: Object.values(packagePaths),
use: ["style-loader", "css-loader", "sass-loader"],
});

return config;
},
};

export default config;
4 changes: 4 additions & 0 deletions packages/apps/storybook/.storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@
#docs-root table thead th {
color: var(--iui-color-text);
}

.forced-thumbnail-height {
height: 200px;
}
</style>
40 changes: 0 additions & 40 deletions packages/apps/storybook/.storybook/preview.js

This file was deleted.

92 changes: 92 additions & 0 deletions packages/apps/storybook/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import { ThemeProvider } from "@itwin/itwinui-react";
import { themes } from "storybook/theming";
import { useDarkMode } from "storybook-dark-mode";
import { darkTheme, lightTheme } from "./itwinTheme";
import "@itwin/itwinui-react/styles.css";
import React from "react";
import { addons } from "storybook/preview-api";

const ITWIN_ID_EVENT = "project/toolbar/set-itwin-id";
const ACCESS_TOKEN_EVENT = "auth/toolbar/set-access-token";
let _currentITwinId = "";
let _currentAccessToken = "";

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
backgrounds: { disable: true },
controls: { expanded: true },
darkMode: {
dark: { ...themes.dark, ...darkTheme },
light: { ...themes.light, ...lightTheme },
},
docs: {
theme: { ...themes.light, ...lightTheme },
},
authClientConfig: {
clientId: process.env.STORYBOOK_AUTH_CLIENT_ID,
scope: "itwin-platform",
authority: "https://qa-ims.bentley.com",
},
layout: "fullscreen",
};

export const decorators = [
(
Story: React.ComponentType<{ args?: Record<string, unknown> }>,
context: {
globals: Record<string, string>;
args: Record<string, unknown>;
argTypes: Record<string, unknown>;
}
) => {
const isDark = useDarkMode();
const theme = isDark ? "dark" : "light";
const [iTwinId, setITwinId] = React.useState(_currentITwinId);
const [accessToken, setAccessToken] = React.useState(_currentAccessToken);

React.useEffect(() => {
const channel = addons.getChannel();
const handleITwinId = (id: string) => {
_currentITwinId = id;
setITwinId(id);
};
const handleAccessToken = (token: string) => {
_currentAccessToken = token;
setAccessToken(token);
};
channel.on(ITWIN_ID_EVENT, handleITwinId);
channel.on(ACCESS_TOKEN_EVENT, handleAccessToken);
return () => {
channel.off(ITWIN_ID_EVENT, handleITwinId);
channel.off(ACCESS_TOKEN_EVENT, handleAccessToken);
};
}, []);

const injectedArgs: Record<string, unknown> = {};
if ("accessToken" in context.argTypes) {
injectedArgs.accessToken = accessToken;
}
if ("iTwinId" in context.argTypes) {
injectedArgs.iTwinId = iTwinId;
}

return (
<ThemeProvider
style={{
background: "var(--iui-color-background)",
padding: "1rem",
minHeight: "100vh",
}}
theme={theme}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
children={
(<Story args={{ ...context.args, ...injectedArgs }} />) as any
}
/>
);
},
];
22 changes: 8 additions & 14 deletions packages/apps/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
"@babel/preset-react": "^7.12.10",
"@babel/preset-typescript": "^7.12.10",
"@bentley/bentleyjs-core": "2.11.0",
"@storybook/builder-webpack5": "6.5.16",
"@storybook/manager-webpack5": "6.5.16",
"@bentley/frontend-authorization-client": "2.11.0",
"@bentley/itwin-client": "2.11.0",
"@storybook/addon-webpack5-compiler-swc": "^4.0.3",
"@storybook/icons": "^2.0.2",
"@storybook/react-webpack5": "^10.4.0",
"css-loader": "^6.7.0",
"sass": "^1.50.0",
"sass-loader": "^12.6.0",
"storybook": "^10.4.0",
"style-loader": "^3.3.0",
"@itwin/create-imodel-react": "workspace:*",
"@itwin/delete-imodel-react": "workspace:*",
Expand All @@ -24,14 +26,6 @@
"@itwin/itwinui-react": "^3.19.4",
"@itwin/manage-versions-react": "workspace:*",
"@itwin/storybook-auth-addon": "workspace:*",
"@storybook/addon-actions": "^6.5.16",
"@storybook/addon-essentials": "^6.5.16",
"@storybook/addon-links": "^6.5.16",
"@storybook/addons": "^6.5.16",
"@storybook/api": "^6.5.16",
"@storybook/core-events": "^6.5.16",
"@storybook/react": "^6.5.16",
"@storybook/theming": "^6.5.16",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"typescript": "~6.0.3",
Expand All @@ -51,14 +45,14 @@
"react-dom": "^18.3.1",
"react": "^18.3.1",
"rimraf": "^3.0.2",
"storybook-dark-mode": "^1.0.7",
"storybook-dark-mode": "^5.0.0",
"webpack": "^5.28.0"
},
"scripts": {
"start": "start-storybook -p 6006",
"start": "storybook dev -p 6006",
"build": "",
"build-storybook": "build-storybook -o storybook-static",
"test": "build-storybook --loglevel error --quiet",
"build-storybook": "storybook build -o storybook-static",
"test": "storybook build --loglevel error --quiet",
"clean": "rimraf storybook-static"
},
"packageManager": "pnpm@10.15.1+sha512.34e538c329b5553014ca8e8f4535997f96180a1d0f614339357449935350d924e22f8614682191264ec33d1462ac21561aff97f6bb18065351c162c7e8f6de67"
Expand Down
Loading
Loading