@fragments-sdk/ui 0.2.1 → 0.2.2
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 +150 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# @fragments-sdk/ui
|
|
2
|
+
|
|
3
|
+
A component library built on [Base UI](https://base-ui.com/) headless primitives with design tokens, SCSS modules, and full AI agent support via [Fragments](https://github.com/ConanMcN/fragments).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @fragments-sdk/ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer dependencies:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install react react-dom
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
Import the global styles in your app entry point:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import '@fragments-sdk/ui/styles';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then use components:
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { Button, Card, Input, Grid } from '@fragments-sdk/ui';
|
|
29
|
+
|
|
30
|
+
function App() {
|
|
31
|
+
return (
|
|
32
|
+
<Card>
|
|
33
|
+
<Grid columns={2} gap="md">
|
|
34
|
+
<Input label="Email" type="email" />
|
|
35
|
+
<Input label="Name" />
|
|
36
|
+
</Grid>
|
|
37
|
+
<Button variant="primary">Submit</Button>
|
|
38
|
+
</Card>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Components
|
|
44
|
+
|
|
45
|
+
| Component | Category | Description |
|
|
46
|
+
|-----------|----------|-------------|
|
|
47
|
+
| Alert | Feedback | Contextual feedback messages with severity levels |
|
|
48
|
+
| Avatar | Display | User or entity profile images with fallbacks |
|
|
49
|
+
| Badge | Display | Status indicators and labels |
|
|
50
|
+
| Button | Actions | Primary interaction element with variants |
|
|
51
|
+
| Card | Layout | Content container with optional sections |
|
|
52
|
+
| Checkbox | Forms | Binary selection control |
|
|
53
|
+
| CircularProgress | Feedback | Circular loading/progress indicator |
|
|
54
|
+
| Dialog | Overlay | Modal dialogs with compound API |
|
|
55
|
+
| EmptyState | Feedback | Placeholder for empty content areas |
|
|
56
|
+
| Grid | Layout | Responsive grid layout with breakpoint support |
|
|
57
|
+
| Input | Forms | Text input with label, error, and helper text |
|
|
58
|
+
| Menu | Overlay | Dropdown action menus |
|
|
59
|
+
| Popover | Overlay | Floating content panels |
|
|
60
|
+
| Progress | Feedback | Linear progress bar |
|
|
61
|
+
| RadioGroup | Forms | Single-select from a group of options |
|
|
62
|
+
| Select | Forms | Dropdown selection control |
|
|
63
|
+
| Separator | Layout | Visual divider between content |
|
|
64
|
+
| Skeleton | Feedback | Loading placeholder that preserves layout |
|
|
65
|
+
| Table | Data | Data table with sorting and selection |
|
|
66
|
+
| Tabs | Navigation | Tabbed content panels |
|
|
67
|
+
| Textarea | Forms | Multi-line text input |
|
|
68
|
+
| Toast | Feedback | Transient notifications |
|
|
69
|
+
| Toggle | Forms | On/off switch control |
|
|
70
|
+
| Tooltip | Overlay | Contextual information on hover |
|
|
71
|
+
|
|
72
|
+
## Design Tokens
|
|
73
|
+
|
|
74
|
+
Access SCSS variables and mixins for custom styling:
|
|
75
|
+
|
|
76
|
+
```scss
|
|
77
|
+
@use '@fragments-sdk/ui/tokens' as *;
|
|
78
|
+
|
|
79
|
+
.custom {
|
|
80
|
+
padding: $fui-spacing-4;
|
|
81
|
+
border-radius: $fui-radius-md;
|
|
82
|
+
color: var(--fui-text-primary);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Breakpoints
|
|
87
|
+
|
|
88
|
+
```scss
|
|
89
|
+
@use '@fragments-sdk/ui/tokens' as *;
|
|
90
|
+
|
|
91
|
+
.responsive {
|
|
92
|
+
@include breakpoint-md {
|
|
93
|
+
grid-template-columns: repeat(2, 1fr);
|
|
94
|
+
}
|
|
95
|
+
@include breakpoint-lg {
|
|
96
|
+
grid-template-columns: repeat(3, 1fr);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
| Token | Value |
|
|
102
|
+
|-------|-------|
|
|
103
|
+
| `$fui-breakpoint-sm` | 640px |
|
|
104
|
+
| `$fui-breakpoint-md` | 768px |
|
|
105
|
+
| `$fui-breakpoint-lg` | 1024px |
|
|
106
|
+
| `$fui-breakpoint-xl` | 1280px |
|
|
107
|
+
|
|
108
|
+
## AI Agent Support
|
|
109
|
+
|
|
110
|
+
This package ships a `fragments.json` file that describes every component's props, usage guidelines, accessibility rules, and code examples. AI agents can access this data through the [`@fragments-sdk/mcp`](https://www.npmjs.com/package/@fragments-sdk/mcp) server.
|
|
111
|
+
|
|
112
|
+
### Setup with Claude Code
|
|
113
|
+
|
|
114
|
+
1. Install both packages:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
npm install @fragments-sdk/ui @fragments-sdk/mcp
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
2. Add the MCP server to your Claude Code settings (`~/.claude/settings.json`):
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"mcpServers": {
|
|
125
|
+
"fragments": {
|
|
126
|
+
"command": "npx",
|
|
127
|
+
"args": ["@fragments-sdk/mcp"]
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The MCP server automatically discovers `fragments.json` from the installed `@fragments-sdk/ui` package. No configuration needed.
|
|
134
|
+
|
|
135
|
+
## Composition Recipes
|
|
136
|
+
|
|
137
|
+
The library includes composition recipes — named patterns showing how components wire together for common use cases:
|
|
138
|
+
|
|
139
|
+
- **Login Form** — Email/password authentication form
|
|
140
|
+
- **Confirm Dialog** — Destructive action confirmation
|
|
141
|
+
- **Card Grid** — Responsive auto-fill card layout
|
|
142
|
+
- **Form Layout** — Two-column form with Grid
|
|
143
|
+
- **Dashboard Layout** — Featured card with metrics grid
|
|
144
|
+
- **Settings Page** — Settings sections with cards and controls
|
|
145
|
+
|
|
146
|
+
Access recipes via the MCP server's `fragments_recipe` tool or `fragments_context`.
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fragments-sdk/ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Customizable UI components built on Base UI headless primitives",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"react-dom": "^19.0.0",
|
|
31
31
|
"sass": "^1.83.0",
|
|
32
32
|
"typescript": "^5.7.0",
|
|
33
|
-
"@fragments/cli": "0.2.1",
|
|
34
33
|
"@fragments/core": "0.2.0",
|
|
34
|
+
"@fragments/cli": "0.2.1",
|
|
35
35
|
"@fragments/viewer": "0.1.1"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|