@dhis2-ui/select 8.2.0 → 8.2.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.
- package/build/cjs/multi-select/features/menu_width_matches_input/index.js +4 -2
- package/build/cjs/multi-select/features/position/index.js +12 -6
- package/build/cjs/multi-select/filterable-menu.js +25 -22
- package/build/cjs/multi-select/input.js +19 -18
- package/build/cjs/multi-select/menu.js +29 -25
- package/build/cjs/multi-select/multi-select.js +31 -30
- package/build/cjs/multi-select/multi-select.stories.e2e.js +30 -20
- package/build/cjs/multi-select/multi-select.stories.js +14 -23
- package/build/cjs/multi-select/selection-list.js +43 -37
- package/build/cjs/multi-select-field/multi-select-field.stories.js +5 -15
- package/build/cjs/multi-select-option/multi-select-option.js +31 -28
- package/build/cjs/select/debounce/debounce.js +8 -2
- package/build/cjs/select/empty.js +14 -11
- package/build/cjs/select/filter-input.js +24 -21
- package/build/cjs/select/filterable-menu.js +8 -7
- package/build/cjs/select/index.js +24 -24
- package/build/cjs/select/input-clear-button.js +16 -13
- package/build/cjs/select/input-placeholder.js +8 -6
- package/build/cjs/select/input-prefix.js +8 -6
- package/build/cjs/select/input-wrapper.js +15 -14
- package/build/cjs/select/loading.js +18 -15
- package/build/cjs/select/menu-wrapper.js +11 -10
- package/build/cjs/select/no-match.js +12 -9
- package/build/cjs/select/option-helpers.js +1 -1
- package/build/cjs/select/select.js +6 -6
- package/build/cjs/single-select/features/menu_width_matches_input/index.js +4 -2
- package/build/cjs/single-select/features/position/index.js +8 -4
- package/build/cjs/single-select/filterable-menu.js +25 -22
- package/build/cjs/single-select/input.js +19 -18
- package/build/cjs/single-select/menu.js +11 -10
- package/build/cjs/single-select/selection.js +8 -7
- package/build/cjs/single-select/single-select.js +31 -30
- package/build/cjs/single-select/single-select.stories.e2e.js +26 -17
- package/build/cjs/single-select/single-select.stories.js +14 -21
- package/build/cjs/single-select-field/single-select-field.stories.js +5 -15
- package/build/cjs/single-select-option/single-select-option.js +23 -20
- package/build/es/multi-select/features/menu_width_matches_input/index.js +4 -2
- package/build/es/multi-select/features/position/index.js +12 -6
- package/build/es/multi-select/filterable-menu.js +25 -22
- package/build/es/multi-select/input.js +19 -18
- package/build/es/multi-select/menu.js +28 -24
- package/build/es/multi-select/multi-select.js +31 -30
- package/build/es/multi-select/multi-select.stories.e2e.js +30 -20
- package/build/es/multi-select/multi-select.stories.js +13 -22
- package/build/es/multi-select/selection-list.js +43 -37
- package/build/es/multi-select-field/multi-select-field.stories.js +4 -14
- package/build/es/multi-select-option/multi-select-option.js +31 -28
- package/build/es/select/debounce/debounce.js +8 -2
- package/build/es/select/empty.js +14 -11
- package/build/es/select/filter-input.js +24 -21
- package/build/es/select/filterable-menu.js +8 -7
- package/build/es/select/input-clear-button.js +16 -13
- package/build/es/select/input-placeholder.js +8 -6
- package/build/es/select/input-prefix.js +8 -6
- package/build/es/select/input-wrapper.js +15 -14
- package/build/es/select/loading.js +18 -15
- package/build/es/select/menu-wrapper.js +11 -10
- package/build/es/select/no-match.js +12 -9
- package/build/es/select/select.js +6 -6
- package/build/es/single-select/features/menu_width_matches_input/index.js +4 -2
- package/build/es/single-select/features/position/index.js +8 -4
- package/build/es/single-select/filterable-menu.js +25 -22
- package/build/es/single-select/input.js +19 -18
- package/build/es/single-select/menu.js +11 -10
- package/build/es/single-select/selection.js +8 -7
- package/build/es/single-select/single-select.js +31 -30
- package/build/es/single-select/single-select.stories.e2e.js +26 -17
- package/build/es/single-select/single-select.stories.js +13 -20
- package/build/es/single-select-field/single-select-field.stories.js +4 -14
- package/build/es/single-select-option/single-select-option.js +23 -20
- package/package.json +14 -14
package/build/es/select/empty.js
CHANGED
|
@@ -3,17 +3,20 @@ import { colors, spacers, theme } from '@dhis2/ui-constants';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
-
const Empty =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
const Empty = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
message,
|
|
9
|
+
className,
|
|
10
|
+
dataTest
|
|
11
|
+
} = _ref;
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
13
|
+
"data-test": dataTest,
|
|
14
|
+
className: _JSXStyle.dynamic([["849993029", [colors.grey700, theme.fonts, spacers.dp8, spacers.dp24]]]) + " " + (className || "")
|
|
15
|
+
}, message, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
16
|
+
id: "849993029",
|
|
17
|
+
dynamic: [colors.grey700, theme.fonts, spacers.dp8, spacers.dp24]
|
|
18
|
+
}, ["div.__jsx-style-dynamic-selector{color:".concat(colors.grey700, ";font-family:").concat(theme.fonts, ";font-size:13px;line-height:16px;padding:").concat(spacers.dp8, " ").concat(spacers.dp24, ";text-align:center;}")]));
|
|
19
|
+
};
|
|
17
20
|
|
|
18
21
|
Empty.propTypes = {
|
|
19
22
|
dataTest: PropTypes.string.isRequired,
|
|
@@ -4,27 +4,30 @@ import { spacers, colors } from '@dhis2/ui-constants';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
const FilterInput =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
const FilterInput = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
value,
|
|
10
|
+
onChange,
|
|
11
|
+
placeholder,
|
|
12
|
+
className,
|
|
13
|
+
dataTest
|
|
14
|
+
} = _ref;
|
|
15
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
className: _JSXStyle.dynamic([["1544004171", [colors.white, spacers.dp8, spacers.dp8, spacers.dp4, spacers.dp8]]]) + " " + (className || "")
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
18
|
+
dense: true,
|
|
19
|
+
dataTest: dataTest,
|
|
20
|
+
value: value,
|
|
21
|
+
onChange: onChange,
|
|
22
|
+
type: "text",
|
|
23
|
+
name: "filter",
|
|
24
|
+
placeholder: placeholder,
|
|
25
|
+
initialFocus: true
|
|
26
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
27
|
+
id: "1544004171",
|
|
28
|
+
dynamic: [colors.white, spacers.dp8, spacers.dp8, spacers.dp4, spacers.dp8]
|
|
29
|
+
}, ["div.__jsx-style-dynamic-selector{position:-webkit-sticky;position:sticky;top:0;background:".concat(colors.white, ";padding:").concat(spacers.dp8, " ").concat(spacers.dp8, " ").concat(spacers.dp4, " ").concat(spacers.dp8, ";z-index:1;}")]));
|
|
30
|
+
};
|
|
28
31
|
|
|
29
32
|
FilterInput.propTypes = {
|
|
30
33
|
dataTest: PropTypes.string.isRequired,
|
|
@@ -8,16 +8,17 @@ import { FilterInput } from './filter-input.js';
|
|
|
8
8
|
import { NoMatch } from './no-match.js';
|
|
9
9
|
import { filterIgnored, checkIfValidOption } from './option-helpers.js';
|
|
10
10
|
export class FilterableMenu extends Component {
|
|
11
|
-
constructor(
|
|
12
|
-
super(...
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
13
|
|
|
14
14
|
_defineProperty(this, "state", {
|
|
15
15
|
filter: ''
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
_defineProperty(this, "onFilterChange",
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
_defineProperty(this, "onFilterChange", _ref => {
|
|
19
|
+
let {
|
|
20
|
+
value
|
|
21
|
+
} = _ref;
|
|
21
22
|
this.setState({
|
|
22
23
|
filter: value
|
|
23
24
|
});
|
|
@@ -52,7 +53,7 @@ export class FilterableMenu extends Component {
|
|
|
52
53
|
|
|
53
54
|
if (React.Children.count(renderedOptions) === 0 || !filter) {
|
|
54
55
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FilterInput, {
|
|
55
|
-
dataTest:
|
|
56
|
+
dataTest: "".concat(dataTest, "-filterinput"),
|
|
56
57
|
placeholder: placeholder,
|
|
57
58
|
value: filter,
|
|
58
59
|
onChange: this.onFilterChange
|
|
@@ -77,7 +78,7 @@ export class FilterableMenu extends Component {
|
|
|
77
78
|
});
|
|
78
79
|
const hasMatch = React.Children.count(filtered) > 0;
|
|
79
80
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FilterInput, {
|
|
80
|
-
dataTest:
|
|
81
|
+
dataTest: "".concat(dataTest, "-filterinput"),
|
|
81
82
|
placeholder: placeholder,
|
|
82
83
|
value: filter,
|
|
83
84
|
onChange: this.onFilterChange
|
|
@@ -2,19 +2,22 @@ import { Button } from '@dhis2-ui/button';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
5
|
-
const InputClearButton =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
const InputClearButton = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
onClear,
|
|
8
|
+
clearText,
|
|
9
|
+
className,
|
|
10
|
+
dataTest
|
|
11
|
+
} = _ref;
|
|
12
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
13
|
+
small: true,
|
|
14
|
+
secondary: true,
|
|
15
|
+
dataTest: dataTest,
|
|
16
|
+
onClick: onClear,
|
|
17
|
+
type: "button",
|
|
18
|
+
className: className
|
|
19
|
+
}, clearText);
|
|
20
|
+
};
|
|
18
21
|
|
|
19
22
|
InputClearButton.propTypes = {
|
|
20
23
|
clearText: PropTypes.string.isRequired,
|
|
@@ -3,11 +3,13 @@ import { colors } from '@dhis2/ui-constants';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
-
const InputPlaceholder =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const InputPlaceholder = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
placeholder,
|
|
9
|
+
className,
|
|
10
|
+
dataTest
|
|
11
|
+
} = _ref;
|
|
12
|
+
|
|
11
13
|
if (!placeholder) {
|
|
12
14
|
return null;
|
|
13
15
|
}
|
|
@@ -18,7 +20,7 @@ const InputPlaceholder = ({
|
|
|
18
20
|
}, placeholder, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
19
21
|
id: "1027033961",
|
|
20
22
|
dynamic: [colors.grey600]
|
|
21
|
-
}, [
|
|
23
|
+
}, ["div.__jsx-style-dynamic-selector{color:".concat(colors.grey600, ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}")]));
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
InputPlaceholder.propTypes = {
|
|
@@ -3,11 +3,13 @@ import { colors, spacers } from '@dhis2/ui-constants';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
-
const InputPrefix =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const InputPrefix = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
prefix,
|
|
9
|
+
className,
|
|
10
|
+
dataTest
|
|
11
|
+
} = _ref;
|
|
12
|
+
|
|
11
13
|
if (!prefix) {
|
|
12
14
|
return null;
|
|
13
15
|
}
|
|
@@ -18,7 +20,7 @@ const InputPrefix = ({
|
|
|
18
20
|
}, prefix, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
19
21
|
id: "153011991",
|
|
20
22
|
dynamic: [colors.grey600, spacers.dp4]
|
|
21
|
-
}, [
|
|
23
|
+
}, ["div.__jsx-style-dynamic-selector{color:".concat(colors.grey600, ";padding-right:").concat(spacers.dp4, ";font-size:14px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}")]));
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
InputPrefix.propTypes = {
|
|
@@ -5,19 +5,20 @@ import cx from 'classnames';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
const InputWrapper =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
const InputWrapper = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
dataTest,
|
|
11
|
+
onToggle,
|
|
12
|
+
children,
|
|
13
|
+
tabIndex,
|
|
14
|
+
error,
|
|
15
|
+
warning,
|
|
16
|
+
valid,
|
|
17
|
+
disabled,
|
|
18
|
+
dense,
|
|
19
|
+
className,
|
|
20
|
+
inputRef
|
|
21
|
+
} = _ref;
|
|
21
22
|
const classNames = cx(className, 'root', {
|
|
22
23
|
error,
|
|
23
24
|
warning,
|
|
@@ -38,7 +39,7 @@ const InputWrapper = ({
|
|
|
38
39
|
}, /*#__PURE__*/React.createElement(IconChevronDown16, null)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
39
40
|
id: "248041060",
|
|
40
41
|
dynamic: [colors.grey500, theme.focus, theme.focus, theme.valid, theme.warning, theme.error, colors.grey100, colors.grey500, theme.disabled]
|
|
41
|
-
}, [
|
|
42
|
+
}, [".root.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:white;border-radius:3px;border:1px solid ".concat(colors.grey500, ";box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;min-height:40px;padding:6px 12px;box-shadow:inset 0 1px 2px 0 rgba(48,54,60,0.1);}"), ".root.__jsx-style-dynamic-selector:not(.disabled):focus,.root.__jsx-style-dynamic-selector:not(.disabled):active{outline:none;box-shadow:inset 0 0 0 2px ".concat(theme.focus, ";border-color:").concat(theme.focus, ";}"), ".root.valid.__jsx-style-dynamic-selector{border-color:".concat(theme.valid, ";}"), ".root.warning.__jsx-style-dynamic-selector{border-color:".concat(theme.warning, ";}"), ".root.error.__jsx-style-dynamic-selector{border-color:".concat(theme.error, ";}"), ".root.disabled.__jsx-style-dynamic-selector{background-color:".concat(colors.grey100, ";border-color:").concat(colors.grey500, ";color:").concat(theme.disabled, ";cursor:not-allowed;}"), ".root.dense.__jsx-style-dynamic-selector{padding:4px 8px;min-height:32px;}", ".root-children.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".root-right.__jsx-style-dynamic-selector{margin:4px 0px 0px 8px;}"]));
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
InputWrapper.defaultProps = {
|
|
@@ -4,21 +4,24 @@ import { colors, spacers, theme } from '@dhis2/ui-constants';
|
|
|
4
4
|
import cx from 'classnames';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React from 'react';
|
|
7
|
-
export const Loading =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}, /*#__PURE__*/React.createElement(
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
export const Loading = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
message,
|
|
10
|
+
className,
|
|
11
|
+
dataTest
|
|
12
|
+
} = _ref;
|
|
13
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
"data-test": dataTest,
|
|
15
|
+
className: _JSXStyle.dynamic([["1068210086", [spacers.dp16, colors.grey700, theme.fonts, spacers.dp8, spacers.dp24]]]) + " " + (cx(className, 'container') || "")
|
|
16
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
className: _JSXStyle.dynamic([["1068210086", [spacers.dp16, colors.grey700, theme.fonts, spacers.dp8, spacers.dp24]]])
|
|
18
|
+
}, /*#__PURE__*/React.createElement(CircularLoader, {
|
|
19
|
+
small: true
|
|
20
|
+
})), message, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
21
|
+
id: "1068210086",
|
|
22
|
+
dynamic: [spacers.dp16, colors.grey700, theme.fonts, spacers.dp8, spacers.dp24]
|
|
23
|
+
}, [".container.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:".concat(spacers.dp16, ";-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;color:").concat(colors.grey700, ";font-family:").concat(theme.fonts, ";font-size:13px;padding:").concat(spacers.dp8, " ").concat(spacers.dp24, ";}")]));
|
|
24
|
+
};
|
|
22
25
|
Loading.propTypes = {
|
|
23
26
|
dataTest: PropTypes.string.isRequired,
|
|
24
27
|
className: PropTypes.string,
|
|
@@ -5,14 +5,15 @@ import { colors, elevations } from '@dhis2/ui-constants';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
const MenuWrapper =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
const MenuWrapper = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
children,
|
|
11
|
+
dataTest,
|
|
12
|
+
maxHeight,
|
|
13
|
+
menuWidth,
|
|
14
|
+
onClick,
|
|
15
|
+
selectRef
|
|
16
|
+
} = _ref;
|
|
16
17
|
return /*#__PURE__*/React.createElement(Layer, {
|
|
17
18
|
onClick: onClick,
|
|
18
19
|
transparent: true
|
|
@@ -21,12 +22,12 @@ const MenuWrapper = ({
|
|
|
21
22
|
placement: "bottom-start",
|
|
22
23
|
observeReferenceResize: true
|
|
23
24
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24
|
-
"data-test":
|
|
25
|
+
"data-test": "".concat(dataTest, "-menuwrapper"),
|
|
25
26
|
className: _JSXStyle.dynamic([["1363246346", [menuWidth, maxHeight, colors.white, colors.grey200, elevations.e300]]])
|
|
26
27
|
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
27
28
|
id: "1363246346",
|
|
28
29
|
dynamic: [menuWidth, maxHeight, colors.white, colors.grey200, elevations.e300]
|
|
29
|
-
}, [
|
|
30
|
+
}, ["div.__jsx-style-dynamic-selector{width:".concat(menuWidth, ";height:auto;max-height:").concat(maxHeight, ";overflow:auto;background:").concat(colors.white, ";border:1px solid ").concat(colors.grey200, ";border-radius:3px;box-shadow:").concat(elevations.e300, ";}")]))));
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
MenuWrapper.defaultProps = {
|
|
@@ -3,15 +3,18 @@ import { colors, spacers, theme } from '@dhis2/ui-constants';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
-
const NoMatch =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
const NoMatch = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
message,
|
|
9
|
+
className
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: _JSXStyle.dynamic([["849993029", [colors.grey700, theme.fonts, spacers.dp8, spacers.dp24]]]) + " " + (className || "")
|
|
13
|
+
}, message, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
14
|
+
id: "849993029",
|
|
15
|
+
dynamic: [colors.grey700, theme.fonts, spacers.dp8, spacers.dp24]
|
|
16
|
+
}, ["div.__jsx-style-dynamic-selector{color:".concat(colors.grey700, ";font-family:").concat(theme.fonts, ";font-size:13px;line-height:16px;padding:").concat(spacers.dp8, " ").concat(spacers.dp24, ";text-align:center;}")]));
|
|
17
|
+
};
|
|
15
18
|
|
|
16
19
|
NoMatch.propTypes = {
|
|
17
20
|
message: PropTypes.string.isRequired,
|
|
@@ -12,8 +12,8 @@ const SPACE_KEY = 32;
|
|
|
12
12
|
const UP_KEY = 38;
|
|
13
13
|
const DOWN_KEY = 40;
|
|
14
14
|
export class Select extends Component {
|
|
15
|
-
constructor(
|
|
16
|
-
super(...
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
17
|
|
|
18
18
|
_defineProperty(this, "state", {
|
|
19
19
|
open: false,
|
|
@@ -154,8 +154,8 @@ export class Select extends Component {
|
|
|
154
154
|
menuWidth
|
|
155
155
|
} = this.state;
|
|
156
156
|
|
|
157
|
-
if (offsetWidth &&
|
|
158
|
-
return
|
|
157
|
+
if (offsetWidth && "".concat(offsetWidth, "px") !== menuWidth) {
|
|
158
|
+
return "".concat(offsetWidth, "px");
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
return menuWidth;
|
|
@@ -212,13 +212,13 @@ export class Select extends Component {
|
|
|
212
212
|
valid: valid,
|
|
213
213
|
disabled: disabled,
|
|
214
214
|
dense: dense,
|
|
215
|
-
dataTest:
|
|
215
|
+
dataTest: "".concat(dataTest, "-input")
|
|
216
216
|
}, input), open && /*#__PURE__*/React.createElement(MenuWrapper, {
|
|
217
217
|
onClick: this.onOutsideClick,
|
|
218
218
|
maxHeight: maxHeight,
|
|
219
219
|
selectRef: this.selectRef,
|
|
220
220
|
menuWidth: menuWidth,
|
|
221
|
-
dataTest:
|
|
221
|
+
dataTest: "".concat(dataTest, "-menu")
|
|
222
222
|
}, menu));
|
|
223
223
|
}
|
|
224
224
|
|
|
@@ -24,7 +24,8 @@ When('the SingleSelect menu is open', () => {
|
|
|
24
24
|
Then('the SingleSelect input is left aligned with the menu', () => {
|
|
25
25
|
const selectDataTest = '[data-test="dhis2-uicore-singleselect"]';
|
|
26
26
|
const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
|
|
27
|
-
cy.getAll(selectDataTest, menuDataTest).should(
|
|
27
|
+
cy.getAll(selectDataTest, menuDataTest).should(_ref => {
|
|
28
|
+
let [inputs, menus] = _ref;
|
|
28
29
|
expect(inputs.length).to.equal(1);
|
|
29
30
|
expect(menus.length).to.equal(1);
|
|
30
31
|
const $input = inputs[0];
|
|
@@ -37,7 +38,8 @@ Then('the SingleSelect input is left aligned with the menu', () => {
|
|
|
37
38
|
When('the SingleSelect input and menu have the same width', () => {
|
|
38
39
|
const inputSelector = '[data-test="dhis2-uicore-select"]';
|
|
39
40
|
const menuSelector = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
|
|
40
|
-
cy.getAll(inputSelector, menuSelector).should(
|
|
41
|
+
cy.getAll(inputSelector, menuSelector).should(_ref2 => {
|
|
42
|
+
let [$input, $menu] = _ref2;
|
|
41
43
|
const inputWidth = Math.round($input.outerWidth());
|
|
42
44
|
const menuWidth = Math.round($menu.outerWidth());
|
|
43
45
|
expect(inputWidth).to.equal(menuWidth);
|
|
@@ -21,7 +21,8 @@ When('the window is scrolled down', () => {
|
|
|
21
21
|
Then('the top of the menu is aligned with the bottom of the input', () => {
|
|
22
22
|
const selectDataTest = '[data-test="dhis2-uicore-singleselect"]';
|
|
23
23
|
const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
|
|
24
|
-
cy.getAll(selectDataTest, menuDataTest).should(
|
|
24
|
+
cy.getAll(selectDataTest, menuDataTest).should(_ref => {
|
|
25
|
+
let [selects, menus] = _ref;
|
|
25
26
|
expect(selects.length).to.equal(1);
|
|
26
27
|
expect(menus.length).to.equal(1);
|
|
27
28
|
const $select = selects[0];
|
|
@@ -34,7 +35,8 @@ Then('the top of the menu is aligned with the bottom of the input', () => {
|
|
|
34
35
|
Then('the bottom of the menu is aligned with the top of the input', () => {
|
|
35
36
|
const selectDataTest = '[data-test="dhis2-uicore-singleselect"]';
|
|
36
37
|
const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
|
|
37
|
-
cy.getAll(selectDataTest, menuDataTest).should(
|
|
38
|
+
cy.getAll(selectDataTest, menuDataTest).should(_ref2 => {
|
|
39
|
+
let [selects, menus] = _ref2;
|
|
38
40
|
expect(selects.length).to.equal(1);
|
|
39
41
|
expect(menus.length).to.equal(1);
|
|
40
42
|
const $select = selects[0];
|
|
@@ -47,7 +49,8 @@ Then('the bottom of the menu is aligned with the top of the input', () => {
|
|
|
47
49
|
Then('it is rendered on top of the SingleSelect', () => {
|
|
48
50
|
const selectDataTest = '[data-test="dhis2-uicore-singleselect"]';
|
|
49
51
|
const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
|
|
50
|
-
cy.getAll(selectDataTest, menuDataTest).should(
|
|
52
|
+
cy.getAll(selectDataTest, menuDataTest).should(_ref3 => {
|
|
53
|
+
let [selects, menus] = _ref3;
|
|
51
54
|
expect(selects.length).to.equal(1);
|
|
52
55
|
expect(menus.length).to.equal(1);
|
|
53
56
|
const $select = selects[0];
|
|
@@ -61,7 +64,8 @@ Then('it is rendered on top of the SingleSelect', () => {
|
|
|
61
64
|
Then('the left of the SingleSelect is aligned with the left of the anchor', () => {
|
|
62
65
|
const selectDataTest = '[data-test="dhis2-uicore-singleselect"]';
|
|
63
66
|
const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
|
|
64
|
-
cy.getAll(selectDataTest, menuDataTest).should(
|
|
67
|
+
cy.getAll(selectDataTest, menuDataTest).should(_ref4 => {
|
|
68
|
+
let [selects, menus] = _ref4;
|
|
65
69
|
expect(selects.length).to.equal(1);
|
|
66
70
|
expect(menus.length).to.equal(1);
|
|
67
71
|
const $select = selects[0];
|
|
@@ -2,28 +2,31 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FilterableMenu as CommonFilterableMenu } from '../select/index.js';
|
|
4
4
|
import { Menu } from './menu.js';
|
|
5
|
-
export const FilterableMenu =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
export const FilterableMenu = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
dataTest,
|
|
8
|
+
options,
|
|
9
|
+
onChange,
|
|
10
|
+
selected,
|
|
11
|
+
empty,
|
|
12
|
+
handleClose,
|
|
13
|
+
handleFocusInput,
|
|
14
|
+
placeholder,
|
|
15
|
+
noMatchText
|
|
16
|
+
} = _ref;
|
|
17
|
+
return /*#__PURE__*/React.createElement(CommonFilterableMenu, {
|
|
18
|
+
dataTest: dataTest,
|
|
19
|
+
options: options,
|
|
20
|
+
onChange: onChange,
|
|
21
|
+
selected: selected,
|
|
22
|
+
empty: empty,
|
|
23
|
+
handleClose: handleClose,
|
|
24
|
+
handleFocusInput: handleFocusInput,
|
|
25
|
+
placeholder: placeholder,
|
|
26
|
+
noMatchText: noMatchText,
|
|
27
|
+
Menu: Menu
|
|
28
|
+
});
|
|
29
|
+
};
|
|
27
30
|
FilterableMenu.propTypes = {
|
|
28
31
|
dataTest: PropTypes.string.isRequired,
|
|
29
32
|
noMatchText: PropTypes.string.isRequired,
|
|
@@ -7,19 +7,20 @@ import React from 'react';
|
|
|
7
7
|
import { InputClearButton, InputPlaceholder, InputPrefix } from '../select/index.js';
|
|
8
8
|
import { Selection } from './selection.js';
|
|
9
9
|
|
|
10
|
-
const Input =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
const Input = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
selected,
|
|
13
|
+
onChange,
|
|
14
|
+
clearable,
|
|
15
|
+
clearText,
|
|
16
|
+
placeholder,
|
|
17
|
+
dataTest,
|
|
18
|
+
prefix,
|
|
19
|
+
options,
|
|
20
|
+
className,
|
|
21
|
+
disabled,
|
|
22
|
+
inputMaxHeight
|
|
23
|
+
} = _ref;
|
|
23
24
|
const hasSelection = selected && typeof selected === 'string';
|
|
24
25
|
|
|
25
26
|
const onClear = (_, e) => {
|
|
@@ -34,10 +35,10 @@ const Input = ({
|
|
|
34
35
|
className: _JSXStyle.dynamic([["1360178250", [colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + (cx('root', className) || "")
|
|
35
36
|
}, /*#__PURE__*/React.createElement(InputPrefix, {
|
|
36
37
|
prefix: prefix,
|
|
37
|
-
dataTest:
|
|
38
|
+
dataTest: "".concat(dataTest, "-prefix")
|
|
38
39
|
}), !hasSelection && !prefix && /*#__PURE__*/React.createElement(InputPlaceholder, {
|
|
39
40
|
placeholder: placeholder,
|
|
40
|
-
dataTest:
|
|
41
|
+
dataTest: "".concat(dataTest, "-placeholder")
|
|
41
42
|
}), hasSelection && /*#__PURE__*/React.createElement("div", {
|
|
42
43
|
className: _JSXStyle.dynamic([["1360178250", [colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + "root-input"
|
|
43
44
|
}, /*#__PURE__*/React.createElement(Selection, {
|
|
@@ -48,14 +49,14 @@ const Input = ({
|
|
|
48
49
|
}, /*#__PURE__*/React.createElement(InputClearButton, {
|
|
49
50
|
onClear: onClear,
|
|
50
51
|
clearText: clearText,
|
|
51
|
-
dataTest:
|
|
52
|
+
dataTest: "".concat(dataTest, "-clear")
|
|
52
53
|
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
53
54
|
id: "1360178250",
|
|
54
55
|
dynamic: [colors.grey900]
|
|
55
|
-
}, [
|
|
56
|
+
}, [".root.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:".concat(colors.grey900, ";font-size:14px;line-height:16px;}"), ".root-input.__jsx-style-dynamic-selector{overflow-y:auto;-webkit-flex:1;-ms-flex:1;flex:1;}", ".root-right.__jsx-style-dynamic-selector{margin-left:auto;margin-right:10px;}"]), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
56
57
|
id: "1331770409",
|
|
57
58
|
dynamic: [inputMaxHeight]
|
|
58
|
-
}, [
|
|
59
|
+
}, [".root-input.__jsx-style-dynamic-selector{max-height:".concat(inputMaxHeight, ";}")]));
|
|
59
60
|
};
|
|
60
61
|
|
|
61
62
|
Input.defaultProps = {
|
|
@@ -7,15 +7,16 @@ const onIgnoredClick = (_, e) => {
|
|
|
7
7
|
e.preventDefault();
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const Menu =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
const Menu = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
options,
|
|
13
|
+
onChange,
|
|
14
|
+
selected,
|
|
15
|
+
empty,
|
|
16
|
+
handleFocusInput,
|
|
17
|
+
handleClose,
|
|
18
|
+
dataTest
|
|
19
|
+
} = _ref;
|
|
19
20
|
const renderedOptions = filterIgnored(options);
|
|
20
21
|
|
|
21
22
|
if (React.Children.count(renderedOptions) === 0) {
|
|
@@ -23,7 +24,7 @@ const Menu = ({
|
|
|
23
24
|
if (typeof empty === 'string') {
|
|
24
25
|
return /*#__PURE__*/React.createElement(Empty, {
|
|
25
26
|
message: empty,
|
|
26
|
-
dataTest:
|
|
27
|
+
dataTest: "".concat(dataTest, "-empty")
|
|
27
28
|
});
|
|
28
29
|
} // Otherwise just render the supplied markup
|
|
29
30
|
|