carbon-react 104.58.0 → 104.58.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/components/menu/menu-item/menu-item.component.js +4 -2
- package/esm/components/select/__internal__/select-text/select-text.component.d.ts +1 -1
- package/esm/components/select/__internal__/select-text/select-text.component.js +2 -5
- package/esm/components/select/select-textbox/select-textbox.component.js +5 -8
- package/esm/components/tabs/__internal__/tab-title/tab-title.component.js +1 -1
- package/lib/components/menu/menu-item/menu-item.component.js +4 -2
- package/lib/components/select/__internal__/select-text/select-text.component.d.ts +1 -1
- package/lib/components/select/__internal__/select-text/select-text.component.js +2 -6
- package/lib/components/select/select-textbox/select-textbox.component.js +5 -8
- package/lib/components/tabs/__internal__/tab-title/tab-title.component.js +1 -1
- package/package.json +1 -1
|
@@ -109,6 +109,8 @@ const MenuItem = ({
|
|
|
109
109
|
|
|
110
110
|
const getTitle = title => maxWidth && typeof title === "string" ? title : "";
|
|
111
111
|
|
|
112
|
+
const itemMaxWidth = !inFullscreenView ? maxWidth : undefined;
|
|
113
|
+
|
|
112
114
|
if (submenu) {
|
|
113
115
|
const asPassiveItem = !(onClick || href);
|
|
114
116
|
return /*#__PURE__*/React.createElement(StyledMenuItem, _extends({
|
|
@@ -116,7 +118,7 @@ const MenuItem = ({
|
|
|
116
118
|
menuType: menuContext.menuType,
|
|
117
119
|
display: "inline-block",
|
|
118
120
|
title: getTitle(submenu),
|
|
119
|
-
maxWidth:
|
|
121
|
+
maxWidth: itemMaxWidth,
|
|
120
122
|
onClick: updateFocusOnClick
|
|
121
123
|
}, rest, {
|
|
122
124
|
inFullscreenView: inFullscreenView
|
|
@@ -140,7 +142,7 @@ const MenuItem = ({
|
|
|
140
142
|
inSubmenu: submenuContext.handleKeyDown !== undefined,
|
|
141
143
|
display: "inline-block",
|
|
142
144
|
title: getTitle(children),
|
|
143
|
-
maxWidth:
|
|
145
|
+
maxWidth: itemMaxWidth
|
|
144
146
|
}, rest, {
|
|
145
147
|
inFullscreenView: inFullscreenView && !Object.keys(submenuContext).length,
|
|
146
148
|
menuOpen: menuOpen
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default SelectText;
|
|
2
2
|
declare function SelectText({ disabled, formattedValue, onClick, onKeyDown, onFocus, onBlur, onMouseDown, placeholder, readOnly, textId, transparent, }: {
|
|
3
3
|
disabled: any;
|
|
4
|
-
formattedValue
|
|
4
|
+
formattedValue?: string | undefined;
|
|
5
5
|
onClick: any;
|
|
6
6
|
onKeyDown: any;
|
|
7
7
|
onFocus: any;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import StyledSelectText from "./select-text.style";
|
|
4
|
-
import useLocale from "../../../../hooks/__internal__/useLocale";
|
|
5
4
|
import { InputContext } from "../../../../__internal__/input-behaviour";
|
|
6
5
|
|
|
7
6
|
const SelectText = ({
|
|
8
7
|
disabled,
|
|
9
|
-
formattedValue,
|
|
8
|
+
formattedValue = "",
|
|
10
9
|
onClick,
|
|
11
10
|
onKeyDown,
|
|
12
11
|
onFocus,
|
|
@@ -17,10 +16,8 @@ const SelectText = ({
|
|
|
17
16
|
textId,
|
|
18
17
|
transparent
|
|
19
18
|
}) => {
|
|
20
|
-
const l = useLocale();
|
|
21
19
|
const inputContext = useContext(InputContext);
|
|
22
20
|
const hasPlaceholder = !disabled && !readOnly && !formattedValue;
|
|
23
|
-
const placeholderText = hasPlaceholder ? placeholder || l.select.placeholder() : "";
|
|
24
21
|
|
|
25
22
|
function handleFocus(event) {
|
|
26
23
|
inputContext.onFocus(event);
|
|
@@ -53,7 +50,7 @@ const SelectText = ({
|
|
|
53
50
|
role: "button",
|
|
54
51
|
tabIndex: "-1",
|
|
55
52
|
transparent: transparent
|
|
56
|
-
},
|
|
53
|
+
}, hasPlaceholder ? placeholder : formattedValue);
|
|
57
54
|
};
|
|
58
55
|
|
|
59
56
|
SelectText.propTypes = {
|
|
@@ -119,7 +119,6 @@ const SelectTextbox = ({
|
|
|
119
119
|
|
|
120
120
|
function getTextboxProps() {
|
|
121
121
|
return {
|
|
122
|
-
placeholder: hasTextCursor ? placeholder || l.select.placeholder() : undefined,
|
|
123
122
|
disabled,
|
|
124
123
|
readOnly,
|
|
125
124
|
required,
|
|
@@ -147,14 +146,11 @@ const SelectTextbox = ({
|
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
function renderSelectText() {
|
|
150
|
-
if (hasTextCursor) {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
149
|
return /*#__PURE__*/React.createElement(SelectText, _extends({
|
|
155
150
|
textId: textId.current,
|
|
156
151
|
transparent: transparent,
|
|
157
|
-
onKeyDown: handleSelectTextKeydown
|
|
152
|
+
onKeyDown: handleSelectTextKeydown,
|
|
153
|
+
placeholder: placeholder || l.select.placeholder()
|
|
158
154
|
}, getTextboxProps()));
|
|
159
155
|
}
|
|
160
156
|
|
|
@@ -174,8 +170,9 @@ const SelectTextbox = ({
|
|
|
174
170
|
autoComplete: "off",
|
|
175
171
|
size: size,
|
|
176
172
|
onChange: onChange,
|
|
177
|
-
value: selectedValue
|
|
178
|
-
|
|
173
|
+
value: selectedValue,
|
|
174
|
+
placeholder: hasTextCursor ? placeholder || l.select.placeholder() : undefined
|
|
175
|
+
}, getInputAriaAttributes(), getTextboxProps()), !hasTextCursor && renderSelectText());
|
|
179
176
|
};
|
|
180
177
|
|
|
181
178
|
const formInputPropTypes = {
|
|
@@ -124,6 +124,7 @@ const TabTitle = /*#__PURE__*/React.forwardRef(({
|
|
|
124
124
|
as: "a"
|
|
125
125
|
}, tagComponent("tab-header", tabTitleProps), {
|
|
126
126
|
onKeyDown: handleKeyDown,
|
|
127
|
+
onClick: handleClick,
|
|
127
128
|
size: size
|
|
128
129
|
}), /*#__PURE__*/React.createElement(StyledTitleContent, {
|
|
129
130
|
error: error,
|
|
@@ -131,7 +132,6 @@ const TabTitle = /*#__PURE__*/React.forwardRef(({
|
|
|
131
132
|
info: info,
|
|
132
133
|
position: position,
|
|
133
134
|
size: size,
|
|
134
|
-
onClick: handleClick,
|
|
135
135
|
noLeftBorder: noLeftBorder,
|
|
136
136
|
noRightBorder: noRightBorder,
|
|
137
137
|
borders: borders,
|
|
@@ -136,6 +136,8 @@ const MenuItem = ({
|
|
|
136
136
|
|
|
137
137
|
const getTitle = title => maxWidth && typeof title === "string" ? title : "";
|
|
138
138
|
|
|
139
|
+
const itemMaxWidth = !inFullscreenView ? maxWidth : undefined;
|
|
140
|
+
|
|
139
141
|
if (submenu) {
|
|
140
142
|
const asPassiveItem = !(onClick || href);
|
|
141
143
|
return /*#__PURE__*/_react.default.createElement(_menu2.StyledMenuItem, _extends({
|
|
@@ -143,7 +145,7 @@ const MenuItem = ({
|
|
|
143
145
|
menuType: menuContext.menuType,
|
|
144
146
|
display: "inline-block",
|
|
145
147
|
title: getTitle(submenu),
|
|
146
|
-
maxWidth:
|
|
148
|
+
maxWidth: itemMaxWidth,
|
|
147
149
|
onClick: updateFocusOnClick
|
|
148
150
|
}, rest, {
|
|
149
151
|
inFullscreenView: inFullscreenView
|
|
@@ -167,7 +169,7 @@ const MenuItem = ({
|
|
|
167
169
|
inSubmenu: submenuContext.handleKeyDown !== undefined,
|
|
168
170
|
display: "inline-block",
|
|
169
171
|
title: getTitle(children),
|
|
170
|
-
maxWidth:
|
|
172
|
+
maxWidth: itemMaxWidth
|
|
171
173
|
}, rest, {
|
|
172
174
|
inFullscreenView: inFullscreenView && !Object.keys(submenuContext).length,
|
|
173
175
|
menuOpen: menuOpen
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default SelectText;
|
|
2
2
|
declare function SelectText({ disabled, formattedValue, onClick, onKeyDown, onFocus, onBlur, onMouseDown, placeholder, readOnly, textId, transparent, }: {
|
|
3
3
|
disabled: any;
|
|
4
|
-
formattedValue
|
|
4
|
+
formattedValue?: string | undefined;
|
|
5
5
|
onClick: any;
|
|
6
6
|
onKeyDown: any;
|
|
7
7
|
onFocus: any;
|
|
@@ -11,8 +11,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _selectText = _interopRequireDefault(require("./select-text.style"));
|
|
13
13
|
|
|
14
|
-
var _useLocale = _interopRequireDefault(require("../../../../hooks/__internal__/useLocale"));
|
|
15
|
-
|
|
16
14
|
var _inputBehaviour = require("../../../../__internal__/input-behaviour");
|
|
17
15
|
|
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -23,7 +21,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
23
21
|
|
|
24
22
|
const SelectText = ({
|
|
25
23
|
disabled,
|
|
26
|
-
formattedValue,
|
|
24
|
+
formattedValue = "",
|
|
27
25
|
onClick,
|
|
28
26
|
onKeyDown,
|
|
29
27
|
onFocus,
|
|
@@ -34,10 +32,8 @@ const SelectText = ({
|
|
|
34
32
|
textId,
|
|
35
33
|
transparent
|
|
36
34
|
}) => {
|
|
37
|
-
const l = (0, _useLocale.default)();
|
|
38
35
|
const inputContext = (0, _react.useContext)(_inputBehaviour.InputContext);
|
|
39
36
|
const hasPlaceholder = !disabled && !readOnly && !formattedValue;
|
|
40
|
-
const placeholderText = hasPlaceholder ? placeholder || l.select.placeholder() : "";
|
|
41
37
|
|
|
42
38
|
function handleFocus(event) {
|
|
43
39
|
inputContext.onFocus(event);
|
|
@@ -70,7 +66,7 @@ const SelectText = ({
|
|
|
70
66
|
role: "button",
|
|
71
67
|
tabIndex: "-1",
|
|
72
68
|
transparent: transparent
|
|
73
|
-
},
|
|
69
|
+
}, hasPlaceholder ? placeholder : formattedValue);
|
|
74
70
|
};
|
|
75
71
|
|
|
76
72
|
SelectText.propTypes = {
|
|
@@ -140,7 +140,6 @@ const SelectTextbox = ({
|
|
|
140
140
|
|
|
141
141
|
function getTextboxProps() {
|
|
142
142
|
return {
|
|
143
|
-
placeholder: hasTextCursor ? placeholder || l.select.placeholder() : undefined,
|
|
144
143
|
disabled,
|
|
145
144
|
readOnly,
|
|
146
145
|
required,
|
|
@@ -168,14 +167,11 @@ const SelectTextbox = ({
|
|
|
168
167
|
}
|
|
169
168
|
|
|
170
169
|
function renderSelectText() {
|
|
171
|
-
if (hasTextCursor) {
|
|
172
|
-
return null;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
170
|
return /*#__PURE__*/_react.default.createElement(_selectText.default, _extends({
|
|
176
171
|
textId: textId.current,
|
|
177
172
|
transparent: transparent,
|
|
178
|
-
onKeyDown: handleSelectTextKeydown
|
|
173
|
+
onKeyDown: handleSelectTextKeydown,
|
|
174
|
+
placeholder: placeholder || l.select.placeholder()
|
|
179
175
|
}, getTextboxProps()));
|
|
180
176
|
}
|
|
181
177
|
|
|
@@ -195,8 +191,9 @@ const SelectTextbox = ({
|
|
|
195
191
|
autoComplete: "off",
|
|
196
192
|
size: size,
|
|
197
193
|
onChange: onChange,
|
|
198
|
-
value: selectedValue
|
|
199
|
-
|
|
194
|
+
value: selectedValue,
|
|
195
|
+
placeholder: hasTextCursor ? placeholder || l.select.placeholder() : undefined
|
|
196
|
+
}, getInputAriaAttributes(), getTextboxProps()), !hasTextCursor && renderSelectText());
|
|
200
197
|
};
|
|
201
198
|
|
|
202
199
|
const formInputPropTypes = {
|
|
@@ -147,6 +147,7 @@ const TabTitle = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
147
147
|
as: "a"
|
|
148
148
|
}, (0, _tags.default)("tab-header", tabTitleProps), {
|
|
149
149
|
onKeyDown: handleKeyDown,
|
|
150
|
+
onClick: handleClick,
|
|
150
151
|
size: size
|
|
151
152
|
}), /*#__PURE__*/_react.default.createElement(_tabTitle.StyledTitleContent, {
|
|
152
153
|
error: error,
|
|
@@ -154,7 +155,6 @@ const TabTitle = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
154
155
|
info: info,
|
|
155
156
|
position: position,
|
|
156
157
|
size: size,
|
|
157
|
-
onClick: handleClick,
|
|
158
158
|
noLeftBorder: noLeftBorder,
|
|
159
159
|
noRightBorder: noRightBorder,
|
|
160
160
|
borders: borders,
|