@appdirect/design-system 0.0.15 → 0.0.16
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/KeyInsight/KeyInsights.js +27 -163
- package/dist/ComplexComponents/KeyInsight/KeyInsights.tsx +71 -194
- package/dist/ComplexComponents/KeyInsight/index.ts +7 -1
- package/dist/contracts/KeyInsight.json +79 -0
- package/dist/contracts/index.json +6 -1
- package/dist/css/foundations.css +8 -0
- package/dist/css/mantine.css +218 -0
- package/dist/index.ts +1 -1
- package/dist/stories/ComplexComponents/KeyInsight/KeyInsights.stories.tsx +70 -82
- package/dist/stories/index.json +3 -2
- package/package.json +2 -2
|
@@ -2,175 +2,39 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Box } from '../../Layout/Box.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
xs: {
|
|
11
|
-
valueOrder: 4, // h4
|
|
12
|
-
titleSize: 'xs',
|
|
13
|
-
subtitleSize: 'xs',
|
|
14
|
-
padding: 'xs',
|
|
15
|
-
customValueStyle: undefined,
|
|
16
|
-
customTitleStyle: undefined,
|
|
17
|
-
customSubtitleStyle: undefined,
|
|
18
|
-
},
|
|
19
|
-
sm: {
|
|
20
|
-
valueOrder: 3, // h3
|
|
21
|
-
titleSize: 'sm',
|
|
22
|
-
subtitleSize: 'sm',
|
|
23
|
-
padding: 'xs',
|
|
24
|
-
customValueStyle: undefined,
|
|
25
|
-
customTitleStyle: undefined,
|
|
26
|
-
customSubtitleStyle: undefined,
|
|
27
|
-
},
|
|
28
|
-
md: {
|
|
29
|
-
valueOrder: 2, // h2
|
|
30
|
-
titleSize: 'md',
|
|
31
|
-
subtitleSize: 'md',
|
|
32
|
-
padding: 'sm',
|
|
33
|
-
customValueStyle: undefined,
|
|
34
|
-
customTitleStyle: undefined,
|
|
35
|
-
customSubtitleStyle: undefined,
|
|
36
|
-
},
|
|
37
|
-
lg: {
|
|
38
|
-
valueOrder: 1, // h1
|
|
39
|
-
titleSize: 'lg',
|
|
40
|
-
subtitleSize: 'lg',
|
|
41
|
-
padding: 'sm',
|
|
42
|
-
customValueStyle: undefined,
|
|
43
|
-
customTitleStyle: undefined,
|
|
44
|
-
customSubtitleStyle: undefined,
|
|
45
|
-
},
|
|
46
|
-
jumbo: {
|
|
47
|
-
valueOrder: 1, // h1 as base, but will be overridden
|
|
48
|
-
titleSize: 'xl',
|
|
49
|
-
subtitleSize: 'xl',
|
|
50
|
-
padding: 'md',
|
|
51
|
-
customValueStyle: {
|
|
52
|
-
fontSize: '96px',
|
|
53
|
-
lineHeight: '130%',
|
|
54
|
-
},
|
|
55
|
-
customTitleStyle: undefined,
|
|
56
|
-
customSubtitleStyle: undefined,
|
|
57
|
-
},
|
|
58
|
-
'super-jumbo': {
|
|
59
|
-
valueOrder: 1, // h1 as base, but will be overridden
|
|
60
|
-
titleSize: 'xl', // Will be overridden
|
|
61
|
-
subtitleSize: 'xl', // Will be overridden
|
|
62
|
-
padding: 'lg',
|
|
63
|
-
customValueStyle: {
|
|
64
|
-
fontSize: '128px',
|
|
65
|
-
lineHeight: '130%',
|
|
66
|
-
},
|
|
67
|
-
customTitleStyle: {
|
|
68
|
-
fontSize: '32px',
|
|
69
|
-
lineHeight: '116%',
|
|
70
|
-
},
|
|
71
|
-
customSubtitleStyle: {
|
|
72
|
-
fontSize: '32px',
|
|
73
|
-
lineHeight: '116%',
|
|
74
|
-
},
|
|
75
|
-
},
|
|
5
|
+
const LEGACY_SIZE_ALIASES = {
|
|
6
|
+
xs: 'level-4',
|
|
7
|
+
sm: 'level-3',
|
|
8
|
+
md: 'level-2',
|
|
9
|
+
lg: 'level-1',
|
|
76
10
|
};
|
|
11
|
+
const DEFAULT_VALUE_ELEMENT = {
|
|
12
|
+
'super-jumbo': 'h1',
|
|
13
|
+
jumbo: 'h1',
|
|
14
|
+
'level-1': 'h1',
|
|
15
|
+
'level-2': 'h2',
|
|
16
|
+
'level-3': 'h3',
|
|
17
|
+
'level-4': 'h4',
|
|
18
|
+
'level-5': 'h5',
|
|
19
|
+
'level-6': 'h6',
|
|
20
|
+
};
|
|
21
|
+
function resolveSize(size) {
|
|
22
|
+
if (size in LEGACY_SIZE_ALIASES) {
|
|
23
|
+
return LEGACY_SIZE_ALIASES[size];
|
|
24
|
+
}
|
|
25
|
+
return size;
|
|
26
|
+
}
|
|
77
27
|
/**
|
|
78
28
|
* KeyInsight Component
|
|
79
29
|
*
|
|
80
30
|
* A reusable component for displaying key metrics or insights with a title, value, and optional subtitle.
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* // Basic usage
|
|
85
|
-
* <KeyInsight
|
|
86
|
-
* value={1250}
|
|
87
|
-
* title="Total Users"
|
|
88
|
-
* />
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* // With subtitle and custom size
|
|
92
|
-
* <KeyInsight
|
|
93
|
-
* value="95%"
|
|
94
|
-
* title="Success Rate"
|
|
95
|
-
* subtitle="Last 30 days"
|
|
96
|
-
* size="lg"
|
|
97
|
-
* />
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* // Different sizes showcase
|
|
101
|
-
* <Stack gap="md">
|
|
102
|
-
* <KeyInsight value={1250} title="Extra Small" size="xs" />
|
|
103
|
-
* <KeyInsight value={1250} title="Small" size="sm" />
|
|
104
|
-
* <KeyInsight value={1250} title="Medium" size="md" />
|
|
105
|
-
* <KeyInsight value={1250} title="Large" size="lg" />
|
|
106
|
-
* <KeyInsight value={1250} title="Jumbo" size="jumbo" />
|
|
107
|
-
* <KeyInsight value={1250} title="Super Jumbo" size="super-jumbo" />
|
|
108
|
-
* </Stack>
|
|
31
|
+
* Sizes are tokenized (`keyInsights.sizes.*`) and applied through `data-size` rules in mantine.css.
|
|
109
32
|
*
|
|
110
33
|
* @example
|
|
111
|
-
*
|
|
112
|
-
* <KeyInsight
|
|
113
|
-
* value="42%"
|
|
114
|
-
* title="Conversion Rate"
|
|
115
|
-
* rightSection={<RiArrowUpLine size={16} color="var(--ad-color-status-success)" />}
|
|
116
|
-
* />
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* // Hero metrics with jumbo size
|
|
120
|
-
* <KeyInsight
|
|
121
|
-
* value="$2.4M"
|
|
122
|
-
* title="Annual Revenue"
|
|
123
|
-
* subtitle="2024 Performance"
|
|
124
|
-
* size="jumbo"
|
|
125
|
-
* />
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* // In a simple grid layout with borders
|
|
129
|
-
* <SimpleGrid cols={3} spacing="sm">
|
|
130
|
-
* <KeyInsight
|
|
131
|
-
* value={1250}
|
|
132
|
-
* title="Total Users"
|
|
133
|
-
* size="lg"
|
|
134
|
-
* showBorder={true}
|
|
135
|
-
* />
|
|
136
|
-
* <KeyInsight
|
|
137
|
-
* value={987}
|
|
138
|
-
* title="Active Users"
|
|
139
|
-
* size="lg"
|
|
140
|
-
* showBorder={true}
|
|
141
|
-
* />
|
|
142
|
-
* <KeyInsight
|
|
143
|
-
* value={263}
|
|
144
|
-
* title="New Users"
|
|
145
|
-
* subtitle="This month"
|
|
146
|
-
* size="lg"
|
|
147
|
-
* showBorder={false}
|
|
148
|
-
* />
|
|
149
|
-
* </SimpleGrid>
|
|
150
|
-
*
|
|
151
|
-
* @example
|
|
152
|
-
* // Dynamic usage with data
|
|
153
|
-
* const insights = [
|
|
154
|
-
* { value: userData.length, title: "Total Users" },
|
|
155
|
-
* { value: activeUsers.length, title: "Active Users" },
|
|
156
|
-
* { value: newUsers.length, title: "New Users" },
|
|
157
|
-
* ];
|
|
158
|
-
*
|
|
159
|
-
* <Inline>
|
|
160
|
-
* {insights.map((insight, index) => (
|
|
161
|
-
* <KeyInsight
|
|
162
|
-
* key={index}
|
|
163
|
-
* value={insight.value}
|
|
164
|
-
* title={insight.title}
|
|
165
|
-
* size="md"
|
|
166
|
-
* showBorder={index < insights.length - 1}
|
|
167
|
-
* />
|
|
168
|
-
* ))}
|
|
169
|
-
* </Inline>
|
|
34
|
+
* <KeyInsight value="95%" title="Success Rate" subtitle="Last 30 days" size="level-1" valueAs="p" />
|
|
170
35
|
*/
|
|
171
|
-
export function KeyInsight({ value, title, subtitle, showBorder = false, size = '
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}, children: [_jsxs(Inline, { gap: "xxs", align: "center", justify: "center", children: [leftSection, _jsx(Title, { order: config.valueOrder, style: config.customValueStyle, children: value }), rightSection] }), _jsx(Text, { size: config.titleSize, mt: 0, style: config.customTitleStyle, children: title }), subtitle && (_jsx(Text, { size: config.subtitleSize, c: "dimmed", style: config.customSubtitleStyle, children: subtitle }))] }));
|
|
36
|
+
export function KeyInsight({ value, title, subtitle, showBorder = false, size = 'level-2', valueAs, leftSection, rightSection, }) {
|
|
37
|
+
const canonicalSize = resolveSize(size);
|
|
38
|
+
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] }));
|
|
176
40
|
}
|
|
@@ -2,11 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Box } from '../../Layout/Box';
|
|
5
|
-
import { Text } from '../../Typography/Text';
|
|
6
|
-
import { Title } from '../../Typography/Title';
|
|
7
|
-
import { Inline } from '../../Layout/Inline';
|
|
8
5
|
|
|
9
|
-
export type
|
|
6
|
+
export type KeyInsightCanonicalSize =
|
|
7
|
+
| 'super-jumbo'
|
|
8
|
+
| 'jumbo'
|
|
9
|
+
| 'level-1'
|
|
10
|
+
| 'level-2'
|
|
11
|
+
| 'level-3'
|
|
12
|
+
| 'level-4'
|
|
13
|
+
| 'level-5'
|
|
14
|
+
| 'level-6';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Legacy KeyInsight sizes. `xs` is `level-4`, `sm` is `level-3`, `md` is `level-2`, `lg` is `level-1`.
|
|
18
|
+
*/
|
|
19
|
+
export type KeyInsightLegacySize = 'xs' | 'sm' | 'md' | 'lg';
|
|
20
|
+
|
|
21
|
+
export type KeyInsightSize = KeyInsightCanonicalSize | KeyInsightLegacySize;
|
|
22
|
+
|
|
23
|
+
/** Element for the value. Visual size comes from `size`, not from this element. */
|
|
24
|
+
export type KeyInsightValueAs = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span';
|
|
10
25
|
|
|
11
26
|
export interface KeyInsightProps {
|
|
12
27
|
/** Value to display (can be number or string) */
|
|
@@ -17,223 +32,85 @@ export interface KeyInsightProps {
|
|
|
17
32
|
subtitle?: string;
|
|
18
33
|
/** Whether to show border on the right */
|
|
19
34
|
showBorder?: boolean;
|
|
20
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Visual size. Canonical values: `super-jumbo`, `jumbo`, `level-1` … `level-6`
|
|
37
|
+
* (Figma: KeyInsights/Super Jumbo, KeyInsights/Jumbo, KeyInsights/level-1 … KeyInsights/level-6).
|
|
38
|
+
*
|
|
39
|
+
* Deprecated aliases, still accepted: `xs` → `level-4`, `sm` → `level-3`, `md` → `level-2`, `lg` → `level-1`.
|
|
40
|
+
*/
|
|
21
41
|
size?: KeyInsightSize;
|
|
42
|
+
/**
|
|
43
|
+
* HTML element for the value. Defaults to the heading that matches the resolved size
|
|
44
|
+
* (`level-1`, `jumbo`, and `super-jumbo` → `h1`; `level-2` → `h2`; … `level-6` → `h6`).
|
|
45
|
+
* Pass `"p"` or `"span"` to keep a level-1 visual size without rendering an `<h1>`.
|
|
46
|
+
*/
|
|
47
|
+
valueAs?: KeyInsightValueAs;
|
|
22
48
|
/** Optional content rendered inline before the value (e.g. a trend arrow or unit) */
|
|
23
49
|
leftSection?: React.ReactNode;
|
|
24
50
|
/** Optional content rendered inline after the value (e.g. a trend arrow or unit) */
|
|
25
51
|
rightSection?: React.ReactNode;
|
|
26
52
|
}
|
|
27
53
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
padding: 'sm' as const,
|
|
53
|
-
customValueStyle: undefined,
|
|
54
|
-
customTitleStyle: undefined,
|
|
55
|
-
customSubtitleStyle: undefined,
|
|
56
|
-
},
|
|
57
|
-
lg: {
|
|
58
|
-
valueOrder: 1 as const, // h1
|
|
59
|
-
titleSize: 'lg' as const,
|
|
60
|
-
subtitleSize: 'lg' as const,
|
|
61
|
-
padding: 'sm' as const,
|
|
62
|
-
customValueStyle: undefined,
|
|
63
|
-
customTitleStyle: undefined,
|
|
64
|
-
customSubtitleStyle: undefined,
|
|
65
|
-
},
|
|
66
|
-
jumbo: {
|
|
67
|
-
valueOrder: 1 as const, // h1 as base, but will be overridden
|
|
68
|
-
titleSize: 'xl' as const,
|
|
69
|
-
subtitleSize: 'xl' as const,
|
|
70
|
-
padding: 'md' as const,
|
|
71
|
-
customValueStyle: {
|
|
72
|
-
fontSize: '96px',
|
|
73
|
-
lineHeight: '130%',
|
|
74
|
-
},
|
|
75
|
-
customTitleStyle: undefined,
|
|
76
|
-
customSubtitleStyle: undefined,
|
|
77
|
-
},
|
|
78
|
-
'super-jumbo': {
|
|
79
|
-
valueOrder: 1 as const, // h1 as base, but will be overridden
|
|
80
|
-
titleSize: 'xl' as const, // Will be overridden
|
|
81
|
-
subtitleSize: 'xl' as const, // Will be overridden
|
|
82
|
-
padding: 'lg' as const,
|
|
83
|
-
customValueStyle: {
|
|
84
|
-
fontSize: '128px',
|
|
85
|
-
lineHeight: '130%',
|
|
86
|
-
},
|
|
87
|
-
customTitleStyle: {
|
|
88
|
-
fontSize: '32px',
|
|
89
|
-
lineHeight: '116%',
|
|
90
|
-
},
|
|
91
|
-
customSubtitleStyle: {
|
|
92
|
-
fontSize: '32px',
|
|
93
|
-
lineHeight: '116%',
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
} as const;
|
|
54
|
+
const LEGACY_SIZE_ALIASES: Record<KeyInsightLegacySize, KeyInsightCanonicalSize> = {
|
|
55
|
+
xs: 'level-4',
|
|
56
|
+
sm: 'level-3',
|
|
57
|
+
md: 'level-2',
|
|
58
|
+
lg: 'level-1',
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const DEFAULT_VALUE_ELEMENT: Record<KeyInsightCanonicalSize, KeyInsightValueAs> = {
|
|
62
|
+
'super-jumbo': 'h1',
|
|
63
|
+
jumbo: 'h1',
|
|
64
|
+
'level-1': 'h1',
|
|
65
|
+
'level-2': 'h2',
|
|
66
|
+
'level-3': 'h3',
|
|
67
|
+
'level-4': 'h4',
|
|
68
|
+
'level-5': 'h5',
|
|
69
|
+
'level-6': 'h6',
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
function resolveSize(size: KeyInsightSize): KeyInsightCanonicalSize {
|
|
73
|
+
if (size in LEGACY_SIZE_ALIASES) {
|
|
74
|
+
return LEGACY_SIZE_ALIASES[size as KeyInsightLegacySize];
|
|
75
|
+
}
|
|
76
|
+
return size as KeyInsightCanonicalSize;
|
|
77
|
+
}
|
|
97
78
|
|
|
98
79
|
/**
|
|
99
80
|
* KeyInsight Component
|
|
100
|
-
*
|
|
81
|
+
*
|
|
101
82
|
* A reusable component for displaying key metrics or insights with a title, value, and optional subtitle.
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* // Basic usage
|
|
106
|
-
* <KeyInsight
|
|
107
|
-
* value={1250}
|
|
108
|
-
* title="Total Users"
|
|
109
|
-
* />
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* // With subtitle and custom size
|
|
113
|
-
* <KeyInsight
|
|
114
|
-
* value="95%"
|
|
115
|
-
* title="Success Rate"
|
|
116
|
-
* subtitle="Last 30 days"
|
|
117
|
-
* size="lg"
|
|
118
|
-
* />
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* // Different sizes showcase
|
|
122
|
-
* <Stack gap="md">
|
|
123
|
-
* <KeyInsight value={1250} title="Extra Small" size="xs" />
|
|
124
|
-
* <KeyInsight value={1250} title="Small" size="sm" />
|
|
125
|
-
* <KeyInsight value={1250} title="Medium" size="md" />
|
|
126
|
-
* <KeyInsight value={1250} title="Large" size="lg" />
|
|
127
|
-
* <KeyInsight value={1250} title="Jumbo" size="jumbo" />
|
|
128
|
-
* <KeyInsight value={1250} title="Super Jumbo" size="super-jumbo" />
|
|
129
|
-
* </Stack>
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* // With a trend indicator next to the value
|
|
133
|
-
* <KeyInsight
|
|
134
|
-
* value="42%"
|
|
135
|
-
* title="Conversion Rate"
|
|
136
|
-
* rightSection={<RiArrowUpLine size={16} color="var(--ad-color-status-success)" />}
|
|
137
|
-
* />
|
|
83
|
+
* Sizes are tokenized (`keyInsights.sizes.*`) and applied through `data-size` rules in mantine.css.
|
|
138
84
|
*
|
|
139
85
|
* @example
|
|
140
|
-
*
|
|
141
|
-
* <KeyInsight
|
|
142
|
-
* value="$2.4M"
|
|
143
|
-
* title="Annual Revenue"
|
|
144
|
-
* subtitle="2024 Performance"
|
|
145
|
-
* size="jumbo"
|
|
146
|
-
* />
|
|
147
|
-
*
|
|
148
|
-
* @example
|
|
149
|
-
* // In a simple grid layout with borders
|
|
150
|
-
* <SimpleGrid cols={3} spacing="sm">
|
|
151
|
-
* <KeyInsight
|
|
152
|
-
* value={1250}
|
|
153
|
-
* title="Total Users"
|
|
154
|
-
* size="lg"
|
|
155
|
-
* showBorder={true}
|
|
156
|
-
* />
|
|
157
|
-
* <KeyInsight
|
|
158
|
-
* value={987}
|
|
159
|
-
* title="Active Users"
|
|
160
|
-
* size="lg"
|
|
161
|
-
* showBorder={true}
|
|
162
|
-
* />
|
|
163
|
-
* <KeyInsight
|
|
164
|
-
* value={263}
|
|
165
|
-
* title="New Users"
|
|
166
|
-
* subtitle="This month"
|
|
167
|
-
* size="lg"
|
|
168
|
-
* showBorder={false}
|
|
169
|
-
* />
|
|
170
|
-
* </SimpleGrid>
|
|
171
|
-
*
|
|
172
|
-
* @example
|
|
173
|
-
* // Dynamic usage with data
|
|
174
|
-
* const insights = [
|
|
175
|
-
* { value: userData.length, title: "Total Users" },
|
|
176
|
-
* { value: activeUsers.length, title: "Active Users" },
|
|
177
|
-
* { value: newUsers.length, title: "New Users" },
|
|
178
|
-
* ];
|
|
179
|
-
*
|
|
180
|
-
* <Inline>
|
|
181
|
-
* {insights.map((insight, index) => (
|
|
182
|
-
* <KeyInsight
|
|
183
|
-
* key={index}
|
|
184
|
-
* value={insight.value}
|
|
185
|
-
* title={insight.title}
|
|
186
|
-
* size="md"
|
|
187
|
-
* showBorder={index < insights.length - 1}
|
|
188
|
-
* />
|
|
189
|
-
* ))}
|
|
190
|
-
* </Inline>
|
|
86
|
+
* <KeyInsight value="95%" title="Success Rate" subtitle="Last 30 days" size="level-1" valueAs="p" />
|
|
191
87
|
*/
|
|
192
88
|
export function KeyInsight({
|
|
193
89
|
value,
|
|
194
90
|
title,
|
|
195
91
|
subtitle,
|
|
196
92
|
showBorder = false,
|
|
197
|
-
size = '
|
|
93
|
+
size = 'level-2',
|
|
94
|
+
valueAs,
|
|
198
95
|
leftSection,
|
|
199
96
|
rightSection,
|
|
200
97
|
}: KeyInsightProps) {
|
|
201
|
-
const
|
|
98
|
+
const canonicalSize = resolveSize(size);
|
|
99
|
+
const ValueElement = valueAs ?? DEFAULT_VALUE_ELEMENT[canonicalSize];
|
|
202
100
|
|
|
203
101
|
return (
|
|
204
102
|
<Box
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
borderRight: showBorder ? '1px solid var(--ad-color-border-subtle)' : undefined
|
|
209
|
-
}}
|
|
103
|
+
className="ad-KeyInsight"
|
|
104
|
+
data-size={canonicalSize}
|
|
105
|
+
data-border={showBorder ? '' : undefined}
|
|
210
106
|
>
|
|
211
|
-
<
|
|
107
|
+
<Box className="ad-KeyInsight-valueRow">
|
|
212
108
|
{leftSection}
|
|
213
|
-
<
|
|
214
|
-
order={config.valueOrder}
|
|
215
|
-
style={config.customValueStyle}
|
|
216
|
-
>
|
|
217
|
-
{value}
|
|
218
|
-
</Title>
|
|
109
|
+
<ValueElement className="ad-KeyInsight-value">{value}</ValueElement>
|
|
219
110
|
{rightSection}
|
|
220
|
-
</
|
|
221
|
-
<
|
|
222
|
-
|
|
223
|
-
mt={0}
|
|
224
|
-
style={config.customTitleStyle}
|
|
225
|
-
>
|
|
226
|
-
{title}
|
|
227
|
-
</Text>
|
|
228
|
-
{subtitle && (
|
|
229
|
-
<Text
|
|
230
|
-
size={config.subtitleSize}
|
|
231
|
-
c="dimmed"
|
|
232
|
-
style={config.customSubtitleStyle}
|
|
233
|
-
>
|
|
234
|
-
{subtitle}
|
|
235
|
-
</Text>
|
|
236
|
-
)}
|
|
111
|
+
</Box>
|
|
112
|
+
<p className="ad-KeyInsight-title">{title}</p>
|
|
113
|
+
{subtitle ? <p className="ad-KeyInsight-subtitle">{subtitle}</p> : null}
|
|
237
114
|
</Box>
|
|
238
115
|
);
|
|
239
|
-
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../contracts/ds-component-contract.v1.json",
|
|
3
|
+
"id": "KeyInsight",
|
|
4
|
+
"kind": "complex",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"purpose": "Single KPI tile: a value, a title, and an optional subtitle. Visual size is independent of the value's HTML element.",
|
|
7
|
+
"importFrom": [
|
|
8
|
+
"@appdirect/design-system"
|
|
9
|
+
],
|
|
10
|
+
"mantineCounterpart": null,
|
|
11
|
+
"anatomy": [
|
|
12
|
+
"value",
|
|
13
|
+
"title",
|
|
14
|
+
"subtitle"
|
|
15
|
+
],
|
|
16
|
+
"api": {
|
|
17
|
+
"props": {
|
|
18
|
+
"value": {
|
|
19
|
+
"type": "string | number",
|
|
20
|
+
"required": true
|
|
21
|
+
},
|
|
22
|
+
"title": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"required": true
|
|
25
|
+
},
|
|
26
|
+
"subtitle": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"showBorder": {
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"default": false
|
|
32
|
+
},
|
|
33
|
+
"size": {
|
|
34
|
+
"enum": [
|
|
35
|
+
"super-jumbo",
|
|
36
|
+
"jumbo",
|
|
37
|
+
"level-1",
|
|
38
|
+
"level-2",
|
|
39
|
+
"level-3",
|
|
40
|
+
"level-4",
|
|
41
|
+
"level-5",
|
|
42
|
+
"level-6",
|
|
43
|
+
"xs",
|
|
44
|
+
"sm",
|
|
45
|
+
"md",
|
|
46
|
+
"lg"
|
|
47
|
+
],
|
|
48
|
+
"default": "level-2",
|
|
49
|
+
"notes": "Canonical sizes are super-jumbo, jumbo, and level-1…level-6. Deprecated aliases: xs→level-4, sm→level-3, md→level-2, lg→level-1. jumbo and super-jumbo are unchanged."
|
|
50
|
+
},
|
|
51
|
+
"valueAs": {
|
|
52
|
+
"enum": [
|
|
53
|
+
"h1",
|
|
54
|
+
"h2",
|
|
55
|
+
"h3",
|
|
56
|
+
"h4",
|
|
57
|
+
"h5",
|
|
58
|
+
"h6",
|
|
59
|
+
"p",
|
|
60
|
+
"span"
|
|
61
|
+
],
|
|
62
|
+
"notes": "Element for the value. Defaults to the heading that matches the resolved size (level-1, jumbo, and super-jumbo → h1). Pass p or span so a level-1 visual size is not an h1."
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"enforcement": {
|
|
67
|
+
"deterministic": [
|
|
68
|
+
"importFrom",
|
|
69
|
+
"kind",
|
|
70
|
+
"mantineCounterpart",
|
|
71
|
+
"api.props.value.required",
|
|
72
|
+
"api.props.title.required",
|
|
73
|
+
"api.props.size.enum"
|
|
74
|
+
],
|
|
75
|
+
"semantic": [
|
|
76
|
+
"purpose"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.16",
|
|
3
3
|
"contracts": [
|
|
4
4
|
{
|
|
5
5
|
"id": "Alert",
|
|
@@ -41,6 +41,11 @@
|
|
|
41
41
|
"kind": "wrapper",
|
|
42
42
|
"source": "Layout/Inline.contract.json"
|
|
43
43
|
},
|
|
44
|
+
{
|
|
45
|
+
"id": "KeyInsight",
|
|
46
|
+
"kind": "complex",
|
|
47
|
+
"source": "ComplexComponents/KeyInsight/KeyInsight.contract.json"
|
|
48
|
+
},
|
|
44
49
|
{
|
|
45
50
|
"id": "PageContentHeader",
|
|
46
51
|
"kind": "complex",
|
package/dist/css/foundations.css
CHANGED
|
@@ -149,6 +149,10 @@
|
|
|
149
149
|
--ad-headings-sizes-h5-line-height: 1.5;
|
|
150
150
|
--ad-headings-sizes-h6-font-size: 14px;
|
|
151
151
|
--ad-headings-sizes-h6-line-height: 1.5;
|
|
152
|
+
--ad-headings-sizes-jumbo-font-size: 96px;
|
|
153
|
+
--ad-headings-sizes-super-jumbo-font-size: 128px;
|
|
154
|
+
--ad-headings-sizes-super-jumbo-label-font-size: 32px;
|
|
155
|
+
--ad-headings-sizes-super-jumbo-label-line-height: 1.16;
|
|
152
156
|
--ad-z-index-app: 100;
|
|
153
157
|
--ad-z-index-modal: 200;
|
|
154
158
|
--ad-z-index-popover: 300;
|
|
@@ -497,6 +501,10 @@
|
|
|
497
501
|
--ad-headings-sizes-h5-line-height: 1.5;
|
|
498
502
|
--ad-headings-sizes-h6-font-size: 14px;
|
|
499
503
|
--ad-headings-sizes-h6-line-height: 1.5;
|
|
504
|
+
--ad-headings-sizes-jumbo-font-size: 96px;
|
|
505
|
+
--ad-headings-sizes-super-jumbo-font-size: 128px;
|
|
506
|
+
--ad-headings-sizes-super-jumbo-label-font-size: 32px;
|
|
507
|
+
--ad-headings-sizes-super-jumbo-label-line-height: 1.16;
|
|
500
508
|
--ad-z-index-app: 100;
|
|
501
509
|
--ad-z-index-modal: 200;
|
|
502
510
|
--ad-z-index-popover: 300;
|
package/dist/css/mantine.css
CHANGED
|
@@ -1080,6 +1080,224 @@
|
|
|
1080
1080
|
background: var(--ad-color-bg-default-hover);
|
|
1081
1081
|
color: var(--ad-color-text-default);
|
|
1082
1082
|
}
|
|
1083
|
+
/* === KeyInsights === */
|
|
1084
|
+
.ad-KeyInsight {
|
|
1085
|
+
text-align: center;
|
|
1086
|
+
}
|
|
1087
|
+
.ad-KeyInsight[data-border] {
|
|
1088
|
+
border-right-width: var(--ad-border-width-thin);
|
|
1089
|
+
border-right-style: var(--ad-border-style-solid);
|
|
1090
|
+
border-right-color: var(--ad-color-border-subtle);
|
|
1091
|
+
}
|
|
1092
|
+
.ad-KeyInsight-valueRow {
|
|
1093
|
+
display: flex;
|
|
1094
|
+
align-items: center;
|
|
1095
|
+
justify-content: center;
|
|
1096
|
+
}
|
|
1097
|
+
.ad-KeyInsight-value {
|
|
1098
|
+
font-family: var(--ad-headings-font-family);
|
|
1099
|
+
margin: var(--ad-spacing-none);
|
|
1100
|
+
}
|
|
1101
|
+
.ad-KeyInsight-title {
|
|
1102
|
+
font-family: var(--ad-font-family-body);
|
|
1103
|
+
margin: var(--ad-spacing-none);
|
|
1104
|
+
}
|
|
1105
|
+
.ad-KeyInsight-subtitle {
|
|
1106
|
+
font-family: var(--ad-font-family-body);
|
|
1107
|
+
margin: var(--ad-spacing-none);
|
|
1108
|
+
}
|
|
1109
|
+
.ad-KeyInsight[data-size="super-jumbo"] {
|
|
1110
|
+
padding: var(--ad-spacing-lg);
|
|
1111
|
+
}
|
|
1112
|
+
.ad-KeyInsight[data-size="super-jumbo"] .ad-KeyInsight-valueRow {
|
|
1113
|
+
gap: var(--ad-spacing-xxs);
|
|
1114
|
+
}
|
|
1115
|
+
.ad-KeyInsight[data-size="super-jumbo"] .ad-KeyInsight-value {
|
|
1116
|
+
font-size: var(--ad-headings-sizes-super-jumbo-font-size);
|
|
1117
|
+
line-height: var(--ad-headings-sizes-h1-line-height);
|
|
1118
|
+
font-weight: var(--ad-headings-font-weight);
|
|
1119
|
+
color: var(--ad-color-text-default);
|
|
1120
|
+
}
|
|
1121
|
+
.ad-KeyInsight[data-size="super-jumbo"] .ad-KeyInsight-title {
|
|
1122
|
+
font-size: var(--ad-headings-sizes-super-jumbo-label-font-size);
|
|
1123
|
+
line-height: var(--ad-headings-sizes-super-jumbo-label-line-height);
|
|
1124
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1125
|
+
color: var(--ad-color-text-default);
|
|
1126
|
+
}
|
|
1127
|
+
.ad-KeyInsight[data-size="super-jumbo"] .ad-KeyInsight-subtitle {
|
|
1128
|
+
font-size: var(--ad-headings-sizes-super-jumbo-label-font-size);
|
|
1129
|
+
line-height: var(--ad-headings-sizes-super-jumbo-label-line-height);
|
|
1130
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1131
|
+
color: var(--ad-color-text-dimmed);
|
|
1132
|
+
}
|
|
1133
|
+
.ad-KeyInsight[data-size="jumbo"] {
|
|
1134
|
+
padding: var(--ad-spacing-md);
|
|
1135
|
+
}
|
|
1136
|
+
.ad-KeyInsight[data-size="jumbo"] .ad-KeyInsight-valueRow {
|
|
1137
|
+
gap: var(--ad-spacing-xxs);
|
|
1138
|
+
}
|
|
1139
|
+
.ad-KeyInsight[data-size="jumbo"] .ad-KeyInsight-value {
|
|
1140
|
+
font-size: var(--ad-headings-sizes-jumbo-font-size);
|
|
1141
|
+
line-height: var(--ad-headings-sizes-h1-line-height);
|
|
1142
|
+
font-weight: var(--ad-headings-font-weight);
|
|
1143
|
+
color: var(--ad-color-text-default);
|
|
1144
|
+
}
|
|
1145
|
+
.ad-KeyInsight[data-size="jumbo"] .ad-KeyInsight-title {
|
|
1146
|
+
font-size: var(--ad-font-sizes-xl);
|
|
1147
|
+
line-height: var(--ad-line-heights-xl);
|
|
1148
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1149
|
+
color: var(--ad-color-text-default);
|
|
1150
|
+
}
|
|
1151
|
+
.ad-KeyInsight[data-size="jumbo"] .ad-KeyInsight-subtitle {
|
|
1152
|
+
font-size: var(--ad-font-sizes-xl);
|
|
1153
|
+
line-height: var(--ad-line-heights-xl);
|
|
1154
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1155
|
+
color: var(--ad-color-text-dimmed);
|
|
1156
|
+
}
|
|
1157
|
+
.ad-KeyInsight[data-size="level-1"] {
|
|
1158
|
+
padding: var(--ad-spacing-sm);
|
|
1159
|
+
}
|
|
1160
|
+
.ad-KeyInsight[data-size="level-1"] .ad-KeyInsight-valueRow {
|
|
1161
|
+
gap: var(--ad-spacing-xxs);
|
|
1162
|
+
}
|
|
1163
|
+
.ad-KeyInsight[data-size="level-1"] .ad-KeyInsight-value {
|
|
1164
|
+
font-size: var(--ad-headings-sizes-h1-font-size);
|
|
1165
|
+
line-height: var(--ad-headings-sizes-h1-line-height);
|
|
1166
|
+
font-weight: var(--ad-headings-font-weight);
|
|
1167
|
+
color: var(--ad-color-text-default);
|
|
1168
|
+
}
|
|
1169
|
+
.ad-KeyInsight[data-size="level-1"] .ad-KeyInsight-title {
|
|
1170
|
+
font-size: var(--ad-font-sizes-lg);
|
|
1171
|
+
line-height: var(--ad-line-heights-lg);
|
|
1172
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1173
|
+
color: var(--ad-color-text-default);
|
|
1174
|
+
}
|
|
1175
|
+
.ad-KeyInsight[data-size="level-1"] .ad-KeyInsight-subtitle {
|
|
1176
|
+
font-size: var(--ad-font-sizes-lg);
|
|
1177
|
+
line-height: var(--ad-line-heights-lg);
|
|
1178
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1179
|
+
color: var(--ad-color-text-dimmed);
|
|
1180
|
+
}
|
|
1181
|
+
.ad-KeyInsight[data-size="level-2"] {
|
|
1182
|
+
padding: var(--ad-spacing-sm);
|
|
1183
|
+
}
|
|
1184
|
+
.ad-KeyInsight[data-size="level-2"] .ad-KeyInsight-valueRow {
|
|
1185
|
+
gap: var(--ad-spacing-xxs);
|
|
1186
|
+
}
|
|
1187
|
+
.ad-KeyInsight[data-size="level-2"] .ad-KeyInsight-value {
|
|
1188
|
+
font-size: var(--ad-headings-sizes-h2-font-size);
|
|
1189
|
+
line-height: var(--ad-headings-sizes-h2-line-height);
|
|
1190
|
+
font-weight: var(--ad-headings-font-weight);
|
|
1191
|
+
color: var(--ad-color-text-default);
|
|
1192
|
+
}
|
|
1193
|
+
.ad-KeyInsight[data-size="level-2"] .ad-KeyInsight-title {
|
|
1194
|
+
font-size: var(--ad-font-sizes-md);
|
|
1195
|
+
line-height: var(--ad-line-heights-md);
|
|
1196
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1197
|
+
color: var(--ad-color-text-default);
|
|
1198
|
+
}
|
|
1199
|
+
.ad-KeyInsight[data-size="level-2"] .ad-KeyInsight-subtitle {
|
|
1200
|
+
font-size: var(--ad-font-sizes-md);
|
|
1201
|
+
line-height: var(--ad-line-heights-md);
|
|
1202
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1203
|
+
color: var(--ad-color-text-dimmed);
|
|
1204
|
+
}
|
|
1205
|
+
.ad-KeyInsight[data-size="level-3"] {
|
|
1206
|
+
padding: var(--ad-spacing-xs);
|
|
1207
|
+
}
|
|
1208
|
+
.ad-KeyInsight[data-size="level-3"] .ad-KeyInsight-valueRow {
|
|
1209
|
+
gap: var(--ad-spacing-xxs);
|
|
1210
|
+
}
|
|
1211
|
+
.ad-KeyInsight[data-size="level-3"] .ad-KeyInsight-value {
|
|
1212
|
+
font-size: var(--ad-headings-sizes-h3-font-size);
|
|
1213
|
+
line-height: var(--ad-headings-sizes-h3-line-height);
|
|
1214
|
+
font-weight: var(--ad-headings-font-weight);
|
|
1215
|
+
color: var(--ad-color-text-default);
|
|
1216
|
+
}
|
|
1217
|
+
.ad-KeyInsight[data-size="level-3"] .ad-KeyInsight-title {
|
|
1218
|
+
font-size: var(--ad-font-sizes-sm);
|
|
1219
|
+
line-height: var(--ad-line-heights-sm);
|
|
1220
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1221
|
+
color: var(--ad-color-text-default);
|
|
1222
|
+
}
|
|
1223
|
+
.ad-KeyInsight[data-size="level-3"] .ad-KeyInsight-subtitle {
|
|
1224
|
+
font-size: var(--ad-font-sizes-sm);
|
|
1225
|
+
line-height: var(--ad-line-heights-sm);
|
|
1226
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1227
|
+
color: var(--ad-color-text-dimmed);
|
|
1228
|
+
}
|
|
1229
|
+
.ad-KeyInsight[data-size="level-4"] {
|
|
1230
|
+
padding: var(--ad-spacing-xs);
|
|
1231
|
+
}
|
|
1232
|
+
.ad-KeyInsight[data-size="level-4"] .ad-KeyInsight-valueRow {
|
|
1233
|
+
gap: var(--ad-spacing-xxs);
|
|
1234
|
+
}
|
|
1235
|
+
.ad-KeyInsight[data-size="level-4"] .ad-KeyInsight-value {
|
|
1236
|
+
font-size: var(--ad-headings-sizes-h4-font-size);
|
|
1237
|
+
line-height: var(--ad-headings-sizes-h4-line-height);
|
|
1238
|
+
font-weight: var(--ad-headings-font-weight);
|
|
1239
|
+
color: var(--ad-color-text-default);
|
|
1240
|
+
}
|
|
1241
|
+
.ad-KeyInsight[data-size="level-4"] .ad-KeyInsight-title {
|
|
1242
|
+
font-size: var(--ad-font-sizes-xs);
|
|
1243
|
+
line-height: var(--ad-line-heights-xs);
|
|
1244
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1245
|
+
color: var(--ad-color-text-default);
|
|
1246
|
+
}
|
|
1247
|
+
.ad-KeyInsight[data-size="level-4"] .ad-KeyInsight-subtitle {
|
|
1248
|
+
font-size: var(--ad-font-sizes-xs);
|
|
1249
|
+
line-height: var(--ad-line-heights-xs);
|
|
1250
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1251
|
+
color: var(--ad-color-text-dimmed);
|
|
1252
|
+
}
|
|
1253
|
+
.ad-KeyInsight[data-size="level-5"] {
|
|
1254
|
+
padding: var(--ad-spacing-xs);
|
|
1255
|
+
}
|
|
1256
|
+
.ad-KeyInsight[data-size="level-5"] .ad-KeyInsight-valueRow {
|
|
1257
|
+
gap: var(--ad-spacing-xxs);
|
|
1258
|
+
}
|
|
1259
|
+
.ad-KeyInsight[data-size="level-5"] .ad-KeyInsight-value {
|
|
1260
|
+
font-size: var(--ad-headings-sizes-h5-font-size);
|
|
1261
|
+
line-height: var(--ad-headings-sizes-h5-line-height);
|
|
1262
|
+
font-weight: var(--ad-headings-font-weight);
|
|
1263
|
+
color: var(--ad-color-text-default);
|
|
1264
|
+
}
|
|
1265
|
+
.ad-KeyInsight[data-size="level-5"] .ad-KeyInsight-title {
|
|
1266
|
+
font-size: var(--ad-font-sizes-xs);
|
|
1267
|
+
line-height: var(--ad-line-heights-xs);
|
|
1268
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1269
|
+
color: var(--ad-color-text-default);
|
|
1270
|
+
}
|
|
1271
|
+
.ad-KeyInsight[data-size="level-5"] .ad-KeyInsight-subtitle {
|
|
1272
|
+
font-size: var(--ad-font-sizes-xs);
|
|
1273
|
+
line-height: var(--ad-line-heights-xs);
|
|
1274
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1275
|
+
color: var(--ad-color-text-dimmed);
|
|
1276
|
+
}
|
|
1277
|
+
.ad-KeyInsight[data-size="level-6"] {
|
|
1278
|
+
padding: var(--ad-spacing-xs);
|
|
1279
|
+
}
|
|
1280
|
+
.ad-KeyInsight[data-size="level-6"] .ad-KeyInsight-valueRow {
|
|
1281
|
+
gap: var(--ad-spacing-xxs);
|
|
1282
|
+
}
|
|
1283
|
+
.ad-KeyInsight[data-size="level-6"] .ad-KeyInsight-value {
|
|
1284
|
+
font-size: var(--ad-headings-sizes-h6-font-size);
|
|
1285
|
+
line-height: var(--ad-headings-sizes-h6-line-height);
|
|
1286
|
+
font-weight: var(--ad-headings-font-weight);
|
|
1287
|
+
color: var(--ad-color-text-default);
|
|
1288
|
+
}
|
|
1289
|
+
.ad-KeyInsight[data-size="level-6"] .ad-KeyInsight-title {
|
|
1290
|
+
font-size: var(--ad-font-sizes-xs);
|
|
1291
|
+
line-height: var(--ad-line-heights-xs);
|
|
1292
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1293
|
+
color: var(--ad-color-text-default);
|
|
1294
|
+
}
|
|
1295
|
+
.ad-KeyInsight[data-size="level-6"] .ad-KeyInsight-subtitle {
|
|
1296
|
+
font-size: var(--ad-font-sizes-xs);
|
|
1297
|
+
line-height: var(--ad-line-heights-xs);
|
|
1298
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1299
|
+
color: var(--ad-color-text-dimmed);
|
|
1300
|
+
}
|
|
1083
1301
|
/* === List === */
|
|
1084
1302
|
.mantine-List-root {
|
|
1085
1303
|
color: var(--ad-color-text-default);
|
package/dist/index.ts
CHANGED
|
@@ -89,7 +89,7 @@ export type { DSAppShellLayoutProps, DSHeaderBarProps, DSSidebarNavProps, NavIte
|
|
|
89
89
|
|
|
90
90
|
// ========================== COMPLEX COMPONENTS ==========================
|
|
91
91
|
export { KeyInsight } from './ComplexComponents/KeyInsight';
|
|
92
|
-
export type { KeyInsightProps } from './ComplexComponents/KeyInsight';
|
|
92
|
+
export type { KeyInsightProps, KeyInsightSize, KeyInsightValueAs } from './ComplexComponents/KeyInsight';
|
|
93
93
|
export { NameValue, NameValueItem } from './ComplexComponents/NameValue';
|
|
94
94
|
export type { NameValueProps, NameValuePair, NameValueItemProps } from './ComplexComponents/NameValue';
|
|
95
95
|
export { CopyButton } from './ComplexComponents/Utilities';
|
|
@@ -8,7 +8,7 @@ const meta: Meta<typeof KeyInsight> = {
|
|
|
8
8
|
layout: 'centered',
|
|
9
9
|
docs: {
|
|
10
10
|
description: {
|
|
11
|
-
component: 'KeyInsight component for displaying key metrics or insights with a title, value, and optional subtitle.
|
|
11
|
+
component: 'KeyInsight component for displaying key metrics or insights with a title, value, and optional subtitle. Sizes: super-jumbo, jumbo, and level-1 through level-6. Use valueAs="p" or "span" when a level-1 visual size must not be an h1.',
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
14
|
},
|
|
@@ -32,8 +32,13 @@ const meta: Meta<typeof KeyInsight> = {
|
|
|
32
32
|
},
|
|
33
33
|
size: {
|
|
34
34
|
control: 'select',
|
|
35
|
-
options: ['
|
|
36
|
-
description: '
|
|
35
|
+
options: ['super-jumbo', 'jumbo', 'level-1', 'level-2', 'level-3', 'level-4', 'level-5', 'level-6'],
|
|
36
|
+
description: 'Visual size. Deprecated aliases xs/sm/md/lg still resolve to level-4/3/2/1.',
|
|
37
|
+
},
|
|
38
|
+
valueAs: {
|
|
39
|
+
control: 'select',
|
|
40
|
+
options: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span'],
|
|
41
|
+
description: 'Element for the value. Defaults to the heading for the size. Use p or span so level-1 is not an h1.',
|
|
37
42
|
},
|
|
38
43
|
},
|
|
39
44
|
};
|
|
@@ -45,7 +50,7 @@ export const Default: Story = {
|
|
|
45
50
|
args: {
|
|
46
51
|
value: 1250,
|
|
47
52
|
title: 'Total Users',
|
|
48
|
-
size: '
|
|
53
|
+
size: 'level-2',
|
|
49
54
|
},
|
|
50
55
|
};
|
|
51
56
|
|
|
@@ -54,7 +59,7 @@ export const WithSubtitle: Story = {
|
|
|
54
59
|
value: '95%',
|
|
55
60
|
title: 'Success Rate',
|
|
56
61
|
subtitle: 'Last 30 days',
|
|
57
|
-
size: '
|
|
62
|
+
size: 'level-1',
|
|
58
63
|
},
|
|
59
64
|
};
|
|
60
65
|
|
|
@@ -63,7 +68,7 @@ export const WithBorder: Story = {
|
|
|
63
68
|
value: 987,
|
|
64
69
|
title: 'Active Users',
|
|
65
70
|
showBorder: true,
|
|
66
|
-
size: '
|
|
71
|
+
size: 'level-2',
|
|
67
72
|
},
|
|
68
73
|
};
|
|
69
74
|
|
|
@@ -74,67 +79,33 @@ export const AllSizes: Story = {
|
|
|
74
79
|
<Stack gap="xl" align="center">
|
|
75
80
|
<Title order={2}>KeyInsight Size Variations</Title>
|
|
76
81
|
<Stack gap="lg" align="center">
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
<KeyInsight
|
|
98
|
-
value={1250}
|
|
99
|
-
title="Total Users"
|
|
100
|
-
subtitle="Last 30 days"
|
|
101
|
-
size="md"
|
|
102
|
-
/>
|
|
103
|
-
</div>
|
|
104
|
-
<div>
|
|
105
|
-
<Text size="sm" c="dimmed" mb="xs" ta="center">Large (lg)</Text>
|
|
106
|
-
<KeyInsight
|
|
107
|
-
value={1250}
|
|
108
|
-
title="Total Users"
|
|
109
|
-
subtitle="Last 30 days"
|
|
110
|
-
size="lg"
|
|
111
|
-
/>
|
|
112
|
-
</div>
|
|
113
|
-
<div>
|
|
114
|
-
<Text size="sm" c="dimmed" mb="xs" ta="center">Extra Large (jumbo)</Text>
|
|
115
|
-
<KeyInsight
|
|
116
|
-
value={1250}
|
|
117
|
-
title="Total Users"
|
|
118
|
-
subtitle="Last 30 days"
|
|
119
|
-
size="jumbo"
|
|
120
|
-
/>
|
|
121
|
-
</div>
|
|
122
|
-
<div>
|
|
123
|
-
<Text size="sm" c="dimmed" mb="xs" ta="center">Super Jumbo (super-jumbo)</Text>
|
|
124
|
-
<KeyInsight
|
|
125
|
-
value={1250}
|
|
126
|
-
title="Total Users"
|
|
127
|
-
subtitle="Last 30 days"
|
|
128
|
-
size="super-jumbo"
|
|
129
|
-
/>
|
|
130
|
-
</div>
|
|
82
|
+
{([
|
|
83
|
+
['super-jumbo', 'Super Jumbo'],
|
|
84
|
+
['jumbo', 'Jumbo'],
|
|
85
|
+
['level-1', 'Level 1'],
|
|
86
|
+
['level-2', 'Level 2 (default)'],
|
|
87
|
+
['level-3', 'Level 3'],
|
|
88
|
+
['level-4', 'Level 4'],
|
|
89
|
+
['level-5', 'Level 5'],
|
|
90
|
+
['level-6', 'Level 6'],
|
|
91
|
+
] as const).map(([size, label]) => (
|
|
92
|
+
<div key={size}>
|
|
93
|
+
<Text size="sm" c="dimmed" mb="xs" ta="center">{label}</Text>
|
|
94
|
+
<KeyInsight
|
|
95
|
+
value={1250}
|
|
96
|
+
title="Total Users"
|
|
97
|
+
subtitle="Last 30 days"
|
|
98
|
+
size={size}
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
))}
|
|
131
102
|
</Stack>
|
|
132
103
|
</Stack>
|
|
133
104
|
),
|
|
134
105
|
parameters: {
|
|
135
106
|
docs: {
|
|
136
107
|
description: {
|
|
137
|
-
story: '
|
|
108
|
+
story: 'All eight KeyInsight sizes. level-1 uses the h1 type scale; pass valueAs="p" when that value must not be an h1.',
|
|
138
109
|
},
|
|
139
110
|
},
|
|
140
111
|
},
|
|
@@ -147,19 +118,19 @@ export const SizeComparison: Story = {
|
|
|
147
118
|
value="$24.5K"
|
|
148
119
|
title="Revenue"
|
|
149
120
|
subtitle="This month"
|
|
150
|
-
size="
|
|
121
|
+
size="level-3"
|
|
151
122
|
/>
|
|
152
123
|
<KeyInsight
|
|
153
124
|
value={1847}
|
|
154
125
|
title="Orders"
|
|
155
126
|
subtitle="Last 30 days"
|
|
156
|
-
size="
|
|
127
|
+
size="level-2"
|
|
157
128
|
/>
|
|
158
129
|
<KeyInsight
|
|
159
130
|
value="12.5%"
|
|
160
131
|
title="Growth"
|
|
161
132
|
subtitle="vs last month"
|
|
162
|
-
size="
|
|
133
|
+
size="level-1"
|
|
163
134
|
/>
|
|
164
135
|
</SimpleGrid>
|
|
165
136
|
),
|
|
@@ -180,27 +151,27 @@ export const DashboardExample: Story = {
|
|
|
180
151
|
<KeyInsight
|
|
181
152
|
value={1250}
|
|
182
153
|
title="Total Users"
|
|
183
|
-
size="
|
|
154
|
+
size="level-2"
|
|
184
155
|
showBorder={true}
|
|
185
156
|
/>
|
|
186
157
|
<KeyInsight
|
|
187
158
|
value={987}
|
|
188
159
|
title="Active Users"
|
|
189
160
|
subtitle="Last 7 days"
|
|
190
|
-
size="
|
|
161
|
+
size="level-2"
|
|
191
162
|
showBorder={true}
|
|
192
163
|
/>
|
|
193
164
|
<KeyInsight
|
|
194
165
|
value={263}
|
|
195
166
|
title="New Users"
|
|
196
167
|
subtitle="This month"
|
|
197
|
-
size="
|
|
168
|
+
size="level-2"
|
|
198
169
|
showBorder={true}
|
|
199
170
|
/>
|
|
200
171
|
<KeyInsight
|
|
201
172
|
value="95%"
|
|
202
173
|
title="Success Rate"
|
|
203
|
-
size="
|
|
174
|
+
size="level-2"
|
|
204
175
|
showBorder={false}
|
|
205
176
|
/>
|
|
206
177
|
</SimpleGrid>
|
|
@@ -223,36 +194,36 @@ export const MetricsGrid: Story = {
|
|
|
223
194
|
value="$24,500"
|
|
224
195
|
title="Revenue"
|
|
225
196
|
subtitle="This month"
|
|
226
|
-
size="
|
|
197
|
+
size="level-1"
|
|
227
198
|
/>
|
|
228
199
|
<KeyInsight
|
|
229
200
|
value={1847}
|
|
230
201
|
title="Orders"
|
|
231
202
|
subtitle="Last 30 days"
|
|
232
|
-
size="
|
|
203
|
+
size="level-1"
|
|
233
204
|
/>
|
|
234
205
|
<KeyInsight
|
|
235
206
|
value="12.5%"
|
|
236
207
|
title="Growth"
|
|
237
208
|
subtitle="vs last month"
|
|
238
|
-
size="
|
|
209
|
+
size="level-1"
|
|
239
210
|
/>
|
|
240
211
|
<KeyInsight
|
|
241
212
|
value={456}
|
|
242
213
|
title="New Customers"
|
|
243
|
-
size="
|
|
214
|
+
size="level-1"
|
|
244
215
|
/>
|
|
245
216
|
<KeyInsight
|
|
246
217
|
value="4.2"
|
|
247
218
|
title="Avg Rating"
|
|
248
219
|
subtitle="Customer satisfaction"
|
|
249
|
-
size="
|
|
220
|
+
size="level-1"
|
|
250
221
|
/>
|
|
251
222
|
<KeyInsight
|
|
252
223
|
value={89}
|
|
253
224
|
title="Support Tickets"
|
|
254
225
|
subtitle="Open"
|
|
255
|
-
size="
|
|
226
|
+
size="level-1"
|
|
256
227
|
/>
|
|
257
228
|
</SimpleGrid>
|
|
258
229
|
</div>
|
|
@@ -274,25 +245,25 @@ export const HorizontalLayout: Story = {
|
|
|
274
245
|
<KeyInsight
|
|
275
246
|
value={1250}
|
|
276
247
|
title="Total Users"
|
|
277
|
-
size="
|
|
248
|
+
size="level-2"
|
|
278
249
|
showBorder={true}
|
|
279
250
|
/>
|
|
280
251
|
<KeyInsight
|
|
281
252
|
value={987}
|
|
282
253
|
title="Active Users"
|
|
283
|
-
size="
|
|
254
|
+
size="level-2"
|
|
284
255
|
showBorder={true}
|
|
285
256
|
/>
|
|
286
257
|
<KeyInsight
|
|
287
258
|
value={263}
|
|
288
259
|
title="New Users"
|
|
289
|
-
size="
|
|
260
|
+
size="level-2"
|
|
290
261
|
showBorder={true}
|
|
291
262
|
/>
|
|
292
263
|
<KeyInsight
|
|
293
264
|
value="95%"
|
|
294
265
|
title="Success Rate"
|
|
295
|
-
size="
|
|
266
|
+
size="level-2"
|
|
296
267
|
showBorder={false}
|
|
297
268
|
/>
|
|
298
269
|
</Inline>
|
|
@@ -342,19 +313,19 @@ export const WithTrendIndicator: Story = {
|
|
|
342
313
|
<KeyInsight
|
|
343
314
|
value="42%"
|
|
344
315
|
title="Conversion Rate"
|
|
345
|
-
size="
|
|
316
|
+
size="level-1"
|
|
346
317
|
rightSection={<span style={{ color: 'var(--ad-color-status-success)', fontSize: 20 }}>↑</span>}
|
|
347
318
|
/>
|
|
348
319
|
<KeyInsight
|
|
349
320
|
value="12%"
|
|
350
321
|
title="Churn Rate"
|
|
351
|
-
size="
|
|
322
|
+
size="level-1"
|
|
352
323
|
rightSection={<span style={{ color: 'var(--ad-color-status-error)', fontSize: 20 }}>↓</span>}
|
|
353
324
|
/>
|
|
354
325
|
<KeyInsight
|
|
355
326
|
value="2.4M"
|
|
356
327
|
title="Annual Revenue"
|
|
357
|
-
size="
|
|
328
|
+
size="level-1"
|
|
358
329
|
leftSection={<span style={{ fontSize: 20 }}>$</span>}
|
|
359
330
|
/>
|
|
360
331
|
</Inline>
|
|
@@ -368,13 +339,30 @@ export const WithTrendIndicator: Story = {
|
|
|
368
339
|
},
|
|
369
340
|
};
|
|
370
341
|
|
|
342
|
+
export const Level1AsParagraph: Story = {
|
|
343
|
+
args: {
|
|
344
|
+
value: '12.5%',
|
|
345
|
+
title: 'Growth',
|
|
346
|
+
subtitle: 'vs last month',
|
|
347
|
+
size: 'level-1',
|
|
348
|
+
valueAs: 'p',
|
|
349
|
+
},
|
|
350
|
+
parameters: {
|
|
351
|
+
docs: {
|
|
352
|
+
description: {
|
|
353
|
+
story: 'level-1 uses the h1 type scale. valueAs="p" keeps that size without rendering an h1.',
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
|
|
371
359
|
export const Interactive: Story = {
|
|
372
360
|
args: {
|
|
373
361
|
value: 1250,
|
|
374
362
|
title: 'Total Users',
|
|
375
363
|
subtitle: 'Last 30 days',
|
|
376
364
|
showBorder: false,
|
|
377
|
-
size: '
|
|
365
|
+
size: 'level-2',
|
|
378
366
|
},
|
|
379
367
|
parameters: {
|
|
380
368
|
docs: {
|
package/dist/stories/index.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.16",
|
|
3
3
|
"stories": [
|
|
4
4
|
{
|
|
5
5
|
"title": "Design System/Buttons/ActionIcon",
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
{
|
|
273
273
|
"title": "Design System/Complex Components/KeyInsight",
|
|
274
274
|
"component": "KeyInsight",
|
|
275
|
-
"description": "KeyInsight component for displaying key metrics or insights with a title, value, and optional subtitle.
|
|
275
|
+
"description": "KeyInsight component for displaying key metrics or insights with a title, value, and optional subtitle. Sizes: super-jumbo, jumbo, and level-1 through level-6. Use valueAs=\"p\" or \"span\" when a level-1 visual size must not be an h1.",
|
|
276
276
|
"stories": [
|
|
277
277
|
"Default",
|
|
278
278
|
"WithSubtitle",
|
|
@@ -284,6 +284,7 @@
|
|
|
284
284
|
"HorizontalLayout",
|
|
285
285
|
"HeroMetrics",
|
|
286
286
|
"WithTrendIndicator",
|
|
287
|
+
"Level1AsParagraph",
|
|
287
288
|
"Interactive"
|
|
288
289
|
],
|
|
289
290
|
"file": "ComplexComponents/KeyInsight/KeyInsights.stories.tsx",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appdirect/design-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
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",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"prepublishOnly": "npm run build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@appdirect/ad-design-tokens": "0.0.
|
|
47
|
+
"@appdirect/ad-design-tokens": "0.0.16",
|
|
48
48
|
"@mantine/dropzone": "^9.6.0",
|
|
49
49
|
"@remixicon/react": "^4.6.0",
|
|
50
50
|
"@tabler/icons-react": "^3.33.0",
|