@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,90 @@
|
|
|
1
|
+
# Dropdown
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Dropdown
|
|
5
|
+
- Slug: `dropdown`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add dropdown`
|
|
8
|
+
- Import: `import { Dropdown } from '@/components/ui/Dropdown'`
|
|
9
|
+
- Installed files: `Dropdown.tsx`, `Dropdown.types.ts`, `Dropdown.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/dropdown
|
|
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 dropdown`. It copies the source into your components folder (`components/ui/Dropdown/`, under `src/` when the project has one); import it as `@/components/ui/Dropdown`. 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 — set to 'rtl' for Arabic. Passed to the root element; inherits from the page when omitted. |
|
|
18
|
+
| `labels?` | `Partial<DropdownLabels>` | — | Override the built-in accessible strings (English defaults). |
|
|
19
|
+
| `type?` | `'button' \| 'icon' \| 'avatar'` | 'button' | Determines which trigger element is rendered. |
|
|
20
|
+
| `surface?` | `'solid' \| 'glass'` | 'solid' | Surface treatment of the panel — `'solid'` (default) or `'glass'` (translucent liquid-glass material). |
|
|
21
|
+
| `alignment?` | `'start' \| 'center' \| 'end'` | 'end' | Panel alignment relative to the trigger. |
|
|
22
|
+
| `placement?` | `'top' \| 'bottom'` | 'bottom' | Whether the panel opens above or below the trigger. |
|
|
23
|
+
| `label?` | `string` | — | Label for the button trigger. Used when type="button". Nothing is rendered when omitted. |
|
|
24
|
+
| `variant?` | `ButtonMenuVariant` | 'primary' | Visual variant for the ButtonMenu trigger. Defaults to 'primary'. |
|
|
25
|
+
| `size?` | `ButtonMenuSize` | 'md' | Size of the ButtonMenu trigger. Defaults to 'md'. |
|
|
26
|
+
| `avatarSrc?` | `string` | — | URL of the avatar image. Used when type="avatar". |
|
|
27
|
+
| `avatarAlt?` | `string` | — | Alt text for the avatar image. |
|
|
28
|
+
| `header?` | `DropdownListHeaderProps` | — | Props forwarded to the DropdownListHeader at the top of the panel. |
|
|
29
|
+
| `items?` | `DropdownItem[]` | [] | Rows rendered in the panel body as ContextMenuDropdown entries. |
|
|
30
|
+
| `disabled?` | `boolean` | false | Whether the panel is disabled. Prevents opening. |
|
|
31
|
+
| `open?` | `boolean` | — | Controlled open state. When provided, the component is fully controlled — pair with `onOpenChange`. |
|
|
32
|
+
| `defaultOpen?` | `boolean` | false | Initial open state for uncontrolled usage. Ignored when `open` is provided. |
|
|
33
|
+
| `onOpenChange?` | `(open: boolean) => void` | — | Called when the open state changes (trigger click or outside click). Required for controlled usage. |
|
|
34
|
+
| `className?` | `string` | — | Additional class names on the root wrapper |
|
|
35
|
+
|
|
36
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `children`.
|
|
37
|
+
|
|
38
|
+
## Options (allowed values)
|
|
39
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction — set to 'rtl' for Arabic. Passed to the root element; inherits from the page when omitted.
|
|
40
|
+
- `type`: `'button'` \| `'icon'` \| `'avatar'` — Trigger type — maps Figma "Type" property:
|
|
41
|
+
Button → ButtonMenu trigger (label + chevron)
|
|
42
|
+
Icon → more-vertical (⋮) icon-only trigger
|
|
43
|
+
Avatar → circular avatar image trigger
|
|
44
|
+
- `surface`: `'solid'` \| `'glass'` — Surface treatment of the dropdown panel.
|
|
45
|
+
- `'solid'` (default) — opaque raised surface with the standard drop shadow.
|
|
46
|
+
- `'glass'` — translucent liquid-glass material (blurred backdrop +
|
|
47
|
+
beveled edge highlight). Reads best placed over imagery or color.
|
|
48
|
+
|
|
49
|
+
The visual is provided by the shared `.glass-surface` utility, so it is
|
|
50
|
+
theme-aware (light / dark) and identical across every component that
|
|
51
|
+
exposes a `surface` prop.
|
|
52
|
+
- `alignment`: `'start'` \| `'center'` \| `'end'` — Panel alignment relative to the trigger — maps Figma "Alignment" property.
|
|
53
|
+
start → panel aligns to the inline-start edge of the trigger
|
|
54
|
+
center → panel centered below the trigger
|
|
55
|
+
end → panel aligns to the inline-end edge of the trigger
|
|
56
|
+
- `placement`: `'top'` \| `'bottom'` — Whether the panel opens above or below the trigger.
|
|
57
|
+
|
|
58
|
+
## Deprecated props
|
|
59
|
+
Do not use in new code:
|
|
60
|
+
- `rtl`
|
|
61
|
+
|
|
62
|
+
## Accessibility
|
|
63
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
64
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
65
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
66
|
+
|
|
67
|
+
## Design tokens used
|
|
68
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
69
|
+
- `var(--ds-color-)`
|
|
70
|
+
- `var(--ds-color-bg-default)`
|
|
71
|
+
- `var(--ds-color-bg-raised)`
|
|
72
|
+
- `var(--ds-color-border-brand)`
|
|
73
|
+
- `var(--ds-color-border-muted)`
|
|
74
|
+
- `var(--ds-color-form-option-bg-hover)`
|
|
75
|
+
- `var(--ds-color-form-option-bg-pressed)`
|
|
76
|
+
- `var(--ds-color-icon-default-500)`
|
|
77
|
+
- `var(--ds-color-icon-default-disabled)`
|
|
78
|
+
- `var(--ds-motion-feedback-duration)`
|
|
79
|
+
- `var(--ds-motion-feedback-easing)`
|
|
80
|
+
- `var(--ds-radius-full)`
|
|
81
|
+
- `var(--ds-radius-m)`
|
|
82
|
+
- `var(--ds-radius-xs)`
|
|
83
|
+
|
|
84
|
+
## AI usage guidance
|
|
85
|
+
When generating UI:
|
|
86
|
+
- Install with `npx sdaia-ui@latest add dropdown` (after `npx sdaia-ui@latest init`), then import `{ Dropdown }` from `@/components/ui/Dropdown`.
|
|
87
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
88
|
+
- Use only the documented option values listed under "Options".
|
|
89
|
+
- Express the disabled state with the `disabled` prop, not custom styling.
|
|
90
|
+
- 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,60 @@
|
|
|
1
|
+
# Empty State
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Empty State
|
|
5
|
+
- Slug: `empty-state`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add empty-state`
|
|
8
|
+
- Import: `import { EmptyState } from '@/components/ui/EmptyState'`
|
|
9
|
+
- Installed files: `EmptyState.tsx`, `EmptyState.types.ts`, `EmptyState.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/empty-state
|
|
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 empty-state`. It copies the source into your components folder (`components/ui/EmptyState/`, under `src/` when the project has one); import it as `@/components/ui/EmptyState`. 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?` | `'no-data' \| 'no-connection' \| 'error' \| 'no-notifications' \| 'connection-lost' \| 'page-not-found'` | 'no-data' | Content/layout preset from Figma (State Types). |
|
|
18
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction. Inherits from the document when omitted. |
|
|
19
|
+
| `labels?` | `Partial<EmptyStateLabels>` | — | Override built-in strings (English defaults) to localize the empty state. |
|
|
20
|
+
| `illustration?` | `ReactNode` | — | Illustration element. When omitted, no illustration slot is rendered. |
|
|
21
|
+
| `heading?` | `boolean` | true | Shows the heading/title area. |
|
|
22
|
+
| `helperText?` | `boolean` | true | Shows the supporting/helper text. |
|
|
23
|
+
| `button?` | `boolean` | true | Shows the call-to-action button. |
|
|
24
|
+
| `headingContent?` | `ReactNode` | — | Heading content. Nothing is rendered when omitted (no sample copy ships as a default). |
|
|
25
|
+
| `helperTextContent?` | `ReactNode` | — | Supporting text content. Nothing is rendered when omitted. |
|
|
26
|
+
| `buttonLabel?` | `string` | — | Button label. The built-in button renders only when a label is provided. |
|
|
27
|
+
| `onButtonClick?` | `() => void` | — | Click handler for the built-in button. |
|
|
28
|
+
|
|
29
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `dir`.
|
|
30
|
+
|
|
31
|
+
## Options (allowed values)
|
|
32
|
+
- `type`: `'no-data'` \| `'no-connection'` \| `'error'` \| `'no-notifications'` \| `'connection-lost'` \| `'page-not-found'` — Content/layout preset from Figma (State Types).
|
|
33
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction. Inherits from the document when omitted.
|
|
34
|
+
|
|
35
|
+
## Deprecated props
|
|
36
|
+
Do not use in new code:
|
|
37
|
+
- `rtl`
|
|
38
|
+
|
|
39
|
+
## Accessibility
|
|
40
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
41
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
42
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
43
|
+
|
|
44
|
+
## Design tokens used
|
|
45
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
46
|
+
- `var(--ds-color-text-display)`
|
|
47
|
+
- `var(--ds-color-text-paragraph)`
|
|
48
|
+
- `var(--ds-spacing-2xl)`
|
|
49
|
+
- `var(--ds-spacing-3xl)`
|
|
50
|
+
- `var(--ds-spacing-5xl)`
|
|
51
|
+
- `var(--ds-spacing-lg)`
|
|
52
|
+
- `var(--ds-spacing-md)`
|
|
53
|
+
- `var(--ds-spacing-xl)`
|
|
54
|
+
|
|
55
|
+
## AI usage guidance
|
|
56
|
+
When generating UI:
|
|
57
|
+
- Install with `npx sdaia-ui@latest add empty-state` (after `npx sdaia-ui@latest init`), then import `{ EmptyState }` from `@/components/ui/EmptyState`.
|
|
58
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
59
|
+
- Use only the documented option values listed under "Options".
|
|
60
|
+
- 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,85 @@
|
|
|
1
|
+
# Filtration
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Filtration
|
|
5
|
+
- Slug: `filtration`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add filtration`
|
|
8
|
+
- Import: `import { Filtration } from '@/components/ui/Filtration'`
|
|
9
|
+
- Installed files: `Filtration.tsx`, `Filtration.types.ts`, `Filtration.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/filtration
|
|
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 filtration`. It copies the source into your components folder (`components/ui/Filtration/`, under `src/` when the project has one); import it as `@/components/ui/Filtration`. 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
|
+
| `triggerType?` | `'button' \| 'icon'` | 'button' | Controls the shape of the trigger: `'button'` (default) — black pill with filter icon, label, and chevron. `'icon'` — bare 24×24 filter icon with no background. |
|
|
18
|
+
| `triggerLabel?` | `string` | "Filter" | Label shown inside the button trigger (accessible name of the icon trigger and of the panel). Wins over `labels.trigger`. |
|
|
19
|
+
| `activeFilters?` | `FiltrationActiveFilter[]` | [] | Array of active filters currently applied. When non-empty, a row of dismissible green solid Chips is rendered between the trigger and the panel. |
|
|
20
|
+
| `onRemoveFilter?` | `(id: string) => void` | — | Called when the user presses × on an active-filter chip. Receives the `id` of the chip that was dismissed. |
|
|
21
|
+
| `removeFilterLabel?` | `(label: string) => string` | (label) => `Remove ${label}` | Accessible name of each chip's remove (×) control. Localise here, e.g. `(label) => \`إزالة ${label}\``. Wins over `labels.removeFilter`. |
|
|
22
|
+
| `sections?` | `FiltrationSectionConfig[]` | [] | Ordered array of filter sections rendered inside the FiltrationList panel. Supports all nine section types: search, checkbox, select, radio, chip, range, amount, date, custom. |
|
|
23
|
+
| `applyLabel?` | `string` | "Apply Filters" | Label for the primary "Apply" button. Wins over `labels.apply`. |
|
|
24
|
+
| `clearLabel?` | `string` | "Clear" | Label for the secondary "Clear" button. Wins over `labels.clear`. |
|
|
25
|
+
| `activeFilterCount?` | `number` | — | Number shown in parentheses next to the apply label, e.g. "Apply Filters (3)" (format via `labels.applyWithCount`). Falls back to `activeFilters.length` when omitted. |
|
|
26
|
+
| `onApply?` | `() => void` | — | Called when the user presses the Apply button inside the panel. |
|
|
27
|
+
| `onClear?` | `() => void` | — | Called when the user presses the Clear button inside the panel. |
|
|
28
|
+
| `showActions?` | `boolean` | true | When `false`, hides the Apply / Clear footer inside the FiltrationList. Defaults to `true`. |
|
|
29
|
+
| `open?` | `boolean` | — | Controlled open state. When provided, the consumer drives open/close. Combine with `onOpenChange` to handle toggle events. |
|
|
30
|
+
| `defaultOpen?` | `boolean` | false | Uncontrolled initial open state. Defaults to `false`. Ignored when `open` is provided. |
|
|
31
|
+
| `onOpenChange?` | `(open: boolean) => void` | — | Called whenever the panel open state changes. |
|
|
32
|
+
| `labels?` | `Partial<FiltrationLabels>` | — | Localised built-in strings (trigger, panel and chip strings). |
|
|
33
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Layout direction of the trigger, chips and panel. Omit to inherit: the portaled panel then copies the trigger's computed direction when it opens. |
|
|
34
|
+
| `className?` | `string` | — | Extra class names forwarded to the root element. |
|
|
35
|
+
| `children?` | `ReactNode` | — | Custom content to render inside the panel below the filter sections. |
|
|
36
|
+
|
|
37
|
+
## Options (allowed values)
|
|
38
|
+
- `triggerType`: `'button'` \| `'icon'` — Visual style of the trigger button
|
|
39
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction of the trigger, chips and panel. Omit to inherit:
|
|
40
|
+
the portaled panel then copies the trigger's computed direction when it opens.
|
|
41
|
+
|
|
42
|
+
## Deprecated props
|
|
43
|
+
Do not use in new code:
|
|
44
|
+
- `rtl` — Enables RTL layout by setting `dir="rtl"` on the root element.
|
|
45
|
+
|
|
46
|
+
## Accessibility
|
|
47
|
+
Built in (SDAIA review item A7) — verified by `axe scan (nested-interactive) — audit-reports/a11y` in the design system's test suite:
|
|
48
|
+
- Chips contain no nested interactive controls (no button inside a button).
|
|
49
|
+
|
|
50
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
51
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
52
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
53
|
+
|
|
54
|
+
## Design tokens used
|
|
55
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
56
|
+
- `var(--ds-color-bg-default)`
|
|
57
|
+
- `var(--ds-color-bg-emphasis-high)`
|
|
58
|
+
- `var(--ds-color-bg-emphasis-low)`
|
|
59
|
+
- `var(--ds-color-bg-emphasis-medium)`
|
|
60
|
+
- `var(--ds-color-border-focus)`
|
|
61
|
+
- `var(--ds-color-button-bg-black-default)`
|
|
62
|
+
- `var(--ds-color-button-bg-black-focused)`
|
|
63
|
+
- `var(--ds-color-button-bg-black-hovered)`
|
|
64
|
+
- `var(--ds-color-button-bg-black-pressed)`
|
|
65
|
+
- `var(--ds-color-icon-default)`
|
|
66
|
+
- `var(--ds-color-text-on-color)`
|
|
67
|
+
- `var(--ds-motion-enter-duration)`
|
|
68
|
+
- `var(--ds-motion-enter-easing)`
|
|
69
|
+
- `var(--ds-motion-feedback-duration)`
|
|
70
|
+
- `var(--ds-motion-feedback-easing)`
|
|
71
|
+
- `var(--ds-radius-m)`
|
|
72
|
+
- `var(--ds-radius-xxs)`
|
|
73
|
+
- `var(--ds-spacing-2xl)`
|
|
74
|
+
- `var(--ds-spacing-lg)`
|
|
75
|
+
- `var(--ds-spacing-md)`
|
|
76
|
+
- `var(--ds-spacing-xl)`
|
|
77
|
+
- `var(--ds-spacing-xs)`
|
|
78
|
+
|
|
79
|
+
## AI usage guidance
|
|
80
|
+
When generating UI:
|
|
81
|
+
- Install with `npx sdaia-ui@latest add filtration` (after `npx sdaia-ui@latest init`), then import `{ Filtration }` from `@/components/ui/Filtration`.
|
|
82
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
83
|
+
- Use only the documented option values listed under "Options".
|
|
84
|
+
- 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).
|
|
85
|
+
- 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,59 @@
|
|
|
1
|
+
# Footer
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Footer
|
|
5
|
+
- Slug: `footer`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add footer`
|
|
8
|
+
- Import: `import { Footer } from '@/components/ui/Footer'`
|
|
9
|
+
- Installed files: `Footer.tsx`, `Footer.types.ts`, `Footer.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/footer
|
|
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 footer`. It copies the source into your components folder (`components/ui/Footer/`, under `src/` when the project has one); import it as `@/components/ui/Footer`. 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
|
+
| `labels?` | `Partial<FooterLabels>` | — | Translatable built-in strings, shared with every `Footer.*` part inside. |
|
|
18
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Direction — applied to the root and drives RTL layout. |
|
|
19
|
+
| `compact?` | `boolean` | false | Compact vertical spacing. When `true` the root uses the "Small" footer padding from Figma (shorter `py`, same `px`). Use for minimal footers that do not include link columns or a newsletter block. |
|
|
20
|
+
| `children?` | `ReactNode` | — | — |
|
|
21
|
+
|
|
22
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …).
|
|
23
|
+
|
|
24
|
+
## Options (allowed values)
|
|
25
|
+
- `dir`: `'ltr'` \| `'rtl'` — Direction — applied to the root and drives RTL layout.
|
|
26
|
+
|
|
27
|
+
## Deprecated props
|
|
28
|
+
Do not use in new code:
|
|
29
|
+
- `rtl`
|
|
30
|
+
|
|
31
|
+
## Accessibility
|
|
32
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
33
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
34
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
35
|
+
|
|
36
|
+
## Design tokens used
|
|
37
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
38
|
+
- `var(--ds-color-)`
|
|
39
|
+
- `var(--ds-color-bg-overlay)`
|
|
40
|
+
- `var(--ds-color-text-default)`
|
|
41
|
+
- `var(--ds-color-text-paragraph)`
|
|
42
|
+
- `var(--ds-spacing-3xl)`
|
|
43
|
+
- `var(--ds-spacing-4xl)`
|
|
44
|
+
- `var(--ds-spacing-5xl)`
|
|
45
|
+
- `var(--ds-spacing-6xl)`
|
|
46
|
+
- `var(--ds-spacing-7xl)`
|
|
47
|
+
- `var(--ds-spacing-lg)`
|
|
48
|
+
- `var(--ds-spacing-md)`
|
|
49
|
+
- `var(--ds-spacing-xl)`
|
|
50
|
+
- `var(--ds-spacing-xxs)`
|
|
51
|
+
- `var(--ds-text-leading-line-heights-text-md)`
|
|
52
|
+
- `var(--ds-text-leading-line-heights-text-sm)`
|
|
53
|
+
|
|
54
|
+
## AI usage guidance
|
|
55
|
+
When generating UI:
|
|
56
|
+
- Install with `npx sdaia-ui@latest add footer` (after `npx sdaia-ui@latest init`), then import `{ Footer }` from `@/components/ui/Footer`.
|
|
57
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
58
|
+
- Use only the documented option values listed under "Options".
|
|
59
|
+
- 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,95 @@
|
|
|
1
|
+
# Line Chart
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Line Chart
|
|
5
|
+
- Slug: `line-chart`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add line-chart`
|
|
8
|
+
- Import: `import { LineChart } from '@/components/ui/LineChart'`
|
|
9
|
+
- Installed files: `LineChart.tsx`, `LineChart.types.ts`, `LineChart.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/line-chart
|
|
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 line-chart`. It copies the source into your components folder (`components/ui/LineChart/`, under `src/` when the project has one); import it as `@/components/ui/LineChart`. 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?` | `'Insight' \| 'Comparison' \| 'Score' \| 'Forecast'` | 'Insight' | Chart variant. - Insight — single line with a highlighted data point - Comparison — two series lines for comparing datasets - Score — single line with a goal reference line - Forecast — solid past line + dashed future projection |
|
|
18
|
+
| `xAxisData?` | `XAxisDataType` | '7 Week Days' | X-axis label preset. |
|
|
19
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction. In `'rtl'` the chart mirrors: time runs right-to-left (the first category is on the right) and the Y-axis sits on the right. Inherited from the document when omitted. |
|
|
20
|
+
| `locale?` | `string` | — | BCP 47 locale for the x-axis day / month names (Gregorian, via `Intl`) and for number formatting in the tooltip, Y-axis and data table, e.g. `'ar-SA'`. English names and plain numbers when omitted. |
|
|
21
|
+
| `labels?` | `Partial<LineChartLabels>` | — | Overrides for the built-in strings (see `LineChartLabels`). |
|
|
22
|
+
| `title?` | `string` | — | Optional chart title rendered above the legend. |
|
|
23
|
+
| `height?` | `number` | — | Total chart height in px (including legend + x-axis). Defaults to a preset based on xAxisData. |
|
|
24
|
+
| `graphStyle?` | `'noisy' \| 'smooth' \| 'elastic'` | 'smooth' | Line interpolation style — matches Figma _Graph Base style variants. |
|
|
25
|
+
| `showLegend?` | `boolean` | true | When false, no legend row is rendered. |
|
|
26
|
+
| `legendPosition?` | `'bottom-center' \| 'bottom-left' \| 'bottom-right' \| 'top-center' \| 'top-left' \| 'top-right'` | 'bottom-center' | Where to place the legend (horizontal line swatch + label per series). |
|
|
27
|
+
| `showYAxis?` | `boolean` | true | When false, the Y-axis labels are hidden. |
|
|
28
|
+
| `showXAxis?` | `boolean` | true | When false, the X-axis labels are hidden. |
|
|
29
|
+
| `showGridLines?` | `boolean` | true | When false, horizontal grid lines are hidden. |
|
|
30
|
+
| `showHoverIndicator?` | `boolean` | true | When false, hover crosshair, dots, and tooltip are disabled. |
|
|
31
|
+
| `showAreaFill?` | `boolean` | true | When false, hides area/gradient fills under the line (Insight, Forecast regions). Lines remain visible. Useful for compact sparkline-style previews. |
|
|
32
|
+
| `series1Color?` | `string` | 'var(--ds-color-chart-series-1)' | Stroke/fill color for series 1. SVG `stroke` is set inline — parent CSS cannot override. |
|
|
33
|
+
| `series2Color?` | `string` | 'var(--ds-color-chart-series-2)' | Stroke color for series 2 (Comparison). Drawn before series 1 in the SVG. |
|
|
34
|
+
| `series1?` | `number[]` | — | Primary line values — required by `type="Insight"`, `"Comparison"` (drawn in `series1Color`) and `"Score"`. Length should match the X-axis preset (e.g. 7 for `'7 Week Days'`). |
|
|
35
|
+
| `series2?` | `number[]` | — | Secondary line values for `type="Comparison"` (drawn in `series2Color`). |
|
|
36
|
+
| `goal?` | `number` | — | Goal reference value for `type="Score"`. Rendered as a dashed horizontal line. |
|
|
37
|
+
| `past?` | `number[]` | — | Historic portion of the series for `type="Forecast"` — drawn solid (required for that type). The last value also anchors the start of `future` (one-point overlap). |
|
|
38
|
+
| `future?` | `number[]` | — | Projected portion for `type="Forecast"` — drawn dashed. First value should equal the last value of `past` so the two segments meet. |
|
|
39
|
+
| `splitIndex?` | `number` | — | Index in the full timeline where `past` ends and `future` begins. Defaults to `past.length - 1`. |
|
|
40
|
+
| `series1Label?` | `string` | labels.seriesName(0) — 'Series 1' | Name of the line drawn in `series1Color` (legend + data table). Applies to Insight, Comparison, Score, and Forecast. |
|
|
41
|
+
| `series2Label?` | `string` | labels.seriesName(1) — 'Series 2' | Name of the second line (Comparison only). |
|
|
42
|
+
| `goalLabel?` | `string` | labels.goal — 'Goal' | Name of the goal line (Score only). |
|
|
43
|
+
| `forecastLabel?` | `string` | labels.forecast — 'Forecast' | Name of the projection (Forecast only). |
|
|
44
|
+
|
|
45
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …).
|
|
46
|
+
|
|
47
|
+
## Options (allowed values)
|
|
48
|
+
- `type`: `'Insight'` \| `'Comparison'` \| `'Score'` \| `'Forecast'` — Chart variant.
|
|
49
|
+
- Insight — single line with a highlighted data point
|
|
50
|
+
- Comparison — two series lines for comparing datasets
|
|
51
|
+
- Score — single line with a goal reference line
|
|
52
|
+
- Forecast — solid past line + dashed future projection
|
|
53
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction. In `'rtl'` the chart mirrors: time runs right-to-left
|
|
54
|
+
(the first category is on the right) and the Y-axis sits on the right.
|
|
55
|
+
Inherited from the document when omitted.
|
|
56
|
+
- `graphStyle`: `'noisy'` \| `'smooth'` \| `'elastic'` — Controls line interpolation style — matches Figma _Graph Base style variants.
|
|
57
|
+
- noisy → straight line segments (angular, thorny)
|
|
58
|
+
- smooth → gentle Catmull-Rom curves
|
|
59
|
+
- elastic → more pronounced, bouncy curves
|
|
60
|
+
- `legendPosition`: `'bottom-center'` \| `'bottom-left'` \| `'bottom-right'` \| `'top-center'` \| `'top-left'` \| `'top-right'` — Legend row placement relative to the chart.
|
|
61
|
+
- `bottom-*` — below the X-axis (default).
|
|
62
|
+
- `top-*` — below the optional title, above the plot.
|
|
63
|
+
|
|
64
|
+
## Deprecated props
|
|
65
|
+
Do not use in new code:
|
|
66
|
+
- `rtl` — Render in right-to-left orientation.
|
|
67
|
+
|
|
68
|
+
## Accessibility
|
|
69
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
70
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
71
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
72
|
+
|
|
73
|
+
## Design tokens used
|
|
74
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
75
|
+
- `var(--ds-color-bg-raised)`
|
|
76
|
+
- `var(--ds-color-border-default)`
|
|
77
|
+
- `var(--ds-color-border-default-strong)`
|
|
78
|
+
- `var(--ds-color-chart-series-1)`
|
|
79
|
+
- `var(--ds-color-chart-series-2)`
|
|
80
|
+
- `var(--ds-color-chart-series-3)`
|
|
81
|
+
- `var(--ds-color-text-default)`
|
|
82
|
+
- `var(--ds-color-text-paragraph)`
|
|
83
|
+
- `var(--ds-radius-m)`
|
|
84
|
+
- `var(--ds-spacing-2xl)`
|
|
85
|
+
- `var(--ds-spacing-lg)`
|
|
86
|
+
- `var(--ds-spacing-md)`
|
|
87
|
+
- `var(--ds-spacing-sm)`
|
|
88
|
+
- `var(--ds-spacing-xs)`
|
|
89
|
+
|
|
90
|
+
## AI usage guidance
|
|
91
|
+
When generating UI:
|
|
92
|
+
- Install with `npx sdaia-ui@latest add line-chart` (after `npx sdaia-ui@latest init`), then import `{ LineChart }` from `@/components/ui/LineChart`.
|
|
93
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
94
|
+
- Use only the documented option values listed under "Options".
|
|
95
|
+
- 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,91 @@
|
|
|
1
|
+
# List
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: List
|
|
5
|
+
- Slug: `list`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add list`
|
|
8
|
+
- Import: `import { List } from '@/components/ui/List'`
|
|
9
|
+
- Installed files: `List.tsx`, `List.types.ts`, `List.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/list
|
|
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 list`. It copies the source into your components folder (`components/ui/List/`, under `src/` when the project has one); import it as `@/components/ui/List`. 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
|
+
A single list row. Every content slot renders only when its content prop is
|
|
16
|
+
provided — the boolean toggles (`textLead`, `tag`, `button`, …) only decide
|
|
17
|
+
whether provided content is shown; nothing is rendered as sample copy.
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
| Prop | Type | Default | Description |
|
|
21
|
+
| --- | --- | --- | --- |
|
|
22
|
+
| `size?` | `'small' \| 'medium' \| 'large'` | "small" | Figma variant: row size. |
|
|
23
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Text direction. Inherits from the document when omitted. |
|
|
24
|
+
| `textLead?` | `boolean` | true | Figma toggle: show primary text (`leadText`) in the lead section. |
|
|
25
|
+
| `descriptionLead?` | `boolean` | false | Figma toggle: show description text (`leadDescriptionText`) in the lead section. |
|
|
26
|
+
| `secondTextLead?` | `boolean` | false | Figma toggle: show second text (`leadSecondText`) in the lead section. |
|
|
27
|
+
| `textTrailing?` | `boolean` | true | Figma toggle: show primary trailing text (`trailingText`). |
|
|
28
|
+
| `descriptionTrailing?` | `boolean` | false | Figma toggle: show trailing description text (`trailingDescriptionText`). |
|
|
29
|
+
| `secondTextTrailing?` | `boolean` | false | Figma toggle: show second trailing text (`trailingSecondText`). |
|
|
30
|
+
| `leadingIcon?` | `boolean` | true | Figma toggle: show the leading icon (`iconNode`). |
|
|
31
|
+
| `checkbox?` | `boolean` | false | Figma toggle: show checkbox. |
|
|
32
|
+
| `avatar?` | `boolean` | false | Figma toggle: show the avatar (`avatarNode`). |
|
|
33
|
+
| `trailingIcon?` | `boolean` | true | Figma toggle: show the trailing icon (`iconNode`). |
|
|
34
|
+
| `tag?` | `boolean` | false | Figma toggle: show the trailing tag (`tagLabel`). |
|
|
35
|
+
| `button?` | `boolean` | false | Figma toggle: show the trailing button (`buttonLabel`). |
|
|
36
|
+
| `iconNode?` | `ReactNode` | — | Icon for the leading / trailing icon slots. Those slots render only when it is provided. |
|
|
37
|
+
| `avatarNode?` | `ReactNode` | — | Avatar content (e.g. an `<Avatar>`). The avatar slot renders only when it is provided. |
|
|
38
|
+
| `tagLabel?` | `ReactNode` | — | Tag label. The tag renders only when it is provided. |
|
|
39
|
+
| `buttonLabel?` | `ReactNode` | — | Button label. The button renders only when it is provided. |
|
|
40
|
+
| `leadText?` | `ReactNode` | — | Lead main text. |
|
|
41
|
+
| `leadSecondText?` | `ReactNode` | — | Lead second text. |
|
|
42
|
+
| `leadDescriptionText?` | `ReactNode` | — | Lead description. |
|
|
43
|
+
| `trailingText?` | `ReactNode` | — | Trailing main text. |
|
|
44
|
+
| `trailingSecondText?` | `ReactNode` | — | Trailing second text. |
|
|
45
|
+
| `trailingDescriptionText?` | `ReactNode` | — | Trailing description. |
|
|
46
|
+
| `divider?` | `boolean` | false | Figma toggle: show divider line at bottom. |
|
|
47
|
+
| `background?` | `boolean` | false | Figma toggle: show the default surface background. |
|
|
48
|
+
|
|
49
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …) — except: `children`, `dir`.
|
|
50
|
+
|
|
51
|
+
## Options (allowed values)
|
|
52
|
+
- `size`: `'small'` \| `'medium'` \| `'large'` — Visual size from the Figma component variants.
|
|
53
|
+
- `dir`: `'ltr'` \| `'rtl'` — Text direction. Inherits from the document when omitted.
|
|
54
|
+
|
|
55
|
+
## Deprecated props
|
|
56
|
+
Do not use in new code:
|
|
57
|
+
- `rtl`
|
|
58
|
+
- `seondTextTrailing`
|
|
59
|
+
|
|
60
|
+
## Accessibility
|
|
61
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
62
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
63
|
+
|
|
64
|
+
## Design tokens used
|
|
65
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
66
|
+
- `var(--ds-color-bg-default)`
|
|
67
|
+
- `var(--ds-color-bg-emphasis-low)`
|
|
68
|
+
- `var(--ds-color-border-default)`
|
|
69
|
+
- `var(--ds-color-border-default-strong)`
|
|
70
|
+
- `var(--ds-color-icon-default-500)`
|
|
71
|
+
- `var(--ds-color-text-default)`
|
|
72
|
+
- `var(--ds-color-text-display)`
|
|
73
|
+
- `var(--ds-color-text-paragraph-muted)`
|
|
74
|
+
- `var(--ds-radius-full)`
|
|
75
|
+
- `var(--ds-radius-m)`
|
|
76
|
+
- `var(--ds-radius-xs)`
|
|
77
|
+
- `var(--ds-radius-xxs)`
|
|
78
|
+
- `var(--ds-spacing-3xl)`
|
|
79
|
+
- `var(--ds-spacing-lg)`
|
|
80
|
+
- `var(--ds-spacing-md)`
|
|
81
|
+
- `var(--ds-spacing-sm)`
|
|
82
|
+
- `var(--ds-spacing-xl)`
|
|
83
|
+
- `var(--ds-spacing-xs)`
|
|
84
|
+
|
|
85
|
+
## AI usage guidance
|
|
86
|
+
When generating UI:
|
|
87
|
+
- Install with `npx sdaia-ui@latest add list` (after `npx sdaia-ui@latest init`), then import `{ List }` from `@/components/ui/List`.
|
|
88
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
89
|
+
- Use only the documented option values listed under "Options".
|
|
90
|
+
- 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).
|
|
91
|
+
- 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,85 @@
|
|
|
1
|
+
# Media Gallery
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Component: Media Gallery
|
|
5
|
+
- Slug: `media-gallery`
|
|
6
|
+
- Category: General
|
|
7
|
+
- Install: `npx sdaia-ui@latest add media-gallery`
|
|
8
|
+
- Import: `import { MediaGallery } from '@/components/ui/MediaGallery'`
|
|
9
|
+
- Installed files: `MediaGallery.tsx`, `MediaGallery.types.ts`, `MediaGallery.variants.ts`, `index.ts`
|
|
10
|
+
- Docs: https://ds.nacew.com/components/media-gallery
|
|
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-gallery`. It copies the source into your components folder (`components/ui/MediaGallery/`, under `src/` when the project has one); import it as `@/components/ui/MediaGallery`. 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
|
+
| `toolbar?` | `boolean` | true | Show the toolbar (search + view toggle + action buttons). Default: true |
|
|
18
|
+
| `searchValue?` | `string` | — | Controlled value for the search input. |
|
|
19
|
+
| `onSearchChange?` | `(value: string) => void` | — | Called when the search input value changes. |
|
|
20
|
+
| `activeView?` | `'list' \| 'grid'` | — | Currently active view mode. Controls which view-toggle button appears selected. Default: 'grid' |
|
|
21
|
+
| `onViewChange?` | `(view: MediaGalleryView) => void` | — | Called when the user clicks a view-toggle button. |
|
|
22
|
+
| `onFilterClick?` | `() => void` | — | Called when the filter button is clicked. Visible on both desktop and mobile/tablet toolbars. |
|
|
23
|
+
| `onDeleteClick?` | `(selectedImages: MediaGalleryImage[]) => void` | — | Called when the delete/trash button is clicked. Receives the images that are selected at the time of the click. Desktop toolbar only. |
|
|
24
|
+
| `onExportClick?` | `(selectedImages: MediaGalleryImage[]) => void` | — | Called when the Export button is clicked. Receives the images that are selected at the time of the click. Desktop toolbar only. |
|
|
25
|
+
| `onAddClick?` | `() => void` | — | Called when the Add button is clicked. Desktop toolbar only. |
|
|
26
|
+
| `onMoreClick?` | `() => void` | — | Called when the mobile/tablet "more" (…) button is clicked. Mobile/tablet toolbar only. |
|
|
27
|
+
| `images?` | `MediaGalleryImage[]` | [] | Array of image items to render in the gallery grid. Responsive grid columns: 2 (mobile) → 3 (tablet) → 5 (desktop). Image size scales accordingly: sm → md → lg. |
|
|
28
|
+
| `pagination?` | `boolean` | true | Show the pagination section. Default: true |
|
|
29
|
+
| `currentPage?` | `number` | 1 | Current page number (1-indexed). Default: 1 |
|
|
30
|
+
| `totalPages?` | `number` | 1 | Total number of pages. Default: 1 |
|
|
31
|
+
| `onPageChange?` | `(page: number) => void` | — | Called when the user navigates to a different page. |
|
|
32
|
+
| `labels?` | `Partial<MediaGalleryLabels>` | — | Translatable built-in text. Unset keys use the English defaults. |
|
|
33
|
+
| `dir?` | `'ltr' \| 'rtl'` | — | Layout direction — set to 'rtl' for Arabic/Hebrew. Inherits from the page when omitted. Applied to the root element and forwarded to Pagination. |
|
|
34
|
+
|
|
35
|
+
Also accepts standard `<div>` HTML attributes (`className`, `style`, `onClick`, `aria-*`, …).
|
|
36
|
+
|
|
37
|
+
## Options (allowed values)
|
|
38
|
+
- `activeView`: `'list'` \| `'grid'` — View mode for the image grid.
|
|
39
|
+
- `dir`: `'ltr'` \| `'rtl'` — Layout direction — set to 'rtl' for Arabic/Hebrew. Inherits from the page
|
|
40
|
+
when omitted. Applied to the root element and forwarded to Pagination.
|
|
41
|
+
|
|
42
|
+
## Deprecated props
|
|
43
|
+
Do not use in new code:
|
|
44
|
+
- `searchPlaceholder` — Placeholder text for the search input.
|
|
45
|
+
- `emptySearchLabel` — Message shown when the search query matches no images.
|
|
46
|
+
- `exportLabel` — Label for the Export button.
|
|
47
|
+
- `addLabel` — Label for the Add button.
|
|
48
|
+
|
|
49
|
+
## Accessibility
|
|
50
|
+
- Built-in strings (button names, announcements) come from `labels`; pass translated strings for Arabic or other languages.
|
|
51
|
+
- Don't remove the focus ring or replace interactive elements with `div`s; keep the control keyboard-operable.
|
|
52
|
+
- For contrast, keyboard patterns and RTL rules, call `get_foundations` (`accessibility`, `rtl`).
|
|
53
|
+
|
|
54
|
+
## Design tokens used
|
|
55
|
+
Keep these consistent (resolve values with `get_tokens`):
|
|
56
|
+
- `var(--ds-color-bg-default)`
|
|
57
|
+
- `var(--ds-color-bg-emphasis-low)`
|
|
58
|
+
- `var(--ds-color-bg-muted)`
|
|
59
|
+
- `var(--ds-color-bg-raised)`
|
|
60
|
+
- `var(--ds-color-border-default)`
|
|
61
|
+
- `var(--ds-color-border-strong)`
|
|
62
|
+
- `var(--ds-color-icon-danger)`
|
|
63
|
+
- `var(--ds-color-icon-default-500)`
|
|
64
|
+
- `var(--ds-color-text-paragraph)`
|
|
65
|
+
- `var(--ds-motion-feedback-duration)`
|
|
66
|
+
- `var(--ds-motion-feedback-easing)`
|
|
67
|
+
- `var(--ds-radius-l)`
|
|
68
|
+
- `var(--ds-radius-m)`
|
|
69
|
+
- `var(--ds-radius-none)`
|
|
70
|
+
- `var(--ds-radius-xxs)`
|
|
71
|
+
- `var(--ds-spacing-2xl)`
|
|
72
|
+
- `var(--ds-spacing-3xl)`
|
|
73
|
+
- `var(--ds-spacing-lg)`
|
|
74
|
+
- `var(--ds-spacing-md)`
|
|
75
|
+
- `var(--ds-spacing-sm)`
|
|
76
|
+
- `var(--ds-spacing-xl)`
|
|
77
|
+
- `var(--ds-spacing-xs)`
|
|
78
|
+
- `var(--ds-text-leading-line-heights-text-sm)`
|
|
79
|
+
|
|
80
|
+
## AI usage guidance
|
|
81
|
+
When generating UI:
|
|
82
|
+
- Install with `npx sdaia-ui@latest add media-gallery` (after `npx sdaia-ui@latest init`), then import `{ MediaGallery }` from `@/components/ui/MediaGallery`.
|
|
83
|
+
- NEVER run `npm install sdaia-ui` and NEVER `import` from the `sdaia-ui` package — it is a source-copying CLI, not a component library.
|
|
84
|
+
- Use only the documented option values listed under "Options".
|
|
85
|
+
- Pick one theme per screen: dark is `.theme-dark` (or `.dark`) on `<html>`; style surrounding layout with DS tokens (`get_tokens`), never hardcoded colors.
|