@nexub/mcp 2.6.0 → 2.8.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/dist/skill/references/components/accordion.md +40 -45
- package/dist/skill/references/components/activity-feed.md +13 -12
- package/dist/skill/references/components/alert-dialog.md +26 -22
- package/dist/skill/references/components/alert.md +26 -8
- package/dist/skill/references/components/amount.md +15 -3
- package/dist/skill/references/components/auth-card.md +22 -11
- package/dist/skill/references/components/autocomplete.md +42 -21
- package/dist/skill/references/components/avatar-group.md +13 -6
- package/dist/skill/references/components/avatar.md +31 -10
- package/dist/skill/references/components/badge.md +37 -16
- package/dist/skill/references/components/banner.md +18 -7
- package/dist/skill/references/components/bento-grid.md +33 -11
- package/dist/skill/references/components/box.md +21 -9
- package/dist/skill/references/components/breadcrumb.md +32 -34
- package/dist/skill/references/components/button-group.md +32 -14
- package/dist/skill/references/components/button.md +57 -32
- package/dist/skill/references/components/callout.md +10 -2
- package/dist/skill/references/components/card.md +54 -22
- package/dist/skill/references/components/checkbox-card.md +23 -8
- package/dist/skill/references/components/checkbox.md +32 -19
- package/dist/skill/references/components/chip.md +22 -10
- package/dist/skill/references/components/citation.md +18 -10
- package/dist/skill/references/components/code-inline.md +20 -2
- package/dist/skill/references/components/collapsible.md +38 -33
- package/dist/skill/references/components/combobox.md +18 -16
- package/dist/skill/references/components/conversation.md +23 -11
- package/dist/skill/references/components/data-table.md +40 -36
- package/dist/skill/references/components/date-picker.md +21 -17
- package/dist/skill/references/components/date-range-picker.md +11 -5
- package/dist/skill/references/components/dialog.md +26 -22
- package/dist/skill/references/components/drawer.md +66 -44
- package/dist/skill/references/components/empty-state.md +40 -50
- package/dist/skill/references/components/error-state.md +22 -10
- package/dist/skill/references/components/error-summary.md +20 -14
- package/dist/skill/references/components/eyebrow-chip.md +15 -5
- package/dist/skill/references/components/filter-bar.md +18 -14
- package/dist/skill/references/components/filter-chip.md +12 -5
- package/dist/skill/references/components/flex.md +31 -15
- package/dist/skill/references/components/form-field.md +11 -5
- package/dist/skill/references/components/gradient-divider.md +5 -1
- package/dist/skill/references/components/grid.md +22 -14
- package/dist/skill/references/components/heading.md +30 -14
- package/dist/skill/references/components/helper-text.md +17 -7
- package/dist/skill/references/components/hover-card.md +21 -12
- package/dist/skill/references/components/icon-button.md +19 -17
- package/dist/skill/references/components/info-list.md +15 -6
- package/dist/skill/references/components/input.md +32 -12
- package/dist/skill/references/components/kbd.md +21 -19
- package/dist/skill/references/components/label.md +20 -6
- package/dist/skill/references/components/link.md +21 -7
- package/dist/skill/references/components/list-detail.md +27 -6
- package/dist/skill/references/components/media-card.md +55 -16
- package/dist/skill/references/components/message-bubble.md +30 -13
- package/dist/skill/references/components/money-input.md +10 -2
- package/dist/skill/references/components/motion-collapse.md +22 -22
- package/dist/skill/references/components/motion-fade.md +19 -15
- package/dist/skill/references/components/motion-scale.md +13 -20
- package/dist/skill/references/components/motion-slide.md +13 -25
- package/dist/skill/references/components/navigation-rail.md +14 -5
- package/dist/skill/references/components/notification-item.md +10 -6
- package/dist/skill/references/components/number-input.md +10 -2
- package/dist/skill/references/components/number-ticker.md +27 -6
- package/dist/skill/references/components/pagination.md +11 -20
- package/dist/skill/references/components/password-input.md +13 -2
- package/dist/skill/references/components/plan-card.md +17 -9
- package/dist/skill/references/components/popover.md +31 -21
- package/dist/skill/references/components/progress.md +22 -8
- package/dist/skill/references/components/prompt-input.md +57 -29
- package/dist/skill/references/components/radio-card.md +41 -22
- package/dist/skill/references/components/radio-group.md +32 -28
- package/dist/skill/references/components/rating.md +23 -7
- package/dist/skill/references/components/scroll-area.md +30 -29
- package/dist/skill/references/components/search-input.md +5 -1
- package/dist/skill/references/components/segmented-control.md +26 -19
- package/dist/skill/references/components/select.md +16 -8
- package/dist/skill/references/components/separator.md +16 -6
- package/dist/skill/references/components/settings-section.md +19 -10
- package/dist/skill/references/components/sheet.md +25 -22
- package/dist/skill/references/components/skeleton.md +29 -12
- package/dist/skill/references/components/slider.md +10 -2
- package/dist/skill/references/components/spinner.md +17 -8
- package/dist/skill/references/components/split-button.md +26 -15
- package/dist/skill/references/components/stack.md +22 -10
- package/dist/skill/references/components/stat-card.md +34 -15
- package/dist/skill/references/components/status-pill.md +18 -12
- package/dist/skill/references/components/step-indicator.md +10 -9
- package/dist/skill/references/components/streaming-text.md +21 -12
- package/dist/skill/references/components/switch.md +10 -9
- package/dist/skill/references/components/table.md +66 -60
- package/dist/skill/references/components/tabs.md +24 -16
- package/dist/skill/references/components/tag.md +13 -5
- package/dist/skill/references/components/text-gradient.md +14 -5
- package/dist/skill/references/components/text.md +29 -12
- package/dist/skill/references/components/textarea.md +21 -7
- package/dist/skill/references/components/thinking-indicator.md +16 -4
- package/dist/skill/references/components/toast.md +41 -64
- package/dist/skill/references/components/toggle-group.md +22 -10
- package/dist/skill/references/components/toggle.md +15 -5
- package/dist/skill/references/components/tooltip.md +22 -9
- package/dist/skill/references/components/user-card.md +9 -5
- package/dist/skill/references/components.md +1 -1
- package/dist/skill/references/tokens.md +1 -1
- package/package.json +1 -1
|
@@ -19,11 +19,20 @@ Navigation for medium-width windows: icons over labels, with an active pill behi
|
|
|
19
19
|
## Example: Default
|
|
20
20
|
|
|
21
21
|
```tsx
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
import { NavigationRail } from '@nexub/react';
|
|
23
|
+
|
|
24
|
+
export default function Example() {
|
|
25
|
+
const glyph = (d: string) => (
|
|
26
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d={d} /></svg>
|
|
27
|
+
);
|
|
28
|
+
return (
|
|
29
|
+
<NavigationRail.Root aria-label="Workspace" className="h-auto bg-[var(--color-surface-container-low)] rounded-[24px]">
|
|
30
|
+
<NavigationRail.Item href="#" icon={glyph('M3 10l9-7 9 7v10a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z')} label="Home" active />
|
|
31
|
+
<NavigationRail.Item href="#" icon={glyph('M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z')} label="Files" />
|
|
32
|
+
<NavigationRail.Item href="#" icon={glyph('M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z')} label="Settings" />
|
|
33
|
+
</NavigationRail.Root>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
27
36
|
```
|
|
28
37
|
|
|
29
38
|
Related: [sidebar](sidebar.md), [top-nav](top-nav.md)
|
|
@@ -20,10 +20,14 @@ Single notification row for notification panels or dropdowns.
|
|
|
20
20
|
## Example: Default
|
|
21
21
|
|
|
22
22
|
```tsx
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/>
|
|
23
|
+
import { NotificationItem } from '@nexub/patterns';
|
|
24
|
+
|
|
25
|
+
export default function Example() {
|
|
26
|
+
return (
|
|
27
|
+
<div className="w-[340px]">
|
|
28
|
+
<NotificationItem title="New team member" description="Sarah joined your workspace." timestamp="2 min ago" read={false} />
|
|
29
|
+
<NotificationItem title="Invoice paid" description="Invoice #1042 was paid successfully." timestamp="1 hr ago" read />
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
29
33
|
```
|
|
@@ -20,11 +20,19 @@ A numeric input with increment and decrement controls, supporting min/max clampi
|
|
|
20
20
|
## Example: Default
|
|
21
21
|
|
|
22
22
|
```tsx
|
|
23
|
-
|
|
23
|
+
import { NumberInput } from '@nexub/react';
|
|
24
|
+
|
|
25
|
+
export default function Example() {
|
|
26
|
+
return <div className="w-[180px]"><NumberInput defaultValue={0} /></div>;
|
|
27
|
+
}
|
|
24
28
|
```
|
|
25
29
|
|
|
26
30
|
## Example: With range
|
|
27
31
|
|
|
28
32
|
```tsx
|
|
29
|
-
|
|
33
|
+
import { NumberInput } from '@nexub/react';
|
|
34
|
+
|
|
35
|
+
export default function Example() {
|
|
36
|
+
return <div className="w-[180px]"><NumberInput defaultValue={5} min={0} max={10} /></div>;
|
|
37
|
+
}
|
|
30
38
|
```
|
|
@@ -20,12 +20,20 @@ A number whose digits roll to new values on the spatial spring. The first render
|
|
|
20
20
|
Each digit is a 0–9 strip; separators and symbols stay still.
|
|
21
21
|
|
|
22
22
|
```tsx
|
|
23
|
-
|
|
23
|
+
import * as React from 'react';
|
|
24
|
+
import { NumberTicker, Button } from '@nexub/react';
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
export default function Example() {
|
|
27
|
+
const [n, setN] = React.useState(12480);
|
|
28
|
+
return (
|
|
29
|
+
<div className="flex flex-col gap-3 items-center">
|
|
30
|
+
<NumberTicker value={n} format={{ maximumFractionDigits: 0 }} className="text-title-lg" />
|
|
31
|
+
<Button size="sm" variant="outlined" onClick={() => setN(Math.round(Math.random() * 100000))}>
|
|
32
|
+
Change
|
|
33
|
+
</Button>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
29
37
|
```
|
|
30
38
|
|
|
31
39
|
## Example: Amount
|
|
@@ -33,7 +41,20 @@ const [n, setN] = React.useState(12480);
|
|
|
33
41
|
`Amount animate` uses the ticker and keeps the quieter symbol and minor units.
|
|
34
42
|
|
|
35
43
|
```tsx
|
|
36
|
-
|
|
44
|
+
import * as React from 'react';
|
|
45
|
+
import { Amount, Button } from '@nexub/react';
|
|
46
|
+
|
|
47
|
+
export default function Example() {
|
|
48
|
+
const [balance, setBalance] = React.useState(128450.75);
|
|
49
|
+
return (
|
|
50
|
+
<div className="flex flex-col gap-3 items-center">
|
|
51
|
+
<Amount value={balance} currency="USD" size="display" animate />
|
|
52
|
+
<Button size="sm" variant="outlined" onClick={() => setBalance(Math.round(Math.random() * 20000000) / 100)}>
|
|
53
|
+
Change
|
|
54
|
+
</Button>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
37
58
|
```
|
|
38
59
|
|
|
39
60
|
## Accessibility
|
|
@@ -21,32 +21,23 @@ Page navigation control with prev/next and page number buttons.
|
|
|
21
21
|
## Example: Default
|
|
22
22
|
|
|
23
23
|
```tsx
|
|
24
|
-
|
|
24
|
+
import * as React from 'react';
|
|
25
|
+
import { Pagination } from '@nexub/react';
|
|
26
|
+
|
|
27
|
+
export default function Example() {
|
|
25
28
|
const [page, setPage] = React.useState(3);
|
|
26
|
-
return
|
|
27
|
-
<Pagination
|
|
28
|
-
page={page}
|
|
29
|
-
totalItems={100}
|
|
30
|
-
pageSize={10}
|
|
31
|
-
onPageChange={setPage}
|
|
32
|
-
/>
|
|
33
|
-
);
|
|
29
|
+
return <Pagination page={page} totalItems={100} pageSize={10} onPageChange={setPage} />;
|
|
34
30
|
}
|
|
35
31
|
```
|
|
36
32
|
|
|
37
33
|
## Example: Large dataset
|
|
38
34
|
|
|
39
35
|
```tsx
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
pageSize={20}
|
|
47
|
-
siblingCount={2}
|
|
48
|
-
onPageChange={setPage}
|
|
49
|
-
/>
|
|
50
|
-
);
|
|
36
|
+
import * as React from 'react';
|
|
37
|
+
import { Pagination } from '@nexub/react';
|
|
38
|
+
|
|
39
|
+
export default function Example() {
|
|
40
|
+
const [page, setPage] = React.useState(3);
|
|
41
|
+
return <Pagination page={page} totalItems={500} pageSize={20} siblingCount={2} onPageChange={setPage} />;
|
|
51
42
|
}
|
|
52
43
|
```
|
|
@@ -14,15 +14,26 @@ A password field with a built-in toggle to reveal or hide the entered value.
|
|
|
14
14
|
| `invalid` | `boolean` | | Applies error styling to indicate a validation failure. |
|
|
15
15
|
| `disabled` | `boolean` | | Disables the input. |
|
|
16
16
|
| `size` | `'sm' \| 'md' \| 'lg'` | | Controls font size and padding. |
|
|
17
|
+
| `visible` | `boolean` | | Shows the password as text. Controlled when set; pair with onVisibleChange. |
|
|
18
|
+
| `defaultVisible` | `boolean` | | Initial visibility when uncontrolled. Defaults to false. |
|
|
19
|
+
| `onVisibleChange` | `(visible: boolean) => void` | | Called when the reveal toggle is pressed. |
|
|
17
20
|
|
|
18
21
|
## Example: Default
|
|
19
22
|
|
|
20
23
|
```tsx
|
|
21
|
-
|
|
24
|
+
import { PasswordInput } from '@nexub/react';
|
|
25
|
+
|
|
26
|
+
export default function Example() {
|
|
27
|
+
return <div className="w-[280px]"><PasswordInput placeholder="Enter password…" /></div>;
|
|
28
|
+
}
|
|
22
29
|
```
|
|
23
30
|
|
|
24
31
|
## Example: Invalid
|
|
25
32
|
|
|
26
33
|
```tsx
|
|
27
|
-
|
|
34
|
+
import { PasswordInput } from '@nexub/react';
|
|
35
|
+
|
|
36
|
+
export default function Example() {
|
|
37
|
+
return <div className="w-[280px]"><PasswordInput invalid placeholder="Password is too short" /></div>;
|
|
38
|
+
}
|
|
28
39
|
```
|
|
@@ -22,13 +22,21 @@ Pricing plan card with feature checklist, badge, and CTA button.
|
|
|
22
22
|
## Example: Default
|
|
23
23
|
|
|
24
24
|
```tsx
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
import { PlanCard } from '@nexub/patterns';
|
|
26
|
+
|
|
27
|
+
export default function Example() {
|
|
28
|
+
return (
|
|
29
|
+
<div className="w-[280px]">
|
|
30
|
+
<PlanCard
|
|
31
|
+
name="Pro"
|
|
32
|
+
price="$49"
|
|
33
|
+
period="/ month"
|
|
34
|
+
description="For growing teams that need more power."
|
|
35
|
+
features={['Unlimited seats', 'Advanced analytics', 'Priority support']}
|
|
36
|
+
cta="Get started"
|
|
37
|
+
onSelect={() => {}}
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
34
42
|
```
|
|
@@ -23,31 +23,41 @@ Floating content panel anchored to a trigger element.
|
|
|
23
23
|
## Example: Default
|
|
24
24
|
|
|
25
25
|
```tsx
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</Popover.
|
|
26
|
+
import { Popover, Button, Text } from '@nexub/react';
|
|
27
|
+
|
|
28
|
+
export default function Example() {
|
|
29
|
+
return (
|
|
30
|
+
<Popover.Root>
|
|
31
|
+
<Popover.Trigger asChild>
|
|
32
|
+
<Button variant="outline">Open popover</Button>
|
|
33
|
+
</Popover.Trigger>
|
|
34
|
+
<Popover.Content>
|
|
35
|
+
<Text size="body-sm">This is popover content. You can put anything here.</Text>
|
|
36
|
+
</Popover.Content>
|
|
37
|
+
</Popover.Root>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
34
40
|
```
|
|
35
41
|
|
|
36
42
|
## Example: With close button
|
|
37
43
|
|
|
38
44
|
```tsx
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
import { Popover, Button, Text } from '@nexub/react';
|
|
46
|
+
|
|
47
|
+
export default function Example() {
|
|
48
|
+
return (
|
|
49
|
+
<div className="flex gap-3 flex-wrap items-center justify-center">
|
|
50
|
+
{(['top', 'right', 'bottom', 'left'] as const).map((s) => (
|
|
51
|
+
<Popover.Root key={s}>
|
|
52
|
+
<Popover.Trigger asChild>
|
|
53
|
+
<Button variant="ghost" size="sm">{s}</Button>
|
|
54
|
+
</Popover.Trigger>
|
|
55
|
+
<Popover.Content side={s}>
|
|
56
|
+
<Text size="body-sm">Opens {s}</Text>
|
|
57
|
+
</Popover.Content>
|
|
58
|
+
</Popover.Root>
|
|
59
|
+
))}
|
|
50
60
|
</div>
|
|
51
|
-
|
|
52
|
-
|
|
61
|
+
);
|
|
62
|
+
}
|
|
53
63
|
```
|
|
@@ -18,22 +18,36 @@ Horizontal progress bar with optional tone and animation.
|
|
|
18
18
|
## Example: Default
|
|
19
19
|
|
|
20
20
|
```tsx
|
|
21
|
-
|
|
21
|
+
import { Progress } from '@nexub/react';
|
|
22
|
+
|
|
23
|
+
export default function Example() {
|
|
24
|
+
return <div className="w-[280px]"><Progress value={65} /></div>;
|
|
25
|
+
}
|
|
22
26
|
```
|
|
23
27
|
|
|
24
28
|
## Example: Tones
|
|
25
29
|
|
|
26
30
|
```tsx
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
import { Progress } from '@nexub/react';
|
|
32
|
+
|
|
33
|
+
export default function Example() {
|
|
34
|
+
return (
|
|
35
|
+
<div className="flex flex-col gap-2.5 items-start w-[280px]">
|
|
36
|
+
<Progress value={80} tone="success" />
|
|
37
|
+
<Progress value={55} tone="info" />
|
|
38
|
+
<Progress value={30} tone="warning" />
|
|
39
|
+
<Progress value={20} tone="danger" />
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
33
43
|
```
|
|
34
44
|
|
|
35
45
|
## Example: Animated
|
|
36
46
|
|
|
37
47
|
```tsx
|
|
38
|
-
|
|
48
|
+
import { Progress } from '@nexub/react';
|
|
49
|
+
|
|
50
|
+
export default function Example() {
|
|
51
|
+
return <div className="w-[280px]"><Progress value={40} animated tone="info" /></div>;
|
|
52
|
+
}
|
|
39
53
|
```
|
|
@@ -37,27 +37,48 @@ The composer for a chat: an auto-growing text field with Send, which turns into
|
|
|
37
37
|
Enter sends, Shift+Enter adds a line. Send stays inert until there is text.
|
|
38
38
|
|
|
39
39
|
```tsx
|
|
40
|
-
|
|
40
|
+
import { PromptInput } from '@nexub/react';
|
|
41
|
+
|
|
42
|
+
export default function Example() {
|
|
43
|
+
return (
|
|
44
|
+
<div className="w-full max-w-[520px]">
|
|
45
|
+
<PromptInput placeholder="Ask anything" />
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
41
49
|
```
|
|
42
50
|
|
|
43
51
|
## Example: Attachments and actions
|
|
44
52
|
|
|
45
53
|
```tsx
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
import * as React from 'react';
|
|
55
|
+
import { PromptInput, Chip, IconButton } from '@nexub/react';
|
|
56
|
+
import { Paperclip, Globe } from '@nexub/icons';
|
|
57
|
+
|
|
58
|
+
export default function Example() {
|
|
59
|
+
const [files, setFiles] = React.useState(['q3-report.pdf', 'pricing.csv']);
|
|
60
|
+
return (
|
|
61
|
+
<div className="w-full max-w-[520px]">
|
|
62
|
+
<PromptInput
|
|
63
|
+
placeholder="Ask about these files"
|
|
64
|
+
attachments={
|
|
65
|
+
files.length > 0 &&
|
|
66
|
+
files.map((f) => (
|
|
67
|
+
<Chip key={f} onRemove={() => setFiles((all) => all.filter((x) => x !== f))}>
|
|
68
|
+
{f}
|
|
69
|
+
</Chip>
|
|
70
|
+
))
|
|
71
|
+
}
|
|
72
|
+
actions={
|
|
73
|
+
<>
|
|
74
|
+
<IconButton size="sm" label="Attach files"><Paperclip /></IconButton>
|
|
75
|
+
<IconButton size="sm" label="Search the web"><Globe /></IconButton>
|
|
76
|
+
</>
|
|
77
|
+
}
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
61
82
|
```
|
|
62
83
|
|
|
63
84
|
## Example: Streaming
|
|
@@ -65,20 +86,27 @@ Enter sends, Shift+Enter adds a line. Send stays inert until there is text.
|
|
|
65
86
|
Send a message: the button turns into Stop for three seconds. Stop or Escape ends it early.
|
|
66
87
|
|
|
67
88
|
```tsx
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
function
|
|
72
|
-
setStatus('
|
|
73
|
-
timer
|
|
89
|
+
import * as React from 'react';
|
|
90
|
+
import { type PromptInputStatus, PromptInput } from '@nexub/react';
|
|
91
|
+
|
|
92
|
+
export default function Example() {
|
|
93
|
+
const [status, setStatus] = React.useState<PromptInputStatus>('idle');
|
|
94
|
+
const timer = React.useRef<ReturnType<typeof setTimeout>>(undefined);
|
|
95
|
+
React.useEffect(() => () => clearTimeout(timer.current), []);
|
|
96
|
+
const send = () => {
|
|
97
|
+
setStatus('streaming');
|
|
98
|
+
timer.current = setTimeout(() => setStatus('idle'), 3000);
|
|
99
|
+
};
|
|
100
|
+
const stop = () => {
|
|
101
|
+
clearTimeout(timer.current);
|
|
102
|
+
setStatus('idle');
|
|
103
|
+
};
|
|
104
|
+
return (
|
|
105
|
+
<div className="w-full max-w-[520px]">
|
|
106
|
+
<PromptInput placeholder="Ask anything" status={status} onSubmit={send} onStop={stop} />
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
74
109
|
}
|
|
75
|
-
|
|
76
|
-
function stop() {
|
|
77
|
-
clearTimeout(timer.current);
|
|
78
|
-
setStatus('idle');
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
<PromptInput placeholder="Ask anything" status={status} onSubmit={send} onStop={stop} />
|
|
82
110
|
```
|
|
83
111
|
|
|
84
112
|
## Accessibility
|
|
@@ -33,19 +33,26 @@ A radio group where each option is a whole card: title, description and optional
|
|
|
33
33
|
## Example: Plan picker
|
|
34
34
|
|
|
35
35
|
```tsx
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</
|
|
36
|
+
import * as React from 'react';
|
|
37
|
+
import { RadioCardGroup, RadioCard } from '@nexub/react';
|
|
38
|
+
import { User, Users, Building2 } from '@nexub/icons';
|
|
39
|
+
|
|
40
|
+
export default function Example() {
|
|
41
|
+
const [plan, setPlan] = React.useState('team');
|
|
42
|
+
return (
|
|
43
|
+
<RadioCardGroup aria-label="Plan" columns={3} value={plan} onValueChange={setPlan} className="w-full">
|
|
44
|
+
<RadioCard value="solo" icon={<User />} title="Solo" description="One seat, core features.">
|
|
45
|
+
<span className="text-sm font-medium">$0 / month</span>
|
|
46
|
+
</RadioCard>
|
|
47
|
+
<RadioCard value="team" icon={<Users />} title="Team" description="Up to 20 seats, shared workspaces.">
|
|
48
|
+
<span className="text-sm font-medium">$12 / seat</span>
|
|
49
|
+
</RadioCard>
|
|
50
|
+
<RadioCard value="enterprise" icon={<Building2 />} title="Enterprise" description="SSO, audit logs, priority support.">
|
|
51
|
+
<span className="text-sm font-medium">Contact sales</span>
|
|
52
|
+
</RadioCard>
|
|
53
|
+
</RadioCardGroup>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
49
56
|
```
|
|
50
57
|
|
|
51
58
|
## Example: Columns
|
|
@@ -53,10 +60,16 @@ const [plan, setPlan] = React.useState('team');
|
|
|
53
60
|
Two columns from the sm breakpoint up, one below.
|
|
54
61
|
|
|
55
62
|
```tsx
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
import { RadioCardGroup, RadioCard } from '@nexub/react';
|
|
64
|
+
|
|
65
|
+
export default function Example() {
|
|
66
|
+
return (
|
|
67
|
+
<RadioCardGroup aria-label="Billing" columns={2} defaultValue="yearly" className="w-full">
|
|
68
|
+
<RadioCard value="monthly" title="Monthly" description="Billed every month." />
|
|
69
|
+
<RadioCard value="yearly" title="Yearly" description="Two months free." />
|
|
70
|
+
</RadioCardGroup>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
60
73
|
```
|
|
61
74
|
|
|
62
75
|
## Example: Disabled
|
|
@@ -64,11 +77,17 @@ Two columns from the sm breakpoint up, one below.
|
|
|
64
77
|
Disable one card, or pass `disabled` to the group to disable all of them.
|
|
65
78
|
|
|
66
79
|
```tsx
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
import { RadioCardGroup, RadioCard } from '@nexub/react';
|
|
81
|
+
|
|
82
|
+
export default function Example() {
|
|
83
|
+
return (
|
|
84
|
+
<RadioCardGroup aria-label="Region" columns={2} defaultValue="eu" className="w-full">
|
|
85
|
+
<RadioCard value="eu" title="Europe" description="Frankfurt" />
|
|
86
|
+
<RadioCard value="us" title="United States" description="Virginia" />
|
|
87
|
+
<RadioCard value="ap" title="Asia Pacific" description="Coming soon" disabled />
|
|
88
|
+
</RadioCardGroup>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
72
91
|
```
|
|
73
92
|
|
|
74
93
|
## Accessibility
|
|
@@ -21,37 +21,41 @@ Group of mutually exclusive radio inputs.
|
|
|
21
21
|
## Example: Default
|
|
22
22
|
|
|
23
23
|
```tsx
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
import { RadioGroup, Label } from '@nexub/react';
|
|
25
|
+
|
|
26
|
+
export default function Example() {
|
|
27
|
+
return (
|
|
28
|
+
<RadioGroup.Root defaultValue="monthly">
|
|
29
|
+
<div className="flex flex-col gap-2 items-start">
|
|
30
|
+
{['Monthly', 'Yearly', 'Lifetime'].map((opt) => (
|
|
31
|
+
<div key={opt} className="flex items-center gap-2">
|
|
32
|
+
<RadioGroup.Item value={opt.toLowerCase()} id={`rg-${opt}`} />
|
|
33
|
+
<Label htmlFor={`rg-${opt}`}>{opt}</Label>
|
|
34
|
+
</div>
|
|
35
|
+
))}
|
|
36
|
+
</div>
|
|
37
|
+
</RadioGroup.Root>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
## Example: Horizontal
|
|
43
43
|
|
|
44
44
|
```tsx
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
import { RadioGroup, Label } from '@nexub/react';
|
|
46
|
+
|
|
47
|
+
export default function Example() {
|
|
48
|
+
return (
|
|
49
|
+
<RadioGroup.Root defaultValue="monthly" orientation="horizontal">
|
|
50
|
+
<div className="flex gap-4">
|
|
51
|
+
{[{ value: 'monthly', label: 'Monthly' }, { value: 'annual', label: 'Annual' }].map(({ value, label }) => (
|
|
52
|
+
<div key={value} className="flex items-center gap-2">
|
|
53
|
+
<RadioGroup.Item value={value} id={`rgh-${value}`} />
|
|
54
|
+
<Label htmlFor={`rgh-${value}`}>{label}</Label>
|
|
55
|
+
</div>
|
|
56
|
+
))}
|
|
57
|
+
</div>
|
|
58
|
+
</RadioGroup.Root>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
57
61
|
```
|
|
@@ -19,21 +19,37 @@ Star rating input, supports controlled and read-only modes.
|
|
|
19
19
|
## Example: Default
|
|
20
20
|
|
|
21
21
|
```tsx
|
|
22
|
-
|
|
22
|
+
import * as React from 'react';
|
|
23
|
+
import { Rating } from '@nexub/react';
|
|
24
|
+
|
|
25
|
+
export default function Example() {
|
|
26
|
+
const [val, setVal] = React.useState(3);
|
|
27
|
+
return <Rating value={val} onValueChange={setVal} />;
|
|
28
|
+
}
|
|
23
29
|
```
|
|
24
30
|
|
|
25
31
|
## Example: Read-only
|
|
26
32
|
|
|
27
33
|
```tsx
|
|
28
|
-
|
|
34
|
+
import { Rating } from '@nexub/react';
|
|
35
|
+
|
|
36
|
+
export default function Example() {
|
|
37
|
+
return <Rating value={4} readOnly />;
|
|
38
|
+
}
|
|
29
39
|
```
|
|
30
40
|
|
|
31
41
|
## Example: Sizes
|
|
32
42
|
|
|
33
43
|
```tsx
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
import { Rating } from '@nexub/react';
|
|
45
|
+
|
|
46
|
+
export default function Example() {
|
|
47
|
+
return (
|
|
48
|
+
<div className="flex flex-col gap-2 items-start">
|
|
49
|
+
<Rating size="sm" value={4} readOnly />
|
|
50
|
+
<Rating size="md" value={4} readOnly />
|
|
51
|
+
<Rating size="lg" value={4} readOnly />
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
39
55
|
```
|