carbon-react 141.4.4 → 142.0.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/file-input/__internal__/file-upload-status/file-upload-status.component.js +12 -4
- package/esm/components/message/{message-content → __internal__/message-content}/message-content.component.d.ts +0 -4
- package/esm/components/message/{message-content → __internal__/message-content}/message-content.component.js +2 -2
- package/{lib/components/message → esm/components/message/__internal__}/type-icon/type-icon.component.d.ts +2 -4
- package/esm/components/message/{type-icon → __internal__/type-icon}/type-icon.component.js +3 -3
- package/{lib/components/message → esm/components/message/__internal__}/type-icon/type-icon.style.d.ts +1 -3
- package/esm/components/message/message.component.js +2 -2
- package/esm/components/progress-tracker/progress-tracker.component.d.ts +4 -21
- package/esm/components/progress-tracker/progress-tracker.component.js +12 -51
- package/esm/components/progress-tracker/progress-tracker.style.d.ts +2 -2
- package/esm/components/progress-tracker/progress-tracker.style.js +2 -4
- package/esm/components/toast/toast.style.d.ts +1 -1
- package/esm/components/toast/toast.style.js +1 -1
- package/lib/components/file-input/__internal__/file-upload-status/file-upload-status.component.js +12 -4
- package/lib/components/message/{message-content → __internal__/message-content}/message-content.component.d.ts +0 -4
- package/lib/components/message/{message-content → __internal__/message-content}/message-content.component.js +2 -2
- package/{esm/components/message → lib/components/message/__internal__}/type-icon/type-icon.component.d.ts +2 -4
- package/lib/components/message/{type-icon → __internal__/type-icon}/type-icon.component.js +3 -3
- package/{esm/components/message → lib/components/message/__internal__}/type-icon/type-icon.style.d.ts +1 -3
- package/lib/components/message/message.component.js +2 -2
- package/lib/components/progress-tracker/progress-tracker.component.d.ts +4 -21
- package/lib/components/progress-tracker/progress-tracker.component.js +12 -53
- package/lib/components/progress-tracker/progress-tracker.style.d.ts +2 -2
- package/lib/components/progress-tracker/progress-tracker.style.js +2 -4
- package/lib/components/toast/toast.style.d.ts +1 -1
- package/lib/components/toast/toast.style.js +1 -1
- package/package.json +1 -1
- /package/esm/components/message/{message-content → __internal__/message-content}/message-content.style.d.ts +0 -0
- /package/esm/components/message/{message-content → __internal__/message-content}/message-content.style.js +0 -0
- /package/esm/components/message/{type-icon → __internal__/type-icon}/type-icon.style.js +0 -0
- /package/lib/components/message/{message-content → __internal__/message-content}/message-content.style.d.ts +0 -0
- /package/lib/components/message/{message-content → __internal__/message-content}/message-content.style.js +0 -0
- /package/lib/components/message/{type-icon → __internal__/type-icon}/type-icon.style.js +0 -0
package/esm/components/file-input/__internal__/file-upload-status/file-upload-status.component.js
CHANGED
|
@@ -3,7 +3,7 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import Link from "../../../link";
|
|
4
4
|
import ButtonMinor from "../../../button-minor";
|
|
5
5
|
import StyledTypography from "../../../typography/typography.style";
|
|
6
|
-
import
|
|
6
|
+
import { StyledProgressBar, InnerBar } from "../../../progress-tracker/progress-tracker.style";
|
|
7
7
|
import LoaderBar from "../../../loader-bar";
|
|
8
8
|
import Icon from "../../../icon";
|
|
9
9
|
import { StyledFileUploadStatus, StyledFileUploadStatusRow, StyledFileLinkContainer } from "./file-upload-status.style";
|
|
@@ -24,10 +24,18 @@ export const FileUploadStatus = ({
|
|
|
24
24
|
switch (status) {
|
|
25
25
|
case "uploading":
|
|
26
26
|
buttonText = locale.fileInput.actions.cancel();
|
|
27
|
-
progressBar = statusProps.progress === undefined ? /*#__PURE__*/React.createElement(LoaderBar, null) : /*#__PURE__*/React.createElement(
|
|
27
|
+
progressBar = statusProps.progress === undefined ? /*#__PURE__*/React.createElement(LoaderBar, null) : /*#__PURE__*/React.createElement(StyledProgressBar, {
|
|
28
|
+
"data-element": "progress-tracker-bar",
|
|
29
|
+
"data-role": "progress-tracker-bar",
|
|
28
30
|
progress: statusProps.progress,
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
+
"aria-hidden": "true"
|
|
32
|
+
}, /*#__PURE__*/React.createElement(InnerBar, {
|
|
33
|
+
"data-element": "inner-bar",
|
|
34
|
+
"data-role": "inner-bar",
|
|
35
|
+
size: "medium",
|
|
36
|
+
progress: statusProps.progress,
|
|
37
|
+
error: false
|
|
38
|
+
}));
|
|
31
39
|
break;
|
|
32
40
|
case "previously":
|
|
33
41
|
case "completed":
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export interface MessageContentProps {
|
|
3
|
-
/** set message title */
|
|
4
3
|
title?: React.ReactNode;
|
|
5
|
-
/** set content to component */
|
|
6
4
|
children?: React.ReactNode;
|
|
7
|
-
/** determines if the close icon is shown */
|
|
8
5
|
showCloseIcon?: boolean;
|
|
9
|
-
/** @ignore @private used to reduce the left-padding for the transparent variant */
|
|
10
6
|
reduceLeftPadding?: boolean;
|
|
11
7
|
}
|
|
12
8
|
declare const MessageContent: ({ title, children, showCloseIcon, reduceLeftPadding, }: MessageContentProps) => React.JSX.Element;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import Content from "
|
|
3
|
+
import Content from "../../../content";
|
|
4
4
|
import MessageContentStyle from "./message-content.style";
|
|
5
5
|
const MessageContent = ({
|
|
6
6
|
title,
|
|
7
7
|
children,
|
|
8
8
|
showCloseIcon,
|
|
9
|
-
reduceLeftPadding
|
|
9
|
+
reduceLeftPadding
|
|
10
10
|
}) => {
|
|
11
11
|
return /*#__PURE__*/React.createElement(MessageContentStyle, {
|
|
12
12
|
showCloseIcon: showCloseIcon,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { MessageVariant } from "
|
|
2
|
+
import { MessageVariant } from "../../message.component";
|
|
3
3
|
export interface TypeIconProps {
|
|
4
|
-
/** set background to be invisible */
|
|
5
4
|
transparent?: boolean;
|
|
6
|
-
|
|
7
|
-
variant?: MessageVariant;
|
|
5
|
+
variant: MessageVariant;
|
|
8
6
|
}
|
|
9
7
|
declare const TypeIcon: ({ variant, transparent }: TypeIconProps) => React.JSX.Element;
|
|
10
8
|
export default TypeIcon;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import TypeIconStyle from "./type-icon.style";
|
|
4
|
-
import Icon from "
|
|
4
|
+
import Icon from "../../../icon";
|
|
5
5
|
const TypeIcon = ({
|
|
6
|
-
variant
|
|
7
|
-
transparent
|
|
6
|
+
variant,
|
|
7
|
+
transparent
|
|
8
8
|
}) => {
|
|
9
9
|
function iconToRender() {
|
|
10
10
|
if (variant === "neutral") return "info";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { MessageVariant } from "
|
|
1
|
+
import { MessageVariant } from "../../message.component";
|
|
2
2
|
declare type TypeIconStyleProps = {
|
|
3
|
-
/** set background to be invisible */
|
|
4
3
|
transparent?: boolean;
|
|
5
|
-
/** set type of message based on new DLS standard */
|
|
6
4
|
variant: MessageVariant;
|
|
7
5
|
};
|
|
8
6
|
declare const TypeIconStyle: import("styled-components").StyledComponent<"div", any, TypeIconStyleProps, never>;
|
|
@@ -2,8 +2,8 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
2
2
|
import React, { useRef } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import MessageStyle from "./message.style";
|
|
5
|
-
import TypeIcon from "./type-icon/type-icon.component";
|
|
6
|
-
import MessageContent from "./message-content/message-content.component";
|
|
5
|
+
import TypeIcon from "./__internal__/type-icon/type-icon.component";
|
|
6
|
+
import MessageContent from "./__internal__/message-content/message-content.component";
|
|
7
7
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
8
8
|
import Icon from "../icon";
|
|
9
9
|
import IconButton from "../icon-button";
|
|
@@ -1,32 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
3
|
export interface ProgressTrackerProps extends MarginProps {
|
|
4
|
-
/** (Deprecated) Specifies an aria label to the component */
|
|
5
|
-
"aria-label"?: string;
|
|
6
|
-
/** (Deprecated) Specifies the aria describedby for the component */
|
|
7
|
-
"aria-describedby"?: string;
|
|
8
|
-
/** (Deprecated) The value of progress to be read out to the user. */
|
|
9
|
-
"aria-valuenow"?: number;
|
|
10
|
-
/** (Deprecated) The minimum value of the progress tracker */
|
|
11
|
-
"aria-valuemin"?: number;
|
|
12
|
-
/** (Deprecated) The maximum value of the progress tracker */
|
|
13
|
-
"aria-valuemax"?: number;
|
|
14
|
-
/** (Deprecated) Prop to define the human readable text alternative of aria-valuenow
|
|
15
|
-
* if aria-valuenow is not a number
|
|
16
|
-
*/
|
|
17
|
-
"aria-valuetext"?: string;
|
|
18
4
|
/** Size of the progress bar. */
|
|
19
5
|
size?: "small" | "medium" | "large";
|
|
20
6
|
/** Length of the component, any valid css string. */
|
|
21
7
|
length?: string;
|
|
22
8
|
/** Current progress (percentage). */
|
|
23
9
|
progress?: number;
|
|
24
|
-
/**
|
|
10
|
+
/** Flag to control error state. */
|
|
25
11
|
error?: boolean;
|
|
26
|
-
/** Flag to control whether the default value labels (as percentages) should be rendered. */
|
|
27
|
-
description?: string;
|
|
28
12
|
/** Value to add a description to the label */
|
|
29
|
-
|
|
13
|
+
description?: string;
|
|
30
14
|
/** Value to display as current progress. */
|
|
31
15
|
currentProgressLabel?: string;
|
|
32
16
|
/** Value to display as the maximum progress limit. */
|
|
@@ -35,14 +19,13 @@ export interface ProgressTrackerProps extends MarginProps {
|
|
|
35
19
|
customValuePreposition?: string;
|
|
36
20
|
/**
|
|
37
21
|
* The position the value label are rendered in.
|
|
38
|
-
* Top/bottom apply to horizontal and left applies to vertical orientation.
|
|
39
22
|
*/
|
|
40
23
|
labelsPosition?: "top" | "bottom" | "left";
|
|
41
|
-
/** Label width */
|
|
24
|
+
/** Label width when position is "left" */
|
|
42
25
|
labelWidth?: string;
|
|
43
26
|
}
|
|
44
27
|
declare const ProgressTracker: {
|
|
45
|
-
({
|
|
28
|
+
({ size, length, error, progress, description, currentProgressLabel, customValuePreposition, maxProgressLabel, labelsPosition, labelWidth, ...rest }: ProgressTrackerProps): React.JSX.Element;
|
|
46
29
|
displayName: string;
|
|
47
30
|
};
|
|
48
31
|
export default ProgressTracker;
|
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
5
5
|
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
6
6
|
import { StyledProgressBar, InnerBar, StyledValuesLabel, StyledProgressTracker, StyledValue, StyledDescription } from "./progress-tracker.style";
|
|
7
|
-
import useResizeObserver from "../../hooks/__internal__/useResizeObserver";
|
|
8
|
-
import Logger from "../../__internal__/utils/logger";
|
|
9
|
-
let deprecatedAriaTagsWarnTriggered = false;
|
|
10
7
|
const ProgressTracker = ({
|
|
11
|
-
"aria-label": ariaLabel,
|
|
12
|
-
"aria-describedby": ariaDescribedBy,
|
|
13
|
-
"aria-valuenow": ariaValueNow,
|
|
14
|
-
"aria-valuemin": ariaValueMin,
|
|
15
|
-
"aria-valuemax": ariaValueMax,
|
|
16
|
-
"aria-valuetext": ariaValueText,
|
|
17
8
|
size = "medium",
|
|
18
9
|
length = "256px",
|
|
19
10
|
error = false,
|
|
20
11
|
progress = 0,
|
|
21
12
|
description,
|
|
22
|
-
showDefaultLabels = false,
|
|
23
13
|
currentProgressLabel,
|
|
24
14
|
customValuePreposition,
|
|
25
15
|
maxProgressLabel,
|
|
@@ -27,40 +17,22 @@ const ProgressTracker = ({
|
|
|
27
17
|
labelWidth,
|
|
28
18
|
...rest
|
|
29
19
|
}) => {
|
|
30
|
-
if ((ariaLabel || ariaDescribedBy || ariaValueNow || ariaValueMax || ariaValueMin || ariaValueText) && !deprecatedAriaTagsWarnTriggered) {
|
|
31
|
-
deprecatedAriaTagsWarnTriggered = true;
|
|
32
|
-
Logger.deprecate("The 'aria-' attribute props in `ProgressTracker` have been deprecated and will soon be removed.");
|
|
33
|
-
}
|
|
34
20
|
const l = useLocale();
|
|
35
|
-
const barRef = useRef(null);
|
|
36
|
-
const [barLength, setBarLength] = useState("0px");
|
|
37
21
|
const prefixLabels = labelsPosition !== "bottom";
|
|
38
|
-
const updateBarLength = useCallback(() => {
|
|
39
|
-
setBarLength(`${barRef.current?.offsetWidth}px`);
|
|
40
|
-
}, []);
|
|
41
|
-
useLayoutEffect(() => {
|
|
42
|
-
updateBarLength();
|
|
43
|
-
}, [updateBarLength]);
|
|
44
|
-
useResizeObserver(barRef, () => {
|
|
45
|
-
updateBarLength();
|
|
46
|
-
});
|
|
47
22
|
const renderValueLabels = () => {
|
|
48
|
-
|
|
49
|
-
|
|
23
|
+
let displayedCurrentProgressLabel, displayedMaxProgressLabel;
|
|
24
|
+
if (currentProgressLabel) {
|
|
25
|
+
displayedCurrentProgressLabel = currentProgressLabel;
|
|
26
|
+
displayedMaxProgressLabel = maxProgressLabel || undefined;
|
|
27
|
+
} else {
|
|
28
|
+
displayedCurrentProgressLabel = `${progress}%`;
|
|
29
|
+
displayedMaxProgressLabel = "100%";
|
|
50
30
|
}
|
|
51
|
-
const label = (value, defaultValue) => {
|
|
52
|
-
if (value) {
|
|
53
|
-
return value;
|
|
54
|
-
}
|
|
55
|
-
return showDefaultLabels ? defaultValue : undefined;
|
|
56
|
-
};
|
|
57
|
-
const displayedCurrentProgressLabel = label(currentProgressLabel, `${progress}%`);
|
|
58
|
-
const displayedMaxProgressLabel = label(maxProgressLabel, "100%");
|
|
59
31
|
return /*#__PURE__*/React.createElement(StyledValuesLabel, {
|
|
60
32
|
labelsPosition: labelsPosition,
|
|
61
33
|
size: size,
|
|
62
34
|
labelWidth: labelWidth
|
|
63
|
-
},
|
|
35
|
+
}, /*#__PURE__*/React.createElement(StyledValue, {
|
|
64
36
|
"data-element": "current-progress-label"
|
|
65
37
|
}, displayedCurrentProgressLabel), displayedMaxProgressLabel && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
66
38
|
"data-element": "custom-preposition"
|
|
@@ -70,29 +42,18 @@ const ProgressTracker = ({
|
|
|
70
42
|
"data-element": "progress-tracker-description"
|
|
71
43
|
}, description));
|
|
72
44
|
};
|
|
73
|
-
const valueMin = ariaValueMin === undefined ? 0 : ariaValueMin;
|
|
74
|
-
const valueMax = ariaValueMax === undefined ? 100 : ariaValueMax;
|
|
75
|
-
const defaultValueNow = valueMin + (valueMax - valueMin) * progress / 100;
|
|
76
45
|
return /*#__PURE__*/React.createElement(StyledProgressTracker, _extends({
|
|
77
46
|
length: length
|
|
78
47
|
}, rest, tagComponent("progress-bar", rest), {
|
|
79
|
-
role: "progressbar",
|
|
80
|
-
"aria-label": ariaLabel || "progress tracker",
|
|
81
|
-
"aria-describedby": ariaDescribedBy,
|
|
82
|
-
"aria-valuenow": ariaValueNow === undefined ? defaultValueNow : ariaValueNow,
|
|
83
|
-
"aria-valuemin": ariaValueMin,
|
|
84
|
-
"aria-valuemax": ariaValueMax,
|
|
85
|
-
"aria-valuetext": ariaValueText,
|
|
86
48
|
labelsPosition: labelsPosition
|
|
87
49
|
}), prefixLabels && renderValueLabels(), /*#__PURE__*/React.createElement(StyledProgressBar, {
|
|
88
|
-
size: size,
|
|
89
|
-
ref: barRef,
|
|
90
50
|
progress: progress,
|
|
91
|
-
error: error
|
|
51
|
+
error: error,
|
|
52
|
+
"aria-hidden": "true"
|
|
92
53
|
}, /*#__PURE__*/React.createElement(InnerBar, {
|
|
93
54
|
"data-element": "inner-bar",
|
|
55
|
+
"data-role": "inner-bar",
|
|
94
56
|
size: size,
|
|
95
|
-
length: barLength,
|
|
96
57
|
progress: progress,
|
|
97
58
|
error: error
|
|
98
59
|
})), !prefixLabels && renderValueLabels());
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ProgressTrackerProps } from "./progress-tracker.component";
|
|
2
2
|
declare const StyledProgressTracker: import("styled-components").StyledComponent<"div", any, Pick<ProgressTrackerProps, "length" | "margin" | "labelsPosition">, never>;
|
|
3
|
-
declare const StyledProgressBar: import("styled-components").StyledComponent<"span", any, Pick<ProgressTrackerProps, "error" | "progress"
|
|
3
|
+
declare const StyledProgressBar: import("styled-components").StyledComponent<"span", any, Pick<ProgressTrackerProps, "error" | "progress">, never>;
|
|
4
4
|
declare const StyledValue: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
5
5
|
declare const StyledDescription: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
6
6
|
declare const StyledValuesLabel: import("styled-components").StyledComponent<"span", any, Pick<ProgressTrackerProps, "labelWidth" | "size" | "labelsPosition">, never>;
|
|
7
|
-
declare const InnerBar: import("styled-components").StyledComponent<"span", any, Pick<ProgressTrackerProps, "error" | "progress" | "
|
|
7
|
+
declare const InnerBar: import("styled-components").StyledComponent<"span", any, Required<Pick<ProgressTrackerProps, "error" | "progress" | "size">>, never>;
|
|
8
8
|
export { StyledProgressBar, InnerBar, StyledProgressTracker, StyledValuesLabel, StyledValue, StyledDescription, };
|
|
@@ -46,7 +46,6 @@ const StyledProgressTracker = styled.div`
|
|
|
46
46
|
`;
|
|
47
47
|
const StyledProgressBar = styled.span`
|
|
48
48
|
${({
|
|
49
|
-
size,
|
|
50
49
|
progress,
|
|
51
50
|
error,
|
|
52
51
|
theme
|
|
@@ -108,8 +107,7 @@ const StyledValuesLabel = styled.span`
|
|
|
108
107
|
const InnerBar = styled.span`
|
|
109
108
|
${({
|
|
110
109
|
progress,
|
|
111
|
-
size
|
|
112
|
-
length,
|
|
110
|
+
size,
|
|
113
111
|
error,
|
|
114
112
|
theme
|
|
115
113
|
}) => css`
|
|
@@ -120,7 +118,7 @@ const InnerBar = styled.span`
|
|
|
120
118
|
error
|
|
121
119
|
})};
|
|
122
120
|
border-radius: ${theme.roundedCornersOptOut ? "25px" : "var(--borderRadius400)"};
|
|
123
|
-
width:
|
|
121
|
+
width: ${progress}%;
|
|
124
122
|
min-width: 2px;
|
|
125
123
|
height: ${getHeight(size)};
|
|
126
124
|
`}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import TypeIcon from "../message/type-icon/type-icon.style";
|
|
2
|
+
import TypeIcon from "../message/__internal__/type-icon/type-icon.style";
|
|
3
3
|
import { MessageVariant } from "../message/message.component";
|
|
4
4
|
declare const StyledPortal: import("styled-components").StyledComponent<({ children, className, id, onReposition, inertOptOut, }: import("../portal/portal").PortalProps) => import("react").JSX.Element, any, {
|
|
5
5
|
align?: "left" | "right" | "center" | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import TypeIcon from "../message/type-icon/type-icon.style";
|
|
2
|
+
import TypeIcon from "../message/__internal__/type-icon/type-icon.style";
|
|
3
3
|
import StyledIconButton from "../icon-button/icon-button.style";
|
|
4
4
|
import Portal from "../portal/portal";
|
|
5
5
|
import baseTheme from "../../style/themes/base";
|
package/lib/components/file-input/__internal__/file-upload-status/file-upload-status.component.js
CHANGED
|
@@ -9,7 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _link = _interopRequireDefault(require("../../../link"));
|
|
10
10
|
var _buttonMinor = _interopRequireDefault(require("../../../button-minor"));
|
|
11
11
|
var _typography = _interopRequireDefault(require("../../../typography/typography.style"));
|
|
12
|
-
var _progressTracker =
|
|
12
|
+
var _progressTracker = require("../../../progress-tracker/progress-tracker.style");
|
|
13
13
|
var _loaderBar = _interopRequireDefault(require("../../../loader-bar"));
|
|
14
14
|
var _icon = _interopRequireDefault(require("../../../icon"));
|
|
15
15
|
var _fileUploadStatus = require("./file-upload-status.style");
|
|
@@ -31,10 +31,18 @@ const FileUploadStatus = ({
|
|
|
31
31
|
switch (status) {
|
|
32
32
|
case "uploading":
|
|
33
33
|
buttonText = locale.fileInput.actions.cancel();
|
|
34
|
-
progressBar = statusProps.progress === undefined ? /*#__PURE__*/_react.default.createElement(_loaderBar.default, null) : /*#__PURE__*/_react.default.createElement(_progressTracker.
|
|
34
|
+
progressBar = statusProps.progress === undefined ? /*#__PURE__*/_react.default.createElement(_loaderBar.default, null) : /*#__PURE__*/_react.default.createElement(_progressTracker.StyledProgressBar, {
|
|
35
|
+
"data-element": "progress-tracker-bar",
|
|
36
|
+
"data-role": "progress-tracker-bar",
|
|
35
37
|
progress: statusProps.progress,
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
+
"aria-hidden": "true"
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement(_progressTracker.InnerBar, {
|
|
40
|
+
"data-element": "inner-bar",
|
|
41
|
+
"data-role": "inner-bar",
|
|
42
|
+
size: "medium",
|
|
43
|
+
progress: statusProps.progress,
|
|
44
|
+
error: false
|
|
45
|
+
}));
|
|
38
46
|
break;
|
|
39
47
|
case "previously":
|
|
40
48
|
case "completed":
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export interface MessageContentProps {
|
|
3
|
-
/** set message title */
|
|
4
3
|
title?: React.ReactNode;
|
|
5
|
-
/** set content to component */
|
|
6
4
|
children?: React.ReactNode;
|
|
7
|
-
/** determines if the close icon is shown */
|
|
8
5
|
showCloseIcon?: boolean;
|
|
9
|
-
/** @ignore @private used to reduce the left-padding for the transparent variant */
|
|
10
6
|
reduceLeftPadding?: boolean;
|
|
11
7
|
}
|
|
12
8
|
declare const MessageContent: ({ title, children, showCloseIcon, reduceLeftPadding, }: MessageContentProps) => React.JSX.Element;
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _content = _interopRequireDefault(require("
|
|
9
|
+
var _content = _interopRequireDefault(require("../../../content"));
|
|
10
10
|
var _messageContent = _interopRequireDefault(require("./message-content.style"));
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
const MessageContent = ({
|
|
13
13
|
title,
|
|
14
14
|
children,
|
|
15
15
|
showCloseIcon,
|
|
16
|
-
reduceLeftPadding
|
|
16
|
+
reduceLeftPadding
|
|
17
17
|
}) => {
|
|
18
18
|
return /*#__PURE__*/_react.default.createElement(_messageContent.default, {
|
|
19
19
|
showCloseIcon: showCloseIcon,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { MessageVariant } from "
|
|
2
|
+
import { MessageVariant } from "../../message.component";
|
|
3
3
|
export interface TypeIconProps {
|
|
4
|
-
/** set background to be invisible */
|
|
5
4
|
transparent?: boolean;
|
|
6
|
-
|
|
7
|
-
variant?: MessageVariant;
|
|
5
|
+
variant: MessageVariant;
|
|
8
6
|
}
|
|
9
7
|
declare const TypeIcon: ({ variant, transparent }: TypeIconProps) => React.JSX.Element;
|
|
10
8
|
export default TypeIcon;
|
|
@@ -7,11 +7,11 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _typeIcon = _interopRequireDefault(require("./type-icon.style"));
|
|
10
|
-
var _icon = _interopRequireDefault(require("
|
|
10
|
+
var _icon = _interopRequireDefault(require("../../../icon"));
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
const TypeIcon = ({
|
|
13
|
-
variant
|
|
14
|
-
transparent
|
|
13
|
+
variant,
|
|
14
|
+
transparent
|
|
15
15
|
}) => {
|
|
16
16
|
function iconToRender() {
|
|
17
17
|
if (variant === "neutral") return "info";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { MessageVariant } from "
|
|
1
|
+
import { MessageVariant } from "../../message.component";
|
|
2
2
|
declare type TypeIconStyleProps = {
|
|
3
|
-
/** set background to be invisible */
|
|
4
3
|
transparent?: boolean;
|
|
5
|
-
/** set type of message based on new DLS standard */
|
|
6
4
|
variant: MessageVariant;
|
|
7
5
|
};
|
|
8
6
|
declare const TypeIconStyle: import("styled-components").StyledComponent<"div", any, TypeIconStyleProps, never>;
|
|
@@ -7,8 +7,8 @@ exports.default = exports.Message = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _message = _interopRequireDefault(require("./message.style"));
|
|
10
|
-
var _typeIcon = _interopRequireDefault(require("./type-icon/type-icon.component"));
|
|
11
|
-
var _messageContent = _interopRequireDefault(require("./message-content/message-content.component"));
|
|
10
|
+
var _typeIcon = _interopRequireDefault(require("./__internal__/type-icon/type-icon.component"));
|
|
11
|
+
var _messageContent = _interopRequireDefault(require("./__internal__/message-content/message-content.component"));
|
|
12
12
|
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
13
13
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
14
14
|
var _iconButton = _interopRequireDefault(require("../icon-button"));
|
|
@@ -1,32 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
3
|
export interface ProgressTrackerProps extends MarginProps {
|
|
4
|
-
/** (Deprecated) Specifies an aria label to the component */
|
|
5
|
-
"aria-label"?: string;
|
|
6
|
-
/** (Deprecated) Specifies the aria describedby for the component */
|
|
7
|
-
"aria-describedby"?: string;
|
|
8
|
-
/** (Deprecated) The value of progress to be read out to the user. */
|
|
9
|
-
"aria-valuenow"?: number;
|
|
10
|
-
/** (Deprecated) The minimum value of the progress tracker */
|
|
11
|
-
"aria-valuemin"?: number;
|
|
12
|
-
/** (Deprecated) The maximum value of the progress tracker */
|
|
13
|
-
"aria-valuemax"?: number;
|
|
14
|
-
/** (Deprecated) Prop to define the human readable text alternative of aria-valuenow
|
|
15
|
-
* if aria-valuenow is not a number
|
|
16
|
-
*/
|
|
17
|
-
"aria-valuetext"?: string;
|
|
18
4
|
/** Size of the progress bar. */
|
|
19
5
|
size?: "small" | "medium" | "large";
|
|
20
6
|
/** Length of the component, any valid css string. */
|
|
21
7
|
length?: string;
|
|
22
8
|
/** Current progress (percentage). */
|
|
23
9
|
progress?: number;
|
|
24
|
-
/**
|
|
10
|
+
/** Flag to control error state. */
|
|
25
11
|
error?: boolean;
|
|
26
|
-
/** Flag to control whether the default value labels (as percentages) should be rendered. */
|
|
27
|
-
description?: string;
|
|
28
12
|
/** Value to add a description to the label */
|
|
29
|
-
|
|
13
|
+
description?: string;
|
|
30
14
|
/** Value to display as current progress. */
|
|
31
15
|
currentProgressLabel?: string;
|
|
32
16
|
/** Value to display as the maximum progress limit. */
|
|
@@ -35,14 +19,13 @@ export interface ProgressTrackerProps extends MarginProps {
|
|
|
35
19
|
customValuePreposition?: string;
|
|
36
20
|
/**
|
|
37
21
|
* The position the value label are rendered in.
|
|
38
|
-
* Top/bottom apply to horizontal and left applies to vertical orientation.
|
|
39
22
|
*/
|
|
40
23
|
labelsPosition?: "top" | "bottom" | "left";
|
|
41
|
-
/** Label width */
|
|
24
|
+
/** Label width when position is "left" */
|
|
42
25
|
labelWidth?: string;
|
|
43
26
|
}
|
|
44
27
|
declare const ProgressTracker: {
|
|
45
|
-
({
|
|
28
|
+
({ size, length, error, progress, description, currentProgressLabel, customValuePreposition, maxProgressLabel, labelsPosition, labelWidth, ...rest }: ProgressTrackerProps): React.JSX.Element;
|
|
46
29
|
displayName: string;
|
|
47
30
|
};
|
|
48
31
|
export default ProgressTracker;
|
|
@@ -4,31 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
10
10
|
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags"));
|
|
11
11
|
var _progressTracker = require("./progress-tracker.style");
|
|
12
|
-
var _useResizeObserver = _interopRequireDefault(require("../../hooks/__internal__/useResizeObserver"));
|
|
13
|
-
var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
|
|
14
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
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); }
|
|
16
|
-
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 && {}.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; }
|
|
17
13
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
18
|
-
let deprecatedAriaTagsWarnTriggered = false;
|
|
19
14
|
const ProgressTracker = ({
|
|
20
|
-
"aria-label": ariaLabel,
|
|
21
|
-
"aria-describedby": ariaDescribedBy,
|
|
22
|
-
"aria-valuenow": ariaValueNow,
|
|
23
|
-
"aria-valuemin": ariaValueMin,
|
|
24
|
-
"aria-valuemax": ariaValueMax,
|
|
25
|
-
"aria-valuetext": ariaValueText,
|
|
26
15
|
size = "medium",
|
|
27
16
|
length = "256px",
|
|
28
17
|
error = false,
|
|
29
18
|
progress = 0,
|
|
30
19
|
description,
|
|
31
|
-
showDefaultLabels = false,
|
|
32
20
|
currentProgressLabel,
|
|
33
21
|
customValuePreposition,
|
|
34
22
|
maxProgressLabel,
|
|
@@ -36,40 +24,22 @@ const ProgressTracker = ({
|
|
|
36
24
|
labelWidth,
|
|
37
25
|
...rest
|
|
38
26
|
}) => {
|
|
39
|
-
if ((ariaLabel || ariaDescribedBy || ariaValueNow || ariaValueMax || ariaValueMin || ariaValueText) && !deprecatedAriaTagsWarnTriggered) {
|
|
40
|
-
deprecatedAriaTagsWarnTriggered = true;
|
|
41
|
-
_logger.default.deprecate("The 'aria-' attribute props in `ProgressTracker` have been deprecated and will soon be removed.");
|
|
42
|
-
}
|
|
43
27
|
const l = (0, _useLocale.default)();
|
|
44
|
-
const barRef = (0, _react.useRef)(null);
|
|
45
|
-
const [barLength, setBarLength] = (0, _react.useState)("0px");
|
|
46
28
|
const prefixLabels = labelsPosition !== "bottom";
|
|
47
|
-
const updateBarLength = (0, _react.useCallback)(() => {
|
|
48
|
-
setBarLength(`${barRef.current?.offsetWidth}px`);
|
|
49
|
-
}, []);
|
|
50
|
-
(0, _react.useLayoutEffect)(() => {
|
|
51
|
-
updateBarLength();
|
|
52
|
-
}, [updateBarLength]);
|
|
53
|
-
(0, _useResizeObserver.default)(barRef, () => {
|
|
54
|
-
updateBarLength();
|
|
55
|
-
});
|
|
56
29
|
const renderValueLabels = () => {
|
|
57
|
-
|
|
58
|
-
|
|
30
|
+
let displayedCurrentProgressLabel, displayedMaxProgressLabel;
|
|
31
|
+
if (currentProgressLabel) {
|
|
32
|
+
displayedCurrentProgressLabel = currentProgressLabel;
|
|
33
|
+
displayedMaxProgressLabel = maxProgressLabel || undefined;
|
|
34
|
+
} else {
|
|
35
|
+
displayedCurrentProgressLabel = `${progress}%`;
|
|
36
|
+
displayedMaxProgressLabel = "100%";
|
|
59
37
|
}
|
|
60
|
-
const label = (value, defaultValue) => {
|
|
61
|
-
if (value) {
|
|
62
|
-
return value;
|
|
63
|
-
}
|
|
64
|
-
return showDefaultLabels ? defaultValue : undefined;
|
|
65
|
-
};
|
|
66
|
-
const displayedCurrentProgressLabel = label(currentProgressLabel, `${progress}%`);
|
|
67
|
-
const displayedMaxProgressLabel = label(maxProgressLabel, "100%");
|
|
68
38
|
return /*#__PURE__*/_react.default.createElement(_progressTracker.StyledValuesLabel, {
|
|
69
39
|
labelsPosition: labelsPosition,
|
|
70
40
|
size: size,
|
|
71
41
|
labelWidth: labelWidth
|
|
72
|
-
},
|
|
42
|
+
}, /*#__PURE__*/_react.default.createElement(_progressTracker.StyledValue, {
|
|
73
43
|
"data-element": "current-progress-label"
|
|
74
44
|
}, displayedCurrentProgressLabel), displayedMaxProgressLabel && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
75
45
|
"data-element": "custom-preposition"
|
|
@@ -79,29 +49,18 @@ const ProgressTracker = ({
|
|
|
79
49
|
"data-element": "progress-tracker-description"
|
|
80
50
|
}, description));
|
|
81
51
|
};
|
|
82
|
-
const valueMin = ariaValueMin === undefined ? 0 : ariaValueMin;
|
|
83
|
-
const valueMax = ariaValueMax === undefined ? 100 : ariaValueMax;
|
|
84
|
-
const defaultValueNow = valueMin + (valueMax - valueMin) * progress / 100;
|
|
85
52
|
return /*#__PURE__*/_react.default.createElement(_progressTracker.StyledProgressTracker, _extends({
|
|
86
53
|
length: length
|
|
87
54
|
}, rest, (0, _tags.default)("progress-bar", rest), {
|
|
88
|
-
role: "progressbar",
|
|
89
|
-
"aria-label": ariaLabel || "progress tracker",
|
|
90
|
-
"aria-describedby": ariaDescribedBy,
|
|
91
|
-
"aria-valuenow": ariaValueNow === undefined ? defaultValueNow : ariaValueNow,
|
|
92
|
-
"aria-valuemin": ariaValueMin,
|
|
93
|
-
"aria-valuemax": ariaValueMax,
|
|
94
|
-
"aria-valuetext": ariaValueText,
|
|
95
55
|
labelsPosition: labelsPosition
|
|
96
56
|
}), prefixLabels && renderValueLabels(), /*#__PURE__*/_react.default.createElement(_progressTracker.StyledProgressBar, {
|
|
97
|
-
size: size,
|
|
98
|
-
ref: barRef,
|
|
99
57
|
progress: progress,
|
|
100
|
-
error: error
|
|
58
|
+
error: error,
|
|
59
|
+
"aria-hidden": "true"
|
|
101
60
|
}, /*#__PURE__*/_react.default.createElement(_progressTracker.InnerBar, {
|
|
102
61
|
"data-element": "inner-bar",
|
|
62
|
+
"data-role": "inner-bar",
|
|
103
63
|
size: size,
|
|
104
|
-
length: barLength,
|
|
105
64
|
progress: progress,
|
|
106
65
|
error: error
|
|
107
66
|
})), !prefixLabels && renderValueLabels());
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ProgressTrackerProps } from "./progress-tracker.component";
|
|
2
2
|
declare const StyledProgressTracker: import("styled-components").StyledComponent<"div", any, Pick<ProgressTrackerProps, "length" | "margin" | "labelsPosition">, never>;
|
|
3
|
-
declare const StyledProgressBar: import("styled-components").StyledComponent<"span", any, Pick<ProgressTrackerProps, "error" | "progress"
|
|
3
|
+
declare const StyledProgressBar: import("styled-components").StyledComponent<"span", any, Pick<ProgressTrackerProps, "error" | "progress">, never>;
|
|
4
4
|
declare const StyledValue: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
5
5
|
declare const StyledDescription: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
6
6
|
declare const StyledValuesLabel: import("styled-components").StyledComponent<"span", any, Pick<ProgressTrackerProps, "labelWidth" | "size" | "labelsPosition">, never>;
|
|
7
|
-
declare const InnerBar: import("styled-components").StyledComponent<"span", any, Pick<ProgressTrackerProps, "error" | "progress" | "
|
|
7
|
+
declare const InnerBar: import("styled-components").StyledComponent<"span", any, Required<Pick<ProgressTrackerProps, "error" | "progress" | "size">>, never>;
|
|
8
8
|
export { StyledProgressBar, InnerBar, StyledProgressTracker, StyledValuesLabel, StyledValue, StyledDescription, };
|
|
@@ -55,7 +55,6 @@ const StyledProgressTracker = exports.StyledProgressTracker = _styledComponents.
|
|
|
55
55
|
`;
|
|
56
56
|
const StyledProgressBar = exports.StyledProgressBar = _styledComponents.default.span`
|
|
57
57
|
${({
|
|
58
|
-
size,
|
|
59
58
|
progress,
|
|
60
59
|
error,
|
|
61
60
|
theme
|
|
@@ -117,8 +116,7 @@ const StyledValuesLabel = exports.StyledValuesLabel = _styledComponents.default.
|
|
|
117
116
|
const InnerBar = exports.InnerBar = _styledComponents.default.span`
|
|
118
117
|
${({
|
|
119
118
|
progress,
|
|
120
|
-
size
|
|
121
|
-
length,
|
|
119
|
+
size,
|
|
122
120
|
error,
|
|
123
121
|
theme
|
|
124
122
|
}) => (0, _styledComponents.css)`
|
|
@@ -129,7 +127,7 @@ const InnerBar = exports.InnerBar = _styledComponents.default.span`
|
|
|
129
127
|
error
|
|
130
128
|
})};
|
|
131
129
|
border-radius: ${theme.roundedCornersOptOut ? "25px" : "var(--borderRadius400)"};
|
|
132
|
-
width:
|
|
130
|
+
width: ${progress}%;
|
|
133
131
|
min-width: 2px;
|
|
134
132
|
height: ${getHeight(size)};
|
|
135
133
|
`}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import TypeIcon from "../message/type-icon/type-icon.style";
|
|
2
|
+
import TypeIcon from "../message/__internal__/type-icon/type-icon.style";
|
|
3
3
|
import { MessageVariant } from "../message/message.component";
|
|
4
4
|
declare const StyledPortal: import("styled-components").StyledComponent<({ children, className, id, onReposition, inertOptOut, }: import("../portal/portal").PortalProps) => import("react").JSX.Element, any, {
|
|
5
5
|
align?: "left" | "right" | "center" | undefined;
|
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "TypeIcon", {
|
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
14
|
-
var _typeIcon = _interopRequireDefault(require("../message/type-icon/type-icon.style"));
|
|
14
|
+
var _typeIcon = _interopRequireDefault(require("../message/__internal__/type-icon/type-icon.style"));
|
|
15
15
|
var _iconButton = _interopRequireDefault(require("../icon-button/icon-button.style"));
|
|
16
16
|
var _portal = _interopRequireDefault(require("../portal/portal"));
|
|
17
17
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|