@appdirect/design-system 0.0.22 → 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.
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
 
@@ -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
@@ -640,11 +640,11 @@ Do **not** import `tokens.css` in Mantine apps (duplicates foundations; unused b
640
640
 
641
641
  | Package | Version | Role |
642
642
  |---|---|---|
643
- | `@mantine/core` | `^9.6.0` | Base component library |
644
- | `@mantine/hooks` | `^9.6.0` | Utility hooks (useDisclosure, etc.) |
645
- | `@mantine/dates` | `^9.6.0` | Date/time inputs |
646
- | `@mantine/notifications` | `^9.6.0` | Do not use in apps — prefer micro-container `ad-toast` (see Alert vs Notification) |
647
- | `@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 |
648
648
  | `@appdirect/design-tokens` | `^0.0.6` | AppDirect token CSS variables (`--ad-*`) |
649
649
  | `@tabler/icons-react` | `^3.33.0` | Icon library (supplementary) |
650
650
  | `@remixicon/react` | `^4.6.0` | Primary icon library; default avatar icon |
@@ -1,40 +1,20 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import React, { forwardRef, useRef } from 'react';
4
- import { NumberInput as MantineNumberInput, ActionIcon, Group, Stack, } from '@mantine/core';
5
- import { RiAddLine, RiInformationLine, RiSubtractLine } from '@remixicon/react';
3
+ import React, { forwardRef } from 'react';
4
+ import { NumberInput as MantineNumberInput, ActionIcon, Group, } from '@mantine/core';
5
+ import { RiInformationLine } from '@remixicon/react';
6
6
  import { Text } from '../Typography/Text.js';
7
7
  import { Tooltip } from '../Overlays/Tooltip.js';
8
- const CONTROL_ICON_SIZE = {
9
- xs: 10,
10
- sm: 12,
11
- md: 14,
12
- lg: 16,
13
- xl: 18,
14
- };
15
8
  // ========================== COMPONENT ==========================
16
9
  /**
17
10
  * AppDirect Design System NumberInput Component
18
11
  *
19
12
  * A numeric input built on top of Mantine's NumberInput with
20
13
  * consistent design system styling and enforced radius.
21
- * Increment/decrement use Remix +/- icons (not Mantine chevrons).
14
+ * Increment/decrement uses Mantine's native stacked chevron controls (styled via mantine.css).
22
15
  */
23
- export const NumberInput = forwardRef(({ size = 'md', showOptional = false, required, label, hasHelpIcon = false, helpIconLabel, onHelpIconClick, rightSection, error, errorCaption, hideControls, readOnly, disabled, handlersRef: handlersRefProp, ...props }, ref) => {
16
+ export const NumberInput = forwardRef(({ size = 'md', showOptional = false, required, label, hasHelpIcon = false, helpIconLabel, onHelpIconClick, leftSection, rightSection, error, errorCaption, hideControls, ...props }, ref) => {
24
17
  const effectiveError = error === true ? (errorCaption ?? true) : error;
25
- const internalHandlersRef = useRef(null);
26
- const setHandlersRef = (handlers) => {
27
- internalHandlersRef.current = handlers ?? null;
28
- if (!handlersRefProp)
29
- return;
30
- if (typeof handlersRefProp === 'function') {
31
- handlersRefProp(handlers);
32
- }
33
- else {
34
- handlersRefProp.current =
35
- handlers;
36
- }
37
- };
38
18
  const enhancedLabel = React.useMemo(() => {
39
19
  if (!label)
40
20
  return label;
@@ -44,18 +24,27 @@ export const NumberInput = forwardRef(({ size = 'md', showOptional = false, requ
44
24
  return label;
45
25
  }, [label, showOptional, required]);
46
26
  const helpIconElement = hasHelpIcon ? (_jsx(Tooltip, { label: helpIconLabel ?? 'Help', position: "top", withArrow: true, children: _jsx(ActionIcon, { variant: "transparent", size: "xs", "aria-label": helpIconLabel ?? 'Help', onClick: onHelpIconClick, color: "gray", style: { cursor: onHelpIconClick ? 'pointer' : 'default' }, children: _jsx(RiInformationLine, { size: 14, "aria-hidden": true }) }) })) : null;
47
- const iconSize = CONTROL_ICON_SIZE[size] ?? 14;
48
- const showDsControls = !hideControls && !readOnly && !disabled && rightSection == null;
49
- const dsControls = showDsControls ? (_jsxs(Stack, { gap: 0, justify: "center", children: [_jsx(ActionIcon, { variant: "transparent", size: "xs", tabIndex: -1, "aria-hidden": true, onMouseDown: (event) => event.preventDefault(), onClick: () => internalHandlersRef.current?.increment(), children: _jsx(RiAddLine, { size: iconSize, "aria-hidden": true }) }), _jsx(ActionIcon, { variant: "transparent", size: "xs", tabIndex: -1, "aria-hidden": true, onMouseDown: (event) => event.preventDefault(), onClick: () => internalHandlersRef.current?.decrement(), children: _jsx(RiSubtractLine, { size: iconSize, "aria-hidden": true }) })] })) : null;
50
- const composedRightSection = (() => {
51
- if (rightSection && helpIconElement) {
52
- return (_jsxs(Group, { gap: 4, wrap: "nowrap", children: [rightSection, helpIconElement] }));
27
+ const nativeControlsVisible = !hideControls && !props.readOnly && !props.disabled;
28
+ const composedLeftSection = React.useMemo(() => {
29
+ if (!helpIconElement)
30
+ return leftSection;
31
+ if (nativeControlsVisible) {
32
+ if (leftSection) {
33
+ return (_jsxs(Group, { gap: 4, wrap: "nowrap", children: [helpIconElement, leftSection] }));
34
+ }
35
+ return helpIconElement;
53
36
  }
54
- if (dsControls && helpIconElement) {
55
- return (_jsxs(Group, { gap: 4, wrap: "nowrap", children: [dsControls, helpIconElement] }));
37
+ return leftSection;
38
+ }, [helpIconElement, leftSection, nativeControlsVisible]);
39
+ const composedRightSection = React.useMemo(() => {
40
+ if (!helpIconElement || nativeControlsVisible) {
41
+ return rightSection;
42
+ }
43
+ if (rightSection) {
44
+ return (_jsxs(Group, { gap: 4, wrap: "nowrap", children: [rightSection, helpIconElement] }));
56
45
  }
57
- return helpIconElement || rightSection || dsControls;
58
- })();
59
- return (_jsx(MantineNumberInput, { ref: ref, size: size, radius: "sm", required: required, label: enhancedLabel, error: effectiveError, hideControls: true, readOnly: readOnly, disabled: disabled, handlersRef: setHandlersRef, rightSection: composedRightSection, ...props }));
46
+ return helpIconElement;
47
+ }, [helpIconElement, nativeControlsVisible, rightSection]);
48
+ return (_jsx(MantineNumberInput, { ref: ref, size: size, radius: "sm", required: required, label: enhancedLabel, error: effectiveError, hideControls: hideControls, leftSection: composedLeftSection, rightSection: composedRightSection, ...props }));
60
49
  });
61
50
  NumberInput.displayName = 'NumberInput';
@@ -1,15 +1,13 @@
1
1
  'use client';
2
2
 
3
- import React, { forwardRef, useRef } from 'react';
3
+ import React, { forwardRef } from 'react';
4
4
  import {
5
5
  NumberInput as MantineNumberInput,
6
6
  NumberInputProps as MantineNumberInputProps,
7
- NumberInputHandlers,
8
7
  ActionIcon,
9
8
  Group,
10
- Stack,
11
9
  } from '@mantine/core';
12
- import { RiAddLine, RiInformationLine, RiSubtractLine } from '@remixicon/react';
10
+ import { RiInformationLine } from '@remixicon/react';
13
11
  import { ComponentSize } from '../config';
14
12
  import { Text } from '../Typography/Text';
15
13
  import { Tooltip } from '../Overlays/Tooltip';
@@ -34,14 +32,6 @@ export interface DSNumberInputProps extends Omit<MantineNumberInputProps, 'size'
34
32
  errorCaption?: string;
35
33
  }
36
34
 
37
- const CONTROL_ICON_SIZE: Record<ComponentSize, number> = {
38
- xs: 10,
39
- sm: 12,
40
- md: 14,
41
- lg: 16,
42
- xl: 18,
43
- };
44
-
45
35
  // ========================== COMPONENT ==========================
46
36
 
47
37
  /**
@@ -49,7 +39,7 @@ const CONTROL_ICON_SIZE: Record<ComponentSize, number> = {
49
39
  *
50
40
  * A numeric input built on top of Mantine's NumberInput with
51
41
  * consistent design system styling and enforced radius.
52
- * Increment/decrement use Remix +/- icons (not Mantine chevrons).
42
+ * Increment/decrement uses Mantine's native stacked chevron controls (styled via mantine.css).
53
43
  */
54
44
  export const NumberInput = forwardRef<HTMLInputElement, DSNumberInputProps>(
55
45
  (
@@ -61,30 +51,16 @@ export const NumberInput = forwardRef<HTMLInputElement, DSNumberInputProps>(
61
51
  hasHelpIcon = false,
62
52
  helpIconLabel,
63
53
  onHelpIconClick,
54
+ leftSection,
64
55
  rightSection,
65
56
  error,
66
57
  errorCaption,
67
58
  hideControls,
68
- readOnly,
69
- disabled,
70
- handlersRef: handlersRefProp,
71
59
  ...props
72
60
  },
73
61
  ref
74
62
  ) => {
75
63
  const effectiveError = error === true ? (errorCaption ?? true) : error;
76
- const internalHandlersRef = useRef<NumberInputHandlers | null>(null);
77
-
78
- const setHandlersRef = (handlers: NumberInputHandlers | undefined) => {
79
- internalHandlersRef.current = handlers ?? null;
80
- if (!handlersRefProp) return;
81
- if (typeof handlersRefProp === 'function') {
82
- handlersRefProp(handlers);
83
- } else {
84
- (handlersRefProp as React.MutableRefObject<NumberInputHandlers | undefined>).current =
85
- handlers;
86
- }
87
- };
88
64
 
89
65
  const enhancedLabel = React.useMemo(() => {
90
66
  if (!label) return label;
@@ -116,53 +92,39 @@ export const NumberInput = forwardRef<HTMLInputElement, DSNumberInputProps>(
116
92
  </Tooltip>
117
93
  ) : null;
118
94
 
119
- const iconSize = CONTROL_ICON_SIZE[size] ?? 14;
120
- const showDsControls = !hideControls && !readOnly && !disabled && rightSection == null;
95
+ const nativeControlsVisible =
96
+ !hideControls && !props.readOnly && !props.disabled;
121
97
 
122
- const dsControls = showDsControls ? (
123
- <Stack gap={0} justify="center">
124
- <ActionIcon
125
- variant="transparent"
126
- size="xs"
127
- tabIndex={-1}
128
- aria-hidden
129
- onMouseDown={(event) => event.preventDefault()}
130
- onClick={() => internalHandlersRef.current?.increment()}
131
- >
132
- <RiAddLine size={iconSize} aria-hidden />
133
- </ActionIcon>
134
- <ActionIcon
135
- variant="transparent"
136
- size="xs"
137
- tabIndex={-1}
138
- aria-hidden
139
- onMouseDown={(event) => event.preventDefault()}
140
- onClick={() => internalHandlersRef.current?.decrement()}
141
- >
142
- <RiSubtractLine size={iconSize} aria-hidden />
143
- </ActionIcon>
144
- </Stack>
145
- ) : null;
98
+ const composedLeftSection = React.useMemo(() => {
99
+ if (!helpIconElement) return leftSection;
100
+ if (nativeControlsVisible) {
101
+ if (leftSection) {
102
+ return (
103
+ <Group gap={4} wrap="nowrap">
104
+ {helpIconElement}
105
+ {leftSection}
106
+ </Group>
107
+ );
108
+ }
109
+ return helpIconElement;
110
+ }
111
+ return leftSection;
112
+ }, [helpIconElement, leftSection, nativeControlsVisible]);
146
113
 
147
- const composedRightSection = (() => {
148
- if (rightSection && helpIconElement) {
149
- return (
150
- <Group gap={4} wrap="nowrap">
151
- {rightSection}
152
- {helpIconElement}
153
- </Group>
154
- );
114
+ const composedRightSection = React.useMemo(() => {
115
+ if (!helpIconElement || nativeControlsVisible) {
116
+ return rightSection;
155
117
  }
156
- if (dsControls && helpIconElement) {
118
+ if (rightSection) {
157
119
  return (
158
120
  <Group gap={4} wrap="nowrap">
159
- {dsControls}
121
+ {rightSection}
160
122
  {helpIconElement}
161
123
  </Group>
162
124
  );
163
125
  }
164
- return helpIconElement || rightSection || dsControls;
165
- })();
126
+ return helpIconElement;
127
+ }, [helpIconElement, nativeControlsVisible, rightSection]);
166
128
 
167
129
  return (
168
130
  <MantineNumberInput
@@ -172,10 +134,8 @@ export const NumberInput = forwardRef<HTMLInputElement, DSNumberInputProps>(
172
134
  required={required}
173
135
  label={enhancedLabel}
174
136
  error={effectiveError}
175
- hideControls
176
- readOnly={readOnly}
177
- disabled={disabled}
178
- handlersRef={setHandlersRef}
137
+ hideControls={hideControls}
138
+ leftSection={composedLeftSection}
179
139
  rightSection={composedRightSection}
180
140
  {...props}
181
141
  />
@@ -183,4 +143,4 @@ export const NumberInput = forwardRef<HTMLInputElement, DSNumberInputProps>(
183
143
  }
184
144
  );
185
145
 
186
- NumberInput.displayName = 'NumberInput';
146
+ NumberInput.displayName = 'NumberInput';
@@ -40,7 +40,7 @@ import { Radio as MantineRadio } from '@mantine/core';
40
40
  * <Radio label="Required radio" value="required" required />
41
41
  * ```
42
42
  */
43
- export const Radio = forwardRef(({ size = 'md', label, ...props }, ref) => {
43
+ export const Radio = forwardRef(({ size = 'sm', label, ...props }, ref) => {
44
44
  // Construct label with required asterisk if needed
45
45
  const enhancedLabel = React.useMemo(() => {
46
46
  if (!label)
@@ -53,7 +53,7 @@ export interface DSRadioProps extends Omit<MantineRadioProps, 'size'> {
53
53
  export const Radio = forwardRef<HTMLInputElement, DSRadioProps>(
54
54
  (
55
55
  {
56
- size = 'md',
56
+ size = 'sm',
57
57
  label,
58
58
  ...props
59
59
  },
@@ -44,7 +44,7 @@ import { Radio as MantineRadio } from '@mantine/core';
44
44
  * </RadioGroup>
45
45
  * ```
46
46
  */
47
- export const RadioGroup = forwardRef(({ size = 'md', label, ...props }, ref) => {
47
+ export const RadioGroup = forwardRef(({ size = 'sm', label, ...props }, ref) => {
48
48
  // Construct label with required asterisk if needed
49
49
  const enhancedLabel = React.useMemo(() => {
50
50
  if (!label)
@@ -57,7 +57,7 @@ export interface DSRadioGroupProps extends Omit<React.ComponentPropsWithoutRef<t
57
57
  export const RadioGroup = forwardRef<HTMLDivElement, DSRadioGroupProps>(
58
58
  (
59
59
  {
60
- size = 'md',
60
+ size = 'sm',
61
61
  label,
62
62
  ...props
63
63
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.22",
2
+ "version": "0.0.23",
3
3
  "contracts": [
4
4
  {
5
5
  "id": "Alert",
@@ -706,10 +706,52 @@
706
706
  --ad-action-default-border: #424242;
707
707
  }
708
708
 
709
- /* Mantine semantic aliases — map Mantine CSS vars onto AppDirect tokens */
709
+ /* Mantine semantic aliases — parity with micro-ui-ts global.css (:root / :host block) */
710
+ :root,
711
+ :host {
712
+ --mantine-color-scheme: light dark;
713
+ --mantine-font-family:
714
+ "Inter", sans-serif, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial,
715
+ sans-serif, Apple Color Emoji, Segoe UI Emoji;
716
+ --mantine-radius-default: calc(0.25rem * var(--mantine-scale));
717
+ --mantine-color-blue-0: var(--ad-open-color-blue-0, #e9f4ff);
718
+ --mantine-color-blue-1: var(--ad-open-color-blue-1, #d5e3fb);
719
+ --mantine-color-blue-2: var(--ad-open-color-blue-2, #abc5f0);
720
+ --mantine-color-blue-3: var(--ad-open-color-blue-3, #7ea4e6);
721
+ --mantine-color-blue-4: var(--ad-open-color-blue-4, #5889dd);
722
+ --mantine-color-blue-5: var(--ad-open-color-blue-5, #4078d8);
723
+ --mantine-color-blue-6: var(--ad-open-color-blue-6, #326fde);
724
+ --mantine-color-blue-7: var(--ad-open-color-blue-7, #235ebf);
725
+ --mantine-color-blue-8: var(--ad-open-color-blue-8, #1953ac);
726
+ --mantine-color-blue-9: var(--ad-open-color-blue-9, #024899);
727
+ }
728
+
710
729
  :root,
711
730
  :root[data-mantine-color-scheme="light"],
712
731
  :root[data-mantine-color-scheme="dark"],
732
+ :host([data-mantine-color-scheme="light"]),
733
+ :host([data-mantine-color-scheme="dark"]),
713
734
  [data-theme="dark"] {
714
- --mantine-color-dimmed: var(--ad-color-text-dimmed, var(--mantine-color-gray-6));
735
+ --mantine-color-dimmed: var(--ad-color-text-dimmed, #495057);
736
+ }
737
+
738
+ :root[data-mantine-color-scheme="light"],
739
+ :host([data-mantine-color-scheme="light"]) {
740
+ --mantine-color-text: var(--ad-color-text-default, #000);
741
+ --mantine-color-body: var(--ad-color-bg-default, #fff);
742
+ --mantine-color-error: var(--ad-color-status-error, #fa5252);
743
+ --mantine-color-success: var(--ad-color-status-success, var(--mantine-color-green-6));
744
+ /* micro-ui a11y: darker than --ad-color-text-placeholder for light-mode contrast */
745
+ --mantine-color-placeholder: #767676;
746
+ --mantine-color-anchor: var(--ad-color-text-link, #326fde);
747
+ --mantine-color-blue-filled: var(--ad-color-brand-primary, var(--mantine-color-blue-6));
748
+ --mantine-color-blue-filled-hover: var(--ad-color-brand-primary-hover, var(--mantine-color-blue-7));
749
+ }
750
+
751
+ :root[data-mantine-color-scheme="dark"],
752
+ :host([data-mantine-color-scheme="dark"]) {
753
+ --mantine-color-success: var(--ad-color-status-success, var(--mantine-color-green-8));
754
+ --mantine-color-anchor: var(--ad-color-text-link, var(--mantine-color-blue-4));
755
+ --mantine-color-blue-filled: var(--ad-color-brand-primary, var(--mantine-color-blue-8));
756
+ --mantine-color-blue-filled-hover: var(--ad-color-brand-primary-hover, var(--mantine-color-blue-9));
715
757
  }