@dnanpm/styleguide 3.11.5 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) 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/Drawer/Drawer.js +9 -8
  4. package/build/cjs/components/Floater/Floater.js +3 -3
  5. package/build/cjs/components/Hero/Hero.d.ts +88 -0
  6. package/build/cjs/components/Hero/Hero.js +202 -0
  7. package/build/cjs/components/Input/Input.d.ts +10 -1
  8. package/build/cjs/components/Input/Input.js +4 -2
  9. package/build/cjs/components/MainNavigation/ChildComponents/BusinessMenu.js +7 -7
  10. package/build/cjs/components/MainNavigation/ChildComponents/DesktopMenu.js +7 -7
  11. package/build/cjs/components/MainNavigation/MainNavigation.js +7 -7
  12. package/build/cjs/components/PixelLoader/PixelLoader.js +5 -5
  13. package/build/cjs/components/PriorityNavigation/PriorityNavigation.js +7 -5
  14. package/build/cjs/components/ProgressIndicator/ProgressIndicator.js +18 -18
  15. package/build/cjs/components/SecondaryNavigation/SecondaryNavigation.js +27 -27
  16. package/build/cjs/components/Textarea/Textarea.js +1 -1
  17. package/build/cjs/components/index.d.ts +1 -0
  18. package/build/cjs/index.js +2 -0
  19. package/build/cjs/themes/themeComponents/breakpoints.js +1 -0
  20. package/build/es/components/ButtonPrimary/ButtonPrimary.js +1 -0
  21. package/build/es/components/ButtonSecondary/ButtonSecondary.js +1 -0
  22. package/build/es/components/Drawer/Drawer.js +9 -8
  23. package/build/es/components/Floater/Floater.js +3 -3
  24. package/build/es/components/Hero/Hero.d.ts +88 -0
  25. package/build/es/components/Hero/Hero.js +194 -0
  26. package/build/es/components/Input/Input.d.ts +10 -1
  27. package/build/es/components/Input/Input.js +4 -2
  28. package/build/es/components/MainNavigation/ChildComponents/BusinessMenu.js +7 -7
  29. package/build/es/components/MainNavigation/ChildComponents/DesktopMenu.js +7 -7
  30. package/build/es/components/MainNavigation/MainNavigation.js +7 -7
  31. package/build/es/components/PixelLoader/PixelLoader.js +5 -5
  32. package/build/es/components/PriorityNavigation/PriorityNavigation.js +7 -5
  33. package/build/es/components/ProgressIndicator/ProgressIndicator.js +18 -18
  34. package/build/es/components/SecondaryNavigation/SecondaryNavigation.js +27 -27
  35. package/build/es/components/Textarea/Textarea.js +1 -1
  36. package/build/es/components/index.d.ts +1 -0
  37. package/build/es/index.js +1 -0
  38. package/build/es/themes/themeComponents/breakpoints.js +1 -0
  39. package/package.json +3 -2
@@ -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
  };
@@ -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;
@@ -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';
@@ -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');
@@ -194,6 +195,7 @@ exports.EnergyLabel = EnergyLabel.default;
194
195
  exports.Expander = Expander.default;
195
196
  exports.Floater = Floater.default;
196
197
  exports.Footer = Footer.default;
198
+ exports.Hero = Hero.default;
197
199
  exports.Icon = Icon.default;
198
200
  exports.hlArrowBackSmall = hlArrowBackSmall.default;
199
201
  exports.hlArrowForwardSmall = hlArrowForwardSmall.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};
@@ -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 };
@@ -0,0 +1,88 @@
1
+ import type { ComponentProps, ComponentType, ReactElement, ReactNode } from 'react';
2
+ import React from 'react';
3
+ import type Label from '../Label/Label';
4
+ import type ButtonPrimary from '../ButtonPrimary/ButtonPrimary';
5
+ import type Button from '../Button/Button';
6
+ interface CommonImageProps {
7
+ [key: string]: unknown;
8
+ src: string;
9
+ alt: string;
10
+ }
11
+ type HeroVariant = 'default' | 'centered' | 'centered-text-left';
12
+ type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
13
+ type ImageComponent = ComponentType<CommonImageProps> | 'img';
14
+ interface HeroProps {
15
+ /**
16
+ * Visual variant of the hero component
17
+ * - default: Content aligned to left with offset
18
+ * - centered: Content and text centered
19
+ * - centered-text-left: Content centered but text left-aligned
20
+ *
21
+ * @default 'default'
22
+ */
23
+ variant?: HeroVariant;
24
+ /**
25
+ * Image component to use for background - can be 'img' for plain HTML or a component like Next.js Image
26
+ * @default 'img'
27
+ */
28
+ Image?: ImageComponent;
29
+ /**
30
+ * Props to pass to the background Image component
31
+ */
32
+ imageProps?: CommonImageProps;
33
+ /**
34
+ * Background color when no image is provided
35
+ */
36
+ backgroundColor?: string;
37
+ /**
38
+ * Enable gradient overlay on background
39
+ *
40
+ * @default false
41
+ */
42
+ hasGradient?: boolean;
43
+ /**
44
+ * Logo image component for logo-style heroes
45
+ */
46
+ LogoImage?: ImageComponent;
47
+ /**
48
+ * Props to pass to the Logo image component
49
+ */
50
+ logoImageProps?: CommonImageProps;
51
+ /**
52
+ * Label content (must use Label component)
53
+ */
54
+ label?: ReactElement<ComponentProps<typeof Label>>;
55
+ /**
56
+ * Main heading content
57
+ */
58
+ heading?: ReactNode;
59
+ /**
60
+ * Heading level for semantic HTML
61
+ *
62
+ * @default 'h1'
63
+ */
64
+ headingLevel?: HeadingLevel;
65
+ /**
66
+ * Description text content
67
+ */
68
+ description?: ReactNode;
69
+ /**
70
+ * Primary call-to-action button
71
+ */
72
+ primaryCta?: ReactElement<ComponentProps<typeof ButtonPrimary>>;
73
+ /**
74
+ * Optional secondary call-to-action button
75
+ */
76
+ secondaryCta?: ReactElement<ComponentProps<typeof Button>>;
77
+ /**
78
+ * Allows to pass a custom className
79
+ */
80
+ className?: string;
81
+ /**
82
+ * Allows to pass testid string for testing purposes
83
+ */
84
+ 'data-testid'?: string;
85
+ }
86
+ declare const Hero: ({ variant, headingLevel, Image, LogoImage, "data-testid": dataTestId, ...props }: HeroProps) => React.JSX.Element;
87
+ /** @component */
88
+ export default Hero;
@@ -0,0 +1,194 @@
1
+ import { __rest } from 'tslib';
2
+ import React__default from 'react';
3
+ import { styled } from 'styled-components';
4
+ import theme from '../../themes/theme.js';
5
+ import { getMultipliedSize } from '../../utils/styledUtils.js';
6
+ import Box from '../Box/Box.js';
7
+
8
+ const HERO_CONSTANTS = {
9
+ mobileHeight: 220,
10
+ desktopMinHeight: 460,
11
+ logoMaxWidth: 500,
12
+ };
13
+ const HeroContainer = styled.div `
14
+ position: relative;
15
+ margin-bottom: ${getMultipliedSize(theme.base.baseWidth, 1.25)};
16
+
17
+ @media (min-width: ${theme.breakpoints.md}px) {
18
+ min-height: calc(
19
+ ${HERO_CONSTANTS.desktopMinHeight}px + ${getMultipliedSize(theme.base.baseHeight, 4)}
20
+ );
21
+ display: flex;
22
+ justify-content: ${({ $variant }) => $variant === 'centered' || $variant === 'centered-text-left' ? 'center' : 'flex-start'};
23
+ }
24
+ `;
25
+ const HeroImage = styled.div `
26
+ position: relative;
27
+ height: ${HERO_CONSTANTS.mobileHeight}px;
28
+ background-color: ${({ $backgroundColor }) => $backgroundColor || 'transparent'};
29
+
30
+ ${({ $hasGradient }) => $hasGradient &&
31
+ `
32
+ linear-gradient(180deg, ${theme.color.background.plum.default}${theme.color.transparency.T0} 0%, ${theme.color.background.plum.default}${theme.color.transparency.T30} 100%);
33
+ background-size: 100% 33.33%;
34
+ background-repeat: no-repeat;
35
+ background-position: bottom;
36
+ `}
37
+
38
+ @media (min-width: ${theme.breakpoints.md}px) {
39
+ height: auto;
40
+ position: absolute;
41
+ top: 0;
42
+ left: 0;
43
+ right: 0;
44
+ bottom: ${getMultipliedSize(theme.base.baseHeight, 4)};
45
+ }
46
+
47
+ img {
48
+ width: 100%;
49
+ height: 100%;
50
+ object-fit: cover;
51
+ display: block;
52
+ }
53
+ `;
54
+ const LogoImageWrap = styled.div `
55
+ position: relative;
56
+ height: 100%;
57
+ width: 100%;
58
+ margin: 0 auto;
59
+ padding: 0 ${getMultipliedSize(theme.base.baseWidth, 1.25)};
60
+ `;
61
+ const LogoImageContainer = styled.div `
62
+ position: absolute;
63
+ top: ${getMultipliedSize(theme.base.baseHeight, 1)};
64
+ bottom: ${getMultipliedSize(theme.base.baseHeight, 4)};
65
+ left: ${getMultipliedSize(theme.base.baseWidth, 1.25)};
66
+ right: ${getMultipliedSize(theme.base.baseWidth, 1.25)};
67
+ padding: ${getMultipliedSize(theme.base.baseWidth, 1.25)};
68
+ display: flex;
69
+ align-items: center;
70
+ justify-content: center;
71
+ max-width: ${HERO_CONSTANTS.logoMaxWidth}px;
72
+ margin: 0 auto;
73
+
74
+ img {
75
+ max-width: 100%;
76
+ max-height: 100%;
77
+ object-fit: contain;
78
+ }
79
+
80
+ @media (min-width: ${theme.breakpoints.md}px) {
81
+ top: ${getMultipliedSize(theme.base.baseWidth, 1.25)};
82
+ bottom: ${getMultipliedSize(theme.base.baseWidth, 1.25)};
83
+ right: ${getMultipliedSize(theme.base.baseWidth, 1.25)};
84
+ left: 50%;
85
+ }
86
+
87
+ @media (min-width: ${theme.breakpoints.lg}px) {
88
+ left: calc(min(64%, 750px));
89
+ }
90
+ `;
91
+ const ContentWrap = styled.div `
92
+ width: 100%;
93
+ padding: 0 ${getMultipliedSize(theme.base.baseWidth, 1.25)};
94
+ margin: -${getMultipliedSize(theme.base.baseHeight, 4)} auto 0;
95
+ z-index: 1;
96
+
97
+ @media (min-width: ${theme.breakpoints.md}px) {
98
+ display: flex;
99
+ align-items: flex-end;
100
+ padding: ${getMultipliedSize(theme.base.baseHeight, 4)}
101
+ ${getMultipliedSize(theme.base.baseWidth, 4)} 0;
102
+ margin: 0 auto;
103
+ justify-content: ${({ $variant }) => $variant === 'centered' || $variant === 'centered-text-left' ? 'center' : 'flex-start'};
104
+ }
105
+ `;
106
+ const Content = styled(Box).attrs({
107
+ elevation: 'extraHigh',
108
+ padding: getMultipliedSize(theme.base.baseWidth, 2),
109
+ }) `
110
+ position: relative;
111
+ text-align: ${({ $variant }) => ($variant === 'centered' ? 'center' : 'left')};
112
+
113
+ @media (min-width: ${theme.breakpoints.md}px) {
114
+ padding: ${getMultipliedSize(theme.base.baseWidth, 3)};
115
+ width: 50%;
116
+ max-width: 650px;
117
+ }
118
+
119
+ @media (min-width: ${theme.breakpoints.lg}px) {
120
+ padding: ${getMultipliedSize(theme.base.baseWidth, 4)};
121
+ width: 60%;
122
+ margin-left: ${({ $variant }) => $variant === 'centered' || $variant === 'centered-text-left'
123
+ ? '0'
124
+ : `${getMultipliedSize(theme.base.baseWidth, 4)}`};
125
+ }
126
+ `;
127
+ const LabelContainer = styled.div `
128
+ margin: 0 0 ${getMultipliedSize(theme.base.baseHeight, 1)};
129
+ `;
130
+ const TextContent = styled.div `
131
+ h1,
132
+ h2,
133
+ h3,
134
+ h4,
135
+ h5,
136
+ h6 {
137
+ margin: 0 0 ${getMultipliedSize(theme.base.baseWidth, 1.25)};
138
+ color: ${theme.color.text.black};
139
+ font-family: ${theme.fontFamily.default};
140
+ }
141
+
142
+ p {
143
+ margin: 0 0 ${getMultipliedSize(theme.base.baseWidth, 1)};
144
+ color: ${theme.color.text.black};
145
+ font-family: ${theme.fontFamily.default};
146
+ line-height: ${theme.lineHeight.default};
147
+
148
+ &:last-child {
149
+ margin-bottom: 0;
150
+ }
151
+ }
152
+ `;
153
+ const CtaArea = styled.div `
154
+ margin: ${getMultipliedSize(theme.base.baseWidth, 3)} 0 0;
155
+ display: flex;
156
+ flex-direction: column;
157
+ gap: ${getMultipliedSize(theme.base.baseWidth, 1.5)};
158
+ justify-content: ${({ $variant }) => ($variant === 'centered' ? 'center' : 'flex-start')};
159
+
160
+ @media (min-width: ${theme.breakpoints.md}px) {
161
+ flex-direction: row;
162
+ margin: ${getMultipliedSize(theme.base.baseWidth, 4)} 0 0;
163
+ }
164
+ `;
165
+ const renderImage = (ImageComponent, imageProps) => {
166
+ if (!imageProps)
167
+ return null;
168
+ if (typeof ImageComponent === 'string') {
169
+ // eslint-disable-next-line jsx-a11y/alt-text, react/jsx-props-no-spreading
170
+ return React__default.createElement("img", Object.assign({}, imageProps));
171
+ }
172
+ // eslint-disable-next-line react/jsx-props-no-spreading
173
+ return React__default.createElement(ImageComponent, Object.assign({}, imageProps));
174
+ };
175
+ const Hero = (_a) => {
176
+ var { variant = 'default', headingLevel = 'h1', Image = 'img', LogoImage = 'img', 'data-testid': dataTestId } = _a, props = __rest(_a, ["variant", "headingLevel", "Image", "LogoImage", 'data-testid']);
177
+ const HeadingTag = headingLevel;
178
+ return (React__default.createElement(HeroContainer, { "$variant": variant, className: props.className, "data-testid": dataTestId },
179
+ React__default.createElement(HeroImage, { "$hasGradient": props.hasGradient, "$backgroundColor": props.backgroundColor },
180
+ props.logoImageProps && (React__default.createElement(LogoImageWrap, null,
181
+ React__default.createElement(LogoImageContainer, null, renderImage(LogoImage, props.logoImageProps)))),
182
+ !props.logoImageProps && props.imageProps && renderImage(Image, props.imageProps)),
183
+ React__default.createElement(ContentWrap, { "$variant": variant },
184
+ React__default.createElement(Content, { "$variant": variant },
185
+ props.label && React__default.createElement(LabelContainer, null, props.label),
186
+ React__default.createElement(TextContent, null,
187
+ props.heading && React__default.createElement(HeadingTag, null, props.heading),
188
+ props.description),
189
+ (props.primaryCta || props.secondaryCta) && (React__default.createElement(CtaArea, { "$variant": variant },
190
+ props.primaryCta,
191
+ props.secondaryCta))))));
192
+ };
193
+
194
+ export { Hero as default };