diff --git a/packages/core/.storybook/modes.ts b/packages/core/.storybook/modes.ts new file mode 100644 index 0000000000..c846174ff4 --- /dev/null +++ b/packages/core/.storybook/modes.ts @@ -0,0 +1,11 @@ +export default { + light: { + theme: "light-app-theme" + }, + dark: { + theme: "dark-app-theme" + }, + black: { + theme: "black-app-theme" + } +}; diff --git a/packages/core/.storybook/preview.tsx b/packages/core/.storybook/preview.tsx index 48b0e9286b..2dc77bc4eb 100644 --- a/packages/core/.storybook/preview.tsx +++ b/packages/core/.storybook/preview.tsx @@ -25,7 +25,6 @@ import { UsageGuidelines, withMemoryStats, RelatedComponent, - MultipleStoryElementsWrapper, StorybookLink } from "vibe-storybook-components"; import CanvasWrapper from "../src/storybook/components/canvas-wrapper/CanvasWrapper"; @@ -37,6 +36,7 @@ import { generateAutocompletion } from "storybook-addon-playground"; import introCode from "../src/storybook/stand-alone-documentaion/playground/playground-helpers"; import reactDocgenOutput from "../src/storybook/stand-alone-documentaion/playground/react-docgen-output.json"; import withLiveEdit from "../src/storybook/decorators/withLiveEdit/withLiveEdit"; +import modes from "./modes"; const fontLoader = async () => ({ fonts: await document.fonts.ready // Fixing Chromatic tests flakiness - taking snapshots after fonts are loaded @@ -44,6 +44,9 @@ const fontLoader = async () => ({ const preview: Preview = { parameters: { + chromatic: { + modes + }, controls: { sort: "alpha", expanded: true @@ -147,7 +150,7 @@ const preview: Preview = { } } }, - + loaders: isChromatic() && document.fonts ? [fontLoader] : [] }; diff --git a/packages/core/package.json b/packages/core/package.json index 0b4d1a114a..7f79d3fd17 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -137,6 +137,7 @@ "@babel/preset-typescript": "^7.23.3", "@babel/standalone": "^7.24.4", "@babel/types": "^7.24.0", + "@chromatic-com/storybook": "^1.4.0", "@hot-loader/react-dom": "^16.13.0", "@jest/transform": "^29.7.0", "@mdx-js/loader": "^2.0.0-rc.2", diff --git a/yarn.lock b/yarn.lock index 00af073d97..bcd0c35296 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1156,6 +1156,17 @@ resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@chromatic-com/storybook@^1.4.0": + version "1.4.0" + resolved "https://registry.npmjs.org/@chromatic-com/storybook/-/storybook-1.4.0.tgz#5cb1c68ecf32c55fe4ab8a8e3271022845169c00" + integrity sha512-CpskwN1RsgaDMSe7mnwrmst9XeLfvrSbCJOc/eaHIDzhSiKhdbbEF83cYjMYnvODPMW8QNVdw9gWMh+yzBQtSw== + dependencies: + chromatic "^11.3.2" + filesize "^10.0.12" + jsonfile "^6.1.0" + react-confetti "^6.1.0" + strip-ansi "^7.1.0" + "@cnakazawa/watch@^1.0.3": version "1.0.4" resolved "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a" @@ -7285,6 +7296,11 @@ chownr@^2.0.0: resolved "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== +chromatic@^11.3.2: + version "11.3.5" + resolved "https://registry.npmjs.org/chromatic/-/chromatic-11.3.5.tgz#980a02fed612fcf9ace84fb50ab4c43b7380a5d1" + integrity sha512-M3xCyoEIjdcsXX3NhN60joXxEthy+wxNEcsCMM0u9u8Yna7tJvwvOsJStbOJDwEBo6TdIKckARN3BbArpduFbA== + chromatic@^7.5.3: version "7.6.0" resolved "https://registry.npmjs.org/chromatic/-/chromatic-7.6.0.tgz#b05cad35d47f6410efa5bca6b35af6fae6e540bc" @@ -9866,6 +9882,11 @@ filelist@^1.0.4: dependencies: minimatch "^5.0.1" +filesize@^10.0.12: + version "10.1.2" + resolved "https://registry.npmjs.org/filesize/-/filesize-10.1.2.tgz#33bb71c5c134102499f1bc36e6f2863137f6cb0c" + integrity sha512-Dx770ai81ohflojxhU+oG+Z2QGvKdYxgEr9OSA8UVrqhwNHjfH9A8f5NKfg83fEH8ZFA5N5llJo5T3PIoZ4CRA== + fill-range@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" @@ -12993,7 +13014,7 @@ jsonfile@^2.1.0: optionalDependencies: graceful-fs "^4.1.6" -jsonfile@^6.0.1: +jsonfile@^6.0.1, jsonfile@^6.1.0: version "6.1.0" resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== @@ -16488,6 +16509,13 @@ react-colorful@^5.1.2: resolved "https://registry.npmjs.org/react-colorful/-/react-colorful-5.6.1.tgz#7dc2aed2d7c72fac89694e834d179e32f3da563b" integrity sha512-1exovf0uGTGyq5mXQT0zgQ80uvj2PCwvF8zY1RN9/vbJVSjSo3fsB/4L3ObbF7u70NduSiK4xu4Y6q1MHoUGEw== +react-confetti@^6.1.0: + version "6.1.0" + resolved "https://registry.npmjs.org/react-confetti/-/react-confetti-6.1.0.tgz#03dc4340d955acd10b174dbf301f374a06e29ce6" + integrity sha512-7Ypx4vz0+g8ECVxr88W9zhcQpbeujJAVqL14ZnXJ3I23mOI9/oBVTQ3dkJhUmB0D6XOtCZEM6N0Gm9PMngkORw== + dependencies: + tween-functions "^1.2.0" + react-dates@21.8.0: version "21.8.0" resolved "https://registry.npmjs.org/react-dates/-/react-dates-21.8.0.tgz#355c3c7a243a7c29568fe00aca96231e171a5e94" @@ -18364,7 +18392,7 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" -strip-ansi@^7.0.1: +strip-ansi@^7.0.1, strip-ansi@^7.1.0: version "7.1.0" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== @@ -19173,6 +19201,11 @@ tuf-js@^2.2.0: debug "^4.3.4" make-fetch-happen "^13.0.0" +tween-functions@^1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/tween-functions/-/tween-functions-1.2.0.tgz#1ae3a50e7c60bb3def774eac707acbca73bbc3ff" + integrity sha512-PZBtLYcCLtEcjL14Fzb1gSxPBeL7nWvGhO5ZFPGqziCcr8uvHp0NDmdjBchp6KHL+tExcg0m3NISmKxhU394dA== + type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"