@nqlib/nqui 0.3.2 → 0.3.3
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 +6 -1
- package/dist/nqui.cjs.js +1 -1
- package/dist/nqui.es.js +3 -3
- package/dist/pages/ComponentShowcase.d.ts.map +1 -1
- package/dist/styles.css +0 -8
- package/docs/components/README.md +119 -0
- package/docs/components/nqui-accordion.md +20 -0
- package/docs/components/nqui-alert-dialog.md +31 -0
- package/docs/components/nqui-alert.md +19 -0
- package/docs/components/nqui-aspect-ratio.md +17 -0
- package/docs/components/nqui-avatar.md +18 -0
- package/docs/components/nqui-badge.md +42 -0
- package/docs/components/nqui-breadcrumb.md +24 -0
- package/docs/components/nqui-button-group.md +31 -0
- package/docs/components/nqui-button.md +56 -0
- package/docs/components/nqui-calendar.md +46 -0
- package/docs/components/nqui-card.md +31 -0
- package/docs/components/nqui-carousel.md +22 -0
- package/docs/components/nqui-checkbox.md +34 -0
- package/docs/components/nqui-code-block.md +39 -0
- package/docs/components/nqui-code-editor.md +21 -0
- package/docs/components/nqui-collapsible.md +18 -0
- package/docs/components/nqui-color-picker.md +38 -0
- package/docs/components/nqui-color-slider.md +23 -0
- package/docs/components/nqui-combobox.md +65 -0
- package/docs/components/nqui-command-palette.md +29 -0
- package/docs/components/nqui-command.md +39 -0
- package/docs/components/nqui-context-menu.md +33 -0
- package/docs/components/nqui-dialog.md +36 -0
- package/docs/components/nqui-drawer.md +27 -0
- package/docs/components/nqui-dropdown-menu.md +56 -0
- package/docs/components/nqui-empty.md +22 -0
- package/docs/components/nqui-field.md +42 -0
- package/docs/components/nqui-frosted-glass.md +19 -0
- package/docs/components/nqui-hover-card.md +18 -0
- package/docs/components/nqui-input-group.md +22 -0
- package/docs/components/nqui-input-otp.md +23 -0
- package/docs/components/nqui-input.md +25 -0
- package/docs/components/nqui-item.md +25 -0
- package/docs/components/nqui-kbd.md +25 -0
- package/docs/components/nqui-label.md +16 -0
- package/docs/components/nqui-logo.md +16 -0
- package/docs/components/nqui-menubar.md +22 -0
- package/docs/components/nqui-native-select.md +28 -0
- package/docs/components/nqui-navigation-menu.md +25 -0
- package/docs/components/nqui-pagination.md +25 -0
- package/docs/components/nqui-popover.md +34 -0
- package/docs/components/nqui-progress.md +22 -0
- package/docs/components/nqui-radio-group.md +34 -0
- package/docs/components/nqui-rating.md +35 -0
- package/docs/components/nqui-resizable.md +23 -0
- package/docs/components/nqui-sandbox.md +27 -0
- package/docs/components/nqui-scroll-area.md +32 -0
- package/docs/components/nqui-segmented-control.md +18 -0
- package/docs/components/nqui-select.md +50 -0
- package/docs/components/nqui-separator.md +16 -0
- package/docs/components/nqui-sheet.md +27 -0
- package/docs/components/nqui-sidebar.md +45 -0
- package/docs/components/nqui-skeleton.md +15 -0
- package/docs/components/nqui-slider.md +16 -0
- package/docs/components/nqui-snippet.md +28 -0
- package/docs/components/nqui-sortable.md +46 -0
- package/docs/components/nqui-spinner.md +16 -0
- package/docs/components/nqui-switch.md +15 -0
- package/docs/components/nqui-table-of-contents.md +37 -0
- package/docs/components/nqui-tabs.md +35 -0
- package/docs/components/nqui-textarea.md +15 -0
- package/docs/components/nqui-toaster.md +44 -0
- package/docs/components/nqui-toggle-group.md +21 -0
- package/docs/components/nqui-toggle.md +15 -0
- package/docs/components/nqui-tooltip.md +24 -0
- package/docs/components/nqui-tracker.md +38 -0
- package/docs/internal-notes/BUILD_VERIFICATION.md +174 -0
- package/docs/internal-notes/DASHBOARD_LAYOUT_DESIGN.md +1429 -0
- package/docs/internal-notes/FROSTED_GLASS_FIX.md +50 -0
- package/docs/internal-notes/PUBLISHING.md +339 -0
- package/docs/internal-notes/layoutdesign.md +616 -0
- package/docs/internal-notes/progress.md +348 -0
- package/docs/internal-notes/stacked-avatar-implementation.md +38 -0
- package/package.json +2 -1
- /package/{INSTALLATION.md → docs/internal-notes/INSTALLATION.md} +0 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
# Progress Component
|
|
2
|
+
|
|
3
|
+
The Progress component displays progress indicators with two distinct styles: a block-based segmented design (dash style) similar to GitHub's contribution graph, or a smooth continuous bar (solid style).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @nqlib/nqui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Import
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Progress } from '@nqlib/nqui';
|
|
15
|
+
// Or import the base version:
|
|
16
|
+
import { CoreProgress } from '@nqlib/nqui';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Basic Usage
|
|
20
|
+
|
|
21
|
+
### Dash Style (Default)
|
|
22
|
+
|
|
23
|
+
The dash style displays progress as discrete colored blocks:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { Progress } from '@nqlib/nqui';
|
|
27
|
+
|
|
28
|
+
export default function Example() {
|
|
29
|
+
return <Progress value={75} variant="success" />;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Solid Style
|
|
34
|
+
|
|
35
|
+
The solid style displays progress as a smooth continuous bar:
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { Progress } from '@nqlib/nqui';
|
|
39
|
+
|
|
40
|
+
export default function Example() {
|
|
41
|
+
return (
|
|
42
|
+
<Progress
|
|
43
|
+
value={75}
|
|
44
|
+
variant="success"
|
|
45
|
+
style="solid"
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Props
|
|
52
|
+
|
|
53
|
+
| Prop | Type | Default | Description |
|
|
54
|
+
|------|------|---------|-------------|
|
|
55
|
+
| `value` | `number` | **required** | Progress value (0 to max) |
|
|
56
|
+
| `max` | `number` | `100` | Maximum value |
|
|
57
|
+
| `variant` | `'default' \| 'success' \| 'warning' \| 'error' \| 'neutral'` | `'default'` | Color variant |
|
|
58
|
+
| `style` | `'dash' \| 'solid'` | `'dash'` | Progress style/appearance |
|
|
59
|
+
| `blocks` | `number` | auto | Number of blocks to display (dash style only, 20-100) |
|
|
60
|
+
| `showTooltip` | `boolean` | `false` | Show tooltip on hover showing progress percentage |
|
|
61
|
+
| `hoverEffect` | `boolean` | `false` | Enable hover opacity effect on blocks (dash style only) |
|
|
62
|
+
| `showAnimation` | `boolean` | `false` | Show animation transition when value changes |
|
|
63
|
+
| `label` | `string` | - | Optional label text to display next to progress bar (solid style only) |
|
|
64
|
+
| `height` | `string` | `'h-8'` (dash) or `'h-2'` (solid) | Height override (Tailwind class or CSS value) |
|
|
65
|
+
| `className` | `string` | - | Additional CSS classes |
|
|
66
|
+
|
|
67
|
+
## Variants
|
|
68
|
+
|
|
69
|
+
Progress comes in five color variants:
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
<Progress value={60} variant="default" /> // Primary color
|
|
73
|
+
<Progress value={60} variant="success" /> // Green
|
|
74
|
+
<Progress value={60} variant="warning" /> // Yellow
|
|
75
|
+
<Progress value={60} variant="error" /> // Red
|
|
76
|
+
<Progress value={60} variant="neutral" /> // Gray
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Styles
|
|
80
|
+
|
|
81
|
+
### Dash Style
|
|
82
|
+
|
|
83
|
+
The dash style displays progress as discrete blocks, similar to GitHub's contribution graph. Blocks are auto-calculated based on container width, or you can specify a custom count.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
// Auto-calculated blocks (default)
|
|
87
|
+
<div className="w-96">
|
|
88
|
+
<Progress value={60} variant="success" />
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
// Custom block count
|
|
92
|
+
<Progress value={60} blocks={50} variant="success" />
|
|
93
|
+
|
|
94
|
+
// With hover effect
|
|
95
|
+
<Progress
|
|
96
|
+
value={60}
|
|
97
|
+
variant="success"
|
|
98
|
+
hoverEffect
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
// With tooltip
|
|
102
|
+
<Progress
|
|
103
|
+
value={60}
|
|
104
|
+
variant="success"
|
|
105
|
+
showTooltip
|
|
106
|
+
/>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Solid Style
|
|
110
|
+
|
|
111
|
+
The solid style displays progress as a smooth continuous bar with rounded corners.
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
// Basic solid bar
|
|
115
|
+
<Progress value={75} variant="success" style="solid" />
|
|
116
|
+
|
|
117
|
+
// With label
|
|
118
|
+
<Progress
|
|
119
|
+
value={75}
|
|
120
|
+
variant="success"
|
|
121
|
+
style="solid"
|
|
122
|
+
label="75% Complete"
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
// With animation
|
|
126
|
+
<Progress
|
|
127
|
+
value={progress}
|
|
128
|
+
variant="success"
|
|
129
|
+
style="solid"
|
|
130
|
+
showAnimation
|
|
131
|
+
/>
|
|
132
|
+
|
|
133
|
+
// Custom height
|
|
134
|
+
<Progress
|
|
135
|
+
value={75}
|
|
136
|
+
variant="success"
|
|
137
|
+
style="solid"
|
|
138
|
+
height="h-4"
|
|
139
|
+
/>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Examples
|
|
143
|
+
|
|
144
|
+
### Dash Style Examples
|
|
145
|
+
|
|
146
|
+
#### Auto-calculated Blocks
|
|
147
|
+
|
|
148
|
+
The component automatically calculates the optimal number of blocks based on container width:
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
<div className="w-64">
|
|
152
|
+
<Progress value={60} variant="default" />
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<div className="w-96">
|
|
156
|
+
<Progress value={60} variant="success" />
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<div className="w-full max-w-2xl">
|
|
160
|
+
<Progress value={60} variant="warning" />
|
|
161
|
+
</div>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### Custom Block Count
|
|
165
|
+
|
|
166
|
+
Specify a custom number of blocks (between 20-100):
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
// Sparse (20 blocks)
|
|
170
|
+
<Progress value={60} blocks={20} variant="success" />
|
|
171
|
+
|
|
172
|
+
// Default density (50 blocks)
|
|
173
|
+
<Progress value={60} blocks={50} variant="success" />
|
|
174
|
+
|
|
175
|
+
// Dense (100 blocks)
|
|
176
|
+
<Progress value={60} blocks={100} variant="success" />
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### With Tooltip
|
|
180
|
+
|
|
181
|
+
Show progress percentage on hover:
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
import { TooltipProvider } from '@nqlib/nqui';
|
|
185
|
+
|
|
186
|
+
<TooltipProvider>
|
|
187
|
+
<Progress
|
|
188
|
+
value={65}
|
|
189
|
+
variant="success"
|
|
190
|
+
showTooltip
|
|
191
|
+
/>
|
|
192
|
+
</TooltipProvider>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
#### With Hover Effect
|
|
196
|
+
|
|
197
|
+
Enable opacity effect on blocks when hovering:
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
<Progress
|
|
201
|
+
value={70}
|
|
202
|
+
variant="default"
|
|
203
|
+
hoverEffect
|
|
204
|
+
/>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### Custom Heights
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
<Progress value={60} height="h-4" variant="success" /> // Small
|
|
211
|
+
<Progress value={60} height="h-6" variant="success" /> // Medium
|
|
212
|
+
<Progress value={60} height="h-8" variant="success" /> // Default
|
|
213
|
+
<Progress value={60} height="h-12" variant="success" /> // Large
|
|
214
|
+
<Progress value={60} height="2rem" variant="success" /> // Custom CSS
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Solid Style Examples
|
|
218
|
+
|
|
219
|
+
#### Basic Solid Bar
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
<Progress value={75} variant="success" style="solid" />
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### With Label
|
|
226
|
+
|
|
227
|
+
```tsx
|
|
228
|
+
<Progress
|
|
229
|
+
value={75}
|
|
230
|
+
variant="success"
|
|
231
|
+
style="solid"
|
|
232
|
+
label="75%"
|
|
233
|
+
/>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### With Animation
|
|
237
|
+
|
|
238
|
+
Animate value changes smoothly:
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
import { useState } from 'react';
|
|
242
|
+
|
|
243
|
+
function AnimatedProgress() {
|
|
244
|
+
const [progress, setProgress] = useState(50);
|
|
245
|
+
|
|
246
|
+
return (
|
|
247
|
+
<Progress
|
|
248
|
+
value={progress}
|
|
249
|
+
variant="success"
|
|
250
|
+
style="solid"
|
|
251
|
+
showAnimation
|
|
252
|
+
/>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
#### Different Progress Values
|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
<Progress value={0} variant="default" style="solid" /> // 0%
|
|
261
|
+
<Progress value={25} variant="success" style="solid" /> // 25%
|
|
262
|
+
<Progress value={50} variant="warning" style="solid" /> // 50%
|
|
263
|
+
<Progress value={75} variant="success" style="solid" /> // 75%
|
|
264
|
+
<Progress value={100} variant="success" style="solid" /> // 100%
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Controlled Progress
|
|
268
|
+
|
|
269
|
+
Use controlled state to update progress dynamically:
|
|
270
|
+
|
|
271
|
+
```tsx
|
|
272
|
+
import { useState } from 'react';
|
|
273
|
+
import { Progress } from '@nqlib/nqui';
|
|
274
|
+
|
|
275
|
+
function ControlledProgress() {
|
|
276
|
+
const [progress, setProgress] = useState(50);
|
|
277
|
+
|
|
278
|
+
return (
|
|
279
|
+
<div className="space-y-4">
|
|
280
|
+
<Progress
|
|
281
|
+
value={progress}
|
|
282
|
+
variant="success"
|
|
283
|
+
showTooltip
|
|
284
|
+
/>
|
|
285
|
+
<input
|
|
286
|
+
type="range"
|
|
287
|
+
min="0"
|
|
288
|
+
max="100"
|
|
289
|
+
value={progress}
|
|
290
|
+
onChange={(e) => setProgress(Number(e.target.value))}
|
|
291
|
+
className="w-full"
|
|
292
|
+
/>
|
|
293
|
+
<div className="text-sm text-muted-foreground">
|
|
294
|
+
Progress: {progress}%
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Requirements
|
|
302
|
+
|
|
303
|
+
### CSS Import
|
|
304
|
+
|
|
305
|
+
Ensure the library CSS is imported in your application:
|
|
306
|
+
|
|
307
|
+
```tsx
|
|
308
|
+
import '@nqlib/nqui/dist/index.css';
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Tooltip Provider
|
|
312
|
+
|
|
313
|
+
If using `showTooltip`, wrap your app with `TooltipProvider`:
|
|
314
|
+
|
|
315
|
+
```tsx
|
|
316
|
+
import { TooltipProvider } from '@nqlib/nqui';
|
|
317
|
+
|
|
318
|
+
function App() {
|
|
319
|
+
return (
|
|
320
|
+
<TooltipProvider>
|
|
321
|
+
{/* Your app */}
|
|
322
|
+
</TooltipProvider>
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Accessibility
|
|
328
|
+
|
|
329
|
+
- Includes ARIA attributes (`role="progressbar"`, `aria-valuenow`, `aria-valuemin`, `aria-valuemax`)
|
|
330
|
+
- Proper progress semantics for screen readers
|
|
331
|
+
- Keyboard accessible (inherited from Radix UI primitives)
|
|
332
|
+
|
|
333
|
+
## Notes
|
|
334
|
+
|
|
335
|
+
- **Dash style**: Block-based design that auto-calculates block count based on container width if `blocks` prop is not provided
|
|
336
|
+
- **Solid style**: Smooth continuous bar with rounded corners, supports labels and animations
|
|
337
|
+
- **Responsive**: Dash style adapts block count to container width automatically
|
|
338
|
+
- **Performance**: Uses ResizeObserver for efficient width calculations in dash style
|
|
339
|
+
|
|
340
|
+
## Base Component
|
|
341
|
+
|
|
342
|
+
If you need the base Radix UI Progress component without enhancements, import `CoreProgress`:
|
|
343
|
+
|
|
344
|
+
```tsx
|
|
345
|
+
import { CoreProgress } from '@nqlib/nqui';
|
|
346
|
+
|
|
347
|
+
<CoreProgress value={33} />
|
|
348
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Stacked Avatar (Assignees) Implementation
|
|
2
|
+
|
|
3
|
+
Use this pattern to show multiple assignees/people in a project cell with limited space.
|
|
4
|
+
|
|
5
|
+
## Pattern
|
|
6
|
+
|
|
7
|
+
1. **Stack avatars** – Use `flex` + `-space-x-1.5` so avatars overlap.
|
|
8
|
+
2. **Limit visible** – Show the first `maxVisible` avatars (e.g. 2–3).
|
|
9
|
+
3. **Overflow indicator** – When there are more, append a "…" badge.
|
|
10
|
+
4. **Hover for details** – Wrap the overflow case in `Tooltip` / `TooltipProvider`; show full list on hover.
|
|
11
|
+
|
|
12
|
+
## Data Shape
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
type Person = { id: string; name: string; avatarUrl?: string }
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Key Props
|
|
19
|
+
|
|
20
|
+
| Prop | Description |
|
|
21
|
+
|-------------|-------------------------------------|
|
|
22
|
+
| `maxVisible`| How many avatars to show (2–3) |
|
|
23
|
+
| `people` | Array of `Person` objects |
|
|
24
|
+
|
|
25
|
+
## Layout Classes
|
|
26
|
+
|
|
27
|
+
- Container: `flex shrink-0 items-center -space-x-1.5`
|
|
28
|
+
- Avatar: `h-5 w-5 border border-background`
|
|
29
|
+
- Fallback: `text-[10px]` for initials
|
|
30
|
+
- Overflow badge: Same size as avatar, `bg-muted text-muted-foreground`
|
|
31
|
+
|
|
32
|
+
## Overflow Logic
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const visible = people.slice(0, maxVisible)
|
|
36
|
+
const overflow = people.length > maxVisible
|
|
37
|
+
// Render visible + "…" badge when overflow; wrap in Tooltip for hover
|
|
38
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nqlib/nqui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "A React component library with enhanced UI components and developer tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/nqui.cjs.js",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|
|
24
24
|
"scripts",
|
|
25
|
+
"docs",
|
|
25
26
|
"README.md",
|
|
26
27
|
"INSTALLATION.md"
|
|
27
28
|
],
|
|
File without changes
|