@dnanpm/styleguide 3.11.5 → 3.12.1

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 (49) hide show
  1. package/build/cjs/components/ButtonPrimary/ButtonPrimary.js +1 -0
  2. package/build/cjs/components/ButtonSecondary/ButtonSecondary.js +1 -0
  3. package/build/cjs/components/DateTimePicker/DateTimePicker.js +4 -0
  4. package/build/cjs/components/Drawer/Drawer.js +9 -8
  5. package/build/cjs/components/Floater/Floater.js +3 -3
  6. package/build/cjs/components/Hero/Hero.d.ts +88 -0
  7. package/build/cjs/components/Hero/Hero.js +202 -0
  8. package/build/cjs/components/Input/Input.d.ts +10 -1
  9. package/build/cjs/components/Input/Input.js +4 -2
  10. package/build/cjs/components/MainNavigation/ChildComponents/BusinessMenu.js +7 -7
  11. package/build/cjs/components/MainNavigation/ChildComponents/DesktopMenu.js +7 -7
  12. package/build/cjs/components/MainNavigation/MainNavigation.js +7 -7
  13. package/build/cjs/components/NotificationBadge/NotificationBadge.js +4 -0
  14. package/build/cjs/components/PixelLoader/PixelLoader.js +5 -5
  15. package/build/cjs/components/PriorityNavigation/PriorityNavigation.js +11 -5
  16. package/build/cjs/components/ProgressIndicator/ProgressIndicator.js +18 -18
  17. package/build/cjs/components/SecondaryNavigation/SecondaryNavigation.js +27 -27
  18. package/build/cjs/components/Skeleton/Skeleton.d.ts +63 -0
  19. package/build/cjs/components/Skeleton/Skeleton.js +73 -0
  20. package/build/cjs/components/Textarea/Textarea.js +1 -1
  21. package/build/cjs/components/Tooltip/Tooltip.js +1 -1
  22. package/build/cjs/components/index.d.ts +2 -0
  23. package/build/cjs/index.js +4 -0
  24. package/build/cjs/themes/themeComponents/breakpoints.js +1 -0
  25. package/build/es/components/ButtonPrimary/ButtonPrimary.js +1 -0
  26. package/build/es/components/ButtonSecondary/ButtonSecondary.js +1 -0
  27. package/build/es/components/DateTimePicker/DateTimePicker.js +4 -0
  28. package/build/es/components/Drawer/Drawer.js +9 -8
  29. package/build/es/components/Floater/Floater.js +3 -3
  30. package/build/es/components/Hero/Hero.d.ts +88 -0
  31. package/build/es/components/Hero/Hero.js +194 -0
  32. package/build/es/components/Input/Input.d.ts +10 -1
  33. package/build/es/components/Input/Input.js +4 -2
  34. package/build/es/components/MainNavigation/ChildComponents/BusinessMenu.js +7 -7
  35. package/build/es/components/MainNavigation/ChildComponents/DesktopMenu.js +7 -7
  36. package/build/es/components/MainNavigation/MainNavigation.js +7 -7
  37. package/build/es/components/NotificationBadge/NotificationBadge.js +4 -0
  38. package/build/es/components/PixelLoader/PixelLoader.js +5 -5
  39. package/build/es/components/PriorityNavigation/PriorityNavigation.js +11 -5
  40. package/build/es/components/ProgressIndicator/ProgressIndicator.js +18 -18
  41. package/build/es/components/SecondaryNavigation/SecondaryNavigation.js +27 -27
  42. package/build/es/components/Skeleton/Skeleton.d.ts +63 -0
  43. package/build/es/components/Skeleton/Skeleton.js +65 -0
  44. package/build/es/components/Textarea/Textarea.js +1 -1
  45. package/build/es/components/Tooltip/Tooltip.js +1 -1
  46. package/build/es/components/index.d.ts +2 -0
  47. package/build/es/index.js +2 -0
  48. package/build/es/themes/themeComponents/breakpoints.js +1 -0
  49. package/package.json +7 -6
@@ -64,7 +64,7 @@ const MobileDropdown = styledComponents.styled.button `
64
64
  cursor: pointer;
65
65
  background: none;
66
66
  border: none;
67
- padding: ${({ isCategoryLabel }) => (isCategoryLabel ? '0.5rem' : '0.75rem')} 1.25rem;
67
+ padding: ${({ $isCategoryLabel }) => ($isCategoryLabel ? '0.5rem' : '0.75rem')} 1.25rem;
68
68
  color: ${theme.default.color.text.pink};
69
69
  font-size: ${theme.default.fontSize.default};
70
70
  line-height: ${theme.default.lineHeight.default};
@@ -125,8 +125,10 @@ const DropdownList = styledComponents.styled(CoreULStyles) `
125
125
  background-color: ${theme.default.color.background.white.default};
126
126
  border: 1px solid ${theme.default.color.line.L04};
127
127
  border-radius: 0 0 ${theme.default.radius.default} ${theme.default.radius.default};
128
- visibility: ${({ isDropdownListOpen }) => (isDropdownListOpen ? 'visible' : 'hidden')};
129
- clip-path: inset(0% 0% ${({ isDropdownListOpen }) => (isDropdownListOpen ? '0%' : '100%')} 0%);
128
+ visibility: ${({ $isDropdownListOpen }) => ($isDropdownListOpen ? 'visible' : 'hidden')};
129
+ clip-path: inset(
130
+ 0% 0% ${({ $isDropdownListOpen }) => ($isDropdownListOpen ? '0%' : '100%')} 0%
131
+ );
130
132
  transition: all 0.2s ease-in-out;
131
133
 
132
134
  ${styledUtils.media.md `
@@ -137,6 +139,10 @@ const DropdownList = styledComponents.styled(CoreULStyles) `
137
139
 
138
140
  ${common.default({ elevation: 'low' })}
139
141
  `;
142
+ /**
143
+ * TODO: Replace the VisuallyHidden styled component with the global class name.
144
+ * Ticket: https://jira.dna.fi/browse/STYLE-916
145
+ */
140
146
  const VisuallyHidden = styledComponents.styled.span `
141
147
  position: absolute;
142
148
  width: 1px;
@@ -327,7 +333,7 @@ const PriorityNavigation = (_a) => {
327
333
  !isMobile && props.categoryLabel && (React__default.default.createElement(Category, { id: categoryId }, props.categoryLabel)),
328
334
  React__default.default.createElement("nav", { "aria-labelledby": categoryId },
329
335
  React__default.default.createElement(ListsContainer, { ref: listsContainerRef },
330
- isMobile && selectedItem && (React__default.default.createElement(MobileDropdown, { onClick: toggleMobileNavigation, "aria-label": mobileDropdownAriaLabel !== null && mobileDropdownAriaLabel !== void 0 ? mobileDropdownAriaLabel : `${props.categoryLabel ? `${props.categoryLabel}, ` : ''}${selectedItem}.`, "aria-expanded": isMobileNavigationOpen, isCategoryLabel: Boolean(props.categoryLabel) },
336
+ isMobile && selectedItem && (React__default.default.createElement(MobileDropdown, { onClick: toggleMobileNavigation, "aria-label": mobileDropdownAriaLabel !== null && mobileDropdownAriaLabel !== void 0 ? mobileDropdownAriaLabel : `${props.categoryLabel ? `${props.categoryLabel}, ` : ''}${selectedItem}.`, "aria-expanded": isMobileNavigationOpen, "$isCategoryLabel": Boolean(props.categoryLabel) },
331
337
  React__default.default.createElement(MobileDropdownContent, null,
332
338
  props.categoryLabel && React__default.default.createElement(Category, null, props.categoryLabel),
333
339
  selectedItem),
@@ -354,7 +360,7 @@ const PriorityNavigation = (_a) => {
354
360
  !isMobile && Boolean(state.dropdownItems.length) && (React__default.default.createElement(React__default.default.Fragment, null,
355
361
  React__default.default.createElement("div", null,
356
362
  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)),
357
- isDropdownListOpen && (React__default.default.createElement(DropdownList, { isDropdownListOpen: isDropdownListOpen }, state.dropdownItems.map(dropdownItem => React.isValidElement(dropdownItem) &&
363
+ isDropdownListOpen && (React__default.default.createElement(DropdownList, { "$isDropdownListOpen": isDropdownListOpen }, state.dropdownItems.map(dropdownItem => React.isValidElement(dropdownItem) &&
358
364
  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
365
  props.onKeyDown, isActive: dropdownItem.props.isActive, className: dropdownItem.props.className, "data-testid": dropdownItem.props['data-testid'] }, dropdownItem.props.children)))))))))));
360
366
  };
@@ -40,7 +40,7 @@ const ProgressIndicatorItem = styledComponents.styled.li `
40
40
  flex-direction: column;
41
41
  align-items: center;
42
42
  flex: 1.5 1 0%;
43
- gap: ${({ small }) => styledUtils.getMultipliedSize(theme.default.base.baseWidth, small ? 0.5 : 1)};
43
+ gap: ${({ $small }) => styledUtils.getMultipliedSize(theme.default.base.baseWidth, $small ? 0.5 : 1)};
44
44
 
45
45
  &:first-of-type {
46
46
  align-items: flex-start;
@@ -70,34 +70,34 @@ const ProgressIndicatorItem = styledComponents.styled.li `
70
70
  `;
71
71
  const ProgressIndicatorItemConnector = styledComponents.styled.div `
72
72
  position: absolute;
73
- top: ${({ small }) => styledUtils.getMultipliedSize(theme.default.base.baseHeight, small ? 1.5 : 2)};
73
+ top: ${({ $small }) => styledUtils.getMultipliedSize(theme.default.base.baseHeight, $small ? 1.5 : 2)};
74
74
  left: -50%;
75
75
  right: 50%;
76
76
  width: 100%;
77
- height: ${({ small }) => (small ? '2px' : '4px')};
78
- background-color: ${({ isActive, isCompleted }) => isActive || isCompleted ? theme.default.color.default.pink : theme.default.color.line.L02};
77
+ height: ${({ $small }) => ($small ? '2px' : '4px')};
78
+ background-color: ${({ $isActive, $isCompleted }) => $isActive || $isCompleted ? theme.default.color.default.pink : theme.default.color.line.L02};
79
79
  `;
80
80
  const ProgressIndicatorItemNumber = styledComponents.styled.div `
81
81
  display: flex;
82
82
  justify-content: center;
83
83
  align-items: center;
84
- font-size: ${({ small }) => (small ? theme.default.fontSize.s : theme.default.fontSize.l)};
84
+ font-size: ${({ $small }) => ($small ? theme.default.fontSize.s : theme.default.fontSize.l)};
85
85
  font-weight: ${theme.default.fontWeight.bold};
86
- width: ${({ small }) => styledUtils.getMultipliedSize(theme.default.base.baseWidth, small ? 3 : 4)};
87
- height: ${({ small }) => styledUtils.getMultipliedSize(theme.default.base.baseHeight, small ? 3 : 4)};
88
- cursor: ${({ isClickable }) => (isClickable ? 'pointer' : 'default')};
89
- color: ${({ isActive }) => (isActive ? theme.default.color.text.white : theme.default.color.text.gray)};
86
+ width: ${({ $small }) => styledUtils.getMultipliedSize(theme.default.base.baseWidth, $small ? 3 : 4)};
87
+ height: ${({ $small }) => styledUtils.getMultipliedSize(theme.default.base.baseHeight, $small ? 3 : 4)};
88
+ cursor: ${({ $isClickable }) => ($isClickable ? 'pointer' : 'default')};
89
+ color: ${({ $isActive }) => ($isActive ? theme.default.color.text.white : theme.default.color.text.gray)};
90
90
  border-radius: ${theme.default.radius.circle};
91
- border: ${({ small, isActive, isCompleted, isError }) => `${small ? '3px' : '4px'} solid ${getBorderColor({ isActive, isCompleted, isError })}`};
91
+ border: ${({ $small, $isActive, $isCompleted, $isError }) => `${$small ? '3px' : '4px'} solid ${getBorderColor({ isActive: $isActive, isCompleted: $isCompleted, isError: $isError })}`};
92
92
  z-index: 1;
93
93
 
94
- ${({ isActive, isError }) => getBackgroundColor({ isActive, isError })}
94
+ ${({ $isActive, $isError }) => getBackgroundColor({ isActive: $isActive, isError: $isError })}
95
95
  `;
96
96
  const ProgressIndicatorItemLabel = styledComponents.styled.div `
97
- font-size: ${({ small }) => (small ? theme.default.fontSize.xs : theme.default.fontSize.s)};
98
- line-height: ${({ small }) => (small ? theme.default.lineHeight.xs : theme.default.lineHeight.s)};
97
+ font-size: ${({ $small }) => ($small ? theme.default.fontSize.xs : theme.default.fontSize.s)};
98
+ line-height: ${({ $small }) => ($small ? theme.default.lineHeight.xs : theme.default.lineHeight.s)};
99
99
  font-weight: ${theme.default.fontWeight.bold};
100
- color: ${({ isActive }) => (isActive ? theme.default.color.text.black : theme.default.color.text.gray)};
100
+ color: ${({ $isActive }) => ($isActive ? theme.default.color.text.black : theme.default.color.text.gray)};
101
101
 
102
102
  ${styledUtils.media.sm `
103
103
  &.visually-hidden {
@@ -133,12 +133,12 @@ const ProgressIndicator = (_a) => {
133
133
  }
134
134
  };
135
135
  const isClickable = isCompleted && Boolean(props.onStepClick);
136
- return (React__default.default.createElement(ProgressIndicatorItem, { key: id, small: props.small },
137
- index > 0 && (React__default.default.createElement(ProgressIndicatorItemConnector, { small: props.small, isActive: isActive, isCompleted: isCompleted })),
138
- React__default.default.createElement(ProgressIndicatorItemNumber, { small: props.small, onClick: handleClick, isActive: isActive, isCompleted: isCompleted, isError: isError, onKeyDown: handleKeyDown, tabIndex: isClickable || isActive ? 0 : -1, isClickable: isClickable, role: "tab", "aria-current": isActive ? 'step' : 'false', "aria-label": isCompleted && props.completedStepLabel
136
+ return (React__default.default.createElement(ProgressIndicatorItem, { key: id, "$small": props.small },
137
+ index > 0 && (React__default.default.createElement(ProgressIndicatorItemConnector, { "$small": props.small, "$isActive": isActive, "$isCompleted": isCompleted })),
138
+ React__default.default.createElement(ProgressIndicatorItemNumber, { "$small": props.small, "$isActive": isActive, "$isCompleted": isCompleted, "$isError": isError, "$isClickable": isClickable, onClick: handleClick, onKeyDown: handleKeyDown, tabIndex: isClickable || isActive ? 0 : -1, role: "tab", "aria-current": isActive ? 'step' : 'false', "aria-label": isCompleted && props.completedStepLabel
139
139
  ? `${label}, ${props.completedStepLabel}`
140
140
  : label }, isCompleted || isError ? (React__default.default.createElement(Icon.default, { icon: isError ? icons.Warning : icons.Check, color: isError ? theme.default.color.text.white : theme.default.color.text.pink, size: "1rem", "aria-hidden": true })) : (stepNumber)),
141
- label && (React__default.default.createElement(ProgressIndicatorItemLabel, { "aria-hidden": true, small: props.small, onClick: handleClick, isActive: isActive, className: "visually-hidden" }, label))));
141
+ label && (React__default.default.createElement(ProgressIndicatorItemLabel, { "aria-hidden": true, "$small": props.small, "$isActive": isActive, onClick: handleClick, className: "visually-hidden" }, label))));
142
142
  });
143
143
  return (React__default.default.createElement(ProgressIndicatorWrapper, { className: props.className, "data-testid": dataTestId, "aria-label": props.ariaLabel, role: "tablist" }, progressIndicatorItems));
144
144
  };
@@ -18,13 +18,13 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
18
18
  const SecondaryNavigationWrapper = styledComponents.styled.nav `
19
19
  font-size: ${theme.default.fontSize.default};
20
20
  padding: 0;
21
- background-color: ${({ whiteBg }) => whiteBg ? theme.default.color.background.white.default : 'transparent'};
21
+ background-color: ${({ $whiteBg }) => $whiteBg ? theme.default.color.background.white.default : 'transparent'};
22
22
 
23
- ${({ mobileOnly }) => styledUtils.media.sm `
24
- display: ${mobileOnly ? 'none' : 'inherit'};
23
+ ${({ $mobileOnly }) => styledUtils.media.sm `
24
+ display: ${$mobileOnly ? 'none' : 'inherit'};
25
25
  `};
26
26
 
27
- @media (min-width: ${({ collapseSize }) => collapseSize + 1}px) {
27
+ @media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
28
28
  border-bottom: 1px solid ${theme.default.color.line.L03};
29
29
  }
30
30
  `;
@@ -45,7 +45,7 @@ const MobileSelector = styledComponents.styled.button `
45
45
  cursor: pointer;
46
46
  }
47
47
 
48
- @media (min-width: ${({ collapseSize }) => collapseSize + 1}px) {
48
+ @media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
49
49
  display: none;
50
50
  }
51
51
  `;
@@ -57,14 +57,14 @@ const MobileSelectorArrow = styledComponents.styled.span `
57
57
 
58
58
  .dnasg-icon svg {
59
59
  transition: transform 0.15s ease-in-out;
60
- transform: rotate(${({ isOpen }) => (isOpen ? '180deg' : '0deg')});
60
+ transform: rotate(${({ $isOpen }) => ($isOpen ? '180deg' : '0deg')});
61
61
  }
62
62
  `;
63
63
  const MobileSelectorCheck = styledComponents.styled.span `
64
64
  margin-left: auto;
65
65
 
66
66
  .dnasg-icon {
67
- @media (min-width: ${({ collapseSize }) => collapseSize + 1}px) {
67
+ @media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
68
68
  display: none;
69
69
  }
70
70
  }
@@ -79,11 +79,11 @@ const SecondaryNavigationList = styledComponents.styled.ul `
79
79
  transition:
80
80
  max-height 0.2s ease-in-out,
81
81
  border-bottom 0.2s linear;
82
- background-color: ${({ isOpen }) => isOpen ? theme.default.color.background.white.default : 'transparent'};
83
- max-height: ${({ isOpen }) => (isOpen ? '500vh' : '0')};
84
- border-bottom: ${({ isOpen }) => (isOpen ? `1px solid ${theme.default.color.line.L03}` : 'none')};
82
+ background-color: ${({ $isOpen }) => $isOpen ? theme.default.color.background.white.default : 'transparent'};
83
+ max-height: ${({ $isOpen }) => ($isOpen ? '500vh' : '0')};
84
+ border-bottom: ${({ $isOpen }) => ($isOpen ? `1px solid ${theme.default.color.line.L03}` : 'none')};
85
85
 
86
- @media (min-width: ${({ collapseSize }) => collapseSize + 1}px) {
86
+ @media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
87
87
  padding: 0 ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
88
88
  max-height: none;
89
89
  position: static;
@@ -101,28 +101,28 @@ const SecondaryNavigationListElement = styledComponents.styled.li `
101
101
  text-decoration: none;
102
102
  padding: 1rem 0;
103
103
  justify-content: start;
104
- color: ${({ isActive }) => (isActive ? theme.default.color.text.pink : theme.default.color.text.black)};
105
- font-weight: ${({ isActive }) => isActive ? theme.default.fontWeight.bold : theme.default.fontWeight.book};
104
+ color: ${({ $isActive }) => ($isActive ? theme.default.color.text.pink : theme.default.color.text.black)};
105
+ font-weight: ${({ $isActive }) => $isActive ? theme.default.fontWeight.bold : theme.default.fontWeight.book};
106
106
  display: flex;
107
107
  align-items: center;
108
108
 
109
109
  &:hover {
110
110
  color: ${theme.default.color.text.pink};
111
111
  text-decoration: none;
112
- cursor: ${({ isActive }) => (isActive ? 'auto' : 'pointer')};
112
+ cursor: ${({ $isActive }) => ($isActive ? 'auto' : 'pointer')};
113
113
  }
114
114
 
115
- @media (min-width: ${({ collapseSize }) => collapseSize + 1}px) {
115
+ @media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
116
116
  padding: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1.5)} 0;
117
117
  font-weight: ${theme.default.fontWeight.book};
118
118
  }
119
119
  }
120
120
 
121
- @media (min-width: ${({ collapseSize }) => collapseSize + 1}px) {
121
+ @media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
122
122
  margin: 0 ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1.5)};
123
123
  white-space: nowrap;
124
124
  transition: border-bottom 0.2s linear;
125
- border-bottom: ${({ isActive }) => isActive ? `1px solid ${theme.default.color.default.pink}` : 'none'};
125
+ border-bottom: ${({ $isActive }) => $isActive ? `1px solid ${theme.default.color.default.pink}` : 'none'};
126
126
 
127
127
  &:first-of-type {
128
128
  margin-left: 0;
@@ -135,7 +135,7 @@ const IconWrapper = styledComponents.styled.span `
135
135
  margin-right: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1)};
136
136
 
137
137
  &:after {
138
- display: ${({ showNotification }) => (showNotification ? 'inline' : 'none')};
138
+ display: ${({ $showNotification }) => ($showNotification ? 'inline' : 'none')};
139
139
  content: '';
140
140
  position: absolute;
141
141
  border-radius: ${theme.default.radius.circle};
@@ -147,7 +147,7 @@ const IconWrapper = styledComponents.styled.span `
147
147
  background-color: ${theme.default.color.default.pink};
148
148
  }
149
149
 
150
- @media (min-width: ${({ collapseSize }) => collapseSize + 1}px) {
150
+ @media (min-width: ${({ $collapseSize }) => $collapseSize + 1}px) {
151
151
  display: none;
152
152
  }
153
153
  `;
@@ -176,16 +176,16 @@ const SecondaryNavigation = (_a) => {
176
176
  const selectedElement = (_b = props.data.pages) === null || _b === void 0 ? void 0 : _b.find(listElement => currentUrl === listElement.urls[lang]);
177
177
  const shouldHighlightSelectedElement = (_c = (selectedElement && highlightIds.some(el => el === selectedElement.id))) !== null && _c !== void 0 ? _c : false;
178
178
  const checkIsMenuItemLinkAbsolute = (menuItemLink) => menuItemLink.includes('http');
179
- return (React__default.default.createElement(SecondaryNavigationWrapper, { ref: ref, collapseSize: collapseSize, "data-testid": dataTestId, className: className, mobileOnly: props.mobileOnly, whiteBg: props.whiteBg },
180
- selectedElement && (React__default.default.createElement(MobileSelector, { onClick: toggleNav, collapseSize: collapseSize, "data-testid": "secondary-navigation-dropdown-selector" },
179
+ return (React__default.default.createElement(SecondaryNavigationWrapper, { ref: ref, "data-testid": dataTestId, className: className, "$collapseSize": collapseSize, "$mobileOnly": props.mobileOnly, "$whiteBg": props.whiteBg },
180
+ selectedElement && (React__default.default.createElement(MobileSelector, { onClick: toggleNav, "$collapseSize": collapseSize, "data-testid": "secondary-navigation-dropdown-selector" },
181
181
  React__default.default.createElement(MobileSelectorTitleWrapper, null,
182
- (selectedElement === null || selectedElement === void 0 ? void 0 : selectedElement.icon) && (React__default.default.createElement(IconWrapper, { showNotification: shouldHighlightSelectedElement, collapseSize: collapseSize },
182
+ (selectedElement === null || selectedElement === void 0 ? void 0 : selectedElement.icon) && (React__default.default.createElement(IconWrapper, { "$showNotification": shouldHighlightSelectedElement, "$collapseSize": collapseSize },
183
183
  React__default.default.createElement(Icon.default, { name: selectedElement.icon }))),
184
184
  React__default.default.createElement("span", null, selectedElement.titles[lang])),
185
- React__default.default.createElement(MobileSelectorArrow, { isOpen: isSecondaryNavOpen },
185
+ React__default.default.createElement(MobileSelectorArrow, { "$isOpen": isSecondaryNavOpen },
186
186
  React__default.default.createElement(Icon.default, { icon: icons.ChevronDown })))),
187
187
  React__default.default.createElement(SecondaryNavigationList, { id: props.data.name ||
188
- `secondary-navigation-category-${(_d = props.data.categoryId) !== null && _d !== void 0 ? _d : ''}`, isOpen: isSecondaryNavOpen, collapseSize: collapseSize, "max-width": maxWidth, "data-testid": "secondary-nav-menu-ul" }, (_e = props.data.pages) === null || _e === void 0 ? void 0 : _e.map((listElement, index) => {
188
+ `secondary-navigation-category-${(_d = props.data.categoryId) !== null && _d !== void 0 ? _d : ''}`, "$isOpen": isSecondaryNavOpen, "$collapseSize": collapseSize, "max-width": maxWidth, "data-testid": "secondary-nav-menu-ul" }, (_e = props.data.pages) === null || _e === void 0 ? void 0 : _e.map((listElement, index) => {
189
189
  const linkUrl = listElement.urls[lang];
190
190
  const linkTitle = listElement.titles[lang];
191
191
  const iconName = listElement.icon || '';
@@ -194,12 +194,12 @@ const SecondaryNavigation = (_a) => {
194
194
  : currentUrl.indexOf(linkUrl) > -1;
195
195
  const showNotification = highlightIds.some(el => el === listElement.id);
196
196
  const isMenuItemLinkAbsolute = checkIsMenuItemLinkAbsolute(linkUrl);
197
- return (React__default.default.createElement(SecondaryNavigationListElement, { key: listElement.id, isActive: isActive, onClick: closeNav, collapseSize: collapseSize }, NextJSSecondaryNavLink && !isMenuItemLinkAbsolute ? (React__default.default.createElement(NextJSSecondaryNavLink, { linkUrl: linkUrl, linkTitle: linkTitle, iconName: iconName, showNotification: showNotification, collapseSize: collapseSize, "data-testid": `secondary-nav-item-link-${index + 1}` }, isActive && (React__default.default.createElement(MobileSelectorCheck, { collapseSize: collapseSize },
197
+ return (React__default.default.createElement(SecondaryNavigationListElement, { key: listElement.id, onClick: closeNav, "$isActive": isActive, "$collapseSize": collapseSize }, NextJSSecondaryNavLink && !isMenuItemLinkAbsolute ? (React__default.default.createElement(NextJSSecondaryNavLink, { linkUrl: linkUrl, linkTitle: linkTitle, iconName: iconName, showNotification: showNotification, collapseSize: collapseSize, "data-testid": `secondary-nav-item-link-${index + 1}` }, isActive && (React__default.default.createElement(MobileSelectorCheck, { "$collapseSize": collapseSize },
198
198
  React__default.default.createElement(Icon.default, { icon: icons.Check }))))) : (React__default.default.createElement("a", { href: linkUrl, "data-testid": `secondary-nav-item-link-${index + 1}` },
199
- iconName && (React__default.default.createElement(IconWrapper, { showNotification: showNotification, collapseSize: collapseSize },
199
+ iconName && (React__default.default.createElement(IconWrapper, { "$showNotification": showNotification, "$collapseSize": collapseSize },
200
200
  React__default.default.createElement(Icon.default, { name: iconName }))),
201
201
  React__default.default.createElement("span", null, linkTitle),
202
- isActive && (React__default.default.createElement(MobileSelectorCheck, { collapseSize: collapseSize },
202
+ isActive && (React__default.default.createElement(MobileSelectorCheck, { "$collapseSize": collapseSize },
203
203
  React__default.default.createElement(Icon.default, { icon: icons.Check })))))));
204
204
  }))));
205
205
  };
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { type ThemeInterface } from '../../themes/theme';
3
+ interface Props {
4
+ /**
5
+ * Unique ID for the skeleton
6
+ */
7
+ id?: string;
8
+ /**
9
+ * Background color of the skeleton
10
+ *
11
+ * @param {string} sand Uses theme.color.background.sand.E01
12
+ * @param {string} white Uses white background (#FFFFFF)
13
+ *
14
+ * @default 'sand'
15
+ */
16
+ backgroundColor?: 'sand' | 'white';
17
+ /**
18
+ * Opacity level of the skeleton
19
+ *
20
+ * @param {number} 100 100% opacity
21
+ * @param {number} 50 50% opacity
22
+ * @param {number} 25 25% opacity
23
+ *
24
+ * @default 100
25
+ */
26
+ opacity?: 100 | 50 | 25;
27
+ /**
28
+ * Allows to pass in custom radius value from theme
29
+ */
30
+ borderRadius?: keyof ThemeInterface['radius'];
31
+ /**
32
+ * Width of the skeleton
33
+ *
34
+ * @default '100%'
35
+ */
36
+ width?: string;
37
+ /**
38
+ * Height of the skeleton
39
+ *
40
+ * @default '6.25rem'
41
+ */
42
+ height?: string;
43
+ /**
44
+ * Allows to pass testid string for testing purposes
45
+ */
46
+ 'data-testid'?: string;
47
+ /**
48
+ * Allows to pass a custom className
49
+ */
50
+ className?: string;
51
+ /**
52
+ * If used inside a carousel, pass the slide index (starting from 1)
53
+ */
54
+ carouselIndex?: number;
55
+ /**
56
+ * Screen reader label describing the use of the skeleton,
57
+ * e.g., "Loading content" or "Loading image."
58
+ */
59
+ ariaLabel?: string;
60
+ }
61
+ declare const Skeleton: ({ backgroundColor, opacity, width, height, borderRadius, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
62
+ /** @component */
63
+ export default Skeleton;
@@ -0,0 +1,73 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var React = require('react');
7
+ var styledComponents = require('styled-components');
8
+ var theme = require('../../themes/theme.js');
9
+
10
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
11
+
12
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
13
+
14
+ const shimmer = styledComponents.keyframes `
15
+ 100% {
16
+ transform: translateX(100%);
17
+ }
18
+ `;
19
+ const sandRgba = '248, 244, 241';
20
+ const whiteRgba = '255, 255, 255';
21
+ const getAnimationDelay = (carouselIndex) => {
22
+ switch (carouselIndex) {
23
+ case 1:
24
+ return '0s';
25
+ case 2:
26
+ return '0.6s';
27
+ case 3:
28
+ return '1.2s';
29
+ case 4:
30
+ return '1.9s';
31
+ case 5:
32
+ return '2.5s';
33
+ default:
34
+ return '0s';
35
+ }
36
+ };
37
+ const getBackgroundColor = (backgroundColor) => `linear-gradient(90deg,rgba(${backgroundColor}, 0) 0%,rgba(${backgroundColor}, 0.8) 50%,rgba(${backgroundColor}, 0) 100%)`;
38
+ const SkeletonWrapper = styledComponents.styled.div `
39
+ position: relative;
40
+ overflow: hidden;
41
+ background-color: ${({ $backgroundColor }) => $backgroundColor === 'sand'
42
+ ? theme.default.color.background.sand.E01
43
+ : theme.default.color.background.white.default};
44
+ opacity: ${({ $opacity }) => ($opacity ? $opacity / 100 : 1)};
45
+ width: ${({ $width }) => $width};
46
+ height: ${({ $height }) => $height};
47
+ border-radius: ${({ $borderRadius }) => theme.default.radius[$borderRadius || 's']};
48
+
49
+ &::after {
50
+ position: absolute;
51
+ inset: 0;
52
+ transform: translateX(-100%);
53
+ background: ${({ $backgroundColor }) => getBackgroundColor($backgroundColor === 'sand' ? whiteRgba : sandRgba)};
54
+
55
+ animation: ${shimmer} 1.5s infinite;
56
+ content: '';
57
+ }
58
+
59
+ @media (min-width: 600px) {
60
+ &::after {
61
+ animation: ${shimmer} 2.5s infinite;
62
+ animation-delay: ${({ $carouselIndex }) => getAnimationDelay($carouselIndex)};
63
+ }
64
+ }
65
+ `;
66
+ const Skeleton = (_a) => {
67
+ var { backgroundColor = 'sand', opacity = 100, width = '25rem', height = '6.25rem', borderRadius = 's', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["backgroundColor", "opacity", "width", "height", "borderRadius", 'data-testid']);
68
+ return (React__default.default.createElement(React__default.default.Fragment, null,
69
+ props.ariaLabel && (React__default.default.createElement("span", { id: props.id, "aria-label": props.ariaLabel, role: "status", "aria-atomic": "true", className: "visually-hidden" })),
70
+ React__default.default.createElement(SkeletonWrapper, { className: props.className, "data-testid": dataTestId, "aria-hidden": "true", tabIndex: -1, "$backgroundColor": backgroundColor, "$opacity": opacity, "$width": width, "$height": height, "$carouselIndex": props.carouselIndex, "$borderRadius": borderRadius })));
71
+ };
72
+
73
+ exports.default = Skeleton;
@@ -88,7 +88,7 @@ const Textarea = (_a) => {
88
88
  props.label && (React__default.default.createElement(LabelText.default, { htmlFor: props.id, "data-testid": dataTestId && `${dataTestId}-label`, status: isErrorStatus ? 'error' : undefined, isMandatory: props.required }, props.label)),
89
89
  React__default.default.createElement(StyledTextarea, { id: props.id, name: props.name, ref: inputRef, value: props.value, rows: height, placeholder: props.placeholder, tabIndex: props.tabIndex, onChange: handleChange, onBlur: handleOnBlur, onFocus: props.onFocus, onClick: onClick, onKeyDown: props.onKeyDown, onKeyPress: props.onKeyPress, required: props.required, disabled: props.disabled, "aria-label": !props.label ? ariaLabel : undefined, "aria-invalid": isErrorStatus, "aria-describedby": describedBy, "data-testid": dataTestId }),
90
90
  props.commentMessage && (React__default.default.createElement(Message, { id: commentId, "data-testid": dataTestId && `${dataTestId}-comment` }, props.commentMessage)),
91
- isErrorStatus && props.errorMessage && (React__default.default.createElement(ErrorMessage, { id: errorId, "data-testid": dataTestId && `${dataTestId}-error` }, props.errorMessage))));
91
+ isErrorStatus && props.errorMessage && (React__default.default.createElement(ErrorMessage, { id: errorId, role: "alert", "data-testid": dataTestId && `${dataTestId}-error` }, props.errorMessage))));
92
92
  };
93
93
 
94
94
  exports.default = Textarea;
@@ -64,7 +64,7 @@ const StyledReactTooltip = styledComponents.styled(reactTooltip.Tooltip) `
64
64
 
65
65
  border: 1px solid ${theme.default.color.line.L02};
66
66
  padding: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1.5)};
67
- text-align: center;
67
+ text-align: left;
68
68
  font-size: ${theme.default.fontSize.default};
69
69
  line-height: ${theme.default.lineHeight.default};
70
70
  width: max-content;
@@ -22,6 +22,7 @@ export { default as EnergyLabel } from './EnergyLabel/EnergyLabel';
22
22
  export { default as Expander } from './Expander/Expander';
23
23
  export { default as Floater } from './Floater/Floater';
24
24
  export { default as Footer } from './Footer/Footer';
25
+ export { default as Hero } from './Hero/Hero';
25
26
  export { default as Icon } from './Icon/Icon';
26
27
  export * from './Icons';
27
28
  export { default as InfoDialog } from './InfoDialog/InfoDialog';
@@ -45,6 +46,7 @@ export { default as ReadMore } from './ReadMore/ReadMore';
45
46
  export { default as Search } from './Search/Search';
46
47
  export { default as SecondaryNavigation } from './SecondaryNavigation/SecondaryNavigation';
47
48
  export { default as Selectbox } from './Selectbox/Selectbox';
49
+ export { default as Skeleton } from './Skeleton/Skeleton';
48
50
  export { default as Switch } from './Switch/Switch';
49
51
  export { default as Tab } from './Tab/Tab';
50
52
  export { default as Tabs } from './Tabs/Tabs';
@@ -24,6 +24,7 @@ var EnergyLabel = require('./components/EnergyLabel/EnergyLabel.js');
24
24
  var Expander = require('./components/Expander/Expander.js');
25
25
  var Floater = require('./components/Floater/Floater.js');
26
26
  var Footer = require('./components/Footer/Footer.js');
27
+ var Hero = require('./components/Hero/Hero.js');
27
28
  var Icon = require('./components/Icon/Icon.js');
28
29
  var hlArrowBackSmall = require('./components/Icons/Small/hlArrowBackSmall.js');
29
30
  var hlArrowForwardSmall = require('./components/Icons/Small/hlArrowForwardSmall.js');
@@ -155,6 +156,7 @@ var ReadMore = require('./components/ReadMore/ReadMore.js');
155
156
  var Search = require('./components/Search/Search.js');
156
157
  var SecondaryNavigation = require('./components/SecondaryNavigation/SecondaryNavigation.js');
157
158
  var Selectbox = require('./components/Selectbox/Selectbox.js');
159
+ var Skeleton = require('./components/Skeleton/Skeleton.js');
158
160
  var Switch = require('./components/Switch/Switch.js');
159
161
  var Tab = require('./components/Tab/Tab.js');
160
162
  var Tabs = require('./components/Tabs/Tabs.js');
@@ -194,6 +196,7 @@ exports.EnergyLabel = EnergyLabel.default;
194
196
  exports.Expander = Expander.default;
195
197
  exports.Floater = Floater.default;
196
198
  exports.Footer = Footer.default;
199
+ exports.Hero = Hero.default;
197
200
  exports.Icon = Icon.default;
198
201
  exports.hlArrowBackSmall = hlArrowBackSmall.default;
199
202
  exports.hlArrowForwardSmall = hlArrowForwardSmall.default;
@@ -326,6 +329,7 @@ exports.ReadMore = ReadMore.default;
326
329
  exports.Search = Search.default;
327
330
  exports.SecondaryNavigation = SecondaryNavigation.default;
328
331
  exports.Selectbox = Selectbox.default;
332
+ exports.Skeleton = Skeleton.default;
329
333
  exports.Switch = Switch.default;
330
334
  exports.Tab = Tab.default;
331
335
  exports.Tabs = Tabs.default;
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const breakpoints = {
6
+ xxl: 1440,
6
7
  xl: 1200,
7
8
  lg: 992,
8
9
  md: 768,
@@ -2,6 +2,7 @@ import { styled } from 'styled-components';
2
2
  import theme from '../../themes/theme.js';
3
3
  import Button, { shade } from '../Button/Button.js';
4
4
 
5
+ /* eslint-disable transient-props/transient-props */
5
6
  /** @visibleName Button Primary */
6
7
  const ButtonPrimary = styled(Button) `
7
8
  color: ${theme.color.text.white};
@@ -2,6 +2,7 @@ import { styled } from 'styled-components';
2
2
  import theme from '../../themes/theme.js';
3
3
  import Button, { shade } from '../Button/Button.js';
4
4
 
5
+ /* eslint-disable transient-props/transient-props */
5
6
  /** @visibleName Button Secondary */
6
7
  const ButtonSecondary = styled(Button) `
7
8
  color: ${theme.color.text.plum};
@@ -251,6 +251,10 @@ const CurrentMonth = styled.div `
251
251
  line-height: ${theme.lineHeight.default};
252
252
  font-weight: ${theme.fontWeight.bold};
253
253
  `;
254
+ /**
255
+ * TODO: Replace the VisuallyHiddenStatus styled component with the global class name.
256
+ * Ticket: https://jira.dna.fi/browse/STYLE-916
257
+ */
254
258
  const VisuallyHiddenStatus = styled.div `
255
259
  position: absolute;
256
260
  left: -9999px;
@@ -40,16 +40,17 @@ const slideIn = keyframes `
40
40
  const StyledReactModal = styled(ReactModal) `
41
41
  position: fixed;
42
42
  top: 0;
43
- ${({ side }) => (side === 'left' ? 'left: 0' : 'right: 0')};
44
- width: ${({ size }) => sizeMap[size]};
43
+ ${({ $side }) => ($side === 'left' ? 'left: 0' : 'right: 0')};
44
+ width: ${({ $size }) => sizeMap[$size]};
45
45
  height: 100dvh;
46
46
  max-height: 100%;
47
47
  max-width: calc(100vw - ${getMultipliedSize(theme.base.baseWidth, 4)});
48
- transform: translateX(${({ side }) => side === 'left' && '-'}100%);
49
- animation: ${slideIn} ${({ size }) => animationMap[size][0]}s forwards;
48
+ transform: translateX(${({ $side }) => $side === 'left' && '-'}100%);
49
+ animation: ${slideIn} ${({ $size }) => animationMap[$size][0]}s forwards;
50
50
 
51
51
  &.ReactModal__Content--before-close {
52
- animation: ${({ side }) => slideOut(side)} ${({ size }) => animationMap[size][1]}s forwards;
52
+ animation: ${({ $side }) => slideOut($side)} ${({ $size }) => animationMap[$size][1]}s
53
+ forwards;
53
54
  }
54
55
 
55
56
  @media (max-width: ${sizeMap.small}) {
@@ -143,7 +144,7 @@ const CloseButton = styled(ButtonClose) `
143
144
  margin: 0;
144
145
  padding: 0.5rem;
145
146
  border-radius: 0 0 0 ${theme.radius.default};
146
- background-color: ${({ variant }) => variant === 'light'
147
+ background-color: ${({ $variant }) => $variant === 'light'
147
148
  ? theme.color.background.sand.E01
148
149
  : theme.color.background.plum.default};
149
150
  `;
@@ -168,13 +169,13 @@ const Drawer = (_a) => {
168
169
  var { appElement = '#__next', size = 'medium', side = 'right', variant = 'light', padding = '1.25rem', closeButton = true, isClosable = true, 'data-testid': dataTestId } = _a, props = __rest(_a, ["appElement", "size", "side", "variant", "padding", "closeButton", "isClosable", 'data-testid']);
169
170
  ReactModal.setAppElement(appElement);
170
171
  return (React__default.createElement(React__default.Fragment, null,
171
- React__default.createElement(StyledReactModal, { id: props.id, isOpen: props.isOpen, overlayElement: ModalOverlay, contentElement: ModalContent, onRequestClose: props.onRequestClose, portalClassName: props.className, contentLabel: props.contentLabel, shouldCloseOnEsc: isClosable, shouldCloseOnOverlayClick: isClosable, closeTimeoutMS: 300, size: size, side: side },
172
+ React__default.createElement(StyledReactModal, { id: props.id, isOpen: props.isOpen, overlayElement: ModalOverlay, contentElement: ModalContent, onRequestClose: props.onRequestClose, portalClassName: props.className, contentLabel: props.contentLabel, shouldCloseOnEsc: isClosable, shouldCloseOnOverlayClick: isClosable, closeTimeoutMS: 300, "$size": size, "$side": side },
172
173
  React__default.createElement(StyledBox, { "data-testid": dataTestId, elevation: "extraHigh", margin: props.margin, padding: "0" },
173
174
  React__default.createElement(ContentContainer, null,
174
175
  React__default.createElement(Header, { "$variant": variant, "data-testid": dataTestId && `${dataTestId}-header` },
175
176
  React__default.createElement(Title, { "$size": size, "$variant": variant }, props.title),
176
177
  props.subtitle && (React__default.createElement(Subtitle, { "$size": size, "$variant": variant }, props.subtitle))),
177
- closeButton && isClosable && (React__default.createElement(CloseButton, { onClick: props.onRequestClose, "aria-label": props.closeLabel, "data-testid": dataTestId && `${dataTestId}-close-button`, variant: variant },
178
+ closeButton && isClosable && (React__default.createElement(CloseButton, { onClick: props.onRequestClose, "aria-label": props.closeLabel, "data-testid": dataTestId && `${dataTestId}-close-button`, "$variant": variant },
178
179
  React__default.createElement(Close, { color: variant === 'light'
179
180
  ? theme.color.default.plum
180
181
  : theme.color.default.white }))),
@@ -11,12 +11,12 @@ const getInset = ({ position, offset, }) => {
11
11
  };
12
12
  const Element = styled.div `
13
13
  position: sticky;
14
- ${({ zIndex }) => zIndex && `z-index: ${zIndex}`};
15
- ${({ $position, offset }) => getInset({ position: $position, offset })}
14
+ ${({ $zIndex }) => $zIndex && `z-index: ${$zIndex}`};
15
+ ${({ $position = 'top', $offset }) => getInset({ position: $position, offset: $offset })}
16
16
  `;
17
17
  const Floater = (_a) => {
18
18
  var { position = 'top', offset = '0', 'data-testid': dataTestId } = _a, props = __rest(_a, ["position", "offset", 'data-testid']);
19
- return (React__default.createElement(Element, { id: props.id, "$position": position, offset: offset, zIndex: props.zIndex, className: props.className, "data-testid": dataTestId }, props.children));
19
+ return (React__default.createElement(Element, { id: props.id, "$position": position, "$offset": offset, "$zIndex": props.zIndex, className: props.className, "data-testid": dataTestId }, props.children));
20
20
  };
21
21
 
22
22
  export { Floater as default };