@metamask/design-system-react 0.21.0 → 0.23.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 (342) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/dist/components/BannerAlert/BannerAlert.d.cts +2 -4
  3. package/dist/components/BannerAlert/BannerAlert.d.cts.map +1 -1
  4. package/dist/components/BannerAlert/BannerAlert.d.mts +2 -4
  5. package/dist/components/BannerAlert/BannerAlert.d.mts.map +1 -1
  6. package/dist/components/BannerBase/BannerBase.cjs +3 -3
  7. package/dist/components/BannerBase/BannerBase.cjs.map +1 -1
  8. package/dist/components/BannerBase/BannerBase.d.cts +2 -4
  9. package/dist/components/BannerBase/BannerBase.d.cts.map +1 -1
  10. package/dist/components/BannerBase/BannerBase.d.mts +2 -4
  11. package/dist/components/BannerBase/BannerBase.d.mts.map +1 -1
  12. package/dist/components/BannerBase/BannerBase.mjs +3 -3
  13. package/dist/components/BannerBase/BannerBase.mjs.map +1 -1
  14. package/dist/components/BannerBase/BannerBase.types.cjs.map +1 -1
  15. package/dist/components/BannerBase/BannerBase.types.d.cts +1 -5
  16. package/dist/components/BannerBase/BannerBase.types.d.cts.map +1 -1
  17. package/dist/components/BannerBase/BannerBase.types.d.mts +1 -5
  18. package/dist/components/BannerBase/BannerBase.types.d.mts.map +1 -1
  19. package/dist/components/BannerBase/BannerBase.types.mjs.map +1 -1
  20. package/dist/components/ButtonBase/ButtonBase.cjs +26 -18
  21. package/dist/components/ButtonBase/ButtonBase.cjs.map +1 -1
  22. package/dist/components/ButtonBase/ButtonBase.constants.cjs +31 -1
  23. package/dist/components/ButtonBase/ButtonBase.constants.cjs.map +1 -1
  24. package/dist/components/ButtonBase/ButtonBase.constants.d.cts +6 -1
  25. package/dist/components/ButtonBase/ButtonBase.constants.d.cts.map +1 -1
  26. package/dist/components/ButtonBase/ButtonBase.constants.d.mts +6 -1
  27. package/dist/components/ButtonBase/ButtonBase.constants.d.mts.map +1 -1
  28. package/dist/components/ButtonBase/ButtonBase.constants.mjs +29 -1
  29. package/dist/components/ButtonBase/ButtonBase.constants.mjs.map +1 -1
  30. package/dist/components/ButtonBase/ButtonBase.d.cts.map +1 -1
  31. package/dist/components/ButtonBase/ButtonBase.d.mts.map +1 -1
  32. package/dist/components/ButtonBase/ButtonBase.mjs +28 -20
  33. package/dist/components/ButtonBase/ButtonBase.mjs.map +1 -1
  34. package/dist/components/HeaderBase/HeaderBase.cjs +43 -0
  35. package/dist/components/HeaderBase/HeaderBase.cjs.map +1 -0
  36. package/dist/components/HeaderBase/HeaderBase.d.cts +4 -0
  37. package/dist/components/HeaderBase/HeaderBase.d.cts.map +1 -0
  38. package/dist/components/HeaderBase/HeaderBase.d.mts +4 -0
  39. package/dist/components/HeaderBase/HeaderBase.d.mts.map +1 -0
  40. package/dist/components/HeaderBase/HeaderBase.mjs +24 -0
  41. package/dist/components/HeaderBase/HeaderBase.mjs.map +1 -0
  42. package/dist/components/HeaderBase/HeaderBase.types.cjs +3 -0
  43. package/dist/components/HeaderBase/HeaderBase.types.cjs.map +1 -0
  44. package/dist/components/HeaderBase/HeaderBase.types.d.cts +51 -0
  45. package/dist/components/HeaderBase/HeaderBase.types.d.cts.map +1 -0
  46. package/dist/components/HeaderBase/HeaderBase.types.d.mts +51 -0
  47. package/dist/components/HeaderBase/HeaderBase.types.d.mts.map +1 -0
  48. package/dist/components/HeaderBase/HeaderBase.types.mjs +2 -0
  49. package/dist/components/HeaderBase/HeaderBase.types.mjs.map +1 -0
  50. package/dist/components/HeaderBase/index.cjs +6 -0
  51. package/dist/components/HeaderBase/index.cjs.map +1 -0
  52. package/dist/components/HeaderBase/index.d.cts +3 -0
  53. package/dist/components/HeaderBase/index.d.cts.map +1 -0
  54. package/dist/components/HeaderBase/index.d.mts +3 -0
  55. package/dist/components/HeaderBase/index.d.mts.map +1 -0
  56. package/dist/components/HeaderBase/index.mjs +2 -0
  57. package/dist/components/HeaderBase/index.mjs.map +1 -0
  58. package/dist/components/HelpText/HelpText.cjs +13 -0
  59. package/dist/components/HelpText/HelpText.cjs.map +1 -0
  60. package/dist/components/HelpText/HelpText.constants.cjs +11 -0
  61. package/dist/components/HelpText/HelpText.constants.cjs.map +1 -0
  62. package/dist/components/HelpText/HelpText.constants.d.cts +3 -0
  63. package/dist/components/HelpText/HelpText.constants.d.cts.map +1 -0
  64. package/dist/components/HelpText/HelpText.constants.d.mts +3 -0
  65. package/dist/components/HelpText/HelpText.constants.d.mts.map +1 -0
  66. package/dist/components/HelpText/HelpText.constants.mjs +8 -0
  67. package/dist/components/HelpText/HelpText.constants.mjs.map +1 -0
  68. package/dist/components/HelpText/HelpText.d.cts +4 -0
  69. package/dist/components/HelpText/HelpText.d.cts.map +1 -0
  70. package/dist/components/HelpText/HelpText.d.mts +4 -0
  71. package/dist/components/HelpText/HelpText.d.mts.map +1 -0
  72. package/dist/components/HelpText/HelpText.mjs +13 -0
  73. package/dist/components/HelpText/HelpText.mjs.map +1 -0
  74. package/dist/components/HelpText/HelpText.types.cjs +3 -0
  75. package/dist/components/HelpText/HelpText.types.cjs.map +1 -0
  76. package/dist/components/HelpText/HelpText.types.d.cts +9 -0
  77. package/dist/components/HelpText/HelpText.types.d.cts.map +1 -0
  78. package/dist/components/HelpText/HelpText.types.d.mts +9 -0
  79. package/dist/components/HelpText/HelpText.types.d.mts.map +1 -0
  80. package/dist/components/HelpText/HelpText.types.mjs +2 -0
  81. package/dist/components/HelpText/HelpText.types.mjs.map +1 -0
  82. package/dist/components/HelpText/index.cjs +8 -0
  83. package/dist/components/HelpText/index.cjs.map +1 -0
  84. package/dist/components/HelpText/index.d.cts +4 -0
  85. package/dist/components/HelpText/index.d.cts.map +1 -0
  86. package/dist/components/HelpText/index.d.mts +4 -0
  87. package/dist/components/HelpText/index.d.mts.map +1 -0
  88. package/dist/components/HelpText/index.mjs +3 -0
  89. package/dist/components/HelpText/index.mjs.map +1 -0
  90. package/dist/components/Icon/icons/Candlestick.cjs +1 -1
  91. package/dist/components/Icon/icons/Candlestick.cjs.map +1 -1
  92. package/dist/components/Icon/icons/Candlestick.mjs +1 -1
  93. package/dist/components/Icon/icons/Candlestick.mjs.map +1 -1
  94. package/dist/components/Icon/icons/Group.cjs +32 -0
  95. package/dist/components/Icon/icons/Group.cjs.map +1 -0
  96. package/dist/components/Icon/icons/Group.d.cts +4 -0
  97. package/dist/components/Icon/icons/Group.d.cts.map +1 -0
  98. package/dist/components/Icon/icons/Group.d.mts +4 -0
  99. package/dist/components/Icon/icons/Group.d.mts.map +1 -0
  100. package/dist/components/Icon/icons/Group.mjs +7 -0
  101. package/dist/components/Icon/icons/Group.mjs.map +1 -0
  102. package/dist/components/Icon/icons/ListArrow.cjs +32 -0
  103. package/dist/components/Icon/icons/ListArrow.cjs.map +1 -0
  104. package/dist/components/Icon/icons/ListArrow.d.cts +4 -0
  105. package/dist/components/Icon/icons/ListArrow.d.cts.map +1 -0
  106. package/dist/components/Icon/icons/ListArrow.d.mts +4 -0
  107. package/dist/components/Icon/icons/ListArrow.d.mts.map +1 -0
  108. package/dist/components/Icon/icons/ListArrow.mjs +7 -0
  109. package/dist/components/Icon/icons/ListArrow.mjs.map +1 -0
  110. package/dist/components/Icon/icons/Musd.cjs +32 -0
  111. package/dist/components/Icon/icons/Musd.cjs.map +1 -0
  112. package/dist/components/Icon/icons/Musd.d.cts +4 -0
  113. package/dist/components/Icon/icons/Musd.d.cts.map +1 -0
  114. package/dist/components/Icon/icons/Musd.d.mts +4 -0
  115. package/dist/components/Icon/icons/Musd.d.mts.map +1 -0
  116. package/dist/components/Icon/icons/Musd.mjs +7 -0
  117. package/dist/components/Icon/icons/Musd.mjs.map +1 -0
  118. package/dist/components/Icon/icons/MusdFilled.cjs +32 -0
  119. package/dist/components/Icon/icons/MusdFilled.cjs.map +1 -0
  120. package/dist/components/Icon/icons/MusdFilled.d.cts +4 -0
  121. package/dist/components/Icon/icons/MusdFilled.d.cts.map +1 -0
  122. package/dist/components/Icon/icons/MusdFilled.d.mts +4 -0
  123. package/dist/components/Icon/icons/MusdFilled.d.mts.map +1 -0
  124. package/dist/components/Icon/icons/MusdFilled.mjs +7 -0
  125. package/dist/components/Icon/icons/MusdFilled.mjs.map +1 -0
  126. package/dist/components/Icon/icons/PieChart.cjs +32 -0
  127. package/dist/components/Icon/icons/PieChart.cjs.map +1 -0
  128. package/dist/components/Icon/icons/PieChart.d.cts +4 -0
  129. package/dist/components/Icon/icons/PieChart.d.cts.map +1 -0
  130. package/dist/components/Icon/icons/PieChart.d.mts +4 -0
  131. package/dist/components/Icon/icons/PieChart.d.mts.map +1 -0
  132. package/dist/components/Icon/icons/PieChart.mjs +7 -0
  133. package/dist/components/Icon/icons/PieChart.mjs.map +1 -0
  134. package/dist/components/Icon/icons/Predictions.cjs +32 -0
  135. package/dist/components/Icon/icons/Predictions.cjs.map +1 -0
  136. package/dist/components/Icon/icons/Predictions.d.cts +4 -0
  137. package/dist/components/Icon/icons/Predictions.d.cts.map +1 -0
  138. package/dist/components/Icon/icons/Predictions.d.mts +4 -0
  139. package/dist/components/Icon/icons/Predictions.d.mts.map +1 -0
  140. package/dist/components/Icon/icons/Predictions.mjs +7 -0
  141. package/dist/components/Icon/icons/Predictions.mjs.map +1 -0
  142. package/dist/components/Icon/icons/index.cjs +12 -0
  143. package/dist/components/Icon/icons/index.cjs.map +1 -1
  144. package/dist/components/Icon/icons/index.d.cts +6 -0
  145. package/dist/components/Icon/icons/index.d.cts.map +1 -1
  146. package/dist/components/Icon/icons/index.d.mts +6 -0
  147. package/dist/components/Icon/icons/index.d.mts.map +1 -1
  148. package/dist/components/Icon/icons/index.mjs +12 -0
  149. package/dist/components/Icon/icons/index.mjs.map +1 -1
  150. package/dist/components/Label/Label.cjs +38 -0
  151. package/dist/components/Label/Label.cjs.map +1 -0
  152. package/dist/components/Label/Label.d.cts +4 -0
  153. package/dist/components/Label/Label.d.cts.map +1 -0
  154. package/dist/components/Label/Label.d.mts +4 -0
  155. package/dist/components/Label/Label.d.mts.map +1 -0
  156. package/dist/components/Label/Label.mjs +19 -0
  157. package/dist/components/Label/Label.mjs.map +1 -0
  158. package/dist/components/Label/Label.types.cjs +3 -0
  159. package/dist/components/Label/Label.types.cjs.map +1 -0
  160. package/dist/components/Label/Label.types.d.cts +27 -0
  161. package/dist/components/Label/Label.types.d.cts.map +1 -0
  162. package/dist/components/Label/Label.types.d.mts +27 -0
  163. package/dist/components/Label/Label.types.d.mts.map +1 -0
  164. package/dist/components/Label/Label.types.mjs +2 -0
  165. package/dist/components/Label/Label.types.mjs.map +1 -0
  166. package/dist/components/Label/index.cjs +6 -0
  167. package/dist/components/Label/index.cjs.map +1 -0
  168. package/dist/components/Label/index.d.cts +3 -0
  169. package/dist/components/Label/index.d.cts.map +1 -0
  170. package/dist/components/Label/index.d.mts +3 -0
  171. package/dist/components/Label/index.d.mts.map +1 -0
  172. package/dist/components/Label/index.mjs +2 -0
  173. package/dist/components/Label/index.mjs.map +1 -0
  174. package/dist/components/Modal/Modal.cjs +49 -0
  175. package/dist/components/Modal/Modal.cjs.map +1 -0
  176. package/dist/components/Modal/Modal.context.cjs +14 -0
  177. package/dist/components/Modal/Modal.context.cjs.map +1 -0
  178. package/dist/components/Modal/Modal.context.d.cts +6 -0
  179. package/dist/components/Modal/Modal.context.d.cts.map +1 -0
  180. package/dist/components/Modal/Modal.context.d.mts +6 -0
  181. package/dist/components/Modal/Modal.context.d.mts.map +1 -0
  182. package/dist/components/Modal/Modal.context.mjs +10 -0
  183. package/dist/components/Modal/Modal.context.mjs.map +1 -0
  184. package/dist/components/Modal/Modal.d.cts +4 -0
  185. package/dist/components/Modal/Modal.d.cts.map +1 -0
  186. package/dist/components/Modal/Modal.d.mts +4 -0
  187. package/dist/components/Modal/Modal.d.mts.map +1 -0
  188. package/dist/components/Modal/Modal.mjs +30 -0
  189. package/dist/components/Modal/Modal.mjs.map +1 -0
  190. package/dist/components/Modal/Modal.types.cjs +3 -0
  191. package/dist/components/Modal/Modal.types.cjs.map +1 -0
  192. package/dist/components/Modal/Modal.types.d.cts +64 -0
  193. package/dist/components/Modal/Modal.types.d.cts.map +1 -0
  194. package/dist/components/Modal/Modal.types.d.mts +64 -0
  195. package/dist/components/Modal/Modal.types.d.mts.map +1 -0
  196. package/dist/components/Modal/Modal.types.mjs +2 -0
  197. package/dist/components/Modal/Modal.types.mjs.map +1 -0
  198. package/dist/components/Modal/index.cjs +8 -0
  199. package/dist/components/Modal/index.cjs.map +1 -0
  200. package/dist/components/Modal/index.d.cts +5 -0
  201. package/dist/components/Modal/index.d.cts.map +1 -0
  202. package/dist/components/Modal/index.d.mts +5 -0
  203. package/dist/components/Modal/index.d.mts.map +1 -0
  204. package/dist/components/Modal/index.mjs +3 -0
  205. package/dist/components/Modal/index.mjs.map +1 -0
  206. package/dist/components/ModalContent/ModalContent.cjs +73 -0
  207. package/dist/components/ModalContent/ModalContent.cjs.map +1 -0
  208. package/dist/components/ModalContent/ModalContent.constants.cjs +34 -0
  209. package/dist/components/ModalContent/ModalContent.constants.cjs.map +1 -0
  210. package/dist/components/ModalContent/ModalContent.constants.d.cts +31 -0
  211. package/dist/components/ModalContent/ModalContent.constants.d.cts.map +1 -0
  212. package/dist/components/ModalContent/ModalContent.constants.d.mts +31 -0
  213. package/dist/components/ModalContent/ModalContent.constants.d.mts.map +1 -0
  214. package/dist/components/ModalContent/ModalContent.constants.mjs +31 -0
  215. package/dist/components/ModalContent/ModalContent.constants.mjs.map +1 -0
  216. package/dist/components/ModalContent/ModalContent.d.cts +4 -0
  217. package/dist/components/ModalContent/ModalContent.d.cts.map +1 -0
  218. package/dist/components/ModalContent/ModalContent.d.mts +4 -0
  219. package/dist/components/ModalContent/ModalContent.d.mts.map +1 -0
  220. package/dist/components/ModalContent/ModalContent.mjs +54 -0
  221. package/dist/components/ModalContent/ModalContent.mjs.map +1 -0
  222. package/dist/components/ModalContent/ModalContent.types.cjs +15 -0
  223. package/dist/components/ModalContent/ModalContent.types.cjs.map +1 -0
  224. package/dist/components/ModalContent/ModalContent.types.d.cts +51 -0
  225. package/dist/components/ModalContent/ModalContent.types.d.cts.map +1 -0
  226. package/dist/components/ModalContent/ModalContent.types.d.mts +51 -0
  227. package/dist/components/ModalContent/ModalContent.types.d.mts.map +1 -0
  228. package/dist/components/ModalContent/ModalContent.types.mjs +12 -0
  229. package/dist/components/ModalContent/ModalContent.types.mjs.map +1 -0
  230. package/dist/components/ModalContent/index.cjs +10 -0
  231. package/dist/components/ModalContent/index.cjs.map +1 -0
  232. package/dist/components/ModalContent/index.d.cts +5 -0
  233. package/dist/components/ModalContent/index.d.cts.map +1 -0
  234. package/dist/components/ModalContent/index.d.mts +5 -0
  235. package/dist/components/ModalContent/index.d.mts.map +1 -0
  236. package/dist/components/ModalContent/index.mjs +4 -0
  237. package/dist/components/ModalContent/index.mjs.map +1 -0
  238. package/dist/components/ModalHeader/ModalHeader.cjs +55 -0
  239. package/dist/components/ModalHeader/ModalHeader.cjs.map +1 -0
  240. package/dist/components/ModalHeader/ModalHeader.d.cts +55 -0
  241. package/dist/components/ModalHeader/ModalHeader.d.cts.map +1 -0
  242. package/dist/components/ModalHeader/ModalHeader.d.mts +55 -0
  243. package/dist/components/ModalHeader/ModalHeader.d.mts.map +1 -0
  244. package/dist/components/ModalHeader/ModalHeader.mjs +36 -0
  245. package/dist/components/ModalHeader/ModalHeader.mjs.map +1 -0
  246. package/dist/components/ModalHeader/ModalHeader.types.cjs +3 -0
  247. package/dist/components/ModalHeader/ModalHeader.types.cjs.map +1 -0
  248. package/dist/components/ModalHeader/ModalHeader.types.d.cts +69 -0
  249. package/dist/components/ModalHeader/ModalHeader.types.d.cts.map +1 -0
  250. package/dist/components/ModalHeader/ModalHeader.types.d.mts +69 -0
  251. package/dist/components/ModalHeader/ModalHeader.types.d.mts.map +1 -0
  252. package/dist/components/ModalHeader/ModalHeader.types.mjs +2 -0
  253. package/dist/components/ModalHeader/ModalHeader.types.mjs.map +1 -0
  254. package/dist/components/ModalHeader/index.cjs +6 -0
  255. package/dist/components/ModalHeader/index.cjs.map +1 -0
  256. package/dist/components/ModalHeader/index.d.cts +3 -0
  257. package/dist/components/ModalHeader/index.d.cts.map +1 -0
  258. package/dist/components/ModalHeader/index.d.mts +3 -0
  259. package/dist/components/ModalHeader/index.d.mts.map +1 -0
  260. package/dist/components/ModalHeader/index.mjs +2 -0
  261. package/dist/components/ModalHeader/index.mjs.map +1 -0
  262. package/dist/components/PopoverHeader/PopoverHeader.cjs +60 -0
  263. package/dist/components/PopoverHeader/PopoverHeader.cjs.map +1 -0
  264. package/dist/components/PopoverHeader/PopoverHeader.d.cts +55 -0
  265. package/dist/components/PopoverHeader/PopoverHeader.d.cts.map +1 -0
  266. package/dist/components/PopoverHeader/PopoverHeader.d.mts +55 -0
  267. package/dist/components/PopoverHeader/PopoverHeader.d.mts.map +1 -0
  268. package/dist/components/PopoverHeader/PopoverHeader.mjs +41 -0
  269. package/dist/components/PopoverHeader/PopoverHeader.mjs.map +1 -0
  270. package/dist/components/PopoverHeader/PopoverHeader.types.cjs +3 -0
  271. package/dist/components/PopoverHeader/PopoverHeader.types.cjs.map +1 -0
  272. package/dist/components/PopoverHeader/PopoverHeader.types.d.cts +70 -0
  273. package/dist/components/PopoverHeader/PopoverHeader.types.d.cts.map +1 -0
  274. package/dist/components/PopoverHeader/PopoverHeader.types.d.mts +70 -0
  275. package/dist/components/PopoverHeader/PopoverHeader.types.d.mts.map +1 -0
  276. package/dist/components/PopoverHeader/PopoverHeader.types.mjs +2 -0
  277. package/dist/components/PopoverHeader/PopoverHeader.types.mjs.map +1 -0
  278. package/dist/components/PopoverHeader/index.cjs +6 -0
  279. package/dist/components/PopoverHeader/index.cjs.map +1 -0
  280. package/dist/components/PopoverHeader/index.d.cts +3 -0
  281. package/dist/components/PopoverHeader/index.d.cts.map +1 -0
  282. package/dist/components/PopoverHeader/index.d.mts +3 -0
  283. package/dist/components/PopoverHeader/index.d.mts.map +1 -0
  284. package/dist/components/PopoverHeader/index.mjs +2 -0
  285. package/dist/components/PopoverHeader/index.mjs.map +1 -0
  286. package/dist/components/SensitiveText/SensitiveText.cjs +47 -0
  287. package/dist/components/SensitiveText/SensitiveText.cjs.map +1 -0
  288. package/dist/components/SensitiveText/SensitiveText.d.cts +4 -0
  289. package/dist/components/SensitiveText/SensitiveText.d.cts.map +1 -0
  290. package/dist/components/SensitiveText/SensitiveText.d.mts +4 -0
  291. package/dist/components/SensitiveText/SensitiveText.d.mts.map +1 -0
  292. package/dist/components/SensitiveText/SensitiveText.mjs +27 -0
  293. package/dist/components/SensitiveText/SensitiveText.mjs.map +1 -0
  294. package/dist/components/SensitiveText/SensitiveText.types.cjs +3 -0
  295. package/dist/components/SensitiveText/SensitiveText.types.cjs.map +1 -0
  296. package/dist/components/SensitiveText/SensitiveText.types.d.cts +11 -0
  297. package/dist/components/SensitiveText/SensitiveText.types.d.cts.map +1 -0
  298. package/dist/components/SensitiveText/SensitiveText.types.d.mts +11 -0
  299. package/dist/components/SensitiveText/SensitiveText.types.d.mts.map +1 -0
  300. package/dist/components/SensitiveText/SensitiveText.types.mjs +2 -0
  301. package/dist/components/SensitiveText/SensitiveText.types.mjs.map +1 -0
  302. package/dist/components/SensitiveText/index.cjs +8 -0
  303. package/dist/components/SensitiveText/index.cjs.map +1 -0
  304. package/dist/components/SensitiveText/index.d.cts +4 -0
  305. package/dist/components/SensitiveText/index.d.cts.map +1 -0
  306. package/dist/components/SensitiveText/index.d.mts +4 -0
  307. package/dist/components/SensitiveText/index.d.mts.map +1 -0
  308. package/dist/components/SensitiveText/index.mjs +3 -0
  309. package/dist/components/SensitiveText/index.mjs.map +1 -0
  310. package/dist/components/Skeleton/Skeleton.cjs +46 -0
  311. package/dist/components/Skeleton/Skeleton.cjs.map +1 -0
  312. package/dist/components/Skeleton/Skeleton.d.cts +4 -0
  313. package/dist/components/Skeleton/Skeleton.d.cts.map +1 -0
  314. package/dist/components/Skeleton/Skeleton.d.mts +4 -0
  315. package/dist/components/Skeleton/Skeleton.d.mts.map +1 -0
  316. package/dist/components/Skeleton/Skeleton.mjs +27 -0
  317. package/dist/components/Skeleton/Skeleton.mjs.map +1 -0
  318. package/dist/components/Skeleton/Skeleton.types.cjs +3 -0
  319. package/dist/components/Skeleton/Skeleton.types.cjs.map +1 -0
  320. package/dist/components/Skeleton/Skeleton.types.d.cts +38 -0
  321. package/dist/components/Skeleton/Skeleton.types.d.cts.map +1 -0
  322. package/dist/components/Skeleton/Skeleton.types.d.mts +38 -0
  323. package/dist/components/Skeleton/Skeleton.types.d.mts.map +1 -0
  324. package/dist/components/Skeleton/Skeleton.types.mjs +2 -0
  325. package/dist/components/Skeleton/Skeleton.types.mjs.map +1 -0
  326. package/dist/components/Skeleton/index.cjs +6 -0
  327. package/dist/components/Skeleton/index.cjs.map +1 -0
  328. package/dist/components/Skeleton/index.d.cts +3 -0
  329. package/dist/components/Skeleton/index.d.cts.map +1 -0
  330. package/dist/components/Skeleton/index.d.mts +3 -0
  331. package/dist/components/Skeleton/index.d.mts.map +1 -0
  332. package/dist/components/Skeleton/index.mjs +2 -0
  333. package/dist/components/Skeleton/index.mjs.map +1 -0
  334. package/dist/components/index.cjs +25 -2
  335. package/dist/components/index.cjs.map +1 -1
  336. package/dist/components/index.d.cts +18 -0
  337. package/dist/components/index.d.cts.map +1 -1
  338. package/dist/components/index.d.mts +18 -0
  339. package/dist/components/index.d.mts.map +1 -1
  340. package/dist/components/index.mjs +9 -0
  341. package/dist/components/index.mjs.map +1 -1
  342. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.23.0]
11
+
12
+ ### Added
13
+
14
+ - Added `PopoverHeader` for popover title rows and trailing actions, aligned with MetaMask extension screen patterns ([#1158](https://github.com/MetaMask/metamask-design-system/pull/1158))
15
+ - Added `ModalHeader` for modal title rows and accessory slots, aligned with MetaMask extension screen patterns ([#1144](https://github.com/MetaMask/metamask-design-system/pull/1144))
16
+ - Added `Label` for accessible captions paired with form controls ([#1152](https://github.com/MetaMask/metamask-design-system/pull/1152))
17
+ - Added `SensitiveText` for masking and revealing sensitive strings (addresses, secrets, recovery phrases) with configurable visible length ([#1164](https://github.com/MetaMask/metamask-design-system/pull/1164))
18
+ - Added `HelpText` for helper, success, warning, and error copy beneath inputs and other controls ([#1169](https://github.com/MetaMask/metamask-design-system/pull/1169))
19
+
20
+ ### Changed
21
+
22
+ - `ButtonBase` now derives label typography, start and end icon sizes, and internal spacing from the `size` prop for every supported `ButtonBaseSize`, keeping defaults aligned without manual per-size tuning ([#1150](https://github.com/MetaMask/metamask-design-system/pull/1150))
23
+ - If you wrap **`ButtonBase`** and override label, icon, or spacing, see [Migration guide](./MIGRATION.md#buttonbase-size-defaults).
24
+ - `BannerBase` close control behavior is simplified and aligned with the shared dismiss contract ([#1166](https://github.com/MetaMask/metamask-design-system/pull/1166))
25
+
26
+ ## [0.22.0]
27
+
28
+ ### Added
29
+
30
+ - Added `Modal` and `useModalContext` for composing modal dialogs with focus management and the same layout patterns used in the MetaMask extension migration ([#1136](https://github.com/MetaMask/metamask-design-system/pull/1136))
31
+ - Added `ModalContent` (with `ModalContentSize` and `MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR`) for sized modal bodies, entrance motion, and outside-click handling aligned with that migration ([#1139](https://github.com/MetaMask/metamask-design-system/pull/1139))
32
+ - Added `Skeleton` for loading placeholders ([#1146](https://github.com/MetaMask/metamask-design-system/pull/1146))
33
+ - Added `HeaderBase` for flexible header layouts when migrating extension screens into the design system ([#1142](https://github.com/MetaMask/metamask-design-system/pull/1142))
34
+ - Added `ListArrow`, `Musd`, and `MusdFilled` icons; refreshed `Candlestick`; and added `Group`, `PieChart`, and `Predictions` icons ([#1157](https://github.com/MetaMask/metamask-design-system/pull/1157), [#1161](https://github.com/MetaMask/metamask-design-system/pull/1161), [#1162](https://github.com/MetaMask/metamask-design-system/pull/1162), [#1163](https://github.com/MetaMask/metamask-design-system/pull/1163))
35
+
10
36
  ## [0.21.0]
11
37
 
12
38
  ### Added
@@ -294,7 +320,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
294
320
  - Full TypeScript support with type definitions and enums
295
321
  - Tailwind CSS integration with design token support
296
322
 
297
- [Unreleased]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.21.0...HEAD
323
+ [Unreleased]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.23.0...HEAD
324
+ [0.23.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.22.0...@metamask/design-system-react@0.23.0
325
+ [0.22.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.21.0...@metamask/design-system-react@0.22.0
298
326
  [0.21.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.20.0...@metamask/design-system-react@0.21.0
299
327
  [0.20.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.19.0...@metamask/design-system-react@0.20.0
300
328
  [0.19.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.18.0...@metamask/design-system-react@0.19.0
@@ -9,7 +9,6 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
9
9
  onClose?: React.MouseEventHandler<HTMLButtonElement> | undefined;
10
10
  closeButtonProps?: (Omit<Partial<import("../index.cjs").ButtonIconProps>, "onClick" | "iconName"> & {
11
11
  'data-testid'?: string | undefined;
12
- onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
13
12
  }) | undefined;
14
13
  } & {
15
14
  actionButtonOnClick: React.MouseEventHandler<HTMLButtonElement>;
@@ -291,11 +290,11 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
291
290
  onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
292
291
  onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
293
292
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
293
+ isDisabled?: boolean | undefined;
294
294
  asChild?: boolean | undefined;
295
295
  textProps?: Partial<import("../index.cjs").TextProps> | undefined;
296
296
  isLoading?: boolean | undefined;
297
297
  loadingText?: string | undefined;
298
- isDisabled?: boolean | undefined;
299
298
  isFullWidth?: boolean | undefined;
300
299
  loadingTextProps?: Partial<import("../index.cjs").TextProps> | undefined;
301
300
  startIconName?: import("@metamask/design-system-shared").IconName | undefined;
@@ -319,7 +318,6 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
319
318
  onClose?: React.MouseEventHandler<HTMLButtonElement> | undefined;
320
319
  closeButtonProps?: (Omit<Partial<import("../index.cjs").ButtonIconProps>, "onClick" | "iconName"> & {
321
320
  'data-testid'?: string | undefined;
322
- onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
323
321
  }) | undefined;
324
322
  } & {
325
323
  actionButtonOnClick?: undefined;
@@ -601,11 +599,11 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
601
599
  onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
602
600
  onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
603
601
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
602
+ isDisabled?: boolean | undefined;
604
603
  asChild?: boolean | undefined;
605
604
  textProps?: Partial<import("../index.cjs").TextProps> | undefined;
606
605
  isLoading?: boolean | undefined;
607
606
  loadingText?: string | undefined;
608
- isDisabled?: boolean | undefined;
609
607
  isFullWidth?: boolean | undefined;
610
608
  loadingTextProps?: Partial<import("../index.cjs").TextProps> | undefined;
611
609
  startIconName?: import("@metamask/design-system-shared").IconName | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"BannerAlert.d.cts","sourceRoot":"","sources":["../../../src/components/BannerAlert/BannerAlert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,uCA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDA8BvB,CAAC"}
@@ -9,7 +9,6 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
9
9
  onClose?: React.MouseEventHandler<HTMLButtonElement> | undefined;
10
10
  closeButtonProps?: (Omit<Partial<import("../index.mjs").ButtonIconProps>, "onClick" | "iconName"> & {
11
11
  'data-testid'?: string | undefined;
12
- onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
13
12
  }) | undefined;
14
13
  } & {
15
14
  actionButtonOnClick: React.MouseEventHandler<HTMLButtonElement>;
@@ -291,11 +290,11 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
291
290
  onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
292
291
  onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
293
292
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
293
+ isDisabled?: boolean | undefined;
294
294
  asChild?: boolean | undefined;
295
295
  textProps?: Partial<import("../index.mjs").TextProps> | undefined;
296
296
  isLoading?: boolean | undefined;
297
297
  loadingText?: string | undefined;
298
- isDisabled?: boolean | undefined;
299
298
  isFullWidth?: boolean | undefined;
300
299
  loadingTextProps?: Partial<import("../index.mjs").TextProps> | undefined;
301
300
  startIconName?: import("@metamask/design-system-shared").IconName | undefined;
@@ -319,7 +318,6 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
319
318
  onClose?: React.MouseEventHandler<HTMLButtonElement> | undefined;
320
319
  closeButtonProps?: (Omit<Partial<import("../index.mjs").ButtonIconProps>, "onClick" | "iconName"> & {
321
320
  'data-testid'?: string | undefined;
322
- onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
323
321
  }) | undefined;
324
322
  } & {
325
323
  actionButtonOnClick?: undefined;
@@ -601,11 +599,11 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
601
599
  onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
602
600
  onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
603
601
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
602
+ isDisabled?: boolean | undefined;
604
603
  asChild?: boolean | undefined;
605
604
  textProps?: Partial<import("../index.mjs").TextProps> | undefined;
606
605
  isLoading?: boolean | undefined;
607
606
  loadingText?: string | undefined;
608
- isDisabled?: boolean | undefined;
609
607
  isFullWidth?: boolean | undefined;
610
608
  loadingTextProps?: Partial<import("../index.mjs").TextProps> | undefined;
611
609
  startIconName?: import("@metamask/design-system-shared").IconName | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"BannerAlert.d.mts","sourceRoot":"","sources":["../../../src/components/BannerAlert/BannerAlert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,uCAAuC;AACrE,OAAO,KAAqB,cAAc;AAe1C,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDA8BvB,CAAC"}
@@ -35,8 +35,8 @@ const isTextContent = (content) => typeof content === 'string' || typeof content
35
35
  const hasContent = (content) => content !== null && content !== undefined;
36
36
  exports.BannerBase = (0, react_1.forwardRef)(({ title, titleProps, description, descriptionProps, children, childrenWrapperProps, actionButtonLabel, actionButtonOnClick, actionButtonProps, startAccessory, onClose, closeButtonProps, className, ...props }, ref) => {
37
37
  const resolvedActionButtonProps = actionButtonProps ?? {};
38
- const { ariaLabel: closeButtonAriaLabel = 'Close banner', onClick: closeButtonPropsOnClick, className: closeButtonClassName, ...resolvedCloseButtonProps } = closeButtonProps ?? {};
39
- const shouldShowCloseButton = Boolean(onClose || closeButtonProps);
38
+ const { ariaLabel: closeButtonAriaLabel = 'Close banner', className: closeButtonClassName, ...resolvedCloseButtonProps } = closeButtonProps ?? {};
39
+ const shouldShowCloseButton = Boolean(onClose);
40
40
  const shouldShowActionButton = Boolean(actionButtonOnClick);
41
41
  return (react_1.default.createElement(Box_1.Box, { ref: ref, flexDirection: design_system_shared_1.BoxFlexDirection.Row, alignItems: design_system_shared_1.BoxAlignItems.Start, gap: 2, backgroundColor: design_system_shared_1.BoxBackgroundColor.BackgroundDefault, padding: 3, className: (0, tw_merge_1.twMerge)('rounded-sm', className), ...props },
42
42
  startAccessory,
@@ -48,7 +48,7 @@ exports.BannerBase = (0, react_1.forwardRef)(({ title, titleProps, description,
48
48
  (isTextContent(children) ? (react_1.default.createElement(Text_1.Text, { variant: design_system_shared_1.TextVariant.BodyMd, ...childrenWrapperProps }, children)) : (children)),
49
49
  shouldShowActionButton && (react_1.default.createElement(Box_1.Box, { className: "mt-4" },
50
50
  react_1.default.createElement(Button_1.Button, { size: design_system_shared_1.ButtonSize.Md, onClick: actionButtonOnClick, ...resolvedActionButtonProps }, actionButtonLabel)))),
51
- shouldShowCloseButton && (react_1.default.createElement(ButtonIcon_1.ButtonIcon, { className: (0, tw_merge_1.twMerge)('ml-3 self-start', closeButtonClassName), iconName: design_system_shared_1.IconName.Close, size: design_system_shared_1.ButtonIconSize.Sm, ariaLabel: closeButtonAriaLabel, onClick: onClose ?? closeButtonPropsOnClick, ...resolvedCloseButtonProps }))));
51
+ shouldShowCloseButton && (react_1.default.createElement(ButtonIcon_1.ButtonIcon, { className: (0, tw_merge_1.twMerge)('ml-3 self-start', closeButtonClassName), iconName: design_system_shared_1.IconName.Close, size: design_system_shared_1.ButtonIconSize.Sm, ariaLabel: closeButtonAriaLabel, onClick: onClose, ...resolvedCloseButtonProps }))));
52
52
  });
53
53
  exports.BannerBase.displayName = 'BannerBase';
54
54
  //# sourceMappingURL=BannerBase.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BannerBase.cjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEASwC;AACxC,+CAA0C;AAE1C,uDAA+C;AAC/C,0CAA6B;AAC7B,gDAAmC;AACnC,wDAA2C;AAC3C,4CAA+B;AAI/B,MAAM,aAAa,GAAG,CAAC,OAAwB,EAA8B,EAAE,CAC7E,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC;AAE7D,MAAM,UAAU,GAAG,CAAC,OAAwB,EAAE,EAAE,CAC9C,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,CAAC;AAE/B,QAAA,UAAU,GAAG,IAAA,kBAAU,EAClC,CACE,EACE,KAAK,EACL,UAAU,EACV,WAAW,E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,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IACnD,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAC5B,8BAAC,WAAI,IAAC,OAAO,EAAE,kCAAW,CAAC,MAAM,KAAM,gBAAgB,IACpD,WAAW,CACP,CACR,CAAC,CAAC,CAAC,CACF,WAAW,CACZ,CACG,CACP;YAEA,UAAU,CAAC,QAAQ,CAAC;gBACnB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACzB,8BAAC,WAAI,IAAC,OAAO,EAAE,kCAAW,CAAC,MAAM,KAAM,oBAAoB,IACxD,QAAQ,CACJ,CACR,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,CAAC;YAEH,sBAAsB,IAAI,CACzB,8BAAC,SAAG,IAAC,SAAS,EAAC,MAAM;gBACnB,8BAAC,eAAM,IACL,IAAI,EAAE,iCAAU,CAAC,EAAE,EACnB,OAAO,EAAE,mBAAmB,KACxB,yBAAyB,IAE5B,iBAAiB,CACX,CACL,CACP,CACG;QAEL,qBAAqB,IAAI,CACxB,8BAAC,uBAAU,IACT,SAAS,EAAE,IAAA,kBAAO,EAAC,iBAAiB,EAAE,oBAAoB,CAAC,EAC3D,QAAQ,EAAE,+BAAQ,CAAC,KAAK,EACxB,IAAI,EAAE,qCAAc,CAAC,EAAE,EACvB,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,OAAO,IAAI,uBAAuB,KACvC,wBAAwB,GAC5B,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import {\n BoxAlignItems,\n BoxBackgroundColor,\n BoxFlexDirection,\n ButtonIconSize,\n ButtonSize,\n FontWeight,\n IconName,\n TextVariant,\n} from '@metamask/design-system-shared';\nimport React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport { Box } from '../Box';\nimport { Button } from '../Button';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Text } from '../Text';\n\nimport type { BannerBaseProps } from './BannerBase.types';\n\nconst isTextContent = (content: React.ReactNode): content is string | number =>\n typeof content === 'string' || typeof content === 'number';\n\nconst hasContent = (content: React.ReactNode) =>\n content !== null && content !== undefined;\n\nexport const BannerBase = forwardRef<HTMLDivElement, BannerBaseProps>(\n (\n {\n title,\n titleProps,\n description,\n descriptionProps,\n children,\n childrenWrapperProps,\n actionButtonLabel,\n actionButtonOnClick,\n actionButtonProps,\n startAccessory,\n onClose,\n closeButtonProps,\n className,\n ...props\n },\n ref,\n ) => {\n const resolvedActionButtonProps = actionButtonProps ?? {};\n\n const {\n ariaLabel: closeButtonAriaLabel = 'Close banner',\n onClick: closeButtonPropsOnClick,\n className: closeButtonClassName,\n ...resolvedCloseButtonProps\n } = closeButtonProps ?? {};\n\n const shouldShowCloseButton = Boolean(onClose || closeButtonProps);\n const shouldShowActionButton = Boolean(actionButtonOnClick);\n\n return (\n <Box\n ref={ref}\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Start}\n gap={2}\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n padding={3}\n className={twMerge('rounded-sm', className)}\n {...props}\n >\n {startAccessory}\n\n <Box className=\"min-w-0 flex-1\">\n {hasContent(title) &&\n (isTextContent(title) ? (\n <Text\n variant={TextVariant.BodyMd}\n fontWeight={FontWeight.Medium}\n {...titleProps}\n >\n {title}\n </Text>\n ) : (\n title\n ))}\n\n {hasContent(description) && (\n <Box className={hasContent(title) ? 'mt-1' : undefined}>\n {isTextContent(description) ? (\n <Text variant={TextVariant.BodySm} {...descriptionProps}>\n {description}\n </Text>\n ) : (\n description\n )}\n </Box>\n )}\n\n {hasContent(children) &&\n (isTextContent(children) ? (\n <Text variant={TextVariant.BodyMd} {...childrenWrapperProps}>\n {children}\n </Text>\n ) : (\n children\n ))}\n\n {shouldShowActionButton && (\n <Box className=\"mt-4\">\n <Button\n size={ButtonSize.Md}\n onClick={actionButtonOnClick}\n {...resolvedActionButtonProps}\n >\n {actionButtonLabel}\n </Button>\n </Box>\n )}\n </Box>\n\n {shouldShowCloseButton && (\n <ButtonIcon\n className={twMerge('ml-3 self-start', closeButtonClassName)}\n iconName={IconName.Close}\n size={ButtonIconSize.Sm}\n ariaLabel={closeButtonAriaLabel}\n onClick={onClose ?? closeButtonPropsOnClick}\n {...resolvedCloseButtonProps}\n />\n )}\n </Box>\n );\n },\n);\n\nBannerBase.displayName = 'BannerBase';\n"]}
1
+ {"version":3,"file":"BannerBase.cjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEASwC;AACxC,+CAA0C;AAE1C,uDAA+C;AAC/C,0CAA6B;AAC7B,gDAAmC;AACnC,wDAA2C;AAC3C,4CAA+B;AAI/B,MAAM,aAAa,GAAG,CAAC,OAAwB,EAA8B,EAAE,CAC7E,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC;AAE7D,MAAM,UAAU,GAAG,CAAC,OAAwB,EAAE,EAAE,CAC9C,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,CAAC;AAE/B,QAAA,UAAU,GAAG,IAAA,kBAAU,EAClC,CACE,EACE,KAAK,EACL,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,yBAAyB,GAAG,iBAAiB,IAAI,EAAE,CAAC;IAE1D,MAAM,EACJ,SAAS,EAAE,oBAAoB,GAAG,cAAc,EAChD,SAAS,EAAE,oBAAoB,EAC/B,GAAG,wBAAwB,EAC5B,GAAG,gBAAgB,IAAI,EAAE,CAAC;IAE3B,MAAM,qBAAqB,GAAG,OAA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,CACT,CAAC;YAEH,sBAAsB,IAAI,CACzB,8BAAC,SAAG,IAAC,SAAS,EAAC,MAAM;gBACnB,8BAAC,eAAM,IACL,IAAI,EAAE,iCAAU,CAAC,EAAE,EACnB,OAAO,EAAE,mBAAmB,KACxB,yBAAyB,IAE5B,iBAAiB,CACX,CACL,CACP,CACG;QAEL,qBAAqB,IAAI,CACxB,8BAAC,uBAAU,IACT,SAAS,EAAE,IAAA,kBAAO,EAAC,iBAAiB,EAAE,oBAAoB,CAAC,EAC3D,QAAQ,EAAE,+BAAQ,CAAC,KAAK,EACxB,IAAI,EAAE,qCAAc,CAAC,EAAE,EACvB,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,OAAO,KACZ,wBAAwB,GAC5B,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import {\n BoxAlignItems,\n BoxBackgroundColor,\n BoxFlexDirection,\n ButtonIconSize,\n ButtonSize,\n FontWeight,\n IconName,\n TextVariant,\n} from '@metamask/design-system-shared';\nimport React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport { Box } from '../Box';\nimport { Button } from '../Button';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Text } from '../Text';\n\nimport type { BannerBaseProps } from './BannerBase.types';\n\nconst isTextContent = (content: React.ReactNode): content is string | number =>\n typeof content === 'string' || typeof content === 'number';\n\nconst hasContent = (content: React.ReactNode) =>\n content !== null && content !== undefined;\n\nexport const BannerBase = forwardRef<HTMLDivElement, BannerBaseProps>(\n (\n {\n title,\n titleProps,\n description,\n descriptionProps,\n children,\n childrenWrapperProps,\n actionButtonLabel,\n actionButtonOnClick,\n actionButtonProps,\n startAccessory,\n onClose,\n closeButtonProps,\n className,\n ...props\n },\n ref,\n ) => {\n const resolvedActionButtonProps = actionButtonProps ?? {};\n\n const {\n ariaLabel: closeButtonAriaLabel = 'Close banner',\n className: closeButtonClassName,\n ...resolvedCloseButtonProps\n } = closeButtonProps ?? {};\n\n const shouldShowCloseButton = Boolean(onClose);\n const shouldShowActionButton = Boolean(actionButtonOnClick);\n\n return (\n <Box\n ref={ref}\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Start}\n gap={2}\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n padding={3}\n className={twMerge('rounded-sm', className)}\n {...props}\n >\n {startAccessory}\n\n <Box className=\"min-w-0 flex-1\">\n {hasContent(title) &&\n (isTextContent(title) ? (\n <Text\n variant={TextVariant.BodyMd}\n fontWeight={FontWeight.Medium}\n {...titleProps}\n >\n {title}\n </Text>\n ) : (\n title\n ))}\n\n {hasContent(description) && (\n <Box className={hasContent(title) ? 'mt-1' : undefined}>\n {isTextContent(description) ? (\n <Text variant={TextVariant.BodySm} {...descriptionProps}>\n {description}\n </Text>\n ) : (\n description\n )}\n </Box>\n )}\n\n {hasContent(children) &&\n (isTextContent(children) ? (\n <Text variant={TextVariant.BodyMd} {...childrenWrapperProps}>\n {children}\n </Text>\n ) : (\n children\n ))}\n\n {shouldShowActionButton && (\n <Box className=\"mt-4\">\n <Button\n size={ButtonSize.Md}\n onClick={actionButtonOnClick}\n {...resolvedActionButtonProps}\n >\n {actionButtonLabel}\n </Button>\n </Box>\n )}\n </Box>\n\n {shouldShowCloseButton && (\n <ButtonIcon\n className={twMerge('ml-3 self-start', closeButtonClassName)}\n iconName={IconName.Close}\n size={ButtonIconSize.Sm}\n ariaLabel={closeButtonAriaLabel}\n onClick={onClose}\n {...resolvedCloseButtonProps}\n />\n )}\n </Box>\n );\n },\n);\n\nBannerBase.displayName = 'BannerBase';\n"]}
@@ -7,7 +7,6 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
7
7
  onClose?: React.MouseEventHandler<HTMLButtonElement> | undefined;
8
8
  closeButtonProps?: (Omit<Partial<import("../ButtonIcon/index.cjs").ButtonIconProps>, "onClick" | "iconName"> & {
9
9
  'data-testid'?: string | undefined;
10
- onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
11
10
  }) | undefined;
12
11
  } & {
13
12
  actionButtonOnClick: React.MouseEventHandler<HTMLButtonElement>;
@@ -289,11 +288,11 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
289
288
  onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
290
289
  onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
291
290
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
291
+ isDisabled?: boolean | undefined;
292
292
  asChild?: boolean | undefined;
293
293
  textProps?: Partial<import("../Text/index.cjs").TextProps> | undefined;
294
294
  isLoading?: boolean | undefined;
295
295
  loadingText?: string | undefined;
296
- isDisabled?: boolean | undefined;
297
296
  isFullWidth?: boolean | undefined;
298
297
  loadingTextProps?: Partial<import("../Text/index.cjs").TextProps> | undefined;
299
298
  startIconName?: IconName | undefined;
@@ -313,7 +312,6 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
313
312
  onClose?: React.MouseEventHandler<HTMLButtonElement> | undefined;
314
313
  closeButtonProps?: (Omit<Partial<import("../ButtonIcon/index.cjs").ButtonIconProps>, "onClick" | "iconName"> & {
315
314
  'data-testid'?: string | undefined;
316
- onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
317
315
  }) | undefined;
318
316
  } & {
319
317
  actionButtonOnClick?: undefined;
@@ -595,11 +593,11 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
595
593
  onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
596
594
  onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
597
595
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
596
+ isDisabled?: boolean | undefined;
598
597
  asChild?: boolean | undefined;
599
598
  textProps?: Partial<import("../Text/index.cjs").TextProps> | undefined;
600
599
  isLoading?: boolean | undefined;
601
600
  loadingText?: string | undefined;
602
- isDisabled?: boolean | undefined;
603
601
  isFullWidth?: boolean | undefined;
604
602
  loadingTextProps?: Partial<import("../Text/index.cjs").TextProps> | undefined;
605
603
  startIconName?: IconName | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"BannerBase.d.cts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,QAAQ,EAET,uCAAuC;AACxC,OAAO,KAAqB,cAAc;AAgB1C,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDA0GtB,CAAC"}
1
+ {"version":3,"file":"BannerBase.d.cts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,QAAQ,EAET,uCAAuC;AACxC,OAAO,KAAqB,cAAc;AAgB1C,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAyGtB,CAAC"}
@@ -7,7 +7,6 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
7
7
  onClose?: React.MouseEventHandler<HTMLButtonElement> | undefined;
8
8
  closeButtonProps?: (Omit<Partial<import("../ButtonIcon/index.mjs").ButtonIconProps>, "onClick" | "iconName"> & {
9
9
  'data-testid'?: string | undefined;
10
- onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
11
10
  }) | undefined;
12
11
  } & {
13
12
  actionButtonOnClick: React.MouseEventHandler<HTMLButtonElement>;
@@ -289,11 +288,11 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
289
288
  onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
290
289
  onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
291
290
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
291
+ isDisabled?: boolean | undefined;
292
292
  asChild?: boolean | undefined;
293
293
  textProps?: Partial<import("../Text/index.mjs").TextProps> | undefined;
294
294
  isLoading?: boolean | undefined;
295
295
  loadingText?: string | undefined;
296
- isDisabled?: boolean | undefined;
297
296
  isFullWidth?: boolean | undefined;
298
297
  loadingTextProps?: Partial<import("../Text/index.mjs").TextProps> | undefined;
299
298
  startIconName?: IconName | undefined;
@@ -313,7 +312,6 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
313
312
  onClose?: React.MouseEventHandler<HTMLButtonElement> | undefined;
314
313
  closeButtonProps?: (Omit<Partial<import("../ButtonIcon/index.mjs").ButtonIconProps>, "onClick" | "iconName"> & {
315
314
  'data-testid'?: string | undefined;
316
- onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
317
315
  }) | undefined;
318
316
  } & {
319
317
  actionButtonOnClick?: undefined;
@@ -595,11 +593,11 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
595
593
  onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
596
594
  onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
597
595
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
596
+ isDisabled?: boolean | undefined;
598
597
  asChild?: boolean | undefined;
599
598
  textProps?: Partial<import("../Text/index.mjs").TextProps> | undefined;
600
599
  isLoading?: boolean | undefined;
601
600
  loadingText?: string | undefined;
602
- isDisabled?: boolean | undefined;
603
601
  isFullWidth?: boolean | undefined;
604
602
  loadingTextProps?: Partial<import("../Text/index.mjs").TextProps> | undefined;
605
603
  startIconName?: IconName | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"BannerBase.d.mts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAyGtB,CAAC"}
@@ -16,8 +16,8 @@ const isTextContent = (content) => typeof content === 'string' || typeof content
16
16
  const hasContent = (content) => content !== null && content !== undefined;
17
17
  export const BannerBase = forwardRef(({ title, titleProps, description, descriptionProps, children, childrenWrapperProps, actionButtonLabel, actionButtonOnClick, actionButtonProps, startAccessory, onClose, closeButtonProps, className, ...props }, ref) => {
18
18
  const resolvedActionButtonProps = actionButtonProps ?? {};
19
- const { ariaLabel: closeButtonAriaLabel = 'Close banner', onClick: closeButtonPropsOnClick, className: closeButtonClassName, ...resolvedCloseButtonProps } = closeButtonProps ?? {};
20
- const shouldShowCloseButton = Boolean(onClose || closeButtonProps);
19
+ const { ariaLabel: closeButtonAriaLabel = 'Close banner', className: closeButtonClassName, ...resolvedCloseButtonProps } = closeButtonProps ?? {};
20
+ const shouldShowCloseButton = Boolean(onClose);
21
21
  const shouldShowActionButton = Boolean(actionButtonOnClick);
22
22
  return (React.createElement(Box, { ref: ref, flexDirection: BoxFlexDirection.Row, alignItems: BoxAlignItems.Start, gap: 2, backgroundColor: BoxBackgroundColor.BackgroundDefault, padding: 3, className: twMerge('rounded-sm', className), ...props },
23
23
  startAccessory,
@@ -29,7 +29,7 @@ export const BannerBase = forwardRef(({ title, titleProps, description, descript
29
29
  (isTextContent(children) ? (React.createElement(Text, { variant: TextVariant.BodyMd, ...childrenWrapperProps }, children)) : (children)),
30
30
  shouldShowActionButton && (React.createElement(Box, { className: "mt-4" },
31
31
  React.createElement(Button, { size: ButtonSize.Md, onClick: actionButtonOnClick, ...resolvedActionButtonProps }, actionButtonLabel)))),
32
- shouldShowCloseButton && (React.createElement(ButtonIcon, { className: twMerge('ml-3 self-start', closeButtonClassName), iconName: IconName.Close, size: ButtonIconSize.Sm, ariaLabel: closeButtonAriaLabel, onClick: onClose ?? closeButtonPropsOnClick, ...resolvedCloseButtonProps }))));
32
+ shouldShowCloseButton && (React.createElement(ButtonIcon, { className: twMerge('ml-3 self-start', closeButtonClassName), iconName: IconName.Close, size: ButtonIconSize.Sm, ariaLabel: closeButtonAriaLabel, onClick: onClose, ...resolvedCloseButtonProps }))));
33
33
  });
34
34
  BannerBase.displayName = 'BannerBase';
35
35
  //# sourceMappingURL=BannerBase.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BannerBase.mjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,uCAAuC;AACxC,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,OAAO,EAAE,iCAA6B;AAC/C,OAAO,EAAE,GAAG,EAAE,yBAAe;AAC7B,OAAO,EAAE,MAAM,EAAE,4BAAkB;AACnC,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAC3C,OAAO,EAAE,IAAI,EAAE,0BAAgB;AAI/B,MAAM,aAAa,GAAG,CAAC,OAAwB,EAA8B,EAAE,CAC7E,OAAO,OAAO,KAAK,QA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ignItems,\n BoxBackgroundColor,\n BoxFlexDirection,\n ButtonIconSize,\n ButtonSize,\n FontWeight,\n IconName,\n TextVariant,\n} from '@metamask/design-system-shared';\nimport React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport { Box } from '../Box';\nimport { Button } from '../Button';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Text } from '../Text';\n\nimport type { BannerBaseProps } from './BannerBase.types';\n\nconst isTextContent = (content: React.ReactNode): content is string | number =>\n typeof content === 'string' || typeof content === 'number';\n\nconst hasContent = (content: React.ReactNode) =>\n content !== null && content !== undefined;\n\nexport const BannerBase = forwardRef<HTMLDivElement, BannerBaseProps>(\n (\n {\n title,\n titleProps,\n description,\n descriptionProps,\n children,\n childrenWrapperProps,\n actionButtonLabel,\n actionButtonOnClick,\n actionButtonProps,\n startAccessory,\n onClose,\n closeButtonProps,\n className,\n ...props\n },\n ref,\n ) => {\n const resolvedActionButtonProps = actionButtonProps ?? {};\n\n const {\n ariaLabel: closeButtonAriaLabel = 'Close banner',\n onClick: closeButtonPropsOnClick,\n className: closeButtonClassName,\n ...resolvedCloseButtonProps\n } = closeButtonProps ?? {};\n\n const shouldShowCloseButton = Boolean(onClose || closeButtonProps);\n const shouldShowActionButton = Boolean(actionButtonOnClick);\n\n return (\n <Box\n ref={ref}\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Start}\n gap={2}\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n padding={3}\n className={twMerge('rounded-sm', className)}\n {...props}\n >\n {startAccessory}\n\n <Box className=\"min-w-0 flex-1\">\n {hasContent(title) &&\n (isTextContent(title) ? (\n <Text\n variant={TextVariant.BodyMd}\n fontWeight={FontWeight.Medium}\n {...titleProps}\n >\n {title}\n </Text>\n ) : (\n title\n ))}\n\n {hasContent(description) && (\n <Box className={hasContent(title) ? 'mt-1' : undefined}>\n {isTextContent(description) ? (\n <Text variant={TextVariant.BodySm} {...descriptionProps}>\n {description}\n </Text>\n ) : (\n description\n )}\n </Box>\n )}\n\n {hasContent(children) &&\n (isTextContent(children) ? (\n <Text variant={TextVariant.BodyMd} {...childrenWrapperProps}>\n {children}\n </Text>\n ) : (\n children\n ))}\n\n {shouldShowActionButton && (\n <Box className=\"mt-4\">\n <Button\n size={ButtonSize.Md}\n onClick={actionButtonOnClick}\n {...resolvedActionButtonProps}\n >\n {actionButtonLabel}\n </Button>\n </Box>\n )}\n </Box>\n\n {shouldShowCloseButton && (\n <ButtonIcon\n className={twMerge('ml-3 self-start', closeButtonClassName)}\n iconName={IconName.Close}\n size={ButtonIconSize.Sm}\n ariaLabel={closeButtonAriaLabel}\n onClick={onClose ?? closeButtonPropsOnClick}\n {...resolvedCloseButtonProps}\n />\n )}\n </Box>\n );\n },\n);\n\nBannerBase.displayName = 'BannerBase';\n"]}
1
+ {"version":3,"file":"BannerBase.mjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,uCAAuC;AACxC,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,OAAO,EAAE,iCAA6B;AAC/C,OAAO,EAAE,GAAG,EAAE,yBAAe;AAC7B,OAAO,EAAE,MAAM,EAAE,4BAAkB;AACnC,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAC3C,OAAO,EAAE,IAAI,EAAE,0BAAgB;AAI/B,MAAM,aAAa,GAAG,CAAC,OAAwB,EAA8B,EAAE,CAC7E,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC;AAE7D,MAAM,UAAU,GAAG,CAAC,OAAwB,EAAE,EAAE,CAC9C,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,CAAC;AAE5C,MAAM,CAAC,MAAM,UAAU,GAAG,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,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IACnD,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAC5B,oBAAC,IAAI,IAAC,OAAO,EAAE,WAAW,CAAC,MAAM,KAAM,gBAAgB,IACpD,WAAW,CACP,CACR,CAAC,CAAC,CAAC,CACF,WAAW,CACZ,CACG,CACP;YAEA,UAAU,CAAC,QAAQ,CAAC;gBACnB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACzB,oBAAC,IAAI,IAAC,OAAO,EAAE,WAAW,CAAC,MAAM,KAAM,oBAAoB,IACxD,QAAQ,CACJ,CACR,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,CAAC;YAEH,sBAAsB,IAAI,CACzB,oBAAC,GAAG,IAAC,SAAS,EAAC,MAAM;gBACnB,oBAAC,MAAM,IACL,IAAI,EAAE,UAAU,CAAC,EAAE,EACnB,OAAO,EAAE,mBAAmB,KACxB,yBAAyB,IAE5B,iBAAiB,CACX,CACL,CACP,CACG;QAEL,qBAAqB,IAAI,CACxB,oBAAC,UAAU,IACT,SAAS,EAAE,OAAO,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,EAC3D,QAAQ,EAAE,QAAQ,CAAC,KAAK,EACxB,IAAI,EAAE,cAAc,CAAC,EAAE,EACvB,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,OAAO,KACZ,wBAAwB,GAC5B,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import {\n BoxAlignItems,\n BoxBackgroundColor,\n BoxFlexDirection,\n ButtonIconSize,\n ButtonSize,\n FontWeight,\n IconName,\n TextVariant,\n} from '@metamask/design-system-shared';\nimport React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport { Box } from '../Box';\nimport { Button } from '../Button';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Text } from '../Text';\n\nimport type { BannerBaseProps } from './BannerBase.types';\n\nconst isTextContent = (content: React.ReactNode): content is string | number =>\n typeof content === 'string' || typeof content === 'number';\n\nconst hasContent = (content: React.ReactNode) =>\n content !== null && content !== undefined;\n\nexport const BannerBase = forwardRef<HTMLDivElement, BannerBaseProps>(\n (\n {\n title,\n titleProps,\n description,\n descriptionProps,\n children,\n childrenWrapperProps,\n actionButtonLabel,\n actionButtonOnClick,\n actionButtonProps,\n startAccessory,\n onClose,\n closeButtonProps,\n className,\n ...props\n },\n ref,\n ) => {\n const resolvedActionButtonProps = actionButtonProps ?? {};\n\n const {\n ariaLabel: closeButtonAriaLabel = 'Close banner',\n className: closeButtonClassName,\n ...resolvedCloseButtonProps\n } = closeButtonProps ?? {};\n\n const shouldShowCloseButton = Boolean(onClose);\n const shouldShowActionButton = Boolean(actionButtonOnClick);\n\n return (\n <Box\n ref={ref}\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Start}\n gap={2}\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n padding={3}\n className={twMerge('rounded-sm', className)}\n {...props}\n >\n {startAccessory}\n\n <Box className=\"min-w-0 flex-1\">\n {hasContent(title) &&\n (isTextContent(title) ? (\n <Text\n variant={TextVariant.BodyMd}\n fontWeight={FontWeight.Medium}\n {...titleProps}\n >\n {title}\n </Text>\n ) : (\n title\n ))}\n\n {hasContent(description) && (\n <Box className={hasContent(title) ? 'mt-1' : undefined}>\n {isTextContent(description) ? (\n <Text variant={TextVariant.BodySm} {...descriptionProps}>\n {description}\n </Text>\n ) : (\n description\n )}\n </Box>\n )}\n\n {hasContent(children) &&\n (isTextContent(children) ? (\n <Text variant={TextVariant.BodyMd} {...childrenWrapperProps}>\n {children}\n </Text>\n ) : (\n children\n ))}\n\n {shouldShowActionButton && (\n <Box className=\"mt-4\">\n <Button\n size={ButtonSize.Md}\n onClick={actionButtonOnClick}\n {...resolvedActionButtonProps}\n >\n {actionButtonLabel}\n </Button>\n </Box>\n )}\n </Box>\n\n {shouldShowCloseButton && (\n <ButtonIcon\n className={twMerge('ml-3 self-start', closeButtonClassName)}\n iconName={IconName.Close}\n size={ButtonIconSize.Sm}\n ariaLabel={closeButtonAriaLabel}\n onClick={onClose}\n {...resolvedCloseButtonProps}\n />\n )}\n </Box>\n );\n },\n);\n\nBannerBase.displayName = 'BannerBase';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BannerBase.types.cjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BannerBasePropsShared } from '@metamask/design-system-shared';\nimport type { MouseEventHandler } from 'react';\n\nimport type { BoxProps } from '../Box';\nimport type { ButtonProps } from '../Button';\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { TextProps } from '../Text';\n\ntype BannerBaseActionButtonProps = Omit<\n Partial<ButtonProps>,\n 'children' | 'onClick' | 'variant'\n>;\n\ntype BannerBaseCloseButtonProps = Omit<\n Partial<ButtonIconProps>,\n 'iconName' | 'onClick'\n> & {\n /**\n * Optional test id for the close button element.\n */\n 'data-testid'?: string;\n /**\n * Optional click handler for the close button.\n */\n onClick?: MouseEventHandler<HTMLButtonElement>;\n};\n\ntype BannerBasePropsBase = BannerBasePropsShared &\n Omit<BoxProps, 'children'> & {\n /**\n * Optional props for the title `Text` when the title is a string.\n */\n titleProps?: Partial<TextProps>;\n /**\n * Optional props for the description `Text` when description is a string.\n */\n descriptionProps?: Partial<TextProps>;\n /**\n * Optional props for the children wrapper `Text` when children is a string.\n */\n childrenWrapperProps?: Partial<TextProps>;\n /**\n * Optional click handler for the close button.\n * If provided, a close button is shown.\n */\n onClose?: MouseEventHandler<HTMLButtonElement>;\n /**\n * Optional props for the close `ButtonIcon`.\n * Providing this also shows a close button.\n */\n closeButtonProps?: BannerBaseCloseButtonProps;\n };\n\ntype BannerBaseActionPropsWithHandler = {\n actionButtonOnClick: MouseEventHandler<HTMLButtonElement>;\n actionButtonLabel: string;\n actionButtonProps?: BannerBaseActionButtonProps;\n};\n\ntype BannerBaseActionPropsWithoutHandler = {\n actionButtonOnClick?: undefined;\n actionButtonLabel?: string;\n actionButtonProps?: BannerBaseActionButtonProps;\n};\n\nexport type BannerBaseProps = BannerBasePropsBase &\n (BannerBaseActionPropsWithHandler | BannerBaseActionPropsWithoutHandler);\n"]}
1
+ {"version":3,"file":"BannerBase.types.cjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BannerBasePropsShared } from '@metamask/design-system-shared';\nimport type { MouseEventHandler } from 'react';\n\nimport type { BoxProps } from '../Box';\nimport type { ButtonProps } from '../Button';\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { TextProps } from '../Text';\n\ntype BannerBaseActionButtonProps = Omit<\n Partial<ButtonProps>,\n 'children' | 'onClick' | 'variant'\n>;\n\ntype BannerBaseCloseButtonProps = Omit<\n Partial<ButtonIconProps>,\n 'iconName' | 'onClick'\n> & {\n /**\n * Optional test id for the close button element.\n */\n 'data-testid'?: string;\n};\n\ntype BannerBasePropsBase = BannerBasePropsShared &\n Omit<BoxProps, 'children'> & {\n /**\n * Optional props for the title `Text` when the title is a string.\n */\n titleProps?: Partial<TextProps>;\n /**\n * Optional props for the description `Text` when description is a string.\n */\n descriptionProps?: Partial<TextProps>;\n /**\n * Optional props for the children wrapper `Text` when children is a string.\n */\n childrenWrapperProps?: Partial<TextProps>;\n /**\n * Optional click handler for the close button.\n * If provided, a close button is shown.\n */\n onClose?: MouseEventHandler<HTMLButtonElement>;\n /**\n * Optional props for the close `ButtonIcon`.\n * Only used when `onClose` is provided.\n */\n closeButtonProps?: BannerBaseCloseButtonProps;\n };\n\ntype BannerBaseActionPropsWithHandler = {\n actionButtonOnClick: MouseEventHandler<HTMLButtonElement>;\n actionButtonLabel: string;\n actionButtonProps?: BannerBaseActionButtonProps;\n};\n\ntype BannerBaseActionPropsWithoutHandler = {\n actionButtonOnClick?: undefined;\n actionButtonLabel?: string;\n actionButtonProps?: BannerBaseActionButtonProps;\n};\n\nexport type BannerBaseProps = BannerBasePropsBase &\n (BannerBaseActionPropsWithHandler | BannerBaseActionPropsWithoutHandler);\n"]}
@@ -10,10 +10,6 @@ type BannerBaseCloseButtonProps = Omit<Partial<ButtonIconProps>, 'iconName' | 'o
10
10
  * Optional test id for the close button element.
11
11
  */
12
12
  'data-testid'?: string;
13
- /**
14
- * Optional click handler for the close button.
15
- */
16
- onClick?: MouseEventHandler<HTMLButtonElement>;
17
13
  };
18
14
  type BannerBasePropsBase = BannerBasePropsShared & Omit<BoxProps, 'children'> & {
19
15
  /**
@@ -35,7 +31,7 @@ type BannerBasePropsBase = BannerBasePropsShared & Omit<BoxProps, 'children'> &
35
31
  onClose?: MouseEventHandler<HTMLButtonElement>;
36
32
  /**
37
33
  * Optional props for the close `ButtonIcon`.
38
- * Providing this also shows a close button.
34
+ * Only used when `onClose` is provided.
39
35
  */
40
36
  closeButtonProps?: BannerBaseCloseButtonProps;
41
37
  };
@@ -1 +1 @@
1
- {"version":3,"file":"BannerBase.types.d.cts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,uCAAuC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc;AAE/C,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAe;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,4BAAkB;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AAEzC,KAAK,2BAA2B,GAAG,IAAI,CACrC,OAAO,CAAC,WAAW,CAAC,EACpB,UAAU,GAAG,SAAS,GAAG,SAAS,CACnC,CAAC;AAEF,KAAK,0BAA0B,GAAG,IAAI,CACpC,OAAO,CAAC,eAAe,CAAC,EACxB,UAAU,GAAG,SAAS,CACvB,GAAG;IACF;;OAEG;IACH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@ type BannerBaseCloseButtonProps = Omit<Partial<ButtonIconProps>, 'iconName' | 'o
10
10
  * Optional test id for the close button element.
11
11
  */
12
12
  'data-testid'?: string;
13
- /**
14
- * Optional click handler for the close button.
15
- */
16
- onClick?: MouseEventHandler<HTMLButtonElement>;
17
13
  };
18
14
  type BannerBasePropsBase = BannerBasePropsShared & Omit<BoxProps, 'children'> & {
19
15
  /**
@@ -35,7 +31,7 @@ type BannerBasePropsBase = BannerBasePropsShared & Omit<BoxProps, 'children'> &
35
31
  onClose?: MouseEventHandler<HTMLButtonElement>;
36
32
  /**
37
33
  * Optional props for the close `ButtonIcon`.
38
- * Providing this also shows a close button.
34
+ * Only used when `onClose` is provided.
39
35
  */
40
36
  closeButtonProps?: BannerBaseCloseButtonProps;
41
37
  };
@@ -1 +1 @@
1
- {"version":3,"file":"BannerBase.types.d.mts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,uCAAuC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc;AAE/C,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAe;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,4BAAkB;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AAEzC,KAAK,2BAA2B,GAAG,IAAI,CACrC,OAAO,CAAC,WAAW,CAAC,EACpB,UAAU,GAAG,SAAS,GAAG,SAAS,CACnC,CAAC;AAEF,KAAK,0BAA0B,GAAG,IAAI,CACpC,OAAO,CAAC,eAAe,CAAC,EACxB,UAAU,GAAG,SAAS,CACvB,GAAG;IACF;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;CAChD,CAAC;AAEF,KAAK,mBAAmB,GAAG,qB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AAC,WAAW,CAAC,EACpB,UAAU,GAAG,SAAS,GAAG,SAAS,CACnC,CAAC;AAEF,KAAK,0BAA0B,GAAG,IAAI,CACpC,OAAO,CAAC,eAAe,CAAC,EACxB,UAAU,GAAG,SAAS,CACvB,GAAG;IACF;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,KAAK,mBAAmB,GAAG,qBAAqB,GAC9C,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,GAAG;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACtC;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1C;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC/C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,0BAA0B,CAAC;CAC/C,CAAC;AAEJ,KAAK,gCAAgC,GAAG;IACtC,mBAAmB,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC1D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,2BAA2B,CAAC;CACjD,CAAC;AAEF,KAAK,mCAAmC,GAAG;IACzC,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,2BAA2B,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAC/C,CAAC,gCAAgC,GAAG,mCAAmC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"BannerBase.types.mjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BannerBasePropsShared } from '@metamask/design-system-shared';\nimport type { MouseEventHandler } from 'react';\n\nimport type { BoxProps } from '../Box';\nimport type { ButtonProps } from '../Button';\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { TextProps } from '../Text';\n\ntype BannerBaseActionButtonProps = Omit<\n Partial<ButtonProps>,\n 'children' | 'onClick' | 'variant'\n>;\n\ntype BannerBaseCloseButtonProps = Omit<\n Partial<ButtonIconProps>,\n 'iconName' | 'onClick'\n> & {\n /**\n * Optional test id for the close button element.\n */\n 'data-testid'?: string;\n /**\n * Optional click handler for the close button.\n */\n onClick?: MouseEventHandler<HTMLButtonElement>;\n};\n\ntype BannerBasePropsBase = BannerBasePropsShared &\n Omit<BoxProps, 'children'> & {\n /**\n * Optional props for the title `Text` when the title is a string.\n */\n titleProps?: Partial<TextProps>;\n /**\n * Optional props for the description `Text` when description is a string.\n */\n descriptionProps?: Partial<TextProps>;\n /**\n * Optional props for the children wrapper `Text` when children is a string.\n */\n childrenWrapperProps?: Partial<TextProps>;\n /**\n * Optional click handler for the close button.\n * If provided, a close button is shown.\n */\n onClose?: MouseEventHandler<HTMLButtonElement>;\n /**\n * Optional props for the close `ButtonIcon`.\n * Providing this also shows a close button.\n */\n closeButtonProps?: BannerBaseCloseButtonProps;\n };\n\ntype BannerBaseActionPropsWithHandler = {\n actionButtonOnClick: MouseEventHandler<HTMLButtonElement>;\n actionButtonLabel: string;\n actionButtonProps?: BannerBaseActionButtonProps;\n};\n\ntype BannerBaseActionPropsWithoutHandler = {\n actionButtonOnClick?: undefined;\n actionButtonLabel?: string;\n actionButtonProps?: BannerBaseActionButtonProps;\n};\n\nexport type BannerBaseProps = BannerBasePropsBase &\n (BannerBaseActionPropsWithHandler | BannerBaseActionPropsWithoutHandler);\n"]}
1
+ {"version":3,"file":"BannerBase.types.mjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BannerBasePropsShared } from '@metamask/design-system-shared';\nimport type { MouseEventHandler } from 'react';\n\nimport type { BoxProps } from '../Box';\nimport type { ButtonProps } from '../Button';\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { TextProps } from '../Text';\n\ntype BannerBaseActionButtonProps = Omit<\n Partial<ButtonProps>,\n 'children' | 'onClick' | 'variant'\n>;\n\ntype BannerBaseCloseButtonProps = Omit<\n Partial<ButtonIconProps>,\n 'iconName' | 'onClick'\n> & {\n /**\n * Optional test id for the close button element.\n */\n 'data-testid'?: string;\n};\n\ntype BannerBasePropsBase = BannerBasePropsShared &\n Omit<BoxProps, 'children'> & {\n /**\n * Optional props for the title `Text` when the title is a string.\n */\n titleProps?: Partial<TextProps>;\n /**\n * Optional props for the description `Text` when description is a string.\n */\n descriptionProps?: Partial<TextProps>;\n /**\n * Optional props for the children wrapper `Text` when children is a string.\n */\n childrenWrapperProps?: Partial<TextProps>;\n /**\n * Optional click handler for the close button.\n * If provided, a close button is shown.\n */\n onClose?: MouseEventHandler<HTMLButtonElement>;\n /**\n * Optional props for the close `ButtonIcon`.\n * Only used when `onClose` is provided.\n */\n closeButtonProps?: BannerBaseCloseButtonProps;\n };\n\ntype BannerBaseActionPropsWithHandler = {\n actionButtonOnClick: MouseEventHandler<HTMLButtonElement>;\n actionButtonLabel: string;\n actionButtonProps?: BannerBaseActionButtonProps;\n};\n\ntype BannerBaseActionPropsWithoutHandler = {\n actionButtonOnClick?: undefined;\n actionButtonLabel?: string;\n actionButtonProps?: BannerBaseActionButtonProps;\n};\n\nexport type BannerBaseProps = BannerBasePropsBase &\n (BannerBaseActionPropsWithHandler | BannerBaseActionPropsWithoutHandler);\n"]}
@@ -34,6 +34,13 @@ const ButtonBase_constants_1 = require("./ButtonBase.constants.cjs");
34
34
  exports.ButtonBase = (0, react_1.forwardRef)(({ children, className, size = design_system_shared_1.ButtonBaseSize.Lg, isFullWidth, asChild, isDisabled, isLoading, loadingText, loadingIconProps, loadingTextProps, startIconName, startIconProps, startAccessory, endIconName, endIconProps, endAccessory, textProps, style, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, 'aria-pressed': ariaPressed, 'aria-expanded': ariaExpanded, 'aria-controls': ariaControls, 'aria-haspopup': ariaHaspopup, ...props }, ref) => {
35
35
  const Component = asChild ? react_slot_1.Slot : 'button';
36
36
  const isInteractive = !(isDisabled ?? isLoading);
37
+ const finalStartIconName = startIconName ?? startIconProps?.name;
38
+ const finalEndIconName = endIconName ?? endIconProps?.name;
39
+ const hasStart = Boolean(finalStartIconName || startAccessory);
40
+ const hasEnd = Boolean(finalEndIconName || endAccessory);
41
+ const hasAccessories = hasStart || hasEnd;
42
+ const iconSize = ButtonBase_constants_1.MAP_BUTTONBASE_SIZE_ICONSIZE[size];
43
+ const labelTextVariant = ButtonBase_constants_1.MAP_BUTTONBASE_SIZE_TEXT_VARIANT[size];
37
44
  // Calculate tabIndex based on asChild and disabled state
38
45
  const getTabIndex = () => {
39
46
  if (asChild) {
@@ -41,41 +48,42 @@ exports.ButtonBase = (0, react_1.forwardRef)(({ children, className, size = desi
41
48
  }
42
49
  return isDisabled ? -1 : undefined;
43
50
  };
51
+ const renderLabel = () => {
52
+ if (children && typeof children === 'string') {
53
+ return (react_1.default.createElement(Text_1.Text, { variant: labelTextVariant, fontWeight: Text_1.FontWeight.Medium, color: Text_1.TextColor.Inherit, asChild: true, ...textProps },
54
+ react_1.default.createElement("span", null, children)));
55
+ }
56
+ return children;
57
+ };
44
58
  const renderLoadingState = () => (react_1.default.createElement(react_1.default.Fragment, null,
45
- react_1.default.createElement("span", { className: "absolute inline-flex items-center", "aria-hidden": "true" },
46
- react_1.default.createElement(Icon_1.Icon, { name: design_system_shared_1.IconName.Loading, size: Icon_1.IconSize.Sm, className: (0, tw_merge_1.twMerge)('mr-2 animate-spin text-inherit', loadingIconProps?.className), ...loadingIconProps }),
47
- react_1.default.createElement(Text_1.Text, { fontWeight: Text_1.FontWeight.Medium, color: Text_1.TextColor.Inherit, asChild: true, ...loadingTextProps },
59
+ react_1.default.createElement("span", { className: "absolute inline-flex items-center gap-x-1", "aria-hidden": "true" },
60
+ react_1.default.createElement(Icon_1.Icon, { name: design_system_shared_1.IconName.Loading, size: iconSize, className: (0, tw_merge_1.twMerge)('animate-spin text-inherit', loadingIconProps?.className), ...loadingIconProps }),
61
+ react_1.default.createElement(Text_1.Text, { variant: labelTextVariant, fontWeight: Text_1.FontWeight.Medium, color: Text_1.TextColor.Inherit, asChild: true, ...loadingTextProps },
48
62
  react_1.default.createElement("span", null, loadingText))),
49
- react_1.default.createElement("span", { className: "invisible inline-flex items-center" }, children),
63
+ react_1.default.createElement("span", { className: "invisible inline-flex items-center", "aria-hidden": "true" }, renderLabel()),
50
64
  react_1.default.createElement("span", { className: "sr-only", "aria-live": "polite", "aria-atomic": "true" }, loadingText || 'Loading')));
51
65
  const renderStartContent = () => {
52
- if (startIconName) {
53
- return (react_1.default.createElement(Icon_1.Icon, { name: startIconName, size: Icon_1.IconSize.Sm, className: (0, tw_merge_1.twMerge)('mr-2 shrink-0 text-inherit', startIconProps?.className), "aria-hidden": "true", ...startIconProps }));
66
+ if (finalStartIconName) {
67
+ return (react_1.default.createElement(Icon_1.Icon, { name: finalStartIconName, size: iconSize, className: (0, tw_merge_1.twMerge)('shrink-0 text-inherit', startIconProps?.className), "aria-hidden": "true", ...startIconProps }));
54
68
  }
55
69
  if (startAccessory) {
56
- return (react_1.default.createElement("span", { className: "mr-2", "aria-hidden": "true" }, startAccessory));
70
+ return react_1.default.createElement("span", { "aria-hidden": "true" }, startAccessory);
57
71
  }
58
72
  return null;
59
73
  };
60
74
  const renderEndContent = () => {
61
- if (endIconName) {
62
- return (react_1.default.createElement(Icon_1.Icon, { name: endIconName, size: Icon_1.IconSize.Sm, className: (0, tw_merge_1.twMerge)('ml-2 shrink-0 text-inherit', endIconProps?.className), "aria-hidden": "true", ...endIconProps }));
75
+ if (finalEndIconName) {
76
+ return (react_1.default.createElement(Icon_1.Icon, { name: finalEndIconName, size: iconSize, className: (0, tw_merge_1.twMerge)('shrink-0 text-inherit', endIconProps?.className), "aria-hidden": "true", ...endIconProps }));
63
77
  }
64
78
  if (endAccessory) {
65
- return (react_1.default.createElement("span", { className: "ml-2", "aria-hidden": "true" }, endAccessory));
79
+ return react_1.default.createElement("span", { "aria-hidden": "true" }, endAccessory);
66
80
  }
67
81
  return null;
68
82
  };
69
- const renderContent = () => {
70
- if (children && typeof children === 'string') {
71
- return (react_1.default.createElement(Text_1.Text, { fontWeight: Text_1.FontWeight.Medium, color: Text_1.TextColor.Inherit, asChild: true, ...textProps },
72
- react_1.default.createElement("span", null, children)));
73
- }
74
- return children;
75
- };
83
+ const renderContent = () => renderLabel();
76
84
  const mergedClassName = (0, tw_merge_1.twMerge)(
77
85
  // Base styles
78
- 'inline-flex items-center justify-center', 'rounded-xl px-4', 'font-medium text-default', 'bg-muted', 'min-w-20 overflow-hidden',
86
+ 'inline-flex items-center justify-center', (0, ButtonBase_constants_1.getButtonBaseBorderRadiusTwClass)(size), (0, ButtonBase_constants_1.getButtonBaseHorizontalPaddingTwClasses)(size, hasStart, hasEnd), hasAccessories && 'gap-x-1', 'font-medium text-default', 'bg-muted', 'overflow-hidden',
79
87
  // Add relative positioning for loading state
80
88
  'relative',
81
89
  // Size
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonBase.cjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAA0E;AAC1E,qDAAuD;AACvD,+CAA0C;AAE1C,uDAA+C;AAC/C,4CAAyC;AACzC,4CAAsD;AAEtD,qEAA8E;AAGjE,QAAA,UAAU,GAAG,IAAA,kBAAU,EAClC,CACE,EACE,QAAQ,EACR,SAAS,EACT,IAAI,GAAG,qCAAc,CAAC,EAAE,EACxB,WAAW,EACX,OAAO,EACP,UAAU,EACV,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,cAAc,EACd,WAAW,EACX,Y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B,EACjB,0BAA0B,EAC1B,UAAU,EACV,0BAA0B;IAC1B,6CAA6C;IAC7C,UAAU;IACV,OAAO;IACP,2DAAoC,CAAC,IAAI,CAAC;IAC1C,aAAa;IACb,WAAW,IAAI,QAAQ;IACvB,oDAAoD;IACpD,aAAa,IAAI;QACf,gBAAgB;QAChB,cAAc;QACd,aAAa;QACb,qBAAqB;QACrB,2CAA2C;KAC5C;IACD,0DAA0D;IAC1D,CAAC,UAAU,IAAI,SAAS,CAAC,IAAI,oBAAoB,EACjD,UAAU,IAAI,YAAY;IAC1B,iBAAiB;IACjB,SAAS,CACV,CAAC;IAEF,OAAO,CACL,8BAAC,SAAS,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,mBAC1C,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,eACnC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,gBAC7B,SAAS,qBACJ,cAAc,sBACb,eAAe,kBACnB,WAAW,mBACV,YAAY,mBACZ,YAAY,mBACZ,YAAY,EAC3B,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EACpC,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,KAAK,KACR,KAAK;QAER,kBAAkB,EAAE;QACrB,8BAAC,sBAAS,QACP,SAAS,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,CACzC;QACX,gBAAgB,EAAE,CACT,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import { ButtonBaseSize, IconName } from '@metamask/design-system-shared';\nimport { Slot, Slottable } from '@radix-ui/react-slot';\nimport React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport { Icon, IconSize } from '../Icon';\nimport { Text, FontWeight, TextColor } from '../Text';\n\nimport { TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION } from './ButtonBase.constants';\nimport type { ButtonBaseProps } from './ButtonBase.types';\n\nexport const ButtonBase = forwardRef<HTMLButtonElement, ButtonBaseProps>(\n (\n {\n children,\n className,\n size = ButtonBaseSize.Lg,\n isFullWidth,\n asChild,\n isDisabled,\n isLoading,\n loadingText,\n loadingIconProps,\n loadingTextProps,\n startIconName,\n startIconProps,\n startAccessory,\n endIconName,\n endIconProps,\n endAccessory,\n textProps,\n style,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-pressed': ariaPressed,\n 'aria-expanded': ariaExpanded,\n 'aria-controls': ariaControls,\n 'aria-haspopup': ariaHaspopup,\n ...props\n },\n ref,\n ) => {\n const Component = asChild ? Slot : 'button';\n const isInteractive = !(isDisabled ?? isLoading);\n\n // Calculate tabIndex based on asChild and disabled state\n const getTabIndex = () => {\n if (asChild) {\n return undefined;\n }\n return isDisabled ? -1 : undefined;\n };\n\n const renderLoadingState = () => (\n <>\n <span className=\"absolute inline-flex items-center\" aria-hidden=\"true\">\n <Icon\n name={IconName.Loading}\n size={IconSize.Sm}\n className={twMerge(\n 'mr-2 animate-spin text-inherit',\n loadingIconProps?.className,\n )}\n {...loadingIconProps}\n />\n <Text\n fontWeight={FontWeight.Medium}\n color={TextColor.Inherit}\n asChild\n {...loadingTextProps}\n >\n <span>{loadingText}</span>\n </Text>\n </span>\n <span className=\"invisible inline-flex items-center\">{children}</span>\n {/* Screen reader announcement for loading */}\n <span className=\"sr-only\" aria-live=\"polite\" aria-atomic=\"true\">\n {loadingText || 'Loading'}\n </span>\n </>\n );\n\n const renderStartContent = () => {\n if (startIconName) {\n return (\n <Icon\n name={startIconName}\n size={IconSize.Sm}\n className={twMerge(\n 'mr-2 shrink-0 text-inherit',\n startIconProps?.className,\n )}\n aria-hidden=\"true\"\n {...startIconProps}\n />\n );\n }\n if (startAccessory) {\n return (\n <span className=\"mr-2\" aria-hidden=\"true\">\n {startAccessory}\n </span>\n );\n }\n return null;\n };\n\n const renderEndContent = () => {\n if (endIconName) {\n return (\n <Icon\n name={endIconName}\n size={IconSize.Sm}\n className={twMerge(\n 'ml-2 shrink-0 text-inherit',\n endIconProps?.className,\n )}\n aria-hidden=\"true\"\n {...endIconProps}\n />\n );\n }\n if (endAccessory) {\n return (\n <span className=\"ml-2\" aria-hidden=\"true\">\n {endAccessory}\n </span>\n );\n }\n return null;\n };\n\n const renderContent = () => {\n if (children && typeof children === 'string') {\n return (\n <Text\n fontWeight={FontWeight.Medium}\n color={TextColor.Inherit}\n asChild\n {...textProps}\n >\n <span>{children}</span>\n </Text>\n );\n }\n return children;\n };\n\n const mergedClassName = twMerge(\n // Base styles\n 'inline-flex items-center justify-center',\n 'rounded-xl px-4',\n 'font-medium text-default',\n 'bg-muted',\n 'min-w-20 overflow-hidden',\n // Add relative positioning for loading state\n 'relative',\n // Size\n TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION[size],\n // Full width\n isFullWidth && 'w-full',\n // Animation classes - only applied when interactive\n isInteractive && [\n 'transition-all',\n 'duration-100',\n 'ease-linear',\n 'active:scale-[0.97]',\n 'active:ease-[cubic-bezier(0.3,0.8,0.3,1)]',\n ],\n // Disabled state - apply to both isDisabled and isLoading\n (isDisabled || isLoading) && 'cursor-not-allowed',\n isDisabled && 'opacity-50',\n // Custom classes\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={mergedClassName}\n disabled={asChild ? undefined : (isDisabled ?? isLoading)}\n aria-disabled={isDisabled ? 'true' : undefined}\n aria-busy={isLoading ? 'true' : undefined}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n aria-pressed={ariaPressed}\n aria-expanded={ariaExpanded}\n aria-controls={ariaControls}\n aria-haspopup={ariaHaspopup}\n role={asChild ? undefined : 'button'}\n tabIndex={getTabIndex()}\n style={style}\n {...props}\n >\n {renderStartContent()}\n <Slottable>\n {isLoading ? renderLoadingState() : renderContent()}\n </Slottable>\n {renderEndContent()}\n </Component>\n );\n },\n);\n\nButtonBase.displayName = 'ButtonBase';\n"]}
1
+ {"version":3,"file":"ButtonBase.cjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAA0E;AAC1E,qDAAuD;AACvD,+CAA0C;AAE1C,uDAA+C;AAC/C,4CAA+B;AAC/B,4CAAsD;AAEtD,qEAMgC;AAGnB,QAAA,UAAU,GAAG,IAAA,kBAAU,EAClC,CACE,EACE,QAAQ,EACR,SAAS,EACT,IAAI,GAAG,qCAAc,CAAC,EAAE,EACxB,WAAW,EACX,OAAO,EACP,UAAU,EACV,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,cAAc,EAAE,WAAW,EAC3B,eAAe,EAAE,YAAY,EAC7B,eAAe,EAAE,YAAY,EAC7B,eAAe,EAAE,YAAY,EAC7B,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,iBAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC5C,MAAM,aAAa,GAAG,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC;IAEjD,MAAM,kBAAkB,GAAG,aAAa,IAAI,cAAc,EAAE,IAAI,CAAC;IACjE,MAAM,gBAAgB,GAAG,WAAW,IAAI,YAAY,EAAE,IAAI,CAAC;IAC3D,MAAM,QAAQ,GAAG,O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,cAAc,IAAI,SAAS,EAC3B,0BAA0B,EAC1B,UAAU,EACV,iBAAiB;IACjB,6CAA6C;IAC7C,UAAU;IACV,OAAO;IACP,2DAAoC,CAAC,IAAI,CAAC;IAC1C,aAAa;IACb,WAAW,IAAI,QAAQ;IACvB,oDAAoD;IACpD,aAAa,IAAI;QACf,gBAAgB;QAChB,cAAc;QACd,aAAa;QACb,qBAAqB;QACrB,2CAA2C;KAC5C;IACD,0DAA0D;IAC1D,CAAC,UAAU,IAAI,SAAS,CAAC,IAAI,oBAAoB,EACjD,UAAU,IAAI,YAAY;IAC1B,iBAAiB;IACjB,SAAS,CACV,CAAC;IAEF,OAAO,CACL,8BAAC,SAAS,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,IAAI,SAAS,CAAC,mBAC1C,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,eACnC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,gBAC7B,SAAS,qBACJ,cAAc,sBACb,eAAe,kBACnB,WAAW,mBACV,YAAY,mBACZ,YAAY,mBACZ,YAAY,EAC3B,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EACpC,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,KAAK,KACR,KAAK;QAER,kBAAkB,EAAE;QACrB,8BAAC,sBAAS,QACP,SAAS,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,CACzC;QACX,gBAAgB,EAAE,CACT,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import { ButtonBaseSize, IconName } from '@metamask/design-system-shared';\nimport { Slot, Slottable } from '@radix-ui/react-slot';\nimport React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport { Icon } from '../Icon';\nimport { Text, FontWeight, TextColor } from '../Text';\n\nimport {\n MAP_BUTTONBASE_SIZE_ICONSIZE,\n MAP_BUTTONBASE_SIZE_TEXT_VARIANT,\n getButtonBaseBorderRadiusTwClass,\n getButtonBaseHorizontalPaddingTwClasses,\n TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION,\n} from './ButtonBase.constants';\nimport type { ButtonBaseProps } from './ButtonBase.types';\n\nexport const ButtonBase = forwardRef<HTMLButtonElement, ButtonBaseProps>(\n (\n {\n children,\n className,\n size = ButtonBaseSize.Lg,\n isFullWidth,\n asChild,\n isDisabled,\n isLoading,\n loadingText,\n loadingIconProps,\n loadingTextProps,\n startIconName,\n startIconProps,\n startAccessory,\n endIconName,\n endIconProps,\n endAccessory,\n textProps,\n style,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-pressed': ariaPressed,\n 'aria-expanded': ariaExpanded,\n 'aria-controls': ariaControls,\n 'aria-haspopup': ariaHaspopup,\n ...props\n },\n ref,\n ) => {\n const Component = asChild ? Slot : 'button';\n const isInteractive = !(isDisabled ?? isLoading);\n\n const finalStartIconName = startIconName ?? startIconProps?.name;\n const finalEndIconName = endIconName ?? endIconProps?.name;\n const hasStart = Boolean(finalStartIconName || startAccessory);\n const hasEnd = Boolean(finalEndIconName || endAccessory);\n const hasAccessories = hasStart || hasEnd;\n const iconSize = MAP_BUTTONBASE_SIZE_ICONSIZE[size];\n const labelTextVariant = MAP_BUTTONBASE_SIZE_TEXT_VARIANT[size];\n\n // Calculate tabIndex based on asChild and disabled state\n const getTabIndex = () => {\n if (asChild) {\n return undefined;\n }\n return isDisabled ? -1 : undefined;\n };\n\n const renderLabel = () => {\n if (children && typeof children === 'string') {\n return (\n <Text\n variant={labelTextVariant}\n fontWeight={FontWeight.Medium}\n color={TextColor.Inherit}\n asChild\n {...textProps}\n >\n <span>{children}</span>\n </Text>\n );\n }\n return children;\n };\n\n const renderLoadingState = () => (\n <>\n <span\n className=\"absolute inline-flex items-center gap-x-1\"\n aria-hidden=\"true\"\n >\n <Icon\n name={IconName.Loading}\n size={iconSize}\n className={twMerge(\n 'animate-spin text-inherit',\n loadingIconProps?.className,\n )}\n {...loadingIconProps}\n />\n <Text\n variant={labelTextVariant}\n fontWeight={FontWeight.Medium}\n color={TextColor.Inherit}\n asChild\n {...loadingTextProps}\n >\n <span>{loadingText}</span>\n </Text>\n </span>\n <span className=\"invisible inline-flex items-center\" aria-hidden=\"true\">\n {renderLabel()}\n </span>\n {/* Screen reader announcement for loading */}\n <span className=\"sr-only\" aria-live=\"polite\" aria-atomic=\"true\">\n {loadingText || 'Loading'}\n </span>\n </>\n );\n\n const renderStartContent = () => {\n if (finalStartIconName) {\n return (\n <Icon\n name={finalStartIconName}\n size={iconSize}\n className={twMerge(\n 'shrink-0 text-inherit',\n startIconProps?.className,\n )}\n aria-hidden=\"true\"\n {...startIconProps}\n />\n );\n }\n if (startAccessory) {\n return <span aria-hidden=\"true\">{startAccessory}</span>;\n }\n return null;\n };\n\n const renderEndContent = () => {\n if (finalEndIconName) {\n return (\n <Icon\n name={finalEndIconName}\n size={iconSize}\n className={twMerge(\n 'shrink-0 text-inherit',\n endIconProps?.className,\n )}\n aria-hidden=\"true\"\n {...endIconProps}\n />\n );\n }\n if (endAccessory) {\n return <span aria-hidden=\"true\">{endAccessory}</span>;\n }\n return null;\n };\n\n const renderContent = () => renderLabel();\n\n const mergedClassName = twMerge(\n // Base styles\n 'inline-flex items-center justify-center',\n getButtonBaseBorderRadiusTwClass(size),\n getButtonBaseHorizontalPaddingTwClasses(size, hasStart, hasEnd),\n hasAccessories && 'gap-x-1',\n 'font-medium text-default',\n 'bg-muted',\n 'overflow-hidden',\n // Add relative positioning for loading state\n 'relative',\n // Size\n TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION[size],\n // Full width\n isFullWidth && 'w-full',\n // Animation classes - only applied when interactive\n isInteractive && [\n 'transition-all',\n 'duration-100',\n 'ease-linear',\n 'active:scale-[0.97]',\n 'active:ease-[cubic-bezier(0.3,0.8,0.3,1)]',\n ],\n // Disabled state - apply to both isDisabled and isLoading\n (isDisabled || isLoading) && 'cursor-not-allowed',\n isDisabled && 'opacity-50',\n // Custom classes\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={mergedClassName}\n disabled={asChild ? undefined : (isDisabled ?? isLoading)}\n aria-disabled={isDisabled ? 'true' : undefined}\n aria-busy={isLoading ? 'true' : undefined}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n aria-pressed={ariaPressed}\n aria-expanded={ariaExpanded}\n aria-controls={ariaControls}\n aria-haspopup={ariaHaspopup}\n role={asChild ? undefined : 'button'}\n tabIndex={getTabIndex()}\n style={style}\n {...props}\n >\n {renderStartContent()}\n <Slottable>\n {isLoading ? renderLoadingState() : renderContent()}\n </Slottable>\n {renderEndContent()}\n </Component>\n );\n },\n);\n\nButtonBase.displayName = 'ButtonBase';\n"]}