carbon-react 102.5.0 → 102.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,11 +9,9 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var _row = require("../row");
|
|
13
|
-
|
|
14
12
|
var _label = _interopRequireDefault(require("../../__internal__/label"));
|
|
15
13
|
|
|
16
|
-
var _inlineInputs =
|
|
14
|
+
var _inlineInputs = _interopRequireWildcard(require("./inline-inputs.style"));
|
|
17
15
|
|
|
18
16
|
var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
|
|
19
17
|
|
|
@@ -23,9 +21,7 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
23
21
|
|
|
24
22
|
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; }
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const columnWrapper = children => {
|
|
24
|
+
const columnWrapper = (children, gutter) => {
|
|
29
25
|
let inputs = children;
|
|
30
26
|
|
|
31
27
|
if (!Array.isArray(inputs)) {
|
|
@@ -36,8 +32,10 @@ const columnWrapper = children => {
|
|
|
36
32
|
// Input is never going to be re-ordered so we don't require a defined key
|
|
37
33
|
|
|
38
34
|
/* eslint-disable react/no-array-index-key */
|
|
39
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
40
|
-
key: index
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_inlineInputs.StyledInlineInput, {
|
|
36
|
+
key: index,
|
|
37
|
+
gutter: gutter,
|
|
38
|
+
"data-element": "inline-input"
|
|
41
39
|
}, input);
|
|
42
40
|
});
|
|
43
41
|
};
|
|
@@ -53,14 +51,6 @@ const InlineInputs = props => {
|
|
|
53
51
|
labelWidth
|
|
54
52
|
} = props;
|
|
55
53
|
const labelId = (0, _react.useRef)((0, _guid.default)());
|
|
56
|
-
const widthProps = {
|
|
57
|
-
inputWidth
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
if (labelWidth) {
|
|
61
|
-
widthProps.labelWidth = labelWidth;
|
|
62
|
-
widthProps.inputWidth = inputWidth || 100 - labelWidth;
|
|
63
|
-
}
|
|
64
54
|
|
|
65
55
|
function renderLabel() {
|
|
66
56
|
if (!label) return null;
|
|
@@ -78,13 +68,16 @@ const InlineInputs = props => {
|
|
|
78
68
|
}));
|
|
79
69
|
}
|
|
80
70
|
|
|
81
|
-
return /*#__PURE__*/_react.default.createElement(_inlineInputs.default,
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement(_inlineInputs.default, {
|
|
82
72
|
gutter: gutter,
|
|
83
73
|
"data-component": "inline-inputs",
|
|
84
|
-
className: className
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
74
|
+
className: className,
|
|
75
|
+
labelWidth: labelWidth
|
|
76
|
+
}, renderLabel(), /*#__PURE__*/_react.default.createElement(_inlineInputs.StyledContentContainer, {
|
|
77
|
+
gutter: gutter,
|
|
78
|
+
"data-element": "inline-inputs-container",
|
|
79
|
+
inputWidth: inputWidth
|
|
80
|
+
}, columnWrapper(renderChildren(), gutter)));
|
|
88
81
|
}; // Assign props over for demo site
|
|
89
82
|
|
|
90
83
|
|
|
@@ -3,14 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.StyledInlineInput = exports.StyledContentContainer = void 0;
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
|
|
10
|
-
var _row = _interopRequireDefault(require("../row/row.style"));
|
|
11
|
-
|
|
12
|
-
var _column = _interopRequireDefault(require("../row/column/column.style"));
|
|
13
|
-
|
|
14
10
|
var _inputPresentation = _interopRequireDefault(require("../../__internal__/input/input-presentation.style"));
|
|
15
11
|
|
|
16
12
|
var _label = require("../../__internal__/label/label.style");
|
|
@@ -33,20 +29,46 @@ const spacings = {
|
|
|
33
29
|
large: 32,
|
|
34
30
|
"extra-large": 40
|
|
35
31
|
};
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
align-items: center;
|
|
32
|
+
const StyledInlineInput = _styledComponents.default.div`
|
|
33
|
+
flex: 1;
|
|
39
34
|
|
|
40
35
|
${({
|
|
36
|
+
gutter
|
|
37
|
+
}) => (0, _styledComponents.css)`
|
|
38
|
+
margin-bottom: 0;
|
|
39
|
+
padding-left: ${spacings[gutter]}px;
|
|
40
|
+
`}
|
|
41
|
+
`;
|
|
42
|
+
exports.StyledInlineInput = StyledInlineInput;
|
|
43
|
+
const StyledContentContainer = _styledComponents.default.div`
|
|
44
|
+
display: flex;
|
|
45
|
+
flex: ${({
|
|
41
46
|
inputWidth
|
|
42
|
-
}) => inputWidth
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
}) => inputWidth ? `0 0 ${inputWidth}%` : 1};
|
|
48
|
+
|
|
49
|
+
${({
|
|
50
|
+
gutter
|
|
51
|
+
}) => (0, _styledComponents.css)`
|
|
52
|
+
margin-bottom: 0;
|
|
53
|
+
margin-left: -${spacings[gutter]}px;
|
|
54
|
+
|
|
55
|
+
${gutter === "none" && (0, _styledComponents.css)`
|
|
56
|
+
${StyledInlineInput} + ${StyledInlineInput} ${_inputPresentation.default} {
|
|
57
|
+
border-left: none;
|
|
58
|
+
}
|
|
59
|
+
`}
|
|
60
|
+
`}
|
|
61
|
+
`;
|
|
62
|
+
exports.StyledContentContainer = StyledContentContainer;
|
|
63
|
+
const StyledInlineInputs = _styledComponents.default.div`
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
45
66
|
|
|
46
67
|
${_label.StyledLabelContainer} {
|
|
68
|
+
width: auto;
|
|
47
69
|
margin-bottom: 0;
|
|
48
70
|
padding-right: 16px;
|
|
49
|
-
|
|
71
|
+
flex: 0 0 ${({
|
|
50
72
|
labelWidth
|
|
51
73
|
}) => labelWidth ? `${labelWidth}%` : "auto"};
|
|
52
74
|
}
|
|
@@ -58,30 +80,6 @@ const StyledInlineInputs = _styledComponents.default.div`
|
|
|
58
80
|
[data-component="carbon-select"] input {
|
|
59
81
|
width: 30px;
|
|
60
82
|
}
|
|
61
|
-
|
|
62
|
-
${_row.default} {
|
|
63
|
-
flex-grow: 1;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
${({
|
|
67
|
-
gutter
|
|
68
|
-
}) => (0, _styledComponents.css)`
|
|
69
|
-
${_row.default} {
|
|
70
|
-
margin-bottom: 0;
|
|
71
|
-
margin-left: -${spacings[gutter]}px;
|
|
72
|
-
|
|
73
|
-
> ${_column.default} {
|
|
74
|
-
margin-bottom: 0;
|
|
75
|
-
padding-left: ${spacings[gutter]}px;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
${gutter === "none" && (0, _styledComponents.css)`
|
|
80
|
-
${_column.default} + ${_column.default} ${_inputPresentation.default} {
|
|
81
|
-
border-left: none;
|
|
82
|
-
}
|
|
83
|
-
`}
|
|
84
|
-
`}
|
|
85
83
|
`;
|
|
86
84
|
StyledInlineInputs.defaultProps = {
|
|
87
85
|
theme: _base.default
|