The Open Standard for Generative UI
feat: add @radix-ui/react-separator package and update CSS utility file
Ankit Dasba0545af1ff8
diff --git a/js/packages/react-ui/cp-css.js b/js/packages/react-ui/cp-css.jsindex 65a77e598..efdf8b642 100644--- a/js/packages/react-ui/cp-css.js+++ b/js/packages/react-ui/cp-css.js@@ -42,6 +42,9 @@ function copyCssFiles() {const indexCSSContent = fs.readFileSync(path.join(srcDir, "index.css"), "utf8");fs.writeFileSync(path.join(distDir, "index.css"), indexCSSContent);++ const cssUtilsSrc = fs.readFileSync(path.join(dirname, "src", "cssUtils.scss"), "utf8");+ fs.writeFileSync(path.join(distDir, "cssUtils.scss"), cssUtilsSrc);}try {diff --git a/js/packages/react-ui/package.json b/js/packages/react-ui/package.jsonindex 023e4fd17..71c66c7e7 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.7",+ "version": "0.8.8","description": "Component library for Generative UI SDK","main": "dist/index.js","types": "dist/index.d.ts",@@ -62,6 +62,7 @@"@radix-ui/react-label": "^2.1.1","@radix-ui/react-radio-group": "^1.2.2","@radix-ui/react-select": "^2.1.5",+ "@radix-ui/react-separator": "^1.1.7","@radix-ui/react-slider": "^1.2.2","@radix-ui/react-switch": "^1.1.2","@radix-ui/react-tabs": "^1.1.2",diff --git a/js/packages/react-ui/src/components/Separator/Separator.tsx b/js/packages/react-ui/src/components/Separator/Separator.tsxnew file mode 100644index 000000000..a0b3cdca8--- /dev/null+++ b/js/packages/react-ui/src/components/Separator/Separator.tsx@@ -0,0 +1,8 @@+import * as RadixSeparator from "@radix-ui/react-separator";+import clsx from "clsx";++const Separator = ({ className, ...props }: React.ComponentProps<typeof RadixSeparator.Root>) => {+ return <RadixSeparator.Root className={clsx("crayon-separator", className)} {...props} />;+};++export { Separator };diff --git a/js/packages/react-ui/src/components/Separator/dependencies.ts b/js/packages/react-ui/src/components/Separator/dependencies.tsnew file mode 100644index 000000000..1a67c76b7--- /dev/null+++ b/js/packages/react-ui/src/components/Separator/dependencies.ts@@ -0,0 +1,2 @@+const dependencies = ["Separator"];+export default dependencies;diff --git a/js/packages/react-ui/src/components/Separator/index.ts b/js/packages/react-ui/src/components/Separator/index.tsnew file mode 100644index 000000000..4060cb5ec--- /dev/null+++ b/js/packages/react-ui/src/components/Separator/index.ts@@ -0,0 +1 @@+export * from "./Separator";diff --git a/js/packages/react-ui/src/components/Separator/separator.scss b/js/packages/react-ui/src/components/Separator/separator.scssnew file mode 100644index 000000000..bc25d145e--- /dev/null+++ b/js/packages/react-ui/src/components/Separator/separator.scss@@ -0,0 +1,15 @@+@use "../../cssUtils" as cssUtils;++.crayon-separator {+ background-color: cssUtils.$stroke-interactive-el;++ &[data-orientation="horizontal"] {+ height: 1px;+ width: 100%;+ }++ &[data-orientation="vertical"] {+ width: 1px;+ height: 100%;+ }+}diff --git a/js/packages/react-ui/src/components/Separator/stories/Separator.stories.tsx b/js/packages/react-ui/src/components/Separator/stories/Separator.stories.tsxnew file mode 100644index 000000000..09cdf59eb--- /dev/null+++ b/js/packages/react-ui/src/components/Separator/stories/Separator.stories.tsx@@ -0,0 +1,52 @@+import type { Meta, StoryObj } from "@storybook/react";+import { Separator } from "../Separator";++const meta: Meta<typeof Separator> = {+ title: "Components/Separator",+ component: Separator,+ tags: ["autodocs", "!dev"],+ parameters: {+ layout: "centered",+ docs: {+ description: {+ component: "```tsx\nimport { Separator } from '@crayon-ui/react-ui';\n```",+ },+ },+ },+ decorators: [+ (Story, { args }) => (+ <div style={args.orientation === "vertical" ? { height: "100px" } : { width: "100px" }}>+ <Story />+ </div>+ ),+ ],+ argTypes: {+ orientation: {+ control: "radio",+ options: ["horizontal", "vertical"],+ description: "The orientation of the separator.",+ defaultValue: "horizontal",+ },+ decorative: {+ control: "boolean",+ description:+ "When ```true```, signifies that it is purely visual, carries no semantic meaning, and ensures it is not present in the accessibility tree.",+ defaultValue: false,+ },+ },+};++export default meta;+type Story = StoryObj<typeof Separator>;++export const Horizontal: Story = {+ args: {+ orientation: "horizontal",+ },+};++export const Vertical: Story = {+ args: {+ orientation: "vertical",+ },+};diff --git a/js/packages/react-ui/src/components/index.scss b/js/packages/react-ui/src/components/index.scssindex 01ce5fee5..cc8230299 100644--- a/js/packages/react-ui/src/components/index.scss+++ b/js/packages/react-ui/src/components/index.scss@@ -42,3 +42,4 @@@forward "./ToggleItem/toggleItem.scss";@forward "./TextCallout/textCallout.scss";@forward "./Charts/charts.scss";+@forward "./Separator/separator.scss";diff --git a/js/pnpm-lock.yaml b/js/pnpm-lock.yamlindex 090e95148..d8de50d09 100644--- a/js/pnpm-lock.yaml+++ b/js/pnpm-lock.yaml@@ -132,6 +132,9 @@ importers:'@radix-ui/react-select':specifier: ^2.1.5version: 2.2.5(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@radix-ui/react-separator':+ specifier: ^1.1.7+ version: 1.1.7(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])'@radix-ui/react-slider':specifier: ^1.2.2version: 1.3.5(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])@@ -1238,6 +1241,19 @@ packages:'@types/react-dom':optional: true+ '@radix-ui/[email protected]':+ resolution: {integrity: sha512-0HEb8R9E8A+jZjvmFCy/J4xhbXy3TV+9XSnGJ3KvTtjlIUy/YQ/p6UYZvi7YbeoeXdyU9+Y3scizK6hkY37baA==}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+'@radix-ui/[email protected]':resolution: {integrity: sha512-rkfe2pU2NBAYfGaxa3Mqosi7VZEWX5CxKaanRv0vZd4Zhl9fvQrg0VM93dv3xGLGfrHuoTRF3JXH8nb9g+B3fw==}peerDependencies:@@ -4831,6 +4847,15 @@ snapshots:'@types/react': 19.1.8'@types/react-dom': 19.1.6(@types/[email protected])+ '@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':+ dependencies:+ '@radix-ui/react-primitive': 2.1.3(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ react: 19.1.0+ react-dom: 19.1.0([email protected])+ optionalDependencies:+ '@types/react': 19.1.8+ '@types/react-dom': 19.1.6(@types/[email protected])+'@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':dependencies:'@radix-ui/number': 1.1.1