@doist/reactist 28.7.2 → 28.7.3

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 (467) hide show
  1. package/dist/reactist.cjs.development.js +2091 -3811
  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/avatar/avatar.js +35 -30
  6. package/es/avatar/avatar.js.map +1 -1
  7. package/es/avatar/utils.js +19 -22
  8. package/es/avatar/utils.js.map +1 -1
  9. package/es/badge/badge.js +5 -16
  10. package/es/badge/badge.js.map +1 -1
  11. package/es/banner/banner.js +39 -115
  12. package/es/banner/banner.js.map +1 -1
  13. package/es/banner/banner.module.css.js +1 -1
  14. package/es/base-field/base-field.js +80 -162
  15. package/es/base-field/base-field.js.map +1 -1
  16. package/es/base-field/base-field.module.css.js +1 -1
  17. package/es/box/box.js +61 -137
  18. package/es/box/box.js.map +1 -1
  19. package/es/button/button.js +42 -95
  20. package/es/button/button.js.map +1 -1
  21. package/es/checkbox-field/checkbox-field.js +46 -73
  22. package/es/checkbox-field/checkbox-field.js.map +1 -1
  23. package/es/checkbox-field/checkbox-field.module.css.js +1 -1
  24. package/es/checkbox-field/checkbox-icon.js +28 -55
  25. package/es/checkbox-field/checkbox-icon.js.map +1 -1
  26. package/es/checkbox-field/use-fork-ref.js +29 -25
  27. package/es/checkbox-field/use-fork-ref.js.map +1 -1
  28. package/es/columns/columns.js +22 -46
  29. package/es/columns/columns.js.map +1 -1
  30. package/es/columns/columns.module.css.js +1 -1
  31. package/es/components/color-picker/color-picker.js +45 -66
  32. package/es/components/color-picker/color-picker.js.map +1 -1
  33. package/es/components/deprecated-button/deprecated-button.js +11 -34
  34. package/es/components/deprecated-button/deprecated-button.js.map +1 -1
  35. package/es/components/deprecated-dropdown/dropdown.js +136 -197
  36. package/es/components/deprecated-dropdown/dropdown.js.map +1 -1
  37. package/es/components/deprecated-input/input.js +6 -10
  38. package/es/components/deprecated-input/input.js.map +1 -1
  39. package/es/components/deprecated-select/select.js +7 -31
  40. package/es/components/deprecated-select/select.js.map +1 -1
  41. package/es/components/key-capturer/key-capturer.js +130 -171
  42. package/es/components/key-capturer/key-capturer.js.map +1 -1
  43. package/es/components/keyboard-shortcut/keyboard-shortcut.js +48 -79
  44. package/es/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
  45. package/es/components/progress-bar/progress-bar.js +8 -20
  46. package/es/components/progress-bar/progress-bar.js.map +1 -1
  47. package/es/components/time/time-utils.js +52 -64
  48. package/es/components/time/time-utils.js.map +1 -1
  49. package/es/components/time/time.js +90 -114
  50. package/es/components/time/time.js.map +1 -1
  51. package/es/divider/divider.js +4 -13
  52. package/es/divider/divider.js.map +1 -1
  53. package/es/heading/heading.js +19 -28
  54. package/es/heading/heading.js.map +1 -1
  55. package/es/hidden/hidden.js +36 -45
  56. package/es/hidden/hidden.js.map +1 -1
  57. package/es/hidden-visually/hidden-visually.js +7 -13
  58. package/es/hidden-visually/hidden-visually.js.map +1 -1
  59. package/es/icons/alert-icon.js +18 -64
  60. package/es/icons/alert-icon.js.map +1 -1
  61. package/es/icons/banner-icon.js +25 -97
  62. package/es/icons/banner-icon.js.map +1 -1
  63. package/es/icons/close-icon.js +3 -9
  64. package/es/icons/close-icon.js.map +1 -1
  65. package/es/icons/password-hidden-icon.js +6 -23
  66. package/es/icons/password-hidden-icon.js.map +1 -1
  67. package/es/icons/password-visible-icon.js +5 -16
  68. package/es/icons/password-visible-icon.js.map +1 -1
  69. package/es/inline/inline.js +8 -23
  70. package/es/inline/inline.js.map +1 -1
  71. package/es/loading/loading.js +17 -28
  72. package/es/loading/loading.js.map +1 -1
  73. package/es/menu/menu.js +127 -260
  74. package/es/menu/menu.js.map +1 -1
  75. package/es/modal/modal.js +143 -272
  76. package/es/modal/modal.js.map +1 -1
  77. package/es/modal/modal.module.css.js +1 -1
  78. package/es/notice/notice.js +8 -21
  79. package/es/notice/notice.js.map +1 -1
  80. package/es/notice/notice.module.css.js +1 -1
  81. package/es/password-field/password-field.js +10 -24
  82. package/es/password-field/password-field.js.map +1 -1
  83. package/es/prose/prose.js +10 -15
  84. package/es/prose/prose.js.map +1 -1
  85. package/es/select-field/select-field.js +14 -51
  86. package/es/select-field/select-field.js.map +1 -1
  87. package/es/spinner/spinner.js +6 -20
  88. package/es/spinner/spinner.js.map +1 -1
  89. package/es/stack/stack.js +15 -27
  90. package/es/stack/stack.js.map +1 -1
  91. package/es/switch-field/switch-field.js +38 -73
  92. package/es/switch-field/switch-field.js.map +1 -1
  93. package/es/switch-field/switch-field.module.css.js +1 -1
  94. package/es/tabs/tabs.js +120 -207
  95. package/es/tabs/tabs.js.map +1 -1
  96. package/es/text/text.js +16 -25
  97. package/es/text/text.js.map +1 -1
  98. package/es/text-area/text-area.js +54 -111
  99. package/es/text-area/text-area.js.map +1 -1
  100. package/es/text-field/text-field.js +30 -84
  101. package/es/text-field/text-field.js.map +1 -1
  102. package/es/text-link/text-link.js +9 -20
  103. package/es/text-link/text-link.js.map +1 -1
  104. package/es/text-link/text-link.module.css.js +1 -1
  105. package/es/toast/static-toast.js +35 -70
  106. package/es/toast/static-toast.js.map +1 -1
  107. package/es/toast/toast-animation.js +121 -159
  108. package/es/toast/toast-animation.js.map +1 -1
  109. package/es/toast/use-toasts.js +134 -197
  110. package/es/toast/use-toasts.js.map +1 -1
  111. package/es/tooltip/tooltip.js +31 -69
  112. package/es/tooltip/tooltip.js.map +1 -1
  113. package/es/utils/common-helpers.js +9 -13
  114. package/es/utils/common-helpers.js.map +1 -1
  115. package/es/utils/polymorphism.js +7 -8
  116. package/es/utils/polymorphism.js.map +1 -1
  117. package/es/utils/responsive-props.js +57 -66
  118. package/es/utils/responsive-props.js.map +1 -1
  119. package/lib/avatar/avatar.d.ts +21 -21
  120. package/lib/avatar/avatar.js +69 -1
  121. package/lib/avatar/avatar.js.map +1 -1
  122. package/lib/avatar/avatar.module.css.js +7 -1
  123. package/lib/avatar/avatar.module.css.js.map +1 -1
  124. package/lib/avatar/index.d.ts +1 -1
  125. package/lib/avatar/utils.d.ts +3 -3
  126. package/lib/avatar/utils.js +30 -1
  127. package/lib/avatar/utils.js.map +1 -1
  128. package/lib/badge/badge.d.ts +15 -15
  129. package/lib/badge/badge.js +36 -1
  130. package/lib/badge/badge.js.map +1 -1
  131. package/lib/badge/badge.module.css.js +7 -1
  132. package/lib/badge/badge.module.css.js.map +1 -1
  133. package/lib/badge/index.d.ts +1 -1
  134. package/lib/banner/banner.d.ts +87 -87
  135. package/lib/banner/banner.js +79 -1
  136. package/lib/banner/banner.js.map +1 -1
  137. package/lib/banner/banner.module.css.js +7 -1
  138. package/lib/banner/banner.module.css.js.map +1 -1
  139. package/lib/banner/index.d.ts +2 -2
  140. package/lib/banner/story-promo-image.d.ts +4 -4
  141. package/lib/base-field/base-field.d.ts +139 -139
  142. package/lib/base-field/base-field.js +127 -1
  143. package/lib/base-field/base-field.js.map +1 -1
  144. package/lib/base-field/base-field.module.css.js +7 -1
  145. package/lib/base-field/base-field.module.css.js.map +1 -1
  146. package/lib/base-field/index.d.ts +1 -1
  147. package/lib/box/box.d.ts +73 -73
  148. package/lib/box/box.js +103 -1
  149. package/lib/box/box.js.map +1 -1
  150. package/lib/box/box.module.css.js +7 -1
  151. package/lib/box/box.module.css.js.map +1 -1
  152. package/lib/box/gap.module.css.js +7 -1
  153. package/lib/box/gap.module.css.js.map +1 -1
  154. package/lib/box/index.d.ts +1 -1
  155. package/lib/box/margin.module.css.js +7 -1
  156. package/lib/box/margin.module.css.js.map +1 -1
  157. package/lib/box/padding.module.css.js +7 -1
  158. package/lib/box/padding.module.css.js.map +1 -1
  159. package/lib/box/width.module.css.js +7 -1
  160. package/lib/box/width.module.css.js.map +1 -1
  161. package/lib/button/button.d.ts +127 -127
  162. package/lib/button/button.js +86 -1
  163. package/lib/button/button.js.map +1 -1
  164. package/lib/button/button.module.css.js +7 -1
  165. package/lib/button/button.module.css.js.map +1 -1
  166. package/lib/button/index.d.ts +1 -1
  167. package/lib/checkbox-field/checkbox-field.d.ts +40 -40
  168. package/lib/checkbox-field/checkbox-field.js +82 -1
  169. package/lib/checkbox-field/checkbox-field.js.map +1 -1
  170. package/lib/checkbox-field/checkbox-field.module.css.js +7 -1
  171. package/lib/checkbox-field/checkbox-field.module.css.js.map +1 -1
  172. package/lib/checkbox-field/checkbox-icon.d.ts +8 -8
  173. package/lib/checkbox-field/checkbox-icon.js +59 -1
  174. package/lib/checkbox-field/checkbox-icon.js.map +1 -1
  175. package/lib/checkbox-field/index.d.ts +1 -1
  176. package/lib/checkbox-field/use-fork-ref.d.ts +11 -11
  177. package/lib/checkbox-field/use-fork-ref.js +42 -1
  178. package/lib/checkbox-field/use-fork-ref.js.map +1 -1
  179. package/lib/columns/columns.d.ts +20 -20
  180. package/lib/columns/columns.js +57 -1
  181. package/lib/columns/columns.js.map +1 -1
  182. package/lib/columns/columns.module.css.js +7 -1
  183. package/lib/columns/columns.module.css.js.map +1 -1
  184. package/lib/columns/index.d.ts +1 -1
  185. package/lib/components/color-picker/color-picker.d.ts +29 -29
  186. package/lib/components/color-picker/color-picker.js +86 -1
  187. package/lib/components/color-picker/color-picker.js.map +1 -1
  188. package/lib/components/color-picker/index.d.ts +3 -3
  189. package/lib/components/color-picker/index.js +11 -1
  190. package/lib/components/color-picker/index.js.map +1 -1
  191. package/lib/components/deprecated-button/deprecated-button.d.ts +54 -54
  192. package/lib/components/deprecated-button/deprecated-button.js +49 -1
  193. package/lib/components/deprecated-button/deprecated-button.js.map +1 -1
  194. package/lib/components/deprecated-button/index.d.ts +4 -4
  195. package/lib/components/deprecated-button/index.js +9 -1
  196. package/lib/components/deprecated-button/index.js.map +1 -1
  197. package/lib/components/deprecated-dropdown/dropdown.d.ts +55 -55
  198. package/lib/components/deprecated-dropdown/dropdown.js +182 -1
  199. package/lib/components/deprecated-dropdown/dropdown.js.map +1 -1
  200. package/lib/components/deprecated-dropdown/index.d.ts +2 -2
  201. package/lib/components/deprecated-dropdown/index.js +9 -1
  202. package/lib/components/deprecated-dropdown/index.js.map +1 -1
  203. package/lib/components/deprecated-input/index.d.ts +2 -2
  204. package/lib/components/deprecated-input/index.js +9 -1
  205. package/lib/components/deprecated-input/index.js.map +1 -1
  206. package/lib/components/deprecated-input/input.d.ts +10 -10
  207. package/lib/components/deprecated-input/input.js +41 -1
  208. package/lib/components/deprecated-input/input.js.map +1 -1
  209. package/lib/components/deprecated-select/index.d.ts +2 -2
  210. package/lib/components/deprecated-select/index.js +9 -1
  211. package/lib/components/deprecated-select/index.js.map +1 -1
  212. package/lib/components/deprecated-select/select.d.ts +33 -33
  213. package/lib/components/deprecated-select/select.js +43 -1
  214. package/lib/components/deprecated-select/select.js.map +1 -1
  215. package/lib/components/icons/CloseIcon.svg.d.ts +3 -3
  216. package/lib/components/icons/ThinQuestionMarkIcon.svg.d.ts +3 -3
  217. package/lib/components/icons/ThreeDotsIcon.svg.d.ts +12 -12
  218. package/lib/components/key-capturer/index.d.ts +3 -3
  219. package/lib/components/key-capturer/index.js +11 -1
  220. package/lib/components/key-capturer/index.js.map +1 -1
  221. package/lib/components/key-capturer/key-capturer.d.ts +40 -40
  222. package/lib/components/key-capturer/key-capturer.js +171 -1
  223. package/lib/components/key-capturer/key-capturer.js.map +1 -1
  224. package/lib/components/keyboard-shortcut/index.d.ts +2 -2
  225. package/lib/components/keyboard-shortcut/index.js +9 -1
  226. package/lib/components/keyboard-shortcut/index.js.map +1 -1
  227. package/lib/components/keyboard-shortcut/keyboard-shortcut.d.ts +44 -44
  228. package/lib/components/keyboard-shortcut/keyboard-shortcut.js +97 -1
  229. package/lib/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
  230. package/lib/components/progress-bar/index.d.ts +2 -2
  231. package/lib/components/progress-bar/index.js +9 -1
  232. package/lib/components/progress-bar/index.js.map +1 -1
  233. package/lib/components/progress-bar/progress-bar.d.ts +14 -14
  234. package/lib/components/progress-bar/progress-bar.js +44 -1
  235. package/lib/components/progress-bar/progress-bar.js.map +1 -1
  236. package/lib/components/progress-bar/progress-bar.module.css.js +7 -1
  237. package/lib/components/progress-bar/progress-bar.module.css.js.map +1 -1
  238. package/lib/components/time/index.d.ts +2 -2
  239. package/lib/components/time/index.js +9 -1
  240. package/lib/components/time/index.js.map +1 -1
  241. package/lib/components/time/time-utils.d.ts +19 -19
  242. package/lib/components/time/time-utils.js +69 -1
  243. package/lib/components/time/time-utils.js.map +1 -1
  244. package/lib/components/time/time.d.ts +39 -39
  245. package/lib/components/time/time.js +124 -1
  246. package/lib/components/time/time.js.map +1 -1
  247. package/lib/divider/divider.d.ts +8 -8
  248. package/lib/divider/divider.js +36 -1
  249. package/lib/divider/divider.js.map +1 -1
  250. package/lib/divider/divider.module.css.js +7 -1
  251. package/lib/divider/divider.module.css.js.map +1 -1
  252. package/lib/divider/index.d.ts +1 -1
  253. package/lib/heading/heading.d.ts +112 -112
  254. package/lib/heading/heading.js +51 -1
  255. package/lib/heading/heading.js.map +1 -1
  256. package/lib/heading/heading.module.css.js +7 -1
  257. package/lib/heading/heading.module.css.js.map +1 -1
  258. package/lib/heading/index.d.ts +1 -1
  259. package/lib/hidden/hidden.d.ts +49 -49
  260. package/lib/hidden/hidden.js +70 -1
  261. package/lib/hidden/hidden.js.map +1 -1
  262. package/lib/hidden/hidden.module.css.js +7 -1
  263. package/lib/hidden/hidden.module.css.js.map +1 -1
  264. package/lib/hidden/index.d.ts +1 -1
  265. package/lib/hidden-visually/hidden-visually.d.ts +11 -11
  266. package/lib/hidden-visually/hidden-visually.js +40 -1
  267. package/lib/hidden-visually/hidden-visually.js.map +1 -1
  268. package/lib/hidden-visually/hidden-visually.module.css.js +7 -1
  269. package/lib/hidden-visually/hidden-visually.module.css.js.map +1 -1
  270. package/lib/hidden-visually/index.d.ts +1 -1
  271. package/lib/hooks/use-previous/index.d.ts +1 -1
  272. package/lib/hooks/use-previous/use-previous.d.ts +15 -15
  273. package/lib/icons/alert-icon.d.ts +6 -6
  274. package/lib/icons/alert-icon.js +56 -1
  275. package/lib/icons/alert-icon.js.map +1 -1
  276. package/lib/icons/banner-icon.d.ts +6 -6
  277. package/lib/icons/banner-icon.js +68 -1
  278. package/lib/icons/banner-icon.js.map +1 -1
  279. package/lib/icons/banner-icon.module.css.js +7 -1
  280. package/lib/icons/banner-icon.module.css.js.map +1 -1
  281. package/lib/icons/close-icon.d.ts +3 -3
  282. package/lib/icons/close-icon.js +33 -1
  283. package/lib/icons/close-icon.js.map +1 -1
  284. package/lib/icons/password-hidden-icon.d.ts +3 -3
  285. package/lib/icons/password-hidden-icon.js +36 -1
  286. package/lib/icons/password-hidden-icon.js.map +1 -1
  287. package/lib/icons/password-visible-icon.d.ts +3 -3
  288. package/lib/icons/password-visible-icon.js +35 -1
  289. package/lib/icons/password-visible-icon.js.map +1 -1
  290. package/lib/index.d.ts +38 -38
  291. package/lib/index.js +106 -1
  292. package/lib/index.js.map +1 -1
  293. package/lib/inline/index.d.ts +1 -1
  294. package/lib/inline/inline.d.ts +12 -12
  295. package/lib/inline/inline.js +40 -1
  296. package/lib/inline/inline.js.map +1 -1
  297. package/lib/loading/index.d.ts +1 -1
  298. package/lib/loading/loading.d.ts +26 -26
  299. package/lib/loading/loading.js +49 -1
  300. package/lib/loading/loading.js.map +1 -1
  301. package/lib/menu/index.d.ts +2 -2
  302. package/lib/menu/menu.d.ts +128 -128
  303. package/lib/menu/menu.js +179 -1
  304. package/lib/menu/menu.js.map +1 -1
  305. package/lib/modal/index.d.ts +1 -1
  306. package/lib/modal/modal-stories-components.d.ts +47 -47
  307. package/lib/modal/modal.d.ts +185 -185
  308. package/lib/modal/modal.js +209 -1
  309. package/lib/modal/modal.js.map +1 -1
  310. package/lib/modal/modal.module.css.js +7 -1
  311. package/lib/modal/modal.module.css.js.map +1 -1
  312. package/lib/notice/index.d.ts +1 -1
  313. package/lib/notice/notice.d.ts +10 -10
  314. package/lib/notice/notice.js +42 -1
  315. package/lib/notice/notice.js.map +1 -1
  316. package/lib/notice/notice.module.css.js +7 -1
  317. package/lib/notice/notice.module.css.js.map +1 -1
  318. package/lib/password-field/index.d.ts +1 -1
  319. package/lib/password-field/password-field.d.ts +10 -10
  320. package/lib/password-field/password-field.js +43 -1
  321. package/lib/password-field/password-field.js.map +1 -1
  322. package/lib/prose/index.d.ts +2 -2
  323. package/lib/prose/prose-example.d.ts +1 -1
  324. package/lib/prose/prose.d.ts +44 -44
  325. package/lib/prose/prose.js +42 -1
  326. package/lib/prose/prose.js.map +1 -1
  327. package/lib/prose/prose.module.css.js +7 -1
  328. package/lib/prose/prose.module.css.js.map +1 -1
  329. package/lib/select-field/index.d.ts +1 -1
  330. package/lib/select-field/select-field.d.ts +7 -7
  331. package/lib/select-field/select-field.js +48 -1
  332. package/lib/select-field/select-field.js.map +1 -1
  333. package/lib/select-field/select-field.module.css.js +7 -1
  334. package/lib/select-field/select-field.module.css.js.map +1 -1
  335. package/lib/spinner/index.d.ts +1 -1
  336. package/lib/spinner/spinner.d.ts +5 -5
  337. package/lib/spinner/spinner.js +36 -1
  338. package/lib/spinner/spinner.js.map +1 -1
  339. package/lib/spinner/spinner.module.css.js +7 -1
  340. package/lib/spinner/spinner.module.css.js.map +1 -1
  341. package/lib/stack/index.d.ts +1 -1
  342. package/lib/stack/stack.d.ts +15 -15
  343. package/lib/stack/stack.js +52 -1
  344. package/lib/stack/stack.js.map +1 -1
  345. package/lib/switch-field/index.d.ts +1 -1
  346. package/lib/switch-field/switch-field.d.ts +19 -19
  347. package/lib/switch-field/switch-field.js +74 -1
  348. package/lib/switch-field/switch-field.js.map +1 -1
  349. package/lib/switch-field/switch-field.module.css.js +7 -1
  350. package/lib/switch-field/switch-field.module.css.js.map +1 -1
  351. package/lib/tabs/index.d.ts +1 -1
  352. package/lib/tabs/tabs.d.ts +125 -125
  353. package/lib/tabs/tabs.js +177 -1
  354. package/lib/tabs/tabs.js.map +1 -1
  355. package/lib/tabs/tabs.module.css.js +7 -1
  356. package/lib/tabs/tabs.module.css.js.map +1 -1
  357. package/lib/text/index.d.ts +1 -1
  358. package/lib/text/text.d.ts +47 -47
  359. package/lib/text/text.js +49 -1
  360. package/lib/text/text.js.map +1 -1
  361. package/lib/text/text.module.css.js +7 -1
  362. package/lib/text/text.module.css.js.map +1 -1
  363. package/lib/text-area/index.d.ts +1 -1
  364. package/lib/text-area/text-area.d.ts +39 -39
  365. package/lib/text-area/text-area.js +92 -1
  366. package/lib/text-area/text-area.js.map +1 -1
  367. package/lib/text-area/text-area.module.css.js +7 -1
  368. package/lib/text-area/text-area.module.css.js.map +1 -1
  369. package/lib/text-field/index.d.ts +1 -1
  370. package/lib/text-field/text-field.d.ts +18 -18
  371. package/lib/text-field/text-field.js +63 -1
  372. package/lib/text-field/text-field.js.map +1 -1
  373. package/lib/text-field/text-field.module.css.js +7 -1
  374. package/lib/text-field/text-field.module.css.js.map +1 -1
  375. package/lib/text-link/index.d.ts +1 -1
  376. package/lib/text-link/text-link.d.ts +9 -9
  377. package/lib/text-link/text-link.js +41 -1
  378. package/lib/text-link/text-link.js.map +1 -1
  379. package/lib/text-link/text-link.module.css.js +7 -1
  380. package/lib/text-link/text-link.module.css.js.map +1 -1
  381. package/lib/toast/index.d.ts +4 -4
  382. package/lib/toast/static-toast.d.ts +63 -63
  383. package/lib/toast/static-toast.js +59 -1
  384. package/lib/toast/static-toast.js.map +1 -1
  385. package/lib/toast/toast-animation.d.ts +50 -50
  386. package/lib/toast/toast-animation.js +141 -1
  387. package/lib/toast/toast-animation.js.map +1 -1
  388. package/lib/toast/toast.module.css.js +7 -1
  389. package/lib/toast/toast.module.css.js.map +1 -1
  390. package/lib/toast/use-toasts.d.ts +132 -132
  391. package/lib/toast/use-toasts.js +166 -1
  392. package/lib/toast/use-toasts.js.map +1 -1
  393. package/lib/tooltip/index.d.ts +2 -2
  394. package/lib/tooltip/tooltip.d.ts +72 -72
  395. package/lib/tooltip/tooltip.js +67 -1
  396. package/lib/tooltip/tooltip.js.map +1 -1
  397. package/lib/tooltip/tooltip.module.css.js +7 -1
  398. package/lib/tooltip/tooltip.module.css.js.map +1 -1
  399. package/lib/utils/common-helpers.d.ts +2 -2
  400. package/lib/utils/common-helpers.js +44 -1
  401. package/lib/utils/common-helpers.js.map +1 -1
  402. package/lib/utils/common-types.d.ts +42 -42
  403. package/lib/utils/polymorphism.d.ts +135 -135
  404. package/lib/utils/polymorphism.js +39 -1
  405. package/lib/utils/polymorphism.js.map +1 -1
  406. package/lib/utils/responsive-props.d.ts +44 -44
  407. package/lib/utils/responsive-props.js +70 -1
  408. package/lib/utils/responsive-props.js.map +1 -1
  409. package/lib/utils/storybook-helper.d.ts +55 -0
  410. package/lib/utils/test-helpers.d.ts +22 -22
  411. package/package.json +14 -18
  412. package/styles/avatar.css +2 -2
  413. package/styles/avatar.module.css.css +1 -1
  414. package/styles/badge.css +2 -2
  415. package/styles/badge.module.css.css +1 -1
  416. package/styles/banner.css +6 -6
  417. package/styles/banner.module.css.css +1 -1
  418. package/styles/base-field.css +4 -4
  419. package/styles/base-field.module.css.css +1 -1
  420. package/styles/box.css +1 -1
  421. package/styles/box.module.css.css +1 -1
  422. package/styles/button.css +4 -4
  423. package/styles/button.module.css.css +1 -1
  424. package/styles/checkbox-field.css +3 -3
  425. package/styles/checkbox-field.module.css.css +1 -1
  426. package/styles/columns.css +1 -1
  427. package/styles/divider.css +1 -1
  428. package/styles/heading.css +2 -2
  429. package/styles/heading.module.css.css +1 -1
  430. package/styles/hidden-visually.css +2 -2
  431. package/styles/hidden-visually.module.css.css +1 -1
  432. package/styles/hidden.css +1 -1
  433. package/styles/index.css +4 -4
  434. package/styles/loading.css +2 -2
  435. package/styles/menu.css +1 -1
  436. package/styles/modal.css +5 -5
  437. package/styles/modal.module.css.css +1 -1
  438. package/styles/notice.css +1 -1
  439. package/styles/password-field.css +7 -7
  440. package/styles/progress-bar.module.css.css +1 -1
  441. package/styles/prose.css +2 -2
  442. package/styles/prose.module.css.css +1 -1
  443. package/styles/reactist.css +30 -30
  444. package/styles/select-field.css +5 -5
  445. package/styles/select-field.module.css.css +1 -1
  446. package/styles/spinner.css +1 -1
  447. package/styles/static-toast.css +6 -6
  448. package/styles/switch-field.css +6 -6
  449. package/styles/switch-field.module.css.css +1 -1
  450. package/styles/tabs.css +2 -2
  451. package/styles/tabs.module.css.css +1 -1
  452. package/styles/text-area.css +5 -5
  453. package/styles/text-area.module.css.css +1 -1
  454. package/styles/text-field.css +5 -5
  455. package/styles/text-field.module.css.css +1 -1
  456. package/styles/text-link.css +2 -2
  457. package/styles/text-link.module.css.css +1 -1
  458. package/styles/text.css +2 -2
  459. package/styles/text.module.css.css +1 -1
  460. package/styles/toast.module.css.css +1 -1
  461. package/styles/tooltip.css +2 -2
  462. package/styles/tooltip.module.css.css +1 -1
  463. package/styles/use-toasts.css +6 -6
  464. package/es/_virtual/_rollupPluginBabelHelpers.js +0 -91
  465. package/es/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  466. package/lib/_virtual/_rollupPluginBabelHelpers.js +0 -2
  467. package/lib/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
@@ -1,185 +1,185 @@
1
- import * as React from 'react';
2
- import { DialogOptions, PortalOptions } from '@ariakit/react';
3
- import { IconButtonProps } from '../button';
4
- import type { ObfuscatedClassName } from '../utils/common-types';
5
- import type { DividerProps } from '../divider';
6
- type ModalWidth = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'full';
7
- type ModalHeightMode = 'expand' | 'fitContent';
8
- type DivProps = Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'className' | 'children' | `aria-label` | `aria-labelledby`>;
9
- export interface ModalProps extends DivProps, ObfuscatedClassName {
10
- /**
11
- * The content of the modal.
12
- */
13
- children: React.ReactNode;
14
- /**
15
- * Whether the modal is open and visible or not.
16
- */
17
- isOpen: boolean;
18
- /**
19
- * Called when the user triggers closing the modal.
20
- */
21
- onDismiss?(): void;
22
- /**
23
- * A descriptive setting for how wide the modal should aim to be, depending on how much space
24
- * it has on screen.
25
- * @default 'medium'
26
- */
27
- width?: ModalWidth;
28
- /**
29
- * A descriptive setting for how tall the modal should aim to be.
30
- *
31
- * - 'expand': the modal aims to fill most of the available screen height, leaving only a small
32
- * padding above and below.
33
- * - 'fitContent': the modal shrinks to the smallest size that allow it to fit its content.
34
- *
35
- * In either case, if content does not fit, the content of the main body is set to scroll
36
- * (provided you use `ModalBody`) so that the modal never has to strech vertically beyond the
37
- * viewport boundaries.
38
- *
39
- * If you do not use `ModalBody`, the modal still prevents overflow, and you are in charge of
40
- * the inner layout to ensure scroll, or whatever other strategy you may want.
41
- */
42
- height?: ModalHeightMode;
43
- /**
44
- * The weight to apply to all dividers rendered inside the modal.
45
- */
46
- dividers?: DividerProps['weight'];
47
- /**
48
- * Whether to set or not the focus initially to the first focusable element inside the modal.
49
- */
50
- autoFocus?: boolean;
51
- /**
52
- * Controls if the modal is dismissed when pressing "Escape".
53
- */
54
- hideOnEscape?: DialogOptions['hideOnEscape'];
55
- /**
56
- * Controls if the modal is dismissed when clicking outside the modal body, on the overlay.
57
- */
58
- hideOnInteractOutside?: DialogOptions['hideOnInteractOutside'];
59
- /**
60
- * An escape hatch in case you need to provide a custom class name to the overlay element.
61
- */
62
- exceptionallySetOverlayClassName?: string;
63
- /**
64
- * Defines a string value that labels the current modal for assistive technologies.
65
- */
66
- 'aria-label'?: string;
67
- /**
68
- * Identifies the element (or elements) that labels the current modal for assistive technologies.
69
- */
70
- 'aria-labelledby'?: string;
71
- /**
72
- * An HTML element or a memoized callback function that returns an HTML element to be used as
73
- * the portal element. By default, the portal element will be a `div` element appended to the
74
- * `document.body`.
75
- *
76
- * @default HTMLDivElement
77
- *
78
- * @example
79
- * const [portal, setPortal] = useState(null);
80
- * <Portal portalElement={portal} />;
81
- * <div ref={setPortal} />;
82
- *
83
- * @example
84
- * const getPortalElement = useCallback(() => {
85
- * const div = document.createElement("div");
86
- * const portalRoot = document.getElementById("portal-root");
87
- * portalRoot.appendChild(div);
88
- * return div;
89
- * }, []);
90
- * <Portal portalElement={getPortalElement} />;
91
- */
92
- portalElement?: PortalOptions['portalElement'];
93
- }
94
- /**
95
- * Renders a modal that sits on top of the rest of the content in the entire page.
96
- *
97
- * Follows the WAI-ARIA Dialog (Modal) Pattern.
98
- *
99
- * @see ModalHeader
100
- * @see ModalFooter
101
- * @see ModalBody
102
- */
103
- export declare function Modal({ isOpen, onDismiss, height, dividers, width, exceptionallySetClassName, exceptionallySetOverlayClassName, autoFocus, hideOnEscape, hideOnInteractOutside, children, portalElement, onKeyDown, className, ...props }: ModalProps): React.JSX.Element | null;
104
- export interface ModalCloseButtonProps extends Omit<IconButtonProps, 'type' | 'variant' | 'icon' | 'disabled' | 'loading' | 'tabIndex' | 'ref'> {
105
- /**
106
- * The descriptive label of the button.
107
- */
108
- 'aria-label': string;
109
- }
110
- /**
111
- * The close button rendered by ModalHeader. Provided independently so that consumers can customize
112
- * the button's label.
113
- *
114
- * @see ModalHeader
115
- */
116
- export declare function ModalCloseButton(props: ModalCloseButtonProps): React.JSX.Element;
117
- export interface ModalHeaderProps extends DivProps, ObfuscatedClassName {
118
- /**
119
- * The content of the header.
120
- */
121
- children: React.ReactNode;
122
- /**
123
- * Allows to provide a custom button element, or to omit the close button if set to false.
124
- * @see ModalCloseButton
125
- */
126
- button?: React.ReactNode | boolean;
127
- /**
128
- * Whether to render a divider line below the header.
129
- * @default false
130
- */
131
- withDivider?: boolean;
132
- }
133
- /**
134
- * Renders a standard modal header area with an optional close button.
135
- *
136
- * @see Modal
137
- * @see ModalFooter
138
- * @see ModalBody
139
- */
140
- export declare function ModalHeader({ children, button, withDivider, exceptionallySetClassName, ...props }: ModalHeaderProps): React.JSX.Element;
141
- export interface ModalBodyProps extends DivProps, ObfuscatedClassName {
142
- /**
143
- * The content of the modal body.
144
- */
145
- children: React.ReactNode;
146
- }
147
- /**
148
- * Renders the body of a modal.
149
- *
150
- * Convenient to use alongside ModalHeader and/or ModalFooter as needed. It ensures, among other
151
- * things, that the content of the modal body expands or contracts depending on the modal height
152
- * setting or the size of the content. The body content also automatically scrolls when it's too
153
- * large to fit the available space.
154
- *
155
- * @see Modal
156
- * @see ModalHeader
157
- * @see ModalFooter
158
- */
159
- export declare const ModalBody: React.ForwardRefExoticComponent<Omit<ModalBodyProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
160
- export interface ModalFooterProps extends DivProps, ObfuscatedClassName {
161
- /**
162
- * The contant of the modal footer.
163
- */
164
- children: React.ReactNode;
165
- /**
166
- * Whether to render a divider line below the footer.
167
- * @default false
168
- */
169
- withDivider?: boolean;
170
- }
171
- /**
172
- * Renders a standard modal footer area.
173
- *
174
- * @see Modal
175
- * @see ModalHeader
176
- * @see ModalBody
177
- */
178
- export declare function ModalFooter({ exceptionallySetClassName, withDivider, ...props }: ModalFooterProps): React.JSX.Element;
179
- export type ModalActionsProps = ModalFooterProps;
180
- /**
181
- * A specific version of the ModalFooter, tailored to showing an inline list of actions (buttons).
182
- * @see ModalFooter
183
- */
184
- export declare function ModalActions({ children, ...props }: ModalActionsProps): React.JSX.Element;
185
- export {};
1
+ import * as React from 'react';
2
+ import { DialogOptions, PortalOptions } from '@ariakit/react';
3
+ import { IconButtonProps } from '../button';
4
+ import type { ObfuscatedClassName } from '../utils/common-types';
5
+ import type { DividerProps } from '../divider';
6
+ type ModalWidth = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'full';
7
+ type ModalHeightMode = 'expand' | 'fitContent';
8
+ type DivProps = Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'className' | 'children' | `aria-label` | `aria-labelledby`>;
9
+ export interface ModalProps extends DivProps, ObfuscatedClassName {
10
+ /**
11
+ * The content of the modal.
12
+ */
13
+ children: React.ReactNode;
14
+ /**
15
+ * Whether the modal is open and visible or not.
16
+ */
17
+ isOpen: boolean;
18
+ /**
19
+ * Called when the user triggers closing the modal.
20
+ */
21
+ onDismiss?(): void;
22
+ /**
23
+ * A descriptive setting for how wide the modal should aim to be, depending on how much space
24
+ * it has on screen.
25
+ * @default 'medium'
26
+ */
27
+ width?: ModalWidth;
28
+ /**
29
+ * A descriptive setting for how tall the modal should aim to be.
30
+ *
31
+ * - 'expand': the modal aims to fill most of the available screen height, leaving only a small
32
+ * padding above and below.
33
+ * - 'fitContent': the modal shrinks to the smallest size that allow it to fit its content.
34
+ *
35
+ * In either case, if content does not fit, the content of the main body is set to scroll
36
+ * (provided you use `ModalBody`) so that the modal never has to strech vertically beyond the
37
+ * viewport boundaries.
38
+ *
39
+ * If you do not use `ModalBody`, the modal still prevents overflow, and you are in charge of
40
+ * the inner layout to ensure scroll, or whatever other strategy you may want.
41
+ */
42
+ height?: ModalHeightMode;
43
+ /**
44
+ * The weight to apply to all dividers rendered inside the modal.
45
+ */
46
+ dividers?: DividerProps['weight'];
47
+ /**
48
+ * Whether to set or not the focus initially to the first focusable element inside the modal.
49
+ */
50
+ autoFocus?: boolean;
51
+ /**
52
+ * Controls if the modal is dismissed when pressing "Escape".
53
+ */
54
+ hideOnEscape?: DialogOptions['hideOnEscape'];
55
+ /**
56
+ * Controls if the modal is dismissed when clicking outside the modal body, on the overlay.
57
+ */
58
+ hideOnInteractOutside?: DialogOptions['hideOnInteractOutside'];
59
+ /**
60
+ * An escape hatch in case you need to provide a custom class name to the overlay element.
61
+ */
62
+ exceptionallySetOverlayClassName?: string;
63
+ /**
64
+ * Defines a string value that labels the current modal for assistive technologies.
65
+ */
66
+ 'aria-label'?: string;
67
+ /**
68
+ * Identifies the element (or elements) that labels the current modal for assistive technologies.
69
+ */
70
+ 'aria-labelledby'?: string;
71
+ /**
72
+ * An HTML element or a memoized callback function that returns an HTML element to be used as
73
+ * the portal element. By default, the portal element will be a `div` element appended to the
74
+ * `document.body`.
75
+ *
76
+ * @default HTMLDivElement
77
+ *
78
+ * @example
79
+ * const [portal, setPortal] = useState(null);
80
+ * <Portal portalElement={portal} />;
81
+ * <div ref={setPortal} />;
82
+ *
83
+ * @example
84
+ * const getPortalElement = useCallback(() => {
85
+ * const div = document.createElement("div");
86
+ * const portalRoot = document.getElementById("portal-root");
87
+ * portalRoot.appendChild(div);
88
+ * return div;
89
+ * }, []);
90
+ * <Portal portalElement={getPortalElement} />;
91
+ */
92
+ portalElement?: PortalOptions['portalElement'];
93
+ }
94
+ /**
95
+ * Renders a modal that sits on top of the rest of the content in the entire page.
96
+ *
97
+ * Follows the WAI-ARIA Dialog (Modal) Pattern.
98
+ *
99
+ * @see ModalHeader
100
+ * @see ModalFooter
101
+ * @see ModalBody
102
+ */
103
+ export declare function Modal({ isOpen, onDismiss, height, dividers, width, exceptionallySetClassName, exceptionallySetOverlayClassName, autoFocus, hideOnEscape, hideOnInteractOutside, children, portalElement, onKeyDown, className, ...props }: ModalProps): React.JSX.Element | null;
104
+ export interface ModalCloseButtonProps extends Omit<IconButtonProps, 'type' | 'variant' | 'icon' | 'disabled' | 'loading' | 'tabIndex' | 'ref'> {
105
+ /**
106
+ * The descriptive label of the button.
107
+ */
108
+ 'aria-label': string;
109
+ }
110
+ /**
111
+ * The close button rendered by ModalHeader. Provided independently so that consumers can customize
112
+ * the button's label.
113
+ *
114
+ * @see ModalHeader
115
+ */
116
+ export declare function ModalCloseButton(props: ModalCloseButtonProps): React.JSX.Element;
117
+ export interface ModalHeaderProps extends DivProps, ObfuscatedClassName {
118
+ /**
119
+ * The content of the header.
120
+ */
121
+ children: React.ReactNode;
122
+ /**
123
+ * Allows to provide a custom button element, or to omit the close button if set to false.
124
+ * @see ModalCloseButton
125
+ */
126
+ button?: React.ReactNode | boolean;
127
+ /**
128
+ * Whether to render a divider line below the header.
129
+ * @default false
130
+ */
131
+ withDivider?: boolean;
132
+ }
133
+ /**
134
+ * Renders a standard modal header area with an optional close button.
135
+ *
136
+ * @see Modal
137
+ * @see ModalFooter
138
+ * @see ModalBody
139
+ */
140
+ export declare function ModalHeader({ children, button, withDivider, exceptionallySetClassName, ...props }: ModalHeaderProps): React.JSX.Element;
141
+ export interface ModalBodyProps extends DivProps, ObfuscatedClassName {
142
+ /**
143
+ * The content of the modal body.
144
+ */
145
+ children: React.ReactNode;
146
+ }
147
+ /**
148
+ * Renders the body of a modal.
149
+ *
150
+ * Convenient to use alongside ModalHeader and/or ModalFooter as needed. It ensures, among other
151
+ * things, that the content of the modal body expands or contracts depending on the modal height
152
+ * setting or the size of the content. The body content also automatically scrolls when it's too
153
+ * large to fit the available space.
154
+ *
155
+ * @see Modal
156
+ * @see ModalHeader
157
+ * @see ModalFooter
158
+ */
159
+ export declare const ModalBody: React.ForwardRefExoticComponent<Omit<ModalBodyProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
160
+ export interface ModalFooterProps extends DivProps, ObfuscatedClassName {
161
+ /**
162
+ * The contant of the modal footer.
163
+ */
164
+ children: React.ReactNode;
165
+ /**
166
+ * Whether to render a divider line below the footer.
167
+ * @default false
168
+ */
169
+ withDivider?: boolean;
170
+ }
171
+ /**
172
+ * Renders a standard modal footer area.
173
+ *
174
+ * @see Modal
175
+ * @see ModalHeader
176
+ * @see ModalBody
177
+ */
178
+ export declare function ModalFooter({ exceptionallySetClassName, withDivider, ...props }: ModalFooterProps): React.JSX.Element;
179
+ export type ModalActionsProps = ModalFooterProps;
180
+ /**
181
+ * A specific version of the ModalFooter, tailored to showing an inline list of actions (buttons).
182
+ * @see ModalFooter
183
+ */
184
+ export declare function ModalActions({ children, ...props }: ModalActionsProps): React.JSX.Element;
185
+ export {};
@@ -1,2 +1,210 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../_virtual/_rollupPluginBabelHelpers.js"),t=require("react"),n=require("classnames"),a=require("react-focus-lock"),r=require("aria-hidden"),o=require("@ariakit/react"),l=require("../icons/close-icon.js"),i=require("../columns/columns.js"),s=require("../inline/inline.js"),c=require("../divider/divider.js"),u=require("../box/box.js"),d=require("../button/button.js"),m=require("./modal.module.css.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function f(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,t}var h=f(t),x=p(n),b=p(a);const g=["isOpen","onDismiss","height","dividers","width","exceptionallySetClassName","exceptionallySetOverlayClassName","autoFocus","hideOnEscape","hideOnInteractOutside","children","portalElement","onKeyDown","className"],v=["children","button","withDivider","exceptionallySetClassName"],E=["exceptionallySetClassName","children"],y=["exceptionallySetClassName","withDivider"],C=["children"],j=h.createContext({onDismiss:void 0,height:"fitContent",dividers:void 0});function S(e){return!(e.ownerDocument===document&&"iframe"===e.tagName.toLowerCase())}function w(t){const{onDismiss:n}=h.useContext(j),[a,r]=h.useState(!1),[o,i]=h.useState(!1);return h.useEffect((function(){o?r(!0):i(!0)}),[o]),h.createElement(d.IconButton,e.objectSpread2(e.objectSpread2({},t),{},{variant:"quaternary",onClick:n,icon:h.createElement(l.CloseIcon,null),tabIndex:a?0:-1}))}const O=t.forwardRef((function(t,n){let{exceptionallySetClassName:a,children:r}=t,o=e.objectWithoutProperties(t,E);const{height:l}=h.useContext(j);return h.createElement(u.Box,e.objectSpread2(e.objectSpread2({},o),{},{ref:n,className:a,flexGrow:"expand"===l?1:0,height:"expand"===l?"full":void 0,overflow:"auto"}),h.createElement(u.Box,{padding:"large",paddingBottom:"xxlarge"},r))}));function D(t){let{exceptionallySetClassName:n,withDivider:a=!1}=t,r=e.objectWithoutProperties(t,y);const{dividers:o}=h.useContext(j);return h.createElement(h.Fragment,null,a?h.createElement(c.Divider,{weight:o}):null,h.createElement(u.Box,e.objectSpread2(e.objectSpread2({as:"footer"},r),{},{className:n,padding:"large"})))}exports.Modal=function(t){let{isOpen:n,onDismiss:a,height:l="fitContent",dividers:i,width:s="medium",exceptionallySetClassName:c,exceptionallySetOverlayClassName:d,autoFocus:p=!0,hideOnEscape:f=!0,hideOnInteractOutside:v=!0,children:E,portalElement:y,onKeyDown:C}=t,w=e.objectWithoutProperties(t,g);const O=h.useCallback(e=>{e||null==a||a()},[a]),D=o.useDialogStore({open:n,setOpen:O}),N=h.useMemo(()=>({onDismiss:a,height:l,dividers:i}),[a,l,i]),P=h.useRef(null),q=h.useRef(null),B=h.useRef(null),F=h.useCallback(e=>{var t,n;null!=(t=q.current)&&t.contains(e.target)||null==(n=B.current)||!n.contains(e.target)||(e.stopPropagation(),null==a||a())},[a]);h.useLayoutEffect((function(){if(n&&P.current)return r.hideOthers(P.current)}),[n]);const k=h.useCallback((function(e){f&&null!=a&&"Escape"===e.key&&!e.defaultPrevented&&(e.stopPropagation(),a()),null==C||C(e)}),[a,f,C]);return n?h.createElement(o.Portal,{portalRef:P,portalElement:y},h.createElement(u.Box,{"data-testid":"modal-overlay","data-overlay":!0,className:x.default(m.default.overlay,m.default[l],m.default[s],d),onPointerDown:v?F:void 0,ref:B},h.createElement(b.default,{autoFocus:p,whiteList:S,returnFocus:!0,crossFrame:!1},h.createElement(o.Dialog,e.objectSpread2(e.objectSpread2({},w),{},{ref:q,render:h.createElement(u.Box,{borderRadius:"full",background:"default",display:"flex",flexDirection:"column",overflow:"hidden",height:"expand"===l?"full":void 0,flexGrow:"expand"===l?1:0}),className:x.default(c,m.default.container),store:D,preventBodyScroll:!0,modal:!1,autoFocus:!1,autoFocusOnShow:!1,autoFocusOnHide:!1,portal:!1,backdrop:!1,hideOnInteractOutside:!1,hideOnEscape:!1,onKeyDown:k}),h.createElement(j.Provider,{value:N},E))))):null},exports.ModalActions=function(t){let{children:n}=t,a=e.objectWithoutProperties(t,C);return h.createElement(D,e.objectSpread2({},a),h.createElement(s.Inline,{align:"right",space:"large"},n))},exports.ModalBody=O,exports.ModalCloseButton=w,exports.ModalFooter=D,exports.ModalHeader=function(t){let{children:n,button:a=!0,withDivider:r=!1,exceptionallySetClassName:o}=t,l=e.objectWithoutProperties(t,v);const{dividers:s}=h.useContext(j);return h.createElement(h.Fragment,null,h.createElement(u.Box,e.objectSpread2(e.objectSpread2({},l),{},{as:"header",paddingLeft:"large",paddingRight:!1===a||null===a?"large":"small",paddingY:"small",className:o}),h.createElement(i.Columns,{space:"large",alignY:"center"},h.createElement(i.Column,{width:"auto"},n),!1===a||null===a?h.createElement("div",{className:m.default.headerContent}):h.createElement(i.Column,{width:"content",exceptionallySetClassName:m.default.buttonContainer,"data-testid":"button-container"},"boolean"==typeof a?h.createElement(w,{"aria-label":"Close modal",autoFocus:!1}):a))),r?h.createElement(c.Divider,{weight:s}):null)};
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var React = require('react');
7
+ var classNames = require('classnames');
8
+ var FocusLock = require('react-focus-lock');
9
+ var ariaHidden = require('aria-hidden');
10
+ var react = require('@ariakit/react');
11
+ var closeIcon = require('../icons/close-icon.js');
12
+ var columns = require('../columns/columns.js');
13
+ var inline = require('../inline/inline.js');
14
+ var divider = require('../divider/divider.js');
15
+ var box = require('../box/box.js');
16
+ var button = require('../button/button.js');
17
+ var modal_module = require('./modal.module.css.js');
18
+
19
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
+
21
+ function _interopNamespace(e) {
22
+ if (e && e.__esModule) return e;
23
+ var n = Object.create(null);
24
+ if (e) {
25
+ Object.keys(e).forEach(function (k) {
26
+ if (k !== 'default') {
27
+ var d = Object.getOwnPropertyDescriptor(e, k);
28
+ Object.defineProperty(n, k, d.get ? d : {
29
+ enumerable: true,
30
+ get: function () { return e[k]; }
31
+ });
32
+ }
33
+ });
34
+ }
35
+ n["default"] = e;
36
+ return Object.freeze(n);
37
+ }
38
+
39
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
40
+ var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
41
+ var FocusLock__default = /*#__PURE__*/_interopDefaultLegacy(FocusLock);
42
+
43
+ var ModalContext = React__namespace.createContext({
44
+ onDismiss: undefined,
45
+ height: 'fitContent',
46
+ dividers: undefined
47
+ });
48
+ function isNotInternalFrame(element) {
49
+ return !(element.ownerDocument === document && element.tagName.toLowerCase() === 'iframe');
50
+ }
51
+ /**
52
+ * Renders a modal that sits on top of the rest of the content in the entire page.
53
+ *
54
+ * Follows the WAI-ARIA Dialog (Modal) Pattern.
55
+ *
56
+ * @see ModalHeader
57
+ * @see ModalFooter
58
+ * @see ModalBody
59
+ */
60
+ function Modal(_a) {
61
+ var isOpen = _a.isOpen, onDismiss = _a.onDismiss, _b = _a.height, height = _b === void 0 ? 'fitContent' : _b, dividers = _a.dividers, _c = _a.width, width = _c === void 0 ? 'medium' : _c, exceptionallySetClassName = _a.exceptionallySetClassName, exceptionallySetOverlayClassName = _a.exceptionallySetOverlayClassName, _d = _a.autoFocus, autoFocus = _d === void 0 ? true : _d, _e = _a.hideOnEscape, hideOnEscape = _e === void 0 ? true : _e, _f = _a.hideOnInteractOutside, hideOnInteractOutside = _f === void 0 ? true : _f, children = _a.children, portalElement = _a.portalElement, onKeyDown = _a.onKeyDown;
62
+ // @ts-expect-error we want to make sure to not pass it to the Dialog component
63
+ _a.className; var props = tslib.__rest(_a, ["isOpen", "onDismiss", "height", "dividers", "width", "exceptionallySetClassName", "exceptionallySetOverlayClassName", "autoFocus", "hideOnEscape", "hideOnInteractOutside", "children", "portalElement", "onKeyDown", "className"]);
64
+ var setOpen = React__namespace.useCallback(function (visible) {
65
+ if (!visible) {
66
+ onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
67
+ }
68
+ }, [onDismiss]);
69
+ var store = react.useDialogStore({ open: isOpen, setOpen: setOpen });
70
+ var contextValue = React__namespace.useMemo(function () { return ({ onDismiss: onDismiss, height: height, dividers: dividers }); }, [
71
+ onDismiss,
72
+ height,
73
+ dividers,
74
+ ]);
75
+ var portalRef = React__namespace.useRef(null);
76
+ var dialogRef = React__namespace.useRef(null);
77
+ var backdropRef = React__namespace.useRef(null);
78
+ var handleBackdropClick = React__namespace.useCallback(function (event) {
79
+ var _a, _b;
80
+ if (
81
+ // The focus lock element takes up the same space as the backdrop and is where the event bubbles up from,
82
+ // so instead of checking the backdrop as the event target, we need to make sure it's just above the dialog
83
+ !((_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) &&
84
+ (
85
+ // Events fired from other portals will bubble up to the backdrop, even if it isn't a child in the DOM
86
+ (_b = backdropRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target))) {
87
+ event.stopPropagation();
88
+ onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
89
+ }
90
+ }, [onDismiss]);
91
+ React__namespace.useLayoutEffect(function disableAccessibilityTreeOutside() {
92
+ if (!isOpen || !portalRef.current) {
93
+ return;
94
+ }
95
+ return ariaHidden.hideOthers(portalRef.current);
96
+ }, [isOpen]);
97
+ var handleKeyDown = React__namespace.useCallback(function handleKeyDown(event) {
98
+ if (hideOnEscape &&
99
+ onDismiss != null &&
100
+ event.key === 'Escape' &&
101
+ !event.defaultPrevented) {
102
+ event.stopPropagation();
103
+ onDismiss();
104
+ }
105
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
106
+ }, [onDismiss, hideOnEscape, onKeyDown]);
107
+ if (!isOpen) {
108
+ return null;
109
+ }
110
+ return (React__namespace.createElement(react.Portal, { portalRef: portalRef, portalElement: portalElement },
111
+ React__namespace.createElement(box.Box, { "data-testid": "modal-overlay", "data-overlay": true, className: classNames__default["default"](modal_module["default"].overlay, modal_module["default"][height], modal_module["default"][width], exceptionallySetOverlayClassName),
112
+ /**
113
+ * We're using `onPointerDown` instead of `onClick` to prevent the modal from
114
+ * closing when the click starts inside the modal and ends on the backdrop.
115
+ */
116
+ onPointerDown: hideOnInteractOutside ? handleBackdropClick : undefined, ref: backdropRef },
117
+ React__namespace.createElement(FocusLock__default["default"], { autoFocus: autoFocus, whiteList: isNotInternalFrame, returnFocus: true, crossFrame: false },
118
+ React__namespace.createElement(react.Dialog, tslib.__assign({}, props, { ref: dialogRef, render: React__namespace.createElement(box.Box, { borderRadius: "full", background: "default", display: "flex", flexDirection: "column", overflow: "hidden", height: height === 'expand' ? 'full' : undefined, flexGrow: height === 'expand' ? 1 : 0 }), className: classNames__default["default"](exceptionallySetClassName, modal_module["default"].container), store: store, preventBodyScroll: true,
119
+ // Disable focus lock as we set up our own using ReactFocusLock
120
+ modal: false, autoFocus: false, autoFocusOnShow: false, autoFocusOnHide: false,
121
+ // Disable portal and backdrop as we control their markup
122
+ portal: false, backdrop: false, hideOnInteractOutside: false, hideOnEscape: false, onKeyDown: handleKeyDown }),
123
+ React__namespace.createElement(ModalContext.Provider, { value: contextValue }, children))))));
124
+ }
125
+ /**
126
+ * The close button rendered by ModalHeader. Provided independently so that consumers can customize
127
+ * the button's label.
128
+ *
129
+ * @see ModalHeader
130
+ */
131
+ function ModalCloseButton(props) {
132
+ var onDismiss = React__namespace.useContext(ModalContext).onDismiss;
133
+ var _a = React__namespace.useState(false), includeInTabOrder = _a[0], setIncludeInTabOrder = _a[1];
134
+ var _b = React__namespace.useState(false), isMounted = _b[0], setIsMounted = _b[1];
135
+ React__namespace.useEffect(function skipAutoFocus() {
136
+ if (isMounted) {
137
+ setIncludeInTabOrder(true);
138
+ }
139
+ else {
140
+ setIsMounted(true);
141
+ }
142
+ }, [isMounted]);
143
+ return (React__namespace.createElement(button.IconButton, tslib.__assign({}, props, { variant: "quaternary", onClick: onDismiss, icon: React__namespace.createElement(closeIcon.CloseIcon, null), tabIndex: includeInTabOrder ? 0 : -1 })));
144
+ }
145
+ /**
146
+ * Renders a standard modal header area with an optional close button.
147
+ *
148
+ * @see Modal
149
+ * @see ModalFooter
150
+ * @see ModalBody
151
+ */
152
+ function ModalHeader(_a) {
153
+ var children = _a.children, _b = _a.button, button = _b === void 0 ? true : _b, _c = _a.withDivider, withDivider = _c === void 0 ? false : _c, exceptionallySetClassName = _a.exceptionallySetClassName, props = tslib.__rest(_a, ["children", "button", "withDivider", "exceptionallySetClassName"]);
154
+ var dividers = React__namespace.useContext(ModalContext).dividers;
155
+ return (React__namespace.createElement(React__namespace.Fragment, null,
156
+ React__namespace.createElement(box.Box, tslib.__assign({}, props, { as: "header", paddingLeft: "large", paddingRight: button === false || button === null ? 'large' : 'small', paddingY: "small", className: exceptionallySetClassName }),
157
+ React__namespace.createElement(columns.Columns, { space: "large", alignY: "center" },
158
+ React__namespace.createElement(columns.Column, { width: "auto" }, children),
159
+ button === false || button === null ? (React__namespace.createElement("div", { className: modal_module["default"].headerContent })) : (React__namespace.createElement(columns.Column, { width: "content", exceptionallySetClassName: modal_module["default"].buttonContainer, "data-testid": "button-container" }, typeof button === 'boolean' ? (React__namespace.createElement(ModalCloseButton, { "aria-label": "Close modal", autoFocus: false })) : (button))))),
160
+ withDivider ? React__namespace.createElement(divider.Divider, { weight: dividers }) : null));
161
+ }
162
+ /**
163
+ * Renders the body of a modal.
164
+ *
165
+ * Convenient to use alongside ModalHeader and/or ModalFooter as needed. It ensures, among other
166
+ * things, that the content of the modal body expands or contracts depending on the modal height
167
+ * setting or the size of the content. The body content also automatically scrolls when it's too
168
+ * large to fit the available space.
169
+ *
170
+ * @see Modal
171
+ * @see ModalHeader
172
+ * @see ModalFooter
173
+ */
174
+ var ModalBody = React.forwardRef(function ModalBody(_a, ref) {
175
+ var exceptionallySetClassName = _a.exceptionallySetClassName, children = _a.children, props = tslib.__rest(_a, ["exceptionallySetClassName", "children"]);
176
+ var height = React__namespace.useContext(ModalContext).height;
177
+ return (React__namespace.createElement(box.Box, tslib.__assign({}, props, { ref: ref, className: exceptionallySetClassName, flexGrow: height === 'expand' ? 1 : 0, height: height === 'expand' ? 'full' : undefined, overflow: "auto" }),
178
+ React__namespace.createElement(box.Box, { padding: "large", paddingBottom: "xxlarge" }, children)));
179
+ });
180
+ /**
181
+ * Renders a standard modal footer area.
182
+ *
183
+ * @see Modal
184
+ * @see ModalHeader
185
+ * @see ModalBody
186
+ */
187
+ function ModalFooter(_a) {
188
+ var exceptionallySetClassName = _a.exceptionallySetClassName, _b = _a.withDivider, withDivider = _b === void 0 ? false : _b, props = tslib.__rest(_a, ["exceptionallySetClassName", "withDivider"]);
189
+ var dividers = React__namespace.useContext(ModalContext).dividers;
190
+ return (React__namespace.createElement(React__namespace.Fragment, null,
191
+ withDivider ? React__namespace.createElement(divider.Divider, { weight: dividers }) : null,
192
+ React__namespace.createElement(box.Box, tslib.__assign({ as: "footer" }, props, { className: exceptionallySetClassName, padding: "large" }))));
193
+ }
194
+ /**
195
+ * A specific version of the ModalFooter, tailored to showing an inline list of actions (buttons).
196
+ * @see ModalFooter
197
+ */
198
+ function ModalActions(_a) {
199
+ var children = _a.children, props = tslib.__rest(_a, ["children"]);
200
+ return (React__namespace.createElement(ModalFooter, tslib.__assign({}, props),
201
+ React__namespace.createElement(inline.Inline, { align: "right", space: "large" }, children)));
202
+ }
203
+
204
+ exports.Modal = Modal;
205
+ exports.ModalActions = ModalActions;
206
+ exports.ModalBody = ModalBody;
207
+ exports.ModalCloseButton = ModalCloseButton;
208
+ exports.ModalFooter = ModalFooter;
209
+ exports.ModalHeader = ModalHeader;
2
210
  //# sourceMappingURL=modal.js.map