@sdaia-ds/mcp 0.0.0-stage → 3.1.1
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 +1117 -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 +12124 -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,158 @@
|
|
|
1
|
+
# Notifications
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Notifications
|
|
5
|
+
- Slug: `notifications`
|
|
6
|
+
- Category: Feedback
|
|
7
|
+
- Install: `npx sdaia-ui@latest add notifications`
|
|
8
|
+
- Import: `import { Notifications } from '@/components/ui/Notifications'`
|
|
9
|
+
- Installed files: `Notifications.tsx`, `Notifications.types.ts`, `Notifications.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/notifications
|
|
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 notifications`. It copies the source into your components folder (`components/ui/Notifications/`, under `src/` when the project has one); import it as `@/components/ui/Notifications`. 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
|
+
| `title?` | `string` | 'Notifications' | Panel heading. Defaults to "Notifications". |
|
|
18
|
+
| `tabs?` | `HorizontalTabItem[]` | — | Tab definitions rendered in the sub-header. Defaults to `[{ value: 'all', label: 'All' }, { value: 'direct', label: 'Direct' }]`. Uses the `HorizontalTabItem` type so consumers can add icons / counts. |
|
|
19
|
+
| `activeTab?` | `string` | — | Controlled active tab value. Defaults to the first tab's value. |
|
|
20
|
+
| `onTabChange?` | `(value: string) => void` | — | Fired when the user switches tabs. |
|
|
21
|
+
| `onMarkAllRead?` | `() => void` | — | "Mark all as Read" action callback. |
|
|
22
|
+
| `onClose?` | `() => void` | — | Fired when the user presses the × close button. |
|
|
23
|
+
| `groups?` | `NotificationGroup[]` | [] | Notification groups to render for every tab (or when no tab-specific override is provided). Each group is a `{ label: string, items: ActivityItemProps[] }` object. |
|
|
24
|
+
| `groupsByTab?` | `Record<string, NotificationGroup[]>` | — | Per-tab group overrides. Keys must match the `value` of a tab item. When the active tab has an entry here its groups are shown instead of `groups`. Tabs with no entry fall back to `groups`. |
|
|
25
|
+
| `surface?` | `'solid' \| 'glass'` | 'solid' | Surface treatment — `'solid'` (default) or `'glass'` (translucent liquid-glass material). |
|
|
26
|
+
| `labels?` | `Partial<NotificationsLabels>` | — | Override built-in strings (English defaults) to localize the panel. |
|
|
27
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction. Inherits from the document when omitted. Applied to the root, so tabs, activity items and rows all mirror with it. |
|
|
28
|
+
|
|
29
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `dir`.
|
|
30
|
+
|
|
31
|
+
## Options (allowed values)
|
|
32
|
+
- `surface`: `'solid'` \| `'glass'` — Surface treatment of the notifications panel.
|
|
33
|
+
- `'solid'` (default) — opaque white card with a hairline border.
|
|
34
|
+
- `'glass'` — translucent liquid-glass material (blurred backdrop +
|
|
35
|
+
beveled edge highlight). Reads best when the panel overlays imagery
|
|
36
|
+
or color.
|
|
37
|
+
|
|
38
|
+
The visual is provided by the shared `.glass-surface` utility, so it is
|
|
39
|
+
theme-aware (light / dark) and identical across every component that
|
|
40
|
+
exposes a `surface` prop.
|
|
41
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction. Inherits from the document when omitted. Applied to the
|
|
42
|
+
root, so tabs, activity items and rows all mirror with it.
|
|
43
|
+
|
|
44
|
+
## Deprecated props
|
|
45
|
+
Do not use in new code:
|
|
46
|
+
- `rtl`
|
|
47
|
+
|
|
48
|
+
## Icons (`@platformscode/icons` + `DgaIcon`)
|
|
49
|
+
|
|
50
|
+
Icons are **not** top-level props on `Notifications`. Pass them through nested tab items and use `sdaia-assets` for feed media. Requires `npx sdaia-ui@latest init` (installs `DgaIcon` + `@platformscode/icons`). Full setup: `setup_project` Step 8.
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { Notifications } from '@/components/ui/Notifications';
|
|
54
|
+
import { DgaIcon } from '@/components/ui/DgaIcon';
|
|
55
|
+
import { notification01Stroke, mail01Stroke } from '@platformscode/icons';
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Built-in close control
|
|
59
|
+
|
|
60
|
+
When `onClose` is set, the panel renders an icon-only close `Button` using `cancel01Stroke` from `@platformscode/icons` (wired inside the installed component). You do not pass this icon unless you replace the whole close affordance yourself.
|
|
61
|
+
|
|
62
|
+
### Tab icons + counts (`tabs` → `HorizontalTabItem`)
|
|
63
|
+
|
|
64
|
+
`Notifications` renders tabs with `HorizontalTabs` → `Tab` at **default size `md`**. The `Tab` component sizes slots for you:
|
|
65
|
+
|
|
66
|
+
| Slot | How `Tab` sizes it | What to pass |
|
|
67
|
+
| --- | --- | --- |
|
|
68
|
+
| `leadingIcon` | Wraps your node in a **`size-icon-sm` (16px)** container | `<DgaIcon data={…} />` only — **no** `className="size-icon-*"` on `DgaIcon` (avoids double sizing / icons looking too small) |
|
|
69
|
+
| `count` | Applies built-in **18px** count pill (`Tab` `COUNT` styles) | A **number or short string** — e.g. `count: 8` or `count: '99+'` |
|
|
70
|
+
|
|
71
|
+
**Do not** put `<Badge />` in `count`. A `Badge` (`sm` = 22px, `md` = 24px) stacks inside the tab count shell and looks **oversized** next to the 16px tab icon. Use the native count bubble instead.
|
|
72
|
+
|
|
73
|
+
| Tab intent | Suggested `@platformscode/icons` token |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| All / inbox | `notification01Stroke` |
|
|
76
|
+
| Direct / messages | `mail01Stroke` |
|
|
77
|
+
| Search / filtered view | `search01Stroke` |
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
tabs={[
|
|
81
|
+
{
|
|
82
|
+
value: 'all',
|
|
83
|
+
label: 'All',
|
|
84
|
+
leadingIcon: <DgaIcon data={notification01Stroke} />,
|
|
85
|
+
count: 8,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
value: 'direct',
|
|
89
|
+
label: 'Direct',
|
|
90
|
+
leadingIcon: <DgaIcon data={mail01Stroke} />,
|
|
91
|
+
count: 2,
|
|
92
|
+
},
|
|
93
|
+
]}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
> **Wrong (icon tiny + count huge):** `leadingIcon={<DgaIcon className="size-icon-xs" … />}` and `count={<Badge size="md">8</Badge>}`.
|
|
97
|
+
|
|
98
|
+
### Feed rows (`groups` / `groupsByTab` → `ActivityItemProps`)
|
|
99
|
+
|
|
100
|
+
Each `items[]` entry is passed to `ActivityItem`. There is **no** `icon` prop on feed rows — use `type` and media fields instead:
|
|
101
|
+
|
|
102
|
+
| `type` | Content | Icons / assets |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
| `'text'` (default) | `title`, `subtext`, `helperText` | `avatarSrc` / `avatarAlt` for the actor photo (defaults to `SaudiAvatar` from `sdaia-assets` when omitted) |
|
|
105
|
+
| `'file'` | `fileName`, `fileSize` | Built-in file visuals from `sdaia-assets` (`PDFSvg`, `Image01SVG`) — not `@platformscode/icons` |
|
|
106
|
+
| `'badge'` | `badges[]` with `label` + `color: 'blue' \| 'gold' \| 'lavender'` | Renders DS `<Badge size="md" pill soft />` inside the row — **not** a tab `count`; do not pass these for tab notification totals |
|
|
107
|
+
| `'comment'` | `comment` bubble text | Avatar as above |
|
|
108
|
+
| `'image'` | `imageSrc`, `imageAlt` | Photo URL, not an icon token |
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
groups={[
|
|
112
|
+
{
|
|
113
|
+
label: 'Today',
|
|
114
|
+
items: [
|
|
115
|
+
{
|
|
116
|
+
type: 'text',
|
|
117
|
+
title: 'Sara Al-Rashid',
|
|
118
|
+
subtext: '12:00 PM',
|
|
119
|
+
helperText: 'Commented on your post.',
|
|
120
|
+
avatarSrc: '/avatars/sara.jpg',
|
|
121
|
+
unread: true,
|
|
122
|
+
primaryAction: { label: 'Reply', onClick: () => {} },
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
]}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
For deeper `ActivityItem` API details, install `npx sdaia-ui@latest add activity` and call `get_component_docs` with `activity`.
|
|
130
|
+
|
|
131
|
+
## Accessibility
|
|
132
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
133
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
134
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
135
|
+
|
|
136
|
+
## Design tokens used
|
|
137
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
138
|
+
- `var(--ds-color-bg-default)`
|
|
139
|
+
- `var(--ds-color-bg-emphasis-high)`
|
|
140
|
+
- `var(--ds-color-border-default)`
|
|
141
|
+
- `var(--ds-color-border-muted)`
|
|
142
|
+
- `var(--ds-color-text-brand)`
|
|
143
|
+
- `var(--ds-color-text-display)`
|
|
144
|
+
- `var(--ds-color-text-paragraph-muted)`
|
|
145
|
+
- `var(--ds-radius-m)`
|
|
146
|
+
- `var(--ds-radius-xs)`
|
|
147
|
+
- `var(--ds-spacing-lg)`
|
|
148
|
+
- `var(--ds-spacing-xl)`
|
|
149
|
+
|
|
150
|
+
## AI usage guidance
|
|
151
|
+
When generating UI:
|
|
152
|
+
- Install with `npx sdaia-ui@latest add notifications` (after `npx sdaia-ui@latest init`), then import `{ Notifications }` from `@/components/ui/Notifications`.
|
|
153
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
154
|
+
- Use only the documented option values listed under "Options".
|
|
155
|
+
- Tab `leadingIcon`: `<DgaIcon data={…} />` from `@platformscode/icons` (e.g. `notification01Stroke`, `mail01Stroke`) — **no** extra `size-icon-*` on `DgaIcon`; `Tab` applies `size-icon-sm`. Tab `count`: plain number/string only — **never** `<Badge />` in `count` (see **Icons**).
|
|
156
|
+
- Feed rows use `ActivityItemProps` (`type`, `avatarSrc`, …), not a generic `icon` prop — use `sdaia-assets` for default avatars / file glyphs.
|
|
157
|
+
- Provide `onClose` when the panel should show the built-in close control (`cancel01Stroke` inside the component).
|
|
158
|
+
- 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,69 @@
|
|
|
1
|
+
# Progress Bar
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Progress Bar
|
|
5
|
+
- Slug: `progress-bar`
|
|
6
|
+
- Category: Feedback
|
|
7
|
+
- Install: `npx sdaia-ui@latest add progress-bar`
|
|
8
|
+
- Import: `import { ProgressBar } from '@/components/ui/ProgressBar'`
|
|
9
|
+
- Installed files: `ProgressBar.tsx`, `ProgressBar.types.ts`, `ProgressBar.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/progressbar
|
|
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 progress-bar`. It copies the source into your components folder (`components/ui/ProgressBar/`, under `src/` when the project has one); import it as `@/components/ui/ProgressBar`. 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
|
+
## Description
|
|
15
|
+
The root is a `role="progressbar"`, which needs an accessible name: pass
|
|
16
|
+
`aria-label` (translated) or `aria-labelledby` pointing at the visible
|
|
17
|
+
heading or file name it reports on. `label` only controls the layout of
|
|
18
|
+
the percentage text.
|
|
19
|
+
|
|
20
|
+
## Props
|
|
21
|
+
| Prop | Type | Default | Description |
|
|
22
|
+
| --- | --- | --- | --- |
|
|
23
|
+
| `progress?` | `number` | 0 | Current progress value (0–100) |
|
|
24
|
+
| `label?` | `'none' \| 'inline' \| 'bottom' \| 'top-floating' \| 'bottom-floating'` | 'none' | Label layout variant |
|
|
25
|
+
| `leadingIcon?` | `boolean` | false | Show leading icon |
|
|
26
|
+
| `trailingIcon?` | `boolean` | false | Show trailing icon |
|
|
27
|
+
| `valueMin?` | `boolean` | false | Show min value (0%) |
|
|
28
|
+
| `valueMax?` | `boolean` | false | Show max value (100%) |
|
|
29
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction. Inherits from the document when omitted. |
|
|
30
|
+
| `animateOnView?` | `boolean` | false | Animate fill from 0 when entering the viewport |
|
|
31
|
+
| `labels?` | `Partial<ProgressBarLabels>` | — | Override built-in strings (English defaults) to localize the progress bar. |
|
|
32
|
+
|
|
33
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `dir`.
|
|
34
|
+
|
|
35
|
+
## Options (allowed values)
|
|
36
|
+
- `label`: `'none'` \| `'inline'` \| `'bottom'` \| `'top-floating'` \| `'bottom-floating'` — Label layout variant
|
|
37
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction. Inherits from the document when omitted.
|
|
38
|
+
|
|
39
|
+
## Accessibility
|
|
40
|
+
Built in (SDAIA review item A7) — verified by `axe scan (aria-progressbar-name) — audit-reports/a11y` in the design system's test suite:
|
|
41
|
+
- The root is a `role="progressbar"` with its current value.
|
|
42
|
+
|
|
43
|
+
You must:
|
|
44
|
+
- Name it: pass `aria-label` (translated) or `aria-labelledby` pointing at visible text. The `label` prop only sets where the percentage is shown.
|
|
45
|
+
|
|
46
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
47
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
48
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
49
|
+
|
|
50
|
+
## Design tokens used
|
|
51
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
52
|
+
- `var(--ds-color-bg-brand)`
|
|
53
|
+
- `var(--ds-color-bg-emphasis-low)`
|
|
54
|
+
- `var(--ds-color-bg-raised)`
|
|
55
|
+
- `var(--ds-color-icon-neutral)`
|
|
56
|
+
- `var(--ds-color-text-default)`
|
|
57
|
+
- `var(--ds-color-text-display)`
|
|
58
|
+
- `var(--ds-radius-m)`
|
|
59
|
+
- `var(--ds-radius-xxs)`
|
|
60
|
+
- `var(--ds-spacing-lg)`
|
|
61
|
+
- `var(--ds-spacing-md)`
|
|
62
|
+
|
|
63
|
+
## AI usage guidance
|
|
64
|
+
When generating UI:
|
|
65
|
+
- Install with `npx sdaia-ui@latest add progress-bar` (after `npx sdaia-ui@latest init`), then import `{ ProgressBar }` from `@/components/ui/ProgressBar`.
|
|
66
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
67
|
+
- Use only the documented option values listed under "Options".
|
|
68
|
+
- 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).
|
|
69
|
+
- 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,58 @@
|
|
|
1
|
+
# Rating Overview
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Rating Overview
|
|
5
|
+
- Slug: `rating-overview`
|
|
6
|
+
- Category: Feedback
|
|
7
|
+
- Install: `npx sdaia-ui@latest add rating-overview`
|
|
8
|
+
- Import: `import { RatingOverview } from '@/components/ui/RatingOverview'`
|
|
9
|
+
- Installed files: `RatingOverview.tsx`, `RatingOverview.types.ts`, `RatingOverview.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/rating-overview
|
|
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 rating-overview`. It copies the source into your components folder (`components/ui/RatingOverview/`, under `src/` when the project has one); import it as `@/components/ui/RatingOverview`. 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
|
+
| `value?` | `number` | — | Average rating value (supports half steps). Unset renders the empty state: empty stars and no score. |
|
|
18
|
+
| `max?` | `number` | 5 | Scale maximum (number of stars). |
|
|
19
|
+
| `label?` | `ReactNode` | — | Section label (e.g. "Ratings"). |
|
|
20
|
+
| `labelPlacement?` | `'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right' \| 'start' \| 'end'` | 'top-left' | Where the label sits relative to the stars when not stacked. |
|
|
21
|
+
| `stacked?` | `boolean` | false | Vertical stacked layout (score + stars + helper). |
|
|
22
|
+
| `showHelperText?` | `boolean` | true | Show the helper line under the stars (e.g. total count). |
|
|
23
|
+
| `helperText?` | `string` | — | Helper line below the stars (e.g. total count). Fully customizable string. |
|
|
24
|
+
| `starStyle?` | `RatingStarStyle` | 'solid' | Star visual style passed to `RatingStar`. |
|
|
25
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction for layout and the star half-fill. Unset inherits from the document. |
|
|
26
|
+
| `starSize?` | `number` | 24 | Pixel size for each `RatingStar`. |
|
|
27
|
+
| `labels?` | `Partial<RatingOverviewLabels>` | — | Localised built-in strings. |
|
|
28
|
+
|
|
29
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `title`, `dir`.
|
|
30
|
+
|
|
31
|
+
## Options (allowed values)
|
|
32
|
+
- `labelPlacement`: `'top-left'` \| `'top-right'` \| `'bottom-left'` \| `'bottom-right'` \| `'start'` \| `'end'` — Label position relative to the star row when `stacked` is false.
|
|
33
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction for layout and the star half-fill. Unset inherits from the document.
|
|
34
|
+
|
|
35
|
+
## Deprecated props
|
|
36
|
+
Do not use in new code:
|
|
37
|
+
- `direction`
|
|
38
|
+
|
|
39
|
+
## Accessibility
|
|
40
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
41
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
42
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
43
|
+
|
|
44
|
+
## Design tokens used
|
|
45
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
46
|
+
- `var(--ds-color-text-disabled)`
|
|
47
|
+
- `var(--ds-color-text-display)`
|
|
48
|
+
- `var(--ds-color-text-paragraph)`
|
|
49
|
+
- `var(--ds-color-text-paragraph-muted)`
|
|
50
|
+
- `var(--ds-spacing-md)`
|
|
51
|
+
- `var(--ds-spacing-xs)`
|
|
52
|
+
|
|
53
|
+
## AI usage guidance
|
|
54
|
+
When generating UI:
|
|
55
|
+
- Install with `npx sdaia-ui@latest add rating-overview` (after `npx sdaia-ui@latest init`), then import `{ RatingOverview }` from `@/components/ui/RatingOverview`.
|
|
56
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
57
|
+
- Use only the documented option values listed under "Options".
|
|
58
|
+
- 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,64 @@
|
|
|
1
|
+
# Rating
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Rating
|
|
5
|
+
- Slug: `rating`
|
|
6
|
+
- Category: Feedback
|
|
7
|
+
- Install: `npx sdaia-ui@latest add rating`
|
|
8
|
+
- Import: `import { Rating } from '@/components/ui/Rating'`
|
|
9
|
+
- Installed files: `Rating.tsx`, `Rating.types.ts`, `Rating.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/rating
|
|
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 rating`. It copies the source into your components folder (`components/ui/Rating/`, under `src/` when the project has one); import it as `@/components/ui/Rating`. 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
|
+
| `value?` | `number` | — | Current value for controlled mode. |
|
|
18
|
+
| `defaultValue?` | `number` | 0 | Initial value for uncontrolled mode. |
|
|
19
|
+
| `max?` | `number` | 5 | Maximum number of stars. |
|
|
20
|
+
| `size?` | `'2xs' \| 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| '2xl'` | 'md' | Rating size preset. |
|
|
21
|
+
| `style?` | `'solid' \| 'outline'` | 'solid' | Visual style of stars. |
|
|
22
|
+
| `brand?` | `boolean` | true | Fill colour: `true` uses the brand colour (`--ds-color-bg-brand`), `false` the rating orange (`--ds-color-rating-star-filled`). |
|
|
23
|
+
| `step?` | `RatingStep` | 0.5 | Step granularity; default is half star. |
|
|
24
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction. Half stars fill from the inline start and the arrow keys follow the reading direction. Unset inherits from the document. |
|
|
25
|
+
| `disabled?` | `boolean` | false | Disables all interactions. |
|
|
26
|
+
| `readOnly?` | `boolean` | false | Prevents update while keeping focus semantics. |
|
|
27
|
+
| `hoverable?` | `boolean` | true | Hover-to-preview behavior. |
|
|
28
|
+
| `starColor?` | `string` | — | Custom active star color (applies to selected and hover preview). |
|
|
29
|
+
| `emptyStarColor?` | `string` | — | Custom empty star color. |
|
|
30
|
+
| `onValueChange?` | `(value: number) => void` | — | Callback when value changes. |
|
|
31
|
+
| `labels?` | `Partial<RatingLabels>` | — | Localised built-in strings. |
|
|
32
|
+
|
|
33
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `onChange`, `style`, `dir`.
|
|
34
|
+
|
|
35
|
+
## Options (allowed values)
|
|
36
|
+
- `size`: `'2xs'` \| `'xs'` \| `'sm'` \| `'md'` \| `'lg'` \| `'xl'` \| `'2xl'` — Rating size preset.
|
|
37
|
+
- `style`: `'solid'` \| `'outline'` — Visual style of stars.
|
|
38
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction. Half stars fill from the inline start and the arrow keys follow the
|
|
39
|
+
reading direction. Unset inherits from the document.
|
|
40
|
+
|
|
41
|
+
## Deprecated props
|
|
42
|
+
Do not use in new code:
|
|
43
|
+
- `direction`
|
|
44
|
+
|
|
45
|
+
## Accessibility
|
|
46
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
47
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
48
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
49
|
+
|
|
50
|
+
## Design tokens used
|
|
51
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
52
|
+
- `var(--ds-color-bg-default)`
|
|
53
|
+
- `var(--ds-color-border-brand)`
|
|
54
|
+
- `var(--ds-spacing-md)`
|
|
55
|
+
- `var(--ds-spacing-sm)`
|
|
56
|
+
- `var(--ds-spacing-xs)`
|
|
57
|
+
|
|
58
|
+
## AI usage guidance
|
|
59
|
+
When generating UI:
|
|
60
|
+
- Install with `npx sdaia-ui@latest add rating` (after `npx sdaia-ui@latest init`), then import `{ Rating }` from `@/components/ui/Rating`.
|
|
61
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
62
|
+
- Use only the documented option values listed under "Options".
|
|
63
|
+
- Express the disabled state with the `disabled` prop, not custom styling.
|
|
64
|
+
- 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,48 @@
|
|
|
1
|
+
# Skeleton/Avatars
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Skeleton/Avatars
|
|
5
|
+
- Slug: `skeleton-avatar`
|
|
6
|
+
- Category: Feedback
|
|
7
|
+
- Install: `npx sdaia-ui@latest add skeleton-avatar`
|
|
8
|
+
- Import: `import { SkeletonAvatar } from '@/components/ui/SkeletonAvatar'`
|
|
9
|
+
- Installed files: `SkeletonAvatar.tsx`, `SkeletonAvatar.types.ts`, `SkeletonAvatar.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/skeleton-avatars
|
|
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 skeleton-avatar`. It copies the source into your components folder (`components/ui/SkeletonAvatar/`, under `src/` when the project has one); import it as `@/components/ui/SkeletonAvatar`. 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
|
+
| `size?` | `'sm' \| 'S' \| 'M' \| 'L'` | 'sm' | Avatar placeholder size. Matches the Figma sizes: - sm: 24px - S: 32px - M: 48px - L: 64px |
|
|
18
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction. Inherits from the document when omitted. |
|
|
19
|
+
|
|
20
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `dir`.
|
|
21
|
+
|
|
22
|
+
## Options (allowed values)
|
|
23
|
+
- `size`: `'sm'` \| `'S'` \| `'M'` \| `'L'` — Avatar placeholder size.
|
|
24
|
+
Matches the Figma sizes:
|
|
25
|
+
- sm: 24px
|
|
26
|
+
- S: 32px
|
|
27
|
+
- M: 48px
|
|
28
|
+
- L: 64px
|
|
29
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction. Inherits from the document when omitted.
|
|
30
|
+
|
|
31
|
+
## Accessibility
|
|
32
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
33
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
34
|
+
|
|
35
|
+
## Design tokens used
|
|
36
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
37
|
+
- `var(--ds-color-alpha-white-40)`
|
|
38
|
+
- `var(--ds-color-button-bg-neutral-default)`
|
|
39
|
+
- `var(--ds-motion-loop-duration)`
|
|
40
|
+
- `var(--ds-motion-loop-easing)`
|
|
41
|
+
- `var(--ds-radius-full)`
|
|
42
|
+
|
|
43
|
+
## AI usage guidance
|
|
44
|
+
When generating UI:
|
|
45
|
+
- Install with `npx sdaia-ui@latest add skeleton-avatar` (after `npx sdaia-ui@latest init`), then import `{ SkeletonAvatar }` from `@/components/ui/SkeletonAvatar`.
|
|
46
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
47
|
+
- Use only the documented option values listed under "Options".
|
|
48
|
+
- 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,53 @@
|
|
|
1
|
+
# Skeleton
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Skeleton
|
|
5
|
+
- Slug: `skeleton`
|
|
6
|
+
- Category: Feedback
|
|
7
|
+
- Install: `npx sdaia-ui@latest add skeleton`
|
|
8
|
+
- Import: `import { Skeleton } from '@/components/ui/Skeleton'`
|
|
9
|
+
- Installed files: `Skeleton.tsx`, `Skeleton.types.ts`, `Skeleton.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/skeleton
|
|
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 skeleton`. It copies the source into your components folder (`components/ui/Skeleton/`, under `src/` when the project has one); import it as `@/components/ui/Skeleton`. 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
|
+
| `size?` | `'text-sm' \| 'text-md' \| 'text-lg' \| 'text-xl'` | 'text-xl' | Visual size preset for text/block placeholders. Matches the Figma text skeleton scale: - text-sm: 16px line (short) - text-md: 16px line (full) - text-lg: 32px block - text-xl: 92px block Widths are fluid: the skeleton fills its container up to the Figma width (298.664px for text-sm, 336px otherwise). Inside a shrink-to-fit parent (a non-growing flex item, `w-fit`, `inline-flex`) give the parent a width or `flex-1`, or pass a `w-*` class. |
|
|
18
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction. Inherits from the document when omitted. |
|
|
19
|
+
|
|
20
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `dir`.
|
|
21
|
+
|
|
22
|
+
## Options (allowed values)
|
|
23
|
+
- `size`: `'text-sm'` \| `'text-md'` \| `'text-lg'` \| `'text-xl'` — Visual size preset for text/block placeholders.
|
|
24
|
+
Matches the Figma text skeleton scale:
|
|
25
|
+
- text-sm: 16px line (short)
|
|
26
|
+
- text-md: 16px line (full)
|
|
27
|
+
- text-lg: 32px block
|
|
28
|
+
- text-xl: 92px block
|
|
29
|
+
|
|
30
|
+
Widths are fluid: the skeleton fills its container up to the Figma width
|
|
31
|
+
(298.664px for text-sm, 336px otherwise). Inside a shrink-to-fit parent
|
|
32
|
+
(a non-growing flex item, `w-fit`, `inline-flex`) give the parent a width
|
|
33
|
+
or `flex-1`, or pass a `w-*` class.
|
|
34
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction. Inherits from the document when omitted.
|
|
35
|
+
|
|
36
|
+
## Accessibility
|
|
37
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
38
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
39
|
+
|
|
40
|
+
## Design tokens used
|
|
41
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
42
|
+
- `var(--ds-color-alpha-white-40)`
|
|
43
|
+
- `var(--ds-color-button-bg-neutral-default)`
|
|
44
|
+
- `var(--ds-motion-loop-duration)`
|
|
45
|
+
- `var(--ds-motion-loop-easing)`
|
|
46
|
+
- `var(--ds-radius-xs)`
|
|
47
|
+
|
|
48
|
+
## AI usage guidance
|
|
49
|
+
When generating UI:
|
|
50
|
+
- Install with `npx sdaia-ui@latest add skeleton` (after `npx sdaia-ui@latest init`), then import `{ Skeleton }` from `@/components/ui/Skeleton`.
|
|
51
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
52
|
+
- Use only the documented option values listed under "Options".
|
|
53
|
+
- 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,74 @@
|
|
|
1
|
+
# Toast
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Toast
|
|
5
|
+
- Slug: `toast`
|
|
6
|
+
- Category: Feedback
|
|
7
|
+
- Install: `npx sdaia-ui@latest add toast`
|
|
8
|
+
- Import: `import { Toast } from '@/components/ui/Toast'`
|
|
9
|
+
- Installed files: `Toast.tsx`, `Toast.types.ts`, `Toast.variants.ts`, `ToastProvider.tsx`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/toast
|
|
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 toast`. It copies the source into your components folder (`components/ui/Toast/`, under `src/` when the project has one); import it as `@/components/ui/Toast`. 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?` | `'neutral' \| 'info' \| 'success' \| 'warning' \| 'error'` | 'neutral' | Outcome of the action the toast reports (Figma `Type`). Sets the featured icon and its colour, and the live-region politeness: `error` is announced with `role="alert"` (assertive), every other type with `role="status"` (polite). |
|
|
18
|
+
| `title` | `ReactNode` | — | Short title — one line that says what happened (Figma `Title`). |
|
|
19
|
+
| `message?` | `ReactNode` | — | Optional supporting sentence under the title (Figma `Message`). |
|
|
20
|
+
| `actionLabel?` | `ReactNode` | — | Label of the single action link, e.g. "Undo" (Figma `Action`). The action renders only when this is set together with `onAction` or `actionHref`. |
|
|
21
|
+
| `onAction?` | `(event: MouseEvent<HTMLElement>) => void` | — | Called when the action is activated. The toast then asks to close with reason `'action'`, unless the handler calls `event.preventDefault()`. |
|
|
22
|
+
| `actionHref?` | `string` | — | Renders the action as a real link to this URL instead of a button. |
|
|
23
|
+
| `closeButton?` | `boolean` | true | Shows the close (×) button (Figma `Close Button`). |
|
|
24
|
+
| `onClose?` | `(reason: ToastCloseReason) => void` | — | Called when the toast asks to close: the timer ran out, the close button or the action was used, or Escape was pressed while focus was inside it. Toast is controlled — remove it here (or let `ToastProvider` do it). |
|
|
25
|
+
| `duration?` | `number \| null` | MIN_DURATION_MS | Milliseconds before the toast closes itself. Values under 5000 are raised to 5000 (WCAG 2.2.1, Figma accessibility notes). `null` keeps the toast until the user closes it. The timer pauses while the toast is hovered or holds focus, and while the page is hidden. Ignored for `type="error"`: error toasts never close themselves. |
|
|
26
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction of the toast. Inherits from the document when omitted. |
|
|
27
|
+
| `labels?` | `Partial<ToastLabels>` | — | Override built-in strings (English defaults). |
|
|
28
|
+
|
|
29
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `title`, `children`, `dir`.
|
|
30
|
+
|
|
31
|
+
## Options (allowed values)
|
|
32
|
+
- `type`: `'neutral'` \| `'info'` \| `'success'` \| `'warning'` \| `'error'` — Figma `Type` — the outcome the toast reports. A variation of the design
|
|
33
|
+
(icon + colour), not an interaction condition.
|
|
34
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction of the toast. Inherits from the document when omitted.
|
|
35
|
+
|
|
36
|
+
## Accessibility
|
|
37
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
38
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
39
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
40
|
+
|
|
41
|
+
## Design tokens used
|
|
42
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
43
|
+
- `var(--ds-brand-spacing-space-1)`
|
|
44
|
+
- `var(--ds-brand-spacing-space-2)`
|
|
45
|
+
- `var(--ds-brand-spacing-space-3)`
|
|
46
|
+
- `var(--ds-brand-spacing-space-4)`
|
|
47
|
+
- `var(--ds-brand-spacing-space-N)`
|
|
48
|
+
- `var(--ds-color-bg-danger-muted)`
|
|
49
|
+
- `var(--ds-color-bg-info-subtle)`
|
|
50
|
+
- `var(--ds-color-bg-muted)`
|
|
51
|
+
- `var(--ds-color-bg-raised)`
|
|
52
|
+
- `var(--ds-color-bg-success-muted)`
|
|
53
|
+
- `var(--ds-color-bg-warning-muted)`
|
|
54
|
+
- `var(--ds-color-border-default)`
|
|
55
|
+
- `var(--ds-color-border-focus)`
|
|
56
|
+
- `var(--ds-color-icon-brand)`
|
|
57
|
+
- `var(--ds-color-icon-danger)`
|
|
58
|
+
- `var(--ds-color-icon-default)`
|
|
59
|
+
- `var(--ds-color-icon-info)`
|
|
60
|
+
- `var(--ds-color-icon-warning)`
|
|
61
|
+
- `var(--ds-color-text-default)`
|
|
62
|
+
- `var(--ds-color-text-paragraph)`
|
|
63
|
+
- `var(--ds-radius-full)`
|
|
64
|
+
- `var(--ds-radius-m)`
|
|
65
|
+
- `var(--ds-spacing-md)`
|
|
66
|
+
- `var(--ds-spacing-xl)`
|
|
67
|
+
|
|
68
|
+
## AI usage guidance
|
|
69
|
+
When generating UI:
|
|
70
|
+
- Install with `npx sdaia-ui@latest add toast` (after `npx sdaia-ui@latest init`), then import `{ Toast }` from `@/components/ui/Toast`.
|
|
71
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
72
|
+
- Use only the documented option values listed under "Options".
|
|
73
|
+
- 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).
|
|
74
|
+
- 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,72 @@
|
|
|
1
|
+
# Tooltip
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Tooltip
|
|
5
|
+
- Slug: `tooltip`
|
|
6
|
+
- Category: Feedback
|
|
7
|
+
- Install: `npx sdaia-ui@latest add tooltip`
|
|
8
|
+
- Import: `import { Tooltip } from '@/components/ui/Tooltip'`
|
|
9
|
+
- Installed files: `Tooltip.tsx`, `Tooltip.types.ts`, `Tooltip.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/tooltip
|
|
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 tooltip`. It copies the source into your components folder (`components/ui/Tooltip/`, under `src/` when the project has one); import it as `@/components/ui/Tooltip`. 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?` | `'neutral' \| 'brand'` | 'neutral' | Visual type — neutral (white/dark bg) or brand (green bg). |
|
|
18
|
+
| `beakPlacement?` | `'none' \| 'top' \| 'bottom' \| 'left' \| 'right'` | 'none' | Beak (arrow) placement relative to the tooltip body. `left` / `right` are physical sides (they do not mirror in RTL), matching the Figma RTL frames. |
|
|
19
|
+
| `beakAlignment?` | `'start' \| 'centre' \| 'end'` | 'start' | Beak alignment along the placed edge. Only applies when beakPlacement is not 'none'. |
|
|
20
|
+
| `title?` | `ReactNode` | — | Title text displayed at the top. Also names the tooltip when it renders as a dialog. |
|
|
21
|
+
| `description?` | `ReactNode` | — | Description text below the title. |
|
|
22
|
+
| `icon?` | `ReactNode \| boolean` | — | Leading icon. Pass `true` for the default info icon, or a custom ReactNode. |
|
|
23
|
+
| `media?` | `ReactNode` | — | Media content (image, video) displayed between text and footer. |
|
|
24
|
+
| `primaryAction?` | `TooltipAction` | — | Primary action button (e.g. "Next"). A tooltip must not contain focusable content, so when any action or link is present the bubble renders as a non-modal `role="dialog"` (a rich tooltip / coach mark) named by its `title` instead of `role="tooltip"`. |
|
|
25
|
+
| `secondaryAction?` | `TooltipAction` | — | Secondary action button (e.g. "Skip"). See `primaryAction` for the role change. |
|
|
26
|
+
| `link?` | `TooltipLinkAction` | — | Link action displayed after the buttons. See `primaryAction` for the role change. |
|
|
27
|
+
| `counting?` | `ReactNode` | — | Counting/pagination text (e.g. "1 of 7"). |
|
|
28
|
+
| `children?` | `ReactNode` | — | Extra content rendered after the media slot. Keep it non-interactive for a plain tooltip (no buttons, links or inputs). |
|
|
29
|
+
| `trigger?` | `ReactElement` | — | Element the tooltip describes (e.g. an icon-only `Button`). When provided the tooltip is hidden until the trigger is hovered or receives keyboard focus; it stays open while the pointer is over the trigger or the tooltip, hides on blur / mouse leave, and Escape hides it without moving focus. While shown, the trigger gets `aria-describedby` pointing to the tooltip. The bubble is placed opposite its beak (beak `top` → below the trigger). When omitted, the tooltip renders statically (always visible), e.g. for onboarding steps or documentation. |
|
|
30
|
+
| `open?` | `boolean` | — | Controlled visibility in trigger mode. |
|
|
31
|
+
| `defaultOpen?` | `boolean` | false | Initial visibility in trigger mode (uncontrolled). |
|
|
32
|
+
| `onOpenChange?` | `(open: boolean) => void` | — | Called when the visibility changes in trigger mode (hover, focus, blur, Escape). |
|
|
33
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction. Inherits from the document when omitted. |
|
|
34
|
+
|
|
35
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `title`, `dir`.
|
|
36
|
+
|
|
37
|
+
## Options (allowed values)
|
|
38
|
+
- `type`: `'neutral'` \| `'brand'` — Visual type — neutral (white/dark bg) or brand (green bg).
|
|
39
|
+
- `beakPlacement`: `'none'` \| `'top'` \| `'bottom'` \| `'left'` \| `'right'` — Beak (arrow) placement relative to the tooltip body. `left` / `right` are
|
|
40
|
+
physical sides (they do not mirror in RTL), matching the Figma RTL frames.
|
|
41
|
+
- `beakAlignment`: `'start'` \| `'centre'` \| `'end'` — Beak alignment along the placed edge. Only applies when beakPlacement is not 'none'.
|
|
42
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction. Inherits from the document when omitted.
|
|
43
|
+
|
|
44
|
+
## Accessibility
|
|
45
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
46
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
47
|
+
|
|
48
|
+
## Design tokens used
|
|
49
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
50
|
+
- `var(--ds-color-bg-brand)`
|
|
51
|
+
- `var(--ds-color-button-bg-black-)`
|
|
52
|
+
- `var(--ds-color-button-bg-black-default)`
|
|
53
|
+
- `var(--ds-color-button-bg-black-hovered)`
|
|
54
|
+
- `var(--ds-color-button-bg-black-pressed)`
|
|
55
|
+
- `var(--ds-color-icon-neutral)`
|
|
56
|
+
- `var(--ds-color-icon-oncolor)`
|
|
57
|
+
- `var(--ds-color-text-on-color)`
|
|
58
|
+
- `var(--ds-color-tooltip-bg-on-dark)`
|
|
59
|
+
- `var(--ds-color-tooltip-text-heading-on-dark)`
|
|
60
|
+
- `var(--ds-color-tooltip-text-paragraph-on-dark)`
|
|
61
|
+
- `var(--ds-radius-m)`
|
|
62
|
+
- `var(--ds-spacing-lg)`
|
|
63
|
+
- `var(--ds-spacing-md)`
|
|
64
|
+
- `var(--ds-spacing-xs)`
|
|
65
|
+
|
|
66
|
+
## AI usage guidance
|
|
67
|
+
When generating UI:
|
|
68
|
+
- Install with `npx sdaia-ui@latest add tooltip` (after `npx sdaia-ui@latest init`), then import `{ Tooltip }` from `@/components/ui/Tooltip`.
|
|
69
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
70
|
+
- Use only the documented option values listed under "Options".
|
|
71
|
+
- 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).
|
|
72
|
+
- Pick one theme per screen: dark is `.theme-dark` (or `.dark`) on `<html>`; style surrounding layout with DS tokens (`get_tokens`), never hardcoded colors.
|