@doist/reactist 10.0.0 → 11.0.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 (562) hide show
  1. package/dist/reactist.cjs.development.js +3083 -1766
  2. package/dist/reactist.cjs.development.js.map +1 -1
  3. package/dist/reactist.cjs.production.min.js +1 -1
  4. package/dist/reactist.cjs.production.min.js.map +1 -1
  5. package/es/_virtual/_rollupPluginBabelHelpers.js +34 -20
  6. package/es/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
  7. package/es/components/{button/button.js → deprecated-button/deprecated-button.js} +8 -3
  8. package/es/components/deprecated-button/deprecated-button.js.map +1 -0
  9. package/es/components/{button → deprecated-button}/index.js +1 -1
  10. package/es/components/{button → deprecated-button}/index.js.map +0 -0
  11. package/es/components/{loading/loading.js → deprecated-loading/deprecated-loading.js} +3 -1
  12. package/es/components/deprecated-loading/deprecated-loading.js.map +1 -0
  13. package/es/components/{modal/modal.js → deprecated-modal/deprecated-modal.js} +14 -6
  14. package/es/components/deprecated-modal/deprecated-modal.js.map +1 -0
  15. package/es/components/{modal → deprecated-modal}/index.js +1 -1
  16. package/es/components/deprecated-modal/index.js.map +1 -0
  17. package/es/components/dropdown/dropdown.js +5 -3
  18. package/es/components/dropdown/dropdown.js.map +1 -1
  19. package/es/components/key-capturer/key-capturer.js +1 -1
  20. package/es/components/key-capturer/key-capturer.js.map +1 -1
  21. package/es/components/keyboard-shortcut/keyboard-shortcut.js +3 -2
  22. package/es/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
  23. package/es/components/menu/menu.js +51 -29
  24. package/es/components/menu/menu.js.map +1 -1
  25. package/es/components/notification/notification.js +9 -4
  26. package/es/components/notification/notification.js.map +1 -1
  27. package/es/components/popover/popover.js +1 -1
  28. package/es/components/popover/popover.js.map +1 -1
  29. package/es/components/popover/positioning-utils.js.map +1 -1
  30. package/es/components/progress-bar/progress-bar.js +8 -2
  31. package/es/components/progress-bar/progress-bar.js.map +1 -1
  32. package/es/components/select/select.js +4 -2
  33. package/es/components/select/select.js.map +1 -1
  34. package/es/components/time/time-utils.js.map +1 -1
  35. package/es/components/time/time.js +1 -1
  36. package/es/components/time/time.js.map +1 -1
  37. package/es/components/tooltip/tooltip.js +4 -2
  38. package/es/components/tooltip/tooltip.js.map +1 -1
  39. package/es/hooks/use-previous/use-previous.js +26 -0
  40. package/es/hooks/use-previous/use-previous.js.map +1 -0
  41. package/es/index.js +32 -13
  42. package/es/index.js.map +1 -1
  43. package/es/new-components/alert/alert.js +38 -0
  44. package/es/new-components/alert/alert.js.map +1 -0
  45. package/es/new-components/alert/alert.module.css.js +4 -0
  46. package/es/new-components/alert/alert.module.css.js.map +1 -0
  47. package/es/new-components/base-button/base-button.js +72 -0
  48. package/es/new-components/base-button/base-button.js.map +1 -0
  49. package/es/new-components/base-button/base-button.module.css.js +4 -0
  50. package/es/new-components/base-button/base-button.module.css.js.map +1 -0
  51. package/es/new-components/base-field/base-field.js +65 -0
  52. package/es/new-components/base-field/base-field.js.map +1 -0
  53. package/es/new-components/base-field/base-field.module.css.js +4 -0
  54. package/es/new-components/base-field/base-field.module.css.js.map +1 -0
  55. package/es/new-components/box/box.js +75 -0
  56. package/es/new-components/box/box.js.map +1 -0
  57. package/es/new-components/box/box.module.css.js +4 -0
  58. package/es/new-components/box/box.module.css.js.map +1 -0
  59. package/es/new-components/box/margin.module.css.js +4 -0
  60. package/es/new-components/box/margin.module.css.js.map +1 -0
  61. package/es/new-components/box/padding.module.css.js +4 -0
  62. package/es/new-components/box/padding.module.css.js.map +1 -0
  63. package/es/new-components/box/width.module.css.js +4 -0
  64. package/es/new-components/box/width.module.css.js.map +1 -0
  65. package/es/new-components/button/button.js +41 -0
  66. package/es/new-components/button/button.js.map +1 -0
  67. package/es/new-components/button-link/button-link.js +42 -0
  68. package/es/new-components/button-link/button-link.js.map +1 -0
  69. package/es/new-components/checkbox-field/checkbox-field.js +88 -0
  70. package/es/new-components/checkbox-field/checkbox-field.js.map +1 -0
  71. package/es/new-components/checkbox-field/checkbox-field.module.css.js +4 -0
  72. package/es/new-components/checkbox-field/checkbox-field.module.css.js.map +1 -0
  73. package/es/new-components/checkbox-field/checkbox-icon.js +61 -0
  74. package/es/new-components/checkbox-field/checkbox-icon.js.map +1 -0
  75. package/es/new-components/columns/columns.js +59 -0
  76. package/es/new-components/columns/columns.js.map +1 -0
  77. package/es/new-components/columns/columns.module.css.js +4 -0
  78. package/es/new-components/columns/columns.module.css.js.map +1 -0
  79. package/es/new-components/common-helpers.js +24 -0
  80. package/es/new-components/common-helpers.js.map +1 -0
  81. package/es/new-components/divider/divider.js +21 -0
  82. package/es/new-components/divider/divider.js.map +1 -0
  83. package/es/new-components/divider/divider.module.css.js +4 -0
  84. package/es/new-components/divider/divider.module.css.js.map +1 -0
  85. package/es/new-components/heading/heading.js +37 -0
  86. package/es/new-components/heading/heading.js.map +1 -0
  87. package/es/new-components/heading/heading.module.css.js +4 -0
  88. package/es/new-components/heading/heading.module.css.js.map +1 -0
  89. package/es/new-components/hidden/hidden.js +55 -0
  90. package/es/new-components/hidden/hidden.js.map +1 -0
  91. package/es/new-components/hidden/hidden.module.css.js +4 -0
  92. package/es/new-components/hidden/hidden.module.css.js.map +1 -0
  93. package/es/new-components/hidden-visually/hidden-visually.js +22 -0
  94. package/es/new-components/hidden-visually/hidden-visually.js.map +1 -0
  95. package/es/new-components/hidden-visually/hidden-visually.module.css.js +4 -0
  96. package/es/new-components/hidden-visually/hidden-visually.module.css.js.map +1 -0
  97. package/es/new-components/icons/alert-icon.js +77 -0
  98. package/es/new-components/icons/alert-icon.js.map +1 -0
  99. package/es/new-components/icons/close-icon.js +15 -0
  100. package/es/new-components/icons/close-icon.js.map +1 -0
  101. package/es/new-components/icons/password-hidden-icon.js +29 -0
  102. package/es/new-components/icons/password-hidden-icon.js.map +1 -0
  103. package/es/new-components/icons/password-visible-icon.js +22 -0
  104. package/es/new-components/icons/password-visible-icon.js.map +1 -0
  105. package/es/new-components/inline/inline.js +36 -0
  106. package/es/new-components/inline/inline.js.map +1 -0
  107. package/es/new-components/inline/inline.module.css.js +4 -0
  108. package/es/new-components/inline/inline.module.css.js.map +1 -0
  109. package/es/new-components/loading/loading.js +37 -0
  110. package/es/new-components/loading/loading.js.map +1 -0
  111. package/es/new-components/modal/modal.js +224 -0
  112. package/es/new-components/modal/modal.js.map +1 -0
  113. package/es/new-components/modal/modal.module.css.js +4 -0
  114. package/es/new-components/modal/modal.module.css.js.map +1 -0
  115. package/es/new-components/notice/notice.js +28 -0
  116. package/es/new-components/notice/notice.js.map +1 -0
  117. package/es/new-components/notice/notice.module.css.js +4 -0
  118. package/es/new-components/notice/notice.module.css.js.map +1 -0
  119. package/es/new-components/password-field/password-field.js +76 -0
  120. package/es/new-components/password-field/password-field.js.map +1 -0
  121. package/es/new-components/password-field/password-field.module.css.js +4 -0
  122. package/es/new-components/password-field/password-field.module.css.js.map +1 -0
  123. package/es/new-components/responsive-props.js +75 -0
  124. package/es/new-components/responsive-props.js.map +1 -0
  125. package/es/new-components/select-field/select-field.js +53 -0
  126. package/es/new-components/select-field/select-field.js.map +1 -0
  127. package/es/new-components/select-field/select-field.module.css.js +4 -0
  128. package/es/new-components/select-field/select-field.module.css.js.map +1 -0
  129. package/es/new-components/spinner/spinner.js +26 -0
  130. package/es/new-components/spinner/spinner.js.map +1 -0
  131. package/es/new-components/spinner/spinner.module.css.js +4 -0
  132. package/es/new-components/spinner/spinner.module.css.js.map +1 -0
  133. package/es/new-components/stack/stack.js +42 -0
  134. package/es/new-components/stack/stack.js.map +1 -0
  135. package/es/new-components/stack/stack.module.css.js +4 -0
  136. package/es/new-components/stack/stack.module.css.js.map +1 -0
  137. package/es/new-components/switch-field/switch-field.js +96 -0
  138. package/es/new-components/switch-field/switch-field.js.map +1 -0
  139. package/es/new-components/switch-field/switch-field.module.css.js +4 -0
  140. package/es/new-components/switch-field/switch-field.module.css.js.map +1 -0
  141. package/es/new-components/tabs/tabs.js +147 -0
  142. package/es/new-components/tabs/tabs.js.map +1 -0
  143. package/es/new-components/tabs/tabs.module.css.js +4 -0
  144. package/es/new-components/tabs/tabs.module.css.js.map +1 -0
  145. package/es/new-components/text/text.js +36 -0
  146. package/es/new-components/text/text.js.map +1 -0
  147. package/es/new-components/text/text.module.css.js +4 -0
  148. package/es/new-components/text/text.module.css.js.map +1 -0
  149. package/es/new-components/text-area/text-area.js +34 -0
  150. package/es/new-components/text-area/text-area.js.map +1 -0
  151. package/es/new-components/text-area/text-area.module.css.js +4 -0
  152. package/es/new-components/text-area/text-area.module.css.js.map +1 -0
  153. package/es/new-components/text-field/text-field.js +41 -0
  154. package/es/new-components/text-field/text-field.js.map +1 -0
  155. package/es/new-components/text-field/text-field.module.css.js +4 -0
  156. package/es/new-components/text-field/text-field.module.css.js.map +1 -0
  157. package/es/new-components/text-link/text-link.js +27 -0
  158. package/es/new-components/text-link/text-link.js.map +1 -0
  159. package/es/new-components/text-link/text-link.module.css.js +4 -0
  160. package/es/new-components/text-link/text-link.module.css.js.map +1 -0
  161. package/es/utils/polymorphism.js +17 -0
  162. package/es/utils/polymorphism.js.map +1 -0
  163. package/lib/_virtual/_rollupPluginBabelHelpers.js +1 -1
  164. package/lib/components/avatar/avatar.test.d.ts +1 -0
  165. package/lib/components/checkbox/checkbox.test.d.ts +1 -0
  166. package/lib/components/color-picker/color-picker.test.d.ts +1 -0
  167. package/lib/components/{button/button.d.ts → deprecated-button/deprecated-button.d.ts} +7 -1
  168. package/lib/components/deprecated-button/deprecated-button.js +2 -0
  169. package/lib/components/deprecated-button/deprecated-button.js.map +1 -0
  170. package/lib/components/deprecated-button/deprecated-button.test.d.ts +1 -0
  171. package/lib/components/deprecated-button/index.d.ts +4 -0
  172. package/lib/components/{button → deprecated-button}/index.js +1 -1
  173. package/lib/components/{button → deprecated-button}/index.js.map +0 -0
  174. package/lib/components/{loading/loading.d.ts → deprecated-loading/deprecated-loading.d.ts} +2 -1
  175. package/lib/components/{loading/loading.js → deprecated-loading/deprecated-loading.js} +1 -1
  176. package/lib/components/deprecated-loading/deprecated-loading.js.map +1 -0
  177. package/lib/components/deprecated-loading/deprecated-loading.test.d.ts +1 -0
  178. package/lib/components/deprecated-loading/index.d.ts +1 -0
  179. package/lib/components/{modal/modal.d.ts → deprecated-modal/deprecated-modal.d.ts} +7 -2
  180. package/lib/components/deprecated-modal/deprecated-modal.js +2 -0
  181. package/lib/components/deprecated-modal/deprecated-modal.js.map +1 -0
  182. package/lib/components/deprecated-modal/deprecated-modal.test.d.ts +1 -0
  183. package/lib/components/{modal → deprecated-modal}/index.d.ts +2 -2
  184. package/lib/components/deprecated-modal/index.js +2 -0
  185. package/lib/components/deprecated-modal/index.js.map +1 -0
  186. package/lib/components/dropdown/dropdown.js +1 -1
  187. package/lib/components/dropdown/dropdown.js.map +1 -1
  188. package/lib/components/dropdown/dropdown.test.d.ts +1 -0
  189. package/lib/components/input/input.test.d.ts +1 -0
  190. package/lib/components/key-capturer/key-capturer.js +1 -1
  191. package/lib/components/key-capturer/key-capturer.test.d.ts +1 -0
  192. package/lib/components/keyboard-shortcut/keyboard-shortcut.js +1 -1
  193. package/lib/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
  194. package/lib/components/keyboard-shortcut/keyboard-shortcut.test.d.ts +1 -0
  195. package/lib/components/menu/menu.d.ts +8 -10
  196. package/lib/components/menu/menu.js +1 -1
  197. package/lib/components/menu/menu.js.map +1 -1
  198. package/lib/components/menu/menu.test.d.ts +1 -0
  199. package/lib/components/notification/notification.d.ts +4 -2
  200. package/lib/components/notification/notification.js +1 -1
  201. package/lib/components/notification/notification.js.map +1 -1
  202. package/lib/components/notification/notification.test.d.ts +1 -0
  203. package/lib/components/popover/popover.js +1 -1
  204. package/lib/components/popover/popover.test.d.ts +1 -0
  205. package/lib/components/progress-bar/progress-bar.d.ts +3 -1
  206. package/lib/components/progress-bar/progress-bar.js +1 -1
  207. package/lib/components/progress-bar/progress-bar.js.map +1 -1
  208. package/lib/components/progress-bar/progress-bar.test.d.ts +1 -0
  209. package/lib/components/select/select.js +1 -1
  210. package/lib/components/select/select.js.map +1 -1
  211. package/lib/components/select/select.test.d.ts +1 -0
  212. package/lib/components/time/time.js +1 -1
  213. package/lib/components/time/time.test.d.ts +1 -0
  214. package/lib/components/tooltip/tooltip.js +1 -1
  215. package/lib/components/tooltip/tooltip.js.map +1 -1
  216. package/lib/components/tooltip/tooltip.test.d.ts +1 -0
  217. package/lib/hooks/use-previous/index.d.ts +1 -0
  218. package/lib/hooks/use-previous/use-previous.d.ts +15 -0
  219. package/lib/hooks/use-previous/use-previous.js +2 -0
  220. package/lib/hooks/use-previous/use-previous.js.map +1 -0
  221. package/lib/index.d.ts +32 -12
  222. package/lib/index.js +1 -1
  223. package/lib/new-components/alert/alert.d.ts +17 -0
  224. package/lib/new-components/alert/alert.js +2 -0
  225. package/lib/new-components/alert/alert.js.map +1 -0
  226. package/lib/new-components/alert/alert.module.css.js +2 -0
  227. package/lib/new-components/alert/alert.module.css.js.map +1 -0
  228. package/lib/new-components/alert/index.d.ts +1 -0
  229. package/lib/new-components/base-button/base-button.d.ts +65 -0
  230. package/lib/new-components/base-button/base-button.js +2 -0
  231. package/lib/new-components/base-button/base-button.js.map +1 -0
  232. package/lib/new-components/base-button/base-button.module.css.js +2 -0
  233. package/lib/new-components/base-button/base-button.module.css.js.map +1 -0
  234. package/lib/new-components/base-button/index.d.ts +1 -0
  235. package/lib/new-components/base-field/base-field.d.ts +64 -0
  236. package/lib/new-components/base-field/base-field.js +2 -0
  237. package/lib/new-components/base-field/base-field.js.map +1 -0
  238. package/lib/new-components/base-field/base-field.module.css.js +2 -0
  239. package/lib/new-components/base-field/base-field.module.css.js.map +1 -0
  240. package/lib/new-components/base-field/index.d.ts +1 -0
  241. package/lib/new-components/box/box.d.ts +57 -0
  242. package/lib/new-components/box/box.js +2 -0
  243. package/lib/new-components/box/box.js.map +1 -0
  244. package/lib/new-components/box/box.module.css.js +2 -0
  245. package/lib/new-components/box/box.module.css.js.map +1 -0
  246. package/lib/new-components/box/box.test.d.ts +1 -0
  247. package/lib/new-components/box/index.d.ts +1 -0
  248. package/lib/new-components/box/margin.module.css.js +2 -0
  249. package/lib/new-components/box/margin.module.css.js.map +1 -0
  250. package/lib/new-components/box/padding.module.css.js +2 -0
  251. package/lib/new-components/box/padding.module.css.js.map +1 -0
  252. package/lib/new-components/box/width.module.css.js +2 -0
  253. package/lib/new-components/box/width.module.css.js.map +1 -0
  254. package/lib/new-components/button/button.d.ts +48 -0
  255. package/lib/new-components/button/button.js +2 -0
  256. package/lib/new-components/button/button.js.map +1 -0
  257. package/lib/new-components/button/button.test.d.ts +1 -0
  258. package/lib/new-components/button/index.d.ts +1 -0
  259. package/lib/new-components/button-link/button-link-story-wrapper.d.ts +7 -0
  260. package/lib/new-components/button-link/button-link.d.ts +15 -0
  261. package/lib/new-components/button-link/button-link.js +2 -0
  262. package/lib/new-components/button-link/button-link.js.map +1 -0
  263. package/lib/new-components/button-link/button-link.test.d.ts +1 -0
  264. package/lib/new-components/button-link/index.d.ts +1 -0
  265. package/lib/new-components/checkbox-field/checkbox-field.d.ts +21 -0
  266. package/lib/new-components/checkbox-field/checkbox-field.js +2 -0
  267. package/lib/new-components/checkbox-field/checkbox-field.js.map +1 -0
  268. package/lib/new-components/checkbox-field/checkbox-field.module.css.js +2 -0
  269. package/lib/new-components/checkbox-field/checkbox-field.module.css.js.map +1 -0
  270. package/lib/new-components/checkbox-field/checkbox-field.test.d.ts +1 -0
  271. package/lib/new-components/checkbox-field/checkbox-icon.d.ts +8 -0
  272. package/lib/new-components/checkbox-field/checkbox-icon.js +2 -0
  273. package/lib/new-components/checkbox-field/checkbox-icon.js.map +1 -0
  274. package/lib/new-components/checkbox-field/index.d.ts +1 -0
  275. package/lib/new-components/columns/columns.d.ts +20 -0
  276. package/lib/new-components/columns/columns.js +2 -0
  277. package/lib/new-components/columns/columns.js.map +1 -0
  278. package/lib/new-components/columns/columns.module.css.js +2 -0
  279. package/lib/new-components/columns/columns.module.css.js.map +1 -0
  280. package/lib/new-components/columns/columns.test.d.ts +1 -0
  281. package/lib/new-components/columns/index.d.ts +1 -0
  282. package/lib/new-components/common-helpers.d.ts +2 -0
  283. package/lib/new-components/common-helpers.js +2 -0
  284. package/lib/new-components/common-helpers.js.map +1 -0
  285. package/lib/new-components/common-types.d.ts +23 -0
  286. package/lib/new-components/divider/divider.d.ts +8 -0
  287. package/lib/new-components/divider/divider.js +2 -0
  288. package/lib/new-components/divider/divider.js.map +1 -0
  289. package/lib/new-components/divider/divider.module.css.js +2 -0
  290. package/lib/new-components/divider/divider.module.css.js.map +1 -0
  291. package/lib/new-components/divider/index.d.ts +1 -0
  292. package/lib/new-components/heading/heading.d.ts +115 -0
  293. package/lib/new-components/heading/heading.js +2 -0
  294. package/lib/new-components/heading/heading.js.map +1 -0
  295. package/lib/new-components/heading/heading.module.css.js +2 -0
  296. package/lib/new-components/heading/heading.module.css.js.map +1 -0
  297. package/lib/new-components/heading/heading.test.d.ts +1 -0
  298. package/lib/new-components/heading/index.d.ts +1 -0
  299. package/lib/new-components/hidden/hidden.d.ts +49 -0
  300. package/lib/new-components/hidden/hidden.js +2 -0
  301. package/lib/new-components/hidden/hidden.js.map +1 -0
  302. package/lib/new-components/hidden/hidden.module.css.js +2 -0
  303. package/lib/new-components/hidden/hidden.module.css.js.map +1 -0
  304. package/lib/new-components/hidden/hidden.test.d.ts +1 -0
  305. package/lib/new-components/hidden/index.d.ts +1 -0
  306. package/lib/new-components/hidden-visually/hidden-visually.d.ts +11 -0
  307. package/lib/new-components/hidden-visually/hidden-visually.js +2 -0
  308. package/lib/new-components/hidden-visually/hidden-visually.js.map +1 -0
  309. package/lib/new-components/hidden-visually/hidden-visually.module.css.js +2 -0
  310. package/lib/new-components/hidden-visually/hidden-visually.module.css.js.map +1 -0
  311. package/lib/new-components/hidden-visually/hidden-visually.test.d.ts +1 -0
  312. package/lib/new-components/hidden-visually/index.d.ts +1 -0
  313. package/lib/new-components/icons/alert-icon.d.ts +6 -0
  314. package/lib/new-components/icons/alert-icon.js +2 -0
  315. package/lib/new-components/icons/alert-icon.js.map +1 -0
  316. package/lib/new-components/icons/close-icon.d.ts +3 -0
  317. package/lib/new-components/icons/close-icon.js +2 -0
  318. package/lib/new-components/icons/close-icon.js.map +1 -0
  319. package/lib/new-components/icons/password-hidden-icon.d.ts +3 -0
  320. package/lib/new-components/icons/password-hidden-icon.js +2 -0
  321. package/lib/new-components/icons/password-hidden-icon.js.map +1 -0
  322. package/lib/new-components/icons/password-visible-icon.d.ts +3 -0
  323. package/lib/new-components/icons/password-visible-icon.js +2 -0
  324. package/lib/new-components/icons/password-visible-icon.js.map +1 -0
  325. package/lib/new-components/inline/index.d.ts +1 -0
  326. package/lib/new-components/inline/inline.d.ts +12 -0
  327. package/lib/new-components/inline/inline.js +2 -0
  328. package/lib/new-components/inline/inline.js.map +1 -0
  329. package/lib/new-components/inline/inline.module.css.js +2 -0
  330. package/lib/new-components/inline/inline.module.css.js.map +1 -0
  331. package/lib/new-components/inline/inline.test.d.ts +1 -0
  332. package/lib/new-components/loading/index.d.ts +1 -0
  333. package/lib/new-components/loading/loading.d.ts +27 -0
  334. package/lib/new-components/loading/loading.js +2 -0
  335. package/lib/new-components/loading/loading.js.map +1 -0
  336. package/lib/new-components/loading/loading.test.d.ts +1 -0
  337. package/lib/new-components/modal/index.d.ts +1 -0
  338. package/lib/new-components/modal/modal-stories-components.d.ts +35 -0
  339. package/lib/new-components/modal/modal.d.ts +155 -0
  340. package/lib/new-components/modal/modal.js +2 -0
  341. package/lib/new-components/modal/modal.js.map +1 -0
  342. package/lib/new-components/modal/modal.module.css.js +2 -0
  343. package/lib/new-components/modal/modal.module.css.js.map +1 -0
  344. package/lib/new-components/modal/modal.test.d.ts +1 -0
  345. package/lib/new-components/notice/index.d.ts +1 -0
  346. package/lib/new-components/notice/notice.d.ts +10 -0
  347. package/lib/new-components/notice/notice.js +2 -0
  348. package/lib/new-components/notice/notice.js.map +1 -0
  349. package/lib/new-components/notice/notice.module.css.js +2 -0
  350. package/lib/new-components/notice/notice.module.css.js.map +1 -0
  351. package/lib/new-components/password-field/index.d.ts +1 -0
  352. package/lib/new-components/password-field/password-field.d.ts +8 -0
  353. package/lib/new-components/password-field/password-field.js +2 -0
  354. package/lib/new-components/password-field/password-field.js.map +1 -0
  355. package/lib/new-components/password-field/password-field.module.css.js +2 -0
  356. package/lib/new-components/password-field/password-field.module.css.js.map +1 -0
  357. package/lib/new-components/password-field/password-field.test.d.ts +1 -0
  358. package/lib/new-components/responsive-props.d.ts +44 -0
  359. package/lib/new-components/responsive-props.js +2 -0
  360. package/lib/new-components/responsive-props.js.map +1 -0
  361. package/lib/new-components/select-field/index.d.ts +1 -0
  362. package/lib/new-components/select-field/select-field.d.ts +6 -0
  363. package/lib/new-components/select-field/select-field.js +2 -0
  364. package/lib/new-components/select-field/select-field.js.map +1 -0
  365. package/lib/new-components/select-field/select-field.module.css.js +2 -0
  366. package/lib/new-components/select-field/select-field.module.css.js.map +1 -0
  367. package/lib/new-components/select-field/select-field.test.d.ts +1 -0
  368. package/lib/new-components/spinner/index.d.ts +1 -0
  369. package/lib/new-components/spinner/spinner.d.ts +5 -0
  370. package/lib/new-components/spinner/spinner.js +2 -0
  371. package/lib/new-components/spinner/spinner.js.map +1 -0
  372. package/lib/new-components/spinner/spinner.module.css.js +2 -0
  373. package/lib/new-components/spinner/spinner.module.css.js.map +1 -0
  374. package/lib/new-components/stack/index.d.ts +1 -0
  375. package/lib/new-components/stack/stack.d.ts +15 -0
  376. package/lib/new-components/stack/stack.js +2 -0
  377. package/lib/new-components/stack/stack.js.map +1 -0
  378. package/lib/new-components/stack/stack.module.css.js +2 -0
  379. package/lib/new-components/stack/stack.module.css.js.map +1 -0
  380. package/lib/new-components/stack/stack.test.d.ts +1 -0
  381. package/lib/new-components/switch-field/index.d.ts +1 -0
  382. package/lib/new-components/switch-field/switch-field.d.ts +13 -0
  383. package/lib/new-components/switch-field/switch-field.js +2 -0
  384. package/lib/new-components/switch-field/switch-field.js.map +1 -0
  385. package/lib/new-components/switch-field/switch-field.module.css.js +2 -0
  386. package/lib/new-components/switch-field/switch-field.module.css.js.map +1 -0
  387. package/lib/new-components/switch-field/switch-field.test.d.ts +1 -0
  388. package/lib/new-components/tabs/index.d.ts +1 -0
  389. package/lib/new-components/tabs/tabs.d.ts +92 -0
  390. package/lib/new-components/tabs/tabs.js +2 -0
  391. package/lib/new-components/tabs/tabs.js.map +1 -0
  392. package/lib/new-components/tabs/tabs.module.css.js +2 -0
  393. package/lib/new-components/tabs/tabs.module.css.js.map +1 -0
  394. package/lib/new-components/tabs/tabs.test.d.ts +1 -0
  395. package/lib/new-components/test-helpers.d.ts +9 -0
  396. package/lib/new-components/text/index.d.ts +1 -0
  397. package/lib/new-components/text/text.d.ts +47 -0
  398. package/lib/new-components/text/text.js +2 -0
  399. package/lib/new-components/text/text.js.map +1 -0
  400. package/lib/new-components/text/text.module.css.js +2 -0
  401. package/lib/new-components/text/text.module.css.js.map +1 -0
  402. package/lib/new-components/text/text.test.d.ts +1 -0
  403. package/lib/new-components/text-area/index.d.ts +1 -0
  404. package/lib/new-components/text-area/text-area.d.ts +6 -0
  405. package/lib/new-components/text-area/text-area.js +2 -0
  406. package/lib/new-components/text-area/text-area.js.map +1 -0
  407. package/lib/new-components/text-area/text-area.module.css.js +2 -0
  408. package/lib/new-components/text-area/text-area.module.css.js.map +1 -0
  409. package/lib/new-components/text-field/index.d.ts +1 -0
  410. package/lib/new-components/text-field/text-field.d.ts +9 -0
  411. package/lib/new-components/text-field/text-field.js +2 -0
  412. package/lib/new-components/text-field/text-field.js.map +1 -0
  413. package/lib/new-components/text-field/text-field.module.css.js +2 -0
  414. package/lib/new-components/text-field/text-field.module.css.js.map +1 -0
  415. package/lib/new-components/text-field/text-field.test.d.ts +1 -0
  416. package/lib/new-components/text-link/index.d.ts +1 -0
  417. package/lib/new-components/text-link/text-link.d.ts +5 -0
  418. package/lib/new-components/text-link/text-link.js +2 -0
  419. package/lib/new-components/text-link/text-link.js.map +1 -0
  420. package/lib/new-components/text-link/text-link.module.css.js +2 -0
  421. package/lib/new-components/text-link/text-link.module.css.js.map +1 -0
  422. package/lib/utils/polymorphism.d.ts +151 -0
  423. package/lib/utils/polymorphism.js +2 -0
  424. package/lib/utils/polymorphism.js.map +1 -0
  425. package/package.json +25 -16
  426. package/styles/alert.css +6 -0
  427. package/styles/alert.module.css.css +1 -0
  428. package/styles/base-button.css +7 -0
  429. package/styles/base-button.module.css.css +1 -0
  430. package/styles/base-field.css +8 -0
  431. package/styles/base-field.module.css.css +1 -0
  432. package/styles/box.css +4 -0
  433. package/styles/box.module.css.css +1 -0
  434. package/styles/checkbox-field.css +6 -0
  435. package/styles/checkbox-field.module.css.css +1 -0
  436. package/styles/color-picker.css +2 -2
  437. package/styles/columns.css +5 -0
  438. package/styles/columns.module.css.css +1 -0
  439. package/styles/{button.css → deprecated-button.css} +2 -2
  440. package/styles/deprecated-loading.css +1 -0
  441. package/styles/deprecated-modal.css +1 -0
  442. package/styles/divider.css +5 -0
  443. package/styles/divider.module.css.css +1 -0
  444. package/styles/dropdown.css +3 -3
  445. package/styles/heading.css +5 -0
  446. package/styles/heading.module.css.css +1 -0
  447. package/styles/hidden-visually.css +5 -0
  448. package/styles/hidden-visually.module.css.css +1 -0
  449. package/styles/hidden.css +5 -0
  450. package/styles/hidden.module.css.css +1 -0
  451. package/styles/inline.css +5 -0
  452. package/styles/inline.module.css.css +1 -0
  453. package/styles/loading.css +5 -1
  454. package/styles/margin.module.css.css +1 -0
  455. package/styles/modal.css +11 -1
  456. package/styles/modal.module.css.css +1 -0
  457. package/styles/notice.css +6 -0
  458. package/styles/notice.module.css.css +1 -0
  459. package/styles/padding.module.css.css +1 -0
  460. package/styles/password-field.css +11 -0
  461. package/styles/password-field.module.css.css +1 -0
  462. package/styles/progress-bar.css +5 -0
  463. package/styles/reactist.css +33 -11
  464. package/styles/select-field.css +9 -0
  465. package/styles/select-field.module.css.css +1 -0
  466. package/styles/spinner.module.css.css +1 -0
  467. package/styles/stack.css +6 -0
  468. package/styles/stack.module.css.css +1 -0
  469. package/styles/switch-field.css +10 -0
  470. package/styles/switch-field.module.css.css +1 -0
  471. package/styles/tabs.css +6 -1
  472. package/styles/tabs.module.css.css +1 -0
  473. package/styles/text-area.css +9 -0
  474. package/styles/text-area.module.css.css +1 -0
  475. package/styles/text-field.css +9 -0
  476. package/styles/text-field.module.css.css +1 -0
  477. package/styles/text-link.css +5 -0
  478. package/styles/text-link.module.css.css +1 -0
  479. package/styles/text.css +5 -0
  480. package/styles/text.module.css.css +1 -0
  481. package/styles/time.css +2 -2
  482. package/styles/width.module.css.css +1 -0
  483. package/es/components/button/button.js.map +0 -1
  484. package/es/components/error-message/error-message.js +0 -90
  485. package/es/components/error-message/error-message.js.map +0 -1
  486. package/es/components/error-message/index.js +0 -6
  487. package/es/components/error-message/index.js.map +0 -1
  488. package/es/components/icon/icon.js +0 -96
  489. package/es/components/icon/icon.js.map +0 -1
  490. package/es/components/icon/index.js +0 -6
  491. package/es/components/icon/index.js.map +0 -1
  492. package/es/components/icons/ThinQuestionMarkIcon.svg.js +0 -24
  493. package/es/components/icons/ThinQuestionMarkIcon.svg.js.map +0 -1
  494. package/es/components/icons/ThreeDotsIcon.svg.js +0 -40
  495. package/es/components/icons/ThreeDotsIcon.svg.js.map +0 -1
  496. package/es/components/loading/index.js +0 -6
  497. package/es/components/loading/index.js.map +0 -1
  498. package/es/components/loading/loading.js.map +0 -1
  499. package/es/components/menu/type-helpers.js +0 -9
  500. package/es/components/menu/type-helpers.js.map +0 -1
  501. package/es/components/modal/index.js.map +0 -1
  502. package/es/components/modal/modal.js.map +0 -1
  503. package/es/components/range-input/index.js +0 -6
  504. package/es/components/range-input/index.js.map +0 -1
  505. package/es/components/range-input/range-input.js +0 -55
  506. package/es/components/range-input/range-input.js.map +0 -1
  507. package/es/components/tabs/tabs.js +0 -123
  508. package/es/components/tabs/tabs.js.map +0 -1
  509. package/es/components/tip/index.js +0 -6
  510. package/es/components/tip/index.js.map +0 -1
  511. package/es/components/tip/tip.js +0 -30
  512. package/es/components/tip/tip.js.map +0 -1
  513. package/lib/components/button/button.js +0 -2
  514. package/lib/components/button/button.js.map +0 -1
  515. package/lib/components/button/index.d.ts +0 -4
  516. package/lib/components/error-message/error-message.d.ts +0 -23
  517. package/lib/components/error-message/error-message.js +0 -2
  518. package/lib/components/error-message/error-message.js.map +0 -1
  519. package/lib/components/error-message/index.d.ts +0 -2
  520. package/lib/components/error-message/index.js +0 -2
  521. package/lib/components/error-message/index.js.map +0 -1
  522. package/lib/components/icon/icon.d.ts +0 -31
  523. package/lib/components/icon/icon.js +0 -2
  524. package/lib/components/icon/icon.js.map +0 -1
  525. package/lib/components/icon/index.d.ts +0 -2
  526. package/lib/components/icon/index.js +0 -2
  527. package/lib/components/icon/index.js.map +0 -1
  528. package/lib/components/icons/ThinQuestionMarkIcon.svg.js +0 -2
  529. package/lib/components/icons/ThinQuestionMarkIcon.svg.js.map +0 -1
  530. package/lib/components/icons/ThreeDotsIcon.svg.js +0 -2
  531. package/lib/components/icons/ThreeDotsIcon.svg.js.map +0 -1
  532. package/lib/components/loading/index.d.ts +0 -2
  533. package/lib/components/loading/index.js +0 -2
  534. package/lib/components/loading/index.js.map +0 -1
  535. package/lib/components/loading/loading.js.map +0 -1
  536. package/lib/components/menu/type-helpers.d.ts +0 -25
  537. package/lib/components/menu/type-helpers.js +0 -2
  538. package/lib/components/menu/type-helpers.js.map +0 -1
  539. package/lib/components/modal/index.js +0 -2
  540. package/lib/components/modal/index.js.map +0 -1
  541. package/lib/components/modal/modal.js +0 -2
  542. package/lib/components/modal/modal.js.map +0 -1
  543. package/lib/components/range-input/index.d.ts +0 -2
  544. package/lib/components/range-input/index.js +0 -2
  545. package/lib/components/range-input/index.js.map +0 -1
  546. package/lib/components/range-input/range-input.d.ts +0 -25
  547. package/lib/components/range-input/range-input.js +0 -2
  548. package/lib/components/range-input/range-input.js.map +0 -1
  549. package/lib/components/tabs/index.d.ts +0 -1
  550. package/lib/components/tabs/tabs.d.ts +0 -33
  551. package/lib/components/tabs/tabs.js +0 -2
  552. package/lib/components/tabs/tabs.js.map +0 -1
  553. package/lib/components/tip/index.d.ts +0 -2
  554. package/lib/components/tip/index.js +0 -2
  555. package/lib/components/tip/index.js.map +0 -1
  556. package/lib/components/tip/tip.d.ts +0 -20
  557. package/lib/components/tip/tip.js +0 -2
  558. package/lib/components/tip/tip.js.map +0 -1
  559. package/styles/error-message.css +0 -1
  560. package/styles/icon.css +0 -2
  561. package/styles/range-input.css +0 -1
  562. package/styles/tip.css +0 -4
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import './modal.less';
2
+ import './deprecated-modal.less';
3
3
  declare type Props = {
4
4
  /** Additional css class applied to the Modal.Box. */
5
5
  className?: string;
@@ -12,10 +12,11 @@ declare type Props = {
12
12
  /** Close the Modal when clicking on the overlay. */
13
13
  closeOnOverlayClick: boolean;
14
14
  };
15
+ /** @deprecated */
15
16
  declare class Box extends React.Component<React.PropsWithChildren<Props>> {
16
17
  static displayName: string;
17
18
  static defaultProps: Props;
18
- constructor(props: Props, context: unknown);
19
+ componentDidMount(): void;
19
20
  componentWillUnmount(): void;
20
21
  _closeModal: () => void;
21
22
  _handleKeyDown: (event: Partial<KeyboardEvent>) => void;
@@ -30,6 +31,7 @@ declare type HeaderProps = {
30
31
  /** Function that is called right before the Modal unmounts itself. */
31
32
  beforeClose?: () => void;
32
33
  };
34
+ /** @deprecated */
33
35
  declare class Header extends React.Component<HeaderProps> {
34
36
  static displayName: string;
35
37
  static defaultProps: HeaderProps;
@@ -51,6 +53,7 @@ declare type BodyProps = {
51
53
  */
52
54
  showCloseIcon?: boolean;
53
55
  };
56
+ /** @deprecated */
54
57
  declare class Body extends React.Component<BodyProps> {
55
58
  static displayName: string;
56
59
  static defaultProps: BodyProps;
@@ -68,11 +71,13 @@ declare type ActionChildrenProps = {
68
71
  close?: boolean;
69
72
  onClick?: () => void;
70
73
  };
74
+ /** @deprecated */
71
75
  declare class Actions extends React.Component<ActionProps> {
72
76
  static displayName: string;
73
77
  _onClick(onClick: ActionChildrenProps['onClick']): void;
74
78
  render(): JSX.Element;
75
79
  }
80
+ /** @deprecated */
76
81
  declare type Modal = {
77
82
  Box: Box;
78
83
  Header: Header;
@@ -0,0 +1,2 @@
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../_virtual/_rollupPluginBabelHelpers.js"),n=e(require("react")),o=e(require("classnames")),r=e(require("react-dom")),l=require("../icons/CloseIcon.svg.js"),a=function(e){function l(){var t;return(t=e.apply(this,arguments)||this)._closeModal=function(){var e=document.getElementById("modal_box");r.unmountComponentAtNode(e)},t._handleKeyDown=function(e){27===e.keyCode&&(t._closeModal(),e.preventDefault&&e.preventDefault())},t._handleOverlayClick=function(e){e.target instanceof Element&&("reactist-overlay"===e.target.id||"reactist-overlay-inner"===e.target.id)&&t._closeModal()},t}t.inheritsLoose(l,e);var a=l.prototype;return a.componentDidMount=function(){window.addEventListener("keydown",this._handleKeyDown)},a.componentWillUnmount=function(){window.removeEventListener("keydown",this._handleKeyDown)},a.render=function(){var e=this.props,t=e.style,r=e.children,l=e.closeOnOverlayClick,a=o("reactist_modal_box",{large:e.large,medium:e.medium},this.props.className);return n.createElement("div",{className:"reactist_overlay",id:"reactist-overlay",onClick:l?this._handleOverlayClick:void 0},n.createElement("div",{className:"reactist_overlay_inner",id:"reactist-overlay-inner"},n.createElement("div",{style:t,className:a},r)))},l}(n.Component);a.displayName="Modal.Box",a.defaultProps={large:!1,closeOnOverlayClick:!1};var s=function(e){function o(){return e.apply(this,arguments)||this}t.inheritsLoose(o,e);var a=o.prototype;return a._closeModal=function(e){e.preventDefault(),"function"==typeof this.props.beforeClose&&this.props.beforeClose();var t=document.getElementById("modal_box");r.unmountComponentAtNode(t)},a.render=function(){return n.createElement("div",{className:"reactist_modal_box__header"},n.createElement("p",null,this.props.title&&n.createElement("span",{className:"title"},this.props.title),this.props.subtitle&&n.createElement("span",{className:"subtitle"},this.props.subtitle),this.props.children),n.createElement("a",{className:"close",onClick:this._closeModal.bind(this),href:"#"},n.createElement(l.default,null)))},o}(n.Component);s.displayName="Modal.Header";var i=function(e){function a(){return e.apply(this,arguments)||this}t.inheritsLoose(a,e);var s=a.prototype;return s._closeModal=function(e){e.preventDefault();var t=document.getElementById("modal_box");r.unmountComponentAtNode(t)},s.render=function(){var e=this.props,t=e.icon,r=e.children,a=e.style,s=e.showCloseIcon,i=o("reactist_modal_box__body",{plain:e.plain},this.props.className);return n.createElement("div",{className:i,style:a},s&&n.createElement("a",{className:"close",onClick:this._closeModal.bind(this),href:"#"},n.createElement(l.default,null)),t?n.createElement("div",{className:"dialog"},n.createElement("div",{className:"reactist_icon"},t),n.createElement("div",{className:"content"},r)):r)},a}(n.Component);i.displayName="Modal.Body",i.defaultProps={showCloseIcon:!1};var c=function(e){function o(){return e.apply(this,arguments)||this}t.inheritsLoose(o,e);var l=o.prototype;return l._onClick=function(e){e&&e();var t=document.getElementById("modal_box");r.unmountComponentAtNode(t)},l.render=function(){var e=this,t=n.Children.map(this.props.children,(function(t){var o;return null!=t&&null!==(o=t.props)&&void 0!==o&&o.close?n.cloneElement(t,{onClick:function(){return e._onClick(t.props.onClick)}}):t?n.cloneElement(t):n.createElement(n.Fragment,null)}));return n.createElement("div",{className:"reactist_modal_box__actions"},t)},o}(n.Component);c.displayName="Modal.Actions",exports.Actions=c,exports.Body=i,exports.Box=a,exports.Header=s;
2
+ //# sourceMappingURL=deprecated-modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated-modal.js","sources":["../../../src/components/deprecated-modal/deprecated-modal.tsx"],"sourcesContent":["import React from 'react'\nimport ReactDOM from 'react-dom'\nimport classnames from 'classnames'\n\nimport CloseIcon from '../icons/CloseIcon.svg'\n\nimport './deprecated-modal.less'\n\ntype Props = {\n /** Additional css class applied to the Modal.Box. */\n className?: string\n /** Sometimes a class name is not enough so you can use this to set the style directly. */\n style?: React.CSSProperties\n /** Large style. */\n large: boolean\n /** Medium size syle. */\n medium?: boolean\n /** Close the Modal when clicking on the overlay. */\n closeOnOverlayClick: boolean\n}\n\n/** @deprecated */\nclass Box extends React.Component<React.PropsWithChildren<Props>> {\n public static displayName: string\n public static defaultProps: Props\n\n componentDidMount() {\n window.addEventListener('keydown', this._handleKeyDown)\n }\n\n componentWillUnmount() {\n window.removeEventListener('keydown', this._handleKeyDown)\n }\n\n _closeModal = () => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const modalElement = document.getElementById('modal_box')!\n ReactDOM.unmountComponentAtNode(modalElement)\n }\n\n _handleKeyDown = (event: Partial<KeyboardEvent>) => {\n if (event.keyCode === 27) {\n // ESC\n this._closeModal()\n if (event.preventDefault) event.preventDefault()\n }\n }\n\n _handleOverlayClick = (event: React.MouseEvent<Element>) => {\n if (\n event.target instanceof Element &&\n (event.target.id === 'reactist-overlay' || event.target.id === 'reactist-overlay-inner')\n ) {\n this._closeModal()\n }\n }\n\n render() {\n const { large, medium, style, children, closeOnOverlayClick } = this.props\n\n const className = classnames('reactist_modal_box', { large, medium }, this.props.className)\n\n return (\n <div\n className=\"reactist_overlay\"\n id=\"reactist-overlay\"\n onClick={closeOnOverlayClick ? this._handleOverlayClick : undefined}\n >\n <div className=\"reactist_overlay_inner\" id=\"reactist-overlay-inner\">\n <div style={style} className={className}>\n {children}\n </div>\n </div>\n </div>\n )\n }\n}\nBox.displayName = 'Modal.Box'\nBox.defaultProps = {\n large: false,\n closeOnOverlayClick: false,\n}\n\ntype HeaderProps = {\n /** Title of the Modal.Header. */\n title?: string | React.ReactNode\n /** Subtitle of the Modal.Header. */\n subtitle?: string | React.ReactNode\n /** Function that is called right before the Modal unmounts itself. */\n beforeClose?: () => void\n}\n\n/** @deprecated */\nclass Header extends React.Component<HeaderProps> {\n public static displayName: string\n public static defaultProps: HeaderProps\n\n _closeModal(event: React.MouseEvent) {\n event.preventDefault()\n if (typeof this.props.beforeClose === 'function') {\n this.props.beforeClose()\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const modalElement = document.getElementById('modal_box')!\n ReactDOM.unmountComponentAtNode(modalElement)\n }\n\n render() {\n return (\n /* eslint-disable jsx-a11y/anchor-is-valid */\n <div className=\"reactist_modal_box__header\">\n <p>\n {this.props.title && <span className=\"title\">{this.props.title}</span>}\n {this.props.subtitle && <span className=\"subtitle\">{this.props.subtitle}</span>}\n {this.props.children}\n </p>\n <a className=\"close\" onClick={this._closeModal.bind(this)} href=\"#\">\n <CloseIcon />\n </a>\n </div>\n /* eslint-enable jsx-a11y/anchor-is-valid */\n )\n }\n}\nHeader.displayName = 'Modal.Header'\n\ntype BodyProps = {\n /** Display an icon (or basically any component) on the right hand side of the Modal.Body. */\n icon?: React.ReactNode\n /** Applies less styles on the body (e.g. no padding) */\n plain?: boolean\n /** Sometimes a class name is not enough so you can use this to set the style directly. */\n style?: React.CSSProperties\n /** Additionall css class applied to the Modal.Body. */\n className?: string\n /**\n * Render a close icon in the top right corner of the Modal.Body.\n * Recommended to use when no Modal.Header is used.\n */\n showCloseIcon?: boolean\n}\n\n/** @deprecated */\nclass Body extends React.Component<BodyProps> {\n public static displayName: string\n public static defaultProps: BodyProps\n\n _closeModal(event: React.MouseEvent) {\n event.preventDefault()\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const modalElement = document.getElementById('modal_box')!\n ReactDOM.unmountComponentAtNode(modalElement)\n }\n\n render() {\n const { icon, plain, children, style, showCloseIcon } = this.props\n const className = classnames('reactist_modal_box__body', { plain }, this.props.className)\n\n return (\n /* eslint-disable jsx-a11y/anchor-is-valid */\n <div className={className} style={style}>\n {showCloseIcon && (\n <a className=\"close\" onClick={this._closeModal.bind(this)} href=\"#\">\n <CloseIcon />\n </a>\n )}\n {icon ? (\n <div className=\"dialog\">\n <div className=\"reactist_icon\">{icon}</div>\n <div className=\"content\">{children}</div>\n </div>\n ) : (\n children\n )}\n </div>\n /* eslint-enable jsx-a11y/anchor-is-valid */\n )\n }\n}\nBody.displayName = 'Modal.Body'\nBody.defaultProps = {\n showCloseIcon: false,\n}\n\ntype ActionProps = {\n /**\n * Children to render inside the Modal.Actions. They can have an optional `close` property (boolean).\n * When that is supplied and set to true it will close the modal after the onClick function\n */\n children?: React.ReactNode\n}\n\ntype ActionChildrenProps = {\n close?: boolean\n onClick?: () => void\n}\n\n/** @deprecated */\nclass Actions extends React.Component<ActionProps> {\n public static displayName: string\n\n _onClick(onClick: ActionChildrenProps['onClick']) {\n if (onClick) {\n onClick()\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const modalElement = document.getElementById('modal_box')!\n ReactDOM.unmountComponentAtNode(modalElement)\n }\n\n render() {\n const children = React.Children.map(\n // see: https://github.com/microsoft/TypeScript/issues/21699\n // @ts-expect-error Children cannot be typed properly yet in React\n this.props.children,\n (child: React.ReactElement<ActionChildrenProps>) => {\n if (child?.props?.close) {\n return React.cloneElement(child, {\n onClick: () => this._onClick(child.props.onClick),\n })\n } else {\n return child ? React.cloneElement(child) : <></>\n }\n },\n )\n\n return <div className=\"reactist_modal_box__actions\">{children}</div>\n }\n}\n\nActions.displayName = 'Modal.Actions'\n\n/** @deprecated */\ntype Modal = {\n Box: Box\n Header: Header\n Body: Body\n Actions: Actions\n}\n\nexport type { Modal }\n\nexport { Box, Header, Body, Actions }\n"],"names":["Box","modalElement","document","getElementById","ReactDOM","unmountComponentAtNode","event","keyCode","_closeModal","preventDefault","target","Element","id","componentDidMount","window","addEventListener","this","_handleKeyDown","componentWillUnmount","removeEventListener","render","props","style","children","closeOnOverlayClick","className","classnames","large","medium","React","onClick","_handleOverlayClick","undefined","Component","displayName","defaultProps","Header","beforeClose","title","subtitle","bind","href","CloseIcon","Body","icon","showCloseIcon","plain","Actions","_onClick","Children","map","child","_child$props","close","cloneElement","_this2"],"mappings":"yTAsBMA,qFAYY,eAEJC,EAAeC,SAASC,eAAe,aAC7CC,EAASC,uBAAuBJ,qBAGnB,SAACK,GACQ,KAAlBA,EAAMC,YAEDC,cACDF,EAAMG,gBAAgBH,EAAMG,yCAIlB,SAACH,GAEfA,EAAMI,kBAAkBC,UACH,qBAApBL,EAAMI,OAAOE,IAAiD,2BAApBN,EAAMI,OAAOE,OAEnDJ,iEA3BbK,kBAAA,WACIC,OAAOC,iBAAiB,UAAWC,KAAKC,mBAG5CC,qBAAA,WACIJ,OAAOK,oBAAoB,UAAWH,KAAKC,mBA0B/CG,OAAA,iBACoEJ,KAAKK,MAA9CC,IAAAA,MAAOC,IAAAA,SAAUC,IAAAA,oBAElCC,EAAYC,EAAW,qBAAsB,CAAEC,QAF7CA,MAEoDC,SAF7CA,QAEuDZ,KAAKK,MAAMI,kBAG7EI,uBACIJ,UAAU,mBACVb,GAAG,mBACHkB,QAASN,EAAsBR,KAAKe,yBAAsBC,GAE1DH,uBAAKJ,UAAU,yBAAyBb,GAAG,0BACvCiB,uBAAKP,MAAOA,EAAOG,UAAWA,GACzBF,SAhDPM,EAAMI,WAuDxBjC,EAAIkC,YAAc,YAClBlC,EAAImC,aAAe,CACfR,OAAO,EACPH,qBAAqB,OAanBY,gHAIF5B,YAAA,SAAYF,GACRA,EAAMG,iBACgC,mBAA3BO,KAAKK,MAAMgB,kBACbhB,MAAMgB,kBAGTpC,EAAeC,SAASC,eAAe,aAC7CC,EAASC,uBAAuBJ,MAGpCmB,OAAA,kBAGQS,uBAAKJ,UAAU,8BACXI,yBACKb,KAAKK,MAAMiB,OAAST,wBAAMJ,UAAU,SAAST,KAAKK,MAAMiB,OACxDtB,KAAKK,MAAMkB,UAAYV,wBAAMJ,UAAU,YAAYT,KAAKK,MAAMkB,UAC9DvB,KAAKK,MAAME,UAEhBM,qBAAGJ,UAAU,QAAQK,QAASd,KAAKR,YAAYgC,KAAKxB,MAAOyB,KAAK,KAC5DZ,gBAACa,sBAxBAb,EAAMI,WA+B3BG,EAAOF,YAAc,mBAmBfS,gHAIFnC,YAAA,SAAYF,GACRA,EAAMG,qBAEAR,EAAeC,SAASC,eAAe,aAC7CC,EAASC,uBAAuBJ,MAGpCmB,OAAA,iBAC4DJ,KAAKK,MAArDuB,IAAAA,KAAarB,IAAAA,SAAUD,IAAAA,MAAOuB,IAAAA,cAChCpB,EAAYC,EAAW,2BAA4B,CAAEoB,QAD7CA,OACsD9B,KAAKK,MAAMI,kBAI3EI,uBAAKJ,UAAWA,EAAWH,MAAOA,GAC7BuB,GACGhB,qBAAGJ,UAAU,QAAQK,QAASd,KAAKR,YAAYgC,KAAKxB,MAAOyB,KAAK,KAC5DZ,gBAACa,iBAGRE,EACGf,uBAAKJ,UAAU,UACXI,uBAAKJ,UAAU,iBAAiBmB,GAChCf,uBAAKJ,UAAU,WAAWF,IAG9BA,OA7BDM,EAAMI,WAoCzBU,EAAKT,YAAc,aACnBS,EAAKR,aAAe,CAChBU,eAAe,OAiBbE,gHAGFC,SAAA,SAASlB,GACDA,GACAA,QAGE7B,EAAeC,SAASC,eAAe,aAC7CC,EAASC,uBAAuBJ,MAGpCmB,OAAA,sBACUG,EAAWM,EAAMoB,SAASC,SAGvB7B,MAAME,UACX,SAAC4B,gBACOA,MAAAA,aAAAA,EAAO9B,oBAAP+B,EAAcC,MACPxB,EAAMyB,aAAaH,EAAO,CAC7BrB,QAAS,kBAAMyB,EAAKP,SAASG,EAAM9B,MAAMS,YAGtCqB,EAAQtB,EAAMyB,aAAaH,GAAStB,2CAKhDA,uBAAKJ,UAAU,+BAA+BF,OA5BvCM,EAAMI,WAgC5Bc,EAAQb,YAAc"}
@@ -1,5 +1,5 @@
1
- import { Box, Header, Body, Actions } from './modal';
2
- import type { Modal } from './modal';
1
+ import { Box, Header, Body, Actions } from './deprecated-modal';
2
+ import type { Modal } from './deprecated-modal';
3
3
  declare const _default: {
4
4
  Box: typeof Box;
5
5
  Header: typeof Header;
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./deprecated-modal.js");exports.default={Box:e.Box,Header:e.Header,Body:e.Body,Actions:e.Actions};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/deprecated-modal/index.ts"],"sourcesContent":["import { Box, Header, Body, Actions } from './deprecated-modal'\nimport type { Modal } from './deprecated-modal'\n\nexport default { Box, Header, Body, Actions }\nexport type { Modal }\n"],"names":["Box","Header","Body","Actions"],"mappings":"2HAGe,CAAEA,IAAAA,MAAKC,OAAAA,SAAQC,KAAAA,OAAMC,QAAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("react")),o=t(require("classnames")),i=require("../../_virtual/_rollupPluginBabelHelpers.js"),n=require("../button/index.js"),r=t(require("react-dom")),s=function(t){function n(e,o){var n;return(n=t.call(this,e,o)||this)._handleClickOutside=function(t){var e=r.findDOMNode(i.assertThisInitialized(n));e&&!e.contains(t.target)?n._toggleShowBody():n.props.allowBodyInteractions||(n._timeout=setTimeout((function(){n.state.showBody&&n._toggleShowBody()}),100))},n._toggleShowBody=function(){n.state.showBody?(n.props.onHideBody&&n.props.onHideBody(),document.removeEventListener("click",n._handleClickOutside,!0)):(n.props.onShowBody&&n.props.onShowBody(),document.addEventListener("click",n._handleClickOutside,!0)),n.setState({showBody:!n.state.showBody})},n._setPosition=function(t){if(t){var e=document.getElementById(n.props.scrolling_parent?n.props.scrolling_parent:"");if(e){var o=r.findDOMNode(i.assertThisInitialized(n));if(!o)return;var s=r.findDOMNode(i.assertThisInitialized(n)).offsetTop,l=o.querySelector(".trigger");if(!l)return;var a=e.clientHeight+e.scrollTop-s-l.clientHeight<t.clientHeight;a!==n.state.top&&n.setState({top:a})}}},n.state={showBody:!1,top:e.top||!1},n._timeout=void 0,n}i.inheritsLoose(n,t);var s=n.prototype;return s.componentWillUnmount=function(){document.removeEventListener("click",this._handleClickOutside,!0),this._timeout&&clearTimeout(this._timeout)},s._getTriggerComponent=function(){var t,o=null===(t=this.props.children)||void 0===t?void 0:t[0];return o?e.cloneElement(o,{onClick:this._toggleShowBody}):void 0},s._getBodyComponent=function(){if(!this.state.showBody)return null;var t=this.state.top,i=this.props,n=i.right,r=i.children,s={top:t,right:void 0!==n&&n,setPosition:this._setPosition},l=o({body_wrapper:!0,with_arrow:!0,top:t,bottom:!t}),a=null==r?void 0:r[1],d="function"==typeof a?a(s):a?e.cloneElement(a,s):void 0;return e.createElement("div",{className:l,style:{position:"relative"}},d)},s.render=function(){var t=o("reactist_dropdown",this.props.className),i=this.state.top;return e.createElement("div",{style:{display:"inline-block"},className:t},i&&this._getBodyComponent(),this._getTriggerComponent(),!i&&this._getBodyComponent())},n}(e.Component);s.displayName="Dropdown.Box";var l=e.forwardRef((function(t,r){var s=t.children,l=t.onClick,a=t.tooltip,d=t.className,c=i.objectWithoutPropertiesLoose(t,["children","onClick","tooltip","className"]);return e.createElement(n.default,Object.assign({},c,{className:o("trigger",d),onClick:function(t){t.preventDefault(),t.stopPropagation(),l&&l(t)},tooltip:a,ref:r}),s)}));function a(t){var o=t.right,i=t.children,n=t.setPosition,r={position:"absolute",right:0,top:0};return t.top&&(r.top="auto",r.bottom=0),o&&(r.right="auto",r.left=0),e.createElement("div",{ref:n,style:r,className:"body",id:"reactist-dropdown-body"},i)}l.displayName="Dropdown.Trigger",a.displayName="Dropdown.Body",exports.Dropdown={Box:s,Trigger:l,Body:a};
1
+ "use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),o=t(require("react")),i=t(require("classnames")),n=t(require("react-dom")),r=require("../deprecated-button/index.js"),s=["children","onClick","tooltip","className"],l=function(t){function r(o,i){var r;return(r=t.call(this,o,i)||this)._handleClickOutside=function(t){var o=n.findDOMNode(e.assertThisInitialized(r));o&&!o.contains(t.target)?r._toggleShowBody():r.props.allowBodyInteractions||(r._timeout=setTimeout((function(){r.state.showBody&&r._toggleShowBody()}),100))},r._toggleShowBody=function(){r.state.showBody?(r.props.onHideBody&&r.props.onHideBody(),document.removeEventListener("click",r._handleClickOutside,!0)):(r.props.onShowBody&&r.props.onShowBody(),document.addEventListener("click",r._handleClickOutside,!0)),r.setState({showBody:!r.state.showBody})},r._setPosition=function(t){if(t){var o=document.getElementById(r.props.scrolling_parent?r.props.scrolling_parent:"");if(o){var i=n.findDOMNode(e.assertThisInitialized(r));if(!i)return;var s=n.findDOMNode(e.assertThisInitialized(r)).offsetTop,l=i.querySelector(".trigger");if(!l)return;var a=o.clientHeight+o.scrollTop-s-l.clientHeight<t.clientHeight;a!==r.state.top&&r.setState({top:a})}}},r.state={showBody:!1,top:o.top||!1},r._timeout=void 0,r}e.inheritsLoose(r,t);var s=r.prototype;return s.componentWillUnmount=function(){document.removeEventListener("click",this._handleClickOutside,!0),this._timeout&&clearTimeout(this._timeout)},s._getTriggerComponent=function(){var t,e=null===(t=this.props.children)||void 0===t?void 0:t[0];return e?o.cloneElement(e,{onClick:this._toggleShowBody}):void 0},s._getBodyComponent=function(){if(!this.state.showBody)return null;var t=this.state.top,e=this.props,n=e.right,r=e.children,s={top:t,right:void 0!==n&&n,setPosition:this._setPosition},l=i({body_wrapper:!0,with_arrow:!0,top:t,bottom:!t}),a=null==r?void 0:r[1],d="function"==typeof a?a(s):a?o.cloneElement(a,s):void 0;return o.createElement("div",{className:l,style:{position:"relative"}},d)},s.render=function(){var t=i("reactist_dropdown",this.props.className),e=this.state.top;return o.createElement("div",{style:{display:"inline-block"},className:t},e&&this._getBodyComponent(),this._getTriggerComponent(),!e&&this._getBodyComponent())},r}(o.Component);l.displayName="Dropdown.Box";var a=o.forwardRef((function(t,n){var l=t.children,a=t.onClick,d=t.tooltip,c=t.className,p=e.objectWithoutPropertiesLoose(t,s);return o.createElement(r.default,Object.assign({},p,{className:i("trigger",c),onClick:function(t){t.preventDefault(),t.stopPropagation(),a&&a(t)},tooltip:d,ref:n}),l)}));function d(t){var e=t.right,i=t.children,n=t.setPosition,r={position:"absolute",right:0,top:0};return t.top&&(r.top="auto",r.bottom=0),e&&(r.right="auto",r.left=0),o.createElement("div",{ref:n,style:r,className:"body",id:"reactist-dropdown-body"},i)}a.displayName="Dropdown.Trigger",d.displayName="Dropdown.Body",exports.Dropdown={Box:l,Trigger:a,Body:d};
2
2
  //# sourceMappingURL=dropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown.js","sources":["../../../src/components/dropdown/dropdown.tsx"],"sourcesContent":["import React from 'react'\nimport ReactDOM from 'react-dom'\nimport classNames from 'classnames'\n\nimport Button from '../button'\n\nimport './dropdown.less'\n\ntype BoxProps = {\n onShowBody?: () => void\n onHideBody?: () => void\n allowBodyInteractions?: boolean\n top?: boolean\n right?: boolean\n scrolling_parent?: string\n children?: [\n React.ReactElement<TriggerProps>,\n React.ReactElement<BodyProps> | ((props: BodyProps) => JSX.Element),\n ]\n className?: string\n}\n\ntype BoxState = {\n top: boolean\n showBody: boolean\n}\n\nclass Box extends React.Component<React.PropsWithChildren<BoxProps>, BoxState> {\n public static displayName: string\n\n constructor(props: BoxProps, context: React.Context<unknown>) {\n super(props, context)\n this.state = {\n showBody: false,\n top: props.top || false,\n }\n\n this._timeout = undefined\n }\n\n componentWillUnmount() {\n document.removeEventListener('click', this._handleClickOutside, true)\n if (this._timeout) {\n clearTimeout(this._timeout)\n }\n }\n _timeout?: ReturnType<typeof setTimeout>\n\n _handleClickOutside = (event: MouseEvent) => {\n const dropdownDOMNode = ReactDOM.findDOMNode(this)\n\n if (dropdownDOMNode && !dropdownDOMNode.contains(event.target as Node))\n this._toggleShowBody()\n else if (!this.props.allowBodyInteractions) {\n // won't close when body interactions are allowed\n this._timeout = setTimeout(() => {\n if (this.state.showBody) {\n this._toggleShowBody()\n }\n }, 100)\n }\n }\n\n _toggleShowBody = () => {\n if (!this.state.showBody) {\n // will show\n if (this.props.onShowBody) this.props.onShowBody()\n document.addEventListener('click', this._handleClickOutside, true)\n } else {\n // will hide\n if (this.props.onHideBody) this.props.onHideBody()\n document.removeEventListener('click', this._handleClickOutside, true)\n }\n\n this.setState({\n showBody: !this.state.showBody,\n })\n }\n\n _getTriggerComponent() {\n const _trigger = this.props.children?.[0]\n return _trigger\n ? React.cloneElement(_trigger, { onClick: this._toggleShowBody })\n : undefined\n }\n\n // https://facebook.github.io/react/docs/refs-and-the-dom.html#exposing-dom-refs-to-parent-components\n _setPosition = (body: HTMLElement | null) => {\n if (body) {\n const scrollingParent = document.getElementById(\n this.props.scrolling_parent ? this.props.scrolling_parent : '',\n )\n\n if (scrollingParent) {\n const dropdown = ReactDOM.findDOMNode(this)\n if (!dropdown) {\n return\n }\n const dropdownVerticalPosition = (ReactDOM.findDOMNode(this) as HTMLElement)\n .offsetTop\n const dropdownTrigger = (dropdown as Element).querySelector('.trigger')\n if (!dropdownTrigger) {\n return\n }\n const dropdownTriggerHeight = dropdownTrigger.clientHeight\n const dropdownBodyHeight = body.clientHeight\n\n const scrollingParentHeight = scrollingParent.clientHeight\n const scrollingParentOffset = scrollingParent.scrollTop\n\n const bottomOffset =\n scrollingParentHeight +\n scrollingParentOffset -\n dropdownVerticalPosition -\n dropdownTriggerHeight\n\n const top = bottomOffset < dropdownBodyHeight\n\n if (top !== this.state.top) {\n this.setState({ top })\n }\n }\n }\n }\n\n _getBodyComponent() {\n if (!this.state.showBody) {\n return null\n }\n const { top } = this.state\n const { right = false, children } = this.props\n const props = { top, right, setPosition: this._setPosition }\n\n const className = classNames({\n body_wrapper: true,\n with_arrow: true,\n top: top,\n bottom: !top,\n })\n\n const body = children?.[1]\n\n const contentMarkup =\n typeof body === 'function'\n ? body(props)\n : body\n ? React.cloneElement(body, props)\n : undefined\n return (\n <div className={className} style={{ position: 'relative' }}>\n {contentMarkup}\n </div>\n )\n }\n\n render() {\n const className = classNames('reactist_dropdown', this.props.className)\n const { top } = this.state\n\n return (\n <div style={{ display: 'inline-block' }} className={className}>\n {top && this._getBodyComponent()}\n {this._getTriggerComponent()}\n {!top && this._getBodyComponent()}\n </div>\n )\n }\n}\n\nBox.displayName = 'Dropdown.Box'\n\ntype NativeButtonProps = React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>\n\ntype TriggerProps = Omit<NativeButtonProps, 'title'> & {\n tooltip?: React.ReactNode\n}\n\nconst Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(function Trigger(\n { children, onClick, tooltip, className, ...props },\n ref,\n) {\n function handleClick(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) {\n event.preventDefault()\n event.stopPropagation()\n if (onClick) onClick(event)\n }\n\n return (\n <Button\n {...props}\n className={classNames('trigger', className)}\n onClick={handleClick}\n tooltip={tooltip}\n ref={ref}\n >\n {children}\n </Button>\n )\n})\n\nTrigger.displayName = 'Dropdown.Trigger'\n\ntype BodyProps = {\n setPosition?: React.Ref<HTMLDivElement>\n children?: React.ReactNode\n top?: boolean\n right?: boolean\n}\n\nfunction Body({ top, right, children, setPosition }: BodyProps) {\n const style: React.CSSProperties = { position: 'absolute', right: 0, top: 0 }\n\n if (top) {\n style.top = 'auto'\n style.bottom = 0\n }\n\n if (right) {\n style.right = 'auto'\n style.left = 0\n }\n\n return (\n <div ref={setPosition} style={style} className=\"body\" id=\"reactist-dropdown-body\">\n {children}\n </div>\n )\n}\n\nBody.displayName = 'Dropdown.Body'\n\nconst Dropdown = {\n Box,\n Trigger,\n Body,\n}\n\nexport { Dropdown }\n"],"names":["Box","props","context","event","dropdownDOMNode","ReactDOM","findDOMNode","contains","target","_this","_toggleShowBody","allowBodyInteractions","_timeout","setTimeout","state","showBody","onHideBody","document","removeEventListener","_handleClickOutside","onShowBody","addEventListener","setState","body","scrollingParent","getElementById","scrolling_parent","dropdown","dropdownVerticalPosition","offsetTop","dropdownTrigger","querySelector","top","clientHeight","scrollTop","undefined","componentWillUnmount","this","clearTimeout","_getTriggerComponent","_trigger","children","_this$props$children","React","cloneElement","onClick","_getBodyComponent","right","setPosition","_setPosition","className","classNames","body_wrapper","with_arrow","bottom","contentMarkup","style","position","render","display","Component","displayName","Trigger","forwardRef","ref","tooltip","Button","preventDefault","stopPropagation","Body","left","id"],"mappings":"kTA2BMA,yBAGUC,EAAiBC,8BACnBD,EAAOC,8BAiBK,SAACC,OACbC,EAAkBC,EAASC,wCAE7BF,IAAoBA,EAAgBG,SAASJ,EAAMK,QACnDC,EAAKC,kBACCD,EAAKR,MAAMU,0BAEZC,SAAWC,YAAW,WACnBJ,EAAKK,MAAMC,YACNL,oBAEV,yBAIO,WACTD,EAAKK,MAAMC,UAMRN,EAAKR,MAAMe,YAAYP,EAAKR,MAAMe,aACtCC,SAASC,oBAAoB,QAAST,EAAKU,qBAAqB,KAL5DV,EAAKR,MAAMmB,YAAYX,EAAKR,MAAMmB,aACtCH,SAASI,iBAAiB,QAASZ,EAAKU,qBAAqB,MAO5DG,SAAS,CACVP,UAAWN,EAAKK,MAAMC,2BAYf,SAACQ,MACRA,EAAM,KACAC,EAAkBP,SAASQ,eAC7BhB,EAAKR,MAAMyB,iBAAmBjB,EAAKR,MAAMyB,iBAAmB,OAG5DF,EAAiB,KACXG,EAAWtB,EAASC,4CACrBqB,aAGCC,EAA4BvB,EAASC,wCACtCuB,UACCC,EAAmBH,EAAqBI,cAAc,gBACvDD,aAeCE,EATwBR,EAAgBS,aAChBT,EAAgBU,UAK1CN,EAT0BE,EAAgBG,aACnBV,EAAKU,aAa5BD,IAAQvB,EAAKK,MAAMkB,OACdV,SAAS,CAAEU,IAAAA,SAvFvBlB,MAAQ,CACTC,UAAU,EACViB,IAAK/B,EAAM+B,MAAO,KAGjBpB,cAAWuB,oDAGpBC,qBAAA,WACInB,SAASC,oBAAoB,QAASmB,KAAKlB,qBAAqB,GAC5DkB,KAAKzB,UACL0B,aAAaD,KAAKzB,aAoC1B2B,qBAAA,iBACUC,YAAWH,KAAKpC,MAAMwC,6BAAXC,EAAsB,UAChCF,EACDG,EAAMC,aAAaJ,EAAU,CAAEK,QAASR,KAAK3B,uBAC7CyB,KA0CVW,kBAAA,eACST,KAAKvB,MAAMC,gBACL,SAEHiB,EAAQK,KAAKvB,MAAbkB,MAC4BK,KAAKpC,UAAjC8C,MAAeN,IAAAA,SACjBxC,EAAQ,CAAE+B,IAAAA,EAAKe,oBAAOC,YAAaX,KAAKY,cAExCC,EAAYC,EAAW,CACzBC,cAAc,EACdC,YAAY,EACZrB,IAAKA,EACLsB,QAAStB,IAGPT,EAAOkB,MAAAA,SAAAA,EAAW,GAElBc,EACc,mBAAThC,EACDA,EAAKtB,GACLsB,EACAoB,EAAMC,aAAarB,EAAMtB,QACzBkC,SAENQ,uBAAKO,UAAWA,EAAWM,MAAO,CAAEC,SAAU,aACzCF,MAKbG,OAAA,eACUR,EAAYC,EAAW,oBAAqBd,KAAKpC,MAAMiD,WACrDlB,EAAQK,KAAKvB,MAAbkB,WAGJW,uBAAKa,MAAO,CAAEG,QAAS,gBAAkBT,UAAWA,GAC/ClB,GAAOK,KAAKS,oBACZT,KAAKE,wBACJP,GAAOK,KAAKS,yBAxIZH,EAAMiB,WA8IxB5D,EAAI6D,YAAc,eAWlB,IAAMC,EAAUnB,EAAMoB,YAA4C,WAE9DC,OADEvB,IAAAA,SAAUI,IAAAA,QAASoB,IAAAA,QAASf,IAAAA,UAAcjD,wFAUxC0C,gBAACuB,2BACOjE,GACJiD,UAAWC,EAAW,UAAWD,GACjCL,iBAVa1C,GACjBA,EAAMgE,iBACNhE,EAAMiE,kBACFvB,GAASA,EAAQ1C,IAQjB8D,QAASA,EACTD,IAAKA,IAEJvB,MAcb,SAAS4B,SAAYtB,IAAAA,MAAON,IAAAA,SAAUO,IAAAA,YAC5BQ,EAA6B,CAAEC,SAAU,WAAYV,MAAO,EAAGf,IAAK,YAD9DA,MAIRwB,EAAMxB,IAAM,OACZwB,EAAMF,OAAS,GAGfP,IACAS,EAAMT,MAAQ,OACdS,EAAMc,KAAO,GAIb3B,uBAAKqB,IAAKhB,EAAaQ,MAAOA,EAAON,UAAU,OAAOqB,GAAG,0BACpD9B,GAxBbqB,EAAQD,YAAc,mBA6BtBQ,EAAKR,YAAc,iCAEF,CACb7D,IAAAA,EACA8D,QAAAA,EACAO,KAAAA"}
1
+ {"version":3,"file":"dropdown.js","sources":["../../../src/components/dropdown/dropdown.tsx"],"sourcesContent":["import React from 'react'\nimport ReactDOM from 'react-dom'\nimport classNames from 'classnames'\n\nimport Button from '../deprecated-button'\n\nimport './dropdown.less'\n\ntype BoxProps = {\n onShowBody?: () => void\n onHideBody?: () => void\n allowBodyInteractions?: boolean\n top?: boolean\n right?: boolean\n scrolling_parent?: string\n children?: [\n React.ReactElement<TriggerProps>,\n React.ReactElement<BodyProps> | ((props: BodyProps) => JSX.Element),\n ]\n className?: string\n}\n\ntype BoxState = {\n top: boolean\n showBody: boolean\n}\n\nclass Box extends React.Component<React.PropsWithChildren<BoxProps>, BoxState> {\n public static displayName: string\n\n constructor(props: BoxProps, context: React.Context<unknown>) {\n super(props, context)\n this.state = {\n showBody: false,\n top: props.top || false,\n }\n\n this._timeout = undefined\n }\n\n componentWillUnmount() {\n document.removeEventListener('click', this._handleClickOutside, true)\n if (this._timeout) {\n clearTimeout(this._timeout)\n }\n }\n _timeout?: ReturnType<typeof setTimeout>\n\n _handleClickOutside = (event: MouseEvent) => {\n const dropdownDOMNode = ReactDOM.findDOMNode(this)\n\n if (dropdownDOMNode && !dropdownDOMNode.contains(event.target as Node))\n this._toggleShowBody()\n else if (!this.props.allowBodyInteractions) {\n // won't close when body interactions are allowed\n this._timeout = setTimeout(() => {\n if (this.state.showBody) {\n this._toggleShowBody()\n }\n }, 100)\n }\n }\n\n _toggleShowBody = () => {\n if (!this.state.showBody) {\n // will show\n if (this.props.onShowBody) this.props.onShowBody()\n document.addEventListener('click', this._handleClickOutside, true)\n } else {\n // will hide\n if (this.props.onHideBody) this.props.onHideBody()\n document.removeEventListener('click', this._handleClickOutside, true)\n }\n\n this.setState({\n showBody: !this.state.showBody,\n })\n }\n\n _getTriggerComponent() {\n const _trigger = this.props.children?.[0]\n return _trigger\n ? React.cloneElement(_trigger, { onClick: this._toggleShowBody })\n : undefined\n }\n\n // https://facebook.github.io/react/docs/refs-and-the-dom.html#exposing-dom-refs-to-parent-components\n _setPosition = (body: HTMLElement | null) => {\n if (body) {\n const scrollingParent = document.getElementById(\n this.props.scrolling_parent ? this.props.scrolling_parent : '',\n )\n\n if (scrollingParent) {\n const dropdown = ReactDOM.findDOMNode(this)\n if (!dropdown) {\n return\n }\n const dropdownVerticalPosition = (ReactDOM.findDOMNode(this) as HTMLElement)\n .offsetTop\n const dropdownTrigger = (dropdown as Element).querySelector('.trigger')\n if (!dropdownTrigger) {\n return\n }\n const dropdownTriggerHeight = dropdownTrigger.clientHeight\n const dropdownBodyHeight = body.clientHeight\n\n const scrollingParentHeight = scrollingParent.clientHeight\n const scrollingParentOffset = scrollingParent.scrollTop\n\n const bottomOffset =\n scrollingParentHeight +\n scrollingParentOffset -\n dropdownVerticalPosition -\n dropdownTriggerHeight\n\n const top = bottomOffset < dropdownBodyHeight\n\n if (top !== this.state.top) {\n this.setState({ top })\n }\n }\n }\n }\n\n _getBodyComponent() {\n if (!this.state.showBody) {\n return null\n }\n const { top } = this.state\n const { right = false, children } = this.props\n const props = { top, right, setPosition: this._setPosition }\n\n const className = classNames({\n body_wrapper: true,\n with_arrow: true,\n top: top,\n bottom: !top,\n })\n\n const body = children?.[1]\n\n const contentMarkup =\n typeof body === 'function'\n ? body(props)\n : body\n ? React.cloneElement(body, props)\n : undefined\n return (\n <div className={className} style={{ position: 'relative' }}>\n {contentMarkup}\n </div>\n )\n }\n\n render() {\n const className = classNames('reactist_dropdown', this.props.className)\n const { top } = this.state\n\n return (\n <div style={{ display: 'inline-block' }} className={className}>\n {top && this._getBodyComponent()}\n {this._getTriggerComponent()}\n {!top && this._getBodyComponent()}\n </div>\n )\n }\n}\n\nBox.displayName = 'Dropdown.Box'\n\ntype NativeButtonProps = React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>\n\ntype TriggerProps = Omit<NativeButtonProps, 'title'> & {\n tooltip?: React.ReactNode\n}\n\nconst Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(function Trigger(\n { children, onClick, tooltip, className, ...props },\n ref,\n) {\n function handleClick(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) {\n event.preventDefault()\n event.stopPropagation()\n if (onClick) onClick(event)\n }\n\n return (\n <Button\n {...props}\n className={classNames('trigger', className)}\n onClick={handleClick}\n tooltip={tooltip}\n ref={ref}\n >\n {children}\n </Button>\n )\n})\n\nTrigger.displayName = 'Dropdown.Trigger'\n\ntype BodyProps = {\n setPosition?: React.Ref<HTMLDivElement>\n children?: React.ReactNode\n top?: boolean\n right?: boolean\n}\n\nfunction Body({ top, right, children, setPosition }: BodyProps) {\n const style: React.CSSProperties = { position: 'absolute', right: 0, top: 0 }\n\n if (top) {\n style.top = 'auto'\n style.bottom = 0\n }\n\n if (right) {\n style.right = 'auto'\n style.left = 0\n }\n\n return (\n <div ref={setPosition} style={style} className=\"body\" id=\"reactist-dropdown-body\">\n {children}\n </div>\n )\n}\n\nBody.displayName = 'Dropdown.Body'\n\nconst Dropdown = {\n Box,\n Trigger,\n Body,\n}\n\nexport { Dropdown }\n"],"names":["Box","props","context","event","dropdownDOMNode","ReactDOM","findDOMNode","contains","target","_this","_toggleShowBody","allowBodyInteractions","_timeout","setTimeout","state","showBody","onHideBody","document","removeEventListener","_handleClickOutside","onShowBody","addEventListener","setState","body","scrollingParent","getElementById","scrolling_parent","dropdown","dropdownVerticalPosition","offsetTop","dropdownTrigger","querySelector","top","clientHeight","scrollTop","undefined","componentWillUnmount","this","clearTimeout","_getTriggerComponent","_trigger","children","_this$props$children","React","cloneElement","onClick","_getBodyComponent","right","setPosition","_setPosition","className","classNames","body_wrapper","with_arrow","bottom","contentMarkup","style","position","render","display","Component","displayName","Trigger","forwardRef","ref","tooltip","Button","preventDefault","stopPropagation","Body","left","id"],"mappings":"4WA2BMA,yBAGUC,EAAiBC,8BACnBD,EAAOC,8BAiBK,SAACC,OACbC,EAAkBC,EAASC,wCAE7BF,IAAoBA,EAAgBG,SAASJ,EAAMK,QACnDC,EAAKC,kBACCD,EAAKR,MAAMU,0BAEZC,SAAWC,YAAW,WACnBJ,EAAKK,MAAMC,YACNL,oBAEV,yBAIO,WACTD,EAAKK,MAAMC,UAMRN,EAAKR,MAAMe,YAAYP,EAAKR,MAAMe,aACtCC,SAASC,oBAAoB,QAAST,EAAKU,qBAAqB,KAL5DV,EAAKR,MAAMmB,YAAYX,EAAKR,MAAMmB,aACtCH,SAASI,iBAAiB,QAASZ,EAAKU,qBAAqB,MAO5DG,SAAS,CACVP,UAAWN,EAAKK,MAAMC,2BAYf,SAACQ,MACRA,EAAM,KACAC,EAAkBP,SAASQ,eAC7BhB,EAAKR,MAAMyB,iBAAmBjB,EAAKR,MAAMyB,iBAAmB,OAG5DF,EAAiB,KACXG,EAAWtB,EAASC,4CACrBqB,aAGCC,EAA4BvB,EAASC,wCACtCuB,UACCC,EAAmBH,EAAqBI,cAAc,gBACvDD,aAeCE,EATwBR,EAAgBS,aAChBT,EAAgBU,UAK1CN,EAT0BE,EAAgBG,aACnBV,EAAKU,aAa5BD,IAAQvB,EAAKK,MAAMkB,OACdV,SAAS,CAAEU,IAAAA,SAvFvBlB,MAAQ,CACTC,UAAU,EACViB,IAAK/B,EAAM+B,MAAO,KAGjBpB,cAAWuB,oDAGpBC,qBAAA,WACInB,SAASC,oBAAoB,QAASmB,KAAKlB,qBAAqB,GAC5DkB,KAAKzB,UACL0B,aAAaD,KAAKzB,aAoC1B2B,qBAAA,iBACUC,YAAWH,KAAKpC,MAAMwC,6BAAXC,EAAsB,UAChCF,EACDG,EAAMC,aAAaJ,EAAU,CAAEK,QAASR,KAAK3B,uBAC7CyB,KA0CVW,kBAAA,eACST,KAAKvB,MAAMC,gBACL,SAEHiB,EAAQK,KAAKvB,MAAbkB,MAC4BK,KAAKpC,UAAjC8C,MAAeN,IAAAA,SACjBxC,EAAQ,CAAE+B,IAAAA,EAAKe,oBAAOC,YAAaX,KAAKY,cAExCC,EAAYC,EAAW,CACzBC,cAAc,EACdC,YAAY,EACZrB,IAAKA,EACLsB,QAAStB,IAGPT,EAAOkB,MAAAA,SAAAA,EAAW,GAElBc,EACc,mBAAThC,EACDA,EAAKtB,GACLsB,EACAoB,EAAMC,aAAarB,EAAMtB,QACzBkC,SAENQ,uBAAKO,UAAWA,EAAWM,MAAO,CAAEC,SAAU,aACzCF,MAKbG,OAAA,eACUR,EAAYC,EAAW,oBAAqBd,KAAKpC,MAAMiD,WACrDlB,EAAQK,KAAKvB,MAAbkB,WAGJW,uBAAKa,MAAO,CAAEG,QAAS,gBAAkBT,UAAWA,GAC/ClB,GAAOK,KAAKS,oBACZT,KAAKE,wBACJP,GAAOK,KAAKS,yBAxIZH,EAAMiB,WA8IxB5D,EAAI6D,YAAc,eAWlB,IAAMC,EAAUnB,EAAMoB,YAA4C,WAE9DC,OADEvB,IAAAA,SAAUI,IAAAA,QAASoB,IAAAA,QAASf,IAAAA,UAAcjD,6CAUxC0C,gBAACuB,2BACOjE,GACJiD,UAAWC,EAAW,UAAWD,GACjCL,iBAVa1C,GACjBA,EAAMgE,iBACNhE,EAAMiE,kBACFvB,GAASA,EAAQ1C,IAQjB8D,QAASA,EACTD,IAAKA,IAEJvB,MAcb,SAAS4B,SAAYtB,IAAAA,MAAON,IAAAA,SAAUO,IAAAA,YAC5BQ,EAA6B,CAAEC,SAAU,WAAYV,MAAO,EAAGf,IAAK,YAD9DA,MAIRwB,EAAMxB,IAAM,OACZwB,EAAMF,OAAS,GAGfP,IACAS,EAAMT,MAAQ,OACdS,EAAMc,KAAO,GAIb3B,uBAAKqB,IAAKhB,EAAaQ,MAAOA,EAAON,UAAU,OAAOqB,GAAG,0BACpD9B,GAxBbqB,EAAQD,YAAc,mBA6BtBQ,EAAKR,YAAc,iCAEF,CACb7D,IAAAA,EACA8D,QAAAA,EACAO,KAAAA"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r,e=require("react"),o=(r=e)&&"object"==typeof r&&"default"in r?r.default:r,t=require("../../_virtual/_rollupPluginBabelHelpers.js"),a={resolveByKey:function(r){switch(r){case"Left":case"ArrowLeft":return"ArrowLeft";case"Up":case"ArrowUp":return"ArrowUp";case"Right":case"ArrowRight":return"ArrowRight";case"Down":case"ArrowDown":return"ArrowDown";case"Enter":return"Enter";case"Backspace":return"Backspace";case"Esc":case"Escape":return"Escape";default:return null}},resolveByKeyCode:function(r){switch(r){case 37:return"ArrowLeft";case 38:return"ArrowUp";case 39:return"ArrowRight";case 40:return"ArrowDown";case 13:return"Enter";case 8:return"Backspace";case 27:return"Escape";default:return null}}},n={ArrowUp:"onArrowUp",ArrowDown:"onArrowDown",ArrowLeft:"onArrowLeft",ArrowRight:"onArrowRight",Enter:"onEnter",Backspace:"onBackspace",Escape:"onEscape"},c={ArrowUp:"propagateArrowUp",ArrowDown:"propagateArrowDown",ArrowLeft:"propagateArrowLeft",ArrowRight:"propagateArrowRight",Enter:"propagateEnter",Backspace:"propagateBackspace",Escape:"propagateEscape"};exports.KeyCapturer=function(r){var s,p=r.children,w=r.eventName,u=void 0===w?"onKeyDown":w,A=e.useRef(!1),i=r.onEnter?{onCompositionStart:function(){A.current=!0},onCompositionEnd:function(){A.current=!1}}:void 0;return o.cloneElement(p,t.objectSpread2(((s={})[u]=function(e){var o=void 0!==e.key?a.resolveByKey(e.key):a.resolveByKeyCode(e.keyCode);if(o){var t=r[c[o]]||!1,s=r[n[o]];"Enter"===o&&s&&(A.current||229===(e.keyCode||e.which))||s&&(s(e),t||(e.preventDefault(),e.stopPropagation()))}},s),i))},exports.KeyCapturerResolver=a,exports.SUPPORTED_KEYS={ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ENTER:"Enter",BACKSPACE:"Backspace",ESCAPE:"Escape"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r,e=require("../../_virtual/_rollupPluginBabelHelpers.js"),o=require("react"),t=(r=o)&&"object"==typeof r&&"default"in r?r.default:r,a={resolveByKey:function(r){switch(r){case"Left":case"ArrowLeft":return"ArrowLeft";case"Up":case"ArrowUp":return"ArrowUp";case"Right":case"ArrowRight":return"ArrowRight";case"Down":case"ArrowDown":return"ArrowDown";case"Enter":return"Enter";case"Backspace":return"Backspace";case"Esc":case"Escape":return"Escape";default:return null}},resolveByKeyCode:function(r){switch(r){case 37:return"ArrowLeft";case 38:return"ArrowUp";case 39:return"ArrowRight";case 40:return"ArrowDown";case 13:return"Enter";case 8:return"Backspace";case 27:return"Escape";default:return null}}},n={ArrowUp:"onArrowUp",ArrowDown:"onArrowDown",ArrowLeft:"onArrowLeft",ArrowRight:"onArrowRight",Enter:"onEnter",Backspace:"onBackspace",Escape:"onEscape"},c={ArrowUp:"propagateArrowUp",ArrowDown:"propagateArrowDown",ArrowLeft:"propagateArrowLeft",ArrowRight:"propagateArrowRight",Enter:"propagateEnter",Backspace:"propagateBackspace",Escape:"propagateEscape"};exports.KeyCapturer=function(r){var s,p=r.children,w=r.eventName,u=void 0===w?"onKeyDown":w,A=o.useRef(!1),i=r.onEnter?{onCompositionStart:function(){A.current=!0},onCompositionEnd:function(){A.current=!1}}:void 0;return t.cloneElement(p,e.objectSpread2(((s={})[u]=function(e){var o=void 0!==e.key?a.resolveByKey(e.key):a.resolveByKeyCode(e.keyCode);if(o){var t=r[c[o]]||!1,s=r[n[o]];"Enter"===o&&s&&(A.current||229===(e.keyCode||e.which))||s&&(s(e),t||(e.preventDefault(),e.stopPropagation()))}},s),i))},exports.KeyCapturerResolver=a,exports.SUPPORTED_KEYS={ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ENTER:"Enter",BACKSPACE:"Backspace",ESCAPE:"Escape"};
2
2
  //# sourceMappingURL=key-capturer.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),r=(e(t),e(require("classnames"))),a=require("../../_virtual/_rollupPluginBabelHelpers.js"),n=function(e){return e};function c(e){switch(e.toLowerCase()){case"cmd":case"mod":return"⌘";case"control":case"ctrl":return"⌃";case"alt":return"⌥";case"shift":return"⇧";case"space":return"␣";default:return e}}function s(e){var s,o,l=e.children,u=e.className,i=e.translateKey,d=void 0===i?n:i,p=e.isMac,m=void 0===p?null!==(s=null===(o=navigator.platform)||void 0===o?void 0:o.toUpperCase().includes("MAC"))&&void 0!==s&&s:p,f=a.objectWithoutPropertiesLoose(e,["children","className","translateKey","isMac"]),b="string"==typeof l?[l]:l;return t.createElement("span",Object.assign({className:r("reactist_keyboard_shortcut",u,{"reactist_keyboard_shortcut--macos":m})},f),b.map((function(e,r){return t.createElement(t.Fragment,{key:r},0===r?null:", ",t.createElement("kbd",null,function(e,t,r){var a=t?c:r,n=/\b(mod|cmd|ctrl|control|alt|shift)\b/i.test(e);return t||(e=e.replace(/\b(mod|cmd)\b/i,"ctrl")),e.split(/\s*\+\s*/).map((function(e){return function(e){return/^(mod|cmd|ctrl|control|alt|shift|space|super)$/i.test(e)}(e)?function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}(a(e)):n&&1===e.length?e.toUpperCase():e}))}(e,m,d).map((function(e,r){return t.createElement("kbd",{key:r},e)}))))})))}s.setTranslateKey=function(e){n=e},exports.KeyboardShortcut=s;
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),a=(e(r),e(require("classnames"))),n=["children","className","translateKey","isMac"],c=function(e){return e};function s(e){switch(e.toLowerCase()){case"cmd":case"mod":return"⌘";case"control":case"ctrl":return"⌃";case"alt":return"⌥";case"shift":return"⇧";case"space":return"␣";default:return e}}function o(e){var o,l,u=e.children,i=e.className,d=e.translateKey,p=void 0===d?c:d,m=e.isMac,f=void 0===m?null!==(o=null===(l=navigator.platform)||void 0===l?void 0:l.toUpperCase().includes("MAC"))&&void 0!==o&&o:m,b=t.objectWithoutPropertiesLoose(e,n),h="string"==typeof u?[u]:u;return r.createElement("span",Object.assign({className:a("reactist_keyboard_shortcut",i,{"reactist_keyboard_shortcut--macos":f})},b),h.map((function(e,t){return r.createElement(r.Fragment,{key:t},0===t?null:", ",r.createElement("kbd",null,function(e,t,r){var a=t?s:r,n=/\b(mod|cmd|ctrl|control|alt|shift)\b/i.test(e);return t||(e=e.replace(/\b(mod|cmd)\b/i,"ctrl")),e.split(/\s*\+\s*/).map((function(e){return function(e){return/^(mod|cmd|ctrl|control|alt|shift|space|super)$/i.test(e)}(e)?function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}(a(e)):n&&1===e.length?e.toUpperCase():e}))}(e,f,p).map((function(e,t){return r.createElement("kbd",{key:t},e)}))))})))}o.setTranslateKey=function(e){c=e},exports.KeyboardShortcut=o;
2
2
  //# sourceMappingURL=keyboard-shortcut.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyboard-shortcut.js","sources":["../../../src/components/keyboard-shortcut/keyboard-shortcut.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\n\n//\n// Support for setting up how to translate modifiers globally.\n//\n\nlet globalTranslateKey = (key: string) => key\n\ntype TranslateKey = typeof globalTranslateKey\n\nKeyboardShortcut.setTranslateKey = (tr: TranslateKey) => {\n globalTranslateKey = tr\n}\n\nfunction translateKeyMac(key: string) {\n switch (key.toLowerCase()) {\n case 'cmd':\n case 'mod':\n return '⌘'\n case 'control':\n case 'ctrl':\n return '⌃'\n case 'alt':\n return '⌥'\n case 'shift':\n return '⇧'\n case 'space':\n return '␣'\n default:\n return key\n }\n}\n\n//\n// Some helpers\n//\n\nfunction capitalize(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()\n}\n\nfunction hasModifiers(str: string) {\n return /\\b(mod|cmd|ctrl|control|alt|shift)\\b/i.test(str)\n}\n\nfunction isSpecialKey(str: string) {\n return /^(mod|cmd|ctrl|control|alt|shift|space|super)$/i.test(str)\n}\n\nfunction parseKeys(shortcut: string, isMac: boolean, translateKey: TranslateKey) {\n const t = isMac ? translateKeyMac : translateKey\n const _hasModifiers = hasModifiers(shortcut)\n\n function mapIndividualKey(str: string) {\n if (isSpecialKey(str)) {\n return capitalize(t(str))\n }\n if (_hasModifiers && str.length === 1) {\n return str.toUpperCase()\n }\n return str\n }\n\n if (!isMac) {\n shortcut = shortcut.replace(/\\b(mod|cmd)\\b/i, 'ctrl')\n }\n\n return shortcut.split(/\\s*\\+\\s*/).map(mapIndividualKey)\n}\n\n//\n// The KeyboardShortcut component\n//\n\ntype NativeSpanProps = React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLSpanElement>,\n HTMLSpanElement\n>\n\ntype Props = Omit<NativeSpanProps, 'children'> & {\n /**\n * The shortcut to be represented as markup. It supports an intuitive syntax where you can\n * combine modifiers (cmd, ctrl, shift, alt) with single keys all concatenated with plus signs.\n * You can also pass various shortcuts as an array, which will be depicted separated by commas.\n */\n children: string | string[]\n /**\n * A function that allows you to change how some key names are represented. This may be useful,\n * for instance, to translate modifier names that are expressed differently in other languages\n * (e.g. `Ctrl` is named `Strg` in German).\n *\n * It defaults to a global version that leaves the key as is. You can pass your version as a\n * prop, or you can also set your own version of this global default one, so you don't need to\n * pass your own on each invocation of this component.\n *\n * ```js\n * import { KeyboardShortcut } from '@doist/reactist'\n * KeyboardShortcut.setTranslateKey = key => { ... }\n * ```\n *\n * Note: When the component detects the macOS operating system it bypasses key translation for\n * most modifiers and uses macOS-specific symbols. See the `isMac` prop for details.\n */\n translateKey?: TranslateKey\n /**\n * This prop is not meant to be passed. The component will automatically initialize it to `true`\n * if it detects that the current browser / operating system is on macOS, in which case modifier\n * keys are represented using macOS' notation (e.g. ⌘ ⌃ ⌥ ⇧).\n *\n * Though it is discouraged, if you don't want this special treatment in macOS, you can pass\n * `isMac={false}` in all invocations of this component.\n */\n isMac?: boolean\n}\n\nfunction KeyboardShortcut({\n children,\n className,\n translateKey = globalTranslateKey,\n isMac = navigator.platform?.toUpperCase().includes('MAC') ?? false,\n ...props\n}: Props) {\n const shortcuts = typeof children === 'string' ? [children] : children\n return (\n <span\n className={classNames('reactist_keyboard_shortcut', className, {\n 'reactist_keyboard_shortcut--macos': isMac,\n })}\n {...props}\n >\n {shortcuts.map((shortcut, i) => (\n <React.Fragment key={i}>\n {i === 0 ? null : ', '}\n <kbd>\n {parseKeys(shortcut, isMac, translateKey).map((key, j) => (\n <kbd key={j}>{key}</kbd>\n ))}\n </kbd>\n </React.Fragment>\n ))}\n </span>\n )\n}\n\nexport { KeyboardShortcut }\n"],"names":["globalTranslateKey","key","translateKeyMac","toLowerCase","KeyboardShortcut","children","className","translateKey","isMac","navigator","platform","_navigator$platform","toUpperCase","includes","props","shortcuts","React","classNames","map","shortcut","i","t","_hasModifiers","test","replace","split","str","isSpecialKey","charAt","slice","capitalize","length","parseKeys","j","setTranslateKey","tr"],"mappings":"4PAOIA,EAAqB,SAACC,UAAgBA,GAQ1C,SAASC,EAAgBD,UACbA,EAAIE,mBACH,UACA,YACM,QACN,cACA,aACM,QACN,YACM,QACN,cACM,QACN,cACM,mBAEAF,GAsFnB,SAASG,aACLC,IAAAA,SACAC,IAAAA,cACAC,aAAAA,aAAeP,QACfQ,MAAAA,iCAAQC,UAAUC,6BAAVC,EAAoBC,cAAcC,SAAS,yBAChDC,oFAEGC,EAAgC,iBAAbV,EAAwB,CAACA,GAAYA,SAE1DW,sCACIV,UAAWW,EAAW,6BAA8BX,EAAW,qCACtBE,KAErCM,GAEHC,EAAUG,KAAI,SAACC,EAAUC,UACtBJ,gBAACA,YAAef,IAAKmB,GACV,IAANA,EAAU,KAAO,KAClBJ,2BApFpB,SAAmBG,EAAkBX,EAAgBD,OAC3Cc,EAAIb,EAAQN,EAAkBK,EAC9Be,EATC,wCAAwCC,KASZJ,UAY9BX,IACDW,EAAWA,EAASK,QAAQ,iBAAkB,SAG3CL,EAASM,MAAM,YAAYP,cAdRQ,UAR9B,SAAsBA,SACX,kDAAkDH,KAAKG,GAQtDC,CAAaD,GAjBzB,SAAoBA,UACTA,EAAIE,OAAO,GAAGhB,cAAgBc,EAAIG,MAAM,GAAG1B,cAiBnC2B,CAAWT,EAAEK,IAEpBJ,GAAgC,IAAfI,EAAIK,OACdL,EAAId,cAERc,KA0EUM,CAAUb,EAAUX,EAAOD,GAAcW,KAAI,SAACjB,EAAKgC,UAChDjB,uBAAKf,IAAKgC,GAAIhC,YA7H1CG,EAAiB8B,gBAAkB,SAACC,GAChCnC,EAAqBmC"}
1
+ {"version":3,"file":"keyboard-shortcut.js","sources":["../../../src/components/keyboard-shortcut/keyboard-shortcut.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\n\n//\n// Support for setting up how to translate modifiers globally.\n//\n\nlet globalTranslateKey = (key: string) => key\n\ntype TranslateKey = typeof globalTranslateKey\n\nKeyboardShortcut.setTranslateKey = (tr: TranslateKey) => {\n globalTranslateKey = tr\n}\n\nfunction translateKeyMac(key: string) {\n switch (key.toLowerCase()) {\n case 'cmd':\n case 'mod':\n return '⌘'\n case 'control':\n case 'ctrl':\n return '⌃'\n case 'alt':\n return '⌥'\n case 'shift':\n return '⇧'\n case 'space':\n return '␣'\n default:\n return key\n }\n}\n\n//\n// Some helpers\n//\n\nfunction capitalize(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()\n}\n\nfunction hasModifiers(str: string) {\n return /\\b(mod|cmd|ctrl|control|alt|shift)\\b/i.test(str)\n}\n\nfunction isSpecialKey(str: string) {\n return /^(mod|cmd|ctrl|control|alt|shift|space|super)$/i.test(str)\n}\n\nfunction parseKeys(shortcut: string, isMac: boolean, translateKey: TranslateKey) {\n const t = isMac ? translateKeyMac : translateKey\n const _hasModifiers = hasModifiers(shortcut)\n\n function mapIndividualKey(str: string) {\n if (isSpecialKey(str)) {\n return capitalize(t(str))\n }\n if (_hasModifiers && str.length === 1) {\n return str.toUpperCase()\n }\n return str\n }\n\n if (!isMac) {\n shortcut = shortcut.replace(/\\b(mod|cmd)\\b/i, 'ctrl')\n }\n\n return shortcut.split(/\\s*\\+\\s*/).map(mapIndividualKey)\n}\n\n//\n// The KeyboardShortcut component\n//\n\ntype NativeSpanProps = React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLSpanElement>,\n HTMLSpanElement\n>\n\ntype Props = Omit<NativeSpanProps, 'children'> & {\n /**\n * The shortcut to be represented as markup. It supports an intuitive syntax where you can\n * combine modifiers (cmd, ctrl, shift, alt) with single keys all concatenated with plus signs.\n * You can also pass various shortcuts as an array, which will be depicted separated by commas.\n */\n children: string | string[]\n /**\n * A function that allows you to change how some key names are represented. This may be useful,\n * for instance, to translate modifier names that are expressed differently in other languages\n * (e.g. `Ctrl` is named `Strg` in German).\n *\n * It defaults to a global version that leaves the key as is. You can pass your version as a\n * prop, or you can also set your own version of this global default one, so you don't need to\n * pass your own on each invocation of this component.\n *\n * ```js\n * import { KeyboardShortcut } from '@doist/reactist'\n * KeyboardShortcut.setTranslateKey = key => { ... }\n * ```\n *\n * Note: When the component detects the macOS operating system it bypasses key translation for\n * most modifiers and uses macOS-specific symbols. See the `isMac` prop for details.\n */\n translateKey?: TranslateKey\n /**\n * This prop is not meant to be passed. The component will automatically initialize it to `true`\n * if it detects that the current browser / operating system is on macOS, in which case modifier\n * keys are represented using macOS' notation (e.g. ⌘ ⌃ ⌥ ⇧).\n *\n * Though it is discouraged, if you don't want this special treatment in macOS, you can pass\n * `isMac={false}` in all invocations of this component.\n */\n isMac?: boolean\n}\n\nfunction KeyboardShortcut({\n children,\n className,\n translateKey = globalTranslateKey,\n isMac = navigator.platform?.toUpperCase().includes('MAC') ?? false,\n ...props\n}: Props) {\n const shortcuts = typeof children === 'string' ? [children] : children\n return (\n <span\n className={classNames('reactist_keyboard_shortcut', className, {\n 'reactist_keyboard_shortcut--macos': isMac,\n })}\n {...props}\n >\n {shortcuts.map((shortcut, i) => (\n <React.Fragment key={i}>\n {i === 0 ? null : ', '}\n <kbd>\n {parseKeys(shortcut, isMac, translateKey).map((key, j) => (\n <kbd key={j}>{key}</kbd>\n ))}\n </kbd>\n </React.Fragment>\n ))}\n </span>\n )\n}\n\nexport { KeyboardShortcut }\n"],"names":["globalTranslateKey","key","translateKeyMac","toLowerCase","KeyboardShortcut","children","className","translateKey","isMac","navigator","platform","_navigator$platform","toUpperCase","includes","props","shortcuts","React","classNames","map","shortcut","i","t","_hasModifiers","test","replace","split","str","isSpecialKey","charAt","slice","capitalize","length","parseKeys","j","setTranslateKey","tr"],"mappings":"8SAOIA,EAAqB,SAACC,UAAgBA,GAQ1C,SAASC,EAAgBD,UACbA,EAAIE,mBACH,UACA,YACM,QACN,cACA,aACM,QACN,YACM,QACN,cACM,QACN,cACM,mBAEAF,GAsFnB,SAASG,aACLC,IAAAA,SACAC,IAAAA,cACAC,aAAAA,aAAeP,QACfQ,MAAAA,iCAAQC,UAAUC,6BAAVC,EAAoBC,cAAcC,SAAS,yBAChDC,sCAEGC,EAAgC,iBAAbV,EAAwB,CAACA,GAAYA,SAE1DW,sCACIV,UAAWW,EAAW,6BAA8BX,EAAW,qCACtBE,KAErCM,GAEHC,EAAUG,KAAI,SAACC,EAAUC,UACtBJ,gBAACA,YAAef,IAAKmB,GACV,IAANA,EAAU,KAAO,KAClBJ,2BApFpB,SAAmBG,EAAkBX,EAAgBD,OAC3Cc,EAAIb,EAAQN,EAAkBK,EAC9Be,EATC,wCAAwCC,KASZJ,UAY9BX,IACDW,EAAWA,EAASK,QAAQ,iBAAkB,SAG3CL,EAASM,MAAM,YAAYP,cAdRQ,UAR9B,SAAsBA,SACX,kDAAkDH,KAAKG,GAQtDC,CAAaD,GAjBzB,SAAoBA,UACTA,EAAIE,OAAO,GAAGhB,cAAgBc,EAAIG,MAAM,GAAG1B,cAiBnC2B,CAAWT,EAAEK,IAEpBJ,GAAgC,IAAfI,EAAIK,OACdL,EAAId,cAERc,KA0EUM,CAAUb,EAAUX,EAAOD,GAAcW,KAAI,SAACjB,EAAKgC,UAChDjB,uBAAKf,IAAKgC,GAAIhC,YA7H1CG,EAAiB8B,gBAAkB,SAACC,GAChCnC,EAAqBmC"}
@@ -22,14 +22,16 @@ declare type MenuProps = Omit<Reakit.MenuInitialState, 'visible'> & {
22
22
  * management for the menu components inside it.
23
23
  */
24
24
  declare function Menu({ children, onItemSelect, ...props }: MenuProps): JSX.Element;
25
+ declare type MenuButtonProps = Omit<Reakit.MenuButtonProps, keyof Reakit.MenuStateReturn | 'className'>;
25
26
  /**
26
27
  * A button to toggle a dropdown menu open or closed.
27
28
  */
28
- declare const MenuButton: import("./type-helpers").ForwardRefComponentWithAs<"button", {}>;
29
+ declare const MenuButton: import("../../utils/polymorphism").PolymorphicComponent<"button", Pick<Reakit.MenuButtonProps, "children" | "unstable_system" | "disabled" | "focusable" | "unstable_clickOnEnter" | "unstable_clickOnSpace" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "ref" | "key" | "wrapElement" | "autoFocus" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value">, "obfuscateClassName">;
30
+ declare type MenuListProps = Omit<Reakit.MenuProps, keyof Reakit.MenuStateReturn | 'className'>;
29
31
  /**
30
32
  * The dropdown menu itself, containing a list of menu items.
31
33
  */
32
- declare const MenuList: import("./type-helpers").ForwardRefComponentWithAs<"div", {}>;
34
+ declare const MenuList: import("../../utils/polymorphism").PolymorphicComponent<"div", Pick<Reakit.MenuProps, "children" | "unstable_system" | "disabled" | "focusable" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "ref" | "key" | "wrapElement" | "hideOnClickOutside" | "preventBodyScroll" | "unstable_initialFocusRef" | "unstable_finalFocusRef" | "unstable_orphan" | "unstable_autoFocusOnShow" | "unstable_autoFocusOnHide">, "obfuscateClassName">;
33
35
  declare type MenuItemProps = {
34
36
  /**
35
37
  * An optional value given to this menu item. It is passed on to the parent `Menu`'s
@@ -48,10 +50,6 @@ declare type MenuItemProps = {
48
50
  * @default true
49
51
  */
50
52
  disabled?: boolean;
51
- /**
52
- * A class name to apply to the menu item element.
53
- */
54
- className?: string;
55
53
  /**
56
54
  * When `true` the menu will close when the menu item is selected, in addition to performing the
57
55
  * action that the menu item is set out to do.
@@ -88,7 +86,7 @@ declare type MenuItemProps = {
88
86
  * A menu item inside a menu list. It can be selected by the user, triggering the `onSelect`
89
87
  * callback.
90
88
  */
91
- declare const MenuItem: import("./type-helpers").ForwardRefComponentWithAs<"button", MenuItemProps>;
89
+ declare const MenuItem: import("../../utils/polymorphism").PolymorphicComponent<"button", MenuItemProps, "obfuscateClassName">;
92
90
  declare type SubMenuProps = Pick<MenuProps, 'children' | 'onItemSelect'>;
93
91
  /**
94
92
  * This component can be rendered alongside other `MenuItem` inside a `MenuList` in order to have
@@ -112,7 +110,7 @@ declare type SubMenuProps = Pick<MenuProps, 'children' | 'onItemSelect'>;
112
110
  * opening a sub-menu with the menu items list below it.
113
111
  */
114
112
  declare const SubMenu: React.ForwardRefExoticComponent<Pick<MenuProps, "children" | "onItemSelect"> & React.RefAttributes<HTMLButtonElement>>;
115
- declare type MenuGroupProps = NativeProps<HTMLDivElement> & {
113
+ declare type MenuGroupProps = Omit<NativeProps<HTMLDivElement>, 'className'> & {
116
114
  /**
117
115
  * A label to be shown visually and also used to semantically label the group.
118
116
  */
@@ -124,6 +122,6 @@ declare type MenuGroupProps = NativeProps<HTMLDivElement> & {
124
122
  * This group does not add any visual separator. You can do that yourself adding `<hr />` elements
125
123
  * before and/or after the group if you so wish.
126
124
  */
127
- declare const MenuGroup: import("./type-helpers").ForwardRefComponentWithAs<"div", MenuGroupProps>;
125
+ declare const MenuGroup: import("../../utils/polymorphism").PolymorphicComponent<"div", MenuGroupProps, "obfuscateClassName">;
128
126
  export { Menu, MenuButton, MenuList, MenuItem, SubMenu, MenuGroup };
129
- export type { MenuItemProps, SubMenuProps, MenuGroupProps };
127
+ export type { MenuButtonProps, MenuListProps, MenuItemProps, SubMenuProps, MenuGroupProps };
@@ -1,2 +1,2 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),r=(e(t),e(require("classnames"))),o=require("../../_virtual/_rollupPluginBabelHelpers.js"),n=require("./type-helpers.js"),a=require("reakit/Menu"),i=require("reakit/Popover"),l=t.createContext({});function s(e){var r=e.children,n=e.onItemSelect,i=o.objectWithoutPropertiesLoose(e,["children","onItemSelect"]),s=a.useMenuState(o.objectSpread2({loop:!0},i)),c=t.useCallback((function(e){n&&n(e)}),[n]),u=t.useMemo((function(){return o.objectSpread2(o.objectSpread2({},s),{},{handleItemSelect:c})}),[s,c]);return t.createElement(l.Provider,{value:u},r)}var c=n.forwardRefWithAs((function(e,n){var i=e.className,s=o.objectWithoutPropertiesLoose(e,["className"]),c=t.useContext(l),u=o.objectWithoutPropertiesLoose(c,["handleItemSelect"]);return t.createElement(a.MenuButton,Object.assign({},s,u,{ref:n,className:r("reactist_menubutton",i)}))})),u={width:"100%",height:"100%",position:"fixed",top:0,left:0};function d(e){return t.createElement(i.PopoverBackdrop,{baseId:e.baseId,visible:e.visible,animated:e.animated,animating:e.animating,stopAnimation:e.stopAnimation,modal:e.modal,style:u},e.children)}var m=n.forwardRefWithAs((function(e,n){var i=e.className,s=o.objectWithoutPropertiesLoose(e,["className"]),c=t.useContext(l),u=o.objectWithoutPropertiesLoose(c,["handleItemSelect"]);return u.visible?t.createElement(d,Object.assign({},u),t.createElement(a.Menu,Object.assign({},s,u,{ref:n,className:r("reactist_menulist",i)}))):null})),h=n.forwardRefWithAs((function(e,r){var n=e.value,i=e.children,s=e.onSelect,c=e.hideOnSelect,u=void 0===c||c,d=e.onClick,m=o.objectWithoutPropertiesLoose(e,["value","children","onSelect","hideOnSelect","onClick"]),h=t.useContext(l),p=h.handleItemSelect,b=o.objectWithoutPropertiesLoose(h,["handleItemSelect"]),f=b.hide,j=t.useCallback((function(e){null==d||d(e);var t=!1!==(s&&!e.defaultPrevented?s():void 0)&&u;p(n),t&&f()}),[s,d,p,u,f,n]);return t.createElement(a.MenuItem,Object.assign({},m,b,{ref:r,onClick:j}),i)})),p=t.forwardRef((function(e,n){var i=e.children,c=e.onItemSelect,u=o.objectWithoutPropertiesLoose(e,["children","onItemSelect"]),d=t.useContext(l),m=d.handleItemSelect,h=o.objectWithoutPropertiesLoose(d,["handleItemSelect"]),p=h.hide,b=t.useCallback((function(e){c&&c(e),m(e),p()}),[p,m,c]),f=t.Children.toArray(i),j=f[0],v=f[1];return t.createElement(a.MenuItem,Object.assign({},h,u,{ref:n}),(function(e){return t.createElement(s,{onItemSelect:b},t.cloneElement(j,o.objectSpread2(o.objectSpread2({},e),{},{className:r(e.className,"reactist_submenu_button")})),v)}))})),b=n.forwardRefWithAs((function(e,r){var n=e.label,i=e.children,s=o.objectWithoutPropertiesLoose(e,["label","children"]),c=t.useContext(l),u=o.objectWithoutPropertiesLoose(c,["handleItemSelect"]);return t.createElement(a.MenuGroup,Object.assign({ref:r},s,u),n?t.createElement("div",{role:"presentation",className:"reactist_menugroup__label"},n):null,i)}));exports.Menu=s,exports.MenuButton=c,exports.MenuGroup=b,exports.MenuItem=h,exports.MenuList=m,exports.SubMenu=p;
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../_virtual/_rollupPluginBabelHelpers.js"),o=require("react"),n=(e(o),e(require("classnames"))),r=require("../../utils/polymorphism.js"),l=require("../../hooks/use-previous/use-previous.js"),i=require("reakit/Menu"),a=require("reakit/Popover"),s=["children","onItemSelect"],c=["exceptionallySetClassName"],u=["handleItemSelect"],m=["exceptionallySetClassName"],p=["handleItemSelect"],d=["value","children","onSelect","hideOnSelect","onClick","exceptionallySetClassName"],b=["handleItemSelect"],h=["children","onItemSelect"],f=["handleItemSelect"],v=["label","children","exceptionallySetClassName"],S=["handleItemSelect"],j=o.createContext({});function C(e){var n=e.children,r=e.onItemSelect,l=t.objectWithoutPropertiesLoose(e,s),a=i.useMenuState(t.objectSpread2({loop:!0},l)),c=o.useCallback((function(e){r&&r(e)}),[r]),u=o.useMemo((function(){return t.objectSpread2(t.objectSpread2({},a),{},{handleItemSelect:c})}),[a,c]);return o.createElement(j.Provider,{value:u},n)}var x=r.polymorphicComponent((function(e,r){var l=e.exceptionallySetClassName,a=t.objectWithoutPropertiesLoose(e,c),s=o.useContext(j),m=t.objectWithoutPropertiesLoose(s,u);return o.createElement(i.MenuButton,Object.assign({},a,m,{ref:r,className:n("reactist_menubutton",l)}))})),I={width:"100%",height:"100%",position:"fixed",top:0,left:0};function P(e){return o.createElement(a.PopoverBackdrop,{baseId:e.baseId,visible:e.visible,animated:e.animated,animating:e.animating,stopAnimation:e.stopAnimation,modal:e.modal,style:I},e.children)}var y=r.polymorphicComponent((function(e,r){var a=e.exceptionallySetClassName,s=t.objectWithoutPropertiesLoose(e,m),c=o.useContext(j),u=t.objectWithoutPropertiesLoose(c,p),d=l.usePrevious(u.visible);return o.useEffect((function(){var e,t;!1===u.visible&&!0===d&&(null===(e=u.unstable_referenceRef)||void 0===e||null===(t=e.current)||void 0===t||t.focus())}),[u.visible,d,u.unstable_referenceRef]),u.visible?o.createElement(P,Object.assign({},u),o.createElement(i.Menu,Object.assign({},s,u,{ref:r,className:n("reactist_menulist",a)}))):null})),M=r.polymorphicComponent((function(e,n){var r=e.value,l=e.children,a=e.onSelect,s=e.hideOnSelect,c=void 0===s||s,u=e.onClick,m=e.exceptionallySetClassName,p=t.objectWithoutPropertiesLoose(e,d),h=o.useContext(j),f=h.handleItemSelect,v=t.objectWithoutPropertiesLoose(h,b),S=v.hide,C=o.useCallback((function(e){null==u||u(e);var t=!1!==(a&&!e.defaultPrevented?a():void 0)&&c;f(r),t&&S()}),[a,u,f,c,S,r]);return o.createElement(i.MenuItem,Object.assign({},p,v,{ref:n,onClick:C,className:m}),l)})),N=o.forwardRef((function(e,r){var l=e.children,a=e.onItemSelect,s=t.objectWithoutPropertiesLoose(e,h),c=o.useContext(j),u=c.handleItemSelect,m=t.objectWithoutPropertiesLoose(c,f),p=m.hide,d=o.useCallback((function(e){a&&a(e),u(e),p()}),[p,u,a]),b=o.Children.toArray(l),v=b[0],S=b[1];return o.createElement(i.MenuItem,Object.assign({},m,s,{ref:r}),(function(e){return o.createElement(C,{onItemSelect:d},o.cloneElement(v,t.objectSpread2(t.objectSpread2({},e),{},{className:n(e.className,"reactist_submenu_button")})),S)}))})),_=r.polymorphicComponent((function(e,n){var r=e.label,l=e.children,a=e.exceptionallySetClassName,s=t.objectWithoutPropertiesLoose(e,v),c=o.useContext(j),u=t.objectWithoutPropertiesLoose(c,S);return o.createElement(i.MenuGroup,Object.assign({ref:n},s,u,{className:a}),r?o.createElement("div",{role:"presentation",className:"reactist_menugroup__label"},r):null,l)}));exports.Menu=C,exports.MenuButton=x,exports.MenuGroup=_,exports.MenuItem=M,exports.MenuList=y,exports.SubMenu=N;
2
2
  //# sourceMappingURL=menu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","sources":["../../../src/components/menu/menu.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\nimport { forwardRefWithAs } from './type-helpers'\n\n//\n// Reactist menu is a thin wrapper around Reakit's menu components. This may or may not be\n// temporary. Our goal is to make it transparent for the users of Reactist of this implementation\n// detail. We may change in the future the external lib we use, or even implement it all internally,\n// as long as we keep the same outer interface as intact as possible.\n//\n// Around the heavy lifting of the external lib we just add some features to better integrate the\n// menu to Reactist's more opinionated approach (e.g. using our button with its custom variants and\n// other features, easily show keyboard shortcuts in menu items, etc.)\n//\nimport * as Reakit from 'reakit/Menu'\nimport { PopoverBackdrop } from 'reakit/Popover'\n\nimport './menu.less'\n\ntype NativeProps<E extends HTMLElement> = React.DetailedHTMLProps<React.HTMLAttributes<E>, E>\n\ntype MenuContextState = Reakit.MenuStateReturn & {\n handleItemSelect: (value: string | null | undefined) => void\n}\n\nconst MenuContext = React.createContext<MenuContextState>(\n // Reakit gives us no means to obtain a valid initial/default value of type MenuStateReturn\n // (it is normally obtained by calling useMenuState but we can't call hooks outside components).\n // This is however of little consequence since this value is only used if some of the components\n // are used outside Menu, something that should not happen and we do not support.\n // @ts-expect-error\n {},\n)\n\n//\n// Menu\n//\n\ntype MenuProps = Omit<Reakit.MenuInitialState, 'visible'> & {\n /**\n * The `Menu` must contain a `MenuList` that defines the menu options. It must also contain a\n * `MenuButton` that triggers the menu to be opened or closed.\n */\n children: React.ReactNode\n\n /**\n * An optional callback that will be called back whenever a menu item is selected. It receives\n * the `value` of the selected `MenuItem`.\n *\n * If you pass down this callback, it is recommended that you properly memoize it so it does not\n * change on every render.\n */\n onItemSelect?: (value: string | null | undefined) => void\n}\n\n/**\n * Wrapper component to control a menu. It does not render anything, only providing the state\n * management for the menu components inside it.\n */\nfunction Menu({ children, onItemSelect, ...props }: MenuProps) {\n const state = Reakit.useMenuState({ loop: true, ...props })\n\n const handleItemSelect = React.useCallback(\n function handleItemSelect(value: string | null | undefined) {\n if (onItemSelect) onItemSelect(value)\n },\n [onItemSelect],\n )\n\n const value: MenuContextState = React.useMemo(\n () => ({\n ...state,\n handleItemSelect,\n }),\n [state, handleItemSelect],\n )\n\n return <MenuContext.Provider value={value}>{children}</MenuContext.Provider>\n}\n\n//\n// MenuButton\n//\n\n/**\n * A button to toggle a dropdown menu open or closed.\n */\nconst MenuButton = forwardRefWithAs<'button'>(function MenuButton({ className, ...props }, ref) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n return (\n <Reakit.MenuButton\n {...props}\n {...state}\n ref={ref}\n className={classNames('reactist_menubutton', className)}\n />\n )\n})\n\n//\n// MenuList\n//\n\ntype MenuBackdropProps = Reakit.MenuStateReturn & {\n children: React.ReactNode\n}\n\nconst BACKDROP_STYLE: React.CSSProperties = {\n width: '100%',\n height: '100%',\n position: 'fixed',\n top: 0,\n left: 0,\n}\n\n/**\n * Internal component to provide a backdrop/overlay to all menus. This is needed because reakit's\n * menus do not show an overlay by default.\n */\nfunction MenuBackdrop({\n baseId,\n visible,\n animated,\n animating,\n stopAnimation,\n modal,\n children,\n}: MenuBackdropProps) {\n return (\n <PopoverBackdrop\n baseId={baseId}\n visible={visible}\n animated={animated}\n animating={animating}\n stopAnimation={stopAnimation}\n modal={modal}\n style={BACKDROP_STYLE}\n >\n {children}\n </PopoverBackdrop>\n )\n}\n\n/**\n * The dropdown menu itself, containing a list of menu items.\n */\nconst MenuList = forwardRefWithAs<'div'>(function MenuList({ className, ...props }, ref) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n return state.visible ? (\n <MenuBackdrop {...state}>\n <Reakit.Menu\n {...props}\n {...state}\n ref={ref}\n className={classNames('reactist_menulist', className)}\n />\n </MenuBackdrop>\n ) : null\n})\n\n//\n// MenuItem\n//\n\ntype MenuItemProps = {\n /**\n * An optional value given to this menu item. It is passed on to the parent `Menu`'s\n * `onItemSelect` when you provide that instead of (or alongside) providing individual\n * `onSelect` callbacks to each menu item.\n */\n value?: string\n /**\n * The content inside the menu item.\n */\n children: React.ReactNode\n /**\n * When `true` the menu item is disabled and won't be selectable or be part of the keyboard\n * navigation across the menu options.\n *\n * @default true\n */\n disabled?: boolean\n /**\n * A class name to apply to the menu item element.\n */\n className?: string\n /**\n * When `true` the menu will close when the menu item is selected, in addition to performing the\n * action that the menu item is set out to do.\n *\n * Set this to `false` to make sure that a given menu item does not auto-closes the menu when\n * selected. This should be the exception and not the norm, as the default is to auto-close.\n *\n * @default true\n */\n hideOnSelect?: boolean\n /**\n * The action to perform when the menu item is selected.\n *\n * If you return `false` from this function, the menu will not auto-close when this menu item\n * is selected. Though you should use `hideOnSelect` for this purpose, this allows you to\n * achieve the same effect conditionally and dynamically deciding at run time.\n */\n onSelect?: () => unknown\n /**\n * The event handler called when the menu item is clicked.\n *\n * This is similar to `onSelect`, but a bit different. You can certainly use it to trigger the\n * action that the menu item represents. But in general you should prefer `onSelect` for that.\n *\n * The main use for this handler is to get access to the click event. This can be used, for\n * example, to call `event.preventDefault()`, which will effectively prevent the rest of the\n * consequences of the click, including preventing `onSelect` from being called. In particular,\n * this is useful in menu items that are links, and you want the click to not trigger navigation\n * under some circumstances.\n */\n onClick?: (event: React.MouseEvent) => void\n}\n\n/**\n * A menu item inside a menu list. It can be selected by the user, triggering the `onSelect`\n * callback.\n */\nconst MenuItem = forwardRefWithAs<'button', MenuItemProps>(function MenuItem(\n { value, children, onSelect, hideOnSelect = true, onClick, ...props },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n const { hide } = state\n\n const handleClick = React.useCallback(\n function handleClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event)\n const onSelectResult: unknown =\n onSelect && !event.defaultPrevented ? onSelect() : undefined\n const shouldClose = onSelectResult !== false && hideOnSelect\n handleItemSelect(value)\n if (shouldClose) hide()\n },\n [onSelect, onClick, handleItemSelect, hideOnSelect, hide, value],\n )\n\n return (\n <Reakit.MenuItem {...props} {...state} ref={ref} onClick={handleClick}>\n {children}\n </Reakit.MenuItem>\n )\n})\n\n//\n// SubMenu\n//\n\ntype SubMenuProps = Pick<MenuProps, 'children' | 'onItemSelect'>\n\n/**\n * This component can be rendered alongside other `MenuItem` inside a `MenuList` in order to have\n * a sub-menu.\n *\n * Its children are expected to have the structure of a first level menu (a `MenuButton` and a\n * `MenuList`).\n *\n * ```jsx\n * <MenuItem label=\"Edit profile\" />\n * <SubMenu>\n * <MenuButton>More options</MenuButton>\n * <MenuList>\n * <MenuItem label=\"Preferences\" />\n * <MenuItem label=\"Sign out\" />\n * </MenuList>\n * </SubMenu>\n * ```\n *\n * The `MenuButton` will become a menu item in the current menu items list, and it will lead to\n * opening a sub-menu with the menu items list below it.\n */\nconst SubMenu = React.forwardRef<HTMLButtonElement, SubMenuProps>(function SubMenu(\n { children, onItemSelect, ...props },\n ref,\n) {\n const { handleItemSelect: parentMenuItemSelect, ...state } = React.useContext(MenuContext)\n const { hide: parentMenuHide } = state\n\n const handleSubItemSelect = React.useCallback(\n function handleSubItemSelect(value) {\n if (onItemSelect) onItemSelect(value)\n parentMenuItemSelect(value)\n parentMenuHide()\n },\n [parentMenuHide, parentMenuItemSelect, onItemSelect],\n )\n\n const [button, list] = React.Children.toArray(children)\n\n return (\n <Reakit.MenuItem {...state} {...props} ref={ref}>\n {(buttonProps) => (\n <Menu onItemSelect={handleSubItemSelect}>\n {React.cloneElement(button as React.ReactElement, {\n ...buttonProps,\n className: classNames(buttonProps.className, 'reactist_submenu_button'),\n })}\n {list}\n </Menu>\n )}\n </Reakit.MenuItem>\n )\n})\n\n//\n// MenuGroup\n//\n\ntype MenuGroupProps = NativeProps<HTMLDivElement> & {\n /**\n * A label to be shown visually and also used to semantically label the group.\n */\n label: string\n}\n\n/**\n * A way to semantically group some menu items.\n *\n * This group does not add any visual separator. You can do that yourself adding `<hr />` elements\n * before and/or after the group if you so wish.\n */\nconst MenuGroup = forwardRefWithAs<'div', MenuGroupProps>(function MenuGroud(\n { label, children, ...props },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n return (\n <Reakit.MenuGroup ref={ref} {...props} {...state}>\n {label ? (\n <div role=\"presentation\" className=\"reactist_menugroup__label\">\n {label}\n </div>\n ) : null}\n {children}\n </Reakit.MenuGroup>\n )\n})\n\nexport { Menu, MenuButton, MenuList, MenuItem, SubMenu, MenuGroup }\nexport type { MenuItemProps, SubMenuProps, MenuGroupProps }\n"],"names":["MenuContext","React","Menu","children","onItemSelect","props","state","Reakit","loop","handleItemSelect","value","Provider","MenuButton","forwardRefWithAs","ref","className","classNames","BACKDROP_STYLE","width","height","position","top","left","MenuBackdrop","PopoverBackdrop","baseId","visible","animated","animating","stopAnimation","modal","style","MenuList","MenuItem","onSelect","hideOnSelect","onClick","hide","handleClick","event","shouldClose","defaultPrevented","undefined","SubMenu","parentMenuItemSelect","parentMenuHide","handleSubItemSelect","toArray","button","list","buttonProps","MenuGroup","label","role"],"mappings":"gVAyBMA,EAAcC,gBAMhB,IA4BJ,SAASC,SAAOC,IAAAA,SAAUC,IAAAA,aAAiBC,gEACjCC,EAAQC,gCAAsBC,MAAM,GAASH,IAE7CI,EAAmBR,eACrB,SAA0BS,GAClBN,GAAcA,EAAaM,KAEnC,CAACN,IAGCM,EAA0BT,WAC5B,qDACOK,OACHG,iBAAAA,MAEJ,CAACH,EAAOG,WAGLR,gBAACD,EAAYW,UAASD,MAAOA,GAAQP,OAU1CS,EAAaC,oBAA2B,WAA6CC,OAAvBC,IAAAA,UAAcV,oDACvCJ,aAAiBD,GAA3BM,gEAEzBL,gBAACM,8BACOF,EACAC,GACJQ,IAAKA,EACLC,UAAWC,EAAW,sBAAuBD,SAanDE,EAAsC,CACxCC,MAAO,OACPC,OAAQ,OACRC,SAAU,QACVC,IAAK,EACLC,KAAM,GAOV,SAASC,YAUDtB,gBAACuB,mBACGC,SAVRA,OAWQC,UAVRA,QAWQC,WAVRA,SAWQC,YAVRA,UAWQC,gBAVRA,cAWQC,QAVRA,MAWQC,MAAOd,KAVfd,cAoBE6B,EAAWnB,oBAAwB,WAA2CC,OAAvBC,IAAAA,UAAcV,oDAChCJ,aAAiBD,GAA3BM,gEACtBA,EAAMoB,QACTzB,gBAACsB,mBAAiBjB,GACdL,gBAACM,wBACOF,EACAC,GACJQ,IAAKA,EACLC,UAAWC,EAAW,oBAAqBD,OAGnD,QAkEFkB,EAAWpB,oBAA0C,WAEvDC,OADEJ,IAAAA,MAAOP,IAAAA,SAAU+B,IAAAA,aAAUC,aAAAA,gBAAqBC,IAAAA,QAAY/B,+FAGvBJ,aAAiBD,GAAhDS,IAAAA,iBAAqBH,yDACrB+B,EAAS/B,EAAT+B,KAEFC,EAAcrC,eAChB,SAAqBsC,GACjBH,MAAAA,GAAAA,EAAUG,OAGJC,GAAiC,KADnCN,IAAaK,EAAME,iBAAmBP,SAAaQ,IACPP,EAChD1B,EAAiBC,GACb8B,GAAaH,MAErB,CAACH,EAAUE,EAAS3B,EAAkB0B,EAAcE,EAAM3B,WAI1DT,gBAACM,4BAAoBF,EAAWC,GAAOQ,IAAKA,EAAKsB,QAASE,IACrDnC,MAgCPwC,EAAU1C,cAAkD,WAE9Da,OADEX,IAAAA,SAAUC,IAAAA,aAAiBC,kEAGgCJ,aAAiBD,GAApD4C,IAAlBnC,iBAA2CH,yDACrCuC,EAAmBvC,EAAzB+B,KAEFS,EAAsB7C,eACxB,SAA6BS,GACrBN,GAAcA,EAAaM,GAC/BkC,EAAqBlC,GACrBmC,MAEJ,CAACA,EAAgBD,EAAsBxC,MAGpBH,WAAe8C,QAAQ5C,GAAvC6C,OAAQC,cAGXhD,gBAACM,4BAAoBD,EAAWD,GAAOS,IAAKA,KACvC,SAACoC,UACEjD,gBAACC,GAAKE,aAAc0C,GACf7C,eAAmB+C,qCACbE,OACHnC,UAAWC,EAAWkC,EAAYnC,UAAW,8BAEhDkC,SAwBfE,EAAYtC,oBAAwC,WAEtDC,OADEsC,IAAAA,MAAOjD,IAAAA,SAAaE,2DAGiBJ,aAAiBD,GAA3BM,gEAEzBL,gBAACM,2BAAiBO,IAAKA,GAAST,EAAWC,GACtC8C,EACGnD,uBAAKoD,KAAK,eAAetC,UAAU,6BAC9BqC,GAEL,KACHjD"}
1
+ {"version":3,"file":"menu.js","sources":["../../../src/components/menu/menu.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { usePrevious } from '../../hooks/use-previous'\n\n//\n// Reactist menu is a thin wrapper around Reakit's menu components. This may or may not be\n// temporary. Our goal is to make it transparent for the users of Reactist of this implementation\n// detail. We may change in the future the external lib we use, or even implement it all internally,\n// as long as we keep the same outer interface as intact as possible.\n//\n// Around the heavy lifting of the external lib we just add some features to better integrate the\n// menu to Reactist's more opinionated approach (e.g. using our button with its custom variants and\n// other features, easily show keyboard shortcuts in menu items, etc.)\n//\nimport * as Reakit from 'reakit/Menu'\nimport { PopoverBackdrop } from 'reakit/Popover'\n\nimport './menu.less'\n\ntype NativeProps<E extends HTMLElement> = React.DetailedHTMLProps<React.HTMLAttributes<E>, E>\n\ntype MenuContextState = Reakit.MenuStateReturn & {\n handleItemSelect: (value: string | null | undefined) => void\n}\n\nconst MenuContext = React.createContext<MenuContextState>(\n // Reakit gives us no means to obtain a valid initial/default value of type MenuStateReturn\n // (it is normally obtained by calling useMenuState but we can't call hooks outside components).\n // This is however of little consequence since this value is only used if some of the components\n // are used outside Menu, something that should not happen and we do not support.\n // @ts-expect-error\n {},\n)\n\n//\n// Menu\n//\n\ntype MenuProps = Omit<Reakit.MenuInitialState, 'visible'> & {\n /**\n * The `Menu` must contain a `MenuList` that defines the menu options. It must also contain a\n * `MenuButton` that triggers the menu to be opened or closed.\n */\n children: React.ReactNode\n\n /**\n * An optional callback that will be called back whenever a menu item is selected. It receives\n * the `value` of the selected `MenuItem`.\n *\n * If you pass down this callback, it is recommended that you properly memoize it so it does not\n * change on every render.\n */\n onItemSelect?: (value: string | null | undefined) => void\n}\n\n/**\n * Wrapper component to control a menu. It does not render anything, only providing the state\n * management for the menu components inside it.\n */\nfunction Menu({ children, onItemSelect, ...props }: MenuProps) {\n const state = Reakit.useMenuState({ loop: true, ...props })\n\n const handleItemSelect = React.useCallback(\n function handleItemSelect(value: string | null | undefined) {\n if (onItemSelect) onItemSelect(value)\n },\n [onItemSelect],\n )\n\n const value: MenuContextState = React.useMemo(\n () => ({\n ...state,\n handleItemSelect,\n }),\n [state, handleItemSelect],\n )\n\n return <MenuContext.Provider value={value}>{children}</MenuContext.Provider>\n}\n\n//\n// MenuButton\n//\n\ntype MenuButtonProps = Omit<Reakit.MenuButtonProps, keyof Reakit.MenuStateReturn | 'className'>\n\n/**\n * A button to toggle a dropdown menu open or closed.\n */\nconst MenuButton = polymorphicComponent<'button', MenuButtonProps>(function MenuButton(\n { exceptionallySetClassName, ...props },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n return (\n <Reakit.MenuButton\n {...props}\n {...state}\n ref={ref}\n className={classNames('reactist_menubutton', exceptionallySetClassName)}\n />\n )\n})\n\n//\n// MenuList\n//\n\ntype MenuBackdropProps = Reakit.MenuStateReturn & {\n children: React.ReactNode\n}\n\nconst BACKDROP_STYLE: React.CSSProperties = {\n width: '100%',\n height: '100%',\n position: 'fixed',\n top: 0,\n left: 0,\n}\n\n/**\n * Internal component to provide a backdrop/overlay to all menus. This is needed because reakit's\n * menus do not show an overlay by default.\n */\nfunction MenuBackdrop({\n baseId,\n visible,\n animated,\n animating,\n stopAnimation,\n modal,\n children,\n}: MenuBackdropProps) {\n return (\n <PopoverBackdrop\n baseId={baseId}\n visible={visible}\n animated={animated}\n animating={animating}\n stopAnimation={stopAnimation}\n modal={modal}\n style={BACKDROP_STYLE}\n >\n {children}\n </PopoverBackdrop>\n )\n}\n\ntype MenuListProps = Omit<Reakit.MenuProps, keyof Reakit.MenuStateReturn | 'className'>\n\n/**\n * The dropdown menu itself, containing a list of menu items.\n */\nconst MenuList = polymorphicComponent<'div', MenuListProps>(function MenuList(\n { exceptionallySetClassName, ...props },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n const previousVisible = usePrevious(state.visible)\n\n React.useEffect(\n function focusTriggerOnClose() {\n if (state.visible === false && previousVisible === true) {\n state.unstable_referenceRef?.current?.focus()\n }\n },\n [state.visible, previousVisible, state.unstable_referenceRef],\n )\n\n return state.visible ? (\n <MenuBackdrop {...state}>\n <Reakit.Menu\n {...props}\n {...state}\n ref={ref}\n className={classNames('reactist_menulist', exceptionallySetClassName)}\n />\n </MenuBackdrop>\n ) : null\n})\n\n//\n// MenuItem\n//\n\ntype MenuItemProps = {\n /**\n * An optional value given to this menu item. It is passed on to the parent `Menu`'s\n * `onItemSelect` when you provide that instead of (or alongside) providing individual\n * `onSelect` callbacks to each menu item.\n */\n value?: string\n /**\n * The content inside the menu item.\n */\n children: React.ReactNode\n /**\n * When `true` the menu item is disabled and won't be selectable or be part of the keyboard\n * navigation across the menu options.\n *\n * @default true\n */\n disabled?: boolean\n /**\n * When `true` the menu will close when the menu item is selected, in addition to performing the\n * action that the menu item is set out to do.\n *\n * Set this to `false` to make sure that a given menu item does not auto-closes the menu when\n * selected. This should be the exception and not the norm, as the default is to auto-close.\n *\n * @default true\n */\n hideOnSelect?: boolean\n /**\n * The action to perform when the menu item is selected.\n *\n * If you return `false` from this function, the menu will not auto-close when this menu item\n * is selected. Though you should use `hideOnSelect` for this purpose, this allows you to\n * achieve the same effect conditionally and dynamically deciding at run time.\n */\n onSelect?: () => unknown\n /**\n * The event handler called when the menu item is clicked.\n *\n * This is similar to `onSelect`, but a bit different. You can certainly use it to trigger the\n * action that the menu item represents. But in general you should prefer `onSelect` for that.\n *\n * The main use for this handler is to get access to the click event. This can be used, for\n * example, to call `event.preventDefault()`, which will effectively prevent the rest of the\n * consequences of the click, including preventing `onSelect` from being called. In particular,\n * this is useful in menu items that are links, and you want the click to not trigger navigation\n * under some circumstances.\n */\n onClick?: (event: React.MouseEvent) => void\n}\n\n/**\n * A menu item inside a menu list. It can be selected by the user, triggering the `onSelect`\n * callback.\n */\nconst MenuItem = polymorphicComponent<'button', MenuItemProps>(function MenuItem(\n {\n value,\n children,\n onSelect,\n hideOnSelect = true,\n onClick,\n exceptionallySetClassName,\n ...props\n },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n const { hide } = state\n\n const handleClick = React.useCallback(\n function handleClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event)\n const onSelectResult: unknown =\n onSelect && !event.defaultPrevented ? onSelect() : undefined\n const shouldClose = onSelectResult !== false && hideOnSelect\n handleItemSelect(value)\n if (shouldClose) hide()\n },\n [onSelect, onClick, handleItemSelect, hideOnSelect, hide, value],\n )\n\n return (\n <Reakit.MenuItem\n {...props}\n {...state}\n ref={ref}\n onClick={handleClick}\n className={exceptionallySetClassName}\n >\n {children}\n </Reakit.MenuItem>\n )\n})\n\n//\n// SubMenu\n//\n\ntype SubMenuProps = Pick<MenuProps, 'children' | 'onItemSelect'>\n\n/**\n * This component can be rendered alongside other `MenuItem` inside a `MenuList` in order to have\n * a sub-menu.\n *\n * Its children are expected to have the structure of a first level menu (a `MenuButton` and a\n * `MenuList`).\n *\n * ```jsx\n * <MenuItem label=\"Edit profile\" />\n * <SubMenu>\n * <MenuButton>More options</MenuButton>\n * <MenuList>\n * <MenuItem label=\"Preferences\" />\n * <MenuItem label=\"Sign out\" />\n * </MenuList>\n * </SubMenu>\n * ```\n *\n * The `MenuButton` will become a menu item in the current menu items list, and it will lead to\n * opening a sub-menu with the menu items list below it.\n */\nconst SubMenu = React.forwardRef<HTMLButtonElement, SubMenuProps>(function SubMenu(\n { children, onItemSelect, ...props },\n ref,\n) {\n const { handleItemSelect: parentMenuItemSelect, ...state } = React.useContext(MenuContext)\n const { hide: parentMenuHide } = state\n\n const handleSubItemSelect = React.useCallback(\n function handleSubItemSelect(value) {\n if (onItemSelect) onItemSelect(value)\n parentMenuItemSelect(value)\n parentMenuHide()\n },\n [parentMenuHide, parentMenuItemSelect, onItemSelect],\n )\n\n const [button, list] = React.Children.toArray(children)\n\n return (\n <Reakit.MenuItem {...state} {...props} ref={ref}>\n {(buttonProps) => (\n <Menu onItemSelect={handleSubItemSelect}>\n {React.cloneElement(button as React.ReactElement, {\n ...buttonProps,\n className: classNames(buttonProps.className, 'reactist_submenu_button'),\n })}\n {list}\n </Menu>\n )}\n </Reakit.MenuItem>\n )\n})\n\n//\n// MenuGroup\n//\n\ntype MenuGroupProps = Omit<NativeProps<HTMLDivElement>, 'className'> & {\n /**\n * A label to be shown visually and also used to semantically label the group.\n */\n label: string\n}\n\n/**\n * A way to semantically group some menu items.\n *\n * This group does not add any visual separator. You can do that yourself adding `<hr />` elements\n * before and/or after the group if you so wish.\n */\nconst MenuGroup = polymorphicComponent<'div', MenuGroupProps>(function MenuGroud(\n { label, children, exceptionallySetClassName, ...props },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n return (\n <Reakit.MenuGroup ref={ref} {...props} {...state} className={exceptionallySetClassName}>\n {label ? (\n <div role=\"presentation\" className=\"reactist_menugroup__label\">\n {label}\n </div>\n ) : null}\n {children}\n </Reakit.MenuGroup>\n )\n})\n\nexport { Menu, MenuButton, MenuList, MenuItem, SubMenu, MenuGroup }\nexport type { MenuButtonProps, MenuListProps, MenuItemProps, SubMenuProps, MenuGroupProps }\n"],"names":["MenuContext","React","Menu","children","onItemSelect","props","state","Reakit","loop","handleItemSelect","value","Provider","MenuButton","polymorphicComponent","ref","exceptionallySetClassName","className","classNames","BACKDROP_STYLE","width","height","position","top","left","MenuBackdrop","PopoverBackdrop","baseId","visible","animated","animating","stopAnimation","modal","style","MenuList","previousVisible","usePrevious","unstable_referenceRef","current","focus","MenuItem","onSelect","hideOnSelect","onClick","hide","handleClick","event","shouldClose","defaultPrevented","undefined","SubMenu","parentMenuItemSelect","parentMenuHide","handleSubItemSelect","toArray","button","list","buttonProps","MenuGroup","label","role"],"mappings":"ywBA0BMA,EAAcC,gBAMhB,IA4BJ,SAASC,SAAOC,IAAAA,SAAUC,IAAAA,aAAiBC,sCACjCC,EAAQC,gCAAsBC,MAAM,GAASH,IAE7CI,EAAmBR,eACrB,SAA0BS,GAClBN,GAAcA,EAAaM,KAEnC,CAACN,IAGCM,EAA0BT,WAC5B,qDACOK,OACHG,iBAAAA,MAEJ,CAACH,EAAOG,WAGLR,gBAACD,EAAYW,UAASD,MAAOA,GAAQP,OAY1CS,EAAaC,wBAAgD,WAE/DC,OADEC,IAAAA,0BAA8BV,wCAGOJ,aAAiBD,GAA3BM,6CAEzBL,gBAACM,8BACOF,EACAC,GACJQ,IAAKA,EACLE,UAAWC,EAAW,sBAAuBF,SAanDG,EAAsC,CACxCC,MAAO,OACPC,OAAQ,OACRC,SAAU,QACVC,IAAK,EACLC,KAAM,GAOV,SAASC,YAUDvB,gBAACwB,mBACGC,SAVRA,OAWQC,UAVRA,QAWQC,WAVRA,SAWQC,YAVRA,UAWQC,gBAVRA,cAWQC,QAVRA,MAWQC,MAAOd,KAVff,cAsBE8B,EAAWpB,wBAA2C,WAExDC,OADEC,IAAAA,0BAA8BV,wCAGOJ,aAAiBD,GAA3BM,sCACvB4B,EAAkBC,cAAY7B,EAAMqB,gBAE1C1B,aACI,oBAC0B,IAAlBK,EAAMqB,UAAyC,IAApBO,cAC3B5B,EAAM8B,gDAAuBC,wBAASC,WAG9C,CAAChC,EAAMqB,QAASO,EAAiB5B,EAAM8B,wBAGpC9B,EAAMqB,QACT1B,gBAACuB,mBAAiBlB,GACdL,gBAACM,wBACOF,EACAC,GACJQ,IAAKA,EACLE,UAAWC,EAAW,oBAAqBF,OAGnD,QA8DFwB,EAAW1B,wBAA8C,WAU3DC,OARIJ,IAAAA,MACAP,IAAAA,SACAqC,IAAAA,aACAC,aAAAA,gBACAC,IAAAA,QACA3B,IAAAA,0BACGV,wCAIgCJ,aAAiBD,GAAhDS,IAAAA,iBAAqBH,sCACrBqC,EAASrC,EAATqC,KAEFC,EAAc3C,eAChB,SAAqB4C,GACjBH,MAAAA,GAAAA,EAAUG,OAGJC,GAAiC,KADnCN,IAAaK,EAAME,iBAAmBP,SAAaQ,IACPP,EAChDhC,EAAiBC,GACboC,GAAaH,MAErB,CAACH,EAAUE,EAASjC,EAAkBgC,EAAcE,EAAMjC,WAI1DT,gBAACM,4BACOF,EACAC,GACJQ,IAAKA,EACL4B,QAASE,EACT5B,UAAWD,IAEVZ,MAgCP8C,EAAUhD,cAAkD,WAE9Da,OADEX,IAAAA,SAAUC,IAAAA,aAAiBC,wCAGgCJ,aAAiBD,GAApDkD,IAAlBzC,iBAA2CH,sCACrC6C,EAAmB7C,EAAzBqC,KAEFS,EAAsBnD,eACxB,SAA6BS,GACrBN,GAAcA,EAAaM,GAC/BwC,EAAqBxC,GACrByC,MAEJ,CAACA,EAAgBD,EAAsB9C,MAGpBH,WAAeoD,QAAQlD,GAAvCmD,OAAQC,cAGXtD,gBAACM,4BAAoBD,EAAWD,GAAOS,IAAKA,KACvC,SAAC0C,UACEvD,gBAACC,GAAKE,aAAcgD,GACfnD,eAAmBqD,qCACbE,OACHxC,UAAWC,EAAWuC,EAAYxC,UAAW,8BAEhDuC,SAwBfE,EAAY5C,wBAA4C,WAE1DC,OADE4C,IAAAA,MAAOvD,IAAAA,SAAUY,IAAAA,0BAA8BV,wCAGVJ,aAAiBD,GAA3BM,6CAEzBL,gBAACM,2BAAiBO,IAAKA,GAAST,EAAWC,GAAOU,UAAWD,IACxD2C,EACGzD,uBAAK0D,KAAK,eAAe3C,UAAU,6BAC9B0C,GAEL,KACHvD"}
@@ -0,0 +1 @@
1
+ export {};
@@ -11,6 +11,8 @@ declare type NotificationProps = {
11
11
  onClose?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
12
12
  closeAltText?: string;
13
13
  className?: string;
14
- } & JSX.IntrinsicElements['div'];
15
- declare function Notification({ id, icon, title, subtitle, children, customCloseButton, onClick, onClose, closeAltText, className, ...rest }: NotificationProps): JSX.Element;
14
+ /** Indicates that the notification will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */
15
+ 'aria-live'?: 'off' | 'polite' | 'assertive';
16
+ } & Omit<JSX.IntrinsicElements['div'], 'aria-live'>;
17
+ declare function Notification({ id, icon, title, subtitle, children, customCloseButton, onClick, onClose, closeAltText, className, 'aria-live': ariaLive, ...rest }: NotificationProps): JSX.Element;
16
18
  export { Notification };
@@ -1,2 +1,2 @@
1
- "use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("react")),l=t(require("classnames")),i=require("../../_virtual/_rollupPluginBabelHelpers.js"),n=require("../icons/CloseIcon.svg.js");exports.Notification=function(t){var o=t.id,a=t.icon,c=t.title,s=t.subtitle,r=t.children,u=t.customCloseButton,b=t.onClick,d=t.onClose,m=t.closeAltText,f=void 0===m?"Close":m,_=t.className,C=i.objectWithoutPropertiesLoose(t,["id","icon","title","subtitle","children","customCloseButton","onClick","onClose","closeAltText","className"]),N=c?o+"-title":null,g=N?{id:N}:null,j=s?o+"-subtitle":null,p=j?{id:j}:null,v=r?o+"-content":null,E=v?{"aria-labelledby":v}:N?{"aria-labelledby":N}:null,h=j&&!r?{"aria-describedby":j}:null,y=e.createElement("div",Object.assign({className:"reactist-notification__content"},r?{id:o+"-content"}:null),null!=r?r:e.createElement(e.Fragment,null,c?e.createElement("h3",Object.assign({className:"reactist-notification__title"},g),c):null,s?e.createElement("p",Object.assign({className:"reactist-notification__subtitle"},p),s):null)),B=e.createElement("div",{className:"reactist-notification__icon-content-group"},null!=a?a:null,y);return e.createElement("div",Object.assign({id:o,role:"dialog",className:l("reactist-notification",_,{"reactist-notification--with-button":Boolean(b),"reactist-notification--with-close-button":Boolean(d)})},E,h,C),b?e.createElement("button",{className:"reactist-notification__button",onClick:b},B):B,d?e.createElement("button",{className:"reactist-notification__close-button",onClick:d,"aria-label":f},null!=u?u:e.createElement(n.default,null)):null)};
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../_virtual/_rollupPluginBabelHelpers.js"),l=e(require("react")),i=e(require("classnames")),n=require("../icons/CloseIcon.svg.js"),a=["id","icon","title","subtitle","children","customCloseButton","onClick","onClose","closeAltText","className","aria-live"];exports.Notification=function(e){var o=e.id,c=e.icon,s=e.title,r=e.subtitle,u=e.children,b=e.customCloseButton,d=e.onClick,m=e.onClose,f=e.closeAltText,_=void 0===f?"Close":f,v=e.className,p=e["aria-live"],C=void 0===p?"polite":p,N=t.objectWithoutPropertiesLoose(e,a),j=s?o+"-title":null,E=j?{id:j}:null,g=r?o+"-subtitle":null,h=g?{id:g}:null,y=u?o+"-content":null,B=y?{"aria-labelledby":y}:j?{"aria-labelledby":j}:null,O=g&&!u?{"aria-describedby":g}:null,k=l.createElement("div",Object.assign({className:"reactist-notification__content"},u?{id:o+"-content"}:null),null!=u?u:l.createElement(l.Fragment,null,s?l.createElement("h3",Object.assign({className:"reactist-notification__title"},E),s):null,r?l.createElement("p",Object.assign({className:"reactist-notification__subtitle"},h),r):null)),q=l.createElement("div",{className:"reactist-notification__icon-content-group"},null!=c?c:null,k);return l.createElement("div",Object.assign({id:o,role:"alert",className:i("reactist-notification",v,{"reactist-notification--with-button":Boolean(d),"reactist-notification--with-close-button":Boolean(m)}),"aria-live":C},B,O,N),d?l.createElement("button",{className:"reactist-notification__button",onClick:d},q):q,m?l.createElement("button",{className:"reactist-notification__close-button",onClick:m,"aria-label":_},null!=b?b:l.createElement(n.default,null)):null)};
2
2
  //# sourceMappingURL=notification.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification.js","sources":["../../../src/components/notification/notification.tsx"],"sourcesContent":["import React from 'react'\nimport classNames from 'classnames'\nimport CloseIcon from '../icons/CloseIcon.svg'\nimport './notification.less'\n\ntype NotificationProps = {\n id: string\n icon?: React.ReactNode\n title?: React.ReactNode\n subtitle?: React.ReactNode\n children?: React.ReactNode\n customCloseButton?: React.ReactNode\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void\n onClose?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void\n closeAltText?: string\n className?: string\n} & JSX.IntrinsicElements['div']\n\nfunction Notification({\n id,\n icon,\n title,\n subtitle,\n children,\n customCloseButton,\n onClick,\n onClose,\n closeAltText = 'Close',\n className,\n ...rest\n}: NotificationProps) {\n const titleId = title ? `${id}-title` : null\n const titleIdAttribute = titleId ? { id: titleId } : null\n const subtitleId = subtitle ? `${id}-subtitle` : null\n const subtitleIdAttribute = subtitleId ? { id: subtitleId } : null\n const contentId = children ? `${id}-content` : null\n const contentIdAttribute = children ? { id: `${id}-content` } : null\n const ariaLabelledBy = contentId\n ? { 'aria-labelledby': contentId }\n : titleId\n ? { 'aria-labelledby': titleId }\n : null\n const ariaDescribedBy = subtitleId && !children ? { 'aria-describedby': subtitleId } : null\n\n const notificationContent = (\n <div className=\"reactist-notification__content\" {...contentIdAttribute}>\n {children ?? (\n <>\n {title ? (\n <h3 className=\"reactist-notification__title\" {...titleIdAttribute}>\n {title}\n </h3>\n ) : null}\n {subtitle ? (\n <p className=\"reactist-notification__subtitle\" {...subtitleIdAttribute}>\n {subtitle}\n </p>\n ) : null}\n </>\n )}\n </div>\n )\n const notificationBody = (\n <div className=\"reactist-notification__icon-content-group\">\n {icon ?? null}\n {notificationContent}\n </div>\n )\n\n return (\n <div\n id={id}\n role=\"dialog\"\n className={classNames('reactist-notification', className, {\n 'reactist-notification--with-button': Boolean(onClick),\n 'reactist-notification--with-close-button': Boolean(onClose),\n })}\n {...ariaLabelledBy}\n {...ariaDescribedBy}\n {...rest}\n >\n {onClick ? (\n <button className=\"reactist-notification__button\" onClick={onClick}>\n {notificationBody}\n </button>\n ) : (\n notificationBody\n )}\n\n {onClose ? (\n <button\n className=\"reactist-notification__close-button\"\n onClick={onClose}\n aria-label={closeAltText}\n >\n {customCloseButton ?? <CloseIcon />}\n </button>\n ) : null}\n </div>\n )\n}\n\nexport { Notification }\n"],"names":["id","icon","title","subtitle","children","customCloseButton","onClick","onClose","closeAltText","className","rest","titleId","titleIdAttribute","subtitleId","subtitleIdAttribute","contentId","ariaLabelledBy","ariaDescribedBy","notificationContent","React","notificationBody","role","classNames","Boolean","CloseIcon"],"mappings":"oTAkBA,gBACIA,IAAAA,GACAC,IAAAA,KACAC,IAAAA,MACAC,IAAAA,SACAC,IAAAA,SACAC,IAAAA,kBACAC,IAAAA,QACAC,IAAAA,YACAC,aAAAA,aAAe,UACfC,IAAAA,UACGC,mJAEGC,EAAUT,EAAWF,WAAa,KAClCY,EAAmBD,EAAU,CAAEX,GAAIW,GAAY,KAC/CE,EAAaV,EAAcH,cAAgB,KAC3Cc,EAAsBD,EAAa,CAAEb,GAAIa,GAAe,KACxDE,EAAYX,EAAcJ,aAAe,KAEzCgB,EAAiBD,EACjB,mBAAqBA,GACrBJ,EACA,mBAAqBA,GACrB,KACAM,EAAkBJ,IAAeT,EAAW,oBAAsBS,GAAe,KAEjFK,EACFC,qCAAKV,UAAU,kCATQL,EAAW,CAAEJ,GAAOA,cAAiB,MAUvDI,MAAAA,EAAAA,EACGe,gCACKjB,EACGiB,oCAAIV,UAAU,gCAAmCG,GAC5CV,GAEL,KACHC,EACGgB,mCAAGV,UAAU,mCAAsCK,GAC9CX,GAEL,OAKdiB,EACFD,uBAAKV,UAAU,6CACVR,MAAAA,EAAAA,EAAQ,KACRiB,UAKLC,qCACInB,GAAIA,EACJqB,KAAK,SACLZ,UAAWa,EAAW,wBAAyBb,EAAW,sCAChBc,QAAQjB,8CACFiB,QAAQhB,MAEpDS,EACAC,EACAP,GAEHJ,EACGa,0BAAQV,UAAU,gCAAgCH,QAASA,GACtDc,GAGLA,EAGHb,EACGY,0BACIV,UAAU,sCACVH,QAASC,eACGC,GAEXH,MAAAA,EAAAA,EAAqBc,gBAACK,iBAE3B"}
1
+ {"version":3,"file":"notification.js","sources":["../../../src/components/notification/notification.tsx"],"sourcesContent":["import React from 'react'\nimport classNames from 'classnames'\nimport CloseIcon from '../icons/CloseIcon.svg'\nimport './notification.less'\n\ntype NotificationProps = {\n id: string\n icon?: React.ReactNode\n title?: React.ReactNode\n subtitle?: React.ReactNode\n children?: React.ReactNode\n customCloseButton?: React.ReactNode\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void\n onClose?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void\n closeAltText?: string\n className?: string\n /** Indicates that the notification will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */\n 'aria-live'?: 'off' | 'polite' | 'assertive'\n} & Omit<JSX.IntrinsicElements['div'], 'aria-live'>\n\nfunction Notification({\n id,\n icon,\n title,\n subtitle,\n children,\n customCloseButton,\n onClick,\n onClose,\n closeAltText = 'Close',\n className,\n 'aria-live': ariaLive = 'polite',\n ...rest\n}: NotificationProps) {\n const titleId = title ? `${id}-title` : null\n const titleIdAttribute = titleId ? { id: titleId } : null\n const subtitleId = subtitle ? `${id}-subtitle` : null\n const subtitleIdAttribute = subtitleId ? { id: subtitleId } : null\n const contentId = children ? `${id}-content` : null\n const contentIdAttribute = children ? { id: `${id}-content` } : null\n const ariaLabelledBy = contentId\n ? { 'aria-labelledby': contentId }\n : titleId\n ? { 'aria-labelledby': titleId }\n : null\n const ariaDescribedBy = subtitleId && !children ? { 'aria-describedby': subtitleId } : null\n\n const notificationContent = (\n <div className=\"reactist-notification__content\" {...contentIdAttribute}>\n {children ?? (\n <>\n {title ? (\n <h3 className=\"reactist-notification__title\" {...titleIdAttribute}>\n {title}\n </h3>\n ) : null}\n {subtitle ? (\n <p className=\"reactist-notification__subtitle\" {...subtitleIdAttribute}>\n {subtitle}\n </p>\n ) : null}\n </>\n )}\n </div>\n )\n const notificationBody = (\n <div className=\"reactist-notification__icon-content-group\">\n {icon ?? null}\n {notificationContent}\n </div>\n )\n\n return (\n <div\n id={id}\n role=\"alert\"\n className={classNames('reactist-notification', className, {\n 'reactist-notification--with-button': Boolean(onClick),\n 'reactist-notification--with-close-button': Boolean(onClose),\n })}\n aria-live={ariaLive}\n {...ariaLabelledBy}\n {...ariaDescribedBy}\n {...rest}\n >\n {onClick ? (\n <button className=\"reactist-notification__button\" onClick={onClick}>\n {notificationBody}\n </button>\n ) : (\n notificationBody\n )}\n\n {onClose ? (\n <button\n className=\"reactist-notification__close-button\"\n onClick={onClose}\n aria-label={closeAltText}\n >\n {customCloseButton ?? <CloseIcon />}\n </button>\n ) : null}\n </div>\n )\n}\n\nexport { Notification }\n"],"names":["id","icon","title","subtitle","children","customCloseButton","onClick","onClose","closeAltText","className","ariaLive","rest","titleId","titleIdAttribute","subtitleId","subtitleIdAttribute","contentId","ariaLabelledBy","ariaDescribedBy","notificationContent","React","notificationBody","role","classNames","Boolean","CloseIcon"],"mappings":"ibAoBA,gBACIA,IAAAA,GACAC,IAAAA,KACAC,IAAAA,MACAC,IAAAA,SACAC,IAAAA,SACAC,IAAAA,kBACAC,IAAAA,QACAC,IAAAA,YACAC,aAAAA,aAAe,UACfC,IAAAA,cACA,aAAaC,aAAW,WACrBC,sCAEGC,EAAUV,EAAWF,WAAa,KAClCa,EAAmBD,EAAU,CAAEZ,GAAIY,GAAY,KAC/CE,EAAaX,EAAcH,cAAgB,KAC3Ce,EAAsBD,EAAa,CAAEd,GAAIc,GAAe,KACxDE,EAAYZ,EAAcJ,aAAe,KAEzCiB,EAAiBD,EACjB,mBAAqBA,GACrBJ,EACA,mBAAqBA,GACrB,KACAM,EAAkBJ,IAAeV,EAAW,oBAAsBU,GAAe,KAEjFK,EACFC,qCAAKX,UAAU,kCATQL,EAAW,CAAEJ,GAAOA,cAAiB,MAUvDI,MAAAA,EAAAA,EACGgB,gCACKlB,EACGkB,oCAAIX,UAAU,gCAAmCI,GAC5CX,GAEL,KACHC,EACGiB,mCAAGX,UAAU,mCAAsCM,GAC9CZ,GAEL,OAKdkB,EACFD,uBAAKX,UAAU,6CACVR,MAAAA,EAAAA,EAAQ,KACRkB,UAKLC,qCACIpB,GAAIA,EACJsB,KAAK,QACLb,UAAWc,EAAW,wBAAyBd,EAAW,sCAChBe,QAAQlB,8CACFkB,QAAQjB,iBAE7CG,GACPO,EACAC,EACAP,GAEHL,EACGc,0BAAQX,UAAU,gCAAgCH,QAASA,GACtDe,GAGLA,EAGHd,EACGa,0BACIX,UAAU,sCACVH,QAASC,eACGC,GAEXH,MAAAA,EAAAA,EAAqBe,gBAACK,iBAE3B"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("react")),o=e(require("classnames")),p=require("../../_virtual/_rollupPluginBabelHelpers.js"),i=require("./positioning-utils.js"),r=function(e){function r(){var t;return(t=e.apply(this,arguments)||this)._updatePopoverPosition=function(){for(var e=t.props,o=e.position,p=e.allowVaguePositioning,r=e.gapSize,n=t.wrapper.getBoundingClientRect(),s=t.popover.getBoundingClientRect(),a=document.documentElement,l=t.wrapper,u=!1;!u;)"absolute"!==getComputedStyle(l).getPropertyValue("position")&&l!==a&&l.parentElement?l=l.parentElement:u=!0;for(var h=l.getBoundingClientRect(),c={height:h.height,width:h.width},f={height:s.height,width:s.width},g={height:n.height,width:n.width},v={x:n.left-h.left,y:n.top-h.top},d={x:n.left,y:n.top},m="auto"===o?["top","right","bottom","left","top"]:"vertical"===o?["top","bottom"]:"horizontal"===o?["left","right"]:[o],w=0;w<m.length;w++){var _=m[w];if(i.hasEnoughSpace(c,f,g,v,_,r)||w===m.length-1){var P=i.calculatePosition(_,g,d,f,r);t.popover.style.top=P.y+"px",t.popover.style.left=P.x+"px",p&&(P.x<0&&(t.popover.style.left=2*r+"px"),P.y+f.height>c.height&&(t.popover.style.top=c.height-f.height-2*r+"px")),_!==o&&(t.popover.className=t._getClassNameForPosition(_));break}}},t._getClassNameForPosition=function(e){var p=t.props,i=p.visible,r=p.withArrow,n=p.arrowClassName,s=o("reactist_popover",{visible:i});return i&&r?o(s,n,{arrow_top:"bottom"===e,arrow_right:"left"===e,arrow_bottom:"auto"===e||"top"===e,arrow_left:"right"===e}):s},t._updatePopoverRef=function(e){t.popover=e,"function"==typeof t.props.popoverRef&&t.props.popoverRef(e)},t._updateWrapperRef=function(e){t.wrapper=e,"function"==typeof t.props.wrapperRef&&t.props.wrapperRef(e)},t}p.inheritsLoose(r,e);var n=r.prototype;return n.componentDidMount=function(){this.props.visible&&this._updatePopoverPosition()},n.componentDidUpdate=function(e){this.wrapper&&this.props.visible&&(e.position!==this.props.position||e.allowVaguePositioning!==this.props.allowVaguePositioning||e.visible!==this.props.visible||e.withArrow!==this.props.withArrow||e.gapSize!==this.props.gapSize||e.content!==this.props.content)&&this._updatePopoverPosition()},n.render=function(){var e=this.props,p=e.position,i=e.wrapperClassName,r=e.popoverClassName,n=e.onMouseEnter,s=e.onMouseLeave,a=e.onClick,l=e.trigger,u=e.content,h=p?this._getClassNameForPosition(p):"",c=o("reactist_popover__content",r),f=o("reactist_popover__wrapper",i),g=t.Children.only(l);return t.createElement("span",{className:f,onMouseEnter:n,onMouseLeave:s,ref:this._updateWrapperRef},t.cloneElement(g,{onClick:function(e){a&&a(e),"function"==typeof g.props.onClick&&g.props.onClick(e)}}),t.createElement("span",{className:h,ref:this._updatePopoverRef},this.props.visible?t.createElement("span",{className:c},"function"==typeof u?u():u):null))},r}(t.Component);r.displayName="Popover",r.defaultProps={position:"auto",gapSize:5},exports.Popover=r;
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../_virtual/_rollupPluginBabelHelpers.js"),o=e(require("react")),p=e(require("classnames")),i=require("./positioning-utils.js"),r=function(e){function r(){var t;return(t=e.apply(this,arguments)||this)._updatePopoverPosition=function(){for(var e=t.props,o=e.position,p=e.allowVaguePositioning,r=e.gapSize,n=t.wrapper.getBoundingClientRect(),s=t.popover.getBoundingClientRect(),a=document.documentElement,l=t.wrapper,u=!1;!u;)"absolute"!==getComputedStyle(l).getPropertyValue("position")&&l!==a&&l.parentElement?l=l.parentElement:u=!0;for(var h=l.getBoundingClientRect(),c={height:h.height,width:h.width},f={height:s.height,width:s.width},g={height:n.height,width:n.width},v={x:n.left-h.left,y:n.top-h.top},d={x:n.left,y:n.top},m="auto"===o?["top","right","bottom","left","top"]:"vertical"===o?["top","bottom"]:"horizontal"===o?["left","right"]:[o],w=0;w<m.length;w++){var _=m[w];if(i.hasEnoughSpace(c,f,g,v,_,r)||w===m.length-1){var P=i.calculatePosition(_,g,d,f,r);t.popover.style.top=P.y+"px",t.popover.style.left=P.x+"px",p&&(P.x<0&&(t.popover.style.left=2*r+"px"),P.y+f.height>c.height&&(t.popover.style.top=c.height-f.height-2*r+"px")),_!==o&&(t.popover.className=t._getClassNameForPosition(_));break}}},t._getClassNameForPosition=function(e){var o=t.props,i=o.visible,r=o.withArrow,n=o.arrowClassName,s=p("reactist_popover",{visible:i});return i&&r?p(s,n,{arrow_top:"bottom"===e,arrow_right:"left"===e,arrow_bottom:"auto"===e||"top"===e,arrow_left:"right"===e}):s},t._updatePopoverRef=function(e){t.popover=e,"function"==typeof t.props.popoverRef&&t.props.popoverRef(e)},t._updateWrapperRef=function(e){t.wrapper=e,"function"==typeof t.props.wrapperRef&&t.props.wrapperRef(e)},t}t.inheritsLoose(r,e);var n=r.prototype;return n.componentDidMount=function(){this.props.visible&&this._updatePopoverPosition()},n.componentDidUpdate=function(e){this.wrapper&&this.props.visible&&(e.position!==this.props.position||e.allowVaguePositioning!==this.props.allowVaguePositioning||e.visible!==this.props.visible||e.withArrow!==this.props.withArrow||e.gapSize!==this.props.gapSize||e.content!==this.props.content)&&this._updatePopoverPosition()},n.render=function(){var e=this.props,t=e.position,i=e.wrapperClassName,r=e.popoverClassName,n=e.onMouseEnter,s=e.onMouseLeave,a=e.onClick,l=e.trigger,u=e.content,h=t?this._getClassNameForPosition(t):"",c=p("reactist_popover__content",r),f=p("reactist_popover__wrapper",i),g=o.Children.only(l);return o.createElement("span",{className:f,onMouseEnter:n,onMouseLeave:s,ref:this._updateWrapperRef},o.cloneElement(g,{onClick:function(e){a&&a(e),"function"==typeof g.props.onClick&&g.props.onClick(e)}}),o.createElement("span",{className:h,ref:this._updatePopoverRef},this.props.visible?o.createElement("span",{className:c},"function"==typeof u?u():u):null))},r}(o.Component);r.displayName="Popover",r.defaultProps={position:"auto",gapSize:5},exports.Popover=r;
2
2
  //# sourceMappingURL=popover.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -5,8 +5,10 @@ declare type Props = {
5
5
  className?: string;
6
6
  /** How much of the progress bar should be filled. Number between 0 and 100 inclusive. */
7
7
  fillPercentage?: number;
8
+ /** Defines the human readable text alternative for assitive technologies. */
9
+ 'aria-valuetext'?: string;
8
10
  };
9
- declare function ProgressBar({ fillPercentage, className }: Props): JSX.Element;
11
+ declare function ProgressBar({ fillPercentage, className, 'aria-valuetext': ariaValuetext }: Props): JSX.Element;
10
12
  declare namespace ProgressBar {
11
13
  var displayName: string;
12
14
  }