iguazio.dashboard-react-controls 0.0.34 → 0.0.36
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/dist/components/Button/Button.js +1 -1
- package/dist/components/FormCheckBox/FormCheckBox.js +7 -2
- package/dist/components/FormCheckBox/formCheckBox.scss +36 -0
- package/dist/components/FormChipCell/FormChip/FormChip.js +7 -5
- package/dist/components/FormChipCell/FormChipCell.js +1 -1
- package/dist/components/FormChipCell/FormChipCellView.js +9 -5
- package/dist/components/FormChipCell/NewChipForm/NewChipForm.js +21 -22
- package/dist/components/FormChipCell/formChipCell.scss +1 -0
- package/dist/components/FormChipCell/formChipCell.util.js +17 -0
- package/dist/components/FormSelect/FormSelect.js +121 -111
- package/dist/components/FormSelect/formSelect.scss +4 -0
- package/dist/components/Modal/Modal.scss +9 -7
- package/dist/components/Tooltip/Tooltip.js +1 -4
- package/dist/components/Tooltip/tooltip.scss +21 -0
- package/dist/elements/HiddenChipsBlock/HiddenChipsBlock.js +7 -5
- package/dist/scss/mixins.scss +11 -5
- package/dist/types.js +22 -2
- package/package.json +1 -1
|
@@ -79,7 +79,7 @@ Button.propTypes = {
|
|
|
79
79
|
density: _propTypes.default.oneOf(['dense', 'normal', 'medium', 'chunky']),
|
|
80
80
|
icon: _propTypes.default.element,
|
|
81
81
|
label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.element]),
|
|
82
|
-
tooltip: _propTypes.default.string,
|
|
82
|
+
tooltip: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.element]),
|
|
83
83
|
variant: _types.BUTTON_VARIANTS
|
|
84
84
|
};
|
|
85
85
|
var _default = Button;
|
|
@@ -17,7 +17,7 @@ require("./formCheckBox.scss");
|
|
|
17
17
|
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
19
|
|
|
20
|
-
var _excluded = ["children", "className", "
|
|
20
|
+
var _excluded = ["children", "className", "highlightLabel", "label", "name"];
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
@@ -34,11 +34,13 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
34
34
|
var FormCheckBox = function FormCheckBox(_ref) {
|
|
35
35
|
var _children = _ref.children,
|
|
36
36
|
className = _ref.className,
|
|
37
|
-
|
|
37
|
+
highlightLabel = _ref.highlightLabel,
|
|
38
38
|
label = _ref.label,
|
|
39
|
+
name = _ref.name,
|
|
39
40
|
inputProps = _objectWithoutProperties(_ref, _excluded);
|
|
40
41
|
|
|
41
42
|
var formFieldClassNames = (0, _classnames.default)('form-field-checkbox', className);
|
|
43
|
+
var labelClassNames = (0, _classnames.default)(highlightLabel && 'highlighted');
|
|
42
44
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
43
45
|
name: name,
|
|
44
46
|
value: inputProps.value,
|
|
@@ -53,6 +55,7 @@ var FormCheckBox = function FormCheckBox(_ref) {
|
|
|
53
55
|
id: (_inputProps$value = inputProps.value) !== null && _inputProps$value !== void 0 ? _inputProps$value : name
|
|
54
56
|
})), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
55
57
|
htmlFor: (_inputProps$value2 = inputProps.value) !== null && _inputProps$value2 !== void 0 ? _inputProps$value2 : name,
|
|
58
|
+
className: labelClassNames,
|
|
56
59
|
children: [label ? label : '', _children]
|
|
57
60
|
})]
|
|
58
61
|
});
|
|
@@ -62,10 +65,12 @@ var FormCheckBox = function FormCheckBox(_ref) {
|
|
|
62
65
|
|
|
63
66
|
FormCheckBox.defaultProps = {
|
|
64
67
|
className: '',
|
|
68
|
+
highlightLabel: false,
|
|
65
69
|
label: ''
|
|
66
70
|
};
|
|
67
71
|
FormCheckBox.propTypes = {
|
|
68
72
|
className: _propTypes.default.string,
|
|
73
|
+
highlightLabel: _propTypes.default.bool,
|
|
69
74
|
name: _propTypes.default.string.isRequired,
|
|
70
75
|
label: _propTypes.default.string
|
|
71
76
|
};
|
|
@@ -47,5 +47,41 @@
|
|
|
47
47
|
background: $white;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
|
|
51
|
+
&:not(:disabled):checked {
|
|
52
|
+
~ label {
|
|
53
|
+
&.highlighted {
|
|
54
|
+
color: $white;
|
|
55
|
+
background-color: $malibu;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:hover {
|
|
60
|
+
~ label {
|
|
61
|
+
&.highlighted {
|
|
62
|
+
background-color: $cornflowerBlue;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
~ label {
|
|
69
|
+
&.highlighted {
|
|
70
|
+
background-color: $mischka;
|
|
71
|
+
font-size: 12px;
|
|
72
|
+
font-weight: bold;
|
|
73
|
+
margin-left: 10px;
|
|
74
|
+
padding: 4px 8px;
|
|
75
|
+
border-radius: 4px;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&:not(:disabled):hover {
|
|
80
|
+
~ label {
|
|
81
|
+
&.highlighted {
|
|
82
|
+
background-color: $iron;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
50
86
|
}
|
|
51
87
|
}
|
|
@@ -51,11 +51,13 @@ var FormChip = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
51
51
|
var chipRef = _react.default.useRef();
|
|
52
52
|
|
|
53
53
|
(0, _react.useEffect)(function () {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
queueMicrotask(function () {
|
|
55
|
+
if (chipRef.current && setChipsSizes) {
|
|
56
|
+
setChipsSizes(function (state) {
|
|
57
|
+
return _objectSpread(_objectSpread({}, state), {}, _defineProperty({}, chipIndex, chipRef.current.getBoundingClientRect().width));
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
59
61
|
}, [chipIndex, setChipsSizes]);
|
|
60
62
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
61
63
|
onClick: function onClick(event) {
|
|
@@ -412,7 +412,7 @@ FormChipCell.defaultProps = {
|
|
|
412
412
|
shortChips: false,
|
|
413
413
|
validationRules: {},
|
|
414
414
|
validator: function validator() {},
|
|
415
|
-
visibleChipsMaxLength:
|
|
415
|
+
visibleChipsMaxLength: null
|
|
416
416
|
};
|
|
417
417
|
FormChipCell.propTypes = {
|
|
418
418
|
chipOptions: _types.CHIP_OPTIONS,
|
|
@@ -13,6 +13,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
|
|
14
14
|
var _reactFinalFormArrays = require("react-final-form-arrays");
|
|
15
15
|
|
|
16
|
+
var _lodash = require("lodash");
|
|
17
|
+
|
|
16
18
|
var _Tooltip = _interopRequireDefault(require("../Tooltip/Tooltip"));
|
|
17
19
|
|
|
18
20
|
var _FormChip = _interopRequireDefault(require("./FormChip/FormChip"));
|
|
@@ -79,7 +81,7 @@ var FormChipCellView = /*#__PURE__*/_react.default.forwardRef(function (_ref, _r
|
|
|
79
81
|
var fields = _ref3.fields,
|
|
80
82
|
meta = _ref3.meta;
|
|
81
83
|
|
|
82
|
-
if (validationRules.key.every(function (rule) {
|
|
84
|
+
if (!(0, _lodash.isEmpty)(validationRules) && validationRules.key.every(function (rule) {
|
|
83
85
|
return rule.name !== _formChipCell.uniquenessError.name;
|
|
84
86
|
})) {
|
|
85
87
|
validationRules.key.push(_formChipCell.uniquenessError);
|
|
@@ -100,10 +102,12 @@ var FormChipCellView = /*#__PURE__*/_react.default.forwardRef(function (_ref, _r
|
|
|
100
102
|
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextTooltipTemplate.default, {
|
|
101
103
|
text: /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
102
104
|
className: "chip__content",
|
|
103
|
-
children: [chipData.key, /*#__PURE__*/(0, _jsxRuntime.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
children: [chipData.key, !chipData.isKeyOnly && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
106
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
107
|
+
className: "chip__delimiter",
|
|
108
|
+
children: chipData.delimiter ? chipData.delimiter : ':'
|
|
109
|
+
}), chipData.value]
|
|
110
|
+
})]
|
|
107
111
|
})
|
|
108
112
|
}),
|
|
109
113
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormChip.default, {
|
|
@@ -71,6 +71,7 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
71
71
|
valueName = _ref.valueName;
|
|
72
72
|
|
|
73
73
|
var _useState = (0, _react.useState)({
|
|
74
|
+
isKeyOnly: chip.isKeyOnly,
|
|
74
75
|
key: chip.key,
|
|
75
76
|
value: chip.value,
|
|
76
77
|
keyFieldWidth: 0,
|
|
@@ -108,9 +109,9 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
108
109
|
var minWidthInput = 25;
|
|
109
110
|
var minWidthValueInput = 35;
|
|
110
111
|
|
|
111
|
-
var refInputKey = _react.default.useRef();
|
|
112
|
+
var refInputKey = _react.default.useRef({});
|
|
112
113
|
|
|
113
|
-
var refInputValue = _react.default.useRef();
|
|
114
|
+
var refInputValue = _react.default.useRef({});
|
|
114
115
|
|
|
115
116
|
var refInputContainer = _react.default.useRef();
|
|
116
117
|
|
|
@@ -121,22 +122,14 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
121
122
|
if (!chipData.keyFieldWidth && !chipData.valueFieldWidth) {
|
|
122
123
|
var currentWidthKeyInput = refInputKey.current.scrollWidth + 1;
|
|
123
124
|
var currentWidthValueInput = refInputValue.current.scrollWidth + 1;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
} else {
|
|
133
|
-
setChipData(function (prevState) {
|
|
134
|
-
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
135
|
-
keyFieldWidth: minWidthInput,
|
|
136
|
-
valueFieldWidth: minWidthValueInput
|
|
137
|
-
});
|
|
125
|
+
var keyFieldWidth = !chipData.key || currentWidthKeyInput <= minWidthInput ? minWidthInput : currentWidthKeyInput >= maxWidthInput ? maxWidthInput : currentWidthKeyInput;
|
|
126
|
+
var valueFieldWidth = !chipData.value || currentWidthValueInput <= minWidthValueInput ? minWidthValueInput : currentWidthValueInput >= maxWidthInput ? maxWidthInput : currentWidthValueInput;
|
|
127
|
+
setChipData(function (prevState) {
|
|
128
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
129
|
+
keyFieldWidth: keyFieldWidth,
|
|
130
|
+
valueFieldWidth: valueFieldWidth
|
|
138
131
|
});
|
|
139
|
-
}
|
|
132
|
+
});
|
|
140
133
|
}
|
|
141
134
|
}, [chipData.key, chipData.value, chipData.keyFieldWidth, chipData.valueFieldWidth, maxWidthInput, refInputKey, refInputValue]);
|
|
142
135
|
|
|
@@ -241,9 +234,11 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
241
234
|
} else {
|
|
242
235
|
var currentWidthValueInput = refInputValue.current.scrollWidth;
|
|
243
236
|
setChipData(function (prevState) {
|
|
237
|
+
var _refInputValue$curren;
|
|
238
|
+
|
|
244
239
|
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
245
240
|
value: refInputValue.current.value,
|
|
246
|
-
valueFieldWidth: refInputValue.current.value.length <= 1 ? minWidthValueInput : currentWidthValueInput >= maxWidthInput ? maxWidthInput : currentWidthValueInput > minWidthValueInput ? currentWidthValueInput + 2 : minWidthValueInput
|
|
241
|
+
valueFieldWidth: ((_refInputValue$curren = refInputValue.current.value) === null || _refInputValue$curren === void 0 ? void 0 : _refInputValue$curren.length) <= 1 ? minWidthValueInput : currentWidthValueInput >= maxWidthInput ? maxWidthInput : currentWidthValueInput > minWidthValueInput ? currentWidthValueInput + 2 : minWidthValueInput
|
|
247
242
|
});
|
|
248
243
|
});
|
|
249
244
|
}
|
|
@@ -261,7 +256,9 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
261
256
|
(0, _react.useEffect)(function () {
|
|
262
257
|
if (meta.error) {
|
|
263
258
|
setValidationRules(function (prevState) {
|
|
264
|
-
|
|
259
|
+
var _prevState$selectedIn;
|
|
260
|
+
|
|
261
|
+
return _objectSpread(_objectSpread({}, prevState), {}, _defineProperty({}, selectedInput, (_prevState$selectedIn = prevState[selectedInput]) === null || _prevState$selectedIn === void 0 ? void 0 : _prevState$selectedIn.map(function (rule) {
|
|
265
262
|
return _objectSpread(_objectSpread({}, rule), {}, {
|
|
266
263
|
isValid: (0, _lodash.isEmpty)((0, _lodash.get)(meta, ['error', editConfig.chipIndex, selectedInput], [])) ? true : !meta.error[editConfig.chipIndex][selectedInput].some(function (err) {
|
|
267
264
|
return err && err.name === rule.name;
|
|
@@ -273,7 +270,9 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
273
270
|
}
|
|
274
271
|
}, [meta, showValidationRules, selectedInput, editConfig.chipIndex]);
|
|
275
272
|
var getValidationRules = (0, _react.useCallback)(function () {
|
|
276
|
-
|
|
273
|
+
var _validationRules$sele;
|
|
274
|
+
|
|
275
|
+
return (_validationRules$sele = validationRules[selectedInput]) === null || _validationRules$sele === void 0 ? void 0 : _validationRules$sele.map(function (_ref2) {
|
|
277
276
|
var _ref2$isValid = _ref2.isValid,
|
|
278
277
|
isValid = _ref2$isValid === void 0 ? false : _ref2$isValid,
|
|
279
278
|
label = _ref2.label,
|
|
@@ -301,10 +300,10 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
301
300
|
style: {
|
|
302
301
|
width: chipData.keyFieldWidth
|
|
303
302
|
}
|
|
304
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
303
|
+
}), !chipData.isKeyOnly && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
305
304
|
className: "edit-chip-separator",
|
|
306
305
|
children: ":"
|
|
307
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_NewChipInput.default, {
|
|
306
|
+
}), !chipData.isKeyOnly && /*#__PURE__*/(0, _jsxRuntime.jsx)(_NewChipInput.default, {
|
|
308
307
|
className: labelValueClassName,
|
|
309
308
|
disabled: !isEditable || editConfig.chipIndex !== chipIndex,
|
|
310
309
|
name: valueName,
|
|
@@ -4,6 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.uniquenessError = void 0;
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
Copyright 2022 Iguazio Systems Ltd.
|
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
11
|
+
an addition restriction as set forth herein. You may not use this
|
|
12
|
+
file except in compliance with the License. You may obtain a copy of
|
|
13
|
+
the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
14
|
+
Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
17
|
+
implied. See the License for the specific language governing
|
|
18
|
+
permissions and limitations under the License.
|
|
19
|
+
In addition, you may not use the software for any purposes that are
|
|
20
|
+
illegal under applicable law, and the grant of the foregoing license
|
|
21
|
+
under the Apache 2.0 license is conditioned upon your compliance with
|
|
22
|
+
such restriction.
|
|
23
|
+
*/
|
|
7
24
|
var uniquenessError = {
|
|
8
25
|
name: 'uniqueness',
|
|
9
26
|
label: 'Key should be unique'
|
|
@@ -74,6 +74,7 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
74
74
|
required = _ref.required,
|
|
75
75
|
search = _ref.search,
|
|
76
76
|
selectedItemAction = _ref.selectedItemAction,
|
|
77
|
+
tooltip = _ref.tooltip,
|
|
77
78
|
withoutBorder = _ref.withoutBorder,
|
|
78
79
|
withSelectedIcon = _ref.withSelectedIcon;
|
|
79
80
|
|
|
@@ -202,125 +203,132 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
202
203
|
children: function children(_ref3) {
|
|
203
204
|
var input = _ref3.input,
|
|
204
205
|
meta = _ref3.meta;
|
|
205
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
children: !hideSelectedOption && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
225
|
-
"data-testid": "selected-option",
|
|
226
|
-
className: "form-field__select",
|
|
227
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
228
|
-
className: selectValueClassName,
|
|
229
|
-
children: getSelectValue()
|
|
230
|
-
})
|
|
206
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
207
|
+
className: "select-tooltip",
|
|
208
|
+
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextTooltipTemplate.default, {
|
|
209
|
+
text: tooltip
|
|
210
|
+
}),
|
|
211
|
+
hidden: !tooltip,
|
|
212
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
213
|
+
"data-testid": "select",
|
|
214
|
+
ref: selectRef,
|
|
215
|
+
className: "form-field-select ".concat(className),
|
|
216
|
+
onClick: toggleOpen,
|
|
217
|
+
children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
218
|
+
className: selectLabelClassName,
|
|
219
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
220
|
+
"data-testid": "select-label",
|
|
221
|
+
children: [label, meta.error && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
222
|
+
className: "form-field__label-mandatory",
|
|
223
|
+
children: " *"
|
|
224
|
+
})]
|
|
231
225
|
})
|
|
232
226
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
} else {
|
|
244
|
-
selectedItemAction.handler(input.value);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
event.stopPropagation();
|
|
248
|
-
},
|
|
249
|
-
children: selectedItemAction.icon
|
|
227
|
+
"data-testid": "select-header",
|
|
228
|
+
className: selectWrapperClassNames,
|
|
229
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
230
|
+
className: "form-field__control",
|
|
231
|
+
children: !hideSelectedOption && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
232
|
+
"data-testid": "selected-option",
|
|
233
|
+
className: "form-field__select",
|
|
234
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
235
|
+
className: selectValueClassName,
|
|
236
|
+
children: getSelectValue()
|
|
250
237
|
})
|
|
251
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
252
|
-
children: selectedItemAction.icon
|
|
253
|
-
})
|
|
254
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
255
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdown.ReactComponent, {
|
|
256
|
-
className: "form-field__caret"
|
|
257
238
|
})
|
|
239
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
240
|
+
className: "form-field__icons",
|
|
241
|
+
children: [input.value && selectedItemAction && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
242
|
+
children: selectedItemAction.handler ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
243
|
+
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextTooltipTemplate.default, {
|
|
244
|
+
text: selectedItemAction.tooltip
|
|
245
|
+
}),
|
|
246
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
247
|
+
onClick: function onClick(event) {
|
|
248
|
+
if (selectedItemAction.confirm) {
|
|
249
|
+
setConfirmDialogOpen(true);
|
|
250
|
+
} else {
|
|
251
|
+
selectedItemAction.handler(input.value);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
event.stopPropagation();
|
|
255
|
+
},
|
|
256
|
+
children: selectedItemAction.icon
|
|
257
|
+
})
|
|
258
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
259
|
+
children: selectedItemAction.icon
|
|
260
|
+
})
|
|
261
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
262
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdown.ReactComponent, {
|
|
263
|
+
className: "form-field__caret"
|
|
264
|
+
})
|
|
265
|
+
})]
|
|
258
266
|
})]
|
|
259
|
-
})
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
267
|
+
}), isConfirmDialogOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConfirmDialog.default, {
|
|
268
|
+
cancelButton: {
|
|
269
|
+
handler: function handler() {
|
|
270
|
+
setConfirmDialogOpen(false);
|
|
271
|
+
},
|
|
272
|
+
label: 'Cancel',
|
|
273
|
+
variant: _constants.TERTIARY_BUTTON
|
|
264
274
|
},
|
|
265
|
-
|
|
266
|
-
variant: _constants.TERTIARY_BUTTON
|
|
267
|
-
},
|
|
268
|
-
closePopUp: function closePopUp() {
|
|
269
|
-
setConfirmDialogOpen(false);
|
|
270
|
-
},
|
|
271
|
-
confirmButton: {
|
|
272
|
-
handler: function handler() {
|
|
273
|
-
selectedItemAction.handler(input.value);
|
|
275
|
+
closePopUp: function closePopUp() {
|
|
274
276
|
setConfirmDialogOpen(false);
|
|
275
277
|
},
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
278
|
+
confirmButton: {
|
|
279
|
+
handler: function handler() {
|
|
280
|
+
selectedItemAction.handler(input.value);
|
|
281
|
+
setConfirmDialogOpen(false);
|
|
282
|
+
},
|
|
283
|
+
label: selectedItemAction.confirm.btnConfirmLabel,
|
|
284
|
+
variant: selectedItemAction.confirm.btnConfirmType
|
|
285
|
+
},
|
|
286
|
+
header: selectedItemAction.confirm.title,
|
|
287
|
+
isOpen: isConfirmDialogOpen,
|
|
288
|
+
message: selectedItemAction.confirm.message
|
|
289
|
+
}), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_PopUpDialog.default, {
|
|
290
|
+
className: "form-field form-field-select__options-list",
|
|
291
|
+
headerIsHidden: true,
|
|
292
|
+
customPosition: {
|
|
293
|
+
element: selectRef,
|
|
294
|
+
position: 'bottom-right'
|
|
295
|
+
},
|
|
296
|
+
style: {
|
|
297
|
+
width: "".concat(dropdownWidth, "px")
|
|
298
|
+
},
|
|
299
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
300
|
+
"data-testid": "select-body",
|
|
301
|
+
className: "options-list__body",
|
|
302
|
+
onClick: handleCloseSelectBody,
|
|
303
|
+
children: [search && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
304
|
+
className: "options-list__search",
|
|
305
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
306
|
+
type: "text",
|
|
307
|
+
placeholder: "Search...",
|
|
308
|
+
value: searchValue,
|
|
309
|
+
onChange: function onChange(event) {
|
|
310
|
+
return setSearchValue(event.target.value);
|
|
311
|
+
}
|
|
312
|
+
})
|
|
313
|
+
}), options.filter(function (option) {
|
|
314
|
+
return !search || option.label.toLowerCase().includes(searchValue.toLowerCase());
|
|
315
|
+
}).map(function (option) {
|
|
316
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOption.default, {
|
|
317
|
+
item: option,
|
|
318
|
+
name: name,
|
|
319
|
+
onClick: function onClick(selectedOption) {
|
|
320
|
+
handleSelectOptionClick(selectedOption, option);
|
|
321
|
+
},
|
|
322
|
+
multiple: multiple,
|
|
323
|
+
selectedId: !multiple ? input.value : '',
|
|
324
|
+
withSelectedIcon: withSelectedIcon
|
|
325
|
+
}, option.id);
|
|
326
|
+
})]
|
|
327
|
+
})
|
|
328
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({}, input), {}, {
|
|
329
|
+
type: "hidden"
|
|
330
|
+
}))]
|
|
331
|
+
})
|
|
324
332
|
});
|
|
325
333
|
}
|
|
326
334
|
});
|
|
@@ -334,6 +342,7 @@ FormSelect.defaultProps = {
|
|
|
334
342
|
label: '',
|
|
335
343
|
onClick: null,
|
|
336
344
|
search: false,
|
|
345
|
+
tooltip: '',
|
|
337
346
|
multiple: false,
|
|
338
347
|
withoutBorder: false,
|
|
339
348
|
withSelectedIcon: true
|
|
@@ -348,6 +357,7 @@ FormSelect.propTypes = {
|
|
|
348
357
|
onClick: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.bool]),
|
|
349
358
|
options: _types.SELECT_OPTIONS.isRequired,
|
|
350
359
|
search: _propTypes.default.bool,
|
|
360
|
+
tooltip: _propTypes.default.string,
|
|
351
361
|
multiple: _propTypes.default.bool,
|
|
352
362
|
withoutBorder: _propTypes.default.bool,
|
|
353
363
|
withSelectedIcon: _propTypes.default.bool
|
|
@@ -60,9 +60,12 @@
|
|
|
60
60
|
&__header {
|
|
61
61
|
position: relative;
|
|
62
62
|
border-bottom: $primaryBorder;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
height: 92px;
|
|
64
|
+
padding: 0 3rem;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
flex-direction: column;
|
|
66
69
|
|
|
67
70
|
&-title {
|
|
68
71
|
color: $primary;
|
|
@@ -72,11 +75,10 @@
|
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
&-sub-title {
|
|
75
|
-
color: $
|
|
78
|
+
color: $topaz;
|
|
76
79
|
font-size: 1.5em;
|
|
77
|
-
font-weight:
|
|
78
|
-
|
|
79
|
-
margin: 0;
|
|
80
|
+
font-weight: 500;
|
|
81
|
+
margin: 10px 0 0;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
&-button {
|
|
@@ -71,9 +71,6 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
71
71
|
var parentRef = (0, _react.useRef)();
|
|
72
72
|
var tooltipRef = (0, _react.useRef)();
|
|
73
73
|
var offset = 10;
|
|
74
|
-
var defaultStyle = {
|
|
75
|
-
transition: "opacity ".concat(duration, "ms ease-in-out ").concat(duration, "ms")
|
|
76
|
-
};
|
|
77
74
|
|
|
78
75
|
var handleScroll = function handleScroll() {
|
|
79
76
|
setShow(false);
|
|
@@ -172,7 +169,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
172
169
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
173
170
|
"data-testid": "tooltip",
|
|
174
171
|
ref: tooltipRef,
|
|
175
|
-
style: _objectSpread(
|
|
172
|
+
style: _objectSpread({}, style),
|
|
176
173
|
className: "tooltip",
|
|
177
174
|
children: template
|
|
178
175
|
})
|
|
@@ -7,3 +7,24 @@
|
|
|
7
7
|
max-width: 400px;
|
|
8
8
|
z-index: 9;
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
.fade {
|
|
12
|
+
&-enter {
|
|
13
|
+
opacity: 0;
|
|
14
|
+
|
|
15
|
+
&-active {
|
|
16
|
+
opacity: 1;
|
|
17
|
+
transition: opacity 200ms;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&-exit {
|
|
22
|
+
opacity: 1;
|
|
23
|
+
|
|
24
|
+
&-active {
|
|
25
|
+
opacity: 0;
|
|
26
|
+
transition: opacity 200ms;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
@@ -82,7 +82,7 @@ var HiddenChipsBlock = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
|
|
|
82
82
|
}, [hiddenRef]);
|
|
83
83
|
|
|
84
84
|
var generateChipData = function generateChipData(chip) {
|
|
85
|
-
return "".concat(chip.key).concat(chip.delimiter ? chip.delimiter : ':', " ").concat(chip.value);
|
|
85
|
+
return chip.isKeyOnly ? chip.key : "".concat(chip.key).concat(chip.delimiter ? chip.delimiter : ':', " ").concat(chip.value);
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
(0, _react.useEffect)(function () {
|
|
@@ -130,10 +130,12 @@ var HiddenChipsBlock = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
|
|
|
130
130
|
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextTooltipTemplate.default, {
|
|
131
131
|
text: element.delimiter ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
132
132
|
className: "chip__content",
|
|
133
|
-
children: [element.key, /*#__PURE__*/(0, _jsxRuntime.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
children: [element.key, !element.isKeyOnly && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
134
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
135
|
+
className: "chip__delimiter",
|
|
136
|
+
children: element.delimiter
|
|
137
|
+
}), element.value]
|
|
138
|
+
})]
|
|
137
139
|
}) : generateChipData(element)
|
|
138
140
|
}),
|
|
139
141
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
package/dist/scss/mixins.scss
CHANGED
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
@mixin tableDet {
|
|
18
|
-
display: flex;
|
|
18
|
+
display: inline-flex;
|
|
19
19
|
align-items: center;
|
|
20
20
|
text-align: left;
|
|
21
21
|
|
|
22
22
|
&:first-child {
|
|
23
|
-
|
|
23
|
+
margin-left: 10px;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -380,12 +380,18 @@
|
|
|
380
380
|
line-height: $lineHeight;
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
-
@mixin tableHeader($
|
|
384
|
-
|
|
383
|
+
@mixin tableHeader($topPadding, $rightPadding, $bottomPadding, $leftPadding) {
|
|
384
|
+
flex-direction: row;
|
|
385
|
+
justify-content: flex-start;
|
|
386
|
+
align-items: center;
|
|
387
|
+
height: auto;
|
|
388
|
+
min-height: 50px;
|
|
389
|
+
margin: 0 1px;
|
|
390
|
+
padding: $topPadding $rightPadding $bottomPadding $leftPadding;
|
|
391
|
+
text-align: left;
|
|
385
392
|
color: $topaz;
|
|
386
393
|
font-weight: bold;
|
|
387
394
|
font-size: 14px;
|
|
388
|
-
line-height: 24px;
|
|
389
395
|
}
|
|
390
396
|
|
|
391
397
|
@mixin resetSpaces {
|
package/dist/types.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WIZARD_STEPS_CONFIG = exports.SELECT_OPTIONS = exports.SELECT_OPTION = exports.POP_UP_CUSTOM_POSITION = exports.MODAL_SIZES = exports.INPUT_VALIDATION_RULES = exports.INPUT_LINK = exports.FORM_TABLE_EDITING_ITEM = exports.CONFIRM_DIALOG_SUBMIT_BUTTON = exports.CONFIRM_DIALOG_CANCEL_BUTTON = exports.COMBOBOX_VALIDATION_RULES = exports.COMBOBOX_SUGGESTION_LIST = exports.COMBOBOX_SELECT_OPTIONS = exports.CHIP_OPTIONS = exports.CHIP_INPUT_LIST = exports.CHIPS = exports.CHIP = exports.BUTTON_VARIANTS = void 0;
|
|
6
|
+
exports.WIZARD_STEPS_CONFIG = exports.SORT_PROPS = exports.SELECT_OPTIONS = exports.SELECT_OPTION = exports.POP_UP_CUSTOM_POSITION = exports.MODAL_SIZES = exports.INPUT_VALIDATION_RULES = exports.INPUT_LINK = exports.FORM_TABLE_EDITING_ITEM = exports.EXCLUDE_SORT_BY = exports.DEFAULT_SORT_BY = exports.CONFIRM_DIALOG_SUBMIT_BUTTON = exports.CONFIRM_DIALOG_CANCEL_BUTTON = exports.COMBOBOX_VALIDATION_RULES = exports.COMBOBOX_SUGGESTION_LIST = exports.COMBOBOX_SELECT_OPTIONS = exports.CHIP_OPTIONS = exports.CHIP_INPUT_LIST = exports.CHIPS = exports.CHIP = exports.BUTTON_VARIANTS = exports.ALLOW_SORT_BY = void 0;
|
|
7
7
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
|
|
@@ -151,4 +151,24 @@ var FORM_TABLE_EDITING_ITEM = _propTypes.default.shape(_defineProperty({
|
|
|
151
151
|
}).isRequired
|
|
152
152
|
}, _propTypes.default.string, _propTypes.default.any));
|
|
153
153
|
|
|
154
|
-
exports.FORM_TABLE_EDITING_ITEM = FORM_TABLE_EDITING_ITEM;
|
|
154
|
+
exports.FORM_TABLE_EDITING_ITEM = FORM_TABLE_EDITING_ITEM;
|
|
155
|
+
|
|
156
|
+
var SORT_PROPS = _propTypes.default.shape({
|
|
157
|
+
selectedColumnName: _propTypes.default.string.isRequired,
|
|
158
|
+
getSortingIcon: _propTypes.default.func.isRequired,
|
|
159
|
+
sortTable: _propTypes.default.func.isRequired
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
exports.SORT_PROPS = SORT_PROPS;
|
|
163
|
+
|
|
164
|
+
var ALLOW_SORT_BY = _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.string, _propTypes.default.number)]);
|
|
165
|
+
|
|
166
|
+
exports.ALLOW_SORT_BY = ALLOW_SORT_BY;
|
|
167
|
+
|
|
168
|
+
var DEFAULT_SORT_BY = _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]);
|
|
169
|
+
|
|
170
|
+
exports.DEFAULT_SORT_BY = DEFAULT_SORT_BY;
|
|
171
|
+
|
|
172
|
+
var EXCLUDE_SORT_BY = _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.string, _propTypes.default.number)]);
|
|
173
|
+
|
|
174
|
+
exports.EXCLUDE_SORT_BY = EXCLUDE_SORT_BY;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iguazio.dashboard-react-controls",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"description": "Collection of resources (such as CSS styles, fonts and images) and ReactJS 17.x components to share among different Iguazio React repos.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|