@appdirect/design-system 0.0.18 → 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/dist/ComplexComponents/DashboardWidget/DashboardWidget.js +15 -51
- package/dist/ComplexComponents/DashboardWidget/DashboardWidget.tsx +91 -139
- package/dist/ComplexComponents/KeyInsight/index.ts +1 -1
- package/dist/contracts/DashboardWidget.json +92 -0
- package/dist/contracts/index.json +6 -1
- package/dist/css/mantine.css +172 -6
- package/dist/css/tokens.css +54 -4
- package/dist/stories/ComplexComponents/DashboardWidget/DashboardWidget.stories.tsx +76 -1
- package/dist/stories/index.json +4 -1
- package/package.json +2 -2
|
@@ -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,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../contracts/ds-component-contract.v1.json",
|
|
3
|
+
"id": "DashboardWidget",
|
|
4
|
+
"kind": "complex",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"purpose": "Dashboard card with a title row, optional header controls, a flexible content slot, and a footer that stays in flow so equal-height rows align.",
|
|
7
|
+
"importFrom": [
|
|
8
|
+
"@appdirect/design-system"
|
|
9
|
+
],
|
|
10
|
+
"mantineCounterpart": null,
|
|
11
|
+
"anatomy": [
|
|
12
|
+
"card",
|
|
13
|
+
"header",
|
|
14
|
+
"title",
|
|
15
|
+
"content",
|
|
16
|
+
"footer"
|
|
17
|
+
],
|
|
18
|
+
"api": {
|
|
19
|
+
"props": {
|
|
20
|
+
"title": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"required": true
|
|
23
|
+
},
|
|
24
|
+
"children": {
|
|
25
|
+
"type": "ReactNode",
|
|
26
|
+
"required": true
|
|
27
|
+
},
|
|
28
|
+
"editable": {
|
|
29
|
+
"type": "boolean"
|
|
30
|
+
},
|
|
31
|
+
"panelNotification": {
|
|
32
|
+
"type": "boolean"
|
|
33
|
+
},
|
|
34
|
+
"headerSelect": {
|
|
35
|
+
"type": "object"
|
|
36
|
+
},
|
|
37
|
+
"footerLinks": {
|
|
38
|
+
"type": "array"
|
|
39
|
+
},
|
|
40
|
+
"spacing": {
|
|
41
|
+
"enum": [
|
|
42
|
+
"xs",
|
|
43
|
+
"sm",
|
|
44
|
+
"md",
|
|
45
|
+
"lg",
|
|
46
|
+
"xl"
|
|
47
|
+
],
|
|
48
|
+
"default": "lg"
|
|
49
|
+
},
|
|
50
|
+
"interactive": {
|
|
51
|
+
"type": "boolean",
|
|
52
|
+
"default": false
|
|
53
|
+
},
|
|
54
|
+
"selected": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"default": false
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"composition": {
|
|
61
|
+
"mustUseFor": [
|
|
62
|
+
"dashboard metric and summary cards"
|
|
63
|
+
],
|
|
64
|
+
"mustNotRebuildFrom": [
|
|
65
|
+
"Card + Title + Select"
|
|
66
|
+
],
|
|
67
|
+
"internalPrimitives": [
|
|
68
|
+
"Card",
|
|
69
|
+
"Title",
|
|
70
|
+
"Text",
|
|
71
|
+
"Switch",
|
|
72
|
+
"Select",
|
|
73
|
+
"Menu",
|
|
74
|
+
"ActionIcon",
|
|
75
|
+
"Alert"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"enforcement": {
|
|
79
|
+
"deterministic": [
|
|
80
|
+
"importFrom",
|
|
81
|
+
"kind",
|
|
82
|
+
"mantineCounterpart",
|
|
83
|
+
"api.props.title.required",
|
|
84
|
+
"api.props.children.required"
|
|
85
|
+
],
|
|
86
|
+
"semantic": [
|
|
87
|
+
"purpose",
|
|
88
|
+
"composition.mustUseFor",
|
|
89
|
+
"composition.mustNotRebuildFrom"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.19",
|
|
3
3
|
"contracts": [
|
|
4
4
|
{
|
|
5
5
|
"id": "Alert",
|
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
"kind": "wrapper",
|
|
22
22
|
"source": "Buttons/Button.contract.json"
|
|
23
23
|
},
|
|
24
|
+
{
|
|
25
|
+
"id": "DashboardWidget",
|
|
26
|
+
"kind": "complex",
|
|
27
|
+
"source": "ComplexComponents/DashboardWidget/DashboardWidget.contract.json"
|
|
28
|
+
},
|
|
24
29
|
{
|
|
25
30
|
"id": "DataTable",
|
|
26
31
|
"kind": "complex",
|
package/dist/css/mantine.css
CHANGED
|
@@ -611,13 +611,19 @@
|
|
|
611
611
|
color: var(--ad-color-state-disabled-text);
|
|
612
612
|
}
|
|
613
613
|
.mantine-Checkbox-icon {
|
|
614
|
-
color: var(--ad-
|
|
614
|
+
color: var(--ad-white);
|
|
615
615
|
}
|
|
616
616
|
.mantine-Checkbox-label {
|
|
617
617
|
font-size: var(--ad-font-sizes-sm);
|
|
618
618
|
font-weight: var(--ad-font-weights-regular);
|
|
619
619
|
color: var(--ad-color-text-default);
|
|
620
620
|
}
|
|
621
|
+
.mantine-Checkbox-root[data-label-position="right"] .mantine-Checkbox-label {
|
|
622
|
+
padding-inline-start: var(--ad-spacing-sm);
|
|
623
|
+
}
|
|
624
|
+
.mantine-Checkbox-root[data-label-position="left"] .mantine-Checkbox-label {
|
|
625
|
+
padding-inline-end: var(--ad-spacing-sm);
|
|
626
|
+
}
|
|
621
627
|
/* === Chip === */
|
|
622
628
|
.mantine-Chip-label[data-variant="outline"]:not([data-checked]):not([data-disabled]) {
|
|
623
629
|
background: var(--ad-color-bg-default);
|
|
@@ -854,6 +860,128 @@
|
|
|
854
860
|
.mantine-Container-root[data-size="xl"] {
|
|
855
861
|
--container-size: 1320px;
|
|
856
862
|
}
|
|
863
|
+
/* === DashboardWidget === */
|
|
864
|
+
.ad-DashboardWidget.mantine-Card-root {
|
|
865
|
+
display: flex;
|
|
866
|
+
flex-direction: column;
|
|
867
|
+
height: 100%;
|
|
868
|
+
min-height: 0;
|
|
869
|
+
box-sizing: border-box;
|
|
870
|
+
padding: var(--ad-spacing-sm) var(--ad-spacing-lg) var(--ad-spacing-none);
|
|
871
|
+
}
|
|
872
|
+
.ad-DashboardWidget[data-interactive] {
|
|
873
|
+
cursor: var(--ad-cursor-pointer);
|
|
874
|
+
}
|
|
875
|
+
.ad-DashboardWidget.mantine-Paper-root[data-interactive]:hover {
|
|
876
|
+
box-shadow: var(--ad-shadows-md);
|
|
877
|
+
}
|
|
878
|
+
.ad-DashboardWidget.mantine-Card-root.mantine-Paper-root[data-with-border][data-selected] {
|
|
879
|
+
background: var(--ad-color-brand-light);
|
|
880
|
+
border-color: var(--ad-color-border-primary);
|
|
881
|
+
}
|
|
882
|
+
.ad-DashboardWidget-body {
|
|
883
|
+
display: flex;
|
|
884
|
+
flex-direction: column;
|
|
885
|
+
flex: 1 1 auto;
|
|
886
|
+
min-height: 0;
|
|
887
|
+
gap: var(--ad-spacing-lg);
|
|
888
|
+
}
|
|
889
|
+
.ad-DashboardWidget-body[data-spacing="xs"] {
|
|
890
|
+
gap: var(--ad-spacing-xs);
|
|
891
|
+
}
|
|
892
|
+
.ad-DashboardWidget-body[data-spacing="sm"] {
|
|
893
|
+
gap: var(--ad-spacing-sm);
|
|
894
|
+
}
|
|
895
|
+
.ad-DashboardWidget-body[data-spacing="md"] {
|
|
896
|
+
gap: var(--ad-spacing-md);
|
|
897
|
+
}
|
|
898
|
+
.ad-DashboardWidget-body[data-spacing="lg"] {
|
|
899
|
+
gap: var(--ad-spacing-lg);
|
|
900
|
+
}
|
|
901
|
+
.ad-DashboardWidget-body[data-spacing="xl"] {
|
|
902
|
+
gap: var(--ad-spacing-xl);
|
|
903
|
+
}
|
|
904
|
+
.ad-DashboardWidget-header {
|
|
905
|
+
display: flex;
|
|
906
|
+
flex-shrink: 0;
|
|
907
|
+
align-items: center;
|
|
908
|
+
justify-content: space-between;
|
|
909
|
+
}
|
|
910
|
+
.ad-DashboardWidget-titleGroup {
|
|
911
|
+
display: flex;
|
|
912
|
+
align-items: center;
|
|
913
|
+
gap: var(--ad-spacing-xs);
|
|
914
|
+
min-width: 0;
|
|
915
|
+
}
|
|
916
|
+
.ad-DashboardWidget .ad-DashboardWidget-title.mantine-Title-root {
|
|
917
|
+
font-size: var(--ad-headings-sizes-h4-font-size);
|
|
918
|
+
font-weight: var(--ad-headings-font-weight);
|
|
919
|
+
}
|
|
920
|
+
.ad-DashboardWidget-controls {
|
|
921
|
+
display: flex;
|
|
922
|
+
align-items: center;
|
|
923
|
+
flex-shrink: 0;
|
|
924
|
+
gap: var(--ad-spacing-sm);
|
|
925
|
+
}
|
|
926
|
+
.ad-DashboardWidget-switch {
|
|
927
|
+
display: flex;
|
|
928
|
+
align-items: center;
|
|
929
|
+
gap: var(--ad-spacing-xs);
|
|
930
|
+
}
|
|
931
|
+
.ad-DashboardWidget-content {
|
|
932
|
+
display: flex;
|
|
933
|
+
flex-direction: column;
|
|
934
|
+
flex: 1 1 auto;
|
|
935
|
+
min-height: 0;
|
|
936
|
+
overflow-x: hidden;
|
|
937
|
+
overflow-y: auto;
|
|
938
|
+
justify-content: safe center;
|
|
939
|
+
align-items: stretch;
|
|
940
|
+
padding-block: var(--ad-spacing-none);
|
|
941
|
+
padding-inline-end: 4px;
|
|
942
|
+
}
|
|
943
|
+
.ad-DashboardWidget-footer {
|
|
944
|
+
display: flex;
|
|
945
|
+
flex-shrink: 0;
|
|
946
|
+
align-items: center;
|
|
947
|
+
box-sizing: border-box;
|
|
948
|
+
margin-inline: calc(var(--ad-spacing-lg) * -1);
|
|
949
|
+
background: var(--ad-color-bg-default);
|
|
950
|
+
padding-inline: var(--ad-spacing-lg);
|
|
951
|
+
padding-block: var(--ad-spacing-sm);
|
|
952
|
+
gap: var(--ad-spacing-xs);
|
|
953
|
+
}
|
|
954
|
+
.ad-DashboardWidget[data-selected] .ad-DashboardWidget-footer {
|
|
955
|
+
background: var(--ad-color-brand-light);
|
|
956
|
+
}
|
|
957
|
+
.ad-DashboardWidget-footerLinks {
|
|
958
|
+
display: flex;
|
|
959
|
+
align-items: center;
|
|
960
|
+
gap: var(--ad-spacing-xs);
|
|
961
|
+
}
|
|
962
|
+
.ad-DashboardWidget-footerLink {
|
|
963
|
+
display: inline-flex;
|
|
964
|
+
align-items: center;
|
|
965
|
+
gap: var(--ad-spacing-xs);
|
|
966
|
+
font: inherit;
|
|
967
|
+
color: var(--ad-color-text-link);
|
|
968
|
+
background: var(--ad-color-transparent);
|
|
969
|
+
padding: var(--ad-spacing-none);
|
|
970
|
+
border-width: var(--ad-border-width-none);
|
|
971
|
+
border-style: var(--ad-border-style-none);
|
|
972
|
+
cursor: var(--ad-cursor-pointer);
|
|
973
|
+
}
|
|
974
|
+
.ad-DashboardWidget-footerLink .mantine-Text-root {
|
|
975
|
+
color: inherit;
|
|
976
|
+
}
|
|
977
|
+
.ad-DashboardWidget-footerLink[data-disabled] {
|
|
978
|
+
color: var(--ad-color-state-disabled-text);
|
|
979
|
+
opacity: 1;
|
|
980
|
+
cursor: var(--ad-cursor-not-allowed);
|
|
981
|
+
}
|
|
982
|
+
.ad-DashboardWidget-footerSpacer {
|
|
983
|
+
height: 21px;
|
|
984
|
+
}
|
|
857
985
|
/* === Divider === */
|
|
858
986
|
.mantine-Divider-root {
|
|
859
987
|
--divider-color: var(--ad-color-border-default);
|
|
@@ -1611,13 +1739,19 @@
|
|
|
1611
1739
|
color: var(--ad-color-state-disabled-text);
|
|
1612
1740
|
}
|
|
1613
1741
|
.mantine-Radio-icon {
|
|
1614
|
-
color: var(--ad-
|
|
1742
|
+
color: var(--ad-white);
|
|
1615
1743
|
}
|
|
1616
1744
|
.mantine-Radio-label {
|
|
1617
1745
|
font-size: var(--ad-font-sizes-sm);
|
|
1618
1746
|
font-weight: var(--ad-font-weights-regular);
|
|
1619
1747
|
color: var(--ad-color-text-default);
|
|
1620
1748
|
}
|
|
1749
|
+
.mantine-Radio-root[data-label-position="right"] .mantine-Radio-label {
|
|
1750
|
+
padding-inline-start: var(--ad-spacing-sm);
|
|
1751
|
+
}
|
|
1752
|
+
.mantine-Radio-root[data-label-position="left"] .mantine-Radio-label {
|
|
1753
|
+
padding-inline-end: var(--ad-spacing-sm);
|
|
1754
|
+
}
|
|
1621
1755
|
/* === SegmentedControl === */
|
|
1622
1756
|
.mantine-SegmentedControl-root {
|
|
1623
1757
|
background: var(--ad-color-bg-tinted);
|
|
@@ -1670,7 +1804,33 @@ fieldset:disabled .mantine-SegmentedControl-label,
|
|
|
1670
1804
|
padding-block: 10px;
|
|
1671
1805
|
font-size: var(--ad-font-sizes-md);
|
|
1672
1806
|
}
|
|
1673
|
-
/* === Select ===
|
|
1807
|
+
/* === Select === */
|
|
1808
|
+
.mantine-Select-input[data-variant="unstyled"] {
|
|
1809
|
+
background: var(--ad-color-transparent);
|
|
1810
|
+
border-width: var(--ad-border-width-none);
|
|
1811
|
+
border-style: var(--ad-border-style-none);
|
|
1812
|
+
border-color: var(--ad-color-transparent);
|
|
1813
|
+
padding-inline-start: var(--ad-spacing-none);
|
|
1814
|
+
padding-block: var(--ad-spacing-none);
|
|
1815
|
+
}
|
|
1816
|
+
.mantine-Select-input[data-variant="unstyled"]:not([data-error]):not([data-disabled]),
|
|
1817
|
+
.mantine-Select-input[data-variant="unstyled"]:not([data-error]):not([data-disabled]):hover {
|
|
1818
|
+
border-color: var(--ad-color-transparent);
|
|
1819
|
+
background: var(--ad-color-transparent);
|
|
1820
|
+
}
|
|
1821
|
+
.mantine-Select-input[data-variant="unstyled"]:focus,
|
|
1822
|
+
.mantine-Select-input[data-variant="unstyled"]:focus-visible {
|
|
1823
|
+
border-color: var(--ad-color-transparent);
|
|
1824
|
+
outline-color: var(--ad-color-transparent);
|
|
1825
|
+
outline-width: var(--ad-border-width-none);
|
|
1826
|
+
outline-style: var(--ad-border-style-none);
|
|
1827
|
+
background: var(--ad-color-transparent);
|
|
1828
|
+
}
|
|
1829
|
+
.mantine-Select-input[data-variant="unstyled"][data-disabled],
|
|
1830
|
+
.mantine-Select-input[data-variant="unstyled"]:disabled {
|
|
1831
|
+
border-color: var(--ad-color-transparent);
|
|
1832
|
+
background: var(--ad-color-transparent);
|
|
1833
|
+
}
|
|
1674
1834
|
/* === Slider === */
|
|
1675
1835
|
.mantine-Slider-root {
|
|
1676
1836
|
--slider-color: var(--ad-color-brand-primary);
|
|
@@ -1780,7 +1940,7 @@ fieldset:disabled .mantine-Slider-mark[data-filled] {
|
|
|
1780
1940
|
}
|
|
1781
1941
|
.mantine-Switch-input:checked + .mantine-Switch-track {
|
|
1782
1942
|
background: var(--ad-color-status-success);
|
|
1783
|
-
color: var(--ad-
|
|
1943
|
+
color: var(--ad-white);
|
|
1784
1944
|
}
|
|
1785
1945
|
.mantine-Switch-input:focus-visible + .mantine-Switch-track {
|
|
1786
1946
|
outline-color: var(--ad-action-primary-focus-ring);
|
|
@@ -1794,7 +1954,7 @@ fieldset:disabled .mantine-Slider-mark[data-filled] {
|
|
|
1794
1954
|
cursor: var(--ad-cursor-not-allowed);
|
|
1795
1955
|
}
|
|
1796
1956
|
.mantine-Switch-thumb {
|
|
1797
|
-
background: var(--ad-
|
|
1957
|
+
background: var(--ad-white);
|
|
1798
1958
|
}
|
|
1799
1959
|
.mantine-Switch-input:disabled + * > .mantine-Switch-thumb,
|
|
1800
1960
|
.mantine-Switch-input[data-disabled] + * > .mantine-Switch-thumb {
|
|
@@ -1802,9 +1962,15 @@ fieldset:disabled .mantine-Slider-mark[data-filled] {
|
|
|
1802
1962
|
}
|
|
1803
1963
|
.mantine-Switch-label {
|
|
1804
1964
|
font-size: var(--ad-font-sizes-sm);
|
|
1805
|
-
font-weight: var(--ad-font-weights-
|
|
1965
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1806
1966
|
color: var(--ad-color-text-default);
|
|
1807
1967
|
}
|
|
1968
|
+
.mantine-Switch-root[data-label-position="right"] .mantine-Switch-label {
|
|
1969
|
+
padding-inline-start: var(--ad-spacing-sm);
|
|
1970
|
+
}
|
|
1971
|
+
.mantine-Switch-root[data-label-position="left"] .mantine-Switch-label {
|
|
1972
|
+
padding-inline-end: var(--ad-spacing-sm);
|
|
1973
|
+
}
|
|
1808
1974
|
/* === Table === */
|
|
1809
1975
|
.mantine-Table-table {
|
|
1810
1976
|
background: var(--ad-color-bg-default);
|
package/dist/css/tokens.css
CHANGED
|
@@ -722,11 +722,19 @@
|
|
|
722
722
|
--ad-dashboard-widget-root-padding-x: 20px;
|
|
723
723
|
--ad-dashboard-widget-root-padding-top: 12px;
|
|
724
724
|
--ad-dashboard-widget-root-padding-bottom: 0px;
|
|
725
|
-
--ad-dashboard-widget-
|
|
725
|
+
--ad-dashboard-widget-root-interactive-cursor: pointer;
|
|
726
|
+
--ad-dashboard-widget-root-interactive-hover-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.05), 0px 20px 25px -5px rgba(0, 0, 0, 0.05), 0px 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
727
|
+
--ad-dashboard-widget-root-interactive-selected-bg: color-mix(in srgb, #326FDE 10%, transparent);
|
|
728
|
+
--ad-dashboard-widget-root-interactive-selected-border: #326FDE;
|
|
729
|
+
--ad-dashboard-widget-sections-gap: 20px;
|
|
726
730
|
--ad-dashboard-widget-header-title-gap: 10px;
|
|
727
731
|
--ad-dashboard-widget-header-controls-gap: 12px;
|
|
728
732
|
--ad-dashboard-widget-header-switch-label-gap: 10px;
|
|
733
|
+
--ad-dashboard-widget-header-title-font-size: 18px;
|
|
734
|
+
--ad-dashboard-widget-header-title-font-weight: 700;
|
|
729
735
|
--ad-dashboard-widget-content-scrollbar-gutter: 4px;
|
|
736
|
+
--ad-dashboard-widget-content-padding-y: 0px;
|
|
737
|
+
--ad-dashboard-widget-content-align: center;
|
|
730
738
|
--ad-dashboard-widget-footer-bg: #ffffff;
|
|
731
739
|
--ad-dashboard-widget-footer-padding-x: 20px;
|
|
732
740
|
--ad-dashboard-widget-footer-padding-y: 12px;
|
|
@@ -734,6 +742,12 @@
|
|
|
734
742
|
--ad-dashboard-widget-footer-empty-height: 21px;
|
|
735
743
|
--ad-dashboard-widget-footer-link-fg: #326FDE;
|
|
736
744
|
--ad-dashboard-widget-footer-link-disabled-fg: #adb5bd;
|
|
745
|
+
--ad-dashboard-widget-footer-link-cursor: pointer;
|
|
746
|
+
--ad-dashboard-widget-footer-link-disabled-cursor: not-allowed;
|
|
747
|
+
--ad-dashboard-widget-footer-link-bg: rgba(0,0,0,0);
|
|
748
|
+
--ad-dashboard-widget-footer-link-padding: 0px;
|
|
749
|
+
--ad-dashboard-widget-footer-link-border-width: 0px;
|
|
750
|
+
--ad-dashboard-widget-footer-link-border-style: none;
|
|
737
751
|
--ad-divider-root-border-color: #ced4da;
|
|
738
752
|
--ad-divider-root-border-style: solid;
|
|
739
753
|
--ad-divider-label-font-size: 12px;
|
|
@@ -1303,6 +1317,17 @@
|
|
|
1303
1317
|
--ad-segmented-control-sizes-xl-padding-x: 20px;
|
|
1304
1318
|
--ad-segmented-control-sizes-xl-padding-y: 10px;
|
|
1305
1319
|
--ad-segmented-control-sizes-xl-font-size: 16px;
|
|
1320
|
+
--ad-select-unstyled-bg: rgba(0,0,0,0);
|
|
1321
|
+
--ad-select-unstyled-border-width: 0px;
|
|
1322
|
+
--ad-select-unstyled-border-style: none;
|
|
1323
|
+
--ad-select-unstyled-border-color: rgba(0,0,0,0);
|
|
1324
|
+
--ad-select-unstyled-padding-start: 0px;
|
|
1325
|
+
--ad-select-unstyled-padding-y: 0px;
|
|
1326
|
+
--ad-select-unstyled-hover-border-color: rgba(0,0,0,0);
|
|
1327
|
+
--ad-select-unstyled-focus-border-color: rgba(0,0,0,0);
|
|
1328
|
+
--ad-select-unstyled-focus-outline-color: rgba(0,0,0,0);
|
|
1329
|
+
--ad-select-unstyled-focus-outline-width: 0px;
|
|
1330
|
+
--ad-select-unstyled-focus-outline-style: none;
|
|
1306
1331
|
--ad-slat-root-sections-gap: 10px;
|
|
1307
1332
|
--ad-slat-row-padding: 12px;
|
|
1308
1333
|
--ad-slat-row-gap: 12px;
|
|
@@ -1389,7 +1414,7 @@
|
|
|
1389
1414
|
--ad-switch-thumb-disabled-bg: #f8f9fa;
|
|
1390
1415
|
--ad-switch-root-gap: 12px;
|
|
1391
1416
|
--ad-switch-label-font-size: 14px;
|
|
1392
|
-
--ad-switch-label-font-weight:
|
|
1417
|
+
--ad-switch-label-font-weight: 400;
|
|
1393
1418
|
--ad-switch-label-color: #000000;
|
|
1394
1419
|
--ad-switch-label-required-gap: 4px;
|
|
1395
1420
|
--ad-switch-label-required-color: #fa5252;
|
|
@@ -2295,11 +2320,19 @@
|
|
|
2295
2320
|
--ad-dashboard-widget-root-padding-x: 20px;
|
|
2296
2321
|
--ad-dashboard-widget-root-padding-top: 12px;
|
|
2297
2322
|
--ad-dashboard-widget-root-padding-bottom: 0px;
|
|
2298
|
-
--ad-dashboard-widget-
|
|
2323
|
+
--ad-dashboard-widget-root-interactive-cursor: pointer;
|
|
2324
|
+
--ad-dashboard-widget-root-interactive-hover-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.05), 0px 20px 25px -5px rgba(0, 0, 0, 0.05), 0px 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
2325
|
+
--ad-dashboard-widget-root-interactive-selected-bg: color-mix(in srgb, #326FDE 15%, transparent);
|
|
2326
|
+
--ad-dashboard-widget-root-interactive-selected-border: #1971c2;
|
|
2327
|
+
--ad-dashboard-widget-sections-gap: 20px;
|
|
2299
2328
|
--ad-dashboard-widget-header-title-gap: 10px;
|
|
2300
2329
|
--ad-dashboard-widget-header-controls-gap: 12px;
|
|
2301
2330
|
--ad-dashboard-widget-header-switch-label-gap: 10px;
|
|
2331
|
+
--ad-dashboard-widget-header-title-font-size: 18px;
|
|
2332
|
+
--ad-dashboard-widget-header-title-font-weight: 700;
|
|
2302
2333
|
--ad-dashboard-widget-content-scrollbar-gutter: 4px;
|
|
2334
|
+
--ad-dashboard-widget-content-padding-y: 0px;
|
|
2335
|
+
--ad-dashboard-widget-content-align: center;
|
|
2303
2336
|
--ad-dashboard-widget-footer-bg: #2e2e2e;
|
|
2304
2337
|
--ad-dashboard-widget-footer-padding-x: 20px;
|
|
2305
2338
|
--ad-dashboard-widget-footer-padding-y: 12px;
|
|
@@ -2307,6 +2340,12 @@
|
|
|
2307
2340
|
--ad-dashboard-widget-footer-empty-height: 21px;
|
|
2308
2341
|
--ad-dashboard-widget-footer-link-fg: #4dabf7;
|
|
2309
2342
|
--ad-dashboard-widget-footer-link-disabled-fg: #696969;
|
|
2343
|
+
--ad-dashboard-widget-footer-link-cursor: pointer;
|
|
2344
|
+
--ad-dashboard-widget-footer-link-disabled-cursor: not-allowed;
|
|
2345
|
+
--ad-dashboard-widget-footer-link-bg: rgba(0,0,0,0);
|
|
2346
|
+
--ad-dashboard-widget-footer-link-padding: 0px;
|
|
2347
|
+
--ad-dashboard-widget-footer-link-border-width: 0px;
|
|
2348
|
+
--ad-dashboard-widget-footer-link-border-style: none;
|
|
2310
2349
|
--ad-divider-root-border-color: #424242;
|
|
2311
2350
|
--ad-divider-root-border-style: solid;
|
|
2312
2351
|
--ad-divider-label-font-size: 12px;
|
|
@@ -2876,6 +2915,17 @@
|
|
|
2876
2915
|
--ad-segmented-control-sizes-xl-padding-x: 20px;
|
|
2877
2916
|
--ad-segmented-control-sizes-xl-padding-y: 10px;
|
|
2878
2917
|
--ad-segmented-control-sizes-xl-font-size: 16px;
|
|
2918
|
+
--ad-select-unstyled-bg: rgba(0,0,0,0);
|
|
2919
|
+
--ad-select-unstyled-border-width: 0px;
|
|
2920
|
+
--ad-select-unstyled-border-style: none;
|
|
2921
|
+
--ad-select-unstyled-border-color: rgba(0,0,0,0);
|
|
2922
|
+
--ad-select-unstyled-padding-start: 0px;
|
|
2923
|
+
--ad-select-unstyled-padding-y: 0px;
|
|
2924
|
+
--ad-select-unstyled-hover-border-color: rgba(0,0,0,0);
|
|
2925
|
+
--ad-select-unstyled-focus-border-color: rgba(0,0,0,0);
|
|
2926
|
+
--ad-select-unstyled-focus-outline-color: rgba(0,0,0,0);
|
|
2927
|
+
--ad-select-unstyled-focus-outline-width: 0px;
|
|
2928
|
+
--ad-select-unstyled-focus-outline-style: none;
|
|
2879
2929
|
--ad-slat-root-sections-gap: 10px;
|
|
2880
2930
|
--ad-slat-row-padding: 12px;
|
|
2881
2931
|
--ad-slat-row-gap: 12px;
|
|
@@ -2962,7 +3012,7 @@
|
|
|
2962
3012
|
--ad-switch-thumb-disabled-bg: #3b3b3b;
|
|
2963
3013
|
--ad-switch-root-gap: 12px;
|
|
2964
3014
|
--ad-switch-label-font-size: 14px;
|
|
2965
|
-
--ad-switch-label-font-weight:
|
|
3015
|
+
--ad-switch-label-font-weight: 400;
|
|
2966
3016
|
--ad-switch-label-color: #C9C9C9;
|
|
2967
3017
|
--ad-switch-label-required-gap: 4px;
|
|
2968
3018
|
--ad-switch-label-required-color: #e03131;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
-
import { DashboardWidget, Text, Title, Stack, SimpleGrid, List, Table, Pill, KeyInsight } from '@appdirect/design-system';
|
|
2
|
+
import { DashboardWidget, Text, Title, Stack, SimpleGrid, Box, List, Table, Pill, KeyInsight } from '@appdirect/design-system';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
5
|
const meta: Meta<typeof DashboardWidget> = {
|
|
@@ -32,6 +32,14 @@ Built on top of our Card component with consistent Design System styling.
|
|
|
32
32
|
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
33
33
|
description: 'Internal spacing between elements',
|
|
34
34
|
},
|
|
35
|
+
interactive: {
|
|
36
|
+
control: 'boolean',
|
|
37
|
+
description: 'Hover shadow and pointer cursor',
|
|
38
|
+
},
|
|
39
|
+
selected: {
|
|
40
|
+
control: 'boolean',
|
|
41
|
+
description: 'Selected surface (brand light background, focus border)',
|
|
42
|
+
},
|
|
35
43
|
},
|
|
36
44
|
};
|
|
37
45
|
|
|
@@ -557,6 +565,73 @@ Try scrolling in the right widget to see the footer behavior in action.
|
|
|
557
565
|
},
|
|
558
566
|
};
|
|
559
567
|
|
|
568
|
+
// ========================== FIGMA FRAME + EQUAL HEIGHT ==========================
|
|
569
|
+
|
|
570
|
+
const periodSelect = {
|
|
571
|
+
data: [{ value: '7d', label: 'Last 7 days' }],
|
|
572
|
+
value: '7d' as string | null,
|
|
573
|
+
onChange: () => {},
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
export const FigmaSize: Story = {
|
|
577
|
+
render: () => (
|
|
578
|
+
<Box w={387}>
|
|
579
|
+
<DashboardWidget
|
|
580
|
+
title="A widget title"
|
|
581
|
+
switch={{
|
|
582
|
+
label: '',
|
|
583
|
+
checked: true,
|
|
584
|
+
onChange: () => {},
|
|
585
|
+
}}
|
|
586
|
+
headerSelect={periodSelect}
|
|
587
|
+
>
|
|
588
|
+
<Title order={1} ta="center">0</Title>
|
|
589
|
+
</DashboardWidget>
|
|
590
|
+
</Box>
|
|
591
|
+
),
|
|
592
|
+
parameters: {
|
|
593
|
+
docs: {
|
|
594
|
+
description: {
|
|
595
|
+
story: 'Compact metric frame: 387px wide, no footer links. The footer spacer stays in flow. The value is Title order 1 (KeyInsights/level-1 is 34px bold).',
|
|
596
|
+
},
|
|
597
|
+
},
|
|
598
|
+
},
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
export const EqualHeightGrid: Story = {
|
|
602
|
+
render: () => (
|
|
603
|
+
<SimpleGrid cols={3} spacing="md" h={280} style={{ gridAutoRows: '1fr' }}>
|
|
604
|
+
<DashboardWidget
|
|
605
|
+
title="With links"
|
|
606
|
+
footerLinks={[
|
|
607
|
+
{ label: 'View details', onClick: () => {} },
|
|
608
|
+
{ label: 'Export', onClick: () => {} },
|
|
609
|
+
]}
|
|
610
|
+
>
|
|
611
|
+
<KeyInsight value="0" title="Total" size="lg" />
|
|
612
|
+
</DashboardWidget>
|
|
613
|
+
<DashboardWidget title="No links">
|
|
614
|
+
<KeyInsight value="12" title="Open" size="lg" />
|
|
615
|
+
</DashboardWidget>
|
|
616
|
+
<DashboardWidget
|
|
617
|
+
title="Selected"
|
|
618
|
+
interactive
|
|
619
|
+
selected
|
|
620
|
+
headerSelect={periodSelect}
|
|
621
|
+
>
|
|
622
|
+
<KeyInsight value="4" title="New" size="lg" />
|
|
623
|
+
</DashboardWidget>
|
|
624
|
+
</SimpleGrid>
|
|
625
|
+
),
|
|
626
|
+
parameters: {
|
|
627
|
+
docs: {
|
|
628
|
+
description: {
|
|
629
|
+
story: 'Three widgets in one row. One has footer links, two do not. The selected card uses interactive + selected. Footers sit on the same baseline because each card is a flex column and the footer is the last in-flow child.',
|
|
630
|
+
},
|
|
631
|
+
},
|
|
632
|
+
},
|
|
633
|
+
};
|
|
634
|
+
|
|
560
635
|
// ========================== SALES DASHBOARD ==========================
|
|
561
636
|
|
|
562
637
|
export const SalesDashboard: Story = {
|
package/dist/stories/index.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.19",
|
|
3
3
|
"stories": [
|
|
4
4
|
{
|
|
5
5
|
"title": "Design System/Buttons/ActionIcon",
|
|
@@ -225,10 +225,13 @@
|
|
|
225
225
|
"WithActionsMenuOnly",
|
|
226
226
|
"ConsistentFooterSpacing",
|
|
227
227
|
"ScrollableContent",
|
|
228
|
+
"FigmaSize",
|
|
229
|
+
"EqualHeightGrid",
|
|
228
230
|
"SalesDashboard"
|
|
229
231
|
],
|
|
230
232
|
"file": "ComplexComponents/DashboardWidget/DashboardWidget.stories.tsx",
|
|
231
233
|
"designSystem": [
|
|
234
|
+
"Box",
|
|
232
235
|
"DashboardWidget",
|
|
233
236
|
"KeyInsight",
|
|
234
237
|
"List",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appdirect/design-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "AppDirect Design System components. Wraps Mantine v9 with standardized props, variants, and tokens.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"prepublishOnly": "npm run build"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@appdirect/ad-design-tokens": "0.0.
|
|
48
|
+
"@appdirect/ad-design-tokens": "0.0.19",
|
|
49
49
|
"@mantine/dropzone": "^9.6.0",
|
|
50
50
|
"@remixicon/react": "^4.6.0",
|
|
51
51
|
"@tabler/icons-react": "^3.33.0",
|