@automattic/vip-design-system 0.20.1 → 0.22.0
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/build/system/Avatar/Avatar.js +7 -3
- package/build/system/Badge/Badge.js +7 -3
- package/build/system/Box/Box.js +4 -3
- package/build/system/Code/Code.js +10 -4
- package/build/system/Flex/Flex.js +10 -5
- package/build/system/Form/Label.js +12 -4
- package/build/system/Form/Radio.js +7 -3
- package/build/system/Form/RadioBoxGroup.js +7 -3
- package/build/system/Form/Toggle.js +7 -3
- package/build/system/Form/ToggleGroup.js +7 -3
- package/build/system/Link/Link.js +7 -3
- package/build/system/Notice/Notice.js +2 -1
- package/build/system/Notification/Notification.js +6 -2
- package/build/system/OptionRow/OptionRow.js +5 -3
- package/build/system/ScreenReaderText/ScreenReaderText.js +16 -13
- package/build/system/Spinner/Spinner.js +7 -3
- package/build/system/Table/Table.js +22 -4
- package/build/system/Table/Table.stories.js +5 -1
- package/build/system/Tabs/Tabs.js +7 -3
- package/build/system/Text/Text.js +7 -3
- package/build/system/Wizard/Wizard.js +4 -2
- package/build/system/Wizard/WizardStep.js +6 -2
- package/build/system/Wizard/WizardStepHorizontal.js +6 -2
- package/package.json +1 -1
- package/src/system/Avatar/Avatar.js +54 -53
- package/src/system/Badge/Badge.js +24 -19
- package/src/system/Box/Box.js +2 -2
- package/src/system/Code/Code.js +81 -76
- package/src/system/Flex/Flex.js +6 -1
- package/src/system/Form/Label.js +10 -2
- package/src/system/Form/Radio.js +11 -3
- package/src/system/Form/RadioBoxGroup.js +52 -46
- package/src/system/Form/Toggle.js +50 -50
- package/src/system/Form/ToggleGroup.js +49 -43
- package/src/system/Link/Link.js +6 -2
- package/src/system/Notice/Notice.js +1 -1
- package/src/system/Notification/Notification.js +41 -34
- package/src/system/OptionRow/OptionRow.js +86 -78
- package/src/system/ScreenReaderText/ScreenReaderText.js +14 -17
- package/src/system/Spinner/Spinner.js +6 -2
- package/src/system/Table/Table.js +25 -10
- package/src/system/Table/Table.stories.jsx +4 -1
- package/src/system/Tabs/Tabs.js +6 -2
- package/src/system/Text/Text.js +6 -2
- package/src/system/Wizard/Wizard.js +49 -45
- package/src/system/Wizard/WizardStep.js +63 -57
- package/src/system/Wizard/WizardStepHorizontal.js +6 -2
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
+
import React from 'react';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
7
8
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
8
9
|
import { MdCheckCircle } from 'react-icons/md';
|
|
@@ -12,54 +13,59 @@ import { MdCheckCircle } from 'react-icons/md';
|
|
|
12
13
|
*/
|
|
13
14
|
import { Heading, Text } from '../';
|
|
14
15
|
|
|
15
|
-
const RadioBoxGroup = (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
16
|
+
const RadioBoxGroup = React.forwardRef(
|
|
17
|
+
( { onChange, groupLabel, value, options, ...props }, forwardRef ) => (
|
|
18
|
+
<RadioGroupPrimitive.Root
|
|
19
|
+
onValueChange={ onChange }
|
|
20
|
+
value={ value }
|
|
21
|
+
aria-label={ groupLabel }
|
|
22
|
+
sx={ {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
gap: 2,
|
|
25
|
+
} }
|
|
26
|
+
ref={ forwardRef }
|
|
27
|
+
{ ...props }
|
|
28
|
+
>
|
|
29
|
+
{ options.map( ( option, index ) => (
|
|
30
|
+
<RadioGroupPrimitive.Item
|
|
31
|
+
key={ option.value }
|
|
32
|
+
value={ option.value }
|
|
33
|
+
id={ `o${ index }` }
|
|
34
|
+
sx={ {
|
|
35
|
+
p: 3,
|
|
36
|
+
background: 'none',
|
|
37
|
+
cursor: 'pointer',
|
|
38
|
+
borderRadius: 2,
|
|
39
|
+
textAlign: 'left',
|
|
40
|
+
border: '1px solid',
|
|
41
|
+
borderColor: 'border',
|
|
42
|
+
position: 'relative',
|
|
43
|
+
'&:hover': {
|
|
44
|
+
borderColor: 'grey.10',
|
|
45
|
+
},
|
|
46
|
+
'&[data-state=checked]': {
|
|
47
|
+
borderColor: 'primary',
|
|
48
|
+
},
|
|
49
|
+
} }
|
|
50
|
+
>
|
|
51
|
+
<RadioGroupPrimitive.Indicator>
|
|
52
|
+
<MdCheckCircle
|
|
53
|
+
size={ 16 }
|
|
54
|
+
sx={ { position: 'absolute', top: 2, right: 2, color: 'primary' } }
|
|
55
|
+
/>
|
|
56
|
+
</RadioGroupPrimitive.Indicator>
|
|
57
|
+
<Heading variant="h4" as="label" htmlFor={ `o${ index }` } sx={ { mb: 0 } }>
|
|
58
|
+
{ option.label }
|
|
59
|
+
</Heading>
|
|
60
|
+
<Text sx={ { color: 'muted', mb: 0, fontSize: 1 } }>{ option.description }</Text>
|
|
61
|
+
</RadioGroupPrimitive.Item>
|
|
62
|
+
) ) }
|
|
63
|
+
</RadioGroupPrimitive.Root>
|
|
64
|
+
)
|
|
61
65
|
);
|
|
62
66
|
|
|
67
|
+
RadioBoxGroup.displayName = 'RadioBoxGroup';
|
|
68
|
+
|
|
63
69
|
RadioBoxGroup.propTypes = {
|
|
64
70
|
onChange: PropTypes.func,
|
|
65
71
|
options: PropTypes.array,
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* External dependencies
|
|
6
6
|
*/
|
|
7
|
+
import React from 'react';
|
|
7
8
|
import classNames from 'classnames';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
10
|
|
|
@@ -12,62 +13,61 @@ import * as Switch from '@radix-ui/react-switch';
|
|
|
12
13
|
// Documentation for Radix Switch component
|
|
13
14
|
// https://www.radix-ui.com/docs/primitives/components/switch
|
|
14
15
|
|
|
15
|
-
export const Toggle = (
|
|
16
|
-
name = 'toggle',
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
borderRadius: '32px',
|
|
31
|
-
backgroundColor: 'muted',
|
|
32
|
-
backgroundRepeat: 'no-repeat',
|
|
33
|
-
backgroundPosition: 'right 2px top 2px',
|
|
34
|
-
backgroundImage: `url(
|
|
16
|
+
export const Toggle = React.forwardRef(
|
|
17
|
+
( { name = 'toggle', onChange, className = null, variant = 'primary', ...rest }, forwardRef ) => (
|
|
18
|
+
<Switch.Root
|
|
19
|
+
className={ classNames( 'vip-toggle-component', className ) }
|
|
20
|
+
sx={ {
|
|
21
|
+
all: 'unset',
|
|
22
|
+
cursor: 'pointer',
|
|
23
|
+
position: 'relative',
|
|
24
|
+
width: 40,
|
|
25
|
+
height: 20,
|
|
26
|
+
borderRadius: '32px',
|
|
27
|
+
backgroundColor: 'muted',
|
|
28
|
+
backgroundRepeat: 'no-repeat',
|
|
29
|
+
backgroundPosition: 'right 2px top 2px',
|
|
30
|
+
backgroundImage: `url(
|
|
35
31
|
'data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.53846 3L3 4.53846L6.46156 8.00001L3.00003 11.4615L4.53848 13L8.00001 9.53847L11.4615 13L13 11.4615L9.53847 8.00001L13 4.53849L11.4615 3.00003L8.00001 6.46156L4.53846 3Z" fill="white"/></svg>')`,
|
|
36
|
-
|
|
32
|
+
WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
'&:focus': theme => theme.outline,
|
|
35
|
+
'&:focus-visible': theme => theme.outline,
|
|
36
|
+
'&[disabled]': {
|
|
37
|
+
opacity: 0.7,
|
|
38
|
+
},
|
|
39
|
+
'&[data-state="checked"]': {
|
|
40
|
+
backgroundColor: variant,
|
|
41
|
+
backgroundPosition: 'left 2px top 2px',
|
|
42
|
+
backgroundImage: `url(
|
|
47
43
|
'data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.4999 4.9995L5.7254 12.4008L2.5 9.33023L3.83307 7.92994L5.7254 9.73144L12.1668 3.59921L13.4999 4.9995Z" fill="white"/></svg>')`,
|
|
48
|
-
|
|
49
|
-
} }
|
|
50
|
-
name={ name }
|
|
51
|
-
onCheckedChange={ onChange || undefined }
|
|
52
|
-
{ ...rest }
|
|
53
|
-
>
|
|
54
|
-
<Switch.Thumb
|
|
55
|
-
sx={ {
|
|
56
|
-
display: 'block',
|
|
57
|
-
width: 16,
|
|
58
|
-
height: 16,
|
|
59
|
-
backgroundColor: 'white',
|
|
60
|
-
borderRadius: '50%',
|
|
61
|
-
boxShadow: 'rgb(0 0 0 / 5%) 0px 1px 5px, rgb(0 0 0 / 15%) 0px 1px 1px',
|
|
62
|
-
transition: 'transform 100ms',
|
|
63
|
-
transform: 'translateX(2px)',
|
|
64
|
-
willChange: 'transform',
|
|
65
|
-
'&[data-state="checked"]': { transform: 'translateX(22px)' },
|
|
44
|
+
},
|
|
66
45
|
} }
|
|
67
|
-
|
|
68
|
-
|
|
46
|
+
name={ name }
|
|
47
|
+
onCheckedChange={ onChange || undefined }
|
|
48
|
+
ref={ forwardRef }
|
|
49
|
+
{ ...rest }
|
|
50
|
+
>
|
|
51
|
+
<Switch.Thumb
|
|
52
|
+
sx={ {
|
|
53
|
+
display: 'block',
|
|
54
|
+
width: 16,
|
|
55
|
+
height: 16,
|
|
56
|
+
backgroundColor: 'white',
|
|
57
|
+
borderRadius: '50%',
|
|
58
|
+
boxShadow: 'rgb(0 0 0 / 5%) 0px 1px 5px, rgb(0 0 0 / 15%) 0px 1px 1px',
|
|
59
|
+
transition: 'transform 100ms',
|
|
60
|
+
transform: 'translateX(2px)',
|
|
61
|
+
willChange: 'transform',
|
|
62
|
+
'&[data-state="checked"]': { transform: 'translateX(22px)' },
|
|
63
|
+
} }
|
|
64
|
+
/>
|
|
65
|
+
</Switch.Root>
|
|
66
|
+
)
|
|
69
67
|
);
|
|
70
68
|
|
|
69
|
+
Toggle.displayName = 'Toggle';
|
|
70
|
+
|
|
71
71
|
Toggle.propTypes = {
|
|
72
72
|
name: PropTypes.string,
|
|
73
73
|
className: PropTypes.any,
|
|
@@ -3,54 +3,60 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
+
import React from 'react';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
7
8
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
8
9
|
|
|
9
|
-
const ToggleGroup = (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
10
|
+
const ToggleGroup = React.forwardRef(
|
|
11
|
+
( { onChange, groupLabel, value, options, ...props }, forwardRef ) => (
|
|
12
|
+
<RadioGroupPrimitive.Root
|
|
13
|
+
onValueChange={ onChange }
|
|
14
|
+
value={ value }
|
|
15
|
+
aria-label={ groupLabel }
|
|
16
|
+
sx={ {
|
|
17
|
+
bg: 'backgroundSecondary',
|
|
18
|
+
p: 1,
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
} }
|
|
22
|
+
ref={ forwardRef }
|
|
23
|
+
{ ...props }
|
|
24
|
+
>
|
|
25
|
+
{ options.map( ( option, index ) => (
|
|
26
|
+
<RadioGroupPrimitive.Item
|
|
27
|
+
key={ option.value }
|
|
28
|
+
value={ option.value }
|
|
29
|
+
id={ `o${ index }` }
|
|
30
|
+
sx={ {
|
|
31
|
+
fontSize: 1,
|
|
32
|
+
color: 'muted',
|
|
33
|
+
background: 'none',
|
|
34
|
+
border: 'none',
|
|
35
|
+
cursor: 'pointer',
|
|
36
|
+
borderRadius: 1,
|
|
37
|
+
py: 1,
|
|
38
|
+
px: 2,
|
|
39
|
+
flex: '1 1 auto',
|
|
40
|
+
textAlign: 'center',
|
|
41
|
+
'&:hover': {
|
|
42
|
+
color: 'heading',
|
|
43
|
+
},
|
|
44
|
+
'&[data-state=checked]': {
|
|
45
|
+
backgroundColor: 'card',
|
|
46
|
+
boxShadow: 'low',
|
|
47
|
+
color: 'heading',
|
|
48
|
+
},
|
|
49
|
+
} }
|
|
50
|
+
>
|
|
51
|
+
{ option.label }
|
|
52
|
+
</RadioGroupPrimitive.Item>
|
|
53
|
+
) ) }
|
|
54
|
+
</RadioGroupPrimitive.Root>
|
|
55
|
+
)
|
|
52
56
|
);
|
|
53
57
|
|
|
58
|
+
ToggleGroup.displayName = 'ToggleGroup';
|
|
59
|
+
|
|
54
60
|
ToggleGroup.propTypes = {
|
|
55
61
|
onChange: PropTypes.func,
|
|
56
62
|
options: PropTypes.array,
|
package/src/system/Link/Link.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
+
import React from 'react';
|
|
6
7
|
import { Link as ThemeLink } from 'theme-ui';
|
|
7
8
|
import PropTypes from 'prop-types';
|
|
8
9
|
|
|
9
|
-
const Link = ( { active = false, sx, ...props } ) => (
|
|
10
|
+
const Link = React.forwardRef( ( { active = false, sx, ...props }, forwardRef ) => (
|
|
10
11
|
<ThemeLink
|
|
11
12
|
{ ...props }
|
|
12
13
|
sx={ {
|
|
@@ -27,8 +28,11 @@ const Link = ( { active = false, sx, ...props } ) => (
|
|
|
27
28
|
'&:focus-visible': theme => theme.outline,
|
|
28
29
|
...sx,
|
|
29
30
|
} }
|
|
31
|
+
ref={ forwardRef }
|
|
30
32
|
/>
|
|
31
|
-
);
|
|
33
|
+
) );
|
|
34
|
+
|
|
35
|
+
Link.displayName = 'Link';
|
|
32
36
|
|
|
33
37
|
Link.propTypes = {
|
|
34
38
|
active: PropTypes.bool,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
+
import React from 'react';
|
|
6
7
|
import { MdCheckCircle, MdClose, MdError } from 'react-icons/md';
|
|
7
8
|
import PropTypes from 'prop-types';
|
|
8
9
|
|
|
@@ -12,43 +13,49 @@ import PropTypes from 'prop-types';
|
|
|
12
13
|
import { Box, Card, Flex, Text, Button } from '../';
|
|
13
14
|
import ScreenReaderText from '../ScreenReaderText';
|
|
14
15
|
|
|
15
|
-
const Notification = (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
const Notification = React.forwardRef(
|
|
17
|
+
( { title, body, status = 'success', onClose }, forwardRef ) => (
|
|
18
|
+
<Card
|
|
19
|
+
role="alert"
|
|
20
|
+
className="vip-notification-component"
|
|
21
|
+
sx={ {
|
|
22
|
+
boxShadow: 'medium',
|
|
23
|
+
width: 320,
|
|
24
|
+
position: 'relative',
|
|
25
|
+
variant: `notification.${ status }`,
|
|
26
|
+
} }
|
|
27
|
+
ref={ forwardRef }
|
|
28
|
+
>
|
|
29
|
+
<ScreenReaderText>Alert,</ScreenReaderText>
|
|
30
|
+
|
|
31
|
+
<Flex sx={ { alignItems: 'center' } }>
|
|
32
|
+
{ status === 'error' ? (
|
|
33
|
+
<MdError sx={ { color: 'error', flex: '0 0 auto' } } aria-hidden="true" />
|
|
34
|
+
) : (
|
|
35
|
+
<MdCheckCircle sx={ { color: 'success', flex: '0 0 auto' } } aria-hidden="true" />
|
|
36
|
+
) }
|
|
37
|
+
<Box sx={ { flex: '1 1 auto', ml: 3 } }>
|
|
38
|
+
<p sx={ { my: 0, color: 'heading', fontWeight: 'bold' } }>{ title }</p>
|
|
39
|
+
{ body && <Text sx={ { mb: 0, mt: 1 } }>{ body }</Text> }
|
|
40
|
+
</Box>
|
|
41
|
+
</Flex>
|
|
42
|
+
|
|
43
|
+
{ onClose && (
|
|
44
|
+
<Button
|
|
45
|
+
onClick={ onClose }
|
|
46
|
+
variant="icon"
|
|
47
|
+
sx={ { color: 'muted', position: 'absolute', top: 2, right: 2 } }
|
|
48
|
+
aria-hidden="true"
|
|
49
|
+
>
|
|
50
|
+
<MdClose />
|
|
51
|
+
</Button>
|
|
32
52
|
) }
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{ body && <Text sx={ { mb: 0, mt: 1 } }>{ body }</Text> }
|
|
36
|
-
</Box>
|
|
37
|
-
</Flex>
|
|
38
|
-
|
|
39
|
-
{ onClose && (
|
|
40
|
-
<Button
|
|
41
|
-
onClick={ onClose }
|
|
42
|
-
variant="icon"
|
|
43
|
-
sx={ { color: 'muted', position: 'absolute', top: 2, right: 2 } }
|
|
44
|
-
aria-hidden="true"
|
|
45
|
-
>
|
|
46
|
-
<MdClose />
|
|
47
|
-
</Button>
|
|
48
|
-
) }
|
|
49
|
-
</Card>
|
|
53
|
+
</Card>
|
|
54
|
+
)
|
|
50
55
|
);
|
|
51
56
|
|
|
57
|
+
Notification.displayName = 'Notification';
|
|
58
|
+
|
|
52
59
|
Notification.propTypes = {
|
|
53
60
|
title: PropTypes.node,
|
|
54
61
|
body: PropTypes.node,
|
|
@@ -34,87 +34,95 @@ const regularGridStyle = small => ( {
|
|
|
34
34
|
borderColor: 'borders.2',
|
|
35
35
|
} );
|
|
36
36
|
|
|
37
|
-
const OptionRow = (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
37
|
+
const OptionRow = React.forwardRef(
|
|
38
|
+
(
|
|
39
|
+
{
|
|
40
|
+
image,
|
|
41
|
+
icon,
|
|
42
|
+
badge,
|
|
43
|
+
label,
|
|
44
|
+
inline = false,
|
|
45
|
+
subTitle,
|
|
46
|
+
body,
|
|
47
|
+
meta,
|
|
48
|
+
to,
|
|
49
|
+
small = false,
|
|
50
|
+
disabled = false,
|
|
51
|
+
order = null,
|
|
52
|
+
className = null,
|
|
53
|
+
...props
|
|
54
|
+
},
|
|
55
|
+
forwardRef
|
|
56
|
+
) => {
|
|
57
|
+
const mergedCard = disabled ? disabledStyles : {};
|
|
58
|
+
const inlineStyles = inline ? gridInlineStyle : regularGridStyle( small );
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
image
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
60
|
+
return (
|
|
61
|
+
<Grid
|
|
62
|
+
to={ to }
|
|
63
|
+
columns={ [ 1, 1, 'auto 1fr auto' ] }
|
|
64
|
+
gap={ [ 3, 3, `${ small ? 3 : 4 }` ] }
|
|
65
|
+
data-order={ order || undefined }
|
|
66
|
+
className={ classNames( 'vip-option-row-component', className ) }
|
|
67
|
+
ref={ forwardRef }
|
|
68
|
+
{ ...props }
|
|
69
|
+
sx={ {
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
cursor: disabled ? 'auto' : 'pointer',
|
|
72
|
+
textDecoration: 'none',
|
|
73
|
+
color: 'inherit',
|
|
74
|
+
'&:hover': ! disabled && {
|
|
75
|
+
backgroundColor: 'hover',
|
|
76
|
+
},
|
|
77
|
+
...inlineStyles,
|
|
78
|
+
} }
|
|
79
|
+
>
|
|
80
|
+
<Box>
|
|
81
|
+
{ image ? (
|
|
82
|
+
<Box
|
|
83
|
+
sx={ {
|
|
84
|
+
display: [ 'inline-block', 'inline-block', 'block' ],
|
|
85
|
+
p: small ? 12 : 20,
|
|
86
|
+
flex: '0 0 auto',
|
|
87
|
+
bg: 'brand.70',
|
|
88
|
+
color: 'brand.10',
|
|
89
|
+
borderRadius: 1,
|
|
90
|
+
...mergedCard,
|
|
91
|
+
} }
|
|
92
|
+
>
|
|
93
|
+
{ React.isValidElement( image ) ? (
|
|
94
|
+
image
|
|
95
|
+
) : (
|
|
96
|
+
<img
|
|
97
|
+
src={ image }
|
|
98
|
+
width={ small ? 32 : 48 }
|
|
99
|
+
sx={ { display: 'block' } }
|
|
100
|
+
alt="Image representing the list item"
|
|
101
|
+
/>
|
|
102
|
+
) }
|
|
103
|
+
</Box>
|
|
104
|
+
) : (
|
|
105
|
+
icon && icon
|
|
106
|
+
) }
|
|
107
|
+
</Box>
|
|
108
|
+
|
|
109
|
+
<Box sx={ { flex: '1 1 auto' } }>
|
|
110
|
+
<Heading variant="h4" sx={ { mb: subTitle || body ? 1 : 0 } }>
|
|
111
|
+
{ label }
|
|
112
|
+
{ badge && <Badge sx={ { marginLeft: 2 } }>{ badge }</Badge> }
|
|
113
|
+
</Heading>
|
|
114
|
+
{ subTitle && <Text sx={ { mb: 1, color: 'muted' } }>{ subTitle }</Text> }
|
|
115
|
+
{ body && <Text sx={ { mb: 0 } }>{ body }</Text> }
|
|
116
|
+
</Box>
|
|
117
|
+
{ false !== meta && '' !== meta && (
|
|
118
|
+
<Box data-testid="meta">{ meta ? meta : <MdArrowForward size={ 24 } /> }</Box>
|
|
101
119
|
) }
|
|
102
|
-
</
|
|
120
|
+
</Grid>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
);
|
|
103
124
|
|
|
104
|
-
|
|
105
|
-
<Heading variant="h4" sx={ { mb: subTitle || body ? 1 : 0 } }>
|
|
106
|
-
{ label }
|
|
107
|
-
{ badge && <Badge sx={ { marginLeft: 2 } }>{ badge }</Badge> }
|
|
108
|
-
</Heading>
|
|
109
|
-
{ subTitle && <Text sx={ { mb: 1, color: 'muted' } }>{ subTitle }</Text> }
|
|
110
|
-
{ body && <Text sx={ { mb: 0 } }>{ body }</Text> }
|
|
111
|
-
</Box>
|
|
112
|
-
{ false !== meta && '' !== meta && (
|
|
113
|
-
<Box data-testid="meta">{ meta ? meta : <MdArrowForward size={ 24 } /> }</Box>
|
|
114
|
-
) }
|
|
115
|
-
</Grid>
|
|
116
|
-
);
|
|
117
|
-
};
|
|
125
|
+
OptionRow.displayName = 'OptionRow';
|
|
118
126
|
|
|
119
127
|
OptionRow.propTypes = {
|
|
120
128
|
image: PropTypes.oneOfType( [ PropTypes.object, PropTypes.string ] ),
|