@ultraviolet/ui 1.23.0 → 1.24.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/dist/index.d.ts +3 -1
- package/dist/src/components/Stepper/index.js +76 -38
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2344,12 +2344,14 @@ type StepperProps = {
|
|
|
2344
2344
|
selected?: number;
|
|
2345
2345
|
children: ReactNode[];
|
|
2346
2346
|
className?: string;
|
|
2347
|
+
labelPosition?: 'bottom' | 'right';
|
|
2348
|
+
size?: 'small' | 'medium';
|
|
2347
2349
|
'data-testid'?: string;
|
|
2348
2350
|
};
|
|
2349
2351
|
/**
|
|
2350
2352
|
* Stepper component to show the progress of a process in a linear way.
|
|
2351
2353
|
*/
|
|
2352
|
-
declare const Stepper: ({ children, selected, animated, className, "data-testid": dataTestId, }: StepperProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
2354
|
+
declare const Stepper: ({ children, selected, animated, className, labelPosition, size, "data-testid": dataTestId, }: StepperProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
2353
2355
|
|
|
2354
2356
|
type SwitchButtonProps = {
|
|
2355
2357
|
name: string;
|
|
@@ -7,6 +7,10 @@ import { Text } from '../Text/index.js';
|
|
|
7
7
|
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
8
8
|
|
|
9
9
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10
|
+
const LINE_HEIGHT_SIZES = {
|
|
11
|
+
small: 2,
|
|
12
|
+
medium: 4
|
|
13
|
+
};
|
|
10
14
|
const loadingAnimation = keyframes`
|
|
11
15
|
from {
|
|
12
16
|
width: 0;
|
|
@@ -16,7 +20,7 @@ const loadingAnimation = keyframes`
|
|
|
16
20
|
}
|
|
17
21
|
`;
|
|
18
22
|
const StyledStepContainer = /*#__PURE__*/_styled("div", {
|
|
19
|
-
target: "
|
|
23
|
+
target: "e19ft7rb4"
|
|
20
24
|
})(process.env.NODE_ENV === "production" ? {
|
|
21
25
|
name: "b8wmnj",
|
|
22
26
|
styles: "display:flex;flex-direction:column;align-items:center;justify-content:flex-start"
|
|
@@ -26,99 +30,128 @@ const StyledStepContainer = /*#__PURE__*/_styled("div", {
|
|
|
26
30
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
27
31
|
});
|
|
28
32
|
const StyledText = /*#__PURE__*/_styled(Text, {
|
|
29
|
-
target: "
|
|
33
|
+
target: "e19ft7rb3"
|
|
30
34
|
})("margin-top:", _ref => {
|
|
31
35
|
let {
|
|
32
36
|
theme
|
|
33
37
|
} = _ref;
|
|
34
38
|
return theme.space['1'];
|
|
35
39
|
}, ";");
|
|
40
|
+
const StyledBullet = /*#__PURE__*/_styled(Bullet, {
|
|
41
|
+
target: "e19ft7rb2"
|
|
42
|
+
})("margin-top:", _ref2 => {
|
|
43
|
+
let {
|
|
44
|
+
theme,
|
|
45
|
+
size
|
|
46
|
+
} = _ref2;
|
|
47
|
+
return size === 'small' ? theme.space['0.5'] : 0;
|
|
48
|
+
}, ";");
|
|
36
49
|
const loadingStyle = /*#__PURE__*/css("animation:", loadingAnimation, " 1s linear infinite;");
|
|
37
50
|
const StyledLine = /*#__PURE__*/_styled("div", {
|
|
38
51
|
target: "e19ft7rb1"
|
|
39
|
-
})("border-radius:",
|
|
52
|
+
})("border-radius:", _ref3 => {
|
|
40
53
|
let {
|
|
41
54
|
theme
|
|
42
|
-
} =
|
|
55
|
+
} = _ref3;
|
|
43
56
|
return theme.radii.default;
|
|
44
|
-
}, ";flex-grow:1;border-radius:",
|
|
57
|
+
}, ";flex-grow:1;border-radius:", _ref4 => {
|
|
45
58
|
let {
|
|
46
59
|
theme
|
|
47
|
-
} =
|
|
60
|
+
} = _ref4;
|
|
48
61
|
return theme.radii.default;
|
|
49
|
-
}, ";background-color:",
|
|
62
|
+
}, ";background-color:", _ref5 => {
|
|
50
63
|
let {
|
|
51
64
|
theme
|
|
52
|
-
} =
|
|
65
|
+
} = _ref5;
|
|
53
66
|
return theme.colors.neutral.backgroundStrong;
|
|
54
|
-
}, ";position:relative;::after{content:'';position:absolute;left:0;top:0;height:100%;border-radius:",
|
|
67
|
+
}, ";position:relative;::after{content:'';position:absolute;left:0;top:0;height:100%;border-radius:", _ref6 => {
|
|
55
68
|
let {
|
|
56
69
|
theme
|
|
57
|
-
} =
|
|
70
|
+
} = _ref6;
|
|
58
71
|
return theme.radii.default;
|
|
59
|
-
}, ";background-color:",
|
|
72
|
+
}, ";background-color:", _ref7 => {
|
|
60
73
|
let {
|
|
61
74
|
theme
|
|
62
|
-
} =
|
|
75
|
+
} = _ref7;
|
|
63
76
|
return theme.colors.primary.backgroundStrong;
|
|
64
|
-
}, ";",
|
|
77
|
+
}, ";", _ref8 => {
|
|
65
78
|
let {
|
|
66
79
|
temporal
|
|
67
|
-
} =
|
|
80
|
+
} = _ref8;
|
|
68
81
|
return temporal === 'previous' && `width: 100%;`;
|
|
69
|
-
}, " ",
|
|
82
|
+
}, " ", _ref9 => {
|
|
70
83
|
let {
|
|
71
84
|
temporal,
|
|
72
85
|
animated
|
|
73
|
-
} =
|
|
86
|
+
} = _ref9;
|
|
74
87
|
return temporal === 'current' && animated && loadingStyle;
|
|
75
88
|
}, ";}");
|
|
76
89
|
const StyledContainer = /*#__PURE__*/_styled("div", {
|
|
77
90
|
target: "e19ft7rb0"
|
|
78
|
-
})("display:flex;flex-direction:row;justify-content:center;align-items:flex-start;gap:0 ",
|
|
79
|
-
let {
|
|
80
|
-
theme
|
|
81
|
-
} = _ref9;
|
|
82
|
-
return theme.space['1'];
|
|
83
|
-
}, ";", StyledStepContainer, "{width:", _ref10 => {
|
|
91
|
+
})("display:flex;flex-direction:row;justify-content:center;align-items:flex-start;gap:0 ", _ref10 => {
|
|
84
92
|
let {
|
|
85
93
|
theme
|
|
86
94
|
} = _ref10;
|
|
87
|
-
return theme.space['
|
|
88
|
-
}, ";
|
|
95
|
+
return theme.space['1'];
|
|
96
|
+
}, ";gap:", _ref11 => {
|
|
89
97
|
let {
|
|
90
|
-
theme
|
|
98
|
+
theme,
|
|
99
|
+
labelPosition,
|
|
100
|
+
size
|
|
91
101
|
} = _ref11;
|
|
92
|
-
return theme.space['0.
|
|
93
|
-
}, ";
|
|
102
|
+
return size === 'medium' && labelPosition === 'bottom' ? theme.space['0'] : theme.space['1'];
|
|
103
|
+
}, ";", StyledStepContainer, "{display:flex;flex-direction:", _ref12 => {
|
|
94
104
|
let {
|
|
95
|
-
|
|
105
|
+
labelPosition
|
|
96
106
|
} = _ref12;
|
|
107
|
+
return labelPosition === 'bottom' ? 'column' : 'row';
|
|
108
|
+
}, ";align-items:", _ref13 => {
|
|
109
|
+
let {
|
|
110
|
+
labelPosition
|
|
111
|
+
} = _ref13;
|
|
112
|
+
return labelPosition === 'bottom' ? 'center' : 'baseline';
|
|
113
|
+
}, ";gap:", _ref14 => {
|
|
114
|
+
let {
|
|
115
|
+
theme,
|
|
116
|
+
labelPosition
|
|
117
|
+
} = _ref14;
|
|
118
|
+
return labelPosition === 'bottom' ? theme.space['0.5'] : theme.space['1'];
|
|
119
|
+
}, ";white-space:nowrap;}", StyledLine, "{height:", _ref15 => {
|
|
120
|
+
let {
|
|
121
|
+
size
|
|
122
|
+
} = _ref15;
|
|
123
|
+
return LINE_HEIGHT_SIZES[size];
|
|
124
|
+
}, "px;margin-top:", _ref16 => {
|
|
125
|
+
let {
|
|
126
|
+
theme
|
|
127
|
+
} = _ref16;
|
|
97
128
|
return theme.space['2'];
|
|
98
|
-
}, ";margin-bottom:",
|
|
129
|
+
}, ";margin-bottom:", _ref17 => {
|
|
99
130
|
let {
|
|
100
131
|
theme
|
|
101
|
-
} =
|
|
132
|
+
} = _ref17;
|
|
102
133
|
return theme.space['2'];
|
|
103
134
|
}, ";}");
|
|
104
|
-
const StepperNumbers =
|
|
135
|
+
const StepperNumbers = _ref18 => {
|
|
105
136
|
let {
|
|
106
137
|
temporal,
|
|
107
138
|
children,
|
|
108
|
-
CurrentStep
|
|
109
|
-
|
|
139
|
+
CurrentStep,
|
|
140
|
+
size = 'medium'
|
|
141
|
+
} = _ref18;
|
|
110
142
|
return jsxs(StyledStepContainer, {
|
|
111
|
-
children: [jsx(
|
|
143
|
+
children: [jsx(StyledBullet, {
|
|
112
144
|
sentiment: temporal === 'next' ? 'neutral' : 'primary',
|
|
113
145
|
...(temporal === 'previous' ? {
|
|
114
146
|
icon: 'check'
|
|
115
147
|
} : {
|
|
116
148
|
text: CurrentStep.toString()
|
|
117
149
|
}),
|
|
118
|
-
prominence: temporal !== 'current' ? 'default' : 'strong'
|
|
150
|
+
prominence: temporal !== 'current' ? 'default' : 'strong',
|
|
151
|
+
size: size
|
|
119
152
|
}), jsx(StyledText, {
|
|
120
153
|
as: "span",
|
|
121
|
-
variant:
|
|
154
|
+
variant: size === 'medium' ? 'body' : 'bodySmall',
|
|
122
155
|
prominence: temporal === 'next' ? 'weak' : 'default',
|
|
123
156
|
children: children
|
|
124
157
|
})]
|
|
@@ -127,18 +160,22 @@ const StepperNumbers = _ref14 => {
|
|
|
127
160
|
/**
|
|
128
161
|
* Stepper component to show the progress of a process in a linear way.
|
|
129
162
|
*/
|
|
130
|
-
const Stepper =
|
|
163
|
+
const Stepper = _ref19 => {
|
|
131
164
|
let {
|
|
132
165
|
children,
|
|
133
166
|
selected = 0,
|
|
134
167
|
animated = false,
|
|
135
168
|
className,
|
|
169
|
+
labelPosition = 'bottom',
|
|
170
|
+
size = 'medium',
|
|
136
171
|
'data-testid': dataTestId
|
|
137
|
-
} =
|
|
172
|
+
} = _ref19;
|
|
138
173
|
const lastStep = Children.count(children) - 1;
|
|
139
174
|
return jsx(StyledContainer, {
|
|
140
175
|
className: className,
|
|
141
176
|
"data-testid": dataTestId,
|
|
177
|
+
labelPosition: labelPosition,
|
|
178
|
+
size: size,
|
|
142
179
|
children: flattenChildren(children).map((child, index) => {
|
|
143
180
|
const getTemporal = () => {
|
|
144
181
|
if (selected > index) return 'previous';
|
|
@@ -153,6 +190,7 @@ const Stepper = _ref15 => {
|
|
|
153
190
|
children: [jsx(StepperNumbers, {
|
|
154
191
|
CurrentStep: index + 1,
|
|
155
192
|
temporal: temporal,
|
|
193
|
+
size: size,
|
|
156
194
|
children: child
|
|
157
195
|
}), isNotLast ? jsx(StyledLine, {
|
|
158
196
|
temporal: temporal,
|