shadcn-glass-ui 2.0.8 → 2.0.10
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 +153 -109
- package/dist/cli/index.cjs +1 -1
- package/dist/components.cjs +4 -4
- package/dist/components.d.ts +63 -322
- package/dist/components.js +2 -2
- package/dist/hooks.cjs +2 -2
- package/dist/index.cjs +43 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/r/alert-glass.json +2 -1
- package/dist/r/avatar-glass.json +2 -3
- package/dist/r/button-glass.json +1 -1
- package/dist/r/circular-progress-glass.json +1 -1
- package/dist/r/combobox-glass.json +1 -1
- package/dist/r/dropdown-glass.json +3 -5
- package/dist/r/dropdown-menu-glass.json +42 -0
- package/dist/r/language-bar-glass.json +2 -2
- package/dist/r/popover-glass.json +1 -1
- package/dist/r/profile-avatar-glass.json +5 -3
- package/dist/r/rainbow-progress-glass.json +1 -1
- package/dist/r/registry.json +10 -4
- package/dist/r/sort-dropdown-glass.json +3 -4
- package/dist/r/tooltip-glass.json +3 -5
- package/dist/r/trust-score-card-glass.json +1 -1
- package/dist/r/trust-score-display-glass.json +1 -1
- package/dist/shadcn-glass-ui.css +1 -1
- package/dist/{theme-context-CVW50BKW.cjs → theme-context-DNe_2vWJ.cjs} +2 -2
- package/dist/theme-context-DNe_2vWJ.cjs.map +1 -0
- package/dist/{theme-context-BZoCplcU.js → theme-context-_T5r1KG4.js} +1 -1
- package/dist/theme-context-_T5r1KG4.js.map +1 -0
- package/dist/themes.cjs +1 -1
- package/dist/themes.d.ts +89 -1
- package/dist/themes.js +1 -1
- package/dist/{trust-score-card-glass-BcZbul0P.js → trust-score-card-glass-A7kas5OS.js} +353 -279
- package/dist/trust-score-card-glass-A7kas5OS.js.map +1 -0
- package/dist/{trust-score-card-glass-r3qM09Jp.cjs → trust-score-card-glass-Dgu46oWI.cjs} +551 -313
- package/dist/trust-score-card-glass-Dgu46oWI.cjs.map +1 -0
- package/dist/{use-focus-ZE8ozmZE.cjs → use-focus-BRkQtQCj.cjs} +2 -2
- package/dist/{use-focus-ZE8ozmZE.cjs.map → use-focus-BRkQtQCj.cjs.map} +1 -1
- package/dist/{use-wallpaper-tint-BuS80tbN.cjs → use-wallpaper-tint-CfShPBo2.cjs} +2 -2
- package/dist/{use-wallpaper-tint-BuS80tbN.cjs.map → use-wallpaper-tint-CfShPBo2.cjs.map} +1 -1
- package/dist/{utils-DLXayspX.cjs → utils-BXN7AcRu.cjs} +2 -2
- package/dist/{utils-DLXayspX.cjs.map → utils-BXN7AcRu.cjs.map} +1 -1
- package/dist/utils.cjs +1 -1
- package/docs/AI_USAGE.md +1 -32
- package/docs/API_PATTERNS_COMPARISON.md +10 -9
- package/docs/COMPONENTS_CATALOG.md +140 -45
- package/docs/DROPDOWN_ARCHITECTURE.md +290 -0
- package/docs/GETTING_STARTED.md +6 -5
- package/docs/TOKEN_ARCHITECTURE.md +100 -0
- package/docs/api/README.md +3 -3
- package/docs/migration/compound-components-v2.md +384 -0
- package/docs/visual-testing-guide.md +50 -12
- package/package.json +2 -2
- package/dist/theme-context-BZoCplcU.js.map +0 -1
- package/dist/theme-context-CVW50BKW.cjs.map +0 -1
- package/dist/trust-score-card-glass-BcZbul0P.js.map +0 -1
- package/dist/trust-score-card-glass-r3qM09Jp.cjs.map +0 -1
- package/docs/ADVANCED_PATTERNS.md +0 -408
- package/docs/BREAKING_CHANGES.md +0 -213
- package/docs/announcements/v1.0.5-devto.md +0 -363
- package/docs/announcements/v1.0.5-reddit.md +0 -115
- package/docs/announcements/v1.0.5-twitter.md +0 -70
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
# Dropdown Components Architecture
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
All dropdown-style components in the Glass UI library follow the **shadcn/ui compound component
|
|
6
|
+
pattern**, built on **Radix UI primitives** and **shared styling utilities**.
|
|
7
|
+
|
|
8
|
+
## Architecture
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
12
|
+
│ Radix UI Primitives │
|
|
13
|
+
│ @radix-ui/react-dropdown-menu │
|
|
14
|
+
└──────────────────────────────┬──────────────────────────────────┘
|
|
15
|
+
│
|
|
16
|
+
▼
|
|
17
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
18
|
+
│ Shared Styling Utilities │
|
|
19
|
+
│ src/lib/variants/dropdown-content-styles.ts │
|
|
20
|
+
└──────────────────────────────┬──────────────────────────────────┘
|
|
21
|
+
│
|
|
22
|
+
▼
|
|
23
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
24
|
+
│ DropdownMenuGlass (Compound Components) │
|
|
25
|
+
│ src/components/glass/ui/dropdown-menu-glass.tsx │
|
|
26
|
+
│ │
|
|
27
|
+
│ Exports: │
|
|
28
|
+
│ • DropdownMenuGlass (Root) │
|
|
29
|
+
│ • DropdownMenuGlassTrigger │
|
|
30
|
+
│ • DropdownMenuGlassContent │
|
|
31
|
+
│ • DropdownMenuGlassItem │
|
|
32
|
+
│ • DropdownMenuGlassSeparator │
|
|
33
|
+
│ • DropdownMenuGlassLabel │
|
|
34
|
+
│ • DropdownMenuGlassCheckboxItem │
|
|
35
|
+
│ • DropdownMenuGlassRadioGroup / RadioItem │
|
|
36
|
+
│ • DropdownMenuGlassSub / SubTrigger / SubContent │
|
|
37
|
+
│ • DropdownMenuGlassShortcut │
|
|
38
|
+
└──────────────────────────────┬──────────────────────────────────┘
|
|
39
|
+
│
|
|
40
|
+
┌───────────────┼───────────────┐
|
|
41
|
+
▼ ▼ ▼
|
|
42
|
+
┌──────────┐ ┌──────────┐ ┌───────────────┐
|
|
43
|
+
│ Dropdown │ │ Sort │ │ ComboBox │
|
|
44
|
+
│ Glass │ │ Dropdown │ │ Glass │
|
|
45
|
+
│ (Simple) │ │ Glass │ │ (Searchable) │
|
|
46
|
+
└──────────┘ └──────────┘ └───────────────┘
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Component APIs
|
|
50
|
+
|
|
51
|
+
### 1. DropdownMenuGlass (Compound Components) - shadcn/ui Pattern
|
|
52
|
+
|
|
53
|
+
**Location:** `src/components/glass/ui/dropdown-menu-glass.tsx`
|
|
54
|
+
|
|
55
|
+
**Purpose:** Base compound components for building any dropdown menu
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import {
|
|
59
|
+
DropdownMenuGlass,
|
|
60
|
+
DropdownMenuGlassTrigger,
|
|
61
|
+
DropdownMenuGlassContent,
|
|
62
|
+
DropdownMenuGlassItem,
|
|
63
|
+
DropdownMenuGlassSeparator,
|
|
64
|
+
DropdownMenuGlassLabel,
|
|
65
|
+
} from '@/components/glass/ui/dropdown-menu-glass';
|
|
66
|
+
|
|
67
|
+
// Basic usage
|
|
68
|
+
<DropdownMenuGlass>
|
|
69
|
+
<DropdownMenuGlassTrigger asChild>
|
|
70
|
+
<Button>Open Menu</Button>
|
|
71
|
+
</DropdownMenuGlassTrigger>
|
|
72
|
+
<DropdownMenuGlassContent>
|
|
73
|
+
<DropdownMenuGlassLabel>Actions</DropdownMenuGlassLabel>
|
|
74
|
+
<DropdownMenuGlassItem onSelect={() => console.log('Edit')}>
|
|
75
|
+
<Edit className="mr-2 h-4 w-4" />
|
|
76
|
+
Edit
|
|
77
|
+
</DropdownMenuGlassItem>
|
|
78
|
+
<DropdownMenuGlassSeparator />
|
|
79
|
+
<DropdownMenuGlassItem variant="destructive">
|
|
80
|
+
<Trash className="mr-2 h-4 w-4" />
|
|
81
|
+
Delete
|
|
82
|
+
</DropdownMenuGlassItem>
|
|
83
|
+
</DropdownMenuGlassContent>
|
|
84
|
+
</DropdownMenuGlass>;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Available Components:**
|
|
88
|
+
|
|
89
|
+
| Component | Description |
|
|
90
|
+
| ------------------------------- | ------------------------------- |
|
|
91
|
+
| `DropdownMenuGlass` | Root component (manages state) |
|
|
92
|
+
| `DropdownMenuGlassTrigger` | Trigger element (use `asChild`) |
|
|
93
|
+
| `DropdownMenuGlassContent` | Dropdown content container |
|
|
94
|
+
| `DropdownMenuGlassItem` | Menu item with `variant` prop |
|
|
95
|
+
| `DropdownMenuGlassSeparator` | Visual divider |
|
|
96
|
+
| `DropdownMenuGlassLabel` | Section label |
|
|
97
|
+
| `DropdownMenuGlassCheckboxItem` | Checkbox menu item |
|
|
98
|
+
| `DropdownMenuGlassRadioGroup` | Radio group container |
|
|
99
|
+
| `DropdownMenuGlassRadioItem` | Radio menu item |
|
|
100
|
+
| `DropdownMenuGlassSub` | Sub-menu root |
|
|
101
|
+
| `DropdownMenuGlassSubTrigger` | Sub-menu trigger |
|
|
102
|
+
| `DropdownMenuGlassSubContent` | Sub-menu content |
|
|
103
|
+
| `DropdownMenuGlassShortcut` | Keyboard shortcut hint |
|
|
104
|
+
|
|
105
|
+
### 2. DropdownGlass (Simple API)
|
|
106
|
+
|
|
107
|
+
**Location:** `src/components/glass/ui/dropdown-glass.tsx`
|
|
108
|
+
|
|
109
|
+
**Purpose:** Quick setup for basic dropdown menus (wrapper over compound components)
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import { DropdownGlass } from '@/components/glass/ui/dropdown-glass';
|
|
113
|
+
|
|
114
|
+
<DropdownGlass
|
|
115
|
+
trigger={
|
|
116
|
+
<button>
|
|
117
|
+
<MoreVertical />
|
|
118
|
+
</button>
|
|
119
|
+
}
|
|
120
|
+
items={[
|
|
121
|
+
{ label: 'Edit', icon: Edit, onClick: handleEdit },
|
|
122
|
+
{ divider: true },
|
|
123
|
+
{ label: 'Delete', icon: Trash, onClick: handleDelete, danger: true },
|
|
124
|
+
]}
|
|
125
|
+
align="left"
|
|
126
|
+
/>;
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**When to use:**
|
|
130
|
+
|
|
131
|
+
- Simple menus with items, dividers, and icons
|
|
132
|
+
- No need for checkboxes, radio groups, or sub-menus
|
|
133
|
+
|
|
134
|
+
### 3. SortDropdownGlass (Specialized)
|
|
135
|
+
|
|
136
|
+
**Location:** `src/components/glass/atomic/sort-dropdown-glass.tsx`
|
|
137
|
+
|
|
138
|
+
**Purpose:** Sort field selection with order toggle
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
import { SortDropdownGlass } from '@/components/glass/atomic/sort-dropdown-glass';
|
|
142
|
+
|
|
143
|
+
<SortDropdownGlass
|
|
144
|
+
sortBy="commits"
|
|
145
|
+
sortOrder="desc"
|
|
146
|
+
onSortChange={(field, order) => console.log(field, order)}
|
|
147
|
+
options={['commits', 'stars', 'name']}
|
|
148
|
+
compact={false}
|
|
149
|
+
/>;
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Built on:** DropdownMenuGlass compound components
|
|
153
|
+
|
|
154
|
+
### 4. ComboBoxGlass (Searchable)
|
|
155
|
+
|
|
156
|
+
**Location:** `src/components/glass/ui/combobox-glass.tsx`
|
|
157
|
+
|
|
158
|
+
**Purpose:** Searchable select dropdown with filtering
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
import { ComboBoxGlass } from '@/components/glass/ui/combobox-glass';
|
|
162
|
+
|
|
163
|
+
<ComboBoxGlass
|
|
164
|
+
options={[
|
|
165
|
+
{ value: '1', label: 'Option 1' },
|
|
166
|
+
{ value: '2', label: 'Option 2' },
|
|
167
|
+
]}
|
|
168
|
+
value={selectedValue}
|
|
169
|
+
onChange={setSelectedValue}
|
|
170
|
+
searchable
|
|
171
|
+
/>;
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Built on:** Radix UI Popover + shadcn Command (separate pattern for search)
|
|
175
|
+
|
|
176
|
+
## Shared Styling
|
|
177
|
+
|
|
178
|
+
### CSS Variables
|
|
179
|
+
|
|
180
|
+
```css
|
|
181
|
+
--dropdown-bg /* Background color */
|
|
182
|
+
--dropdown-border /* Border color */
|
|
183
|
+
--dropdown-glow /* Shadow/glow effect */
|
|
184
|
+
--dropdown-item-text /* Item text color */
|
|
185
|
+
--dropdown-item-hover /* Hover background */
|
|
186
|
+
--dropdown-icon /* Icon color */
|
|
187
|
+
--dropdown-icon-hover /* Icon hover color */
|
|
188
|
+
--dropdown-divider /* Separator color */
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Styling Utilities
|
|
192
|
+
|
|
193
|
+
**Location:** `src/lib/variants/dropdown-content-styles.ts`
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
// Glass surface styling
|
|
197
|
+
getDropdownContentStyles(): CSSProperties
|
|
198
|
+
|
|
199
|
+
// Container classes
|
|
200
|
+
dropdownContentClasses: string
|
|
201
|
+
|
|
202
|
+
// Item classes with state support
|
|
203
|
+
getDropdownItemClasses({ danger?, selected?, highlighted? }): string
|
|
204
|
+
|
|
205
|
+
// Icon classes
|
|
206
|
+
getDropdownIconClasses({ danger? }): string
|
|
207
|
+
|
|
208
|
+
// Other classes
|
|
209
|
+
dropdownSeparatorClasses: string
|
|
210
|
+
dropdownLabelClasses: string
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Creating New Dropdown Components
|
|
214
|
+
|
|
215
|
+
### Step 1: Import DropdownMenuGlass primitives
|
|
216
|
+
|
|
217
|
+
```tsx
|
|
218
|
+
import {
|
|
219
|
+
DropdownMenuGlass,
|
|
220
|
+
DropdownMenuGlassTrigger,
|
|
221
|
+
DropdownMenuGlassContent,
|
|
222
|
+
DropdownMenuGlassItem,
|
|
223
|
+
} from '@/components/glass/ui/dropdown-menu-glass';
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Step 2: Build your component
|
|
227
|
+
|
|
228
|
+
```tsx
|
|
229
|
+
export function MyDropdown({ value, onChange, options }) {
|
|
230
|
+
return (
|
|
231
|
+
<DropdownMenuGlass>
|
|
232
|
+
<DropdownMenuGlassTrigger asChild>
|
|
233
|
+
<button>{value}</button>
|
|
234
|
+
</DropdownMenuGlassTrigger>
|
|
235
|
+
<DropdownMenuGlassContent>
|
|
236
|
+
{options.map((opt) => (
|
|
237
|
+
<DropdownMenuGlassItem key={opt.value} onSelect={() => onChange(opt.value)}>
|
|
238
|
+
{opt.label}
|
|
239
|
+
</DropdownMenuGlassItem>
|
|
240
|
+
))}
|
|
241
|
+
</DropdownMenuGlassContent>
|
|
242
|
+
</DropdownMenuGlass>
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Step 3: Add custom styling if needed
|
|
248
|
+
|
|
249
|
+
```tsx
|
|
250
|
+
<DropdownMenuGlassItem
|
|
251
|
+
className={cn(
|
|
252
|
+
'justify-between',
|
|
253
|
+
isSelected && 'bg-(--select-item-selected-bg)'
|
|
254
|
+
)}
|
|
255
|
+
>
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Benefits
|
|
259
|
+
|
|
260
|
+
1. **shadcn/ui Compatible**: Same compound component pattern
|
|
261
|
+
2. **Composable**: Mix and match components as needed
|
|
262
|
+
3. **Accessible**: Full Radix UI accessibility support
|
|
263
|
+
4. **Themeable**: Uses CSS variables for easy customization
|
|
264
|
+
5. **Tree-shakeable**: Import only what you need
|
|
265
|
+
|
|
266
|
+
## Migration from v1.x
|
|
267
|
+
|
|
268
|
+
### SortDropdownGlass Changes
|
|
269
|
+
|
|
270
|
+
**Before (v1.x):**
|
|
271
|
+
|
|
272
|
+
- Manual state management with useState
|
|
273
|
+
- Custom click outside/Escape handlers
|
|
274
|
+
- Z-index hacks
|
|
275
|
+
|
|
276
|
+
**After (v2.x):**
|
|
277
|
+
|
|
278
|
+
- Built on DropdownMenuGlass primitives
|
|
279
|
+
- Radix UI handles all interactions
|
|
280
|
+
- No z-index issues
|
|
281
|
+
|
|
282
|
+
The API remains the same - no breaking changes for consumers.
|
|
283
|
+
|
|
284
|
+
## Related Files
|
|
285
|
+
|
|
286
|
+
- `src/components/glass/ui/dropdown-menu-glass.tsx` - Compound components
|
|
287
|
+
- `src/components/glass/ui/dropdown-glass.tsx` - Simple API wrapper
|
|
288
|
+
- `src/components/glass/atomic/sort-dropdown-glass.tsx` - Sort dropdown
|
|
289
|
+
- `src/components/glass/ui/combobox-glass.tsx` - Searchable dropdown
|
|
290
|
+
- `src/lib/variants/dropdown-content-styles.ts` - Shared styling
|
package/docs/GETTING_STARTED.md
CHANGED
|
@@ -28,9 +28,9 @@ Before starting, ensure you have:
|
|
|
28
28
|
The easiest way to add components to an existing shadcn/ui project:
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
npx shadcn@latest add @shadcn-glass-ui/button
|
|
32
|
-
npx shadcn@latest add @shadcn-glass-ui/input
|
|
33
|
-
npx shadcn@latest add @shadcn-glass-ui/modal
|
|
31
|
+
npx shadcn@latest add @shadcn-glass-ui/button-glass
|
|
32
|
+
npx shadcn@latest add @shadcn-glass-ui/input-glass
|
|
33
|
+
npx shadcn@latest add @shadcn-glass-ui/modal-glass
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
This will:
|
|
@@ -634,8 +634,9 @@ Read [UI_DESIGN.md](design-system/UI_DESIGN.md) to understand:
|
|
|
634
634
|
### Browse Examples
|
|
635
635
|
|
|
636
636
|
- [Storybook](https://yhooi2.github.io/shadcn-glass-ui-library/) - Live component demos
|
|
637
|
-
- [ComponentShowcase](../src/components/ComponentShowcase.tsx) - All components in one page
|
|
638
|
-
- [DesktopShowcase](../src/components/DesktopShowcase.tsx) - Full application example
|
|
637
|
+
- [ComponentShowcase](../src/components/demos/ComponentShowcase.tsx) - All components in one page
|
|
638
|
+
- [DesktopShowcase](../src/components/demos/DesktopShowcase.tsx) - Full application example
|
|
639
|
+
- [MobileShowcase](../src/components/demos/MobileShowcase.tsx) - Mobile-optimized showcase
|
|
639
640
|
|
|
640
641
|
### Customize
|
|
641
642
|
|
|
@@ -340,6 +340,106 @@ src/styles/
|
|
|
340
340
|
|
|
341
341
|
---
|
|
342
342
|
|
|
343
|
+
## Tailwind CSS v4: Base vs Derived Values
|
|
344
|
+
|
|
345
|
+
### The Problem
|
|
346
|
+
|
|
347
|
+
In Tailwind CSS v4, variables defined inside `@theme` are **overwritten by Tailwind's defaults**.
|
|
348
|
+
This means custom base values like `--radius` get replaced.
|
|
349
|
+
|
|
350
|
+
```css
|
|
351
|
+
/* ❌ WRONG: Tailwind will overwrite --radius with its default (0.25rem) */
|
|
352
|
+
@theme {
|
|
353
|
+
--radius: 0.75rem;
|
|
354
|
+
--radius-lg: var(--radius);
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### The Solution (Glass UI Pattern)
|
|
359
|
+
|
|
360
|
+
Put **ALL values** (base AND derived) in `:root`, use `@theme` only for registration:
|
|
361
|
+
|
|
362
|
+
```css
|
|
363
|
+
/* ✅ CORRECT: ALL values in :root, @theme only references them */
|
|
364
|
+
|
|
365
|
+
:root {
|
|
366
|
+
/* Base value - editable */
|
|
367
|
+
--radius: 0.75rem;
|
|
368
|
+
|
|
369
|
+
/* Derived values - MUST also be in :root to override Tailwind defaults */
|
|
370
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
371
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
372
|
+
--radius-lg: var(--radius);
|
|
373
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
@theme {
|
|
377
|
+
/* Registration only - references :root values */
|
|
378
|
+
--radius-sm: var(--radius-sm);
|
|
379
|
+
--radius-md: var(--radius-md);
|
|
380
|
+
--radius-lg: var(--radius-lg);
|
|
381
|
+
--radius-xl: var(--radius-xl);
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
**Why derived values MUST be in `:root`:**
|
|
386
|
+
|
|
387
|
+
Tailwind v4 generates defaults like `--radius-xl: 0.75rem` in `@layer theme`. If you put your
|
|
388
|
+
derived values in `@theme`, Tailwind's defaults will override them because `@layer theme` is
|
|
389
|
+
processed after `@theme`.
|
|
390
|
+
|
|
391
|
+
### Why This Works
|
|
392
|
+
|
|
393
|
+
1. **`:root` has higher specificity** than Tailwind's `@layer theme`
|
|
394
|
+
2. **ALL values are preserved** - both base and derived override Tailwind defaults
|
|
395
|
+
3. **Derived values reference base** - they update automatically when base changes
|
|
396
|
+
4. **`@theme` registers utilities** - makes values available as Tailwind classes
|
|
397
|
+
5. **Single point of control** - change `--radius` once, affects all `--radius-*`
|
|
398
|
+
|
|
399
|
+
### File Structure
|
|
400
|
+
|
|
401
|
+
```
|
|
402
|
+
src/styles/tokens/primitives.css
|
|
403
|
+
├── :root { } ← ALL VALUES (base + derived)
|
|
404
|
+
│ ├── --radius (base)
|
|
405
|
+
│ ├── --radius-sm, --radius-md, --radius-lg, ... (derived)
|
|
406
|
+
│ ├── --blur (base)
|
|
407
|
+
│ ├── --blur-sm, --blur-md, --blur-lg, ... (derived)
|
|
408
|
+
│ └── ... all other scales
|
|
409
|
+
│
|
|
410
|
+
└── @theme { } ← REGISTRATION ONLY (references)
|
|
411
|
+
├── --radius-sm: var(--radius-sm);
|
|
412
|
+
├── --blur-lg: var(--blur-lg);
|
|
413
|
+
└── ... references to :root values
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Customization Examples
|
|
417
|
+
|
|
418
|
+
To change the global border radius:
|
|
419
|
+
|
|
420
|
+
```css
|
|
421
|
+
/* In your custom CSS (after importing Glass UI) */
|
|
422
|
+
:root {
|
|
423
|
+
--radius: 1rem; /* 16px - Apple-style liquid glass */
|
|
424
|
+
}
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
All `rounded-*` utilities will automatically update:
|
|
428
|
+
|
|
429
|
+
| `--radius` Value | `rounded-sm` | `rounded-md` | `rounded-lg` | `rounded-xl` |
|
|
430
|
+
| ---------------- | ------------ | ------------ | ------------ | ------------ |
|
|
431
|
+
| `0.5rem` (8px) | 4px | 6px | 8px | 12px |
|
|
432
|
+
| `0.75rem` (12px) | 8px | 10px | 12px | 16px |
|
|
433
|
+
| `1rem` (16px) | 12px | 14px | 16px | 20px |
|
|
434
|
+
| `1.25rem` (20px) | 16px | 18px | 20px | 24px |
|
|
435
|
+
|
|
436
|
+
### References
|
|
437
|
+
|
|
438
|
+
- [Tailwind v4 - shadcn/ui](https://ui.shadcn.com/docs/tailwind-v4)
|
|
439
|
+
- [Theming shadcn with Tailwind v4](https://www.shadcnblocks.com/blog/tailwind4-shadcn-themeing/)
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
343
443
|
## Browser Compatibility
|
|
344
444
|
|
|
345
445
|
**Primitive Tokens:** Universal support (CSS custom properties)
|
package/docs/api/README.md
CHANGED
|
@@ -43,7 +43,7 @@ comprehensive docs.
|
|
|
43
43
|
- **Storybook 10.1** - Component workshop with ESM-only architecture
|
|
44
44
|
- **Vitest 4.0** - Browser mode testing with visual regression
|
|
45
45
|
|
|
46
|
-
See [DEPENDENCIES.md](DEPENDENCIES.md) for detailed dependency documentation.
|
|
46
|
+
See [DEPENDENCIES.md](../technical/DEPENDENCIES.md) for detailed dependency documentation.
|
|
47
47
|
|
|
48
48
|
## 🤖 AI Assistant Support
|
|
49
49
|
|
|
@@ -91,7 +91,7 @@ npm install shadcn-glass-ui
|
|
|
91
91
|
|
|
92
92
|
- React 18.0+ or 19.0+
|
|
93
93
|
- React-DOM 18.0+ or 19.0+
|
|
94
|
-
- Tailwind CSS 4.
|
|
94
|
+
- Tailwind CSS 4.1+
|
|
95
95
|
|
|
96
96
|
### Basic Usage
|
|
97
97
|
|
|
@@ -302,7 +302,7 @@ See [CHANGELOG.md](../../CHANGELOG.md) for complete version history and breaking
|
|
|
302
302
|
- **[Visual Testing Guide](../../docs/visual-testing-guide.md)** - Screenshot update workflow
|
|
303
303
|
- **[Migration Guide](MIGRATION_GUIDE.md)** - Upgrading from v1
|
|
304
304
|
- **[Breaking Changes](BREAKING_CHANGES.md)** - API changes log
|
|
305
|
-
- **[Dependencies](DEPENDENCIES.md)** - Detailed dependency docs
|
|
305
|
+
- **[Dependencies](../technical/DEPENDENCIES.md)** - Detailed dependency docs
|
|
306
306
|
- **[Contributing](../../CONTRIBUTING.md)** - Development guidelines
|
|
307
307
|
|
|
308
308
|
## 🎯 Component Categories
|