@cascivo/mcp 0.2.0 → 0.3.4
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/LICENSE +1 -1
- package/README.md +53 -23
- package/dist/context/accordion.md +93 -0
- package/dist/context/action-sheet.md +117 -0
- package/dist/context/alert-dialog.md +122 -0
- package/dist/context/alert.md +110 -0
- package/dist/context/app-shell.md +98 -0
- package/dist/context/aspect-ratio.md +92 -0
- package/dist/context/avatar-group.md +111 -0
- package/dist/context/avatar.md +100 -0
- package/dist/context/badge.md +119 -0
- package/dist/context/block/console-app.md +66 -0
- package/dist/context/block/dashboard-charts.md +61 -0
- package/dist/context/block/empty-dashboard.md +60 -0
- package/dist/context/block/login-page.md +60 -0
- package/dist/context/block/notification-center.md +61 -0
- package/dist/context/block/page-with-breadcrumb.md +54 -0
- package/dist/context/block/settings-form-page.md +60 -0
- package/dist/context/block/sidebar-app.md +55 -0
- package/dist/context/block/stats-cards.md +61 -0
- package/dist/context/block/users-table-page.md +61 -0
- package/dist/context/blockquote.md +95 -0
- package/dist/context/bottom-sheet.md +112 -0
- package/dist/context/breadcrumb.md +106 -0
- package/dist/context/button-group.md +100 -0
- package/dist/context/button.md +117 -0
- package/dist/context/calendar.md +118 -0
- package/dist/context/card.md +90 -0
- package/dist/context/carousel.md +101 -0
- package/dist/context/chart/area-chart.md +99 -0
- package/dist/context/chart/bar-chart.md +114 -0
- package/dist/context/chart/boxplot.md +82 -0
- package/dist/context/chart/bubble-chart.md +80 -0
- package/dist/context/chart/bullet.md +75 -0
- package/dist/context/chart/calendar.md +79 -0
- package/dist/context/chart/candlestick.md +104 -0
- package/dist/context/chart/combo-chart.md +78 -0
- package/dist/context/chart/funnel.md +87 -0
- package/dist/context/chart/gauge.md +87 -0
- package/dist/context/chart/heatmap.md +77 -0
- package/dist/context/chart/histogram.md +74 -0
- package/dist/context/chart/kpi.md +70 -0
- package/dist/context/chart/line-chart.md +113 -0
- package/dist/context/chart/meter.md +71 -0
- package/dist/context/chart/pie-chart.md +126 -0
- package/dist/context/chart/polar.md +92 -0
- package/dist/context/chart/radar.md +81 -0
- package/dist/context/chart/radial-bar.md +96 -0
- package/dist/context/chart/sankey.md +89 -0
- package/dist/context/chart/scatter-chart.md +90 -0
- package/dist/context/chart/sparkline.md +69 -0
- package/dist/context/chart/stream.md +88 -0
- package/dist/context/chart/sunburst.md +93 -0
- package/dist/context/chart/treemap.md +84 -0
- package/dist/context/chat-bubble.md +116 -0
- package/dist/context/checkbox-card.md +104 -0
- package/dist/context/checkbox.md +104 -0
- package/dist/context/code-snippet.md +118 -0
- package/dist/context/code.md +103 -0
- package/dist/context/collapsible.md +104 -0
- package/dist/context/color-picker.md +101 -0
- package/dist/context/combobox.md +125 -0
- package/dist/context/command-menu.md +121 -0
- package/dist/context/comparison.md +117 -0
- package/dist/context/contained-list.md +103 -0
- package/dist/context/context-menu.md +103 -0
- package/dist/context/copy-button.md +106 -0
- package/dist/context/data-list.md +99 -0
- package/dist/context/data-table.md +149 -0
- package/dist/context/date-picker.md +116 -0
- package/dist/context/date-range-picker.md +113 -0
- package/dist/context/dock.md +117 -0
- package/dist/context/drawer.md +111 -0
- package/dist/context/dropdown.md +96 -0
- package/dist/context/editable.md +101 -0
- package/dist/context/editor/code-editor.md +146 -0
- package/dist/context/editor/highlight.md +74 -0
- package/dist/context/empty-state.md +101 -0
- package/dist/context/fab.md +128 -0
- package/dist/context/field.md +118 -0
- package/dist/context/file-uploader.md +121 -0
- package/dist/context/filter.md +129 -0
- package/dist/context/flow/flow-background.md +103 -0
- package/dist/context/flow/flow-canvas.md +82 -0
- package/dist/context/flow/flow-controls.md +84 -0
- package/dist/context/flow/flow-edge.md +128 -0
- package/dist/context/flow/flow-handle.md +83 -0
- package/dist/context/flow/flow-minimap.md +89 -0
- package/dist/context/flow/flow-node.md +97 -0
- package/dist/context/flow/flow-panel.md +75 -0
- package/dist/context/flow/flow-story.md +145 -0
- package/dist/context/flow/flow.md +139 -0
- package/dist/context/form.md +104 -0
- package/dist/context/header-panel.md +96 -0
- package/dist/context/header.md +104 -0
- package/dist/context/heading.md +107 -0
- package/dist/context/hover-card.md +108 -0
- package/dist/context/icon-button.md +115 -0
- package/dist/context/image.md +115 -0
- package/dist/context/indicator.md +95 -0
- package/dist/context/inline-loading.md +101 -0
- package/dist/context/input-group.md +122 -0
- package/dist/context/input.md +101 -0
- package/dist/context/item.md +109 -0
- package/dist/context/join.md +97 -0
- package/dist/context/kbd.md +100 -0
- package/dist/context/label.md +117 -0
- package/dist/context/layout/app-shell.md +85 -0
- package/dist/context/layout/auth-layout.md +74 -0
- package/dist/context/layout/auto-grid.md +69 -0
- package/dist/context/layout/center.md +67 -0
- package/dist/context/layout/columns.md +70 -0
- package/dist/context/layout/dashboard-layout.md +68 -0
- package/dist/context/layout/grid.md +70 -0
- package/dist/context/layout/masonry.md +70 -0
- package/dist/context/layout/page-header.md +75 -0
- package/dist/context/layout/section.md +69 -0
- package/dist/context/layout/settings-layout.md +68 -0
- package/dist/context/layout/spacer.md +64 -0
- package/dist/context/layout/split-view.md +71 -0
- package/dist/context/layout/stack.md +93 -0
- package/dist/context/link.md +112 -0
- package/dist/context/list.md +109 -0
- package/dist/context/log-viewer.md +124 -0
- package/dist/context/menu-button.md +137 -0
- package/dist/context/menu.md +108 -0
- package/dist/context/menubar.md +92 -0
- package/dist/context/modal.md +96 -0
- package/dist/context/multi-select.md +104 -0
- package/dist/context/native-select.md +118 -0
- package/dist/context/navigation-menu.md +95 -0
- package/dist/context/notification.md +116 -0
- package/dist/context/number-input.md +117 -0
- package/dist/context/otp-input.md +98 -0
- package/dist/context/overflow-menu.md +107 -0
- package/dist/context/pagination.md +123 -0
- package/dist/context/password-input.md +100 -0
- package/dist/context/popover.md +108 -0
- package/dist/context/progress-bar.md +107 -0
- package/dist/context/progress-circle.md +101 -0
- package/dist/context/progress-indicator.md +105 -0
- package/dist/context/progress.md +109 -0
- package/dist/context/prose.md +110 -0
- package/dist/context/pull-to-refresh.md +101 -0
- package/dist/context/qr-code.md +101 -0
- package/dist/context/radial-progress.md +117 -0
- package/dist/context/radio-card.md +95 -0
- package/dist/context/radio.md +94 -0
- package/dist/context/rating-group.md +97 -0
- package/dist/context/relative-time.md +90 -0
- package/dist/context/resizable.md +102 -0
- package/dist/context/scroll-area.md +101 -0
- package/dist/context/search.md +113 -0
- package/dist/context/section/cta.md +83 -0
- package/dist/context/section/feature-grid.md +98 -0
- package/dist/context/section/hero.md +101 -0
- package/dist/context/section/media-masonry.md +77 -0
- package/dist/context/section/page-footer.md +101 -0
- package/dist/context/section/stats-band.md +81 -0
- package/dist/context/segmented-control.md +101 -0
- package/dist/context/select.md +101 -0
- package/dist/context/separator.md +88 -0
- package/dist/context/sheet.md +100 -0
- package/dist/context/shell-header.md +105 -0
- package/dist/context/side-nav.md +134 -0
- package/dist/context/skeleton.md +101 -0
- package/dist/context/skip-nav.md +103 -0
- package/dist/context/slider.md +98 -0
- package/dist/context/spinner.md +89 -0
- package/dist/context/stack.md +96 -0
- package/dist/context/stat.md +101 -0
- package/dist/context/status.md +105 -0
- package/dist/context/steps.md +124 -0
- package/dist/context/structured-list.md +107 -0
- package/dist/context/swap.md +100 -0
- package/dist/context/swipe-item.md +110 -0
- package/dist/context/switcher.md +97 -0
- package/dist/context/tabs.md +93 -0
- package/dist/context/tag.md +110 -0
- package/dist/context/tags-input.md +94 -0
- package/dist/context/text.md +111 -0
- package/dist/context/textarea.md +98 -0
- package/dist/context/tile.md +116 -0
- package/dist/context/time-picker.md +102 -0
- package/dist/context/timeline.md +93 -0
- package/dist/context/toast.md +91 -0
- package/dist/context/toc.md +110 -0
- package/dist/context/toggle-group.md +118 -0
- package/dist/context/toggle.md +103 -0
- package/dist/context/toggletip.md +119 -0
- package/dist/context/tooltip.md +92 -0
- package/dist/context/tree-view.md +107 -0
- package/dist/context/user.md +100 -0
- package/dist/context/visually-hidden.md +90 -0
- package/dist/context.json +22456 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +73 -32
- package/dist/index.mjs.map +1 -1
- package/dist/marketplace.json +70 -0
- package/dist/registry.json +2832 -358
- package/dist/tokens.catalog.json +2375 -0
- package/dist/tokens.variants.json +3291 -0
- package/package.json +4 -3
- package/readme.body.md +53 -23
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# CodeSnippet
|
|
2
|
+
|
|
3
|
+
**Category:** display
|
|
4
|
+
**Description:** Displays code (inline, single-line, or multi-line) with an optional copy button, lightweight built-in syntax highlighting for bash/css/js/ts, and an optional terminal-window look
|
|
5
|
+
|
|
6
|
+
## When to use
|
|
7
|
+
|
|
8
|
+
- Showing a command, token, or path the user is expected to copy
|
|
9
|
+
- Displaying a short read-only code block in docs or UI
|
|
10
|
+
- Inline code references inside flowing text (inline variant)
|
|
11
|
+
|
|
12
|
+
## When NOT to use
|
|
13
|
+
|
|
14
|
+
- An editable code input — use a textarea or code editor
|
|
15
|
+
- Whole source files needing folding, diagnostics, or many languages — use a dedicated viewer; the built-in highlighter is a presentational scan for bash/css/js/ts only
|
|
16
|
+
|
|
17
|
+
## Anti-patterns
|
|
18
|
+
|
|
19
|
+
### The inline variant is a single in-text chip; multi-line content belongs in the multi variant
|
|
20
|
+
|
|
21
|
+
**Bad:** `<CodeSnippet variant="inline" code={"line1\nline2"} />`
|
|
22
|
+
**Good:** `<CodeSnippet variant="multi" code={"line1\nline2"} />`
|
|
23
|
+
**Why:** The inline variant is a single in-text chip; multi-line content belongs in the multi variant
|
|
24
|
+
|
|
25
|
+
## Related components
|
|
26
|
+
|
|
27
|
+
- **CopyButton** (pairs-with): CodeSnippet embeds the same clipboard behavior for its copy affordance
|
|
28
|
+
|
|
29
|
+
## Accessibility rationale
|
|
30
|
+
|
|
31
|
+
Code is rendered in semantic <code>/<pre>. The copy button is a real button with an aria-label that flips between the copy and copied messages so the action and its result are announced. Line numbers are aria-hidden so they are not read as content.
|
|
32
|
+
|
|
33
|
+
## Props
|
|
34
|
+
|
|
35
|
+
| Name | Type | Required | Default | Description |
|
|
36
|
+
| ----------------- | ------------------------------------ | -------- | ------- | ----------------------------------------------------------------------------------------- |
|
|
37
|
+
| `code` | `string` | Yes | — | The code to display (and copy). |
|
|
38
|
+
| `variant` | `'inline' \| 'single' \| 'multi'` | No | single | inline = a <code> span; single = one-line <pre>; multi = multi-line <pre>. |
|
|
39
|
+
| `language` | `'bash' \| 'css' \| 'js' \| 'ts'` | No | — | Enables built-in syntax highlighting for the block variants; inline is never highlighted. |
|
|
40
|
+
| `terminal` | `boolean` | No | false | Renders terminal-window chrome (title bar with dots). Block variants only. |
|
|
41
|
+
| `title` | `string` | No | — | Optional label shown in the terminal title bar. |
|
|
42
|
+
| `showLineNumbers` | `boolean` | No | — | Show line numbers (multi only; ignored when language is set). |
|
|
43
|
+
| `showCopyButton` | `boolean` | No | — | Show the copy-to-clipboard button. Defaults true for single/multi, false for inline. |
|
|
44
|
+
| `labels` | `{ copy?: string; copied?: string }` | No | — | Overrides for the component’s user-visible strings (i18n). |
|
|
45
|
+
| `className` | `string` | No | — | Additional CSS class names merged onto the root element. |
|
|
46
|
+
|
|
47
|
+
## Tokens
|
|
48
|
+
|
|
49
|
+
- `--cascivo-font-mono`
|
|
50
|
+
- `--cascivo-color-text`
|
|
51
|
+
- `--cascivo-color-text-muted`
|
|
52
|
+
- `--cascivo-color-bg-subtle`
|
|
53
|
+
- `--cascivo-color-surface`
|
|
54
|
+
- `--cascivo-color-border`
|
|
55
|
+
- `--cascivo-radius-surface`
|
|
56
|
+
- `--cascivo-radius-control`
|
|
57
|
+
|
|
58
|
+
## Examples
|
|
59
|
+
|
|
60
|
+
### Install command
|
|
61
|
+
|
|
62
|
+
```jsx
|
|
63
|
+
<CodeSnippet code="npx cascivo add button" language="bash" />
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Inline
|
|
67
|
+
|
|
68
|
+
```jsx
|
|
69
|
+
<p>
|
|
70
|
+
Run <CodeSnippet variant="inline" code="pnpm build" /> first.
|
|
71
|
+
</p>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Terminal block
|
|
75
|
+
|
|
76
|
+
Multi-line shell transcript with terminal-window chrome.
|
|
77
|
+
|
|
78
|
+
```jsx
|
|
79
|
+
<CodeSnippet
|
|
80
|
+
variant="multi"
|
|
81
|
+
language="bash"
|
|
82
|
+
terminal
|
|
83
|
+
title="deploy.sh"
|
|
84
|
+
code={'pnpm build\npnpm deploy'}
|
|
85
|
+
/>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Boundaries
|
|
89
|
+
|
|
90
|
+
| Area | Level | Note |
|
|
91
|
+
| ----------- | -------- | -------------------------------------------------------------------- |
|
|
92
|
+
| variant | strict | inline \| single \| multi — controls the wrapping element and layout |
|
|
93
|
+
| copy button | flexible | Shown by default for single/multi; togglable via showCopyButton |
|
|
94
|
+
|
|
95
|
+
## AI context prompt
|
|
96
|
+
|
|
97
|
+
Copy this into an LLM context bar before editing this component:
|
|
98
|
+
|
|
99
|
+
```text
|
|
100
|
+
I am modifying the cascivo CodeSnippet component (display). Displays code (inline, single-line, or multi-line) with an optional copy button, lightweight built-in syntax highlighting for bash/css/js/ts, and an optional terminal-window look
|
|
101
|
+
|
|
102
|
+
Architecture constraints — follow exactly:
|
|
103
|
+
- Signals only (useSignal/useComputed/useSignalEffect from @cascivo/core). Never useState/useEffect/useContext/useReducer.
|
|
104
|
+
- Style only through --cascivo-* custom properties. No Tailwind, no inline styles, no CSS-in-JS.
|
|
105
|
+
- Responsive via @container queries on the canonical scale (30rem/40rem/64rem/80rem). Do not use global viewport @media breakpoints.
|
|
106
|
+
- Visual states (hover/focus/active/disabled) via CSS pseudo-classes, not JS.
|
|
107
|
+
- CSS logical properties only (RTL-safe).
|
|
108
|
+
|
|
109
|
+
CodeSnippet is strictly bound to these tokens — use only these, do not invent token names:
|
|
110
|
+
--cascivo-font-mono, --cascivo-color-text, --cascivo-color-text-muted, --cascivo-color-bg-subtle, --cascivo-color-surface, --cascivo-color-border, --cascivo-radius-surface, --cascivo-radius-control
|
|
111
|
+
|
|
112
|
+
Accessibility: role "group", WCAG 2.2-AA, keyboard: Enter/Space. Keep it AA.
|
|
113
|
+
|
|
114
|
+
Do not change (strict): variant — inline | single | multi — controls the wrapping element and layout
|
|
115
|
+
Flexible: copy button.
|
|
116
|
+
|
|
117
|
+
Do not invent props, tokens, or global viewport media queries.
|
|
118
|
+
```
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Code
|
|
2
|
+
|
|
3
|
+
**Category:** display
|
|
4
|
+
**Description:** Inline code span for identifiers, commands, and short snippets
|
|
5
|
+
|
|
6
|
+
## When to use
|
|
7
|
+
|
|
8
|
+
- Marking up an inline identifier, command, path, or token within prose
|
|
9
|
+
- Distinguishing literal code from surrounding text with a monospace span
|
|
10
|
+
|
|
11
|
+
## When NOT to use
|
|
12
|
+
|
|
13
|
+
- Multi-line code blocks with syntax highlighting — use a <pre> block
|
|
14
|
+
- Keyboard shortcuts the user should press — use Kbd
|
|
15
|
+
|
|
16
|
+
## Anti-patterns
|
|
17
|
+
|
|
18
|
+
### Code marks literal code; key presses are semantically Kbd
|
|
19
|
+
|
|
20
|
+
**Bad:** `<Code>Press Cmd+K</Code>`
|
|
21
|
+
**Good:** `<Kbd>⌘</Kbd> <Kbd>K</Kbd>`
|
|
22
|
+
**Why:** Code marks literal code; key presses are semantically Kbd
|
|
23
|
+
|
|
24
|
+
## Related components
|
|
25
|
+
|
|
26
|
+
- **Kbd** (alternative): Kbd is for keys to press, not code to read
|
|
27
|
+
- **Prose** (pairs-with): Prose styles inline <code> automatically in authored content
|
|
28
|
+
|
|
29
|
+
## Accessibility rationale
|
|
30
|
+
|
|
31
|
+
Renders a native <code> element so assistive tech can expose the content as code; relies on monospace and surface, not color alone, to distinguish it
|
|
32
|
+
|
|
33
|
+
## Props
|
|
34
|
+
|
|
35
|
+
| Name | Type | Required | Default | Description |
|
|
36
|
+
| ------ | -------------- | -------- | ------- | ----------------------------------------------------- |
|
|
37
|
+
| `size` | `'sm' \| 'md'` | No | md | Visual size of the component (e.g. 'sm', 'md', 'lg'). |
|
|
38
|
+
|
|
39
|
+
## Tokens
|
|
40
|
+
|
|
41
|
+
- `--cascivo-font-mono`
|
|
42
|
+
- `--cascivo-color-text`
|
|
43
|
+
- `--cascivo-color-surface`
|
|
44
|
+
- `--cascivo-color-border`
|
|
45
|
+
- `--cascivo-radius-indicator`
|
|
46
|
+
- `--cascivo-text-xs`
|
|
47
|
+
- `--cascivo-text-sm`
|
|
48
|
+
|
|
49
|
+
## Examples
|
|
50
|
+
|
|
51
|
+
### Default
|
|
52
|
+
|
|
53
|
+
```jsx
|
|
54
|
+
<Code>npx cascivo add button</Code>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### In a sentence
|
|
58
|
+
|
|
59
|
+
Sits inline with surrounding text
|
|
60
|
+
|
|
61
|
+
```jsx
|
|
62
|
+
<Text>
|
|
63
|
+
Run <Code>vp check</Code> before committing.
|
|
64
|
+
</Text>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Small
|
|
68
|
+
|
|
69
|
+
```jsx
|
|
70
|
+
<Code size="sm">--cascivo-color-accent</Code>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Boundaries
|
|
74
|
+
|
|
75
|
+
| Area | Level | Note |
|
|
76
|
+
| ----------- | -------- | ---------------------------------------------------------------------------- |
|
|
77
|
+
| size | flexible | sm fits dense UI; md matches body text |
|
|
78
|
+
| token names | strict | Font and surface must resolve to --cascivo-font-mono and --cascivo-\* tokens |
|
|
79
|
+
|
|
80
|
+
## AI context prompt
|
|
81
|
+
|
|
82
|
+
Copy this into an LLM context bar before editing this component:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
I am modifying the cascivo Code component (display). Inline code span for identifiers, commands, and short snippets
|
|
86
|
+
|
|
87
|
+
Architecture constraints — follow exactly:
|
|
88
|
+
- Signals only (useSignal/useComputed/useSignalEffect from @cascivo/core). Never useState/useEffect/useContext/useReducer.
|
|
89
|
+
- Style only through --cascivo-* custom properties. No Tailwind, no inline styles, no CSS-in-JS.
|
|
90
|
+
- Responsive via @container queries on the canonical scale (30rem/40rem/64rem/80rem). Do not use global viewport @media breakpoints.
|
|
91
|
+
- Visual states (hover/focus/active/disabled) via CSS pseudo-classes, not JS.
|
|
92
|
+
- CSS logical properties only (RTL-safe).
|
|
93
|
+
|
|
94
|
+
Code is strictly bound to these tokens — use only these, do not invent token names:
|
|
95
|
+
--cascivo-font-mono, --cascivo-color-text, --cascivo-color-surface, --cascivo-color-border, --cascivo-radius-indicator, --cascivo-text-xs, --cascivo-text-sm
|
|
96
|
+
|
|
97
|
+
Accessibility: role "code", WCAG 2.2-AA. Keep it AA.
|
|
98
|
+
|
|
99
|
+
Do not change (strict): token names — Font and surface must resolve to --cascivo-font-mono and --cascivo-* tokens
|
|
100
|
+
Flexible: size.
|
|
101
|
+
|
|
102
|
+
Do not invent props, tokens, or global viewport media queries.
|
|
103
|
+
```
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Collapsible
|
|
2
|
+
|
|
3
|
+
**Category:** display
|
|
4
|
+
**Description:** A single disclosure region toggled open and closed by its trigger
|
|
5
|
+
|
|
6
|
+
## When to use
|
|
7
|
+
|
|
8
|
+
- Hiding a single secondary block until the user asks for it
|
|
9
|
+
- Progressive disclosure of details, advanced options, or supplementary text
|
|
10
|
+
- Toggling one region whose state you may want to control externally
|
|
11
|
+
|
|
12
|
+
## When NOT to use
|
|
13
|
+
|
|
14
|
+
- Several mutually related sections — use Accordion instead
|
|
15
|
+
- Transient overlays anchored to a trigger — use Dropdown or Popover
|
|
16
|
+
|
|
17
|
+
## Anti-patterns
|
|
18
|
+
|
|
19
|
+
### Accordion manages single/multiple-open semantics and shared keyboard navigation
|
|
20
|
+
|
|
21
|
+
**Bad:** `Stacking many Collapsibles to emulate an accordion`
|
|
22
|
+
**Good:** `Use Accordion when sections are a related set`
|
|
23
|
+
**Why:** Accordion manages single/multiple-open semantics and shared keyboard navigation
|
|
24
|
+
|
|
25
|
+
## Related components
|
|
26
|
+
|
|
27
|
+
- **Accordion** (alternative): Multi-region disclosure; Collapsible is the single-region case
|
|
28
|
+
|
|
29
|
+
## Accessibility rationale
|
|
30
|
+
|
|
31
|
+
The trigger is a native button exposing aria-expanded and aria-controls; the region is labelled by the trigger, so screen readers announce the disclosure state and target
|
|
32
|
+
|
|
33
|
+
## Props
|
|
34
|
+
|
|
35
|
+
| Name | Type | Required | Default | Description |
|
|
36
|
+
| -------------- | ------------------------- | -------- | ------- | --------------------------------------------------- |
|
|
37
|
+
| `open` | `boolean` | No | — | Controlled open state |
|
|
38
|
+
| `defaultOpen` | `boolean` | No | false | Initial open state for uncontrolled use |
|
|
39
|
+
| `onOpenChange` | `(open: boolean) => void` | No | — | Called whenever the open state should change |
|
|
40
|
+
| `trigger` | `ReactNode` | Yes | — | Content rendered inside the built-in trigger button |
|
|
41
|
+
| `disabled` | `boolean` | No | false | Disables the trigger button |
|
|
42
|
+
| `children` | `ReactNode` | No | — | Content of the collapsible region |
|
|
43
|
+
|
|
44
|
+
## Tokens
|
|
45
|
+
|
|
46
|
+
- `--cascivo-color-text`
|
|
47
|
+
- `--cascivo-color-text-subtle`
|
|
48
|
+
- `--cascivo-color-border`
|
|
49
|
+
- `--cascivo-color-bg-subtle`
|
|
50
|
+
- `--cascivo-radius-control`
|
|
51
|
+
- `--cascivo-focus-ring`
|
|
52
|
+
- `--cascivo-space-3`
|
|
53
|
+
- `--cascivo-duration-200`
|
|
54
|
+
- `--cascivo-ease-out`
|
|
55
|
+
|
|
56
|
+
## Examples
|
|
57
|
+
|
|
58
|
+
### Uncontrolled
|
|
59
|
+
|
|
60
|
+
```jsx
|
|
61
|
+
<Collapsible trigger="Show details">
|
|
62
|
+
<p>Hidden content revealed on toggle.</p>
|
|
63
|
+
</Collapsible>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Open by default
|
|
67
|
+
|
|
68
|
+
```jsx
|
|
69
|
+
<Collapsible defaultOpen trigger="Details">
|
|
70
|
+
<p>Visible initially.</p>
|
|
71
|
+
</Collapsible>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Boundaries
|
|
75
|
+
|
|
76
|
+
| Area | Level | Note |
|
|
77
|
+
| -------------- | -------- | -------------------------------------------------------------------- |
|
|
78
|
+
| open state | flexible | Controlled or uncontrolled via open / defaultOpen |
|
|
79
|
+
| trigger markup | strict | Always rendered as a native button for keyboard and a11y correctness |
|
|
80
|
+
|
|
81
|
+
## AI context prompt
|
|
82
|
+
|
|
83
|
+
Copy this into an LLM context bar before editing this component:
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
I am modifying the cascivo Collapsible component (display). A single disclosure region toggled open and closed by its trigger
|
|
87
|
+
|
|
88
|
+
Architecture constraints — follow exactly:
|
|
89
|
+
- Signals only (useSignal/useComputed/useSignalEffect from @cascivo/core). Never useState/useEffect/useContext/useReducer.
|
|
90
|
+
- Style only through --cascivo-* custom properties. No Tailwind, no inline styles, no CSS-in-JS.
|
|
91
|
+
- Responsive via @container queries on the canonical scale (30rem/40rem/64rem/80rem). Do not use global viewport @media breakpoints.
|
|
92
|
+
- Visual states (hover/focus/active/disabled) via CSS pseudo-classes, not JS.
|
|
93
|
+
- CSS logical properties only (RTL-safe).
|
|
94
|
+
|
|
95
|
+
Collapsible is strictly bound to these tokens — use only these, do not invent token names:
|
|
96
|
+
--cascivo-color-text, --cascivo-color-text-subtle, --cascivo-color-border, --cascivo-color-bg-subtle, --cascivo-radius-control, --cascivo-focus-ring, --cascivo-space-3, --cascivo-duration-200, --cascivo-ease-out
|
|
97
|
+
|
|
98
|
+
Accessibility: role "region", WCAG 2.2-AA, keyboard: Enter/Space. Keep it AA.
|
|
99
|
+
|
|
100
|
+
Do not change (strict): trigger markup — Always rendered as a native button for keyboard and a11y correctness
|
|
101
|
+
Flexible: open state.
|
|
102
|
+
|
|
103
|
+
Do not invent props, tokens, or global viewport media queries.
|
|
104
|
+
```
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# ColorPicker
|
|
2
|
+
|
|
3
|
+
**Category:** inputs
|
|
4
|
+
**Description:** Interactive color selection widget with saturation/lightness area, hue and alpha sliders
|
|
5
|
+
|
|
6
|
+
## When to use
|
|
7
|
+
|
|
8
|
+
- Letting a user choose an arbitrary color via a visual saturation/lightness area plus hue control
|
|
9
|
+
- Brand or theme customization UIs where an exact color value (hex) is captured
|
|
10
|
+
- Forms that need an optional alpha channel alongside the color
|
|
11
|
+
|
|
12
|
+
## When NOT to use
|
|
13
|
+
|
|
14
|
+
- Choosing from a small fixed palette only — use a swatch RadioGroup instead
|
|
15
|
+
- A single accent toggle where a few preset chips suffice
|
|
16
|
+
|
|
17
|
+
## Anti-patterns
|
|
18
|
+
|
|
19
|
+
### A free-form picker invites off-brand values when only a fixed set is allowed
|
|
20
|
+
|
|
21
|
+
**Bad:** `<ColorPicker /> with no presets for a brand palette of 4 fixed colors`
|
|
22
|
+
**Good:** `<RadioGroup> of color swatches`
|
|
23
|
+
**Why:** A free-form picker invites off-brand values when only a fixed set is allowed
|
|
24
|
+
|
|
25
|
+
## Related components
|
|
26
|
+
|
|
27
|
+
- **Slider** (contains): Hue and alpha channels are range sliders
|
|
28
|
+
- **Input** (pairs-with): The hex text field lets users paste an exact value
|
|
29
|
+
|
|
30
|
+
## Accessibility rationale
|
|
31
|
+
|
|
32
|
+
The saturation/lightness area is a focusable role="slider" with arrow-key nudging and an aria-valuetext reporting the current hex; hue and alpha are native range inputs that inherit platform slider semantics and announcements.
|
|
33
|
+
|
|
34
|
+
## Props
|
|
35
|
+
|
|
36
|
+
| Name | Type | Required | Default | Description |
|
|
37
|
+
| --------------- | ------------------------- | -------- | ------- | ------------------------------------------------------------------ |
|
|
38
|
+
| `value` | `string` | No | — | Controlled hex color value |
|
|
39
|
+
| `defaultValue` | `string` | No | #3b82f6 | The initial value when uncontrolled. |
|
|
40
|
+
| `onValueChange` | `(value: string) => void` | No | — | Called with the new value when it changes. |
|
|
41
|
+
| `presets` | `string[]` | No | — | Preset swatch colors |
|
|
42
|
+
| `alpha` | `boolean` | No | true | When true, enables alpha (opacity) selection. |
|
|
43
|
+
| `label` | `string` | No | — | Text label for the control. |
|
|
44
|
+
| `disabled` | `boolean` | No | false | When true, disables the control and removes it from the tab order. |
|
|
45
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | No | md | Visual size of the component (e.g. 'sm', 'md', 'lg'). |
|
|
46
|
+
|
|
47
|
+
## Tokens
|
|
48
|
+
|
|
49
|
+
- `--cascivo-color-accent`
|
|
50
|
+
- `--cascivo-color-surface`
|
|
51
|
+
- `--cascivo-color-border`
|
|
52
|
+
- `--cascivo-color-border-strong`
|
|
53
|
+
- `--cascivo-radius-md`
|
|
54
|
+
- `--cascivo-radius-full`
|
|
55
|
+
- `--cascivo-focus-ring`
|
|
56
|
+
|
|
57
|
+
## Examples
|
|
58
|
+
|
|
59
|
+
### Basic
|
|
60
|
+
|
|
61
|
+
```jsx
|
|
62
|
+
<ColorPicker defaultValue="#3b82f6" onValueChange={setColor} />
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### With presets
|
|
66
|
+
|
|
67
|
+
```jsx
|
|
68
|
+
<ColorPicker presets={['#ef4444', '#3b82f6', '#10b981']} alpha={false} />
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Boundaries
|
|
72
|
+
|
|
73
|
+
| Area | Level | Note |
|
|
74
|
+
| ----------- | -------- | -------------------------------------------------------------------------- |
|
|
75
|
+
| color model | flexible | Values are stored as hex; consumers can convert to rgb/hsl/oklch as needed |
|
|
76
|
+
| token names | strict | Surfaces, borders and focus ring must resolve to --cascivo-\* tokens |
|
|
77
|
+
|
|
78
|
+
## AI context prompt
|
|
79
|
+
|
|
80
|
+
Copy this into an LLM context bar before editing this component:
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
I am modifying the cascivo ColorPicker component (inputs). Interactive color selection widget with saturation/lightness area, hue and alpha sliders
|
|
84
|
+
|
|
85
|
+
Architecture constraints — follow exactly:
|
|
86
|
+
- Signals only (useSignal/useComputed/useSignalEffect from @cascivo/core). Never useState/useEffect/useContext/useReducer.
|
|
87
|
+
- Style only through --cascivo-* custom properties. No Tailwind, no inline styles, no CSS-in-JS.
|
|
88
|
+
- Responsive via @container queries on the canonical scale (30rem/40rem/64rem/80rem). Do not use global viewport @media breakpoints.
|
|
89
|
+
- Visual states (hover/focus/active/disabled) via CSS pseudo-classes, not JS.
|
|
90
|
+
- CSS logical properties only (RTL-safe).
|
|
91
|
+
|
|
92
|
+
ColorPicker is strictly bound to these tokens — use only these, do not invent token names:
|
|
93
|
+
--cascivo-color-accent, --cascivo-color-surface, --cascivo-color-border, --cascivo-color-border-strong, --cascivo-radius-md, --cascivo-radius-full, --cascivo-focus-ring
|
|
94
|
+
|
|
95
|
+
Accessibility: role "slider", WCAG 2.2-AA, keyboard: ArrowLeft/ArrowRight/ArrowUp/ArrowDown. Keep it AA.
|
|
96
|
+
|
|
97
|
+
Do not change (strict): token names — Surfaces, borders and focus ring must resolve to --cascivo-* tokens
|
|
98
|
+
Flexible: color model.
|
|
99
|
+
|
|
100
|
+
Do not invent props, tokens, or global viewport media queries.
|
|
101
|
+
```
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Combobox
|
|
2
|
+
|
|
3
|
+
**Category:** inputs
|
|
4
|
+
**Description:** Filterable single-select with an animated custom listbox, built on the dropdown open/close machine
|
|
5
|
+
|
|
6
|
+
## When to use
|
|
7
|
+
|
|
8
|
+
- Single-select from a long list where type-to-filter makes finding an option faster
|
|
9
|
+
- Form fields where the value is one of many known options (country, assignee, repository)
|
|
10
|
+
|
|
11
|
+
## When NOT to use
|
|
12
|
+
|
|
13
|
+
- Short option lists (≈2–7) where filtering adds no value — use Select or SegmentedControl
|
|
14
|
+
- Selecting multiple values — use MultiSelect
|
|
15
|
+
- Triggering actions or commands — use Dropdown or CommandMenu
|
|
16
|
+
|
|
17
|
+
## Anti-patterns
|
|
18
|
+
|
|
19
|
+
### Combobox has role="combobox" with a listbox of selectable values and onChange semantics — actions belong in a menu
|
|
20
|
+
|
|
21
|
+
**Bad:** `Using Combobox to fire actions like "Delete" or "Export"`
|
|
22
|
+
**Good:** `Use Dropdown for actions; Combobox is for picking a value`
|
|
23
|
+
**Why:** Combobox has role="combobox" with a listbox of selectable values and onChange semantics — actions belong in a menu
|
|
24
|
+
|
|
25
|
+
### Without filtering the list becomes an unusable scroll; either keep search on or switch to a different selection pattern
|
|
26
|
+
|
|
27
|
+
**Bad:** `Setting searchable={false} on a 200-item list`
|
|
28
|
+
**Good:** `undefined`
|
|
29
|
+
**Why:** Without filtering the list becomes an unusable scroll; either keep search on or switch to a different selection pattern
|
|
30
|
+
|
|
31
|
+
## Related components
|
|
32
|
+
|
|
33
|
+
- **Select** (alternative): Use for short lists that do not need type-to-filter
|
|
34
|
+
- **MultiSelect** (alternative): Use when more than one value can be selected
|
|
35
|
+
- **CommandMenu** (alternative): Use the Cmd+K palette for command/navigation search rather than value selection
|
|
36
|
+
|
|
37
|
+
## Accessibility rationale
|
|
38
|
+
|
|
39
|
+
Trigger exposes role="combobox" with aria-expanded, aria-controls, aria-haspopup="listbox", and aria-activedescendant pointing at the active option so screen readers track focus through arrow navigation without moving DOM focus off the input; error state is wired via aria-invalid + aria-describedby and announced with role="alert"
|
|
40
|
+
|
|
41
|
+
## Props
|
|
42
|
+
|
|
43
|
+
| Name | Type | Required | Default | Description |
|
|
44
|
+
| -------------- | -------------------------------------- | -------- | ------- | ------------------------------------------------------------------ |
|
|
45
|
+
| `options` | `ComboboxOption[]` | Yes | — | The selectable options. |
|
|
46
|
+
| `value` | `string` | No | — | The controlled value. |
|
|
47
|
+
| `defaultValue` | `string` | No | — | The initial value when uncontrolled. |
|
|
48
|
+
| `onChange` | `(value: string \| undefined) => void` | No | — | Called when the value changes. |
|
|
49
|
+
| `clearable` | `boolean` | No | false | When true, shows a control to clear the selected value. |
|
|
50
|
+
| `searchable` | `boolean` | No | true | When true, shows a search/filter input. |
|
|
51
|
+
| `label` | `string` | No | — | Text label for the control. |
|
|
52
|
+
| `hint` | `string` | No | — | Supplementary hint text shown with the control. |
|
|
53
|
+
| `error` | `string` | No | — | Error message shown when the value is invalid. |
|
|
54
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | No | 'md' | Visual size of the component (e.g. 'sm', 'md', 'lg'). |
|
|
55
|
+
| `disabled` | `boolean` | No | false | When true, disables the control and removes it from the tab order. |
|
|
56
|
+
| `labels` | `ComboboxLabels` | No | — | Overrides for the component’s user-visible strings (i18n). |
|
|
57
|
+
| `className` | `string` | No | — | Additional CSS class names merged onto the root element. |
|
|
58
|
+
|
|
59
|
+
## Tokens
|
|
60
|
+
|
|
61
|
+
- `--cascivo-color-surface`
|
|
62
|
+
- `--cascivo-color-surface-overlay`
|
|
63
|
+
- `--cascivo-color-bg-subtle`
|
|
64
|
+
- `--cascivo-color-border`
|
|
65
|
+
- `--cascivo-color-border-strong`
|
|
66
|
+
- `--cascivo-color-text`
|
|
67
|
+
- `--cascivo-color-text-muted`
|
|
68
|
+
- `--cascivo-color-text-subtle`
|
|
69
|
+
- `--cascivo-color-accent`
|
|
70
|
+
- `--cascivo-color-danger`
|
|
71
|
+
- `--cascivo-radius-input`
|
|
72
|
+
- `--cascivo-radius-md`
|
|
73
|
+
- `--cascivo-radius-sm`
|
|
74
|
+
- `--cascivo-shadow-lg`
|
|
75
|
+
- `--cascivo-motion-enter`
|
|
76
|
+
- `--cascivo-z-dropdown`
|
|
77
|
+
|
|
78
|
+
## Examples
|
|
79
|
+
|
|
80
|
+
### Basic combobox
|
|
81
|
+
|
|
82
|
+
```jsx
|
|
83
|
+
<Combobox
|
|
84
|
+
label="Country"
|
|
85
|
+
options={[
|
|
86
|
+
{ value: 'us', label: 'United States' },
|
|
87
|
+
{ value: 'de', label: 'Germany' },
|
|
88
|
+
{ value: 'fr', label: 'France' },
|
|
89
|
+
]}
|
|
90
|
+
onChange={(value) => console.log(value)}
|
|
91
|
+
/>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Boundaries
|
|
95
|
+
|
|
96
|
+
| Area | Level | Note |
|
|
97
|
+
| -------------------------- | -------- | ---------------------------------------------------------------------------------------- |
|
|
98
|
+
| searchable | flexible | Filtering can be toggled off for short lists via searchable={false} |
|
|
99
|
+
| controlled vs uncontrolled | flexible | Supports value + onChange or defaultValue |
|
|
100
|
+
| token names | strict | Listbox/field styling resolves to semantic --cascivo-color-_ / --cascivo-radius-_ tokens |
|
|
101
|
+
|
|
102
|
+
## AI context prompt
|
|
103
|
+
|
|
104
|
+
Copy this into an LLM context bar before editing this component:
|
|
105
|
+
|
|
106
|
+
```text
|
|
107
|
+
I am modifying the cascivo Combobox component (inputs). Filterable single-select with an animated custom listbox, built on the dropdown open/close machine
|
|
108
|
+
|
|
109
|
+
Architecture constraints — follow exactly:
|
|
110
|
+
- Signals only (useSignal/useComputed/useSignalEffect from @cascivo/core). Never useState/useEffect/useContext/useReducer.
|
|
111
|
+
- Style only through --cascivo-* custom properties. No Tailwind, no inline styles, no CSS-in-JS.
|
|
112
|
+
- Responsive via @container queries on the canonical scale (30rem/40rem/64rem/80rem). Do not use global viewport @media breakpoints.
|
|
113
|
+
- Visual states (hover/focus/active/disabled) via CSS pseudo-classes, not JS.
|
|
114
|
+
- CSS logical properties only (RTL-safe).
|
|
115
|
+
|
|
116
|
+
Combobox is strictly bound to these tokens — use only these, do not invent token names:
|
|
117
|
+
--cascivo-color-surface, --cascivo-color-surface-overlay, --cascivo-color-bg-subtle, --cascivo-color-border, --cascivo-color-border-strong, --cascivo-color-text, --cascivo-color-text-muted, --cascivo-color-text-subtle, --cascivo-color-accent, --cascivo-color-danger, --cascivo-radius-input, --cascivo-radius-md, --cascivo-radius-sm, --cascivo-shadow-lg, --cascivo-motion-enter, --cascivo-z-dropdown
|
|
118
|
+
|
|
119
|
+
Accessibility: role "combobox", WCAG 2.2-AA, keyboard: ArrowDown/ArrowUp/Enter/Escape/Tab. Keep it AA.
|
|
120
|
+
|
|
121
|
+
Do not change (strict): token names — Listbox/field styling resolves to semantic --cascivo-color-* / --cascivo-radius-* tokens
|
|
122
|
+
Flexible: searchable, controlled vs uncontrolled.
|
|
123
|
+
|
|
124
|
+
Do not invent props, tokens, or global viewport media queries.
|
|
125
|
+
```
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# CommandMenu
|
|
2
|
+
|
|
3
|
+
**Category:** overlay
|
|
4
|
+
**Description:** Cmd+K command palette with fuzzy search over grouped commands
|
|
5
|
+
|
|
6
|
+
## When to use
|
|
7
|
+
|
|
8
|
+
- Giving power users a global Cmd/Ctrl+K palette to search and run actions or navigate
|
|
9
|
+
- Exposing many commands across grouped categories that benefit from fuzzy search
|
|
10
|
+
- Multi-step flows where selecting an item drills into a nested page of further commands
|
|
11
|
+
|
|
12
|
+
## When NOT to use
|
|
13
|
+
|
|
14
|
+
- Picking a form value from a list — use Combobox
|
|
15
|
+
- A small set of actions tied to a specific trigger button — use Dropdown
|
|
16
|
+
|
|
17
|
+
## Anti-patterns
|
|
18
|
+
|
|
19
|
+
### CommandMenu is a modal command palette whose items run onSelect callbacks or open sub-pages; it has no controlled form value
|
|
20
|
+
|
|
21
|
+
**Bad:** `Using CommandMenu as a form field to capture a selected value`
|
|
22
|
+
**Good:** `Use Combobox for value selection inside a form`
|
|
23
|
+
**Why:** CommandMenu is a modal command palette whose items run onSelect callbacks or open sub-pages; it has no controlled form value
|
|
24
|
+
|
|
25
|
+
### Each item must do exactly one thing — run an action (onSelect) or push a nested page (page)
|
|
26
|
+
|
|
27
|
+
**Bad:** `Items with both onSelect and page set, or neither`
|
|
28
|
+
**Good:** `undefined`
|
|
29
|
+
**Why:** Each item must do exactly one thing — run an action (onSelect) or push a nested page (page)
|
|
30
|
+
|
|
31
|
+
## Related components
|
|
32
|
+
|
|
33
|
+
- **Combobox** (alternative): Use for filtering and selecting a form value rather than running commands
|
|
34
|
+
- **Dropdown** (alternative): Use for a small action menu anchored to a button instead of a global palette
|
|
35
|
+
- **Modal** (contained-by): Renders inside a native modal dialog with backdrop dismiss
|
|
36
|
+
|
|
37
|
+
## Accessibility rationale
|
|
38
|
+
|
|
39
|
+
The search input is role="combobox" with aria-controls, aria-expanded, aria-autocomplete="list" and aria-activedescendant so navigation is announced without moving DOM focus from the input; it renders in a native <dialog> for focus trapping, the empty/loading state uses role="status", and footer hints are aria-hidden as redundant decoration
|
|
40
|
+
|
|
41
|
+
## Props
|
|
42
|
+
|
|
43
|
+
| Name | Type | Required | Default | Description |
|
|
44
|
+
| --------------- | ------------------------- | -------- | ------------------------- | --------------------------------------------------------------------- |
|
|
45
|
+
| `open` | `boolean` | Yes | — | Whether the component is open (controlled). |
|
|
46
|
+
| `onOpenChange` | `(open: boolean) => void` | Yes | — | Called with the next open state when it changes. |
|
|
47
|
+
| `groups` | `CommandGroup[]` | Yes | — | The grouped commands to display. |
|
|
48
|
+
| `placeholder` | `string` | No | Type a command or search… | Placeholder text shown when the field is empty. |
|
|
49
|
+
| `emptyLabel` | `string` | No | No results found | Text shown when no commands match the query. |
|
|
50
|
+
| `hotkey` | `boolean` | No | true | Global Cmd/Ctrl+K toggles the menu via onOpenChange |
|
|
51
|
+
| `label` | `string` | No | Command menu | Text label for the control. |
|
|
52
|
+
| `loading` | `boolean` | No | false | Shows a loading spinner in place of the empty state (for async items) |
|
|
53
|
+
| `onQueryChange` | `(query: string) => void` | No | — | Fires on every query keystroke — use to fetch async items |
|
|
54
|
+
| `className` | `string` | No | — | Additional CSS class names merged onto the root element. |
|
|
55
|
+
|
|
56
|
+
## Tokens
|
|
57
|
+
|
|
58
|
+
- `--cascivo-color-surface-overlay`
|
|
59
|
+
- `--cascivo-color-border`
|
|
60
|
+
- `--cascivo-color-bg-subtle`
|
|
61
|
+
- `--cascivo-color-text`
|
|
62
|
+
- `--cascivo-color-text-muted`
|
|
63
|
+
- `--cascivo-color-text-subtle`
|
|
64
|
+
- `--cascivo-radius-modal`
|
|
65
|
+
- `--cascivo-radius-sm`
|
|
66
|
+
- `--cascivo-shadow-xl`
|
|
67
|
+
- `--cascivo-motion-enter`
|
|
68
|
+
- `--cascivo-motion-exit`
|
|
69
|
+
|
|
70
|
+
## Examples
|
|
71
|
+
|
|
72
|
+
### Basic command menu
|
|
73
|
+
|
|
74
|
+
```jsx
|
|
75
|
+
<CommandMenu
|
|
76
|
+
open={open}
|
|
77
|
+
onOpenChange={setOpen}
|
|
78
|
+
groups={[
|
|
79
|
+
{
|
|
80
|
+
heading: 'Actions',
|
|
81
|
+
items: [
|
|
82
|
+
{ id: 'new', label: 'New file', shortcut: ['⌘', 'N'], onSelect: createFile },
|
|
83
|
+
{ id: 'search', label: 'Search docs', keywords: ['find'], onSelect: openSearch },
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
]}
|
|
87
|
+
/>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Boundaries
|
|
91
|
+
|
|
92
|
+
| Area | Level | Note |
|
|
93
|
+
| ----------- | -------- | --------------------------------------------------------------------------------------- |
|
|
94
|
+
| hotkey | flexible | Global Cmd/Ctrl+K binding can be disabled via hotkey={false} for custom triggering |
|
|
95
|
+
| async items | flexible | onQueryChange + loading allow fetching items per keystroke |
|
|
96
|
+
| token names | strict | Palette styling resolves to semantic --cascivo-color-\* / --cascivo-radius-modal tokens |
|
|
97
|
+
|
|
98
|
+
## AI context prompt
|
|
99
|
+
|
|
100
|
+
Copy this into an LLM context bar before editing this component:
|
|
101
|
+
|
|
102
|
+
```text
|
|
103
|
+
I am modifying the cascivo CommandMenu component (overlay). Cmd+K command palette with fuzzy search over grouped commands
|
|
104
|
+
|
|
105
|
+
Architecture constraints — follow exactly:
|
|
106
|
+
- Signals only (useSignal/useComputed/useSignalEffect from @cascivo/core). Never useState/useEffect/useContext/useReducer.
|
|
107
|
+
- Style only through --cascivo-* custom properties. No Tailwind, no inline styles, no CSS-in-JS.
|
|
108
|
+
- Responsive via @container queries on the canonical scale (30rem/40rem/64rem/80rem). Do not use global viewport @media breakpoints.
|
|
109
|
+
- Visual states (hover/focus/active/disabled) via CSS pseudo-classes, not JS.
|
|
110
|
+
- CSS logical properties only (RTL-safe).
|
|
111
|
+
|
|
112
|
+
CommandMenu is strictly bound to these tokens — use only these, do not invent token names:
|
|
113
|
+
--cascivo-color-surface-overlay, --cascivo-color-border, --cascivo-color-bg-subtle, --cascivo-color-text, --cascivo-color-text-muted, --cascivo-color-text-subtle, --cascivo-radius-modal, --cascivo-radius-sm, --cascivo-shadow-xl, --cascivo-motion-enter, --cascivo-motion-exit
|
|
114
|
+
|
|
115
|
+
Accessibility: role "combobox", WCAG 2.2-AA, keyboard: Cmd/Ctrl+K/ArrowDown/ArrowUp/Home/End/Enter/Escape. Keep it AA.
|
|
116
|
+
|
|
117
|
+
Do not change (strict): token names — Palette styling resolves to semantic --cascivo-color-* / --cascivo-radius-modal tokens
|
|
118
|
+
Flexible: hotkey, async items.
|
|
119
|
+
|
|
120
|
+
Do not invent props, tokens, or global viewport media queries.
|
|
121
|
+
```
|