@babylonlabs-io/core-ui 1.12.0 → 1.13.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 +45 -44
- package/dist/index.es.js +900 -887
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +45 -0
- 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/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,131 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback } from "react";
|
|
3
|
+
import { Table } from ".";
|
|
4
|
+
import { Avatar } from "../Avatar";
|
|
5
|
+
import { Select } from "../Form";
|
|
6
|
+
const meta = {
|
|
7
|
+
component: Table,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
const data = [
|
|
12
|
+
{
|
|
13
|
+
id: "1",
|
|
14
|
+
name: "Lombard",
|
|
15
|
+
icon: "/images/fps/lombard.jpeg",
|
|
16
|
+
status: "Active",
|
|
17
|
+
btcPk: "1234...4321",
|
|
18
|
+
totalDelegation: 10,
|
|
19
|
+
commission: 1,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "2",
|
|
23
|
+
name: "Solv Protocol",
|
|
24
|
+
icon: "/images/fps/solv.jpeg",
|
|
25
|
+
status: "Inactive",
|
|
26
|
+
btcPk: "1234...4321",
|
|
27
|
+
totalDelegation: 20,
|
|
28
|
+
commission: 3,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "3",
|
|
32
|
+
name: "PumpBTC",
|
|
33
|
+
icon: "/images/fps/pumpbtc.jpeg",
|
|
34
|
+
status: "Active",
|
|
35
|
+
btcPk: "1234...4321",
|
|
36
|
+
totalDelegation: 30,
|
|
37
|
+
commission: 5,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "4",
|
|
41
|
+
name: "Solv Protocol",
|
|
42
|
+
icon: "/images/fps/solv.jpeg",
|
|
43
|
+
status: "Active",
|
|
44
|
+
btcPk: "1234...4321",
|
|
45
|
+
totalDelegation: 20,
|
|
46
|
+
commission: 3,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "5",
|
|
50
|
+
name: "PumpBTC",
|
|
51
|
+
icon: "/images/fps/pumpbtc.jpeg",
|
|
52
|
+
status: "Active",
|
|
53
|
+
btcPk: "1234...4321",
|
|
54
|
+
totalDelegation: 30,
|
|
55
|
+
commission: 5,
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
const columns = [
|
|
59
|
+
{
|
|
60
|
+
key: "name",
|
|
61
|
+
header: "Finality Provider",
|
|
62
|
+
render: (_, row) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Avatar, { size: "small", url: row.icon, alt: row.name }), _jsx("span", { children: row.name })] })),
|
|
63
|
+
sorter: (a, b) => a.name.localeCompare(b.name),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: "status",
|
|
67
|
+
header: "Status",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: "btcPk",
|
|
71
|
+
header: "BTC PK",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
key: "totalDelegation",
|
|
75
|
+
header: "Total Delegation",
|
|
76
|
+
render: (_, row) => `${row.totalDelegation} sBTC`,
|
|
77
|
+
sorter: (a, b) => a.totalDelegation - b.totalDelegation,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
key: "commission",
|
|
81
|
+
header: "Commission",
|
|
82
|
+
render: (_, row) => `${row.commission}%`,
|
|
83
|
+
sorter: (a, b) => a.commission - b.commission,
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
export const Default = {
|
|
87
|
+
render: () => {
|
|
88
|
+
const [tableData, setTableData] = useState(data);
|
|
89
|
+
const [loading, setLoading] = useState(false);
|
|
90
|
+
const [hasMore, setHasMore] = useState(true);
|
|
91
|
+
const [selectedProvider, setSelectedProvider] = useState(null);
|
|
92
|
+
const handleLoadMore = useCallback(async () => {
|
|
93
|
+
setLoading(true);
|
|
94
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
95
|
+
const nextItems = data.slice(tableData.length, tableData.length + 3);
|
|
96
|
+
setTableData((prev) => [...prev, ...nextItems]);
|
|
97
|
+
setHasMore(tableData.length + nextItems.length < data.length);
|
|
98
|
+
setLoading(false);
|
|
99
|
+
}, [tableData]);
|
|
100
|
+
const handleRowSelect = useCallback((row) => {
|
|
101
|
+
setSelectedProvider(row);
|
|
102
|
+
}, []);
|
|
103
|
+
const isRowSelectable = useCallback((row) => {
|
|
104
|
+
return row.status === "Active";
|
|
105
|
+
}, []);
|
|
106
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx("div", { children: _jsx(Table, { data: tableData, hasMore: hasMore, loading: loading, onLoadMore: handleLoadMore, columns: columns, onRowSelect: handleRowSelect, isRowSelectable: isRowSelectable, defaultSelectedRow: "1" }) }), selectedProvider && (_jsxs("div", { className: "rounded bg-primary-contrast p-4", children: ["Selected Provider: ", selectedProvider.name, " (Commission: ", selectedProvider.commission, "%)"] }))] }));
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
export const ControlledSelection = {
|
|
110
|
+
render: () => {
|
|
111
|
+
const [selectedId, setSelectedId] = useState("2");
|
|
112
|
+
const [selectedProvider, setSelectedProvider] = useState(null);
|
|
113
|
+
const handleRowSelect = useCallback((row) => {
|
|
114
|
+
setSelectedId(row?.id ?? null);
|
|
115
|
+
setSelectedProvider(row);
|
|
116
|
+
}, []);
|
|
117
|
+
const selectOptions = [
|
|
118
|
+
{ value: "", label: "None" },
|
|
119
|
+
...data.map((provider) => ({
|
|
120
|
+
value: provider.id,
|
|
121
|
+
label: provider.name,
|
|
122
|
+
})),
|
|
123
|
+
];
|
|
124
|
+
const handleSelect = useCallback((value) => {
|
|
125
|
+
const selectedRow = value ? (data.find((row) => row.id === value) ?? null) : null;
|
|
126
|
+
setSelectedId(value);
|
|
127
|
+
setSelectedProvider(selectedRow);
|
|
128
|
+
}, []);
|
|
129
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Select, { value: selectedId ?? "", options: selectOptions, onSelect: (value) => handleSelect(value), placeholder: "Select a provider" }), _jsx("div", { className: "h-[150px]", children: _jsx(Table, { data: data, columns: columns, selectedRow: selectedId, onSelectedRowChange: setSelectedId, onRowSelect: handleRowSelect }) }), selectedProvider && (_jsxs("div", { className: "rounded bg-primary-contrast p-4", children: ["Selected Provider: ", selectedProvider.name, " (Commission: ", selectedProvider.commission, "%)"] }))] }));
|
|
130
|
+
},
|
|
131
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { twJoin } from "tailwind-merge";
|
|
3
|
+
import { Text } from "@/components/Text";
|
|
4
|
+
export function Cell({ className, render, value, columnName, ...restProps }) {
|
|
5
|
+
return (_jsx(Text, { variant: "body2", as: "td", className: twJoin(`bbn-cell-left`, className), "data-column": columnName, ...restProps, children: render ? render(value) : value }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { twJoin } from "tailwind-merge";
|
|
4
|
+
import { RiArrowUpSFill, RiArrowDownSFill } from "react-icons/ri";
|
|
5
|
+
import { TableContext } from "../../../context/Table.context";
|
|
6
|
+
import { Text } from "@/components/Text";
|
|
7
|
+
export function Column({ name, className, children, sorter, ...restProps }) {
|
|
8
|
+
const { columns, sortStates, onColumnSort } = useContext(TableContext);
|
|
9
|
+
const sortState = sortStates[name ?? ""];
|
|
10
|
+
const sortDirection = sortState?.direction;
|
|
11
|
+
return (_jsx(Text, { variant: "caption", as: "th", className: twJoin(`bbn-cell-left`, sorter && "bbn-table-sortable", className), onClick: () => {
|
|
12
|
+
if (sorter && name) {
|
|
13
|
+
const column = columns.find((col) => col.key === name);
|
|
14
|
+
onColumnSort?.(name, column?.sorter);
|
|
15
|
+
}
|
|
16
|
+
}, "data-column": name, ...restProps, children: _jsxs("div", { className: "flex items-center justify-between gap-1", children: [_jsx("span", { children: children }), sorter && (_jsxs("span", { className: "bbn-table-sort-icons", children: [_jsx(RiArrowUpSFill, { className: twJoin("bbn-sort-icon bbn-sort-icon-up", sortDirection === "asc" ? "bbn-sort-icon-active" : "bbn-sort-icon-inactive") }), _jsx(RiArrowDownSFill, { className: twJoin("bbn-sort-icon bbn-sort-icon-down", sortDirection === "desc" ? "bbn-sort-icon-active" : "bbn-sort-icon-inactive") })] }))] }) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { twJoin } from "tailwind-merge";
|
|
3
|
+
import { Cell } from "./Cell";
|
|
4
|
+
export function Row({ row, columns, isSelected, isSelectable, onSelect, }) {
|
|
5
|
+
return (_jsx("tr", { className: twJoin(isSelected && "selected", !!onSelect && isSelectable && "cursor-pointer", !isSelectable && "opacity-50"), onClick: () => onSelect(row), children: columns.map((column) => (_jsx(Cell, { value: row[column.key], columnName: column.key, className: column.cellClassName, render: column.render ? (value) => column.render(value, row) : undefined }, column.key))) }));
|
|
6
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
1
|
+
export * from "./Table";
|
|
2
|
+
export * from "./types";
|
|
3
|
+
export * from "./components/Cell";
|
|
4
|
+
export * from "./components/Column";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { HTMLProps } from
|
|
1
|
+
import { type HTMLProps } from "react";
|
|
2
|
+
import "./Text.css";
|
|
2
3
|
type Variant = "body1" | "body2" | "subtitle1" | "subtitle2" | "overline" | "caption";
|
|
3
4
|
export interface TextProps extends HTMLProps<HTMLElement> {
|
|
4
5
|
variant?: Variant;
|
|
5
6
|
as?: string;
|
|
6
7
|
}
|
|
7
|
-
export declare const Text: import(
|
|
8
|
+
export declare const Text: import("react").ForwardRefExoticComponent<Omit<TextProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
8
9
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createElement, forwardRef } from "react";
|
|
2
|
+
import { twJoin } from "tailwind-merge";
|
|
3
|
+
import "./Text.css";
|
|
4
|
+
export const Text = forwardRef(({ variant = "body1", as = "p", children, className, ...restProps }, ref) => {
|
|
5
|
+
return createElement(as, {
|
|
6
|
+
...restProps,
|
|
7
|
+
ref,
|
|
8
|
+
className: twJoin(`bbn-text-${variant}`, className),
|
|
9
|
+
}, children);
|
|
10
|
+
});
|
|
11
|
+
Text.displayName = "Text";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from "./Text";
|
|
3
|
+
const meta = {
|
|
4
|
+
component: Text,
|
|
5
|
+
tags: ["autodocs"],
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
export const Default = {
|
|
9
|
+
render: (args) => args.variant ? (_jsxs(Text, { ...args, children: ["Text--", args.variant] })) : (_jsxs("div", { className: "text-accent-secondary", children: [_jsx(Text, { ...args, variant: "body1", className: "my-4", children: "Text--Body1" }), _jsx(Text, { ...args, variant: "body2", className: "my-4", children: "Text--Body2" }), _jsx(Text, { ...args, variant: "subtitle1", className: "my-4", children: "Text--subtitle1" }), _jsx(Text, { ...args, variant: "subtitle2", className: "my-4", children: "Text--subtitle2" }), _jsx(Text, { ...args, variant: "overline", className: "my-4", children: "Text--overline" }), _jsx(Text, { ...args, variant: "caption", className: "my-4", children: "Text--caption" })] })),
|
|
10
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./Text";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Text";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { twJoin } from "tailwind-merge";
|
|
3
|
+
import { useControlledState } from "@/hooks/useControlledState";
|
|
4
|
+
import "./Toggle.css";
|
|
5
|
+
export function Toggle(props) {
|
|
6
|
+
const [value = false, setValue] = useControlledState({
|
|
7
|
+
value: props.value,
|
|
8
|
+
defaultValue: props.defaultValue,
|
|
9
|
+
onStateChange: props.onChange,
|
|
10
|
+
});
|
|
11
|
+
return (_jsxs("div", { className: "bbn-toggle", onClick: () => void setValue(!value), children: [_jsx("span", { className: "bbn-toggle-bg", children: props.activeIcon }), _jsx("span", { className: twJoin("bbn-toggle-control", value && "bbn-toggle-control-active") }), _jsx("span", { className: "bbn-toggle-bg", children: props.inactiveIcon })] }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FaLock, FaLockOpen } from "react-icons/fa";
|
|
3
|
+
import { Toggle } from "./Toggle";
|
|
4
|
+
const meta = {
|
|
5
|
+
component: Toggle,
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
export const Default = {
|
|
10
|
+
args: {
|
|
11
|
+
activeIcon: _jsx(FaLockOpen, { size: 10 }),
|
|
12
|
+
inactiveIcon: _jsx(FaLock, { size: 10 }),
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./Toggle";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Toggle";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { twJoin } from "tailwind-merge";
|
|
3
|
+
import "./Warning.css";
|
|
4
|
+
export function Warning({ children, className }) {
|
|
5
|
+
return (_jsxs("div", { className: twJoin("bbn-warning", className), children: [_jsx("img", { src: "/images/status/warning_dark2.svg", alt: "Warning icon", className: "bbn-warning-icon" }), _jsx("p", { className: "bbn-warning-message", children: children })] }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Warning } from "./Warning";
|
|
3
|
+
declare const meta: Meta<typeof Warning>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const LongText: Story;
|
|
8
|
+
export declare const CustomAltText: Story;
|
|
9
|
+
export declare const CustomStyled: Story;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Warning } from "./Warning";
|
|
2
|
+
const meta = {
|
|
3
|
+
component: Warning,
|
|
4
|
+
tags: ["autodocs"],
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
export const Default = {
|
|
8
|
+
args: {
|
|
9
|
+
children: "Processing your claim will take approximately 2 blocks to complete. BABY is a test token without any real world value.",
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export const LongText = {
|
|
13
|
+
args: {
|
|
14
|
+
children: "This is a very long warning message meant to test how the component behaves when the text spans multiple lines. It should wrap correctly and keep the icon aligned at the top of the message. You can also include more details here for the user to read without breaking the layout of the warning component.",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export const CustomAltText = {
|
|
18
|
+
args: {
|
|
19
|
+
children: "Custom alt text is provided for better accessibility.",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const CustomStyled = {
|
|
23
|
+
args: {
|
|
24
|
+
children: "This warning box has a custom max-width and is centered using Tailwind utility classes.",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Warning } from
|
|
1
|
+
export { Warning } from "./Warning";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Warning } from "./Warning";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PropsWithChildren } from
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
2
|
interface DialogContext {
|
|
3
3
|
removeDialog: (id: string, value?: boolean) => void;
|
|
4
4
|
updateDialog: (id: string, value: boolean) => void;
|
|
5
5
|
}
|
|
6
|
-
export declare const DialogContext: import(
|
|
6
|
+
export declare const DialogContext: import("react").Context<DialogContext>;
|
|
7
7
|
export declare function ScrollLocker({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useState, useMemo, useCallback, useEffect } from "react";
|
|
3
|
+
import { toPixels } from "@/utils/css";
|
|
4
|
+
export const DialogContext = createContext({
|
|
5
|
+
removeDialog: () => null,
|
|
6
|
+
updateDialog: () => null,
|
|
7
|
+
});
|
|
8
|
+
export function ScrollLocker({ children }) {
|
|
9
|
+
const [dialogs, setDialogs] = useState({});
|
|
10
|
+
const bodyLocked = useMemo(() => Object.values(dialogs).some((v) => v), [dialogs]);
|
|
11
|
+
useEffect(function lockBody() {
|
|
12
|
+
if (bodyLocked) {
|
|
13
|
+
const width = document.body.offsetWidth;
|
|
14
|
+
document.body.style.overflow = "hidden";
|
|
15
|
+
document.body.style.paddingRight =
|
|
16
|
+
document.body.offsetWidth - width >= 1
|
|
17
|
+
? (toPixels(document.body.offsetWidth - width) ?? "")
|
|
18
|
+
: document.body.style.paddingRight;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
document.body.style.overflow = "";
|
|
22
|
+
document.body.style.paddingRight = "";
|
|
23
|
+
}
|
|
24
|
+
}, [bodyLocked]);
|
|
25
|
+
const removeDialog = useCallback((id) => {
|
|
26
|
+
setDialogs((state) => (Reflect.deleteProperty(state, id) ? { ...state } : state));
|
|
27
|
+
}, []);
|
|
28
|
+
const updateDialog = useCallback((id, value) => {
|
|
29
|
+
setDialogs((state) => ({ ...state, [id]: value }));
|
|
30
|
+
}, []);
|
|
31
|
+
const value = useMemo(() => ({ removeDialog, updateDialog }), [removeDialog, updateDialog]);
|
|
32
|
+
return _jsx(DialogContext.Provider, { value: value, children: children });
|
|
33
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColumnProps } from
|
|
1
|
+
import type { ColumnProps } from "../components/Table/types";
|
|
2
2
|
export interface TableContextType<T = unknown> {
|
|
3
3
|
data: T[];
|
|
4
4
|
columns: ColumnProps<T>[];
|
|
@@ -11,4 +11,4 @@ export interface TableContextType<T = unknown> {
|
|
|
11
11
|
onColumnSort?: (columnKey: string, sorter?: (a: T, b: T) => number) => void;
|
|
12
12
|
onRowSelect?: (row: T) => void;
|
|
13
13
|
}
|
|
14
|
-
export declare const TableContext: import(
|
|
14
|
+
export declare const TableContext: import("react").Context<TableContextType<unknown>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar } from "../../components/Avatar";
|
|
3
|
+
import { Text } from "../../components/Text";
|
|
4
|
+
import { CloseIcon } from "../../components/Icons";
|
|
5
|
+
import { FinalityProviderLogo } from "../FinalityProviderLogo/FinalityProviderLogo";
|
|
6
|
+
export function FinalityProviderItem({ bsnId, bsnName, bsnLogoUrl, address, provider, onRemove }) {
|
|
7
|
+
if (!provider)
|
|
8
|
+
return null;
|
|
9
|
+
const renderBsnLogo = () => {
|
|
10
|
+
if (bsnLogoUrl) {
|
|
11
|
+
return _jsx(Avatar, { url: bsnLogoUrl, alt: bsnName, variant: "rounded", size: "tiny", className: "mr-1" });
|
|
12
|
+
}
|
|
13
|
+
const placeholderLetter = bsnName?.charAt(0).toUpperCase() || "?";
|
|
14
|
+
return (_jsx(Avatar, { variant: "rounded", size: "tiny", className: "mr-1", children: _jsx(Text, { as: "span", className: "inline-flex h-full w-full items-center justify-center bg-secondary-main text-xs text-accent-contrast", children: placeholderLetter }) }));
|
|
15
|
+
};
|
|
16
|
+
const shortenAddress = (value) => {
|
|
17
|
+
const visibleChars = 6;
|
|
18
|
+
if (!value || value.length <= visibleChars * 2)
|
|
19
|
+
return value;
|
|
20
|
+
return `${value.slice(0, visibleChars)}...${value.slice(-visibleChars)}`;
|
|
21
|
+
};
|
|
22
|
+
const renderChainOrAddress = () => {
|
|
23
|
+
if (address) {
|
|
24
|
+
return (_jsx("div", { className: "text-xs text-accent-secondary", children: shortenAddress(address) }));
|
|
25
|
+
}
|
|
26
|
+
return (_jsxs("div", { className: "flex items-center text-xs text-accent-secondary", children: [renderBsnLogo(), bsnName] }));
|
|
27
|
+
};
|
|
28
|
+
return (_jsxs("div", { className: "flex flex-row items-center justify-between", children: [_jsxs("div", { className: "flex h-10 flex-row gap-2", children: [_jsx("div", { className: "shrink-0", children: _jsx(FinalityProviderLogo, { logoUrl: provider.logo_url, rank: provider.rank, moniker: provider.description?.moniker, size: "lg" }) }), _jsxs("div", { className: "flex flex-col justify-center text-accent-primary", children: [renderChainOrAddress(), _jsx(Text, { as: "div", className: "text-base font-medium text-accent-primary", children: provider.description?.moniker })] })] }), onRemove ?
|
|
29
|
+
_jsx("button", { onClick: () => onRemove(bsnId), className: "ml-[10px] flex items-center justify-center cursor-pointer p-1", children: _jsx(CloseIcon, { size: 12 }) }) : null] }));
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { FinalityProviderItem } from "./FinalityProviderItem";
|
|
3
|
+
declare const meta: Meta<typeof FinalityProviderItem>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithoutBsnLogo: Story;
|
|
8
|
+
export declare const WithoutProviderLogo: Story;
|
|
9
|
+
export declare const HighRankProvider: Story;
|
|
10
|
+
export declare const LongNames: Story;
|
|
11
|
+
export declare const WithoutRemove: Story;
|
|
12
|
+
export declare const AddressOnly: Story;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { FinalityProviderItem } from "./FinalityProviderItem";
|
|
2
|
+
const meta = {
|
|
3
|
+
component: FinalityProviderItem,
|
|
4
|
+
tags: ["autodocs"],
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: "centered",
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
const mockProvider = {
|
|
11
|
+
logo_url: "/images/fps/lombard.jpeg",
|
|
12
|
+
rank: 1,
|
|
13
|
+
description: {
|
|
14
|
+
moniker: "Lombard Protocol",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const mockProviderWithoutLogo = {
|
|
18
|
+
logo_url: undefined,
|
|
19
|
+
rank: 5,
|
|
20
|
+
description: {
|
|
21
|
+
moniker: "Bitcoin Staking Provider",
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export const Default = {
|
|
25
|
+
args: {
|
|
26
|
+
bsnId: "bsn123",
|
|
27
|
+
bsnName: "Babylon",
|
|
28
|
+
bsnLogoUrl: "/images/fps/pumpbtc.jpeg",
|
|
29
|
+
provider: mockProvider,
|
|
30
|
+
onRemove: (bsnId) => alert(`Remove clicked for ${bsnId}`),
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const WithoutBsnLogo = {
|
|
34
|
+
args: {
|
|
35
|
+
bsnId: "bsn456",
|
|
36
|
+
bsnName: "Babylon Chain",
|
|
37
|
+
bsnLogoUrl: undefined,
|
|
38
|
+
provider: mockProvider,
|
|
39
|
+
onRemove: (bsnId) => alert(`Remove clicked for ${bsnId}`),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const WithoutProviderLogo = {
|
|
43
|
+
args: {
|
|
44
|
+
bsnId: "bsn789",
|
|
45
|
+
bsnName: "Babylon Network",
|
|
46
|
+
bsnLogoUrl: "/images/fps/solv.jpeg",
|
|
47
|
+
provider: mockProviderWithoutLogo,
|
|
48
|
+
onRemove: (bsnId) => alert(`Remove clicked for ${bsnId}`),
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
export const HighRankProvider = {
|
|
52
|
+
args: {
|
|
53
|
+
bsnId: "bsn999",
|
|
54
|
+
bsnName: "Babylon Testnet",
|
|
55
|
+
bsnLogoUrl: "/images/fps/pumpbtc.jpeg",
|
|
56
|
+
provider: {
|
|
57
|
+
logo_url: "/images/fps/solv.jpeg",
|
|
58
|
+
rank: 99,
|
|
59
|
+
description: {
|
|
60
|
+
moniker: "High Rank Provider",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
onRemove: (bsnId) => alert(`Remove clicked for ${bsnId}`),
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
export const LongNames = {
|
|
67
|
+
args: {
|
|
68
|
+
bsnId: "bsn_very_long_id_123456789",
|
|
69
|
+
bsnName: "Very Long Babylon Network Name That Might Wrap",
|
|
70
|
+
bsnLogoUrl: "/images/fps/lombard.jpeg",
|
|
71
|
+
provider: {
|
|
72
|
+
logo_url: "/images/fps/pumpbtc.jpeg",
|
|
73
|
+
rank: 42,
|
|
74
|
+
description: {
|
|
75
|
+
moniker: "Very Long Finality Provider Name That Should Handle Text Overflow",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
onRemove: (bsnId) => alert(`Remove clicked for ${bsnId}`),
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
export const WithoutRemove = {
|
|
82
|
+
args: {
|
|
83
|
+
bsnId: "bsn321",
|
|
84
|
+
bsnName: "Babylon Network",
|
|
85
|
+
bsnLogoUrl: "/images/fps/lombard.jpeg",
|
|
86
|
+
provider: mockProvider,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
export const AddressOnly = {
|
|
90
|
+
args: {
|
|
91
|
+
bsnId: "bsnAddr",
|
|
92
|
+
bsnName: "",
|
|
93
|
+
bsnLogoUrl: undefined,
|
|
94
|
+
address: "dfe19b1234567890f732de",
|
|
95
|
+
provider: mockProvider,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./FinalityProviderItem";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./FinalityProviderItem";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from "../../components/Text";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { twMerge } from "tailwind-merge";
|
|
5
|
+
const STYLES = {
|
|
6
|
+
lg: {
|
|
7
|
+
logo: "size-10",
|
|
8
|
+
subLogo: "text-[0.8rem]",
|
|
9
|
+
},
|
|
10
|
+
md: {
|
|
11
|
+
logo: "size-6",
|
|
12
|
+
subLogo: "text-[0.5rem]",
|
|
13
|
+
},
|
|
14
|
+
sm: {
|
|
15
|
+
logo: "size-5",
|
|
16
|
+
subLogo: "text-[0.4rem]",
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
export const FinalityProviderLogo = ({ logoUrl, rank, moniker, size = "md", className }) => {
|
|
20
|
+
const [imageError, setImageError] = useState(false);
|
|
21
|
+
const styles = STYLES[size];
|
|
22
|
+
const fallbackLabel = moniker?.charAt(0).toUpperCase() ?? String(rank);
|
|
23
|
+
return (_jsx("span", { className: twMerge("relative inline-block", styles.logo, className), children: logoUrl && !imageError ? (_jsx("img", { src: logoUrl, alt: moniker || `Finality Provider ${rank}`, className: "h-full w-full rounded-full object-cover", onError: () => setImageError(true) })) : (_jsx(Text, { as: "span", className: "inline-flex h-full w-full items-center justify-center rounded-full bg-secondary-main text-[1rem] text-accent-contrast", children: fallbackLabel })) }));
|
|
24
|
+
};
|