@appdirect/design-system 0.0.11 → 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.
- package/README.md +84 -6
- package/dist/Buttons/ActionIcon.js +14 -0
- package/dist/Buttons/Button.js +66 -0
- package/dist/Buttons/CloseButton.js +48 -0
- package/dist/Buttons/index.js +13 -0
- package/dist/Combobox/AutocompleteClearable.js +36 -0
- package/dist/Combobox/Combobox.js +28 -0
- package/dist/Combobox/Multiselect.js +31 -0
- package/dist/Combobox/SearchableSelect.js +43 -0
- package/dist/Combobox/Select.js +72 -0
- package/dist/Combobox/index.js +10 -0
- package/dist/ComplexComponents/DashboardWidget/DashboardWidget.js +96 -0
- package/dist/ComplexComponents/DashboardWidget/index.js +1 -0
- package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.js +82 -0
- package/dist/ComplexComponents/DataTable/CustomBottomToolbar/utils.js +23 -0
- package/dist/ComplexComponents/DataTable/CustomToolbarAlertBannerContent/index.js +23 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.js +230 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterChip.js +30 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/DateRangeFilter.js +12 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterRenderer.js +32 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterSystem.js +90 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/MultiSelectFilter.js +43 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/SingleSelectFilter.js +30 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/index.js +39 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/types.js +9 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/ResultCount/index.js +31 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.js +42 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/SelectFilter.js +21 -0
- package/dist/ComplexComponents/DataTable/CustomTopToolbar/index.js +410 -0
- package/dist/ComplexComponents/DataTable/DataTable.js +405 -0
- package/dist/ComplexComponents/DataTable/ErrorOverlay/index.js +9 -0
- package/dist/ComplexComponents/DataTable/SortableHeaderCell/index.js +27 -0
- package/dist/ComplexComponents/DataTable/index.js +1 -0
- package/dist/ComplexComponents/DataTable/translations/en.js +99 -0
- package/dist/ComplexComponents/DataTable/translations/index.js +17 -0
- package/dist/ComplexComponents/KeyInsight/KeyInsights.js +176 -0
- package/dist/ComplexComponents/KeyInsight/index.js +1 -0
- package/dist/ComplexComponents/NameValue/NameValue.js +94 -0
- package/dist/ComplexComponents/NameValue/NameValueItem.js +59 -0
- package/dist/ComplexComponents/NameValue/index.js +2 -0
- package/dist/ComplexComponents/PageContentHeader/PageContentHeader.js +92 -0
- package/dist/ComplexComponents/PageContentHeader/index.js +1 -0
- package/dist/ComplexComponents/Placeholder/Placeholder.js +51 -0
- package/dist/ComplexComponents/Placeholder/index.js +1 -0
- package/dist/ComplexComponents/Slat/Slat.js +53 -0
- package/dist/ComplexComponents/Slat/index.js +1 -0
- package/dist/ComplexComponents/Utilities/CopyButton.js +45 -0
- package/dist/ComplexComponents/Utilities/index.js +1 -0
- package/dist/DataDisplay/Alert.js +77 -0
- package/dist/DataDisplay/Avatar.js +157 -0
- package/dist/DataDisplay/Badge.js +78 -0
- package/dist/DataDisplay/Card.js +100 -0
- package/dist/DataDisplay/Chip.js +36 -0
- package/dist/DataDisplay/Indicator.js +59 -0
- package/dist/DataDisplay/List.js +60 -0
- package/dist/DataDisplay/Pill.js +81 -0
- package/dist/DataDisplay/Progress.js +42 -0
- package/dist/DataDisplay/Table.js +38 -0
- package/dist/DataDisplay/ThemeIcon.js +31 -0
- package/dist/DataDisplay/index.js +18 -0
- package/dist/Inputs/Checkbox.js +62 -0
- package/dist/Inputs/ColorInput.js +48 -0
- package/dist/Inputs/DropZone.js +12 -0
- package/dist/Inputs/FileInput.js +77 -0
- package/dist/Inputs/NumberInput.js +49 -0
- package/dist/Inputs/Radio.js +55 -0
- package/dist/Inputs/RadioGroup.js +59 -0
- package/dist/Inputs/SegmentedControl.js +50 -0
- package/dist/Inputs/Slider.js +50 -0
- package/dist/Inputs/SliderWithLabel.js +32 -0
- package/dist/Inputs/Switch.js +47 -0
- package/dist/Inputs/TextArea.js +50 -0
- package/dist/Inputs/TextInput.js +87 -0
- package/dist/Inputs/index.js +27 -0
- package/dist/Layout/Box.js +39 -0
- package/dist/Layout/Center.js +11 -0
- package/dist/Layout/Container.js +11 -0
- package/dist/Layout/Flex.js +12 -0
- package/dist/Layout/Grid.js +13 -0
- package/dist/Layout/Group.js +14 -0
- package/dist/Layout/Inline.js +46 -0
- package/dist/Layout/SimpleGrid.js +14 -0
- package/dist/Layout/Stack.js +45 -0
- package/dist/Layout/index.js +10 -0
- package/dist/Misc/Divider.js +8 -0
- package/dist/Misc/Paper.js +24 -0
- package/dist/Misc/index.js +10 -0
- package/dist/Navigation/Breadcrumb.js +60 -0
- package/dist/Navigation/NavLink.js +28 -0
- package/dist/Navigation/Stepper.js +8 -0
- package/dist/Navigation/Tabs.js +22 -0
- package/dist/Navigation/index.js +9 -0
- package/dist/Overlays/Drawer.js +63 -0
- package/dist/Overlays/Menu.js +85 -0
- package/dist/Overlays/Modal.js +61 -0
- package/dist/Overlays/Popover.js +118 -0
- package/dist/Overlays/Tooltip.js +71 -0
- package/dist/Overlays/index.js +12 -0
- package/dist/Shell/AppShellLayout.js +13 -0
- package/dist/Shell/HeaderBar.js +8 -0
- package/dist/Shell/SidebarNav.js +9 -0
- package/dist/Shell/SidebarNavLink.js +17 -0
- package/dist/Shell/SingleColumnLayout.js +11 -0
- package/dist/Shell/TertiaryColumnLayout.js +12 -0
- package/dist/Shell/index.js +6 -0
- package/dist/Typography/Code.js +8 -0
- package/dist/Typography/Kbd.js +58 -0
- package/dist/Typography/Text.js +8 -0
- package/dist/Typography/Title.js +11 -0
- package/dist/Typography/index.js +12 -0
- package/dist/config.js +202 -0
- package/dist/contracts/index.json +1 -1
- package/dist/hooks/useTableHandlers.js +136 -0
- package/dist/hooks/useTableRenderFunctions.js +164 -0
- package/dist/hooks/useTableState.js +70 -0
- package/dist/index.js +162 -0
- package/dist/stories/index.json +1 -1
- package/dist/types.js +127 -0
- package/package.json +9 -6
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Menu as MantineMenu } from '@mantine/core';
|
|
5
|
+
const isLegacyMenuProps = (props) => 'trigger' in props && 'sections' in props;
|
|
6
|
+
/**
|
|
7
|
+
* AppDirect Design System Menu Component
|
|
8
|
+
*
|
|
9
|
+
* A dropdown menu component built on top of Mantine's Menu with
|
|
10
|
+
* consistent design system styling.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Mantine-aligned composition
|
|
15
|
+
* <Menu shadow="md" width={220}>
|
|
16
|
+
* <Menu.Target>
|
|
17
|
+
* <Button>Actions</Button>
|
|
18
|
+
* </Menu.Target>
|
|
19
|
+
*
|
|
20
|
+
* <Menu.Dropdown>
|
|
21
|
+
* <Menu.Item>Edit</Menu.Item>
|
|
22
|
+
* <Menu.Item>Duplicate</Menu.Item>
|
|
23
|
+
* <Menu.Divider />
|
|
24
|
+
* <Menu.Label>Danger zone</Menu.Label>
|
|
25
|
+
* <Menu.Item color="red">Delete</Menu.Item>
|
|
26
|
+
* </Menu.Dropdown>
|
|
27
|
+
* </Menu>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // Legacy structured API still supported during migration
|
|
33
|
+
* <Menu
|
|
34
|
+
* trigger={<Button>Menu</Button>}
|
|
35
|
+
* sections={[
|
|
36
|
+
* {
|
|
37
|
+
* title: "Application",
|
|
38
|
+
* items: [
|
|
39
|
+
* {
|
|
40
|
+
* id: "settings",
|
|
41
|
+
* label: "Settings",
|
|
42
|
+
* leftSection: <RiSettingsLine size={14} />,
|
|
43
|
+
* onClick: () => console.log('Settings')
|
|
44
|
+
* },
|
|
45
|
+
* {
|
|
46
|
+
* id: "search",
|
|
47
|
+
* label: "Search",
|
|
48
|
+
* leftSection: <RiSearchLine size={14} />,
|
|
49
|
+
* rightSection: "⌘K",
|
|
50
|
+
* onClick: () => console.log('Search')
|
|
51
|
+
* }
|
|
52
|
+
* ]
|
|
53
|
+
* },
|
|
54
|
+
* {
|
|
55
|
+
* title: "Danger Zone",
|
|
56
|
+
* items: [
|
|
57
|
+
* {
|
|
58
|
+
* id: "delete-account",
|
|
59
|
+
* label: "Delete Account",
|
|
60
|
+
* leftSection: <RiDeleteBinLine size={14} />,
|
|
61
|
+
* color: "red",
|
|
62
|
+
* onClick: () => console.log('Delete Account')
|
|
63
|
+
* }
|
|
64
|
+
* ]
|
|
65
|
+
* }
|
|
66
|
+
* ]}
|
|
67
|
+
* />
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
const MenuRoot = forwardRef((props, _ref) => {
|
|
71
|
+
if (isLegacyMenuProps(props)) {
|
|
72
|
+
const { trigger, sections, shadow = 'md', radius = 'sm', ...menuProps } = props;
|
|
73
|
+
return (_jsxs(MantineMenu, { shadow: shadow, radius: radius, ...menuProps, children: [_jsx(MantineMenu.Target, { children: trigger }), _jsx(MantineMenu.Dropdown, { children: sections.map((section, sectionIndex) => (_jsxs(React.Fragment, { children: [sectionIndex > 0 && _jsx(MantineMenu.Divider, {}), section.title && (_jsx(MantineMenu.Label, { children: section.title })), section.items.map((item) => (_jsx(MantineMenu.Item, { leftSection: item.leftSection, rightSection: item.rightSection, onClick: item.onClick, disabled: item.disabled, color: item.color, children: item.label }, item.id)))] }, sectionIndex))) })] }));
|
|
74
|
+
}
|
|
75
|
+
const { shadow = 'md', radius = 'sm', ...menuProps } = props;
|
|
76
|
+
return (_jsx(MantineMenu, { shadow: shadow, radius: radius, ...menuProps }));
|
|
77
|
+
});
|
|
78
|
+
MenuRoot.displayName = 'Menu';
|
|
79
|
+
export const Menu = Object.assign(MenuRoot, {
|
|
80
|
+
Target: MantineMenu.Target,
|
|
81
|
+
Dropdown: MantineMenu.Dropdown,
|
|
82
|
+
Item: MantineMenu.Item,
|
|
83
|
+
Label: MantineMenu.Label,
|
|
84
|
+
Divider: MantineMenu.Divider,
|
|
85
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Modal as MantineModal, Stack } from '@mantine/core';
|
|
5
|
+
import { Inline } from '../index.js';
|
|
6
|
+
import { Button } from '../Buttons/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* AppDirect Design System Modal Component
|
|
9
|
+
*
|
|
10
|
+
* A modal dialog component built on top of Mantine's Modal with
|
|
11
|
+
* consistent design system styling.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* // Simple content modal
|
|
16
|
+
* <Modal
|
|
17
|
+
* opened={infoOpened}
|
|
18
|
+
* onClose={() => setInfoOpened(false)}
|
|
19
|
+
* title="Information"
|
|
20
|
+
* size="sm"
|
|
21
|
+
* >
|
|
22
|
+
* <Text>This is some information content.</Text>
|
|
23
|
+
* </Modal>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* // Confirmation buttons composed inside children
|
|
29
|
+
* <Modal
|
|
30
|
+
* opened={confirmOpened}
|
|
31
|
+
* onClose={() => setConfirmOpened(false)}
|
|
32
|
+
* title="Confirm Action"
|
|
33
|
+
* >
|
|
34
|
+
* <Stack gap="md">
|
|
35
|
+
* <Text>Are you sure you want to perform this action?</Text>
|
|
36
|
+
* <Inline justify="flex-end" gap="sm">
|
|
37
|
+
* <Button variant="outline">Cancel</Button>
|
|
38
|
+
* <Button variant="primary">Confirm</Button>
|
|
39
|
+
* </Inline>
|
|
40
|
+
* </Stack>
|
|
41
|
+
* </Modal>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export const Modal = forwardRef(({ title, size = 'md', withCloseButton = true, closeOnClickOutside = true, closeOnEscape = true, padding = 'md', centered = true, ...props }, ref) => {
|
|
45
|
+
return (_jsx(MantineModal, { ref: ref, title: title, size: size, withCloseButton: withCloseButton, closeOnClickOutside: closeOnClickOutside, closeOnEscape: closeOnEscape, padding: padding, centered: centered, radius: "sm", ...props }));
|
|
46
|
+
});
|
|
47
|
+
Modal.displayName = 'Modal';
|
|
48
|
+
export const ConfirmationModal = forwardRef(({ confirmLabel = 'Confirm', cancelLabel = 'Cancel', confirmVariant = 'primary', onConfirm, onCancel, confirmLoading = false, onClose, children, ...props }, ref) => {
|
|
49
|
+
const handleCancel = () => {
|
|
50
|
+
onCancel?.();
|
|
51
|
+
onClose();
|
|
52
|
+
};
|
|
53
|
+
const handleConfirm = () => {
|
|
54
|
+
onConfirm?.();
|
|
55
|
+
if (!confirmLoading) {
|
|
56
|
+
onClose();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return (_jsx(Modal, { ref: ref, onClose: onClose, ...props, children: _jsxs(Stack, { gap: "md", children: [children, _jsxs(Inline, { justify: "flex-end", gap: "sm", children: [_jsx(Button, { variant: "outline", onClick: handleCancel, children: cancelLabel }), _jsx(Button, { variant: confirmVariant, onClick: handleConfirm, loading: confirmLoading, children: confirmLabel })] })] }) }));
|
|
60
|
+
});
|
|
61
|
+
ConfirmationModal.displayName = 'ConfirmationModal';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Popover as MantinePopover, Stack, Text } from '@mantine/core';
|
|
5
|
+
import { Inline } from '../index.js';
|
|
6
|
+
import { Button } from '../Buttons/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* AppDirect Design System Popover Component
|
|
9
|
+
*
|
|
10
|
+
* A popover component built on top of Mantine's Popover with
|
|
11
|
+
* consistent design system styling and flexible content support.
|
|
12
|
+
* Arrow size is set to 10 and arrow radius to 0 by default.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Simple text popover
|
|
17
|
+
* <Popover
|
|
18
|
+
* trigger={<Button>Show Info</Button>}
|
|
19
|
+
* title="Information"
|
|
20
|
+
* position="top"
|
|
21
|
+
* >
|
|
22
|
+
* <Text>This is some helpful information.</Text>
|
|
23
|
+
* </Popover>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* // Popover with actions
|
|
29
|
+
* <Popover
|
|
30
|
+
* trigger={<Button>Actions</Button>}
|
|
31
|
+
* title="Quick Actions"
|
|
32
|
+
* position="bottom"
|
|
33
|
+
* actions={[
|
|
34
|
+
* {
|
|
35
|
+
* id: "save",
|
|
36
|
+
* label: "Save",
|
|
37
|
+
* variant: "primary",
|
|
38
|
+
* onClick: handleSave,
|
|
39
|
+
* closeOnClick: true
|
|
40
|
+
* },
|
|
41
|
+
* {
|
|
42
|
+
* id: "cancel",
|
|
43
|
+
* label: "Cancel",
|
|
44
|
+
* variant: "outline",
|
|
45
|
+
* closeOnClick: true
|
|
46
|
+
* }
|
|
47
|
+
* ]}
|
|
48
|
+
* tertiaryActions={[
|
|
49
|
+
* {
|
|
50
|
+
* id: "help",
|
|
51
|
+
* label: "Help",
|
|
52
|
+
* variant: "default",
|
|
53
|
+
* onClick: showHelp
|
|
54
|
+
* }
|
|
55
|
+
* ]}
|
|
56
|
+
* >
|
|
57
|
+
* <Text>Are you sure you want to continue?</Text>
|
|
58
|
+
* </Popover>
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* // Form popover
|
|
64
|
+
* <Popover
|
|
65
|
+
* trigger={<ActionIcon><RiSettingsLine /></ActionIcon>}
|
|
66
|
+
* title="Quick Settings"
|
|
67
|
+
* position="left"
|
|
68
|
+
* width={300}
|
|
69
|
+
* actions={[
|
|
70
|
+
* {
|
|
71
|
+
* id: "apply",
|
|
72
|
+
* label: "Apply",
|
|
73
|
+
* variant: "primary",
|
|
74
|
+
* onClick: applySettings
|
|
75
|
+
* }
|
|
76
|
+
* ]}
|
|
77
|
+
* >
|
|
78
|
+
* <Stack gap="sm">
|
|
79
|
+
* <Switch label="Enable notifications" />
|
|
80
|
+
* <Select label="Theme" data={themes} />
|
|
81
|
+
* </Stack>
|
|
82
|
+
* </Popover>
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export const Popover = forwardRef(({ trigger, title, children, actions = [], tertiaryActions = [], position = 'bottom', opened, onChange, onClose, width = 'auto', withArrow = true, arrowSize = 10, arrowRadius = 0, closeOnClickOutside = true, closeOnEscape = true, ...props }, ref) => {
|
|
86
|
+
const handleActionClick = (action) => {
|
|
87
|
+
if (action.onClick) {
|
|
88
|
+
action.onClick();
|
|
89
|
+
}
|
|
90
|
+
if (action.closeOnClick && onClose) {
|
|
91
|
+
onClose();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const hasActions = actions.length > 0 || tertiaryActions.length > 0;
|
|
95
|
+
return (_jsxs(MantinePopover, { opened: opened, onChange: onChange, position: position, width: width, withArrow: withArrow, arrowSize: arrowSize, arrowRadius: arrowRadius, closeOnClickOutside: closeOnClickOutside, closeOnEscape: closeOnEscape, shadow: "md", ...props, children: [_jsx(MantinePopover.Target, { children: trigger }), _jsx(MantinePopover.Dropdown, { children: _jsxs(Stack, { gap: "sm", children: [_jsxs("div", { children: [title && (_jsx(Text, { fw: 600, size: "sm", mb: "xs", children: title })), children] }), hasActions && (_jsxs(Inline, { justify: "space-between", gap: "sm", children: [_jsx(Inline, { gap: "sm", children: actions.map((action) => (_jsx(Button, { variant: action.variant || 'outline', onClick: () => handleActionClick(action), disabled: action.disabled, loading: action.loading, size: "xs", children: action.label }, action.id))) }), _jsx(Inline, { gap: "sm", children: tertiaryActions.map((action) => (_jsx(Button, { variant: action.variant || 'outline', onClick: () => handleActionClick(action), disabled: action.disabled, loading: action.loading, size: "xs", children: action.label }, action.id))) })] }))] }) })] }));
|
|
96
|
+
});
|
|
97
|
+
Popover.displayName = 'Popover';
|
|
98
|
+
export const ConfirmationPopover = forwardRef(({ confirmLabel = 'Confirm', cancelLabel = 'Cancel', confirmVariant = 'primary', onConfirm, onCancel, confirmLoading = false, tertiaryActions = [], onClose, ...props }, ref) => {
|
|
99
|
+
const actions = [
|
|
100
|
+
{
|
|
101
|
+
id: 'confirm',
|
|
102
|
+
label: confirmLabel,
|
|
103
|
+
variant: confirmVariant,
|
|
104
|
+
onClick: onConfirm,
|
|
105
|
+
loading: confirmLoading,
|
|
106
|
+
closeOnClick: !confirmLoading,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: 'cancel',
|
|
110
|
+
label: cancelLabel,
|
|
111
|
+
variant: 'outline',
|
|
112
|
+
onClick: onCancel,
|
|
113
|
+
closeOnClick: true,
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
return (_jsx(Popover, { ref: ref, actions: actions, tertiaryActions: tertiaryActions, onClose: onClose, ...props }));
|
|
117
|
+
});
|
|
118
|
+
ConfirmationPopover.displayName = 'ConfirmationPopover';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Tooltip as MantineTooltip } from '@mantine/core';
|
|
5
|
+
// ========================== COMPONENT ==========================
|
|
6
|
+
/**
|
|
7
|
+
* Tooltip Component
|
|
8
|
+
*
|
|
9
|
+
* Built on top of Mantine's Tooltip component with design system styling.
|
|
10
|
+
* Uses consistent dark background with white text and arrow pointer.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Basic tooltip
|
|
14
|
+
* <Tooltip label="This is a tooltip! Rejoice!">
|
|
15
|
+
* <Button>Hover me</Button>
|
|
16
|
+
* </Tooltip>
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Different positions
|
|
20
|
+
* <Tooltip label="Top tooltip" position="top">
|
|
21
|
+
* <Button>Top</Button>
|
|
22
|
+
* </Tooltip>
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Custom width and multiline
|
|
26
|
+
* <Tooltip
|
|
27
|
+
* label="This is a longer tooltip that can span multiple lines"
|
|
28
|
+
* width={200}
|
|
29
|
+
* position="bottom"
|
|
30
|
+
* >
|
|
31
|
+
* <Button>Long tooltip</Button>
|
|
32
|
+
* </Tooltip>
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // With delays
|
|
36
|
+
* <Tooltip
|
|
37
|
+
* label="Delayed tooltip"
|
|
38
|
+
* openDelay={500}
|
|
39
|
+
* closeDelay={200}
|
|
40
|
+
* >
|
|
41
|
+
* <Button>Delayed</Button>
|
|
42
|
+
* </Tooltip>
|
|
43
|
+
*/
|
|
44
|
+
export const Tooltip = forwardRef(({ label, children, position = 'top', disabled = false, openDelay = 0, closeDelay = 0, keepMounted = false, width = 'auto', withArrow = true, arrowSize = 6, ...props }, ref) => {
|
|
45
|
+
return (_jsx(MantineTooltip, { ref: ref, label: label, position: position, disabled: disabled, openDelay: openDelay, closeDelay: closeDelay, keepMounted: keepMounted, withArrow: withArrow, arrowSize: arrowSize,
|
|
46
|
+
// Design system styling from Figma
|
|
47
|
+
color: "dark", radius: "sm",
|
|
48
|
+
// Custom styles to match Figma design exactly
|
|
49
|
+
styles: {
|
|
50
|
+
tooltip: {
|
|
51
|
+
backgroundColor: '#212529',
|
|
52
|
+
color: '#ffffff',
|
|
53
|
+
fontFamily: 'Inter, sans-serif',
|
|
54
|
+
fontSize: '14px',
|
|
55
|
+
fontWeight: 400,
|
|
56
|
+
lineHeight: 1.55,
|
|
57
|
+
padding: '5px 8px',
|
|
58
|
+
borderRadius: '4px',
|
|
59
|
+
border: 'none',
|
|
60
|
+
width: width !== 'auto' ? width : undefined,
|
|
61
|
+
maxWidth: width === 'auto' ? '300px' : undefined,
|
|
62
|
+
},
|
|
63
|
+
arrow: {
|
|
64
|
+
backgroundColor: '#212529',
|
|
65
|
+
borderColor: '#212529',
|
|
66
|
+
}
|
|
67
|
+
}, ...props, children: children }));
|
|
68
|
+
});
|
|
69
|
+
Tooltip.displayName = 'Tooltip';
|
|
70
|
+
// Default export for convenience
|
|
71
|
+
export default Tooltip;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlays Components
|
|
3
|
+
*
|
|
4
|
+
* Components that appear on top of other content like modals, drawers, and popovers.
|
|
5
|
+
*/
|
|
6
|
+
export { Drawer } from './Drawer.js';
|
|
7
|
+
export { Menu } from './Menu.js';
|
|
8
|
+
export { Modal, ConfirmationModal } from './Modal.js';
|
|
9
|
+
export { Popover, ConfirmationPopover } from './Popover.js';
|
|
10
|
+
export { Tooltip } from './Tooltip.js';
|
|
11
|
+
// Future overlay component exports will go here:
|
|
12
|
+
// export { HoverCard } from './HoverCard';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { AppShell } from '@mantine/core';
|
|
5
|
+
import { Stack } from '../Layout/Stack.js';
|
|
6
|
+
import { HeaderBar } from './HeaderBar.js';
|
|
7
|
+
import { SidebarNav } from './SidebarNav.js';
|
|
8
|
+
const APP_DIRECT_NAVY = '#011B58';
|
|
9
|
+
export function AppShellLayout({ children, title, navItems = [], hideNav = false, }) {
|
|
10
|
+
const showNav = !hideNav && navItems.length > 0;
|
|
11
|
+
return (_jsxs(AppShell, { header: { height: 68 }, navbar: showNav ? { width: 300, breakpoint: 'sm', collapsed: { mobile: false } } : undefined, padding: "lg", children: [_jsx(AppShell.Header, { style: { background: APP_DIRECT_NAVY }, children: _jsx(HeaderBar, { title: title }) }), showNav && (_jsx(AppShell.Navbar, { pt: 0, pb: "md", pl: "md", pr: 0, children: _jsx(SidebarNav, { navItems: navItems, title: title ?? 'Navigation' }) })), _jsx(AppShell.Main, { children: _jsx(Stack, { gap: "xl", children: children }) })] }));
|
|
12
|
+
}
|
|
13
|
+
AppShellLayout.displayName = 'AppShellLayout';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ThemeIcon, Title } from '@mantine/core';
|
|
4
|
+
import { Inline } from '../Layout/Inline.js';
|
|
5
|
+
export function HeaderBar({ title = 'Prototype' }) {
|
|
6
|
+
return (_jsxs(Inline, { h: "100%", px: "xl", gap: "lg", children: [_jsx(ThemeIcon, { variant: "transparent", size: "lg", color: "white", children: _jsx("i", { className: "ri-grid-fill", style: { fontSize: 28 } }) }), _jsx(ThemeIcon, { variant: "transparent", p: "xs", size: 48, children: _jsx("img", { src: "/assets/AppDirect-Mark_White.svg", alt: "Logo", width: 38, height: 38 }) }), _jsx(Title, { order: 1, c: "white", fw: 300, fz: 22, ml: 12, children: title })] }));
|
|
7
|
+
}
|
|
8
|
+
HeaderBar.displayName = 'HeaderBar';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ThemeIcon, Divider, Title } from '@mantine/core';
|
|
4
|
+
import { Inline } from '../Layout/Inline.js';
|
|
5
|
+
import { SidebarNavLink } from './SidebarNavLink.js';
|
|
6
|
+
export function SidebarNav({ navItems, title }) {
|
|
7
|
+
return (_jsxs("nav", { "aria-label": "Sidebar Navigation", children: [_jsxs(Inline, { align: "center", gap: "sm", mb: 0, h: 66, pl: "xs", children: [_jsx(ThemeIcon, { variant: "transparent", size: "lg", color: "dark", children: _jsx("i", { className: "ri-group-line", style: { fontSize: 28 } }) }), _jsx(Title, { order: 5, fw: 700, m: 0, children: title })] }), _jsx(Divider, { mb: "md" }), navItems.map((item) => (_jsx(SidebarNavLink, { label: item.label, icon: item.icon, href: item.href, active: item.active, color: item.color, rightSection: item.rightSection }, item.label)))] }));
|
|
8
|
+
}
|
|
9
|
+
SidebarNav.displayName = 'SidebarNav';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { NavLink as MantineNavLink, ThemeIcon } from '@mantine/core';
|
|
4
|
+
const navLinkStyles = {
|
|
5
|
+
root: {
|
|
6
|
+
height: 44,
|
|
7
|
+
paddingLeft: 'var(--mantine-spacing-xs)',
|
|
8
|
+
borderTopLeftRadius: 'var(--mantine-radius-sm)',
|
|
9
|
+
borderBottomLeftRadius: 'var(--mantine-radius-sm)',
|
|
10
|
+
borderTopRightRadius: 0,
|
|
11
|
+
borderBottomRightRadius: 0,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export function SidebarNavLink({ label, icon, href, active, color = 'dark', rightSection, }) {
|
|
15
|
+
return (_jsx(MantineNavLink, { component: "a", href: href ?? '#', label: label, leftSection: _jsx(ThemeIcon, { variant: "transparent", size: "md", color: color, children: _jsx("i", { className: icon, style: { fontSize: 20 } }) }), rightSection: rightSection, active: active, "aria-current": active ? 'page' : undefined, styles: navLinkStyles }));
|
|
16
|
+
}
|
|
17
|
+
SidebarNavLink.displayName = 'SidebarNavLink';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Stack } from '../Layout/Stack.js';
|
|
4
|
+
/**
|
|
5
|
+
* Full-width single-column content layout.
|
|
6
|
+
* Use inside AppShellLayout for standard page content.
|
|
7
|
+
*/
|
|
8
|
+
export function SingleColumnLayout({ children, gap = 'lg' }) {
|
|
9
|
+
return (_jsx(Stack, { gap: gap, children: children }));
|
|
10
|
+
}
|
|
11
|
+
SingleColumnLayout.displayName = 'SingleColumnLayout';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Grid } from '../Layout/Grid.js';
|
|
4
|
+
/**
|
|
5
|
+
* Two-column content layout with a primary area and a narrower aside.
|
|
6
|
+
* Use inside AppShellLayout for pages that need a side panel.
|
|
7
|
+
*/
|
|
8
|
+
export function TertiaryColumnLayout({ main, aside, mainSpan = 8, }) {
|
|
9
|
+
const asideSpan = 12 - mainSpan;
|
|
10
|
+
return (_jsxs(Grid, { gap: "lg", children: [_jsx(Grid.Col, { span: mainSpan, children: main }), _jsx(Grid.Col, { span: asideSpan, children: aside })] }));
|
|
11
|
+
}
|
|
12
|
+
TertiaryColumnLayout.displayName = 'TertiaryColumnLayout';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { AppShellLayout } from './AppShellLayout.js';
|
|
2
|
+
export { HeaderBar } from './HeaderBar.js';
|
|
3
|
+
export { SidebarNav } from './SidebarNav.js';
|
|
4
|
+
export { SidebarNavLink } from './SidebarNavLink.js';
|
|
5
|
+
export { SingleColumnLayout } from './SingleColumnLayout.js';
|
|
6
|
+
export { TertiaryColumnLayout } from './TertiaryColumnLayout.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Code as MantineCode } from '@mantine/core';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
export const Code = forwardRef(({ children, size = 'sm', fz, ...props }, ref) => {
|
|
6
|
+
return (_jsx(MantineCode, { ref: ref, fz: fz || size, ...props, children: children }));
|
|
7
|
+
});
|
|
8
|
+
Code.displayName = 'Code';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Kbd as MantineKbd } from '@mantine/core';
|
|
5
|
+
/**
|
|
6
|
+
* AppDirect Design System Kbd Component
|
|
7
|
+
*
|
|
8
|
+
* A keyboard key component built on top of Mantine's Kbd with
|
|
9
|
+
* consistent design system styling for displaying keyboard shortcuts.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // Basic usage
|
|
14
|
+
* <Kbd>⌘K</Kbd>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* // With different sizes
|
|
20
|
+
* <Inline gap="sm">
|
|
21
|
+
* <Kbd size="xs">Esc</Kbd>
|
|
22
|
+
* <Kbd size="sm">⌘K</Kbd>
|
|
23
|
+
* <Kbd size="md">Ctrl+C</Kbd>
|
|
24
|
+
* <Kbd size="lg">Enter</Kbd>
|
|
25
|
+
* </Inline>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // Common keyboard shortcuts
|
|
31
|
+
* <Inline gap="sm">
|
|
32
|
+
* <Kbd>⌘</Kbd>
|
|
33
|
+
* <Kbd>⌘K</Kbd>
|
|
34
|
+
* <Kbd>⌘⇧P</Kbd>
|
|
35
|
+
* <Kbd>Ctrl+C</Kbd>
|
|
36
|
+
* <Kbd>Ctrl+V</Kbd>
|
|
37
|
+
* <Kbd>Enter</Kbd>
|
|
38
|
+
* <Kbd>Esc</Kbd>
|
|
39
|
+
* <Kbd>Tab</Kbd>
|
|
40
|
+
* <Kbd>Space</Kbd>
|
|
41
|
+
* </Inline>
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* // In Menu items
|
|
47
|
+
* <Menu.Item
|
|
48
|
+
* leftSection={<RiSearchLine size={14} />}
|
|
49
|
+
* rightSection={<Kbd>⌘K</Kbd>}
|
|
50
|
+
* >
|
|
51
|
+
* Search
|
|
52
|
+
* </Menu.Item>
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export const Kbd = forwardRef(({ children, size = 'sm', ...props }, ref) => {
|
|
56
|
+
return (_jsx(MantineKbd, { ref: ref, size: size, ...props, children: children }));
|
|
57
|
+
});
|
|
58
|
+
Kbd.displayName = 'Kbd';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Text as MantineText } from '@mantine/core';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
export const Text = forwardRef(({ children, size = 'sm', fz, ...props }, ref) => {
|
|
6
|
+
return (_jsx(MantineText, { ref: ref, fz: fz || size, ...props, children: children }));
|
|
7
|
+
});
|
|
8
|
+
Text.displayName = 'Text';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Title as MantineTitle } from '@mantine/core';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
export const Title = forwardRef(({ children, size, order = 2, fz, ...props }, ref) => {
|
|
6
|
+
// Only override font size if explicitly provided via fz or size
|
|
7
|
+
// Otherwise, let Mantine handle the semantic sizing based on order
|
|
8
|
+
const fontSize = fz || size;
|
|
9
|
+
return (_jsx(MantineTitle, { ref: ref, order: order, fz: fontSize, ...props, children: children }));
|
|
10
|
+
});
|
|
11
|
+
Title.displayName = 'Title';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typography Components
|
|
3
|
+
*
|
|
4
|
+
* Components for displaying text, keyboard shortcuts, and typographic elements
|
|
5
|
+
*/
|
|
6
|
+
export { Kbd } from './Kbd.js';
|
|
7
|
+
export { Code } from './Code.js';
|
|
8
|
+
export { Text } from './Text.js';
|
|
9
|
+
export { Title } from './Title.js';
|
|
10
|
+
// Future typography component exports will go here:
|
|
11
|
+
// export { Text } from './Text.js';
|
|
12
|
+
// export { Title } from './Title.js';
|