shru-design-system 0.0.9 → 0.1.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.
package/README.md CHANGED
@@ -1,130 +1,183 @@
1
- # Design System Repository
1
+ # shru-design-system
2
2
 
3
- A comprehensive design system with 72+ reusable components and a theme management library. This monorepo contains both a Next.js showcase application and publishable npm libraries.
4
-
5
- ## Purpose
6
-
7
- A design system with 72+ reusable components and a theme management library. Includes both a Next.js showcase application and publishable npm libraries.
8
-
9
- ## Key Features
10
-
11
- ### Design System Components
12
- - **72+ Components** organized by category (atoms, molecules, layout, primitives)
13
- - **Radix UI Based** - Accessible, unstyled primitives with custom styling
14
- - **Tailwind CSS** - Utility-first styling with CSS variables
15
- - **TypeScript** - Full type definitions for all components
16
- - **Component Showcases** - Live, interactive examples for every component
17
-
18
- ### Theme System
19
- - **Token-based Theming** with multi-category support (color, typography, shape, density, animation)
20
- - **Reusable Library** - Theme toggle component and utilities published as `shru-design-system`
21
- - **Zero CSS Imports** - CSS variables generated and injected automatically
22
- - **Dynamic Theme Switching** - Runtime theme composition and application
23
- - **Modular Architecture** - Clean separation of UI, hooks, config, and utilities
24
-
25
- ### Architecture
26
- - **Module-based Structure** - Clean separation of UI, hooks, config, and utils
27
- - **Centralized Exports** - Clean import paths with `index.ts` files
28
- - **Atomic Design** - Components organized by complexity and purpose
3
+ A React component library with atoms and molecules built on Radix UI and Tailwind CSS.
29
4
 
30
5
  ## Installation
31
6
 
32
7
  ```bash
33
8
  npm install shru-design-system
34
- # or
35
- pnpm add shru-design-system
36
9
  ```
37
10
 
38
- ## Quick Start
11
+ ## Quick Setup
39
12
 
40
- ```tsx
41
- // 1. Import CSS (required)
42
- import '@shru/design-system/styles'
13
+ After installation, run the setup script to configure Tailwind CSS:
43
14
 
44
- // 2. Import component
45
- import { ThemeToggle } from 'shru-design-system'
46
-
47
- function App() {
48
- return <ThemeToggle position="bottom-right" />
49
- }
15
+ ```bash
16
+ npx shru-design-system-init
50
17
  ```
51
18
 
52
- **Note:** You must import the CSS file - it contains Tailwind setup and base CSS variables. The theme system will dynamically override variables at runtime.
19
+ Or it will run automatically after `npm install` (you can skip this step if it already ran).
53
20
 
54
- See [USAGE.md](./USAGE.md) for complete usage guide.
21
+ ## Manual Setup
55
22
 
56
- ## Build Process
23
+ If you prefer to set up manually or the automatic setup didn't work:
57
24
 
58
- ```bash
59
- # Build the library
60
- npm run build:lib
61
- # Generates: dist/index.js (ESM), dist/index.cjs (CJS), dist/index.d.ts (types)
25
+ ### 1. Install Tailwind CSS
62
26
 
63
- # Run the showcase app
64
- npm run dev
65
- # Visit: http://localhost:3000/design-system
27
+ ```bash
28
+ npm install -D tailwindcss postcss autoprefixer
29
+ npx tailwindcss init -p
66
30
  ```
67
31
 
68
- ## Project Structure
69
-
32
+ ### 2. Configure Tailwind
33
+
34
+ Update `tailwind.config.js`:
35
+
36
+ ```js
37
+ export default {
38
+ content: [
39
+ "./index.html",
40
+ "./src/**/*.{js,ts,jsx,tsx}",
41
+ "./node_modules/shru-design-system/dist/**/*.{js,mjs}",
42
+ ],
43
+ theme: {
44
+ extend: {
45
+ colors: {
46
+ background: "hsl(var(--background))",
47
+ foreground: "hsl(var(--foreground))",
48
+ primary: {
49
+ DEFAULT: "hsl(var(--primary))",
50
+ foreground: "hsl(var(--primary-foreground))",
51
+ },
52
+ secondary: {
53
+ DEFAULT: "hsl(var(--secondary))",
54
+ foreground: "hsl(var(--secondary-foreground))",
55
+ },
56
+ destructive: {
57
+ DEFAULT: "hsl(var(--destructive))",
58
+ foreground: "hsl(var(--destructive-foreground))",
59
+ },
60
+ muted: {
61
+ DEFAULT: "hsl(var(--muted))",
62
+ foreground: "hsl(var(--muted-foreground))",
63
+ },
64
+ accent: {
65
+ DEFAULT: "hsl(var(--accent))",
66
+ foreground: "hsl(var(--accent-foreground))",
67
+ },
68
+ popover: {
69
+ DEFAULT: "hsl(var(--popover))",
70
+ foreground: "hsl(var(--popover-foreground))",
71
+ },
72
+ border: "hsl(var(--border))",
73
+ input: "hsl(var(--input))",
74
+ ring: "hsl(var(--ring))",
75
+ },
76
+ borderRadius: {
77
+ lg: "var(--radius)",
78
+ md: "calc(var(--radius) - 2px)",
79
+ sm: "calc(var(--radius) - 4px)",
80
+ },
81
+ },
82
+ },
83
+ plugins: [],
84
+ }
70
85
  ```
71
- .
72
- ├── apps/
73
- │ └── design-system/ # Next.js showcase application
74
- │ ├── app/ # Routes (minimal)
75
- │ ├── src/design-system/ # Component library & themes
76
- │ ├── config/ # App configuration
77
- │ ├── hooks/ # App-level hooks
78
- │ ├── lib/ # Shared utilities
79
- │ └── public/tokens/ # Design tokens (symlinked to src/tokens)
80
- ├── src/ # Reusable library code
81
- │ ├── tokens/ # Design tokens (JSON files)
82
- │ └── index.ts # Library entry point (re-exports from app's theme system)
83
- ├── dist/ # Built library files (generated)
84
- └── package.json # Root package config
86
+
87
+ ### 3. Add CSS Variables
88
+
89
+ Create or update `src/index.css`:
90
+
91
+ ```css
92
+ @tailwind base;
93
+ @tailwind components;
94
+ @tailwind utilities;
95
+
96
+ @layer base {
97
+ :root {
98
+ --background: 0 0% 100%;
99
+ --foreground: 222.2 84% 4.9%;
100
+ --primary: 222.2 47.4% 11.2%;
101
+ --primary-foreground: 210 40% 98%;
102
+ --secondary: 210 40% 96.1%;
103
+ --secondary-foreground: 222.2 47.4% 11.2%;
104
+ --destructive: 0 84.2% 60.2%;
105
+ --destructive-foreground: 210 40% 98%;
106
+ --muted: 210 40% 96.1%;
107
+ --muted-foreground: 215.4 16.3% 46.9%;
108
+ --accent: 210 40% 96.1%;
109
+ --accent-foreground: 222.2 47.4% 11.2%;
110
+ --popover: 0 0% 100%;
111
+ --popover-foreground: 222.2 84% 4.9%;
112
+ --border: 214.3 31.8% 91.4%;
113
+ --input: 214.3 31.8% 91.4%;
114
+ --ring: 222.2 84% 4.9%;
115
+ --radius: 0.5rem;
116
+ }
117
+
118
+ * {
119
+ border-color: hsl(var(--border));
120
+ }
121
+
122
+ body {
123
+ background-color: hsl(var(--background));
124
+ color: hsl(var(--foreground));
125
+ }
126
+ }
85
127
  ```
86
128
 
87
- ## Documentation
129
+ ### 4. Import CSS
88
130
 
89
- ### Getting Started
90
- - **[USAGE.md](./USAGE.md)** - Complete usage guide: setup, theme toggle, components, how it works
91
- - **[CURSOR_PROMPT.md](./CURSOR_PROMPT.md)** - Ready-to-use Cursor prompt for integrating the library
131
+ Import the CSS file in your entry point (e.g., `src/main.tsx`):
92
132
 
93
- ### Advanced Topics
94
- - **[TOKEN_EXTENSION.md](./TOKEN_EXTENSION.md)** - Extending themes with custom token files
95
- - **[COMPONENT_DEPENDENCIES.md](./COMPONENT_DEPENDENCIES.md)** - Complete dependencies reference
133
+ ```tsx
134
+ import './index.css'
135
+ ```
96
136
 
97
- ### Contributing & Development
98
- - **[CONTRIBUTING.md](./CONTRIBUTING.md)** - Contribution guidelines and development workflow
99
- - **[apps/design-system/ARCHITECTURE.md](./apps/design-system/ARCHITECTURE.md)** - Architecture overview
100
- - **[apps/design-system/src/design-system/components/README.md](./apps/design-system/src/design-system/components/README.md)** - Adding components
101
- - **[apps/design-system/src/design-system/themes/README.md](./apps/design-system/src/design-system/themes/README.md)** - Theme system internals
137
+ ## Usage
102
138
 
103
- ## Contributing
139
+ ```tsx
140
+ import { Button, Badge, Modal, Select } from 'shru-design-system'
104
141
 
105
- ### Getting Started
142
+ function App() {
143
+ return (
144
+ <div>
145
+ <Button variant="default">Click me</Button>
146
+ <Badge>New</Badge>
147
+
148
+ <Modal>
149
+ <ModalTrigger asChild>
150
+ <Button>Open Modal</Button>
151
+ </ModalTrigger>
152
+ <ModalContent>
153
+ <ModalHeader>
154
+ <ModalTitle>Hello</ModalTitle>
155
+ <ModalDescription>This is a modal</ModalDescription>
156
+ </ModalHeader>
157
+ </ModalContent>
158
+ </Modal>
159
+ </div>
160
+ )
161
+ }
162
+ ```
106
163
 
107
- 1. **Clone and install:**
108
- ```bash
109
- git clone <repo-url>
110
- npm install
111
- ```
164
+ ## Components
112
165
 
113
- 2. **Run the showcase:**
114
- ```bash
115
- npm run dev
116
- ```
166
+ ### Atoms
167
+ - **Button** - Versatile button with multiple variants and sizes
168
+ - **Badge** - Small status indicators
117
169
 
118
- 3. **Make changes:**
119
- - **Adding a component**: See [Component System Docs](./apps/design-system/src/design-system/components/README.md#how-to-add-a-component)
120
- - **Adding a theme**: See [Theme System Docs](./apps/design-system/src/design-system/themes/README.md#how-to-add-a-new-theme)
121
- - **Library changes**: Edit `src/`, then run `npm run build:lib`
170
+ ### Molecules
171
+ - **Modal** - Dialog component with overlay
172
+ - **Select** - Dropdown select component
122
173
 
123
- ### Development Workflow
174
+ ## Peer Dependencies
124
175
 
125
- 1. Make changes in appropriate module (`components/`, `themes/`, etc.)
126
- 2. Test in the showcase app (`npm run dev`)
127
- 3. If changing library code (`src/`), rebuild: `npm run build:lib`
176
+ Make sure to install these peer dependencies:
177
+
178
+ ```bash
179
+ npm install @radix-ui/react-slot @radix-ui/react-dialog @radix-ui/react-select class-variance-authority clsx tailwind-merge lucide-react
180
+ ```
128
181
 
129
182
  ## License
130
183
 
@@ -0,0 +1,55 @@
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import * as React from 'react';
3
+ import { VariantProps } from 'class-variance-authority';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
6
+ import * as SelectPrimitive from '@radix-ui/react-select';
7
+
8
+ declare const buttonVariants: (props?: ({
9
+ readonly variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
10
+ readonly size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
11
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
12
+ declare const Button: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<(props?: ({
13
+ readonly variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
14
+ readonly size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
15
+ } & class_variance_authority_types.ClassProp) | undefined) => string> & {
16
+ asChild?: boolean;
17
+ }, "ref"> & React.RefAttributes<HTMLButtonElement>>;
18
+
19
+ declare const badgeVariants: (props?: ({
20
+ readonly variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
21
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
22
+ declare const Badge: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLSpanElement> & React.HTMLAttributes<HTMLSpanElement> & VariantProps<(props?: ({
23
+ readonly variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
24
+ } & class_variance_authority_types.ClassProp) | undefined) => string> & {
25
+ asChild?: boolean;
26
+ }, "ref"> & React.RefAttributes<HTMLSpanElement>>;
27
+
28
+ declare function Modal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): react_jsx_runtime.JSX.Element;
29
+ declare function ModalTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
30
+ declare function ModalPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): react_jsx_runtime.JSX.Element;
31
+ declare function ModalClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): react_jsx_runtime.JSX.Element;
32
+ declare function ModalOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): react_jsx_runtime.JSX.Element;
33
+ declare function ModalContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
34
+ showCloseButton?: boolean;
35
+ }): react_jsx_runtime.JSX.Element;
36
+ declare function ModalHeader({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
37
+ declare function ModalFooter({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
38
+ declare function ModalTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): react_jsx_runtime.JSX.Element;
39
+ declare function ModalDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): react_jsx_runtime.JSX.Element;
40
+
41
+ declare function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): react_jsx_runtime.JSX.Element;
42
+ declare function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): react_jsx_runtime.JSX.Element;
43
+ declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): react_jsx_runtime.JSX.Element;
44
+ declare const selectTriggerSizes: readonly ["sm", "default"];
45
+ declare function SelectTrigger({ className, size, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
46
+ size?: typeof selectTriggerSizes[number];
47
+ }): react_jsx_runtime.JSX.Element;
48
+ declare function SelectContent({ className, children, position, align, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): react_jsx_runtime.JSX.Element;
49
+ declare function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>): react_jsx_runtime.JSX.Element;
50
+ declare function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>): react_jsx_runtime.JSX.Element;
51
+ declare function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>): react_jsx_runtime.JSX.Element;
52
+ declare function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>): react_jsx_runtime.JSX.Element;
53
+ declare function SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>): react_jsx_runtime.JSX.Element;
54
+
55
+ export { Badge, Button, Modal, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, badgeVariants, buttonVariants };