@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,78 @@
|
|
|
1
|
+
# Image Viewer
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Image Viewer
|
|
5
|
+
- Slug: `media-viewer`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add media-viewer`
|
|
8
|
+
- Import: `import { MediaViewer } from '@/components/ui/MediaViewer'`
|
|
9
|
+
- Installed files: `MediaViewer.tsx`, `MediaViewer.types.ts`, `MediaViewer.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/image-viewer
|
|
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 media-viewer`. It copies the source into your components folder (`components/ui/MediaViewer/`, under `src/` when the project has one); import it as `@/components/ui/MediaViewer`. 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
|
+
| `open` | `boolean` | — | Whether the viewer is open. |
|
|
18
|
+
| `onClose` | `() => void` | — | Called when the viewer should close (close button, backdrop click, Escape key). |
|
|
19
|
+
| `images?` | `MediaViewerImage[]` | [] | List of images to view. |
|
|
20
|
+
| `currentIndex?` | `number` | — | 0-based index of the currently visible image (controlled). |
|
|
21
|
+
| `onIndexChange?` | `(index: number) => void` | — | Called when the user navigates to a different image. |
|
|
22
|
+
| `zoom?` | `number` | — | Zoom level (1 = 100 %, 2 = 200 %, etc.). When provided the component is fully controlled for zoom. When omitted the component manages zoom internally. |
|
|
23
|
+
| `onZoomChange?` | `(zoom: number) => void` | — | Called when zoom changes. |
|
|
24
|
+
| `minZoom?` | `number` | 0.5 | Minimum zoom. Default 0.5 |
|
|
25
|
+
| `maxZoom?` | `number` | 3 | Maximum zoom. Default 3 |
|
|
26
|
+
| `zoomStep?` | `number` | 0.25 | Zoom step per click. Default 0.25 |
|
|
27
|
+
| `onShare?` | `() => void` | — | Called when the Share button is clicked. |
|
|
28
|
+
| `onPrint?` | `() => void` | — | Called when the Print button is clicked. |
|
|
29
|
+
| `overlay?` | `boolean` | false | Overlay mode — image fills the full area and all controls (header, arrows, zoom) are absolutely positioned on top of it. Default: false (Standard mode — header above, image, zoom below). |
|
|
30
|
+
| `labels?` | `Partial<MediaViewerLabels>` | — | Translatable built-in text. Unset keys use the English defaults. |
|
|
31
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction. Inherits from the page when omitted. In RTL the layout mirrors: "previous" sits on the right and ArrowLeft goes to the next image. |
|
|
32
|
+
| `contained?` | `boolean` | false | Render inline instead of as a fixed full-viewport overlay. Skips createPortal and body scroll lock — use in docs/demos where the viewer should be embedded in the page rather than covering it. |
|
|
33
|
+
|
|
34
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `children`.
|
|
35
|
+
|
|
36
|
+
## Options (allowed values)
|
|
37
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction. Inherits from the page when omitted. In RTL the layout
|
|
38
|
+
mirrors: "previous" sits on the right and ArrowLeft goes to the next image.
|
|
39
|
+
|
|
40
|
+
## Deprecated props
|
|
41
|
+
Do not use in new code:
|
|
42
|
+
- `rtl` — Enable right-to-left layout.
|
|
43
|
+
|
|
44
|
+
## Accessibility
|
|
45
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
46
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
47
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
48
|
+
|
|
49
|
+
## Design tokens used
|
|
50
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
51
|
+
- `var(--ds-brand-alpha-black-50)`
|
|
52
|
+
- `var(--ds-brand-alpha-black-70)`
|
|
53
|
+
- `var(--ds-brand-alpha-black-80)`
|
|
54
|
+
- `var(--ds-color-alpha-black-)`
|
|
55
|
+
- `var(--ds-color-bg-emphasis-low)`
|
|
56
|
+
- `var(--ds-color-border-on-dark-40)`
|
|
57
|
+
- `var(--ds-color-button-bg-transparent-)`
|
|
58
|
+
- `var(--ds-color-button-bg-transparent-hovered)`
|
|
59
|
+
- `var(--ds-color-button-bg-transparent-pressed)`
|
|
60
|
+
- `var(--ds-color-icon-oncolor)`
|
|
61
|
+
- `var(--ds-color-text-on-color)`
|
|
62
|
+
- `var(--ds-color-text-on-color-subtle)`
|
|
63
|
+
- `var(--ds-radius-full)`
|
|
64
|
+
- `var(--ds-radius-m)`
|
|
65
|
+
- `var(--ds-radius-xxs)`
|
|
66
|
+
- `var(--ds-spacing-7xl)`
|
|
67
|
+
- `var(--ds-spacing-8xl)`
|
|
68
|
+
- `var(--ds-spacing-lg)`
|
|
69
|
+
- `var(--ds-spacing-md)`
|
|
70
|
+
- `var(--ds-spacing-sm)`
|
|
71
|
+
- `var(--ds-spacing-xl)`
|
|
72
|
+
|
|
73
|
+
## AI usage guidance
|
|
74
|
+
When generating UI:
|
|
75
|
+
- Install with `npx sdaia-ui@latest add media-viewer` (after `npx sdaia-ui@latest init`), then import `{ MediaViewer }` from `@/components/ui/MediaViewer`.
|
|
76
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
77
|
+
- Use only the documented option values listed under "Options".
|
|
78
|
+
- Pick one theme per screen: dark is `.theme-dark` (or `.dark`) on `<html>`; style surrounding layout with DS tokens (`get_tokens`), never hardcoded colors.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Menu
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Menu
|
|
5
|
+
- Slug: `menu`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add menu`
|
|
8
|
+
- Import: `import { Menu } from '@/components/ui/Menu'`
|
|
9
|
+
- Installed files: `Menu.tsx`, `Menu.types.ts`, `Menu.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/menu
|
|
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 menu`. It copies the source into your components folder (`components/ui/Menu/`, under `src/` when the project has one); import it as `@/components/ui/Menu`. 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
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Layout direction — applied to the root element. Inherits from the page when omitted. |
|
|
18
|
+
| `sections?` | `MenuSectionData[]` | — | Sections to render. Each section is a group label + list of items, separated by a divider. |
|
|
19
|
+
| `value?` | `string \| null` | — | Controlled selected value. |
|
|
20
|
+
| `defaultValue?` | `string \| null` | null | Uncontrolled initial selected value. |
|
|
21
|
+
| `onValueChange?` | `(value: string) => void` | — | Fires when the user selects an item. Receives the item's `value` (or its fallback key). |
|
|
22
|
+
| `background?` | `boolean` | false | Show the menu background (white / dark surface). Defaults to `false` (transparent). |
|
|
23
|
+
| `border?` | `boolean` | false | Show the outer border. Defaults to `false`. |
|
|
24
|
+
| `surface?` | `'solid' \| 'glass'` | 'solid' | Surface treatment — `'solid'` (default) or `'glass'` (translucent liquid-glass material). `'glass'` overrides `background` / `border`. |
|
|
25
|
+
| `divider?` | `boolean` | true | Render dividers between sections. Defaults to `true`. |
|
|
26
|
+
| `children?` | `ReactNode` | — | Custom content — if provided, overrides `sections` so consumers can compose freely. |
|
|
27
|
+
|
|
28
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `onChange`, `defaultValue`.
|
|
29
|
+
|
|
30
|
+
## Options (allowed values)
|
|
31
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction — applied to the root element. Inherits from the page when omitted.
|
|
32
|
+
- `surface`: `'solid'` \| `'glass'` — Surface treatment of the menu container.
|
|
33
|
+
- `'solid'` (default) — honors the `background` / `border` toggles.
|
|
34
|
+
- `'glass'` — translucent liquid-glass material (blurred backdrop +
|
|
35
|
+
beveled edge highlight). Provides its own background and edge, so it
|
|
36
|
+
overrides `background` / `border`. Reads best placed over imagery 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
|
+
|
|
42
|
+
## Deprecated props
|
|
43
|
+
Do not use in new code:
|
|
44
|
+
- `rtl`
|
|
45
|
+
|
|
46
|
+
## Accessibility
|
|
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-overlay)`
|
|
53
|
+
- `var(--ds-color-border-default)`
|
|
54
|
+
- `var(--ds-color-text-display)`
|
|
55
|
+
- `var(--ds-radius-m)`
|
|
56
|
+
- `var(--ds-spacing-lg)`
|
|
57
|
+
- `var(--ds-spacing-md)`
|
|
58
|
+
- `var(--ds-spacing-xl)`
|
|
59
|
+
- `var(--ds-text-leading-line-heights-text-xs)`
|
|
60
|
+
|
|
61
|
+
## AI usage guidance
|
|
62
|
+
When generating UI:
|
|
63
|
+
- Install with `npx sdaia-ui@latest add menu` (after `npx sdaia-ui@latest init`), then import `{ Menu }` from `@/components/ui/Menu`.
|
|
64
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
65
|
+
- Use only the documented option values listed under "Options".
|
|
66
|
+
- 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,92 @@
|
|
|
1
|
+
# Metric
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Metric
|
|
5
|
+
- Slug: `metric`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add metric`
|
|
8
|
+
- Import: `import { Metric } from '@/components/ui/Metric'`
|
|
9
|
+
- Installed files: `Metric.tsx`, `Metric.types.ts`, `Metric.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/metric
|
|
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 metric`. It copies the source into your components folder (`components/ui/Metric/`, under `src/` when the project has one); import it as `@/components/ui/Metric`. 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
|
+
| `action?` | `'Default' \| 'Footer' \| 'Header'` | 'Default' | Card action layout. - Default: no action bar; MoreVertical (⋮) lives in the label row only. - Header: "View report" link in a top bar (border-b), content below. - Footer: Content at top, then "View report" link / outlined button in a bottom bar (border-t). |
|
|
18
|
+
| `type?` | `'Compact' \| 'Icon Left' \| 'Icon Top' \| 'Icon Left + Text'` | 'Compact' | Icon and layout variant. - Compact: No icon. Label row + value row. - Icon Left: 40 px star to the start; label + value stacked in the adjacent column. - Icon Top: 40 px star alone in the heading row; label then value below. - Icon Left + Text: Star + label share the heading row; value + trend below. |
|
|
19
|
+
| `trend?` | `'None' \| 'Badge' \| 'Text'` | 'None' | Trend indicator variant shown next to (or below) the value. - None: No indicator. - Badge: Bordered pill with a green dot and `trendValue` text (e.g. "100%"). - Text: Coloured `trendValue` followed by muted `trendLabel` (e.g. "100% vs last month"). |
|
|
20
|
+
| `graph?` | `'None' \| 'Compact' \| 'Large'` | 'None' | Sparkline graph variant. - None: No chart. - Compact: Fixed 128×64 px sparkline aligned to the end of the value row. - Large: Full-width sparkline below the content. |
|
|
21
|
+
| `chartTrend?` | `SparklineTrend` | 'Positive' | Trend direction for the embedded sparkline. |
|
|
22
|
+
| `chartValues?` | `number[]` | — | Data points plotted by the sparkline (`graph="Compact"` / `"Large"`). The chart is then exposed as a figure named by `label` (or `labels.chart`). Without it no sparkline is drawn (there is no built-in sample shape). |
|
|
23
|
+
| `label?` | `string` | — | Metric label / title text. Not rendered when omitted. |
|
|
24
|
+
| `value?` | `string` | — | Main metric value (e.g. "2,000"). Not rendered when omitted. |
|
|
25
|
+
| `trendValue?` | `string` | — | Percentage or indicator value used by both `trend="Badge"` and `trend="Text"`. - Badge: shown as the text inside the pill (e.g. "100%"). - Text: shown in accent colour before `trendLabel` (e.g. "100%"). |
|
|
26
|
+
| `trendLabel?` | `string` | — | Secondary label appended after `trendValue` when `trend="Text"`. (e.g. "vs last month") |
|
|
27
|
+
| `actionLabel?` | `string` | — | Action button label shown in the header / footer bar (e.g. "View report"). The bar is only rendered when a label is provided. |
|
|
28
|
+
| `onAction?` | `() => void` | — | Called when the action button is clicked. |
|
|
29
|
+
| `onMoreOptions?` | `() => void` | — | Called when the MoreVertical (⋮) icon is clicked. |
|
|
30
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction. Inherits from the document when omitted. |
|
|
31
|
+
| `labels?` | `Partial<MetricLabels>` | — | Override built-in strings (English defaults) to localize the card. |
|
|
32
|
+
|
|
33
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `dir`.
|
|
34
|
+
|
|
35
|
+
## Options (allowed values)
|
|
36
|
+
- `action`: `'Default'` \| `'Footer'` \| `'Header'` — Card action layout.
|
|
37
|
+
- Default: no action bar; MoreVertical (⋮) lives in the label row only.
|
|
38
|
+
- Header: "View report" link in a top bar (border-b), content below.
|
|
39
|
+
- Footer: Content at top, then "View report" link / outlined button in a bottom bar (border-t).
|
|
40
|
+
- `type`: `'Compact'` \| `'Icon Left'` \| `'Icon Top'` \| `'Icon Left + Text'` — Icon and layout variant.
|
|
41
|
+
- Compact: No icon. Label row + value row.
|
|
42
|
+
- Icon Left: 40 px star to the start; label + value stacked in the adjacent column.
|
|
43
|
+
- Icon Top: 40 px star alone in the heading row; label then value below.
|
|
44
|
+
- Icon Left + Text: Star + label share the heading row; value + trend below.
|
|
45
|
+
- `trend`: `'None'` \| `'Badge'` \| `'Text'` — Trend indicator variant shown next to (or below) the value.
|
|
46
|
+
- None: No indicator.
|
|
47
|
+
- Badge: Bordered pill with a green dot and `trendValue` text (e.g. "100%").
|
|
48
|
+
- Text: Coloured `trendValue` followed by muted `trendLabel` (e.g. "100% vs last month").
|
|
49
|
+
- `graph`: `'None'` \| `'Compact'` \| `'Large'` — Sparkline graph variant.
|
|
50
|
+
- None: No chart.
|
|
51
|
+
- Compact: Fixed 128×64 px sparkline aligned to the end of the value row.
|
|
52
|
+
- Large: Full-width sparkline below the content.
|
|
53
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction. Inherits from the document when omitted.
|
|
54
|
+
|
|
55
|
+
## Accessibility
|
|
56
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
57
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
58
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
59
|
+
|
|
60
|
+
## Design tokens used
|
|
61
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
62
|
+
- `var(--ds-color-bg-default)`
|
|
63
|
+
- `var(--ds-color-bg-emphasis-high)`
|
|
64
|
+
- `var(--ds-color-bg-raised)`
|
|
65
|
+
- `var(--ds-color-border-default-strong)`
|
|
66
|
+
- `var(--ds-color-border-muted)`
|
|
67
|
+
- `var(--ds-color-chart-lavender)`
|
|
68
|
+
- `var(--ds-color-chart-series-)`
|
|
69
|
+
- `var(--ds-color-chart-series-1)`
|
|
70
|
+
- `var(--ds-color-chart-series-2)`
|
|
71
|
+
- `var(--ds-color-icon-default-400)`
|
|
72
|
+
- `var(--ds-color-link-primary-hovered)`
|
|
73
|
+
- `var(--ds-color-text-brand)`
|
|
74
|
+
- `var(--ds-color-text-default)`
|
|
75
|
+
- `var(--ds-color-text-paragraph-muted)`
|
|
76
|
+
- `var(--ds-radius-full)`
|
|
77
|
+
- `var(--ds-radius-l)`
|
|
78
|
+
- `var(--ds-radius-xs)`
|
|
79
|
+
- `var(--ds-spacing-2xl)`
|
|
80
|
+
- `var(--ds-spacing-lg)`
|
|
81
|
+
- `var(--ds-spacing-md)`
|
|
82
|
+
- `var(--ds-spacing-sm)`
|
|
83
|
+
- `var(--ds-spacing-xs)`
|
|
84
|
+
- `var(--ds-text-leading-line-heights-display-xs)`
|
|
85
|
+
|
|
86
|
+
## AI usage guidance
|
|
87
|
+
When generating UI:
|
|
88
|
+
- Install with `npx sdaia-ui@latest add metric` (after `npx sdaia-ui@latest init`), then import `{ Metric }` from `@/components/ui/Metric`.
|
|
89
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
90
|
+
- Use only the documented option values listed under "Options".
|
|
91
|
+
- Pass icons via `<DgaIcon data={…} className="size-icon-sm" />` from `@platformscode/icons` only — see `get_foundations` (`icon-usage`). Never emoji, Lucide, or random icons (e.g. `pizza01Stroke` for dark mode).
|
|
92
|
+
- 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,62 @@
|
|
|
1
|
+
# Nav Bar
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Nav Bar
|
|
5
|
+
- Slug: `nav-bar`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add nav-bar`
|
|
8
|
+
- Import: `import { NavBar } from '@/components/ui/NavBar'`
|
|
9
|
+
- Installed files: `NavBar.tsx`, `NavBar.types.ts`, `NavBar.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/nav-bar
|
|
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 nav-bar`. It copies the source into your components folder (`components/ui/NavBar/`, under `src/` when the project has one); import it as `@/components/ui/NavBar`. 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
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Layout direction applied to the root. Omit to inherit the ambient direction from the page. |
|
|
18
|
+
| `variant?` | `'default' \| 'gray' \| 'brand'` | 'default' | Visual background / colour variant. Controls sidebar background, text colours, and icon colours across all composed sub-components. |
|
|
19
|
+
| `collapsed?` | `boolean` | false | Whether the sidebar is in its collapsed (icon-only) state. - Desktop collapsed → 64 px wide, icons only. - Mobile collapsed → full-width 68 px header strip with hamburger icon. Pass `false` for the expanded (full) view. |
|
|
20
|
+
| `mobile?` | `boolean` | — | Enable mobile layout mode. - When `collapsed` is true → renders only the header strip + hamburger. - When `collapsed` is false → renders a modal overlay drawer (focus is moved into it, trapped, and returned to the hamburger on close). Omit to switch automatically below 768 px. |
|
|
21
|
+
| `onToggle?` | `() => void` | — | Called when the header toggle (desktop), the hamburger (mobile collapsed) or the close button (mobile expanded) is activated, and on Escape in the mobile drawer. The parent is responsible for toggling `collapsed`. |
|
|
22
|
+
| `headerProps?` | `Omit<HeaderItemProps, 'variant' \| 'size'>` | — | Props forwarded to the built-in `HeaderItem` at the top of the sidebar. The `variant` and `size` props are derived from the NavBar's own `variant` and `collapsed` props — do not override them here. An `aria-label` passed here overrides the toggle label from `labels`. |
|
|
23
|
+
| `footerProps?` | `Omit<FooterItemProps, 'variant' \| 'size'>` | — | Props forwarded to the built-in `FooterItem` at the bottom of the sidebar. The `variant` and `size` props are derived from the NavBar — do not override them here. |
|
|
24
|
+
| `groups?` | `NavBarGroup[]` | [] | Navigation groups to render in the scrollable content area. Items render as buttons in a list; the selected item carries `aria-current="page"`. |
|
|
25
|
+
| `labels?` | `Partial<NavBarLabels>` | — | Override the built-in accessible strings (English defaults). |
|
|
26
|
+
|
|
27
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `dir`.
|
|
28
|
+
|
|
29
|
+
## Options (allowed values)
|
|
30
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction applied to the root. Omit to inherit the ambient
|
|
31
|
+
direction from the page.
|
|
32
|
+
- `variant`: `'default'` \| `'gray'` \| `'brand'` — Visual background variant of the sidebar.
|
|
33
|
+
- `default` — `--ds-color-bg-default` background
|
|
34
|
+
- `gray` — `--ds-color-bg-canvas` background
|
|
35
|
+
- `brand` — `--ds-color-bg-brand` background, on-color text on all sub-components
|
|
36
|
+
|
|
37
|
+
## Deprecated props
|
|
38
|
+
Do not use in new code:
|
|
39
|
+
- `rtl`
|
|
40
|
+
|
|
41
|
+
## Accessibility
|
|
42
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
43
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
44
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
45
|
+
|
|
46
|
+
## Design tokens used
|
|
47
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
48
|
+
- `var(--ds-color-alpha-black-40)`
|
|
49
|
+
- `var(--ds-color-bg-brand)`
|
|
50
|
+
- `var(--ds-color-bg-canvas)`
|
|
51
|
+
- `var(--ds-color-bg-default)`
|
|
52
|
+
- `var(--ds-color-primitive-alpha-black-40)`
|
|
53
|
+
- `var(--ds-spacing-none)`
|
|
54
|
+
- `var(--ds-spacing-xl)`
|
|
55
|
+
|
|
56
|
+
## AI usage guidance
|
|
57
|
+
When generating UI:
|
|
58
|
+
- Install with `npx sdaia-ui@latest add nav-bar` (after `npx sdaia-ui@latest init`), then import `{ NavBar }` from `@/components/ui/NavBar`.
|
|
59
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
60
|
+
- Use only the documented option values listed under "Options".
|
|
61
|
+
- 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).
|
|
62
|
+
- 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,125 @@
|
|
|
1
|
+
# Nav Header
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Nav Header
|
|
5
|
+
- Slug: `nav-header`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add nav-header`
|
|
8
|
+
- Import: `import { NavHeader } from '@/components/ui/NavHeader'`
|
|
9
|
+
- Installed files: `NavHeader.tsx`, `NavHeader.types.ts`, `NavHeader.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/nav-header
|
|
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 nav-header`. It copies the source into your components folder (`components/ui/NavHeader/`, under `src/` when the project has one); import it as `@/components/ui/NavHeader`. 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
|
+
NavHeader props.
|
|
16
|
+
|
|
17
|
+
Extends `HTMLAttributes<HTMLElement>` (minus `title`, which we shadow so
|
|
18
|
+
consumers can pass a richer ReactNode label for the mobile footer block).
|
|
19
|
+
|
|
20
|
+
The component is *pure composition* — every interactive sub-element
|
|
21
|
+
is a separate `sdaia-ui` component that the consumer passes in:
|
|
22
|
+
|
|
23
|
+
- `logo` → typically `<NavLogoPlaceholder size="medium" text="…" />`
|
|
24
|
+
- `items` → array of `<NavHeaderMenuItem />` (desktop row / mobile stack)
|
|
25
|
+
- `search` → a `<TextInput placeholder="Search" />`
|
|
26
|
+
- `actions` → a `<NavHeaderActions />`
|
|
27
|
+
- `menuContent` → what to render inside the expanded dropdown/drawer.
|
|
28
|
+
Typically `<NavHeaderDropdownItemList />`,
|
|
29
|
+
`<NavHeaderMenuCard />`, or any combination.
|
|
30
|
+
- `mobileFooter` → optional footer block for the mobile drawer
|
|
31
|
+
(links + NavHeaderActions).
|
|
32
|
+
|
|
33
|
+
This keeps NavHeader agnostic to concrete content (labels, hrefs, copy,
|
|
34
|
+
localisation) and prevents us from duplicating the public APIs of the
|
|
35
|
+
reused components.
|
|
36
|
+
|
|
37
|
+
## Props
|
|
38
|
+
| Prop | Type | Default | Description |
|
|
39
|
+
| --- | --- | --- | --- |
|
|
40
|
+
| `type?` | `'default' \| 'menu' \| 'menu-compact'` | 'default' | Visual type — controls which menu-panel density is rendered when `menuOpen` is true. When `type='default'` the menu panel is never rendered regardless of `menuOpen`. |
|
|
41
|
+
| `surface?` | `'solid' \| 'glass'` | 'solid' | Surface treatment — `'solid'` (default) or `'glass'` (translucent liquid-glass material). Applies to the bar plus the desktop dropdown and mobile drawer. |
|
|
42
|
+
| `mobile?` | `boolean` | — | Layout override. - `undefined` (default — recommended for app code) Auto-responsive: renders BOTH branches and uses CSS to switch at the `md` breakpoint (≥768 px → desktop bar, <768 px → mobile bar + drawer). The same `<NavHeader />` adapts to any viewport without a JS resize listener. - `true` → force the mobile layout regardless of viewport. Useful for documentation demos that want to showcase the mobile variant inside a desktop preview frame. - `false` → force the desktop layout regardless of viewport. Useful for documentation demos that want to showcase the desktop variant inside a constrained preview frame. |
|
|
43
|
+
| `menuOpen?` | `boolean` | false | Whether the menu panel (desktop dropdown or mobile drawer) is open. Controlled. The component toggles the hamburger glyph to match but never owns this state itself — the consumer passes the latest value via props and updates it in response to `onOpenChange`. |
|
|
44
|
+
| `onOpenChange?` | `(open: boolean) => void` | — | Fires when the user clicks the mobile hamburger or × button. The consumer is expected to flip `menuOpen` in response. Ignored on desktop (where menu open/close is driven by individual `<NavHeaderMenuItem open>` buttons in the bar). |
|
|
45
|
+
| `onDropdownClose?` | `() => void` | — | Fires when the user presses Escape while focus is inside the open desktop dropdown panel (or on its trigger). Close the dropdown in response (flip the open `<NavHeaderMenuItem open>` to `false`); focus returns to that trigger automatically. Escape inside the open mobile drawer calls `onOpenChange(false)` and returns focus to the menu toggle. |
|
|
46
|
+
| `labels?` | `Partial<NavHeaderLabels>` | — | Override the built-in accessible strings (English defaults). |
|
|
47
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Layout direction — applied to the root `<nav>`; inherits from the page when omitted. |
|
|
48
|
+
| `logo?` | `ReactNode` | — | Logo slot — typically `<NavLogoPlaceholder size="medium" text="…" />`. Nothing is rendered when omitted (no sample logo). |
|
|
49
|
+
| `items?` | `ReactNode[]` | — | Main navigation items — one entry per `<NavHeaderMenuItem />`. On desktop they render as a horizontal row inside the bar; on mobile they render stacked inside the drawer, interleaved with any `menuContent` the consumer passes. When empty / omitted, the item row is hidden on desktop and the mobile drawer falls back to rendering only `search`, `menuContent`, `mobileFooter`, and `actions`. |
|
|
50
|
+
| `search?` | `ReactNode` | — | Search input. Rendered inline between the items and the actions on desktop; rendered at the top of the drawer on mobile. Omit to hide. Typically `<TextInput placeholder="Search" fullWidth />`. |
|
|
51
|
+
| `actions?` | `ReactNode` | — | Trailing cluster — Log in / Sign Up buttons (logged-out) or an avatar + identity (logged-in). Typically `<NavHeaderActions />`. Rendered inline on desktop; stacked at the bottom of the drawer on mobile. |
|
|
52
|
+
| `menuContent?` | `ReactNode` | — | Content rendered inside the expanded menu panel. On desktop this renders as an absolutely-positioned dropdown below the bar; on mobile it renders inline inside the drawer, between `search` and the footer. Ignored when `type='default'`, or when `menuOpen` is false on mobile. On desktop the dropdown is only shown when `type !== 'default'` AND at least one `<NavHeaderMenuItem open>` is in `items` — i.e. the consumer controls open/close by flipping the `open` prop on the relevant item. |
|
|
53
|
+
| `mobileFooter?` | `ReactNode` | — | Mobile-only footer block shown at the bottom of the drawer — typically a `<div>` with secondary-link columns. Omit to hide. Has no effect on desktop. |
|
|
54
|
+
| `className?` | `string` | — | Extra classes merged onto the root element. |
|
|
55
|
+
| `barClassName?` | `string` | — | Extra classes merged onto the inner bar `<div>` (the element that carries the responsive horizontal padding). Use this to override padding in constrained contexts such as documentation preview frames, e.g. `barClassName="px-spacing-xl"`. |
|
|
56
|
+
| `dropdownClassName?` | `string` | — | Extra classes merged onto the desktop dropdown panel `<div>`. The full panel (`type="menu"`) aligns its columns with responsive `px-*`; the compact panel (`type="menu-compact"`) sits inside the bar gutter with responsive `inset-x-*`. Use this alongside `barClassName` to keep the dropdown edge-aligned with a locked bar, e.g. `dropdownClassName="px-spacing-xl"` (menu) or `dropdownClassName="inset-x-spacing-xl"` (menu-compact). |
|
|
57
|
+
|
|
58
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `title`.
|
|
59
|
+
|
|
60
|
+
## Options (allowed values)
|
|
61
|
+
- `type`: `'default'` \| `'menu'` \| `'menu-compact'` — Layout tier — drives the structure of the header bar and, when a menu
|
|
62
|
+
panel is present, the visual density of the dropdown.
|
|
63
|
+
|
|
64
|
+
- `default` → header bar only, no menu panel
|
|
65
|
+
- `menu` → header bar + full menu panel: flush under the bar,
|
|
66
|
+
full width, flat (no radius or shadow), with a
|
|
67
|
+
separator line under the bar while it is open;
|
|
68
|
+
full drawer on mobile
|
|
69
|
+
- `menu-compact` → header bar + compact menu panel: a floating card
|
|
70
|
+
inset by the bar gutter, 8 px below the bar, rounded,
|
|
71
|
+
with a drop shadow; same drawer on mobile
|
|
72
|
+
|
|
73
|
+
Both panels use Background/background-raised. The component does not
|
|
74
|
+
generate the content; the consumer passes it in via `menuContent`.
|
|
75
|
+
- `surface`: `'solid'` \| `'glass'` — Surface treatment of the header shell (bar + dropdown + drawer).
|
|
76
|
+
- `'solid'` (default) — opaque backgrounds, with the standard drop
|
|
77
|
+
shadow on the floating compact dropdown and the drawer.
|
|
78
|
+
- `'glass'` — translucent liquid-glass material (blurred backdrop +
|
|
79
|
+
beveled edge highlight). Reads best when the header overlays imagery
|
|
80
|
+
or color, e.g. a sticky bar above a hero.
|
|
81
|
+
|
|
82
|
+
The visual is provided by the shared `.glass-surface` utility, so it is
|
|
83
|
+
theme-aware (light / dark) and identical across every component that
|
|
84
|
+
exposes a `surface` prop. Orthogonal to `type` and `menuOpen`.
|
|
85
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction — applied to the root `<nav>`; inherits from the page
|
|
86
|
+
when omitted.
|
|
87
|
+
|
|
88
|
+
## Deprecated props
|
|
89
|
+
Do not use in new code:
|
|
90
|
+
- `rtl`
|
|
91
|
+
|
|
92
|
+
## Accessibility
|
|
93
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
94
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
95
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
96
|
+
|
|
97
|
+
## Design tokens used
|
|
98
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
99
|
+
- `var(--ds-brand-spacing-space-3)`
|
|
100
|
+
- `var(--ds-brand-spacing-space-4)`
|
|
101
|
+
- `var(--ds-brand-spacing-space-5)`
|
|
102
|
+
- `var(--ds-brand-spacing-space-6)`
|
|
103
|
+
- `var(--ds-brand-spacing-space-N)`
|
|
104
|
+
- `var(--ds-color-)`
|
|
105
|
+
- `var(--ds-color-bg-canvas)`
|
|
106
|
+
- `var(--ds-color-bg-overlay)`
|
|
107
|
+
- `var(--ds-color-bg-raised)`
|
|
108
|
+
- `var(--ds-color-border-default)`
|
|
109
|
+
- `var(--ds-radius-m)`
|
|
110
|
+
- `var(--ds-spacing-)`
|
|
111
|
+
- `var(--ds-spacing-3xl)`
|
|
112
|
+
- `var(--ds-spacing-4xl)`
|
|
113
|
+
- `var(--ds-spacing-6xl)`
|
|
114
|
+
- `var(--ds-spacing-8xl)`
|
|
115
|
+
- `var(--ds-spacing-md)`
|
|
116
|
+
- `var(--ds-spacing-none)`
|
|
117
|
+
- `var(--ds-spacing-xl)`
|
|
118
|
+
- `var(--ds-spacing-xs)`
|
|
119
|
+
|
|
120
|
+
## AI usage guidance
|
|
121
|
+
When generating UI:
|
|
122
|
+
- Install with `npx sdaia-ui@latest add nav-header` (after `npx sdaia-ui@latest init`), then import `{ NavHeader }` from `@/components/ui/NavHeader`.
|
|
123
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
124
|
+
- Use only the documented option values listed under "Options".
|
|
125
|
+
- 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
|
+
# Number
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Number
|
|
5
|
+
- Slug: `number`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add number`
|
|
8
|
+
- Import: `import { Number } from '@/components/ui/Number'`
|
|
9
|
+
- Installed files: `Number.tsx`, `Number.types.ts`, `Number.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/number
|
|
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 number`. It copies the source into your components folder (`components/ui/Number/`, under `src/` when the project has one); import it as `@/components/ui/Number`. 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?` | `'StatPair' \| 'StatHighlight' \| 'StatSplit' \| 'StatComparisonBlock' \| 'StatSideList' \| 'StatExtendedPanel' \| 'StatMixedStack' \| 'StatOptionBlock' \| 'StatDetailPair' \| 'StatInlineGroup' \| 'StatHeaderSplit' \| 'StatListStack'` | 'StatPair' | Layout type. |
|
|
18
|
+
| `label?` | `string` | — | Label / indicator name above the primary value. Not rendered when unset. |
|
|
19
|
+
| `value?` | `string` | — | Large primary value (e.g. "422.61"). Not rendered when unset. |
|
|
20
|
+
| `trend?` | `'positive' \| 'negative'` | 'positive' (layouts with a badge) | Trend direction for the primary badge. |
|
|
21
|
+
| `trendValue?` | `string` | — | Trend badge text (e.g. "12%"). The badge renders only when this is set. |
|
|
22
|
+
| `label2?` | `string` | — | — |
|
|
23
|
+
| `value2?` | `string` | — | — |
|
|
24
|
+
| `trend2?` | `'positive' \| 'negative'` | 'negative' (layouts with a badge) | Trend direction for the secondary badge. |
|
|
25
|
+
| `trendValue2?` | `string` | — | — |
|
|
26
|
+
| `title?` | `string` | — | Card title — StatInlineGroup only. Not rendered when unset. |
|
|
27
|
+
| `rows?` | `NumberRow[]` | [] | Up to 3 secondary data rows (label + medium value, optional badge). |
|
|
28
|
+
| `menuLabel?` | `string` | — | Dropdown button label — StatExtendedPanel only. Wins over `labels.menu`. |
|
|
29
|
+
| `onMenuClick?` | `() => void` | — | — |
|
|
30
|
+
| `onMoreClick?` | `() => void` | — | More-options (⋮) click handler — StatInlineGroup only |
|
|
31
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction of the card. Unset inherits from the closest `dir` ancestor. |
|
|
32
|
+
| `labels?` | `Partial<NumberLabels>` | — | Localised built-in strings. |
|
|
33
|
+
|
|
34
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `title`.
|
|
35
|
+
|
|
36
|
+
## Options (allowed values)
|
|
37
|
+
- `type`: `'StatPair'` \| `'StatHighlight'` \| `'StatSplit'` \| `'StatComparisonBlock'` \| `'StatSideList'` \| `'StatExtendedPanel'` \| `'StatMixedStack'` \| `'StatOptionBlock'` \| `'StatDetailPair'` \| `'StatInlineGroup'` \| `'StatHeaderSplit'` \| `'StatListStack'` — Layout type.
|
|
38
|
+
- `trend`: `'positive'` \| `'negative'` — Trend direction for the primary badge.
|
|
39
|
+
- `trend2`: `'positive'` \| `'negative'` — Trend direction for the secondary badge.
|
|
40
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction of the card. Unset inherits from the closest `dir` ancestor.
|
|
41
|
+
|
|
42
|
+
## Accessibility
|
|
43
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
44
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
45
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
46
|
+
|
|
47
|
+
## Design tokens used
|
|
48
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
49
|
+
- `var(--ds-color-bg-emphasis-low)`
|
|
50
|
+
- `var(--ds-color-bg-raised)`
|
|
51
|
+
- `var(--ds-color-border-default)`
|
|
52
|
+
- `var(--ds-color-text-danger)`
|
|
53
|
+
- `var(--ds-color-text-default)`
|
|
54
|
+
- `var(--ds-color-text-paragraph)`
|
|
55
|
+
- `var(--ds-color-text-paragraph-muted)`
|
|
56
|
+
- `var(--ds-radius-l)`
|
|
57
|
+
- `var(--ds-radius-m)`
|
|
58
|
+
- `var(--ds-spacing-2xl)`
|
|
59
|
+
- `var(--ds-spacing-3xl)`
|
|
60
|
+
- `var(--ds-spacing-4xl)`
|
|
61
|
+
- `var(--ds-spacing-5xl)`
|
|
62
|
+
- `var(--ds-spacing-6xl)`
|
|
63
|
+
- `var(--ds-spacing-lg)`
|
|
64
|
+
- `var(--ds-spacing-md)`
|
|
65
|
+
- `var(--ds-spacing-xl)`
|
|
66
|
+
|
|
67
|
+
## AI usage guidance
|
|
68
|
+
When generating UI:
|
|
69
|
+
- Install with `npx sdaia-ui@latest add number` (after `npx sdaia-ui@latest init`), then import `{ Number }` from `@/components/ui/Number`.
|
|
70
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
71
|
+
- Use only the documented option values listed under "Options".
|
|
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.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Page Template
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Page Template
|
|
5
|
+
- Slug: `page-template`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add page-template`
|
|
8
|
+
- Import: `import { PageTemplate } from '@/components/ui/PageTemplate'`
|
|
9
|
+
- Installed files: `PageTemplate.tsx`, `PageTemplate.types.ts`, `PageTemplate.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/page-template
|
|
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 page-template`. It copies the source into your components folder (`components/ui/PageTemplate/`, under `src/` when the project has one); import it as `@/components/ui/PageTemplate`. 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?` | `'list' \| 'detail' \| 'form' \| 'settings' \| 'dashboard' \| 'sign-in' \| 'error-403' \| 'error-404' \| 'error-500'` | 'list' | Figma `Type`. |
|
|
18
|
+
| `shell?` | `PageTemplateShellProps` | — | Renders the page inside an `AppShell` with these props (header, side navigation…). Omit when the page already sits in an App Shell, e.g. one placed in a shared layout. Ignored by `sign-in`. The Figma error templates use the shell without `sideNavigation`. |
|
|
19
|
+
| `title` | `ReactNode` | — | Page title, rendered as the page's `<h1>` (sign-in card heading, error title). |
|
|
20
|
+
| `description?` | `ReactNode` | — | Supporting text under the title: the sign-in subtitle, the error explanation, or an optional intro line on app pages. |
|
|
21
|
+
| `breadcrumb?` | `ReactNode` | — | App pages: breadcrumb above the title, typically a `<Breadcrumb />`. |
|
|
22
|
+
| `status?` | `ReactNode` | — | App pages: element next to the title, e.g. a status `<Badge />` (Detail). |
|
|
23
|
+
| `actions?` | `ReactNode` | — | App pages: page-level buttons at the end of the title row. Error pages: recovery buttons under the description. |
|
|
24
|
+
| `aside?` | `ReactNode` | — | App pages: secondary column (360 px) beside the content once the page is 960 px wide, stacked under it below (e.g. the Detail template's side cards). The page width is measured with a container query (`@container/page-template`), so it also works in a narrow box. |
|
|
25
|
+
| `logo?` | `ReactNode` | — | Sign-in: logo at the top of the card, typically `<NavLogoPlaceholder />`. |
|
|
26
|
+
| `code?` | `ReactNode` | — | Error pages: the status code. Defaults to the code of the `type` (`403`, `404`, `500`). |
|
|
27
|
+
| `footer?` | `ReactNode` | — | Sign-in: line at the bottom of the card (e.g. a help link). Error pages: small print under the actions (e.g. the error reference). |
|
|
28
|
+
| `children?` | `ReactNode` | — | App pages: the page content under the header (or beside `aside`). Sign-in: the form inside the card. Error pages: extra content under the message. |
|
|
29
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Layout direction. Omit to inherit the ambient direction. |
|
|
30
|
+
|
|
31
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `title`, `dir`, `children`.
|
|
32
|
+
|
|
33
|
+
## Options (allowed values)
|
|
34
|
+
- `type`: `'list'` \| `'detail'` \| `'form'` \| `'settings'` \| `'dashboard'` \| `'sign-in'` \| `'error-403'` \| `'error-404'` \| `'error-500'` — Figma `Type` — which starting-point template the page follows.
|
|
35
|
+
|
|
36
|
+
The type picks the page frame:
|
|
37
|
+
- `list` · `detail` · `form` · `settings` · `dashboard` → app page: page
|
|
38
|
+
header (breadcrumb, title, status, actions) above the page content,
|
|
39
|
+
inside the App Shell. These five share the frame; they differ in the
|
|
40
|
+
content you compose (table, cards, form sections, metrics…).
|
|
41
|
+
- `sign-in` → a centred card on the canvas, without the App Shell.
|
|
42
|
+
- `error-403` · `error-404` · `error-500` → a centred status message
|
|
43
|
+
(code, title, description, recovery actions, reference).
|
|
44
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction. Omit to inherit the ambient direction.
|
|
45
|
+
|
|
46
|
+
## Accessibility
|
|
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-canvas)`
|
|
53
|
+
- `var(--ds-color-bg-raised)`
|
|
54
|
+
- `var(--ds-color-border-default)`
|
|
55
|
+
- `var(--ds-color-text-brand)`
|
|
56
|
+
- `var(--ds-color-text-default)`
|
|
57
|
+
- `var(--ds-color-text-display)`
|
|
58
|
+
- `var(--ds-color-text-paragraph)`
|
|
59
|
+
- `var(--ds-color-text-paragraph-muted)`
|
|
60
|
+
- `var(--ds-radius-l)`
|
|
61
|
+
- `var(--ds-spacing-2xl)`
|
|
62
|
+
- `var(--ds-spacing-3xl)`
|
|
63
|
+
- `var(--ds-spacing-4xl)`
|
|
64
|
+
- `var(--ds-spacing-lg)`
|
|
65
|
+
- `var(--ds-spacing-md)`
|
|
66
|
+
- `var(--ds-spacing-xl)`
|
|
67
|
+
- `var(--ds-spacing-xs)`
|
|
68
|
+
- `var(--ds-text-leading-line-heights-display-2xl)`
|
|
69
|
+
- `var(--ds-text-leading-line-heights-display-sm)`
|
|
70
|
+
- `var(--ds-text-leading-line-heights-display-xs)`
|
|
71
|
+
- `var(--ds-text-leading-line-heights-text-md)`
|
|
72
|
+
- `var(--ds-text-leading-line-heights-text-sm)`
|
|
73
|
+
- `var(--ds-text-leading-line-heights-text-xs)`
|
|
74
|
+
|
|
75
|
+
## AI usage guidance
|
|
76
|
+
When generating UI:
|
|
77
|
+
- Install with `npx sdaia-ui@latest add page-template` (after `npx sdaia-ui@latest init`), then import `{ PageTemplate }` from `@/components/ui/PageTemplate`.
|
|
78
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
79
|
+
- Use only the documented option values listed under "Options".
|
|
80
|
+
- Pick one theme per screen: dark is `.theme-dark` (or `.dark`) on `<html>`; style surrounding layout with DS tokens (`get_tokens`), never hardcoded colors.
|