@sdaia-ds/mcp 0.0.0-stage → 3.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 +212 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +291 -0
- package/dist/index.js.map +1 -0
- package/knowledge/actions/breadcrumb.md +50 -0
- package/knowledge/actions/button-menu.md +82 -0
- package/knowledge/actions/button-split.md +69 -0
- package/knowledge/actions/button.md +101 -0
- package/knowledge/actions/content-switcher.md +66 -0
- package/knowledge/actions/date-picker.md +115 -0
- package/knowledge/actions/floating-button.md +100 -0
- package/knowledge/actions/horizontal-tabs.md +52 -0
- package/knowledge/actions/link.md +76 -0
- package/knowledge/actions/modal.md +103 -0
- package/knowledge/actions/pagination.md +69 -0
- package/knowledge/actions/radio-button.md +88 -0
- package/knowledge/actions/switch.md +87 -0
- package/knowledge/actions/tag.md +69 -0
- package/knowledge/ai/agent-activity.md +65 -0
- package/knowledge/ai/agent-card.md +65 -0
- package/knowledge/ai/agent-handoff.md +65 -0
- package/knowledge/ai/ai-citation.md +78 -0
- package/knowledge/ai/ai-code-block.md +86 -0
- package/knowledge/ai/ai-disclaimer.md +84 -0
- package/knowledge/ai/ai-message-bubble.md +81 -0
- package/knowledge/ai/ai-message.md +118 -0
- package/knowledge/ai/ai-prompt-input.md +93 -0
- package/knowledge/ai/ai-states.md +107 -0
- package/knowledge/ai/ai-status-indicator.md +81 -0
- package/knowledge/ai/ai-suggested-prompts.md +62 -0
- package/knowledge/ai/ai-thinking-indicator.md +94 -0
- package/knowledge/ai/artifact-viewer.md +105 -0
- package/knowledge/ai/citation.md +61 -0
- package/knowledge/ai/context-manager.md +111 -0
- package/knowledge/ai/prompt-context.md +72 -0
- package/knowledge/ai/prompt-suggestion.md +68 -0
- package/knowledge/ai/prompt-template.md +71 -0
- package/knowledge/ai/prompt-variable.md +61 -0
- package/knowledge/ai/reasoning-trace.md +106 -0
- package/knowledge/ai/source-explorer.md +117 -0
- package/knowledge/ai/source-group.md +59 -0
- package/knowledge/ai/source-reference.md +70 -0
- package/knowledge/ai/thinking-panel.md +77 -0
- package/knowledge/ai/tool-activity-feed.md +67 -0
- package/knowledge/ai/tool-call-card.md +66 -0
- package/knowledge/ai/tool-status-row.md +72 -0
- package/knowledge/ai/tool-timeline-item.md +71 -0
- package/knowledge/ai/voice-session.md +93 -0
- package/knowledge/feedback/alert.md +106 -0
- package/knowledge/feedback/badge.md +86 -0
- package/knowledge/feedback/card.md +54 -0
- package/knowledge/feedback/feedback-overview.md +37 -0
- package/knowledge/feedback/feedback.md +46 -0
- package/knowledge/feedback/help-icon.md +57 -0
- package/knowledge/feedback/loading-indicator.md +76 -0
- package/knowledge/feedback/notification-banner.md +73 -0
- package/knowledge/feedback/notification-popup.md +87 -0
- package/knowledge/feedback/notifications.md +158 -0
- package/knowledge/feedback/progress-bar.md +69 -0
- package/knowledge/feedback/rating-overview.md +58 -0
- package/knowledge/feedback/rating.md +64 -0
- package/knowledge/feedback/skeleton-avatar.md +48 -0
- package/knowledge/feedback/skeleton.md +53 -0
- package/knowledge/feedback/toast.md +74 -0
- package/knowledge/feedback/tooltip.md +72 -0
- package/knowledge/form/autocomplete.md +100 -0
- package/knowledge/form/checkbox.md +95 -0
- package/knowledge/form/date-time-field.md +63 -0
- package/knowledge/form/error-summary.md +56 -0
- package/knowledge/form/field-group.md +57 -0
- package/knowledge/form/file-uploader.md +60 -0
- package/knowledge/form/form-section.md +58 -0
- package/knowledge/form/number-input.md +92 -0
- package/knowledge/form/otp-input.md +83 -0
- package/knowledge/form/password-input.md +49 -0
- package/knowledge/form/range-slider.md +71 -0
- package/knowledge/form/rich-text-editor.md +106 -0
- package/knowledge/form/select.md +113 -0
- package/knowledge/form/signature.md +83 -0
- package/knowledge/form/slider.md +66 -0
- package/knowledge/form/text-area.md +90 -0
- package/knowledge/form/text-input.md +132 -0
- package/knowledge/form/time-input.md +44 -0
- package/knowledge/form/time-picker.md +73 -0
- package/knowledge/foundations/accessibility.md +97 -0
- package/knowledge/foundations/colors.md +1113 -0
- package/knowledge/foundations/figma.md +30 -0
- package/knowledge/foundations/icon-usage.md +114 -0
- package/knowledge/foundations/icons.md +16 -0
- package/knowledge/foundations/motion.md +39 -0
- package/knowledge/foundations/radius.md +17 -0
- package/knowledge/foundations/responsive.md +64 -0
- package/knowledge/foundations/rtl.md +106 -0
- package/knowledge/foundations/spacing.md +27 -0
- package/knowledge/foundations/theme.md +115 -0
- package/knowledge/foundations/tokens.json +12080 -0
- package/knowledge/foundations/typography.md +45 -0
- package/knowledge/general/accordion.md +79 -0
- package/knowledge/general/activity.md +44 -0
- package/knowledge/general/app-shell.md +64 -0
- package/knowledge/general/area-chart.md +89 -0
- package/knowledge/general/audio-player.md +85 -0
- package/knowledge/general/avatar-group.md +50 -0
- package/knowledge/general/avatar.md +61 -0
- package/knowledge/general/carousel-image.md +103 -0
- package/knowledge/general/chart.md +25 -0
- package/knowledge/general/chip.md +90 -0
- package/knowledge/general/code-snippet.md +80 -0
- package/knowledge/general/column-chart.md +84 -0
- package/knowledge/general/context-menu.md +55 -0
- package/knowledge/general/digital-stamp.md +77 -0
- package/knowledge/general/divider.md +65 -0
- package/knowledge/general/donut-chart.md +75 -0
- package/knowledge/general/draggable-list.md +43 -0
- package/knowledge/general/dropdown.md +90 -0
- package/knowledge/general/empty-state.md +60 -0
- package/knowledge/general/filtration.md +85 -0
- package/knowledge/general/footer.md +59 -0
- package/knowledge/general/line-chart.md +95 -0
- package/knowledge/general/list.md +91 -0
- package/knowledge/general/media-gallery.md +85 -0
- package/knowledge/general/media-viewer.md +78 -0
- package/knowledge/general/menu.md +66 -0
- package/knowledge/general/metric.md +92 -0
- package/knowledge/general/nav-bar.md +62 -0
- package/knowledge/general/nav-header.md +125 -0
- package/knowledge/general/number.md +72 -0
- package/knowledge/general/page-template.md +80 -0
- package/knowledge/general/pdf-viewer.md +91 -0
- package/knowledge/general/pie-chart-panel.md +86 -0
- package/knowledge/general/popover.md +115 -0
- package/knowledge/general/progress-circle.md +63 -0
- package/knowledge/general/quote.md +64 -0
- package/knowledge/general/radial-stepper.md +72 -0
- package/knowledge/general/scatter-chart.md +62 -0
- package/knowledge/general/second-nav-header.md +55 -0
- package/knowledge/general/slideout-menu.md +92 -0
- package/knowledge/general/stepper.md +42 -0
- package/knowledge/general/structured-list.md +52 -0
- package/knowledge/general/table-bulk-actions-bar.md +66 -0
- package/knowledge/general/table-of-content.md +49 -0
- package/knowledge/general/table.md +113 -0
- package/knowledge/general/tree-view.md +55 -0
- package/knowledge/general/vertical-tabs.md +48 -0
- package/knowledge/general/video-player.md +88 -0
- package/knowledge/manifest.json +919 -0
- package/knowledge/patterns/buttons-with-sdaia-touch.md +34 -0
- package/knowledge/patterns/sdaia-logo-animation.md +35 -0
- package/knowledge/patterns/switch-with-sdaia-touch.md +29 -0
- package/knowledge/setup.md +125 -0
- package/package.json +45 -4
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Agent Handoff
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Agent Handoff
|
|
5
|
+
- Slug: `agent-handoff`
|
|
6
|
+
- Category: AI
|
|
7
|
+
- Install: `npx sdaia-ui@latest add agent-handoff`
|
|
8
|
+
- Import: `import { AgentHandoff } from '@/components/ui/AgentHandoff'`
|
|
9
|
+
- Installed files: `AgentHandoff.tsx`, `AgentHandoff.types.ts`, `AgentHandoff.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/agent-handoff
|
|
11
|
+
|
|
12
|
+
> **Hard rule:** `sdaia-ui` is a CLI, not a runtime package — NEVER run `npm install sdaia-ui` and NEVER `import … from 'sdaia-ui'`. Run `npx sdaia-ui@latest init` once per project (Tailwind CSS v4, tokens, the IBM Plex Sans Arabic font, the `@/` alias on Vite, `cn`), then `npx sdaia-ui@latest add agent-handoff`. It copies the source into your components folder (`components/ui/AgentHandoff/`, under `src/` when the project has one); import it as `@/components/ui/AgentHandoff`. The files are yours: prefer props and composition over editing them. `npx sdaia-ui@latest update` never overwrites a file you changed: it keeps it and says it has updates; `diff` shows them and `update --force` takes them.
|
|
13
|
+
|
|
14
|
+
## Props
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `variant?` | `'brand' \| 'neutral' \| 'outline'` | 'brand' | Visual style of the handoff container. - `brand` — brand-tinted surface + brand border (default) - `neutral` — subtle surface + subtle border - `outline` — transparent surface + default border |
|
|
18
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Layout direction. `rtl` mirrors the flow (destination on the start side). Inherits from the document when unset. |
|
|
19
|
+
| `source` | `AgentHandoffAgent` | — | The agent delegating the task. |
|
|
20
|
+
| `destination` | `AgentHandoffAgent` | — | The agent receiving the task. |
|
|
21
|
+
| `label?` | `ReactNode` | labels.connector ('Delegating Task') | Connector pill text describing the handoff. Wins over `labels.connector`; pass `null` to hide the pill. |
|
|
22
|
+
| `showLabel?` | `boolean` | true | Show the connector label pill. |
|
|
23
|
+
| `arrowIcon?` | `string` | arrowRight02Stroke | Connector arrow icon — points from source to destination and flips in RTL. |
|
|
24
|
+
| `labels?` | `Partial<AgentHandoffLabels>` | — | Translatable built-in strings (see ). |
|
|
25
|
+
| `as?` | `ElementType` | 'div' | Override the rendered root element. |
|
|
26
|
+
|
|
27
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `children`.
|
|
28
|
+
|
|
29
|
+
## Options (allowed values)
|
|
30
|
+
- `variant`: `'brand'` \| `'neutral'` \| `'outline'` — Visual style of the handoff — mirrors the Figma `Style` property.
|
|
31
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction. `rtl` mirrors the flow (destination on the start side).
|
|
32
|
+
Inherits from the document when unset.
|
|
33
|
+
|
|
34
|
+
## Accessibility
|
|
35
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
36
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
37
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
38
|
+
|
|
39
|
+
## Design tokens used
|
|
40
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
41
|
+
- `var(--ds-color-bg-brand-subtle)`
|
|
42
|
+
- `var(--ds-color-bg-muted)`
|
|
43
|
+
- `var(--ds-color-bg-raised)`
|
|
44
|
+
- `var(--ds-color-bg-subtle)`
|
|
45
|
+
- `var(--ds-color-border-brand)`
|
|
46
|
+
- `var(--ds-color-border-default)`
|
|
47
|
+
- `var(--ds-color-border-subtle)`
|
|
48
|
+
- `var(--ds-color-icon-brand)`
|
|
49
|
+
- `var(--ds-color-icon-neutral)`
|
|
50
|
+
- `var(--ds-color-text-default)`
|
|
51
|
+
- `var(--ds-color-text-paragraph-muted)`
|
|
52
|
+
- `var(--ds-radius-l)`
|
|
53
|
+
- `var(--ds-radius-m)`
|
|
54
|
+
- `var(--ds-spacing-lg)`
|
|
55
|
+
- `var(--ds-spacing-sm)`
|
|
56
|
+
- `var(--ds-spacing-xs)`
|
|
57
|
+
- `var(--ds-spacing-xxs)`
|
|
58
|
+
|
|
59
|
+
## AI usage guidance
|
|
60
|
+
When generating UI:
|
|
61
|
+
- Install with `npx sdaia-ui@latest add agent-handoff` (after `npx sdaia-ui@latest init`), then import `{ AgentHandoff }` from `@/components/ui/AgentHandoff`.
|
|
62
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
63
|
+
- Use only the documented option values listed under "Options".
|
|
64
|
+
- Pass icons via `<DgaIcon data={…} className="size-icon-sm" />` from `@platformscode/icons` only — see `get_foundations` (`icon-usage`). Never emoji, Lucide, or random icons (e.g. `pizza01Stroke` for dark mode).
|
|
65
|
+
- Pick one theme per screen: dark is `.theme-dark` (or `.dark`) on `<html>`; style surrounding layout with DS tokens (`get_tokens`), never hardcoded colors.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# AI Citation
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: AI Citation
|
|
5
|
+
- Slug: `ai-citation`
|
|
6
|
+
- Category: AI
|
|
7
|
+
- Install: `npx sdaia-ui@latest add ai-citation`
|
|
8
|
+
- Import: `import { AiCitation } from '@/components/ui/AiCitation'`
|
|
9
|
+
- Installed files: `AiCitation.tsx`, `AiCitation.types.ts`, `AiCitation.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/ai-citation
|
|
11
|
+
|
|
12
|
+
> **Hard rule:** `sdaia-ui` is a CLI, not a runtime package — NEVER run `npm install sdaia-ui` and NEVER `import … from 'sdaia-ui'`. Run `npx sdaia-ui@latest init` once per project (Tailwind CSS v4, tokens, the IBM Plex Sans Arabic font, the `@/` alias on Vite, `cn`), then `npx sdaia-ui@latest add ai-citation`. It copies the source into your components folder (`components/ui/AiCitation/`, under `src/` when the project has one); import it as `@/components/ui/AiCitation`. The files are yours: prefer props and composition over editing them. `npx sdaia-ui@latest update` never overwrites a file you changed: it keeps it and says it has updates; `diff` shows them and `update --force` takes them.
|
|
13
|
+
|
|
14
|
+
## Props
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `variant?` | `'neutral' \| 'brand' \| 'outline'` | 'neutral' | Visual style — mirrors the Figma `Style` property. |
|
|
18
|
+
| `type?` | `'inline-chip' \| 'sources-panel'` | 'inline-chip' | Structural layout — mirrors the Figma `Type` property. |
|
|
19
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Layout direction. `rtl` mirrors the layout via logical alignment. |
|
|
20
|
+
| `text?` | `ReactNode` | — | The cited text fragment shown before the chip (e.g. `…reducing dependence on oil`). Omit to render the chip on its own so it can be dropped inline after any run of text. (`inline-chip` only.) |
|
|
21
|
+
| `index?` | `ReactNode` | — | The citation number shown inside the chip. Omit to render the link glyph alone — there is no built-in sample number. (`inline-chip` only.) |
|
|
22
|
+
| `href?` | `string` | — | When set, the chip renders as an anchor to this URL. (`inline-chip` only.) |
|
|
23
|
+
| `target?` | `string` | — | Anchor target — defaults to `_blank` when `href` is set. |
|
|
24
|
+
| `rel?` | `string` | — | Anchor rel — defaults to `noopener noreferrer` for `_blank`. |
|
|
25
|
+
| `onChipClick?` | `MouseEventHandler<HTMLElement>` | — | When set (and no `href`), the chip renders as a button. (`inline-chip` only.) |
|
|
26
|
+
| `chipLabel?` | `string` | `View citation <index>` | Accessible label for an interactive chip. Wins over `labels.chip`. |
|
|
27
|
+
| `label?` | `ReactNode` | 'Sources' (`sources-panel` only.) | Panel header label. Wins over `labels.sources`. |
|
|
28
|
+
| `count?` | `number` | — | Header count badge. Defaults to the number of `sources`. |
|
|
29
|
+
| `hideCount?` | `boolean` | false | Hide the header count badge. |
|
|
30
|
+
| `sources?` | `AiCitationSource[]` | [] | The source rows. (`sources-panel` only.) |
|
|
31
|
+
| `autoNumber?` | `boolean` | true | Auto-number rows by position when a row omits `number`. |
|
|
32
|
+
| `labels?` | `Partial<AiCitationLabels>` | — | Overrides for every built-in visible or accessible string (see ). Unset keys keep the English defaults. |
|
|
33
|
+
| `as?` | `ElementType` | 'span' (inline) / 'div' (panel) | Override the rendered root element. |
|
|
34
|
+
|
|
35
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `children`, `title`.
|
|
36
|
+
|
|
37
|
+
## Options (allowed values)
|
|
38
|
+
- `variant`: `'neutral'` \| `'brand'` \| `'outline'` — Figma `Style` property — the visual treatment of the citation.
|
|
39
|
+
- `type`: `'inline-chip'` \| `'sources-panel'` — Figma `Type` property — the two structural layouts.
|
|
40
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction. `rtl` mirrors the layout via logical alignment.
|
|
41
|
+
|
|
42
|
+
## Accessibility
|
|
43
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
44
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
45
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
46
|
+
|
|
47
|
+
## Design tokens used
|
|
48
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
49
|
+
- `var(--ds-color-)`
|
|
50
|
+
- `var(--ds-color-bg-brand-subtle)`
|
|
51
|
+
- `var(--ds-color-bg-default)`
|
|
52
|
+
- `var(--ds-color-bg-raised)`
|
|
53
|
+
- `var(--ds-color-border-brand)`
|
|
54
|
+
- `var(--ds-color-border-default)`
|
|
55
|
+
- `var(--ds-color-border-muted)`
|
|
56
|
+
- `var(--ds-color-icon-brand)`
|
|
57
|
+
- `var(--ds-color-icon-default)`
|
|
58
|
+
- `var(--ds-color-icon-neutral)`
|
|
59
|
+
- `var(--ds-color-primitive-radius-radius-)`
|
|
60
|
+
- `var(--ds-color-primitive-radius-radius-12)`
|
|
61
|
+
- `var(--ds-color-primitive-radius-radius-6)`
|
|
62
|
+
- `var(--ds-color-primitive-radius-radius-9999)`
|
|
63
|
+
- `var(--ds-color-text-brand)`
|
|
64
|
+
- `var(--ds-color-text-default)`
|
|
65
|
+
- `var(--ds-color-text-paragraph)`
|
|
66
|
+
- `var(--ds-color-text-paragraph-muted)`
|
|
67
|
+
- `var(--ds-spacing-lg)`
|
|
68
|
+
- `var(--ds-spacing-md)`
|
|
69
|
+
- `var(--ds-spacing-sm)`
|
|
70
|
+
- `var(--ds-spacing-xs)`
|
|
71
|
+
- `var(--ds-spacing-xxs)`
|
|
72
|
+
|
|
73
|
+
## AI usage guidance
|
|
74
|
+
When generating UI:
|
|
75
|
+
- Install with `npx sdaia-ui@latest add ai-citation` (after `npx sdaia-ui@latest init`), then import `{ AiCitation }` from `@/components/ui/AiCitation`.
|
|
76
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
77
|
+
- Use only the documented option values listed under "Options".
|
|
78
|
+
- Pick one theme per screen: dark is `.theme-dark` (or `.dark`) on `<html>`; style surrounding layout with DS tokens (`get_tokens`), never hardcoded colors.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# AI Code Block
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: AI Code Block
|
|
5
|
+
- Slug: `ai-code-block`
|
|
6
|
+
- Category: AI
|
|
7
|
+
- Install: `npx sdaia-ui@latest add ai-code-block`
|
|
8
|
+
- Import: `import { AiCodeBlock } from '@/components/ui/AiCodeBlock'`
|
|
9
|
+
- Installed files: `AiCodeBlock.tsx`, `AiCodeBlock.types.ts`, `AiCodeBlock.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/ai-code-block
|
|
11
|
+
|
|
12
|
+
> **Hard rule:** `sdaia-ui` is a CLI, not a runtime package — NEVER run `npm install sdaia-ui` and NEVER `import … from 'sdaia-ui'`. Run `npx sdaia-ui@latest init` once per project (Tailwind CSS v4, tokens, the IBM Plex Sans Arabic font, the `@/` alias on Vite, `cn`), then `npx sdaia-ui@latest add ai-code-block`. It copies the source into your components folder (`components/ui/AiCodeBlock/`, under `src/` when the project has one); import it as `@/components/ui/AiCodeBlock`. The files are yours: prefer props and composition over editing them. `npx sdaia-ui@latest update` never overwrites a file you changed: it keeps it and says it has updates; `diff` shows them and `update --force` takes them.
|
|
13
|
+
|
|
14
|
+
## Props
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `variant?` | `'neutral' \| 'brand' \| 'outline'` | 'neutral' | Visual style. |
|
|
18
|
+
| `fileName?` | `ReactNode` | — | Filename / label shown in the header (e.g. `response.ts`). |
|
|
19
|
+
| `code?` | `string` | — | Raw code string. Rendered line-by-line as plain on-color text when no are supplied, and used as the copy-to-clipboard payload. |
|
|
20
|
+
| `lines?` | `ReactNode[]` | — | Pre-highlighted code, one entry per line. Strings render as plain on-color text; pass JSX (token-coloured spans) for syntax highlighting. Overrides the plain rendering of . When `lines` contain JSX, also pass so the copy action yields the correct plain text. |
|
|
21
|
+
| `showCopy?` | `boolean` | true | Show the header copy button. |
|
|
22
|
+
| `copyLabel?` | `string` | 'Copy code' | Accessible label for the copy button (idle state). Same as `labels.copy`. |
|
|
23
|
+
| `copiedLabel?` | `string` | 'Copied' | Accessible label announced after a successful copy. Same as `labels.copied`. |
|
|
24
|
+
| `onCopy?` | `(code: string) => void \| Promise<void>` | — | Called when the copy button is pressed, with the resolved copy text. When provided it replaces the default `navigator.clipboard.writeText` behaviour. |
|
|
25
|
+
| `collapsible?` | `boolean` | false | Enable the collapsible behaviour. When collapsed, only the first lines are shown above a "Show N more lines" footer that expands the block. |
|
|
26
|
+
| `collapsed?` | `boolean` | — | Controlled collapsed state. |
|
|
27
|
+
| `defaultCollapsed?` | `boolean` | false | Initial collapsed state when uncontrolled. |
|
|
28
|
+
| `onCollapsedChange?` | `(collapsed: boolean) => void` | — | Called when the collapsed state changes (expansion). |
|
|
29
|
+
| `collapsedVisibleLines?` | `number` | 2 | Number of lines kept visible while collapsed. |
|
|
30
|
+
| `hiddenLineCount?` | `number` | — | Override the hidden-line count shown in the footer label. Defaults to `totalLines - collapsedVisibleLines`. |
|
|
31
|
+
| `showMoreLabel?` | `ReactNode \| ((hiddenLineCount: number) => ReactNode)` | (n) => `Show ${n} more line(s)` | Footer label. Either a node, or a builder receiving the hidden-line count. Same as `labels.showMore`. |
|
|
32
|
+
| `labels?` | `Partial<AiCodeBlockLabels>` | — | Localised copy for the copy action, its confirmation and the footer. |
|
|
33
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Layout direction. `rtl` mirrors the chrome; the code stays LTR. |
|
|
34
|
+
| `as?` | `ElementType` | 'div' | Render the root as a different element. |
|
|
35
|
+
|
|
36
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `style`, `title`, `children`, `onCopy`.
|
|
37
|
+
|
|
38
|
+
## Options (allowed values)
|
|
39
|
+
- `variant`: `'neutral'` \| `'brand'` \| `'outline'` — Visual style — mirrors the Figma `Style` property.
|
|
40
|
+
- `neutral` — subtle-filled header + default (grey) border (default)
|
|
41
|
+
- `brand` — subtle-filled header + brand (green) border
|
|
42
|
+
- `outline` — transparent header + default (grey) border
|
|
43
|
+
|
|
44
|
+
The dark code surface is identical across all three styles; only the chrome
|
|
45
|
+
(border + header fill) changes.
|
|
46
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction. `rtl` mirrors the chrome; the code stays LTR.
|
|
47
|
+
|
|
48
|
+
## Deprecated props
|
|
49
|
+
Do not use in new code:
|
|
50
|
+
- `rtl` — Deprecated boolean form of . Prefer `dir`.
|
|
51
|
+
|
|
52
|
+
## Accessibility
|
|
53
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
54
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
55
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
56
|
+
|
|
57
|
+
## Design tokens used
|
|
58
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
59
|
+
- `var(--ds-brand-neutral-800)`
|
|
60
|
+
- `var(--ds-color-)`
|
|
61
|
+
- `var(--ds-color-bg-brand)`
|
|
62
|
+
- `var(--ds-color-bg-brand-muted)`
|
|
63
|
+
- `var(--ds-color-bg-muted)`
|
|
64
|
+
- `var(--ds-color-bg-subtle)`
|
|
65
|
+
- `var(--ds-color-border-brand)`
|
|
66
|
+
- `var(--ds-color-border-default)`
|
|
67
|
+
- `var(--ds-color-chart-gold)`
|
|
68
|
+
- `var(--ds-color-chart-green)`
|
|
69
|
+
- `var(--ds-color-primitive-public-lavender-300)`
|
|
70
|
+
- `var(--ds-color-primitive-radius-radius-12)`
|
|
71
|
+
- `var(--ds-color-text-brand)`
|
|
72
|
+
- `var(--ds-color-text-on-color)`
|
|
73
|
+
- `var(--ds-color-text-on-color-subtle)`
|
|
74
|
+
- `var(--ds-color-text-paragraph)`
|
|
75
|
+
- `var(--ds-radius-xs)`
|
|
76
|
+
- `var(--ds-spacing-lg)`
|
|
77
|
+
- `var(--ds-spacing-md)`
|
|
78
|
+
- `var(--ds-spacing-sm)`
|
|
79
|
+
- `var(--ds-spacing-xxs)`
|
|
80
|
+
|
|
81
|
+
## AI usage guidance
|
|
82
|
+
When generating UI:
|
|
83
|
+
- Install with `npx sdaia-ui@latest add ai-code-block` (after `npx sdaia-ui@latest init`), then import `{ AiCodeBlock }` from `@/components/ui/AiCodeBlock`.
|
|
84
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
85
|
+
- Use only the documented option values listed under "Options".
|
|
86
|
+
- Pick one theme per screen: dark is `.theme-dark` (or `.dark`) on `<html>`; style surrounding layout with DS tokens (`get_tokens`), never hardcoded colors.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# AI Disclaimer
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: AI Disclaimer
|
|
5
|
+
- Slug: `ai-disclaimer`
|
|
6
|
+
- Category: AI
|
|
7
|
+
- Install: `npx sdaia-ui@latest add ai-disclaimer`
|
|
8
|
+
- Import: `import { AiDisclaimer } from '@/components/ui/AiDisclaimer'`
|
|
9
|
+
- Installed files: `AiDisclaimer.tsx`, `AiDisclaimer.types.ts`, `AiDisclaimer.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/ai-disclaimer
|
|
11
|
+
|
|
12
|
+
> **Hard rule:** `sdaia-ui` is a CLI, not a runtime package — NEVER run `npm install sdaia-ui` and NEVER `import … from 'sdaia-ui'`. Run `npx sdaia-ui@latest init` once per project (Tailwind CSS v4, tokens, the IBM Plex Sans Arabic font, the `@/` alias on Vite, `cn`), then `npx sdaia-ui@latest add ai-disclaimer`. It copies the source into your components folder (`components/ui/AiDisclaimer/`, under `src/` when the project has one); import it as `@/components/ui/AiDisclaimer`. The files are yours: prefer props and composition over editing them. `npx sdaia-ui@latest update` never overwrites a file you changed: it keeps it and says it has updates; `diff` shows them and `update --force` takes them.
|
|
13
|
+
|
|
14
|
+
## Props
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `variant?` | `'neutral' \| 'brand' \| 'outline'` | 'neutral' | Visual style. |
|
|
18
|
+
| `type?` | `'footer' \| 'banner' \| 'model-chip'` | 'banner' | Structural type. |
|
|
19
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Layout direction. `rtl` mirrors the layout. |
|
|
20
|
+
| `icon?` | `string` | — | Leading glyph (a `DgaIcon` data URL from `@platformscode/icons`). Defaults to `alert02Stroke` for the `footer` type and `sparklesStroke` for the `banner` / `model-chip` types. |
|
|
21
|
+
| `text?` | `ReactNode` | 'AI can make mistakes. Verify important information.' | Disclaimer line shown in the `footer` type. Same as `labels.text`. |
|
|
22
|
+
| `title?` | `ReactNode` | 'You’re chatting with an AI assistant' | Banner heading (`banner` type). Same as `labels.title`. |
|
|
23
|
+
| `description?` | `ReactNode` | 'Responses may be inaccurate. Please don’t share sensitive personal information.' | Banner supporting copy (`banner` type). Same as `labels.description`. |
|
|
24
|
+
| `modelName?` | `ReactNode` | — | Assistant name shown in the `model-chip` type. No default — nothing is rendered when omitted. |
|
|
25
|
+
| `modelVersion?` | `ReactNode` | — | Model / version shown after the separator dot in the `model-chip` type. No default — the dot and version are omitted when unset. |
|
|
26
|
+
| `labels?` | `Partial<AiDisclaimerLabels>` | — | Localised built-in copy for the `footer` and `banner` types. |
|
|
27
|
+
| `as?` | `ElementType` | 'div' | Render the root as a different element. |
|
|
28
|
+
|
|
29
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `title`, `style`.
|
|
30
|
+
|
|
31
|
+
## Options (allowed values)
|
|
32
|
+
- `variant`: `'neutral'` \| `'brand'` \| `'outline'` — Visual style — mirrors the Figma `Style` property.
|
|
33
|
+
- `neutral` — quiet surfaces (banner tinted, chip subtle bg + default border) (default)
|
|
34
|
+
- `brand` — brand-tinted surfaces (banner tinted, chip brand bg + brand border)
|
|
35
|
+
- `outline` — minimal surfaces (banner transparent, chip transparent + default border)
|
|
36
|
+
|
|
37
|
+
The `footer` type is identical across all three styles (it has no surface).
|
|
38
|
+
- `type`: `'footer'` \| `'banner'` \| `'model-chip'` — Structural type — mirrors the Figma `Type` property.
|
|
39
|
+
- `footer` — a quiet, centered single-line note (e.g. "AI can make mistakes…")
|
|
40
|
+
- `banner` — a card with a brand AI avatar, a title and a description
|
|
41
|
+
- `model-chip` — a compact pill naming the assistant + model/version
|
|
42
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction. `rtl` mirrors the layout.
|
|
43
|
+
|
|
44
|
+
## Deprecated props
|
|
45
|
+
Do not use in new code:
|
|
46
|
+
- `style` — Visual style (collides with React's `style` attribute).
|
|
47
|
+
- `rtl` — Deprecated boolean form of . Prefer `dir`.
|
|
48
|
+
|
|
49
|
+
## Accessibility
|
|
50
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
51
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
52
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
53
|
+
|
|
54
|
+
## Design tokens used
|
|
55
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
56
|
+
- `var(--ds-color-)`
|
|
57
|
+
- `var(--ds-color-bg-brand)`
|
|
58
|
+
- `var(--ds-color-bg-brand-subtle)`
|
|
59
|
+
- `var(--ds-color-bg-subtle)`
|
|
60
|
+
- `var(--ds-color-border-brand)`
|
|
61
|
+
- `var(--ds-color-border-default)`
|
|
62
|
+
- `var(--ds-color-icon-brand)`
|
|
63
|
+
- `var(--ds-color-icon-neutral)`
|
|
64
|
+
- `var(--ds-color-icon-oncolor)`
|
|
65
|
+
- `var(--ds-color-primitive-radius-radius-12)`
|
|
66
|
+
- `var(--ds-color-text-default)`
|
|
67
|
+
- `var(--ds-color-text-paragraph-muted)`
|
|
68
|
+
- `var(--ds-radius-full)`
|
|
69
|
+
- `var(--ds-spacing-lg)`
|
|
70
|
+
- `var(--ds-spacing-md)`
|
|
71
|
+
- `var(--ds-spacing-sm)`
|
|
72
|
+
- `var(--ds-spacing-xl)`
|
|
73
|
+
- `var(--ds-spacing-xs)`
|
|
74
|
+
- `var(--ds-spacing-xxs)`
|
|
75
|
+
- `var(--ds-text-leading-line-heights-text-sm)`
|
|
76
|
+
- `var(--ds-text-leading-line-heights-text-xs)`
|
|
77
|
+
|
|
78
|
+
## AI usage guidance
|
|
79
|
+
When generating UI:
|
|
80
|
+
- Install with `npx sdaia-ui@latest add ai-disclaimer` (after `npx sdaia-ui@latest init`), then import `{ AiDisclaimer }` from `@/components/ui/AiDisclaimer`.
|
|
81
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
82
|
+
- Use only the documented option values listed under "Options".
|
|
83
|
+
- Pass icons via `<DgaIcon data={…} className="size-icon-sm" />` from `@platformscode/icons` only — see `get_foundations` (`icon-usage`). Never emoji, Lucide, or random icons (e.g. `pizza01Stroke` for dark mode).
|
|
84
|
+
- Pick one theme per screen: dark is `.theme-dark` (or `.dark`) on `<html>`; style surrounding layout with DS tokens (`get_tokens`), never hardcoded colors.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# AI Message Bubble
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: AI Message Bubble
|
|
5
|
+
- Slug: `ai-message-bubble`
|
|
6
|
+
- Category: AI
|
|
7
|
+
- Install: `npx sdaia-ui@latest add ai-message-bubble`
|
|
8
|
+
- Import: `import { AiMessageBubble } from '@/components/ui/AiMessageBubble'`
|
|
9
|
+
- Installed files: `AiMessageBubble.tsx`, `AiMessageBubble.types.ts`, `AiMessageBubble.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/ai-message-bubble
|
|
11
|
+
|
|
12
|
+
> **Hard rule:** `sdaia-ui` is a CLI, not a runtime package — NEVER run `npm install sdaia-ui` and NEVER `import … from 'sdaia-ui'`. Run `npx sdaia-ui@latest init` once per project (Tailwind CSS v4, tokens, the IBM Plex Sans Arabic font, the `@/` alias on Vite, `cn`), then `npx sdaia-ui@latest add ai-message-bubble`. It copies the source into your components folder (`components/ui/AiMessageBubble/`, under `src/` when the project has one); import it as `@/components/ui/AiMessageBubble`. The files are yours: prefer props and composition over editing them. `npx sdaia-ui@latest update` never overwrites a file you changed: it keeps it and says it has updates; `diff` shows them and `update --force` takes them.
|
|
13
|
+
|
|
14
|
+
## Props
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `type?` | `'user' \| 'ai'` | 'ai' (or derived from a legacy `state`) | Who is speaking. |
|
|
18
|
+
| `state?` | `'default' \| 'streaming' \| 'error' \| 'user' \| 'ai'` | 'default' | Bubble condition — `default`, `streaming` (live caret) or `error` (danger bubble + Retry). Legacy values `'user'` / `'ai'` are accepted and mean `type="user" \| "ai"` with `state="default"`. |
|
|
19
|
+
| `variant?` | `'neutral' \| 'brand' \| 'outline'` | 'neutral' | Assistant bubble surface — Figma `Style`. Ignored for `user`/`error`. |
|
|
20
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Layout direction. |
|
|
21
|
+
| `children?` | `ReactNode` | — | Message content. For `error`, defaults to `labels.errorMessage`. |
|
|
22
|
+
| `maxWidth?` | `number \| string` | 520px | Max bubble width (CSS length or px number). The bubble is fluid below it. |
|
|
23
|
+
| `avatar?` | `ReactNode` | — | Override the avatar node entirely. |
|
|
24
|
+
| `avatarIcon?` | `string` | sparklesStroke | Avatar glyph (`@platformscode/icons` data URL). |
|
|
25
|
+
| `showAvatar?` | `boolean` | true | Show the assistant avatar. |
|
|
26
|
+
| `retryLabel?` | `ReactNode` | 'Retry' | Retry button label. Same as `labels.retry`. |
|
|
27
|
+
| `onRetry?` | `MouseEventHandler<HTMLButtonElement>` | — | Fired when the Retry button is pressed. |
|
|
28
|
+
| `showRetry?` | `boolean` | true | Show the Retry action. |
|
|
29
|
+
| `retryIcon?` | `string` | refreshStroke | Retry glyph (`@platformscode/icons` data URL). |
|
|
30
|
+
| `labels?` | `Partial<AiMessageBubbleLabels>` | — | Localised copy for the error message, Retry and the streaming announcement. |
|
|
31
|
+
|
|
32
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …).
|
|
33
|
+
|
|
34
|
+
## Options (allowed values)
|
|
35
|
+
- `type`: `'user'` \| `'ai'` — Who is speaking — Figma `State` User / AI.
|
|
36
|
+
- `state`: `'default'` \| `'streaming'` \| `'error'` \| `'user'` \| `'ai'` — Bubble condition. `'default'` / `'streaming'` / `'error'` are the states.
|
|
37
|
+
|
|
38
|
+
`'user'` and `'ai'` are still accepted for backwards compatibility (they were
|
|
39
|
+
the original single `state` axis) and map to `type` + `state="default"`.
|
|
40
|
+
Prefer `type="user" | "ai"` for those.
|
|
41
|
+
- `variant`: `'neutral'` \| `'brand'` \| `'outline'` — Figma `Style` — the assistant bubble surface treatment.
|
|
42
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction.
|
|
43
|
+
|
|
44
|
+
## Deprecated props
|
|
45
|
+
Do not use in new code:
|
|
46
|
+
- `rtl`
|
|
47
|
+
|
|
48
|
+
## Accessibility
|
|
49
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
50
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
51
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
52
|
+
|
|
53
|
+
## Design tokens used
|
|
54
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
55
|
+
- `var(--ds-color-)`
|
|
56
|
+
- `var(--ds-color-bg-brand)`
|
|
57
|
+
- `var(--ds-color-bg-brand-subtle)`
|
|
58
|
+
- `var(--ds-color-bg-danger-subtle)`
|
|
59
|
+
- `var(--ds-color-bg-raised)`
|
|
60
|
+
- `var(--ds-color-border-brand)`
|
|
61
|
+
- `var(--ds-color-border-danger-subtle)`
|
|
62
|
+
- `var(--ds-color-border-default)`
|
|
63
|
+
- `var(--ds-color-icon-oncolor)`
|
|
64
|
+
- `var(--ds-color-text-danger)`
|
|
65
|
+
- `var(--ds-color-text-default)`
|
|
66
|
+
- `var(--ds-color-text-on-color)`
|
|
67
|
+
- `var(--ds-color-text-paragraph)`
|
|
68
|
+
- `var(--ds-spacing-lg)`
|
|
69
|
+
- `var(--ds-spacing-md)`
|
|
70
|
+
- `var(--ds-spacing-xl)`
|
|
71
|
+
- `var(--ds-spacing-xs)`
|
|
72
|
+
- `var(--ds-text-leading-line-heights-text-md)`
|
|
73
|
+
- `var(--ds-text-leading-line-heights-text-sm)`
|
|
74
|
+
|
|
75
|
+
## AI usage guidance
|
|
76
|
+
When generating UI:
|
|
77
|
+
- Install with `npx sdaia-ui@latest add ai-message-bubble` (after `npx sdaia-ui@latest init`), then import `{ AiMessageBubble }` from `@/components/ui/AiMessageBubble`.
|
|
78
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
79
|
+
- Use only the documented option values listed under "Options".
|
|
80
|
+
- Pass icons via `<DgaIcon data={…} className="size-icon-sm" />` from `@platformscode/icons` only — see `get_foundations` (`icon-usage`). Never emoji, Lucide, or random icons (e.g. `pizza01Stroke` for dark mode).
|
|
81
|
+
- Pick one theme per screen: dark is `.theme-dark` (or `.dark`) on `<html>`; style surrounding layout with DS tokens (`get_tokens`), never hardcoded colors.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# AI Message
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: AI Message
|
|
5
|
+
- Slug: `ai-message`
|
|
6
|
+
- Category: AI
|
|
7
|
+
- Install: `npx sdaia-ui@latest add ai-message`
|
|
8
|
+
- Import: `import { AiMessage } from '@/components/ui/AiMessage'`
|
|
9
|
+
- Installed files: `AiMessage.tsx`, `AiMessage.types.ts`, `AiMessage.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/ai-message
|
|
11
|
+
|
|
12
|
+
> **Hard rule:** `sdaia-ui` is a CLI, not a runtime package — NEVER run `npm install sdaia-ui` and NEVER `import … from 'sdaia-ui'`. Run `npx sdaia-ui@latest init` once per project (Tailwind CSS v4, tokens, the IBM Plex Sans Arabic font, the `@/` alias on Vite, `cn`), then `npx sdaia-ui@latest add ai-message`. It copies the source into your components folder (`components/ui/AiMessage/`, under `src/` when the project has one); import it as `@/components/ui/AiMessage`. The files are yours: prefer props and composition over editing them. `npx sdaia-ui@latest update` never overwrites a file you changed: it keeps it and says it has updates; `diff` shows them and `update --force` takes them.
|
|
13
|
+
|
|
14
|
+
## Props
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `type?` | `'standard' \| 'reasoning' \| 'research' \| 'code' \| 'image-generation' \| 'multi-tool'` | 'standard' | Body composition (block order). |
|
|
18
|
+
| `variant?` | `'neutral' \| 'brand' \| 'outline'` | 'neutral' | Card surface treatment. |
|
|
19
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Layout direction. |
|
|
20
|
+
| `name?` | `ReactNode` | — | Assistant name. No default — renders only when set. |
|
|
21
|
+
| `avatar?` | `ReactNode` | — | Override the avatar node entirely. |
|
|
22
|
+
| `avatarIcon?` | `string` | sparklesStroke | Avatar glyph (`@platformscode/icons` data URL). |
|
|
23
|
+
| `model?` | `ReactNode` | — | Model pill label. No default — renders only when set. |
|
|
24
|
+
| `showModel?` | `boolean` | true | — |
|
|
25
|
+
| `modelIcon?` | `string` | sparklesStroke | Model pill glyph. |
|
|
26
|
+
| `status?` | `AiStatus` | — | AI status shown in the header pill. No default — the pill renders only when set. |
|
|
27
|
+
| `statusLabel?` | `ReactNode` | — | Override the status label. |
|
|
28
|
+
| `statusAppearance?` | `AiStatusAppearance` | 'neutral' | Status pill appearance. |
|
|
29
|
+
| `showStatus?` | `boolean` | true | — |
|
|
30
|
+
| `timestamp?` | `ReactNode` | — | Trailing timestamp. No default — renders only when set. |
|
|
31
|
+
| `showTimestamp?` | `boolean` | true | — |
|
|
32
|
+
| `chips?` | `AiMessageChip[]` | — | Header metadata chips (e.g. Research / Multi-tool). |
|
|
33
|
+
| `showDivider?` | `boolean` | true | Show the divider under the header. |
|
|
34
|
+
| `title?` | `ReactNode` | — | — |
|
|
35
|
+
| `body?` | `ReactNode` | — | — |
|
|
36
|
+
| `bullets?` | `ReactNode[]` | — | Bulleted list items (brand-coloured bullets). |
|
|
37
|
+
| `link?` | `AiMessageLink \| ReactNode` | — | Inline call-to-action link. |
|
|
38
|
+
| `citationsLabel?` | `ReactNode` | labels.citations ('Cited sources') | Label preceding the cited-source chips. |
|
|
39
|
+
| `citations?` | `ReactNode[]` | — | Bare numbered citation chips, e.g. `[1, 2, 3, 4]`. |
|
|
40
|
+
| `sources?` | `AiMessageSource[]` | — | Cited-source cards. |
|
|
41
|
+
| `viewAll?` | `AiMessageAction` | — | "View all N sources" action. |
|
|
42
|
+
| `reasoning?` | `AiMessageReasoning` | — | — |
|
|
43
|
+
| `createdFileChip?` | `AiMessageChip` | — | The "Created file: …" brand chip above the artifact. |
|
|
44
|
+
| `artifact?` | `Partial<ArtifactViewerProps>` | — | Props forwarded to the composed DS `ArtifactViewer` (Code / Multi-tool). The artifact renders only when this is set with a `title`. |
|
|
45
|
+
| `codeActions?` | `AiMessageAction[]` | — | Secondary chip-button row under the code artifact (Copy / Apply / Run again / Explain). |
|
|
46
|
+
| `toolResults?` | `AiMessageToolResult[]` | — | Tool-result rows — the Code-execution result and the Multi-tool timeline. |
|
|
47
|
+
| `image?` | `AiMessageImage` | — | — |
|
|
48
|
+
| `actions?` | `AiMessageAction[]` | — | Footer action bar. Defaults to Copy / Regenerate / Share / Save / Like / More (copy from `labels`). |
|
|
49
|
+
| `showActions?` | `boolean` | true | — |
|
|
50
|
+
| `labels?` | `Partial<AiMessageLabels>` | — | Localised copy for actions, feedback, toggles and status badges. |
|
|
51
|
+
| `children?` | `ReactNode` | — | Custom body — replaces the `type`-driven body entirely (header + footer stay). |
|
|
52
|
+
|
|
53
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `title`, `style`.
|
|
54
|
+
|
|
55
|
+
## Options (allowed values)
|
|
56
|
+
- `type`: `'standard'` \| `'reasoning'` \| `'research'` \| `'code'` \| `'image-generation'` \| `'multi-tool'` — Figma `Type` — selects the body composition.
|
|
57
|
+
- `variant`: `'neutral'` \| `'brand'` \| `'outline'` — Figma `Style` — the root card surface treatment.
|
|
58
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction.
|
|
59
|
+
|
|
60
|
+
## Deprecated props
|
|
61
|
+
Do not use in new code:
|
|
62
|
+
- `style` — Card surface treatment (collides with React's `style` attribute).
|
|
63
|
+
- `rtl`
|
|
64
|
+
|
|
65
|
+
## Accessibility
|
|
66
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
67
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
68
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
69
|
+
|
|
70
|
+
## Design tokens used
|
|
71
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
72
|
+
- `var(--ds-color-)`
|
|
73
|
+
- `var(--ds-color-bg-brand-subtle)`
|
|
74
|
+
- `var(--ds-color-bg-danger-subtle)`
|
|
75
|
+
- `var(--ds-color-bg-default)`
|
|
76
|
+
- `var(--ds-color-bg-info-subtle)`
|
|
77
|
+
- `var(--ds-color-bg-muted)`
|
|
78
|
+
- `var(--ds-color-bg-raised)`
|
|
79
|
+
- `var(--ds-color-bg-subtle)`
|
|
80
|
+
- `var(--ds-color-bg-success-subtle)`
|
|
81
|
+
- `var(--ds-color-bg-warning-subtle)`
|
|
82
|
+
- `var(--ds-color-border-brand)`
|
|
83
|
+
- `var(--ds-color-border-default)`
|
|
84
|
+
- `var(--ds-color-border-subtle)`
|
|
85
|
+
- `var(--ds-color-icon-brand)`
|
|
86
|
+
- `var(--ds-color-icon-danger)`
|
|
87
|
+
- `var(--ds-color-icon-default)`
|
|
88
|
+
- `var(--ds-color-icon-default-400)`
|
|
89
|
+
- `var(--ds-color-icon-info)`
|
|
90
|
+
- `var(--ds-color-icon-success)`
|
|
91
|
+
- `var(--ds-color-icon-warning)`
|
|
92
|
+
- `var(--ds-color-primitive-radius-radius-10)`
|
|
93
|
+
- `var(--ds-color-primitive-radius-radius-12)`
|
|
94
|
+
- `var(--ds-color-primitive-radius-radius-16)`
|
|
95
|
+
- `var(--ds-color-primitive-radius-radius-8)`
|
|
96
|
+
- `var(--ds-color-text-brand)`
|
|
97
|
+
- `var(--ds-color-text-default)`
|
|
98
|
+
- `var(--ds-color-text-info)`
|
|
99
|
+
- `var(--ds-color-text-paragraph)`
|
|
100
|
+
- `var(--ds-color-text-paragraph-muted)`
|
|
101
|
+
- `var(--ds-color-text-success)`
|
|
102
|
+
- `var(--ds-radius-full)`
|
|
103
|
+
- `var(--ds-spacing-lg)`
|
|
104
|
+
- `var(--ds-spacing-md)`
|
|
105
|
+
- `var(--ds-spacing-sm)`
|
|
106
|
+
- `var(--ds-spacing-xl)`
|
|
107
|
+
- `var(--ds-spacing-xs)`
|
|
108
|
+
- `var(--ds-spacing-xxs)`
|
|
109
|
+
- `var(--ds-text-leading-line-heights-text-sm)`
|
|
110
|
+
- `var(--ds-text-leading-line-heights-text-xs)`
|
|
111
|
+
|
|
112
|
+
## AI usage guidance
|
|
113
|
+
When generating UI:
|
|
114
|
+
- Install with `npx sdaia-ui@latest add ai-message` (after `npx sdaia-ui@latest init`), then import `{ AiMessage }` from `@/components/ui/AiMessage`.
|
|
115
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
116
|
+
- Use only the documented option values listed under "Options".
|
|
117
|
+
- Pass icons via `<DgaIcon data={…} className="size-icon-sm" />` from `@platformscode/icons` only — see `get_foundations` (`icon-usage`). Never emoji, Lucide, or random icons (e.g. `pizza01Stroke` for dark mode).
|
|
118
|
+
- Pick one theme per screen: dark is `.theme-dark` (or `.dark`) on `<html>`; style surrounding layout with DS tokens (`get_tokens`), never hardcoded colors.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# AI Prompt Input
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: AI Prompt Input
|
|
5
|
+
- Slug: `ai-prompt-input`
|
|
6
|
+
- Category: AI
|
|
7
|
+
- Install: `npx sdaia-ui@latest add ai-prompt-input`
|
|
8
|
+
- Import: `import { AiPromptInput } from '@/components/ui/AiPromptInput'`
|
|
9
|
+
- Installed files: `AiPromptInput.tsx`, `AiPromptInput.types.ts`, `AiPromptInput.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/ai-prompt-input
|
|
11
|
+
|
|
12
|
+
> **Hard rule:** `sdaia-ui` is a CLI, not a runtime package — NEVER run `npm install sdaia-ui` and NEVER `import … from 'sdaia-ui'`. Run `npx sdaia-ui@latest init` once per project (Tailwind CSS v4, tokens, the IBM Plex Sans Arabic font, the `@/` alias on Vite, `cn`), then `npx sdaia-ui@latest add ai-prompt-input`. It copies the source into your components folder (`components/ui/AiPromptInput/`, under `src/` when the project has one); import it as `@/components/ui/AiPromptInput`. The files are yours: prefer props and composition over editing them. `npx sdaia-ui@latest update` never overwrites a file you changed: it keeps it and says it has updates; `diff` shows them and `update --force` takes them.
|
|
13
|
+
|
|
14
|
+
## Props
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `variant?` | `'neutral' \| 'brand' \| 'outline'` | 'neutral' | Field surface treatment — Figma `Style`. |
|
|
18
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Layout direction. Omit to inherit from the closest `dir` ancestor. |
|
|
19
|
+
| `labels?` | `Partial<AiPromptInputLabels>` | — | Override any built-in string (placeholder, aria-labels, counter, error). |
|
|
20
|
+
| `limit?` | `number` | 1000 | Character-counter denominator and error threshold. This is **not** a hard input cap (the native `maxLength` is intentionally omitted) so the field can exceed the limit and surface the error state. |
|
|
21
|
+
| `showCounter?` | `boolean` | — | Show the "{count} / {limit}" counter. Defaults to auto — visible while the field is focused or holds any value (mirrors the Figma Default vs Focused frames). Pass `true`/`false` to force it. |
|
|
22
|
+
| `error?` | `boolean` | — | Force the error state. Otherwise derived from `value.length > limit`. |
|
|
23
|
+
| `errorMessage?` | `ReactNode` | `labels.limitExceeded(limit)` | Error helper text under the field. |
|
|
24
|
+
| `streaming?` | `boolean` | false | Streaming — replaces the send button with a stop button. |
|
|
25
|
+
| `disabled?` | `boolean` | false | Disable the whole field (textarea + every action). |
|
|
26
|
+
| `showAttach?` | `boolean` | true | Show the attachment button. |
|
|
27
|
+
| `showRecord?` | `boolean` | true | Show the voice / record button. |
|
|
28
|
+
| `onAttach?` | `MouseEventHandler<HTMLButtonElement>` | — | — |
|
|
29
|
+
| `onRecord?` | `MouseEventHandler<HTMLButtonElement>` | — | — |
|
|
30
|
+
| `attachIcon?` | `string` | attachmentSquareStroke | Attachment glyph (`@platformscode/icons` data URL). |
|
|
31
|
+
| `recordIcon?` | `string` | recordStroke | Voice glyph (`@platformscode/icons` data URL). |
|
|
32
|
+
| `attachLabel?` | `string` | — | Localised aria-label for the attachment button. Prefer `labels.attach`. |
|
|
33
|
+
| `recordLabel?` | `string` | — | Localised aria-label for the voice button. Prefer `labels.record`. |
|
|
34
|
+
| `onSend?` | `(value: string) => void` | — | Fired when send is pressed (or Enter when `submitOnEnter`). Receives the current value. |
|
|
35
|
+
| `onStop?` | `MouseEventHandler<HTMLButtonElement>` | — | Fired when the stop button is pressed during streaming. |
|
|
36
|
+
| `sendDisabled?` | `boolean` | false | Disable only the send button. |
|
|
37
|
+
| `sendIcon?` | `string` | navigation03Stroke | Send glyph (`@platformscode/icons` data URL). |
|
|
38
|
+
| `stopIcon?` | `string` | recordStroke | Stop glyph during streaming (`@platformscode/icons` data URL). |
|
|
39
|
+
| `sendLabel?` | `string` | — | Localised aria-label for the send button. Prefer `labels.send`. |
|
|
40
|
+
| `stopLabel?` | `string` | — | Localised aria-label for the stop button. Prefer `labels.stop`. |
|
|
41
|
+
| `submitOnEnter?` | `boolean` | false | Submit on Enter (Shift+Enter inserts a newline). |
|
|
42
|
+
| `className?` | `string` | — | Class applied to the root wrapper. |
|
|
43
|
+
|
|
44
|
+
Also accepts standard `<textarea>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `style`, `maxLength`, `children`.
|
|
45
|
+
|
|
46
|
+
## Options (allowed values)
|
|
47
|
+
- `variant`: `'neutral'` \| `'brand'` \| `'outline'` — Figma `Style` — the field surface treatment.
|
|
48
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction. Omit to inherit from the closest `dir` ancestor.
|
|
49
|
+
|
|
50
|
+
## Deprecated props
|
|
51
|
+
Do not use in new code:
|
|
52
|
+
- `style`
|
|
53
|
+
- `rtl`
|
|
54
|
+
|
|
55
|
+
## Accessibility
|
|
56
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
57
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
58
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
59
|
+
|
|
60
|
+
## Design tokens used
|
|
61
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
62
|
+
- `var(--ds-color-)`
|
|
63
|
+
- `var(--ds-color-bg-brand-subtle)`
|
|
64
|
+
- `var(--ds-color-bg-danger-strong)`
|
|
65
|
+
- `var(--ds-color-bg-default)`
|
|
66
|
+
- `var(--ds-color-border-brand)`
|
|
67
|
+
- `var(--ds-color-control-border)`
|
|
68
|
+
- `var(--ds-color-form-field-bg-default)`
|
|
69
|
+
- `var(--ds-color-form-field-border-danger)`
|
|
70
|
+
- `var(--ds-color-form-field-border-default)`
|
|
71
|
+
- `var(--ds-color-form-field-text-filled)`
|
|
72
|
+
- `var(--ds-color-form-field-text-helper)`
|
|
73
|
+
- `var(--ds-color-form-field-text-placeholder)`
|
|
74
|
+
- `var(--ds-color-primitive-radius-radius-16)`
|
|
75
|
+
- `var(--ds-color-text-danger)`
|
|
76
|
+
- `var(--ds-motion-feedback-duration)`
|
|
77
|
+
- `var(--ds-motion-feedback-easing)`
|
|
78
|
+
- `var(--ds-spacing-lg)`
|
|
79
|
+
- `var(--ds-spacing-md)`
|
|
80
|
+
- `var(--ds-spacing-sm)`
|
|
81
|
+
- `var(--ds-spacing-xl)`
|
|
82
|
+
- `var(--ds-spacing-xs)`
|
|
83
|
+
- `var(--ds-text-leading-line-heights-text-md)`
|
|
84
|
+
- `var(--ds-text-leading-line-heights-text-sm)`
|
|
85
|
+
|
|
86
|
+
## AI usage guidance
|
|
87
|
+
When generating UI:
|
|
88
|
+
- Install with `npx sdaia-ui@latest add ai-prompt-input` (after `npx sdaia-ui@latest init`), then import `{ AiPromptInput }` from `@/components/ui/AiPromptInput`.
|
|
89
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
90
|
+
- Use only the documented option values listed under "Options".
|
|
91
|
+
- Pass icons via `<DgaIcon data={…} className="size-icon-sm" />` from `@platformscode/icons` only — see `get_foundations` (`icon-usage`). Never emoji, Lucide, or random icons (e.g. `pizza01Stroke` for dark mode).
|
|
92
|
+
- Express the disabled state with the `disabled` prop, not custom styling.
|
|
93
|
+
- Pick one theme per screen: dark is `.theme-dark` (or `.dark`) on `<html>`; style surrounding layout with DS tokens (`get_tokens`), never hardcoded colors.
|