@laerdal/life-react-components 1.6.0-dev.6.full → 1.6.0-dev.8

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.
@@ -0,0 +1,204 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
4
+ import _pt from "prop-types";
5
+ var _excluded = ["icon"],
6
+ _excluded2 = ["text", "variant", "action"],
7
+ _excluded3 = ["text", "variant", "action"],
8
+ _excluded4 = ["action", "text"];
9
+
10
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
11
+
12
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
13
+
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
15
+
16
+ import React from 'react';
17
+ import { Size } from '../types';
18
+ import { ModalContainer } from './index';
19
+ import styled from 'styled-components';
20
+ import { COLORS, ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle, ComponentXLStyling, ComponentXSStyling, ComponentXXSStyling } from '../styles';
21
+ import { TooltipContainer, TooltipWrapper } from '../Tooltips';
22
+ import { Button, IconButton } from '../Button';
23
+ import { Close, Help } from '../icons/systemicons/SystemIcons';
24
+ import { HyperLink } from '../HyperLink';
25
+ import { jsx as _jsx } from "react/jsx-runtime";
26
+ import { jsxs as _jsxs } from "react/jsx-runtime";
27
+ var HeaderText = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: center;\n\n padding: 12px 0 12px 12px;\n gap: 4px\n"])));
28
+ var HeaderTitle = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n"])), ComponentMStyling(ComponentTextStyle.Bold, COLORS.black));
29
+ var HeaderNote = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n"])), ComponentXXSStyling(ComponentTextStyle.Regular, COLORS.neutral_600));
30
+ var HeaderActions = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n"])));
31
+ var Header = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n padding: 4px;\n\n ", " {\n height: max-content;\n }\n"])), TooltipContainer);
32
+ var Content = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-right: 8px;\n padding: 0 8px 0 16px;\n overflow: auto;\n\n /* width */\n\n ::-webkit-scrollbar {\n width: 4px;\n cursor: pointer;\n }\n\n /* Track */\n\n ::-webkit-scrollbar-track {\n background: ", ";\n border-radius: 8px;\n }\n\n /* Handle */\n\n ::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 8px;\n }\n\n /* Handle on hover */\n\n ::-webkit-scrollbar-thumb:hover {\n background: ", ";\n }\n"])), COLORS.neutral_100, COLORS.neutral_600, COLORS.neutral_500);
33
+ var FooterLeftContainer = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n"])));
34
+ var FooterLeftNote = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 4px;\n\n ", "\n"])), ComponentXXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600));
35
+ var FooterLeftLink = styled.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n ", "\n a {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 4px;\n }\n"])), ComponentSStyling(ComponentTextStyle.Bold, COLORS.primary_500));
36
+ var FooterRightContainer = styled.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n gap: 8px;\n margin-left: auto;\n"])));
37
+ var Footer = styled.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n"])));
38
+ var Wrapper = styled.div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: max-content;\n\n max-height: calc(100vh - 32px);\n max-width: calc(100vw - 32px);\n\n &.medium {\n max-height: calc(100vh - 64px);\n max-width: calc(100vw - 64px);\n\n ", " {\n padding: 12px 12px 4px 12px;\n\n ", " {\n padding: 12px 0 12px 12px;\n gap: 4px;\n\n ", " {\n ", "\n }\n\n ", " {\n ", "\n }\n }\n }\n\n ", " {\n padding: 0 16px 0 24px;\n }\n\n ", " {\n padding: 12px 24px 20px 24px;\n\n ", " {\n ", "\n gap: 6px;\n }\n\n ", " {\n a {\n gap: 6px;\n }\n\n ", "\n }\n\n ", " {\n gap: 8px;\n }\n }\n }\n\n &.large {\n max-height: calc(100vh - 112px);\n max-width: calc(100vw - 112px);\n\n ", " {\n padding: 20px 20px 4px 20px;\n\n ", " {\n padding: 10px 0 10px 12px;\n gap: 8px;\n\n ", " {\n ", "\n }\n\n ", " {\n ", "\n }\n }\n }\n\n ", " {\n padding: 0 24px 0 32px;\n }\n\n ", " {\n padding: 16px 32px 32px 32px;\n\n ", " {\n ", "\n gap: 8px;\n }\n\n ", " {\n a {\n gap: 8px;\n }\n\n ", "\n }\n\n ", " {\n gap: 16px;\n }\n }\n }\n"])), Header, HeaderText, HeaderTitle, ComponentLStyling(ComponentTextStyle.Bold, null), HeaderNote, ComponentXSStyling(ComponentTextStyle.Regular, null), Content, Footer, FooterLeftNote, ComponentXSStyling(ComponentTextStyle.Bold, null), FooterLeftLink, ComponentMStyling(ComponentTextStyle.Bold, null), FooterRightContainer, Header, HeaderText, HeaderTitle, ComponentXLStyling(ComponentTextStyle.Bold, null), HeaderNote, ComponentSStyling(ComponentTextStyle.Regular, null), Content, Footer, FooterLeftNote, ComponentSStyling(ComponentTextStyle.Bold, null), FooterLeftLink, ComponentLStyling(ComponentTextStyle.Bold, null), FooterRightContainer);
39
+
40
+ var ModalContent = function ModalContent(props) {
41
+ var _props$size, _props$footerActions;
42
+
43
+ var tooltip = function tooltip() {
44
+ return !!props.tooltip && /*#__PURE__*/_jsx(TooltipWrapper, {
45
+ delay: "0s",
46
+ size: Size.XSmall,
47
+ align: "center",
48
+ position: "bottom",
49
+ withArrow: false,
50
+ label: props.tooltip,
51
+ children: /*#__PURE__*/_jsx(IconButton, {
52
+ variant: "secondary",
53
+ shape: "circular",
54
+ style: {
55
+ cursor: 'help'
56
+ },
57
+ action: function action() {},
58
+ children: /*#__PURE__*/_jsx(Help, {
59
+ size: "24px",
60
+ color: COLORS.neutral_600
61
+ })
62
+ })
63
+ });
64
+ };
65
+
66
+ var headerActions = function headerActions() {
67
+ var _props$headerActions;
68
+
69
+ return (_props$headerActions = props.headerActions) === null || _props$headerActions === void 0 ? void 0 : _props$headerActions.map(function (action, index) {
70
+ var icon = action.icon,
71
+ rest = _objectWithoutProperties(action, _excluded);
72
+
73
+ return /*#__PURE__*/_jsx(IconButton, _objectSpread(_objectSpread({}, rest), {}, {
74
+ children: icon
75
+ }), action.id || index);
76
+ });
77
+ };
78
+
79
+ var getLeftActionIconElement = function getLeftActionIconElement() {
80
+ var _props$leftFooterActi, _props$leftFooterActi2;
81
+
82
+ return !!((_props$leftFooterActi = props.leftFooterAction) !== null && _props$leftFooterActi !== void 0 && _props$leftFooterActi.icon) && /*#__PURE__*/React.cloneElement((_props$leftFooterActi2 = props.leftFooterAction) === null || _props$leftFooterActi2 === void 0 ? void 0 : _props$leftFooterActi2.icon, {
83
+ size: props.size === Size.Small ? '20px' : props.size === Size.Large ? '28px' : '24px'
84
+ });
85
+ };
86
+
87
+ var leftFooterAction = function leftFooterAction() {
88
+ if (!props.leftFooterAction) return null;
89
+
90
+ switch (props.leftFooterAction.actionType) {
91
+ case 'button':
92
+ {
93
+ var _ref = props.leftFooterAction,
94
+ text = _ref.text,
95
+ variant = _ref.variant,
96
+ action = _ref.action,
97
+ rest = _objectWithoutProperties(_ref, _excluded2);
98
+
99
+ return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, rest), {}, {
100
+ size: props.size,
101
+ onClick: action,
102
+ variant: variant !== null && variant !== void 0 ? variant : 'secondary',
103
+ children: text
104
+ }));
105
+ }
106
+
107
+ case 'hyperlink':
108
+ {
109
+ var _ref2 = props.leftFooterAction,
110
+ _text = _ref2.text,
111
+ _variant = _ref2.variant,
112
+ _action = _ref2.action,
113
+ _rest = _objectWithoutProperties(_ref2, _excluded3);
114
+
115
+ return /*#__PURE__*/_jsx(FooterLeftLink, {
116
+ children: /*#__PURE__*/_jsxs(HyperLink, _objectSpread(_objectSpread({}, _rest), {}, {
117
+ variant: _variant !== null && _variant !== void 0 ? _variant : 'default',
118
+ onClick: function onClick(e) {
119
+ if (_action) {
120
+ e.preventDefault();
121
+
122
+ _action(e);
123
+ }
124
+ },
125
+ children: [getLeftActionIconElement(), _text]
126
+ }))
127
+ });
128
+ }
129
+
130
+ case 'note':
131
+ {
132
+ var _text2 = props.leftFooterAction.text;
133
+ return /*#__PURE__*/_jsxs(FooterLeftNote, {
134
+ children: [getLeftActionIconElement(), /*#__PURE__*/_jsx("span", {
135
+ children: _text2
136
+ })]
137
+ });
138
+ }
139
+ }
140
+ };
141
+
142
+ return /*#__PURE__*/_jsx(ModalContainer, {
143
+ showModal: props.isModalOpen,
144
+ closeModal: props.closeAction,
145
+ children: /*#__PURE__*/_jsxs(Wrapper, {
146
+ className: (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : Size.Medium,
147
+ children: [/*#__PURE__*/_jsxs(Header, {
148
+ children: [/*#__PURE__*/_jsxs(HeaderText, {
149
+ children: [/*#__PURE__*/_jsx(HeaderTitle, {
150
+ children: props.title
151
+ }), !!props.note && /*#__PURE__*/_jsx(HeaderNote, {
152
+ children: props.note
153
+ })]
154
+ }), /*#__PURE__*/_jsxs(HeaderActions, {
155
+ children: [tooltip(), headerActions(), /*#__PURE__*/_jsx(IconButton, {
156
+ id: 'content-modal-close-button',
157
+ variant: "secondary",
158
+ shape: "circular",
159
+ action: props.closeAction,
160
+ children: /*#__PURE__*/_jsx(Close, {
161
+ size: "24px",
162
+ color: COLORS.neutral_600
163
+ })
164
+ })]
165
+ })]
166
+ }), /*#__PURE__*/_jsx(Content, {
167
+ children: props.children
168
+ }), /*#__PURE__*/_jsxs(Footer, {
169
+ children: [/*#__PURE__*/_jsx(FooterLeftContainer, {
170
+ children: leftFooterAction()
171
+ }), /*#__PURE__*/_jsx(FooterRightContainer, {
172
+ children: (_props$footerActions = props.footerActions) === null || _props$footerActions === void 0 ? void 0 : _props$footerActions.map(function (item, index) {
173
+ var action = item.action,
174
+ text = item.text,
175
+ rest = _objectWithoutProperties(item, _excluded4);
176
+
177
+ return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, rest), {}, {
178
+ onClick: action,
179
+ size: props.size,
180
+ onKeyDown: function onKeyDown(a) {
181
+ return (a.key === 'Enter' || a.key === ' ') && action(a);
182
+ },
183
+ children: text
184
+ }), rest.id || index);
185
+ })
186
+ })]
187
+ })]
188
+ })
189
+ });
190
+ };
191
+
192
+ ModalContent.propTypes = {
193
+ isModalOpen: _pt.bool.isRequired,
194
+ closeAction: _pt.func.isRequired,
195
+ title: _pt.string.isRequired,
196
+ note: _pt.string,
197
+ headerActions: _pt.array,
198
+ footerActions: _pt.array,
199
+ tooltip: _pt.string,
200
+ yOffset: _pt.number,
201
+ zIndex: _pt.number
202
+ };
203
+ export default ModalContent;
204
+ //# sourceMappingURL=ModalContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Modals/ModalContent.tsx"],"names":["React","Size","ModalContainer","styled","COLORS","ComponentLStyling","ComponentMStyling","ComponentSStyling","ComponentTextStyle","ComponentXLStyling","ComponentXSStyling","ComponentXXSStyling","TooltipContainer","TooltipWrapper","Button","IconButton","Close","Help","HyperLink","HeaderText","div","HeaderTitle","Bold","black","HeaderNote","Regular","neutral_600","HeaderActions","Header","Content","neutral_100","neutral_500","FooterLeftContainer","FooterLeftNote","FooterLeftLink","primary_500","FooterRightContainer","Footer","Wrapper","ModalContent","props","tooltip","XSmall","cursor","headerActions","map","action","index","icon","rest","id","getLeftActionIconElement","leftFooterAction","cloneElement","size","Small","Large","actionType","text","variant","e","preventDefault","isModalOpen","closeAction","Medium","title","note","children","footerActions","item","a","key","yOffset","zIndex"],"mappings":";;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAQC,IAAR,QAAmB,UAAnB;AAEA,SAAQC,cAAR,QAA6B,SAA7B;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SACEC,MADF,EAEEC,iBAFF,EAGEC,iBAHF,EAGqBC,iBAHrB,EAIEC,kBAJF,EAIsBC,kBAJtB,EAKEC,kBALF,EAMEC,mBANF,QAOO,WAPP;AAQA,SAAQC,gBAAR,EAA0BC,cAA1B,QAA+C,aAA/C;AACA,SAAQC,MAAR,EAAgBC,UAAhB,QAAiC,WAAjC;AACA,SAAQC,KAAR,EAAeC,IAAf,QAA0B,kCAA1B;AACA,SAAQC,SAAR,QAAwB,cAAxB;;;AAEA,IAAMC,UAAU,GAAGhB,MAAM,CAACiB,GAAV,wMAAhB;AASA,IAAMC,WAAW,GAAGlB,MAAM,CAACiB,GAAV,kFACbd,iBA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CAAP;AAOD,WATF;AADH,UAJF;AAAA,QAlBF;AAAA;AADF,IADF;AAyCD,CAxHD;;;AAZEe,EAAAA,W;AACAC,EAAAA,W;AACAE,EAAAA,K;AACAC,EAAAA,I;AACAtB,EAAAA,a;AACAwB,EAAAA,a;AAEA3B,EAAAA,O;AACA+B,EAAAA,O;AACAC,EAAAA,M;;AA6HF,eAAelC,YAAf","sourcesContent":["import React from 'react';\nimport {Size} from '../types';\nimport {ButtonAction, IconButtonAction, LeftFooterAction, LeftFooterButton, LeftFooterHyperlink} from './ModalTypes';\nimport {ModalContainer} from './index';\nimport styled from 'styled-components';\nimport {\n COLORS,\n ComponentLStyling,\n ComponentMStyling, ComponentSStyling,\n ComponentTextStyle, ComponentXLStyling,\n ComponentXSStyling,\n ComponentXXSStyling\n} from '../styles';\nimport {TooltipContainer, TooltipWrapper} from '../Tooltips';\nimport {Button, IconButton} from '../Button';\nimport {Close, Help} from '../icons/systemicons/SystemIcons';\nimport {HyperLink} from '../HyperLink';\n\nconst HeaderText = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: center;\n\n padding: 12px 0 12px 12px;\n gap: 4px\n`;\nconst HeaderTitle = styled.div`\n ${ComponentMStyling(ComponentTextStyle.Bold, COLORS.black)}\n`;\nconst HeaderNote = styled.div`\n ${ComponentXXSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n`;\n\nconst HeaderActions = styled.div`\n display: flex;\n flex-direction: row;\n`;\n\nconst Header = styled.div`\n display: flex;\n flex-direction: row;\n padding: 4px;\n\n ${TooltipContainer} {\n height: max-content;\n }\n`;\n\nconst Content = styled.div`\n margin-right: 8px;\n padding: 0 8px 0 16px;\n overflow: auto;\n\n /* width */\n\n ::-webkit-scrollbar {\n width: 4px;\n cursor: pointer;\n }\n\n /* Track */\n\n ::-webkit-scrollbar-track {\n background: ${COLORS.neutral_100};\n border-radius: 8px;\n }\n\n /* Handle */\n\n ::-webkit-scrollbar-thumb {\n background: ${COLORS.neutral_600};\n border-radius: 8px;\n }\n\n /* Handle on hover */\n\n ::-webkit-scrollbar-thumb:hover {\n background: ${COLORS.neutral_500};\n }\n`;\n\nconst FooterLeftContainer = styled.div`\n display: flex;\n align-items: center;\n`;\n\nconst FooterLeftNote = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 4px;\n\n ${ComponentXXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n`;\n\nconst FooterLeftLink = styled.div`\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.primary_500)}\n a {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 4px;\n }\n`;\n\nconst FooterRightContainer = styled.div`\n gap: 8px;\n margin-left: auto;\n`\n\nconst Footer = styled.div`\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n`;\n\n\nconst Wrapper = styled.div`\n display: flex;\n flex-direction: column;\n width: max-content;\n\n max-height: calc(100vh - 32px);\n max-width: calc(100vw - 32px);\n\n &.medium {\n max-height: calc(100vh - 64px);\n max-width: calc(100vw - 64px);\n\n ${Header} {\n padding: 12px 12px 4px 12px;\n\n ${HeaderText} {\n padding: 12px 0 12px 12px;\n gap: 4px;\n\n ${HeaderTitle} {\n ${ComponentLStyling(ComponentTextStyle.Bold, null)}\n }\n\n ${HeaderNote} {\n ${ComponentXSStyling(ComponentTextStyle.Regular, null)}\n }\n }\n }\n\n ${Content} {\n padding: 0 16px 0 24px;\n }\n\n ${Footer} {\n padding: 12px 24px 20px 24px;\n\n ${FooterLeftNote} {\n ${ComponentXSStyling(ComponentTextStyle.Bold, null)}\n gap: 6px;\n }\n\n ${FooterLeftLink} {\n a {\n gap: 6px;\n }\n\n ${ComponentMStyling(ComponentTextStyle.Bold, null)}\n }\n\n ${FooterRightContainer} {\n gap: 8px;\n }\n }\n }\n\n &.large {\n max-height: calc(100vh - 112px);\n max-width: calc(100vw - 112px);\n\n ${Header} {\n padding: 20px 20px 4px 20px;\n\n ${HeaderText} {\n padding: 10px 0 10px 12px;\n gap: 8px;\n\n ${HeaderTitle} {\n ${ComponentXLStyling(ComponentTextStyle.Bold, null)}\n }\n\n ${HeaderNote} {\n ${ComponentSStyling(ComponentTextStyle.Regular, null)}\n }\n }\n }\n\n ${Content} {\n padding: 0 24px 0 32px;\n }\n\n ${Footer} {\n padding: 16px 32px 32px 32px;\n\n ${FooterLeftNote} {\n ${ComponentSStyling(ComponentTextStyle.Bold, null)}\n gap: 8px;\n }\n\n ${FooterLeftLink} {\n a {\n gap: 8px;\n }\n\n ${ComponentLStyling(ComponentTextStyle.Bold, null)}\n }\n\n ${FooterRightContainer} {\n gap: 16px;\n }\n }\n }\n`;\n\n\ninterface ModalContentProps {\n size?: Size.Small | Size.Medium | Size.Large;\n isModalOpen: boolean;\n closeAction: () => void;\n title: string;\n note?: string;\n headerActions?: IconButtonAction[];\n footerActions?: ButtonAction[];\n leftFooterAction?: LeftFooterAction;\n tooltip?: string;\n yOffset?: number;\n zIndex?: number;\n}\n\nconst ModalContent: React.FC<ModalContentProps> = (props) => {\n\n const tooltip = () =>\n !!props.tooltip &&\n <TooltipWrapper delay=\"0s\" size={Size.XSmall} align=\"center\" position=\"bottom\" withArrow={false}\n label={props.tooltip}>\n <IconButton variant=\"secondary\" shape=\"circular\" style={{cursor: 'help'}} action={() => {\n }}>\n <Help size=\"24px\" color={COLORS.neutral_600}/>\n </IconButton>\n </TooltipWrapper>;\n\n const headerActions = () => props.headerActions?.map((action, index) => {\n const {icon, ...rest} = action;\n return <IconButton key={action.id || index}\n {...rest}>\n {icon}\n </IconButton>\n }\n );\n\n const getLeftActionIconElement = () =>\n !!props.leftFooterAction?.icon &&\n React.cloneElement(props.leftFooterAction?.icon as React.ReactElement, {\n size:\n props.size === Size.Small\n ? '20px'\n : props.size === Size.Large\n ? '28px'\n : '24px'\n });\n\n const leftFooterAction = () => {\n if (!props.leftFooterAction) return null;\n\n switch (props.leftFooterAction.actionType) {\n case 'button': {\n const {text, variant, action, ...rest} = props.leftFooterAction as LeftFooterButton;\n return (\n <Button{...rest}\n size={props.size}\n onClick={action}\n variant={variant ?? 'secondary'}>\n {text}\n </Button>\n );\n }\n case 'hyperlink': {\n const {text, variant, action, ...rest} = props.leftFooterAction as LeftFooterHyperlink;\n return (\n <FooterLeftLink>\n <HyperLink {...rest}\n variant={variant ?? 'default'}\n onClick={(e) => {\n if (action) {\n e.preventDefault();\n action(e);\n }\n }}>\n {getLeftActionIconElement()}\n {text}\n </HyperLink>\n </FooterLeftLink>\n );\n\n }\n case 'note': {\n const {text} = props.leftFooterAction;\n return (\n <FooterLeftNote>\n {getLeftActionIconElement()}\n <span>{text}</span>\n </FooterLeftNote>\n );\n }\n }\n };\n\n\n return (\n <ModalContainer showModal={props.isModalOpen} closeModal={props.closeAction}>\n <Wrapper className={props.size ?? Size.Medium}>\n <Header>\n <HeaderText>\n <HeaderTitle>{props.title}</HeaderTitle>\n {!!props.note && <HeaderNote>{props.note}</HeaderNote>}\n </HeaderText>\n <HeaderActions>\n {tooltip()}\n {headerActions()}\n <IconButton id={'content-modal-close-button'} variant=\"secondary\" shape=\"circular\"\n action={props.closeAction}>\n <Close size=\"24px\" color={COLORS.neutral_600}/>\n </IconButton>\n </HeaderActions>\n </Header>\n <Content>\n {props.children}\n </Content>\n <Footer>\n <FooterLeftContainer>\n {leftFooterAction()}\n </FooterLeftContainer>\n <FooterRightContainer>\n {props.footerActions?.map((item, index) => {\n const {action, text, ...rest} = item;\n return <Button key={rest.id || index}\n {...rest}\n onClick={action}\n size={props.size}\n onKeyDown={a => (a.key === 'Enter' || a.key === ' ') && action!(a)}>\n {text}\n </Button>\n }\n )}\n </FooterRightContainer>\n </Footer>\n </Wrapper>\n </ModalContainer>\n );\n};\n\nexport default ModalContent;\n"],"file":"ModalContent.js"}
@@ -1,5 +1,10 @@
1
1
  import { ButtonProps } from '../Button/Button';
2
2
  import { HyperlinkProps } from '../HyperLink/HyperLink';
3
+ import { IconButtonProps } from '../Button/Iconbutton';
4
+ import React from 'react';
5
+ export interface IconButtonAction extends Pick<IconButtonProps, 'variant' | 'id' | 'shape' | 'disabled' | 'action'> {
6
+ icon: React.ReactNode;
7
+ }
3
8
  export interface ButtonAction extends Pick<ButtonProps, 'variant' | 'id' | 'loading' | 'disabled' | 'icon' | 'type'> {
4
9
  action?: (() => void) | ((e: any) => void);
5
10
  text: string;
@@ -31,6 +31,12 @@ Object.defineProperty(exports, "ModalContainer", {
31
31
  return _ModalContainer.default;
32
32
  }
33
33
  });
34
+ Object.defineProperty(exports, "ModalContent", {
35
+ enumerable: true,
36
+ get: function get() {
37
+ return _ModalContent.default;
38
+ }
39
+ });
34
40
  Object.defineProperty(exports, "ModalDialog", {
35
41
  enumerable: true,
36
42
  get: function get() {
@@ -64,6 +70,8 @@ var _ModalStyles = require("./ModalStyles");
64
70
 
65
71
  var _ModalDialog = _interopRequireDefault(require("./ModalDialog"));
66
72
 
73
+ var _ModalContent = _interopRequireDefault(require("./ModalContent"));
74
+
67
75
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
68
76
 
69
77
  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; }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Modals/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA","sourcesContent":["import Modal, { ModalCloseButton } from './Modal';\nimport ModalContainer from './ModalContainer';\nimport { ModalHeader, ModalTitle, ModalBody, ModalFooter } from './ModalStyles';\nimport ModalDialog from './ModalDialog';\n\nexport { Modal, ModalContainer, ModalHeader, ModalBody, ModalFooter, ModalTitle, ModalCloseButton, ModalDialog };\n\nexport type {LeftFooterAction, LeftFooterHyperlink, LeftFooterActionBase, LeftFooterButton} from './ModalTypes';\n"],"file":"index.cjs"}
1
+ {"version":3,"sources":["../../src/Modals/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["import Modal, { ModalCloseButton } from './Modal';\nimport ModalContainer from './ModalContainer';\nimport { ModalHeader, ModalTitle, ModalBody, ModalFooter } from './ModalStyles';\nimport ModalDialog from './ModalDialog';\nimport ModalContent from './ModalContent';\n\nexport { Modal, ModalContainer, ModalHeader, ModalBody, ModalFooter, ModalTitle, ModalCloseButton, ModalDialog, ModalContent };\n\nexport type {LeftFooterAction, LeftFooterHyperlink, LeftFooterActionBase, LeftFooterButton, IconButtonAction} from './ModalTypes';\n"],"file":"index.cjs"}
@@ -2,5 +2,6 @@ import Modal, { ModalCloseButton } from './Modal';
2
2
  import ModalContainer from './ModalContainer';
3
3
  import { ModalHeader, ModalTitle, ModalBody, ModalFooter } from './ModalStyles';
4
4
  import ModalDialog from './ModalDialog';
5
- export { Modal, ModalContainer, ModalHeader, ModalBody, ModalFooter, ModalTitle, ModalCloseButton, ModalDialog };
6
- export type { LeftFooterAction, LeftFooterHyperlink, LeftFooterActionBase, LeftFooterButton } from './ModalTypes';
5
+ import ModalContent from './ModalContent';
6
+ export { Modal, ModalContainer, ModalHeader, ModalBody, ModalFooter, ModalTitle, ModalCloseButton, ModalDialog, ModalContent };
7
+ export type { LeftFooterAction, LeftFooterHyperlink, LeftFooterActionBase, LeftFooterButton, IconButtonAction } from './ModalTypes';
@@ -2,5 +2,6 @@ import Modal, { ModalCloseButton } from './Modal';
2
2
  import ModalContainer from './ModalContainer';
3
3
  import { ModalHeader, ModalTitle, ModalBody, ModalFooter } from './ModalStyles';
4
4
  import ModalDialog from './ModalDialog';
5
- export { Modal, ModalContainer, ModalHeader, ModalBody, ModalFooter, ModalTitle, ModalCloseButton, ModalDialog };
5
+ import ModalContent from './ModalContent';
6
+ export { Modal, ModalContainer, ModalHeader, ModalBody, ModalFooter, ModalTitle, ModalCloseButton, ModalDialog, ModalContent };
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Modals/index.tsx"],"names":["Modal","ModalCloseButton","ModalContainer","ModalHeader","ModalTitle","ModalBody","ModalFooter","ModalDialog"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,gBAAhB,QAAwC,SAAxC;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,SAASC,WAAT,EAAsBC,UAAtB,EAAkCC,SAAlC,EAA6CC,WAA7C,QAAgE,eAAhE;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAEA,SAASP,KAAT,EAAgBE,cAAhB,EAAgCC,WAAhC,EAA6CE,SAA7C,EAAwDC,WAAxD,EAAqEF,UAArE,EAAiFH,gBAAjF,EAAmGM,WAAnG","sourcesContent":["import Modal, { ModalCloseButton } from './Modal';\nimport ModalContainer from './ModalContainer';\nimport { ModalHeader, ModalTitle, ModalBody, ModalFooter } from './ModalStyles';\nimport ModalDialog from './ModalDialog';\n\nexport { Modal, ModalContainer, ModalHeader, ModalBody, ModalFooter, ModalTitle, ModalCloseButton, ModalDialog };\n\nexport type {LeftFooterAction, LeftFooterHyperlink, LeftFooterActionBase, LeftFooterButton} from './ModalTypes';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/Modals/index.tsx"],"names":["Modal","ModalCloseButton","ModalContainer","ModalHeader","ModalTitle","ModalBody","ModalFooter","ModalDialog","ModalContent"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,gBAAhB,QAAwC,SAAxC;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,SAASC,WAAT,EAAsBC,UAAtB,EAAkCC,SAAlC,EAA6CC,WAA7C,QAAgE,eAAhE;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AAEA,SAASR,KAAT,EAAgBE,cAAhB,EAAgCC,WAAhC,EAA6CE,SAA7C,EAAwDC,WAAxD,EAAqEF,UAArE,EAAiFH,gBAAjF,EAAmGM,WAAnG,EAAgHC,YAAhH","sourcesContent":["import Modal, { ModalCloseButton } from './Modal';\nimport ModalContainer from './ModalContainer';\nimport { ModalHeader, ModalTitle, ModalBody, ModalFooter } from './ModalStyles';\nimport ModalDialog from './ModalDialog';\nimport ModalContent from './ModalContent';\n\nexport { Modal, ModalContainer, ModalHeader, ModalBody, ModalFooter, ModalTitle, ModalCloseButton, ModalDialog, ModalContent };\n\nexport type {LeftFooterAction, LeftFooterHyperlink, LeftFooterActionBase, LeftFooterButton, IconButtonAction} from './ModalTypes';\n"],"file":"index.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laerdal/life-react-components",
3
- "version": "1.6.0-dev.6.full",
3
+ "version": "1.6.0-dev.8",
4
4
  "private": false,
5
5
  "author": "Thomas Kalve <thomas.kalve@laerdal.com>",
6
6
  "contributors": [