carbon-react 125.9.3 → 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.
- package/esm/components/heading/heading.style.d.ts +1 -1
- package/esm/components/pill/pill.component.d.ts +4 -2
- package/esm/components/pill/pill.component.js +28 -18
- package/esm/components/pill/pill.style.config.d.ts +3 -1
- package/esm/components/pill/pill.style.config.js +20 -10
- package/esm/components/pill/pill.style.d.ts +2 -1
- package/esm/components/pill/pill.style.js +4 -3
- package/esm/components/step-flow/index.d.ts +2 -0
- package/esm/components/step-flow/index.js +1 -0
- package/esm/components/step-flow/step-flow.component.d.ts +33 -0
- package/esm/components/step-flow/step-flow.component.js +277 -0
- package/esm/components/step-flow/step-flow.style.d.ts +12 -0
- package/esm/components/step-flow/step-flow.style.js +42 -0
- package/esm/components/typography/index.d.ts +1 -1
- package/esm/components/typography/typography.component.d.ts +3 -1
- package/esm/components/typography/typography.component.js +3 -1
- package/esm/locales/__internal__/pl-pl.js +5 -0
- package/esm/locales/en-gb.js +5 -0
- package/esm/locales/locale.d.ts +5 -0
- package/esm/style/design-tokens/debug-theme.util.d.ts +24 -5
- package/esm/style/themes/sage/index.d.ts +24 -5
- package/lib/components/heading/heading.style.d.ts +1 -1
- package/lib/components/pill/pill.component.d.ts +4 -2
- package/lib/components/pill/pill.component.js +28 -18
- package/lib/components/pill/pill.style.config.d.ts +3 -1
- package/lib/components/pill/pill.style.config.js +20 -10
- package/lib/components/pill/pill.style.d.ts +2 -1
- package/lib/components/pill/pill.style.js +4 -3
- package/lib/components/step-flow/index.d.ts +2 -0
- package/lib/components/step-flow/index.js +13 -0
- package/lib/components/step-flow/package.json +6 -0
- package/lib/components/step-flow/step-flow.component.d.ts +33 -0
- package/lib/components/step-flow/step-flow.component.js +285 -0
- package/lib/components/step-flow/step-flow.style.d.ts +12 -0
- package/lib/components/step-flow/step-flow.style.js +48 -0
- package/lib/components/typography/index.d.ts +1 -1
- package/lib/components/typography/typography.component.d.ts +3 -1
- package/lib/components/typography/typography.component.js +3 -1
- package/lib/locales/__internal__/pl-pl.js +5 -0
- package/lib/locales/en-gb.js +5 -0
- package/lib/locales/locale.d.ts +5 -0
- package/lib/style/design-tokens/debug-theme.util.d.ts +24 -5
- package/lib/style/themes/sage/index.d.ts +24 -5
- package/package.json +2 -4
|
@@ -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>;
|
|
@@ -4,7 +4,9 @@ export interface PillProps extends StyledPillProps {
|
|
|
4
4
|
/** The content to display inside of the pill. */
|
|
5
5
|
children: string;
|
|
6
6
|
/** Change the color of a status pill. */
|
|
7
|
-
colorVariant?: "neutral" | "negative" | "positive" | "warning";
|
|
7
|
+
colorVariant?: "neutral" | "negative" | "positive" | "warning" | "information" | "neutralWhite";
|
|
8
|
+
/** Sets the colour styling when a status pill is rendered on a dark background. */
|
|
9
|
+
isDarkBackground?: boolean;
|
|
8
10
|
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
9
11
|
"data-element"?: string;
|
|
10
12
|
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
@@ -22,5 +24,5 @@ export interface PillProps extends StyledPillProps {
|
|
|
22
24
|
/** @private @ignore title attribute passed down to underlying element */
|
|
23
25
|
title?: string;
|
|
24
26
|
}
|
|
25
|
-
export declare const Pill: ({ wrapText, borderColor, colorVariant, children, fill, maxWidth, onClick, onDelete, pillRole, size, ariaLabelOfRemoveButton, ...rest }: PillProps) => React.JSX.Element;
|
|
27
|
+
export declare const Pill: ({ wrapText, borderColor, colorVariant, isDarkBackground, children, fill, maxWidth, onClick, onDelete, pillRole, size, ariaLabelOfRemoveButton, ...rest }: PillProps) => React.JSX.Element;
|
|
26
28
|
export default Pill;
|
|
@@ -5,10 +5,12 @@ import StyledPill from "./pill.style";
|
|
|
5
5
|
import Icon from "../icon";
|
|
6
6
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
7
7
|
import IconButton from "../icon-button";
|
|
8
|
+
let neutralWhiteWarnTriggered = false;
|
|
8
9
|
export const Pill = ({
|
|
9
10
|
wrapText,
|
|
10
11
|
borderColor,
|
|
11
12
|
colorVariant = "neutral",
|
|
13
|
+
isDarkBackground = false,
|
|
12
14
|
children,
|
|
13
15
|
fill = false,
|
|
14
16
|
maxWidth,
|
|
@@ -18,22 +20,30 @@ export const Pill = ({
|
|
|
18
20
|
size = "M",
|
|
19
21
|
ariaLabelOfRemoveButton = "remove pill",
|
|
20
22
|
...rest
|
|
21
|
-
}) =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
}) => {
|
|
24
|
+
if (!neutralWhiteWarnTriggered && !isDarkBackground && colorVariant === "neutralWhite" && !fill) {
|
|
25
|
+
neutralWhiteWarnTriggered = true;
|
|
26
|
+
// eslint-disable-next-line no-console
|
|
27
|
+
console.warn("[WARNING] The `neutralWhite` variant should only be used on dark backgrounds with fill set to true. " + "Please set the `isDarkBackground` and `fill` props to true or use another color variant.");
|
|
28
|
+
}
|
|
29
|
+
return /*#__PURE__*/React.createElement(StyledPill, _extends({
|
|
30
|
+
inFill: fill,
|
|
31
|
+
colorVariant: colorVariant,
|
|
32
|
+
isDarkBackground: isDarkBackground,
|
|
33
|
+
isDeletable: !!onDelete,
|
|
34
|
+
pillRole: pillRole,
|
|
35
|
+
size: size,
|
|
36
|
+
borderColor: borderColor,
|
|
37
|
+
onClick: onClick
|
|
38
|
+
}, tagComponent("pill", rest), {
|
|
39
|
+
maxWidth: maxWidth,
|
|
40
|
+
wrapText: wrapText
|
|
41
|
+
}, rest), children, onDelete && /*#__PURE__*/React.createElement(IconButton, {
|
|
42
|
+
onClick: onDelete,
|
|
43
|
+
"data-element": "close",
|
|
44
|
+
"aria-label": ariaLabelOfRemoveButton
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
46
|
+
type: "cross"
|
|
47
|
+
})));
|
|
48
|
+
};
|
|
39
49
|
export default Pill;
|
|
@@ -9,10 +9,12 @@ interface StyledPillConfig {
|
|
|
9
9
|
negative: StyledPillInnerConfigProps;
|
|
10
10
|
warning: StyledPillInnerConfigProps;
|
|
11
11
|
positive: StyledPillInnerConfigProps;
|
|
12
|
+
information: StyledPillInnerConfigProps;
|
|
13
|
+
neutralWhite: StyledPillInnerConfigProps;
|
|
12
14
|
};
|
|
13
15
|
tag: {
|
|
14
16
|
primary: StyledPillInnerConfigProps;
|
|
15
17
|
};
|
|
16
18
|
}
|
|
17
|
-
declare const _default: () => StyledPillConfig;
|
|
19
|
+
declare const _default: (isDarkBackground: boolean) => StyledPillConfig;
|
|
18
20
|
export default _default;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export default (
|
|
1
|
+
export default (isDarkBackground => {
|
|
2
2
|
return {
|
|
3
3
|
status: {
|
|
4
4
|
neutral: {
|
|
5
|
-
varietyColor: "var(--colorsSemanticNeutral500)",
|
|
6
|
-
buttonFocus: "var(--colorsSemanticNeutral600)",
|
|
7
|
-
content: "var(--colorsSemanticNeutralYang100)"
|
|
5
|
+
varietyColor: isDarkBackground ? "var(--colorsSemanticNeutral400)" : "var(--colorsSemanticNeutral500)",
|
|
6
|
+
buttonFocus: isDarkBackground ? "var(--colorsSemanticNeutral500)" : "var(--colorsSemanticNeutral600)",
|
|
7
|
+
content: isDarkBackground ? "var(--colorsSemanticNeutralYin090)" : "var(--colorsSemanticNeutralYang100)"
|
|
8
8
|
},
|
|
9
9
|
negative: {
|
|
10
|
-
varietyColor: "var(--colorsSemanticNegative500)",
|
|
11
|
-
buttonFocus: "var(--colorsSemanticNegative600)",
|
|
12
|
-
content: "var(--colorsSemanticNegativeYang100)"
|
|
10
|
+
varietyColor: isDarkBackground ? "var(--colorsSemanticNegative450)" : "var(--colorsSemanticNegative500)",
|
|
11
|
+
buttonFocus: isDarkBackground ? "var(--colorsSemanticNegative500)" : "var(--colorsSemanticNegative600)",
|
|
12
|
+
content: isDarkBackground ? "var(--colorsSemanticNegativeYin090)" : "var(--colorsSemanticNegativeYang100)"
|
|
13
13
|
},
|
|
14
14
|
warning: {
|
|
15
15
|
varietyColor: "var(--colorsSemanticCaution400)",
|
|
@@ -17,9 +17,19 @@ export default (() => {
|
|
|
17
17
|
content: "var(--colorsSemanticCautionYin090)"
|
|
18
18
|
},
|
|
19
19
|
positive: {
|
|
20
|
-
varietyColor: "var(--colorsSemanticPositive500)",
|
|
21
|
-
buttonFocus: "var(--colorsSemanticPositive600)",
|
|
22
|
-
content: "var(--colorsSemanticPositiveYang100)"
|
|
20
|
+
varietyColor: isDarkBackground ? "var(--colorsSemanticPositive400)" : "var(--colorsSemanticPositive500)",
|
|
21
|
+
buttonFocus: isDarkBackground ? "var(--colorsSemanticPositive500)" : "var(--colorsSemanticPositive600)",
|
|
22
|
+
content: isDarkBackground ? "var(--colorsSemanticPositiveYin090)" : "var(--colorsSemanticPositiveYang100)"
|
|
23
|
+
},
|
|
24
|
+
information: {
|
|
25
|
+
varietyColor: isDarkBackground ? "var(--colorsSemanticInfo400)" : "var(--colorsSemanticInfo500)",
|
|
26
|
+
buttonFocus: isDarkBackground ? "var(--colorsSemanticInfo500)" : "var(--colorsSemanticInfo600)",
|
|
27
|
+
content: isDarkBackground ? "var(--colorsSemanticInfoYin090)" : "var(--colorsSemanticInfoYang100)"
|
|
28
|
+
},
|
|
29
|
+
neutralWhite: {
|
|
30
|
+
varietyColor: "var(--colorsSemanticNeutralYang100)",
|
|
31
|
+
buttonFocus: "var(--colorsSemanticNeutralYin030)",
|
|
32
|
+
content: "var(--colorsSemanticNeutral500)"
|
|
23
33
|
}
|
|
24
34
|
},
|
|
25
35
|
tag: {
|
|
@@ -15,7 +15,8 @@ export interface StyledPillProps extends MarginProps {
|
|
|
15
15
|
interface AllStyledPillProps extends StyledPillProps {
|
|
16
16
|
inFill?: boolean;
|
|
17
17
|
isDeletable: boolean;
|
|
18
|
-
|
|
18
|
+
isDarkBackground: boolean;
|
|
19
|
+
colorVariant: "neutral" | "negative" | "positive" | "warning" | "information" | "neutralWhite";
|
|
19
20
|
pillRole: "tag" | "status";
|
|
20
21
|
}
|
|
21
22
|
declare const StyledPill: import("styled-components").StyledComponent<"span", any, AllStyledPillProps, never>;
|
|
@@ -21,6 +21,7 @@ const StyledPill = styled.span`
|
|
|
21
21
|
wrapText,
|
|
22
22
|
borderColor,
|
|
23
23
|
colorVariant,
|
|
24
|
+
isDarkBackground,
|
|
24
25
|
isDeletable,
|
|
25
26
|
inFill,
|
|
26
27
|
maxWidth,
|
|
@@ -41,7 +42,7 @@ const StyledPill = styled.span`
|
|
|
41
42
|
const {
|
|
42
43
|
status,
|
|
43
44
|
tag
|
|
44
|
-
} = styleConfig();
|
|
45
|
+
} = styleConfig(isDarkBackground);
|
|
45
46
|
const {
|
|
46
47
|
varietyColor,
|
|
47
48
|
buttonFocus,
|
|
@@ -83,7 +84,7 @@ const StyledPill = styled.span`
|
|
|
83
84
|
`}
|
|
84
85
|
|
|
85
86
|
${!inFill && css`
|
|
86
|
-
color: var(--colorsUtilityYin090);
|
|
87
|
+
color: ${!isDarkBackground ? "var(--colorsUtilityYin090)" : "var(--colorsUtilityYang100)"};
|
|
87
88
|
`}
|
|
88
89
|
|
|
89
90
|
${size === "S" && css`
|
|
@@ -204,7 +205,7 @@ const StyledPill = styled.span`
|
|
|
204
205
|
|
|
205
206
|
${!inFill && css`
|
|
206
207
|
${StyledIcon} {
|
|
207
|
-
color: var(--colorsUtilityYin090);
|
|
208
|
+
color: ${!isDarkBackground ? "var(--colorsUtilityYin090)" : "var(--colorsUtilityYang100)"};
|
|
208
209
|
}
|
|
209
210
|
`}
|
|
210
211
|
}
|
|
@@ -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Ł"
|
package/esm/locales/en-gb.js
CHANGED
|
@@ -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"
|
package/esm/locales/locale.d.ts
CHANGED
|
@@ -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;
|