@appdirect/design-system 0.0.21 → 0.0.23

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 (36) hide show
  1. package/README.md +1 -1
  2. package/dist/Combobox/Select.js +11 -2
  3. package/dist/Combobox/Select.module.css +8 -0
  4. package/dist/Combobox/Select.tsx +16 -3
  5. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/CustomBottomToolbar.module.css +1 -24
  6. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.js +2 -5
  7. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.tsx +15 -22
  8. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.js +1 -2
  9. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.module.css +2 -9
  10. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.tsx +4 -5
  11. package/dist/ComplexComponents/DataTable/DataTableGrid/DataTableGrid.module.css +2 -6
  12. package/dist/ComplexComponents/DataTable/DataTableGrid/index.js +1 -1
  13. package/dist/ComplexComponents/DataTable/DataTableGrid/index.tsx +1 -1
  14. package/dist/DESIGN.md +11 -7
  15. package/dist/DataDisplay/Alert.js +3 -2
  16. package/dist/DataDisplay/Alert.tsx +4 -1
  17. package/dist/DataDisplay/Badge.js +37 -12
  18. package/dist/DataDisplay/Badge.tsx +42 -12
  19. package/dist/Inputs/NumberInput.js +28 -27
  20. package/dist/Inputs/NumberInput.tsx +53 -32
  21. package/dist/Inputs/Radio.js +1 -1
  22. package/dist/Inputs/Radio.tsx +1 -1
  23. package/dist/Inputs/RadioGroup.js +1 -1
  24. package/dist/Inputs/RadioGroup.tsx +1 -1
  25. package/dist/Overlays/Modal.js +2 -2
  26. package/dist/Overlays/Modal.tsx +2 -2
  27. package/dist/contracts/index.json +1 -1
  28. package/dist/css/foundations.css +44 -2
  29. package/dist/css/mantine.css +1541 -48
  30. package/dist/css/tokens.css +4 -12
  31. package/dist/stories/Inputs/Radio.stories.tsx +10 -5
  32. package/dist/stories/Inputs/RadioGroup.stories.tsx +122 -80
  33. package/dist/stories/Overlays/Drawer.stories.tsx +2 -2
  34. package/dist/stories/Overlays/Modal.stories.tsx +2 -2
  35. package/dist/stories/index.json +1 -1
  36. package/package.json +10 -6
package/README.md CHANGED
@@ -11,7 +11,7 @@ npm install @appdirect/design-system
11
11
  Peer dependencies (install at the versions declared by this package):
12
12
 
13
13
  - `react`, `react-dom`
14
- - `@mantine/core`, `@mantine/dates`, `@mantine/hooks`
14
+ - `@mantine/core`, `@mantine/dates`, `@mantine/dropzone`, `@mantine/hooks`
15
15
 
16
16
  ## What ships in the package
17
17
 
@@ -5,6 +5,7 @@ import { Select as MantineSelect, ActionIcon, Group } from '@mantine/core';
5
5
  import { IconInfoCircle, IconSelector } from '@tabler/icons-react';
6
6
  import { Text } from '../Typography/Text.js';
7
7
  import { Tooltip } from '../Overlays/Tooltip.js';
8
+ import styles from './Select.module.css';
8
9
  // ========================== COMPONENT ==========================
9
10
  /**
10
11
  * AppDirect Design System Select Component
@@ -52,7 +53,7 @@ import { Tooltip } from '../Overlays/Tooltip.js';
52
53
  * />
53
54
  * ```
54
55
  */
55
- export const Select = forwardRef(({ size = 'sm', borderless = false, showOptional = false, required, label, hasHelpIcon = false, helpIconLabel, onHelpIconClick, error, errorCaption, variant, ...props }, ref) => {
56
+ export const Select = forwardRef(({ size = 'sm', borderless = false, showOptional = false, required, label, hasHelpIcon = false, helpIconLabel, onHelpIconClick, error, errorCaption, variant, classNames, ...props }, ref) => {
56
57
  const effectiveError = error === true ? (errorCaption ?? true) : error;
57
58
  const enhancedLabel = React.useMemo(() => {
58
59
  if (!label)
@@ -67,6 +68,14 @@ export const Select = forwardRef(({ size = 'sm', borderless = false, showOptiona
67
68
  const composedRightSection = helpIconElement
68
69
  ? _jsxs(Group, { gap: 4, wrap: "nowrap", children: [selectorIcon, helpIconElement] })
69
70
  : selectorIcon;
70
- return (_jsx(MantineSelect, { ref: ref, size: size, radius: "sm", required: required, label: enhancedLabel, rightSection: composedRightSection, rightSectionPointerEvents: hasHelpIcon || props.clearable ? 'auto' : 'none', variant: borderless ? 'unstyled' : (variant ?? 'default'), error: effectiveError, ...props }));
71
+ const mergedClassNames = typeof classNames === 'function'
72
+ ? classNames
73
+ : {
74
+ ...classNames,
75
+ input: [borderless ? styles.borderless : undefined, classNames?.input]
76
+ .filter(Boolean)
77
+ .join(' '),
78
+ };
79
+ return (_jsx(MantineSelect, { ...props, ref: ref, size: size, radius: "sm", required: required, label: enhancedLabel, rightSection: composedRightSection, rightSectionPointerEvents: hasHelpIcon || props.clearable ? 'auto' : 'none', variant: variant ?? 'default', classNames: mergedClassNames, error: effectiveError }));
71
80
  });
72
81
  Select.displayName = 'Select';
@@ -0,0 +1,8 @@
1
+ /* borderless keeps default Input padding; only chrome is removed.
2
+ Do not use Mantine variant="unstyled" — it zeros --input-padding*. */
3
+ .borderless[data-variant]:not([data-error]):not([data-disabled]),
4
+ .borderless[data-variant]:not([data-error]):not([data-disabled]):hover,
5
+ .borderless[data-variant]:not([data-error]):focus {
6
+ background: transparent;
7
+ border-color: transparent;
8
+ }
@@ -6,13 +6,14 @@ import { IconInfoCircle, IconSelector } from '@tabler/icons-react';
6
6
  import { ComponentSize } from '../config';
7
7
  import { Text } from '../Typography/Text';
8
8
  import { Tooltip } from '../Overlays/Tooltip';
9
+ import styles from './Select.module.css';
9
10
 
10
11
  // ========================== TYPES ==========================
11
12
 
12
13
  export interface DSSelectProps extends Omit<MantineSelectProps, 'size' | 'radius' | 'rightSection'> {
13
14
  /** Input size from design system scale */
14
15
  size?: ComponentSize;
15
- /** Whether to use borderless style (unstyled variant) */
16
+ /** No border/fill; keeps normal field padding (does not use Mantine unstyled) */
16
17
  borderless?: boolean;
17
18
  /** Whether to show "(Optional)" text after label */
18
19
  showOptional?: boolean;
@@ -91,6 +92,7 @@ export const Select = forwardRef<HTMLInputElement, DSSelectProps>(
91
92
  error,
92
93
  errorCaption,
93
94
  variant,
95
+ classNames,
94
96
  ...props
95
97
  },
96
98
  ref
@@ -134,8 +136,19 @@ export const Select = forwardRef<HTMLInputElement, DSSelectProps>(
134
136
  ? <Group gap={4} wrap="nowrap">{selectorIcon}{helpIconElement}</Group>
135
137
  : selectorIcon;
136
138
 
139
+ const mergedClassNames =
140
+ typeof classNames === 'function'
141
+ ? classNames
142
+ : {
143
+ ...classNames,
144
+ input: [borderless ? styles.borderless : undefined, classNames?.input]
145
+ .filter(Boolean)
146
+ .join(' '),
147
+ };
148
+
137
149
  return (
138
150
  <MantineSelect
151
+ {...props}
139
152
  ref={ref}
140
153
  size={size}
141
154
  radius="sm"
@@ -143,9 +156,9 @@ export const Select = forwardRef<HTMLInputElement, DSSelectProps>(
143
156
  label={enhancedLabel}
144
157
  rightSection={composedRightSection}
145
158
  rightSectionPointerEvents={hasHelpIcon || props.clearable ? 'auto' : 'none'}
146
- variant={borderless ? 'unstyled' : (variant ?? 'default')}
159
+ variant={variant ?? 'default'}
160
+ classNames={mergedClassNames}
147
161
  error={effectiveError}
148
- {...props}
149
162
  />
150
163
  );
151
164
  }
@@ -4,27 +4,4 @@
4
4
 
5
5
  .pageSize {
6
6
  flex-shrink: 0;
7
- }
8
-
9
- /* The page-size select reads as plain text with a chevron: no fill or border, even on hover and
10
- focus. The selectors are deliberately as specific as the global Input state rules
11
- (:hover / :focus) so they win without !important. */
12
- .pageSize .pageSizeInput[data-variant="unstyled"]:not([data-error]):not([data-disabled]) {
13
- background: transparent;
14
- border-color: transparent;
15
- padding-inline-start: 0;
16
- cursor: pointer;
17
- }
18
-
19
- .pageSizeChevron {
20
- width: var(--ad-icon-size-lg);
21
- height: var(--ad-icon-size-lg);
22
- flex-shrink: 0;
23
- color: var(--ad-color-text-default);
24
- }
25
-
26
- /* The global Input section rule pads both sides, which squeezes the chevron to a few px. */
27
- .pageSize .pageSizeSection[data-position] {
28
- padding-inline: 0;
29
- justify-content: flex-end;
30
- }
7
+ }
@@ -2,15 +2,12 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // Source of truth: micro-ui-ts/src/components/Table/CustomBottomToolbar/index.tsx. Keep in sync; DS-only changes are marked DS-ADAPT.
4
4
  import React, { useMemo } from "react";
5
- import { Box, Flex, Select, ActionIcon, Text } from "@mantine/core";
5
+ import { Flex, Select, ActionIcon, Text } from "@mantine/core";
6
6
  import { RiArrowLeftSLine as PreviousPageIcon } from "@remixicon/react"; // DS-ADAPT: @remixicon/react instead of remixicon svg import
7
7
  import { RiArrowRightSLine as NextPageIcon } from "@remixicon/react"; // DS-ADAPT: @remixicon/react instead of remixicon svg import
8
- import { RiArrowDropDownFill as DropdownIcon } from "@remixicon/react"; // DS-ADAPT: down triangle for the page-size select
9
8
  import { translate } from "../translations/index.js"; // DS-ADAPT: translate lives in DataTable/translations
10
9
  import { getFormattedPageCount, getFormattedPageSize, getNumOfRowsPerPageOptions } from "./utils.js";
11
10
  import styles from "./CustomBottomToolbar.module.css";
12
- /** Keeps the page-size control compact; value is max two digits (e.g. 40). */
13
- const PAGE_SIZE_SELECT_WIDTH = "var(--ad-table-toolbar-page-size-width)";
14
11
  const CustomBottomToolbar = ({ paginationState, onPageSizeChange, onNextPage, onPreviousPage, isDisabled = false, hasNextPage, hasPreviousPage, totalNumOfRows = 0, isFetching = false, numberOfSelectedRowsText, }) => {
15
12
  const rowCount = totalNumOfRows; // DS-ADAPT: derive directly; copying in an effect lags one render
16
13
  const onPageSizeChangeHandler = (newPageSize) => {
@@ -18,7 +15,7 @@ const CustomBottomToolbar = ({ paginationState, onPageSizeChange, onNextPage, on
18
15
  };
19
16
  const formattedPageLegend = getFormattedPageCount(paginationState.pageIndex, paginationState.pageSize, rowCount);
20
17
  const numOfRowsPerPageOptions = useMemo(() => getNumOfRowsPerPageOptions(rowCount, undefined, paginationState.pageSize), [rowCount, paginationState.pageSize]);
21
- return (_jsxs(Flex, { className: styles.toolbar, bg: "var(--ad-color-bg-subtle)", px: "md", py: "xshalf", justify: "space-between", align: "center", children: [_jsxs(Flex, { align: "center", gap: "sm", w: "fit-content", flex: "none", children: [_jsx(Text, { size: "xs", children: translate("table.rows.per.page") }), _jsx(Box, { w: PAGE_SIZE_SELECT_WIDTH, className: styles.pageSize, children: _jsx(Select, { disabled: !rowCount || isDisabled, "aria-label": translate("table.rows.per.page"), data: numOfRowsPerPageOptions, value: paginationState.pageSize.toString(), onChange: onPageSizeChangeHandler, size: "xs", w: "100%", rightSectionWidth: 22, variant: "unstyled", rightSection: _jsx(DropdownIcon, { className: styles.pageSizeChevron }), classNames: { input: styles.pageSizeInput, section: styles.pageSizeSection }, comboboxProps: { withinPortal: false, width: "max-content" } }) })] }), numberOfSelectedRowsText && _jsx(Text, { size: "xs", children: numberOfSelectedRowsText }), _jsxs(Flex, { align: "center", gap: "xs", children: [_jsx(Text, { size: "xs", children: formattedPageLegend }), _jsx(ActionIcon, { "data-testid": "previous-page-btn", disabled: !hasPreviousPage || isDisabled, onClick: () => {
18
+ return (_jsxs(Flex, { className: styles.toolbar, bg: "var(--ad-color-bg-subtle)", px: "md", py: "xshalf", justify: "space-between", align: "center", children: [_jsxs(Flex, { align: "center", gap: "sm", w: "fit-content", flex: "none", children: [_jsx(Text, { size: "xs", children: translate("table.rows.per.page") }), _jsx(Select, { className: styles.pageSize, disabled: !rowCount || isDisabled, "aria-label": translate("table.rows.per.page"), data: numOfRowsPerPageOptions, value: paginationState.pageSize.toString(), onChange: onPageSizeChangeHandler, size: "xs", w: "var(--ad-table-toolbar-page-size-width)", flex: "0 0 auto", allowDeselect: false, comboboxProps: { withinPortal: false, width: "max-content" } })] }), numberOfSelectedRowsText && _jsx(Text, { size: "xs", children: numberOfSelectedRowsText }), _jsxs(Flex, { align: "center", gap: "xs", children: [_jsx(Text, { size: "xs", children: formattedPageLegend }), _jsx(ActionIcon, { "data-testid": "previous-page-btn", disabled: !hasPreviousPage || isDisabled, onClick: () => {
22
19
  if (!isFetching && onPreviousPage) {
23
20
  onPreviousPage();
24
21
  }
@@ -1,10 +1,9 @@
1
1
  'use client'; // DS-ADAPT: Next.js App Router
2
2
  // Source of truth: micro-ui-ts/src/components/Table/CustomBottomToolbar/index.tsx. Keep in sync; DS-only changes are marked DS-ADAPT.
3
3
  import React, { useMemo, ReactElement } from "react";
4
- import { Box, Flex, Select, ActionIcon, Text } from "@mantine/core";
4
+ import { Flex, Select, ActionIcon, Text } from "@mantine/core";
5
5
  import { RiArrowLeftSLine as PreviousPageIcon } from "@remixicon/react"; // DS-ADAPT: @remixicon/react instead of remixicon svg import
6
6
  import { RiArrowRightSLine as NextPageIcon } from "@remixicon/react"; // DS-ADAPT: @remixicon/react instead of remixicon svg import
7
- import { RiArrowDropDownFill as DropdownIcon } from "@remixicon/react"; // DS-ADAPT: down triangle for the page-size select
8
7
  import { PaginationState } from "../types";
9
8
  import { translate } from "../translations"; // DS-ADAPT: translate lives in DataTable/translations
10
9
  import { getFormattedPageCount, getFormattedPageSize, getNumOfRowsPerPageOptions } from "./utils";
@@ -23,9 +22,6 @@ export interface CustomBottomToolbarProps {
23
22
  numberOfSelectedRowsText?: string; // if row selection is enabled
24
23
  }
25
24
 
26
- /** Keeps the page-size control compact; value is max two digits (e.g. 40). */
27
- const PAGE_SIZE_SELECT_WIDTH = "var(--ad-table-toolbar-page-size-width)";
28
-
29
25
  const CustomBottomToolbar = ({
30
26
  paginationState,
31
27
  onPageSizeChange,
@@ -66,22 +62,19 @@ const CustomBottomToolbar = ({
66
62
  >
67
63
  <Flex align="center" gap="sm" w="fit-content" flex="none">
68
64
  <Text size="xs">{translate("table.rows.per.page")}</Text>
69
- <Box w={PAGE_SIZE_SELECT_WIDTH} className={styles.pageSize}>
70
- <Select
71
- disabled={!rowCount || isDisabled}
72
- aria-label={translate("table.rows.per.page")}
73
- data={numOfRowsPerPageOptions}
74
- value={paginationState.pageSize.toString()}
75
- onChange={onPageSizeChangeHandler}
76
- size="xs"
77
- w="100%"
78
- rightSectionWidth={22}
79
- variant="unstyled"
80
- rightSection={<DropdownIcon className={styles.pageSizeChevron} />} // DS-ADAPT: down triangle marks the select as interactive
81
- classNames={{ input: styles.pageSizeInput, section: styles.pageSizeSection }} // DS-ADAPT: chevron, no fill or border
82
- comboboxProps={{ withinPortal: false, width: "max-content" }}
83
- />
84
- </Box>
65
+ <Select
66
+ className={styles.pageSize}
67
+ disabled={!rowCount || isDisabled}
68
+ aria-label={translate("table.rows.per.page")}
69
+ data={numOfRowsPerPageOptions}
70
+ value={paginationState.pageSize.toString()}
71
+ onChange={onPageSizeChangeHandler}
72
+ size="xs"
73
+ w="var(--ad-table-toolbar-page-size-width)"
74
+ flex="0 0 auto"
75
+ allowDeselect={false}
76
+ comboboxProps={{ withinPortal: false, width: "max-content" }}
77
+ />
85
78
  </Flex>
86
79
  {numberOfSelectedRowsText && <Text size="xs">{numberOfSelectedRowsText}</Text>}
87
80
  <Flex align="center" gap="xs">
@@ -121,4 +114,4 @@ const CustomBottomToolbar = ({
121
114
  );
122
115
  };
123
116
 
124
- export default CustomBottomToolbar;
117
+ export default CustomBottomToolbar;
@@ -4,7 +4,6 @@ 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 clsx from "clsx";
8
7
  import { TextInput } from "@mantine/core";
9
8
  import { translate } from "../translations/index.js"; // DS-ADAPT: translate lives in DataTable/translations
10
9
  import styles from "./SearchFilter.module.css";
@@ -37,6 +36,6 @@ const SearchFilter = ({ searchTerm, onChange }) => {
37
36
  useEffect(() => {
38
37
  setLocalSearchTerm(searchTerm);
39
38
  }, [searchTerm]);
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
+ return (_jsx(TextInput, { size: "xs", placeholder: translate("table.search.placeholder"), flex: "1 1 auto", classNames: { section: styles.section }, onChange: (event) => handleSearchChange(event.target.value), rightSection: localSearchTerm === "" ? (_jsx(SearchIcon, {})) : (_jsx(CloseIcon, { className: styles.clearIcon, "data-testid": "search-clear", onClick: clearSearch })), value: localSearchTerm }));
41
40
  };
42
41
  export default SearchFilter;
@@ -1,16 +1,9 @@
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. */
1
+ /* Section slot sizing comes from Mantine; icon size from mantine.css input.section tokens. */
3
2
  .section[data-position] {
4
3
  padding-inline: 0;
5
4
  justify-content: center;
6
5
  }
7
6
 
8
- .icon {
9
- width: var(--ad-icon-size-md);
10
- height: var(--ad-icon-size-md);
11
- flex-shrink: 0;
12
- }
13
-
14
7
  .clearIcon {
15
8
  cursor: pointer;
16
- }
9
+ }
@@ -3,7 +3,6 @@
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 clsx from "clsx";
7
6
  import { TextInput } from "@mantine/core";
8
7
  import { translate } from "../translations"; // DS-ADAPT: translate lives in DataTable/translations
9
8
  import styles from "./SearchFilter.module.css";
@@ -55,16 +54,16 @@ const SearchFilter = ({ searchTerm, onChange }: SearchFilterProps): ReactElement
55
54
  size="xs"
56
55
  placeholder={translate("table.search.placeholder")}
57
56
  flex="1 1 auto"
57
+ classNames={{ section: styles.section }}
58
58
  onChange={(event): void => handleSearchChange(event.target.value)}
59
- classNames={{ section: styles.section }} // DS-ADAPT: icon sizing via tokens in a module
60
59
  rightSection={
61
60
  localSearchTerm === "" ? (
62
- <SearchIcon className={styles.icon} />
61
+ <SearchIcon />
63
62
  ) : (
64
63
  <CloseIcon
64
+ className={styles.clearIcon}
65
65
  data-testid="search-clear"
66
66
  onClick={clearSearch}
67
- className={clsx(styles.icon, styles.clearIcon)}
68
67
  />
69
68
  )
70
69
  }
@@ -73,4 +72,4 @@ const SearchFilter = ({ searchTerm, onChange }: SearchFilterProps): ReactElement
73
72
  );
74
73
  };
75
74
 
76
- export default SearchFilter;
75
+ export default SearchFilter;
@@ -38,12 +38,8 @@
38
38
  box-sizing: border-box;
39
39
  }
40
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 {
41
+ /* Toolbar border-top is the line under the grid; tokens drop the last tbody row border. */
42
+ .body > .bodyRow:last-of-type[data-with-row-border] {
47
43
  border-bottom: none;
48
44
  }
49
45
 
@@ -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: 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() })] }));
44
+ return (_jsxs(Table, { className: styles.rootGrid, highlightOnHover: false, "data-density": density, withRowBorders: true, 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,7 +116,7 @@ const DataTableGrid = <TData extends RowData>({
116
116
  className={styles.rootGrid}
117
117
  highlightOnHover={false}
118
118
  data-density={density}
119
- withRowBorders={false}
119
+ withRowBorders
120
120
  withTableBorder={false}
121
121
  __vars={columnSizeVars as unknown as ComponentProps<typeof Table>["__vars"]} // DS-ADAPT: Mantine 9 CssVarsProp typing
122
122
  >
package/dist/DESIGN.md CHANGED
@@ -623,12 +623,16 @@ These variables are injected by `@appdirect/design-tokens/css/foundations.css` a
623
623
  ### CSS load order
624
624
 
625
625
  ```css
626
- @mantine/core/styles.css /* Mantine base */
626
+ @mantine/core/styles.css /* Mantine base — not styles.layer.css */
627
627
  @appdirect/design-tokens/css/foundations.css /* --ad-* variables */
628
+ @appdirect/design-tokens/css/open-color.css /* --ad-open-color-* (host always loads this) */
628
629
  @appdirect/design-tokens/css/mantine.css /* Mantine component overrides */
630
+ @mantine/dates/styles.css /* when using dates */
629
631
  ```
630
632
 
631
- This order is already configured in `app/layout.tsx` and `.storybook/preview.tsx`. Do not reorder.
633
+ Do **not** import `tokens.css` in Mantine apps (duplicates foundations; unused by the adapter).
634
+
635
+ **Platform parity (micro-container + micro-ui-ts):** the host loads `foundations.css` + `open-color.css` and sets `window.mantineTheme` / `data-theme`. The remote loads Mantine component CSS (per-file allowlist) → `mantine.css` → dates, and merges the host theme in `MantineProvider`. Storybook and `app/layout.tsx` must follow the same order and host bridge so previews match remotes. See `packages/tokens/CONSUMING.md` Recipe 1.
632
636
 
633
637
  ---
634
638
 
@@ -636,11 +640,11 @@ This order is already configured in `app/layout.tsx` and `.storybook/preview.tsx
636
640
 
637
641
  | Package | Version | Role |
638
642
  |---|---|---|
639
- | `@mantine/core` | `^9.6.0` | Base component library |
640
- | `@mantine/hooks` | `^9.6.0` | Utility hooks (useDisclosure, etc.) |
641
- | `@mantine/dates` | `^9.6.0` | Date/time inputs |
642
- | `@mantine/notifications` | `^9.6.0` | Do not use in apps — prefer micro-container `ad-toast` (see Alert vs Notification) |
643
- | `@mantine/dropzone` | `^9.6.0` | File drag-and-drop |
643
+ | `@mantine/core` | `^9.8.2` | Base component library (peer of `@appdirect/design-system`) |
644
+ | `@mantine/hooks` | `^9.8.2` | Utility hooks (useDisclosure, etc.) |
645
+ | `@mantine/dates` | `^9.8.2` | Date/time inputs |
646
+ | `@mantine/notifications` | `^9.8.2` | Do not use in apps — prefer micro-container `ad-toast` (see Alert vs Notification) |
647
+ | `@mantine/dropzone` | `^9.8.2` | File drag-and-drop |
644
648
  | `@appdirect/design-tokens` | `^0.0.6` | AppDirect token CSS variables (`--ad-*`) |
645
649
  | `@tabler/icons-react` | `^3.33.0` | Icon library (supplementary) |
646
650
  | `@remixicon/react` | `^4.6.0` | Primary icon library; default avatar icon |
@@ -53,8 +53,9 @@ import { ALERT_TO_MANTINE_COLOR } from '../types.js';
53
53
  * <Alert color="danger" title="Error">Error message with light background</Alert>
54
54
  * ```
55
55
  */
56
- export const Alert = forwardRef(({ color = 'default', type, icon: customIcon, title, withCloseButton = false, onClose, children, ...props }, ref) => {
56
+ export const Alert = forwardRef(({ color, type, icon: customIcon, title, withCloseButton = false, onClose, children, ...props }, ref) => {
57
57
  // Keep `type` as a deprecated alias while `color` becomes the primary API.
58
+ // Do not default `color` in destructuring — that would shadow `type="info"` etc.
58
59
  const semanticColor = color ?? type ?? 'default';
59
60
  // Map semantic colors to Mantine colors and default icons
60
61
  const getAlertConfig = (alertColor) => {
@@ -72,6 +73,6 @@ export const Alert = forwardRef(({ color = 'default', type, icon: customIcon, ti
72
73
  };
73
74
  const { color: mantineColor, icon: defaultIcon } = getAlertConfig(semanticColor);
74
75
  const alertIcon = customIcon || defaultIcon;
75
- return (_jsx(MantineAlert, { ref: ref, variant: "light", color: mantineColor, radius: "sm", icon: alertIcon, title: title, withCloseButton: withCloseButton, onClose: onClose, ...props, children: children }));
76
+ return (_jsx(MantineAlert, { ref: ref, variant: "light", color: mantineColor, radius: "sm", icon: alertIcon, title: title, withCloseButton: withCloseButton, onClose: onClose, ...props, "data-color": semanticColor, children: children }));
76
77
  });
77
78
  Alert.displayName = 'Alert';
@@ -77,7 +77,7 @@ export interface DSAlertProps extends Omit<MantineAlertProps, 'color' | 'variant
77
77
  export const Alert = forwardRef<HTMLDivElement, DSAlertProps>(
78
78
  (
79
79
  {
80
- color = 'default',
80
+ color,
81
81
  type,
82
82
  icon: customIcon,
83
83
  title,
@@ -89,6 +89,7 @@ export const Alert = forwardRef<HTMLDivElement, DSAlertProps>(
89
89
  ref
90
90
  ) => {
91
91
  // Keep `type` as a deprecated alias while `color` becomes the primary API.
92
+ // Do not default `color` in destructuring — that would shadow `type="info"` etc.
92
93
  const semanticColor = color ?? type ?? 'default';
93
94
 
94
95
  // Map semantic colors to Mantine colors and default icons
@@ -120,6 +121,8 @@ export const Alert = forwardRef<HTMLDivElement, DSAlertProps>(
120
121
  withCloseButton={withCloseButton}
121
122
  onClose={onClose}
122
123
  {...props}
124
+ // Semantic name for mantine.css ([data-color=info|…]); must win over props.
125
+ data-color={semanticColor}
123
126
  >
124
127
  {children}
125
128
  </MantineAlert>
@@ -39,30 +39,54 @@ import { Badge as MantineBadge } from '@mantine/core';
39
39
  * ```
40
40
  */
41
41
  export const Badge = forwardRef(({ variant = 'filled', size = 'md', color = 'default', children, ...props }, ref) => {
42
- // Map design system colors to Mantine colors
43
- const getMantineColor = (dsColor, dsVariant) => {
44
- const resolvedColor = dsColor === 'default' && ['info', 'success', 'danger', 'pending', 'warning'].includes(dsVariant || '')
45
- ? (dsVariant === 'warning' ? 'pending' : dsVariant)
46
- : dsColor;
42
+ // Legacy: variant used as semantic color when color stays default.
43
+ const resolvedColor = color === 'default' &&
44
+ ['info', 'success', 'danger', 'pending', 'warning'].includes(variant || '')
45
+ ? variant === 'warning'
46
+ ? 'pending'
47
+ : variant
48
+ : color;
49
+ // Normalize aliases (blue/green/…) to semantic names for mantine.css [data-color].
50
+ const semanticDataColor = (() => {
47
51
  switch (resolvedColor) {
48
52
  case 'info':
49
53
  case 'blue':
50
- return 'blue';
54
+ return 'info';
51
55
  case 'success':
52
56
  case 'green':
53
- return 'green';
57
+ return 'success';
54
58
  case 'danger':
55
59
  case 'red':
56
- return 'red';
60
+ return 'danger';
57
61
  case 'pending':
58
62
  case 'warning':
59
63
  case 'yellow':
60
- return 'yellow';
64
+ return 'pending';
61
65
  case 'default':
62
66
  case 'gray':
67
+ return 'default';
68
+ default: {
69
+ const _exhaustive = resolvedColor;
70
+ return _exhaustive;
71
+ }
72
+ }
73
+ })();
74
+ const getMantineColor = (semantic) => {
75
+ switch (semantic) {
76
+ case 'info':
77
+ return 'blue';
78
+ case 'success':
79
+ return 'green';
80
+ case 'danger':
81
+ return 'red';
82
+ case 'pending':
83
+ return 'yellow';
84
+ case 'default':
63
85
  return 'gray';
64
- default:
65
- return 'gray';
86
+ default: {
87
+ const _exhaustive = semantic;
88
+ return _exhaustive;
89
+ }
66
90
  }
67
91
  };
68
92
  const getMantineVariant = (dsVariant) => {
@@ -73,6 +97,7 @@ export const Badge = forwardRef(({ variant = 'filled', size = 'md', color = 'def
73
97
  return 'filled';
74
98
  }
75
99
  };
76
- return (_jsx(MantineBadge, { ref: ref, variant: getMantineVariant(variant), size: size, color: getMantineColor(color, variant), radius: "sm", ...props, children: children }));
100
+ const mantineColor = getMantineColor(semanticDataColor);
101
+ return (_jsx(MantineBadge, { ref: ref, variant: getMantineVariant(variant), size: size, color: mantineColor, radius: "sm", ...props, "data-color": semanticDataColor, children: children }));
77
102
  });
78
103
  Badge.displayName = 'Badge';
@@ -64,31 +64,57 @@ export const Badge = forwardRef<HTMLDivElement, DSBadgeProps>(
64
64
  },
65
65
  ref
66
66
  ) => {
67
- // Map design system colors to Mantine colors
68
- const getMantineColor = (dsColor: DSBadgeProps['color'], dsVariant: DSBadgeProps['variant']) => {
69
- const resolvedColor = dsColor === 'default' && ['info', 'success', 'danger', 'pending', 'warning'].includes(dsVariant || '')
70
- ? (dsVariant === 'warning' ? 'pending' : dsVariant)
71
- : dsColor;
67
+ // Legacy: variant used as semantic color when color stays default.
68
+ const resolvedColor: DSBadgeColor =
69
+ color === 'default' &&
70
+ ['info', 'success', 'danger', 'pending', 'warning'].includes(variant || '')
71
+ ? variant === 'warning'
72
+ ? 'pending'
73
+ : (variant as DSBadgeColor)
74
+ : color;
72
75
 
76
+ // Normalize aliases (blue/green/…) to semantic names for mantine.css [data-color].
77
+ const semanticDataColor = (() => {
73
78
  switch (resolvedColor) {
74
79
  case 'info':
75
80
  case 'blue':
76
- return 'blue';
81
+ return 'info' as const;
77
82
  case 'success':
78
83
  case 'green':
79
- return 'green';
84
+ return 'success' as const;
80
85
  case 'danger':
81
86
  case 'red':
82
- return 'red';
87
+ return 'danger' as const;
83
88
  case 'pending':
84
89
  case 'warning':
85
90
  case 'yellow':
86
- return 'yellow';
91
+ return 'pending' as const;
87
92
  case 'default':
88
93
  case 'gray':
94
+ return 'default' as const;
95
+ default: {
96
+ const _exhaustive: never = resolvedColor;
97
+ return _exhaustive;
98
+ }
99
+ }
100
+ })();
101
+
102
+ const getMantineColor = (semantic: typeof semanticDataColor) => {
103
+ switch (semantic) {
104
+ case 'info':
105
+ return 'blue';
106
+ case 'success':
107
+ return 'green';
108
+ case 'danger':
109
+ return 'red';
110
+ case 'pending':
111
+ return 'yellow';
112
+ case 'default':
89
113
  return 'gray';
90
- default:
91
- return 'gray';
114
+ default: {
115
+ const _exhaustive: never = semantic;
116
+ return _exhaustive;
117
+ }
92
118
  }
93
119
  };
94
120
 
@@ -101,14 +127,18 @@ export const Badge = forwardRef<HTMLDivElement, DSBadgeProps>(
101
127
  }
102
128
  };
103
129
 
130
+ const mantineColor = getMantineColor(semanticDataColor);
131
+
104
132
  return (
105
133
  <MantineBadge
106
134
  ref={ref}
107
135
  variant={getMantineVariant(variant)}
108
136
  size={size}
109
- color={getMantineColor(color, variant)}
137
+ color={mantineColor}
110
138
  radius="sm"
111
139
  {...props}
140
+ // Semantic name for mantine.css ([data-color=info|…]); must win over props.
141
+ data-color={semanticDataColor}
112
142
  >
113
143
  {children}
114
144
  </MantineBadge>