iguazio.dashboard-react-controls 0.0.4 → 0.0.7
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/Backdrop/Backdrop.js +48 -0
- package/dist/components/Backdrop/Backdrop.scss +32 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.js +100 -0
- package/dist/components/ConfirmDialog/confirmDialog.scss +19 -0
- package/dist/components/FormCheckBox/FormCheckBox.js +57 -0
- package/dist/components/FormCheckBox/formCheckBox.scss +33 -0
- package/dist/components/FormInput/FormInput.js +418 -0
- package/dist/components/FormInput/formInput.scss +169 -0
- package/dist/components/FormSelect/FormSelect.js +306 -0
- package/dist/components/FormSelect/FormSelect.test.js +158 -0
- package/dist/components/FormSelect/formSelect.scss +303 -0
- package/dist/components/Modal/Modal.js +116 -0
- package/dist/components/Modal/Modal.scss +121 -0
- package/dist/components/PopUpDialog/PopUpDialog.js +1 -1
- package/dist/components/PopUpDialog/popUpDialog.scss +2 -2
- package/dist/components/Tip/Tip.js +132 -0
- package/dist/components/Tip/Tip.test.js +96 -0
- package/dist/components/Tip/tip.scss +89 -0
- package/dist/components/Wizard/Wizard.js +253 -0
- package/dist/components/Wizard/Wizard.scss +17 -0
- package/dist/components/Wizard/WizardSteps/WizardSteps.js +65 -0
- package/dist/components/Wizard/WizardSteps/WizardSteps.scss +67 -0
- package/dist/components/index.js +56 -0
- package/dist/constants.js +29 -3
- package/dist/elements/OptionsMenu/OptionsMenu.js +64 -0
- package/dist/elements/OptionsMenu/optionsMenu.scss +49 -0
- package/dist/elements/SelectOption/SelectOption.js +95 -0
- package/dist/elements/SelectOption/SelectOption.test.js +99 -0
- package/dist/elements/SelectOption/selectOption.scss +61 -0
- package/dist/elements/ValidationTemplate/ValidationTemplate.js +48 -0
- package/dist/elements/ValidationTemplate/ValidationTemplate.scss +36 -0
- package/dist/hooks/useDetectOutsideClick.js +34 -0
- package/dist/images/checkmark2.svg +3 -0
- package/dist/index.js +5 -1
- package/dist/scss/colors.scss +1 -0
- package/dist/scss/mixins.scss +11 -23
- package/dist/scss/variables.scss +1 -0
- package/dist/types.js +62 -2
- package/dist/utils/validationService.js +269 -0
- package/package.json +7 -4
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
@import '../../scss/mixins';
|
|
2
|
+
@import '../../scss/colors';
|
|
3
|
+
@import '../../scss/borders';
|
|
4
|
+
@import '../../scss/shadows';
|
|
5
|
+
|
|
6
|
+
.form-field {
|
|
7
|
+
position: relative;
|
|
8
|
+
display: block;
|
|
9
|
+
width: 100%;
|
|
10
|
+
|
|
11
|
+
&__label {
|
|
12
|
+
margin-bottom: 5px;
|
|
13
|
+
color: $topaz;
|
|
14
|
+
font-size: 12px;
|
|
15
|
+
text-transform: capitalize;
|
|
16
|
+
background-color: transparent;
|
|
17
|
+
|
|
18
|
+
&-disabled {
|
|
19
|
+
color: $spunPearl;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__select {
|
|
24
|
+
padding-left: 16px;
|
|
25
|
+
padding-right: 30px;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
|
|
28
|
+
@include fieldWrapper;
|
|
29
|
+
|
|
30
|
+
&-active:not(.without-border) {
|
|
31
|
+
background: $alabaster;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&-disabled {
|
|
35
|
+
color: $spunPearl;
|
|
36
|
+
cursor: not-allowed;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.without {
|
|
40
|
+
&-border {
|
|
41
|
+
border-color: transparent;
|
|
42
|
+
|
|
43
|
+
.form-field__caret {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&:hover {
|
|
48
|
+
.form-field__caret {
|
|
49
|
+
display: block;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&-label {
|
|
55
|
+
padding-left: 16px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&-dense {
|
|
60
|
+
padding-top: 12px;
|
|
61
|
+
padding-bottom: 12px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&-normal {
|
|
65
|
+
padding-top: 14px;
|
|
66
|
+
padding-bottom: 14px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&-medium {
|
|
70
|
+
padding-top: 16px;
|
|
71
|
+
padding-bottom: 16px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&-chunky {
|
|
75
|
+
padding-top: 18px;
|
|
76
|
+
padding-bottom: 18px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&-value {
|
|
80
|
+
display: block;
|
|
81
|
+
min-height: 18px;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// .select {
|
|
87
|
+
// position: relative;
|
|
88
|
+
// display: flex;
|
|
89
|
+
// flex-flow: column;
|
|
90
|
+
// flex: 1 0;
|
|
91
|
+
// cursor: pointer;
|
|
92
|
+
|
|
93
|
+
// @include fieldWrapper;
|
|
94
|
+
|
|
95
|
+
// &__label {
|
|
96
|
+
// margin-bottom: 5px;
|
|
97
|
+
// color: $topaz;
|
|
98
|
+
// font-size: 12px;
|
|
99
|
+
// text-transform: capitalize;
|
|
100
|
+
// background-color: transparent;
|
|
101
|
+
|
|
102
|
+
// &-mandatory {
|
|
103
|
+
// color: $amaranth;
|
|
104
|
+
// }
|
|
105
|
+
|
|
106
|
+
// &-disabled {
|
|
107
|
+
// color: $spunPearl;
|
|
108
|
+
|
|
109
|
+
// .form-field__label-mandatory {
|
|
110
|
+
// color: $spunPearl;
|
|
111
|
+
// }
|
|
112
|
+
// }
|
|
113
|
+
// }
|
|
114
|
+
|
|
115
|
+
// &_active:not(.without-border) {
|
|
116
|
+
// background: $alabaster;
|
|
117
|
+
// }
|
|
118
|
+
|
|
119
|
+
// &__caret {
|
|
120
|
+
// position: absolute;
|
|
121
|
+
// top: 50%;
|
|
122
|
+
// right: 10px;
|
|
123
|
+
// transform: translate(0%, -50%);
|
|
124
|
+
// }
|
|
125
|
+
|
|
126
|
+
// &.without {
|
|
127
|
+
// &-border {
|
|
128
|
+
// border: none;
|
|
129
|
+
|
|
130
|
+
// .select__caret {
|
|
131
|
+
// display: none;
|
|
132
|
+
// }
|
|
133
|
+
|
|
134
|
+
// &:hover {
|
|
135
|
+
// .select__caret {
|
|
136
|
+
// display: block;
|
|
137
|
+
// }
|
|
138
|
+
// }
|
|
139
|
+
// }
|
|
140
|
+
|
|
141
|
+
// &-label {
|
|
142
|
+
// padding-left: 16px;
|
|
143
|
+
// }
|
|
144
|
+
// }
|
|
145
|
+
|
|
146
|
+
// &__header {
|
|
147
|
+
// position: relative;
|
|
148
|
+
// display: flex;
|
|
149
|
+
// align-items: center;
|
|
150
|
+
// width: 100%;
|
|
151
|
+
// height: 100%;
|
|
152
|
+
// }
|
|
153
|
+
|
|
154
|
+
// &__value {
|
|
155
|
+
// min-width: 96px;
|
|
156
|
+
// min-height: 1em;
|
|
157
|
+
// padding-right: 50px;
|
|
158
|
+
// overflow: hidden;
|
|
159
|
+
// color: $mulledWine;
|
|
160
|
+
// white-space: nowrap;
|
|
161
|
+
// text-overflow: ellipsis;
|
|
162
|
+
|
|
163
|
+
// &_floating {
|
|
164
|
+
// position: relative;
|
|
165
|
+
// top: 6px;
|
|
166
|
+
// left: 16px;
|
|
167
|
+
// }
|
|
168
|
+
// }
|
|
169
|
+
|
|
170
|
+
// &__label {
|
|
171
|
+
// top: 15px;
|
|
172
|
+
// left: 0;
|
|
173
|
+
// padding: 0 5px 0 16px;
|
|
174
|
+
// color: $topaz;
|
|
175
|
+
// font-size: 15px;
|
|
176
|
+
// text-transform: capitalize;
|
|
177
|
+
// transition: 200ms ease;
|
|
178
|
+
|
|
179
|
+
// &_floating {
|
|
180
|
+
// position: absolute;
|
|
181
|
+
// top: 0;
|
|
182
|
+
// left: 0;
|
|
183
|
+
// padding-top: 9px;
|
|
184
|
+
// font-weight: 700;
|
|
185
|
+
// font-size: 10px;
|
|
186
|
+
// line-height: 12px;
|
|
187
|
+
// letter-spacing: 0.5px;
|
|
188
|
+
// transition: 200ms ease;
|
|
189
|
+
// }
|
|
190
|
+
|
|
191
|
+
// &_top {
|
|
192
|
+
// position: absolute;
|
|
193
|
+
// top: -20px;
|
|
194
|
+
// left: 0;
|
|
195
|
+
// padding: 0;
|
|
196
|
+
// font-weight: bold;
|
|
197
|
+
// font-size: 12px;
|
|
198
|
+
// line-height: 15px;
|
|
199
|
+
|
|
200
|
+
// & + .select__value {
|
|
201
|
+
// padding-left: 15px;
|
|
202
|
+
// }
|
|
203
|
+
// }
|
|
204
|
+
// }
|
|
205
|
+
|
|
206
|
+
// &__options-list {
|
|
207
|
+
// .pop-up-dialog {
|
|
208
|
+
// width: 100%;
|
|
209
|
+
// padding: 0;
|
|
210
|
+
|
|
211
|
+
// &__header {
|
|
212
|
+
// display: none;
|
|
213
|
+
// }
|
|
214
|
+
// }
|
|
215
|
+
// }
|
|
216
|
+
|
|
217
|
+
// &.disabled {
|
|
218
|
+
// cursor: not-allowed;
|
|
219
|
+
|
|
220
|
+
// .select__label,
|
|
221
|
+
// .select__value {
|
|
222
|
+
// color: $spunPearl;
|
|
223
|
+
// }
|
|
224
|
+
// }
|
|
225
|
+
|
|
226
|
+
// .sub-label {
|
|
227
|
+
// margin-left: 5px;
|
|
228
|
+
// overflow: hidden;
|
|
229
|
+
// color: $topaz;
|
|
230
|
+
// white-space: nowrap;
|
|
231
|
+
// text-overflow: ellipsis;
|
|
232
|
+
// }
|
|
233
|
+
|
|
234
|
+
// &__body {
|
|
235
|
+
// width: 100%;
|
|
236
|
+
// max-height: 250px;
|
|
237
|
+
// overflow-y: auto;
|
|
238
|
+
// color: $mulledWineTwo;
|
|
239
|
+
// background-color: $white;
|
|
240
|
+
// border: $primaryBorder;
|
|
241
|
+
// border-radius: 2px;
|
|
242
|
+
// box-shadow: $filterShadow;
|
|
243
|
+
// }
|
|
244
|
+
|
|
245
|
+
// &__search {
|
|
246
|
+
// width: 100%;
|
|
247
|
+
|
|
248
|
+
// input {
|
|
249
|
+
// width: 100%;
|
|
250
|
+
// padding: 10px;
|
|
251
|
+
// border: none;
|
|
252
|
+
// border-bottom: $primaryBorder;
|
|
253
|
+
// }
|
|
254
|
+
// }
|
|
255
|
+
|
|
256
|
+
// .actions {
|
|
257
|
+
// position: absolute;
|
|
258
|
+
// right: 25px;
|
|
259
|
+
// }
|
|
260
|
+
|
|
261
|
+
// .disabled {
|
|
262
|
+
// color: $spunPearl;
|
|
263
|
+
// cursor: default;
|
|
264
|
+
// user-select: none;
|
|
265
|
+
|
|
266
|
+
// &:hover {
|
|
267
|
+
// background-color: $white;
|
|
268
|
+
// }
|
|
269
|
+
// }
|
|
270
|
+
|
|
271
|
+
// .pop-up-dialog__overlay {
|
|
272
|
+
// top: 100%;
|
|
273
|
+
// right: calc(100% + 10px);
|
|
274
|
+
// }
|
|
275
|
+
|
|
276
|
+
// &-dense {
|
|
277
|
+
// height: 40px;
|
|
278
|
+
|
|
279
|
+
// .select__label_floating {
|
|
280
|
+
// padding-top: 6px;
|
|
281
|
+
// }
|
|
282
|
+
// }
|
|
283
|
+
|
|
284
|
+
// &-normal {
|
|
285
|
+
// height: 48px;
|
|
286
|
+
// }
|
|
287
|
+
|
|
288
|
+
// &-medium {
|
|
289
|
+
// height: 52px;
|
|
290
|
+
|
|
291
|
+
// .select__label_floating {
|
|
292
|
+
// padding-top: 11px;
|
|
293
|
+
// }
|
|
294
|
+
// }
|
|
295
|
+
|
|
296
|
+
// &-chunky {
|
|
297
|
+
// height: 56px;
|
|
298
|
+
|
|
299
|
+
// .select__label_floating {
|
|
300
|
+
// padding-top: 13px;
|
|
301
|
+
// }
|
|
302
|
+
// }
|
|
303
|
+
// }
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _reactDom = require("react-dom");
|
|
13
|
+
|
|
14
|
+
var _reactTransitionGroup = require("react-transition-group");
|
|
15
|
+
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
|
|
18
|
+
var _Backdrop = _interopRequireDefault(require("../Backdrop/Backdrop"));
|
|
19
|
+
|
|
20
|
+
var _RoundedIcon = _interopRequireDefault(require("../RoundedIcon/RoundedIcon"));
|
|
21
|
+
|
|
22
|
+
var _constants = require("../../constants");
|
|
23
|
+
|
|
24
|
+
var _types = require("../../types");
|
|
25
|
+
|
|
26
|
+
var _close = require("../../images/close.svg");
|
|
27
|
+
|
|
28
|
+
require("./Modal.scss");
|
|
29
|
+
|
|
30
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
+
|
|
34
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
35
|
+
|
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
37
|
+
|
|
38
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
39
|
+
|
|
40
|
+
var JSX_MODAL = function JSX_MODAL(_ref) {
|
|
41
|
+
var actions = _ref.actions,
|
|
42
|
+
children = _ref.children,
|
|
43
|
+
className = _ref.className,
|
|
44
|
+
onClose = _ref.onClose,
|
|
45
|
+
size = _ref.size,
|
|
46
|
+
show = _ref.show,
|
|
47
|
+
title = _ref.title;
|
|
48
|
+
var modalClassNames = (0, _classnames.default)('modal', className, size && "modal-".concat(size));
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
50
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Backdrop.default, {
|
|
51
|
+
onClose: onClose,
|
|
52
|
+
show: show
|
|
53
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
|
|
54
|
+
in: show,
|
|
55
|
+
timeout: 300,
|
|
56
|
+
classNames: "modal-transition",
|
|
57
|
+
unmountOnExit: true,
|
|
58
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
59
|
+
className: modalClassNames,
|
|
60
|
+
"data-testid": "modal",
|
|
61
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
62
|
+
className: "modal__header-button",
|
|
63
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RoundedIcon.default, {
|
|
64
|
+
"data-testid": "pop-up-close-btn",
|
|
65
|
+
onClick: onClose,
|
|
66
|
+
tooltipText: "Close",
|
|
67
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_close.ReactComponent, {})
|
|
68
|
+
})
|
|
69
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
70
|
+
className: "modal__content",
|
|
71
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
72
|
+
className: "modal__header",
|
|
73
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h5", {
|
|
74
|
+
className: "modal__header-title",
|
|
75
|
+
children: title
|
|
76
|
+
})
|
|
77
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
78
|
+
className: "modal__body",
|
|
79
|
+
children: children
|
|
80
|
+
}), actions && actions.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
81
|
+
className: "modal__footer",
|
|
82
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
83
|
+
className: "modal__footer-actions",
|
|
84
|
+
children: actions.map(function (action, idx) {
|
|
85
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
86
|
+
children: action
|
|
87
|
+
}, idx);
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
})]
|
|
91
|
+
})]
|
|
92
|
+
})
|
|
93
|
+
})]
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
var Modal = function Modal(props) {
|
|
98
|
+
return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/(0, _jsxRuntime.jsx)(JSX_MODAL, _objectSpread({}, props)), document.getElementById('overlay_container'));
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
Modal.defaultProps = {
|
|
102
|
+
actions: [],
|
|
103
|
+
show: false,
|
|
104
|
+
size: _constants.MODAL_MD,
|
|
105
|
+
title: ''
|
|
106
|
+
};
|
|
107
|
+
Modal.propTypes = {
|
|
108
|
+
actions: _propTypes.default.array,
|
|
109
|
+
children: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.object, _propTypes.default.node, _propTypes.default.string]).isRequired,
|
|
110
|
+
onClose: _propTypes.default.func.isRequired,
|
|
111
|
+
show: _propTypes.default.bool.isRequired,
|
|
112
|
+
size: _types.MODAL_SIZES,
|
|
113
|
+
title: _propTypes.default.string
|
|
114
|
+
};
|
|
115
|
+
var _default = Modal;
|
|
116
|
+
exports.default = _default;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
@import '../../scss/variables';
|
|
2
|
+
@import '../../scss/colors';
|
|
3
|
+
@import '../../scss/borders';
|
|
4
|
+
|
|
5
|
+
.modal {
|
|
6
|
+
position: fixed;
|
|
7
|
+
top: 50%;
|
|
8
|
+
left: 50%;
|
|
9
|
+
width: 700px;
|
|
10
|
+
height: 660px;
|
|
11
|
+
max-width: 96%;
|
|
12
|
+
max-height: 96%;
|
|
13
|
+
outline: 0;
|
|
14
|
+
transform: translate(-50%, -50%);
|
|
15
|
+
z-index: 9;
|
|
16
|
+
|
|
17
|
+
@media screen and (min-width: 1200px) {
|
|
18
|
+
width: 1000px;
|
|
19
|
+
|
|
20
|
+
&-sm {
|
|
21
|
+
width: 700px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&-lg {
|
|
25
|
+
width: 1400px;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__content {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-flow: column nowrap;
|
|
32
|
+
position: relative;
|
|
33
|
+
padding-bottom: 1rem;
|
|
34
|
+
min-height: inherit;
|
|
35
|
+
height: 100%;
|
|
36
|
+
width: 100%;
|
|
37
|
+
max-height: 100%;
|
|
38
|
+
background-color: $white;
|
|
39
|
+
border-radius: $modalBorderRadius;
|
|
40
|
+
box-shadow: 0 6px 26px rgba($black, 0.2);
|
|
41
|
+
text-align: left;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&__header {
|
|
45
|
+
position: relative;
|
|
46
|
+
padding: 1.5rem 2rem;
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-shrink: 0;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
align-items: center;
|
|
51
|
+
border-bottom: $primaryBorder;
|
|
52
|
+
|
|
53
|
+
&-title {
|
|
54
|
+
color: $primary;
|
|
55
|
+
font-size: 2em;
|
|
56
|
+
font-weight: 400;
|
|
57
|
+
text-transform: capitalize;
|
|
58
|
+
margin: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&-button {
|
|
62
|
+
position: absolute;
|
|
63
|
+
top: 10px;
|
|
64
|
+
right: 5px;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&__body {
|
|
69
|
+
overflow-y: auto;
|
|
70
|
+
overflow-x: hidden;
|
|
71
|
+
flex: 1 0;
|
|
72
|
+
flex-basis: 0;
|
|
73
|
+
padding: 1.5rem 2rem 0;
|
|
74
|
+
margin-bottom: 1rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&__footer {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-flow: row nowrap;
|
|
80
|
+
flex-shrink: 0;
|
|
81
|
+
justify-content: space-between;
|
|
82
|
+
padding: 0 2rem;
|
|
83
|
+
min-height: 50px;
|
|
84
|
+
|
|
85
|
+
&-actions {
|
|
86
|
+
display: flex;
|
|
87
|
+
flex: 1 0 auto;
|
|
88
|
+
justify-content: flex-end;
|
|
89
|
+
align-items: center;
|
|
90
|
+
|
|
91
|
+
& > *:not(:last-child) {
|
|
92
|
+
margin-right: 10px;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&-transition {
|
|
98
|
+
&-enter {
|
|
99
|
+
opacity: 0;
|
|
100
|
+
transform: translate(-50%, calc(100vh));
|
|
101
|
+
transition: all 0.3s ease-in-out;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&-enter-active,
|
|
105
|
+
&-enter-done {
|
|
106
|
+
opacity: 1;
|
|
107
|
+
transform: translate(-50%, -50%);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&-exit {
|
|
111
|
+
opacity: 1;
|
|
112
|
+
transform: translate(-50%, -50%);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&-exit-active {
|
|
116
|
+
opacity: 0;
|
|
117
|
+
transform: translate(-50%, -70%);
|
|
118
|
+
transition: all 0.3s ease-in-out;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -59,7 +59,7 @@ var PopUpDialog = function PopUpDialog(_ref) {
|
|
|
59
59
|
var popUpOverlayRef = (0, _react.useRef)(null);
|
|
60
60
|
var popUpClassNames = (0, _classnames.default)(className, 'pop-up-dialog__overlay', customPosition.element && 'custom-position');
|
|
61
61
|
var calculateCustomPopUpPosition = (0, _react.useCallback)(function () {
|
|
62
|
-
if (customPosition.element) {
|
|
62
|
+
if (customPosition && customPosition.element) {
|
|
63
63
|
var elementRect = customPosition.element.current.getBoundingClientRect();
|
|
64
64
|
var popUpRect = popUpOverlayRef.current.getBoundingClientRect();
|
|
65
65
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
padding: 20px;
|
|
9
9
|
overflow-y: auto;
|
|
10
10
|
background-color: $white;
|
|
11
|
-
border-radius: $
|
|
11
|
+
border-radius: $modalBorderRadius;
|
|
12
12
|
box-shadow: 0 6px 26px rgba($black, 0.2);
|
|
13
13
|
|
|
14
14
|
&__buttons_wrapper {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
align-items: baseline;
|
|
41
41
|
justify-content: space-between;
|
|
42
42
|
min-height: 30px;
|
|
43
|
-
margin-bottom:
|
|
43
|
+
margin-bottom: 15px;
|
|
44
44
|
|
|
45
45
|
&-text {
|
|
46
46
|
width: 100%;
|
|
@@ -0,0 +1,132 @@
|
|
|
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
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _reactTransitionGroup = require("react-transition-group");
|
|
15
|
+
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
|
|
18
|
+
var _reactDom = require("react-dom");
|
|
19
|
+
|
|
20
|
+
var _questionMark = require("../../images/question-mark.svg");
|
|
21
|
+
|
|
22
|
+
var _tip = _interopRequireDefault(require("./tip.scss"));
|
|
23
|
+
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
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); }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
33
|
+
|
|
34
|
+
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."); }
|
|
35
|
+
|
|
36
|
+
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); }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
|
|
40
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
41
|
+
|
|
42
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
43
|
+
|
|
44
|
+
var arrowOffset = parseInt(_tip.default.arrowoffset);
|
|
45
|
+
var arrowLength = parseInt(_tip.default.arrowlength);
|
|
46
|
+
var iconLength = parseInt(_tip.default.iconlength);
|
|
47
|
+
var minTextLength = 40;
|
|
48
|
+
|
|
49
|
+
var Tip = function Tip(_ref) {
|
|
50
|
+
var className = _ref.className,
|
|
51
|
+
text = _ref.text;
|
|
52
|
+
|
|
53
|
+
var _useState = (0, _react.useState)(false),
|
|
54
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
55
|
+
isShow = _useState2[0],
|
|
56
|
+
setIsShow = _useState2[1];
|
|
57
|
+
|
|
58
|
+
var _useState3 = (0, _react.useState)('tip_top tip_left'),
|
|
59
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
60
|
+
tipClassName = _useState4[0],
|
|
61
|
+
setTipClassName = _useState4[1];
|
|
62
|
+
|
|
63
|
+
var iconRef = (0, _react.useRef)();
|
|
64
|
+
var tipBodyRef = (0, _react.useRef)();
|
|
65
|
+
var tipContainerClassNames = (0, _classnames.default)(className, 'tip-container');
|
|
66
|
+
var tipClassNames = (0, _classnames.default)('tip', tipClassName, text.length <= minTextLength ? 'tip_small' : 'tip_big');
|
|
67
|
+
var handleMouseEnter = (0, _react.useCallback)(function (event) {
|
|
68
|
+
setIsShow(true);
|
|
69
|
+
var iconRect = iconRef.current.getBoundingClientRect();
|
|
70
|
+
var tipRect = tipBodyRef.current.getBoundingClientRect();
|
|
71
|
+
var widthPosition = iconRect.left > tipRect.width - arrowOffset ? 'tip_left' : 'tip_right';
|
|
72
|
+
var heightPosition = iconRect.top > tipRect.height + arrowLength ? 'tip_top' : 'tip_bottom';
|
|
73
|
+
setTipClassName("".concat(heightPosition, " ").concat(widthPosition));
|
|
74
|
+
|
|
75
|
+
if (widthPosition === 'tip_left') {
|
|
76
|
+
var computedArrowOffset = arrowOffset + (iconLength + arrowLength) / 2;
|
|
77
|
+
tipBodyRef.current.style.left = "".concat(iconRect.left - (tipRect.width - computedArrowOffset), "px");
|
|
78
|
+
} else {
|
|
79
|
+
var _computedArrowOffset = arrowOffset - (iconLength - arrowLength) / 2;
|
|
80
|
+
|
|
81
|
+
tipBodyRef.current.style.left = "".concat(iconRect.left - _computedArrowOffset, "px");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
tipBodyRef.current.style.top = heightPosition === 'tip_top' ? "".concat(iconRect.top - tipRect.height - arrowLength, "px") : "".concat(iconRect.bottom + arrowLength, "px");
|
|
85
|
+
}, []);
|
|
86
|
+
|
|
87
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
88
|
+
setIsShow(false);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
(0, _react.useEffect)(function () {
|
|
92
|
+
var node = iconRef.current;
|
|
93
|
+
|
|
94
|
+
if (iconRef.current) {
|
|
95
|
+
node.addEventListener('mouseenter', handleMouseEnter);
|
|
96
|
+
node.addEventListener('mouseleave', handleMouseLeave);
|
|
97
|
+
return function () {
|
|
98
|
+
node.removeEventListener('mouseenter', handleMouseEnter);
|
|
99
|
+
node.removeEventListener('mouseleave', handleMouseLeave);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}, [handleMouseEnter, isShow]);
|
|
103
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
104
|
+
"data-testid": "tip",
|
|
105
|
+
className: tipContainerClassNames,
|
|
106
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_questionMark.ReactComponent, {
|
|
107
|
+
"data-testid": "tip-icon",
|
|
108
|
+
ref: iconRef
|
|
109
|
+
}), /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
|
|
110
|
+
in: isShow,
|
|
111
|
+
timeout: 200,
|
|
112
|
+
classNames: "fade",
|
|
113
|
+
unmountOnExit: true,
|
|
114
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
115
|
+
ref: tipBodyRef,
|
|
116
|
+
"data-testid": "tip-text",
|
|
117
|
+
className: tipClassNames,
|
|
118
|
+
children: text
|
|
119
|
+
})
|
|
120
|
+
}), document.getElementById('overlay_container'))]
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
Tip.defaultProps = {
|
|
125
|
+
className: ''
|
|
126
|
+
};
|
|
127
|
+
Tip.propTypes = {
|
|
128
|
+
className: _propTypes.default.string,
|
|
129
|
+
text: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.element]).isRequired
|
|
130
|
+
};
|
|
131
|
+
var _default = Tip;
|
|
132
|
+
exports.default = _default;
|