iguazio.dashboard-react-controls 1.3.6 → 1.3.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.
@@ -22,13 +22,10 @@
22
22
  &_invalid {
23
23
  color: $amaranth;
24
24
  }
25
-
26
- &::placeholder {
27
- color: $spunPearl;
28
- }
29
25
  }
30
26
 
31
- &.input-label-key, &.input-label-value {
27
+ &.input-label-key,
28
+ &.input-label-value {
32
29
  &::placeholder {
33
30
  color: $topaz;
34
31
  }
@@ -51,7 +51,12 @@ var FormRadio = function FormRadio(_ref) {
51
51
  var input = _ref2.input;
52
52
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
53
53
  className: formFieldClassNames,
54
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({}, _objectSpread(_objectSpread({}, input), inputProps)), {}, {
54
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
55
+ className: (0, _classnames.default)(input.checked ? 'checked' : 'unchecked'),
56
+ type: "radio",
57
+ "data-testid": "radio-".concat(inputProps.value)
58
+ }, _objectSpread(_objectSpread({}, input), inputProps)), {}, {
59
+ checked: input.checked,
55
60
  id: name + inputProps.value
56
61
  })), /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
57
62
  htmlFor: name + inputProps.value,
@@ -179,6 +179,7 @@ var FormSelect = function FormSelect(_ref) {
179
179
  }, [clickHandler, handleScroll, isOpen]);
180
180
  var scrollOptionToView = (0, _react.useCallback)(function () {
181
181
  var selectedOptionEl = optionsListRef.current.querySelector("#".concat(_constants.SELECT_OPTION_ID_PREFIX).concat(input.value));
182
+ if (!selectedOptionEl) return;
182
183
  searchValue ? optionsListRef.current.scrollTo({
183
184
  top: 0,
184
185
  left: 0,
@@ -11,7 +11,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _reactFinalForm = require("react-final-form");
12
12
  require("./formToggle.scss");
13
13
  var _jsxRuntime = require("react/jsx-runtime");
14
- var _excluded = ["className", "label", "name", "onChange", "readOnly"];
14
+ var _excluded = ["className", "density", "label", "name", "onChange", "readOnly"];
15
15
  /*
16
16
  Copyright 2022 Iguazio Systems Ltd.
17
17
  Licensed under the Apache License, Version 2.0 (the "License") with
@@ -38,18 +38,20 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
38
38
  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; }
39
39
  var FormToggle = function FormToggle(_ref) {
40
40
  var className = _ref.className,
41
+ density = _ref.density,
41
42
  label = _ref.label,
42
43
  name = _ref.name,
43
44
  _onChange = _ref.onChange,
44
45
  readOnly = _ref.readOnly,
45
46
  inputProps = _objectWithoutProperties(_ref, _excluded);
47
+ var toggleWrapperClassNames = (0, _classnames.default)('form-field__wrapper', "form-field__wrapper-".concat(density));
46
48
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
47
49
  name: name,
48
50
  value: inputProps.value,
49
51
  type: "checkbox",
50
52
  children: function children(_ref2) {
51
53
  var input = _ref2.input;
52
- var toggleClassName = (0, _classnames.default)('form-field-toggle', className, readOnly && 'form-field-toggle_readonly', input.checked && 'form-field-toggle_checked');
54
+ var toggleClassName = (0, _classnames.default)('form-field-toggle', className, readOnly && 'form-field_readonly', input.checked && 'form-field_checked');
53
55
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
54
56
  className: toggleClassName,
55
57
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
@@ -61,14 +63,17 @@ var FormToggle = function FormToggle(_ref) {
61
63
  input.onChange(event);
62
64
  },
63
65
  type: "checkbox"
64
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
65
- className: "form-field-toggle__switch",
66
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
67
- className: "form-field-toggle__switch-button"
68
- })
69
- }), label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
70
- className: "form-field-toggle__label",
66
+ })), label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
67
+ className: "form-field__label",
71
68
  children: label
69
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
70
+ className: toggleWrapperClassNames,
71
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
72
+ className: "form-field-toggle__switch",
73
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
74
+ className: "form-field-toggle__switch-button"
75
+ })
76
+ })
72
77
  })]
73
78
  });
74
79
  }
@@ -82,6 +87,7 @@ FormToggle.defaultProps = {
82
87
  };
83
88
  FormToggle.propTypes = {
84
89
  className: _propTypes.default.string,
90
+ density: _propTypes.default.string,
85
91
  label: _propTypes.default.string,
86
92
  name: _propTypes.default.string.isRequired,
87
93
  onChange: _propTypes.default.func,
@@ -1,10 +1,14 @@
1
1
  @import '../../scss/colors';
2
+ @import '../../scss/mixins';
2
3
 
3
4
  .form-field-toggle {
4
5
  position: relative;
5
- display: flex;
6
- font-size: 16px;
7
- line-height: 24px;
6
+
7
+ input[type='checkbox'] {
8
+ display: none;
9
+ width: 0;
10
+ height: 0;
11
+ }
8
12
 
9
13
  &__switch {
10
14
  height: 24px;
@@ -26,28 +30,32 @@
26
30
  }
27
31
  }
28
32
 
29
- &__label {
30
- margin-left: 10px;
31
- }
32
-
33
- &_readonly {
34
- opacity: 0.5;
35
- pointer-events: none;
33
+ .form-field {
34
+ @include inputSelectField;
36
35
 
37
- .form-field-toggle__switch {
38
- cursor: default;
36
+ &__wrapper {
37
+ border: none;
39
38
  }
40
39
 
41
- &.form-field-toggle_checked {
40
+ &_readonly {
41
+ opacity: 0.5;
42
+ pointer-events: none;
43
+
42
44
  .form-field-toggle__switch {
43
- &-button {
44
- opacity: 0.5;
45
+ cursor: default;
46
+ }
47
+
48
+ &.form-field-toggle_checked {
49
+ .form-field-toggle__switch {
50
+ &-button {
51
+ opacity: 0.5;
52
+ }
45
53
  }
46
54
  }
47
55
  }
48
56
  }
49
57
 
50
- &_checked {
58
+ &.form-field_checked {
51
59
  .form-field-toggle__switch {
52
60
  background-color: $malibu;
53
61
 
@@ -56,10 +64,4 @@
56
64
  }
57
65
  }
58
66
  }
59
-
60
- input[type='checkbox'] {
61
- display: none;
62
- width: 0;
63
- height: 0;
64
- }
65
67
  }
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M9 2V6.91H7V2C4.16 2.48 2 4.94 2 7.91C2 10.13 3.21 12.06 5 13.1V21.91C5 22.46 5.45 22.91 6 22.91H10C10.55 22.91 11 22.46 11 21.91V13.1C12.79 12.06 14 10.13 14 7.91C14 4.94 11.84 2.48 9 2ZM10 11.37L9 11.95V20.91H7V11.95L6 11.37C4.77 10.65 4 9.33 4 7.91C4 6.91 4.37 5.97 5 5.26V8.91H11V5.26C11.63 5.97 12 6.91 12 7.91C12 9.33 11.23 10.65 10 11.37ZM20.94 18.85C20.96 18.7 20.97 18.56 20.97 18.41C20.97 18.26 20.96 18.11 20.94 17.96L21.91 17.23C22 17.16 22.03 17.04 21.97 16.94L21.05 15.38C21 15.28 20.87 15.24 20.76 15.28L19.61 15.73C19.37 15.56 19.12 15.41 18.83 15.29L18.66 14.1C18.64 13.99 18.54 13.91 18.43 13.91H16.58C16.46 13.91 16.36 13.99 16.34 14.1L16.17 15.29C15.88 15.41 15.63 15.56 15.39 15.73L14.24 15.28C14.14 15.24 14 15.28 13.96 15.38L13.03 16.94C12.97 17.04 13 17.16 13.09 17.23L14.06 17.96C14.05 18.11 14.03 18.26 14.03 18.41C14.03 18.56 14.05 18.7 14.06 18.85L13.09 19.59C13 19.66 12.97 19.78 13.03 19.88L13.96 21.44C14 21.54 14.14 21.57 14.24 21.54L15.39 21.08C15.63 21.26 15.88 21.41 16.17 21.53L16.34 22.72C16.36 22.83 16.46 22.91 16.58 22.91H18.43C18.54 22.91 18.64 22.83 18.66 22.72L18.83 21.53C19.12 21.41 19.37 21.26 19.61 21.08L20.76 21.54C20.87 21.57 21 21.54 21.05 21.44L21.97 19.88C22.03 19.78 22 19.66 21.91 19.59L20.94 18.85ZM17.5 19.91C16.67 19.91 16 19.24 16 18.41C16 17.58 16.67 16.91 17.5 16.91C18.33 16.91 19 17.58 19 18.41C19 19.24 18.33 19.91 17.5 19.91Z" fill="#7F7989"/>
3
+ </svg>
@@ -1022,6 +1022,7 @@
1022
1022
  @include fieldWrapper;
1023
1023
 
1024
1024
  &-disabled {
1025
+ border: $disabledBorder;
1025
1026
  color: $spunPearl;
1026
1027
  cursor: not-allowed;
1027
1028
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iguazio.dashboard-react-controls",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
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",