@dhis2-ui/select 8.1.11 → 8.2.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.
Files changed (71) hide show
  1. package/build/cjs/multi-select/features/menu_width_matches_input/index.js +4 -2
  2. package/build/cjs/multi-select/features/position/index.js +12 -6
  3. package/build/cjs/multi-select/filterable-menu.js +25 -22
  4. package/build/cjs/multi-select/input.js +19 -18
  5. package/build/cjs/multi-select/menu.js +29 -25
  6. package/build/cjs/multi-select/multi-select.js +31 -30
  7. package/build/cjs/multi-select/multi-select.stories.e2e.js +30 -20
  8. package/build/cjs/multi-select/multi-select.stories.js +14 -23
  9. package/build/cjs/multi-select/selection-list.js +43 -37
  10. package/build/cjs/multi-select-field/multi-select-field.stories.js +5 -15
  11. package/build/cjs/multi-select-option/multi-select-option.js +31 -28
  12. package/build/cjs/select/debounce/debounce.js +8 -2
  13. package/build/cjs/select/empty.js +14 -11
  14. package/build/cjs/select/filter-input.js +24 -21
  15. package/build/cjs/select/filterable-menu.js +8 -7
  16. package/build/cjs/select/index.js +24 -24
  17. package/build/cjs/select/input-clear-button.js +16 -13
  18. package/build/cjs/select/input-placeholder.js +8 -6
  19. package/build/cjs/select/input-prefix.js +8 -6
  20. package/build/cjs/select/input-wrapper.js +15 -14
  21. package/build/cjs/select/loading.js +18 -15
  22. package/build/cjs/select/menu-wrapper.js +11 -10
  23. package/build/cjs/select/no-match.js +12 -9
  24. package/build/cjs/select/option-helpers.js +1 -1
  25. package/build/cjs/select/select.js +6 -6
  26. package/build/cjs/single-select/features/menu_width_matches_input/index.js +4 -2
  27. package/build/cjs/single-select/features/position/index.js +8 -4
  28. package/build/cjs/single-select/filterable-menu.js +25 -22
  29. package/build/cjs/single-select/input.js +19 -18
  30. package/build/cjs/single-select/menu.js +11 -10
  31. package/build/cjs/single-select/selection.js +8 -7
  32. package/build/cjs/single-select/single-select.js +31 -30
  33. package/build/cjs/single-select/single-select.stories.e2e.js +26 -17
  34. package/build/cjs/single-select/single-select.stories.js +14 -21
  35. package/build/cjs/single-select-field/single-select-field.stories.js +5 -15
  36. package/build/cjs/single-select-option/single-select-option.js +23 -20
  37. package/build/es/multi-select/features/menu_width_matches_input/index.js +4 -2
  38. package/build/es/multi-select/features/position/index.js +12 -6
  39. package/build/es/multi-select/filterable-menu.js +25 -22
  40. package/build/es/multi-select/input.js +19 -18
  41. package/build/es/multi-select/menu.js +28 -24
  42. package/build/es/multi-select/multi-select.js +31 -30
  43. package/build/es/multi-select/multi-select.stories.e2e.js +30 -20
  44. package/build/es/multi-select/multi-select.stories.js +13 -22
  45. package/build/es/multi-select/selection-list.js +43 -37
  46. package/build/es/multi-select-field/multi-select-field.stories.js +4 -14
  47. package/build/es/multi-select-option/multi-select-option.js +31 -28
  48. package/build/es/select/debounce/debounce.js +8 -2
  49. package/build/es/select/empty.js +14 -11
  50. package/build/es/select/filter-input.js +24 -21
  51. package/build/es/select/filterable-menu.js +8 -7
  52. package/build/es/select/input-clear-button.js +16 -13
  53. package/build/es/select/input-placeholder.js +8 -6
  54. package/build/es/select/input-prefix.js +8 -6
  55. package/build/es/select/input-wrapper.js +15 -14
  56. package/build/es/select/loading.js +18 -15
  57. package/build/es/select/menu-wrapper.js +11 -10
  58. package/build/es/select/no-match.js +12 -9
  59. package/build/es/select/select.js +6 -6
  60. package/build/es/single-select/features/menu_width_matches_input/index.js +4 -2
  61. package/build/es/single-select/features/position/index.js +8 -4
  62. package/build/es/single-select/filterable-menu.js +25 -22
  63. package/build/es/single-select/input.js +19 -18
  64. package/build/es/single-select/menu.js +11 -10
  65. package/build/es/single-select/selection.js +8 -7
  66. package/build/es/single-select/single-select.js +31 -30
  67. package/build/es/single-select/single-select.stories.e2e.js +26 -17
  68. package/build/es/single-select/single-select.stories.js +13 -20
  69. package/build/es/single-select-field/single-select-field.stories.js +4 -14
  70. package/build/es/single-select-option/single-select-option.js +23 -20
  71. package/package.json +14 -14
@@ -3,28 +3,31 @@ import React from 'react';
3
3
  import { FilterableMenu as CommonFilterableMenu } from '../select/index.js';
4
4
  import { Menu } from './menu.js';
5
5
 
6
- const FilterableMenu = ({
7
- dataTest,
8
- options,
9
- onChange,
10
- selected,
11
- empty,
12
- handleClose,
13
- handleFocusInput,
14
- placeholder,
15
- noMatchText
16
- }) => /*#__PURE__*/React.createElement(CommonFilterableMenu, {
17
- dataTest: dataTest,
18
- options: options,
19
- onChange: onChange,
20
- selected: selected,
21
- empty: empty,
22
- handleClose: handleClose,
23
- handleFocusInput: handleFocusInput,
24
- placeholder: placeholder,
25
- noMatchText: noMatchText,
26
- Menu: Menu
27
- });
6
+ const FilterableMenu = _ref => {
7
+ let {
8
+ dataTest,
9
+ options,
10
+ onChange,
11
+ selected,
12
+ empty,
13
+ handleClose,
14
+ handleFocusInput,
15
+ placeholder,
16
+ noMatchText
17
+ } = _ref;
18
+ return /*#__PURE__*/React.createElement(CommonFilterableMenu, {
19
+ dataTest: dataTest,
20
+ options: options,
21
+ onChange: onChange,
22
+ selected: selected,
23
+ empty: empty,
24
+ handleClose: handleClose,
25
+ handleFocusInput: handleFocusInput,
26
+ placeholder: placeholder,
27
+ noMatchText: noMatchText,
28
+ Menu: Menu
29
+ });
30
+ };
28
31
 
29
32
  FilterableMenu.propTypes = {
30
33
  dataTest: PropTypes.string.isRequired,
@@ -7,19 +7,20 @@ import React from 'react';
7
7
  import { InputClearButton, InputPlaceholder, InputPrefix } from '../select/index.js';
8
8
  import { SelectionList } from './selection-list.js';
9
9
 
10
- const Input = ({
11
- selected,
12
- onChange,
13
- clearable,
14
- clearText,
15
- placeholder,
16
- dataTest,
17
- prefix,
18
- options,
19
- className,
20
- disabled,
21
- inputMaxHeight
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.length > 0;
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: `${dataTest}-prefix`
38
+ dataTest: "".concat(dataTest, "-prefix")
38
39
  }), !hasSelection && !prefix && /*#__PURE__*/React.createElement(InputPlaceholder, {
39
40
  placeholder: placeholder,
40
- dataTest: `${dataTest}-placeholder`
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(SelectionList, {
@@ -50,14 +51,14 @@ const Input = ({
50
51
  }, /*#__PURE__*/React.createElement(InputClearButton, {
51
52
  onClear: onClear,
52
53
  clearText: clearText,
53
- dataTest: `${dataTest}-clear`
54
+ dataTest: "".concat(dataTest, "-clear")
54
55
  })), /*#__PURE__*/React.createElement(_JSXStyle, {
55
56
  id: "1360178250",
56
57
  dynamic: [colors.grey900]
57
- }, [`.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-left:auto;margin-right:10px;}"]), /*#__PURE__*/React.createElement(_JSXStyle, {
58
+ }, [".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, {
58
59
  id: "1331770409",
59
60
  dynamic: [inputMaxHeight]
60
- }, [`.root-input.__jsx-style-dynamic-selector{max-height:${inputMaxHeight};}`]));
61
+ }, [".root-input.__jsx-style-dynamic-selector{max-height:".concat(inputMaxHeight, ";}")]));
61
62
  };
62
63
 
63
64
  Input.defaultProps = {
@@ -7,36 +7,40 @@ const onDisabledClick = (_, e) => {
7
7
  e.preventDefault();
8
8
  };
9
9
 
10
- const createHandler = ({
11
- isActive,
12
- onChange,
13
- selected,
14
- value
15
- }) => (_, e) => {
16
- e.stopPropagation(); // If the option is currently selected remove it from the array of selected options
10
+ const createHandler = _ref => {
11
+ let {
12
+ isActive,
13
+ onChange,
14
+ selected,
15
+ value
16
+ } = _ref;
17
+ return (_, e) => {
18
+ e.stopPropagation(); // If the option is currently selected remove it from the array of selected options
19
+
20
+ if (isActive) {
21
+ const filtered = removeOption(value, selected);
22
+ const data = {
23
+ selected: filtered
24
+ };
25
+ return onChange(data, e);
26
+ } // Otherwise, add it to selected
27
+
17
28
 
18
- if (isActive) {
19
- const filtered = removeOption(value, selected);
20
29
  const data = {
21
- selected: filtered
30
+ selected: selected.concat([value])
22
31
  };
23
32
  return onChange(data, e);
24
- } // Otherwise, add it to selected
25
-
26
-
27
- const data = {
28
- selected: selected.concat([value])
29
33
  };
30
- return onChange(data, e);
31
34
  };
32
35
 
33
- const Menu = ({
34
- options,
35
- onChange,
36
- selected,
37
- empty,
38
- dataTest
39
- }) => {
36
+ const Menu = _ref2 => {
37
+ let {
38
+ options,
39
+ onChange,
40
+ selected,
41
+ empty,
42
+ dataTest
43
+ } = _ref2;
40
44
  const renderedOptions = filterIgnored(options);
41
45
 
42
46
  if (React.Children.count(renderedOptions) === 0) {
@@ -44,7 +48,7 @@ const Menu = ({
44
48
  if (typeof empty === 'string') {
45
49
  return /*#__PURE__*/React.createElement(Empty, {
46
50
  message: empty,
47
- dataTest: `${dataTest}-empty`
51
+ dataTest: "".concat(dataTest, "-empty")
48
52
  });
49
53
  } // Otherwise just render the supplied markup
50
54
 
@@ -9,34 +9,35 @@ import { FilterableMenu } from './filterable-menu.js';
9
9
  import { Input } from './input.js';
10
10
  import { Menu } from './menu.js';
11
11
 
12
- const MultiSelect = ({
13
- className,
14
- selected,
15
- tabIndex,
16
- maxHeight,
17
- inputMaxHeight,
18
- onChange,
19
- onFocus,
20
- onBlur,
21
- loading,
22
- error,
23
- warning,
24
- valid,
25
- disabled,
26
- children,
27
- clearable,
28
- clearText,
29
- filterable,
30
- filterPlaceholder,
31
- placeholder,
32
- prefix,
33
- empty,
34
- loadingText,
35
- noMatchText,
36
- initialFocus,
37
- dense,
38
- dataTest
39
- }) => {
12
+ const MultiSelect = _ref => {
13
+ let {
14
+ className,
15
+ selected,
16
+ tabIndex,
17
+ maxHeight,
18
+ inputMaxHeight,
19
+ onChange,
20
+ onFocus,
21
+ onBlur,
22
+ loading,
23
+ error,
24
+ warning,
25
+ valid,
26
+ disabled,
27
+ children,
28
+ clearable,
29
+ clearText,
30
+ filterable,
31
+ filterPlaceholder,
32
+ placeholder,
33
+ prefix,
34
+ empty,
35
+ loadingText,
36
+ noMatchText,
37
+ initialFocus,
38
+ dense,
39
+ dataTest
40
+ } = _ref;
40
41
  // If the select is filterable, use a filterable menu
41
42
  const menu = filterable ? /*#__PURE__*/React.createElement(FilterableMenu, {
42
43
  dataTest: dataTest,
@@ -77,7 +78,7 @@ const MultiSelect = ({
77
78
  dense: dense
78
79
  }, children, loading && /*#__PURE__*/React.createElement(CommonLoading, {
79
80
  message: loadingText,
80
- dataTest: `${dataTest}-loading`
81
+ dataTest: "".concat(dataTest, "-loading")
81
82
  }))), /*#__PURE__*/React.createElement(StatusIcon, {
82
83
  error: error,
83
84
  valid: valid,
@@ -85,7 +86,7 @@ const MultiSelect = ({
85
86
  }), /*#__PURE__*/React.createElement(_JSXStyle, {
86
87
  id: "2180377457",
87
88
  dynamic: [spacers.dp8]
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;}"]));
89
+ }, [".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:".concat(spacers.dp8, ";}"), ".root-input.__jsx-style-dynamic-selector{-webkit-flex:1;-ms-flex:1;flex:1;}"]));
89
90
  };
90
91
 
91
92
  MultiSelect.defaultProps = {
@@ -10,12 +10,15 @@ window.onChange = window.Cypress && window.Cypress.cy.stub();
10
10
  window.onFocus = window.Cypress && window.Cypress.cy.stub();
11
11
  window.onBlur = window.Cypress && window.Cypress.cy.stub();
12
12
 
13
- const CustomMultiSelectOption = ({
14
- label,
15
- onClick
16
- }) => /*#__PURE__*/React.createElement("div", {
17
- onClick: e => onClick({}, e)
18
- }, label);
13
+ const CustomMultiSelectOption = _ref => {
14
+ let {
15
+ label,
16
+ onClick
17
+ } = _ref;
18
+ return /*#__PURE__*/React.createElement("div", {
19
+ onClick: e => onClick({}, e)
20
+ }, label);
21
+ };
19
22
 
20
23
  CustomMultiSelectOption.propTypes = {
21
24
  label: PropTypes.string,
@@ -528,9 +531,10 @@ storiesOf('MultiSelect', module).add('With options', () => /*#__PURE__*/React.cr
528
531
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MultiSelect, {
529
532
  className: "select",
530
533
  selected: values,
531
- onChange: ({
532
- selected
533
- }) => {
534
+ onChange: _ref2 => {
535
+ let {
536
+ selected
537
+ } = _ref2;
534
538
  window.onChange && window.onChange({
535
539
  selected
536
540
  });
@@ -569,17 +573,23 @@ storiesOf('MultiSelect', module).add('With options', () => /*#__PURE__*/React.cr
569
573
  flexGrow: 1
570
574
  }
571
575
  }, /*#__PURE__*/React.createElement(MultiSelect, {
572
- onChange: ({
573
- selected
574
- }) => console.log('size changed to ' + selected)
575
- }, options.map(({
576
- name,
577
- id
578
- }) => /*#__PURE__*/React.createElement(MultiSelectOption, {
579
- key: id,
580
- value: id,
581
- label: name
582
- })))), toggle && /*#__PURE__*/React.createElement("div", {
576
+ onChange: _ref3 => {
577
+ let {
578
+ selected
579
+ } = _ref3;
580
+ return console.log('size changed to ' + selected);
581
+ }
582
+ }, options.map(_ref4 => {
583
+ let {
584
+ name,
585
+ id
586
+ } = _ref4;
587
+ return /*#__PURE__*/React.createElement(MultiSelectOption, {
588
+ key: id,
589
+ value: id,
590
+ label: name
591
+ });
592
+ }))), toggle && /*#__PURE__*/React.createElement("div", {
583
593
  style: {
584
594
  padding: '30px',
585
595
  border: '1px solid green'
@@ -4,35 +4,26 @@ import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
5
  import { MultiSelectOption } from '../index.js';
6
6
  import { MultiSelect } from './index.js';
7
- const description = `
8
- Multiple selection allows the user to select more than one option from the list. Checkboxes are used to highlight the possibility of making more than one selection. Selected options are displayed as chips inside the input. Make sure to communicate clearly to the user if there is a limit to the number of selectable elements.
9
-
10
- Use multiple selection wherever the user needs to make more than one selection. If the multiple selection is complex, requires a defined order or needs to made from different groups, consider using a transfer component instead.
11
-
12
- Read more about using \`Select\` components at [Design System: Select](https://github.com/dhis2/design-system/blob/master/molecules/select.md).
13
-
14
- \`\`\`js
15
- import { MultiSelect, MultiSelectOption } from '@dhis2/ui'
16
- \`\`\`
17
-
18
- _**Note:** Due to demo limitations on this page, only one representative example is rendered here. For more (props-interactive) examples, see individual stories in the 'Canvas' tab._
19
- `;
7
+ const description = "\nMultiple selection allows the user to select more than one option from the list. Checkboxes are used to highlight the possibility of making more than one selection. Selected options are displayed as chips inside the input. Make sure to communicate clearly to the user if there is a limit to the number of selectable elements.\n\nUse multiple selection wherever the user needs to make more than one selection. If the multiple selection is complex, requires a defined order or needs to made from different groups, consider using a transfer component instead.\n\nRead more about using `Select` components at [Design System: Select](https://github.com/dhis2/design-system/blob/master/molecules/select.md).\n\n```js\nimport { MultiSelect, MultiSelectOption } from '@dhis2/ui'\n```\n\n_**Note:** Due to demo limitations on this page, only one representative example is rendered here. For more (props-interactive) examples, see individual stories in the 'Canvas' tab._\n";
20
8
 
21
9
  const eventHandler = handlerName => (payload, event) => {
22
- console.log(`${handlerName} payload`, payload);
23
- console.log(`${handlerName} event`, event);
10
+ console.log("".concat(handlerName, " payload"), payload);
11
+ console.log("".concat(handlerName, " event"), event);
24
12
  };
25
13
 
26
14
  const onChange = eventHandler('onChange');
27
15
  const onFocus = eventHandler('onFocus');
28
16
  const onBlur = eventHandler('onBlur');
29
17
 
30
- const CustomMultiSelectOption = ({
31
- label,
32
- onClick
33
- }) => /*#__PURE__*/React.createElement("div", {
34
- onClick: e => onClick({}, e)
35
- }, label);
18
+ const CustomMultiSelectOption = _ref => {
19
+ let {
20
+ label,
21
+ onClick
22
+ } = _ref;
23
+ return /*#__PURE__*/React.createElement("div", {
24
+ onClick: e => onClick({}, e)
25
+ }, label);
26
+ };
36
27
 
37
28
  CustomMultiSelectOption.propTypes = {
38
29
  label: PropTypes.string,
@@ -49,7 +40,7 @@ const requiredIfArgType = {
49
40
  }
50
41
  };
51
42
  export default {
52
- title: 'Forms/Multi Select/Multi Select',
43
+ title: 'Multi Select',
53
44
  component: MultiSelect,
54
45
  parameters: {
55
46
  docs: {
@@ -3,50 +3,56 @@ import PropTypes from 'prop-types';
3
3
  import React from 'react';
4
4
  import { removeOption, findOptionChild } from '../select/index.js';
5
5
 
6
- const createRemoveHandler = ({
7
- selected,
8
- onChange,
9
- value
10
- }) => (_, e) => {
11
- const filtered = removeOption(value, selected);
12
- const data = {
13
- selected: filtered
6
+ const createRemoveHandler = _ref => {
7
+ let {
8
+ selected,
9
+ onChange,
10
+ value
11
+ } = _ref;
12
+ return (_, e) => {
13
+ const filtered = removeOption(value, selected);
14
+ const data = {
15
+ selected: filtered
16
+ };
17
+ onChange(data, e);
14
18
  };
15
- onChange(data, e);
16
19
  };
17
20
 
18
- const SelectionList = ({
19
- selected,
20
- onChange,
21
- disabled,
22
- options
23
- }) => /*#__PURE__*/React.createElement(React.Fragment, null, selected.map(value => {
24
- const selectedOption = findOptionChild(value, options);
21
+ const SelectionList = _ref2 => {
22
+ let {
23
+ selected,
24
+ onChange,
25
+ disabled,
26
+ options
27
+ } = _ref2;
28
+ return /*#__PURE__*/React.createElement(React.Fragment, null, selected.map(value => {
29
+ const selectedOption = findOptionChild(value, options);
25
30
 
26
- if (!selectedOption) {
27
- const message = `There is no option with the value: "${value}". ` + 'Make sure that all the values passed to the selected ' + 'prop match the value of an existing option.';
28
- throw new Error(message);
29
- } // The chip should be disabled if the option or the select are disabled
31
+ if (!selectedOption) {
32
+ const message = "There is no option with the value: \"".concat(value, "\". ") + 'Make sure that all the values passed to the selected ' + 'prop match the value of an existing option.';
33
+ throw new Error(message);
34
+ } // The chip should be disabled if the option or the select are disabled
30
35
 
31
36
 
32
- const isDisabled = selectedOption.props.disabled || disabled; // Create an onRemove handler, but only if it's not disabled
37
+ const isDisabled = selectedOption.props.disabled || disabled; // Create an onRemove handler, but only if it's not disabled
33
38
 
34
- const onRemove = isDisabled ? undefined : createRemoveHandler({
35
- selected,
36
- onChange,
37
- value
38
- });
39
- return /*#__PURE__*/React.createElement(Chip, {
40
- key: value,
41
- onRemove: onRemove,
42
- disabled: isDisabled,
43
- marginBottom: "0",
44
- marginLeft: "0",
45
- marginTop: "0",
46
- overflow: true,
47
- dense: true
48
- }, selectedOption.props.label);
49
- }));
39
+ const onRemove = isDisabled ? undefined : createRemoveHandler({
40
+ selected,
41
+ onChange,
42
+ value
43
+ });
44
+ return /*#__PURE__*/React.createElement(Chip, {
45
+ key: value,
46
+ onRemove: onRemove,
47
+ disabled: isDisabled,
48
+ marginBottom: "0",
49
+ marginLeft: "0",
50
+ marginTop: "0",
51
+ overflow: true,
52
+ dense: true
53
+ }, selectedOption.props.label);
54
+ }));
55
+ };
50
56
 
51
57
  SelectionList.propTypes = {
52
58
  disabled: PropTypes.bool,
@@ -2,19 +2,9 @@ import { sharedPropTypes } from '@dhis2/ui-constants';
2
2
  import React from 'react';
3
3
  import { MultiSelectOption } from '../index.js';
4
4
  import { MultiSelectField } from './index.js';
5
- const description = `
6
- \`MultiSelectField\` is a wrapper around a \`MultiSelect\` component that adds a label, help text, validation text, and other features.
5
+ const description = "\n`MultiSelectField` is a wrapper around a `MultiSelect` component that adds a label, help text, validation text, and other features.\n\nSee the MultiSelect for more information, and read more at [Design System: Select](https://github.com/dhis2/design-system/blob/master/molecules/select.md#multiple-selection).\n\n```js\nimport { MultiSelectField, MultiSelectOption } from '@dhis2/ui'\n```\n\n_**Note**: The dropdowns in some of the following stories won't appear correctly on this page. View these demos in the 'Canvas' tab._\n";
7
6
 
8
- See the MultiSelect for more information, and read more at [Design System: Select](https://github.com/dhis2/design-system/blob/master/molecules/select.md#multiple-selection).
9
-
10
- \`\`\`js
11
- import { MultiSelectField, MultiSelectOption } from '@dhis2/ui'
12
- \`\`\`
13
-
14
- _**Note**: The dropdowns in some of the following stories won't appear correctly on this page. View these demos in the 'Canvas' tab._
15
- `;
16
-
17
- const onChange = selected => alert(`Selected changed to: ${JSON.stringify(selected, null, 2)}`);
7
+ const onChange = selected => alert("Selected changed to: ".concat(JSON.stringify(selected, null, 2)));
18
8
 
19
9
  const options = [/*#__PURE__*/React.createElement(MultiSelectOption, {
20
10
  key: "1",
@@ -58,7 +48,7 @@ const options = [/*#__PURE__*/React.createElement(MultiSelectOption, {
58
48
  label: "ten"
59
49
  })];
60
50
  export default {
61
- title: 'Forms/Multi Select/Multi Select Field',
51
+ title: 'Multi Select Field',
62
52
  component: MultiSelectField,
63
53
  subcomponents: {
64
54
  MultiSelectOption
@@ -98,7 +88,7 @@ WithHelpText.args = {
98
88
  WithHelpText.parameters = {
99
89
  docs: {
100
90
  description: {
101
- story: `_**Note**: The dropdowns in the following stories won't appear correctly on this page. View these demos in the 'Canvas' tab._`
91
+ story: "_**Note**: The dropdowns in the following stories won't appear correctly on this page. View these demos in the 'Canvas' tab._"
102
92
  }
103
93
  }
104
94
  };
@@ -11,37 +11,40 @@ const {
11
11
  } = {
12
12
  styles: /*#__PURE__*/React.createElement(_JSXStyle, {
13
13
  id: "2013783366"
14
- }, [`.jsx-2013783366{padding:${spacers.dp8} ${spacers.dp12};}`]),
14
+ }, [".jsx-2013783366{padding:".concat(spacers.dp8, " ").concat(spacers.dp12, ";}")]),
15
15
  className: "jsx-2013783366"
16
16
  };
17
17
 
18
- const MultiSelectOption = ({
19
- label,
20
- active,
21
- disabled,
22
- onClick,
23
- className,
24
- dataTest,
25
- value
26
- }) => /*#__PURE__*/React.createElement("div", {
27
- "data-test": dataTest,
28
- "data-value": value,
29
- "data-label": label,
30
- className: _JSXStyle.dynamic([["3813980210", [colors.grey200]]]) + " " + (cx(className, {
31
- disabled
32
- }) || "")
33
- }, /*#__PURE__*/React.createElement(Checkbox, {
34
- name: label,
35
- className: checkboxClassname,
36
- checked: active,
37
- label: label,
38
- onChange: onClick,
39
- disabled: disabled,
40
- dense: true
41
- }), styles, /*#__PURE__*/React.createElement(_JSXStyle, {
42
- id: "3813980210",
43
- dynamic: [colors.grey200]
44
- }, [`div.__jsx-style-dynamic-selector:hover{background-color:${colors.grey200};}`, "div.disabled.__jsx-style-dynamic-selector:hover{background-color:initial;}"]));
18
+ const MultiSelectOption = _ref => {
19
+ let {
20
+ label,
21
+ active,
22
+ disabled,
23
+ onClick,
24
+ className,
25
+ dataTest,
26
+ value
27
+ } = _ref;
28
+ return /*#__PURE__*/React.createElement("div", {
29
+ "data-test": dataTest,
30
+ "data-value": value,
31
+ "data-label": label,
32
+ className: _JSXStyle.dynamic([["3813980210", [colors.grey200]]]) + " " + (cx(className, {
33
+ disabled
34
+ }) || "")
35
+ }, /*#__PURE__*/React.createElement(Checkbox, {
36
+ name: label,
37
+ className: checkboxClassname,
38
+ checked: active,
39
+ label: label,
40
+ onChange: onClick,
41
+ disabled: disabled,
42
+ dense: true
43
+ }), styles, /*#__PURE__*/React.createElement(_JSXStyle, {
44
+ id: "3813980210",
45
+ dynamic: [colors.grey200]
46
+ }, ["div.__jsx-style-dynamic-selector:hover{background-color:".concat(colors.grey200, ";}"), "div.disabled.__jsx-style-dynamic-selector:hover{background-color:initial;}"]));
47
+ };
45
48
 
46
49
  MultiSelectOption.defaultProps = {
47
50
  dataTest: 'dhis2-uicore-multiselectoption'
@@ -1,3 +1,5 @@
1
+ var _this = this;
2
+
1
3
  /**
2
4
  * Returns a function, that, as long as it continues to be invoked, will not be triggered. The
3
5
  * function will be called after it stops being called for N milliseconds. If `immediate` is
@@ -5,8 +7,12 @@
5
7
  */
6
8
  export const debounce = (func, wait, immediate) => {
7
9
  let timeout;
8
- return (...args) => {
9
- const context = this;
10
+ return function () {
11
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12
+ args[_key] = arguments[_key];
13
+ }
14
+
15
+ const context = _this;
10
16
 
11
17
  const later = () => {
12
18
  timeout = null;