The Open Standard for Generative UI
AD/Theme (#34)
Ankit Das22aadbc2bfc1
diff --git a/js/packages/react-ui/.storybook/main.ts b/js/packages/react-ui/.storybook/main.tsindex 10a7fcd4e..fb5462dbf 100644--- a/js/packages/react-ui/.storybook/main.ts+++ b/js/packages/react-ui/.storybook/main.ts@@ -4,11 +4,15 @@ import { mergeConfig } from "vite";const config: StorybookConfig = {stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],- addons: ["@storybook/addon-essentials", "@storybook/addon-themes"],- framework: {- name: "@storybook/react-vite",- options: {},- },+ addons: [+ "@storybook/addon-essentials",+ "@storybook/addon-interactions",+ "@storybook/addon-onboarding",+ "@storybook/core-events",+ "@storybook/blocks",+ ],+ framework: "@storybook/react-vite",+ features: {},previewHead: (head) => `${head}<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/normalize.css">@@ -20,6 +24,7 @@ const config: StorybookConfig = {body {margin: 0 !important;padding: 0 !important;+ background-color: #1B1C1D;}</style>`,diff --git a/js/packages/react-ui/.storybook/manager.ts b/js/packages/react-ui/.storybook/manager.tsindex 749fe6617..bb5ca6fa0 100644--- a/js/packages/react-ui/.storybook/manager.ts+++ b/js/packages/react-ui/.storybook/manager.ts@@ -4,5 +4,6 @@ import theme from "./theme";addons.setConfig({theme: theme,- sidebar: {},+});+diff --git a/js/packages/react-ui/.storybook/preview.tsx b/js/packages/react-ui/.storybook/preview.tsxindex c61631ac2..b55d0ad58 100644--- a/js/packages/react-ui/.storybook/preview.tsx+++ b/js/packages/react-ui/.storybook/preview.tsx@@ -1,9 +1,8 @@import type { Preview } from "@storybook/react";import { themes } from "@storybook/theming";+import "../src/components/index.scss";import { ThemeProvider } from "../src/components/ThemeProvider";import React from "react";-import "../src/components/index.scss";-const preview: Preview = {parameters: {controls: {@@ -12,16 +11,61 @@ const preview: Preview = {date: /Date$/i,},},+ backgrounds: {+ disable: true,+ },docs: {theme: themes.dark,},},+ initialGlobals: {+ backgrounds: {+ value: "#F7F9F2",+ },+ },+ globalTypes: {+ theme: {+ description: "Global theme for components",+ defaultValue: "light",+ toolbar: {+ title: "Theme",+ icon: "paintbrush",+ items: [+ {+ value: "light",+ icon: "sun",+ title: "Light",+ },+ {+ value: "dark",+ icon: "moon",+ title: "Dark",+ },+ ],+ dynamicTitle: true,+ },+ },+ },decorators: [- (Story) => (- <ThemeProvider>- <Story />- </ThemeProvider>- ),+ (Story, context) => {+ // Use the selected theme from toolbar+ const selectedTheme = context.globals.theme;++ return (+ <>+ <style>+ {`+ .docs-story {+ background-color: ${selectedTheme === "dark" ? "#333" : "#F7F9F2"};+ }+ `}+ </style>+ <ThemeProvider mode={selectedTheme}>+ <Story />+ </ThemeProvider>+ </>+ );+ },],};diff --git a/js/packages/react-ui/package.json b/js/packages/react-ui/package.jsonindex a70e62add..82b0d0fe6 100644--- a/js/packages/react-ui/package.json+++ b/js/packages/react-ui/package.json@@ -67,6 +67,7 @@"@radix-ui/react-switch": "^1.1.2","@radix-ui/react-tabs": "^1.1.2","@storybook/addon-styling-webpack": "^1.0.1",+ "@storybook/core-events": "^8.5.3","@storybook/manager-api": "^8.5.3","@storybook/theming": "^8.5.3","clsx": "^2.1.1",diff --git a/js/packages/react-ui/src/components/Charts/PieChart/PieChart.tsx b/js/packages/react-ui/src/components/Charts/PieChart/PieChart.tsxindex d1be76c97..6801e970f 100644--- a/js/packages/react-ui/src/components/Charts/PieChart/PieChart.tsx+++ b/js/packages/react-ui/src/components/Charts/PieChart/PieChart.tsx@@ -139,7 +139,7 @@ export const PieChart = <T extends PieChartData>({y={y}textAnchor={textAnchor}dominantBaseline={dominantBaseline}- className="fill-t-comp-secondary p-0"+ className="crayon-pie-chart-label">{formattedValue}{format === "percentage" ? "%" : ""}diff --git a/js/packages/react-ui/src/components/Charts/charts.scss b/js/packages/react-ui/src/components/Charts/charts.scssindex f9815c5d5..7736b78f1 100644--- a/js/packages/react-ui/src/components/Charts/charts.scss+++ b/js/packages/react-ui/src/components/Charts/charts.scss@@ -249,3 +249,8 @@}}}++.crayon-pie-chart-label {+ fill: map.get(cssUtils.$colors, "text", "secondary");+ padding: 0;+}diff --git a/js/packages/react-ui/src/components/CheckBoxItem/checkBoxItem.scss b/js/packages/react-ui/src/components/CheckBoxItem/checkBoxItem.scssindex 132e1be2f..87a379106 100644--- a/js/packages/react-ui/src/components/CheckBoxItem/checkBoxItem.scss+++ b/js/packages/react-ui/src/components/CheckBoxItem/checkBoxItem.scss@@ -39,6 +39,7 @@display: flex;align-items: center;justify-content: center;+ color: map.get(cssUtils.$colors, "text", "primary");}.crayon-checkbox-item-label {diff --git a/js/packages/react-ui/src/components/FollowUpItem/followUpItem.scss b/js/packages/react-ui/src/components/FollowUpItem/followUpItem.scssindex 410042b84..0eff85211 100644--- a/js/packages/react-ui/src/components/FollowUpItem/followUpItem.scss+++ b/js/packages/react-ui/src/components/FollowUpItem/followUpItem.scss@@ -13,5 +13,6 @@align-items: center;justify-content: space-between;width: 100%;+ color: map.get(cssUtils.$colors, "text", "primary");cursor: pointer;}diff --git a/js/packages/react-ui/src/components/Input/input.scss b/js/packages/react-ui/src/components/Input/input.scssindex 8b493dcd0..eb278714b 100644--- a/js/packages/react-ui/src/components/Input/input.scss+++ b/js/packages/react-ui/src/components/Input/input.scss@@ -8,6 +8,8 @@box-sizing: border-box;width: 100%;gap: map.get(cssUtils.$spacing, "xs");+ background-color: map.get(cssUtils.$colors, "fills", "container");+ color: map.get(cssUtils.$colors, "text", "primary");&-small {padding: map.get(cssUtils.$spacing, "2xs") map.get(cssUtils.$spacing, "s");diff --git a/js/packages/react-ui/src/components/Shell/shell.scss b/js/packages/react-ui/src/components/Shell/shell.scssindex 5cd0d83cc..50ffa2964 100644--- a/js/packages/react-ui/src/components/Shell/shell.scss+++ b/js/packages/react-ui/src/components/Shell/shell.scss@@ -12,8 +12,8 @@width: 100vw;padding: map.get(cssUtils.$spacing, "m");overflow: hidden;- // todo: replace with css variable- background: #efefef;++ background: map.get(cssUtils.$colors, fills, "background");box-sizing: border-box;& * {box-sizing: border-box;diff --git a/js/packages/react-ui/src/components/Shell/sidebar.scss b/js/packages/react-ui/src/components/Shell/sidebar.scssindex a314a4afe..976b4d466 100644--- a/js/packages/react-ui/src/components/Shell/sidebar.scss+++ b/js/packages/react-ui/src/components/Shell/sidebar.scss@@ -49,7 +49,6 @@ $sidebar-mobile-padding: map.get(cssUtils.$spacing, "l");&__logo {width: 36px;height: 36px;- // todo check the border radiusborder-radius: map.get(cssUtils.$radius, "s");}diff --git a/js/packages/react-ui/src/components/Shell/thread.scss b/js/packages/react-ui/src/components/Shell/thread.scssindex 4d18339a3..e2bf2e0fa 100644--- a/js/packages/react-ui/src/components/Shell/thread.scss+++ b/js/packages/react-ui/src/components/Shell/thread.scss@@ -75,8 +75,7 @@ $center-align-spacing: calc(32px + map.get(cssUtils.$spacing, "s"));&__content {@include cssUtils.typography(primary, default);padding: map.get(cssUtils.$spacing, "m") map.get(cssUtils.$spacing, "l");- // todo: update with css variable- background-color: #000;+ background-color: map.get(cssUtils.$colors, "fills", "brand-el");color: #fff;border-radius: map.get(cssUtils.$radius, "2xl");overflow-wrap: break-word;diff --git a/js/packages/react-ui/src/components/Table/table.scss b/js/packages/react-ui/src/components/Table/table.scssindex 025f72a79..64eb278c8 100644--- a/js/packages/react-ui/src/components/Table/table.scss+++ b/js/packages/react-ui/src/components/Table/table.scss@@ -51,6 +51,7 @@.crayon-table-head {padding: map.get(cssUtils.$spacing, "m");border: 1px solid map.get(cssUtils.$colors, "strokes", "default");+ color: map.get(cssUtils.$colors, "text", "primary");}.crayon-table-head {@@ -73,6 +74,7 @@display: flex;align-items: center;justify-content: center;+ color: map.get(cssUtils.$colors, "text", "primary");}}diff --git a/js/packages/react-ui/src/components/Tabs/tabs.scss b/js/packages/react-ui/src/components/Tabs/tabs.scssindex 60d4b37f5..e36616a42 100644--- a/js/packages/react-ui/src/components/Tabs/tabs.scss+++ b/js/packages/react-ui/src/components/Tabs/tabs.scss@@ -53,6 +53,7 @@border-radius: map.get(cssUtils.$radius, "xs");width: 100%;background-color: map.get(cssUtils.$colors, "fills", "container");+ color: map.get(cssUtils.$colors, "text", "primary");@include cssUtils.typography(label, default);&[data-state="active"] {background-color: map.get(cssUtils.$colors, "fills", "background");diff --git a/js/packages/react-ui/src/components/Tag/tag.scss b/js/packages/react-ui/src/components/Tag/tag.scssindex 3fe99d4e7..e31c621ca 100644--- a/js/packages/react-ui/src/components/Tag/tag.scss+++ b/js/packages/react-ui/src/components/Tag/tag.scss@@ -12,6 +12,7 @@border-radius: map.get(cssUtils.$radius, "xs");padding: map.get(cssUtils.$spacing, "3xs") map.get(cssUtils.$spacing, "2xs");background: map.get(cssUtils.$colors, "fills", "sunk");+ color: map.get(cssUtils.$colors, "text", "primary");@include cssUtils.typography(body, default);&-icon {diff --git a/js/packages/react-ui/src/components/TextContent/textContent.scss b/js/packages/react-ui/src/components/TextContent/textContent.scssindex ad1446f66..7669eacd0 100644--- a/js/packages/react-ui/src/components/TextContent/textContent.scss+++ b/js/packages/react-ui/src/components/TextContent/textContent.scss@@ -18,6 +18,7 @@.text-content {box-sizing: border-box;+ color: map.get(cssUtils.$colors, "text", "primary");@include cssUtils.typography(primary, default);border: 1px solid;diff --git a/js/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx b/js/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsxindex 60fc43688..7d9c2f816 100644--- a/js/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx+++ b/js/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx@@ -1,117 +1,14 @@-interface ThemeProviderProps {- // Background colors- backgroundFills?: string;- brandElFills?: string;- brandElHoverFills?: string;- containerFills?: string;- overlayFills?: string;- sunkFills?: string;- containerHoverFills?: string;- dangerFills?: string;- successFills?: string;-- // Border colors- strokesDefault?: string;- stocksInteractiveEl?: string;- stocksInteractiveElHover?: string;- strokesInteractiveElSelected?: string;-- // Text colors- brandText?: string;- brandSecondaryText?: string;- primaryText?: string;- secondaryText?: string;- disabledText?: string;- dangerText?: string;- successText?: string;- linkText?: string;- infoText?: string;-- // Spacing- spacing0?: string;- spacing3xs?: string;- spacing2xs?: string;- spacingXs?: string;- spacingS?: string;- spacingM?: string;- spacingL?: string;- spacingXl?: string;- spacing2xl?: string;- spacing3xl?: string;-- // Radius- rounded0?: string;- rounded3xs?: string;- rounded2xs?: string;- roundedXs?: string;- roundedS?: string;- roundedM?: string;- roundedL?: string;- roundedXl?: string;- rounded2xl?: string;- rounded3xl?: string;- rounded4xl?: string;- roundedFull?: string;- roundedClickable?: string;-- // Font styles- fontPrimary?: string;- fontPrimaryLetterSpacing?: string;- fontTitle?: string;- fontTitleLetterSpacing?: string;- fontTitleMedium?: string;- fontTitleMediumLetterSpacing?: string;- fontTitleSmall?: string;- fontTitleSmallLetterSpacing?: string;- fontBody?: string;- fontBodyLetterSpacing?: string;- fontBodyLink?: string;- fontBodyLinkLetterSpacing?: string;- fontBodyHeavy?: string;- fontBodyHeavyLetterSpacing?: string;- fontBodyMedium?: string;- fontBodyMediumLetterSpacing?: string;- fontBodySmallHeavy?: string;- fontBodySmallHeavyLetterSpacing?: string;- fontBodySmall?: string;- fontBodySmallLetterSpacing?: string;- fontLabel?: string;- fontLabelLetterSpacing?: string;- fontLabelHeavy?: string;- fontLabelHeavyLetterSpacing?: string;- fontLabelSmall?: string;- fontLabelSmallLetterSpacing?: string;- fontLabelSmallHeavy?: string;- fontLabelSmallHeavyLetterSpacing?: string;- fontLabelExtraSmall?: string;- fontLabelExtraSmallLetterSpacing?: string;- fontLabelExtraSmallHeavy?: string;- fontLabelExtraSmallHeavyLetterSpacing?: string;- fontLabelLargeHeavy?: string;- fontLabelLargeHeavyLetterSpacing?: string;- fontLabelLarge?: string;- fontLabelLargeLetterSpacing?: string;- fontLabelMediumHeavy?: string;- fontLabelMediumHeavyLetterSpacing?: string;- fontLabelMedium?: string;- fontLabelMediumLetterSpacing?: string;- fontHeadingLarge?: string;- fontHeadingLargeLetterSpacing?: string;- fontHeadingMedium?: string;- fontHeadingMediumLetterSpacing?: string;- fontHeadingSmall?: string;- fontHeadingSmallLetterSpacing?: string;+import { ColorTheme, EffectTheme, LayoutTheme, Theme, ThemeMode, TypographyTheme } from "./types";++export type ThemeProps = {+ mode?: ThemeMode;+ children?: React.ReactNode;+ // merged with lightTheme or darkTheme(if darkTheme is not provided)+ theme?: Theme;+ darkTheme?: Theme;+};- // Shadows- shadowS?: string;- shadowM?: string;- shadowL?: string;- shadowXl?: string;- shadow2xl?: string;- shadow3xl?: string;-}--const defaultTheme: ThemeProviderProps = {+const lightTheme: ColorTheme = {// Background colorsbackgroundFills: "rgb(245, 245, 245)",brandElFills: "rgb(0, 0, 0)",@@ -119,7 +16,7 @@ const defaultTheme: ThemeProviderProps = {containerFills: "rgb(255, 255, 255)",overlayFills: "rgba(0, 0, 0, 0.4)",sunkFills: "rgba(0, 0, 0, 0.04)",- containerHoverFills: "rgba(0, 0, 0, 0.04)",+ containerHoverFills: "rgba(255, 255, 255, 0.04)",dangerFills: "rgba(217, 45, 32, 0.08)",successFills: "rgba(7, 148, 85, 0.08)",@@ -127,7 +24,7 @@ const defaultTheme: ThemeProviderProps = {strokesDefault: "rgba(0, 0, 0, 0.06)",stocksInteractiveEl: "rgba(0, 0, 0, 0.12)",stocksInteractiveElHover: "rgba(0, 0, 0, 0.4)",- strokesInteractiveElSelected: "rgba(0, 0, 0, 1)",+ strokesInteractiveElSelected: "rgb(0, 0, 0)",// Text colorsbrandText: "rgba(255, 255, 255, 1)",@@ -136,10 +33,43 @@ const defaultTheme: ThemeProviderProps = {secondaryText: "rgba(0, 0, 0, 0.4)",disabledText: "rgba(0, 0, 0, 0.2)",dangerText: "rgba(217, 45, 32, 1)",- successText: "rgba(217, 45, 32, 1)",+ successText: "rgba(7, 148, 85, 1)",linkText: "rgba(0, 0, 0, 1)",infoText: "rgba(0, 0, 0, 0.4)",+} as const;++const darkTheme: ColorTheme = {+ // Background colors+ backgroundFills: "rgb(28, 28, 28)",+ brandElFills: "rgb(255, 255, 255)",+ brandElHoverFills: "rgba(255, 255, 255, 0.8)",+ containerFills: "rgb(43, 43, 43)",+ overlayFills: "rgba(0, 0, 0, 0.4)",+ sunkFills: "rgba(0, 0, 0, 0.2)",+ containerHoverFills: "rgba(255, 255, 255, 0.1)",+ dangerFills: "rgba(217, 45, 32, 0.1)",+ successFills: "rgba(7, 148, 85, 0.1)",++ // Border colors+ strokesDefault: "rgba(255, 255, 255, 0.06)",+ stocksInteractiveEl: "rgba(255, 255, 255, 0.12)",+ stocksInteractiveElHover: "rgba(255, 255, 255, 0.4)",+ strokesInteractiveElSelected: "rgba(255, 255, 255, 1)",+ // Text colors+ brandText: "rgba(0, 0, 0, 1)",+ brandSecondaryText: "rgba(255, 255, 255, 0.4)",+ primaryText: "rgba(255, 255, 255, 1)",+ secondaryText: "rgba(255, 255, 255, 0.6)",+ disabledText: "rgba(255, 255, 255, 0.2)",+ dangerText: "rgba(253, 162, 155, 1)",+ successText: "rgba(117, 224, 167, 1)",+ linkText: "rgba(255, 255, 255, 1)",+ infoText: "rgba(255, 255, 255, 0.6)",+} as const;++// Shared theme properties that don't change between light/dark modes+const layoutTheme: LayoutTheme = {// Spacingspacing0: "0px",spacing3xs: "2px",@@ -166,8 +96,10 @@ const defaultTheme: ThemeProviderProps = {rounded4xl: "24px",roundedFull: "999px",roundedClickable: "6px",+} as const;- // Primary Font+const typographyTheme: TypographyTheme = {+ // TypographyfontPrimary: '400 14px/20px "Inter"',fontPrimaryLetterSpacing: "0px",@@ -244,7 +176,9 @@ const defaultTheme: ThemeProviderProps = {fontLabelExtraSmallHeavy: '500 8px/12px "Inter"',fontLabelExtraSmallHeavyLetterSpacing: "0px",+} as const;+const effectTheme: EffectTheme = {// ShadowsshadowS: "0px 2px 4px -2px rgba(0, 0, 0, 0.04), 0px 1px 2px -2px rgba(0, 0, 0, 0.02)",shadowM: "0px 2px 2px -2px rgba(0, 0, 0, 0.05), 0px 4px 6px -2px rgba(0, 0, 0, 0.03)",@@ -252,119 +186,132 @@ const defaultTheme: ThemeProviderProps = {shadowXl: "0px 6px 8px -4px rgba(0, 0, 0, 0.12), 0px 4px 20px -6px rgba(0, 0, 0, 0.08)",shadow2xl: "0px 6px 10px -6px rgba(0, 0, 0, 0.14), 0px 8px 32px -6px rgba(0, 0, 0, 0.12)",shadow3xl: "0px 12px 24px -4px rgba(0, 0, 0, 0.14), 0px 16px 32px -6px rgba(0, 0, 0, 0.12)",-};--export const ThemeProvider = (props: React.PropsWithChildren<ThemeProviderProps>) => {- const theme = { ...defaultTheme, ...props };+} as const;++const themes = {+ light: { ...layoutTheme, ...lightTheme, ...typographyTheme, ...effectTheme },+ dark: { ...layoutTheme, ...darkTheme, ...typographyTheme, ...effectTheme },+} as const;++export const ThemeProvider = ({+ mode = "light",+ children,+ theme: userTheme = {},+ darkTheme: userDarkTheme,+}: ThemeProps) => {+ const baseTheme = themes[mode];+ const lightTheme = { ...baseTheme, ...userTheme };+ const darkTheme = { ...baseTheme, ...(userDarkTheme || userTheme) };+ const theme = mode === "light" ? lightTheme : darkTheme;return (<><style>{`- body {- --background-fills: ${theme.backgroundFills};- --brand-el-fills: ${theme.brandElFills};- --brand-el-hover-fills: ${theme.brandElHoverFills};- --container-fills: ${theme.containerFills};- --overlay-fills: ${theme.overlayFills};- --sunk-fills: ${theme.sunkFills};- --container-hover-fills: ${theme.containerHoverFills};- --danger-fills: ${theme.dangerFills};- --success-fills: ${theme.successFills};-- --strokes-default: ${theme.strokesDefault};- --stocks-interactive-el: ${theme.stocksInteractiveEl};- --stocks-interactive-el-hover: ${theme.stocksInteractiveElHover};- --strokes-interactive-el-selected: ${theme.strokesInteractiveElSelected};-- --brand-text: ${theme.brandText};- --brand-secondary-text: ${theme.brandSecondaryText};- --primary-text: ${theme.primaryText};- --secondary-text: ${theme.secondaryText};- --disabled-text: ${theme.disabledText};- --danger-text: ${theme.dangerText};- --success-text: ${theme.successText};- --link-text: ${theme.linkText};- --info-text: ${theme.infoText};-- --spacing-0: ${theme.spacing0};- --spacing-3xs: ${theme.spacing3xs};- --spacing-2xs: ${theme.spacing2xs};- --spacing-xs: ${theme.spacingXs};- --spacing-s: ${theme.spacingS};- --spacing-m: ${theme.spacingM};- --spacing-l: ${theme.spacingL};- --spacing-xl: ${theme.spacingXl};- --spacing-2xl: ${theme.spacing2xl};- --spacing-3xl: ${theme.spacing3xl};-- --rounded-0: ${theme.rounded0};- --rounded-3xs: ${theme.rounded3xs};- --rounded-2xs: ${theme.rounded2xs};- --rounded-xs: ${theme.roundedXs};- --rounded-s: ${theme.roundedS};- --rounded-m: ${theme.roundedM};- --rounded-l: ${theme.roundedL};- --rounded-xl: ${theme.roundedXl};- --rounded-2xl: ${theme.rounded2xl};- --rounded-3xl: ${theme.rounded3xl};- --rounded-full: ${theme.roundedFull};-- --font-primary: ${theme.fontPrimary};- --font-primary-letter-spacing: ${theme.fontPrimaryLetterSpacing};- --font-title: ${theme.fontTitle};- --font-title-letter-spacing: ${theme.fontTitleLetterSpacing};- --font-title-medium: ${theme.fontTitleMedium};- --font-title-medium-letter-spacing: ${theme.fontTitleMediumLetterSpacing};- --font-title-small: ${theme.fontTitleSmall};- --font-title-small-letter-spacing: ${theme.fontTitleSmallLetterSpacing};- --font-body: ${theme.fontBody};- --font-body-letter-spacing: ${theme.fontBodyLetterSpacing};- --font-body-link: ${theme.fontBodyLink};- --font-body-link-letter-spacing: ${theme.fontBodyLinkLetterSpacing};- --font-body-heavy: ${theme.fontBodyHeavy};- --font-body-heavy-letter-spacing: ${theme.fontBodyHeavyLetterSpacing};- --font-body-medium: ${theme.fontBodyMedium};- --font-body-medium-letter-spacing: ${theme.fontBodyMediumLetterSpacing};- --font-body-small-heavy: ${theme.fontBodySmallHeavy};- --font-body-small-heavy-letter-spacing: ${theme.fontBodySmallHeavyLetterSpacing};- --font-body-small: ${theme.fontBodySmall};- --font-body-small-letter-spacing: ${theme.fontBodySmallLetterSpacing};- --font-label: ${theme.fontLabel};- --font-label-letter-spacing: ${theme.fontLabelLetterSpacing};- --font-label-heavy: ${theme.fontLabelHeavy};- --font-label-heavy-letter-spacing: ${theme.fontLabelHeavyLetterSpacing};- --font-label-small: ${theme.fontLabelSmall};- --font-label-small-letter-spacing: ${theme.fontLabelSmallLetterSpacing};- --font-label-small-heavy: ${theme.fontLabelSmallHeavy};- --font-label-small-heavy-letter-spacing: ${theme.fontLabelSmallHeavyLetterSpacing};- --font-label-extra-small: ${theme.fontLabelExtraSmall};- --font-label-extra-small-letter-spacing: ${theme.fontLabelExtraSmallLetterSpacing};- --font-label-extra-small-heavy: ${theme.fontLabelExtraSmallHeavy};- --font-label-extra-small-heavy-letter-spacing: ${theme.fontLabelExtraSmallHeavyLetterSpacing};- --font-label-large-heavy: ${theme.fontLabelLargeHeavy};- --font-label-large-heavy-letter-spacing: ${theme.fontLabelLargeHeavyLetterSpacing};- --font-label-large: ${theme.fontLabelLarge};- --font-label-large-letter-spacing: ${theme.fontLabelLargeLetterSpacing};- --font-label-medium-heavy: ${theme.fontLabelMediumHeavy};- --font-label-medium-heavy-letter-spacing: ${theme.fontLabelMediumHeavyLetterSpacing};- --font-label-medium: ${theme.fontLabelMedium};- --font-label-medium-letter-spacing: ${theme.fontLabelMediumLetterSpacing};- --font-heading-large: ${theme.fontHeadingLarge};- --font-heading-large-letter-spacing: ${theme.fontHeadingLargeLetterSpacing};- --font-heading-medium: ${theme.fontHeadingMedium};- --font-heading-medium-letter-spacing: ${theme.fontHeadingMediumLetterSpacing};- --font-heading-small: ${theme.fontHeadingSmall};- --font-heading-small-letter-spacing: ${theme.fontHeadingSmallLetterSpacing};-- --shadow-s: ${theme.shadowS};- --shadow-m: ${theme.shadowM};- --shadow-l: ${theme.shadowL};- --shadow-xl: ${theme.shadowXl};- --shadow-2xl: ${theme.shadow2xl};- --shadow-3xl: ${theme.shadow3xl};- }- `}</style>- {props.children}+ body {+ --background-fills: ${theme.backgroundFills};+ --brand-el-fills: ${theme.brandElFills};+ --brand-el-hover-fills: ${theme.brandElHoverFills};+ --container-fills: ${theme.containerFills};+ --overlay-fills: ${theme.overlayFills};+ --sunk-fills: ${theme.sunkFills};+ --container-hover-fills: ${theme.containerHoverFills};+ --danger-fills: ${theme.dangerFills};+ --success-fills: ${theme.successFills};++ --strokes-default: ${theme.strokesDefault};+ --stocks-interactive-el: ${theme.stocksInteractiveEl};+ --stocks-interactive-el-hover: ${theme.stocksInteractiveElHover};+ --strokes-interactive-el-selected: ${theme.strokesInteractiveElSelected};++ --brand-text: ${theme.brandText};+ --brand-secondary-text: ${theme.brandSecondaryText};+ --primary-text: ${theme.primaryText};+ --secondary-text: ${theme.secondaryText};+ --disabled-text: ${theme.disabledText};+ --danger-text: ${theme.dangerText};+ --success-text: ${theme.successText};+ --link-text: ${theme.linkText};+ --info-text: ${theme.infoText};++ --spacing-0: ${theme.spacing0};+ --spacing-3xs: ${theme.spacing3xs};+ --spacing-2xs: ${theme.spacing2xs};+ --spacing-xs: ${theme.spacingXs};+ --spacing-s: ${theme.spacingS};+ --spacing-m: ${theme.spacingM};+ --spacing-l: ${theme.spacingL};+ --spacing-xl: ${theme.spacingXl};+ --spacing-2xl: ${theme.spacing2xl};+ --spacing-3xl: ${theme.spacing3xl};++ --rounded-0: ${theme.rounded0};+ --rounded-3xs: ${theme.rounded3xs};+ --rounded-2xs: ${theme.rounded2xs};+ --rounded-xs: ${theme.roundedXs};+ --rounded-s: ${theme.roundedS};+ --rounded-m: ${theme.roundedM};+ --rounded-l: ${theme.roundedL};+ --rounded-xl: ${theme.roundedXl};+ --rounded-2xl: ${theme.rounded2xl};+ --rounded-3xl: ${theme.rounded3xl};+ --rounded-full: ${theme.roundedFull};++ --font-primary: ${theme.fontPrimary};+ --font-primary-letter-spacing: ${theme.fontPrimaryLetterSpacing};+ --font-title: ${theme.fontTitle};+ --font-title-letter-spacing: ${theme.fontTitleLetterSpacing};+ --font-title-medium: ${theme.fontTitleMedium};+ --font-title-medium-letter-spacing: ${theme.fontTitleMediumLetterSpacing};+ --font-title-small: ${theme.fontTitleSmall};+ --font-title-small-letter-spacing: ${theme.fontTitleSmallLetterSpacing};+ --font-body: ${theme.fontBody};+ --font-body-letter-spacing: ${theme.fontBodyLetterSpacing};+ --font-body-link: ${theme.fontBodyLink};+ --font-body-link-letter-spacing: ${theme.fontBodyLinkLetterSpacing};+ --font-body-heavy: ${theme.fontBodyHeavy};+ --font-body-heavy-letter-spacing: ${theme.fontBodyHeavyLetterSpacing};+ --font-body-medium: ${theme.fontBodyMedium};+ --font-body-medium-letter-spacing: ${theme.fontBodyMediumLetterSpacing};+ --font-body-small-heavy: ${theme.fontBodySmallHeavy};+ --font-body-small-heavy-letter-spacing: ${theme.fontBodySmallHeavyLetterSpacing};+ --font-body-small: ${theme.fontBodySmall};+ --font-body-small-letter-spacing: ${theme.fontBodySmallLetterSpacing};+ --font-label: ${theme.fontLabel};+ --font-label-letter-spacing: ${theme.fontLabelLetterSpacing};+ --font-label-heavy: ${theme.fontLabelHeavy};+ --font-label-heavy-letter-spacing: ${theme.fontLabelHeavyLetterSpacing};+ --font-label-small: ${theme.fontLabelSmall};+ --font-label-small-letter-spacing: ${theme.fontLabelSmallLetterSpacing};+ --font-label-small-heavy: ${theme.fontLabelSmallHeavy};+ --font-label-small-heavy-letter-spacing: ${theme.fontLabelSmallHeavyLetterSpacing};+ --font-label-extra-small: ${theme.fontLabelExtraSmall};+ --font-label-extra-small-letter-spacing: ${theme.fontLabelExtraSmallLetterSpacing};+ --font-label-extra-small-heavy: ${theme.fontLabelExtraSmallHeavy};+ --font-label-extra-small-heavy-letter-spacing: ${theme.fontLabelExtraSmallHeavyLetterSpacing};+ --font-label-large-heavy: ${theme.fontLabelLargeHeavy};+ --font-label-large-heavy-letter-spacing: ${theme.fontLabelLargeHeavyLetterSpacing};+ --font-label-large: ${theme.fontLabelLarge};+ --font-label-large-letter-spacing: ${theme.fontLabelLargeLetterSpacing};+ --font-label-medium-heavy: ${theme.fontLabelMediumHeavy};+ --font-label-medium-heavy-letter-spacing: ${theme.fontLabelMediumHeavyLetterSpacing};+ --font-label-medium: ${theme.fontLabelMedium};+ --font-label-medium-letter-spacing: ${theme.fontLabelMediumLetterSpacing};+ --font-heading-large: ${theme.fontHeadingLarge};+ --font-heading-large-letter-spacing: ${theme.fontHeadingLargeLetterSpacing};+ --font-heading-medium: ${theme.fontHeadingMedium};+ --font-heading-medium-letter-spacing: ${theme.fontHeadingMediumLetterSpacing};+ --font-heading-small: ${theme.fontHeadingSmall};+ --font-heading-small-letter-spacing: ${theme.fontHeadingSmallLetterSpacing};++ --shadow-s: ${theme.shadowS};+ --shadow-m: ${theme.shadowM};+ --shadow-l: ${theme.shadowL};+ --shadow-xl: ${theme.shadowXl};+ --shadow-2xl: ${theme.shadow2xl};+ --shadow-3xl: ${theme.shadow3xl};+ }+ `}</style>+ {children}</>);};diff --git a/js/packages/react-ui/src/components/ThemeProvider/types.ts b/js/packages/react-ui/src/components/ThemeProvider/types.tsnew file mode 100644index 000000000..3d1d9b1a8--- /dev/null+++ b/js/packages/react-ui/src/components/ThemeProvider/types.ts@@ -0,0 +1,135 @@+// Add at the top of the file+export type ThemeMode = "light" | "dark";++// Color-related theme properties+export interface ColorTheme {+ // Background colors+ backgroundFills?: string;+ brandElFills?: string;+ brandElHoverFills?: string;+ containerFills?: string;+ overlayFills?: string;+ sunkFills?: string;+ containerHoverFills?: string;+ dangerFills?: string;+ successFills?: string;++ // Border colors+ strokesDefault?: string;+ stocksInteractiveEl?: string;+ stocksInteractiveElHover?: string;+ strokesInteractiveElSelected?: string;++ // Text colors+ brandText?: string;+ brandSecondaryText?: string;+ primaryText?: string;+ secondaryText?: string;+ disabledText?: string;+ dangerText?: string;+ successText?: string;+ linkText?: string;+ infoText?: string;+}++// Layout-related theme properties+export interface LayoutTheme {+ // Spacing+ spacing0?: string;+ spacing3xs?: string;+ spacing2xs?: string;+ spacingXs?: string;+ spacingS?: string;+ spacingM?: string;+ spacingL?: string;+ spacingXl?: string;+ spacing2xl?: string;+ spacing3xl?: string;++ // Radius+ rounded0?: string;+ rounded3xs?: string;+ rounded2xs?: string;+ roundedXs?: string;+ roundedS?: string;+ roundedM?: string;+ roundedL?: string;+ roundedXl?: string;+ rounded2xl?: string;+ rounded3xl?: string;+ rounded4xl?: string;+ roundedFull?: string;+ roundedClickable?: string;+}++// Typography-related theme properties+export interface TypographyTheme {+ // Primary Font+ fontPrimary?: string;+ fontPrimaryLetterSpacing?: string;++ // Title Variants+ fontTitle?: string;+ fontTitleLetterSpacing?: string;+ fontTitleMedium?: string;+ fontTitleMediumLetterSpacing?: string;+ fontTitleSmall?: string;+ fontTitleSmallLetterSpacing?: string;++ // Body Text+ fontBody?: string;+ fontBodyLetterSpacing?: string;+ fontBodyLink?: string;+ fontBodyLinkLetterSpacing?: string;+ fontBodyHeavy?: string;+ fontBodyHeavyLetterSpacing?: string;+ fontBodyMedium?: string;+ fontBodyMediumLetterSpacing?: string;+ fontBodySmallHeavy?: string;+ fontBodySmallHeavyLetterSpacing?: string;+ fontBodySmall?: string;+ fontBodySmallLetterSpacing?: string;++ // Label System+ fontLabel?: string;+ fontLabelLetterSpacing?: string;+ fontLabelHeavy?: string;+ fontLabelHeavyLetterSpacing?: string;+ fontLabelSmall?: string;+ fontLabelSmallLetterSpacing?: string;+ fontLabelSmallHeavy?: string;+ fontLabelSmallHeavyLetterSpacing?: string;+ fontLabelExtraSmall?: string;+ fontLabelExtraSmallLetterSpacing?: string;+ fontLabelExtraSmallHeavy?: string;+ fontLabelExtraSmallHeavyLetterSpacing?: string;+ fontLabelLargeHeavy?: string;+ fontLabelLargeHeavyLetterSpacing?: string;+ fontLabelLarge?: string;+ fontLabelLargeLetterSpacing?: string;+ fontLabelMediumHeavy?: string;+ fontLabelMediumHeavyLetterSpacing?: string;+ fontLabelMedium?: string;+ fontLabelMediumLetterSpacing?: string;++ // Headings+ fontHeadingLarge?: string;+ fontHeadingLargeLetterSpacing?: string;+ fontHeadingMedium?: string;+ fontHeadingMediumLetterSpacing?: string;+ fontHeadingSmall?: string;+ fontHeadingSmallLetterSpacing?: string;+}++// Effect-related theme properties+export interface EffectTheme {+ // Shadows+ shadowS?: string;+ shadowM?: string;+ shadowL?: string;+ shadowXl?: string;+ shadow2xl?: string;+ shadow3xl?: string;+}++export interface Theme extends ColorTheme, LayoutTheme, TypographyTheme, EffectTheme {}diff --git a/js/pnpm-lock.yaml b/js/pnpm-lock.yamlindex 7aed00946..48586ec29 100644--- a/js/pnpm-lock.yaml+++ b/js/pnpm-lock.yaml@@ -135,6 +135,9 @@ importers:'@storybook/addon-styling-webpack':specifier: ^1.0.1+ '@storybook/core-events':+ specifier: ^8.5.3+ version: 8.5.3([email protected]([email protected]))'@storybook/manager-api':specifier: ^8.5.3version: 8.5.3([email protected]([email protected]))@@ -1625,6 +1628,11 @@ packages:peerDependencies:storybook: ^8.2.0 || ^8.3.0-0 || ^8.4.0-0 || ^8.5.0-0 || ^8.6.0-0+ '@storybook/[email protected]':+ resolution: {integrity: sha512-os2ddayQjBFH8/yZOHdxHIWXIq8MwfhaaPa74ogRCuwCO7qe2E5WBWpt2vTrC0ZJR7RPVKH9zEFqviOzHvz+uA==}+ peerDependencies:+ storybook: ^8.2.0 || ^8.3.0-0 || ^8.4.0-0 || ^8.5.0-0 || ^8.6.0-0+'@storybook/[email protected]':resolution: {integrity: sha512-ZLlr2pltbj/hmC54lggJTnh09FCAJR62lIdiXNwa+V+/eJz0CfD8tfGmZGKPSmaQeZBpMwAOeRM97k2oLPF+0w==}peerDependencies:@@ -4745,6 +4753,10 @@ snapshots:dependencies:storybook: 8.5.3([email protected])+ dependencies:+ storybook: 8.5.3([email protected])+'@storybook/[email protected]([email protected])':dependencies:'@storybook/csf': 0.1.12