@salutejs/plasma-new-hope 0.77.1-canary.1197.8831064988.0 → 0.77.1-canary.1201.8930079977.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (357) hide show
  1. package/cjs/components/Combobox/Combobox.css +17 -7
  2. package/cjs/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +15 -6
  3. package/cjs/components/Combobox/ui/ComboboxDivider/ComboboxDivider.js +2 -2
  4. package/cjs/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +15 -6
  5. package/cjs/components/Combobox/ui/ComboboxFooter/ComboboxFooter.js +2 -2
  6. package/cjs/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +15 -6
  7. package/cjs/components/Combobox/ui/ComboboxGroup/ComboboxGroup.js +2 -2
  8. package/cjs/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +15 -6
  9. package/cjs/components/Combobox/ui/ComboboxHeader/ComboboxHeader.js +2 -2
  10. package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.css +4 -23
  11. package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.js +81 -10
  12. package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.js.map +1 -1
  13. package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.styles.js +21 -9
  14. package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.styles.js.map +1 -1
  15. package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.styles_s4sk53.css +4 -0
  16. package/cjs/components/Combobox/utils/index.js +23 -0
  17. package/cjs/components/Combobox/utils/index.js.map +1 -0
  18. package/cjs/components/Dropdown/Dropdown.css +25 -2
  19. package/cjs/components/Dropdown/Dropdown.js +138 -54
  20. package/cjs/components/Dropdown/Dropdown.js.map +1 -1
  21. package/cjs/components/Dropdown/Dropdown.styles.js +40 -7
  22. package/cjs/components/Dropdown/Dropdown.styles.js.map +1 -1
  23. package/cjs/components/Dropdown/Dropdown.styles_1tihqkp.css +3 -0
  24. package/cjs/components/Dropdown/Dropdown.tokens.js +26 -23
  25. package/cjs/components/Dropdown/Dropdown.tokens.js.map +1 -1
  26. package/cjs/components/Dropdown/hooks/useHashMaps.js +31 -0
  27. package/cjs/components/Dropdown/hooks/useHashMaps.js.map +1 -0
  28. package/cjs/components/Dropdown/hooks/useKeyboardNavigation.js +200 -0
  29. package/cjs/components/Dropdown/hooks/useKeyboardNavigation.js.map +1 -0
  30. package/cjs/components/Dropdown/reducers/focusedPathReducer.js +37 -0
  31. package/cjs/components/Dropdown/reducers/focusedPathReducer.js.map +1 -0
  32. package/cjs/components/Dropdown/reducers/pathReducer.js +41 -0
  33. package/cjs/components/Dropdown/reducers/pathReducer.js.map +1 -0
  34. package/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js +119 -0
  35. package/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js.map +1 -0
  36. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.css +7 -4
  37. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +79 -100
  38. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
  39. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +90 -5
  40. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js.map +1 -1
  41. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles_1o4szyu.css +5 -0
  42. package/cjs/components/Dropdown/ui/DropdownItemOld/DropdownItem.styles.js +30 -0
  43. package/cjs/components/Dropdown/ui/DropdownItemOld/DropdownItem.styles.js.map +1 -0
  44. package/cjs/components/Dropdown/ui/DropdownItemOld/DropdownItem.styles_12e50g5.css +4 -0
  45. package/cjs/components/Dropdown/ui/DropdownItemOld/DropdownItemOld.css +4 -0
  46. package/cjs/components/Dropdown/ui/DropdownItemOld/DropdownItemOld.js +112 -0
  47. package/cjs/components/Dropdown/ui/DropdownItemOld/DropdownItemOld.js.map +1 -0
  48. package/cjs/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_size/base.js +1 -1
  49. package/cjs/components/Dropdown/ui/DropdownItemOld/variations/_size/base.js.map +1 -0
  50. package/cjs/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_view/base.js +1 -1
  51. package/cjs/components/Dropdown/ui/DropdownItemOld/variations/_view/base.js.map +1 -0
  52. package/cjs/components/Dropdown/utils/index.js +16 -0
  53. package/cjs/components/Dropdown/utils/index.js.map +1 -1
  54. package/cjs/components/Pagination/Pagination.css +14 -7
  55. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +14 -7
  56. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +1 -1
  57. package/cjs/components/Select/Select.css +14 -7
  58. package/cjs/components/Select/ui/SelectDivider/SelectDivider.css +15 -6
  59. package/cjs/components/Select/ui/SelectDivider/SelectDivider.js +2 -2
  60. package/cjs/components/Select/ui/SelectFooter/SelectFooter.css +15 -6
  61. package/cjs/components/Select/ui/SelectFooter/SelectFooter.js +2 -2
  62. package/cjs/components/Select/ui/SelectGroup/SelectGroup.css +15 -6
  63. package/cjs/components/Select/ui/SelectGroup/SelectGroup.js +2 -2
  64. package/cjs/components/Select/ui/SelectHeader/SelectHeader.css +15 -6
  65. package/cjs/components/Select/ui/SelectHeader/SelectHeader.js +2 -2
  66. package/cjs/components/Select/ui/SelectItem/SelectItem.css +16 -7
  67. package/cjs/components/Select/ui/SelectItem/SelectItem.js +3 -3
  68. package/cjs/components/Select/ui/SelectItem/SelectItem.js.map +1 -1
  69. package/cjs/components/Select/ui/SelectItem/SelectItem.styles.js +2 -2
  70. package/cjs/components/Select/ui/SelectItem/SelectItem.styles.js.map +1 -1
  71. package/cjs/components/Select/ui/SelectItem/{SelectItem.styles_6h17aw.css → SelectItem.styles_vk39mp.css} +1 -1
  72. package/cjs/components/TextField/TextField.js +2 -2
  73. package/cjs/components/TextField/TextField.js.map +1 -1
  74. package/cjs/components/_Icon/Icon.assets/DisclosureRight.js +1 -2
  75. package/cjs/components/_Icon/Icon.assets/DisclosureRight.js.map +1 -1
  76. package/cjs/index.css +18 -8
  77. package/cjs/index.js +8 -2
  78. package/cjs/index.js.map +1 -1
  79. package/es/components/Combobox/Combobox.css +17 -7
  80. package/es/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +15 -6
  81. package/es/components/Combobox/ui/ComboboxDivider/ComboboxDivider.js +2 -2
  82. package/es/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +15 -6
  83. package/es/components/Combobox/ui/ComboboxFooter/ComboboxFooter.js +2 -2
  84. package/es/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +15 -6
  85. package/es/components/Combobox/ui/ComboboxGroup/ComboboxGroup.js +2 -2
  86. package/es/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +15 -6
  87. package/es/components/Combobox/ui/ComboboxHeader/ComboboxHeader.js +2 -2
  88. package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.css +4 -23
  89. package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.js +82 -11
  90. package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.js.map +1 -1
  91. package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.styles.js +19 -10
  92. package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.styles.js.map +1 -1
  93. package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.styles_s4sk53.css +4 -0
  94. package/es/components/Combobox/utils/index.js +19 -0
  95. package/es/components/Combobox/utils/index.js.map +1 -0
  96. package/es/components/Dropdown/Dropdown.css +25 -2
  97. package/es/components/Dropdown/Dropdown.js +144 -60
  98. package/es/components/Dropdown/Dropdown.js.map +1 -1
  99. package/es/components/Dropdown/Dropdown.styles.js +39 -7
  100. package/es/components/Dropdown/Dropdown.styles.js.map +1 -1
  101. package/es/components/Dropdown/Dropdown.styles_1tihqkp.css +3 -0
  102. package/es/components/Dropdown/Dropdown.tokens.js +26 -23
  103. package/es/components/Dropdown/Dropdown.tokens.js.map +1 -1
  104. package/es/components/Dropdown/hooks/useHashMaps.js +27 -0
  105. package/es/components/Dropdown/hooks/useHashMaps.js.map +1 -0
  106. package/es/components/Dropdown/hooks/useKeyboardNavigation.js +196 -0
  107. package/es/components/Dropdown/hooks/useKeyboardNavigation.js.map +1 -0
  108. package/es/components/Dropdown/reducers/focusedPathReducer.js +33 -0
  109. package/es/components/Dropdown/reducers/focusedPathReducer.js.map +1 -0
  110. package/es/components/Dropdown/reducers/pathReducer.js +37 -0
  111. package/es/components/Dropdown/reducers/pathReducer.js.map +1 -0
  112. package/es/components/Dropdown/ui/DropdownInner/DropdownInner.js +115 -0
  113. package/es/components/Dropdown/ui/DropdownInner/DropdownInner.js.map +1 -0
  114. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.css +7 -4
  115. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +80 -100
  116. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
  117. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +89 -5
  118. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js.map +1 -1
  119. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles_1o4szyu.css +5 -0
  120. package/es/components/Dropdown/ui/DropdownItemOld/DropdownItem.styles.js +23 -0
  121. package/es/components/Dropdown/ui/DropdownItemOld/DropdownItem.styles.js.map +1 -0
  122. package/es/components/Dropdown/ui/DropdownItemOld/DropdownItem.styles_12e50g5.css +4 -0
  123. package/es/components/Dropdown/ui/DropdownItemOld/DropdownItemOld.css +4 -0
  124. package/es/components/Dropdown/ui/DropdownItemOld/DropdownItemOld.js +107 -0
  125. package/es/components/Dropdown/ui/DropdownItemOld/DropdownItemOld.js.map +1 -0
  126. package/es/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_size/base.js +1 -1
  127. package/es/components/Dropdown/ui/DropdownItemOld/variations/_size/base.js.map +1 -0
  128. package/es/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_view/base.js +1 -1
  129. package/es/components/Dropdown/ui/DropdownItemOld/variations/_view/base.js.map +1 -0
  130. package/es/components/Dropdown/utils/index.js +16 -2
  131. package/es/components/Dropdown/utils/index.js.map +1 -1
  132. package/es/components/Pagination/Pagination.css +14 -7
  133. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +14 -7
  134. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +1 -1
  135. package/es/components/Select/Select.css +14 -7
  136. package/es/components/Select/ui/SelectDivider/SelectDivider.css +15 -6
  137. package/es/components/Select/ui/SelectDivider/SelectDivider.js +2 -2
  138. package/es/components/Select/ui/SelectFooter/SelectFooter.css +15 -6
  139. package/es/components/Select/ui/SelectFooter/SelectFooter.js +2 -2
  140. package/es/components/Select/ui/SelectGroup/SelectGroup.css +15 -6
  141. package/es/components/Select/ui/SelectGroup/SelectGroup.js +2 -2
  142. package/es/components/Select/ui/SelectHeader/SelectHeader.css +15 -6
  143. package/es/components/Select/ui/SelectHeader/SelectHeader.js +2 -2
  144. package/es/components/Select/ui/SelectItem/SelectItem.css +16 -7
  145. package/es/components/Select/ui/SelectItem/SelectItem.js +3 -3
  146. package/es/components/Select/ui/SelectItem/SelectItem.js.map +1 -1
  147. package/es/components/Select/ui/SelectItem/SelectItem.styles.js +2 -2
  148. package/es/components/Select/ui/SelectItem/SelectItem.styles.js.map +1 -1
  149. package/es/components/Select/ui/SelectItem/{SelectItem.styles_6h17aw.css → SelectItem.styles_vk39mp.css} +1 -1
  150. package/es/components/TextField/TextField.js +3 -3
  151. package/es/components/TextField/TextField.js.map +1 -1
  152. package/es/components/_Icon/Icon.assets/DisclosureRight.js +1 -2
  153. package/es/components/_Icon/Icon.assets/DisclosureRight.js.map +1 -1
  154. package/es/index.css +18 -8
  155. package/es/index.js +4 -1
  156. package/es/index.js.map +1 -1
  157. package/package.json +3 -3
  158. package/styled-components/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.js +91 -2
  159. package/styled-components/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.styles.js +27 -7
  160. package/styled-components/cjs/components/Combobox/utils/index.js +23 -0
  161. package/styled-components/cjs/components/Dropdown/Dropdown.js +140 -54
  162. package/styled-components/cjs/components/Dropdown/Dropdown.styles.js +22 -7
  163. package/styled-components/cjs/components/Dropdown/Dropdown.tokens.js +26 -23
  164. package/styled-components/cjs/components/Dropdown/hooks/useHashMaps.js +29 -0
  165. package/styled-components/cjs/components/Dropdown/hooks/useKeyboardNavigation.js +199 -0
  166. package/styled-components/cjs/components/Dropdown/index.js +9 -1
  167. package/styled-components/cjs/components/Dropdown/reducers/focusedPathReducer.js +40 -0
  168. package/styled-components/cjs/components/Dropdown/reducers/pathReducer.js +44 -0
  169. package/styled-components/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js +114 -0
  170. package/styled-components/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.type.js +5 -0
  171. package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +77 -105
  172. package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +83 -18
  173. package/styled-components/cjs/components/Dropdown/ui/DropdownItemOld/DropdownItem.styles.js +33 -0
  174. package/styled-components/cjs/components/Dropdown/ui/DropdownItemOld/DropdownItem.type.js +5 -0
  175. package/styled-components/cjs/components/Dropdown/ui/DropdownItemOld/DropdownItemOld.js +119 -0
  176. package/styled-components/cjs/components/Dropdown/ui/index.js +19 -5
  177. package/styled-components/cjs/components/Dropdown/utils/index.js +15 -1
  178. package/styled-components/cjs/components/Dropdown/variations/_size/tokens.json +1 -9
  179. package/styled-components/cjs/components/Dropdown/variations/_view/tokens.json +1 -1
  180. package/styled-components/cjs/components/Select/ui/SelectItem/SelectItem.js +1 -1
  181. package/styled-components/cjs/components/Select/ui/SelectItem/SelectItem.styles.js +1 -1
  182. package/styled-components/cjs/components/TextField/TextField.js +4 -4
  183. package/styled-components/cjs/components/_Icon/Icon.assets/DisclosureRight.js +1 -2
  184. package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Dropdown.config.js +25 -0
  185. package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Dropdown.js +11 -0
  186. package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Dropdown.stories.tsx +292 -0
  187. package/styled-components/es/components/Combobox/ui/ComboboxItem/ComboboxItem.js +90 -3
  188. package/styled-components/es/components/Combobox/ui/ComboboxItem/ComboboxItem.styles.js +23 -6
  189. package/styled-components/es/components/Combobox/utils/index.js +15 -0
  190. package/styled-components/es/components/Dropdown/Dropdown.js +142 -55
  191. package/styled-components/es/components/Dropdown/Dropdown.styles.js +18 -5
  192. package/styled-components/es/components/Dropdown/Dropdown.tokens.js +26 -23
  193. package/styled-components/es/components/Dropdown/hooks/useHashMaps.js +23 -0
  194. package/styled-components/es/components/Dropdown/hooks/useKeyboardNavigation.js +193 -0
  195. package/styled-components/es/components/Dropdown/index.js +1 -0
  196. package/styled-components/es/components/Dropdown/reducers/focusedPathReducer.js +34 -0
  197. package/styled-components/es/components/Dropdown/reducers/pathReducer.js +38 -0
  198. package/styled-components/es/components/Dropdown/ui/DropdownInner/DropdownInner.js +108 -0
  199. package/styled-components/es/components/Dropdown/ui/DropdownInner/DropdownInner.type.js +1 -0
  200. package/styled-components/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +78 -107
  201. package/styled-components/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +80 -14
  202. package/styled-components/es/components/Dropdown/ui/DropdownItemOld/DropdownItem.styles.js +25 -0
  203. package/styled-components/es/components/Dropdown/ui/DropdownItemOld/DropdownItem.type.js +1 -0
  204. package/styled-components/es/components/Dropdown/ui/DropdownItemOld/DropdownItemOld.js +111 -0
  205. package/styled-components/es/components/Dropdown/ui/index.js +3 -1
  206. package/styled-components/es/components/Dropdown/utils/index.js +15 -1
  207. package/styled-components/es/components/Dropdown/variations/_size/tokens.json +1 -9
  208. package/styled-components/es/components/Dropdown/variations/_view/tokens.json +1 -1
  209. package/styled-components/es/components/Select/ui/SelectItem/SelectItem.js +2 -2
  210. package/styled-components/es/components/Select/ui/SelectItem/SelectItem.styles.js +1 -1
  211. package/styled-components/es/components/TextField/TextField.js +4 -4
  212. package/styled-components/es/components/_Icon/Icon.assets/DisclosureRight.js +1 -2
  213. package/styled-components/es/examples/plasma_b2c/components/Dropdown/Dropdown.config.js +19 -0
  214. package/styled-components/es/examples/plasma_b2c/components/Dropdown/Dropdown.js +5 -0
  215. package/styled-components/es/examples/plasma_b2c/components/Dropdown/Dropdown.stories.tsx +292 -0
  216. package/types/components/Combobox/ui/ComboboxItem/ComboboxItem.d.ts +15 -13
  217. package/types/components/Combobox/ui/ComboboxItem/ComboboxItem.d.ts.map +1 -1
  218. package/types/components/Combobox/ui/ComboboxItem/ComboboxItem.styles.d.ts +5 -1
  219. package/types/components/Combobox/ui/ComboboxItem/ComboboxItem.styles.d.ts.map +1 -1
  220. package/types/components/Combobox/ui/ComboboxItem/ComboboxItem.type.d.ts +59 -2
  221. package/types/components/Combobox/ui/ComboboxItem/ComboboxItem.type.d.ts.map +1 -1
  222. package/types/components/Combobox/utils/index.d.ts +4 -0
  223. package/types/components/Combobox/utils/index.d.ts.map +1 -0
  224. package/types/components/Dropdown/Dropdown.d.ts +4 -4
  225. package/types/components/Dropdown/Dropdown.d.ts.map +1 -1
  226. package/types/components/Dropdown/Dropdown.styles.d.ts +8 -1
  227. package/types/components/Dropdown/Dropdown.styles.d.ts.map +1 -1
  228. package/types/components/Dropdown/Dropdown.tokens.d.ts +24 -22
  229. package/types/components/Dropdown/Dropdown.tokens.d.ts.map +1 -1
  230. package/types/components/Dropdown/Dropdown.types.d.ts +64 -40
  231. package/types/components/Dropdown/Dropdown.types.d.ts.map +1 -1
  232. package/types/components/Dropdown/hooks/useHashMaps.d.ts +6 -0
  233. package/types/components/Dropdown/hooks/useHashMaps.d.ts.map +1 -0
  234. package/types/components/Dropdown/hooks/useKeyboardNavigation.d.ts +23 -0
  235. package/types/components/Dropdown/hooks/useKeyboardNavigation.d.ts.map +1 -0
  236. package/types/components/Dropdown/index.d.ts +3 -1
  237. package/types/components/Dropdown/index.d.ts.map +1 -1
  238. package/types/components/Dropdown/reducers/focusedPathReducer.d.ts +16 -0
  239. package/types/components/Dropdown/reducers/focusedPathReducer.d.ts.map +1 -0
  240. package/types/components/Dropdown/reducers/pathReducer.d.ts +20 -0
  241. package/types/components/Dropdown/reducers/pathReducer.d.ts.map +1 -0
  242. package/types/components/Dropdown/ui/DropdownInner/DropdownInner.d.ts +5 -0
  243. package/types/components/Dropdown/ui/DropdownInner/DropdownInner.d.ts.map +1 -0
  244. package/types/components/Dropdown/ui/DropdownInner/DropdownInner.type.d.ts +26 -0
  245. package/types/components/Dropdown/ui/DropdownInner/DropdownInner.type.d.ts.map +1 -0
  246. package/types/components/Dropdown/ui/DropdownItem/DropdownItem.d.ts +2 -56
  247. package/types/components/Dropdown/ui/DropdownItem/DropdownItem.d.ts.map +1 -1
  248. package/types/components/Dropdown/ui/DropdownItem/DropdownItem.styles.d.ts +5 -2
  249. package/types/components/Dropdown/ui/DropdownItem/DropdownItem.styles.d.ts.map +1 -1
  250. package/types/components/Dropdown/ui/DropdownItem/DropdownItem.type.d.ts +44 -38
  251. package/types/components/Dropdown/ui/DropdownItem/DropdownItem.type.d.ts.map +1 -1
  252. package/types/components/Dropdown/ui/DropdownItemOld/DropdownItem.styles.d.ts +7 -0
  253. package/types/components/Dropdown/ui/DropdownItemOld/DropdownItem.styles.d.ts.map +1 -0
  254. package/types/components/Dropdown/ui/DropdownItemOld/DropdownItem.type.d.ts +60 -0
  255. package/types/components/Dropdown/ui/DropdownItemOld/DropdownItem.type.d.ts.map +1 -0
  256. package/types/components/Dropdown/ui/DropdownItemOld/DropdownItemOld.d.ts +58 -0
  257. package/types/components/Dropdown/ui/DropdownItemOld/DropdownItemOld.d.ts.map +1 -0
  258. package/types/components/Dropdown/ui/DropdownItemOld/variations/_size/base.d.ts.map +1 -0
  259. package/types/components/Dropdown/ui/DropdownItemOld/variations/_view/base.d.ts.map +1 -0
  260. package/types/components/Dropdown/ui/index.d.ts +3 -1
  261. package/types/components/Dropdown/ui/index.d.ts.map +1 -1
  262. package/types/components/Dropdown/utils/index.d.ts +5 -2
  263. package/types/components/Dropdown/utils/index.d.ts.map +1 -1
  264. package/types/components/Select/ui/SelectItem/SelectItem.d.ts +2 -2
  265. package/types/components/Select/ui/SelectItem/SelectItem.d.ts.map +1 -1
  266. package/types/components/Select/ui/SelectItem/SelectItem.type.d.ts +2 -2
  267. package/types/components/Select/utils/index.d.ts +1 -1
  268. package/types/components/TextField/TextField.d.ts +2 -2
  269. package/types/components/TextField/TextField.d.ts.map +1 -1
  270. package/types/components/_Icon/Icon.assets/DisclosureRight.d.ts.map +1 -1
  271. package/types/examples/plasma_b2c/components/Dropdown/Dropdown.config.d.ts.map +1 -0
  272. package/types/examples/plasma_b2c/components/Dropdown/Dropdown.d.ts +13 -0
  273. package/types/examples/plasma_b2c/components/Dropdown/Dropdown.d.ts.map +1 -0
  274. package/types/examples/plasma_b2c/components/TextField/TextField.d.ts +2 -2
  275. package/types/examples/plasma_b2c/components/TextField/TextField.d.ts.map +1 -1
  276. package/types/examples/plasma_web/components/TextField/TextField.d.ts +2 -2
  277. package/types/examples/plasma_web/components/TextField/TextField.d.ts.map +1 -1
  278. package/types/examples/sds_engineer/components/TextField/TextField.d.ts +2 -2
  279. package/types/examples/sds_engineer/components/TextField/TextField.d.ts.map +1 -1
  280. package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.styles_936wgl.css +0 -1
  281. package/cjs/components/Dropdown/Dropdown.styles_1daxhqh.css +0 -2
  282. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles_1juhjtq.css +0 -4
  283. package/cjs/components/Dropdown/ui/DropdownItem/variations/_size/base.js.map +0 -1
  284. package/cjs/components/Dropdown/ui/DropdownItem/variations/_view/base.js.map +0 -1
  285. package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.styles_936wgl.css +0 -1
  286. package/es/components/Dropdown/Dropdown.styles_1daxhqh.css +0 -2
  287. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles_1juhjtq.css +0 -4
  288. package/es/components/Dropdown/ui/DropdownItem/variations/_size/base.js.map +0 -1
  289. package/es/components/Dropdown/ui/DropdownItem/variations/_view/base.js.map +0 -1
  290. package/styled-components/cjs/components/Dropdown/Dropdown.template-doc.mdx +0 -80
  291. package/styled-components/cjs/components/Dropdown/ui/DropdownItem/variations/_size/tokens.json +0 -19
  292. package/styled-components/cjs/components/Dropdown/ui/DropdownItem/variations/_view/tokens.json +0 -9
  293. package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.config.js +0 -27
  294. package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.js +0 -13
  295. package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.stories.tsx +0 -194
  296. package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.config.js +0 -27
  297. package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.js +0 -13
  298. package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.stories.tsx +0 -195
  299. package/styled-components/cjs/examples/plasma_web/components/Dropdown/Normal/Dropdown.config.js +0 -27
  300. package/styled-components/cjs/examples/plasma_web/components/Dropdown/Normal/Dropdown.js +0 -13
  301. package/styled-components/cjs/examples/plasma_web/components/Dropdown/Normal/Dropdown.stories.tsx +0 -195
  302. package/styled-components/cjs/examples/plasma_web/components/Dropdown/Tight/Dropdown.config.js +0 -27
  303. package/styled-components/cjs/examples/plasma_web/components/Dropdown/Tight/Dropdown.js +0 -13
  304. package/styled-components/cjs/examples/plasma_web/components/Dropdown/Tight/Dropdown.stories.tsx +0 -195
  305. package/styled-components/cjs/examples/sds_engineer/components/Dropdown/Dropdown.config.js +0 -22
  306. package/styled-components/cjs/examples/sds_engineer/components/Dropdown/Dropdown.js +0 -21
  307. package/styled-components/cjs/examples/sds_engineer/components/Dropdown/Dropdown.stories.tsx +0 -277
  308. package/styled-components/es/components/Dropdown/Dropdown.template-doc.mdx +0 -80
  309. package/styled-components/es/components/Dropdown/ui/DropdownItem/variations/_size/tokens.json +0 -19
  310. package/styled-components/es/components/Dropdown/ui/DropdownItem/variations/_view/tokens.json +0 -9
  311. package/styled-components/es/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.config.js +0 -21
  312. package/styled-components/es/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.js +0 -7
  313. package/styled-components/es/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.stories.tsx +0 -194
  314. package/styled-components/es/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.config.js +0 -21
  315. package/styled-components/es/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.js +0 -7
  316. package/styled-components/es/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.stories.tsx +0 -195
  317. package/styled-components/es/examples/plasma_web/components/Dropdown/Normal/Dropdown.config.js +0 -21
  318. package/styled-components/es/examples/plasma_web/components/Dropdown/Normal/Dropdown.js +0 -7
  319. package/styled-components/es/examples/plasma_web/components/Dropdown/Normal/Dropdown.stories.tsx +0 -195
  320. package/styled-components/es/examples/plasma_web/components/Dropdown/Tight/Dropdown.config.js +0 -21
  321. package/styled-components/es/examples/plasma_web/components/Dropdown/Tight/Dropdown.js +0 -7
  322. package/styled-components/es/examples/plasma_web/components/Dropdown/Tight/Dropdown.stories.tsx +0 -195
  323. package/styled-components/es/examples/sds_engineer/components/Dropdown/Dropdown.config.js +0 -16
  324. package/styled-components/es/examples/sds_engineer/components/Dropdown/Dropdown.js +0 -15
  325. package/styled-components/es/examples/sds_engineer/components/Dropdown/Dropdown.stories.tsx +0 -277
  326. package/types/components/Dropdown/ui/DropdownItem/variations/_size/base.d.ts.map +0 -1
  327. package/types/components/Dropdown/ui/DropdownItem/variations/_view/base.d.ts.map +0 -1
  328. package/types/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.config.d.ts.map +0 -1
  329. package/types/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.d.ts +0 -30
  330. package/types/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.d.ts.map +0 -1
  331. package/types/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.config.d.ts +0 -18
  332. package/types/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.config.d.ts.map +0 -1
  333. package/types/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.d.ts +0 -30
  334. package/types/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.d.ts.map +0 -1
  335. package/types/examples/plasma_web/components/Dropdown/Normal/Dropdown.config.d.ts +0 -18
  336. package/types/examples/plasma_web/components/Dropdown/Normal/Dropdown.config.d.ts.map +0 -1
  337. package/types/examples/plasma_web/components/Dropdown/Normal/Dropdown.d.ts +0 -30
  338. package/types/examples/plasma_web/components/Dropdown/Normal/Dropdown.d.ts.map +0 -1
  339. package/types/examples/plasma_web/components/Dropdown/Tight/Dropdown.config.d.ts +0 -18
  340. package/types/examples/plasma_web/components/Dropdown/Tight/Dropdown.config.d.ts.map +0 -1
  341. package/types/examples/plasma_web/components/Dropdown/Tight/Dropdown.d.ts +0 -30
  342. package/types/examples/plasma_web/components/Dropdown/Tight/Dropdown.d.ts.map +0 -1
  343. package/types/examples/sds_engineer/components/Dropdown/Dropdown.config.d.ts +0 -15
  344. package/types/examples/sds_engineer/components/Dropdown/Dropdown.config.d.ts.map +0 -1
  345. package/types/examples/sds_engineer/components/Dropdown/Dropdown.d.ts +0 -51
  346. package/types/examples/sds_engineer/components/Dropdown/Dropdown.d.ts.map +0 -1
  347. /package/cjs/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_size/base_x642ct.css +0 -0
  348. /package/cjs/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_view/base_x642ct.css +0 -0
  349. /package/es/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_size/base_x642ct.css +0 -0
  350. /package/es/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_view/base_x642ct.css +0 -0
  351. /package/styled-components/cjs/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_size/base.js +0 -0
  352. /package/styled-components/cjs/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_view/base.js +0 -0
  353. /package/styled-components/es/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_size/base.js +0 -0
  354. /package/styled-components/es/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_view/base.js +0 -0
  355. /package/types/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_size/base.d.ts +0 -0
  356. /package/types/components/Dropdown/ui/{DropdownItem → DropdownItemOld}/variations/_view/base.d.ts +0 -0
  357. /package/types/examples/plasma_b2c/components/Dropdown/{Normal/Dropdown.config.d.ts → Dropdown.config.d.ts} +0 -0
@@ -1,82 +1,169 @@
1
- var _excluded = ["id", "target", "children", "hasArrow", "role", "view", "size", "frame", "onToggle", "isFocusTrapped", "isOpen", "placement", "trigger", "offset", "preventOverflow", "closeOnOverlayClick", "closeOnEsc"];
1
+ var _excluded = ["items", "children", "placement", "offset", "closeOnOverlayClick", "onToggle", "size", "view", "itemRole", "className", "listWidth", "listHeight", "listOverflow", "closeOnSelect", "onHover", "onItemSelect", "onItemClick", "trigger", "variant", "hasArrow"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ 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."); }
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ 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; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3
9
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
- import React, { forwardRef, useRef } from 'react';
6
- import { useFocusTrap, useForkRef, useUniqId } from '@salutejs/plasma-core';
11
+ import React, { forwardRef, useReducer } from 'react';
12
+ import { cx } from '../../utils';
13
+ import { pathReducer } from './reducers/pathReducer';
14
+ import { focusedPathReducer } from './reducers/focusedPathReducer';
15
+ import { DropdownInner } from './ui';
7
16
  import { base as viewCSS } from './variations/_view/base';
8
17
  import { base as sizeCSS } from './variations/_size/base';
9
- import { StyledDropdown, StyledPopover } from './Dropdown.styles';
10
- import { getPlacements } from './utils';
18
+ import { Ul, StyledPopover, base } from './Dropdown.styles';
19
+ import { getPlacements, childrenWithProps } from './utils';
20
+ import { classes } from './Dropdown.tokens';
21
+ import { useKeyNavigation } from './hooks/useKeyboardNavigation';
22
+ import { useHashMaps } from './hooks/useHashMaps';
23
+
11
24
  /**
12
- * Выпадающий список без внешнего контроля видимости.
25
+ * Выпадающий список.
13
26
  */
14
27
  export var dropdownRoot = function dropdownRoot(Root) {
15
- return /*#__PURE__*/forwardRef(function (_ref, outerRootRef) {
16
- var id = _ref.id,
17
- target = _ref.target,
28
+ return /*#__PURE__*/forwardRef(function (_ref, ref) {
29
+ var items = _ref.items,
18
30
  children = _ref.children,
19
- hasArrow = _ref.hasArrow,
20
- role = _ref.role,
21
- view = _ref.view,
22
- size = _ref.size,
23
- frame = _ref.frame,
24
- _onToggle = _ref.onToggle,
25
- _ref$isFocusTrapped = _ref.isFocusTrapped,
26
- isFocusTrapped = _ref$isFocusTrapped === void 0 ? true : _ref$isFocusTrapped,
27
- _ref$isOpen = _ref.isOpen,
28
- isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
29
31
  _ref$placement = _ref.placement,
30
- placement = _ref$placement === void 0 ? 'auto' : _ref$placement,
31
- _ref$trigger = _ref.trigger,
32
- trigger = _ref$trigger === void 0 ? 'click' : _ref$trigger,
32
+ placement = _ref$placement === void 0 ? 'bottom' : _ref$placement,
33
33
  _ref$offset = _ref.offset,
34
- offset = _ref$offset === void 0 ? [0, 6] : _ref$offset,
35
- _ref$preventOverflow = _ref.preventOverflow,
36
- preventOverflow = _ref$preventOverflow === void 0 ? false : _ref$preventOverflow,
34
+ offset = _ref$offset === void 0 ? [0, 0] : _ref$offset,
37
35
  _ref$closeOnOverlayCl = _ref.closeOnOverlayClick,
38
- closeOnOverlayClick = _ref$closeOnOverlayCl === void 0 ? false : _ref$closeOnOverlayCl,
39
- _ref$closeOnEsc = _ref.closeOnEsc,
40
- closeOnEsc = _ref$closeOnEsc === void 0 ? false : _ref$closeOnEsc,
36
+ closeOnOverlayClick = _ref$closeOnOverlayCl === void 0 ? true : _ref$closeOnOverlayCl,
37
+ onToggle = _ref.onToggle,
38
+ size = _ref.size,
39
+ view = _ref.view,
40
+ _ref$itemRole = _ref.itemRole,
41
+ itemRole = _ref$itemRole === void 0 ? 'option' : _ref$itemRole,
42
+ className = _ref.className,
43
+ listWidth = _ref.listWidth,
44
+ listHeight = _ref.listHeight,
45
+ listOverflow = _ref.listOverflow,
46
+ _ref$closeOnSelect = _ref.closeOnSelect,
47
+ closeOnSelect = _ref$closeOnSelect === void 0 ? true : _ref$closeOnSelect,
48
+ onHover = _ref.onHover,
49
+ onItemSelect = _ref.onItemSelect,
50
+ onItemClick = _ref.onItemClick,
51
+ _ref$trigger = _ref.trigger,
52
+ trigger = _ref$trigger === void 0 ? 'click' : _ref$trigger,
53
+ _ref$variant = _ref.variant,
54
+ variant = _ref$variant === void 0 ? 'normal' : _ref$variant,
55
+ _ref$hasArrow = _ref.hasArrow,
56
+ hasArrow = _ref$hasArrow === void 0 ? true : _ref$hasArrow,
41
57
  rest = _objectWithoutProperties(_ref, _excluded);
42
- var uniqId = useUniqId();
43
- var innerId = id || uniqId;
44
- var rootRef = useRef(null);
45
- var dropdownRef = useRef(null);
46
- var handleRef = useForkRef(rootRef, outerRootRef);
47
- var trapRef = useFocusTrap(isOpen && isFocusTrapped);
48
- var dropdownForkRef = useForkRef(dropdownRef, trapRef);
49
- return /*#__PURE__*/React.createElement(StyledPopover, {
50
- role: role,
51
- isOpen: isOpen,
58
+ var _useReducer = useReducer(pathReducer, []),
59
+ _useReducer2 = _slicedToArray(_useReducer, 2),
60
+ path = _useReducer2[0],
61
+ dispatchPath = _useReducer2[1];
62
+ var _useReducer3 = useReducer(focusedPathReducer, []),
63
+ _useReducer4 = _slicedToArray(_useReducer3, 2),
64
+ focusedPath = _useReducer4[0],
65
+ dispatchFocusedPath = _useReducer4[1];
66
+ var _useHashMaps = useHashMaps(items),
67
+ _useHashMaps2 = _slicedToArray(_useHashMaps, 2),
68
+ pathMap = _useHashMaps2[0],
69
+ focusedToValueMap = _useHashMaps2[1];
70
+ var handleGlobalToggle = function handleGlobalToggle(opened, event) {
71
+ if (opened) {
72
+ dispatchPath({
73
+ type: 'opened_first_level'
74
+ });
75
+ } else {
76
+ dispatchFocusedPath({
77
+ type: 'reset'
78
+ });
79
+ dispatchPath({
80
+ type: 'reset'
81
+ });
82
+ }
83
+ if (onToggle) {
84
+ onToggle(opened, event);
85
+ }
86
+ };
87
+ var _useKeyNavigation = useKeyNavigation({
88
+ focusedPath: focusedPath,
89
+ dispatchFocusedPath: dispatchFocusedPath,
90
+ path: path,
91
+ dispatchPath: dispatchPath,
92
+ pathMap: pathMap,
93
+ focusedToValueMap: focusedToValueMap,
94
+ handleGlobalToggle: handleGlobalToggle,
95
+ closeOnSelect: closeOnSelect,
96
+ onItemSelect: onItemSelect,
97
+ onItemClick: onItemClick
98
+ }),
99
+ onKeyDown = _useKeyNavigation.onKeyDown;
100
+ var isCurrentListOpen = Boolean(path[0]);
101
+ var getActiveDescendant = function getActiveDescendant() {
102
+ var _focusedToValueMap$ge;
103
+ var focusedPathAsString = focusedPath.reduce(function (acc, n) {
104
+ return "".concat(acc, "/").concat(n);
105
+ }, '').replace(/^(\/)/, '');
106
+ return focusedToValueMap === null || focusedToValueMap === void 0 || (_focusedToValueMap$ge = focusedToValueMap.get(focusedPathAsString)) === null || _focusedToValueMap$ge === void 0 ? void 0 : _focusedToValueMap$ge.value.toString();
107
+ };
108
+ return /*#__PURE__*/React.createElement(Root, _extends({
109
+ className: cx(className, classes.dropdownRoot),
110
+ ref: ref,
111
+ view: view,
112
+ size: size,
113
+ items: items
114
+ }, rest), /*#__PURE__*/React.createElement(StyledPopover, {
115
+ isOpen: isCurrentListOpen,
52
116
  usePortal: false,
53
- onToggle: function onToggle(is, event) {
54
- return _onToggle === null || _onToggle === void 0 ? void 0 : _onToggle(is, event);
55
- },
56
- id: innerId,
57
- ref: dropdownForkRef,
58
- target: target,
117
+ onToggle: handleGlobalToggle,
59
118
  offset: offset,
60
- preventOverflow: preventOverflow,
61
- hasArrow: hasArrow,
62
119
  placement: getPlacements(placement),
63
120
  trigger: trigger,
64
121
  closeOnOverlayClick: closeOnOverlayClick,
65
- closeOnEsc: closeOnEsc,
66
- isFocusTrapped: isFocusTrapped,
67
- frame: frame
68
- }, /*#__PURE__*/React.createElement(Root, _extends({
69
- ref: handleRef,
70
- view: view,
71
- size: size
72
- }, rest), /*#__PURE__*/React.createElement(StyledDropdown, null, children)));
122
+ isFocusTrapped: false,
123
+ target: childrenWithProps(children, {
124
+ role: 'combobox',
125
+ 'aria-controls': 'listbox1',
126
+ 'aria-expanded': isCurrentListOpen,
127
+ 'aria-haspopup': 'listbox',
128
+ 'aria-activedescendant': getActiveDescendant(),
129
+ onKeyDown: onKeyDown
130
+ })
131
+ }, /*#__PURE__*/React.createElement(Ul, {
132
+ listHeight: listHeight,
133
+ listOverflow: listOverflow,
134
+ role: "listbox",
135
+ id: "listbox1",
136
+ listWidth: listWidth
137
+ }, items.map(function (item, index) {
138
+ return /*#__PURE__*/React.createElement(DropdownInner, {
139
+ key: "".concat(index, "/0"),
140
+ item: item,
141
+ currentLevel: 0,
142
+ focusedPath: focusedPath,
143
+ trigger: trigger,
144
+ path: path,
145
+ dispatchPath: dispatchPath,
146
+ index: index,
147
+ itemRole: itemRole,
148
+ listHeight: listHeight,
149
+ listOverflow: listOverflow,
150
+ handleGlobalToggle: handleGlobalToggle,
151
+ closeOnSelect: closeOnSelect,
152
+ onHover: onHover,
153
+ onItemSelect: onItemSelect,
154
+ onItemClick: onItemClick,
155
+ listWidth: listWidth,
156
+ variant: variant,
157
+ hasArrow: hasArrow
158
+ });
159
+ }))));
73
160
  });
74
161
  };
75
162
  export var dropdownConfig = {
76
163
  name: 'Dropdown',
77
164
  tag: 'div',
78
165
  layout: dropdownRoot,
79
- base: '',
166
+ base: base,
80
167
  variations: {
81
168
  view: {
82
169
  css: viewCSS
@@ -1,13 +1,26 @@
1
1
  import styled from 'styled-components';
2
+ import { css } from 'styled-components';
2
3
  import { component } from '../../engines';
3
4
  import { popoverConfig, popoverClasses } from '../Popover';
5
+ import { getCorrectHeight } from './utils';
4
6
  import { tokens } from './Dropdown.tokens';
5
-
6
- // issue #823
7
7
  var Popover = /*#__PURE__*/component(popoverConfig);
8
8
  export var StyledPopover = /*#__PURE__*/styled(Popover).withConfig({
9
9
  componentId: "plasma-new-hope__sc-13ezpo5-0"
10
- })([".", "{display:block;}"], /*#__PURE__*/String(popoverClasses.target));
11
- export var StyledDropdown = /*#__PURE__*/styled.div.withConfig({
10
+ })([".", ",.", "{display:block;}"], /*#__PURE__*/String(popoverClasses.wrapper), /*#__PURE__*/String(popoverClasses.target));
11
+ export var Ul = /*#__PURE__*/styled.ul.withConfig({
12
12
  componentId: "plasma-new-hope__sc-13ezpo5-1"
13
- })(["box-sizing:border-box;background:var(", ");box-shadow:var(", ");border-radius:var(", ");width:var(", ");height:var(", ");padding:var(", ") var(", ") var(", ") var(", ");"], tokens.background, tokens.boxShadow, tokens.borderRadius, tokens.width, tokens.height, tokens.paddingTop, tokens.paddingRight, tokens.paddingBottom, tokens.paddingLeft);
13
+ })(["box-sizing:border-box;background:var(", ");box-shadow:var(", ");border-radius:var(", ");width:", ";height:", ";overflow:", ";margin:", ";padding:var(", ");"], tokens.background, tokens.boxShadow, tokens.borderRadius, function (_ref) {
14
+ var listWidth = _ref.listWidth;
15
+ return listWidth || "var(".concat(tokens.width, ")");
16
+ }, function (_ref2) {
17
+ var listHeight = _ref2.listHeight;
18
+ return listHeight ? getCorrectHeight(listHeight) : 'auto';
19
+ }, function (_ref3) {
20
+ var listOverflow = _ref3.listOverflow;
21
+ return listOverflow || 'initial';
22
+ }, function (_ref4) {
23
+ var isInnerUl = _ref4.isInnerUl;
24
+ return isInnerUl ? "calc(var(".concat(tokens.padding, ") * -1) 0 0 var(").concat(tokens.padding, ")") : 0;
25
+ }, tokens.padding);
26
+ export var base = /*#__PURE__*/css(["display:inline-block;"]);
@@ -1,45 +1,36 @@
1
1
  export var classes = {
2
- dropdownItemIsSelected: 'dropdown-item-is-selected',
3
- dropdownItemIsDisabled: 'dropdown-item-is-disabled'
2
+ dropdownRoot: 'dropdown-root',
3
+ dropdownItemIsFocused: 'dropdown-item-is-focused',
4
+ dropdownItemIsDisabled: 'dropdown-item-is-disabled',
5
+ dropdownItemIsActive: 'dropdown-item-is-active',
6
+ dropdownItemIsSelected: 'dropdownItemIsSelected'
4
7
  };
5
8
  export var tokens = {
6
9
  background: '--plasma-dropdown-background',
7
10
  boxShadow: '--plasma-dropdown-box-shadow',
8
11
  width: '--plasma-dropdown-width',
9
- height: '--plasma-dropdown-height',
10
12
  borderRadius: '--plasma-dropdown-border-radius',
11
- paddingTop: '--plasma-dropdown-padding-top',
12
- paddingRight: '--plasma-dropdown-padding-right',
13
- paddingBottom: '--plasma-dropdown-padding-bottom',
14
- paddingLeft: '--plasma-dropdown-padding-left',
13
+ padding: '--plasma-dropdown-padding',
14
+ disclosureIconColor: '--plasma-dropdown-disclosure-icon-color',
15
15
  itemBackground: '--plasma-dropdown-item-background',
16
16
  itemColor: '--plasma-dropdown-item-color',
17
17
  itemBackgroundHover: '--plasma-dropdown-item-background-hover',
18
- itemBackgroundSelected: '--plasma-dropdown-item-background-selected',
19
- itemColorSelected: '--plasma-dropdown-item-color-selected',
20
- itemBackgroundSelectedHover: '--plasma-dropdown-item-background-selected-hover',
21
- itemColorSelectedHover: '--plasma-dropdown-item-color-selected-hover',
22
- itemWidth: '--plasma-dropdown-item-width',
23
- itemHeight: '--plasma-dropdown-item-height',
24
18
  itemBorderRadius: '--plasma-dropdown-item-border-radius',
25
19
  itemPaddingTop: '--plasma-dropdown-item-padding-top',
20
+ itemPaddingTopTight: '--plasma-dropdown-item-padding-top-tight',
26
21
  itemPaddingRight: '--plasma-dropdown-item-padding-right',
27
22
  itemPaddingBottom: '--plasma-dropdown-item-padding-bottom',
23
+ itemPaddingBottomTight: '--plasma-dropdown-item-padding-bottom-tight',
28
24
  itemPaddingLeft: '--plasma-dropdown-item-padding-left',
29
- itemMarginTop: '--plasma-dropdown-item-margin-top',
30
- itemMarginRight: '--plasma-dropdown-item-margin-right',
31
- itemMarginBottom: '--plasma-dropdown-item-margin-bottom',
32
- itemMarginLeft: '--plasma-dropdown-item-margin-left',
33
25
  itemFontFamily: '--plasma-dropdown-item-font-family',
34
26
  itemFontSize: '--plasma-dropdown-item-font-size',
35
27
  itemFontStyle: '--plasma-dropdown-item-font-style',
36
28
  itemFontWeightBold: '--plasma-dropdown-item-letter-spacing',
37
29
  itemFontLetterSpacing: '--plasma-dropdown-item-line-height',
38
30
  itemFontLineHeight: '--plasma-dropdown-item-font-weight',
39
- itemContentLeftColor: '--plasma-dropdown-item-content-left-color',
40
- itemContentRightColor: '--plasma-dropdown-item-content-right-color',
41
- itemContentLeftWidth: '--plasma-dropdown-item-content-left-width',
42
- itemContentRightWidth: '--plasma-dropdown-item-content-right-width',
31
+ disabledOpacity: '--plasma-dropdown-disabled-opacity',
32
+ focusColor: '--plasma-dropdown-focus-color',
33
+ // TODO: Remove below tokens as soon as they are no longer needed
43
34
  footerBackground: '--plasma-dropdown-footer-background',
44
35
  footerWidth: '--plasma-dropdown-footer-width',
45
36
  footerHeight: '--plasma-dropdown-footer-height',
@@ -107,6 +98,18 @@ export var tokens = {
107
98
  groupLabelMarginRight: '--plasma-dropdown-group-label-margin-right',
108
99
  groupLabelMarginBottom: '--plasma-dropdown-group-label-margin-bottom',
109
100
  groupLabelMarginLeft: '--plasma-dropdown-group-label-margin-left',
110
- disabledOpacity: '--plasma-dropdown-disabled-opacity',
111
- focusColor: '--plasma-dropdown-focus-color'
101
+ itemBackgroundSelected: '--plasma-dropdown-item-background-selected',
102
+ itemColorSelected: '--plasma-dropdown-item-color-selected',
103
+ itemBackgroundSelectedHover: '--plasma-dropdown-item-background-selected-hover',
104
+ itemColorSelectedHover: '--plasma-dropdown-item-color-selected-hover',
105
+ itemContentLeftColor: '--plasma-dropdown-item-content-left-color',
106
+ itemContentRightColor: '--plasma-dropdown-item-content-right-color',
107
+ itemWidth: '--plasma-dropdown-item-width',
108
+ itemHeight: '--plasma-dropdown-item-height',
109
+ itemMarginTop: '--plasma-dropdown-item-margin-top',
110
+ itemMarginRight: '--plasma-dropdown-item-margin-right',
111
+ itemMarginBottom: '--plasma-dropdown-item-margin-bottom',
112
+ itemMarginLeft: '--plasma-dropdown-item-margin-left',
113
+ itemContentLeftWidth: '--plasma-dropdown-item-content-left-width',
114
+ itemContentRightWidth: '--plasma-dropdown-item-content-right-width'
112
115
  };
@@ -0,0 +1,23 @@
1
+ import { useMemo } from 'react';
2
+ export var useHashMaps = function useHashMaps(items) {
3
+ return useMemo(function () {
4
+ var pathMap = new Map();
5
+ var focusedToValueMap = new Map();
6
+ pathMap.set('root', items.length);
7
+ var rec = function rec(items) {
8
+ var prevIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
9
+ items.forEach(function (item, index) {
10
+ var value = item.value,
11
+ innerItems = item.items;
12
+ var currIndex = "".concat(prevIndex, "/").concat(index).replace(/^(\/)/, '');
13
+ focusedToValueMap.set(currIndex, item);
14
+ if (innerItems) {
15
+ pathMap.set(value, innerItems.length);
16
+ rec(innerItems, currIndex);
17
+ }
18
+ });
19
+ };
20
+ rec(items);
21
+ return [pathMap, focusedToValueMap];
22
+ }, [items]);
23
+ };
@@ -0,0 +1,193 @@
1
+ var getFurtherPath = function getFurtherPath(focusedPath, focusedToValueMap) {
2
+ var focusedPathAsString = focusedPath.reduce(function (acc, n) {
3
+ return "".concat(acc, "/").concat(n);
4
+ }, '').replace(/^(\/)/, '');
5
+ return focusedToValueMap.get(focusedPathAsString);
6
+ };
7
+ export var useKeyNavigation = function useKeyNavigation(_ref) {
8
+ var focusedPath = _ref.focusedPath,
9
+ dispatchFocusedPath = _ref.dispatchFocusedPath,
10
+ path = _ref.path,
11
+ dispatchPath = _ref.dispatchPath,
12
+ pathMap = _ref.pathMap,
13
+ focusedToValueMap = _ref.focusedToValueMap,
14
+ handleGlobalToggle = _ref.handleGlobalToggle,
15
+ closeOnSelect = _ref.closeOnSelect,
16
+ onItemSelect = _ref.onItemSelect,
17
+ onItemClick = _ref.onItemClick;
18
+ var currentLength = pathMap.get(path === null || path === void 0 ? void 0 : path[path.length - 1]) || 0;
19
+ var currentIndex = (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[focusedPath.length - 1]) || 0;
20
+ var onKeyDown = function onKeyDown(event) {
21
+ var code = event.code;
22
+ if (code === 'ArrowUp') {
23
+ if (focusedPath.length) {
24
+ var newIndex = currentIndex <= 0 ? currentLength - 1 : currentIndex - 1;
25
+ dispatchFocusedPath({
26
+ type: 'change_last_focus',
27
+ value: newIndex
28
+ });
29
+ } else {
30
+ dispatchPath({
31
+ type: 'opened_first_level'
32
+ });
33
+ dispatchFocusedPath({
34
+ type: 'set_initial_focus'
35
+ });
36
+ handleGlobalToggle(true, event);
37
+ }
38
+ }
39
+ if (code === 'ArrowDown') {
40
+ if (focusedPath.length) {
41
+ var _newIndex = currentIndex + 1 >= currentLength ? 0 : currentIndex + 1;
42
+ dispatchFocusedPath({
43
+ type: 'change_last_focus',
44
+ value: _newIndex
45
+ });
46
+ } else {
47
+ dispatchPath({
48
+ type: 'opened_first_level'
49
+ });
50
+ dispatchFocusedPath({
51
+ type: 'set_initial_focus'
52
+ });
53
+ handleGlobalToggle(true, event);
54
+ }
55
+ }
56
+ if (code === 'ArrowLeft') {
57
+ if (focusedPath.length) {
58
+ dispatchPath({
59
+ type: 'removed_last_level'
60
+ });
61
+ dispatchFocusedPath({
62
+ type: 'return_prev_focus'
63
+ });
64
+ }
65
+ if (focusedPath.length === 1) {
66
+ handleGlobalToggle(false, event);
67
+ }
68
+ }
69
+ if (code === 'ArrowRight') {
70
+ if (focusedPath.length) {
71
+ var currentItem = getFurtherPath(focusedPath, focusedToValueMap);
72
+ if (currentItem !== null && currentItem !== void 0 && currentItem.items) {
73
+ dispatchPath({
74
+ type: 'added_next_level',
75
+ value: currentItem.value.toString()
76
+ });
77
+ dispatchFocusedPath({
78
+ type: 'add_focus',
79
+ value: 0
80
+ });
81
+ }
82
+ }
83
+ }
84
+ if (code === 'Enter' || code === 'Space') {
85
+ event.preventDefault();
86
+ if (path[0]) {
87
+ var _currentItem = getFurtherPath(focusedPath, focusedToValueMap);
88
+ if (_currentItem !== null && _currentItem !== void 0 && _currentItem.disabled || _currentItem !== null && _currentItem !== void 0 && _currentItem.isDisabled) return;
89
+ if (_currentItem !== null && _currentItem !== void 0 && _currentItem.items) {
90
+ dispatchPath({
91
+ type: 'added_next_level',
92
+ value: _currentItem.value.toString()
93
+ });
94
+ dispatchFocusedPath({
95
+ type: 'add_focus',
96
+ value: 0
97
+ });
98
+ } else {
99
+ if (closeOnSelect) {
100
+ handleGlobalToggle(false, event);
101
+ }
102
+ if (onItemSelect && _currentItem) {
103
+ onItemSelect(_currentItem, event);
104
+ }
105
+ if (onItemClick && _currentItem) {
106
+ onItemClick(_currentItem, event);
107
+ }
108
+ }
109
+ } else {
110
+ dispatchPath({
111
+ type: 'opened_first_level'
112
+ });
113
+ dispatchFocusedPath({
114
+ type: 'set_initial_focus'
115
+ });
116
+ }
117
+ }
118
+ if (code === 'Tab' || code === 'Escape') {
119
+ dispatchFocusedPath({
120
+ type: 'reset'
121
+ });
122
+ dispatchPath({
123
+ type: 'reset'
124
+ });
125
+ handleGlobalToggle(false, event);
126
+ }
127
+ if (code === 'Home') {
128
+ if (path[0]) {
129
+ dispatchFocusedPath({
130
+ type: 'change_last_focus',
131
+ value: 0
132
+ });
133
+ } else {
134
+ dispatchPath({
135
+ type: 'opened_first_level'
136
+ });
137
+ dispatchFocusedPath({
138
+ type: 'set_initial_focus'
139
+ });
140
+ handleGlobalToggle(true, event);
141
+ }
142
+ }
143
+ if (code === 'End') {
144
+ if (path[0]) {
145
+ dispatchFocusedPath({
146
+ type: 'change_last_focus',
147
+ value: currentLength - 1
148
+ });
149
+ } else {
150
+ dispatchPath({
151
+ type: 'opened_first_level'
152
+ });
153
+ dispatchFocusedPath({
154
+ type: 'change_last_focus',
155
+ value: (pathMap.get('root') || 0) - 1
156
+ });
157
+ handleGlobalToggle(true, event);
158
+ }
159
+ }
160
+ if (code === 'PageUp') {
161
+ if (path[0]) {
162
+ if (currentIndex <= 10) {
163
+ dispatchFocusedPath({
164
+ type: 'set_initial_focus'
165
+ });
166
+ } else {
167
+ dispatchFocusedPath({
168
+ type: 'change_last_focus',
169
+ value: currentIndex - 10
170
+ });
171
+ }
172
+ }
173
+ }
174
+ if (code === 'PageDown') {
175
+ if (path[0]) {
176
+ if (currentLength - currentIndex <= 10) {
177
+ dispatchFocusedPath({
178
+ type: 'change_last_focus',
179
+ value: currentLength - 1
180
+ });
181
+ } else {
182
+ dispatchFocusedPath({
183
+ type: 'change_last_focus',
184
+ value: currentIndex + 10
185
+ });
186
+ }
187
+ }
188
+ }
189
+ };
190
+ return {
191
+ onKeyDown: onKeyDown
192
+ };
193
+ };
@@ -1,3 +1,4 @@
1
1
  export { dropdownRoot, dropdownConfig } from './Dropdown';
2
2
  export { classes as dropdownClasses, tokens as dropdownTokens } from './Dropdown.tokens';
3
+ export { useKeyNavigation as useDropdownKeyNavigation } from './hooks/useKeyboardNavigation';
3
4
  export * from './ui';
@@ -0,0 +1,34 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ export function focusedPathReducer(state, action) {
8
+ switch (action.type) {
9
+ case 'reset':
10
+ {
11
+ return [];
12
+ }
13
+ case 'set_initial_focus':
14
+ {
15
+ return [0];
16
+ }
17
+ case 'change_last_focus':
18
+ {
19
+ return [].concat(_toConsumableArray(state.slice(0, -1)), [action.value]);
20
+ }
21
+ case 'add_focus':
22
+ {
23
+ return [].concat(_toConsumableArray(state), [action.value]);
24
+ }
25
+ case 'return_prev_focus':
26
+ {
27
+ return _toConsumableArray(state.slice(0, -1));
28
+ }
29
+ default:
30
+ {
31
+ return state;
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,38 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ export function pathReducer(state, action) {
8
+ switch (action.type) {
9
+ case 'reset':
10
+ {
11
+ return [];
12
+ }
13
+ case 'opened_first_level':
14
+ {
15
+ return ['root'];
16
+ }
17
+ case 'added_next_level':
18
+ {
19
+ return [].concat(_toConsumableArray(state), [action.value]);
20
+ }
21
+ case 'removed_last_level':
22
+ {
23
+ return _toConsumableArray(state.slice(0, -1));
24
+ }
25
+ case 'changed_on_level':
26
+ {
27
+ return [].concat(_toConsumableArray(state.slice(0, action.level)), [action.value]);
28
+ }
29
+ case 'cut_by_level':
30
+ {
31
+ return state.slice(0, action.level);
32
+ }
33
+ default:
34
+ {
35
+ return state;
36
+ }
37
+ }
38
+ }