@dhis2-ui/select 9.11.0 → 9.11.1-beta.2
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/index.js +0 -6
- package/build/cjs/locales/index.js +3 -69
- package/build/cjs/multi-select/__tests__/multi-select.test.js +1 -7
- package/build/cjs/multi-select/__tests__/selection-list.test.js +7 -18
- package/build/cjs/multi-select/features/accepts_blur_cb/index.js +1 -2
- package/build/cjs/multi-select/features/accepts_focus_cb/index.js +1 -2
- package/build/cjs/multi-select/features/accepts_initial_focus/index.js +1 -2
- package/build/cjs/multi-select/features/accepts_loading/index.js +0 -1
- package/build/cjs/multi-select/features/accepts_max_height/index.js +1 -2
- package/build/cjs/multi-select/features/accepts_placeholder/index.js +0 -1
- package/build/cjs/multi-select/features/accepts_prefix/index.js +0 -1
- package/build/cjs/multi-select/features/allows_invalid_options/index.js +0 -1
- package/build/cjs/multi-select/features/allows_selecting/index.js +2 -3
- package/build/cjs/multi-select/features/can_be_cleared/index.js +1 -2
- package/build/cjs/multi-select/features/can_be_disabled/index.js +0 -1
- package/build/cjs/multi-select/features/can_be_empty/index.js +0 -1
- package/build/cjs/multi-select/features/can_be_filtered/index.js +0 -1
- package/build/cjs/multi-select/features/can_be_opened_and_closed/index.js +0 -1
- package/build/cjs/multi-select/features/common/index.js +2 -3
- package/build/cjs/multi-select/features/duplicate_option_values/index.js +0 -1
- package/build/cjs/multi-select/features/menu_width_matches_input/index.js +1 -2
- package/build/cjs/multi-select/features/position/index.js +4 -5
- package/build/cjs/multi-select/features/position.feature +0 -1
- package/build/cjs/multi-select/features/shows_selections/index.js +0 -1
- package/build/cjs/multi-select/filterable-menu.js +1 -8
- package/build/cjs/multi-select/index.js +0 -1
- package/build/cjs/multi-select/input.js +6 -19
- package/build/cjs/multi-select/menu.js +16 -23
- package/build/cjs/multi-select/multi-select.e2e.stories.js +675 -0
- package/build/cjs/multi-select/multi-select.js +4 -21
- package/build/cjs/multi-select/{multi-select.stories.js → multi-select.prod.stories.js} +62 -101
- package/build/cjs/multi-select/selection-list.js +10 -18
- package/build/cjs/multi-select-field/__tests__/multi-select-field.test.js +1 -7
- package/build/cjs/multi-select-field/features/accepts_help_text/index.js +0 -1
- package/build/cjs/multi-select-field/features/accepts_label/index.js +0 -1
- package/build/cjs/multi-select-field/features/accepts_validation_text/index.js +0 -1
- package/build/cjs/multi-select-field/features/can_be_required/index.js +0 -1
- package/build/cjs/multi-select-field/features/has_default_clear_text/index.js +0 -1
- package/build/cjs/multi-select-field/features/has_default_empty_text/index.js +0 -1
- package/build/cjs/multi-select-field/features/has_default_filter_nomatch_text/index.js +0 -1
- package/build/cjs/multi-select-field/features/has_default_filter_placeholder/index.js +0 -1
- package/build/cjs/multi-select-field/features/has_default_loading_text/index.js +0 -1
- package/build/cjs/multi-select-field/index.js +0 -1
- package/build/cjs/multi-select-field/multi-select-field.e2e.stories.js +89 -0
- package/build/cjs/multi-select-field/multi-select-field.js +10 -51
- package/build/cjs/multi-select-field/{multi-select-field.stories.js → multi-select-field.prod.stories.js} +31 -39
- package/build/cjs/multi-select-option/index.js +0 -1
- package/build/cjs/multi-select-option/multi-select-option.js +4 -14
- package/build/cjs/select/__tests__/select.test.js +1 -7
- package/build/cjs/select/debounce/debounce.js +1 -8
- package/build/cjs/select/debounce/debounce.spec.js +0 -1
- package/build/cjs/select/empty.js +2 -9
- package/build/cjs/select/filter-input.js +3 -11
- package/build/cjs/select/filterable-menu.js +15 -29
- package/build/cjs/select/index.js +0 -8
- package/build/cjs/select/input-clear-button.js +3 -11
- package/build/cjs/select/input-placeholder.js +2 -11
- package/build/cjs/select/input-prefix.js +2 -11
- package/build/cjs/select/input-wrapper.js +2 -11
- package/build/cjs/select/loading.js +3 -12
- package/build/cjs/select/menu-wrapper.js +4 -13
- package/build/cjs/select/no-match.js +2 -9
- package/build/cjs/select/option-helpers.js +9 -18
- package/build/cjs/select/select.js +23 -69
- package/build/cjs/single-select/__tests__/selection.test.js +7 -18
- package/build/cjs/single-select/__tests__/single-select.test.js +1 -7
- package/build/cjs/single-select/features/accepts_blur_cb/index.js +1 -2
- package/build/cjs/single-select/features/accepts_focus_cb/index.js +1 -2
- package/build/cjs/single-select/features/accepts_initial_focus/index.js +1 -2
- package/build/cjs/single-select/features/accepts_loading/index.js +0 -1
- package/build/cjs/single-select/features/accepts_max_height/index.js +1 -2
- package/build/cjs/single-select/features/accepts_placeholder/index.js +0 -1
- package/build/cjs/single-select/features/accepts_prefix/index.js +0 -1
- package/build/cjs/single-select/features/allows_invalid_options/index.js +0 -1
- package/build/cjs/single-select/features/allows_selecting/index.js +2 -3
- package/build/cjs/single-select/features/can_be_cleared/index.js +1 -2
- package/build/cjs/single-select/features/can_be_disabled/index.js +0 -1
- package/build/cjs/single-select/features/can_be_empty/index.js +0 -1
- package/build/cjs/single-select/features/can_be_filtered/index.js +0 -1
- package/build/cjs/single-select/features/can_be_opened_and_closed/index.js +0 -1
- package/build/cjs/single-select/features/common/index.js +2 -3
- package/build/cjs/single-select/features/duplicate_option_values/index.js +0 -1
- package/build/cjs/single-select/features/menu_width_matches_input/index.js +1 -2
- package/build/cjs/single-select/features/position/index.js +3 -4
- package/build/cjs/single-select/features/shows_selections/index.js +0 -1
- package/build/cjs/single-select/filterable-menu.js +1 -8
- package/build/cjs/single-select/index.js +0 -1
- package/build/cjs/single-select/input.js +6 -19
- package/build/cjs/single-select/menu.js +12 -21
- package/build/cjs/single-select/selection.js +5 -17
- package/build/cjs/single-select/single-select.e2e.stories.js +633 -0
- package/build/cjs/single-select/single-select.js +4 -25
- package/build/cjs/single-select/{single-select.stories.js → single-select.prod.stories.js} +58 -95
- package/build/cjs/single-select-field/__tests__/single-select-field.test.js +1 -7
- package/build/cjs/single-select-field/features/accepts_help_text/index.js +0 -1
- package/build/cjs/single-select-field/features/accepts_label/index.js +0 -1
- package/build/cjs/single-select-field/features/accepts_validation_text/index.js +0 -1
- package/build/cjs/single-select-field/features/can_be_required/index.js +0 -1
- package/build/cjs/single-select-field/features/has_default_clear_text/index.js +0 -1
- package/build/cjs/single-select-field/features/has_default_empty_text/index.js +0 -1
- package/build/cjs/single-select-field/features/has_default_filter_nomatch_text/index.js +0 -1
- package/build/cjs/single-select-field/features/has_default_filter_placeholder/index.js +0 -1
- package/build/cjs/single-select-field/features/has_default_loading_text/index.js +0 -1
- package/build/cjs/single-select-field/index.js +0 -1
- package/build/cjs/single-select-field/single-select-field.e2e.stories.js +89 -0
- package/build/cjs/single-select-field/single-select-field.js +10 -51
- package/build/cjs/single-select-field/{single-select-field.stories.js → single-select-field.prod.stories.js} +31 -39
- package/build/cjs/single-select-option/index.js +0 -1
- package/build/cjs/single-select-option/single-select-option.js +2 -10
- package/build/es/multi-select/__tests__/selection-list.test.js +6 -3
- package/build/es/multi-select/features/accepts_blur_cb/index.js +1 -1
- package/build/es/multi-select/features/accepts_focus_cb/index.js +1 -1
- package/build/es/multi-select/features/accepts_initial_focus/index.js +1 -1
- package/build/es/multi-select/features/accepts_max_height/index.js +1 -1
- package/build/es/multi-select/features/allows_selecting/index.js +2 -2
- package/build/es/multi-select/features/can_be_cleared/index.js +1 -1
- package/build/es/multi-select/features/common/index.js +2 -2
- package/build/es/multi-select/features/menu_width_matches_input/index.js +1 -1
- package/build/es/multi-select/features/position/index.js +4 -4
- package/build/es/multi-select/features/position.feature +0 -1
- package/build/es/multi-select/filterable-menu.js +0 -2
- package/build/es/multi-select/input.js +5 -9
- package/build/es/multi-select/menu.js +15 -17
- package/build/es/multi-select/{multi-select.stories.e2e.js → multi-select.e2e.stories.js} +74 -42
- package/build/es/multi-select/multi-select.js +3 -9
- package/build/es/multi-select/{multi-select.stories.js → multi-select.prod.stories.js} +40 -24
- package/build/es/multi-select/selection-list.js +9 -12
- package/build/es/multi-select-field/{multi-select-field.stories.e2e.js → multi-select-field.e2e.stories.js} +18 -9
- package/build/es/multi-select-field/multi-select-field.js +4 -35
- package/build/es/multi-select-field/{multi-select-field.stories.js → multi-select-field.prod.stories.js} +19 -9
- package/build/es/multi-select-option/multi-select-option.js +3 -5
- package/build/es/select/debounce/debounce.js +1 -6
- package/build/es/select/empty.js +1 -3
- package/build/es/select/filter-input.js +2 -4
- package/build/es/select/filterable-menu.js +12 -15
- package/build/es/select/input-clear-button.js +2 -4
- package/build/es/select/input-placeholder.js +1 -5
- package/build/es/select/input-prefix.js +1 -5
- package/build/es/select/input-wrapper.js +1 -3
- package/build/es/select/loading.js +2 -2
- package/build/es/select/menu-wrapper.js +3 -5
- package/build/es/select/no-match.js +1 -3
- package/build/es/select/option-helpers.js +10 -6
- package/build/es/select/select.js +22 -51
- package/build/es/single-select/__tests__/selection.test.js +6 -3
- package/build/es/single-select/features/accepts_blur_cb/index.js +1 -1
- package/build/es/single-select/features/accepts_focus_cb/index.js +1 -1
- package/build/es/single-select/features/accepts_initial_focus/index.js +1 -1
- package/build/es/single-select/features/accepts_max_height/index.js +1 -1
- package/build/es/single-select/features/allows_selecting/index.js +2 -2
- package/build/es/single-select/features/can_be_cleared/index.js +1 -1
- package/build/es/single-select/features/common/index.js +2 -2
- package/build/es/single-select/features/menu_width_matches_input/index.js +1 -1
- package/build/es/single-select/features/position/index.js +3 -3
- package/build/es/single-select/input.js +5 -9
- package/build/es/single-select/menu.js +11 -15
- package/build/es/single-select/selection.js +4 -9
- package/build/es/single-select/{single-select.stories.e2e.js → single-select.e2e.stories.js} +68 -38
- package/build/es/single-select/single-select.js +3 -13
- package/build/es/single-select/{single-select.stories.js → single-select.prod.stories.js} +37 -24
- package/build/es/single-select-field/{single-select-field.stories.e2e.js → single-select-field.e2e.stories.js} +18 -9
- package/build/es/single-select-field/single-select-field.js +4 -35
- package/build/es/single-select-field/{single-select-field.stories.js → single-select-field.prod.stories.js} +19 -9
- package/build/es/single-select-option/single-select-option.js +1 -3
- package/package.json +18 -18
- package/build/cjs/multi-select/multi-select.stories.e2e.js +0 -618
- package/build/cjs/multi-select-field/multi-select-field.stories.e2e.js +0 -73
- package/build/cjs/single-select/single-select.stories.e2e.js +0 -579
- package/build/cjs/single-select-field/single-select-field.stories.e2e.js +0 -73
|
@@ -29,7 +29,7 @@ Then('the top of the menu is aligned with the bottom of the input', () => {
|
|
|
29
29
|
const $menu = menus[0];
|
|
30
30
|
const selectRect = $select.getBoundingClientRect();
|
|
31
31
|
const menuRect = $menu.getBoundingClientRect();
|
|
32
|
-
expect(menuRect.top).to.
|
|
32
|
+
expect(menuRect.top).to.be.closeTo(selectRect.bottom, 1);
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
Then('the bottom of the menu is aligned with the top of the input', () => {
|
|
@@ -43,7 +43,7 @@ Then('the bottom of the menu is aligned with the top of the input', () => {
|
|
|
43
43
|
const $menu = menus[0];
|
|
44
44
|
const selectRect = $select.getBoundingClientRect();
|
|
45
45
|
const menuRect = $menu.getBoundingClientRect();
|
|
46
|
-
expect(selectRect.top).to.
|
|
46
|
+
expect(selectRect.top).to.be.closeTo(menuRect.bottom, 1);
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
Then('it is rendered on top of the SingleSelect', () => {
|
|
@@ -72,6 +72,6 @@ Then('the left of the SingleSelect is aligned with the left of the anchor', () =
|
|
|
72
72
|
const $menu = menus[0];
|
|
73
73
|
const selectRect = $select.getBoundingClientRect();
|
|
74
74
|
const menuRect = $menu.getBoundingClientRect();
|
|
75
|
-
expect(selectRect.left).to.
|
|
75
|
+
expect(selectRect.left).to.be.closeTo(menuRect.left, 1);
|
|
76
76
|
});
|
|
77
77
|
});
|
|
@@ -6,7 +6,6 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { InputClearButton, InputPlaceholder, InputPrefix } from '../select/index.js';
|
|
8
8
|
import { Selection } from './selection.js';
|
|
9
|
-
|
|
10
9
|
const Input = _ref => {
|
|
11
10
|
let {
|
|
12
11
|
selected,
|
|
@@ -22,7 +21,6 @@ const Input = _ref => {
|
|
|
22
21
|
inputMaxHeight
|
|
23
22
|
} = _ref;
|
|
24
23
|
const hasSelection = selected && typeof selected === 'string';
|
|
25
|
-
|
|
26
24
|
const onClear = e => {
|
|
27
25
|
const data = {
|
|
28
26
|
selected: ''
|
|
@@ -30,15 +28,14 @@ const Input = _ref => {
|
|
|
30
28
|
e.stopPropagation();
|
|
31
29
|
onChange(data, e);
|
|
32
30
|
};
|
|
33
|
-
|
|
34
31
|
return /*#__PURE__*/React.createElement("div", {
|
|
35
32
|
className: _JSXStyle.dynamic([["2186325794", [colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + (cx('root', className) || "")
|
|
36
33
|
}, /*#__PURE__*/React.createElement(InputPrefix, {
|
|
37
34
|
prefix: prefix,
|
|
38
|
-
dataTest:
|
|
35
|
+
dataTest: `${dataTest}-prefix`
|
|
39
36
|
}), !hasSelection && !prefix && /*#__PURE__*/React.createElement(InputPlaceholder, {
|
|
40
37
|
placeholder: placeholder,
|
|
41
|
-
dataTest:
|
|
38
|
+
dataTest: `${dataTest}-placeholder`
|
|
42
39
|
}), hasSelection && /*#__PURE__*/React.createElement("div", {
|
|
43
40
|
className: _JSXStyle.dynamic([["2186325794", [colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + "root-input"
|
|
44
41
|
}, /*#__PURE__*/React.createElement(Selection, {
|
|
@@ -49,16 +46,15 @@ const Input = _ref => {
|
|
|
49
46
|
}, /*#__PURE__*/React.createElement(InputClearButton, {
|
|
50
47
|
onClear: onClear,
|
|
51
48
|
clearText: clearText,
|
|
52
|
-
dataTest:
|
|
49
|
+
dataTest: `${dataTest}-clear`
|
|
53
50
|
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
54
51
|
id: "2186325794",
|
|
55
52
|
dynamic: [colors.grey900]
|
|
56
|
-
}, [
|
|
53
|
+
}, [`.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:${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-inline-start:auto;}"]), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
57
54
|
id: "1331770409",
|
|
58
55
|
dynamic: [inputMaxHeight]
|
|
59
|
-
}, [
|
|
56
|
+
}, [`.root-input.__jsx-style-dynamic-selector{max-height:${inputMaxHeight};}`]));
|
|
60
57
|
};
|
|
61
|
-
|
|
62
58
|
Input.defaultProps = {
|
|
63
59
|
inputMaxHeight: '100px'
|
|
64
60
|
};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Empty, filterIgnored, checkIfValidOption } from '../select/index.js';
|
|
4
|
-
|
|
5
4
|
const onIgnoredClick = (_, e) => {
|
|
6
5
|
e.stopPropagation();
|
|
7
6
|
e.preventDefault();
|
|
8
7
|
};
|
|
9
|
-
|
|
10
8
|
const Menu = _ref => {
|
|
11
9
|
let {
|
|
12
10
|
options,
|
|
@@ -18,34 +16,32 @@ const Menu = _ref => {
|
|
|
18
16
|
dataTest
|
|
19
17
|
} = _ref;
|
|
20
18
|
const renderedOptions = filterIgnored(options);
|
|
21
|
-
|
|
22
19
|
if (React.Children.count(renderedOptions) === 0) {
|
|
23
20
|
// If it's a string, supply it to our <Empty> component so it looks better
|
|
24
21
|
if (typeof empty === 'string') {
|
|
25
22
|
return /*#__PURE__*/React.createElement(Empty, {
|
|
26
23
|
message: empty,
|
|
27
|
-
dataTest:
|
|
24
|
+
dataTest: `${dataTest}-empty`
|
|
28
25
|
});
|
|
29
|
-
}
|
|
30
|
-
|
|
26
|
+
}
|
|
31
27
|
|
|
28
|
+
// Otherwise just render the supplied markup
|
|
32
29
|
return empty;
|
|
33
30
|
}
|
|
34
|
-
|
|
35
31
|
const children = React.Children.map(options, child => {
|
|
36
|
-
const isValidOption = checkIfValidOption(child);
|
|
32
|
+
const isValidOption = checkIfValidOption(child);
|
|
37
33
|
|
|
34
|
+
// Return early if the child isn't an option, to prevent attaching handlers etc.
|
|
38
35
|
if (!isValidOption) {
|
|
39
36
|
return child;
|
|
40
37
|
}
|
|
41
|
-
|
|
42
38
|
const {
|
|
43
39
|
value,
|
|
44
40
|
disabled: isDisabled
|
|
45
|
-
} = child.props;
|
|
41
|
+
} = child.props;
|
|
46
42
|
|
|
43
|
+
// Active means the option is currently selected
|
|
47
44
|
const isActive = value === selected;
|
|
48
|
-
|
|
49
45
|
const onClick = (_, e) => {
|
|
50
46
|
const data = {
|
|
51
47
|
selected: value
|
|
@@ -54,18 +50,18 @@ const Menu = _ref => {
|
|
|
54
50
|
onChange(data, e);
|
|
55
51
|
handleClose();
|
|
56
52
|
handleFocusInput();
|
|
57
|
-
};
|
|
58
|
-
|
|
53
|
+
};
|
|
59
54
|
|
|
55
|
+
// Clicks on active options or disabled options should be ignored for the single select
|
|
60
56
|
const isIgnored = isActive || isDisabled;
|
|
61
|
-
return /*#__PURE__*/React.cloneElement(child, {
|
|
57
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
58
|
+
...child.props,
|
|
62
59
|
onClick: isIgnored ? onIgnoredClick : onClick,
|
|
63
60
|
active: isActive
|
|
64
61
|
});
|
|
65
62
|
});
|
|
66
63
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
67
64
|
};
|
|
68
|
-
|
|
69
65
|
Menu.defaultProps = {
|
|
70
66
|
empty: ''
|
|
71
67
|
};
|
|
@@ -4,7 +4,6 @@ import cx from 'classnames';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { findOptionChild } from '../select/index.js';
|
|
7
|
-
|
|
8
7
|
const Selection = _ref => {
|
|
9
8
|
let {
|
|
10
9
|
options,
|
|
@@ -13,10 +12,8 @@ const Selection = _ref => {
|
|
|
13
12
|
} = _ref;
|
|
14
13
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
15
14
|
const selectedOption = findOptionChild(selected, options);
|
|
16
|
-
|
|
17
15
|
if (!selectedOption) {
|
|
18
|
-
const message =
|
|
19
|
-
|
|
16
|
+
const message = `There is no option with the value: "${selected}". ` + 'Make sure that the value passed to the selected ' + 'prop matches the value of an existing option.';
|
|
20
17
|
if (isProduction) {
|
|
21
18
|
// Don't crash the app if in production
|
|
22
19
|
console.error(message);
|
|
@@ -25,9 +22,8 @@ const Selection = _ref => {
|
|
|
25
22
|
throw new Error(message);
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
const icon = selectedOption && selectedOption.props.icon;
|
|
26
|
+
// Use the selected value if we do not have a label
|
|
31
27
|
const label = selectedOption ? selectedOption.props.label : selected;
|
|
32
28
|
return /*#__PURE__*/React.createElement("div", {
|
|
33
29
|
className: _JSXStyle.dynamic([["1914911415", [spacers.dp8, spacers.dp16, spacers.dp16]]]) + " " + (cx(className, 'root') || "")
|
|
@@ -36,9 +32,8 @@ const Selection = _ref => {
|
|
|
36
32
|
}, icon), label, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
37
33
|
id: "1914911415",
|
|
38
34
|
dynamic: [spacers.dp8, spacers.dp16, spacers.dp16]
|
|
39
|
-
}, [".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;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}",
|
|
35
|
+
}, [".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;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}", `.root-icon.__jsx-style-dynamic-selector{margin-inline-end:${spacers.dp8};width:${spacers.dp16};height:${spacers.dp16};overflow:hidden;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}`]));
|
|
40
36
|
};
|
|
41
|
-
|
|
42
37
|
Selection.propTypes = {
|
|
43
38
|
className: PropTypes.string,
|
|
44
39
|
options: PropTypes.node,
|
package/build/es/single-select/{single-select.stories.e2e.js → single-select.e2e.stories.js}
RENAMED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
2
|
import { Button } from '@dhis2-ui/button';
|
|
3
3
|
import { Modal, ModalTitle, ModalContent } from '@dhis2-ui/modal';
|
|
4
|
-
import { storiesOf } from '@storybook/react';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
import React, { useState } from 'react';
|
|
7
6
|
import { SingleSelectOption } from '../index.js';
|
|
@@ -9,7 +8,6 @@ import { SingleSelect } from './index.js';
|
|
|
9
8
|
window.onChange = window.Cypress && window.Cypress.cy.stub();
|
|
10
9
|
window.onFocus = window.Cypress && window.Cypress.cy.stub();
|
|
11
10
|
window.onBlur = window.Cypress && window.Cypress.cy.stub();
|
|
12
|
-
|
|
13
11
|
const CustomSingleSelectOption = _ref => {
|
|
14
12
|
let {
|
|
15
13
|
label,
|
|
@@ -19,7 +17,6 @@ const CustomSingleSelectOption = _ref => {
|
|
|
19
17
|
onClick: e => onClick({}, e)
|
|
20
18
|
}, label);
|
|
21
19
|
};
|
|
22
|
-
|
|
23
20
|
CustomSingleSelectOption.propTypes = {
|
|
24
21
|
label: PropTypes.string,
|
|
25
22
|
onClick: PropTypes.func
|
|
@@ -37,7 +34,10 @@ const options = [{
|
|
|
37
34
|
name: 'bar',
|
|
38
35
|
id: '4'
|
|
39
36
|
}];
|
|
40
|
-
|
|
37
|
+
export default {
|
|
38
|
+
title: 'SingleSelect'
|
|
39
|
+
};
|
|
40
|
+
export const WithOptions = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
41
41
|
className: "select"
|
|
42
42
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
43
43
|
value: "1",
|
|
@@ -48,7 +48,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
48
48
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
49
49
|
value: "3",
|
|
50
50
|
label: "option three"
|
|
51
|
-
}))
|
|
51
|
+
}));
|
|
52
|
+
export const WithOptionsAndOnChange = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
52
53
|
className: "select",
|
|
53
54
|
onChange: window.onChange
|
|
54
55
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
@@ -60,7 +61,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
60
61
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
61
62
|
value: "3",
|
|
62
63
|
label: "option three"
|
|
63
|
-
}))
|
|
64
|
+
}));
|
|
65
|
+
export const WithOnFocus = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
64
66
|
className: "select",
|
|
65
67
|
onFocus: window.onFocus
|
|
66
68
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
@@ -72,7 +74,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
72
74
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
73
75
|
value: "3",
|
|
74
76
|
label: "option three"
|
|
75
|
-
}))
|
|
77
|
+
}));
|
|
78
|
+
export const WithOnBlur = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
76
79
|
className: "select",
|
|
77
80
|
onBlur: window.onBlur
|
|
78
81
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
@@ -84,7 +87,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
84
87
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
85
88
|
value: "3",
|
|
86
89
|
label: "option three"
|
|
87
|
-
}))
|
|
90
|
+
}));
|
|
91
|
+
export const WithCustomOptionsAndOnChange = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
88
92
|
className: "select",
|
|
89
93
|
onChange: window.onChange
|
|
90
94
|
}, /*#__PURE__*/React.createElement(CustomSingleSelectOption, {
|
|
@@ -96,7 +100,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
96
100
|
}), /*#__PURE__*/React.createElement(CustomSingleSelectOption, {
|
|
97
101
|
value: "3",
|
|
98
102
|
label: "option three"
|
|
99
|
-
}))
|
|
103
|
+
}));
|
|
104
|
+
export const WithInvalidOptions = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
100
105
|
className: "select"
|
|
101
106
|
}, /*#__PURE__*/React.createElement("div", null, "invalid one"), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
102
107
|
value: "1",
|
|
@@ -107,7 +112,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
107
112
|
}), /*#__PURE__*/React.createElement("div", null, "invalid three"), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
108
113
|
value: "3",
|
|
109
114
|
label: "option three"
|
|
110
|
-
}), null, undefined, false)
|
|
115
|
+
}), null, undefined, false);
|
|
116
|
+
export const WithInvalidFilterableOptions = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
111
117
|
filterable: true,
|
|
112
118
|
className: "select",
|
|
113
119
|
noMatchText: "No match"
|
|
@@ -120,20 +126,25 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
120
126
|
}), /*#__PURE__*/React.createElement("div", null, "invalid three"), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
121
127
|
value: "3",
|
|
122
128
|
label: "option three"
|
|
123
|
-
}))
|
|
129
|
+
}));
|
|
130
|
+
export const WithInitialFocus = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
124
131
|
className: "select",
|
|
125
132
|
initialFocus: true
|
|
126
|
-
})
|
|
133
|
+
});
|
|
134
|
+
export const Empty = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
127
135
|
className: "select"
|
|
128
|
-
})
|
|
136
|
+
});
|
|
137
|
+
export const EmptyWithEmptyText = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
129
138
|
className: "select",
|
|
130
139
|
empty: "Custom empty text"
|
|
131
|
-
})
|
|
140
|
+
});
|
|
141
|
+
export const EmptyWithEmptyComponent = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
132
142
|
className: "select",
|
|
133
143
|
empty: /*#__PURE__*/React.createElement("div", {
|
|
134
144
|
className: "custom-empty"
|
|
135
145
|
}, "Custom empty component")
|
|
136
|
-
})
|
|
146
|
+
});
|
|
147
|
+
export const WithOptionsAndLoading = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
137
148
|
className: "select",
|
|
138
149
|
loading: true
|
|
139
150
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
@@ -145,7 +156,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
145
156
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
146
157
|
value: "3",
|
|
147
158
|
label: "option three"
|
|
148
|
-
}))
|
|
159
|
+
}));
|
|
160
|
+
export const WithOptionsLoadingAndLoadingText = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
149
161
|
className: "select",
|
|
150
162
|
loadingText: "Loading options",
|
|
151
163
|
loading: true
|
|
@@ -158,7 +170,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
158
170
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
159
171
|
value: "3",
|
|
160
172
|
label: "option three"
|
|
161
|
-
}))
|
|
173
|
+
}));
|
|
174
|
+
export const WithMoreThanTenOptions = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
162
175
|
className: "select"
|
|
163
176
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
164
177
|
value: "1",
|
|
@@ -196,7 +209,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
196
209
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
197
210
|
value: "12",
|
|
198
211
|
label: "option twelve"
|
|
199
|
-
}))
|
|
212
|
+
}));
|
|
213
|
+
export const WithMoreThanThreeOptionsAndA100pxMaxHeight = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
200
214
|
className: "select",
|
|
201
215
|
maxHeight: "100px"
|
|
202
216
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
@@ -235,7 +249,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
235
249
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
236
250
|
value: "12",
|
|
237
251
|
label: "option twelve"
|
|
238
|
-
}))
|
|
252
|
+
}));
|
|
253
|
+
export const WithOptionsASelectionAndDisabled = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
239
254
|
disabled: true,
|
|
240
255
|
className: "select",
|
|
241
256
|
selected: "1"
|
|
@@ -248,7 +263,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
248
263
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
249
264
|
value: "3",
|
|
250
265
|
label: "option three"
|
|
251
|
-
}))
|
|
266
|
+
}));
|
|
267
|
+
export const WithOptionsAndDisabled = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
252
268
|
disabled: true,
|
|
253
269
|
className: "select"
|
|
254
270
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
@@ -260,7 +276,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
260
276
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
261
277
|
value: "3",
|
|
262
278
|
label: "option three"
|
|
263
|
-
}))
|
|
279
|
+
}));
|
|
280
|
+
export const WithPrefix = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
264
281
|
className: "select",
|
|
265
282
|
prefix: "Prefix text"
|
|
266
283
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
@@ -272,7 +289,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
272
289
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
273
290
|
value: "3",
|
|
274
291
|
label: "option three"
|
|
275
|
-
}))
|
|
292
|
+
}));
|
|
293
|
+
export const WithPrefixAndSelection = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
276
294
|
className: "select",
|
|
277
295
|
prefix: "Prefix text",
|
|
278
296
|
selected: "1"
|
|
@@ -285,7 +303,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
285
303
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
286
304
|
value: "3",
|
|
287
305
|
label: "option three"
|
|
288
|
-
}))
|
|
306
|
+
}));
|
|
307
|
+
export const WithPlaceholder = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
289
308
|
className: "select",
|
|
290
309
|
placeholder: "Placeholder text"
|
|
291
310
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
@@ -297,7 +316,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
297
316
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
298
317
|
value: "3",
|
|
299
318
|
label: "option three"
|
|
300
|
-
}))
|
|
319
|
+
}));
|
|
320
|
+
export const WithPlaceholderAndSelection = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
301
321
|
className: "select",
|
|
302
322
|
selected: "1",
|
|
303
323
|
placeholder: "Placeholder text"
|
|
@@ -310,7 +330,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
310
330
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
311
331
|
value: "3",
|
|
312
332
|
label: "option three"
|
|
313
|
-
}))
|
|
333
|
+
}));
|
|
334
|
+
export const WithDisabledOptionAndOnChange = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
314
335
|
className: "select",
|
|
315
336
|
onChange: window.onChange
|
|
316
337
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
@@ -326,7 +347,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
326
347
|
value: "4",
|
|
327
348
|
label: "disabled option",
|
|
328
349
|
disabled: true
|
|
329
|
-
}))
|
|
350
|
+
}));
|
|
351
|
+
export const WithOptionsAndASelection = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
330
352
|
className: "select",
|
|
331
353
|
selected: "1"
|
|
332
354
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
@@ -338,7 +360,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
338
360
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
339
361
|
value: "3",
|
|
340
362
|
label: "option three"
|
|
341
|
-
}))
|
|
363
|
+
}));
|
|
364
|
+
export const WithOptionsASelectionAndOnChange = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
342
365
|
className: "select",
|
|
343
366
|
selected: "1",
|
|
344
367
|
onChange: window.onChange
|
|
@@ -351,7 +374,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
351
374
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
352
375
|
value: "3",
|
|
353
376
|
label: "option three"
|
|
354
|
-
}))
|
|
377
|
+
}));
|
|
378
|
+
export const WithClearButtonSelectionAndOnChange = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
355
379
|
clearable: true,
|
|
356
380
|
clearText: "Clear",
|
|
357
381
|
className: "select",
|
|
@@ -366,7 +390,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
366
390
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
367
391
|
value: "3",
|
|
368
392
|
label: "option three"
|
|
369
|
-
}))
|
|
393
|
+
}));
|
|
394
|
+
export const WithFilterField = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
370
395
|
filterable: true,
|
|
371
396
|
noMatchText: "No match found",
|
|
372
397
|
className: "select"
|
|
@@ -379,7 +404,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
379
404
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
380
405
|
value: "3",
|
|
381
406
|
label: "option three"
|
|
382
|
-
}))
|
|
407
|
+
}));
|
|
408
|
+
export const DefaultPosition = () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SingleSelect, {
|
|
383
409
|
className: "select"
|
|
384
410
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
385
411
|
value: "1",
|
|
@@ -418,8 +444,9 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
418
444
|
value: "12",
|
|
419
445
|
label: "option twelve"
|
|
420
446
|
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
421
|
-
id: "
|
|
422
|
-
}, ["#root{margin-bottom:2000px;}"]))
|
|
447
|
+
id: "1438642817"
|
|
448
|
+
}, ["#storybook-root{margin-bottom:2000px;}"]));
|
|
449
|
+
export const FlippedPosition = () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SingleSelect, {
|
|
423
450
|
className: "select"
|
|
424
451
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
425
452
|
value: "1",
|
|
@@ -458,8 +485,9 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
458
485
|
value: "12",
|
|
459
486
|
label: "option twelve"
|
|
460
487
|
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
461
|
-
id: "
|
|
462
|
-
}, ["html,body,#root{position:relative;height:500px;max-height:500px;}", "#root{padding-top:400px !important;}"]))
|
|
488
|
+
id: "979451016"
|
|
489
|
+
}, ["html,body,#storybook-root{position:relative;height:500px;max-height:500px;}", "#storybook-root{padding-top:400px !important;}"]));
|
|
490
|
+
export const ShiftedIntoView = () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SingleSelect, {
|
|
463
491
|
className: "select"
|
|
464
492
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
465
493
|
value: "1",
|
|
@@ -498,8 +526,9 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
498
526
|
value: "12",
|
|
499
527
|
label: "option twelve"
|
|
500
528
|
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
501
|
-
id: "
|
|
502
|
-
}, ["html,body,#root{position:relative;height:300px !important;max-height:300px;}", "#root{padding-top:130px !important;}"]))
|
|
529
|
+
id: "438540012"
|
|
530
|
+
}, ["html,body,#storybook-root{position:relative;height:300px !important;max-height:300px;}", "#storybook-root{padding-top:130px !important;}"]));
|
|
531
|
+
export const WithDuplicateSelectedOptionValues = () => /*#__PURE__*/React.createElement(SingleSelect, {
|
|
503
532
|
className: "select",
|
|
504
533
|
selected: "1"
|
|
505
534
|
}, /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
@@ -514,7 +543,8 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
514
543
|
}), /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
515
544
|
value: "3",
|
|
516
545
|
label: "option three"
|
|
517
|
-
}))
|
|
546
|
+
}));
|
|
547
|
+
export const MenuWidthChanging = () => {
|
|
518
548
|
const [toggle, setToggle] = useState(false);
|
|
519
549
|
return /*#__PURE__*/React.createElement("div", {
|
|
520
550
|
className: "App"
|
|
@@ -560,4 +590,4 @@ storiesOf('SingleSelect', module).add('With options', () => /*#__PURE__*/React.c
|
|
|
560
590
|
}, "Stuff")), /*#__PURE__*/React.createElement(Button, {
|
|
561
591
|
onClick: () => setToggle(!toggle)
|
|
562
592
|
}, "Toggle"))));
|
|
563
|
-
}
|
|
593
|
+
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { StatusIcon } from '@dhis2-ui/status-icon';
|
|
3
2
|
import { requiredIf } from '@dhis2/prop-types';
|
|
4
3
|
import { spacers, sharedPropTypes } from '@dhis2/ui-constants';
|
|
4
|
+
import { StatusIcon } from '@dhis2-ui/status-icon';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { Loading as CommonLoading, Select } from '../select/index.js';
|
|
8
8
|
import { FilterableMenu } from './filterable-menu.js';
|
|
9
9
|
import { Input } from './input.js';
|
|
10
10
|
import { Menu } from './menu.js';
|
|
11
|
-
|
|
12
11
|
const SingleSelect = _ref => {
|
|
13
12
|
let {
|
|
14
13
|
className,
|
|
@@ -80,7 +79,7 @@ const SingleSelect = _ref => {
|
|
|
80
79
|
dense: dense
|
|
81
80
|
}, children, loading && /*#__PURE__*/React.createElement(CommonLoading, {
|
|
82
81
|
message: loadingText,
|
|
83
|
-
dataTest:
|
|
82
|
+
dataTest: `${dataTest}-loading`
|
|
84
83
|
}))), /*#__PURE__*/React.createElement(StatusIcon, {
|
|
85
84
|
error: error,
|
|
86
85
|
valid: valid,
|
|
@@ -88,9 +87,8 @@ const SingleSelect = _ref => {
|
|
|
88
87
|
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
89
88
|
id: "2180377457",
|
|
90
89
|
dynamic: [spacers.dp8]
|
|
91
|
-
}, [
|
|
90
|
+
}, [`.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;}"]));
|
|
92
91
|
};
|
|
93
|
-
|
|
94
92
|
SingleSelect.defaultProps = {
|
|
95
93
|
selected: '',
|
|
96
94
|
dataTest: 'dhis2-uicore-singleselect'
|
|
@@ -98,23 +96,18 @@ SingleSelect.defaultProps = {
|
|
|
98
96
|
SingleSelect.propTypes = {
|
|
99
97
|
children: PropTypes.node,
|
|
100
98
|
className: PropTypes.string,
|
|
101
|
-
|
|
102
99
|
/** Text on button that clears selection. Required if `clearable` prop is true */
|
|
103
100
|
clearText: requiredIf(props => props.clearable, PropTypes.string),
|
|
104
|
-
|
|
105
101
|
/** Adds a button to clear selection */
|
|
106
102
|
clearable: PropTypes.bool,
|
|
107
103
|
dataTest: PropTypes.string,
|
|
108
104
|
dense: PropTypes.bool,
|
|
109
105
|
disabled: PropTypes.bool,
|
|
110
|
-
|
|
111
106
|
/** Text or component to display when there are no options */
|
|
112
107
|
empty: PropTypes.node,
|
|
113
|
-
|
|
114
108
|
/** Applies 'error' appearance for validation feedback. Mutually exclusive with `warning` and `valid` props */
|
|
115
109
|
error: sharedPropTypes.statusPropType,
|
|
116
110
|
filterPlaceholder: PropTypes.string,
|
|
117
|
-
|
|
118
111
|
/** Adds a filter field to add text to filter options */
|
|
119
112
|
filterable: PropTypes.bool,
|
|
120
113
|
initialFocus: PropTypes.bool,
|
|
@@ -122,17 +115,14 @@ SingleSelect.propTypes = {
|
|
|
122
115
|
loading: PropTypes.bool,
|
|
123
116
|
loadingText: PropTypes.string,
|
|
124
117
|
maxHeight: PropTypes.string,
|
|
125
|
-
|
|
126
118
|
/** Text to show when filter returns no results. Required if `filterable` prop is true */
|
|
127
119
|
noMatchText: requiredIf(props => props.filterable, PropTypes.string),
|
|
128
120
|
placeholder: PropTypes.string,
|
|
129
121
|
prefix: PropTypes.string,
|
|
130
122
|
selected: PropTypes.string,
|
|
131
123
|
tabIndex: PropTypes.string,
|
|
132
|
-
|
|
133
124
|
/** Applies 'valid' appearance for validation feedback. Mutually exclusive with `warning` and `error` props */
|
|
134
125
|
valid: sharedPropTypes.statusPropType,
|
|
135
|
-
|
|
136
126
|
/** Applies 'warning' appearance for validation feedback. Mutually exclusive with `valid` and `error` props */
|
|
137
127
|
warning: sharedPropTypes.statusPropType,
|
|
138
128
|
onBlur: PropTypes.func,
|