carbon-react 111.8.3 → 111.8.5
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__/input/input-presentation.component.d.ts +3 -1
- package/esm/__internal__/input/input-presentation.component.js +5 -2
- package/esm/__internal__/input/input-presentation.style.d.ts +1 -1
- package/esm/__internal__/input/input-presentation.style.js +10 -3
- package/esm/__internal__/input-behaviour/useInputBehaviour.js +7 -2
- package/esm/__internal__/input-icon-toggle/input-icon-toggle.style.js +0 -2
- package/esm/components/date/date.style.js +5 -0
- package/esm/components/dialog/dialog.style.js +2 -43
- package/esm/components/form/form.style.js +0 -17
- package/esm/components/link-preview/__internal__/placeholder.component.d.ts +2 -0
- package/esm/components/link-preview/index.d.ts +2 -2
- package/esm/components/link-preview/link-preview.component.d.ts +28 -0
- package/esm/components/link-preview/link-preview.component.js +17 -30
- package/esm/components/link-preview/link-preview.style.d.ts +11 -0
- package/esm/components/select/__internal__/select-text/select-text.component.js +8 -3
- package/esm/components/select/__internal__/select-text/select-text.d.ts +2 -0
- package/esm/components/select/__internal__/select-text/select-text.style.js +4 -1
- package/esm/components/select/multi-select/multi-select.style.js +8 -1
- package/esm/components/select/select-textbox/select-textbox.component.js +3 -2
- package/esm/components/sidebar/sidebar.component.js +2 -2
- package/esm/components/sidebar/sidebar.config.d.ts +4 -0
- package/esm/components/sidebar/sidebar.config.js +5 -1
- package/esm/components/sidebar/sidebar.style.d.ts +2 -1
- package/esm/components/sidebar/sidebar.style.js +11 -0
- package/esm/components/textarea/textarea.component.js +3 -1
- package/esm/components/textarea/textarea.style.d.ts +1 -1
- package/esm/components/textarea/textarea.style.js +10 -5
- package/esm/components/textbox/textbox.component.js +4 -2
- package/esm/style/utils/form-style-utils.d.ts +19 -0
- package/esm/style/utils/form-style-utils.js +99 -0
- package/lib/__internal__/input/input-presentation.component.d.ts +3 -1
- package/lib/__internal__/input/input-presentation.component.js +5 -2
- package/lib/__internal__/input/input-presentation.style.d.ts +1 -1
- package/lib/__internal__/input/input-presentation.style.js +11 -3
- package/lib/__internal__/input-behaviour/useInputBehaviour.js +7 -2
- package/lib/__internal__/input-icon-toggle/input-icon-toggle.style.js +0 -2
- package/lib/components/date/date.style.js +6 -0
- package/lib/components/dialog/dialog.style.js +5 -45
- package/lib/components/form/form.style.js +0 -17
- package/lib/components/link-preview/__internal__/placeholder.component.d.ts +2 -0
- package/lib/components/link-preview/index.d.ts +2 -2
- package/lib/components/link-preview/link-preview.component.d.ts +28 -0
- package/lib/components/link-preview/link-preview.component.js +18 -31
- package/lib/components/link-preview/link-preview.style.d.ts +11 -0
- package/lib/components/select/__internal__/select-text/select-text.component.js +8 -3
- package/lib/components/select/__internal__/select-text/select-text.d.ts +2 -0
- package/lib/components/select/__internal__/select-text/select-text.style.js +7 -1
- package/lib/components/select/multi-select/multi-select.style.js +9 -1
- package/lib/components/select/select-textbox/select-textbox.component.js +3 -2
- package/lib/components/sidebar/sidebar.component.js +2 -2
- package/lib/components/sidebar/sidebar.config.d.ts +4 -0
- package/lib/components/sidebar/sidebar.config.js +10 -2
- package/lib/components/sidebar/sidebar.style.d.ts +2 -1
- package/lib/components/sidebar/sidebar.style.js +13 -0
- package/lib/components/textarea/textarea.component.js +3 -1
- package/lib/components/textarea/textarea.style.d.ts +1 -1
- package/lib/components/textarea/textarea.style.js +10 -6
- package/lib/components/textbox/textbox.component.js +4 -2
- package/lib/style/utils/form-style-utils.d.ts +19 -0
- package/lib/style/utils/form-style-utils.js +113 -0
- package/package.json +1 -1
- package/esm/components/link-preview/link-preview.d.ts +0 -24
- package/lib/components/link-preview/link-preview.d.ts +0 -24
|
@@ -13,10 +13,12 @@ export interface CommonInputPresentationProps extends ValidationProps {
|
|
|
13
13
|
readOnly?: boolean;
|
|
14
14
|
/** Size of an input */
|
|
15
15
|
size?: Sizes;
|
|
16
|
+
/** If true, the component has an icon rendered inside */
|
|
17
|
+
hasIcon?: boolean;
|
|
16
18
|
}
|
|
17
19
|
export interface InputPresentationProps extends CommonInputPresentationProps {
|
|
18
20
|
/** Content to be rendered before the input */
|
|
19
21
|
positionedChildren?: React.ReactNode;
|
|
20
22
|
}
|
|
21
|
-
declare const InputPresentation: ({ children, positionedChildren, inputWidth, align, disabled, readOnly, size, error, warning, info, }: InputPresentationProps) => JSX.Element;
|
|
23
|
+
declare const InputPresentation: ({ children, positionedChildren, inputWidth, align, disabled, readOnly, size, error, warning, info, hasIcon, }: InputPresentationProps) => JSX.Element;
|
|
22
24
|
export default InputPresentation;
|
|
@@ -14,7 +14,8 @@ const InputPresentation = ({
|
|
|
14
14
|
size = "medium",
|
|
15
15
|
error,
|
|
16
16
|
warning,
|
|
17
|
-
info
|
|
17
|
+
info,
|
|
18
|
+
hasIcon
|
|
18
19
|
}) => {
|
|
19
20
|
const {
|
|
20
21
|
hasFocus,
|
|
@@ -55,7 +56,8 @@ const InputPresentation = ({
|
|
|
55
56
|
warning: warning,
|
|
56
57
|
error: error,
|
|
57
58
|
info: info,
|
|
58
|
-
validationRedesignOptIn: validationRedesignOptIn
|
|
59
|
+
validationRedesignOptIn: validationRedesignOptIn,
|
|
60
|
+
hasIcon: hasIcon
|
|
59
61
|
}, children));
|
|
60
62
|
};
|
|
61
63
|
|
|
@@ -64,6 +66,7 @@ InputPresentation.propTypes = {
|
|
|
64
66
|
"children": PropTypes.node,
|
|
65
67
|
"disabled": PropTypes.bool,
|
|
66
68
|
"error": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
69
|
+
"hasIcon": PropTypes.bool,
|
|
67
70
|
"info": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
68
71
|
"inputWidth": PropTypes.number,
|
|
69
72
|
"positionedChildren": PropTypes.node,
|
|
@@ -2,5 +2,5 @@ import { CommonInputPresentationProps } from "./input-presentation.component";
|
|
|
2
2
|
import { InputContextProps } from "../input-behaviour";
|
|
3
3
|
import { CarbonProviderProps } from "../../components/carbon-provider";
|
|
4
4
|
export declare const StyledInputPresentationContainer: import("styled-components").StyledComponent<"div", any, Pick<CommonInputPresentationProps, "inputWidth">, never>;
|
|
5
|
-
declare const InputPresentationStyle: import("styled-components").StyledComponent<"div", any, Pick<InputContextProps, "hasFocus"> & Pick<CommonInputPresentationProps, "disabled" | "error" | "info" | "warning" | "align" | "readOnly" | "size"> & Pick<CarbonProviderProps, "validationRedesignOptIn">, never>;
|
|
5
|
+
declare const InputPresentationStyle: import("styled-components").StyledComponent<"div", any, Pick<InputContextProps, "hasFocus"> & Pick<CommonInputPresentationProps, "disabled" | "error" | "info" | "warning" | "align" | "readOnly" | "size" | "hasIcon"> & Pick<CarbonProviderProps, "validationRedesignOptIn">, never>;
|
|
6
6
|
export default InputPresentationStyle;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import sizes from "./input-sizes.style";
|
|
3
|
+
import StyledInput from "./input.style";
|
|
3
4
|
export const StyledInputPresentationContainer = styled.div`
|
|
4
5
|
flex: 0 0 ${({
|
|
5
6
|
inputWidth
|
|
@@ -49,11 +50,17 @@ const InputPresentationStyle = styled.div`
|
|
|
49
50
|
width: 100%;
|
|
50
51
|
margin: 0;
|
|
51
52
|
${({
|
|
52
|
-
size
|
|
53
|
+
size,
|
|
54
|
+
hasIcon,
|
|
55
|
+
align
|
|
53
56
|
}) => size && css`
|
|
54
57
|
min-height: ${sizes[size].height};
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
|
|
59
|
+
${StyledInput} {
|
|
60
|
+
padding: 0 ${sizes[size].horizontalPadding};
|
|
61
|
+
${hasIcon && align === "right" && "padding-left: 0;"}
|
|
62
|
+
${hasIcon && align === "left" && "padding-right: 0;"}
|
|
63
|
+
}
|
|
57
64
|
`}
|
|
58
65
|
|
|
59
66
|
${({
|
|
@@ -11,8 +11,13 @@ const useInputBehaviour = blockGroupBehaviour => {
|
|
|
11
11
|
}, []); // use mouse down rather than click to accommodate click and drag events too
|
|
12
12
|
|
|
13
13
|
const onMouseDown = useCallback(() => {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
requestAnimationFrame(() => {
|
|
15
|
+
var _inputRef$current;
|
|
16
|
+
|
|
17
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus({
|
|
18
|
+
preventScroll: true
|
|
19
|
+
});
|
|
20
|
+
});
|
|
16
21
|
}, []);
|
|
17
22
|
const onMouseEnter = useCallback(() => setHasMouseOver(true), []);
|
|
18
23
|
const onMouseLeave = useCallback(() => setHasMouseOver(false), []);
|
|
@@ -2,6 +2,7 @@ import styled from "styled-components";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { margin } from "styled-system";
|
|
4
4
|
import baseTheme from "../../style/themes/base";
|
|
5
|
+
import StyledInput from "../../__internal__/input/input.style";
|
|
5
6
|
import StyledInputPresentation from "../../__internal__/input/input-presentation.style";
|
|
6
7
|
const datePickerWidth = {
|
|
7
8
|
large: "140px",
|
|
@@ -16,6 +17,10 @@ const StyledDateInput = styled.div`
|
|
|
16
17
|
width: ${({
|
|
17
18
|
size
|
|
18
19
|
}) => datePickerWidth[size]};
|
|
20
|
+
|
|
21
|
+
${StyledInput} {
|
|
22
|
+
margin-right: -8px;
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
`;
|
|
21
26
|
StyledDateInput.propTypes = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { padding as paddingFn } from "styled-system";
|
|
3
3
|
import baseTheme from "../../style/themes/base";
|
|
4
|
+
import { calculateFormSpacingValues, calculateWidthValue } from "../../style/utils/form-style-utils";
|
|
4
5
|
import { StyledForm, StyledFormFooter, StyledFormContent } from "../form/form.style";
|
|
5
6
|
import { StyledHeaderContent, StyledHeading, StyledHeadingTitle } from "../heading/heading.style";
|
|
6
7
|
import StyledIconButton from "../icon-button/icon-button.style";
|
|
@@ -16,48 +17,6 @@ const dialogSizes = {
|
|
|
16
17
|
"extra-large": "1080px"
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
const calculateWidthValue = props => {
|
|
20
|
-
const {
|
|
21
|
-
paddingLeft,
|
|
22
|
-
paddingRight,
|
|
23
|
-
padding
|
|
24
|
-
} = paddingFn(props);
|
|
25
|
-
const paddingValue = paddingLeft ?? paddingRight ?? padding;
|
|
26
|
-
return paddingValue === undefined ? HORIZONTAL_PADDING : paddingValue;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const calculateFormSpacingValues = (props, isFormContent) => {
|
|
30
|
-
const {
|
|
31
|
-
paddingTop,
|
|
32
|
-
paddingBottom,
|
|
33
|
-
paddingLeft,
|
|
34
|
-
paddingRight,
|
|
35
|
-
padding
|
|
36
|
-
} = paddingFn(props);
|
|
37
|
-
const spacingTopValue = paddingTop ?? padding ?? CONTENT_TOP_PADDING;
|
|
38
|
-
const spacingRightValue = paddingRight ?? padding ?? HORIZONTAL_PADDING;
|
|
39
|
-
const spacingBottomValue = paddingBottom ?? padding ?? CONTENT_BOTTOM_PADDING;
|
|
40
|
-
const spacingLeftValue = paddingLeft ?? padding ?? HORIZONTAL_PADDING;
|
|
41
|
-
|
|
42
|
-
const setNegativeValue = value => `calc(-1px * ${value})`;
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
"margin-left": setNegativeValue(spacingLeftValue),
|
|
46
|
-
"margin-right": setNegativeValue(spacingRightValue),
|
|
47
|
-
...(isFormContent && {
|
|
48
|
-
"margin-top": setNegativeValue(spacingTopValue),
|
|
49
|
-
"padding-top": spacingTopValue,
|
|
50
|
-
"padding-bottom": spacingBottomValue,
|
|
51
|
-
"padding-left": spacingLeftValue,
|
|
52
|
-
"padding-right": spacingRightValue
|
|
53
|
-
}),
|
|
54
|
-
...(!isFormContent && {
|
|
55
|
-
"margin-bottom": setNegativeValue(spacingBottomValue),
|
|
56
|
-
bottom: setNegativeValue(spacingBottomValue)
|
|
57
|
-
})
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
|
|
61
20
|
const calculatePaddingTopInnerContent = ({
|
|
62
21
|
py,
|
|
63
22
|
p
|
|
@@ -103,7 +62,7 @@ const StyledDialog = styled.div`
|
|
|
103
62
|
}
|
|
104
63
|
|
|
105
64
|
${StyledFormFooter}.sticky {
|
|
106
|
-
|
|
65
|
+
${calculateWidthValue};
|
|
107
66
|
${props => calculateFormSpacingValues(props, false)}
|
|
108
67
|
}
|
|
109
68
|
|
|
@@ -126,23 +126,6 @@ export const StyledForm = styled.form`
|
|
|
126
126
|
|
|
127
127
|
${isInSidebar && css`
|
|
128
128
|
min-height: 100%;
|
|
129
|
-
${StyledFormContent}.sticky {
|
|
130
|
-
padding-right: var(--spacing400);
|
|
131
|
-
padding-left: var(--spacing400);
|
|
132
|
-
padding-top: 27px;
|
|
133
|
-
margin-right: calc(-1 * var(--spacing400));
|
|
134
|
-
margin-left: calc(-1 * var(--spacing400));
|
|
135
|
-
margin-top: -27px;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
${StyledFormFooter}.sticky {
|
|
139
|
-
margin-left: calc(-1 * var(--spacing400));
|
|
140
|
-
margin-bottom: calc(-1 * var(--spacing400));
|
|
141
|
-
width: calc(100% + var(--spacing800));
|
|
142
|
-
padding-left: var(--spacing400);
|
|
143
|
-
padding-right: var(--spacing400);
|
|
144
|
-
bottom: -32px;
|
|
145
|
-
}
|
|
146
129
|
`}
|
|
147
130
|
`}
|
|
148
131
|
`;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "./link-preview";
|
|
2
|
-
export
|
|
1
|
+
export { default } from "./link-preview.component";
|
|
2
|
+
export type { LinkPreviewProps } from "./link-preview.component";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface ImageShape {
|
|
3
|
+
/** The url string to be passed to image src */
|
|
4
|
+
url: string;
|
|
5
|
+
/** The string to be passed to image alt */
|
|
6
|
+
alt?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface LinkPreviewProps {
|
|
9
|
+
/** Used to set the root element to either an anchor link or div container */
|
|
10
|
+
as?: "a" | "div";
|
|
11
|
+
/** The description to be displayed */
|
|
12
|
+
description?: string;
|
|
13
|
+
/** The config for the image to be displayed */
|
|
14
|
+
image?: ImageShape;
|
|
15
|
+
/** Flag to trigger the loading animation */
|
|
16
|
+
isLoading?: boolean;
|
|
17
|
+
/** The callback to handle the deleting of a Preview, to hide the close button do not set this prop */
|
|
18
|
+
onClose?: (url?: string) => void;
|
|
19
|
+
/** The title to be displayed */
|
|
20
|
+
title?: string;
|
|
21
|
+
/** The url string to be displayed and to serve as the link's src */
|
|
22
|
+
url?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const LinkPreview: {
|
|
25
|
+
({ as, description, image, isLoading, onClose, title, url, ...rest }: LinkPreviewProps): JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
28
|
+
export default LinkPreview;
|
|
@@ -40,13 +40,15 @@ const LinkPreview = ({
|
|
|
40
40
|
return url;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
const linkProps = canRenderAsLink ? {
|
|
44
|
+
href: url,
|
|
45
|
+
target: "_blank",
|
|
46
|
+
rel: "noopener noreferrer"
|
|
47
|
+
} : {};
|
|
43
48
|
return /*#__PURE__*/React.createElement(StyledLinkPreview, _extends({
|
|
44
49
|
as: loadingState ? "div" : as,
|
|
45
|
-
tabIndex: loadingState || as === "div" ? -1 : 0
|
|
46
|
-
|
|
47
|
-
target: canRenderAsLink ? "_blank" : undefined,
|
|
48
|
-
rel: canRenderAsLink ? "noopener noreferrer" : undefined
|
|
49
|
-
}, rest), imageProps().src ? /*#__PURE__*/React.createElement(Image, imageProps()) : /*#__PURE__*/React.createElement(Placeholder, null), /*#__PURE__*/React.createElement(StyledPreviewWrapper, {
|
|
50
|
+
tabIndex: loadingState || as === "div" ? -1 : 0
|
|
51
|
+
}, linkProps, rest), imageProps().src ? /*#__PURE__*/React.createElement(Image, imageProps()) : /*#__PURE__*/React.createElement(Placeholder, null), /*#__PURE__*/React.createElement(StyledPreviewWrapper, {
|
|
50
52
|
isLoading: loadingState
|
|
51
53
|
}, /*#__PURE__*/React.createElement(Preview, {
|
|
52
54
|
loading: loadingState,
|
|
@@ -60,32 +62,17 @@ const LinkPreview = ({
|
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
LinkPreview.propTypes = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/** The config for the image to be displayed */
|
|
70
|
-
image: PropTypes.shape({
|
|
71
|
-
/** The url string to be passed to image src */
|
|
72
|
-
url: PropTypes.string.isRequired,
|
|
73
|
-
|
|
74
|
-
/** The string to be passed to image alt */
|
|
75
|
-
alt: PropTypes.string
|
|
65
|
+
"as": PropTypes.oneOf(["a", "div"]),
|
|
66
|
+
"description": PropTypes.string,
|
|
67
|
+
"image": PropTypes.shape({
|
|
68
|
+
"alt": PropTypes.string,
|
|
69
|
+
"url": PropTypes.string.isRequired
|
|
76
70
|
}),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
/** The callback to handle the deleting of a Preview, to hide the close button do not set this prop */
|
|
82
|
-
onClose: PropTypes.func,
|
|
83
|
-
|
|
84
|
-
/** The title to be displayed */
|
|
85
|
-
title: PropTypes.string,
|
|
86
|
-
|
|
87
|
-
/** The url string to be displayed and to serve as the link's src */
|
|
88
|
-
url: PropTypes.string
|
|
71
|
+
"isLoading": PropTypes.bool,
|
|
72
|
+
"onClose": PropTypes.func,
|
|
73
|
+
"title": PropTypes.string,
|
|
74
|
+
"url": PropTypes.string
|
|
89
75
|
};
|
|
76
|
+
export { LinkPreview };
|
|
90
77
|
LinkPreview.displayName = "LinkPreview";
|
|
91
78
|
export default LinkPreview;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const StyledLinkPreview: import("styled-components").StyledComponent<"a", any, {
|
|
2
|
+
as?: "a" | "div" | undefined;
|
|
3
|
+
}, never>;
|
|
4
|
+
declare const StyledCloseIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
declare const StyledPreviewWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
}, never>;
|
|
8
|
+
declare const StyledTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
|
+
declare const StyledDescription: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
|
+
declare const StyledUrl: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
+
export { StyledLinkPreview, StyledCloseIconWrapper, StyledPreviewWrapper, StyledTitle, StyledDescription, StyledUrl, };
|
|
@@ -11,7 +11,8 @@ const SelectText = ({
|
|
|
11
11
|
placeholder,
|
|
12
12
|
readOnly,
|
|
13
13
|
textId,
|
|
14
|
-
transparent
|
|
14
|
+
transparent,
|
|
15
|
+
size = "medium"
|
|
15
16
|
}) => {
|
|
16
17
|
const hasPlaceholder = !disabled && !readOnly && !formattedValue;
|
|
17
18
|
|
|
@@ -31,7 +32,8 @@ const SelectText = ({
|
|
|
31
32
|
readOnly: readOnly,
|
|
32
33
|
role: "button",
|
|
33
34
|
tabIndex: "-1",
|
|
34
|
-
transparent: transparent
|
|
35
|
+
transparent: transparent,
|
|
36
|
+
size: size
|
|
35
37
|
}, hasPlaceholder ? placeholder : formattedValue);
|
|
36
38
|
};
|
|
37
39
|
|
|
@@ -61,6 +63,9 @@ SelectText.propTypes = {
|
|
|
61
63
|
transparent: PropTypes.bool,
|
|
62
64
|
|
|
63
65
|
/** Id of the Select Text element */
|
|
64
|
-
textId: PropTypes.string
|
|
66
|
+
textId: PropTypes.string,
|
|
67
|
+
|
|
68
|
+
/** Component size */
|
|
69
|
+
size: PropTypes.string
|
|
65
70
|
};
|
|
66
71
|
export default SelectText;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
+
import sizes from "../../../../__internal__/input/input-sizes.style";
|
|
2
3
|
const StyledSelectText = styled.span`
|
|
3
4
|
${({
|
|
4
5
|
disabled,
|
|
5
6
|
hasPlaceholder,
|
|
6
7
|
readOnly,
|
|
7
|
-
transparent
|
|
8
|
+
transparent,
|
|
9
|
+
size
|
|
8
10
|
}) => css`
|
|
9
11
|
align-items: center;
|
|
10
12
|
display: inline-flex;
|
|
@@ -17,6 +19,7 @@ const StyledSelectText = styled.span`
|
|
|
17
19
|
white-space: nowrap;
|
|
18
20
|
width: 30px;
|
|
19
21
|
z-index: 1;
|
|
22
|
+
padding-left: ${sizes[size].horizontalPadding};
|
|
20
23
|
|
|
21
24
|
${transparent && css`
|
|
22
25
|
font-weight: 900;
|
|
@@ -4,6 +4,7 @@ import { baseTheme } from "../../../style/themes";
|
|
|
4
4
|
import InputIconToggleStyle from "../../../__internal__/input-icon-toggle/input-icon-toggle.style";
|
|
5
5
|
import StyledSelect from "../select.style";
|
|
6
6
|
import InputPresentationStyle from "../../../__internal__/input/input-presentation.style";
|
|
7
|
+
import StyledInput from "../../../__internal__/input/input.style";
|
|
7
8
|
import sizes from "../../../__internal__/input/input-sizes.style";
|
|
8
9
|
const StyledSelectPillContainer = styled.div`
|
|
9
10
|
display: flex;
|
|
@@ -18,7 +19,6 @@ const StyledSelectPillContainer = styled.div`
|
|
|
18
19
|
`;
|
|
19
20
|
const StyledSelectMultiSelect = styled(StyledSelect)`
|
|
20
21
|
${InputIconToggleStyle} {
|
|
21
|
-
margin-right: 0;
|
|
22
22
|
position: absolute;
|
|
23
23
|
right: 0;
|
|
24
24
|
height: 100%;
|
|
@@ -28,7 +28,14 @@ const StyledSelectMultiSelect = styled(StyledSelect)`
|
|
|
28
28
|
padding-right: ${({
|
|
29
29
|
size
|
|
30
30
|
}) => sizes[size].height};
|
|
31
|
+
padding-left: ${({
|
|
32
|
+
size
|
|
33
|
+
}) => sizes[size].horizontalPadding};
|
|
31
34
|
position: relative;
|
|
35
|
+
|
|
36
|
+
${StyledInput} {
|
|
37
|
+
padding: 0;
|
|
38
|
+
}
|
|
32
39
|
}
|
|
33
40
|
`;
|
|
34
41
|
const StyledAccessibilityLabelContainer = styled.div`
|
|
@@ -32,7 +32,7 @@ const SelectTextbox = ({
|
|
|
32
32
|
isOpen,
|
|
33
33
|
readOnly,
|
|
34
34
|
placeholder,
|
|
35
|
-
size,
|
|
35
|
+
size = "medium",
|
|
36
36
|
onClick,
|
|
37
37
|
onFocus,
|
|
38
38
|
onBlur,
|
|
@@ -122,7 +122,8 @@ const SelectTextbox = ({
|
|
|
122
122
|
placeholder: placeholder || l.select.placeholder(),
|
|
123
123
|
onClick: handleTextboxClick,
|
|
124
124
|
disabled: disabled,
|
|
125
|
-
readOnly: readOnly
|
|
125
|
+
readOnly: readOnly,
|
|
126
|
+
size: size
|
|
126
127
|
}, restProps));
|
|
127
128
|
}
|
|
128
129
|
|
|
@@ -65,7 +65,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
|
|
|
65
65
|
"data-element": rest["data-element"],
|
|
66
66
|
"data-role": rest["data-role"]
|
|
67
67
|
};
|
|
68
|
-
const sidebar = /*#__PURE__*/React.createElement(StyledSidebar, {
|
|
68
|
+
const sidebar = /*#__PURE__*/React.createElement(StyledSidebar, _extends({
|
|
69
69
|
"aria-modal": !enableBackgroundUI && (topModal === null || topModal === void 0 ? void 0 : topModal.contains(sidebarRef.current)),
|
|
70
70
|
"aria-describedby": ariaDescribedBy,
|
|
71
71
|
"aria-label": ariaLabel,
|
|
@@ -76,7 +76,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
|
|
|
76
76
|
"data-element": "sidebar",
|
|
77
77
|
onCancel: onCancel,
|
|
78
78
|
role: role
|
|
79
|
-
}, header && /*#__PURE__*/React.createElement(SidebarHeader, {
|
|
79
|
+
}, filterStyledSystemPaddingProps(rest)), header && /*#__PURE__*/React.createElement(SidebarHeader, {
|
|
80
80
|
id: headerId
|
|
81
81
|
}, header), closeIcon(), /*#__PURE__*/React.createElement(Box, _extends({
|
|
82
82
|
"data-element": "sidebar-content",
|
|
@@ -9,3 +9,7 @@ export declare const SIDEBAR_SIZES_CSS: {
|
|
|
9
9
|
};
|
|
10
10
|
export declare const SIDEBAR_SIZES: string[];
|
|
11
11
|
export declare const SIDEBAR_ALIGNMENTS: string[];
|
|
12
|
+
export declare const SIDEBAR_TOP_SPACING = "27px";
|
|
13
|
+
export declare const SIDEBAR_BOTTOM_SPACING = "var(--spacing400)";
|
|
14
|
+
export declare const SIDEBAR_LEFT_PADDING = "var(--spacing400)";
|
|
15
|
+
export declare const SIDEBAR_RIGHT_PADDING = "var(--spacing400)";
|
|
@@ -8,4 +8,8 @@ export const SIDEBAR_SIZES_CSS = {
|
|
|
8
8
|
"extra-large": "814px"
|
|
9
9
|
};
|
|
10
10
|
export const SIDEBAR_SIZES = ["extra-small", "small", "medium-small", "medium", "medium-large", "large", "extra-large"];
|
|
11
|
-
export const SIDEBAR_ALIGNMENTS = ["left", "right"];
|
|
11
|
+
export const SIDEBAR_ALIGNMENTS = ["left", "right"];
|
|
12
|
+
export const SIDEBAR_TOP_SPACING = "27px";
|
|
13
|
+
export const SIDEBAR_BOTTOM_SPACING = "var(--spacing400)";
|
|
14
|
+
export const SIDEBAR_LEFT_PADDING = "var(--spacing400)";
|
|
15
|
+
export const SIDEBAR_RIGHT_PADDING = "var(--spacing400)";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { PaddingProps } from "styled-system";
|
|
1
2
|
import { SidebarProps } from "./sidebar.component";
|
|
2
3
|
declare type StyledSidebarProps = {
|
|
3
4
|
onCancel?: SidebarProps["onCancel"];
|
|
4
5
|
position?: SidebarProps["position"];
|
|
5
6
|
size?: SidebarProps["size"];
|
|
6
7
|
};
|
|
7
|
-
declare const StyledSidebar: import("styled-components").StyledComponent<"div", any, StyledSidebarProps
|
|
8
|
+
declare const StyledSidebar: import("styled-components").StyledComponent<"div", any, StyledSidebarProps & PaddingProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>, never>;
|
|
8
9
|
export default StyledSidebar;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import baseTheme from "../../style/themes/base";
|
|
3
3
|
import StyledIconButton from "../icon-button/icon-button.style";
|
|
4
|
+
import { calculateFormSpacingValues, calculateWidthValue } from "../../style/utils/form-style-utils";
|
|
5
|
+
import { StyledFormContent, StyledFormFooter } from "../form/form.style";
|
|
4
6
|
import { SIDEBAR_SIZES_CSS } from "./sidebar.config";
|
|
5
7
|
const StyledSidebar = styled.div`
|
|
6
8
|
// prevents outline being added in safari
|
|
@@ -8,6 +10,15 @@ const StyledSidebar = styled.div`
|
|
|
8
10
|
outline: none;
|
|
9
11
|
}
|
|
10
12
|
|
|
13
|
+
${StyledFormContent} {
|
|
14
|
+
${props => calculateFormSpacingValues(props, true, "sidebar")}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
${StyledFormFooter}.sticky {
|
|
18
|
+
${calculateWidthValue}
|
|
19
|
+
${props => calculateFormSpacingValues(props, false, "sidebar")}
|
|
20
|
+
}
|
|
21
|
+
|
|
11
22
|
${({
|
|
12
23
|
onCancel,
|
|
13
24
|
position,
|
|
@@ -117,6 +117,7 @@ const Textarea = ({
|
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
}, [expandable]);
|
|
120
|
+
const hasIconInside = !!(inputIcon || validationIconId && !validationOnLabel);
|
|
120
121
|
return /*#__PURE__*/React.createElement(TooltipProvider, {
|
|
121
122
|
tooltipPosition: tooltipPosition,
|
|
122
123
|
helpAriaLabel: helpAriaLabel
|
|
@@ -124,7 +125,8 @@ const Textarea = ({
|
|
|
124
125
|
labelInline: labelInline,
|
|
125
126
|
"data-component": dataComponent,
|
|
126
127
|
"data-role": dataRole,
|
|
127
|
-
"data-element": dataElement
|
|
128
|
+
"data-element": dataElement,
|
|
129
|
+
hasIcon: hasIconInside
|
|
128
130
|
}, filterStyledSystemMarginProps(props)), /*#__PURE__*/React.createElement(FormField, {
|
|
129
131
|
fieldHelp: computeLabelPropValues(fieldHelp),
|
|
130
132
|
fieldHelpId: fieldHelpId,
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { margin } from "styled-system";
|
|
3
|
-
import InputPresentationStyle from "../../__internal__/input/input-presentation.style";
|
|
4
3
|
import StyledInput from "../../__internal__/input/input.style";
|
|
5
4
|
import { StyledLabelContainer } from "../../__internal__/label/label.style";
|
|
6
5
|
import InputIconToggleStyle from "../../__internal__/input-icon-toggle/input-icon-toggle.style";
|
|
7
6
|
import BaseTheme from "../../style/themes/base";
|
|
8
|
-
export const MIN_HEIGHT =
|
|
7
|
+
export const MIN_HEIGHT = 64;
|
|
9
8
|
const StyledTextarea = styled.div`
|
|
10
9
|
${margin};
|
|
11
10
|
|
|
12
11
|
${StyledInput} {
|
|
12
|
+
box-sizing: border-box;
|
|
13
13
|
resize: none;
|
|
14
14
|
min-height: ${MIN_HEIGHT}px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
${InputPresentationStyle} {
|
|
18
15
|
padding: var(--spacing150) var(--spacing200);
|
|
16
|
+
|
|
17
|
+
${({
|
|
18
|
+
hasIcon
|
|
19
|
+
}) => hasIcon && "padding-right: var(--spacing500)"}
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
${({
|
|
@@ -29,6 +30,10 @@ const StyledTextarea = styled.div`
|
|
|
29
30
|
|
|
30
31
|
${InputIconToggleStyle} {
|
|
31
32
|
height: 40px;
|
|
33
|
+
position: absolute;
|
|
34
|
+
height: 100%;
|
|
35
|
+
top: 0px;
|
|
36
|
+
right: 4px;
|
|
32
37
|
}
|
|
33
38
|
`;
|
|
34
39
|
StyledTextarea.defaultProps = {
|
|
@@ -18,7 +18,7 @@ import { NewValidationContext } from "../carbon-provider/carbon-provider.compone
|
|
|
18
18
|
import NumeralDateContext from "../numeral-date/numeral-date-context";
|
|
19
19
|
|
|
20
20
|
const Textbox = ({
|
|
21
|
-
align,
|
|
21
|
+
align = "left",
|
|
22
22
|
autoFocus,
|
|
23
23
|
children,
|
|
24
24
|
disabled,
|
|
@@ -98,6 +98,7 @@ const Textbox = ({
|
|
|
98
98
|
fieldHelp
|
|
99
99
|
});
|
|
100
100
|
const labelId = label ? externalLabelId || internalLabelId : "";
|
|
101
|
+
const hasIconInside = !!(inputIcon || validationIconId && !validationOnLabel);
|
|
101
102
|
return /*#__PURE__*/React.createElement(TooltipProvider, {
|
|
102
103
|
helpAriaLabel: helpAriaLabel,
|
|
103
104
|
tooltipPosition: tooltipPosition
|
|
@@ -138,7 +139,8 @@ const Textbox = ({
|
|
|
138
139
|
warning: warning,
|
|
139
140
|
info: info,
|
|
140
141
|
inputWidth: inputWidth || 100 - labelWidth,
|
|
141
|
-
positionedChildren: positionedChildren
|
|
142
|
+
positionedChildren: positionedChildren,
|
|
143
|
+
hasIcon: hasIconInside
|
|
142
144
|
}, leftChildren, prefix && /*#__PURE__*/React.createElement(StyledPrefix, {
|
|
143
145
|
"data-element": "textbox-prefix"
|
|
144
146
|
}, prefix), validationRedesignOptIn && !disableErrorBorder && (error || warning) && /*#__PURE__*/React.createElement(ErrorBorder, {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PaddingProps } from "styled-system";
|
|
2
|
+
declare type ContainerComponent = "dialog" | "sidebar";
|
|
3
|
+
export declare const calculateWidthValue: (props: PaddingProps) => string;
|
|
4
|
+
export declare const calculateFormSpacingValues: (props: PaddingProps, isFormContent: boolean, containerComponent?: ContainerComponent) => {
|
|
5
|
+
"margin-top": string;
|
|
6
|
+
"padding-top": string;
|
|
7
|
+
"padding-bottom": string | undefined;
|
|
8
|
+
"padding-left": string;
|
|
9
|
+
"padding-right": string;
|
|
10
|
+
"margin-left": string;
|
|
11
|
+
"margin-right": string;
|
|
12
|
+
} | {
|
|
13
|
+
"margin-bottom": string;
|
|
14
|
+
"padding-left": string | undefined;
|
|
15
|
+
"padding-right": string | undefined;
|
|
16
|
+
"margin-left": string;
|
|
17
|
+
"margin-right": string;
|
|
18
|
+
};
|
|
19
|
+
export {};
|