@dnanpm/styleguide 3.9.5 → 3.9.7

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 (85) hide show
  1. package/build/cjs/components/AccordionItem/AccordionItem.d.ts +5 -1
  2. package/build/cjs/components/AccordionItem/AccordionItem.js +17 -7
  3. package/build/cjs/components/Box/Box.d.ts +10 -1
  4. package/build/cjs/components/Box/Box.js +1 -1
  5. package/build/cjs/components/ButtonIcon/ButtonIcon.d.ts +6 -0
  6. package/build/cjs/components/ButtonIcon/ButtonIcon.js +2 -2
  7. package/build/cjs/components/EmptyState/EmptyState.d.ts +4 -0
  8. package/build/cjs/components/EmptyState/EmptyState.js +2 -2
  9. package/build/cjs/components/Expander/Expander.js +8 -2
  10. package/build/cjs/components/Footer/Components/FooterComponents.js +9 -5
  11. package/build/cjs/components/Footer/Footer.js +4 -0
  12. package/build/cjs/components/Icon/Icon.d.ts +9 -1
  13. package/build/cjs/components/Icon/Icon.js +2 -2
  14. package/build/cjs/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +1 -0
  15. package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.d.ts +7 -4
  16. package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +3 -0
  17. package/build/cjs/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +5 -5
  18. package/build/cjs/components/MainHeaderNavigation/context/NavContext.d.ts +5 -5
  19. package/build/cjs/components/MainHeaderNavigation/globalNavStyles.d.ts +27 -0
  20. package/build/cjs/components/MainNavigation/ChildComponents/BusinessMenu.js +1 -0
  21. package/build/cjs/components/MainNavigation/ChildComponents/HeaderNavigationElements.d.ts +3 -0
  22. package/build/cjs/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +3 -0
  23. package/build/cjs/components/MainNavigation/globalNavStyles.d.ts +12 -0
  24. package/build/cjs/components/PixelLoader/PixelLoader.d.ts +4 -0
  25. package/build/cjs/components/PixelLoader/PixelLoader.js +1 -0
  26. package/build/cjs/components/PriorityNavigationItem/PriorityNavigationItem.js +1 -0
  27. package/build/cjs/components/ProgressIndicator/ProgressIndicator.d.ts +8 -0
  28. package/build/cjs/components/ProgressIndicator/ProgressIndicator.js +12 -5
  29. package/build/cjs/components/SecondaryNavigation/SecondaryNavigation.js +1 -0
  30. package/build/cjs/components/Selectbox/Selectbox.d.ts +18 -1
  31. package/build/cjs/components/Selectbox/Selectbox.js +18 -11
  32. package/build/cjs/components/Switch/Switch.d.ts +6 -1
  33. package/build/cjs/components/Switch/Switch.js +12 -4
  34. package/build/cjs/components/Tab/Tab.js +10 -2
  35. package/build/cjs/components/Tabs/Tabs.js +13 -1
  36. package/build/cjs/components/TooltipMenu/ChildComponents/TooltipMenuExportedStyles.d.ts +6 -0
  37. package/build/cjs/themes/globalStyles.d.ts +9 -0
  38. package/build/cjs/themes/globalStyles.js +13 -4
  39. package/build/cjs/themes/styled.d.ts +21 -0
  40. package/build/cjs/themes/theme.d.ts +3 -0
  41. package/build/cjs/themes/themeComponents/color.d.ts +3 -0
  42. package/build/cjs/themes/themeComponents/color.js +3 -0
  43. package/build/es/components/AccordionItem/AccordionItem.d.ts +5 -1
  44. package/build/es/components/AccordionItem/AccordionItem.js +17 -7
  45. package/build/es/components/Box/Box.d.ts +10 -1
  46. package/build/es/components/Box/Box.js +1 -1
  47. package/build/es/components/ButtonIcon/ButtonIcon.d.ts +6 -0
  48. package/build/es/components/ButtonIcon/ButtonIcon.js +2 -2
  49. package/build/es/components/EmptyState/EmptyState.d.ts +4 -0
  50. package/build/es/components/EmptyState/EmptyState.js +2 -2
  51. package/build/es/components/Expander/Expander.js +8 -2
  52. package/build/es/components/Footer/Components/FooterComponents.js +10 -6
  53. package/build/es/components/Footer/Footer.js +4 -0
  54. package/build/es/components/Icon/Icon.d.ts +9 -1
  55. package/build/es/components/Icon/Icon.js +2 -2
  56. package/build/es/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +1 -0
  57. package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.d.ts +7 -4
  58. package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +3 -0
  59. package/build/es/components/MainHeaderNavigation/MainHeaderNavigation.d.ts +5 -5
  60. package/build/es/components/MainHeaderNavigation/context/NavContext.d.ts +5 -5
  61. package/build/es/components/MainHeaderNavigation/globalNavStyles.d.ts +27 -0
  62. package/build/es/components/MainNavigation/ChildComponents/BusinessMenu.js +1 -0
  63. package/build/es/components/MainNavigation/ChildComponents/HeaderNavigationElements.d.ts +3 -0
  64. package/build/es/components/MainNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +3 -0
  65. package/build/es/components/MainNavigation/globalNavStyles.d.ts +12 -0
  66. package/build/es/components/PixelLoader/PixelLoader.d.ts +4 -0
  67. package/build/es/components/PixelLoader/PixelLoader.js +1 -0
  68. package/build/es/components/PriorityNavigationItem/PriorityNavigationItem.js +1 -0
  69. package/build/es/components/ProgressIndicator/ProgressIndicator.d.ts +8 -0
  70. package/build/es/components/ProgressIndicator/ProgressIndicator.js +12 -5
  71. package/build/es/components/SecondaryNavigation/SecondaryNavigation.js +1 -0
  72. package/build/es/components/Selectbox/Selectbox.d.ts +18 -1
  73. package/build/es/components/Selectbox/Selectbox.js +18 -11
  74. package/build/es/components/Switch/Switch.d.ts +6 -1
  75. package/build/es/components/Switch/Switch.js +12 -4
  76. package/build/es/components/Tab/Tab.js +10 -2
  77. package/build/es/components/Tabs/Tabs.js +13 -1
  78. package/build/es/components/TooltipMenu/ChildComponents/TooltipMenuExportedStyles.d.ts +6 -0
  79. package/build/es/themes/globalStyles.d.ts +9 -0
  80. package/build/es/themes/globalStyles.js +13 -4
  81. package/build/es/themes/styled.d.ts +21 -0
  82. package/build/es/themes/theme.d.ts +3 -0
  83. package/build/es/themes/themeComponents/color.d.ts +3 -0
  84. package/build/es/themes/themeComponents/color.js +3 -0
  85. package/package.json +10 -10
@@ -1,4 +1,4 @@
1
- import { User, Headset, Shop, ArrowRight, ChevronDown, Facebook, Instagram, Linkedin, Tiktok, X, Youtube } from '@dnanpm/icons';
1
+ import { User, Headset, Shop, ArrowRight, ChevronDown, Facebook, Instagram, Linkedin, Tiktok, Threads, X, Youtube } from '@dnanpm/icons';
2
2
  import React__default, { useContext } from 'react';
3
3
  import styled from '../../../themes/styled.js';
4
4
  import theme from '../../../themes/theme.js';
@@ -12,6 +12,7 @@ const LinksListEl = styled.li `
12
12
  a {
13
13
  line-height: ${theme.lineHeight.default};
14
14
  color: ${theme.color.default.white};
15
+ text-decoration: none;
15
16
  &:hover,
16
17
  &:focus,
17
18
  &:active {
@@ -145,6 +146,7 @@ const GeneralInformationContainer = styled.div `
145
146
  `;
146
147
  const GeneralInformationLink = styled.a `
147
148
  &:after {
149
+ display: inline-block;
148
150
  content: '|';
149
151
  padding-left: ${getMultipliedSize(theme.base.baseHeight, 1.5)};
150
152
  }
@@ -163,6 +165,7 @@ const socialMediaIcons = {
163
165
  instagram: Instagram,
164
166
  linkedin: Linkedin,
165
167
  tiktok: Tiktok,
168
+ threads: Threads,
166
169
  twitter: X,
167
170
  youtube: Youtube,
168
171
  };
@@ -214,14 +217,15 @@ const GeneralInformation = ({ generalInformation }) => {
214
217
  const SocialMediaLinks = ({ socialMedia }) => {
215
218
  const { language } = useContext(FooterContext);
216
219
  return (React__default.createElement(SocialMediaLinksContainer, { "data-testid": "social-media-section" }, socialMedia &&
217
- Object.keys(socialMedia || {}).map(socialMediaKey => {
218
- if (socialMediaKey === '__typename') {
219
- return null;
220
- }
220
+ Object.keys(socialMedia).map(socialMediaKey => {
221
+ var _a;
221
222
  const socialMediaName = socialMediaKey.charAt(0).toUpperCase() +
222
223
  socialMediaKey.toLowerCase().slice(1);
223
224
  const currentObject = socialMedia[socialMediaKey];
224
- const currentMediaUrl = currentObject === null || currentObject === void 0 ? void 0 : currentObject.urls[language];
225
+ const currentMediaUrl = (_a = currentObject === null || currentObject === void 0 ? void 0 : currentObject.urls) === null || _a === void 0 ? void 0 : _a[language];
226
+ if (!currentMediaUrl) {
227
+ return null;
228
+ }
225
229
  return (React__default.createElement("a", { href: currentMediaUrl, key: `social-media-link-${socialMediaKey}`, "aria-label": socialMediaName },
226
230
  React__default.createElement(Icon, { icon: socialMediaIcons[socialMediaKey.toLowerCase()] })));
227
231
  })));
@@ -22,6 +22,7 @@ const TopContainer = styled.div `
22
22
  gap: ${getMultipliedSize(theme.base.baseHeight, 0.9)};
23
23
  font-weight: ${theme.fontWeight.bold};
24
24
  line-height: ${theme.lineHeight.default};
25
+ text-decoration: none;
25
26
 
26
27
  &:hover,
27
28
  &:focus,
@@ -60,6 +61,7 @@ const LangLinksContainer = styled.div `
60
61
  const LangLink = styled.a `
61
62
  background: ${({ isActive }) => isActive ? theme.color.background.white.default : 'transparent'};
62
63
  color: ${({ isActive }) => (isActive ? theme.color.text.plum : theme.color.text.white)};
64
+ text-decoration: none;
63
65
  &:hover,
64
66
  &:active,
65
67
  &:focus {
@@ -141,6 +143,7 @@ const FooterContainer = styled.footer `
141
143
 
142
144
  nav {
143
145
  a {
146
+ text-decoration: none;
144
147
  &:not(.active-site) {
145
148
  background: transparent;
146
149
  }
@@ -161,6 +164,7 @@ const FooterContainer = styled.footer `
161
164
  }
162
165
 
163
166
  div > a {
167
+ text-decoration: none;
164
168
  &:not(${LangLink}) {
165
169
  color: ${theme.color.text.white};
166
170
  &:not(.service-button):hover,
@@ -52,7 +52,15 @@ export interface Props extends Partial<IconProps> {
52
52
  * Allows to pass testid string for testing purposes
53
53
  */
54
54
  'data-testid'?: string;
55
+ /**
56
+ * Allows to pass aria label for accessibility purposes
57
+ */
58
+ 'aria-label'?: string;
59
+ /**
60
+ * Allows to pass aria hidden for accessibility purposes
61
+ */
62
+ 'aria-hidden'?: boolean;
55
63
  }
56
- declare const Icon: ({ name, icon: IconParam, color, size, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
64
+ declare const Icon: ({ name, icon: IconParam, color, size, "data-testid": dataTestId, "aria-label": ariaLabel, "aria-hidden": ariaHidden, ...props }: Props) => React.JSX.Element;
57
65
  /** @component */
58
66
  export default Icon;
@@ -27,13 +27,13 @@ const IconContainer = styled.span `
27
27
  }
28
28
  `;
29
29
  const Icon = (_a) => {
30
- var { name, icon: IconParam, color = 'currentColor', size = '1.5rem', 'data-testid': dataTestId } = _a, props = __rest(_a, ["name", "icon", "color", "size", 'data-testid']);
30
+ var { name, icon: IconParam, color = 'currentColor', size = '1.5rem', 'data-testid': dataTestId, 'aria-label': ariaLabel, 'aria-hidden': ariaHidden } = _a, props = __rest(_a, ["name", "icon", "color", "size", 'data-testid', 'aria-label', 'aria-hidden']);
31
31
  // TODO: Remove once https://jira.dna.fi/browse/STYLE-334 is done
32
32
  const RenderIcon = name && IconsList[name];
33
33
  return (React__default.createElement(React__default.Fragment, null,
34
34
  RenderIcon && (React__default.createElement(IconContainer, { position: props.position, size: size, className: "dnasg-icon", "data-testid": dataTestId },
35
35
  React__default.createElement(RenderIcon, Object.assign({}, props, { size: size, color: color })))),
36
- IconParam && (React__default.createElement(IconContainer, { onClick: props.onClick, position: props.position, size: size, className: `dnasg-icon ${props.className || ''}`.trim(), "data-testid": dataTestId },
36
+ IconParam && (React__default.createElement(IconContainer, { onClick: props.onClick, position: props.position, size: size, className: `dnasg-icon ${props.className || ''}`.trim(), "data-testid": dataTestId, "aria-label": ariaLabel, "aria-hidden": ariaHidden, role: !ariaHidden ? 'img' : undefined },
37
37
  React__default.createElement(IconParam, { size: size, color: color })))));
38
38
  };
39
39
 
@@ -11,6 +11,7 @@ const BusinessMenuLink = styled.a `
11
11
  font-size: ${theme.fontSize.xs};
12
12
  line-height: ${theme.lineHeight.s};
13
13
  border-radius: ${theme.radius.pill};
14
+ text-decoration: none;
14
15
  display: block;
15
16
  padding: ${getMultipliedSize(theme.base.baseHeight, 0.5)};
16
17
  ${media.md `
@@ -1,7 +1,7 @@
1
- import type { ReactNode } from 'react';
1
+ import type { ComponentType, ReactNode } from 'react';
2
2
  import React from 'react';
3
3
  import type { MainHeaderNavigationProps } from '../MainHeaderNavigation';
4
- interface MainNavTooltipMenuProps extends Pick<MainHeaderNavigationProps, 'onCartButtonClick'> {
4
+ interface MainNavTooltipMenuProps<ContentProps extends object = object> extends Pick<MainHeaderNavigationProps, 'onCartButtonClick'> {
5
5
  /** Aria-label for screen readers in mobile */
6
6
  ariaLabel?: string;
7
7
  /** Tooltip menu content */
@@ -11,7 +11,7 @@ interface MainNavTooltipMenuProps extends Pick<MainHeaderNavigationProps, 'onCar
11
11
  /** Tooltip position from right. Default: 1.25rem */
12
12
  tooltipRight?: string;
13
13
  /** Mandatory Component provided as login content */
14
- contentComponent?: ReactNode | boolean;
14
+ contentComponent?: ComponentType<ContentProps> | ReactNode | boolean;
15
15
  /** Array of tags (lowercase) that will close menu if they are inside the dropdown tooltip menu. default []. THIS CAN BE OVERRIDEN WITH data-no-close="true" in element */
16
16
  closeWhenTagClicked?: string[];
17
17
  /** Width of the opened menu content. default 20rem. */
@@ -47,6 +47,9 @@ export declare const IconContainer: import("styled-components").StyledComponent<
47
47
  sky: string;
48
48
  orange: string;
49
49
  };
50
+ active: {
51
+ pink: string;
52
+ };
50
53
  hover: {
51
54
  pink: string;
52
55
  };
@@ -189,5 +192,5 @@ export declare const IconContainer: import("styled-components").StyledComponent<
189
192
  isActive?: boolean;
190
193
  collapseSize: number;
191
194
  }, never>;
192
- declare const MainNavTooltipMenu: ({ ariaLabel, children, closeWhenTagClicked, contentComponent, contentWidth, fullWidthBreakpoint, fullWidthDesktop, globalStateString, tooltipRight, zIndex, ...props }: MainNavTooltipMenuProps) => React.JSX.Element;
195
+ declare const MainNavTooltipMenu: <ContentProps extends object = object>({ ariaLabel, children, closeWhenTagClicked, contentComponent, contentWidth, fullWidthBreakpoint, fullWidthDesktop, globalStateString, tooltipRight, zIndex, ...props }: MainNavTooltipMenuProps<ContentProps>) => React.JSX.Element;
193
196
  export default MainNavTooltipMenu;
@@ -22,6 +22,9 @@ declare const TooltipWrapper: import("styled-components").StyledComponent<"butto
22
22
  sky: string;
23
23
  orange: string;
24
24
  };
25
+ active: {
26
+ pink: string;
27
+ };
25
28
  hover: {
26
29
  pink: string;
27
30
  };
@@ -1,4 +1,4 @@
1
- import type { MouseEvent, ReactNode } from 'react';
1
+ import type { ComponentType, MouseEvent, ReactNode } from 'react';
2
2
  import React from 'react';
3
3
  import type { GlobalNavItems } from './types/globalNavProps';
4
4
  export interface MainHeaderNavigationProps {
@@ -11,7 +11,7 @@ export interface MainHeaderNavigationProps {
11
11
  zIndex?: number;
12
12
  search?: boolean;
13
13
  searchText?: string;
14
- searchComponent?: ReactNode | boolean;
14
+ searchComponent?: ComponentType | ReactNode | boolean;
15
15
  mainMenuAriaLabel?: string;
16
16
  minicart?: boolean;
17
17
  minicartText?: string;
@@ -21,7 +21,7 @@ export interface MainHeaderNavigationProps {
21
21
  *
22
22
  * @deprecated Use `onCartButtonClick` property instead
23
23
  */
24
- minicartComponent?: ReactNode | boolean;
24
+ minicartComponent?: ComponentType | ReactNode | boolean;
25
25
  showMinicart?: boolean;
26
26
  /**
27
27
  * On Cart button click callback
@@ -32,10 +32,10 @@ export interface MainHeaderNavigationProps {
32
32
  languageSelectorText?: string;
33
33
  login?: boolean;
34
34
  loginText?: string;
35
- loginComponent?: ReactNode | boolean;
35
+ loginComponent?: ComponentType | ReactNode | boolean;
36
36
  isLoggedIn?: boolean;
37
37
  collapseSize?: number;
38
- nextJSLinkComponent: ReactNode | boolean;
38
+ nextJSLinkComponent: ComponentType | ReactNode | boolean;
39
39
  currentUrl?: string;
40
40
  notificationText?: string;
41
41
  }
@@ -1,4 +1,4 @@
1
- import type { Dispatch, ReactNode, SetStateAction } from 'react';
1
+ import type { ComponentType, Dispatch, ReactNode, SetStateAction } from 'react';
2
2
  import type { GlobalNavItems, MenuLevelItem, MenuStates, MenuTooltipItems, MobileMenuLevel } from '../types/globalNavProps';
3
3
  export interface NavContextProps {
4
4
  categoryCollectionText: string;
@@ -13,13 +13,13 @@ export interface NavContextProps {
13
13
  level1Items: MobileMenuLevel;
14
14
  level2Items: MobileMenuLevel;
15
15
  lang: string;
16
- loginComponent?: ReactNode | boolean | undefined;
16
+ loginComponent?: ComponentType | ReactNode | boolean;
17
17
  menuLevel: MenuStates;
18
- minicartComponent?: ReactNode | boolean | undefined;
18
+ minicartComponent?: ComponentType | ReactNode | boolean;
19
19
  navZIndex: number;
20
- nextJSLinkComponent: ReactNode | boolean;
20
+ nextJSLinkComponent: ComponentType | ReactNode | boolean;
21
21
  resetMenuEvents: () => void;
22
- searchComponent?: ReactNode | boolean | undefined;
22
+ searchComponent?: ComponentType | ReactNode | boolean;
23
23
  setTooltipItems: Dispatch<SetStateAction<MenuTooltipItems>>;
24
24
  showLoginTooltip: boolean;
25
25
  showMinicart: boolean;
@@ -22,6 +22,9 @@ export declare const LogoLink: import("styled-components").StyledComponent<"a",
22
22
  sky: string;
23
23
  orange: string;
24
24
  };
25
+ active: {
26
+ pink: string;
27
+ };
25
28
  hover: {
26
29
  pink: string;
27
30
  };
@@ -185,6 +188,9 @@ export declare const DesktopMenuContainer: import("styled-components").StyledCom
185
188
  sky: string;
186
189
  orange: string;
187
190
  };
191
+ active: {
192
+ pink: string;
193
+ };
188
194
  hover: {
189
195
  pink: string;
190
196
  };
@@ -350,6 +356,9 @@ export declare const MobileMenuButton: import("styled-components").StyledCompone
350
356
  sky: string;
351
357
  orange: string;
352
358
  };
359
+ active: {
360
+ pink: string;
361
+ };
353
362
  hover: {
354
363
  pink: string;
355
364
  };
@@ -513,6 +522,9 @@ export declare const HeaderIconContainer: import("styled-components").StyledComp
513
522
  sky: string;
514
523
  orange: string;
515
524
  };
525
+ active: {
526
+ pink: string;
527
+ };
516
528
  hover: {
517
529
  pink: string;
518
530
  };
@@ -678,6 +690,9 @@ export declare const MenuItem: import("styled-components").StyledComponent<"li",
678
690
  sky: string;
679
691
  orange: string;
680
692
  };
693
+ active: {
694
+ pink: string;
695
+ };
681
696
  hover: {
682
697
  pink: string;
683
698
  };
@@ -844,6 +859,9 @@ export declare const MenuLink: import("styled-components").StyledComponent<"a",
844
859
  sky: string;
845
860
  orange: string;
846
861
  };
862
+ active: {
863
+ pink: string;
864
+ };
847
865
  hover: {
848
866
  pink: string;
849
867
  };
@@ -1009,6 +1027,9 @@ export declare const MenuLinkWithChildren: import("styled-components").StyledCom
1009
1027
  sky: string;
1010
1028
  orange: string;
1011
1029
  };
1030
+ active: {
1031
+ pink: string;
1032
+ };
1012
1033
  hover: {
1013
1034
  pink: string;
1014
1035
  };
@@ -1174,6 +1195,9 @@ export declare const MenuList: import("styled-components").StyledComponent<"ul",
1174
1195
  sky: string;
1175
1196
  orange: string;
1176
1197
  };
1198
+ active: {
1199
+ pink: string;
1200
+ };
1177
1201
  hover: {
1178
1202
  pink: string;
1179
1203
  };
@@ -1339,6 +1363,9 @@ export declare const FeaturedBlock: import("styled-components").StyledComponent<
1339
1363
  sky: string;
1340
1364
  orange: string;
1341
1365
  };
1366
+ active: {
1367
+ pink: string;
1368
+ };
1342
1369
  hover: {
1343
1370
  pink: string;
1344
1371
  };
@@ -7,6 +7,7 @@ import NavContext from '../context/NavContext.js';
7
7
  const BusinessMenuLink = styled.a `
8
8
  color: ${p => (p.isActive ? theme.color.text.pink : theme.color.text.black)};
9
9
  display: block;
10
+ text-decoration: none;
10
11
  margin: ${p => !p.isMobileMenu
11
12
  ? `0 ${getMultipliedSize(theme.base.baseWidth, 1)}`
12
13
  : `${getMultipliedSize(theme.base.baseWidth, 1.25)} ${getMultipliedSize(theme.base.baseWidth, 2)} `};
@@ -24,6 +24,9 @@ export declare const IconContainer: import("styled-components").StyledComponent<
24
24
  sky: string;
25
25
  orange: string;
26
26
  };
27
+ active: {
28
+ pink: string;
29
+ };
27
30
  hover: {
28
31
  pink: string;
29
32
  };
@@ -22,6 +22,9 @@ declare const TooltipWrapper: import("styled-components").StyledComponent<"butto
22
22
  sky: string;
23
23
  orange: string;
24
24
  };
25
+ active: {
26
+ pink: string;
27
+ };
25
28
  hover: {
26
29
  pink: string;
27
30
  };
@@ -22,6 +22,9 @@ export declare const MenuItem: import("styled-components").StyledComponent<"li",
22
22
  sky: string;
23
23
  orange: string;
24
24
  };
25
+ active: {
26
+ pink: string;
27
+ };
25
28
  hover: {
26
29
  pink: string;
27
30
  };
@@ -187,6 +190,9 @@ export declare const MenuLink: import("styled-components").StyledComponent<"a",
187
190
  sky: string;
188
191
  orange: string;
189
192
  };
193
+ active: {
194
+ pink: string;
195
+ };
190
196
  hover: {
191
197
  pink: string;
192
198
  };
@@ -352,6 +358,9 @@ export declare const MenuLinkWithChildren: import("styled-components").StyledCom
352
358
  sky: string;
353
359
  orange: string;
354
360
  };
361
+ active: {
362
+ pink: string;
363
+ };
355
364
  hover: {
356
365
  pink: string;
357
366
  };
@@ -518,6 +527,9 @@ export declare const MenuList: import("styled-components").StyledComponent<"ul",
518
527
  sky: string;
519
528
  orange: string;
520
529
  };
530
+ active: {
531
+ pink: string;
532
+ };
521
533
  hover: {
522
534
  pink: string;
523
535
  };
@@ -14,6 +14,10 @@ interface Props {
14
14
  * Allows to pass testid string for testing purposes
15
15
  */
16
16
  'data-testid'?: string;
17
+ /**
18
+ * Allows to pass a label for screen readers
19
+ */
20
+ label?: string;
17
21
  }
18
22
  /** @visibleName Pixel Loader */
19
23
  declare const PixelLoader: ({ className, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
@@ -33,6 +33,7 @@ const Pixel = styled.div `
33
33
  const PixelLoader = (_a) => {
34
34
  var { className, 'data-testid': dataTestId } = _a, props = __rest(_a, ["className", 'data-testid']);
35
35
  return (React__default.createElement(PixelLoaderWrapper, { className: className, "data-testid": dataTestId },
36
+ props.label && React__default.createElement("span", { className: "visually-hidden" }, props.label),
36
37
  React__default.createElement(Pixel, { color: props.color, delay: "-0.27" }),
37
38
  React__default.createElement(Pixel, { color: props.color, delay: "-0.18" }),
38
39
  React__default.createElement(Pixel, { color: props.color, delay: "-0.09" }),
@@ -36,6 +36,7 @@ const Element = styled.li `
36
36
  `}
37
37
 
38
38
  & > a {
39
+ text-decoration: none;
39
40
  &:focus-visible {
40
41
  border-radius: ${theme.radius.s};
41
42
  border: 2px solid ${theme.color.focus.light};
@@ -34,6 +34,14 @@ interface Props {
34
34
  * Allows to pass testid string for testing purposes
35
35
  */
36
36
  'data-testid'?: string;
37
+ /**
38
+ * Screen reader label describing the purpose of the ProgressIndicator,
39
+ */
40
+ ariaLabel?: string;
41
+ /**
42
+ * Screen reader label describing the completed step,
43
+ */
44
+ completedStepLabel?: string;
37
45
  }
38
46
  /** @visibleName Progress Indicator */
39
47
  declare const ProgressIndicator: ({ activeStep, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
@@ -86,14 +86,19 @@ const ProgressIndicatorItemNumber = styled.div `
86
86
  ${({ isActive, isError }) => getBackgroundColor({ isActive, isError })}
87
87
  `;
88
88
  const ProgressIndicatorItemLabel = styled.div `
89
- display: none;
90
89
  font-size: ${({ small }) => (small ? theme.fontSize.xs : theme.fontSize.s)};
91
90
  line-height: ${({ small }) => (small ? theme.lineHeight.xs : theme.lineHeight.s)};
92
91
  font-weight: ${theme.fontWeight.bold};
93
92
  color: ${({ isActive }) => (isActive ? theme.color.text.black : theme.color.text.gray)};
94
93
 
95
94
  ${media.sm `
96
- display: initial;
95
+ &.visually-hidden {
96
+ width: auto;
97
+ height: auto;
98
+ overflow: visible;
99
+ clip: auto;
100
+ opacity: 1;
101
+ }
97
102
  `}
98
103
  `;
99
104
  /** @visibleName Progress Indicator */
@@ -115,10 +120,12 @@ const ProgressIndicator = (_a) => {
115
120
  };
116
121
  return (React__default.createElement(ProgressIndicatorItem, { key: id, small: props.small, "aria-current": isActive ? 'step' : 'false' },
117
122
  index > 0 && (React__default.createElement(ProgressIndicatorItemConnector, { small: props.small, isActive: isActive, isCompleted: isCompleted })),
118
- React__default.createElement(ProgressIndicatorItemNumber, { small: props.small, onClick: handleClick, isActive: isActive, isCompleted: isCompleted, isError: isError, isClickable: isCompleted && Boolean(props.onStepClick) }, isCompleted || isError ? (React__default.createElement(Icon, { icon: isError ? Warning : Check, color: isError ? theme.color.text.white : theme.color.text.pink, size: "1rem" })) : (stepNumber)),
119
- label && (React__default.createElement(ProgressIndicatorItemLabel, { small: props.small, onClick: handleClick, isActive: isActive }, label))));
123
+ React__default.createElement(ProgressIndicatorItemNumber, { small: props.small, onClick: handleClick, isActive: isActive, isCompleted: isCompleted, isError: isError, isClickable: isCompleted && Boolean(props.onStepClick) }, isCompleted || isError ? (React__default.createElement(React__default.Fragment, null,
124
+ isCompleted && props.completedStepLabel && (React__default.createElement("span", { className: "visually-hidden" }, props.completedStepLabel)),
125
+ React__default.createElement(Icon, { icon: isError ? Warning : Check, color: isError ? theme.color.text.white : theme.color.text.pink, size: "1rem" }))) : (stepNumber)),
126
+ label && (React__default.createElement(ProgressIndicatorItemLabel, { small: props.small, onClick: handleClick, isActive: isActive, className: "visually-hidden" }, label))));
120
127
  });
121
- return (React__default.createElement(ProgressIndicatorWrapper, { className: props.className, "data-testid": dataTestId }, progressIndicatorItems));
128
+ return (React__default.createElement(ProgressIndicatorWrapper, { className: props.className, "data-testid": dataTestId, "aria-label": props.ariaLabel, role: "list" }, progressIndicatorItems));
122
129
  };
123
130
 
124
131
  export { ProgressIndicator as default };
@@ -88,6 +88,7 @@ const SecondaryNavigationListElement = styled.li `
88
88
  margin: 0 ${getMultipliedSize(theme.base.baseWidth, 2)};
89
89
 
90
90
  a {
91
+ text-decoration: none;
91
92
  padding: 1rem 0;
92
93
  justify-content: start;
93
94
  color: ${({ isActive }) => (isActive ? theme.color.text.pink : theme.color.text.black)};
@@ -1,5 +1,6 @@
1
+ import type { ComponentType } from 'react';
1
2
  import React from 'react';
2
- import type { GroupBase, OptionsOrGroups, Props as ReactSelectProps } from 'react-select';
3
+ import type { GroupBase, OptionProps, OptionsOrGroups, Props as ReactSelectProps } from 'react-select';
3
4
  interface SelectboxOption {
4
5
  label: string;
5
6
  value: string;
@@ -114,6 +115,22 @@ interface Props<Option extends SelectboxOption = SelectboxOption, IsMulti extend
114
115
  * Allows to pass testid string for testing purposes
115
116
  */
116
117
  'data-testid'?: string;
118
+ /**
119
+ * Screen reader label describing the purpose of the SelectBox,
120
+ */
121
+ ariaLabel?: string;
122
+ /**
123
+ * Allows to pass a screen reader label for the loading indicator
124
+ */
125
+ loadingLabel?: string;
126
+ /**
127
+ * Allows to pass custom styles
128
+ */
129
+ styles?: ReactSelectProps<Option, IsMulti, Group>['styles'];
130
+ /**
131
+ * Allows to pass custom option component
132
+ */
133
+ optionComponent?: ComponentType<OptionProps<Option, IsMulti, Group>>;
117
134
  }
118
135
  declare const SelectBox: <Option extends SelectboxOption = SelectboxOption, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ noOptionsText, "data-testid": dataTestId, ...props }: Props<Option, IsMulti, Group>) => React.JSX.Element;
119
136
  export default SelectBox;
@@ -41,7 +41,7 @@ const getStyles = () => ({
41
41
  color: theme.color.text.black,
42
42
  backgroundColor: theme.color.background.sand.E02,
43
43
  } })),
44
- placeholder: styles => (Object.assign(Object.assign({}, styles), { color: theme.color.text.black + theme.color.transparency.T40 })),
44
+ placeholder: styles => (Object.assign(Object.assign({}, styles), { color: theme.color.text.black + theme.color.transparency.T50 })),
45
45
  indicatorSeparator: styles => (Object.assign(Object.assign({}, styles), { width: 0, backgroundColor: 'transparent', border: 'none' })),
46
46
  clearIndicator: styles => (Object.assign(Object.assign({}, styles), { cursor: 'pointer', color: theme.color.text.black, padding: 0, marginLeft: getMultipliedSize(theme.base.baseHeight, 1), ':hover': {
47
47
  color: theme.color.text.black,
@@ -76,8 +76,15 @@ const IndicatorsContainer = (_a) => {
76
76
  };
77
77
  const ClearIndicator = (_a) => {
78
78
  var clearIndicatorProps = __rest(_a, []);
79
- return components.ClearIndicator && (React__default.createElement(components.ClearIndicator, { clearValue: clearIndicatorProps.clearValue, cx: clearIndicatorProps.cx, getClassNames: clearIndicatorProps.getClassNames, getStyles: clearIndicatorProps.getStyles, getValue: clearIndicatorProps.getValue, hasValue: clearIndicatorProps.hasValue, innerProps: clearIndicatorProps.innerProps, isFocused: clearIndicatorProps.isFocused, isMulti: clearIndicatorProps.isMulti, isRtl: clearIndicatorProps.isRtl, options: clearIndicatorProps.options, selectOption: clearIndicatorProps.selectOption, selectProps: clearIndicatorProps.selectProps, setValue: clearIndicatorProps.setValue, theme: clearIndicatorProps.theme },
80
- React__default.createElement(Icon, { icon: Close })));
79
+ const onHandleKeyDown = (e) => {
80
+ if (e.key === 'Enter' || e.key === ' ') {
81
+ e.preventDefault();
82
+ e.stopPropagation();
83
+ clearIndicatorProps.clearValue();
84
+ }
85
+ };
86
+ return (components.ClearIndicator && (React__default.createElement(components.ClearIndicator, { clearValue: clearIndicatorProps.clearValue, cx: clearIndicatorProps.cx, getClassNames: clearIndicatorProps.getClassNames, getStyles: clearIndicatorProps.getStyles, getValue: clearIndicatorProps.getValue, hasValue: clearIndicatorProps.hasValue, innerProps: Object.assign(Object.assign({}, clearIndicatorProps.innerProps), { tabIndex: 0, role: 'button', onKeyDown: e => onHandleKeyDown(e) }), isFocused: clearIndicatorProps.isFocused, isMulti: clearIndicatorProps.isMulti, isRtl: clearIndicatorProps.isRtl, options: clearIndicatorProps.options, selectOption: clearIndicatorProps.selectOption, selectProps: clearIndicatorProps.selectProps, setValue: clearIndicatorProps.setValue, theme: clearIndicatorProps.theme },
87
+ React__default.createElement(Icon, { icon: Close }))));
81
88
  };
82
89
  const DropdownIndicator = (_a) => {
83
90
  var { selectProps } = _a, dropdownIndicatorProps = __rest(_a, ["selectProps"]);
@@ -93,15 +100,15 @@ const DropdownIndicator = (_a) => {
93
100
  const SelectBox = (_a) => {
94
101
  var { noOptionsText = '', 'data-testid': dataTestId } = _a, props = __rest(_a, ["noOptionsText", 'data-testid']);
95
102
  const getNoOptionsText = () => noOptionsText;
96
- return !props.isLoading ? (React__default.createElement(FieldContainer, { className: props.className, "data-testid": dataTestId },
103
+ const errorId = props.inputId ? `${props.inputId}-error` : undefined;
104
+ const allComponents = Object.assign({ MultiValueRemove,
105
+ IndicatorsContainer,
106
+ ClearIndicator,
107
+ DropdownIndicator }, (props.optionComponent ? { Option: props.optionComponent } : {}));
108
+ return !props.isLoading ? (React__default.createElement(FieldContainer, { className: props.className, "data-testid": dataTestId, "aria-label": props.ariaLabel },
97
109
  props.label && (React__default.createElement(LabelText, { htmlFor: props.inputId, status: (props.error && 'error') || undefined, isMandatory: props.isRequired }, props.label)),
98
- React__default.createElement(Select, { inputId: props.inputId, styles: getStyles(), theme: customTheme, components: {
99
- MultiValueRemove,
100
- IndicatorsContainer,
101
- ClearIndicator,
102
- DropdownIndicator,
103
- }, options: props.options, classNamePrefix: "react_select", onChange: props.onChange, onInputChange: props.onInputChange, value: props.value, placeholder: props.placeholder, noOptionsMessage: getNoOptionsText, menuPortalTarget: props.menuPortalTarget, menuPlacement: props.menuPlacement, isSearchable: Boolean(props.isSearchable), isClearable: Boolean(props.isClearable), isMulti: props.isMulti, isDisabled: Boolean(props.isDisabled), hideSelectedOptions: false, closeMenuOnSelect: !props.isMulti, errorState: props.error }),
104
- props.error && props.errorMessage && React__default.createElement(ErrorMessage, null, props.errorMessage))) : (React__default.createElement(PixelLoader, null));
110
+ React__default.createElement(Select, { inputId: props.inputId, styles: props.styles || getStyles(), theme: customTheme, components: allComponents, options: props.options, classNamePrefix: "react_select", onChange: props.onChange, onInputChange: props.onInputChange, value: props.value, placeholder: props.placeholder, noOptionsMessage: getNoOptionsText, menuPortalTarget: props.menuPortalTarget, menuPlacement: props.menuPlacement, isSearchable: Boolean(props.isSearchable), isClearable: Boolean(props.isClearable), isMulti: props.isMulti, isDisabled: Boolean(props.isDisabled), hideSelectedOptions: false, closeMenuOnSelect: !props.isMulti, errorState: props.error, "aria-labelledby": props.error ? errorId : undefined }),
111
+ props.error && props.errorMessage && (React__default.createElement(ErrorMessage, { id: errorId }, props.errorMessage)))) : (React__default.createElement(PixelLoader, { label: props.loadingLabel }));
105
112
  };
106
113
 
107
114
  export { SelectBox as default };
@@ -36,7 +36,12 @@ interface Props {
36
36
  * Allows to pass testid string for testing purposes
37
37
  */
38
38
  'data-testid'?: string;
39
+ /**
40
+ * Screen reader label describing the purpose of the switch,
41
+ * e.g., "toggle between accepting or rejecting the terms and conditions"
42
+ */
43
+ ariaLabel?: string;
39
44
  }
40
- declare const Switch: ({ onChange, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
45
+ declare const Switch: ({ onChange, "data-testid": dataTestId, ariaLabel, ...props }: Props) => React.JSX.Element;
41
46
  /** @component */
42
47
  export default Switch;
@@ -47,11 +47,18 @@ const Checkbox = styled.input `
47
47
  }
48
48
  :disabled + label > div {
49
49
  cursor: not-allowed;
50
- border-color: ${({ checked }) => checked && checked ? theme.color.default.pink : theme.color.line.L01}${theme.color.transparency.T40}};
50
+ border-color: ${({ checked }) => checked ? theme.color.default.pink : theme.color.line.L01}${theme.color.transparency
51
+ .T40};
51
52
  }
52
53
  :disabled + label div div {
53
54
  pointer-events: none;
54
- background-color: ${({ checked }) => checked && checked ? theme.color.default.pink : theme.color.line.L01}${theme.color.transparency.T40};
55
+ background-color: ${({ checked }) => checked ? theme.color.default.pink : theme.color.line.L01}${theme.color.transparency
56
+ .T40};
57
+ }
58
+
59
+ :focus-visible + label > div {
60
+ outline: none;
61
+ box-shadow: 0px 0px 0px 2px ${theme.color.focus.dark};
55
62
  }
56
63
  `;
57
64
  const LabelWrapper = styled(LabelText) `
@@ -76,14 +83,15 @@ const Rail = styled.div `
76
83
  `};
77
84
  `;
78
85
  const Switch = (_a) => {
79
- var { onChange, 'data-testid': dataTestId } = _a, props = __rest(_a, ["onChange", 'data-testid']);
86
+ var { onChange, 'data-testid': dataTestId, ariaLabel } = _a, props = __rest(_a, ["onChange", 'data-testid', "ariaLabel"]);
80
87
  const handleChange = () => {
81
88
  if (onChange && !props.disabled) {
82
89
  onChange(!props.isChecked);
83
90
  }
84
91
  };
92
+ const accessibleLabel = props.label ? undefined : ariaLabel || 'Toggle switch';
85
93
  return (React.createElement(Container, { className: props.className, "data-testid": dataTestId },
86
- React.createElement(Checkbox, { id: props.id, name: props.name, checked: Boolean(props.isChecked), "aria-checked": Boolean(props.isChecked), disabled: props.disabled, onChange: handleChange, role: "switch", type: "checkbox" }),
94
+ React.createElement(Checkbox, { id: props.id, name: props.name, checked: Boolean(props.isChecked), "aria-label": accessibleLabel, disabled: props.disabled, onChange: handleChange, role: "switch", type: "checkbox" }),
87
95
  React.createElement(LabelWrapper, { htmlFor: props.id },
88
96
  React.createElement(Rail, { isChecked: props.isChecked },
89
97
  React.createElement(Button, { isChecked: props.isChecked })),