@laerdal/life-react-components 6.0.0-dev.1.full → 6.0.0-dev.12.full
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/Accordion/ContentAccordion.cjs +40 -11
- package/dist/Accordion/ContentAccordion.cjs.map +1 -1
- package/dist/Accordion/ContentAccordion.js +40 -11
- package/dist/Accordion/ContentAccordion.js.map +1 -1
- package/dist/Accordion/__tests__/AccordionMenu.test.tsx +42 -0
- package/dist/Accordion/__tests__/ContentAccordion.test.tsx +150 -0
- package/dist/Accordion/styles.cjs +51 -13
- package/dist/Accordion/styles.cjs.map +1 -1
- package/dist/Accordion/styles.js +51 -13
- package/dist/Accordion/styles.js.map +1 -1
- package/dist/AuthPage/__tests__/AuthPage.test.tsx +27 -0
- package/dist/Banners/Banner.cjs +38 -34
- package/dist/Banners/Banner.cjs.map +1 -1
- package/dist/Banners/Banner.d.ts +2 -3
- package/dist/Banners/Banner.js +38 -34
- package/dist/Banners/Banner.js.map +1 -1
- package/dist/Banners/__tests__/Banner.test.tsx +47 -0
- package/dist/Banners/__tests__/OverviewBanner.test.tsx +20 -0
- package/dist/Banners/styles.cjs +8 -16
- package/dist/Banners/styles.cjs.map +1 -1
- package/dist/Banners/styles.js +8 -16
- package/dist/Banners/styles.js.map +1 -1
- package/dist/Breadcrumb/Breadcrumb.cjs +8 -2
- package/dist/Breadcrumb/Breadcrumb.cjs.map +1 -1
- package/dist/Breadcrumb/Breadcrumb.js +8 -2
- package/dist/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/Breadcrumb/__tests__/Breadcrumb.test.tsx +78 -0
- package/dist/Breadcrumb/styles.cjs +15 -4
- package/dist/Breadcrumb/styles.cjs.map +1 -1
- package/dist/Breadcrumb/styles.js +15 -4
- package/dist/Breadcrumb/styles.js.map +1 -1
- package/dist/Button/BackButton.cjs +27 -6
- package/dist/Button/BackButton.cjs.map +1 -1
- package/dist/Button/BackButton.js +27 -6
- package/dist/Button/BackButton.js.map +1 -1
- package/dist/Button/Button.cjs +179 -47
- package/dist/Button/Button.cjs.map +1 -1
- package/dist/Button/Button.d.ts +2 -0
- package/dist/Button/Button.js +179 -47
- package/dist/Button/Button.js.map +1 -1
- package/dist/Button/Iconbutton.cjs +83 -21
- package/dist/Button/Iconbutton.cjs.map +1 -1
- package/dist/Button/Iconbutton.js +83 -21
- package/dist/Button/Iconbutton.js.map +1 -1
- package/dist/Button/__tests__/BackButton.test.tsx +32 -0
- package/dist/Button/__tests__/Button.test.tsx +45 -0
- package/dist/Button/__tests__/DualButton.test.tsx +119 -0
- package/dist/Card/HorizontalCard/HorizontalCard.cjs +20 -5
- package/dist/Card/HorizontalCard/HorizontalCard.cjs.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCard.js +20 -5
- package/dist/Card/HorizontalCard/HorizontalCard.js.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardBody.cjs +12 -3
- package/dist/Card/HorizontalCard/HorizontalCardBody.cjs.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardBody.js +12 -3
- package/dist/Card/HorizontalCard/HorizontalCardBody.js.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.cjs +8 -2
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.cjs.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.js +8 -2
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.js.map +1 -1
- package/dist/Card/HorizontalCard/__tests__/HorizontalCard.test.tsx +71 -0
- package/dist/Card/HorizontalCard/__tests__/VerticalCard.test.tsx +124 -0
- package/dist/Card/VerticalCard/Card.cjs +20 -5
- package/dist/Card/VerticalCard/Card.cjs.map +1 -1
- package/dist/Card/VerticalCard/Card.js +20 -5
- package/dist/Card/VerticalCard/Card.js.map +1 -1
- package/dist/Card/VerticalCard/CardBottomSection.cjs +72 -19
- package/dist/Card/VerticalCard/CardBottomSection.cjs.map +1 -1
- package/dist/Card/VerticalCard/CardBottomSection.d.ts +8 -1
- package/dist/Card/VerticalCard/CardBottomSection.js +73 -20
- package/dist/Card/VerticalCard/CardBottomSection.js.map +1 -1
- package/dist/Card/VerticalCard/CardMiddleSection.cjs +19 -4
- package/dist/Card/VerticalCard/CardMiddleSection.cjs.map +1 -1
- package/dist/Card/VerticalCard/CardMiddleSection.js +19 -4
- package/dist/Card/VerticalCard/CardMiddleSection.js.map +1 -1
- package/dist/Card/VerticalCard/CardTopSection.cjs +9 -2
- package/dist/Card/VerticalCard/CardTopSection.cjs.map +1 -1
- package/dist/Card/VerticalCard/CardTopSection.js +9 -2
- package/dist/Card/VerticalCard/CardTopSection.js.map +1 -1
- package/dist/Card/__tests__/Card.test.tsx +146 -0
- package/dist/Chips/ChipStyles.cjs +4 -1
- package/dist/Chips/ChipStyles.cjs.map +1 -1
- package/dist/Chips/ChipStyles.js +4 -1
- package/dist/Chips/ChipStyles.js.map +1 -1
- package/dist/Chips/__tests__/ActionChip.test.tsx +94 -0
- package/dist/Chips/__tests__/ChoiceChips.test.tsx +79 -0
- package/dist/Chips/__tests__/FilterChip.test.tsx +95 -0
- package/dist/Chips/__tests__/InputChip.test.tsx +155 -0
- package/dist/ChipsInput/ChipInputField.cjs +16 -4
- package/dist/ChipsInput/ChipInputField.cjs.map +1 -1
- package/dist/ChipsInput/ChipInputField.js +16 -4
- package/dist/ChipsInput/ChipInputField.js.map +1 -1
- package/dist/ChipsInput/__tests__/ChipDropdownInput.test.tsx +100 -0
- package/dist/ChipsInput/__tests__/ChipInputFields.test.tsx +155 -0
- package/dist/Dropdown/BasicDropdown.cjs +12 -3
- package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
- package/dist/Dropdown/BasicDropdown.js +12 -3
- package/dist/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/Dropdown/CommonStyling.cjs +172 -42
- package/dist/Dropdown/CommonStyling.cjs.map +1 -1
- package/dist/Dropdown/CommonStyling.js +172 -42
- package/dist/Dropdown/CommonStyling.js.map +1 -1
- package/dist/Dropdown/DropdownContent.cjs +36 -10
- package/dist/Dropdown/DropdownContent.cjs.map +1 -1
- package/dist/Dropdown/DropdownContent.js +36 -10
- package/dist/Dropdown/DropdownContent.js.map +1 -1
- package/dist/Dropdown/DropdownFilter.cjs +12 -3
- package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
- package/dist/Dropdown/DropdownFilter.js +12 -3
- package/dist/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/Dropdown/__tests__/DropdownFilter.test.tsx +39 -0
- package/dist/Footer/Components/FooterNewsletterAndSocialSection.cjs +4 -1
- package/dist/Footer/Components/FooterNewsletterAndSocialSection.cjs.map +1 -1
- package/dist/Footer/Components/FooterNewsletterAndSocialSection.js +4 -1
- package/dist/Footer/Components/FooterNewsletterAndSocialSection.js.map +1 -1
- package/dist/Footer/__tests__/Footer.test.tsx +182 -0
- package/dist/GlobalNavigationBar/__tests__/GlobalNavigationBar.tests.d.ts +1 -0
- package/dist/GlobalNavigationBar/__tests__/Logo.test.tsx +39 -0
- package/dist/GlobalNavigationBar/__tests__/Logo.tests.d.ts +1 -0
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs +4 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.js +4 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/__tests__/DesktopActions.test.tsx +108 -0
- package/dist/GlobalNavigationBar/desktop/__tests__/ExtendedMainMenu.test.tsx +28 -0
- package/dist/GlobalNavigationBar/desktop/__tests__/MainMenu.test.tsx +55 -0
- package/dist/GlobalNavigationBar/desktop/__tests__/RightSideNav.test.tsx +45 -0
- package/dist/GlobalNavigationBar/desktop/__tests__/UserMenu.test.tsx +125 -0
- package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenu.test.tsx +317 -0
- package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenuContent.test.tsx +294 -0
- package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenuHeader.test.tsx +195 -0
- package/dist/HyperLink/styling.cjs +38 -8
- package/dist/HyperLink/styling.cjs.map +1 -1
- package/dist/HyperLink/styling.js +38 -8
- package/dist/HyperLink/styling.js.map +1 -1
- package/dist/InputFields/Checkbox.cjs +54 -14
- package/dist/InputFields/Checkbox.cjs.map +1 -1
- package/dist/InputFields/Checkbox.js +54 -14
- package/dist/InputFields/Checkbox.js.map +1 -1
- package/dist/InputFields/DatepickerField.cjs +149 -43
- package/dist/InputFields/DatepickerField.cjs.map +1 -1
- package/dist/InputFields/DatepickerField.d.ts +1 -1
- package/dist/InputFields/DatepickerField.js +150 -44
- package/dist/InputFields/DatepickerField.js.map +1 -1
- package/dist/InputFields/DatepickerFieldHeader.cjs +20 -5
- package/dist/InputFields/DatepickerFieldHeader.cjs.map +1 -1
- package/dist/InputFields/DatepickerFieldHeader.js +20 -5
- package/dist/InputFields/DatepickerFieldHeader.js.map +1 -1
- package/dist/InputFields/Label.cjs +38 -11
- package/dist/InputFields/Label.cjs.map +1 -1
- package/dist/InputFields/Label.js +38 -11
- package/dist/InputFields/Label.js.map +1 -1
- package/dist/InputFields/NumberField.cjs +66 -16
- package/dist/InputFields/NumberField.cjs.map +1 -1
- package/dist/InputFields/NumberField.js +66 -16
- package/dist/InputFields/NumberField.js.map +1 -1
- package/dist/InputFields/PasswordField.cjs +4 -1
- package/dist/InputFields/PasswordField.cjs.map +1 -1
- package/dist/InputFields/PasswordField.d.ts +1 -1
- package/dist/InputFields/PasswordField.js +4 -1
- package/dist/InputFields/PasswordField.js.map +1 -1
- package/dist/InputFields/QuickSearch.cjs +30 -6
- package/dist/InputFields/QuickSearch.cjs.map +1 -1
- package/dist/InputFields/QuickSearch.js +30 -6
- package/dist/InputFields/QuickSearch.js.map +1 -1
- package/dist/InputFields/RadioButton.cjs +63 -15
- package/dist/InputFields/RadioButton.cjs.map +1 -1
- package/dist/InputFields/RadioButton.js +63 -15
- package/dist/InputFields/RadioButton.js.map +1 -1
- package/dist/InputFields/RichTextField.cjs +60 -15
- package/dist/InputFields/RichTextField.cjs.map +1 -1
- package/dist/InputFields/RichTextField.js +60 -15
- package/dist/InputFields/RichTextField.js.map +1 -1
- package/dist/InputFields/SearchBar.cjs +4 -1
- package/dist/InputFields/SearchBar.cjs.map +1 -1
- package/dist/InputFields/SearchBar.js +4 -1
- package/dist/InputFields/SearchBar.js.map +1 -1
- package/dist/InputFields/TextField.cjs +9 -3
- package/dist/InputFields/TextField.cjs.map +1 -1
- package/dist/InputFields/TextField.d.ts +1 -1
- package/dist/InputFields/TextField.js +9 -3
- package/dist/InputFields/TextField.js.map +1 -1
- package/dist/InputFields/Textarea.cjs +68 -17
- package/dist/InputFields/Textarea.cjs.map +1 -1
- package/dist/InputFields/Textarea.js +68 -17
- package/dist/InputFields/Textarea.js.map +1 -1
- package/dist/InputFields/__tests__/NumberField.test.tsx +67 -0
- package/dist/InputFields/__tests__/NumberInput.test.tsx +68 -0
- package/dist/InputFields/__tests__/QuickSearch.test.tsx +42 -0
- package/dist/InputFields/components/SearchBarInput.cjs +28 -7
- package/dist/InputFields/components/SearchBarInput.cjs.map +1 -1
- package/dist/InputFields/components/SearchBarInput.js +28 -7
- package/dist/InputFields/components/SearchBarInput.js.map +1 -1
- package/dist/InputFields/components/SearchField.cjs +60 -15
- package/dist/InputFields/components/SearchField.cjs.map +1 -1
- package/dist/InputFields/components/SearchField.js +60 -15
- package/dist/InputFields/components/SearchField.js.map +1 -1
- package/dist/InputFields/styling.cjs +95 -39
- package/dist/InputFields/styling.cjs.map +1 -1
- package/dist/InputFields/styling.d.ts +1 -2
- package/dist/InputFields/styling.js +95 -39
- package/dist/InputFields/styling.js.map +1 -1
- package/dist/LinearProgress/LinearProgress.cjs +161 -53
- package/dist/LinearProgress/LinearProgress.cjs.map +1 -1
- package/dist/LinearProgress/LinearProgress.js +161 -53
- package/dist/LinearProgress/LinearProgress.js.map +1 -1
- package/dist/LinearProgress/__tests__/LinearProgress.test.tsx +25 -0
- package/dist/List/ListRow.cjs +36 -9
- package/dist/List/ListRow.cjs.map +1 -1
- package/dist/List/ListRow.js +36 -9
- package/dist/List/ListRow.js.map +1 -1
- package/dist/List/__tests__/ListRow.test.tsx +18 -0
- package/dist/List/__tests__/ListRow.tests.d.ts +1 -0
- package/dist/LoadingIndicator/LoadingIndicator.cjs +4 -1
- package/dist/LoadingIndicator/LoadingIndicator.cjs.map +1 -1
- package/dist/LoadingIndicator/LoadingIndicator.js +4 -1
- package/dist/LoadingIndicator/LoadingIndicator.js.map +1 -1
- package/dist/LoadingPage/GlobalLoadingPage.cjs +4 -1
- package/dist/LoadingPage/GlobalLoadingPage.cjs.map +1 -1
- package/dist/LoadingPage/GlobalLoadingPage.js +4 -1
- package/dist/LoadingPage/GlobalLoadingPage.js.map +1 -1
- package/dist/LoadingPage/__tests__/GlobalLoadingPage.test.tsx +23 -0
- package/dist/MenuItem/MenuItem.cjs +101 -26
- package/dist/MenuItem/MenuItem.cjs.map +1 -1
- package/dist/MenuItem/MenuItem.js +101 -26
- package/dist/MenuItem/MenuItem.js.map +1 -1
- package/dist/Modals/Modal.cjs +4 -1
- package/dist/Modals/Modal.cjs.map +1 -1
- package/dist/Modals/Modal.js +4 -1
- package/dist/Modals/Modal.js.map +1 -1
- package/dist/Modals/ModalContent.cjs +24 -6
- package/dist/Modals/ModalContent.cjs.map +1 -1
- package/dist/Modals/ModalContent.js +24 -6
- package/dist/Modals/ModalContent.js.map +1 -1
- package/dist/Modals/ModalDialog.cjs +12 -3
- package/dist/Modals/ModalDialog.cjs.map +1 -1
- package/dist/Modals/ModalDialog.js +12 -3
- package/dist/Modals/ModalDialog.js.map +1 -1
- package/dist/Modals/ModalNote.cjs +16 -4
- package/dist/Modals/ModalNote.cjs.map +1 -1
- package/dist/Modals/ModalNote.js +16 -4
- package/dist/Modals/ModalNote.js.map +1 -1
- package/dist/Modals/ModalStyles.cjs +44 -11
- package/dist/Modals/ModalStyles.cjs.map +1 -1
- package/dist/Modals/ModalStyles.js +44 -11
- package/dist/Modals/ModalStyles.js.map +1 -1
- package/dist/Modals/__tests__/Modal.test.tsx +169 -0
- package/dist/Modals/__tests__/ModalContainer.test.tsx +77 -0
- package/dist/Modals/__tests__/ModalContent.test.tsx +126 -0
- package/dist/NavItem/NavItem.cjs +4 -1
- package/dist/NavItem/NavItem.cjs.map +1 -1
- package/dist/NavItem/NavItem.js +4 -1
- package/dist/NavItem/NavItem.js.map +1 -1
- package/dist/NavItem/__tests__/NavItem.test.ts +6 -0
- package/dist/NotificationDot/NotificationDot.cjs +17 -2
- package/dist/NotificationDot/NotificationDot.cjs.map +1 -1
- package/dist/NotificationDot/NotificationDot.js +17 -2
- package/dist/NotificationDot/NotificationDot.js.map +1 -1
- package/dist/NotificationDot/__tests__/NotificationDot.test.tsx +33 -0
- package/dist/Paginator/Paginator.cjs +76 -29
- package/dist/Paginator/Paginator.cjs.map +1 -1
- package/dist/Paginator/Paginator.js +76 -29
- package/dist/Paginator/Paginator.js.map +1 -1
- package/dist/Paginator/__tests__/Paginator.test.tsx +39 -0
- package/dist/Panel/Panel.cjs +4 -1
- package/dist/Panel/Panel.cjs.map +1 -1
- package/dist/Panel/Panel.js +4 -1
- package/dist/Panel/Panel.js.map +1 -1
- package/dist/Popover/Popover.cjs +22 -3
- package/dist/Popover/Popover.cjs.map +1 -1
- package/dist/Popover/Popover.js +22 -3
- package/dist/Popover/Popover.js.map +1 -1
- package/dist/Popover/__tests__/Popover.test.tsx +64 -0
- package/dist/ProfileButton/ProfileButton.cjs +9 -2
- package/dist/ProfileButton/ProfileButton.cjs.map +1 -1
- package/dist/ProfileButton/ProfileButton.js +9 -2
- package/dist/ProfileButton/ProfileButton.js.map +1 -1
- package/dist/ProfileButton/__tests__/ProfileButton.test.tsx +31 -0
- package/dist/QuizButton/__tests__/QuizButton.test.tsx +53 -0
- package/dist/SegmentControl/SegmentControl.cjs +46 -11
- package/dist/SegmentControl/SegmentControl.cjs.map +1 -1
- package/dist/SegmentControl/SegmentControl.js +46 -11
- package/dist/SegmentControl/SegmentControl.js.map +1 -1
- package/dist/SegmentControl/__tests__/SegmentControl.test.tsx +145 -0
- package/dist/SideMenu/SideMenuHeader.cjs +12 -3
- package/dist/SideMenu/SideMenuHeader.cjs.map +1 -1
- package/dist/SideMenu/SideMenuHeader.js +12 -3
- package/dist/SideMenu/SideMenuHeader.js.map +1 -1
- package/dist/SideMenu/__tests__/SideMenu.test.tsx +99 -0
- package/dist/Switcher/SwitcherMenuItem.cjs +4 -1
- package/dist/Switcher/SwitcherMenuItem.cjs.map +1 -1
- package/dist/Switcher/SwitcherMenuItem.js +4 -1
- package/dist/Switcher/SwitcherMenuItem.js.map +1 -1
- package/dist/Switcher/__tests__/SwitcherMenuItem.tsx +14 -0
- package/dist/Table/TableFooter.cjs +8 -2
- package/dist/Table/TableFooter.cjs.map +1 -1
- package/dist/Table/TableFooter.js +8 -2
- package/dist/Table/TableFooter.js.map +1 -1
- package/dist/Table/TableStyles.cjs +132 -33
- package/dist/Table/TableStyles.cjs.map +1 -1
- package/dist/Table/TableStyles.js +132 -33
- package/dist/Table/TableStyles.js.map +1 -1
- package/dist/Table/__tests__/Table.test.tsx +499 -0
- package/dist/Tabs/HorizontalTabs.cjs +68 -18
- package/dist/Tabs/HorizontalTabs.cjs.map +1 -1
- package/dist/Tabs/HorizontalTabs.js +68 -18
- package/dist/Tabs/HorizontalTabs.js.map +1 -1
- package/dist/Tabs/TabLink.cjs +4 -1
- package/dist/Tabs/TabLink.cjs.map +1 -1
- package/dist/Tabs/TabLink.js +4 -1
- package/dist/Tabs/TabLink.js.map +1 -1
- package/dist/Tabs/__tests__/HorizontalTabs.test.tsx +95 -0
- package/dist/Tabs/__tests__/TabLink.test.tsx +40 -0
- package/dist/Tabs/__tests__/TabLink.tests.d.ts +1 -0
- package/dist/Tabs/__tests__/Tablist.test.tsx +37 -0
- package/dist/Tabs/__tests__/Tablist.tests.d.ts +2 -0
- package/dist/Tag/Tag.cjs +2 -2
- package/dist/Tag/Tag.cjs.map +1 -1
- package/dist/Tag/Tag.js +2 -2
- package/dist/Tag/Tag.js.map +1 -1
- package/dist/Tag/__tests__/Tag.test.tsx +86 -0
- package/dist/Tile/Tile.cjs +8 -2
- package/dist/Tile/Tile.cjs.map +1 -1
- package/dist/Tile/Tile.js +8 -2
- package/dist/Tile/Tile.js.map +1 -1
- package/dist/Tile/TileCommonItems.cjs +8 -2
- package/dist/Tile/TileCommonItems.cjs.map +1 -1
- package/dist/Tile/TileCommonItems.js +8 -2
- package/dist/Tile/TileCommonItems.js.map +1 -1
- package/dist/Tile/TileFooter.cjs +4 -1
- package/dist/Tile/TileFooter.cjs.map +1 -1
- package/dist/Tile/TileFooter.js +4 -1
- package/dist/Tile/TileFooter.js.map +1 -1
- package/dist/Tile/TileHeader.cjs +12 -3
- package/dist/Tile/TileHeader.cjs.map +1 -1
- package/dist/Tile/TileHeader.js +12 -3
- package/dist/Tile/TileHeader.js.map +1 -1
- package/dist/Toasters/Toast.cjs +62 -13
- package/dist/Toasters/Toast.cjs.map +1 -1
- package/dist/Toasters/Toast.js +62 -13
- package/dist/Toasters/Toast.js.map +1 -1
- package/dist/Toasters/__tests__/Toast.test.tsx +74 -0
- package/dist/Toggles/ToggleButton.cjs +9 -3
- package/dist/Toggles/ToggleButton.cjs.map +1 -1
- package/dist/Toggles/ToggleButton.d.ts +1 -1
- package/dist/Toggles/ToggleButton.js +9 -3
- package/dist/Toggles/ToggleButton.js.map +1 -1
- package/dist/Toggles/TogglerStyles.cjs +22 -8
- package/dist/Toggles/TogglerStyles.cjs.map +1 -1
- package/dist/Toggles/TogglerStyles.js +22 -8
- package/dist/Toggles/TogglerStyles.js.map +1 -1
- package/dist/Toggles/__tests__/ToggleButton.test.tsx +53 -0
- package/dist/Toggles/__tests__/ToggleSwitch.test.tsx +87 -0
- package/dist/Tooltips/TooltipStyles.cjs +28 -6
- package/dist/Tooltips/TooltipStyles.cjs.map +1 -1
- package/dist/Tooltips/TooltipStyles.js +28 -6
- package/dist/Tooltips/TooltipStyles.js.map +1 -1
- package/dist/Tooltips/__tests__/TooltipWrapper.test.tsx +16 -0
- package/dist/common/InputStyling.cjs +30 -7
- package/dist/common/InputStyling.cjs.map +1 -1
- package/dist/common/InputStyling.js +30 -7
- package/dist/common/InputStyling.js.map +1 -1
- package/dist/common/Link.cjs +45 -0
- package/dist/common/Link.cjs.map +1 -0
- package/dist/common/Link.d.ts +9 -0
- package/dist/common/Link.js +37 -0
- package/dist/common/Link.js.map +1 -0
- package/dist/common/NavigationHelper.cjs +30 -0
- package/dist/common/NavigationHelper.cjs.map +1 -0
- package/dist/common/NavigationHelper.d.ts +4 -0
- package/dist/common/NavigationHelper.js +23 -0
- package/dist/common/NavigationHelper.js.map +1 -0
- package/dist/custom.d.ts +2 -0
- package/dist/styles/colors.cjs +439 -84
- package/dist/styles/colors.cjs.map +1 -1
- package/dist/styles/colors.d.ts +200 -11
- package/dist/styles/colors.js +439 -84
- package/dist/styles/colors.js.map +1 -1
- package/dist/styles/global.cjs +19 -2
- package/dist/styles/global.cjs.map +1 -1
- package/dist/styles/global.d.ts +3 -2
- package/dist/styles/global.js +18 -3
- package/dist/styles/global.js.map +1 -1
- package/dist/styles/index.cjs +21 -9
- package/dist/styles/index.cjs.map +1 -1
- package/dist/styles/index.d.ts +2 -2
- package/dist/styles/index.js +18 -6
- package/dist/styles/index.js.map +1 -1
- package/dist/styles/react-datepicker.css +766 -0
- package/dist/utils/color-tokens.cjs +91 -0
- package/dist/utils/color-tokens.cjs.map +1 -0
- package/dist/utils/color-tokens.d.ts +19 -0
- package/dist/utils/color-tokens.js +82 -0
- package/dist/utils/color-tokens.js.map +1 -0
- package/package.json +144 -141
|
@@ -67,89 +67,151 @@ const IconButtonStyled = exports.IconButtonStyled = _styledComponents.default.bu
|
|
|
67
67
|
`;
|
|
68
68
|
const IconButtonStyledPrimary = exports.IconButtonStyledPrimary = (0, _styledComponents.default)(IconButtonStyled)`
|
|
69
69
|
${IconButtonContentStyles} {
|
|
70
|
-
background-color: ${props => props.$useTransparentBackground ? 'transparent' : _styles.COLORS.
|
|
70
|
+
background-color: ${props => props.$useTransparentBackground ? 'transparent' : _styles.COLORS.generateToken({
|
|
71
|
+
componentType: 'bg-fill',
|
|
72
|
+
defaultVariant: 'primary'
|
|
73
|
+
}, props.theme)};
|
|
71
74
|
|
|
72
75
|
svg {
|
|
73
|
-
fill: ${props => props.$iconColor || _styles.COLORS.
|
|
76
|
+
fill: ${props => props.$iconColor || _styles.COLORS.generateToken({
|
|
77
|
+
componentType: 'icon',
|
|
78
|
+
isOnFill: true,
|
|
79
|
+
defaultVariant: 'primary'
|
|
80
|
+
}, props.theme)};
|
|
74
81
|
path {
|
|
75
|
-
fill: ${props => props.$iconColor || _styles.COLORS.
|
|
82
|
+
fill: ${props => props.$iconColor || _styles.COLORS.generateToken({
|
|
83
|
+
componentType: 'icon',
|
|
84
|
+
isOnFill: true,
|
|
85
|
+
defaultVariant: 'primary'
|
|
86
|
+
}, props.theme)};
|
|
76
87
|
}
|
|
77
88
|
}
|
|
78
89
|
}
|
|
79
90
|
&:hover:not(:disabled),
|
|
80
91
|
&.hover-state {
|
|
81
92
|
${IconButtonContentStyles} {
|
|
82
|
-
background-color: ${props => _styles.COLORS.
|
|
93
|
+
background-color: ${props => _styles.COLORS.generateToken({
|
|
94
|
+
componentType: 'bg-fill',
|
|
95
|
+
state: 'hover',
|
|
96
|
+
defaultVariant: 'primary'
|
|
97
|
+
}, props.theme)};
|
|
83
98
|
}
|
|
84
99
|
${IconButtonContentStyles} svg path,
|
|
85
100
|
${IconButtonContentStyles} svg {
|
|
86
|
-
fill: ${props => _styles.COLORS.
|
|
101
|
+
fill: ${props => _styles.COLORS.generateToken({
|
|
102
|
+
componentType: 'icon',
|
|
103
|
+
isOnFill: true,
|
|
104
|
+
defaultVariant: 'primary'
|
|
105
|
+
}, props.theme)};
|
|
87
106
|
}
|
|
88
107
|
}
|
|
89
108
|
&:active:not(:disabled),
|
|
90
109
|
&.active-state {
|
|
91
110
|
${IconButtonContentStyles} {
|
|
92
|
-
background: ${props => _styles.COLORS.
|
|
111
|
+
background-color: ${props => _styles.COLORS.generateToken({
|
|
112
|
+
componentType: 'bg-fill',
|
|
113
|
+
state: 'active',
|
|
114
|
+
defaultVariant: 'primary'
|
|
115
|
+
}, props.theme)};
|
|
93
116
|
}
|
|
94
117
|
${IconButtonContentStyles} svg path,
|
|
95
118
|
${IconButtonContentStyles} svg {
|
|
96
|
-
fill: ${props => _styles.COLORS.
|
|
119
|
+
fill: ${props => _styles.COLORS.generateToken({
|
|
120
|
+
componentType: 'icon',
|
|
121
|
+
isOnFill: true,
|
|
122
|
+
defaultVariant: 'primary'
|
|
123
|
+
}, props.theme)};
|
|
97
124
|
}
|
|
98
125
|
}
|
|
99
126
|
&:disabled {
|
|
100
127
|
${IconButtonContentStyles} {
|
|
101
|
-
background-color: ${props => _styles.COLORS.
|
|
128
|
+
background-color: ${props => _styles.COLORS.generateToken({
|
|
129
|
+
componentType: 'bg-fill',
|
|
130
|
+
state: 'disabled'
|
|
131
|
+
}, props.theme)};
|
|
102
132
|
}
|
|
103
133
|
svg {
|
|
104
134
|
path {
|
|
105
|
-
fill: ${props => _styles.COLORS.
|
|
135
|
+
fill: ${props => _styles.COLORS.generateToken({
|
|
136
|
+
componentType: 'icon',
|
|
137
|
+
isOnFill: true,
|
|
138
|
+
defaultVariant: 'primary'
|
|
139
|
+
}, props.theme)};
|
|
106
140
|
}
|
|
107
|
-
fill: ${props => _styles.COLORS.
|
|
141
|
+
fill: ${props => _styles.COLORS.generateToken({
|
|
142
|
+
componentType: 'icon',
|
|
143
|
+
isOnFill: true,
|
|
144
|
+
defaultVariant: 'primary'
|
|
145
|
+
}, props.theme)};
|
|
108
146
|
}
|
|
109
147
|
}
|
|
110
148
|
`;
|
|
111
149
|
const IconButtonStyledSecondary = exports.IconButtonStyledSecondary = (0, _styledComponents.default)(IconButtonStyled)`
|
|
112
150
|
${IconButtonContentStyles} {
|
|
113
|
-
background-color:
|
|
151
|
+
background-color: transparent;
|
|
114
152
|
|
|
115
153
|
svg {
|
|
116
|
-
fill: ${props => props.$iconColor || _styles.COLORS.
|
|
154
|
+
fill: ${props => props.$iconColor || _styles.COLORS.generateToken({
|
|
155
|
+
componentType: 'icon',
|
|
156
|
+
defaultVariant: 'subtle'
|
|
157
|
+
}, props.theme)};
|
|
117
158
|
path {
|
|
118
|
-
fill: ${props => props.$iconColor || _styles.COLORS.
|
|
159
|
+
fill: ${props => props.$iconColor || _styles.COLORS.generateToken({
|
|
160
|
+
componentType: 'icon',
|
|
161
|
+
defaultVariant: 'subtle'
|
|
162
|
+
}, props.theme)};
|
|
119
163
|
}
|
|
120
164
|
}
|
|
121
165
|
}
|
|
122
166
|
|
|
123
|
-
|
|
124
167
|
&:hover:not(:disabled) {
|
|
125
168
|
${IconButtonContentStyles} {
|
|
126
|
-
background-color: ${props => _styles.COLORS.
|
|
169
|
+
background-color: ${props => _styles.COLORS.generateToken({
|
|
170
|
+
componentType: 'bg-surface',
|
|
171
|
+
state: 'hover'
|
|
172
|
+
}, props.theme)};
|
|
127
173
|
}
|
|
128
174
|
${IconButtonContentStyles} svg path,
|
|
129
175
|
${IconButtonContentStyles} svg {
|
|
130
|
-
fill: ${props => _styles.COLORS.
|
|
176
|
+
fill: ${props => _styles.COLORS.generateToken({
|
|
177
|
+
componentType: 'icon',
|
|
178
|
+
state: 'hover'
|
|
179
|
+
}, props.theme)};
|
|
131
180
|
}
|
|
132
181
|
}
|
|
182
|
+
|
|
133
183
|
&:active:not(:disabled),
|
|
134
184
|
&.active-state {
|
|
135
185
|
${IconButtonContentStyles} {
|
|
136
|
-
background: ${props => _styles.COLORS.
|
|
186
|
+
background: ${props => _styles.COLORS.generateToken({
|
|
187
|
+
componentType: 'bg-surface',
|
|
188
|
+
state: 'active'
|
|
189
|
+
}, props.theme)};
|
|
137
190
|
}
|
|
138
191
|
${IconButtonContentStyles} svg path,
|
|
139
192
|
${IconButtonContentStyles} svg {
|
|
140
|
-
fill: ${props => _styles.COLORS.
|
|
193
|
+
fill: ${props => _styles.COLORS.generateToken({
|
|
194
|
+
componentType: 'icon',
|
|
195
|
+
state: 'active'
|
|
196
|
+
}, props.theme)};
|
|
141
197
|
}
|
|
142
198
|
}
|
|
143
199
|
|
|
144
200
|
&:disabled {
|
|
145
201
|
${IconButtonContentStyles} {
|
|
146
|
-
background-color:
|
|
202
|
+
background-color: transparent;
|
|
147
203
|
}
|
|
148
204
|
svg {
|
|
149
205
|
path {
|
|
150
|
-
fill: ${props => _styles.COLORS.
|
|
206
|
+
fill: ${props => _styles.COLORS.generateToken({
|
|
207
|
+
componentType: 'icon',
|
|
208
|
+
state: 'disabled'
|
|
209
|
+
}, props.theme)};
|
|
151
210
|
}
|
|
152
|
-
fill: ${props => _styles.COLORS.
|
|
211
|
+
fill: ${props => _styles.COLORS.generateToken({
|
|
212
|
+
componentType: 'icon',
|
|
213
|
+
state: 'disabled'
|
|
214
|
+
}, props.theme)};
|
|
153
215
|
}
|
|
154
216
|
}
|
|
155
217
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Iconbutton.cjs","names":["_react","_interopRequireDefault","require","_styledComponents","_styles","_common","_TooltipWrapper","_jsxRuntime","_excluded","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","getBorderRadius","borderRadius","getBorderRadiusStyle","flatEdge","radius","IconButtonContentStyles","exports","styled","div","IconButtonStyled","button","props","$borderRadius","$flatEdge","$unsetIconSize","$invertFocus","invertedFocusStyles","focusStyles","IconButtonStyledPrimary","$useTransparentBackground","COLORS","getColor","theme","$iconColor","IconButtonStyledSecondary","IconButton","React","forwardRef","_ref","ref","id","variant","shape","action","children","useTransparentBackground","disabled","iconColor","unsetIconSize","tabIndex","type","hidden","invertFocus","dataTestId","focusOnClick","tooltip","rest","_objectWithoutProperties2","render","ButtonVariant","jsx","onClick","event","stopPropagation","onMouseDown","defaultOnMouseDownHandler","undefined","propTypes","_propTypes","oneOf","func","isRequired","bool","string","number","node","_default"],"sources":["../../src/Button/Iconbutton.tsx"],"sourcesContent":["import React from 'react';\r\nimport styled from 'styled-components';\r\n\r\nimport { BREAKPOINTS, COLORS, focusStyles, invertedFocusStyles } from '../styles';\r\nimport { defaultOnMouseDownHandler } from '../common';\r\nimport { Testable } from '../types';\r\nimport {TooltipProps} from \"../Tooltips/TooltipTypes\";\r\nimport TooltipWrapper from \"../Tooltips/TooltipWrapper\";\r\n\r\nexport interface HeaderItemProps {\r\n inMobileMenu?: boolean;\r\n useTransparentBackground?: boolean;\r\n iconColor?: string;\r\n unsetIconSize?: boolean;\r\n borderRadius?: number;\r\n shape?: string;\r\n flatEdge?: string;\r\n invertFocus?: boolean;\r\n shouldNotInteract?: boolean;\r\n}\r\n\r\nconst getBorderRadius = (borderRadius?: number) => (borderRadius ? `${borderRadius}px` : '4px');\r\n\r\nconst getBorderRadiusStyle = ( flatEdge?: string, borderRadius?: number ) => {\r\n const radius = getBorderRadius(borderRadius);\r\n switch (flatEdge) {\r\n case 'left':\r\n return `0px ${radius} ${radius} 0px`;\r\n\r\n case 'right':\r\n return `${radius} 0px 0px ${radius}`;\r\n\r\n case 'none':\r\n default:\r\n return `${radius}`;\r\n }\r\n};\r\n\r\nexport const IconButtonContentStyles = styled.div``;\r\n\r\nexport const IconButtonStyled = styled.button<{$borderRadius?: number; $flatEdge?: string; $unsetIconSize?: boolean;\r\n $invertFocus?: boolean; $useTransparentBackground?: boolean; $iconColor?: string;}>`\r\n border-width: 0;\r\n cursor: pointer;\r\n height: 48px;\r\n width: 48px;\r\n background: transparent;\r\n position: relative;\r\n display: block;\r\n\r\n border-radius: ${(props) => (props.$borderRadius ? `${props.$borderRadius}px` : '4px')};\r\n ${IconButtonContentStyles} {\r\n height: 36px;\r\n width: 36px;\r\n border-radius: ${props => getBorderRadiusStyle(props.$flatEdge, props.$borderRadius)};\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n svg {\r\n height: ${(props) => (props.$unsetIconSize ? 'unset' : '24px')};\r\n width: ${(props) => (props.$unsetIconSize ? 'unset' : '24px')};\r\n padding: 0;\r\n }\r\n }\r\n &:only-child {\r\n margin: 0;\r\n }\r\n &:disabled {\r\n cursor: not-allowed;\r\n }\r\n\r\n &:focus {\r\n ${(props) => (props.$invertFocus ? invertedFocusStyles : focusStyles)}\r\n }\r\n`;\r\n\r\nexport const IconButtonStyledPrimary = styled(IconButtonStyled)`\r\n ${IconButtonContentStyles} {\r\n background-color: ${(props) => (props.$useTransparentBackground ? 'transparent' : COLORS.getColor('primary_500', props.theme))};\r\n\r\n svg {\r\n fill: ${(props) => props.$iconColor || COLORS.getColor('white', props.theme)};\r\n path {\r\n fill: ${(props) => props.$iconColor || COLORS.getColor('white', props.theme)};\r\n }\r\n }\r\n }\r\n &:hover:not(:disabled),\r\n &.hover-state {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.getColor('primary_700', props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.getColor('white', props.theme)};\r\n }\r\n }\r\n &:active:not(:disabled),\r\n &.active-state {\r\n ${IconButtonContentStyles} {\r\n background: ${props => COLORS.getColor('primary_800', props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.getColor('white', props.theme)};\r\n }\r\n }\r\n &:disabled {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.getColor('neutral_200', props.theme)};\r\n }\r\n svg {\r\n path {\r\n fill: ${props => COLORS.getColor('white', props.theme)};\r\n }\r\n fill: ${props => COLORS.getColor('white', props.theme)};\r\n }\r\n }\r\n`;\r\n\r\nexport const IconButtonStyledSecondary = styled(IconButtonStyled)`\r\n ${IconButtonContentStyles} {\r\n background-color: ${(props) => (props.$useTransparentBackground ? 'transparent' : COLORS.getColor('white', props.theme))};\r\n\r\n svg {\r\n fill: ${(props) => props.$iconColor || COLORS.getColor('neutral_600', props.theme)};\r\n path {\r\n fill: ${(props) => props.$iconColor || COLORS.getColor('neutral_600', props.theme)};\r\n }\r\n }\r\n }\r\n\r\n\r\n &:hover:not(:disabled) {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.getColor('primary_20', props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.getColor('primary_700', props.theme)};\r\n }\r\n }\r\n &:active:not(:disabled),\r\n &.active-state {\r\n ${IconButtonContentStyles} {\r\n background: ${props => COLORS.getColor('primary_100', props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.getColor('primary_800', props.theme)};\r\n }\r\n }\r\n\r\n &:disabled {\r\n ${IconButtonContentStyles} {\r\n background-color: ${(props) => (props.$useTransparentBackground ? 'transparent' : COLORS.getColor('white', props.theme))};\r\n }\r\n svg {\r\n path {\r\n fill: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n }\r\n fill: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n }\r\n }\r\n`;\r\n\r\nexport interface IconButtonProps extends Testable, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onMouseDown'> {\r\n /** Variant of the button. Defaults to 'primary' */\r\n variant?: 'primary' | 'secondary';\r\n /** Shape of the button. Defaults to 'square' */\r\n shape?: 'square' | 'circular';\r\n /** Action that will get executed when button is clicked. */\r\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\r\n /** Allows removing rounded corners on one of the edges of the button. */\r\n flatEdge?: 'right' | 'left' | 'none' | undefined;\r\n /** If set background filling color of the button will be transparent. */\r\n useTransparentBackground?: boolean;\r\n /** Custom fill color for SVG icon. */\r\n iconColor?: string;\r\n /** If set then the width and height of SVG icon will be set to 'unset', otherwise will be set to '24px' */\r\n unsetIconSize?: boolean;\r\n /** Sets border radius of the button. */\r\n borderRadius?: number;\r\n /** Content (icon) to show in the button. */\r\n children?: React.ReactNode;\r\n /** Invert color scheme of focus framing. */\r\n invertFocus?: boolean;\r\n /** If this flag is set, then blurs current focus, as a result will focus current IconButton when user clicks it. */\r\n focusOnClick?: boolean;\r\n /** Details of the tooltip to show. */\r\n tooltip?: Omit<TooltipProps, 'tabIndex'>;\r\n}\r\n\r\nexport const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\r\n (\r\n {\r\n id,\r\n variant,\r\n shape,\r\n action,\r\n children,\r\n useTransparentBackground,\r\n disabled,\r\n iconColor,\r\n unsetIconSize,\r\n tabIndex,\r\n flatEdge,\r\n borderRadius,\r\n type,\r\n hidden,\r\n invertFocus,\r\n dataTestId,\r\n focusOnClick,\r\n tooltip,\r\n ...rest\r\n }: IconButtonProps,\r\n ref,\r\n ) => {\r\n\r\n const render = () => {\r\n // Let's render button\r\n\r\n let ButtonVariant = IconButtonStyledPrimary;\r\n switch (variant) {\r\n case 'secondary':\r\n ButtonVariant = IconButtonStyledSecondary;\r\n break;\r\n }\r\n\r\n return <ButtonVariant\r\n id={id}\r\n type={type ?? 'button'}\r\n data-testid={dataTestId}\r\n $flatEdge={flatEdge}\r\n ref={ref}\r\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\r\n event.stopPropagation();\r\n action(event);\r\n }}\r\n disabled={disabled}\r\n $useTransparentBackground={useTransparentBackground}\r\n $iconColor={iconColor}\r\n $unsetIconSize={unsetIconSize}\r\n tabIndex={tabIndex}\r\n $borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\r\n onMouseDown={!focusOnClick ? defaultOnMouseDownHandler : undefined}\r\n hidden={hidden}\r\n $invertFocus={invertFocus}\r\n {...rest}>\r\n <IconButtonContentStyles>{children}</IconButtonContentStyles>\r\n </ButtonVariant>;\r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,OAAA,CAAAkE,IAAA;EAExBzB,SAAS,EAAAqB,UAAA,CAAA9D,OAAA,CAAAmE,MAAA;EAETzB,aAAa,EAAAoB,UAAA,CAAA9D,OAAA,CAAAkE,IAAA;EAEb7D,YAAY,EAAAyD,UAAA,CAAA9D,OAAA,CAAAoE,MAAA;EAEZ9B,QAAQ,EAAAwB,UAAA,CAAA9D,OAAA,CAAAqE,IAAA;EAERvB,WAAW,EAAAgB,UAAA,CAAA9D,OAAA,CAAAkE,IAAA;EAEXlB,YAAY,EAAAc,UAAA,CAAA9D,OAAA,CAAAkE;AAAA;AAAA,IAAAI,QAAA,GAAA5D,OAAA,CAAAV,OAAA,GA2EC6B,UAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Iconbutton.cjs","names":["_react","_interopRequireDefault","require","_styledComponents","_styles","_common","_TooltipWrapper","_jsxRuntime","_excluded","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","getBorderRadius","borderRadius","getBorderRadiusStyle","flatEdge","radius","IconButtonContentStyles","exports","styled","div","IconButtonStyled","button","props","$borderRadius","$flatEdge","$unsetIconSize","$invertFocus","invertedFocusStyles","focusStyles","IconButtonStyledPrimary","$useTransparentBackground","COLORS","generateToken","componentType","defaultVariant","theme","$iconColor","isOnFill","state","IconButtonStyledSecondary","IconButton","React","forwardRef","_ref","ref","id","variant","shape","action","children","useTransparentBackground","disabled","iconColor","unsetIconSize","tabIndex","type","hidden","invertFocus","dataTestId","focusOnClick","tooltip","rest","_objectWithoutProperties2","render","ButtonVariant","jsx","onClick","event","stopPropagation","onMouseDown","defaultOnMouseDownHandler","undefined","propTypes","_propTypes","oneOf","func","isRequired","bool","string","number","node","_default"],"sources":["../../src/Button/Iconbutton.tsx"],"sourcesContent":["import React from 'react';\r\nimport styled from 'styled-components';\r\n\r\nimport { BREAKPOINTS, COLORS, focusStyles, invertedFocusStyles } from '../styles';\r\nimport { defaultOnMouseDownHandler } from '../common';\r\nimport { Testable } from '../types';\r\nimport {TooltipProps} from \"../Tooltips/TooltipTypes\";\r\nimport TooltipWrapper from \"../Tooltips/TooltipWrapper\";\r\n\r\nexport interface HeaderItemProps {\r\n inMobileMenu?: boolean;\r\n useTransparentBackground?: boolean;\r\n iconColor?: string;\r\n unsetIconSize?: boolean;\r\n borderRadius?: number;\r\n shape?: string;\r\n flatEdge?: string;\r\n invertFocus?: boolean;\r\n shouldNotInteract?: boolean;\r\n}\r\n\r\nconst getBorderRadius = (borderRadius?: number) => (borderRadius ? `${borderRadius}px` : '4px');\r\n\r\nconst getBorderRadiusStyle = ( flatEdge?: string, borderRadius?: number ) => {\r\n const radius = getBorderRadius(borderRadius);\r\n switch (flatEdge) {\r\n case 'left':\r\n return `0px ${radius} ${radius} 0px`;\r\n\r\n case 'right':\r\n return `${radius} 0px 0px ${radius}`;\r\n\r\n case 'none':\r\n default:\r\n return `${radius}`;\r\n }\r\n};\r\n\r\nexport const IconButtonContentStyles = styled.div``;\r\n\r\nexport const IconButtonStyled = styled.button<{$borderRadius?: number; $flatEdge?: string; $unsetIconSize?: boolean;\r\n $invertFocus?: boolean; $useTransparentBackground?: boolean; $iconColor?: string;}>`\r\n border-width: 0;\r\n cursor: pointer;\r\n height: 48px;\r\n width: 48px;\r\n background: transparent;\r\n position: relative;\r\n display: block;\r\n\r\n border-radius: ${(props) => (props.$borderRadius ? `${props.$borderRadius}px` : '4px')};\r\n ${IconButtonContentStyles} {\r\n height: 36px;\r\n width: 36px;\r\n border-radius: ${props => getBorderRadiusStyle(props.$flatEdge, props.$borderRadius)};\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n svg {\r\n height: ${(props) => (props.$unsetIconSize ? 'unset' : '24px')};\r\n width: ${(props) => (props.$unsetIconSize ? 'unset' : '24px')};\r\n padding: 0;\r\n }\r\n }\r\n &:only-child {\r\n margin: 0;\r\n }\r\n &:disabled {\r\n cursor: not-allowed;\r\n }\r\n\r\n &:focus {\r\n ${(props) => (props.$invertFocus ? invertedFocusStyles : focusStyles)}\r\n }\r\n`;\r\n\r\nexport const IconButtonStyledPrimary = styled(IconButtonStyled)`\r\n ${IconButtonContentStyles} {\r\n background-color: ${(props) => (props.$useTransparentBackground ? 'transparent' : COLORS.generateToken({componentType: 'bg-fill', defaultVariant: 'primary'}, props.theme))};\r\n\r\n svg {\r\n fill: ${(props) => props.$iconColor || COLORS.generateToken({ componentType: 'icon', isOnFill: true, defaultVariant: 'primary'}, props.theme)};\r\n path {\r\n fill: ${(props) => props.$iconColor || COLORS.generateToken({ componentType: 'icon', isOnFill: true, defaultVariant: 'primary'}, props.theme)};\r\n }\r\n }\r\n }\r\n &:hover:not(:disabled),\r\n &.hover-state {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.generateToken({ componentType: 'bg-fill', state: 'hover', defaultVariant: 'primary'}, props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', isOnFill: true, defaultVariant: 'primary'}, props.theme)};\r\n }\r\n }\r\n &:active:not(:disabled),\r\n &.active-state {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.generateToken({ componentType: 'bg-fill', state: 'active', defaultVariant: 'primary'}, props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', isOnFill: true, defaultVariant: 'primary'}, props.theme)};\r\n }\r\n }\r\n &:disabled {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.generateToken({ componentType: 'bg-fill', state: 'disabled' }, props.theme)};\r\n }\r\n svg {\r\n path {\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', isOnFill: true, defaultVariant: 'primary'}, props.theme)};\r\n }\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', isOnFill: true, defaultVariant: 'primary'}, props.theme)};\r\n }\r\n }\r\n`;\r\n\r\nexport const IconButtonStyledSecondary = styled(IconButtonStyled)`\r\n ${IconButtonContentStyles} {\r\n background-color: transparent;\r\n\r\n svg {\r\n fill: ${(props) => props.$iconColor || COLORS.generateToken({ componentType: 'icon', defaultVariant: 'subtle'}, props.theme)};\r\n path {\r\n fill: ${(props) => props.$iconColor || COLORS.generateToken({ componentType: 'icon', defaultVariant: 'subtle'}, props.theme)};\r\n }\r\n }\r\n }\r\n\r\n &:hover:not(:disabled) {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.generateToken({ componentType: 'bg-surface', state: 'hover' }, props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', state: 'hover' }, props.theme)};\r\n }\r\n }\r\n\r\n &:active:not(:disabled),\r\n &.active-state {\r\n ${IconButtonContentStyles} {\r\n background: ${props => COLORS.generateToken({ componentType: 'bg-surface', state: 'active' }, props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', state: 'active' }, props.theme)};\r\n }\r\n }\r\n\r\n &:disabled {\r\n ${IconButtonContentStyles} {\r\n background-color: transparent;\r\n }\r\n svg {\r\n path {\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', state: 'disabled' }, props.theme)};\r\n }\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', state: 'disabled' }, props.theme)};\r\n }\r\n }\r\n`;\r\n\r\nexport interface IconButtonProps extends Testable, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onMouseDown'> {\r\n /** Variant of the button. Defaults to 'primary' */\r\n variant?: 'primary' | 'secondary';\r\n /** Shape of the button. Defaults to 'square' */\r\n shape?: 'square' | 'circular';\r\n /** Action that will get executed when button is clicked. */\r\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\r\n /** Allows removing rounded corners on one of the edges of the button. */\r\n flatEdge?: 'right' | 'left' | 'none' | undefined;\r\n /** If set background filling color of the button will be transparent. */\r\n useTransparentBackground?: boolean;\r\n /** Custom fill color for SVG icon. */\r\n iconColor?: string;\r\n /** If set then the width and height of SVG icon will be set to 'unset', otherwise will be set to '24px' */\r\n unsetIconSize?: boolean;\r\n /** Sets border radius of the button. */\r\n borderRadius?: number;\r\n /** Content (icon) to show in the button. */\r\n children?: React.ReactNode;\r\n /** Invert color scheme of focus framing. */\r\n invertFocus?: boolean;\r\n /** If this flag is set, then blurs current focus, as a result will focus current IconButton when user clicks it. */\r\n focusOnClick?: boolean;\r\n /** Details of the tooltip to show. */\r\n tooltip?: Omit<TooltipProps, 'tabIndex'>;\r\n}\r\n\r\nexport const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\r\n (\r\n {\r\n id,\r\n variant,\r\n shape,\r\n action,\r\n children,\r\n useTransparentBackground,\r\n disabled,\r\n iconColor,\r\n unsetIconSize,\r\n tabIndex,\r\n flatEdge,\r\n borderRadius,\r\n type,\r\n hidden,\r\n invertFocus,\r\n dataTestId,\r\n focusOnClick,\r\n tooltip,\r\n ...rest\r\n }: IconButtonProps,\r\n ref,\r\n ) => {\r\n\r\n const render = () => {\r\n // Let's render button\r\n\r\n let ButtonVariant = IconButtonStyledPrimary;\r\n switch (variant) {\r\n case 'secondary':\r\n ButtonVariant = IconButtonStyledSecondary;\r\n break;\r\n }\r\n\r\n return <ButtonVariant\r\n id={id}\r\n type={type ?? 'button'}\r\n data-testid={dataTestId}\r\n $flatEdge={flatEdge}\r\n ref={ref}\r\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\r\n event.stopPropagation();\r\n action(event);\r\n }}\r\n disabled={disabled}\r\n $useTransparentBackground={useTransparentBackground}\r\n $iconColor={iconColor}\r\n $unsetIconSize={unsetIconSize}\r\n tabIndex={tabIndex}\r\n $borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\r\n onMouseDown={!focusOnClick ? defaultOnMouseDownHandler : undefined}\r\n hidden={hidden}\r\n $invertFocus={invertFocus}\r\n {...rest}>\r\n <IconButtonContentStyles>{children}</IconButtonContentStyles>\r\n </ButtonVariant>;\r\n }\r\n\r\n return !tooltip\r\n ? render()\r\n : (\r\n <TooltipWrapper {...tooltip}>\r\n {render()}\r\n </TooltipWrapper>\r\n );\r\n },\r\n);\r\n\r\nexport default IconButton;\r\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAGA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAwD,IAAAK,WAAA,GAAAL,OAAA;AAAA,MAAAM,SAAA;AAAA,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,QAAAe,gBAAA,CAAA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EAEZ9B,QAAQ,EAAAwB,UAAA,CAAAlE,OAAA,CAAAyE,IAAA;EAERvB,WAAW,EAAAgB,UAAA,CAAAlE,OAAA,CAAAsE,IAAA;EAEXlB,YAAY,EAAAc,UAAA,CAAAlE,OAAA,CAAAsE;AAAA;AAAA,IAAAI,QAAA,GAAAhE,OAAA,CAAAV,OAAA,GA2ECiC,UAAU","ignoreList":[]}
|
|
@@ -60,89 +60,151 @@ export const IconButtonStyled = styled.button`
|
|
|
60
60
|
`;
|
|
61
61
|
export const IconButtonStyledPrimary = styled(IconButtonStyled)`
|
|
62
62
|
${IconButtonContentStyles} {
|
|
63
|
-
background-color: ${props => props.$useTransparentBackground ? 'transparent' : COLORS.
|
|
63
|
+
background-color: ${props => props.$useTransparentBackground ? 'transparent' : COLORS.generateToken({
|
|
64
|
+
componentType: 'bg-fill',
|
|
65
|
+
defaultVariant: 'primary'
|
|
66
|
+
}, props.theme)};
|
|
64
67
|
|
|
65
68
|
svg {
|
|
66
|
-
fill: ${props => props.$iconColor || COLORS.
|
|
69
|
+
fill: ${props => props.$iconColor || COLORS.generateToken({
|
|
70
|
+
componentType: 'icon',
|
|
71
|
+
isOnFill: true,
|
|
72
|
+
defaultVariant: 'primary'
|
|
73
|
+
}, props.theme)};
|
|
67
74
|
path {
|
|
68
|
-
fill: ${props => props.$iconColor || COLORS.
|
|
75
|
+
fill: ${props => props.$iconColor || COLORS.generateToken({
|
|
76
|
+
componentType: 'icon',
|
|
77
|
+
isOnFill: true,
|
|
78
|
+
defaultVariant: 'primary'
|
|
79
|
+
}, props.theme)};
|
|
69
80
|
}
|
|
70
81
|
}
|
|
71
82
|
}
|
|
72
83
|
&:hover:not(:disabled),
|
|
73
84
|
&.hover-state {
|
|
74
85
|
${IconButtonContentStyles} {
|
|
75
|
-
background-color: ${props => COLORS.
|
|
86
|
+
background-color: ${props => COLORS.generateToken({
|
|
87
|
+
componentType: 'bg-fill',
|
|
88
|
+
state: 'hover',
|
|
89
|
+
defaultVariant: 'primary'
|
|
90
|
+
}, props.theme)};
|
|
76
91
|
}
|
|
77
92
|
${IconButtonContentStyles} svg path,
|
|
78
93
|
${IconButtonContentStyles} svg {
|
|
79
|
-
fill: ${props => COLORS.
|
|
94
|
+
fill: ${props => COLORS.generateToken({
|
|
95
|
+
componentType: 'icon',
|
|
96
|
+
isOnFill: true,
|
|
97
|
+
defaultVariant: 'primary'
|
|
98
|
+
}, props.theme)};
|
|
80
99
|
}
|
|
81
100
|
}
|
|
82
101
|
&:active:not(:disabled),
|
|
83
102
|
&.active-state {
|
|
84
103
|
${IconButtonContentStyles} {
|
|
85
|
-
background: ${props => COLORS.
|
|
104
|
+
background-color: ${props => COLORS.generateToken({
|
|
105
|
+
componentType: 'bg-fill',
|
|
106
|
+
state: 'active',
|
|
107
|
+
defaultVariant: 'primary'
|
|
108
|
+
}, props.theme)};
|
|
86
109
|
}
|
|
87
110
|
${IconButtonContentStyles} svg path,
|
|
88
111
|
${IconButtonContentStyles} svg {
|
|
89
|
-
fill: ${props => COLORS.
|
|
112
|
+
fill: ${props => COLORS.generateToken({
|
|
113
|
+
componentType: 'icon',
|
|
114
|
+
isOnFill: true,
|
|
115
|
+
defaultVariant: 'primary'
|
|
116
|
+
}, props.theme)};
|
|
90
117
|
}
|
|
91
118
|
}
|
|
92
119
|
&:disabled {
|
|
93
120
|
${IconButtonContentStyles} {
|
|
94
|
-
background-color: ${props => COLORS.
|
|
121
|
+
background-color: ${props => COLORS.generateToken({
|
|
122
|
+
componentType: 'bg-fill',
|
|
123
|
+
state: 'disabled'
|
|
124
|
+
}, props.theme)};
|
|
95
125
|
}
|
|
96
126
|
svg {
|
|
97
127
|
path {
|
|
98
|
-
fill: ${props => COLORS.
|
|
128
|
+
fill: ${props => COLORS.generateToken({
|
|
129
|
+
componentType: 'icon',
|
|
130
|
+
isOnFill: true,
|
|
131
|
+
defaultVariant: 'primary'
|
|
132
|
+
}, props.theme)};
|
|
99
133
|
}
|
|
100
|
-
fill: ${props => COLORS.
|
|
134
|
+
fill: ${props => COLORS.generateToken({
|
|
135
|
+
componentType: 'icon',
|
|
136
|
+
isOnFill: true,
|
|
137
|
+
defaultVariant: 'primary'
|
|
138
|
+
}, props.theme)};
|
|
101
139
|
}
|
|
102
140
|
}
|
|
103
141
|
`;
|
|
104
142
|
export const IconButtonStyledSecondary = styled(IconButtonStyled)`
|
|
105
143
|
${IconButtonContentStyles} {
|
|
106
|
-
background-color:
|
|
144
|
+
background-color: transparent;
|
|
107
145
|
|
|
108
146
|
svg {
|
|
109
|
-
fill: ${props => props.$iconColor || COLORS.
|
|
147
|
+
fill: ${props => props.$iconColor || COLORS.generateToken({
|
|
148
|
+
componentType: 'icon',
|
|
149
|
+
defaultVariant: 'subtle'
|
|
150
|
+
}, props.theme)};
|
|
110
151
|
path {
|
|
111
|
-
fill: ${props => props.$iconColor || COLORS.
|
|
152
|
+
fill: ${props => props.$iconColor || COLORS.generateToken({
|
|
153
|
+
componentType: 'icon',
|
|
154
|
+
defaultVariant: 'subtle'
|
|
155
|
+
}, props.theme)};
|
|
112
156
|
}
|
|
113
157
|
}
|
|
114
158
|
}
|
|
115
159
|
|
|
116
|
-
|
|
117
160
|
&:hover:not(:disabled) {
|
|
118
161
|
${IconButtonContentStyles} {
|
|
119
|
-
background-color: ${props => COLORS.
|
|
162
|
+
background-color: ${props => COLORS.generateToken({
|
|
163
|
+
componentType: 'bg-surface',
|
|
164
|
+
state: 'hover'
|
|
165
|
+
}, props.theme)};
|
|
120
166
|
}
|
|
121
167
|
${IconButtonContentStyles} svg path,
|
|
122
168
|
${IconButtonContentStyles} svg {
|
|
123
|
-
fill: ${props => COLORS.
|
|
169
|
+
fill: ${props => COLORS.generateToken({
|
|
170
|
+
componentType: 'icon',
|
|
171
|
+
state: 'hover'
|
|
172
|
+
}, props.theme)};
|
|
124
173
|
}
|
|
125
174
|
}
|
|
175
|
+
|
|
126
176
|
&:active:not(:disabled),
|
|
127
177
|
&.active-state {
|
|
128
178
|
${IconButtonContentStyles} {
|
|
129
|
-
background: ${props => COLORS.
|
|
179
|
+
background: ${props => COLORS.generateToken({
|
|
180
|
+
componentType: 'bg-surface',
|
|
181
|
+
state: 'active'
|
|
182
|
+
}, props.theme)};
|
|
130
183
|
}
|
|
131
184
|
${IconButtonContentStyles} svg path,
|
|
132
185
|
${IconButtonContentStyles} svg {
|
|
133
|
-
fill: ${props => COLORS.
|
|
186
|
+
fill: ${props => COLORS.generateToken({
|
|
187
|
+
componentType: 'icon',
|
|
188
|
+
state: 'active'
|
|
189
|
+
}, props.theme)};
|
|
134
190
|
}
|
|
135
191
|
}
|
|
136
192
|
|
|
137
193
|
&:disabled {
|
|
138
194
|
${IconButtonContentStyles} {
|
|
139
|
-
background-color:
|
|
195
|
+
background-color: transparent;
|
|
140
196
|
}
|
|
141
197
|
svg {
|
|
142
198
|
path {
|
|
143
|
-
fill: ${props => COLORS.
|
|
199
|
+
fill: ${props => COLORS.generateToken({
|
|
200
|
+
componentType: 'icon',
|
|
201
|
+
state: 'disabled'
|
|
202
|
+
}, props.theme)};
|
|
144
203
|
}
|
|
145
|
-
fill: ${props => COLORS.
|
|
204
|
+
fill: ${props => COLORS.generateToken({
|
|
205
|
+
componentType: 'icon',
|
|
206
|
+
state: 'disabled'
|
|
207
|
+
}, props.theme)};
|
|
146
208
|
}
|
|
147
209
|
}
|
|
148
210
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Iconbutton.js","names":["React","styled","COLORS","focusStyles","invertedFocusStyles","defaultOnMouseDownHandler","TooltipWrapper","jsx","_jsx","getBorderRadius","borderRadius","getBorderRadiusStyle","flatEdge","radius","IconButtonContentStyles","div","IconButtonStyled","button","props","$borderRadius","$flatEdge","$unsetIconSize","$invertFocus","IconButtonStyledPrimary","$useTransparentBackground","getColor","theme","$iconColor","IconButtonStyledSecondary","IconButton","forwardRef","_ref","ref","id","variant","shape","action","children","useTransparentBackground","disabled","iconColor","unsetIconSize","tabIndex","type","hidden","invertFocus","dataTestId","focusOnClick","tooltip","rest","_objectWithoutProperties","_excluded","render","ButtonVariant","_objectSpread","onClick","event","stopPropagation","onMouseDown","undefined","propTypes","_pt","oneOf","func","isRequired","bool","string","number","node"],"sources":["../../src/Button/Iconbutton.tsx"],"sourcesContent":["import React from 'react';\r\nimport styled from 'styled-components';\r\n\r\nimport { BREAKPOINTS, COLORS, focusStyles, invertedFocusStyles } from '../styles';\r\nimport { defaultOnMouseDownHandler } from '../common';\r\nimport { Testable } from '../types';\r\nimport {TooltipProps} from \"../Tooltips/TooltipTypes\";\r\nimport TooltipWrapper from \"../Tooltips/TooltipWrapper\";\r\n\r\nexport interface HeaderItemProps {\r\n inMobileMenu?: boolean;\r\n useTransparentBackground?: boolean;\r\n iconColor?: string;\r\n unsetIconSize?: boolean;\r\n borderRadius?: number;\r\n shape?: string;\r\n flatEdge?: string;\r\n invertFocus?: boolean;\r\n shouldNotInteract?: boolean;\r\n}\r\n\r\nconst getBorderRadius = (borderRadius?: number) => (borderRadius ? `${borderRadius}px` : '4px');\r\n\r\nconst getBorderRadiusStyle = ( flatEdge?: string, borderRadius?: number ) => {\r\n const radius = getBorderRadius(borderRadius);\r\n switch (flatEdge) {\r\n case 'left':\r\n return `0px ${radius} ${radius} 0px`;\r\n\r\n case 'right':\r\n return `${radius} 0px 0px ${radius}`;\r\n\r\n case 'none':\r\n default:\r\n return `${radius}`;\r\n }\r\n};\r\n\r\nexport const IconButtonContentStyles = styled.div``;\r\n\r\nexport const IconButtonStyled = styled.button<{$borderRadius?: number; $flatEdge?: string; $unsetIconSize?: boolean;\r\n $invertFocus?: boolean; $useTransparentBackground?: boolean; $iconColor?: string;}>`\r\n border-width: 0;\r\n cursor: pointer;\r\n height: 48px;\r\n width: 48px;\r\n background: transparent;\r\n position: relative;\r\n display: block;\r\n\r\n border-radius: ${(props) => (props.$borderRadius ? `${props.$borderRadius}px` : '4px')};\r\n ${IconButtonContentStyles} {\r\n height: 36px;\r\n width: 36px;\r\n border-radius: ${props => getBorderRadiusStyle(props.$flatEdge, props.$borderRadius)};\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n svg {\r\n height: ${(props) => (props.$unsetIconSize ? 'unset' : '24px')};\r\n width: ${(props) => (props.$unsetIconSize ? 'unset' : '24px')};\r\n padding: 0;\r\n }\r\n }\r\n &:only-child {\r\n margin: 0;\r\n }\r\n &:disabled {\r\n cursor: not-allowed;\r\n }\r\n\r\n &:focus {\r\n ${(props) => (props.$invertFocus ? invertedFocusStyles : focusStyles)}\r\n }\r\n`;\r\n\r\nexport const IconButtonStyledPrimary = styled(IconButtonStyled)`\r\n ${IconButtonContentStyles} {\r\n background-color: ${(props) => (props.$useTransparentBackground ? 'transparent' : COLORS.getColor('primary_500', props.theme))};\r\n\r\n svg {\r\n fill: ${(props) => props.$iconColor || COLORS.getColor('white', props.theme)};\r\n path {\r\n fill: ${(props) => props.$iconColor || COLORS.getColor('white', props.theme)};\r\n }\r\n }\r\n }\r\n &:hover:not(:disabled),\r\n &.hover-state {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.getColor('primary_700', props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.getColor('white', props.theme)};\r\n }\r\n }\r\n &:active:not(:disabled),\r\n &.active-state {\r\n ${IconButtonContentStyles} {\r\n background: ${props => COLORS.getColor('primary_800', props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.getColor('white', props.theme)};\r\n }\r\n }\r\n &:disabled {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.getColor('neutral_200', props.theme)};\r\n }\r\n svg {\r\n path {\r\n fill: ${props => COLORS.getColor('white', props.theme)};\r\n }\r\n fill: ${props => COLORS.getColor('white', props.theme)};\r\n }\r\n }\r\n`;\r\n\r\nexport const IconButtonStyledSecondary = styled(IconButtonStyled)`\r\n ${IconButtonContentStyles} {\r\n background-color: ${(props) => (props.$useTransparentBackground ? 'transparent' : COLORS.getColor('white', props.theme))};\r\n\r\n svg {\r\n fill: ${(props) => props.$iconColor || COLORS.getColor('neutral_600', props.theme)};\r\n path {\r\n fill: ${(props) => props.$iconColor || COLORS.getColor('neutral_600', props.theme)};\r\n }\r\n }\r\n }\r\n\r\n\r\n &:hover:not(:disabled) {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.getColor('primary_20', props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.getColor('primary_700', props.theme)};\r\n }\r\n }\r\n &:active:not(:disabled),\r\n &.active-state {\r\n ${IconButtonContentStyles} {\r\n background: ${props => COLORS.getColor('primary_100', props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.getColor('primary_800', props.theme)};\r\n }\r\n }\r\n\r\n &:disabled {\r\n ${IconButtonContentStyles} {\r\n background-color: ${(props) => (props.$useTransparentBackground ? 'transparent' : COLORS.getColor('white', props.theme))};\r\n }\r\n svg {\r\n path {\r\n fill: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n }\r\n fill: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n }\r\n }\r\n`;\r\n\r\nexport interface IconButtonProps extends Testable, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onMouseDown'> {\r\n /** Variant of the button. Defaults to 'primary' */\r\n variant?: 'primary' | 'secondary';\r\n /** Shape of the button. Defaults to 'square' */\r\n shape?: 'square' | 'circular';\r\n /** Action that will get executed when button is clicked. */\r\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\r\n /** Allows removing rounded corners on one of the edges of the button. */\r\n flatEdge?: 'right' | 'left' | 'none' | undefined;\r\n /** If set background filling color of the button will be transparent. */\r\n useTransparentBackground?: boolean;\r\n /** Custom fill color for SVG icon. */\r\n iconColor?: string;\r\n /** If set then the width and height of SVG icon will be set to 'unset', otherwise will be set to '24px' */\r\n unsetIconSize?: boolean;\r\n /** Sets border radius of the button. */\r\n borderRadius?: number;\r\n /** Content (icon) to show in the button. */\r\n children?: React.ReactNode;\r\n /** Invert color scheme of focus framing. */\r\n invertFocus?: boolean;\r\n /** If this flag is set, then blurs current focus, as a result will focus current IconButton when user clicks it. */\r\n focusOnClick?: boolean;\r\n /** Details of the tooltip to show. */\r\n tooltip?: Omit<TooltipProps, 'tabIndex'>;\r\n}\r\n\r\nexport const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\r\n (\r\n {\r\n id,\r\n variant,\r\n shape,\r\n action,\r\n children,\r\n useTransparentBackground,\r\n disabled,\r\n iconColor,\r\n unsetIconSize,\r\n tabIndex,\r\n flatEdge,\r\n borderRadius,\r\n type,\r\n hidden,\r\n invertFocus,\r\n dataTestId,\r\n focusOnClick,\r\n tooltip,\r\n ...rest\r\n }: IconButtonProps,\r\n ref,\r\n ) => {\r\n\r\n const render = () => {\r\n // Let's render button\r\n\r\n let ButtonVariant = IconButtonStyledPrimary;\r\n switch (variant) {\r\n case 'secondary':\r\n ButtonVariant = IconButtonStyledSecondary;\r\n break;\r\n }\r\n\r\n return <ButtonVariant\r\n id={id}\r\n type={type ?? 'button'}\r\n data-testid={dataTestId}\r\n $flatEdge={flatEdge}\r\n ref={ref}\r\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\r\n event.stopPropagation();\r\n action(event);\r\n }}\r\n disabled={disabled}\r\n $useTransparentBackground={useTransparentBackground}\r\n $iconColor={iconColor}\r\n $unsetIconSize={unsetIconSize}\r\n tabIndex={tabIndex}\r\n $borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\r\n onMouseDown={!focusOnClick ? defaultOnMouseDownHandler : undefined}\r\n hidden={hidden}\r\n $invertFocus={invertFocus}\r\n {...rest}>\r\n <IconButtonContentStyles>{children}</IconButtonContentStyles>\r\n </ButtonVariant>;\r\n }\r\n\r\n return !tooltip\r\n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zB,aAAa,EAAAoB,GAAA,CAAAI,IAAA;EAEbvD,YAAY,EAAAmD,GAAA,CAAAM,MAAA;EAEZ9B,QAAQ,EAAAwB,GAAA,CAAAO,IAAA;EAERvB,WAAW,EAAAgB,GAAA,CAAAI,IAAA;EAEXlB,YAAY,EAAAc,GAAA,CAAAI;AAAA;AA2Ed,eAAepC,UAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Iconbutton.js","names":["React","styled","COLORS","focusStyles","invertedFocusStyles","defaultOnMouseDownHandler","TooltipWrapper","jsx","_jsx","getBorderRadius","borderRadius","getBorderRadiusStyle","flatEdge","radius","IconButtonContentStyles","div","IconButtonStyled","button","props","$borderRadius","$flatEdge","$unsetIconSize","$invertFocus","IconButtonStyledPrimary","$useTransparentBackground","generateToken","componentType","defaultVariant","theme","$iconColor","isOnFill","state","IconButtonStyledSecondary","IconButton","forwardRef","_ref","ref","id","variant","shape","action","children","useTransparentBackground","disabled","iconColor","unsetIconSize","tabIndex","type","hidden","invertFocus","dataTestId","focusOnClick","tooltip","rest","_objectWithoutProperties","_excluded","render","ButtonVariant","_objectSpread","onClick","event","stopPropagation","onMouseDown","undefined","propTypes","_pt","oneOf","func","isRequired","bool","string","number","node"],"sources":["../../src/Button/Iconbutton.tsx"],"sourcesContent":["import React from 'react';\r\nimport styled from 'styled-components';\r\n\r\nimport { BREAKPOINTS, COLORS, focusStyles, invertedFocusStyles } from '../styles';\r\nimport { defaultOnMouseDownHandler } from '../common';\r\nimport { Testable } from '../types';\r\nimport {TooltipProps} from \"../Tooltips/TooltipTypes\";\r\nimport TooltipWrapper from \"../Tooltips/TooltipWrapper\";\r\n\r\nexport interface HeaderItemProps {\r\n inMobileMenu?: boolean;\r\n useTransparentBackground?: boolean;\r\n iconColor?: string;\r\n unsetIconSize?: boolean;\r\n borderRadius?: number;\r\n shape?: string;\r\n flatEdge?: string;\r\n invertFocus?: boolean;\r\n shouldNotInteract?: boolean;\r\n}\r\n\r\nconst getBorderRadius = (borderRadius?: number) => (borderRadius ? `${borderRadius}px` : '4px');\r\n\r\nconst getBorderRadiusStyle = ( flatEdge?: string, borderRadius?: number ) => {\r\n const radius = getBorderRadius(borderRadius);\r\n switch (flatEdge) {\r\n case 'left':\r\n return `0px ${radius} ${radius} 0px`;\r\n\r\n case 'right':\r\n return `${radius} 0px 0px ${radius}`;\r\n\r\n case 'none':\r\n default:\r\n return `${radius}`;\r\n }\r\n};\r\n\r\nexport const IconButtonContentStyles = styled.div``;\r\n\r\nexport const IconButtonStyled = styled.button<{$borderRadius?: number; $flatEdge?: string; $unsetIconSize?: boolean;\r\n $invertFocus?: boolean; $useTransparentBackground?: boolean; $iconColor?: string;}>`\r\n border-width: 0;\r\n cursor: pointer;\r\n height: 48px;\r\n width: 48px;\r\n background: transparent;\r\n position: relative;\r\n display: block;\r\n\r\n border-radius: ${(props) => (props.$borderRadius ? `${props.$borderRadius}px` : '4px')};\r\n ${IconButtonContentStyles} {\r\n height: 36px;\r\n width: 36px;\r\n border-radius: ${props => getBorderRadiusStyle(props.$flatEdge, props.$borderRadius)};\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n svg {\r\n height: ${(props) => (props.$unsetIconSize ? 'unset' : '24px')};\r\n width: ${(props) => (props.$unsetIconSize ? 'unset' : '24px')};\r\n padding: 0;\r\n }\r\n }\r\n &:only-child {\r\n margin: 0;\r\n }\r\n &:disabled {\r\n cursor: not-allowed;\r\n }\r\n\r\n &:focus {\r\n ${(props) => (props.$invertFocus ? invertedFocusStyles : focusStyles)}\r\n }\r\n`;\r\n\r\nexport const IconButtonStyledPrimary = styled(IconButtonStyled)`\r\n ${IconButtonContentStyles} {\r\n background-color: ${(props) => (props.$useTransparentBackground ? 'transparent' : COLORS.generateToken({componentType: 'bg-fill', defaultVariant: 'primary'}, props.theme))};\r\n\r\n svg {\r\n fill: ${(props) => props.$iconColor || COLORS.generateToken({ componentType: 'icon', isOnFill: true, defaultVariant: 'primary'}, props.theme)};\r\n path {\r\n fill: ${(props) => props.$iconColor || COLORS.generateToken({ componentType: 'icon', isOnFill: true, defaultVariant: 'primary'}, props.theme)};\r\n }\r\n }\r\n }\r\n &:hover:not(:disabled),\r\n &.hover-state {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.generateToken({ componentType: 'bg-fill', state: 'hover', defaultVariant: 'primary'}, props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', isOnFill: true, defaultVariant: 'primary'}, props.theme)};\r\n }\r\n }\r\n &:active:not(:disabled),\r\n &.active-state {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.generateToken({ componentType: 'bg-fill', state: 'active', defaultVariant: 'primary'}, props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', isOnFill: true, defaultVariant: 'primary'}, props.theme)};\r\n }\r\n }\r\n &:disabled {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.generateToken({ componentType: 'bg-fill', state: 'disabled' }, props.theme)};\r\n }\r\n svg {\r\n path {\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', isOnFill: true, defaultVariant: 'primary'}, props.theme)};\r\n }\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', isOnFill: true, defaultVariant: 'primary'}, props.theme)};\r\n }\r\n }\r\n`;\r\n\r\nexport const IconButtonStyledSecondary = styled(IconButtonStyled)`\r\n ${IconButtonContentStyles} {\r\n background-color: transparent;\r\n\r\n svg {\r\n fill: ${(props) => props.$iconColor || COLORS.generateToken({ componentType: 'icon', defaultVariant: 'subtle'}, props.theme)};\r\n path {\r\n fill: ${(props) => props.$iconColor || COLORS.generateToken({ componentType: 'icon', defaultVariant: 'subtle'}, props.theme)};\r\n }\r\n }\r\n }\r\n\r\n &:hover:not(:disabled) {\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.generateToken({ componentType: 'bg-surface', state: 'hover' }, props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', state: 'hover' }, props.theme)};\r\n }\r\n }\r\n\r\n &:active:not(:disabled),\r\n &.active-state {\r\n ${IconButtonContentStyles} {\r\n background: ${props => COLORS.generateToken({ componentType: 'bg-surface', state: 'active' }, props.theme)};\r\n }\r\n ${IconButtonContentStyles} svg path,\r\n ${IconButtonContentStyles} svg {\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', state: 'active' }, props.theme)};\r\n }\r\n }\r\n\r\n &:disabled {\r\n ${IconButtonContentStyles} {\r\n background-color: transparent;\r\n }\r\n svg {\r\n path {\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', state: 'disabled' }, props.theme)};\r\n }\r\n fill: ${props => COLORS.generateToken({ componentType: 'icon', state: 'disabled' }, props.theme)};\r\n }\r\n }\r\n`;\r\n\r\nexport interface IconButtonProps extends Testable, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onMouseDown'> {\r\n /** Variant of the button. Defaults to 'primary' */\r\n variant?: 'primary' | 'secondary';\r\n /** Shape of the button. Defaults to 'square' */\r\n shape?: 'square' | 'circular';\r\n /** Action that will get executed when button is clicked. */\r\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\r\n /** Allows removing rounded corners on one of the edges of the button. */\r\n flatEdge?: 'right' | 'left' | 'none' | undefined;\r\n /** If set background filling color of the button will be transparent. */\r\n useTransparentBackground?: boolean;\r\n /** Custom fill color for SVG icon. */\r\n iconColor?: string;\r\n /** If set then the width and height of SVG icon will be set to 'unset', otherwise will be set to '24px' */\r\n unsetIconSize?: boolean;\r\n /** Sets border radius of the button. */\r\n borderRadius?: number;\r\n /** Content (icon) to show in the button. */\r\n children?: React.ReactNode;\r\n /** Invert color scheme of focus framing. */\r\n invertFocus?: boolean;\r\n /** If this flag is set, then blurs current focus, as a result will focus current IconButton when user clicks it. */\r\n focusOnClick?: boolean;\r\n /** Details of the tooltip to show. */\r\n tooltip?: Omit<TooltipProps, 'tabIndex'>;\r\n}\r\n\r\nexport const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\r\n (\r\n {\r\n id,\r\n variant,\r\n shape,\r\n action,\r\n children,\r\n useTransparentBackground,\r\n disabled,\r\n iconColor,\r\n unsetIconSize,\r\n tabIndex,\r\n flatEdge,\r\n borderRadius,\r\n type,\r\n hidden,\r\n invertFocus,\r\n dataTestId,\r\n focusOnClick,\r\n tooltip,\r\n ...rest\r\n }: IconButtonProps,\r\n ref,\r\n ) => {\r\n\r\n const render = () => {\r\n // Let's render button\r\n\r\n let ButtonVariant = IconButtonStyledPrimary;\r\n switch (variant) {\r\n case 'secondary':\r\n ButtonVariant = IconButtonStyledSecondary;\r\n break;\r\n }\r\n\r\n return <ButtonVariant\r\n id={id}\r\n type={type ?? 'button'}\r\n data-testid={dataTestId}\r\n $flatEdge={flatEdge}\r\n ref={ref}\r\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\r\n event.stopPropagation();\r\n action(event);\r\n }}\r\n disabled={disabled}\r\n $useTransparentBackground={useTransparentBackground}\r\n $iconColor={iconColor}\r\n $unsetIconSize={unsetIconSize}\r\n tabIndex={tabIndex}\r\n $borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\r\n onMouseDown={!focusOnClick ? defaultOnMouseDownHandler : undefined}\r\n hidden={hidden}\r\n $invertFocus={invertFocus}\r\n {...rest}>\r\n <IconButtonContentStyles>{children}</IconButtonContentStyles>\r\n </ButtonVariant>;\r\n }\r\n\r\n return !tooltip\r\n ? render()\r\n : (\r\n <TooltipWrapper {...tooltip}>\r\n {render()}\r\n </TooltipWrapper>\r\n );\r\n },\r\n);\r\n\r\nexport default IconButton;\r\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,MAAM,MAAM,mBAAmB;A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ACtBI,IAAI;MAAAZ,QAAA,eACRjC,IAAA,CAACM,uBAAuB;QAAA2B,QAAA,EAAEA;MAAQ,CAA0B;IAAC,EAChD,CAAC;EAClB,CAAC;EAEH,OAAO,CAACW,OAAO,GACXI,MAAM,CAAC,CAAC,gBAERhD,IAAA,CAACF,cAAc,EAAAoD,aAAA,CAAAA,aAAA,KAAKN,OAAO;IAAAX,QAAA,EACxBe,MAAM,CAAC;EAAC,EACK,CACjB;AACL,CACF,CAAC;AAACvB,UAAA,CAAA+B,SAAA;EA7FA1B,OAAO,EAAA2B,GAAA,CAAAC,KAAA,EAAG,SAAS,EAAG,WAAW;EAEjC3B,KAAK,EAAA0B,GAAA,CAAAC,KAAA,EAAG,QAAQ,EAAG,UAAU;EAE7B1B,MAAM,EAAAyB,GAAA,CAAAE,IAAA,CAAAC,UAAA;EAIN1B,wBAAwB,EAAAuB,GAAA,CAAAI,IAAA;EAExBzB,SAAS,EAAAqB,GAAA,CAAAK,MAAA;EAETzB,aAAa,EAAAoB,GAAA,CAAAI,IAAA;EAEb3D,YAAY,EAAAuD,GAAA,CAAAM,MAAA;EAEZ9B,QAAQ,EAAAwB,GAAA,CAAAO,IAAA;EAERvB,WAAW,EAAAgB,GAAA,CAAAI,IAAA;EAEXlB,YAAY,EAAAc,GAAA,CAAAI;AAAA;AA2Ed,eAAepC,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {act, render} from '../../test-utils';
|
|
3
|
+
import {BackButton} from '../index';
|
|
4
|
+
import {Size} from '../../types'
|
|
5
|
+
import 'jest-styled-components';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
describe('<BackButton />', () => {
|
|
11
|
+
it('should render back button', function () {
|
|
12
|
+
const {queryByText} = render(<BackButton size={Size.Small}>Back Button</BackButton>);
|
|
13
|
+
expect(queryByText('Back Button')).toBeDefined();
|
|
14
|
+
});
|
|
15
|
+
it('should call action on click', function () {
|
|
16
|
+
const clickMock = jest.fn(() => {});
|
|
17
|
+
const component = render(<BackButton size={Size.Small} onClick={clickMock}>Back Button</BackButton>);
|
|
18
|
+
act(() => {
|
|
19
|
+
component.getByText('Back Button').click();
|
|
20
|
+
});
|
|
21
|
+
expect(clickMock).toBeCalled();
|
|
22
|
+
});
|
|
23
|
+
it('should not call action on click when disabled', function () {
|
|
24
|
+
const clickMock = jest.fn(() => {});
|
|
25
|
+
const component = render(<BackButton size={Size.Small} disabled={true} onClick={clickMock}>Back Button</BackButton>);
|
|
26
|
+
act(() => {
|
|
27
|
+
component.getByText('Back Button').click();
|
|
28
|
+
});
|
|
29
|
+
expect(clickMock).toBeCalledTimes(0);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '../../test-utils';
|
|
3
|
+
import { Button } from '../index';
|
|
4
|
+
import 'jest-styled-components';
|
|
5
|
+
import { COLORS } from '../../styles';
|
|
6
|
+
import { Size } from '../..';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
describe('<Button />', () => {
|
|
12
|
+
it('Renders primary button', async () => {
|
|
13
|
+
const { queryByText, getByTestId } = render(
|
|
14
|
+
<Button variant="primary" testId="TestButton" size={Size.Large}>
|
|
15
|
+
TestButton
|
|
16
|
+
</Button>,
|
|
17
|
+
);
|
|
18
|
+
expect(queryByText('TestButton')).toBeDefined();
|
|
19
|
+
/*expect(getByTestId('TestButton')).toHaveStyleRule('background-color', COLORS.primary);
|
|
20
|
+
expect(getByTestId('TestButton')).toHaveStyleRule('cursor', 'pointer');
|
|
21
|
+
expect(getByTestId('TestButton')).toHaveStyleRule('color', 'white');*/
|
|
22
|
+
});
|
|
23
|
+
it('Renders secondary button', async () => {
|
|
24
|
+
const { queryByText, getByTestId } = render(
|
|
25
|
+
<Button variant="secondary" testId="TestButton">
|
|
26
|
+
TestButton
|
|
27
|
+
</Button>,
|
|
28
|
+
);
|
|
29
|
+
expect(queryByText('TestButton')).toBeDefined();
|
|
30
|
+
/*expect(getByTestId('TestButton')).toHaveStyleRule('color', COLORS.primary);
|
|
31
|
+
expect(getByTestId('TestButton')).toHaveStyleRule('border-color', COLORS.primary);
|
|
32
|
+
expect(getByTestId('TestButton')).toHaveStyleRule('background-color', 'white');*/
|
|
33
|
+
});
|
|
34
|
+
it('Renders tertiary button', async () => {
|
|
35
|
+
const { queryByText, getByTestId } = render(
|
|
36
|
+
<Button variant="tertiary" testId="TestButton">
|
|
37
|
+
TestButton
|
|
38
|
+
</Button>,
|
|
39
|
+
);
|
|
40
|
+
expect(queryByText('TestButton')).toBeDefined();
|
|
41
|
+
/*expect(getByTestId('TestButton')).toHaveStyleRule('background-color', 'white');
|
|
42
|
+
expect(getByTestId('TestButton')).toHaveStyleRule('border-color', COLORS.neutral_100);
|
|
43
|
+
expect(getByTestId('TestButton')).toHaveStyleRule('color', COLORS.primary);*/
|
|
44
|
+
});
|
|
45
|
+
});
|