@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
|
@@ -1,20 +1,26 @@
|
|
|
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 StackDirection = 'row' | 'column';
|
|
5
6
|
export type StackAlign = 'start' | 'center' | 'end' | 'stretch';
|
|
6
|
-
export type StackJustify =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
export type StackJustify =
|
|
8
|
+
| 'start'
|
|
9
|
+
| 'center'
|
|
10
|
+
| 'end'
|
|
11
|
+
| 'between'
|
|
12
|
+
| 'around'
|
|
13
|
+
| 'evenly';
|
|
14
|
+
|
|
15
|
+
export type StackProps = React.HTMLAttributes<HTMLDivElement> &
|
|
16
|
+
Sprinkles & {
|
|
17
|
+
direction?: StackDirection;
|
|
18
|
+
align?: StackAlign;
|
|
19
|
+
justify?: StackJustify;
|
|
20
|
+
gap?: 'none' | 'small' | 'medium' | 'large';
|
|
21
|
+
wrap?: boolean;
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
};
|
|
18
24
|
|
|
19
25
|
const alignMap: Record<StackAlign, string> = {
|
|
20
26
|
start: 'flex-start',
|
|
@@ -33,10 +39,23 @@ const justifyMap: Record<StackJustify, string> = {
|
|
|
33
39
|
};
|
|
34
40
|
|
|
35
41
|
const Stack = forwardRef<HTMLElement, StackProps>(
|
|
36
|
-
(
|
|
42
|
+
(
|
|
43
|
+
{
|
|
44
|
+
direction = 'column',
|
|
45
|
+
align,
|
|
46
|
+
justify,
|
|
47
|
+
gap,
|
|
48
|
+
wrap,
|
|
49
|
+
children,
|
|
50
|
+
className,
|
|
51
|
+
style,
|
|
52
|
+
...rest
|
|
53
|
+
},
|
|
54
|
+
ref,
|
|
55
|
+
) => {
|
|
37
56
|
const alignItems = align ? alignMap[align] : undefined;
|
|
38
57
|
const justifyContent = justify ? justifyMap[justify] : undefined;
|
|
39
|
-
|
|
58
|
+
|
|
40
59
|
return (
|
|
41
60
|
<Box
|
|
42
61
|
ref={ref}
|
|
@@ -52,7 +71,7 @@ const Stack = forwardRef<HTMLElement, StackProps>(
|
|
|
52
71
|
{children}
|
|
53
72
|
</Box>
|
|
54
73
|
);
|
|
55
|
-
}
|
|
74
|
+
},
|
|
56
75
|
);
|
|
57
76
|
|
|
58
77
|
Stack.displayName = 'Stack';
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
stepConnectorVertical,
|
|
18
18
|
} from './styles.css';
|
|
19
19
|
import Box from '../Box';
|
|
20
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
20
21
|
|
|
21
22
|
export type StepperOrientation = 'horizontal' | 'vertical';
|
|
22
23
|
export type StepStatus = 'pending' | 'current' | 'completed';
|
|
@@ -27,14 +28,15 @@ export interface Step {
|
|
|
27
28
|
status?: StepStatus;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
export type StepperProps = React.HTMLAttributes<HTMLDivElement> &
|
|
32
|
+
Sprinkles & {
|
|
33
|
+
steps: Step[];
|
|
34
|
+
currentStep?: number;
|
|
35
|
+
orientation?: StepperOrientation;
|
|
36
|
+
showConnectors?: boolean;
|
|
37
|
+
onStepClick?: (stepIndex: number) => void;
|
|
38
|
+
clickable?: boolean;
|
|
39
|
+
};
|
|
38
40
|
|
|
39
41
|
const Stepper = ({
|
|
40
42
|
steps,
|
|
@@ -73,7 +75,7 @@ const Stepper = ({
|
|
|
73
75
|
const status = stepItem.status || getStepStatus(index);
|
|
74
76
|
const isLast = index === steps.length - 1;
|
|
75
77
|
const isCompleted = status === 'completed';
|
|
76
|
-
|
|
78
|
+
|
|
77
79
|
return (
|
|
78
80
|
<Box
|
|
79
81
|
key={index}
|
|
@@ -83,11 +85,14 @@ const Stepper = ({
|
|
|
83
85
|
>
|
|
84
86
|
{showConnectors && !isLast && orientation === 'horizontal' && (
|
|
85
87
|
<Box
|
|
86
|
-
className={clsx(
|
|
88
|
+
className={clsx(
|
|
89
|
+
stepConnector,
|
|
90
|
+
isCompleted && stepConnectorCompleted,
|
|
91
|
+
)}
|
|
87
92
|
aria-hidden="true"
|
|
88
93
|
/>
|
|
89
94
|
)}
|
|
90
|
-
|
|
95
|
+
|
|
91
96
|
{showConnectors && !isLast && orientation === 'vertical' && (
|
|
92
97
|
<Box
|
|
93
98
|
className={stepConnectorVertical}
|
|
@@ -95,19 +100,16 @@ const Stepper = ({
|
|
|
95
100
|
aria-hidden="true"
|
|
96
101
|
/>
|
|
97
102
|
)}
|
|
98
|
-
|
|
103
|
+
|
|
99
104
|
<Box
|
|
100
|
-
className={clsx(
|
|
101
|
-
stepIndicator,
|
|
102
|
-
stepIndicatorVariants[status],
|
|
103
|
-
)}
|
|
105
|
+
className={clsx(stepIndicator, stepIndicatorVariants[status])}
|
|
104
106
|
onClick={() => handleStepClick(index)}
|
|
105
107
|
style={{ cursor: clickable ? 'pointer' : 'default' }}
|
|
106
108
|
aria-label={`Step ${index + 1}: ${stepItem.title}`}
|
|
107
109
|
>
|
|
108
110
|
{status === 'completed' ? '✓' : index + 1}
|
|
109
111
|
</Box>
|
|
110
|
-
|
|
112
|
+
|
|
111
113
|
<Box
|
|
112
114
|
className={clsx(
|
|
113
115
|
stepContent,
|
|
@@ -11,30 +11,27 @@ import {
|
|
|
11
11
|
tableContainer,
|
|
12
12
|
} from './styles.css';
|
|
13
13
|
import Box from '../Box';
|
|
14
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
14
15
|
|
|
15
16
|
// Context to pass striping info to rows
|
|
16
17
|
const TableContext = createContext<{ striped?: boolean }>({});
|
|
17
18
|
|
|
18
|
-
type TableProps =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
19
|
+
type TableProps = React.HTMLAttributes<HTMLTableElement> &
|
|
20
|
+
Sprinkles & {
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
striped?: boolean;
|
|
23
|
+
};
|
|
24
24
|
|
|
25
25
|
const TableComponent = ({
|
|
26
26
|
children,
|
|
27
|
-
className,
|
|
28
27
|
striped = false,
|
|
29
|
-
|
|
28
|
+
className,
|
|
29
|
+
...props
|
|
30
30
|
}: TableProps) => {
|
|
31
31
|
return (
|
|
32
32
|
<TableContext.Provider value={{ striped }}>
|
|
33
|
-
<Box
|
|
34
|
-
className={clsx(
|
|
35
|
-
width="100%"
|
|
36
|
-
>
|
|
37
|
-
<Box as="table" className={clsx(table, className)}>
|
|
33
|
+
<Box className={clsx(tableContainer, className)} width="100%">
|
|
34
|
+
<Box as="table" className={clsx(table)} {...props}>
|
|
38
35
|
{children}
|
|
39
36
|
</Box>
|
|
40
37
|
</Box>
|
|
@@ -48,7 +45,11 @@ type TheadProps = {
|
|
|
48
45
|
};
|
|
49
46
|
|
|
50
47
|
const Thead = ({ children, className }: TheadProps) => {
|
|
51
|
-
return
|
|
48
|
+
return (
|
|
49
|
+
<Box as="thead" className={clsx(thead, className)}>
|
|
50
|
+
{children}
|
|
51
|
+
</Box>
|
|
52
|
+
);
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
type TbodyProps = {
|
|
@@ -57,7 +58,11 @@ type TbodyProps = {
|
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
const Tbody = ({ children, className }: TbodyProps) => {
|
|
60
|
-
return
|
|
61
|
+
return (
|
|
62
|
+
<Box as="tbody" className={clsx(tbody, className)}>
|
|
63
|
+
{children}
|
|
64
|
+
</Box>
|
|
65
|
+
);
|
|
61
66
|
};
|
|
62
67
|
|
|
63
68
|
type TfootProps = {
|
|
@@ -66,7 +71,11 @@ type TfootProps = {
|
|
|
66
71
|
};
|
|
67
72
|
|
|
68
73
|
const Tfoot = ({ children, className }: TfootProps) => {
|
|
69
|
-
return
|
|
74
|
+
return (
|
|
75
|
+
<Box as="tfoot" className={clsx(tfoot, className)}>
|
|
76
|
+
{children}
|
|
77
|
+
</Box>
|
|
78
|
+
);
|
|
70
79
|
};
|
|
71
80
|
|
|
72
81
|
type TrProps = {
|
|
@@ -79,10 +88,7 @@ const Tr = ({ children, className }: TrProps) => {
|
|
|
79
88
|
return (
|
|
80
89
|
<Box
|
|
81
90
|
as="tr"
|
|
82
|
-
className={clsx(
|
|
83
|
-
tr[striped ? 'striped' : 'default'],
|
|
84
|
-
className,
|
|
85
|
-
)}
|
|
91
|
+
className={clsx(tr[striped ? 'striped' : 'default'], className)}
|
|
86
92
|
>
|
|
87
93
|
{children}
|
|
88
94
|
</Box>
|
|
@@ -95,7 +101,11 @@ type ThProps = {
|
|
|
95
101
|
};
|
|
96
102
|
|
|
97
103
|
const Th = ({ children, className }: ThProps) => {
|
|
98
|
-
return
|
|
104
|
+
return (
|
|
105
|
+
<Box as="th" className={clsx(th, className)}>
|
|
106
|
+
{children}
|
|
107
|
+
</Box>
|
|
108
|
+
);
|
|
99
109
|
};
|
|
100
110
|
|
|
101
111
|
type TdProps = {
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
tabContent,
|
|
10
10
|
} from './styles.css';
|
|
11
11
|
import Box from '../Box';
|
|
12
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
12
13
|
|
|
13
14
|
type TabsContextType = {
|
|
14
15
|
activeTab: string;
|
|
@@ -21,20 +22,21 @@ const TabsContext = createContext<TabsContextType>({
|
|
|
21
22
|
setActiveTab: () => {},
|
|
22
23
|
});
|
|
23
24
|
|
|
24
|
-
type TabsProps =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
25
|
+
type TabsProps = React.HTMLAttributes<HTMLDivElement> &
|
|
26
|
+
Sprinkles & {
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
defaultValue?: string;
|
|
29
|
+
orientation?: 'horizontal' | 'vertical';
|
|
30
|
+
onChange?: (value: string) => void;
|
|
31
|
+
};
|
|
31
32
|
|
|
32
33
|
const Tabs = ({
|
|
33
34
|
children,
|
|
34
35
|
defaultValue = '',
|
|
35
36
|
orientation = 'horizontal',
|
|
36
|
-
className,
|
|
37
37
|
onChange,
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
38
40
|
}: TabsProps) => {
|
|
39
41
|
const [activeTab, setActiveTab] = useState(defaultValue);
|
|
40
42
|
|
|
@@ -46,8 +48,10 @@ const Tabs = ({
|
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
return (
|
|
49
|
-
<TabsContext.Provider
|
|
50
|
-
|
|
51
|
+
<TabsContext.Provider
|
|
52
|
+
value={{ activeTab, setActiveTab: handleTabChange, orientation }}
|
|
53
|
+
>
|
|
54
|
+
<Box className={clsx(tabsContainer, className)} width="100%" {...props}>
|
|
51
55
|
{children}
|
|
52
56
|
</Box>
|
|
53
57
|
</TabsContext.Provider>
|
|
@@ -2,14 +2,15 @@ import clsx from 'clsx';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { tag, removeButton, tagGroup } from './styles.css';
|
|
4
4
|
import Box from '../Box';
|
|
5
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
5
6
|
|
|
6
|
-
type TagProps =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
7
|
+
type TagProps = React.HTMLAttributes<HTMLSpanElement> &
|
|
8
|
+
Sprinkles & {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
variant?: 'default' | 'primary' | 'success' | 'warning' | 'error';
|
|
11
|
+
onRemove?: () => void;
|
|
12
|
+
removable?: boolean;
|
|
13
|
+
};
|
|
13
14
|
|
|
14
15
|
const Tag = ({
|
|
15
16
|
children,
|
|
@@ -2,12 +2,13 @@ import clsx from 'clsx';
|
|
|
2
2
|
import { heading, text } from './styles.css';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import Box from '../Box';
|
|
5
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
5
6
|
|
|
6
|
-
type HeaderProps =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
7
|
+
type HeaderProps = React.HTMLAttributes<HTMLHeadingElement> &
|
|
8
|
+
Sprinkles & {
|
|
9
|
+
variant: 'h1' | 'h2' | 'h3';
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
};
|
|
11
12
|
|
|
12
13
|
const Header = ({ variant, children, className }: HeaderProps) => {
|
|
13
14
|
return (
|
|
@@ -2,11 +2,12 @@ import clsx from 'clsx';
|
|
|
2
2
|
import { text } from './styles.css';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import Box from '../Box';
|
|
5
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
5
6
|
|
|
6
|
-
type PProps = React.HTMLAttributes<HTMLParagraphElement> &
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
7
|
+
type PProps = React.HTMLAttributes<HTMLParagraphElement> &
|
|
8
|
+
Sprinkles & {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
};
|
|
10
11
|
|
|
11
12
|
const P = (props: PProps) => {
|
|
12
13
|
return (
|
|
@@ -3,11 +3,13 @@ import React from 'react';
|
|
|
3
3
|
import { textAreaStyle, 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 TextAreaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> &
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export type TextAreaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> &
|
|
9
|
+
Sprinkles & {
|
|
10
|
+
label?: string;
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
};
|
|
11
13
|
|
|
12
14
|
const TextArea = (props: TextAreaProps) => {
|
|
13
15
|
return (
|
|
@@ -19,10 +21,7 @@ const TextArea = (props: TextAreaProps) => {
|
|
|
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}
|
|
@@ -15,15 +15,20 @@ import {
|
|
|
15
15
|
} from './styles.css';
|
|
16
16
|
import React, { useState, useId } from 'react';
|
|
17
17
|
import Box from '../Box';
|
|
18
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
18
19
|
|
|
19
20
|
export type ToggleSize = 'small' | 'medium' | 'large';
|
|
20
21
|
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
export type ToggleProps = Omit<
|
|
23
|
+
React.InputHTMLAttributes<HTMLInputElement>,
|
|
24
|
+
'size' | 'checked' | 'onChange'
|
|
25
|
+
> &
|
|
26
|
+
Sprinkles & {
|
|
27
|
+
checked?: boolean;
|
|
28
|
+
onChange?: (checked: boolean) => void;
|
|
29
|
+
size?: ToggleSize;
|
|
30
|
+
label?: string;
|
|
31
|
+
};
|
|
27
32
|
|
|
28
33
|
const Toggle = ({
|
|
29
34
|
checked = false,
|
|
@@ -86,7 +91,11 @@ const Toggle = ({
|
|
|
86
91
|
aria-hidden="true"
|
|
87
92
|
/>
|
|
88
93
|
</Box>
|
|
89
|
-
{label &&
|
|
94
|
+
{label && (
|
|
95
|
+
<Box as="span" marginLeft="small">
|
|
96
|
+
{label}
|
|
97
|
+
</Box>
|
|
98
|
+
)}
|
|
90
99
|
</Box>
|
|
91
100
|
);
|
|
92
101
|
};
|
|
@@ -11,15 +11,17 @@ import {
|
|
|
11
11
|
} from './styles.css';
|
|
12
12
|
import React, { useState } from 'react';
|
|
13
13
|
import Box from '../Box';
|
|
14
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
14
15
|
|
|
15
16
|
export type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
16
17
|
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
export type TooltipProps = React.HTMLAttributes<HTMLDivElement> &
|
|
19
|
+
Sprinkles & {
|
|
20
|
+
content: string;
|
|
21
|
+
position?: TooltipPosition;
|
|
22
|
+
showArrow?: boolean;
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
};
|
|
23
25
|
|
|
24
26
|
const Tooltip = ({
|
|
25
27
|
content,
|
|
@@ -50,17 +52,20 @@ const Tooltip = ({
|
|
|
50
52
|
{children}
|
|
51
53
|
<Box
|
|
52
54
|
as="div"
|
|
53
|
-
className={clsx(
|
|
54
|
-
tooltipContent,
|
|
55
|
-
tooltipPositions[position],
|
|
56
|
-
)}
|
|
55
|
+
className={clsx(tooltipContent, tooltipPositions[position])}
|
|
57
56
|
data-visible={isVisible}
|
|
58
57
|
role="tooltip"
|
|
59
58
|
>
|
|
60
59
|
{showArrow && (
|
|
61
60
|
<Box
|
|
62
61
|
as="span"
|
|
63
|
-
className={clsx(
|
|
62
|
+
className={clsx(
|
|
63
|
+
tooltipArrow,
|
|
64
|
+
arrowStyle.top,
|
|
65
|
+
arrowStyle.bottom,
|
|
66
|
+
arrowStyle.left,
|
|
67
|
+
arrowStyle.right,
|
|
68
|
+
)}
|
|
64
69
|
/>
|
|
65
70
|
)}
|
|
66
71
|
{content}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { visuallyHidden } from './styles.css';
|
|
3
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
+
export type VisuallyHiddenProps = Sprinkles & {
|
|
5
6
|
children: React.ReactNode;
|
|
6
7
|
as?: React.ElementType;
|
|
7
|
-
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
|
|
10
|
-
const VisuallyHidden = ({
|
|
11
|
-
children,
|
|
10
|
+
const VisuallyHidden = ({
|
|
11
|
+
children,
|
|
12
12
|
as: Component = 'span',
|
|
13
|
-
|
|
14
|
-
...props
|
|
13
|
+
...props
|
|
15
14
|
}: VisuallyHiddenProps) => {
|
|
16
15
|
return React.createElement(
|
|
17
16
|
Component as React.ElementType,
|
|
@@ -19,7 +18,7 @@ const VisuallyHidden = ({
|
|
|
19
18
|
className: visuallyHidden,
|
|
20
19
|
...props,
|
|
21
20
|
},
|
|
22
|
-
children
|
|
21
|
+
children,
|
|
23
22
|
);
|
|
24
23
|
};
|
|
25
24
|
|