shru-design-system 0.0.9 → 0.1.0
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 +35 -107
- package/dist/index.d.mts +55 -0
- package/dist/index.d.ts +34 -1028
- package/dist/index.js +241 -7839
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +364 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +36 -79
- package/apps/design-system/styles/globals.css +0 -640
- package/dist/index.cjs +0 -8452
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -1049
- package/scripts/build-css.js +0 -231
- package/scripts/copy-globals.js +0 -106
- package/scripts/copy-tokens.js +0 -62
- package/src/tokens/base.json +0 -161
- package/src/tokens/palettes.json +0 -294
- package/src/tokens/themes/animation/brisk.json +0 -14
- package/src/tokens/themes/animation/gentle.json +0 -14
- package/src/tokens/themes/color/dark.json +0 -38
- package/src/tokens/themes/color/white.json +0 -38
- package/src/tokens/themes/custom/brand.json +0 -13
- package/src/tokens/themes/custom/minimal.json +0 -16
- package/src/tokens/themes/density/comfortable.json +0 -19
- package/src/tokens/themes/density/compact.json +0 -19
- package/src/tokens/themes/shape/sharp.json +0 -11
- package/src/tokens/themes/shape/smooth.json +0 -11
- package/src/tokens/themes/typography/sans.json +0 -25
- package/src/tokens/themes/typography/serif.json +0 -25
package/README.md
CHANGED
|
@@ -1,131 +1,59 @@
|
|
|
1
|
-
#
|
|
1
|
+
# shru-design-system
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A minimal React component library.
|
|
4
4
|
|
|
5
|
-
##
|
|
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
|
|
29
|
-
|
|
30
|
-
## Installation
|
|
5
|
+
## Setup
|
|
31
6
|
|
|
32
7
|
```bash
|
|
33
|
-
npm install
|
|
34
|
-
|
|
35
|
-
pnpm add shru-design-system
|
|
8
|
+
npm install
|
|
9
|
+
npm run build
|
|
36
10
|
```
|
|
37
11
|
|
|
38
|
-
##
|
|
39
|
-
|
|
40
|
-
```tsx
|
|
41
|
-
// 1. Import CSS (required)
|
|
42
|
-
import '@shru/design-system/styles'
|
|
43
|
-
|
|
44
|
-
// 2. Import component
|
|
45
|
-
import { ThemeToggle } from 'shru-design-system'
|
|
46
|
-
|
|
47
|
-
function App() {
|
|
48
|
-
return <ThemeToggle position="bottom-right" />
|
|
49
|
-
}
|
|
50
|
-
```
|
|
12
|
+
## Development
|
|
51
13
|
|
|
52
|
-
|
|
14
|
+
The package is built using `tsup` and outputs both ESM and CJS formats.
|
|
53
15
|
|
|
54
|
-
|
|
16
|
+
## Testing
|
|
55
17
|
|
|
56
|
-
|
|
18
|
+
A test app is available in the `test/` folder:
|
|
57
19
|
|
|
58
20
|
```bash
|
|
59
|
-
|
|
60
|
-
npm
|
|
61
|
-
# Generates: dist/index.js (ESM), dist/index.cjs (CJS), dist/index.d.ts (types)
|
|
62
|
-
|
|
63
|
-
# Run the showcase app
|
|
21
|
+
cd test
|
|
22
|
+
npm install
|
|
64
23
|
npm run dev
|
|
65
|
-
# Visit: http://localhost:3000/design-system
|
|
66
24
|
```
|
|
67
25
|
|
|
68
|
-
|
|
26
|
+
The test app installs the package locally using `file:..` and demonstrates the Button component.
|
|
27
|
+
|
|
28
|
+
## Package Structure
|
|
69
29
|
|
|
70
30
|
```
|
|
71
31
|
.
|
|
72
|
-
├──
|
|
73
|
-
│
|
|
74
|
-
│
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
|
32
|
+
├── src/
|
|
33
|
+
│ ├── Button.tsx # Button component
|
|
34
|
+
│ └── index.ts # Package exports
|
|
35
|
+
├── dist/ # Built output (ESM + CJS)
|
|
36
|
+
├── test/ # Test application
|
|
37
|
+
└── package.json # Package configuration
|
|
85
38
|
```
|
|
86
39
|
|
|
87
|
-
##
|
|
88
|
-
|
|
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
|
|
92
|
-
|
|
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
|
|
96
|
-
|
|
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
|
|
102
|
-
|
|
103
|
-
## Contributing
|
|
104
|
-
|
|
105
|
-
### Getting Started
|
|
40
|
+
## Usage
|
|
106
41
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
git clone <repo-url>
|
|
110
|
-
npm install
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
2. **Run the showcase:**
|
|
114
|
-
```bash
|
|
115
|
-
npm run dev
|
|
116
|
-
```
|
|
117
|
-
|
|
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`
|
|
42
|
+
```tsx
|
|
43
|
+
import { Button } from 'shru-design-system'
|
|
122
44
|
|
|
123
|
-
|
|
45
|
+
function App() {
|
|
46
|
+
return (
|
|
47
|
+
<Button variant="primary" size="md">
|
|
48
|
+
Click me
|
|
49
|
+
</Button>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
```
|
|
124
53
|
|
|
125
|
-
|
|
126
|
-
2. Test in the showcase app (`npm run dev`)
|
|
127
|
-
3. If changing library code (`src/`), rebuild: `npm run build:lib`
|
|
54
|
+
## Button Props
|
|
128
55
|
|
|
129
|
-
|
|
56
|
+
- `variant`: "primary" | "secondary" | "outline" (default: "primary")
|
|
57
|
+
- `size`: "sm" | "md" | "lg" (default: "md")
|
|
58
|
+
- All standard HTML button attributes are supported
|
|
130
59
|
|
|
131
|
-
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -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 };
|