@automattic/vip-design-system 2.13.6 → 2.13.7
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/DescriptionList/DescriptionList.d.ts +13 -0
- package/build/system/DescriptionList/DescriptionList.js +40 -0
- package/build/system/DescriptionList/DetailsList.stories.d.ts +11 -0
- package/build/system/DescriptionList/DetailsList.stories.js +24 -0
- package/build/system/DescriptionList/index.d.ts +4 -0
- package/build/system/DescriptionList/index.js +4 -0
- package/build/system/Wizard/Wizard.d.ts +1 -0
- package/build/system/Wizard/Wizard.js +4 -1
- package/build/system/Wizard/Wizard.stories.d.ts +1 -0
- package/build/system/Wizard/Wizard.stories.js +23 -1
- package/build/system/Wizard/WizardStep.d.ts +1 -0
- package/build/system/Wizard/WizardStep.js +6 -3
- package/build/system/theme/generated/valet-theme-dark.json +4 -4
- package/package.json +1 -1
- package/src/system/DescriptionList/DescriptionList.tsx +48 -0
- package/src/system/DescriptionList/DetailsList.stories.tsx +29 -0
- package/src/system/DescriptionList/index.ts +4 -0
- package/src/system/Wizard/Wizard.stories.tsx +26 -1
- package/src/system/Wizard/Wizard.tsx +11 -1
- package/src/system/Wizard/WizardStep.tsx +9 -4
- package/src/system/theme/generated/valet-theme-dark.json +4 -4
- package/tokens/valet-core/wpvip-product-dark.json +4 -4
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ThemeUIStyleObject } from 'theme-ui';
|
|
3
|
+
export interface DescriptionListProps {
|
|
4
|
+
list: {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}[];
|
|
8
|
+
className?: string;
|
|
9
|
+
sx?: ThemeUIStyleObject;
|
|
10
|
+
labelWidth?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const DescriptionList: import("react").ForwardRefExoticComponent<DescriptionListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export default DescriptionList;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { forwardRef } from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { Grid } from '../Grid';
|
|
10
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
12
|
+
import { Fragment as _Fragment } from "theme-ui/jsx-runtime";
|
|
13
|
+
export var DescriptionList = /*#__PURE__*/forwardRef(function (_ref) {
|
|
14
|
+
var sx = _ref.sx,
|
|
15
|
+
className = _ref.className,
|
|
16
|
+
list = _ref.list,
|
|
17
|
+
_ref$labelWidth = _ref.labelWidth,
|
|
18
|
+
labelWidth = _ref$labelWidth === void 0 ? '100px' : _ref$labelWidth;
|
|
19
|
+
return _jsx(_Fragment, {
|
|
20
|
+
children: list.map(function (item) {
|
|
21
|
+
return _jsxs(Grid, {
|
|
22
|
+
className: className,
|
|
23
|
+
as: "dl",
|
|
24
|
+
columns: [labelWidth + " auto"],
|
|
25
|
+
sx: _extends({
|
|
26
|
+
fontSize: 2,
|
|
27
|
+
gap: 2,
|
|
28
|
+
alignItems: 'flex-start'
|
|
29
|
+
}, sx),
|
|
30
|
+
children: [_jsx("dt", {
|
|
31
|
+
children: item.label
|
|
32
|
+
}), _jsx("dd", {
|
|
33
|
+
children: item.value
|
|
34
|
+
})]
|
|
35
|
+
}, item.label);
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
DescriptionList.displayName = 'DescriptionList';
|
|
40
|
+
export default DescriptionList;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
/**
|
|
4
|
+
* Internal dependencies
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: {
|
|
7
|
+
title: string;
|
|
8
|
+
component: import("react").ForwardRefExoticComponent<import("./DescriptionList").DescriptionListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
11
|
+
export declare const Default: () => import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
// we'll need jsxImportSource for the sx prop when used with html elements
|
|
3
|
+
|
|
4
|
+
import { DescriptionList } from './DescriptionList';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
10
|
+
export default {
|
|
11
|
+
title: 'DescriptionList',
|
|
12
|
+
component: DescriptionList
|
|
13
|
+
};
|
|
14
|
+
export var Default = function Default() {
|
|
15
|
+
return _jsx(DescriptionList, {
|
|
16
|
+
list: [{
|
|
17
|
+
label: 'Short Label',
|
|
18
|
+
value: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
|
|
19
|
+
}, {
|
|
20
|
+
label: 'Long label to test label width',
|
|
21
|
+
value: 'Value'
|
|
22
|
+
}]
|
|
23
|
+
});
|
|
24
|
+
};
|
|
@@ -22,7 +22,9 @@ export var Wizard = /*#__PURE__*/React.forwardRef(function (_ref, forwardRef) {
|
|
|
22
22
|
_ref$className = _ref.className,
|
|
23
23
|
className = _ref$className === void 0 ? null : _ref$className,
|
|
24
24
|
_ref$titleAutofocus = _ref.titleAutofocus,
|
|
25
|
-
titleAutofocus = _ref$titleAutofocus === void 0 ? false : _ref$titleAutofocus
|
|
25
|
+
titleAutofocus = _ref$titleAutofocus === void 0 ? false : _ref$titleAutofocus,
|
|
26
|
+
_ref$showStepText = _ref.showStepText,
|
|
27
|
+
showStepText = _ref$showStepText === void 0 ? true : _ref$showStepText;
|
|
26
28
|
var _useState = useState(false),
|
|
27
29
|
didMount = _useState[0],
|
|
28
30
|
setDidMount = _useState[1];
|
|
@@ -59,6 +61,7 @@ export var Wizard = /*#__PURE__*/React.forwardRef(function (_ref, forwardRef) {
|
|
|
59
61
|
onChange: onChange,
|
|
60
62
|
shouldFocusTitle: titleAutofocus && didMount,
|
|
61
63
|
actionLabel: actionLabel,
|
|
64
|
+
showStepText: showStepText,
|
|
62
65
|
children: children
|
|
63
66
|
}, index);
|
|
64
67
|
})
|
|
@@ -9,7 +9,7 @@ import React from 'react';
|
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { Wizard, Box, Label, Input, Button, Checkbox, Flex } from '..';
|
|
12
|
+
import { Wizard, Box, Label, Input, Button, Checkbox, Flex, Text } from '..';
|
|
13
13
|
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
15
15
|
export default {
|
|
@@ -164,4 +164,26 @@ export var WithTitleAutoFocus = function WithTitleAutoFocus() {
|
|
|
164
164
|
})
|
|
165
165
|
})]
|
|
166
166
|
});
|
|
167
|
+
};
|
|
168
|
+
export var HideStepText = function HideStepText() {
|
|
169
|
+
var steps = [{
|
|
170
|
+
title: 'Included Logs',
|
|
171
|
+
titleVariant: 'h2',
|
|
172
|
+
subTitle: '',
|
|
173
|
+
children: _jsx(Text, {
|
|
174
|
+
children: "Error Logs"
|
|
175
|
+
})
|
|
176
|
+
}];
|
|
177
|
+
return _jsx(React.Fragment, {
|
|
178
|
+
children: _jsx(Box, {
|
|
179
|
+
mt: 4,
|
|
180
|
+
children: _jsx(Wizard, {
|
|
181
|
+
showStepText: false,
|
|
182
|
+
activeStep: 0,
|
|
183
|
+
steps: steps,
|
|
184
|
+
completed: [0],
|
|
185
|
+
className: "vip-wizard-xyz"
|
|
186
|
+
})
|
|
187
|
+
})
|
|
188
|
+
});
|
|
167
189
|
};
|
|
@@ -22,5 +22,6 @@ export interface WizardStepProps {
|
|
|
22
22
|
summary?: WizardStepSummary[];
|
|
23
23
|
shouldFocusTitle?: boolean;
|
|
24
24
|
actionLabel?: string;
|
|
25
|
+
showStepText?: boolean;
|
|
25
26
|
}
|
|
26
27
|
export declare const WizardStep: React.ForwardRefExoticComponent<WizardStepProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -30,11 +30,14 @@ export var WizardStep = /*#__PURE__*/React.forwardRef(function (_ref, forwardRef
|
|
|
30
30
|
summary = _ref.summary,
|
|
31
31
|
onChange = _ref.onChange,
|
|
32
32
|
_ref$actionLabel = _ref.actionLabel,
|
|
33
|
-
actionLabel = _ref$actionLabel === void 0 ? 'Change' : _ref$actionLabel
|
|
33
|
+
actionLabel = _ref$actionLabel === void 0 ? 'Change' : _ref$actionLabel,
|
|
34
|
+
_ref$showStepText = _ref.showStepText,
|
|
35
|
+
showStepText = _ref$showStepText === void 0 ? true : _ref$showStepText;
|
|
34
36
|
var titleRef = React.useRef(null);
|
|
35
37
|
var status = 'inactive';
|
|
36
38
|
var statusText = 'Step not completed';
|
|
37
|
-
if (active) {
|
|
39
|
+
if (active && !(complete && totalSteps === 1)) {
|
|
40
|
+
// if the step is active but is an unique step, we don't want to show as active status
|
|
38
41
|
status = 'active';
|
|
39
42
|
statusText = ''; // not adding the status text for active step since it's announced by aria-current
|
|
40
43
|
} else if (complete) {
|
|
@@ -98,7 +101,7 @@ export var WizardStep = /*#__PURE__*/React.forwardRef(function (_ref, forwardRef
|
|
|
98
101
|
ref: titleRef,
|
|
99
102
|
tabIndex: shouldFocusTitle ? -1 : undefined,
|
|
100
103
|
"aria-current": active ? 'step' : undefined,
|
|
101
|
-
children: [_jsx(Text, {
|
|
104
|
+
children: [showStepText && _jsx(Text, {
|
|
102
105
|
sx: {
|
|
103
106
|
color: 'wizard.step.number.color'
|
|
104
107
|
},
|
|
@@ -606,21 +606,21 @@
|
|
|
606
606
|
"slider": {
|
|
607
607
|
"background": {
|
|
608
608
|
"default": {
|
|
609
|
-
"value": "#
|
|
609
|
+
"value": "#514e4d",
|
|
610
610
|
"type": "color"
|
|
611
611
|
},
|
|
612
612
|
"disabled": {
|
|
613
|
-
"value": "#
|
|
613
|
+
"value": "#514e4d",
|
|
614
614
|
"type": "color"
|
|
615
615
|
}
|
|
616
616
|
},
|
|
617
617
|
"handle": {
|
|
618
618
|
"default": {
|
|
619
|
-
"value": "#
|
|
619
|
+
"value": "#d7d4d3",
|
|
620
620
|
"type": "color"
|
|
621
621
|
},
|
|
622
622
|
"disabled": {
|
|
623
|
-
"value": "#
|
|
623
|
+
"value": "#827f7e",
|
|
624
624
|
"type": "color"
|
|
625
625
|
}
|
|
626
626
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { ThemeUIStyleObject } from 'theme-ui';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { Grid } from '../Grid';
|
|
11
|
+
|
|
12
|
+
export interface DescriptionListProps {
|
|
13
|
+
list: {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}[];
|
|
17
|
+
className?: string;
|
|
18
|
+
sx?: ThemeUIStyleObject;
|
|
19
|
+
labelWidth?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const DescriptionList = forwardRef< HTMLDivElement, DescriptionListProps >(
|
|
23
|
+
( { sx, className, list, labelWidth = '100px' }: DescriptionListProps ) => (
|
|
24
|
+
<>
|
|
25
|
+
{ list.map( item => (
|
|
26
|
+
<Grid
|
|
27
|
+
className={ className }
|
|
28
|
+
as="dl"
|
|
29
|
+
key={ item.label }
|
|
30
|
+
columns={ [ `${ labelWidth } auto` ] }
|
|
31
|
+
sx={ {
|
|
32
|
+
fontSize: 2,
|
|
33
|
+
gap: 2,
|
|
34
|
+
alignItems: 'flex-start',
|
|
35
|
+
...sx,
|
|
36
|
+
} }
|
|
37
|
+
>
|
|
38
|
+
<dt>{ item.label }</dt>
|
|
39
|
+
<dd>{ item.value }</dd>
|
|
40
|
+
</Grid>
|
|
41
|
+
) ) }
|
|
42
|
+
</>
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
DescriptionList.displayName = 'DescriptionList';
|
|
47
|
+
|
|
48
|
+
export default DescriptionList;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
// we'll need jsxImportSource for the sx prop when used with html elements
|
|
3
|
+
|
|
4
|
+
import { DescriptionList } from './DescriptionList';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: 'DescriptionList',
|
|
12
|
+
component: DescriptionList,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const Default = () => (
|
|
16
|
+
<DescriptionList
|
|
17
|
+
list={ [
|
|
18
|
+
{
|
|
19
|
+
label: 'Short Label',
|
|
20
|
+
value:
|
|
21
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: 'Long label to test label width',
|
|
25
|
+
value: 'Value',
|
|
26
|
+
},
|
|
27
|
+
] }
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
@@ -9,7 +9,7 @@ import React from 'react';
|
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
11
|
import { WizardStepProps } from './WizardStep';
|
|
12
|
-
import { Wizard, Box, Label, Input, Button, Checkbox, Flex } from '..';
|
|
12
|
+
import { Wizard, Box, Label, Input, Button, Checkbox, Flex, Text } from '..';
|
|
13
13
|
|
|
14
14
|
export default {
|
|
15
15
|
title: 'Navigation/Wizard',
|
|
@@ -139,3 +139,28 @@ export const WithTitleAutoFocus = () => {
|
|
|
139
139
|
</React.Fragment>
|
|
140
140
|
);
|
|
141
141
|
};
|
|
142
|
+
|
|
143
|
+
export const HideStepText = () => {
|
|
144
|
+
const steps: WizardStepProps[] = [
|
|
145
|
+
{
|
|
146
|
+
title: 'Included Logs',
|
|
147
|
+
titleVariant: 'h2',
|
|
148
|
+
subTitle: '',
|
|
149
|
+
children: <Text>Error Logs</Text>,
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<React.Fragment>
|
|
155
|
+
<Box mt={ 4 }>
|
|
156
|
+
<Wizard
|
|
157
|
+
showStepText={ false }
|
|
158
|
+
activeStep={ 0 }
|
|
159
|
+
steps={ steps }
|
|
160
|
+
completed={ [ 0 ] }
|
|
161
|
+
className="vip-wizard-xyz"
|
|
162
|
+
/>
|
|
163
|
+
</Box>
|
|
164
|
+
</React.Fragment>
|
|
165
|
+
);
|
|
166
|
+
};
|
|
@@ -19,10 +19,19 @@ export interface WizardProps {
|
|
|
19
19
|
skipped?: number[];
|
|
20
20
|
className?: string;
|
|
21
21
|
titleAutofocus?: boolean;
|
|
22
|
+
showStepText?: boolean;
|
|
22
23
|
}
|
|
23
24
|
export const Wizard = React.forwardRef< HTMLDivElement, WizardProps >(
|
|
24
25
|
(
|
|
25
|
-
{
|
|
26
|
+
{
|
|
27
|
+
steps,
|
|
28
|
+
activeStep,
|
|
29
|
+
completed = [],
|
|
30
|
+
skipped = [],
|
|
31
|
+
className = null,
|
|
32
|
+
titleAutofocus = false,
|
|
33
|
+
showStepText = true,
|
|
34
|
+
},
|
|
26
35
|
forwardRef
|
|
27
36
|
) => {
|
|
28
37
|
const [ didMount, setDidMount ] = useState( false );
|
|
@@ -55,6 +64,7 @@ export const Wizard = React.forwardRef< HTMLDivElement, WizardProps >(
|
|
|
55
64
|
onChange={ onChange }
|
|
56
65
|
shouldFocusTitle={ titleAutofocus && didMount }
|
|
57
66
|
actionLabel={ actionLabel }
|
|
67
|
+
showStepText={ showStepText }
|
|
58
68
|
>
|
|
59
69
|
{ children }
|
|
60
70
|
</WizardStep>
|
|
@@ -31,6 +31,7 @@ export interface WizardStepProps {
|
|
|
31
31
|
summary?: WizardStepSummary[];
|
|
32
32
|
shouldFocusTitle?: boolean;
|
|
33
33
|
actionLabel?: string;
|
|
34
|
+
showStepText?: boolean;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
export const WizardStep = React.forwardRef< HTMLDivElement, WizardStepProps >(
|
|
@@ -49,13 +50,15 @@ export const WizardStep = React.forwardRef< HTMLDivElement, WizardStepProps >(
|
|
|
49
50
|
summary,
|
|
50
51
|
onChange,
|
|
51
52
|
actionLabel = 'Change',
|
|
53
|
+
showStepText = true,
|
|
52
54
|
},
|
|
53
55
|
forwardRef
|
|
54
56
|
) => {
|
|
55
57
|
const titleRef = React.useRef< HTMLHeadingElement >( null );
|
|
56
58
|
let status = 'inactive';
|
|
57
59
|
let statusText = 'Step not completed';
|
|
58
|
-
if ( active ) {
|
|
60
|
+
if ( active && ! ( complete && totalSteps === 1 ) ) {
|
|
61
|
+
// if the step is active but is an unique step, we don't want to show as active status
|
|
59
62
|
status = 'active';
|
|
60
63
|
statusText = ''; // not adding the status text for active step since it's announced by aria-current
|
|
61
64
|
} else if ( complete ) {
|
|
@@ -120,9 +123,11 @@ export const WizardStep = React.forwardRef< HTMLDivElement, WizardStepProps >(
|
|
|
120
123
|
tabIndex={ shouldFocusTitle ? -1 : undefined }
|
|
121
124
|
aria-current={ active ? 'step' : undefined }
|
|
122
125
|
>
|
|
123
|
-
|
|
124
|
-
{
|
|
125
|
-
|
|
126
|
+
{ showStepText && (
|
|
127
|
+
<Text sx={ { color: 'wizard.step.number.color' } } aria-hidden="true">
|
|
128
|
+
{ stepText }
|
|
129
|
+
</Text>
|
|
130
|
+
) }
|
|
126
131
|
|
|
127
132
|
<Flex as="span" sx={ { mt: 3, alignItems: 'center' } } aria-hidden="true">
|
|
128
133
|
{ complete ? (
|
|
@@ -606,21 +606,21 @@
|
|
|
606
606
|
"slider": {
|
|
607
607
|
"background": {
|
|
608
608
|
"default": {
|
|
609
|
-
"value": "#
|
|
609
|
+
"value": "#514e4d",
|
|
610
610
|
"type": "color"
|
|
611
611
|
},
|
|
612
612
|
"disabled": {
|
|
613
|
-
"value": "#
|
|
613
|
+
"value": "#514e4d",
|
|
614
614
|
"type": "color"
|
|
615
615
|
}
|
|
616
616
|
},
|
|
617
617
|
"handle": {
|
|
618
618
|
"default": {
|
|
619
|
-
"value": "#
|
|
619
|
+
"value": "#d7d4d3",
|
|
620
620
|
"type": "color"
|
|
621
621
|
},
|
|
622
622
|
"disabled": {
|
|
623
|
-
"value": "#
|
|
623
|
+
"value": "#827f7e",
|
|
624
624
|
"type": "color"
|
|
625
625
|
}
|
|
626
626
|
}
|
|
@@ -606,21 +606,21 @@
|
|
|
606
606
|
"slider": {
|
|
607
607
|
"background": {
|
|
608
608
|
"default": {
|
|
609
|
-
"value": "{color.gray.
|
|
609
|
+
"value": "{color.gray.70}",
|
|
610
610
|
"type": "color"
|
|
611
611
|
},
|
|
612
612
|
"disabled": {
|
|
613
|
-
"value": "{color.gray.
|
|
613
|
+
"value": "{color.gray.70}",
|
|
614
614
|
"type": "color"
|
|
615
615
|
}
|
|
616
616
|
},
|
|
617
617
|
"handle": {
|
|
618
618
|
"default": {
|
|
619
|
-
"value": "{color.
|
|
619
|
+
"value": "{color.gray.15}",
|
|
620
620
|
"type": "color"
|
|
621
621
|
},
|
|
622
622
|
"disabled": {
|
|
623
|
-
"value": "{color.gray.
|
|
623
|
+
"value": "{color.gray.50}",
|
|
624
624
|
"type": "color"
|
|
625
625
|
}
|
|
626
626
|
}
|