@appdirect/design-system 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/README.md +85 -5
  2. package/dist/Buttons/ActionIcon.js +14 -0
  3. package/dist/Buttons/Button.js +66 -0
  4. package/dist/Buttons/CloseButton.js +48 -0
  5. package/dist/Buttons/index.js +13 -0
  6. package/dist/Combobox/AutocompleteClearable.js +36 -0
  7. package/dist/Combobox/Combobox.js +28 -0
  8. package/dist/Combobox/Multiselect.js +31 -0
  9. package/dist/Combobox/SearchableSelect.js +43 -0
  10. package/dist/Combobox/Select.js +72 -0
  11. package/dist/Combobox/index.js +10 -0
  12. package/dist/ComplexComponents/DashboardWidget/DashboardWidget.js +96 -0
  13. package/dist/ComplexComponents/DashboardWidget/index.js +1 -0
  14. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.js +82 -0
  15. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/utils.js +23 -0
  16. package/dist/ComplexComponents/DataTable/CustomToolbarAlertBannerContent/index.js +23 -0
  17. package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.js +230 -0
  18. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterChip.js +30 -0
  19. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/DateRangeFilter.js +12 -0
  20. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterRenderer.js +32 -0
  21. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterSystem.js +90 -0
  22. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/MultiSelectFilter.js +43 -0
  23. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/SingleSelectFilter.js +30 -0
  24. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/index.js +39 -0
  25. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/types.js +9 -0
  26. package/dist/ComplexComponents/DataTable/CustomTopToolbar/ResultCount/index.js +31 -0
  27. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.js +42 -0
  28. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SelectFilter.js +21 -0
  29. package/dist/ComplexComponents/DataTable/CustomTopToolbar/index.js +410 -0
  30. package/dist/ComplexComponents/DataTable/DataTable.js +405 -0
  31. package/dist/ComplexComponents/DataTable/ErrorOverlay/index.js +9 -0
  32. package/dist/ComplexComponents/DataTable/SortableHeaderCell/index.js +27 -0
  33. package/dist/ComplexComponents/DataTable/index.js +1 -0
  34. package/dist/ComplexComponents/DataTable/translations/en.js +99 -0
  35. package/dist/ComplexComponents/DataTable/translations/index.js +17 -0
  36. package/dist/ComplexComponents/KeyInsight/KeyInsights.js +176 -0
  37. package/dist/ComplexComponents/KeyInsight/index.js +1 -0
  38. package/dist/ComplexComponents/NameValue/NameValue.js +94 -0
  39. package/dist/ComplexComponents/NameValue/NameValueItem.js +59 -0
  40. package/dist/ComplexComponents/NameValue/index.js +2 -0
  41. package/dist/ComplexComponents/PageContentHeader/PageContentHeader.js +92 -0
  42. package/dist/ComplexComponents/PageContentHeader/PageContentHeader.tsx +24 -34
  43. package/dist/ComplexComponents/PageContentHeader/index.js +1 -0
  44. package/dist/ComplexComponents/PageContentHeader/index.ts +0 -2
  45. package/dist/ComplexComponents/Placeholder/Placeholder.js +51 -0
  46. package/dist/ComplexComponents/Placeholder/index.js +1 -0
  47. package/dist/ComplexComponents/Slat/Slat.js +53 -0
  48. package/dist/ComplexComponents/Slat/index.js +1 -0
  49. package/dist/ComplexComponents/Utilities/CopyButton.js +45 -0
  50. package/dist/ComplexComponents/Utilities/index.js +1 -0
  51. package/dist/DataDisplay/Alert.js +77 -0
  52. package/dist/DataDisplay/Avatar.js +157 -0
  53. package/dist/DataDisplay/Badge.js +78 -0
  54. package/dist/DataDisplay/Card.js +100 -0
  55. package/dist/DataDisplay/Chip.js +36 -0
  56. package/dist/DataDisplay/Indicator.js +59 -0
  57. package/dist/DataDisplay/List.js +60 -0
  58. package/dist/DataDisplay/Pill.js +81 -0
  59. package/dist/DataDisplay/Progress.js +42 -0
  60. package/dist/DataDisplay/Table.js +38 -0
  61. package/dist/DataDisplay/ThemeIcon.js +31 -0
  62. package/dist/DataDisplay/index.js +18 -0
  63. package/dist/Inputs/Checkbox.js +62 -0
  64. package/dist/Inputs/ColorInput.js +48 -0
  65. package/dist/Inputs/DropZone.js +12 -0
  66. package/dist/Inputs/FileInput.js +77 -0
  67. package/dist/Inputs/NumberInput.js +49 -0
  68. package/dist/Inputs/Radio.js +55 -0
  69. package/dist/Inputs/RadioGroup.js +59 -0
  70. package/dist/Inputs/SegmentedControl.js +50 -0
  71. package/dist/Inputs/Slider.js +50 -0
  72. package/dist/Inputs/SliderWithLabel.js +32 -0
  73. package/dist/Inputs/Switch.js +47 -0
  74. package/dist/Inputs/TextArea.js +50 -0
  75. package/dist/Inputs/TextInput.js +87 -0
  76. package/dist/Inputs/index.js +27 -0
  77. package/dist/Layout/Box.js +39 -0
  78. package/dist/Layout/Center.js +11 -0
  79. package/dist/Layout/Container.js +11 -0
  80. package/dist/Layout/Flex.js +12 -0
  81. package/dist/Layout/Grid.js +13 -0
  82. package/dist/Layout/Group.js +14 -0
  83. package/dist/Layout/Inline.js +46 -0
  84. package/dist/Layout/SimpleGrid.js +14 -0
  85. package/dist/Layout/Stack.js +45 -0
  86. package/dist/Layout/index.js +10 -0
  87. package/dist/Misc/Divider.js +8 -0
  88. package/dist/Misc/Paper.js +24 -0
  89. package/dist/Misc/index.js +10 -0
  90. package/dist/Navigation/Breadcrumb.js +60 -0
  91. package/dist/Navigation/NavLink.js +28 -0
  92. package/dist/Navigation/Stepper.js +8 -0
  93. package/dist/Navigation/Tabs.js +22 -0
  94. package/dist/Navigation/index.js +9 -0
  95. package/dist/Overlays/Drawer.js +63 -0
  96. package/dist/Overlays/Menu.js +85 -0
  97. package/dist/Overlays/Modal.js +61 -0
  98. package/dist/Overlays/Popover.js +118 -0
  99. package/dist/Overlays/Tooltip.js +71 -0
  100. package/dist/Overlays/index.js +12 -0
  101. package/dist/Shell/AppShellLayout.js +13 -0
  102. package/dist/Shell/HeaderBar.js +8 -0
  103. package/dist/Shell/SidebarNav.js +9 -0
  104. package/dist/Shell/SidebarNavLink.js +17 -0
  105. package/dist/Shell/SingleColumnLayout.js +11 -0
  106. package/dist/Shell/TertiaryColumnLayout.js +12 -0
  107. package/dist/Shell/index.js +6 -0
  108. package/dist/Typography/Code.js +8 -0
  109. package/dist/Typography/Kbd.js +58 -0
  110. package/dist/Typography/Text.js +8 -0
  111. package/dist/Typography/Title.js +11 -0
  112. package/dist/Typography/index.js +12 -0
  113. package/dist/config.js +202 -0
  114. package/dist/contracts/PageContentHeader.json +10 -5
  115. package/dist/contracts/index.json +1 -1
  116. package/dist/hooks/useTableHandlers.js +136 -0
  117. package/dist/hooks/useTableRenderFunctions.js +164 -0
  118. package/dist/hooks/useTableState.js +70 -0
  119. package/dist/index.js +162 -0
  120. package/dist/index.ts +3 -4
  121. package/dist/stories/Buttons/ActionIcon.stories.tsx +159 -0
  122. package/dist/stories/Buttons/Button.stories.tsx +145 -0
  123. package/dist/stories/Buttons/CloseButton.stories.tsx +121 -0
  124. package/dist/stories/Combobox/AutocompleteClearable.stories.tsx +554 -0
  125. package/dist/stories/Combobox/Combobox.stories.tsx +106 -0
  126. package/dist/stories/Combobox/Multiselect.stories.tsx +664 -0
  127. package/dist/stories/Combobox/SearchableSelect.stories.tsx +640 -0
  128. package/dist/stories/Combobox/Select.stories.tsx +311 -0
  129. package/dist/stories/ComplexComponents/DashboardWidget/DashboardWidget.stories.tsx +822 -0
  130. package/dist/stories/ComplexComponents/DataTable/DataTable.stories.tsx +502 -0
  131. package/dist/stories/ComplexComponents/KeyInsight/KeyInsights.stories.tsx +386 -0
  132. package/dist/stories/ComplexComponents/NameValue/NameValue.stories.tsx +405 -0
  133. package/dist/stories/ComplexComponents/PageContentHeader/PageContentHeader.stories.tsx +527 -0
  134. package/dist/stories/ComplexComponents/Placeholder/Placeholder.stories.tsx +76 -0
  135. package/dist/stories/ComplexComponents/Slat/Slat.stories.tsx +79 -0
  136. package/dist/stories/ComplexComponents/Utilities/CopyButton.stories.tsx +479 -0
  137. package/dist/stories/DataDisplay/Alert.stories.tsx +296 -0
  138. package/dist/stories/DataDisplay/Avatar.stories.tsx +251 -0
  139. package/dist/stories/DataDisplay/Badge.stories.tsx +176 -0
  140. package/dist/stories/DataDisplay/Card.stories.tsx +406 -0
  141. package/dist/stories/DataDisplay/Chip.stories.tsx +495 -0
  142. package/dist/stories/DataDisplay/Indicator.stories.tsx +571 -0
  143. package/dist/stories/DataDisplay/List.stories.tsx +376 -0
  144. package/dist/stories/DataDisplay/Pill.stories.tsx +506 -0
  145. package/dist/stories/DataDisplay/Progress.stories.tsx +352 -0
  146. package/dist/stories/DataDisplay/Table.stories.tsx +346 -0
  147. package/dist/stories/DataDisplay/ThemeIcon.stories.tsx +125 -0
  148. package/dist/stories/Inputs/Checkbox.stories.tsx +263 -0
  149. package/dist/stories/Inputs/ColorInput.stories.tsx +434 -0
  150. package/dist/stories/Inputs/DropZone.stories.tsx +401 -0
  151. package/dist/stories/Inputs/FileInput.stories.tsx +383 -0
  152. package/dist/stories/Inputs/NumberInput.stories.tsx +342 -0
  153. package/dist/stories/Inputs/Radio.stories.tsx +437 -0
  154. package/dist/stories/Inputs/RadioGroup.stories.tsx +526 -0
  155. package/dist/stories/Inputs/SegmentedControl.stories.tsx +60 -0
  156. package/dist/stories/Inputs/Slider.stories.tsx +22 -0
  157. package/dist/stories/Inputs/SliderWithLabel.stories.tsx +37 -0
  158. package/dist/stories/Inputs/Switch.stories.tsx +361 -0
  159. package/dist/stories/Inputs/TextArea.stories.tsx +355 -0
  160. package/dist/stories/Inputs/TextInput.stories.tsx +266 -0
  161. package/dist/stories/Misc/Divider.stories.tsx +581 -0
  162. package/dist/stories/Misc/Paper.stories.tsx +557 -0
  163. package/dist/stories/Navigation/Breadcrumb.stories.tsx +489 -0
  164. package/dist/stories/Navigation/NavLink.stories.tsx +601 -0
  165. package/dist/stories/Navigation/Stepper.stories.tsx +413 -0
  166. package/dist/stories/Navigation/Tabs.stories.tsx +528 -0
  167. package/dist/stories/Overlays/Drawer.stories.tsx +802 -0
  168. package/dist/stories/Overlays/Menu.stories.tsx +941 -0
  169. package/dist/stories/Overlays/Modal.stories.tsx +249 -0
  170. package/dist/stories/Overlays/Popover.stories.tsx +780 -0
  171. package/dist/stories/Overlays/Tooltip.stories.tsx +52 -0
  172. package/dist/stories/Typography/Code.stories.tsx +368 -0
  173. package/dist/stories/Typography/Kbd.stories.tsx +514 -0
  174. package/dist/stories/Typography/Text.stories.tsx +117 -0
  175. package/dist/stories/Typography/Title.stories.tsx +112 -0
  176. package/dist/stories/index.json +1435 -0
  177. package/dist/types.js +127 -0
  178. package/package.json +12 -7
  179. package/dist/ComplexComponents/PageContentHeader/DescriptionBlock.tsx +0 -65
@@ -0,0 +1,176 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React from 'react';
4
+ import { Box } from '../../Layout/Box.js';
5
+ import { Text } from '../../Typography/Text.js';
6
+ import { Title } from '../../Typography/Title.js';
7
+ import { Inline } from '../../Layout/Inline.js';
8
+ // Size mappings for different elements
9
+ const sizeConfig = {
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
+ },
76
+ };
77
+ /**
78
+ * KeyInsight Component
79
+ *
80
+ * A reusable component for displaying key metrics or insights with a title, value, and optional subtitle.
81
+ * Commonly used in dashboards, analytics pages, or summary sections.
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>
109
+ *
110
+ * @example
111
+ * // With a trend indicator next to the value
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>
170
+ */
171
+ export function KeyInsight({ value, title, subtitle, showBorder = false, size = 'md', leftSection, rightSection, }) {
172
+ const config = sizeConfig[size];
173
+ return (_jsxs(Box, { ta: "center", p: config.padding, style: {
174
+ borderRight: showBorder ? '1px solid var(--ad-color-border-subtle)' : undefined
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 }))] }));
176
+ }
@@ -0,0 +1 @@
1
+ export { KeyInsight } from './KeyInsights.js';
@@ -0,0 +1,94 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React from 'react';
4
+ import { SimpleGrid } from '../../Layout/SimpleGrid.js';
5
+ import { Stack } from '../../Layout/Stack.js';
6
+ import { NameValueItem } from './NameValueItem.js';
7
+ /**
8
+ * NameValue Component
9
+ *
10
+ * A component for displaying name-value pairs in vertical layout.
11
+ * Can be arranged in a grid format for multiple pairs using the columns prop.
12
+ * Perfect for metadata display, specifications, statistics, or any key-value information.
13
+ *
14
+ * @example
15
+ * // Single name-value pair with the default copy action
16
+ * <NameValue
17
+ * name="API Key"
18
+ * value="sk-1234567890abcdef"
19
+ * valueColor="green"
20
+ * action={{ onClick: (value) => navigator.clipboard.writeText(value) }}
21
+ * />
22
+ *
23
+ * @example
24
+ * // Multiple pairs with selective copy actions
25
+ * const userInfo = [
26
+ * { name: "Name", value: "John Doe" },
27
+ * { name: "Email", value: "john@example.com", action: { onClick: (v) => navigator.clipboard.writeText(v) } },
28
+ * { name: "User ID", value: "usr_123456", action: { onClick: (v) => navigator.clipboard.writeText(v) } },
29
+ * { name: "Last Login", value: "2 hours ago" }
30
+ * ];
31
+ *
32
+ * <NameValue
33
+ * pairs={userInfo}
34
+ * spacing="md"
35
+ * />
36
+ *
37
+ * @example
38
+ * // Status values as badges
39
+ * const serverInfo = [
40
+ * { name: "Status", value: "Running", valueAsBadge: true },
41
+ * { name: "IP Address", value: "192.168.1.100", action: { onClick: (v) => navigator.clipboard.writeText(v) } },
42
+ * { name: "Port", value: "8080" },
43
+ * { name: "Uptime", value: "15 days" },
44
+ * ];
45
+ *
46
+ * <NameValue
47
+ * pairs={serverInfo}
48
+ * columns={3}
49
+ * spacing="sm"
50
+ * />
51
+ *
52
+ * @example
53
+ * // All values copyable by default, with a custom action icon for one
54
+ * const credentials = [
55
+ * { name: "Username", value: "admin" },
56
+ * { name: "Password", value: "secret123" },
57
+ * { name: "Token", value: "eyJhbGciOiJIUzI1NiIs..." },
58
+ * { name: "Database URL", value: "postgresql://localhost:5432/db", action: { icon: <RiEditLine size={16} />, onClick: openEditDialog, label: "Edit" } },
59
+ * ];
60
+ *
61
+ * <NameValue
62
+ * pairs={credentials}
63
+ * action={{ onClick: (value) => navigator.clipboard.writeText(value) }}
64
+ * columns={2}
65
+ * />
66
+ */
67
+ export function NameValue({ name, value, pairs, columns, labelSize = 'xs', valueSize = 'sm', spacing = 'sm', nameColor = 'dimmed', valueColor, valueWeight = 500, valueAsBadge = false, action, }) {
68
+ // Create pairs array from individual props if provided
69
+ const allPairs = pairs || (name && value ? [{ name, value, valueAsBadge, action }] : []);
70
+ if (allPairs.length === 0) {
71
+ return null;
72
+ }
73
+ // Render a single name-value pair using NameValueItem
74
+ const renderPair = (pair, index) => {
75
+ const itemProps = {
76
+ name: pair.name,
77
+ value: pair.value,
78
+ labelSize,
79
+ valueSize,
80
+ nameColor,
81
+ valueColor: pair.valueColor || valueColor,
82
+ valueWeight: pair.valueWeight || valueWeight,
83
+ valueAsBadge: pair.valueAsBadge ?? valueAsBadge,
84
+ action: pair.action ?? action,
85
+ };
86
+ return _jsx(NameValueItem, { ...itemProps }, index);
87
+ };
88
+ // Use equal-width grid layout if columns prop is provided
89
+ if (columns) {
90
+ return (_jsx(SimpleGrid, { cols: columns, spacing: 0, children: allPairs.map((pair, index) => renderPair(pair, index)) }));
91
+ }
92
+ // Default: render all pairs in a vertical stack
93
+ return (_jsx(Stack, { gap: spacing, children: allPairs.map((pair, index) => renderPair(pair, index)) }));
94
+ }
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { Inline } from '../../Layout/Inline.js';
4
+ import { Stack } from '../../Layout/Stack.js';
5
+ import { Text } from '../../Typography/Text.js';
6
+ import { Badge } from '../../DataDisplay/Badge.js';
7
+ import { ActionIcon } from '../../Buttons/ActionIcon.js';
8
+ import { Tooltip } from '../../Overlays/Tooltip.js';
9
+ import { RiFileCopyLine } from '@remixicon/react';
10
+ /**
11
+ * NameValueItem Component
12
+ *
13
+ * A component for displaying a single name-value pair with an optional
14
+ * icon-triggered action (copy-to-clipboard by default, or any icon the
15
+ * designer assigns). Designed to be used within the NameValue component or
16
+ * as a standalone item.
17
+ *
18
+ * @example
19
+ * // Basic name-value pair
20
+ * <NameValueItem
21
+ * name="Status"
22
+ * value="Active"
23
+ * />
24
+ *
25
+ * @example
26
+ * // With the default copy action
27
+ * <NameValueItem
28
+ * name="API Key"
29
+ * value="sk-1234567890abcdef"
30
+ * valueColor="green"
31
+ * action={{ onClick: (value) => navigator.clipboard.writeText(value) }}
32
+ * />
33
+ *
34
+ * @example
35
+ * // With a custom action icon
36
+ * <NameValueItem
37
+ * name="Server Name"
38
+ * value="prod-web-01"
39
+ * action={{ icon: <RiEditLine size={16} />, onClick: openEditDialog, label: 'Edit' }}
40
+ * />
41
+ *
42
+ * @example
43
+ * // Value as a badge
44
+ * <NameValueItem name="Status" value="Active" valueAsBadge />
45
+ *
46
+ * @example
47
+ * // Custom styling
48
+ * <NameValueItem
49
+ * name="Revenue"
50
+ * value="$125,430"
51
+ * labelSize="sm"
52
+ * valueSize="lg"
53
+ * valueColor="green"
54
+ * valueWeight="bold"
55
+ * />
56
+ */
57
+ export function NameValueItem({ name, value, labelSize = 'xs', valueSize = 'sm', nameColor = 'dimmed', valueColor, valueWeight = 500, valueAsBadge = false, action, }) {
58
+ return (_jsxs(Stack, { gap: 0, p: "xs", children: [_jsx(Text, { size: labelSize, c: nameColor, children: name }), _jsxs(Inline, { gap: "xs", align: "center", children: [valueAsBadge ? (_jsx(Badge, { size: valueSize, variant: "outline", color: "default", children: value })) : (_jsx(Text, { size: valueSize, fw: valueWeight, c: valueColor, children: value })), action && (_jsx(Tooltip, { label: action.label ?? 'Copy', position: "top", withArrow: true, children: _jsx(ActionIcon, { variant: "link", color: "gray", size: "xs", onClick: () => action.onClick(value), "aria-label": action.label ?? `Action for ${name}`, children: action.icon ?? _jsx(RiFileCopyLine, { size: action.iconSize ?? 16 }) }) }))] })] }));
59
+ }
@@ -0,0 +1,2 @@
1
+ export { NameValue } from './NameValue.js';
2
+ export { NameValueItem } from './NameValueItem.js';
@@ -0,0 +1,92 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React from 'react';
4
+ import { Collapse, rem } from '@mantine/core';
5
+ import { Box } from '../../Layout/Box.js';
6
+ import { SimpleGrid } from '../../Layout/SimpleGrid.js';
7
+ import { Inline } from '../../Layout/Inline.js';
8
+ import { Stack } from '../../Layout/Stack.js';
9
+ import { Button } from '../../Buttons/Button.js';
10
+ import { ActionIcon } from '../../Buttons/ActionIcon.js';
11
+ import { Badge } from '../../DataDisplay/Badge.js';
12
+ import { ThemeIcon } from '../../DataDisplay/ThemeIcon.js';
13
+ import { Text } from '../../Typography/Text.js';
14
+ import { Title } from '../../Typography/Title.js';
15
+ import { Card } from '../../DataDisplay/Card.js';
16
+ import { Alert } from '../../DataDisplay/Alert.js';
17
+ import { useDisclosure } from '@mantine/hooks';
18
+ import { RiEditLine, RiArrowDownSLine, RiArrowUpSLine } from '@remixicon/react';
19
+ import { KeyInsight } from '../KeyInsight/index.js';
20
+ import { NameValue } from '../NameValue/index.js';
21
+ // ========================== CONSTANTS ==========================
22
+ const ICON_STYLES = {
23
+ width: rem(58),
24
+ height: rem(58),
25
+ minWidth: rem(58),
26
+ minHeight: rem(58),
27
+ borderColor: 'var(--ad-color-border-strong)',
28
+ };
29
+ // ========================== COMPONENT ==========================
30
+ export function PageContentHeader({
31
+ // Header props
32
+ subhead, title, badge, icon, iconSize = 44, iconContainerSize = 58, editable = false, onEdit,
33
+ // Action props
34
+ actions = [],
35
+ // Panel notification props
36
+ panelNotification = false, panelNotificationMessage,
37
+ // Content props
38
+ contentSection, insights = [], descriptionTitle, description, allowLinks = false, nameValuePairs = [], nameValueColumns = 2, drawerContent, drawerLabel = 'Show More', drawerLabelOpen = 'Show Less', defaultDrawerOpen = false,
39
+ // Styling props
40
+ cardProps = {}, spacing = 'sm', }) {
41
+ const [drawerOpened, { toggle: toggleDrawer }] = useDisclosure(defaultDrawerOpen);
42
+ // ==================== RENDER FUNCTIONS ==========================
43
+ const renderHeader = () => (_jsx(Inline, { justify: "space-between", align: "flex-start", children: _jsxs(Inline, { gap: "xs", align: "flex-start", children: [icon && (_jsx(ThemeIcon, { variant: "outline", c: "gray.9", size: "xxl", radius: "md", style: {
44
+ ...ICON_STYLES,
45
+ width: rem(iconContainerSize),
46
+ height: rem(iconContainerSize),
47
+ minWidth: rem(iconContainerSize),
48
+ minHeight: rem(iconContainerSize),
49
+ }, children: typeof icon === 'string' ? (_jsx("i", { className: icon, style: { fontSize: iconSize } })) : React.isValidElement(icon) && icon.type === 'i' ? (React.cloneElement(icon, {
50
+ style: { ...(icon.props.style || {}), fontSize: iconSize }
51
+ })) : (React.cloneElement(icon, { size: iconSize })) })), _jsxs(Stack, { gap: "0", align: "flex-start", children: [subhead && (_jsxs(Inline, { justify: "flex-start", align: "center", gap: "xs", children: [_jsx(Text, { size: "md", children: subhead }), badge && (_jsx(Badge, { size: "md", variant: "outline", color: "default", children: badge }))] })), _jsxs(Inline, { gap: "xs", align: "center", children: [_jsx(Title, { order: 3, children: title }), editable && (_jsx(ActionIcon, { size: "sm", onClick: onEdit, "aria-label": "Edit title", style: { marginLeft: rem(4) }, children: _jsx(RiEditLine, { size: 16 }) }))] })] })] }) }));
52
+ const renderActions = () => {
53
+ if (actions.length === 0)
54
+ return null;
55
+ return (_jsx(Inline, { gap: "sm", children: actions.map((action, index) => (_jsx(Button, { variant: action.variant || 'default', onClick: action.onClick, size: "sm", children: action.label }, index))) }));
56
+ };
57
+ const renderKeyInsights = () => (_jsx(Box, { p: 0, children: _jsx(SimpleGrid, { cols: insights.length, spacing: "sm", children: insights.map((insight, index) => (_jsx(KeyInsight, { value: insight.value, title: insight.title, subtitle: insight.subtitle, showBorder: index < insights.length - 1 }, index))) }) }));
58
+ const renderDescription = () => {
59
+ if (!description && !descriptionTitle)
60
+ return null;
61
+ return (_jsx(Box, { p: spacing, children: _jsxs(Stack, { gap: "xs", children: [descriptionTitle && (_jsx(Title, { order: 5, children: descriptionTitle })), allowLinks ? (_jsx(Text, { size: "sm", c: "dimmed", style: { lineHeight: 1.6 }, children: _jsx("div", { dangerouslySetInnerHTML: { __html: description || '' } }) })) : (_jsx(Text, { size: "sm", c: "dimmed", style: { lineHeight: 1.6 }, children: description }))] }) }));
62
+ };
63
+ const renderNameValuePairs = () => (_jsx(Box, { p: spacing, children: _jsx(NameValue, { pairs: nameValuePairs, columns: nameValueColumns, spacing: "md", labelSize: "xs", valueSize: "sm" }) }));
64
+ const renderDrawer = () => (_jsx(Box, { p: 0, children: _jsxs(Stack, { gap: 0, children: [_jsx(Collapse, { expanded: drawerOpened, children: _jsx(Box, { p: spacing, style: {
65
+ backgroundColor: 'white', // Light blue background when open
66
+ }, children: drawerContent }) }), _jsx(Button, { onClick: toggleDrawer, rightSection: drawerOpened ? _jsx(RiArrowUpSLine, { size: 16 }) : _jsx(RiArrowDownSLine, { size: 16 }), fullWidth: true, size: "sm", style: {
67
+ border: drawerOpened ? '1px solid var(--ad-color-border-default)' : 'none',
68
+ borderRadius: 0,
69
+ backgroundColor: drawerOpened
70
+ ? 'var(--ad-color-brand-light)'
71
+ : 'var(--ad-color-bg-subtle)',
72
+ color: 'var(--ad-color-text-default)',
73
+ transition: 'background-color 0.2s ease',
74
+ }, children: drawerOpened ? drawerLabelOpen : drawerLabel })] }) }));
75
+ const renderContentSection = () => {
76
+ switch (contentSection) {
77
+ case 'insights':
78
+ return renderKeyInsights();
79
+ case 'description':
80
+ return renderDescription();
81
+ case 'nameValuePairs':
82
+ return renderNameValuePairs();
83
+ case 'drawer':
84
+ return renderDrawer();
85
+ default:
86
+ return null;
87
+ }
88
+ };
89
+ // ==================== MAIN RENDER ==========================
90
+ const contentSection_ = renderContentSection();
91
+ return (_jsxs(Card, { pb: contentSection_ ? 0 : undefined, ...cardProps, children: [_jsxs(Stack, { gap: spacing, children: [_jsx(Box, { children: renderHeader() }), actions.length > 0 && (_jsx(Box, { children: renderActions() })), panelNotification && (_jsx(Alert, { color: "info", children: panelNotificationMessage }))] }), contentSection_ && (_jsx(Card.Section, { withBorder: true, mt: "md", children: contentSection_ }))] }));
92
+ }
@@ -13,15 +13,15 @@ import { ThemeIcon } from '../../DataDisplay/ThemeIcon';
13
13
  import { Text } from '../../Typography/Text';
14
14
  import { Title } from '../../Typography/Title';
15
15
  import { Card } from '../../DataDisplay/Card';
16
+ import { Alert } from '../../DataDisplay/Alert';
16
17
  import { useDisclosure } from '@mantine/hooks';
17
18
  import { RiEditLine, RiArrowDownSLine, RiArrowUpSLine } from '@remixicon/react';
18
19
  import { KeyInsight, KeyInsightProps } from '../KeyInsight';
19
20
  import { NameValue, NameValuePair } from '../NameValue';
20
- import { DescriptionBlock } from './DescriptionBlock';
21
21
 
22
22
  // ========================== TYPES ==========================
23
23
 
24
- export type ContentSection = 'insights' | 'description' | 'descriptionBlock' | 'nameValuePairs' | 'drawer';
24
+ export type ContentSection = 'insights' | 'description' | 'nameValuePairs' | 'drawer';
25
25
 
26
26
  export interface PageContentHeaderProps {
27
27
  // ==================== HEADER SECTION ====================
@@ -51,10 +51,16 @@ export interface PageContentHeaderProps {
51
51
  variant?: 'primary' | 'secondary' | 'default' | 'disabled' | 'link' | 'secret' | 'outline' | 'danger';
52
52
  }>;
53
53
 
54
+ // ==================== PANEL NOTIFICATION ====================
55
+ /** Whether to show a panel notification banner below the header */
56
+ panelNotification?: boolean;
57
+ /** Content for the panel notification (ignored when panelNotification is false) */
58
+ panelNotificationMessage?: React.ReactNode;
59
+
54
60
  // ==================== CONTENT SECTIONS (MUTUALLY EXCLUSIVE) ====================
55
- /** Which content section to display. Content sections bleed to edges like Card.Section */
56
- contentSection: ContentSection;
57
-
61
+ /** Which content section to display, if any. Content sections bleed to edges like Card.Section */
62
+ contentSection?: ContentSection;
63
+
58
64
  // Key Insights Section
59
65
  /** Array of key insights to display */
60
66
  insights?: Omit<KeyInsightProps, 'showBorder'>[];
@@ -66,15 +72,7 @@ export interface PageContentHeaderProps {
66
72
  description?: string;
67
73
  /** Whether description supports markdown/links */
68
74
  allowLinks?: boolean;
69
-
70
- // DescriptionBlock Section
71
- /** Title for the description block */
72
- descriptionBlockTitle?: string;
73
- /** Description text for the description block */
74
- descriptionBlockText?: string;
75
- /** Whether description block supports HTML/links */
76
- descriptionBlockAllowHtml?: boolean;
77
-
75
+
78
76
  // Name Value Pairs Section
79
77
  /** Array of name-value pairs */
80
78
  nameValuePairs?: NameValuePair[];
@@ -123,16 +121,17 @@ export function PageContentHeader({
123
121
 
124
122
  // Action props
125
123
  actions = [],
126
-
124
+
125
+ // Panel notification props
126
+ panelNotification = false,
127
+ panelNotificationMessage,
128
+
127
129
  // Content props
128
130
  contentSection,
129
131
  insights = [],
130
132
  descriptionTitle,
131
133
  description,
132
134
  allowLinks = false,
133
- descriptionBlockTitle,
134
- descriptionBlockText,
135
- descriptionBlockAllowHtml,
136
135
  nameValuePairs = [],
137
136
  nameValueColumns = 2,
138
137
  drawerContent,
@@ -272,19 +271,6 @@ export function PageContentHeader({
272
271
  );
273
272
  };
274
273
 
275
- const renderDescriptionBlock = () => {
276
- if (!descriptionBlockText) return null;
277
-
278
- // DescriptionBlock bleeds to edges - no padding wrapper
279
- return (
280
- <DescriptionBlock
281
- title={descriptionBlockTitle}
282
- description={descriptionBlockText}
283
- allowHtml={descriptionBlockAllowHtml}
284
- />
285
- );
286
- };
287
-
288
274
  const renderNameValuePairs = () => (
289
275
  <Box p={spacing}>
290
276
  <NameValue
@@ -342,8 +328,6 @@ export function PageContentHeader({
342
328
  return renderKeyInsights();
343
329
  case 'description':
344
330
  return renderDescription();
345
- case 'descriptionBlock':
346
- return renderDescriptionBlock();
347
331
  case 'nameValuePairs':
348
332
  return renderNameValuePairs();
349
333
  case 'drawer':
@@ -370,8 +354,14 @@ export function PageContentHeader({
370
354
  {renderActions()}
371
355
  </Box>
372
356
  )}
357
+ {/* Panel notification */}
358
+ {panelNotification && (
359
+ <Alert color="info">
360
+ {panelNotificationMessage}
361
+ </Alert>
362
+ )}
373
363
  </Stack>
374
-
364
+
375
365
  {/* Content Section - uses Card.Section to bleed to edges */}
376
366
  {contentSection_ && (
377
367
  <Card.Section withBorder mt="md">
@@ -0,0 +1 @@
1
+ export { PageContentHeader } from './PageContentHeader.js';
@@ -1,4 +1,2 @@
1
1
  export { PageContentHeader } from './PageContentHeader';
2
2
  export type { PageContentHeaderProps, ContentSection } from './PageContentHeader';
3
- export { DescriptionBlock } from './DescriptionBlock';
4
- export type { DescriptionBlockProps } from './DescriptionBlock';
@@ -0,0 +1,51 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React from 'react';
4
+ import { ThemeIcon } from '../../DataDisplay/ThemeIcon.js';
5
+ import { Title } from '../../Typography/Title.js';
6
+ import { Text } from '../../Typography/Text.js';
7
+ import { Button } from '../../Buttons/Button.js';
8
+ import { Stack } from '../../Layout/Stack.js';
9
+ import { Inline } from '../../Layout/Inline.js';
10
+ const titleOrderBySize = {
11
+ sm: 5, // h5, 16px
12
+ md: 4, // h4, 18px
13
+ lg: 3, // h3, 22px
14
+ };
15
+ const descriptionSizeBySize = {
16
+ sm: 'sm',
17
+ md: 'md',
18
+ lg: 'lg',
19
+ };
20
+ const actionSizeBySize = {
21
+ sm: 'xs',
22
+ md: 'sm',
23
+ lg: 'md',
24
+ };
25
+ /**
26
+ * Placeholder Component
27
+ *
28
+ * An empty-state message: icon, title, optional description, and up to two
29
+ * link-style actions. All typography reuses the existing heading/body scale
30
+ * directly (headings h3/h4/h5, Text sm/md/lg) — no new tokens needed. The
31
+ * icon is a fixed ThemeIcon size (lg, 34px) regardless of the placeholder's
32
+ * own size, matching the live Figma design.
33
+ *
34
+ * @example
35
+ * <Placeholder
36
+ * icon={<RiErrorWarningLine size={24} />}
37
+ * title="This is the Title"
38
+ * description="This is the optional description of the placeholder"
39
+ * actions={[
40
+ * { label: 'Button One', onClick: () => {} },
41
+ * { label: 'Button Two', onClick: () => {} },
42
+ * ]}
43
+ * />
44
+ *
45
+ * @example
46
+ * // Large size, no description or actions
47
+ * <Placeholder icon={<RiInboxLine size={24} />} title="No results found" size="lg" />
48
+ */
49
+ export function Placeholder({ icon, title, description, actions = [], size = 'sm', }) {
50
+ return (_jsxs(Stack, { align: "center", gap: "md", p: "xl", children: [icon && (_jsx(ThemeIcon, { variant: "default", size: "lg", children: icon })), _jsxs(Stack, { align: "center", gap: 0, ta: "center", children: [_jsx(Title, { order: titleOrderBySize[size], children: title }), description && (_jsx(Text, { size: descriptionSizeBySize[size], c: "dimmed", children: description }))] }), actions.length > 0 && (_jsx(Inline, { gap: "xs", justify: "center", children: actions.map((action, index) => (_jsx(Button, { variant: "link", size: actionSizeBySize[size], onClick: action.onClick, children: action.label }, index))) }))] }));
51
+ }
@@ -0,0 +1 @@
1
+ export { Placeholder } from './Placeholder.js';
@@ -0,0 +1,53 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React from 'react';
4
+ import { Paper } from '../../Misc/Paper.js';
5
+ import { ThemeIcon } from '../../DataDisplay/ThemeIcon.js';
6
+ import { Indicator } from '../../DataDisplay/Indicator.js';
7
+ import { Badge } from '../../DataDisplay/Badge.js';
8
+ import { Alert } from '../../DataDisplay/Alert.js';
9
+ import { Button } from '../../Buttons/Button.js';
10
+ import { Stack, Inline, Box } from '../../Layout/index.js';
11
+ import { Title } from '../../Typography/Title.js';
12
+ import { Text } from '../../Typography/Text.js';
13
+ // Title order (h6-h2) per Slat size, matching Figma's Components/Slat/h6-h2 styles
14
+ const TITLE_ORDER_BY_SIZE = {
15
+ xs: 6,
16
+ sm: 5,
17
+ md: 4,
18
+ lg: 3,
19
+ xl: 2,
20
+ };
21
+ // Matches Indicator's own default `size` (12px). The standalone subhead
22
+ // indicator has no real child to overlay, so this box reserves the same
23
+ // footprint the dot/pill occupies, keeping it in flow instead of collapsing
24
+ // to zero size and overlapping neighboring subtitle/badge content.
25
+ const INDICATOR_DOT_SIZE = 12;
26
+ // ========================== COMPONENT ==========================
27
+ /**
28
+ * Slat Component
29
+ *
30
+ * A compact row for listing items (e.g. in a feed or list), with a leading
31
+ * icon, title/subtitle, optional status indicator or badge, a trailing
32
+ * action, and an optional notification banner below.
33
+ *
34
+ * @example
35
+ * <Slat
36
+ * title="This is the title"
37
+ * subtitle="and this is the subhead"
38
+ * icon={<RiStarLine size={16} />}
39
+ * />
40
+ *
41
+ * @example
42
+ * // With status indicator, badge, and action
43
+ * <Slat
44
+ * title="Invoice #1024"
45
+ * subtitle="Due in 3 days"
46
+ * indicator={{ variant: 'pending' }}
47
+ * badge={{ label: 'Draft', color: 'default' }}
48
+ * action={{ label: 'Review', onClick: () => {} }}
49
+ * />
50
+ */
51
+ export function Slat({ size = 'xs', icon, showIcon = true, title, subtitle, indicator, badge, action, notification, rightSection, shadow, withBorder = false, }) {
52
+ return (_jsx(Paper, { shadow: shadow, withBorder: withBorder, children: _jsxs(Stack, { gap: "xs", children: [_jsxs(Inline, { gap: "sm", align: "center", p: "sm", children: [_jsxs(Inline, { gap: "xs", align: "center", style: { flex: 1, minWidth: 0 }, children: [showIcon && icon && (_jsx(ThemeIcon, { size: size, children: icon })), _jsxs(Stack, { gap: 0, style: { flex: 1, minWidth: 0 }, children: [_jsx(Title, { order: TITLE_ORDER_BY_SIZE[size], children: title }), (subtitle || indicator || badge) && (_jsxs(Inline, { gap: 5, align: "center", children: [subtitle && _jsx(Text, { size: size, children: subtitle }), indicator && (_jsx(Indicator, { type: indicator.variant ?? 'default', label: indicator.label, withBorder: indicator.withBorder, size: INDICATOR_DOT_SIZE, position: "middle-center", offset: 0, inline: true, children: _jsx("div", { style: { width: INDICATOR_DOT_SIZE, height: INDICATOR_DOT_SIZE } }) })), badge && (_jsx(Badge, { variant: badge.variant ?? 'outline', color: badge.color ?? 'default', children: badge.label }))] }))] })] }), action && (_jsx(Button, { variant: action.variant ?? 'default', size: size, onClick: action.onClick, children: action.label }))] }), notification && _jsx(Alert, { color: "info", children: notification }), rightSection && _jsx(Box, { children: rightSection })] }) }));
53
+ }