@camtomlabs/malix-design-system 0.1.2
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/LICENSE +7 -0
- package/README.md +38 -0
- package/package.json +49 -0
- package/src/components/Accordion.tsx +52 -0
- package/src/components/Avatar.tsx +18 -0
- package/src/components/Badge.tsx +27 -0
- package/src/components/Banner.tsx +75 -0
- package/src/components/Breadcrumb.tsx +58 -0
- package/src/components/Button.tsx +47 -0
- package/src/components/Card.tsx +34 -0
- package/src/components/ChatInput.tsx +53 -0
- package/src/components/Checkbox.tsx +85 -0
- package/src/components/CreditsIndicator.tsx +41 -0
- package/src/components/DataTable.tsx +75 -0
- package/src/components/DateInput.tsx +57 -0
- package/src/components/Divider.tsx +12 -0
- package/src/components/Dropzone.tsx +94 -0
- package/src/components/EmptyState.tsx +65 -0
- package/src/components/FileCard.tsx +78 -0
- package/src/components/FilterTabs.tsx +49 -0
- package/src/components/FlyoutMenu.tsx +36 -0
- package/src/components/GlassPopover.tsx +38 -0
- package/src/components/Header.tsx +22 -0
- package/src/components/Input.tsx +18 -0
- package/src/components/InputGroup.tsx +37 -0
- package/src/components/LanguageSelector.tsx +81 -0
- package/src/components/Modal.tsx +104 -0
- package/src/components/OnboardingPopover.tsx +61 -0
- package/src/components/OperationStatus.tsx +73 -0
- package/src/components/Overlay.tsx +66 -0
- package/src/components/Pagination.tsx +89 -0
- package/src/components/Pill.tsx +19 -0
- package/src/components/PricingCard.tsx +74 -0
- package/src/components/ProgressBar.tsx +47 -0
- package/src/components/Radio.tsx +56 -0
- package/src/components/SectionHeader.tsx +32 -0
- package/src/components/SegmentedControl.tsx +42 -0
- package/src/components/Select.tsx +62 -0
- package/src/components/SelectGroup.tsx +32 -0
- package/src/components/SelectionCard.tsx +47 -0
- package/src/components/SidebarItem.tsx +27 -0
- package/src/components/SidebarPanel.tsx +84 -0
- package/src/components/SplitPane.tsx +85 -0
- package/src/components/StatCard.tsx +64 -0
- package/src/components/StatusDot.tsx +26 -0
- package/src/components/Stepper.tsx +40 -0
- package/src/components/TabBar.tsx +45 -0
- package/src/components/Textarea.tsx +43 -0
- package/src/components/Toggle.tsx +50 -0
- package/src/components/Tooltip.tsx +33 -0
- package/src/components/UserProfilePopover.tsx +100 -0
- package/src/components/ValidationAlert.tsx +72 -0
- package/src/index.ts +177 -0
- package/src/styles.css +3237 -0
- package/src/tokens.css +165 -0
- package/src/tokens.registry.json +75 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export type UserProfileMenuItem = {
|
|
4
|
+
icon?: React.ReactNode;
|
|
5
|
+
label: string;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type UserProfilePopoverProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
10
|
+
name: string;
|
|
11
|
+
email: string;
|
|
12
|
+
avatar?: React.ReactNode;
|
|
13
|
+
menuItems?: UserProfileMenuItem[];
|
|
14
|
+
onLogout?: () => void;
|
|
15
|
+
credits?: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function UserProfilePopover({
|
|
19
|
+
name,
|
|
20
|
+
email,
|
|
21
|
+
avatar,
|
|
22
|
+
menuItems,
|
|
23
|
+
onLogout,
|
|
24
|
+
credits,
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: UserProfilePopoverProps) {
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
className={`malix-user-profile${className ? ` ${className}` : ''}`}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
<div className="malix-user-profile__header">
|
|
34
|
+
{avatar ? (
|
|
35
|
+
<span className="malix-user-profile__avatar">{avatar}</span>
|
|
36
|
+
) : null}
|
|
37
|
+
<div className="malix-user-profile__info">
|
|
38
|
+
<span className="malix-user-profile__name">{name}</span>
|
|
39
|
+
<span className="malix-user-profile__email">{email}</span>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
{credits !== undefined ? (
|
|
44
|
+
<div className="malix-user-profile__credits">
|
|
45
|
+
<span className="malix-user-profile__credits-label">Credits</span>
|
|
46
|
+
<span className="malix-user-profile__credits-value">{credits}</span>
|
|
47
|
+
</div>
|
|
48
|
+
) : null}
|
|
49
|
+
|
|
50
|
+
{menuItems && menuItems.length > 0 ? (
|
|
51
|
+
<>
|
|
52
|
+
<hr className="malix-user-profile__divider" />
|
|
53
|
+
<nav className="malix-user-profile__menu" role="menu">
|
|
54
|
+
{menuItems.map((item, i) => (
|
|
55
|
+
<button
|
|
56
|
+
key={i}
|
|
57
|
+
type="button"
|
|
58
|
+
className="malix-user-profile__menu-item"
|
|
59
|
+
role="menuitem"
|
|
60
|
+
onClick={item.onClick}
|
|
61
|
+
>
|
|
62
|
+
{item.icon ? (
|
|
63
|
+
<span className="malix-user-profile__menu-item-icon">{item.icon}</span>
|
|
64
|
+
) : null}
|
|
65
|
+
<span className="malix-user-profile__menu-item-label">{item.label}</span>
|
|
66
|
+
</button>
|
|
67
|
+
))}
|
|
68
|
+
</nav>
|
|
69
|
+
</>
|
|
70
|
+
) : null}
|
|
71
|
+
|
|
72
|
+
{onLogout ? (
|
|
73
|
+
<>
|
|
74
|
+
<hr className="malix-user-profile__divider" />
|
|
75
|
+
<button
|
|
76
|
+
type="button"
|
|
77
|
+
className="malix-user-profile__logout"
|
|
78
|
+
onClick={onLogout}
|
|
79
|
+
>
|
|
80
|
+
<svg
|
|
81
|
+
width="16"
|
|
82
|
+
height="16"
|
|
83
|
+
viewBox="0 0 24 24"
|
|
84
|
+
fill="none"
|
|
85
|
+
stroke="currentColor"
|
|
86
|
+
strokeWidth="2"
|
|
87
|
+
strokeLinecap="round"
|
|
88
|
+
strokeLinejoin="round"
|
|
89
|
+
>
|
|
90
|
+
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
|
|
91
|
+
<polyline points="16 17 21 12 16 7" />
|
|
92
|
+
<line x1="21" y1="12" x2="9" y2="12" />
|
|
93
|
+
</svg>
|
|
94
|
+
<span>Log out</span>
|
|
95
|
+
</button>
|
|
96
|
+
</>
|
|
97
|
+
) : null}
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export type ValidationAlertVariant = 'error' | 'warning' | 'info';
|
|
4
|
+
|
|
5
|
+
export type ValidationAlertProps = {
|
|
6
|
+
title: string;
|
|
7
|
+
message: string;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
variant?: ValidationAlertVariant;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function AlertIcon({ variant }: { variant: ValidationAlertVariant }) {
|
|
14
|
+
const shared = { width: 16, height: 16, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2, strokeLinecap: 'round' as const, strokeLinejoin: 'round' as const };
|
|
15
|
+
|
|
16
|
+
switch (variant) {
|
|
17
|
+
case 'error':
|
|
18
|
+
case 'warning':
|
|
19
|
+
return (
|
|
20
|
+
<svg {...shared}>
|
|
21
|
+
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" />
|
|
22
|
+
<line x1="12" y1="9" x2="12" y2="13" />
|
|
23
|
+
<line x1="12" y1="17" x2="12.01" y2="17" />
|
|
24
|
+
</svg>
|
|
25
|
+
);
|
|
26
|
+
case 'info':
|
|
27
|
+
return (
|
|
28
|
+
<svg {...shared}>
|
|
29
|
+
<circle cx="12" cy="12" r="10" />
|
|
30
|
+
<line x1="12" y1="16" x2="12" y2="12" />
|
|
31
|
+
<line x1="12" y1="8" x2="12.01" y2="8" />
|
|
32
|
+
</svg>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function ValidationAlert({
|
|
38
|
+
title,
|
|
39
|
+
message,
|
|
40
|
+
onClose,
|
|
41
|
+
variant = 'error',
|
|
42
|
+
className,
|
|
43
|
+
}: ValidationAlertProps) {
|
|
44
|
+
return (
|
|
45
|
+
<div
|
|
46
|
+
className={`malix-validation-alert${className ? ` ${className}` : ''}`}
|
|
47
|
+
data-variant={variant}
|
|
48
|
+
role="alert"
|
|
49
|
+
>
|
|
50
|
+
<span className="malix-validation-alert__icon">
|
|
51
|
+
<AlertIcon variant={variant} />
|
|
52
|
+
</span>
|
|
53
|
+
<div className="malix-validation-alert__content">
|
|
54
|
+
<span className="malix-validation-alert__title">{title}</span>
|
|
55
|
+
<span className="malix-validation-alert__message">{message}</span>
|
|
56
|
+
</div>
|
|
57
|
+
{onClose ? (
|
|
58
|
+
<button
|
|
59
|
+
type="button"
|
|
60
|
+
className="malix-validation-alert__close"
|
|
61
|
+
onClick={onClose}
|
|
62
|
+
aria-label="Close"
|
|
63
|
+
>
|
|
64
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
65
|
+
<line x1="18" y1="6" x2="6" y2="18" />
|
|
66
|
+
<line x1="6" y1="6" x2="18" y2="18" />
|
|
67
|
+
</svg>
|
|
68
|
+
</button>
|
|
69
|
+
) : null}
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
export { default as tokenRegistry } from './tokens.registry.json' with { type: 'json' };
|
|
2
|
+
|
|
3
|
+
// Atoms
|
|
4
|
+
export { Divider } from './components/Divider';
|
|
5
|
+
export type { DividerProps } from './components/Divider';
|
|
6
|
+
export { Avatar } from './components/Avatar';
|
|
7
|
+
export type { AvatarProps } from './components/Avatar';
|
|
8
|
+
export { Pill } from './components/Pill';
|
|
9
|
+
export type { PillProps, PillVariant } from './components/Pill';
|
|
10
|
+
|
|
11
|
+
// Button
|
|
12
|
+
export { Button } from './components/Button';
|
|
13
|
+
export type { ButtonProps, ButtonHierarchy, ButtonVariant } from './components/Button';
|
|
14
|
+
|
|
15
|
+
// Inputs
|
|
16
|
+
export { Input, SearchInput } from './components/Input';
|
|
17
|
+
export type { InputProps } from './components/Input';
|
|
18
|
+
export { InputGroup } from './components/InputGroup';
|
|
19
|
+
export type { InputGroupProps } from './components/InputGroup';
|
|
20
|
+
|
|
21
|
+
// Feedback
|
|
22
|
+
export { Tooltip } from './components/Tooltip';
|
|
23
|
+
export type { TooltipProps, TooltipPlacement } from './components/Tooltip';
|
|
24
|
+
|
|
25
|
+
// Navigation
|
|
26
|
+
export { SidebarItem } from './components/SidebarItem';
|
|
27
|
+
export type { SidebarItemProps } from './components/SidebarItem';
|
|
28
|
+
export { FlyoutMenu } from './components/FlyoutMenu';
|
|
29
|
+
export type { FlyoutMenuProps, FlyoutMenuItem } from './components/FlyoutMenu';
|
|
30
|
+
export { SidebarPanel } from './components/SidebarPanel';
|
|
31
|
+
export type { SidebarPanelProps } from './components/SidebarPanel';
|
|
32
|
+
export { Header } from './components/Header';
|
|
33
|
+
export type { HeaderProps } from './components/Header';
|
|
34
|
+
|
|
35
|
+
// Layout
|
|
36
|
+
export { Card } from './components/Card';
|
|
37
|
+
export type { CardProps, CardLevel } from './components/Card';
|
|
38
|
+
|
|
39
|
+
// Data display
|
|
40
|
+
export { StatCard } from './components/StatCard';
|
|
41
|
+
export type { StatCardProps, StatCardChangeType } from './components/StatCard';
|
|
42
|
+
|
|
43
|
+
// Date
|
|
44
|
+
export { DateInput } from './components/DateInput';
|
|
45
|
+
export type { DateInputProps } from './components/DateInput';
|
|
46
|
+
|
|
47
|
+
// Tabs
|
|
48
|
+
export { FilterTabs } from './components/FilterTabs';
|
|
49
|
+
export type { FilterTabsProps, FilterTabItem } from './components/FilterTabs';
|
|
50
|
+
|
|
51
|
+
// Navigation (continued)
|
|
52
|
+
export { Breadcrumb } from './components/Breadcrumb';
|
|
53
|
+
export type { BreadcrumbProps, BreadcrumbItem } from './components/Breadcrumb';
|
|
54
|
+
|
|
55
|
+
// Feedback (continued)
|
|
56
|
+
export { ProgressBar } from './components/ProgressBar';
|
|
57
|
+
export type { ProgressBarProps, ProgressBarVariant } from './components/ProgressBar';
|
|
58
|
+
export { EmptyState } from './components/EmptyState';
|
|
59
|
+
export type { EmptyStateProps } from './components/EmptyState';
|
|
60
|
+
|
|
61
|
+
// Stepper
|
|
62
|
+
export { Stepper } from './components/Stepper';
|
|
63
|
+
export type { StepperProps, StepItem, StepStatus } from './components/Stepper';
|
|
64
|
+
|
|
65
|
+
// Textarea
|
|
66
|
+
export { Textarea } from './components/Textarea';
|
|
67
|
+
export type { TextareaProps } from './components/Textarea';
|
|
68
|
+
|
|
69
|
+
// Chat
|
|
70
|
+
export { ChatInput } from './components/ChatInput';
|
|
71
|
+
export type { ChatInputProps } from './components/ChatInput';
|
|
72
|
+
|
|
73
|
+
// Section / Page structure
|
|
74
|
+
export { SectionHeader } from './components/SectionHeader';
|
|
75
|
+
export type { SectionHeaderProps } from './components/SectionHeader';
|
|
76
|
+
|
|
77
|
+
// File display
|
|
78
|
+
export { FileCard } from './components/FileCard';
|
|
79
|
+
export type { FileCardProps } from './components/FileCard';
|
|
80
|
+
|
|
81
|
+
// Tabs (continued)
|
|
82
|
+
export { TabBar } from './components/TabBar';
|
|
83
|
+
export type { TabBarProps, TabItem } from './components/TabBar';
|
|
84
|
+
|
|
85
|
+
// Status / Alerts
|
|
86
|
+
export { OperationStatus } from './components/OperationStatus';
|
|
87
|
+
export type { OperationStatusProps, OperationStatusType } from './components/OperationStatus';
|
|
88
|
+
export { ValidationAlert } from './components/ValidationAlert';
|
|
89
|
+
export type { ValidationAlertProps, ValidationAlertVariant } from './components/ValidationAlert';
|
|
90
|
+
|
|
91
|
+
// Selection
|
|
92
|
+
export { SelectionCard } from './components/SelectionCard';
|
|
93
|
+
export type { SelectionCardProps } from './components/SelectionCard';
|
|
94
|
+
|
|
95
|
+
// Overlays
|
|
96
|
+
export { Overlay } from './components/Overlay';
|
|
97
|
+
export type { OverlayProps } from './components/Overlay';
|
|
98
|
+
export { Modal } from './components/Modal';
|
|
99
|
+
export type { ModalProps } from './components/Modal';
|
|
100
|
+
export { GlassPopover } from './components/GlassPopover';
|
|
101
|
+
export type { GlassPopoverProps } from './components/GlassPopover';
|
|
102
|
+
|
|
103
|
+
// Accordion
|
|
104
|
+
export { Accordion } from './components/Accordion';
|
|
105
|
+
export type { AccordionProps } from './components/Accordion';
|
|
106
|
+
|
|
107
|
+
// Badge
|
|
108
|
+
export { Badge } from './components/Badge';
|
|
109
|
+
export type { BadgeProps, BadgeVariant } from './components/Badge';
|
|
110
|
+
|
|
111
|
+
// Banner
|
|
112
|
+
export { Banner } from './components/Banner';
|
|
113
|
+
export type { BannerProps, BannerVariant } from './components/Banner';
|
|
114
|
+
|
|
115
|
+
// Checkbox
|
|
116
|
+
export { Checkbox } from './components/Checkbox';
|
|
117
|
+
export type { CheckboxProps } from './components/Checkbox';
|
|
118
|
+
|
|
119
|
+
// Radio
|
|
120
|
+
export { Radio } from './components/Radio';
|
|
121
|
+
export type { RadioProps } from './components/Radio';
|
|
122
|
+
|
|
123
|
+
// Toggle
|
|
124
|
+
export { Toggle } from './components/Toggle';
|
|
125
|
+
export type { ToggleProps } from './components/Toggle';
|
|
126
|
+
|
|
127
|
+
// Select
|
|
128
|
+
export { Select } from './components/Select';
|
|
129
|
+
export type { SelectProps, SelectOption } from './components/Select';
|
|
130
|
+
|
|
131
|
+
// SelectGroup
|
|
132
|
+
export { SelectGroup } from './components/SelectGroup';
|
|
133
|
+
export type { SelectGroupProps } from './components/SelectGroup';
|
|
134
|
+
|
|
135
|
+
// SegmentedControl
|
|
136
|
+
export { SegmentedControl } from './components/SegmentedControl';
|
|
137
|
+
export type { SegmentedControlProps, SegmentedControlItem } from './components/SegmentedControl';
|
|
138
|
+
|
|
139
|
+
// DataTable
|
|
140
|
+
export { DataTable } from './components/DataTable';
|
|
141
|
+
export type { DataTableProps, TableColumn, TableRow } from './components/DataTable';
|
|
142
|
+
|
|
143
|
+
// Pagination
|
|
144
|
+
export { Pagination } from './components/Pagination';
|
|
145
|
+
export type { PaginationProps, PaginationVariant } from './components/Pagination';
|
|
146
|
+
|
|
147
|
+
// StatusDot
|
|
148
|
+
export { StatusDot } from './components/StatusDot';
|
|
149
|
+
export type { StatusDotProps, StatusDotVariant } from './components/StatusDot';
|
|
150
|
+
|
|
151
|
+
// Dropzone
|
|
152
|
+
export { Dropzone } from './components/Dropzone';
|
|
153
|
+
export type { DropzoneProps } from './components/Dropzone';
|
|
154
|
+
|
|
155
|
+
// SplitPane
|
|
156
|
+
export { SplitPane } from './components/SplitPane';
|
|
157
|
+
export type { SplitPaneProps } from './components/SplitPane';
|
|
158
|
+
|
|
159
|
+
// PricingCard
|
|
160
|
+
export { PricingCard } from './components/PricingCard';
|
|
161
|
+
export type { PricingCardProps } from './components/PricingCard';
|
|
162
|
+
|
|
163
|
+
// OnboardingPopover
|
|
164
|
+
export { OnboardingPopover } from './components/OnboardingPopover';
|
|
165
|
+
export type { OnboardingPopoverProps } from './components/OnboardingPopover';
|
|
166
|
+
|
|
167
|
+
// CreditsIndicator
|
|
168
|
+
export { CreditsIndicator } from './components/CreditsIndicator';
|
|
169
|
+
export type { CreditsIndicatorProps } from './components/CreditsIndicator';
|
|
170
|
+
|
|
171
|
+
// LanguageSelector
|
|
172
|
+
export { LanguageSelector } from './components/LanguageSelector';
|
|
173
|
+
export type { LanguageSelectorProps, LanguageSelectorOption } from './components/LanguageSelector';
|
|
174
|
+
|
|
175
|
+
// UserProfilePopover
|
|
176
|
+
export { UserProfilePopover } from './components/UserProfilePopover';
|
|
177
|
+
export type { UserProfilePopoverProps, UserProfileMenuItem } from './components/UserProfilePopover';
|