@doist/reactist 10.0.0 → 11.2.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 (593) hide show
  1. package/dist/reactist.cjs.development.js +3031 -1700
  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/{avatar → 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 +53 -30
  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 +48 -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/{components → new-components}/avatar/avatar.js +14 -8
  48. package/es/new-components/avatar/avatar.js.map +1 -0
  49. package/es/new-components/avatar/avatar.module.css.js +4 -0
  50. package/es/new-components/avatar/avatar.module.css.js.map +1 -0
  51. package/es/{components → new-components}/avatar/utils.js +0 -0
  52. package/es/new-components/avatar/utils.js.map +1 -0
  53. package/es/new-components/base-button/base-button.js +74 -0
  54. package/es/new-components/base-button/base-button.js.map +1 -0
  55. package/es/new-components/base-button/base-button.module.css.js +4 -0
  56. package/es/new-components/base-button/base-button.module.css.js.map +1 -0
  57. package/es/new-components/base-field/base-field.js +65 -0
  58. package/es/new-components/base-field/base-field.js.map +1 -0
  59. package/es/new-components/base-field/base-field.module.css.js +4 -0
  60. package/es/new-components/base-field/base-field.module.css.js.map +1 -0
  61. package/es/new-components/box/box.js +74 -0
  62. package/es/new-components/box/box.js.map +1 -0
  63. package/es/new-components/box/box.module.css.js +4 -0
  64. package/es/new-components/box/box.module.css.js.map +1 -0
  65. package/es/new-components/box/margin.module.css.js +4 -0
  66. package/es/new-components/box/margin.module.css.js.map +1 -0
  67. package/es/new-components/box/padding.module.css.js +4 -0
  68. package/es/new-components/box/padding.module.css.js.map +1 -0
  69. package/es/new-components/box/width.module.css.js +4 -0
  70. package/es/new-components/box/width.module.css.js.map +1 -0
  71. package/es/new-components/button/button.js +41 -0
  72. package/es/new-components/button/button.js.map +1 -0
  73. package/es/new-components/button-link/button-link.js +42 -0
  74. package/es/new-components/button-link/button-link.js.map +1 -0
  75. package/es/new-components/checkbox-field/checkbox-field.js +88 -0
  76. package/es/new-components/checkbox-field/checkbox-field.js.map +1 -0
  77. package/es/new-components/checkbox-field/checkbox-field.module.css.js +4 -0
  78. package/es/new-components/checkbox-field/checkbox-field.module.css.js.map +1 -0
  79. package/es/new-components/checkbox-field/checkbox-icon.js +61 -0
  80. package/es/new-components/checkbox-field/checkbox-icon.js.map +1 -0
  81. package/es/new-components/columns/columns.js +59 -0
  82. package/es/new-components/columns/columns.js.map +1 -0
  83. package/es/new-components/columns/columns.module.css.js +4 -0
  84. package/es/new-components/columns/columns.module.css.js.map +1 -0
  85. package/es/new-components/common-helpers.js +24 -0
  86. package/es/new-components/common-helpers.js.map +1 -0
  87. package/es/new-components/divider/divider.js +21 -0
  88. package/es/new-components/divider/divider.js.map +1 -0
  89. package/es/new-components/divider/divider.module.css.js +4 -0
  90. package/es/new-components/divider/divider.module.css.js.map +1 -0
  91. package/es/new-components/heading/heading.js +37 -0
  92. package/es/new-components/heading/heading.js.map +1 -0
  93. package/es/new-components/heading/heading.module.css.js +4 -0
  94. package/es/new-components/heading/heading.module.css.js.map +1 -0
  95. package/es/new-components/hidden/hidden.js +55 -0
  96. package/es/new-components/hidden/hidden.js.map +1 -0
  97. package/es/new-components/hidden/hidden.module.css.js +4 -0
  98. package/es/new-components/hidden/hidden.module.css.js.map +1 -0
  99. package/es/new-components/hidden-visually/hidden-visually.js +22 -0
  100. package/es/new-components/hidden-visually/hidden-visually.js.map +1 -0
  101. package/es/new-components/hidden-visually/hidden-visually.module.css.js +4 -0
  102. package/es/new-components/hidden-visually/hidden-visually.module.css.js.map +1 -0
  103. package/es/new-components/icons/alert-icon.js +77 -0
  104. package/es/new-components/icons/alert-icon.js.map +1 -0
  105. package/es/new-components/icons/close-icon.js +15 -0
  106. package/es/new-components/icons/close-icon.js.map +1 -0
  107. package/es/new-components/icons/password-hidden-icon.js +29 -0
  108. package/es/new-components/icons/password-hidden-icon.js.map +1 -0
  109. package/es/new-components/icons/password-visible-icon.js +22 -0
  110. package/es/new-components/icons/password-visible-icon.js.map +1 -0
  111. package/es/new-components/inline/inline.js +36 -0
  112. package/es/new-components/inline/inline.js.map +1 -0
  113. package/es/new-components/inline/inline.module.css.js +4 -0
  114. package/es/new-components/inline/inline.module.css.js.map +1 -0
  115. package/es/new-components/loading/loading.js +37 -0
  116. package/es/new-components/loading/loading.js.map +1 -0
  117. package/es/new-components/modal/modal.js +220 -0
  118. package/es/new-components/modal/modal.js.map +1 -0
  119. package/es/new-components/modal/modal.module.css.js +4 -0
  120. package/es/new-components/modal/modal.module.css.js.map +1 -0
  121. package/es/new-components/notice/notice.js +30 -0
  122. package/es/new-components/notice/notice.js.map +1 -0
  123. package/es/new-components/notice/notice.module.css.js +4 -0
  124. package/es/new-components/notice/notice.module.css.js.map +1 -0
  125. package/es/new-components/password-field/password-field.js +76 -0
  126. package/es/new-components/password-field/password-field.js.map +1 -0
  127. package/es/new-components/password-field/password-field.module.css.js +4 -0
  128. package/es/new-components/password-field/password-field.module.css.js.map +1 -0
  129. package/es/new-components/responsive-props.js +75 -0
  130. package/es/new-components/responsive-props.js.map +1 -0
  131. package/es/new-components/select-field/select-field.js +53 -0
  132. package/es/new-components/select-field/select-field.js.map +1 -0
  133. package/es/new-components/select-field/select-field.module.css.js +4 -0
  134. package/es/new-components/select-field/select-field.module.css.js.map +1 -0
  135. package/es/new-components/spinner/spinner.js +26 -0
  136. package/es/new-components/spinner/spinner.js.map +1 -0
  137. package/es/new-components/spinner/spinner.module.css.js +4 -0
  138. package/es/new-components/spinner/spinner.module.css.js.map +1 -0
  139. package/es/new-components/stack/stack.js +42 -0
  140. package/es/new-components/stack/stack.js.map +1 -0
  141. package/es/new-components/stack/stack.module.css.js +4 -0
  142. package/es/new-components/stack/stack.module.css.js.map +1 -0
  143. package/es/new-components/switch-field/switch-field.js +96 -0
  144. package/es/new-components/switch-field/switch-field.js.map +1 -0
  145. package/es/new-components/switch-field/switch-field.module.css.js +4 -0
  146. package/es/new-components/switch-field/switch-field.module.css.js.map +1 -0
  147. package/es/new-components/tabs/tabs.js +147 -0
  148. package/es/new-components/tabs/tabs.js.map +1 -0
  149. package/es/new-components/tabs/tabs.module.css.js +4 -0
  150. package/es/new-components/tabs/tabs.module.css.js.map +1 -0
  151. package/es/new-components/text/text.js +36 -0
  152. package/es/new-components/text/text.js.map +1 -0
  153. package/es/new-components/text/text.module.css.js +4 -0
  154. package/es/new-components/text/text.module.css.js.map +1 -0
  155. package/es/new-components/text-area/text-area.js +34 -0
  156. package/es/new-components/text-area/text-area.js.map +1 -0
  157. package/es/new-components/text-area/text-area.module.css.js +4 -0
  158. package/es/new-components/text-area/text-area.module.css.js.map +1 -0
  159. package/es/new-components/text-field/text-field.js +41 -0
  160. package/es/new-components/text-field/text-field.js.map +1 -0
  161. package/es/new-components/text-field/text-field.module.css.js +4 -0
  162. package/es/new-components/text-field/text-field.module.css.js.map +1 -0
  163. package/es/new-components/text-link/text-link.js +27 -0
  164. package/es/new-components/text-link/text-link.js.map +1 -0
  165. package/es/new-components/text-link/text-link.module.css.js +4 -0
  166. package/es/new-components/text-link/text-link.module.css.js.map +1 -0
  167. package/es/utils/polymorphism.js +17 -0
  168. package/es/utils/polymorphism.js.map +1 -0
  169. package/lib/_virtual/_rollupPluginBabelHelpers.js +1 -1
  170. package/lib/components/{avatar/utils.test.d.ts → checkbox/checkbox.test.d.ts} +0 -0
  171. package/lib/components/color-picker/color-picker.test.d.ts +1 -0
  172. package/lib/components/{button/button.d.ts → deprecated-button/deprecated-button.d.ts} +7 -1
  173. package/lib/components/deprecated-button/deprecated-button.js +2 -0
  174. package/lib/components/deprecated-button/deprecated-button.js.map +1 -0
  175. package/lib/components/deprecated-button/deprecated-button.test.d.ts +1 -0
  176. package/lib/components/deprecated-button/index.d.ts +4 -0
  177. package/lib/components/{avatar → deprecated-button}/index.js +1 -1
  178. package/lib/components/{avatar → deprecated-button}/index.js.map +0 -0
  179. package/lib/components/{loading/loading.d.ts → deprecated-loading/deprecated-loading.d.ts} +2 -1
  180. package/lib/components/{loading/loading.js → deprecated-loading/deprecated-loading.js} +1 -1
  181. package/lib/components/deprecated-loading/deprecated-loading.js.map +1 -0
  182. package/lib/components/deprecated-loading/deprecated-loading.test.d.ts +1 -0
  183. package/lib/components/deprecated-loading/index.d.ts +1 -0
  184. package/lib/components/{modal/modal.d.ts → deprecated-modal/deprecated-modal.d.ts} +7 -2
  185. package/lib/components/deprecated-modal/deprecated-modal.js +2 -0
  186. package/lib/components/deprecated-modal/deprecated-modal.js.map +1 -0
  187. package/lib/components/deprecated-modal/deprecated-modal.test.d.ts +1 -0
  188. package/lib/components/{modal → deprecated-modal}/index.d.ts +2 -2
  189. package/lib/components/deprecated-modal/index.js +2 -0
  190. package/lib/components/deprecated-modal/index.js.map +1 -0
  191. package/lib/components/dropdown/dropdown.js +1 -1
  192. package/lib/components/dropdown/dropdown.js.map +1 -1
  193. package/lib/components/dropdown/dropdown.test.d.ts +1 -0
  194. package/lib/components/input/input.test.d.ts +1 -0
  195. package/lib/components/key-capturer/key-capturer.js +1 -1
  196. package/lib/components/key-capturer/key-capturer.test.d.ts +1 -0
  197. package/lib/components/keyboard-shortcut/keyboard-shortcut.js +1 -1
  198. package/lib/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
  199. package/lib/components/keyboard-shortcut/keyboard-shortcut.test.d.ts +1 -0
  200. package/lib/components/menu/menu.d.ts +8 -10
  201. package/lib/components/menu/menu.js +1 -1
  202. package/lib/components/menu/menu.js.map +1 -1
  203. package/lib/components/menu/menu.test.d.ts +1 -0
  204. package/lib/components/notification/notification.d.ts +4 -2
  205. package/lib/components/notification/notification.js +1 -1
  206. package/lib/components/notification/notification.js.map +1 -1
  207. package/lib/components/notification/notification.test.d.ts +1 -0
  208. package/lib/components/popover/popover.js +1 -1
  209. package/lib/components/popover/popover.test.d.ts +1 -0
  210. package/lib/components/progress-bar/progress-bar.d.ts +3 -1
  211. package/lib/components/progress-bar/progress-bar.js +1 -1
  212. package/lib/components/progress-bar/progress-bar.js.map +1 -1
  213. package/lib/components/progress-bar/progress-bar.test.d.ts +1 -0
  214. package/lib/components/select/select.js +1 -1
  215. package/lib/components/select/select.js.map +1 -1
  216. package/lib/components/select/select.test.d.ts +1 -0
  217. package/lib/components/time/time.js +1 -1
  218. package/lib/components/time/time.test.d.ts +1 -0
  219. package/lib/components/tooltip/tooltip.js +1 -1
  220. package/lib/components/tooltip/tooltip.js.map +1 -1
  221. package/lib/components/tooltip/tooltip.test.d.ts +1 -0
  222. package/lib/hooks/use-previous/index.d.ts +1 -0
  223. package/lib/hooks/use-previous/use-previous.d.ts +15 -0
  224. package/lib/hooks/use-previous/use-previous.js +2 -0
  225. package/lib/hooks/use-previous/use-previous.js.map +1 -0
  226. package/lib/index.d.ts +33 -13
  227. package/lib/index.js +1 -1
  228. package/lib/new-components/alert/alert.d.ts +17 -0
  229. package/lib/new-components/alert/alert.js +2 -0
  230. package/lib/new-components/alert/alert.js.map +1 -0
  231. package/lib/new-components/alert/alert.module.css.js +2 -0
  232. package/lib/new-components/alert/alert.module.css.js.map +1 -0
  233. package/lib/new-components/alert/alert.test.d.ts +1 -0
  234. package/lib/new-components/alert/index.d.ts +1 -0
  235. package/lib/{components → new-components}/avatar/avatar.d.ts +6 -3
  236. package/lib/new-components/avatar/avatar.js +2 -0
  237. package/lib/new-components/avatar/avatar.js.map +1 -0
  238. package/lib/new-components/avatar/avatar.module.css.js +2 -0
  239. package/lib/new-components/avatar/avatar.module.css.js.map +1 -0
  240. package/lib/new-components/avatar/avatar.test.d.ts +1 -0
  241. package/lib/new-components/avatar/index.d.ts +1 -0
  242. package/lib/{components → new-components}/avatar/utils.d.ts +0 -0
  243. package/lib/{components → new-components}/avatar/utils.js +0 -0
  244. package/lib/new-components/avatar/utils.js.map +1 -0
  245. package/lib/new-components/avatar/utils.test.d.ts +1 -0
  246. package/lib/new-components/base-button/base-button.d.ts +69 -0
  247. package/lib/new-components/base-button/base-button.js +2 -0
  248. package/lib/new-components/base-button/base-button.js.map +1 -0
  249. package/lib/new-components/base-button/base-button.module.css.js +2 -0
  250. package/lib/new-components/base-button/base-button.module.css.js.map +1 -0
  251. package/lib/new-components/base-button/index.d.ts +1 -0
  252. package/lib/new-components/base-field/base-field.d.ts +64 -0
  253. package/lib/new-components/base-field/base-field.js +2 -0
  254. package/lib/new-components/base-field/base-field.js.map +1 -0
  255. package/lib/new-components/base-field/base-field.module.css.js +2 -0
  256. package/lib/new-components/base-field/base-field.module.css.js.map +1 -0
  257. package/lib/new-components/base-field/index.d.ts +1 -0
  258. package/lib/new-components/box/box.d.ts +58 -0
  259. package/lib/new-components/box/box.js +2 -0
  260. package/lib/new-components/box/box.js.map +1 -0
  261. package/lib/new-components/box/box.module.css.js +2 -0
  262. package/lib/new-components/box/box.module.css.js.map +1 -0
  263. package/lib/new-components/box/box.test.d.ts +1 -0
  264. package/lib/new-components/box/index.d.ts +1 -0
  265. package/lib/new-components/box/margin.module.css.js +2 -0
  266. package/lib/new-components/box/margin.module.css.js.map +1 -0
  267. package/lib/new-components/box/padding.module.css.js +2 -0
  268. package/lib/new-components/box/padding.module.css.js.map +1 -0
  269. package/lib/new-components/box/width.module.css.js +2 -0
  270. package/lib/new-components/box/width.module.css.js.map +1 -0
  271. package/lib/new-components/button/button.d.ts +50 -0
  272. package/lib/new-components/button/button.js +2 -0
  273. package/lib/new-components/button/button.js.map +1 -0
  274. package/lib/new-components/button/button.test.d.ts +1 -0
  275. package/lib/new-components/button/index.d.ts +1 -0
  276. package/lib/new-components/button-link/button-link-story-wrapper.d.ts +7 -0
  277. package/lib/new-components/button-link/button-link.d.ts +15 -0
  278. package/lib/new-components/button-link/button-link.js +2 -0
  279. package/lib/new-components/button-link/button-link.js.map +1 -0
  280. package/lib/new-components/button-link/button-link.test.d.ts +1 -0
  281. package/lib/new-components/button-link/index.d.ts +1 -0
  282. package/lib/new-components/checkbox-field/checkbox-field.d.ts +21 -0
  283. package/lib/new-components/checkbox-field/checkbox-field.js +2 -0
  284. package/lib/new-components/checkbox-field/checkbox-field.js.map +1 -0
  285. package/lib/new-components/checkbox-field/checkbox-field.module.css.js +2 -0
  286. package/lib/new-components/checkbox-field/checkbox-field.module.css.js.map +1 -0
  287. package/lib/new-components/checkbox-field/checkbox-field.test.d.ts +1 -0
  288. package/lib/new-components/checkbox-field/checkbox-icon.d.ts +8 -0
  289. package/lib/new-components/checkbox-field/checkbox-icon.js +2 -0
  290. package/lib/new-components/checkbox-field/checkbox-icon.js.map +1 -0
  291. package/lib/new-components/checkbox-field/index.d.ts +1 -0
  292. package/lib/new-components/columns/columns.d.ts +20 -0
  293. package/lib/new-components/columns/columns.js +2 -0
  294. package/lib/new-components/columns/columns.js.map +1 -0
  295. package/lib/new-components/columns/columns.module.css.js +2 -0
  296. package/lib/new-components/columns/columns.module.css.js.map +1 -0
  297. package/lib/new-components/columns/columns.test.d.ts +1 -0
  298. package/lib/new-components/columns/index.d.ts +1 -0
  299. package/lib/new-components/common-helpers.d.ts +2 -0
  300. package/lib/new-components/common-helpers.js +2 -0
  301. package/lib/new-components/common-helpers.js.map +1 -0
  302. package/lib/new-components/common-types.d.ts +23 -0
  303. package/lib/new-components/divider/divider.d.ts +8 -0
  304. package/lib/new-components/divider/divider.js +2 -0
  305. package/lib/new-components/divider/divider.js.map +1 -0
  306. package/lib/new-components/divider/divider.module.css.js +2 -0
  307. package/lib/new-components/divider/divider.module.css.js.map +1 -0
  308. package/lib/new-components/divider/index.d.ts +1 -0
  309. package/lib/new-components/heading/heading.d.ts +115 -0
  310. package/lib/new-components/heading/heading.js +2 -0
  311. package/lib/new-components/heading/heading.js.map +1 -0
  312. package/lib/new-components/heading/heading.module.css.js +2 -0
  313. package/lib/new-components/heading/heading.module.css.js.map +1 -0
  314. package/lib/new-components/heading/heading.test.d.ts +1 -0
  315. package/lib/new-components/heading/index.d.ts +1 -0
  316. package/lib/new-components/hidden/hidden.d.ts +49 -0
  317. package/lib/new-components/hidden/hidden.js +2 -0
  318. package/lib/new-components/hidden/hidden.js.map +1 -0
  319. package/lib/new-components/hidden/hidden.module.css.js +2 -0
  320. package/lib/new-components/hidden/hidden.module.css.js.map +1 -0
  321. package/lib/new-components/hidden/hidden.test.d.ts +1 -0
  322. package/lib/new-components/hidden/index.d.ts +1 -0
  323. package/lib/new-components/hidden-visually/hidden-visually.d.ts +11 -0
  324. package/lib/new-components/hidden-visually/hidden-visually.js +2 -0
  325. package/lib/new-components/hidden-visually/hidden-visually.js.map +1 -0
  326. package/lib/new-components/hidden-visually/hidden-visually.module.css.js +2 -0
  327. package/lib/new-components/hidden-visually/hidden-visually.module.css.js.map +1 -0
  328. package/lib/new-components/hidden-visually/hidden-visually.test.d.ts +1 -0
  329. package/lib/new-components/hidden-visually/index.d.ts +1 -0
  330. package/lib/new-components/icons/alert-icon.d.ts +6 -0
  331. package/lib/new-components/icons/alert-icon.js +2 -0
  332. package/lib/new-components/icons/alert-icon.js.map +1 -0
  333. package/lib/new-components/icons/close-icon.d.ts +3 -0
  334. package/lib/new-components/icons/close-icon.js +2 -0
  335. package/lib/new-components/icons/close-icon.js.map +1 -0
  336. package/lib/new-components/icons/password-hidden-icon.d.ts +3 -0
  337. package/lib/new-components/icons/password-hidden-icon.js +2 -0
  338. package/lib/new-components/icons/password-hidden-icon.js.map +1 -0
  339. package/lib/new-components/icons/password-visible-icon.d.ts +3 -0
  340. package/lib/new-components/icons/password-visible-icon.js +2 -0
  341. package/lib/new-components/icons/password-visible-icon.js.map +1 -0
  342. package/lib/new-components/inline/index.d.ts +1 -0
  343. package/lib/new-components/inline/inline.d.ts +12 -0
  344. package/lib/new-components/inline/inline.js +2 -0
  345. package/lib/new-components/inline/inline.js.map +1 -0
  346. package/lib/new-components/inline/inline.module.css.js +2 -0
  347. package/lib/new-components/inline/inline.module.css.js.map +1 -0
  348. package/lib/new-components/inline/inline.test.d.ts +1 -0
  349. package/lib/new-components/loading/index.d.ts +1 -0
  350. package/lib/new-components/loading/loading.d.ts +27 -0
  351. package/lib/new-components/loading/loading.js +2 -0
  352. package/lib/new-components/loading/loading.js.map +1 -0
  353. package/lib/new-components/loading/loading.test.d.ts +1 -0
  354. package/lib/new-components/modal/index.d.ts +1 -0
  355. package/lib/new-components/modal/modal-stories-components.d.ts +35 -0
  356. package/lib/new-components/modal/modal.d.ts +156 -0
  357. package/lib/new-components/modal/modal.js +2 -0
  358. package/lib/new-components/modal/modal.js.map +1 -0
  359. package/lib/new-components/modal/modal.module.css.js +2 -0
  360. package/lib/new-components/modal/modal.module.css.js.map +1 -0
  361. package/lib/new-components/modal/modal.test.d.ts +1 -0
  362. package/lib/new-components/notice/index.d.ts +1 -0
  363. package/lib/new-components/notice/notice.d.ts +10 -0
  364. package/lib/new-components/notice/notice.js +2 -0
  365. package/lib/new-components/notice/notice.js.map +1 -0
  366. package/lib/new-components/notice/notice.module.css.js +2 -0
  367. package/lib/new-components/notice/notice.module.css.js.map +1 -0
  368. package/lib/new-components/notice/notice.test.d.ts +1 -0
  369. package/lib/new-components/password-field/index.d.ts +1 -0
  370. package/lib/new-components/password-field/password-field.d.ts +8 -0
  371. package/lib/new-components/password-field/password-field.js +2 -0
  372. package/lib/new-components/password-field/password-field.js.map +1 -0
  373. package/lib/new-components/password-field/password-field.module.css.js +2 -0
  374. package/lib/new-components/password-field/password-field.module.css.js.map +1 -0
  375. package/lib/new-components/password-field/password-field.test.d.ts +1 -0
  376. package/lib/new-components/responsive-props.d.ts +44 -0
  377. package/lib/new-components/responsive-props.js +2 -0
  378. package/lib/new-components/responsive-props.js.map +1 -0
  379. package/lib/new-components/select-field/index.d.ts +1 -0
  380. package/lib/new-components/select-field/select-field.d.ts +6 -0
  381. package/lib/new-components/select-field/select-field.js +2 -0
  382. package/lib/new-components/select-field/select-field.js.map +1 -0
  383. package/lib/new-components/select-field/select-field.module.css.js +2 -0
  384. package/lib/new-components/select-field/select-field.module.css.js.map +1 -0
  385. package/lib/new-components/select-field/select-field.test.d.ts +1 -0
  386. package/lib/new-components/spinner/index.d.ts +1 -0
  387. package/lib/new-components/spinner/spinner.d.ts +5 -0
  388. package/lib/new-components/spinner/spinner.js +2 -0
  389. package/lib/new-components/spinner/spinner.js.map +1 -0
  390. package/lib/new-components/spinner/spinner.module.css.js +2 -0
  391. package/lib/new-components/spinner/spinner.module.css.js.map +1 -0
  392. package/lib/new-components/stack/index.d.ts +1 -0
  393. package/lib/new-components/stack/stack.d.ts +15 -0
  394. package/lib/new-components/stack/stack.js +2 -0
  395. package/lib/new-components/stack/stack.js.map +1 -0
  396. package/lib/new-components/stack/stack.module.css.js +2 -0
  397. package/lib/new-components/stack/stack.module.css.js.map +1 -0
  398. package/lib/new-components/stack/stack.test.d.ts +1 -0
  399. package/lib/new-components/switch-field/index.d.ts +1 -0
  400. package/lib/new-components/switch-field/switch-field.d.ts +13 -0
  401. package/lib/new-components/switch-field/switch-field.js +2 -0
  402. package/lib/new-components/switch-field/switch-field.js.map +1 -0
  403. package/lib/new-components/switch-field/switch-field.module.css.js +2 -0
  404. package/lib/new-components/switch-field/switch-field.module.css.js.map +1 -0
  405. package/lib/new-components/switch-field/switch-field.test.d.ts +1 -0
  406. package/lib/new-components/tabs/index.d.ts +1 -0
  407. package/lib/new-components/tabs/tabs.d.ts +92 -0
  408. package/lib/new-components/tabs/tabs.js +2 -0
  409. package/lib/new-components/tabs/tabs.js.map +1 -0
  410. package/lib/new-components/tabs/tabs.module.css.js +2 -0
  411. package/lib/new-components/tabs/tabs.module.css.js.map +1 -0
  412. package/lib/new-components/tabs/tabs.test.d.ts +1 -0
  413. package/lib/new-components/test-helpers.d.ts +9 -0
  414. package/lib/new-components/text/index.d.ts +1 -0
  415. package/lib/new-components/text/text.d.ts +47 -0
  416. package/lib/new-components/text/text.js +2 -0
  417. package/lib/new-components/text/text.js.map +1 -0
  418. package/lib/new-components/text/text.module.css.js +2 -0
  419. package/lib/new-components/text/text.module.css.js.map +1 -0
  420. package/lib/new-components/text/text.test.d.ts +1 -0
  421. package/lib/new-components/text-area/index.d.ts +1 -0
  422. package/lib/new-components/text-area/text-area.d.ts +8 -0
  423. package/lib/new-components/text-area/text-area.js +2 -0
  424. package/lib/new-components/text-area/text-area.js.map +1 -0
  425. package/lib/new-components/text-area/text-area.module.css.js +2 -0
  426. package/lib/new-components/text-area/text-area.module.css.js.map +1 -0
  427. package/lib/new-components/text-field/index.d.ts +1 -0
  428. package/lib/new-components/text-field/text-field.d.ts +9 -0
  429. package/lib/new-components/text-field/text-field.js +2 -0
  430. package/lib/new-components/text-field/text-field.js.map +1 -0
  431. package/lib/new-components/text-field/text-field.module.css.js +2 -0
  432. package/lib/new-components/text-field/text-field.module.css.js.map +1 -0
  433. package/lib/new-components/text-field/text-field.test.d.ts +1 -0
  434. package/lib/new-components/text-link/index.d.ts +1 -0
  435. package/lib/new-components/text-link/text-link.d.ts +5 -0
  436. package/lib/new-components/text-link/text-link.js +2 -0
  437. package/lib/new-components/text-link/text-link.js.map +1 -0
  438. package/lib/new-components/text-link/text-link.module.css.js +2 -0
  439. package/lib/new-components/text-link/text-link.module.css.js.map +1 -0
  440. package/lib/utils/polymorphism.d.ts +151 -0
  441. package/lib/utils/polymorphism.js +2 -0
  442. package/lib/utils/polymorphism.js.map +1 -0
  443. package/package.json +25 -16
  444. package/styles/alert.css +9 -0
  445. package/styles/alert.module.css.css +1 -0
  446. package/styles/avatar.css +5 -1
  447. package/styles/avatar.module.css.css +1 -0
  448. package/styles/base-button.css +7 -0
  449. package/styles/base-button.module.css.css +1 -0
  450. package/styles/base-field.css +8 -0
  451. package/styles/base-field.module.css.css +1 -0
  452. package/styles/box.css +4 -0
  453. package/styles/box.module.css.css +1 -0
  454. package/styles/checkbox-field.css +6 -0
  455. package/styles/checkbox-field.module.css.css +1 -0
  456. package/styles/color-picker.css +2 -2
  457. package/styles/columns.css +5 -0
  458. package/styles/columns.module.css.css +1 -0
  459. package/styles/{button.css → deprecated-button.css} +2 -2
  460. package/styles/deprecated-loading.css +1 -0
  461. package/styles/deprecated-modal.css +1 -0
  462. package/styles/divider.css +5 -0
  463. package/styles/divider.module.css.css +1 -0
  464. package/styles/dropdown.css +3 -3
  465. package/styles/heading.css +5 -0
  466. package/styles/heading.module.css.css +1 -0
  467. package/styles/hidden-visually.css +5 -0
  468. package/styles/hidden-visually.module.css.css +1 -0
  469. package/styles/hidden.css +5 -0
  470. package/styles/hidden.module.css.css +1 -0
  471. package/styles/inline.css +5 -0
  472. package/styles/inline.module.css.css +1 -0
  473. package/styles/loading.css +5 -1
  474. package/styles/margin.module.css.css +1 -0
  475. package/styles/menu.css +1 -1
  476. package/styles/modal.css +11 -1
  477. package/styles/modal.module.css.css +1 -0
  478. package/styles/notice.css +6 -0
  479. package/styles/notice.module.css.css +1 -0
  480. package/styles/padding.module.css.css +1 -0
  481. package/styles/password-field.css +11 -0
  482. package/styles/password-field.module.css.css +1 -0
  483. package/styles/progress-bar.css +5 -0
  484. package/styles/reactist.css +34 -12
  485. package/styles/select-field.css +9 -0
  486. package/styles/select-field.module.css.css +1 -0
  487. package/styles/spinner.module.css.css +1 -0
  488. package/styles/stack.css +6 -0
  489. package/styles/stack.module.css.css +1 -0
  490. package/styles/switch-field.css +10 -0
  491. package/styles/switch-field.module.css.css +1 -0
  492. package/styles/tabs.css +6 -1
  493. package/styles/tabs.module.css.css +1 -0
  494. package/styles/text-area.css +9 -0
  495. package/styles/text-area.module.css.css +1 -0
  496. package/styles/text-field.css +9 -0
  497. package/styles/text-field.module.css.css +1 -0
  498. package/styles/text-link.css +5 -0
  499. package/styles/text-link.module.css.css +1 -0
  500. package/styles/text.css +5 -0
  501. package/styles/text.module.css.css +1 -0
  502. package/styles/time.css +2 -2
  503. package/styles/width.module.css.css +1 -0
  504. package/es/components/avatar/avatar.js.map +0 -1
  505. package/es/components/avatar/index.js +0 -6
  506. package/es/components/avatar/utils.js.map +0 -1
  507. package/es/components/button/button.js.map +0 -1
  508. package/es/components/button/index.js.map +0 -1
  509. package/es/components/error-message/error-message.js +0 -90
  510. package/es/components/error-message/error-message.js.map +0 -1
  511. package/es/components/error-message/index.js +0 -6
  512. package/es/components/error-message/index.js.map +0 -1
  513. package/es/components/icon/icon.js +0 -96
  514. package/es/components/icon/icon.js.map +0 -1
  515. package/es/components/icon/index.js +0 -6
  516. package/es/components/icon/index.js.map +0 -1
  517. package/es/components/icons/ThinQuestionMarkIcon.svg.js +0 -24
  518. package/es/components/icons/ThinQuestionMarkIcon.svg.js.map +0 -1
  519. package/es/components/icons/ThreeDotsIcon.svg.js +0 -40
  520. package/es/components/icons/ThreeDotsIcon.svg.js.map +0 -1
  521. package/es/components/loading/index.js +0 -6
  522. package/es/components/loading/index.js.map +0 -1
  523. package/es/components/loading/loading.js.map +0 -1
  524. package/es/components/menu/type-helpers.js +0 -9
  525. package/es/components/menu/type-helpers.js.map +0 -1
  526. package/es/components/modal/index.js.map +0 -1
  527. package/es/components/modal/modal.js.map +0 -1
  528. package/es/components/range-input/index.js +0 -6
  529. package/es/components/range-input/index.js.map +0 -1
  530. package/es/components/range-input/range-input.js +0 -55
  531. package/es/components/range-input/range-input.js.map +0 -1
  532. package/es/components/tabs/tabs.js +0 -123
  533. package/es/components/tabs/tabs.js.map +0 -1
  534. package/es/components/tip/index.js +0 -6
  535. package/es/components/tip/index.js.map +0 -1
  536. package/es/components/tip/tip.js +0 -30
  537. package/es/components/tip/tip.js.map +0 -1
  538. package/lib/components/avatar/avatar.js +0 -2
  539. package/lib/components/avatar/avatar.js.map +0 -1
  540. package/lib/components/avatar/index.d.ts +0 -2
  541. package/lib/components/avatar/utils.js.map +0 -1
  542. package/lib/components/button/button.js +0 -2
  543. package/lib/components/button/button.js.map +0 -1
  544. package/lib/components/button/index.d.ts +0 -4
  545. package/lib/components/button/index.js +0 -2
  546. package/lib/components/button/index.js.map +0 -1
  547. package/lib/components/error-message/error-message.d.ts +0 -23
  548. package/lib/components/error-message/error-message.js +0 -2
  549. package/lib/components/error-message/error-message.js.map +0 -1
  550. package/lib/components/error-message/index.d.ts +0 -2
  551. package/lib/components/error-message/index.js +0 -2
  552. package/lib/components/error-message/index.js.map +0 -1
  553. package/lib/components/icon/icon.d.ts +0 -31
  554. package/lib/components/icon/icon.js +0 -2
  555. package/lib/components/icon/icon.js.map +0 -1
  556. package/lib/components/icon/index.d.ts +0 -2
  557. package/lib/components/icon/index.js +0 -2
  558. package/lib/components/icon/index.js.map +0 -1
  559. package/lib/components/icons/ThinQuestionMarkIcon.svg.js +0 -2
  560. package/lib/components/icons/ThinQuestionMarkIcon.svg.js.map +0 -1
  561. package/lib/components/icons/ThreeDotsIcon.svg.js +0 -2
  562. package/lib/components/icons/ThreeDotsIcon.svg.js.map +0 -1
  563. package/lib/components/loading/index.d.ts +0 -2
  564. package/lib/components/loading/index.js +0 -2
  565. package/lib/components/loading/index.js.map +0 -1
  566. package/lib/components/loading/loading.js.map +0 -1
  567. package/lib/components/menu/type-helpers.d.ts +0 -25
  568. package/lib/components/menu/type-helpers.js +0 -2
  569. package/lib/components/menu/type-helpers.js.map +0 -1
  570. package/lib/components/modal/index.js +0 -2
  571. package/lib/components/modal/index.js.map +0 -1
  572. package/lib/components/modal/modal.js +0 -2
  573. package/lib/components/modal/modal.js.map +0 -1
  574. package/lib/components/range-input/index.d.ts +0 -2
  575. package/lib/components/range-input/index.js +0 -2
  576. package/lib/components/range-input/index.js.map +0 -1
  577. package/lib/components/range-input/range-input.d.ts +0 -25
  578. package/lib/components/range-input/range-input.js +0 -2
  579. package/lib/components/range-input/range-input.js.map +0 -1
  580. package/lib/components/tabs/index.d.ts +0 -1
  581. package/lib/components/tabs/tabs.d.ts +0 -33
  582. package/lib/components/tabs/tabs.js +0 -2
  583. package/lib/components/tabs/tabs.js.map +0 -1
  584. package/lib/components/tip/index.d.ts +0 -2
  585. package/lib/components/tip/index.js +0 -2
  586. package/lib/components/tip/index.js.map +0 -1
  587. package/lib/components/tip/tip.d.ts +0 -20
  588. package/lib/components/tip/tip.js +0 -2
  589. package/lib/components/tip/tip.js.map +0 -1
  590. package/styles/error-message.css +0 -1
  591. package/styles/icon.css +0 -2
  592. package/styles/range-input.css +0 -1
  593. package/styles/tip.css +0 -4
@@ -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, unstable_offset: [8, 8], ...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","unstable_offset","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,EAAMC,gBAAiB,CAAC,EAAG,IAAOJ,IAEtEK,EAAmBT,eACrB,SAA0BU,GAClBP,GAAcA,EAAaO,KAEnC,CAACP,IAGCO,EAA0BV,WAC5B,qDACOK,OACHI,iBAAAA,MAEJ,CAACJ,EAAOI,WAGLT,gBAACD,EAAYY,UAASD,MAAOA,GAAQR,OAY1CU,EAAaC,wBAAgD,WAE/DC,OADEC,IAAAA,0BAA8BX,wCAGOJ,aAAiBD,GAA3BM,6CAEzBL,gBAACM,8BACOF,EACAC,GACJS,IAAKA,EACLE,UAAWC,EAAW,sBAAuBF,SAanDG,EAAsC,CACxCC,MAAO,OACPC,OAAQ,OACRC,SAAU,QACVC,IAAK,EACLC,KAAM,GAOV,SAASC,YAUDxB,gBAACyB,mBACGC,SAVRA,OAWQC,UAVRA,QAWQC,WAVRA,SAWQC,YAVRA,UAWQC,gBAVRA,cAWQC,QAVRA,MAWQC,MAAOd,KAVfhB,cAsBE+B,EAAWpB,wBAA2C,WAExDC,OADEC,IAAAA,0BAA8BX,wCAGOJ,aAAiBD,GAA3BM,sCACvB6B,EAAkBC,cAAY9B,EAAMsB,gBAE1C3B,aACI,oBAC0B,IAAlBK,EAAMsB,UAAyC,IAApBO,cAC3B7B,EAAM+B,gDAAuBC,wBAASC,WAG9C,CAACjC,EAAMsB,QAASO,EAAiB7B,EAAM+B,wBAGpC/B,EAAMsB,QACT3B,gBAACwB,mBAAiBnB,GACdL,gBAACM,wBACOF,EACAC,GACJS,IAAKA,EACLE,UAAWC,EAAW,oBAAqBF,OAGnD,QA8DFwB,EAAW1B,wBAA8C,WAU3DC,OARIJ,IAAAA,MACAR,IAAAA,SACAsC,IAAAA,aACAC,aAAAA,gBACAC,IAAAA,QACA3B,IAAAA,0BACGX,wCAIgCJ,aAAiBD,GAAhDU,IAAAA,iBAAqBJ,sCACrBsC,EAAStC,EAATsC,KAEFC,EAAc5C,eAChB,SAAqB6C,GACjBH,MAAAA,GAAAA,EAAUG,OAGJC,GAAiC,KADnCN,IAAaK,EAAME,iBAAmBP,SAAaQ,IACPP,EAChDhC,EAAiBC,GACboC,GAAaH,MAErB,CAACH,EAAUE,EAASjC,EAAkBgC,EAAcE,EAAMjC,WAI1DV,gBAACM,4BACOF,EACAC,GACJS,IAAKA,EACL4B,QAASE,EACT5B,UAAWD,IAEVb,MAgCP+C,EAAUjD,cAAkD,WAE9Dc,OADEZ,IAAAA,SAAUC,IAAAA,aAAiBC,wCAGgCJ,aAAiBD,GAApDmD,IAAlBzC,iBAA2CJ,sCACrC8C,EAAmB9C,EAAzBsC,KAEFS,EAAsBpD,eACxB,SAA6BU,GACrBP,GAAcA,EAAaO,GAC/BwC,EAAqBxC,GACrByC,MAEJ,CAACA,EAAgBD,EAAsB/C,MAGpBH,WAAeqD,QAAQnD,GAAvCoD,OAAQC,cAGXvD,gBAACM,4BAAoBD,EAAWD,GAAOU,IAAKA,KACvC,SAAC0C,UACExD,gBAACC,GAAKE,aAAciD,GACfpD,eAAmBsD,qCACbE,OACHxC,UAAWC,EAAWuC,EAAYxC,UAAW,8BAEhDuC,SAwBfE,EAAY5C,wBAA4C,WAE1DC,OADE4C,IAAAA,MAAOxD,IAAAA,SAAUa,IAAAA,0BAA8BX,wCAGVJ,aAAiBD,GAA3BM,6CAEzBL,gBAACM,2BAAiBQ,IAAKA,GAASV,EAAWC,GAAOW,UAAWD,IACxD2C,EACG1D,uBAAK2D,KAAK,eAAe3C,UAAU,6BAC9B0C,GAEL,KACHxD"}
@@ -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
  }
@@ -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 r=e(require("react")),t=e(require("classnames"));function a(e){var a=e.fillPercentage,s=void 0===a?0:a,i=t("reactist_progress_bar",e.className);return r.createElement("div",{className:i},r.createElement("div",{className:"inner",style:{width:(s<0?0:s>100?100:s)+"%"}}))}a.displayName="ProgressBar",exports.ProgressBar=a;
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("react")),a=e(require("classnames")),t=require("../../new-components/hidden-visually/hidden-visually.js");function s(e){var s=e.fillPercentage,l=void 0===s?0:s,i=e["aria-valuetext"],n=a("reactist_progress_bar",e.className),u=l<0?0:l>100?100:l;return r.createElement("div",{className:n},r.createElement("div",{className:"inner",style:{width:u+"%"}}),r.createElement(t.HiddenVisually,null,r.createElement("progress",{value:u,max:100,"aria-valuetext":null!=i?i:void 0})))}s.displayName="ProgressBar",exports.ProgressBar=s;
2
2
  //# sourceMappingURL=progress-bar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"progress-bar.js","sources":["../../../src/components/progress-bar/progress-bar.tsx"],"sourcesContent":["import React from 'react'\nimport classNames from 'classnames'\n\nimport './progress-bar.less'\n\ntype Props = {\n /** Additional css class applied to the progress bar. */\n className?: string\n /** How much of the progress bar should be filled. Number between 0 and 100 inclusive. */\n fillPercentage?: number\n}\nfunction ProgressBar({ fillPercentage = 0, className }: Props) {\n const finalClassName = classNames('reactist_progress_bar', className)\n const width = fillPercentage < 0 ? 0 : fillPercentage > 100 ? 100 : fillPercentage\n return (\n <div className={finalClassName}>\n <div className=\"inner\" style={{ width: `${width}%` }} />\n </div>\n )\n}\nProgressBar.displayName = 'ProgressBar'\n\nexport { ProgressBar }\n"],"names":["ProgressBar","fillPercentage","finalClassName","classNames","className","React","style","width","displayName"],"mappings":"+LAWA,SAASA,aAAcC,eAAAA,aAAiB,IAC9BC,EAAiBC,EAAW,0BADKC,kBAInCC,uBAAKD,UAAWF,GACZG,uBAAKD,UAAU,QAAQE,MAAO,CAAEC,OAH1BN,EAAiB,EAAI,EAAIA,EAAiB,IAAM,IAAMA,WAOxED,EAAYQ,YAAc"}
1
+ {"version":3,"file":"progress-bar.js","sources":["../../../src/components/progress-bar/progress-bar.tsx"],"sourcesContent":["import React from 'react'\nimport { HiddenVisually } from '../../new-components/hidden-visually'\nimport classNames from 'classnames'\n\nimport './progress-bar.less'\n\ntype Props = {\n /** Additional css class applied to the progress bar. */\n className?: string\n /** How much of the progress bar should be filled. Number between 0 and 100 inclusive. */\n fillPercentage?: number\n /** Defines the human readable text alternative for assitive technologies. */\n 'aria-valuetext'?: string\n}\nfunction ProgressBar({ fillPercentage = 0, className, 'aria-valuetext': ariaValuetext }: Props) {\n const finalClassName = classNames('reactist_progress_bar', className)\n const width = fillPercentage < 0 ? 0 : fillPercentage > 100 ? 100 : fillPercentage\n return (\n <div className={finalClassName}>\n <div className=\"inner\" style={{ width: `${width}%` }} />\n <HiddenVisually>\n <progress value={width} max={100} aria-valuetext={ariaValuetext ?? undefined} />\n </HiddenVisually>\n </div>\n )\n}\nProgressBar.displayName = 'ProgressBar'\n\nexport { ProgressBar }\n"],"names":["ProgressBar","fillPercentage","ariaValuetext","finalClassName","classNames","className","width","React","style","HiddenVisually","value","max","undefined","displayName"],"mappings":"oQAcA,SAASA,aAAcC,eAAAA,aAAiB,IAAgCC,IAAlB,kBAC5CC,EAAiBC,EAAW,0BADKC,WAEjCC,EAAQL,EAAiB,EAAI,EAAIA,EAAiB,IAAM,IAAMA,SAEhEM,uBAAKF,UAAWF,GACZI,uBAAKF,UAAU,QAAQG,MAAO,CAAEF,MAAUA,SAC1CC,gBAACE,sBACGF,4BAAUG,MAAOJ,EAAOK,IAAK,qBAAqBT,MAAAA,EAAAA,OAAiBU,MAKnFZ,EAAYa,YAAc"}
@@ -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 a=e(require("react")),t=e(require("classnames")),l=require("../../_virtual/_rollupPluginBabelHelpers.js");function s(e){var s=e.value,u=e.options,i=void 0===u?[]:u,o=e.onChange,r=e.disabled,n=void 0===r||r,d=e.className,c=void 0===d?"":d,v=e.defaultValue,p=l.objectWithoutPropertiesLoose(e,["value","options","onChange","disabled","className","defaultValue"]),b=t("reactist_select",{disabled:n},c);return a.createElement("select",Object.assign({className:b,value:s,onChange:function(e){return o?o(e.target.value):void 0},disabled:n,defaultValue:v},p),null==i?void 0:i.map((function(e){return a.createElement("option",{key:e.key||e.value,value:e.value,disabled:e.disabled},e.text)})))}s.displayName="Select",s.defaultProps={options:[],disabled:!1},exports.Select=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 a=require("../../_virtual/_rollupPluginBabelHelpers.js"),t=e(require("react")),l=e(require("classnames")),s=["value","options","onChange","disabled","className","defaultValue"];function u(e){var u=e.value,i=e.options,o=void 0===i?[]:i,r=e.onChange,n=e.disabled,d=void 0===n||n,c=e.className,v=void 0===c?"":c,p=e.defaultValue,b=a.objectWithoutPropertiesLoose(e,s),f=l("reactist_select",{disabled:d},v);return t.createElement("select",Object.assign({className:f,value:u,onChange:function(e){return r?r(e.target.value):void 0},disabled:d,defaultValue:p},b),null==o?void 0:o.map((function(e){return t.createElement("option",{key:e.key||e.value,value:e.value,disabled:e.disabled},e.text)})))}u.displayName="Select",u.defaultProps={options:[],disabled:!1},exports.Select=u;
2
2
  //# sourceMappingURL=select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","sources":["../../../src/components/select/select.tsx"],"sourcesContent":["import React from 'react'\nimport classNames from 'classnames'\n\nimport './select.less'\n\ntype Option = {\n /** Optional key for each option. If not provided `value` is used. */\n key?: string | number\n /** Value of the option. */\n value: string | number\n /** Text to display for the option. */\n text?: string | number\n /** Whether the options is disabled or not. */\n disabled?: boolean\n}\n\ntype Props = {\n className?: string\n disabled?: boolean\n /** Currently selected value. */\n value?: string | number\n /** Callback for the change event. Will be called with the next value (not the full event). */\n onChange?: (value: string) => void\n /** Options that are rendered in the select. */\n options?: Option[]\n /** Value to initially be set */\n defaultValue?: string | number\n}\n\nfunction Select({\n value,\n options = [],\n onChange,\n disabled = true,\n className = '',\n defaultValue,\n ...otherProps\n}: Props) {\n const selectClassName = classNames('reactist_select', { disabled }, className)\n return (\n <select\n className={selectClassName}\n value={value}\n onChange={(event) => (onChange ? onChange(event.target.value) : undefined)}\n disabled={disabled}\n defaultValue={defaultValue}\n {...otherProps}\n >\n {options?.map((option) => (\n <option\n key={option.key || option.value}\n value={option.value}\n disabled={option.disabled}\n >\n {option.text}\n </option>\n ))}\n </select>\n )\n}\nSelect.displayName = 'Select'\nSelect.defaultProps = {\n options: [],\n disabled: false,\n}\n\nexport { Select }\n"],"names":["Select","value","options","onChange","disabled","className","defaultValue","otherProps","selectClassName","classNames","React","event","target","undefined","map","option","key","text","displayName","defaultProps"],"mappings":"wPA6BA,SAASA,SACLC,IAAAA,UACAC,QAAAA,aAAU,KACVC,IAAAA,aACAC,SAAAA,oBACAC,UAAAA,aAAY,KACZC,IAAAA,aACGC,yGAEGC,EAAkBC,EAAW,kBAAmB,CAAEL,SAAAA,GAAYC,UAEhEK,wCACIL,UAAWG,EACXP,MAAOA,EACPE,SAAU,SAACQ,UAAWR,EAAWA,EAASQ,EAAMC,OAAOX,YAASY,GAChET,SAAUA,EACVE,aAAcA,GACVC,GAEHL,MAAAA,SAAAA,EAASY,KAAI,SAACC,UACXL,0BACIM,IAAKD,EAAOC,KAAOD,EAAOd,MAC1BA,MAAOc,EAAOd,MACdG,SAAUW,EAAOX,UAEhBW,EAAOE,UAM5BjB,EAAOkB,YAAc,SACrBlB,EAAOmB,aAAe,CAClBjB,QAAS,GACTE,UAAU"}
1
+ {"version":3,"file":"select.js","sources":["../../../src/components/select/select.tsx"],"sourcesContent":["import React from 'react'\nimport classNames from 'classnames'\n\nimport './select.less'\n\ntype Option = {\n /** Optional key for each option. If not provided `value` is used. */\n key?: string | number\n /** Value of the option. */\n value: string | number\n /** Text to display for the option. */\n text?: string | number\n /** Whether the options is disabled or not. */\n disabled?: boolean\n}\n\ntype Props = {\n className?: string\n disabled?: boolean\n /** Currently selected value. */\n value?: string | number\n /** Callback for the change event. Will be called with the next value (not the full event). */\n onChange?: (value: string) => void\n /** Options that are rendered in the select. */\n options?: Option[]\n /** Value to initially be set */\n defaultValue?: string | number\n}\n\nfunction Select({\n value,\n options = [],\n onChange,\n disabled = true,\n className = '',\n defaultValue,\n ...otherProps\n}: Props) {\n const selectClassName = classNames('reactist_select', { disabled }, className)\n return (\n <select\n className={selectClassName}\n value={value}\n onChange={(event) => (onChange ? onChange(event.target.value) : undefined)}\n disabled={disabled}\n defaultValue={defaultValue}\n {...otherProps}\n >\n {options?.map((option) => (\n <option\n key={option.key || option.value}\n value={option.value}\n disabled={option.disabled}\n >\n {option.text}\n </option>\n ))}\n </select>\n )\n}\nSelect.displayName = 'Select'\nSelect.defaultProps = {\n options: [],\n disabled: false,\n}\n\nexport { Select }\n"],"names":["Select","value","options","onChange","disabled","className","defaultValue","otherProps","selectClassName","classNames","React","event","target","undefined","map","option","key","text","displayName","defaultProps"],"mappings":"+TA6BA,SAASA,SACLC,IAAAA,UACAC,QAAAA,aAAU,KACVC,IAAAA,aACAC,SAAAA,oBACAC,UAAAA,aAAY,KACZC,IAAAA,aACGC,sCAEGC,EAAkBC,EAAW,kBAAmB,CAAEL,SAAAA,GAAYC,UAEhEK,wCACIL,UAAWG,EACXP,MAAOA,EACPE,SAAU,SAACQ,UAAWR,EAAWA,EAASQ,EAAMC,OAAOX,YAASY,GAChET,SAAUA,EACVE,aAAcA,GACVC,GAEHL,MAAAA,SAAAA,EAASY,KAAI,SAACC,UACXL,0BACIM,IAAKD,EAAOC,KAAOD,EAAOd,MAC1BA,MAAOc,EAAOd,MACdG,SAAUW,EAAOX,UAEhBW,EAAOE,UAM5BjB,EAAOkB,YAAc,SACrBlB,EAAOmB,aAAe,CAClBjB,QAAS,GACTE,UAAU"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e,r=require("../../_virtual/_rollupPluginBabelHelpers.js"),o=require("../tooltip/tooltip.js"),i=require("./time-utils.js"),s=function(e){function s(t){var r;return(r=e.call(this,t)||this).refreshInterval=void 0,r.state={hovered:!1,mouseX:void 0,mouseY:void 0},r}r.inheritsLoose(s,e);var n=s.prototype;return n.componentDidMount=function(){this.props.refresh&&this._refresh()},n.componentDidUpdate=function(e){!e.refresh&&this.props.refresh&&this._refresh(),e.refresh&&!this.props.refresh&&this.refreshInterval&&clearTimeout(this.refreshInterval)},n.componentWillUnmount=function(){this.refreshInterval&&clearTimeout(this.refreshInterval)},n._setHovered=function(e,t){var r=this.state,o=t.clientX,i=t.clientY;o===r.mouseX&&i===r.mouseY||this.setState((function(){return{hovered:e,mouseX:o,mouseY:i}}))},n._renderTime=function(e){if(this.props.time){if(this.state.hovered){if(this.props.expandFullyOnHover&&!this.props.tooltipOnHover)return i.TimeUtils.formatTimeLong(this.props.time,e);if(this.props.expandOnHover&&!this.props.tooltipOnHover)return i.TimeUtils.formatTime(this.props.time,e)}return i.TimeUtils.timeAgo(this.props.time,e)}},n._refresh=function(){var e=this;this.refreshInterval=setInterval((function(){e.forceUpdate()}),6e4)},n.render=function(){var e=this,r="reactist_time";this.props.className&&(r=this.props.className);var s=this._renderTime(this.props.config);return t.createElement("time",{className:r,onMouseEnter:function(t){return e._setHovered(!0,t)},onMouseLeave:function(t){return e._setHovered(!1,t)}},this.props.tooltipOnHover?t.createElement(o.Tooltip,{content:this.props.tooltip||this.props.time&&i.TimeUtils.formatTimeLong(this.props.time,this.props.config)},t.createElement("span",null,s)):s)},s}(t.Component);s.displayName="Time",s.defaultProps={expandOnHover:!1,expandFullyOnHover:!1,tooltipOnHover:!1,refresh:!0,config:{locale:"en",daysSuffix:"d",hoursSuffix:"h",minutesSuffix:"m",momentsAgo:"moments ago"}},exports.Time=s;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e,o=require("../tooltip/tooltip.js"),i=require("./time-utils.js"),s=function(e){function s(t){var r;return(r=e.call(this,t)||this).refreshInterval=void 0,r.state={hovered:!1,mouseX:void 0,mouseY:void 0},r}t.inheritsLoose(s,e);var n=s.prototype;return n.componentDidMount=function(){this.props.refresh&&this._refresh()},n.componentDidUpdate=function(e){!e.refresh&&this.props.refresh&&this._refresh(),e.refresh&&!this.props.refresh&&this.refreshInterval&&clearTimeout(this.refreshInterval)},n.componentWillUnmount=function(){this.refreshInterval&&clearTimeout(this.refreshInterval)},n._setHovered=function(e,t){var r=this.state,o=t.clientX,i=t.clientY;o===r.mouseX&&i===r.mouseY||this.setState((function(){return{hovered:e,mouseX:o,mouseY:i}}))},n._renderTime=function(e){if(this.props.time){if(this.state.hovered){if(this.props.expandFullyOnHover&&!this.props.tooltipOnHover)return i.TimeUtils.formatTimeLong(this.props.time,e);if(this.props.expandOnHover&&!this.props.tooltipOnHover)return i.TimeUtils.formatTime(this.props.time,e)}return i.TimeUtils.timeAgo(this.props.time,e)}},n._refresh=function(){var e=this;this.refreshInterval=setInterval((function(){e.forceUpdate()}),6e4)},n.render=function(){var e=this,t="reactist_time";this.props.className&&(t=this.props.className);var s=this._renderTime(this.props.config);return r.createElement("time",{className:t,onMouseEnter:function(t){return e._setHovered(!0,t)},onMouseLeave:function(t){return e._setHovered(!1,t)}},this.props.tooltipOnHover?r.createElement(o.Tooltip,{content:this.props.tooltip||this.props.time&&i.TimeUtils.formatTimeLong(this.props.time,this.props.config)},r.createElement("span",null,s)):s)},s}(r.Component);s.displayName="Time",s.defaultProps={expandOnHover:!1,expandFullyOnHover:!1,tooltipOnHover:!1,refresh:!0,config:{locale:"en",daysSuffix:"d",hoursSuffix:"h",minutesSuffix:"m",momentsAgo:"moments ago"}},exports.Time=s;
2
2
  //# sourceMappingURL=time.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=e(require("react")),n=e(require("classnames")),o=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("reakit/Tooltip");exports.HIDE_DELAY=100,exports.SHOW_DELAY=500,exports.Tooltip=function(e){var u,i,c,s,l=e.children,a=e.content,p=e.position,f=void 0===p?"top":p,d=e.gapSize,m=void 0===d?3:d,b=e.className,E=o.objectWithoutPropertiesLoose(e,["children","content","position","gapSize","className"]),v=(c=r.useTooltipState({placement:f,gutter:m}),u=t.useRef(),i=t.useCallback((function(){null!=u.current&&clearTimeout(u.current)}),[]),t.useEffect((function(){return i}),[i]),s=t.useCallback((function(e,t){return function(){i(),u.current=setTimeout(e,t)}}),[i]),t.useMemo((function(){return o.objectSpread2(o.objectSpread2({},c),{},{show:s((function(){return c.show()}),500),hide:s((function(){return c.hide()}),100)})}),[s,c])),h=t.Children.only(l);return a?t.createElement(t.Fragment,null,t.createElement(r.TooltipReference,Object.assign({},v,{ref:h.ref},h.props,{onFocus:function(e){e.currentTarget.addEventListener("keyup",(function(e){var t=e.key;"Escape"!==t&&"Enter"!==t&&"Space"!==t&&v.show()}),{once:!0}),e.preventDefault(),"function"==typeof h.props.onFocus&&h.props.onFocus(e)}}),(function(e){return t.cloneElement(h,e)})),v.visible?t.createElement(r.Tooltip,Object.assign({},v,E,{className:n("reactist_tooltip",b)}),"function"==typeof a?a():a):null):h};
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=require("reakit/Tooltip"),u=["children","content","position","gapSize","className"];exports.HIDE_DELAY=100,exports.SHOW_DELAY=500,exports.Tooltip=function(e){var i,c,s,l,a=e.children,p=e.content,f=e.position,d=void 0===f?"top":f,m=e.gapSize,b=void 0===m?3:m,E=e.className,v=t.objectWithoutPropertiesLoose(e,u),h=(s=r.useTooltipState({placement:d,gutter:b}),i=n.useRef(),c=n.useCallback((function(){null!=i.current&&clearTimeout(i.current)}),[]),n.useEffect((function(){return c}),[c]),l=n.useCallback((function(e,t){return function(){c(),i.current=setTimeout(e,t)}}),[c]),n.useMemo((function(){return t.objectSpread2(t.objectSpread2({},s),{},{show:l((function(){return s.show()}),500),hide:l((function(){return s.hide()}),100)})}),[l,s])),g=n.Children.only(a);return p?n.createElement(n.Fragment,null,n.createElement(r.TooltipReference,Object.assign({},h,{ref:g.ref},g.props,{onFocus:function(e){e.currentTarget.addEventListener("keyup",(function(e){var t=e.key;"Escape"!==t&&"Enter"!==t&&"Space"!==t&&h.show()}),{once:!0}),e.preventDefault(),"function"==typeof g.props.onFocus&&g.props.onFocus(e)}}),(function(e){return n.cloneElement(g,e)})),h.visible?n.createElement(r.Tooltip,Object.assign({},h,v,{className:o("reactist_tooltip",E)}),"function"==typeof p?p():p):null):g};
2
2
  //# sourceMappingURL=tooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sources":["../../../src/components/tooltip/tooltip.tsx"],"sourcesContent":["import React from 'react'\nimport classNames from 'classnames'\n\nimport {\n useTooltipState,\n TooltipInitialState,\n Tooltip as ReakitTooltip,\n TooltipReference,\n TooltipProps as ReakitTooltipProps,\n} from 'reakit/Tooltip'\nimport { PopoverState } from 'reakit/Popover'\n\nimport './tooltip.less'\n\ntype TooltipProps = Omit<ReakitTooltipProps, 'children'> & {\n children: React.ReactNode\n content: React.ReactNode | (() => React.ReactNode)\n position?: PopoverState['placement']\n gapSize?: number\n}\n\n// These are exported to be used in the tests, they are not meant to be exported publicly\nexport const SHOW_DELAY = 500\nexport const HIDE_DELAY = 100\n\nfunction useDelayedTooltipState(initialState: TooltipInitialState) {\n const tooltipState = useTooltipState(initialState)\n const delay = useDelay()\n return React.useMemo(\n () => ({\n ...tooltipState,\n show: delay(() => tooltipState.show(), SHOW_DELAY),\n hide: delay(() => tooltipState.hide(), HIDE_DELAY),\n }),\n [delay, tooltipState],\n )\n}\n\nfunction Tooltip({\n children,\n content,\n position = 'top',\n gapSize = 3,\n className,\n ...props\n}: TooltipProps) {\n const tooltip = useDelayedTooltipState({ placement: position, gutter: gapSize })\n\n const child = React.Children.only<React.ReactElement>(children as React.ReactElement)\n if (!content) {\n return child\n }\n\n /**\n * Prevents the tooltip from automatically firing on focus all the time. This is to prevent\n * tooltips from showing when the trigger element is focused back after a popover or dialog that\n * it opened was closed. See link below for more details.\n * @see https://github.com/reakit/reakit/discussions/749\n */\n function handleFocus(event: React.FocusEvent) {\n // If focus is not followed by a key up event, does it mean that it's not\n // an intentional keyboard focus? Not sure but it seems to work.\n // This may be resolved soon in an upcoming version of reakit:\n // https://github.com/reakit/reakit/issues/750\n function handleKeyUp(e: Event) {\n const eventKey = (e as KeyboardEvent).key\n if (eventKey !== 'Escape' && eventKey !== 'Enter' && eventKey !== 'Space') {\n tooltip.show()\n }\n }\n event.currentTarget.addEventListener('keyup', handleKeyUp, { once: true })\n // Prevent tooltip.show from being called by TooltipReference\n event.preventDefault()\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n if (typeof child.props.onFocus === 'function') child.props.onFocus(event)\n }\n\n return (\n <>\n <TooltipReference\n {...tooltip}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n ref={(child as any).ref}\n {...child.props}\n onFocus={handleFocus}\n >\n {(referenceProps) => React.cloneElement(child, referenceProps)}\n </TooltipReference>\n {tooltip.visible ? (\n <ReakitTooltip\n {...tooltip}\n {...props}\n className={classNames('reactist_tooltip', className)}\n >\n {typeof content === 'function' ? content() : content}\n </ReakitTooltip>\n ) : null}\n </>\n )\n}\n\nexport type { TooltipProps }\nexport { Tooltip }\n\n//\n// Internal helpers\n//\n\n/**\n * Returns a function offering the same interface as setTimeout, but cleans up on unmount.\n *\n * The timeout state is shared, and only one delayed function can be active at any given time. If\n * a new delayed function is called while another one was waiting for its time to run, that older\n * invocation is cleared and it never runs.\n *\n * This is suitable for our use case here, but probably not the most intuitive thing in general.\n * That's why this is not made a shared util or something like it.\n */\nfunction useDelay() {\n const timeoutRef = React.useRef<ReturnType<typeof setTimeout>>()\n\n const clearTimeouts = React.useCallback(function clearTimeouts() {\n if (timeoutRef.current != null) {\n clearTimeout(timeoutRef.current)\n }\n }, [])\n\n // Runs clearTimeouts when the component is unmounted\n React.useEffect(() => clearTimeouts, [clearTimeouts])\n\n return React.useCallback(\n function delay(fn: () => void, delay: number) {\n return () => {\n clearTimeouts()\n timeoutRef.current = setTimeout(fn, delay)\n }\n },\n [clearTimeouts],\n )\n}\n"],"names":["timeoutRef","clearTimeouts","tooltipState","delay","children","content","position","gapSize","className","props","tooltip","useTooltipState","placement","gutter","React","useRef","useCallback","current","clearTimeout","useEffect","fn","setTimeout","useMemo","show","hide","child","Children","only","TooltipReference","ref","onFocus","event","currentTarget","addEventListener","e","eventKey","key","once","preventDefault","referenceProps","cloneElement","visible","ReakitTooltip","classNames"],"mappings":"uSAuB0B,uBADA,oBAgB1B,gBAiFUA,EAEAC,EA/FAC,EACAC,EAYNC,IAAAA,SACAC,IAAAA,YACAC,SAAAA,aAAW,YACXC,QAAAA,aAAU,IACVC,IAAAA,UACGC,4FAEGC,GApBAR,EAAeS,kBAoBkB,CAAEC,UAAWN,EAAUO,OAAQN,IAyEhEP,EAAac,EAAMC,SAEnBd,EAAgBa,EAAME,aAAY,WACV,MAAtBhB,EAAWiB,SACXC,aAAalB,EAAWiB,WAE7B,IAGHH,EAAMK,WAAU,kBAAMlB,IAAe,CAACA,IArGhCE,EAuGCW,EAAME,aACT,SAAeI,EAAgBjB,UACpB,WACHF,IACAD,EAAWiB,QAAUI,WAAWD,EAAIjB,MAG5C,CAACF,IA7GEa,EAAMQ,SACT,qDACOpB,OACHqB,KAAMpB,GAAM,kBAAMD,EAAaqB,SATjB,KAUdC,KAAMrB,GAAM,kBAAMD,EAAasB,SATjB,SAWlB,CAACrB,EAAOD,KAcNuB,EAAQX,EAAMY,SAASC,KAAyBvB,UACjDC,EA6BDS,gCACIA,gBAACc,oCACOlB,GAEJmB,IAAMJ,EAAcI,KAChBJ,EAAMhB,OACVqB,iBAzBSC,GAWjBA,EAAMC,cAAcC,iBAAiB,kBANhBC,OACXC,EAAYD,EAAoBE,IACrB,WAAbD,GAAsC,UAAbA,GAAqC,UAAbA,GACjDzB,EAAQa,SAG2C,CAAEc,MAAM,IAEnEN,EAAMO,iBAE6B,mBAAxBb,EAAMhB,MAAMqB,SAAwBL,EAAMhB,MAAMqB,QAAQC,OAY1D,SAACQ,UAAmBzB,EAAM0B,aAAaf,EAAOc,MAElD7B,EAAQ+B,QACL3B,gBAAC4B,2BACOhC,EACAD,GACJD,UAAWmC,EAAW,mBAAoBnC,KAEtB,mBAAZH,EAAyBA,IAAYA,GAEjD,MA9CDoB"}
1
+ {"version":3,"file":"tooltip.js","sources":["../../../src/components/tooltip/tooltip.tsx"],"sourcesContent":["import React from 'react'\nimport classNames from 'classnames'\n\nimport {\n useTooltipState,\n TooltipInitialState,\n Tooltip as ReakitTooltip,\n TooltipReference,\n TooltipProps as ReakitTooltipProps,\n} from 'reakit/Tooltip'\nimport { PopoverState } from 'reakit/Popover'\n\nimport './tooltip.less'\n\ntype TooltipProps = Omit<ReakitTooltipProps, 'children'> & {\n children: React.ReactNode\n content: React.ReactNode | (() => React.ReactNode)\n position?: PopoverState['placement']\n gapSize?: number\n}\n\n// These are exported to be used in the tests, they are not meant to be exported publicly\nexport const SHOW_DELAY = 500\nexport const HIDE_DELAY = 100\n\nfunction useDelayedTooltipState(initialState: TooltipInitialState) {\n const tooltipState = useTooltipState(initialState)\n const delay = useDelay()\n return React.useMemo(\n () => ({\n ...tooltipState,\n show: delay(() => tooltipState.show(), SHOW_DELAY),\n hide: delay(() => tooltipState.hide(), HIDE_DELAY),\n }),\n [delay, tooltipState],\n )\n}\n\nfunction Tooltip({\n children,\n content,\n position = 'top',\n gapSize = 3,\n className,\n ...props\n}: TooltipProps) {\n const tooltip = useDelayedTooltipState({ placement: position, gutter: gapSize })\n\n const child = React.Children.only<React.ReactElement>(children as React.ReactElement)\n if (!content) {\n return child\n }\n\n /**\n * Prevents the tooltip from automatically firing on focus all the time. This is to prevent\n * tooltips from showing when the trigger element is focused back after a popover or dialog that\n * it opened was closed. See link below for more details.\n * @see https://github.com/reakit/reakit/discussions/749\n */\n function handleFocus(event: React.FocusEvent) {\n // If focus is not followed by a key up event, does it mean that it's not\n // an intentional keyboard focus? Not sure but it seems to work.\n // This may be resolved soon in an upcoming version of reakit:\n // https://github.com/reakit/reakit/issues/750\n function handleKeyUp(e: Event) {\n const eventKey = (e as KeyboardEvent).key\n if (eventKey !== 'Escape' && eventKey !== 'Enter' && eventKey !== 'Space') {\n tooltip.show()\n }\n }\n event.currentTarget.addEventListener('keyup', handleKeyUp, { once: true })\n // Prevent tooltip.show from being called by TooltipReference\n event.preventDefault()\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n if (typeof child.props.onFocus === 'function') child.props.onFocus(event)\n }\n\n return (\n <>\n <TooltipReference\n {...tooltip}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n ref={(child as any).ref}\n {...child.props}\n onFocus={handleFocus}\n >\n {(referenceProps) => React.cloneElement(child, referenceProps)}\n </TooltipReference>\n {tooltip.visible ? (\n <ReakitTooltip\n {...tooltip}\n {...props}\n className={classNames('reactist_tooltip', className)}\n >\n {typeof content === 'function' ? content() : content}\n </ReakitTooltip>\n ) : null}\n </>\n )\n}\n\nexport type { TooltipProps }\nexport { Tooltip }\n\n//\n// Internal helpers\n//\n\n/**\n * Returns a function offering the same interface as setTimeout, but cleans up on unmount.\n *\n * The timeout state is shared, and only one delayed function can be active at any given time. If\n * a new delayed function is called while another one was waiting for its time to run, that older\n * invocation is cleared and it never runs.\n *\n * This is suitable for our use case here, but probably not the most intuitive thing in general.\n * That's why this is not made a shared util or something like it.\n */\nfunction useDelay() {\n const timeoutRef = React.useRef<ReturnType<typeof setTimeout>>()\n\n const clearTimeouts = React.useCallback(function clearTimeouts() {\n if (timeoutRef.current != null) {\n clearTimeout(timeoutRef.current)\n }\n }, [])\n\n // Runs clearTimeouts when the component is unmounted\n React.useEffect(() => clearTimeouts, [clearTimeouts])\n\n return React.useCallback(\n function delay(fn: () => void, delay: number) {\n return () => {\n clearTimeouts()\n timeoutRef.current = setTimeout(fn, delay)\n }\n },\n [clearTimeouts],\n )\n}\n"],"names":["timeoutRef","clearTimeouts","tooltipState","delay","children","content","position","gapSize","className","props","tooltip","useTooltipState","placement","gutter","React","useRef","useCallback","current","clearTimeout","useEffect","fn","setTimeout","useMemo","show","hide","child","Children","only","TooltipReference","ref","onFocus","event","currentTarget","addEventListener","e","eventKey","key","once","preventDefault","referenceProps","cloneElement","visible","ReakitTooltip","classNames"],"mappings":"iWAuB0B,uBADA,oBAgB1B,gBAiFUA,EAEAC,EA/FAC,EACAC,EAYNC,IAAAA,SACAC,IAAAA,YACAC,SAAAA,aAAW,YACXC,QAAAA,aAAU,IACVC,IAAAA,UACGC,sCAEGC,GApBAR,EAAeS,kBAoBkB,CAAEC,UAAWN,EAAUO,OAAQN,IAyEhEP,EAAac,EAAMC,SAEnBd,EAAgBa,EAAME,aAAY,WACV,MAAtBhB,EAAWiB,SACXC,aAAalB,EAAWiB,WAE7B,IAGHH,EAAMK,WAAU,kBAAMlB,IAAe,CAACA,IArGhCE,EAuGCW,EAAME,aACT,SAAeI,EAAgBjB,UACpB,WACHF,IACAD,EAAWiB,QAAUI,WAAWD,EAAIjB,MAG5C,CAACF,IA7GEa,EAAMQ,SACT,qDACOpB,OACHqB,KAAMpB,GAAM,kBAAMD,EAAaqB,SATjB,KAUdC,KAAMrB,GAAM,kBAAMD,EAAasB,SATjB,SAWlB,CAACrB,EAAOD,KAcNuB,EAAQX,EAAMY,SAASC,KAAyBvB,UACjDC,EA6BDS,gCACIA,gBAACc,oCACOlB,GAEJmB,IAAMJ,EAAcI,KAChBJ,EAAMhB,OACVqB,iBAzBSC,GAWjBA,EAAMC,cAAcC,iBAAiB,kBANhBC,OACXC,EAAYD,EAAoBE,IACrB,WAAbD,GAAsC,UAAbA,GAAqC,UAAbA,GACjDzB,EAAQa,SAG2C,CAAEc,MAAM,IAEnEN,EAAMO,iBAE6B,mBAAxBb,EAAMhB,MAAMqB,SAAwBL,EAAMhB,MAAMqB,QAAQC,OAY1D,SAACQ,UAAmBzB,EAAM0B,aAAaf,EAAOc,MAElD7B,EAAQ+B,QACL3B,gBAAC4B,2BACOhC,EACAD,GACJD,UAAWmC,EAAW,mBAAoBnC,KAEtB,mBAAZH,EAAyBA,IAAYA,GAEjD,MA9CDoB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './use-previous';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * usePrevious tracks the change of the given value -
3
+ * when a given value has been changed from a previous call,
4
+ * it will return the value prior to the change.
5
+ *
6
+ * Example:
7
+ *
8
+ * const [x, setX] = useState(1)
9
+ * const prevX = usePrevious(x)
10
+ *
11
+ * Suppose `setX(2)` is called, then in the next component render
12
+ * x = 2 and prevX = 1
13
+ */
14
+ declare function usePrevious<T>(value: T): T | null;
15
+ export { usePrevious };
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");exports.usePrevious=function(r){var u=e.useRef(null);return e.useEffect((function(){u.current=r}),[r]),u.current};
2
+ //# sourceMappingURL=use-previous.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-previous.js","sources":["../../../src/hooks/use-previous/use-previous.ts"],"sourcesContent":["import * as React from 'react'\n\n/**\n * usePrevious tracks the change of the given value -\n * when a given value has been changed from a previous call,\n * it will return the value prior to the change.\n *\n * Example:\n *\n * const [x, setX] = useState(1)\n * const prevX = usePrevious(x)\n *\n * Suppose `setX(2)` is called, then in the next component render\n * x = 2 and prevX = 1\n */\nfunction usePrevious<T>(value: T): T | null {\n const ref = React.useRef<T | null>(null)\n\n React.useEffect(() => {\n ref.current = value\n }, [value])\n\n return ref.current\n}\n\nexport { usePrevious }\n"],"names":["value","ref","React","current"],"mappings":"+GAeA,SAAwBA,OACdC,EAAMC,SAAuB,aAEnCA,aAAgB,WACZD,EAAIE,QAAUH,IACf,CAACA,IAEGC,EAAIE"}
package/lib/index.d.ts CHANGED
@@ -1,22 +1,42 @@
1
- export { default as Avatar } from './components/avatar';
2
- export { default as Button } from './components/button';
1
+ import './new-components/default-styles.less';
2
+ export * from './new-components/box';
3
+ export * from './new-components/columns';
4
+ export * from './new-components/divider';
5
+ export * from './new-components/inline';
6
+ export * from './new-components/stack';
7
+ export * from './new-components/hidden';
8
+ export * from './new-components/hidden-visually';
9
+ export * from './new-components/alert';
10
+ export * from './new-components/loading';
11
+ export * from './new-components/notice';
12
+ export * from './new-components/heading';
13
+ export * from './new-components/text';
14
+ export * from './new-components/button';
15
+ export * from './new-components/button-link';
16
+ export * from './new-components/text-link';
17
+ export * from './new-components/checkbox-field';
18
+ export * from './new-components/password-field';
19
+ export * from './new-components/select-field';
20
+ export * from './new-components/switch-field';
21
+ export * from './new-components/text-area';
22
+ export * from './new-components/text-field';
23
+ export * from './new-components/tabs';
24
+ export * from './new-components/modal';
25
+ export * from './new-components/avatar';
26
+ export * from './hooks/use-previous';
3
27
  export { default as Checkbox } from './components/checkbox';
4
28
  export { default as ColorPicker, COLORS } from './components/color-picker';
5
29
  export { default as Dropdown } from './components/dropdown';
6
- export { default as ErrorMessage } from './components/error-message';
7
- export { default as Icon } from './components/icon';
8
30
  export { default as Input } from './components/input';
9
- export { default as KeyCapturer, SUPPORTED_KEYS } from './components/key-capturer';
10
31
  export { default as KeyboardShortcut } from './components/keyboard-shortcut';
11
- export { default as Loading } from './components/loading';
12
- export * from './components/menu';
13
- export { default as Modal } from './components/modal';
14
- export { Notification } from './components/notification/notification';
32
+ export { default as KeyCapturer, SUPPORTED_KEYS } from './components/key-capturer';
33
+ export { default as Popover } from './components/popover';
15
34
  export { default as ProgressBar } from './components/progress-bar';
16
- export { default as RangeInput } from './components/range-input';
17
35
  export { default as Select } from './components/select';
18
- export { Tabs, Tab } from './components/tabs';
19
36
  export { default as Time } from './components/time';
20
- export { default as Tip } from './components/tip';
37
+ export { Notification } from './components/notification/notification';
21
38
  export { Tooltip, TooltipProps } from './components/tooltip';
22
- export { default as Popover } from './components/popover';
39
+ export * from './components/menu';
40
+ export { default as DeprecatedButton } from './components/deprecated-button';
41
+ export { default as DeprecatedModal } from './components/deprecated-modal';
42
+ export { DeprecatedLoading } from './components/deprecated-loading';
package/lib/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./components/avatar/index.js"),o=require("./components/tooltip/tooltip.js"),r=require("./components/button/index.js"),t=require("./components/checkbox/index.js"),n=require("./components/dropdown/index.js"),s=require("./components/color-picker/color-picker.js"),p=require("./components/color-picker/index.js"),u=require("./components/error-message/index.js"),i=require("./components/icon/index.js"),a=require("./components/input/index.js"),x=require("./components/key-capturer/key-capturer.js"),c=require("./components/key-capturer/index.js"),d=require("./components/keyboard-shortcut/index.js"),l=require("./components/loading/index.js"),m=require("./components/menu/menu.js"),j=require("./components/modal/index.js"),q=require("./components/notification/notification.js"),f=require("./components/progress-bar/index.js"),b=require("./components/range-input/index.js"),M=require("./components/select/index.js"),k=require("./components/tabs/tabs.js"),S=require("./components/time/index.js"),T=require("./components/tip/index.js"),g=require("./components/popover/index.js");exports.Avatar=e.default,exports.Tooltip=o.Tooltip,exports.Button=r.default,exports.Checkbox=t.default,exports.Dropdown=n.default,exports.COLORS=s.COLORS,exports.ColorPicker=p.default,exports.ErrorMessage=u.default,exports.Icon=i.default,exports.Input=a.default,exports.SUPPORTED_KEYS=x.SUPPORTED_KEYS,exports.KeyCapturer=c.default,exports.KeyboardShortcut=d.default,exports.Loading=l.default,exports.Menu=m.Menu,exports.MenuButton=m.MenuButton,exports.MenuGroup=m.MenuGroup,exports.MenuItem=m.MenuItem,exports.MenuList=m.MenuList,exports.SubMenu=m.SubMenu,exports.Modal=j.default,exports.Notification=q.Notification,exports.ProgressBar=f.default,exports.RangeInput=b.default,exports.Select=M.default,exports.Tab=k.Tab,exports.Tabs=k.Tabs,exports.Time=S.default,exports.Tip=T.default,exports.Popover=g.default;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./new-components/box/box.js"),o=require("./new-components/columns/columns.js"),t=require("./new-components/divider/divider.js"),r=require("./new-components/inline/inline.js"),n=require("./new-components/stack/stack.js"),s=require("./new-components/hidden/hidden.js"),i=require("./new-components/hidden-visually/hidden-visually.js"),p=require("./components/tooltip/tooltip.js"),d=require("./new-components/button/button.js"),u=require("./new-components/alert/alert.js"),a=require("./new-components/loading/loading.js"),l=require("./new-components/notice/notice.js"),c=require("./new-components/heading/heading.js"),x=require("./new-components/text/text.js"),m=require("./new-components/button-link/button-link.js"),j=require("./new-components/text-link/text-link.js"),q=require("./new-components/checkbox-field/checkbox-field.js"),w=require("./new-components/password-field/password-field.js"),b=require("./new-components/select-field/select-field.js"),f=require("./new-components/switch-field/switch-field.js"),k=require("./new-components/text-area/text-area.js"),M=require("./new-components/text-field/text-field.js"),T=require("./hooks/use-previous/use-previous.js"),h=require("./new-components/tabs/tabs.js"),v=require("./new-components/modal/modal.js"),S=require("./new-components/avatar/avatar.js"),g=require("./components/checkbox/index.js"),B=require("./components/deprecated-button/index.js"),L=require("./components/dropdown/index.js"),P=require("./components/color-picker/color-picker.js"),y=require("./components/color-picker/index.js"),C=require("./components/input/index.js"),F=require("./components/keyboard-shortcut/index.js"),A=require("./components/key-capturer/key-capturer.js"),D=require("./components/key-capturer/index.js"),H=require("./components/popover/index.js"),O=require("./components/progress-bar/index.js"),I=require("./components/select/index.js"),E=require("./components/time/index.js"),K=require("./components/notification/notification.js"),N=require("./components/menu/menu.js"),R=require("./components/deprecated-modal/index.js"),_=require("./components/deprecated-loading/deprecated-loading.js");exports.Box=e.Box,exports.Column=o.Column,exports.Columns=o.Columns,exports.Divider=t.Divider,exports.Inline=r.Inline,exports.Stack=n.Stack,exports.Hidden=s.Hidden,exports.HiddenVisually=i.HiddenVisually,exports.Tooltip=p.Tooltip,exports.Button=d.Button,exports.Alert=u.Alert,exports.Loading=a.Loading,exports.Notice=l.Notice,exports.Heading=c.Heading,exports.Text=x.Text,exports.ButtonLink=m.ButtonLink,exports.TextLink=j.TextLink,exports.CheckboxField=q.CheckboxField,exports.PasswordField=w.PasswordField,exports.SelectField=b.SelectField,exports.SwitchField=f.SwitchField,exports.TextArea=k.TextArea,exports.TextField=M.TextField,exports.usePrevious=T.usePrevious,exports.Tab=h.Tab,exports.TabAwareSlot=h.TabAwareSlot,exports.TabList=h.TabList,exports.TabPanel=h.TabPanel,exports.Tabs=h.Tabs,exports.Modal=v.Modal,exports.ModalActions=v.ModalActions,exports.ModalBody=v.ModalBody,exports.ModalCloseButton=v.ModalCloseButton,exports.ModalFooter=v.ModalFooter,exports.ModalHeader=v.ModalHeader,exports.Avatar=S.Avatar,exports.Checkbox=g.default,exports.DeprecatedButton=B.default,exports.Dropdown=L.default,exports.COLORS=P.COLORS,exports.ColorPicker=y.default,exports.Input=C.default,exports.KeyboardShortcut=F.default,exports.SUPPORTED_KEYS=A.SUPPORTED_KEYS,exports.KeyCapturer=D.default,exports.Popover=H.default,exports.ProgressBar=O.default,exports.Select=I.default,exports.Time=E.default,exports.Notification=K.Notification,exports.Menu=N.Menu,exports.MenuButton=N.MenuButton,exports.MenuGroup=N.MenuGroup,exports.MenuItem=N.MenuItem,exports.MenuList=N.MenuList,exports.SubMenu=N.SubMenu,exports.DeprecatedModal=R.default,exports.DeprecatedLoading=_.Loading;
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { AlertTone } from '../common-types';
3
+ declare type AllOrNone<T> = T | {
4
+ [K in keyof T]?: never;
5
+ };
6
+ declare type AlertCloseProps = AllOrNone<{
7
+ closeLabel: string;
8
+ onClose: () => void;
9
+ }>;
10
+ declare type AlertProps = {
11
+ id?: string;
12
+ children: React.ReactNode;
13
+ tone: AlertTone;
14
+ } & AlertCloseProps;
15
+ declare function Alert({ id, children, tone, closeLabel, onClose }: AlertProps): JSX.Element;
16
+ export { Alert };
17
+ export type { AlertProps };
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),l=require("../responsive-props.js"),t=require("../box/box.js"),n=require("../columns/columns.js"),r=require("../button/button.js"),a=require("../icons/alert-icon.js"),o=require("../icons/close-icon.js"),s=require("./alert.module.css.js");exports.Alert=function(i){var u=i.children,c=i.tone,m=i.closeLabel,d=i.onClose;return e.createElement(t.Box,{id:i.id,role:"alert","aria-live":"polite",borderRadius:"standard",className:[s.default.container,l.getClassNames(s.default,"tone",c)]},e.createElement(n.Columns,{space:"small",alignY:"top"},e.createElement(n.Column,{width:"content"},e.createElement(a.AlertIcon,{tone:c})),e.createElement(n.Column,null,e.createElement(t.Box,{paddingY:"xsmall",paddingRight:null!=d&&null!=m?void 0:"small"},u)),null!=d&&null!=m?e.createElement(n.Column,{width:"content"},e.createElement(r.Button,{variant:"quaternary",size:"small",onClick:d,"aria-label":m,icon:e.createElement(o.CloseIcon,null),style:{"--reactist-btn-hover-fill":"transparent"}})):null))};
2
+ //# sourceMappingURL=alert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.js","sources":["../../../src/new-components/alert/alert.tsx"],"sourcesContent":["import * as React from 'react'\nimport { AlertTone } from '../common-types'\nimport { getClassNames } from '../responsive-props'\nimport { Box } from '../box'\nimport { Button } from '../button'\nimport { Columns, Column } from '../columns'\n\nimport { AlertIcon } from '../icons/alert-icon'\nimport { CloseIcon } from '../icons/close-icon'\n\nimport styles from './alert.module.css'\n\ntype AllOrNone<T> = T | { [K in keyof T]?: never }\n\ntype AlertCloseProps = AllOrNone<{\n closeLabel: string\n onClose: () => void\n}>\n\ntype AlertProps = {\n id?: string\n children: React.ReactNode\n tone: AlertTone\n} & AlertCloseProps\n\nfunction Alert({ id, children, tone, closeLabel, onClose }: AlertProps) {\n return (\n <Box\n id={id}\n role=\"alert\"\n aria-live=\"polite\"\n borderRadius=\"standard\"\n className={[styles.container, getClassNames(styles, 'tone', tone)]}\n >\n <Columns space=\"small\" alignY=\"top\">\n <Column width=\"content\">\n <AlertIcon tone={tone} />\n </Column>\n <Column>\n <Box\n paddingY=\"xsmall\"\n paddingRight={onClose != null && closeLabel != null ? undefined : 'small'}\n >\n {children}\n </Box>\n </Column>\n {onClose != null && closeLabel != null ? (\n <Column width=\"content\">\n <Button\n variant=\"quaternary\"\n size=\"small\"\n onClick={onClose}\n aria-label={closeLabel}\n icon={<CloseIcon />}\n style={{\n // @ts-expect-error not sure how to make TypeScript understand custom CSS properties\n '--reactist-btn-hover-fill': 'transparent',\n }}\n />\n </Column>\n ) : null}\n </Columns>\n </Box>\n )\n}\n\nexport { Alert }\nexport type { AlertProps }\n"],"names":["children","tone","closeLabel","onClose","React","Box","id","role","borderRadius","className","styles","container","getClassNames","Columns","space","alignY","Column","width","AlertIcon","paddingY","paddingRight","undefined","Button","variant","size","onClick","icon","CloseIcon","style"],"mappings":"uVAyBA,gBAAqBA,IAAAA,SAAUC,IAAAA,KAAMC,IAAAA,WAAYC,IAAAA,eAEzCC,gBAACC,OACGC,KAHKA,GAILC,KAAK,oBACK,SACVC,aAAa,WACbC,UAAW,CAACC,UAAOC,UAAWC,gBAAcF,UAAQ,OAAQT,KAE5DG,gBAACS,WAAQC,MAAM,QAAQC,OAAO,OAC1BX,gBAACY,UAAOC,MAAM,WACVb,gBAACc,aAAUjB,KAAMA,KAErBG,gBAACY,cACGZ,gBAACC,OACGc,SAAS,SACTC,aAAyB,MAAXjB,GAAiC,MAAdD,OAAqBmB,EAAY,SAEjErB,IAGG,MAAXG,GAAiC,MAAdD,EAChBE,gBAACY,UAAOC,MAAM,WACVb,gBAACkB,UACGC,QAAQ,aACRC,KAAK,QACLC,QAAStB,eACGD,EACZwB,KAAMtB,gBAACuB,kBACPC,MAAO,6BAE0B,kBAIzC"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={container:"eb665121","tone-info":"d0373ff9","tone-positive":"bb18dcab","tone-caution":"_0af02331","tone-critical":"f76146f9"};
2
+ //# sourceMappingURL=alert.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './alert';
@@ -1,17 +1,20 @@
1
1
  /// <reference types="react" />
2
- import './avatar.less';
2
+ import { ResponsiveProp } from '../responsive-props';
3
3
  declare type AvatarSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';
4
4
  declare type Props = {
5
+ /** @deprecated Please use `exceptionallySetClassName` */
5
6
  className?: string;
7
+ exceptionallySetClassName?: string;
8
+ /** @deprecated */
6
9
  colorList?: string[];
7
- size?: AvatarSize;
10
+ size?: ResponsiveProp<AvatarSize>;
8
11
  avatarUrl?: string;
9
12
  user: {
10
13
  name?: string;
11
14
  email: string;
12
15
  };
13
16
  };
14
- declare function Avatar({ user, avatarUrl, size, className, colorList }: Props): JSX.Element;
17
+ declare function Avatar({ user, avatarUrl, size, className, colorList, exceptionallySetClassName, ...props }: Props): JSX.Element;
15
18
  declare namespace Avatar {
16
19
  var displayName: string;
17
20
  }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,a=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e,t=require("../responsive-props.js"),s=require("../box/box.js"),l=require("./utils.js"),i=require("./avatar.module.css.js"),o=["user","avatarUrl","size","className","colorList","exceptionallySetClassName"],c=["#fcc652","#e9952c","#e16b2d","#d84b40","#e8435a","#e5198a","#ad3889","#86389c","#a8a8a8","#98be2f","#5d9d50","#5f9f85","#5bbcb6","#32a3bf","#2bafeb","#2d88c3","#3863cc","#5e5e5e"];function u(e){var u=e.user,d=e.avatarUrl,n=e.size,b=void 0===n?"l":n,m=e.className,p=e.colorList,f=void 0===p?c:p,v=e.exceptionallySetClassName,x=a.objectWithoutPropertiesLoose(e,o),g=l.getInitials(u.name)||l.getInitials(u.email),j=b||"l",N=d?{backgroundImage:"url("+d+")",textIndent:"-9999px"}:{backgroundColor:f[l.emailToIndex(u.email,f.length)]},q=t.getClassNames(i.default,"size",j);return r.createElement(s.Box,Object.assign({className:[m,i.default.avatar,q,v],style:N},x),g)}u.displayName="Avatar",exports.Avatar=u;
2
+ //# sourceMappingURL=avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.js","sources":["../../../src/new-components/avatar/avatar.tsx"],"sourcesContent":["import React from 'react'\n\nimport { getInitials, emailToIndex } from './utils'\n\nimport { getClassNames, ResponsiveProp } from '../responsive-props'\nimport styles from './avatar.module.css'\nimport { Box } from '../box'\n\nconst AVATAR_COLORS = [\n '#fcc652',\n '#e9952c',\n '#e16b2d',\n '#d84b40',\n '#e8435a',\n '#e5198a',\n '#ad3889',\n '#86389c',\n '#a8a8a8',\n '#98be2f',\n '#5d9d50',\n '#5f9f85',\n '#5bbcb6',\n '#32a3bf',\n '#2bafeb',\n '#2d88c3',\n '#3863cc',\n '#5e5e5e',\n]\n\ntype AvatarSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl'\n\ntype Props = {\n /** @deprecated Please use `exceptionallySetClassName` */\n className?: string\n exceptionallySetClassName?: string\n /** @deprecated */\n colorList?: string[]\n size?: ResponsiveProp<AvatarSize>\n avatarUrl?: string\n user: { name?: string; email: string }\n}\n\nfunction Avatar({\n user,\n avatarUrl,\n size = 'l',\n className,\n colorList = AVATAR_COLORS,\n exceptionallySetClassName,\n ...props\n}: Props) {\n const userInitials = getInitials(user.name) || getInitials(user.email)\n const avatarSize = size ? size : 'l'\n\n const style = avatarUrl\n ? {\n backgroundImage: `url(${avatarUrl})`,\n textIndent: '-9999px', // hide the initials\n }\n : {\n backgroundColor: colorList[emailToIndex(user.email, colorList.length)],\n }\n\n const sizeClassName = getClassNames(styles, 'size', avatarSize)\n\n return (\n <Box\n className={[className, styles.avatar, sizeClassName, exceptionallySetClassName]}\n style={style}\n {...props}\n >\n {userInitials}\n </Box>\n )\n}\nAvatar.displayName = 'Avatar'\n\nexport { Avatar }\n"],"names":["AVATAR_COLORS","Avatar","user","avatarUrl","size","className","colorList","exceptionallySetClassName","props","userInitials","getInitials","name","email","avatarSize","style","backgroundImage","textIndent","backgroundColor","emailToIndex","length","sizeClassName","getClassNames","styles","React","Box","avatar","displayName"],"mappings":"sZAQMA,EAAgB,CAClB,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAgBJ,SAASC,SACLC,IAAAA,KACAC,IAAAA,cACAC,KAAAA,aAAO,MACPC,IAAAA,cACAC,UAAAA,aAAYN,IACZO,IAAAA,0BACGC,sCAEGC,EAAeC,cAAYR,EAAKS,OAASD,cAAYR,EAAKU,OAC1DC,EAAaT,GAAc,IAE3BU,EAAQX,EACR,CACIY,uBAAwBZ,MACxBa,WAAY,WAEhB,CACIC,gBAAiBX,EAAUY,eAAahB,EAAKU,MAAON,EAAUa,UAGlEC,EAAgBC,gBAAcC,UAAQ,OAAQT,UAGhDU,gBAACC,qBACGnB,UAAW,CAACA,EAAWiB,UAAOG,OAAQL,EAAeb,GACrDO,MAAOA,GACHN,GAEHC,GAIbR,EAAOyB,YAAc"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={avatar:"_38a1be89","size-xxs":"d32e92ae","size-xs":"_0667d719","size-s":"cf529fcf","size-m":"_6e268eab","size-l":"d64c62cf","size-xl":"_44fb77de","size-xxl":"_01f85e0e","size-xxxl":"_41a5fe19","tablet-size-xxs":"_6ab1577d","tablet-size-xs":"b52a4963","tablet-size-s":"_714a8419","tablet-size-m":"_81cd4d51","tablet-size-l":"bf0a4edb","tablet-size-xl":"e4f0dabd","tablet-size-xxl":"_67ea065d","tablet-size-xxxl":"_2af7f76f","desktop-size-xxs":"_759081dc","desktop-size-xs":"_8290d1c1","desktop-size-s":"_48ea172d","desktop-size-m":"_758f6641","desktop-size-l":"f9ada088","desktop-size-xl":"d3bb7470","desktop-size-xxl":"_9a312ee3","desktop-size-xxxl":"a1d30c23"};
2
+ //# sourceMappingURL=avatar.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './avatar';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../src/new-components/avatar/utils.ts"],"sourcesContent":["function getInitials(name?: string) {\n if (!name) {\n return ''\n }\n\n const seed = name.trim().split(' ')\n const firstInitial = seed[0]\n const lastInitial = seed[seed.length - 1]\n\n let initials = firstInitial[0]\n // Better readable this way.\n // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with\n if (firstInitial[0] !== lastInitial[0]) {\n initials += lastInitial[0]\n }\n return initials.toUpperCase()\n}\n\nfunction emailToIndex(email: string, maxIndex: number) {\n const seed = email.split('@')[0]\n const hash = seed.charCodeAt(0) + seed.charCodeAt(seed.length - 1) || 0\n return hash % maxIndex\n}\n\nexport { getInitials, emailToIndex }\n"],"names":["email","maxIndex","seed","split","charCodeAt","length","name","trim","firstInitial","lastInitial","initials","toUpperCase"],"mappings":"yFAkBA,SAAsBA,EAAeC,OAC3BC,EAAOF,EAAMG,MAAM,KAAK,UACjBD,EAAKE,WAAW,GAAKF,EAAKE,WAAWF,EAAKG,OAAS,IAAM,GACxDJ,uBArBlB,SAAqBK,OACZA,QACM,OAGLJ,EAAOI,EAAKC,OAAOJ,MAAM,KACzBK,EAAeN,EAAK,GACpBO,EAAcP,EAAKA,EAAKG,OAAS,GAEnCK,EAAWF,EAAa,UAGxBA,EAAa,KAAOC,EAAY,KAChCC,GAAYD,EAAY,IAErBC,EAASC"}
@@ -0,0 +1 @@
1
+ export {};