@squadbase/vantage 0.0.1 → 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 +21 -4
- package/dist/chunk-A2UUGASH.js +12 -0
- package/dist/chunk-A2UUGASH.js.map +1 -0
- package/dist/{chunk-ZGDU5YLH.js → chunk-PRFBSQA4.js} +9 -5
- package/dist/chunk-PRFBSQA4.js.map +1 -0
- package/dist/chunk-WQZYXXQW.js +2249 -0
- package/dist/chunk-WQZYXXQW.js.map +1 -0
- package/dist/{chunk-73J5ZD4C.js → chunk-YLAB6UQS.js} +17 -3
- package/dist/chunk-YLAB6UQS.js.map +1 -0
- package/dist/cli.js +607 -36
- package/dist/cli.js.map +1 -1
- package/dist/components/index.d.ts +554 -0
- package/dist/components/index.js +1983 -0
- package/dist/components/index.js.map +1 -0
- package/dist/markdown/index.d.ts +9 -0
- package/dist/markdown/index.js +26 -0
- package/dist/markdown/index.js.map +1 -0
- package/dist/query/index.d.ts +27 -1
- package/dist/query/index.js +18 -0
- package/dist/query/index.js.map +1 -1
- package/dist/server/node.js +6 -1
- package/dist/server/node.js.map +1 -1
- package/dist/ui/index.d.ts +316 -200
- package/dist/ui/index.js +566 -511
- package/dist/ui/index.js.map +1 -1
- package/dist/vite/index.js +2 -2
- package/docs/en/agent-skills.md +89 -0
- package/docs/en/api-and-server.md +84 -0
- package/docs/en/build-and-deploy.md +280 -0
- package/docs/en/cli-reference.md +311 -0
- package/docs/en/components.md +233 -0
- package/docs/en/data-fetching.md +78 -0
- package/docs/en/environment-variables.md +69 -0
- package/docs/en/getting-started.md +95 -0
- package/docs/en/index.md +65 -0
- package/docs/en/markdown/markdown-renderer.md +44 -0
- package/docs/en/pages-and-metadata.md +56 -0
- package/docs/en/parts/app-shell.md +54 -0
- package/docs/en/parts/dashboard-card.md +64 -0
- package/docs/en/parts/data-table.md +86 -0
- package/docs/en/parts/date-range-picker.md +41 -0
- package/docs/en/parts/echart.md +53 -0
- package/docs/en/parts/filter-bar.md +66 -0
- package/docs/en/parts/funnel-steps.md +33 -0
- package/docs/en/parts/metric-value.md +23 -0
- package/docs/en/parts/multi-select.md +27 -0
- package/docs/en/parts/page-shell.md +45 -0
- package/docs/en/parts/searchable-select.md +47 -0
- package/docs/en/parts/section-header.md +20 -0
- package/docs/en/parts/segmented-control.md +25 -0
- package/docs/en/parts/status-badge.md +44 -0
- package/docs/en/parts/trend-indicator.md +26 -0
- package/docs/en/routing.md +95 -0
- package/docs/en/ui/accordion.md +36 -0
- package/docs/en/ui/alert.md +31 -0
- package/docs/en/ui/badge.md +23 -0
- package/docs/en/ui/breadcrumb.md +38 -0
- package/docs/en/ui/button.md +39 -0
- package/docs/en/ui/calendar.md +28 -0
- package/docs/en/ui/card.md +35 -0
- package/docs/en/ui/checkbox.md +34 -0
- package/docs/en/ui/cn.md +34 -0
- package/docs/en/ui/collapsible.md +21 -0
- package/docs/en/ui/command.md +37 -0
- package/docs/en/ui/dialog.md +52 -0
- package/docs/en/ui/dropdown-menu.md +50 -0
- package/docs/en/ui/empty.md +22 -0
- package/docs/en/ui/error-state.md +50 -0
- package/docs/en/ui/input-group.md +30 -0
- package/docs/en/ui/input.md +28 -0
- package/docs/en/ui/label.md +19 -0
- package/docs/en/ui/loading.md +19 -0
- package/docs/en/ui/popover.md +34 -0
- package/docs/en/ui/progress.md +28 -0
- package/docs/en/ui/scroll-area.md +23 -0
- package/docs/en/ui/select.md +63 -0
- package/docs/en/ui/separator.md +15 -0
- package/docs/en/ui/sheet.md +28 -0
- package/docs/en/ui/sidebar.md +92 -0
- package/docs/en/ui/skeleton.md +16 -0
- package/docs/en/ui/slider.md +21 -0
- package/docs/en/ui/spinner.md +14 -0
- package/docs/en/ui/switch.md +19 -0
- package/docs/en/ui/table.md +24 -0
- package/docs/en/ui/tabs.md +23 -0
- package/docs/en/ui/textarea.md +15 -0
- package/docs/en/ui/toggle-group.md +26 -0
- package/docs/en/ui/toggle.md +19 -0
- package/docs/en/ui/tooltip.md +22 -0
- package/docs/en/ui/use-is-mobile.md +18 -0
- package/docs/en/ui-and-theming.md +95 -0
- package/docs/index.json +1306 -0
- package/docs/ja/agent-skills.md +87 -0
- package/docs/ja/api-and-server.md +84 -0
- package/docs/ja/build-and-deploy.md +279 -0
- package/docs/ja/cli-reference.md +305 -0
- package/docs/ja/components.md +229 -0
- package/docs/ja/data-fetching.md +78 -0
- package/docs/ja/environment-variables.md +68 -0
- package/docs/ja/getting-started.md +95 -0
- package/docs/ja/index.md +65 -0
- package/docs/ja/markdown/markdown-renderer.md +43 -0
- package/docs/ja/pages-and-metadata.md +56 -0
- package/docs/ja/parts/app-shell.md +54 -0
- package/docs/ja/parts/dashboard-card.md +64 -0
- package/docs/ja/parts/data-table.md +85 -0
- package/docs/ja/parts/date-range-picker.md +41 -0
- package/docs/ja/parts/echart.md +52 -0
- package/docs/ja/parts/filter-bar.md +64 -0
- package/docs/ja/parts/funnel-steps.md +33 -0
- package/docs/ja/parts/metric-value.md +25 -0
- package/docs/ja/parts/multi-select.md +27 -0
- package/docs/ja/parts/page-shell.md +45 -0
- package/docs/ja/parts/searchable-select.md +47 -0
- package/docs/ja/parts/section-header.md +20 -0
- package/docs/ja/parts/segmented-control.md +26 -0
- package/docs/ja/parts/status-badge.md +44 -0
- package/docs/ja/parts/trend-indicator.md +26 -0
- package/docs/ja/routing.md +95 -0
- package/docs/ja/ui/accordion.md +37 -0
- package/docs/ja/ui/alert.md +31 -0
- package/docs/ja/ui/badge.md +23 -0
- package/docs/ja/ui/breadcrumb.md +38 -0
- package/docs/ja/ui/button.md +39 -0
- package/docs/ja/ui/calendar.md +28 -0
- package/docs/ja/ui/card.md +35 -0
- package/docs/ja/ui/checkbox.md +34 -0
- package/docs/ja/ui/cn.md +34 -0
- package/docs/ja/ui/collapsible.md +21 -0
- package/docs/ja/ui/command.md +36 -0
- package/docs/ja/ui/dialog.md +51 -0
- package/docs/ja/ui/dropdown-menu.md +50 -0
- package/docs/ja/ui/empty.md +22 -0
- package/docs/ja/ui/error-state.md +50 -0
- package/docs/ja/ui/input-group.md +30 -0
- package/docs/ja/ui/input.md +28 -0
- package/docs/ja/ui/label.md +19 -0
- package/docs/ja/ui/loading.md +19 -0
- package/docs/ja/ui/popover.md +34 -0
- package/docs/ja/ui/progress.md +28 -0
- package/docs/ja/ui/scroll-area.md +24 -0
- package/docs/ja/ui/select.md +64 -0
- package/docs/ja/ui/separator.md +15 -0
- package/docs/ja/ui/sheet.md +28 -0
- package/docs/ja/ui/sidebar.md +92 -0
- package/docs/ja/ui/skeleton.md +16 -0
- package/docs/ja/ui/slider.md +21 -0
- package/docs/ja/ui/spinner.md +14 -0
- package/docs/ja/ui/switch.md +19 -0
- package/docs/ja/ui/table.md +24 -0
- package/docs/ja/ui/tabs.md +24 -0
- package/docs/ja/ui/textarea.md +15 -0
- package/docs/ja/ui/toggle-group.md +27 -0
- package/docs/ja/ui/toggle.md +19 -0
- package/docs/ja/ui/tooltip.md +22 -0
- package/docs/ja/ui/use-is-mobile.md +18 -0
- package/docs/ja/ui-and-theming.md +95 -0
- package/package.json +29 -4
- package/registry/blocks/sales-overview.tsx +43 -19
- package/registry/ui/data-table.tsx +702 -102
- package/skills/vantage-add-feature/SKILL.md +150 -0
- package/skills/vantage-app/SKILL.md +258 -0
- package/skills/vantage-pitfalls/SKILL.md +115 -0
- package/templates/AGENTS.md +268 -0
- package/theme.css +178 -40
- package/dist/chunk-73J5ZD4C.js.map +0 -1
- package/dist/chunk-ZGDU5YLH.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Input
|
|
2
|
+
|
|
3
|
+
> The single-line text input.
|
|
4
|
+
|
|
5
|
+
A plain `<input>` with the theme's border and focus ring. The props are the native ones, `type`
|
|
6
|
+
included.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Input } from "@squadbase/vantage/ui";
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Tie a [`Label`](ui/label) to it with `htmlFor`.
|
|
13
|
+
|
|
14
|
+
## States
|
|
15
|
+
|
|
16
|
+
| Written as | Looks like |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `disabled` | Dimmed, not interactive |
|
|
19
|
+
| `aria-invalid` | Border and ring turn `destructive` |
|
|
20
|
+
| `readOnly` | Unchanged, but not editable |
|
|
21
|
+
|
|
22
|
+
Validation styling is just `aria-invalid` — pass the boolean straight through.
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
<Input aria-invalid={Boolean(error)} />
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
To attach an icon or button on either end, use [`InputGroup`](ui/input-group).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Label
|
|
2
|
+
|
|
3
|
+
> The form label.
|
|
4
|
+
|
|
5
|
+
A `<label>` with consistent type and a dimmed disabled state. Either tie it with `htmlFor` or wrap
|
|
6
|
+
the control.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Label } from "@squadbase/vantage/ui";
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Wrapping a checkbox or switch in a `Label` makes the text clickable too.
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
<Label className="flex items-center gap-2">
|
|
16
|
+
<Switch />
|
|
17
|
+
Auto-refresh
|
|
18
|
+
</Label>
|
|
19
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Loading
|
|
2
|
+
|
|
3
|
+
> A centred spinner with a label.
|
|
4
|
+
|
|
5
|
+
The loading state for a whole panel. It carries `role="status"` and `aria-live="polite"`, so screen
|
|
6
|
+
readers announce it too. One of the three state components Vantage adds on top of shadcn/ui,
|
|
7
|
+
alongside `Empty` and `ErrorState`.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Loading } from "@squadbase/vantage/ui";
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- |
|
|
15
|
+
| `label` | `string` | `"Loading…"` | Text shown next to the spinner. |
|
|
16
|
+
| `className` | `string` | | Classes to add. By default it centres within a 30vh minimum height. |
|
|
17
|
+
|
|
18
|
+
To hold the layout while waiting use [`Skeleton`](ui/skeleton); in tight spots such
|
|
19
|
+
as a button, [`Spinner`](ui/spinner).
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Popover
|
|
2
|
+
|
|
3
|
+
> A bubble anchored to its trigger.
|
|
4
|
+
|
|
5
|
+
A panel that opens anchored to an element. If you need to trap focus, use
|
|
6
|
+
[`Dialog`](ui/dialog); for a caption alone, [`Tooltip`](ui/tooltip).
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import {
|
|
10
|
+
Popover,
|
|
11
|
+
PopoverTrigger,
|
|
12
|
+
PopoverContent,
|
|
13
|
+
PopoverHeader,
|
|
14
|
+
PopoverTitle,
|
|
15
|
+
PopoverDescription,
|
|
16
|
+
} from "@squadbase/vantage/ui";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Placement
|
|
20
|
+
|
|
21
|
+
Set by `PopoverContent`'s `side` (default `bottom`), `align` (default `center`) and `sideOffset`
|
|
22
|
+
(default `4`).
|
|
23
|
+
|
|
24
|
+
## Matching the trigger's width
|
|
25
|
+
|
|
26
|
+
Base UI exposes a `--anchor-width` CSS variable — the equivalent of Radix's
|
|
27
|
+
`--radix-popover-trigger-width`.
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
<PopoverContent className="w-(--anchor-width)">…</PopoverContent>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
> [!NOTE]
|
|
34
|
+
> To make the trigger a button write `render={<Button />}`. Base UI has no `asChild`.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Progress
|
|
2
|
+
|
|
3
|
+
> The progress bar, with optional label and value.
|
|
4
|
+
|
|
5
|
+
A bar for 0–100 progress. Put a label or value inside `Progress` and the bar is drawn beneath them
|
|
6
|
+
automatically.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import {
|
|
10
|
+
Progress,
|
|
11
|
+
ProgressTrack,
|
|
12
|
+
ProgressIndicator,
|
|
13
|
+
ProgressLabel,
|
|
14
|
+
ProgressValue,
|
|
15
|
+
} from "@squadbase/vantage/ui";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Parts
|
|
19
|
+
|
|
20
|
+
| Part | Role |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `Progress` | The root. `value` (`null` for indeterminate) |
|
|
23
|
+
| `ProgressLabel` | The heading |
|
|
24
|
+
| `ProgressValue` | The current value, as a percentage by default |
|
|
25
|
+
| `ProgressTrack` / `ProgressIndicator` | The bar itself — `Progress` renders these for you |
|
|
26
|
+
|
|
27
|
+
Pass `value={null}` when the total isn't known. If you only mean "loading",
|
|
28
|
+
[`Skeleton`](ui/skeleton) or [`Spinner`](ui/spinner) says it better.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# ScrollArea
|
|
2
|
+
|
|
3
|
+
> A scroll region with a consistent, non-native scrollbar.
|
|
4
|
+
|
|
5
|
+
Gives a fixed-height region a styled scrollbar instead of the OS one — dropdown contents, long log
|
|
6
|
+
output, and the like.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { ScrollArea, ScrollBar } from "@squadbase/vantage/ui";
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Set the height (or width) via `className`. Vertical is the default; for horizontal scrolling add a
|
|
13
|
+
`ScrollBar orientation="horizontal"` child.
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<ScrollArea className="w-96 whitespace-nowrap">
|
|
17
|
+
<div className="flex gap-3">…</div>
|
|
18
|
+
<ScrollBar orientation="horizontal" />
|
|
19
|
+
</ScrollArea>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
> [!NOTE]
|
|
23
|
+
> If you only want to hide the scrollbar, `theme.css` defines a `no-scrollbar` utility.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Select
|
|
2
|
+
|
|
3
|
+
> The single-choice select. Note that onValueChange can hand you null.
|
|
4
|
+
|
|
5
|
+
Pick one option from a list. When there are many options and you want search, use
|
|
6
|
+
[`SearchableSelect`](parts/searchable-select); for a handful shown side by side,
|
|
7
|
+
[`SegmentedControl`](parts/segmented-control).
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import {
|
|
11
|
+
Select,
|
|
12
|
+
SelectTrigger,
|
|
13
|
+
SelectValue,
|
|
14
|
+
SelectContent,
|
|
15
|
+
SelectGroup,
|
|
16
|
+
SelectLabel,
|
|
17
|
+
SelectItem,
|
|
18
|
+
SelectSeparator,
|
|
19
|
+
SelectScrollUpButton,
|
|
20
|
+
SelectScrollDownButton,
|
|
21
|
+
} from "@squadbase/vantage/ui";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Parts
|
|
25
|
+
|
|
26
|
+
| Part | Role |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| `Select` | The state: `value` / `defaultValue` / `onValueChange` / `items` |
|
|
29
|
+
| `SelectTrigger` | The closed state. `size`: `default` \| `sm` |
|
|
30
|
+
| `SelectValue` | What's selected; `placeholder` covers "nothing yet" |
|
|
31
|
+
| `SelectContent` | The open list |
|
|
32
|
+
| `SelectGroup` + `SelectLabel` | A group with a heading |
|
|
33
|
+
| `SelectItem` | One option; `value` is required |
|
|
34
|
+
|
|
35
|
+
> [!WARNING]
|
|
36
|
+
> `onValueChange` hands you **`string | null`** — Base UI allows deselection. Always guard for `null`.
|
|
37
|
+
>
|
|
38
|
+
> ```tsx
|
|
39
|
+
> <Select onValueChange={(value) => value !== null && setRegion(value)}>
|
|
40
|
+
> ```
|
|
41
|
+
|
|
42
|
+
> [!WARNING]
|
|
43
|
+
> `SelectValue` shows the **raw selected `value`** by default — it never looks inside `SelectItem`.
|
|
44
|
+
> With `value="kanto"` the trigger reads `kanto`, not "Kanto". Give `Select` the value-to-label map
|
|
45
|
+
> via `items`.
|
|
46
|
+
>
|
|
47
|
+
> ```tsx
|
|
48
|
+
> const regions = { hokkaido: "Hokkaido", kanto: "Kanto", kansai: "Kansai" };
|
|
49
|
+
>
|
|
50
|
+
> <Select items={regions} value={region} onValueChange={…}>
|
|
51
|
+
> <SelectTrigger><SelectValue placeholder="Pick a region" /></SelectTrigger>
|
|
52
|
+
> …
|
|
53
|
+
> </Select>;
|
|
54
|
+
> ```
|
|
55
|
+
>
|
|
56
|
+
> If you'd rather not carry `items`, a function child on `SelectValue` does the same job.
|
|
57
|
+
>
|
|
58
|
+
> ```tsx
|
|
59
|
+
> <SelectValue>{(value) => regions[value] ?? "Pick a region"}</SelectValue>
|
|
60
|
+
> ```
|
|
61
|
+
|
|
62
|
+
`SelectContent` opens over the trigger with the selected item aligned to it. For a plain dropdown
|
|
63
|
+
below the trigger, pass `alignItemWithTrigger={false}`.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Separator
|
|
2
|
+
|
|
3
|
+
> A single dividing rule.
|
|
4
|
+
|
|
5
|
+
A rule between sections. With `orientation="vertical"` the parent needs a height.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Separator } from "@squadbase/vantage/ui";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Which way the rule runs. |
|
|
14
|
+
|
|
15
|
+
It is decorative, so assistive technology skips it.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Sheet
|
|
2
|
+
|
|
3
|
+
> A panel that slides in from an edge.
|
|
4
|
+
|
|
5
|
+
A panel that slides in from the edge of the screen — for a full set of filters, or an edit form that
|
|
6
|
+
wants more room than a modal.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import {
|
|
10
|
+
Sheet,
|
|
11
|
+
SheetTrigger,
|
|
12
|
+
SheetContent,
|
|
13
|
+
SheetHeader,
|
|
14
|
+
SheetTitle,
|
|
15
|
+
SheetDescription,
|
|
16
|
+
SheetFooter,
|
|
17
|
+
SheetClose,
|
|
18
|
+
} from "@squadbase/vantage/ui";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The structure matches [`Dialog`](ui/dialog); only the direction differs.
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Description |
|
|
24
|
+
| --- | --- | --- | --- |
|
|
25
|
+
| `side` | `"top" \| "right" \| "bottom" \| "left"` | `"right"` | Goes on `SheetContent`. Which edge it enters from. |
|
|
26
|
+
|
|
27
|
+
`SheetTitle` is required for assistive technology. Keep it and add `className="sr-only"` if it
|
|
28
|
+
shouldn't be visible.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Sidebar
|
|
2
|
+
|
|
3
|
+
> The full collapsible application sidebar kit.
|
|
4
|
+
|
|
5
|
+
A kit of twenty-odd parts for building an application's navigation. If you'd rather just hand over
|
|
6
|
+
an array of nav items, [`AppShell`](parts/app-shell) gets you there faster.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import {
|
|
10
|
+
Sidebar,
|
|
11
|
+
SidebarProvider,
|
|
12
|
+
SidebarInset,
|
|
13
|
+
SidebarTrigger,
|
|
14
|
+
SidebarHeader,
|
|
15
|
+
SidebarContent,
|
|
16
|
+
SidebarFooter,
|
|
17
|
+
SidebarGroup,
|
|
18
|
+
SidebarGroupLabel,
|
|
19
|
+
SidebarGroupContent,
|
|
20
|
+
SidebarGroupAction,
|
|
21
|
+
SidebarMenu,
|
|
22
|
+
SidebarMenuItem,
|
|
23
|
+
SidebarMenuButton,
|
|
24
|
+
SidebarMenuAction,
|
|
25
|
+
SidebarMenuBadge,
|
|
26
|
+
SidebarMenuSkeleton,
|
|
27
|
+
SidebarMenuSub,
|
|
28
|
+
SidebarMenuSubItem,
|
|
29
|
+
SidebarMenuSubButton,
|
|
30
|
+
SidebarSeparator,
|
|
31
|
+
SidebarInput,
|
|
32
|
+
SidebarRail,
|
|
33
|
+
useSidebar,
|
|
34
|
+
} from "@squadbase/vantage/ui";
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## The skeleton
|
|
38
|
+
|
|
39
|
+
`SidebarProvider` owns the open/closed state; `Sidebar` and `SidebarInset` (the content side) sit
|
|
40
|
+
inside it.
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
<SidebarProvider>
|
|
44
|
+
<Sidebar>
|
|
45
|
+
<SidebarHeader>Acme Analytics</SidebarHeader>
|
|
46
|
+
<SidebarContent>
|
|
47
|
+
<SidebarGroup>
|
|
48
|
+
<SidebarGroupLabel>Analytics</SidebarGroupLabel>
|
|
49
|
+
<SidebarGroupContent>
|
|
50
|
+
<SidebarMenu>
|
|
51
|
+
<SidebarMenuItem>
|
|
52
|
+
<SidebarMenuButton isActive>Overview</SidebarMenuButton>
|
|
53
|
+
</SidebarMenuItem>
|
|
54
|
+
<SidebarMenuItem>
|
|
55
|
+
<SidebarMenuButton>Sales</SidebarMenuButton>
|
|
56
|
+
<SidebarMenuBadge>12</SidebarMenuBadge>
|
|
57
|
+
</SidebarMenuItem>
|
|
58
|
+
</SidebarMenu>
|
|
59
|
+
</SidebarGroupContent>
|
|
60
|
+
</SidebarGroup>
|
|
61
|
+
</SidebarContent>
|
|
62
|
+
<SidebarRail />
|
|
63
|
+
</Sidebar>
|
|
64
|
+
|
|
65
|
+
<SidebarInset>
|
|
66
|
+
<SidebarTrigger />
|
|
67
|
+
{children}
|
|
68
|
+
</SidebarInset>
|
|
69
|
+
</SidebarProvider>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Worth knowing
|
|
73
|
+
|
|
74
|
+
| Thing | Effect |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `isActive` on `SidebarMenuButton` | Highlights the current page |
|
|
77
|
+
| `tooltip` on `SidebarMenuButton` | Shows the label while collapsed |
|
|
78
|
+
| `render` on `SidebarMenuButton` | Swaps in a link component |
|
|
79
|
+
| `SidebarRail` | The thin strip you drag to collapse |
|
|
80
|
+
| `SidebarMenuSkeleton` | A loading menu |
|
|
81
|
+
| `useSidebar()` | Reads the open state and the mobile flag |
|
|
82
|
+
|
|
83
|
+
## Making items links
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import { Link } from "@squadbase/vantage/router";
|
|
87
|
+
|
|
88
|
+
<SidebarMenuButton render={<Link to="/sales" />}>Sales</SidebarMenuButton>;
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
> [!NOTE]
|
|
92
|
+
> Base UI has no `asChild` — pass an element to `render`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Skeleton
|
|
2
|
+
|
|
3
|
+
> A box shaped like the content that will replace it.
|
|
4
|
+
|
|
5
|
+
A placeholder shaped like whatever is coming. Unlike [`Loading`](ui/loading)'s
|
|
6
|
+
full-panel spinner, it keeps the layout intact while you wait.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Skeleton } from "@squadbase/vantage/ui";
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Size it with `className` (`h-4 w-32` and friends). Match the height of the real element and the page
|
|
13
|
+
won't jump when the data lands.
|
|
14
|
+
|
|
15
|
+
For dashboard tiles, [`DashboardCardSkeleton`](parts/dashboard-card) is already the
|
|
16
|
+
right shape.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Slider
|
|
2
|
+
|
|
3
|
+
> Pick a number by dragging. Ranges included.
|
|
4
|
+
|
|
5
|
+
Choose a number by dragging. Pass an array as `value` and you get one thumb per entry — a range.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Slider } from "@squadbase/vantage/ui";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `value` | `number \| number[]` | | Thumb position(s). An array makes it a range. |
|
|
14
|
+
| `defaultValue` | `number \| number[]` | | Initial value when uncontrolled. |
|
|
15
|
+
| `onValueChange` | `(value: number \| number[]) => void` | | Fired on change, in the same shape you passed to `value`. |
|
|
16
|
+
| `min` | `number` | `0` | Lower bound. |
|
|
17
|
+
| `max` | `number` | `100` | Upper bound. |
|
|
18
|
+
| `step` | `number` | `1` | Increment. |
|
|
19
|
+
| `disabled` | `boolean` | | Disable interaction. |
|
|
20
|
+
|
|
21
|
+
Thumbs are aligned to the track's edges, so they never overhang it at `min` or `max`.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Spinner
|
|
2
|
+
|
|
3
|
+
> The smallest waiting indicator.
|
|
4
|
+
|
|
5
|
+
Just a spinning icon — for tight spots like inside a button.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Spinner } from "@squadbase/vantage/ui";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
It is an `<svg>`, so `size-*` sets the size and `text-*` the colour.
|
|
12
|
+
|
|
13
|
+
For a whole panel use [`Loading`](ui/loading); to hold the layout while you wait,
|
|
14
|
+
[`Skeleton`](ui/skeleton).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Switch
|
|
2
|
+
|
|
3
|
+
> A toggle for settings that take effect at once.
|
|
4
|
+
|
|
5
|
+
For a setting that applies immediately. If it only takes effect on submit,
|
|
6
|
+
[`Checkbox`](ui/checkbox) is the better fit.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Switch } from "@squadbase/vantage/ui";
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
| Prop | Type | Default | Description |
|
|
13
|
+
| --- | --- | --- | --- |
|
|
14
|
+
| `checked` | `boolean` | | On or off. |
|
|
15
|
+
| `onCheckedChange` | `(checked: boolean) => void` | | Fired on change. |
|
|
16
|
+
| `size` | `"default" \| "sm"` | `"default"` | Scale. |
|
|
17
|
+
| `disabled` | `boolean` | | Disable interaction. |
|
|
18
|
+
|
|
19
|
+
Wrap it in a [`Label`](ui/label) so the text is clickable too.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Table
|
|
2
|
+
|
|
3
|
+
> The bare table primitives. For sorting and search, use DataTable.
|
|
4
|
+
|
|
5
|
+
The `<table>` family with the theme's rules and spacing, nothing more. If you need sorting, search
|
|
6
|
+
or pagination, use [`DataTable`](parts/data-table).
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import {
|
|
10
|
+
Table,
|
|
11
|
+
TableHeader,
|
|
12
|
+
TableBody,
|
|
13
|
+
TableFooter,
|
|
14
|
+
TableRow,
|
|
15
|
+
TableHead,
|
|
16
|
+
TableCell,
|
|
17
|
+
TableCaption,
|
|
18
|
+
} from "@squadbase/vantage/ui";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The mapping is the plain HTML one — `Table` is `<table>`, `TableHeader` is `<thead>`, `TableHead` is
|
|
22
|
+
`<th>`, `TableCell` is `<td>` — and the native props pass through.
|
|
23
|
+
|
|
24
|
+
Add `text-right tabular-nums` to numeric columns so the digits line up.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Tabs
|
|
2
|
+
|
|
3
|
+
> Tabs that switch between views.
|
|
4
|
+
|
|
5
|
+
Show one of several views in the same place. For a two-to-four-way toggle,
|
|
6
|
+
[`SegmentedControl`](parts/segmented-control) takes less room.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants } from "@squadbase/vantage/ui";
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parts
|
|
13
|
+
|
|
14
|
+
| Part | Role |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| `Tabs` | The state: `value` / `defaultValue` / `onValueChange`, plus `orientation` |
|
|
17
|
+
| `TabsList` | The strip. `variant`: `default` (filled) \| `line` (underline) |
|
|
18
|
+
| `TabsTrigger` | One tab; `value` is required |
|
|
19
|
+
| `TabsContent` | The matching panel |
|
|
20
|
+
|
|
21
|
+
To keep the active tab in the URL, wire `value` to a search param — see [Routing](routing).
|
|
22
|
+
|
|
23
|
+
`orientation="vertical"` stacks them.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Textarea
|
|
2
|
+
|
|
3
|
+
> The multi-line text input.
|
|
4
|
+
|
|
5
|
+
Multi-line input. The props are the native `<textarea>` ones.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Textarea } from "@squadbase/vantage/ui";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Set the height with `rows` or `className` (`min-h-32` and friends). `aria-invalid` turns it the
|
|
12
|
+
error colour, exactly as with [`Input`](ui/input).
|
|
13
|
+
|
|
14
|
+
For a toolbar above or below, pair [`InputGroup`](ui/input-group)'s
|
|
15
|
+
`InputGroupTextarea` with `align="block-end"`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# ToggleGroup
|
|
2
|
+
|
|
3
|
+
> A band of toggles. value is always an array.
|
|
4
|
+
|
|
5
|
+
Groups toggles into one band. Under Base UI **`value` is an array even for single choice** — if
|
|
6
|
+
single choice is all you want, [`SegmentedControl`](parts/segmented-control) already
|
|
7
|
+
handles that for you.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { ToggleGroup, ToggleGroupItem } from "@squadbase/vantage/ui";
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- |
|
|
15
|
+
| `value` | `string[]` | | The selected values — **an array even for single choice**. |
|
|
16
|
+
| `onValueChange` | `(value: string[]) => void` | | Fired on change, with an array. |
|
|
17
|
+
| `toggleMultiple` | `boolean` | | Allow more than one selection. |
|
|
18
|
+
| `variant` | `"default" \| "outline"` | `"default"` | |
|
|
19
|
+
| `size` | `"default" \| "sm" \| "lg"` | `"default"` | |
|
|
20
|
+
| `spacing` | `number` | `2` | Gap between items; `0` welds them into one band. |
|
|
21
|
+
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | |
|
|
22
|
+
|
|
23
|
+
> [!WARNING]
|
|
24
|
+
> There is no Radix-style `type="single"` / `type="multiple"`. Single choice means keeping the array's
|
|
25
|
+
> length at one yourself. [`SegmentedControl`](parts/segmented-control) already does
|
|
26
|
+
> that, so prefer it when you want single choice.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Toggle
|
|
2
|
+
|
|
3
|
+
> A button that stays pressed.
|
|
4
|
+
|
|
5
|
+
A button that keeps its pressed state. To group several, use
|
|
6
|
+
[`ToggleGroup`](ui/toggle-group).
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Toggle, toggleVariants } from "@squadbase/vantage/ui";
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
| Prop | Type | Default | Description |
|
|
13
|
+
| --- | --- | --- | --- |
|
|
14
|
+
| `pressed` | `boolean` | | The pressed state. |
|
|
15
|
+
| `onPressedChange` | `(pressed: boolean) => void` | | Fired on change. |
|
|
16
|
+
| `variant` | `"default" \| "outline"` | `"default"` | Look. |
|
|
17
|
+
| `size` | `"default" \| "sm" \| "lg"` | `"default"` | Scale. |
|
|
18
|
+
|
|
19
|
+
Icon-only toggles need an `aria-label`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Tooltip
|
|
2
|
+
|
|
3
|
+
> A short caption on hover.
|
|
4
|
+
|
|
5
|
+
A short caption shown on hover or focus. The moment you want something interactive inside it, reach
|
|
6
|
+
for [`Popover`](ui/popover).
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "@squadbase/vantage/ui";
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parts
|
|
13
|
+
|
|
14
|
+
| Part | Role |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| `TooltipProvider` | Shared timing. `delay` (default `0`, ms) |
|
|
17
|
+
| `Tooltip` | One tooltip's state |
|
|
18
|
+
| `TooltipTrigger` | What triggers it; `render` makes it any element |
|
|
19
|
+
| `TooltipContent` | The bubble. `side` (default `top`) / `align` / `sideOffset` |
|
|
20
|
+
|
|
21
|
+
> [!NOTE]
|
|
22
|
+
> Tooltips never appear on touch devices. **Don't put information there that a reader needs.**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# useIsMobile()
|
|
2
|
+
|
|
3
|
+
> A hook that reports whether the viewport is narrow.
|
|
4
|
+
|
|
5
|
+
Returns whether the viewport is narrow (under 768px). It is the same check
|
|
6
|
+
[`Sidebar`](ui/sidebar) uses to switch to a sheet on mobile.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { useIsMobile } from "@squadbase/vantage/ui";
|
|
10
|
+
|
|
11
|
+
export default function Overview() {
|
|
12
|
+
const isMobile = useIsMobile();
|
|
13
|
+
return <EChart option={option} height={isMobile ? 200 : 360} />;
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
It subscribes to `matchMedia`, so resizing re-renders. Note that the first render starts at `false`
|
|
18
|
+
— where you can, express layout branches as CSS breakpoints instead.
|