@salutejs/plasma-hope 1.387.0 → 1.387.1-dev.0

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 (229) hide show
  1. package/components/Button/views/b2c/ButtonB2C.d.ts +1 -1
  2. package/components/Button/views/web/ButtonWeb.d.ts +1 -1
  3. package/components/Card/CardBadge.d.ts +12 -1
  4. package/components/Card/CardBadge.d.ts.map +1 -1
  5. package/components/Card/CardBadge.js +19 -4
  6. package/components/PreviewGallery/PreviewGalleryItemBase.d.ts +1 -1
  7. package/components/PreviewGallery/PreviewGalleryItemBase.d.ts.map +1 -1
  8. package/components/PreviewGallery/PreviewGalleryItemBase.js +1 -2
  9. package/components/Upload/UploadMessage.d.ts.map +1 -1
  10. package/components/Upload/UploadMessage.js +2 -2
  11. package/es/components/Card/CardBadge.js +17 -3
  12. package/es/components/PreviewGallery/PreviewGalleryItemBase.js +1 -2
  13. package/es/components/Upload/UploadMessage.js +1 -1
  14. package/es/index.js +0 -10
  15. package/index.d.ts +0 -10
  16. package/index.js +0 -110
  17. package/package.json +11 -11
  18. package/components/Badge/Badge.d.ts +0 -21
  19. package/components/Badge/Badge.d.ts.map +0 -1
  20. package/components/Badge/Badge.js +0 -30
  21. package/components/Badge/index.d.ts +0 -5
  22. package/components/Badge/index.d.ts.map +0 -1
  23. package/components/Badge/index.js +0 -25
  24. package/components/Cell/Cell.d.ts +0 -18
  25. package/components/Cell/Cell.d.ts.map +0 -1
  26. package/components/Cell/Cell.js +0 -32
  27. package/components/Cell/index.d.ts +0 -3
  28. package/components/Cell/index.d.ts.map +0 -1
  29. package/components/Cell/index.js +0 -12
  30. package/components/Dropdown/Dropdown.component-test.js +0 -547
  31. package/components/Dropdown/Dropdown.d.ts +0 -20
  32. package/components/Dropdown/Dropdown.d.ts.map +0 -1
  33. package/components/Dropdown/Dropdown.js +0 -64
  34. package/components/Dropdown/Dropdown.types.d.ts +0 -16
  35. package/components/Dropdown/Dropdown.types.d.ts.map +0 -1
  36. package/components/Dropdown/Dropdown.types.js +0 -7
  37. package/components/Dropdown/DropdownItem.d.ts +0 -30
  38. package/components/Dropdown/DropdownItem.d.ts.map +0 -1
  39. package/components/Dropdown/DropdownItem.js +0 -122
  40. package/components/Dropdown/DropdownList.d.ts +0 -22
  41. package/components/Dropdown/DropdownList.d.ts.map +0 -1
  42. package/components/Dropdown/DropdownList.js +0 -23
  43. package/components/Dropdown/DropdownMenu.d.ts +0 -30
  44. package/components/Dropdown/DropdownMenu.d.ts.map +0 -1
  45. package/components/Dropdown/DropdownMenu.js +0 -60
  46. package/components/Dropdown/DropdownPopup.d.ts +0 -18
  47. package/components/Dropdown/DropdownPopup.d.ts.map +0 -1
  48. package/components/Dropdown/DropdownPopup.js +0 -47
  49. package/components/Dropdown/DropdownUncontrolled.d.ts +0 -12
  50. package/components/Dropdown/DropdownUncontrolled.d.ts.map +0 -1
  51. package/components/Dropdown/DropdownUncontrolled.js +0 -69
  52. package/components/Dropdown/index.d.ts +0 -13
  53. package/components/Dropdown/index.d.ts.map +0 -1
  54. package/components/Dropdown/index.js +0 -53
  55. package/components/Dropdown/keyboardNavigation/index.d.ts +0 -2
  56. package/components/Dropdown/keyboardNavigation/index.d.ts.map +0 -1
  57. package/components/Dropdown/keyboardNavigation/index.js +0 -18
  58. package/components/Dropdown/keyboardNavigation/useKeyboardNavigation.d.ts +0 -20
  59. package/components/Dropdown/keyboardNavigation/useKeyboardNavigation.d.ts.map +0 -1
  60. package/components/Dropdown/keyboardNavigation/useKeyboardNavigation.js +0 -58
  61. package/components/Dropdown/keyboardNavigation/useOnComboType.d.ts +0 -6
  62. package/components/Dropdown/keyboardNavigation/useOnComboType.d.ts.map +0 -1
  63. package/components/Dropdown/keyboardNavigation/useOnComboType.js +0 -30
  64. package/components/Dropdown/keyboardNavigation/useSearchString.d.ts +0 -5
  65. package/components/Dropdown/keyboardNavigation/useSearchString.d.ts.map +0 -1
  66. package/components/Dropdown/keyboardNavigation/useSearchString.js +0 -46
  67. package/components/Dropdown/keyboardNavigation/utils.d.ts +0 -39
  68. package/components/Dropdown/keyboardNavigation/utils.d.ts.map +0 -1
  69. package/components/Dropdown/keyboardNavigation/utils.js +0 -175
  70. package/components/Dropdown/withAssistiveDropdown.d.ts +0 -27
  71. package/components/Dropdown/withAssistiveDropdown.d.ts.map +0 -1
  72. package/components/Dropdown/withAssistiveDropdown.js +0 -134
  73. package/components/Editable/Editable.component-test.js +0 -114
  74. package/components/Editable/Editable.d.ts +0 -36
  75. package/components/Editable/Editable.d.ts.map +0 -1
  76. package/components/Editable/Editable.js +0 -154
  77. package/components/Editable/index.d.ts +0 -2
  78. package/components/Editable/index.d.ts.map +0 -1
  79. package/components/Editable/index.js +0 -16
  80. package/components/List/List.d.ts +0 -3
  81. package/components/List/List.d.ts.map +0 -1
  82. package/components/List/List.js +0 -14
  83. package/components/List/ListItem.d.ts +0 -3
  84. package/components/List/ListItem.d.ts.map +0 -1
  85. package/components/List/ListItem.js +0 -14
  86. package/components/List/index.d.ts +0 -3
  87. package/components/List/index.d.ts.map +0 -1
  88. package/components/List/index.js +0 -19
  89. package/components/Price/Price.d.ts +0 -8
  90. package/components/Price/Price.d.ts.map +0 -1
  91. package/components/Price/Price.js +0 -17
  92. package/components/Price/index.d.ts +0 -3
  93. package/components/Price/index.d.ts.map +0 -1
  94. package/components/Price/index.js +0 -12
  95. package/components/Select/Select.d.ts +0 -35
  96. package/components/Select/Select.d.ts.map +0 -1
  97. package/components/Select/Select.js +0 -38
  98. package/components/Select/Select.utils.d.ts +0 -18
  99. package/components/Select/Select.utils.d.ts.map +0 -1
  100. package/components/Select/Select.utils.js +0 -50
  101. package/components/Select/SelectButton.d.ts +0 -20
  102. package/components/Select/SelectButton.d.ts.map +0 -1
  103. package/components/Select/SelectButton.js +0 -75
  104. package/components/Select/SelectDropdown.d.ts +0 -6
  105. package/components/Select/SelectDropdown.d.ts.map +0 -1
  106. package/components/Select/SelectDropdown.js +0 -16
  107. package/components/Select/SelectGroup.d.ts +0 -2
  108. package/components/Select/SelectGroup.d.ts.map +0 -1
  109. package/components/Select/SelectGroup.js +0 -13
  110. package/components/Select/SelectView.d.ts +0 -18
  111. package/components/Select/SelectView.d.ts.map +0 -1
  112. package/components/Select/SelectView.js +0 -29
  113. package/components/Select/index.d.ts +0 -5
  114. package/components/Select/index.d.ts.map +0 -1
  115. package/components/Select/index.js +0 -19
  116. package/components/Select/types.d.ts +0 -4
  117. package/components/Select/types.d.ts.map +0 -1
  118. package/components/Select/types.js +0 -5
  119. package/components/Select/views/b2c/SelectButton.d.ts +0 -4
  120. package/components/Select/views/b2c/SelectButton.d.ts.map +0 -1
  121. package/components/Select/views/b2c/SelectButton.js +0 -18
  122. package/components/Select/views/b2c/SelectDropdown.d.ts +0 -2
  123. package/components/Select/views/b2c/SelectDropdown.d.ts.map +0 -1
  124. package/components/Select/views/b2c/SelectDropdown.js +0 -11
  125. package/components/Select/views/b2c/SelectView.d.ts +0 -7
  126. package/components/Select/views/b2c/SelectView.d.ts.map +0 -1
  127. package/components/Select/views/b2c/SelectView.js +0 -76
  128. package/components/Select/views/web/SelectView.d.ts +0 -7
  129. package/components/Select/views/web/SelectView.d.ts.map +0 -1
  130. package/components/Select/views/web/SelectView.js +0 -73
  131. package/components/Select/withMultiSelect.d.ts +0 -24
  132. package/components/Select/withMultiSelect.d.ts.map +0 -1
  133. package/components/Select/withMultiSelect.js +0 -54
  134. package/components/Select/withSingleSelect.d.ts +0 -20
  135. package/components/Select/withSingleSelect.d.ts.map +0 -1
  136. package/components/Select/withSingleSelect.js +0 -47
  137. package/components/Slider/Slider.d.ts +0 -4
  138. package/components/Slider/Slider.d.ts.map +0 -1
  139. package/components/Slider/Slider.js +0 -14
  140. package/components/Slider/index.d.ts +0 -2
  141. package/components/Slider/index.d.ts.map +0 -1
  142. package/components/Slider/index.js +0 -12
  143. package/components/Switch/Switch.d.ts +0 -6
  144. package/components/Switch/Switch.d.ts.map +0 -1
  145. package/components/Switch/Switch.js +0 -17
  146. package/components/Switch/index.d.ts +0 -3
  147. package/components/Switch/index.d.ts.map +0 -1
  148. package/components/Switch/index.js +0 -12
  149. package/components/Typography/Body/index.d.ts +0 -2
  150. package/components/Typography/Body/index.d.ts.map +0 -1
  151. package/components/Typography/Body/index.js +0 -18
  152. package/components/Typography/Button/index.d.ts +0 -2
  153. package/components/Typography/Button/index.d.ts.map +0 -1
  154. package/components/Typography/Button/index.js +0 -18
  155. package/components/Typography/Caption/index.d.ts +0 -2
  156. package/components/Typography/Caption/index.d.ts.map +0 -1
  157. package/components/Typography/Caption/index.js +0 -12
  158. package/components/Typography/Footnote/index.d.ts +0 -2
  159. package/components/Typography/Footnote/index.d.ts.map +0 -1
  160. package/components/Typography/Footnote/index.js +0 -18
  161. package/components/Typography/Headline/index.d.ts +0 -4
  162. package/components/Typography/Headline/index.d.ts.map +0 -1
  163. package/components/Typography/Headline/index.js +0 -52
  164. package/components/Typography/Paragraph/index.d.ts +0 -2
  165. package/components/Typography/Paragraph/index.d.ts.map +0 -1
  166. package/components/Typography/Paragraph/index.js +0 -36
  167. package/components/Typography/Subtitle/index.d.ts +0 -2
  168. package/components/Typography/Subtitle/index.d.ts.map +0 -1
  169. package/components/Typography/Subtitle/index.js +0 -21
  170. package/components/Typography/Underline/index.d.ts +0 -2
  171. package/components/Typography/Underline/index.d.ts.map +0 -1
  172. package/components/Typography/Underline/index.js +0 -12
  173. package/components/Typography/index.d.ts +0 -11
  174. package/components/Typography/index.d.ts.map +0 -1
  175. package/components/Typography/index.js +0 -223
  176. package/es/components/Badge/Badge.js +0 -22
  177. package/es/components/Badge/index.js +0 -2
  178. package/es/components/Cell/Cell.js +0 -25
  179. package/es/components/Cell/index.js +0 -1
  180. package/es/components/Dropdown/Dropdown.component-test.js +0 -544
  181. package/es/components/Dropdown/Dropdown.js +0 -55
  182. package/es/components/Dropdown/Dropdown.types.js +0 -3
  183. package/es/components/Dropdown/DropdownItem.js +0 -114
  184. package/es/components/Dropdown/DropdownList.js +0 -15
  185. package/es/components/Dropdown/DropdownMenu.js +0 -53
  186. package/es/components/Dropdown/DropdownPopup.js +0 -39
  187. package/es/components/Dropdown/DropdownUncontrolled.js +0 -61
  188. package/es/components/Dropdown/index.js +0 -6
  189. package/es/components/Dropdown/keyboardNavigation/index.js +0 -1
  190. package/es/components/Dropdown/keyboardNavigation/useKeyboardNavigation.js +0 -52
  191. package/es/components/Dropdown/keyboardNavigation/useOnComboType.js +0 -24
  192. package/es/components/Dropdown/keyboardNavigation/useSearchString.js +0 -40
  193. package/es/components/Dropdown/keyboardNavigation/utils.js +0 -170
  194. package/es/components/Dropdown/withAssistiveDropdown.js +0 -126
  195. package/es/components/Editable/Editable.component-test.js +0 -111
  196. package/es/components/Editable/Editable.js +0 -145
  197. package/es/components/Editable/index.js +0 -1
  198. package/es/components/List/List.js +0 -7
  199. package/es/components/List/ListItem.js +0 -7
  200. package/es/components/List/index.js +0 -2
  201. package/es/components/Price/Price.js +0 -10
  202. package/es/components/Price/index.js +0 -1
  203. package/es/components/Select/Select.js +0 -29
  204. package/es/components/Select/Select.utils.js +0 -44
  205. package/es/components/Select/SelectButton.js +0 -67
  206. package/es/components/Select/SelectDropdown.js +0 -9
  207. package/es/components/Select/SelectGroup.js +0 -6
  208. package/es/components/Select/SelectView.js +0 -21
  209. package/es/components/Select/index.js +0 -2
  210. package/es/components/Select/types.js +0 -1
  211. package/es/components/Select/views/b2c/SelectButton.js +0 -12
  212. package/es/components/Select/views/b2c/SelectDropdown.js +0 -5
  213. package/es/components/Select/views/b2c/SelectView.js +0 -67
  214. package/es/components/Select/views/web/SelectView.js +0 -64
  215. package/es/components/Select/withMultiSelect.js +0 -46
  216. package/es/components/Select/withSingleSelect.js +0 -39
  217. package/es/components/Slider/Slider.js +0 -7
  218. package/es/components/Slider/index.js +0 -1
  219. package/es/components/Switch/Switch.js +0 -10
  220. package/es/components/Switch/index.js +0 -1
  221. package/es/components/Typography/Body/index.js +0 -1
  222. package/es/components/Typography/Button/index.js +0 -1
  223. package/es/components/Typography/Caption/index.js +0 -1
  224. package/es/components/Typography/Footnote/index.js +0 -1
  225. package/es/components/Typography/Headline/index.js +0 -20
  226. package/es/components/Typography/Paragraph/index.js +0 -1
  227. package/es/components/Typography/Subtitle/index.js +0 -14
  228. package/es/components/Typography/Underline/index.js +0 -1
  229. package/es/components/Typography/index.js +0 -9
@@ -1,547 +0,0 @@
1
- "use strict";
2
-
3
- var _react = /*#__PURE__*/_interopRequireDefault(/*#__PURE__*/require("react"));
4
- var _styledComponents = /*#__PURE__*/require("styled-components");
5
- var _plasmaTypo = /*#__PURE__*/require("@salutejs/plasma-typo");
6
- var _plasmaIcons = /*#__PURE__*/require("@salutejs/plasma-icons");
7
- var _plasmaCyUtils = /*#__PURE__*/require("@salutejs/plasma-cy-utils");
8
- var _StandardTypoStyle, _span;
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
- var StandardTypoStyle = /*#__PURE__*/(0, _styledComponents.createGlobalStyle)(_plasmaTypo.standard);
11
- var items = [{
12
- value: 'north_america',
13
- label: 'Северная Америка',
14
- contentLeft: /*#__PURE__*/_react["default"].createElement(_plasmaIcons.IconLocation, {
15
- color: "inherit"
16
- }),
17
- contentRight: /*#__PURE__*/_react["default"].createElement(_plasmaIcons.IconLocation, {
18
- color: "inherit"
19
- })
20
- }, {
21
- value: 'south_america',
22
- label: 'Южная Америка',
23
- items: [{
24
- value: 'brazil',
25
- label: 'Бразилия',
26
- items: [{
27
- value: 'rio_de_janeiro',
28
- label: 'Рио-де-Жанейро'
29
- }, {
30
- value: 'sao_paulo',
31
- label: 'Сан-Паулу'
32
- }]
33
- }, {
34
- value: 'argentina',
35
- label: 'Аргентина',
36
- items: [{
37
- value: 'buenos_aires',
38
- label: 'Буэнос-Айрес'
39
- }, {
40
- value: 'cordoba',
41
- label: 'Кордова'
42
- }]
43
- }, {
44
- value: 'colombia',
45
- label: 'Колумбия',
46
- items: [{
47
- value: 'bogota',
48
- label: 'Богота'
49
- }, {
50
- value: 'medellin',
51
- label: 'Медельин'
52
- }]
53
- }]
54
- }, {
55
- value: 'europe',
56
- label: 'Европа',
57
- items: [{
58
- value: 'france',
59
- label: 'Франция',
60
- items: [{
61
- value: 'paris',
62
- label: 'Париж'
63
- }, {
64
- value: 'lyon',
65
- label: 'Лион'
66
- }]
67
- }, {
68
- value: 'germany',
69
- label: 'Германия',
70
- items: [{
71
- value: 'berlin',
72
- label: 'Берлин'
73
- }, {
74
- value: 'munich',
75
- label: 'Мюнхен'
76
- }]
77
- }, {
78
- value: 'italy',
79
- label: 'Италия',
80
- items: [{
81
- value: 'rome',
82
- label: 'Рим'
83
- }, {
84
- value: 'milan',
85
- label: 'Милан'
86
- }]
87
- }, {
88
- value: 'spain',
89
- label: 'Испания',
90
- items: [{
91
- value: 'madrid',
92
- label: 'Мадрид'
93
- }, {
94
- value: 'barcelona',
95
- label: 'Барселона'
96
- }]
97
- }, {
98
- value: 'united_kingdom',
99
- label: 'Великобритания',
100
- items: [{
101
- value: 'london',
102
- label: 'Лондон'
103
- }, {
104
- value: 'manchester',
105
- label: 'Манчестер'
106
- }]
107
- }]
108
- }, {
109
- value: 'asia',
110
- label: 'Азия',
111
- items: [{
112
- value: 'china',
113
- label: 'Китай',
114
- items: [{
115
- value: 'beijing',
116
- label: 'Пекин'
117
- }, {
118
- value: 'shanghai',
119
- label: 'Шанхай'
120
- }]
121
- }, {
122
- value: 'japan',
123
- label: 'Япония',
124
- items: [{
125
- value: 'tokyo',
126
- label: 'Токио'
127
- }, {
128
- value: 'osaka',
129
- label: 'Осака'
130
- }]
131
- }, {
132
- value: 'india',
133
- label: 'Индия',
134
- items: [{
135
- value: 'delhi',
136
- label: 'Дели'
137
- }, {
138
- value: 'mumbai',
139
- label: 'Мумбаи'
140
- }]
141
- }, {
142
- value: 'south_korea',
143
- label: 'Южная Корея',
144
- items: [{
145
- value: 'seoul',
146
- label: 'Сеул'
147
- }, {
148
- value: 'busan',
149
- label: 'Пусан'
150
- }]
151
- }, {
152
- value: 'thailand',
153
- label: 'Таиланд',
154
- items: [{
155
- value: 'bangkok',
156
- label: 'Бангкок'
157
- }, {
158
- value: 'phuket',
159
- label: 'Пхукет'
160
- }]
161
- }]
162
- }, {
163
- value: 'africa',
164
- label: 'Африка',
165
- disabled: true
166
- }];
167
- describe('plasma-b2c: Dropdown', function () {
168
- var _CypressTestDecorator, _Dropdown, _Dropdown2, _Dropdown3, _Dropdown4, _Dropdown5, _Dropdown6, _Dropdown7, _Dropdown8, _Button, _Button2, _CypressTestDecorator2, _Button3, _Button4, _Button5, _CypressTestDecorator3, _CypressTestDecorator4, _CypressTestDecorator5, _CypressTestDecorator6, _Button6, _Button7, _CypressTestDecorator7, _Button8;
169
- var Dropdown = (0, _plasmaCyUtils.getComponent)('Dropdown');
170
- var Button = (0, _plasmaCyUtils.getComponent)('Button');
171
- var CypressTestDecoratorWithTypo = function CypressTestDecoratorWithTypo(_ref) {
172
- var children = _ref.children;
173
- return /*#__PURE__*/_react["default"].createElement(_plasmaCyUtils.CypressTestDecorator, null, _StandardTypoStyle || (_StandardTypoStyle = /*#__PURE__*/_react["default"].createElement(StandardTypoStyle, null)), children);
174
- };
175
- it('default', function () {
176
- cy.viewport(1000, 500);
177
- (0, _plasmaCyUtils.mount)(_CypressTestDecorator || (_CypressTestDecorator = /*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement(Dropdown, {
178
- items: items
179
- }, /*#__PURE__*/_react["default"].createElement(Button, {
180
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
181
- })))));
182
- cy.get('button').click();
183
- cy.get('#south_america').click();
184
- cy.get('#argentina').click();
185
- cy.matchImageSnapshot();
186
- });
187
- it('prop: size', function () {
188
- cy.viewport(1500, 500);
189
- (0, _plasmaCyUtils.mount)(/*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement("div", {
190
- style: {
191
- display: 'flex',
192
- gap: '200px'
193
- }
194
- }, _Dropdown || (_Dropdown = /*#__PURE__*/_react["default"].createElement(Dropdown, {
195
- items: items,
196
- size: "xs",
197
- closeOnOverlayClick: false
198
- }, /*#__PURE__*/_react["default"].createElement(Button, {
199
- id: "xs",
200
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D XS"
201
- }))), _Dropdown2 || (_Dropdown2 = /*#__PURE__*/_react["default"].createElement(Dropdown, {
202
- items: items,
203
- size: "s",
204
- closeOnOverlayClick: false
205
- }, /*#__PURE__*/_react["default"].createElement(Button, {
206
- id: "s",
207
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D S"
208
- }))), _Dropdown3 || (_Dropdown3 = /*#__PURE__*/_react["default"].createElement(Dropdown, {
209
- items: items,
210
- size: "m",
211
- closeOnOverlayClick: false
212
- }, /*#__PURE__*/_react["default"].createElement(Button, {
213
- id: "m",
214
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D M"
215
- }))), _Dropdown4 || (_Dropdown4 = /*#__PURE__*/_react["default"].createElement(Dropdown, {
216
- items: items,
217
- size: "l",
218
- closeOnOverlayClick: false
219
- }, /*#__PURE__*/_react["default"].createElement(Button, {
220
- id: "l",
221
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D L"
222
- }))))));
223
- cy.get('#xs').click();
224
- cy.get('#s').click();
225
- cy.get('#m').click();
226
- cy.get('#l').click();
227
- cy.matchImageSnapshot();
228
- });
229
- it('prop: size, variant', function () {
230
- cy.viewport(1500, 500);
231
- (0, _plasmaCyUtils.mount)(/*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement("div", {
232
- style: {
233
- display: 'flex',
234
- gap: '200px'
235
- }
236
- }, _Dropdown5 || (_Dropdown5 = /*#__PURE__*/_react["default"].createElement(Dropdown, {
237
- items: items,
238
- size: "xs",
239
- closeOnOverlayClick: false,
240
- variant: "tight"
241
- }, /*#__PURE__*/_react["default"].createElement(Button, {
242
- id: "xs",
243
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D XS"
244
- }))), _Dropdown6 || (_Dropdown6 = /*#__PURE__*/_react["default"].createElement(Dropdown, {
245
- items: items,
246
- size: "s",
247
- closeOnOverlayClick: false,
248
- variant: "tight"
249
- }, /*#__PURE__*/_react["default"].createElement(Button, {
250
- id: "s",
251
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D S"
252
- }))), _Dropdown7 || (_Dropdown7 = /*#__PURE__*/_react["default"].createElement(Dropdown, {
253
- items: items,
254
- size: "m",
255
- closeOnOverlayClick: false,
256
- variant: "tight"
257
- }, /*#__PURE__*/_react["default"].createElement(Button, {
258
- id: "m",
259
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D M"
260
- }))), _Dropdown8 || (_Dropdown8 = /*#__PURE__*/_react["default"].createElement(Dropdown, {
261
- items: items,
262
- size: "l",
263
- closeOnOverlayClick: false,
264
- variant: "tight"
265
- }, /*#__PURE__*/_react["default"].createElement(Button, {
266
- id: "l",
267
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D L"
268
- }))))));
269
- cy.get('#xs').click();
270
- cy.get('#s').click();
271
- cy.get('#m').click();
272
- cy.get('#l').click();
273
- cy.matchImageSnapshot();
274
- });
275
- it('prop: onHover', function () {
276
- (0, _plasmaCyUtils.mount)(/*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement(Dropdown, {
277
- items: items,
278
- onHover: function onHover(index) {
279
- expect(index).to.eq(0);
280
- }
281
- }, _Button || (_Button = /*#__PURE__*/_react["default"].createElement(Button, {
282
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
283
- })))));
284
- cy.get('button').click();
285
- cy.get('#north_america').trigger('mouseover');
286
- });
287
- it('prop: onItemSelect', function () {
288
- (0, _plasmaCyUtils.mount)(/*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement(Dropdown, {
289
- items: items,
290
- onItemSelect: function onItemSelect(item, event) {
291
- expect(item).to.eq(items[0]);
292
- expect(event.type).to.eq('click');
293
- }
294
- }, _Button2 || (_Button2 = /*#__PURE__*/_react["default"].createElement(Button, {
295
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
296
- })))));
297
- cy.get('button').click();
298
- cy.get('#north_america').click();
299
- });
300
- it('prop: trigger', function () {
301
- cy.viewport(1000, 500);
302
- (0, _plasmaCyUtils.mount)(_CypressTestDecorator2 || (_CypressTestDecorator2 = /*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement(Dropdown, {
303
- items: items,
304
- trigger: "hover"
305
- }, /*#__PURE__*/_react["default"].createElement(Button, {
306
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
307
- })))));
308
- cy.get('button').trigger('mouseover');
309
- cy.get('#asia').trigger('mouseover');
310
- cy.get('#india').trigger('mouseover');
311
- cy.get('#delhi').should('be.visible');
312
- cy.matchImageSnapshot();
313
- });
314
- it('prop: placement', function () {
315
- cy.viewport(500, 800);
316
- (0, _plasmaCyUtils.mount)(/*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement(Dropdown, {
317
- placement: ['top', 'bottom'],
318
- items: items,
319
- closeOnOverlayClick: false
320
- }, _Button3 || (_Button3 = /*#__PURE__*/_react["default"].createElement(Button, {
321
- id: "top",
322
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
323
- }))), /*#__PURE__*/_react["default"].createElement("div", {
324
- style: {
325
- height: '600px'
326
- }
327
- }), /*#__PURE__*/_react["default"].createElement(Dropdown, {
328
- placement: ['top', 'bottom'],
329
- items: items,
330
- closeOnOverlayClick: false
331
- }, _Button4 || (_Button4 = /*#__PURE__*/_react["default"].createElement(Button, {
332
- id: "bottom",
333
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
334
- })))));
335
- cy.get('#top').click();
336
- cy.get('#bottom').click();
337
- cy.matchImageSnapshot();
338
- });
339
- it('prop: offset', function () {
340
- cy.viewport(1000, 500);
341
- (0, _plasmaCyUtils.mount)(/*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement(Dropdown, {
342
- items: items,
343
- offset: [20, 20]
344
- }, _Button5 || (_Button5 = /*#__PURE__*/_react["default"].createElement(Button, {
345
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
346
- })))));
347
- cy.get('button').click();
348
- cy.get('#south_america').click();
349
- cy.get('#argentina').click();
350
- cy.matchImageSnapshot();
351
- });
352
- it('prop: listWidth', function () {
353
- cy.viewport(1000, 500);
354
- (0, _plasmaCyUtils.mount)(_CypressTestDecorator3 || (_CypressTestDecorator3 = /*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement(Dropdown, {
355
- items: items,
356
- listWidth: "300px"
357
- }, /*#__PURE__*/_react["default"].createElement(Button, {
358
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
359
- })))));
360
- cy.get('button').click();
361
- cy.get('#south_america').click();
362
- cy.get('#argentina').click();
363
- cy.matchImageSnapshot();
364
- });
365
- it('prop: hasArrow', function () {
366
- cy.viewport(1000, 500);
367
- (0, _plasmaCyUtils.mount)(_CypressTestDecorator4 || (_CypressTestDecorator4 = /*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement(Dropdown, {
368
- items: items,
369
- hasArrow: false
370
- }, /*#__PURE__*/_react["default"].createElement(Button, {
371
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
372
- })))));
373
- cy.get('button').click();
374
- cy.get('#south_america').click();
375
- cy.get('#argentina').click();
376
- cy.matchImageSnapshot();
377
- });
378
- it('prop: closeOnSelect', function () {
379
- (0, _plasmaCyUtils.mount)(_CypressTestDecorator5 || (_CypressTestDecorator5 = /*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement(Dropdown, {
380
- items: items,
381
- closeOnSelect: false
382
- }, /*#__PURE__*/_react["default"].createElement(Button, {
383
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
384
- })))));
385
- cy.get('button').click();
386
- cy.get('#north_america').click();
387
- cy.get('#north_america').should('be.visible');
388
- });
389
- it('prop: closeOnOverlayClick', function () {
390
- (0, _plasmaCyUtils.mount)(_CypressTestDecorator6 || (_CypressTestDecorator6 = /*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, _span || (_span = /*#__PURE__*/_react["default"].createElement("span", {
391
- id: "outer"
392
- }, "outer text")), /*#__PURE__*/_react["default"].createElement(Dropdown, {
393
- items: items,
394
- closeOnOverlayClick: false
395
- }, /*#__PURE__*/_react["default"].createElement(Button, {
396
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
397
- })))));
398
- cy.get('button').click();
399
- cy.get('#outer').click();
400
- cy.get('#north_america').should('be.visible');
401
- });
402
- it('prop: onToggle', function () {
403
- (0, _plasmaCyUtils.mount)(/*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement(Dropdown, {
404
- items: items,
405
- onToggle: function onToggle(isOpen, event) {
406
- expect(isOpen).to.be.oneOf([true, false]);
407
- expect(event.type).to.eq('click');
408
- }
409
- }, _Button6 || (_Button6 = /*#__PURE__*/_react["default"].createElement(Button, {
410
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
411
- })))));
412
- cy.get('button').click();
413
- cy.get('button').click();
414
- });
415
- it('prop: onItemClick', function () {
416
- (0, _plasmaCyUtils.mount)(/*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement(Dropdown, {
417
- items: items,
418
- onItemClick: function onItemClick(item, event) {
419
- expect(item).to.eq(items[0]);
420
- expect(event.type).to.eq('click');
421
- }
422
- }, _Button7 || (_Button7 = /*#__PURE__*/_react["default"].createElement(Button, {
423
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
424
- })))));
425
- cy.get('button').click();
426
- cy.get('#north_america').click();
427
- });
428
- it('prop: listHeight, listOverflow', function () {
429
- (0, _plasmaCyUtils.mount)(_CypressTestDecorator7 || (_CypressTestDecorator7 = /*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement(Dropdown, {
430
- items: items,
431
- listOverflow: "scroll",
432
- listHeight: 6
433
- }, /*#__PURE__*/_react["default"].createElement(Button, {
434
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
435
- })))));
436
- cy.get('button').click();
437
- cy.matchImageSnapshot();
438
- });
439
- it('keyboard interactions', function () {
440
- cy.viewport(1000, 500);
441
- (0, _plasmaCyUtils.mount)(/*#__PURE__*/_react["default"].createElement(CypressTestDecoratorWithTypo, null, /*#__PURE__*/_react["default"].createElement(Dropdown, {
442
- items: items,
443
- onItemSelect: function onItemSelect(item, event) {
444
- expect(item).to.eq(items[0]);
445
- expect(event.type).to.eq('keydown');
446
- }
447
- }, _Button8 || (_Button8 = /*#__PURE__*/_react["default"].createElement(Button, {
448
- text: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u0442\u0440\u0430\u043D"
449
- })))));
450
- cy.get('body').realClick();
451
- cy.realPress('Tab');
452
-
453
- // Arrow Down
454
- cy.realPress('ArrowDown');
455
- cy.get('#listbox1').should('be.visible');
456
- cy.get('#north_america').should('have.class', 'dropdown-item-is-focused');
457
- cy.get('button').should('have.focus');
458
- cy.realPress('ArrowDown').realPress('ArrowDown').realPress('ArrowDown').realPress('ArrowDown').realPress('ArrowDown').realPress('ArrowDown').realPress('ArrowDown');
459
- cy.get('#europe').should('have.class', 'dropdown-item-is-focused');
460
- cy.realPress('Escape');
461
-
462
- // Arrow Up
463
- cy.realPress('ArrowUp');
464
- cy.get('#north_america').should('have.class', 'dropdown-item-is-focused');
465
- cy.realPress('ArrowUp');
466
- cy.get('#africa').should('have.class', 'dropdown-item-is-focused');
467
- cy.realPress('Escape');
468
-
469
- // Arrows Right and Left
470
- cy.realPress('ArrowDown').realPress('ArrowDown').realPress('ArrowRight');
471
- cy.get('#listbox1').should('be.visible');
472
- cy.get('#listbox2').should('be.visible');
473
- cy.get('#brazil').should('have.class', 'dropdown-item-is-focused');
474
- cy.get('button').should('have.focus');
475
- cy.get('#south_america').should('have.class', 'dropdown-item-is-active');
476
- cy.realPress('ArrowLeft');
477
- cy.get('#listbox1').should('be.visible');
478
- cy.get('#listbox2').should('not.be.visible');
479
- cy.get('#south_america').should('have.class', 'dropdown-item-is-focused');
480
- cy.realPress('ArrowDown').realPress('ArrowRight');
481
- cy.get('#france').should('have.class', 'dropdown-item-is-focused');
482
- cy.get('button').should('have.focus');
483
- cy.get('#europe').should('have.class', 'dropdown-item-is-active');
484
- cy.realPress('ArrowRight');
485
- cy.get('#europe').should('have.class', 'dropdown-item-is-active');
486
- cy.get('#france').should('have.class', 'dropdown-item-is-active');
487
- cy.get('#paris').should('have.class', 'dropdown-item-is-focused');
488
- cy.realPress('ArrowLeft').realPress('ArrowLeft').realPress('ArrowLeft');
489
- cy.get('#listbox1').should('not.be.visible');
490
- cy.get('button').should('have.focus');
491
-
492
- // Escape
493
- cy.realPress('Escape');
494
- cy.get('#listbox1').should('not.be.visible');
495
- cy.get('button').should('have.focus');
496
-
497
- // Home
498
- cy.realPress('Home');
499
- cy.get('#listbox1').should('be.visible');
500
- cy.get('button').should('have.focus');
501
- cy.get('#north_america').should('have.class', 'dropdown-item-is-focused');
502
- cy.realPress('Escape');
503
-
504
- // End
505
- cy.realPress('End');
506
- cy.get('#listbox1').should('be.visible');
507
- cy.get('button').should('have.focus');
508
- cy.get('#africa').should('have.class', 'dropdown-item-is-focused');
509
- cy.realPress('Escape');
510
-
511
- // Page Down
512
- cy.realPress('PageDown');
513
- cy.get('#listbox1').should('not.be.visible');
514
- cy.get('button').should('have.focus');
515
- cy.realPress('ArrowDown');
516
- cy.realPress('PageDown');
517
- cy.get('button').should('have.focus');
518
- cy.get('#africa').should('have.class', 'dropdown-item-is-focused');
519
- cy.realPress('Escape');
520
-
521
- // Page Up
522
- cy.realPress('PageUp');
523
- cy.get('#listbox1').should('not.be.visible');
524
- cy.get('button').should('have.focus');
525
- cy.realPress('ArrowDown');
526
- cy.realPress('ArrowDown');
527
- cy.realPress('PageUp');
528
- cy.get('button').should('have.focus');
529
- cy.get('#north_america').should('have.class', 'dropdown-item-is-focused');
530
- cy.realPress('Escape');
531
-
532
- // Space
533
- cy.realPress('ArrowDown').realPress('ArrowDown').realPress('Space').realPress('ArrowLeft').realPress('ArrowUp').realPress('Space');
534
- cy.get('#listbox1').should('not.be.visible');
535
- cy.get('button').should('have.focus');
536
-
537
- // Enter
538
- cy.realPress('Enter').realPress('ArrowDown').realPress('Enter').realPress('ArrowLeft').realPress('ArrowUp').realPress('Enter');
539
- cy.get('#listbox1').should('not.be.visible');
540
- cy.get('button').should('have.focus');
541
-
542
- // Tab
543
- cy.realPress('ArrowDown').realPress('Tab');
544
- cy.get('#listbox1').should('not.be.visible');
545
- cy.get('button').should('not.have.focus');
546
- });
547
- });
@@ -1,20 +0,0 @@
1
- import { FC } from 'react';
2
- import { DropdownUncontrolledProps } from './DropdownUncontrolled';
3
- import type { OnItemSelect } from './Dropdown.types';
4
- import type { DropdownListCssProperties } from './DropdownList';
5
- export interface DropdownProps extends Omit<DropdownUncontrolledProps, 'opened' | 'isOpen' | 'hoverIndex'>, DropdownListCssProperties {
6
- /**
7
- * Закрыть выпадающий список после выбора.
8
- */
9
- closeOnSelect?: boolean;
10
- /**
11
- * Обработчик клика по item.
12
- * @deprecated Будет удалено в v2.0, используйте onItemSelect.
13
- */
14
- onItemClick?: OnItemSelect;
15
- }
16
- /**
17
- * Выпадающий список без внешнего контроля видимости.
18
- */
19
- export declare const Dropdown: FC<DropdownProps>;
20
- //# sourceMappingURL=Dropdown.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAyB,MAAM,OAAO,CAAC;AAGzD,OAAO,EAAwB,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,MAAM,WAAW,aACb,SAAQ,IAAI,CAAC,yBAAyB,EAAE,QAAQ,GAAG,QAAQ,GAAG,YAAY,CAAC,EACvE,yBAAyB;IAC7B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,YAAY,CAAC;CAC9B;AAMD;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAwCtC,CAAC"}
@@ -1,64 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.Dropdown = void 0;
8
- var _react = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("react"));
9
- var _styledComponents = /*#__PURE__*/_interopRequireDefault(/*#__PURE__*/require("styled-components"));
10
- var _DropdownUncontrolled = /*#__PURE__*/require("./DropdownUncontrolled");
11
- var _DropdownList = /*#__PURE__*/require("./DropdownList");
12
- var _collectPackageInfo = /*#__PURE__*/require("../../collectPackageInfo");
13
- var _excluded = ["disabled", "closeOnSelect", "onItemClick", "onToggle", "onItemSelect"];
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
15
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
16
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
17
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
18
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
20
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
21
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
22
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
23
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
24
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
25
- (0, _collectPackageInfo.collectPackageInfo)('Dropdown/Dropdown');
26
- var StyledDropdownUncontrolled = /*#__PURE__*/(0, _styledComponents["default"])(_DropdownUncontrolled.DropdownUncontrolled).withConfig({
27
- componentId: "plasma-web-core__sc-1aw1the-0"
28
- })(["", ";"], _DropdownList.applyDropdownListCssProperties);
29
-
30
- /**
31
- * Выпадающий список без внешнего контроля видимости.
32
- */
33
- var Dropdown = exports.Dropdown = function Dropdown(_ref) {
34
- var disabled = _ref.disabled,
35
- _ref$closeOnSelect = _ref.closeOnSelect,
36
- closeOnSelect = _ref$closeOnSelect === void 0 ? true : _ref$closeOnSelect,
37
- onItemClick = _ref.onItemClick,
38
- onToggleExternal = _ref.onToggle,
39
- onItemSelectExternal = _ref.onItemSelect,
40
- rest = _objectWithoutProperties(_ref, _excluded);
41
- var _useState = (0, _react.useState)(false),
42
- _useState2 = _slicedToArray(_useState, 2),
43
- isOpen = _useState2[0],
44
- setIsOpen = _useState2[1];
45
- var onToggle = (0, _react.useCallback)(function (newIsOpen, event) {
46
- setIsOpen(newIsOpen);
47
- onToggleExternal === null || onToggleExternal === void 0 || onToggleExternal(newIsOpen, event);
48
- }, [onToggleExternal, disabled]);
49
- var onItemSelect = (0, _react.useCallback)(function (item, event) {
50
- if (closeOnSelect) {
51
- onToggle === null || onToggle === void 0 || onToggle(false, event);
52
- }
53
- if (onItemSelectExternal) {
54
- return onItemSelectExternal(item, event);
55
- }
56
- return onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item, event);
57
- }, [closeOnSelect, onToggle, onItemSelectExternal, onItemClick]);
58
- return /*#__PURE__*/_react["default"].createElement(StyledDropdownUncontrolled, _extends({}, rest, {
59
- opened: isOpen,
60
- disabled: disabled,
61
- onToggle: onToggle,
62
- onItemSelect: onItemSelect
63
- }));
64
- };
@@ -1,16 +0,0 @@
1
- import type { ReactNode, SyntheticEvent } from 'react';
2
- export interface DropdownItem {
3
- value: string | number;
4
- label: string;
5
- color?: string;
6
- contentLeft?: ReactNode;
7
- }
8
- export interface DropdownNode extends DropdownItem {
9
- items?: Array<DropdownNode>;
10
- isActive?: boolean;
11
- isDisabled?: boolean;
12
- }
13
- export type OnItemSelect = (item: DropdownNode, event: SyntheticEvent) => void;
14
- export type OnIndexChange = (index: number) => void;
15
- export type OnHover = (index: number) => void;
16
- //# sourceMappingURL=Dropdown.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Dropdown.types.d.ts","sourceRoot":"","sources":["../../src/components/Dropdown/Dropdown.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvD,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,SAAS,CAAC;CAC3B;AACD,MAAM,WAAW,YAAa,SAAQ,YAAY;IAC9C,KAAK,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;AAC/E,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AACpD,MAAM,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _collectPackageInfo = /*#__PURE__*/require("../../collectPackageInfo");
7
- (0, _collectPackageInfo.collectPackageInfo)('Dropdown/Dropdown.types');