@pingux/astro 2.140.0-alpha.4 → 2.140.0-alpha.5
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/lib/cjs/components/Callout/Callout.stories.js +16 -6
- package/lib/cjs/components/Stepper/Step.js +11 -4
- package/lib/cjs/components/Stepper/Stepper.js +42 -8
- package/lib/cjs/components/Stepper/Stepper.stories.js +48 -2
- package/lib/cjs/components/Stepper/Stepper.styles.js +85 -30
- package/lib/cjs/components/Text/Text.styles.d.ts +840 -0
- package/lib/cjs/components/Text/Text.styles.js +10 -1
- package/lib/components/Callout/Callout.stories.js +16 -6
- package/lib/components/Stepper/Step.js +11 -4
- package/lib/components/Stepper/Stepper.js +43 -9
- package/lib/components/Stepper/Stepper.stories.js +45 -0
- package/lib/components/Stepper/Stepper.styles.js +83 -29
- package/lib/components/Text/Text.styles.js +10 -1
- package/package.json +1 -1
@@ -50,6 +50,14 @@ var tabLabel = _objectSpread(_objectSpread(_objectSpread({}, base), wordWrap), {
|
|
50
50
|
color: 'neutral.80'
|
51
51
|
}
|
52
52
|
});
|
53
|
+
var stepperLabel = _objectSpread(_objectSpread({}, base), {}, {
|
54
|
+
fontSize: '14px',
|
55
|
+
fontWeight: '500',
|
56
|
+
display: 'flex',
|
57
|
+
ml: '14px',
|
58
|
+
color: 'neutral.30',
|
59
|
+
cursor: 'pointer'
|
60
|
+
});
|
53
61
|
var environmentBreadcrumb = _objectSpread(_objectSpread({}, base), {}, {
|
54
62
|
fontSize: 'sm',
|
55
63
|
fontWeight: 3,
|
@@ -249,6 +257,7 @@ var text = _objectSpread(_objectSpread(_objectSpread({
|
|
249
257
|
title: title,
|
250
258
|
copyRightText: copyRightText,
|
251
259
|
attachmentTitle: attachmentTitle,
|
252
|
-
messagesText: _objectSpread({}, base)
|
260
|
+
messagesText: _objectSpread({}, base),
|
261
|
+
stepperLabel: stepperLabel
|
253
262
|
});
|
254
263
|
exports.text = text;
|
@@ -116,15 +116,25 @@ Warning.parameters = {
|
|
116
116
|
url: FIGMA_LINKS.callout.warning
|
117
117
|
}
|
118
118
|
};
|
119
|
+
var iconContainer = {
|
120
|
+
display: 'flex',
|
121
|
+
justifyContent: 'center',
|
122
|
+
alignItems: 'center',
|
123
|
+
width: 25,
|
124
|
+
height: 25,
|
125
|
+
minWidth: 25,
|
126
|
+
minHeight: 25,
|
127
|
+
borderStyle: 'solid',
|
128
|
+
borderRadius: '50%',
|
129
|
+
backgroundColor: 'active',
|
130
|
+
borderColor: 'active',
|
131
|
+
color: 'text.primaryLight',
|
132
|
+
mx: 'md'
|
133
|
+
};
|
119
134
|
export var WithCustomIcon = function WithCustomIcon() {
|
120
135
|
return ___EmotionJSX(Callout, {
|
121
136
|
icon: ___EmotionJSX(Box, {
|
122
|
-
|
123
|
-
mx: "md",
|
124
|
-
minHeight: 25,
|
125
|
-
minWidth: 25,
|
126
|
-
height: 25,
|
127
|
-
width: 25
|
137
|
+
sx: iconContainer
|
128
138
|
}, ___EmotionJSX(Icon, {
|
129
139
|
icon: CheckBoldIcon,
|
130
140
|
title: {
|
@@ -5,31 +5,38 @@ import CheckBoldIcon from '@pingux/mdi-react/CheckBoldIcon';
|
|
5
5
|
import { useHover } from '@react-aria/interactions';
|
6
6
|
import PropTypes from 'prop-types';
|
7
7
|
import { Box, Icon } from '../../index';
|
8
|
+
import ORIENTATION from '../../utils/devUtils/constants/orientation';
|
8
9
|
import { stepStatuses } from './Stepper.constants';
|
9
10
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
11
|
var COMPLETED = stepStatuses.COMPLETED,
|
11
12
|
INACTIVE = stepStatuses.INACTIVE;
|
12
13
|
var Step = /*#__PURE__*/forwardRef(function (props, ref) {
|
13
14
|
var status = props.status,
|
14
|
-
value = props.value
|
15
|
+
value = props.value,
|
16
|
+
className = props.className,
|
17
|
+
orientation = props.orientation;
|
15
18
|
var _useHover = useHover(props),
|
16
19
|
hoverProps = _useHover.hoverProps,
|
17
20
|
isHovered = _useHover.isHovered;
|
21
|
+
var stepValue = orientation !== ORIENTATION.VERTICAL && value;
|
18
22
|
return ___EmotionJSX(Box, _extends({
|
19
23
|
variant: "stepper.step.".concat(status),
|
20
24
|
ref: ref
|
21
|
-
}, hoverProps
|
25
|
+
}, hoverProps, {
|
26
|
+
className: className
|
27
|
+
}), status === COMPLETED && !isHovered ? ___EmotionJSX(Icon, {
|
22
28
|
icon: CheckBoldIcon,
|
23
29
|
size: 23,
|
24
30
|
color: "text.primaryLight",
|
25
31
|
title: {
|
26
32
|
name: 'Check Bold Icon'
|
27
33
|
}
|
28
|
-
}) :
|
34
|
+
}) : stepValue);
|
29
35
|
});
|
30
36
|
Step.propTypes = {
|
31
37
|
status: PropTypes.oneOf(_Object$values(stepStatuses)),
|
32
|
-
value: PropTypes.number
|
38
|
+
value: PropTypes.number,
|
39
|
+
orientation: PropTypes.oneOf([ORIENTATION.VERTICAL, ORIENTATION.HORIZONTAL])
|
33
40
|
};
|
34
41
|
Step.defaultProps = {
|
35
42
|
status: INACTIVE,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
4
|
-
var _excluded = ["activeStep", "onStepChange", "tabListProps", "tooltipProps"];
|
4
|
+
var _excluded = ["activeStep", "onStepChange", "tabListProps", "tooltipProps", "orientation", "className"];
|
5
5
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
7
7
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
@@ -19,10 +19,13 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
|
|
19
19
|
import React, { forwardRef } from 'react';
|
20
20
|
import { useSingleSelectListState } from '@react-stately/list';
|
21
21
|
import PropTypes from 'prop-types';
|
22
|
-
import { Step, Tab, Tabs } from '../..';
|
22
|
+
import { Box, Step, Tab, Tabs, Text } from '../..';
|
23
|
+
import { useStatusClasses } from '../../hooks';
|
24
|
+
import ORIENTATION from '../../utils/devUtils/constants/orientation';
|
23
25
|
import isValidPositiveInt from '../../utils/devUtils/props/isValidPositiveInt';
|
24
26
|
import Line from './Line';
|
25
27
|
import { stepStatuses } from './Stepper.constants';
|
28
|
+
import { verticalLine } from './Stepper.styles';
|
26
29
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
27
30
|
var ACTIVE = stepStatuses.ACTIVE,
|
28
31
|
COMPLETED = stepStatuses.COMPLETED,
|
@@ -33,6 +36,8 @@ var Stepper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
33
36
|
onStepChange = props.onStepChange,
|
34
37
|
tabListProps = props.tabListProps,
|
35
38
|
tooltipProps = props.tooltipProps,
|
39
|
+
orientation = props.orientation,
|
40
|
+
className = props.className,
|
36
41
|
others = _objectWithoutProperties(props, _excluded);
|
37
42
|
var state = useSingleSelectListState(props);
|
38
43
|
var getStatus = function getStatus(i) {
|
@@ -49,23 +54,46 @@ var Stepper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
49
54
|
onStepChange(+key);
|
50
55
|
}
|
51
56
|
};
|
57
|
+
var _useStatusClasses = useStatusClasses(className, {
|
58
|
+
'is-vertical': orientation === ORIENTATION.VERTICAL,
|
59
|
+
'is-horizontal': orientation === ORIENTATION.HORIZONTAL
|
60
|
+
}),
|
61
|
+
classNames = _useStatusClasses.classNames;
|
52
62
|
var steps = _Array$from(state.collection);
|
53
63
|
var lines = _mapInstanceProperty(steps).call(steps, function (_v, i) {
|
54
64
|
return ___EmotionJSX(Line, {
|
65
|
+
className: classNames,
|
55
66
|
status: getStatus(i + 2)
|
56
67
|
});
|
57
68
|
});
|
58
69
|
var isFirst = true; // make sure not to insert until there's at least one non-null child
|
59
70
|
|
60
71
|
var render = _mapInstanceProperty(steps).call(steps, function (item, i) {
|
72
|
+
var _item$props;
|
61
73
|
var stepIndex = i + 1;
|
62
74
|
var stepStatus = getStatus(stepIndex);
|
75
|
+
var line = _Array$isArray(lines) ? lines[i - 1] : lines;
|
76
|
+
var defaultIndicator = ___EmotionJSX(Box, {
|
77
|
+
variant: "forms.label.indicator"
|
78
|
+
}, "*");
|
63
79
|
var step = ___EmotionJSX(Step, {
|
64
80
|
key: item.key,
|
65
81
|
value: stepIndex,
|
66
|
-
status: stepStatus
|
82
|
+
status: stepStatus,
|
83
|
+
className: classNames,
|
84
|
+
orientation: orientation
|
67
85
|
});
|
68
|
-
var
|
86
|
+
var verticalStep = ___EmotionJSX(Box, {
|
87
|
+
isRow: true
|
88
|
+
}, ___EmotionJSX(Step, {
|
89
|
+
key: item.key,
|
90
|
+
value: stepIndex,
|
91
|
+
status: stepStatus,
|
92
|
+
className: classNames,
|
93
|
+
orientation: orientation
|
94
|
+
}), ___EmotionJSX(Text, {
|
95
|
+
variant: "stepperLabel"
|
96
|
+
}, item.textValue, (item === null || item === void 0 || (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.isRequired) && defaultIndicator));
|
69
97
|
|
70
98
|
/* istanbul ignore next */
|
71
99
|
var textValue = item && item.value && item.value.label || item.textValue || stepIndex.toString();
|
@@ -79,11 +107,12 @@ var Stepper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
79
107
|
variant: 'stepper.tabLabel'
|
80
108
|
},
|
81
109
|
textValue: textValue,
|
82
|
-
title: step,
|
110
|
+
title: orientation === ORIENTATION.VERTICAL ? verticalStep : step,
|
83
111
|
"aria-label": textValue,
|
84
112
|
content: item.rendered,
|
85
|
-
separator: !isFirst && line,
|
86
|
-
tooltipTriggerProps: tooltipProps
|
113
|
+
separator: !isFirst && orientation === ORIENTATION.HORIZONTAL && !isFirst && line,
|
114
|
+
tooltipTriggerProps: tooltipProps,
|
115
|
+
sx: i !== steps.length - 1 && orientation === ORIENTATION.VERTICAL && verticalLine
|
87
116
|
});
|
88
117
|
isFirst = isFirst && !container;
|
89
118
|
return container;
|
@@ -97,7 +126,8 @@ var Stepper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
97
126
|
}, tabListProps),
|
98
127
|
onSelectionChange: onStepChangeHandler,
|
99
128
|
selectedKey: activeStep === null || activeStep === void 0 ? void 0 : activeStep.toString(),
|
100
|
-
mode: "tooltip"
|
129
|
+
mode: "tooltip",
|
130
|
+
orientation: orientation
|
101
131
|
}, others), render);
|
102
132
|
});
|
103
133
|
Stepper.propTypes = {
|
@@ -121,7 +151,11 @@ Stepper.propTypes = {
|
|
121
151
|
onStepChange: PropTypes.func,
|
122
152
|
/** A props object that is subsequently spread into the rendered tablist. */
|
123
153
|
tabListProps: PropTypes.shape({}),
|
124
|
-
tooltipProps: PropTypes.shape({})
|
154
|
+
tooltipProps: PropTypes.shape({}),
|
155
|
+
orientation: PropTypes.oneOf(['vertical', 'horizontal'])
|
125
156
|
};
|
126
157
|
Stepper.displayName = 'Stepper';
|
158
|
+
Stepper.defaultProps = {
|
159
|
+
orientation: 'horizontal'
|
160
|
+
};
|
127
161
|
export default Stepper;
|
@@ -70,6 +70,23 @@ var steps = [{
|
|
70
70
|
title: 'Excepteur Sint',
|
71
71
|
name: 'step3'
|
72
72
|
}];
|
73
|
+
var customSteps = [{
|
74
|
+
label: 'Duis Aute',
|
75
|
+
children: 'Quis autem vel eum iure reprehenderit qui in ea voluptate',
|
76
|
+
title: 'Duis Aute',
|
77
|
+
name: 'step1',
|
78
|
+
isRequired: true
|
79
|
+
}, {
|
80
|
+
label: 'Lorem Ipsum',
|
81
|
+
children: 'Sed ut perspiciatis unde omnis',
|
82
|
+
title: 'Lorem Ipsum',
|
83
|
+
name: 'step2'
|
84
|
+
}, {
|
85
|
+
label: 'Excepteur Sint',
|
86
|
+
children: 'Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam',
|
87
|
+
title: 'Excepteur Sint',
|
88
|
+
name: 'step3'
|
89
|
+
}];
|
73
90
|
var sx = {
|
74
91
|
overlayPanel: {
|
75
92
|
padding: '0px',
|
@@ -84,6 +101,11 @@ var sx = {
|
|
84
101
|
},
|
85
102
|
buttonStyle: {
|
86
103
|
margin: '50px 0px'
|
104
|
+
},
|
105
|
+
verticalContentContainer: {
|
106
|
+
marginTop: 'lg',
|
107
|
+
ml: 'lg',
|
108
|
+
gap: 'sm'
|
87
109
|
}
|
88
110
|
};
|
89
111
|
export var Default = function Default(args) {
|
@@ -274,4 +296,27 @@ export var Panel = function Panel() {
|
|
274
296
|
}, item.children)));
|
275
297
|
})))
|
276
298
|
);
|
299
|
+
};
|
300
|
+
export var VerticalStepper = function VerticalStepper() {
|
301
|
+
var _useState5 = useState(2),
|
302
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
303
|
+
activeStep = _useState6[0],
|
304
|
+
setActiveStep = _useState6[1];
|
305
|
+
return ___EmotionJSX(Stepper, {
|
306
|
+
items: customSteps,
|
307
|
+
activeStep: activeStep,
|
308
|
+
onStepChange: setActiveStep,
|
309
|
+
orientation: "vertical",
|
310
|
+
mode: "tooltipIsDisabled"
|
311
|
+
}, function (item) {
|
312
|
+
return ___EmotionJSX(Item, {
|
313
|
+
key: item.name,
|
314
|
+
textValue: item.title,
|
315
|
+
isRequired: item === null || item === void 0 ? void 0 : item.isRequired
|
316
|
+
}, ___EmotionJSX(Box, {
|
317
|
+
sx: sx.verticalContentContainer
|
318
|
+
}, ___EmotionJSX(Text, {
|
319
|
+
fontSize: "md"
|
320
|
+
}, item.children)));
|
321
|
+
});
|
277
322
|
};
|
@@ -18,19 +18,48 @@ var tabs = {
|
|
18
18
|
outline: 'none',
|
19
19
|
borderBottom: 'none',
|
20
20
|
mb: 0,
|
21
|
-
|
22
|
-
|
21
|
+
justifyContent: 'center',
|
22
|
+
'&.is-horizontal': {
|
23
|
+
width: '100%'
|
24
|
+
},
|
25
|
+
'&.is-vertical': {
|
26
|
+
minWidth: '217px',
|
27
|
+
borderRight: '1px solid #e4e6e9'
|
28
|
+
}
|
29
|
+
};
|
30
|
+
export var verticalLine = {
|
31
|
+
'&:before': {
|
32
|
+
position: 'absolute',
|
33
|
+
content: '""',
|
34
|
+
borderLeft: '2px solid',
|
35
|
+
borderLeftColor: 'neutral.80',
|
36
|
+
left: '27px',
|
37
|
+
top: '28px',
|
38
|
+
height: '26px'
|
39
|
+
}
|
23
40
|
};
|
24
41
|
var tab = {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
42
|
+
'&.is-horizontal': {
|
43
|
+
mb: 0,
|
44
|
+
mr: 0,
|
45
|
+
outline: 'none',
|
46
|
+
'&.is-focused': _objectSpread({
|
47
|
+
borderRadius: '50%'
|
48
|
+
}, defaultFocus),
|
49
|
+
'&:not(:first-of-type)': {
|
50
|
+
flex: 1,
|
51
|
+
maxWidth: 122
|
52
|
+
}
|
53
|
+
},
|
54
|
+
'&.is-vertical': {
|
55
|
+
position: 'relative',
|
56
|
+
height: '42px',
|
57
|
+
width: '100%',
|
58
|
+
py: '12px',
|
59
|
+
px: '20px',
|
60
|
+
':focus-visible:not(.is-focused)': {
|
61
|
+
outline: 'none'
|
62
|
+
}
|
34
63
|
}
|
35
64
|
};
|
36
65
|
var tabLabel = {
|
@@ -42,13 +71,13 @@ var outerWrapper = {
|
|
42
71
|
|
43
72
|
/** Step styles */
|
44
73
|
var stepBase = {
|
74
|
+
display: 'flex',
|
75
|
+
justifyContent: 'center',
|
76
|
+
alignItems: 'center',
|
45
77
|
width: 32,
|
46
78
|
height: 32,
|
47
79
|
minWidth: 32,
|
48
80
|
minHeight: 32,
|
49
|
-
display: 'flex',
|
50
|
-
justifyContent: 'center',
|
51
|
-
alignItems: 'center',
|
52
81
|
borderWidth: 1,
|
53
82
|
borderStyle: 'solid',
|
54
83
|
borderRadius: '50%',
|
@@ -61,22 +90,47 @@ var stepBase = {
|
|
61
90
|
color: 'text.primaryLight'
|
62
91
|
}
|
63
92
|
};
|
93
|
+
var stepBaseVertical = _objectSpread(_objectSpread({}, stepBase), {}, {
|
94
|
+
width: 16,
|
95
|
+
height: 16,
|
96
|
+
minWidth: 16,
|
97
|
+
minHeight: 16
|
98
|
+
});
|
64
99
|
var step = {
|
65
|
-
active:
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
100
|
+
active: {
|
101
|
+
'&.is-horizontal': _objectSpread({
|
102
|
+
backgroundColor: 'accent.99',
|
103
|
+
borderColor: 'active',
|
104
|
+
color: 'active'
|
105
|
+
}, stepBase),
|
106
|
+
'&.is-vertical': _objectSpread(_objectSpread({}, stepBaseVertical), {}, {
|
107
|
+
backgroundColor: '#fff',
|
108
|
+
border: '4px solid',
|
109
|
+
borderColor: 'active'
|
110
|
+
})
|
111
|
+
},
|
112
|
+
completed: {
|
113
|
+
'&.is-horizontal': _objectSpread({
|
114
|
+
backgroundColor: 'active',
|
115
|
+
borderColor: 'active',
|
116
|
+
color: 'text.primaryLight'
|
117
|
+
}, stepBase),
|
118
|
+
'&.is-vertical': _objectSpread({
|
119
|
+
backgroundColor: 'active',
|
120
|
+
borderColor: 'transparent'
|
121
|
+
}, stepBaseVertical)
|
122
|
+
},
|
123
|
+
inactive: {
|
124
|
+
'&.is-horizontal': _objectSpread({
|
125
|
+
backgroundColor: 'white',
|
126
|
+
borderColor: 'neutral.80',
|
127
|
+
color: 'neutral.40'
|
128
|
+
}, stepBase),
|
129
|
+
'&.is-vertical': _objectSpread(_objectSpread({}, stepBaseVertical), {}, {
|
130
|
+
backgroundColor: '#caced3',
|
131
|
+
border: '4px solid #fff'
|
132
|
+
})
|
133
|
+
}
|
80
134
|
};
|
81
135
|
|
82
136
|
/** Line styles */
|
@@ -41,6 +41,14 @@ var tabLabel = _objectSpread(_objectSpread(_objectSpread({}, base), wordWrap), {
|
|
41
41
|
color: 'neutral.80'
|
42
42
|
}
|
43
43
|
});
|
44
|
+
var stepperLabel = _objectSpread(_objectSpread({}, base), {}, {
|
45
|
+
fontSize: '14px',
|
46
|
+
fontWeight: '500',
|
47
|
+
display: 'flex',
|
48
|
+
ml: '14px',
|
49
|
+
color: 'neutral.30',
|
50
|
+
cursor: 'pointer'
|
51
|
+
});
|
44
52
|
var environmentBreadcrumb = _objectSpread(_objectSpread({}, base), {}, {
|
45
53
|
fontSize: 'sm',
|
46
54
|
fontWeight: 3,
|
@@ -240,5 +248,6 @@ export var text = _objectSpread(_objectSpread(_objectSpread({
|
|
240
248
|
title: title,
|
241
249
|
copyRightText: copyRightText,
|
242
250
|
attachmentTitle: attachmentTitle,
|
243
|
-
messagesText: _objectSpread({}, base)
|
251
|
+
messagesText: _objectSpread({}, base),
|
252
|
+
stepperLabel: stepperLabel
|
244
253
|
});
|