@babylonlabs-io/core-ui 1.12.0 → 1.14.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 (411) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +2 -2
  2. package/dist/components/Accordion/Accordion.js +25 -0
  3. package/dist/components/Accordion/Accordion.stories.d.ts +6 -0
  4. package/dist/components/Accordion/Accordion.stories.js +16 -0
  5. package/dist/components/Accordion/components/AccordionDetails.d.ts +1 -1
  6. package/dist/components/Accordion/components/AccordionDetails.js +29 -0
  7. package/dist/components/Accordion/components/AccordionSummary.d.ts +1 -1
  8. package/dist/components/Accordion/components/AccordionSummary.js +10 -0
  9. package/dist/components/Accordion/hooks/useHeightObserver.d.ts +1 -1
  10. package/dist/components/Accordion/hooks/useHeightObserver.js +24 -0
  11. package/dist/components/Accordion/index.d.ts +4 -3
  12. package/dist/components/Accordion/index.js +4 -0
  13. package/dist/components/AmountItem/AmountItem.d.ts +1 -1
  14. package/dist/components/AmountItem/AmountItem.js +5 -0
  15. package/dist/components/AmountItem/AmountItem.stories.d.ts +6 -0
  16. package/dist/components/AmountItem/AmountItem.stories.js +29 -0
  17. package/dist/components/AmountItem/index.d.ts +1 -1
  18. package/dist/components/AmountItem/index.js +1 -0
  19. package/dist/components/Avatar/Avatar.d.ts +2 -1
  20. package/dist/components/Avatar/Avatar.js +6 -0
  21. package/dist/components/Avatar/Avatar.stories.d.ts +7 -0
  22. package/dist/components/Avatar/Avatar.stories.js +18 -0
  23. package/dist/components/Avatar/AvatarGroup.d.ts +3 -2
  24. package/dist/components/Avatar/AvatarGroup.js +15 -0
  25. package/dist/components/Avatar/AvatarGroup.stories.d.ts +6 -0
  26. package/dist/components/Avatar/AvatarGroup.stories.js +21 -0
  27. package/dist/components/Avatar/index.d.ts +2 -2
  28. package/dist/components/Avatar/index.js +2 -0
  29. package/dist/components/Badge/Badge.d.ts +2 -1
  30. package/dist/components/Badge/Badge.js +10 -0
  31. package/dist/components/Badge/Badge.stories.d.ts +6 -0
  32. package/dist/components/Badge/Badge.stories.js +14 -0
  33. package/dist/components/Badge/index.d.ts +1 -1
  34. package/dist/components/Badge/index.js +1 -0
  35. package/dist/components/Button/Button.d.ts +3 -2
  36. package/dist/components/Button/Button.js +8 -0
  37. package/dist/components/Button/Button.stories.d.ts +6 -0
  38. package/dist/components/Button/Button.stories.js +9 -0
  39. package/dist/components/Button/IconButton.d.ts +2 -1
  40. package/dist/components/Button/IconButton.js +6 -0
  41. package/dist/components/Button/IconButton.stories.d.ts +6 -0
  42. package/dist/components/Button/IconButton.stories.js +13 -0
  43. package/dist/components/Button/WalletDisconnectButton.d.ts +2 -2
  44. package/dist/components/Button/WalletDisconnectButton.js +8 -0
  45. package/dist/components/Button/index.d.ts +3 -3
  46. package/dist/components/Button/index.js +3 -0
  47. package/dist/components/Card/Card.d.ts +4 -3
  48. package/dist/components/Card/Card.js +6 -0
  49. package/dist/components/Card/Card.stories.d.ts +6 -0
  50. package/dist/components/Card/Card.stories.js +10 -0
  51. package/dist/components/Card/index.d.ts +1 -1
  52. package/dist/components/Card/index.js +1 -0
  53. package/dist/components/Chip/Chip.d.ts +2 -1
  54. package/dist/components/Chip/Chip.js +6 -0
  55. package/dist/components/Chip/Chip.stories.d.ts +6 -0
  56. package/dist/components/Chip/Chip.stories.js +9 -0
  57. package/dist/components/Chip/index.d.ts +1 -1
  58. package/dist/components/Chip/index.js +1 -0
  59. package/dist/components/Copy/Copy.d.ts +1 -1
  60. package/dist/components/Copy/Copy.js +29 -0
  61. package/dist/components/Copy/index.js +1 -0
  62. package/dist/components/CounterButton/CounterButton.js +8 -0
  63. package/dist/components/CounterButton/CounterButton.stories.d.ts +10 -0
  64. package/dist/components/CounterButton/CounterButton.stories.js +41 -0
  65. package/dist/components/CounterButton/index.d.ts +1 -1
  66. package/dist/components/CounterButton/index.js +1 -0
  67. package/dist/components/Dialog/Dialog.d.ts +1 -1
  68. package/dist/components/Dialog/Dialog.js +9 -0
  69. package/dist/components/Dialog/Dialog.stories.d.ts +7 -0
  70. package/dist/components/Dialog/Dialog.stories.js +41 -0
  71. package/dist/components/Dialog/MobileDialog.d.ts +1 -1
  72. package/dist/components/Dialog/MobileDialog.js +10 -0
  73. package/dist/components/Dialog/MobileDialog.stories.d.ts +6 -0
  74. package/dist/components/Dialog/MobileDialog.stories.js +27 -0
  75. package/dist/components/Dialog/components/Backdrop.d.ts +2 -1
  76. package/dist/components/Dialog/components/Backdrop.js +4 -0
  77. package/dist/components/Dialog/components/DialogBody.d.ts +1 -1
  78. package/dist/components/Dialog/components/DialogBody.js +3 -0
  79. package/dist/components/Dialog/components/DialogFooter.d.ts +1 -1
  80. package/dist/components/Dialog/components/DialogFooter.js +3 -0
  81. package/dist/components/Dialog/components/DialogHeader.d.ts +1 -1
  82. package/dist/components/Dialog/components/DialogHeader.js +5 -0
  83. package/dist/components/Dialog/index.d.ts +6 -5
  84. package/dist/components/Dialog/index.js +6 -0
  85. package/dist/components/DisplayHash/DisplayHash.d.ts +1 -1
  86. package/dist/components/DisplayHash/DisplayHash.js +10 -0
  87. package/dist/components/DisplayHash/index.js +1 -0
  88. package/dist/components/FeeItem/FeeItem.d.ts +1 -1
  89. package/dist/components/FeeItem/FeeItem.js +6 -0
  90. package/dist/components/FeeItem/FeeItem.stories.d.ts +7 -0
  91. package/dist/components/FeeItem/FeeItem.stories.js +19 -0
  92. package/dist/components/Form/Checkbox.d.ts +2 -2
  93. package/dist/components/Form/Checkbox.js +10 -0
  94. package/dist/components/Form/Checkbox.stories.d.ts +6 -0
  95. package/dist/components/Form/Checkbox.stories.js +13 -0
  96. package/dist/components/Form/FormControl.d.ts +2 -1
  97. package/dist/components/Form/FormControl.js +6 -0
  98. package/dist/components/Form/FormControl.stories.d.ts +8 -0
  99. package/dist/components/Form/FormControl.stories.js +30 -0
  100. package/dist/components/Form/Input.d.ts +3 -2
  101. package/dist/components/Form/Input.js +8 -0
  102. package/dist/components/Form/Input.stories.d.ts +10 -0
  103. package/dist/components/Form/Input.stories.js +43 -0
  104. package/dist/components/Form/Radio.d.ts +2 -2
  105. package/dist/components/Form/Radio.js +10 -0
  106. package/dist/components/Form/Radio.stories.d.ts +6 -0
  107. package/dist/components/Form/Radio.stories.js +13 -0
  108. package/dist/components/Form/Select.d.ts +3 -2
  109. package/dist/components/Form/Select.js +39 -0
  110. package/dist/components/Form/Select.stories.d.ts +9 -0
  111. package/dist/components/Form/Select.stories.js +47 -0
  112. package/dist/components/Form/components/Toggle.d.ts +3 -2
  113. package/dist/components/Form/components/Toggle.js +22 -0
  114. package/dist/components/Form/index.d.ts +5 -5
  115. package/dist/components/Form/index.js +5 -0
  116. package/dist/components/Heading/Heading.d.ts +3 -2
  117. package/dist/components/Heading/Heading.js +9 -0
  118. package/dist/components/Heading/Heading.stories.d.ts +6 -0
  119. package/dist/components/Heading/Heading.stories.js +10 -0
  120. package/dist/components/Heading/index.d.ts +1 -1
  121. package/dist/components/Heading/index.js +1 -0
  122. package/dist/components/Icons/ThemedIcon.js +25 -0
  123. package/dist/components/Icons/common/CloseIcon.d.ts +1 -1
  124. package/dist/components/Icons/common/CloseIcon.js +7 -0
  125. package/dist/components/Icons/common/CopyIcon.d.ts +1 -1
  126. package/dist/components/Icons/common/CopyIcon.js +7 -0
  127. package/dist/components/Icons/index.d.ts +6 -6
  128. package/dist/components/Icons/index.js +18 -0
  129. package/dist/components/Icons/wallet/BitcoinPublicKeyIcon.d.ts +1 -1
  130. package/dist/components/Icons/wallet/BitcoinPublicKeyIcon.js +5 -0
  131. package/dist/components/Icons/wallet/LinkWalletIcon.d.ts +1 -1
  132. package/dist/components/Icons/wallet/LinkWalletIcon.js +5 -0
  133. package/dist/components/Icons/wallet/UsingInscriptionIcon.d.ts +1 -1
  134. package/dist/components/Icons/wallet/UsingInscriptionIcon.js +5 -0
  135. package/dist/components/List/List.d.ts +3 -2
  136. package/dist/components/List/List.js +16 -0
  137. package/dist/components/List/List.stories.d.ts +11 -0
  138. package/dist/components/List/List.stories.js +69 -0
  139. package/dist/components/List/components/ListItem.js +6 -0
  140. package/dist/components/List/index.d.ts +2 -2
  141. package/dist/components/List/index.js +2 -0
  142. package/dist/components/ListLegacy/ListLegacy.d.ts +3 -2
  143. package/dist/components/ListLegacy/ListLegacy.js +16 -0
  144. package/dist/components/ListLegacy/ListLegacy.stories.d.ts +11 -0
  145. package/dist/components/ListLegacy/ListLegacy.stories.js +71 -0
  146. package/dist/components/ListLegacy/components/ListItemLegacy.js +6 -0
  147. package/dist/components/ListLegacy/index.d.ts +2 -2
  148. package/dist/components/ListLegacy/index.js +2 -0
  149. package/dist/components/Loader/Loader.d.ts +1 -0
  150. package/dist/components/Loader/Loader.js +6 -0
  151. package/dist/components/Loader/Loader.stories.d.ts +6 -0
  152. package/dist/components/Loader/Loader.stories.js +11 -0
  153. package/dist/components/Loader/index.d.ts +1 -1
  154. package/dist/components/Loader/index.js +1 -0
  155. package/dist/components/Menu/Menu.d.ts +2 -2
  156. package/dist/components/Menu/Menu.js +29 -0
  157. package/dist/components/Menu/Menu.stories.d.ts +6 -0
  158. package/dist/components/Menu/Menu.stories.js +38 -0
  159. package/dist/components/Menu/MenuContext.d.ts +1 -1
  160. package/dist/components/Menu/MenuContext.js +9 -0
  161. package/dist/components/Menu/MenuDrawer.d.ts +1 -1
  162. package/dist/components/Menu/MenuDrawer.js +22 -0
  163. package/dist/components/Menu/MenuItem.d.ts +1 -1
  164. package/dist/components/Menu/MenuItem.js +20 -0
  165. package/dist/components/Menu/SubMenu.d.ts +1 -1
  166. package/dist/components/Menu/SubMenu.js +12 -0
  167. package/dist/components/Menu/SubMenuItem.d.ts +1 -1
  168. package/dist/components/Menu/SubMenuItem.js +6 -0
  169. package/dist/components/Menu/index.d.ts +6 -6
  170. package/dist/components/Menu/index.js +6 -0
  171. package/dist/components/Popover/Popover.d.ts +3 -2
  172. package/dist/components/Popover/Popover.js +16 -0
  173. package/dist/components/Popover/Popover.stories.d.ts +6 -0
  174. package/dist/components/Popover/Popover.stories.js +25 -0
  175. package/dist/components/Popover/index.d.ts +1 -1
  176. package/dist/components/Popover/index.js +1 -0
  177. package/dist/components/Portal/Portal.d.ts +2 -2
  178. package/dist/components/Portal/Portal.js +45 -0
  179. package/dist/components/Portal/index.d.ts +1 -1
  180. package/dist/components/Portal/index.js +1 -0
  181. package/dist/components/Spacer/Spacer.d.ts +1 -1
  182. package/dist/components/Spacer/Spacer.js +9 -0
  183. package/dist/components/Spacer/index.js +1 -0
  184. package/dist/components/SubSection/SubSection.d.ts +1 -1
  185. package/dist/components/SubSection/SubSection.js +3 -0
  186. package/dist/components/SubSection/SubSection.stories.d.ts +6 -0
  187. package/dist/components/SubSection/SubSection.stories.js +13 -0
  188. package/dist/components/SubSection/index.d.ts +1 -1
  189. package/dist/components/SubSection/index.js +1 -0
  190. package/dist/components/Table/Table.d.ts +2 -1
  191. package/dist/components/Table/Table.js +37 -0
  192. package/dist/components/Table/Table.stories.d.ts +7 -0
  193. package/dist/components/Table/Table.stories.js +131 -0
  194. package/dist/components/Table/components/Cell.d.ts +1 -1
  195. package/dist/components/Table/components/Cell.js +6 -0
  196. package/dist/components/Table/components/Column.d.ts +1 -1
  197. package/dist/components/Table/components/Column.js +17 -0
  198. package/dist/components/Table/components/Row.d.ts +1 -1
  199. package/dist/components/Table/components/Row.js +6 -0
  200. package/dist/components/Table/index.d.ts +4 -4
  201. package/dist/components/Table/index.js +4 -0
  202. package/dist/components/Table/types/index.d.ts +1 -1
  203. package/dist/components/Table/types/index.js +1 -0
  204. package/dist/components/Text/Text.d.ts +3 -2
  205. package/dist/components/Text/Text.js +11 -0
  206. package/dist/components/Text/Text.stories.d.ts +6 -0
  207. package/dist/components/Text/Text.stories.js +10 -0
  208. package/dist/components/Text/index.d.ts +1 -1
  209. package/dist/components/Text/index.js +1 -0
  210. package/dist/components/Toggle/Toggle.d.ts +1 -0
  211. package/dist/components/Toggle/Toggle.js +12 -0
  212. package/dist/components/Toggle/Toggle.stories.d.ts +6 -0
  213. package/dist/components/Toggle/Toggle.stories.js +14 -0
  214. package/dist/components/Toggle/index.d.ts +1 -1
  215. package/dist/components/Toggle/index.js +1 -0
  216. package/dist/components/Warning/Warning.d.ts +2 -1
  217. package/dist/components/Warning/Warning.js +6 -0
  218. package/dist/components/Warning/Warning.stories.d.ts +9 -0
  219. package/dist/components/Warning/Warning.stories.js +26 -0
  220. package/dist/components/Warning/index.d.ts +1 -1
  221. package/dist/components/Warning/index.js +1 -0
  222. package/dist/components/index.js +3 -0
  223. package/dist/context/Dialog.context.d.ts +2 -2
  224. package/dist/context/Dialog.context.js +33 -0
  225. package/dist/context/Table.context.d.ts +2 -2
  226. package/dist/context/Table.context.js +8 -0
  227. package/dist/elements/FinalityProviderItem/FinalityProviderItem.js +30 -0
  228. package/dist/elements/FinalityProviderItem/FinalityProviderItem.stories.d.ts +12 -0
  229. package/dist/elements/FinalityProviderItem/FinalityProviderItem.stories.js +97 -0
  230. package/dist/elements/FinalityProviderItem/index.d.ts +1 -1
  231. package/dist/elements/FinalityProviderItem/index.js +1 -0
  232. package/dist/elements/FinalityProviderLogo/FinalityProviderLogo.js +24 -0
  233. package/dist/elements/FinalityProviderLogo/FinalityProviderLogo.stories.d.ts +13 -0
  234. package/dist/elements/FinalityProviderLogo/FinalityProviderLogo.stories.js +61 -0
  235. package/dist/elements/FinalityProviderLogo/index.d.ts +1 -1
  236. package/dist/elements/FinalityProviderLogo/index.js +1 -0
  237. package/dist/elements/Icons/ChevronRightIcon.d.ts +1 -1
  238. package/dist/elements/Icons/ChevronRightIcon.js +2 -0
  239. package/dist/elements/Icons/SettingsIcon.d.ts +1 -1
  240. package/dist/elements/Icons/SettingsIcon.js +2 -0
  241. package/dist/elements/Icons/index.js +2 -0
  242. package/dist/elements/ProvidersList/ProvidersList.js +9 -0
  243. package/dist/elements/ProvidersList/ProvidersList.stories.d.ts +10 -0
  244. package/dist/elements/ProvidersList/ProvidersList.stories.js +139 -0
  245. package/dist/elements/ProvidersList/index.d.ts +1 -1
  246. package/dist/elements/ProvidersList/index.js +1 -0
  247. package/dist/elements/Table/Table.d.ts +1 -1
  248. package/dist/elements/Table/Table.js +14 -0
  249. package/dist/elements/Table/Table.stories.d.ts +8 -0
  250. package/dist/elements/Table/Table.stories.js +50 -0
  251. package/dist/elements/Table/index.d.ts +1 -1
  252. package/dist/elements/Table/index.js +1 -0
  253. package/dist/hooks/index.js +9 -0
  254. package/dist/hooks/useClickOutside.js +17 -0
  255. package/dist/hooks/useControlledState.js +13 -0
  256. package/dist/hooks/useCopy.js +48 -0
  257. package/dist/hooks/useIsMobile.js +33 -0
  258. package/dist/hooks/useMemoizedArray.js +22 -0
  259. package/dist/hooks/useModalManager.js +28 -0
  260. package/dist/hooks/useResizeObserver.js +21 -0
  261. package/dist/hooks/useTableScroll.d.ts +1 -1
  262. package/dist/hooks/useTableScroll.js +22 -0
  263. package/dist/hooks/useTableSort.d.ts +1 -1
  264. package/dist/hooks/useTableSort.js +46 -0
  265. package/dist/index.cjs.js +1 -1
  266. package/dist/index.cjs.js.map +1 -1
  267. package/dist/index.d.ts +46 -44
  268. package/dist/index.es.js +1379 -1246
  269. package/dist/index.es.js.map +1 -1
  270. package/dist/index.js +46 -0
  271. package/dist/style.css +1 -1
  272. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  273. package/dist/utils/constants.js +3 -0
  274. package/dist/utils/css.js +6 -0
  275. package/dist/utils/helpers.js +71 -0
  276. package/dist/utils/trim.js +14 -0
  277. package/dist/widgets/form/CheckboxField/CheckboxField.d.ts +1 -1
  278. package/dist/widgets/form/CheckboxField/CheckboxField.js +7 -0
  279. package/dist/widgets/form/CheckboxField/CheckboxField.stories.d.ts +6 -0
  280. package/dist/widgets/form/CheckboxField/CheckboxField.stories.js +17 -0
  281. package/dist/widgets/form/CheckboxField/index.d.ts +1 -1
  282. package/dist/widgets/form/CheckboxField/index.js +1 -0
  283. package/dist/widgets/form/Form/Form.d.ts +3 -3
  284. package/dist/widgets/form/Form/Form.js +20 -0
  285. package/dist/widgets/form/Form/Form.stories.d.ts +6 -0
  286. package/dist/widgets/form/Form/Form.stories.js +27 -0
  287. package/dist/widgets/form/Form/index.d.ts +1 -1
  288. package/dist/widgets/form/Form/index.js +1 -0
  289. package/dist/widgets/form/HiddenField/HiddenField.d.ts +1 -1
  290. package/dist/widgets/form/HiddenField/HiddenField.js +13 -0
  291. package/dist/widgets/form/HiddenField/HiddenField.stories.d.ts +6 -0
  292. package/dist/widgets/form/HiddenField/HiddenField.stories.js +17 -0
  293. package/dist/widgets/form/HiddenField/index.d.ts +1 -1
  294. package/dist/widgets/form/HiddenField/index.js +1 -0
  295. package/dist/widgets/form/NumberField/NumberField.d.ts +2 -2
  296. package/dist/widgets/form/NumberField/NumberField.js +15 -0
  297. package/dist/widgets/form/NumberField/NumberField.stories.d.ts +6 -0
  298. package/dist/widgets/form/NumberField/NumberField.stories.js +31 -0
  299. package/dist/widgets/form/NumberField/index.d.ts +1 -1
  300. package/dist/widgets/form/NumberField/index.js +1 -0
  301. package/dist/widgets/form/RadioField/RadioField.d.ts +1 -1
  302. package/dist/widgets/form/RadioField/RadioField.js +7 -0
  303. package/dist/widgets/form/RadioField/RadioField.stories.d.ts +6 -0
  304. package/dist/widgets/form/RadioField/RadioField.stories.js +14 -0
  305. package/dist/widgets/form/RadioField/index.d.ts +1 -1
  306. package/dist/widgets/form/RadioField/index.js +1 -0
  307. package/dist/widgets/form/SelectField/SelectField.d.ts +3 -3
  308. package/dist/widgets/form/SelectField/SelectField.js +13 -0
  309. package/dist/widgets/form/SelectField/SelectField.stories.d.ts +6 -0
  310. package/dist/widgets/form/SelectField/SelectField.stories.js +33 -0
  311. package/dist/widgets/form/SelectField/index.d.ts +1 -1
  312. package/dist/widgets/form/SelectField/index.js +1 -0
  313. package/dist/widgets/form/TextField/TextField.d.ts +2 -2
  314. package/dist/widgets/form/TextField/TextField.js +9 -0
  315. package/dist/widgets/form/TextField/TextField.stories.d.ts +6 -0
  316. package/dist/widgets/form/TextField/TextField.stories.js +28 -0
  317. package/dist/widgets/form/TextField/index.d.ts +1 -1
  318. package/dist/widgets/form/TextField/index.js +1 -0
  319. package/dist/widgets/form/hooks.d.ts +3 -3
  320. package/dist/widgets/form/hooks.js +29 -0
  321. package/dist/widgets/form/types.js +1 -0
  322. package/dist/widgets/sections/ActivityCard/ActivityCard.d.ts +37 -0
  323. package/dist/widgets/sections/ActivityCard/ActivityCard.js +7 -0
  324. package/dist/widgets/sections/ActivityCard/ActivityCard.stories.d.ts +14 -0
  325. package/dist/widgets/sections/ActivityCard/ActivityCard.stories.js +228 -0
  326. package/dist/widgets/sections/ActivityCard/components/ActivityCardActionSection.d.ts +6 -0
  327. package/dist/widgets/sections/ActivityCard/components/ActivityCardActionSection.js +5 -0
  328. package/dist/widgets/sections/ActivityCard/components/ActivityCardAmountSection.d.ts +9 -0
  329. package/dist/widgets/sections/ActivityCard/components/ActivityCardAmountSection.js +6 -0
  330. package/dist/widgets/sections/ActivityCard/components/ActivityCardDetailsSection.d.ts +11 -0
  331. package/dist/widgets/sections/ActivityCard/components/ActivityCardDetailsSection.js +10 -0
  332. package/dist/widgets/sections/ActivityCard/components/ActivityListItem.d.ts +12 -0
  333. package/dist/widgets/sections/ActivityCard/components/ActivityListItem.js +5 -0
  334. package/dist/widgets/sections/ActivityCard/index.d.ts +5 -0
  335. package/dist/widgets/sections/ActivityCard/index.js +5 -0
  336. package/dist/widgets/sections/AmountSubsection/AmountSubsection.js +29 -0
  337. package/dist/widgets/sections/AmountSubsection/AmountSubsection.stories.d.ts +6 -0
  338. package/dist/widgets/sections/AmountSubsection/AmountSubsection.stories.js +35 -0
  339. package/dist/widgets/sections/AmountSubsection/index.d.ts +1 -1
  340. package/dist/widgets/sections/AmountSubsection/index.js +1 -0
  341. package/dist/widgets/sections/FeesSection/BBNFeeAmount.js +7 -0
  342. package/dist/widgets/sections/FeesSection/BTCFeeAmount.js +19 -0
  343. package/dist/widgets/sections/FeesSection/BTCFeeRate.js +7 -0
  344. package/dist/widgets/sections/FeesSection/FeesSection.js +10 -0
  345. package/dist/widgets/sections/FeesSection/FeesSection.stories.d.ts +6 -0
  346. package/dist/widgets/sections/FeesSection/FeesSection.stories.js +14 -0
  347. package/dist/widgets/sections/FeesSection/Total.js +20 -0
  348. package/dist/widgets/sections/FeesSection/index.d.ts +6 -6
  349. package/dist/widgets/sections/FeesSection/index.js +6 -0
  350. package/dist/widgets/sections/FinalityProviderSubsection/FinalityProviderSubsection.d.ts +1 -1
  351. package/dist/widgets/sections/FinalityProviderSubsection/FinalityProviderSubsection.js +9 -0
  352. package/dist/widgets/sections/FinalityProviderSubsection/FinalityProviderSubsection.stories.d.ts +13 -0
  353. package/dist/widgets/sections/FinalityProviderSubsection/FinalityProviderSubsection.stories.js +191 -0
  354. package/dist/widgets/sections/FinalityProviderSubsection/index.d.ts +1 -1
  355. package/dist/widgets/sections/FinalityProviderSubsection/index.js +1 -0
  356. package/dist/widgets/sections/PreviewModal/PreviewModal.d.ts +1 -1
  357. package/dist/widgets/sections/PreviewModal/PreviewModal.js +37 -0
  358. package/dist/widgets/sections/PreviewModal/PreviewModal.stories.d.ts +6 -0
  359. package/dist/widgets/sections/PreviewModal/PreviewModal.stories.js +47 -0
  360. package/dist/widgets/sections/PreviewModal/index.d.ts +1 -1
  361. package/dist/widgets/sections/PreviewModal/index.js +1 -0
  362. package/dist/widgets/sections/RewardsPreviewModal/RewardsPreviewModal.d.ts +1 -1
  363. package/dist/widgets/sections/RewardsPreviewModal/RewardsPreviewModal.js +16 -0
  364. package/dist/widgets/sections/RewardsPreviewModal/RewardsPreviewModal.stories.d.ts +7 -0
  365. package/dist/widgets/sections/RewardsPreviewModal/RewardsPreviewModal.stories.js +60 -0
  366. package/dist/widgets/sections/RewardsSubsection/RewardsSubsection.js +13 -0
  367. package/dist/widgets/sections/RewardsSubsection/RewardsSubsection.stories.d.ts +7 -0
  368. package/dist/widgets/sections/RewardsSubsection/RewardsSubsection.stories.js +60 -0
  369. package/dist/widgets/sections/RewardsSubsection/index.d.ts +1 -1
  370. package/dist/widgets/sections/RewardsSubsection/index.js +1 -0
  371. package/dist/widgets/sections/SettingMenu/SettingMenu.d.ts +3 -3
  372. package/dist/widgets/sections/SettingMenu/SettingMenu.js +17 -0
  373. package/dist/widgets/sections/SettingMenu/SettingMenu.stories.d.ts +5 -0
  374. package/dist/widgets/sections/SettingMenu/SettingMenu.stories.js +35 -0
  375. package/dist/widgets/sections/SettingMenu/components/SettingMenuCustomContent.d.ts +1 -1
  376. package/dist/widgets/sections/SettingMenu/components/SettingMenuCustomContent.js +2 -0
  377. package/dist/widgets/sections/SettingMenu/components/SettingMenuDescription.d.ts +1 -1
  378. package/dist/widgets/sections/SettingMenu/components/SettingMenuDescription.js +4 -0
  379. package/dist/widgets/sections/SettingMenu/components/SettingMenuGroup.d.ts +1 -1
  380. package/dist/widgets/sections/SettingMenu/components/SettingMenuGroup.js +15 -0
  381. package/dist/widgets/sections/SettingMenu/components/SettingMenuItem.d.ts +1 -1
  382. package/dist/widgets/sections/SettingMenu/components/SettingMenuItem.js +13 -0
  383. package/dist/widgets/sections/SettingMenu/components/SettingMenuSubMenu.d.ts +1 -1
  384. package/dist/widgets/sections/SettingMenu/components/SettingMenuSubMenu.js +14 -0
  385. package/dist/widgets/sections/SettingMenu/components/SettingMenuTitle.d.ts +1 -1
  386. package/dist/widgets/sections/SettingMenu/components/SettingMenuTitle.js +4 -0
  387. package/dist/widgets/sections/SettingMenu/components/index.d.ts +12 -12
  388. package/dist/widgets/sections/SettingMenu/components/index.js +6 -0
  389. package/dist/widgets/sections/SettingMenu/index.d.ts +14 -14
  390. package/dist/widgets/sections/SettingMenu/index.js +7 -0
  391. package/dist/widgets/sections/TableElement/TableElement.d.ts +1 -1
  392. package/dist/widgets/sections/TableElement/TableElement.js +6 -0
  393. package/dist/widgets/sections/TableElement/TableElement.stories.d.ts +9 -0
  394. package/dist/widgets/sections/TableElement/TableElement.stories.js +54 -0
  395. package/dist/widgets/sections/TableElement/index.d.ts +1 -1
  396. package/dist/widgets/sections/TableElement/index.js +1 -0
  397. package/dist/widgets/sections/WalletMenu/WalletMenu.d.ts +1 -1
  398. package/dist/widgets/sections/WalletMenu/WalletMenu.js +22 -0
  399. package/dist/widgets/sections/WalletMenu/WalletMenu.stories.d.ts +6 -0
  400. package/dist/widgets/sections/WalletMenu/WalletMenu.stories.js +35 -0
  401. package/dist/widgets/sections/WalletMenu/components/WalletInfoCard.d.ts +1 -1
  402. package/dist/widgets/sections/WalletMenu/components/WalletInfoCard.js +9 -0
  403. package/dist/widgets/sections/WalletMenu/components/WalletInfoSection.d.ts +1 -1
  404. package/dist/widgets/sections/WalletMenu/components/WalletInfoSection.js +8 -0
  405. package/dist/widgets/sections/WalletMenu/components/WalletSettingItem.d.ts +1 -1
  406. package/dist/widgets/sections/WalletMenu/components/WalletSettingItem.js +7 -0
  407. package/dist/widgets/sections/WalletMenu/components/WalletToggle.d.ts +1 -1
  408. package/dist/widgets/sections/WalletMenu/components/WalletToggle.js +12 -0
  409. package/dist/widgets/sections/WalletMenu/components/index.js +4 -0
  410. package/dist/widgets/sections/WalletMenu/index.js +5 -0
  411. package/package.json +4 -10
@@ -0,0 +1,191 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FinalityProviderSubsection } from "./FinalityProviderSubsection";
3
+ const sampleItems = [
4
+ {
5
+ bsnId: "babylon",
6
+ bsnName: "Babylon Genesis",
7
+ bsnLogoUrl: "https://placehold.co/24x24?text=B",
8
+ provider: {
9
+ rank: 1,
10
+ logo_url: "https://placehold.co/40x40",
11
+ description: { moniker: "Provider 1" },
12
+ },
13
+ },
14
+ ];
15
+ const multipleItems = [
16
+ {
17
+ bsnId: "babylon",
18
+ bsnName: "Babylon Genesis",
19
+ bsnLogoUrl: "https://placehold.co/24x24?text=B",
20
+ provider: {
21
+ rank: 1,
22
+ logo_url: "https://placehold.co/40x40",
23
+ description: { moniker: "Babylon Provider" },
24
+ },
25
+ },
26
+ {
27
+ bsnId: "ethereum",
28
+ bsnName: "Ethereum Bridge",
29
+ bsnLogoUrl: "https://placehold.co/24x24?text=E",
30
+ provider: {
31
+ rank: 2,
32
+ logo_url: "https://placehold.co/40x40",
33
+ description: { moniker: "Ethereum Provider" },
34
+ },
35
+ },
36
+ ];
37
+ const maxCapacityItems = [
38
+ {
39
+ bsnId: "babylon",
40
+ bsnName: "Babylon Genesis",
41
+ bsnLogoUrl: "https://placehold.co/24x24?text=B",
42
+ provider: {
43
+ rank: 1,
44
+ logo_url: "https://placehold.co/40x40",
45
+ description: { moniker: "Babylon Provider" },
46
+ },
47
+ },
48
+ {
49
+ bsnId: "ethereum",
50
+ bsnName: "Ethereum Bridge",
51
+ bsnLogoUrl: "https://placehold.co/24x24?text=E",
52
+ provider: {
53
+ rank: 2,
54
+ logo_url: "https://placehold.co/40x40",
55
+ description: { moniker: "Ethereum Provider" },
56
+ },
57
+ },
58
+ {
59
+ bsnId: "polygon",
60
+ bsnName: "Polygon Network",
61
+ bsnLogoUrl: "https://placehold.co/24x24?text=P",
62
+ provider: {
63
+ rank: 3,
64
+ logo_url: "https://placehold.co/40x40",
65
+ description: { moniker: "Polygon Provider" },
66
+ },
67
+ },
68
+ ];
69
+ const meta = {
70
+ component: FinalityProviderSubsection,
71
+ tags: ["autodocs"],
72
+ };
73
+ export default meta;
74
+ export const Default = {
75
+ args: {
76
+ max: 3,
77
+ items: sampleItems,
78
+ actionText: "Add BSN and Finality Provider",
79
+ onAdd: () => alert("Add clicked"),
80
+ onRemove: () => alert("Remove clicked"),
81
+ },
82
+ render: ({ max, items, actionText, onAdd, onRemove }) => (_jsx(FinalityProviderSubsection, { max: max, items: items, actionText: actionText, onAdd: onAdd, onRemove: onRemove })),
83
+ };
84
+ export const Empty = {
85
+ args: {
86
+ max: 3,
87
+ items: [],
88
+ actionText: "Add BSN and Finality Provider",
89
+ onAdd: () => alert("Add clicked"),
90
+ onRemove: () => alert("Remove clicked"),
91
+ },
92
+ render: ({ max, items, actionText, onAdd, onRemove }) => (_jsx(FinalityProviderSubsection, { max: max, items: items, actionText: actionText, onAdd: onAdd, onRemove: onRemove })),
93
+ };
94
+ export const MultipleItems = {
95
+ args: {
96
+ max: 5,
97
+ items: multipleItems,
98
+ actionText: "Add BSN and Finality Provider",
99
+ onAdd: () => alert("Add clicked"),
100
+ onRemove: (bsnId) => alert(`Remove clicked for ${bsnId}`),
101
+ },
102
+ render: ({ max, items, actionText, onAdd, onRemove }) => (_jsx(FinalityProviderSubsection, { max: max, items: items, actionText: actionText, onAdd: onAdd, onRemove: onRemove })),
103
+ };
104
+ export const AtMaximumCapacity = {
105
+ args: {
106
+ max: 3,
107
+ items: maxCapacityItems,
108
+ actionText: "Add BSN and Finality Provider",
109
+ onAdd: () => alert("Add clicked"),
110
+ onRemove: (bsnId) => alert(`Remove clicked for ${bsnId}`),
111
+ },
112
+ render: ({ max, items, actionText, onAdd, onRemove }) => (_jsx(FinalityProviderSubsection, { max: max, items: items, actionText: actionText, onAdd: onAdd, onRemove: onRemove })),
113
+ };
114
+ export const SingleProviderMode = {
115
+ args: {
116
+ max: 1,
117
+ items: [],
118
+ actionText: "Add Finality Provider",
119
+ onAdd: () => alert("Add clicked"),
120
+ onRemove: () => alert("Remove clicked"),
121
+ },
122
+ render: ({ max, items, actionText, onAdd, onRemove }) => (_jsx(FinalityProviderSubsection, { max: max, items: items, actionText: actionText, onAdd: onAdd, onRemove: onRemove })),
123
+ };
124
+ export const SingleProviderModeWithItem = {
125
+ args: {
126
+ max: 1,
127
+ items: [sampleItems[0]],
128
+ actionText: "Add Finality Provider",
129
+ onAdd: () => alert("Add clicked"),
130
+ onRemove: (bsnId) => alert(`Remove clicked for ${bsnId}`),
131
+ },
132
+ render: ({ max, items, actionText, onAdd, onRemove }) => (_jsx(FinalityProviderSubsection, { max: max, items: items, actionText: actionText, onAdd: onAdd, onRemove: onRemove })),
133
+ };
134
+ export const ProvidersWithoutLogos = {
135
+ args: {
136
+ max: 3,
137
+ items: [
138
+ {
139
+ bsnId: "nologo1",
140
+ bsnName: "Provider Without Logo",
141
+ provider: {
142
+ rank: 1,
143
+ description: { moniker: "No Logo Provider" },
144
+ },
145
+ },
146
+ {
147
+ bsnId: "nologo2",
148
+ bsnName: "Another Provider",
149
+ bsnLogoUrl: "https://placehold.co/24x24?text=A",
150
+ provider: {
151
+ rank: 2,
152
+ description: { moniker: "Provider with BSN logo only" },
153
+ },
154
+ },
155
+ ],
156
+ actionText: "Add BSN and Finality Provider",
157
+ onAdd: () => alert("Add clicked"),
158
+ onRemove: (bsnId) => alert(`Remove clicked for ${bsnId}`),
159
+ },
160
+ render: ({ max, items, actionText, onAdd, onRemove }) => (_jsx(FinalityProviderSubsection, { max: max, items: items, actionText: actionText, onAdd: onAdd, onRemove: onRemove })),
161
+ };
162
+ export const ProvidersWithoutDescriptions = {
163
+ args: {
164
+ max: 3,
165
+ items: [
166
+ {
167
+ bsnId: "nodesc1",
168
+ bsnName: "Provider Without Description",
169
+ bsnLogoUrl: "https://placehold.co/24x24?text=N",
170
+ provider: {
171
+ rank: 1,
172
+ logo_url: "https://placehold.co/40x40",
173
+ },
174
+ },
175
+ {
176
+ bsnId: "nodesc2",
177
+ bsnName: "Another Provider",
178
+ bsnLogoUrl: "https://placehold.co/24x24?text=A",
179
+ provider: {
180
+ rank: 2,
181
+ logo_url: "https://placehold.co/40x40",
182
+ description: {},
183
+ },
184
+ },
185
+ ],
186
+ actionText: "Add BSN and Finality Provider",
187
+ onAdd: () => alert("Add clicked"),
188
+ onRemove: (bsnId) => alert(`Remove clicked for ${bsnId}`),
189
+ },
190
+ render: ({ max, items, actionText, onAdd, onRemove }) => (_jsx(FinalityProviderSubsection, { max: max, items: items, actionText: actionText, onAdd: onAdd, onRemove: onRemove })),
191
+ };
@@ -1 +1 @@
1
- export { FinalityProviderSubsection } from './FinalityProviderSubsection';
1
+ export { FinalityProviderSubsection } from "./FinalityProviderSubsection";
@@ -0,0 +1 @@
1
+ export { FinalityProviderSubsection } from "./FinalityProviderSubsection";
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren, ReactNode } from 'react';
1
+ import { PropsWithChildren, ReactNode } from "react";
2
2
  interface Info {
3
3
  icon: ReactNode;
4
4
  name: string;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from "@/components/Button";
3
+ import { WINDOW_BREAKPOINT } from "../../../utils/constants";
4
+ import { Table } from "@/elements/Table";
5
+ import { Dialog, MobileDialog, DialogBody, DialogFooter, DialogHeader } from "@/components/Dialog";
6
+ import { Heading } from "@/components/Heading";
7
+ import { Text } from "@/components/Text";
8
+ import { useIsMobile } from "@/hooks/useIsMobile";
9
+ import { twMerge } from "tailwind-merge";
10
+ function ResponsiveDialog({ className, ...restProps }) {
11
+ const isMobileView = useIsMobile(WINDOW_BREAKPOINT);
12
+ const DialogComponent = isMobileView ? MobileDialog : Dialog;
13
+ return _jsx(DialogComponent, { ...restProps, className: twMerge("w-[41.25rem] max-w-full", className) });
14
+ }
15
+ export const PreviewModal = ({ open, processing = false, onClose, onProceed, bsns, finalityProviders, details, }) => {
16
+ const fields = [
17
+ { label: "Stake Amount", value: details.stakeAmount },
18
+ { label: "Fee Rate", value: details.feeRate },
19
+ { label: "Transaction Fees", value: details.transactionFees },
20
+ {
21
+ label: "Term",
22
+ value: (_jsxs(_Fragment, { children: [details.term.blocks, _jsx("br", {}), _jsx("span", { className: "text-md text-secondary", children: details.term.duration })] })),
23
+ },
24
+ { label: "Unbonding", value: details.unbonding },
25
+ { label: "Unbonding Fee", value: details.unbondingFee },
26
+ ];
27
+ return (_jsxs(ResponsiveDialog, { open: open, onClose: onClose, children: [_jsx(DialogHeader, { title: "Preview", onClose: onClose, className: "text-accent-primary" }), _jsxs(DialogBody, { className: "no-scrollbar mb-8 mt-4 flex max-h-[calc(100vh-12rem)] flex-col gap-4 overflow-y-auto text-accent-primary", children: [_jsx(Table, { data: [
28
+ ["BSNs", "Finality Provider"],
29
+ ...bsns.map((bsnItem, index) => {
30
+ const fpItem = finalityProviders[index];
31
+ return [
32
+ _jsxs("div", { className: "flex w-full items-center justify-center gap-2 py-1", children: [bsnItem.icon, _jsx(Text, { variant: "body2", className: "font-medium", children: bsnItem.name })] }, `bsn-${index}`),
33
+ fpItem ? (_jsxs("div", { className: "flex w-full items-center justify-center gap-2 py-1", children: [fpItem.icon, _jsx(Text, { variant: "body2", className: "font-medium", children: fpItem.name })] }, `fp-${index}`)) : (_jsx("div", {}, `fp-${index}`)),
34
+ ];
35
+ }),
36
+ ] }), _jsx("div", { className: "flex flex-col", children: fields.map((field, index) => (_jsxs("div", { className: "flex flex-row items-center justify-between py-3", children: [_jsx(Text, { variant: "body1", className: "text-secondary font-normal", children: field.label }), _jsx(Text, { variant: "body1", className: "text-right font-normal", children: field.value })] }, index))) }), _jsx("div", { className: "border-divider w-full border-t" }), _jsxs("div", { className: "pt-2", children: [_jsx(Heading, { variant: "h6", className: "text-primary mb-2", children: "Attention!" }), _jsx(Text, { variant: "body2", className: "text-secondary", children: "1. No third party possesses your staked BTC. You are the only one who can unbond and withdraw your stake." }), _jsx(Text, { variant: "body2", className: "text-secondary", children: "2. Your stake will first be sent to Babylon Genesis for verification (~20 seconds), then you will be prompted to submit it to the Bitcoin ledger. It will be marked as 'Pending' until it receives 10 Bitcoin confirmations." })] })] }), _jsxs(DialogFooter, { className: "flex flex-col gap-4 pb-8 pt-0 sm:flex-row", children: [_jsx(Button, { variant: "contained", color: "primary", onClick: onProceed, className: "w-full sm:flex-1 sm:order-2", disabled: processing, children: processing ? "Processing..." : "Proceed to Signing" }), _jsx(Button, { variant: "outlined", color: "primary", onClick: onClose, className: "w-full sm:flex-1 sm:order-1", children: "Cancel" })] })] }));
37
+ };
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { PreviewModal } from "./PreviewModal";
3
+ declare const meta: Meta<typeof PreviewModal>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { PreviewModal } from "./PreviewModal";
3
+ const PlaceholderIcon = ({ text, bgColor = "bg-primary-300" }) => (_jsx("div", { className: `${bgColor} flex h-6 w-6 items-center justify-center rounded text-xs font-semibold text-white`, children: text }));
4
+ const meta = {
5
+ component: PreviewModal,
6
+ tags: ["autodocs"],
7
+ };
8
+ export default meta;
9
+ export const Default = {
10
+ args: {
11
+ open: true,
12
+ processing: false,
13
+ onClose: () => { },
14
+ onProceed: () => { },
15
+ bsns: [
16
+ {
17
+ icon: _jsx(PlaceholderIcon, { text: "B1", bgColor: "bg-black" }),
18
+ name: "BSN 1",
19
+ },
20
+ {
21
+ icon: _jsx(PlaceholderIcon, { text: "B2", bgColor: "bg-black" }),
22
+ name: "BSN 2",
23
+ },
24
+ ],
25
+ finalityProviders: [
26
+ {
27
+ icon: _jsx(PlaceholderIcon, { text: "F1", bgColor: "bg-black" }),
28
+ name: "FP 1",
29
+ },
30
+ {
31
+ icon: _jsx(PlaceholderIcon, { text: "F2", bgColor: "bg-black" }),
32
+ name: "FP 2",
33
+ },
34
+ ],
35
+ details: {
36
+ stakeAmount: "0.5 BTC",
37
+ feeRate: "5 sat/vB",
38
+ transactionFees: "0.0001 BTC",
39
+ term: {
40
+ blocks: "60000 blocks",
41
+ duration: "~ 60 weeks",
42
+ },
43
+ unbonding: "~ 1 day",
44
+ unbondingFee: "0 BTC",
45
+ },
46
+ },
47
+ };
@@ -1 +1 @@
1
- export * from './PreviewModal';
1
+ export * from "./PreviewModal";
@@ -0,0 +1 @@
1
+ export * from "./PreviewModal";
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren, ReactNode } from 'react';
1
+ import { PropsWithChildren, ReactNode } from "react";
2
2
  interface Info {
3
3
  icon: ReactNode;
4
4
  name: string;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from "@/components/Button";
3
+ import { Warning } from "@/components/Warning";
4
+ import { WINDOW_BREAKPOINT } from "../../../utils/constants";
5
+ import { Dialog, MobileDialog, DialogBody, DialogFooter, DialogHeader } from "@/components/Dialog";
6
+ import { useIsMobile } from "@/hooks/useIsMobile";
7
+ import { twMerge } from "tailwind-merge";
8
+ import { FeeItem } from "@/components/FeeItem/FeeItem";
9
+ function ResponsiveDialog({ className, ...restProps }) {
10
+ const isMobileView = useIsMobile(WINDOW_BREAKPOINT);
11
+ const DialogComponent = isMobileView ? MobileDialog : Dialog;
12
+ return _jsx(DialogComponent, { ...restProps, className: twMerge("w-[41.25rem] max-w-full", className) });
13
+ }
14
+ export const RewardsPreviewModal = ({ open, processing = false, title, onClose, onProceed, bsns, warning, amount, transactionFees, }) => {
15
+ return (_jsxs(ResponsiveDialog, { open: open, onClose: onClose, children: [_jsx(DialogHeader, { title: title, className: "text-accent-primary" }), _jsxs(DialogBody, { className: "no-scrollbar mb-[40px] mt-8 flex max-h-[calc(100vh-12rem)] flex-col gap-[40px] overflow-y-auto text-accent-primary", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(FeeItem, { title: "Receiving", children: _jsx("div", { className: "flex flex-col items-end gap-1", children: bsns.map((item, index) => (_jsxs("div", { className: "flex items-center gap-2", children: [item.icon, item.name] }, `bsn-${index}`))) }) }), _jsx("div", { className: "border-divider w-full border-t" }), _jsx(FeeItem, { title: "Amount", hint: amount.usd, children: amount.token }), _jsx("div", { className: "border-divider w-full border-t" }), _jsx(FeeItem, { title: "Transaction Fees", hint: transactionFees.usd, children: transactionFees.token })] }), _jsx(Warning, { children: warning })] }), _jsxs(DialogFooter, { className: "flex flex-col gap-4 pt-0 sm:flex-row", children: [_jsx(Button, { variant: "contained", color: "primary", onClick: onProceed, className: "w-full sm:flex-1 sm:order-2", disabled: processing, children: processing ? "Processing..." : "Proceed" }), _jsx(Button, { variant: "outlined", color: "primary", onClick: onClose, className: "w-full sm:flex-1 sm:order-1", children: "Cancel" })] })] }));
16
+ };
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { RewardsPreviewModal } from "./RewardsPreviewModal";
3
+ declare const meta: Meta<typeof RewardsPreviewModal>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const OneReceivingToken: Story;
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { RewardsPreviewModal } from "./RewardsPreviewModal";
3
+ const PlaceholderIcon = ({ text, bgColor = "bg-primary-300", }) => (_jsx("div", { className: `${bgColor} flex h-6 w-6 items-center justify-center rounded text-xs font-semibold text-white`, children: text }));
4
+ const meta = {
5
+ component: RewardsPreviewModal,
6
+ tags: ["autodocs"],
7
+ };
8
+ export default meta;
9
+ export const Default = {
10
+ args: {
11
+ open: true,
12
+ processing: false,
13
+ onClose: () => { },
14
+ onProceed: () => { },
15
+ bsns: [
16
+ {
17
+ icon: _jsx(PlaceholderIcon, { text: "B1", bgColor: "bg-black" }),
18
+ name: "Token 1",
19
+ },
20
+ {
21
+ icon: _jsx(PlaceholderIcon, { text: "B2", bgColor: "bg-black" }),
22
+ name: "Token 2",
23
+ },
24
+ ],
25
+ amount: {
26
+ token: "100.000 BABY",
27
+ usd: "$6,677.15 USD",
28
+ },
29
+ transactionFees: {
30
+ token: "10 BABY",
31
+ usd: "$0.56 USD",
32
+ },
33
+ warning: "Processing your claim will take approximately 2 blocks to complete. BABY is a test token without any real world value.",
34
+ title: "Claim BABY Rewards",
35
+ },
36
+ };
37
+ export const OneReceivingToken = {
38
+ args: {
39
+ open: true,
40
+ processing: false,
41
+ onClose: () => { },
42
+ onProceed: () => { },
43
+ bsns: [
44
+ {
45
+ icon: _jsx(PlaceholderIcon, { text: "B1", bgColor: "bg-black" }),
46
+ name: "Token 1",
47
+ },
48
+ ],
49
+ amount: {
50
+ token: "100.000 BABY",
51
+ usd: "$6,677.15 USD",
52
+ },
53
+ transactionFees: {
54
+ token: "10 BABY",
55
+ usd: "$0.56 USD",
56
+ },
57
+ warning: "Processing your claim will take approximately 2 blocks to complete. BABY is a test token without any real world value.",
58
+ title: "Claim BABY Rewards",
59
+ },
60
+ };
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SubSection } from "@/components/SubSection";
3
+ import { calculateTokenValueInCurrency } from "@/utils/helpers";
4
+ import { AmountItem } from "../../../components/AmountItem";
5
+ import { Button } from "../../../components/Button";
6
+ export const RewardsSubsection = ({ rewards }) => {
7
+ return (_jsxs(SubSection, { className: "flex w-full flex-col content-center justify-between gap-4", children: [rewards.map((reward, index) => {
8
+ const amountValue = parseFloat(String(reward.amount));
9
+ const amountUsd = calculateTokenValueInCurrency(amountValue, reward.balanceDetails?.price ?? 0, { zeroDisplay: "$0.00" });
10
+ return (_jsx(AmountItem, { amount: reward.amount, currencyIcon: reward.currencyIcon, currencyName: reward.currencyName, placeholder: reward.placeholder ?? "Enter Amount", displayBalance: reward.displayBalance, balanceDetails: reward.balanceDetails, min: reward.min ?? "0", step: reward.step ?? "any", autoFocus: false, onChange: () => { }, onKeyDown: () => { }, amountUsd: amountUsd, disabled: true, subtitle: reward.chainName }, index));
11
+ }), _jsx(Button, { children: "Claim" })] }));
12
+ };
13
+ export default RewardsSubsection;
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { RewardsSubsection } from "./RewardsSubsection";
3
+ declare const meta: Meta<typeof RewardsSubsection>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const MultipleRewards: Story;
@@ -0,0 +1,60 @@
1
+ import { RewardsSubsection } from "./RewardsSubsection";
2
+ const meta = {
3
+ component: RewardsSubsection,
4
+ tags: ["autodocs"],
5
+ };
6
+ export default meta;
7
+ export const Default = {
8
+ args: {
9
+ rewards: [
10
+ {
11
+ amount: 123,
12
+ currencyIcon: "https://placehold.co/40x40",
13
+ currencyName: "BBN",
14
+ displayBalance: true,
15
+ chainName: "Babylon",
16
+ balanceDetails: {
17
+ balance: 1234.56789,
18
+ symbol: "BBN",
19
+ price: 0.25,
20
+ displayUSD: true,
21
+ decimals: 8,
22
+ },
23
+ },
24
+ ],
25
+ },
26
+ };
27
+ export const MultipleRewards = {
28
+ args: {
29
+ rewards: [
30
+ {
31
+ amount: 123,
32
+ currencyIcon: "https://placehold.co/40x40",
33
+ currencyName: "BBN",
34
+ displayBalance: true,
35
+ chainName: "Babylon",
36
+ balanceDetails: {
37
+ balance: 1234.56789,
38
+ symbol: "BBN",
39
+ price: 0.25,
40
+ displayUSD: true,
41
+ decimals: 8,
42
+ },
43
+ },
44
+ {
45
+ amount: 45,
46
+ currencyIcon: "https://placehold.co/40x40",
47
+ currencyName: "BTC",
48
+ displayBalance: true,
49
+ chainName: "Bitcoin",
50
+ balanceDetails: {
51
+ balance: 10,
52
+ symbol: "BTC",
53
+ price: 30000,
54
+ displayUSD: true,
55
+ decimals: 8,
56
+ },
57
+ },
58
+ ],
59
+ },
60
+ };
@@ -1 +1 @@
1
- export { RewardsSubsection } from './RewardsSubsection';
1
+ export { RewardsSubsection } from "./RewardsSubsection";
@@ -0,0 +1 @@
1
+ export { RewardsSubsection } from "./RewardsSubsection";
@@ -1,6 +1,6 @@
1
- import { default as React, ReactNode } from 'react';
2
- import { SpacerProps } from '../../../components/Spacer/Spacer';
3
- import { SettingMenuTitleProps, SettingMenuGroupProps, SettingMenuItemProps, SettingMenuSubMenuProps, SettingMenuDescriptionProps, SettingMenuCustomContentProps } from './components';
1
+ import React, { ReactNode } from "react";
2
+ import { SpacerProps } from "@/components/Spacer/Spacer";
3
+ import { type SettingMenuTitleProps, type SettingMenuGroupProps, type SettingMenuItemProps, type SettingMenuSubMenuProps, type SettingMenuDescriptionProps, type SettingMenuCustomContentProps } from "./components";
4
4
  export interface SettingMenuProps {
5
5
  /** Custom trigger element (defaults to settings icon button) */
6
6
  trigger?: ReactNode;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Menu } from "@/components/Menu";
3
+ import { Spacer } from "@/components/Spacer";
4
+ import { SettingsIcon } from "@/elements/Icons";
5
+ import { SettingMenuTitle, SettingMenuGroup, SettingMenuItem, SettingMenuSubMenu, SettingMenuDescription, SettingMenuCustomContent, } from "./components";
6
+ const SettingMenuBase = ({ trigger, open, onOpenChange, placement = "bottom-end", className, offset = [0, 8], children, }) => {
7
+ const defaultTrigger = (_jsx("button", { className: "flex h-10 w-10 items-center justify-center rounded-lg transition-colors hover:bg-accent-primary/10", "aria-label": "Settings menu", children: _jsx(SettingsIcon, {}) }));
8
+ return (_jsx(Menu, { trigger: trigger || defaultTrigger, open: open, onOpenChange: onOpenChange, placement: placement, className: className, offset: offset, children: children }));
9
+ };
10
+ export const SettingMenu = SettingMenuBase;
11
+ SettingMenu.Title = SettingMenuTitle;
12
+ SettingMenu.Group = SettingMenuGroup;
13
+ SettingMenu.Item = SettingMenuItem;
14
+ SettingMenu.SubMenu = SettingMenuSubMenu;
15
+ SettingMenu.Description = SettingMenuDescription;
16
+ SettingMenu.CustomContent = SettingMenuCustomContent;
17
+ SettingMenu.Spacer = Spacer;
@@ -0,0 +1,5 @@
1
+ import { Meta, StoryFn } from "@storybook/react";
2
+ import { SettingMenu } from "./SettingMenu";
3
+ declare const _default: Meta<typeof SettingMenu>;
4
+ export default _default;
5
+ export declare const Default: StoryFn;
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { SettingMenu } from "./SettingMenu";
4
+ import { Button } from "@/components/Button";
5
+ import { useIsMobile } from "@/hooks/useIsMobile";
6
+ export default {
7
+ title: "Widgets/sections/SettingMenu",
8
+ component: SettingMenu,
9
+ argTypes: {
10
+ onOpenChange: { action: "open state changed" },
11
+ },
12
+ tags: ["autodocs"],
13
+ };
14
+ const ThemeIcon = () => (_jsxs("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { width: "40", height: "40", rx: "20", fill: "#387085", fillOpacity: "0.12" }), _jsx("path", { d: "M20 30C25.52 30 30 25.52 30 20C30 14.48 25.52 10 20 10C14.48 10 10 14.48 10 20C10 25.52 14.48 30 20 30ZM21 12.07C24.94 12.56 28 15.92 28 20C28 24.08 24.95 27.44 21 27.93V12.07Z", fill: "#387085" })] }));
15
+ const ReportABugIcon = () => (_jsxs("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { width: "40", height: "40", rx: "20", fill: "#387085", fillOpacity: "0.12" }), _jsx("path", { d: "M23.73 11H16.27L11 16.27V23.73L16.27 29H23.73L29 23.73V16.27L23.73 11ZM20 25.3C19.28 25.3 18.7 24.72 18.7 24C18.7 23.28 19.28 22.7 20 22.7C20.72 22.7 21.3 23.28 21.3 24C21.3 24.72 20.72 25.3 20 25.3ZM21 21H19V15H21V21Z", fill: "#387085" })] }));
16
+ export const Default = () => {
17
+ const [selectedTheme, setSelectedTheme] = useState("auto");
18
+ const isMobile = useIsMobile();
19
+ const handleThemeChange = (theme) => {
20
+ setSelectedTheme(theme);
21
+ };
22
+ const getThemeDescription = () => {
23
+ switch (selectedTheme) {
24
+ case "light":
25
+ return "Light";
26
+ case "dark":
27
+ return "Dark";
28
+ case "auto":
29
+ return "Auto";
30
+ default:
31
+ return "Auto";
32
+ }
33
+ };
34
+ return (_jsx("div", { className: "p-4", children: _jsxs(SettingMenu, { children: [_jsx(SettingMenu.Title, { children: "Settings" }), _jsxs(SettingMenu.Group, { background: "secondary", children: [_jsxs(SettingMenu.SubMenu, { icon: _jsx(ThemeIcon, {}), children: ["Theme", _jsx(SettingMenu.Description, { children: getThemeDescription() }), _jsx(SettingMenu.Item, { selected: selectedTheme === "light", onClick: () => handleThemeChange("light"), children: "Light" }), _jsx(SettingMenu.Item, { selected: selectedTheme === "dark", onClick: () => handleThemeChange("dark"), children: "Dark" }), _jsx(SettingMenu.Item, { selected: selectedTheme === "auto", onClick: () => handleThemeChange("auto"), children: "Auto" })] }), _jsx(SettingMenu.Item, { icon: _jsx(ReportABugIcon, {}), onClick: () => console.log("Report bug clicked"), children: "Report a Bug" })] }), isMobile && _jsx(SettingMenu.Spacer, {}), _jsxs(SettingMenu.Group, { background: "secondary", children: [_jsx(SettingMenu.Item, { onClick: () => window.open("https://example.com/terms", "_blank"), children: "Terms of Use" }), _jsx(SettingMenu.Item, { onClick: () => window.open("https://example.com/privacy", "_blank"), children: "Privacy Policy" })] }), _jsx(SettingMenu.Spacer, {}), _jsx(SettingMenu.CustomContent, { className: "my-4 flex justify-center", children: _jsx(Button, { className: "!bg-[#D5FCE8] !text-black", variant: "contained", children: "Switch to BABY Staking" }) })] }) }));
35
+ };
@@ -1,4 +1,4 @@
1
- import { default as React, ReactNode } from 'react';
1
+ import React, { ReactNode } from "react";
2
2
  export interface SettingMenuCustomContentProps {
3
3
  children: ReactNode;
4
4
  className?: string;
@@ -0,0 +1,2 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export const SettingMenuCustomContent = ({ children, className = "" }) => (_jsx("div", { className: className, children: children }));
@@ -1,4 +1,4 @@
1
- import { default as React, ReactNode } from 'react';
1
+ import React, { ReactNode } from "react";
2
2
  export interface SettingMenuDescriptionProps {
3
3
  children: ReactNode;
4
4
  className?: string;
@@ -0,0 +1,4 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ export const SettingMenuDescription = ({ children }) => {
3
+ return _jsx(_Fragment, { children: children });
4
+ };
@@ -1,4 +1,4 @@
1
- import { default as React, ReactNode } from 'react';
1
+ import React, { ReactNode } from "react";
2
2
  export interface SettingMenuGroupProps {
3
3
  /** Background style for the group */
4
4
  background?: "none" | "secondary" | "custom";
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { twJoin } from "tailwind-merge";
3
+ export const SettingMenuGroup = ({ background = "none", backgroundClassName = "", className = "", children, }) => {
4
+ const getBackgroundClass = () => {
5
+ switch (background) {
6
+ case "secondary":
7
+ return "mx-[21px] rounded-lg bg-secondary-highlight md:mx-0 md:bg-transparent";
8
+ case "custom":
9
+ return backgroundClassName;
10
+ default:
11
+ return "";
12
+ }
13
+ };
14
+ return _jsx("div", { className: twJoin(getBackgroundClass(), className), children: children });
15
+ };
@@ -1,4 +1,4 @@
1
- import { default as React, ReactNode } from 'react';
1
+ import React, { ReactNode } from "react";
2
2
  export interface SettingMenuItemProps {
3
3
  /** Icon element */
4
4
  icon?: ReactNode;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { MenuItem } from "@/components/Menu/MenuItem";
4
+ import { ChevronRightIcon } from "@/elements/Icons";
5
+ import { SettingMenuDescription } from "./SettingMenuDescription";
6
+ export const SettingMenuItem = ({ icon, suffix, onClick, disabled = false, selected = false, className = "", children, }) => {
7
+ const childrenArray = React.Children.toArray(children);
8
+ const label = childrenArray.find((child) => typeof child === "string" || (React.isValidElement(child) && child.type !== SettingMenuDescription));
9
+ const description = childrenArray.find((child) => React.isValidElement(child) && child.type === SettingMenuDescription);
10
+ const labelText = typeof label === "string" ? label : "";
11
+ const defaultSuffix = onClick ? _jsx(ChevronRightIcon, {}) : undefined;
12
+ return (_jsx(MenuItem, { icon: icon, name: labelText, description: description ? description.props.children : undefined, onClick: onClick, disabled: disabled, selected: selected, className: className, suffix: suffix || defaultSuffix }));
13
+ };