carbon-react 152.2.1 → 152.3.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/__internal__/ai-icon/ai-icon.component.d.ts +4 -0
- package/esm/__internal__/ai-icon/ai-icon.component.js +28 -0
- package/esm/__internal__/ai-icon/index.d.ts +1 -0
- package/esm/__internal__/ai-icon/index.js +1 -0
- package/esm/__internal__/utils/helpers/events/events.d.ts +1 -1
- package/esm/components/button/button-types.style.js +11 -1
- package/esm/components/button/button.component.js +1 -1
- package/esm/components/hr/hr.style.js +1 -1
- package/esm/components/image/image.style.d.ts +1 -1
- package/esm/components/message/message.component.d.ts +5 -1
- package/esm/components/message/message.component.js +38 -24
- package/esm/components/message/message.style.d.ts +4 -1
- package/esm/components/message/message.style.js +39 -13
- package/esm/components/split-button/split-button-toggle.style.d.ts +1 -0
- package/esm/components/split-button/split-button-toggle.style.js +30 -2
- package/esm/components/split-button/split-button.component.d.ts +2 -0
- package/esm/components/split-button/split-button.component.js +4 -0
- package/esm/components/time/index.d.ts +1 -1
- package/esm/components/time/time.component.js +16 -1
- package/esm/components/toast/toast.component.js +2 -1
- package/esm/components/toast/toast.style.d.ts +2 -3
- package/esm/components/toast/toast.style.js +1 -2
- package/esm/components/typography/typography.style.d.ts +1 -1
- package/esm/locales/en-gb.js +2 -1
- package/esm/locales/locale.d.ts +1 -0
- package/lib/__internal__/ai-icon/ai-icon.component.d.ts +4 -0
- package/lib/__internal__/ai-icon/ai-icon.component.js +36 -0
- package/lib/__internal__/ai-icon/index.d.ts +1 -0
- package/lib/__internal__/ai-icon/index.js +13 -0
- package/lib/__internal__/ai-icon/package.json +6 -0
- package/lib/__internal__/utils/helpers/events/events.d.ts +1 -1
- package/lib/components/button/button-types.style.js +11 -1
- package/lib/components/button/button.component.js +1 -1
- package/lib/components/hr/hr.style.js +1 -1
- package/lib/components/image/image.style.d.ts +1 -1
- package/lib/components/message/message.component.d.ts +5 -1
- package/lib/components/message/message.component.js +38 -24
- package/lib/components/message/message.style.d.ts +4 -1
- package/lib/components/message/message.style.js +38 -13
- package/lib/components/split-button/split-button-toggle.style.d.ts +1 -0
- package/lib/components/split-button/split-button-toggle.style.js +30 -2
- package/lib/components/split-button/split-button.component.d.ts +2 -0
- package/lib/components/split-button/split-button.component.js +4 -0
- package/lib/components/time/index.d.ts +1 -1
- package/lib/components/time/time.component.js +15 -0
- package/lib/components/toast/toast.component.js +2 -1
- package/lib/components/toast/toast.style.d.ts +2 -3
- package/lib/components/toast/toast.style.js +0 -7
- package/lib/components/typography/typography.style.d.ts +1 -1
- package/lib/locales/en-gb.js +2 -1
- package/lib/locales/locale.d.ts +1 -0
- package/package.json +15 -15
- package/esm/components/message/__internal__/message-content/message-content.component.d.ts +0 -9
- package/esm/components/message/__internal__/message-content/message-content.component.js +0 -19
- package/esm/components/message/__internal__/message-content/message-content.style.d.ts +0 -3
- package/esm/components/message/__internal__/message-content/message-content.style.js +0 -12
- package/esm/components/message/__internal__/type-icon/type-icon.component.d.ts +0 -8
- package/esm/components/message/__internal__/type-icon/type-icon.component.js +0 -20
- package/esm/components/message/__internal__/type-icon/type-icon.style.d.ts +0 -7
- package/esm/components/message/__internal__/type-icon/type-icon.style.js +0 -38
- package/lib/components/message/__internal__/message-content/message-content.component.d.ts +0 -9
- package/lib/components/message/__internal__/message-content/message-content.component.js +0 -26
- package/lib/components/message/__internal__/message-content/message-content.style.d.ts +0 -3
- package/lib/components/message/__internal__/message-content/message-content.style.js +0 -19
- package/lib/components/message/__internal__/type-icon/type-icon.component.d.ts +0 -8
- package/lib/components/message/__internal__/type-icon/type-icon.component.js +0 -27
- package/lib/components/message/__internal__/type-icon/type-icon.style.d.ts +0 -7
- package/lib/components/message/__internal__/type-icon/type-icon.style.js +0 -46
|
@@ -0,0 +1,28 @@
|
|
|
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 from "react";
|
|
3
|
+
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
4
|
+
export const AiIcon = ({
|
|
5
|
+
...rest
|
|
6
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends({}, tagComponent("ai-icon", rest), {
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
width: "20",
|
|
9
|
+
height: "20",
|
|
10
|
+
fill: "none",
|
|
11
|
+
viewBox: "0 0 20 20"
|
|
12
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
13
|
+
clipPath: "url(#a)"
|
|
14
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
15
|
+
"data-role": "white-star",
|
|
16
|
+
fill: "#fff",
|
|
17
|
+
d: "m16.378 9.799-3.776-1.49a1.615 1.615 0 0 1-.91-.91l-1.49-3.775c-.537-1.364-2.466-1.364-3.004 0L5.708 7.4a1.615 1.615 0 0 1-.91.91L1.022 9.799c-1.363.537-1.363 2.466 0 3.004l3.776 1.49c.417.163.746.493.91.91l1.49 3.775c.538 1.363 2.467 1.363 3.005 0l1.489-3.776c.164-.416.494-.745.91-.91l3.776-1.489c1.364-.538 1.364-2.467 0-3.004Z"
|
|
18
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
19
|
+
"data-role": "green-circle",
|
|
20
|
+
fill: "#00D639",
|
|
21
|
+
d: "M17.172 5.655a2.827 2.827 0 1 0 0-5.655 2.827 2.827 0 0 0 0 5.655Z"
|
|
22
|
+
})), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
23
|
+
id: "a"
|
|
24
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
25
|
+
fill: "#fff",
|
|
26
|
+
d: "M0 0h20v20H0z"
|
|
27
|
+
}))));
|
|
28
|
+
export default AiIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ai-icon.component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ai-icon.component";
|
|
@@ -17,7 +17,7 @@ declare const Events: {
|
|
|
17
17
|
/**
|
|
18
18
|
* Determines if event is a keyboard event
|
|
19
19
|
*/
|
|
20
|
-
isKeyboardEvent: (ev: React.SyntheticEvent | Event) => ev is React.KeyboardEvent<Element
|
|
20
|
+
isKeyboardEvent: (ev: React.SyntheticEvent | Event) => ev is KeyboardEvent | React.KeyboardEvent<Element>;
|
|
21
21
|
/**
|
|
22
22
|
* Determines if a number key along the top of the keyboard or a number key on the
|
|
23
23
|
* keypad is pressed
|
|
@@ -76,6 +76,16 @@ export default (isDisabled, destructive, isWhite) => ({
|
|
|
76
76
|
${makeColors("var(--colorsActionMajorYang100)")};
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
${isWhite && (!isDisabled || !destructive) ? `
|
|
80
|
+
border-color: var(--colorsActionMajorYang100);
|
|
81
|
+
${makeColors("var(--colorsActionMajorYang100)")};
|
|
82
|
+
&:hover {
|
|
83
|
+
background: var(--colorsActionMajorYang100);
|
|
84
|
+
border-color: var(--colorsActionMajorYang100);
|
|
85
|
+
${makeColors("var(--colorsYin100)")};
|
|
86
|
+
}
|
|
87
|
+
` : ""}
|
|
88
|
+
|
|
79
89
|
${destructive ? `
|
|
80
90
|
border-color: var(--colorsSemanticNegative500);
|
|
81
91
|
${makeColors("var(--colorsSemanticNegative500)")}
|
|
@@ -86,7 +96,7 @@ export default (isDisabled, destructive, isWhite) => ({
|
|
|
86
96
|
}
|
|
87
97
|
` : ""}
|
|
88
98
|
|
|
89
|
-
${isDisabled ? `
|
|
99
|
+
${isDisabled && !isWhite ? `
|
|
90
100
|
border-color: var(--colorsActionDisabled500);
|
|
91
101
|
${makeColors("var(--colorsActionMajorYin030)")};
|
|
92
102
|
&:hover {
|
|
@@ -64,13 +64,13 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
64
64
|
children,
|
|
65
65
|
destructive = false,
|
|
66
66
|
disabled = false,
|
|
67
|
+
isWhite = false,
|
|
67
68
|
fullWidth: fullWidthProp = false,
|
|
68
69
|
href,
|
|
69
70
|
iconPosition: iconPositionProp = "before",
|
|
70
71
|
iconTooltipMessage,
|
|
71
72
|
iconTooltipPosition,
|
|
72
73
|
iconType,
|
|
73
|
-
isWhite = false,
|
|
74
74
|
m = 0,
|
|
75
75
|
noWrap,
|
|
76
76
|
onClick,
|
|
@@ -34,5 +34,5 @@ declare const StyledImage: import("styled-components").StyledComponent<"div", an
|
|
|
34
34
|
bottom: string | undefined;
|
|
35
35
|
left: string | undefined;
|
|
36
36
|
as?: string | undefined;
|
|
37
|
-
} & StyledImageProps, "hidden" | "children" | "left" | "right" | "top" | "bottom" | "
|
|
37
|
+
} & StyledImageProps, "hidden" | "children" | "left" | "right" | "top" | "bottom" | "as" | "src" | "position">;
|
|
38
38
|
export { StyledImage };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
3
|
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
|
|
4
|
-
export
|
|
4
|
+
export interface TypeIconProps {
|
|
5
|
+
transparent?: boolean;
|
|
6
|
+
variant: MessageVariant;
|
|
7
|
+
}
|
|
8
|
+
export declare type MessageVariant = "error" | "info" | "success" | "warning" | "neutral" | "ai";
|
|
5
9
|
export interface MessageProps extends MarginProps, TagProps {
|
|
6
10
|
/** Set the component's content */
|
|
7
11
|
children?: React.ReactNode;
|
|
@@ -1,12 +1,12 @@
|
|
|
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
2
|
import React, { useRef } from "react";
|
|
3
3
|
import Typography from "../typography";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import MessageContent from "./__internal__/message-content/message-content.component";
|
|
4
|
+
import Content from "../content";
|
|
5
|
+
import MessageStyle, { MessageContent, TypeIconStyle } from "./message.style";
|
|
7
6
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
8
7
|
import Icon from "../icon";
|
|
9
8
|
import IconButton from "../icon-button";
|
|
9
|
+
import AiIcon from "../../__internal__/ai-icon";
|
|
10
10
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
11
11
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
12
12
|
export const Message = /*#__PURE__*/React.forwardRef(({
|
|
@@ -22,38 +22,52 @@ export const Message = /*#__PURE__*/React.forwardRef(({
|
|
|
22
22
|
width,
|
|
23
23
|
...props
|
|
24
24
|
}, ref) => {
|
|
25
|
-
const
|
|
26
|
-
const
|
|
25
|
+
const localRef = useRef(null);
|
|
26
|
+
const messageRef = ref || localRef;
|
|
27
|
+
const locale = useLocale();
|
|
27
28
|
const marginProps = filterStyledSystemMarginProps(props);
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
onClick: onDismiss
|
|
35
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
36
|
-
type: "close"
|
|
37
|
-
}));
|
|
29
|
+
const VARIANT_ICON_MAP = {
|
|
30
|
+
neutral: "info",
|
|
31
|
+
success: "tick_circle",
|
|
32
|
+
error: "error",
|
|
33
|
+
warning: "warning",
|
|
34
|
+
info: "info"
|
|
38
35
|
};
|
|
39
|
-
|
|
36
|
+
if (!open) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return /*#__PURE__*/React.createElement(MessageStyle, _extends({}, tagComponent("Message", props), {
|
|
40
40
|
transparent: transparent,
|
|
41
41
|
variant: variant,
|
|
42
42
|
id: id,
|
|
43
43
|
width: width,
|
|
44
|
-
ref:
|
|
44
|
+
ref: messageRef
|
|
45
45
|
}, marginProps, {
|
|
46
46
|
tabIndex: -1
|
|
47
|
-
}), /*#__PURE__*/React.createElement(
|
|
47
|
+
}), /*#__PURE__*/React.createElement(TypeIconStyle, {
|
|
48
48
|
variant: variant,
|
|
49
49
|
transparent: transparent
|
|
50
|
-
}
|
|
50
|
+
}, variant === "ai" ? /*#__PURE__*/React.createElement(AiIcon, {
|
|
51
|
+
"data-role": "ai-icon"
|
|
52
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
53
|
+
"data-role": "category-icon",
|
|
54
|
+
type: VARIANT_ICON_MAP[variant]
|
|
55
|
+
})), /*#__PURE__*/React.createElement(Typography, {
|
|
51
56
|
screenReaderOnly: true
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
}, locale.message?.[variant]?.()), /*#__PURE__*/React.createElement(MessageContent, {
|
|
58
|
+
"data-element": "message-content",
|
|
59
|
+
"data-role": "message-content"
|
|
60
|
+
}, !showCloseIcon || !onDismiss ? /*#__PURE__*/React.createElement(Content, {
|
|
61
|
+
title: title
|
|
62
|
+
}, children) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Content, {
|
|
63
|
+
title: title
|
|
64
|
+
}, children), /*#__PURE__*/React.createElement(IconButton, {
|
|
65
|
+
"data-element": "close",
|
|
66
|
+
"aria-label": closeButtonAriaLabel || locale.message.closeButtonAriaLabel(),
|
|
67
|
+
onClick: onDismiss
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
69
|
+
type: "close"
|
|
70
|
+
})))));
|
|
57
71
|
});
|
|
58
72
|
Message.displayName = "Message";
|
|
59
73
|
export default Message;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { MarginProps } from "styled-system";
|
|
2
|
-
import { MessageVariant } from "./message.component";
|
|
2
|
+
import { MessageVariant, TypeIconProps } from "./message.component";
|
|
3
3
|
declare type MessageStyleProps = {
|
|
4
4
|
variant?: MessageVariant;
|
|
5
5
|
transparent?: boolean;
|
|
6
6
|
width?: string;
|
|
7
7
|
};
|
|
8
8
|
declare const MessageStyle: import("styled-components").StyledComponent<"div", any, MessageStyleProps & MarginProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>, never>;
|
|
9
|
+
declare const MessageContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
|
+
declare const TypeIconStyle: import("styled-components").StyledComponent<"div", any, TypeIconProps, never>;
|
|
9
11
|
export default MessageStyle;
|
|
12
|
+
export { MessageContent, TypeIconStyle };
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { margin } from "styled-system";
|
|
3
3
|
import BaseTheme from "../../style/themes/base";
|
|
4
|
-
import StyledIconButton from "../icon-button/icon-button.style";
|
|
5
4
|
const messageVariants = {
|
|
6
5
|
error: "var(--colorsSemanticNegative500)",
|
|
7
6
|
info: "var(--colorsSemanticInfo500)",
|
|
8
7
|
success: "var(--colorsSemanticPositive500)",
|
|
9
8
|
warning: "var(--colorsSemanticCaution500)",
|
|
10
|
-
neutral: "var(--colorsSemanticNeutral500)"
|
|
9
|
+
neutral: "var(--colorsSemanticNeutral500)",
|
|
10
|
+
ai: "var(--colorsUtilityYin100)"
|
|
11
11
|
};
|
|
12
12
|
const MessageStyle = styled.div`
|
|
13
13
|
position: relative;
|
|
14
14
|
display: flex;
|
|
15
|
-
justify-content: flex-start;
|
|
16
|
-
align-content: center;
|
|
17
15
|
border-radius: var(--borderRadius100);
|
|
18
16
|
overflow: hidden;
|
|
19
17
|
border: 1px solid ${({
|
|
@@ -33,20 +31,48 @@ const MessageStyle = styled.div`
|
|
|
33
31
|
background: transparent;
|
|
34
32
|
`}
|
|
35
33
|
|
|
36
|
-
${StyledIconButton} {
|
|
37
|
-
position: absolute;
|
|
38
|
-
right: 20px;
|
|
39
|
-
top: 50%;
|
|
40
|
-
transform: translateY(-50%);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
34
|
${({
|
|
44
35
|
width
|
|
45
36
|
}) => width && `width: ${width};`}
|
|
46
|
-
|
|
47
37
|
${margin}
|
|
48
38
|
`;
|
|
39
|
+
const MessageContent = styled.div`
|
|
40
|
+
width: 100%;
|
|
41
|
+
display: flex;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
align-items: center;
|
|
44
|
+
padding: var(--spacing200);
|
|
45
|
+
gap: var(--spacing300);
|
|
46
|
+
`;
|
|
47
|
+
const TypeIconStyle = styled.div`
|
|
48
|
+
display: flex;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
align-items: center;
|
|
51
|
+
background-color: ${({
|
|
52
|
+
variant
|
|
53
|
+
}) => messageVariants[variant]};
|
|
54
|
+
min-width: 30px;
|
|
55
|
+
|
|
56
|
+
span {
|
|
57
|
+
&:before {
|
|
58
|
+
color: var(--colorsUtilityYang100);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
${({
|
|
63
|
+
transparent,
|
|
64
|
+
variant
|
|
65
|
+
}) => transparent && css`
|
|
66
|
+
background-color: transparent;
|
|
67
|
+
span {
|
|
68
|
+
&:before {
|
|
69
|
+
color: ${messageVariants[variant]};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
`}
|
|
73
|
+
`;
|
|
49
74
|
MessageStyle.defaultProps = {
|
|
50
75
|
theme: BaseTheme
|
|
51
76
|
};
|
|
52
|
-
export default MessageStyle;
|
|
77
|
+
export default MessageStyle;
|
|
78
|
+
export { MessageContent, TypeIconStyle };
|
|
@@ -3,6 +3,7 @@ declare type StyledSplitButtonToggleProps = {
|
|
|
3
3
|
disabled: boolean;
|
|
4
4
|
displayed: boolean;
|
|
5
5
|
size: "small" | "medium" | "large";
|
|
6
|
+
isWhite?: boolean;
|
|
6
7
|
};
|
|
7
8
|
declare const StyledSplitButtonToggle: import("styled-components").StyledComponent<"button", any, import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & Omit<import("../button").ButtonProps, "buttonType"> & {
|
|
8
9
|
iconOnly?: boolean | undefined;
|
|
@@ -12,12 +12,13 @@ const StyledSplitButtonToggle = styled(StyledButton)`
|
|
|
12
12
|
buttonType,
|
|
13
13
|
disabled,
|
|
14
14
|
displayed,
|
|
15
|
-
size
|
|
15
|
+
size,
|
|
16
|
+
isWhite
|
|
16
17
|
}) => css`
|
|
17
18
|
border-top-left-radius: var(--borderRadius000);
|
|
18
19
|
border-bottom-left-radius: var(--borderRadius000);
|
|
19
20
|
|
|
20
|
-
${!disabled && displayed ? css`
|
|
21
|
+
${!disabled && displayed && !isWhite ? css`
|
|
21
22
|
background-color: var(--colorsActionMajor500);
|
|
22
23
|
border-color: var(--colorsActionMajor500);
|
|
23
24
|
|
|
@@ -30,6 +31,21 @@ const StyledSplitButtonToggle = styled(StyledButton)`
|
|
|
30
31
|
border-left-color: var(--colorsSemanticFocus500);
|
|
31
32
|
}
|
|
32
33
|
` : ""}
|
|
34
|
+
|
|
35
|
+
${!disabled && displayed && isWhite ? css`
|
|
36
|
+
background-color: var(--colorsActionMajorYang100);
|
|
37
|
+
border-color: var(--colorsActionMajorYang100);
|
|
38
|
+
|
|
39
|
+
&,
|
|
40
|
+
${StyledIcon} {
|
|
41
|
+
color: var(--colorsYin100);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:focus {
|
|
45
|
+
border-left-color: var(--colorsSemanticFocus500);
|
|
46
|
+
}
|
|
47
|
+
` : ""}
|
|
48
|
+
|
|
33
49
|
${!disabled && buttonType === "primary" && `
|
|
34
50
|
position: relative;
|
|
35
51
|
&::before {
|
|
@@ -63,6 +79,18 @@ const StyledSplitButtonToggle = styled(StyledButton)`
|
|
|
63
79
|
color: var(--colorsActionMajorYang100);
|
|
64
80
|
}
|
|
65
81
|
}
|
|
82
|
+
|
|
83
|
+
${!disabled && isWhite && `
|
|
84
|
+
&:focus {
|
|
85
|
+
background-color: var(--colorsActionMajorYang100);
|
|
86
|
+
border-color: var(--colorsActionMajorYang100);
|
|
87
|
+
|
|
88
|
+
&,
|
|
89
|
+
${StyledIcon} {
|
|
90
|
+
color: var(--colorsYin100);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
`}
|
|
66
94
|
`}
|
|
67
95
|
`;
|
|
68
96
|
StyledSplitButtonToggle.defaultProps = {
|
|
@@ -25,6 +25,8 @@ export interface SplitButtonProps extends React.ButtonHTMLAttributes<HTMLButtonE
|
|
|
25
25
|
text: string;
|
|
26
26
|
/** Sets rendering position of menu */
|
|
27
27
|
position?: "left" | "right";
|
|
28
|
+
/** Renders the white variant of the secondary split button */
|
|
29
|
+
isWhite?: boolean;
|
|
28
30
|
}
|
|
29
31
|
export declare type SplitButtonHandle = {
|
|
30
32
|
/** Programmatically focus the main button */
|
|
@@ -32,6 +32,7 @@ export const SplitButton = /*#__PURE__*/forwardRef(({
|
|
|
32
32
|
"data-element": dataElement,
|
|
33
33
|
"data-role": dataRole,
|
|
34
34
|
"aria-label": ariaLabel,
|
|
35
|
+
isWhite = false,
|
|
35
36
|
...rest
|
|
36
37
|
}, ref) => {
|
|
37
38
|
const locale = useLocale();
|
|
@@ -42,6 +43,7 @@ export const SplitButton = /*#__PURE__*/forwardRef(({
|
|
|
42
43
|
const {
|
|
43
44
|
isInFlatTable
|
|
44
45
|
} = useContext(FlatTableContext);
|
|
46
|
+
const shouldRenderIsWhiteVariant = buttonType === "secondary" && isWhite;
|
|
45
47
|
useImperativeHandle(ref, () => ({
|
|
46
48
|
focusMainButton() {
|
|
47
49
|
mainButtonRef.current?.focus();
|
|
@@ -76,12 +78,14 @@ export const SplitButton = /*#__PURE__*/forwardRef(({
|
|
|
76
78
|
onClick: handleMainClick,
|
|
77
79
|
size,
|
|
78
80
|
subtext,
|
|
81
|
+
isWhite: shouldRenderIsWhiteVariant,
|
|
79
82
|
...filterOutStyledSystemSpacingProps(rest)
|
|
80
83
|
};
|
|
81
84
|
const handleToggleClick = () => {
|
|
82
85
|
showButtons();
|
|
83
86
|
};
|
|
84
87
|
const toggleButtonProps = {
|
|
88
|
+
isWhite: shouldRenderIsWhiteVariant,
|
|
85
89
|
disabled,
|
|
86
90
|
displayed: showAdditionalButtons,
|
|
87
91
|
onTouchStart: showButtons,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Time } from "./time.component";
|
|
2
|
-
export type { TimeValue, TimeProps, TimeHandle, ToggleValue, } from "./time.component";
|
|
2
|
+
export type { TimeValue, TimeProps, TimeHandle, ToggleValue, TimeInputEvent, } from "./time.component";
|
|
@@ -1,5 +1,5 @@
|
|
|
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, { useCallback, useImperativeHandle, useRef, useState } from "react";
|
|
2
|
+
import React, { useCallback, useImperativeHandle, useRef, useState, useEffect } from "react";
|
|
3
3
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
4
4
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
5
5
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
@@ -69,6 +69,21 @@ const Time = /*#__PURE__*/React.forwardRef(({
|
|
|
69
69
|
const minsAriaLabel = minutesAriaLabel || locale.time.minutesAriaLabelText();
|
|
70
70
|
const hoursRef = useRef(null);
|
|
71
71
|
const minsRef = useRef(null);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
const updates = [...inputValues];
|
|
74
|
+
if (inputValues[0] !== hourValue) {
|
|
75
|
+
updates[0] = hourValue;
|
|
76
|
+
}
|
|
77
|
+
if (inputValues[1] !== minuteValue) {
|
|
78
|
+
updates[1] = minuteValue;
|
|
79
|
+
}
|
|
80
|
+
if (inputValues[0] !== hourValue || inputValues[1] !== minuteValue) {
|
|
81
|
+
setInputValues(updates);
|
|
82
|
+
const formattedHours = hourValue.length ? hourValue.padStart(2, "0") : hourValue;
|
|
83
|
+
const formattedMinutes = minuteValue.length ? minuteValue.padStart(2, "0") : minuteValue;
|
|
84
|
+
setFormattedInputValues([formattedHours, formattedMinutes]);
|
|
85
|
+
}
|
|
86
|
+
}, [hourValue, minuteValue, inputValues]);
|
|
72
87
|
const computedValidations = (hrs, mins) => {
|
|
73
88
|
const hoursIsString = typeof hrs === "string";
|
|
74
89
|
const minutesIsString = typeof mins === "string";
|
|
@@ -3,7 +3,8 @@ import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
|
3
3
|
import { TransitionGroup, CSSTransition } from "react-transition-group";
|
|
4
4
|
import Icon from "../icon";
|
|
5
5
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
6
|
-
import { StyledToast,
|
|
6
|
+
import { StyledToast, StyledToastContent, ToastWrapper, StyledPortal } from "./toast.style";
|
|
7
|
+
import { TypeIconStyle as TypeIcon } from "../message/message.style";
|
|
7
8
|
import IconButton from "../icon-button";
|
|
8
9
|
import Events from "../../__internal__/utils/helpers/events";
|
|
9
10
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import TypeIcon from "../message/__internal__/type-icon/type-icon.style";
|
|
3
2
|
import { MessageVariant } from "../message/message.component";
|
|
4
3
|
declare const StyledPortal: import("styled-components").StyledComponent<({ children, className, id, onReposition, inertOptOut, }: import("../portal/portal").PortalProps) => import("react").JSX.Element, any, {
|
|
5
4
|
align?: "center" | "left" | "right" | undefined;
|
|
6
5
|
alignY?: "center" | "top" | "bottom" | undefined;
|
|
7
6
|
isNotice?: boolean | undefined;
|
|
8
7
|
}, never>;
|
|
9
|
-
declare type ToastVariants = MessageVariant
|
|
8
|
+
declare type ToastVariants = Exclude<MessageVariant, "ai">;
|
|
10
9
|
declare type ToastStyleProps = {
|
|
11
10
|
align?: "left" | "center" | "right";
|
|
12
11
|
alignY?: "top" | "center" | "bottom";
|
|
@@ -24,4 +23,4 @@ declare const ToastWrapper: import("styled-components").StyledComponent<"div", a
|
|
|
24
23
|
align?: "center" | "left" | "right" | undefined;
|
|
25
24
|
isNotice?: boolean | undefined;
|
|
26
25
|
}, never>;
|
|
27
|
-
export { StyledPortal, StyledToast,
|
|
26
|
+
export { StyledPortal, StyledToast, StyledToastContent, ToastWrapper };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import TypeIcon from "../message/__internal__/type-icon/type-icon.style";
|
|
3
2
|
import StyledIconButton from "../icon-button/icon-button.style";
|
|
4
3
|
import Portal from "../portal/portal";
|
|
5
4
|
import baseTheme from "../../style/themes/base";
|
|
@@ -224,4 +223,4 @@ const ToastWrapper = styled.div`
|
|
|
224
223
|
display: block;
|
|
225
224
|
`}
|
|
226
225
|
`;
|
|
227
|
-
export { StyledPortal, StyledToast,
|
|
226
|
+
export { StyledPortal, StyledToast, StyledToastContent, ToastWrapper };
|
|
@@ -8,5 +8,5 @@ declare const StyledTypography: import("styled-components").StyledComponent<"spa
|
|
|
8
8
|
textDecoration: string;
|
|
9
9
|
lineHeight: string;
|
|
10
10
|
defaultMargin: string;
|
|
11
|
-
} & TypographyProps, "textDecoration" | "
|
|
11
|
+
} & TypographyProps, "textDecoration" | "as" | "size" | "weight" | "textTransform" | "lineHeight" | "defaultMargin">;
|
|
12
12
|
export default StyledTypography;
|
package/esm/locales/en-gb.js
CHANGED
package/esm/locales/locale.d.ts
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.AiIcon = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
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); }
|
|
11
|
+
const AiIcon = ({
|
|
12
|
+
...rest
|
|
13
|
+
}) => /*#__PURE__*/_react.default.createElement("svg", _extends({}, (0, _tags.default)("ai-icon", rest), {
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
width: "20",
|
|
16
|
+
height: "20",
|
|
17
|
+
fill: "none",
|
|
18
|
+
viewBox: "0 0 20 20"
|
|
19
|
+
}), /*#__PURE__*/_react.default.createElement("g", {
|
|
20
|
+
clipPath: "url(#a)"
|
|
21
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
22
|
+
"data-role": "white-star",
|
|
23
|
+
fill: "#fff",
|
|
24
|
+
d: "m16.378 9.799-3.776-1.49a1.615 1.615 0 0 1-.91-.91l-1.49-3.775c-.537-1.364-2.466-1.364-3.004 0L5.708 7.4a1.615 1.615 0 0 1-.91.91L1.022 9.799c-1.363.537-1.363 2.466 0 3.004l3.776 1.49c.417.163.746.493.91.91l1.49 3.775c.538 1.363 2.467 1.363 3.005 0l1.489-3.776c.164-.416.494-.745.91-.91l3.776-1.489c1.364-.538 1.364-2.467 0-3.004Z"
|
|
25
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
26
|
+
"data-role": "green-circle",
|
|
27
|
+
fill: "#00D639",
|
|
28
|
+
d: "M17.172 5.655a2.827 2.827 0 1 0 0-5.655 2.827 2.827 0 0 0 0 5.655Z"
|
|
29
|
+
})), /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("clipPath", {
|
|
30
|
+
id: "a"
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
32
|
+
fill: "#fff",
|
|
33
|
+
d: "M0 0h20v20H0z"
|
|
34
|
+
}))));
|
|
35
|
+
exports.AiIcon = AiIcon;
|
|
36
|
+
var _default = exports.default = AiIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ai-icon.component";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _aiIcon.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _aiIcon = _interopRequireDefault(require("./ai-icon.component"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -17,7 +17,7 @@ declare const Events: {
|
|
|
17
17
|
/**
|
|
18
18
|
* Determines if event is a keyboard event
|
|
19
19
|
*/
|
|
20
|
-
isKeyboardEvent: (ev: React.SyntheticEvent | Event) => ev is React.KeyboardEvent<Element
|
|
20
|
+
isKeyboardEvent: (ev: React.SyntheticEvent | Event) => ev is KeyboardEvent | React.KeyboardEvent<Element>;
|
|
21
21
|
/**
|
|
22
22
|
* Determines if a number key along the top of the keyboard or a number key on the
|
|
23
23
|
* keypad is pressed
|
|
@@ -83,6 +83,16 @@ var _default = (isDisabled, destructive, isWhite) => ({
|
|
|
83
83
|
${makeColors("var(--colorsActionMajorYang100)")};
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
${isWhite && (!isDisabled || !destructive) ? `
|
|
87
|
+
border-color: var(--colorsActionMajorYang100);
|
|
88
|
+
${makeColors("var(--colorsActionMajorYang100)")};
|
|
89
|
+
&:hover {
|
|
90
|
+
background: var(--colorsActionMajorYang100);
|
|
91
|
+
border-color: var(--colorsActionMajorYang100);
|
|
92
|
+
${makeColors("var(--colorsYin100)")};
|
|
93
|
+
}
|
|
94
|
+
` : ""}
|
|
95
|
+
|
|
86
96
|
${destructive ? `
|
|
87
97
|
border-color: var(--colorsSemanticNegative500);
|
|
88
98
|
${makeColors("var(--colorsSemanticNegative500)")}
|
|
@@ -93,7 +103,7 @@ var _default = (isDisabled, destructive, isWhite) => ({
|
|
|
93
103
|
}
|
|
94
104
|
` : ""}
|
|
95
105
|
|
|
96
|
-
${isDisabled ? `
|
|
106
|
+
${isDisabled && !isWhite ? `
|
|
97
107
|
border-color: var(--colorsActionDisabled500);
|
|
98
108
|
${makeColors("var(--colorsActionMajorYin030)")};
|
|
99
109
|
&:hover {
|
|
@@ -73,13 +73,13 @@ const Button = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
73
73
|
children,
|
|
74
74
|
destructive = false,
|
|
75
75
|
disabled = false,
|
|
76
|
+
isWhite = false,
|
|
76
77
|
fullWidth: fullWidthProp = false,
|
|
77
78
|
href,
|
|
78
79
|
iconPosition: iconPositionProp = "before",
|
|
79
80
|
iconTooltipMessage,
|
|
80
81
|
iconTooltipPosition,
|
|
81
82
|
iconType,
|
|
82
|
-
isWhite = false,
|
|
83
83
|
m = 0,
|
|
84
84
|
noWrap,
|
|
85
85
|
onClick,
|