carbon-react 111.8.3 → 111.8.4
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/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/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/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/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/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/package.json +1 -1
|
@@ -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 = {
|
|
@@ -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
|
|
|
@@ -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, {
|
|
@@ -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;
|
|
@@ -31,7 +31,8 @@ const InputPresentation = ({
|
|
|
31
31
|
size = "medium",
|
|
32
32
|
error,
|
|
33
33
|
warning,
|
|
34
|
-
info
|
|
34
|
+
info,
|
|
35
|
+
hasIcon
|
|
35
36
|
}) => {
|
|
36
37
|
const {
|
|
37
38
|
hasFocus,
|
|
@@ -72,7 +73,8 @@ const InputPresentation = ({
|
|
|
72
73
|
warning: warning,
|
|
73
74
|
error: error,
|
|
74
75
|
info: info,
|
|
75
|
-
validationRedesignOptIn: validationRedesignOptIn
|
|
76
|
+
validationRedesignOptIn: validationRedesignOptIn,
|
|
77
|
+
hasIcon: hasIcon
|
|
76
78
|
}, children));
|
|
77
79
|
};
|
|
78
80
|
|
|
@@ -81,6 +83,7 @@ InputPresentation.propTypes = {
|
|
|
81
83
|
"children": _propTypes.default.node,
|
|
82
84
|
"disabled": _propTypes.default.bool,
|
|
83
85
|
"error": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
86
|
+
"hasIcon": _propTypes.default.bool,
|
|
84
87
|
"info": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
85
88
|
"inputWidth": _propTypes.default.number,
|
|
86
89
|
"positionedChildren": _propTypes.default.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;
|
|
@@ -9,6 +9,8 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
9
9
|
|
|
10
10
|
var _inputSizes = _interopRequireDefault(require("./input-sizes.style"));
|
|
11
11
|
|
|
12
|
+
var _input = _interopRequireDefault(require("./input.style"));
|
|
13
|
+
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
|
|
14
16
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -65,11 +67,17 @@ const InputPresentationStyle = _styledComponents.default.div`
|
|
|
65
67
|
width: 100%;
|
|
66
68
|
margin: 0;
|
|
67
69
|
${({
|
|
68
|
-
size
|
|
70
|
+
size,
|
|
71
|
+
hasIcon,
|
|
72
|
+
align
|
|
69
73
|
}) => size && (0, _styledComponents.css)`
|
|
70
74
|
min-height: ${_inputSizes.default[size].height};
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
|
|
76
|
+
${_input.default} {
|
|
77
|
+
padding: 0 ${_inputSizes.default[size].horizontalPadding};
|
|
78
|
+
${hasIcon && align === "right" && "padding-left: 0;"}
|
|
79
|
+
${hasIcon && align === "left" && "padding-right: 0;"}
|
|
80
|
+
}
|
|
73
81
|
`}
|
|
74
82
|
|
|
75
83
|
${({
|
|
@@ -18,8 +18,13 @@ const useInputBehaviour = blockGroupBehaviour => {
|
|
|
18
18
|
}, []); // use mouse down rather than click to accommodate click and drag events too
|
|
19
19
|
|
|
20
20
|
const onMouseDown = (0, _react.useCallback)(() => {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
requestAnimationFrame(() => {
|
|
22
|
+
var _inputRef$current;
|
|
23
|
+
|
|
24
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus({
|
|
25
|
+
preventScroll: true
|
|
26
|
+
});
|
|
27
|
+
});
|
|
23
28
|
}, []);
|
|
24
29
|
const onMouseEnter = (0, _react.useCallback)(() => setHasMouseOver(true), []);
|
|
25
30
|
const onMouseLeave = (0, _react.useCallback)(() => setHasMouseOver(false), []);
|
|
@@ -35,8 +35,6 @@ const InputIconToggleStyle = _styledComponents.default.span.attrs(({
|
|
|
35
35
|
${({
|
|
36
36
|
size = "medium"
|
|
37
37
|
}) => (0, _styledComponents.css)`
|
|
38
|
-
margin-right: calc(-1 * ${_inputSizes.default[size].horizontalPadding});
|
|
39
|
-
margin-left: calc(-1 * ${_inputSizes.default[size].horizontalPadding});
|
|
40
38
|
width: ${_inputSizes.default[size].height};
|
|
41
39
|
`}
|
|
42
40
|
|
|
@@ -13,6 +13,8 @@ var _styledSystem = require("styled-system");
|
|
|
13
13
|
|
|
14
14
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
15
15
|
|
|
16
|
+
var _input = _interopRequireDefault(require("../../__internal__/input/input.style"));
|
|
17
|
+
|
|
16
18
|
var _inputPresentation = _interopRequireDefault(require("../../__internal__/input/input-presentation.style"));
|
|
17
19
|
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -30,6 +32,10 @@ const StyledDateInput = _styledComponents.default.div`
|
|
|
30
32
|
width: ${({
|
|
31
33
|
size
|
|
32
34
|
}) => datePickerWidth[size]};
|
|
35
|
+
|
|
36
|
+
${_input.default} {
|
|
37
|
+
margin-right: -8px;
|
|
38
|
+
}
|
|
33
39
|
}
|
|
34
40
|
`;
|
|
35
41
|
StyledDateInput.propTypes = {
|
|
@@ -22,7 +22,8 @@ const SelectText = ({
|
|
|
22
22
|
placeholder,
|
|
23
23
|
readOnly,
|
|
24
24
|
textId,
|
|
25
|
-
transparent
|
|
25
|
+
transparent,
|
|
26
|
+
size = "medium"
|
|
26
27
|
}) => {
|
|
27
28
|
const hasPlaceholder = !disabled && !readOnly && !formattedValue;
|
|
28
29
|
|
|
@@ -42,7 +43,8 @@ const SelectText = ({
|
|
|
42
43
|
readOnly: readOnly,
|
|
43
44
|
role: "button",
|
|
44
45
|
tabIndex: "-1",
|
|
45
|
-
transparent: transparent
|
|
46
|
+
transparent: transparent,
|
|
47
|
+
size: size
|
|
46
48
|
}, hasPlaceholder ? placeholder : formattedValue);
|
|
47
49
|
};
|
|
48
50
|
|
|
@@ -72,7 +74,10 @@ SelectText.propTypes = {
|
|
|
72
74
|
transparent: _propTypes.default.bool,
|
|
73
75
|
|
|
74
76
|
/** Id of the Select Text element */
|
|
75
|
-
textId: _propTypes.default.string
|
|
77
|
+
textId: _propTypes.default.string,
|
|
78
|
+
|
|
79
|
+
/** Component size */
|
|
80
|
+
size: _propTypes.default.string
|
|
76
81
|
};
|
|
77
82
|
var _default = SelectText;
|
|
78
83
|
exports.default = _default;
|
|
@@ -7,6 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
|
|
10
|
+
var _inputSizes = _interopRequireDefault(require("../../../../__internal__/input/input-sizes.style"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
10
14
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
11
15
|
|
|
12
16
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -16,7 +20,8 @@ const StyledSelectText = _styledComponents.default.span`
|
|
|
16
20
|
disabled,
|
|
17
21
|
hasPlaceholder,
|
|
18
22
|
readOnly,
|
|
19
|
-
transparent
|
|
23
|
+
transparent,
|
|
24
|
+
size
|
|
20
25
|
}) => (0, _styledComponents.css)`
|
|
21
26
|
align-items: center;
|
|
22
27
|
display: inline-flex;
|
|
@@ -29,6 +34,7 @@ const StyledSelectText = _styledComponents.default.span`
|
|
|
29
34
|
white-space: nowrap;
|
|
30
35
|
width: 30px;
|
|
31
36
|
z-index: 1;
|
|
37
|
+
padding-left: ${_inputSizes.default[size].horizontalPadding};
|
|
32
38
|
|
|
33
39
|
${transparent && (0, _styledComponents.css)`
|
|
34
40
|
font-weight: 900;
|
|
@@ -17,6 +17,8 @@ var _select = _interopRequireDefault(require("../select.style"));
|
|
|
17
17
|
|
|
18
18
|
var _inputPresentation = _interopRequireDefault(require("../../../__internal__/input/input-presentation.style"));
|
|
19
19
|
|
|
20
|
+
var _input = _interopRequireDefault(require("../../../__internal__/input/input.style"));
|
|
21
|
+
|
|
20
22
|
var _inputSizes = _interopRequireDefault(require("../../../__internal__/input/input-sizes.style"));
|
|
21
23
|
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -35,7 +37,6 @@ const StyledSelectPillContainer = _styledComponents.default.div`
|
|
|
35
37
|
exports.StyledSelectPillContainer = StyledSelectPillContainer;
|
|
36
38
|
const StyledSelectMultiSelect = (0, _styledComponents.default)(_select.default)`
|
|
37
39
|
${_inputIconToggle.default} {
|
|
38
|
-
margin-right: 0;
|
|
39
40
|
position: absolute;
|
|
40
41
|
right: 0;
|
|
41
42
|
height: 100%;
|
|
@@ -45,7 +46,14 @@ const StyledSelectMultiSelect = (0, _styledComponents.default)(_select.default)`
|
|
|
45
46
|
padding-right: ${({
|
|
46
47
|
size
|
|
47
48
|
}) => _inputSizes.default[size].height};
|
|
49
|
+
padding-left: ${({
|
|
50
|
+
size
|
|
51
|
+
}) => _inputSizes.default[size].horizontalPadding};
|
|
48
52
|
position: relative;
|
|
53
|
+
|
|
54
|
+
${_input.default} {
|
|
55
|
+
padding: 0;
|
|
56
|
+
}
|
|
49
57
|
}
|
|
50
58
|
`;
|
|
51
59
|
exports.StyledSelectMultiSelect = StyledSelectMultiSelect;
|
|
@@ -53,7 +53,7 @@ const SelectTextbox = ({
|
|
|
53
53
|
isOpen,
|
|
54
54
|
readOnly,
|
|
55
55
|
placeholder,
|
|
56
|
-
size,
|
|
56
|
+
size = "medium",
|
|
57
57
|
onClick,
|
|
58
58
|
onFocus,
|
|
59
59
|
onBlur,
|
|
@@ -143,7 +143,8 @@ const SelectTextbox = ({
|
|
|
143
143
|
placeholder: placeholder || l.select.placeholder(),
|
|
144
144
|
onClick: handleTextboxClick,
|
|
145
145
|
disabled: disabled,
|
|
146
|
-
readOnly: readOnly
|
|
146
|
+
readOnly: readOnly,
|
|
147
|
+
size: size
|
|
147
148
|
}, restProps));
|
|
148
149
|
}
|
|
149
150
|
|
|
@@ -147,6 +147,7 @@ const Textarea = ({
|
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
}, [expandable]);
|
|
150
|
+
const hasIconInside = !!(inputIcon || validationIconId && !validationOnLabel);
|
|
150
151
|
return /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
|
|
151
152
|
tooltipPosition: tooltipPosition,
|
|
152
153
|
helpAriaLabel: helpAriaLabel
|
|
@@ -154,7 +155,8 @@ const Textarea = ({
|
|
|
154
155
|
labelInline: labelInline,
|
|
155
156
|
"data-component": dataComponent,
|
|
156
157
|
"data-role": dataRole,
|
|
157
|
-
"data-element": dataElement
|
|
158
|
+
"data-element": dataElement,
|
|
159
|
+
hasIcon: hasIconInside
|
|
158
160
|
}, (0, _utils.filterStyledSystemMarginProps)(props)), /*#__PURE__*/_react.default.createElement(_formField.default, {
|
|
159
161
|
fieldHelp: computeLabelPropValues(fieldHelp),
|
|
160
162
|
fieldHelpId: fieldHelpId,
|
|
@@ -9,8 +9,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
9
9
|
|
|
10
10
|
var _styledSystem = require("styled-system");
|
|
11
11
|
|
|
12
|
-
var _inputPresentation = _interopRequireDefault(require("../../__internal__/input/input-presentation.style"));
|
|
13
|
-
|
|
14
12
|
var _input = _interopRequireDefault(require("../../__internal__/input/input.style"));
|
|
15
13
|
|
|
16
14
|
var _label = require("../../__internal__/label/label.style");
|
|
@@ -25,18 +23,20 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
25
23
|
|
|
26
24
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
25
|
|
|
28
|
-
const MIN_HEIGHT =
|
|
26
|
+
const MIN_HEIGHT = 64;
|
|
29
27
|
exports.MIN_HEIGHT = MIN_HEIGHT;
|
|
30
28
|
const StyledTextarea = _styledComponents.default.div`
|
|
31
29
|
${_styledSystem.margin};
|
|
32
30
|
|
|
33
31
|
${_input.default} {
|
|
32
|
+
box-sizing: border-box;
|
|
34
33
|
resize: none;
|
|
35
34
|
min-height: ${MIN_HEIGHT}px;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
${_inputPresentation.default} {
|
|
39
35
|
padding: var(--spacing150) var(--spacing200);
|
|
36
|
+
|
|
37
|
+
${({
|
|
38
|
+
hasIcon
|
|
39
|
+
}) => hasIcon && "padding-right: var(--spacing500)"}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
${({
|
|
@@ -50,6 +50,10 @@ const StyledTextarea = _styledComponents.default.div`
|
|
|
50
50
|
|
|
51
51
|
${_inputIconToggle.default} {
|
|
52
52
|
height: 40px;
|
|
53
|
+
position: absolute;
|
|
54
|
+
height: 100%;
|
|
55
|
+
top: 0px;
|
|
56
|
+
right: 4px;
|
|
53
57
|
}
|
|
54
58
|
`;
|
|
55
59
|
StyledTextarea.defaultProps = {
|
|
@@ -46,7 +46,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
46
46
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
47
47
|
|
|
48
48
|
const Textbox = ({
|
|
49
|
-
align,
|
|
49
|
+
align = "left",
|
|
50
50
|
autoFocus,
|
|
51
51
|
children,
|
|
52
52
|
disabled,
|
|
@@ -126,6 +126,7 @@ const Textbox = ({
|
|
|
126
126
|
fieldHelp
|
|
127
127
|
});
|
|
128
128
|
const labelId = label ? externalLabelId || internalLabelId : "";
|
|
129
|
+
const hasIconInside = !!(inputIcon || validationIconId && !validationOnLabel);
|
|
129
130
|
return /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
|
|
130
131
|
helpAriaLabel: helpAriaLabel,
|
|
131
132
|
tooltipPosition: tooltipPosition
|
|
@@ -166,7 +167,8 @@ const Textbox = ({
|
|
|
166
167
|
warning: warning,
|
|
167
168
|
info: info,
|
|
168
169
|
inputWidth: inputWidth || 100 - labelWidth,
|
|
169
|
-
positionedChildren: positionedChildren
|
|
170
|
+
positionedChildren: positionedChildren,
|
|
171
|
+
hasIcon: hasIconInside
|
|
170
172
|
}, leftChildren, prefix && /*#__PURE__*/_react.default.createElement(_prefix.default, {
|
|
171
173
|
"data-element": "textbox-prefix"
|
|
172
174
|
}, prefix), validationRedesignOptIn && !disableErrorBorder && (error || warning) && /*#__PURE__*/_react.default.createElement(_textbox.ErrorBorder, {
|