diff --git a/packages/ui/components.json b/packages/ui/components.json new file mode 100644 index 00000000000..96755d34bcc --- /dev/null +++ b/packages/ui/components.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "default", + "rsc": false, + "tsx": false, + "tailwind": { + "config": "tailwind.config.js", + "css": "src/index.css", + "baseColor": "zinc", + "cssVariables": true, + "prefix": "" + }, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils", + "ui": "@/components/ui", + "lib": "@/lib", + "hooks": "@/hooks" + }, + "iconLibrary": "lucide" +} \ No newline at end of file diff --git a/packages/ui/package.json b/packages/ui/package.json index 7af3bf3b987..258a2441600 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -15,17 +15,19 @@ "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", "@microsoft/fetch-event-source": "^2.0.1", - "@mui/base": "5.0.0-beta.40", + "@mui/base": "5.0.0-beta.68", "@mui/icons-material": "5.0.3", "@mui/lab": "5.0.0-alpha.156", "@mui/material": "5.15.0", "@mui/x-data-grid": "6.8.0", + "@radix-ui/react-slot": "^1.1.1", "@tabler/icons-react": "^3.3.0", "@uiw/codemirror-theme-sublime": "^4.21.21", "@uiw/codemirror-theme-vscode": "^4.21.21", "@uiw/react-codemirror": "^4.21.21", "axios": "1.6.2", - "clsx": "^1.1.1", + "class-variance-authority": "^0.7.1", + "clsx": "^1.2.1", "dotenv": "^16.0.0", "flowise-embed": "latest", "flowise-embed-react": "latest", @@ -57,6 +59,8 @@ "remark-gfm": "^3.0.1", "remark-math": "^5.1.1", "socket.io-client": "^4.6.1", + "tailwind-merge": "^2.6.0", + "tailwindcss-animate": "^1.0.7", "uuid": "^9.0.1", "yup": "^0.32.9" }, @@ -91,10 +95,13 @@ "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^12.8.3", "@vitejs/plugin-react": "^4.2.0", + "autoprefixer": "^10.4.20", + "postcss": "^8.4.49", "pretty-quick": "^3.1.3", "react-scripts": "^5.0.1", "rimraf": "^5.0.5", "sass": "^1.42.1", + "tailwindcss": "^3.4.17", "typescript": "^5.4.5", "vite": "^5.0.2", "vite-plugin-pwa": "^0.17.0", diff --git a/packages/ui/postcss.config.js b/packages/ui/postcss.config.js new file mode 100644 index 00000000000..33ad091d26d --- /dev/null +++ b/packages/ui/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/packages/ui/src/components/ui/badge.jsx b/packages/ui/src/components/ui/badge.jsx new file mode 100644 index 00000000000..2723d4499a3 --- /dev/null +++ b/packages/ui/src/components/ui/badge.jsx @@ -0,0 +1,31 @@ +import PropTypes from 'prop-types' +import { cva } from 'class-variance-authority' + +import { cn } from '@/lib/utils' + +const badgeVariants = cva( + 'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', + { + variants: { + variant: { + default: 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80', + secondary: 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80', + destructive: 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80', + outline: 'text-foreground' + } + }, + defaultVariants: { + variant: 'default' + } + } +) + +const Badge = ({ className, variant, ...props }) => { + return
+} +Badge.propTypes = { + className: PropTypes.string, + variant: PropTypes.oneOf(['default', 'secondary', 'destructive', 'outline']) +} + +export { Badge, badgeVariants } diff --git a/packages/ui/src/components/ui/button.jsx b/packages/ui/src/components/ui/button.jsx new file mode 100644 index 00000000000..b1a7473cf6d --- /dev/null +++ b/packages/ui/src/components/ui/button.jsx @@ -0,0 +1,44 @@ +import * as React from 'react' +import PropTypes from 'prop-types' +import { Button as BaseButton } from '@mui/base' +import { cva } from 'class-variance-authority' + +import { cn } from '@/lib/utils' + +const buttonVariants = cva( + 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', + { + variants: { + variant: { + default: 'bg-primary text-primary-foreground hover:bg-primary/90', + destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90', + outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground', + secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80', + ghost: 'hover:bg-accent hover:text-accent-foreground', + link: 'text-primary underline-offset-4 hover:underline' + }, + size: { + default: 'h-10 px-4 py-2', + sm: 'h-9 rounded-md px-3', + lg: 'h-11 rounded-md px-8', + icon: 'h-10 w-10' + } + }, + defaultVariants: { + variant: 'default', + size: 'default' + } + } +) + +const Button = React.forwardRef(({ className, variant, size, ...props }, ref) => { + return