@appdirect/design-system 0.0.20 → 0.0.22

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 (35) hide show
  1. package/dist/Combobox/Select.js +11 -2
  2. package/dist/Combobox/Select.module.css +8 -0
  3. package/dist/Combobox/Select.tsx +16 -3
  4. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/CustomBottomToolbar.module.css +24 -1
  5. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.js +2 -1
  6. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.tsx +3 -0
  7. package/dist/ComplexComponents/DataTable/CustomToolbarAlertBannerContent/CustomToolbarAlertBannerContent.module.css +9 -1
  8. package/dist/ComplexComponents/DataTable/CustomTopToolbar/CustomTopToolbar.module.css +7 -0
  9. package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/DateRangeSelectorFilter.module.css +7 -0
  10. package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.js +1 -1
  11. package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.tsx +1 -0
  12. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.js +4 -2
  13. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.module.css +16 -0
  14. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.tsx +6 -3
  15. package/dist/ComplexComponents/DataTable/CustomTopToolbar/index.js +2 -2
  16. package/dist/ComplexComponents/DataTable/CustomTopToolbar/index.tsx +11 -8
  17. package/dist/ComplexComponents/DataTable/DataTableGrid/DataTableGrid.module.css +17 -3
  18. package/dist/ComplexComponents/DataTable/DataTableGrid/index.js +1 -1
  19. package/dist/ComplexComponents/DataTable/DataTableGrid/index.tsx +2 -2
  20. package/dist/ComplexComponents/DataTable/ToolbarAlertBanner/ToolbarAlertBanner.module.css +4 -1
  21. package/dist/DESIGN.md +6 -2
  22. package/dist/DataDisplay/Alert.js +3 -2
  23. package/dist/DataDisplay/Alert.tsx +4 -1
  24. package/dist/DataDisplay/Badge.js +37 -12
  25. package/dist/DataDisplay/Badge.tsx +42 -12
  26. package/dist/Inputs/NumberInput.js +40 -28
  27. package/dist/Inputs/NumberInput.tsx +93 -32
  28. package/dist/Overlays/Modal.js +2 -2
  29. package/dist/Overlays/Modal.tsx +2 -2
  30. package/dist/contracts/index.json +1 -1
  31. package/dist/css/mantine.css +1503 -39
  32. package/dist/stories/Overlays/Drawer.stories.tsx +2 -2
  33. package/dist/stories/Overlays/Modal.stories.tsx +2 -2
  34. package/dist/stories/index.json +1 -1
  35. package/package.json +2 -2
@@ -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,4 +4,27 @@
4
4
 
5
5
  .pageSize {
6
6
  flex-shrink: 0;
7
- }
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
+ }
@@ -5,6 +5,7 @@ import React, { useMemo } from "react";
5
5
  import { Box, 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
8
9
  import { translate } from "../translations/index.js"; // DS-ADAPT: translate lives in DataTable/translations
9
10
  import { getFormattedPageCount, getFormattedPageSize, getNumOfRowsPerPageOptions } from "./utils.js";
10
11
  import styles from "./CustomBottomToolbar.module.css";
@@ -17,7 +18,7 @@ const CustomBottomToolbar = ({ paginationState, onPageSizeChange, onNextPage, on
17
18
  };
18
19
  const formattedPageLegend = getFormattedPageCount(paginationState.pageIndex, paginationState.pageSize, rowCount);
19
20
  const numOfRowsPerPageOptions = useMemo(() => getNumOfRowsPerPageOptions(rowCount, undefined, paginationState.pageSize), [rowCount, paginationState.pageSize]);
20
- 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", 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: () => {
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: () => {
21
22
  if (!isFetching && onPreviousPage) {
22
23
  onPreviousPage();
23
24
  }
@@ -4,6 +4,7 @@ import React, { useMemo, ReactElement } from "react";
4
4
  import { Box, 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
7
8
  import { PaginationState } from "../types";
8
9
  import { translate } from "../translations"; // DS-ADAPT: translate lives in DataTable/translations
9
10
  import { getFormattedPageCount, getFormattedPageSize, getNumOfRowsPerPageOptions } from "./utils";
@@ -76,6 +77,8 @@ const CustomBottomToolbar = ({
76
77
  w="100%"
77
78
  rightSectionWidth={22}
78
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
79
82
  comboboxProps={{ withinPortal: false, width: "max-content" }}
80
83
  />
81
84
  </Box>
@@ -1,4 +1,12 @@
1
- .action {
1
+ /* The global outline Button rule paints brand blue on the brand-blue banner, which made the action
2
+ invisible. These selectors match its :hover / :active specificity so the banner colours win
3
+ without !important. */
4
+ .action[data-variant="outline"]:not(:disabled):not([data-disabled]) {
2
5
  color: var(--ad-table-toolbar-selection-banner-fg);
3
6
  border-color: var(--ad-table-toolbar-selection-banner-fg);
4
7
  }
8
+
9
+ .action.action[data-variant="outline"]:not(:disabled):not([data-disabled]):hover,
10
+ .action.action[data-variant="outline"]:not(:disabled):not([data-disabled]):active {
11
+ background: color-mix(in srgb, var(--ad-table-toolbar-selection-banner-fg) 16%, transparent);
12
+ }
@@ -2,6 +2,13 @@
2
2
  border-bottom: var(--ad-table-toolbar-border-width) solid var(--ad-table-toolbar-border-color);
3
3
  }
4
4
 
5
+ /* Closed: same white-surface outline as the fullscreen and density buttons (outline variant).
6
+ Open: brand outline and icon, matching the outline Button. */
7
+ .filterToggle[data-open="true"][data-variant] {
8
+ color: var(--ad-color-brand-primary);
9
+ border-color: var(--ad-color-brand-primary);
10
+ }
11
+
5
12
  .clearFilters {
6
13
  cursor: pointer;
7
14
  }
@@ -1,3 +1,10 @@
1
1
  .field label {
2
2
  font-weight: 600;
3
3
  }
4
+
5
+ /* The trigger is a <button>, so unlike a text input it does not centre its text vertically:
6
+ the global input padding plus the full-height line-height pushed the value below the City
7
+ select's text. Zero block padding lines the two up. */
8
+ .fieldInput[data-variant] {
9
+ padding-block: 0;
10
+ }
@@ -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
@@ -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
 
@@ -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';