carbon-react 134.2.0 → 135.1.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/badge/badge.component.js +3 -2
- package/esm/components/multi-action-button/multi-action-button.component.d.ts +1 -1
- package/esm/components/multi-action-button/multi-action-button.component.js +2 -1
- package/esm/components/multi-action-button/multi-action-button.config.d.ts +1 -0
- package/esm/components/multi-action-button/multi-action-button.config.js +2 -1
- package/esm/components/portal/portal.js +1 -0
- package/esm/components/split-button/split-button.component.d.ts +5 -3
- package/esm/components/split-button/split-button.component.js +2 -1
- package/esm/components/split-button/split-button.config.d.ts +1 -0
- package/esm/components/split-button/split-button.config.js +2 -1
- package/esm/components/toast/toast.component.d.ts +0 -2
- package/esm/components/toast/toast.component.js +7 -15
- package/esm/components/toast/toast.style.d.ts +0 -3
- package/esm/components/toast/toast.style.js +4 -21
- package/lib/components/badge/badge.component.js +3 -2
- package/lib/components/multi-action-button/multi-action-button.component.d.ts +1 -1
- package/lib/components/multi-action-button/multi-action-button.component.js +2 -1
- package/lib/components/multi-action-button/multi-action-button.config.d.ts +1 -0
- package/lib/components/multi-action-button/multi-action-button.config.js +3 -2
- package/lib/components/portal/portal.js +1 -0
- package/lib/components/split-button/split-button.component.d.ts +5 -3
- package/lib/components/split-button/split-button.component.js +2 -1
- package/lib/components/split-button/split-button.config.d.ts +1 -0
- package/lib/components/split-button/split-button.config.js +3 -2
- package/lib/components/toast/toast.component.d.ts +0 -2
- package/lib/components/toast/toast.component.js +7 -15
- package/lib/components/toast/toast.style.d.ts +0 -3
- package/lib/components/toast/toast.style.js +4 -21
- package/package.json +1 -1
- package/esm/components/carousel/carousel.component.d.ts +0 -25
- package/esm/components/carousel/carousel.component.js +0 -125
- package/esm/components/carousel/carousel.style.d.ts +0 -20
- package/esm/components/carousel/carousel.style.js +0 -154
- package/esm/components/carousel/index.d.ts +0 -4
- package/esm/components/carousel/index.js +0 -2
- package/esm/components/carousel/slide/index.d.ts +0 -2
- package/esm/components/carousel/slide/index.js +0 -1
- package/esm/components/carousel/slide/slide.component.d.ts +0 -12
- package/esm/components/carousel/slide/slide.component.js +0 -9
- package/esm/components/carousel/slide/slide.style.d.ts +0 -2
- package/esm/components/carousel/slide/slide.style.js +0 -32
- package/esm/components/carousel/slide.config.d.ts +0 -3
- package/esm/components/carousel/slide.config.js +0 -80
- package/esm/components/step-sequence/index.d.ts +0 -4
- package/esm/components/step-sequence/index.js +0 -2
- package/esm/components/step-sequence/step-sequence-item/index.d.ts +0 -2
- package/esm/components/step-sequence/step-sequence-item/index.js +0 -1
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item.component.d.ts +0 -19
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item.component.js +0 -43
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item.style.d.ts +0 -6
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item.style.js +0 -96
- package/esm/components/step-sequence/step-sequence.component.d.ts +0 -13
- package/esm/components/step-sequence/step-sequence.component.js +0 -29
- package/esm/components/step-sequence/step-sequence.config.d.ts +0 -2
- package/esm/components/step-sequence/step-sequence.config.js +0 -2
- package/esm/components/step-sequence/step-sequence.style.d.ts +0 -4
- package/esm/components/step-sequence/step-sequence.style.js +0 -21
- package/lib/components/carousel/carousel.component.d.ts +0 -25
- package/lib/components/carousel/carousel.component.js +0 -135
- package/lib/components/carousel/carousel.style.d.ts +0 -20
- package/lib/components/carousel/carousel.style.js +0 -162
- package/lib/components/carousel/index.d.ts +0 -4
- package/lib/components/carousel/index.js +0 -20
- package/lib/components/carousel/package.json +0 -6
- package/lib/components/carousel/slide/index.d.ts +0 -2
- package/lib/components/carousel/slide/index.js +0 -13
- package/lib/components/carousel/slide/package.json +0 -6
- package/lib/components/carousel/slide/slide.component.d.ts +0 -12
- package/lib/components/carousel/slide/slide.component.js +0 -16
- package/lib/components/carousel/slide/slide.style.d.ts +0 -2
- package/lib/components/carousel/slide/slide.style.js +0 -39
- package/lib/components/carousel/slide.config.d.ts +0 -3
- package/lib/components/carousel/slide.config.js +0 -85
- package/lib/components/step-sequence/index.d.ts +0 -4
- package/lib/components/step-sequence/index.js +0 -20
- package/lib/components/step-sequence/package.json +0 -6
- package/lib/components/step-sequence/step-sequence-item/index.d.ts +0 -2
- package/lib/components/step-sequence/step-sequence-item/index.js +0 -13
- package/lib/components/step-sequence/step-sequence-item/package.json +0 -6
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item.component.d.ts +0 -19
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item.component.js +0 -53
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item.style.d.ts +0 -6
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item.style.js +0 -105
- package/lib/components/step-sequence/step-sequence.component.d.ts +0 -13
- package/lib/components/step-sequence/step-sequence.component.js +0 -37
- package/lib/components/step-sequence/step-sequence.config.d.ts +0 -2
- package/lib/components/step-sequence/step-sequence.config.js +0 -8
- package/lib/components/step-sequence/step-sequence.style.d.ts +0 -4
- package/lib/components/step-sequence/step-sequence.style.js +0 -29
|
@@ -9,8 +9,8 @@ export const Badge = ({
|
|
|
9
9
|
color = "--colorsActionMajor500",
|
|
10
10
|
onClick
|
|
11
11
|
}) => {
|
|
12
|
-
const shouldDisplayCounter = counter > 0;
|
|
13
|
-
const counterToDisplay = counter > 99 ? 99 : counter;
|
|
12
|
+
const shouldDisplayCounter = +counter > 0;
|
|
13
|
+
const counterToDisplay = +counter > 99 ? 99 : counter;
|
|
14
14
|
const renderCorrectBadge = () => {
|
|
15
15
|
const props = onClick ? {
|
|
16
16
|
buttonType: "secondary",
|
|
@@ -20,6 +20,7 @@ export const Badge = ({
|
|
|
20
20
|
};
|
|
21
21
|
if (shouldDisplayCounter) {
|
|
22
22
|
return /*#__PURE__*/React.createElement(StyledBadge, _extends({
|
|
23
|
+
"data-role": "badge",
|
|
23
24
|
"data-component": "badge",
|
|
24
25
|
color: color
|
|
25
26
|
}, props), onClick && /*#__PURE__*/React.createElement(StyledCrossIcon, {
|
|
@@ -7,5 +7,5 @@ export interface MultiActionButtonProps extends WidthProps, Omit<SplitButtonProp
|
|
|
7
7
|
/** Second text child, renders under main text, only when size is "large" */
|
|
8
8
|
subtext?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare const MultiActionButton: ({ align, disabled, buttonType, size, children, text, subtext, width, onClick, "data-element": dataElement, "data-role": dataRole, ...rest }: MultiActionButtonProps) => React.JSX.Element;
|
|
10
|
+
export declare const MultiActionButton: ({ align, position, disabled, buttonType, size, children, text, subtext, width, onClick, "data-element": dataElement, "data-role": dataRole, ...rest }: MultiActionButtonProps) => React.JSX.Element;
|
|
11
11
|
export default MultiActionButton;
|
|
@@ -11,6 +11,7 @@ import { filterStyledSystemMarginProps, filterOutStyledSystemSpacingProps } from
|
|
|
11
11
|
import useChildButtons from "../../hooks/__internal__/useChildButtons";
|
|
12
12
|
export const MultiActionButton = ({
|
|
13
13
|
align = "left",
|
|
14
|
+
position = "left",
|
|
14
15
|
disabled,
|
|
15
16
|
buttonType,
|
|
16
17
|
size,
|
|
@@ -53,7 +54,7 @@ export const MultiActionButton = ({
|
|
|
53
54
|
...filterOutStyledSystemSpacingProps(rest)
|
|
54
55
|
};
|
|
55
56
|
const renderAdditionalButtons = () => /*#__PURE__*/React.createElement(Popover, {
|
|
56
|
-
placement: "bottom-end",
|
|
57
|
+
placement: position === "left" ? "bottom-start" : /* istanbul ignore next */"bottom-end",
|
|
57
58
|
reference: buttonNode,
|
|
58
59
|
middleware: [offset(6), flip({
|
|
59
60
|
fallbackStrategy: "initialPlacement"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export const MULTI_ACTION_BUTTON_ALIGNMENTS = ["left", "right"];
|
|
2
2
|
export const MULTI_ACTION_BUTTON_SIZES = ["small", "medium", "large"];
|
|
3
|
-
export const MULTI_ACTION_BUTTON_THEMES = ["primary", "secondary", "tertiary"];
|
|
3
|
+
export const MULTI_ACTION_BUTTON_THEMES = ["primary", "secondary", "tertiary"];
|
|
4
|
+
export const MULTI_ACTION_BUTTON_POSITIONS = ["left", "right"];
|
|
@@ -60,6 +60,7 @@ export const Portal = ({
|
|
|
60
60
|
node = document.createElement("div");
|
|
61
61
|
node.classList.add(portalClassName);
|
|
62
62
|
node.setAttribute("data-portal-exit", uniqueId);
|
|
63
|
+
node.setAttribute("data-role", "carbon-portal-exit");
|
|
63
64
|
if (id !== undefined) {
|
|
64
65
|
node.setAttribute("id", id);
|
|
65
66
|
}
|
|
@@ -20,12 +20,14 @@ export interface SplitButtonProps extends React.ButtonHTMLAttributes<HTMLButtonE
|
|
|
20
20
|
iconPosition?: "before" | "after";
|
|
21
21
|
/** Defines an Icon type within the button */
|
|
22
22
|
iconType?: IconType;
|
|
23
|
-
/** The size of the buttons
|
|
23
|
+
/** The size of the buttons. */
|
|
24
24
|
size?: "small" | "medium" | "large";
|
|
25
25
|
/** Second text child, renders under main text, only when size is "large" */
|
|
26
26
|
subtext?: string;
|
|
27
|
-
/** The text to be displayed in the
|
|
27
|
+
/** The text to be displayed in the main button. */
|
|
28
28
|
text: string;
|
|
29
|
+
/** Sets rendering position of menu */
|
|
30
|
+
position?: "left" | "right";
|
|
29
31
|
}
|
|
30
|
-
export declare const SplitButton: ({ align, buttonType, children, disabled, iconPosition, iconType, onClick, size, subtext, text, "data-element": dataElement, "data-role": dataRole, "aria-label": ariaLabel, ...rest }: SplitButtonProps) => React.JSX.Element;
|
|
32
|
+
export declare const SplitButton: ({ align, position, buttonType, children, disabled, iconPosition, iconType, onClick, size, subtext, text, "data-element": dataElement, "data-role": dataRole, "aria-label": ariaLabel, ...rest }: SplitButtonProps) => React.JSX.Element;
|
|
31
33
|
export default SplitButton;
|
|
@@ -19,6 +19,7 @@ import useLocale from "../../hooks/__internal__/useLocale";
|
|
|
19
19
|
const CONTENT_WIDTH_RATIO = 0.75;
|
|
20
20
|
export const SplitButton = ({
|
|
21
21
|
align = "left",
|
|
22
|
+
position = "right",
|
|
22
23
|
buttonType = "secondary",
|
|
23
24
|
children,
|
|
24
25
|
disabled = false,
|
|
@@ -105,7 +106,7 @@ export const SplitButton = ({
|
|
|
105
106
|
function renderAdditionalButtons() {
|
|
106
107
|
if (!showAdditionalButtons) return null;
|
|
107
108
|
return /*#__PURE__*/React.createElement(Popover, {
|
|
108
|
-
placement: "bottom-end",
|
|
109
|
+
placement: position === "left" ? /* istanbul ignore next */"bottom-start" : "bottom-end",
|
|
109
110
|
reference: buttonNode,
|
|
110
111
|
middleware: [offset(6), flip({
|
|
111
112
|
fallbackStrategy: "initialPlacement"
|
|
@@ -2,3 +2,4 @@ export declare const SPLIT_BUTTON_ICON_POSITIONS: string[];
|
|
|
2
2
|
export declare const SPLIT_BUTTON_THEMES: string[];
|
|
3
3
|
export declare const SPLIT_BUTTON_SIZES: string[];
|
|
4
4
|
export declare const SPLIT_BUTTON_ALIGNMENTS: string[];
|
|
5
|
+
export declare const SPLIT_BUTTON_POSITIONS: string[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const SPLIT_BUTTON_ICON_POSITIONS = ["before", "after"];
|
|
2
2
|
export const SPLIT_BUTTON_THEMES = ["primary", "secondary"];
|
|
3
3
|
export const SPLIT_BUTTON_SIZES = ["small", "medium", "large"];
|
|
4
|
-
export const SPLIT_BUTTON_ALIGNMENTS = ["left", "right"];
|
|
4
|
+
export const SPLIT_BUTTON_ALIGNMENTS = ["left", "right"];
|
|
5
|
+
export const SPLIT_BUTTON_POSITIONS = ["left", "right"];
|
|
@@ -26,8 +26,6 @@ export interface ToastProps {
|
|
|
26
26
|
closeButtonDataProps?: Pick<TagProps, "data-role" | "data-element">;
|
|
27
27
|
/** Time for Toast to remain on screen */
|
|
28
28
|
timeout?: string | number;
|
|
29
|
-
/** Centers the Toast on the screen */
|
|
30
|
-
isCenter?: boolean;
|
|
31
29
|
/** Target Portal ID where the Toast will render */
|
|
32
30
|
targetPortalId?: string;
|
|
33
31
|
/** Maximum toast width */
|
|
@@ -9,15 +9,12 @@ import IconButton from "../icon-button";
|
|
|
9
9
|
import Events from "../../__internal__/utils/helpers/events";
|
|
10
10
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
11
11
|
import useModalManager from "../../hooks/__internal__/useModalManager";
|
|
12
|
-
import Logger from "../../__internal__/utils/logger";
|
|
13
|
-
let isDeprecationWarningTriggered = false;
|
|
14
12
|
const Toast = /*#__PURE__*/React.forwardRef(({
|
|
15
|
-
align,
|
|
13
|
+
align = "center",
|
|
16
14
|
alignY,
|
|
17
15
|
children,
|
|
18
16
|
className,
|
|
19
17
|
id,
|
|
20
|
-
isCenter = true,
|
|
21
18
|
maxWidth,
|
|
22
19
|
onDismiss,
|
|
23
20
|
open = true,
|
|
@@ -41,10 +38,6 @@ const Toast = /*#__PURE__*/React.forwardRef(({
|
|
|
41
38
|
if (ref && typeof ref === "object" && "current" in ref) {
|
|
42
39
|
refToPass = ref;
|
|
43
40
|
}
|
|
44
|
-
if (isCenter !== undefined && !isDeprecationWarningTriggered) {
|
|
45
|
-
isDeprecationWarningTriggered = true;
|
|
46
|
-
Logger.deprecate(`isCenter prop in ${Toast.displayName} is being deprecated in favour of the align prop.`);
|
|
47
|
-
}
|
|
48
41
|
const dismissToast = useCallback(ev => {
|
|
49
42
|
if (onDismiss && Events.isEscKey(ev)) {
|
|
50
43
|
ev.stopImmediatePropagation();
|
|
@@ -131,7 +124,6 @@ const Toast = /*#__PURE__*/React.forwardRef(({
|
|
|
131
124
|
isNotification: isNotification,
|
|
132
125
|
className: className
|
|
133
126
|
}, tagComponent(restProps["data-component"] || "toast", restProps), {
|
|
134
|
-
isCenter: isCenter,
|
|
135
127
|
variant: toastVariant,
|
|
136
128
|
id: id,
|
|
137
129
|
maxWidth: maxWidth,
|
|
@@ -140,25 +132,26 @@ const Toast = /*#__PURE__*/React.forwardRef(({
|
|
|
140
132
|
tabIndex,
|
|
141
133
|
onBlur: () => setTabIndex(undefined)
|
|
142
134
|
}), !isNotice && /*#__PURE__*/React.createElement(TypeIcon, {
|
|
143
|
-
variant: isNotification ? "info" : variant
|
|
135
|
+
variant: isNotification ? "info" : variant,
|
|
136
|
+
"data-role": "toast-type-icon"
|
|
144
137
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
145
138
|
type: toastIcon
|
|
146
139
|
})), /*#__PURE__*/React.createElement(StyledToastContent, {
|
|
147
140
|
isNotice: isNotice,
|
|
148
|
-
isDismiss: !!onDismiss
|
|
141
|
+
isDismiss: !!onDismiss,
|
|
142
|
+
"data-role": "toast-content"
|
|
149
143
|
}, children), renderCloseIcon()));
|
|
150
144
|
}
|
|
151
145
|
return /*#__PURE__*/React.createElement(StyledPortal, {
|
|
152
146
|
id: targetPortalId,
|
|
153
147
|
align: align,
|
|
154
148
|
alignY: alignY,
|
|
155
|
-
isCenter: isCenter,
|
|
156
149
|
isNotice: isNotice
|
|
157
150
|
}, /*#__PURE__*/React.createElement(ToastWrapper, {
|
|
158
151
|
align: align,
|
|
159
|
-
isCenter: isCenter,
|
|
160
152
|
ref: refToPass,
|
|
161
|
-
isNotice: isNotice
|
|
153
|
+
isNotice: isNotice,
|
|
154
|
+
"data-role": "toast-wrapper"
|
|
162
155
|
}, /*#__PURE__*/React.createElement(TransitionGroup, null, renderToastContent())));
|
|
163
156
|
});
|
|
164
157
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -174,7 +167,6 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
174
167
|
"data-component": PropTypes.string,
|
|
175
168
|
"disableAutoFocus": PropTypes.bool,
|
|
176
169
|
"id": PropTypes.string,
|
|
177
|
-
"isCenter": PropTypes.bool,
|
|
178
170
|
"maxWidth": PropTypes.string,
|
|
179
171
|
"onDismiss": PropTypes.func,
|
|
180
172
|
"open": PropTypes.bool,
|
|
@@ -4,7 +4,6 @@ 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;
|
|
6
6
|
alignY?: "bottom" | "top" | "center" | undefined;
|
|
7
|
-
isCenter?: boolean | undefined;
|
|
8
7
|
isNotice?: boolean | undefined;
|
|
9
8
|
}, never>;
|
|
10
9
|
declare type ToastVariants = MessageVariant;
|
|
@@ -12,7 +11,6 @@ declare type ToastStyleProps = {
|
|
|
12
11
|
align?: "left" | "center" | "right";
|
|
13
12
|
alignY?: "top" | "center" | "bottom";
|
|
14
13
|
maxWidth?: string;
|
|
15
|
-
isCenter?: boolean;
|
|
16
14
|
isNotice?: boolean;
|
|
17
15
|
isNotification?: boolean;
|
|
18
16
|
variant: ToastVariants;
|
|
@@ -24,7 +22,6 @@ declare const StyledToastContent: import("styled-components").StyledComponent<"d
|
|
|
24
22
|
}, never>;
|
|
25
23
|
declare const ToastWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
26
24
|
align?: "left" | "right" | "center" | undefined;
|
|
27
|
-
isCenter?: boolean | undefined;
|
|
28
25
|
isNotice?: boolean | undefined;
|
|
29
26
|
}, never>;
|
|
30
27
|
export { StyledPortal, StyledToast, TypeIcon, StyledToastContent, ToastWrapper, };
|
|
@@ -7,7 +7,6 @@ import StyledIcon from "../icon/icon.style";
|
|
|
7
7
|
const StyledPortal = styled(Portal)`
|
|
8
8
|
${({
|
|
9
9
|
theme,
|
|
10
|
-
isCenter,
|
|
11
10
|
isNotice,
|
|
12
11
|
align,
|
|
13
12
|
alignY
|
|
@@ -16,11 +15,6 @@ const StyledPortal = styled(Portal)`
|
|
|
16
15
|
top: 0;
|
|
17
16
|
z-index: ${theme.zIndex.notification};
|
|
18
17
|
|
|
19
|
-
${isCenter && css`
|
|
20
|
-
margin-left: 50%;
|
|
21
|
-
transform: translateX(-50%);
|
|
22
|
-
`}
|
|
23
|
-
|
|
24
18
|
${align === "left" && css`
|
|
25
19
|
left: 0;
|
|
26
20
|
transform: translateX(50%);
|
|
@@ -82,7 +76,6 @@ const iconPositionStyles = css`
|
|
|
82
76
|
const StyledToast = styled.div`
|
|
83
77
|
${({
|
|
84
78
|
maxWidth,
|
|
85
|
-
isCenter,
|
|
86
79
|
align,
|
|
87
80
|
isNotification,
|
|
88
81
|
alignY,
|
|
@@ -113,8 +106,8 @@ const StyledToast = styled.div`
|
|
|
113
106
|
margin-bottom: ${alignY === "bottom" && !isNotice ? "30px" : "0"};
|
|
114
107
|
max-width: ${!maxWidth ? "300px" : maxWidth};
|
|
115
108
|
position: relative;
|
|
116
|
-
margin-right: ${
|
|
117
|
-
margin-left: ${
|
|
109
|
+
margin-right: ${align === "center" || align === "right" ? "auto" : "30px"};
|
|
110
|
+
margin-left: ${align === "center" || align === "left" ? "auto" : "30px"};
|
|
118
111
|
|
|
119
112
|
${isNotification && css`
|
|
120
113
|
border: 1px solid var(--colorsSemanticInfo500);
|
|
@@ -134,8 +127,8 @@ const StyledToast = styled.div`
|
|
|
134
127
|
&${animationName}-enter${animationName}-enter-active {
|
|
135
128
|
opacity: 1;
|
|
136
129
|
transform: ${({
|
|
137
|
-
|
|
138
|
-
}) =>
|
|
130
|
+
align
|
|
131
|
+
}) => align === "center" ? " scale(1) translateY(0)" : "scale(1)"};
|
|
139
132
|
transition: all 300ms cubic-bezier(0.25, 0.25, 0, 1.5);
|
|
140
133
|
}
|
|
141
134
|
|
|
@@ -225,16 +218,6 @@ const ToastWrapper = styled.div`
|
|
|
225
218
|
display: flex;
|
|
226
219
|
`}
|
|
227
220
|
|
|
228
|
-
${({
|
|
229
|
-
isCenter
|
|
230
|
-
}) => isCenter && css`
|
|
231
|
-
position: relative;
|
|
232
|
-
width: auto;
|
|
233
|
-
height: auto;
|
|
234
|
-
justify-content: center;
|
|
235
|
-
display: flex;
|
|
236
|
-
`}
|
|
237
|
-
|
|
238
221
|
${({
|
|
239
222
|
isNotice
|
|
240
223
|
}) => isNotice && css`
|
|
@@ -16,8 +16,8 @@ const Badge = ({
|
|
|
16
16
|
color = "--colorsActionMajor500",
|
|
17
17
|
onClick
|
|
18
18
|
}) => {
|
|
19
|
-
const shouldDisplayCounter = counter > 0;
|
|
20
|
-
const counterToDisplay = counter > 99 ? 99 : counter;
|
|
19
|
+
const shouldDisplayCounter = +counter > 0;
|
|
20
|
+
const counterToDisplay = +counter > 99 ? 99 : counter;
|
|
21
21
|
const renderCorrectBadge = () => {
|
|
22
22
|
const props = onClick ? {
|
|
23
23
|
buttonType: "secondary",
|
|
@@ -27,6 +27,7 @@ const Badge = ({
|
|
|
27
27
|
};
|
|
28
28
|
if (shouldDisplayCounter) {
|
|
29
29
|
return /*#__PURE__*/_react.default.createElement(_badge.StyledBadge, _extends({
|
|
30
|
+
"data-role": "badge",
|
|
30
31
|
"data-component": "badge",
|
|
31
32
|
color: color
|
|
32
33
|
}, props), onClick && /*#__PURE__*/_react.default.createElement(_badge.StyledCrossIcon, {
|
|
@@ -7,5 +7,5 @@ export interface MultiActionButtonProps extends WidthProps, Omit<SplitButtonProp
|
|
|
7
7
|
/** Second text child, renders under main text, only when size is "large" */
|
|
8
8
|
subtext?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare const MultiActionButton: ({ align, disabled, buttonType, size, children, text, subtext, width, onClick, "data-element": dataElement, "data-role": dataRole, ...rest }: MultiActionButtonProps) => React.JSX.Element;
|
|
10
|
+
export declare const MultiActionButton: ({ align, position, disabled, buttonType, size, children, text, subtext, width, onClick, "data-element": dataElement, "data-role": dataRole, ...rest }: MultiActionButtonProps) => React.JSX.Element;
|
|
11
11
|
export default MultiActionButton;
|
|
@@ -20,6 +20,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
20
20
|
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); }
|
|
21
21
|
const MultiActionButton = ({
|
|
22
22
|
align = "left",
|
|
23
|
+
position = "left",
|
|
23
24
|
disabled,
|
|
24
25
|
buttonType,
|
|
25
26
|
size,
|
|
@@ -62,7 +63,7 @@ const MultiActionButton = ({
|
|
|
62
63
|
...(0, _utils.filterOutStyledSystemSpacingProps)(rest)
|
|
63
64
|
};
|
|
64
65
|
const renderAdditionalButtons = () => /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
65
|
-
placement: "bottom-end",
|
|
66
|
+
placement: position === "left" ? "bottom-start" : /* istanbul ignore next */"bottom-end",
|
|
66
67
|
reference: buttonNode,
|
|
67
68
|
middleware: [(0, _dom.offset)(6), (0, _dom.flip)({
|
|
68
69
|
fallbackStrategy: "initialPlacement"
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.MULTI_ACTION_BUTTON_THEMES = exports.MULTI_ACTION_BUTTON_SIZES = exports.MULTI_ACTION_BUTTON_ALIGNMENTS = void 0;
|
|
6
|
+
exports.MULTI_ACTION_BUTTON_THEMES = exports.MULTI_ACTION_BUTTON_SIZES = exports.MULTI_ACTION_BUTTON_POSITIONS = exports.MULTI_ACTION_BUTTON_ALIGNMENTS = void 0;
|
|
7
7
|
const MULTI_ACTION_BUTTON_ALIGNMENTS = exports.MULTI_ACTION_BUTTON_ALIGNMENTS = ["left", "right"];
|
|
8
8
|
const MULTI_ACTION_BUTTON_SIZES = exports.MULTI_ACTION_BUTTON_SIZES = ["small", "medium", "large"];
|
|
9
|
-
const MULTI_ACTION_BUTTON_THEMES = exports.MULTI_ACTION_BUTTON_THEMES = ["primary", "secondary", "tertiary"];
|
|
9
|
+
const MULTI_ACTION_BUTTON_THEMES = exports.MULTI_ACTION_BUTTON_THEMES = ["primary", "secondary", "tertiary"];
|
|
10
|
+
const MULTI_ACTION_BUTTON_POSITIONS = exports.MULTI_ACTION_BUTTON_POSITIONS = ["left", "right"];
|
|
@@ -69,6 +69,7 @@ const Portal = ({
|
|
|
69
69
|
node = document.createElement("div");
|
|
70
70
|
node.classList.add(portalClassName);
|
|
71
71
|
node.setAttribute("data-portal-exit", uniqueId);
|
|
72
|
+
node.setAttribute("data-role", "carbon-portal-exit");
|
|
72
73
|
if (id !== undefined) {
|
|
73
74
|
node.setAttribute("id", id);
|
|
74
75
|
}
|
|
@@ -20,12 +20,14 @@ export interface SplitButtonProps extends React.ButtonHTMLAttributes<HTMLButtonE
|
|
|
20
20
|
iconPosition?: "before" | "after";
|
|
21
21
|
/** Defines an Icon type within the button */
|
|
22
22
|
iconType?: IconType;
|
|
23
|
-
/** The size of the buttons
|
|
23
|
+
/** The size of the buttons. */
|
|
24
24
|
size?: "small" | "medium" | "large";
|
|
25
25
|
/** Second text child, renders under main text, only when size is "large" */
|
|
26
26
|
subtext?: string;
|
|
27
|
-
/** The text to be displayed in the
|
|
27
|
+
/** The text to be displayed in the main button. */
|
|
28
28
|
text: string;
|
|
29
|
+
/** Sets rendering position of menu */
|
|
30
|
+
position?: "left" | "right";
|
|
29
31
|
}
|
|
30
|
-
export declare const SplitButton: ({ align, buttonType, children, disabled, iconPosition, iconType, onClick, size, subtext, text, "data-element": dataElement, "data-role": dataRole, "aria-label": ariaLabel, ...rest }: SplitButtonProps) => React.JSX.Element;
|
|
32
|
+
export declare const SplitButton: ({ align, position, buttonType, children, disabled, iconPosition, iconType, onClick, size, subtext, text, "data-element": dataElement, "data-role": dataRole, "aria-label": ariaLabel, ...rest }: SplitButtonProps) => React.JSX.Element;
|
|
31
33
|
export default SplitButton;
|
|
@@ -28,6 +28,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
28
28
|
const CONTENT_WIDTH_RATIO = 0.75;
|
|
29
29
|
const SplitButton = ({
|
|
30
30
|
align = "left",
|
|
31
|
+
position = "right",
|
|
31
32
|
buttonType = "secondary",
|
|
32
33
|
children,
|
|
33
34
|
disabled = false,
|
|
@@ -114,7 +115,7 @@ const SplitButton = ({
|
|
|
114
115
|
function renderAdditionalButtons() {
|
|
115
116
|
if (!showAdditionalButtons) return null;
|
|
116
117
|
return /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
117
|
-
placement: "bottom-end",
|
|
118
|
+
placement: position === "left" ? /* istanbul ignore next */"bottom-start" : "bottom-end",
|
|
118
119
|
reference: buttonNode,
|
|
119
120
|
middleware: [(0, _dom.offset)(6), (0, _dom.flip)({
|
|
120
121
|
fallbackStrategy: "initialPlacement"
|
|
@@ -2,3 +2,4 @@ export declare const SPLIT_BUTTON_ICON_POSITIONS: string[];
|
|
|
2
2
|
export declare const SPLIT_BUTTON_THEMES: string[];
|
|
3
3
|
export declare const SPLIT_BUTTON_SIZES: string[];
|
|
4
4
|
export declare const SPLIT_BUTTON_ALIGNMENTS: string[];
|
|
5
|
+
export declare const SPLIT_BUTTON_POSITIONS: string[];
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SPLIT_BUTTON_THEMES = exports.SPLIT_BUTTON_SIZES = exports.SPLIT_BUTTON_ICON_POSITIONS = exports.SPLIT_BUTTON_ALIGNMENTS = void 0;
|
|
6
|
+
exports.SPLIT_BUTTON_THEMES = exports.SPLIT_BUTTON_SIZES = exports.SPLIT_BUTTON_POSITIONS = exports.SPLIT_BUTTON_ICON_POSITIONS = exports.SPLIT_BUTTON_ALIGNMENTS = void 0;
|
|
7
7
|
const SPLIT_BUTTON_ICON_POSITIONS = exports.SPLIT_BUTTON_ICON_POSITIONS = ["before", "after"];
|
|
8
8
|
const SPLIT_BUTTON_THEMES = exports.SPLIT_BUTTON_THEMES = ["primary", "secondary"];
|
|
9
9
|
const SPLIT_BUTTON_SIZES = exports.SPLIT_BUTTON_SIZES = ["small", "medium", "large"];
|
|
10
|
-
const SPLIT_BUTTON_ALIGNMENTS = exports.SPLIT_BUTTON_ALIGNMENTS = ["left", "right"];
|
|
10
|
+
const SPLIT_BUTTON_ALIGNMENTS = exports.SPLIT_BUTTON_ALIGNMENTS = ["left", "right"];
|
|
11
|
+
const SPLIT_BUTTON_POSITIONS = exports.SPLIT_BUTTON_POSITIONS = ["left", "right"];
|
|
@@ -26,8 +26,6 @@ export interface ToastProps {
|
|
|
26
26
|
closeButtonDataProps?: Pick<TagProps, "data-role" | "data-element">;
|
|
27
27
|
/** Time for Toast to remain on screen */
|
|
28
28
|
timeout?: string | number;
|
|
29
|
-
/** Centers the Toast on the screen */
|
|
30
|
-
isCenter?: boolean;
|
|
31
29
|
/** Target Portal ID where the Toast will render */
|
|
32
30
|
targetPortalId?: string;
|
|
33
31
|
/** Maximum toast width */
|
|
@@ -14,19 +14,16 @@ var _iconButton = _interopRequireDefault(require("../icon-button"));
|
|
|
14
14
|
var _events = _interopRequireDefault(require("../../__internal__/utils/helpers/events"));
|
|
15
15
|
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
16
16
|
var _useModalManager = _interopRequireDefault(require("../../hooks/__internal__/useModalManager"));
|
|
17
|
-
var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
|
|
18
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
18
|
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); }
|
|
20
19
|
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; }
|
|
21
20
|
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); }
|
|
22
|
-
let isDeprecationWarningTriggered = false;
|
|
23
21
|
const Toast = exports.Toast = /*#__PURE__*/_react.default.forwardRef(({
|
|
24
|
-
align,
|
|
22
|
+
align = "center",
|
|
25
23
|
alignY,
|
|
26
24
|
children,
|
|
27
25
|
className,
|
|
28
26
|
id,
|
|
29
|
-
isCenter = true,
|
|
30
27
|
maxWidth,
|
|
31
28
|
onDismiss,
|
|
32
29
|
open = true,
|
|
@@ -50,10 +47,6 @@ const Toast = exports.Toast = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
50
47
|
if (ref && typeof ref === "object" && "current" in ref) {
|
|
51
48
|
refToPass = ref;
|
|
52
49
|
}
|
|
53
|
-
if (isCenter !== undefined && !isDeprecationWarningTriggered) {
|
|
54
|
-
isDeprecationWarningTriggered = true;
|
|
55
|
-
_logger.default.deprecate(`isCenter prop in ${Toast.displayName} is being deprecated in favour of the align prop.`);
|
|
56
|
-
}
|
|
57
50
|
const dismissToast = (0, _react.useCallback)(ev => {
|
|
58
51
|
if (onDismiss && _events.default.isEscKey(ev)) {
|
|
59
52
|
ev.stopImmediatePropagation();
|
|
@@ -140,7 +133,6 @@ const Toast = exports.Toast = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
140
133
|
isNotification: isNotification,
|
|
141
134
|
className: className
|
|
142
135
|
}, (0, _tags.default)(restProps["data-component"] || "toast", restProps), {
|
|
143
|
-
isCenter: isCenter,
|
|
144
136
|
variant: toastVariant,
|
|
145
137
|
id: id,
|
|
146
138
|
maxWidth: maxWidth,
|
|
@@ -149,25 +141,26 @@ const Toast = exports.Toast = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
149
141
|
tabIndex,
|
|
150
142
|
onBlur: () => setTabIndex(undefined)
|
|
151
143
|
}), !isNotice && /*#__PURE__*/_react.default.createElement(_toast.TypeIcon, {
|
|
152
|
-
variant: isNotification ? "info" : variant
|
|
144
|
+
variant: isNotification ? "info" : variant,
|
|
145
|
+
"data-role": "toast-type-icon"
|
|
153
146
|
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
154
147
|
type: toastIcon
|
|
155
148
|
})), /*#__PURE__*/_react.default.createElement(_toast.StyledToastContent, {
|
|
156
149
|
isNotice: isNotice,
|
|
157
|
-
isDismiss: !!onDismiss
|
|
150
|
+
isDismiss: !!onDismiss,
|
|
151
|
+
"data-role": "toast-content"
|
|
158
152
|
}, children), renderCloseIcon()));
|
|
159
153
|
}
|
|
160
154
|
return /*#__PURE__*/_react.default.createElement(_toast.StyledPortal, {
|
|
161
155
|
id: targetPortalId,
|
|
162
156
|
align: align,
|
|
163
157
|
alignY: alignY,
|
|
164
|
-
isCenter: isCenter,
|
|
165
158
|
isNotice: isNotice
|
|
166
159
|
}, /*#__PURE__*/_react.default.createElement(_toast.ToastWrapper, {
|
|
167
160
|
align: align,
|
|
168
|
-
isCenter: isCenter,
|
|
169
161
|
ref: refToPass,
|
|
170
|
-
isNotice: isNotice
|
|
162
|
+
isNotice: isNotice,
|
|
163
|
+
"data-role": "toast-wrapper"
|
|
171
164
|
}, /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.TransitionGroup, null, renderToastContent())));
|
|
172
165
|
});
|
|
173
166
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -183,7 +176,6 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
183
176
|
"data-component": _propTypes.default.string,
|
|
184
177
|
"disableAutoFocus": _propTypes.default.bool,
|
|
185
178
|
"id": _propTypes.default.string,
|
|
186
|
-
"isCenter": _propTypes.default.bool,
|
|
187
179
|
"maxWidth": _propTypes.default.string,
|
|
188
180
|
"onDismiss": _propTypes.default.func,
|
|
189
181
|
"open": _propTypes.default.bool,
|
|
@@ -4,7 +4,6 @@ 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;
|
|
6
6
|
alignY?: "bottom" | "top" | "center" | undefined;
|
|
7
|
-
isCenter?: boolean | undefined;
|
|
8
7
|
isNotice?: boolean | undefined;
|
|
9
8
|
}, never>;
|
|
10
9
|
declare type ToastVariants = MessageVariant;
|
|
@@ -12,7 +11,6 @@ declare type ToastStyleProps = {
|
|
|
12
11
|
align?: "left" | "center" | "right";
|
|
13
12
|
alignY?: "top" | "center" | "bottom";
|
|
14
13
|
maxWidth?: string;
|
|
15
|
-
isCenter?: boolean;
|
|
16
14
|
isNotice?: boolean;
|
|
17
15
|
isNotification?: boolean;
|
|
18
16
|
variant: ToastVariants;
|
|
@@ -24,7 +22,6 @@ declare const StyledToastContent: import("styled-components").StyledComponent<"d
|
|
|
24
22
|
}, never>;
|
|
25
23
|
declare const ToastWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
26
24
|
align?: "left" | "right" | "center" | undefined;
|
|
27
|
-
isCenter?: boolean | undefined;
|
|
28
25
|
isNotice?: boolean | undefined;
|
|
29
26
|
}, never>;
|
|
30
27
|
export { StyledPortal, StyledToast, TypeIcon, StyledToastContent, ToastWrapper, };
|
|
@@ -22,7 +22,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
22
22
|
const StyledPortal = exports.StyledPortal = (0, _styledComponents.default)(_portal.default)`
|
|
23
23
|
${({
|
|
24
24
|
theme,
|
|
25
|
-
isCenter,
|
|
26
25
|
isNotice,
|
|
27
26
|
align,
|
|
28
27
|
alignY
|
|
@@ -31,11 +30,6 @@ const StyledPortal = exports.StyledPortal = (0, _styledComponents.default)(_port
|
|
|
31
30
|
top: 0;
|
|
32
31
|
z-index: ${theme.zIndex.notification};
|
|
33
32
|
|
|
34
|
-
${isCenter && (0, _styledComponents.css)`
|
|
35
|
-
margin-left: 50%;
|
|
36
|
-
transform: translateX(-50%);
|
|
37
|
-
`}
|
|
38
|
-
|
|
39
33
|
${align === "left" && (0, _styledComponents.css)`
|
|
40
34
|
left: 0;
|
|
41
35
|
transform: translateX(50%);
|
|
@@ -97,7 +91,6 @@ const iconPositionStyles = (0, _styledComponents.css)`
|
|
|
97
91
|
const StyledToast = exports.StyledToast = _styledComponents.default.div`
|
|
98
92
|
${({
|
|
99
93
|
maxWidth,
|
|
100
|
-
isCenter,
|
|
101
94
|
align,
|
|
102
95
|
isNotification,
|
|
103
96
|
alignY,
|
|
@@ -128,8 +121,8 @@ const StyledToast = exports.StyledToast = _styledComponents.default.div`
|
|
|
128
121
|
margin-bottom: ${alignY === "bottom" && !isNotice ? "30px" : "0"};
|
|
129
122
|
max-width: ${!maxWidth ? "300px" : maxWidth};
|
|
130
123
|
position: relative;
|
|
131
|
-
margin-right: ${
|
|
132
|
-
margin-left: ${
|
|
124
|
+
margin-right: ${align === "center" || align === "right" ? "auto" : "30px"};
|
|
125
|
+
margin-left: ${align === "center" || align === "left" ? "auto" : "30px"};
|
|
133
126
|
|
|
134
127
|
${isNotification && (0, _styledComponents.css)`
|
|
135
128
|
border: 1px solid var(--colorsSemanticInfo500);
|
|
@@ -149,8 +142,8 @@ const StyledToast = exports.StyledToast = _styledComponents.default.div`
|
|
|
149
142
|
&${animationName}-enter${animationName}-enter-active {
|
|
150
143
|
opacity: 1;
|
|
151
144
|
transform: ${({
|
|
152
|
-
|
|
153
|
-
}) =>
|
|
145
|
+
align
|
|
146
|
+
}) => align === "center" ? " scale(1) translateY(0)" : "scale(1)"};
|
|
154
147
|
transition: all 300ms cubic-bezier(0.25, 0.25, 0, 1.5);
|
|
155
148
|
}
|
|
156
149
|
|
|
@@ -240,16 +233,6 @@ const ToastWrapper = exports.ToastWrapper = _styledComponents.default.div`
|
|
|
240
233
|
display: flex;
|
|
241
234
|
`}
|
|
242
235
|
|
|
243
|
-
${({
|
|
244
|
-
isCenter
|
|
245
|
-
}) => isCenter && (0, _styledComponents.css)`
|
|
246
|
-
position: relative;
|
|
247
|
-
width: auto;
|
|
248
|
-
height: auto;
|
|
249
|
-
justify-content: center;
|
|
250
|
-
display: flex;
|
|
251
|
-
`}
|
|
252
|
-
|
|
253
236
|
${({
|
|
254
237
|
isNotice
|
|
255
238
|
}) => isNotice && (0, _styledComponents.css)`
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
|
|
3
|
-
export interface CarouselProps extends TagProps {
|
|
4
|
-
/** Individual tabs */
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
/** [legacy] Custom className */
|
|
7
|
-
className?: string;
|
|
8
|
-
/** Enables the next button */
|
|
9
|
-
enableNextButton?: boolean;
|
|
10
|
-
/** Enables the previous button */
|
|
11
|
-
enablePreviousButton?: boolean;
|
|
12
|
-
/** Enables the slide selector */
|
|
13
|
-
enableSlideSelector?: boolean;
|
|
14
|
-
/** The selected tab on page load */
|
|
15
|
-
initialSlideIndex?: number | string;
|
|
16
|
-
/** Action to be called on slide change */
|
|
17
|
-
onSlideChange?: (index: number, transitionDirection: string) => void;
|
|
18
|
-
/** The selected slide */
|
|
19
|
-
slideIndex?: number | string;
|
|
20
|
-
}
|
|
21
|
-
export declare const Carousel: {
|
|
22
|
-
({ children, className, enableSlideSelector, enablePreviousButton, enableNextButton, initialSlideIndex, onSlideChange, slideIndex, ...props }: CarouselProps): React.JSX.Element;
|
|
23
|
-
displayName: string;
|
|
24
|
-
};
|
|
25
|
-
export default Carousel;
|