@dnanpm/styleguide 3.9.9 → 3.9.11

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 (45) hide show
  1. package/build/cjs/components/Chip/Chip.d.ts +18 -5
  2. package/build/cjs/components/Chip/Chip.js +32 -8
  3. package/build/cjs/components/MainHeaderNavigation/ChildComponents/DesktopMenu.d.ts +2 -2
  4. package/build/cjs/components/MainHeaderNavigation/ChildComponents/DesktopMenu.js +7 -10
  5. package/build/cjs/components/MainHeaderNavigation/ChildComponents/LinkModifier.js +2 -2
  6. package/build/cjs/components/MainHeaderNavigation/ChildComponents/MobileMenu.js +17 -26
  7. package/build/cjs/components/MainHeaderNavigation/context/MobileMenuContext.d.ts +1 -1
  8. package/build/cjs/components/MainHeaderNavigation/globalNavStyles.js +4 -19
  9. package/build/cjs/components/Notification/Notification.d.ts +18 -4
  10. package/build/cjs/components/Notification/Notification.js +25 -10
  11. package/build/cjs/components/NotificationBadge/NotificationBadge.d.ts +5 -1
  12. package/build/cjs/components/NotificationBadge/NotificationBadge.js +16 -2
  13. package/build/cjs/components/Pill/Pill.d.ts +15 -2
  14. package/build/cjs/components/Pill/Pill.js +61 -20
  15. package/build/cjs/components/PriorityNavigation/PriorityNavigation.d.ts +13 -1
  16. package/build/cjs/components/PriorityNavigation/PriorityNavigation.js +67 -28
  17. package/build/cjs/components/PriorityNavigationItem/PriorityNavigationItem.d.ts +1 -1
  18. package/build/cjs/components/PriorityNavigationItem/PriorityNavigationItem.js +7 -8
  19. package/build/cjs/components/Toaster/Toaster.d.ts +1 -1
  20. package/build/cjs/components/Toaster/Toaster.js +6 -7
  21. package/build/cjs/components/Tooltip/Tooltip.d.ts +5 -1
  22. package/build/cjs/components/Tooltip/Tooltip.js +46 -6
  23. package/build/es/components/Chip/Chip.d.ts +18 -5
  24. package/build/es/components/Chip/Chip.js +32 -8
  25. package/build/es/components/MainHeaderNavigation/ChildComponents/DesktopMenu.d.ts +2 -2
  26. package/build/es/components/MainHeaderNavigation/ChildComponents/DesktopMenu.js +7 -10
  27. package/build/es/components/MainHeaderNavigation/ChildComponents/LinkModifier.js +2 -2
  28. package/build/es/components/MainHeaderNavigation/ChildComponents/MobileMenu.js +18 -27
  29. package/build/es/components/MainHeaderNavigation/context/MobileMenuContext.d.ts +1 -1
  30. package/build/es/components/MainHeaderNavigation/globalNavStyles.js +4 -19
  31. package/build/es/components/Notification/Notification.d.ts +18 -4
  32. package/build/es/components/Notification/Notification.js +26 -11
  33. package/build/es/components/NotificationBadge/NotificationBadge.d.ts +5 -1
  34. package/build/es/components/NotificationBadge/NotificationBadge.js +16 -2
  35. package/build/es/components/Pill/Pill.d.ts +15 -2
  36. package/build/es/components/Pill/Pill.js +61 -20
  37. package/build/es/components/PriorityNavigation/PriorityNavigation.d.ts +13 -1
  38. package/build/es/components/PriorityNavigation/PriorityNavigation.js +68 -29
  39. package/build/es/components/PriorityNavigationItem/PriorityNavigationItem.d.ts +1 -1
  40. package/build/es/components/PriorityNavigationItem/PriorityNavigationItem.js +7 -8
  41. package/build/es/components/Toaster/Toaster.d.ts +1 -1
  42. package/build/es/components/Toaster/Toaster.js +6 -7
  43. package/build/es/components/Tooltip/Tooltip.d.ts +5 -1
  44. package/build/es/components/Tooltip/Tooltip.js +46 -6
  45. package/package.json +8 -8
@@ -10,20 +10,24 @@ interface Props {
10
10
  /**
11
11
  * Allows to change the color styling of component, depending on the passed type
12
12
  *
13
- * @param {ChipType} default Uses `theme.color.line.L01` color for styling
14
- * @param {ChipType} info Uses `theme.color.notification.info` color for styling
13
+ * @param {ChipType} default Uses default color: `theme.color.line.L01`
14
+ * @param {ChipType} info Changes color to default color (this type will be deprecated in the future)
15
15
  * @param {ChipType} success Uses `theme.color.notification.success` color for styling
16
- * @param {ChipType} warning Uses `theme.color.notification.warning` color for styling
16
+ * @param {ChipType} warning Changes color to default color (this type will be deprecated in the future)
17
17
  * @param {ChipType} error Uses `theme.color.notification.error` color for styling
18
18
  *
19
+ * @deprecated The 'info' and 'warning' types will be deprecated and removed in the next major release.
20
+ *
19
21
  * @default 'default'
20
22
  */
21
23
  type?: ChipType;
22
24
  /**
23
25
  * Allows to change the appearance styling of component, depending on passed variant
24
26
  *
25
- * @param {ChipVariant} outlined Displays the component with border color depending on the `type` property
26
- * @param {ChipVariant} filled Displays the component with background color depending on the `type` property
27
+ * @param {ChipVariant} outlined
28
+ * @param {ChipVariant} filled
29
+ *
30
+ * @deprecated The styles are now encapsulated within the component. The 'variant' prop will be removed in the next major release.
27
31
  *
28
32
  * @default 'outlined'
29
33
  */
@@ -44,6 +48,15 @@ interface Props {
44
48
  * Allows to pass testid string for testing purposes
45
49
  */
46
50
  'data-testid'?: string;
51
+ /**
52
+ * Allows to pass an accessible label for the component.
53
+ */
54
+ ariaLabel?: string;
55
+ /**
56
+ * Provides additional information about the Chip not included in the aria-label.
57
+ * This attribute should reference the ID of a related text element for context.
58
+ */
59
+ ariaDescribedBy?: string;
47
60
  }
48
61
  declare const Chip: ({ type, variant, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
49
62
  /** @component */
@@ -13,14 +13,31 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
13
13
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
14
14
  var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
15
15
 
16
- const getStyling = ({ $type, $variant, }) => {
17
- const stylingColor = $type === 'default' ? theme.default.color.line.L01 : theme.default.color.notification[$type];
18
- const border = `border: 2px solid ${stylingColor};`;
19
- const background = `background-color: ${$variant === 'outlined' ? theme.default.color.background.white.default : stylingColor};`;
20
- const color = `color: ${$variant === 'outlined' ? theme.default.color.text.black : theme.default.color.text.white};`;
21
- return `${border}${background}${color}`;
16
+ const getStyling = ({ $type }) => {
17
+ switch ($type) {
18
+ case 'success':
19
+ return `
20
+ color: ${theme.default.color.text.white};
21
+ border: 2px solid ${theme.default.color.notification.success};
22
+ background-color: ${theme.default.color.notification.success};
23
+ `;
24
+ case 'error':
25
+ return `
26
+ color: ${theme.default.color.text.black};
27
+ border: 2px solid ${theme.default.color.notification.error};
28
+ background-color: ${theme.default.color.background.white.default};
29
+ `;
30
+ case 'default':
31
+ default:
32
+ return `
33
+ color: ${theme.default.color.text.black};
34
+ border: 2px solid ${theme.default.color.line.L01};
35
+ background-color: ${theme.default.color.background.white.default};
36
+ `;
37
+ }
22
38
  };
23
39
  const Element = styled__default.default.div `
40
+ all: unset;
24
41
  display: inline-block;
25
42
  border-radius: ${theme.default.radius.pill};
26
43
  padding: 1px ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1)};
@@ -30,11 +47,18 @@ const Element = styled__default.default.div `
30
47
  text-align: center;
31
48
  ${({ onClick }) => onClick && `cursor: pointer`};
32
49
 
33
- ${({ $type, $variant }) => getStyling({ $type, $variant })}
50
+ ${({ $type }) => getStyling({ $type })}
51
+
52
+ &:focus-visible {
53
+ outline: none;
54
+ box-shadow: 0px 0px 0px 2px ${theme.default.color.focus.light},
55
+ 0px 0px 0px 4px ${theme.default.color.focus.dark};
56
+ }
34
57
  `;
35
58
  const Chip = (_a) => {
36
59
  var { type = 'default', variant = 'outlined', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["type", "variant", 'data-testid']);
37
- return (React__default.default.createElement(Element, { id: props.id, "$type": type, "$variant": variant, onClick: props.onClick, className: props.className, "data-testid": dataTestId }, props.children));
60
+ const label = props.ariaLabel || (typeof props.children === 'string' ? props.children : undefined);
61
+ return (React__default.default.createElement(Element, { as: props.onClick ? 'button' : 'div', id: props.id, "$type": type, "$variant": variant, onClick: props.onClick, className: props.className, "data-testid": dataTestId, "aria-label": label, "aria-describedby": props.ariaDescribedBy, tabIndex: 0 }, props.children));
38
62
  };
39
63
 
40
64
  exports.default = Chip;
@@ -1,3 +1,3 @@
1
- import type { FC } from 'react';
2
- declare const DesktopMenu: FC;
1
+ import React from 'react';
2
+ declare const DesktopMenu: () => React.JSX.Element | null;
3
3
  export default DesktopMenu;
@@ -9,7 +9,6 @@ var styled = require('../../../themes/styled.js');
9
9
  var theme = require('../../../themes/theme.js');
10
10
  var navigation = require('../../../themes/themeComponents/navigation.js');
11
11
  var styledUtils = require('../../../utils/styledUtils.js');
12
- var Icon = require('../../Icon/Icon.js');
13
12
  var NavContext = require('../context/NavContext.js');
14
13
  var globalNavStyles = require('../globalNavStyles.js');
15
14
  var LinkModifier = require('./LinkModifier.js');
@@ -77,7 +76,6 @@ const SubMenuItem = styled.default.li `
77
76
  > a {
78
77
  color: ${p => (p.isHighlighted ? theme.default.color.text.pink : theme.default.color.text.black)};
79
78
  font-weight: ${p => (p.isHighlighted ? theme.default.fontWeight.bold : theme.default.fontWeight.book)};
80
- }
81
79
  }
82
80
  `;
83
81
  const DesktopMenuList = styled.default(globalNavStyles.MenuList) `
@@ -173,16 +171,16 @@ const MenuItemWithChildren = ({ menuItem, currentLevel }) => {
173
171
  const menuClickMain = (element) => () => {
174
172
  handleNavMenuClick(element.id, 'level1');
175
173
  };
176
- return (React__default.default.createElement(DesktopMenuItem, { isActive: LinkModifier.isSelected(currentUrl, menuItem.urls[lang]), "data-testid": `desktop-nav-item-level-1-${currentLevel + 1}`, role: "presentation" },
177
- React__default.default.createElement(globalNavStyles.MenuLinkWithChildren, { isOpen: menuLevel.level1 === menuItem.id, onClick: menuClickMain(menuItem), role: "menuitem", "aria-haspopup": "true", "data-testid": "menu-button-with-children" },
174
+ return (React__default.default.createElement(DesktopMenuItem, { isActive: LinkModifier.isSelected(currentUrl, menuItem.urls[lang]), "data-testid": `desktop-nav-item-level-1-${currentLevel + 1}` },
175
+ React__default.default.createElement(globalNavStyles.MenuLinkWithChildren, { isOpen: menuLevel.level1 === menuItem.id, onClick: menuClickMain(menuItem), "data-testid": "menu-button-with-children" },
178
176
  React__default.default.createElement("span", null, menuItem.titles[lang]),
179
- React__default.default.createElement(Icon.default, { icon: icons.ChevronRight, size: "1rem" })),
177
+ React__default.default.createElement(icons.ChevronRight, { size: "1rem" })),
180
178
  React__default.default.createElement(SubMenuLevel1, { menuItem: menuItem })));
181
179
  };
182
180
  const DesktopMenu = () => {
183
181
  var _a;
184
182
  const { items, lang, resetMenuEvents, menuLevel, currentUrl, collapseSize } = React.useContext(NavContext.default);
185
- const mainNavigation = ((_a = items === null || items === void 0 ? void 0 : items.mainNavigation) === null || _a === void 0 ? void 0 : _a.pages) || [];
183
+ const mainNavigation = ((_a = items.mainNavigation) === null || _a === void 0 ? void 0 : _a.pages) || [];
186
184
  const ref = React.useRef(null);
187
185
  useOutsideClick.default(ref, () => {
188
186
  if (menuLevel.level1 || menuLevel.level2) {
@@ -192,13 +190,12 @@ const DesktopMenu = () => {
192
190
  if (!mainNavigation.length) {
193
191
  return null;
194
192
  }
195
- return (React__default.default.createElement(DesktopMenuList, { role: "menu", "aria-hidden": false, ref: ref, "data-testid": "desktop-nav-menu-ul", collapseSize: collapseSize }, mainNavigation.map((navElement, index) => {
196
- var _a;
197
- const displaySubMenu = !navElement.pageIsLinkInDesktopNavigation && !!((_a = navElement.pages) === null || _a === void 0 ? void 0 : _a.length);
193
+ return (React__default.default.createElement(DesktopMenuList, { "aria-hidden": false, ref: ref, "data-testid": "desktop-nav-menu-ul", collapseSize: collapseSize }, mainNavigation.map((navElement, index) => {
194
+ const displaySubMenu = !navElement.pageIsLinkInDesktopNavigation && !!navElement.pages.length;
198
195
  if (displaySubMenu) {
199
196
  return (React__default.default.createElement(MenuItemWithChildren, { menuItem: navElement, key: navElement.id, currentLevel: index }));
200
197
  }
201
- return (React__default.default.createElement(DesktopMenuItem, { key: navElement.id, role: "presentation", "data-testid": `desktop-nav-item-level-1-${index + 1}`, isActive: LinkModifier.isSelected(currentUrl, navElement.urls[lang]) },
198
+ return (React__default.default.createElement(DesktopMenuItem, { key: navElement.id, "data-testid": `desktop-nav-item-level-1-${index + 1}`, isActive: LinkModifier.isSelected(currentUrl, navElement.urls[lang]) },
202
199
  React__default.default.createElement(LinkModifier.default, { menuItem: navElement, tabIndex: false })));
203
200
  })));
204
201
  };
@@ -28,8 +28,8 @@ const LinkModifier = ({ menuItem, tabIndex, showIcon }) => {
28
28
  const { lang, nextJSLinkComponent, resetMenuEvents } = React.useContext(NavContext.default);
29
29
  const menuItemLink = menuItem.urls[lang] || '';
30
30
  const isExternalLink = menuItem.target === '_blank';
31
- const MenuLinkComponent = (React__default.default.createElement(globalNavStyles.MenuLink, { href: menuItemLink, id: menuItem.id, onClick: resetMenuEvents, role: "menuitem", tabIndex: tabIndex ? -1 : undefined, target: isExternalLink ? '_blank' : '_self' },
32
- showIcon && (React__default.default.createElement(Icon.default, { icon: isExternalLink ? icons.Open : icons.ArrowRight, size: "1rem", color: theme.default.color.default.pink })),
31
+ const MenuLinkComponent = (React__default.default.createElement(globalNavStyles.MenuLink, { href: menuItemLink, id: menuItem.id, onClick: resetMenuEvents, tabIndex: tabIndex ? -1 : undefined, target: isExternalLink ? '_blank' : '_self' },
32
+ showIcon && (React__default.default.createElement(Icon.default, { icon: isExternalLink ? icons.Open : icons.ArrowRight, size: "1.25rem", color: theme.default.color.default.pink })),
33
33
  React__default.default.createElement("span", null, menuItem.titles[lang])));
34
34
  if (nextJSLinkComponent && !isMenuItemLinkAbsolute(menuItemLink)) {
35
35
  const NextJSLinkComponent = nextJSLinkComponent;
@@ -9,7 +9,6 @@ var styled = require('../../../themes/styled.js');
9
9
  var theme = require('../../../themes/theme.js');
10
10
  var navigation = require('../../../themes/themeComponents/navigation.js');
11
11
  var styledUtils = require('../../../utils/styledUtils.js');
12
- var Icon = require('../../Icon/Icon.js');
13
12
  var MobileMenuContext = require('../context/MobileMenuContext.js');
14
13
  var NavContext = require('../context/NavContext.js');
15
14
  var globalNavStyles = require('../globalNavStyles.js');
@@ -19,8 +18,9 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
19
18
 
20
19
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
21
20
 
22
- const MobileMenuWrapper = styled.default.div `
21
+ const MobileMenuWrapper = styled.default(reactSpring.animated.div) `
23
22
  width: ${100 * navigation.menuLevelsAmount}%;
23
+ display: flex;
24
24
  button {
25
25
  border: 0;
26
26
  background: transparent;
@@ -36,16 +36,15 @@ const MobileMenuContainer = styled.default.div `
36
36
  overflow: hidden;
37
37
  overflow-y: auto;
38
38
  transition: max-height 0.2s ease-in-out;
39
- background: ${theme.default.color.background.white.default};
39
+ background-color: ${theme.default.color.background.sand.default};
40
40
  max-height: ${mobileMenu};
41
41
  height: ${mobileMenu};
42
42
  max-width: ${navigation.mobileNavMaxWidth};
43
43
  ${globalNavStyles.MenuList} {
44
44
  display: block;
45
- float: left;
46
45
  width: ${100 / navigation.menuLevelsAmount}%;
47
46
  position: relative;
48
- min-height: ${mobileMenu};
47
+ border-top: 4px solid ${theme.default.color.background.white.default};
49
48
  &:first-of-type {
50
49
  background: ${theme.default.color.background.white.default};
51
50
  > ${globalNavStyles.MenuItem} > ${globalNavStyles.MenuLink} {
@@ -58,17 +57,12 @@ const MobileMenuContainer = styled.default.div `
58
57
  }
59
58
  ${globalNavStyles.MenuItem} {
60
59
  border-bottom: 1px solid ${theme.default.color.line.L04};
61
- &:last-of-type {
62
- margin-bottom: ${navigation.headerMaxHeight}; // make sure items are visible in different devices which might calculate vh differently
63
- }
64
60
  }
61
+ margin-bottom: ${navigation.headerMaxHeight}; // make sure items are visible in different devices which might calculate vh differently
65
62
  }
66
63
  ${globalNavStyles.MenuLink}, ${globalNavStyles.MenuLinkWithChildren} {
67
64
  line-height: ${theme.default.lineHeight.default};
68
- padding: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1.75)}
69
- ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1.5)}
70
- ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1.75)}
71
- ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
65
+ padding: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
72
66
  font-size: ${theme.default.fontSize.default};
73
67
  display: flex;
74
68
  flex-grow: 1;
@@ -85,7 +79,7 @@ const MobileMenuContainer = styled.default.div `
85
79
  color: ${theme.default.color.text.pink};
86
80
  justify-content: flex-start;
87
81
  gap: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1)};
88
- height: auto;
82
+ height: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 6)};
89
83
  }
90
84
  ${globalNavStyles.FeaturedBlock} {
91
85
  border-bottom: 1px solid ${theme.default.color.line.L04};
@@ -97,7 +91,6 @@ const MobileMenuContainer = styled.default.div `
97
91
  }
98
92
  }
99
93
  `;
100
- const useTabNavigationDisabled = (scrollPosition, indexLevel) => scrollPosition !== indexLevel;
101
94
  const MenuItemBackLink = ({ currentLevel }) => {
102
95
  const { handleNavMenuClick, lang, menuLevel: { scrollPosition }, level1Items, level2Items, getBackLink, } = React.useContext(NavContext.default);
103
96
  const levels = {
@@ -112,17 +105,16 @@ const MenuItemBackLink = ({ currentLevel }) => {
112
105
  const tabNavigationDisabled = scrollPosition !== currentLevel - 1;
113
106
  const backLink = getBackLink(menuElements, currentLevel - 1);
114
107
  return (React__default.default.createElement(globalNavStyles.MenuItem, { key: `back-${backLink.id}`, "data-testid": `mobile-nav-menu-backlink-level-${currentLevel}` },
115
- React__default.default.createElement(MenuLinkBackLink, { role: "menuitem", as: "button", onClick: mobileMenuBackClick, tabIndex: tabNavigationDisabled ? -1 : undefined },
116
- React__default.default.createElement(Icon.default, { icon: icons.ChevronLeft, size: "1rem" }),
108
+ React__default.default.createElement(MenuLinkBackLink, { as: "button", onClick: mobileMenuBackClick, tabIndex: tabNavigationDisabled ? -1 : undefined },
109
+ React__default.default.createElement(icons.ChevronLeft, { size: "1.5rem" }),
117
110
  backLink.titles[lang])));
118
111
  };
119
112
  const CreateSubMenuItem = ({ menuItem, currentLevel, itemIndex }) => {
120
- var _a;
121
113
  const { handleNavMenuClick, menuLevel, lang, currentUrl } = React.useContext(NavContext.default);
122
114
  const { mobileMenuRef } = React.useContext(MobileMenuContext.default);
123
- const hasChildren = (_a = menuItem === null || menuItem === void 0 ? void 0 : menuItem.pages) === null || _a === void 0 ? void 0 : _a.length;
115
+ const hasChildren = menuItem.pages.length;
124
116
  const indexLevel = currentLevel - 1;
125
- const tabNavigationDisabled = useTabNavigationDisabled(menuLevel.scrollPosition, indexLevel);
117
+ const tabNavigationDisabled = menuLevel.scrollPosition !== indexLevel;
126
118
  const menuUrl = menuItem.urls[lang] || '';
127
119
  const mobileMenuClick = (element) => (e) => {
128
120
  var _a, _b;
@@ -134,11 +126,11 @@ const CreateSubMenuItem = ({ menuItem, currentLevel, itemIndex }) => {
134
126
  e.preventDefault();
135
127
  handleNavMenuClick(element.id, `level${currentLevel}Mobile`);
136
128
  };
137
- const renderMenuItem = (children) => (React__default.default.createElement(globalNavStyles.MenuItem, { key: menuItem.id, role: "presentation", "data-testid": `mobile-menu-level-${currentLevel}-link-${itemIndex + 1}`, isActive: LinkModifier.isSelected(currentUrl, menuUrl, true) }, children));
129
+ const renderMenuItem = (children) => (React__default.default.createElement(globalNavStyles.MenuItem, { key: menuItem.id, "data-testid": `mobile-menu-level-${currentLevel}-link-${itemIndex + 1}`, isActive: LinkModifier.isSelected(currentUrl, menuUrl, true) }, children));
138
130
  if (hasChildren && currentLevel < 3) {
139
- return renderMenuItem(React__default.default.createElement(globalNavStyles.MenuLink, { as: "button", onClick: mobileMenuClick(menuItem), role: "menuitem", tabIndex: tabNavigationDisabled ? -1 : undefined },
131
+ return renderMenuItem(React__default.default.createElement(globalNavStyles.MenuLink, { as: "button", onClick: mobileMenuClick(menuItem), tabIndex: tabNavigationDisabled ? -1 : undefined },
140
132
  menuItem.titles[lang],
141
- React__default.default.createElement(Icon.default, { icon: icons.ChevronRight, color: theme.default.color.default.pink })));
133
+ React__default.default.createElement(icons.ChevronRight, { color: theme.default.color.default.pink })));
142
134
  }
143
135
  return renderMenuItem(React__default.default.createElement(LinkModifier.default, { menuItem: menuItem, tabIndex: tabNavigationDisabled }));
144
136
  };
@@ -146,7 +138,7 @@ const SubMenuMobile = ({ currentLevel, menuItem }) => {
146
138
  const featuredItems = menuItem.pages.filter(subMenuItem => !subMenuItem.pages.length && currentLevel === 2);
147
139
  const indexLevel = currentLevel - 1;
148
140
  const { collapseSize, menuLevel: { scrollPosition }, } = React.useContext(NavContext.default);
149
- const tabNavigationDisabled = useTabNavigationDisabled(scrollPosition, indexLevel);
141
+ const tabNavigationDisabled = scrollPosition !== indexLevel;
150
142
  if (!menuItem.pages.length) {
151
143
  return null;
152
144
  }
@@ -186,9 +178,8 @@ const RenderMobileMenu = () => {
186
178
  }
187
179
  return (React__default.default.createElement(MobileMenuContainer, { ref: mobileMenuRef },
188
180
  React__default.default.createElement(MobileMenuContext.default.Provider, { value: mobileMenuContext },
189
- React__default.default.createElement(MobileMenuWrapper, null,
190
- React__default.default.createElement(reactSpring.animated.div, { style: slidingMenuAnimation },
191
- React__default.default.createElement(NavigationMenuMobile, null))))));
181
+ React__default.default.createElement(MobileMenuWrapper, { style: slidingMenuAnimation },
182
+ React__default.default.createElement(NavigationMenuMobile, null)))));
192
183
  };
193
184
 
194
185
  exports.default = RenderMobileMenu;
@@ -1,5 +1,5 @@
1
1
  import type { RefObject } from 'react';
2
- interface MobileMenuContextProps {
2
+ export interface MobileMenuContextProps {
3
3
  mobileMenuRef: RefObject<HTMLElement> | null;
4
4
  }
5
5
  declare const MobileMenuContext: import("react").Context<MobileMenuContextProps>;
@@ -29,14 +29,9 @@ const MobileMenuButton = styled.default.button `
29
29
  border: 0;
30
30
  padding: 0;
31
31
  background: transparent;
32
- svg {
33
- color: ${theme.default.color.text.black};
34
- fill: ${theme.default.color.text.black};
35
- }
36
32
  &:focus,
37
33
  &:active {
38
34
  svg {
39
- color: ${theme.default.color.text.pink};
40
35
  fill: ${theme.default.color.text.pink};
41
36
  }
42
37
  }
@@ -47,6 +42,9 @@ const MobileMenuButton = styled.default.button `
47
42
  0px 0px 0px 4px ${theme.default.color.focus.dark};
48
43
  color: ${theme.default.color.text.black};
49
44
  }
45
+ svg {
46
+ fill: ${theme.default.color.text.black};
47
+ }
50
48
  `;
51
49
  const HeaderIconContainer = styled.default.div `
52
50
  display: flex;
@@ -76,9 +74,6 @@ const MenuItem = styled.default.li `
76
74
  padding: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 0.5)}
77
75
  ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 3)};
78
76
  }
79
- > button {
80
- background-color: ${theme.default.color.background.white};
81
- }
82
77
  > button,
83
78
  > a {
84
79
  color: ${p => (p.isActive ? theme.default.color.text.pink : theme.default.color.text.black)};
@@ -99,14 +94,6 @@ const MenuLink = styled.default.a `
99
94
  overflow: visible;
100
95
  text-decoration: none;
101
96
  color: ${p => (p.isActive ? theme.default.color.text.pink : theme.default.color.text.black)};
102
- &:hover,
103
- &:focus {
104
- color: ${theme.default.color.hover.pink};
105
- text-underline-offset: 0.2em;
106
- -webkit-text-decoration-skip: ink;
107
- text-decoration-skip-ink: auto;
108
- text-decoration-thickness: from-font;
109
- }
110
97
  `;
111
98
  const MenuLinkWithChildren = styled.default.button `
112
99
  line-height: ${theme.default.lineHeight.xs};
@@ -125,7 +112,7 @@ const MenuLinkWithChildren = styled.default.button `
125
112
  cursor: pointer;
126
113
  outline: none;
127
114
  }
128
- > span > svg {
115
+ > svg {
129
116
  transform: rotate( ${p => (p.isOpen ? '270deg' : '90deg')});
130
117
  transition: transform .2s ease-in-out;
131
118
  }
@@ -135,8 +122,6 @@ const MenuLinkWithChildren = styled.default.button `
135
122
  const MenuList = styled.default.ul `
136
123
  display: flex;
137
124
  max-height: ${p => (typeof p.isInView !== 'boolean' || p.isInView ? 'auto' : '5px')};
138
- overflow: ${p => (typeof p.isInView === 'boolean' ? 'hidden' : 'unset')};
139
- list-style: none;
140
125
  margin: 0;
141
126
  padding: 0;
142
127
  background-color: ${theme.default.color.background.white};
@@ -16,13 +16,17 @@ interface Props {
16
16
  /**
17
17
  * Content of the component
18
18
  */
19
- children?: ReactNode;
19
+ children: ReactNode;
20
20
  /**
21
21
  * Allows to show and hide close button
22
22
  *
23
23
  * @default false
24
24
  */
25
25
  closeButton?: boolean;
26
+ /**
27
+ * Label for the close button
28
+ */
29
+ closeButtonLabel?: string;
26
30
  /**
27
31
  * On close button click callback
28
32
  */
@@ -41,8 +45,18 @@ interface Props {
41
45
  * Allows to pass testid string for testing purposes
42
46
  */
43
47
  'data-testid'?: string;
48
+ /**
49
+ * If true, the component is treated as static (non-interactive),
50
+ * and uses `aria-label` instead of `role="alert"`.
51
+ *
52
+ * @default false
53
+ */
54
+ isStatic?: boolean;
55
+ /**
56
+ * Accessible label for the notification. Required when `isStatic` is true
57
+ * and no type-based default label is desired.
58
+ */
59
+ ariaLabel?: string;
44
60
  }
45
- /** @visibleName Notification */
46
- declare const Notification: ({ type, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element | null;
47
- /** @component */
61
+ declare const Notification: ({ type, "data-testid": dataTestId, isStatic, className, children, closeButton, closeButtonLabel, onClickCloseButton, dismissed, ariaLabel, }: Props) => React.JSX.Element | null;
48
62
  export default Notification;
@@ -2,7 +2,6 @@
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 styled = require('styled-components');
@@ -21,7 +20,7 @@ const iconsMap = {
21
20
  warning: icons.Warning,
22
21
  error: icons.Error,
23
22
  };
24
- const NotificationWrapper = styled__default.default.div `
23
+ const sharedStyles = styled.css `
25
24
  display: flex;
26
25
  gap: 1rem;
27
26
  line-height: ${theme.default.lineHeight.default};
@@ -30,6 +29,14 @@ const NotificationWrapper = styled__default.default.div `
30
29
  border-radius: ${theme.default.radius.s};
31
30
  border: 2px solid ${({ $type }) => theme.default.color.notification[$type]};
32
31
  `;
32
+ const NotificationWrapper = styled__default.default.div `
33
+ ${sharedStyles}
34
+ border-color: ${({ $type }) => theme.default.color.notification[$type]};
35
+ `;
36
+ const StaticWrapper = styled__default.default.section `
37
+ ${sharedStyles}
38
+ border-color: ${({ $type }) => theme.default.color.notification[$type]};
39
+ `;
33
40
  const IconWrapper = styled__default.default.div `
34
41
  display: flex;
35
42
  align-items: center;
@@ -44,16 +51,24 @@ const ContentWrapper = styled__default.default.span `
44
51
  const ButtonCloseStyled = styled__default.default(ButtonClose.default) `
45
52
  position: static;
46
53
  margin: auto 0.5rem;
54
+
55
+ &:focus-visible {
56
+ outline: none;
57
+ box-shadow: 0px 0px 0px 2px ${theme.default.color.focus.light},
58
+ 0px 0px 0px 4px ${theme.default.color.focus.dark};
59
+ }
47
60
  `;
48
- /** @visibleName Notification */
49
- const Notification = (_a) => {
50
- var { type = 'info', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["type", 'data-testid']);
51
- return !props.dismissed ? (React__default.default.createElement(NotificationWrapper, { "$type": type, className: props.className, "data-testid": dataTestId },
61
+ const Notification = ({ type = 'info', 'data-testid': dataTestId, isStatic = false, className, children, closeButton = false, closeButtonLabel, onClickCloseButton, dismissed = false, ariaLabel, }) => {
62
+ if (dismissed)
63
+ return null;
64
+ const IconToUse = iconsMap[type];
65
+ const renderContent = () => (React__default.default.createElement(React__default.default.Fragment, null,
52
66
  React__default.default.createElement(IconWrapper, { "$type": type },
53
- React__default.default.createElement(Icon.default, { icon: iconsMap[type], size: "2rem", color: theme.default.color.default.white })),
54
- React__default.default.createElement(ContentWrapper, null, props.children),
55
- props.closeButton && (React__default.default.createElement(ButtonCloseStyled, { onClick: props.onClickCloseButton },
56
- React__default.default.createElement(Icon.default, { icon: icons.Close, color: "currentColor" }))))) : null;
67
+ React__default.default.createElement(Icon.default, { icon: IconToUse, size: "2rem", color: theme.default.color.default.white, "aria-hidden": true })),
68
+ React__default.default.createElement(ContentWrapper, null, children),
69
+ closeButton && (React__default.default.createElement(ButtonCloseStyled, { onClick: onClickCloseButton, "aria-label": closeButtonLabel },
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()));
57
72
  };
58
73
 
59
74
  exports.default = Notification;
@@ -35,8 +35,12 @@ interface Props {
35
35
  * Allows to pass testid string for testing purposes
36
36
  */
37
37
  'data-testid'?: string;
38
+ /**
39
+ * Screen reader label for the badge (visually hidden)
40
+ */
41
+ visuallyHiddenText?: string;
38
42
  }
39
43
  /** @visibleName Notification Badge */
40
- declare const NotificationBadge: ({ "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
44
+ declare const NotificationBadge: ({ "data-testid": dataTestId, visuallyHiddenText, ...props }: Props) => React.JSX.Element;
41
45
  /** @component */
42
46
  export default NotificationBadge;
@@ -26,10 +26,24 @@ const NotificationBadgeElement = styled.default.div `
26
26
  background-color: ${theme.default.color.notification.error};
27
27
  border-radius: ${theme.default.radius.circle};
28
28
  `;
29
+ const VisuallyHidden = styled.default.span `
30
+ position: absolute;
31
+ width: 1px;
32
+ height: 1px;
33
+ padding: 0;
34
+ margin: -1px;
35
+ overflow: hidden;
36
+ clip: rect(0 0 0 0);
37
+ clip-path: inset(50%);
38
+ white-space: nowrap;
39
+ border: 0;
40
+ `;
29
41
  /** @visibleName Notification Badge */
30
42
  const NotificationBadge = (_a) => {
31
- var { 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ['data-testid']);
32
- return (React__default.default.createElement(NotificationBadgeElement, { id: props.id, position: props.position, top: props.top, right: props.right, className: props.className, "data-testid": dataTestId }, props.children));
43
+ var { 'data-testid': dataTestId, visuallyHiddenText } = _a, props = tslib.__rest(_a, ['data-testid', "visuallyHiddenText"]);
44
+ return (React__default.default.createElement(React__default.default.Fragment, null,
45
+ visuallyHiddenText && React__default.default.createElement(VisuallyHidden, null, visuallyHiddenText),
46
+ React__default.default.createElement(NotificationBadgeElement, { id: props.id, position: props.position, top: props.top, right: props.right, className: props.className, "data-testid": dataTestId, "aria-hidden": "true" }, props.children)));
33
47
  };
34
48
 
35
49
  exports.default = NotificationBadge;
@@ -4,7 +4,11 @@ type PillType = 'none' | 'checkbox' | 'radio';
4
4
  type Position = 'auto' | 'left' | 'right' | 'middle';
5
5
  interface Props {
6
6
  /**
7
- * Unique ID for the input element
7
+ * Unique ID
8
+ *
9
+ * This ID is used to associate the label with the input for
10
+ * "checkbox" and "radio" types. For "none" types, the ID
11
+ * is applied directly to the button element.
8
12
  */
9
13
  id: string;
10
14
  /**
@@ -14,7 +18,7 @@ interface Props {
14
18
  /**
15
19
  * Allows to change the functionality of component while retaining style
16
20
  *
17
- * @param {PillType} none No functionality
21
+ * @param {PillType} none Acts as a button
18
22
  * @param {PillType} checkbox Acts as a checkbox input type
19
23
  * @param {PillType} radio Acts as a radiobutton input type
20
24
  *
@@ -72,7 +76,16 @@ interface Props {
72
76
  * Allows to pass a custom className
73
77
  */
74
78
  className?: string;
79
+ /**
80
+ * A styled version that is designed to look like the default Button component
81
+ */
82
+ isDefaultButtonStyle?: boolean;
83
+ /**
84
+ * A screen reader label that describes the purpose of the Pill component when the default text is not sufficiently descriptive.
85
+ */
86
+ ariaLabel?: string;
75
87
  }
76
88
  declare const Pill: ({ type, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
77
89
  /** @component */
78
90
  export default Pill;
91
+ export { PillType, Position };