@appdirect/design-system 0.0.24 → 0.0.28

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 (46) hide show
  1. package/README.md +11 -0
  2. package/dist/Combobox/AutocompleteClearable.js +33 -35
  3. package/dist/Combobox/AutocompleteClearable.tsx +56 -121
  4. package/dist/Combobox/SearchableSelect.js +23 -42
  5. package/dist/Combobox/SearchableSelect.tsx +33 -129
  6. package/dist/ComplexComponents/DashboardWidget/DashboardWidget.js +1 -1
  7. package/dist/ComplexComponents/DashboardWidget/DashboardWidget.tsx +9 -7
  8. package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.js +1 -1
  9. package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.tsx +1 -1
  10. package/dist/ComplexComponents/KeyInsight/KeyInsights.js +6 -1
  11. package/dist/ComplexComponents/KeyInsight/KeyInsights.tsx +12 -2
  12. package/dist/ComplexComponents/PageContentHeader/PageContentHeader.js +1 -1
  13. package/dist/ComplexComponents/PageContentHeader/PageContentHeader.tsx +16 -11
  14. package/dist/ComplexComponents/Slat/Slat.js +14 -7
  15. package/dist/ComplexComponents/Slat/Slat.tsx +31 -19
  16. package/dist/ComplexComponents/Utilities/CopyButton.js +15 -27
  17. package/dist/ComplexComponents/Utilities/CopyButton.tsx +35 -49
  18. package/dist/DESIGN.md +4 -0
  19. package/dist/DataDisplay/Alert.js +2 -2
  20. package/dist/DataDisplay/Alert.tsx +7 -0
  21. package/dist/DataDisplay/Avatar.js +26 -81
  22. package/dist/DataDisplay/Avatar.tsx +35 -93
  23. package/dist/DataDisplay/Card.js +5 -4
  24. package/dist/DataDisplay/Card.tsx +5 -11
  25. package/dist/Layout/Inline.js +5 -42
  26. package/dist/Layout/Inline.tsx +6 -79
  27. package/dist/Overlays/Modal.js +2 -2
  28. package/dist/Overlays/Modal.tsx +4 -4
  29. package/dist/contracts/Alert.json +5 -0
  30. package/dist/contracts/index.json +1 -1
  31. package/dist/css/mantine.css +120 -12
  32. package/dist/css/tokens.css +52 -14
  33. package/dist/hooks/index.js +18 -0
  34. package/dist/hooks/index.ts +28 -0
  35. package/dist/hooks/useSelectedRowsText.js +73 -0
  36. package/dist/hooks/useSelectedRowsText.ts +74 -0
  37. package/dist/stories/Combobox/SearchableSelect.stories.tsx +3 -3
  38. package/dist/stories/ComplexComponents/DashboardWidget/DashboardWidget.stories.tsx +7 -0
  39. package/dist/stories/ComplexComponents/PageContentHeader/PageContentHeader.stories.tsx +21 -21
  40. package/dist/stories/ComplexComponents/Utilities/CopyButton.stories.tsx +4 -14
  41. package/dist/stories/DataDisplay/Progress.stories.tsx +11 -27
  42. package/dist/stories/Navigation/Stepper.stories.tsx +25 -21
  43. package/dist/stories/Overlays/Drawer.stories.tsx +6 -6
  44. package/dist/stories/Overlays/Modal.stories.tsx +31 -11
  45. package/dist/stories/index.json +6 -6
  46. package/package.json +97 -3
package/README.md CHANGED
@@ -97,6 +97,17 @@ export function Example() {
97
97
  }
98
98
  ```
99
99
 
100
+ Prefer the barrel for everyday use. For a single complex or `AD*` component without pulling the rest of the barrel, use a subpath export:
101
+
102
+ ```tsx
103
+ import { PageContentHeader } from '@appdirect/design-system/ComplexComponents/PageContentHeader';
104
+ import { KeyInsight } from '@appdirect/design-system/ComplexComponents/KeyInsight';
105
+ import { ADMultiselect } from '@appdirect/design-system/Combobox/ADMultiselect';
106
+ import { Button } from '@appdirect/design-system/Buttons';
107
+ ```
108
+
109
+ Category folders (`Buttons`, `Inputs`, `Layout`, …), `ComplexComponents/<Name>`, and `AD*` modules (e.g. `Combobox/ADMultiselect`) are listed in `package.json` `exports`. `npm run test:build` discovers every ComplexComponent folder and every `AD*.tsx` and asserts barrel + subpath resolve.
110
+
100
111
  Use AppDirect button variants (`primary`, `secondary`, `default`, `outline`, `danger`, `link`, `secret`), not Mantine `filled` / `light` / `subtle`. Prefer `--ad-*` tokens for colour; avoid palette props like `color="blue"`.
101
112
 
102
113
  Shared helpers:
@@ -1,36 +1,34 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState } from 'react';
4
- import { CloseButton, Combobox, TextInput, useCombobox } from '@mantine/core';
5
- const countries = [
6
- 'United States',
7
- 'Canada',
8
- 'United Kingdom',
9
- 'Germany',
10
- 'France',
11
- 'Australia',
12
- 'Japan',
13
- 'Singapore',
14
- ];
15
- export function AutocompleteClearable({ label, placeholder = "Pick a country or type anything", data = countries, description, error, required = false, showOptional = false, disabled = false, size = 'md', style, ...props }) {
16
- const combobox = useCombobox();
17
- const [value, setValue] = useState('');
18
- // Convert data to consistent format
19
- const normalizedData = data.map(item => typeof item === 'string' ? { value: item, label: item } : item);
20
- const shouldFilterOptions = !normalizedData.some((item) => item.value === value);
21
- const filteredOptions = shouldFilterOptions
22
- ? normalizedData.filter((item) => item.label.toLowerCase().includes(value.toLowerCase().trim()) ||
23
- item.value.toLowerCase().includes(value.toLowerCase().trim()))
24
- : normalizedData;
25
- const options = filteredOptions.map((item) => (_jsx(Combobox.Option, { value: item.value, children: item.label }, item.value)));
26
- return (_jsx("div", { style: style, children: _jsxs(Combobox, { onOptionSubmit: (optionValue) => {
27
- setValue(optionValue);
28
- combobox.closeDropdown();
29
- }, store: combobox, withinPortal: false, children: [_jsx(Combobox.Target, { children: _jsx(TextInput, { label: label, description: description, error: error, required: required, size: size, disabled: disabled, placeholder: placeholder, value: value, onChange: (event) => {
30
- setValue(event.currentTarget.value);
31
- combobox.openDropdown();
32
- combobox.updateSelectedOptionIndex();
33
- }, onClick: () => combobox.openDropdown(), onFocus: () => combobox.openDropdown(), onBlur: () => combobox.closeDropdown(), withAsterisk: required && !showOptional, ...(showOptional && !required && {
34
- label: label ? `${label} (optional)` : undefined
35
- }), rightSection: value !== '' && !disabled && (_jsx(CloseButton, { size: "sm", onMouseDown: (event) => event.preventDefault(), onClick: () => setValue(''), "aria-label": "Clear value" })) }) }), _jsx(Combobox.Dropdown, { children: _jsx(Combobox.Options, { children: options.length === 0 ? _jsx(Combobox.Empty, { children: "Nothing found" }) : options }) })] }) }));
36
- }
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React, { forwardRef, useMemo } from 'react';
4
+ import { Autocomplete as MantineAutocomplete } from '@mantine/core';
5
+ import { Text } from '../Typography/Text.js';
6
+ // ========================== COMPONENT ==========================
7
+ /**
8
+ * AppDirect Design System AutocompleteClearable
9
+ *
10
+ * Mantine's `Autocomplete` with the clear button on by default and DS sizing, radius
11
+ * and "(Optional)" label. Filtering, controlled and uncontrolled value, keyboard
12
+ * handling and every other `Autocomplete` prop are Mantine core behavior.
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * <AutocompleteClearable
17
+ * label="Country"
18
+ * placeholder="Pick a country or type anything"
19
+ * data={['United States', 'Canada', 'Germany']}
20
+ * />
21
+ * ```
22
+ */
23
+ export const AutocompleteClearable = forwardRef(({ size = 'md', clearable = true, showOptional = false, required, label, ...props }, ref) => {
24
+ const enhancedLabel = useMemo(() => {
25
+ if (!label)
26
+ return label;
27
+ if (showOptional && !required) {
28
+ return (_jsxs(_Fragment, { children: [label, " ", _jsx(Text, { span: true, c: "dimmed", fw: "normal", children: "(Optional)" })] }));
29
+ }
30
+ return label;
31
+ }, [label, showOptional, required]);
32
+ return (_jsx(MantineAutocomplete, { ref: ref, size: size, radius: "sm", clearable: clearable, required: required, label: enhancedLabel, ...props }));
33
+ });
34
+ AutocompleteClearable.displayName = 'AutocompleteClearable';
@@ -1,128 +1,63 @@
1
1
  'use client';
2
2
 
3
- import { useState } from 'react';
4
- import { CloseButton, Combobox, TextInput, useCombobox } from '@mantine/core';
3
+ import React, { forwardRef, useMemo } from 'react';
4
+ import { Autocomplete as MantineAutocomplete, AutocompleteProps as MantineAutocompleteProps } from '@mantine/core';
5
+ import { ComponentSize } from '../config';
6
+ import { Text } from '../Typography/Text';
5
7
 
6
- const countries = [
7
- 'United States',
8
- 'Canada',
9
- 'United Kingdom',
10
- 'Germany',
11
- 'France',
12
- 'Australia',
13
- 'Japan',
14
- 'Singapore',
15
- ];
8
+ // ========================== TYPES ==========================
16
9
 
17
- export interface DSAutocompleteClearableProps {
18
- /** Label for the input */
19
- label?: string;
20
- /** Placeholder text */
21
- placeholder?: string;
22
- /** Data array for options - can be strings or objects with value/label */
23
- data?: string[] | { value: string; label: string }[];
24
- /** Description text displayed below the input */
25
- description?: string;
26
- /** Error message */
27
- error?: string;
28
- /** Whether the field is required */
29
- required?: boolean;
30
- /** Whether to show "(optional)" next to the label */
10
+ export interface DSAutocompleteClearableProps extends Omit<MantineAutocompleteProps, 'size' | 'radius'> {
11
+ /** Input size from design system scale */
12
+ size?: ComponentSize;
13
+ /** Whether to show "(Optional)" text after the label */
31
14
  showOptional?: boolean;
32
- /** Whether the input is disabled */
33
- disabled?: boolean;
34
- /** Input size */
35
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
36
- /** Style object for the component */
37
- style?: React.CSSProperties;
38
15
  }
39
16
 
40
- export function AutocompleteClearable({
41
- label,
42
- placeholder = "Pick a country or type anything",
43
- data = countries,
44
- description,
45
- error,
46
- required = false,
47
- showOptional = false,
48
- disabled = false,
49
- size = 'md',
50
- style,
51
- ...props
52
- }: DSAutocompleteClearableProps) {
53
- const combobox = useCombobox();
54
- const [value, setValue] = useState('');
55
-
56
- // Convert data to consistent format
57
- const normalizedData = data.map(item =>
58
- typeof item === 'string' ? { value: item, label: item } : item
59
- );
60
-
61
- const shouldFilterOptions = !normalizedData.some((item) => item.value === value);
62
- const filteredOptions = shouldFilterOptions
63
- ? normalizedData.filter((item) =>
64
- item.label.toLowerCase().includes(value.toLowerCase().trim()) ||
65
- item.value.toLowerCase().includes(value.toLowerCase().trim())
66
- )
67
- : normalizedData;
68
-
69
- const options = filteredOptions.map((item) => (
70
- <Combobox.Option value={item.value} key={item.value}>
71
- {item.label}
72
- </Combobox.Option>
73
- ));
74
-
75
- return (
76
- <div style={style}>
77
- <Combobox
78
- onOptionSubmit={(optionValue) => {
79
- setValue(optionValue);
80
- combobox.closeDropdown();
81
- }}
82
- store={combobox}
83
- withinPortal={false}
84
- >
85
- <Combobox.Target>
86
- <TextInput
87
- label={label}
88
- description={description}
89
- error={error}
90
- required={required}
91
- size={size}
92
- disabled={disabled}
93
- placeholder={placeholder}
94
- value={value}
95
- onChange={(event) => {
96
- setValue(event.currentTarget.value);
97
- combobox.openDropdown();
98
- combobox.updateSelectedOptionIndex();
99
- }}
100
- onClick={() => combobox.openDropdown()}
101
- onFocus={() => combobox.openDropdown()}
102
- onBlur={() => combobox.closeDropdown()}
103
- withAsterisk={required && !showOptional}
104
- {...(showOptional && !required && {
105
- label: label ? `${label} (optional)` : undefined
106
- })}
107
- rightSection={
108
- value !== '' && !disabled && (
109
- <CloseButton
110
- size="sm"
111
- onMouseDown={(event) => event.preventDefault()}
112
- onClick={() => setValue('')}
113
- aria-label="Clear value"
114
- />
115
- )
116
- }
117
- />
118
- </Combobox.Target>
119
-
120
- <Combobox.Dropdown>
121
- <Combobox.Options>
122
- {options.length === 0 ? <Combobox.Empty>Nothing found</Combobox.Empty> : options}
123
- </Combobox.Options>
124
- </Combobox.Dropdown>
125
- </Combobox>
126
- </div>
127
- );
128
- }
17
+ // ========================== COMPONENT ==========================
18
+
19
+ /**
20
+ * AppDirect Design System AutocompleteClearable
21
+ *
22
+ * Mantine's `Autocomplete` with the clear button on by default and DS sizing, radius
23
+ * and "(Optional)" label. Filtering, controlled and uncontrolled value, keyboard
24
+ * handling and every other `Autocomplete` prop are Mantine core behavior.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * <AutocompleteClearable
29
+ * label="Country"
30
+ * placeholder="Pick a country or type anything"
31
+ * data={['United States', 'Canada', 'Germany']}
32
+ * />
33
+ * ```
34
+ */
35
+ export const AutocompleteClearable = forwardRef<HTMLInputElement, DSAutocompleteClearableProps>(
36
+ ({ size = 'md', clearable = true, showOptional = false, required, label, ...props }, ref) => {
37
+ const enhancedLabel = useMemo(() => {
38
+ if (!label) return label;
39
+ if (showOptional && !required) {
40
+ return (
41
+ <>
42
+ {label} <Text span c="dimmed" fw="normal">(Optional)</Text>
43
+ </>
44
+ );
45
+ }
46
+ return label;
47
+ }, [label, showOptional, required]);
48
+
49
+ return (
50
+ <MantineAutocomplete
51
+ ref={ref}
52
+ size={size}
53
+ radius="sm"
54
+ clearable={clearable}
55
+ required={required}
56
+ label={enhancedLabel}
57
+ {...props}
58
+ />
59
+ );
60
+ }
61
+ );
62
+
63
+ AutocompleteClearable.displayName = 'AutocompleteClearable';
@@ -1,43 +1,24 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState } from 'react';
4
- import { Combobox, InputBase, useCombobox } from '@mantine/core';
5
- const languages = [
6
- 'JavaScript',
7
- 'TypeScript',
8
- 'Python',
9
- 'Java',
10
- 'C++',
11
- 'Go',
12
- 'Rust',
13
- 'Swift',
14
- ];
15
- export function SearchableSelect({ label, placeholder = "Search programming languages", data = languages, description, error, required = false, showOptional = false, disabled = false, searchable = true, size = 'md', style, ...props }) {
16
- const combobox = useCombobox({
17
- onDropdownClose: () => combobox.resetSelectedOption(),
18
- });
19
- const [value, setValue] = useState(null);
20
- const [search, setSearch] = useState('');
21
- // Convert data to consistent format
22
- const normalizedData = data.map(item => typeof item === 'string' ? { value: item, label: item } : item);
23
- const shouldFilterOptions = normalizedData.every((item) => item.value !== search);
24
- const filteredOptions = shouldFilterOptions && searchable
25
- ? normalizedData.filter((item) => item.label.toLowerCase().includes(search.toLowerCase().trim()) ||
26
- item.value.toLowerCase().includes(search.toLowerCase().trim()))
27
- : normalizedData;
28
- const options = filteredOptions.map((item) => (_jsx(Combobox.Option, { value: item.value, children: item.label }, item.value)));
29
- return (_jsx("div", { style: style, children: _jsxs(Combobox, { store: combobox, withinPortal: false, onOptionSubmit: (val) => {
30
- setValue(val);
31
- setSearch(val);
32
- combobox.closeDropdown();
33
- }, children: [_jsx(Combobox.Target, { children: _jsx(InputBase, { label: label, description: description, error: error, required: required, size: size, disabled: disabled, rightSection: _jsx(Combobox.Chevron, {}), value: search, onChange: (event) => {
34
- combobox.openDropdown();
35
- combobox.updateSelectedOptionIndex();
36
- setSearch(event.currentTarget.value);
37
- }, onClick: () => combobox.openDropdown(), onFocus: () => combobox.openDropdown(), onBlur: () => {
38
- combobox.closeDropdown();
39
- setSearch(value || '');
40
- }, placeholder: placeholder, rightSectionPointerEvents: "none", withAsterisk: required && !showOptional, ...(showOptional && !required && {
41
- label: label ? `${label} (optional)` : undefined
42
- }) }) }), _jsx(Combobox.Dropdown, { children: _jsx(Combobox.Options, { children: options.length > 0 ? options : _jsx(Combobox.Empty, { children: "Nothing found" }) }) })] }) }));
43
- }
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React, { forwardRef } from 'react';
4
+ import { Select } from './Select.js';
5
+ // ========================== COMPONENT ==========================
6
+ /**
7
+ * AppDirect Design System SearchableSelect
8
+ *
9
+ * The DS `Select` (Mantine's `Select`) with `searchable` on by default, so the
10
+ * field is typeable and filters its options. Search, filtering, controlled and
11
+ * uncontrolled value, clearable, grouping and every other `Select` prop are Mantine
12
+ * core behavior.
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * <SearchableSelect
17
+ * label="Language"
18
+ * placeholder="Search languages"
19
+ * data={['JavaScript', 'TypeScript', 'Python']}
20
+ * />
21
+ * ```
22
+ */
23
+ export const SearchableSelect = forwardRef(({ searchable = true, size = 'md', ...props }, ref) => (_jsx(Select, { ref: ref, searchable: searchable, size: size, ...props })));
24
+ SearchableSelect.displayName = 'SearchableSelect';
@@ -1,131 +1,35 @@
1
1
  'use client';
2
2
 
3
- import { useState } from 'react';
4
- import { Combobox, InputBase, useCombobox } from '@mantine/core';
5
-
6
- const languages = [
7
- 'JavaScript',
8
- 'TypeScript',
9
- 'Python',
10
- 'Java',
11
- 'C++',
12
- 'Go',
13
- 'Rust',
14
- 'Swift',
15
- ];
16
-
17
- export interface DSSearchableSelectProps {
18
- /** Label for the input */
19
- label?: string;
20
- /** Placeholder text */
21
- placeholder?: string;
22
- /** Data array for options - can be strings or objects with value/label */
23
- data?: string[] | { value: string; label: string }[];
24
- /** Description text displayed below the input */
25
- description?: string;
26
- /** Error message */
27
- error?: string;
28
- /** Whether the field is required */
29
- required?: boolean;
30
- /** Whether to show "(optional)" next to the label */
31
- showOptional?: boolean;
32
- /** Whether the input is disabled */
33
- disabled?: boolean;
34
- /** Whether the select is searchable */
35
- searchable?: boolean;
36
- /** Input size */
37
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
38
- /** Style object for the component */
39
- style?: React.CSSProperties;
40
- }
41
-
42
- export function SearchableSelect({
43
- label,
44
- placeholder = "Search programming languages",
45
- data = languages,
46
- description,
47
- error,
48
- required = false,
49
- showOptional = false,
50
- disabled = false,
51
- searchable = true,
52
- size = 'md',
53
- style,
54
- ...props
55
- }: DSSearchableSelectProps) {
56
- const combobox = useCombobox({
57
- onDropdownClose: () => combobox.resetSelectedOption(),
58
- });
59
-
60
- const [value, setValue] = useState<string | null>(null);
61
- const [search, setSearch] = useState('');
62
-
63
- // Convert data to consistent format
64
- const normalizedData = data.map(item =>
65
- typeof item === 'string' ? { value: item, label: item } : item
66
- );
67
-
68
- const shouldFilterOptions = normalizedData.every((item) => item.value !== search);
69
- const filteredOptions = shouldFilterOptions && searchable
70
- ? normalizedData.filter((item) =>
71
- item.label.toLowerCase().includes(search.toLowerCase().trim()) ||
72
- item.value.toLowerCase().includes(search.toLowerCase().trim())
73
- )
74
- : normalizedData;
75
-
76
- const options = filteredOptions.map((item) => (
77
- <Combobox.Option value={item.value} key={item.value}>
78
- {item.label}
79
- </Combobox.Option>
80
- ));
81
-
82
- return (
83
- <div style={style}>
84
- <Combobox
85
- store={combobox}
86
- withinPortal={false}
87
- onOptionSubmit={(val) => {
88
- setValue(val);
89
- setSearch(val);
90
- combobox.closeDropdown();
91
- }}
92
- >
93
- <Combobox.Target>
94
- <InputBase
95
- label={label}
96
- description={description}
97
- error={error}
98
- required={required}
99
- size={size}
100
- disabled={disabled}
101
- rightSection={<Combobox.Chevron />}
102
- value={search}
103
- onChange={(event) => {
104
- combobox.openDropdown();
105
- combobox.updateSelectedOptionIndex();
106
- setSearch(event.currentTarget.value);
107
- }}
108
- onClick={() => combobox.openDropdown()}
109
- onFocus={() => combobox.openDropdown()}
110
- onBlur={() => {
111
- combobox.closeDropdown();
112
- setSearch(value || '');
113
- }}
114
- placeholder={placeholder}
115
- rightSectionPointerEvents="none"
116
- withAsterisk={required && !showOptional}
117
- {...(showOptional && !required && {
118
- label: label ? `${label} (optional)` : undefined
119
- })}
120
- />
121
- </Combobox.Target>
122
-
123
- <Combobox.Dropdown>
124
- <Combobox.Options>
125
- {options.length > 0 ? options : <Combobox.Empty>Nothing found</Combobox.Empty>}
126
- </Combobox.Options>
127
- </Combobox.Dropdown>
128
- </Combobox>
129
- </div>
130
- );
131
- }
3
+ import React, { forwardRef } from 'react';
4
+ import { Select, DSSelectProps } from './Select';
5
+
6
+ // ========================== TYPES ==========================
7
+
8
+ export type DSSearchableSelectProps = DSSelectProps;
9
+
10
+ // ========================== COMPONENT ==========================
11
+
12
+ /**
13
+ * AppDirect Design System SearchableSelect
14
+ *
15
+ * The DS `Select` (Mantine's `Select`) with `searchable` on by default, so the
16
+ * field is typeable and filters its options. Search, filtering, controlled and
17
+ * uncontrolled value, clearable, grouping and every other `Select` prop are Mantine
18
+ * core behavior.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * <SearchableSelect
23
+ * label="Language"
24
+ * placeholder="Search languages"
25
+ * data={['JavaScript', 'TypeScript', 'Python']}
26
+ * />
27
+ * ```
28
+ */
29
+ export const SearchableSelect = forwardRef<HTMLInputElement, DSSearchableSelectProps>(
30
+ ({ searchable = true, size = 'md', ...props }, ref) => (
31
+ <Select ref={ref} searchable={searchable} size={size} {...props} />
32
+ )
33
+ );
34
+
35
+ SearchableSelect.displayName = 'SearchableSelect';
@@ -56,5 +56,5 @@ export function DashboardWidget({ title, editable = false, onEdit, panelNotifica
56
56
  const hasFooterLinks = Boolean(footerLinks && footerLinks.length > 0);
57
57
  const renderHeader = () => (_jsxs("div", { className: "ad-DashboardWidget-header", children: [_jsxs("div", { className: "ad-DashboardWidget-titleGroup", children: [_jsx(Title, { order: 4, className: "ad-DashboardWidget-title", children: title }), editable && (_jsx(ActionIcon, { size: "sm", onClick: onEdit, "aria-label": "Edit title", children: _jsx(RiEditLine, { size: 16 }) }))] }), _jsxs("div", { className: "ad-DashboardWidget-controls", children: [switchConfig && (_jsxs("div", { className: "ad-DashboardWidget-switch", children: [switchConfig.label ? _jsx(Text, { size: "sm", children: switchConfig.label }) : null, _jsx(Switch, { checked: switchConfig.checked, onChange: (event) => switchConfig.onChange(event.currentTarget.checked), disabled: switchConfig.disabled, size: "sm" })] })), headerSelect && (_jsx(Select, { data: headerSelect.data, value: headerSelect.value, onChange: headerSelect.onChange, placeholder: headerSelect.placeholder, disabled: headerSelect.disabled, searchable: headerSelect.searchable, clearable: headerSelect.clearable, borderless: true, size: "sm" })), actionsMenu && !headerSelect && (_jsx(Menu, { trigger: _jsx(ActionIcon, { size: "sm", "aria-label": "Widget actions", children: _jsx(RiMore2Fill, { size: 16 }) }), position: "bottom-end", sections: actionsMenu.sections }))] })] }));
58
58
  const renderFooter = () => (_jsx("div", { className: "ad-DashboardWidget-footer", children: hasFooterLinks ? (_jsx("div", { className: "ad-DashboardWidget-footerLinks", children: footerLinks.map((link, index) => (_jsxs("button", { type: "button", className: "ad-DashboardWidget-footerLink", "data-disabled": link.disabled ? '' : undefined, disabled: link.disabled, onClick: link.disabled ? undefined : link.onClick, children: [_jsx(Text, { span: true, size: "sm", children: link.label }), _jsx(RiArrowRightSLine, { size: 14 })] }, index))) })) : (_jsx("div", { className: "ad-DashboardWidget-footerSpacer" })) }));
59
- return (_jsxs(Card, { ...restCardProps, style: cardStyle, className: ['ad-DashboardWidget', cardClassName].filter(Boolean).join(' '), "data-interactive": interactive ? '' : undefined, "data-selected": selected ? '' : undefined, children: [_jsxs("div", { className: "ad-DashboardWidget-body", "data-spacing": spacing === 'lg' ? undefined : spacing, children: [renderHeader(), panelNotification && (_jsx(Alert, { color: "info", children: panelNotificationMessage })), _jsx("div", { className: "ad-DashboardWidget-content", children: children })] }), renderFooter()] }));
59
+ return (_jsxs(Card, { ...restCardProps, style: cardStyle, className: ['ad-DashboardWidget', cardClassName].filter(Boolean).join(' '), "data-interactive": interactive ? '' : undefined, "data-selected": selected ? '' : undefined, children: [panelNotification && (_jsx("div", { className: "ad-DashboardWidget-notification", children: _jsx(Alert, { panel: true, color: "info", children: panelNotificationMessage }) })), _jsxs("div", { className: "ad-DashboardWidget-body", "data-spacing": spacing === 'lg' ? undefined : spacing, children: [renderHeader(), _jsx("div", { className: "ad-DashboardWidget-content", children: children })] }), renderFooter()] }));
60
60
  }
@@ -31,7 +31,7 @@ export interface DashboardWidgetProps {
31
31
  onEdit?: () => void;
32
32
 
33
33
  // ==================== PANEL NOTIFICATION ====================
34
- /** Whether to show a panel notification banner below the header */
34
+ /** Whether to show a panel notification bar flush at the top of the widget, above the header */
35
35
  panelNotification?: boolean;
36
36
  /** Content for the panel notification (ignored when panelNotification is false) */
37
37
  panelNotificationMessage?: React.ReactNode;
@@ -242,18 +242,20 @@ export function DashboardWidget({
242
242
  data-interactive={interactive ? '' : undefined}
243
243
  data-selected={selected ? '' : undefined}
244
244
  >
245
+ {panelNotification && (
246
+ <div className="ad-DashboardWidget-notification">
247
+ <Alert panel color="info">
248
+ {panelNotificationMessage}
249
+ </Alert>
250
+ </div>
251
+ )}
252
+
245
253
  <div
246
254
  className="ad-DashboardWidget-body"
247
255
  data-spacing={spacing === 'lg' ? undefined : spacing}
248
256
  >
249
257
  {renderHeader()}
250
258
 
251
- {panelNotification && (
252
- <Alert color="info">
253
- {panelNotificationMessage}
254
- </Alert>
255
- )}
256
-
257
259
  <div className="ad-DashboardWidget-content">
258
260
  {children}
259
261
  </div>
@@ -6,7 +6,7 @@ import { CloseButton, Combobox, InputBase, InputPlaceholder, Popover, useCombobo
6
6
  import { DatePicker } from "@mantine/dates";
7
7
  import { translate } from "../../translations/index.js"; // DS-ADAPT: translate lives in DataTable/translations
8
8
  import { Preset, getPresetLabel, getPresets, getDateRangeFromPreset } from "./utils.js";
9
- import useClickOutside from '../../../../hooks/useClickOutside';
9
+ import useClickOutside from "../../hooks/useClickOutside.js";
10
10
  import styles from "./DateRangeSelectorFilter.module.css";
11
11
  /** Parse a local `YYYY-MM-DD` string (or Date) to a local-midnight Date. */
12
12
  const toLocalDate = (value) => {
@@ -12,7 +12,7 @@ import {
12
12
  import { DatePicker, DatesRangeValue } from "@mantine/dates";
13
13
  import { translate } from "../../translations"; // DS-ADAPT: translate lives in DataTable/translations
14
14
  import { Preset, getPresetLabel, getPresets, getDateRangeFromPreset } from "./utils";
15
- import useClickOutside from '../../../../hooks/useClickOutside';
15
+ import useClickOutside from "../../hooks/useClickOutside";
16
16
  import styles from "./DateRangeSelectorFilter.module.css";
17
17
 
18
18
  /** DS-ADAPT: Mantine 9 DatePicker works with local `YYYY-MM-DD` strings; presets emit Dates. */
@@ -24,6 +24,11 @@ function resolveSize(size) {
24
24
  }
25
25
  return size;
26
26
  }
27
+ // Fixed locale so server and client render identically (no hydration mismatch).
28
+ const numberFormatter = new Intl.NumberFormat('en-US', { maximumFractionDigits: 20 });
29
+ function formatValue(value) {
30
+ return typeof value === 'number' && Number.isFinite(value) ? numberFormatter.format(value) : value;
31
+ }
27
32
  /**
28
33
  * KeyInsight Component
29
34
  *
@@ -36,5 +41,5 @@ function resolveSize(size) {
36
41
  export function KeyInsight({ value, title, subtitle, showBorder = false, size = 'level-2', valueAs, leftSection, rightSection, }) {
37
42
  const canonicalSize = resolveSize(size);
38
43
  const ValueElement = valueAs ?? DEFAULT_VALUE_ELEMENT[canonicalSize];
39
- return (_jsxs(Box, { className: "ad-KeyInsight", "data-size": canonicalSize, "data-border": showBorder ? '' : undefined, children: [_jsxs(Box, { className: "ad-KeyInsight-valueRow", children: [leftSection, _jsx(ValueElement, { className: "ad-KeyInsight-value", children: value }), rightSection] }), _jsx("p", { className: "ad-KeyInsight-title", children: title }), subtitle ? _jsx("p", { className: "ad-KeyInsight-subtitle", children: subtitle }) : null] }));
44
+ return (_jsxs(Box, { className: "ad-KeyInsight", "data-size": canonicalSize, "data-border": showBorder ? '' : undefined, children: [_jsxs(Box, { className: "ad-KeyInsight-valueRow", children: [leftSection, _jsx(ValueElement, { className: "ad-KeyInsight-value", children: formatValue(value) }), rightSection] }), _jsx("p", { className: "ad-KeyInsight-title", children: title }), subtitle ? _jsx("p", { className: "ad-KeyInsight-subtitle", children: subtitle }) : null] }));
40
45
  }
@@ -24,7 +24,10 @@ export type KeyInsightSize = KeyInsightCanonicalSize | KeyInsightLegacySize;
24
24
  export type KeyInsightValueAs = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span';
25
25
 
26
26
  export interface KeyInsightProps {
27
- /** Value to display (can be number or string) */
27
+ /**
28
+ * Value to display. Numbers are shown with thousands separators (`11987` → `11,987`).
29
+ * Strings are rendered as-is, so pre-formatted values like `"95%"` or IDs are never altered.
30
+ */
28
31
  value: string | number;
29
32
  /** Title/label for the insight */
30
33
  title: string;
@@ -76,6 +79,13 @@ function resolveSize(size: KeyInsightSize): KeyInsightCanonicalSize {
76
79
  return size as KeyInsightCanonicalSize;
77
80
  }
78
81
 
82
+ // Fixed locale so server and client render identically (no hydration mismatch).
83
+ const numberFormatter = new Intl.NumberFormat('en-US', { maximumFractionDigits: 20 });
84
+
85
+ function formatValue(value: string | number): string | number {
86
+ return typeof value === 'number' && Number.isFinite(value) ? numberFormatter.format(value) : value;
87
+ }
88
+
79
89
  /**
80
90
  * KeyInsight Component
81
91
  *
@@ -106,7 +116,7 @@ export function KeyInsight({
106
116
  >
107
117
  <Box className="ad-KeyInsight-valueRow">
108
118
  {leftSection}
109
- <ValueElement className="ad-KeyInsight-value">{value}</ValueElement>
119
+ <ValueElement className="ad-KeyInsight-value">{formatValue(value)}</ValueElement>
110
120
  {rightSection}
111
121
  </Box>
112
122
  <p className="ad-KeyInsight-title">{title}</p>
@@ -88,5 +88,5 @@ cardProps = {}, spacing = 'sm', }) {
88
88
  };
89
89
  // ==================== MAIN RENDER ==========================
90
90
  const contentSection_ = renderContentSection();
91
- return (_jsxs(Card, { pb: contentSection_ ? 0 : undefined, ...cardProps, children: [_jsxs(Stack, { gap: spacing, children: [_jsx(Box, { children: renderHeader() }), actions.length > 0 && (_jsx(Box, { children: renderActions() })), panelNotification && (_jsx(Alert, { color: "info", children: panelNotificationMessage }))] }), contentSection_ && (_jsx(Card.Section, { withBorder: true, mt: "md", children: contentSection_ }))] }));
91
+ return (_jsxs(Card, { ...cardProps, children: [panelNotification && (_jsx(Card.Section, { children: _jsx(Alert, { panel: true, color: "info", children: panelNotificationMessage }) })), _jsxs(Stack, { gap: spacing, mt: panelNotification ? 'var(--card-padding)' : undefined, children: [_jsx(Box, { children: renderHeader() }), actions.length > 0 && (_jsx(Box, { children: renderActions() }))] }), contentSection_ && (_jsx(Card.Section, { withBorder: true, mt: "md", children: contentSection_ }))] }));
92
92
  }