Skip to content

The Open Standard for Generative UI

Fix css variables (#52)

abhithesysc9db51a47d26
diff --git a/js/packages/react-ui/package.json b/js/packages/react-ui/package.json
index 309d298c3..233609914 100644
--- a/js/packages/react-ui/package.json
+++ b/js/packages/react-ui/package.json
@@ -2,7 +2,7 @@
"type": "module",
"name": "@crayonai/react-ui",
"license": "MIT",
- "version": "0.5.4",
+ "version": "0.5.5",
"description": "Component library for Generative UI SDK",
"main": "dist/index.js",
"types": "dist/index.d.ts",
diff --git a/js/packages/react-ui/src/components/Card/card.scss b/js/packages/react-ui/src/components/Card/card.scss
index b4757b980..04a495831 100644
--- a/js/packages/react-ui/src/components/Card/card.scss
+++ b/js/packages/react-ui/src/components/Card/card.scss
@@ -9,6 +9,11 @@
color: cssUtils.$primary-text;
@include cssUtils.typography(body, default);
+ // override theme variables so that other crayon components don't depend on chat colors
+ // this solves the case where the crayon-card component is used without the crayon-shell-container
+ --crayon-primary-text: #{cssUtils.$chat-assistant-response-text};
+ --crayon-container-fills: #{cssUtils.$chat-assistant-response-bg};
+
&-card {
padding: cssUtils.$spacing-l;
border-radius: cssUtils.$rounded-3xl;
diff --git a/js/packages/react-ui/src/components/Shell/thread.scss b/js/packages/react-ui/src/components/Shell/thread.scss
index 64fb9323e..28c4552e4 100644
--- a/js/packages/react-ui/src/components/Shell/thread.scss
+++ b/js/packages/react-ui/src/components/Shell/thread.scss
@@ -36,6 +36,7 @@ $center-align-spacing: calc(32px + cssUtils.$spacing-s);
overflow: hidden;
// override theme variables so that other crayon components don't depend on chat colors
+ // this solves the case where the crayon-card component is used in the thread but without card component
--crayon-primary-text: #{cssUtils.$chat-assistant-response-text};
--crayon-container-fills: #{cssUtils.$chat-assistant-response-bg};
diff --git a/js/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx b/js/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
index ee5924b4b..7272dcf9a 100644
--- a/js/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
+++ b/js/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
@@ -21,10 +21,10 @@ const lightTheme: ColorTheme = {
successFills: "rgba(7, 148, 85, 0.08)",
// Border colors
- strokesDefault: "rgba(0, 0, 0, 0.06)",
- stocksInteractiveEl: "rgba(0, 0, 0, 0.12)",
- stocksInteractiveElHover: "rgba(0, 0, 0, 0.4)",
- strokesInteractiveElSelected: "rgb(0, 0, 0)",
+ strokeDefault: "rgba(0, 0, 0, 0.06)",
+ strokeInteractiveEl: "rgba(0, 0, 0, 0.12)",
+ strokeInteractiveElHover: "rgba(0, 0, 0, 0.4)",
+ strokeInteractiveElSelected: "rgb(0, 0, 0)",
// Text colors
brandText: "rgba(255, 255, 255, 1)",
@@ -51,10 +51,10 @@ const darkTheme: ColorTheme = {
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)",
+ strokeDefault: "rgba(255, 255, 255, 0.06)",
+ strokeInteractiveEl: "rgba(255, 255, 255, 0.12)",
+ strokeInteractiveElHover: "rgba(255, 255, 255, 0.4)",
+ strokeInteractiveElSelected: "rgba(255, 255, 255, 1)",
// Text colors
brandText: "rgba(0, 0, 0, 1)",
@@ -218,10 +218,10 @@ export const ThemeProvider = ({
--crayon-danger-fills: ${theme.dangerFills};
--crayon-success-fills: ${theme.successFills};
- --crayon-strokes-default: ${theme.strokesDefault};
- --crayon-stocks-interactive-el: ${theme.stocksInteractiveEl};
- --crayon-stocks-interactive-el-hover: ${theme.stocksInteractiveElHover};
- --crayon-strokes-interactive-el-selected: ${theme.strokesInteractiveElSelected};
+ --crayon-stroke-default: ${theme.strokeDefault};
+ --crayon-stroke-interactive-el: ${theme.strokeInteractiveEl};
+ --crayon-stroke-interactive-el-hover: ${theme.strokeInteractiveElHover};
+ --crayon-stroke-interactive-el-selected: ${theme.strokeInteractiveElSelected};
--crayon-brand-text: ${theme.brandText};
--crayon-brand-secondary-text: ${theme.brandSecondaryText};
diff --git a/js/packages/react-ui/src/components/ThemeProvider/types.ts b/js/packages/react-ui/src/components/ThemeProvider/types.ts
index 6f46fc4c0..82b7202df 100644
--- a/js/packages/react-ui/src/components/ThemeProvider/types.ts
+++ b/js/packages/react-ui/src/components/ThemeProvider/types.ts
@@ -15,10 +15,10 @@ export interface ColorTheme {
successFills?: string;
// Border colors
- strokesDefault?: string;
- stocksInteractiveEl?: string;
- stocksInteractiveElHover?: string;
- strokesInteractiveElSelected?: string;
+ strokeDefault?: string;
+ strokeInteractiveEl?: string;
+ strokeInteractiveElHover?: string;
+ strokeInteractiveElSelected?: string;
// Text colors
brandText?: string;
diff --git a/js/packages/react-ui/src/cssUtils.scss b/js/packages/react-ui/src/cssUtils.scss
index 4bdb69966..18725f551 100644
--- a/js/packages/react-ui/src/cssUtils.scss
+++ b/js/packages/react-ui/src/cssUtils.scss
@@ -12,12 +12,12 @@ $bg-sunk: var(--crayon-sunk-fills);
$bg-danger: var(--crayon-danger-fills);
$bg-success: var(--crayon-success-fills);
-// Crayon Strokes Colors
+// Crayon Stroke Colors
-$stroke-default: var(--crayon-strokes-default);
-$stroke-interactive-el: var(--crayon-stocks-interactive-el);
-$stroke-interactive-el-hover: var(--crayon-stocks-interactive-el-hover);
-$stroke-interactive-el-selected: var(--crayon-strokes-interactive-el-selected);
+$stroke-default: var(--crayon-stroke-default);
+$stroke-interactive-el: var(--crayon-stroke-interactive-el);
+$stroke-interactive-el-hover: var(--crayon-stroke-interactive-el-hover);
+$stroke-interactive-el-selected: var(--crayon-stroke-interactive-el-selected);
// Crayon Text Colors