@laerdal/life-react-components 1.4.1-dev.21 → 1.4.1-dev.23.full

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 (40) hide show
  1. package/dist/Banners/Banner.cjs +83 -184
  2. package/dist/Banners/Banner.cjs.map +1 -1
  3. package/dist/Banners/Banner.d.ts +1 -0
  4. package/dist/Banners/Banner.js +83 -188
  5. package/dist/Banners/Banner.js.map +1 -1
  6. package/dist/Banners/styles.cjs +43 -7
  7. package/dist/Banners/styles.cjs.map +1 -1
  8. package/dist/Banners/styles.js +43 -7
  9. package/dist/Banners/styles.js.map +1 -1
  10. package/dist/Button/Button.cjs +27 -101
  11. package/dist/Button/Button.cjs.map +1 -1
  12. package/dist/Button/Button.js +27 -101
  13. package/dist/Button/Button.js.map +1 -1
  14. package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
  15. package/dist/Dropdown/BasicDropdown.js.map +1 -1
  16. package/dist/Dropdown/ChipDropdownInput.cjs +2 -6
  17. package/dist/Dropdown/ChipDropdownInput.cjs.map +1 -1
  18. package/dist/Dropdown/ChipDropdownInput.js +2 -4
  19. package/dist/Dropdown/ChipDropdownInput.js.map +1 -1
  20. package/dist/Dropdown/CommonStyling.cjs +3 -17
  21. package/dist/Dropdown/CommonStyling.cjs.map +1 -1
  22. package/dist/Dropdown/CommonStyling.d.ts +0 -5
  23. package/dist/Dropdown/CommonStyling.js +3 -10
  24. package/dist/Dropdown/CommonStyling.js.map +1 -1
  25. package/dist/Dropdown/DropdownContent.cjs +18 -52
  26. package/dist/Dropdown/DropdownContent.cjs.map +1 -1
  27. package/dist/Dropdown/DropdownContent.js +19 -54
  28. package/dist/Dropdown/DropdownContent.js.map +1 -1
  29. package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
  30. package/dist/Dropdown/DropdownFilter.js.map +1 -1
  31. package/dist/MenuItem/MenuItem.cjs +104 -0
  32. package/dist/MenuItem/MenuItem.cjs.map +1 -0
  33. package/dist/MenuItem/MenuItem.d.ts +21 -0
  34. package/dist/MenuItem/MenuItem.js +64 -0
  35. package/dist/MenuItem/MenuItem.js.map +1 -0
  36. package/dist/QuizButton/QuizButton.cjs +1 -1
  37. package/dist/QuizButton/QuizButton.cjs.map +1 -1
  38. package/dist/QuizButton/QuizButton.js +1 -1
  39. package/dist/QuizButton/QuizButton.js.map +1 -1
  40. package/package.json +1 -1
@@ -69,7 +69,8 @@ var Banner = function Banner(_ref) {
69
69
  link = _ref.link,
70
70
  onClose = _ref.onClose,
71
71
  icon = _ref.icon,
72
- noIcon = _ref.noIcon;
72
+ noIcon = _ref.noIcon,
73
+ linkAction = _ref.linkAction;
73
74
 
74
75
  var _React$useState = React.useState(window.innerWidth),
75
76
  _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
@@ -83,202 +84,100 @@ var Banner = function Banner(_ref) {
83
84
 
84
85
  window.addEventListener('resize', handleResize);
85
86
  });
87
+ var bannerParams = {
88
+ typeColor: _styles.COLORS.primary_100,
89
+ accentColor: _styles.COLORS.primary_700,
90
+ hoverColor: _styles.COLORS.primary_20,
91
+ closeIconColor: _styles.COLORS.primary_500,
92
+ icon: _SystemIcons.Tip,
93
+ containerType: 'neutral',
94
+ focusBgColor: _styles.COLORS.primary_200
95
+ };
86
96
  var formatTypeToLowerCase = type === null || type === void 0 ? void 0 : type.toLowerCase();
87
97
 
88
- switch (formatTypeToLowerCase) {
89
- case 'warning':
90
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(BannerContainer, {
91
- "data-testid": testId,
92
- $type: _styles.COLORS.warning_100,
93
- link: _styles.COLORS.warning_700,
94
- hover: _styles.COLORS.warning_20,
95
- bottom: bottom,
96
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(BannerCenter, {
97
- $color: _styles.COLORS.warning_700,
98
- className: size,
99
- children: [icon ? icon : noIcon ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.Help, {
100
- color: _styles.COLORS.warning_700,
101
- size: "24px"
102
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(BannerContentWrapper, {
103
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_typography.ComponentResponsive, {
104
- size: size,
105
- width: width,
106
- color: _styles.COLORS.warning_700,
107
- children: [children, "\xA0\xA0", link && linkText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_HyperLink.HyperLink, {
108
- id: "".concat(Math.floor(Math.random() * 999999999999), "_BannerLink"),
109
- href: link,
110
- variant: "default",
111
- children: linkText
112
- })]
113
- })
114
- }), onClose && /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonWrapper, {
115
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonContainer, {
116
- $type: formatTypeToLowerCase,
117
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
118
- variant: "secondary",
119
- shape: "circular",
120
- useTransparentBackground: true,
121
- focusBackgroundColor: _styles.COLORS.warning_200,
122
- action: function action() {
123
- return onClose();
124
- },
125
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.Close, {
126
- color: _styles.COLORS.warning_500,
127
- size: "24px"
128
- })
129
- })
130
- })
131
- })]
132
- })
133
- });
134
-
135
- case 'critical':
136
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(BannerContainer, {
137
- "data-testid": testId,
138
- $type: _styles.COLORS.critical_100,
139
- link: _styles.COLORS.critical_700,
140
- hover: _styles.COLORS.critical_20,
141
- bottom: bottom,
142
- className: size,
143
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(BannerCenter, {
144
- $color: _styles.COLORS.critical_700,
145
- className: size,
146
- children: [icon ? icon : noIcon ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.TechnicalWarning, {
147
- color: _styles.COLORS.critical_700,
148
- size: "24px"
149
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(BannerContentWrapper, {
150
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_typography.ComponentResponsive, {
151
- size: size,
152
- width: width,
153
- color: _styles.COLORS.critical_700,
154
- children: [children, "\xA0\xA0", link && linkText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_HyperLink.HyperLink, {
155
- id: "".concat(Math.floor(Math.random() * 999999999999), "_BannerLink"),
156
- href: link,
157
- variant: "default",
158
- children: linkText
159
- })]
160
- })
161
- }), onClose && /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonWrapper, {
162
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonContainer, {
163
- $type: formatTypeToLowerCase,
164
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
165
- variant: "secondary",
166
- shape: "circular",
167
- useTransparentBackground: true,
168
- focusBackgroundColor: _styles.COLORS.critical_200,
169
- action: function action() {
170
- return onClose();
171
- },
172
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.Close, {
173
- color: _styles.COLORS.critical_500,
174
- size: "24px"
175
- })
176
- })
177
- })
178
- })]
179
- })
180
- });
98
+ if (formatTypeToLowerCase == 'warning') {
99
+ bannerParams.typeColor = _styles.COLORS.warning_100;
100
+ bannerParams.accentColor = _styles.COLORS.warning_700;
101
+ bannerParams.focusBgColor = _styles.COLORS.warning_200;
102
+ bannerParams.hoverColor = _styles.COLORS.warning_20;
103
+ bannerParams.icon = _SystemIcons.Help;
104
+ bannerParams.closeIconColor = _styles.COLORS.warning_500;
105
+ bannerParams.containerType = formatTypeToLowerCase;
106
+ } else if (formatTypeToLowerCase == 'critical') {
107
+ bannerParams.typeColor = _styles.COLORS.critical_100;
108
+ bannerParams.accentColor = _styles.COLORS.critical_700;
109
+ bannerParams.focusBgColor = _styles.COLORS.critical_200;
110
+ bannerParams.hoverColor = _styles.COLORS.critical_20;
111
+ bannerParams.icon = _SystemIcons.TechnicalWarning;
112
+ bannerParams.closeIconColor = _styles.COLORS.critical_500;
113
+ bannerParams.containerType = formatTypeToLowerCase;
114
+ } else if (formatTypeToLowerCase == 'positive') {
115
+ bannerParams.typeColor = _styles.COLORS.correct_100;
116
+ bannerParams.accentColor = _styles.COLORS.correct_700;
117
+ bannerParams.focusBgColor = _styles.COLORS.correct_200;
118
+ bannerParams.hoverColor = _styles.COLORS.correct_20;
119
+ bannerParams.icon = _SystemIcons.ThumbsUp;
120
+ bannerParams.closeIconColor = _styles.COLORS.correct_500;
121
+ bannerParams.containerType = formatTypeToLowerCase;
122
+ }
181
123
 
182
- case 'positive':
183
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(BannerContainer, {
184
- "data-testid": testId,
185
- $type: _styles.COLORS.correct_100,
186
- link: _styles.COLORS.correct_700,
187
- hover: _styles.COLORS.correct_20,
188
- bottom: bottom,
189
- className: size,
190
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(BannerCenter, {
191
- $color: _styles.COLORS.correct_700,
192
- className: size,
193
- children: [icon ? icon : noIcon ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.ThumbsUp, {
194
- color: _styles.COLORS.correct_700,
195
- size: "24px"
196
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(BannerContentWrapper, {
197
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_typography.ComponentResponsive, {
198
- size: size,
199
- width: width,
200
- color: _styles.COLORS.correct_700,
201
- children: [children, "\xA0\xA0", link && linkText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_HyperLink.HyperLink, {
202
- id: "".concat(Math.floor(Math.random() * 999999999999), "_BannerLink"),
203
- href: link,
204
- variant: "default",
205
- children: linkText
206
- })]
207
- })
208
- }), onClose && /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonWrapper, {
209
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonContainer, {
210
- $type: formatTypeToLowerCase,
211
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
212
- variant: "secondary",
213
- shape: "circular",
214
- useTransparentBackground: true,
215
- focusBackgroundColor: _styles.COLORS.correct_200,
216
- action: function action() {
217
- return onClose();
218
- },
219
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.Close, {
220
- color: _styles.COLORS.correct_500,
221
- size: "24px"
222
- })
223
- })
224
- })
124
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(BannerContainer, {
125
+ "data-testid": testId,
126
+ $type: bannerParams.typeColor,
127
+ link: bannerParams.accentColor,
128
+ hover: bannerParams.hoverColor,
129
+ bottom: bottom,
130
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(BannerCenter, {
131
+ $color: bannerParams.accentColor,
132
+ className: size,
133
+ children: [icon ? icon : noIcon ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(bannerParams.icon, {
134
+ color: bannerParams.accentColor,
135
+ size: "24px"
136
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(BannerContentWrapper, {
137
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_typography.ComponentResponsive, {
138
+ size: size,
139
+ width: width,
140
+ color: bannerParams.accentColor,
141
+ children: [children, "\xA0\xA0", link && linkText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_HyperLink.HyperLink, {
142
+ id: "".concat(Math.floor(Math.random() * 999999999999), "_BannerLink"),
143
+ onClick: function onClick(e) {
144
+ if (linkAction) {
145
+ e.preventDefault();
146
+ linkAction(e);
147
+ }
148
+ },
149
+ href: link,
150
+ variant: "default",
151
+ children: linkText
225
152
  })]
226
153
  })
227
- });
228
-
229
- default:
230
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(BannerContainer, {
231
- "data-testid": testId,
232
- $type: _styles.COLORS.primary_100,
233
- link: _styles.COLORS.primary_700,
234
- hover: _styles.COLORS.primary_20,
235
- bottom: bottom,
236
- className: size,
237
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(BannerCenter, {
238
- $color: _styles.COLORS.primary_700,
239
- className: size,
240
- children: [icon ? icon : noIcon ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.Tip, {
241
- color: _styles.COLORS.primary_700,
242
- size: "24px"
243
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(BannerContentWrapper, {
244
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_typography.ComponentResponsive, {
245
- size: size,
246
- width: width,
247
- color: _styles.COLORS.primary_700,
248
- children: [children, "\xA0\xA0", link && linkText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_HyperLink.HyperLink, {
249
- id: "".concat(Math.floor(Math.random() * 999999999999), "_BannerLink"),
250
- href: link,
251
- variant: "default",
252
- children: linkText
253
- })]
154
+ }), onClose && /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonWrapper, {
155
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonContainer, {
156
+ $type: bannerParams.containerType,
157
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
158
+ variant: "secondary",
159
+ shape: "circular",
160
+ useTransparentBackground: true,
161
+ focusBackgroundColor: bannerParams.focusBgColor,
162
+ action: function action() {
163
+ return onClose();
164
+ },
165
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.Close, {
166
+ color: bannerParams.closeIconColor,
167
+ size: "24px"
254
168
  })
255
- }), onClose && /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonWrapper, {
256
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonContainer, {
257
- $type: "neutral",
258
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
259
- variant: "secondary",
260
- shape: "circular",
261
- useTransparentBackground: true,
262
- focusBackgroundColor: _styles.COLORS.primary_200,
263
- action: function action() {
264
- return onClose();
265
- },
266
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.Close, {
267
- color: _styles.COLORS.primary_500,
268
- size: "24px"
269
- })
270
- })
271
- })
272
- })]
169
+ })
273
170
  })
274
- });
275
- }
171
+ })]
172
+ })
173
+ });
276
174
  };
277
175
 
278
176
  Banner.propTypes = {
279
177
  type: _propTypes.default.string,
280
178
  link: _propTypes.default.string,
281
179
  linkText: _propTypes.default.string,
180
+ linkAction: _propTypes.default.func,
282
181
  hover: _propTypes.default.string,
283
182
  bottom: _propTypes.default.bool,
284
183
  testId: _propTypes.default.string,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Banners/Banner.tsx"],"names":["BannerContainer","styled","div","props","$type","COLORS","correct_100","black","bottom","BREAKPOINTS","MEDIUM","LARGE","link","BannerCenter","ComponentTextStyle","Regular","$color","ButtonWrapper","ButtonContainer","BannerContentWrapper","Banner","size","type","children","testId","linkText","onClose","icon","noIcon","React","useState","window","innerWidth","width","setWidth","useEffect","handleResize","addEventListener","formatTypeToLowerCase","toLowerCase","warning_100","warning_700","warning_20","Math","floor","random","warning_200","warning_500","critical_100","critical_700","critical_20","critical_200","critical_500","correct_700","correct_20","correct_200","correct_500","primary_100","primary_700","primary_20","primary_200","primary_500","hover"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAOA,IAAMA,eAAe,GAAGC,0BAAOC,GAAV,4hBACL,UAACC,KAAD;AAAA,SAA8BA,KAAK,CAACC,KAAN,GAAcD,KAAK,CAACC,KAApB,GAA4BC,eAAOC,WAAjE;AAAA,CADK,EAIVD,eAAOE,KAJG,EAKL,UAACJ,KAAD;AAAA,SAA8BA,KAAK,CAACK,MAAN,GAAe,MAAf,GAAwB,GAAtD;AAAA,CALK,EAUfC,oBAAYC,MAVG,EAafD,oBAAYE,KAbG,EA4BR,UAACR,KAAD;AAAA,SAAwBA,KAAK,CAACS,IAA9B;AAAA,CA5BQ,CAArB;;AAgCA,IAAMC,YAAY,GAAGZ,0BAAOC,GAAV,iZACd,UAACC,KAAD;AAAA,SAAW,mCAAkBW,2BAAmBC,OAArC,EAA8CZ,KAAK,CAACa,MAApD,CAAX;AAAA,CADc,EAMdP,oBAAYC,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B,IAAI,CAACC,KAAL,CAAWD,IAAI,CAACE,MAAL,KAAgB,YAA3B,CAAL,gBAAb;AAAyE,gBAAA,IAAI,EAAEjC,IAA/E;AAAqF,gBAAA,OAAO,EAAC,SAA7F;AAAA,0BACGa;AADH,gBAHJ;AAAA;AADF,YAFF,EAYGC,OAAO,iBACN,qBAAC,aAAD;AAAA,mCACE,qBAAC,eAAD;AAAiB,cAAA,KAAK,EAAC,SAAvB;AAAA,qCACE,qBAAC,kBAAD;AAAY,gBAAA,OAAO,EAAC,WAApB;AAAgC,gBAAA,KAAK,EAAC,UAAtC;AAAiD,gBAAA,wBAAwB,MAAzE;AAA0E,gBAAA,oBAAoB,EAAErB,eAAOuD,WAAvG;AAAoH,gBAAA,MAAM,EAAE;AAAA,yBAAMlC,OAAO,EAAb;AAAA,iBAA5H;AAAA,uCACE,qBAAC,kBAAD;AAAO,kBAAA,KAAK,EAAErB,eAAOwD,WAArB;AAAkC,kBAAA,IAAI,EAAC;AAAvC;AADF;AADF;AADF,YAbJ;AAAA;AADF,QADF;AAnFJ;AA8GD,CAxHD;;;AAXEvC,EAAAA,I;AACAV,EAAAA,I;AACAa,EAAAA,Q;AACAqC,EAAAA,K;AACAtD,EAAAA,M;AACAgB,EAAAA,M;AACAG,EAAAA,I;AACAD,EAAAA,O;AACAE,EAAAA,M;;eA6HaR,M","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\n\nimport { BREAKPOINTS, COLORS, ComponentTextStyle } from '../styles';\nimport { Close, Help, TechnicalWarning, ThumbsUp, Tip } from '../icons/systemicons/SystemIcons';\nimport { IconButton } from '../Button';\nimport { getButtonStyle } from './styles';\nimport { Size } from '../types';\nimport { ComponentMStyling, ComponentResponsive } from '../styles/typography';\nimport { HyperLink } from '../HyperLink';\n\n/**\n * Styles for <Banner />\n */\ntype StyleBannerProps = BannerProps & { $type: string };\n\nconst BannerContainer = styled.div<StyleBannerProps>`\n background: ${(props: StyleBannerProps) => (props.$type ? props.$type : COLORS.correct_100)};\n min-height: 48px;\n display: flex;\n color: ${COLORS.black};\n margin-top: ${(props: StyleBannerProps) => (props.bottom ? 'auto' : '0')};\n\n button:last-child {\n line-height: 0;\n margin: 0 0 0 8px;\n ${BREAKPOINTS.MEDIUM} {\n margin: 0 0 0 16px;\n }\n ${BREAKPOINTS.LARGE} {\n margin: 0 0 0 32px;\n }\n &.small {\n margin: 0 0 0 8px;\n }\n &.medium {\n margin: 0 0 0 16px;\n }\n &.large {\n margin: 0 0 0 32px;\n }\n }\n\n a {\n color: ${(props: BannerProps) => props.link} !important;\n }\n`;\n\nconst BannerCenter = styled.div<{ $color: string }>`\n ${(props) => ComponentMStyling(ComponentTextStyle.Regular, props.$color)}\n\n display: flex;\n width: 100%;\n margin: 0 16px;\n ${BREAKPOINTS.MEDIUM} {\n margin: 0 32px;\n }\n ${BREAKPOINTS.LARGE} {\n margin: 0 56px;\n }\n &.small {\n margin: 0 16px;\n }\n &.medium {\n margin: 0 32px;\n }\n &.large {\n margin: 0 56px;\n }\n\n > svg {\n flex-shrink: 0;\n margin: 12px 0;\n }\n`;\n\nconst ButtonWrapper = styled.div`\n margin: 0 0 0 auto;\n`;\n\nconst ButtonContainer = styled.div<{ $type?: string }>`\n display: contents;\n ${(props) => (props.$type ? getButtonStyle(props.$type) : null)};\n`;\n\nconst BannerContentWrapper = styled.div`\n display: flex;\n align-items: center;\n margin: 12px 0;\n &:not(:first-child) {\n margin-left: 8px;\n }\n`;\n\ntype BannerProps = {\n size?: Size.Small | Size.Medium | Size.Large;\n type?: string;\n link?: string;\n linkText?: string;\n hover?: string;\n bottom?: boolean;\n testId?: string;\n icon?: React.ReactNode;\n onClose?: () => void;\n noIcon?: boolean;\n};\n\nconst Banner: React.FunctionComponent<BannerProps> = ({ size, type, children, bottom, testId, linkText, link, onClose, icon, noIcon }) => {\n const [width, setWidth] = React.useState<number>(window.innerWidth);\n React.useEffect(() => {\n function handleResize() {\n setWidth(window.innerWidth);\n }\n window.addEventListener('resize', handleResize);\n });\n\n const formatTypeToLowerCase = type?.toLowerCase();\n switch (formatTypeToLowerCase) {\n case 'warning':\n return (\n <BannerContainer data-testid={testId} $type={COLORS.warning_100} link={COLORS.warning_700} hover={COLORS.warning_20} bottom={bottom}>\n <BannerCenter $color={COLORS.warning_700} className={size}>\n {icon ? icon : noIcon ? null : <Help color={COLORS.warning_700} size=\"24px\" />}\n <BannerContentWrapper>\n <ComponentResponsive size={size} width={width} color={COLORS.warning_700}>\n {children}&nbsp;&nbsp;\n {link && linkText && (\n <HyperLink id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`} href={link} variant=\"default\">\n {linkText}\n </HyperLink>\n )}\n </ComponentResponsive>\n </BannerContentWrapper>\n {onClose && (\n <ButtonWrapper>\n <ButtonContainer $type={formatTypeToLowerCase}>\n <IconButton variant=\"secondary\" shape=\"circular\" useTransparentBackground focusBackgroundColor={COLORS.warning_200} action={() => onClose()}>\n <Close color={COLORS.warning_500} size=\"24px\" />\n </IconButton>\n </ButtonContainer>\n </ButtonWrapper>\n )}\n </BannerCenter>\n </BannerContainer>\n );\n case 'critical':\n return (\n <BannerContainer data-testid={testId} $type={COLORS.critical_100} link={COLORS.critical_700} hover={COLORS.critical_20} bottom={bottom} className={size}>\n <BannerCenter $color={COLORS.critical_700} className={size}>\n {icon ? icon : noIcon ? null : <TechnicalWarning color={COLORS.critical_700} size=\"24px\" />}\n <BannerContentWrapper>\n <ComponentResponsive size={size} width={width} color={COLORS.critical_700}>\n {children}&nbsp;&nbsp;\n {link && linkText && (\n <HyperLink id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`} href={link} variant=\"default\">\n {linkText}\n </HyperLink>\n )}\n </ComponentResponsive>\n </BannerContentWrapper>\n {onClose && (\n <ButtonWrapper>\n <ButtonContainer $type={formatTypeToLowerCase}>\n <IconButton variant=\"secondary\" shape=\"circular\" useTransparentBackground focusBackgroundColor={COLORS.critical_200} action={() => onClose()}>\n <Close color={COLORS.critical_500} size=\"24px\" />\n </IconButton>\n </ButtonContainer>\n </ButtonWrapper>\n )}\n </BannerCenter>\n </BannerContainer>\n );\n case 'positive':\n return (\n <BannerContainer data-testid={testId} $type={COLORS.correct_100} link={COLORS.correct_700} hover={COLORS.correct_20} bottom={bottom} className={size}>\n <BannerCenter $color={COLORS.correct_700} className={size}>\n {icon ? icon : noIcon ? null : <ThumbsUp color={COLORS.correct_700} size=\"24px\" />}\n <BannerContentWrapper>\n <ComponentResponsive size={size} width={width} color={COLORS.correct_700}>\n {children}&nbsp;&nbsp;\n {link && linkText && (\n <HyperLink id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`} href={link} variant=\"default\">\n {linkText}\n </HyperLink>\n )}\n </ComponentResponsive>\n </BannerContentWrapper>\n {onClose && (\n <ButtonWrapper>\n <ButtonContainer $type={formatTypeToLowerCase}>\n <IconButton variant=\"secondary\" shape=\"circular\" useTransparentBackground focusBackgroundColor={COLORS.correct_200} action={() => onClose()}>\n <Close color={COLORS.correct_500} size=\"24px\" />\n </IconButton>\n </ButtonContainer>\n </ButtonWrapper>\n )}\n </BannerCenter>\n </BannerContainer>\n );\n default:\n return (\n <BannerContainer data-testid={testId} $type={COLORS.primary_100} link={COLORS.primary_700} hover={COLORS.primary_20} bottom={bottom} className={size}>\n <BannerCenter $color={COLORS.primary_700} className={size}>\n {icon ? icon : noIcon ? null : <Tip color={COLORS.primary_700} size=\"24px\" />}\n <BannerContentWrapper>\n <ComponentResponsive size={size} width={width} color={COLORS.primary_700}>\n {children}&nbsp;&nbsp;\n {link && linkText && (\n <HyperLink id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`} href={link} variant=\"default\">\n {linkText}\n </HyperLink>\n )}\n </ComponentResponsive>\n </BannerContentWrapper>\n {onClose && (\n <ButtonWrapper>\n <ButtonContainer $type=\"neutral\">\n <IconButton variant=\"secondary\" shape=\"circular\" useTransparentBackground focusBackgroundColor={COLORS.primary_200} action={() => onClose()}>\n <Close color={COLORS.primary_500} size=\"24px\" />\n </IconButton>\n </ButtonContainer>\n </ButtonWrapper>\n )}\n </BannerCenter>\n </BannerContainer>\n );\n }\n};\n\nexport default Banner;\n"],"file":"Banner.cjs"}
1
+ {"version":3,"sources":["../../src/Banners/Banner.tsx"],"names":["BannerContainer","styled","div","props","$type","COLORS","correct_100","black","bottom","BREAKPOINTS","MEDIUM","LARGE","link","BannerCenter","ComponentTextStyle","Regular","$color","ButtonWrapper","ButtonContainer","BannerContentWrapper","Banner","size","type","children","testId","linkText","onClose","icon","noIcon","linkAction","React","useState","window","innerWidth","width","setWidth","useEffect","handleResize","addEventListener","bannerParams","typeColor","primary_100","accentColor","primary_700","hoverColor","primary_20","closeIconColor","primary_500","Tip","containerType","focusBgColor","primary_200","formatTypeToLowerCase","toLowerCase","warning_100","warning_700","warning_200","warning_20","Help","warning_500","critical_100","critical_700","critical_200","critical_20","TechnicalWarning","critical_500","correct_700","correct_200","correct_20","ThumbsUp","correct_500","Math","floor","random","e","preventDefault","hover"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAQA,IAAMA,eAAe,GAAGC,0BAAOC,GAAV,4hBACL,UAACC,KAAD;AAAA,SAA8BA,KAAK,CAACC,KAAN,GAAcD,KAAK,CAACC,KAApB,GAA4BC,eAAOC,WAAjE;AAAA,CADK,EAIVD,eAAOE,KAJG,EAKL,UAACJ,KAAD;AAAA,SAA8BA,KAAK,CAACK,MAAN,GAAe,MAAf,GAAwB,GAAtD;AAAA,CALK,EAUfC,oBAAYC,MAVG,EAafD,oBAAYE,KAbG,EA4BR,UAACR,KAAD;AAAA,SAAwBA,KAAK,CAACS,IAA9B;AAAA,CA5BQ,CAArB;;AAgCA,IAAMC,YAAY,GAAGZ,0BAAOC,GAAV,iZACd,UAACC,KAAD;AAAA,SAAW,mCAAkBW,2BAAmBC,OAArC,EAA8CZ,KAAK,CAACa,MAApD,CAAX;AAAA,CADc,EAMdP,oBAAYC,MANE,EASdD,oBA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AAF;AACA9C,gBAAAA,UAAU,CAAC6C,CAAD,CAAV;AACD;AACF,aANH;AAOE,YAAA,IAAI,EAAE9D,IAPR;AAOc,YAAA,OAAO,EAAC,SAPtB;AAAA,sBAQGa;AARH,YAHJ;AAAA;AADF,QAFF,EAmBGC,OAAO,iBACN,qBAAC,aAAD;AAAA,+BACE,qBAAC,eAAD;AAAiB,UAAA,KAAK,EAAEa,YAAY,CAACU,aAArC;AAAA,iCACE,qBAAC,kBAAD;AAAY,YAAA,OAAO,EAAC,WAApB;AAAgC,YAAA,KAAK,EAAC,UAAtC;AAAiD,YAAA,wBAAwB,MAAzE;AAA0E,YAAA,oBAAoB,EAAEV,YAAY,CAACW,YAA7G;AAA2H,YAAA,MAAM,EAAE;AAAA,qBAAMxB,OAAO,EAAb;AAAA,aAAnI;AAAA,mCACE,qBAAC,kBAAD;AAAO,cAAA,KAAK,EAAEa,YAAY,CAACO,cAA3B;AAA2C,cAAA,IAAI,EAAC;AAAhD;AADF;AADF;AADF,QApBJ;AAAA;AAHD,IAAP;AAiCD,CAnFD;;;AAZExB,EAAAA,I;AACAV,EAAAA,I;AACAa,EAAAA,Q;AACAI,EAAAA,U;AACA+C,EAAAA,K;AACApE,EAAAA,M;AACAgB,EAAAA,M;AACAG,EAAAA,I;AACAD,EAAAA,O;AACAE,EAAAA,M;;eAwFaR,M","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\n\nimport { BREAKPOINTS, COLORS, ComponentTextStyle } from '../styles';\nimport { Close, Help, TechnicalWarning, ThumbsUp, Tip } from '../icons/systemicons/SystemIcons';\nimport { IconButton } from '../Button';\nimport { getButtonStyle } from './styles';\nimport { Size } from '../types';\nimport { ComponentMStyling, ComponentResponsive } from '../styles/typography';\nimport { HyperLink } from '../HyperLink';\nimport { stringify } from 'querystring';\n\n/**\n * Styles for <Banner />\n */\ntype StyleBannerProps = BannerProps & { $type: string };\n\nconst BannerContainer = styled.div<StyleBannerProps>`\n background: ${(props: StyleBannerProps) => (props.$type ? props.$type : COLORS.correct_100)};\n min-height: 48px;\n display: flex;\n color: ${COLORS.black};\n margin-top: ${(props: StyleBannerProps) => (props.bottom ? 'auto' : '0')};\n\n button:last-child {\n line-height: 0;\n margin: 0 0 0 8px;\n ${BREAKPOINTS.MEDIUM} {\n margin: 0 0 0 16px;\n }\n ${BREAKPOINTS.LARGE} {\n margin: 0 0 0 32px;\n }\n &.small {\n margin: 0 0 0 8px;\n }\n &.medium {\n margin: 0 0 0 16px;\n }\n &.large {\n margin: 0 0 0 32px;\n }\n }\n\n a {\n color: ${(props: BannerProps) => props.link} !important;\n }\n`;\n\nconst BannerCenter = styled.div<{ $color: string }>`\n ${(props) => ComponentMStyling(ComponentTextStyle.Regular, props.$color)}\n\n display: flex;\n width: 100%;\n margin: 0 16px;\n ${BREAKPOINTS.MEDIUM} {\n margin: 0 32px;\n }\n ${BREAKPOINTS.LARGE} {\n margin: 0 56px;\n }\n &.small {\n margin: 0 16px;\n }\n &.medium {\n margin: 0 32px;\n }\n &.large {\n margin: 0 56px;\n }\n\n > svg {\n flex-shrink: 0;\n margin: 12px 0;\n }\n`;\n\nconst ButtonWrapper = styled.div`\n margin: 0 0 0 auto;\n`;\n\nconst ButtonContainer = styled.div<{ $type?: string }>`\n display: contents;\n ${(props) => (props.$type ? getButtonStyle(props.$type) : null)};\n`;\n\nconst BannerContentWrapper = styled.div`\n display: flex;\n align-items: center;\n margin: 12px 0;\n &:not(:first-child) {\n margin-left: 8px;\n }\n`;\n\ntype BannerProps = {\n size?: Size.Small | Size.Medium | Size.Large;\n type?: string;\n link?: string;\n linkText?: string;\n linkAction?: (ev: React.MouseEvent) => void;\n hover?: string;\n bottom?: boolean;\n testId?: string;\n icon?: React.ReactNode;\n onClose?: () => void;\n noIcon?: boolean;\n};\n\nconst Banner: React.FunctionComponent<BannerProps> = ({ size, type, children, bottom, testId, linkText, link, onClose, icon, noIcon, linkAction }) => {\n const [width, setWidth] = React.useState<number>(window.innerWidth);\n React.useEffect(() => {\n function handleResize() {\n setWidth(window.innerWidth);\n }\n window.addEventListener('resize', handleResize);\n });\n\n let bannerParams = {\n typeColor: COLORS.primary_100,\n accentColor: COLORS.primary_700, \n hoverColor: COLORS.primary_20,\n closeIconColor: COLORS.primary_500,\n icon: Tip,\n containerType: 'neutral',\n focusBgColor: COLORS.primary_200\n };\n const formatTypeToLowerCase = type?.toLowerCase();\n if(formatTypeToLowerCase == 'warning')\n {\n bannerParams.typeColor = COLORS.warning_100;\n bannerParams.accentColor = COLORS.warning_700;\n bannerParams.focusBgColor = COLORS.warning_200;\n bannerParams.hoverColor = COLORS.warning_20;\n bannerParams.icon = Help;\n bannerParams.closeIconColor = COLORS.warning_500;\n bannerParams.containerType = formatTypeToLowerCase;\n }\n else if (formatTypeToLowerCase == 'critical')\n {\n bannerParams.typeColor = COLORS.critical_100;\n bannerParams.accentColor = COLORS.critical_700;\n bannerParams.focusBgColor = COLORS.critical_200;\n bannerParams.hoverColor = COLORS.critical_20;\n bannerParams.icon = TechnicalWarning;\n bannerParams.closeIconColor = COLORS.critical_500;\n bannerParams.containerType = formatTypeToLowerCase;\n }\n else if (formatTypeToLowerCase == 'positive')\n {\n bannerParams.typeColor = COLORS.correct_100;\n bannerParams.accentColor = COLORS.correct_700;\n bannerParams.focusBgColor = COLORS.correct_200;\n bannerParams.hoverColor = COLORS.correct_20;\n bannerParams.icon = ThumbsUp;\n bannerParams.closeIconColor = COLORS.correct_500;\n bannerParams.containerType = formatTypeToLowerCase;\n }\n\n return <BannerContainer data-testid={testId} $type={bannerParams.typeColor} \n link={bannerParams.accentColor} \n hover={bannerParams.hoverColor} bottom={bottom}>\n <BannerCenter $color={bannerParams.accentColor} className={size}>\n {icon ? icon : noIcon ? null : <bannerParams.icon color={bannerParams.accentColor} size=\"24px\" />}\n <BannerContentWrapper>\n <ComponentResponsive size={size} width={width} color={bannerParams.accentColor}>\n {children}&nbsp;&nbsp;\n {link && linkText && (\n <HyperLink id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`} \n onClick={(e) => {\n if(linkAction) {\n e.preventDefault();\n linkAction(e);\n }\n }}\n href={link} variant=\"default\">\n {linkText}\n </HyperLink>\n )}\n </ComponentResponsive>\n </BannerContentWrapper>\n {onClose && (\n <ButtonWrapper>\n <ButtonContainer $type={bannerParams.containerType}>\n <IconButton variant=\"secondary\" shape=\"circular\" useTransparentBackground focusBackgroundColor={bannerParams.focusBgColor} action={() => onClose()}>\n <Close color={bannerParams.closeIconColor} size=\"24px\" />\n </IconButton>\n </ButtonContainer>\n </ButtonWrapper>\n )}\n </BannerCenter>\n </BannerContainer>;\n};\n\nexport default Banner;\n"],"file":"Banner.cjs"}
@@ -5,6 +5,7 @@ declare type BannerProps = {
5
5
  type?: string;
6
6
  link?: string;
7
7
  linkText?: string;
8
+ linkAction?: (ev: React.MouseEvent) => void;
8
9
  hover?: string;
9
10
  bottom?: boolean;
10
11
  testId?: string;