@dhis2-ui/select 7.14.1 → 7.15.1

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.
@@ -33,14 +33,14 @@ var _steps = require("cypress-cucumber-preprocessor/steps");
33
33
  (0, _steps.When)('an option is clicked', () => {
34
34
  cy.contains('option one').click();
35
35
  });
36
- (0, _steps.Then)('the Input grows in height', () => {
36
+ (0, _steps.Then)('the Input remains the same height', () => {
37
37
  const emptyInputHeight = '@emptyInputHeight';
38
38
  const inputDataTest = '[data-test="dhis2-uicore-select-input"]';
39
39
  cy.getAll(emptyInputHeight, inputDataTest).should(([emptyInputHeight, inputs]) => {
40
40
  expect(inputs.length).to.equal(1);
41
41
  const $input = inputs[0];
42
42
  const inputRect = $input.getBoundingClientRect();
43
- expect(inputRect.height).to.be.greaterThan(emptyInputHeight);
43
+ expect(inputRect.height).to.equal(emptyInputHeight);
44
44
  });
45
45
  });
46
46
  (0, _steps.Then)('the top of the menu is aligned with the bottom of the input', () => {
@@ -34,14 +34,14 @@ Feature: Position of MultiSelect menu dropdown
34
34
  Then the left of the Menu is aligned with the left of the Input
35
35
  And the Menu and the Input have an equal width
36
36
 
37
- Scenario: Repositioning the menu when the Input grows
37
+ Scenario: Positioning the menu when an option is selected
38
38
  Given a MultiSelect is rendered to which options can be added
39
39
  And the input is empty
40
40
  When the MultiSelect is clicked
41
41
  Then the top of the menu is aligned with the bottom of the input
42
42
  And the left of the Menu is aligned with the left of the Input
43
43
  When an option is clicked
44
- Then the Input grows in height
44
+ Then the Input remains the same height
45
45
  And the top of the menu is aligned with the bottom of the input
46
46
  And the left of the Menu is aligned with the left of the Input
47
47
 
@@ -7,12 +7,12 @@ exports.MultiSelect = void 0;
7
7
 
8
8
  var _style = _interopRequireDefault(require("styled-jsx/style"));
9
9
 
10
+ var _statusIcon = require("@dhis2-ui/status-icon");
11
+
10
12
  var _propTypes = require("@dhis2/prop-types");
11
13
 
12
14
  var _uiConstants = require("@dhis2/ui-constants");
13
15
 
14
- var _uiIcons = require("@dhis2/ui-icons");
15
-
16
16
  var _propTypes2 = _interopRequireDefault(require("prop-types"));
17
17
 
18
18
  var _react = _interopRequireDefault(require("react"));
@@ -27,43 +27,6 @@ var _menu = require("./menu.js");
27
27
 
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
29
 
30
- const StatusIcon = ({
31
- error,
32
- warning,
33
- valid,
34
- defaultTo
35
- }) => {
36
- if (error) {
37
- return /*#__PURE__*/_react.default.createElement(_uiIcons.IconErrorFilled24, {
38
- color: _uiConstants.theme.error
39
- });
40
- }
41
-
42
- if (warning) {
43
- return /*#__PURE__*/_react.default.createElement(_uiIcons.IconWarningFilled24, {
44
- color: _uiConstants.theme.warning
45
- });
46
- }
47
-
48
- if (valid) {
49
- return /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckmark24, {
50
- color: _uiConstants.theme.valid
51
- });
52
- }
53
-
54
- return defaultTo;
55
- };
56
-
57
- StatusIcon.defaultProps = {
58
- defaultTo: null
59
- };
60
- StatusIcon.propTypes = {
61
- defaultTo: _propTypes2.default.element,
62
- error: _propTypes2.default.bool,
63
- valid: _propTypes2.default.bool,
64
- warning: _propTypes2.default.bool
65
- };
66
-
67
30
  const MultiSelect = ({
68
31
  className,
69
32
  selected,
@@ -104,9 +67,9 @@ const MultiSelect = ({
104
67
  });
105
68
  return /*#__PURE__*/_react.default.createElement("div", {
106
69
  "data-test": dataTest,
107
- className: _style.default.dynamic([["196189569", [_uiConstants.spacers.dp8]]]) + " " + "root"
70
+ className: _style.default.dynamic([["2180377457", [_uiConstants.spacers.dp8]]]) + " " + "root"
108
71
  }, /*#__PURE__*/_react.default.createElement("div", {
109
- className: _style.default.dynamic([["196189569", [_uiConstants.spacers.dp8]]]) + " " + "root-input"
72
+ className: _style.default.dynamic([["2180377457", [_uiConstants.spacers.dp8]]]) + " " + "root-input"
110
73
  }, /*#__PURE__*/_react.default.createElement(_index.Select, {
111
74
  className: className,
112
75
  selected: selected,
@@ -133,14 +96,14 @@ const MultiSelect = ({
133
96
  }, children, loading && /*#__PURE__*/_react.default.createElement(_index.Loading, {
134
97
  message: loadingText,
135
98
  dataTest: `${dataTest}-loading`
136
- }))), /*#__PURE__*/_react.default.createElement(StatusIcon, {
99
+ }))), /*#__PURE__*/_react.default.createElement(_statusIcon.StatusIcon, {
137
100
  error: error,
138
101
  valid: valid,
139
102
  warning: warning
140
103
  }), /*#__PURE__*/_react.default.createElement(_style.default, {
141
- id: "196189569",
104
+ id: "2180377457",
142
105
  dynamic: [_uiConstants.spacers.dp8]
143
- }, [".root.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", `.root-input.__jsx-style-dynamic-selector{margin-right:${_uiConstants.spacers.dp8};-webkit-flex:1;-ms-flex:1;flex:1;}`]));
106
+ }, [`.root.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:${_uiConstants.spacers.dp8};}`, ".root-input.__jsx-style-dynamic-selector{-webkit-flex:1;-ms-flex:1;flex:1;}"]));
144
107
  };
145
108
 
146
109
  exports.MultiSelect = MultiSelect;
@@ -52,6 +52,9 @@ const SelectionList = ({
52
52
  key: value,
53
53
  onRemove: onRemove,
54
54
  disabled: isDisabled,
55
+ marginBottom: "0",
56
+ marginLeft: "0",
57
+ marginTop: "0",
55
58
  overflow: true,
56
59
  dense: true
57
60
  }, selectedOption.props.label);
@@ -7,12 +7,12 @@ exports.SingleSelect = void 0;
7
7
 
8
8
  var _style = _interopRequireDefault(require("styled-jsx/style"));
9
9
 
10
+ var _statusIcon = require("@dhis2-ui/status-icon");
11
+
10
12
  var _propTypes = require("@dhis2/prop-types");
11
13
 
12
14
  var _uiConstants = require("@dhis2/ui-constants");
13
15
 
14
- var _uiIcons = require("@dhis2/ui-icons");
15
-
16
16
  var _propTypes2 = _interopRequireDefault(require("prop-types"));
17
17
 
18
18
  var _react = _interopRequireDefault(require("react"));
@@ -27,43 +27,6 @@ var _menu = require("./menu.js");
27
27
 
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
29
 
30
- const StatusIcon = ({
31
- error,
32
- warning,
33
- valid,
34
- defaultTo
35
- }) => {
36
- if (error) {
37
- return /*#__PURE__*/_react.default.createElement(_uiIcons.IconErrorFilled24, {
38
- color: _uiConstants.theme.error
39
- });
40
- }
41
-
42
- if (warning) {
43
- return /*#__PURE__*/_react.default.createElement(_uiIcons.IconWarningFilled24, {
44
- color: _uiConstants.theme.warning
45
- });
46
- }
47
-
48
- if (valid) {
49
- return /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckmark24, {
50
- color: _uiConstants.theme.valid
51
- });
52
- }
53
-
54
- return defaultTo;
55
- };
56
-
57
- StatusIcon.defaultProps = {
58
- defaultTo: null
59
- };
60
- StatusIcon.propTypes = {
61
- defaultTo: _propTypes2.default.element,
62
- error: _propTypes2.default.bool,
63
- valid: _propTypes2.default.bool,
64
- warning: _propTypes2.default.bool
65
- };
66
-
67
30
  const SingleSelect = ({
68
31
  className,
69
32
  selected,
@@ -104,9 +67,9 @@ const SingleSelect = ({
104
67
  });
105
68
  return /*#__PURE__*/_react.default.createElement("div", {
106
69
  "data-test": dataTest,
107
- className: _style.default.dynamic([["196189569", [_uiConstants.spacers.dp8]]]) + " " + "root"
70
+ className: _style.default.dynamic([["2180377457", [_uiConstants.spacers.dp8]]]) + " " + "root"
108
71
  }, /*#__PURE__*/_react.default.createElement("div", {
109
- className: _style.default.dynamic([["196189569", [_uiConstants.spacers.dp8]]]) + " " + "root-input"
72
+ className: _style.default.dynamic([["2180377457", [_uiConstants.spacers.dp8]]]) + " " + "root-input"
110
73
  }, /*#__PURE__*/_react.default.createElement(_index.Select, {
111
74
  className: className,
112
75
  selected: selected,
@@ -133,14 +96,14 @@ const SingleSelect = ({
133
96
  }, children, loading && /*#__PURE__*/_react.default.createElement(_index.Loading, {
134
97
  message: loadingText,
135
98
  dataTest: `${dataTest}-loading`
136
- }))), /*#__PURE__*/_react.default.createElement(StatusIcon, {
99
+ }))), /*#__PURE__*/_react.default.createElement(_statusIcon.StatusIcon, {
137
100
  error: error,
138
101
  valid: valid,
139
102
  warning: warning
140
103
  }), /*#__PURE__*/_react.default.createElement(_style.default, {
141
- id: "196189569",
104
+ id: "2180377457",
142
105
  dynamic: [_uiConstants.spacers.dp8]
143
- }, [".root.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", `.root-input.__jsx-style-dynamic-selector{margin-right:${_uiConstants.spacers.dp8};-webkit-flex:1;-ms-flex:1;flex:1;}`]));
106
+ }, [`.root.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:${_uiConstants.spacers.dp8};}`, ".root-input.__jsx-style-dynamic-selector{-webkit-flex:1;-ms-flex:1;flex:1;}"]));
144
107
  };
145
108
 
146
109
  exports.SingleSelect = SingleSelect;
@@ -29,14 +29,14 @@ When('the window is resized to a greater width', () => {
29
29
  When('an option is clicked', () => {
30
30
  cy.contains('option one').click();
31
31
  });
32
- Then('the Input grows in height', () => {
32
+ Then('the Input remains the same height', () => {
33
33
  const emptyInputHeight = '@emptyInputHeight';
34
34
  const inputDataTest = '[data-test="dhis2-uicore-select-input"]';
35
35
  cy.getAll(emptyInputHeight, inputDataTest).should(([emptyInputHeight, inputs]) => {
36
36
  expect(inputs.length).to.equal(1);
37
37
  const $input = inputs[0];
38
38
  const inputRect = $input.getBoundingClientRect();
39
- expect(inputRect.height).to.be.greaterThan(emptyInputHeight);
39
+ expect(inputRect.height).to.equal(emptyInputHeight);
40
40
  });
41
41
  });
42
42
  Then('the top of the menu is aligned with the bottom of the input', () => {
@@ -34,14 +34,14 @@ Feature: Position of MultiSelect menu dropdown
34
34
  Then the left of the Menu is aligned with the left of the Input
35
35
  And the Menu and the Input have an equal width
36
36
 
37
- Scenario: Repositioning the menu when the Input grows
37
+ Scenario: Positioning the menu when an option is selected
38
38
  Given a MultiSelect is rendered to which options can be added
39
39
  And the input is empty
40
40
  When the MultiSelect is clicked
41
41
  Then the top of the menu is aligned with the bottom of the input
42
42
  And the left of the Menu is aligned with the left of the Input
43
43
  When an option is clicked
44
- Then the Input grows in height
44
+ Then the Input remains the same height
45
45
  And the top of the menu is aligned with the bottom of the input
46
46
  And the left of the Menu is aligned with the left of the Input
47
47
 
@@ -1,7 +1,7 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
+ import { StatusIcon } from '@dhis2-ui/status-icon';
2
3
  import { requiredIf } from '@dhis2/prop-types';
3
- import { theme, spacers, sharedPropTypes } from '@dhis2/ui-constants';
4
- import { IconErrorFilled24, IconWarningFilled24, IconCheckmark24 } from '@dhis2/ui-icons';
4
+ import { spacers, sharedPropTypes } from '@dhis2/ui-constants';
5
5
  import PropTypes from 'prop-types';
6
6
  import React from 'react';
7
7
  import { Loading as CommonLoading, Select } from '../select/index.js';
@@ -9,43 +9,6 @@ import { FilterableMenu } from './filterable-menu.js';
9
9
  import { Input } from './input.js';
10
10
  import { Menu } from './menu.js';
11
11
 
12
- const StatusIcon = ({
13
- error,
14
- warning,
15
- valid,
16
- defaultTo
17
- }) => {
18
- if (error) {
19
- return /*#__PURE__*/React.createElement(IconErrorFilled24, {
20
- color: theme.error
21
- });
22
- }
23
-
24
- if (warning) {
25
- return /*#__PURE__*/React.createElement(IconWarningFilled24, {
26
- color: theme.warning
27
- });
28
- }
29
-
30
- if (valid) {
31
- return /*#__PURE__*/React.createElement(IconCheckmark24, {
32
- color: theme.valid
33
- });
34
- }
35
-
36
- return defaultTo;
37
- };
38
-
39
- StatusIcon.defaultProps = {
40
- defaultTo: null
41
- };
42
- StatusIcon.propTypes = {
43
- defaultTo: PropTypes.element,
44
- error: PropTypes.bool,
45
- valid: PropTypes.bool,
46
- warning: PropTypes.bool
47
- };
48
-
49
12
  const MultiSelect = ({
50
13
  className,
51
14
  selected,
@@ -86,9 +49,9 @@ const MultiSelect = ({
86
49
  });
87
50
  return /*#__PURE__*/React.createElement("div", {
88
51
  "data-test": dataTest,
89
- className: _JSXStyle.dynamic([["196189569", [spacers.dp8]]]) + " " + "root"
52
+ className: _JSXStyle.dynamic([["2180377457", [spacers.dp8]]]) + " " + "root"
90
53
  }, /*#__PURE__*/React.createElement("div", {
91
- className: _JSXStyle.dynamic([["196189569", [spacers.dp8]]]) + " " + "root-input"
54
+ className: _JSXStyle.dynamic([["2180377457", [spacers.dp8]]]) + " " + "root-input"
92
55
  }, /*#__PURE__*/React.createElement(Select, {
93
56
  className: className,
94
57
  selected: selected,
@@ -120,9 +83,9 @@ const MultiSelect = ({
120
83
  valid: valid,
121
84
  warning: warning
122
85
  }), /*#__PURE__*/React.createElement(_JSXStyle, {
123
- id: "196189569",
86
+ id: "2180377457",
124
87
  dynamic: [spacers.dp8]
125
- }, [".root.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", `.root-input.__jsx-style-dynamic-selector{margin-right:${spacers.dp8};-webkit-flex:1;-ms-flex:1;flex:1;}`]));
88
+ }, [`.root.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:${spacers.dp8};}`, ".root-input.__jsx-style-dynamic-selector{-webkit-flex:1;-ms-flex:1;flex:1;}"]));
126
89
  };
127
90
 
128
91
  MultiSelect.defaultProps = {
@@ -40,6 +40,9 @@ const SelectionList = ({
40
40
  key: value,
41
41
  onRemove: onRemove,
42
42
  disabled: isDisabled,
43
+ marginBottom: "0",
44
+ marginLeft: "0",
45
+ marginTop: "0",
43
46
  overflow: true,
44
47
  dense: true
45
48
  }, selectedOption.props.label);
@@ -1,7 +1,7 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
+ import { StatusIcon } from '@dhis2-ui/status-icon';
2
3
  import { requiredIf } from '@dhis2/prop-types';
3
- import { theme, spacers, sharedPropTypes } from '@dhis2/ui-constants';
4
- import { IconErrorFilled24, IconWarningFilled24, IconCheckmark24 } from '@dhis2/ui-icons';
4
+ import { spacers, sharedPropTypes } from '@dhis2/ui-constants';
5
5
  import PropTypes from 'prop-types';
6
6
  import React from 'react';
7
7
  import { Loading as CommonLoading, Select } from '../select/index.js';
@@ -9,43 +9,6 @@ import { FilterableMenu } from './filterable-menu.js';
9
9
  import { Input } from './input.js';
10
10
  import { Menu } from './menu.js';
11
11
 
12
- const StatusIcon = ({
13
- error,
14
- warning,
15
- valid,
16
- defaultTo
17
- }) => {
18
- if (error) {
19
- return /*#__PURE__*/React.createElement(IconErrorFilled24, {
20
- color: theme.error
21
- });
22
- }
23
-
24
- if (warning) {
25
- return /*#__PURE__*/React.createElement(IconWarningFilled24, {
26
- color: theme.warning
27
- });
28
- }
29
-
30
- if (valid) {
31
- return /*#__PURE__*/React.createElement(IconCheckmark24, {
32
- color: theme.valid
33
- });
34
- }
35
-
36
- return defaultTo;
37
- };
38
-
39
- StatusIcon.defaultProps = {
40
- defaultTo: null
41
- };
42
- StatusIcon.propTypes = {
43
- defaultTo: PropTypes.element,
44
- error: PropTypes.bool,
45
- valid: PropTypes.bool,
46
- warning: PropTypes.bool
47
- };
48
-
49
12
  const SingleSelect = ({
50
13
  className,
51
14
  selected,
@@ -86,9 +49,9 @@ const SingleSelect = ({
86
49
  });
87
50
  return /*#__PURE__*/React.createElement("div", {
88
51
  "data-test": dataTest,
89
- className: _JSXStyle.dynamic([["196189569", [spacers.dp8]]]) + " " + "root"
52
+ className: _JSXStyle.dynamic([["2180377457", [spacers.dp8]]]) + " " + "root"
90
53
  }, /*#__PURE__*/React.createElement("div", {
91
- className: _JSXStyle.dynamic([["196189569", [spacers.dp8]]]) + " " + "root-input"
54
+ className: _JSXStyle.dynamic([["2180377457", [spacers.dp8]]]) + " " + "root-input"
92
55
  }, /*#__PURE__*/React.createElement(Select, {
93
56
  className: className,
94
57
  selected: selected,
@@ -120,9 +83,9 @@ const SingleSelect = ({
120
83
  valid: valid,
121
84
  warning: warning
122
85
  }), /*#__PURE__*/React.createElement(_JSXStyle, {
123
- id: "196189569",
86
+ id: "2180377457",
124
87
  dynamic: [spacers.dp8]
125
- }, [".root.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", `.root-input.__jsx-style-dynamic-selector{margin-right:${spacers.dp8};-webkit-flex:1;-ms-flex:1;flex:1;}`]));
88
+ }, [`.root.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:${spacers.dp8};}`, ".root-input.__jsx-style-dynamic-selector{-webkit-flex:1;-ms-flex:1;flex:1;}"]));
126
89
  };
127
90
 
128
91
  SingleSelect.defaultProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/select",
3
- "version": "7.14.1",
3
+ "version": "7.15.1",
4
4
  "description": "UI Select",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,18 +33,19 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@dhis2/prop-types": "^3.0.0-beta.1",
36
- "@dhis2-ui/box": "7.14.1",
37
- "@dhis2-ui/button": "7.14.1",
38
- "@dhis2-ui/card": "7.14.1",
39
- "@dhis2-ui/checkbox": "7.14.1",
40
- "@dhis2-ui/chip": "7.14.1",
41
- "@dhis2-ui/field": "7.14.1",
42
- "@dhis2-ui/input": "7.14.1",
43
- "@dhis2-ui/layer": "7.14.1",
44
- "@dhis2-ui/loader": "7.14.1",
45
- "@dhis2-ui/popper": "7.14.1",
46
- "@dhis2/ui-constants": "7.14.1",
47
- "@dhis2/ui-icons": "7.14.1",
36
+ "@dhis2-ui/box": "7.15.1",
37
+ "@dhis2-ui/button": "7.15.1",
38
+ "@dhis2-ui/card": "7.15.1",
39
+ "@dhis2-ui/checkbox": "7.15.1",
40
+ "@dhis2-ui/chip": "7.15.1",
41
+ "@dhis2-ui/field": "7.15.1",
42
+ "@dhis2-ui/input": "7.15.1",
43
+ "@dhis2-ui/layer": "7.15.1",
44
+ "@dhis2-ui/loader": "7.15.1",
45
+ "@dhis2-ui/popper": "7.15.1",
46
+ "@dhis2-ui/status-icon": "7.15.1",
47
+ "@dhis2/ui-constants": "7.15.1",
48
+ "@dhis2/ui-icons": "7.15.1",
48
49
  "classnames": "^2.3.1",
49
50
  "prop-types": "^15.7.2"
50
51
  },