@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.
- package/dist/components/Accordion/Accordion.d.ts +2 -2
- package/dist/components/Accordion/Accordion.js +25 -0
- package/dist/components/Accordion/Accordion.stories.d.ts +6 -0
- package/dist/components/Accordion/Accordion.stories.js +16 -0
- package/dist/components/Accordion/components/AccordionDetails.d.ts +1 -1
- package/dist/components/Accordion/components/AccordionDetails.js +29 -0
- package/dist/components/Accordion/components/AccordionSummary.d.ts +1 -1
- package/dist/components/Accordion/components/AccordionSummary.js +10 -0
- package/dist/components/Accordion/hooks/useHeightObserver.d.ts +1 -1
- package/dist/components/Accordion/hooks/useHeightObserver.js +24 -0
- package/dist/components/Accordion/index.d.ts +4 -3
- package/dist/components/Accordion/index.js +4 -0
- package/dist/components/AmountItem/AmountItem.d.ts +1 -1
- package/dist/components/AmountItem/AmountItem.js +5 -0
- package/dist/components/AmountItem/AmountItem.stories.d.ts +6 -0
- package/dist/components/AmountItem/AmountItem.stories.js +29 -0
- package/dist/components/AmountItem/index.d.ts +1 -1
- package/dist/components/AmountItem/index.js +1 -0
- package/dist/components/Avatar/Avatar.d.ts +2 -1
- package/dist/components/Avatar/Avatar.js +6 -0
- package/dist/components/Avatar/Avatar.stories.d.ts +7 -0
- package/dist/components/Avatar/Avatar.stories.js +18 -0
- package/dist/components/Avatar/AvatarGroup.d.ts +3 -2
- package/dist/components/Avatar/AvatarGroup.js +15 -0
- package/dist/components/Avatar/AvatarGroup.stories.d.ts +6 -0
- package/dist/components/Avatar/AvatarGroup.stories.js +21 -0
- package/dist/components/Avatar/index.d.ts +2 -2
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Badge/Badge.d.ts +2 -1
- package/dist/components/Badge/Badge.js +10 -0
- package/dist/components/Badge/Badge.stories.d.ts +6 -0
- package/dist/components/Badge/Badge.stories.js +14 -0
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Badge/index.js +1 -0
- package/dist/components/Button/Button.d.ts +3 -2
- package/dist/components/Button/Button.js +8 -0
- package/dist/components/Button/Button.stories.d.ts +6 -0
- package/dist/components/Button/Button.stories.js +9 -0
- package/dist/components/Button/IconButton.d.ts +2 -1
- package/dist/components/Button/IconButton.js +6 -0
- package/dist/components/Button/IconButton.stories.d.ts +6 -0
- package/dist/components/Button/IconButton.stories.js +13 -0
- package/dist/components/Button/WalletDisconnectButton.d.ts +2 -2
- package/dist/components/Button/WalletDisconnectButton.js +8 -0
- package/dist/components/Button/index.d.ts +3 -3
- package/dist/components/Button/index.js +3 -0
- package/dist/components/Card/Card.d.ts +4 -3
- package/dist/components/Card/Card.js +6 -0
- package/dist/components/Card/Card.stories.d.ts +6 -0
- package/dist/components/Card/Card.stories.js +10 -0
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Card/index.js +1 -0
- package/dist/components/Chip/Chip.d.ts +2 -1
- package/dist/components/Chip/Chip.js +6 -0
- package/dist/components/Chip/Chip.stories.d.ts +6 -0
- package/dist/components/Chip/Chip.stories.js +9 -0
- package/dist/components/Chip/index.d.ts +1 -1
- package/dist/components/Chip/index.js +1 -0
- package/dist/components/Copy/Copy.d.ts +1 -1
- package/dist/components/Copy/Copy.js +29 -0
- package/dist/components/Copy/index.js +1 -0
- package/dist/components/CounterButton/CounterButton.js +8 -0
- package/dist/components/CounterButton/CounterButton.stories.d.ts +10 -0
- package/dist/components/CounterButton/CounterButton.stories.js +41 -0
- package/dist/components/CounterButton/index.d.ts +1 -1
- package/dist/components/CounterButton/index.js +1 -0
- package/dist/components/Dialog/Dialog.d.ts +1 -1
- package/dist/components/Dialog/Dialog.js +9 -0
- package/dist/components/Dialog/Dialog.stories.d.ts +7 -0
- package/dist/components/Dialog/Dialog.stories.js +41 -0
- package/dist/components/Dialog/MobileDialog.d.ts +1 -1
- package/dist/components/Dialog/MobileDialog.js +10 -0
- package/dist/components/Dialog/MobileDialog.stories.d.ts +6 -0
- package/dist/components/Dialog/MobileDialog.stories.js +27 -0
- package/dist/components/Dialog/components/Backdrop.d.ts +2 -1
- package/dist/components/Dialog/components/Backdrop.js +4 -0
- package/dist/components/Dialog/components/DialogBody.d.ts +1 -1
- package/dist/components/Dialog/components/DialogBody.js +3 -0
- package/dist/components/Dialog/components/DialogFooter.d.ts +1 -1
- package/dist/components/Dialog/components/DialogFooter.js +3 -0
- package/dist/components/Dialog/components/DialogHeader.d.ts +1 -1
- package/dist/components/Dialog/components/DialogHeader.js +5 -0
- package/dist/components/Dialog/index.d.ts +6 -5
- package/dist/components/Dialog/index.js +6 -0
- package/dist/components/DisplayHash/DisplayHash.d.ts +1 -1
- package/dist/components/DisplayHash/DisplayHash.js +10 -0
- package/dist/components/DisplayHash/index.js +1 -0
- package/dist/components/FeeItem/FeeItem.d.ts +1 -1
- package/dist/components/FeeItem/FeeItem.js +6 -0
- package/dist/components/FeeItem/FeeItem.stories.d.ts +7 -0
- package/dist/components/FeeItem/FeeItem.stories.js +19 -0
- package/dist/components/Form/Checkbox.d.ts +2 -2
- package/dist/components/Form/Checkbox.js +10 -0
- package/dist/components/Form/Checkbox.stories.d.ts +6 -0
- package/dist/components/Form/Checkbox.stories.js +13 -0
- package/dist/components/Form/FormControl.d.ts +2 -1
- package/dist/components/Form/FormControl.js +6 -0
- package/dist/components/Form/FormControl.stories.d.ts +8 -0
- package/dist/components/Form/FormControl.stories.js +30 -0
- package/dist/components/Form/Input.d.ts +3 -2
- package/dist/components/Form/Input.js +8 -0
- package/dist/components/Form/Input.stories.d.ts +10 -0
- package/dist/components/Form/Input.stories.js +43 -0
- package/dist/components/Form/Radio.d.ts +2 -2
- package/dist/components/Form/Radio.js +10 -0
- package/dist/components/Form/Radio.stories.d.ts +6 -0
- package/dist/components/Form/Radio.stories.js +13 -0
- package/dist/components/Form/Select.d.ts +3 -2
- package/dist/components/Form/Select.js +39 -0
- package/dist/components/Form/Select.stories.d.ts +9 -0
- package/dist/components/Form/Select.stories.js +47 -0
- package/dist/components/Form/components/Toggle.d.ts +3 -2
- package/dist/components/Form/components/Toggle.js +22 -0
- package/dist/components/Form/index.d.ts +5 -5
- package/dist/components/Form/index.js +5 -0
- package/dist/components/Heading/Heading.d.ts +3 -2
- package/dist/components/Heading/Heading.js +9 -0
- package/dist/components/Heading/Heading.stories.d.ts +6 -0
- package/dist/components/Heading/Heading.stories.js +10 -0
- package/dist/components/Heading/index.d.ts +1 -1
- package/dist/components/Heading/index.js +1 -0
- package/dist/components/Icons/ThemedIcon.js +25 -0
- package/dist/components/Icons/common/CloseIcon.d.ts +1 -1
- package/dist/components/Icons/common/CloseIcon.js +7 -0
- package/dist/components/Icons/common/CopyIcon.d.ts +1 -1
- package/dist/components/Icons/common/CopyIcon.js +7 -0
- package/dist/components/Icons/index.d.ts +6 -6
- package/dist/components/Icons/index.js +18 -0
- package/dist/components/Icons/wallet/BitcoinPublicKeyIcon.d.ts +1 -1
- package/dist/components/Icons/wallet/BitcoinPublicKeyIcon.js +5 -0
- package/dist/components/Icons/wallet/LinkWalletIcon.d.ts +1 -1
- package/dist/components/Icons/wallet/LinkWalletIcon.js +5 -0
- package/dist/components/Icons/wallet/UsingInscriptionIcon.d.ts +1 -1
- package/dist/components/Icons/wallet/UsingInscriptionIcon.js +5 -0
- package/dist/components/List/List.d.ts +3 -2
- package/dist/components/List/List.js +16 -0
- package/dist/components/List/List.stories.d.ts +11 -0
- package/dist/components/List/List.stories.js +69 -0
- package/dist/components/List/components/ListItem.js +6 -0
- package/dist/components/List/index.d.ts +2 -2
- package/dist/components/List/index.js +2 -0
- package/dist/components/ListLegacy/ListLegacy.d.ts +3 -2
- package/dist/components/ListLegacy/ListLegacy.js +16 -0
- package/dist/components/ListLegacy/ListLegacy.stories.d.ts +11 -0
- package/dist/components/ListLegacy/ListLegacy.stories.js +71 -0
- package/dist/components/ListLegacy/components/ListItemLegacy.js +6 -0
- package/dist/components/ListLegacy/index.d.ts +2 -2
- package/dist/components/ListLegacy/index.js +2 -0
- package/dist/components/Loader/Loader.d.ts +1 -0
- package/dist/components/Loader/Loader.js +6 -0
- package/dist/components/Loader/Loader.stories.d.ts +6 -0
- package/dist/components/Loader/Loader.stories.js +11 -0
- package/dist/components/Loader/index.d.ts +1 -1
- package/dist/components/Loader/index.js +1 -0
- package/dist/components/Menu/Menu.d.ts +2 -2
- package/dist/components/Menu/Menu.js +29 -0
- package/dist/components/Menu/Menu.stories.d.ts +6 -0
- package/dist/components/Menu/Menu.stories.js +38 -0
- package/dist/components/Menu/MenuContext.d.ts +1 -1
- package/dist/components/Menu/MenuContext.js +9 -0
- package/dist/components/Menu/MenuDrawer.d.ts +1 -1
- package/dist/components/Menu/MenuDrawer.js +22 -0
- package/dist/components/Menu/MenuItem.d.ts +1 -1
- package/dist/components/Menu/MenuItem.js +20 -0
- package/dist/components/Menu/SubMenu.d.ts +1 -1
- package/dist/components/Menu/SubMenu.js +12 -0
- package/dist/components/Menu/SubMenuItem.d.ts +1 -1
- package/dist/components/Menu/SubMenuItem.js +6 -0
- package/dist/components/Menu/index.d.ts +6 -6
- package/dist/components/Menu/index.js +6 -0
- package/dist/components/Popover/Popover.d.ts +3 -2
- package/dist/components/Popover/Popover.js +16 -0
- package/dist/components/Popover/Popover.stories.d.ts +6 -0
- package/dist/components/Popover/Popover.stories.js +25 -0
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Popover/index.js +1 -0
- package/dist/components/Portal/Portal.d.ts +2 -2
- package/dist/components/Portal/Portal.js +45 -0
- package/dist/components/Portal/index.d.ts +1 -1
- package/dist/components/Portal/index.js +1 -0
- package/dist/components/Spacer/Spacer.d.ts +1 -1
- package/dist/components/Spacer/Spacer.js +9 -0
- package/dist/components/Spacer/index.js +1 -0
- package/dist/components/SubSection/SubSection.d.ts +1 -1
- package/dist/components/SubSection/SubSection.js +3 -0
- package/dist/components/SubSection/SubSection.stories.d.ts +6 -0
- package/dist/components/SubSection/SubSection.stories.js +13 -0
- package/dist/components/SubSection/index.d.ts +1 -1
- package/dist/components/SubSection/index.js +1 -0
- package/dist/components/Table/Table.d.ts +2 -1
- package/dist/components/Table/Table.js +37 -0
- package/dist/components/Table/Table.stories.d.ts +7 -0
- package/dist/components/Table/Table.stories.js +131 -0
- package/dist/components/Table/components/Cell.d.ts +1 -1
- package/dist/components/Table/components/Cell.js +6 -0
- package/dist/components/Table/components/Column.d.ts +1 -1
- package/dist/components/Table/components/Column.js +17 -0
- package/dist/components/Table/components/Row.d.ts +1 -1
- package/dist/components/Table/components/Row.js +6 -0
- package/dist/components/Table/index.d.ts +4 -4
- package/dist/components/Table/index.js +4 -0
- package/dist/components/Table/types/index.d.ts +1 -1
- package/dist/components/Table/types/index.js +1 -0
- package/dist/components/Text/Text.d.ts +3 -2
- package/dist/components/Text/Text.js +11 -0
- package/dist/components/Text/Text.stories.d.ts +6 -0
- package/dist/components/Text/Text.stories.js +10 -0
- package/dist/components/Text/index.d.ts +1 -1
- package/dist/components/Text/index.js +1 -0
- package/dist/components/Toggle/Toggle.d.ts +1 -0
- package/dist/components/Toggle/Toggle.js +12 -0
- package/dist/components/Toggle/Toggle.stories.d.ts +6 -0
- package/dist/components/Toggle/Toggle.stories.js +14 -0
- package/dist/components/Toggle/index.d.ts +1 -1
- package/dist/components/Toggle/index.js +1 -0
- package/dist/components/Warning/Warning.d.ts +2 -1
- package/dist/components/Warning/Warning.js +6 -0
- package/dist/components/Warning/Warning.stories.d.ts +9 -0
- package/dist/components/Warning/Warning.stories.js +26 -0
- package/dist/components/Warning/index.d.ts +1 -1
- package/dist/components/Warning/index.js +1 -0
- package/dist/components/index.js +3 -0
- package/dist/context/Dialog.context.d.ts +2 -2
- package/dist/context/Dialog.context.js +33 -0
- package/dist/context/Table.context.d.ts +2 -2
- package/dist/context/Table.context.js +8 -0
- package/dist/elements/FinalityProviderItem/FinalityProviderItem.js +30 -0
- package/dist/elements/FinalityProviderItem/FinalityProviderItem.stories.d.ts +12 -0
- package/dist/elements/FinalityProviderItem/FinalityProviderItem.stories.js +97 -0
- package/dist/elements/FinalityProviderItem/index.d.ts +1 -1
- package/dist/elements/FinalityProviderItem/index.js +1 -0
- package/dist/elements/FinalityProviderLogo/FinalityProviderLogo.js +24 -0
- package/dist/elements/FinalityProviderLogo/FinalityProviderLogo.stories.d.ts +13 -0
- package/dist/elements/FinalityProviderLogo/FinalityProviderLogo.stories.js +61 -0
- package/dist/elements/FinalityProviderLogo/index.d.ts +1 -1
- package/dist/elements/FinalityProviderLogo/index.js +1 -0
- package/dist/elements/Icons/ChevronRightIcon.d.ts +1 -1
- package/dist/elements/Icons/ChevronRightIcon.js +2 -0
- package/dist/elements/Icons/SettingsIcon.d.ts +1 -1
- package/dist/elements/Icons/SettingsIcon.js +2 -0
- package/dist/elements/Icons/index.js +2 -0
- package/dist/elements/ProvidersList/ProvidersList.js +9 -0
- package/dist/elements/ProvidersList/ProvidersList.stories.d.ts +10 -0
- package/dist/elements/ProvidersList/ProvidersList.stories.js +139 -0
- package/dist/elements/ProvidersList/index.d.ts +1 -1
- package/dist/elements/ProvidersList/index.js +1 -0
- package/dist/elements/Table/Table.d.ts +1 -1
- package/dist/elements/Table/Table.js +14 -0
- package/dist/elements/Table/Table.stories.d.ts +8 -0
- package/dist/elements/Table/Table.stories.js +50 -0
- package/dist/elements/Table/index.d.ts +1 -1
- package/dist/elements/Table/index.js +1 -0
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/useClickOutside.js +17 -0
- package/dist/hooks/useControlledState.js +13 -0
- package/dist/hooks/useCopy.js +48 -0
- package/dist/hooks/useIsMobile.js +33 -0
- package/dist/hooks/useMemoizedArray.js +22 -0
- package/dist/hooks/useModalManager.js +28 -0
- package/dist/hooks/useResizeObserver.js +21 -0
- package/dist/hooks/useTableScroll.d.ts +1 -1
- package/dist/hooks/useTableScroll.js +22 -0
- package/dist/hooks/useTableSort.d.ts +1 -1
- package/dist/hooks/useTableSort.js +46 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +46 -44
- package/dist/index.es.js +1379 -1246
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +46 -0
- package/dist/style.css +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/dist/utils/constants.js +3 -0
- package/dist/utils/css.js +6 -0
- package/dist/utils/helpers.js +71 -0
- package/dist/utils/trim.js +14 -0
- package/dist/widgets/form/CheckboxField/CheckboxField.d.ts +1 -1
- package/dist/widgets/form/CheckboxField/CheckboxField.js +7 -0
- package/dist/widgets/form/CheckboxField/CheckboxField.stories.d.ts +6 -0
- package/dist/widgets/form/CheckboxField/CheckboxField.stories.js +17 -0
- package/dist/widgets/form/CheckboxField/index.d.ts +1 -1
- package/dist/widgets/form/CheckboxField/index.js +1 -0
- package/dist/widgets/form/Form/Form.d.ts +3 -3
- package/dist/widgets/form/Form/Form.js +20 -0
- package/dist/widgets/form/Form/Form.stories.d.ts +6 -0
- package/dist/widgets/form/Form/Form.stories.js +27 -0
- package/dist/widgets/form/Form/index.d.ts +1 -1
- package/dist/widgets/form/Form/index.js +1 -0
- package/dist/widgets/form/HiddenField/HiddenField.d.ts +1 -1
- package/dist/widgets/form/HiddenField/HiddenField.js +13 -0
- package/dist/widgets/form/HiddenField/HiddenField.stories.d.ts +6 -0
- package/dist/widgets/form/HiddenField/HiddenField.stories.js +17 -0
- package/dist/widgets/form/HiddenField/index.d.ts +1 -1
- package/dist/widgets/form/HiddenField/index.js +1 -0
- package/dist/widgets/form/NumberField/NumberField.d.ts +2 -2
- package/dist/widgets/form/NumberField/NumberField.js +15 -0
- package/dist/widgets/form/NumberField/NumberField.stories.d.ts +6 -0
- package/dist/widgets/form/NumberField/NumberField.stories.js +31 -0
- package/dist/widgets/form/NumberField/index.d.ts +1 -1
- package/dist/widgets/form/NumberField/index.js +1 -0
- package/dist/widgets/form/RadioField/RadioField.d.ts +1 -1
- package/dist/widgets/form/RadioField/RadioField.js +7 -0
- package/dist/widgets/form/RadioField/RadioField.stories.d.ts +6 -0
- package/dist/widgets/form/RadioField/RadioField.stories.js +14 -0
- package/dist/widgets/form/RadioField/index.d.ts +1 -1
- package/dist/widgets/form/RadioField/index.js +1 -0
- package/dist/widgets/form/SelectField/SelectField.d.ts +3 -3
- package/dist/widgets/form/SelectField/SelectField.js +13 -0
- package/dist/widgets/form/SelectField/SelectField.stories.d.ts +6 -0
- package/dist/widgets/form/SelectField/SelectField.stories.js +33 -0
- package/dist/widgets/form/SelectField/index.d.ts +1 -1
- package/dist/widgets/form/SelectField/index.js +1 -0
- package/dist/widgets/form/TextField/TextField.d.ts +2 -2
- package/dist/widgets/form/TextField/TextField.js +9 -0
- package/dist/widgets/form/TextField/TextField.stories.d.ts +6 -0
- package/dist/widgets/form/TextField/TextField.stories.js +28 -0
- package/dist/widgets/form/TextField/index.d.ts +1 -1
- package/dist/widgets/form/TextField/index.js +1 -0
- package/dist/widgets/form/hooks.d.ts +3 -3
- package/dist/widgets/form/hooks.js +29 -0
- package/dist/widgets/form/types.js +1 -0
- package/dist/widgets/sections/ActivityCard/ActivityCard.d.ts +37 -0
- package/dist/widgets/sections/ActivityCard/ActivityCard.js +7 -0
- package/dist/widgets/sections/ActivityCard/ActivityCard.stories.d.ts +14 -0
- package/dist/widgets/sections/ActivityCard/ActivityCard.stories.js +228 -0
- package/dist/widgets/sections/ActivityCard/components/ActivityCardActionSection.d.ts +6 -0
- package/dist/widgets/sections/ActivityCard/components/ActivityCardActionSection.js +5 -0
- package/dist/widgets/sections/ActivityCard/components/ActivityCardAmountSection.d.ts +9 -0
- package/dist/widgets/sections/ActivityCard/components/ActivityCardAmountSection.js +6 -0
- package/dist/widgets/sections/ActivityCard/components/ActivityCardDetailsSection.d.ts +11 -0
- package/dist/widgets/sections/ActivityCard/components/ActivityCardDetailsSection.js +10 -0
- package/dist/widgets/sections/ActivityCard/components/ActivityListItem.d.ts +12 -0
- package/dist/widgets/sections/ActivityCard/components/ActivityListItem.js +5 -0
- package/dist/widgets/sections/ActivityCard/index.d.ts +5 -0
- package/dist/widgets/sections/ActivityCard/index.js +5 -0
- package/dist/widgets/sections/AmountSubsection/AmountSubsection.js +29 -0
- package/dist/widgets/sections/AmountSubsection/AmountSubsection.stories.d.ts +6 -0
- package/dist/widgets/sections/AmountSubsection/AmountSubsection.stories.js +35 -0
- package/dist/widgets/sections/AmountSubsection/index.d.ts +1 -1
- package/dist/widgets/sections/AmountSubsection/index.js +1 -0
- package/dist/widgets/sections/FeesSection/BBNFeeAmount.js +7 -0
- package/dist/widgets/sections/FeesSection/BTCFeeAmount.js +19 -0
- package/dist/widgets/sections/FeesSection/BTCFeeRate.js +7 -0
- package/dist/widgets/sections/FeesSection/FeesSection.js +10 -0
- package/dist/widgets/sections/FeesSection/FeesSection.stories.d.ts +6 -0
- package/dist/widgets/sections/FeesSection/FeesSection.stories.js +14 -0
- package/dist/widgets/sections/FeesSection/Total.js +20 -0
- package/dist/widgets/sections/FeesSection/index.d.ts +6 -6
- package/dist/widgets/sections/FeesSection/index.js +6 -0
- package/dist/widgets/sections/FinalityProviderSubsection/FinalityProviderSubsection.d.ts +1 -1
- package/dist/widgets/sections/FinalityProviderSubsection/FinalityProviderSubsection.js +9 -0
- package/dist/widgets/sections/FinalityProviderSubsection/FinalityProviderSubsection.stories.d.ts +13 -0
- package/dist/widgets/sections/FinalityProviderSubsection/FinalityProviderSubsection.stories.js +191 -0
- package/dist/widgets/sections/FinalityProviderSubsection/index.d.ts +1 -1
- package/dist/widgets/sections/FinalityProviderSubsection/index.js +1 -0
- package/dist/widgets/sections/PreviewModal/PreviewModal.d.ts +1 -1
- package/dist/widgets/sections/PreviewModal/PreviewModal.js +37 -0
- package/dist/widgets/sections/PreviewModal/PreviewModal.stories.d.ts +6 -0
- package/dist/widgets/sections/PreviewModal/PreviewModal.stories.js +47 -0
- package/dist/widgets/sections/PreviewModal/index.d.ts +1 -1
- package/dist/widgets/sections/PreviewModal/index.js +1 -0
- package/dist/widgets/sections/RewardsPreviewModal/RewardsPreviewModal.d.ts +1 -1
- package/dist/widgets/sections/RewardsPreviewModal/RewardsPreviewModal.js +16 -0
- package/dist/widgets/sections/RewardsPreviewModal/RewardsPreviewModal.stories.d.ts +7 -0
- package/dist/widgets/sections/RewardsPreviewModal/RewardsPreviewModal.stories.js +60 -0
- package/dist/widgets/sections/RewardsSubsection/RewardsSubsection.js +13 -0
- package/dist/widgets/sections/RewardsSubsection/RewardsSubsection.stories.d.ts +7 -0
- package/dist/widgets/sections/RewardsSubsection/RewardsSubsection.stories.js +60 -0
- package/dist/widgets/sections/RewardsSubsection/index.d.ts +1 -1
- package/dist/widgets/sections/RewardsSubsection/index.js +1 -0
- package/dist/widgets/sections/SettingMenu/SettingMenu.d.ts +3 -3
- package/dist/widgets/sections/SettingMenu/SettingMenu.js +17 -0
- package/dist/widgets/sections/SettingMenu/SettingMenu.stories.d.ts +5 -0
- package/dist/widgets/sections/SettingMenu/SettingMenu.stories.js +35 -0
- package/dist/widgets/sections/SettingMenu/components/SettingMenuCustomContent.d.ts +1 -1
- package/dist/widgets/sections/SettingMenu/components/SettingMenuCustomContent.js +2 -0
- package/dist/widgets/sections/SettingMenu/components/SettingMenuDescription.d.ts +1 -1
- package/dist/widgets/sections/SettingMenu/components/SettingMenuDescription.js +4 -0
- package/dist/widgets/sections/SettingMenu/components/SettingMenuGroup.d.ts +1 -1
- package/dist/widgets/sections/SettingMenu/components/SettingMenuGroup.js +15 -0
- package/dist/widgets/sections/SettingMenu/components/SettingMenuItem.d.ts +1 -1
- package/dist/widgets/sections/SettingMenu/components/SettingMenuItem.js +13 -0
- package/dist/widgets/sections/SettingMenu/components/SettingMenuSubMenu.d.ts +1 -1
- package/dist/widgets/sections/SettingMenu/components/SettingMenuSubMenu.js +14 -0
- package/dist/widgets/sections/SettingMenu/components/SettingMenuTitle.d.ts +1 -1
- package/dist/widgets/sections/SettingMenu/components/SettingMenuTitle.js +4 -0
- package/dist/widgets/sections/SettingMenu/components/index.d.ts +12 -12
- package/dist/widgets/sections/SettingMenu/components/index.js +6 -0
- package/dist/widgets/sections/SettingMenu/index.d.ts +14 -14
- package/dist/widgets/sections/SettingMenu/index.js +7 -0
- package/dist/widgets/sections/TableElement/TableElement.d.ts +1 -1
- package/dist/widgets/sections/TableElement/TableElement.js +6 -0
- package/dist/widgets/sections/TableElement/TableElement.stories.d.ts +9 -0
- package/dist/widgets/sections/TableElement/TableElement.stories.js +54 -0
- package/dist/widgets/sections/TableElement/index.d.ts +1 -1
- package/dist/widgets/sections/TableElement/index.js +1 -0
- package/dist/widgets/sections/WalletMenu/WalletMenu.d.ts +1 -1
- package/dist/widgets/sections/WalletMenu/WalletMenu.js +22 -0
- package/dist/widgets/sections/WalletMenu/WalletMenu.stories.d.ts +6 -0
- package/dist/widgets/sections/WalletMenu/WalletMenu.stories.js +35 -0
- package/dist/widgets/sections/WalletMenu/components/WalletInfoCard.d.ts +1 -1
- package/dist/widgets/sections/WalletMenu/components/WalletInfoCard.js +9 -0
- package/dist/widgets/sections/WalletMenu/components/WalletInfoSection.d.ts +1 -1
- package/dist/widgets/sections/WalletMenu/components/WalletInfoSection.js +8 -0
- package/dist/widgets/sections/WalletMenu/components/WalletSettingItem.d.ts +1 -1
- package/dist/widgets/sections/WalletMenu/components/WalletSettingItem.js +7 -0
- package/dist/widgets/sections/WalletMenu/components/WalletToggle.d.ts +1 -1
- package/dist/widgets/sections/WalletMenu/components/WalletToggle.js +12 -0
- package/dist/widgets/sections/WalletMenu/components/index.js +4 -0
- package/dist/widgets/sections/WalletMenu/index.js +5 -0
- package/package.json +4 -10
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { ActivityCard } from "./ActivityCard";
|
|
2
|
+
const meta = {
|
|
3
|
+
component: ActivityCard,
|
|
4
|
+
tags: ["autodocs"],
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
export const Basic = {
|
|
8
|
+
args: {
|
|
9
|
+
data: {
|
|
10
|
+
formattedAmount: "1.5 BTC",
|
|
11
|
+
details: [
|
|
12
|
+
{ label: "Status", value: "Confirmed" },
|
|
13
|
+
{ label: "Date", value: "Mar 15, 2024" },
|
|
14
|
+
{ label: "Transaction ID", value: "bc1q...xyz789" },
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
export const WithIcon = {
|
|
20
|
+
args: {
|
|
21
|
+
data: {
|
|
22
|
+
formattedAmount: "2.3 BTC",
|
|
23
|
+
icon: "/images/fps/lombard.jpeg",
|
|
24
|
+
iconAlt: "Lombard Protocol",
|
|
25
|
+
details: [
|
|
26
|
+
{ label: "Status", value: "Pending" },
|
|
27
|
+
{ label: "Date", value: "Mar 16, 2024" },
|
|
28
|
+
{ label: "Fee", value: "0.0001 BTC" },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const WithPrimaryAction = {
|
|
34
|
+
args: {
|
|
35
|
+
data: {
|
|
36
|
+
formattedAmount: "0.75 BTC",
|
|
37
|
+
icon: "/images/fps/pumpbtc.jpeg",
|
|
38
|
+
iconAlt: "PumpBTC",
|
|
39
|
+
details: [
|
|
40
|
+
{ label: "Status", value: "Pending" },
|
|
41
|
+
{ label: "Date", value: "Mar 16, 2024" },
|
|
42
|
+
{ label: "Confirmations", value: "2/6" },
|
|
43
|
+
],
|
|
44
|
+
primaryAction: {
|
|
45
|
+
label: "View Details",
|
|
46
|
+
onClick: () => alert("Primary action clicked"),
|
|
47
|
+
variant: "contained",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
export const WithSecondaryActions = {
|
|
53
|
+
args: {
|
|
54
|
+
data: {
|
|
55
|
+
formattedAmount: "5.0 BTC",
|
|
56
|
+
icon: "/images/fps/solv.jpeg",
|
|
57
|
+
iconAlt: "Solv Protocol",
|
|
58
|
+
details: [
|
|
59
|
+
{ label: "Status", value: "Completed" },
|
|
60
|
+
{ label: "Date", value: "Mar 14, 2024" },
|
|
61
|
+
{ label: "Recipient", value: "bc1q...abc123" },
|
|
62
|
+
],
|
|
63
|
+
secondaryActions: [
|
|
64
|
+
{
|
|
65
|
+
label: "Copy Hash",
|
|
66
|
+
onClick: () => alert("Hash copied"),
|
|
67
|
+
variant: "outlined",
|
|
68
|
+
size: "small",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: "Export",
|
|
72
|
+
onClick: () => alert("Export clicked"),
|
|
73
|
+
variant: "outlined",
|
|
74
|
+
size: "small",
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
export const WithOptionalDetails = {
|
|
81
|
+
args: {
|
|
82
|
+
data: {
|
|
83
|
+
formattedAmount: "3.2 BTC",
|
|
84
|
+
icon: "/images/wallets/keystone.svg",
|
|
85
|
+
iconAlt: "Keystone Wallet",
|
|
86
|
+
details: [
|
|
87
|
+
{ label: "Status", value: "Confirmed" },
|
|
88
|
+
{ label: "Date", value: "Mar 15, 2024" },
|
|
89
|
+
],
|
|
90
|
+
optionalDetails: [
|
|
91
|
+
{ label: "Network Fee", value: "0.0001 BTC" },
|
|
92
|
+
{ label: "Block Height", value: "834,567" },
|
|
93
|
+
{ label: "Confirmations", value: "6/6" },
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
export const WithListItems = {
|
|
99
|
+
args: {
|
|
100
|
+
data: {
|
|
101
|
+
formattedAmount: "10.5 BTC",
|
|
102
|
+
icon: "/images/wallets/binance.webp",
|
|
103
|
+
iconAlt: "Binance Wallet",
|
|
104
|
+
details: [
|
|
105
|
+
{ label: "Status", value: "Completed" },
|
|
106
|
+
{ label: "Date", value: "Mar 13, 2024" },
|
|
107
|
+
],
|
|
108
|
+
listItems: [
|
|
109
|
+
{
|
|
110
|
+
label: "Finality Providers",
|
|
111
|
+
items: [
|
|
112
|
+
{ name: "Lombard Protocol", id: "fp1", icon: "/images/fps/lombard.jpeg" },
|
|
113
|
+
{ name: "PumpBTC", id: "fp2", icon: "/images/fps/pumpbtc.jpeg" },
|
|
114
|
+
{ name: "Solv Protocol", id: "fp3", icon: "/images/fps/solv.jpeg" },
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
label: "Validators",
|
|
119
|
+
items: [
|
|
120
|
+
{ name: "Validator One", id: "val1" },
|
|
121
|
+
{ name: "Validator Two", id: "val2" },
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
export const Complete = {
|
|
129
|
+
args: {
|
|
130
|
+
data: {
|
|
131
|
+
formattedAmount: "7.8 BTC",
|
|
132
|
+
icon: "/images/fps/lombard.jpeg",
|
|
133
|
+
iconAlt: "Lombard Protocol",
|
|
134
|
+
details: [
|
|
135
|
+
{ label: "Status", value: "Confirmed" },
|
|
136
|
+
{ label: "Date", value: "Mar 12, 2024" },
|
|
137
|
+
{ label: "Type", value: "Delegation" },
|
|
138
|
+
],
|
|
139
|
+
optionalDetails: [
|
|
140
|
+
{ label: "Network Fee", value: "0.00015 BTC" },
|
|
141
|
+
{ label: "Block Height", value: "834,234" },
|
|
142
|
+
{ label: "Lock Time", value: "1000 blocks" },
|
|
143
|
+
],
|
|
144
|
+
listItems: [
|
|
145
|
+
{
|
|
146
|
+
label: "Finality Providers",
|
|
147
|
+
items: [
|
|
148
|
+
{ name: "Lombard Protocol", id: "bp1", icon: "/images/fps/lombard.jpeg" },
|
|
149
|
+
{ name: "Solv Protocol", id: "bp2", icon: "/images/fps/solv.jpeg" },
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
primaryAction: {
|
|
154
|
+
label: "Manage Delegation",
|
|
155
|
+
onClick: () => alert("Manage delegation clicked"),
|
|
156
|
+
variant: "contained",
|
|
157
|
+
fullWidth: true,
|
|
158
|
+
},
|
|
159
|
+
secondaryActions: [
|
|
160
|
+
{
|
|
161
|
+
label: "View on Explorer",
|
|
162
|
+
onClick: () => alert("Explorer opened"),
|
|
163
|
+
variant: "outlined",
|
|
164
|
+
size: "small",
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
label: "Share",
|
|
168
|
+
onClick: () => alert("Share clicked"),
|
|
169
|
+
variant: "outlined",
|
|
170
|
+
size: "small",
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
label: "Export Details",
|
|
174
|
+
onClick: () => alert("Export clicked"),
|
|
175
|
+
variant: "outlined",
|
|
176
|
+
size: "small",
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
export const LargeAmount = {
|
|
183
|
+
args: {
|
|
184
|
+
data: {
|
|
185
|
+
formattedAmount: "1,234.56789 BTC",
|
|
186
|
+
icon: "/images/fps/pumpbtc.jpeg",
|
|
187
|
+
iconAlt: "PumpBTC",
|
|
188
|
+
details: [
|
|
189
|
+
{ label: "Status", value: "High Value Transaction" },
|
|
190
|
+
{ label: "Date", value: "Mar 16, 2024" },
|
|
191
|
+
{ label: "USD Value", value: "$87,421,234.56" },
|
|
192
|
+
],
|
|
193
|
+
primaryAction: {
|
|
194
|
+
label: "Confirm Transaction",
|
|
195
|
+
onClick: () => alert("High value transaction confirmed"),
|
|
196
|
+
variant: "contained",
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
export const ErrorState = {
|
|
202
|
+
args: {
|
|
203
|
+
data: {
|
|
204
|
+
formattedAmount: "0.5 BTC",
|
|
205
|
+
icon: "/images/status/warning.svg",
|
|
206
|
+
iconAlt: "Warning",
|
|
207
|
+
details: [
|
|
208
|
+
{ label: "Status", value: "Failed" },
|
|
209
|
+
{ label: "Date", value: "Mar 16, 2024" },
|
|
210
|
+
{ label: "Error", value: "Insufficient funds" },
|
|
211
|
+
],
|
|
212
|
+
secondaryActions: [
|
|
213
|
+
{
|
|
214
|
+
label: "Retry",
|
|
215
|
+
onClick: () => alert("Retry clicked"),
|
|
216
|
+
variant: "contained",
|
|
217
|
+
size: "small",
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
label: "Cancel",
|
|
221
|
+
onClick: () => alert("Cancel clicked"),
|
|
222
|
+
variant: "outlined",
|
|
223
|
+
size: "small",
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActivityCardActionButton } from "../ActivityCard";
|
|
2
|
+
interface ActivityCardActionSectionProps {
|
|
3
|
+
actions: ActivityCardActionButton[];
|
|
4
|
+
}
|
|
5
|
+
export declare function ActivityCardActionSection({ actions, }: ActivityCardActionSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "../../../../components/Button";
|
|
3
|
+
export function ActivityCardActionSection({ actions, }) {
|
|
4
|
+
return (_jsx("div", { className: "mt-4 sm:mt-6 space-y-2", children: actions.map((action, index) => (_jsx(Button, { variant: action.variant || "outlined", size: action.size || "small", className: `sm:bbn-btn-medium ${action.fullWidth ? "w-full" : ""} ${action.className || ""}`, onClick: action.onClick, children: action.label }, index))) }));
|
|
5
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActivityCardActionButton } from "../ActivityCard";
|
|
2
|
+
interface ActivityCardAmountSectionProps {
|
|
3
|
+
formattedAmount: string;
|
|
4
|
+
icon?: string | React.ReactNode;
|
|
5
|
+
iconAlt?: string;
|
|
6
|
+
primaryAction?: ActivityCardActionButton;
|
|
7
|
+
}
|
|
8
|
+
export declare function ActivityCardAmountSection({ formattedAmount, icon, iconAlt, primaryAction, }: ActivityCardAmountSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "../../../../components/Button";
|
|
3
|
+
export function ActivityCardAmountSection({ formattedAmount, icon, iconAlt, primaryAction, }) {
|
|
4
|
+
return (_jsxs("div", { className: "flex items-center justify-between mb-4 sm:mb-6", children: [_jsxs("div", { className: "flex items-center gap-2", children: [icon &&
|
|
5
|
+
(typeof icon === "string" ? (_jsx("img", { src: icon, alt: iconAlt || "icon", className: "w-6 h-6 sm:w-8 sm:h-8" })) : (icon)), _jsx("span", { className: "text-base sm:text-lg font-medium text-accent-primary", children: formattedAmount })] }), primaryAction && (_jsx(Button, { variant: primaryAction.variant || "contained", size: primaryAction.size || "small", className: `sm:bbn-btn-medium ${primaryAction.className || ""}`, onClick: primaryAction.onClick, children: primaryAction.label }))] }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActivityCardDetailItem, ActivityListItemData } from "../ActivityCard";
|
|
2
|
+
interface ActivityCardDetailsSectionProps {
|
|
3
|
+
details: ActivityCardDetailItem[];
|
|
4
|
+
optionalDetails?: ActivityCardDetailItem[];
|
|
5
|
+
listItems?: {
|
|
6
|
+
label: string;
|
|
7
|
+
items: ActivityListItemData[];
|
|
8
|
+
}[];
|
|
9
|
+
}
|
|
10
|
+
export declare function ActivityCardDetailsSection({ details, optionalDetails, listItems, }: ActivityCardDetailsSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ActivityListItem } from "./ActivityListItem";
|
|
3
|
+
function DetailRow({ label, value }) {
|
|
4
|
+
return (_jsxs("div", { className: "flex items-center justify-between gap-2 min-w-0 overflow-x-auto", children: [_jsx("span", { className: "text-xs sm:text-sm text-accent-secondary flex-shrink-0", children: label }), _jsx("span", { className: "text-xs sm:text-sm text-accent-primary font-medium text-right min-w-0 overflow-x-auto whitespace-nowrap", children: value })] }));
|
|
5
|
+
}
|
|
6
|
+
export function ActivityCardDetailsSection({ details, optionalDetails, listItems, }) {
|
|
7
|
+
const hasOptionalDetails = optionalDetails && optionalDetails.length > 0;
|
|
8
|
+
const hasListItems = listItems && listItems.length > 0;
|
|
9
|
+
return (_jsxs("div", { className: "space-y-3 sm:space-y-4 overflow-x-auto", children: [_jsx("div", { className: "space-y-4 sm:space-y-6", children: details.map((detail, detailIndex) => (_jsx(DetailRow, { label: detail.label, value: detail.value }, detailIndex))) }), hasListItems && (_jsx("div", { className: "space-y-3 sm:space-y-4", children: listItems.map((listSection, sectionIndex) => (_jsx("div", { className: "bg-surface p-3 sm:p-4 rounded space-y-3 sm:space-y-4 overflow-x-auto", children: _jsxs("div", { className: "flex justify-between items-start gap-2", children: [_jsx("span", { className: "text-xs sm:text-sm text-accent-secondary", children: listSection.label }), _jsx("div", { className: "flex flex-wrap gap-2", children: listSection.items.map((item, itemIndex) => (_jsx(ActivityListItem, { item: item }, item.id || itemIndex))) })] }) }, sectionIndex))) })), hasOptionalDetails && (_jsx("div", { className: "bg-surface p-3 sm:p-4 rounded space-y-3 sm:space-y-4 overflow-x-auto", children: optionalDetails.map((detail, index) => (_jsx(DetailRow, { label: detail.label, value: detail.value }, index))) }))] }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ActivityListItemData {
|
|
2
|
+
icon?: string | React.ReactNode;
|
|
3
|
+
iconAlt?: string;
|
|
4
|
+
name: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
}
|
|
7
|
+
interface ActivityListItemProps {
|
|
8
|
+
item: ActivityListItemData;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function ActivityListItem({ item, className }: ActivityListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
export function ActivityListItem({ item, className }) {
|
|
4
|
+
return (_jsxs("div", { className: twMerge("flex items-center gap-2 min-w-0", className), children: [_jsx("span", { className: "text-xs sm:text-sm text-accent-primary font-medium truncate flex items-center", children: item.name }), item.icon && (_jsx("div", { className: "flex items-center w-4 h-4 flex-shrink-0 justify-center text-xs sm:text-sm", children: typeof item.icon === "string" ? (_jsx("img", { src: item.icon, alt: item.iconAlt || item.name, className: "w-full h-full rounded-full object-cover" })) : (item.icon) }))] }));
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ActivityCard, type ActivityCardActionButton, type ActivityCardData, type ActivityCardDetailItem, type ActivityListItemData, } from "./ActivityCard";
|
|
2
|
+
export { ActivityCardActionSection } from "./components/ActivityCardActionSection";
|
|
3
|
+
export { ActivityCardAmountSection } from "./components/ActivityCardAmountSection";
|
|
4
|
+
export { ActivityCardDetailsSection } from "./components/ActivityCardDetailsSection";
|
|
5
|
+
export { ActivityListItem } from "./components/ActivityListItem";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ActivityCard, } from "./ActivityCard";
|
|
2
|
+
export { ActivityCardActionSection } from "./components/ActivityCardActionSection";
|
|
3
|
+
export { ActivityCardAmountSection } from "./components/ActivityCardAmountSection";
|
|
4
|
+
export { ActivityCardDetailsSection } from "./components/ActivityCardDetailsSection";
|
|
5
|
+
export { ActivityListItem } from "./components/ActivityListItem";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { HiddenField } from "@/widgets/form/HiddenField";
|
|
3
|
+
import { SubSection } from "@/components/SubSection";
|
|
4
|
+
import { useFormContext, useWatch } from "react-hook-form";
|
|
5
|
+
import { AmountItem } from "../../../components/AmountItem/AmountItem";
|
|
6
|
+
import { calculateTokenValueInCurrency, maxDecimals } from "@/utils/helpers";
|
|
7
|
+
import { BTC_DECIMAL_PLACES } from "@/utils/constants";
|
|
8
|
+
export const AmountSubsection = ({ fieldName, currencyIcon, currencyName, displayBalance, placeholder = "Enter Amount", balanceDetails, min = "0", step = "any", autoFocus = true, }) => {
|
|
9
|
+
const amount = useWatch({ name: fieldName, defaultValue: "" });
|
|
10
|
+
const { setValue } = useFormContext();
|
|
11
|
+
const amountValue = parseFloat(amount || "0");
|
|
12
|
+
const amountUsd = calculateTokenValueInCurrency(amountValue, balanceDetails?.price ?? 0, {
|
|
13
|
+
zeroDisplay: "$0.00",
|
|
14
|
+
});
|
|
15
|
+
const handleInputChange = (e) => {
|
|
16
|
+
setValue(fieldName, e.target.value, {
|
|
17
|
+
shouldValidate: true,
|
|
18
|
+
shouldDirty: true,
|
|
19
|
+
shouldTouch: true,
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const handleKeyDown = (e) => {
|
|
23
|
+
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const subtitle = `Stakable: ${maxDecimals(Number(balanceDetails?.balance), balanceDetails?.decimals ?? BTC_DECIMAL_PLACES)} ${balanceDetails?.symbol}`;
|
|
28
|
+
return (_jsxs(_Fragment, { children: [_jsx(HiddenField, { name: fieldName, defaultValue: "" }), _jsx(SubSection, { className: "flex w-full flex-col content-center justify-between gap-4", children: _jsx(AmountItem, { amount: amount, currencyIcon: currencyIcon, currencyName: currencyName, placeholder: placeholder, displayBalance: displayBalance, balanceDetails: balanceDetails, min: min, step: step, autoFocus: autoFocus, onChange: handleInputChange, onKeyDown: handleKeyDown, amountUsd: amountUsd, subtitle: subtitle }) })] }));
|
|
29
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as yup from "yup";
|
|
3
|
+
import { AmountSubsection } from "./AmountSubsection";
|
|
4
|
+
import { Form } from "@/widgets/form/Form";
|
|
5
|
+
const meta = {
|
|
6
|
+
component: AmountSubsection,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
// Define a simple validation schema for the field used in this story
|
|
11
|
+
const schema = yup
|
|
12
|
+
.object()
|
|
13
|
+
.shape({
|
|
14
|
+
amount: yup.number().required().positive(),
|
|
15
|
+
})
|
|
16
|
+
.required();
|
|
17
|
+
export const Default = {
|
|
18
|
+
args: {
|
|
19
|
+
fieldName: "amount",
|
|
20
|
+
currencyIcon: "https://placehold.co/40x40",
|
|
21
|
+
currencyName: "BBN",
|
|
22
|
+
placeholder: "Enter Amount",
|
|
23
|
+
displayBalance: true,
|
|
24
|
+
balanceDetails: {
|
|
25
|
+
balance: 1234.56789,
|
|
26
|
+
symbol: "BBN",
|
|
27
|
+
price: 0.25,
|
|
28
|
+
displayUSD: true,
|
|
29
|
+
decimals: 8,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
decorators: [
|
|
33
|
+
(Story) => (_jsx(Form, { onChange: console.log, schema: schema, children: _jsx(Story, {}) })),
|
|
34
|
+
],
|
|
35
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AmountSubsection } from
|
|
1
|
+
export { AmountSubsection } from "./AmountSubsection";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AmountSubsection } from "./AmountSubsection";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FeeItem } from "../../../components/FeeItem/FeeItem";
|
|
3
|
+
import { BBN_DECIMAL_PLACES } from "../../../utils/constants";
|
|
4
|
+
export function BBNFeeAmount({ amount, coinSymbol, hint, title, className, decimals = BBN_DECIMAL_PLACES }) {
|
|
5
|
+
const formattedAmount = typeof amount === "number" ? amount.toFixed(decimals) : amount;
|
|
6
|
+
return (_jsxs(FeeItem, { title: title ?? `${coinSymbol} Network Fee`, hint: hint, className: className, children: [formattedAmount, " ", coinSymbol] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FeeItem } from "../../../components/FeeItem/FeeItem";
|
|
3
|
+
import { BTC_DECIMAL_PLACES } from "../../../utils/constants";
|
|
4
|
+
export function BTCFeeAmount({ amount, coinSymbol, hint, title, className, decimals = BTC_DECIMAL_PLACES }) {
|
|
5
|
+
let formattedAmount;
|
|
6
|
+
if (typeof amount === "number") {
|
|
7
|
+
if (amount === 0) {
|
|
8
|
+
formattedAmount = "0";
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
const str = amount.toFixed(decimals);
|
|
12
|
+
formattedAmount = str.replace(/0+$/, "").replace(/\.$/, "");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
formattedAmount = amount;
|
|
17
|
+
}
|
|
18
|
+
return (_jsxs(FeeItem, { title: title ?? `${coinSymbol} Network Fee`, hint: hint, className: className, children: [formattedAmount, " ", coinSymbol] }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FeeItem } from "../../../components/FeeItem/FeeItem";
|
|
3
|
+
import { Button } from "../../../components/Button";
|
|
4
|
+
import { FaPen } from "react-icons/fa6";
|
|
5
|
+
export function BTCFeeRate({ value, onEdit, title = "Network Fee Rate", className }) {
|
|
6
|
+
return (_jsxs(FeeItem, { title: title, className: className, children: [_jsxs("span", { children: [value, " sats/vB"] }), onEdit && (_jsx(Button, { size: "small", variant: "outlined", className: "h-6 w-6 pl-1 text-secondary-strokeDark", onClick: onEdit, children: _jsx(FaPen, { size: 16, className: "text-secondary-strokeDark" }) }))] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
import { SubSection } from "../../../components/SubSection";
|
|
4
|
+
import { BTCFeeRate } from "./BTCFeeRate";
|
|
5
|
+
import { BTCFeeAmount } from "./BTCFeeAmount";
|
|
6
|
+
import { BBNFeeAmount } from "./BBNFeeAmount";
|
|
7
|
+
import { Total } from "./Total";
|
|
8
|
+
export function FeesSection({ className, feeRate, onFeeRateEdit, feeAmount, coinSymbol, feeAmountHint, total, totalHint, bbnFeeAmount, bbnCoinSymbol, bbnFeeAmountHint, bbnFeeDecimals, }) {
|
|
9
|
+
return (_jsx(SubSection, { className: twMerge("flex w-full flex-col content-center justify-between gap-4", className), children: _jsxs("div", { className: "flex flex-col gap-6 p-4", children: [_jsx(BTCFeeRate, { value: feeRate, onEdit: onFeeRateEdit }), _jsx(BTCFeeAmount, { amount: feeAmount, coinSymbol: coinSymbol, hint: feeAmountHint }), bbnFeeAmount !== undefined && bbnCoinSymbol ? (_jsx(BBNFeeAmount, { amount: bbnFeeAmount, coinSymbol: bbnCoinSymbol, hint: bbnFeeAmountHint, decimals: bbnFeeDecimals })) : null, _jsx("div", { className: "divider my-4" }), _jsx(Total, { total: total, coinSymbol: coinSymbol, hint: totalHint })] }) }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FeesSection } from "./FeesSection";
|
|
2
|
+
const meta = {
|
|
3
|
+
component: FeesSection,
|
|
4
|
+
tags: ["autodocs"],
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
export const Default = {
|
|
8
|
+
args: {
|
|
9
|
+
feeRate: 5,
|
|
10
|
+
feeAmount: "0.0001",
|
|
11
|
+
coinSymbol: "BTC",
|
|
12
|
+
total: "0.0001",
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from "../../../components/Text";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
import { BTC_DECIMAL_PLACES } from "../../../utils/constants";
|
|
5
|
+
export function Total({ total, coinSymbol, hint, title = "Total", className, decimals = BTC_DECIMAL_PLACES }) {
|
|
6
|
+
let formattedTotal;
|
|
7
|
+
if (typeof total === "number") {
|
|
8
|
+
if (total === 0) {
|
|
9
|
+
formattedTotal = "0";
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
const str = total.toFixed(decimals);
|
|
13
|
+
formattedTotal = str.replace(/0+$/, "").replace(/\.$/, "");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
formattedTotal = total;
|
|
18
|
+
}
|
|
19
|
+
return (_jsxs("div", { className: twMerge("flex flex-row items-start justify-between text-accent-primary", className), children: [_jsx(Text, { variant: "body1", className: "font-bold", children: title }), _jsxs("div", { className: "flex flex-col items-end justify-center", children: [_jsxs(Text, { variant: "body1", className: "font-bold", children: [formattedTotal, " ", coinSymbol] }), hint && (_jsx(Text, { variant: "body1", className: "text-sm text-accent-secondary", children: hint }))] })] }));
|
|
20
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
1
|
+
export * from "./FeesSection";
|
|
2
|
+
export * from "../../../components/FeeItem/FeeItem";
|
|
3
|
+
export * from "./Total";
|
|
4
|
+
export * from "./BTCFeeRate";
|
|
5
|
+
export * from "./BTCFeeAmount";
|
|
6
|
+
export * from "./BBNFeeAmount";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SubSection } from "../../../components/SubSection";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { CounterButton } from "../../../components/CounterButton/CounterButton";
|
|
5
|
+
import { ProvidersList } from "../../../elements/ProvidersList/ProvidersList";
|
|
6
|
+
export function FinalityProviderSubsection({ max, items = [], actionText, onAdd, onRemove }) {
|
|
7
|
+
const count = useMemo(() => items.length, [items]);
|
|
8
|
+
return (_jsx(SubSection, { children: _jsxs("div", { className: "flex w-full flex-col gap-4", children: [_jsx("div", { className: "flex flex-row", children: _jsxs("div", { className: "flex w-full flex-row content-center items-center justify-between font-normal", children: [_jsx("span", { className: "text-sm sm:text-base", children: actionText }), _jsx(CounterButton, { counter: count, max: max, onAdd: onAdd })] }) }), count > 0 && _jsx(ProvidersList, { items: items, onRemove: onRemove })] }) }));
|
|
9
|
+
}
|
package/dist/widgets/sections/FinalityProviderSubsection/FinalityProviderSubsection.stories.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { FinalityProviderSubsection } from "./FinalityProviderSubsection";
|
|
3
|
+
declare const meta: Meta<typeof FinalityProviderSubsection>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Empty: Story;
|
|
8
|
+
export declare const MultipleItems: Story;
|
|
9
|
+
export declare const AtMaximumCapacity: Story;
|
|
10
|
+
export declare const SingleProviderMode: Story;
|
|
11
|
+
export declare const SingleProviderModeWithItem: Story;
|
|
12
|
+
export declare const ProvidersWithoutLogos: Story;
|
|
13
|
+
export declare const ProvidersWithoutDescriptions: Story;
|