@dnotrever2/super-kit 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 +666 -0
- package/dist/Badge/Badge.d.ts +15 -0
- package/dist/Badge/index.d.ts +1 -0
- package/dist/Button/Button.d.ts +17 -0
- package/dist/Button/index.d.ts +1 -0
- package/dist/Card/Card.d.ts +33 -0
- package/dist/Card/index.d.ts +1 -0
- package/dist/Input/Input.d.ts +43 -0
- package/dist/Input/index.d.ts +1 -0
- package/dist/Markers/Markers.d.ts +38 -0
- package/dist/Markers/index.d.ts +1 -0
- package/dist/Menu/Menu.d.ts +23 -0
- package/dist/Menu/index.d.ts +1 -0
- package/dist/Modal/Modal.d.ts +19 -0
- package/dist/Modal/index.d.ts +1 -0
- package/dist/Popover/Popover.d.ts +17 -0
- package/dist/Popover/index.d.ts +1 -0
- package/dist/PushButton/PushButton.d.ts +19 -0
- package/dist/PushButton/index.d.ts +1 -0
- package/dist/Scrollable/Scrollable.d.ts +16 -0
- package/dist/Scrollable/index.d.ts +1 -0
- package/dist/Select/Select.d.ts +44 -0
- package/dist/Select/index.d.ts +1 -0
- package/dist/Spinner/Spinner.d.ts +13 -0
- package/dist/Spinner/index.d.ts +1 -0
- package/dist/Textarea/Textarea.d.ts +23 -0
- package/dist/Textarea/index.d.ts +1 -0
- package/dist/Toast/Toast.d.ts +28 -0
- package/dist/Toast/index.d.ts +1 -0
- package/dist/Tooltip/Tooltip.d.ts +13 -0
- package/dist/Tooltip/index.d.ts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useControlledState.d.ts +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/super-kit.cjs +2 -0
- package/dist/super-kit.cjs.map +1 -0
- package/dist/super-kit.css +1 -0
- package/dist/super-kit.js +1239 -0
- package/dist/super-kit.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/mask.d.ts +6 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,666 @@
|
|
|
1
|
+
# @dnotrever2/super-kit
|
|
2
|
+
|
|
3
|
+
React component library for the **Verazor** design system. Dark, layered, technical aesthetic built on Geist + Geist Mono. Zero runtime dependencies.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @dnotrever2/super-kit
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Peer dependencies** — install if not already present:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install react react-dom
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Setup
|
|
22
|
+
|
|
23
|
+
Import the global stylesheet once at your app's entry point. It provides all design tokens, base resets, and scrollbar utilities:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import "@dnotrever2/super-kit/dist/styles/index.css";
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
> CSS modules are injected into the JS bundle by Vite — there is no separate `.css` output per component. Only the global stylesheet needs a manual import.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Components
|
|
34
|
+
|
|
35
|
+
### Badge
|
|
36
|
+
|
|
37
|
+
Status labels, tags, counts, and version strings.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { Badge } from "@dnotrever2/super-kit";
|
|
41
|
+
|
|
42
|
+
<Badge variant="success">Deployed</Badge>
|
|
43
|
+
<Badge variant="danger" pill>Failed</Badge>
|
|
44
|
+
<Badge variant="dot" dotColor="var(--success)">Online</Badge>
|
|
45
|
+
<Badge variant="count">12</Badge>
|
|
46
|
+
<Badge variant="version">v2.4.1</Badge>
|
|
47
|
+
<Badge dismissable onDismiss={() => {}}>api-gateway</Badge>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
| Prop | Type | Default |
|
|
51
|
+
| ------------- | ------------------------------------------------------------------------------------------------------------------------------- | --------------- |
|
|
52
|
+
| `variant` | `"neutral" \| "accent" \| "outline" \| "success" \| "warning" \| "danger" \| "info" \| "count" \| "mono" \| "version" \| "dot"` | `"neutral"` |
|
|
53
|
+
| `icon` | `ReactNode` | — |
|
|
54
|
+
| `pill` | `boolean` | `false` |
|
|
55
|
+
| `dismissable` | `boolean` | `false` |
|
|
56
|
+
| `onDismiss` | `() => void` | — |
|
|
57
|
+
| `dotColor` | `string` | `var(--accent)` |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### Button
|
|
62
|
+
|
|
63
|
+
Standard action button with semantic variants and loading state.
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import { Button } from "@dnotrever2/super-kit";
|
|
67
|
+
|
|
68
|
+
<Button variant="primary" onClick={deploy}>Deploy</Button>
|
|
69
|
+
<Button variant="success" icon={<CheckIcon />}>Approve</Button>
|
|
70
|
+
<Button variant="danger">Delete</Button>
|
|
71
|
+
<Button variant="primary" loading icon={<Spinner size="sm" onAccent />}>
|
|
72
|
+
Deploying
|
|
73
|
+
</Button>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
| Prop | Type | Default |
|
|
77
|
+
| ---------- | --------------------------------------------------------------------------- | ------------- |
|
|
78
|
+
| `variant` | `"primary" \| "secondary" \| "ghost" \| "danger" \| "success" \| "warning"` | `"secondary"` |
|
|
79
|
+
| `size` | `"sm" \| "md" \| "lg"` | `"md"` |
|
|
80
|
+
| `icon` | `ReactNode` | — |
|
|
81
|
+
| `loading` | `boolean` | `false` |
|
|
82
|
+
| `disabled` | `boolean` | `false` |
|
|
83
|
+
|
|
84
|
+
Forwards a `ref` to the underlying `<button>`. Accepts all native button attributes.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### Card
|
|
89
|
+
|
|
90
|
+
Container surface with optional tilt hover effect and close button.
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
import { Card, CardHeader, CardStat } from "@dnotrever2/super-kit";
|
|
94
|
+
|
|
95
|
+
<Card padding="md" tilt onClose={() => setVisible(false)}>
|
|
96
|
+
<CardHeader
|
|
97
|
+
icon={<DatabaseIcon />}
|
|
98
|
+
title="orders-db"
|
|
99
|
+
subtitle="postgres · us-east-1"
|
|
100
|
+
/>
|
|
101
|
+
<CardStat value="2.4" unit="ms" delta="-12%" deltaDirection="positive" />
|
|
102
|
+
</Card>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Card props**
|
|
106
|
+
|
|
107
|
+
| Prop | Type | Default |
|
|
108
|
+
| --------------- | ----------------------------------------- | --------------------------------------------------------------- |
|
|
109
|
+
| `padding` | `"none" \| "sm" \| "md" \| "lg"` | `"md"` |
|
|
110
|
+
| `tilt` | `boolean` | `false` — hover lifts the card with a subtle 3D tilt and shadow |
|
|
111
|
+
| `onClose` | `() => void` | — — renders a × button (fades in on hover) |
|
|
112
|
+
| `closeBtnProps` | `ButtonHTMLAttributes<HTMLButtonElement>` | — |
|
|
113
|
+
|
|
114
|
+
**CardHeader props**
|
|
115
|
+
|
|
116
|
+
| Prop | Type |
|
|
117
|
+
| ---------- | ---------------------- |
|
|
118
|
+
| `title` | `ReactNode` (required) |
|
|
119
|
+
| `subtitle` | `ReactNode` |
|
|
120
|
+
| `icon` | `ReactNode` |
|
|
121
|
+
|
|
122
|
+
**CardStat props**
|
|
123
|
+
|
|
124
|
+
| Prop | Type | Default |
|
|
125
|
+
| ---------------- | --------------------------------------- | ------------ |
|
|
126
|
+
| `value` | `ReactNode` (required) | — |
|
|
127
|
+
| `unit` | `string` | — |
|
|
128
|
+
| `delta` | `string` | — |
|
|
129
|
+
| `deltaDirection` | `"positive" \| "negative" \| "neutral"` | `"positive"` |
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### Input
|
|
134
|
+
|
|
135
|
+
Text input with label, icon, mask, and clear button.
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import { Input } from "@dnotrever2/super-kit";
|
|
139
|
+
|
|
140
|
+
// Basic
|
|
141
|
+
<Input label="name" placeholder="api-gateway" clearable />
|
|
142
|
+
|
|
143
|
+
// With icon
|
|
144
|
+
<Input label="search" icon={<SearchIcon />} placeholder="Search services" />
|
|
145
|
+
|
|
146
|
+
// With mask — only digits allowed, formatted as 000-0000
|
|
147
|
+
<Input
|
|
148
|
+
label="code"
|
|
149
|
+
mask="XXX-XXXX"
|
|
150
|
+
maskAllowedPattern={/\d/}
|
|
151
|
+
placeholder="000-0000"
|
|
152
|
+
onValueChange={({ value, rawValue }) => console.log(rawValue)}
|
|
153
|
+
/>
|
|
154
|
+
|
|
155
|
+
// Select all on focus, right-aligned text
|
|
156
|
+
<Input selectOnFocus textAlign="right" defaultValue="127.0.0.1" />
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**How masks work**
|
|
160
|
+
|
|
161
|
+
- `mask` — format string where every character is a literal except positions matched by `maskAllowedPattern`. Example: `"(XX) XXXXX-XXXX"` for Brazilian phone numbers.
|
|
162
|
+
- `maskAllowedPattern` — `RegExp` that each typed character must match (default: any character). Use `/\d/` for digits-only, `/[A-Za-z]/` for letters-only.
|
|
163
|
+
- `maskPlaceholder` — character used to fill empty mask positions (e.g. `"_"`). If omitted, empty positions are left blank.
|
|
164
|
+
- `onValueChange` receives both `value` (formatted with mask) and `rawValue` (mask characters stripped).
|
|
165
|
+
|
|
166
|
+
| Prop | Type | Default |
|
|
167
|
+
| ------------------------ | --------------------------------------- | ------- |
|
|
168
|
+
| `label` | `string` | — |
|
|
169
|
+
| `icon` | `ReactNode` | — |
|
|
170
|
+
| `mask` | `string` | — |
|
|
171
|
+
| `maskAllowedPattern` | `RegExp` | — |
|
|
172
|
+
| `maskPlaceholder` | `string` | — |
|
|
173
|
+
| `clearable` | `boolean` | `false` |
|
|
174
|
+
| `selectOnFocus` | `boolean` | `false` |
|
|
175
|
+
| `textAlign` | `"left" \| "center" \| "right"` | — |
|
|
176
|
+
| `value` / `defaultValue` | `string` | `""` |
|
|
177
|
+
| `onChange` | `ChangeEvent<HTMLInputElement>` | — |
|
|
178
|
+
| `onValueChange` | `(change: { value, rawValue }) => void` | — |
|
|
179
|
+
| `wrapperProps` | `HTMLAttributes<HTMLSpanElement>` | — |
|
|
180
|
+
| `fieldProps` | `HTMLAttributes<HTMLDivElement>` | — |
|
|
181
|
+
|
|
182
|
+
Forwards a `ref` to the underlying `<input>`.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
### Markers
|
|
187
|
+
|
|
188
|
+
Form selection primitives: Checkbox, Radio, and Switch.
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
import { Checkbox, Radio, RadioGroup, Switch } from "@dnotrever2/super-kit";
|
|
192
|
+
|
|
193
|
+
<Checkbox label="Auto-deploy" checked={checked} onChange={setChecked} />
|
|
194
|
+
<Checkbox label="Partial" indeterminate />
|
|
195
|
+
<Checkbox label="Disabled" disabled />
|
|
196
|
+
|
|
197
|
+
<RadioGroup>
|
|
198
|
+
<Radio label="main → production" value="prod" checked={v === "prod"} onChange={setV} />
|
|
199
|
+
<Radio label="main → staging" value="staging" checked={v === "staging"} onChange={setV} />
|
|
200
|
+
</RadioGroup>
|
|
201
|
+
|
|
202
|
+
<Switch label="SSO required" checked={on} onChange={setOn} />
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Checkbox / Switch props**
|
|
206
|
+
|
|
207
|
+
| Prop | Type |
|
|
208
|
+
| ---------------- | ---------------------------- |
|
|
209
|
+
| `label` | `ReactNode` |
|
|
210
|
+
| `checked` | `boolean` |
|
|
211
|
+
| `defaultChecked` | `boolean` |
|
|
212
|
+
| `indeterminate` | `boolean` (Checkbox only) |
|
|
213
|
+
| `disabled` | `boolean` |
|
|
214
|
+
| `onChange` | `(checked: boolean) => void` |
|
|
215
|
+
|
|
216
|
+
**Radio props**
|
|
217
|
+
|
|
218
|
+
| Prop | Type |
|
|
219
|
+
| ---------- | ------------------------- |
|
|
220
|
+
| `label` | `ReactNode` |
|
|
221
|
+
| `value` | `string` |
|
|
222
|
+
| `checked` | `boolean` |
|
|
223
|
+
| `disabled` | `boolean` |
|
|
224
|
+
| `onChange` | `(value: string) => void` |
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
### Menu
|
|
229
|
+
|
|
230
|
+
Composable dropdown menu — render inside a positioned container toggled by your own trigger button.
|
|
231
|
+
|
|
232
|
+
```tsx
|
|
233
|
+
import { Menu, MenuItem, MenuSeparator } from "@dnotrever2/super-kit";
|
|
234
|
+
|
|
235
|
+
const [open, setOpen] = useState(false);
|
|
236
|
+
|
|
237
|
+
<div style={{ position: "relative", display: "inline-block" }}>
|
|
238
|
+
<Button onClick={() => setOpen(o => !o)}>Options</Button>
|
|
239
|
+
{open && (
|
|
240
|
+
<div style={{ position: "absolute", top: "calc(100% + 4px)", left: 0, zIndex: 20 }}>
|
|
241
|
+
<Menu style={{ width: 240 }}>
|
|
242
|
+
<MenuItem icon={<PlayIcon />} kbd="⌘R">Run workflow</MenuItem>
|
|
243
|
+
<MenuItem icon={<CopyIcon />}>Duplicate</MenuItem>
|
|
244
|
+
<MenuSeparator />
|
|
245
|
+
<MenuItem icon={<TrashIcon />} danger>Delete</MenuItem>
|
|
246
|
+
</Menu>
|
|
247
|
+
</div>
|
|
248
|
+
)}
|
|
249
|
+
</div>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**MenuItem props**
|
|
253
|
+
|
|
254
|
+
| Prop | Type | Default |
|
|
255
|
+
| ---------- | ----------- | ------------------------ |
|
|
256
|
+
| `icon` | `ReactNode` | — |
|
|
257
|
+
| `kbd` | `string` | — keyboard shortcut hint |
|
|
258
|
+
| `active` | `boolean` | `false` |
|
|
259
|
+
| `danger` | `boolean` | `false` |
|
|
260
|
+
| `disabled` | `boolean` | `false` |
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
### Modal
|
|
265
|
+
|
|
266
|
+
Dialog overlay with backdrop. Renders as a `div`-based panel, not `<dialog>`.
|
|
267
|
+
|
|
268
|
+
```tsx
|
|
269
|
+
import { Modal } from "@dnotrever2/super-kit";
|
|
270
|
+
|
|
271
|
+
<Modal
|
|
272
|
+
open={isOpen}
|
|
273
|
+
title="Confirm delete"
|
|
274
|
+
onClose={() => setIsOpen(false)}
|
|
275
|
+
>
|
|
276
|
+
<p>This action cannot be undone.</p>
|
|
277
|
+
</Modal>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
| Prop | Type | Default |
|
|
281
|
+
| ---------- | ------------ | ------- |
|
|
282
|
+
| `open` | `boolean` | `false` |
|
|
283
|
+
| `title` | `ReactNode` | — |
|
|
284
|
+
| `onClose` | `() => void` | — |
|
|
285
|
+
| `children` | `ReactNode` | — |
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
### Popover
|
|
290
|
+
|
|
291
|
+
Anchored floating panel, controlled or uncontrolled.
|
|
292
|
+
|
|
293
|
+
```tsx
|
|
294
|
+
import { Popover } from "@dnotrever2/super-kit";
|
|
295
|
+
|
|
296
|
+
<Popover
|
|
297
|
+
trigger={<Button variant="secondary">Settings</Button>}
|
|
298
|
+
title="Connection"
|
|
299
|
+
side="bottom-start"
|
|
300
|
+
>
|
|
301
|
+
<p>Content here</p>
|
|
302
|
+
</Popover>
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
| Prop | Type | Default |
|
|
306
|
+
| ----------------- | ------------------------------------------------------------ | ---------------- |
|
|
307
|
+
| `trigger` | `ReactNode` | — |
|
|
308
|
+
| `title` | `ReactNode` | — |
|
|
309
|
+
| `side` | `"bottom-start" \| "bottom-end" \| "top-start" \| "top-end"` | `"bottom-start"` |
|
|
310
|
+
| `open` | `boolean` | — (controlled) |
|
|
311
|
+
| `defaultOpen` | `boolean` | `false` |
|
|
312
|
+
| `showCloseButton` | `boolean` | `true` |
|
|
313
|
+
| `onOpenChange` | `(open: boolean) => void` | — |
|
|
314
|
+
| `popProps` | `HTMLAttributes<HTMLDivElement>` | — |
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
### PushButton
|
|
319
|
+
|
|
320
|
+
Toggle button and grouped toolbar segments.
|
|
321
|
+
|
|
322
|
+
```tsx
|
|
323
|
+
import { PushButton, PushButtonGroup } from "@dnotrever2/super-kit";
|
|
324
|
+
|
|
325
|
+
// Standalone toggle
|
|
326
|
+
<PushButton on={active} accent onClick={() => setActive(a => !a)} icon={<GridIcon />} />
|
|
327
|
+
|
|
328
|
+
// Grouped toolbar
|
|
329
|
+
<PushButtonGroup>
|
|
330
|
+
<PushButton on={view === "list"} onClick={() => setView("list")}>List</PushButton>
|
|
331
|
+
<PushButton on={view === "grid"} onClick={() => setView("grid")}>Grid</PushButton>
|
|
332
|
+
</PushButtonGroup>
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**PushButton props**
|
|
336
|
+
|
|
337
|
+
| Prop | Type | Default |
|
|
338
|
+
| ---------- | ----------- | --------------------------------------------- |
|
|
339
|
+
| `on` | `boolean` | `false` |
|
|
340
|
+
| `accent` | `boolean` | `false` — accent color when active |
|
|
341
|
+
| `solo` | `boolean` | `false` — standalone (no group border fusion) |
|
|
342
|
+
| `icon` | `ReactNode` | — |
|
|
343
|
+
| `disabled` | `boolean` | `false` |
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
### Scrollable
|
|
348
|
+
|
|
349
|
+
Scrollable container with custom styled scrollbar.
|
|
350
|
+
|
|
351
|
+
```tsx
|
|
352
|
+
import { Scrollable } from "@dnotrever2/super-kit";
|
|
353
|
+
|
|
354
|
+
<Scrollable height={200} track arrows scrollbarSize={8}>
|
|
355
|
+
{items.map(item => <div key={item}>{item}</div>)}
|
|
356
|
+
</Scrollable>
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
| Prop | Type | Default |
|
|
360
|
+
| --------------- | -------------------------------------- | ---------------------------------------------------- |
|
|
361
|
+
| `direction` | `"vertical" \| "horizontal" \| "both"` | `"vertical"` |
|
|
362
|
+
| `track` | `boolean` | `false` — shows a visible track behind the thumb |
|
|
363
|
+
| `arrows` | `boolean` | `false` — shows arrow buttons (WebKit only) |
|
|
364
|
+
| `scrollbarSize` | `number` | `10` — scrollbar track width in pixels (WebKit only) |
|
|
365
|
+
| `height` | `string \| number` | — |
|
|
366
|
+
|
|
367
|
+
The scrollbar classes (`sb`, `sb-track`, `sb-arrows`) are also available as global CSS classes — apply them directly to any scrollable element.
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
### Select
|
|
372
|
+
|
|
373
|
+
Single or multi-value dropdown with optional search and clearable state.
|
|
374
|
+
|
|
375
|
+
```tsx
|
|
376
|
+
import { Select } from "@dnotrever2/super-kit";
|
|
377
|
+
|
|
378
|
+
const options = [
|
|
379
|
+
{ value: "us-east-1", label: "US East (N. Virginia)" },
|
|
380
|
+
{ value: "eu-west-1", label: "EU West (Ireland)" },
|
|
381
|
+
];
|
|
382
|
+
|
|
383
|
+
// Single
|
|
384
|
+
<Select label="region" options={options} onValueChange={(v) => setRegion(v)} />
|
|
385
|
+
|
|
386
|
+
// Multi + searchable
|
|
387
|
+
<Select
|
|
388
|
+
label="regions"
|
|
389
|
+
options={options}
|
|
390
|
+
multiple
|
|
391
|
+
searchable
|
|
392
|
+
clearable
|
|
393
|
+
onValueChange={(values) => setRegions(values)}
|
|
394
|
+
/>
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
| Prop | Type | Default |
|
|
398
|
+
| ------------------------ | -------------------------------------- | ------------------------- |
|
|
399
|
+
| `options` | `{ value, label, meta?, disabled? }[]` | required |
|
|
400
|
+
| `value` / `defaultValue` | `string \| string[] \| null` | `null` |
|
|
401
|
+
| `multiple` | `boolean` | `false` |
|
|
402
|
+
| `searchable` | `boolean` | `false` |
|
|
403
|
+
| `clearable` | `boolean` | `false` |
|
|
404
|
+
| `disabled` | `boolean` | `false` |
|
|
405
|
+
| `placeholder` | `string` | `"Select"` |
|
|
406
|
+
| `label` | `string` | — |
|
|
407
|
+
| `onValueChange` | `(value, selectedOptions) => void` | — |
|
|
408
|
+
| `filterOptions` | `(options, search) => options` | built-in case-insensitive |
|
|
409
|
+
| `isLoading` | `boolean` | `false` |
|
|
410
|
+
| `loadingLabel` | `string` | `"Loading..."` |
|
|
411
|
+
| `emptyLabel` | `string` | `"No options found"` |
|
|
412
|
+
|
|
413
|
+
Forwards a `ref` to the root `<div>`.
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
### Spinner
|
|
418
|
+
|
|
419
|
+
Loading indicator in three styles.
|
|
420
|
+
|
|
421
|
+
```tsx
|
|
422
|
+
import { Spinner } from "@dnotrever2/super-kit";
|
|
423
|
+
|
|
424
|
+
<Spinner variant="ring" size="md" />
|
|
425
|
+
<Spinner variant="dots" />
|
|
426
|
+
<Spinner variant="bar" />
|
|
427
|
+
|
|
428
|
+
// Inside a primary button (white on accent background)
|
|
429
|
+
<Button variant="primary" loading icon={<Spinner size="sm" onAccent />}>
|
|
430
|
+
Deploying
|
|
431
|
+
</Button>
|
|
432
|
+
|
|
433
|
+
// Subdued — when the accent blue is too visually dominant
|
|
434
|
+
<Spinner muted />
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
| Prop | Type | Default |
|
|
438
|
+
| ---------- | --------------------------- | --------------------------------------------------------- |
|
|
439
|
+
| `variant` | `"ring" \| "dots" \| "bar"` | `"ring"` |
|
|
440
|
+
| `size` | `"sm" \| "md" \| "lg"` | `"md"` — ring only |
|
|
441
|
+
| `muted` | `boolean` | `false` — gray arc instead of accent blue |
|
|
442
|
+
| `onAccent` | `boolean` | `false` — white arc for use on accent-colored backgrounds |
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
### Textarea
|
|
447
|
+
|
|
448
|
+
Multi-line text input with custom scrollbar, character count, and clear button.
|
|
449
|
+
|
|
450
|
+
```tsx
|
|
451
|
+
import { Textarea } from "@dnotrever2/super-kit";
|
|
452
|
+
|
|
453
|
+
<Textarea
|
|
454
|
+
label="Description"
|
|
455
|
+
placeholder="Describe the deployment..."
|
|
456
|
+
maxLength={500}
|
|
457
|
+
helpText="Markdown supported"
|
|
458
|
+
clearable
|
|
459
|
+
/>
|
|
460
|
+
|
|
461
|
+
// Monospace (for code / config)
|
|
462
|
+
<Textarea label="config.yaml" mono />
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
| Prop | Type | Default |
|
|
466
|
+
| ------------------------ | ------------------------- | ------- |
|
|
467
|
+
| `label` | `string` | — |
|
|
468
|
+
| `helpText` | `string` | — |
|
|
469
|
+
| `maxLength` | `number` | — |
|
|
470
|
+
| `clearable` | `boolean` | `false` |
|
|
471
|
+
| `mono` | `boolean` | `false` |
|
|
472
|
+
| `value` / `defaultValue` | `string` | `""` |
|
|
473
|
+
| `onValueChange` | `(value: string) => void` | — |
|
|
474
|
+
|
|
475
|
+
Forwards a `ref` to the underlying `<textarea>`.
|
|
476
|
+
|
|
477
|
+
---
|
|
478
|
+
|
|
479
|
+
### Toast
|
|
480
|
+
|
|
481
|
+
Notification toasts via context provider and `useToast` hook.
|
|
482
|
+
|
|
483
|
+
```tsx
|
|
484
|
+
// 1. Wrap your app
|
|
485
|
+
import { ToastProvider } from "@dnotrever2/super-kit";
|
|
486
|
+
|
|
487
|
+
<ToastProvider>
|
|
488
|
+
<App />
|
|
489
|
+
</ToastProvider>
|
|
490
|
+
|
|
491
|
+
// 2. Trigger from anywhere
|
|
492
|
+
import { useToast } from "@dnotrever2/super-kit";
|
|
493
|
+
|
|
494
|
+
function DeployButton() {
|
|
495
|
+
const { toast } = useToast();
|
|
496
|
+
|
|
497
|
+
return (
|
|
498
|
+
<Button onClick={() => toast({ variant: "ok", title: "Deployed", message: "v2.4.1 is live" })}>
|
|
499
|
+
Deploy
|
|
500
|
+
</Button>
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
**`toast(options)` options**
|
|
506
|
+
|
|
507
|
+
| Field | Type | Default |
|
|
508
|
+
| ---------- | ---------------------------------------- | --------------------------- |
|
|
509
|
+
| `variant` | `"ok" \| "error" \| "warning" \| "info"` | required |
|
|
510
|
+
| `title` | `string` | required |
|
|
511
|
+
| `message` | `string` | — |
|
|
512
|
+
| `duration` | `number` (ms) | `4000` — set `0` to persist |
|
|
513
|
+
|
|
514
|
+
`toast()` returns the toast `id`. Dismiss manually with `dismiss(id)`.
|
|
515
|
+
|
|
516
|
+
---
|
|
517
|
+
|
|
518
|
+
### Tooltip
|
|
519
|
+
|
|
520
|
+
Hover/focus tooltip above or below a child element.
|
|
521
|
+
|
|
522
|
+
```tsx
|
|
523
|
+
import { Tooltip } from "@dnotrever2/super-kit";
|
|
524
|
+
|
|
525
|
+
<Tooltip content="Deploy to production" side="top">
|
|
526
|
+
<Button variant="primary">Deploy</Button>
|
|
527
|
+
</Tooltip>
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
| Prop | Type | Default |
|
|
531
|
+
| -------------- | --------------------------------- | -------- |
|
|
532
|
+
| `content` | `ReactNode` | required |
|
|
533
|
+
| `side` | `"top" \| "bottom"` | `"top"` |
|
|
534
|
+
| `disabled` | `boolean` | `false` |
|
|
535
|
+
| `wrapperProps` | `HTMLAttributes<HTMLSpanElement>` | — |
|
|
536
|
+
|
|
537
|
+
---
|
|
538
|
+
|
|
539
|
+
## Design tokens
|
|
540
|
+
|
|
541
|
+
All tokens are CSS custom properties defined in `src/styles/index.css` and available globally via `var(--token)`.
|
|
542
|
+
|
|
543
|
+
### Surfaces
|
|
544
|
+
|
|
545
|
+
| Token | Value |
|
|
546
|
+
| -------- | -------------------------------- |
|
|
547
|
+
| `--bg-0` | `#0a0b0e` — deepest background |
|
|
548
|
+
| `--bg-1` | `#15181f` — card / input surface |
|
|
549
|
+
| `--bg-2` | `#1f242c` — hover state |
|
|
550
|
+
| `--bg-3` | `#2a2f38` — popover / selected |
|
|
551
|
+
|
|
552
|
+
### Foreground
|
|
553
|
+
|
|
554
|
+
| Token | Value |
|
|
555
|
+
| ---------------- | ----------------------------- |
|
|
556
|
+
| `--fg-1` | `#f1f3f5` — primary text |
|
|
557
|
+
| `--fg-2` | `#aab2bd` — secondary text |
|
|
558
|
+
| `--fg-3` | `#6b7280` — muted / labels |
|
|
559
|
+
| `--fg-4` | `#4a505a` — placeholder |
|
|
560
|
+
| `--fg-on-accent` | `#ffffff` — text on accent bg |
|
|
561
|
+
|
|
562
|
+
### Accent & semantic
|
|
563
|
+
|
|
564
|
+
| Token | |
|
|
565
|
+
| ------------------------------ | ---------------------- |
|
|
566
|
+
| `--accent` | Blue `#3d7eff` |
|
|
567
|
+
| `--accent-hover` | `#5b95ff` |
|
|
568
|
+
| `--accent-soft` | `rgba(61,126,255,.14)` |
|
|
569
|
+
| `--accent-ring` | `rgba(61,126,255,.35)` |
|
|
570
|
+
| `--success` / `--success-soft` | Green `#3ecf8e` |
|
|
571
|
+
| `--warning` / `--warning-soft` | Yellow `#facc15` |
|
|
572
|
+
| `--danger` / `--danger-soft` | Red `#f0556a` |
|
|
573
|
+
|
|
574
|
+
### Typography
|
|
575
|
+
|
|
576
|
+
| Token | Value |
|
|
577
|
+
| ------------- | -------------------------- |
|
|
578
|
+
| `--font-sans` | Geist, system-ui |
|
|
579
|
+
| `--font-mono` | Geist Mono, JetBrains Mono |
|
|
580
|
+
|
|
581
|
+
### Spacing (4px base)
|
|
582
|
+
|
|
583
|
+
`--s-1` (4px) · `--s-2` (8px) · `--s-3` (12px) · `--s-4` (16px) · `--s-5` (20px) · `--s-6` (24px) · `--s-8` (32px) · `--s-10` (40px)
|
|
584
|
+
|
|
585
|
+
### Radii
|
|
586
|
+
|
|
587
|
+
`--r-1` (4px) · `--r-2` (6px) · `--r-3` (8px) · `--r-full` (999px)
|
|
588
|
+
|
|
589
|
+
### Input heights
|
|
590
|
+
|
|
591
|
+
`--h-input-sm` (28px) · `--h-input` (32px) · `--h-input-lg` (36px)
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
## Development
|
|
596
|
+
|
|
597
|
+
### Start Storybook
|
|
598
|
+
|
|
599
|
+
```bash
|
|
600
|
+
npm run dev # http://localhost:6006
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
Or with Docker:
|
|
604
|
+
|
|
605
|
+
```bash
|
|
606
|
+
make build # docker compose up --build
|
|
607
|
+
make restart
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
### Type check
|
|
611
|
+
|
|
612
|
+
Always use `tsconfig.build.json` — the root config produces a false positive about `vite.config.d.ts`:
|
|
613
|
+
|
|
614
|
+
```bash
|
|
615
|
+
npm run typecheck
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
### Build the library
|
|
619
|
+
|
|
620
|
+
```bash
|
|
621
|
+
npm run build
|
|
622
|
+
ls dist/super-kit.js dist/super-kit.cjs dist/index.d.ts
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
### Publish
|
|
626
|
+
|
|
627
|
+
```bash
|
|
628
|
+
make publish TYPE=patch # bumps version, builds, publishes to npm
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
#### Configuração inicial (uma vez por máquina)
|
|
632
|
+
|
|
633
|
+
O `make publish` exige autenticação no npm. Siga os passos abaixo:
|
|
634
|
+
|
|
635
|
+
**1. Criar um token de autenticação**
|
|
636
|
+
|
|
637
|
+
Acesse **npmjs.com → seu perfil → Access Tokens → Generate New Token**.
|
|
638
|
+
|
|
639
|
+
Escolha **Granular Access Token** e configure:
|
|
640
|
+
- **Bypass two-factor authentication (2FA)** → marque o checkbox
|
|
641
|
+
- **Packages and scopes → Permissions** → selecione **"All packages"** com **"Read and write"**
|
|
642
|
+
- Defina uma data de expiração e gere o token
|
|
643
|
+
|
|
644
|
+
> Atenção: o token só é exibido uma vez. Copie antes de sair da página.
|
|
645
|
+
|
|
646
|
+
**2. Configurar o token localmente**
|
|
647
|
+
|
|
648
|
+
Crie o arquivo `.npmrc` na raiz do projeto:
|
|
649
|
+
|
|
650
|
+
```
|
|
651
|
+
//registry.npmjs.org/:_authToken=npm_SEU_TOKEN_AQUI
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
O `.npmrc` já está no `.gitignore` — nunca será commitado.
|
|
655
|
+
|
|
656
|
+
**3. Publicar**
|
|
657
|
+
|
|
658
|
+
```bash
|
|
659
|
+
make publish TYPE=patch # ou minor / major
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
### Add a new component
|
|
663
|
+
|
|
664
|
+
1. Create `src/ComponentName/ComponentName.tsx`, `ComponentName.module.css`, `ComponentName.stories.tsx`, `index.ts`
|
|
665
|
+
2. Export from `src/index.ts`: `export * from "./ComponentName"`
|
|
666
|
+
3. Run `npm run typecheck` and confirm the story renders in Storybook
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type BadgeVariant = "neutral" | "accent" | "outline" | "success" | "warning" | "danger" | "info" | "count" | "mono" | "version" | "dot";
|
|
3
|
+
export type BadgeProps = HTMLAttributes<HTMLSpanElement> & {
|
|
4
|
+
variant?: BadgeVariant;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
pill?: boolean;
|
|
7
|
+
dismissable?: boolean;
|
|
8
|
+
onDismiss?: () => void;
|
|
9
|
+
dotColor?: string;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export declare function Badge({ variant, icon, pill, dismissable, onDismiss, dotColor, children, className, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare namespace Badge {
|
|
14
|
+
var displayName: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Badge';
|