@appdirect/design-system 0.0.19 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +21 -0
  2. package/bin/ad-sync-agents.mjs +542 -0
  3. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/CustomBottomToolbar.module.css +24 -1
  4. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.js +2 -1
  5. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.tsx +3 -0
  6. package/dist/ComplexComponents/DataTable/CustomToolbarAlertBannerContent/CustomToolbarAlertBannerContent.module.css +9 -1
  7. package/dist/ComplexComponents/DataTable/CustomTopToolbar/CustomTopToolbar.module.css +7 -0
  8. package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/DateRangeSelectorFilter.module.css +7 -0
  9. package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.js +1 -1
  10. package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.tsx +1 -0
  11. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.js +4 -2
  12. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.module.css +16 -0
  13. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.tsx +6 -3
  14. package/dist/ComplexComponents/DataTable/CustomTopToolbar/index.js +2 -2
  15. package/dist/ComplexComponents/DataTable/CustomTopToolbar/index.tsx +11 -8
  16. package/dist/ComplexComponents/DataTable/DataTableGrid/DataTableGrid.module.css +17 -3
  17. package/dist/ComplexComponents/DataTable/DataTableGrid/index.js +1 -1
  18. package/dist/ComplexComponents/DataTable/DataTableGrid/index.tsx +2 -2
  19. package/dist/ComplexComponents/DataTable/ToolbarAlertBanner/ToolbarAlertBanner.module.css +4 -1
  20. package/dist/DESIGN.md +49 -7
  21. package/dist/agent-kit/README.md +11 -0
  22. package/dist/agent-kit/manifest.json +81 -0
  23. package/dist/agent-kit/micro-ui/CLAUDE.md +1 -0
  24. package/dist/agent-kit/micro-ui/micro-ui.AGENTS.md +62 -0
  25. package/dist/agent-kit/rules/accessibility.mdc +46 -0
  26. package/dist/agent-kit/rules/module-federation.mdc +30 -0
  27. package/dist/agent-kit/rules/react-stack.mdc +73 -0
  28. package/dist/agent-kit/rules/testing.mdc +44 -0
  29. package/dist/agent-kit/skills/design-feature/SKILL.md +205 -0
  30. package/dist/agent-kit/skills/developer-handoff/SKILL.md +192 -0
  31. package/dist/agent-kit/skills/figma-mcp-integration/SKILL.md +134 -0
  32. package/dist/agent-kit/skills/figma-to-page/SKILL.md +24 -0
  33. package/dist/agent-kit/skills/mantine-combobox/SKILL.md +73 -0
  34. package/dist/agent-kit/skills/mantine-combobox/references/api.md +199 -0
  35. package/dist/agent-kit/skills/mantine-combobox/references/patterns.md +279 -0
  36. package/dist/agent-kit/skills/mantine-custom-components/SKILL.md +112 -0
  37. package/dist/agent-kit/skills/mantine-custom-components/references/api.md +407 -0
  38. package/dist/agent-kit/skills/mantine-custom-components/references/patterns.md +431 -0
  39. package/dist/agent-kit/skills/mantine-form/SKILL.md +103 -0
  40. package/dist/agent-kit/skills/mantine-form/references/api.md +313 -0
  41. package/dist/agent-kit/skills/mantine-form/references/patterns.md +310 -0
  42. package/dist/agent-kit/skills/prototype-page/SKILL.md +82 -0
  43. package/dist/contracts/index.json +1 -1
  44. package/dist/css/mantine.css +4 -4
  45. package/dist/skills/design-feature/SKILL.md +205 -0
  46. package/dist/stories/index.json +1 -1
  47. package/package.json +8 -4
@@ -121,6 +121,6 @@ const DateRangeSelector = ({ label, locale, onChange }) => {
121
121
  }));
122
122
  onChange(value);
123
123
  };
124
- return (_jsxs(Popover, { opened: isDatePickerOpened, position: "bottom-start", children: [_jsx(Popover.Target, { children: _jsx("div", { ref: presetSelectRef, role: "menuitem", children: _jsxs(Combobox, { size: "xs", store: combobox, withinPortal: false, onOptionSubmit: handlePresetChange, children: [_jsx(Combobox.Target, { children: _jsx(InputBase, { className: styles.field, component: "button", type: "button", size: "xs", pointer: true, rightSection: preset ? (_jsx(CloseButton, { size: "xs", variant: "transparent", onMouseDown: (event) => event.preventDefault(), onClick: handleClearClick, "aria-label": "Clear date range" })) : (_jsx(Combobox.Chevron, { size: "xs" })), onClick: handleInputBaseClick, rightSectionPointerEvents: preset === null ? "none" : "all", label: label, children: getValueDisplayed }) }), _jsx(Combobox.Dropdown, { children: _jsx(Combobox.Options, { children: options }) })] }) }) }), _jsx(Popover.Dropdown, { children: _jsx(DatePicker, { id: "date-picker", "data-testid": "date-picker", type: "range", value: customDateRange, onChange: handleDatePickerChange, defaultDate: customDateRange[0] || customDateRange[1] || toDateString(new Date()) || undefined, allowSingleDateInRange: true }) })] }));
124
+ return (_jsxs(Popover, { opened: isDatePickerOpened, position: "bottom-start", children: [_jsx(Popover.Target, { children: _jsx("div", { ref: presetSelectRef, role: "menuitem", children: _jsxs(Combobox, { size: "xs", store: combobox, withinPortal: false, onOptionSubmit: handlePresetChange, children: [_jsx(Combobox.Target, { children: _jsx(InputBase, { className: styles.field, classNames: { input: styles.fieldInput }, component: "button", type: "button", size: "xs", pointer: true, rightSection: preset ? (_jsx(CloseButton, { size: "xs", variant: "transparent", onMouseDown: (event) => event.preventDefault(), onClick: handleClearClick, "aria-label": "Clear date range" })) : (_jsx(Combobox.Chevron, { size: "xs" })), onClick: handleInputBaseClick, rightSectionPointerEvents: preset === null ? "none" : "all", label: label, children: getValueDisplayed }) }), _jsx(Combobox.Dropdown, { children: _jsx(Combobox.Options, { children: options }) })] }) }) }), _jsx(Popover.Dropdown, { children: _jsx(DatePicker, { id: "date-picker", "data-testid": "date-picker", type: "range", value: customDateRange, onChange: handleDatePickerChange, defaultDate: customDateRange[0] || customDateRange[1] || toDateString(new Date()) || undefined, allowSingleDateInRange: true }) })] }));
125
125
  };
126
126
  export default DateRangeSelector;
@@ -163,6 +163,7 @@ const DateRangeSelector = ({ label, locale, onChange }: DateRangeSelectorProps):
163
163
  <Combobox.Target>
164
164
  <InputBase
165
165
  className={styles.field}
166
+ classNames={{ input: styles.fieldInput }} // DS-ADAPT: align the button text with the City select
166
167
  component="button"
167
168
  type="button"
168
169
  size="xs"
@@ -4,8 +4,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  import React, { useEffect, useRef, useState } from "react";
5
5
  import { RiSearchLine as SearchIcon } from "@remixicon/react"; // DS-ADAPT: @remixicon/react instead of remixicon svg import
6
6
  import { RiCloseLine as CloseIcon } from "@remixicon/react"; // DS-ADAPT: @remixicon/react instead of remixicon svg import
7
- import { rem, TextInput } from "@mantine/core";
7
+ import clsx from "clsx";
8
+ import { TextInput } from "@mantine/core";
8
9
  import { translate } from "../translations/index.js"; // DS-ADAPT: translate lives in DataTable/translations
10
+ import styles from "./SearchFilter.module.css";
9
11
  const debounce = (fn, timeout = 1000) => {
10
12
  let timer;
11
13
  return (value) => {
@@ -35,6 +37,6 @@ const SearchFilter = ({ searchTerm, onChange }) => {
35
37
  useEffect(() => {
36
38
  setLocalSearchTerm(searchTerm);
37
39
  }, [searchTerm]);
38
- return (_jsx(TextInput, { size: "xs", placeholder: translate("table.search.placeholder"), flex: "1 1 auto", onChange: (event) => handleSearchChange(event.target.value), rightSection: localSearchTerm === "" ? (_jsx(SearchIcon, { style: { width: rem(14), height: rem(14) } })) : (_jsx(CloseIcon, { "data-testid": "search-clear", onClick: clearSearch, style: { width: rem(14), height: rem(14), cursor: "pointer" } })), value: localSearchTerm }));
40
+ return (_jsx(TextInput, { size: "xs", placeholder: translate("table.search.placeholder"), flex: "1 1 auto", onChange: (event) => handleSearchChange(event.target.value), classNames: { section: styles.section }, rightSection: localSearchTerm === "" ? (_jsx(SearchIcon, { className: styles.icon })) : (_jsx(CloseIcon, { "data-testid": "search-clear", onClick: clearSearch, className: clsx(styles.icon, styles.clearIcon) })), value: localSearchTerm }));
39
41
  };
40
42
  export default SearchFilter;
@@ -0,0 +1,16 @@
1
+ /* The global Input section rule pads the section on both sides, which squeezes a bare icon down to
2
+ a few px. The icon fills the section instead. */
3
+ .section[data-position] {
4
+ padding-inline: 0;
5
+ justify-content: center;
6
+ }
7
+
8
+ .icon {
9
+ width: var(--ad-icon-size-md);
10
+ height: var(--ad-icon-size-md);
11
+ flex-shrink: 0;
12
+ }
13
+
14
+ .clearIcon {
15
+ cursor: pointer;
16
+ }
@@ -3,8 +3,10 @@
3
3
  import React, { ReactElement, useEffect, useRef, useState } from "react";
4
4
  import { RiSearchLine as SearchIcon } from "@remixicon/react"; // DS-ADAPT: @remixicon/react instead of remixicon svg import
5
5
  import { RiCloseLine as CloseIcon } from "@remixicon/react"; // DS-ADAPT: @remixicon/react instead of remixicon svg import
6
- import { rem, TextInput } from "@mantine/core";
6
+ import clsx from "clsx";
7
+ import { TextInput } from "@mantine/core";
7
8
  import { translate } from "../translations"; // DS-ADAPT: translate lives in DataTable/translations
9
+ import styles from "./SearchFilter.module.css";
8
10
 
9
11
  const debounce = (fn: (value: string) => void, timeout = 1000): ((value: string) => void) => {
10
12
  let timer: NodeJS.Timeout | undefined;
@@ -54,14 +56,15 @@ const SearchFilter = ({ searchTerm, onChange }: SearchFilterProps): ReactElement
54
56
  placeholder={translate("table.search.placeholder")}
55
57
  flex="1 1 auto"
56
58
  onChange={(event): void => handleSearchChange(event.target.value)}
59
+ classNames={{ section: styles.section }} // DS-ADAPT: icon sizing via tokens in a module
57
60
  rightSection={
58
61
  localSearchTerm === "" ? (
59
- <SearchIcon style={{ width: rem(14), height: rem(14) }} />
62
+ <SearchIcon className={styles.icon} />
60
63
  ) : (
61
64
  <CloseIcon
62
65
  data-testid="search-clear"
63
66
  onClick={clearSearch}
64
- style={{ width: rem(14), height: rem(14), cursor: "pointer" }}
67
+ className={clsx(styles.icon, styles.clearIcon)}
65
68
  />
66
69
  )
67
70
  }
@@ -23,7 +23,7 @@ const dateOptions = {
23
23
  day: "numeric",
24
24
  timeZone: "UTC", // DS-ADAPT: range dates are stored as UTC calendar days, so format them in UTC to avoid a day shift
25
25
  };
26
- const FilterIconButton = ({ onClick, areFiltersShown, }) => (_jsx(ActionIcon, { "data-testid": "additional-filter-toggle", variant: areFiltersShown ? "outline" : "default", onClick: onClick, "aria-label": translate("table.filters.toggle.aria"), children: _jsx(FilterIcon, { color: "var(--ad-color-text-default)", style: { width: "71%", height: "71%" } }) }));
26
+ const FilterIconButton = ({ onClick, areFiltersShown, }) => (_jsx(ActionIcon, { "data-testid": "additional-filter-toggle", variant: "outline", className: styles.filterToggle, size: "var(--ad-table-toolbar-action-icon-size)", "data-open": areFiltersShown, onClick: onClick, "aria-label": translate("table.filters.toggle.aria"), children: _jsx(FilterIcon, { color: areFiltersShown ? "currentColor" : "var(--ad-color-text-default)", style: { width: "71%", height: "71%" } }) }));
27
27
  const CustomTopToolbar = ({ filtersState, locale, resultCount, onChange, isLoading, showFilters, onFilterToggleChange, fullscreenControl, densityControl, alertBanner, }) => {
28
28
  const { searchTerm, city, dateRange } = filtersState;
29
29
  const [dateRangeSelectorRefreshKey, setDateRangeSelectorRefreshKey] = useState(0);
@@ -68,7 +68,7 @@ const CustomTopToolbar = ({ filtersState, locale, resultCount, onChange, isLoadi
68
68
  });
69
69
  setDateRangeSelectorRefreshKey(prev => prev + 1);
70
70
  };
71
- return (_jsxs(_Fragment, { children: [_jsxs(Stack, { p: "md", gap: "xshalf", className: styles.toolbar, children: [_jsxs(SimpleGrid, { cols: 2, children: [_jsxs(Group, { gap: "xs", align: "center", children: [areFiltersActive() ? (_jsx(Indicator, { size: "8", children: _jsx(FilterIconButton, { areFiltersShown: showFilters, onClick: onToggleFilterClick }) })) : (_jsx(FilterIconButton, { areFiltersShown: showFilters, onClick: onToggleFilterClick })), _jsx(SearchFilter, { searchTerm: searchTerm, onChange: (value) => onChange({
71
+ return (_jsxs(_Fragment, { children: [_jsxs(Stack, { p: "md", gap: "xshalf", className: styles.toolbar, children: [_jsxs(SimpleGrid, { cols: 2, children: [_jsxs(Group, { gap: "xs", align: "center", children: [_jsx(Indicator, { size: "8", disabled: !(areFiltersActive() || Boolean(searchTerm)), children: _jsx(FilterIconButton, { areFiltersShown: showFilters, onClick: onToggleFilterClick }) }), _jsx(SearchFilter, { searchTerm: searchTerm, onChange: (value) => onChange({
72
72
  searchTerm: value,
73
73
  }) })] }), _jsxs(Group, { justify: "end", gap: "xs", children: [fullscreenControl, densityControl] })] }), _jsx(Group, { justify: "space-between", children: _jsxs(Group, { gap: "xs", children: [areFiltersActive() && (_jsxs(_Fragment, { children: [_jsx(Text, { className: styles.clearFilters, size: "xs", span: true, role: "button", fw: 600, onClick: clearFilters, c: "var(--ad-color-text-link)", "data-testid": "clear-filters", children: translate("table.filters.clear.filters") }), filtersState.city && (_jsx(FilterChip, { label: filtersState.city, onClick: () => onChange({
74
74
  city: null,
@@ -57,11 +57,17 @@ const FilterIconButton = ({
57
57
  }): ReactElement => (
58
58
  <ActionIcon
59
59
  data-testid="additional-filter-toggle"
60
- variant={areFiltersShown ? "outline" : "default"}
60
+ variant="outline"
61
+ className={styles.filterToggle}
62
+ size="var(--ad-table-toolbar-action-icon-size)"
63
+ data-open={areFiltersShown}
61
64
  onClick={onClick}
62
65
  aria-label={translate("table.filters.toggle.aria")}
63
66
  >
64
- <FilterIcon color="var(--ad-color-text-default)" style={{ width: "71%", height: "71%" }} />
67
+ <FilterIcon
68
+ color={areFiltersShown ? "currentColor" : "var(--ad-color-text-default)"} // DS-ADAPT: open state takes the outline variant's brand colour
69
+ style={{ width: "71%", height: "71%" }}
70
+ />
65
71
  </ActionIcon>
66
72
  );
67
73
 
@@ -134,13 +140,10 @@ const CustomTopToolbar = ({
134
140
  <Stack p="md" gap="xshalf" className={styles.toolbar}>
135
141
  <SimpleGrid cols={2}>
136
142
  <Group gap="xs" align="center">
137
- {areFiltersActive() ? (
138
- <Indicator size="8">
139
- <FilterIconButton areFiltersShown={showFilters} onClick={onToggleFilterClick} />
140
- </Indicator>
141
- ) : (
143
+ {/* DS-ADAPT: indicator shows for a search term as well as filters */}
144
+ <Indicator size="8" disabled={!(areFiltersActive() || Boolean(searchTerm))}>
142
145
  <FilterIconButton areFiltersShown={showFilters} onClick={onToggleFilterClick} />
143
- )}
146
+ </Indicator>
144
147
  <SearchFilter
145
148
  searchTerm={searchTerm as string}
146
149
  onChange={(value): void =>
@@ -18,12 +18,17 @@
18
18
  flex-direction: column;
19
19
  }
20
20
 
21
- .headRow {
22
- background-color: var(--ad-table-header-bg);
23
- display: flex;
21
+ /* The grid layout makes <thead> a block-level grid item, so the sticky element has to be the
22
+ thead itself: a sticky <tr> can only move within its own (header-high) containing block. */
23
+ .head {
24
24
  position: sticky;
25
25
  top: 0;
26
26
  z-index: var(--ad-table-header-z-index);
27
+ }
28
+
29
+ .headRow {
30
+ background-color: var(--ad-table-header-bg);
31
+ display: flex;
27
32
  box-shadow: var(--ad-table-header-shadow);
28
33
  }
29
34
 
@@ -33,6 +38,15 @@
33
38
  box-sizing: border-box;
34
39
  }
35
40
 
41
+ /* The bottom toolbar owns the line under the table (its border-top) in every layout, including
42
+ fullscreen, where a short grid leaves blank space above the footer and a tall one sits flush
43
+ against it. The last row therefore never draws its own border: that is the only way to get
44
+ exactly one line when flush, and a blank gap above the footer line is the normal table look. */
45
+ .body > .bodyRow:last-of-type .bodyCell,
46
+ .body > .bodyRow:last-of-type .emptyCell {
47
+ border-bottom: none;
48
+ }
49
+
36
50
  .bodyRow[data-selected="true"],
37
51
  .bodyRow[data-selected="true"] .bodyCell {
38
52
  background-color: var(--ad-table-row-selected-bg);
@@ -41,6 +41,6 @@ const DataTableGrid = ({ table, density, rowSelection, isLoading, pageSize, empt
41
41
  }
42
42
  return (_jsx(_Fragment, { children: rows.map(row => (_jsx(TableTr, { className: clsx(styles.bodyRow, rowStyles["table-row"]), "data-selected": rowSelection[row.id] ? "true" : undefined, children: row.getAllCells().map(cell => (_jsx(TableTd, { className: styles.bodyCell, ...getCellSizeProps(cell.column.id, cell.column.columnDef.minSize ?? 40), children: _jsx(table.FlexRender, { cell: cell }) }, cell.id))) }, row.id))) }));
43
43
  };
44
- return (_jsxs(Table, { className: styles.rootGrid, highlightOnHover: false, "data-density": density, withRowBorders: true, withTableBorder: false, __vars: columnSizeVars, children: [_jsx(TableThead, { children: table.getHeaderGroups().map(headerGroup => (_jsx(TableTr, { className: styles.headRow, children: headerGroup.headers.map(header => (_jsx(TableTh, { className: styles.headCell, ...getCellSizeProps(header.column.id, header.column.columnDef.minSize ?? 40), children: header.isPlaceholder ? null : _jsx(table.FlexRender, { header: header }) }, header.id))) }, headerGroup.id))) }), _jsx(TableTbody, { className: styles.body, children: renderBody() })] }));
44
+ return (_jsxs(Table, { className: styles.rootGrid, highlightOnHover: false, "data-density": density, withRowBorders: false, withTableBorder: false, __vars: columnSizeVars, children: [_jsx(TableThead, { className: styles.head, children: table.getHeaderGroups().map(headerGroup => (_jsx(TableTr, { className: styles.headRow, children: headerGroup.headers.map(header => (_jsx(TableTh, { className: styles.headCell, ...getCellSizeProps(header.column.id, header.column.columnDef.minSize ?? 40), children: header.isPlaceholder ? null : _jsx(table.FlexRender, { header: header }) }, header.id))) }, headerGroup.id))) }), _jsx(TableTbody, { className: styles.body, children: renderBody() })] }));
45
45
  };
46
46
  export default DataTableGrid;
@@ -116,11 +116,11 @@ const DataTableGrid = <TData extends RowData>({
116
116
  className={styles.rootGrid}
117
117
  highlightOnHover={false}
118
118
  data-density={density}
119
- withRowBorders
119
+ withRowBorders={false}
120
120
  withTableBorder={false}
121
121
  __vars={columnSizeVars as unknown as ComponentProps<typeof Table>["__vars"]} // DS-ADAPT: Mantine 9 CssVarsProp typing
122
122
  >
123
- <TableThead>
123
+ <TableThead className={styles.head}>
124
124
  {table.getHeaderGroups().map(headerGroup => (
125
125
  <TableTr key={headerGroup.id} className={styles.headRow}>
126
126
  {headerGroup.headers.map(header => (
@@ -1,7 +1,10 @@
1
- .alert {
1
+ /* [data-variant] lifts these above the global .mantine-Alert-root rule, which would otherwise
2
+ put its radius back (the radius={0} prop is only a Mantine variable). */
3
+ .alert[data-variant] {
2
4
  background-color: var(--ad-table-toolbar-selection-banner-bg);
3
5
  color: var(--ad-table-toolbar-selection-banner-fg);
4
6
  border: 0;
7
+ border-radius: 0;
5
8
  }
6
9
 
7
10
  .alert :global(.mantine-Alert-icon) {
package/dist/DESIGN.md CHANGED
@@ -357,6 +357,8 @@ All inputs default to `radius="sm"` and `size="sm"` matching the button default.
357
357
 
358
358
  `SearchableSelect` and `AutocompleteClearable` are opinionated wrappers with built-in clear affordance. Use `Multiselect` for tag-style multi-value selection.
359
359
 
360
+ **Toolbar vs tag-editor chips** — in dense table toolbars, multi-select values belong in the **chip row above the table**, with a **count** in the control (see **DataTable patterns**). Do not pile chips inside the combobox there; it breaks horizontal layouts. Standalone tag editors (e.g. form fields that edit a list of tags) may keep chips in the field.
361
+
360
362
  ---
361
363
 
362
364
  ### Navigation
@@ -371,9 +373,10 @@ All inputs default to `radius="sm"` and `size="sm"` matching the button default.
371
373
 
372
374
  `Modal` · `ConfirmationModal` · `Drawer` · `Menu` · `Popover` · `ConfirmationPopover` · `Tooltip`
373
375
 
374
- - `ConfirmationModal` — preconfigured two-button (confirm/cancel) modal for destructive actions
375
- - `ConfirmationPopover` — inline confirm/cancel popover; preferred over modal for lower-stakes confirmations that don't require full-screen focus
376
- - `Menu` accepts typed `MenuItem` and `MenuSection` arrays for structured dropdowns
376
+ - `ConfirmationModal` — preconfigured two-button (confirm/cancel) modal. Use for **bulk, high-stakes, or multi-item** destructive actions that need full-screen focus. Pass `confirmVariant="danger"` and irreversible copy (e.g. “cannot be undone”); set `confirmLabel` to the action (e.g. Delete).
377
+ - `ConfirmationPopover` — inline confirm/cancel popover. **Preferred** for single-item, lower-stakes confirmations that do not need full-screen focus. Same `confirmVariant="danger"` / irreversible-copy rules for deletes.
378
+ - Destructive flows are always two-step: the user chooses Delete, then confirms in Modal or Popover. Never delete on the first click. There is no type-to-confirm or second dialog in the DS.
379
+ - `Menu` accepts typed `MenuItem` and `MenuSection` arrays for structured dropdowns. Use for overflow / row-action menus; mark destructive items with the menu’s danger affordance and open confirm (above) instead of deleting immediately.
377
380
 
378
381
  ---
379
382
 
@@ -381,6 +384,11 @@ All inputs default to `radius="sm"` and `size="sm"` matching the button default.
381
384
 
382
385
  `Alert` · `Avatar` · `Badge` · `Card` · `CardSection` · `Chip` · `Pill` · `Indicator` · `Progress` · `ThemeIcon` · `List` · `Table`
383
386
 
387
+ **Alert vs Notification**
388
+ - Prefer micro-container **toasts** via `document.body.dispatchEvent(new CustomEvent('ad-toast', { detail: { title, message, type } }))` for transient success/info after an action (saved, exported, queued). Do **not** use Mantine `Notification` / `@mantine/notifications` in app or prototype code — `ds-enforce` disallows it.
389
+ - Use **Alert** for persistent in-page status: errors that block or explain the view, empty/error banners in the table shell, or page-level messaging that must stay visible until dismissed or resolved.
390
+ - Alert stays `variant="light"`. Status color is `info` / `success` / `danger` / `pending` / `default` — never `warning` on Alert. Always pair status color with icon and text.
391
+
384
392
  **Badge:**
385
393
  - Variants: `filled` (default) · `outline` · `info` · `success` · `pending` · `warning` · `danger` · `default`
386
394
  - Colors: `info` · `success` · `pending` · `warning` · `danger` · `default` · `blue` · `green` · `yellow` · `red` · `gray`
@@ -489,9 +497,43 @@ Figma auto-layout mapping: `flex-direction: column` → `Stack`; `flex-direction
489
497
  - Server-side sort via `SortableHeaderCell` in column headers (state lives in the page)
490
498
  - Row selection (`rowSelection`, `onRowSelectionChange`) with a selection banner and bulk `selectionActions`
491
499
  - Density (`xs` 10px, `md` 16px, `xl` 32px; both axes) and fullscreen, both controlled
492
- - Top toolbar with search, filter chips and date range; bottom toolbar with pagination
500
+ - Top toolbar with search, filter toggle, filter chips and date range; bottom toolbar with pagination
493
501
  - Loading skeleton rows, empty and error states
494
502
  - Styled with `--ad-table-*` tokens in CSS modules (the one place CSS modules are allowed, because the grid diverges from Mantine's supported MRT)
503
+ - Interaction patterns (filters, delete confirm, row overflow menu, narrow width) — see **DataTable patterns** below
504
+
505
+ #### DataTable patterns
506
+
507
+ **Filters (toolbar)** — search stays always visible. Extra filters are tucked behind a filter `ActionIcon` next to search (`variant="default"` when closed, `"outline"` when open). Show an `Indicator` on the toggle when any non-search filter is active. Opening the toggle reveals a panel (`SimpleGrid`, typically 3 columns) of filter controls. Applied filters appear as dismissible chips; toolbar “Clear filters” clears chip filters but **keeps** search. Empty-state / full reset may also clear search — treat that as a different action from toolbar clear. Product tables own filter state via controlled `filters` / `onFiltersChange` / `showFilters` / `onFilterToggleChange`. The reference toolbar’s city + date-range filters are demo-hardcoded; replace them with the page’s real filter fields. Do not treat the orphan `FilterSystem` demo as the DataTable filter API.
508
+
509
+ **Multi-select filters / chips** — multi-select controls show a **count** in the control; selected values appear as **chips in the chip row above** the table, not stuffed inside the combobox. Do **not** use Mantine’s default of rendering many chips inside the combobox — it breaks horizontal toolbar layouts. Single-value filters (e.g. a date string) may display their value inside the control. See also Combobox.
510
+
511
+ **Selection** — changing search or filters clears all row selections. Selecting rows across pages is allowed while the same search/filter criteria stay in place.
512
+
513
+ **Action hierarchy (list pages)**
514
+ - **Primary** (page / `PageContentHeader` or facets bar): Create new, Export / Download CSV — one primary CTA max.
515
+ - **Secondary** (selection banner): bulk actions on selected rows (delete, save, duplicate) — still confirm destructive ones (see Overlays).
516
+ - **Tertiary** (row ⋯ / table kebab): Export CSV and other low-frequency table actions.
517
+ - **Facets**: when the page has facet navigation, use `Tabs` **outside** the expandable filters panel.
518
+ - **Toolbar**: search always visible; show/hide filters; density (3 levels); fullscreen expand/shrink; optional show/hide columns when product needs it.
519
+ - **Footer**: result/record count + cursor pagination.
520
+
521
+ **Destructive delete** — always two-step (see Overlays). Wire confirm from `selectionActions.onClick` (bulk) or the row Delete menu item; do not delete on first click. Bulk / multi-item / high-stakes → `ConfirmationModal` with `confirmVariant="danger"`. Single low-stakes row delete → `ConfirmationPopover`. The reference table’s selection banner Delete does not open confirm yet — product UIs must still follow this pattern.
522
+
523
+ **Row actions (⋯)** — DataTable has no built-in actions column. Compose a trailing column (or last cell) with one overflow control: `ActionIcon` (default variant) + `RiMore2Fill`, translated `aria-label`, opening a `Menu` of secondary actions. `secret` is a Button variant only — never use it on ActionIcon (allowed ActionIcon variants: `default`, `outline`, `link`). Prefer the overflow menu over a row of icon buttons when there is more than one secondary action. Destructive items use the menu danger affordance and open confirm (above), not immediate delete. Same overflow trigger pattern as `DashboardWidget`’s actions menu.
524
+
525
+ **Narrow width** — supported strategy is horizontal scroll inside the table shell (`overflow: auto`) with a sticky header. Columns keep min widths; the grid does not collapse to cards or hide columns at breakpoints. Use `CellHoverReveal` for truncated cell text. Prioritize fewer, meaningful default columns. Do not invent stacked/card table layouts for admin list pages unless product design (Design Ops / the owning UX designer) explicitly adds them and updates this file.
526
+
527
+ #### List page composition
528
+
529
+ Standard admin list stack (top → bottom):
530
+
531
+ 1. `PageContentHeader` — icon, title, subhead, page-level actions (required on prototype/admin list and detail pages). Pick one `contentSection`: Insights, Description, Name/Value Pairs, or Drawer. Keep description copy short; link out rather than long text that goes stale.
532
+ 2. Optional page-level status — Panel Notification or in-page `Alert` (not a toast) when the whole view needs persistent messaging.
533
+ 3. Optional facet `Tabs` — outside the DataTable filter panel when the page has facet navigation.
534
+ 4. `DataTable` — toolbar → grid → footer (see **DataTable patterns**).
535
+
536
+ Detail pages use `PageContentHeader` + Cards / forms instead of DataTable. Do not invent alternate list chrome that skips PCH or relocates search/filters outside the DataTable toolbar pattern above.
495
537
 
496
538
  **KeyInsight** — single KPI tile: `value`, `title`, `subtitle`, optional right border divider
497
539
 
@@ -597,7 +639,7 @@ This order is already configured in `app/layout.tsx` and `.storybook/preview.tsx
597
639
  | `@mantine/core` | `^9.6.0` | Base component library |
598
640
  | `@mantine/hooks` | `^9.6.0` | Utility hooks (useDisclosure, etc.) |
599
641
  | `@mantine/dates` | `^9.6.0` | Date/time inputs |
600
- | `@mantine/notifications` | `^9.6.0` | Toast notifications |
642
+ | `@mantine/notifications` | `^9.6.0` | Do not use in apps — prefer micro-container `ad-toast` (see Alert vs Notification) |
601
643
  | `@mantine/dropzone` | `^9.6.0` | File drag-and-drop |
602
644
  | `@appdirect/design-tokens` | `^0.0.6` | AppDirect token CSS variables (`--ad-*`) |
603
645
  | `@tabler/icons-react` | `^3.33.0` | Icon library (supplementary) |
@@ -626,9 +668,9 @@ Per-token annotations that don't fit naturally into the prose sections above. Th
626
668
  1. **AppDirect Navy tokenization** — `#011B58` is hardcoded in `AppShellLayout.tsx`; will become `--ad-color-brand-navy` (or similar) once the brand color group is added to `@appdirect/design-tokens`
627
669
  2. **Dark mode toggle** — `[data-theme="dark"]` tokens are fully defined; the app needs a toggle that sets this attribute on `<html>` and persists the preference
628
670
  3. **Form composition patterns** — document label placement, required field indicators, error/validation states, help text, and field grouping conventions
629
- 4. **Page-level composition patterns** — document standard list page (PageContentHeader + DataTable) and detail page (PageContentHeader + Cards) structures with code examples
671
+ 4. **Page-level composition patterns** — list-page stack and detail-page sketch are documented under **List page composition** and **DataTable patterns** (including Figma-derived action hierarchy, selection, and chip rules). Remaining work is optional code examples for full page scaffolding.
630
672
  5. **Loading / empty / error states** — document how to handle async loading (Button `loading`, Progress, Skeleton), empty DataTable, and form validation errors
631
673
  6. **Component token expansion** — remaining components in `@appdirect/design-tokens/tokens/components/*.json` (30+ files) not yet reflected in the `components:` YAML block
632
674
  7. **Prose pass** — brand/DS leads should revise Overview + Do's-and-Don'ts sections for voice and rationale
633
- 8. **Harvest Figma component docs** — each Figma component has a `utilities/doc-section` with usage guidance; extract and merge into Components subsections
675
+ 8. **Selective Figma harvest** — prefer AppDirect annotations / IA (e.g. Table Control Panel) over generic `utilities/doc-section` boilerplate. This pass covers table/list composition, filter chips, selection rules, and Alert vs Notification. Harvest further component pages only when marker annotations or AppDirect-specific descriptions add new rules.
634
676
  9. **Wire into tokens pipeline** — `@appdirect/design-tokens` will emit a `dist/design-spec.yaml` adapter; a `sync-design-docs` script in this repo will replace the YAML front matter automatically on `npm install`. Backlog item added to `appdirect-design-tokens/CLAUDE.md`.
@@ -0,0 +1,11 @@
1
+ # Micro UI agent kit
2
+
3
+ Copied into AppDirect micro UIs by `ad-sync-agents` (from `@appdirect/design-system` postinstall / `npm run sync-agents`).
4
+
5
+ **Not** agent instructions for this design-system repo. Authoring paths:
6
+
7
+ - Skills: edit under `agent-kit/skills/` (`.cursor/skills/<name>` in the design-system app is a symlink here)
8
+ - Rules: `agent-kit/rules/*.mdc`
9
+ - AGENTS: `agent-kit/micro-ui/micro-ui.AGENTS.md` (named so this package is not loaded as `AGENTS.md` here)
10
+
11
+ Consumers: sync runs only in micro UI projects (`src/components/Root` **and** Module Federation exposes `./Root` in rspack/webpack config). Default: add missing files; refresh untouched kit docs/skills (hash in `.claude/skills/.ad-agent-kit.json` — **commit that file**). Rules are never overwritten. `ad-sync-agents --force` overwrites kit AGENTS.md, CLAUDE.md, and skills (skill directories are deleted and recreated). `prototype-page` and `figma-to-page` sync only when the consumer has a `standalone/` directory. Under `postinstall`, sync errors warn and exit 0 so they do not fail `npm install`.
@@ -0,0 +1,81 @@
1
+ {
2
+ "version": 1,
3
+ "docs": [
4
+ {
5
+ "id": "agents",
6
+ "source": "micro-ui/micro-ui.AGENTS.md",
7
+ "dest": "AGENTS.md"
8
+ },
9
+ {
10
+ "id": "claude",
11
+ "source": "micro-ui/CLAUDE.md",
12
+ "dest": "CLAUDE.md"
13
+ }
14
+ ],
15
+ "rules": [
16
+ {
17
+ "id": "accessibility",
18
+ "source": "rules/accessibility.mdc",
19
+ "dest": ".cursor/rules/accessibility.mdc"
20
+ },
21
+ {
22
+ "id": "module-federation",
23
+ "source": "rules/module-federation.mdc",
24
+ "dest": ".cursor/rules/module-federation.mdc"
25
+ },
26
+ {
27
+ "id": "react-stack",
28
+ "source": "rules/react-stack.mdc",
29
+ "dest": ".cursor/rules/react-stack.mdc"
30
+ },
31
+ {
32
+ "id": "testing",
33
+ "source": "rules/testing.mdc",
34
+ "dest": ".cursor/rules/testing.mdc"
35
+ }
36
+ ],
37
+ "skills": [
38
+ {
39
+ "id": "design-feature",
40
+ "source": "skills/design-feature",
41
+ "dest": ".claude/skills/design-feature"
42
+ },
43
+ {
44
+ "id": "mantine-combobox",
45
+ "source": "skills/mantine-combobox",
46
+ "dest": ".claude/skills/mantine-combobox"
47
+ },
48
+ {
49
+ "id": "mantine-form",
50
+ "source": "skills/mantine-form",
51
+ "dest": ".claude/skills/mantine-form"
52
+ },
53
+ {
54
+ "id": "mantine-custom-components",
55
+ "source": "skills/mantine-custom-components",
56
+ "dest": ".claude/skills/mantine-custom-components"
57
+ },
58
+ {
59
+ "id": "figma-mcp-integration",
60
+ "source": "skills/figma-mcp-integration",
61
+ "dest": ".claude/skills/figma-mcp-integration"
62
+ },
63
+ {
64
+ "id": "developer-handoff",
65
+ "source": "skills/developer-handoff",
66
+ "dest": ".claude/skills/developer-handoff"
67
+ },
68
+ {
69
+ "id": "prototype-page",
70
+ "source": "skills/prototype-page",
71
+ "dest": ".claude/skills/prototype-page",
72
+ "requires": "standalone"
73
+ },
74
+ {
75
+ "id": "figma-to-page",
76
+ "source": "skills/figma-to-page",
77
+ "dest": ".claude/skills/figma-to-page",
78
+ "requires": "standalone"
79
+ }
80
+ ]
81
+ }
@@ -0,0 +1 @@
1
+ @AGENTS.md
@@ -0,0 +1,62 @@
1
+ # Micro UI
2
+
3
+ A marketplace micro UI loaded through Module Federation (`remoteEntry.js`, exposes `./Root`). Typical scripts: `npm start` (dev remote), `npm test`, `npm run build`. Ports and exact script names may differ per repo — follow this app's `package.json`.
4
+
5
+ ## Where agent instructions live
6
+
7
+ This file is read by Cursor, Claude Code, Codex, Copilot and other tools that follow [AGENTS.md](https://agents.md/). `CLAUDE.md` imports it for Claude Code sessions that only read `CLAUDE.md`.
8
+
9
+ - Always on: this file. Folder rules: `AGENTS.md` inside a folder (for example `__e2e__/AGENTS.md`) load when an agent works in that folder. Each one has a `CLAUDE.md` beside it that imports it, because Claude Code skips `AGENTS.md` once a `CLAUDE.md` exists.
10
+ - Rules scoped to file patterns: edit `.cursor/rules/*.mdc`. Claude Code copies live in `.claude/rules/` (`ad-sync-agents` generates them from kit `.mdc` files; some repos also have `npm run rules:sync`). Kit rules ship from `@appdirect/design-system` via `ad-sync-agents` (add only if missing; never overwritten).
11
+ - Skills: `.claude/skills/<name>/SKILL.md` ([Agent Skills](https://agentskills.io) format). Cursor and Claude Code both load this folder (`.cursor/skills` symlinks here). Shared skills come from `@appdirect/design-system` on `npm install` / `npm run sync-agents`. Change them in ad-design-system `packages/components/agent-kit/`. `npm run sync-agents:force` overwrites kit AGENTS.md, CLAUDE.md, and skills; rules stay add-if-missing. `prototype-page` / `figma-to-page` sync only when `standalone/` exists.
12
+ - MCP servers: `.cursor/mcp.json` for Cursor, `.mcp.json` for Claude Code. Keep both lists the same.
13
+
14
+ ## Route first
15
+ - Figma URL or node id → use the `figma-mcp-integration` skill before any Figma MCP call.
16
+ - Rspack, `src/index.tsx`, `src/components/Root`, `src/providers/` or Shadow DOM → follow the `module-federation` rule.
17
+
18
+ ## Always follow the design system
19
+
20
+ When building or editing UI, follow **Design system** below and [`docs/DESIGN.md`](docs/DESIGN.md). Stories and Figma never override these rules; when they conflict, this file wins. `docs/DESIGN.md` consumption rules are for the design-system package authors — this file wins for app code.
21
+
22
+ `docs/DESIGN.md` is synced from `@appdirect/design-system` (canonical [`apps/design-system/DESIGN.md`](https://github.com/AppDirect/ad-design-system/blob/master/apps/design-system/DESIGN.md)) on `npm install` (`postinstall` / `npm run sync-design-docs`). Do not hand-edit that file; bump the design-system package and reinstall to refresh it.
23
+
24
+ ## Design system
25
+
26
+ CSS tokens come from `@appdirect/design-tokens`. Enforcement is `@appdirect/ds-enforce`.
27
+
28
+ ### Components
29
+ Import from `@mantine/core` and `@mantine/dates`. Which imports are outside the design system is decided by `@appdirect/ds-enforce`, not by a list in this file. ESLint `ds/no-unadopted-mantine` warns on `mantineDisallowed` in `@appdirect/ds-enforce/eslint/contracts.json`. Also honor `ds/contract-props`, `ds/uncontracted-props`, `ds/no-theme-override`, `ds/no-tailwind-classnames`. A component missing from the examples below is still allowed when that warning does not fire.
30
+ When the warning fires: do not delete the import and do not refuse to write it. The component is not in the design system yet. Prefer the replacement named in the warning unless this component is required. Tell the user it is outside the UX-approved list.
31
+ Reach for these first. Buttons: Button, ActionIcon, CloseButton. Inputs: TextInput, Textarea, NumberInput, ColorInput, Slider, Switch, SegmentedControl, Checkbox, Radio, RadioGroup, FileInput, Dropzone, DatePickerInput (`@mantine/dates`, as in the Table filters). Combobox: Select, Autocomplete, MultiSelect, Combobox. Navigation: Tabs, Breadcrumbs, NavLink, Stepper, Anchor.
32
+ Overlays: Modal, Drawer, Menu, Popover, Tooltip. Data: Alert, Avatar, Badge, Card, Card.Section, Chip, Pill, Indicator, Progress, ThemeIcon, List, Skeleton; data grids = `src/components/Table`. Type: Title, Text, Code, Kbd. Misc: Divider, Paper. Layout: Stack, Group, Box, SimpleGrid, Grid, Flex, Container, Center.
33
+ Provider/infra imports (`MantineProvider`, `createTheme`, `DatesProvider`) live only in `src/providers/` and `__setup__/`.
34
+
35
+ ### Layout, type, and chrome
36
+ - Page structure: `Stack` / `Group` / `Grid` / `Box` — no ad-hoc `div` + flex/grid.
37
+ - Spacing: token scale only (`none`, `xxs`–`xxl` or `--ad-spacing-*`); no raw pixel padding, gap, or margin.
38
+ - Type: `Title` `order` without skipped levels; no pixel `font-size`; labels `fw={600}`; `Code` for IDs and timestamps.
39
+ - Radius: default `sm`; `full` only for avatars — not buttons, badges, or chips.
40
+ - Status colour only on Badge, Alert, Chip, Indicator; pair with icon or text. Alert yellow is `pending`, not `warning`.
41
+ - Shadows only for interactive layers, not decoration.
42
+ - Icons: Remix (`@remixicon/react` or SVGR); Tabler only inside Mantine internals; `@appdirect/ad-svg-icons` legacy. Size with the `size` number prop — do not resize in CSS.
43
+
44
+ ### Buttons (default `size="sm"`, `radius="sm"`)
45
+ - `primary`: solid brand blue, the main action, max one per view. `secondary`: solid cyan, black text — AppDirect's secondary CTA, use deliberately. `default`: white, neutral border — the everyday action. `disabled`: non-interactive.
46
+ - `outline`: transparent, brand text + border — lower-emphasis alternative beside a primary. `danger`: destructive only. `link`: reads as a link inside a button layout. `secret`: low-affordance Button only (overflow menus, secondary toolbars) — never on ActionIcon.
47
+ - ActionIcon variants: `default` (light blue fill), `outline` (neutral bordered), `link` (transparent). For row ⋯ menus use `default`, not `secret`.
48
+ - Never Mantine `filled`/`light`/`subtle`/`transparent`/`white`/`gradient`.
49
+
50
+ ### Colour
51
+ - `--ad-*` tokens only. `--mantine-color-*`, hex, `rgb()/rgba()` and palette props (`color="blue"`, `c="gray.6"`, `c="dimmed"`, `bg="gray.0"`) are forbidden. Sole exception: `#011B58` in app chrome.
52
+ - Allowed non-colour Mantine vars: `--mantine-{spacing,radius,font-size,line-height,shadow,z-index}-*`.
53
+ - Alert stays `variant="light"`. Status colour is `info`, `success`, `danger`, `pending`, or `default`, plus icon and text. `warning` is a Badge variant, not an Alert colour.
54
+ - Secondary text: CSS module `color: var(--ad-color-text-dimmed)`. Links: `--ad-color-text-link`. Borders: `--ad-color-border-default` / `-subtle` / `-strong`.
55
+
56
+ ### Scales
57
+ - Spacing `none`, `xxs`–`xxl` (props or `--ad-spacing-*`). Button, Badge, and Alert radius are fixed at `sm`. Avatar stays circular.
58
+
59
+ ### Styling order
60
+ DS component props → Mantine style props (non-colour) → CSS module using `--ad-*`, attached with `className` on the component root. Never `style`, `styles`, `vars` or `classNames` on DS components. Never Tailwind classes. Global CSS only in `src/providers/MantineProviderWrapper/global.css`.
61
+
62
+ Rationale and token tables: [`docs/DESIGN.md`](docs/DESIGN.md).
@@ -0,0 +1,46 @@
1
+ ---
2
+ description: Accessibility rules for micro-UI React/Mantine components (WCAG 2.1 AA) — input labels, accessible names, overlays, headings, status announcements, tables, focus. Covers only what lint cannot catch.
3
+ globs: src/**/*.tsx,src/**/*.module.css
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Accessibility (WCAG 2.1 AA)
8
+
9
+ Target: text contrast 4.5:1 (3:1 large, 1.4.3); UI components and focus indicators 3:1 (1.4.11); async results announced (4.1.3).
10
+ Contrast is owned by the `--ad-*` tokens and DS variants (checked by cypress-axe, `__e2e__/AGENTS.md`). Never override a colour "for contrast" — raise it with design.
11
+ Colours, variants, allowlist → root `AGENTS.md`. `translate`, routing → `react-stack.mdc`. Tests → `testing.mdc`.
12
+
13
+ ## Names and labels
14
+ - Every accessible name (`aria-label`, `alt`, `title`, `closeButtonLabel`, …) is a `translate(...)` call — never an English literal.
15
+ - Inputs: visible `label` by default. `aria-label` only when the Figma design has no visible label (e.g. table search); then it is translated and the PR says "no visible label per design". Placeholder is never a label. Helper text in `description`, errors in `error` — Mantine wires both to `aria-describedby`.
16
+ - Icon-only controls: `<ActionIcon variant="default" size="md" aria-label={translate("x.delete")}><RiDeleteBinLine size={18} aria-hidden /></ActionIcon>`. Icons are always `aria-hidden`; the control carries the name.
17
+ - Link text says where it goes ("View invoice #123"), never "Click here" / "Read more".
18
+
19
+ ## Overlays
20
+ - `Modal`/`Drawer`: always pass `title`. With no visible title, use `Modal.Root` + `Modal.Content aria-label={...}` — `aria-label` on `<Modal>` lands on the wrapper, not the `role="dialog"` element. Test it with `getByRole('dialog', { name })`.
21
+ - Always `closeButtonProps={{ 'aria-label': translate("common.close") }}`. `data-autofocus` on the element that should get initial focus. Never disable `trapFocus`, `closeOnEscape` or `returnFocus`.
22
+ - `Alert withCloseButton` always has `closeButtonLabel={translate(...)}`.
23
+ - `Menu`: never `trigger="hover"`. Click is the default; `trigger="click-hover"` if hover is required.
24
+
25
+ ## Headings (owned here)
26
+ - A page micro UI (one routed in `src/navigation/router.tsx`) renders exactly one `<Title order={1}>` — the page title, matching `usePageTitle`. The host header has no page heading.
27
+ - A widget micro UI embedded in someone else's page starts at `order={2}`.
28
+ - Never skip levels. Change the look with `size` (`<Title order={3} size="h5">`), never with a wrong `order`.
29
+
30
+ ## Status announcements
31
+ - Status visuals follow the root `AGENTS.md` design system (DS variant + Remix icon + text).
32
+ - Async results (saved, failed, N results) are announced: `Alert` (renders `role="alert"`) for errors, a `role="status"` region for non-urgent updates.
33
+
34
+ ## Tables
35
+ - Every data table has an accessible name: `DataTableGrid` must forward a translated `aria-label` (or `aria-labelledby` pointing at the visible title) to Mantine `<Table>`. The reference implementation doesn't yet — add the prop when you build a table.
36
+ - Sortable headers: the `<Table.Th>` carries `aria-sort` (`ascending`/`descending`/`none`) and wraps the label in an `UnstyledButton`. The reference `SortableHeaderCell` is a clickable `Flex` with neither — fix it when you touch it.
37
+ - Scroll container, only when it actually scrolls: `role="region"` + `aria-labelledby` (or `aria-label`) + `tabIndex={0}`. Never `aria-label` on a plain `div`.
38
+
39
+ ## Interaction and focus
40
+ - No clickable `div`/`span`/`Box`/`Flex`, not even with `role="button"`. A clickable card is `Card component={Link} to=…` (in-app), `Card component="a" href=…` (external) or `Card component="button"` (action).
41
+ - Never `outline: none` / `outline: 0` without an equivalent visible focus style. Focus rings come from the theme and the DS adapter — don't restyle them.
42
+
43
+ ## Lint boundary
44
+ - Enforced by eslint-plugin-jsx-a11y in `eslint.config.cjs` (the config `npm run lint` loads), don't restate: `alt-text`, `no-autofocus`, `tabindex-no-positive`, `click-events-have-key-events`, `no-static-element-interactions`, `interactive-supports-focus`, `anchor-is-valid`, `anchor-has-content`, `heading-has-content`, `aria-props`, `role-has-required-aria-props`.
45
+ - `eslint.config.cjs` must set `settings['jsx-a11y']: { polymorphicPropName: 'component', components: { Anchor: 'a', Button: 'button', ActionIcon: 'button', UnstyledButton: 'button' } }` and `'jsx-a11y/anchor-is-valid': ['error', { components: ['Link'], specialLink: ['to'], aspects: ['noHref', 'invalidHref', 'preferButton'] }]`.
46
+ - NOT enforced by lint: `aria-label` on `ActionIcon`/`CloseButton` (airbnb turns `control-has-associated-label` off) — that check lives here and in Bugbot.
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: Module Federation, Shadow DOM and provider setup for micro UIs — rspack.config.js, src/index.tsx, src/components/Root, src/providers (MantineProviderWrapper, DatesProviderWrapper), CSS injection, portals, DOM access. Read before touching any of these.
3
+ globs: rspack.config.js,src/index.tsx,src/components/Root/**,src/providers/**
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Module Federation + Shadow DOM
8
+
9
+ ## How a micro UI is loaded
10
+ - The host loads `./Root` from `remoteEntry.js` (rspack `ModuleFederationPlugin`, name from `APPNAME`). `./RemoteReact` and `./RemoteReactDom` are exposed so the host renders `Root` with this remote's own React. There is no `shared` config — do not add one.
11
+ - In the monolith, `src/index.tsx` defines `window.startMicroUI`, which mounts `Root` into `#app` (inside a shadow root when `SHADOW_ROOT` is true).
12
+ - `bypassReactIntlGlobalContext` must stay the FIRST import in both `src/index.tsx` and `src/components/Root`.
13
+
14
+ ## Provider stack (only in Root — components never create their own)
15
+ `AppDirectContextProvider` → `MantineProviderWrapper` (includes `DatesProviderWrapper`) → `QueryClientProvider` → `AppDirectI18nProvider` → `RouterProvider`.
16
+ - The Mantine theme is built in `src/providers/MantineProviderWrapper`: it starts from the host's `window.mantineTheme` and adds overrides in `getMantineExtendedComponents()`. Put DS component defaults there (e.g. `Button.extend({ defaultProps: { variant: 'default', size: 'sm' } })`). Never call `createTheme` elsewhere.
17
+ - Colour scheme comes from the host (`window.mantineColorSchemeManager`, `window.mantineDefaultColorScheme`). Never force one.
18
+
19
+ ## CSS
20
+ - Light DOM (default, `useShadowRoot = false` in rspack.config.js): styles are injected into `#microui-app-styles` / `#microui-app-styles-modules`; the host provides `--ad-*` variables at `:root`. Never import `@appdirect/design-tokens/css/*` from components.
21
+ - Shadow DOM (`useShadowRoot = true`): styles are tagged `data-shadow-style` and copied into the shadow root by `src/index.tsx`; PostCSS rewrites `:root` → `:host`; `foundations.css` is required by `MantineProviderWrapper` because the shadow root can't inherit the host's variables.
22
+ - Mantine component CSS is imported per component in `MantineProviderWrapper/index.tsx`. Using a new allowlisted component → add its `@mantine/core/styles/<Component>.css` import there.
23
+ - Global CSS only in `MantineProviderWrapper/global.css`; rspack ignores global CSS elsewhere in `src/` on purpose (it would break host header branding). Everything else is a `.module.css`.
24
+
25
+ ## Portals in Shadow DOM
26
+ - Mantine portals default to `document.body`, outside the shadow root, so overlays lose their styles. In Shadow DOM mode, set a portal target once in `getMantineExtendedComponents()`: `Portal.extend({ defaultProps: { target: shadowPortalEl } })`, where `shadowPortalEl` is an `HTMLElement` created inside the shadow root. Never a selector string, never per component.
27
+
28
+ ## DOM access
29
+ - `document` is the host page. Never `document.querySelector`/`getElementById` for app elements; use refs. Global listeners only through Mantine hooks (`useWindowEvent`, `useClickOutside`) or with cleanup.
30
+ - Breakpoints (`visibleFrom`, `hiddenFrom`) follow the host viewport. Prefer `Grid type="container"` / `SimpleGrid type="container"` for layout that must adapt to its slot.