@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.
Files changed (151) hide show
  1. package/README.md +212 -2
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +291 -0
  4. package/dist/index.js.map +1 -0
  5. package/knowledge/actions/breadcrumb.md +50 -0
  6. package/knowledge/actions/button-menu.md +82 -0
  7. package/knowledge/actions/button-split.md +69 -0
  8. package/knowledge/actions/button.md +101 -0
  9. package/knowledge/actions/content-switcher.md +66 -0
  10. package/knowledge/actions/date-picker.md +115 -0
  11. package/knowledge/actions/floating-button.md +100 -0
  12. package/knowledge/actions/horizontal-tabs.md +52 -0
  13. package/knowledge/actions/link.md +76 -0
  14. package/knowledge/actions/modal.md +103 -0
  15. package/knowledge/actions/pagination.md +69 -0
  16. package/knowledge/actions/radio-button.md +88 -0
  17. package/knowledge/actions/switch.md +87 -0
  18. package/knowledge/actions/tag.md +69 -0
  19. package/knowledge/ai/agent-activity.md +65 -0
  20. package/knowledge/ai/agent-card.md +65 -0
  21. package/knowledge/ai/agent-handoff.md +65 -0
  22. package/knowledge/ai/ai-citation.md +78 -0
  23. package/knowledge/ai/ai-code-block.md +86 -0
  24. package/knowledge/ai/ai-disclaimer.md +84 -0
  25. package/knowledge/ai/ai-message-bubble.md +81 -0
  26. package/knowledge/ai/ai-message.md +118 -0
  27. package/knowledge/ai/ai-prompt-input.md +93 -0
  28. package/knowledge/ai/ai-states.md +107 -0
  29. package/knowledge/ai/ai-status-indicator.md +81 -0
  30. package/knowledge/ai/ai-suggested-prompts.md +62 -0
  31. package/knowledge/ai/ai-thinking-indicator.md +94 -0
  32. package/knowledge/ai/artifact-viewer.md +105 -0
  33. package/knowledge/ai/citation.md +61 -0
  34. package/knowledge/ai/context-manager.md +111 -0
  35. package/knowledge/ai/prompt-context.md +72 -0
  36. package/knowledge/ai/prompt-suggestion.md +68 -0
  37. package/knowledge/ai/prompt-template.md +71 -0
  38. package/knowledge/ai/prompt-variable.md +61 -0
  39. package/knowledge/ai/reasoning-trace.md +106 -0
  40. package/knowledge/ai/source-explorer.md +117 -0
  41. package/knowledge/ai/source-group.md +59 -0
  42. package/knowledge/ai/source-reference.md +70 -0
  43. package/knowledge/ai/thinking-panel.md +77 -0
  44. package/knowledge/ai/tool-activity-feed.md +67 -0
  45. package/knowledge/ai/tool-call-card.md +66 -0
  46. package/knowledge/ai/tool-status-row.md +72 -0
  47. package/knowledge/ai/tool-timeline-item.md +71 -0
  48. package/knowledge/ai/voice-session.md +93 -0
  49. package/knowledge/feedback/alert.md +106 -0
  50. package/knowledge/feedback/badge.md +86 -0
  51. package/knowledge/feedback/card.md +54 -0
  52. package/knowledge/feedback/feedback-overview.md +37 -0
  53. package/knowledge/feedback/feedback.md +46 -0
  54. package/knowledge/feedback/help-icon.md +57 -0
  55. package/knowledge/feedback/loading-indicator.md +76 -0
  56. package/knowledge/feedback/notification-banner.md +73 -0
  57. package/knowledge/feedback/notification-popup.md +87 -0
  58. package/knowledge/feedback/notifications.md +158 -0
  59. package/knowledge/feedback/progress-bar.md +69 -0
  60. package/knowledge/feedback/rating-overview.md +58 -0
  61. package/knowledge/feedback/rating.md +64 -0
  62. package/knowledge/feedback/skeleton-avatar.md +48 -0
  63. package/knowledge/feedback/skeleton.md +53 -0
  64. package/knowledge/feedback/toast.md +74 -0
  65. package/knowledge/feedback/tooltip.md +72 -0
  66. package/knowledge/form/autocomplete.md +100 -0
  67. package/knowledge/form/checkbox.md +95 -0
  68. package/knowledge/form/date-time-field.md +63 -0
  69. package/knowledge/form/error-summary.md +56 -0
  70. package/knowledge/form/field-group.md +57 -0
  71. package/knowledge/form/file-uploader.md +60 -0
  72. package/knowledge/form/form-section.md +58 -0
  73. package/knowledge/form/number-input.md +92 -0
  74. package/knowledge/form/otp-input.md +83 -0
  75. package/knowledge/form/password-input.md +49 -0
  76. package/knowledge/form/range-slider.md +71 -0
  77. package/knowledge/form/rich-text-editor.md +106 -0
  78. package/knowledge/form/select.md +113 -0
  79. package/knowledge/form/signature.md +83 -0
  80. package/knowledge/form/slider.md +66 -0
  81. package/knowledge/form/text-area.md +90 -0
  82. package/knowledge/form/text-input.md +132 -0
  83. package/knowledge/form/time-input.md +44 -0
  84. package/knowledge/form/time-picker.md +73 -0
  85. package/knowledge/foundations/accessibility.md +97 -0
  86. package/knowledge/foundations/colors.md +1117 -0
  87. package/knowledge/foundations/figma.md +30 -0
  88. package/knowledge/foundations/icon-usage.md +114 -0
  89. package/knowledge/foundations/icons.md +16 -0
  90. package/knowledge/foundations/motion.md +39 -0
  91. package/knowledge/foundations/radius.md +17 -0
  92. package/knowledge/foundations/responsive.md +64 -0
  93. package/knowledge/foundations/rtl.md +106 -0
  94. package/knowledge/foundations/spacing.md +27 -0
  95. package/knowledge/foundations/theme.md +115 -0
  96. package/knowledge/foundations/tokens.json +12124 -0
  97. package/knowledge/foundations/typography.md +45 -0
  98. package/knowledge/general/accordion.md +79 -0
  99. package/knowledge/general/activity.md +44 -0
  100. package/knowledge/general/app-shell.md +64 -0
  101. package/knowledge/general/area-chart.md +89 -0
  102. package/knowledge/general/audio-player.md +85 -0
  103. package/knowledge/general/avatar-group.md +50 -0
  104. package/knowledge/general/avatar.md +61 -0
  105. package/knowledge/general/carousel-image.md +103 -0
  106. package/knowledge/general/chart.md +25 -0
  107. package/knowledge/general/chip.md +90 -0
  108. package/knowledge/general/code-snippet.md +80 -0
  109. package/knowledge/general/column-chart.md +84 -0
  110. package/knowledge/general/context-menu.md +55 -0
  111. package/knowledge/general/digital-stamp.md +77 -0
  112. package/knowledge/general/divider.md +65 -0
  113. package/knowledge/general/donut-chart.md +75 -0
  114. package/knowledge/general/draggable-list.md +43 -0
  115. package/knowledge/general/dropdown.md +90 -0
  116. package/knowledge/general/empty-state.md +60 -0
  117. package/knowledge/general/filtration.md +85 -0
  118. package/knowledge/general/footer.md +59 -0
  119. package/knowledge/general/line-chart.md +95 -0
  120. package/knowledge/general/list.md +91 -0
  121. package/knowledge/general/media-gallery.md +85 -0
  122. package/knowledge/general/media-viewer.md +78 -0
  123. package/knowledge/general/menu.md +66 -0
  124. package/knowledge/general/metric.md +92 -0
  125. package/knowledge/general/nav-bar.md +62 -0
  126. package/knowledge/general/nav-header.md +125 -0
  127. package/knowledge/general/number.md +72 -0
  128. package/knowledge/general/page-template.md +80 -0
  129. package/knowledge/general/pdf-viewer.md +91 -0
  130. package/knowledge/general/pie-chart-panel.md +86 -0
  131. package/knowledge/general/popover.md +115 -0
  132. package/knowledge/general/progress-circle.md +63 -0
  133. package/knowledge/general/quote.md +64 -0
  134. package/knowledge/general/radial-stepper.md +72 -0
  135. package/knowledge/general/scatter-chart.md +62 -0
  136. package/knowledge/general/second-nav-header.md +55 -0
  137. package/knowledge/general/slideout-menu.md +92 -0
  138. package/knowledge/general/stepper.md +42 -0
  139. package/knowledge/general/structured-list.md +52 -0
  140. package/knowledge/general/table-bulk-actions-bar.md +66 -0
  141. package/knowledge/general/table-of-content.md +49 -0
  142. package/knowledge/general/table.md +113 -0
  143. package/knowledge/general/tree-view.md +55 -0
  144. package/knowledge/general/vertical-tabs.md +48 -0
  145. package/knowledge/general/video-player.md +88 -0
  146. package/knowledge/manifest.json +919 -0
  147. package/knowledge/patterns/buttons-with-sdaia-touch.md +34 -0
  148. package/knowledge/patterns/sdaia-logo-animation.md +35 -0
  149. package/knowledge/patterns/switch-with-sdaia-touch.md +29 -0
  150. package/knowledge/setup.md +125 -0
  151. package/package.json +45 -4
@@ -0,0 +1,30 @@
1
+ # SDAIA Figma Library and Code
2
+
3
+ The **SDAIA Design System Figma library** is the design source for `sdaia-ui`. Code follows it: component sets, variants, states and sizes in Figma map to components, props and option values in code, and the Figma variables match the `@sdaia-ds/tokens` design tokens. Each component's docs page on https://ds.nacew.com links to its Figma component; ask the SDAIA design team for access to the library.
4
+
5
+ ## Mapping Figma to code
6
+
7
+ | In Figma | In code |
8
+ | --- | --- |
9
+ | Component set (e.g. `Button`) | Component (`import { Button } from '@/components/ui/Button'`; `get_component_docs`) |
10
+ | Variant property `Style`, `Size`, `Type` | Props with string options (`variant`, `size`, `type`, …) — the allowed values are listed under "Options" in `get_component_docs` |
11
+ | Variant property `State` (Hover, Focused, Pressed) | Not a prop: the component renders it from user interaction |
12
+ | `State = Disabled` / `Error` | The `disabled` / `error` props |
13
+ | Color variables (`bg-default`, `text-paragraph`, …) | Semantic tokens `--ds-color-*` (`get_tokens` category `colors`) |
14
+ | Spacing / Typography variables with Desktop, Tablet and Mobile modes | Responsive tokens that switch at 768px and 1280px (topic `responsive`) |
15
+ | Text styles (`Display xs`, `Text md` …) | `text-display-*` / `text-text-*` utilities (topic `typography`) |
16
+ | Brand modes | Brand classes on `<html>` (topic `theme`) |
17
+ | Instances inside a component (Button, Badge, Checkbox …) | The same components composed inside the coded one |
18
+
19
+ ## When building from a Figma frame
20
+
21
+ 1. Identify each instance's component set and find it with `search_components`.
22
+ 2. Read its props and allowed values with `get_component_docs`; use the documented option values only.
23
+ 3. Use the Figma variable names to pick tokens (`get_tokens`); never copy hex values or pixel numbers from the inspector.
24
+ 4. Build layout around components with token-based spacing (`p-spacing-*`, `gap-spacing-*`) and make it fluid (topic `responsive`).
25
+ 5. For icons, find the glyph in `@platformscode/icons` (topic `icon-usage`); don't export SVGs from Figma for UI icons.
26
+
27
+ ## Known differences
28
+
29
+ - Text at 14px / 20px line height renders about 0.7px higher in browsers than in Figma (font metrics). This is accepted; don't compensate with padding.
30
+ - If a Figma component and its docs page disagree, the component's code (what `get_component_docs` shows) is what ships; report the difference to the design team.
@@ -0,0 +1,114 @@
1
+ # Icons — `@platformscode/icons` + `DgaIcon`
2
+
3
+ > **Hard rule for AI:** Every functional UI icon MUST come from `@platformscode/icons` rendered with the CLI-installed `<DgaIcon />`.
4
+ > **Never** use emoji (☀️ 🌙 🔔), Unicode symbols, Lucide, Heroicons, Material Icons, inline `<svg>`, `sdaia-ui/icons`, or invented import names.
5
+ > **Never** pick random icons from the package (e.g. `pizza01Stroke`, `hamburger01Stroke`) for standard actions — use the mappings below.
6
+
7
+ `npx sdaia-ui@latest init` installs the `@platformscode/icons` package. `DgaIcon` comes with any component that uses icons, or on its own with `npx sdaia-ui@latest add dga-icon` (it lives at `@/components/ui/DgaIcon`). Size: `size-icon-xs` 12 · `sm` 16 · `lg` 20 · `xl` 24 · `2xl` 32 · `3xl` 40 px — there is no `size-icon-md`. Directional icons take `flipOnRtl`.
8
+
9
+ ## Import pattern (always two imports)
10
+
11
+ ```tsx
12
+ import { DgaIcon } from '@/components/ui/DgaIcon';
13
+ import { search01Stroke, cancel01Stroke } from '@platformscode/icons';
14
+
15
+ <DgaIcon data={search01Stroke} className="size-icon-sm" />
16
+ ```
17
+
18
+ - **`DgaIcon`** — local component (wrapper). Path: `@/components/ui/DgaIcon`.
19
+ - **Icon data** — named exports from `@platformscode/icons` (SVG path strings). Suffix is `Stroke` or `Solid`.
20
+ - **Size** — `size-icon-xs` | `size-icon-sm` | `size-icon-lg` | `size-icon-xl` | `size-icon-2xl` | `size-icon-3xl` on the icon or its parent slot (see `get_foundations` topic `icons` for px values).
21
+ - When a parent component (e.g. `Tab`, `Button` icon-only) already wraps `leadingIcon` in `size-icon-sm`, pass `<DgaIcon data={…} />` **without** duplicating size classes on the SVG.
22
+
23
+ ## What NOT to do
24
+
25
+ | Wrong | Why |
26
+ | --- | --- |
27
+ | `{dark ? '☀️' : '🌙'}` in a theme toggle | Not DS icons; inconsistent with design system |
28
+ | `import { Moon } from 'lucide-react'` | Wrong icon library |
29
+ | `import { Pizza } from …` / `pizza01Stroke` for dark mode | Random package icon — use `darkModeStroke` / `moon02Stroke` / `sun01Stroke` |
30
+ | `import … from 'sdaia-ui'` or `sdaia-ui/icons` | Deprecated — CLI copies source only |
31
+ | Invented names like `closeIcon`, `BellIcon` as npm imports | Must be real exports: `cancel01Stroke`, `notification01Stroke`, … |
32
+ | `<img src="…">` for toolbar / input affordances | Use `DgaIcon` + token |
33
+
34
+ ## Approved icon map (common UI)
35
+
36
+ Use these **exact export names** from `@platformscode/icons`. Prefer **`Stroke`** in buttons, inputs, tabs, and navigation; use **`Solid`** when matching an installed component that already imports solids (e.g. `NotificationPopup`).
37
+
38
+ | UI intent | Use this export | Notes |
39
+ | --- | --- | --- |
40
+ | Close / dismiss | `cancel01Stroke` | Used by `Notifications` close, `Filtration` chips |
41
+ | Search | `search01Stroke` | Default search affordance |
42
+ | Notifications / bell | `notification01Stroke` | Inbox, alerts |
43
+ | Email / direct | `mail01Stroke` | Mail, direct messages |
44
+ | Info / help | `informationCircleStroke` | Helper, tooltips |
45
+ | Filter | `filterStroke` | Filter menus (`Filtration`) |
46
+ | More / overflow menu | `moreVerticalStroke` | `Dropdown` trigger |
47
+ | Chevron / expand | `arrowDown01Stroke`, `arrowRight01Stroke` | Menus, nav |
48
+ | Settings | `settings01Stroke` or `settings02Stroke` | Verify name exists before import |
49
+ | **Dark mode (show moon)** | `darkModeStroke` or `moon02Stroke` | Theme toggle when switching **to** dark |
50
+ | **Light mode (show sun)** | `sun01Stroke` or `sun02Stroke` | Theme toggle when switching **to** light |
51
+ | Success (toast/popup) | `tick02Solid` | `NotificationPopup` success |
52
+ | Error | `cancel01Solid` or `alert02Solid` | Match popup type |
53
+ | Warning / alert | `alert02Stroke` or `notification02Solid` | Alerts, notification popup |
54
+
55
+ > If unsure whether a name exists, only use icons listed in this table or copied from `get_component_docs` for the target component. Do not guess food, weather, or entertainment icons.
56
+
57
+ ## Dark / light mode toggle (icons + theme class)
58
+
59
+ Theme is **`document.documentElement.classList.toggle('theme-dark', isDark)`** — see `get_foundations` topic `theme`.
60
+ Icons for the toggle button:
61
+
62
+ ```tsx
63
+ import { DgaIcon } from '@/components/ui/DgaIcon';
64
+ import { darkModeStroke, sun01Stroke } from '@platformscode/icons';
65
+ import { Button } from '@/components/ui/Button';
66
+
67
+ // When currently light → show moon/dark affordance; when dark → show sun
68
+ <Button
69
+ variant="transparent"
70
+ size="md"
71
+ iconOnly
72
+ aria-label={dark ? 'Switch to light mode' : 'Switch to dark mode'}
73
+ leadingIcon={
74
+ <DgaIcon data={dark ? sun01Stroke : darkModeStroke} className="size-icon-sm" />
75
+ }
76
+ onClick={() => setDark((value) => !value)}
77
+ />
78
+ ```
79
+
80
+ Optional: `moon02Stroke` instead of `darkModeStroke`. **Do not** use `pizza01Stroke`, emoji, or unrelated icons.
81
+
82
+ ## Passing icons into DS components
83
+
84
+ ```tsx
85
+ import { DgaIcon } from '@/components/ui/DgaIcon';
86
+ import { mail01Stroke, informationCircleStroke } from '@platformscode/icons';
87
+
88
+ <TextInput
89
+ prefix={<DgaIcon data={mail01Stroke} className="size-icon-sm" />}
90
+ suffix={<DgaIcon data={informationCircleStroke} className="size-icon-sm" />}
91
+ />
92
+
93
+ <Button leadingIcon={<DgaIcon data={search01Stroke} className="size-icon-sm" />}>Search</Button>
94
+ ```
95
+
96
+ For `HorizontalTabItem.leadingIcon`, `Select.leadingIcon`, `Button.leadingIcon`, etc., see each component's `get_component_docs` entry.
97
+
98
+ ## Logos and illustrations (not `DgaIcon`)
99
+
100
+ Brand logos, feedback emojis, PDF/file illustrations → **`sdaia-assets`** (installed by `init`), not `@platformscode/icons`.
101
+
102
+ ```tsx
103
+ import { SdaiaLogo } from '@/components/sdaia-assets';
104
+ ```
105
+
106
+ ## MCP tools
107
+
108
+ | Need | Tool |
109
+ | --- | --- |
110
+ | Setup + init | `setup_project` (Step 8) |
111
+ | Icon sizes (tokens) | `get_foundations` → `icons` |
112
+ | This mapping | `get_foundations` → `icon-usage` |
113
+ | Theme class | `get_foundations` → `theme` |
114
+ | Icons a component uses | `get_component_docs` → `<slug>` |
@@ -0,0 +1,16 @@
1
+ # Icon Sizes
2
+
3
+ Icon sizing tokens. Use the built-in `size-icon-*` utility classes on `<DgaIcon>` rather than hardcoded sizes.
4
+
5
+ > Resolve any token live with the `get_tokens` tool.
6
+
7
+ ## Icon Sizes
8
+
9
+ | Token | CSS variable | Light | Dark | Description |
10
+ | --- | --- | --- | --- | --- |
11
+ | `icon-xs` | `var(--ds-icon-xs)` | `12px` | — | Tiny icon (12px). Inline with caption text, dense table cells, status dots. Pair with text-xs. |
12
+ | `icon-sm` | `var(--ds-icon-sm)` | `16px` | — | Default UI icon (16px). Inline with body text, button leading icons, form field affixes. Most common — start here. |
13
+ | `icon-lg` | `var(--ds-icon-lg)` | `20px` | — | Medium icon (20px). Navigation icons, toolbar buttons, list item leading icons. |
14
+ | `icon-xl` | `var(--ds-icon-xl)` | `24px` | — | Large icon (24px). Section headers, primary action buttons, app bar icons. |
15
+ | `icon-2xl` | `var(--ds-icon-2xl)` | `32px` | — | Extra-large icon (32px). Empty state illustrations, feature cards, prominent actions. |
16
+ | `icon-3xl` | `var(--ds-icon-3xl)` | `40px` | — | Largest icon (40px). Hero sections, onboarding flows, marketing pages. |
@@ -0,0 +1,39 @@
1
+ # Motion
2
+
3
+ Motion duration and easing tokens for transitions and animations.
4
+
5
+ > Resolve any token live with the `get_tokens` tool.
6
+
7
+ ## Easing
8
+
9
+ | Token | CSS variable | Light | Dark | Description |
10
+ | --- | --- | --- | --- | --- |
11
+ | `motion-easing-linear` | `var(--ds-motion-easing-linear)` | `cubic-bezier(0, 0, 1, 1)` | — | Constant rate (linear). Use for progress bars, loaders. Avoid for natural movement. |
12
+ | `motion-easing-standard` | `var(--ds-motion-easing-standard)` | `cubic-bezier(0.2, 0, 0, 1)` | — | Default smooth easing. Most UI transitions: state changes, fades, simple movement. |
13
+ | `motion-easing-decelerate` | `var(--ds-motion-easing-decelerate)` | `cubic-bezier(0, 0, 0.2, 1)` | — | Ease-out. Elements entering the screen, slowing as they arrive. Modals opening, drawers sliding in. |
14
+ | `motion-easing-accelerate` | `var(--ds-motion-easing-accelerate)` | `cubic-bezier(0.4, 0, 1, 1)` | — | Ease-in. Elements leaving the screen, speeding up as they exit. Modals closing, dismissed items. |
15
+ | `motion-easing-emphasized` | `var(--ds-motion-easing-emphasized)` | `cubic-bezier(0.2, 0, 0, 1.2)` | — | Pronounced curve for elements demanding attention. Important state changes, hero animations. |
16
+ | `motion-feedback-easing` | `var(--ds-motion-feedback-easing)` | `cubic-bezier(0.2, 0, 0, 1)` | — | Easing for interaction feedback. Standard quick response curve. |
17
+ | `motion-enter-easing` | `var(--ds-motion-enter-easing)` | `cubic-bezier(0, 0, 0.2, 1)` | — | Easing for elements entering view. Decelerates as they settle into final position. |
18
+ | `motion-exit-easing` | `var(--ds-motion-exit-easing)` | `cubic-bezier(0.4, 0, 1, 1)` | — | Easing for elements leaving view. Accelerates as they exit. |
19
+ | `motion-expand-easing` | `var(--ds-motion-expand-easing)` | `cubic-bezier(0.2, 0, 0, 1)` | — | Easing for spatial expansion/collapse. Smooth standard curve. |
20
+ | `motion-transition-easing` | `var(--ds-motion-transition-easing)` | `cubic-bezier(0.2, 0, 0, 1)` | — | Easing for general transitions. Standard smooth curve. |
21
+ | `motion-emphasis-easing` | `var(--ds-motion-emphasis-easing)` | `cubic-bezier(0.2, 0, 0, 1.2)` | — | Pronounced easing curve for emphasis animations. Use sparingly to maintain impact. |
22
+ | `motion-loop-easing` | `var(--ds-motion-loop-easing)` | `cubic-bezier(0, 0, 1, 1)` | — | Easing for looping animations. Linear or smooth depending on visual style. |
23
+ | `motion-feedback-duration` | `var(--ds-motion-feedback-duration)` | `150ms` | — | Duration for interaction feedback (button press, tap response). Default 150ms / Reduced 100ms. |
24
+ | `motion-enter-duration` | `var(--ds-motion-enter-duration)` | `250ms` | — | Duration for elements entering view (modals opening, items appearing). Default 250ms / Reduced 100ms. |
25
+ | `motion-exit-duration` | `var(--ds-motion-exit-duration)` | `150ms` | — | Duration for elements leaving view (modals closing, items dismissing). Default 200ms / Reduced 100ms. |
26
+ | `motion-expand-duration` | `var(--ds-motion-expand-duration)` | `350ms` | — | Duration for size changes (accordion expand, panel resize). Default 350ms / Reduced 0ms. |
27
+ | `motion-transition-duration` | `var(--ds-motion-transition-duration)` | `250ms` | — | Duration for general state transitions (theme flip, color change). Default 250ms / Reduced 100ms. |
28
+ | `motion-emphasis-duration` | `var(--ds-motion-emphasis-duration)` | `350ms` | — | Duration for attention-grabbing animations (notifications, callouts). Default 350ms / Reduced 0ms. |
29
+ | `motion-loop-duration` | `var(--ds-motion-loop-duration)` | `500ms` | — | Duration for looping animations (loaders, spinners, pulse effects). Default 1500ms / Reduced 0ms (loops disabled). |
30
+
31
+ ## Duration
32
+
33
+ | Token | CSS variable | Light | Dark | Description |
34
+ | --- | --- | --- | --- | --- |
35
+ | `motion-duration-instant` | `var(--ds-motion-duration-instant)` | `0ms` | — | Zero delay (0ms). State changes that should feel immediate: tooltips on desktop, badge count updates. |
36
+ | `motion-duration-fast` | `var(--ds-motion-duration-fast)` | `150ms` | — | Fast micro-interactions (150ms default / 100ms reduced). Hover, focus, press, ripple effects. |
37
+ | `motion-duration-base` | `var(--ds-motion-duration-base)` | `250ms` | — | Standard transitions (250ms default / 100ms reduced). Modal enter, toast, tab swap, simple fades. |
38
+ | `motion-duration-moderate` | `var(--ds-motion-duration-moderate)` | `350ms` | — | Spatial transitions (350ms default / 0ms reduced). Accordion expand, dropdown open, drawer slide. Reduced removes spatial motion entirely. |
39
+ | `motion-duration-slow` | `var(--ds-motion-duration-slow)` | `500ms` | — | Long transitions (500ms default / 0ms reduced). Full-screen overlays, page transitions, complex choreography. |
@@ -0,0 +1,17 @@
1
+ # Radius
2
+
3
+ Border-radius scale tokens.
4
+
5
+ > Resolve any token live with the `get_tokens` tool.
6
+
7
+ ## Border Radius
8
+
9
+ | Token | CSS variable | Light | Dark | Description |
10
+ | --- | --- | --- | --- | --- |
11
+ | `radius-none` | `var(--ds-radius-none)` | `0px` | — | Zero corner radius. For full-bleed sections, dividers, sharp edges. All radius modes: 0px. |
12
+ | `radius-xxs` | `var(--ds-radius-xxs)` | `2px` | — | Minimal corner radius for hairline elements: input outlines, small chips. Standard 2px / Square 0 / Rounded 4px. |
13
+ | `radius-xs` | `var(--ds-radius-xs)` | `6px` | — | Small corner radius for compact controls: chips, tags, badges. Standard 4px / Square 0 / Rounded 8px. |
14
+ | `radius-m` | `var(--ds-radius-m)` | `8px` | — | Default UI radius for buttons, inputs, form fields, small cards. Most common — start here. Standard 8px / Square 0 / Rounded 12px. |
15
+ | `radius-l` | `var(--ds-radius-l)` | `16px` | — | Medium-large radius for cards, modals, popovers, content surfaces. Standard 16px / Square 0 / Rounded 24px. |
16
+ | `radius-xl` | `var(--ds-radius-xl)` | `24px` | — | Large radius for hero sections, feature cards, large content blocks. Standard 24px / Square 0 / Rounded 32px. |
17
+ | `radius-full` | `var(--ds-radius-full)` | `9999px` | — | Fully rounded — pill shapes, avatars, circular indicators, badges. Always 9999px regardless of radius mode. |
@@ -0,0 +1,64 @@
1
+ # SDAIA Responsive Behaviour
2
+
3
+ SDAIA UI is one set of components that adapts to the screen (responsive web: desktop first, tablet fully supported, phone for key tasks). Spacing and type tokens switch automatically between desktop, tablet and phone values, and components reflow to the width they are given. Docs: https://ds.nacew.com/foundations/responsive
4
+
5
+ ## Breakpoints
6
+
7
+ Three system breakpoints, the same in Figma, the tokens and the CSS `init` installs:
8
+
9
+ | Tier | Viewport width | Tailwind prefix where it starts |
10
+ | --- | --- | --- |
11
+ | Mobile | under 768px | (default) |
12
+ | Tablet | 768px – 1279px | `md:` |
13
+ | Desktop | 1280px and up | `xl:` |
14
+
15
+ `sm:` (640), `lg:` (1024) and `2xl:` (1536) are only for fine-tuning a layout inside a tier; tokens don't change there.
16
+
17
+ ```ts
18
+ const isTabletUp = window.matchMedia('(min-width: 768px)').matches;
19
+ const isDesktop = window.matchMedia('(min-width: 1280px)').matches;
20
+ ```
21
+
22
+ ## What switches automatically
23
+
24
+ The CSS from `npx sdaia-ui@latest init` is mobile first: mobile values are the defaults and media queries at 768px and 1280px switch to tablet and desktop. **Spacing, font sizes and line heights** change; icon sizes, radii, border widths and colours don't. Every component and every utility built on the tokens (`p-spacing-xl`, `gap-spacing-2xl`, `text-text-md`, …) follows the screen width with no extra class.
25
+
26
+ Type scale (size · line height, desktop / tablet / mobile, px):
27
+
28
+ | Utility | Size | Line height |
29
+ | --- | --- | --- |
30
+ | `text-display-2xl` | 72 / 56 / 48 | 90 / 72 / 64 |
31
+ | `text-display-xl` | 60 / 48 / 40 | 72 / 64 / 56 |
32
+ | `text-display-lg` | 48 / 36 / 32 | 60 / 48 / 40 |
33
+ | `text-display-md` | 36 / 30 / 24 | 44 / 40 / 32 |
34
+ | `text-display-sm` | 30 / 24 / 20 | 38 / 32 / 28 |
35
+ | `text-display-xs` | 24 / 20 / 18 | 32 / 28 / 24 |
36
+ | `text-text-xl` | 20 / 18 / 16 | 30 / 26 / 24 |
37
+ | `text-text-lg` | 18 / 16 / 14 | 28 / 24 / 20 |
38
+ | `text-text-md` | 16 / 14 / 12 | 24 / 20 / 18 |
39
+ | `text-text-sm` | 14 / 12 / 10 | 20 / 16 / 14 |
40
+ | `text-text-xs` | 12 / 10 / 8 | 18 / 14 / 12 |
41
+ | `text-text-2xs` | 12 / 8 / 8 | 18 / 12 / 10 |
42
+
43
+ Spacing steps (`spacing-xxs` … `spacing-11xl`) also step down on tablet and phone; the exact values depend on the brand. Look them up with `get_tokens` (category `spacing`) and always use the token, never the number.
44
+
45
+ ## Rules for generated layouts
46
+
47
+ - **Don't** add your own mobile step-downs on top of the tokens (`text-sm md:text-md`, `p-4 md:p-6` for component internals): the tokens already step down.
48
+ - **Don't** add `viewport-mobile` / `viewport-tablet` classes yourself.
49
+ - Build page layouts with fluid primitives: `w-full`, `max-w-*`, `min-w-0`, `flex-wrap`, CSS grid with `md:` / `xl:` column changes. Avoid fixed widths and `min-width` on wrappers.
50
+ - Everything must work at a **360px** viewport without horizontal page scroll, and at 200% zoom.
51
+ - AppShell, PageTemplate and Stepper switch layout by **their own width** (container queries), so they adapt inside a narrow column too; FormSection's side-by-side layout wraps when there is no room. Give these a container that spans the available width.
52
+
53
+ ```tsx
54
+ <main className="mx-auto w-full max-w-[1216px] px-4 md:px-8">
55
+ <div className="grid grid-cols-4 gap-4 md:grid-cols-6 md:gap-8 xl:grid-cols-12 xl:gap-6">
56
+ <section className="col-span-4 md:col-span-6 xl:col-span-8">…</section>
57
+ <aside className="col-span-4 md:col-span-6 xl:col-span-4">…</aside>
58
+ </div>
59
+ </main>
60
+ ```
61
+
62
+ ## Where the interaction changes
63
+
64
+ Navigation (NavHeader / NavBar switch to their compact layout below 768px), tables, dialogs and pickers have their own small-screen behaviour built in. Each component's docs page has a "Responsive behavior" section; use the component as is rather than building a separate mobile version.
@@ -0,0 +1,106 @@
1
+ # SDAIA RTL (Right-to-Left) Layout Guide
2
+
3
+ The SDAIA Design System is built RTL-first — it was designed for Arabic-language products.
4
+ Every component ships with an LTR/RTL preview toggle on its documentation page.
5
+
6
+ ## Setting document direction
7
+
8
+ ### Full RTL document (Arabic UI)
9
+
10
+ ```html
11
+ <html lang="ar" dir="rtl">
12
+ ```
13
+
14
+ Set **both** `dir` (mirrors the layout) and `lang` (Arabic screen-reader voice and Arabic CSS rules). Where: `app/layout.tsx` (Next.js App Router), `<Html>` in `pages/_document.tsx` (Pages Router), `index.html` (Vite).
15
+
16
+ ### Conditional direction (locale-aware)
17
+
18
+ ```tsx
19
+ const locale = 'ar'; // or 'en'
20
+ document.documentElement.setAttribute('dir', locale === 'ar' ? 'rtl' : 'ltr');
21
+ document.documentElement.setAttribute('lang', locale);
22
+ ```
23
+
24
+ ## Per-component direction prop
25
+
26
+ Components follow the document direction. Each also accepts `dir?: 'ltr' | 'rtl'` on its root to override it for one subtree (some older components also accept a boolean `rtl`, kept as a deprecated alias — use `dir`). Components with built-in text (Date Picker, Pagination) switch their own strings to Arabic for an RTL / Arabic context; others take translated strings through `labels`.
27
+
28
+ ```tsx
29
+ <Card dir="rtl">...</Card> // Force RTL regardless of document dir
30
+ <CodeSnippet dir="ltr" /> // Keep code LTR inside an RTL page
31
+ ```
32
+
33
+ ## CSS logical properties
34
+
35
+ Always use CSS logical properties instead of physical ones so layout flips automatically with `dir`:
36
+
37
+ | Avoid (physical) | Use instead (logical) |
38
+ |-------------------------|------------------------------------|
39
+ | `margin-left` | `margin-inline-start` |
40
+ | `margin-right` | `margin-inline-end` |
41
+ | `padding-left` | `padding-inline-start` |
42
+ | `padding-right` | `padding-inline-end` |
43
+ | `border-left` | `border-inline-start` |
44
+ | `border-right` | `border-inline-end` |
45
+ | `left: 0` | `inset-inline-start: 0` |
46
+ | `right: 0` | `inset-inline-end: 0` |
47
+ | `text-align: left` | `text-align: start` |
48
+ | `text-align: right` | `text-align: end` |
49
+ | `flex-direction: row` | (already logical — no change) |
50
+
51
+ ```css
52
+ /* Correct — flips automatically in RTL */
53
+ .card {
54
+ padding-inline-start: var(--ds-spacing-md);
55
+ border-inline-end: 1px solid var(--ds-color-border-default);
56
+ }
57
+ ```
58
+
59
+ ## IBM Plex Sans Arabic rendering
60
+
61
+ `npx sdaia-ui@latest init` installs IBM Plex Sans Arabic and the body already uses it through `--ds-text-family-text`, for Arabic and Latin text alike. No separate Arabic font stack is needed (topic `typography`).
62
+
63
+ ## Icons
64
+
65
+ Directional icons (arrows, chevrons, back / forward) mirror in RTL with `<DgaIcon data={arrowRight01Stroke} flipOnRtl />`. Don't add `rtl:-scale-x-100` by hand, and don't flip non-directional icons (search, settings, check).
66
+
67
+ ## LTR islands inside RTL documents
68
+
69
+ Some content must remain LTR regardless of document direction:
70
+
71
+ ```tsx
72
+ {/* Code blocks */}
73
+ <pre dir="ltr"><code>{snippet}</code></pre>
74
+
75
+ {/* URLs and email addresses */}
76
+ <span dir="ltr">https://example.com</span>
77
+
78
+ {/* Numeric data (phone numbers, IDs) */}
79
+ <span dir="ltr">+966 50 000 0000</span>
80
+ ```
81
+
82
+ ## Tailwind RTL utilities
83
+
84
+ With Tailwind v4 (installed by `sdaia-ui init`), use logical utilities:
85
+
86
+ ```html
87
+ <!-- Logical padding (RTL-safe) -->
88
+ <div class="ps-4 pe-2">...</div> <!-- ps = padding-inline-start, pe = end -->
89
+
90
+ <!-- RTL-conditional utilities -->
91
+ <div class="ms-auto rtl:me-auto rtl:ms-0">...</div>
92
+ ```
93
+
94
+ ## Testing RTL
95
+
96
+ 1. Add `dir="rtl"` temporarily to `<html>` in DevTools
97
+ 2. Verify layout mirrors correctly without horizontal overflow
98
+ 3. Check icon directions (arrows, chevrons) — SDAIA icons are direction-aware
99
+ 4. Confirm text alignment follows reading direction
100
+
101
+ ## Common mistakes
102
+
103
+ - Using `margin-left` / `padding-right` instead of logical equivalents
104
+ - Hardcoding `text-align: left` — use `text-align: start`
105
+ - Forcing `dir="ltr"` on the whole document when building an Arabic product
106
+ - Forgetting `dir="ltr"` on code snippets and URLs inside an RTL page
@@ -0,0 +1,27 @@
1
+ # Spacing
2
+
3
+ Spacing scale tokens. Use Tailwind `p-spacing-*` / `gap-spacing-*` utilities backed by these CSS variables.
4
+
5
+ > Resolve any token live with the `get_tokens` tool.
6
+
7
+ ## Global
8
+
9
+ | Token | CSS variable | Light | Dark | Description |
10
+ | --- | --- | --- | --- | --- |
11
+ | `spacing-3xl` | `var(--ds-spacing-3xl)` | `24px` | — | Spacious — section padding, between major content blocks. Desktop 32px. |
12
+ | `spacing-xl` | `var(--ds-spacing-xl)` | `16px` | — | Standard spacing — button horizontal padding, form group gaps. Desktop 16px. |
13
+ | `spacing-lg` | `var(--ds-spacing-lg)` | `12px` | — | Medium spacing — between related controls in a row, button padding vertical. Desktop 12px. |
14
+ | `spacing-9xl` | `var(--ds-spacing-9xl)` | `96px` | — | Maximum content separation in hero/marketing layouts. Desktop 128px. |
15
+ | `spacing-sm` | `var(--ds-spacing-sm)` | `6px` | — | Small spacing — tight icon-text gaps, compact form labels. Desktop 6px / Tablet/Mobile shrink. |
16
+ | `spacing-md` | `var(--ds-spacing-md)` | `8px` | — | Default tight spacing — icon-to-label inside buttons, form field internal gaps. Desktop 8px. Most common small-spacing token. |
17
+ | `spacing-xs` | `var(--ds-spacing-xs)` | `4px` | — | Very tight spacing — chip internal padding, dense menu items. Desktop 4px / Tablet/Mobile shrink. |
18
+ | `spacing-6xl` | `var(--ds-spacing-6xl)` | `48px` | — | Hero section padding, generous content areas. Desktop 64px. |
19
+ | `spacing-11xl` | `var(--ds-spacing-11xl)` | `160px` | — | Largest spacing token — full-screen hero margins, marketing landing pages. Desktop 192px. |
20
+ | `spacing-10xl` | `var(--ds-spacing-10xl)` | `128px` | — | Extra-large layout spacing for marketing pages. Desktop 160px. |
21
+ | `spacing-8xl` | `var(--ds-spacing-8xl)` | `80px` | — | Major section dividers, full-page spacing. Desktop 96px. |
22
+ | `spacing-none` | `var(--ds-spacing-none)` | `0px` | — | No spacing (0px). Use to remove default gaps in flex/grid containers. |
23
+ | `spacing-5xl` | `var(--ds-spacing-5xl)` | `40px` | — | Large section dividers, hero margins. Desktop 48px. |
24
+ | `spacing-4xl` | `var(--ds-spacing-4xl)` | `32px` | — | Page margin spacing. Desktop 40px. |
25
+ | `spacing-2xl` | `var(--ds-spacing-2xl)` | `20px` | — | Comfortable spacing — card internal padding, between cards in a list. Desktop 24px. |
26
+ | `spacing-7xl` | `var(--ds-spacing-7xl)` | `64px` | — | Very large hero spacing, prominent feature blocks. Desktop 80px. |
27
+ | `spacing-xxs` | `var(--ds-spacing-xxs)` | `2px` | — | Tightest spacing — between tightly-coupled elements: icon-text gap in dense controls. Desktop 2px / Tablet/Mobile shrink. |
@@ -0,0 +1,115 @@
1
+ # SDAIA Theme Guide — dark mode and brands
2
+
3
+ ## Brands
4
+
5
+ `sdaia-ui` ships six brands. They share every component and behaviour; a brand changes the palette, the font and some spacing and radii. Pick the brand at `init` (`npx sdaia-ui@latest init --brand <name>`, which also installs its font) and put its class on `<html>`:
6
+
7
+ | Brand | Class on `<html>` | Font (Latin) |
8
+ | --- | --- | --- |
9
+ | `sdaia-dga` (default) | none | IBM Plex Sans Arabic |
10
+ | `spectrum` | `brand-spectrum` | Inter |
11
+ | `canvas` | `brand-canvas` | system font (SF Pro on Apple devices) |
12
+ | `dessert` | `brand-dessert` | Roboto |
13
+ | `dune` | `brand-dune` | Assistant |
14
+ | `carbon` | `brand-carbon` | Inter (display), Roboto Mono (text) |
15
+
16
+ Arabic text always renders in **IBM Plex Sans Arabic**, the official SDAIA typeface: `init` installs it for every brand and the other brands fall back to it for Arabic glyphs.
17
+
18
+ ```html
19
+ <html> <!-- sdaia-dga, light -->
20
+ <html class="theme-dark"> <!-- sdaia-dga, dark -->
21
+ <html class="brand-spectrum theme-dark"> <!-- spectrum, dark -->
22
+ ```
23
+
24
+ > **Default to `sdaia-dga`** (no class) unless the user names another brand. Always use semantic tokens (`--ds-color-*`, `bg-*`, `text-*` utilities) so the brand and the theme resolve automatically. Never hardcode a palette hex. There is no `brand-private` class.
25
+
26
+ ## How theming works
27
+
28
+ The SDAIA design system uses **class-based** theming — not `prefers-color-scheme` media queries.
29
+ All semantic color tokens (`--ds-color-bg-*`, `--ds-color-text-*`, `--ds-color-border-*`) are
30
+ defined for light mode by default and overridden when `.theme-dark` is present on `<html>`.
31
+
32
+ `npx sdaia-ui@latest init` adds a class-based `dark:` variant to your global CSS, so Tailwind `dark:` utilities and the design tokens both follow `theme-dark` on `<html>`. Don't replace it with a `prefers-color-scheme` media query.
33
+
34
+ > **Never hardcode hex colors.** Always use `var(--ds-color-*)` tokens so dark mode works automatically.
35
+
36
+ ## Enabling dark mode
37
+
38
+ ### 1 — Prevent flash on page load (FOUC fix)
39
+
40
+ Add this inline script to `index.html` before `</head>`:
41
+
42
+ ```html
43
+ <script>
44
+ (function() {
45
+ const stored = window.localStorage.getItem('theme');
46
+ const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
47
+ const isDark = stored ? stored === 'dark' : prefersDark;
48
+ document.documentElement.classList.toggle('theme-dark', isDark);
49
+ })();
50
+ </script>
51
+ ```
52
+
53
+ ### 2 — React toggle hook
54
+
55
+ ```tsx
56
+ const [dark, setDark] = useState(() =>
57
+ document.documentElement.classList.contains('theme-dark')
58
+ );
59
+
60
+ useEffect(() => {
61
+ document.documentElement.classList.toggle('theme-dark', dark);
62
+ window.localStorage.setItem('theme', dark ? 'dark' : 'light');
63
+ }, [dark]);
64
+ ```
65
+
66
+ Use this as the **only** theme toggle path. Do not add or remove a separate `dark` class, and do not keep another theme flag elsewhere in the app shell.
67
+
68
+ ### 3 — Toggle button (DS icons — not emoji)
69
+
70
+ Use `@platformscode/icons` + `DgaIcon` — see `get_foundations` topic **`icon-usage`**. **Never** use ☀️/🌙 emoji or unrelated icons (e.g. `pizza01Stroke`).
71
+
72
+ ```tsx
73
+ import { DgaIcon } from '@/components/ui/DgaIcon';
74
+ import { darkModeStroke, sun01Stroke } from '@platformscode/icons';
75
+ import { Button } from '@/components/ui/Button';
76
+
77
+ <Button
78
+ variant="transparent"
79
+ size="md"
80
+ iconOnly
81
+ aria-label={dark ? 'Switch to light mode' : 'Switch to dark mode'}
82
+ leadingIcon={
83
+ <DgaIcon data={dark ? sun01Stroke : darkModeStroke} className="size-icon-sm" />
84
+ }
85
+ onClick={() => setDark((value) => !value)}
86
+ />
87
+ ```
88
+
89
+ ## Key semantic tokens
90
+
91
+ Surfaces: `--ds-color-bg-canvas` (page), `--ds-color-bg-default` (cards, fields), `--ds-color-bg-raised` (popovers, menus). Text: `--ds-color-text-display` (headings), `--ds-color-text-paragraph` (body), `--ds-color-text-paragraph-muted` (secondary). Borders: `--ds-color-border-default`, focus `--ds-color-border-focus`. Look up exact light and dark values with `get_tokens`; use the variables, never the values.
92
+
93
+ ## Common mistakes
94
+
95
+ - Hardcoding hex values (`color: #08060d`) — they ignore `.theme-dark`
96
+ - Using `background-color: white` instead of `var(--ds-color-bg-default)`
97
+ - Removing or editing the `@custom-variant dark` rule that `init` added
98
+ - Building the page shell with hardcoded light classes such as `bg-white`, `text-black`, or `border-gray-200` while DS components use dark-aware tokens
99
+ - Copying one component example labeled dark and another labeled light into the same screen without deciding the root theme first
100
+ - Forgetting the flash-prevention inline script (causes FOUC on first paint in dark OS)
101
+ - Setting dark mode via `prefers-color-scheme` CSS only — DS tokens do not respond to media queries
102
+ - Toggling `.theme-dark` and a separate `dark` class independently
103
+
104
+ ## Why mixed dark and light UIs happen
105
+
106
+ This usually means the app shell and the DS components are not using the same theme contract.
107
+
108
+ - DS components often style themselves from semantic tokens, so they respond when `.theme-dark` exists on `<html>`.
109
+ - Custom wrappers, sections, cards, and page backgrounds generated by the LLM often use hardcoded Tailwind colors like `bg-white`, `text-slate-900`, or `border-gray-200`, which stay light even in dark mode.
110
+ - The reverse also happens: a dark custom shell can wrap light-mode components if the root `.theme-dark` class was never applied.
111
+
112
+ To keep a consistent result, always theme both layers:
113
+
114
+ - App shell: use DS tokens such as `var(--ds-color-bg-canvas)`, `var(--ds-color-bg-default)`, `var(--ds-color-text-default)`, and `var(--ds-color-border-default)`.
115
+ - Components: let the installed DS components keep their built-in token-based styles.