@appdirect/design-system 0.0.0-stage → 0.0.1
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/README.md +12 -2
- package/dist/Buttons/ActionIcon.tsx +37 -0
- package/dist/Buttons/Button.module.css +5 -0
- package/dist/Buttons/Button.tsx +124 -0
- package/dist/Buttons/CloseButton.tsx +83 -0
- package/dist/Buttons/index.ts +20 -0
- package/dist/Combobox/AutocompleteClearable.tsx +128 -0
- package/dist/Combobox/Combobox.tsx +37 -0
- package/dist/Combobox/Multiselect.tsx +158 -0
- package/dist/Combobox/SearchableSelect.tsx +131 -0
- package/dist/Combobox/Select.tsx +154 -0
- package/dist/Combobox/index.ts +20 -0
- package/dist/ComplexComponents/DashboardWidget/DashboardWidget.tsx +280 -0
- package/dist/ComplexComponents/DashboardWidget/index.ts +2 -0
- package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.tsx +177 -0
- package/dist/ComplexComponents/DataTable/CustomBottomToolbar/utils.ts +35 -0
- package/dist/ComplexComponents/DataTable/CustomToolbarAlertBannerContent/index.tsx +74 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.tsx +358 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterChip.tsx +48 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/DateRangeFilter.tsx +26 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterRenderer.tsx +71 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterSystem.tsx +158 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/MultiSelectFilter.tsx +79 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/SingleSelectFilter.tsx +65 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/index.ts +70 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/types.ts +140 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/ResultCount/index.tsx +76 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.tsx +73 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/SelectFilter.tsx +50 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/index.tsx +788 -0
- package/dist/ComplexComponents/DataTable/DataTable.tsx +582 -0
- package/dist/ComplexComponents/DataTable/ErrorOverlay/index.tsx +29 -0
- package/dist/ComplexComponents/DataTable/SortableHeaderCell/index.tsx +57 -0
- package/dist/ComplexComponents/DataTable/index.ts +2 -0
- package/dist/ComplexComponents/DataTable/translations/en.ts +115 -0
- package/dist/ComplexComponents/DataTable/translations/index.ts +23 -0
- package/dist/ComplexComponents/KeyInsight/KeyInsights.tsx +221 -0
- package/dist/ComplexComponents/KeyInsight/index.ts +2 -0
- package/dist/ComplexComponents/NameValue/NameValue.tsx +175 -0
- package/dist/ComplexComponents/NameValue/NameValueItem.tsx +100 -0
- package/dist/ComplexComponents/NameValue/index.ts +4 -0
- package/dist/ComplexComponents/PageContentHeader/DescriptionBlock.tsx +65 -0
- package/dist/ComplexComponents/PageContentHeader/PageContentHeader.tsx +383 -0
- package/dist/ComplexComponents/PageContentHeader/index.ts +4 -0
- package/dist/ComplexComponents/Utilities/CopyButton.tsx +82 -0
- package/dist/ComplexComponents/Utilities/index.ts +2 -0
- package/dist/DataDisplay/Alert.tsx +130 -0
- package/dist/DataDisplay/Avatar.tsx +216 -0
- package/dist/DataDisplay/Badge.tsx +119 -0
- package/dist/DataDisplay/Card.module.css +26 -0
- package/dist/DataDisplay/Card.tsx +163 -0
- package/dist/DataDisplay/Chip.tsx +66 -0
- package/dist/DataDisplay/Indicator.tsx +122 -0
- package/dist/DataDisplay/List.tsx +90 -0
- package/dist/DataDisplay/Pill.tsx +125 -0
- package/dist/DataDisplay/Progress.tsx +77 -0
- package/dist/DataDisplay/Table.tsx +57 -0
- package/dist/DataDisplay/ThemeIcon.tsx +67 -0
- package/dist/DataDisplay/index.ts +41 -0
- package/dist/Inputs/Checkbox.tsx +94 -0
- package/dist/Inputs/ColorInput.tsx +124 -0
- package/dist/Inputs/DropZone.tsx +78 -0
- package/dist/Inputs/FileInput.tsx +120 -0
- package/dist/Inputs/NumberInput.tsx +125 -0
- package/dist/Inputs/Radio.tsx +86 -0
- package/dist/Inputs/RadioGroup.tsx +90 -0
- package/dist/Inputs/SegmentedControl.tsx +64 -0
- package/dist/Inputs/Slider.tsx +69 -0
- package/dist/Inputs/Switch.tsx +67 -0
- package/dist/Inputs/TextArea.tsx +126 -0
- package/dist/Inputs/TextInput.tsx +167 -0
- package/dist/Inputs/index.ts +51 -0
- package/dist/Layout/Box.tsx +82 -0
- package/dist/Layout/Center.tsx +17 -0
- package/dist/Layout/Container.tsx +17 -0
- package/dist/Layout/Flex.tsx +18 -0
- package/dist/Layout/Grid.tsx +31 -0
- package/dist/Layout/Group.tsx +54 -0
- package/dist/Layout/Inline.tsx +86 -0
- package/dist/Layout/SimpleGrid.tsx +50 -0
- package/dist/Layout/Stack.tsx +86 -0
- package/dist/Layout/index.ts +29 -0
- package/dist/Misc/Divider.tsx +27 -0
- package/dist/Misc/Paper.tsx +47 -0
- package/dist/Misc/index.ts +15 -0
- package/dist/Navigation/Breadcrumb.tsx +138 -0
- package/dist/Navigation/NavLink.tsx +37 -0
- package/dist/Navigation/Stepper.tsx +17 -0
- package/dist/Navigation/Tabs.tsx +29 -0
- package/dist/Navigation/index.ts +17 -0
- package/dist/Overlays/Drawer.tsx +123 -0
- package/dist/Overlays/Menu.tsx +192 -0
- package/dist/Overlays/Modal.tsx +159 -0
- package/dist/Overlays/Popover.tsx +319 -0
- package/dist/Overlays/Tooltip.tsx +131 -0
- package/dist/Overlays/index.ts +19 -0
- package/dist/Shell/AppShellLayout.tsx +56 -0
- package/dist/Shell/HeaderBar.tsx +26 -0
- package/dist/Shell/SidebarNav.tsx +47 -0
- package/dist/Shell/SidebarNavLink.tsx +50 -0
- package/dist/Shell/SingleColumnLayout.tsx +22 -0
- package/dist/Shell/TertiaryColumnLayout.tsx +32 -0
- package/dist/Shell/index.ts +17 -0
- package/dist/Typography/Code.tsx +27 -0
- package/dist/Typography/Kbd.tsx +87 -0
- package/dist/Typography/Text.tsx +27 -0
- package/dist/Typography/Title.tsx +34 -0
- package/dist/Typography/index.ts +21 -0
- package/dist/bin/ds-audit.js +521 -0
- package/dist/config.ts +226 -0
- package/dist/contracts/Alert.json +80 -0
- package/dist/contracts/Badge.json +78 -0
- package/dist/contracts/Box.json +52 -0
- package/dist/contracts/Button.json +111 -0
- package/dist/contracts/DataTable.json +68 -0
- package/dist/contracts/Grid.json +35 -0
- package/dist/contracts/Group.json +44 -0
- package/dist/contracts/Inline.json +73 -0
- package/dist/contracts/PageContentHeader.json +107 -0
- package/dist/contracts/Stack.json +62 -0
- package/dist/contracts/ds-component-contract.v1.json +23 -0
- package/dist/contracts/index.json +55 -0
- package/dist/css/foundations.css +703 -0
- package/dist/css/mantine.css +1797 -0
- package/dist/hooks/useTableHandlers.ts +179 -0
- package/dist/hooks/useTableRenderFunctions.tsx +283 -0
- package/dist/hooks/useTableState.ts +81 -0
- package/dist/index.ts +210 -0
- package/dist/types.ts +202 -0
- package/package.json +56 -4
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Indicator as MantineIndicator, IndicatorProps as MantineIndicatorProps } from '@mantine/core';
|
|
5
|
+
|
|
6
|
+
// ========================== TYPES ==========================
|
|
7
|
+
|
|
8
|
+
export interface DSIndicatorProps extends Omit<MantineIndicatorProps, 'color'> {
|
|
9
|
+
/** Semantic indicator type */
|
|
10
|
+
type?: 'success' | 'danger' | 'pending' | 'info' | 'default';
|
|
11
|
+
/** Custom indicator color (overrides type) */
|
|
12
|
+
color?: string;
|
|
13
|
+
/** Indicator size in pixels */
|
|
14
|
+
size?: number;
|
|
15
|
+
/** Indicator position */
|
|
16
|
+
position?: 'top-start' | 'top-center' | 'top-end' | 'middle-start' | 'middle-center' | 'middle-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
17
|
+
/** Whether indicator should have border */
|
|
18
|
+
withBorder?: boolean;
|
|
19
|
+
/** Whether indicator should be disabled */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Whether indicator should be processing (animated) */
|
|
22
|
+
processing?: boolean;
|
|
23
|
+
/** Number to display in indicator */
|
|
24
|
+
count?: number;
|
|
25
|
+
/** Custom label inside indicator (overrides count) */
|
|
26
|
+
label?: React.ReactNode;
|
|
27
|
+
/** Whether to show outline variant */
|
|
28
|
+
withOutline?: boolean;
|
|
29
|
+
/** Child element that indicator will be attached to */
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// ========================== COMPONENT ==========================
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Indicator Component
|
|
37
|
+
*
|
|
38
|
+
* Built on top of Mantine's Indicator component with design system styling.
|
|
39
|
+
* Used to show notifications, status, or other supplementary information.
|
|
40
|
+
*
|
|
41
|
+
* Mantine's Indicator automatically handles:
|
|
42
|
+
* - Minimum size constraints (always at least a circle)
|
|
43
|
+
* - Pill shape when content is added (label/count)
|
|
44
|
+
* - Proper sizing and positioning
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* // Basic semantic indicators (dots)
|
|
48
|
+
* <Indicator type="success" size={12}>
|
|
49
|
+
* <Avatar />
|
|
50
|
+
* </Indicator>
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* // With count (pill-shaped)
|
|
54
|
+
* <Indicator type="danger" count={5} size={16}>
|
|
55
|
+
* <Button>Messages</Button>
|
|
56
|
+
* </Indicator>
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* // With outline variant
|
|
60
|
+
* <Indicator type="info" count={12} withOutline size={20}>
|
|
61
|
+
* <IconBell />
|
|
62
|
+
* </Indicator>
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* // Processing/animated indicator
|
|
66
|
+
* <Indicator type="pending" processing size={14}>
|
|
67
|
+
* <Avatar />
|
|
68
|
+
* </Indicator>
|
|
69
|
+
*/
|
|
70
|
+
export const Indicator = forwardRef<HTMLDivElement, DSIndicatorProps>(
|
|
71
|
+
({
|
|
72
|
+
type = 'default',
|
|
73
|
+
color,
|
|
74
|
+
size = 12,
|
|
75
|
+
position = 'top-end',
|
|
76
|
+
withBorder = false,
|
|
77
|
+
disabled = false,
|
|
78
|
+
processing = false,
|
|
79
|
+
count,
|
|
80
|
+
label,
|
|
81
|
+
withOutline = false,
|
|
82
|
+
children,
|
|
83
|
+
...props
|
|
84
|
+
}, ref) => {
|
|
85
|
+
|
|
86
|
+
// Map semantic types to colors
|
|
87
|
+
const getTypeColor = (type: string) => {
|
|
88
|
+
switch (type) {
|
|
89
|
+
case 'success': return 'green';
|
|
90
|
+
case 'danger': return 'red';
|
|
91
|
+
case 'pending': return 'yellow';
|
|
92
|
+
case 'info': return 'blue';
|
|
93
|
+
case 'default': return 'gray';
|
|
94
|
+
default: return 'gray';
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const indicatorColor = color || getTypeColor(type);
|
|
99
|
+
const indicatorLabel = label || (count !== undefined ? count.toString() : undefined);
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<MantineIndicator
|
|
103
|
+
ref={ref}
|
|
104
|
+
color={indicatorColor}
|
|
105
|
+
size={size}
|
|
106
|
+
position={position}
|
|
107
|
+
withBorder={withBorder || withOutline}
|
|
108
|
+
disabled={disabled}
|
|
109
|
+
processing={processing}
|
|
110
|
+
label={indicatorLabel}
|
|
111
|
+
{...props}
|
|
112
|
+
>
|
|
113
|
+
{children}
|
|
114
|
+
</MantineIndicator>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
Indicator.displayName = 'Indicator';
|
|
120
|
+
|
|
121
|
+
// Default export for convenience
|
|
122
|
+
export default Indicator;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { List as MantineList, ListProps as MantineListProps } from '@mantine/core';
|
|
5
|
+
import { ComponentSize } from '../config';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Enhanced List props extending Mantine's ListProps
|
|
9
|
+
*/
|
|
10
|
+
export interface DSListProps extends Omit<MantineListProps, 'size' | 'spacing'> {
|
|
11
|
+
/** List size from design system scale */
|
|
12
|
+
size?: ComponentSize;
|
|
13
|
+
/** Spacing between list items */
|
|
14
|
+
spacing?: ComponentSize;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* AppDirect Design System List Component
|
|
19
|
+
*
|
|
20
|
+
* A semantic list component built on top of Mantine's List with
|
|
21
|
+
* consistent design system styling and spacing options.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* // Basic usage
|
|
26
|
+
* <List>
|
|
27
|
+
* <List.Item>First item</List.Item>
|
|
28
|
+
* <List.Item>Second item</List.Item>
|
|
29
|
+
* <List.Item>Third item</List.Item>
|
|
30
|
+
* </List>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // With custom icon
|
|
36
|
+
* <List
|
|
37
|
+
* icon={<IconCheck size={16} />}
|
|
38
|
+
* spacing="md"
|
|
39
|
+
* size="sm"
|
|
40
|
+
* >
|
|
41
|
+
* <List.Item>Task completed</List.Item>
|
|
42
|
+
* <List.Item>Another task done</List.Item>
|
|
43
|
+
* </List>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* // Ordered list
|
|
49
|
+
* <List type="ordered" spacing="sm">
|
|
50
|
+
* <List.Item>Step one</List.Item>
|
|
51
|
+
* <List.Item>Step two</List.Item>
|
|
52
|
+
* <List.Item>Step three</List.Item>
|
|
53
|
+
* </List>
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* // Different sizes and spacing
|
|
59
|
+
* <List size="lg" spacing="xl">
|
|
60
|
+
* <List.Item>Large spaced item</List.Item>
|
|
61
|
+
* <List.Item>Another large item</List.Item>
|
|
62
|
+
* </List>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
const ListComponent = forwardRef<HTMLUListElement | HTMLOListElement, DSListProps>(
|
|
66
|
+
(
|
|
67
|
+
{
|
|
68
|
+
size = 'md',
|
|
69
|
+
spacing = 'sm',
|
|
70
|
+
...props
|
|
71
|
+
},
|
|
72
|
+
ref
|
|
73
|
+
) => {
|
|
74
|
+
return (
|
|
75
|
+
<MantineList
|
|
76
|
+
ref={ref as React.ComponentPropsWithRef<typeof MantineList>['ref']}
|
|
77
|
+
size={size}
|
|
78
|
+
spacing={spacing}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
ListComponent.displayName = 'List';
|
|
86
|
+
|
|
87
|
+
// Create a compound component with Item attached
|
|
88
|
+
export const List = Object.assign(ListComponent, {
|
|
89
|
+
Item: MantineList.Item,
|
|
90
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { Box, CloseButton } from '@mantine/core';
|
|
5
|
+
import { Inline } from '../Layout';
|
|
6
|
+
|
|
7
|
+
export interface DSPillProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
8
|
+
/** Pill content */
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/** Size of the pill */
|
|
11
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
+
/** Whether the pill can be removed */
|
|
13
|
+
withRemoveButton?: boolean;
|
|
14
|
+
/** Called when remove button is clicked */
|
|
15
|
+
onRemove?: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Size configurations
|
|
19
|
+
const sizeConfig = {
|
|
20
|
+
xs: {
|
|
21
|
+
height: 18,
|
|
22
|
+
fontSize: 10,
|
|
23
|
+
lineHeight: 10,
|
|
24
|
+
letterSpacing: 0.1563,
|
|
25
|
+
px: 8,
|
|
26
|
+
gap: 0,
|
|
27
|
+
closeSize: 18,
|
|
28
|
+
},
|
|
29
|
+
sm: {
|
|
30
|
+
height: 24,
|
|
31
|
+
fontSize: 11,
|
|
32
|
+
lineHeight: 12,
|
|
33
|
+
letterSpacing: 0.17,
|
|
34
|
+
px: 8,
|
|
35
|
+
gap: 6,
|
|
36
|
+
closeSize: 14,
|
|
37
|
+
},
|
|
38
|
+
md: {
|
|
39
|
+
height: 25,
|
|
40
|
+
fontSize: 14,
|
|
41
|
+
lineHeight: 14,
|
|
42
|
+
letterSpacing: 0.2184,
|
|
43
|
+
px: 11.2,
|
|
44
|
+
gap: 8,
|
|
45
|
+
closeSize: 25,
|
|
46
|
+
},
|
|
47
|
+
lg: {
|
|
48
|
+
height: 32,
|
|
49
|
+
fontSize: 13,
|
|
50
|
+
lineHeight: 14,
|
|
51
|
+
letterSpacing: 0.2,
|
|
52
|
+
px: 12,
|
|
53
|
+
gap: 8,
|
|
54
|
+
closeSize: 18,
|
|
55
|
+
},
|
|
56
|
+
xl: {
|
|
57
|
+
height: 36,
|
|
58
|
+
fontSize: 14,
|
|
59
|
+
lineHeight: 16,
|
|
60
|
+
letterSpacing: 0.22,
|
|
61
|
+
px: 14,
|
|
62
|
+
gap: 8,
|
|
63
|
+
closeSize: 20,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const Pill = forwardRef<HTMLDivElement, DSPillProps>(
|
|
68
|
+
({
|
|
69
|
+
children,
|
|
70
|
+
size = 'md',
|
|
71
|
+
withRemoveButton = false,
|
|
72
|
+
onRemove,
|
|
73
|
+
style,
|
|
74
|
+
...others
|
|
75
|
+
}, ref) => {
|
|
76
|
+
const config = sizeConfig[size];
|
|
77
|
+
|
|
78
|
+
const colors = {
|
|
79
|
+
backgroundColor: 'var(--ad-color-bg-subtle)',
|
|
80
|
+
color: 'var(--ad-color-text-dimmed)',
|
|
81
|
+
border: 'none',
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Box
|
|
86
|
+
ref={ref}
|
|
87
|
+
style={{
|
|
88
|
+
display: 'inline-flex',
|
|
89
|
+
alignItems: 'center',
|
|
90
|
+
height: config.height,
|
|
91
|
+
paddingLeft: config.px,
|
|
92
|
+
paddingRight: withRemoveButton ? 0 : config.px,
|
|
93
|
+
borderRadius: config.height / 2,
|
|
94
|
+
fontSize: config.fontSize,
|
|
95
|
+
fontWeight: 400,
|
|
96
|
+
lineHeight: `${config.lineHeight}px`,
|
|
97
|
+
letterSpacing: config.letterSpacing,
|
|
98
|
+
userSelect: 'none',
|
|
99
|
+
...colors,
|
|
100
|
+
...style,
|
|
101
|
+
}}
|
|
102
|
+
{...others}
|
|
103
|
+
>
|
|
104
|
+
<Inline gap={config.gap} wrap="nowrap">
|
|
105
|
+
<span>{children}</span>
|
|
106
|
+
{withRemoveButton && (
|
|
107
|
+
<CloseButton
|
|
108
|
+
size={config.closeSize}
|
|
109
|
+
onClick={onRemove}
|
|
110
|
+
variant="transparent"
|
|
111
|
+
style={{
|
|
112
|
+
color: 'currentColor',
|
|
113
|
+
minWidth: config.closeSize,
|
|
114
|
+
minHeight: config.closeSize,
|
|
115
|
+
}}
|
|
116
|
+
aria-label="Remove"
|
|
117
|
+
/>
|
|
118
|
+
)}
|
|
119
|
+
</Inline>
|
|
120
|
+
</Box>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
Pill.displayName = 'Pill';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Progress as MantineProgress, ProgressProps as MantineProgressProps } from '@mantine/core';
|
|
5
|
+
import { ComponentSize } from '../config';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Enhanced Progress props extending Mantine's ProgressProps
|
|
9
|
+
*/
|
|
10
|
+
export interface DSProgressProps extends Omit<MantineProgressProps, 'size' | 'color' | 'radius'> {
|
|
11
|
+
/** Progress bar size from design system scale */
|
|
12
|
+
size?: ComponentSize;
|
|
13
|
+
/** Progress value (0-100) */
|
|
14
|
+
value: number;
|
|
15
|
+
/** Whether to show animation */
|
|
16
|
+
animated?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* AppDirect Design System Progress Component
|
|
21
|
+
*
|
|
22
|
+
* A progress bar component built on top of Mantine's Progress with
|
|
23
|
+
* consistent design system styling and blue color scheme.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* // Basic usage
|
|
28
|
+
* <Progress value={60} />
|
|
29
|
+
*
|
|
30
|
+
* // Different sizes
|
|
31
|
+
* <Progress value={30} size="xs" />
|
|
32
|
+
* <Progress value={50} size="sm" />
|
|
33
|
+
* <Progress value={70} size="md" />
|
|
34
|
+
* <Progress value={80} size="lg" />
|
|
35
|
+
* <Progress value={90} size="xl" />
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* // With animation
|
|
41
|
+
* <Progress value={75} animated />
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* // Different progress levels
|
|
47
|
+
* <Progress value={25} /> // Low progress
|
|
48
|
+
* <Progress value={60} /> // Medium progress
|
|
49
|
+
* <Progress value={90} /> // High progress
|
|
50
|
+
* <Progress value={100} /> // Complete
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export const Progress = forwardRef<HTMLDivElement, DSProgressProps>(
|
|
54
|
+
(
|
|
55
|
+
{
|
|
56
|
+
size = 'md',
|
|
57
|
+
value,
|
|
58
|
+
animated = false,
|
|
59
|
+
...props
|
|
60
|
+
},
|
|
61
|
+
ref
|
|
62
|
+
) => {
|
|
63
|
+
return (
|
|
64
|
+
<MantineProgress
|
|
65
|
+
ref={ref}
|
|
66
|
+
size={size}
|
|
67
|
+
value={value}
|
|
68
|
+
color="blue"
|
|
69
|
+
radius="xl"
|
|
70
|
+
animated={animated}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
Progress.displayName = 'Progress';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Table as MantineTable, TableProps as MantineTableProps } from '@mantine/core';
|
|
5
|
+
|
|
6
|
+
// ========================== TYPES ==========================
|
|
7
|
+
|
|
8
|
+
export interface DSTableProps extends MantineTableProps {
|
|
9
|
+
// All Mantine Table props are supported
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// ========================== COMPONENT ==========================
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Table Component
|
|
16
|
+
*
|
|
17
|
+
* A simple table component for displaying tabular data with consistent styling.
|
|
18
|
+
* Built on top of Mantine's Table component with Design System patterns.
|
|
19
|
+
*
|
|
20
|
+
* For complex data tables with features like sorting, filtering, and pagination,
|
|
21
|
+
* use the ComplexComponents/DataTable component instead.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* Basic table usage with compound components
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* Table with data prop for simple data
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* Styled table with borders and spacing
|
|
31
|
+
*/
|
|
32
|
+
const TableBase = forwardRef<HTMLTableElement, DSTableProps>(
|
|
33
|
+
(props, ref) => {
|
|
34
|
+
return (
|
|
35
|
+
<MantineTable
|
|
36
|
+
ref={ref}
|
|
37
|
+
horizontalSpacing="sm"
|
|
38
|
+
verticalSpacing="xs"
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
TableBase.displayName = 'DSTable';
|
|
46
|
+
|
|
47
|
+
// Create compound component with proper typing
|
|
48
|
+
export const Table = Object.assign(TableBase, {
|
|
49
|
+
Thead: MantineTable.Thead,
|
|
50
|
+
Tbody: MantineTable.Tbody,
|
|
51
|
+
Tfoot: MantineTable.Tfoot,
|
|
52
|
+
Tr: MantineTable.Tr,
|
|
53
|
+
Th: MantineTable.Th,
|
|
54
|
+
Td: MantineTable.Td,
|
|
55
|
+
Caption: MantineTable.Caption,
|
|
56
|
+
ScrollContainer: MantineTable.ScrollContainer,
|
|
57
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ThemeIcon as MantineThemeIcon, ThemeIconProps as MantineThemeIconProps } from '@mantine/core';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
|
|
6
|
+
export type ThemeIconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
7
|
+
export type ThemeIconColor = 'default' | 'blue' | string;
|
|
8
|
+
export type ThemeIconVariant = NonNullable<MantineThemeIconProps['variant']> | 'info' | 'success' | 'danger' | 'pending';
|
|
9
|
+
|
|
10
|
+
export interface DSThemeIconProps extends Omit<MantineThemeIconProps, 'size' | 'color'> {
|
|
11
|
+
/** ThemeIcon content */
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
/** Size of the ThemeIcon - supports Mantine t-shirt sizes plus xxl (58x58px) */
|
|
14
|
+
size?: ThemeIconSize | number;
|
|
15
|
+
/** Color variant - default (gray icon) or blue (blue icon), both use default variant styling */
|
|
16
|
+
color?: ThemeIconColor;
|
|
17
|
+
/** Variant with optional semantic aliases */
|
|
18
|
+
variant?: ThemeIconVariant;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const ThemeIcon = forwardRef<HTMLDivElement, DSThemeIconProps>(
|
|
22
|
+
({ children, size = 'md', color = 'default', variant = 'default', style, ...props }, ref) => {
|
|
23
|
+
// Handle xxl size which should be 58x58px
|
|
24
|
+
const getSize = () => {
|
|
25
|
+
if (size === 'xxl') {
|
|
26
|
+
return 58;
|
|
27
|
+
}
|
|
28
|
+
return size;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const resolvedVariant =
|
|
32
|
+
variant === 'info' || variant === 'success' || variant === 'danger' || variant === 'pending'
|
|
33
|
+
? 'light'
|
|
34
|
+
: variant;
|
|
35
|
+
|
|
36
|
+
const resolvedColor =
|
|
37
|
+
color !== 'default'
|
|
38
|
+
? color
|
|
39
|
+
: variant === 'info'
|
|
40
|
+
? 'blue'
|
|
41
|
+
: variant === 'success'
|
|
42
|
+
? 'green'
|
|
43
|
+
: variant === 'danger'
|
|
44
|
+
? 'red'
|
|
45
|
+
: variant === 'pending'
|
|
46
|
+
? 'yellow'
|
|
47
|
+
: 'default';
|
|
48
|
+
|
|
49
|
+
// For blue/default semantic variants, prefer explicit icon color
|
|
50
|
+
const iconStyle = resolvedColor === 'blue' ? { color: 'var(--ad-color-brand-primary)', ...style } : style;
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<MantineThemeIcon
|
|
54
|
+
ref={ref}
|
|
55
|
+
size={getSize()}
|
|
56
|
+
variant={resolvedVariant}
|
|
57
|
+
color={resolvedColor === 'default' ? undefined : resolvedColor}
|
|
58
|
+
style={iconStyle}
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
{children}
|
|
62
|
+
</MantineThemeIcon>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
ThemeIcon.displayName = 'ThemeIcon';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DataDisplay Components
|
|
3
|
+
*
|
|
4
|
+
* Components for displaying and organizing data in various formats.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { Alert } from './Alert';
|
|
8
|
+
export type { DSAlertProps } from './Alert';
|
|
9
|
+
|
|
10
|
+
export { Avatar } from './Avatar';
|
|
11
|
+
export type { DSAvatarProps, AvatarVariant, AvatarSize } from './Avatar';
|
|
12
|
+
|
|
13
|
+
export { Badge } from './Badge';
|
|
14
|
+
export type { DSBadgeProps } from './Badge';
|
|
15
|
+
|
|
16
|
+
export { Card, CardSection } from './Card';
|
|
17
|
+
export type { DSCardProps, DSCardSectionProps } from './Card';
|
|
18
|
+
|
|
19
|
+
export { Chip } from './Chip';
|
|
20
|
+
export type { DSChipProps } from './Chip';
|
|
21
|
+
|
|
22
|
+
export { Pill } from './Pill';
|
|
23
|
+
export type { DSPillProps } from './Pill';
|
|
24
|
+
|
|
25
|
+
export { Indicator } from './Indicator';
|
|
26
|
+
export type { DSIndicatorProps } from './Indicator';
|
|
27
|
+
|
|
28
|
+
export { Progress } from './Progress';
|
|
29
|
+
export type { DSProgressProps } from './Progress';
|
|
30
|
+
|
|
31
|
+
export { ThemeIcon } from './ThemeIcon';
|
|
32
|
+
export type { DSThemeIconProps, ThemeIconSize, ThemeIconColor } from './ThemeIcon';
|
|
33
|
+
|
|
34
|
+
export { List } from './List';
|
|
35
|
+
export type { DSListProps } from './List';
|
|
36
|
+
|
|
37
|
+
export { Table } from './Table';
|
|
38
|
+
export type { DSTableProps } from './Table';
|
|
39
|
+
|
|
40
|
+
// Future data display component exports will go here:
|
|
41
|
+
// export { ADDSKbd } from './Kbd';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Checkbox as MantineCheckbox, CheckboxProps as MantineCheckboxProps } from '@mantine/core';
|
|
5
|
+
import { ComponentSize } from '../config';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Enhanced Checkbox props extending Mantine's CheckboxProps
|
|
9
|
+
*/
|
|
10
|
+
export interface DSCheckboxProps extends Omit<MantineCheckboxProps, 'size' | 'radius'> {
|
|
11
|
+
/** Checkbox size from design system scale */
|
|
12
|
+
size?: ComponentSize;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* AppDirect Design System Checkbox Component
|
|
17
|
+
*
|
|
18
|
+
* A clean checkbox component built on top of Mantine's Checkbox with
|
|
19
|
+
* consistent design system styling and enforced radius.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* // Basic usage
|
|
24
|
+
* <Checkbox label="Accept terms" />
|
|
25
|
+
*
|
|
26
|
+
* // Controlled
|
|
27
|
+
* <Checkbox
|
|
28
|
+
* label="Subscribe to newsletter"
|
|
29
|
+
* checked={subscribed}
|
|
30
|
+
* onChange={(event) => setSubscribed(event.currentTarget.checked)}
|
|
31
|
+
* />
|
|
32
|
+
*
|
|
33
|
+
* // Required
|
|
34
|
+
* <Checkbox
|
|
35
|
+
* label="I agree to the terms"
|
|
36
|
+
* required
|
|
37
|
+
* />
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* // Different sizes
|
|
43
|
+
* <Checkbox size="xs" label="Extra small" />
|
|
44
|
+
* <Checkbox size="sm" label="Small" />
|
|
45
|
+
* <Checkbox size="md" label="Medium" />
|
|
46
|
+
* <Checkbox size="lg" label="Large" />
|
|
47
|
+
* <Checkbox size="xl" label="Extra large" />
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* // States
|
|
53
|
+
* <Checkbox label="Default checkbox" />
|
|
54
|
+
* <Checkbox label="Checked" defaultChecked />
|
|
55
|
+
* <Checkbox label="Disabled" disabled />
|
|
56
|
+
* <Checkbox label="Disabled checked" disabled defaultChecked />
|
|
57
|
+
* <Checkbox label="Indeterminate" indeterminate />
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export const Checkbox = forwardRef<HTMLInputElement, DSCheckboxProps>(
|
|
61
|
+
(
|
|
62
|
+
{
|
|
63
|
+
size = 'md',
|
|
64
|
+
label,
|
|
65
|
+
...props
|
|
66
|
+
},
|
|
67
|
+
ref
|
|
68
|
+
) => {
|
|
69
|
+
// Construct label with required asterisk if needed
|
|
70
|
+
const enhancedLabel = React.useMemo(() => {
|
|
71
|
+
if (!label) return label;
|
|
72
|
+
if (props.required) {
|
|
73
|
+
return (
|
|
74
|
+
<>
|
|
75
|
+
{label} <span style={{ color: 'var(--ad-color-status-error)' }}>*</span>
|
|
76
|
+
</>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
return label;
|
|
80
|
+
}, [label, props.required]);
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<MantineCheckbox
|
|
84
|
+
ref={ref}
|
|
85
|
+
size={size}
|
|
86
|
+
radius="sm"
|
|
87
|
+
label={enhancedLabel}
|
|
88
|
+
{...props}
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
Checkbox.displayName = 'Checkbox';
|