iguazio.dashboard-react-controls 1.2.2 → 1.2.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/dist/components/FormChipCell/FormChipCell.js +27 -84
- package/dist/components/FormChipCell/FormChipCellView.js +11 -5
- package/dist/components/FormChipCell/HiddenChipsBlock/HiddenChipsBlock.js +107 -0
- package/dist/components/FormInput/FormInput.js +5 -5
- package/dist/hooks/useChipCell.hook.js +150 -0
- package/dist/hooks/useHiddenChipsBlock.hook.js +117 -0
- package/dist/scss/common.scss +56 -0
- package/dist/scss/shadows.scss +2 -2
- package/dist/utils/common.util.js +23 -2
- package/dist/utils/getFirstScrollableParent.util.js +26 -4
- package/package.json +1 -1
- package/dist/elements/HiddenChipsBlock/HiddenChipsBlock.js +0 -154
- package/dist/elements/HiddenChipsBlock/hiddenChipsBlock.scss +0 -58
|
@@ -10,12 +10,13 @@ var _lodash = _interopRequireWildcard(require("lodash"));
|
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _FormChipCellView = _interopRequireDefault(require("./FormChipCellView"));
|
|
13
|
+
var _types = require("../../types");
|
|
14
|
+
var _constants = require("../../constants");
|
|
13
15
|
var _common = require("../../utils/common.util");
|
|
14
|
-
var _generateChipsList = require("../../utils/generateChipsList.util");
|
|
15
16
|
var _validation = require("../../utils/validation.util");
|
|
17
|
+
var _generateChipsList = require("../../utils/generateChipsList.util");
|
|
16
18
|
var _formChipCell = require("./formChipCell.util");
|
|
17
|
-
var
|
|
18
|
-
var _constants = require("../../constants");
|
|
19
|
+
var _useChipCell2 = require("../../hooks/useChipCell.hook");
|
|
19
20
|
require("./formChipCell.scss");
|
|
20
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -62,95 +63,33 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
62
63
|
validator = _ref.validator,
|
|
63
64
|
visibleChipsMaxLength = _ref.visibleChipsMaxLength;
|
|
64
65
|
var chipsClassName = (0, _classnames.default)('chips', className);
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
setShowHiddenChips =
|
|
73
|
-
|
|
66
|
+
var _useChipCell = (0, _useChipCell2.useChipCell)(isEditable, visibleChipsMaxLength),
|
|
67
|
+
chipsCellRef = _useChipCell.chipsCellRef,
|
|
68
|
+
chipsWrapperRef = _useChipCell.chipsWrapperRef,
|
|
69
|
+
handleShowElements = _useChipCell.handleShowElements,
|
|
70
|
+
hiddenChipsCounterRef = _useChipCell.hiddenChipsCounterRef,
|
|
71
|
+
hiddenChipsPopUpRef = _useChipCell.hiddenChipsPopUpRef,
|
|
72
|
+
setChipsSizes = _useChipCell.setChipsSizes,
|
|
73
|
+
setShowHiddenChips = _useChipCell.setShowHiddenChips,
|
|
74
|
+
showChips = _useChipCell.showChips,
|
|
75
|
+
showHiddenChips = _useChipCell.showHiddenChips,
|
|
76
|
+
visibleChipsCount = _useChipCell.visibleChipsCount;
|
|
77
|
+
var _useState = (0, _react.useState)({
|
|
74
78
|
chipIndex: null,
|
|
75
79
|
isEdit: false,
|
|
76
80
|
isKeyFocused: false,
|
|
77
81
|
isValueFocused: false,
|
|
78
82
|
isNewChip: false
|
|
79
83
|
}),
|
|
80
|
-
|
|
81
|
-
editConfig =
|
|
82
|
-
setEditConfig =
|
|
83
|
-
var _useState7 = (0, _react.useState)(false),
|
|
84
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
85
|
-
showChips = _useState8[0],
|
|
86
|
-
setShowChips = _useState8[1];
|
|
87
|
-
var _useState9 = (0, _react.useState)(8),
|
|
88
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
89
|
-
visibleChipsCount = _useState10[0],
|
|
90
|
-
setVisibleChipsCount = _useState10[1];
|
|
91
|
-
var chipsCellRef = (0, _react.useRef)();
|
|
92
|
-
var chipsWrapperRef = (0, _react.useRef)();
|
|
93
|
-
var handleShowElements = (0, _react.useCallback)(function () {
|
|
94
|
-
if (!isEditable || isEditable && visibleChipsMaxLength) {
|
|
95
|
-
setShowHiddenChips(function (state) {
|
|
96
|
-
return !state;
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}, [isEditable, visibleChipsMaxLength]);
|
|
84
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
85
|
+
editConfig = _useState2[0],
|
|
86
|
+
setEditConfig = _useState2[1];
|
|
100
87
|
var chips = (0, _react.useMemo)(function () {
|
|
101
88
|
return isEditable || visibleChipsMaxLength === 'all' ? {
|
|
102
89
|
visibleChips: (0, _lodash.get)(formState.values, name),
|
|
103
90
|
hiddenChips: []
|
|
104
91
|
} : (0, _generateChipsList.generateChipsList)((0, _lodash.get)(formState.values, name), visibleChipsMaxLength ? visibleChipsMaxLength : visibleChipsCount);
|
|
105
92
|
}, [visibleChipsMaxLength, isEditable, visibleChipsCount, formState.values, name]);
|
|
106
|
-
var handleResize = (0, _react.useCallback)(function () {
|
|
107
|
-
if (!isEditable && !(0, _common.isEveryObjectValueEmpty)(chipsSizes)) {
|
|
108
|
-
var _chipsCellRef$current;
|
|
109
|
-
var parentSize = (_chipsCellRef$current = chipsCellRef.current) === null || _chipsCellRef$current === void 0 ? void 0 : _chipsCellRef$current.getBoundingClientRect().width;
|
|
110
|
-
var maxLength = 0;
|
|
111
|
-
var chipIndex = 0;
|
|
112
|
-
var padding = 65;
|
|
113
|
-
Object.values(chipsSizes).every(function (chipSize, index) {
|
|
114
|
-
if (maxLength + chipSize > parentSize || Object.values(chipsSizes).length > 1 && maxLength + chipSize + padding > parentSize) {
|
|
115
|
-
chipIndex = index;
|
|
116
|
-
return false;
|
|
117
|
-
} else {
|
|
118
|
-
maxLength += chipSize;
|
|
119
|
-
if (index === Object.values(chipsSizes).length - 1) {
|
|
120
|
-
chipIndex = 8;
|
|
121
|
-
}
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
setVisibleChipsCount(chipIndex);
|
|
126
|
-
setShowChips(true);
|
|
127
|
-
}
|
|
128
|
-
}, [chipsSizes, isEditable]);
|
|
129
|
-
(0, _react.useEffect)(function () {
|
|
130
|
-
handleResize();
|
|
131
|
-
}, [handleResize, showChips]);
|
|
132
|
-
(0, _react.useEffect)(function () {
|
|
133
|
-
if (!isEditable) {
|
|
134
|
-
window.addEventListener('resize', handleResize);
|
|
135
|
-
return function () {
|
|
136
|
-
return window.removeEventListener('resize', handleResize);
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
}, [handleResize, isEditable]);
|
|
140
|
-
(0, _react.useEffect)(function () {
|
|
141
|
-
window.addEventListener('mainResize', handleResize);
|
|
142
|
-
return function () {
|
|
143
|
-
return window.removeEventListener('mainResize', handleResize);
|
|
144
|
-
};
|
|
145
|
-
}, [handleResize]);
|
|
146
|
-
(0, _react.useEffect)(function () {
|
|
147
|
-
if (showHiddenChips) {
|
|
148
|
-
window.addEventListener('click', handleShowElements);
|
|
149
|
-
return function () {
|
|
150
|
-
return window.removeEventListener('click', handleShowElements);
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
}, [showHiddenChips, handleShowElements]);
|
|
154
93
|
var checkChipsList = (0, _react.useCallback)(function (currentChipsList) {
|
|
155
94
|
if ((0, _common.areArraysEqual)((0, _lodash.get)(initialValues, name), currentChipsList, ['id'])) {
|
|
156
95
|
(0, _lodash.set)(formState.initialValues, name, currentChipsList);
|
|
@@ -163,9 +102,11 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
163
102
|
});
|
|
164
103
|
}, [initialValues, name, formState]);
|
|
165
104
|
var handleAddNewChip = (0, _react.useCallback)(function (event, fields) {
|
|
105
|
+
var _fields$value;
|
|
106
|
+
var fieldsLength = ((_fields$value = fields.value) === null || _fields$value === void 0 ? void 0 : _fields$value.length) || 0;
|
|
166
107
|
if (!editConfig.isEdit && !editConfig.chipIndex) {
|
|
167
108
|
formState.form.mutators.push(name, {
|
|
168
|
-
id:
|
|
109
|
+
id: fieldsLength + new Date(),
|
|
169
110
|
key: '',
|
|
170
111
|
value: '',
|
|
171
112
|
delimiter: delimiter
|
|
@@ -175,14 +116,14 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
175
116
|
setShowHiddenChips(false);
|
|
176
117
|
}
|
|
177
118
|
setEditConfig({
|
|
178
|
-
chipIndex:
|
|
119
|
+
chipIndex: fieldsLength,
|
|
179
120
|
isEdit: true,
|
|
180
121
|
isKeyFocused: true,
|
|
181
122
|
isValueFocused: false,
|
|
182
123
|
isNewChip: true
|
|
183
124
|
});
|
|
184
125
|
event && event.preventDefault();
|
|
185
|
-
}, [editConfig.isEdit, editConfig.chipIndex, showHiddenChips, formState, name, delimiter]);
|
|
126
|
+
}, [editConfig.isEdit, editConfig.chipIndex, showHiddenChips, formState.form.mutators, name, delimiter, setShowHiddenChips]);
|
|
186
127
|
var handleRemoveChip = (0, _react.useCallback)(function (event, fields, chipIndex) {
|
|
187
128
|
checkChipsList(_lodash.default.chain(formState).get(['values', name]).filter(function (_, index) {
|
|
188
129
|
return index !== chipIndex;
|
|
@@ -345,7 +286,9 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
345
286
|
name: name,
|
|
346
287
|
ref: {
|
|
347
288
|
chipsCellRef: chipsCellRef,
|
|
348
|
-
chipsWrapperRef: chipsWrapperRef
|
|
289
|
+
chipsWrapperRef: chipsWrapperRef,
|
|
290
|
+
hiddenChipsCounterRef: hiddenChipsCounterRef,
|
|
291
|
+
hiddenChipsPopUpRef: hiddenChipsPopUpRef
|
|
349
292
|
},
|
|
350
293
|
setChipsSizes: setChipsSizes,
|
|
351
294
|
setEditConfig: setEditConfig,
|
|
@@ -9,13 +9,13 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _reactFinalFormArrays = require("react-final-form-arrays");
|
|
11
11
|
var _lodash = require("lodash");
|
|
12
|
-
var _Tooltip = _interopRequireDefault(require("../Tooltip/Tooltip"));
|
|
13
12
|
var _FormChip = _interopRequireDefault(require("./FormChip/FormChip"));
|
|
13
|
+
var _HiddenChipsBlock = _interopRequireDefault(require("./HiddenChipsBlock/HiddenChipsBlock"));
|
|
14
14
|
var _TextTooltipTemplate = _interopRequireDefault(require("../TooltipTemplate/TextTooltipTemplate"));
|
|
15
|
-
var
|
|
15
|
+
var _Tooltip = _interopRequireDefault(require("../Tooltip/Tooltip"));
|
|
16
16
|
var _types = require("../../types");
|
|
17
|
-
var _formChipCell = require("./formChipCell.util");
|
|
18
17
|
var _common = require("../../utils/common.util");
|
|
18
|
+
var _formChipCell = require("./formChipCell.util");
|
|
19
19
|
var _add = require("../../images/add.svg");
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -55,7 +55,9 @@ var FormChipCellView = /*#__PURE__*/_react.default.forwardRef(function (_ref, _r
|
|
|
55
55
|
validateFields = _ref.validateFields,
|
|
56
56
|
validationRules = _ref.validationRules;
|
|
57
57
|
var chipsCellRef = _ref2.chipsCellRef,
|
|
58
|
-
chipsWrapperRef = _ref2.chipsWrapperRef
|
|
58
|
+
chipsWrapperRef = _ref2.chipsWrapperRef,
|
|
59
|
+
hiddenChipsCounterRef = _ref2.hiddenChipsCounterRef,
|
|
60
|
+
hiddenChipsPopUpRef = _ref2.hiddenChipsPopUpRef;
|
|
59
61
|
var buttonAddClassNames = (0, _classnames.default)('button-add', chipOptions.background && "button-add-background_".concat(chipOptions.background), chipOptions.borderColor && "button-add-border_".concat(chipOptions.borderColor), chipOptions.font && "button-add-font_".concat(chipOptions.font), chipOptions.density && "button-add-density_".concat(chipOptions.density));
|
|
60
62
|
var wrapperClassNames = (0, _classnames.default)('chips-wrapper', isEditable && 'fixed-max-width');
|
|
61
63
|
var chipClassNames = (0, _classnames.default)('chip', 'chip__content', isEditable && 'data-ellipsis', shortChips && 'chip_short', chips.hiddenChips && 'chip_hidden', chipOptions.density && "chip-density_".concat(chipOptions.density), chipOptions.borderRadius && "chip-border_".concat(chipOptions.borderRadius), chipOptions.background && "chip-background_".concat(chipOptions.background), chipOptions.borderColor && "chip-border_".concat(chipOptions.borderColor), chipOptions.font && "chip-font_".concat(chipOptions.font), isEditable && 'editable', (showChips || isEditable) && 'chip_visible');
|
|
@@ -123,9 +125,13 @@ var FormChipCellView = /*#__PURE__*/_react.default.forwardRef(function (_ref, _r
|
|
|
123
125
|
chipOptions: chipOptions,
|
|
124
126
|
chips: chips.hiddenChips,
|
|
125
127
|
handleShowElements: handleShowElements,
|
|
126
|
-
ref:
|
|
128
|
+
ref: {
|
|
129
|
+
hiddenChipsCounterRef: hiddenChipsCounterRef,
|
|
130
|
+
hiddenChipsPopUpRef: hiddenChipsPopUpRef
|
|
131
|
+
},
|
|
127
132
|
textOverflowEllipsis: true
|
|
128
133
|
}), chips.hiddenChipsNumber && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
134
|
+
ref: hiddenChipsCounterRef,
|
|
129
135
|
className: "".concat(chipClassNames, " chips_button"),
|
|
130
136
|
onClick: handleShowElements,
|
|
131
137
|
children: chips.hiddenChipsNumber
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactDom = require("react-dom");
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _Tooltip = _interopRequireDefault(require("../../Tooltip/Tooltip"));
|
|
13
|
+
var _TextTooltipTemplate = _interopRequireDefault(require("../../TooltipTemplate/TextTooltipTemplate"));
|
|
14
|
+
var _types = require("../../../types");
|
|
15
|
+
var _useHiddenChipsBlock2 = require("../../../hooks/useHiddenChipsBlock.hook");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
|
|
20
|
+
/*
|
|
21
|
+
Copyright 2022 Iguazio Systems Ltd.
|
|
22
|
+
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
23
|
+
an addition restriction as set forth herein. You may not use this
|
|
24
|
+
file except in compliance with the License. You may obtain a copy of
|
|
25
|
+
the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
26
|
+
Unless required by applicable law or agreed to in writing, software
|
|
27
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
28
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
29
|
+
implied. See the License for the specific language governing
|
|
30
|
+
permissions and limitations under the License.
|
|
31
|
+
In addition, you may not use the software for any purposes that are
|
|
32
|
+
illegal under applicable law, and the grant of the foregoing license
|
|
33
|
+
under the Apache 2.0 license is conditioned upon your compliance with
|
|
34
|
+
such restriction.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
var HiddenChipsBlock = /*#__PURE__*/_react.default.forwardRef(function (_ref, _ref2) {
|
|
38
|
+
var chipClassNames = _ref.chipClassNames,
|
|
39
|
+
chipOptions = _ref.chipOptions,
|
|
40
|
+
chips = _ref.chips,
|
|
41
|
+
handleShowElements = _ref.handleShowElements,
|
|
42
|
+
textOverflowEllipsis = _ref.textOverflowEllipsis;
|
|
43
|
+
var hiddenChipsCounterRef = _ref2.hiddenChipsCounterRef,
|
|
44
|
+
hiddenChipsPopUpRef = _ref2.hiddenChipsPopUpRef;
|
|
45
|
+
var _useHiddenChipsBlock = (0, _useHiddenChipsBlock2.useHiddenChipsBlock)(hiddenChipsCounterRef, hiddenChipsPopUpRef),
|
|
46
|
+
hiddenChipsBlockClassNames = _useHiddenChipsBlock.hiddenChipsBlockClassNames;
|
|
47
|
+
var chipLabelClassNames = (0, _classnames.default)('chip__label', textOverflowEllipsis && 'data-ellipsis');
|
|
48
|
+
var chipValueClassNames = (0, _classnames.default)('chip__value', textOverflowEllipsis && 'data-ellipsis', chipOptions.boldValue && 'chip-value_bold');
|
|
49
|
+
var generateChipData = function generateChipData(chip) {
|
|
50
|
+
return chip.isKeyOnly ? chip.key : "".concat(chip.key).concat(chip.delimiter ? chip.delimiter : ':', " ").concat(chip.value);
|
|
51
|
+
};
|
|
52
|
+
(0, _react.useEffect)(function () {
|
|
53
|
+
if (chips.length === 0) {
|
|
54
|
+
handleShowElements();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
58
|
+
ref: hiddenChipsPopUpRef,
|
|
59
|
+
className: hiddenChipsBlockClassNames,
|
|
60
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
61
|
+
className: "chip-block-hidden__scrollable-container",
|
|
62
|
+
children: chips === null || chips === void 0 ? void 0 : chips.map(function (element) {
|
|
63
|
+
var _element$delimiter;
|
|
64
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
65
|
+
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextTooltipTemplate.default, {
|
|
66
|
+
text: element.delimiter ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
67
|
+
className: "chip__content",
|
|
68
|
+
children: [element.key, !element.isKeyOnly && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
69
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
70
|
+
className: "chip__delimiter",
|
|
71
|
+
children: element.delimiter
|
|
72
|
+
}), element.value]
|
|
73
|
+
})]
|
|
74
|
+
}) : generateChipData(element)
|
|
75
|
+
}),
|
|
76
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
77
|
+
className: chipClassNames,
|
|
78
|
+
children: [element.key && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
79
|
+
className: chipLabelClassNames,
|
|
80
|
+
children: element.key
|
|
81
|
+
}), element.value && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
82
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
83
|
+
className: "chip__delimiter",
|
|
84
|
+
children: (_element$delimiter = element.delimiter) !== null && _element$delimiter !== void 0 ? _element$delimiter : ':'
|
|
85
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
86
|
+
className: chipValueClassNames,
|
|
87
|
+
children: element.value
|
|
88
|
+
})]
|
|
89
|
+
})]
|
|
90
|
+
})
|
|
91
|
+
}, element.id);
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
}), document.getElementById('overlay_container'));
|
|
95
|
+
});
|
|
96
|
+
HiddenChipsBlock.defaultProps = {
|
|
97
|
+
textOverflowEllipsis: false
|
|
98
|
+
};
|
|
99
|
+
HiddenChipsBlock.propTypes = {
|
|
100
|
+
chipClassNames: _propTypes.default.string.isRequired,
|
|
101
|
+
chipOptions: _types.CHIP_OPTIONS.isRequired,
|
|
102
|
+
chips: _propTypes.default.array.isRequired,
|
|
103
|
+
handleShowElements: _propTypes.default.func.isRequired,
|
|
104
|
+
textOverflowEllipsis: _propTypes.default.bool
|
|
105
|
+
};
|
|
106
|
+
var _default = HiddenChipsBlock;
|
|
107
|
+
exports.default = _default;
|
|
@@ -12,12 +12,12 @@ var _lodash = require("lodash");
|
|
|
12
12
|
var _reactFinalForm = require("react-final-form");
|
|
13
13
|
var _InputNumberButtons = _interopRequireDefault(require("./InputNumberButtons/InputNumberButtons"));
|
|
14
14
|
var _OptionsMenu = _interopRequireDefault(require("../../elements/OptionsMenu/OptionsMenu"));
|
|
15
|
-
var _components = require("../../components");
|
|
16
15
|
var _ValidationTemplate = _interopRequireDefault(require("../../elements/ValidationTemplate/ValidationTemplate"));
|
|
17
|
-
var
|
|
18
|
-
var _validation = require("../../utils/validation.util");
|
|
19
|
-
var _useDetectOutsideClick = require("../../hooks/useDetectOutsideClick");
|
|
16
|
+
var _components = require("../../components");
|
|
20
17
|
var _types = require("../../types");
|
|
18
|
+
var _validation = require("../../utils/validation.util");
|
|
19
|
+
var _useDebounce = require("../../hooks/useDebounce");
|
|
20
|
+
var _hooks = require("../../hooks");
|
|
21
21
|
var _invalid = require("../../images/invalid.svg");
|
|
22
22
|
var _popout = require("../../images/popout.svg");
|
|
23
23
|
var _warning = require("../../images/warning.svg");
|
|
@@ -113,7 +113,7 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
113
113
|
(_ref2 = ref) !== null && _ref2 !== void 0 ? _ref2 : ref = wrapperRef;
|
|
114
114
|
var inputRef = (0, _react.useRef)();
|
|
115
115
|
var errorsRef = (0, _react.useRef)();
|
|
116
|
-
(0,
|
|
116
|
+
(0, _hooks.useDetectOutsideClick)(ref, function () {
|
|
117
117
|
return setShowValidationRules(false);
|
|
118
118
|
});
|
|
119
119
|
var debounceAsync = (0, _useDebounce.useDebounce)();
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useChipCell = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _lodash = require("lodash");
|
|
9
|
+
var _common = require("../utils/common.util");
|
|
10
|
+
var _getFirstScrollableParent = require("../utils/getFirstScrollableParent.util");
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /*
|
|
17
|
+
Copyright 2019 Iguazio Systems Ltd.
|
|
18
|
+
|
|
19
|
+
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
20
|
+
an addition restriction as set forth herein. You may not use this
|
|
21
|
+
file except in compliance with the License. You may obtain a copy of
|
|
22
|
+
the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
23
|
+
|
|
24
|
+
Unless required by applicable law or agreed to in writing, software
|
|
25
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
26
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
27
|
+
implied. See the License for the specific language governing
|
|
28
|
+
permissions and limitations under the License.
|
|
29
|
+
|
|
30
|
+
In addition, you may not use the software for any purposes that are
|
|
31
|
+
illegal under applicable law, and the grant of the foregoing license
|
|
32
|
+
under the Apache 2.0 license is conditioned upon your compliance with
|
|
33
|
+
such restriction.
|
|
34
|
+
*/
|
|
35
|
+
var useChipCell = function useChipCell(isEditMode, visibleChipsMaxLength) {
|
|
36
|
+
var _useState = (0, _react.useState)(false),
|
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
38
|
+
showHiddenChips = _useState2[0],
|
|
39
|
+
setShowHiddenChips = _useState2[1];
|
|
40
|
+
var _useState3 = (0, _react.useState)({}),
|
|
41
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
42
|
+
chipsSizes = _useState4[0],
|
|
43
|
+
setChipsSizes = _useState4[1];
|
|
44
|
+
var _useState5 = (0, _react.useState)(false),
|
|
45
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
46
|
+
showChips = _useState6[0],
|
|
47
|
+
setShowChips = _useState6[1];
|
|
48
|
+
var _useState7 = (0, _react.useState)(8),
|
|
49
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
50
|
+
visibleChipsCount = _useState8[0],
|
|
51
|
+
setVisibleChipsCount = _useState8[1];
|
|
52
|
+
var transitionEndEventName = (0, _react.useMemo)(function () {
|
|
53
|
+
return (0, _common.getTransitionEndEventName)();
|
|
54
|
+
}, []);
|
|
55
|
+
var chipsCellRef = (0, _react.useRef)();
|
|
56
|
+
var chipsWrapperRef = (0, _react.useRef)();
|
|
57
|
+
var hiddenChipsCounterRef = (0, _react.useRef)();
|
|
58
|
+
var hiddenChipsPopUpRef = (0, _react.useRef)();
|
|
59
|
+
var handleShowElements = (0, _react.useCallback)(function () {
|
|
60
|
+
if (!isEditMode || isEditMode && visibleChipsMaxLength) {
|
|
61
|
+
setShowHiddenChips(function (state) {
|
|
62
|
+
return !state;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}, [isEditMode, visibleChipsMaxLength]);
|
|
66
|
+
(0, _react.useEffect)(function () {
|
|
67
|
+
if (showHiddenChips) {
|
|
68
|
+
window.addEventListener('click', handleShowElements);
|
|
69
|
+
return function () {
|
|
70
|
+
return window.removeEventListener('click', handleShowElements);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}, [showHiddenChips, handleShowElements]);
|
|
74
|
+
var handleScroll = (0, _react.useCallback)(function (event) {
|
|
75
|
+
if (event.target.parentElement !== (hiddenChipsPopUpRef === null || hiddenChipsPopUpRef === void 0 ? void 0 : hiddenChipsPopUpRef.current)) {
|
|
76
|
+
setShowHiddenChips(false);
|
|
77
|
+
}
|
|
78
|
+
}, [hiddenChipsPopUpRef]);
|
|
79
|
+
(0, _react.useEffect)(function () {
|
|
80
|
+
if (showHiddenChips) {
|
|
81
|
+
window.addEventListener('scroll', handleScroll, true);
|
|
82
|
+
}
|
|
83
|
+
return function () {
|
|
84
|
+
return window.removeEventListener('scroll', handleScroll, true);
|
|
85
|
+
};
|
|
86
|
+
}, [handleScroll, showHiddenChips]);
|
|
87
|
+
var resizeChipCell = (0, _react.useCallback)(function () {
|
|
88
|
+
if (hiddenChipsPopUpRef !== null && hiddenChipsPopUpRef !== void 0 && hiddenChipsPopUpRef.current) {
|
|
89
|
+
var _hiddenChipsCounterRe;
|
|
90
|
+
var scrollableParent = (0, _getFirstScrollableParent.getFirstScrollableParent)(hiddenChipsCounterRef.current.offsetParent);
|
|
91
|
+
var scrollableParentRect = scrollableParent.getBoundingClientRect();
|
|
92
|
+
var hiddenChipsCounterRect = (_hiddenChipsCounterRe = hiddenChipsCounterRef.current) === null || _hiddenChipsCounterRe === void 0 ? void 0 : _hiddenChipsCounterRe.getBoundingClientRect();
|
|
93
|
+
|
|
94
|
+
// Check if the hiddenChipsCounterRect is outside the boundaries of the scrollableParentRect or the window
|
|
95
|
+
if (hiddenChipsCounterRect.left < scrollableParentRect.left || hiddenChipsCounterRect.top < scrollableParentRect.top || hiddenChipsCounterRect.right > scrollableParentRect.right || hiddenChipsCounterRect.bottom > scrollableParentRect.bottom || hiddenChipsCounterRect.right > window.innerWidth || hiddenChipsCounterRect.bottom > window.innerHeight) {
|
|
96
|
+
setShowHiddenChips(false);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (!isEditMode && !(0, _common.isEveryObjectValueEmpty)(chipsSizes)) {
|
|
100
|
+
var _chipsCellRef$current;
|
|
101
|
+
var parentSize = (_chipsCellRef$current = chipsCellRef.current) === null || _chipsCellRef$current === void 0 ? void 0 : _chipsCellRef$current.getBoundingClientRect().width;
|
|
102
|
+
var maxLength = 0;
|
|
103
|
+
var chipIndex = 0;
|
|
104
|
+
var padding = 65;
|
|
105
|
+
Object.values(chipsSizes).every(function (chipSize, index) {
|
|
106
|
+
// Check if adding chipSize to maxLength exceeds parentSize
|
|
107
|
+
// or if adding chipSize and padding exceeds parentSize when there are multiple chips
|
|
108
|
+
if (maxLength + chipSize > parentSize || Object.values(chipsSizes).length > 1 && maxLength + chipSize + padding > parentSize) {
|
|
109
|
+
chipIndex = index;
|
|
110
|
+
return false;
|
|
111
|
+
} else {
|
|
112
|
+
maxLength += chipSize;
|
|
113
|
+
if (index === Object.values(chipsSizes).length - 1) {
|
|
114
|
+
chipIndex = 8;
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
setVisibleChipsCount(chipIndex);
|
|
120
|
+
setShowChips(true);
|
|
121
|
+
}
|
|
122
|
+
}, [chipsSizes, isEditMode]);
|
|
123
|
+
(0, _react.useEffect)(function () {
|
|
124
|
+
resizeChipCell();
|
|
125
|
+
}, [resizeChipCell]);
|
|
126
|
+
(0, _react.useEffect)(function () {
|
|
127
|
+
var resizeChipCellDebounced = (0, _lodash.throttle)(resizeChipCell, 500);
|
|
128
|
+
if (!isEditMode) {
|
|
129
|
+
window.addEventListener('resize', resizeChipCellDebounced);
|
|
130
|
+
window.addEventListener(transitionEndEventName, resizeChipCellDebounced);
|
|
131
|
+
return function () {
|
|
132
|
+
window.removeEventListener('resize', resizeChipCellDebounced);
|
|
133
|
+
window.removeEventListener(transitionEndEventName, resizeChipCellDebounced);
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}, [resizeChipCell, isEditMode, transitionEndEventName]);
|
|
137
|
+
return {
|
|
138
|
+
chipsCellRef: chipsCellRef,
|
|
139
|
+
chipsWrapperRef: chipsWrapperRef,
|
|
140
|
+
handleShowElements: handleShowElements,
|
|
141
|
+
hiddenChipsCounterRef: hiddenChipsCounterRef,
|
|
142
|
+
hiddenChipsPopUpRef: hiddenChipsPopUpRef,
|
|
143
|
+
setChipsSizes: setChipsSizes,
|
|
144
|
+
setShowHiddenChips: setShowHiddenChips,
|
|
145
|
+
showChips: showChips,
|
|
146
|
+
showHiddenChips: showHiddenChips,
|
|
147
|
+
visibleChipsCount: visibleChipsCount
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
exports.useChipCell = useChipCell;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useHiddenChipsBlock = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var _common = require("../utils/common.util");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /*
|
|
17
|
+
Copyright 2019 Iguazio Systems Ltd.
|
|
18
|
+
|
|
19
|
+
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
20
|
+
an addition restriction as set forth herein. You may not use this
|
|
21
|
+
file except in compliance with the License. You may obtain a copy of
|
|
22
|
+
the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
23
|
+
|
|
24
|
+
Unless required by applicable law or agreed to in writing, software
|
|
25
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
26
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
27
|
+
implied. See the License for the specific language governing
|
|
28
|
+
permissions and limitations under the License.
|
|
29
|
+
|
|
30
|
+
In addition, you may not use the software for any purposes that are
|
|
31
|
+
illegal under applicable law, and the grant of the foregoing license
|
|
32
|
+
under the Apache 2.0 license is conditioned upon your compliance with
|
|
33
|
+
such restriction.
|
|
34
|
+
*/
|
|
35
|
+
var useHiddenChipsBlock = function useHiddenChipsBlock(hiddenChipsCounterRef, hiddenChipsPopUpRef) {
|
|
36
|
+
var _useState = (0, _react.useState)(false),
|
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
38
|
+
isTop = _useState2[0],
|
|
39
|
+
setIsTop = _useState2[1];
|
|
40
|
+
var _useState3 = (0, _react.useState)(false),
|
|
41
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
42
|
+
isLeft = _useState4[0],
|
|
43
|
+
setIsLeft = _useState4[1];
|
|
44
|
+
var _useState5 = (0, _react.useState)(false),
|
|
45
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
46
|
+
isVisible = _useState6[0],
|
|
47
|
+
setIsVisible = _useState6[1];
|
|
48
|
+
var transitionEndEventName = (0, _react.useMemo)(function () {
|
|
49
|
+
return (0, _common.getTransitionEndEventName)();
|
|
50
|
+
}, []);
|
|
51
|
+
var hiddenChipsBlockClassNames = (0, _classnames.default)('chip-block-hidden', isTop ? 'chip-block-hidden_top' : 'chip-block-hidden_bottom', isLeft ? 'chip-block-hidden_left' : 'chip-block-hidden_right', isVisible && 'chip-block-hidden_visible');
|
|
52
|
+
var resizePopUp = (0, _react.useCallback)(function () {
|
|
53
|
+
if (hiddenChipsPopUpRef !== null && hiddenChipsPopUpRef !== void 0 && hiddenChipsPopUpRef.current && hiddenChipsCounterRef !== null && hiddenChipsCounterRef !== void 0 && hiddenChipsCounterRef.current) {
|
|
54
|
+
var offset = 10;
|
|
55
|
+
var offsetMargin = 20;
|
|
56
|
+
var elementRect = hiddenChipsCounterRef.current.getBoundingClientRect();
|
|
57
|
+
|
|
58
|
+
// Calculate the distance from the right edge of the window to the element's right edge
|
|
59
|
+
var elementRectRight = Math.floor(window.innerWidth - elementRect.left - elementRect.width);
|
|
60
|
+
|
|
61
|
+
// Calculate the distance from the bottom edge of the window to the element's bottom edge
|
|
62
|
+
var elementRectBottom = Math.floor(window.innerHeight - elementRect.top - elementRect.height);
|
|
63
|
+
var isLeftPosition = false;
|
|
64
|
+
var isTopPosition = false;
|
|
65
|
+
hiddenChipsPopUpRef.current.style.maxWidth = '100%';
|
|
66
|
+
hiddenChipsPopUpRef.current.style.maxHeight = '100%';
|
|
67
|
+
|
|
68
|
+
// Determine if the left position is preferred based on the element's position and available width
|
|
69
|
+
if (elementRect.left > hiddenChipsPopUpRef.current.clientWidth) {
|
|
70
|
+
isLeftPosition = true;
|
|
71
|
+
} else if (elementRectRight > hiddenChipsPopUpRef.current.clientWidth) {
|
|
72
|
+
isLeftPosition = false;
|
|
73
|
+
} else {
|
|
74
|
+
// Compare elementRect.left and elementRectRight to choose the larger value as the max width
|
|
75
|
+
isLeftPosition = elementRect.left > elementRectRight;
|
|
76
|
+
var popUpMaxWidth = Math.max(elementRect.left, elementRectRight);
|
|
77
|
+
hiddenChipsPopUpRef.current.style.maxWidth = "".concat(popUpMaxWidth, "px");
|
|
78
|
+
}
|
|
79
|
+
hiddenChipsPopUpRef.current.style.right = isLeftPosition ? "".concat(elementRectRight, "px") : 'unset';
|
|
80
|
+
hiddenChipsPopUpRef.current.style.left = isLeftPosition ? 'unset' : "".concat(elementRect.left, "px");
|
|
81
|
+
|
|
82
|
+
// Determine if the top position is preferred based on the element's position and available height
|
|
83
|
+
if (elementRect.top > hiddenChipsPopUpRef.current.clientHeight + offset + offsetMargin) {
|
|
84
|
+
isTopPosition = true;
|
|
85
|
+
} else if (elementRectBottom > hiddenChipsPopUpRef.current.clientHeight + offset + offsetMargin) {
|
|
86
|
+
isTopPosition = false;
|
|
87
|
+
} else {
|
|
88
|
+
// Compare elementRect.top and elementRectBottom to choose the larger value as the max height
|
|
89
|
+
isTopPosition = elementRect.top > elementRectBottom + offset;
|
|
90
|
+
var popUpMaxHeight = Math.max(elementRect.top, elementRectBottom) - offset - offsetMargin;
|
|
91
|
+
hiddenChipsPopUpRef.current.style.maxHeight = "".concat(popUpMaxHeight, "px");
|
|
92
|
+
}
|
|
93
|
+
hiddenChipsPopUpRef.current.style.bottom = isTopPosition ? "".concat(elementRectBottom + elementRect.height + offset, "px") : 'unset';
|
|
94
|
+
hiddenChipsPopUpRef.current.style.top = isTopPosition ? 'unset' : "".concat(elementRect.bottom + offset, "px");
|
|
95
|
+
setIsTop(isTopPosition);
|
|
96
|
+
setIsLeft(isLeftPosition);
|
|
97
|
+
setIsVisible(true);
|
|
98
|
+
}
|
|
99
|
+
}, [hiddenChipsCounterRef, hiddenChipsPopUpRef]);
|
|
100
|
+
(0, _react.useEffect)(function () {
|
|
101
|
+
if (hiddenChipsPopUpRef !== null && hiddenChipsPopUpRef !== void 0 && hiddenChipsPopUpRef.current && hiddenChipsCounterRef !== null && hiddenChipsCounterRef !== void 0 && hiddenChipsCounterRef.current) {
|
|
102
|
+
window.addEventListener('resize', resizePopUp);
|
|
103
|
+
window.addEventListener(transitionEndEventName, resizePopUp);
|
|
104
|
+
return function () {
|
|
105
|
+
window.removeEventListener('resize', resizePopUp);
|
|
106
|
+
window.removeEventListener(transitionEndEventName, resizePopUp);
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}, [hiddenChipsPopUpRef, hiddenChipsCounterRef, resizePopUp, transitionEndEventName]);
|
|
110
|
+
(0, _react.useEffect)(function () {
|
|
111
|
+
resizePopUp();
|
|
112
|
+
}, [resizePopUp]);
|
|
113
|
+
return {
|
|
114
|
+
hiddenChipsBlockClassNames: hiddenChipsBlockClassNames
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
exports.useHiddenChipsBlock = useHiddenChipsBlock;
|
package/dist/scss/common.scss
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
@import './colors';
|
|
2
2
|
@import './borders';
|
|
3
3
|
@import './variables';
|
|
4
|
+
@import './shadows';
|
|
5
|
+
@import './mixins';
|
|
4
6
|
|
|
5
7
|
#root {
|
|
6
8
|
z-index: 1;
|
|
@@ -253,3 +255,57 @@ textarea {
|
|
|
253
255
|
}
|
|
254
256
|
}
|
|
255
257
|
}
|
|
258
|
+
|
|
259
|
+
.chip-block-hidden {
|
|
260
|
+
position: fixed;
|
|
261
|
+
display: flex;
|
|
262
|
+
flex-direction: column;
|
|
263
|
+
top: unset;
|
|
264
|
+
right: unset;
|
|
265
|
+
left: unset;
|
|
266
|
+
bottom: unset;
|
|
267
|
+
width: min-content;
|
|
268
|
+
height: min-content;
|
|
269
|
+
min-width: 250px;
|
|
270
|
+
max-width: 100%;
|
|
271
|
+
max-height: 100%;
|
|
272
|
+
padding: 10px;
|
|
273
|
+
background-color: $white;
|
|
274
|
+
border-radius: $mainBorderRadius;
|
|
275
|
+
box-shadow: $hiddenChipsBlockShadow;
|
|
276
|
+
z-index: 9;
|
|
277
|
+
opacity: 0;
|
|
278
|
+
|
|
279
|
+
&__scrollable-container {
|
|
280
|
+
overflow: auto;
|
|
281
|
+
display: flex;
|
|
282
|
+
width: 100%;
|
|
283
|
+
flex-flow: row wrap;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
&_bottom {
|
|
287
|
+
&::after {
|
|
288
|
+
@include hiddenChipBlockArrow();
|
|
289
|
+
|
|
290
|
+
top: -6px;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
&_top {
|
|
295
|
+
&::before {
|
|
296
|
+
@include hiddenChipBlockArrow();
|
|
297
|
+
|
|
298
|
+
top: calc(100% - 6px);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
&_left {
|
|
303
|
+
&::before, &::after {
|
|
304
|
+
right: 15px;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
&_visible {
|
|
309
|
+
opacity: 1;
|
|
310
|
+
}
|
|
311
|
+
}
|
package/dist/scss/shadows.scss
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
$jobsShadow: 0 3px 4px rgba($black, 0.18);
|
|
4
4
|
$headerShadow: inset 0 -1px 0 #edecef;
|
|
5
5
|
$mainHeaderShadow: 0 2px 4px -1px rgba($black, 0.2), 0 4px 5px 0 rgba($black, 0.14),
|
|
6
|
-
|
|
6
|
+
0 1px 10px 0 rgba($black, 0.12);
|
|
7
7
|
$filterShadow: 0 4px 8px rgba($black, 0.23);
|
|
8
8
|
$tooltipShadow: 0 5px 11px rgba($black, 0.18);
|
|
9
|
-
$hiddenChipsBlockShadow:
|
|
9
|
+
$hiddenChipsBlockShadow: 2px 2px 8px 2px rgba($black, 0.2);
|
|
10
10
|
$previewBoxShadowInit: 0px 3px 10px rgba(0, 0, 0, 0.07);
|
|
11
11
|
$previewBoxShadow: 0 3px 10px rgba($black, 0.3);
|
|
12
12
|
$projectStatisticsShadow: 0 8px 30px rgba($topaz, 0.08);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.openPopUp = exports.openConfirmPopUp = exports.isEveryObjectValueEmpty = exports.areArraysEqual = void 0;
|
|
6
|
+
exports.openPopUp = exports.openConfirmPopUp = exports.isEveryObjectValueEmpty = exports.getTransitionEndEventName = exports.areArraysEqual = void 0;
|
|
7
7
|
var _reactModalPromise = require("react-modal-promise");
|
|
8
8
|
var _lodash = require("lodash");
|
|
9
9
|
var _components = require("../components");
|
|
@@ -60,4 +60,25 @@ var areArraysEqual = function areArraysEqual(firstArray, secondArray) {
|
|
|
60
60
|
return (0, _lodash.isEqual)((0, _lodash.omit)(a, omitBy), (0, _lodash.omit)(b, omitBy));
|
|
61
61
|
}));
|
|
62
62
|
};
|
|
63
|
-
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Retrieves the appropriate transition end event name based on the browser.
|
|
66
|
+
*
|
|
67
|
+
* @returns {string} The transition end event name.
|
|
68
|
+
*/
|
|
69
|
+
exports.areArraysEqual = areArraysEqual;
|
|
70
|
+
var getTransitionEndEventName = function getTransitionEndEventName() {
|
|
71
|
+
var transitions = {
|
|
72
|
+
transition: 'transitionend',
|
|
73
|
+
OTransition: 'oTransitionEnd',
|
|
74
|
+
MozTransition: 'transitionend',
|
|
75
|
+
WebkitTransition: 'webkitTransitionEnd'
|
|
76
|
+
};
|
|
77
|
+
var bodyStyle = document.body.style;
|
|
78
|
+
for (var transition in transitions) {
|
|
79
|
+
if (bodyStyle[transition] !== undefined) {
|
|
80
|
+
return transitions[transition];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
exports.getTransitionEndEventName = getTransitionEndEventName;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getFirstScrollableParent = void 0;
|
|
7
7
|
/*
|
|
8
8
|
Copyright 2022 Iguazio Systems Ltd.
|
|
9
9
|
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
@@ -21,13 +21,35 @@ under the Apache 2.0 license is conditioned upon your compliance with
|
|
|
21
21
|
such restriction.
|
|
22
22
|
*/
|
|
23
23
|
var regex = /(auto|scroll|hidden)/;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves the computed style of a node for the specified CSS property.
|
|
27
|
+
*
|
|
28
|
+
* @param {Node} node - The DOM node.
|
|
29
|
+
* @param {string} prop - The CSS property to retrieve.
|
|
30
|
+
* @returns {string} The computed style value.
|
|
31
|
+
*/
|
|
24
32
|
var style = function style(node, prop) {
|
|
25
33
|
return getComputedStyle(node, null).getPropertyValue(prop);
|
|
26
34
|
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Checks if the given node has a scrollable overflow.
|
|
38
|
+
*
|
|
39
|
+
* @param {Node} node - The DOM node.
|
|
40
|
+
* @returns {boolean} Returns true if the node has a scrollable overflow, false otherwise.
|
|
41
|
+
*/
|
|
27
42
|
var scroll = function scroll(node) {
|
|
28
43
|
return regex.test(style(node, 'overflow') + style(node, 'overflow-y') + style(node, 'overflow-x'));
|
|
29
44
|
};
|
|
30
|
-
|
|
31
|
-
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Finds the first scrollable parent node of the given node.
|
|
48
|
+
*
|
|
49
|
+
* @param {Node} node - The DOM node.
|
|
50
|
+
* @returns {Node} The first scrollable parent node.
|
|
51
|
+
*/
|
|
52
|
+
var getFirstScrollableParent = function getFirstScrollableParent(node) {
|
|
53
|
+
return !node || node === document.body ? document.body : scroll(node) ? node : getFirstScrollableParent(node.parentNode);
|
|
32
54
|
};
|
|
33
|
-
exports.
|
|
55
|
+
exports.getFirstScrollableParent = getFirstScrollableParent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iguazio.dashboard-react-controls",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
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",
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _Tooltip = _interopRequireDefault(require("../../components/Tooltip/Tooltip"));
|
|
12
|
-
var _TextTooltipTemplate = _interopRequireDefault(require("../../components/TooltipTemplate/TextTooltipTemplate"));
|
|
13
|
-
var _types = require("../../types");
|
|
14
|
-
var _getFirstScrollableParent = require("../../utils/getFirstScrollableParent.util");
|
|
15
|
-
require("./hiddenChipsBlock.scss");
|
|
16
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
|
|
20
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
24
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
25
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /*
|
|
26
|
-
Copyright 2022 Iguazio Systems Ltd.
|
|
27
|
-
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
28
|
-
an addition restriction as set forth herein. You may not use this
|
|
29
|
-
file except in compliance with the License. You may obtain a copy of
|
|
30
|
-
the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
31
|
-
Unless required by applicable law or agreed to in writing, software
|
|
32
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
33
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
34
|
-
implied. See the License for the specific language governing
|
|
35
|
-
permissions and limitations under the License.
|
|
36
|
-
In addition, you may not use the software for any purposes that are
|
|
37
|
-
illegal under applicable law, and the grant of the foregoing license
|
|
38
|
-
under the Apache 2.0 license is conditioned upon your compliance with
|
|
39
|
-
such restriction.
|
|
40
|
-
*/
|
|
41
|
-
var HiddenChipsBlock = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
42
|
-
var chipClassNames = _ref.chipClassNames,
|
|
43
|
-
chipOptions = _ref.chipOptions,
|
|
44
|
-
chips = _ref.chips,
|
|
45
|
-
handleShowElements = _ref.handleShowElements,
|
|
46
|
-
textOverflowEllipsis = _ref.textOverflowEllipsis;
|
|
47
|
-
var _useState = (0, _react.useState)(false),
|
|
48
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
49
|
-
isTop = _useState2[0],
|
|
50
|
-
setIsTop = _useState2[1];
|
|
51
|
-
var _useState3 = (0, _react.useState)(true),
|
|
52
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
53
|
-
isRight = _useState4[0],
|
|
54
|
-
setIsRight = _useState4[1];
|
|
55
|
-
var _useState5 = (0, _react.useState)(false),
|
|
56
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
57
|
-
isVisible = _useState6[0],
|
|
58
|
-
setIsVisible = _useState6[1];
|
|
59
|
-
var _useState7 = (0, _react.useState)(window.innerWidth / 2),
|
|
60
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
61
|
-
windowHalfWidth = _useState8[0],
|
|
62
|
-
setWindowHalfWidth = _useState8[1];
|
|
63
|
-
var hiddenRef = (0, _react.useRef)();
|
|
64
|
-
var offset = 28;
|
|
65
|
-
var hiddenChipsBlockClassNames = (0, _classnames.default)('chip-block-hidden', isTop ? 'chip-block-hidden_top' : 'chip-block-hidden_bottom', isRight ? 'chip-block-hidden_right' : 'chip-block-hidden_left', isVisible && 'chip-block-hidden_visible');
|
|
66
|
-
var chipLabelClassNames = (0, _classnames.default)('chip__label', textOverflowEllipsis && 'data-ellipsis');
|
|
67
|
-
var chipValueClassNames = (0, _classnames.default)('chip__value', textOverflowEllipsis && 'data-ellipsis', chipOptions.boldValue && 'chip-value_bold');
|
|
68
|
-
var handleResize = (0, _react.useCallback)(function () {
|
|
69
|
-
if (hiddenRef !== null && hiddenRef !== void 0 && hiddenRef.current) {
|
|
70
|
-
setWindowHalfWidth(parseInt(window.innerWidth / 2));
|
|
71
|
-
}
|
|
72
|
-
}, [hiddenRef]);
|
|
73
|
-
var generateChipData = function generateChipData(chip) {
|
|
74
|
-
return chip.isKeyOnly ? chip.key : "".concat(chip.key).concat(chip.delimiter ? chip.delimiter : ':', " ").concat(chip.value);
|
|
75
|
-
};
|
|
76
|
-
(0, _react.useEffect)(function () {
|
|
77
|
-
handleResize();
|
|
78
|
-
}, [handleResize]);
|
|
79
|
-
(0, _react.useEffect)(function () {
|
|
80
|
-
if (hiddenRef !== null && hiddenRef !== void 0 && hiddenRef.current) {
|
|
81
|
-
window.addEventListener('resize', handleResize);
|
|
82
|
-
return function () {
|
|
83
|
-
return window.removeEventListener('resize', handleResize);
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
}, [handleResize, hiddenRef]);
|
|
87
|
-
(0, _react.useEffect)(function () {
|
|
88
|
-
if (hiddenRef !== null && hiddenRef !== void 0 && hiddenRef.current) {
|
|
89
|
-
var scrollableParent = (0, _getFirstScrollableParent.getFirstScrollableParentUtil)(hiddenRef.current.offsetParent);
|
|
90
|
-
var _hiddenRef$current$ge = hiddenRef.current.getBoundingClientRect(),
|
|
91
|
-
height = _hiddenRef$current$ge.height,
|
|
92
|
-
top = _hiddenRef$current$ge.top;
|
|
93
|
-
var _ref$current$getBound = ref.current.getBoundingClientRect(),
|
|
94
|
-
right = _ref$current$getBound.right;
|
|
95
|
-
if (hiddenRef.current.offsetParent.getBoundingClientRect().top - hiddenRef.current.offsetParent.clientHeight - height - offset < 0 || scrollableParent.getBoundingClientRect().top > top) {
|
|
96
|
-
setIsTop(true);
|
|
97
|
-
}
|
|
98
|
-
setIsRight(right <= windowHalfWidth);
|
|
99
|
-
setIsVisible(true);
|
|
100
|
-
}
|
|
101
|
-
}, [hiddenRef, isRight, offset, ref, windowHalfWidth]);
|
|
102
|
-
(0, _react.useEffect)(function () {
|
|
103
|
-
if (chips.length === 0) {
|
|
104
|
-
handleShowElements();
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
108
|
-
ref: hiddenRef,
|
|
109
|
-
className: hiddenChipsBlockClassNames,
|
|
110
|
-
children: chips === null || chips === void 0 ? void 0 : chips.map(function (element) {
|
|
111
|
-
var _element$delimiter;
|
|
112
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
113
|
-
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextTooltipTemplate.default, {
|
|
114
|
-
text: element.delimiter ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
115
|
-
className: "chip__content",
|
|
116
|
-
children: [element.key, !element.isKeyOnly && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
117
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
118
|
-
className: "chip__delimiter",
|
|
119
|
-
children: element.delimiter
|
|
120
|
-
}), element.value]
|
|
121
|
-
})]
|
|
122
|
-
}) : generateChipData(element)
|
|
123
|
-
}),
|
|
124
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
125
|
-
className: chipClassNames,
|
|
126
|
-
children: [element.key && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
127
|
-
className: chipLabelClassNames,
|
|
128
|
-
children: element.key
|
|
129
|
-
}), element.value && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
130
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
131
|
-
className: "chip__delimiter",
|
|
132
|
-
children: (_element$delimiter = element.delimiter) !== null && _element$delimiter !== void 0 ? _element$delimiter : ':'
|
|
133
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
134
|
-
className: chipValueClassNames,
|
|
135
|
-
children: element.value
|
|
136
|
-
})]
|
|
137
|
-
})]
|
|
138
|
-
})
|
|
139
|
-
}, element.id);
|
|
140
|
-
})
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
HiddenChipsBlock.defaultProps = {
|
|
144
|
-
textOverflowEllipsis: false
|
|
145
|
-
};
|
|
146
|
-
HiddenChipsBlock.propTypes = {
|
|
147
|
-
chipClassNames: _propTypes.default.string.isRequired,
|
|
148
|
-
chipOptions: _types.CHIP_OPTIONS.isRequired,
|
|
149
|
-
chips: _propTypes.default.array.isRequired,
|
|
150
|
-
handleShowElements: _propTypes.default.func.isRequired,
|
|
151
|
-
textOverflowEllipsis: _propTypes.default.bool
|
|
152
|
-
};
|
|
153
|
-
var _default = HiddenChipsBlock;
|
|
154
|
-
exports.default = _default;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
@import '../../scss/variables';
|
|
2
|
-
@import '../../scss/colors';
|
|
3
|
-
@import '../../scss/shadows';
|
|
4
|
-
@import '../../scss/borders';
|
|
5
|
-
@import '../../scss/mixins';
|
|
6
|
-
|
|
7
|
-
.chip-block-hidden {
|
|
8
|
-
position: absolute;
|
|
9
|
-
right: 0;
|
|
10
|
-
z-index: 6;
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-flow: row wrap;
|
|
13
|
-
min-width: 250px;
|
|
14
|
-
max-width: 45vw;
|
|
15
|
-
padding: 10px;
|
|
16
|
-
background-color: $white;
|
|
17
|
-
border-radius: $mainBorderRadius;
|
|
18
|
-
box-shadow: $hiddenChipsBlockShadow;
|
|
19
|
-
opacity: 0;
|
|
20
|
-
|
|
21
|
-
&_bottom {
|
|
22
|
-
bottom: 112%;
|
|
23
|
-
|
|
24
|
-
&::after {
|
|
25
|
-
@include hiddenChipBlockArrow();
|
|
26
|
-
|
|
27
|
-
bottom: -6px;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&_top {
|
|
32
|
-
top: 112%;
|
|
33
|
-
|
|
34
|
-
&::before {
|
|
35
|
-
@include hiddenChipBlockArrow();
|
|
36
|
-
|
|
37
|
-
top: -6px;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&_left {
|
|
42
|
-
&::before {
|
|
43
|
-
right: 20px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&::after {
|
|
47
|
-
right: 20px;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&_right {
|
|
52
|
-
right: unset;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
&_visible {
|
|
56
|
-
opacity: 1;
|
|
57
|
-
}
|
|
58
|
-
}
|