@jordan-mace/chaser-design-system 1.2.7 → 1.2.8
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/dist/components/Accordion/Accordion.d.ts +5 -6
- package/dist/components/Accordion/Accordion.js +4 -4
- package/dist/components/Alert/Alert.d.ts +2 -1
- package/dist/components/Avatar/Avatar.d.ts +2 -2
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/Badge/Badge.d.ts +3 -2
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +4 -3
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/Button/Button.d.ts +2 -1
- package/dist/components/Card/Card.d.ts +2 -1
- package/dist/components/Checkbox/Checkbox.d.ts +145 -0
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/Collapse/Collapse.d.ts +3 -3
- package/dist/components/Combobox/Combobox.d.ts +3 -2
- package/dist/components/Combobox/Combobox.js +15 -8
- package/dist/components/Container/Container.d.ts +155 -3
- package/dist/components/Divider/Divider.d.ts +3 -2
- package/dist/components/Divider/Divider.js +3 -1
- package/dist/components/Drawer/Drawer.d.ts +4 -2
- package/dist/components/Drawer/Drawer.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +3 -2
- package/dist/components/DropdownMenu/DropdownMenu.js +6 -3
- package/dist/components/EmptyState/EmptyState.d.ts +3 -3
- package/dist/components/EmptyState/EmptyState.js +1 -1
- package/dist/components/FileUpload/FileUpload.d.ts +3 -2
- package/dist/components/FileUpload/FileUpload.js +8 -4
- package/dist/components/Form/Form.d.ts +2 -2
- package/dist/components/Grid/Grid.d.ts +154 -5
- package/dist/components/Grid/Grid.js +4 -4
- package/dist/components/Icon/Icon.d.ts +2 -2
- package/dist/components/Input/Input.d.ts +2 -1
- package/dist/components/Kbd/Kbd.d.ts +3 -3
- package/dist/components/List/List.d.ts +3 -2
- package/dist/components/List/List.js +2 -2
- package/dist/components/List/ListItem.d.ts +3 -2
- package/dist/components/List/ListItem.js +2 -2
- package/dist/components/Modal/Modal.d.ts +4 -2
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Navbar/Navbar.d.ts +2 -1
- package/dist/components/Navbar/NavbarItem.d.ts +2 -1
- package/dist/components/NumberInput/NumberInput.d.ts +3 -2
- package/dist/components/Pagination/Pagination.d.ts +4 -2
- package/dist/components/Pagination/Pagination.js +6 -3
- package/dist/components/Popover/Popover.d.ts +3 -2
- package/dist/components/Popover/Popover.js +2 -1
- package/dist/components/Progress/Progress.d.ts +3 -2
- package/dist/components/Radio/Radio.d.ts +145 -0
- package/dist/components/Radio/Radio.js +1 -1
- package/dist/components/ScrollArea/ScrollArea.d.ts +3 -3
- package/dist/components/Select/Select.d.ts +145 -0
- package/dist/components/Separator/Separator.d.ts +4 -3
- package/dist/components/Separator/Separator.js +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +3 -2
- package/dist/components/Spinner/Spinner.d.ts +3 -2
- package/dist/components/Spinner/Spinner.js +1 -1
- package/dist/components/Stack/Stack.d.ts +156 -5
- package/dist/components/Stepper/Stepper.d.ts +3 -2
- package/dist/components/Table/Table.d.ts +3 -4
- package/dist/components/Table/Table.js +6 -6
- package/dist/components/Tabs/Tabs.d.ts +3 -3
- package/dist/components/Tabs/Tabs.js +2 -2
- package/dist/components/Tag/Tag.d.ts +2 -2
- package/dist/components/Text/Header.d.ts +2 -2
- package/dist/components/Text/P.d.ts +2 -2
- package/dist/components/TextArea/TextArea.d.ts +2 -1
- package/dist/components/Toggle/Toggle.d.ts +3 -2
- package/dist/components/Toggle/Toggle.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +3 -2
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +4 -4
- package/dist/components/VisuallyHidden/VisuallyHidden.js +1 -1
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.tsx +21 -16
- package/src/components/Alert/Alert.tsx +11 -7
- package/src/components/Avatar/Avatar.tsx +16 -14
- package/src/components/Badge/Badge.tsx +8 -6
- package/src/components/Breadcrumb/Breadcrumb.tsx +7 -10
- package/src/components/Button/Button.tsx +9 -11
- package/src/components/Card/Card.tsx +8 -10
- package/src/components/Checkbox/Checkbox.tsx +11 -8
- package/src/components/Collapse/Collapse.tsx +12 -9
- package/src/components/Combobox/Combobox.tsx +60 -31
- package/src/components/Container/Container.tsx +4 -3
- package/src/components/Divider/Divider.tsx +9 -5
- package/src/components/Drawer/Drawer.tsx +20 -13
- package/src/components/DropdownMenu/DropdownMenu.tsx +37 -15
- package/src/components/EmptyState/EmptyState.tsx +9 -12
- package/src/components/FileUpload/FileUpload.tsx +61 -45
- package/src/components/Form/Form.tsx +6 -8
- package/src/components/Grid/Grid.tsx +18 -13
- package/src/components/Icon/Icon.tsx +7 -6
- package/src/components/Input/Input.tsx +7 -8
- package/src/components/Kbd/Kbd.tsx +5 -4
- package/src/components/List/List.tsx +6 -2
- package/src/components/List/ListItem.tsx +6 -2
- package/src/components/Modal/Modal.tsx +16 -5
- package/src/components/Navbar/Navbar.tsx +2 -1
- package/src/components/Navbar/NavbarItem.tsx +2 -1
- package/src/components/NumberInput/NumberInput.tsx +29 -22
- package/src/components/Pagination/Pagination.tsx +39 -28
- package/src/components/Popover/Popover.tsx +37 -21
- package/src/components/Progress/Progress.tsx +39 -38
- package/src/components/Radio/Radio.tsx +12 -6
- package/src/components/ScrollArea/ScrollArea.tsx +9 -10
- package/src/components/Select/Select.tsx +12 -7
- package/src/components/Separator/Separator.tsx +8 -14
- package/src/components/Skeleton/Skeleton.tsx +11 -13
- package/src/components/Spinner/Spinner.tsx +15 -11
- package/src/components/Stack/Stack.tsx +34 -15
- package/src/components/Stepper/Stepper.tsx +19 -17
- package/src/components/Table/Table.tsx +31 -21
- package/src/components/Tabs/Tabs.tsx +14 -10
- package/src/components/Tag/Tag.tsx +8 -7
- package/src/components/Text/Header.tsx +6 -5
- package/src/components/Text/P.tsx +5 -4
- package/src/components/TextArea/TextArea.tsx +7 -8
- package/src/components/Toggle/Toggle.tsx +16 -7
- package/src/components/Tooltip/Tooltip.tsx +16 -11
- package/src/components/VisuallyHidden/VisuallyHidden.tsx +7 -8
|
@@ -7,14 +7,16 @@ import {
|
|
|
7
7
|
} from './styles.css';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import Box from '../Box';
|
|
10
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
10
11
|
|
|
11
12
|
export type DividerOrientation = 'horizontal' | 'vertical';
|
|
12
13
|
export type DividerSize = 'small' | 'medium' | 'large';
|
|
13
14
|
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
export type DividerProps = React.HTMLAttributes<HTMLHRElement> &
|
|
16
|
+
Sprinkles & {
|
|
17
|
+
orientation?: DividerOrientation;
|
|
18
|
+
size?: DividerSize;
|
|
19
|
+
};
|
|
18
20
|
|
|
19
21
|
const Divider = ({
|
|
20
22
|
orientation = 'horizontal',
|
|
@@ -27,7 +29,9 @@ const Divider = ({
|
|
|
27
29
|
className={clsx(
|
|
28
30
|
divider,
|
|
29
31
|
dividerOrientations[orientation],
|
|
30
|
-
orientation === 'vertical'
|
|
32
|
+
orientation === 'vertical'
|
|
33
|
+
? dividerVerticalSizes[size]
|
|
34
|
+
: dividerSizes[size],
|
|
31
35
|
props.className,
|
|
32
36
|
)}
|
|
33
37
|
role="separator"
|
|
@@ -11,10 +11,25 @@ import {
|
|
|
11
11
|
drawerFooter,
|
|
12
12
|
} from './styles.css';
|
|
13
13
|
import Box from '../Box';
|
|
14
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
14
15
|
|
|
15
16
|
export type DrawerPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
16
17
|
export type DrawerSize = 'small' | 'medium' | 'large' | 'full';
|
|
17
18
|
|
|
19
|
+
type DrawerPropsBase = React.HTMLAttributes<HTMLDivElement> & {
|
|
20
|
+
isOpen: boolean;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
title?: string;
|
|
23
|
+
position?: DrawerPosition;
|
|
24
|
+
size?: DrawerSize;
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
footer?: React.ReactNode;
|
|
27
|
+
showCloseButton?: boolean;
|
|
28
|
+
closeOnOverlayClick?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type DrawerProps = DrawerPropsBase & Sprinkles;
|
|
32
|
+
|
|
18
33
|
const sizeMap: Record<DrawerPosition, Record<DrawerSize, string>> = {
|
|
19
34
|
left: {
|
|
20
35
|
small: '250px',
|
|
@@ -42,18 +57,6 @@ const sizeMap: Record<DrawerPosition, Record<DrawerSize, string>> = {
|
|
|
42
57
|
},
|
|
43
58
|
};
|
|
44
59
|
|
|
45
|
-
export interface DrawerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
46
|
-
isOpen: boolean;
|
|
47
|
-
onClose: () => void;
|
|
48
|
-
title?: string;
|
|
49
|
-
position?: DrawerPosition;
|
|
50
|
-
size?: DrawerSize;
|
|
51
|
-
children?: React.ReactNode;
|
|
52
|
-
footer?: React.ReactNode;
|
|
53
|
-
showCloseButton?: boolean;
|
|
54
|
-
closeOnOverlayClick?: boolean;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
60
|
const Drawer = ({
|
|
58
61
|
isOpen,
|
|
59
62
|
onClose,
|
|
@@ -139,7 +142,11 @@ const Drawer = ({
|
|
|
139
142
|
{children}
|
|
140
143
|
</Box>
|
|
141
144
|
|
|
142
|
-
{footer &&
|
|
145
|
+
{footer && (
|
|
146
|
+
<Box as="div" className={drawerFooter}>
|
|
147
|
+
{footer}
|
|
148
|
+
</Box>
|
|
149
|
+
)}
|
|
143
150
|
</Box>
|
|
144
151
|
</>
|
|
145
152
|
);
|
|
@@ -12,8 +12,13 @@ import {
|
|
|
12
12
|
dropdownMenuLabel,
|
|
13
13
|
} from './styles.css';
|
|
14
14
|
import Box from '../Box';
|
|
15
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
15
16
|
|
|
16
|
-
export type DropdownMenuPosition =
|
|
17
|
+
export type DropdownMenuPosition =
|
|
18
|
+
| 'bottomLeft'
|
|
19
|
+
| 'bottomRight'
|
|
20
|
+
| 'topLeft'
|
|
21
|
+
| 'topRight';
|
|
17
22
|
export type DropdownMenuItemVariant = 'default' | 'destructive' | 'disabled';
|
|
18
23
|
|
|
19
24
|
export interface DropdownMenuItemProps {
|
|
@@ -29,13 +34,14 @@ export interface DropdownMenuGroupProps {
|
|
|
29
34
|
items: DropdownMenuItemProps[];
|
|
30
35
|
}
|
|
31
36
|
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
export type DropdownMenuProps = React.HTMLAttributes<HTMLDivElement> &
|
|
38
|
+
Sprinkles & {
|
|
39
|
+
trigger: React.ReactNode;
|
|
40
|
+
items?: DropdownMenuItemProps[];
|
|
41
|
+
groups?: DropdownMenuGroupProps[];
|
|
42
|
+
position?: DropdownMenuPosition;
|
|
43
|
+
closeOnItemClick?: boolean;
|
|
44
|
+
};
|
|
39
45
|
|
|
40
46
|
const DropdownMenu = ({
|
|
41
47
|
trigger,
|
|
@@ -51,7 +57,10 @@ const DropdownMenu = ({
|
|
|
51
57
|
|
|
52
58
|
useEffect(() => {
|
|
53
59
|
const handleClickOutside = (event: MouseEvent) => {
|
|
54
|
-
if (
|
|
60
|
+
if (
|
|
61
|
+
containerRef.current &&
|
|
62
|
+
!containerRef.current.contains(event.target as Node)
|
|
63
|
+
) {
|
|
55
64
|
setIsOpen(false);
|
|
56
65
|
}
|
|
57
66
|
};
|
|
@@ -78,7 +87,7 @@ const DropdownMenu = ({
|
|
|
78
87
|
|
|
79
88
|
const handleItemClick = (item: DropdownMenuItemProps) => {
|
|
80
89
|
if (item.disabled || item.variant === 'disabled') return;
|
|
81
|
-
|
|
90
|
+
|
|
82
91
|
item.onClick?.();
|
|
83
92
|
if (closeOnItemClick) {
|
|
84
93
|
setIsOpen(false);
|
|
@@ -91,7 +100,11 @@ const DropdownMenu = ({
|
|
|
91
100
|
as="button"
|
|
92
101
|
className={clsx(
|
|
93
102
|
dropdownMenuItem,
|
|
94
|
-
dropdownMenuItemVariants[
|
|
103
|
+
dropdownMenuItemVariants[
|
|
104
|
+
item.disabled || item.variant === 'disabled'
|
|
105
|
+
? 'disabled'
|
|
106
|
+
: item.variant || 'default'
|
|
107
|
+
],
|
|
95
108
|
)}
|
|
96
109
|
onClick={() => handleItemClick(item)}
|
|
97
110
|
disabled={item.disabled || item.variant === 'disabled'}
|
|
@@ -128,10 +141,13 @@ const DropdownMenu = ({
|
|
|
128
141
|
>
|
|
129
142
|
{trigger}
|
|
130
143
|
</Box>
|
|
131
|
-
|
|
144
|
+
|
|
132
145
|
{isOpen && (
|
|
133
146
|
<Box
|
|
134
|
-
className={clsx(
|
|
147
|
+
className={clsx(
|
|
148
|
+
dropdownMenuContent,
|
|
149
|
+
dropdownMenuPositionVariants[position],
|
|
150
|
+
)}
|
|
135
151
|
role="menu"
|
|
136
152
|
aria-orientation="vertical"
|
|
137
153
|
>
|
|
@@ -140,10 +156,16 @@ const DropdownMenu = ({
|
|
|
140
156
|
{items.map((item, index) => renderItem(item, index))}
|
|
141
157
|
</Box>
|
|
142
158
|
)}
|
|
143
|
-
|
|
159
|
+
|
|
144
160
|
{groups.map((group, index) => (
|
|
145
161
|
<React.Fragment key={index}>
|
|
146
|
-
{index > 0 &&
|
|
162
|
+
{index > 0 && (
|
|
163
|
+
<Box
|
|
164
|
+
as="div"
|
|
165
|
+
className={dropdownMenuSeparator}
|
|
166
|
+
role="separator"
|
|
167
|
+
/>
|
|
168
|
+
)}
|
|
147
169
|
{renderGroup(group, index)}
|
|
148
170
|
</React.Fragment>
|
|
149
171
|
))}
|
|
@@ -8,14 +8,15 @@ import {
|
|
|
8
8
|
emptyStateAction,
|
|
9
9
|
} from './styles.css';
|
|
10
10
|
import Box from '../Box';
|
|
11
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
11
12
|
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
export type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> &
|
|
14
|
+
Sprinkles & {
|
|
15
|
+
icon?: React.ReactNode;
|
|
16
|
+
title?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
action?: React.ReactNode;
|
|
19
|
+
};
|
|
19
20
|
|
|
20
21
|
const EmptyState = ({
|
|
21
22
|
icon,
|
|
@@ -41,11 +42,7 @@ const EmptyState = ({
|
|
|
41
42
|
{description}
|
|
42
43
|
</Box>
|
|
43
44
|
)}
|
|
44
|
-
{action &&
|
|
45
|
-
<Box className={emptyStateAction}>
|
|
46
|
-
{action}
|
|
47
|
-
</Box>
|
|
48
|
-
)}
|
|
45
|
+
{action && <Box className={emptyStateAction}>{action}</Box>}
|
|
49
46
|
</Box>
|
|
50
47
|
);
|
|
51
48
|
};
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
fileUploadProgressFillVariants,
|
|
22
22
|
} from './styles.css';
|
|
23
23
|
import Box from '../Box';
|
|
24
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
24
25
|
|
|
25
26
|
export interface FileUploadFile {
|
|
26
27
|
id: string;
|
|
@@ -32,21 +33,22 @@ export interface FileUploadFile {
|
|
|
32
33
|
errorMessage?: string;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
export type FileUploadProps = React.HTMLAttributes<HTMLDivElement> &
|
|
37
|
+
Sprinkles & {
|
|
38
|
+
label?: string;
|
|
39
|
+
files?: FileUploadFile[];
|
|
40
|
+
onFilesChange?: (files: FileUploadFile[]) => void;
|
|
41
|
+
onFileAdd?: (files: File[]) => void;
|
|
42
|
+
onFileRemove?: (fileId: string) => void;
|
|
43
|
+
accept?: string;
|
|
44
|
+
multiple?: boolean;
|
|
45
|
+
maxFileSize?: number;
|
|
46
|
+
maxFiles?: number;
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
dropzoneText?: string;
|
|
49
|
+
hint?: string;
|
|
50
|
+
showProgress?: boolean;
|
|
51
|
+
};
|
|
50
52
|
|
|
51
53
|
const formatFileSize = (bytes: number): string => {
|
|
52
54
|
if (bytes === 0) return '0 Bytes';
|
|
@@ -82,8 +84,8 @@ const FileUpload = ({
|
|
|
82
84
|
return `File size exceeds ${formatFileSize(maxFileSize)}`;
|
|
83
85
|
}
|
|
84
86
|
if (accept) {
|
|
85
|
-
const acceptedTypes = accept.split(',').map(type => type.trim());
|
|
86
|
-
const isAccepted = acceptedTypes.some(type => {
|
|
87
|
+
const acceptedTypes = accept.split(',').map((type) => type.trim());
|
|
88
|
+
const isAccepted = acceptedTypes.some((type) => {
|
|
87
89
|
if (type.includes('*')) {
|
|
88
90
|
return file.type.startsWith(type.replace('/*', ''));
|
|
89
91
|
}
|
|
@@ -96,36 +98,39 @@ const FileUpload = ({
|
|
|
96
98
|
return null;
|
|
97
99
|
};
|
|
98
100
|
|
|
99
|
-
const handleFiles = useCallback(
|
|
100
|
-
|
|
101
|
+
const handleFiles = useCallback(
|
|
102
|
+
(fileList: FileList | null) => {
|
|
103
|
+
if (!fileList || disabled) return;
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
const newFiles: File[] = [];
|
|
106
|
+
const errors: string[] = [];
|
|
104
107
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
Array.from(fileList).forEach((file) => {
|
|
109
|
+
const validationError = validateFile(file);
|
|
110
|
+
if (validationError) {
|
|
111
|
+
errors.push(`${file.name}: ${validationError}`);
|
|
112
|
+
} else {
|
|
113
|
+
newFiles.push(file);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
113
116
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
if (maxFiles && files.length + newFiles.length > maxFiles) {
|
|
118
|
+
errors.push(`Maximum ${maxFiles} files allowed`);
|
|
119
|
+
newFiles.splice(maxFiles - files.length);
|
|
120
|
+
}
|
|
118
121
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
if (errors.length > 0) {
|
|
123
|
+
setError(errors.join(', '));
|
|
124
|
+
} else {
|
|
125
|
+
setError(null);
|
|
126
|
+
}
|
|
124
127
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
if (newFiles.length > 0) {
|
|
129
|
+
onFileAdd?.(newFiles);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
[disabled, files.length, maxFileSize, maxFiles, accept, onFileAdd],
|
|
133
|
+
);
|
|
129
134
|
|
|
130
135
|
const handleDragOver = (e: React.DragEvent) => {
|
|
131
136
|
e.preventDefault();
|
|
@@ -190,7 +195,14 @@ const FileUpload = ({
|
|
|
190
195
|
aria-disabled={disabled}
|
|
191
196
|
>
|
|
192
197
|
<Box className={fileUploadIcon} aria-hidden="true">
|
|
193
|
-
<svg
|
|
198
|
+
<svg
|
|
199
|
+
width="48"
|
|
200
|
+
height="48"
|
|
201
|
+
viewBox="0 0 24 24"
|
|
202
|
+
fill="none"
|
|
203
|
+
stroke="currentColor"
|
|
204
|
+
strokeWidth="2"
|
|
205
|
+
>
|
|
194
206
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
|
|
195
207
|
<polyline points="17,8 12,3 7,8" />
|
|
196
208
|
<line x1="12" y1="3" x2="12" y2="15" />
|
|
@@ -233,9 +245,13 @@ const FileUpload = ({
|
|
|
233
245
|
</Box>
|
|
234
246
|
<Box as="p" className={fileUploadItemSize}>
|
|
235
247
|
{formatFileSize(file.size)}
|
|
236
|
-
{file.status === 'uploading' &&
|
|
248
|
+
{file.status === 'uploading' &&
|
|
249
|
+
showProgress &&
|
|
250
|
+
' • Uploading...'}
|
|
237
251
|
{file.status === 'success' && ' • Complete'}
|
|
238
|
-
{file.status === 'error' &&
|
|
252
|
+
{file.status === 'error' &&
|
|
253
|
+
file.errorMessage &&
|
|
254
|
+
` • ${file.errorMessage}`}
|
|
239
255
|
</Box>
|
|
240
256
|
{showProgress && file.status === 'uploading' && (
|
|
241
257
|
<Box className={fileUploadProgressBar}>
|
|
@@ -2,11 +2,12 @@ import clsx from 'clsx';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { formStyle } from './styles.css';
|
|
4
4
|
import Box from '../Box';
|
|
5
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
5
6
|
|
|
6
|
-
type FormProps = React.FormHTMLAttributes<HTMLFormElement> &
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
7
|
+
type FormProps = React.FormHTMLAttributes<HTMLFormElement> &
|
|
8
|
+
Sprinkles & {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
};
|
|
10
11
|
|
|
11
12
|
const Form = (props: FormProps) => {
|
|
12
13
|
return (
|
|
@@ -14,10 +15,7 @@ const Form = (props: FormProps) => {
|
|
|
14
15
|
as="form"
|
|
15
16
|
gap="medium"
|
|
16
17
|
paddingX="large"
|
|
17
|
-
className={clsx(
|
|
18
|
-
formStyle,
|
|
19
|
-
props.className,
|
|
20
|
-
)}
|
|
18
|
+
className={clsx(formStyle, props.className)}
|
|
21
19
|
{...props}
|
|
22
20
|
>
|
|
23
21
|
{props.children}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import Box from '../Box';
|
|
3
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
4
|
|
|
4
5
|
export type GridColumns = 1 | 2 | 3 | 4 | 5 | 6 | 12;
|
|
5
6
|
export type GridGap = 'none' | 'small' | 'medium' | 'large';
|
|
6
7
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
8
|
+
export type GridProps = React.HTMLAttributes<HTMLDivElement> &
|
|
9
|
+
Sprinkles & {
|
|
10
|
+
columns?: GridColumns;
|
|
11
|
+
gap?: GridGap;
|
|
12
|
+
minChildWidth?: string;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
};
|
|
15
15
|
|
|
16
16
|
const gapMap: Record<GridGap, string> = {
|
|
17
17
|
none: '0',
|
|
@@ -21,7 +21,7 @@ const gapMap: Record<GridGap, string> = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const Grid = forwardRef<HTMLElement, GridProps>(
|
|
24
|
-
({ columns, gap = 'medium', minChildWidth, children,
|
|
24
|
+
({ columns, gap = 'medium', minChildWidth, children, ...props }, ref) => {
|
|
25
25
|
const gapValue: GridGap = gap;
|
|
26
26
|
|
|
27
27
|
const gridStyle: React.CSSProperties = {
|
|
@@ -30,17 +30,22 @@ const Grid = forwardRef<HTMLElement, GridProps>(
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
if (minChildWidth) {
|
|
33
|
-
gridStyle.gridTemplateColumns = `repeat(auto-fit, minmax(${minChildWidth},
|
|
33
|
+
gridStyle.gridTemplateColumns = `repeat(auto-fit, minmax(${minChildWidth},1fr))`;
|
|
34
34
|
} else if (columns) {
|
|
35
|
-
gridStyle.gridTemplateColumns = `repeat(${columns},
|
|
35
|
+
gridStyle.gridTemplateColumns = `repeat(${columns},1fr)`;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
|
-
<Box
|
|
39
|
+
<Box
|
|
40
|
+
ref={ref}
|
|
41
|
+
className={props.className}
|
|
42
|
+
style={{ ...gridStyle, ...props.style }}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
40
45
|
{children}
|
|
41
46
|
</Box>
|
|
42
47
|
);
|
|
43
|
-
}
|
|
48
|
+
},
|
|
44
49
|
);
|
|
45
50
|
|
|
46
51
|
Grid.displayName = 'Grid';
|
|
@@ -2,13 +2,14 @@ import clsx from 'clsx';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { icon } from './styles.css';
|
|
4
4
|
import Box from '../Box';
|
|
5
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
5
6
|
|
|
6
|
-
type IconProps =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
7
|
+
type IconProps = React.HTMLAttributes<HTMLSpanElement> &
|
|
8
|
+
Sprinkles & {
|
|
9
|
+
name?: string;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
color?: string;
|
|
12
|
+
};
|
|
12
13
|
|
|
13
14
|
const IconComponent = ({ name, children, className, color }: IconProps) => {
|
|
14
15
|
const iconMap: Record<string, string> = {
|
|
@@ -3,11 +3,13 @@ import React from 'react';
|
|
|
3
3
|
import { inputStyle, label } from './styles.css';
|
|
4
4
|
import { text } from '../Text/styles.css';
|
|
5
5
|
import Box from '../Box';
|
|
6
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
6
7
|
|
|
7
|
-
export type InputProps = React.InputHTMLAttributes<HTMLInputElement> &
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export type InputProps = React.InputHTMLAttributes<HTMLInputElement> &
|
|
9
|
+
Sprinkles & {
|
|
10
|
+
label?: string;
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
};
|
|
11
13
|
|
|
12
14
|
const Input = (props: InputProps) => {
|
|
13
15
|
return (
|
|
@@ -19,10 +21,7 @@ const Input = (props: InputProps) => {
|
|
|
19
21
|
{props.label && (
|
|
20
22
|
<Box
|
|
21
23
|
as="label"
|
|
22
|
-
className={clsx(
|
|
23
|
-
text,
|
|
24
|
-
label,
|
|
25
|
-
)}
|
|
24
|
+
className={clsx(text, label)}
|
|
26
25
|
marginX={{ mobile: 'auto', tablet: 'none' }}
|
|
27
26
|
marginY={{ mobile: 'none', tablet: 'auto' }}
|
|
28
27
|
htmlFor={props.id}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { kbd } from './styles.css';
|
|
3
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
5
|
+
export type KbdProps = React.HTMLAttributes<HTMLElement> &
|
|
6
|
+
Sprinkles & {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
};
|
|
8
9
|
|
|
9
10
|
const Kbd = ({ children, className, ...props }: KbdProps) => {
|
|
10
11
|
return (
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { list } from './styles.css';
|
|
3
3
|
import Box from '../Box';
|
|
4
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
4
5
|
|
|
5
|
-
const List = ({
|
|
6
|
+
const List = ({
|
|
7
|
+
children,
|
|
8
|
+
...props
|
|
9
|
+
}: { children: React.ReactNode } & Sprinkles) => {
|
|
6
10
|
return (
|
|
7
|
-
<Box as="ul" className={list}>
|
|
11
|
+
<Box as="ul" className={list} {...props}>
|
|
8
12
|
{children}
|
|
9
13
|
</Box>
|
|
10
14
|
);
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { listItem } from './styles.css';
|
|
3
3
|
import Box from '../Box';
|
|
4
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
4
5
|
|
|
5
|
-
const ListItem = ({
|
|
6
|
+
const ListItem = ({
|
|
7
|
+
children,
|
|
8
|
+
...props
|
|
9
|
+
}: { children: React.ReactNode } & Sprinkles) => {
|
|
6
10
|
return (
|
|
7
|
-
<Box as="li" className={listItem}>
|
|
11
|
+
<Box as="li" className={listItem} {...props}>
|
|
8
12
|
{children}
|
|
9
13
|
</Box>
|
|
10
14
|
);
|
|
@@ -10,10 +10,11 @@ import {
|
|
|
10
10
|
} from './styles.css';
|
|
11
11
|
import React, { useEffect, useRef } from 'react';
|
|
12
12
|
import Box from '../Box';
|
|
13
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
13
14
|
|
|
14
15
|
export type ModalSize = 'small' | 'medium' | 'large' | 'full';
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
type ModalPropsType = React.HTMLAttributes<HTMLDialogElement> & {
|
|
17
18
|
isOpen: boolean;
|
|
18
19
|
onClose: () => void;
|
|
19
20
|
title?: string;
|
|
@@ -21,7 +22,9 @@ export interface ModalProps extends React.HTMLAttributes<HTMLDialogElement> {
|
|
|
21
22
|
children?: React.ReactNode;
|
|
22
23
|
footer?: React.ReactNode;
|
|
23
24
|
showCloseButton?: boolean;
|
|
24
|
-
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type ModalProps = ModalPropsType & Sprinkles;
|
|
25
28
|
|
|
26
29
|
interface DialogMethods {
|
|
27
30
|
showModal: () => void;
|
|
@@ -84,7 +87,9 @@ const Modal = ({
|
|
|
84
87
|
>
|
|
85
88
|
{title && (
|
|
86
89
|
<Box as="div" className={modalHeader}>
|
|
87
|
-
<Box as="h2" className={modalTitle}>
|
|
90
|
+
<Box as="h2" className={modalTitle}>
|
|
91
|
+
{title}
|
|
92
|
+
</Box>
|
|
88
93
|
{showCloseButton && (
|
|
89
94
|
<Box
|
|
90
95
|
as="button"
|
|
@@ -99,9 +104,15 @@ const Modal = ({
|
|
|
99
104
|
</Box>
|
|
100
105
|
)}
|
|
101
106
|
|
|
102
|
-
<Box as="div" className={modalBody}>
|
|
107
|
+
<Box as="div" className={modalBody}>
|
|
108
|
+
{children}
|
|
109
|
+
</Box>
|
|
103
110
|
|
|
104
|
-
{footer &&
|
|
111
|
+
{footer && (
|
|
112
|
+
<Box as="div" className={modalFooter}>
|
|
113
|
+
{footer}
|
|
114
|
+
</Box>
|
|
115
|
+
)}
|
|
105
116
|
</Box>
|
|
106
117
|
);
|
|
107
118
|
};
|
|
@@ -2,8 +2,9 @@ import clsx from 'clsx';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { navbarStyle } from './styles.css';
|
|
4
4
|
import Box from '../Box';
|
|
5
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
5
6
|
|
|
6
|
-
type NavbarProps = React.HTMLAttributes<HTMLElement> & {
|
|
7
|
+
type NavbarProps = React.HTMLAttributes<HTMLElement> & Sprinkles & {
|
|
7
8
|
children?: React.ReactNode;
|
|
8
9
|
};
|
|
9
10
|
|
|
@@ -2,8 +2,9 @@ import clsx from 'clsx';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { navbarItemStyle } from './styles.css';
|
|
4
4
|
import Box from '../Box';
|
|
5
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
5
6
|
|
|
6
|
-
type NavbarItemProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
type NavbarItemProps = React.HTMLAttributes<HTMLDivElement> & Sprinkles & {
|
|
7
8
|
children?: React.ReactNode;
|
|
8
9
|
};
|
|
9
10
|
|