@appdirect/design-system 0.0.17 → 0.0.19
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/DashboardWidget/DashboardWidget.js +15 -51
- package/dist/ComplexComponents/DashboardWidget/DashboardWidget.tsx +91 -139
- 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/ComplexComponents/KeyInsight/index.ts +1 -1
- package/dist/DESIGN.md +9 -10
- package/dist/contracts/DashboardWidget.json +92 -0
- package/dist/contracts/DataTable.json +83 -6
- package/dist/contracts/index.json +6 -1
- package/dist/css/foundations.css +4 -0
- package/dist/css/mantine.css +173 -7
- package/dist/css/tokens.css +3195 -0
- package/dist/index.js +3 -0
- package/dist/index.ts +14 -1
- package/dist/stories/ComplexComponents/DashboardWidget/DashboardWidget.stories.tsx +76 -1
- package/dist/stories/ComplexComponents/DataTable/DataTable.stories.tsx +216 -458
- package/dist/stories/index.json +16 -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
|
File without changes
|
|
@@ -3,7 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Card } from '../../DataDisplay/Card.js';
|
|
5
5
|
import { Alert } from '../../DataDisplay/Alert.js';
|
|
6
|
-
import { Stack, Inline, Box } from '../../Layout/index.js';
|
|
7
6
|
import { Title } from '../../Typography/Title.js';
|
|
8
7
|
import { Text } from '../../Typography/Text.js';
|
|
9
8
|
import { Switch } from '../../Inputs/Switch.js';
|
|
@@ -16,35 +15,29 @@ import { RiMore2Fill, RiArrowRightSLine, RiEditLine } from '@remixicon/react';
|
|
|
16
15
|
* DashboardWidget Component
|
|
17
16
|
*
|
|
18
17
|
* A flexible widget container for dashboard content with optional controls.
|
|
19
|
-
* Built on top of the Card component
|
|
18
|
+
* Built on top of the Card component. Layout and color come from
|
|
19
|
+
* `.ad-DashboardWidget*` classes emitted by the dashboard-widget token adapter.
|
|
20
|
+
* The card is a flex column at height 100%. Extra equal-height grid space
|
|
21
|
+
* goes to the content slot. The footer is always the last in-flow child
|
|
22
|
+
* (links, or an empty spacer) so footers share one baseline across a row.
|
|
20
23
|
*
|
|
21
24
|
* @example
|
|
22
25
|
* // Basic widget with content
|
|
23
26
|
* <DashboardWidget title="A widget title">
|
|
24
|
-
* <Text>This is a slot
|
|
25
|
-
* <ul>
|
|
26
|
-
* <li>Create a local component with autolayout on</li>
|
|
27
|
-
* <li>Switch out this slot with that component using the component instance switcher</li>
|
|
28
|
-
* </ul>
|
|
27
|
+
* <Text>This is a slot.</Text>
|
|
29
28
|
* </DashboardWidget>
|
|
30
29
|
*
|
|
31
30
|
* @example
|
|
32
31
|
* // Widget with all features
|
|
33
32
|
* <DashboardWidget
|
|
34
33
|
* title="Analytics Widget"
|
|
34
|
+
* interactive
|
|
35
|
+
* selected
|
|
35
36
|
* switch={{
|
|
36
37
|
* label: "Live updates",
|
|
37
38
|
* checked: true,
|
|
38
39
|
* onChange: (checked) => console.log(checked)
|
|
39
40
|
* }}
|
|
40
|
-
* actionsMenu={{
|
|
41
|
-
* sections: [{
|
|
42
|
-
* items: [
|
|
43
|
-
* { label: "Export", onClick: () => console.log("Export") },
|
|
44
|
-
* { label: "Settings", onClick: () => console.log("Settings") }
|
|
45
|
-
* ]
|
|
46
|
-
* }]
|
|
47
|
-
* }}
|
|
48
41
|
* headerSelect={{
|
|
49
42
|
* placeholder: "Select filter",
|
|
50
43
|
* data: ["Option 1", "Option 2", "Option 3"],
|
|
@@ -52,45 +45,16 @@ import { RiMore2Fill, RiArrowRightSLine, RiEditLine } from '@remixicon/react';
|
|
|
52
45
|
* }}
|
|
53
46
|
* footerLinks={[
|
|
54
47
|
* { label: "Link 1", onClick: () => console.log("Link 1") },
|
|
55
|
-
* { label: "Link 2", onClick: () => console.log("Link 2") }
|
|
56
|
-
* { label: "Link 3", onClick: () => console.log("Link 3") }
|
|
48
|
+
* { label: "Link 2", onClick: () => console.log("Link 2") }
|
|
57
49
|
* ]}
|
|
58
50
|
* >
|
|
59
51
|
* <YourCustomContent />
|
|
60
52
|
* </DashboardWidget>
|
|
61
53
|
*/
|
|
62
|
-
export function DashboardWidget({ title, editable = false, onEdit, panelNotification = false, panelNotificationMessage, switch: switchConfig, actionsMenu, children, headerSelect, footerLinks, cardProps = {}, spacing = '
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
opacity: link.disabled ? 0.5 : 1,
|
|
69
|
-
color: link.disabled ? 'var(--ad-color-text-dimmed)' : 'var(--ad-color-brand-primary)',
|
|
70
|
-
transition: 'color 0.2s ease',
|
|
71
|
-
}, children: [_jsx(Text, { size: "sm", c: link.disabled ? 'dimmed' : 'blue', children: link.label }), _jsx(RiArrowRightSLine, { size: 14 })] }, index))) })) : (
|
|
72
|
-
// Empty footer that maintains the same height
|
|
73
|
-
_jsx(Box, { style: { height: '21px' } })) }));
|
|
74
|
-
};
|
|
75
|
-
// ==================== MAIN RENDER ==========================
|
|
76
|
-
return (_jsxs(Card, { ...cardProps, pl: "lg", pr: "lg", pt: "sm", pb: 0, style: {
|
|
77
|
-
position: 'relative',
|
|
78
|
-
height: '100%',
|
|
79
|
-
overflow: 'hidden',
|
|
80
|
-
...cardProps.style,
|
|
81
|
-
}, children: [_jsxs(Stack, { gap: spacing, style: {
|
|
82
|
-
height: '100%',
|
|
83
|
-
paddingBottom: '60px', // Space for fixed footer
|
|
84
|
-
}, children: [renderHeader(), panelNotification && (_jsx(Alert, { color: "info", children: panelNotificationMessage })), _jsx(Box, { style: {
|
|
85
|
-
flex: 1,
|
|
86
|
-
overflowY: 'auto',
|
|
87
|
-
overflowX: 'hidden',
|
|
88
|
-
paddingRight: '4px', // Space for scrollbar
|
|
89
|
-
}, children: children })] }), _jsx("div", { style: {
|
|
90
|
-
position: 'absolute',
|
|
91
|
-
bottom: 0,
|
|
92
|
-
left: 0,
|
|
93
|
-
right: 0,
|
|
94
|
-
backgroundColor: 'var(--ad-color-bg-default)',
|
|
95
|
-
}, children: renderFooterLinks() })] }));
|
|
54
|
+
export function DashboardWidget({ title, editable = false, onEdit, panelNotification = false, panelNotificationMessage, switch: switchConfig, actionsMenu, children, headerSelect, footerLinks, cardProps = {}, spacing = 'lg', interactive = false, selected = false, }) {
|
|
55
|
+
const { className: cardClassName, style: cardStyle, ...restCardProps } = cardProps;
|
|
56
|
+
const hasFooterLinks = Boolean(footerLinks && footerLinks.length > 0);
|
|
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
|
+
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()] }));
|
|
96
60
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Card } from '../../DataDisplay/Card';
|
|
5
5
|
import { Alert } from '../../DataDisplay/Alert';
|
|
6
|
-
import { Stack, Inline, Box } from '../../Layout';
|
|
7
6
|
import { Title } from '../../Typography/Title';
|
|
8
7
|
import { Text } from '../../Typography/Text';
|
|
9
8
|
import { Switch } from '../../Inputs/Switch';
|
|
@@ -45,7 +44,7 @@ export interface DashboardWidgetProps {
|
|
|
45
44
|
onChange: (checked: boolean) => void;
|
|
46
45
|
disabled?: boolean;
|
|
47
46
|
};
|
|
48
|
-
|
|
47
|
+
|
|
49
48
|
/** Optional actions menu */
|
|
50
49
|
actionsMenu?: {
|
|
51
50
|
sections: Array<{
|
|
@@ -57,11 +56,11 @@ export interface DashboardWidgetProps {
|
|
|
57
56
|
}>;
|
|
58
57
|
}>;
|
|
59
58
|
};
|
|
60
|
-
|
|
59
|
+
|
|
61
60
|
// ==================== CONTENT AREA ====================
|
|
62
61
|
/** Main content area - can be any React node */
|
|
63
62
|
children: React.ReactNode;
|
|
64
|
-
|
|
63
|
+
|
|
65
64
|
// ==================== OPTIONAL CONTROLS ====================
|
|
66
65
|
/** Optional select dropdown in the header (top-right) */
|
|
67
66
|
headerSelect?: {
|
|
@@ -77,52 +76,50 @@ export interface DashboardWidgetProps {
|
|
|
77
76
|
/** Whether the select is clearable */
|
|
78
77
|
clearable?: boolean;
|
|
79
78
|
};
|
|
80
|
-
|
|
81
|
-
/** Optional footer links */
|
|
79
|
+
|
|
80
|
+
/** Optional footer links. The footer is always reserved; an empty spacer is rendered when this is omitted. */
|
|
82
81
|
footerLinks?: DashboardWidgetLink[];
|
|
83
|
-
|
|
82
|
+
|
|
84
83
|
// ==================== STYLING ====================
|
|
85
84
|
/** Additional card props */
|
|
86
85
|
cardProps?: Record<string, any>;
|
|
87
|
-
/**
|
|
86
|
+
/** Gap between header, notification, and content. Default follows the sections.gap token (spacing.lg). */
|
|
88
87
|
spacing?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
88
|
+
/** Hover shadow and pointer cursor. Sets data-interactive. */
|
|
89
|
+
interactive?: boolean;
|
|
90
|
+
/** Brand-tinted selected surface. Sets data-selected. */
|
|
91
|
+
selected?: boolean;
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
// ========================== COMPONENT ==========================
|
|
92
95
|
|
|
93
96
|
/**
|
|
94
97
|
* DashboardWidget Component
|
|
95
|
-
*
|
|
98
|
+
*
|
|
96
99
|
* A flexible widget container for dashboard content with optional controls.
|
|
97
|
-
* Built on top of the Card component
|
|
98
|
-
*
|
|
100
|
+
* Built on top of the Card component. Layout and color come from
|
|
101
|
+
* `.ad-DashboardWidget*` classes emitted by the dashboard-widget token adapter.
|
|
102
|
+
* The card is a flex column at height 100%. Extra equal-height grid space
|
|
103
|
+
* goes to the content slot. The footer is always the last in-flow child
|
|
104
|
+
* (links, or an empty spacer) so footers share one baseline across a row.
|
|
105
|
+
*
|
|
99
106
|
* @example
|
|
100
107
|
* // Basic widget with content
|
|
101
108
|
* <DashboardWidget title="A widget title">
|
|
102
|
-
* <Text>This is a slot
|
|
103
|
-
* <ul>
|
|
104
|
-
* <li>Create a local component with autolayout on</li>
|
|
105
|
-
* <li>Switch out this slot with that component using the component instance switcher</li>
|
|
106
|
-
* </ul>
|
|
109
|
+
* <Text>This is a slot.</Text>
|
|
107
110
|
* </DashboardWidget>
|
|
108
|
-
*
|
|
111
|
+
*
|
|
109
112
|
* @example
|
|
110
113
|
* // Widget with all features
|
|
111
114
|
* <DashboardWidget
|
|
112
115
|
* title="Analytics Widget"
|
|
116
|
+
* interactive
|
|
117
|
+
* selected
|
|
113
118
|
* switch={{
|
|
114
119
|
* label: "Live updates",
|
|
115
120
|
* checked: true,
|
|
116
121
|
* onChange: (checked) => console.log(checked)
|
|
117
122
|
* }}
|
|
118
|
-
* actionsMenu={{
|
|
119
|
-
* sections: [{
|
|
120
|
-
* items: [
|
|
121
|
-
* { label: "Export", onClick: () => console.log("Export") },
|
|
122
|
-
* { label: "Settings", onClick: () => console.log("Settings") }
|
|
123
|
-
* ]
|
|
124
|
-
* }]
|
|
125
|
-
* }}
|
|
126
123
|
* headerSelect={{
|
|
127
124
|
* placeholder: "Select filter",
|
|
128
125
|
* data: ["Option 1", "Option 2", "Option 3"],
|
|
@@ -130,8 +127,7 @@ export interface DashboardWidgetProps {
|
|
|
130
127
|
* }}
|
|
131
128
|
* footerLinks={[
|
|
132
129
|
* { label: "Link 1", onClick: () => console.log("Link 1") },
|
|
133
|
-
* { label: "Link 2", onClick: () => console.log("Link 2") }
|
|
134
|
-
* { label: "Link 3", onClick: () => console.log("Link 3") }
|
|
130
|
+
* { label: "Link 2", onClick: () => console.log("Link 2") }
|
|
135
131
|
* ]}
|
|
136
132
|
* >
|
|
137
133
|
* <YourCustomContent />
|
|
@@ -149,46 +145,42 @@ export function DashboardWidget({
|
|
|
149
145
|
headerSelect,
|
|
150
146
|
footerLinks,
|
|
151
147
|
cardProps = {},
|
|
152
|
-
spacing = '
|
|
148
|
+
spacing = 'lg',
|
|
149
|
+
interactive = false,
|
|
150
|
+
selected = false,
|
|
153
151
|
}: DashboardWidgetProps) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
const { className: cardClassName, style: cardStyle, ...restCardProps } = cardProps;
|
|
153
|
+
const hasFooterLinks = Boolean(footerLinks && footerLinks.length > 0);
|
|
154
|
+
|
|
157
155
|
const renderHeader = () => (
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
</Inline>
|
|
175
|
-
</Stack>
|
|
176
|
-
{/* Header controls */}
|
|
177
|
-
<Inline gap="sm" align="center">
|
|
178
|
-
{/* Switch */}
|
|
156
|
+
<div className="ad-DashboardWidget-header">
|
|
157
|
+
<div className="ad-DashboardWidget-titleGroup">
|
|
158
|
+
<Title order={4} className="ad-DashboardWidget-title">
|
|
159
|
+
{title}
|
|
160
|
+
</Title>
|
|
161
|
+
{editable && (
|
|
162
|
+
<ActionIcon
|
|
163
|
+
size="sm"
|
|
164
|
+
onClick={onEdit}
|
|
165
|
+
aria-label="Edit title"
|
|
166
|
+
>
|
|
167
|
+
<RiEditLine size={16} />
|
|
168
|
+
</ActionIcon>
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
171
|
+
<div className="ad-DashboardWidget-controls">
|
|
179
172
|
{switchConfig && (
|
|
180
|
-
<
|
|
181
|
-
<Text size="sm">{switchConfig.label}</Text>
|
|
173
|
+
<div className="ad-DashboardWidget-switch">
|
|
174
|
+
{switchConfig.label ? <Text size="sm">{switchConfig.label}</Text> : null}
|
|
182
175
|
<Switch
|
|
183
176
|
checked={switchConfig.checked}
|
|
184
177
|
onChange={(event) => switchConfig.onChange(event.currentTarget.checked)}
|
|
185
178
|
disabled={switchConfig.disabled}
|
|
186
179
|
size="sm"
|
|
187
180
|
/>
|
|
188
|
-
</
|
|
181
|
+
</div>
|
|
189
182
|
)}
|
|
190
|
-
|
|
191
|
-
{/* Header select (borderless select in top-right) */}
|
|
183
|
+
|
|
192
184
|
{headerSelect && (
|
|
193
185
|
<Select
|
|
194
186
|
data={headerSelect.data}
|
|
@@ -202,8 +194,7 @@ export function DashboardWidget({
|
|
|
202
194
|
size="sm"
|
|
203
195
|
/>
|
|
204
196
|
)}
|
|
205
|
-
|
|
206
|
-
{/* Actions menu - only show if no header select */}
|
|
197
|
+
|
|
207
198
|
{actionsMenu && !headerSelect && (
|
|
208
199
|
<Menu
|
|
209
200
|
trigger={
|
|
@@ -215,99 +206,60 @@ export function DashboardWidget({
|
|
|
215
206
|
sections={actionsMenu.sections}
|
|
216
207
|
/>
|
|
217
208
|
)}
|
|
218
|
-
</
|
|
219
|
-
</
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
220
211
|
);
|
|
221
|
-
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
</Inline>
|
|
247
|
-
))}
|
|
248
|
-
</Inline>
|
|
249
|
-
) : (
|
|
250
|
-
// Empty footer that maintains the same height
|
|
251
|
-
<Box style={{ height: '21px' }} />
|
|
252
|
-
)}
|
|
253
|
-
</Box>
|
|
254
|
-
);
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
// ==================== MAIN RENDER ==========================
|
|
258
|
-
|
|
212
|
+
|
|
213
|
+
const renderFooter = () => (
|
|
214
|
+
<div className="ad-DashboardWidget-footer">
|
|
215
|
+
{hasFooterLinks ? (
|
|
216
|
+
<div className="ad-DashboardWidget-footerLinks">
|
|
217
|
+
{footerLinks!.map((link, index) => (
|
|
218
|
+
<button
|
|
219
|
+
key={index}
|
|
220
|
+
type="button"
|
|
221
|
+
className="ad-DashboardWidget-footerLink"
|
|
222
|
+
data-disabled={link.disabled ? '' : undefined}
|
|
223
|
+
disabled={link.disabled}
|
|
224
|
+
onClick={link.disabled ? undefined : link.onClick}
|
|
225
|
+
>
|
|
226
|
+
<Text span size="sm">{link.label}</Text>
|
|
227
|
+
<RiArrowRightSLine size={14} />
|
|
228
|
+
</button>
|
|
229
|
+
))}
|
|
230
|
+
</div>
|
|
231
|
+
) : (
|
|
232
|
+
<div className="ad-DashboardWidget-footerSpacer" />
|
|
233
|
+
)}
|
|
234
|
+
</div>
|
|
235
|
+
);
|
|
236
|
+
|
|
259
237
|
return (
|
|
260
|
-
<Card
|
|
261
|
-
{...
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
style={{
|
|
267
|
-
position: 'relative',
|
|
268
|
-
height: '100%',
|
|
269
|
-
overflow: 'hidden',
|
|
270
|
-
...cardProps.style,
|
|
271
|
-
}}
|
|
238
|
+
<Card
|
|
239
|
+
{...restCardProps}
|
|
240
|
+
style={cardStyle}
|
|
241
|
+
className={['ad-DashboardWidget', cardClassName].filter(Boolean).join(' ')}
|
|
242
|
+
data-interactive={interactive ? '' : undefined}
|
|
243
|
+
data-selected={selected ? '' : undefined}
|
|
272
244
|
>
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
style={{
|
|
277
|
-
height: '100%',
|
|
278
|
-
paddingBottom: '60px', // Space for fixed footer
|
|
279
|
-
}}
|
|
245
|
+
<div
|
|
246
|
+
className="ad-DashboardWidget-body"
|
|
247
|
+
data-spacing={spacing === 'lg' ? undefined : spacing}
|
|
280
248
|
>
|
|
281
249
|
{renderHeader()}
|
|
282
250
|
|
|
283
|
-
{/* Panel notification */}
|
|
284
251
|
{panelNotification && (
|
|
285
252
|
<Alert color="info">
|
|
286
253
|
{panelNotificationMessage}
|
|
287
254
|
</Alert>
|
|
288
255
|
)}
|
|
289
256
|
|
|
290
|
-
|
|
291
|
-
<Box style={{
|
|
292
|
-
flex: 1,
|
|
293
|
-
overflowY: 'auto',
|
|
294
|
-
overflowX: 'hidden',
|
|
295
|
-
paddingRight: '4px', // Space for scrollbar
|
|
296
|
-
}}>
|
|
257
|
+
<div className="ad-DashboardWidget-content">
|
|
297
258
|
{children}
|
|
298
|
-
</
|
|
299
|
-
</Stack>
|
|
300
|
-
|
|
301
|
-
{/* Footer area - fixed at bottom */}
|
|
302
|
-
<div style={{
|
|
303
|
-
position: 'absolute',
|
|
304
|
-
bottom: 0,
|
|
305
|
-
left: 0,
|
|
306
|
-
right: 0,
|
|
307
|
-
backgroundColor: 'var(--ad-color-bg-default)',
|
|
308
|
-
}}>
|
|
309
|
-
{renderFooterLinks()}
|
|
259
|
+
</div>
|
|
310
260
|
</div>
|
|
261
|
+
|
|
262
|
+
{renderFooter()}
|
|
311
263
|
</Card>
|
|
312
264
|
);
|
|
313
|
-
}
|
|
265
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.cellHoverReveal {
|
|
2
|
+
white-space: nowrap;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
text-overflow: ellipsis;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.overflowing:hover,
|
|
8
|
+
.overflowing:focus-visible {
|
|
9
|
+
overflow: visible;
|
|
10
|
+
white-space: normal;
|
|
11
|
+
position: absolute;
|
|
12
|
+
z-index: var(--ad-table-cell-reveal-z-index);
|
|
13
|
+
padding: var(--table-vertical-spacing) var(--table-horizontal-spacing);
|
|
14
|
+
background-color: var(--ad-table-cell-reveal-bg);
|
|
15
|
+
box-shadow: var(--ad-table-cell-reveal-shadow);
|
|
16
|
+
border: var(--ad-table-cell-reveal-border-width) solid var(--ad-table-cell-reveal-border-color);
|
|
17
|
+
text-indent: -1px;
|
|
18
|
+
width: max-content;
|
|
19
|
+
top: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
height: 100%;
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
align-items: center;
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client'; // DS-ADAPT: Next.js App Router
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
// Source of truth: micro-ui-ts/src/components/Table/CellHoverReveal/index.tsx. Keep in sync; DS-only changes are marked DS-ADAPT.
|
|
4
|
+
import React, { useRef, useState } from "react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import styles from "./CellHoverReveal.module.css";
|
|
7
|
+
const CellHoverReveal = ({ children }) => {
|
|
8
|
+
const divRef = useRef(null);
|
|
9
|
+
const [isOverflowing, setIsOverflowing] = useState(false);
|
|
10
|
+
const onMouseEnter = () => {
|
|
11
|
+
const div = divRef.current;
|
|
12
|
+
if (div) {
|
|
13
|
+
setIsOverflowing(div.scrollWidth > div.clientWidth);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const onMouseLeave = () => {
|
|
17
|
+
setIsOverflowing(false);
|
|
18
|
+
};
|
|
19
|
+
return (
|
|
20
|
+
// Measures whether the cell text overflows. Not an action control.
|
|
21
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
22
|
+
_jsx("div", { ref: divRef, "data-cell-hover-reveal": true, className: clsx(styles.cellHoverReveal, isOverflowing && styles.overflowing), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, tabIndex: 0, onFocus: onMouseEnter, onBlur: onMouseLeave, children: children }));
|
|
23
|
+
};
|
|
24
|
+
export default CellHoverReveal;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client'; // DS-ADAPT: Next.js App Router
|
|
2
|
+
// Source of truth: micro-ui-ts/src/components/Table/CellHoverReveal/index.tsx. Keep in sync; DS-only changes are marked DS-ADAPT.
|
|
3
|
+
import React, { useRef, useState, type ReactElement, type ReactNode } from "react";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import styles from "./CellHoverReveal.module.css";
|
|
6
|
+
|
|
7
|
+
interface CellHoverRevealProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const CellHoverReveal = ({ children }: CellHoverRevealProps): ReactElement => {
|
|
12
|
+
const divRef = useRef<HTMLDivElement>(null);
|
|
13
|
+
const [isOverflowing, setIsOverflowing] = useState(false);
|
|
14
|
+
|
|
15
|
+
const onMouseEnter = (): void => {
|
|
16
|
+
const div = divRef.current;
|
|
17
|
+
if (div) {
|
|
18
|
+
setIsOverflowing(div.scrollWidth > div.clientWidth);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const onMouseLeave = (): void => {
|
|
23
|
+
setIsOverflowing(false);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
// Measures whether the cell text overflows. Not an action control.
|
|
28
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
29
|
+
<div
|
|
30
|
+
ref={divRef}
|
|
31
|
+
data-cell-hover-reveal
|
|
32
|
+
className={clsx(styles.cellHoverReveal, isOverflowing && styles.overflowing)}
|
|
33
|
+
onMouseEnter={onMouseEnter}
|
|
34
|
+
onMouseLeave={onMouseLeave}
|
|
35
|
+
tabIndex={0}
|
|
36
|
+
onFocus={onMouseEnter}
|
|
37
|
+
onBlur={onMouseLeave}
|
|
38
|
+
>
|
|
39
|
+
{children}
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default CellHoverReveal;
|