@jordan-mace/chaser-design-system 1.2.6 → 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
- package/src/styles/reset.css.ts +41 -27
|
@@ -13,25 +13,30 @@ import {
|
|
|
13
13
|
numberInputErrorMessage,
|
|
14
14
|
} from './styles.css';
|
|
15
15
|
import Box from '../Box';
|
|
16
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
16
17
|
|
|
17
18
|
export type NumberInputPosition = 'right' | 'left';
|
|
18
19
|
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
value
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
export type NumberInputProps = Omit<
|
|
21
|
+
React.InputHTMLAttributes<HTMLInputElement>,
|
|
22
|
+
'onChange' | 'value' | 'min' | 'max'
|
|
23
|
+
> &
|
|
24
|
+
Sprinkles & {
|
|
25
|
+
label?: string;
|
|
26
|
+
value?: number | '';
|
|
27
|
+
onChange?: (value: number | '') => void;
|
|
28
|
+
min?: number;
|
|
29
|
+
max?: number;
|
|
30
|
+
step?: number;
|
|
31
|
+
stepperPosition?: NumberInputPosition;
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
hint?: string;
|
|
34
|
+
error?: boolean;
|
|
35
|
+
errorMessage?: string;
|
|
36
|
+
fullWidth?: boolean;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
allowEmpty?: boolean;
|
|
39
|
+
};
|
|
35
40
|
|
|
36
41
|
const NumberInput = ({
|
|
37
42
|
label,
|
|
@@ -53,7 +58,7 @@ const NumberInput = ({
|
|
|
53
58
|
}: NumberInputProps) => {
|
|
54
59
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
55
60
|
const inputValue = e.target.value;
|
|
56
|
-
|
|
61
|
+
|
|
57
62
|
if (inputValue === '') {
|
|
58
63
|
if (allowEmpty) {
|
|
59
64
|
onChange?.('');
|
|
@@ -62,7 +67,7 @@ const NumberInput = ({
|
|
|
62
67
|
}
|
|
63
68
|
return;
|
|
64
69
|
}
|
|
65
|
-
|
|
70
|
+
|
|
66
71
|
const numValue = parseFloat(inputValue);
|
|
67
72
|
if (!isNaN(numValue)) {
|
|
68
73
|
const clampedValue = Math.min(Math.max(numValue, min), max);
|
|
@@ -82,8 +87,10 @@ const NumberInput = ({
|
|
|
82
87
|
onChange?.(newValue);
|
|
83
88
|
}, [value, step, min, onChange]);
|
|
84
89
|
|
|
85
|
-
const isIncrementDisabled =
|
|
86
|
-
|
|
90
|
+
const isIncrementDisabled =
|
|
91
|
+
disabled || (typeof value === 'number' && value >= max);
|
|
92
|
+
const isDecrementDisabled =
|
|
93
|
+
disabled || (typeof value === 'number' && value <= min);
|
|
87
94
|
|
|
88
95
|
const displayValue = value === '' ? '' : value;
|
|
89
96
|
|
|
@@ -94,7 +101,7 @@ const NumberInput = ({
|
|
|
94
101
|
{label}
|
|
95
102
|
</Box>
|
|
96
103
|
)}
|
|
97
|
-
|
|
104
|
+
|
|
98
105
|
<Box className={numberInputContainer}>
|
|
99
106
|
<Box
|
|
100
107
|
as="input"
|
|
@@ -113,7 +120,7 @@ const NumberInput = ({
|
|
|
113
120
|
)}
|
|
114
121
|
{...props}
|
|
115
122
|
/>
|
|
116
|
-
|
|
123
|
+
|
|
117
124
|
<Box
|
|
118
125
|
className={clsx(
|
|
119
126
|
numberInputStepper,
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
paginationContainer,
|
|
5
|
+
pageButton,
|
|
6
|
+
pageButtonVariants,
|
|
7
|
+
ellipsis,
|
|
8
|
+
} from './styles.css';
|
|
4
9
|
import Box from '../Box';
|
|
10
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
5
11
|
|
|
6
|
-
export type PaginationProps =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
export type PaginationProps = React.HTMLAttributes<HTMLDivElement> &
|
|
13
|
+
Sprinkles & {
|
|
14
|
+
currentPage: number;
|
|
15
|
+
totalPages: number;
|
|
16
|
+
onPageChange: (page: number) => void;
|
|
17
|
+
siblingCount?: number;
|
|
18
|
+
showFirstLast?: boolean;
|
|
19
|
+
showPrevNext?: boolean;
|
|
20
|
+
};
|
|
14
21
|
|
|
15
22
|
const Pagination = ({
|
|
16
23
|
currentPage,
|
|
@@ -19,23 +26,24 @@ const Pagination = ({
|
|
|
19
26
|
siblingCount = 1,
|
|
20
27
|
showFirstLast = true,
|
|
21
28
|
showPrevNext = true,
|
|
29
|
+
...props
|
|
22
30
|
}: PaginationProps) => {
|
|
23
31
|
const generatePageNumbers = () => {
|
|
24
32
|
const pages: (number | string)[] = [];
|
|
25
|
-
|
|
33
|
+
|
|
26
34
|
const leftSiblingIndex = Math.max(currentPage - siblingCount, 1);
|
|
27
35
|
const rightSiblingIndex = Math.min(currentPage + siblingCount, totalPages);
|
|
28
|
-
|
|
36
|
+
|
|
29
37
|
const shouldShowLeftEllipsis = leftSiblingIndex > 2;
|
|
30
38
|
const shouldShowRightEllipsis = rightSiblingIndex < totalPages - 1;
|
|
31
|
-
|
|
39
|
+
|
|
32
40
|
if (totalPages <= 7) {
|
|
33
41
|
for (let i = 1; i <= totalPages; i++) {
|
|
34
42
|
pages.push(i);
|
|
35
43
|
}
|
|
36
44
|
} else {
|
|
37
45
|
pages.push(1);
|
|
38
|
-
|
|
46
|
+
|
|
39
47
|
if (shouldShowLeftEllipsis) {
|
|
40
48
|
pages.push('left-ellipsis');
|
|
41
49
|
} else if (currentPage > 3) {
|
|
@@ -43,13 +51,13 @@ const Pagination = ({
|
|
|
43
51
|
pages.push(i);
|
|
44
52
|
}
|
|
45
53
|
}
|
|
46
|
-
|
|
54
|
+
|
|
47
55
|
for (let i = leftSiblingIndex; i <= rightSiblingIndex; i++) {
|
|
48
56
|
if (i !== 1 && i !== totalPages) {
|
|
49
57
|
pages.push(i);
|
|
50
58
|
}
|
|
51
59
|
}
|
|
52
|
-
|
|
60
|
+
|
|
53
61
|
if (shouldShowRightEllipsis) {
|
|
54
62
|
pages.push('right-ellipsis');
|
|
55
63
|
} else if (currentPage < totalPages - 2) {
|
|
@@ -57,17 +65,18 @@ const Pagination = ({
|
|
|
57
65
|
pages.push(i);
|
|
58
66
|
}
|
|
59
67
|
}
|
|
60
|
-
|
|
68
|
+
|
|
61
69
|
pages.push(totalPages);
|
|
62
70
|
}
|
|
63
|
-
|
|
71
|
+
|
|
64
72
|
return pages;
|
|
65
73
|
};
|
|
66
|
-
|
|
74
|
+
|
|
67
75
|
const pages = generatePageNumbers();
|
|
68
|
-
|
|
76
|
+
const { className, ...restProps } = props;
|
|
77
|
+
|
|
69
78
|
return (
|
|
70
|
-
<Box className={paginationContainer}>
|
|
79
|
+
<Box className={clsx(paginationContainer, className)} {...restProps}>
|
|
71
80
|
{showFirstLast && (
|
|
72
81
|
<Box
|
|
73
82
|
as="button"
|
|
@@ -78,7 +87,7 @@ const Pagination = ({
|
|
|
78
87
|
{'<<'}
|
|
79
88
|
</Box>
|
|
80
89
|
)}
|
|
81
|
-
|
|
90
|
+
|
|
82
91
|
{showPrevNext && (
|
|
83
92
|
<Box
|
|
84
93
|
as="button"
|
|
@@ -89,15 +98,17 @@ const Pagination = ({
|
|
|
89
98
|
{'<'}
|
|
90
99
|
</Box>
|
|
91
100
|
)}
|
|
92
|
-
|
|
93
|
-
{pages.map((page, index) =>
|
|
101
|
+
|
|
102
|
+
{pages.map((page, index) =>
|
|
94
103
|
typeof page === 'number' ? (
|
|
95
104
|
<Box
|
|
96
105
|
key={`page-${page}`}
|
|
97
106
|
as="button"
|
|
98
107
|
className={clsx(
|
|
99
108
|
pageButton,
|
|
100
|
-
page === currentPage
|
|
109
|
+
page === currentPage
|
|
110
|
+
? pageButtonVariants.active
|
|
111
|
+
: pageButtonVariants.default,
|
|
101
112
|
)}
|
|
102
113
|
onClick={() => onPageChange(page)}
|
|
103
114
|
>
|
|
@@ -107,9 +118,9 @@ const Pagination = ({
|
|
|
107
118
|
<Box key={`${page}-${index}`} className={ellipsis}>
|
|
108
119
|
...
|
|
109
120
|
</Box>
|
|
110
|
-
)
|
|
111
|
-
)
|
|
112
|
-
|
|
121
|
+
),
|
|
122
|
+
)}
|
|
123
|
+
|
|
113
124
|
{showPrevNext && (
|
|
114
125
|
<Box
|
|
115
126
|
as="button"
|
|
@@ -120,7 +131,7 @@ const Pagination = ({
|
|
|
120
131
|
{'>'}
|
|
121
132
|
</Box>
|
|
122
133
|
)}
|
|
123
|
-
|
|
134
|
+
|
|
124
135
|
{showFirstLast && (
|
|
125
136
|
<Box
|
|
126
137
|
as="button"
|
|
@@ -14,23 +14,33 @@ import {
|
|
|
14
14
|
popoverFooter,
|
|
15
15
|
} from './styles.css';
|
|
16
16
|
import Box from '../Box';
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
18
|
+
|
|
19
|
+
export type PopoverPosition =
|
|
20
|
+
| 'top'
|
|
21
|
+
| 'bottom'
|
|
22
|
+
| 'left'
|
|
23
|
+
| 'right'
|
|
24
|
+
| 'topLeft'
|
|
25
|
+
| 'topRight'
|
|
26
|
+
| 'bottomLeft'
|
|
27
|
+
| 'bottomRight';
|
|
19
28
|
export type PopoverTriggerType = 'click' | 'hover';
|
|
20
29
|
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
export type PopoverProps = React.HTMLAttributes<HTMLDivElement> &
|
|
31
|
+
Sprinkles & {
|
|
32
|
+
trigger: React.ReactNode;
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
position?: PopoverPosition;
|
|
35
|
+
title?: string;
|
|
36
|
+
footer?: React.ReactNode;
|
|
37
|
+
showArrow?: boolean;
|
|
38
|
+
triggerType?: PopoverTriggerType;
|
|
39
|
+
closeOnClickOutside?: boolean;
|
|
40
|
+
closeOnEscape?: boolean;
|
|
41
|
+
defaultOpen?: boolean;
|
|
42
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
43
|
+
};
|
|
34
44
|
|
|
35
45
|
const Popover = ({
|
|
36
46
|
trigger,
|
|
@@ -58,7 +68,10 @@ const Popover = ({
|
|
|
58
68
|
if (!closeOnClickOutside) return;
|
|
59
69
|
|
|
60
70
|
const handleClickOutside = (event: MouseEvent) => {
|
|
61
|
-
if (
|
|
71
|
+
if (
|
|
72
|
+
containerRef.current &&
|
|
73
|
+
!containerRef.current.contains(event.target as Node)
|
|
74
|
+
) {
|
|
62
75
|
setIsOpen(false);
|
|
63
76
|
}
|
|
64
77
|
};
|
|
@@ -118,7 +131,7 @@ const Popover = ({
|
|
|
118
131
|
>
|
|
119
132
|
{trigger}
|
|
120
133
|
</Box>
|
|
121
|
-
|
|
134
|
+
|
|
122
135
|
{isOpen && (
|
|
123
136
|
<Box
|
|
124
137
|
className={clsx(popoverContent, popoverPositionVariants[position])}
|
|
@@ -128,10 +141,13 @@ const Popover = ({
|
|
|
128
141
|
{showArrow && (
|
|
129
142
|
<Box
|
|
130
143
|
as="span"
|
|
131
|
-
className={clsx(
|
|
144
|
+
className={clsx(
|
|
145
|
+
popoverArrow,
|
|
146
|
+
popoverArrowPositionVariants[position],
|
|
147
|
+
)}
|
|
132
148
|
/>
|
|
133
149
|
)}
|
|
134
|
-
|
|
150
|
+
|
|
135
151
|
{(title || triggerType === 'click') && (
|
|
136
152
|
<Box as="div" className={popoverHeader}>
|
|
137
153
|
{title && (
|
|
@@ -152,11 +168,11 @@ const Popover = ({
|
|
|
152
168
|
)}
|
|
153
169
|
</Box>
|
|
154
170
|
)}
|
|
155
|
-
|
|
171
|
+
|
|
156
172
|
<Box as="div" className={popoverBody}>
|
|
157
173
|
{children}
|
|
158
174
|
</Box>
|
|
159
|
-
|
|
175
|
+
|
|
160
176
|
{footer && (
|
|
161
177
|
<Box as="div" className={popoverFooter}>
|
|
162
178
|
{footer}
|
|
@@ -7,15 +7,16 @@ import {
|
|
|
7
7
|
progressLabel,
|
|
8
8
|
} from './styles.css';
|
|
9
9
|
import Box from '../Box';
|
|
10
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
10
11
|
|
|
11
|
-
type ProgressProps =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
12
|
+
type ProgressProps = React.HTMLAttributes<HTMLDivElement> &
|
|
13
|
+
Sprinkles & {
|
|
14
|
+
value: number;
|
|
15
|
+
max?: number;
|
|
16
|
+
label?: string;
|
|
17
|
+
showPercentage?: boolean;
|
|
18
|
+
variant?: 'default' | 'success' | 'warning' | 'error';
|
|
19
|
+
};
|
|
19
20
|
|
|
20
21
|
const Progress = ({
|
|
21
22
|
value,
|
|
@@ -26,41 +27,41 @@ const Progress = ({
|
|
|
26
27
|
className,
|
|
27
28
|
}: ProgressProps) => {
|
|
28
29
|
const percentage = Math.min(Math.max((value / max) * 100, 0), 100);
|
|
29
|
-
|
|
30
|
+
|
|
30
31
|
return (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<Box
|
|
34
|
-
className={progressLabel}
|
|
35
|
-
display="flex"
|
|
36
|
-
justifyContent="space-between"
|
|
37
|
-
fontSize="12px"
|
|
38
|
-
fontWeight="500"
|
|
39
|
-
color="c5-600"
|
|
40
|
-
marginBottom="small"
|
|
41
|
-
fontFamily="body"
|
|
42
|
-
>
|
|
43
|
-
{label && <Box as="span">{label}</Box>}
|
|
44
|
-
{showPercentage && <Box as="span">{percentage}%</Box>}
|
|
45
|
-
</Box>
|
|
46
|
-
)}
|
|
32
|
+
<Box className={clsx(progress, className)} width="100%">
|
|
33
|
+
{(label || showPercentage) && (
|
|
47
34
|
<Box
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
className={progressLabel}
|
|
36
|
+
display="flex"
|
|
37
|
+
justifyContent="space-between"
|
|
38
|
+
fontSize="12px"
|
|
39
|
+
fontWeight="500"
|
|
40
|
+
color="c5-600"
|
|
41
|
+
marginBottom="small"
|
|
42
|
+
fontFamily="body"
|
|
54
43
|
>
|
|
55
|
-
<Box
|
|
56
|
-
|
|
57
|
-
className={progressFill[variant]}
|
|
58
|
-
style={{ width: `${percentage}%` }}
|
|
59
|
-
role="presentation"
|
|
60
|
-
/>
|
|
44
|
+
{label && <Box as="span">{label}</Box>}
|
|
45
|
+
{showPercentage && <Box as="span">{percentage}%</Box>}
|
|
61
46
|
</Box>
|
|
47
|
+
)}
|
|
48
|
+
<Box
|
|
49
|
+
as="div"
|
|
50
|
+
className={progressBar[variant]}
|
|
51
|
+
role="progressbar"
|
|
52
|
+
aria-valuenow={value}
|
|
53
|
+
aria-valuemin={0}
|
|
54
|
+
aria-valuemax={max}
|
|
55
|
+
>
|
|
56
|
+
<Box
|
|
57
|
+
as="div"
|
|
58
|
+
className={progressFill[variant]}
|
|
59
|
+
style={{ width: `${percentage}%` }}
|
|
60
|
+
role="presentation"
|
|
61
|
+
/>
|
|
62
62
|
</Box>
|
|
63
|
-
|
|
63
|
+
</Box>
|
|
64
|
+
);
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
export default Progress;
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
radioGroupHorizontal,
|
|
9
9
|
} from './styles.css';
|
|
10
10
|
import Box from '../Box';
|
|
11
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
11
12
|
|
|
12
13
|
type RadioContextType = {
|
|
13
14
|
name?: string;
|
|
@@ -20,17 +21,18 @@ const RadioContext = createContext<RadioContextType>({});
|
|
|
20
21
|
type RadioProps = Omit<
|
|
21
22
|
React.InputHTMLAttributes<HTMLInputElement>,
|
|
22
23
|
'type' | 'value' | 'onChange'
|
|
23
|
-
> &
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
> &
|
|
25
|
+
Sprinkles & {
|
|
26
|
+
label?: string;
|
|
27
|
+
value: string;
|
|
28
|
+
};
|
|
27
29
|
|
|
28
30
|
const Radio = forwardRef<HTMLInputElement, RadioProps>(
|
|
29
31
|
({ label, className, value, ...props }, ref) => {
|
|
30
32
|
const context = useContext(RadioContext);
|
|
31
33
|
const name = context.name || props.name;
|
|
32
34
|
const isChecked = context.value === value;
|
|
33
|
-
|
|
35
|
+
|
|
34
36
|
const handleChange = () => {
|
|
35
37
|
if (context.onChange) {
|
|
36
38
|
context.onChange(value);
|
|
@@ -58,7 +60,11 @@ const Radio = forwardRef<HTMLInputElement, RadioProps>(
|
|
|
58
60
|
className={radioInput}
|
|
59
61
|
{...props}
|
|
60
62
|
/>
|
|
61
|
-
{label &&
|
|
63
|
+
{label && (
|
|
64
|
+
<Box as="span" className={radioLabel}>
|
|
65
|
+
{label}
|
|
66
|
+
</Box>
|
|
67
|
+
)}
|
|
62
68
|
</Box>
|
|
63
69
|
);
|
|
64
70
|
},
|
|
@@ -6,16 +6,17 @@ import {
|
|
|
6
6
|
scrollAreaViewport,
|
|
7
7
|
} from './styles.css';
|
|
8
8
|
import Box from '../Box';
|
|
9
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
9
10
|
|
|
10
11
|
export type ScrollAreaOrientation = 'vertical' | 'horizontal' | 'both';
|
|
11
12
|
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
export type ScrollAreaProps = React.HTMLAttributes<HTMLDivElement> &
|
|
14
|
+
Sprinkles & {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
orientation?: ScrollAreaOrientation;
|
|
17
|
+
maxHeight?: string | number;
|
|
18
|
+
maxWidth?: string | number;
|
|
19
|
+
};
|
|
19
20
|
|
|
20
21
|
const ScrollArea = ({
|
|
21
22
|
children,
|
|
@@ -40,9 +41,7 @@ const ScrollArea = ({
|
|
|
40
41
|
style={style}
|
|
41
42
|
{...props}
|
|
42
43
|
>
|
|
43
|
-
<Box className={scrollAreaViewport}>
|
|
44
|
-
{children}
|
|
45
|
-
</Box>
|
|
44
|
+
<Box className={scrollAreaViewport}>{children}</Box>
|
|
46
45
|
</Box>
|
|
47
46
|
);
|
|
48
47
|
};
|
|
@@ -2,6 +2,7 @@ import clsx from 'clsx';
|
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { select, selectLabel, selectWrapper } from './styles.css';
|
|
4
4
|
import Box from '../Box';
|
|
5
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
5
6
|
|
|
6
7
|
type SelectOption = {
|
|
7
8
|
value: string;
|
|
@@ -9,15 +10,19 @@ type SelectOption = {
|
|
|
9
10
|
disabled?: boolean;
|
|
10
11
|
};
|
|
11
12
|
|
|
12
|
-
type SelectProps = Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size'> &
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
type SelectProps = Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size'> &
|
|
14
|
+
Sprinkles & {
|
|
15
|
+
label?: string;
|
|
16
|
+
options: SelectOption[];
|
|
17
|
+
error?: boolean;
|
|
18
|
+
fullWidth?: boolean;
|
|
19
|
+
};
|
|
18
20
|
|
|
19
21
|
const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
20
|
-
(
|
|
22
|
+
(
|
|
23
|
+
{ label, options, error = false, fullWidth = true, className, ...props },
|
|
24
|
+
ref,
|
|
25
|
+
) => {
|
|
21
26
|
return (
|
|
22
27
|
<Box className={selectWrapper} width="100%">
|
|
23
28
|
{label && (
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
separator,
|
|
5
|
-
separatorOrientation,
|
|
6
|
-
} from './styles.css';
|
|
3
|
+
import { separator, separatorOrientation } from './styles.css';
|
|
7
4
|
import Box from '../Box';
|
|
5
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
8
6
|
|
|
9
7
|
export type SeparatorOrientation = 'horizontal' | 'vertical';
|
|
10
8
|
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
9
|
+
export type SeparatorProps = React.HTMLAttributes<HTMLHRElement> &
|
|
10
|
+
Sprinkles & {
|
|
11
|
+
orientation?: SeparatorOrientation;
|
|
12
|
+
decorative?: boolean;
|
|
13
|
+
};
|
|
16
14
|
|
|
17
15
|
const Separator = ({
|
|
18
16
|
orientation = 'horizontal',
|
|
@@ -23,11 +21,7 @@ const Separator = ({
|
|
|
23
21
|
return (
|
|
24
22
|
<Box
|
|
25
23
|
as="hr"
|
|
26
|
-
className={clsx(
|
|
27
|
-
separator,
|
|
28
|
-
separatorOrientation[orientation],
|
|
29
|
-
className,
|
|
30
|
-
)}
|
|
24
|
+
className={clsx(separator, separatorOrientation[orientation], className)}
|
|
31
25
|
aria-hidden={decorative}
|
|
32
26
|
{...props}
|
|
33
27
|
/>
|
|
@@ -7,19 +7,21 @@ import {
|
|
|
7
7
|
skeletonAnimation,
|
|
8
8
|
} from './styles.css';
|
|
9
9
|
import Box from '../Box';
|
|
10
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
10
11
|
|
|
11
12
|
export type SkeletonVariant = 'text' | 'circle' | 'rectangle';
|
|
12
13
|
export type SkeletonSize = 'small' | 'medium' | 'large';
|
|
13
14
|
export type SkeletonAnimation = 'shimmer' | 'pulse' | 'none';
|
|
14
15
|
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
export type SkeletonProps = React.HTMLAttributes<HTMLDivElement> &
|
|
17
|
+
Sprinkles & {
|
|
18
|
+
variant?: SkeletonVariant;
|
|
19
|
+
size?: SkeletonSize;
|
|
20
|
+
animation?: SkeletonAnimation;
|
|
21
|
+
width?: string | number;
|
|
22
|
+
height?: string | number;
|
|
23
|
+
count?: number;
|
|
24
|
+
};
|
|
23
25
|
|
|
24
26
|
const Skeleton = ({
|
|
25
27
|
variant = 'text',
|
|
@@ -54,11 +56,7 @@ const Skeleton = ({
|
|
|
54
56
|
));
|
|
55
57
|
|
|
56
58
|
return (
|
|
57
|
-
<Box
|
|
58
|
-
display="flex"
|
|
59
|
-
flexDirection="column"
|
|
60
|
-
gap="small"
|
|
61
|
-
>
|
|
59
|
+
<Box display="flex" flexDirection="column" gap="small">
|
|
62
60
|
{skeletons}
|
|
63
61
|
</Box>
|
|
64
62
|
);
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import {
|
|
3
|
-
spinner,
|
|
4
|
-
spinnerColors,
|
|
5
|
-
spinnerSizes,
|
|
6
|
-
} from './styles.css';
|
|
2
|
+
import { spinner, spinnerColors, spinnerSizes } from './styles.css';
|
|
7
3
|
import React from 'react';
|
|
8
4
|
import Box from '../Box';
|
|
5
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
9
6
|
|
|
10
|
-
export type SpinnerColor =
|
|
7
|
+
export type SpinnerColor =
|
|
8
|
+
| 'primary'
|
|
9
|
+
| 'secondary'
|
|
10
|
+
| 'success'
|
|
11
|
+
| 'warning'
|
|
12
|
+
| 'error'
|
|
13
|
+
| 'info';
|
|
11
14
|
export type SpinnerSize = 'small' | 'medium' | 'large';
|
|
12
15
|
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
export type SpinnerProps = React.HTMLAttributes<HTMLDivElement> &
|
|
17
|
+
Sprinkles & {
|
|
18
|
+
color?: SpinnerColor;
|
|
19
|
+
size?: SpinnerSize;
|
|
20
|
+
role?: string;
|
|
21
|
+
};
|
|
18
22
|
|
|
19
23
|
const Spinner = ({
|
|
20
24
|
color = 'primary',
|