carbon-react 110.5.0 → 110.5.1
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/icon/icon.component.js +22 -9
- package/esm/components/message/index.d.ts +2 -1
- package/esm/components/message/message-content/message-content.component.d.ts +9 -0
- package/esm/components/message/message-content/message-content.component.js +4 -5
- package/esm/components/message/message-content/message-content.style.d.ts +2 -0
- package/esm/components/message/message-content/message-content.style.js +0 -3
- package/esm/components/message/message.component.d.ts +27 -0
- package/esm/components/message/message.component.js +169 -37
- package/esm/components/message/message.style.d.ts +8 -0
- package/esm/components/message/message.style.js +1 -8
- package/esm/components/message/type-icon/type-icon.component.d.ts +10 -0
- package/esm/components/message/type-icon/type-icon.component.js +4 -8
- package/esm/components/message/type-icon/type-icon.style.d.ts +9 -0
- package/esm/components/message/type-icon/type-icon.style.js +0 -10
- package/esm/components/sidebar/__internal__/sidebar-header/index.d.ts +1 -0
- package/esm/components/sidebar/__internal__/sidebar-header/sidebar-header.component.d.ts +9 -0
- package/esm/components/sidebar/__internal__/sidebar-header/sidebar-header.component.js +7 -18
- package/esm/components/sidebar/__internal__/sidebar-header/sidebar-header.style.d.ts +2 -0
- package/esm/components/sidebar/index.d.ts +2 -1
- package/esm/components/sidebar/index.js +1 -2
- package/esm/components/sidebar/sidebar.component.d.ts +44 -0
- package/esm/components/sidebar/sidebar.component.js +187 -48
- package/esm/components/sidebar/sidebar.config.d.ts +11 -0
- package/esm/components/sidebar/sidebar.style.d.ts +8 -0
- package/esm/components/step-sequence/index.d.ts +4 -2
- package/esm/components/step-sequence/step-sequence-item/index.d.ts +2 -0
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item.component.d.ts +19 -0
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item.component.js +26 -41
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item.style.d.ts +9 -0
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item.style.js +18 -2
- package/esm/components/step-sequence/step-sequence.component.d.ts +13 -0
- package/esm/components/step-sequence/step-sequence.component.js +170 -18
- package/esm/components/step-sequence/step-sequence.config.d.ts +2 -0
- package/esm/components/step-sequence/step-sequence.style.d.ts +4 -0
- package/esm/components/tabs/__internal__/tab-title/tab-title.component.d.ts +4 -0
- package/esm/components/tabs/__internal__/tab-title/tab-title.component.js +34 -4
- package/esm/components/tabs/__internal__/tab-title/tab-title.d.ts +6 -0
- package/esm/components/tabs/__internal__/tab-title/tab-title.style.d.ts +4 -0
- package/lib/components/icon/icon.component.js +22 -8
- package/lib/components/message/index.d.ts +2 -1
- package/lib/components/message/message-content/message-content.component.d.ts +9 -0
- package/lib/components/message/message-content/message-content.component.js +5 -6
- package/lib/components/message/message-content/message-content.style.d.ts +2 -0
- package/lib/components/message/message-content/message-content.style.js +0 -4
- package/lib/components/message/message.component.d.ts +27 -0
- package/lib/components/message/message.component.js +170 -40
- package/lib/components/message/message.style.d.ts +8 -0
- package/lib/components/message/message.style.js +1 -9
- package/lib/components/message/type-icon/type-icon.component.d.ts +10 -0
- package/lib/components/message/type-icon/type-icon.component.js +4 -8
- package/lib/components/message/type-icon/type-icon.style.d.ts +9 -0
- package/lib/components/message/type-icon/type-icon.style.js +0 -13
- package/lib/components/sidebar/__internal__/sidebar-header/index.d.ts +1 -0
- package/lib/components/sidebar/__internal__/sidebar-header/sidebar-header.component.d.ts +9 -0
- package/lib/components/sidebar/__internal__/sidebar-header/sidebar-header.component.js +7 -19
- package/lib/components/sidebar/__internal__/sidebar-header/sidebar-header.style.d.ts +2 -0
- package/lib/components/sidebar/index.d.ts +2 -1
- package/lib/components/sidebar/sidebar.component.d.ts +44 -0
- package/lib/components/sidebar/sidebar.component.js +187 -50
- package/lib/components/sidebar/sidebar.config.d.ts +11 -0
- package/lib/components/sidebar/sidebar.style.d.ts +8 -0
- package/lib/components/step-sequence/index.d.ts +4 -2
- package/lib/components/step-sequence/step-sequence-item/index.d.ts +2 -0
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item.component.d.ts +19 -0
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item.component.js +30 -48
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item.style.d.ts +9 -0
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item.style.js +22 -3
- package/lib/components/step-sequence/step-sequence.component.d.ts +13 -0
- package/lib/components/step-sequence/step-sequence.component.js +171 -21
- package/lib/components/step-sequence/step-sequence.config.d.ts +2 -0
- package/lib/components/step-sequence/step-sequence.style.d.ts +4 -0
- package/lib/components/tabs/__internal__/tab-title/tab-title.component.d.ts +4 -0
- package/lib/components/tabs/__internal__/tab-title/tab-title.component.js +38 -4
- package/lib/components/tabs/__internal__/tab-title/tab-title.d.ts +6 -0
- package/lib/components/tabs/__internal__/tab-title/tab-title.style.d.ts +4 -0
- package/package.json +1 -1
- package/esm/components/message/message.d.ts +0 -29
- package/esm/components/sidebar/__internal__/sidebar-header/__definition__.js +0 -13
- package/esm/components/sidebar/sidebar.d.ts +0 -57
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item-content.style.js +0 -5
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item-hidden-label.style.js +0 -9
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item-indicator.style.js +0 -9
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item.d.ts +0 -22
- package/esm/components/step-sequence/step-sequence.d.ts +0 -12
- package/lib/components/message/message.d.ts +0 -29
- package/lib/components/sidebar/__internal__/sidebar-header/__definition__.js +0 -25
- package/lib/components/sidebar/sidebar.d.ts +0 -57
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item-content.style.js +0 -16
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item-hidden-label.style.js +0 -20
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item-indicator.style.js +0 -20
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item.d.ts +0 -22
- package/lib/components/step-sequence/step-sequence.d.ts +0 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext } from "react";
|
|
1
|
+
import React, { useContext, useMemo } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import invariant from "invariant";
|
|
4
4
|
import Tooltip from "../tooltip";
|
|
@@ -7,6 +7,7 @@ import { TooltipContext } from "../../__internal__/tooltip-provider";
|
|
|
7
7
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
8
8
|
import StyledIcon from "./icon.style";
|
|
9
9
|
import { ICON_TOOLTIP_POSITIONS } from "./icon-config";
|
|
10
|
+
import { TabTitleContext } from "../tabs/__internal__/tab-title/tab-title.component";
|
|
10
11
|
const Icon = /*#__PURE__*/React.forwardRef(({
|
|
11
12
|
"aria-hidden": ariaHidden,
|
|
12
13
|
ariaLabel,
|
|
@@ -47,9 +48,12 @@ const Icon = /*#__PURE__*/React.forwardRef(({
|
|
|
47
48
|
disabled: disabledFromContext,
|
|
48
49
|
target
|
|
49
50
|
} = useContext(TooltipContext);
|
|
51
|
+
const {
|
|
52
|
+
isInTab
|
|
53
|
+
} = useContext(TabTitleContext);
|
|
50
54
|
/** Return Icon type with overrides */
|
|
51
55
|
|
|
52
|
-
const iconType = () => {
|
|
56
|
+
const iconType = useMemo(() => {
|
|
53
57
|
// switch tweaks icon names for actual icons in the set
|
|
54
58
|
switch (type) {
|
|
55
59
|
case "help":
|
|
@@ -71,10 +75,16 @@ const Icon = /*#__PURE__*/React.forwardRef(({
|
|
|
71
75
|
default:
|
|
72
76
|
return type;
|
|
73
77
|
}
|
|
74
|
-
};
|
|
75
|
-
|
|
78
|
+
}, [type]);
|
|
76
79
|
const isFocusable = focusableFromContext !== undefined ? focusableFromContext : focusable;
|
|
77
80
|
const hasTooltip = !disabled && !disabledFromContext && !!tooltipMessage && isFocusable;
|
|
81
|
+
const computedTabIndex = useMemo(() => {
|
|
82
|
+
if (isInTab) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return hasTooltip && tabIndex === undefined ? 0 : tabIndex;
|
|
87
|
+
}, [isInTab, hasTooltip, tabIndex]);
|
|
78
88
|
const styledIconProps = {
|
|
79
89
|
"aria-hidden": ariaHidden,
|
|
80
90
|
"aria-label": ariaLabel,
|
|
@@ -83,7 +93,7 @@ const Icon = /*#__PURE__*/React.forwardRef(({
|
|
|
83
93
|
bgShape,
|
|
84
94
|
className: className || undefined,
|
|
85
95
|
color,
|
|
86
|
-
"data-element": iconType
|
|
96
|
+
"data-element": iconType,
|
|
87
97
|
disabled: disabledFromContext || disabled,
|
|
88
98
|
fontSize,
|
|
89
99
|
hasTooltip,
|
|
@@ -92,15 +102,18 @@ const Icon = /*#__PURE__*/React.forwardRef(({
|
|
|
92
102
|
key: "icon",
|
|
93
103
|
ref,
|
|
94
104
|
role,
|
|
95
|
-
tabIndex:
|
|
96
|
-
type: iconType
|
|
105
|
+
tabIndex: computedTabIndex,
|
|
106
|
+
type: iconType,
|
|
97
107
|
...tagComponent("icon", rest),
|
|
98
108
|
...filterStyledSystemMarginProps(rest)
|
|
99
109
|
};
|
|
100
110
|
|
|
111
|
+
const shouldShowTooltip = () => {
|
|
112
|
+
return tooltipVisibleFromContext !== undefined ? tooltipVisibleFromContext : tooltipVisible;
|
|
113
|
+
};
|
|
114
|
+
|
|
101
115
|
if (tooltipMessage) {
|
|
102
|
-
const
|
|
103
|
-
const visible = disabled ? undefined : showTooltip;
|
|
116
|
+
const visible = disabled ? undefined : shouldShowTooltip();
|
|
104
117
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
105
118
|
message: tooltipMessage,
|
|
106
119
|
position: tooltipPositionFromContext || tooltipPosition,
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from "./message";
|
|
1
|
+
export { default } from "./message.component";
|
|
2
|
+
export type { MessageProps } from "./message.component";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface MessageContentProps {
|
|
3
|
+
/** set message title */
|
|
4
|
+
title?: React.ReactNode;
|
|
5
|
+
/** set content to component */
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const MessageContent: ({ title, children }: MessageContentProps) => JSX.Element;
|
|
9
|
+
export default MessageContent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import Content from "../../content
|
|
3
|
+
import Content from "../../content";
|
|
4
4
|
import MessageContentStyle from "./message-content.style";
|
|
5
5
|
|
|
6
6
|
const MessageContent = ({
|
|
@@ -8,13 +8,12 @@ const MessageContent = ({
|
|
|
8
8
|
children
|
|
9
9
|
}) => {
|
|
10
10
|
return /*#__PURE__*/React.createElement(MessageContentStyle, null, /*#__PURE__*/React.createElement(Content, {
|
|
11
|
-
title: title
|
|
12
|
-
className: "message-content"
|
|
11
|
+
title: title
|
|
13
12
|
}, children));
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
MessageContent.propTypes = {
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
"children": PropTypes.node,
|
|
17
|
+
"title": PropTypes.node
|
|
19
18
|
};
|
|
20
19
|
export default MessageContent;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
|
-
import { margin } from "styled-system";
|
|
3
2
|
const MessageContentStyle = styled.div`
|
|
4
3
|
padding: 15px 50px 15px 20px;
|
|
5
4
|
white-space: pre-wrap;
|
|
@@ -12,7 +11,5 @@ const MessageContentStyle = styled.div`
|
|
|
12
11
|
.carbon-content__body {
|
|
13
12
|
margin-top: 0px;
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
${margin}
|
|
17
14
|
`;
|
|
18
15
|
export default MessageContentStyle;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
export declare type MessageVariant = "error" | "info" | "success" | "warning";
|
|
4
|
+
export interface MessageProps extends MarginProps {
|
|
5
|
+
/** set content to component */
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
/** set custom class to component */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** set custom aria label for message close button */
|
|
10
|
+
closeButtonAriaLabel?: string;
|
|
11
|
+
/** set custom id to component root */
|
|
12
|
+
id?: string;
|
|
13
|
+
/** function runs when user click dismiss button */
|
|
14
|
+
onDismiss?: (e: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
|
|
15
|
+
/** show message component */
|
|
16
|
+
open?: boolean;
|
|
17
|
+
/** determines if the close icon is shown */
|
|
18
|
+
showCloseIcon?: boolean;
|
|
19
|
+
/** set message title */
|
|
20
|
+
title?: React.ReactNode;
|
|
21
|
+
/** set background to be invisible */
|
|
22
|
+
transparent?: boolean;
|
|
23
|
+
/** set type of message based on new DLS standard */
|
|
24
|
+
variant?: MessageVariant;
|
|
25
|
+
}
|
|
26
|
+
export declare const Message: ({ open, transparent, title, variant, children, onDismiss, id, className, closeButtonAriaLabel, showCloseIcon, ...props }: MessageProps) => JSX.Element | null;
|
|
27
|
+
export default Message;
|
|
@@ -2,7 +2,6 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
-
import styledSystemPropTypes from "@styled-system/prop-types";
|
|
6
5
|
import MessageStyle from "./message.style";
|
|
7
6
|
import TypeIcon from "./type-icon/type-icon.component";
|
|
8
7
|
import MessageContent from "./message-content/message-content.component";
|
|
@@ -11,7 +10,6 @@ import Icon from "../icon";
|
|
|
11
10
|
import IconButton from "../icon-button";
|
|
12
11
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
13
12
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
14
|
-
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
15
13
|
|
|
16
14
|
const Message = ({
|
|
17
15
|
open = true,
|
|
@@ -34,14 +32,13 @@ const Message = ({
|
|
|
34
32
|
return /*#__PURE__*/React.createElement(IconButton, {
|
|
35
33
|
"data-element": "close",
|
|
36
34
|
"aria-label": closeButtonAriaLabel || l.message.closeButtonAriaLabel(),
|
|
37
|
-
onAction: onDismiss
|
|
38
|
-
variant: variant
|
|
35
|
+
onAction: onDismiss
|
|
39
36
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
40
37
|
type: "close"
|
|
41
38
|
}));
|
|
42
39
|
};
|
|
43
40
|
|
|
44
|
-
return open
|
|
41
|
+
return open ? /*#__PURE__*/React.createElement(MessageStyle, _extends({}, tagComponent("Message", props), {
|
|
45
42
|
className: className,
|
|
46
43
|
transparent: transparent,
|
|
47
44
|
variant: variant,
|
|
@@ -52,39 +49,174 @@ const Message = ({
|
|
|
52
49
|
transparent: transparent
|
|
53
50
|
}), /*#__PURE__*/React.createElement(MessageContent, {
|
|
54
51
|
title: title
|
|
55
|
-
}, children), renderCloseIcon());
|
|
52
|
+
}, children), renderCloseIcon()) : null;
|
|
56
53
|
};
|
|
57
54
|
|
|
58
|
-
Message.propTypes = {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
55
|
+
Message.propTypes = {
|
|
56
|
+
"children": PropTypes.node,
|
|
57
|
+
"className": PropTypes.string,
|
|
58
|
+
"closeButtonAriaLabel": PropTypes.string,
|
|
59
|
+
"id": PropTypes.string,
|
|
60
|
+
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
61
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
62
|
+
"description": PropTypes.string,
|
|
63
|
+
"toString": PropTypes.func.isRequired,
|
|
64
|
+
"valueOf": PropTypes.func.isRequired
|
|
65
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
66
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
67
|
+
"description": PropTypes.string,
|
|
68
|
+
"toString": PropTypes.func.isRequired,
|
|
69
|
+
"valueOf": PropTypes.func.isRequired
|
|
70
|
+
}), PropTypes.string]),
|
|
71
|
+
"margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
72
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
73
|
+
"description": PropTypes.string,
|
|
74
|
+
"toString": PropTypes.func.isRequired,
|
|
75
|
+
"valueOf": PropTypes.func.isRequired
|
|
76
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
77
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
78
|
+
"description": PropTypes.string,
|
|
79
|
+
"toString": PropTypes.func.isRequired,
|
|
80
|
+
"valueOf": PropTypes.func.isRequired
|
|
81
|
+
}), PropTypes.string]),
|
|
82
|
+
"marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
83
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
84
|
+
"description": PropTypes.string,
|
|
85
|
+
"toString": PropTypes.func.isRequired,
|
|
86
|
+
"valueOf": PropTypes.func.isRequired
|
|
87
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
88
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
89
|
+
"description": PropTypes.string,
|
|
90
|
+
"toString": PropTypes.func.isRequired,
|
|
91
|
+
"valueOf": PropTypes.func.isRequired
|
|
92
|
+
}), PropTypes.string]),
|
|
93
|
+
"marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
94
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
95
|
+
"description": PropTypes.string,
|
|
96
|
+
"toString": PropTypes.func.isRequired,
|
|
97
|
+
"valueOf": PropTypes.func.isRequired
|
|
98
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
99
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
100
|
+
"description": PropTypes.string,
|
|
101
|
+
"toString": PropTypes.func.isRequired,
|
|
102
|
+
"valueOf": PropTypes.func.isRequired
|
|
103
|
+
}), PropTypes.string]),
|
|
104
|
+
"marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
105
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
106
|
+
"description": PropTypes.string,
|
|
107
|
+
"toString": PropTypes.func.isRequired,
|
|
108
|
+
"valueOf": PropTypes.func.isRequired
|
|
109
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
110
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
111
|
+
"description": PropTypes.string,
|
|
112
|
+
"toString": PropTypes.func.isRequired,
|
|
113
|
+
"valueOf": PropTypes.func.isRequired
|
|
114
|
+
}), PropTypes.string]),
|
|
115
|
+
"marginTop": 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
|
+
"marginX": 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
|
+
"marginY": 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
|
+
"mb": 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
|
+
"ml": 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
|
+
"mr": 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
|
+
"mt": 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
|
+
"mx": 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
|
+
"my": 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
|
+
"onDismiss": PropTypes.func,
|
|
215
|
+
"open": PropTypes.bool,
|
|
216
|
+
"showCloseIcon": PropTypes.bool,
|
|
217
|
+
"title": PropTypes.node,
|
|
218
|
+
"transparent": PropTypes.bool,
|
|
219
|
+
"variant": PropTypes.oneOf(["error", "info", "success", "warning"])
|
|
89
220
|
};
|
|
221
|
+
export { Message };
|
|
90
222
|
export default Message;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MarginProps } from "styled-system";
|
|
2
|
+
import { MessageVariant } from "./message.component";
|
|
3
|
+
declare type MessageStyleProps = {
|
|
4
|
+
variant: MessageVariant;
|
|
5
|
+
transparent?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const MessageStyle: import("styled-components").StyledComponent<"div", any, MessageStyleProps & MarginProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>, never>;
|
|
8
|
+
export default MessageStyle;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import { margin } from "styled-system";
|
|
4
3
|
import BaseTheme from "../../style/themes/base";
|
|
5
4
|
import StyledIconButton from "../icon-button/icon-button.style";
|
|
@@ -37,12 +36,6 @@ const MessageStyle = styled.div`
|
|
|
37
36
|
${margin}
|
|
38
37
|
`;
|
|
39
38
|
MessageStyle.defaultProps = {
|
|
40
|
-
|
|
41
|
-
theme: BaseTheme,
|
|
42
|
-
transparent: false
|
|
43
|
-
};
|
|
44
|
-
MessageStyle.propTypes = {
|
|
45
|
-
variant: PropTypes.string,
|
|
46
|
-
transparent: PropTypes.bool
|
|
39
|
+
theme: BaseTheme
|
|
47
40
|
};
|
|
48
41
|
export default MessageStyle;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MessageVariant } from "../message.component";
|
|
3
|
+
export interface TypeIconProps {
|
|
4
|
+
/** set background to be invisible */
|
|
5
|
+
transparent?: boolean;
|
|
6
|
+
/** set type of message based on new DLS standard */
|
|
7
|
+
variant?: MessageVariant;
|
|
8
|
+
}
|
|
9
|
+
declare const TypeIcon: ({ variant, transparent }: TypeIconProps) => JSX.Element;
|
|
10
|
+
export default TypeIcon;
|
|
@@ -4,8 +4,8 @@ import TypeIconStyle from "./type-icon.style";
|
|
|
4
4
|
import Icon from "../../icon";
|
|
5
5
|
|
|
6
6
|
const TypeIcon = ({
|
|
7
|
-
variant,
|
|
8
|
-
transparent
|
|
7
|
+
variant = "info",
|
|
8
|
+
transparent = false
|
|
9
9
|
}) => {
|
|
10
10
|
return /*#__PURE__*/React.createElement(TypeIconStyle, {
|
|
11
11
|
variant: variant,
|
|
@@ -15,12 +15,8 @@ const TypeIcon = ({
|
|
|
15
15
|
}));
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
TypeIcon.defaultProps = {
|
|
19
|
-
variant: "info",
|
|
20
|
-
transparent: false
|
|
21
|
-
};
|
|
22
18
|
TypeIcon.propTypes = {
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
"transparent": PropTypes.bool,
|
|
20
|
+
"variant": PropTypes.oneOf(["error", "info", "success", "warning"])
|
|
25
21
|
};
|
|
26
22
|
export default TypeIcon;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MessageVariant } from "../message.component";
|
|
2
|
+
declare type TypeIconStyleProps = {
|
|
3
|
+
/** set background to be invisible */
|
|
4
|
+
transparent?: boolean;
|
|
5
|
+
/** set type of message based on new DLS standard */
|
|
6
|
+
variant: MessageVariant;
|
|
7
|
+
};
|
|
8
|
+
declare const TypeIconStyle: import("styled-components").StyledComponent<"div", any, TypeIconStyleProps, never>;
|
|
9
|
+
export default TypeIconStyle;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
const messageVariants = {
|
|
4
3
|
error: "var(--colorsSemanticNegative500)",
|
|
5
4
|
info: "var(--colorsSemanticNeutral500)",
|
|
@@ -34,13 +33,4 @@ const TypeIconStyle = styled.div`
|
|
|
34
33
|
}
|
|
35
34
|
`}
|
|
36
35
|
`;
|
|
37
|
-
TypeIconStyle.defaultProps = {
|
|
38
|
-
variant: "info",
|
|
39
|
-
transparent: false
|
|
40
|
-
};
|
|
41
|
-
TypeIconStyle.propTypes = {
|
|
42
|
-
variant: PropTypes.oneOf(["error", "info", "success", "warning"]),
|
|
43
|
-
border: PropTypes.bool,
|
|
44
|
-
transparent: PropTypes.bool
|
|
45
|
-
};
|
|
46
36
|
export default TypeIconStyle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./sidebar-header.component";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface SidebarHeaderProps {
|
|
3
|
+
/** This component supports children. */
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
/** A custom id. */
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
declare const SidebarHeader: ({ children, id }: SidebarHeaderProps) => JSX.Element;
|
|
9
|
+
export default SidebarHeader;
|
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || 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
|
-
|
|
3
1
|
import React from "react";
|
|
4
2
|
import PropTypes from "prop-types";
|
|
5
|
-
import tagComponent from "../../../../__internal__/utils/helpers/tags/tags";
|
|
6
3
|
import SidebarHeaderStyle from "./sidebar-header.style";
|
|
7
4
|
|
|
8
5
|
const SidebarHeader = ({
|
|
9
|
-
className,
|
|
10
6
|
children,
|
|
11
|
-
id
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}, tagComponent("sidebar-header", props)), children);
|
|
7
|
+
id
|
|
8
|
+
}) => /*#__PURE__*/React.createElement(SidebarHeaderStyle, {
|
|
9
|
+
id: id,
|
|
10
|
+
"data-component": "sidebar-header"
|
|
11
|
+
}, children);
|
|
17
12
|
|
|
18
13
|
SidebarHeader.propTypes = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/** A custom class name. */
|
|
23
|
-
className: PropTypes.string,
|
|
24
|
-
|
|
25
|
-
/** A custom id. */
|
|
26
|
-
id: PropTypes.string
|
|
14
|
+
"children": PropTypes.node,
|
|
15
|
+
"id": PropTypes.string.isRequired
|
|
27
16
|
};
|
|
28
17
|
export default SidebarHeader;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default, SidebarContext } from "./sidebar";
|
|
1
|
+
export { default, SidebarContext } from "./sidebar.component";
|
|
2
|
+
export type { SidebarProps } from "./sidebar.component";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { default } from "./sidebar.component";
|
|
2
|
-
export { SidebarContext } from "./sidebar.component";
|
|
1
|
+
export { default, SidebarContext } from "./sidebar.component";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PaddingProps } from "styled-system";
|
|
3
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
|
|
4
|
+
export interface SidebarContextProps {
|
|
5
|
+
isInSidebar?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const SidebarContext: React.Context<SidebarContextProps>;
|
|
8
|
+
export interface SidebarProps extends PaddingProps, TagProps {
|
|
9
|
+
/** Prop to specify the aria-describedby property of the component */
|
|
10
|
+
"aria-describedby"?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Prop to specify the aria-label of the component.
|
|
13
|
+
* To be used only when the title prop is not defined, and the component is not labelled by any internal element.
|
|
14
|
+
*/
|
|
15
|
+
"aria-label"?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Prop to specify the aria-labeledby property of the component
|
|
18
|
+
* To be used when the title prop is a custom React Node,
|
|
19
|
+
* or the component is labelled by an internal element other than the title.
|
|
20
|
+
*/
|
|
21
|
+
"aria-labelledby"?: string;
|
|
22
|
+
/** Modal content */
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
/** Determines if the Esc Key closes the modal */
|
|
25
|
+
disableEscKey?: boolean;
|
|
26
|
+
/** Set this prop to false to hide the translucent background when the dialog is open. */
|
|
27
|
+
enableBackgroundUI?: boolean;
|
|
28
|
+
/** Node that will be used as sidebar header. */
|
|
29
|
+
header?: React.ReactNode;
|
|
30
|
+
/** A custom close event handler */
|
|
31
|
+
onCancel?: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement>) => void;
|
|
32
|
+
/** Sets the open state of the modal */
|
|
33
|
+
open: boolean;
|
|
34
|
+
/** Sets the position of sidebar, either left or right. */
|
|
35
|
+
position?: "left" | "right";
|
|
36
|
+
/** The ARIA role to be applied to the component container */
|
|
37
|
+
role?: string;
|
|
38
|
+
/** Sets the size of the sidebar when open. */
|
|
39
|
+
size?: "extra-small" | "small" | "medium-small" | "medium" | "medium-large" | "large" | "extra-large";
|
|
40
|
+
/** an optional array of refs to containers whose content should also be reachable by tabbing from the sidebar */
|
|
41
|
+
focusableContainers?: React.MutableRefObject<HTMLElement>[];
|
|
42
|
+
}
|
|
43
|
+
export declare const Sidebar: React.ForwardRefExoticComponent<Pick<SidebarProps, keyof SidebarProps> & React.RefAttributes<HTMLDivElement>>;
|
|
44
|
+
export default Sidebar;
|