carbon-react 125.10.0 → 125.11.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.
Files changed (28) hide show
  1. package/esm/components/heading/heading.style.d.ts +1 -1
  2. package/esm/components/step-flow/index.d.ts +2 -0
  3. package/esm/components/step-flow/index.js +1 -0
  4. package/esm/components/step-flow/step-flow.component.d.ts +33 -0
  5. package/esm/components/step-flow/step-flow.component.js +277 -0
  6. package/esm/components/step-flow/step-flow.style.d.ts +12 -0
  7. package/esm/components/step-flow/step-flow.style.js +42 -0
  8. package/esm/components/typography/index.d.ts +1 -1
  9. package/esm/components/typography/typography.component.d.ts +3 -1
  10. package/esm/components/typography/typography.component.js +3 -1
  11. package/esm/locales/__internal__/pl-pl.js +5 -0
  12. package/esm/locales/en-gb.js +5 -0
  13. package/esm/locales/locale.d.ts +5 -0
  14. package/lib/components/heading/heading.style.d.ts +1 -1
  15. package/lib/components/step-flow/index.d.ts +2 -0
  16. package/lib/components/step-flow/index.js +13 -0
  17. package/lib/components/step-flow/package.json +6 -0
  18. package/lib/components/step-flow/step-flow.component.d.ts +33 -0
  19. package/lib/components/step-flow/step-flow.component.js +285 -0
  20. package/lib/components/step-flow/step-flow.style.d.ts +12 -0
  21. package/lib/components/step-flow/step-flow.style.js +48 -0
  22. package/lib/components/typography/index.d.ts +1 -1
  23. package/lib/components/typography/typography.component.d.ts +3 -1
  24. package/lib/components/typography/typography.component.js +3 -1
  25. package/lib/locales/__internal__/pl-pl.js +5 -0
  26. package/lib/locales/en-gb.js +5 -0
  27. package/lib/locales/locale.d.ts +5 -0
  28. package/package.json +1 -1
@@ -12,7 +12,7 @@ declare type StyledHeadingTitleProps = {
12
12
  withMargin?: boolean;
13
13
  };
14
14
  declare const StyledHeadingTitle: import("styled-components").StyledComponent<{
15
- ({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, isDisabled, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
15
+ ({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, isDisabled, "aria-hidden": ariaHidden, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
16
16
  displayName: string;
17
17
  }, any, StyledHeadingTitleProps, never>;
18
18
  declare const StyledHeadingPills: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -0,0 +1,2 @@
1
+ export { default as StepFlow } from "./step-flow.component";
2
+ export type { StepFlowProps } from "./step-flow.component";
@@ -0,0 +1 @@
1
+ export { default as StepFlow } from "./step-flow.component";
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import { MarginProps } from "styled-system";
3
+ import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
4
+ export declare type Steps = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
5
+ export interface StepFlowProps extends MarginProps, TagProps {
6
+ /** A category for the user journey. */
7
+ category?: string;
8
+ /** The title of the current step. */
9
+ title: string;
10
+ /** Set the variant of the internal 'Typography' component which contains the title.
11
+ * However, despite the chosen variant the styling will always be overridden.
12
+ */
13
+ titleVariant?: "h1" | "h2";
14
+ /** The total steps in the user journey. */
15
+ totalSteps: Steps;
16
+ /**
17
+ * The current step of the user journey. If the set `currentStep` is higher than
18
+ * `totalSteps`the value of `currentStep` will be that of `totalSteps` instead.
19
+ */
20
+ currentStep: Steps;
21
+ /** Determines if the progress indicator is shown. */
22
+ showProgressIndicator?: boolean;
23
+ /** Determines if the close icon button is shown */
24
+ showCloseIcon?: boolean;
25
+ /** function runs when user click dismiss button */
26
+ onDismiss?: (e: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
27
+ }
28
+ export declare type StepFlowHandle = {
29
+ /** Programmatically focus on root container of Dialog. */
30
+ focus: () => void;
31
+ } | null;
32
+ export declare const StepFlow: React.ForwardRefExoticComponent<StepFlowProps & React.RefAttributes<StepFlowHandle>>;
33
+ export default StepFlow;
@@ -0,0 +1,277 @@
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
+ import React, { useImperativeHandle, useRef, forwardRef } from "react";
3
+ import PropTypes from "prop-types";
4
+ import Icon from "../icon";
5
+ import IconButton from "../icon-button";
6
+ import { StyledStepFlow, StyledStepContent, StyledStepContentText, StyledStepLabelAndProgress, StyledProgressIndicatorBar, StyledProgressIndicator, StyledTitleFocusWrapper } from "./step-flow.style";
7
+ import tagComponent from "../../__internal__/utils/helpers/tags/tags";
8
+ import Typography from "../typography";
9
+ import useLocale from "../../hooks/__internal__/useLocale";
10
+ const StepFlow = /*#__PURE__*/forwardRef(({
11
+ category,
12
+ title,
13
+ titleVariant,
14
+ totalSteps,
15
+ currentStep,
16
+ showProgressIndicator = false,
17
+ showCloseIcon = false,
18
+ onDismiss,
19
+ ...rest
20
+ }, ref) => {
21
+ const totalStepsArray = Array.from({
22
+ length: totalSteps
23
+ }, (_, index) => index + 1);
24
+ const validatedCurrentStep = currentStep > totalSteps ? totalSteps : currentStep;
25
+ let currentStepWarnTriggered = false;
26
+ let noRefWarnTriggered = false;
27
+
28
+ /* eslint-disable no-console */
29
+ if (!currentStepWarnTriggered && currentStep > totalSteps) {
30
+ currentStepWarnTriggered = true;
31
+ console.warn("[WARNING] The `currentStep` prop should not be higher than the `totalSteps`prop in `StepFlow`." + " Please ensure `currentStep`s value does not exceed that of `totalSteps`, in the meantime" + " we have set `currentStep` value to that of `totalSteps`, and all indicators have been marked as completed.");
32
+ }
33
+ if (!noRefWarnTriggered && !ref) {
34
+ noRefWarnTriggered = true;
35
+ console.warn("[WARNING] A `ref` should be provided to ensure focus is programmatically focused back to a title div," + " this ensures screen reader users are informed regarding any changes and can navigate back down the page.");
36
+ }
37
+ const progressIndicators = totalStepsArray.map(step => {
38
+ const generateDataState = () => {
39
+ if (step === validatedCurrentStep) {
40
+ return "in-progress";
41
+ }
42
+ if (step < validatedCurrentStep) {
43
+ return "is-completed";
44
+ }
45
+ return "not-completed";
46
+ };
47
+ return /*#__PURE__*/React.createElement(StyledProgressIndicator, {
48
+ key: step,
49
+ "aria-hidden": "true",
50
+ "data-element": "progress-indicator",
51
+ isCompleted: step < validatedCurrentStep,
52
+ isInProgress: step === validatedCurrentStep,
53
+ "data-state": generateDataState()
54
+ }, "\xA0");
55
+ });
56
+ const locale = useLocale();
57
+ const closeIcon = /*#__PURE__*/React.createElement(IconButton, {
58
+ "data-element": "close",
59
+ "aria-label": locale.stepFlow.closeIconAriaLabel?.(),
60
+ onClick: onDismiss
61
+ }, /*#__PURE__*/React.createElement(Icon, {
62
+ type: "close"
63
+ }));
64
+ const titleRef = useRef(null);
65
+ useImperativeHandle(ref, () => ({
66
+ focus() {
67
+ titleRef.current?.focus();
68
+ }
69
+ }), []);
70
+ const stepFlowTitle = /*#__PURE__*/React.createElement(StyledTitleFocusWrapper, {
71
+ "data-element": "title-text-wrapper",
72
+ tabIndex: -1,
73
+ ref: titleRef
74
+ }, /*#__PURE__*/React.createElement(Typography, {
75
+ variant: titleVariant || "h1",
76
+ "data-element": "title-text"
77
+ }, /*#__PURE__*/React.createElement(Typography, {
78
+ fontWeight: "900",
79
+ fontSize: "var(--fontSizes600)",
80
+ lineHeight: "var(--sizing375)",
81
+ variant: "span",
82
+ "aria-hidden": "true",
83
+ "data-element": "visible-title-text"
84
+ }, title), /*#__PURE__*/React.createElement(Typography, {
85
+ variant: "span",
86
+ "data-element": "visually-hidden-title-text",
87
+ screenReaderOnly: true
88
+ }, locale.stepFlow.screenReaderOnlyTitle(title, validatedCurrentStep, totalSteps, category))));
89
+ const stepFlowLabel = /*#__PURE__*/React.createElement(Typography, {
90
+ variant: "span",
91
+ fontWeight: "400",
92
+ fontSize: "var(--fontSizes200)",
93
+ lineHeight: "var(--sizing300)",
94
+ "data-element": "step-label",
95
+ "aria-hidden": "true"
96
+ }, locale.stepFlow.stepLabel(validatedCurrentStep, totalSteps));
97
+ return /*#__PURE__*/React.createElement(StyledStepFlow, _extends({}, rest, tagComponent("step-flow", rest)), /*#__PURE__*/React.createElement(StyledStepContent, null, category ? /*#__PURE__*/React.createElement(StyledStepContentText, null, /*#__PURE__*/React.createElement(Typography, {
98
+ fontWeight: "500",
99
+ fontSize: "var(--fontSizes100)",
100
+ lineHeight: "var(--sizing250)",
101
+ variant: "span",
102
+ "data-element": "category-text",
103
+ "aria-hidden": "true"
104
+ }, category), stepFlowTitle) : stepFlowTitle, showCloseIcon ? closeIcon : null), showProgressIndicator ? /*#__PURE__*/React.createElement(StyledStepLabelAndProgress, null, stepFlowLabel, /*#__PURE__*/React.createElement(StyledProgressIndicatorBar, {
105
+ "data-element": "progress-indicator-bar"
106
+ }, progressIndicators)) : stepFlowLabel);
107
+ });
108
+ StepFlow.propTypes = {
109
+ "category": PropTypes.string,
110
+ "children": PropTypes.node,
111
+ "currentStep": PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8]).isRequired,
112
+ "data-component": PropTypes.string,
113
+ "data-element": PropTypes.string,
114
+ "data-role": PropTypes.string,
115
+ "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
116
+ "__@toStringTag": PropTypes.string.isRequired,
117
+ "description": PropTypes.string,
118
+ "toString": PropTypes.func.isRequired,
119
+ "valueOf": PropTypes.func.isRequired
120
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
121
+ "__@toStringTag": PropTypes.string.isRequired,
122
+ "description": PropTypes.string,
123
+ "toString": PropTypes.func.isRequired,
124
+ "valueOf": PropTypes.func.isRequired
125
+ }), PropTypes.string]),
126
+ "margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
127
+ "__@toStringTag": PropTypes.string.isRequired,
128
+ "description": PropTypes.string,
129
+ "toString": PropTypes.func.isRequired,
130
+ "valueOf": PropTypes.func.isRequired
131
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
132
+ "__@toStringTag": PropTypes.string.isRequired,
133
+ "description": PropTypes.string,
134
+ "toString": PropTypes.func.isRequired,
135
+ "valueOf": PropTypes.func.isRequired
136
+ }), PropTypes.string]),
137
+ "marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
138
+ "__@toStringTag": PropTypes.string.isRequired,
139
+ "description": PropTypes.string,
140
+ "toString": PropTypes.func.isRequired,
141
+ "valueOf": PropTypes.func.isRequired
142
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
143
+ "__@toStringTag": PropTypes.string.isRequired,
144
+ "description": PropTypes.string,
145
+ "toString": PropTypes.func.isRequired,
146
+ "valueOf": PropTypes.func.isRequired
147
+ }), PropTypes.string]),
148
+ "marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
149
+ "__@toStringTag": PropTypes.string.isRequired,
150
+ "description": PropTypes.string,
151
+ "toString": PropTypes.func.isRequired,
152
+ "valueOf": PropTypes.func.isRequired
153
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
154
+ "__@toStringTag": PropTypes.string.isRequired,
155
+ "description": PropTypes.string,
156
+ "toString": PropTypes.func.isRequired,
157
+ "valueOf": PropTypes.func.isRequired
158
+ }), PropTypes.string]),
159
+ "marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
160
+ "__@toStringTag": PropTypes.string.isRequired,
161
+ "description": PropTypes.string,
162
+ "toString": PropTypes.func.isRequired,
163
+ "valueOf": PropTypes.func.isRequired
164
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
165
+ "__@toStringTag": PropTypes.string.isRequired,
166
+ "description": PropTypes.string,
167
+ "toString": PropTypes.func.isRequired,
168
+ "valueOf": PropTypes.func.isRequired
169
+ }), PropTypes.string]),
170
+ "marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
171
+ "__@toStringTag": PropTypes.string.isRequired,
172
+ "description": PropTypes.string,
173
+ "toString": PropTypes.func.isRequired,
174
+ "valueOf": PropTypes.func.isRequired
175
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
176
+ "__@toStringTag": PropTypes.string.isRequired,
177
+ "description": PropTypes.string,
178
+ "toString": PropTypes.func.isRequired,
179
+ "valueOf": PropTypes.func.isRequired
180
+ }), PropTypes.string]),
181
+ "marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
182
+ "__@toStringTag": PropTypes.string.isRequired,
183
+ "description": PropTypes.string,
184
+ "toString": PropTypes.func.isRequired,
185
+ "valueOf": PropTypes.func.isRequired
186
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
187
+ "__@toStringTag": PropTypes.string.isRequired,
188
+ "description": PropTypes.string,
189
+ "toString": PropTypes.func.isRequired,
190
+ "valueOf": PropTypes.func.isRequired
191
+ }), PropTypes.string]),
192
+ "marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
193
+ "__@toStringTag": PropTypes.string.isRequired,
194
+ "description": PropTypes.string,
195
+ "toString": PropTypes.func.isRequired,
196
+ "valueOf": PropTypes.func.isRequired
197
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
198
+ "__@toStringTag": PropTypes.string.isRequired,
199
+ "description": PropTypes.string,
200
+ "toString": PropTypes.func.isRequired,
201
+ "valueOf": PropTypes.func.isRequired
202
+ }), PropTypes.string]),
203
+ "mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
204
+ "__@toStringTag": PropTypes.string.isRequired,
205
+ "description": PropTypes.string,
206
+ "toString": PropTypes.func.isRequired,
207
+ "valueOf": PropTypes.func.isRequired
208
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
209
+ "__@toStringTag": PropTypes.string.isRequired,
210
+ "description": PropTypes.string,
211
+ "toString": PropTypes.func.isRequired,
212
+ "valueOf": PropTypes.func.isRequired
213
+ }), PropTypes.string]),
214
+ "ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
215
+ "__@toStringTag": PropTypes.string.isRequired,
216
+ "description": PropTypes.string,
217
+ "toString": PropTypes.func.isRequired,
218
+ "valueOf": PropTypes.func.isRequired
219
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
220
+ "__@toStringTag": PropTypes.string.isRequired,
221
+ "description": PropTypes.string,
222
+ "toString": PropTypes.func.isRequired,
223
+ "valueOf": PropTypes.func.isRequired
224
+ }), PropTypes.string]),
225
+ "mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
226
+ "__@toStringTag": PropTypes.string.isRequired,
227
+ "description": PropTypes.string,
228
+ "toString": PropTypes.func.isRequired,
229
+ "valueOf": PropTypes.func.isRequired
230
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
231
+ "__@toStringTag": PropTypes.string.isRequired,
232
+ "description": PropTypes.string,
233
+ "toString": PropTypes.func.isRequired,
234
+ "valueOf": PropTypes.func.isRequired
235
+ }), PropTypes.string]),
236
+ "mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
237
+ "__@toStringTag": PropTypes.string.isRequired,
238
+ "description": PropTypes.string,
239
+ "toString": PropTypes.func.isRequired,
240
+ "valueOf": PropTypes.func.isRequired
241
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
242
+ "__@toStringTag": PropTypes.string.isRequired,
243
+ "description": PropTypes.string,
244
+ "toString": PropTypes.func.isRequired,
245
+ "valueOf": PropTypes.func.isRequired
246
+ }), PropTypes.string]),
247
+ "mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
248
+ "__@toStringTag": PropTypes.string.isRequired,
249
+ "description": PropTypes.string,
250
+ "toString": PropTypes.func.isRequired,
251
+ "valueOf": PropTypes.func.isRequired
252
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
253
+ "__@toStringTag": PropTypes.string.isRequired,
254
+ "description": PropTypes.string,
255
+ "toString": PropTypes.func.isRequired,
256
+ "valueOf": PropTypes.func.isRequired
257
+ }), PropTypes.string]),
258
+ "my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
259
+ "__@toStringTag": PropTypes.string.isRequired,
260
+ "description": PropTypes.string,
261
+ "toString": PropTypes.func.isRequired,
262
+ "valueOf": PropTypes.func.isRequired
263
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
264
+ "__@toStringTag": PropTypes.string.isRequired,
265
+ "description": PropTypes.string,
266
+ "toString": PropTypes.func.isRequired,
267
+ "valueOf": PropTypes.func.isRequired
268
+ }), PropTypes.string]),
269
+ "onDismiss": PropTypes.func,
270
+ "showCloseIcon": PropTypes.bool,
271
+ "showProgressIndicator": PropTypes.bool,
272
+ "title": PropTypes.string.isRequired,
273
+ "titleVariant": PropTypes.oneOf(["h1", "h2"]),
274
+ "totalSteps": PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8]).isRequired
275
+ };
276
+ export { StepFlow };
277
+ export default StepFlow;
@@ -0,0 +1,12 @@
1
+ declare const StyledStepFlow: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ declare const StyledStepContent: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ declare const StyledStepContentText: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ declare const StyledTitleFocusWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ declare const StyledStepLabelAndProgress: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ declare const StyledProgressIndicatorBar: import("styled-components").StyledComponent<"div", any, {}, never>;
7
+ interface StyledProgressIndicatorProps {
8
+ isCompleted: boolean;
9
+ isInProgress: boolean;
10
+ }
11
+ declare const StyledProgressIndicator: import("styled-components").StyledComponent<"span", any, StyledProgressIndicatorProps, never>;
12
+ export { StyledStepFlow, StyledStepContent, StyledStepContentText, StyledTitleFocusWrapper, StyledStepLabelAndProgress, StyledProgressIndicatorBar, StyledProgressIndicator, };
@@ -0,0 +1,42 @@
1
+ import styled from "styled-components";
2
+ import { margin } from "styled-system";
3
+ const StyledStepFlow = styled.div`
4
+ ${margin}
5
+ `;
6
+ const StyledStepContent = styled.div`
7
+ display: flex;
8
+ justify-content: space-between;
9
+ margin-bottom: var(--sizing200);
10
+ `;
11
+ const StyledStepContentText = styled.div`
12
+ display: flex;
13
+ flex-direction: column;
14
+ `;
15
+ const StyledTitleFocusWrapper = styled.div``;
16
+ const StyledStepLabelAndProgress = styled.div`
17
+ margin-top: var(--sizing125);
18
+ `;
19
+ const StyledProgressIndicatorBar = styled.div`
20
+ display: flex;
21
+ margin-top: var(--sizing100);
22
+ `;
23
+ function calculateProgressIndicatorColor({
24
+ isCompleted,
25
+ isInProgress
26
+ }) {
27
+ if (isInProgress) {
28
+ return "var(--colorsUtilityYin090)";
29
+ }
30
+ if (isCompleted) {
31
+ return "var(--colorsSemanticPositive500)";
32
+ }
33
+ return "var(--colorsActionDisabled600)";
34
+ }
35
+ const StyledProgressIndicator = styled.span`
36
+ background-color: ${calculateProgressIndicatorColor};
37
+ width: 100%;
38
+ height: 8px;
39
+ border-radius: 8px;
40
+ margin-right: 12px;
41
+ `;
42
+ export { StyledStepFlow, StyledStepContent, StyledStepContentText, StyledTitleFocusWrapper, StyledStepLabelAndProgress, StyledProgressIndicatorBar, StyledProgressIndicator };
@@ -1,4 +1,4 @@
1
1
  export { default } from "./typography.component";
2
2
  export { List, ListItem } from "./list.component";
3
- export type { TypographyProps } from "./typography.component";
3
+ export type { TypographyProps, VariantTypes } from "./typography.component";
4
4
  export type { ListProps, ListItemProps } from "./list.component";
@@ -55,9 +55,11 @@ export interface TypographyProps extends SpaceProps, TagProps {
55
55
  * Override the default color of the rendered element to match disabled styling
56
56
  * */
57
57
  isDisabled?: boolean;
58
+ /** @private @ignore Set whether the component should be recognised by assistive technologies */
59
+ "aria-hidden"?: "true" | "false";
58
60
  }
59
61
  export declare const Typography: {
60
- ({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, isDisabled, ...rest }: TypographyProps): React.JSX.Element;
62
+ ({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, isDisabled, "aria-hidden": ariaHidden, ...rest }: TypographyProps): React.JSX.Element;
61
63
  displayName: string;
62
64
  };
63
65
  export default Typography;
@@ -30,6 +30,7 @@ export const Typography = ({
30
30
  className,
31
31
  screenReaderOnly,
32
32
  isDisabled,
33
+ "aria-hidden": ariaHidden,
33
34
  ...rest
34
35
  }) => {
35
36
  return /*#__PURE__*/React.createElement(StyledTypography, _extends({
@@ -54,7 +55,8 @@ export const Typography = ({
54
55
  opacity: opacity,
55
56
  className: className,
56
57
  screenReaderOnly: screenReaderOnly,
57
- isDisabled: isDisabled
58
+ isDisabled: isDisabled,
59
+ "aria-hidden": ariaHidden
58
60
  }, tagComponent(dataComponent, rest), filterStyledSystemMarginProps(rest), filterStyledSystemPaddingProps(rest)), children);
59
61
  };
60
62
  Typography.displayName = "Typography";
@@ -177,6 +177,11 @@ const plPL = {
177
177
  splitButton: {
178
178
  ariaLabel: () => "Pokaż więcej"
179
179
  },
180
+ stepFlow: {
181
+ stepLabel: (currentStep, totalSteps) => `Krok ${currentStep} z ${totalSteps}`,
182
+ screenReaderOnlyTitle: (title, currentStep, totalSteps, category) => `${category ? `${category}.` : ""}. ${title}. Krok ${currentStep} of ${totalSteps}.`,
183
+ closeIconAriaLabel: () => "Zamknij"
184
+ },
180
185
  switch: {
181
186
  on: () => "WŁ",
182
187
  off: () => "WYŁ"
@@ -142,6 +142,11 @@ const enGB = {
142
142
  splitButton: {
143
143
  ariaLabel: () => "Show more"
144
144
  },
145
+ stepFlow: {
146
+ stepLabel: (currentStep, totalSteps) => `Step ${currentStep} of ${totalSteps}`,
147
+ screenReaderOnlyTitle: (title, currentStep, totalSteps, category) => `${category ? `${category}.` : ""} ${title}. Step ${currentStep} of ${totalSteps}.`,
148
+ closeIconAriaLabel: () => "Close"
149
+ },
145
150
  switch: {
146
151
  on: () => "ON",
147
152
  off: () => "OFF"
@@ -121,6 +121,11 @@ interface Locale {
121
121
  on: () => string;
122
122
  off: () => string;
123
123
  };
124
+ stepFlow: {
125
+ stepLabel: (currentStep: number, totalSteps: number) => string;
126
+ screenReaderOnlyTitle: (title: string, currentStep: number, totalSteps: number, category?: string) => string;
127
+ closeIconAriaLabel?: () => string;
128
+ };
124
129
  textEditor: {
125
130
  tooltipMessages: {
126
131
  bold: () => string;
@@ -12,7 +12,7 @@ declare type StyledHeadingTitleProps = {
12
12
  withMargin?: boolean;
13
13
  };
14
14
  declare const StyledHeadingTitle: import("styled-components").StyledComponent<{
15
- ({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, isDisabled, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
15
+ ({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, isDisabled, "aria-hidden": ariaHidden, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
16
16
  displayName: string;
17
17
  }, any, StyledHeadingTitleProps, never>;
18
18
  declare const StyledHeadingPills: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -0,0 +1,2 @@
1
+ export { default as StepFlow } from "./step-flow.component";
2
+ export type { StepFlowProps } from "./step-flow.component";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "StepFlow", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _stepFlow.default;
10
+ }
11
+ });
12
+ var _stepFlow = _interopRequireDefault(require("./step-flow.component"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../../../esm/components/step-flow/index.js",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import { MarginProps } from "styled-system";
3
+ import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
4
+ export declare type Steps = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
5
+ export interface StepFlowProps extends MarginProps, TagProps {
6
+ /** A category for the user journey. */
7
+ category?: string;
8
+ /** The title of the current step. */
9
+ title: string;
10
+ /** Set the variant of the internal 'Typography' component which contains the title.
11
+ * However, despite the chosen variant the styling will always be overridden.
12
+ */
13
+ titleVariant?: "h1" | "h2";
14
+ /** The total steps in the user journey. */
15
+ totalSteps: Steps;
16
+ /**
17
+ * The current step of the user journey. If the set `currentStep` is higher than
18
+ * `totalSteps`the value of `currentStep` will be that of `totalSteps` instead.
19
+ */
20
+ currentStep: Steps;
21
+ /** Determines if the progress indicator is shown. */
22
+ showProgressIndicator?: boolean;
23
+ /** Determines if the close icon button is shown */
24
+ showCloseIcon?: boolean;
25
+ /** function runs when user click dismiss button */
26
+ onDismiss?: (e: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
27
+ }
28
+ export declare type StepFlowHandle = {
29
+ /** Programmatically focus on root container of Dialog. */
30
+ focus: () => void;
31
+ } | null;
32
+ export declare const StepFlow: React.ForwardRefExoticComponent<StepFlowProps & React.RefAttributes<StepFlowHandle>>;
33
+ export default StepFlow;
@@ -0,0 +1,285 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.StepFlow = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _icon = _interopRequireDefault(require("../icon"));
10
+ var _iconButton = _interopRequireDefault(require("../icon-button"));
11
+ var _stepFlow = require("./step-flow.style");
12
+ var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
13
+ var _typography = _interopRequireDefault(require("../typography"));
14
+ var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
17
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
+ 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); }
19
+ const StepFlow = exports.StepFlow = /*#__PURE__*/(0, _react.forwardRef)(({
20
+ category,
21
+ title,
22
+ titleVariant,
23
+ totalSteps,
24
+ currentStep,
25
+ showProgressIndicator = false,
26
+ showCloseIcon = false,
27
+ onDismiss,
28
+ ...rest
29
+ }, ref) => {
30
+ const totalStepsArray = Array.from({
31
+ length: totalSteps
32
+ }, (_, index) => index + 1);
33
+ const validatedCurrentStep = currentStep > totalSteps ? totalSteps : currentStep;
34
+ let currentStepWarnTriggered = false;
35
+ let noRefWarnTriggered = false;
36
+
37
+ /* eslint-disable no-console */
38
+ if (!currentStepWarnTriggered && currentStep > totalSteps) {
39
+ currentStepWarnTriggered = true;
40
+ console.warn("[WARNING] The `currentStep` prop should not be higher than the `totalSteps`prop in `StepFlow`." + " Please ensure `currentStep`s value does not exceed that of `totalSteps`, in the meantime" + " we have set `currentStep` value to that of `totalSteps`, and all indicators have been marked as completed.");
41
+ }
42
+ if (!noRefWarnTriggered && !ref) {
43
+ noRefWarnTriggered = true;
44
+ console.warn("[WARNING] A `ref` should be provided to ensure focus is programmatically focused back to a title div," + " this ensures screen reader users are informed regarding any changes and can navigate back down the page.");
45
+ }
46
+ const progressIndicators = totalStepsArray.map(step => {
47
+ const generateDataState = () => {
48
+ if (step === validatedCurrentStep) {
49
+ return "in-progress";
50
+ }
51
+ if (step < validatedCurrentStep) {
52
+ return "is-completed";
53
+ }
54
+ return "not-completed";
55
+ };
56
+ return /*#__PURE__*/_react.default.createElement(_stepFlow.StyledProgressIndicator, {
57
+ key: step,
58
+ "aria-hidden": "true",
59
+ "data-element": "progress-indicator",
60
+ isCompleted: step < validatedCurrentStep,
61
+ isInProgress: step === validatedCurrentStep,
62
+ "data-state": generateDataState()
63
+ }, "\xA0");
64
+ });
65
+ const locale = (0, _useLocale.default)();
66
+ const closeIcon = /*#__PURE__*/_react.default.createElement(_iconButton.default, {
67
+ "data-element": "close",
68
+ "aria-label": locale.stepFlow.closeIconAriaLabel?.(),
69
+ onClick: onDismiss
70
+ }, /*#__PURE__*/_react.default.createElement(_icon.default, {
71
+ type: "close"
72
+ }));
73
+ const titleRef = (0, _react.useRef)(null);
74
+ (0, _react.useImperativeHandle)(ref, () => ({
75
+ focus() {
76
+ titleRef.current?.focus();
77
+ }
78
+ }), []);
79
+ const stepFlowTitle = /*#__PURE__*/_react.default.createElement(_stepFlow.StyledTitleFocusWrapper, {
80
+ "data-element": "title-text-wrapper",
81
+ tabIndex: -1,
82
+ ref: titleRef
83
+ }, /*#__PURE__*/_react.default.createElement(_typography.default, {
84
+ variant: titleVariant || "h1",
85
+ "data-element": "title-text"
86
+ }, /*#__PURE__*/_react.default.createElement(_typography.default, {
87
+ fontWeight: "900",
88
+ fontSize: "var(--fontSizes600)",
89
+ lineHeight: "var(--sizing375)",
90
+ variant: "span",
91
+ "aria-hidden": "true",
92
+ "data-element": "visible-title-text"
93
+ }, title), /*#__PURE__*/_react.default.createElement(_typography.default, {
94
+ variant: "span",
95
+ "data-element": "visually-hidden-title-text",
96
+ screenReaderOnly: true
97
+ }, locale.stepFlow.screenReaderOnlyTitle(title, validatedCurrentStep, totalSteps, category))));
98
+ const stepFlowLabel = /*#__PURE__*/_react.default.createElement(_typography.default, {
99
+ variant: "span",
100
+ fontWeight: "400",
101
+ fontSize: "var(--fontSizes200)",
102
+ lineHeight: "var(--sizing300)",
103
+ "data-element": "step-label",
104
+ "aria-hidden": "true"
105
+ }, locale.stepFlow.stepLabel(validatedCurrentStep, totalSteps));
106
+ return /*#__PURE__*/_react.default.createElement(_stepFlow.StyledStepFlow, _extends({}, rest, (0, _tags.default)("step-flow", rest)), /*#__PURE__*/_react.default.createElement(_stepFlow.StyledStepContent, null, category ? /*#__PURE__*/_react.default.createElement(_stepFlow.StyledStepContentText, null, /*#__PURE__*/_react.default.createElement(_typography.default, {
107
+ fontWeight: "500",
108
+ fontSize: "var(--fontSizes100)",
109
+ lineHeight: "var(--sizing250)",
110
+ variant: "span",
111
+ "data-element": "category-text",
112
+ "aria-hidden": "true"
113
+ }, category), stepFlowTitle) : stepFlowTitle, showCloseIcon ? closeIcon : null), showProgressIndicator ? /*#__PURE__*/_react.default.createElement(_stepFlow.StyledStepLabelAndProgress, null, stepFlowLabel, /*#__PURE__*/_react.default.createElement(_stepFlow.StyledProgressIndicatorBar, {
114
+ "data-element": "progress-indicator-bar"
115
+ }, progressIndicators)) : stepFlowLabel);
116
+ });
117
+ StepFlow.propTypes = {
118
+ "category": _propTypes.default.string,
119
+ "children": _propTypes.default.node,
120
+ "currentStep": _propTypes.default.oneOf([1, 2, 3, 4, 5, 6, 7, 8]).isRequired,
121
+ "data-component": _propTypes.default.string,
122
+ "data-element": _propTypes.default.string,
123
+ "data-role": _propTypes.default.string,
124
+ "m": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
125
+ "__@toStringTag": _propTypes.default.string.isRequired,
126
+ "description": _propTypes.default.string,
127
+ "toString": _propTypes.default.func.isRequired,
128
+ "valueOf": _propTypes.default.func.isRequired
129
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
130
+ "__@toStringTag": _propTypes.default.string.isRequired,
131
+ "description": _propTypes.default.string,
132
+ "toString": _propTypes.default.func.isRequired,
133
+ "valueOf": _propTypes.default.func.isRequired
134
+ }), _propTypes.default.string]),
135
+ "margin": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
136
+ "__@toStringTag": _propTypes.default.string.isRequired,
137
+ "description": _propTypes.default.string,
138
+ "toString": _propTypes.default.func.isRequired,
139
+ "valueOf": _propTypes.default.func.isRequired
140
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
141
+ "__@toStringTag": _propTypes.default.string.isRequired,
142
+ "description": _propTypes.default.string,
143
+ "toString": _propTypes.default.func.isRequired,
144
+ "valueOf": _propTypes.default.func.isRequired
145
+ }), _propTypes.default.string]),
146
+ "marginBottom": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
147
+ "__@toStringTag": _propTypes.default.string.isRequired,
148
+ "description": _propTypes.default.string,
149
+ "toString": _propTypes.default.func.isRequired,
150
+ "valueOf": _propTypes.default.func.isRequired
151
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
152
+ "__@toStringTag": _propTypes.default.string.isRequired,
153
+ "description": _propTypes.default.string,
154
+ "toString": _propTypes.default.func.isRequired,
155
+ "valueOf": _propTypes.default.func.isRequired
156
+ }), _propTypes.default.string]),
157
+ "marginLeft": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
158
+ "__@toStringTag": _propTypes.default.string.isRequired,
159
+ "description": _propTypes.default.string,
160
+ "toString": _propTypes.default.func.isRequired,
161
+ "valueOf": _propTypes.default.func.isRequired
162
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
163
+ "__@toStringTag": _propTypes.default.string.isRequired,
164
+ "description": _propTypes.default.string,
165
+ "toString": _propTypes.default.func.isRequired,
166
+ "valueOf": _propTypes.default.func.isRequired
167
+ }), _propTypes.default.string]),
168
+ "marginRight": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
169
+ "__@toStringTag": _propTypes.default.string.isRequired,
170
+ "description": _propTypes.default.string,
171
+ "toString": _propTypes.default.func.isRequired,
172
+ "valueOf": _propTypes.default.func.isRequired
173
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
174
+ "__@toStringTag": _propTypes.default.string.isRequired,
175
+ "description": _propTypes.default.string,
176
+ "toString": _propTypes.default.func.isRequired,
177
+ "valueOf": _propTypes.default.func.isRequired
178
+ }), _propTypes.default.string]),
179
+ "marginTop": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
180
+ "__@toStringTag": _propTypes.default.string.isRequired,
181
+ "description": _propTypes.default.string,
182
+ "toString": _propTypes.default.func.isRequired,
183
+ "valueOf": _propTypes.default.func.isRequired
184
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
185
+ "__@toStringTag": _propTypes.default.string.isRequired,
186
+ "description": _propTypes.default.string,
187
+ "toString": _propTypes.default.func.isRequired,
188
+ "valueOf": _propTypes.default.func.isRequired
189
+ }), _propTypes.default.string]),
190
+ "marginX": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
191
+ "__@toStringTag": _propTypes.default.string.isRequired,
192
+ "description": _propTypes.default.string,
193
+ "toString": _propTypes.default.func.isRequired,
194
+ "valueOf": _propTypes.default.func.isRequired
195
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
196
+ "__@toStringTag": _propTypes.default.string.isRequired,
197
+ "description": _propTypes.default.string,
198
+ "toString": _propTypes.default.func.isRequired,
199
+ "valueOf": _propTypes.default.func.isRequired
200
+ }), _propTypes.default.string]),
201
+ "marginY": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
202
+ "__@toStringTag": _propTypes.default.string.isRequired,
203
+ "description": _propTypes.default.string,
204
+ "toString": _propTypes.default.func.isRequired,
205
+ "valueOf": _propTypes.default.func.isRequired
206
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
207
+ "__@toStringTag": _propTypes.default.string.isRequired,
208
+ "description": _propTypes.default.string,
209
+ "toString": _propTypes.default.func.isRequired,
210
+ "valueOf": _propTypes.default.func.isRequired
211
+ }), _propTypes.default.string]),
212
+ "mb": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
213
+ "__@toStringTag": _propTypes.default.string.isRequired,
214
+ "description": _propTypes.default.string,
215
+ "toString": _propTypes.default.func.isRequired,
216
+ "valueOf": _propTypes.default.func.isRequired
217
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
218
+ "__@toStringTag": _propTypes.default.string.isRequired,
219
+ "description": _propTypes.default.string,
220
+ "toString": _propTypes.default.func.isRequired,
221
+ "valueOf": _propTypes.default.func.isRequired
222
+ }), _propTypes.default.string]),
223
+ "ml": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
224
+ "__@toStringTag": _propTypes.default.string.isRequired,
225
+ "description": _propTypes.default.string,
226
+ "toString": _propTypes.default.func.isRequired,
227
+ "valueOf": _propTypes.default.func.isRequired
228
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
229
+ "__@toStringTag": _propTypes.default.string.isRequired,
230
+ "description": _propTypes.default.string,
231
+ "toString": _propTypes.default.func.isRequired,
232
+ "valueOf": _propTypes.default.func.isRequired
233
+ }), _propTypes.default.string]),
234
+ "mr": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
235
+ "__@toStringTag": _propTypes.default.string.isRequired,
236
+ "description": _propTypes.default.string,
237
+ "toString": _propTypes.default.func.isRequired,
238
+ "valueOf": _propTypes.default.func.isRequired
239
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
240
+ "__@toStringTag": _propTypes.default.string.isRequired,
241
+ "description": _propTypes.default.string,
242
+ "toString": _propTypes.default.func.isRequired,
243
+ "valueOf": _propTypes.default.func.isRequired
244
+ }), _propTypes.default.string]),
245
+ "mt": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
246
+ "__@toStringTag": _propTypes.default.string.isRequired,
247
+ "description": _propTypes.default.string,
248
+ "toString": _propTypes.default.func.isRequired,
249
+ "valueOf": _propTypes.default.func.isRequired
250
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
251
+ "__@toStringTag": _propTypes.default.string.isRequired,
252
+ "description": _propTypes.default.string,
253
+ "toString": _propTypes.default.func.isRequired,
254
+ "valueOf": _propTypes.default.func.isRequired
255
+ }), _propTypes.default.string]),
256
+ "mx": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
257
+ "__@toStringTag": _propTypes.default.string.isRequired,
258
+ "description": _propTypes.default.string,
259
+ "toString": _propTypes.default.func.isRequired,
260
+ "valueOf": _propTypes.default.func.isRequired
261
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
262
+ "__@toStringTag": _propTypes.default.string.isRequired,
263
+ "description": _propTypes.default.string,
264
+ "toString": _propTypes.default.func.isRequired,
265
+ "valueOf": _propTypes.default.func.isRequired
266
+ }), _propTypes.default.string]),
267
+ "my": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
268
+ "__@toStringTag": _propTypes.default.string.isRequired,
269
+ "description": _propTypes.default.string,
270
+ "toString": _propTypes.default.func.isRequired,
271
+ "valueOf": _propTypes.default.func.isRequired
272
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
273
+ "__@toStringTag": _propTypes.default.string.isRequired,
274
+ "description": _propTypes.default.string,
275
+ "toString": _propTypes.default.func.isRequired,
276
+ "valueOf": _propTypes.default.func.isRequired
277
+ }), _propTypes.default.string]),
278
+ "onDismiss": _propTypes.default.func,
279
+ "showCloseIcon": _propTypes.default.bool,
280
+ "showProgressIndicator": _propTypes.default.bool,
281
+ "title": _propTypes.default.string.isRequired,
282
+ "titleVariant": _propTypes.default.oneOf(["h1", "h2"]),
283
+ "totalSteps": _propTypes.default.oneOf([1, 2, 3, 4, 5, 6, 7, 8]).isRequired
284
+ };
285
+ var _default = exports.default = StepFlow;
@@ -0,0 +1,12 @@
1
+ declare const StyledStepFlow: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ declare const StyledStepContent: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ declare const StyledStepContentText: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ declare const StyledTitleFocusWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ declare const StyledStepLabelAndProgress: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ declare const StyledProgressIndicatorBar: import("styled-components").StyledComponent<"div", any, {}, never>;
7
+ interface StyledProgressIndicatorProps {
8
+ isCompleted: boolean;
9
+ isInProgress: boolean;
10
+ }
11
+ declare const StyledProgressIndicator: import("styled-components").StyledComponent<"span", any, StyledProgressIndicatorProps, never>;
12
+ export { StyledStepFlow, StyledStepContent, StyledStepContentText, StyledTitleFocusWrapper, StyledStepLabelAndProgress, StyledProgressIndicatorBar, StyledProgressIndicator, };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledTitleFocusWrapper = exports.StyledStepLabelAndProgress = exports.StyledStepFlow = exports.StyledStepContentText = exports.StyledStepContent = exports.StyledProgressIndicatorBar = exports.StyledProgressIndicator = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ var _styledSystem = require("styled-system");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const StyledStepFlow = exports.StyledStepFlow = _styledComponents.default.div`
11
+ ${_styledSystem.margin}
12
+ `;
13
+ const StyledStepContent = exports.StyledStepContent = _styledComponents.default.div`
14
+ display: flex;
15
+ justify-content: space-between;
16
+ margin-bottom: var(--sizing200);
17
+ `;
18
+ const StyledStepContentText = exports.StyledStepContentText = _styledComponents.default.div`
19
+ display: flex;
20
+ flex-direction: column;
21
+ `;
22
+ const StyledTitleFocusWrapper = exports.StyledTitleFocusWrapper = _styledComponents.default.div``;
23
+ const StyledStepLabelAndProgress = exports.StyledStepLabelAndProgress = _styledComponents.default.div`
24
+ margin-top: var(--sizing125);
25
+ `;
26
+ const StyledProgressIndicatorBar = exports.StyledProgressIndicatorBar = _styledComponents.default.div`
27
+ display: flex;
28
+ margin-top: var(--sizing100);
29
+ `;
30
+ function calculateProgressIndicatorColor({
31
+ isCompleted,
32
+ isInProgress
33
+ }) {
34
+ if (isInProgress) {
35
+ return "var(--colorsUtilityYin090)";
36
+ }
37
+ if (isCompleted) {
38
+ return "var(--colorsSemanticPositive500)";
39
+ }
40
+ return "var(--colorsActionDisabled600)";
41
+ }
42
+ const StyledProgressIndicator = exports.StyledProgressIndicator = _styledComponents.default.span`
43
+ background-color: ${calculateProgressIndicatorColor};
44
+ width: 100%;
45
+ height: 8px;
46
+ border-radius: 8px;
47
+ margin-right: 12px;
48
+ `;
@@ -1,4 +1,4 @@
1
1
  export { default } from "./typography.component";
2
2
  export { List, ListItem } from "./list.component";
3
- export type { TypographyProps } from "./typography.component";
3
+ export type { TypographyProps, VariantTypes } from "./typography.component";
4
4
  export type { ListProps, ListItemProps } from "./list.component";
@@ -55,9 +55,11 @@ export interface TypographyProps extends SpaceProps, TagProps {
55
55
  * Override the default color of the rendered element to match disabled styling
56
56
  * */
57
57
  isDisabled?: boolean;
58
+ /** @private @ignore Set whether the component should be recognised by assistive technologies */
59
+ "aria-hidden"?: "true" | "false";
58
60
  }
59
61
  export declare const Typography: {
60
- ({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, isDisabled, ...rest }: TypographyProps): React.JSX.Element;
62
+ ({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, isDisabled, "aria-hidden": ariaHidden, ...rest }: TypographyProps): React.JSX.Element;
61
63
  displayName: string;
62
64
  };
63
65
  export default Typography;
@@ -37,6 +37,7 @@ const Typography = ({
37
37
  className,
38
38
  screenReaderOnly,
39
39
  isDisabled,
40
+ "aria-hidden": ariaHidden,
40
41
  ...rest
41
42
  }) => {
42
43
  return /*#__PURE__*/_react.default.createElement(_typography.default, _extends({
@@ -61,7 +62,8 @@ const Typography = ({
61
62
  opacity: opacity,
62
63
  className: className,
63
64
  screenReaderOnly: screenReaderOnly,
64
- isDisabled: isDisabled
65
+ isDisabled: isDisabled,
66
+ "aria-hidden": ariaHidden
65
67
  }, (0, _tags.default)(dataComponent, rest), (0, _utils.filterStyledSystemMarginProps)(rest), (0, _utils.filterStyledSystemPaddingProps)(rest)), children);
66
68
  };
67
69
  exports.Typography = Typography;
@@ -184,6 +184,11 @@ const plPL = {
184
184
  splitButton: {
185
185
  ariaLabel: () => "Pokaż więcej"
186
186
  },
187
+ stepFlow: {
188
+ stepLabel: (currentStep, totalSteps) => `Krok ${currentStep} z ${totalSteps}`,
189
+ screenReaderOnlyTitle: (title, currentStep, totalSteps, category) => `${category ? `${category}.` : ""}. ${title}. Krok ${currentStep} of ${totalSteps}.`,
190
+ closeIconAriaLabel: () => "Zamknij"
191
+ },
187
192
  switch: {
188
193
  on: () => "WŁ",
189
194
  off: () => "WYŁ"
@@ -148,6 +148,11 @@ const enGB = {
148
148
  splitButton: {
149
149
  ariaLabel: () => "Show more"
150
150
  },
151
+ stepFlow: {
152
+ stepLabel: (currentStep, totalSteps) => `Step ${currentStep} of ${totalSteps}`,
153
+ screenReaderOnlyTitle: (title, currentStep, totalSteps, category) => `${category ? `${category}.` : ""} ${title}. Step ${currentStep} of ${totalSteps}.`,
154
+ closeIconAriaLabel: () => "Close"
155
+ },
151
156
  switch: {
152
157
  on: () => "ON",
153
158
  off: () => "OFF"
@@ -121,6 +121,11 @@ interface Locale {
121
121
  on: () => string;
122
122
  off: () => string;
123
123
  };
124
+ stepFlow: {
125
+ stepLabel: (currentStep: number, totalSteps: number) => string;
126
+ screenReaderOnlyTitle: (title: string, currentStep: number, totalSteps: number, category?: string) => string;
127
+ closeIconAriaLabel?: () => string;
128
+ };
124
129
  textEditor: {
125
130
  tooltipMessages: {
126
131
  bold: () => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "125.10.0",
3
+ "version": "125.11.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",