react-magma-dom 5.3.0-rc.2 → 5.3.1-v5-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/SKILL.md +142 -0
- package/ai/setup-guide.md +44 -0
- package/ai/styling-guide.md +89 -0
- package/package.json +7 -3
package/ai/SKILL.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react-magma
|
|
3
|
+
description: Use when writing or editing React UI in a project that depends on react-magma-dom (Cengage's accessible component library) — finding the right component, its props, theming, inverse surfaces, icons and accessibility.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# React Magma (react-magma-dom 5.3.1-v5-next.0)
|
|
7
|
+
|
|
8
|
+
Accessible React component library. This guide is generated for react-magma-dom 5.3.1-v5-next.0, which requires React ^18.3.1.
|
|
9
|
+
|
|
10
|
+
## How to use this guide
|
|
11
|
+
|
|
12
|
+
1. Find the matching component in the Catalog before creating UI. Use it whenever its API supports the requested behavior.
|
|
13
|
+
2. Read the installed declarations and JSDoc: required/optional props, defaults, accepted values and enums. Inspect implementation when unclear; never guess or force unsupported props with casts or `any`.
|
|
14
|
+
3. Before layout or styling work, read [styling-guide.md](styling-guide.md). Read [setup-guide.md](setup-guide.md) for app setup and theme APIs.
|
|
15
|
+
4. Preserve requested behavior; do not invent required fields, validation or defaults.
|
|
16
|
+
5. Review your diff against the rules below, then run the project's configured type-check. A bundler build may not check TypeScript; report when no type-check is available.
|
|
17
|
+
|
|
18
|
+
## Required design-system rules
|
|
19
|
+
|
|
20
|
+
- Use `Heading` with a semantic `level` instead of raw `h1`–`h6`, and `Paragraph` instead of raw `p` for standalone content; preserve built-in component typography. Use Magma typography variants for other styled text.
|
|
21
|
+
- Use Magma layout and widgets: `Container`, `Flex`, `Grid`, `Spacer`, `Card`, `Table`, `Tabs`, `Pagination`, `EmptyState`, etc. Keep native semantic landmarks; custom replacements require an API gap or an explicit user/project exception. Explain any exception.
|
|
22
|
+
- Read the active `ThemeContext` for spacing, colors, fonts, text sizes, radii, icons and breakpoints. Do not introduce literal design values, external fonts or cosmetic overrides of Magma states.
|
|
23
|
+
- Map intended spacing to the nearest active `spaceScale` value; ties use the smaller value. With default tokens, 5px becomes `spacing02` (4px), not a new 5px rule. Do not bypass tokens with arithmetic. Preserve explicit requirements and accessibility constraints; see [styling-guide.md](styling-guide.md) for structural CSS exceptions.
|
|
24
|
+
|
|
25
|
+
## Library conventions
|
|
26
|
+
|
|
27
|
+
- Omit optional props when the desired value is already the component default. Verify defaults in the installed version's declarations, JSDoc or implementation before omitting them. Set props explicitly when overriding a default; keep required props and explicit values needed to override inherited context.
|
|
28
|
+
- Import from the package root: `import { Button, ButtonColor } from 'react-magma-dom'`.
|
|
29
|
+
- Variants are exported enums (`ButtonColor.secondary`, `ModalSize.large`).
|
|
30
|
+
- Dark backgrounds: `isInverse` prop, or `<InverseContext.Provider value={{ isInverse: true }}>` for a region.
|
|
31
|
+
- Accessibility is built in: form fields take `labelText`, icon-only buttons require `aria-label`, `Heading` takes a semantic `level`.
|
|
32
|
+
- `Hyperlink` takes `to`, not `href`.
|
|
33
|
+
- When an icon is needed, look for it in `react-magma-icons` first and verify its exported name and props in the installed package. Import from `react-magma-icons`; don't draw a replacement or use another icon library unless the project specifically requires it.
|
|
34
|
+
- Charts and file upload ship as separate packages, listed under Add-on packages with their package name. If the package is not installed, propose installing it and ask first. Read its declarations under `node_modules/<package>/dist`. Charts also need `import '@react-magma/charts/dist/charts.css'` once.
|
|
35
|
+
|
|
36
|
+
Theme, i18n, and other package-level APIs: [setup-guide.md](setup-guide.md).
|
|
37
|
+
|
|
38
|
+
## Catalog
|
|
39
|
+
|
|
40
|
+
Format: **Folder** — purpose (search words). Not for: need → better component. Also: related exports. Exports not listed are internal helpers.
|
|
41
|
+
|
|
42
|
+
### Actions
|
|
43
|
+
- **Button** — Performs an action or submits a form (button, cta, submit, primary action). Not for: navigation → Hyperlink; icon only → IconButton; on/off setting → Toggle. Also: ButtonColor, ButtonShape, ButtonSize, ButtonTextTransform, ButtonType, ButtonVariant
|
|
44
|
+
- **IconButton** — Button with an icon, with or without text (icon button, close button, toolbar button). Also: ButtonIconPosition
|
|
45
|
+
- **AIButton** — Animated gradient button for AI features (ai action, generate, assistant button). Also: AIButtonShape, AIButtonSize, AIButtonTextTransform, AIButtonType, AIButtonVariant
|
|
46
|
+
- **ButtonGroup** — Lays out and aligns related buttons (button bar, actions row, button set). Also: ButtonGroupAlignment, ButtonGroupOrientation
|
|
47
|
+
- **ToggleButton** — Button with a pressed/selected state (pressed button, bold/italic toggle, selectable button). Also: ToggleButtonRole
|
|
48
|
+
- **ToggleButtonGroup** — Group of ToggleButtons with single or multiple selection (segmented control, view switcher, button toggle group). Also: ToggleButtonGroupRole
|
|
49
|
+
- **Dropdown** — Menu of actions or links opened from a button (menu, actions menu, kebab menu, overflow menu, split button). Not for: choosing a form value → Select. Also: DropdownAlignment, DropdownButton, DropdownContent, DropdownDivider, DropdownDropDirection, DropdownExpandableMenuButton, DropdownExpandableMenuGroup, DropdownExpandableMenuItem, DropdownExpandableMenuListItem, DropdownExpandableMenuPanel, DropdownHeader, DropdownMenuGroup, DropdownMenuItem, DropdownMenuNavItem, DropdownSplitButton
|
|
50
|
+
|
|
51
|
+
### Forms
|
|
52
|
+
- **Form** — Form container with header, description and actions (form, form layout)
|
|
53
|
+
- **Input** — Text field with label, helper and error message (text field, textbox, email field, number field, form field). Also: InputMessage
|
|
54
|
+
- **PasswordInput** — Password field with show/hide toggle (password, show password)
|
|
55
|
+
- **Search** — Search field with `onSearch`, clear and loading states (search box, search bar, filter field)
|
|
56
|
+
- **Textarea** — Multi-line text field (textarea, comment box, multiline input)
|
|
57
|
+
- **CharacterCounter** — Remaining-characters counter; prefer `maxCount` on Input/Textarea (character limit, char count)
|
|
58
|
+
- **Select** — Choose one or many (`isMulti`) values from a list (dropdown list, picker, single select, multi select). Not for: typing to filter or create → Combobox; browser-native list → NativeSelect; action menu → Dropdown
|
|
59
|
+
- **Combobox** — Select with typing, filtering and creating items (autocomplete, typeahead, searchable select, creatable select)
|
|
60
|
+
- **NativeSelect** — Magma-styled browser <select> (native select, html select)
|
|
61
|
+
- **Checkbox** — Checkbox for one boolean or one of many options (checkbox, check box, agree). Also: CheckboxTextPosition
|
|
62
|
+
- **IndeterminateCheckbox** — Tri-state checkbox (checked, unchecked, indeterminate) (select all, partial selection, tri-state). Also: IndeterminateCheckboxStatus
|
|
63
|
+
- **Radio** — Single radio option; use inside RadioGroup (radio, radio button, option). Also: RadioTextPosition
|
|
64
|
+
- **RadioGroup** — Labelled group of mutually exclusive Radios (radio group, choose one)
|
|
65
|
+
- **Toggle** — On/off switch for a setting (switch, toggle switch, enable setting). Also: ToggleTextPosition
|
|
66
|
+
- **DatePicker** — Date field with calendar popup (date, calendar, date input)
|
|
67
|
+
- **TimePicker** — Time field with keyboard entry (time, time input, clock)
|
|
68
|
+
- **DateTimePicker** — Combined date and time field (datetime, date and time, schedule)
|
|
69
|
+
- **FormGroup** — Labelled group of Checkboxes or Toggles with shared error (checkbox group, checkbox list, options group)
|
|
70
|
+
- **Fieldset** — Semantic <fieldset> with legend for related controls (fieldset, legend, group of fields)
|
|
71
|
+
- **Label** — Standalone field label; fields already render `labelText` (label). Also: LabelPosition
|
|
72
|
+
- **FormFieldContainer** — Label, helper and error wiring for a custom field (custom field, field wrapper)
|
|
73
|
+
- **InputBase** — Low-level unlabelled input; prefer Input (bare input). Also: InputIconPosition, InputSize, InputType
|
|
74
|
+
|
|
75
|
+
### Overlays
|
|
76
|
+
- **Modal** — Dialog that blocks the page and traps focus (dialog, popup, lightbox, confirm window, overlay). Not for: side panel → Drawer; small anchored content → Popover. Also: ModalSize
|
|
77
|
+
- **Drawer** — Panel sliding in from a screen edge (side panel, off-canvas, slide-out, sheet, sidebar). Also: DrawerPosition
|
|
78
|
+
- **Popover** — Interactive content anchored to a trigger (popover, flyout, callout, info bubble). Not for: hover text only → Tooltip. Also: PopoverAlignment, PopoverContent, PopoverFooter, PopoverHeader, PopoverPosition, PopoverTrigger
|
|
79
|
+
- **Tooltip** — Short text on hover or focus (tooltip, hint, hover text). Also: TooltipArrow, TooltipPosition
|
|
80
|
+
|
|
81
|
+
### Feedback
|
|
82
|
+
- **AlertBase** — Low-level alert primitive used by Alert and Toast (alert primitive, toast primitive). Not for: standard inline alert → Alert. Also: AlertVariant
|
|
83
|
+
- **Alert** — Inline message with optional dismiss (alert, message, warning, error message, info box). Not for: page-wide notice → Banner; temporary notice → Toast
|
|
84
|
+
- **Banner** — Full-width system or app-level message (banner, announcement bar, site notice)
|
|
85
|
+
- **Toast** — Temporary notification; render inside ToastsContainer and a persistent Announce region so screen readers announce new toasts (toast, snackbar, notification, flash message). Also: ToastsContainer
|
|
86
|
+
- **EmptyState** — No-content message with icon and actions (empty state, no results, nothing here, zero state)
|
|
87
|
+
- **LoadingIndicator** — Page or section loading with progressive messages (loading screen, loader, please wait). Also: LoadingIndicatorType
|
|
88
|
+
- **Spinner** — Small inline loading spinner (spinner, busy indicator)
|
|
89
|
+
- **ProgressBar** — Linear progress of a task (progress bar, percent complete, upload progress). Also: ProgressBarColor
|
|
90
|
+
- **ProgressRing** — Circular progress indicator (progress circle, radial progress)
|
|
91
|
+
- **Skeleton** — Placeholder shapes while content loads (skeleton, shimmer, placeholder, ghost loading). Also: SkeletonAnimation, SkeletonVariant
|
|
92
|
+
|
|
93
|
+
### Navigation
|
|
94
|
+
- **Hyperlink** — Link (prop `to`), can look like a button (link, anchor, href, link button). Also: HyperlinkIconPosition
|
|
95
|
+
- **Breadcrumb** — Location within a page hierarchy (breadcrumbs, trail, path). Also: BreadcrumbItem
|
|
96
|
+
- **Tabs** — Switch between panels of related content (tabs, tab panel, segmented content, scroll spy). Not for: links to other pages → NavTabs. Also: CustomTab, Tab, TabPanel, TabPanelsContainer, TabScrollSpyPanel, TabsAlignment, TabsBorderPosition, TabsContainer, TabsIconPosition, TabsOrientation, TabsScrollSpyContainer, TabsTextTransform
|
|
97
|
+
- **NavTabs** — Tab-styled navigation between pages (nav tabs, page tabs, tab navigation). Also: NavTab
|
|
98
|
+
- **Pagination** — Page number navigation (pagination, pager, page numbers). Also: PageButtonSize, PaginationType
|
|
99
|
+
- **Stepper** — Progress through multi-step flows (stepper, wizard, steps, progress steps). Also: ResponsiveStepperContainer, Step, StepperLayout, StepperOrientation
|
|
100
|
+
- **TreeView** — Expandable hierarchical list with selection (tree, folder tree, nested list, hierarchy, file explorer). Also: TreeItem, TreeNodeType, TreeViewSelectable
|
|
101
|
+
- **AppBar** — Top header bar for the current screen (header, top bar, navbar, app header). Also: AppBarPosition
|
|
102
|
+
- **SkipLink** — Skip-to-main-content link and its target (skip link, skip navigation). Also: SkipLinkContent
|
|
103
|
+
|
|
104
|
+
### Layout
|
|
105
|
+
- **Container** — Centers content horizontally with max width (container, page wrapper, wrapper)
|
|
106
|
+
- **Flex** — Responsive 12-column flexbox rows and columns (flex, row, column, stack, responsive columns). Also: FlexAlignContent, FlexAlignItems, FlexBehavior, FlexDirection, FlexJustify, FlexWrap
|
|
107
|
+
- **Grid** — CSS grid container with grid props (grid, css grid, grid layout). Also: GridAlignContent, GridAlignItems, GridAutoFlow, GridDisplay, GridItem, GridItemAlignSelf, GridItemJustifySelf, GridJustifyContent, GridJustifyItems
|
|
108
|
+
- **Spacer** — Horizontal or vertical gap from the space scale (spacer, gap, margin, whitespace). Also: SpacerAxis
|
|
109
|
+
- **Card** — Surface for grouped content (card, tile, panel, box). Also: CardAlignment, CardBody, CardCalloutType, CardHeading
|
|
110
|
+
- **Accordion** — Stacked collapsible sections (accordion, collapse, expandable section, faq). Also: AccordionButton, AccordionIconPosition, AccordionItem, AccordionPanel
|
|
111
|
+
- **BreakpointsContainer** — Render different content per screen size (responsive, breakpoint, mobile/desktop content). Also: Breakpoint, BreakpointScreenSize
|
|
112
|
+
- **HideAtBreakpoint** — Hide content above or below a breakpoint (hide on mobile, hide on desktop, responsive visibility). Also: HideAtBreakpointDisplayType
|
|
113
|
+
|
|
114
|
+
### Content and data
|
|
115
|
+
- **Typography** — Low-level typography primitive for custom text styles (typography, text style, styled text). Not for: semantic heading → Heading; paragraph → Paragraph. Also: TypographyColor, TypographyContextVariant, TypographyVisualStyle
|
|
116
|
+
- **Heading** — Headings h1–h6 (`level`), style set separately (heading, title, h1, h2)
|
|
117
|
+
- **Paragraph** — Body text with typography styles (paragraph, body text, text, copy)
|
|
118
|
+
- **List** — Ordered or unordered list, optional icons (list, bullet list, numbered list). Also: IconAlignment, IconSizes, ListItem
|
|
119
|
+
- **DefinitionList** — Term/description pairs (definition list, key value, details list, dl). Also: DefinitionListItem, DefinitionListType
|
|
120
|
+
- **BlockQuote** — Styled quotation with attribution (quote, blockquote, citation). Also: BlockQuoteItem
|
|
121
|
+
- **Table** — Composable table (rows, cells, sorting, pagination) (table, rows, columns, sortable table). Not for: table from data props → Datagrid. Also: TableBody, TableCell, TableCellAlign, TableDensity, TableHead, TableHeaderCell, TableHeaderCellScope, TablePagination, TableRow, TableRowColor, TableSortDirection
|
|
122
|
+
- **Datagrid** — Table rendered from columns/rows props, selection and pagination (data grid, data table, selectable rows)
|
|
123
|
+
- **Badge** — Small label or count (badge, counter, status label, pill). Also: BadgeColor, BadgeVariant, BadgeWeight
|
|
124
|
+
- **Tag** — Category chip, clickable or removable (tag, chip, filter chip, token). Also: TagColor, TagSize
|
|
125
|
+
|
|
126
|
+
### Utilities
|
|
127
|
+
- **VisuallyHidden** — Content for screen readers only (sr-only, screen reader text, visually hidden)
|
|
128
|
+
- **Announce** — aria-live region announcing dynamic changes (live region, aria-live, announce)
|
|
129
|
+
- **Transition** — framer-motion enter/exit animations (animation, fade, slide, collapse animation)
|
|
130
|
+
|
|
131
|
+
### Add-on packages
|
|
132
|
+
- **CarbonChart** (`@react-magma/charts`) — Accessible chart (`type`: bar, line, area, pie, donut, gauge, scatter…); `chartToolbar` adds table view, fullscreen and downloads (chart, graph, data visualization, bar chart, line chart, pie chart, dashboard). Also: CarbonChartType
|
|
133
|
+
- **ChartTable** (`@react-magma/charts`) — Parts for a custom chart toolbar and table view; prefer `CarbonChart` `chartToolbar` (chart toolbar, chart data table, fullscreen chart). Also: ChartDataTable, ChartFullscreenButton, ChartMoreOptionsButton, ChartTableButton, ChartTableModal, ChartToolbar
|
|
134
|
+
- **Dropzone** (`@react-magma/dropzone`) — Drag-and-drop file upload with previews, type/size/count limits and progress (file upload, drag and drop, dropzone, file input, attachment, uploader). Also: FileIcon
|
|
135
|
+
|
|
136
|
+
### Public hooks
|
|
137
|
+
|
|
138
|
+
Public hooks available for consumer use: `useDeviceDetect`, `useFocusLock`, `useMediaQuery`.
|
|
139
|
+
|
|
140
|
+
### Other public exports
|
|
141
|
+
|
|
142
|
+
`GlobalStyles`, `I18nContext`, `InverseContext`, `ThemeContext`, `defaultI18n`, `magma`, `styled`
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# React Magma setup and theming
|
|
2
|
+
|
|
3
|
+
## App root
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {
|
|
7
|
+
GlobalStyles,
|
|
8
|
+
I18nContext,
|
|
9
|
+
ThemeContext,
|
|
10
|
+
defaultI18n,
|
|
11
|
+
magma,
|
|
12
|
+
} from 'react-magma-dom';
|
|
13
|
+
|
|
14
|
+
<ThemeContext.Provider value={magma}>
|
|
15
|
+
<I18nContext.Provider value={defaultI18n}>
|
|
16
|
+
<GlobalStyles />
|
|
17
|
+
<App />
|
|
18
|
+
</I18nContext.Provider>
|
|
19
|
+
</ThemeContext.Provider>;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`ThemeContext` defaults to `magma`; add the provider only for a custom theme. For a custom theme, spread `magma` and override keys: `{ ...magma, colors: { ...magma.colors, primary: '…' } }`.
|
|
23
|
+
|
|
24
|
+
## Required Magma styling
|
|
25
|
+
|
|
26
|
+
Use Magma components and the active Magma theme for UI styling. Follow [styling-guide.md](styling-guide.md) for typography, layout, token selection and examples. Existing custom CSS does not authorize a different design system; design-system overrides need an explicit user or project instruction naming their scope.
|
|
27
|
+
|
|
28
|
+
## Theme tokens and styling
|
|
29
|
+
|
|
30
|
+
React Magma exposes design tokens through `ThemeContext` and `magma`. Read the current theme from `ThemeContext`, rather than styling from the static default `magma` object, so custom themes are respected. Apply tokens through the consumer application's existing styling approach; React Magma does not require consumers to use Emotion or any other styling library.
|
|
31
|
+
|
|
32
|
+
Token groups include `spaceScale` (`spacing01`…`spacing14`), `typeScale` (`size01`…`size16`), `colors`, `borderRadius*`, `breakpoints` (`xs`, `small`, `medium`, `large`, `xl`), and `iconSizes`. Check exact token values before mapping a design value (for example, `spaceScale.spacing04` is `12px`, not 16px).
|
|
33
|
+
|
|
34
|
+
Use the token itself in styles or component props, rather than copying its current literal value. When creating CSS variables for tokens, place them where their consumers can inherit them, including content rendered through portals such as Modal.
|
|
35
|
+
|
|
36
|
+
Use component variants and supported props before adding CSS. Do not override Magma typography, colors, focus, hover or disabled states just to create a different visual style. Explicitly requested overrides must still preserve theming and accessibility.
|
|
37
|
+
|
|
38
|
+
## Inverse (dark surfaces)
|
|
39
|
+
|
|
40
|
+
Components accept `isInverse`. For a whole region use `<InverseContext.Provider value={{ isInverse: true }}>`; read it in your own components with `useIsInverse(props.isInverse)`.
|
|
41
|
+
|
|
42
|
+
## i18n
|
|
43
|
+
|
|
44
|
+
User-facing strings built into components come from `I18nContext`. Override by spreading `defaultI18n` and replacing keys; do not hard-code those labels in props when an i18n key exists.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Required React Magma components and tokens
|
|
2
|
+
|
|
3
|
+
Use this page before writing layout, typography or custom styles. React Magma is the required default design system for agent-created UI. A different design system requires an explicit user request or project instruction naming its scope; existing custom styles alone do not authorize it. Follow the allowances below for unsupported APIs, structural CSS and accessibility, and report any exception and its reason.
|
|
4
|
+
|
|
5
|
+
## Choose components first
|
|
6
|
+
|
|
7
|
+
- Render standalone headings through `Heading` and paragraphs through `Paragraph`. Choose semantic heading levels independently of `TypographyVisualStyle`. If a component already supplies typography through a title, header, description or label prop, use that API without nesting another heading or paragraph inside it. For example, `Modal.header` already renders a `Heading`.
|
|
8
|
+
- Use `Typography` or supported typography variants for other styled text. Do not replace fonts or recreate typography with raw headings, paragraphs, CSS font rules or remote font imports.
|
|
9
|
+
- Use `Container`, `Flex`, `Grid`, `Spacer` and `Card` for the layout and surfaces they support. `Flex` requires `behavior`; direction, alignment and other variants use exported enums. Check each component's actual props before use.
|
|
10
|
+
- Use available widgets such as `Table`, `Tabs`, `Pagination`, `Accordion`, `Tooltip` and `EmptyState` instead of styling and maintaining custom equivalents. Use Magma controls, feedback and icons where supported.
|
|
11
|
+
- Keep native semantic elements such as `main`, `nav`, `section` and `form` where needed. Do not use paragraph typography for control labels; use the control's label API. Avoid wrappers that break valid table/list markup or semantics.
|
|
12
|
+
- If an API cannot support the requested behavior, select another suitable Magma component first. If none fits, use accessible native markup or a small custom implementation, style it with theme tokens, and explain the gap. Never invent props or bypass types.
|
|
13
|
+
|
|
14
|
+
## Select tokens, not arbitrary design values
|
|
15
|
+
|
|
16
|
+
Read the active theme with `useContext(ThemeContext)`. Use that theme's `spaceScale`, `colors`, typography, `borderRadius*`, `iconSizes` and `breakpoints`. Inspect their installed definitions; token names are not pixel values. Use appropriate semantic colors and typography variants, rather than numerically matching colors or guessing font sizes.
|
|
17
|
+
|
|
18
|
+
For agent-chosen padding, margin and gaps:
|
|
19
|
+
|
|
20
|
+
1. Inspect the active `spaceScale` values.
|
|
21
|
+
2. Select the closest token to the intended spacing; when equally close, select the smaller value. Compare actual lengths in consistent units.
|
|
22
|
+
3. Reference the token in the implementation. Do not copy a literal or add/subtract a constant to manufacture an off-scale value.
|
|
23
|
+
|
|
24
|
+
Default-theme examples (custom themes can change these values):
|
|
25
|
+
|
|
26
|
+
| Intended spacing | Use | Default value |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| 5px | `theme.spaceScale.spacing02` | 4px |
|
|
29
|
+
| 6px (tie) | `theme.spaceScale.spacing02` | 4px |
|
|
30
|
+
| 7px | `theme.spaceScale.spacing03` | 8px |
|
|
31
|
+
| 18px | `theme.spaceScale.spacing05` | 16px |
|
|
32
|
+
|
|
33
|
+
Some component props are numeric multipliers or enum keys, not CSS lengths. For example, `Flex.spacing` is a number with component-defined spacing behavior, not a `spaceScale` string. Inspect that API; use its supported spacing semantics or a token-based style such as `gap` rather than passing a token to an incompatible prop.
|
|
34
|
+
|
|
35
|
+
Keep Magma component defaults and supported variants. Never use CSS or `!important` to replace their typography, colors or interactive states with a different design. Custom styling uses the application's existing styling tools, with values from the active Magma theme; do not install another styling library.
|
|
36
|
+
|
|
37
|
+
## Necessary structural values and exceptions
|
|
38
|
+
|
|
39
|
+
Tokens govern visual design choices, not every CSS number. Values such as `0`, `auto`, percentages, `1fr`, flex ratios, content-dependent dimensions and positioning needed for behavior are valid structural CSS. Keywords such as `inherit`, `currentColor` and `transparent` are valid when preserving token-derived styling or behavior. Use the library's dimensions or component props where available. Do not invent token names when no corresponding token exists.
|
|
40
|
+
|
|
41
|
+
Do not round an explicit user requirement, an accessibility minimum or a behavior-critical size to an unsuitable smaller token. Use a suitable supported value and explain the exception. Do not round or rewrite the library's internal styles. Choose colors by their intended role and accessible contrast, not by numeric proximity.
|
|
42
|
+
|
|
43
|
+
## Example: theme-aware layout and typography
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { useContext } from 'react';
|
|
47
|
+
import {
|
|
48
|
+
Button,
|
|
49
|
+
ButtonColor,
|
|
50
|
+
Container,
|
|
51
|
+
Flex,
|
|
52
|
+
FlexBehavior,
|
|
53
|
+
FlexDirection,
|
|
54
|
+
Heading,
|
|
55
|
+
Paragraph,
|
|
56
|
+
ThemeContext,
|
|
57
|
+
} from 'react-magma-dom';
|
|
58
|
+
|
|
59
|
+
export function CoursesIntro() {
|
|
60
|
+
const theme = useContext(ThemeContext);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<main
|
|
64
|
+
style={{
|
|
65
|
+
backgroundColor: theme.colors.neutral100,
|
|
66
|
+
paddingBlock: theme.spaceScale.spacing06,
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
<Container gutterWidth={theme.spaceScale.spacing05}>
|
|
70
|
+
<Flex
|
|
71
|
+
behavior={FlexBehavior.container}
|
|
72
|
+
direction={FlexDirection.column}
|
|
73
|
+
style={{ gap: theme.spaceScale.spacing03 }}
|
|
74
|
+
>
|
|
75
|
+
<Heading level={1}>Courses</Heading>
|
|
76
|
+
<Paragraph noMargins>Manage your learning catalog.</Paragraph>
|
|
77
|
+
<Button color={ButtonColor.primary}>Create course</Button>
|
|
78
|
+
</Flex>
|
|
79
|
+
</Container>
|
|
80
|
+
</main>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The inline style demonstrates reading tokens without requiring a styling library; use the consumer project's styling tools in real code. If using CSS variables, make sure portal content can also inherit them.
|
|
86
|
+
|
|
87
|
+
## Review before finishing
|
|
88
|
+
|
|
89
|
+
Inspect changed JSX and styles for raw headings/paragraphs, custom Magma widget replacements, literal spacing/colors/fonts, remote fonts and cosmetic component overrides. Replace them with components, supported variants and tokens, or report the specific justified exception. Run the project's available type-check and relevant checks; do not equate a bundler build with TypeScript validation.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-magma-dom",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.1-v5-next.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://react-magma.cengage.com",
|
|
@@ -18,17 +18,21 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"dist",
|
|
20
20
|
"!dist/reports",
|
|
21
|
-
"lib"
|
|
21
|
+
"lib",
|
|
22
|
+
"ai"
|
|
22
23
|
],
|
|
23
24
|
"scripts": {
|
|
24
25
|
"build": "tsdx build",
|
|
25
|
-
"postbuild": "npm run generate-properties",
|
|
26
|
+
"postbuild": "npm run generate-properties && npm run generate-ai",
|
|
26
27
|
"build-watch": "tsdx watch",
|
|
28
|
+
"check-ai": "node scripts/generate-skill.js --check",
|
|
27
29
|
"copy-changelog": "node scripts/copy-changelog.js",
|
|
30
|
+
"generate-ai": "node scripts/generate-skill.js",
|
|
28
31
|
"generate-properties": "node scripts/generateJSON.mjs",
|
|
29
32
|
"lint": "eslint ./src",
|
|
30
33
|
"lint:fix": "eslint ./src --fix",
|
|
31
34
|
"lint:check": "eslint ./src --max-warnings=0",
|
|
35
|
+
"prepack": "npm run generate-ai",
|
|
32
36
|
"prepublishOnly": "npm run copy-changelog",
|
|
33
37
|
"test": "jest",
|
|
34
38
|
"test-watch": "jest --watch",
|