buildgrid-ui 1.0.0 → 1.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,9 @@ on:
3
3
  push:
4
4
  branches:
5
5
  - main
6
+ - alpha
7
+ - beta
8
+ - rc
6
9
  jobs:
7
10
  release:
8
11
  runs-on: ubuntu-latest
package/.releaserc.json CHANGED
@@ -1,5 +1,19 @@
1
1
  {
2
- "branches": ["main"],
2
+ "branches": [
3
+ "main",
4
+ {
5
+ "name": "alpha",
6
+ "prerelease": "alpha"
7
+ },
8
+ {
9
+ "name": "beta",
10
+ "prerelease": "beta"
11
+ },
12
+ {
13
+ "name": "release-candidate",
14
+ "prerelease": "rc"
15
+ }
16
+ ],
3
17
  "plugins": [
4
18
  "@semantic-release/commit-analyzer",
5
19
  "@semantic-release/release-notes-generator",
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # [1.1.0-alpha.1](https://github.com/adrianomaringolo/buildgrid-ui/compare/v1.0.0...v1.1.0-alpha.1) (2025-01-02)
2
+
3
+
4
+ ### Features
5
+
6
+ * adding shadcn configuration ([5841434](https://github.com/adrianomaringolo/buildgrid-ui/commit/584143402fad7aa19e477693d2a4727f5625e430))
7
+ * enhance Button component stories with props and update export ([69292b3](https://github.com/adrianomaringolo/buildgrid-ui/commit/69292b3d467dd5ed8eacf521e9c5f89e465af323))
8
+
1
9
  # 1.0.0 (2025-01-02)
2
10
 
3
11
 
package/README.md ADDED
@@ -0,0 +1,132 @@
1
+ # buildgrid-ui
2
+
3
+ ### This lib is under construction, take a look again soon 🚧
4
+
5
+ A React component library built using [Vite](https://vitejs.dev) and [shadcn](https://shadcn.dev) as the foundation. This library is designed to integrate seamlessly with React and Next.js applications and includes support for [TailwindCSS](https://tailwindcss.com). It also provides a Storybook setup to display and document the components.
6
+
7
+ ## Features
8
+
9
+ - **Built with Vite** for a fast development experience.
10
+ - **TailwindCSS Integration** for utility-first styling.
11
+ - **shadcn Components** as a robust base.
12
+ - **Storybook** for component documentation and testing.
13
+ - **Semantic Versioning** with automated releases using [semantic-release](https://semantic-release.gitbook.io/semantic-release/).
14
+
15
+ ---
16
+
17
+ ## Getting Started
18
+
19
+ ### Installation
20
+
21
+ To install the library, run:
22
+
23
+ ```bash
24
+ npm install buildgrid-ui
25
+ ```
26
+
27
+ or
28
+
29
+ ```bash
30
+ yarn add buildgrid-ui
31
+ ```
32
+
33
+ ---
34
+
35
+ ### Usage
36
+
37
+ 1. Import a component in your React project:
38
+
39
+ ```jsx
40
+ import { Button } from "buildgrid-ui";
41
+
42
+ const App = () => <Button variant="primary">Click Me</Button>;
43
+
44
+ export default App;
45
+ ```
46
+
47
+ 2. Ensure TailwindCSS is configured in your project. Add the following imports to your `styles.css` file (or equivalent):
48
+
49
+ ```css
50
+ @tailwind base;
51
+ @tailwind components;
52
+ @tailwind utilities;
53
+ ```
54
+
55
+ 3. Include the `tailwind.config.js` content paths for buildgrid-ui:
56
+ ```javascript
57
+ module.exports = {
58
+ content: [
59
+ "./src/**/*.{js,ts,jsx,tsx}",
60
+ "./node_modules/buildgrid-ui/**/*.{js,ts,jsx,tsx}",
61
+ ],
62
+ theme: {
63
+ extend: {},
64
+ },
65
+ plugins: [],
66
+ };
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Development
72
+
73
+ ### Setting Up the Project
74
+
75
+ Clone the repository and install dependencies:
76
+
77
+ ```bash
78
+ git clone https://github.com/yourusername/buildgrid-ui.git
79
+ cd buildgrid-ui
80
+ npm install
81
+ ```
82
+
83
+ ### Storybook
84
+
85
+ Run Storybook locally to preview and develop components:
86
+
87
+ ```bash
88
+ npm run storybook
89
+ ```
90
+
91
+ ---
92
+
93
+ ### Build the Library
94
+
95
+ To build the library for production:
96
+
97
+ ```bash
98
+ npm run build
99
+ ```
100
+
101
+ The output will be in the `dist/` directory, ready for publishing or integration.
102
+
103
+ ---
104
+
105
+ ## Semantic Releases
106
+
107
+ This project uses [semantic-release](https://semantic-release.gitbook.io/) for automated versioning and releases.
108
+
109
+ ### Steps to Create a Pre-release
110
+
111
+ 1. Push changes to the designated pre-release branch (e.g., `alpha`):
112
+ ```bash
113
+ git checkout -b alpha
114
+ git push origin alpha
115
+ ```
116
+ 2. Pre-release versions (e.g., `1.0.0-alpha.1`) will be automatically created.
117
+
118
+ ---
119
+
120
+ ## Contributing
121
+
122
+ Contributions are welcome! To contribute:
123
+
124
+ 1. Fork the repository.
125
+ 2. Create a new branch for your feature or bugfix.
126
+ 3. Submit a pull request with a detailed description of your changes.
127
+
128
+ ---
129
+
130
+ ## License
131
+
132
+ This project is licensed under the [MIT License](LICENSE).
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "default",
4
+ "rsc": false,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "tailwind.config.js",
8
+ "css": "src/styles/tailwind.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "aliases": {
14
+ "components": "@/components",
15
+ "utils": "@/lib/utils",
16
+ "ui": "@/components/ui",
17
+ "lib": "@/lib",
18
+ "hooks": "@/hooks"
19
+ },
20
+ "iconLibrary": "lucide"
21
+ }
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "buildgrid-ui",
3
- "version": "1.0.0",
3
+ "version": "1.1.0-alpha.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
4
7
  "main": "dist/buildgrid-ui.umd.js",
5
8
  "module": "dist/buildgrid-ui.esm.js",
6
9
  "types": "dist/index.d.ts",
@@ -15,9 +18,15 @@
15
18
  "license": "ISC",
16
19
  "description": "",
17
20
  "dependencies": {
21
+ "@radix-ui/react-slot": "^1.1.1",
18
22
  "@shadcn/ui": "^0.0.4",
23
+ "class-variance-authority": "^0.7.1",
24
+ "clsx": "^2.1.1",
25
+ "lucide-react": "^0.469.0",
19
26
  "react": "^19.0.0",
20
27
  "react-dom": "^19.0.0",
28
+ "tailwind-merge": "^2.6.0",
29
+ "tailwindcss-animate": "^1.0.7",
21
30
  "vite": "^6.0.6"
22
31
  },
23
32
  "devDependencies": {
@@ -36,6 +45,7 @@
36
45
  "@storybook/react": "^8.4.7",
37
46
  "@storybook/react-vite": "^8.4.7",
38
47
  "@storybook/test": "^8.4.7",
48
+ "@types/node": "^22.10.3",
39
49
  "@types/react": "^19.0.2",
40
50
  "@vitejs/plugin-react": "^4.3.4",
41
51
  "autoprefixer": "^10.4.20",
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
2
 
3
- import Button from "./Button";
3
+ import { Button, ButtonProps } from "./Button";
4
4
 
5
5
  const meta: Meta<typeof Button> = {
6
6
  component: Button,
@@ -9,8 +9,19 @@ const meta: Meta<typeof Button> = {
9
9
  export default meta;
10
10
  type Story = StoryObj<typeof Button>;
11
11
 
12
- export const Primary: Story = {
12
+ const Template = (args: ButtonProps) => {
13
+ return (
14
+ <div style={{ padding: "10px" }}>
15
+ <Button>{args.children}</Button>
16
+ </div>
17
+ );
18
+ };
19
+
20
+ export const Default: Story = {
21
+ render: Template.bind({}),
13
22
  args: {
14
- label: "Button example",
23
+ children: "Primary Button",
24
+ variant: "default",
25
+ size: "default",
15
26
  },
16
27
  };
@@ -1,17 +1,57 @@
1
- import React from "react";
1
+ import { Slot } from "@radix-ui/react-slot";
2
+ import { cva, type VariantProps } from "class-variance-authority";
3
+ import * as React from "react";
4
+ import { cn } from "../../lib/utils/cn";
2
5
 
3
- export interface ButtonProps {
4
- label: string;
5
- onClick?: () => void;
6
+ const buttonVariants = cva(
7
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default:
12
+ "bg-primary text-primary-foreground shadow hover:bg-primary/90",
13
+ destructive:
14
+ "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
15
+ outline:
16
+ "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
17
+ secondary:
18
+ "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
19
+ ghost: "hover:bg-accent hover:text-accent-foreground",
20
+ link: "text-primary underline-offset-4 hover:underline",
21
+ },
22
+ size: {
23
+ default: "h-9 px-4 py-2",
24
+ sm: "h-8 rounded-md px-3 text-xs",
25
+ lg: "h-10 rounded-md px-8",
26
+ xl: "h-12 rounded-md px-10 text-xl",
27
+ icon: "h-9 w-9",
28
+ },
29
+ },
30
+ defaultVariants: {
31
+ variant: "default",
32
+ size: "default",
33
+ },
34
+ }
35
+ );
36
+
37
+ export interface ButtonProps
38
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
39
+ VariantProps<typeof buttonVariants> {
40
+ asChild?: boolean;
6
41
  }
7
42
 
8
- const Button: React.FC<ButtonProps> = ({ label, onClick }) => (
9
- <button
10
- onClick={onClick}
11
- className="px-4 py-2 bg-blue-500 text-white rounded"
12
- >
13
- {label}
14
- </button>
43
+ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
44
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
45
+ const Comp = asChild ? Slot : "button";
46
+ return (
47
+ <Comp
48
+ className={cn(buttonVariants({ variant, size, className }))}
49
+ ref={ref}
50
+ {...props}
51
+ />
52
+ );
53
+ }
15
54
  );
55
+ Button.displayName = "Button";
16
56
 
17
- export default Button;
57
+ export { Button, buttonVariants };
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export { default as Button } from "./components/button/Button";
1
+ export { Button } from "./components/button/Button";
@@ -0,0 +1,6 @@
1
+ import { clsx, type ClassValue } from "clsx"
2
+ import { twMerge } from "tailwind-merge"
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs))
6
+ }
@@ -0,0 +1,6 @@
1
+ import { clsx, type ClassValue } from "clsx"
2
+ import { twMerge } from "tailwind-merge"
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs))
6
+ }
@@ -1,3 +1,66 @@
1
1
  @tailwind base;
2
2
  @tailwind components;
3
3
  @tailwind utilities;
4
+ @layer base {
5
+ :root {
6
+ --background: 0 0% 100%;
7
+ --foreground: 0 0% 3.9%;
8
+ --card: 0 0% 100%;
9
+ --card-foreground: 0 0% 3.9%;
10
+ --popover: 0 0% 100%;
11
+ --popover-foreground: 0 0% 3.9%;
12
+ --primary: 0 0% 9%;
13
+ --primary-foreground: 0 0% 98%;
14
+ --secondary: 0 0% 96.1%;
15
+ --secondary-foreground: 0 0% 9%;
16
+ --muted: 0 0% 96.1%;
17
+ --muted-foreground: 0 0% 45.1%;
18
+ --accent: 0 0% 96.1%;
19
+ --accent-foreground: 0 0% 9%;
20
+ --destructive: 0 84.2% 60.2%;
21
+ --destructive-foreground: 0 0% 98%;
22
+ --border: 0 0% 89.8%;
23
+ --input: 0 0% 89.8%;
24
+ --ring: 0 0% 3.9%;
25
+ --chart-1: 12 76% 61%;
26
+ --chart-2: 173 58% 39%;
27
+ --chart-3: 197 37% 24%;
28
+ --chart-4: 43 74% 66%;
29
+ --chart-5: 27 87% 67%;
30
+ --radius: 0.5rem
31
+ }
32
+ .dark {
33
+ --background: 0 0% 3.9%;
34
+ --foreground: 0 0% 98%;
35
+ --card: 0 0% 3.9%;
36
+ --card-foreground: 0 0% 98%;
37
+ --popover: 0 0% 3.9%;
38
+ --popover-foreground: 0 0% 98%;
39
+ --primary: 0 0% 98%;
40
+ --primary-foreground: 0 0% 9%;
41
+ --secondary: 0 0% 14.9%;
42
+ --secondary-foreground: 0 0% 98%;
43
+ --muted: 0 0% 14.9%;
44
+ --muted-foreground: 0 0% 63.9%;
45
+ --accent: 0 0% 14.9%;
46
+ --accent-foreground: 0 0% 98%;
47
+ --destructive: 0 62.8% 30.6%;
48
+ --destructive-foreground: 0 0% 98%;
49
+ --border: 0 0% 14.9%;
50
+ --input: 0 0% 14.9%;
51
+ --ring: 0 0% 83.1%;
52
+ --chart-1: 220 70% 50%;
53
+ --chart-2: 160 60% 45%;
54
+ --chart-3: 30 80% 55%;
55
+ --chart-4: 280 65% 60%;
56
+ --chart-5: 340 75% 55%
57
+ }
58
+ }
59
+ @layer base {
60
+ * {
61
+ @apply border-border;
62
+ }
63
+ body {
64
+ @apply bg-background text-foreground;
65
+ }
66
+ }
@@ -1,8 +1,57 @@
1
1
  /** @type {import('tailwindcss').Config} */
2
2
  module.exports = {
3
- content: ["./src/**/*.{js,ts,jsx,tsx}"],
3
+ darkMode: ["class"],
4
+ content: ["./src/**/*.{js,ts,jsx,tsx}"],
4
5
  theme: {
5
- extend: {},
6
+ extend: {
7
+ borderRadius: {
8
+ lg: 'var(--radius)',
9
+ md: 'calc(var(--radius) - 2px)',
10
+ sm: 'calc(var(--radius) - 4px)'
11
+ },
12
+ colors: {
13
+ background: 'hsl(var(--background))',
14
+ foreground: 'hsl(var(--foreground))',
15
+ card: {
16
+ DEFAULT: 'hsl(var(--card))',
17
+ foreground: 'hsl(var(--card-foreground))'
18
+ },
19
+ popover: {
20
+ DEFAULT: 'hsl(var(--popover))',
21
+ foreground: 'hsl(var(--popover-foreground))'
22
+ },
23
+ primary: {
24
+ DEFAULT: 'hsl(var(--primary))',
25
+ foreground: 'hsl(var(--primary-foreground))'
26
+ },
27
+ secondary: {
28
+ DEFAULT: 'hsl(var(--secondary))',
29
+ foreground: 'hsl(var(--secondary-foreground))'
30
+ },
31
+ muted: {
32
+ DEFAULT: 'hsl(var(--muted))',
33
+ foreground: 'hsl(var(--muted-foreground))'
34
+ },
35
+ accent: {
36
+ DEFAULT: 'hsl(var(--accent))',
37
+ foreground: 'hsl(var(--accent-foreground))'
38
+ },
39
+ destructive: {
40
+ DEFAULT: 'hsl(var(--destructive))',
41
+ foreground: 'hsl(var(--destructive-foreground))'
42
+ },
43
+ border: 'hsl(var(--border))',
44
+ input: 'hsl(var(--input))',
45
+ ring: 'hsl(var(--ring))',
46
+ chart: {
47
+ '1': 'hsl(var(--chart-1))',
48
+ '2': 'hsl(var(--chart-2))',
49
+ '3': 'hsl(var(--chart-3))',
50
+ '4': 'hsl(var(--chart-4))',
51
+ '5': 'hsl(var(--chart-5))'
52
+ }
53
+ }
54
+ }
6
55
  },
7
- plugins: [],
56
+ plugins: [require("tailwindcss-animate")],
8
57
  };
@@ -0,0 +1,10 @@
1
+ {
2
+ "compilerOptions": {
3
+ // ...
4
+ "baseUrl": ".",
5
+ "paths": {
6
+ "@/*": ["./src/*"]
7
+ }
8
+ // ...
9
+ }
10
+ }
package/tsconfig.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "baseUrl": ".",
3
4
  "target": "esnext",
4
5
  "module": "esnext",
5
6
  "lib": ["dom", "esnext"],
@@ -8,7 +9,11 @@
8
9
  "moduleResolution": "node",
9
10
  "esModuleInterop": true,
10
11
  "declaration": true,
11
- "outDir": "dist"
12
+ "outDir": "dist",
13
+
14
+ "paths": {
15
+ "@/*": ["./src/*"]
16
+ }
12
17
  },
13
18
  "include": ["src"]
14
19
  }
package/vite.config.ts CHANGED
@@ -1,8 +1,20 @@
1
1
  import { defineConfig } from "vite";
2
+ import path from "path";
2
3
  import react from "@vitejs/plugin-react";
3
4
 
4
5
  export default defineConfig({
5
6
  plugins: [react()],
7
+ resolve: {
8
+ alias: {
9
+ "@": path.resolve(__dirname, "./src"),
10
+ },
11
+ },
12
+ css: {
13
+ postcss: {
14
+ plugins: [require("tailwindcss"), require("autoprefixer")],
15
+ },
16
+ },
17
+
6
18
  build: {
7
19
  lib: {
8
20
  entry: "src/index.ts",