@dnanpm/styleguide 3.9.13 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/build/cjs/components/Box/Box.d.ts +4 -0
  2. package/build/cjs/components/Box/Box.js +1 -1
  3. package/build/cjs/components/Button/Button.d.ts +4 -0
  4. package/build/cjs/components/Button/Button.js +1 -1
  5. package/build/cjs/components/ButtonArrow/ButtonArrow.js +9 -2
  6. package/build/cjs/components/ButtonIcon/ButtonIcon.d.ts +4 -0
  7. package/build/cjs/components/ButtonIcon/ButtonIcon.js +49 -13
  8. package/build/cjs/components/Carousel/Carousel.js +4 -1
  9. package/build/cjs/components/Checkbox/Checkbox.js +1 -1
  10. package/build/cjs/components/EnergyLabel/EnergyLabel.d.ts +65 -0
  11. package/build/cjs/components/EnergyLabel/EnergyLabel.js +98 -0
  12. package/build/cjs/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +2 -3
  13. package/build/cjs/components/MainHeaderNavigation/ChildComponents/DesktopMenu.js +15 -16
  14. package/build/cjs/components/MainHeaderNavigation/ChildComponents/LanguageSelector.js +1 -2
  15. package/build/cjs/components/MainHeaderNavigation/ChildComponents/LinkModifier.d.ts +2 -2
  16. package/build/cjs/components/MainHeaderNavigation/ChildComponents/LinkModifier.js +5 -7
  17. package/build/cjs/components/MainHeaderNavigation/ChildComponents/LoginTooltip.js +3 -5
  18. package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.js +5 -5
  19. package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +4 -4
  20. package/build/cjs/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.d.ts +3 -2
  21. package/build/cjs/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.js +6 -10
  22. package/build/cjs/components/MainHeaderNavigation/ChildComponents/MobileMenu.js +3 -3
  23. package/build/cjs/components/MainHeaderNavigation/ChildComponents/PageSearch.js +3 -5
  24. package/build/cjs/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +5 -1
  25. package/build/cjs/components/MainHeaderNavigation/MainHeaderNavigation.js +7 -7
  26. package/build/cjs/components/MainHeaderNavigation/globalNavStyles.js +6 -0
  27. package/build/cjs/components/Notification/Notification.js +3 -3
  28. package/build/cjs/components/Overlay/Overlay.d.ts +64 -3
  29. package/build/cjs/components/Overlay/Overlay.js +11 -8
  30. package/build/cjs/components/Pill/Pill.js +1 -1
  31. package/build/cjs/components/PriorityNavigation/PriorityNavigation.d.ts +0 -4
  32. package/build/cjs/components/PriorityNavigation/PriorityNavigation.js +18 -9
  33. package/build/cjs/components/RadioButton/RadioButton.js +1 -1
  34. package/build/cjs/components/Switch/Switch.js +1 -1
  35. package/build/cjs/components/index.d.ts +1 -0
  36. package/build/cjs/index.js +2 -0
  37. package/build/es/components/Box/Box.d.ts +4 -0
  38. package/build/es/components/Box/Box.js +1 -1
  39. package/build/es/components/Button/Button.d.ts +4 -0
  40. package/build/es/components/Button/Button.js +1 -1
  41. package/build/es/components/ButtonArrow/ButtonArrow.js +10 -3
  42. package/build/es/components/ButtonIcon/ButtonIcon.d.ts +4 -0
  43. package/build/es/components/ButtonIcon/ButtonIcon.js +49 -13
  44. package/build/es/components/Carousel/Carousel.js +4 -1
  45. package/build/es/components/Checkbox/Checkbox.js +1 -1
  46. package/build/es/components/EnergyLabel/EnergyLabel.d.ts +65 -0
  47. package/build/es/components/EnergyLabel/EnergyLabel.js +90 -0
  48. package/build/es/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +2 -3
  49. package/build/es/components/MainHeaderNavigation/ChildComponents/DesktopMenu.js +15 -16
  50. package/build/es/components/MainHeaderNavigation/ChildComponents/LanguageSelector.js +1 -2
  51. package/build/es/components/MainHeaderNavigation/ChildComponents/LinkModifier.d.ts +2 -2
  52. package/build/es/components/MainHeaderNavigation/ChildComponents/LinkModifier.js +5 -7
  53. package/build/es/components/MainHeaderNavigation/ChildComponents/LoginTooltip.js +3 -5
  54. package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.js +5 -5
  55. package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +4 -4
  56. package/build/es/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.d.ts +3 -2
  57. package/build/es/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.js +6 -10
  58. package/build/es/components/MainHeaderNavigation/ChildComponents/MobileMenu.js +3 -3
  59. package/build/es/components/MainHeaderNavigation/ChildComponents/PageSearch.js +3 -5
  60. package/build/es/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +5 -1
  61. package/build/es/components/MainHeaderNavigation/MainHeaderNavigation.js +8 -8
  62. package/build/es/components/MainHeaderNavigation/globalNavStyles.js +6 -0
  63. package/build/es/components/Notification/Notification.js +3 -3
  64. package/build/es/components/Overlay/Overlay.d.ts +64 -3
  65. package/build/es/components/Overlay/Overlay.js +11 -8
  66. package/build/es/components/Pill/Pill.js +1 -1
  67. package/build/es/components/PriorityNavigation/PriorityNavigation.d.ts +0 -4
  68. package/build/es/components/PriorityNavigation/PriorityNavigation.js +18 -9
  69. package/build/es/components/RadioButton/RadioButton.js +1 -1
  70. package/build/es/components/Switch/Switch.js +1 -1
  71. package/build/es/components/index.d.ts +1 -0
  72. package/build/es/index.js +1 -0
  73. package/package.json +2 -2
@@ -2,7 +2,8 @@ import React from 'react';
2
2
  import type { MainHeaderNavigationProps } from '../MainHeaderNavigation';
3
3
  interface MinicartTooltipProps extends Pick<MainHeaderNavigationProps, 'onCartButtonClick'> {
4
4
  minicartAmount: number;
5
- minicartLabel?: string;
5
+ minicartLabel: string;
6
+ minicartAmountLabel: string;
6
7
  }
7
- declare const MinicartTooltip: ({ minicartAmount, minicartLabel, ...props }: MinicartTooltipProps) => React.JSX.Element;
8
+ declare const MinicartTooltip: ({ minicartAmount, minicartAmountLabel, minicartLabel, onCartButtonClick, }: MinicartTooltipProps) => React.JSX.Element;
8
9
  export default MinicartTooltip;
@@ -2,12 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var tslib = require('tslib');
6
5
  var icons = require('@dnanpm/icons');
7
6
  var React = require('react');
8
7
  var theme = require('../../../themes/theme.js');
9
- var navigation = require('../../../themes/themeComponents/navigation.js');
10
- var Icon = require('../../Icon/Icon.js');
11
8
  var NotificationBadge = require('../../NotificationBadge/NotificationBadge.js');
12
9
  var NavContext = require('../context/NavContext.js');
13
10
  var MainNavTooltipMenu = require('./MainNavTooltipMenu.js');
@@ -16,13 +13,12 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
16
13
 
17
14
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
18
15
 
19
- const MinicartTooltip = (_a) => {
20
- var { minicartAmount, minicartLabel } = _a, props = tslib.__rest(_a, ["minicartAmount", "minicartLabel"]);
21
- const { navZIndex, minicartComponent: MinicartComponent } = React.useContext(NavContext.default);
22
- return (React__default.default.createElement(MainNavTooltipMenu.default, { ariaLabel: minicartLabel, closeWhenTagClicked: ['a', 'button'], onCartButtonClick: props.onCartButtonClick, contentComponent: MinicartComponent, contentWidth: "35rem", fullWidthBreakpoint: theme.default.breakpoints.md, globalStateString: "minicart", tooltipRight: "5rem", zIndex: navZIndex + 1 },
23
- React__default.default.createElement(Icon.default, { icon: icons.Cart, size: navigation.navIconSize }),
24
- React__default.default.createElement("span", null, minicartLabel),
25
- minicartAmount > 0 && (React__default.default.createElement(NotificationBadge.default, { top: "-5px", right: "5px", "data-testid": "header-minicart-amount" }, minicartAmount))));
16
+ const MinicartTooltip = ({ minicartAmount, minicartAmountLabel, minicartLabel, onCartButtonClick, }) => {
17
+ const { navZIndex, minicartComponent } = React.useContext(NavContext.default);
18
+ return (React__default.default.createElement(MainNavTooltipMenu.default, { ariaLabel: minicartLabel, closeWhenTagClicked: ['a', 'button'], onCartButtonClick: onCartButtonClick, contentComponent: minicartComponent, contentWidth: "35rem", fullWidthBreakpoint: theme.default.breakpoints.md, globalStateString: "minicart", tooltipRight: "5rem", zIndex: navZIndex + 1 },
19
+ React__default.default.createElement(icons.Cart, null),
20
+ React__default.default.createElement("span", { "aria-hidden": true }, minicartLabel),
21
+ minicartAmount > 0 && (React__default.default.createElement(NotificationBadge.default, { "data-testid": "header-minicart-amount", right: "5px", top: "-5px", visuallyHiddenText: minicartAmountLabel }, minicartAmount))));
26
22
  };
27
23
 
28
24
  exports.default = MinicartTooltip;
@@ -132,7 +132,7 @@ const CreateSubMenuItem = ({ menuItem, currentLevel, itemIndex }) => {
132
132
  menuItem.titles[lang],
133
133
  React__default.default.createElement(icons.ChevronRight, { color: theme.default.color.default.pink })));
134
134
  }
135
- return renderMenuItem(React__default.default.createElement(LinkModifier.default, { menuItem: menuItem, tabIndex: tabNavigationDisabled }));
135
+ return renderMenuItem(React__default.default.createElement(LinkModifier.default, { menuItem: menuItem, disabledTabIndex: tabNavigationDisabled }));
136
136
  };
137
137
  const SubMenuMobile = ({ currentLevel, menuItem }) => {
138
138
  const featuredItems = menuItem.pages.filter(subMenuItem => !subMenuItem.pages.length && currentLevel === 2);
@@ -144,7 +144,7 @@ const SubMenuMobile = ({ currentLevel, menuItem }) => {
144
144
  }
145
145
  return (React__default.default.createElement(React__default.default.Fragment, null,
146
146
  currentLevel > 1 && React__default.default.createElement(MenuItemBackLink, { currentLevel: currentLevel }),
147
- featuredItems.length > 0 && (React__default.default.createElement(globalNavStyles.FeaturedBlock, { collapseSize: collapseSize }, featuredItems.map(subMenuItem => (React__default.default.createElement(LinkModifier.default, { key: subMenuItem.id, menuItem: subMenuItem, showIcon: true, tabIndex: tabNavigationDisabled }))))),
147
+ featuredItems.length > 0 && (React__default.default.createElement(globalNavStyles.FeaturedBlock, { collapseSize: collapseSize }, featuredItems.map(subMenuItem => (React__default.default.createElement(LinkModifier.default, { key: subMenuItem.id, menuItem: subMenuItem, showIcon: true, disabledTabIndex: tabNavigationDisabled }))))),
148
148
  menuItem.pages
149
149
  .filter(subMenuItem => !featuredItems.includes(subMenuItem))
150
150
  .map((subMenuItem, index) => (React__default.default.createElement(CreateSubMenuItem, { currentLevel: currentLevel, itemIndex: index, key: subMenuItem.id, menuItem: subMenuItem })))));
@@ -155,7 +155,7 @@ const NavigationMenuMobile = () => {
155
155
  if (!(mainNavigation === null || mainNavigation === void 0 ? void 0 : mainNavigation.pages.length)) {
156
156
  return null;
157
157
  }
158
- const renderMenuList = (scrollPosition, level, menuItem) => (React__default.default.createElement(globalNavStyles.MenuList, { role: "menu", "aria-hidden": menuLevel.scrollPosition !== scrollPosition, "aria-disabled": menuLevel.scrollPosition !== scrollPosition, "data-testid": `mobile-nav-menu-level-${level}`, isInView: menuLevel.scrollPosition === scrollPosition },
158
+ const renderMenuList = (scrollPosition, level, menuItem) => (React__default.default.createElement(globalNavStyles.MenuList, { "aria-hidden": menuLevel.scrollPosition !== scrollPosition, "aria-disabled": menuLevel.scrollPosition !== scrollPosition, "data-testid": `mobile-nav-menu-level-${level}`, isInView: menuLevel.scrollPosition === scrollPosition },
159
159
  React__default.default.createElement(SubMenuMobile, { currentLevel: level, menuItem: menuItem })));
160
160
  return (React__default.default.createElement(React__default.default.Fragment, null,
161
161
  renderMenuList(0, 1, mainNavigation),
@@ -4,8 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var icons = require('@dnanpm/icons');
6
6
  var React = require('react');
7
- var navigation = require('../../../themes/themeComponents/navigation.js');
8
- var Icon = require('../../Icon/Icon.js');
9
7
  var NavContext = require('../context/NavContext.js');
10
8
  var MainNavTooltipMenu = require('./MainNavTooltipMenu.js');
11
9
 
@@ -14,9 +12,9 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
14
12
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
15
13
 
16
14
  const PageSearch = ({ searchLabel }) => {
17
- const { navZIndex, searchComponent: SearchComponent } = React.useContext(NavContext.default);
18
- return (React__default.default.createElement(MainNavTooltipMenu.default, { ariaLabel: searchLabel, closeWhenTagClicked: ['a'], contentComponent: SearchComponent, contentWidth: "100%", "data-testid": "header-search-container", fullWidthDesktop: true, globalStateString: "search", tooltipRight: "0", zIndex: navZIndex + 1 },
19
- React__default.default.createElement(Icon.default, { icon: icons.Search, size: navigation.navIconSize }),
15
+ const { navZIndex, searchComponent } = React.useContext(NavContext.default);
16
+ return (React__default.default.createElement(MainNavTooltipMenu.default, { ariaLabel: searchLabel, closeWhenTagClicked: ['a'], contentComponent: searchComponent, contentWidth: "100%", "data-testid": "header-search-container", fullWidthDesktop: true, globalStateString: "search", tooltipRight: "0", zIndex: navZIndex + 1 },
17
+ React__default.default.createElement(icons.Search, null),
20
18
  React__default.default.createElement("span", null, searchLabel)));
21
19
  };
22
20
 
@@ -16,6 +16,7 @@ export interface MainHeaderNavigationProps {
16
16
  minicart?: boolean;
17
17
  minicartText?: string;
18
18
  minicartAmount?: number;
19
+ minicartAmountLabel?: string;
19
20
  /**
20
21
  * Defines MinicartComponent when used. If minicart is true but component is not provided, shown as disabled element.
21
22
  *
@@ -27,6 +28,9 @@ export interface MainHeaderNavigationProps {
27
28
  * On Cart button click callback
28
29
  */
29
30
  onCartButtonClick?: (e: MouseEvent<HTMLElement>) => void;
31
+ dnaLogoLinkAriaLabel?: string;
32
+ openMainMenuAriaLabel?: string;
33
+ closeMainMenuAriaLabel?: string;
30
34
  showLoginTooltip?: boolean;
31
35
  languageSelector?: boolean;
32
36
  languageSelectorText?: string;
@@ -40,6 +44,6 @@ export interface MainHeaderNavigationProps {
40
44
  notificationText?: string;
41
45
  }
42
46
  /** @visibleName MainHeaderNavigation */
43
- declare const MainHeaderNavigation: ({ businessMenuAriaLabel, categoryCollectionText, className, collapseSize, currentUrl, isLoggedIn, items, language, languageSelector, languageSelectorText, login, loginComponent, loginText, mainMenuAriaLabel, minicart, minicartAmount, minicartComponent, minicartText, nextJSLinkComponent, notificationText, search, searchComponent, searchText, showLoginTooltip, showMinicart, zIndex, ...props }: MainHeaderNavigationProps) => React.JSX.Element;
47
+ declare const MainHeaderNavigation: ({ businessMenuAriaLabel, categoryCollectionText, closeMainMenuAriaLabel, className, collapseSize, currentUrl, dnaLogoLinkAriaLabel, isLoggedIn, items, language, languageSelector, languageSelectorText, login, loginComponent, loginText, mainMenuAriaLabel, minicart, minicartAmount, minicartAmountLabel, minicartComponent, minicartText, nextJSLinkComponent, notificationText, openMainMenuAriaLabel, search, searchComponent, searchText, showLoginTooltip, showMinicart, zIndex, ...props }: MainHeaderNavigationProps) => React.JSX.Element;
44
48
  /** @component */
45
49
  export default MainHeaderNavigation;
@@ -13,7 +13,6 @@ var theme = require('../../themes/theme.js');
13
13
  var navigation = require('../../themes/themeComponents/navigation.js');
14
14
  var styledUtils = require('../../utils/styledUtils.js');
15
15
  var DnaLogo = require('../DnaLogo/DnaLogo.js');
16
- var Icon = require('../Icon/Icon.js');
17
16
  var Notification = require('../Notification/Notification.js');
18
17
  var BusinessMenu = require('./ChildComponents/BusinessMenu.js');
19
18
  var DesktopMenu = require('./ChildComponents/DesktopMenu.js');
@@ -135,7 +134,7 @@ const initiateScrollToHeader = (componentRef) => {
135
134
  /** @visibleName MainHeaderNavigation */
136
135
  const MainHeaderNavigation = (_a) => {
137
136
  var _b, _c, _d;
138
- var { businessMenuAriaLabel = 'Sivustot', categoryCollectionText = 'Muut kategoriat', className, collapseSize = 767, currentUrl = '', isLoggedIn = false, items = {}, language = 'fi', languageSelector = false, languageSelectorText = 'Vaihda kieltä', login = true, loginComponent, loginText = 'Kirjaudu', mainMenuAriaLabel = 'Päänavigaatio', minicart = true, minicartAmount = 0, minicartComponent = false, minicartText = 'Ostoskori', nextJSLinkComponent = false, notificationText = '', search = true, searchComponent = false, searchText = 'Haku', showLoginTooltip = false, showMinicart = false, zIndex = 1030 } = _a, props = tslib.__rest(_a, ["businessMenuAriaLabel", "categoryCollectionText", "className", "collapseSize", "currentUrl", "isLoggedIn", "items", "language", "languageSelector", "languageSelectorText", "login", "loginComponent", "loginText", "mainMenuAriaLabel", "minicart", "minicartAmount", "minicartComponent", "minicartText", "nextJSLinkComponent", "notificationText", "search", "searchComponent", "searchText", "showLoginTooltip", "showMinicart", "zIndex"]);
137
+ var { businessMenuAriaLabel = 'Sivustot', categoryCollectionText = 'Muut kategoriat', closeMainMenuAriaLabel, className, collapseSize = 767, currentUrl = '', dnaLogoLinkAriaLabel, isLoggedIn = false, items = {}, language = 'fi', languageSelector = false, languageSelectorText = 'Vaihda kieltä', login = true, loginComponent, loginText = 'Kirjaudu', mainMenuAriaLabel = 'Päänavigaatio', minicart = true, minicartAmount = 0, minicartAmountLabel, minicartComponent = false, minicartText = 'Ostoskori', nextJSLinkComponent = false, notificationText = '', openMainMenuAriaLabel, search = true, searchComponent = false, searchText = 'Haku', showLoginTooltip = false, showMinicart = false, zIndex = 1030 } = _a, props = tslib.__rest(_a, ["businessMenuAriaLabel", "categoryCollectionText", "closeMainMenuAriaLabel", "className", "collapseSize", "currentUrl", "dnaLogoLinkAriaLabel", "isLoggedIn", "items", "language", "languageSelector", "languageSelectorText", "login", "loginComponent", "loginText", "mainMenuAriaLabel", "minicart", "minicartAmount", "minicartAmountLabel", "minicartComponent", "minicartText", "nextJSLinkComponent", "notificationText", "openMainMenuAriaLabel", "search", "searchComponent", "searchText", "showLoginTooltip", "showMinicart", "zIndex"]);
139
138
  const { isMobile } = useWindowSize.default(collapseSize);
140
139
  const navigationEl = React.useRef(null);
141
140
  const key = ramda.prop('id');
@@ -301,24 +300,25 @@ const MainHeaderNavigation = (_a) => {
301
300
  };
302
301
  return (React__default.default.createElement(React__default.default.Fragment, null,
303
302
  isPageOverlay && React__default.default.createElement(PageOverlay, { "data-testid": "navigation-overlay", navZIndex: zIndex }),
304
- React__default.default.createElement(GlobalNavigationContainer, { className: className, collapseSize: collapseSize, "data-testid": "dna-main-header", navZIndex: zIndex, ref: navigationEl, role: "banner" },
303
+ React__default.default.createElement(GlobalNavigationContainer, { className: className, collapseSize: collapseSize, "data-testid": "dna-main-header", navZIndex: zIndex, ref: navigationEl },
305
304
  React__default.default.createElement(NavContext.default.Provider, { value: navigationContext },
306
305
  React__default.default.createElement(GlobalStyle, null),
307
306
  !items.mainNavigation && notificationText && (React__default.default.createElement(Notification.default, { type: "info" }, notificationText)),
308
307
  React__default.default.createElement(BusinessMenu.default, { ariaLabel: businessMenuAriaLabel, currentBusinessId: items.businessId, items: (_d = items.businessSelector) === null || _d === void 0 ? void 0 : _d.items, lang: language }),
309
308
  React__default.default.createElement(NavigationWrapper, { collapseSize: collapseSize },
310
- React__default.default.createElement(globalNavStyles.LogoLink, { "data-testid": "dna-logo-link", href: currentBusinessSite === null || currentBusinessSite === void 0 ? void 0 : currentBusinessSite.urls[language], title: "DNA" },
309
+ React__default.default.createElement(globalNavStyles.LogoLink, { "data-testid": "dna-logo-link", href: currentBusinessSite === null || currentBusinessSite === void 0 ? void 0 : currentBusinessSite.urls[language], "aria-label": dnaLogoLinkAriaLabel },
311
310
  React__default.default.createElement(DnaLogo.default, { size: navigation.headerLogoSize })),
312
311
  React__default.default.createElement(globalNavStyles.DesktopMenuContainer, { "aria-label": mainMenuAriaLabel, collapseSize: collapseSize },
313
312
  React__default.default.createElement(DesktopMenu.default, null)),
314
313
  React__default.default.createElement(globalNavStyles.HeaderIconContainer, { collapseSize: collapseSize },
315
314
  languagesObject && languageSelector && (React__default.default.createElement(LanguageSelector.default, { currentLanguage: language, languagesObject: languagesObject, languageSelectorLabel: languageSelectorText })),
316
315
  search && React__default.default.createElement(PageSearch.default, { searchLabel: searchText }),
317
- minicart && (React__default.default.createElement(MinicartTooltip.default, { minicartAmount: minicartAmount, minicartLabel: minicartText, onCartButtonClick: props.onCartButtonClick })),
316
+ minicart && (React__default.default.createElement(MinicartTooltip.default, { minicartAmount: minicartAmount, minicartAmountLabel: minicartAmountLabel !== null && minicartAmountLabel !== void 0 ? minicartAmountLabel : '', minicartLabel: minicartText, onCartButtonClick: props.onCartButtonClick })),
318
317
  login && React__default.default.createElement(LoginTooltip.default, { loginLabel: loginText, isLogged: isLoggedIn }),
319
318
  React__default.default.createElement(MainNavTooltipMenu.IconContainer, { collapseSize: collapseSize, "data-testid": "header-mobile-menu-container" },
320
- React__default.default.createElement(globalNavStyles.MobileMenuButton, { "aria-expanded": isMobileMenuOpen, "aria-label": "menu toggle", "data-testid": "header-mobile-menu-toggle", onClick: handleToggleClick },
321
- React__default.default.createElement(Icon.default, { icon: isMobileMenuOpen ? icons.Close : icons.Menu, size: navigation.navIconSize })))),
319
+ React__default.default.createElement(globalNavStyles.MobileMenuButton, { "aria-expanded": isMobileMenuOpen, "aria-label": isMobileMenuOpen
320
+ ? closeMainMenuAriaLabel
321
+ : openMainMenuAriaLabel, "data-testid": "header-mobile-menu-toggle", onClick: handleToggleClick }, isMobileMenuOpen ? React__default.default.createElement(icons.Close, null) : React__default.default.createElement(icons.Menu, null)))),
322
322
  isMobile && React__default.default.createElement(MobileMenu.default, null))))));
323
323
  };
324
324
 
@@ -94,6 +94,12 @@ const MenuLink = styled.default.a `
94
94
  overflow: visible;
95
95
  text-decoration: none;
96
96
  color: ${p => (p.isActive ? theme.default.color.text.pink : theme.default.color.text.black)};
97
+ > svg {
98
+ fill: ${theme.default.color.text.pink};
99
+ height: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 2)};
100
+ width: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
101
+ }
102
+ }
97
103
  `;
98
104
  const MenuLinkWithChildren = styled.default.a `
99
105
  line-height: ${theme.default.lineHeight.xs};
@@ -33,7 +33,7 @@ const NotificationWrapper = styled__default.default.div `
33
33
  ${sharedStyles}
34
34
  border-color: ${({ $type }) => theme.default.color.notification[$type]};
35
35
  `;
36
- const StaticWrapper = styled__default.default.section `
36
+ const StaticWrapper = styled__default.default.div `
37
37
  ${sharedStyles}
38
38
  border-color: ${({ $type }) => theme.default.color.notification[$type]};
39
39
  `;
@@ -43,7 +43,7 @@ const IconWrapper = styled__default.default.div `
43
43
  padding: 0.5rem;
44
44
  background-color: ${({ $type }) => theme.default.color.notification[$type]};
45
45
  `;
46
- const ContentWrapper = styled__default.default.span `
46
+ const ContentWrapper = styled__default.default.div `
47
47
  margin: auto 0;
48
48
  padding: 0.5rem 0;
49
49
  width: 100%;
@@ -68,7 +68,7 @@ const Notification = ({ type = 'info', 'data-testid': dataTestId, isStatic = fal
68
68
  React__default.default.createElement(ContentWrapper, null, children),
69
69
  closeButton && (React__default.default.createElement(ButtonCloseStyled, { onClick: onClickCloseButton, "aria-label": closeButtonLabel },
70
70
  React__default.default.createElement(Icon.default, { icon: icons.Close, color: "currentColor", "aria-hidden": true })))));
71
- return isStatic ? (React__default.default.createElement(StaticWrapper, { "$type": type, className: className, "data-testid": dataTestId, "aria-label": ariaLabel }, renderContent())) : (React__default.default.createElement(NotificationWrapper, { "$type": type, className: className, "data-testid": dataTestId, role: "alert" }, renderContent()));
71
+ return isStatic ? (React__default.default.createElement(StaticWrapper, { "$type": type, className: className, "data-testid": dataTestId, "aria-label": ariaLabel, role: "region" }, renderContent())) : (React__default.default.createElement(NotificationWrapper, { "$type": type, className: className, "data-testid": dataTestId, role: "alert" }, renderContent()));
72
72
  };
73
73
 
74
74
  exports.default = Notification;
@@ -1,6 +1,8 @@
1
- import type { MouseEvent, ReactNode } from 'react';
1
+ import type { MouseEvent, ReactNode, KeyboardEvent } from 'react';
2
2
  import React from 'react';
3
- interface Props {
3
+ type AriaLandmarkRoles = 'none' | 'main' | 'navigation' | 'banner' | 'complementary' | 'contentinfo' | 'form' | 'region' | 'search';
4
+ type Html5Tag = 'main' | 'div' | 'section' | 'article' | 'aside' | 'nav' | 'header' | 'footer';
5
+ interface BaseProps {
4
6
  /**
5
7
  * Unique ID for the component
6
8
  */
@@ -13,6 +15,11 @@ interface Props {
13
15
  * On overlay element mouse click
14
16
  */
15
17
  onClick?: (e: MouseEvent<HTMLElement>) => void;
18
+ /**
19
+ * Callback function for keydown events on the overlay element to be used with prop `onClick`.
20
+ * This can be used to handle keyboard interactions, such as closing the overlay with the Escape key.
21
+ */
22
+ onKeyDown?: (e: KeyboardEvent<HTMLElement>) => void;
16
23
  /**
17
24
  * Allows to set DOM node to which Overlay component will be appended. The node must already exist.
18
25
  * Use `false` to render in place without use of `createPortal`
@@ -42,8 +49,62 @@ interface Props {
42
49
  * Allows to pass a custom className
43
50
  */
44
51
  className?: string;
52
+ /**
53
+ * Specifies the HTML5 tag to be used for the content wrapper.
54
+ * It is recommended to use native semantic HTML elements whenever possible.
55
+ * If a suitable semantic element is not available, a `<div>` with an appropriate ARIA role should be used (role from `role`).
56
+ * ARIA roles from https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles
57
+ *
58
+ * @param {Html5Tag} main Uses `<main>` tag for the content wrapper.
59
+ * @param {Html5Tag} div Uses `<div>` tag for the content wrapper.
60
+ * @param {Html5Tag} section Uses `<section>` tag for the content wrapper.
61
+ * @param {Html5Tag} article Uses `<article>` tag for the content wrapper.
62
+ * @param {Html5Tag} aside Uses `<aside>` tag for the content wrapper.
63
+ * @param {Html5Tag} nav Uses `<nav>` tag for the content wrapper.
64
+ * @param {Html5Tag} header Uses `<header>` tag for the content wrapper.
65
+ * @param {Html5Tag} footer Uses `<footer>` tag for the content wrapper.
66
+ *
67
+ * @default 'section'
68
+ */
69
+ as?: Html5Tag;
70
+ /**
71
+ * Specifies the ARIA landmark role for the content wrapper and is used when `as` is a div.
72
+ * It is always recommended to use native semantic HTML elements from `as` whenever possible.
73
+ * ARIA roles from https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles
74
+ *
75
+ * @param {AriaLandmarkRoles} main Represents the main content with `role="main"` (acting as <main>).
76
+ * @param {AriaLandmarkRoles} navigation Represents navigation links with `role="navigation"` (acting as <nav>).
77
+ * @param {AriaLandmarkRoles} banner Represents introductory content with `role="banner"` (acting as <header>).
78
+ * @param {AriaLandmarkRoles} complementary Represents related content with `role="complementary"` (acting as <aside>).
79
+ * @param {AriaLandmarkRoles} contentinfo Represents footer information with `role="contentinfo"` (acting as <footer>).
80
+ * @param {AriaLandmarkRoles} form Indicates an interactive form with `role="form"` (acting as <form>).
81
+ * @param {AriaLandmarkRoles} region Represents an important section with `role="region"` (acting as <section>).
82
+ * @param {AriaLandmarkRoles} search Represents a search area with `role="search"` (acting as <search>).
83
+ */
84
+ role?: AriaLandmarkRoles;
85
+ /**
86
+ * If a role from `role` is used more than once on a page, the aria-label attribute should also be used in order to distinguish between the two regions.
87
+ */
88
+ ariaLabel?: string;
89
+ /**
90
+ * Ensures that overlays maintain proper focus management and accessibility.
91
+ * If `isFocusTrapped` is true, an appropriate ARIA role should be used (role from `focusableTrappedWidgetRole`).
92
+ * If `isFocusTrapped` is false, the tabbable element will not have an ARIA role.
93
+ *
94
+ * @default true
95
+ */
96
+ isFocusTrapped?: boolean;
45
97
  }
98
+ type DivProps = BaseProps & {
99
+ as?: 'div';
100
+ role: AriaLandmarkRoles;
101
+ };
102
+ type NonDivProps = BaseProps & {
103
+ as?: Exclude<Html5Tag, 'div'>;
104
+ role?: undefined;
105
+ };
106
+ type Props = DivProps | NonDivProps;
46
107
  /** @visibleName Overlay */
47
- declare const Overlay: ({ portalContainer: portalContainerSelector, appElement: appElementSelector, preventBodyScroll, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
108
+ declare const Overlay: ({ portalContainer: portalContainerSelector, appElement: appElementSelector, preventBodyScroll, "data-testid": dataTestId, as, role, isFocusTrapped, ...props }: Props) => React.JSX.Element;
48
109
  /** @component */
49
110
  export default Overlay;
@@ -33,28 +33,31 @@ const Element = styled.default.div `
33
33
  `;
34
34
  /** @visibleName Overlay */
35
35
  const Overlay = (_a) => {
36
- var { portalContainer: portalContainerSelector = 'body', appElement: appElementSelector = '#__next', preventBodyScroll = true, 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["portalContainer", "appElement", "preventBodyScroll", 'data-testid']);
36
+ var { portalContainer: portalContainerSelector = 'body', appElement: appElementSelector = '#__next', preventBodyScroll = true, 'data-testid': dataTestId, as = 'section', role, isFocusTrapped = true } = _a, props = tslib.__rest(_a, ["portalContainer", "appElement", "preventBodyScroll", 'data-testid', "as", "role", "isFocusTrapped"]);
37
37
  const contentRef = React.useRef(null);
38
38
  const portalContainer = portalContainerSelector
39
39
  ? document.querySelector(portalContainerSelector)
40
40
  : null;
41
41
  const appElement = document.querySelector(appElementSelector);
42
- const overlayElement = (React__default.default.createElement(Element, { id: props.id, onClick: props.onClick, className: props.className, "data-testid": dataTestId },
43
- React__default.default.createElement("div", { ref: contentRef, tabIndex: -1 }, props.children)));
42
+ const overlayElement = (React__default.default.createElement(Element, { id: props.id, onClick: props.onClick, className: props.className, "data-testid": dataTestId, onKeyDown: props.onKeyDown, "aria-label": props.ariaLabel, as: as, role: as === 'div' ? role : undefined },
43
+ React__default.default.createElement("div", { ref: contentRef, tabIndex: -1, "data-testid": dataTestId ? `${dataTestId}-content` : '' }, props.children)));
44
44
  React.useEffect(() => {
45
45
  if (preventBodyScroll) {
46
46
  document.body.style.setProperty('overflow', 'hidden');
47
+ document.body.style.setProperty('position', 'relative');
48
+ document.body.style.setProperty('top', '0');
49
+ document.body.style.setProperty('left', '0');
47
50
  return () => {
48
51
  document.body.style.removeProperty('overflow');
49
52
  };
50
53
  }
51
54
  return undefined;
52
- });
55
+ }, [preventBodyScroll]);
53
56
  React.useEffect(() => {
54
57
  var _a;
55
58
  if (appElement) {
56
59
  const focusTrapStart = document.createElement('div');
57
- focusTrapStart.setAttribute('tabindex', '0');
60
+ focusTrapStart.setAttribute('tabindex', isFocusTrapped ? '0' : '-1');
58
61
  focusTrapStart.addEventListener('focus', () => {
59
62
  var _a;
60
63
  (_a = contentRef === null || contentRef === void 0 ? void 0 : contentRef.current) === null || _a === void 0 ? void 0 : _a.focus();
@@ -67,15 +70,15 @@ const Overlay = (_a) => {
67
70
  (_a = contentRef === null || contentRef === void 0 ? void 0 : contentRef.current) === null || _a === void 0 ? void 0 : _a.focus();
68
71
  document.body.prepend(focusTrapStart);
69
72
  document.body.append(focusTrapEnd);
70
- appElement.setAttribute('aria-hidden', 'true');
73
+ appElement.setAttribute('inert', 'true');
71
74
  return () => {
72
75
  document.body.removeChild(focusTrapStart);
73
76
  document.body.removeChild(focusTrapEnd);
74
- appElement.removeAttribute('aria-hidden');
77
+ appElement.removeAttribute('inert');
75
78
  };
76
79
  }
77
80
  return undefined;
78
- });
81
+ }, [appElement, contentRef, isFocusTrapped]);
79
82
  return portalContainerSelector === false
80
83
  ? overlayElement
81
84
  : reactDom.createPortal(overlayElement, portalContainer !== null && portalContainer !== void 0 ? portalContainer : document.body);
@@ -124,7 +124,7 @@ const Pill = (_a) => {
124
124
  const isDefaultType = type === 'none';
125
125
  return (React__default.default.createElement(Label, { as: isDefaultType ? 'button' : 'label', id: isDefaultType ? props.id : undefined, htmlFor: !isDefaultType ? props.id : undefined, type: isDefaultType ? 'button' : undefined, position: props.position, isChecked: props.isChecked || props.isDefaultChecked, isDisabled: props.isDisabled, className: props.className, "data-testid": dataTestId, isDefaultButtonStyle: props.isDefaultButtonStyle, "aria-label": props.ariaLabel, disabled: isDefaultType ? props.isDisabled : undefined, onClick: isDefaultType && !props.isDisabled ? props.onClick : undefined },
126
126
  props.children,
127
- !isDefaultType && (React__default.default.createElement(Input, { id: props.id, name: props.name, type: type, defaultChecked: props.isDefaultChecked, checked: props.isChecked, value: props.value, onChange: props.onChange, disabled: props.isDisabled, readOnly: !props.onChange, "data-testid": dataTestId && `${dataTestId}-input` }))));
127
+ !isDefaultType && (React__default.default.createElement(Input, { id: props.id, name: props.name, type: type, defaultChecked: props.isDefaultChecked, checked: props.isChecked, value: props.value, onChange: props.onChange, disabled: props.isDisabled, readOnly: !props.onChange, "data-testid": dataTestId && `${dataTestId}-input`, "data-checked": props.isChecked }))));
128
128
  };
129
129
 
130
130
  exports.default = Pill;
@@ -41,10 +41,6 @@ interface Props {
41
41
  * Allows to pass a custom className
42
42
  */
43
43
  className?: string;
44
- /**
45
- * Allows to pass a custom aria-label for mobile dropdown button
46
- */
47
- dropdownButtonAriaLabel?: string;
48
44
  /**
49
45
  * Allows to pass testid string for testing purposes
50
46
  */
@@ -276,14 +276,20 @@ const PriorityNavigation = (_a) => {
276
276
  });
277
277
  React.useEffect(() => {
278
278
  if (!isMobile) {
279
- dispatch({
280
- type: 'resetNavigationState',
281
- payload: {
282
- navigationItems: props.children,
283
- },
279
+ requestAnimationFrame(() => {
280
+ dispatch({
281
+ type: 'resetNavigationState',
282
+ payload: {
283
+ navigationItems: props.children,
284
+ },
285
+ });
286
+ setTimeout(() => {
287
+ checkHorizontalOverflow();
288
+ }, 0);
284
289
  });
285
290
  }
286
291
  setIsMobileNavigationOpen(false);
292
+ // eslint-disable-next-line react-hooks/exhaustive-deps
287
293
  }, [isMobile, props.children]);
288
294
  React.useLayoutEffect(() => {
289
295
  if (!isMobile) {
@@ -299,13 +305,15 @@ const PriorityNavigation = (_a) => {
299
305
  checkHorizontalOverflow,
300
306
  ]);
301
307
  const handleNavigationListKeyDown = React.useCallback((e) => {
302
- var _a;
308
+ var _a, _b;
303
309
  if (isMobile && isMobileNavigationOpen && e.key === 'Tab') {
304
310
  const focusableElements = (_a = navigationListRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('a, button, input, [tabindex]:not([tabindex="-1"])');
305
311
  const lastElement = focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements[focusableElements.length - 1];
306
- if (document.activeElement === lastElement) {
312
+ const goingForward = !e.shiftKey;
313
+ if (goingForward && document.activeElement === lastElement) {
307
314
  e.preventDefault();
308
315
  setIsMobileNavigationOpen(false);
316
+ (_b = dropdownButtonRef.current) === null || _b === void 0 ? void 0 : _b.focus();
309
317
  }
310
318
  }
311
319
  }, [isMobile, isMobileNavigationOpen]);
@@ -346,8 +354,9 @@ const PriorityNavigation = (_a) => {
346
354
  !isMobile && Boolean(state.dropdownItems.length) && (React__default.default.createElement(React__default.default.Fragment, null,
347
355
  React__default.default.createElement("div", null,
348
356
  React__default.default.createElement(ButtonIcon.default, { ref: dropdownButtonRef, ariaLabel: openMoreSubpagesAriaLabel, ariaExpanded: isDropdownListOpen, onClick: toggleDropdown, icon: isDropdownListOpen ? icons.ChevronUp : icons.ChevronDown, isReversed: true, "data-testid": "dropdown-button" }, dropdownButtonLabel)),
349
- React__default.default.createElement(DropdownList, { isDropdownListOpen: isDropdownListOpen }, state.dropdownItems.map(dropdownItem => React.isValidElement(dropdownItem) &&
350
- dropdownItem.type === PriorityNavigationItem.default && (React__default.default.createElement(PriorityNavigationItem.default, { id: dropdownItem.props.id, key: dropdownItem.key, onClick: dropdownItem.props.onClick || props.onClick, onKeyDown: dropdownItem.props.onKeyDown || props.onKeyDown, isActive: dropdownItem.props.isActive, className: dropdownItem.props.className, "data-testid": dropdownItem.props['data-testid'] }, dropdownItem.props.children))))))))));
357
+ isDropdownListOpen && (React__default.default.createElement(DropdownList, { isDropdownListOpen: isDropdownListOpen }, state.dropdownItems.map(dropdownItem => React.isValidElement(dropdownItem) &&
358
+ dropdownItem.type === PriorityNavigationItem.default && (React__default.default.createElement(PriorityNavigationItem.default, { id: dropdownItem.props.id, key: dropdownItem.key, onClick: dropdownItem.props.onClick || props.onClick, onKeyDown: dropdownItem.props.onKeyDown ||
359
+ props.onKeyDown, isActive: dropdownItem.props.isActive, className: dropdownItem.props.className, "data-testid": dropdownItem.props['data-testid'] }, dropdownItem.props.children)))))))))));
351
360
  };
352
361
 
353
362
  exports.default = PriorityNavigation;
@@ -104,7 +104,7 @@ const RadioButtonGroup = ({ label, description, groupName, value, onChange, id,
104
104
  const descriptionId = `${baseId}-description`;
105
105
  const combinedDescribedBy = [description ? descriptionId : undefined].filter(Boolean).join(' ');
106
106
  const content = children ||
107
- (options === null || options === void 0 ? void 0 : options.map(option => (React__default.default.createElement(RadioButtonComponent, { key: option.id, id: option.id, name: groupName, value: option.value, label: option.label, disabled: option.disabled, checked: value === option.value, onChange: onChange, className: option.className, "data-testid": option['data-testid'] }))));
107
+ (options === null || options === void 0 ? void 0 : options.map(option => (React__default.default.createElement(RadioButtonComponent, { key: option.id, id: option.id, name: groupName, value: option.value, label: option.label, disabled: option.disabled, checked: value === option.value, onChange: onChange, className: option.className, "data-testid": option['data-testid'], "data-checked": value === option.value }))));
108
108
  const Wrapper = isFieldset ? StyledFieldset : 'div';
109
109
  const renderLabel = () => {
110
110
  if (!label)
@@ -115,7 +115,7 @@ const Switch = (_a) => {
115
115
  };
116
116
  const accessibleLabel = props.label ? undefined : ariaLabel || 'Toggle switch';
117
117
  return (React__namespace.createElement(Container, { className: props.className, "data-testid": dataTestId },
118
- React__namespace.createElement(Checkbox, { id: props.id, name: props.name, checked: Boolean(props.isChecked), "aria-label": accessibleLabel, disabled: props.disabled, onChange: handleChange, role: "switch", type: "checkbox" }),
118
+ React__namespace.createElement(Checkbox, { id: props.id, name: props.name, checked: Boolean(props.isChecked), "aria-label": accessibleLabel, disabled: props.disabled, onChange: handleChange, role: "switch", type: "checkbox", "data-checked": Boolean(props.isChecked) }),
119
119
  React__namespace.createElement(LabelWrapper, { htmlFor: props.id },
120
120
  React__namespace.createElement(Rail, { isChecked: props.isChecked },
121
121
  React__namespace.createElement(Button, { isChecked: props.isChecked })),
@@ -18,6 +18,7 @@ export { default as Divider } from './Divider/Divider';
18
18
  export { default as DnaLogo } from './DnaLogo/DnaLogo';
19
19
  export { default as Drawer } from './Drawer/Drawer';
20
20
  export { default as EmptyState } from './EmptyState/EmptyState';
21
+ export { default as EnergyLabel } from './EnergyLabel/EnergyLabel';
21
22
  export { default as Expander } from './Expander/Expander';
22
23
  export { default as Floater } from './Floater/Floater';
23
24
  export { default as Footer } from './Footer/Footer';
@@ -20,6 +20,7 @@ var Divider = require('./components/Divider/Divider.js');
20
20
  var DnaLogo = require('./components/DnaLogo/DnaLogo.js');
21
21
  var Drawer = require('./components/Drawer/Drawer.js');
22
22
  var EmptyState = require('./components/EmptyState/EmptyState.js');
23
+ var EnergyLabel = require('./components/EnergyLabel/EnergyLabel.js');
23
24
  var Expander = require('./components/Expander/Expander.js');
24
25
  var Floater = require('./components/Floater/Floater.js');
25
26
  var Footer = require('./components/Footer/Footer.js');
@@ -189,6 +190,7 @@ exports.Divider = Divider.default;
189
190
  exports.DnaLogo = DnaLogo.default;
190
191
  exports.Drawer = Drawer.default;
191
192
  exports.EmptyState = EmptyState.default;
193
+ exports.EnergyLabel = EnergyLabel.default;
192
194
  exports.Expander = Expander.default;
193
195
  exports.Floater = Floater.default;
194
196
  exports.Footer = Footer.default;
@@ -65,6 +65,10 @@ interface Props {
65
65
  * e.g., "important information" or "example."
66
66
  */
67
67
  ariaLabel?: string;
68
+ /**
69
+ * Screen reader live region policy for the box content
70
+ */
71
+ ariaLive?: 'off' | 'polite' | 'assertive';
68
72
  /**
69
73
  * Allows to pass a role to the component
70
74
  */
@@ -17,7 +17,7 @@ const BoxWrapper = styled__default.div `
17
17
  `;
18
18
  const Box = (_a) => {
19
19
  var { elevation = 'none', 'data-testid': dataTestId } = _a, props = __rest(_a, ["elevation", 'data-testid']);
20
- return (React__default.createElement(BoxWrapper, { id: props.id, "$elevation": elevation, shadow: props.shadow, width: props.width, height: props.height, margin: props.margin, padding: props.padding, className: props.className, "data-testid": dataTestId, role: props.role, "aria-label": props.ariaLabel }, props.children));
20
+ return (React__default.createElement(BoxWrapper, { id: props.id, "$elevation": elevation, shadow: props.shadow, width: props.width, height: props.height, margin: props.margin, padding: props.padding, className: props.className, "data-testid": dataTestId, role: props.role, "aria-label": props.ariaLabel, "aria-live": props.ariaLive }, props.children));
21
21
  };
22
22
 
23
23
  export { Box as default };
@@ -24,6 +24,10 @@ export interface Props {
24
24
  * Allows to change the type of resulting HTML element from button (`<button></button>`) to anchor (`<a href="..."></a>`)
25
25
  */
26
26
  href?: string;
27
+ /**
28
+ * Allows to set the target attribute for the link
29
+ */
30
+ target?: '_self' | '_blank' | '_parent' | '_top';
27
31
  /**
28
32
  * Content of Button component
29
33
  */
@@ -114,7 +114,7 @@ const Element = styled__default.button `
114
114
  /** @visibleName Button */
115
115
  const Button = (_a) => {
116
116
  var { type = 'submit', 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = __rest(_a, ["type", 'data-testid', 'data-no-close', 'data-track-value', 'aria-label']);
117
- return (React__default.createElement(Element, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, fullWidth: props.fullWidth, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-label": ariaLabel }, props.dataAttributes, (!props.href && {
117
+ return (React__default.createElement(Element, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, target: props.href ? props.target : undefined, rel: props.target === '_blank' ? 'noopener noreferrer' : undefined, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, fullWidth: props.fullWidth, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-label": ariaLabel }, props.dataAttributes, (!props.href && {
118
118
  name: props.name,
119
119
  disabled: props.disabled,
120
120
  })), props.loading ? (React__default.createElement(PixelLoader, { color: props.darkBg ? theme.color.default.white : theme.color.default.plum, label: props.loadingLabel })) : (React__default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))));
@@ -1,12 +1,11 @@
1
1
  import { __rest } from 'tslib';
2
2
  import { ChevronUp, ChevronRight, ChevronDown, ChevronLeft } from '@dnanpm/icons';
3
- import React__default, { isValidElement } from 'react';
3
+ import React__default, { isValidElement, cloneElement } from 'react';
4
4
  import styled__default from 'styled-components';
5
5
  import theme from '../../themes/theme.js';
6
6
  import { getMultipliedSize } from '../../utils/styledUtils.js';
7
7
  import ButtonPrimary from '../ButtonPrimary/ButtonPrimary.js';
8
8
  import ButtonSecondary from '../ButtonSecondary/ButtonSecondary.js';
9
- import Icon from '../Icon/Icon.js';
10
9
 
11
10
  const iconsMap = {
12
11
  up: ChevronUp,
@@ -64,7 +63,15 @@ const buttonsMap = {
64
63
  const ButtonArrow = (_a) => {
65
64
  var { variant = 'primary', 'data-testid': dataTestId, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = __rest(_a, ["variant", 'data-testid', 'data-track-value', 'aria-label']);
66
65
  const Element = buttonsMap[variant];
67
- return (React__default.createElement(Element, { id: props.id, href: props.href, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, darkBg: props.darkBg, disabled: props.disabled, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue, dataAttributes: props.dataAttributes, "aria-label": ariaLabel }, props.direction ? (React__default.createElement(Icon, { icon: iconsMap[props.direction], size: "1rem", "aria-hidden": true })) : (isValidElement(props.icon) && props.icon.type === Icon && props.icon)));
66
+ let iconElement = null;
67
+ if (props.direction) {
68
+ const IconComponent = iconsMap[props.direction];
69
+ iconElement = React__default.createElement(IconComponent, { size: "1rem" });
70
+ }
71
+ else if (isValidElement(props.icon)) {
72
+ iconElement = cloneElement(props.icon, { size: '1rem' });
73
+ }
74
+ return (React__default.createElement(Element, { id: props.id, href: props.href, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, darkBg: props.darkBg, disabled: props.disabled, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue, dataAttributes: props.dataAttributes, "aria-label": ariaLabel }, iconElement));
68
75
  };
69
76
 
70
77
  export { ButtonArrow as default };
@@ -30,6 +30,10 @@ interface Props extends Omit<ButtonProps, 'fullWidth'> {
30
30
  * Screen reader label describing the purpose of the ButtonIcon,
31
31
  */
32
32
  ariaLabel?: string;
33
+ /**
34
+ * Show the element with link color (pink)
35
+ */
36
+ isLinkStyle?: boolean;
33
37
  }
34
38
  /** @visibleName Button Icon */
35
39
  declare const ButtonIcon: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLButtonElement>>;