Skip to content

The Open Standard for Generative UI

Adding new bg-color variable (#168)

subham2fc68cd50ddc
diff --git a/js/packages/react-ui/package.json b/js/packages/react-ui/package.json
index 9304f16f9..26145cdd7 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.8.16",
+ "version": "0.8.17",
"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/Tag/Tag.tsx b/js/packages/react-ui/src/components/Tag/Tag.tsx
index b17181573..74c6859d9 100644
--- a/js/packages/react-ui/src/components/Tag/Tag.tsx
+++ b/js/packages/react-ui/src/components/Tag/Tag.tsx
@@ -1,10 +1,11 @@
import clsx from "clsx";
import { CSSProperties, forwardRef, ReactNode } from "react";
-type TagSize = "md" | "lg";
+type TagSize = "sm" | "md" | "lg";
type TagVariant = "neutral" | "info" | "success" | "warning" | "danger";
const sizeMap: Record<TagSize, string> = {
+ sm: "crayon-tag-sm",
md: "crayon-tag-md",
lg: "crayon-tag-lg",
};
diff --git a/js/packages/react-ui/src/components/Tag/stories/Tag.stories.tsx b/js/packages/react-ui/src/components/Tag/stories/Tag.stories.tsx
index 0a829ec1f..de2bcb96c 100644
--- a/js/packages/react-ui/src/components/Tag/stories/Tag.stories.tsx
+++ b/js/packages/react-ui/src/components/Tag/stories/Tag.stories.tsx
@@ -32,11 +32,11 @@ const meta: Meta<typeof Tag> = {
},
size: {
control: "select",
- options: ["md", "lg"],
+ options: ["sm", "md", "lg"],
description: "The size of the tag",
table: {
category: "Appearance",
- type: { summary: "md | lg" },
+ type: { summary: "sm | md | lg" },
defaultValue: { summary: "md" },
},
},
diff --git a/js/packages/react-ui/src/components/Tag/tag.scss b/js/packages/react-ui/src/components/Tag/tag.scss
index 29bd18432..a21135c7d 100644
--- a/js/packages/react-ui/src/components/Tag/tag.scss
+++ b/js/packages/react-ui/src/components/Tag/tag.scss
@@ -20,6 +20,17 @@
text-overflow: ellipsis;
}
+ &-sm {
+ padding: cssUtils.$spacing-2xs cssUtils.$spacing-xs;
+ border-radius: cssUtils.$rounded-xs;
+ height: 24px;
+
+ .crayon-tag-icon {
+ width: 14px;
+ height: 14px;
+ }
+ }
+
&-md {
padding: cssUtils.$spacing-xs cssUtils.$spacing-s;
border-radius: cssUtils.$rounded-s;
diff --git a/js/packages/react-ui/src/components/TagBlock/stories/TagBlock.stories.tsx b/js/packages/react-ui/src/components/TagBlock/stories/TagBlock.stories.tsx
index fc05b861c..c32e37c95 100644
--- a/js/packages/react-ui/src/components/TagBlock/stories/TagBlock.stories.tsx
+++ b/js/packages/react-ui/src/components/TagBlock/stories/TagBlock.stories.tsx
@@ -52,11 +52,12 @@ type Story = StoryObj<typeof TagBlock>;
export const Default: Story = {
render: (args) => (
<TagBlock {...args}>
+ <Tag variant="info" icon={<Info size={16} />} size="sm" text="Info" />
+ <Tag variant="success" icon={<Star size={16} />} size="sm" text="Star" />
<Tag variant="info" icon={<Info size={16} />} size="md" text="Info" />
<Tag variant="success" icon={<Star size={16} />} size="md" text="Star" />
<Tag variant="warning" icon={<Heart size={16} />} size="lg" text="Heart" />
<Tag variant="danger" icon={<User size={16} />} size="lg" text="User" />
- <Tag variant="neutral" icon={<User size={16} />} size="lg" text="User" />
</TagBlock>
),
};
diff --git a/js/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx b/js/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
index 1bf871ae9..47c8e001c 100644
--- a/js/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
+++ b/js/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
@@ -47,6 +47,7 @@ const lightTheme: ColorTheme = {
invertedFills: "rgba(21, 21, 21, 1)",
elevatedFills: "rgba(255, 255, 255, 0.6)",
sunkBgFills: "rgba(0, 0, 0, 0.04)",
+ highlightSubtle: "rgba(0, 0, 0, 0.03)",
// Border colors
strokeDefault: "rgba(0, 0, 0, 0.04)",
@@ -120,6 +121,7 @@ const darkTheme: ColorTheme = {
elevatedFills: "rgba(255, 255, 255, 0.06)",
invertedFills: "rgba(253, 253, 253, 1)",
sunkBgFills: "rgba(0, 0, 0, 0.16)",
+ highlightSubtle: "rgba(255, 255, 255, 0.03)",
// Border colors
strokeDefault: "rgba(255, 255, 255, 0.04)",
@@ -354,6 +356,7 @@ export const ThemeProvider = ({
--crayon-interactive-destructive-accent-hover: ${theme.interactiveDestructiveAccentHover};
--crayon-interactive-destructive-accent-pressed: ${theme.interactiveDestructiveAccentPressed};
--crayon-interactive-destructive-accent-disabled: ${theme.interactiveDestructiveAccentDisabled};
+ --crayon-highlight-subtle: ${theme.highlightSubtle};
--crayon-stroke-default: ${theme.strokeDefault};
--crayon-stroke-interactive-el: ${theme.strokeInteractiveEl};
diff --git a/js/packages/react-ui/src/components/ThemeProvider/types.ts b/js/packages/react-ui/src/components/ThemeProvider/types.ts
index c431445e3..29bc9c528 100644
--- a/js/packages/react-ui/src/components/ThemeProvider/types.ts
+++ b/js/packages/react-ui/src/components/ThemeProvider/types.ts
@@ -105,6 +105,7 @@ export interface ColorTheme extends ChartColorPalette {
interactiveDestructiveAccentHover?: string;
interactiveDestructiveAccentPressed?: string;
interactiveDestructiveAccentDisabled?: string;
+ highlightSubtle?: string;
// chat colors
chatContainerBg?: string;
diff --git a/js/packages/react-ui/src/cssUtils.scss b/js/packages/react-ui/src/cssUtils.scss
index f32ccba7f..6286802f3 100644
--- a/js/packages/react-ui/src/cssUtils.scss
+++ b/js/packages/react-ui/src/cssUtils.scss
@@ -13,6 +13,7 @@ $bg-elevated: var(--crayon-elevated-fills);
$bg-alert: var(--crayon-alert-fills);
$bg-inverted: var(--crayon-inverted-fills);
$bg-sunk-bg: var(--crayon-sunk-bg-fills);
+$bg-highlight-subtle: var(--crayon-highlight-subtle);
// Crayon Interactive Colors