shadcn-glass-ui 1.0.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/CHANGELOG.md +227 -0
- package/LICENSE +201 -0
- package/README.md +693 -0
- package/dist/components.cjs +59 -0
- package/dist/components.d.ts +1413 -0
- package/dist/components.js +5 -0
- package/dist/hooks.cjs +6 -0
- package/dist/hooks.d.ts +225 -0
- package/dist/hooks.js +3 -0
- package/dist/index.cjs +138 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1761 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/shadcn-glass-ui.css +3 -0
- package/dist/theme-context-BZoCplcU.js +66 -0
- package/dist/theme-context-BZoCplcU.js.map +1 -0
- package/dist/theme-context-DrLak65e.cjs +102 -0
- package/dist/theme-context-DrLak65e.cjs.map +1 -0
- package/dist/themes.cjs +7 -0
- package/dist/themes.d.ts +36 -0
- package/dist/themes.js +2 -0
- package/dist/trust-score-card-glass-DqaCKo1w.cjs +8225 -0
- package/dist/trust-score-card-glass-DqaCKo1w.cjs.map +1 -0
- package/dist/trust-score-card-glass-tJnNNzeS.js +7789 -0
- package/dist/trust-score-card-glass-tJnNNzeS.js.map +1 -0
- package/dist/use-focus-6xqfE5s6.cjs +130 -0
- package/dist/use-focus-6xqfE5s6.cjs.map +1 -0
- package/dist/use-focus-CX0TJJIj.js +118 -0
- package/dist/use-focus-CX0TJJIj.js.map +1 -0
- package/dist/use-wallpaper-tint-D1f3UGGs.cjs +162 -0
- package/dist/use-wallpaper-tint-D1f3UGGs.cjs.map +1 -0
- package/dist/use-wallpaper-tint-DUgmytlY.js +150 -0
- package/dist/use-wallpaper-tint-DUgmytlY.js.map +1 -0
- package/dist/utils-BNzkwPwE.cjs +14 -0
- package/dist/utils-BNzkwPwE.cjs.map +1 -0
- package/dist/utils-CGCOTvxT.js +8 -0
- package/dist/utils-CGCOTvxT.js.map +1 -0
- package/dist/utils.cjs +2 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +2 -0
- package/dist/vite.svg +1 -0
- package/package.json +196 -0
package/README.md
ADDED
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
# shadcn-glass-ui
|
|
2
|
+
|
|
3
|
+
> Modern glassmorphism UI component library for React with full shadcn/ui compatibility
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/shadcn-glass-ui)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://www.typescriptlang.org/)
|
|
8
|
+
[](https://github.com/yourusername/shadcn-glass-ui)
|
|
9
|
+
|
|
10
|
+
## โจ Highlights
|
|
11
|
+
|
|
12
|
+
- ๐จ **48 Components** - Core UI (16) + Atomic (4) + Composites (5) + Sections (6) + Blocks (6) + New (11)
|
|
13
|
+
- ๐ **3 Themes** - Glass (dark glassmorphism), Light (clean minimal), Aurora (gradient glow)
|
|
14
|
+
- ๐ฎ **Advanced Patterns** - asChild polymorphic rendering, Compound components (Modal, Tabs)
|
|
15
|
+
- โฟ **WCAG 2.1 AA** - Full accessibility compliance with automated testing
|
|
16
|
+
- ๐ฑ **Touch Optimized** - 44ร44px minimum touch targets (Apple HIG)
|
|
17
|
+
- โก **Modern Stack** - React 19, Tailwind v4, Vitest 4, Storybook 10, Vite 7
|
|
18
|
+
- ๐งช **704 Tests** - 125 unit tests + 579 visual regression (99.5% passing)
|
|
19
|
+
- ๐ฆ **shadcn Compatible** - Works seamlessly with existing shadcn/ui projects
|
|
20
|
+
- ๐ฏ **Design System** - Comprehensive [UI_DESIGN.md](docs/design-system/UI_DESIGN.md) specifications
|
|
21
|
+
- ๐ฆ **Bundle Size** - ~110KB gzipped (production build)
|
|
22
|
+
|
|
23
|
+
## Tech Stack
|
|
24
|
+
|
|
25
|
+
- **React 19.2** - Server Components, React Compiler, automatic batching
|
|
26
|
+
- **TypeScript 5.9** - Strict type checking
|
|
27
|
+
- **Tailwind CSS 4.1** - CSS-first configuration with CSS variables
|
|
28
|
+
- **Vite 7** (rolldown-vite) - Rust-powered bundler
|
|
29
|
+
- **Storybook 10.1** - Component workshop with ESM-only architecture
|
|
30
|
+
- **Vitest 4.0** - Browser mode testing with visual regression
|
|
31
|
+
|
|
32
|
+
See [DEPENDENCIES.md](DEPENDENCIES.md) for detailed dependency documentation.
|
|
33
|
+
|
|
34
|
+
## ๐ Quick Start
|
|
35
|
+
|
|
36
|
+
### Installation
|
|
37
|
+
|
|
38
|
+
#### Option 1: shadcn CLI (Recommended)
|
|
39
|
+
|
|
40
|
+
Add individual components to your existing shadcn/ui project:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx shadcn@latest add @shadcn-glass-ui/button
|
|
44
|
+
npx shadcn@latest add @shadcn-glass-ui/input
|
|
45
|
+
npx shadcn@latest add @shadcn-glass-ui/modal
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### Option 2: NPM Package
|
|
49
|
+
|
|
50
|
+
Install the entire library:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install shadcn-glass-ui
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### Option 3: Manual Copy
|
|
57
|
+
|
|
58
|
+
Copy component files directly from the repository:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Clone the repository
|
|
62
|
+
git clone https://github.com/yourusername/shadcn-glass-ui.git
|
|
63
|
+
|
|
64
|
+
# Copy components
|
|
65
|
+
cp shadcn-glass-ui/src/components/glass/ui/button-glass.tsx your-project/components/ui/
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Basic Usage
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { ButtonGlass, InputGlass, AlertGlass } from 'shadcn-glass-ui';
|
|
72
|
+
|
|
73
|
+
export default function App() {
|
|
74
|
+
return (
|
|
75
|
+
<div className="theme-glass min-h-screen p-8">
|
|
76
|
+
<ButtonGlass variant="primary">Click me</ButtonGlass>
|
|
77
|
+
<ButtonGlass variant="destructive">Delete</ButtonGlass>
|
|
78
|
+
<InputGlass placeholder="Enter text..." />
|
|
79
|
+
<AlertGlass variant="default" title="Welcome">
|
|
80
|
+
Getting started with shadcn-glass-ui
|
|
81
|
+
</AlertGlass>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Theme Setup
|
|
88
|
+
|
|
89
|
+
Add CSS variables to your `globals.css`:
|
|
90
|
+
|
|
91
|
+
```css
|
|
92
|
+
@import 'shadcn-glass-ui/dist/styles.css';
|
|
93
|
+
|
|
94
|
+
/* Or define variables manually */
|
|
95
|
+
:root {
|
|
96
|
+
--blur-sm: 8px;
|
|
97
|
+
--blur-md: 16px;
|
|
98
|
+
--blur-lg: 24px;
|
|
99
|
+
--blur-xl: 32px;
|
|
100
|
+
--card-medium-bg: rgba(255, 255, 255, 0.15);
|
|
101
|
+
--card-medium-border: rgba(255, 255, 255, 0.15);
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Apply theme class to your app:
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
// Glass theme (dark glassmorphism)
|
|
109
|
+
<div className="theme-glass">
|
|
110
|
+
<App />
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
// Light theme
|
|
114
|
+
<div className="theme-light">
|
|
115
|
+
<App />
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
// Aurora theme (gradient)
|
|
119
|
+
<div className="theme-aurora">
|
|
120
|
+
<App />
|
|
121
|
+
</div>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## ๐ Advanced Features (Phase 3)
|
|
125
|
+
|
|
126
|
+
### asChild Pattern
|
|
127
|
+
|
|
128
|
+
Polymorphic rendering with Radix UI Slot - render components as any element:
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
import { ButtonGlass } from 'shadcn-glass-ui';
|
|
132
|
+
import { Link } from 'react-router-dom';
|
|
133
|
+
|
|
134
|
+
// Render button as Link
|
|
135
|
+
<ButtonGlass asChild>
|
|
136
|
+
<Link to="/profile">View Profile</Link>
|
|
137
|
+
</ButtonGlass>
|
|
138
|
+
|
|
139
|
+
// Render button as anchor
|
|
140
|
+
<ButtonGlass asChild variant="primary">
|
|
141
|
+
<a href="https://example.com" target="_blank">
|
|
142
|
+
External Link
|
|
143
|
+
</a>
|
|
144
|
+
</ButtonGlass>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Supported components:** `ButtonGlass`, `AvatarGlass`, `GlassCard`
|
|
148
|
+
|
|
149
|
+
### Compound Components
|
|
150
|
+
|
|
151
|
+
Fine-grained composition for complex components:
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
import { ModalGlass, TabsGlass } from 'shadcn-glass-ui';
|
|
155
|
+
|
|
156
|
+
// ModalGlass Compound API
|
|
157
|
+
<ModalGlass.Root open={open} onOpenChange={setOpen}>
|
|
158
|
+
<ModalGlass.Overlay />
|
|
159
|
+
<ModalGlass.Content>
|
|
160
|
+
<ModalGlass.Header>
|
|
161
|
+
<ModalGlass.Title>Confirm Action</ModalGlass.Title>
|
|
162
|
+
<ModalGlass.Description>
|
|
163
|
+
This action cannot be undone
|
|
164
|
+
</ModalGlass.Description>
|
|
165
|
+
<ModalGlass.Close />
|
|
166
|
+
</ModalGlass.Header>
|
|
167
|
+
<ModalGlass.Body>
|
|
168
|
+
<p>Content here...</p>
|
|
169
|
+
</ModalGlass.Body>
|
|
170
|
+
<ModalGlass.Footer>
|
|
171
|
+
<ButtonGlass onClick={() => setOpen(false)}>Cancel</ButtonGlass>
|
|
172
|
+
<ButtonGlass variant="primary">Confirm</ButtonGlass>
|
|
173
|
+
</ModalGlass.Footer>
|
|
174
|
+
</ModalGlass.Content>
|
|
175
|
+
</ModalGlass.Root>
|
|
176
|
+
|
|
177
|
+
// TabsGlass Compound API
|
|
178
|
+
<TabsGlass.Root value={activeTab} onValueChange={setActiveTab}>
|
|
179
|
+
<TabsGlass.List>
|
|
180
|
+
<TabsGlass.Trigger value="tab1">Overview</TabsGlass.Trigger>
|
|
181
|
+
<TabsGlass.Trigger value="tab2">Analytics</TabsGlass.Trigger>
|
|
182
|
+
</TabsGlass.List>
|
|
183
|
+
<TabsGlass.Content value="tab1">
|
|
184
|
+
<p>Overview content</p>
|
|
185
|
+
</TabsGlass.Content>
|
|
186
|
+
<TabsGlass.Content value="tab2">
|
|
187
|
+
<p>Analytics content</p>
|
|
188
|
+
</TabsGlass.Content>
|
|
189
|
+
</TabsGlass.Root>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## โ ๏ธ Breaking Changes (v1.0.0)
|
|
193
|
+
|
|
194
|
+
**v1.0.0 removes all legacy/deprecated APIs.** This is a clean slate release with only Compound API support.
|
|
195
|
+
|
|
196
|
+
### Removed Components
|
|
197
|
+
|
|
198
|
+
#### SelectGlass (Removed in v1.0.0)
|
|
199
|
+
|
|
200
|
+
**SelectGlass has been removed.** Use **ComboBoxGlass** instead.
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
// โ Removed in v1.0.0
|
|
204
|
+
<SelectGlass
|
|
205
|
+
options={options}
|
|
206
|
+
value={value}
|
|
207
|
+
onChange={setValue}
|
|
208
|
+
placeholder="Select option"
|
|
209
|
+
/>
|
|
210
|
+
|
|
211
|
+
// โ
Use ComboBoxGlass
|
|
212
|
+
<ComboBoxGlass
|
|
213
|
+
options={options}
|
|
214
|
+
value={value}
|
|
215
|
+
onChange={setValue}
|
|
216
|
+
placeholder="Select option"
|
|
217
|
+
/>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Removed Legacy APIs
|
|
221
|
+
|
|
222
|
+
#### ModalGlass: Legacy Props API Removed
|
|
223
|
+
|
|
224
|
+
**The old props-based API has been removed.** Use Compound API instead.
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
// โ Removed in v1.0.0
|
|
228
|
+
<ModalGlass isOpen={true} onClose={() => {}} title="Test">
|
|
229
|
+
Content
|
|
230
|
+
</ModalGlass>
|
|
231
|
+
|
|
232
|
+
// โ
Use Compound API
|
|
233
|
+
<ModalGlass.Root open={true} onOpenChange={() => {}}>
|
|
234
|
+
<ModalGlass.Overlay />
|
|
235
|
+
<ModalGlass.Content>
|
|
236
|
+
<ModalGlass.Header>
|
|
237
|
+
<ModalGlass.Title>Test</ModalGlass.Title>
|
|
238
|
+
<ModalGlass.Close />
|
|
239
|
+
</ModalGlass.Header>
|
|
240
|
+
<ModalGlass.Body>Content</ModalGlass.Body>
|
|
241
|
+
</ModalGlass.Content>
|
|
242
|
+
</ModalGlass.Root>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Key Changes:**
|
|
246
|
+
- `isOpen` โ `open` (on ModalGlass.Root)
|
|
247
|
+
- `onClose` โ `onOpenChange` (callback signature changed from `() => void` to `(open: boolean) => void`)
|
|
248
|
+
- `title` prop removed โ use `<ModalGlass.Title>` component
|
|
249
|
+
- Manual structure required (Overlay, Content, Header, Body, Footer)
|
|
250
|
+
|
|
251
|
+
#### TabsGlass: Legacy Props API Removed
|
|
252
|
+
|
|
253
|
+
**The old props-based API has been removed.** Use Compound API instead.
|
|
254
|
+
|
|
255
|
+
```tsx
|
|
256
|
+
// โ Removed in v1.0.0
|
|
257
|
+
<TabsGlass
|
|
258
|
+
tabs={[
|
|
259
|
+
{ id: 'tab1', label: 'Tab 1' },
|
|
260
|
+
{ id: 'tab2', label: 'Tab 2' }
|
|
261
|
+
]}
|
|
262
|
+
activeTab="tab1"
|
|
263
|
+
onChange={setActiveTab}
|
|
264
|
+
/>
|
|
265
|
+
|
|
266
|
+
// โ
Use Compound API
|
|
267
|
+
<TabsGlass.Root value="tab1" onValueChange={setActiveTab}>
|
|
268
|
+
<TabsGlass.List>
|
|
269
|
+
<TabsGlass.Trigger value="tab1">Tab 1</TabsGlass.Trigger>
|
|
270
|
+
<TabsGlass.Trigger value="tab2">Tab 2</TabsGlass.Trigger>
|
|
271
|
+
</TabsGlass.List>
|
|
272
|
+
<TabsGlass.Content value="tab1">Content 1</TabsGlass.Content>
|
|
273
|
+
<TabsGlass.Content value="tab2">Content 2</TabsGlass.Content>
|
|
274
|
+
</TabsGlass.Root>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Key Changes:**
|
|
278
|
+
- `tabs` array prop removed โ use individual `<TabsGlass.Trigger>` components
|
|
279
|
+
- `activeTab` โ `value` (on TabsGlass.Root)
|
|
280
|
+
- `onChange` โ `onValueChange`
|
|
281
|
+
- Content must be explicitly defined with `<TabsGlass.Content>` for each tab
|
|
282
|
+
|
|
283
|
+
### Migration Guides
|
|
284
|
+
|
|
285
|
+
Detailed migration guides are available in the [docs/migration/](docs/migration/) directory:
|
|
286
|
+
|
|
287
|
+
- **[ModalGlass Compound API](docs/migration/modal-glass-compound-api.md)** - Legacy โ Compound API
|
|
288
|
+
- **[TabsGlass Compound API](docs/migration/tabs-glass-compound-api.md)** - Legacy โ Compound API
|
|
289
|
+
|
|
290
|
+
### Changelog
|
|
291
|
+
|
|
292
|
+
See [CHANGELOG.md](CHANGELOG.md) for complete version history and breaking changes.
|
|
293
|
+
|
|
294
|
+
## ๐ Documentation
|
|
295
|
+
|
|
296
|
+
- **[Getting Started Guide](docs/GETTING_STARTED.md)** - Comprehensive setup tutorial
|
|
297
|
+
- **[AI Usage Guide](docs/AI_USAGE.md)** - Using library with AI assistants (Copilot, Claude, GPT)
|
|
298
|
+
- **[Publishing Guide](docs/PUBLISHING.md)** - Build and publish with TypeScript declarations
|
|
299
|
+
- **[Storybook](https://yourusername.github.io/shadcn-glass-ui/)** - Live component demos
|
|
300
|
+
- **[UI Design System](docs/design-system/UI_DESIGN.md)** - Complete design specifications
|
|
301
|
+
- **[Visual Testing Guide](docs/visual-testing-guide.md)** - Screenshot update workflow
|
|
302
|
+
- **[Migration Guide](MIGRATION_GUIDE.md)** - Upgrading from v1
|
|
303
|
+
- **[Breaking Changes](BREAKING_CHANGES.md)** - API changes log
|
|
304
|
+
- **[Dependencies](DEPENDENCIES.md)** - Detailed dependency docs
|
|
305
|
+
- **[Contributing](CONTRIBUTING.md)** - Development guidelines
|
|
306
|
+
|
|
307
|
+
## ๐ฏ Component Categories
|
|
308
|
+
|
|
309
|
+
### Level 1: Core UI (17 components)
|
|
310
|
+
|
|
311
|
+
Essential building blocks for any application:
|
|
312
|
+
|
|
313
|
+
- **Buttons & Actions**: ButtonGlass, IconButtonGlass
|
|
314
|
+
- **Inputs**: InputGlass, CheckboxGlass, ToggleGlass, SliderGlass, ComboBoxGlass
|
|
315
|
+
- **Containers**: GlassCard, ModalGlass
|
|
316
|
+
- **Navigation**: TabsGlass, DropdownGlass
|
|
317
|
+
- **Feedback**: BadgeGlass, AlertGlass, NotificationGlass, TooltipGlass, SkeletonGlass,
|
|
318
|
+
ProgressGlass, CircularProgressGlass
|
|
319
|
+
- **Media**: AvatarGlass
|
|
320
|
+
|
|
321
|
+
[View all Core UI components โ](src/components/glass/ui/)
|
|
322
|
+
|
|
323
|
+
### Level 2: Atomic (9 components)
|
|
324
|
+
|
|
325
|
+
Small, specialized components for specific use cases:
|
|
326
|
+
|
|
327
|
+
- **StatusIndicatorGlass** - Status dots with glow effect
|
|
328
|
+
- **SegmentedControlGlass** - Segmented button group
|
|
329
|
+
- **RainbowProgressGlass** - Rainbow gradient progress bar
|
|
330
|
+
- **LanguageBarGlass** - Language proficiency bar with legend
|
|
331
|
+
- **StatItemGlass** - Individual stat display
|
|
332
|
+
- **SearchBoxGlass** - Search input with icon
|
|
333
|
+
- **ThemeToggleGlass** - Theme switcher button
|
|
334
|
+
- **ExpandableHeaderGlass** - Collapsible header section
|
|
335
|
+
- **SortDropdownGlass** - Sorting dropdown menu
|
|
336
|
+
|
|
337
|
+
[View all Atomic components โ](src/components/glass/atomic/)
|
|
338
|
+
|
|
339
|
+
### Level 3: Composite (13 components)
|
|
340
|
+
|
|
341
|
+
Pre-built complex components combining multiple elements:
|
|
342
|
+
|
|
343
|
+
- **MetricCardGlass** - Metric display card with progress indicator
|
|
344
|
+
- **YearCardGlass** - Year card for career timeline
|
|
345
|
+
- **AICardGlass** - AI summary card with feature list
|
|
346
|
+
- **RepositoryCardGlass** - Repository card with expandable details
|
|
347
|
+
- **TrustScoreDisplayGlass** - Trust score with visual indicator
|
|
348
|
+
- **ProfileAvatarGlass** - Large avatar with glow animation
|
|
349
|
+
- **FlagAlertGlass** - Warning/danger flag alert with icon
|
|
350
|
+
- **UserStatsLineGlass** - User statistics horizontal display
|
|
351
|
+
- **ProjectCardGlass** - Project card with status and metadata
|
|
352
|
+
- **TeamMemberCardGlass** - Team member profile card
|
|
353
|
+
- **NotificationCardGlass** - Notification card with actions
|
|
354
|
+
- **TimelineItemGlass** - Timeline entry with connector
|
|
355
|
+
- **PricingCardGlass** - Pricing tier card with features
|
|
356
|
+
|
|
357
|
+
[View all Composite components โ](src/components/glass/composite/)
|
|
358
|
+
|
|
359
|
+
### Level 4: Sections (7 components)
|
|
360
|
+
|
|
361
|
+
Full-page sections ready to use in your application:
|
|
362
|
+
|
|
363
|
+
- **HeaderNavGlass** - Navigation header with search and theme toggle
|
|
364
|
+
- **ProfileHeaderGlass** - User profile header with avatar, stats, and languages
|
|
365
|
+
- **CareerStatsGlass** - Career statistics with expandable year cards
|
|
366
|
+
- **FlagsSectionGlass** - Expandable flags/warnings section
|
|
367
|
+
- **TrustScoreCardGlass** - Trust score display with detailed metrics
|
|
368
|
+
- **ProjectsListGlass** - Projects list with filtering and sorting
|
|
369
|
+
- **HeaderBrandingGlass** - Branded header with logo and navigation
|
|
370
|
+
|
|
371
|
+
[View all Section components โ](src/components/glass/sections/)
|
|
372
|
+
|
|
373
|
+
### Blocks (6 ready-to-use sections)
|
|
374
|
+
|
|
375
|
+
Complete component showcases following shadcn/ui pattern:
|
|
376
|
+
|
|
377
|
+
- **ButtonsBlock** - All button variants, sizes, states
|
|
378
|
+
- **FormElementsBlock** - Input, Slider, Toggle, Checkbox demos
|
|
379
|
+
- **ProgressBlock** - Progress bars, RainbowProgress, Skeletons
|
|
380
|
+
- **AvatarGalleryBlock** - Avatar sizes and status indicators
|
|
381
|
+
- **BadgesBlock** - Badge variants with tooltips
|
|
382
|
+
- **NotificationsBlock** - Notifications and alerts
|
|
383
|
+
|
|
384
|
+
[View all Blocks โ](src/components/blocks/)
|
|
385
|
+
|
|
386
|
+
### Demo Pages (2 full applications)
|
|
387
|
+
|
|
388
|
+
Complete application examples:
|
|
389
|
+
|
|
390
|
+
- **ComponentShowcase** - Interactive demo of all 57 core components
|
|
391
|
+
- **DesktopShowcase** - GitHub Analytics desktop application mockup with glassmorphism design
|
|
392
|
+
|
|
393
|
+
[Try live demos โ](https://yourusername.github.io/shadcn-glass-ui/)
|
|
394
|
+
|
|
395
|
+
## ๐จ Themes
|
|
396
|
+
|
|
397
|
+
shadcn-glass-ui provides three built-in themes:
|
|
398
|
+
|
|
399
|
+
### ๐ Glass Theme (Dark Glassmorphism)
|
|
400
|
+
|
|
401
|
+
Default dark theme with frosted glass effects:
|
|
402
|
+
|
|
403
|
+
```tsx
|
|
404
|
+
<div className="theme-glass">
|
|
405
|
+
<ButtonGlass>Glassmorphic Button</ButtonGlass>
|
|
406
|
+
</div>
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**Features:**
|
|
410
|
+
|
|
411
|
+
- Backdrop blur: 16px (md)
|
|
412
|
+
- Dark background with glass overlays
|
|
413
|
+
- Purple gradient accents
|
|
414
|
+
- Glow effects on hover/focus
|
|
415
|
+
|
|
416
|
+
### โ๏ธ Light Theme
|
|
417
|
+
|
|
418
|
+
Clean, minimal light theme:
|
|
419
|
+
|
|
420
|
+
```tsx
|
|
421
|
+
<div className="theme-light">
|
|
422
|
+
<ButtonGlass>Light Theme Button</ButtonGlass>
|
|
423
|
+
</div>
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
**Features:**
|
|
427
|
+
|
|
428
|
+
- Subtle shadows instead of blur
|
|
429
|
+
- White/gray color palette
|
|
430
|
+
- Reduced opacity overlays
|
|
431
|
+
- Crisp, modern aesthetic
|
|
432
|
+
|
|
433
|
+
### ๐ Aurora Theme (Gradient)
|
|
434
|
+
|
|
435
|
+
Vibrant gradient theme with glow effects:
|
|
436
|
+
|
|
437
|
+
```tsx
|
|
438
|
+
<div className="theme-aurora">
|
|
439
|
+
<ButtonGlass>Aurora Gradient Button</ButtonGlass>
|
|
440
|
+
</div>
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**Features:**
|
|
444
|
+
|
|
445
|
+
- Multi-color gradients
|
|
446
|
+
- Enhanced glow effects
|
|
447
|
+
- Dynamic backgrounds
|
|
448
|
+
- Eye-catching visuals
|
|
449
|
+
|
|
450
|
+
### Theme Switching
|
|
451
|
+
|
|
452
|
+
```tsx
|
|
453
|
+
import { useState } from 'react';
|
|
454
|
+
import { ThemeProvider, useTheme } from '@/lib/theme-context';
|
|
455
|
+
|
|
456
|
+
function App() {
|
|
457
|
+
return (
|
|
458
|
+
<ThemeProvider defaultTheme="glass">
|
|
459
|
+
<YourApp />
|
|
460
|
+
</ThemeProvider>
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
function ThemeSwitcher() {
|
|
465
|
+
const { theme, setTheme } = useTheme();
|
|
466
|
+
|
|
467
|
+
return (
|
|
468
|
+
<select value={theme} onChange={(e) => setTheme(e.target.value)}>
|
|
469
|
+
<option value="glass">Glass (Dark)</option>
|
|
470
|
+
<option value="light">Light</option>
|
|
471
|
+
<option value="aurora">Aurora</option>
|
|
472
|
+
</select>
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
## ๐ฎ Glass Effect Variants
|
|
478
|
+
|
|
479
|
+
Each GlassCard supports 4 glass effect variants:
|
|
480
|
+
|
|
481
|
+
```tsx
|
|
482
|
+
// Standard glassmorphism (16px blur)
|
|
483
|
+
<GlassCard variant="glass">Standard Glass</GlassCard>
|
|
484
|
+
|
|
485
|
+
// Heavy frosted effect (32px blur)
|
|
486
|
+
<GlassCard variant="frosted">Frosted Glass</GlassCard>
|
|
487
|
+
|
|
488
|
+
// Vertical streaks effect
|
|
489
|
+
<GlassCard variant="fluted">Fluted Glass</GlassCard>
|
|
490
|
+
|
|
491
|
+
// Diamond-cut reflections
|
|
492
|
+
<GlassCard variant="crystal">Crystal Glass</GlassCard>
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
## โฟ Accessibility
|
|
496
|
+
|
|
497
|
+
All components are WCAG 2.1 AA compliant:
|
|
498
|
+
|
|
499
|
+
- โ
**Keyboard Navigation** - Full Tab/Enter/Arrow key support
|
|
500
|
+
- โ
**Screen Readers** - Proper ARIA labels and roles
|
|
501
|
+
- โ
**Focus Indicators** - Visible focus rings (2px inner + 4px outer)
|
|
502
|
+
- โ
**Color Contrast** - Minimum 4.5:1 for text, 3:1 for UI
|
|
503
|
+
- โ
**Touch Targets** - 44ร44px minimum (Apple HIG)
|
|
504
|
+
- โ
**Reduced Motion** - Respects `prefers-reduced-motion`
|
|
505
|
+
|
|
506
|
+
### Automated Testing
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
npm run test:compliance # Design system compliance (647 tests)
|
|
510
|
+
npm run test:compliance:browser # Browser-based a11y tests
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
## ๐ Performance
|
|
514
|
+
|
|
515
|
+
Thanks to the modern stack:
|
|
516
|
+
|
|
517
|
+
### Build Performance
|
|
518
|
+
|
|
519
|
+
- **Production Builds**: 3-16x faster (Rolldown bundler)
|
|
520
|
+
- **Memory Usage**: 100x reduction vs Webpack/Rollup
|
|
521
|
+
- **Dev Server**: Near-instant start with Vite HMR
|
|
522
|
+
- **CSS Builds**: 100x faster incremental builds (Tailwind v4)
|
|
523
|
+
|
|
524
|
+
### Runtime Performance
|
|
525
|
+
|
|
526
|
+
- **Render Optimization**: 32% fewer renders (React 19 compiler)
|
|
527
|
+
- **Bundle Size**: Tree-shakeable ESM exports
|
|
528
|
+
- **Code Splitting**: Automatic route-based splitting
|
|
529
|
+
- **CSS Output**: Optimized purged CSS (~10KB gzipped)
|
|
530
|
+
|
|
531
|
+
### Performance Benchmarks
|
|
532
|
+
|
|
533
|
+
```bash
|
|
534
|
+
npm run benchmark # Run performance benchmarks
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
Example results:
|
|
538
|
+
|
|
539
|
+
- ButtonGlass initial render: < 1ms
|
|
540
|
+
- 100 component renders: < 50ms
|
|
541
|
+
- Theme switching: < 100ms
|
|
542
|
+
|
|
543
|
+
## ๐งช Testing
|
|
544
|
+
|
|
545
|
+
Comprehensive test coverage across multiple layers:
|
|
546
|
+
|
|
547
|
+
### Test Suites
|
|
548
|
+
|
|
549
|
+
```bash
|
|
550
|
+
# All tests (2,127 total)
|
|
551
|
+
npm test
|
|
552
|
+
|
|
553
|
+
# Design system compliance (647 tests)
|
|
554
|
+
npm run test:compliance:run # jsdom tests
|
|
555
|
+
npm run test:compliance:browser:run # browser tests
|
|
556
|
+
|
|
557
|
+
# Visual regression (1,480 screenshots)
|
|
558
|
+
npm run test:visual:ci # Run visual tests
|
|
559
|
+
npm run test:visual:update # Update baselines
|
|
560
|
+
|
|
561
|
+
# Unit tests (110 tests)
|
|
562
|
+
npm run test:unit
|
|
563
|
+
|
|
564
|
+
# Coverage report (90% target)
|
|
565
|
+
npm run test:coverage
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
### Test Categories
|
|
569
|
+
|
|
570
|
+
| Category | Tests | Coverage |
|
|
571
|
+
| ---------------------------- | --------- | ----------------- |
|
|
572
|
+
| **Design System Compliance** | 647 | 100% |
|
|
573
|
+
| **Visual Regression** | 1,480 | All components |
|
|
574
|
+
| **Unit Tests** | 110 | 13.87% (growing) |
|
|
575
|
+
| **Total** | **2,127** | **Comprehensive** |
|
|
576
|
+
|
|
577
|
+
## ๐ ๏ธ Development
|
|
578
|
+
|
|
579
|
+
### Prerequisites
|
|
580
|
+
|
|
581
|
+
- **Node.js**: 20.16+, 22.19+, or 24+
|
|
582
|
+
- **npm**: Latest stable version
|
|
583
|
+
|
|
584
|
+
### Setup
|
|
585
|
+
|
|
586
|
+
```bash
|
|
587
|
+
# Clone repository
|
|
588
|
+
git clone https://github.com/yourusername/shadcn-glass-ui.git
|
|
589
|
+
cd shadcn-glass-ui
|
|
590
|
+
|
|
591
|
+
# Install dependencies
|
|
592
|
+
npm install
|
|
593
|
+
|
|
594
|
+
# Start development
|
|
595
|
+
npm run dev # Vite dev server (port 5173)
|
|
596
|
+
npm run storybook # Storybook (port 6006)
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
### Build
|
|
600
|
+
|
|
601
|
+
```bash
|
|
602
|
+
npm run build # TypeScript check + Vite build
|
|
603
|
+
npm run build-storybook # Build static Storybook
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
### Linting
|
|
607
|
+
|
|
608
|
+
```bash
|
|
609
|
+
npm run lint # ESLint
|
|
610
|
+
npm run format # Prettier
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
## ๐ Project Structure
|
|
614
|
+
|
|
615
|
+
```
|
|
616
|
+
shadcn-glass-ui/
|
|
617
|
+
โโโ src/
|
|
618
|
+
โ โโโ components/
|
|
619
|
+
โ โ โโโ glass/
|
|
620
|
+
โ โ โ โโโ ui/ # Core UI components (17)
|
|
621
|
+
โ โ โ โโโ atomic/ # Atomic components (6)
|
|
622
|
+
โ โ โ โโโ composite/ # Composite components (13)
|
|
623
|
+
โ โ โ โโโ sections/ # Section components (7)
|
|
624
|
+
โ โ โโโ blocks/ # Ready-to-use blocks (6)
|
|
625
|
+
โ โ โโโ __visual__/ # Visual regression tests
|
|
626
|
+
โ โ โโโ ComponentShowcase.tsx
|
|
627
|
+
โ โ โโโ DesktopShowcase.tsx
|
|
628
|
+
โ โโโ lib/
|
|
629
|
+
โ โ โโโ utils.ts # cn() utility
|
|
630
|
+
โ โ โโโ theme-context.tsx # Theme provider
|
|
631
|
+
โ โ โโโ themeStyles.ts # Theme definitions
|
|
632
|
+
โ โ โโโ variants/ # CVA variants
|
|
633
|
+
โ โโโ styles/
|
|
634
|
+
โ โ โโโ tokens/ # Design tokens
|
|
635
|
+
โ โ โโโ themes/ # Theme CSS
|
|
636
|
+
โ โโโ test/
|
|
637
|
+
โ โโโ compliance/ # Compliance tests
|
|
638
|
+
โ โโโ utils/ # Test utilities
|
|
639
|
+
โโโ .storybook/ # Storybook config
|
|
640
|
+
โโโ docs/ # Documentation
|
|
641
|
+
โโโ docs/design-system/UI_DESIGN.md # Design system spec
|
|
642
|
+
โโโ package.json
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
## ๐ค Contributing
|
|
646
|
+
|
|
647
|
+
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
648
|
+
|
|
649
|
+
### Quick Contribution Guide
|
|
650
|
+
|
|
651
|
+
1. Fork the repository
|
|
652
|
+
2. Create a feature branch: `git checkout -b feat/amazing-component`
|
|
653
|
+
3. Make your changes following our code standards
|
|
654
|
+
4. Run tests: `npm run test:compliance:run`
|
|
655
|
+
5. Commit with conventional commits: `feat(ui): add DatePickerGlass component`
|
|
656
|
+
6. Push and create a Pull Request
|
|
657
|
+
|
|
658
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
|
|
659
|
+
|
|
660
|
+
## ๐ License
|
|
661
|
+
|
|
662
|
+
MIT ยฉ [Your Name]
|
|
663
|
+
|
|
664
|
+
This project is open source under the MIT license. See [LICENSE](LICENSE) for details.
|
|
665
|
+
|
|
666
|
+
## ๐ Credits
|
|
667
|
+
|
|
668
|
+
Built with amazing open source projects:
|
|
669
|
+
|
|
670
|
+
- [shadcn/ui](https://ui.shadcn.com/) - Design system foundation
|
|
671
|
+
- [Radix UI](https://www.radix-ui.com/) - Unstyled accessible primitives
|
|
672
|
+
- [Tailwind CSS](https://tailwindcss.com/) - Utility-first CSS framework
|
|
673
|
+
- [Vite](https://vitejs.dev/) - Next generation frontend tooling
|
|
674
|
+
- [Storybook](https://storybook.js.org/) - Component workshop
|
|
675
|
+
- [Vitest](https://vitest.dev/) - Blazing fast unit test framework
|
|
676
|
+
|
|
677
|
+
## ๐ Links
|
|
678
|
+
|
|
679
|
+
- **NPM Package**: [shadcn-glass-ui](https://www.npmjs.com/package/shadcn-glass-ui)
|
|
680
|
+
- **Documentation**: [Storybook](https://yourusername.github.io/shadcn-glass-ui/)
|
|
681
|
+
- **GitHub**: [shadcn-glass-ui](https://github.com/yourusername/shadcn-glass-ui)
|
|
682
|
+
- **Issues**: [Report a bug](https://github.com/yourusername/shadcn-glass-ui/issues)
|
|
683
|
+
- **Discussions**: [Community](https://github.com/yourusername/shadcn-glass-ui/discussions)
|
|
684
|
+
|
|
685
|
+
## โญ Star History
|
|
686
|
+
|
|
687
|
+
If you find this project useful, please consider giving it a star on GitHub!
|
|
688
|
+
|
|
689
|
+
[](https://star-history.com/#yourusername/shadcn-glass-ui&Date)
|
|
690
|
+
|
|
691
|
+
---
|
|
692
|
+
|
|
693
|
+
**Made with โค๏ธ and glassmorphism**
|