@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,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Group as MantineGroup, GroupProps as MantineGroupProps } from '@mantine/core';
|
|
5
|
+
import { SpacingScale } from './Stack';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Enhanced Group props extending Mantine's GroupProps
|
|
9
|
+
*/
|
|
10
|
+
export interface DSGroupProps extends Omit<MantineGroupProps, 'gap'> {
|
|
11
|
+
/** Spacing between group items using design system scale */
|
|
12
|
+
gap?: SpacingScale | string | number;
|
|
13
|
+
/** Alignment of items along the cross axis */
|
|
14
|
+
align?: 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
|
|
15
|
+
/** Distribution of items along the main axis */
|
|
16
|
+
justify?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
|
17
|
+
/** Whether items should wrap to new lines */
|
|
18
|
+
wrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* AppDirect Design System Group Component
|
|
23
|
+
*
|
|
24
|
+
* Mantine-named alias of `Inline`. Prefer `Inline` for new Figma-mapped and
|
|
25
|
+
* prototype code so agents have one horizontal primitive.
|
|
26
|
+
*/
|
|
27
|
+
export const Group = forwardRef<HTMLDivElement, DSGroupProps>(
|
|
28
|
+
(
|
|
29
|
+
{
|
|
30
|
+
gap = 'md',
|
|
31
|
+
align = 'center',
|
|
32
|
+
justify = 'flex-start',
|
|
33
|
+
wrap = 'wrap',
|
|
34
|
+
children,
|
|
35
|
+
...props
|
|
36
|
+
},
|
|
37
|
+
ref
|
|
38
|
+
) => {
|
|
39
|
+
return (
|
|
40
|
+
<MantineGroup
|
|
41
|
+
ref={ref}
|
|
42
|
+
gap={gap}
|
|
43
|
+
align={align}
|
|
44
|
+
justify={justify}
|
|
45
|
+
wrap={wrap}
|
|
46
|
+
{...props}
|
|
47
|
+
>
|
|
48
|
+
{children}
|
|
49
|
+
</MantineGroup>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
Group.displayName = 'Group';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Group as MantineGroup, GroupProps as MantineGroupProps } from '@mantine/core';
|
|
5
|
+
import { SpacingScale } from './Stack';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Enhanced Inline props extending Mantine's GroupProps
|
|
9
|
+
*/
|
|
10
|
+
export interface DSInlineProps extends Omit<MantineGroupProps, 'gap'> {
|
|
11
|
+
/** Spacing between inline items using design system scale */
|
|
12
|
+
gap?: SpacingScale | string | number;
|
|
13
|
+
/** Alignment of items along the cross axis */
|
|
14
|
+
align?: 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
|
|
15
|
+
/** Distribution of items along the main axis */
|
|
16
|
+
justify?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
|
17
|
+
/** Whether items should wrap to new lines */
|
|
18
|
+
wrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* AppDirect Design System Inline Component
|
|
23
|
+
*
|
|
24
|
+
* Horizontal layout primitive for new Figma-mapped and prototype code
|
|
25
|
+
* (`flex-direction: row` → `Inline`). `Group` is the Mantine-named alias of this
|
|
26
|
+
* same primitive — do not mix both in new code.
|
|
27
|
+
*
|
|
28
|
+
* Arranges children horizontally with design-system spacing. Built on Mantine Group.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // Basic horizontal layout
|
|
33
|
+
* <Inline gap="md">
|
|
34
|
+
* <Button>First</Button>
|
|
35
|
+
* <Button>Second</Button>
|
|
36
|
+
* <Button>Third</Button>
|
|
37
|
+
* </Inline>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* // Inline with alignment and wrapping
|
|
43
|
+
* <Inline gap="sm" align="center" wrap="wrap">
|
|
44
|
+
* <Badge>Tag 1</Badge>
|
|
45
|
+
* <Badge>Tag 2</Badge>
|
|
46
|
+
* <Badge>Tag 3</Badge>
|
|
47
|
+
* </Inline>
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* // Justified inline layout
|
|
53
|
+
* <Inline justify="space-between">
|
|
54
|
+
* <Text>Left content</Text>
|
|
55
|
+
* <Button>Right action</Button>
|
|
56
|
+
* </Inline>
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export const Inline = forwardRef<HTMLDivElement, DSInlineProps>(
|
|
60
|
+
(
|
|
61
|
+
{
|
|
62
|
+
gap = 'md',
|
|
63
|
+
align = 'center',
|
|
64
|
+
justify = 'flex-start',
|
|
65
|
+
wrap = 'wrap',
|
|
66
|
+
children,
|
|
67
|
+
...props
|
|
68
|
+
},
|
|
69
|
+
ref
|
|
70
|
+
) => {
|
|
71
|
+
return (
|
|
72
|
+
<MantineGroup
|
|
73
|
+
ref={ref}
|
|
74
|
+
gap={gap}
|
|
75
|
+
align={align}
|
|
76
|
+
justify={justify}
|
|
77
|
+
wrap={wrap}
|
|
78
|
+
{...props}
|
|
79
|
+
>
|
|
80
|
+
{children}
|
|
81
|
+
</MantineGroup>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
Inline.displayName = 'Inline';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { SimpleGrid as MantineSimpleGrid, SimpleGridProps as MantineSimpleGridProps } from '@mantine/core';
|
|
5
|
+
import { SpacingScale } from './Stack';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Enhanced SimpleGrid props extending Mantine's SimpleGridProps
|
|
9
|
+
*/
|
|
10
|
+
export interface DSSimpleGridProps extends Omit<MantineSimpleGridProps, 'spacing'> {
|
|
11
|
+
/** Number of columns */
|
|
12
|
+
cols?: number | { base?: number; xs?: number; sm?: number; md?: number; lg?: number; xl?: number };
|
|
13
|
+
/** Spacing between grid items using design system scale */
|
|
14
|
+
spacing?: SpacingScale | string | number;
|
|
15
|
+
/** Vertical spacing between rows */
|
|
16
|
+
verticalSpacing?: SpacingScale | string | number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* AppDirect Design System SimpleGrid Component
|
|
21
|
+
*
|
|
22
|
+
* A responsive equal-width grid primitive aligned with Mantine's SimpleGrid
|
|
23
|
+
* naming. Use it when all columns should have the same width.
|
|
24
|
+
*/
|
|
25
|
+
export const SimpleGrid = forwardRef<HTMLDivElement, DSSimpleGridProps>(
|
|
26
|
+
(
|
|
27
|
+
{
|
|
28
|
+
cols = 1,
|
|
29
|
+
spacing = 'md',
|
|
30
|
+
verticalSpacing,
|
|
31
|
+
children,
|
|
32
|
+
...props
|
|
33
|
+
},
|
|
34
|
+
ref
|
|
35
|
+
) => {
|
|
36
|
+
return (
|
|
37
|
+
<MantineSimpleGrid
|
|
38
|
+
ref={ref}
|
|
39
|
+
cols={cols}
|
|
40
|
+
spacing={spacing}
|
|
41
|
+
verticalSpacing={verticalSpacing}
|
|
42
|
+
{...props}
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
</MantineSimpleGrid>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
SimpleGrid.displayName = 'SimpleGrid';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Stack as MantineStack, StackProps as MantineStackProps } from '@mantine/core';
|
|
5
|
+
import { ComponentSize } from '../config';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Design System spacing scale mapped to rem values
|
|
9
|
+
*/
|
|
10
|
+
export type SpacingScale = 'none' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Enhanced Stack props extending Mantine's StackProps
|
|
14
|
+
*/
|
|
15
|
+
export interface DSStackProps extends Omit<MantineStackProps, 'gap'> {
|
|
16
|
+
/** Spacing between stack items using design system scale */
|
|
17
|
+
gap?: SpacingScale | string | number;
|
|
18
|
+
/** Alignment of items along the cross axis */
|
|
19
|
+
align?: 'stretch' | 'flex-start' | 'flex-end' | 'center' | 'baseline';
|
|
20
|
+
/** Distribution of items along the main axis */
|
|
21
|
+
justify?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* AppDirect Design System Stack Component
|
|
26
|
+
*
|
|
27
|
+
* A layout primitive that stacks child elements vertically with consistent spacing
|
|
28
|
+
* using design system tokens. Built on top of Mantine's Stack component.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // Basic vertical stack
|
|
33
|
+
* <Stack gap="md">
|
|
34
|
+
* <Text>First item</Text>
|
|
35
|
+
* <Text>Second item</Text>
|
|
36
|
+
* <Text>Third item</Text>
|
|
37
|
+
* </Stack>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* // Stack with alignment
|
|
43
|
+
* <Stack gap="lg" align="center">
|
|
44
|
+
* <Button>Centered button</Button>
|
|
45
|
+
* <Text>Centered text</Text>
|
|
46
|
+
* </Stack>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* // Nested stacks with different spacing
|
|
52
|
+
* <Stack gap="xl">
|
|
53
|
+
* <Title>Main Section</Title>
|
|
54
|
+
* <Stack gap="sm">
|
|
55
|
+
* <Text>Related item 1</Text>
|
|
56
|
+
* <Text>Related item 2</Text>
|
|
57
|
+
* </Stack>
|
|
58
|
+
* </Stack>
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export const Stack = forwardRef<HTMLDivElement, DSStackProps>(
|
|
62
|
+
(
|
|
63
|
+
{
|
|
64
|
+
gap = 'md',
|
|
65
|
+
align = 'stretch',
|
|
66
|
+
justify = 'flex-start',
|
|
67
|
+
children,
|
|
68
|
+
...props
|
|
69
|
+
},
|
|
70
|
+
ref
|
|
71
|
+
) => {
|
|
72
|
+
return (
|
|
73
|
+
<MantineStack
|
|
74
|
+
ref={ref}
|
|
75
|
+
gap={gap}
|
|
76
|
+
align={align}
|
|
77
|
+
justify={justify}
|
|
78
|
+
{...props}
|
|
79
|
+
>
|
|
80
|
+
{children}
|
|
81
|
+
</MantineStack>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
Stack.displayName = 'Stack';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Layout Primitives
|
|
2
|
+
export { Stack } from './Stack';
|
|
3
|
+
export type { DSStackProps } from './Stack';
|
|
4
|
+
|
|
5
|
+
export { Group } from './Group';
|
|
6
|
+
export type { DSGroupProps } from './Group';
|
|
7
|
+
|
|
8
|
+
export { Inline } from './Inline';
|
|
9
|
+
export type { DSInlineProps } from './Inline';
|
|
10
|
+
|
|
11
|
+
export { Box } from './Box';
|
|
12
|
+
export type { DSBoxProps } from './Box';
|
|
13
|
+
|
|
14
|
+
export { SimpleGrid } from './SimpleGrid';
|
|
15
|
+
export type { DSSimpleGridProps } from './SimpleGrid';
|
|
16
|
+
|
|
17
|
+
export { Grid } from './Grid';
|
|
18
|
+
export type { DSGridProps, DSGridColProps } from './Grid';
|
|
19
|
+
|
|
20
|
+
export { Flex } from './Flex';
|
|
21
|
+
export type { DSFlexProps } from './Flex';
|
|
22
|
+
|
|
23
|
+
export { Container } from './Container';
|
|
24
|
+
export type { DSContainerProps } from './Container';
|
|
25
|
+
|
|
26
|
+
export { Center } from './Center';
|
|
27
|
+
export type { DSCenterProps } from './Center';
|
|
28
|
+
|
|
29
|
+
export type { SpacingScale } from './Stack';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Divider as MantineDivider, DividerProps as MantineDividerProps } from '@mantine/core';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
|
|
6
|
+
export interface DSDividerProps extends Omit<MantineDividerProps, 'color'> {
|
|
7
|
+
/** Orientation of the divider */
|
|
8
|
+
orientation?: 'horizontal' | 'vertical';
|
|
9
|
+
/** Thickness of the divider - supports Mantine t-shirt sizes */
|
|
10
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Divider = forwardRef<HTMLDivElement, DSDividerProps>(
|
|
14
|
+
({ orientation = 'horizontal', size = 'sm', ...props }, ref) => {
|
|
15
|
+
return (
|
|
16
|
+
<MantineDivider
|
|
17
|
+
ref={ref}
|
|
18
|
+
orientation={orientation}
|
|
19
|
+
size={size}
|
|
20
|
+
color="gray.4"
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
Divider.displayName = 'Divider';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Paper as MantinePaper, PaperProps as MantinePaperProps } from '@mantine/core';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
|
|
6
|
+
export interface DSPaperProps extends Omit<MantinePaperProps, 'padding'> {
|
|
7
|
+
/** Legacy variant alias retained for backwards compatibility */
|
|
8
|
+
variant?: 'default' | 'shadow' | 'border' | 'border-shadow';
|
|
9
|
+
/** Content of the paper */
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Paper = forwardRef<HTMLDivElement, DSPaperProps>(
|
|
14
|
+
({ variant, children, p, shadow, withBorder, ...props }, ref) => {
|
|
15
|
+
const getVariantProps = () => {
|
|
16
|
+
switch (variant) {
|
|
17
|
+
case 'shadow':
|
|
18
|
+
return { shadow: 'xs' as const, withBorder: false };
|
|
19
|
+
case 'border':
|
|
20
|
+
return { withBorder: true, shadow: undefined };
|
|
21
|
+
case 'border-shadow':
|
|
22
|
+
return { withBorder: true, shadow: 'xs' as const };
|
|
23
|
+
case 'default':
|
|
24
|
+
default:
|
|
25
|
+
return { withBorder: false, shadow: undefined };
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const variantProps = getVariantProps();
|
|
30
|
+
const resolvedShadow = shadow ?? variantProps.shadow;
|
|
31
|
+
const resolvedWithBorder = withBorder ?? variantProps.withBorder;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<MantinePaper
|
|
35
|
+
ref={ref}
|
|
36
|
+
p={p}
|
|
37
|
+
shadow={resolvedShadow}
|
|
38
|
+
withBorder={resolvedWithBorder}
|
|
39
|
+
{...props}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</MantinePaper>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
Paper.displayName = 'Paper';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Miscellaneous Components
|
|
3
|
+
*
|
|
4
|
+
* Utility components for layout, spacing, and other miscellaneous purposes
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { Divider } from './Divider';
|
|
8
|
+
export type { DSDividerProps } from './Divider';
|
|
9
|
+
|
|
10
|
+
export { Paper } from './Paper';
|
|
11
|
+
export type { DSPaperProps } from './Paper';
|
|
12
|
+
|
|
13
|
+
// Future misc component exports will go here:
|
|
14
|
+
// export { Portal } from './Portal';
|
|
15
|
+
// export { Transition } from './Transition';
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Breadcrumbs as MantineBreadcrumbs, Anchor, Text, Group, BreadcrumbsProps as MantineBreadcrumbsProps } from '@mantine/core';
|
|
5
|
+
import { IconChevronLeft } from '@tabler/icons-react';
|
|
6
|
+
|
|
7
|
+
// ========================== TYPES ==========================
|
|
8
|
+
|
|
9
|
+
export interface BreadcrumbItem {
|
|
10
|
+
label: string;
|
|
11
|
+
href?: string;
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface DSBreadcrumbProps extends Omit<MantineBreadcrumbsProps, 'children'> {
|
|
16
|
+
/** Array of breadcrumb items */
|
|
17
|
+
items: BreadcrumbItem[];
|
|
18
|
+
/** Custom separator (default: '/') */
|
|
19
|
+
separator?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface DSBackBreadcrumbProps {
|
|
23
|
+
/** Back button label (default: 'Back') */
|
|
24
|
+
label?: string;
|
|
25
|
+
/** Click handler for back button */
|
|
26
|
+
onClick?: () => void;
|
|
27
|
+
/** href for back navigation (alternative to onClick) */
|
|
28
|
+
href?: string;
|
|
29
|
+
/** Additional class names */
|
|
30
|
+
className?: string;
|
|
31
|
+
/** Accessible label for screen readers (overrides visible label when set) */
|
|
32
|
+
'aria-label'?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ========================== COMPONENTS ==========================
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Standard Breadcrumb Component
|
|
39
|
+
*
|
|
40
|
+
* Built on top of Mantine's Breadcrumbs component with design system styling.
|
|
41
|
+
* Displays a navigation breadcrumb with clickable links and separators.
|
|
42
|
+
* The last item is rendered as plain text with `aria-current="page"` to
|
|
43
|
+
* represent the current page both visually and semantically.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* <Breadcrumb
|
|
47
|
+
* items={[
|
|
48
|
+
* { label: 'Home', href: '/' },
|
|
49
|
+
* { label: 'Products', href: '/products' },
|
|
50
|
+
* { label: 'Details' }
|
|
51
|
+
* ]}
|
|
52
|
+
* />
|
|
53
|
+
*/
|
|
54
|
+
export const Breadcrumb = forwardRef<HTMLDivElement, DSBreadcrumbProps>(
|
|
55
|
+
({ items, separator = '/', ...props }, ref) => {
|
|
56
|
+
if (!items || items.length === 0) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const breadcrumbItems = items.map((item, index) => {
|
|
61
|
+
const isLast = index === items.length - 1;
|
|
62
|
+
|
|
63
|
+
if (isLast) {
|
|
64
|
+
return (
|
|
65
|
+
<Text key={item.label} component="span" aria-current="page">
|
|
66
|
+
{item.label}
|
|
67
|
+
</Text>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (item.href) {
|
|
72
|
+
return (
|
|
73
|
+
<Anchor key={item.label} href={item.href}>
|
|
74
|
+
{item.label}
|
|
75
|
+
</Anchor>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<Anchor key={item.label} component="button" onClick={item.onClick}>
|
|
81
|
+
{item.label}
|
|
82
|
+
</Anchor>
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<MantineBreadcrumbs
|
|
88
|
+
ref={ref}
|
|
89
|
+
separator={separator}
|
|
90
|
+
aria-label="breadcrumb"
|
|
91
|
+
{...props}
|
|
92
|
+
>
|
|
93
|
+
{breadcrumbItems}
|
|
94
|
+
</MantineBreadcrumbs>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Back Breadcrumb Component
|
|
101
|
+
*
|
|
102
|
+
* Displays a simple back navigation with a chevron icon and label.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* <BackBreadcrumb
|
|
106
|
+
* label="Back to Products"
|
|
107
|
+
* onClick={() => router.back()}
|
|
108
|
+
* />
|
|
109
|
+
*/
|
|
110
|
+
export const BackBreadcrumb = forwardRef<HTMLAnchorElement & HTMLButtonElement, DSBackBreadcrumbProps>(
|
|
111
|
+
({ label = 'Back', onClick, href, className, 'aria-label': ariaLabel }, ref) => {
|
|
112
|
+
const content = (
|
|
113
|
+
<Group gap={4} wrap="nowrap">
|
|
114
|
+
<IconChevronLeft size={16} />
|
|
115
|
+
<span>{label}</span>
|
|
116
|
+
</Group>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
if (href) {
|
|
120
|
+
return (
|
|
121
|
+
<Anchor ref={ref} href={href} className={className} aria-label={ariaLabel}>
|
|
122
|
+
{content}
|
|
123
|
+
</Anchor>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<Anchor ref={ref} component="button" className={className} onClick={onClick} aria-label={ariaLabel}>
|
|
129
|
+
{content}
|
|
130
|
+
</Anchor>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
Breadcrumb.displayName = 'Breadcrumb';
|
|
136
|
+
BackBreadcrumb.displayName = 'BackBreadcrumb';
|
|
137
|
+
|
|
138
|
+
export default Breadcrumb;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { NavLink as MantineNavLink, NavLinkProps as MantineNavLinkProps } from '@mantine/core';
|
|
5
|
+
|
|
6
|
+
// ========================== TYPES ==========================
|
|
7
|
+
|
|
8
|
+
export interface DSNavLinkProps extends MantineNavLinkProps {}
|
|
9
|
+
|
|
10
|
+
// ========================== COMPONENT ==========================
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* NavLink Component
|
|
14
|
+
*
|
|
15
|
+
* Thin wrapper around Mantine's NavLink. Used for navigation items
|
|
16
|
+
* in menus and sidebars.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <NavLink
|
|
20
|
+
* leftSection={<RiHomeLine size={18} />}
|
|
21
|
+
* label="Dashboard"
|
|
22
|
+
* onClick={() => navigate('/dashboard')}
|
|
23
|
+
* />
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <NavLink
|
|
27
|
+
* leftSection={<RiSettingsLine size={18} />}
|
|
28
|
+
* label="Settings"
|
|
29
|
+
* description="Manage your preferences"
|
|
30
|
+
* active
|
|
31
|
+
* />
|
|
32
|
+
*/
|
|
33
|
+
export const NavLink = forwardRef<HTMLAnchorElement, DSNavLinkProps>(
|
|
34
|
+
(props, ref) => <MantineNavLink ref={ref} {...props} />
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
NavLink.displayName = 'NavLink';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import {
|
|
5
|
+
Stepper as MantineStepper,
|
|
6
|
+
StepperProps as MantineStepperProps,
|
|
7
|
+
} from '@mantine/core';
|
|
8
|
+
|
|
9
|
+
export interface DSStepperProps extends MantineStepperProps {}
|
|
10
|
+
|
|
11
|
+
export const Stepper = forwardRef<HTMLDivElement, DSStepperProps>(
|
|
12
|
+
({ ...props }, ref) => <MantineStepper ref={ref} {...props} />
|
|
13
|
+
) as typeof MantineStepper;
|
|
14
|
+
|
|
15
|
+
Stepper.displayName = 'Stepper';
|
|
16
|
+
Stepper.Step = MantineStepper.Step;
|
|
17
|
+
Stepper.Completed = MantineStepper.Completed;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Tabs as MantineTabs, TabsProps as MantineTabsProps } from '@mantine/core';
|
|
4
|
+
|
|
5
|
+
// ========================== TYPES ==========================
|
|
6
|
+
|
|
7
|
+
export type DSTabsProps = MantineTabsProps;
|
|
8
|
+
|
|
9
|
+
// ========================== COMPONENT ==========================
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Tabs Component
|
|
13
|
+
*
|
|
14
|
+
* Thin wrapper around Mantine's Tabs compound component.
|
|
15
|
+
* Use Tabs.List, Tabs.Tab, and Tabs.Panel for composition.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <Tabs defaultValue="overview">
|
|
19
|
+
* <Tabs.List>
|
|
20
|
+
* <Tabs.Tab value="overview" leftSection={<RiDashboardLine size={14} />}>
|
|
21
|
+
* Overview
|
|
22
|
+
* </Tabs.Tab>
|
|
23
|
+
* <Tabs.Tab value="analytics">Analytics</Tabs.Tab>
|
|
24
|
+
* </Tabs.List>
|
|
25
|
+
* <Tabs.Panel value="overview">Overview content</Tabs.Panel>
|
|
26
|
+
* <Tabs.Panel value="analytics">Analytics content</Tabs.Panel>
|
|
27
|
+
* </Tabs>
|
|
28
|
+
*/
|
|
29
|
+
export const Tabs = MantineTabs;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Components
|
|
3
|
+
*
|
|
4
|
+
* This module exports navigation-related components including breadcrumbs and nav links.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { Breadcrumb, BackBreadcrumb } from './Breadcrumb';
|
|
8
|
+
export type { DSBreadcrumbProps, DSBackBreadcrumbProps, BreadcrumbItem } from './Breadcrumb';
|
|
9
|
+
|
|
10
|
+
export { NavLink } from './NavLink';
|
|
11
|
+
export type { DSNavLinkProps } from './NavLink';
|
|
12
|
+
|
|
13
|
+
export { Stepper } from './Stepper';
|
|
14
|
+
export type { DSStepperProps } from './Stepper';
|
|
15
|
+
|
|
16
|
+
export { Tabs } from './Tabs';
|
|
17
|
+
export type { DSTabsProps } from './Tabs';
|