@laerdal/life-react-components 1.4.1-dev.22.full → 1.4.1-dev.24.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.
- package/dist/Banners/Banner.cjs +83 -184
- package/dist/Banners/Banner.cjs.map +1 -1
- package/dist/Banners/Banner.d.ts +1 -0
- package/dist/Banners/Banner.js +83 -188
- package/dist/Banners/Banner.js.map +1 -1
- package/dist/Banners/styles.cjs +43 -7
- package/dist/Banners/styles.cjs.map +1 -1
- package/dist/Banners/styles.js +43 -7
- package/dist/Banners/styles.js.map +1 -1
- package/dist/Button/Button.cjs +27 -101
- package/dist/Button/Button.cjs.map +1 -1
- package/dist/Button/Button.js +27 -101
- package/dist/Button/Button.js.map +1 -1
- package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
- package/dist/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/Dropdown/ChipDropdownInput.cjs +2 -6
- package/dist/Dropdown/ChipDropdownInput.cjs.map +1 -1
- package/dist/Dropdown/ChipDropdownInput.js +2 -4
- package/dist/Dropdown/ChipDropdownInput.js.map +1 -1
- package/dist/Dropdown/CommonStyling.cjs +3 -17
- package/dist/Dropdown/CommonStyling.cjs.map +1 -1
- package/dist/Dropdown/CommonStyling.d.ts +0 -5
- package/dist/Dropdown/CommonStyling.js +3 -10
- package/dist/Dropdown/CommonStyling.js.map +1 -1
- package/dist/Dropdown/DropdownContent.cjs +18 -52
- package/dist/Dropdown/DropdownContent.cjs.map +1 -1
- package/dist/Dropdown/DropdownContent.js +19 -54
- package/dist/Dropdown/DropdownContent.js.map +1 -1
- package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
- package/dist/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/MenuItem/MenuItem.cjs +104 -0
- package/dist/MenuItem/MenuItem.cjs.map +1 -0
- package/dist/MenuItem/MenuItem.d.ts +21 -0
- package/dist/MenuItem/MenuItem.js +64 -0
- package/dist/MenuItem/MenuItem.js.map +1 -0
- package/package.json +1 -1
package/dist/Banners/Banner.js
CHANGED
|
@@ -12,10 +12,6 @@ import { IconButton } from '../Button';
|
|
|
12
12
|
import { getButtonStyle } from './styles';
|
|
13
13
|
import { ComponentMStyling, ComponentResponsive } from '../styles/typography';
|
|
14
14
|
import { HyperLink } from '../HyperLink';
|
|
15
|
-
/**
|
|
16
|
-
* Styles for <Banner />
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
17
|
var BannerContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n min-height: 48px;\n display: flex;\n color: ", ";\n margin-top: ", ";\n\n button:last-child {\n line-height: 0;\n margin: 0 0 0 8px;\n ", " {\n margin: 0 0 0 16px;\n }\n ", " {\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: ", " !important;\n }\n"])), function (props) {
|
|
@@ -44,7 +40,8 @@ var Banner = function Banner(_ref) {
|
|
|
44
40
|
link = _ref.link,
|
|
45
41
|
onClose = _ref.onClose,
|
|
46
42
|
icon = _ref.icon,
|
|
47
|
-
noIcon = _ref.noIcon
|
|
43
|
+
noIcon = _ref.noIcon,
|
|
44
|
+
linkAction = _ref.linkAction;
|
|
48
45
|
|
|
49
46
|
var _React$useState = React.useState(window.innerWidth),
|
|
50
47
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -58,202 +55,100 @@ var Banner = function Banner(_ref) {
|
|
|
58
55
|
|
|
59
56
|
window.addEventListener('resize', handleResize);
|
|
60
57
|
});
|
|
58
|
+
var bannerParams = {
|
|
59
|
+
typeColor: COLORS.primary_100,
|
|
60
|
+
accentColor: COLORS.primary_700,
|
|
61
|
+
hoverColor: COLORS.primary_20,
|
|
62
|
+
closeIconColor: COLORS.primary_500,
|
|
63
|
+
icon: Tip,
|
|
64
|
+
containerType: 'neutral',
|
|
65
|
+
focusBgColor: COLORS.primary_200
|
|
66
|
+
};
|
|
61
67
|
var formatTypeToLowerCase = type === null || type === void 0 ? void 0 : type.toLowerCase();
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
})
|
|
89
|
-
}), onClose && /*#__PURE__*/_jsx(ButtonWrapper, {
|
|
90
|
-
children: /*#__PURE__*/_jsx(ButtonContainer, {
|
|
91
|
-
$type: formatTypeToLowerCase,
|
|
92
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
|
93
|
-
variant: "secondary",
|
|
94
|
-
shape: "circular",
|
|
95
|
-
useTransparentBackground: true,
|
|
96
|
-
focusBackgroundColor: COLORS.warning_200,
|
|
97
|
-
action: function action() {
|
|
98
|
-
return onClose();
|
|
99
|
-
},
|
|
100
|
-
children: /*#__PURE__*/_jsx(Close, {
|
|
101
|
-
color: COLORS.warning_500,
|
|
102
|
-
size: "24px"
|
|
103
|
-
})
|
|
104
|
-
})
|
|
105
|
-
})
|
|
106
|
-
})]
|
|
107
|
-
})
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
case 'critical':
|
|
111
|
-
return /*#__PURE__*/_jsx(BannerContainer, {
|
|
112
|
-
"data-testid": testId,
|
|
113
|
-
$type: COLORS.critical_100,
|
|
114
|
-
link: COLORS.critical_700,
|
|
115
|
-
hover: COLORS.critical_20,
|
|
116
|
-
bottom: bottom,
|
|
117
|
-
className: size,
|
|
118
|
-
children: /*#__PURE__*/_jsxs(BannerCenter, {
|
|
119
|
-
$color: COLORS.critical_700,
|
|
120
|
-
className: size,
|
|
121
|
-
children: [icon ? icon : noIcon ? null : /*#__PURE__*/_jsx(TechnicalWarning, {
|
|
122
|
-
color: COLORS.critical_700,
|
|
123
|
-
size: "24px"
|
|
124
|
-
}), /*#__PURE__*/_jsx(BannerContentWrapper, {
|
|
125
|
-
children: /*#__PURE__*/_jsxs(ComponentResponsive, {
|
|
126
|
-
size: size,
|
|
127
|
-
width: width,
|
|
128
|
-
color: COLORS.critical_700,
|
|
129
|
-
children: [children, "\xA0\xA0", link && linkText && /*#__PURE__*/_jsx(HyperLink, {
|
|
130
|
-
id: "".concat(Math.floor(Math.random() * 999999999999), "_BannerLink"),
|
|
131
|
-
href: link,
|
|
132
|
-
variant: "default",
|
|
133
|
-
children: linkText
|
|
134
|
-
})]
|
|
135
|
-
})
|
|
136
|
-
}), onClose && /*#__PURE__*/_jsx(ButtonWrapper, {
|
|
137
|
-
children: /*#__PURE__*/_jsx(ButtonContainer, {
|
|
138
|
-
$type: formatTypeToLowerCase,
|
|
139
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
|
140
|
-
variant: "secondary",
|
|
141
|
-
shape: "circular",
|
|
142
|
-
useTransparentBackground: true,
|
|
143
|
-
focusBackgroundColor: COLORS.critical_200,
|
|
144
|
-
action: function action() {
|
|
145
|
-
return onClose();
|
|
146
|
-
},
|
|
147
|
-
children: /*#__PURE__*/_jsx(Close, {
|
|
148
|
-
color: COLORS.critical_500,
|
|
149
|
-
size: "24px"
|
|
150
|
-
})
|
|
151
|
-
})
|
|
152
|
-
})
|
|
153
|
-
})]
|
|
154
|
-
})
|
|
155
|
-
});
|
|
69
|
+
if (formatTypeToLowerCase == 'warning') {
|
|
70
|
+
bannerParams.typeColor = COLORS.warning_100;
|
|
71
|
+
bannerParams.accentColor = COLORS.warning_700;
|
|
72
|
+
bannerParams.focusBgColor = COLORS.warning_200;
|
|
73
|
+
bannerParams.hoverColor = COLORS.warning_20;
|
|
74
|
+
bannerParams.icon = Help;
|
|
75
|
+
bannerParams.closeIconColor = COLORS.warning_500;
|
|
76
|
+
bannerParams.containerType = formatTypeToLowerCase;
|
|
77
|
+
} else if (formatTypeToLowerCase == 'critical') {
|
|
78
|
+
bannerParams.typeColor = COLORS.critical_100;
|
|
79
|
+
bannerParams.accentColor = COLORS.critical_700;
|
|
80
|
+
bannerParams.focusBgColor = COLORS.critical_200;
|
|
81
|
+
bannerParams.hoverColor = COLORS.critical_20;
|
|
82
|
+
bannerParams.icon = TechnicalWarning;
|
|
83
|
+
bannerParams.closeIconColor = COLORS.critical_500;
|
|
84
|
+
bannerParams.containerType = formatTypeToLowerCase;
|
|
85
|
+
} else if (formatTypeToLowerCase == 'positive') {
|
|
86
|
+
bannerParams.typeColor = COLORS.correct_100;
|
|
87
|
+
bannerParams.accentColor = COLORS.correct_700;
|
|
88
|
+
bannerParams.focusBgColor = COLORS.correct_200;
|
|
89
|
+
bannerParams.hoverColor = COLORS.correct_20;
|
|
90
|
+
bannerParams.icon = ThumbsUp;
|
|
91
|
+
bannerParams.closeIconColor = COLORS.correct_500;
|
|
92
|
+
bannerParams.containerType = formatTypeToLowerCase;
|
|
93
|
+
}
|
|
156
94
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
children:
|
|
185
|
-
$type: formatTypeToLowerCase,
|
|
186
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
|
187
|
-
variant: "secondary",
|
|
188
|
-
shape: "circular",
|
|
189
|
-
useTransparentBackground: true,
|
|
190
|
-
focusBackgroundColor: COLORS.correct_200,
|
|
191
|
-
action: function action() {
|
|
192
|
-
return onClose();
|
|
193
|
-
},
|
|
194
|
-
children: /*#__PURE__*/_jsx(Close, {
|
|
195
|
-
color: COLORS.correct_500,
|
|
196
|
-
size: "24px"
|
|
197
|
-
})
|
|
198
|
-
})
|
|
199
|
-
})
|
|
95
|
+
return /*#__PURE__*/_jsx(BannerContainer, {
|
|
96
|
+
"data-testid": testId,
|
|
97
|
+
$type: bannerParams.typeColor,
|
|
98
|
+
link: bannerParams.accentColor,
|
|
99
|
+
hover: bannerParams.hoverColor,
|
|
100
|
+
bottom: bottom,
|
|
101
|
+
children: /*#__PURE__*/_jsxs(BannerCenter, {
|
|
102
|
+
$color: bannerParams.accentColor,
|
|
103
|
+
className: size,
|
|
104
|
+
children: [icon ? icon : noIcon ? null : /*#__PURE__*/_jsx(bannerParams.icon, {
|
|
105
|
+
color: bannerParams.accentColor,
|
|
106
|
+
size: "24px"
|
|
107
|
+
}), /*#__PURE__*/_jsx(BannerContentWrapper, {
|
|
108
|
+
children: /*#__PURE__*/_jsxs(ComponentResponsive, {
|
|
109
|
+
size: size,
|
|
110
|
+
width: width,
|
|
111
|
+
color: bannerParams.accentColor,
|
|
112
|
+
children: [children, "\xA0\xA0", link && linkText && /*#__PURE__*/_jsx(HyperLink, {
|
|
113
|
+
id: "".concat(Math.floor(Math.random() * 999999999999), "_BannerLink"),
|
|
114
|
+
onClick: function onClick(e) {
|
|
115
|
+
if (linkAction) {
|
|
116
|
+
e.preventDefault();
|
|
117
|
+
linkAction(e);
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
href: link,
|
|
121
|
+
variant: "default",
|
|
122
|
+
children: linkText
|
|
200
123
|
})]
|
|
201
124
|
})
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
color: COLORS.primary_700,
|
|
217
|
-
size: "24px"
|
|
218
|
-
}), /*#__PURE__*/_jsx(BannerContentWrapper, {
|
|
219
|
-
children: /*#__PURE__*/_jsxs(ComponentResponsive, {
|
|
220
|
-
size: size,
|
|
221
|
-
width: width,
|
|
222
|
-
color: COLORS.primary_700,
|
|
223
|
-
children: [children, "\xA0\xA0", link && linkText && /*#__PURE__*/_jsx(HyperLink, {
|
|
224
|
-
id: "".concat(Math.floor(Math.random() * 999999999999), "_BannerLink"),
|
|
225
|
-
href: link,
|
|
226
|
-
variant: "default",
|
|
227
|
-
children: linkText
|
|
228
|
-
})]
|
|
125
|
+
}), onClose && /*#__PURE__*/_jsx(ButtonWrapper, {
|
|
126
|
+
children: /*#__PURE__*/_jsx(ButtonContainer, {
|
|
127
|
+
$type: bannerParams.containerType,
|
|
128
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
129
|
+
variant: "secondary",
|
|
130
|
+
shape: "circular",
|
|
131
|
+
useTransparentBackground: true,
|
|
132
|
+
focusBackgroundColor: bannerParams.focusBgColor,
|
|
133
|
+
action: function action() {
|
|
134
|
+
return onClose();
|
|
135
|
+
},
|
|
136
|
+
children: /*#__PURE__*/_jsx(Close, {
|
|
137
|
+
color: bannerParams.closeIconColor,
|
|
138
|
+
size: "24px"
|
|
229
139
|
})
|
|
230
|
-
})
|
|
231
|
-
children: /*#__PURE__*/_jsx(ButtonContainer, {
|
|
232
|
-
$type: "neutral",
|
|
233
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
|
234
|
-
variant: "secondary",
|
|
235
|
-
shape: "circular",
|
|
236
|
-
useTransparentBackground: true,
|
|
237
|
-
focusBackgroundColor: COLORS.primary_200,
|
|
238
|
-
action: function action() {
|
|
239
|
-
return onClose();
|
|
240
|
-
},
|
|
241
|
-
children: /*#__PURE__*/_jsx(Close, {
|
|
242
|
-
color: COLORS.primary_500,
|
|
243
|
-
size: "24px"
|
|
244
|
-
})
|
|
245
|
-
})
|
|
246
|
-
})
|
|
247
|
-
})]
|
|
140
|
+
})
|
|
248
141
|
})
|
|
249
|
-
})
|
|
250
|
-
|
|
142
|
+
})]
|
|
143
|
+
})
|
|
144
|
+
});
|
|
251
145
|
};
|
|
252
146
|
|
|
253
147
|
Banner.propTypes = {
|
|
254
148
|
type: _pt.string,
|
|
255
149
|
link: _pt.string,
|
|
256
150
|
linkText: _pt.string,
|
|
151
|
+
linkAction: _pt.func,
|
|
257
152
|
hover: _pt.string,
|
|
258
153
|
bottom: _pt.bool,
|
|
259
154
|
testId: _pt.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Banners/Banner.tsx"],"names":["React","styled","BREAKPOINTS","COLORS","ComponentTextStyle","Close","Help","TechnicalWarning","ThumbsUp","Tip","IconButton","getButtonStyle","ComponentMStyling","ComponentResponsive","HyperLink","BannerContainer","div","props","$type","correct_100","black","bottom","MEDIUM","LARGE","link","BannerCenter","Regular","$color","ButtonWrapper","ButtonContainer","BannerContentWrapper","Banner","size","type","children","testId","linkText","onClose","icon","noIcon","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,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AAEA,SAASC,WAAT,EAAsBC,MAAtB,EAA8BC,kBAA9B,QAAwD,WAAxD;AACA,SAASC,KAAT,EAAgBC,IAAhB,EAAsBC,gBAAtB,EAAwCC,QAAxC,EAAkDC,GAAlD,QAA6D,kCAA7D;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,S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AA0E,gBAAA,oBAAoB,EAAElC,MAAM,CAACmE,WAAvG;AAAoH,gBAAA,MAAM,EAAE;AAAA,yBAAMjC,OAAO,EAAb;AAAA,iBAA5H;AAAA,uCACE,KAAC,KAAD;AAAO,kBAAA,KAAK,EAAElC,MAAM,CAACoE,WAArB;AAAkC,kBAAA,IAAI,EAAC;AAAvC;AADF;AADF;AADF,YAbJ;AAAA;AADF,QADF;AAnFJ;AA8GD,CAxHD;;;AAXEtC,EAAAA,I;AACAT,EAAAA,I;AACAY,EAAAA,Q;AACAoC,EAAAA,K;AACAnD,EAAAA,M;AACAc,EAAAA,M;AACAG,EAAAA,I;AACAD,EAAAA,O;AACAE,EAAAA,M;;AA6HF,eAAeR,MAAf","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} \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} \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} \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} \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.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/Banners/Banner.tsx"],"names":["React","styled","BREAKPOINTS","COLORS","ComponentTextStyle","Close","Help","TechnicalWarning","ThumbsUp","Tip","IconButton","getButtonStyle","ComponentMStyling","ComponentResponsive","HyperLink","BannerContainer","div","props","$type","correct_100","black","bottom","MEDIUM","LARGE","link","BannerCenter","Regular","$color","ButtonWrapper","ButtonContainer","BannerContentWrapper","Banner","size","type","children","testId","linkText","onClose","icon","noIcon","linkAction","useState","window","innerWidth","width","setWidth","useEffect","handleResize","addEventListener","bannerParams","typeColor","primary_100","accentColor","primary_700","hoverColor","primary_20","closeIconColor","primary_500","containerType","focusBgColor","primary_200","formatTypeToLowerCase","toLowerCase","warning_100","warning_700","warning_200","warning_20","warning_500","critical_100","critical_700","critical_200","critical_20","critical_500","correct_700","correct_200","correct_20","correct_500","Math","floor","random","e","preventDefault","hover"],"mappings":";;;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AAEA,SAASC,WAAT,EAAsBC,MAAtB,EAA8BC,kBAA9B,QAAwD,WAAxD;AACA,SAASC,KAAT,EAAgBC,IAAhB,EAAsBC,gBAAtB,EAAwCC,QAAxC,EAAkDC,GAAlD,QAA6D,kCAA7D;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,SAASC,cAAT,QAA+B,UAA/B;AAEA,SAASC,iBAAT,EAA4BC,mBAA5B,QAAuD,sBAAvD;AACA,SAASC,SAAT,QAA0B,cAA1B;;;AAQA,IAAMC,eAAe,GAAGd,MAAM,CAACe,GAAV,8gBACL,UAACC,KAAD;AAAA,SAA8BA,KAAK,CAACC,KAAN,GAAcD,KAAK,CAACC,KAApB,GAA4Bf,MAAM,CAACgB,WAAjE;AAAA,CADK,EAIVhB,MAAM,CAACiB,KAJG,EAKL,UAACH,KAAD;AAAA,SAA8BA,KAAK,CAACI,MAAN,GAAe,MAAf,GAAwB,GAAtD;AAAA,CALK,EAUfnB,WAAW,CAACoB,MAVG,EAafpB,WAAW,CAACqB,KAbG,EA4BR,UAACN,KAAD;AAAA,SAAwBA,KAAK,CAACO,IAA9B;AAAA,CA5BQ,CAArB;AAgCA,IAAMC,YAAY,GAAGxB,MAAM,CAACe,GAAV,mYACd,UAACC,KAAD;AAAA,SAAWL,iBAAiB,CAACR,kBAAkB,CAACsB,OAApB,EAA6BT,KAAK,CAACU,MAAnC,CAA5B;AAAA,CADc,EAMdzB,WAAW,CAACoB,MANE,EASdpB,WAAW,CAACqB,KATE,CAAlB;AA4BA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AAEE,YAAA,OAAO,EAAE,iBAACC,CAAD,EAAO;AACd,kBAAIxC,UAAJ,EAAgB;AACdwC,gBAAAA,CAAC,CAACC,cAAF;AACAzC,gBAAAA,UAAU,CAACwC,CAAD,CAAV;AACD;AACF,aAPH;AAQE,YAAA,IAAI,EAAExD,IARR;AASE,YAAA,OAAO,EAAC,SATV;AAAA,sBAUGY;AAVH,YAHJ;AAAA;AADF,QAFF,EAqBGC,OAAO,iBACN,KAAC,aAAD;AAAA,+BACE,KAAC,eAAD;AAAiB,UAAA,KAAK,EAAEY,YAAY,CAACS,aAArC;AAAA,iCACE,KAAC,UAAD;AAAY,YAAA,OAAO,EAAC,WAApB;AAAgC,YAAA,KAAK,EAAC,UAAtC;AAAiD,YAAA,wBAAwB,MAAzE;AAA0E,YAAA,oBAAoB,EAAET,YAAY,CAACU,YAA7G;AAA2H,YAAA,MAAM,EAAE;AAAA,qBAAMtB,OAAO,EAAb;AAAA,aAAnI;AAAA,mCACE,KAAC,KAAD;AAAO,cAAA,KAAK,EAAEY,YAAY,CAACO,cAA3B;AAA2C,cAAA,IAAI,EAAC;AAAhD;AADF;AADF;AADF,QAtBJ;AAAA;AADF,IADF;AAmCD,CAhFD;;;AAZEvB,EAAAA,I;AACAT,EAAAA,I;AACAY,EAAAA,Q;AACAI,EAAAA,U;AACA0C,EAAAA,K;AACA7D,EAAAA,M;AACAc,EAAAA,M;AACAG,EAAAA,I;AACAD,EAAAA,O;AACAE,EAAAA,M;;AAqFF,eAAeR,MAAf","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 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 } else if (formatTypeToLowerCase == 'critical') {\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 } else if (formatTypeToLowerCase == 'positive') {\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 (\n <BannerContainer data-testid={testId} $type={bannerParams.typeColor} link={bannerParams.accentColor} 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} \n {link && linkText && (\n <HyperLink\n id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`}\n onClick={(e) => {\n if (linkAction) {\n e.preventDefault();\n linkAction(e);\n }\n }}\n href={link}\n 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};\n\nexport default Banner;\n"],"file":"Banner.js"}
|
package/dist/Banners/styles.cjs
CHANGED
|
@@ -15,22 +15,58 @@ var _Iconbutton = require("../Button/Iconbutton");
|
|
|
15
15
|
|
|
16
16
|
var _styles = require("../styles");
|
|
17
17
|
|
|
18
|
-
var _templateObject
|
|
18
|
+
var _templateObject;
|
|
19
19
|
|
|
20
20
|
var getButtonStyle = function getButtonStyle(type) {
|
|
21
|
+
var style = {
|
|
22
|
+
svgFill: _styles.COLORS.primary_500,
|
|
23
|
+
hoverBgColor: _styles.COLORS.primary_200,
|
|
24
|
+
hoverSvgFill: _styles.COLORS.primary_700,
|
|
25
|
+
activeBgColor: _styles.COLORS.primary_300,
|
|
26
|
+
activeSvgFill: _styles.COLORS.primary_800,
|
|
27
|
+
focusBgColor: _styles.COLORS.primary_200,
|
|
28
|
+
focusSvgFill: _styles.COLORS.primary_700
|
|
29
|
+
};
|
|
30
|
+
|
|
21
31
|
switch (type) {
|
|
22
32
|
case 'warning':
|
|
23
|
-
|
|
33
|
+
style = {
|
|
34
|
+
svgFill: _styles.COLORS.warning_500,
|
|
35
|
+
hoverBgColor: _styles.COLORS.warning_200,
|
|
36
|
+
hoverSvgFill: _styles.COLORS.warning_700,
|
|
37
|
+
activeBgColor: _styles.COLORS.warning_300,
|
|
38
|
+
activeSvgFill: _styles.COLORS.warning_800,
|
|
39
|
+
focusBgColor: _styles.COLORS.warning_200,
|
|
40
|
+
focusSvgFill: _styles.COLORS.warning_700
|
|
41
|
+
};
|
|
42
|
+
break;
|
|
24
43
|
|
|
25
44
|
case 'critical':
|
|
26
|
-
|
|
45
|
+
style = {
|
|
46
|
+
svgFill: _styles.COLORS.critical_600,
|
|
47
|
+
hoverBgColor: _styles.COLORS.critical_200,
|
|
48
|
+
hoverSvgFill: _styles.COLORS.critical_700,
|
|
49
|
+
activeBgColor: _styles.COLORS.critical_300,
|
|
50
|
+
activeSvgFill: _styles.COLORS.critical_800,
|
|
51
|
+
focusBgColor: _styles.COLORS.critical_200,
|
|
52
|
+
focusSvgFill: _styles.COLORS.critical_700
|
|
53
|
+
};
|
|
54
|
+
break;
|
|
27
55
|
|
|
28
56
|
case 'positive':
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
57
|
+
style = {
|
|
58
|
+
svgFill: _styles.COLORS.correct_500,
|
|
59
|
+
hoverBgColor: _styles.COLORS.correct_200,
|
|
60
|
+
hoverSvgFill: _styles.COLORS.correct_700,
|
|
61
|
+
activeBgColor: _styles.COLORS.correct_300,
|
|
62
|
+
activeSvgFill: _styles.COLORS.correct_800,
|
|
63
|
+
focusBgColor: _styles.COLORS.correct_200,
|
|
64
|
+
focusSvgFill: _styles.COLORS.correct_700
|
|
65
|
+
};
|
|
66
|
+
break;
|
|
33
67
|
}
|
|
68
|
+
|
|
69
|
+
return (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", " {\n div {\n background-color: transparent;\n }\n div svg path,\n div svg {\n fill: ", ";\n }\n &:hover:not(:disabled) {\n div {\n background-color: ", ";\n }\n div svg path,\n div svg {\n fill: ", ";\n }\n }\n &:focus:not(:disabled) {\n div {\n background-color: ", ";\n }\n div svg path,\n div svg {\n fill: ", ";\n }\n }\n &:active:not(:disabled) {\n div {\n background: ", ";\n }\n div svg path,\n div svg {\n fill: ", ";\n }\n }\n }"])), _Iconbutton.StyledSecondaryIconButton, style.svgFill, style.hoverBgColor, style.hoverSvgFill, style.focusBgColor, style.focusSvgFill, style.activeBgColor, style.activeSvgFill);
|
|
34
70
|
};
|
|
35
71
|
|
|
36
72
|
exports.getButtonStyle = getButtonStyle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Banners/styles.tsx"],"names":["getButtonStyle","type","
|
|
1
|
+
{"version":3,"sources":["../../src/Banners/styles.tsx"],"names":["getButtonStyle","type","style","svgFill","COLORS","primary_500","hoverBgColor","primary_200","hoverSvgFill","primary_700","activeBgColor","primary_300","activeSvgFill","primary_800","focusBgColor","focusSvgFill","warning_500","warning_200","warning_700","warning_300","warning_800","critical_600","critical_200","critical_700","critical_300","critical_800","correct_500","correct_200","correct_700","correct_300","correct_800","css","StyledSecondaryIconButton"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;;;AAEO,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,CAACC,IAAD,EAAkB;AAC9C,MAAIC,KAAK,GAAG;AACVC,IAAAA,OAAO,EAAEC,eAAOC,WADN;AAEVC,IAAAA,YAAY,EAAEF,eAAOG,WAFX;AAGVC,IAAAA,YAAY,EAAEJ,eAAOK,WAHX;AAIVC,IAAAA,aAAa,EAAEN,eAAOO,WAJZ;AAKVC,IAAAA,aAAa,EAAER,eAAOS,WALZ;AAMVC,IAAAA,YAAY,EAAEV,eAAOG,WANX;AAOVQ,IAAAA,YAAY,EAAEX,eAAOK;AAPX,GAAZ;;AAUA,UAAOR,IAAP;AAEE,SAAK,SAAL;AACEC,MAAAA,KAAK,GAAG;AACNC,QAAAA,OAAO,EAAEC,eAAOY,WADV;AAENV,QAAAA,YAAY,EAAEF,eAAOa,WAFf;AAGNT,QAAAA,YAAY,EAAEJ,eAAOc,WAHf;AAINR,QAAAA,aAAa,EAAEN,eAAOe,WAJhB;AAKNP,QAAAA,aAAa,EAAER,eAAOgB,WALhB;AAMNN,QAAAA,YAAY,EAAEV,eAAOa,WANf;AAONF,QAAAA,YAAY,EAAEX,eAAOc;AAPf,OAAR;AASA;;AAEF,SAAK,UAAL;AACEhB,MAAAA,KAAK,GAAG;AACNC,QAAAA,OAAO,EAAEC,eAAOiB,YADV;AAENf,QAAAA,YAAY,EAAEF,eAAOkB,YAFf;AAGNd,QAAAA,YAAY,EAAEJ,eAAOmB,YAHf;AAINb,QAAAA,aAAa,EAAEN,eAAOoB,YAJhB;AAKNZ,QAAAA,aAAa,EAAER,eAAOqB,YALhB;AAMNX,QAAAA,YAAY,EAAEV,eAAOkB,YANf;AAONP,QAAAA,YAAY,EAAEX,eAAOmB;AAPf,OAAR;AASA;;AAEF,SAAK,UAAL;AACErB,MAAAA,KAAK,GAAG;AACNC,QAAAA,OAAO,EAAEC,eAAOsB,WADV;AAENpB,QAAAA,YAAY,EAAEF,eAAOuB,WAFf;AAGNnB,QAAAA,YAAY,EAAEJ,eAAOwB,WAHf;AAINlB,QAAAA,aAAa,EAAEN,eAAOyB,WAJhB;AAKNjB,QAAAA,aAAa,EAAER,eAAO0B,WALhB;AAMNhB,QAAAA,YAAY,EAAEV,eAAOuB,WANf;AAONZ,QAAAA,YAAY,EAAEX,eAAOwB;AAPf,OAAR;AASA;AApCJ;;AAuCA,aAAOG,qBAAP,qrBACIC,qCADJ,EAOY9B,KAAK,CAACC,OAPlB,EAW0BD,KAAK,CAACI,YAXhC,EAecJ,KAAK,CAACM,YAfpB,EAoB0BN,KAAK,CAACY,YApBhC,EAwBcZ,KAAK,CAACa,YAxBpB,EA6BoBb,KAAK,CAACQ,aA7B1B,EAiCcR,KAAK,CAACU,aAjCpB;AAqCD,CAvFM","sourcesContent":["import { css } from 'styled-components';\nimport { StyledSecondaryIconButton } from '../Button/Iconbutton';\nimport { COLORS } from '../styles';\n\nexport const getButtonStyle = (type: string) => {\n let style = {\n svgFill: COLORS.primary_500,\n hoverBgColor: COLORS.primary_200,\n hoverSvgFill: COLORS.primary_700,\n activeBgColor: COLORS.primary_300,\n activeSvgFill: COLORS.primary_800,\n focusBgColor: COLORS.primary_200,\n focusSvgFill: COLORS.primary_700\n };\n\n switch(type)\n {\n case 'warning':\n style = {\n svgFill: COLORS.warning_500,\n hoverBgColor: COLORS.warning_200,\n hoverSvgFill: COLORS.warning_700,\n activeBgColor: COLORS.warning_300,\n activeSvgFill: COLORS.warning_800,\n focusBgColor: COLORS.warning_200,\n focusSvgFill: COLORS.warning_700\n };\n break;\n \n case 'critical':\n style = {\n svgFill: COLORS.critical_600,\n hoverBgColor: COLORS.critical_200,\n hoverSvgFill: COLORS.critical_700,\n activeBgColor: COLORS.critical_300,\n activeSvgFill: COLORS.critical_800,\n focusBgColor: COLORS.critical_200,\n focusSvgFill: COLORS.critical_700\n };\n break;\n\n case 'positive':\n style = {\n svgFill: COLORS.correct_500,\n hoverBgColor: COLORS.correct_200,\n hoverSvgFill: COLORS.correct_700,\n activeBgColor: COLORS.correct_300,\n activeSvgFill: COLORS.correct_800,\n focusBgColor: COLORS.correct_200,\n focusSvgFill: COLORS.correct_700\n };\n break;\n }\n\n return css`\n ${StyledSecondaryIconButton} {\n div {\n background-color: transparent;\n }\n div svg path,\n div svg {\n fill: ${style.svgFill};\n }\n &:hover:not(:disabled) {\n div {\n background-color: ${style.hoverBgColor};\n }\n div svg path,\n div svg {\n fill: ${style.hoverSvgFill};\n }\n }\n &:focus:not(:disabled) {\n div {\n background-color: ${style.focusBgColor};\n }\n div svg path,\n div svg {\n fill: ${style.focusSvgFill};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${style.activeBgColor};\n }\n div svg path,\n div svg {\n fill: ${style.activeSvgFill};\n }\n }\n }`;\n};\n"],"file":"styles.cjs"}
|
package/dist/Banners/styles.js
CHANGED
|
@@ -1,23 +1,59 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject
|
|
3
|
+
var _templateObject;
|
|
4
4
|
|
|
5
5
|
import { css } from 'styled-components';
|
|
6
6
|
import { StyledSecondaryIconButton } from '../Button/Iconbutton';
|
|
7
7
|
import { COLORS } from '../styles';
|
|
8
8
|
export var getButtonStyle = function getButtonStyle(type) {
|
|
9
|
+
var style = {
|
|
10
|
+
svgFill: COLORS.primary_500,
|
|
11
|
+
hoverBgColor: COLORS.primary_200,
|
|
12
|
+
hoverSvgFill: COLORS.primary_700,
|
|
13
|
+
activeBgColor: COLORS.primary_300,
|
|
14
|
+
activeSvgFill: COLORS.primary_800,
|
|
15
|
+
focusBgColor: COLORS.primary_200,
|
|
16
|
+
focusSvgFill: COLORS.primary_700
|
|
17
|
+
};
|
|
18
|
+
|
|
9
19
|
switch (type) {
|
|
10
20
|
case 'warning':
|
|
11
|
-
|
|
21
|
+
style = {
|
|
22
|
+
svgFill: COLORS.warning_500,
|
|
23
|
+
hoverBgColor: COLORS.warning_200,
|
|
24
|
+
hoverSvgFill: COLORS.warning_700,
|
|
25
|
+
activeBgColor: COLORS.warning_300,
|
|
26
|
+
activeSvgFill: COLORS.warning_800,
|
|
27
|
+
focusBgColor: COLORS.warning_200,
|
|
28
|
+
focusSvgFill: COLORS.warning_700
|
|
29
|
+
};
|
|
30
|
+
break;
|
|
12
31
|
|
|
13
32
|
case 'critical':
|
|
14
|
-
|
|
33
|
+
style = {
|
|
34
|
+
svgFill: COLORS.critical_600,
|
|
35
|
+
hoverBgColor: COLORS.critical_200,
|
|
36
|
+
hoverSvgFill: COLORS.critical_700,
|
|
37
|
+
activeBgColor: COLORS.critical_300,
|
|
38
|
+
activeSvgFill: COLORS.critical_800,
|
|
39
|
+
focusBgColor: COLORS.critical_200,
|
|
40
|
+
focusSvgFill: COLORS.critical_700
|
|
41
|
+
};
|
|
42
|
+
break;
|
|
15
43
|
|
|
16
44
|
case 'positive':
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
45
|
+
style = {
|
|
46
|
+
svgFill: COLORS.correct_500,
|
|
47
|
+
hoverBgColor: COLORS.correct_200,
|
|
48
|
+
hoverSvgFill: COLORS.correct_700,
|
|
49
|
+
activeBgColor: COLORS.correct_300,
|
|
50
|
+
activeSvgFill: COLORS.correct_800,
|
|
51
|
+
focusBgColor: COLORS.correct_200,
|
|
52
|
+
focusSvgFill: COLORS.correct_700
|
|
53
|
+
};
|
|
54
|
+
break;
|
|
21
55
|
}
|
|
56
|
+
|
|
57
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", " {\n div {\n background-color: transparent;\n }\n div svg path,\n div svg {\n fill: ", ";\n }\n &:hover:not(:disabled) {\n div {\n background-color: ", ";\n }\n div svg path,\n div svg {\n fill: ", ";\n }\n }\n &:focus:not(:disabled) {\n div {\n background-color: ", ";\n }\n div svg path,\n div svg {\n fill: ", ";\n }\n }\n &:active:not(:disabled) {\n div {\n background: ", ";\n }\n div svg path,\n div svg {\n fill: ", ";\n }\n }\n }"])), StyledSecondaryIconButton, style.svgFill, style.hoverBgColor, style.hoverSvgFill, style.focusBgColor, style.focusSvgFill, style.activeBgColor, style.activeSvgFill);
|
|
22
58
|
};
|
|
23
59
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Banners/styles.tsx"],"names":["css","StyledSecondaryIconButton","COLORS","getButtonStyle","type","warning_500","warning_200","warning_700","warning_300","warning_800","critical_600","critical_200","critical_700","critical_300","critical_800","correct_500","correct_200","correct_700","correct_300","correct_800"
|
|
1
|
+
{"version":3,"sources":["../../src/Banners/styles.tsx"],"names":["css","StyledSecondaryIconButton","COLORS","getButtonStyle","type","style","svgFill","primary_500","hoverBgColor","primary_200","hoverSvgFill","primary_700","activeBgColor","primary_300","activeSvgFill","primary_800","focusBgColor","focusSvgFill","warning_500","warning_200","warning_700","warning_300","warning_800","critical_600","critical_200","critical_700","critical_300","critical_800","correct_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AAMNX,QAAAA,YAAY,EAAEd,MAAM,CAACsB,YANf;AAONP,QAAAA,YAAY,EAAEf,MAAM,CAACuB;AAPf,OAAR;AASA;;AAEF,SAAK,UAAL;AACEpB,MAAAA,KAAK,GAAG;AACNC,QAAAA,OAAO,EAAEJ,MAAM,CAAC0B,WADV;AAENpB,QAAAA,YAAY,EAAEN,MAAM,CAAC2B,WAFf;AAGNnB,QAAAA,YAAY,EAAER,MAAM,CAAC4B,WAHf;AAINlB,QAAAA,aAAa,EAAEV,MAAM,CAAC6B,WAJhB;AAKNjB,QAAAA,aAAa,EAAEZ,MAAM,CAAC8B,WALhB;AAMNhB,QAAAA,YAAY,EAAEd,MAAM,CAAC2B,WANf;AAONZ,QAAAA,YAAY,EAAEf,MAAM,CAAC4B;AAPf,OAAR;AASA;AApCJ;;AAuCA,SAAO9B,GAAP,sqBACIC,yBADJ,EAOYI,KAAK,CAACC,OAPlB,EAW0BD,KAAK,CAACG,YAXhC,EAecH,KAAK,CAACK,YAfpB,EAoB0BL,KAAK,CAACW,YApBhC,EAwBcX,KAAK,CAACY,YAxBpB,EA6BoBZ,KAAK,CAACO,aA7B1B,EAiCcP,KAAK,CAACS,aAjCpB;AAqCD,CAvFM","sourcesContent":["import { css } from 'styled-components';\nimport { StyledSecondaryIconButton } from '../Button/Iconbutton';\nimport { COLORS } from '../styles';\n\nexport const getButtonStyle = (type: string) => {\n let style = {\n svgFill: COLORS.primary_500,\n hoverBgColor: COLORS.primary_200,\n hoverSvgFill: COLORS.primary_700,\n activeBgColor: COLORS.primary_300,\n activeSvgFill: COLORS.primary_800,\n focusBgColor: COLORS.primary_200,\n focusSvgFill: COLORS.primary_700\n };\n\n switch(type)\n {\n case 'warning':\n style = {\n svgFill: COLORS.warning_500,\n hoverBgColor: COLORS.warning_200,\n hoverSvgFill: COLORS.warning_700,\n activeBgColor: COLORS.warning_300,\n activeSvgFill: COLORS.warning_800,\n focusBgColor: COLORS.warning_200,\n focusSvgFill: COLORS.warning_700\n };\n break;\n \n case 'critical':\n style = {\n svgFill: COLORS.critical_600,\n hoverBgColor: COLORS.critical_200,\n hoverSvgFill: COLORS.critical_700,\n activeBgColor: COLORS.critical_300,\n activeSvgFill: COLORS.critical_800,\n focusBgColor: COLORS.critical_200,\n focusSvgFill: COLORS.critical_700\n };\n break;\n\n case 'positive':\n style = {\n svgFill: COLORS.correct_500,\n hoverBgColor: COLORS.correct_200,\n hoverSvgFill: COLORS.correct_700,\n activeBgColor: COLORS.correct_300,\n activeSvgFill: COLORS.correct_800,\n focusBgColor: COLORS.correct_200,\n focusSvgFill: COLORS.correct_700\n };\n break;\n }\n\n return css`\n ${StyledSecondaryIconButton} {\n div {\n background-color: transparent;\n }\n div svg path,\n div svg {\n fill: ${style.svgFill};\n }\n &:hover:not(:disabled) {\n div {\n background-color: ${style.hoverBgColor};\n }\n div svg path,\n div svg {\n fill: ${style.hoverSvgFill};\n }\n }\n &:focus:not(:disabled) {\n div {\n background-color: ${style.focusBgColor};\n }\n div svg path,\n div svg {\n fill: ${style.focusSvgFill};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${style.activeBgColor};\n }\n div svg path,\n div svg {\n fill: ${style.activeSvgFill};\n }\n }\n }`;\n};\n"],"file":"styles.js"}
|