@appdirect/design-system 0.0.16 → 0.0.18
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/bin/ad-sync-design-md.mjs +0 -0
- package/dist/ComplexComponents/DataTable/CellHoverReveal/CellHoverReveal.module.css +25 -0
- package/dist/ComplexComponents/DataTable/CellHoverReveal/index.js +24 -0
- package/dist/ComplexComponents/DataTable/CellHoverReveal/index.tsx +44 -0
- package/dist/ComplexComponents/DataTable/CustomBottomToolbar/CustomBottomToolbar.module.css +7 -0
- package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.js +25 -77
- package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.tsx +101 -157
- package/dist/ComplexComponents/DataTable/CustomBottomToolbar/utils.js +14 -7
- package/dist/ComplexComponents/DataTable/CustomBottomToolbar/utils.ts +13 -7
- package/dist/ComplexComponents/DataTable/CustomToolbarAlertBannerContent/CustomToolbarAlertBannerContent.module.css +4 -0
- package/dist/ComplexComponents/DataTable/CustomToolbarAlertBannerContent/index.js +8 -20
- package/dist/ComplexComponents/DataTable/CustomToolbarAlertBannerContent/index.tsx +40 -58
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/CustomTopToolbar.module.css +7 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/DateRangeSelectorFilter.module.css +3 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.js +50 -154
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.tsx +59 -205
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/utils.js +48 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/utils.ts +51 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterChip.js +5 -25
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterChip.tsx +7 -28
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/ResultCount.js +16 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/ResultCount.tsx +26 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.js +26 -28
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.tsx +38 -38
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/SelectFilter.js +8 -18
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/SelectFilter.module.css +3 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/SelectFilter.tsx +25 -37
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/index.js +67 -378
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/index.tsx +170 -711
- package/dist/ComplexComponents/DataTable/DataTable.js +74 -393
- package/dist/ComplexComponents/DataTable/DataTable.tsx +229 -546
- package/dist/ComplexComponents/DataTable/DataTableGrid/DataTableGrid.module.css +85 -0
- package/dist/ComplexComponents/DataTable/DataTableGrid/index.js +46 -0
- package/dist/ComplexComponents/DataTable/DataTableGrid/index.tsx +143 -0
- package/dist/ComplexComponents/DataTable/DataTableShell/DataTableShell.module.css +38 -0
- package/dist/ComplexComponents/DataTable/DataTableShell/index.js +9 -0
- package/dist/ComplexComponents/DataTable/DataTableShell/index.tsx +47 -0
- package/dist/ComplexComponents/DataTable/ErrorOverlay/index.js +6 -6
- package/dist/ComplexComponents/DataTable/ErrorOverlay/index.tsx +53 -24
- package/dist/ComplexComponents/DataTable/SelectCheckbox/index.js +33 -0
- package/dist/ComplexComponents/DataTable/SelectCheckbox/index.tsx +63 -0
- package/dist/ComplexComponents/DataTable/SortableHeaderCell/SortableHeaderCell.module.css +3 -0
- package/dist/ComplexComponents/DataTable/SortableHeaderCell/index.js +43 -21
- package/dist/ComplexComponents/DataTable/SortableHeaderCell/index.tsx +62 -38
- package/dist/ComplexComponents/DataTable/ToggleDensityButton/index.js +18 -0
- package/dist/ComplexComponents/DataTable/ToggleDensityButton/index.tsx +47 -0
- package/dist/ComplexComponents/DataTable/ToggleFullScreenButton/index.js +19 -0
- package/dist/ComplexComponents/DataTable/ToggleFullScreenButton/index.tsx +59 -0
- package/dist/ComplexComponents/DataTable/ToolbarAlertBanner/ToolbarAlertBanner.module.css +15 -0
- package/dist/ComplexComponents/DataTable/ToolbarAlertBanner/index.js +8 -0
- package/dist/ComplexComponents/DataTable/ToolbarAlertBanner/index.tsx +20 -0
- package/dist/ComplexComponents/DataTable/hooks/useClickOutside.js +27 -0
- package/dist/ComplexComponents/DataTable/hooks/useClickOutside.ts +39 -0
- package/dist/ComplexComponents/DataTable/index.js +5 -1
- package/dist/ComplexComponents/DataTable/index.ts +13 -2
- package/dist/ComplexComponents/DataTable/table.module.css +9 -0
- package/dist/ComplexComponents/DataTable/tableFeatures.js +6 -0
- package/dist/ComplexComponents/DataTable/tableFeatures.ts +7 -0
- package/dist/ComplexComponents/DataTable/translations/en.js +16 -4
- package/dist/ComplexComponents/DataTable/translations/en.ts +16 -4
- package/dist/ComplexComponents/DataTable/translations/index.js +5 -0
- package/dist/ComplexComponents/DataTable/translations/index.ts +11 -1
- package/dist/ComplexComponents/DataTable/types.js +5 -0
- package/dist/ComplexComponents/DataTable/types.ts +17 -0
- package/dist/ComplexComponents/DataTable/utils/parseCSSVarId.js +3 -0
- package/dist/ComplexComponents/DataTable/utils/parseCSSVarId.ts +4 -0
- package/dist/DESIGN.md +9 -10
- package/dist/contracts/DataTable.json +83 -6
- package/dist/contracts/index.json +1 -1
- package/dist/css/foundations.css +4 -0
- package/dist/css/mantine.css +1 -1
- package/dist/css/tokens.css +3145 -0
- package/dist/index.js +3 -0
- package/dist/index.ts +14 -1
- package/dist/stories/ComplexComponents/DataTable/DataTable.stories.tsx +216 -458
- package/dist/stories/index.json +13 -15
- package/package.json +5 -3
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/ResultCount/index.js +0 -31
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/ResultCount/index.tsx +0 -76
- package/dist/hooks/useTableHandlers.js +0 -136
- package/dist/hooks/useTableHandlers.ts +0 -179
- package/dist/hooks/useTableRenderFunctions.js +0 -164
- package/dist/hooks/useTableRenderFunctions.tsx +0 -283
- package/dist/hooks/useTableState.js +0 -70
- package/dist/hooks/useTableState.ts +0 -81
|
@@ -1,42 +1,40 @@
|
|
|
1
|
+
'use client'; // DS-ADAPT: Next.js App Router
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
+
// Source of truth: micro-ui-ts/src/components/Table/CustomTopToolbar/SearchFilter.tsx. Keep in sync; DS-only changes are marked DS-ADAPT.
|
|
4
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { RiSearchLine as SearchIcon } from "@remixicon/react"; // DS-ADAPT: @remixicon/react instead of remixicon svg import
|
|
6
|
+
import { RiCloseLine as CloseIcon } from "@remixicon/react"; // DS-ADAPT: @remixicon/react instead of remixicon svg import
|
|
3
7
|
import { rem, TextInput } from "@mantine/core";
|
|
4
|
-
import {
|
|
5
|
-
// Local translation function
|
|
6
|
-
const translate = (key, params) => {
|
|
7
|
-
if (!params)
|
|
8
|
-
return key;
|
|
9
|
-
return Object.entries(params).reduce((str, [key, value]) => {
|
|
10
|
-
return str.replace(`{${key}}`, String(value));
|
|
11
|
-
}, key);
|
|
12
|
-
};
|
|
8
|
+
import { translate } from "../translations/index.js"; // DS-ADAPT: translate lives in DataTable/translations
|
|
13
9
|
const debounce = (fn, timeout = 1000) => {
|
|
14
10
|
let timer;
|
|
15
11
|
return (value) => {
|
|
16
|
-
if (timer)
|
|
12
|
+
if (timer)
|
|
17
13
|
clearTimeout(timer);
|
|
18
|
-
|
|
19
|
-
timer = setTimeout(() => {
|
|
20
|
-
fn(value);
|
|
21
|
-
}, timeout);
|
|
14
|
+
timer = setTimeout(() => fn(value), timeout);
|
|
22
15
|
};
|
|
23
16
|
};
|
|
24
17
|
const SearchFilter = ({ searchTerm, onChange }) => {
|
|
25
|
-
const [
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
const [localSearchTerm, setLocalSearchTerm] = useState(searchTerm);
|
|
19
|
+
// DS-ADAPT: always call the latest onChange; the debounced fn is created once.
|
|
20
|
+
const onChangeRef = useRef(onChange);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
onChangeRef.current = onChange;
|
|
23
|
+
});
|
|
24
|
+
const debouncedSearch = useRef(debounce(value => {
|
|
25
|
+
onChangeRef.current(value);
|
|
26
|
+
}, 300)).current;
|
|
27
|
+
const handleSearchChange = (value) => {
|
|
28
|
+
setLocalSearchTerm(value);
|
|
29
|
+
debouncedSearch(value);
|
|
31
30
|
};
|
|
32
|
-
const
|
|
33
|
-
|
|
31
|
+
const clearSearch = () => {
|
|
32
|
+
setLocalSearchTerm("");
|
|
34
33
|
onChange("");
|
|
35
34
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} }));
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
setLocalSearchTerm(searchTerm);
|
|
37
|
+
}, [searchTerm]);
|
|
38
|
+
return (_jsx(TextInput, { size: "xs", placeholder: translate("table.search.placeholder"), flex: "1 1 auto", onChange: (event) => handleSearchChange(event.target.value), rightSection: localSearchTerm === "" ? (_jsx(SearchIcon, { style: { width: rem(14), height: rem(14) } })) : (_jsx(CloseIcon, { "data-testid": "search-clear", onClick: clearSearch, style: { width: rem(14), height: rem(14), cursor: "pointer" } })), value: localSearchTerm }));
|
|
41
39
|
};
|
|
42
40
|
export default SearchFilter;
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'; // DS-ADAPT: Next.js App Router
|
|
2
|
+
// Source of truth: micro-ui-ts/src/components/Table/CustomTopToolbar/SearchFilter.tsx. Keep in sync; DS-only changes are marked DS-ADAPT.
|
|
3
|
+
import React, { ReactElement, useEffect, useRef, useState } from "react";
|
|
4
|
+
import { RiSearchLine as SearchIcon } from "@remixicon/react"; // DS-ADAPT: @remixicon/react instead of remixicon svg import
|
|
5
|
+
import { RiCloseLine as CloseIcon } from "@remixicon/react"; // DS-ADAPT: @remixicon/react instead of remixicon svg import
|
|
2
6
|
import { rem, TextInput } from "@mantine/core";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
// Local translation function
|
|
6
|
-
const translate = (key: string, params?: Record<string, any>) => {
|
|
7
|
-
if (!params) return key;
|
|
8
|
-
return Object.entries(params).reduce((str, [key, value]) => {
|
|
9
|
-
return str.replace(`{${key}}`, String(value));
|
|
10
|
-
}, key);
|
|
11
|
-
};
|
|
7
|
+
import { translate } from "../translations"; // DS-ADAPT: translate lives in DataTable/translations
|
|
12
8
|
|
|
13
9
|
const debounce = (fn: (value: string) => void, timeout = 1000): ((value: string) => void) => {
|
|
14
10
|
let timer: NodeJS.Timeout | undefined;
|
|
15
|
-
return (value: string) => {
|
|
16
|
-
if (timer)
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
timer = setTimeout(() => {
|
|
20
|
-
fn(value);
|
|
21
|
-
}, timeout);
|
|
11
|
+
return (value: string): void => {
|
|
12
|
+
if (timer) clearTimeout(timer);
|
|
13
|
+
timer = setTimeout(() => fn(value), timeout);
|
|
22
14
|
};
|
|
23
15
|
};
|
|
24
16
|
|
|
@@ -28,44 +20,52 @@ interface SearchFilterProps {
|
|
|
28
20
|
}
|
|
29
21
|
|
|
30
22
|
const SearchFilter = ({ searchTerm, onChange }: SearchFilterProps): ReactElement => {
|
|
31
|
-
const [
|
|
23
|
+
const [localSearchTerm, setLocalSearchTerm] = useState<string>(searchTerm);
|
|
24
|
+
|
|
25
|
+
// DS-ADAPT: always call the latest onChange; the debounced fn is created once.
|
|
26
|
+
const onChangeRef = useRef(onChange);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
onChangeRef.current = onChange;
|
|
29
|
+
});
|
|
32
30
|
|
|
33
|
-
const
|
|
31
|
+
const debouncedSearch = useRef(
|
|
32
|
+
debounce(value => {
|
|
33
|
+
onChangeRef.current(value);
|
|
34
|
+
}, 300)
|
|
35
|
+
).current;
|
|
34
36
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
debouncedOnChange(newValue);
|
|
37
|
+
const handleSearchChange = (value: string): void => {
|
|
38
|
+
setLocalSearchTerm(value);
|
|
39
|
+
debouncedSearch(value);
|
|
39
40
|
};
|
|
40
41
|
|
|
41
|
-
const
|
|
42
|
-
|
|
42
|
+
const clearSearch = (): void => {
|
|
43
|
+
setLocalSearchTerm("");
|
|
43
44
|
onChange("");
|
|
44
45
|
};
|
|
45
46
|
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
setLocalSearchTerm(searchTerm);
|
|
49
|
+
}, [searchTerm]);
|
|
50
|
+
|
|
46
51
|
return (
|
|
47
52
|
<TextInput
|
|
48
53
|
size="xs"
|
|
49
54
|
placeholder={translate("table.search.placeholder")}
|
|
50
|
-
|
|
51
|
-
onChange={
|
|
55
|
+
flex="1 1 auto"
|
|
56
|
+
onChange={(event): void => handleSearchChange(event.target.value)}
|
|
52
57
|
rightSection={
|
|
53
|
-
|
|
54
|
-
<
|
|
58
|
+
localSearchTerm === "" ? (
|
|
59
|
+
<SearchIcon style={{ width: rem(14), height: rem(14) }} />
|
|
60
|
+
) : (
|
|
61
|
+
<CloseIcon
|
|
55
62
|
data-testid="search-clear"
|
|
56
|
-
onClick={
|
|
63
|
+
onClick={clearSearch}
|
|
57
64
|
style={{ width: rem(14), height: rem(14), cursor: "pointer" }}
|
|
58
65
|
/>
|
|
59
|
-
) : (
|
|
60
|
-
<IconSearch style={{ width: rem(14), height: rem(14) }} />
|
|
61
66
|
)
|
|
62
67
|
}
|
|
63
|
-
value={
|
|
64
|
-
styles={{
|
|
65
|
-
wrapper: {
|
|
66
|
-
fontSize: "var(--mantine-font-size-xs)",
|
|
67
|
-
},
|
|
68
|
-
}}
|
|
68
|
+
value={localSearchTerm}
|
|
69
69
|
/>
|
|
70
70
|
);
|
|
71
71
|
};
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
+
'use client'; // DS-ADAPT: Next.js App Router
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
// Source of truth: micro-ui-ts/src/components/Table/CustomTopToolbar/SelectFilter.tsx. Keep in sync; DS-only changes are marked DS-ADAPT.
|
|
2
4
|
import React from "react";
|
|
3
|
-
import {
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return str.replace(`{${key}}`, String(value));
|
|
10
|
-
}, key);
|
|
11
|
-
};
|
|
12
|
-
const SelectFilter = ({ label, data, selectedValue, onChange, placeholderEmpty = "All", placeholderWithSelection = "Select more" }) => {
|
|
13
|
-
const hasSelection = selectedValue && selectedValue.length > 0;
|
|
14
|
-
const placeholder = hasSelection ? placeholderWithSelection : placeholderEmpty;
|
|
15
|
-
return (_jsx(MultiSelect, { size: "xs", label: label, placeholder: placeholder, data: data, value: selectedValue || [], onChange: (value) => onChange(value.length > 0 ? value : null), clearable: true, styles: {
|
|
16
|
-
label: {
|
|
17
|
-
fontWeight: 600,
|
|
18
|
-
},
|
|
19
|
-
} }));
|
|
20
|
-
};
|
|
5
|
+
import { Select } from "@mantine/core";
|
|
6
|
+
import { translate } from "../translations/index.js"; // DS-ADAPT: translate lives in DataTable/translations
|
|
7
|
+
import styles from "./SelectFilter.module.css";
|
|
8
|
+
const SelectFilter = ({ selectedValue, data, onChange, label, }) => (_jsx("div", { role: "menuitem", children: _jsx(Select, { className: styles.field, "data-testid": "select-filter", clearable: true, size: "xs", label: label, placeholder: translate("table.filters.show.all"), data: data, onChange: (value) => {
|
|
9
|
+
onChange(value);
|
|
10
|
+
}, value: selectedValue }) }));
|
|
21
11
|
export default SelectFilter;
|
|
@@ -1,50 +1,38 @@
|
|
|
1
|
+
'use client'; // DS-ADAPT: Next.js App Router
|
|
2
|
+
// Source of truth: micro-ui-ts/src/components/Table/CustomTopToolbar/SelectFilter.tsx. Keep in sync; DS-only changes are marked DS-ADAPT.
|
|
1
3
|
import React, { ReactElement } from "react";
|
|
2
|
-
import { ComboboxData,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const translate = (key: string, params?: Record<string, any>) => {
|
|
6
|
-
if (!params) return key;
|
|
7
|
-
return Object.entries(params).reduce((str, [key, value]) => {
|
|
8
|
-
return str.replace(`{${key}}`, String(value));
|
|
9
|
-
}, key);
|
|
10
|
-
};
|
|
4
|
+
import { ComboboxData, Select } from "@mantine/core";
|
|
5
|
+
import { translate } from "../translations"; // DS-ADAPT: translate lives in DataTable/translations
|
|
6
|
+
import styles from "./SelectFilter.module.css";
|
|
11
7
|
|
|
12
8
|
export interface SelectFilterProps {
|
|
13
9
|
label: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
placeholderEmpty?: string;
|
|
18
|
-
placeholderWithSelection?: string;
|
|
10
|
+
selectedValue: string | null;
|
|
11
|
+
onChange: (value: string | null) => void;
|
|
12
|
+
data?: ComboboxData;
|
|
19
13
|
}
|
|
20
14
|
|
|
21
|
-
const SelectFilter = ({
|
|
22
|
-
|
|
23
|
-
data,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<MultiSelect
|
|
15
|
+
const SelectFilter = ({
|
|
16
|
+
selectedValue,
|
|
17
|
+
data,
|
|
18
|
+
onChange,
|
|
19
|
+
label,
|
|
20
|
+
}: SelectFilterProps): ReactElement => (
|
|
21
|
+
<div role="menuitem">
|
|
22
|
+
<Select
|
|
23
|
+
className={styles.field}
|
|
24
|
+
data-testid="select-filter"
|
|
25
|
+
clearable
|
|
34
26
|
size="xs"
|
|
35
27
|
label={label}
|
|
36
|
-
placeholder={
|
|
28
|
+
placeholder={translate("table.filters.show.all")}
|
|
37
29
|
data={data}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
clearable
|
|
41
|
-
styles={{
|
|
42
|
-
label: {
|
|
43
|
-
fontWeight: 600,
|
|
44
|
-
},
|
|
30
|
+
onChange={(value): void => {
|
|
31
|
+
onChange(value);
|
|
45
32
|
}}
|
|
33
|
+
value={selectedValue}
|
|
46
34
|
/>
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
49
37
|
|
|
50
38
|
export default SelectFilter;
|