iguazio.dashboard-react-controls 0.0.9 → 0.0.10
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 +5 -2
- package/dist/components/Button/Button.scss +17 -2
- package/dist/components/FormInput/FormInput.js +3 -1
- package/dist/components/FormInput/formInput.scss +41 -74
- package/dist/components/FormSelect/FormSelect.js +2 -2
- package/dist/components/FormSelect/formSelect.scss +69 -63
- package/dist/components/FormTextarea/FormTextarea.js +222 -0
- package/dist/components/FormTextarea/formTextarea.scss +23 -0
- package/dist/components/Modal/Modal.scss +1 -1
- package/dist/components/PopUpDialog/popUpDialog.scss +3 -3
- package/dist/components/index.js +8 -0
- package/dist/scss/common.scss +35 -0
- package/dist/scss/mixins.scss +18 -9
- package/dist/scss/variables.scss +6 -0
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ require("./Button.scss");
|
|
|
25
25
|
|
|
26
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
27
|
|
|
28
|
-
var _excluded = ["className", "icon", "label", "tooltip", "variant"];
|
|
28
|
+
var _excluded = ["className", "density", "icon", "label", "tooltip", "variant"];
|
|
29
29
|
|
|
30
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
31
|
|
|
@@ -45,13 +45,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
45
45
|
|
|
46
46
|
var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
47
47
|
var className = _ref.className,
|
|
48
|
+
density = _ref.density,
|
|
48
49
|
icon = _ref.icon,
|
|
49
50
|
label = _ref.label,
|
|
50
51
|
tooltip = _ref.tooltip,
|
|
51
52
|
variant = _ref.variant,
|
|
52
53
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
53
54
|
|
|
54
|
-
var buttonClassName = (0, _classnames.default)('btn', "btn-".concat(variant), className);
|
|
55
|
+
var buttonClassName = (0, _classnames.default)('btn', "btn-".concat(variant), "btn-".concat(density), className);
|
|
55
56
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
56
57
|
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextTooltipTemplate.default, {
|
|
57
58
|
text: tooltip
|
|
@@ -68,12 +69,14 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
68
69
|
});
|
|
69
70
|
Button.defaultProps = {
|
|
70
71
|
className: '',
|
|
72
|
+
density: 'normal',
|
|
71
73
|
label: 'Button',
|
|
72
74
|
tooltip: '',
|
|
73
75
|
variant: _constants.TERTIARY_BUTTON
|
|
74
76
|
};
|
|
75
77
|
Button.propTypes = {
|
|
76
78
|
className: _propTypes.default.string,
|
|
79
|
+
density: _propTypes.default.oneOf(['dense', 'normal', 'medium', 'chunky']),
|
|
77
80
|
icon: _propTypes.default.element,
|
|
78
81
|
label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.element]),
|
|
79
82
|
tooltip: _propTypes.default.string,
|
|
@@ -7,16 +7,31 @@
|
|
|
7
7
|
align-items: center;
|
|
8
8
|
justify-content: center;
|
|
9
9
|
min-width: 90px;
|
|
10
|
-
height:
|
|
10
|
+
height: $fieldNormal;
|
|
11
11
|
padding: 0 16px;
|
|
12
12
|
color: $white;
|
|
13
13
|
font-weight: 500;
|
|
14
14
|
font-size: 0.875rem;
|
|
15
15
|
font-style: normal;
|
|
16
|
-
line-height: 16px;
|
|
17
16
|
border: $transparentBorder;
|
|
18
17
|
border-radius: $mainBorderRadius;
|
|
19
18
|
|
|
19
|
+
&-dense {
|
|
20
|
+
height: $fieldDense;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&-normal {
|
|
24
|
+
height: $fieldNormal;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&-medium {
|
|
28
|
+
height: $fieldMedium;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-chunky {
|
|
32
|
+
height: $fieldChunky;
|
|
33
|
+
}
|
|
34
|
+
|
|
20
35
|
svg {
|
|
21
36
|
& > * {
|
|
22
37
|
fill: currentColor;
|
|
@@ -136,7 +136,7 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
136
136
|
(0, _useDetectOutsideClick.useDetectOutsideClick)(ref, function () {
|
|
137
137
|
return setShowValidationRules(false);
|
|
138
138
|
});
|
|
139
|
-
var formFieldClassNames = (0, _classnames.default)('form-field', className);
|
|
139
|
+
var formFieldClassNames = (0, _classnames.default)('form-field form-field-input', className);
|
|
140
140
|
var inputWrapperClassNames = (0, _classnames.default)('form-field__wrapper', "form-field__wrapper-".concat(density), disabled && 'form-field__wrapper-disabled', isInvalid && 'form-field__wrapper-invalid', withoutBorder && 'without-border');
|
|
141
141
|
var labelClassNames = (0, _classnames.default)('form-field__label', disabled && 'form-field__label-disabled');
|
|
142
142
|
(0, _react.useEffect)(function () {
|
|
@@ -200,6 +200,8 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
200
200
|
};
|
|
201
201
|
|
|
202
202
|
var handleScroll = function handleScroll(event) {
|
|
203
|
+
if (inputRef.current.contains(event.target)) return;
|
|
204
|
+
|
|
203
205
|
if (!event.target.closest('.options-menu') && !event.target.classList.contains('form-field')) {
|
|
204
206
|
setShowValidationRules(false);
|
|
205
207
|
}
|
|
@@ -3,90 +3,57 @@
|
|
|
3
3
|
@import '../../scss/shadows';
|
|
4
4
|
@import '../../scss/mixins';
|
|
5
5
|
|
|
6
|
-
.form-field {
|
|
7
|
-
|
|
6
|
+
.form-field.form-field-input {
|
|
7
|
+
width: 100%;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
display: inline-flex;
|
|
12
|
-
margin-left: 3px;
|
|
9
|
+
.form-field {
|
|
10
|
+
@include formField;
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
&__label {
|
|
13
|
+
&-icon {
|
|
16
14
|
display: inline-flex;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
a {
|
|
20
|
-
transform: translateY(-1px);
|
|
21
|
-
}
|
|
15
|
+
margin-left: 3px;
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
path {
|
|
28
|
-
fill: $cornflowerBlue;
|
|
17
|
+
& > *,
|
|
18
|
+
a {
|
|
19
|
+
display: inline-flex;
|
|
29
20
|
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
input {
|
|
35
|
-
border: 0;
|
|
36
|
-
color: inherit;
|
|
37
|
-
background-color: transparent;
|
|
38
|
-
padding: 0;
|
|
39
|
-
width: 100%;
|
|
40
|
-
|
|
41
|
-
&::placeholder {
|
|
42
|
-
color: $spunPearl;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&::-webkit-input-placeholder {
|
|
46
|
-
/* Chrome/Opera/Safari */
|
|
47
|
-
color: $spunPearl;
|
|
48
|
-
}
|
|
49
21
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
&:-ms-input-placeholder {
|
|
56
|
-
/* IE 10+ */
|
|
57
|
-
color: $spunPearl;
|
|
58
|
-
}
|
|
22
|
+
a {
|
|
23
|
+
transform: translateY(-1px);
|
|
24
|
+
}
|
|
59
25
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
26
|
+
svg {
|
|
27
|
+
width: 12px;
|
|
28
|
+
height: 12px;
|
|
64
29
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
30
|
+
path {
|
|
31
|
+
fill: $cornflowerBlue;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
68
35
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
&__suggestion-list {
|
|
72
|
-
position: absolute;
|
|
73
|
-
top: 100%;
|
|
74
|
-
left: 0;
|
|
75
|
-
z-index: 5;
|
|
76
|
-
margin: 0;
|
|
77
|
-
padding: 7px 0;
|
|
78
|
-
background-color: $white;
|
|
79
|
-
border-radius: 4px;
|
|
80
|
-
box-shadow: $previewBoxShadow;
|
|
81
36
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
37
|
+
&__suggestion-list {
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: 100%;
|
|
40
|
+
left: 0;
|
|
41
|
+
z-index: 5;
|
|
42
|
+
margin: 0;
|
|
43
|
+
padding: 7px 0;
|
|
44
|
+
background-color: $white;
|
|
45
|
+
border-radius: 4px;
|
|
46
|
+
box-shadow: $previewBoxShadow;
|
|
47
|
+
|
|
48
|
+
.suggestion-item {
|
|
49
|
+
padding: 7px 15px;
|
|
50
|
+
color: $mulledWine;
|
|
51
|
+
list-style-type: none;
|
|
52
|
+
|
|
53
|
+
&:hover {
|
|
54
|
+
background-color: $alabaster;
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
}
|
|
90
57
|
}
|
|
91
58
|
}
|
|
92
59
|
}
|
|
@@ -185,7 +185,7 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
185
185
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
186
186
|
"data-testid": "select",
|
|
187
187
|
ref: selectRef,
|
|
188
|
-
className: "form-field ".concat(className),
|
|
188
|
+
className: "form-field form-field-select ".concat(className),
|
|
189
189
|
onClick: toggleOpen,
|
|
190
190
|
children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
191
191
|
className: selectLabelClassName,
|
|
@@ -264,7 +264,7 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
264
264
|
isOpen: isConfirmDialogOpen,
|
|
265
265
|
message: selectedItemAction.confirm.message
|
|
266
266
|
}), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_PopUpDialog.default, {
|
|
267
|
-
className: "form-
|
|
267
|
+
className: "form-field form-field-select__options-list",
|
|
268
268
|
customPosition: {
|
|
269
269
|
element: selectRef,
|
|
270
270
|
position: 'bottom-right'
|
|
@@ -2,90 +2,96 @@
|
|
|
2
2
|
@import '../../scss/colors';
|
|
3
3
|
@import '../../scss/shadows';
|
|
4
4
|
|
|
5
|
-
.form-field {
|
|
6
|
-
|
|
5
|
+
.form-field.form-field-select {
|
|
6
|
+
width: 100%;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
background: $alabaster;
|
|
11
|
-
}
|
|
8
|
+
.form-field {
|
|
9
|
+
@include formField;
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
&__wrapper {
|
|
12
|
+
&-active {
|
|
13
|
+
background: $alabaster;
|
|
14
|
+
}
|
|
16
15
|
|
|
17
|
-
&-disabled {
|
|
18
16
|
.form-field__caret {
|
|
19
|
-
cursor:
|
|
20
|
-
|
|
21
|
-
path {
|
|
22
|
-
fill: $spunPearl;
|
|
23
|
-
}
|
|
17
|
+
cursor: pointer;
|
|
24
18
|
}
|
|
25
|
-
}
|
|
26
19
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
&-disabled {
|
|
21
|
+
.form-field__caret {
|
|
22
|
+
cursor: not-allowed;
|
|
23
|
+
|
|
24
|
+
path {
|
|
25
|
+
fill: $spunPearl;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
&.without-border {
|
|
33
31
|
.form-field__caret {
|
|
34
|
-
display:
|
|
32
|
+
display: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&:hover {
|
|
36
|
+
.form-field__caret {
|
|
37
|
+
display: block;
|
|
38
|
+
}
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
|
-
}
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
&__select {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
width: 100%;
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
&-value {
|
|
49
|
+
display: block;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
white-space: nowrap;
|
|
52
|
+
text-overflow: ellipsis;
|
|
53
|
+
}
|
|
49
54
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
&-sub_label {
|
|
56
|
+
display: block;
|
|
57
|
+
margin-left: 5px;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
color: $topaz;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
text-overflow: ellipsis;
|
|
62
|
+
}
|
|
57
63
|
}
|
|
64
|
+
}
|
|
58
65
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
&__options-list {
|
|
67
|
+
.pop-up-dialog {
|
|
68
|
+
width: 100%;
|
|
69
|
+
padding: 0;
|
|
63
70
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
&__header {
|
|
72
|
+
display: none;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
.options-list {
|
|
76
|
+
&__body {
|
|
77
|
+
width: 100%;
|
|
78
|
+
max-height: 250px;
|
|
79
|
+
overflow-y: auto;
|
|
80
|
+
color: $mulledWineTwo;
|
|
81
|
+
background-color: $white;
|
|
82
|
+
border: $primaryBorder;
|
|
83
|
+
border-radius: 2px;
|
|
84
|
+
box-shadow: $filterShadow;
|
|
67
85
|
}
|
|
68
|
-
.options-list {
|
|
69
|
-
&__body {
|
|
70
|
-
width: 100%;
|
|
71
|
-
max-height: 250px;
|
|
72
|
-
overflow-y: auto;
|
|
73
|
-
color: $mulledWineTwo;
|
|
74
|
-
background-color: $white;
|
|
75
|
-
border: $primaryBorder;
|
|
76
|
-
border-radius: 2px;
|
|
77
|
-
box-shadow: $filterShadow;
|
|
78
|
-
}
|
|
79
86
|
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
&__search {
|
|
88
|
+
width: 100%;
|
|
82
89
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
90
|
+
input {
|
|
91
|
+
width: 100%;
|
|
92
|
+
padding: 10px;
|
|
93
|
+
border: none;
|
|
94
|
+
border-bottom: $primaryBorder;
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
97
|
}
|
|
@@ -0,0 +1,222 @@
|
|
|
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 _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _reactFinalForm = require("react-final-form");
|
|
17
|
+
|
|
18
|
+
var _components = require("igz-controls/components");
|
|
19
|
+
|
|
20
|
+
var _invalid = require("igz-controls/images/invalid.svg");
|
|
21
|
+
|
|
22
|
+
require("./formTextarea.scss");
|
|
23
|
+
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
|
|
26
|
+
var _excluded = ["className", "disabled", "focused", "iconClass", "invalidText", "label", "name", "onBlur", "onChange", "required", "textAreaIcon", "tip", "withoutBorder"];
|
|
27
|
+
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
41
|
+
|
|
42
|
+
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."); }
|
|
43
|
+
|
|
44
|
+
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); }
|
|
45
|
+
|
|
46
|
+
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; }
|
|
47
|
+
|
|
48
|
+
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; }
|
|
49
|
+
|
|
50
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
51
|
+
|
|
52
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
53
|
+
|
|
54
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
55
|
+
|
|
56
|
+
var TextArea = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
57
|
+
var className = _ref.className,
|
|
58
|
+
disabled = _ref.disabled,
|
|
59
|
+
focused = _ref.focused,
|
|
60
|
+
iconClass = _ref.iconClass,
|
|
61
|
+
invalidText = _ref.invalidText,
|
|
62
|
+
label = _ref.label,
|
|
63
|
+
name = _ref.name,
|
|
64
|
+
onBlur = _ref.onBlur,
|
|
65
|
+
onChange = _ref.onChange,
|
|
66
|
+
required = _ref.required,
|
|
67
|
+
textAreaIcon = _ref.textAreaIcon,
|
|
68
|
+
tip = _ref.tip,
|
|
69
|
+
withoutBorder = _ref.withoutBorder,
|
|
70
|
+
textareaProps = _objectWithoutProperties(_ref, _excluded);
|
|
71
|
+
|
|
72
|
+
var _useField = (0, _reactFinalForm.useField)(name),
|
|
73
|
+
input = _useField.input,
|
|
74
|
+
meta = _useField.meta;
|
|
75
|
+
|
|
76
|
+
var _useState = (0, _react.useState)(false),
|
|
77
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
78
|
+
isInvalid = _useState2[0],
|
|
79
|
+
setIsInvalid = _useState2[1];
|
|
80
|
+
|
|
81
|
+
var textAreaRef = /*#__PURE__*/_react.default.createRef();
|
|
82
|
+
|
|
83
|
+
var formFieldClassNames = (0, _classnames.default)('form-field form-field-textarea', className);
|
|
84
|
+
var labelClassNames = (0, _classnames.default)('form-field__label', disabled && 'form-field__label-disabled');
|
|
85
|
+
var textAreaClassNames = (0, _classnames.default)('form-field__wrapper', disabled && 'form-field__wrapper-disabled', isInvalid && 'form-field__wrapper-invalid', withoutBorder && 'without-border');
|
|
86
|
+
(0, _react.useEffect)(function () {
|
|
87
|
+
if (focused) {
|
|
88
|
+
textAreaRef.current.focus();
|
|
89
|
+
}
|
|
90
|
+
}, [focused, textAreaRef]);
|
|
91
|
+
(0, _react.useEffect)(function () {
|
|
92
|
+
setIsInvalid(meta.invalid && (meta.validating || meta.modified || meta.submitFailed && meta.touched));
|
|
93
|
+
}, [meta.invalid, meta.modified, meta.submitFailed, meta.touched, meta.validating]);
|
|
94
|
+
|
|
95
|
+
var handleInputBlur = function handleInputBlur(event) {
|
|
96
|
+
input.onBlur(event);
|
|
97
|
+
onBlur && onBlur(event);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
var handleInputChange = function handleInputChange(event) {
|
|
101
|
+
input.onChange(event);
|
|
102
|
+
onChange && onChange(event.target.value);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
var handleInputFocus = function handleInputFocus(event) {
|
|
106
|
+
input.onFocus(event);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
var validateField = function validateField(value) {
|
|
110
|
+
var valueToValidate = value !== null && value !== void 0 ? value : '';
|
|
111
|
+
var validationError = null;
|
|
112
|
+
|
|
113
|
+
if (valueToValidate.startsWith(' ')) {
|
|
114
|
+
validationError = {
|
|
115
|
+
name: 'empty',
|
|
116
|
+
label: invalidText
|
|
117
|
+
};
|
|
118
|
+
} else if (required && valueToValidate.trim().length === 0) {
|
|
119
|
+
validationError = {
|
|
120
|
+
name: 'required',
|
|
121
|
+
label: 'This field is required'
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return validationError;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
129
|
+
validate: validateField,
|
|
130
|
+
name: name,
|
|
131
|
+
children: function children(_ref2) {
|
|
132
|
+
var _meta$error$label, _meta$error;
|
|
133
|
+
|
|
134
|
+
var input = _ref2.input,
|
|
135
|
+
meta = _ref2.meta;
|
|
136
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
137
|
+
ref: ref,
|
|
138
|
+
className: formFieldClassNames,
|
|
139
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
140
|
+
className: labelClassNames,
|
|
141
|
+
children: label && /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
142
|
+
"data-testid": "label",
|
|
143
|
+
htmlFor: input.name,
|
|
144
|
+
children: [label, required && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
145
|
+
className: "form-field__label-mandatory",
|
|
146
|
+
children: " *"
|
|
147
|
+
})]
|
|
148
|
+
})
|
|
149
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
150
|
+
className: textAreaClassNames,
|
|
151
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
152
|
+
className: "form-field__control",
|
|
153
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("textarea", _objectSpread(_objectSpread({
|
|
154
|
+
"data-testid": "textarea",
|
|
155
|
+
id: input.name,
|
|
156
|
+
ref: textAreaRef,
|
|
157
|
+
required: isInvalid || required
|
|
158
|
+
}, _objectSpread(_objectSpread({
|
|
159
|
+
disabled: disabled
|
|
160
|
+
}, textareaProps), input)), {}, {
|
|
161
|
+
onBlur: handleInputBlur,
|
|
162
|
+
onChange: handleInputChange,
|
|
163
|
+
onFocus: handleInputFocus
|
|
164
|
+
}))
|
|
165
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
166
|
+
className: "form-field__icons",
|
|
167
|
+
children: [isInvalid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
168
|
+
className: "form-field__warning",
|
|
169
|
+
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextTooltipTemplate, {
|
|
170
|
+
text: (_meta$error$label = (_meta$error = meta.error) === null || _meta$error === void 0 ? void 0 : _meta$error.label) !== null && _meta$error$label !== void 0 ? _meta$error$label : invalidText,
|
|
171
|
+
warning: true
|
|
172
|
+
}),
|
|
173
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_invalid.ReactComponent, {})
|
|
174
|
+
}), tip && !required && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tip, {
|
|
175
|
+
text: tip,
|
|
176
|
+
className: "form-field__tip"
|
|
177
|
+
}), textAreaIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
178
|
+
"data-testid": "textarea__icon",
|
|
179
|
+
className: iconClass,
|
|
180
|
+
children: textAreaIcon
|
|
181
|
+
})]
|
|
182
|
+
})]
|
|
183
|
+
})]
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
TextArea.defaultProps = {
|
|
190
|
+
className: '',
|
|
191
|
+
disabled: false,
|
|
192
|
+
focused: false,
|
|
193
|
+
iconClass: '',
|
|
194
|
+
textAreaIcon: null,
|
|
195
|
+
invalidText: 'This field is invalid',
|
|
196
|
+
label: '',
|
|
197
|
+
onBlur: function onBlur() {},
|
|
198
|
+
onChange: function onChange() {},
|
|
199
|
+
placeholder: '',
|
|
200
|
+
required: false,
|
|
201
|
+
rows: 3,
|
|
202
|
+
tip: ''
|
|
203
|
+
};
|
|
204
|
+
TextArea.propTypes = {
|
|
205
|
+
className: _propTypes.default.string,
|
|
206
|
+
disabled: _propTypes.default.bool,
|
|
207
|
+
focused: _propTypes.default.bool,
|
|
208
|
+
iconClass: _propTypes.default.string,
|
|
209
|
+
textAreaIcon: _propTypes.default.element,
|
|
210
|
+
invalidText: _propTypes.default.string,
|
|
211
|
+
label: _propTypes.default.string,
|
|
212
|
+
name: _propTypes.default.string.isRequired,
|
|
213
|
+
onBlur: _propTypes.default.func,
|
|
214
|
+
onChange: _propTypes.default.func,
|
|
215
|
+
placeholder: _propTypes.default.string,
|
|
216
|
+
required: _propTypes.default.bool,
|
|
217
|
+
tip: _propTypes.default.string
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
var _default = /*#__PURE__*/_react.default.memo(TextArea);
|
|
221
|
+
|
|
222
|
+
exports.default = _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import '../../scss/colors';
|
|
2
|
+
@import '../../scss/borders';
|
|
3
|
+
@import '../../scss/shadows';
|
|
4
|
+
@import '../../scss/mixins';
|
|
5
|
+
|
|
6
|
+
.form-field.form-field-textarea {
|
|
7
|
+
width: 100%;
|
|
8
|
+
|
|
9
|
+
.form-field {
|
|
10
|
+
@include formField;
|
|
11
|
+
|
|
12
|
+
&__wrapper {
|
|
13
|
+
.form-field__control {
|
|
14
|
+
padding: 0;
|
|
15
|
+
|
|
16
|
+
& > *:first-child {
|
|
17
|
+
height: inherit;
|
|
18
|
+
padding: 12px 0 12px 16px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
@import '../../scss/borders';
|
|
4
4
|
|
|
5
5
|
.pop-up-dialog {
|
|
6
|
+
position: relative;
|
|
6
7
|
width: 477px;
|
|
7
8
|
max-height: 90vh;
|
|
8
9
|
padding: 20px;
|
|
@@ -35,7 +36,6 @@
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
&__header {
|
|
38
|
-
position: relative;
|
|
39
39
|
display: flex;
|
|
40
40
|
align-items: baseline;
|
|
41
41
|
justify-content: space-between;
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
|
|
72
72
|
&_close {
|
|
73
73
|
position: absolute;
|
|
74
|
-
top:
|
|
75
|
-
right:
|
|
74
|
+
top: 10px;
|
|
75
|
+
right: 10px;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
package/dist/components/index.js
CHANGED
|
@@ -39,6 +39,12 @@ Object.defineProperty(exports, "FormSelect", {
|
|
|
39
39
|
return _FormSelect.default;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "FormTextarea", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _FormTextarea.default;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
42
48
|
Object.defineProperty(exports, "Modal", {
|
|
43
49
|
enumerable: true,
|
|
44
50
|
get: function get() {
|
|
@@ -94,6 +100,8 @@ var _FormKeyValueTable = _interopRequireDefault(require("./FormKeyValueTable/For
|
|
|
94
100
|
|
|
95
101
|
var _FormSelect = _interopRequireDefault(require("./FormSelect/FormSelect"));
|
|
96
102
|
|
|
103
|
+
var _FormTextarea = _interopRequireDefault(require("./FormTextarea/FormTextarea"));
|
|
104
|
+
|
|
97
105
|
var _Modal = _interopRequireDefault(require("./Modal/Modal"));
|
|
98
106
|
|
|
99
107
|
var _PopUpDialog = _interopRequireDefault(require("./PopUpDialog/PopUpDialog"));
|
package/dist/scss/common.scss
CHANGED
|
@@ -48,6 +48,41 @@ textarea {
|
|
|
48
48
|
line-height: 18px;
|
|
49
49
|
white-space: nowrap;
|
|
50
50
|
text-overflow: ellipsis;
|
|
51
|
+
border: 0;
|
|
52
|
+
color: inherit;
|
|
53
|
+
background-color: transparent;
|
|
54
|
+
padding: 0;
|
|
55
|
+
resize: none;
|
|
56
|
+
width: 100%;
|
|
57
|
+
|
|
58
|
+
&::placeholder {
|
|
59
|
+
color: $spunPearl;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&::-webkit-input-placeholder {
|
|
63
|
+
/* Chrome/Opera/Safari */
|
|
64
|
+
color: $spunPearl;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&::-moz-placeholder {
|
|
68
|
+
/* Firefox 19+ */
|
|
69
|
+
color: $spunPearl;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&:-ms-input-placeholder {
|
|
73
|
+
/* IE 10+ */
|
|
74
|
+
color: $spunPearl;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&:-moz-placeholder {
|
|
78
|
+
/* Firefox 18- */
|
|
79
|
+
color: $spunPearl;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&:disabled {
|
|
83
|
+
background: transparent;
|
|
84
|
+
cursor: not-allowed;
|
|
85
|
+
}
|
|
51
86
|
|
|
52
87
|
&:active,
|
|
53
88
|
&:focus {
|
package/dist/scss/mixins.scss
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@import './colors';
|
|
2
2
|
@import './borders';
|
|
3
|
+
@import './variables.scss';
|
|
3
4
|
|
|
4
5
|
@mixin fixed {
|
|
5
6
|
position: fixed;
|
|
@@ -1040,23 +1041,27 @@
|
|
|
1040
1041
|
}
|
|
1041
1042
|
|
|
1042
1043
|
&-dense {
|
|
1043
|
-
|
|
1044
|
-
|
|
1044
|
+
.form-field__control > *:first-child {
|
|
1045
|
+
height: $fieldDense;
|
|
1046
|
+
}
|
|
1045
1047
|
}
|
|
1046
1048
|
|
|
1047
1049
|
&-normal {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
+
.form-field__control > *:first-child {
|
|
1051
|
+
height: $fieldNormal;
|
|
1052
|
+
}
|
|
1050
1053
|
}
|
|
1051
1054
|
|
|
1052
1055
|
&-medium {
|
|
1053
|
-
|
|
1054
|
-
|
|
1056
|
+
.form-field__control > *:first-child {
|
|
1057
|
+
height: $fieldMedium;
|
|
1058
|
+
}
|
|
1055
1059
|
}
|
|
1056
1060
|
|
|
1057
1061
|
&-chunky {
|
|
1058
|
-
|
|
1059
|
-
|
|
1062
|
+
.form-field__control > *:first-child {
|
|
1063
|
+
height: $fieldChunky;
|
|
1064
|
+
}
|
|
1060
1065
|
}
|
|
1061
1066
|
}
|
|
1062
1067
|
|
|
@@ -1064,6 +1069,7 @@
|
|
|
1064
1069
|
position: relative;
|
|
1065
1070
|
display: flex;
|
|
1066
1071
|
flex: 1;
|
|
1072
|
+
align-items: center;
|
|
1067
1073
|
overflow: hidden;
|
|
1068
1074
|
padding: 0 8px 0 16px;
|
|
1069
1075
|
}
|
|
@@ -1072,13 +1078,16 @@
|
|
|
1072
1078
|
display: flex;
|
|
1073
1079
|
flex-shrink: 0;
|
|
1074
1080
|
align-items: center;
|
|
1075
|
-
margin-right: 4px;
|
|
1076
1081
|
min-height: 25px;
|
|
1077
1082
|
|
|
1078
1083
|
& > * {
|
|
1079
1084
|
display: flex;
|
|
1080
1085
|
align-items: center;
|
|
1081
1086
|
padding: 0 4px;
|
|
1087
|
+
|
|
1088
|
+
&:last-child {
|
|
1089
|
+
margin-right: 4px;
|
|
1090
|
+
}
|
|
1082
1091
|
}
|
|
1083
1092
|
}
|
|
1084
1093
|
}
|
package/dist/scss/variables.scss
CHANGED
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.10",
|
|
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",
|