@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 @@
1
+ export { Slat } from './Slat.js';
@@ -0,0 +1,45 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React, { useState } from 'react';
4
+ import { ActionIcon } from '@mantine/core';
5
+ import { Tooltip } from '../../Overlays/Tooltip.js';
6
+ import { RiFileCopyLine } from '@remixicon/react';
7
+ /**
8
+ * CopyButton Component
9
+ *
10
+ * A reusable button component with copy-to-clipboard functionality and interactive tooltips.
11
+ * Shows "Copy" on hover and "Copied" after clicking, resetting when cursor leaves.
12
+ *
13
+ * @example
14
+ * // Basic usage
15
+ * <CopyButton
16
+ * value="Production"
17
+ * label="Environment"
18
+ * onCopy={(value) => navigator.clipboard.writeText(value)}
19
+ * />
20
+ *
21
+ * @example
22
+ * // With custom icon size
23
+ * <CopyButton
24
+ * value="sk-1234567890abcdef"
25
+ * label="API Key"
26
+ * iconSize={16}
27
+ * onCopy={(value) => {
28
+ * navigator.clipboard.writeText(value);
29
+ * console.log('API Key copied');
30
+ * }}
31
+ * />
32
+ */
33
+ export function CopyButton({ value, label, onCopy, iconSize = 24, }) {
34
+ const [isCopied, setIsCopied] = useState(false);
35
+ const handleCopy = () => {
36
+ if (onCopy) {
37
+ onCopy(value);
38
+ setIsCopied(true);
39
+ }
40
+ };
41
+ const handleMouseLeave = () => {
42
+ setIsCopied(false);
43
+ };
44
+ return (_jsx(Tooltip, { label: isCopied ? "Copied" : "Copy", position: "top", withArrow: true, children: _jsx(ActionIcon, { variant: "subtle", size: "xs", c: "blue", onClick: handleCopy, onMouseLeave: handleMouseLeave, "aria-label": `Copy ${label}`, children: _jsx(RiFileCopyLine, { size: iconSize }) }) }));
45
+ }
@@ -0,0 +1 @@
1
+ export { CopyButton } from './CopyButton.js';
@@ -0,0 +1,77 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React, { forwardRef } from 'react';
4
+ import { Alert as MantineAlert } from '@mantine/core';
5
+ import { RiInformationLine, RiCheckboxCircleLine, RiErrorWarningLine, RiTimeLine } from '@remixicon/react';
6
+ import { ALERT_TO_MANTINE_COLOR } from '../types.js';
7
+ /**
8
+ * AppDirect Design System Alert Component
9
+ *
10
+ * A semantic alert component built on top of Mantine's Alert with
11
+ * consistent design system styling and semantic color options.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * // Basic usage
16
+ * <Alert color="info" title="Information">
17
+ * This is an informational alert message.
18
+ * </Alert>
19
+ *
20
+ * // Different semantic colors
21
+ * <Alert color="success" title="Success">Operation completed successfully!</Alert>
22
+ * <Alert color="danger" title="Error">Something went wrong.</Alert>
23
+ * <Alert color="pending" title="Processing">Your request is being processed...</Alert>
24
+ * ```
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * // With close button
29
+ * <Alert
30
+ * color="info"
31
+ * title="Notification"
32
+ * withCloseButton
33
+ * onClose={() => console.log('Alert closed')}
34
+ * >
35
+ * This alert can be dismissed.
36
+ * </Alert>
37
+ *
38
+ * // With custom icon
39
+ * <Alert
40
+ * color="info"
41
+ * title="Custom Alert"
42
+ * icon={<RiStarLine size={20} />}
43
+ * >
44
+ * This alert uses a custom star icon instead of the default info icon.
45
+ * </Alert>
46
+ * ```
47
+ *
48
+ * @example
49
+ * ```tsx
50
+ * // Different semantic colors
51
+ * <Alert color="info" title="Information">Info message with light background</Alert>
52
+ * <Alert color="success" title="Success">Success message with light background</Alert>
53
+ * <Alert color="danger" title="Error">Error message with light background</Alert>
54
+ * ```
55
+ */
56
+ export const Alert = forwardRef(({ color = 'default', type, icon: customIcon, title, withCloseButton = false, onClose, children, ...props }, ref) => {
57
+ // Keep `type` as a deprecated alias while `color` becomes the primary API.
58
+ const semanticColor = color ?? type ?? 'default';
59
+ // Map semantic colors to Mantine colors and default icons
60
+ const getAlertConfig = (alertColor) => {
61
+ const icons = {
62
+ info: _jsx(RiInformationLine, { size: 20 }),
63
+ success: _jsx(RiCheckboxCircleLine, { size: 20 }),
64
+ danger: _jsx(RiErrorWarningLine, { size: 20 }),
65
+ pending: _jsx(RiTimeLine, { size: 20 }),
66
+ default: _jsx(RiInformationLine, { size: 20 }),
67
+ };
68
+ return {
69
+ color: ALERT_TO_MANTINE_COLOR[alertColor],
70
+ icon: icons[alertColor],
71
+ };
72
+ };
73
+ const { color: mantineColor, icon: defaultIcon } = getAlertConfig(semanticColor);
74
+ const alertIcon = customIcon || defaultIcon;
75
+ return (_jsx(MantineAlert, { ref: ref, variant: "light", color: mantineColor, radius: "sm", icon: alertIcon, title: title, withCloseButton: withCloseButton, onClose: onClose, ...props, children: children }));
76
+ });
77
+ Alert.displayName = 'Alert';
@@ -0,0 +1,157 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React, { forwardRef, useState, useCallback } from 'react';
4
+ import { Avatar as MantineAvatar } from '@mantine/core';
5
+ import { RiUser3Fill } from '@remixicon/react';
6
+ // ========================== CONSTANTS ==========================
7
+ // Mantine's default avatar sizes
8
+ const AVATAR_SIZES = {
9
+ xs: 16,
10
+ sm: 26,
11
+ md: 38,
12
+ lg: 56,
13
+ xl: 84,
14
+ };
15
+ // Icon sizes proportional to avatar sizes (roughly 70% of avatar size)
16
+ const ICON_SIZES = {
17
+ xs: 11,
18
+ sm: 18,
19
+ md: 27,
20
+ lg: 39,
21
+ xl: 59,
22
+ };
23
+ // ========================== COMPONENT ==========================
24
+ /**
25
+ * Avatar Component
26
+ *
27
+ * Built on top of Mantine's Avatar component with design system styling.
28
+ * Supports three variants: icon, image, and initials with all Mantine t-shirt sizes.
29
+ *
30
+ * @example
31
+ * // Icon avatar (default)
32
+ * <Avatar variant="icon" size="md" />
33
+ *
34
+ * @example
35
+ * // Image avatar
36
+ * <Avatar
37
+ * variant="image"
38
+ * src="/user-photo.jpg"
39
+ * alt="John Doe"
40
+ * size="lg"
41
+ * fallback="initials"
42
+ * fallbackInitials="JD"
43
+ * />
44
+ *
45
+ * @example
46
+ * // Initials avatar
47
+ * <Avatar
48
+ * variant="initials"
49
+ * initials="AB"
50
+ * size="xl"
51
+ * />
52
+ *
53
+ * @example
54
+ * // Custom icon
55
+ * <Avatar
56
+ * variant="icon"
57
+ * icon={<RiUserLine />}
58
+ * size="sm"
59
+ * />
60
+ */
61
+ export const Avatar = forwardRef(({ variant, size = 'md', src, alt, initials, icon, fallback = 'icon', fallbackInitials, ...props }, ref) => {
62
+ // Track image loading state
63
+ const [imageError, setImageError] = useState(false);
64
+ // Check if URL is obviously invalid
65
+ const isInvalidUrl = (url) => {
66
+ if (!url || url.trim() === '')
67
+ return true;
68
+ try {
69
+ const hostname = new URL(url, 'https://local.invalid').hostname;
70
+ if (hostname === 'example.com' || hostname.endsWith('.example.com'))
71
+ return true;
72
+ }
73
+ catch {
74
+ return true;
75
+ }
76
+ if (url.includes('broken-image'))
77
+ return true;
78
+ return false;
79
+ };
80
+ // Reset image error when src changes
81
+ React.useEffect(() => {
82
+ if (src && isInvalidUrl(src)) {
83
+ setImageError(true);
84
+ }
85
+ else {
86
+ setImageError(false);
87
+ }
88
+ }, [src]);
89
+ // Handle image load error
90
+ const handleImageError = useCallback(() => {
91
+ setImageError(true);
92
+ }, []);
93
+ if (process.env.NODE_ENV === 'development') {
94
+ // eslint-disable-next-line react-hooks/rules-of-hooks
95
+ React.useEffect(() => {
96
+ if (variant === 'image' && !src) {
97
+ console.warn('Avatar: src is required when variant is "image"');
98
+ }
99
+ if (variant === 'initials' && !initials) {
100
+ console.warn('Avatar: initials is required when variant is "initials"');
101
+ }
102
+ if (variant === 'initials' && initials && initials.length !== 2) {
103
+ console.warn('Avatar: initials should be exactly 2 characters');
104
+ }
105
+ }, [variant, src, initials]);
106
+ }
107
+ // Render icon content
108
+ const renderIcon = () => {
109
+ const iconSize = ICON_SIZES[size];
110
+ if (icon) {
111
+ return React.isValidElement(icon)
112
+ ? React.cloneElement(icon, {
113
+ size: iconSize,
114
+ color: 'var(--ad-color-text-default)',
115
+ })
116
+ : icon;
117
+ }
118
+ return _jsx(RiUser3Fill, { size: iconSize, color: "var(--ad-color-text-default)" });
119
+ };
120
+ // Render initials content
121
+ const renderInitials = (text) => {
122
+ return text.substring(0, 2).toUpperCase();
123
+ };
124
+ // Handle different variants
125
+ const getAvatarContent = () => {
126
+ switch (variant) {
127
+ case 'image':
128
+ // For image variant, always check if we should show fallback first
129
+ if (!src || imageError) {
130
+ // Show fallback content instead of trying to load image
131
+ return {
132
+ children: fallback === 'initials' && fallbackInitials
133
+ ? renderInitials(fallbackInitials)
134
+ : renderIcon(),
135
+ };
136
+ }
137
+ // Only try to load image if we have src and no error yet
138
+ return {
139
+ src: src,
140
+ alt: alt,
141
+ onError: handleImageError,
142
+ };
143
+ case 'initials':
144
+ return {
145
+ children: initials ? renderInitials(initials) : '??',
146
+ };
147
+ case 'icon':
148
+ default:
149
+ return {
150
+ children: renderIcon(),
151
+ };
152
+ }
153
+ };
154
+ const avatarContent = getAvatarContent();
155
+ return (_jsx(MantineAvatar, { ref: ref, size: AVATAR_SIZES[size], radius: 1000, ...avatarContent, ...props }));
156
+ });
157
+ Avatar.displayName = 'Avatar';
@@ -0,0 +1,78 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React, { forwardRef } from 'react';
4
+ import { Badge as MantineBadge } from '@mantine/core';
5
+ /**
6
+ * AppDirect Design System Badge Component
7
+ *
8
+ * A semantic badge component built on top of Mantine's Badge with
9
+ * consistent design system styling and restricted color options.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * // Basic usage
14
+ * <Badge>Default</Badge>
15
+ *
16
+ * // Different variants
17
+ * <Badge variant="filled" color="info">Info</Badge>
18
+ * <Badge variant="outline" color="success">Success</Badge>
19
+ * <Badge variant="filled" color="danger">Danger</Badge>
20
+ * <Badge variant="outline" color="pending">Pending</Badge>
21
+ * ```
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * // Different sizes
26
+ * <Badge size="sm" color="info">Small</Badge>
27
+ * <Badge size="md" color="success">Medium</Badge>
28
+ * <Badge size="lg" color="danger">Large</Badge>
29
+ * ```
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * // All color variants
34
+ * <Badge color="default">Default</Badge>
35
+ * <Badge color="info">Info</Badge>
36
+ * <Badge color="success">Success</Badge>
37
+ * <Badge color="danger">Danger</Badge>
38
+ * <Badge color="pending">Pending</Badge>
39
+ * ```
40
+ */
41
+ export const Badge = forwardRef(({ variant = 'filled', size = 'md', color = 'default', children, ...props }, ref) => {
42
+ // Map design system colors to Mantine colors
43
+ const getMantineColor = (dsColor, dsVariant) => {
44
+ const resolvedColor = dsColor === 'default' && ['info', 'success', 'danger', 'pending', 'warning'].includes(dsVariant || '')
45
+ ? (dsVariant === 'warning' ? 'pending' : dsVariant)
46
+ : dsColor;
47
+ switch (resolvedColor) {
48
+ case 'info':
49
+ case 'blue':
50
+ return 'blue';
51
+ case 'success':
52
+ case 'green':
53
+ return 'green';
54
+ case 'danger':
55
+ case 'red':
56
+ return 'red';
57
+ case 'pending':
58
+ case 'warning':
59
+ case 'yellow':
60
+ return 'yellow';
61
+ case 'default':
62
+ case 'gray':
63
+ return 'gray';
64
+ default:
65
+ return 'gray';
66
+ }
67
+ };
68
+ const getMantineVariant = (dsVariant) => {
69
+ switch (dsVariant) {
70
+ case 'outline':
71
+ return 'outline';
72
+ default:
73
+ return 'filled';
74
+ }
75
+ };
76
+ return (_jsx(MantineBadge, { ref: ref, variant: getMantineVariant(variant), size: size, color: getMantineColor(color, variant), radius: "sm", ...props, children: children }));
77
+ });
78
+ Badge.displayName = 'Badge';
@@ -0,0 +1,100 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React, { forwardRef } from 'react';
4
+ import { Card as MantineCard } from '@mantine/core';
5
+ import classes from './Card.module.css';
6
+ // ========================== COMPONENTS ==========================
7
+ /**
8
+ * Card.Section Component
9
+ *
10
+ * Use to create full-bleed sections within a card that extend to the edges.
11
+ * Perfect for images, headers, or other content that should span the full width.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * <Card>
16
+ * <Card.Section>
17
+ * <img src="image.jpg" alt="Full width image" />
18
+ * </Card.Section>
19
+ * <Title>Card Content</Title>
20
+ * <Text>Regular padded content</Text>
21
+ * </Card>
22
+ * ```
23
+ */
24
+ const CardSection = forwardRef(({ children, ...props }, ref) => {
25
+ return (_jsx(MantineCard.Section, { ref: ref, ...props, children: children }));
26
+ });
27
+ CardSection.displayName = 'Card.Section';
28
+ /**
29
+ * Card Component
30
+ *
31
+ * Built on top of Mantine's Card component with design system styling.
32
+ * Provides a consistent container for content with fixed styling options:
33
+ * - Shadow: xs (subtle shadow)
34
+ * - Padding: md (16px)
35
+ * - Border: always enabled
36
+ * - Radius: sm (4px)
37
+ *
38
+ * @example
39
+ * // Basic card
40
+ * <Card>
41
+ * <h3>Card Title</h3>
42
+ * <p>Card content goes here.</p>
43
+ * </Card>
44
+ *
45
+ * @example
46
+ * // Interactive card
47
+ * <Card
48
+ * interactive
49
+ * onClick={() => console.log('Card clicked')}
50
+ * >
51
+ * <h3>Clickable Card</h3>
52
+ * <p>This card responds to clicks and hover.</p>
53
+ * </Card>
54
+ *
55
+ * @example
56
+ * // Card with full bleed image
57
+ * <Card>
58
+ * <Card.Section>
59
+ * <img src="image.jpg" alt="Full width" />
60
+ * </Card.Section>
61
+ * <h3>Card Title</h3>
62
+ * <p>Content with padding</p>
63
+ * </Card>
64
+ *
65
+ * @example
66
+ * // Card with custom styling
67
+ * <Card
68
+ * style={{ backgroundColor: 'var(--ad-color-brand-light)' }}
69
+ * >
70
+ * <h3>Custom Styled Card</h3>
71
+ * <p>With custom background color.</p>
72
+ * </Card>
73
+ */
74
+ const CardRoot = forwardRef(({ interactive = false, children, onClick, style, className, ...props }, ref) => {
75
+ // Runtime validation
76
+ React.useEffect(() => {
77
+ if (interactive && !onClick) {
78
+ console.warn('Card: interactive is true but no onClick handler provided');
79
+ }
80
+ }, [interactive, onClick]);
81
+ // Determine if card should be clickable
82
+ const isClickable = Boolean(onClick);
83
+ // Build class names - add interactive/clickable classes when needed
84
+ const cardClassName = [
85
+ className,
86
+ interactive && classes.interactive,
87
+ isClickable && classes.clickable,
88
+ ].filter(Boolean).join(' ');
89
+ return (_jsx(MantineCard, { ref: ref, padding: "md", radius: "sm", shadow: "xs", withBorder: true, style: style, className: cardClassName, onClick: onClick, ...props, children: children }));
90
+ });
91
+ CardRoot.displayName = 'Card';
92
+ // ========================== COMPOUND COMPONENT ==========================
93
+ /**
94
+ * Compound Card component with Section support
95
+ */
96
+ export const Card = Object.assign(CardRoot, {
97
+ Section: CardSection,
98
+ });
99
+ // Export the Section component separately for named imports
100
+ export { CardSection };
@@ -0,0 +1,36 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React from 'react';
4
+ import { Chip as MantineChip } from '@mantine/core';
5
+ // Map semantic variants to Mantine colors
6
+ const variantToColor = {
7
+ info: 'blue',
8
+ success: 'green',
9
+ danger: 'red',
10
+ pending: 'yellow',
11
+ default: 'gray',
12
+ };
13
+ /**
14
+ * Chip component with semantic color variants and selection states.
15
+ * Built on top of Mantine's Chip component with consistent styling.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * // Basic chip
20
+ * <Chip>Default</Chip>
21
+ *
22
+ * // Colored variants
23
+ * <Chip variant="info">Info</Chip>
24
+ * <Chip variant="success">Success</Chip>
25
+ * <Chip variant="danger">Danger</Chip>
26
+ *
27
+ * // Controlled selection
28
+ * <Chip checked={selected} onChange={setSelected}>
29
+ * Toggle me
30
+ * </Chip>
31
+ * ```
32
+ */
33
+ export const Chip = ({ variant = 'default', checked, onChange, ...props }) => {
34
+ return (_jsx(MantineChip, { color: variantToColor[variant], variant: "outline", radius: "sm", checked: checked, onChange: onChange, ...props }));
35
+ };
36
+ export default Chip;
@@ -0,0 +1,59 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React, { forwardRef } from 'react';
4
+ import { Indicator as MantineIndicator } from '@mantine/core';
5
+ // ========================== COMPONENT ==========================
6
+ /**
7
+ * Indicator Component
8
+ *
9
+ * Built on top of Mantine's Indicator component with design system styling.
10
+ * Used to show notifications, status, or other supplementary information.
11
+ *
12
+ * Mantine's Indicator automatically handles:
13
+ * - Minimum size constraints (always at least a circle)
14
+ * - Pill shape when content is added (label/count)
15
+ * - Proper sizing and positioning
16
+ *
17
+ * @example
18
+ * // Basic semantic indicators (dots)
19
+ * <Indicator type="success" size={12}>
20
+ * <Avatar />
21
+ * </Indicator>
22
+ *
23
+ * @example
24
+ * // With count (pill-shaped)
25
+ * <Indicator type="danger" count={5} size={16}>
26
+ * <Button>Messages</Button>
27
+ * </Indicator>
28
+ *
29
+ * @example
30
+ * // With outline variant
31
+ * <Indicator type="info" count={12} withOutline size={20}>
32
+ * <IconBell />
33
+ * </Indicator>
34
+ *
35
+ * @example
36
+ * // Processing/animated indicator
37
+ * <Indicator type="pending" processing size={14}>
38
+ * <Avatar />
39
+ * </Indicator>
40
+ */
41
+ export const Indicator = forwardRef(({ type = 'default', color, size = 12, position = 'top-end', withBorder = false, disabled = false, processing = false, count, label, withOutline = false, children, ...props }, ref) => {
42
+ // Map semantic types to colors
43
+ const getTypeColor = (type) => {
44
+ switch (type) {
45
+ case 'success': return 'green';
46
+ case 'danger': return 'red';
47
+ case 'pending': return 'yellow';
48
+ case 'info': return 'blue';
49
+ case 'default': return 'gray';
50
+ default: return 'gray';
51
+ }
52
+ };
53
+ const indicatorColor = color || getTypeColor(type);
54
+ const indicatorLabel = label || (count !== undefined ? count.toString() : undefined);
55
+ return (_jsx(MantineIndicator, { ref: ref, color: indicatorColor, size: size, position: position, withBorder: withBorder || withOutline, disabled: disabled, processing: processing, label: indicatorLabel, ...props, children: children }));
56
+ });
57
+ Indicator.displayName = 'Indicator';
58
+ // Default export for convenience
59
+ export default Indicator;
@@ -0,0 +1,60 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React, { forwardRef } from 'react';
4
+ import { List as MantineList } from '@mantine/core';
5
+ /**
6
+ * AppDirect Design System List Component
7
+ *
8
+ * A semantic list component built on top of Mantine's List with
9
+ * consistent design system styling and spacing options.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * // Basic usage
14
+ * <List>
15
+ * <List.Item>First item</List.Item>
16
+ * <List.Item>Second item</List.Item>
17
+ * <List.Item>Third item</List.Item>
18
+ * </List>
19
+ * ```
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * // With custom icon
24
+ * <List
25
+ * icon={<IconCheck size={16} />}
26
+ * spacing="md"
27
+ * size="sm"
28
+ * >
29
+ * <List.Item>Task completed</List.Item>
30
+ * <List.Item>Another task done</List.Item>
31
+ * </List>
32
+ * ```
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * // Ordered list
37
+ * <List type="ordered" spacing="sm">
38
+ * <List.Item>Step one</List.Item>
39
+ * <List.Item>Step two</List.Item>
40
+ * <List.Item>Step three</List.Item>
41
+ * </List>
42
+ * ```
43
+ *
44
+ * @example
45
+ * ```tsx
46
+ * // Different sizes and spacing
47
+ * <List size="lg" spacing="xl">
48
+ * <List.Item>Large spaced item</List.Item>
49
+ * <List.Item>Another large item</List.Item>
50
+ * </List>
51
+ * ```
52
+ */
53
+ const ListComponent = forwardRef(({ size = 'md', spacing = 'sm', ...props }, ref) => {
54
+ return (_jsx(MantineList, { ref: ref, size: size, spacing: spacing, ...props }));
55
+ });
56
+ ListComponent.displayName = 'List';
57
+ // Create a compound component with Item attached
58
+ export const List = Object.assign(ListComponent, {
59
+ Item: MantineList.Item,
60
+ });