@babylonlabs-io/core-ui 1.38.0 → 1.39.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/components/AccordionDetails.d.ts +1 -1
- package/dist/components/Accordion/components/AccordionSummary.d.ts +2 -2
- package/dist/components/Accordion/hooks/useHeightObserver.d.ts +1 -1
- package/dist/components/Accordion/index.d.ts +3 -4
- package/dist/components/AmountItem/AmountItem.d.ts +1 -1
- package/dist/components/AmountItem/index.d.ts +1 -1
- package/dist/components/Avatar/Avatar.d.ts +1 -2
- package/dist/components/Avatar/AvatarGroup.d.ts +2 -3
- package/dist/components/Avatar/ValidatorAvatar.d.ts +1 -1
- package/dist/components/Avatar/index.d.ts +3 -3
- package/dist/components/Badge/Badge.d.ts +1 -2
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +2 -3
- package/dist/components/Button/IconButton.d.ts +2 -3
- package/dist/components/Button/WalletDisconnectButton.d.ts +2 -2
- package/dist/components/Button/index.d.ts +3 -3
- package/dist/components/Card/Card.d.ts +3 -4
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Chip/Chip.d.ts +1 -2
- package/dist/components/Chip/index.d.ts +1 -1
- package/dist/components/Copy/Copy.d.ts +1 -1
- package/dist/components/CounterButton/index.d.ts +1 -1
- package/dist/components/Dialog/Dialog.d.ts +1 -1
- package/dist/components/Dialog/MobileDialog.d.ts +1 -1
- package/dist/components/Dialog/components/Backdrop.d.ts +1 -2
- package/dist/components/Dialog/components/DialogBody.d.ts +1 -1
- package/dist/components/Dialog/components/DialogFooter.d.ts +1 -1
- package/dist/components/Dialog/components/DialogHeader.d.ts +1 -1
- package/dist/components/Dialog/index.d.ts +5 -6
- package/dist/components/DisplayHash/DisplayHash.d.ts +1 -1
- package/dist/components/FeeItem/FeeItem.d.ts +1 -1
- package/dist/components/Form/Checkbox.d.ts +2 -2
- package/dist/components/Form/FormControl.d.ts +1 -2
- package/dist/components/Form/Input.d.ts +2 -3
- package/dist/components/Form/Radio.d.ts +2 -2
- package/dist/components/Form/Select.d.ts +2 -3
- package/dist/components/Form/components/Toggle.d.ts +2 -3
- package/dist/components/Form/index.d.ts +5 -5
- package/dist/components/Heading/Heading.d.ts +2 -3
- package/dist/components/Heading/index.d.ts +1 -1
- package/dist/components/Hint/Hint.d.ts +1 -1
- package/dist/components/Icons/common/BugReportIcon.d.ts +1 -1
- package/dist/components/Icons/common/ChevronLeftIcon.d.ts +1 -1
- package/dist/components/Icons/common/CloseIcon.d.ts +1 -1
- package/dist/components/Icons/common/CollapseIcon.d.ts +1 -1
- package/dist/components/Icons/common/CopyIcon.d.ts +1 -1
- package/dist/components/Icons/common/InfoIcon.d.ts +1 -1
- package/dist/components/Icons/common/OpenIcon.d.ts +1 -1
- package/dist/components/Icons/common/ThemeIcon.d.ts +1 -1
- package/dist/components/Icons/common/WarningIcon.d.ts +1 -1
- package/dist/components/Icons/index.d.ts +13 -13
- package/dist/components/Icons/wallet/BitcoinPublicKeyIcon.d.ts +1 -1
- package/dist/components/Icons/wallet/LinkWalletIcon.d.ts +1 -1
- package/dist/components/Icons/wallet/UsingInscriptionIcon.d.ts +1 -1
- package/dist/components/List/List.d.ts +2 -3
- package/dist/components/List/StatItem.d.ts +2 -2
- package/dist/components/List/index.d.ts +3 -3
- package/dist/components/ListLegacy/ListLegacy.d.ts +2 -3
- package/dist/components/ListLegacy/index.d.ts +2 -2
- package/dist/components/Loader/Loader.d.ts +0 -1
- package/dist/components/Loader/index.d.ts +1 -1
- package/dist/components/Menu/Menu.d.ts +2 -2
- package/dist/components/Menu/MenuContext.d.ts +1 -1
- package/dist/components/Menu/MenuDrawer.d.ts +1 -1
- package/dist/components/Menu/MenuItem.d.ts +1 -1
- package/dist/components/Menu/SubMenu.d.ts +1 -1
- package/dist/components/Menu/SubMenuItem.d.ts +1 -1
- package/dist/components/Menu/index.d.ts +6 -6
- package/dist/components/Popover/Popover.d.ts +2 -3
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Portal/Portal.d.ts +2 -2
- package/dist/components/Portal/index.d.ts +1 -1
- package/dist/components/Spacer/Spacer.d.ts +1 -1
- package/dist/components/SubSection/SubSection.d.ts +1 -2
- package/dist/components/SubSection/index.d.ts +1 -1
- package/dist/components/Table/Table.d.ts +1 -2
- package/dist/components/Table/components/Cell.d.ts +1 -1
- package/dist/components/Table/components/Column.d.ts +1 -1
- package/dist/components/Table/components/Row.d.ts +1 -1
- package/dist/components/Table/index.d.ts +4 -4
- package/dist/components/Table/types/index.d.ts +1 -1
- package/dist/components/Text/Text.d.ts +2 -3
- package/dist/components/Text/index.d.ts +1 -1
- package/dist/components/Toggle/Toggle.d.ts +0 -1
- package/dist/components/Toggle/index.d.ts +1 -1
- package/dist/components/Warning/Warning.d.ts +1 -2
- package/dist/components/Warning/index.d.ts +1 -1
- package/dist/context/Dialog.context.d.ts +2 -2
- package/dist/context/Table.context.d.ts +2 -2
- package/dist/elements/FinalityProviderItem/index.d.ts +1 -1
- package/dist/elements/FinalityProviderLogo/index.d.ts +1 -1
- package/dist/elements/Icons/ChevronRightIcon.d.ts +1 -1
- package/dist/elements/Icons/SettingsIcon.d.ts +1 -1
- package/dist/elements/ProvidersList/index.d.ts +1 -1
- package/dist/elements/Table/Table.d.ts +1 -1
- package/dist/elements/Table/index.d.ts +1 -1
- package/dist/hooks/useFrozenColumns.d.ts +1 -1
- package/dist/hooks/useTableScroll.d.ts +1 -1
- package/dist/hooks/useTableSort.d.ts +1 -1
- package/dist/index.d.ts +52 -54
- package/dist/widgets/form/CheckboxField/CheckboxField.d.ts +1 -1
- package/dist/widgets/form/CheckboxField/index.d.ts +1 -1
- package/dist/widgets/form/Form/Form.d.ts +3 -3
- package/dist/widgets/form/Form/index.d.ts +1 -1
- package/dist/widgets/form/HiddenField/HiddenField.d.ts +1 -1
- package/dist/widgets/form/HiddenField/index.d.ts +1 -1
- package/dist/widgets/form/NumberField/NumberField.d.ts +2 -2
- package/dist/widgets/form/NumberField/index.d.ts +1 -1
- package/dist/widgets/form/RadioField/RadioField.d.ts +1 -1
- package/dist/widgets/form/RadioField/index.d.ts +1 -1
- package/dist/widgets/form/SelectField/SelectField.d.ts +3 -3
- package/dist/widgets/form/SelectField/index.d.ts +1 -1
- package/dist/widgets/form/TextField/TextField.d.ts +2 -2
- package/dist/widgets/form/TextField/index.d.ts +1 -1
- package/dist/widgets/form/hooks.d.ts +3 -3
- package/dist/widgets/sections/ActivityCard/components/ActivityCardActionSection.d.ts +1 -1
- package/dist/widgets/sections/ActivityCard/components/ActivityCardDetailsSection.d.ts +1 -1
- package/dist/widgets/sections/ActivityCard/index.d.ts +5 -5
- package/dist/widgets/sections/AmountSubsection/index.d.ts +1 -1
- package/dist/widgets/sections/FeesSection/index.d.ts +6 -6
- package/dist/widgets/sections/FinalityProviderSubsection/FinalityProviderSubsection.d.ts +1 -1
- package/dist/widgets/sections/FinalityProviderSubsection/index.d.ts +1 -1
- package/dist/widgets/sections/PreviewModal/PreviewModal.d.ts +1 -1
- package/dist/widgets/sections/PreviewModal/index.d.ts +1 -1
- package/dist/widgets/sections/RewardsPreviewModal/RewardsPreviewModal.d.ts +1 -1
- package/dist/widgets/sections/RewardsPreviewModal/index.d.ts +1 -1
- package/dist/widgets/sections/RewardsSubsection/index.d.ts +1 -1
- package/dist/widgets/sections/SettingMenu/SettingMenu.d.ts +3 -3
- package/dist/widgets/sections/SettingMenu/components/SettingMenuCustomContent.d.ts +1 -1
- package/dist/widgets/sections/SettingMenu/components/SettingMenuDescription.d.ts +1 -1
- package/dist/widgets/sections/SettingMenu/components/SettingMenuGroup.d.ts +1 -1
- package/dist/widgets/sections/SettingMenu/components/SettingMenuItem.d.ts +1 -1
- package/dist/widgets/sections/SettingMenu/components/SettingMenuSubMenu.d.ts +1 -1
- package/dist/widgets/sections/SettingMenu/components/SettingMenuTitle.d.ts +1 -1
- package/dist/widgets/sections/SettingMenu/components/index.d.ts +12 -12
- package/dist/widgets/sections/SettingMenu/index.d.ts +14 -14
- package/dist/widgets/sections/TableElement/TableElement.d.ts +1 -1
- package/dist/widgets/sections/TableElement/index.d.ts +1 -1
- package/dist/widgets/sections/UnbondingModal/index.d.ts +1 -1
- package/dist/widgets/sections/ValidatorSelector/ValidatorSelector.d.ts +2 -2
- package/dist/widgets/sections/ValidatorSelector/index.d.ts +1 -1
- package/dist/widgets/sections/WalletMenu/WalletMenu.d.ts +2 -2
- package/dist/widgets/sections/WalletMenu/components/WalletMenuCard.d.ts +1 -1
- package/dist/widgets/sections/WalletMenu/components/WalletMenuInfoItem.d.ts +1 -1
- package/dist/widgets/sections/WalletMenu/components/WalletMenuSettingItem.d.ts +1 -1
- package/dist/widgets/sections/WalletMenu/components/WalletToggle.d.ts +1 -1
- package/package.json +6 -6
- package/dist/components/Accordion/Accordion.js +0 -25
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -6
- package/dist/components/Accordion/Accordion.stories.js +0 -16
- package/dist/components/Accordion/components/AccordionDetails.js +0 -29
- package/dist/components/Accordion/components/AccordionSummary.js +0 -10
- package/dist/components/Accordion/hooks/useHeightObserver.js +0 -24
- package/dist/components/Accordion/index.js +0 -4
- package/dist/components/AmountItem/AmountItem.js +0 -5
- package/dist/components/AmountItem/AmountItem.stories.d.ts +0 -6
- package/dist/components/AmountItem/AmountItem.stories.js +0 -29
- package/dist/components/AmountItem/index.js +0 -1
- package/dist/components/Avatar/Avatar.js +0 -6
- package/dist/components/Avatar/Avatar.stories.d.ts +0 -7
- package/dist/components/Avatar/Avatar.stories.js +0 -18
- package/dist/components/Avatar/AvatarGroup.js +0 -15
- package/dist/components/Avatar/AvatarGroup.stories.d.ts +0 -6
- package/dist/components/Avatar/AvatarGroup.stories.js +0 -21
- package/dist/components/Avatar/ValidatorAvatar.js +0 -6
- package/dist/components/Avatar/ValidatorAvatar.stories.d.ts +0 -7
- package/dist/components/Avatar/ValidatorAvatar.stories.js +0 -21
- package/dist/components/Avatar/index.js +0 -3
- package/dist/components/Badge/Badge.js +0 -10
- package/dist/components/Badge/Badge.stories.d.ts +0 -6
- package/dist/components/Badge/Badge.stories.js +0 -14
- package/dist/components/Badge/index.js +0 -1
- package/dist/components/Button/Button.js +0 -8
- package/dist/components/Button/Button.stories.d.ts +0 -6
- package/dist/components/Button/Button.stories.js +0 -9
- package/dist/components/Button/IconButton.js +0 -7
- package/dist/components/Button/IconButton.stories.d.ts +0 -12
- package/dist/components/Button/IconButton.stories.js +0 -55
- package/dist/components/Button/WalletDisconnectButton.js +0 -8
- package/dist/components/Button/index.js +0 -3
- package/dist/components/Card/Card.js +0 -6
- package/dist/components/Card/Card.stories.d.ts +0 -8
- package/dist/components/Card/Card.stories.js +0 -29
- package/dist/components/Card/index.js +0 -1
- package/dist/components/Chip/Chip.js +0 -6
- package/dist/components/Chip/Chip.stories.d.ts +0 -6
- package/dist/components/Chip/Chip.stories.js +0 -9
- package/dist/components/Chip/index.js +0 -1
- package/dist/components/Copy/Copy.js +0 -29
- package/dist/components/Copy/index.js +0 -1
- package/dist/components/CounterButton/CounterButton.js +0 -8
- package/dist/components/CounterButton/CounterButton.stories.d.ts +0 -10
- package/dist/components/CounterButton/CounterButton.stories.js +0 -41
- package/dist/components/CounterButton/index.js +0 -1
- package/dist/components/Dialog/Dialog.js +0 -9
- package/dist/components/Dialog/Dialog.stories.d.ts +0 -7
- package/dist/components/Dialog/Dialog.stories.js +0 -42
- package/dist/components/Dialog/MobileDialog.js +0 -10
- package/dist/components/Dialog/MobileDialog.stories.d.ts +0 -6
- package/dist/components/Dialog/MobileDialog.stories.js +0 -27
- package/dist/components/Dialog/components/Backdrop.js +0 -4
- package/dist/components/Dialog/components/DialogBody.js +0 -3
- package/dist/components/Dialog/components/DialogFooter.js +0 -3
- package/dist/components/Dialog/components/DialogHeader.js +0 -5
- package/dist/components/Dialog/index.js +0 -6
- package/dist/components/DisplayHash/DisplayHash.js +0 -10
- package/dist/components/DisplayHash/index.js +0 -1
- package/dist/components/FeeItem/FeeItem.js +0 -6
- package/dist/components/FeeItem/FeeItem.stories.d.ts +0 -7
- package/dist/components/FeeItem/FeeItem.stories.js +0 -19
- package/dist/components/Form/Checkbox.js +0 -10
- package/dist/components/Form/Checkbox.stories.d.ts +0 -6
- package/dist/components/Form/Checkbox.stories.js +0 -13
- package/dist/components/Form/FormControl.js +0 -6
- package/dist/components/Form/FormControl.stories.d.ts +0 -8
- package/dist/components/Form/FormControl.stories.js +0 -30
- package/dist/components/Form/Input.js +0 -8
- package/dist/components/Form/Input.stories.d.ts +0 -10
- package/dist/components/Form/Input.stories.js +0 -43
- package/dist/components/Form/Radio.js +0 -10
- package/dist/components/Form/Radio.stories.d.ts +0 -6
- package/dist/components/Form/Radio.stories.js +0 -13
- package/dist/components/Form/Select.js +0 -47
- package/dist/components/Form/Select.stories.d.ts +0 -11
- package/dist/components/Form/Select.stories.js +0 -69
- package/dist/components/Form/components/Toggle.js +0 -22
- package/dist/components/Form/index.js +0 -5
- package/dist/components/Heading/Heading.js +0 -9
- package/dist/components/Heading/Heading.stories.d.ts +0 -6
- package/dist/components/Heading/Heading.stories.js +0 -10
- package/dist/components/Heading/index.js +0 -1
- package/dist/components/Hint/Hint.js +0 -53
- package/dist/components/Hint/Hint.stories.d.ts +0 -12
- package/dist/components/Hint/Hint.stories.js +0 -52
- package/dist/components/Hint/index.js +0 -1
- package/dist/components/Icons/ThemedIcon.js +0 -25
- package/dist/components/Icons/common/BugReportIcon.js +0 -7
- package/dist/components/Icons/common/ChevronLeftIcon.js +0 -7
- package/dist/components/Icons/common/CloseIcon.js +0 -7
- package/dist/components/Icons/common/CollapseIcon.js +0 -7
- package/dist/components/Icons/common/CopyIcon.js +0 -7
- package/dist/components/Icons/common/InfoIcon.js +0 -8
- package/dist/components/Icons/common/OpenIcon.js +0 -7
- package/dist/components/Icons/common/ThemeIcon.js +0 -7
- package/dist/components/Icons/common/WarningIcon.js +0 -8
- package/dist/components/Icons/index.js +0 -25
- package/dist/components/Icons/wallet/BitcoinPublicKeyIcon.js +0 -8
- package/dist/components/Icons/wallet/LinkWalletIcon.js +0 -8
- package/dist/components/Icons/wallet/UsingInscriptionIcon.js +0 -8
- package/dist/components/List/List.js +0 -16
- package/dist/components/List/List.stories.d.ts +0 -12
- package/dist/components/List/List.stories.js +0 -81
- package/dist/components/List/StatItem.js +0 -24
- package/dist/components/List/components/ListItem.js +0 -6
- package/dist/components/List/index.js +0 -3
- package/dist/components/ListLegacy/ListLegacy.js +0 -16
- package/dist/components/ListLegacy/ListLegacy.stories.d.ts +0 -11
- package/dist/components/ListLegacy/ListLegacy.stories.js +0 -71
- package/dist/components/ListLegacy/components/ListItemLegacy.js +0 -6
- package/dist/components/ListLegacy/index.js +0 -2
- package/dist/components/Loader/Loader.js +0 -6
- package/dist/components/Loader/Loader.stories.d.ts +0 -6
- package/dist/components/Loader/Loader.stories.js +0 -11
- package/dist/components/Loader/index.js +0 -1
- package/dist/components/Menu/Menu.js +0 -29
- package/dist/components/Menu/Menu.stories.d.ts +0 -6
- package/dist/components/Menu/Menu.stories.js +0 -38
- package/dist/components/Menu/MenuContext.js +0 -9
- package/dist/components/Menu/MenuDrawer.js +0 -24
- package/dist/components/Menu/MenuItem.js +0 -27
- package/dist/components/Menu/SubMenu.js +0 -12
- package/dist/components/Menu/SubMenuItem.js +0 -6
- package/dist/components/Menu/index.js +0 -6
- package/dist/components/Popover/Popover.js +0 -16
- package/dist/components/Popover/Popover.stories.d.ts +0 -6
- package/dist/components/Popover/Popover.stories.js +0 -25
- package/dist/components/Popover/index.js +0 -1
- package/dist/components/Portal/Portal.js +0 -44
- package/dist/components/Portal/index.js +0 -1
- package/dist/components/Spacer/Spacer.js +0 -9
- package/dist/components/Spacer/index.js +0 -1
- package/dist/components/SubSection/SubSection.js +0 -4
- package/dist/components/SubSection/SubSection.stories.d.ts +0 -6
- package/dist/components/SubSection/SubSection.stories.js +0 -13
- package/dist/components/SubSection/index.js +0 -1
- package/dist/components/Table/Table.js +0 -43
- package/dist/components/Table/Table.stories.d.ts +0 -9
- package/dist/components/Table/Table.stories.js +0 -210
- package/dist/components/Table/components/Cell.js +0 -8
- package/dist/components/Table/components/Column.js +0 -19
- package/dist/components/Table/components/Row.js +0 -7
- package/dist/components/Table/index.js +0 -4
- package/dist/components/Table/types/index.js +0 -1
- package/dist/components/Text/Text.js +0 -11
- package/dist/components/Text/Text.stories.d.ts +0 -6
- package/dist/components/Text/Text.stories.js +0 -10
- package/dist/components/Text/index.js +0 -1
- package/dist/components/Toggle/Toggle.js +0 -12
- package/dist/components/Toggle/Toggle.stories.d.ts +0 -6
- package/dist/components/Toggle/Toggle.stories.js +0 -14
- package/dist/components/Toggle/index.js +0 -1
- package/dist/components/Warning/Warning.js +0 -7
- package/dist/components/Warning/Warning.stories.d.ts +0 -9
- package/dist/components/Warning/Warning.stories.js +0 -26
- package/dist/components/Warning/index.js +0 -1
- package/dist/components/index.js +0 -5
- package/dist/context/Dialog.context.js +0 -33
- package/dist/context/Table.context.js +0 -8
- package/dist/elements/FinalityProviderItem/FinalityProviderItem.js +0 -30
- package/dist/elements/FinalityProviderItem/FinalityProviderItem.stories.d.ts +0 -12
- package/dist/elements/FinalityProviderItem/FinalityProviderItem.stories.js +0 -97
- package/dist/elements/FinalityProviderItem/index.js +0 -1
- package/dist/elements/FinalityProviderLogo/FinalityProviderLogo.js +0 -24
- package/dist/elements/FinalityProviderLogo/FinalityProviderLogo.stories.d.ts +0 -13
- package/dist/elements/FinalityProviderLogo/FinalityProviderLogo.stories.js +0 -61
- package/dist/elements/FinalityProviderLogo/index.js +0 -1
- package/dist/elements/Icons/ChevronRightIcon.js +0 -2
- package/dist/elements/Icons/SettingsIcon.js +0 -2
- package/dist/elements/Icons/index.js +0 -2
- package/dist/elements/ProvidersList/ProvidersList.js +0 -9
- package/dist/elements/ProvidersList/ProvidersList.stories.d.ts +0 -10
- package/dist/elements/ProvidersList/ProvidersList.stories.js +0 -139
- package/dist/elements/ProvidersList/index.js +0 -1
- package/dist/elements/Table/Table.js +0 -14
- package/dist/elements/Table/Table.stories.d.ts +0 -8
- package/dist/elements/Table/Table.stories.js +0 -50
- package/dist/elements/Table/index.js +0 -1
- package/dist/hooks/index.js +0 -11
- package/dist/hooks/useClickOutside.js +0 -17
- package/dist/hooks/useControlledState.js +0 -13
- package/dist/hooks/useCopy.js +0 -43
- package/dist/hooks/useDrawerAnimation.js +0 -42
- package/dist/hooks/useFrozenColumns.js +0 -23
- package/dist/hooks/useIsMobile.js +0 -33
- package/dist/hooks/useMemoizedArray.js +0 -22
- package/dist/hooks/useModalManager.js +0 -28
- package/dist/hooks/useResizeObserver.js +0 -21
- package/dist/hooks/useTableScroll.js +0 -22
- package/dist/hooks/useTableSort.js +0 -46
- package/dist/index.js +0 -54
- package/dist/providers/CoreUIProvider.js +0 -9
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
- package/dist/utils/constants.js +0 -4
- package/dist/utils/css.js +0 -6
- package/dist/utils/helpers.js +0 -110
- package/dist/utils/trim.js +0 -14
- package/dist/widgets/form/CheckboxField/CheckboxField.js +0 -7
- package/dist/widgets/form/CheckboxField/CheckboxField.stories.d.ts +0 -6
- package/dist/widgets/form/CheckboxField/CheckboxField.stories.js +0 -17
- package/dist/widgets/form/CheckboxField/index.js +0 -1
- package/dist/widgets/form/Form/Form.js +0 -20
- package/dist/widgets/form/Form/Form.stories.d.ts +0 -6
- package/dist/widgets/form/Form/Form.stories.js +0 -27
- package/dist/widgets/form/Form/index.js +0 -1
- package/dist/widgets/form/HiddenField/HiddenField.js +0 -13
- package/dist/widgets/form/HiddenField/HiddenField.stories.d.ts +0 -6
- package/dist/widgets/form/HiddenField/HiddenField.stories.js +0 -17
- package/dist/widgets/form/HiddenField/index.js +0 -1
- package/dist/widgets/form/NumberField/NumberField.js +0 -15
- package/dist/widgets/form/NumberField/NumberField.stories.d.ts +0 -6
- package/dist/widgets/form/NumberField/NumberField.stories.js +0 -31
- package/dist/widgets/form/NumberField/index.js +0 -1
- package/dist/widgets/form/RadioField/RadioField.js +0 -7
- package/dist/widgets/form/RadioField/RadioField.stories.d.ts +0 -6
- package/dist/widgets/form/RadioField/RadioField.stories.js +0 -14
- package/dist/widgets/form/RadioField/index.js +0 -1
- package/dist/widgets/form/SelectField/SelectField.js +0 -13
- package/dist/widgets/form/SelectField/SelectField.stories.d.ts +0 -6
- package/dist/widgets/form/SelectField/SelectField.stories.js +0 -33
- package/dist/widgets/form/SelectField/index.js +0 -1
- package/dist/widgets/form/TextField/TextField.js +0 -9
- package/dist/widgets/form/TextField/TextField.stories.d.ts +0 -6
- package/dist/widgets/form/TextField/TextField.stories.js +0 -28
- package/dist/widgets/form/TextField/index.js +0 -1
- package/dist/widgets/form/hooks.js +0 -29
- package/dist/widgets/form/types.js +0 -1
- package/dist/widgets/sections/ActivityCard/ActivityCard.js +0 -8
- package/dist/widgets/sections/ActivityCard/ActivityCard.stories.d.ts +0 -14
- package/dist/widgets/sections/ActivityCard/ActivityCard.stories.js +0 -265
- package/dist/widgets/sections/ActivityCard/components/ActivityCardActionSection.js +0 -5
- package/dist/widgets/sections/ActivityCard/components/ActivityCardAmountSection.js +0 -6
- package/dist/widgets/sections/ActivityCard/components/ActivityCardDetailsSection.js +0 -19
- package/dist/widgets/sections/ActivityCard/components/ActivityListItem.js +0 -5
- package/dist/widgets/sections/ActivityCard/index.js +0 -5
- package/dist/widgets/sections/AmountSubsection/AmountSubsection.js +0 -53
- package/dist/widgets/sections/AmountSubsection/AmountSubsection.stories.d.ts +0 -16
- package/dist/widgets/sections/AmountSubsection/AmountSubsection.stories.js +0 -230
- package/dist/widgets/sections/AmountSubsection/index.js +0 -1
- package/dist/widgets/sections/FeesSection/BBNFeeAmount.js +0 -7
- package/dist/widgets/sections/FeesSection/BTCFeeAmount.js +0 -19
- package/dist/widgets/sections/FeesSection/BTCFeeRate.js +0 -7
- package/dist/widgets/sections/FeesSection/FeesSection.js +0 -10
- package/dist/widgets/sections/FeesSection/FeesSection.stories.d.ts +0 -7
- package/dist/widgets/sections/FeesSection/FeesSection.stories.js +0 -18
- package/dist/widgets/sections/FeesSection/Total.js +0 -20
- package/dist/widgets/sections/FeesSection/index.js +0 -6
- package/dist/widgets/sections/FinalityProviderSubsection/FinalityProviderSubsection.js +0 -9
- package/dist/widgets/sections/FinalityProviderSubsection/FinalityProviderSubsection.stories.d.ts +0 -14
- package/dist/widgets/sections/FinalityProviderSubsection/FinalityProviderSubsection.stories.js +0 -212
- package/dist/widgets/sections/FinalityProviderSubsection/index.js +0 -1
- package/dist/widgets/sections/PreviewModal/PreviewModal.js +0 -48
- package/dist/widgets/sections/PreviewModal/PreviewModal.stories.d.ts +0 -8
- package/dist/widgets/sections/PreviewModal/PreviewModal.stories.js +0 -115
- package/dist/widgets/sections/PreviewModal/index.js +0 -1
- package/dist/widgets/sections/RewardsPreviewModal/RewardsPreviewModal.js +0 -15
- package/dist/widgets/sections/RewardsPreviewModal/RewardsPreviewModal.stories.d.ts +0 -9
- package/dist/widgets/sections/RewardsPreviewModal/RewardsPreviewModal.stories.js +0 -190
- package/dist/widgets/sections/RewardsPreviewModal/index.js +0 -1
- package/dist/widgets/sections/RewardsSubsection/RewardsSubsection.js +0 -13
- package/dist/widgets/sections/RewardsSubsection/RewardsSubsection.stories.d.ts +0 -8
- package/dist/widgets/sections/RewardsSubsection/RewardsSubsection.stories.js +0 -96
- package/dist/widgets/sections/RewardsSubsection/index.js +0 -1
- package/dist/widgets/sections/SettingMenu/SettingMenu.js +0 -18
- package/dist/widgets/sections/SettingMenu/SettingMenu.stories.d.ts +0 -6
- package/dist/widgets/sections/SettingMenu/SettingMenu.stories.js +0 -49
- package/dist/widgets/sections/SettingMenu/components/SettingMenuCustomContent.js +0 -2
- package/dist/widgets/sections/SettingMenu/components/SettingMenuDescription.js +0 -4
- package/dist/widgets/sections/SettingMenu/components/SettingMenuGroup.js +0 -15
- package/dist/widgets/sections/SettingMenu/components/SettingMenuItem.js +0 -13
- package/dist/widgets/sections/SettingMenu/components/SettingMenuSubMenu.js +0 -14
- package/dist/widgets/sections/SettingMenu/components/SettingMenuTitle.js +0 -4
- package/dist/widgets/sections/SettingMenu/components/index.js +0 -6
- package/dist/widgets/sections/SettingMenu/index.js +0 -7
- package/dist/widgets/sections/TableElement/TableElement.js +0 -6
- package/dist/widgets/sections/TableElement/TableElement.stories.d.ts +0 -9
- package/dist/widgets/sections/TableElement/TableElement.stories.js +0 -54
- package/dist/widgets/sections/TableElement/index.js +0 -1
- package/dist/widgets/sections/UnbondingModal/UnbondingModal.js +0 -18
- package/dist/widgets/sections/UnbondingModal/UnbondingModal.stories.d.ts +0 -7
- package/dist/widgets/sections/UnbondingModal/UnbondingModal.stories.js +0 -81
- package/dist/widgets/sections/UnbondingModal/index.js +0 -1
- package/dist/widgets/sections/ValidatorSelector/ValidatorSelector.js +0 -34
- package/dist/widgets/sections/ValidatorSelector/ValidatorSelector.stories.d.ts +0 -6
- package/dist/widgets/sections/ValidatorSelector/ValidatorSelector.stories.js +0 -52
- package/dist/widgets/sections/ValidatorSelector/index.js +0 -1
- package/dist/widgets/sections/WalletMenu/WalletMenu.js +0 -33
- package/dist/widgets/sections/WalletMenu/WalletMenu.stories.d.ts +0 -7
- package/dist/widgets/sections/WalletMenu/WalletMenu.stories.js +0 -70
- package/dist/widgets/sections/WalletMenu/components/WalletMenuCard.js +0 -32
- package/dist/widgets/sections/WalletMenu/components/WalletMenuInfoItem.js +0 -8
- package/dist/widgets/sections/WalletMenu/components/WalletMenuSettingItem.js +0 -8
- package/dist/widgets/sections/WalletMenu/components/WalletToggle.js +0 -12
- package/dist/widgets/sections/WalletMenu/components/index.js +0 -4
- package/dist/widgets/sections/WalletMenu/index.js +0 -5
package/dist/utils/helpers.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { Decimal } from "decimal.js-light";
|
|
2
|
-
const defaultFormatOptions = {
|
|
3
|
-
prefix: "$",
|
|
4
|
-
precision: 2,
|
|
5
|
-
zeroDisplay: "-",
|
|
6
|
-
format: {
|
|
7
|
-
minimumFractionDigits: 2,
|
|
8
|
-
maximumFractionDigits: 2,
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
export function formatCurrency(currencyValue, options = {}) {
|
|
12
|
-
const { prefix, precision, zeroDisplay, format } = {
|
|
13
|
-
...defaultFormatOptions,
|
|
14
|
-
...options,
|
|
15
|
-
};
|
|
16
|
-
if (currencyValue === 0)
|
|
17
|
-
return zeroDisplay;
|
|
18
|
-
const formatted = currencyValue.toLocaleString("en", format ?? { maximumFractionDigits: precision });
|
|
19
|
-
return `${prefix}${formatted}`;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Converts token amount to formatted currency string
|
|
23
|
-
* @param amount The amount of token
|
|
24
|
-
* @param price The price of token in currency
|
|
25
|
-
* @param options Formatting options
|
|
26
|
-
*/
|
|
27
|
-
export function calculateTokenValueInCurrency(amount, price, options) {
|
|
28
|
-
const currencyValue = amount * price;
|
|
29
|
-
return formatCurrency(currencyValue, options);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Limits the number of decimal places of a given number to a specified maximum.
|
|
33
|
-
*
|
|
34
|
-
* @param value The original number that you want to limit the decimal places for.
|
|
35
|
-
* @param maxDecimals The maximum number of decimal places that the result should have.
|
|
36
|
-
* @returns The number rounded to the specified number of decimal places.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* maxDecimals(3.14159, 2); // returns 3.14
|
|
40
|
-
* maxDecimals(1.005, 2); // returns 1.01
|
|
41
|
-
* maxDecimals(10, 0); // returns 10
|
|
42
|
-
* maxDecimals(0.00010000, 8); // returns 0.0001
|
|
43
|
-
* maxDecimals(0.00010000, 8); // returns 0.0001
|
|
44
|
-
* maxDecimals(3.141, 3); // returns 3.141
|
|
45
|
-
* maxDecimals(3.149, 3); // returns 3.149
|
|
46
|
-
*/
|
|
47
|
-
export const maxDecimals = (value, maxDecimals, rm) => {
|
|
48
|
-
return new Decimal(value).toDecimalPlaces(maxDecimals, rm).toNumber();
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Converts a string to kebab-case for use as unique or semantic keys.
|
|
52
|
-
*
|
|
53
|
-
* @param str The input string to convert.
|
|
54
|
-
* @returns The kebab-case version of the input string.
|
|
55
|
-
*/
|
|
56
|
-
export const toKebabCase = (str) => {
|
|
57
|
-
let result = "";
|
|
58
|
-
for (let i = 0; i < str.length; i++) {
|
|
59
|
-
const char = str[i].toLowerCase();
|
|
60
|
-
if ((char >= "a" && char <= "z") || (char >= "0" && char <= "9")) {
|
|
61
|
-
result += char;
|
|
62
|
-
}
|
|
63
|
-
else if (result.length > 0 && result[result.length - 1] !== "-") {
|
|
64
|
-
result += "-";
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (result.endsWith("-")) {
|
|
68
|
-
result = result.slice(0, -1);
|
|
69
|
-
}
|
|
70
|
-
return result;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Creates a generic balance formatter function for cryptocurrency amounts
|
|
74
|
-
* @param coinSymbol The symbol of the cryptocurrency (e.g., 'BTC', 'ETH', 'BABY')
|
|
75
|
-
* @param decimals Number of decimal places to display
|
|
76
|
-
* @returns A formatter function that takes an amount and returns formatted string
|
|
77
|
-
*/
|
|
78
|
-
export function createBalanceFormatter(coinSymbol, decimals = 8) {
|
|
79
|
-
return (amount) => {
|
|
80
|
-
return `${amount.toLocaleString(undefined, {
|
|
81
|
-
minimumFractionDigits: Math.min(2, decimals),
|
|
82
|
-
maximumFractionDigits: decimals,
|
|
83
|
-
})} ${coinSymbol}`;
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Format balance with fewer decimals for larger amounts, more decimals for smaller amounts
|
|
88
|
-
* @param amount The amount to format
|
|
89
|
-
* @param coinSymbol The coin symbol
|
|
90
|
-
* @returns Formatted balance string
|
|
91
|
-
*/
|
|
92
|
-
export function formatCryptoBalance(amount, coinSymbol) {
|
|
93
|
-
if (amount === 0)
|
|
94
|
-
return `0 ${coinSymbol}`;
|
|
95
|
-
// For amounts >= 1, show 2-4 decimals
|
|
96
|
-
if (amount >= 1) {
|
|
97
|
-
return `${amount.toLocaleString(undefined, {
|
|
98
|
-
minimumFractionDigits: 2,
|
|
99
|
-
maximumFractionDigits: 4,
|
|
100
|
-
})} ${coinSymbol}`;
|
|
101
|
-
}
|
|
102
|
-
// For smaller amounts, show up to 8 decimals but remove trailing zeros
|
|
103
|
-
const formatted = amount.toLocaleString(undefined, {
|
|
104
|
-
minimumFractionDigits: 2,
|
|
105
|
-
maximumFractionDigits: 8,
|
|
106
|
-
});
|
|
107
|
-
// Remove trailing zeros after decimal point
|
|
108
|
-
const trimmed = formatted.replace(/\.?0+$/, '');
|
|
109
|
-
return `${trimmed} ${coinSymbol}`;
|
|
110
|
-
}
|
package/dist/utils/trim.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trims a string to a specified number of characters from the start and end
|
|
3
|
-
* @param value - The string to trim
|
|
4
|
-
* @param symbols - Number of characters to show from start and end (default: 8)
|
|
5
|
-
* @returns Trimmed string with ellipsis in the middle
|
|
6
|
-
*/
|
|
7
|
-
export function trim(value, symbols = 8) {
|
|
8
|
-
if (!value || value.length <= symbols * 2) {
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
const start = value.slice(0, symbols);
|
|
12
|
-
const end = value.slice(-symbols);
|
|
13
|
-
return `${start}...${end}`;
|
|
14
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Checkbox } from "@/components/Form/Checkbox";
|
|
3
|
-
import { useField } from "@/widgets/form/hooks";
|
|
4
|
-
export function CheckboxField({ name, id = name, label, className, disabled, value, defaultChecked, labelClassName, orientation, }) {
|
|
5
|
-
const { ref, value: checked = false, onChange, onBlur } = useField({ name });
|
|
6
|
-
return (_jsx(Checkbox, { ref: ref, name: name, checked: checked, id: id, label: label, className: className, disabled: disabled, value: value, defaultChecked: defaultChecked, labelClassName: labelClassName, orientation: orientation, inputProps: { onChange, onBlur } }));
|
|
7
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Form } from "@/widgets/form/Form";
|
|
3
|
-
import { CheckboxField } from "./CheckboxField";
|
|
4
|
-
const meta = {
|
|
5
|
-
component: CheckboxField,
|
|
6
|
-
tags: ["autodocs"],
|
|
7
|
-
};
|
|
8
|
-
export default meta;
|
|
9
|
-
export const Default = {
|
|
10
|
-
args: {
|
|
11
|
-
name: "checkbox_field",
|
|
12
|
-
label: "Checkbox field",
|
|
13
|
-
},
|
|
14
|
-
decorators: [
|
|
15
|
-
(Story) => (_jsx(Form, { onChange: console.log, defaultValues: { checkbox_field: true }, children: _jsx(Story, {}) })),
|
|
16
|
-
],
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./CheckboxField";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import { FormProvider, useForm, } from "react-hook-form";
|
|
4
|
-
import { yupResolver } from "@hookform/resolvers/yup";
|
|
5
|
-
import { twJoin } from "tailwind-merge";
|
|
6
|
-
export function Form({ className, name, children, mode = "onBlur", reValidateMode = "onBlur", defaultValues, schema, formProps, onSubmit = () => null, onChange, }) {
|
|
7
|
-
const methods = useForm({
|
|
8
|
-
mode,
|
|
9
|
-
reValidateMode,
|
|
10
|
-
defaultValues,
|
|
11
|
-
resolver: schema ? yupResolver(schema) : undefined,
|
|
12
|
-
});
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (!onChange)
|
|
15
|
-
return;
|
|
16
|
-
const { unsubscribe } = methods.watch(onChange);
|
|
17
|
-
return unsubscribe;
|
|
18
|
-
}, [onChange, methods.watch]);
|
|
19
|
-
return (_jsx(FormProvider, { ...methods, children: _jsx("form", { className: twJoin("bbn-form", className), name: name, onSubmit: methods.handleSubmit(onSubmit), ...formProps, children: children }) }));
|
|
20
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as yup from "yup";
|
|
3
|
-
import { Form } from "./Form";
|
|
4
|
-
import { useField } from "@/widgets/form/hooks";
|
|
5
|
-
import { Input, FormControl } from "@/components/Form";
|
|
6
|
-
const meta = {
|
|
7
|
-
component: Form,
|
|
8
|
-
tags: ["autodocs"],
|
|
9
|
-
};
|
|
10
|
-
export default meta;
|
|
11
|
-
const Field = () => {
|
|
12
|
-
const { error, invalid, ...inputProps } = useField({ name: "test", autoFocus: true, defaultValue: "test" });
|
|
13
|
-
return (_jsx(FormControl, { label: "Text field", state: invalid ? "error" : "default", hint: error, children: _jsx(Input, { ...inputProps, state: invalid ? "error" : "default" }) }));
|
|
14
|
-
};
|
|
15
|
-
const schema = yup
|
|
16
|
-
.object()
|
|
17
|
-
.shape({
|
|
18
|
-
test: yup.string().required(),
|
|
19
|
-
})
|
|
20
|
-
.required();
|
|
21
|
-
export const Default = {
|
|
22
|
-
args: {
|
|
23
|
-
onChange: console.log,
|
|
24
|
-
schema,
|
|
25
|
-
},
|
|
26
|
-
render: (props) => (_jsx(Form, { ...props, children: _jsx(Field, {}) })),
|
|
27
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Form";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { FormControl } from "@/components/Form";
|
|
3
|
-
import { useField } from "@/widgets/form/hooks";
|
|
4
|
-
export function HiddenField({ displayError = false, ...props }) {
|
|
5
|
-
const { error, value, onChange, onBlur, disabled, name, ref } = useField(props);
|
|
6
|
-
const input = (_jsx("input", { ref: ref, type: "hidden", name: name, disabled: disabled, value: value, onChange: onChange, onBlur: onBlur }));
|
|
7
|
-
if (displayError) {
|
|
8
|
-
const fieldState = displayError ? "error" : "default";
|
|
9
|
-
const fieldHint = displayError ? error : "";
|
|
10
|
-
return (_jsx(FormControl, { hint: fieldHint, state: fieldState, children: input }));
|
|
11
|
-
}
|
|
12
|
-
return input;
|
|
13
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Form } from "@/widgets/form/Form";
|
|
3
|
-
import { HiddenField } from "./HiddenField";
|
|
4
|
-
const meta = {
|
|
5
|
-
component: HiddenField,
|
|
6
|
-
tags: ["autodocs"],
|
|
7
|
-
};
|
|
8
|
-
export default meta;
|
|
9
|
-
export const Default = {
|
|
10
|
-
args: {
|
|
11
|
-
name: "hidden_field",
|
|
12
|
-
defaultValue: "test",
|
|
13
|
-
},
|
|
14
|
-
decorators: [
|
|
15
|
-
(Story) => (_jsx(Form, { onChange: console.log, children: _jsx(Story, {}) })),
|
|
16
|
-
],
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./HiddenField";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { FormControl, Input } from "@/components/Form";
|
|
3
|
-
import { useField } from "@/widgets/form/hooks";
|
|
4
|
-
const NUMBER_REG_EXP = /^-?\d*\.?\d*$/;
|
|
5
|
-
export function NumberField({ name, id = name, label, hint, className, controlClassName, disabled, autoFocus, defaultValue, placeholder, type, suffix, prefix, shouldUnregister, state, validateOnMount, }) {
|
|
6
|
-
const { ref, value = "", error, invalid, onChange, onBlur, } = useField({ name, defaultValue, autoFocus, shouldUnregister, validateOnMount });
|
|
7
|
-
const fieldState = invalid ? "error" : state;
|
|
8
|
-
const fieldHint = invalid ? error : hint;
|
|
9
|
-
const handleChange = (e) => {
|
|
10
|
-
if (NUMBER_REG_EXP.test(e.target.value)) {
|
|
11
|
-
onChange(e.target.value);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
return (_jsx(FormControl, { label: label, className: controlClassName, state: fieldState, hint: fieldHint, children: _jsx(Input, { inputMode: "decimal", pattern: "^-?\\d*\\.?\\d*$", ref: ref, value: value, id: id, name: name, type: type, className: className, disabled: disabled, autoFocus: autoFocus, placeholder: placeholder, suffix: suffix, prefix: prefix, state: fieldState, onChange: handleChange, onBlur: onBlur }) }));
|
|
15
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as yup from "yup";
|
|
3
|
-
import { NumberField } from "./NumberField";
|
|
4
|
-
import { Form } from "@/widgets/form/Form";
|
|
5
|
-
const meta = {
|
|
6
|
-
component: NumberField,
|
|
7
|
-
tags: ["autodocs"],
|
|
8
|
-
};
|
|
9
|
-
export default meta;
|
|
10
|
-
const schema = yup
|
|
11
|
-
.object()
|
|
12
|
-
.shape({
|
|
13
|
-
number_field: yup
|
|
14
|
-
.number()
|
|
15
|
-
.transform((value) => (Number.isNaN(value) ? null : value))
|
|
16
|
-
.required(),
|
|
17
|
-
})
|
|
18
|
-
.required();
|
|
19
|
-
export const Default = {
|
|
20
|
-
args: {
|
|
21
|
-
label: "Number Field",
|
|
22
|
-
name: "number_field",
|
|
23
|
-
placeholder: "Default input",
|
|
24
|
-
hint: "Some random and useless hint",
|
|
25
|
-
defaultValue: "",
|
|
26
|
-
autoFocus: true,
|
|
27
|
-
},
|
|
28
|
-
decorators: [
|
|
29
|
-
(Story) => (_jsx(Form, { schema: schema, onChange: console.log, children: _jsx(Story, {}) })),
|
|
30
|
-
],
|
|
31
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./NumberField";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Radio } from "@/components/Form/Radio";
|
|
3
|
-
import { useField } from "@/widgets/form/hooks";
|
|
4
|
-
export function RadioField({ name, id = name, label, className, disabled, value, defaultChecked, labelClassName, orientation, }) {
|
|
5
|
-
const { ref, value: selectedValue, onChange, onBlur, } = useField({ name, disabled, defaultValue: defaultChecked ? value : undefined });
|
|
6
|
-
return (_jsx(Radio, { ref: ref, name: name, id: id, label: label, className: className, disabled: disabled, checked: selectedValue === value, value: value, labelClassName: labelClassName, orientation: orientation, inputProps: { onChange, onBlur } }));
|
|
7
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Form } from "@/widgets/form/Form";
|
|
3
|
-
import { RadioField } from "./RadioField";
|
|
4
|
-
const meta = {
|
|
5
|
-
component: RadioField,
|
|
6
|
-
tags: ["autodocs"],
|
|
7
|
-
};
|
|
8
|
-
export default meta;
|
|
9
|
-
export const Default = {
|
|
10
|
-
decorators: [
|
|
11
|
-
(Story) => (_jsx(Form, { onChange: console.log, children: _jsx(Story, {}) })),
|
|
12
|
-
],
|
|
13
|
-
render: () => (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(RadioField, { name: "radio_filed", value: "test", label: "Test" }), _jsx(RadioField, { defaultChecked: true, name: "radio_filed", value: "test1", label: "Test 1" }), _jsx(RadioField, { name: "radio_filed", value: "test2", label: "Test 2" })] })),
|
|
14
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./RadioField";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { FormControl, Select } from "@/components/Form";
|
|
3
|
-
import { useField } from "@/widgets/form/hooks";
|
|
4
|
-
export function SelectField({ open, defaultOpen, options, optionClassName, popoverClassName, name, id = name, label, hint, className, controlClassName, disabled, autoFocus, defaultValue, placeholder, shouldUnregister, state, validateOnMount, onOpen, onClose, renderSelectedOption, }) {
|
|
5
|
-
const { ref, value = "", error, invalid, onChange, onBlur, } = useField({ name, defaultValue, autoFocus, shouldUnregister, validateOnMount });
|
|
6
|
-
const fieldState = invalid ? "error" : state;
|
|
7
|
-
const fieldHint = invalid ? error : hint;
|
|
8
|
-
const handleClose = () => {
|
|
9
|
-
onBlur?.();
|
|
10
|
-
onClose?.();
|
|
11
|
-
};
|
|
12
|
-
return (_jsx(FormControl, { label: label, className: controlClassName, state: fieldState, hint: fieldHint, children: _jsx(Select, { open: open, defaultOpen: defaultOpen, options: options, ref: ref, value: value, id: id, name: name, className: className, disabled: disabled, placeholder: placeholder, state: fieldState, optionClassName: optionClassName, popoverClassName: popoverClassName, onSelect: onChange, onBlur: onBlur, onOpen: onOpen, onClose: handleClose, renderSelectedOption: renderSelectedOption }) }));
|
|
13
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as yup from "yup";
|
|
3
|
-
import { SelectField } from "./SelectField";
|
|
4
|
-
import { Form } from "../Form";
|
|
5
|
-
const meta = {
|
|
6
|
-
component: SelectField,
|
|
7
|
-
tags: ["autodocs"],
|
|
8
|
-
};
|
|
9
|
-
export default meta;
|
|
10
|
-
const schema = yup
|
|
11
|
-
.object()
|
|
12
|
-
.shape({
|
|
13
|
-
select_field: yup.string().required(),
|
|
14
|
-
})
|
|
15
|
-
.required();
|
|
16
|
-
export const Default = {
|
|
17
|
-
args: {
|
|
18
|
-
label: "Select Field",
|
|
19
|
-
name: "select_field",
|
|
20
|
-
placeholder: "Select value",
|
|
21
|
-
hint: "Some random and useless hint",
|
|
22
|
-
defaultValue: "pending",
|
|
23
|
-
options: [
|
|
24
|
-
{ value: "", label: "None" },
|
|
25
|
-
{ value: "active", label: "Active" },
|
|
26
|
-
{ value: "inactive", label: "Inactive" },
|
|
27
|
-
{ value: "pending", label: "Pending" },
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
decorators: [
|
|
31
|
-
(Story) => (_jsx(Form, { schema: schema, onChange: console.log, children: _jsx(Story, {}) })),
|
|
32
|
-
],
|
|
33
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./SelectField";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { FormControl, Input } from "@/components/Form";
|
|
3
|
-
import { useField } from "@/widgets/form/hooks";
|
|
4
|
-
export function TextField({ name, id = name, label, hint, className, controlClassName, disabled, autoFocus, defaultValue, placeholder, type, suffix, prefix, shouldUnregister, state, validateOnMount, }) {
|
|
5
|
-
const { ref, value = "", error, invalid, onChange, onBlur, } = useField({ name, defaultValue, autoFocus, shouldUnregister, validateOnMount });
|
|
6
|
-
const fieldState = invalid ? "error" : state;
|
|
7
|
-
const fieldHint = invalid ? error : hint;
|
|
8
|
-
return (_jsx(FormControl, { label: label, className: controlClassName, state: fieldState, hint: fieldHint, children: _jsx(Input, { ref: ref, value: value, id: id, name: name, type: type, className: className, disabled: disabled, autoFocus: autoFocus, placeholder: placeholder, suffix: suffix, prefix: prefix, state: fieldState, onChange: onChange, onBlur: onBlur }) }));
|
|
9
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as yup from "yup";
|
|
3
|
-
import { TextField } from "./TextField";
|
|
4
|
-
import { Form } from "@/widgets/form/Form";
|
|
5
|
-
const meta = {
|
|
6
|
-
component: TextField,
|
|
7
|
-
tags: ["autodocs"],
|
|
8
|
-
};
|
|
9
|
-
export default meta;
|
|
10
|
-
const schema = yup
|
|
11
|
-
.object()
|
|
12
|
-
.shape({
|
|
13
|
-
text_field: yup.string().required(),
|
|
14
|
-
})
|
|
15
|
-
.required();
|
|
16
|
-
export const Default = {
|
|
17
|
-
args: {
|
|
18
|
-
label: "Text Field",
|
|
19
|
-
name: "text_field",
|
|
20
|
-
placeholder: "Default input",
|
|
21
|
-
hint: "Some random and useless hint",
|
|
22
|
-
defaultValue: "",
|
|
23
|
-
autoFocus: true,
|
|
24
|
-
},
|
|
25
|
-
decorators: [
|
|
26
|
-
(Story) => (_jsx(Form, { schema: schema, onChange: console.log, children: _jsx(Story, {}) })),
|
|
27
|
-
],
|
|
28
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./TextField";
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { useController, useFormContext, useFormState } from "react-hook-form";
|
|
3
|
-
export function useField({ name, defaultValue, disabled = false, autoFocus = false, shouldUnregister = false, validateOnMount = true, }) {
|
|
4
|
-
const { setFocus, trigger } = useFormContext();
|
|
5
|
-
const { field, fieldState } = useController({ name, defaultValue, disabled, shouldUnregister });
|
|
6
|
-
const { invalid, isTouched, error } = fieldState;
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
if (validateOnMount) {
|
|
9
|
-
trigger(name, { shouldFocus: autoFocus });
|
|
10
|
-
}
|
|
11
|
-
else if (autoFocus) {
|
|
12
|
-
setFocus(name);
|
|
13
|
-
}
|
|
14
|
-
}, [name, validateOnMount]);
|
|
15
|
-
return {
|
|
16
|
-
...field,
|
|
17
|
-
value: field.value,
|
|
18
|
-
invalid: invalid && isTouched,
|
|
19
|
-
error: error?.message ?? "",
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export function useFieldState(field) {
|
|
23
|
-
const { getFieldState } = useFormContext();
|
|
24
|
-
const formState = useFormState({ name: field });
|
|
25
|
-
const fieldState = Array.isArray(field)
|
|
26
|
-
? field.map((fieldName) => getFieldState(fieldName, formState))
|
|
27
|
-
: getFieldState(field, formState);
|
|
28
|
-
return fieldState;
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from "../../../components/Button";
|
|
3
|
-
import { ActivityCardActionSection } from "./components/ActivityCardActionSection";
|
|
4
|
-
import { ActivityCardAmountSection } from "./components/ActivityCardAmountSection";
|
|
5
|
-
import { ActivityCardDetailsSection } from "./components/ActivityCardDetailsSection";
|
|
6
|
-
export function ActivityCard({ data, className }) {
|
|
7
|
-
return (_jsxs("div", { className: `w-full bg-secondary-highlight p-3 sm:p-4 rounded flex flex-col justify-between ${className || ""}`, children: [_jsxs("div", { className: "space-y-3 sm:space-y-4", children: [_jsx(ActivityCardAmountSection, { formattedAmount: data.formattedAmount, icon: data.icon, iconAlt: data.iconAlt, chainName: data.chainName, chainIcon: data.chainIcon, chainIconAlt: data.chainIconAlt }), _jsx(ActivityCardDetailsSection, { details: data.details, optionalDetails: data.optionalDetails, listItems: data.listItems }), data.secondaryActions && data.secondaryActions.length > 0 && (_jsx(ActivityCardActionSection, { actions: data.secondaryActions }))] }), data.primaryAction && (_jsx(Button, { variant: "outlined", className: `mt-4 ${data.primaryAction.className || ""}`, onClick: data.primaryAction.onClick, fluid: data.primaryAction.fullWidth !== false, children: data.primaryAction.label }))] }));
|
|
8
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { ActivityCard } from "./ActivityCard";
|
|
3
|
-
declare const meta: Meta<typeof ActivityCard>;
|
|
4
|
-
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const Basic: Story;
|
|
7
|
-
export declare const WithIcon: Story;
|
|
8
|
-
export declare const WithPrimaryAction: Story;
|
|
9
|
-
export declare const WithSecondaryActions: Story;
|
|
10
|
-
export declare const WithOptionalDetails: Story;
|
|
11
|
-
export declare const WithListItems: Story;
|
|
12
|
-
export declare const Complete: Story;
|
|
13
|
-
export declare const LargeAmount: Story;
|
|
14
|
-
export declare const ErrorState: Story;
|