@appdirect/design-system 0.0.22 → 0.0.24

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 (53) hide show
  1. package/README.md +1 -1
  2. package/dist/Combobox/ADMultiselect.js +91 -0
  3. package/dist/Combobox/ADMultiselect.tsx +237 -0
  4. package/dist/Combobox/Select.js +13 -19
  5. package/dist/Combobox/Select.tsx +15 -44
  6. package/dist/Combobox/index.js +1 -1
  7. package/dist/Combobox/index.ts +2 -2
  8. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/CustomBottomToolbar.module.css +1 -24
  9. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.js +2 -5
  10. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.tsx +15 -22
  11. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.js +1 -2
  12. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.module.css +2 -9
  13. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.tsx +4 -5
  14. package/dist/ComplexComponents/DataTable/DataTableGrid/DataTableGrid.module.css +2 -6
  15. package/dist/ComplexComponents/DataTable/DataTableGrid/index.js +1 -1
  16. package/dist/ComplexComponents/DataTable/DataTableGrid/index.tsx +1 -1
  17. package/dist/DESIGN.md +7 -7
  18. package/dist/DataDisplay/Pill.js +21 -79
  19. package/dist/DataDisplay/Pill.tsx +34 -116
  20. package/dist/Inputs/ColorInput.js +12 -18
  21. package/dist/Inputs/ColorInput.tsx +13 -41
  22. package/dist/Inputs/NumberInput.js +15 -50
  23. package/dist/Inputs/NumberInput.tsx +18 -117
  24. package/dist/Inputs/Radio.js +1 -1
  25. package/dist/Inputs/Radio.tsx +1 -1
  26. package/dist/Inputs/RadioGroup.js +1 -1
  27. package/dist/Inputs/RadioGroup.tsx +1 -1
  28. package/dist/Inputs/TextArea.js +12 -18
  29. package/dist/Inputs/TextArea.tsx +13 -41
  30. package/dist/Inputs/TextInput.js +12 -18
  31. package/dist/Inputs/TextInput.tsx +13 -41
  32. package/dist/Inputs/inputLabel.js +35 -0
  33. package/dist/Inputs/inputLabel.tsx +83 -0
  34. package/dist/Overlays/Tooltip.js +2 -2
  35. package/dist/Overlays/Tooltip.tsx +4 -1
  36. package/dist/contracts/index.json +1 -1
  37. package/dist/css/foundations.css +44 -2
  38. package/dist/css/mantine.css +236 -43
  39. package/dist/css/tokens.css +58 -26
  40. package/dist/index.js +3 -3
  41. package/dist/index.ts +4 -4
  42. package/dist/stories/Combobox/{Multiselect.stories.tsx → ADMultiselect.stories.tsx} +159 -53
  43. package/dist/stories/Combobox/Select.stories.tsx +1 -1
  44. package/dist/stories/Inputs/ColorInput.stories.tsx +12 -0
  45. package/dist/stories/Inputs/NumberInput.stories.tsx +12 -0
  46. package/dist/stories/Inputs/Radio.stories.tsx +10 -5
  47. package/dist/stories/Inputs/RadioGroup.stories.tsx +122 -80
  48. package/dist/stories/Inputs/TextArea.stories.tsx +12 -0
  49. package/dist/stories/Inputs/TextInput.stories.tsx +12 -0
  50. package/dist/stories/index.json +40 -32
  51. package/package.json +10 -6
  52. package/dist/Combobox/Multiselect.js +0 -31
  53. package/dist/Combobox/Multiselect.tsx +0 -158
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
 
@@ -0,0 +1,91 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React, { forwardRef, useMemo } from 'react';
4
+ import { MultiSelect as MantineMultiSelect, } from '@mantine/core';
5
+ import { useUncontrolled } from '@mantine/hooks';
6
+ import { IconSelector } from '@tabler/icons-react';
7
+ import { Checkbox } from '../Inputs/Checkbox.js';
8
+ import { Inline } from '../Layout/index.js';
9
+ import { Pill } from '../DataDisplay/Pill.js';
10
+ import { getInputLabelProps } from '../Inputs/inputLabel.js';
11
+ import { Tooltip } from '../Overlays/Tooltip.js';
12
+ const MAX_DISPLAYED_VALUES = 2;
13
+ // ========================== HELPERS ==========================
14
+ /** Flatten ComboboxData (strings, items and groups) into a flat item list. */
15
+ function flattenData(data) {
16
+ const items = [];
17
+ const push = (item) => items.push(typeof item === 'string'
18
+ ? { value: item, label: item }
19
+ : { value: item.value, label: item.label ?? item.value });
20
+ data?.forEach((entry) => {
21
+ if (typeof entry !== 'string' && 'group' in entry)
22
+ entry.items.forEach(push);
23
+ else
24
+ push(entry);
25
+ });
26
+ return items;
27
+ }
28
+ // ========================== COMPONENT ==========================
29
+ /**
30
+ * AppDirect multi-value select.
31
+ *
32
+ * Mantine's `MultiSelect` with two DS customizations, everything else
33
+ * (value/onChange, search, clearable, hidden form input, ARIA, keyboard
34
+ * handling, ...) is core behavior and every core prop is supported:
35
+ *
36
+ * - **"+N more" pill:** only `maxDisplayedValues` pill slots are shown; the
37
+ * remaining values collapse into a "+N more" pill whose tooltip lists them.
38
+ * - **Checkbox options:** options render with a checkbox instead of a check icon.
39
+ *
40
+ * Design hand-off: there is intentionally no Figma component. It looks the same as
41
+ * `Combobox`, so designers use that and engineering swaps this in for multi-value fields.
42
+ *
43
+ * @example
44
+ * ```tsx
45
+ * <ADMultiselect
46
+ * label="Technologies"
47
+ * placeholder="Pick one or more"
48
+ * data={['React', 'Vue', 'Angular']}
49
+ * value={value}
50
+ * onChange={setValue}
51
+ * maxDisplayedValues={2}
52
+ * />
53
+ * ```
54
+ */
55
+ export const ADMultiselect = forwardRef(({ size = 'md', label, required, showOptional = false, hasHelpIcon = false, helpIconLabel, onHelpIconClick, error, errorCaption, maxDisplayedValues = MAX_DISPLAYED_VALUES, value, defaultValue, onChange, data, placeholder, readOnly, withCheckIcon = false, renderOption, variant, ...props }, ref) => {
56
+ const [selected, setSelected] = useUncontrolled({
57
+ value,
58
+ defaultValue,
59
+ finalValue: [],
60
+ onChange,
61
+ });
62
+ const effectiveError = error === true ? (errorCaption ?? true) : error;
63
+ const labelProps = getInputLabelProps({
64
+ label,
65
+ required,
66
+ showOptional,
67
+ hasHelpIcon,
68
+ helpIconLabel,
69
+ onHelpIconClick,
70
+ });
71
+ const labelsByValue = useMemo(() => new Map(flattenData(data).map((item) => [item.value, item.label])), [data]);
72
+ // The "+N more" pill occupies the last visible slot once values overflow.
73
+ const hasOverflow = selected.length > maxDisplayedValues;
74
+ const visibleCount = hasOverflow ? Math.max(maxDisplayedValues - 1, 0) : selected.length;
75
+ const hiddenValues = selected.slice(visibleCount);
76
+ const renderPill = ({ option, value: pillValue, onRemove, disabled, }) => {
77
+ const index = pillValue === undefined ? -1 : selected.indexOf(pillValue);
78
+ if (index < visibleCount) {
79
+ return (_jsx(Pill, { size: size, disabled: disabled, withRemoveButton: !readOnly && !option?.disabled, onRemove: onRemove, children: option?.label ?? pillValue }));
80
+ }
81
+ if (index === visibleCount) {
82
+ return (_jsx(Tooltip, { position: "top", maxWidth: 420, label: _jsx(Inline, { gap: 4, children: hiddenValues.map((hidden, i) => (_jsxs("span", { children: [labelsByValue.get(hidden) ?? hidden, i < hiddenValues.length - 1 ? ',' : ''] }, hidden))) }), children: _jsxs(Pill, { size: size, disabled: disabled, children: ["+", hiddenValues.length, " more"] }) }));
83
+ }
84
+ return null;
85
+ };
86
+ const renderCheckboxOption = ({ option, checked }) => (_jsxs(Inline, { gap: "sm", wrap: "nowrap", children: [_jsx(Checkbox, { checked: !!checked, disabled: option.disabled, onChange: () => { }, "aria-hidden": true, tabIndex: -1, style: { pointerEvents: 'none' } }), _jsx("span", { children: option.label })] }));
87
+ return (_jsx(MantineMultiSelect, { ...props, ref: ref, size: size, radius: "sm", variant: variant ?? 'default', ...labelProps, required: required, data: data,
88
+ // Core keeps the placeholder visible next to the pills; the DS shows it only when empty.
89
+ placeholder: selected.length > 0 ? undefined : placeholder, value: selected, onChange: setSelected, readOnly: readOnly, withCheckIcon: withCheckIcon, renderOption: renderOption ?? renderCheckboxOption, renderPill: renderPill, rightSection: _jsx(IconSelector, { size: 14, "aria-hidden": true }), rightSectionPointerEvents: props.clearable ? 'auto' : 'none', error: effectiveError }));
90
+ });
91
+ ADMultiselect.displayName = 'ADMultiselect';
@@ -0,0 +1,237 @@
1
+ 'use client';
2
+
3
+ import React, { forwardRef, useMemo } from 'react';
4
+ import {
5
+ MultiSelect as MantineMultiSelect,
6
+ MultiSelectProps as MantineMultiSelectProps,
7
+ ComboboxData,
8
+ ComboboxItem,
9
+ } from '@mantine/core';
10
+ import { useUncontrolled } from '@mantine/hooks';
11
+ import { IconSelector } from '@tabler/icons-react';
12
+ import { ComponentSize } from '../config';
13
+ import { Checkbox } from '../Inputs/Checkbox';
14
+ import { Inline } from '../Layout';
15
+ import { Pill } from '../DataDisplay/Pill';
16
+ import { getInputLabelProps } from '../Inputs/inputLabel';
17
+ import { Tooltip } from '../Overlays/Tooltip';
18
+
19
+ const MAX_DISPLAYED_VALUES = 2;
20
+
21
+ // ========================== TYPES ==========================
22
+
23
+ export interface ADMultiselectProps
24
+ extends Omit<MantineMultiSelectProps, 'size' | 'radius' | 'rightSection' | 'renderPill'> {
25
+ /** Input size from design system scale */
26
+ size?: ComponentSize;
27
+ /** Whether to show "(Optional)" text after the label */
28
+ showOptional?: boolean;
29
+ /** Whether to show a (?) help icon with a tooltip to the right of the label */
30
+ hasHelpIcon?: boolean;
31
+ /** Tooltip label shown when hovering the help icon. Also used as aria-label for a11y */
32
+ helpIconLabel?: string;
33
+ /** Optional click handler for the help icon */
34
+ onHelpIconClick?: React.MouseEventHandler<HTMLButtonElement>;
35
+ /**
36
+ * Optional error message text shown below the input when in error state.
37
+ * Used with error={true} for red border + message; omit for red border only.
38
+ */
39
+ errorCaption?: string;
40
+ /**
41
+ * Maximum number of pills shown before the rest collapse into a "+N more"
42
+ * pill. The "+N more" pill takes the last slot, so `2` shows one value pill
43
+ * plus "+N more" once more than two values are selected. Hovering it lists
44
+ * the hidden values.
45
+ */
46
+ maxDisplayedValues?: number;
47
+ }
48
+
49
+ // ========================== HELPERS ==========================
50
+
51
+ /** Flatten ComboboxData (strings, items and groups) into a flat item list. */
52
+ function flattenData(data: ComboboxData | undefined): ComboboxItem[] {
53
+ const items: ComboboxItem[] = [];
54
+ const push = (item: string | { value: string; label?: string }) =>
55
+ items.push(
56
+ typeof item === 'string'
57
+ ? { value: item, label: item }
58
+ : { value: item.value, label: item.label ?? item.value }
59
+ );
60
+
61
+ data?.forEach((entry) => {
62
+ if (typeof entry !== 'string' && 'group' in entry) entry.items.forEach(push);
63
+ else push(entry as string | { value: string; label?: string });
64
+ });
65
+ return items;
66
+ }
67
+
68
+ // ========================== COMPONENT ==========================
69
+
70
+ /**
71
+ * AppDirect multi-value select.
72
+ *
73
+ * Mantine's `MultiSelect` with two DS customizations, everything else
74
+ * (value/onChange, search, clearable, hidden form input, ARIA, keyboard
75
+ * handling, ...) is core behavior and every core prop is supported:
76
+ *
77
+ * - **"+N more" pill:** only `maxDisplayedValues` pill slots are shown; the
78
+ * remaining values collapse into a "+N more" pill whose tooltip lists them.
79
+ * - **Checkbox options:** options render with a checkbox instead of a check icon.
80
+ *
81
+ * Design hand-off: there is intentionally no Figma component. It looks the same as
82
+ * `Combobox`, so designers use that and engineering swaps this in for multi-value fields.
83
+ *
84
+ * @example
85
+ * ```tsx
86
+ * <ADMultiselect
87
+ * label="Technologies"
88
+ * placeholder="Pick one or more"
89
+ * data={['React', 'Vue', 'Angular']}
90
+ * value={value}
91
+ * onChange={setValue}
92
+ * maxDisplayedValues={2}
93
+ * />
94
+ * ```
95
+ */
96
+ export const ADMultiselect = forwardRef<HTMLInputElement, ADMultiselectProps>(
97
+ (
98
+ {
99
+ size = 'md',
100
+ label,
101
+ required,
102
+ showOptional = false,
103
+ hasHelpIcon = false,
104
+ helpIconLabel,
105
+ onHelpIconClick,
106
+ error,
107
+ errorCaption,
108
+ maxDisplayedValues = MAX_DISPLAYED_VALUES,
109
+ value,
110
+ defaultValue,
111
+ onChange,
112
+ data,
113
+ placeholder,
114
+ readOnly,
115
+ withCheckIcon = false,
116
+ renderOption,
117
+ variant,
118
+ ...props
119
+ },
120
+ ref
121
+ ) => {
122
+ const [selected, setSelected] = useUncontrolled<string[]>({
123
+ value,
124
+ defaultValue,
125
+ finalValue: [],
126
+ onChange,
127
+ });
128
+
129
+ const effectiveError = error === true ? (errorCaption ?? true) : error;
130
+
131
+ const labelProps = getInputLabelProps({
132
+ label,
133
+ required,
134
+ showOptional,
135
+ hasHelpIcon,
136
+ helpIconLabel,
137
+ onHelpIconClick,
138
+ });
139
+
140
+ const labelsByValue = useMemo(
141
+ () => new Map(flattenData(data).map((item) => [item.value, item.label])),
142
+ [data]
143
+ );
144
+
145
+ // The "+N more" pill occupies the last visible slot once values overflow.
146
+ const hasOverflow = selected.length > maxDisplayedValues;
147
+ const visibleCount = hasOverflow ? Math.max(maxDisplayedValues - 1, 0) : selected.length;
148
+ const hiddenValues = selected.slice(visibleCount);
149
+
150
+ const renderPill: MantineMultiSelectProps['renderPill'] = ({
151
+ option,
152
+ value: pillValue,
153
+ onRemove,
154
+ disabled,
155
+ }) => {
156
+ const index = pillValue === undefined ? -1 : selected.indexOf(pillValue);
157
+
158
+ if (index < visibleCount) {
159
+ return (
160
+ <Pill
161
+ size={size}
162
+ disabled={disabled}
163
+ withRemoveButton={!readOnly && !option?.disabled}
164
+ onRemove={onRemove}
165
+ >
166
+ {option?.label ?? pillValue}
167
+ </Pill>
168
+ );
169
+ }
170
+
171
+ if (index === visibleCount) {
172
+ return (
173
+ <Tooltip
174
+ position="top"
175
+ maxWidth={420}
176
+ label={
177
+ <Inline gap={4}>
178
+ {hiddenValues.map((hidden, i) => (
179
+ <span key={hidden}>
180
+ {labelsByValue.get(hidden) ?? hidden}
181
+ {i < hiddenValues.length - 1 ? ',' : ''}
182
+ </span>
183
+ ))}
184
+ </Inline>
185
+ }
186
+ >
187
+ <Pill size={size} disabled={disabled}>
188
+ +{hiddenValues.length} more
189
+ </Pill>
190
+ </Tooltip>
191
+ );
192
+ }
193
+
194
+ return null;
195
+ };
196
+
197
+ const renderCheckboxOption: MantineMultiSelectProps['renderOption'] = ({ option, checked }) => (
198
+ <Inline gap="sm" wrap="nowrap">
199
+ <Checkbox
200
+ checked={!!checked}
201
+ disabled={option.disabled}
202
+ onChange={() => {}} // Selection is handled by the option click
203
+ aria-hidden
204
+ tabIndex={-1}
205
+ style={{ pointerEvents: 'none' }}
206
+ />
207
+ <span>{option.label}</span>
208
+ </Inline>
209
+ );
210
+
211
+ return (
212
+ <MantineMultiSelect
213
+ {...props}
214
+ ref={ref}
215
+ size={size}
216
+ radius="sm"
217
+ variant={variant ?? 'default'}
218
+ {...labelProps}
219
+ required={required}
220
+ data={data}
221
+ // Core keeps the placeholder visible next to the pills; the DS shows it only when empty.
222
+ placeholder={selected.length > 0 ? undefined : placeholder}
223
+ value={selected}
224
+ onChange={setSelected}
225
+ readOnly={readOnly}
226
+ withCheckIcon={withCheckIcon}
227
+ renderOption={renderOption ?? renderCheckboxOption}
228
+ renderPill={renderPill}
229
+ rightSection={<IconSelector size={14} aria-hidden />}
230
+ rightSectionPointerEvents={props.clearable ? 'auto' : 'none'}
231
+ error={effectiveError}
232
+ />
233
+ );
234
+ }
235
+ );
236
+
237
+ ADMultiselect.displayName = 'ADMultiselect';
@@ -1,10 +1,9 @@
1
1
  'use client';
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import React, { forwardRef } from 'react';
4
- import { Select as MantineSelect, ActionIcon, Group } from '@mantine/core';
5
- import { IconInfoCircle, IconSelector } from '@tabler/icons-react';
6
- import { Text } from '../Typography/Text.js';
7
- import { Tooltip } from '../Overlays/Tooltip.js';
4
+ import { Select as MantineSelect } from '@mantine/core';
5
+ import { IconSelector } from '@tabler/icons-react';
6
+ import { getInputLabelProps } from '../Inputs/inputLabel.js';
8
7
  import styles from './Select.module.css';
9
8
  // ========================== COMPONENT ==========================
10
9
  /**
@@ -55,19 +54,14 @@ import styles from './Select.module.css';
55
54
  */
56
55
  export const Select = forwardRef(({ size = 'sm', borderless = false, showOptional = false, required, label, hasHelpIcon = false, helpIconLabel, onHelpIconClick, error, errorCaption, variant, classNames, ...props }, ref) => {
57
56
  const effectiveError = error === true ? (errorCaption ?? true) : error;
58
- const enhancedLabel = React.useMemo(() => {
59
- if (!label)
60
- return label;
61
- if (showOptional && !required) {
62
- return (_jsxs(_Fragment, { children: [label, " ", _jsx(Text, { span: true, c: "dimmed", fw: "normal", children: "(Optional)" })] }));
63
- }
64
- return label;
65
- }, [label, showOptional, required]);
66
- 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(IconInfoCircle, { size: 14, "aria-hidden": true }) }) })) : null;
67
- const selectorIcon = _jsx(IconSelector, { size: 14, "aria-hidden": true });
68
- const composedRightSection = helpIconElement
69
- ? _jsxs(Group, { gap: 4, wrap: "nowrap", children: [selectorIcon, helpIconElement] })
70
- : selectorIcon;
57
+ const labelProps = getInputLabelProps({
58
+ label,
59
+ required,
60
+ showOptional,
61
+ hasHelpIcon,
62
+ helpIconLabel,
63
+ onHelpIconClick,
64
+ });
71
65
  const mergedClassNames = typeof classNames === 'function'
72
66
  ? classNames
73
67
  : {
@@ -76,6 +70,6 @@ export const Select = forwardRef(({ size = 'sm', borderless = false, showOptiona
76
70
  .filter(Boolean)
77
71
  .join(' '),
78
72
  };
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 }));
73
+ return (_jsx(MantineSelect, { ...props, ref: ref, size: size, radius: "sm", required: required, ...labelProps, rightSection: _jsx(IconSelector, { size: 14, "aria-hidden": true }), rightSectionPointerEvents: props.clearable ? 'auto' : 'none', variant: variant ?? 'default', classNames: mergedClassNames, error: effectiveError }));
80
74
  });
81
75
  Select.displayName = 'Select';
@@ -1,11 +1,10 @@
1
1
  'use client';
2
2
 
3
3
  import React, { forwardRef } from 'react';
4
- import { Select as MantineSelect, SelectProps as MantineSelectProps, ActionIcon, Group } from '@mantine/core';
5
- import { IconInfoCircle, IconSelector } from '@tabler/icons-react';
4
+ import { Select as MantineSelect, SelectProps as MantineSelectProps } from '@mantine/core';
5
+ import { IconSelector } from '@tabler/icons-react';
6
6
  import { ComponentSize } from '../config';
7
- import { Text } from '../Typography/Text';
8
- import { Tooltip } from '../Overlays/Tooltip';
7
+ import { getInputLabelProps } from '../Inputs/inputLabel';
9
8
  import styles from './Select.module.css';
10
9
 
11
10
  // ========================== TYPES ==========================
@@ -17,7 +16,7 @@ export interface DSSelectProps extends Omit<MantineSelectProps, 'size' | 'radius
17
16
  borderless?: boolean;
18
17
  /** Whether to show "(Optional)" text after label */
19
18
  showOptional?: boolean;
20
- /** Whether to show a help icon with a tooltip in the right section */
19
+ /** Whether to show a (?) help icon with a tooltip to the right of the label */
21
20
  hasHelpIcon?: boolean;
22
21
  /** Tooltip label shown when hovering the help icon. Also used as aria-label for a11y */
23
22
  helpIconLabel?: string;
@@ -99,42 +98,14 @@ export const Select = forwardRef<HTMLInputElement, DSSelectProps>(
99
98
  ) => {
100
99
  const effectiveError = error === true ? (errorCaption ?? true) : error;
101
100
 
102
- const enhancedLabel = React.useMemo(() => {
103
- if (!label) return label;
104
- if (showOptional && !required) {
105
- return (
106
- <>
107
- {label} <Text span c="dimmed" fw="normal">(Optional)</Text>
108
- </>
109
- );
110
- }
111
- return label;
112
- }, [label, showOptional, required]);
113
-
114
- const helpIconElement = hasHelpIcon ? (
115
- <Tooltip
116
- label={helpIconLabel ?? 'Help'}
117
- position="top"
118
- withArrow
119
- >
120
- <ActionIcon
121
- variant="transparent"
122
- size="xs"
123
- aria-label={helpIconLabel ?? 'Help'}
124
- onClick={onHelpIconClick}
125
- color="gray"
126
- style={{ cursor: onHelpIconClick ? 'pointer' : 'default' }}
127
- >
128
- <IconInfoCircle size={14} aria-hidden />
129
- </ActionIcon>
130
- </Tooltip>
131
- ) : null;
132
-
133
- const selectorIcon = <IconSelector size={14} aria-hidden />;
134
-
135
- const composedRightSection = helpIconElement
136
- ? <Group gap={4} wrap="nowrap">{selectorIcon}{helpIconElement}</Group>
137
- : selectorIcon;
101
+ const labelProps = getInputLabelProps({
102
+ label,
103
+ required,
104
+ showOptional,
105
+ hasHelpIcon,
106
+ helpIconLabel,
107
+ onHelpIconClick,
108
+ });
138
109
 
139
110
  const mergedClassNames =
140
111
  typeof classNames === 'function'
@@ -153,9 +124,9 @@ export const Select = forwardRef<HTMLInputElement, DSSelectProps>(
153
124
  size={size}
154
125
  radius="sm"
155
126
  required={required}
156
- label={enhancedLabel}
157
- rightSection={composedRightSection}
158
- rightSectionPointerEvents={hasHelpIcon || props.clearable ? 'auto' : 'none'}
127
+ {...labelProps}
128
+ rightSection={<IconSelector size={14} aria-hidden />}
129
+ rightSectionPointerEvents={props.clearable ? 'auto' : 'none'}
159
130
  variant={variant ?? 'default'}
160
131
  classNames={mergedClassNames}
161
132
  error={effectiveError}
@@ -5,6 +5,6 @@
5
5
  */
6
6
  export { SearchableSelect } from './SearchableSelect.js';
7
7
  export { AutocompleteClearable } from './AutocompleteClearable.js';
8
- export { Multiselect } from './Multiselect.js';
8
+ export { ADMultiselect } from './ADMultiselect.js';
9
9
  export { Select } from './Select.js';
10
10
  export { Combobox } from './Combobox.js';
@@ -10,8 +10,8 @@ export type { DSSearchableSelectProps } from './SearchableSelect';
10
10
  export { AutocompleteClearable } from './AutocompleteClearable';
11
11
  export type { DSAutocompleteClearableProps } from './AutocompleteClearable';
12
12
 
13
- export { Multiselect } from './Multiselect';
14
- export type { DSMultiselectProps } from './Multiselect';
13
+ export { ADMultiselect } from './ADMultiselect';
14
+ export type { ADMultiselectProps } from './ADMultiselect';
15
15
 
16
16
  export { Select } from './Select';
17
17
  export type { DSSelectProps } from './Select';
@@ -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
+ }