@laerdal/life-react-components 1.6.1-dev.1 → 1.7.0-dev.2.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 +21 -5
- package/dist/Banners/Banner.cjs.map +1 -1
- package/dist/Banners/Banner.js +20 -5
- package/dist/Banners/Banner.js.map +1 -1
- package/dist/Button/Iconbutton.cjs +4 -1
- package/dist/Button/Iconbutton.cjs.map +1 -1
- package/dist/Button/Iconbutton.d.ts +2 -0
- package/dist/Button/Iconbutton.js +4 -1
- package/dist/Button/Iconbutton.js.map +1 -1
- package/dist/Card/CardTopSection.cjs +2 -2
- package/dist/Card/CardTopSection.cjs.map +1 -1
- package/dist/Card/CardTopSection.js +2 -2
- package/dist/Card/CardTopSection.js.map +1 -1
- package/dist/Chips/ActionChip.cjs +21 -28
- package/dist/Chips/ActionChip.cjs.map +1 -1
- package/dist/Chips/ActionChip.js +23 -30
- package/dist/Chips/ActionChip.js.map +1 -1
- package/dist/Chips/ChipInput.cjs.map +1 -1
- package/dist/Chips/ChipInput.js.map +1 -1
- package/dist/Chips/ChipStyles.cjs +13 -15
- package/dist/Chips/ChipStyles.cjs.map +1 -1
- package/dist/Chips/ChipStyles.d.ts +2 -6
- package/dist/Chips/ChipStyles.js +6 -12
- package/dist/Chips/ChipStyles.js.map +1 -1
- package/dist/Chips/ChipTypes.d.ts +7 -9
- package/dist/Chips/ChoiceChips.cjs +13 -7
- package/dist/Chips/ChoiceChips.cjs.map +1 -1
- package/dist/Chips/ChoiceChips.js +13 -8
- package/dist/Chips/ChoiceChips.js.map +1 -1
- package/dist/Chips/FilterChip.cjs +21 -28
- package/dist/Chips/FilterChip.cjs.map +1 -1
- package/dist/Chips/FilterChip.js +24 -31
- package/dist/Chips/FilterChip.js.map +1 -1
- package/dist/Chips/InputChip.cjs +44 -44
- package/dist/Chips/InputChip.cjs.map +1 -1
- package/dist/Chips/InputChip.js +46 -45
- package/dist/Chips/InputChip.js.map +1 -1
- package/dist/Dropdown/ChipDropdownInput.cjs +1 -1
- package/dist/Dropdown/ChipDropdownInput.cjs.map +1 -1
- package/dist/Dropdown/ChipDropdownInput.js +1 -1
- package/dist/Dropdown/ChipDropdownInput.js.map +1 -1
- package/dist/Dropdown/DropdownContent.cjs +2 -2
- package/dist/Dropdown/DropdownContent.cjs.map +1 -1
- package/dist/Dropdown/DropdownContent.js +3 -3
- package/dist/Dropdown/DropdownContent.js.map +1 -1
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.cjs +3 -1
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.js +2 -1
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.js.map +1 -1
- package/dist/HyperLink/HyperLink.cjs +3 -1
- package/dist/HyperLink/HyperLink.cjs.map +1 -1
- package/dist/HyperLink/HyperLink.d.ts +4 -0
- package/dist/HyperLink/HyperLink.js +1 -1
- package/dist/HyperLink/HyperLink.js.map +1 -1
- package/dist/HyperLink/styling.cjs +1 -1
- package/dist/HyperLink/styling.cjs.map +1 -1
- package/dist/HyperLink/styling.js +1 -1
- package/dist/HyperLink/styling.js.map +1 -1
- package/dist/Image/ImageWithFallbacks.cjs +122 -0
- package/dist/Image/ImageWithFallbacks.cjs.map +1 -0
- package/dist/Image/ImageWithFallbacks.d.ts +21 -0
- package/dist/Image/ImageWithFallbacks.js +109 -0
- package/dist/Image/ImageWithFallbacks.js.map +1 -0
- package/dist/Image/index.cjs +16 -0
- package/dist/Image/index.cjs.map +1 -0
- package/dist/Image/index.d.ts +2 -0
- package/dist/Image/index.js +3 -0
- package/dist/Image/index.js.map +1 -0
- package/dist/InputFields/DatepickerField.cjs +56 -18
- package/dist/InputFields/DatepickerField.cjs.map +1 -1
- package/dist/InputFields/DatepickerField.js +54 -17
- package/dist/InputFields/DatepickerField.js.map +1 -1
- package/dist/InputFields/styling.cjs +2 -2
- package/dist/InputFields/styling.cjs.map +1 -1
- package/dist/InputFields/styling.js +2 -2
- package/dist/InputFields/styling.js.map +1 -1
- package/dist/Modals/ModalContainer.cjs +3 -2
- package/dist/Modals/ModalContainer.cjs.map +1 -1
- package/dist/Modals/ModalContainer.js +3 -2
- package/dist/Modals/ModalContainer.js.map +1 -1
- package/dist/Modals/ModalContent.cjs +235 -0
- package/dist/Modals/ModalContent.cjs.map +1 -0
- package/dist/Modals/ModalContent.d.ts +18 -0
- package/dist/Modals/ModalContent.js +204 -0
- package/dist/Modals/ModalContent.js.map +1 -0
- package/dist/Modals/ModalDialog.cjs +68 -26
- package/dist/Modals/ModalDialog.cjs.map +1 -1
- package/dist/Modals/ModalDialog.d.ts +6 -1
- package/dist/Modals/ModalDialog.js +70 -27
- package/dist/Modals/ModalDialog.js.map +1 -1
- package/dist/Modals/ModalStyles.cjs +14 -8
- package/dist/Modals/ModalStyles.cjs.map +1 -1
- package/dist/Modals/ModalStyles.d.ts +2 -0
- package/dist/Modals/ModalStyles.js +12 -7
- package/dist/Modals/ModalStyles.js.map +1 -1
- package/dist/Modals/ModalTypes.d.ts +5 -0
- package/dist/Modals/index.cjs +8 -0
- package/dist/Modals/index.cjs.map +1 -1
- package/dist/Modals/index.d.ts +3 -2
- package/dist/Modals/index.js +2 -1
- package/dist/Modals/index.js.map +1 -1
- package/dist/SkipToContent/SkipToContent.cjs +2 -2
- package/dist/SkipToContent/SkipToContent.cjs.map +1 -1
- package/dist/SkipToContent/SkipToContent.js +2 -2
- package/dist/SkipToContent/SkipToContent.js.map +1 -1
- package/dist/Switcher/MobileSwitcherMenu.cjs +3 -1
- package/dist/Switcher/MobileSwitcherMenu.cjs.map +1 -1
- package/dist/Switcher/MobileSwitcherMenu.js +2 -1
- package/dist/Switcher/MobileSwitcherMenu.js.map +1 -1
- package/dist/common/HoverWithin.cjs +63 -0
- package/dist/common/HoverWithin.cjs.map +1 -0
- package/dist/common/HoverWithin.d.ts +2 -0
- package/dist/common/HoverWithin.js +51 -0
- package/dist/common/HoverWithin.js.map +1 -0
- package/dist/common/index.cjs +8 -0
- package/dist/common/index.cjs.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +1 -0
- package/dist/common/index.js.map +1 -1
- package/dist/index.cjs +14 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/index.cjs +7 -1
- package/dist/styles/index.cjs.map +1 -1
- package/dist/styles/index.d.ts +2 -1
- package/dist/styles/index.js +5 -1
- package/dist/styles/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/Banners/Banner.cjs
CHANGED
|
@@ -31,6 +31,8 @@ var _typography = require("../styles/typography");
|
|
|
31
31
|
|
|
32
32
|
var _HyperLink = require("../HyperLink");
|
|
33
33
|
|
|
34
|
+
var _HyperLink2 = require("../HyperLink/HyperLink");
|
|
35
|
+
|
|
34
36
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
37
|
|
|
36
38
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
@@ -39,13 +41,17 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
39
41
|
|
|
40
42
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
43
|
|
|
42
|
-
var BannerContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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
|
|
44
|
+
var BannerContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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 ", " {\n &:link{\n color: ", ";\n }\n &:visited{\n color: ", ";\n }\n &:focus,\n &:active{\n background-color: ", ";\n color: ", ";\n }\n }\n"])), function (props) {
|
|
43
45
|
return props.$type ? props.$type : _styles.COLORS.correct_100;
|
|
44
46
|
}, _styles.COLORS.black, function (props) {
|
|
45
47
|
return props.bottom ? 'auto' : '0';
|
|
46
|
-
}, _styles.BREAKPOINTS.MEDIUM, _styles.BREAKPOINTS.LARGE, function (props) {
|
|
48
|
+
}, _styles.BREAKPOINTS.MEDIUM, _styles.BREAKPOINTS.LARGE, _HyperLink2.StyledLink, function (props) {
|
|
47
49
|
return props.link;
|
|
48
|
-
})
|
|
50
|
+
}, function (props) {
|
|
51
|
+
return props.linkVisited;
|
|
52
|
+
}, function (props) {
|
|
53
|
+
return props.linkFocused;
|
|
54
|
+
}, _styles.COLORS.white);
|
|
49
55
|
|
|
50
56
|
var BannerCenter = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n\n display: flex;\n width: 100%;\n margin: 0 16px;\n ", " {\n margin: 0 32px;\n }\n ", " {\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"])), function (props) {
|
|
51
57
|
return (0, _typography.ComponentMStyling)(_styles.ComponentTextStyle.Regular, props.$color);
|
|
@@ -91,7 +97,9 @@ var Banner = function Banner(_ref) {
|
|
|
91
97
|
closeIconColor: _styles.COLORS.primary_500,
|
|
92
98
|
icon: _SystemIcons.Tip,
|
|
93
99
|
containerType: 'neutral',
|
|
94
|
-
focusBgColor: _styles.COLORS.primary_200
|
|
100
|
+
focusBgColor: _styles.COLORS.primary_200,
|
|
101
|
+
linkVisited: _styles.COLORS.primary_600,
|
|
102
|
+
linkFocused: _styles.COLORS.primary_800
|
|
95
103
|
};
|
|
96
104
|
var formatTypeToLowerCase = type === null || type === void 0 ? void 0 : type.toLowerCase();
|
|
97
105
|
|
|
@@ -103,6 +111,8 @@ var Banner = function Banner(_ref) {
|
|
|
103
111
|
bannerParams.icon = _SystemIcons.Help;
|
|
104
112
|
bannerParams.closeIconColor = _styles.COLORS.warning_500;
|
|
105
113
|
bannerParams.containerType = formatTypeToLowerCase;
|
|
114
|
+
bannerParams.linkVisited = _styles.COLORS.warning_600;
|
|
115
|
+
bannerParams.linkFocused = _styles.COLORS.warning_800;
|
|
106
116
|
} else if (formatTypeToLowerCase == 'critical') {
|
|
107
117
|
bannerParams.typeColor = _styles.COLORS.critical_100;
|
|
108
118
|
bannerParams.accentColor = _styles.COLORS.critical_700;
|
|
@@ -111,6 +121,8 @@ var Banner = function Banner(_ref) {
|
|
|
111
121
|
bannerParams.icon = _SystemIcons.TechnicalWarning;
|
|
112
122
|
bannerParams.closeIconColor = _styles.COLORS.critical_500;
|
|
113
123
|
bannerParams.containerType = formatTypeToLowerCase;
|
|
124
|
+
bannerParams.linkVisited = _styles.COLORS.critical_600;
|
|
125
|
+
bannerParams.linkFocused = _styles.COLORS.critical_800;
|
|
114
126
|
} else if (formatTypeToLowerCase == 'positive') {
|
|
115
127
|
bannerParams.typeColor = _styles.COLORS.correct_100;
|
|
116
128
|
bannerParams.accentColor = _styles.COLORS.correct_700;
|
|
@@ -119,11 +131,15 @@ var Banner = function Banner(_ref) {
|
|
|
119
131
|
bannerParams.icon = _SystemIcons.ThumbsUp;
|
|
120
132
|
bannerParams.closeIconColor = _styles.COLORS.correct_500;
|
|
121
133
|
bannerParams.containerType = formatTypeToLowerCase;
|
|
134
|
+
bannerParams.linkVisited = _styles.COLORS.correct_600;
|
|
135
|
+
bannerParams.linkFocused = _styles.COLORS.correct_800;
|
|
122
136
|
}
|
|
123
137
|
|
|
124
138
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BannerContainer, {
|
|
125
139
|
"data-testid": testId,
|
|
126
140
|
$type: bannerParams.typeColor,
|
|
141
|
+
linkFocused: bannerParams.linkFocused,
|
|
142
|
+
linkVisited: bannerParams.linkVisited,
|
|
127
143
|
link: bannerParams.accentColor,
|
|
128
144
|
hover: bannerParams.hoverColor,
|
|
129
145
|
bottom: bottom,
|
|
@@ -138,7 +154,7 @@ var Banner = function Banner(_ref) {
|
|
|
138
154
|
size: size,
|
|
139
155
|
width: width,
|
|
140
156
|
color: bannerParams.accentColor,
|
|
141
|
-
children: [children, "\xA0
|
|
157
|
+
children: [children, "\xA0", link && linkText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_HyperLink.HyperLink, {
|
|
142
158
|
id: "".concat(Math.floor(Math.random() * 999999999999), "_BannerLink"),
|
|
143
159
|
onClick: function onClick(e) {
|
|
144
160
|
if (linkAction) {
|
|
@@ -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","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,oBAAYE,KATE,CAAlB;;AA4BA,IAAMM,aAAa,GAAGhB,0BAAOC,GAAV,8GAAnB;;AAIA,IAAMgB,eAAe,GAAGjB,0BAAOC,GAAV,uHAEjB,UAACC,KAAD;AAAA,SAAYA,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BAUGa;AAVH,YAHJ;AAAA;AADF,QAFF,EAqBGC,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,QAtBJ;AAAA;AADF,IADF;AAmCD,CAhFD;;;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;;eAqFaR,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 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.cjs"}
|
|
1
|
+
{"version":3,"sources":["../../src/Banners/Banner.tsx"],"names":["BannerContainer","styled","div","props","$type","COLORS","correct_100","black","bottom","BREAKPOINTS","MEDIUM","LARGE","StyledLink","link","linkVisited","linkFocused","white","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","primary_600","primary_800","formatTypeToLowerCase","toLowerCase","warning_100","warning_700","warning_200","warning_20","Help","warning_500","warning_600","warning_800","critical_100","critical_700","critical_200","critical_20","TechnicalWarning","critical_500","critical_600","critical_800","correct_700","correct_200","correct_20","ThumbsUp","correct_500","correct_600","correct_800","Math","floor","random","e","preventDefault","hover"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AASA,IAAMA,eAAe,GAAGC,0BAAOC,GAAV,4qBACL,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,E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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,QAtBJ;AAAA;AADF,IADF;AAmCD,CAxFD;;;AAZExB,EAAAA,I;AACAb,EAAAA,I;AACAgB,EAAAA,Q;AACAI,EAAAA,U;AACAuD,EAAAA,K;AACAhF,EAAAA,M;AACAoB,EAAAA,M;AACAG,EAAAA,I;AACAD,EAAAA,O;AACAE,EAAAA,M;;eA6FaR,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 {StyledLink} from '../HyperLink/HyperLink';\nimport {defaultOnMouseDownHandler} from '../common';\nimport {defaultStyle} from '../HyperLink/styling';\n\n/**\n * Styles for <Banner />\n */\ntype StyleBannerProps = BannerProps & { $type: string, linkVisited: string, linkFocused: 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 ${StyledLink} {\n &:link{\n color: ${(props) => props.link};\n }\n &:visited{\n color: ${(props) => props.linkVisited};\n }\n &:focus,\n &:active{\n background-color: ${(props) => props.linkFocused};\n color: ${COLORS.white};\n }\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 linkVisited: COLORS.primary_600,\n linkFocused: COLORS.primary_800\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 bannerParams.linkVisited = COLORS.warning_600;\n bannerParams.linkFocused = COLORS.warning_800;\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 bannerParams.linkVisited = COLORS.critical_600;\n bannerParams.linkFocused = COLORS.critical_800;\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 bannerParams.linkVisited = COLORS.correct_600;\n bannerParams.linkFocused = COLORS.correct_800;\n }\n\n return (\n <BannerContainer data-testid={testId} $type={bannerParams.typeColor} linkFocused={bannerParams.linkFocused} linkVisited={bannerParams.linkVisited} 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.cjs"}
|
package/dist/Banners/Banner.js
CHANGED
|
@@ -12,15 +12,20 @@ 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
|
+
import { StyledLink } from '../HyperLink/HyperLink';
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
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
|
|
18
|
+
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 ", " {\n &:link{\n color: ", ";\n }\n &:visited{\n color: ", ";\n }\n &:focus,\n &:active{\n background-color: ", ";\n color: ", ";\n }\n }\n"])), function (props) {
|
|
18
19
|
return props.$type ? props.$type : COLORS.correct_100;
|
|
19
20
|
}, COLORS.black, function (props) {
|
|
20
21
|
return props.bottom ? 'auto' : '0';
|
|
21
|
-
}, BREAKPOINTS.MEDIUM, BREAKPOINTS.LARGE, function (props) {
|
|
22
|
+
}, BREAKPOINTS.MEDIUM, BREAKPOINTS.LARGE, StyledLink, function (props) {
|
|
22
23
|
return props.link;
|
|
23
|
-
})
|
|
24
|
+
}, function (props) {
|
|
25
|
+
return props.linkVisited;
|
|
26
|
+
}, function (props) {
|
|
27
|
+
return props.linkFocused;
|
|
28
|
+
}, COLORS.white);
|
|
24
29
|
var BannerCenter = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n\n display: flex;\n width: 100%;\n margin: 0 16px;\n ", " {\n margin: 0 32px;\n }\n ", " {\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"])), function (props) {
|
|
25
30
|
return ComponentMStyling(ComponentTextStyle.Regular, props.$color);
|
|
26
31
|
}, BREAKPOINTS.MEDIUM, BREAKPOINTS.LARGE);
|
|
@@ -62,7 +67,9 @@ var Banner = function Banner(_ref) {
|
|
|
62
67
|
closeIconColor: COLORS.primary_500,
|
|
63
68
|
icon: Tip,
|
|
64
69
|
containerType: 'neutral',
|
|
65
|
-
focusBgColor: COLORS.primary_200
|
|
70
|
+
focusBgColor: COLORS.primary_200,
|
|
71
|
+
linkVisited: COLORS.primary_600,
|
|
72
|
+
linkFocused: COLORS.primary_800
|
|
66
73
|
};
|
|
67
74
|
var formatTypeToLowerCase = type === null || type === void 0 ? void 0 : type.toLowerCase();
|
|
68
75
|
|
|
@@ -74,6 +81,8 @@ var Banner = function Banner(_ref) {
|
|
|
74
81
|
bannerParams.icon = Help;
|
|
75
82
|
bannerParams.closeIconColor = COLORS.warning_500;
|
|
76
83
|
bannerParams.containerType = formatTypeToLowerCase;
|
|
84
|
+
bannerParams.linkVisited = COLORS.warning_600;
|
|
85
|
+
bannerParams.linkFocused = COLORS.warning_800;
|
|
77
86
|
} else if (formatTypeToLowerCase == 'critical') {
|
|
78
87
|
bannerParams.typeColor = COLORS.critical_100;
|
|
79
88
|
bannerParams.accentColor = COLORS.critical_700;
|
|
@@ -82,6 +91,8 @@ var Banner = function Banner(_ref) {
|
|
|
82
91
|
bannerParams.icon = TechnicalWarning;
|
|
83
92
|
bannerParams.closeIconColor = COLORS.critical_500;
|
|
84
93
|
bannerParams.containerType = formatTypeToLowerCase;
|
|
94
|
+
bannerParams.linkVisited = COLORS.critical_600;
|
|
95
|
+
bannerParams.linkFocused = COLORS.critical_800;
|
|
85
96
|
} else if (formatTypeToLowerCase == 'positive') {
|
|
86
97
|
bannerParams.typeColor = COLORS.correct_100;
|
|
87
98
|
bannerParams.accentColor = COLORS.correct_700;
|
|
@@ -90,11 +101,15 @@ var Banner = function Banner(_ref) {
|
|
|
90
101
|
bannerParams.icon = ThumbsUp;
|
|
91
102
|
bannerParams.closeIconColor = COLORS.correct_500;
|
|
92
103
|
bannerParams.containerType = formatTypeToLowerCase;
|
|
104
|
+
bannerParams.linkVisited = COLORS.correct_600;
|
|
105
|
+
bannerParams.linkFocused = COLORS.correct_800;
|
|
93
106
|
}
|
|
94
107
|
|
|
95
108
|
return /*#__PURE__*/_jsx(BannerContainer, {
|
|
96
109
|
"data-testid": testId,
|
|
97
110
|
$type: bannerParams.typeColor,
|
|
111
|
+
linkFocused: bannerParams.linkFocused,
|
|
112
|
+
linkVisited: bannerParams.linkVisited,
|
|
98
113
|
link: bannerParams.accentColor,
|
|
99
114
|
hover: bannerParams.hoverColor,
|
|
100
115
|
bottom: bottom,
|
|
@@ -109,7 +124,7 @@ var Banner = function Banner(_ref) {
|
|
|
109
124
|
size: size,
|
|
110
125
|
width: width,
|
|
111
126
|
color: bannerParams.accentColor,
|
|
112
|
-
children: [children, "\xA0
|
|
127
|
+
children: [children, "\xA0", link && linkText && /*#__PURE__*/_jsx(HyperLink, {
|
|
113
128
|
id: "".concat(Math.floor(Math.random() * 999999999999), "_BannerLink"),
|
|
114
129
|
onClick: function onClick(e) {
|
|
115
130
|
if (linkAction) {
|
|
@@ -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","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,M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;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"}
|
|
1
|
+
{"version":3,"sources":["../../src/Banners/Banner.tsx"],"names":["React","styled","BREAKPOINTS","COLORS","ComponentTextStyle","Close","Help","TechnicalWarning","ThumbsUp","Tip","IconButton","getButtonStyle","ComponentMStyling","ComponentResponsive","HyperLink","StyledLink","BannerContainer","div","props","$type","correct_100","black","bottom","MEDIUM","LARGE","link","linkVisited","linkFocused","white","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","primary_600","primary_800","formatTypeToLowerCase","toLowerCase","warning_100","warning_700","warning_200","warning_20","warning_500","warning_600","warning_800","critical_100","critical_700","critical_200","critical_20","critical_500","critical_600","critical_800","correct_700","correct_200","correct_20","correct_500","correct_600","correct_800","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;AACA,SAAQC,UAAR,QAAyB,wBAAzB;;;AASA,IAAMC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ACG,WAAnE;AAAA,qBACGlB,QADH,UAEGb,IAAI,IAAIe,QAAR,iBACC,KAAC,SAAD;AACE,YAAA,EAAE,YAAKiD,IAAI,CAACC,KAAL,CAAWD,IAAI,CAACE,MAAL,KAAgB,YAA3B,CAAL,gBADJ;AAEE,YAAA,OAAO,EAAE,iBAACC,CAAD,EAAO;AACd,kBAAIhD,UAAJ,EAAgB;AACdgD,gBAAAA,CAAC,CAACC,cAAF;AACAjD,gBAAAA,UAAU,CAACgD,CAAD,CAAV;AACD;AACF,aAPH;AAQE,YAAA,IAAI,EAAEnE,IARR;AASE,YAAA,OAAO,EAAC,SATV;AAAA,sBAUGe;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,CAxFD;;;AAZEvB,EAAAA,I;AACAZ,EAAAA,I;AACAe,EAAAA,Q;AACAI,EAAAA,U;AACAkD,EAAAA,K;AACAxE,EAAAA,M;AACAiB,EAAAA,M;AACAG,EAAAA,I;AACAD,EAAAA,O;AACAE,EAAAA,M;;AA6FF,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 {StyledLink} from '../HyperLink/HyperLink';\nimport {defaultOnMouseDownHandler} from '../common';\nimport {defaultStyle} from '../HyperLink/styling';\n\n/**\n * Styles for <Banner />\n */\ntype StyleBannerProps = BannerProps & { $type: string, linkVisited: string, linkFocused: 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 ${StyledLink} {\n &:link{\n color: ${(props) => props.link};\n }\n &:visited{\n color: ${(props) => props.linkVisited};\n }\n &:focus,\n &:active{\n background-color: ${(props) => props.linkFocused};\n color: ${COLORS.white};\n }\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 linkVisited: COLORS.primary_600,\n linkFocused: COLORS.primary_800\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 bannerParams.linkVisited = COLORS.warning_600;\n bannerParams.linkFocused = COLORS.warning_800;\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 bannerParams.linkVisited = COLORS.critical_600;\n bannerParams.linkFocused = COLORS.critical_800;\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 bannerParams.linkVisited = COLORS.correct_600;\n bannerParams.linkFocused = COLORS.correct_800;\n }\n\n return (\n <BannerContainer data-testid={testId} $type={bannerParams.typeColor} linkFocused={bannerParams.linkFocused} linkVisited={bannerParams.linkVisited} 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"}
|
|
@@ -94,7 +94,8 @@ var IconButton = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
94
94
|
onKeyPress = _ref.onKeyPress,
|
|
95
95
|
focusBackgroundColor = _ref.focusBackgroundColor,
|
|
96
96
|
type = _ref.type,
|
|
97
|
-
hidden = _ref.hidden
|
|
97
|
+
hidden = _ref.hidden,
|
|
98
|
+
style = _ref.style;
|
|
98
99
|
|
|
99
100
|
var isPressingEnterOrSpace = function isPressingEnterOrSpace(e) {
|
|
100
101
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
@@ -131,6 +132,7 @@ var IconButton = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
131
132
|
onMouseDown: _common.defaultOnMouseDownHandler,
|
|
132
133
|
onKeyPress: onKeyPress,
|
|
133
134
|
hidden: hidden,
|
|
135
|
+
style: style,
|
|
134
136
|
focusBackgroundColor: focusBackgroundColor,
|
|
135
137
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
136
138
|
children: children
|
|
@@ -163,6 +165,7 @@ var IconButton = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
163
165
|
onMouseDown: _common.defaultOnMouseDownHandler,
|
|
164
166
|
onKeyPress: onKeyPress,
|
|
165
167
|
hidden: hidden,
|
|
168
|
+
style: style,
|
|
166
169
|
focusBackgroundColor: focusBackgroundColor,
|
|
167
170
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
168
171
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Button/Iconbutton.tsx"],"names":["getBorderRadius","props","borderRadius","getBorderRadiusStyle","radius","flatEdge","StyledIconButton","styled","button","hideOnLowWidth","BREAKPOINTS","MEDIUM","unsetIconSize","StyledPrimaryIconButton","useTransparentBackground","COLORS","primary_500","iconColor","white","focusBackgroundColor","primary_700","primary_800","neutral_200","StyledSecondaryIconButton","neutral_600","primary_20","primary_100","neutral_300","IconButton","React","forwardRef","ref","id","variant","shape","action","isInMobileMenu","children","disabled","tabIndex","onKeyPress","type","hidden","isPressingEnterOrSpace","e","key","stopPropagation","event","defaultOnMouseDownHandler"],"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YAAY,EAAE2B,cAVhB;AAWE,QAAA,wBAAwB,EAAEtB,wBAX5B;AAYE,QAAA,SAAS,EAAEG,SAZb;AAaE,QAAA,aAAa,EAAEL,aAbjB;AAcE,QAAA,QAAQ,EAAE2B,QAAQ,IAAI,CAdxB;AAeE,QAAA,YAAY,EAAErC,YAAY,IAAIgC,KAAK,KAAK,UAA1B,GAAuC,EAAvC,GAA4C,CAf5D;AAgBE,QAAA,WAAW,EAAEc,iCAhBf;AAiBE,QAAA,UAAU,EAAER,UAjBd;AAkBE,QAAA,MAAM,EAAEE,MAlBV;AAmBE,QAAA,oBAAoB,EAAEvB,oBAnBxB;AAAA,+BAoBE;AAAA,oBAAMkB;AAAN;AApBF,QADF;AA3BJ;AAoDD,CAlFkB,CAAnB;;;AApBEL,EAAAA,E;AACAC,EAAAA,O,4BAAU,S,EAAY,W;AACtBC,EAAAA,K,4BAAQ,Q,EAAW,U;AACnBC,EAAAA,M;AACA1B,EAAAA,c;AAEA2B,EAAAA,c;AACAE,EAAAA,Q;AACAxB,EAAAA,wB;AACAG,EAAAA,S;AACAL,EAAAA,a;AACA2B,EAAAA,Q;AACArC,EAAAA,Y;AACAsC,EAAAA,U;AACArB,EAAAA,oB;AAEAkB,EAAAA,Q;AACAK,EAAAA,M;;eAuFad,U","sourcesContent":["import React from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BREAKPOINTS, COLORS } from '../styles';\nimport {defaultOnMouseDownHandler} from '../common';\n\ninterface HeaderItemProps {\n hideOnLowWidth: boolean;\n inMobileMenu?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n borderRadius?: number;\n shape?: string;\n flatEdge?: string;\n focusBackgroundColor?: string;\n}\n\nconst getBorderRadius = (props:HeaderItemProps) => (props.borderRadius ? `${props.borderRadius}px` : '4px');\n\nconst getBorderRadiusStyle = (props:HeaderItemProps) => {\n const radius = getBorderRadius(props);\n switch(props.flatEdge)\n {\n case 'left':\n return `0px ${radius} ${radius} 0px`;\n\n case 'right':\n return `${radius} 0px 0px ${radius}`;\n\n case 'none':\n default:\n return `${radius}`;\n }\n};\n\nconst StyledIconButton = styled.button<HeaderItemProps>`\n border-width: 0;\n cursor: pointer;\n height: 48px;\n width: 48px;\n background: transparent;\n\n display: ${(props) => (props.hideOnLowWidth ? 'none' : 'block')};\n ${BREAKPOINTS.MEDIUM} {\n display: block;\n }\n\n border-radius: ${(props) => (props.borderRadius ? `${props.borderRadius}px` : '4px')};\n div {\n height: 36px;\n width: 36px;\n border-radius: ${getBorderRadiusStyle};\n display: flex;\n justify-content: center;\n align-items: center;\n svg {\n height: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n width: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n padding: 0;\n }\n }\n &:only-child {\n margin: 0;\n }\n &:disabled {\n cursor: not-allowed;\n }\n &:focus:not(:disabled) {\n outline: none;\n div {\n outline: none;\n }\n }\n &:active:not(:disabled) {\n div {\n box-shadow: none !important;\n }\n }\n`;\n\nexport const StyledPrimaryIconButton = styled(StyledIconButton)`\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.primary_500)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.white};\n path {\n fill: ${(props) => props.iconColor || COLORS.white};\n }\n }\n }\n &:focus:not(:disabled) {\n div {\n background-color: ${(props) => props.focusBackgroundColor || COLORS.primary_700} !important;\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2e7fa1;\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:hover:not(:disabled) {\n div {\n background-color: ${COLORS.primary_700};\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${COLORS.primary_800};\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:disabled {\n div {\n background-color: ${COLORS.neutral_200};\n }\n svg {\n path {\n fill: ${COLORS.white};\n }\n fill: ${COLORS.white};\n }\n }\n\n`;\n\nexport const StyledSecondaryIconButton = styled(StyledIconButton)`\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n path {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n }\n }\n }\n\n &:focus:not(:disabled) {\n div {\n background-color: ${(props) => props.focusBackgroundColor || 'transparent'};\n box-shadow: 0px 0px 8px ${COLORS.primary_500}, 0px 4px 12px rgba(46, 127, 161, 0.25);\n }\n div svg path,\n div svg {\n fill: ${COLORS.neutral_600};\n }\n }\n \n &:hover:not(:disabled) {\n div {\n background-color: ${COLORS.primary_20};\n }\n div svg path,\n div svg {\n fill: ${COLORS.primary_700};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${COLORS.primary_100};\n }\n div svg path,\n div svg {\n fill: ${COLORS.primary_800};\n }\n }\n\n &:disabled {\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n }\n svg {\n path {\n fill: ${COLORS.neutral_300};\n }\n fill: ${COLORS.neutral_300};\n }\n }\n\n`;\n\nexport interface IconButtonProps {\n id?: string;\n variant?: 'primary' | 'secondary';\n shape?: 'square' | 'circular';\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n hideOnLowWidth?: boolean;\n flatEdge?: 'right' | 'left' | 'none' | undefined;\n isInMobileMenu?: boolean;\n disabled?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n tabIndex?: number;\n borderRadius?: number;\n onKeyPress?: React.KeyboardEventHandler<HTMLButtonElement>;\n focusBackgroundColor?: string;\n type?: 'submit' | 'reset' | 'button' | undefined;\n children?: React.ReactNode;\n hidden?: boolean;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(({\n id,\n variant,\n shape,\n action,\n hideOnLowWidth,\n isInMobileMenu,\n children,\n useTransparentBackground,\n disabled,\n iconColor,\n unsetIconSize,\n tabIndex,\n flatEdge,\n borderRadius,\n onKeyPress,\n focusBackgroundColor,\n type,\n hidden\n}: IconButtonProps, ref) => {\n\n const isPressingEnterOrSpace = (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.stopPropagation();\n return true;\n }\n return false;\n };\n\n // Let's render button\n switch (variant) {\n case 'secondary':\n return (\n <StyledSecondaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {event.stopPropagation(); action(event);}}\n onKeyDown={(e: any) => isPressingEnterOrSpace(e) ? action() : null}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyPress={onKeyPress}\n hidden={hidden}\n focusBackgroundColor={focusBackgroundColor}>\n <div>{children}</div>\n </StyledSecondaryIconButton>\n );\n case 'primary':\n default:\n return (\n <StyledPrimaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n flatEdge={flatEdge}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {event.stopPropagation(); action(event);}}\n onKeyDown={(e: any) => isPressingEnterOrSpace(e) ? action() : null}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyPress={onKeyPress}\n hidden={hidden}\n focusBackgroundColor={focusBackgroundColor}>\n <div>{children}</div>\n </StyledPrimaryIconButton>\n );\n }\n});\n\nexport default IconButton;\n"],"file":"Iconbutton.cjs"}
|
|
1
|
+
{"version":3,"sources":["../../src/Button/Iconbutton.tsx"],"names":["getBorderRadius","props","borderRadius","getBorderRadiusStyle","radius","flatEdge","StyledIconButton","styled","button","hideOnLowWidth","BREAKPOINTS","MEDIUM","unsetIconSize","StyledPrimaryIconButton","useTransparentBackground","COLORS","primary_500","iconColor","white","focusBackgroundColor","primary_700","primary_800","neutral_200","StyledSecondaryIconButton","neutral_600","primary_20","primary_100","neutral_300","IconButton","React","forwardRef","ref","id","variant","shape","action","isInMobileMenu","children","disabled","tabIndex","onKeyPress","type","hidden","style","isPressingEnterOrSpace","e","key","stopPropagation","event","defaultOnMouseDownHandler"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;AAcA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD;AAAA,SAA4BA,KAAK,CAACC,YAAN,aAAwBD,KAAK,CAACC,YAA9B,UAAiD,KAA7E;AAAA,CAAxB;;AAEA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACF,KAAD,EAA2B;AACtD,MAAMG,MAAM,GAAGJ,eAAe,CAACC,KAAD,CAA9B;;AACA,UAAOA,KAAK,CAACI,QAAb;AAEI,SAAK,MAAL;AACI,2BAAcD,MAAd,cAAwBA,MAAxB;;AAEJ,SAAK,OAAL;AACI,uBAAUA,MAAV,sBAA4BA,MAA5B;;AAEJ,SAAK,MAAL;AACA;AACI,uBAAUA,MAAV;AAVR;AAYD,CAdD;;AAgBA,IAAME,gBAAgB,GAAGC,0BAAOC,MAAV,+vBAOT,UAACP,KAAD;AAAA,SAAYA,KAAK,CAACQ,cAAN,GAAuB,MAAvB,GAAgC,OAA5C;AAAA,CAPS,EAQlBC,oBAAYC,MARM,EAYH,UAACV,KAAD;AAAA,SAAYA,KAAK,CAACC,YAAN,aAAwBD,KAAK,CAACC,YAA9B,UAAiD,KAA7D;AAAA,CAZG,EAgBDC,oBAhBC,EAqBN,UAACF,KAAD;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,EAAAA,Y;AACAsC,EAAAA,U;AACArB,EAAAA,oB;AAEAkB,EAAAA,Q;AACAK,EAAAA,M;;eA2Fad,U","sourcesContent":["import React from 'react';\nimport styled, {css, CSSProperties} from 'styled-components';\n\nimport { BREAKPOINTS, COLORS } from '../styles';\nimport {defaultOnMouseDownHandler} from '../common';\n\ninterface HeaderItemProps {\n hideOnLowWidth: boolean;\n inMobileMenu?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n borderRadius?: number;\n shape?: string;\n flatEdge?: string;\n focusBackgroundColor?: string;\n}\n\nconst getBorderRadius = (props:HeaderItemProps) => (props.borderRadius ? `${props.borderRadius}px` : '4px');\n\nconst getBorderRadiusStyle = (props:HeaderItemProps) => {\n const radius = getBorderRadius(props);\n switch(props.flatEdge)\n {\n case 'left':\n return `0px ${radius} ${radius} 0px`;\n\n case 'right':\n return `${radius} 0px 0px ${radius}`;\n\n case 'none':\n default:\n return `${radius}`;\n }\n};\n\nconst StyledIconButton = styled.button<HeaderItemProps>`\n border-width: 0;\n cursor: pointer;\n height: 48px;\n width: 48px;\n background: transparent;\n\n display: ${(props) => (props.hideOnLowWidth ? 'none' : 'block')};\n ${BREAKPOINTS.MEDIUM} {\n display: block;\n }\n\n border-radius: ${(props) => (props.borderRadius ? `${props.borderRadius}px` : '4px')};\n div {\n height: 36px;\n width: 36px;\n border-radius: ${getBorderRadiusStyle};\n display: flex;\n justify-content: center;\n align-items: center;\n svg {\n height: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n width: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n padding: 0;\n }\n }\n &:only-child {\n margin: 0;\n }\n &:disabled {\n cursor: not-allowed;\n }\n &:focus:not(:disabled) {\n outline: none;\n div {\n outline: none;\n }\n }\n &:active:not(:disabled) {\n div {\n box-shadow: none !important;\n }\n }\n`;\n\nexport const StyledPrimaryIconButton = styled(StyledIconButton)`\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.primary_500)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.white};\n path {\n fill: ${(props) => props.iconColor || COLORS.white};\n }\n }\n }\n &:focus:not(:disabled) {\n div {\n background-color: ${(props) => props.focusBackgroundColor || COLORS.primary_700} !important;\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2e7fa1;\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:hover:not(:disabled) {\n div {\n background-color: ${COLORS.primary_700};\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${COLORS.primary_800};\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:disabled {\n div {\n background-color: ${COLORS.neutral_200};\n }\n svg {\n path {\n fill: ${COLORS.white};\n }\n fill: ${COLORS.white};\n }\n }\n\n`;\n\nexport const StyledSecondaryIconButton = styled(StyledIconButton)`\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n path {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n }\n }\n }\n\n &:focus:not(:disabled) {\n div {\n background-color: ${(props) => props.focusBackgroundColor || 'transparent'};\n box-shadow: 0px 0px 8px ${COLORS.primary_500}, 0px 4px 12px rgba(46, 127, 161, 0.25);\n }\n div svg path,\n div svg {\n fill: ${COLORS.neutral_600};\n }\n }\n \n &:hover:not(:disabled) {\n div {\n background-color: ${COLORS.primary_20};\n }\n div svg path,\n div svg {\n fill: ${COLORS.primary_700};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${COLORS.primary_100};\n }\n div svg path,\n div svg {\n fill: ${COLORS.primary_800};\n }\n }\n\n &:disabled {\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n }\n svg {\n path {\n fill: ${COLORS.neutral_300};\n }\n fill: ${COLORS.neutral_300};\n }\n }\n\n`;\n\nexport interface IconButtonProps {\n id?: string;\n variant?: 'primary' | 'secondary';\n shape?: 'square' | 'circular';\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n hideOnLowWidth?: boolean;\n flatEdge?: 'right' | 'left' | 'none' | undefined;\n isInMobileMenu?: boolean;\n disabled?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n tabIndex?: number;\n borderRadius?: number;\n onKeyPress?: React.KeyboardEventHandler<HTMLButtonElement>;\n focusBackgroundColor?: string;\n type?: 'submit' | 'reset' | 'button' | undefined;\n children?: React.ReactNode;\n hidden?: boolean;\n style?: CSSProperties | undefined;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(({\n id,\n variant,\n shape,\n action,\n hideOnLowWidth,\n isInMobileMenu,\n children,\n useTransparentBackground,\n disabled,\n iconColor,\n unsetIconSize,\n tabIndex,\n flatEdge,\n borderRadius,\n onKeyPress,\n focusBackgroundColor,\n type,\n hidden,\n style\n}: IconButtonProps, ref) => {\n\n const isPressingEnterOrSpace = (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.stopPropagation();\n return true;\n }\n return false;\n };\n\n // Let's render button\n switch (variant) {\n case 'secondary':\n return (\n <StyledSecondaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {event.stopPropagation(); action(event);}}\n onKeyDown={(e: any) => isPressingEnterOrSpace(e) ? action() : null}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyPress={onKeyPress}\n hidden={hidden}\n style={style}\n focusBackgroundColor={focusBackgroundColor}>\n <div>{children}</div>\n </StyledSecondaryIconButton>\n );\n case 'primary':\n default:\n return (\n <StyledPrimaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n flatEdge={flatEdge}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {event.stopPropagation(); action(event);}}\n onKeyDown={(e: any) => isPressingEnterOrSpace(e) ? action() : null}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyPress={onKeyPress}\n hidden={hidden}\n style={style}\n focusBackgroundColor={focusBackgroundColor}>\n <div>{children}</div>\n </StyledPrimaryIconButton>\n );\n }\n});\n\nexport default IconButton;\n"],"file":"Iconbutton.cjs"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { CSSProperties } from 'styled-components';
|
|
2
3
|
interface HeaderItemProps {
|
|
3
4
|
hideOnLowWidth: boolean;
|
|
4
5
|
inMobileMenu?: boolean;
|
|
@@ -31,6 +32,7 @@ export interface IconButtonProps {
|
|
|
31
32
|
type?: 'submit' | 'reset' | 'button' | undefined;
|
|
32
33
|
children?: React.ReactNode;
|
|
33
34
|
hidden?: boolean;
|
|
35
|
+
style?: CSSProperties | undefined;
|
|
34
36
|
}
|
|
35
37
|
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
36
38
|
export default IconButton;
|
|
@@ -76,7 +76,8 @@ var IconButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
76
76
|
onKeyPress = _ref.onKeyPress,
|
|
77
77
|
focusBackgroundColor = _ref.focusBackgroundColor,
|
|
78
78
|
type = _ref.type,
|
|
79
|
-
hidden = _ref.hidden
|
|
79
|
+
hidden = _ref.hidden,
|
|
80
|
+
style = _ref.style;
|
|
80
81
|
|
|
81
82
|
var isPressingEnterOrSpace = function isPressingEnterOrSpace(e) {
|
|
82
83
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
@@ -113,6 +114,7 @@ var IconButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
113
114
|
onMouseDown: defaultOnMouseDownHandler,
|
|
114
115
|
onKeyPress: onKeyPress,
|
|
115
116
|
hidden: hidden,
|
|
117
|
+
style: style,
|
|
116
118
|
focusBackgroundColor: focusBackgroundColor,
|
|
117
119
|
children: /*#__PURE__*/_jsx("div", {
|
|
118
120
|
children: children
|
|
@@ -145,6 +147,7 @@ var IconButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
145
147
|
onMouseDown: defaultOnMouseDownHandler,
|
|
146
148
|
onKeyPress: onKeyPress,
|
|
147
149
|
hidden: hidden,
|
|
150
|
+
style: style,
|
|
148
151
|
focusBackgroundColor: focusBackgroundColor,
|
|
149
152
|
children: /*#__PURE__*/_jsx("div", {
|
|
150
153
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Button/Iconbutton.tsx"],"names":["React","styled","BREAKPOINTS","COLORS","defaultOnMouseDownHandler","getBorderRadius","props","borderRadius","getBorderRadiusStyle","radius","flatEdge","StyledIconButton","button","hideOnLowWidth","MEDIUM","unsetIconSize","StyledPrimaryIconButton","useTransparentBackground","primary_500","iconColor","white","focusBackgroundColor","primary_700","primary_800","neutral_200","StyledSecondaryIconButton","neutral_600","primary_20","primary_100","neutral_300","IconButton","forwardRef","ref","id","variant","shape","action","isInMobileMenu","children","disabled","tabIndex","onKeyPress","type","hidden","isPressingEnterOrSpace","e","key","stopPropagation","event"],"mappings":";;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,MAAP,MAA4B,mBAA5B;AAEA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,WAApC;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AA,iBAAYD,sBAAsB,CAACC,CAAD,CAAtB,GAA4BT,MAAM,EAAlC,GAAuC,IAAnD;AAAA,SAPb;AAQE,QAAA,QAAQ,EAAEG,QARZ;AASE,QAAA,cAAc,EAAE1B,cAAc,IAAI,KATpC;AAUE,QAAA,YAAY,EAAEwB,cAVhB;AAWE,QAAA,wBAAwB,EAAEpB,wBAX5B;AAYE,QAAA,SAAS,EAAEE,SAZb;AAaE,QAAA,aAAa,EAAEJ,aAbjB;AAcE,QAAA,QAAQ,EAAEyB,QAAQ,IAAI,CAdxB;AAeE,QAAA,YAAY,EAAEjC,YAAY,IAAI4B,KAAK,KAAK,UAA1B,GAAuC,EAAvC,GAA4C,CAf5D;AAgBE,QAAA,WAAW,EAAE/B,yBAhBf;AAiBE,QAAA,UAAU,EAAEqC,UAjBd;AAkBE,QAAA,MAAM,EAAEE,MAlBV;AAmBE,QAAA,oBAAoB,EAAEtB,oBAnBxB;AAAA,+BAoBE;AAAA,oBAAMiB;AAAN;AApBF,QADF;AA3BJ;AAoDD,CAlFkB,CAAnB;;AApBEL,EAAAA,E;AACAC,EAAAA,O,aAAU,S,EAAY,W;AACtBC,EAAAA,K,aAAQ,Q,EAAW,U;AACnBC,EAAAA,M;AACAvB,EAAAA,c;AAEAwB,EAAAA,c;AACAE,EAAAA,Q;AACAtB,EAAAA,wB;AACAE,EAAAA,S;AACAJ,EAAAA,a;AACAyB,EAAAA,Q;AACAjC,EAAAA,Y;AACAkC,EAAAA,U;AACApB,EAAAA,oB;AAEAiB,EAAAA,Q;AACAK,EAAAA,M;;AAuFF,eAAeb,UAAf","sourcesContent":["import React from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BREAKPOINTS, COLORS } from '../styles';\nimport {defaultOnMouseDownHandler} from '../common';\n\ninterface HeaderItemProps {\n hideOnLowWidth: boolean;\n inMobileMenu?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n borderRadius?: number;\n shape?: string;\n flatEdge?: string;\n focusBackgroundColor?: string;\n}\n\nconst getBorderRadius = (props:HeaderItemProps) => (props.borderRadius ? `${props.borderRadius}px` : '4px');\n\nconst getBorderRadiusStyle = (props:HeaderItemProps) => {\n const radius = getBorderRadius(props);\n switch(props.flatEdge)\n {\n case 'left':\n return `0px ${radius} ${radius} 0px`;\n\n case 'right':\n return `${radius} 0px 0px ${radius}`;\n\n case 'none':\n default:\n return `${radius}`;\n }\n};\n\nconst StyledIconButton = styled.button<HeaderItemProps>`\n border-width: 0;\n cursor: pointer;\n height: 48px;\n width: 48px;\n background: transparent;\n\n display: ${(props) => (props.hideOnLowWidth ? 'none' : 'block')};\n ${BREAKPOINTS.MEDIUM} {\n display: block;\n }\n\n border-radius: ${(props) => (props.borderRadius ? `${props.borderRadius}px` : '4px')};\n div {\n height: 36px;\n width: 36px;\n border-radius: ${getBorderRadiusStyle};\n display: flex;\n justify-content: center;\n align-items: center;\n svg {\n height: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n width: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n padding: 0;\n }\n }\n &:only-child {\n margin: 0;\n }\n &:disabled {\n cursor: not-allowed;\n }\n &:focus:not(:disabled) {\n outline: none;\n div {\n outline: none;\n }\n }\n &:active:not(:disabled) {\n div {\n box-shadow: none !important;\n }\n }\n`;\n\nexport const StyledPrimaryIconButton = styled(StyledIconButton)`\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.primary_500)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.white};\n path {\n fill: ${(props) => props.iconColor || COLORS.white};\n }\n }\n }\n &:focus:not(:disabled) {\n div {\n background-color: ${(props) => props.focusBackgroundColor || COLORS.primary_700} !important;\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2e7fa1;\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:hover:not(:disabled) {\n div {\n background-color: ${COLORS.primary_700};\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${COLORS.primary_800};\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:disabled {\n div {\n background-color: ${COLORS.neutral_200};\n }\n svg {\n path {\n fill: ${COLORS.white};\n }\n fill: ${COLORS.white};\n }\n }\n\n`;\n\nexport const StyledSecondaryIconButton = styled(StyledIconButton)`\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n path {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n }\n }\n }\n\n &:focus:not(:disabled) {\n div {\n background-color: ${(props) => props.focusBackgroundColor || 'transparent'};\n box-shadow: 0px 0px 8px ${COLORS.primary_500}, 0px 4px 12px rgba(46, 127, 161, 0.25);\n }\n div svg path,\n div svg {\n fill: ${COLORS.neutral_600};\n }\n }\n \n &:hover:not(:disabled) {\n div {\n background-color: ${COLORS.primary_20};\n }\n div svg path,\n div svg {\n fill: ${COLORS.primary_700};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${COLORS.primary_100};\n }\n div svg path,\n div svg {\n fill: ${COLORS.primary_800};\n }\n }\n\n &:disabled {\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n }\n svg {\n path {\n fill: ${COLORS.neutral_300};\n }\n fill: ${COLORS.neutral_300};\n }\n }\n\n`;\n\nexport interface IconButtonProps {\n id?: string;\n variant?: 'primary' | 'secondary';\n shape?: 'square' | 'circular';\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n hideOnLowWidth?: boolean;\n flatEdge?: 'right' | 'left' | 'none' | undefined;\n isInMobileMenu?: boolean;\n disabled?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n tabIndex?: number;\n borderRadius?: number;\n onKeyPress?: React.KeyboardEventHandler<HTMLButtonElement>;\n focusBackgroundColor?: string;\n type?: 'submit' | 'reset' | 'button' | undefined;\n children?: React.ReactNode;\n hidden?: boolean;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(({\n id,\n variant,\n shape,\n action,\n hideOnLowWidth,\n isInMobileMenu,\n children,\n useTransparentBackground,\n disabled,\n iconColor,\n unsetIconSize,\n tabIndex,\n flatEdge,\n borderRadius,\n onKeyPress,\n focusBackgroundColor,\n type,\n hidden\n}: IconButtonProps, ref) => {\n\n const isPressingEnterOrSpace = (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.stopPropagation();\n return true;\n }\n return false;\n };\n\n // Let's render button\n switch (variant) {\n case 'secondary':\n return (\n <StyledSecondaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {event.stopPropagation(); action(event);}}\n onKeyDown={(e: any) => isPressingEnterOrSpace(e) ? action() : null}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyPress={onKeyPress}\n hidden={hidden}\n focusBackgroundColor={focusBackgroundColor}>\n <div>{children}</div>\n </StyledSecondaryIconButton>\n );\n case 'primary':\n default:\n return (\n <StyledPrimaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n flatEdge={flatEdge}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {event.stopPropagation(); action(event);}}\n onKeyDown={(e: any) => isPressingEnterOrSpace(e) ? action() : null}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyPress={onKeyPress}\n hidden={hidden}\n focusBackgroundColor={focusBackgroundColor}>\n <div>{children}</div>\n </StyledPrimaryIconButton>\n );\n }\n});\n\nexport default IconButton;\n"],"file":"Iconbutton.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/Button/Iconbutton.tsx"],"names":["React","styled","BREAKPOINTS","COLORS","defaultOnMouseDownHandler","getBorderRadius","props","borderRadius","getBorderRadiusStyle","radius","flatEdge","StyledIconButton","button","hideOnLowWidth","MEDIUM","unsetIconSize","StyledPrimaryIconButton","useTransparentBackground","primary_500","iconColor","white","focusBackgroundColor","primary_700","primary_800","neutral_200","StyledSecondaryIconButton","neutral_600","primary_20","primary_100","neutral_300","IconButton","forwardRef","ref","id","variant","shape","action","isInMobileMenu","children","disabled","tabIndex","onKeyPress","type","hidden","style","isPressingEnterOrSpace","e","key","stopPropagation","event"],"mappings":";;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,MAAP,MAAyC,mBAAzC;AAEA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,WAApC;AACA,SAAQC,yBAAR,QAAwC,WAAxC;;;AAcA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD;AAAA,SAA4BA,KAAK,CAACC,YAAN,aAAwBD,KAAK,CAACC,YAA9B,UAAiD,KAA7E;AAAA,CAAxB;;AAEA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACF,KAAD,EAA2B;AACtD,MAAMG,MAAM,GAAGJ,eAAe,CAACC,KAAD,CAA9B;;AACA,UAAOA,KAAK,CAACI,QAAb;AAEI,SAAK,MAAL;AACI,2BAAcD,MAAd,cAAwBA,MAAxB;;AAEJ,SAAK,OAAL;AACI,uBAAUA,MAAV,sBAA4BA,MAA5B;;AAEJ,SAAK,MAAL;AACA;AACI,uBAAUA,MAAV;AAVR;AAYD,CAdD;;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AA4C,CAf5D;AAgBE,QAAA,WAAW,EAAE/B,yBAhBf;AAiBE,QAAA,UAAU,EAAEqC,UAjBd;AAkBE,QAAA,MAAM,EAAEE,MAlBV;AAmBE,QAAA,KAAK,EAAEC,KAnBT;AAoBE,QAAA,oBAAoB,EAAEvB,oBApBxB;AAAA,+BAqBE;AAAA,oBAAMiB;AAAN;AArBF,QADF;AA5BJ;AAsDD,CArFkB,CAAnB;;AArBEL,EAAAA,E;AACAC,EAAAA,O,aAAU,S,EAAY,W;AACtBC,EAAAA,K,aAAQ,Q,EAAW,U;AACnBC,EAAAA,M;AACAvB,EAAAA,c;AAEAwB,EAAAA,c;AACAE,EAAAA,Q;AACAtB,EAAAA,wB;AACAE,EAAAA,S;AACAJ,EAAAA,a;AACAyB,EAAAA,Q;AACAjC,EAAAA,Y;AACAkC,EAAAA,U;AACApB,EAAAA,oB;AAEAiB,EAAAA,Q;AACAK,EAAAA,M;;AA2FF,eAAeb,UAAf","sourcesContent":["import React from 'react';\nimport styled, {css, CSSProperties} from 'styled-components';\n\nimport { BREAKPOINTS, COLORS } from '../styles';\nimport {defaultOnMouseDownHandler} from '../common';\n\ninterface HeaderItemProps {\n hideOnLowWidth: boolean;\n inMobileMenu?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n borderRadius?: number;\n shape?: string;\n flatEdge?: string;\n focusBackgroundColor?: string;\n}\n\nconst getBorderRadius = (props:HeaderItemProps) => (props.borderRadius ? `${props.borderRadius}px` : '4px');\n\nconst getBorderRadiusStyle = (props:HeaderItemProps) => {\n const radius = getBorderRadius(props);\n switch(props.flatEdge)\n {\n case 'left':\n return `0px ${radius} ${radius} 0px`;\n\n case 'right':\n return `${radius} 0px 0px ${radius}`;\n\n case 'none':\n default:\n return `${radius}`;\n }\n};\n\nconst StyledIconButton = styled.button<HeaderItemProps>`\n border-width: 0;\n cursor: pointer;\n height: 48px;\n width: 48px;\n background: transparent;\n\n display: ${(props) => (props.hideOnLowWidth ? 'none' : 'block')};\n ${BREAKPOINTS.MEDIUM} {\n display: block;\n }\n\n border-radius: ${(props) => (props.borderRadius ? `${props.borderRadius}px` : '4px')};\n div {\n height: 36px;\n width: 36px;\n border-radius: ${getBorderRadiusStyle};\n display: flex;\n justify-content: center;\n align-items: center;\n svg {\n height: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n width: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n padding: 0;\n }\n }\n &:only-child {\n margin: 0;\n }\n &:disabled {\n cursor: not-allowed;\n }\n &:focus:not(:disabled) {\n outline: none;\n div {\n outline: none;\n }\n }\n &:active:not(:disabled) {\n div {\n box-shadow: none !important;\n }\n }\n`;\n\nexport const StyledPrimaryIconButton = styled(StyledIconButton)`\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.primary_500)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.white};\n path {\n fill: ${(props) => props.iconColor || COLORS.white};\n }\n }\n }\n &:focus:not(:disabled) {\n div {\n background-color: ${(props) => props.focusBackgroundColor || COLORS.primary_700} !important;\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2e7fa1;\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:hover:not(:disabled) {\n div {\n background-color: ${COLORS.primary_700};\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${COLORS.primary_800};\n }\n div svg path,\n div svg {\n fill: ${COLORS.white};\n }\n }\n &:disabled {\n div {\n background-color: ${COLORS.neutral_200};\n }\n svg {\n path {\n fill: ${COLORS.white};\n }\n fill: ${COLORS.white};\n }\n }\n\n`;\n\nexport const StyledSecondaryIconButton = styled(StyledIconButton)`\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n path {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n }\n }\n }\n\n &:focus:not(:disabled) {\n div {\n background-color: ${(props) => props.focusBackgroundColor || 'transparent'};\n box-shadow: 0px 0px 8px ${COLORS.primary_500}, 0px 4px 12px rgba(46, 127, 161, 0.25);\n }\n div svg path,\n div svg {\n fill: ${COLORS.neutral_600};\n }\n }\n \n &:hover:not(:disabled) {\n div {\n background-color: ${COLORS.primary_20};\n }\n div svg path,\n div svg {\n fill: ${COLORS.primary_700};\n }\n }\n &:active:not(:disabled) {\n div {\n background: ${COLORS.primary_100};\n }\n div svg path,\n div svg {\n fill: ${COLORS.primary_800};\n }\n }\n\n &:disabled {\n div {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n }\n svg {\n path {\n fill: ${COLORS.neutral_300};\n }\n fill: ${COLORS.neutral_300};\n }\n }\n\n`;\n\nexport interface IconButtonProps {\n id?: string;\n variant?: 'primary' | 'secondary';\n shape?: 'square' | 'circular';\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n hideOnLowWidth?: boolean;\n flatEdge?: 'right' | 'left' | 'none' | undefined;\n isInMobileMenu?: boolean;\n disabled?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n tabIndex?: number;\n borderRadius?: number;\n onKeyPress?: React.KeyboardEventHandler<HTMLButtonElement>;\n focusBackgroundColor?: string;\n type?: 'submit' | 'reset' | 'button' | undefined;\n children?: React.ReactNode;\n hidden?: boolean;\n style?: CSSProperties | undefined;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(({\n id,\n variant,\n shape,\n action,\n hideOnLowWidth,\n isInMobileMenu,\n children,\n useTransparentBackground,\n disabled,\n iconColor,\n unsetIconSize,\n tabIndex,\n flatEdge,\n borderRadius,\n onKeyPress,\n focusBackgroundColor,\n type,\n hidden,\n style\n}: IconButtonProps, ref) => {\n\n const isPressingEnterOrSpace = (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.stopPropagation();\n return true;\n }\n return false;\n };\n\n // Let's render button\n switch (variant) {\n case 'secondary':\n return (\n <StyledSecondaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {event.stopPropagation(); action(event);}}\n onKeyDown={(e: any) => isPressingEnterOrSpace(e) ? action() : null}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyPress={onKeyPress}\n hidden={hidden}\n style={style}\n focusBackgroundColor={focusBackgroundColor}>\n <div>{children}</div>\n </StyledSecondaryIconButton>\n );\n case 'primary':\n default:\n return (\n <StyledPrimaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n flatEdge={flatEdge}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {event.stopPropagation(); action(event);}}\n onKeyDown={(e: any) => isPressingEnterOrSpace(e) ? action() : null}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyPress={onKeyPress}\n hidden={hidden}\n style={style}\n focusBackgroundColor={focusBackgroundColor}>\n <div>{children}</div>\n </StyledPrimaryIconButton>\n );\n }\n});\n\nexport default IconButton;\n"],"file":"Iconbutton.js"}
|
|
@@ -35,7 +35,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
35
35
|
|
|
36
36
|
var Img = _styledComponents.default.img(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n object-fit: cover;\n width: 100%;\n height: 100%;\n border-top-right-radius: 8px;\n border-top-left-radius: 8px;\n"])));
|
|
37
37
|
|
|
38
|
-
var TagContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n\n top: 16px;\n left: 16px;\n"])));
|
|
38
|
+
var TagContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n\n top: 16px;\n left: 16px;\n width: calc(100% - 32px);\n"])));
|
|
39
39
|
|
|
40
40
|
var Container = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n width: 100%;\n height: 200px;\n overflow: visible;\n\n ", "\n\n ", "\n"])), function (props) {
|
|
41
41
|
return props.disabled ? "\n img, svg {\n filter: grayscale(100%);\n }" : '';
|
|
@@ -43,7 +43,7 @@ var Container = _styledComponents.default.div(_templateObject3 || (_templateObje
|
|
|
43
43
|
return props.interactionType == _.InteractionType.Clickable ? "\n cursor: ".concat(props.disabled ? 'not-allowed' : 'pointer', ";\n ") : '';
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
var RibbonContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n min-height: calc(40px - 16px);\n background-color: ", ";\n width: calc(100% - 32px);\n position: absolute;\n bottom: 0px;\n left: 0px;\n padding: 8px 16px 8px 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n\n svg {\n color: ", ";\n
|
|
46
|
+
var RibbonContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n min-height: calc(40px - 16px);\n background-color: ", ";\n width: calc(100% - 32px);\n position: absolute;\n bottom: 0px;\n left: 0px;\n padding: 8px 16px 8px 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 8px;\n\n svg {\n color: ", ";\n width: 24px;\n height: 24px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n"])), function (props) {
|
|
47
47
|
return props.$backgroundColor;
|
|
48
48
|
}, function (props) {
|
|
49
49
|
return props.$color;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Card/CardTopSection.tsx"],"names":["Img","styled","img","TagContainer","div","Container","props","disabled","interactionType","InteractionType","Clickable","RibbonContainer","$backgroundColor","$color","CheckboxContainer","COLORS","white","CardTopSection","selected","setSelected","image","tagLabel","tagIcon","tagVariant","highlightRibbonIcon","highlightRibbonText","highlightRibbonContentColor","highlightRibbonBgColor","undefined","Selectable","neutral_300","ComponentTextStyle","Regular"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AAiBA,IAAMA,GAAG,GAAGC,0BAAOC,GAAV,6MAAT;;AAQA,IAAMC,YAAY,GAAGF,0BAAOG,GAAV,
|
|
1
|
+
{"version":3,"sources":["../../src/Card/CardTopSection.tsx"],"names":["Img","styled","img","TagContainer","div","Container","props","disabled","interactionType","InteractionType","Clickable","RibbonContainer","$backgroundColor","$color","CheckboxContainer","COLORS","white","CardTopSection","selected","setSelected","image","tagLabel","tagIcon","tagVariant","highlightRibbonIcon","highlightRibbonText","highlightRibbonContentColor","highlightRibbonBgColor","undefined","Selectable","neutral_300","ComponentTextStyle","Regular"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AAiBA,IAAMA,GAAG,GAAGC,0BAAOC,GAAV,6MAAT;;AAQA,IAAMC,YAAY,GAAGF,0BAAOG,GAAV,0KAAlB;;AAQA,IAAMC,SAAS,GAAGJ,0BAAOG,GAAV,2LAMX,UAAAE,KAAK;AAAA,SAAIA,KAAK,CAACC,QAAN,yDAGN,EAHE;AAAA,CANM,EAWX,UAAAD,KAAK;AAAA,SACLA,KAAK,CAACE,eAAN,IAAyBC,kBAAgBC,SAAzC,2B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AAlB;AAAgE,QAAA,QAAQ,EAAEA;AAA1E;AADF,MAHJ,EAOG,CAACG,QAAQ,IAAIC,OAAb,kBACC,qBAAC,YAAD;AAAA,6BACE,qBAAC,QAAD;AAAK,QAAA,KAAK,EAAED,QAAZ;AAAsB,QAAA,OAAO,EAAEE,UAA/B;AAA2C,QAAA,IAAI,EAAED;AAAjD;AADF,MARJ,EAYG,CAACE,mBAAmB,IAAIC,mBAAxB,kBACC,sBAAC,eAAD;AAAiB,MAAA,MAAM,EAAEC,2BAAF,aAAEA,2BAAF,cAAEA,2BAAF,GAAiC,EAAxD;AAA4D,MAAA,gBAAgB,EAAEnB,QAAQ,GAAGQ,SAAOe,WAAV,GAAwBH,sBAAxB,aAAwBA,sBAAxB,cAAwBA,sBAAxB,GAAkD,EAAxI;AAAA,iBACGH,mBADH,EAEGC,mBAAmB,iBAClB,qBAAC,sBAAD;AAAY,QAAA,KAAK,EAAEC,2BAAF,aAAEA,2BAAF,cAAEA,2BAAF,GAAiC,EAAlD;AAAsD,QAAA,SAAS,EAAEK,+BAAmBC,OAApF;AAAA,kBACGP;AADH,QAHJ;AAAA,MAbJ;AAAA,IADF;AAyBD,CAvCD;;;AAhFEP,EAAAA,Q;AACAC,EAAAA,W;AACAE,EAAAA,Q;AACAC,EAAAA,O;AAEAG,EAAAA,mB;AACAD,EAAAA,mB;AACAE,EAAAA,2B;AACAC,EAAAA,sB;AACAP,EAAAA,K;AACAb,EAAAA,Q;;eA+GaU,c","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { ComponentS, ComponentTextStyle } from '../styles/typography';\nimport Checkbox, { StyledCheckBox } from '../InputFields/Checkbox';\nimport { Tag, TagVariants } from '../Tag';\n\nimport { COLORS, InteractionType } from '..';\n\nexport interface CardTopSectionProps {\n interactionType: InteractionType;\n selected: boolean;\n setSelected: (arg0: boolean) => void;\n tagLabel?: string;\n tagIcon?: React.ReactNode;\n tagVariant?: TagVariants;\n highlightRibbonText?: string;\n highlightRibbonIcon?: string;\n highlightRibbonContentColor?: string;\n highlightRibbonBgColor?: string;\n image?: string;\n disabled: boolean;\n}\n\nconst Img = styled.img`\n object-fit: cover;\n width: 100%;\n height: 100%;\n border-top-right-radius: 8px;\n border-top-left-radius: 8px;\n`;\n\nconst TagContainer = styled.div`\n position: absolute;\n\n top: 16px;\n left: 16px;\n width: calc(100% - 32px);\n`;\n\nconst Container = styled.div<{ interactionType: InteractionType; disabled: boolean }>`\n position: relative;\n width: 100%;\n height: 200px;\n overflow: visible;\n\n ${props => props.disabled ? `\n img, svg {\n filter: grayscale(100%);\n }` : ''}\n\n ${props =>\n props.interactionType == InteractionType.Clickable\n ? `\n cursor: ${props.disabled ? 'not-allowed' : 'pointer'};\n `\n : ''}\n`;\n\nconst RibbonContainer = styled.div<{ $color: string; $backgroundColor: string }>`\n min-height: calc(40px - 16px);\n background-color: ${props => props.$backgroundColor};\n width: calc(100% - 32px);\n position: absolute;\n bottom: 0px;\n left: 0px;\n padding: 8px 16px 8px 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 8px;\n\n svg {\n color: ${props => props.$color};\n width: 24px;\n height: 24px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n`;\n\nconst CheckboxContainer = styled.div`\n position: absolute;\n top: 0px;\n right: 0px;\n\n .checkbox-icon {\n background-color: ${COLORS.white};\n }\n`;\n\nconst CardTopSection: React.FunctionComponent<CardTopSectionProps> = ({\n interactionType,\n selected,\n setSelected,\n image,\n tagLabel,\n tagIcon,\n tagVariant = 'positive',\n highlightRibbonIcon,\n highlightRibbonText,\n highlightRibbonContentColor,\n highlightRibbonBgColor,\n disabled\n}: CardTopSectionProps) => {\n return (\n <Container disabled={disabled} interactionType={interactionType}>\n <Img src={image} />\n {(selected !== undefined || setSelected !== undefined) && interactionType == InteractionType.Selectable && (\n <CheckboxContainer>\n <Checkbox select={(selected: boolean) => setSelected(selected)} selected={selected} />\n </CheckboxContainer>\n )}\n {(tagLabel || tagIcon) && (\n <TagContainer>\n <Tag label={tagLabel} variant={tagVariant} icon={tagIcon} />\n </TagContainer>\n )}\n {(highlightRibbonIcon || highlightRibbonText) && (\n <RibbonContainer $color={highlightRibbonContentColor ?? ''} $backgroundColor={disabled ? COLORS.neutral_300 : highlightRibbonBgColor ?? ''}>\n {highlightRibbonIcon}\n {highlightRibbonText && (\n <ComponentS color={highlightRibbonContentColor ?? ''} textStyle={ComponentTextStyle.Regular}>\n {highlightRibbonText}\n </ComponentS>\n )}\n </RibbonContainer>\n )}\n </Container>\n );\n};\n\nexport default CardTopSection;\n"],"file":"CardTopSection.cjs"}
|
|
@@ -12,13 +12,13 @@ import { COLORS, InteractionType } from '..';
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
var Img = styled.img(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n object-fit: cover;\n width: 100%;\n height: 100%;\n border-top-right-radius: 8px;\n border-top-left-radius: 8px;\n"])));
|
|
15
|
-
var TagContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n\n top: 16px;\n left: 16px;\n"])));
|
|
15
|
+
var TagContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n\n top: 16px;\n left: 16px;\n width: calc(100% - 32px);\n"])));
|
|
16
16
|
var Container = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n height: 200px;\n overflow: visible;\n\n ", "\n\n ", "\n"])), function (props) {
|
|
17
17
|
return props.disabled ? "\n img, svg {\n filter: grayscale(100%);\n }" : '';
|
|
18
18
|
}, function (props) {
|
|
19
19
|
return props.interactionType == InteractionType.Clickable ? "\n cursor: ".concat(props.disabled ? 'not-allowed' : 'pointer', ";\n ") : '';
|
|
20
20
|
});
|
|
21
|
-
var RibbonContainer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n min-height: calc(40px - 16px);\n background-color: ", ";\n width: calc(100% - 32px);\n position: absolute;\n bottom: 0px;\n left: 0px;\n padding: 8px 16px 8px 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n\n svg {\n color: ", ";\n
|
|
21
|
+
var RibbonContainer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n min-height: calc(40px - 16px);\n background-color: ", ";\n width: calc(100% - 32px);\n position: absolute;\n bottom: 0px;\n left: 0px;\n padding: 8px 16px 8px 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 8px;\n\n svg {\n color: ", ";\n width: 24px;\n height: 24px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n"])), function (props) {
|
|
22
22
|
return props.$backgroundColor;
|
|
23
23
|
}, function (props) {
|
|
24
24
|
return props.$color;
|