@dhis2-ui/select 10.16.3-alpha.1 → 10.16.4

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 (168) hide show
  1. package/build/cjs/locales/index.js +94 -57
  2. package/build/cjs/multi-select/features/menu_width_matches_input/index.js +2 -4
  3. package/build/cjs/multi-select/features/position/index.js +6 -12
  4. package/build/cjs/multi-select/filterable-menu.js +22 -25
  5. package/build/cjs/multi-select/input.js +14 -15
  6. package/build/cjs/multi-select/menu.js +24 -28
  7. package/build/cjs/multi-select/multi-select.e2e.stories.js +21 -32
  8. package/build/cjs/multi-select/multi-select.js +30 -31
  9. package/build/cjs/multi-select/multi-select.prod.stories.js +13 -21
  10. package/build/cjs/multi-select/selection-list.js +51 -57
  11. package/build/cjs/multi-select-option/multi-select-option.js +27 -30
  12. package/build/cjs/select/debounce/debounce.js +2 -6
  13. package/build/cjs/select/empty.js +11 -14
  14. package/build/cjs/select/filter-input.js +21 -24
  15. package/build/cjs/select/filterable-menu.js +6 -8
  16. package/build/cjs/select/input-clear-button.js +28 -31
  17. package/build/cjs/select/input-placeholder.js +5 -6
  18. package/build/cjs/select/input-prefix.js +5 -6
  19. package/build/cjs/select/input-wrapper.js +13 -14
  20. package/build/cjs/select/loading.js +15 -18
  21. package/build/cjs/select/menu-wrapper.js +8 -9
  22. package/build/cjs/select/no-match.js +9 -12
  23. package/build/cjs/select/select.js +3 -4
  24. package/build/cjs/simple-single-select/__stories__/DefaultPosition.js +1 -2
  25. package/build/cjs/simple-single-select/__stories__/Dense.js +1 -2
  26. package/build/cjs/simple-single-select/__stories__/Empty.js +1 -2
  27. package/build/cjs/simple-single-select/__stories__/EmptyWithEmptyNode.js +1 -2
  28. package/build/cjs/simple-single-select/__stories__/EmptyWithEmptyText.js +1 -2
  29. package/build/cjs/simple-single-select/__stories__/FlippedPosition.js +1 -2
  30. package/build/cjs/simple-single-select/__stories__/InfiniteLoading.js +1 -2
  31. package/build/cjs/simple-single-select/__stories__/ShiftedIntoView.js +1 -2
  32. package/build/cjs/simple-single-select/__stories__/WithClearButton.js +1 -2
  33. package/build/cjs/simple-single-select/__stories__/WithCustomLowMaxHeight.js +1 -2
  34. package/build/cjs/simple-single-select/__stories__/WithCustomOptions.js +17 -21
  35. package/build/cjs/simple-single-select/__stories__/WithDisabledOption.js +1 -2
  36. package/build/cjs/simple-single-select/__stories__/WithFilterField.js +5 -9
  37. package/build/cjs/simple-single-select/__stories__/WithInitialFocus.js +1 -2
  38. package/build/cjs/simple-single-select/__stories__/WithManyOptions.js +1 -2
  39. package/build/cjs/simple-single-select/__stories__/WithMultipleSelectsAndScrollableParent.js +1 -2
  40. package/build/cjs/simple-single-select/__stories__/WithNoMatchText.js +1 -2
  41. package/build/cjs/simple-single-select/__stories__/WithOnBlur.js +1 -2
  42. package/build/cjs/simple-single-select/__stories__/WithOnFocus.js +1 -2
  43. package/build/cjs/simple-single-select/__stories__/WithOptionsAndDisabled.js +1 -2
  44. package/build/cjs/simple-single-select/__stories__/WithOptionsAndLoading.js +1 -2
  45. package/build/cjs/simple-single-select/__stories__/WithOptionsAndLoadingText.js +1 -2
  46. package/build/cjs/simple-single-select/__stories__/WithPlaceholder.js +1 -2
  47. package/build/cjs/simple-single-select/__stories__/WithPlaceholderAndSelection.js +1 -2
  48. package/build/cjs/simple-single-select/__stories__/WithPrefix.js +1 -2
  49. package/build/cjs/simple-single-select/__stories__/WithPrefixAndSelection.js +1 -2
  50. package/build/cjs/simple-single-select/__stories__/WithRTL.js +1 -2
  51. package/build/cjs/simple-single-select/__stories__/WithScrollingParent.js +1 -2
  52. package/build/cjs/simple-single-select/__stories__/WithSelection.js +1 -2
  53. package/build/cjs/simple-single-select/__stories__/WithSelectionAndDisabled.js +1 -2
  54. package/build/cjs/simple-single-select/__stories__/WithServerSideFilteringDemo.js +25 -36
  55. package/build/cjs/simple-single-select/__stories__/WithSimpleFilteringDemo.js +4 -6
  56. package/build/cjs/simple-single-select/__stories__/WithoutOptionsAndLoading.js +1 -2
  57. package/build/cjs/simple-single-select/__stories__/WithoutSelection.js +1 -2
  58. package/build/cjs/simple-single-select/__stories__/simple-single-select-server-side-filtering/CustomDataProvider.js +19 -26
  59. package/build/cjs/simple-single-select/features/keyboard-interactions.test.e2e.js +9 -18
  60. package/build/cjs/simple-single-select/features/menu-positioning.test.e2e.js +8 -16
  61. package/build/cjs/simple-single-select/menu/empty.js +8 -11
  62. package/build/cjs/simple-single-select/menu/filter.js +11 -12
  63. package/build/cjs/simple-single-select/menu/loading.js +3 -4
  64. package/build/cjs/simple-single-select/menu/menu.js +26 -28
  65. package/build/cjs/simple-single-select/menu/no-match.js +9 -12
  66. package/build/cjs/simple-single-select/menu/option.js +20 -23
  67. package/build/cjs/simple-single-select/menu/options-list.js +23 -26
  68. package/build/cjs/simple-single-select/selected-value/clear-button.js +5 -6
  69. package/build/cjs/simple-single-select/selected-value/container.js +23 -25
  70. package/build/cjs/simple-single-select/selected-value/placeholder.js +5 -6
  71. package/build/cjs/simple-single-select/selected-value/prefix.js +5 -6
  72. package/build/cjs/simple-single-select/selected-value/selected-value.js +34 -35
  73. package/build/cjs/simple-single-select/simple-single-select.e2e.stories.js +1 -2
  74. package/build/cjs/simple-single-select/simple-single-select.js +47 -50
  75. package/build/cjs/simple-single-select/simple-single-select.test.js +14 -24
  76. package/build/cjs/simple-single-select/use-handle-key-press/use-focus-option.js +5 -6
  77. package/build/cjs/simple-single-select/use-handle-key-press/use-handle-key-press-on-combobox.js +31 -34
  78. package/build/cjs/simple-single-select/use-handle-key-press/use-handle-key-press-on-filter-input.js +11 -12
  79. package/build/cjs/simple-single-select/use-handle-key-press/use-handle-typing.js +10 -14
  80. package/build/cjs/simple-single-select/use-handle-key-press/use-highlight-first-option-on-previous-page.js +6 -7
  81. package/build/cjs/simple-single-select/use-handle-key-press/use-highlight-first-visible-option.js +5 -6
  82. package/build/cjs/simple-single-select/use-handle-key-press/use-highlight-last-option-on-next-page.js +6 -7
  83. package/build/cjs/simple-single-select/use-handle-key-press/use-highlight-last-visible-option.js +5 -6
  84. package/build/cjs/simple-single-select/use-handle-key-press/use-page-down.js +6 -7
  85. package/build/cjs/simple-single-select/use-handle-key-press/use-page-up.js +6 -7
  86. package/build/cjs/simple-single-select/use-handle-key-press/utils.js +17 -22
  87. package/build/cjs/simple-single-select-field/simple-single-select-field.js +3 -6
  88. package/build/cjs/simple-single-select-field/simple-single-select-field.prod.stories.js +1 -2
  89. package/build/cjs/simple-single-select-field/simple-single-select-field.test.js +3 -6
  90. package/build/cjs/single-select/features/menu_width_matches_input/index.js +2 -4
  91. package/build/cjs/single-select/features/position/index.js +4 -8
  92. package/build/cjs/single-select/filterable-menu.js +22 -25
  93. package/build/cjs/single-select/input.js +13 -14
  94. package/build/cjs/single-select/menu.js +9 -10
  95. package/build/cjs/single-select/selection.js +5 -6
  96. package/build/cjs/single-select/single-select.e2e.stories.js +18 -28
  97. package/build/cjs/single-select/single-select.js +29 -30
  98. package/build/cjs/single-select/single-select.prod.stories.js +7 -11
  99. package/build/cjs/single-select-option/single-select-option.js +25 -28
  100. package/build/es/locales/index.js +70 -33
  101. package/build/es/multi-select/features/menu_width_matches_input/index.js +2 -4
  102. package/build/es/multi-select/features/position/index.js +6 -12
  103. package/build/es/multi-select/filterable-menu.js +22 -25
  104. package/build/es/multi-select/input.js +14 -15
  105. package/build/es/multi-select/menu.js +24 -28
  106. package/build/es/multi-select/multi-select.e2e.stories.js +20 -30
  107. package/build/es/multi-select/multi-select.js +30 -31
  108. package/build/es/multi-select/multi-select.prod.stories.js +12 -19
  109. package/build/es/multi-select/selection-list.js +51 -57
  110. package/build/es/multi-select-option/multi-select-option.js +27 -30
  111. package/build/es/select/debounce/debounce.js +2 -6
  112. package/build/es/select/empty.js +11 -14
  113. package/build/es/select/filter-input.js +21 -24
  114. package/build/es/select/filterable-menu.js +5 -6
  115. package/build/es/select/input-clear-button.js +28 -31
  116. package/build/es/select/input-placeholder.js +5 -6
  117. package/build/es/select/input-prefix.js +5 -6
  118. package/build/es/select/input-wrapper.js +13 -14
  119. package/build/es/select/loading.js +15 -18
  120. package/build/es/select/menu-wrapper.js +8 -9
  121. package/build/es/select/no-match.js +9 -12
  122. package/build/es/select/select.js +2 -2
  123. package/build/es/simple-single-select/__stories__/WithCustomOptions.js +16 -19
  124. package/build/es/simple-single-select/__stories__/WithFilterField.js +4 -7
  125. package/build/es/simple-single-select/__stories__/WithServerSideFilteringDemo.js +24 -34
  126. package/build/es/simple-single-select/__stories__/WithSimpleFilteringDemo.js +3 -4
  127. package/build/es/simple-single-select/__stories__/simple-single-select-server-side-filtering/CustomDataProvider.js +19 -26
  128. package/build/es/simple-single-select/features/keyboard-interactions.test.e2e.js +9 -18
  129. package/build/es/simple-single-select/features/menu-positioning.test.e2e.js +8 -16
  130. package/build/es/simple-single-select/menu/empty.js +8 -11
  131. package/build/es/simple-single-select/menu/filter.js +11 -12
  132. package/build/es/simple-single-select/menu/loading.js +3 -4
  133. package/build/es/simple-single-select/menu/menu.js +25 -26
  134. package/build/es/simple-single-select/menu/no-match.js +9 -12
  135. package/build/es/simple-single-select/menu/option.js +19 -21
  136. package/build/es/simple-single-select/menu/options-list.js +22 -24
  137. package/build/es/simple-single-select/selected-value/clear-button.js +5 -6
  138. package/build/es/simple-single-select/selected-value/container.js +22 -23
  139. package/build/es/simple-single-select/selected-value/placeholder.js +5 -6
  140. package/build/es/simple-single-select/selected-value/prefix.js +5 -6
  141. package/build/es/simple-single-select/selected-value/selected-value.js +34 -35
  142. package/build/es/simple-single-select/simple-single-select.js +46 -48
  143. package/build/es/simple-single-select/simple-single-select.test.js +13 -22
  144. package/build/es/simple-single-select/use-handle-key-press/use-focus-option.js +5 -6
  145. package/build/es/simple-single-select/use-handle-key-press/use-handle-key-press-on-combobox.js +31 -34
  146. package/build/es/simple-single-select/use-handle-key-press/use-handle-key-press-on-filter-input.js +11 -12
  147. package/build/es/simple-single-select/use-handle-key-press/use-handle-typing.js +10 -14
  148. package/build/es/simple-single-select/use-handle-key-press/use-highlight-first-option-on-previous-page.js +6 -7
  149. package/build/es/simple-single-select/use-handle-key-press/use-highlight-first-visible-option.js +5 -6
  150. package/build/es/simple-single-select/use-handle-key-press/use-highlight-last-option-on-next-page.js +6 -7
  151. package/build/es/simple-single-select/use-handle-key-press/use-highlight-last-visible-option.js +5 -6
  152. package/build/es/simple-single-select/use-handle-key-press/use-page-down.js +6 -7
  153. package/build/es/simple-single-select/use-handle-key-press/use-page-up.js +6 -7
  154. package/build/es/simple-single-select/use-handle-key-press/utils.js +17 -22
  155. package/build/es/simple-single-select-field/simple-single-select-field.js +3 -6
  156. package/build/es/simple-single-select-field/simple-single-select-field.test.js +3 -6
  157. package/build/es/single-select/features/menu_width_matches_input/index.js +2 -4
  158. package/build/es/single-select/features/position/index.js +4 -8
  159. package/build/es/single-select/filterable-menu.js +22 -25
  160. package/build/es/single-select/input.js +13 -14
  161. package/build/es/single-select/menu.js +9 -10
  162. package/build/es/single-select/selection.js +5 -6
  163. package/build/es/single-select/single-select.e2e.stories.js +17 -26
  164. package/build/es/single-select/single-select.js +29 -30
  165. package/build/es/single-select/single-select.prod.stories.js +6 -9
  166. package/build/es/single-select-option/single-select-option.js +25 -28
  167. package/package.json +15 -15
  168. package/src/locales/index.js +102 -33
@@ -41,37 +41,74 @@ import viTranslations from './vi/translations.json';
41
41
  import zhTranslations from './zh/translations.json';
42
42
  import zh_CNTranslations from './zh_CN/translations.json';
43
43
  const namespace = 'default';
44
- i18n.addResources('ar', namespace, arTranslations);
45
- i18n.addResources('ar_IQ', namespace, ar_IQTranslations);
46
- i18n.addResources('ckb', namespace, ckbTranslations);
47
- i18n.addResources('cs', namespace, csTranslations);
48
- i18n.addResources('da', namespace, daTranslations);
49
- i18n.addResources('en', namespace, enTranslations);
50
- i18n.addResources('en_US', namespace, en_USTranslations);
51
- i18n.addResources('es', namespace, esTranslations);
52
- i18n.addResources('es_419', namespace, es_419Translations);
53
- i18n.addResources('fr', namespace, frTranslations);
54
- i18n.addResources('hi_IN', namespace, hi_INTranslations);
55
- i18n.addResources('id', namespace, idTranslations);
56
- i18n.addResources('km', namespace, kmTranslations);
57
- i18n.addResources('lo', namespace, loTranslations);
58
- i18n.addResources('my', namespace, myTranslations);
59
- i18n.addResources('nb', namespace, nbTranslations);
60
- i18n.addResources('nl', namespace, nlTranslations);
61
- i18n.addResources('prs', namespace, prsTranslations);
62
- i18n.addResources('ps', namespace, psTranslations);
63
- i18n.addResources('pt', namespace, ptTranslations);
64
- i18n.addResources('pt_BR', namespace, pt_BRTranslations);
65
- i18n.addResources('ru', namespace, ruTranslations);
66
- i18n.addResources('sv', namespace, svTranslations);
67
- i18n.addResources('tet', namespace, tetTranslations);
68
- i18n.addResources('tg', namespace, tgTranslations);
69
- i18n.addResources('uk', namespace, ukTranslations);
70
- i18n.addResources('ur', namespace, urTranslations);
71
- i18n.addResources('uz_Latn', namespace, uz_LatnTranslations);
72
- i18n.addResources('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations);
73
- i18n.addResources('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations);
74
- i18n.addResources('vi', namespace, viTranslations);
75
- i18n.addResources('zh', namespace, zhTranslations);
76
- i18n.addResources('zh_CN', namespace, zh_CNTranslations);
44
+
45
+ // Use 'deep' = true and 'overwrite' = false to add to, but not overwrite,
46
+ // custom translations from the datastore (added by the app adapter)
47
+
48
+ i18n.addResourceBundle('ar', namespace, arTranslations, true, false);
49
+ i18n.addResourceBundle('ar', namespace, arTranslations, true, false);
50
+ i18n.addResourceBundle('ar_IQ', namespace, ar_IQTranslations, true, false);
51
+ i18n.addResourceBundle('ar-IQ', namespace, ar_IQTranslations, true, false);
52
+ i18n.addResourceBundle('ckb', namespace, ckbTranslations, true, false);
53
+ i18n.addResourceBundle('ckb', namespace, ckbTranslations, true, false);
54
+ i18n.addResourceBundle('cs', namespace, csTranslations, true, false);
55
+ i18n.addResourceBundle('cs', namespace, csTranslations, true, false);
56
+ i18n.addResourceBundle('da', namespace, daTranslations, true, false);
57
+ i18n.addResourceBundle('da', namespace, daTranslations, true, false);
58
+ i18n.addResourceBundle('en', namespace, enTranslations, true, false);
59
+ i18n.addResourceBundle('en', namespace, enTranslations, true, false);
60
+ i18n.addResourceBundle('en_US', namespace, en_USTranslations, true, false);
61
+ i18n.addResourceBundle('en-US', namespace, en_USTranslations, true, false);
62
+ i18n.addResourceBundle('es', namespace, esTranslations, true, false);
63
+ i18n.addResourceBundle('es', namespace, esTranslations, true, false);
64
+ i18n.addResourceBundle('es_419', namespace, es_419Translations, true, false);
65
+ i18n.addResourceBundle('es-419', namespace, es_419Translations, true, false);
66
+ i18n.addResourceBundle('fr', namespace, frTranslations, true, false);
67
+ i18n.addResourceBundle('fr', namespace, frTranslations, true, false);
68
+ i18n.addResourceBundle('hi_IN', namespace, hi_INTranslations, true, false);
69
+ i18n.addResourceBundle('hi-IN', namespace, hi_INTranslations, true, false);
70
+ i18n.addResourceBundle('id', namespace, idTranslations, true, false);
71
+ i18n.addResourceBundle('id', namespace, idTranslations, true, false);
72
+ i18n.addResourceBundle('km', namespace, kmTranslations, true, false);
73
+ i18n.addResourceBundle('km', namespace, kmTranslations, true, false);
74
+ i18n.addResourceBundle('lo', namespace, loTranslations, true, false);
75
+ i18n.addResourceBundle('lo', namespace, loTranslations, true, false);
76
+ i18n.addResourceBundle('my', namespace, myTranslations, true, false);
77
+ i18n.addResourceBundle('my', namespace, myTranslations, true, false);
78
+ i18n.addResourceBundle('nb', namespace, nbTranslations, true, false);
79
+ i18n.addResourceBundle('nb', namespace, nbTranslations, true, false);
80
+ i18n.addResourceBundle('nl', namespace, nlTranslations, true, false);
81
+ i18n.addResourceBundle('nl', namespace, nlTranslations, true, false);
82
+ i18n.addResourceBundle('prs', namespace, prsTranslations, true, false);
83
+ i18n.addResourceBundle('prs', namespace, prsTranslations, true, false);
84
+ i18n.addResourceBundle('ps', namespace, psTranslations, true, false);
85
+ i18n.addResourceBundle('ps', namespace, psTranslations, true, false);
86
+ i18n.addResourceBundle('pt', namespace, ptTranslations, true, false);
87
+ i18n.addResourceBundle('pt', namespace, ptTranslations, true, false);
88
+ i18n.addResourceBundle('pt_BR', namespace, pt_BRTranslations, true, false);
89
+ i18n.addResourceBundle('pt-BR', namespace, pt_BRTranslations, true, false);
90
+ i18n.addResourceBundle('ru', namespace, ruTranslations, true, false);
91
+ i18n.addResourceBundle('ru', namespace, ruTranslations, true, false);
92
+ i18n.addResourceBundle('sv', namespace, svTranslations, true, false);
93
+ i18n.addResourceBundle('sv', namespace, svTranslations, true, false);
94
+ i18n.addResourceBundle('tet', namespace, tetTranslations, true, false);
95
+ i18n.addResourceBundle('tet', namespace, tetTranslations, true, false);
96
+ i18n.addResourceBundle('tg', namespace, tgTranslations, true, false);
97
+ i18n.addResourceBundle('tg', namespace, tgTranslations, true, false);
98
+ i18n.addResourceBundle('uk', namespace, ukTranslations, true, false);
99
+ i18n.addResourceBundle('uk', namespace, ukTranslations, true, false);
100
+ i18n.addResourceBundle('ur', namespace, urTranslations, true, false);
101
+ i18n.addResourceBundle('ur', namespace, urTranslations, true, false);
102
+ i18n.addResourceBundle('uz_Latn', namespace, uz_LatnTranslations, true, false);
103
+ i18n.addResourceBundle('uz-Latn', namespace, uz_LatnTranslations, true, false);
104
+ i18n.addResourceBundle('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations, true, false);
105
+ i18n.addResourceBundle('uz-Cyrl-UZ', namespace, uz_UZ_CyrlTranslations, true, false);
106
+ i18n.addResourceBundle('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations, true, false);
107
+ i18n.addResourceBundle('uz-Latn-UZ', namespace, uz_UZ_LatnTranslations, true, false);
108
+ i18n.addResourceBundle('vi', namespace, viTranslations, true, false);
109
+ i18n.addResourceBundle('vi', namespace, viTranslations, true, false);
110
+ i18n.addResourceBundle('zh', namespace, zhTranslations, true, false);
111
+ i18n.addResourceBundle('zh', namespace, zhTranslations, true, false);
112
+ i18n.addResourceBundle('zh_CN', namespace, zh_CNTranslations, true, false);
113
+ i18n.addResourceBundle('zh-CN', namespace, zh_CNTranslations, true, false);
77
114
  export default i18n;
@@ -23,8 +23,7 @@ When('the MultiSelect menu is open', () => {
23
23
  Then('the MultiSelect input is left aligned with the menu', () => {
24
24
  const selectDataTest = '[data-test="dhis2-uicore-multiselect"]';
25
25
  const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
26
- cy.getAll(selectDataTest, menuDataTest).should(_ref => {
27
- let [inputs, menus] = _ref;
26
+ cy.getAll(selectDataTest, menuDataTest).should(([inputs, menus]) => {
28
27
  expect(inputs.length).to.equal(1);
29
28
  expect(menus.length).to.equal(1);
30
29
  const $input = inputs[0];
@@ -37,8 +36,7 @@ Then('the MultiSelect input is left aligned with the menu', () => {
37
36
  When('the MultiSelect input and menu have the same width', () => {
38
37
  const inputSelector = '[data-test="dhis2-uicore-select"]';
39
38
  const menuSelector = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
40
- cy.getAll(inputSelector, menuSelector).should(_ref2 => {
41
- let [$input, $menu] = _ref2;
39
+ cy.getAll(inputSelector, menuSelector).should(([$input, $menu]) => {
42
40
  const inputWidth = Math.round($input.outerWidth());
43
41
  const menuWidth = Math.round($menu.outerWidth());
44
42
  expect(inputWidth).to.equal(menuWidth);
@@ -31,8 +31,7 @@ When('an option is clicked', () => {
31
31
  Then('the Input remains the same height', () => {
32
32
  const emptyInputHeight = '@emptyInputHeight';
33
33
  const inputDataTest = '[data-test="dhis2-uicore-select-input"]';
34
- cy.getAll(emptyInputHeight, inputDataTest).should(_ref => {
35
- let [emptyInputHeight, inputs] = _ref;
34
+ cy.getAll(emptyInputHeight, inputDataTest).should(([emptyInputHeight, inputs]) => {
36
35
  expect(inputs.length).to.equal(1);
37
36
  const $input = inputs[0];
38
37
  const inputRect = $input.getBoundingClientRect();
@@ -42,8 +41,7 @@ Then('the Input remains the same height', () => {
42
41
  Then('the top of the menu is aligned with the bottom of the input', () => {
43
42
  const selectDataTest = '[data-test="dhis2-uicore-multiselect"]';
44
43
  const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
45
- cy.getAll(selectDataTest, menuDataTest).should(_ref2 => {
46
- let [selects, menus] = _ref2;
44
+ cy.getAll(selectDataTest, menuDataTest).should(([selects, menus]) => {
47
45
  expect(selects.length).to.equal(1);
48
46
  expect(menus.length).to.equal(1);
49
47
  const $select = selects[0];
@@ -56,8 +54,7 @@ Then('the top of the menu is aligned with the bottom of the input', () => {
56
54
  Then('the bottom of the menu is aligned with the top of the input', () => {
57
55
  const selectDataTest = '[data-test="dhis2-uicore-multiselect"]';
58
56
  const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
59
- cy.getAll(selectDataTest, menuDataTest).should(_ref3 => {
60
- let [selects, menus] = _ref3;
57
+ cy.getAll(selectDataTest, menuDataTest).should(([selects, menus]) => {
61
58
  expect(selects.length).to.equal(1);
62
59
  expect(menus.length).to.equal(1);
63
60
  const $select = selects[0];
@@ -70,8 +67,7 @@ Then('the bottom of the menu is aligned with the top of the input', () => {
70
67
  Then('it is rendered on top of the MultiSelect', () => {
71
68
  const selectDataTest = '[data-test="dhis2-uicore-multiselect"]';
72
69
  const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
73
- cy.getAll(selectDataTest, menuDataTest).should(_ref4 => {
74
- let [selects, menus] = _ref4;
70
+ cy.getAll(selectDataTest, menuDataTest).should(([selects, menus]) => {
75
71
  expect(selects.length).to.equal(1);
76
72
  expect(menus.length).to.equal(1);
77
73
  const $select = selects[0];
@@ -85,8 +81,7 @@ Then('it is rendered on top of the MultiSelect', () => {
85
81
  Then('the left of the Menu is aligned with the left of the Input', () => {
86
82
  const selectDataTest = '[data-test="dhis2-uicore-multiselect"]';
87
83
  const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
88
- cy.getAll(selectDataTest, menuDataTest).should(_ref5 => {
89
- let [selects, menus] = _ref5;
84
+ cy.getAll(selectDataTest, menuDataTest).should(([selects, menus]) => {
90
85
  expect(selects.length).to.equal(1);
91
86
  expect(menus.length).to.equal(1);
92
87
  const $select = selects[0];
@@ -99,8 +94,7 @@ Then('the left of the Menu is aligned with the left of the Input', () => {
99
94
  Then('the Menu and the Input have an equal width', () => {
100
95
  const inputDataTest = '[data-test="dhis2-uicore-multiselect"] .root-input';
101
96
  const menuDataTest = '[data-test="dhis2-uicore-select-menu-menuwrapper"]';
102
- cy.getAll(inputDataTest, menuDataTest).should(_ref6 => {
103
- let [inputs, menus] = _ref6;
97
+ cy.getAll(inputDataTest, menuDataTest).should(([inputs, menus]) => {
104
98
  expect(inputs.length).to.equal(1);
105
99
  expect(menus.length).to.equal(1);
106
100
  const $input = inputs[0];
@@ -2,31 +2,28 @@ 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
- 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
- };
5
+ const FilterableMenu = ({
6
+ dataTest,
7
+ options,
8
+ onChange,
9
+ selected,
10
+ empty,
11
+ handleClose,
12
+ handleFocusInput,
13
+ placeholder,
14
+ noMatchText
15
+ }) => /*#__PURE__*/React.createElement(CommonFilterableMenu, {
16
+ dataTest: dataTest,
17
+ options: options,
18
+ onChange: onChange,
19
+ selected: selected,
20
+ empty: empty,
21
+ handleClose: handleClose,
22
+ handleFocusInput: handleFocusInput,
23
+ placeholder: placeholder,
24
+ noMatchText: noMatchText,
25
+ Menu: Menu
26
+ });
30
27
  FilterableMenu.propTypes = {
31
28
  dataTest: PropTypes.string.isRequired,
32
29
  noMatchText: PropTypes.string.isRequired,
@@ -7,21 +7,20 @@ import React from 'react';
7
7
  import i18n from '../locales/index.js';
8
8
  import { InputClearButton, InputPlaceholder, InputPrefix } from '../select/index.js';
9
9
  import { SelectionList } from './selection-list.js';
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 = '100px',
23
- collapseSelectionAfter
24
- } = _ref;
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 = '100px',
22
+ collapseSelectionAfter
23
+ }) => {
25
24
  const hasSelection = selected.length > 0;
26
25
  const shouldCollapse = hasSelection && typeof collapseSelectionAfter === 'number' && selected.length > collapseSelectionAfter;
27
26
  const onClear = e => {
@@ -5,40 +5,36 @@ const onDisabledClick = (_, e) => {
5
5
  e.stopPropagation();
6
6
  e.preventDefault();
7
7
  };
8
- const createHandler = _ref => {
9
- let {
10
- isActive,
11
- onChange,
12
- selected,
13
- value
14
- } = _ref;
15
- return (_, e) => {
16
- e.stopPropagation();
17
-
18
- // If the option is currently selected remove it from the array of selected options
19
- if (isActive) {
20
- const filtered = removeOption(value, selected);
21
- const data = {
22
- selected: filtered
23
- };
24
- return onChange(data, e);
25
- }
8
+ const createHandler = ({
9
+ isActive,
10
+ onChange,
11
+ selected,
12
+ value
13
+ }) => (_, e) => {
14
+ e.stopPropagation();
26
15
 
27
- // Otherwise, add it to selected
16
+ // If the option is currently selected remove it from the array of selected options
17
+ if (isActive) {
18
+ const filtered = removeOption(value, selected);
28
19
  const data = {
29
- selected: selected.concat([value])
20
+ selected: filtered
30
21
  };
31
22
  return onChange(data, e);
23
+ }
24
+
25
+ // Otherwise, add it to selected
26
+ const data = {
27
+ selected: selected.concat([value])
32
28
  };
29
+ return onChange(data, e);
33
30
  };
34
- const Menu = _ref2 => {
35
- let {
36
- options,
37
- onChange,
38
- selected,
39
- empty = '',
40
- dataTest
41
- } = _ref2;
31
+ const Menu = ({
32
+ options,
33
+ onChange,
34
+ selected,
35
+ empty = '',
36
+ dataTest
37
+ }) => {
42
38
  const renderedOptions = filterIgnored(options);
43
39
  if (React.Children.count(renderedOptions) === 0) {
44
40
  // If it's a string, supply it to our <Empty> component so it looks better
@@ -8,15 +8,12 @@ import { MultiSelect } from './multi-select.js';
8
8
  window.onChange = window.Cypress && window.Cypress.cy.stub();
9
9
  window.onFocus = window.Cypress && window.Cypress.cy.stub();
10
10
  window.onBlur = window.Cypress && window.Cypress.cy.stub();
11
- const CustomMultiSelectOption = _ref => {
12
- let {
13
- label,
14
- onClick
15
- } = _ref;
16
- return /*#__PURE__*/React.createElement("div", {
17
- onClick: e => onClick({}, e)
18
- }, label);
19
- };
11
+ const CustomMultiSelectOption = ({
12
+ label,
13
+ onClick
14
+ }) => /*#__PURE__*/React.createElement("div", {
15
+ onClick: e => onClick({}, e)
16
+ }, label);
20
17
  CustomMultiSelectOption.propTypes = {
21
18
  label: PropTypes.string,
22
19
  onClick: PropTypes.func
@@ -562,10 +559,9 @@ export const WithOptionsThatCanBeAddedToTheInput = () => {
562
559
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MultiSelect, {
563
560
  className: "select",
564
561
  selected: values,
565
- onChange: _ref2 => {
566
- let {
567
- selected
568
- } = _ref2;
562
+ onChange: ({
563
+ selected
564
+ }) => {
569
565
  window.onChange && window.onChange({
570
566
  selected
571
567
  });
@@ -605,23 +601,17 @@ export const MenuWidthChanging = () => {
605
601
  flexGrow: 1
606
602
  }
607
603
  }, /*#__PURE__*/React.createElement(MultiSelect, {
608
- onChange: _ref3 => {
609
- let {
610
- selected
611
- } = _ref3;
612
- return console.log('size changed to ' + selected);
613
- }
614
- }, options.map(_ref4 => {
615
- let {
616
- name,
617
- id
618
- } = _ref4;
619
- return /*#__PURE__*/React.createElement(MultiSelectOption, {
620
- key: id,
621
- value: id,
622
- label: name
623
- });
624
- }))), toggle && /*#__PURE__*/React.createElement("div", {
604
+ onChange: ({
605
+ selected
606
+ }) => console.log('size changed to ' + selected)
607
+ }, options.map(({
608
+ name,
609
+ id
610
+ }) => /*#__PURE__*/React.createElement(MultiSelectOption, {
611
+ key: id,
612
+ value: id,
613
+ label: name
614
+ })))), toggle && /*#__PURE__*/React.createElement("div", {
625
615
  style: {
626
616
  padding: '30px',
627
617
  border: '1px solid green'
@@ -11,37 +11,36 @@ import { Menu } from './menu.js';
11
11
 
12
12
  // stable object reference
13
13
  const staticArr = [];
14
- const MultiSelect = _ref => {
15
- let {
16
- className,
17
- selected = staticArr,
18
- tabIndex,
19
- maxHeight,
20
- inputMaxHeight,
21
- onChange,
22
- onFocus,
23
- onKeyDown,
24
- onBlur,
25
- loading,
26
- error,
27
- warning,
28
- valid,
29
- disabled,
30
- children,
31
- clearable,
32
- clearText,
33
- filterable,
34
- filterPlaceholder,
35
- placeholder,
36
- prefix,
37
- empty,
38
- loadingText,
39
- noMatchText,
40
- initialFocus,
41
- dense,
42
- collapseSelectionAfter,
43
- dataTest = 'dhis2-uicore-multiselect'
44
- } = _ref;
14
+ const MultiSelect = ({
15
+ className,
16
+ selected = staticArr,
17
+ tabIndex,
18
+ maxHeight,
19
+ inputMaxHeight,
20
+ onChange,
21
+ onFocus,
22
+ onKeyDown,
23
+ onBlur,
24
+ loading,
25
+ error,
26
+ warning,
27
+ valid,
28
+ disabled,
29
+ children,
30
+ clearable,
31
+ clearText,
32
+ filterable,
33
+ filterPlaceholder,
34
+ placeholder,
35
+ prefix,
36
+ empty,
37
+ loadingText,
38
+ noMatchText,
39
+ initialFocus,
40
+ dense,
41
+ collapseSelectionAfter,
42
+ dataTest = 'dhis2-uicore-multiselect'
43
+ }) => {
45
44
  // If the select is filterable, use a filterable menu
46
45
  const menu = filterable ? /*#__PURE__*/React.createElement(FilterableMenu, {
47
46
  dataTest: dataTest,
@@ -24,15 +24,12 @@ const eventHandler = handlerName => (payload, event) => {
24
24
  const onChange = eventHandler('onChange');
25
25
  const onFocus = eventHandler('onFocus');
26
26
  const onBlur = eventHandler('onBlur');
27
- const CustomMultiSelectOption = _ref => {
28
- let {
29
- label,
30
- onClick
31
- } = _ref;
32
- return /*#__PURE__*/React.createElement("div", {
33
- onClick: e => onClick({}, e)
34
- }, label);
35
- };
27
+ const CustomMultiSelectOption = ({
28
+ label,
29
+ onClick
30
+ }) => /*#__PURE__*/React.createElement("div", {
31
+ onClick: e => onClick({}, e)
32
+ }, label);
36
33
  CustomMultiSelectOption.propTypes = {
37
34
  label: PropTypes.string,
38
35
  onClick: PropTypes.func
@@ -333,10 +330,9 @@ export const WithMultipleSelectionsWrapped = () => {
333
330
  }, /*#__PURE__*/React.createElement(MultiSelect, {
334
331
  className: "select",
335
332
  selected: selected,
336
- onChange: _ref2 => {
337
- let {
338
- selected
339
- } = _ref2;
333
+ onChange: ({
334
+ selected
335
+ }) => {
340
336
  console.log({
341
337
  selected
342
338
  });
@@ -503,12 +499,9 @@ export const CollapseSelectionAfterThreshold = () => {
503
499
  }, /*#__PURE__*/React.createElement(MultiSelect, {
504
500
  className: "select",
505
501
  selected: selected,
506
- onChange: _ref3 => {
507
- let {
508
- selected
509
- } = _ref3;
510
- return setSelected(selected);
511
- },
502
+ onChange: ({
503
+ selected
504
+ }) => setSelected(selected),
512
505
  collapseSelectionAfter: 2,
513
506
  prefix: "Prefix text",
514
507
  clearable: true,