@exitvibing/hqui 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 +45 -0
- package/dist/index.css +1 -0
- package/dist/index.d.mts +180 -0
- package/dist/index.d.ts +180 -0
- package/dist/index.js +1049 -0
- package/dist/index.mjs +988 -0
- package/docs/components.md +304 -0
- package/docs/design-system.md +85 -0
- package/docs/extended-components.md +201 -0
- package/docs/setup.md +146 -0
- package/package.json +33 -0
- package/src/components/Badge.tsx +40 -0
- package/src/components/Button.tsx +50 -0
- package/src/components/Card.tsx +72 -0
- package/src/components/Checkbox.tsx +47 -0
- package/src/components/HighlightText.tsx +24 -0
- package/src/components/Input.tsx +21 -0
- package/src/components/ProgressBar.tsx +64 -0
- package/src/components/Separator.tsx +25 -0
- package/src/components/Switch.tsx +43 -0
- package/src/components/Table.tsx +87 -0
- package/src/components/Tabs.tsx +122 -0
- package/src/components/ThemeToggle.tsx +40 -0
- package/src/components/Tooltip.tsx +120 -0
- package/src/components/extended/ArrowButton.tsx +28 -0
- package/src/components/extended/ChooseList.tsx +38 -0
- package/src/components/extended/Counter.tsx +74 -0
- package/src/components/extended/Popup.tsx +78 -0
- package/src/components/extended/StatusBar.tsx +45 -0
- package/src/components/extended/WeekViewCalendar.tsx +126 -0
- package/src/index.css +119 -0
- package/src/index.ts +25 -0
- package/src/lib/cn.ts +6 -0
- package/tailwind.config.ts +64 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
# Core Components
|
|
2
|
+
|
|
3
|
+
Every component accepts `className` for custom styling and uses `forwardRef` for ref forwarding.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Button
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Button } from "hqui";
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Props:**
|
|
14
|
+
|
|
15
|
+
| Prop | Type | Default |
|
|
16
|
+
| --------- | -------------------------------------------------------------------------------------------------------- | ----------- |
|
|
17
|
+
| `variant` | `'primary'` `'secondary'` `'destructive'` `'outline'` `'ghost'` `'purple'` `'orange'` `'blue'` `'green'` | `'primary'` |
|
|
18
|
+
| `size` | `'sm'` `'default'` `'lg'` `'icon'` | `'default'` |
|
|
19
|
+
|
|
20
|
+
`primary` is white background with black text in dark mode, black background with white text in light mode.
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
<Button variant="purple" size="lg">Save</Button>
|
|
24
|
+
<Button variant="orange">Warning</Button>
|
|
25
|
+
<Button variant="ghost" size="icon"><Icon /></Button>
|
|
26
|
+
<Button disabled>Disabled</Button>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Card
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import {
|
|
35
|
+
Card,
|
|
36
|
+
CardHeader,
|
|
37
|
+
CardTitle,
|
|
38
|
+
CardDescription,
|
|
39
|
+
CardContent,
|
|
40
|
+
CardFooter,
|
|
41
|
+
} from "hqui";
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
No custom props. Compose the card using subcomponents:
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<Card>
|
|
48
|
+
<CardHeader>
|
|
49
|
+
<CardTitle>Title</CardTitle>
|
|
50
|
+
<CardDescription>Subtitle text</CardDescription>
|
|
51
|
+
</CardHeader>
|
|
52
|
+
<CardContent>
|
|
53
|
+
<p>Main content goes here</p>
|
|
54
|
+
</CardContent>
|
|
55
|
+
<CardFooter>
|
|
56
|
+
<Button>Action</Button>
|
|
57
|
+
</CardFooter>
|
|
58
|
+
</Card>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Input
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import { Input } from "hqui";
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Wraps a native `<input>` with styled border and focus ring. All standard input props work.
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
<Input placeholder="Email" type="email" />
|
|
73
|
+
<Input type="password" placeholder="Password" />
|
|
74
|
+
<Input disabled placeholder="Cannot edit" />
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Checkbox
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import { Checkbox } from "hqui";
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Props:**
|
|
86
|
+
|
|
87
|
+
| Prop | Type | Default |
|
|
88
|
+
| ------- | -------- | ------- |
|
|
89
|
+
| `label` | `string` | none |
|
|
90
|
+
|
|
91
|
+
Also accepts all standard input props (`defaultChecked`, `disabled`, `onChange`, etc).
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
<Checkbox label="Accept terms" defaultChecked />
|
|
95
|
+
<Checkbox label="Send emails" />
|
|
96
|
+
<Checkbox label="Cannot change" disabled />
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## ProgressBar
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import { ProgressBar } from "hqui";
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Props:**
|
|
108
|
+
|
|
109
|
+
| Prop | Type | Default |
|
|
110
|
+
| ----------- | -------------------------------------------------- | --------- |
|
|
111
|
+
| `value` | `number` | `0` |
|
|
112
|
+
| `max` | `number` | `100` |
|
|
113
|
+
| `showLabel` | `boolean` | `false` |
|
|
114
|
+
| `color` | `'white'` `'purple'` `'orange'` `'blue'` `'green'` | `'white'` |
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
<ProgressBar value={65} max={100} />
|
|
118
|
+
<ProgressBar value={80} color="purple" showLabel />
|
|
119
|
+
<ProgressBar value={40} color="orange" />
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Table
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
import {
|
|
128
|
+
Table,
|
|
129
|
+
TableHeader,
|
|
130
|
+
TableBody,
|
|
131
|
+
TableRow,
|
|
132
|
+
TableHead,
|
|
133
|
+
TableCell,
|
|
134
|
+
} from "hqui";
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
No custom props. Standard HTML table structure:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
<Table>
|
|
141
|
+
<TableHeader>
|
|
142
|
+
<TableRow>
|
|
143
|
+
<TableHead>Name</TableHead>
|
|
144
|
+
<TableHead>Email</TableHead>
|
|
145
|
+
</TableRow>
|
|
146
|
+
</TableHeader>
|
|
147
|
+
<TableBody>
|
|
148
|
+
<TableRow>
|
|
149
|
+
<TableCell>Alice</TableCell>
|
|
150
|
+
<TableCell>alice@example.com</TableCell>
|
|
151
|
+
</TableRow>
|
|
152
|
+
</TableBody>
|
|
153
|
+
</Table>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## HighlightText
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
import { HighlightText } from "hqui";
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Wraps inline text with a highlight. In dark mode: white background, black text. In light mode: black background, white text.
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
<p>
|
|
168
|
+
This is <HighlightText>highlighted</HighlightText> text.
|
|
169
|
+
</p>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Badge
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
import { Badge } from "hqui";
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Props:**
|
|
181
|
+
|
|
182
|
+
| Prop | Type | Default |
|
|
183
|
+
| --------- | ---------------------------------------------------------------------------------------------------------------- | ----------- |
|
|
184
|
+
| `variant` | `'default'` `'secondary'` `'outline'` `'white'` `'destructive'` `'purple'` `'orange'` `'blue'` `'green'` `'red'` | `'default'` |
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
<Badge variant="purple">Admin</Badge>
|
|
188
|
+
<Badge variant="orange">Warning</Badge>
|
|
189
|
+
<Badge variant="blue">Info</Badge>
|
|
190
|
+
<Badge variant="white">Neutral</Badge>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Separator
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
import { Separator } from "hqui";
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Props:**
|
|
202
|
+
|
|
203
|
+
| Prop | Type | Default |
|
|
204
|
+
| ------------- | --------------------------- | -------------- |
|
|
205
|
+
| `orientation` | `'horizontal'` `'vertical'` | `'horizontal'` |
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
<Separator />
|
|
209
|
+
<Separator orientation="vertical" />
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Tabs
|
|
215
|
+
|
|
216
|
+
```tsx
|
|
217
|
+
import { Tabs, TabsList, TabsTrigger, TabsContent } from "hqui";
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Tabs props:**
|
|
221
|
+
|
|
222
|
+
| Prop | Type | Default |
|
|
223
|
+
| --------------- | ------------------------- | ------- |
|
|
224
|
+
| `defaultValue` | `string` | none |
|
|
225
|
+
| `value` | `string` | none |
|
|
226
|
+
| `onValueChange` | `(value: string) => void` | none |
|
|
227
|
+
|
|
228
|
+
Use `defaultValue` for uncontrolled, or `value` + `onValueChange` for controlled.
|
|
229
|
+
|
|
230
|
+
```tsx
|
|
231
|
+
<Tabs defaultValue="tab1">
|
|
232
|
+
<TabsList>
|
|
233
|
+
<TabsTrigger value="tab1">First</TabsTrigger>
|
|
234
|
+
<TabsTrigger value="tab2">Second</TabsTrigger>
|
|
235
|
+
</TabsList>
|
|
236
|
+
<TabsContent value="tab1">Content for first tab</TabsContent>
|
|
237
|
+
<TabsContent value="tab2">Content for second tab</TabsContent>
|
|
238
|
+
</Tabs>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Switch
|
|
244
|
+
|
|
245
|
+
```tsx
|
|
246
|
+
import { Switch } from "hqui";
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Props:**
|
|
250
|
+
|
|
251
|
+
| Prop | Type | Default |
|
|
252
|
+
| ------- | -------- | ------- |
|
|
253
|
+
| `label` | `string` | none |
|
|
254
|
+
|
|
255
|
+
Also accepts standard input props (`defaultChecked`, `disabled`, `onChange`, etc).
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
<Switch label="Enable dark mode" defaultChecked />
|
|
259
|
+
<Switch label="Notifications" />
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Tooltip
|
|
265
|
+
|
|
266
|
+
```tsx
|
|
267
|
+
import { Tooltip } from "hqui";
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**Props:**
|
|
271
|
+
|
|
272
|
+
| Prop | Type | Default |
|
|
273
|
+
| --------- | ------------------------------------- | -------- |
|
|
274
|
+
| `content` | `ReactNode` | required |
|
|
275
|
+
| `side` | `'top'` `'bottom'` `'left'` `'right'` | `'top'` |
|
|
276
|
+
| `delayMs` | `number` | `200` |
|
|
277
|
+
|
|
278
|
+
Wrap any element. The tooltip appears on hover after `delayMs` milliseconds.
|
|
279
|
+
|
|
280
|
+
```tsx
|
|
281
|
+
<Tooltip content="Delete this item" side="bottom">
|
|
282
|
+
<Button variant="destructive">Delete</Button>
|
|
283
|
+
</Tooltip>
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## ThemeToggle
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
import { ThemeToggle } from "hqui";
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**Props:**
|
|
295
|
+
|
|
296
|
+
| Prop | Type | Default |
|
|
297
|
+
| -------------- | ------------------ | --------------------- |
|
|
298
|
+
| `defaultTheme` | `'light'` `'dark'` | auto-detects from DOM |
|
|
299
|
+
|
|
300
|
+
Renders a button that toggles `class="dark"` on `<html>`. Shows a sun icon in dark mode, moon icon in light mode.
|
|
301
|
+
|
|
302
|
+
```tsx
|
|
303
|
+
<ThemeToggle />
|
|
304
|
+
```
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Design System
|
|
2
|
+
|
|
3
|
+
## Colors
|
|
4
|
+
|
|
5
|
+
Named colors available as CSS variables. Priority order: purple, orange, blue, green, red.
|
|
6
|
+
|
|
7
|
+
| Variable | Value | Hex |
|
|
8
|
+
| ---------- | ------------- | ------- |
|
|
9
|
+
| `--purple` | `258 90% 66%` | #8b5cf6 |
|
|
10
|
+
| `--orange` | `24 95% 53%` | #f97316 |
|
|
11
|
+
| `--blue` | `217 91% 60%` | #3b82f6 |
|
|
12
|
+
| `--green` | `142 71% 45%` | #22c55e |
|
|
13
|
+
| `--red` | `0 84% 60%` | #ef4444 |
|
|
14
|
+
|
|
15
|
+
Use them in Tailwind classes: `bg-[hsl(var(--purple))]` or in CSS: `hsl(var(--purple))`.
|
|
16
|
+
|
|
17
|
+
## Light and Dark Mode
|
|
18
|
+
|
|
19
|
+
The library ships with two themes. Light mode is the default. Dark mode activates when `<html>` has `class="dark"`.
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<html>
|
|
23
|
+
<!-- light mode -->
|
|
24
|
+
<html class="dark">
|
|
25
|
+
<!-- dark mode -->
|
|
26
|
+
</html>
|
|
27
|
+
</html>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use the `ThemeToggle` component to let users switch between themes at runtime.
|
|
31
|
+
|
|
32
|
+
### Light mode variables
|
|
33
|
+
|
|
34
|
+
| Variable | Value | What it looks like |
|
|
35
|
+
| ---------------------- | ---------------- | ------------------ |
|
|
36
|
+
| `--background` | `0 0% 100%` | White |
|
|
37
|
+
| `--foreground` | `240 10% 3.9%` | Near black |
|
|
38
|
+
| `--primary` | `240 5.9% 10%` | Dark |
|
|
39
|
+
| `--primary-foreground` | `0 0% 98%` | White |
|
|
40
|
+
| `--secondary` | `240 4.8% 95.9%` | Light gray |
|
|
41
|
+
| `--muted` | `240 4.8% 95.9%` | Light gray |
|
|
42
|
+
| `--muted-foreground` | `240 3.8% 46.1%` | Medium gray |
|
|
43
|
+
| `--border` | `240 5.9% 90%` | Light border |
|
|
44
|
+
|
|
45
|
+
### Dark mode variables
|
|
46
|
+
|
|
47
|
+
| Variable | Value | What it looks like |
|
|
48
|
+
| ---------------------- | ---------------- | ------------------ |
|
|
49
|
+
| `--background` | `240 10% 3.9%` | Near black |
|
|
50
|
+
| `--foreground` | `0 0% 98%` | White |
|
|
51
|
+
| `--primary` | `0 0% 98%` | White |
|
|
52
|
+
| `--primary-foreground` | `240 5.9% 10%` | Dark |
|
|
53
|
+
| `--secondary` | `240 3.7% 15.6%` | Dark gray |
|
|
54
|
+
| `--muted` | `240 3.7% 15.6%` | Dark gray |
|
|
55
|
+
| `--muted-foreground` | `240 5% 64.9%` | Medium gray |
|
|
56
|
+
| `--border` | `240 3.7% 15.6%` | Dark border |
|
|
57
|
+
|
|
58
|
+
### Using variables
|
|
59
|
+
|
|
60
|
+
In Tailwind: `bg-background`, `text-foreground`, `border-border`, etc.
|
|
61
|
+
|
|
62
|
+
In CSS: `hsl(var(--background))`, `hsl(var(--foreground))`, etc.
|
|
63
|
+
|
|
64
|
+
## Text Selection
|
|
65
|
+
|
|
66
|
+
Selected text always shows white background with black text:
|
|
67
|
+
|
|
68
|
+
```css
|
|
69
|
+
::selection {
|
|
70
|
+
background: white;
|
|
71
|
+
color: black;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Border Radius
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
--radius: 0.5rem
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Tailwind classes: `rounded-lg` (0.5rem), `rounded-md` (0.375rem), `rounded-sm` (0.25rem).
|
|
82
|
+
|
|
83
|
+
## Typography
|
|
84
|
+
|
|
85
|
+
No fonts are bundled. The library uses the system font stack. If you want Inter, load it in your app.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Extended Components
|
|
2
|
+
|
|
3
|
+
Built on top of the core components.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Counter
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Counter } from "hqui";
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Props:**
|
|
14
|
+
|
|
15
|
+
| Prop | Type | Default |
|
|
16
|
+
| -------------- | ------------------------- | ------- |
|
|
17
|
+
| `initialValue` | `number` | `0` |
|
|
18
|
+
| `min` | `number` | `0` |
|
|
19
|
+
| `max` | `number` | `99` |
|
|
20
|
+
| `onChange` | `(value: number) => void` | none |
|
|
21
|
+
|
|
22
|
+
A number input with minus and plus buttons.
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
<Counter initialValue={3} min={1} max={20} />
|
|
26
|
+
<Counter initialValue={0} onChange={(val) => console.log(val)} />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## ArrowButton
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { ArrowButton } from "hqui";
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Props:**
|
|
38
|
+
|
|
39
|
+
| Prop | Type | Default |
|
|
40
|
+
| ----------- | ---------------------- | ----------- |
|
|
41
|
+
| `direction` | `'left'` `'right'` | required |
|
|
42
|
+
| `text` | `string` | none |
|
|
43
|
+
| `variant` | same as Button variant | `'primary'` |
|
|
44
|
+
|
|
45
|
+
A button with an arrow icon. If `text` is provided, it shows text next to the arrow.
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
<ArrowButton direction="left" />
|
|
49
|
+
<ArrowButton direction="right" text="Next" />
|
|
50
|
+
<ArrowButton direction="left" text="Back" variant="outline" />
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## ChooseList
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { ChooseList } from "hqui";
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Props:**
|
|
62
|
+
|
|
63
|
+
| Prop | Type | Default |
|
|
64
|
+
| -------------- | ------------------------------------ | ------- |
|
|
65
|
+
| `options` | `{ label: string, value: string }[]` | `[]` |
|
|
66
|
+
| `defaultValue` | `string` | none |
|
|
67
|
+
| `onChange` | `(e: ChangeEvent) => void` | none |
|
|
68
|
+
|
|
69
|
+
A styled dropdown select.
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
<ChooseList
|
|
73
|
+
options={[
|
|
74
|
+
{ label: "React", value: "react" },
|
|
75
|
+
{ label: "Vue", value: "vue" },
|
|
76
|
+
{ label: "Svelte", value: "svelte" },
|
|
77
|
+
]}
|
|
78
|
+
defaultValue="react"
|
|
79
|
+
/>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Popup
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { Popup } from "hqui";
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Props:**
|
|
91
|
+
|
|
92
|
+
| Prop | Type | Default |
|
|
93
|
+
| --------- | ------------ | -------- |
|
|
94
|
+
| `open` | `boolean` | `false` |
|
|
95
|
+
| `onClose` | `() => void` | required |
|
|
96
|
+
| `title` | `string` | none |
|
|
97
|
+
|
|
98
|
+
A modal dialog. Press Escape or click the backdrop to close. Body scroll is locked while open.
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
const [open, setOpen] = useState(false)
|
|
102
|
+
|
|
103
|
+
<Button onClick={() => setOpen(true)}>Open</Button>
|
|
104
|
+
|
|
105
|
+
<Popup open={open} onClose={() => setOpen(false)} title="Confirm">
|
|
106
|
+
<p>Are you sure?</p>
|
|
107
|
+
<div className="flex gap-2 mt-4">
|
|
108
|
+
<Button variant="ghost" onClick={() => setOpen(false)}>Cancel</Button>
|
|
109
|
+
<Button onClick={() => setOpen(false)}>Confirm</Button>
|
|
110
|
+
</div>
|
|
111
|
+
</Popup>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## StatusBar
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import { StatusBar } from "hqui";
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Props:**
|
|
123
|
+
|
|
124
|
+
| Prop | Type | Default |
|
|
125
|
+
| ---------- | ------------------------------------------------- | ---------------- |
|
|
126
|
+
| `status` | `'idle'` `'working'` `'error'` `'ready'` `'live'` | `'idle'` |
|
|
127
|
+
| `label` | `string` | uses status name |
|
|
128
|
+
| `children` | `ReactNode` | none |
|
|
129
|
+
|
|
130
|
+
Shows a colored dot next to a label. Children are shown after a divider.
|
|
131
|
+
|
|
132
|
+
**Colors by status:**
|
|
133
|
+
|
|
134
|
+
| Status | Dot color | Use for |
|
|
135
|
+
| --------- | ---------------- | ----------------------------- |
|
|
136
|
+
| `ready` | Purple | Online, active, connected |
|
|
137
|
+
| `live` | Purple (pulsing) | Live, real-time |
|
|
138
|
+
| `working` | Blue (pulsing) | Processing, deploying |
|
|
139
|
+
| `idle` | Gray | Away, inactive |
|
|
140
|
+
| `error` | Orange | Offline, disconnected, failed |
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
<StatusBar status="ready" label="Online" />
|
|
144
|
+
<StatusBar status="error" label="Offline" />
|
|
145
|
+
<StatusBar status="working" label="Deploying" />
|
|
146
|
+
<StatusBar status="live" label="Live">us-east-1</StatusBar>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## WeekViewCalendar
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
import { WeekViewCalendar } from "hqui";
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Props:**
|
|
158
|
+
|
|
159
|
+
| Prop | Type | Default |
|
|
160
|
+
| ----------- | ----------------- | ------- |
|
|
161
|
+
| `events` | `CalendarEvent[]` | `[]` |
|
|
162
|
+
| `startHour` | `number` | `8` |
|
|
163
|
+
| `endHour` | `number` | `18` |
|
|
164
|
+
|
|
165
|
+
**CalendarEvent:**
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
{
|
|
169
|
+
id: string;
|
|
170
|
+
dayIndex: number; // 0 = Sunday, 1 = Monday, ..., 6 = Saturday
|
|
171
|
+
startHour: number; // 9.5 means 9:30 AM
|
|
172
|
+
durationHours: number; // 1.5 means 1 hour 30 minutes
|
|
173
|
+
title: string;
|
|
174
|
+
color: string; // any CSS color
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
<WeekViewCalendar
|
|
180
|
+
events={[
|
|
181
|
+
{
|
|
182
|
+
id: "1",
|
|
183
|
+
dayIndex: 1,
|
|
184
|
+
startHour: 9,
|
|
185
|
+
durationHours: 2,
|
|
186
|
+
title: "Standup",
|
|
187
|
+
color: "hsl(var(--purple))",
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: "2",
|
|
191
|
+
dayIndex: 3,
|
|
192
|
+
startHour: 14,
|
|
193
|
+
durationHours: 1,
|
|
194
|
+
title: "Review",
|
|
195
|
+
color: "hsl(var(--orange))",
|
|
196
|
+
},
|
|
197
|
+
]}
|
|
198
|
+
startHour={8}
|
|
199
|
+
endHour={18}
|
|
200
|
+
/>
|
|
201
|
+
```
|