@laerdal/life-react-components 1.5.1-dev.9 → 1.6.1-dev.1
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/Button/Iconbutton.cjs +12 -13
- package/dist/Button/Iconbutton.cjs.map +1 -1
- package/dist/Button/Iconbutton.js +12 -13
- package/dist/Button/Iconbutton.js.map +1 -1
- package/dist/Card/Card.cjs +101 -0
- package/dist/Card/Card.cjs.map +1 -0
- package/dist/Card/Card.d.ts +23 -0
- package/dist/Card/Card.js +74 -0
- package/dist/Card/Card.js.map +1 -0
- package/dist/Card/CardBottomSection.cjs +133 -0
- package/dist/Card/CardBottomSection.cjs.map +1 -0
- package/dist/Card/CardBottomSection.d.ts +22 -0
- package/dist/Card/CardBottomSection.js +105 -0
- package/dist/Card/CardBottomSection.js.map +1 -0
- package/dist/Card/CardMiddleSection.cjs +94 -0
- package/dist/Card/CardMiddleSection.cjs.map +1 -0
- package/dist/Card/CardMiddleSection.d.ts +14 -0
- package/dist/Card/CardMiddleSection.js +71 -0
- package/dist/Card/CardMiddleSection.js.map +1 -0
- package/dist/Card/CardTopSection.cjs +112 -0
- package/dist/Card/CardTopSection.cjs.map +1 -0
- package/dist/Card/CardTopSection.d.ts +19 -0
- package/dist/Card/CardTopSection.js +85 -0
- package/dist/Card/CardTopSection.js.map +1 -0
- package/dist/Card/index.cjs +52 -0
- package/dist/Card/index.cjs.map +1 -0
- package/dist/Card/index.d.ts +5 -0
- package/dist/Card/index.js +6 -0
- package/dist/Card/index.js.map +1 -0
- package/dist/Dropdown/BasicDropdown.cjs +38 -55
- package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
- package/dist/Dropdown/BasicDropdown.js +36 -53
- package/dist/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/Dropdown/CommonStyling.cjs +9 -17
- package/dist/Dropdown/CommonStyling.cjs.map +1 -1
- package/dist/Dropdown/CommonStyling.d.ts +0 -3
- package/dist/Dropdown/CommonStyling.js +8 -12
- package/dist/Dropdown/CommonStyling.js.map +1 -1
- package/dist/Dropdown/DropdownButton.cjs +11 -24
- package/dist/Dropdown/DropdownButton.cjs.map +1 -1
- package/dist/Dropdown/DropdownButton.js +11 -24
- package/dist/Dropdown/DropdownButton.js.map +1 -1
- package/dist/Dropdown/DropdownContent.cjs +21 -12
- package/dist/Dropdown/DropdownContent.cjs.map +1 -1
- package/dist/Dropdown/DropdownContent.js +21 -12
- package/dist/Dropdown/DropdownContent.js.map +1 -1
- package/dist/Dropdown/DropdownFilter.cjs +43 -46
- package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
- package/dist/Dropdown/DropdownFilter.js +41 -45
- package/dist/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/LinearProgress/LinearProgress.cjs +142 -0
- package/dist/LinearProgress/LinearProgress.cjs.map +1 -0
- package/dist/LinearProgress/LinearProgress.d.ts +25 -0
- package/dist/LinearProgress/LinearProgress.js +111 -0
- package/dist/LinearProgress/LinearProgress.js.map +1 -0
- package/dist/LinearProgress/index.cjs +32 -0
- package/dist/LinearProgress/index.cjs.map +1 -0
- package/dist/LinearProgress/index.d.ts +3 -0
- package/dist/LinearProgress/index.js +4 -0
- package/dist/LinearProgress/index.js.map +1 -0
- package/dist/Modals/ModalContainer.cjs +8 -3
- package/dist/Modals/ModalContainer.cjs.map +1 -1
- package/dist/Modals/ModalContainer.d.ts +1 -0
- package/dist/Modals/ModalContainer.js +8 -3
- package/dist/Modals/ModalContainer.js.map +1 -1
- package/dist/Modals/ModalDialog.cjs +5 -2
- package/dist/Modals/ModalDialog.cjs.map +1 -1
- package/dist/Modals/ModalDialog.d.ts +1 -0
- package/dist/Modals/ModalDialog.js +5 -2
- package/dist/Modals/ModalDialog.js.map +1 -1
- package/dist/SegmentControl/SegmentControl.cjs +99 -0
- package/dist/SegmentControl/SegmentControl.cjs.map +1 -0
- package/dist/SegmentControl/SegmentControl.d.ts +19 -0
- package/dist/SegmentControl/SegmentControl.js +71 -0
- package/dist/SegmentControl/SegmentControl.js.map +1 -0
- package/dist/SegmentControl/index.cjs +16 -0
- package/dist/SegmentControl/index.cjs.map +1 -0
- package/dist/SegmentControl/index.d.ts +3 -0
- package/dist/SegmentControl/index.js +3 -0
- package/dist/SegmentControl/index.js.map +1 -0
- package/dist/Table/TableFooter.cjs +1 -1
- package/dist/Table/TableFooter.cjs.map +1 -1
- package/dist/Table/TableFooter.js +1 -1
- package/dist/Table/TableFooter.js.map +1 -1
- package/dist/Table/TableStyles.cjs +1 -1
- package/dist/Table/TableStyles.cjs.map +1 -1
- package/dist/Table/TableStyles.js +1 -1
- package/dist/Table/TableStyles.js.map +1 -1
- package/dist/Tag/Tag.cjs +95 -0
- package/dist/Tag/Tag.cjs.map +1 -0
- package/dist/Tag/Tag.d.ts +9 -0
- package/dist/Tag/Tag.js +73 -0
- package/dist/Tag/Tag.js.map +1 -0
- package/dist/Tag/index.cjs +16 -0
- package/dist/Tag/index.cjs.map +1 -0
- package/dist/Tag/index.d.ts +2 -0
- package/dist/Tag/index.js +2 -0
- package/dist/Tag/index.js.map +1 -0
- package/dist/common/InputStyling.cjs +1 -1
- package/dist/common/InputStyling.cjs.map +1 -1
- package/dist/common/InputStyling.js +1 -1
- package/dist/common/InputStyling.js.map +1 -1
- package/dist/index.cjs +99 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var React = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
|
+
|
|
20
|
+
var _ = require("..");
|
|
21
|
+
|
|
22
|
+
var _Button = require("../Button");
|
|
23
|
+
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
|
|
26
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
27
|
+
|
|
28
|
+
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); }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
var ProgressContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n padding: 8px 0;\n"])));
|
|
33
|
+
|
|
34
|
+
var NotesContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n height: 48px;\n position: relative;\n color: ", ";\n display: flex;\n flex-direction: row;\n align-items: center;\n"])), _.COLORS.neutral_500);
|
|
35
|
+
|
|
36
|
+
var AuthorContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n align-items: center;\n height: 48px;\n\n div:first-child {\n flex-grow: 2;\n }\n\n svg, img {\n width: 80px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n\n ", "\n"])), function (props) {
|
|
37
|
+
return props.disabled ? "\n color: ".concat(_.COLORS.neutral_300, ";\n svg, img {\n filter: grayscale(100%);\n }\n \n ") : '';
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
var Divider = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n border-top: 1px;\n border-top-color: ", ";\n border-top-style: solid;\n width: 100%;\n"])), _.COLORS.neutral_100);
|
|
41
|
+
|
|
42
|
+
var NoteLeft = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n left: 0px;\n display: flex;\n flex-direction: row;\n align-items: center;\n\n svg {\n margin-right: 4px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n"])));
|
|
43
|
+
|
|
44
|
+
var NoteRight = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n right: 0px;\n display: flex;\n flex-direction: row;\n align-items: center;\n\n svg {\n margin-right: 4px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n"])));
|
|
45
|
+
|
|
46
|
+
var ButtonRowContainer = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-items: center;\n border-top: 1px;\n border-top-color: ", ";\n border-top-style: solid;\n\n button:last-child{\n margin: 8px 0px 0px 0px;\n }\n\n button:not(:last-child) {\n margin: 8px 0px 0px 0px;\n }\n\n svg {\n color: ", ";\n }\n"])), _.COLORS.neutral_100, _.COLORS.neutral_600);
|
|
47
|
+
|
|
48
|
+
var Container = _styledComponents.default.div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n padding: 0px 16px 8px 16px;\n width: calc(100% - 32px);\n cursor: ", ";\n\n ", " {\n ", "\n }\n"])), function (props) {
|
|
49
|
+
return props.disabled ? 'not-allowed' : 'pointer';
|
|
50
|
+
}, ButtonRowContainer, function (props) {
|
|
51
|
+
return props.interactionType == _.InteractionType.Clickable ? "cursor: ".concat(props.disabled ? 'not-allowed' : 'auto', ";") : '';
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
var CardBottomSection = function CardBottomSection(_ref) {
|
|
55
|
+
var interactionType = _ref.interactionType,
|
|
56
|
+
progressLevel = _ref.progressLevel,
|
|
57
|
+
progressMax = _ref.progressMax,
|
|
58
|
+
_ref$progressType = _ref.progressType,
|
|
59
|
+
progressType = _ref$progressType === void 0 ? _.LinearProgressType.Line : _ref$progressType,
|
|
60
|
+
noteLeft = _ref.noteLeft,
|
|
61
|
+
noteLeftIcon = _ref.noteLeftIcon,
|
|
62
|
+
noteRight = _ref.noteRight,
|
|
63
|
+
noteRightIcon = _ref.noteRightIcon,
|
|
64
|
+
authorName = _ref.authorName,
|
|
65
|
+
logo = _ref.logo,
|
|
66
|
+
actions = _ref.actions,
|
|
67
|
+
disabled = _ref.disabled;
|
|
68
|
+
var haveAtLeastSomething = progressLevel != undefined || noteLeft || noteLeftIcon || noteRight || noteRightIcon || authorName;
|
|
69
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
70
|
+
disabled: disabled,
|
|
71
|
+
interactionType: interactionType,
|
|
72
|
+
children: [haveAtLeastSomething && /*#__PURE__*/(0, _jsxRuntime.jsx)(Divider, {}), progressLevel != undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(ProgressContainer, {
|
|
73
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.LinearProgress, {
|
|
74
|
+
size: _.Size.Small,
|
|
75
|
+
type: progressType,
|
|
76
|
+
variant: _.LinearProgressVariant.Normal,
|
|
77
|
+
value: progressLevel,
|
|
78
|
+
max: progressMax !== null && progressMax !== void 0 ? progressMax : progressLevel
|
|
79
|
+
})
|
|
80
|
+
}), (noteLeft || noteLeftIcon || noteRight || noteRightIcon) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(NotesContainer, {
|
|
81
|
+
children: [(noteLeft || noteLeftIcon) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(NoteLeft, {
|
|
82
|
+
children: [noteLeftIcon, /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ComponentXXS, {
|
|
83
|
+
color: _.COLORS.neutral_500,
|
|
84
|
+
textStyle: _.ComponentTextStyle.Bold,
|
|
85
|
+
children: noteLeft
|
|
86
|
+
})]
|
|
87
|
+
}), (noteRight || noteRightIcon) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(NoteRight, {
|
|
88
|
+
children: [noteRightIcon, /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ComponentXXS, {
|
|
89
|
+
color: _.COLORS.neutral_500,
|
|
90
|
+
textStyle: _.ComponentTextStyle.Bold,
|
|
91
|
+
children: noteRight
|
|
92
|
+
})]
|
|
93
|
+
})]
|
|
94
|
+
}), (authorName || logo) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(AuthorContainer, {
|
|
95
|
+
disabled: disabled,
|
|
96
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.ComponentXXS, {
|
|
97
|
+
children: authorName
|
|
98
|
+
}), logo]
|
|
99
|
+
}), actions && /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonRowContainer, {
|
|
100
|
+
children: actions.map(function (x) {
|
|
101
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
|
102
|
+
disabled: disabled,
|
|
103
|
+
variant: "secondary",
|
|
104
|
+
shape: "circular",
|
|
105
|
+
action: function action(e) {
|
|
106
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
107
|
+
x.onClick();
|
|
108
|
+
},
|
|
109
|
+
children: x.icon
|
|
110
|
+
});
|
|
111
|
+
})
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
CardBottomSection.propTypes = {
|
|
117
|
+
progressLevel: _propTypes.default.number,
|
|
118
|
+
progressMax: _propTypes.default.number,
|
|
119
|
+
noteLeft: _propTypes.default.string,
|
|
120
|
+
noteLeftIcon: _propTypes.default.node,
|
|
121
|
+
noteRight: _propTypes.default.string,
|
|
122
|
+
noteRightIcon: _propTypes.default.node,
|
|
123
|
+
authorName: _propTypes.default.string,
|
|
124
|
+
actions: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
125
|
+
icon: _propTypes.default.node.isRequired,
|
|
126
|
+
onClick: _propTypes.default.func.isRequired
|
|
127
|
+
})),
|
|
128
|
+
logo: _propTypes.default.node,
|
|
129
|
+
disabled: _propTypes.default.bool.isRequired
|
|
130
|
+
};
|
|
131
|
+
var _default = CardBottomSection;
|
|
132
|
+
exports.default = _default;
|
|
133
|
+
//# sourceMappingURL=CardBottomSection.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Card/CardBottomSection.tsx"],"names":["ProgressContainer","styled","div","NotesContainer","COLORS","neutral_500","AuthorContainer","props","disabled","neutral_300","Divider","neutral_100","NoteLeft","NoteRight","ButtonRowContainer","neutral_600","Container","interactionType","InteractionType","Clickable","CardBottomSection","progressLevel","progressMax","progressType","LinearProgressType","Line","noteLeft","noteLeftIcon","noteRight","noteRightIcon","authorName","logo","actions","haveAtLeastSomething","undefined","Size","Small","LinearProgressVariant","Normal","ComponentTextStyle","Bold","map","x","e","stopPropagation","onClick","icon"],"mappings":";;;;;;;;;;;;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A,SAAS,EAAEkC,qBAAmBC,IAAvE;AAAA,oBAA8EZ;AAA9E,UAFF;AAAA,QARyD;AAAA,MAV/D,EAyBG,CAACE,UAAU,IAAIC,IAAf,kBAAwB,sBAAC,eAAD;AAAiB,MAAA,QAAQ,EAAEvB,QAA3B;AAAA,8BACvB,qBAAC,cAAD;AAAA,kBAAesB;AAAf,QADuB,EAEtBC,IAFsB;AAAA,MAzB3B,EA8BGC,OAAO,iBAAI,qBAAC,kBAAD;AAAA,gBACTA,OAAO,CAACS,GAAR,CAAY,UAAAC,CAAC;AAAA,4BACZ,qBAAC,kBAAD;AAAY,UAAA,QAAQ,EAAElC,QAAtB;AAAgC,UAAA,OAAO,EAAC,WAAxC;AAAoD,UAAA,KAAK,EAAC,UAA1D;AAAqE,UAAA,MAAM,EAAE,gBAACmC,CAAD,EAAO;AAACA,YAAAA,CAAC,SAAD,IAAAA,CAAC,WAAD,YAAAA,CAAC,CAAEC,eAAH;AAAsBF,YAAAA,CAAC,CAACG,OAAF;AAAa,WAAxH;AAAA,oBACGH,CAAC,CAACI;AADL,UADY;AAAA,OAAb;AADS,MA9Bd;AAAA,IADF;AAwCD,CAxDD;;;AAzHEzB,EAAAA,a;AACAC,EAAAA,W;AAGAI,EAAAA,Q;AACAC,EAAAA,Y;AACAC,EAAAA,S;AACAC,EAAAA,a;AAEAC,EAAAA,U;AACAE,EAAAA,O;AAhBAc,IAAAA,I;AACAD,IAAAA,O;;AAgBAd,EAAAA,I;AACAvB,EAAAA,Q;;eAuKaY,iB","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { COLORS, ComponentTextStyle, ComponentXXS, InteractionType, LinearProgress, LinearProgressType, LinearProgressVariant, Size } from '..';\nimport { LaerdalLogo } from '../assets';\nimport { IconButton } from '../Button';\n\nexport interface ActionItem {\n icon: React.ReactNode;\n onClick: () => void;\n}\n\nexport interface CardBottomSectionProps {\n interactionType: InteractionType;\n progressLevel?: number;\n progressMax?: number;\n progressType?: LinearProgressType;\n\n noteLeft?: string;\n noteLeftIcon?: React.ReactNode;\n noteRight?: string;\n noteRightIcon?: React.ReactNode;\n \n authorName?: string;\n actions?: ActionItem[];\n logo?: React.ReactNode;\n disabled: boolean;\n}\n\nconst ProgressContainer = styled.div`\n padding: 8px 0;\n`;\n\nconst NotesContainer = styled.div`\n height: 48px;\n position: relative;\n color: ${COLORS.neutral_500};\n display: flex;\n flex-direction: row;\n align-items: center;\n`;\n\nconst AuthorContainer = styled.div<{disabled: boolean}>`\n display: flex;\n flex-direction: row;\n align-items: center;\n height: 48px;\n\n div:first-child {\n flex-grow: 2;\n }\n\n svg, img {\n width: 80px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n\n ${props => props.disabled ? `\n color: ${COLORS.neutral_300};\n svg, img {\n filter: grayscale(100%);\n }\n \n ` : ''}\n`;\n\nconst Divider = styled.div`\n border-top: 1px;\n border-top-color: ${COLORS.neutral_100};\n border-top-style: solid;\n width: 100%;\n`;\n\nconst NoteLeft = styled.div`\n position: absolute;\n left: 0px;\n display: flex;\n flex-direction: row;\n align-items: center;\n\n svg {\n margin-right: 4px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n`;\n\nconst NoteRight = styled.div`\n position: absolute;\n right: 0px;\n display: flex;\n flex-direction: row;\n align-items: center;\n\n svg {\n margin-right: 4px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n`;\n\nconst ButtonRowContainer = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-items: center;\n border-top: 1px;\n border-top-color: ${COLORS.neutral_100};\n border-top-style: solid;\n\n button:last-child{\n margin: 8px 0px 0px 0px;\n }\n\n button:not(:last-child) {\n margin: 8px 0px 0px 0px;\n }\n\n svg {\n color: ${COLORS.neutral_600};\n }\n`;\n\nconst Container = styled.div<{interactionType: InteractionType; disabled: boolean}>`\n padding: 0px 16px 8px 16px;\n width: calc(100% - 32px);\n cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};\n\n ${ButtonRowContainer} {\n ${props => props.interactionType == InteractionType.Clickable ? \n `cursor: ${props.disabled ? 'not-allowed' : 'auto'};` : ''}\n }\n`;\n\nconst CardBottomSection: React.FunctionComponent<CardBottomSectionProps> = ({\n interactionType,\n progressLevel,\n progressMax,\n progressType = LinearProgressType.Line,\n noteLeft,\n noteLeftIcon,\n noteRight,\n noteRightIcon,\n authorName,\n logo,\n actions,\n disabled\n}: CardBottomSectionProps) => {\n\n const haveAtLeastSomething = progressLevel != undefined || noteLeft || noteLeftIcon || noteRight || noteRightIcon || authorName;\n return (\n <Container disabled={disabled} interactionType={interactionType}>\n {haveAtLeastSomething && <Divider />}\n {progressLevel != undefined && <ProgressContainer>\n <LinearProgress size={Size.Small}\n type={progressType}\n variant={LinearProgressVariant.Normal}\n value={progressLevel}\n max={progressMax ?? progressLevel} />\n </ProgressContainer>}\n\n {(noteLeft || noteLeftIcon || noteRight || noteRightIcon) && <NotesContainer>\n {(noteLeft || noteLeftIcon) && (\n <NoteLeft>\n {noteLeftIcon}\n <ComponentXXS color={COLORS.neutral_500} textStyle={ComponentTextStyle.Bold}>{noteLeft}</ComponentXXS>\n </NoteLeft>\n )}\n {(noteRight || noteRightIcon) && (\n <NoteRight>\n {noteRightIcon}\n <ComponentXXS color={COLORS.neutral_500} textStyle={ComponentTextStyle.Bold}>{noteRight}</ComponentXXS>\n </NoteRight>\n )}\n </NotesContainer>}\n\n {(authorName || logo) && <AuthorContainer disabled={disabled}>\n <ComponentXXS>{authorName}</ComponentXXS>\n {logo}\n </AuthorContainer>}\n\n {actions && <ButtonRowContainer>\n {actions.map(x => (\n <IconButton disabled={disabled} variant=\"secondary\" shape=\"circular\" action={(e) => {e?.stopPropagation(); x.onClick();}}>\n {x.icon}\n </IconButton>\n ))}\n </ButtonRowContainer>}\n </Container>\n );\n};\n\nexport default CardBottomSection;\n"],"file":"CardBottomSection.cjs"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { InteractionType, LinearProgressType } from '..';
|
|
3
|
+
export interface ActionItem {
|
|
4
|
+
icon: React.ReactNode;
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface CardBottomSectionProps {
|
|
8
|
+
interactionType: InteractionType;
|
|
9
|
+
progressLevel?: number;
|
|
10
|
+
progressMax?: number;
|
|
11
|
+
progressType?: LinearProgressType;
|
|
12
|
+
noteLeft?: string;
|
|
13
|
+
noteLeftIcon?: React.ReactNode;
|
|
14
|
+
noteRight?: string;
|
|
15
|
+
noteRightIcon?: React.ReactNode;
|
|
16
|
+
authorName?: string;
|
|
17
|
+
actions?: ActionItem[];
|
|
18
|
+
logo?: React.ReactNode;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare const CardBottomSection: React.FunctionComponent<CardBottomSectionProps>;
|
|
22
|
+
export default CardBottomSection;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
import _pt from "prop-types";
|
|
3
|
+
|
|
4
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
5
|
+
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { COLORS, ComponentTextStyle, ComponentXXS, InteractionType, LinearProgress, LinearProgressType, LinearProgressVariant, Size } from '..';
|
|
9
|
+
import { IconButton } from '../Button';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
var ProgressContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 8px 0;\n"])));
|
|
13
|
+
var NotesContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 48px;\n position: relative;\n color: ", ";\n display: flex;\n flex-direction: row;\n align-items: center;\n"])), COLORS.neutral_500);
|
|
14
|
+
var AuthorContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n height: 48px;\n\n div:first-child {\n flex-grow: 2;\n }\n\n svg, img {\n width: 80px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n\n ", "\n"])), function (props) {
|
|
15
|
+
return props.disabled ? "\n color: ".concat(COLORS.neutral_300, ";\n svg, img {\n filter: grayscale(100%);\n }\n \n ") : '';
|
|
16
|
+
});
|
|
17
|
+
var Divider = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-top: 1px;\n border-top-color: ", ";\n border-top-style: solid;\n width: 100%;\n"])), COLORS.neutral_100);
|
|
18
|
+
var NoteLeft = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: absolute;\n left: 0px;\n display: flex;\n flex-direction: row;\n align-items: center;\n\n svg {\n margin-right: 4px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n"])));
|
|
19
|
+
var NoteRight = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: absolute;\n right: 0px;\n display: flex;\n flex-direction: row;\n align-items: center;\n\n svg {\n margin-right: 4px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n"])));
|
|
20
|
+
var ButtonRowContainer = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-items: center;\n border-top: 1px;\n border-top-color: ", ";\n border-top-style: solid;\n\n button:last-child{\n margin: 8px 0px 0px 0px;\n }\n\n button:not(:last-child) {\n margin: 8px 0px 0px 0px;\n }\n\n svg {\n color: ", ";\n }\n"])), COLORS.neutral_100, COLORS.neutral_600);
|
|
21
|
+
var Container = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n padding: 0px 16px 8px 16px;\n width: calc(100% - 32px);\n cursor: ", ";\n\n ", " {\n ", "\n }\n"])), function (props) {
|
|
22
|
+
return props.disabled ? 'not-allowed' : 'pointer';
|
|
23
|
+
}, ButtonRowContainer, function (props) {
|
|
24
|
+
return props.interactionType == InteractionType.Clickable ? "cursor: ".concat(props.disabled ? 'not-allowed' : 'auto', ";") : '';
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
var CardBottomSection = function CardBottomSection(_ref) {
|
|
28
|
+
var interactionType = _ref.interactionType,
|
|
29
|
+
progressLevel = _ref.progressLevel,
|
|
30
|
+
progressMax = _ref.progressMax,
|
|
31
|
+
_ref$progressType = _ref.progressType,
|
|
32
|
+
progressType = _ref$progressType === void 0 ? LinearProgressType.Line : _ref$progressType,
|
|
33
|
+
noteLeft = _ref.noteLeft,
|
|
34
|
+
noteLeftIcon = _ref.noteLeftIcon,
|
|
35
|
+
noteRight = _ref.noteRight,
|
|
36
|
+
noteRightIcon = _ref.noteRightIcon,
|
|
37
|
+
authorName = _ref.authorName,
|
|
38
|
+
logo = _ref.logo,
|
|
39
|
+
actions = _ref.actions,
|
|
40
|
+
disabled = _ref.disabled;
|
|
41
|
+
var haveAtLeastSomething = progressLevel != undefined || noteLeft || noteLeftIcon || noteRight || noteRightIcon || authorName;
|
|
42
|
+
return /*#__PURE__*/_jsxs(Container, {
|
|
43
|
+
disabled: disabled,
|
|
44
|
+
interactionType: interactionType,
|
|
45
|
+
children: [haveAtLeastSomething && /*#__PURE__*/_jsx(Divider, {}), progressLevel != undefined && /*#__PURE__*/_jsx(ProgressContainer, {
|
|
46
|
+
children: /*#__PURE__*/_jsx(LinearProgress, {
|
|
47
|
+
size: Size.Small,
|
|
48
|
+
type: progressType,
|
|
49
|
+
variant: LinearProgressVariant.Normal,
|
|
50
|
+
value: progressLevel,
|
|
51
|
+
max: progressMax !== null && progressMax !== void 0 ? progressMax : progressLevel
|
|
52
|
+
})
|
|
53
|
+
}), (noteLeft || noteLeftIcon || noteRight || noteRightIcon) && /*#__PURE__*/_jsxs(NotesContainer, {
|
|
54
|
+
children: [(noteLeft || noteLeftIcon) && /*#__PURE__*/_jsxs(NoteLeft, {
|
|
55
|
+
children: [noteLeftIcon, /*#__PURE__*/_jsx(ComponentXXS, {
|
|
56
|
+
color: COLORS.neutral_500,
|
|
57
|
+
textStyle: ComponentTextStyle.Bold,
|
|
58
|
+
children: noteLeft
|
|
59
|
+
})]
|
|
60
|
+
}), (noteRight || noteRightIcon) && /*#__PURE__*/_jsxs(NoteRight, {
|
|
61
|
+
children: [noteRightIcon, /*#__PURE__*/_jsx(ComponentXXS, {
|
|
62
|
+
color: COLORS.neutral_500,
|
|
63
|
+
textStyle: ComponentTextStyle.Bold,
|
|
64
|
+
children: noteRight
|
|
65
|
+
})]
|
|
66
|
+
})]
|
|
67
|
+
}), (authorName || logo) && /*#__PURE__*/_jsxs(AuthorContainer, {
|
|
68
|
+
disabled: disabled,
|
|
69
|
+
children: [/*#__PURE__*/_jsx(ComponentXXS, {
|
|
70
|
+
children: authorName
|
|
71
|
+
}), logo]
|
|
72
|
+
}), actions && /*#__PURE__*/_jsx(ButtonRowContainer, {
|
|
73
|
+
children: actions.map(function (x) {
|
|
74
|
+
return /*#__PURE__*/_jsx(IconButton, {
|
|
75
|
+
disabled: disabled,
|
|
76
|
+
variant: "secondary",
|
|
77
|
+
shape: "circular",
|
|
78
|
+
action: function action(e) {
|
|
79
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
80
|
+
x.onClick();
|
|
81
|
+
},
|
|
82
|
+
children: x.icon
|
|
83
|
+
});
|
|
84
|
+
})
|
|
85
|
+
})]
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
CardBottomSection.propTypes = {
|
|
90
|
+
progressLevel: _pt.number,
|
|
91
|
+
progressMax: _pt.number,
|
|
92
|
+
noteLeft: _pt.string,
|
|
93
|
+
noteLeftIcon: _pt.node,
|
|
94
|
+
noteRight: _pt.string,
|
|
95
|
+
noteRightIcon: _pt.node,
|
|
96
|
+
authorName: _pt.string,
|
|
97
|
+
actions: _pt.arrayOf(_pt.shape({
|
|
98
|
+
icon: _pt.node.isRequired,
|
|
99
|
+
onClick: _pt.func.isRequired
|
|
100
|
+
})),
|
|
101
|
+
logo: _pt.node,
|
|
102
|
+
disabled: _pt.bool.isRequired
|
|
103
|
+
};
|
|
104
|
+
export default CardBottomSection;
|
|
105
|
+
//# sourceMappingURL=CardBottomSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Card/CardBottomSection.tsx"],"names":["React","styled","COLORS","ComponentTextStyle","ComponentXXS","InteractionType","LinearProgress","LinearProgressType","LinearProgressVariant","Size","IconButton","ProgressContainer","div","NotesContainer","neutral_500","AuthorContainer","props","disabled","neutral_300","Divider","neutral_100","NoteLeft","NoteRight","ButtonRowContainer","neutral_600","Container","interactionType","Clickable","CardBottomSection","progressLevel","progressMax","progressType","Line","noteLeft","noteLeftIcon","noteRight","noteRightIcon","authorName","logo","actions","haveAtLeastSomething","undefined","Small","Normal","Bold","map","x","e","stopPropagation","onClick","icon"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAASC,MAAT,EAAiBC,kBAAjB,EAAqCC,YAArC,EAAmDC,eAAnD,EAAoEC,cAApE,EAAoFC,kBAApF,EAAwGC,qBAAxG,EAA+HC,IAA/H,QAA2I,IAA3I;AAEA,SAASC,UAAT,QAA2B,WAA3B;;;AAwBA,IAAMC,iBAAiB,GAAGV,MAAM,CAACW,GAAV,0FAAvB;AAIA,IAAMC,cAAc,GAAGZ,MAAM,CAACW,GAAV,oMAGTV,MAAM,CAACY,WAHE,CAApB;AASA,IAAMC,eAAe,GAAGd,MAAM,CAACW,GAAV,qSAgBjB,UAAAI,KAAK;AAAA,SAAIA,KAAK,CAACC,QAAN,0BACAf,MAAM,CAACgB,WADP,0EAMP,EANG;AAAA,CAhBY,CAArB;AAyBA,IAAMC,OAAO,GAAGlB,MAAM,CAACW,GAAV,qK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A,gBACTA,OAAO,CAACM,GAAR,CAAY,UAAAC,CAAC;AAAA,4BACZ,KAAC,UAAD;AAAY,UAAA,QAAQ,EAAE7B,QAAtB;AAAgC,UAAA,OAAO,EAAC,WAAxC;AAAoD,UAAA,KAAK,EAAC,UAA1D;AAAqE,UAAA,MAAM,EAAE,gBAAC8B,CAAD,EAAO;AAACA,YAAAA,CAAC,SAAD,IAAAA,CAAC,WAAD,YAAAA,CAAC,CAAEC,eAAH;AAAsBF,YAAAA,CAAC,CAACG,OAAF;AAAa,WAAxH;AAAA,oBACGH,CAAC,CAACI;AADL,UADY;AAAA,OAAb;AADS,MA9Bd;AAAA,IADF;AAwCD,CAxDD;;;AAzHErB,EAAAA,a;AACAC,EAAAA,W;AAGAG,EAAAA,Q;AACAC,EAAAA,Y;AACAC,EAAAA,S;AACAC,EAAAA,a;AAEAC,EAAAA,U;AACAE,EAAAA,O;AAhBAW,IAAAA,I;AACAD,IAAAA,O;;AAgBAX,EAAAA,I;AACArB,EAAAA,Q;;AAuKF,eAAeW,iBAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { COLORS, ComponentTextStyle, ComponentXXS, InteractionType, LinearProgress, LinearProgressType, LinearProgressVariant, Size } from '..';\nimport { LaerdalLogo } from '../assets';\nimport { IconButton } from '../Button';\n\nexport interface ActionItem {\n icon: React.ReactNode;\n onClick: () => void;\n}\n\nexport interface CardBottomSectionProps {\n interactionType: InteractionType;\n progressLevel?: number;\n progressMax?: number;\n progressType?: LinearProgressType;\n\n noteLeft?: string;\n noteLeftIcon?: React.ReactNode;\n noteRight?: string;\n noteRightIcon?: React.ReactNode;\n \n authorName?: string;\n actions?: ActionItem[];\n logo?: React.ReactNode;\n disabled: boolean;\n}\n\nconst ProgressContainer = styled.div`\n padding: 8px 0;\n`;\n\nconst NotesContainer = styled.div`\n height: 48px;\n position: relative;\n color: ${COLORS.neutral_500};\n display: flex;\n flex-direction: row;\n align-items: center;\n`;\n\nconst AuthorContainer = styled.div<{disabled: boolean}>`\n display: flex;\n flex-direction: row;\n align-items: center;\n height: 48px;\n\n div:first-child {\n flex-grow: 2;\n }\n\n svg, img {\n width: 80px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n\n ${props => props.disabled ? `\n color: ${COLORS.neutral_300};\n svg, img {\n filter: grayscale(100%);\n }\n \n ` : ''}\n`;\n\nconst Divider = styled.div`\n border-top: 1px;\n border-top-color: ${COLORS.neutral_100};\n border-top-style: solid;\n width: 100%;\n`;\n\nconst NoteLeft = styled.div`\n position: absolute;\n left: 0px;\n display: flex;\n flex-direction: row;\n align-items: center;\n\n svg {\n margin-right: 4px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n`;\n\nconst NoteRight = styled.div`\n position: absolute;\n right: 0px;\n display: flex;\n flex-direction: row;\n align-items: center;\n\n svg {\n margin-right: 4px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n`;\n\nconst ButtonRowContainer = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-items: center;\n border-top: 1px;\n border-top-color: ${COLORS.neutral_100};\n border-top-style: solid;\n\n button:last-child{\n margin: 8px 0px 0px 0px;\n }\n\n button:not(:last-child) {\n margin: 8px 0px 0px 0px;\n }\n\n svg {\n color: ${COLORS.neutral_600};\n }\n`;\n\nconst Container = styled.div<{interactionType: InteractionType; disabled: boolean}>`\n padding: 0px 16px 8px 16px;\n width: calc(100% - 32px);\n cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};\n\n ${ButtonRowContainer} {\n ${props => props.interactionType == InteractionType.Clickable ? \n `cursor: ${props.disabled ? 'not-allowed' : 'auto'};` : ''}\n }\n`;\n\nconst CardBottomSection: React.FunctionComponent<CardBottomSectionProps> = ({\n interactionType,\n progressLevel,\n progressMax,\n progressType = LinearProgressType.Line,\n noteLeft,\n noteLeftIcon,\n noteRight,\n noteRightIcon,\n authorName,\n logo,\n actions,\n disabled\n}: CardBottomSectionProps) => {\n\n const haveAtLeastSomething = progressLevel != undefined || noteLeft || noteLeftIcon || noteRight || noteRightIcon || authorName;\n return (\n <Container disabled={disabled} interactionType={interactionType}>\n {haveAtLeastSomething && <Divider />}\n {progressLevel != undefined && <ProgressContainer>\n <LinearProgress size={Size.Small}\n type={progressType}\n variant={LinearProgressVariant.Normal}\n value={progressLevel}\n max={progressMax ?? progressLevel} />\n </ProgressContainer>}\n\n {(noteLeft || noteLeftIcon || noteRight || noteRightIcon) && <NotesContainer>\n {(noteLeft || noteLeftIcon) && (\n <NoteLeft>\n {noteLeftIcon}\n <ComponentXXS color={COLORS.neutral_500} textStyle={ComponentTextStyle.Bold}>{noteLeft}</ComponentXXS>\n </NoteLeft>\n )}\n {(noteRight || noteRightIcon) && (\n <NoteRight>\n {noteRightIcon}\n <ComponentXXS color={COLORS.neutral_500} textStyle={ComponentTextStyle.Bold}>{noteRight}</ComponentXXS>\n </NoteRight>\n )}\n </NotesContainer>}\n\n {(authorName || logo) && <AuthorContainer disabled={disabled}>\n <ComponentXXS>{authorName}</ComponentXXS>\n {logo}\n </AuthorContainer>}\n\n {actions && <ButtonRowContainer>\n {actions.map(x => (\n <IconButton disabled={disabled} variant=\"secondary\" shape=\"circular\" action={(e) => {e?.stopPropagation(); x.onClick();}}>\n {x.icon}\n </IconButton>\n ))}\n </ButtonRowContainer>}\n </Container>\n );\n};\n\nexport default CardBottomSection;\n"],"file":"CardBottomSection.js"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var React = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
|
+
|
|
20
|
+
var _ = require("..");
|
|
21
|
+
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
|
|
24
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
25
|
+
|
|
26
|
+
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); }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-grow: 1;\n width: calc(100% - 32px);\n position: relative;\n flex-direction: column;\n padding: 16px;\n gap: 8px;\n\n .descriptionBlock {\n padding: 2px 0;\n }\n\n .titleBlock {\n padding: 2px 0;\n }\n\n ", "\n"])), function (props) {
|
|
31
|
+
return props.interactionType == _.InteractionType.Clickable ? "\n cursor: ".concat(props.disabled ? 'not-allowed' : 'pointer', ";\n ") : '';
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
var ColorBand = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n width: 100%;\n top: 0px;\n left: 0px;\n height: 8px;\n background-color: ", ";\n"])), function (props) {
|
|
35
|
+
return props.$color;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
var TagsContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n padding: 4px 0;\n gap: 4px;\n flex-wrap: wrap;\n"])));
|
|
39
|
+
|
|
40
|
+
var CategoryContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: none;\n gap: 6px;\n \n svg {\n color: ", ";\n flex-grow: 0;\n flex-shrink: 0;\n }\n"])), _.COLORS.neutral_500);
|
|
41
|
+
|
|
42
|
+
var CardMiddleSection = function CardMiddleSection(_ref) {
|
|
43
|
+
var interactionType = _ref.interactionType,
|
|
44
|
+
colorBandColor = _ref.colorBandColor,
|
|
45
|
+
categoryIcon = _ref.categoryIcon,
|
|
46
|
+
categoryLabel = _ref.categoryLabel,
|
|
47
|
+
title = _ref.title,
|
|
48
|
+
description = _ref.description,
|
|
49
|
+
tags = _ref.tags,
|
|
50
|
+
disabled = _ref.disabled;
|
|
51
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
52
|
+
disabled: disabled,
|
|
53
|
+
interactionType: interactionType,
|
|
54
|
+
children: [colorBandColor && /*#__PURE__*/(0, _jsxRuntime.jsx)(ColorBand, {
|
|
55
|
+
$color: colorBandColor
|
|
56
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(CategoryContainer, {
|
|
57
|
+
extraTopMargin: Boolean(colorBandColor),
|
|
58
|
+
bottomMargin: Boolean(categoryIcon || categoryLabel),
|
|
59
|
+
children: [categoryIcon, /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ComponentS, {
|
|
60
|
+
textStyle: _.ComponentTextStyle.Bold,
|
|
61
|
+
color: _.COLORS.neutral_500,
|
|
62
|
+
children: categoryLabel
|
|
63
|
+
})]
|
|
64
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ComponentXL, {
|
|
65
|
+
className: "titleBlock",
|
|
66
|
+
textStyle: _.ComponentTextStyle.Bold,
|
|
67
|
+
color: disabled ? _.COLORS.neutral_500 : _.COLORS.black,
|
|
68
|
+
children: title
|
|
69
|
+
}), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ComponentS, {
|
|
70
|
+
className: "descriptionBlock",
|
|
71
|
+
color: _.COLORS.neutral_600,
|
|
72
|
+
children: description
|
|
73
|
+
}), tags && /*#__PURE__*/(0, _jsxRuntime.jsx)(TagsContainer, {
|
|
74
|
+
children: tags.map(function (x) {
|
|
75
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tag, {
|
|
76
|
+
label: x
|
|
77
|
+
});
|
|
78
|
+
})
|
|
79
|
+
})]
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
CardMiddleSection.propTypes = {
|
|
84
|
+
colorBandColor: _propTypes.default.string,
|
|
85
|
+
categoryIcon: _propTypes.default.node,
|
|
86
|
+
categoryLabel: _propTypes.default.string,
|
|
87
|
+
title: _propTypes.default.string.isRequired,
|
|
88
|
+
description: _propTypes.default.string,
|
|
89
|
+
tags: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
90
|
+
disabled: _propTypes.default.bool.isRequired
|
|
91
|
+
};
|
|
92
|
+
var _default = CardMiddleSection;
|
|
93
|
+
exports.default = _default;
|
|
94
|
+
//# sourceMappingURL=CardMiddleSection.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Card/CardMiddleSection.tsx"],"names":["Container","styled","div","props","interactionType","InteractionType","Clickable","disabled","ColorBand","$color","TagsContainer","CategoryContainer","COLORS","neutral_500","CardMiddleSection","colorBandColor","categoryIcon","categoryLabel","title","description","tags","Boolean","ComponentTextStyle","Bold","black","neutral_600","map","x"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;AAaA,IAAMA,SAAS,GAAGC,0BAAOC,GAAV,iVAiBX,UAAAC,KAAK;AAAA,SACLA,KAAK,CAACC,eAAN,IAAyBC,kBAAgBC,SAAzC,2BAEUH,KAAK,CAACI,QAAN,GAAiB,aAAjB,GAAiC,SAF3C,aAII,EALC;AAAA,CAjBM,CAAf;;AAyBA,IAAMC,SAAS,GAAGP,0BAAOC,GAAV,qMAMO,UAAAC,KAAK;AAAA,SAAIA,KAAK,CAACM,MAAV;AAAA,CANZ,CAAf;;AASA,IAAMC,aAAa,GAAGT,0BAAOC,GAAV,qLAAnB;;AAQA,IAAMS,iBAAiB,GAAGV,0BAAOC,GAAV,qQAQVU,SAAOC,WARG,CAAvB;;AAcA,IAAMC,iBAAkE,GAAG,SAArEA,iBAAqE,OAS7C;AAAA,MAR5BV,eAQ4B,QAR5BA,eAQ4B;AAAA,MAP5BW,cAO4B,QAP5BA,cAO4B;AAAA,MAN5BC,YAM4B,QAN5BA,YAM4B;AAAA,MAL5BC,aAK4B,QAL5BA,aAK4B;AAAA,MAJ5BC,KAI4B,QAJ5BA,KAI4B;AAAA,MAH5BC,WAG4B,QAH5BA,WAG4B;AAAA,MAF5BC,IAE4B,QAF5BA,IAE4B;AAAA,MAD5Bb,QAC4B,QAD5BA,QAC4B;AAC5B,sBACE,sBAAC,SAAD;AAAW,IAAA,QAAQ,EAAEA,QAArB;AAA+B,IAAA,eAAe,EAAEH,eAAhD;AAAA,eACGW,cAAc,iBAAI,qBAAC,SAAD;AAAW,MAAA,MAAM,EAAEA;AAAnB,MADrB,eAEE,sBAAC,iBAAD;AAAmB,MAAA,cAAc,EAAEM,OAAO,CAACN,cAAD,CAA1C;AAA4D,MAAA,YAAY,EAAEM,OAAO,CAACL,YAAY,IAAIC,aAAjB,CAAjF;AAAA,iBACGD,YADH,eAEE,qBAAC,YAAD;AAAY,QAAA,SAAS,EAAEM,qBAAmBC,IAA1C;AAAgD,QAAA,KAAK,EAAEX,SAAOC,WAA9D;AAAA,kBACGI;AADH,QAFF;AAAA,MAFF,eAQE,qBAAC,aAAD;AAAa,MAAA,SAAS,EAAC,YAAvB;AAAoC,MAAA,SAAS,EAAEK,qBAAmBC,IAAlE;AAAwE,MAAA,KAAK,EAAEhB,QAAQ,GAAGK,SAAOC,WAAV,GAAwBD,SAAOY,KAAtH;AAAA,gBACGN;AADH,MARF,EAWGC,WAAW,iBACV,qBAAC,YAAD;AAAY,MAAA,SAAS,EAAC,kBAAtB;AAAyC,MAAA,KAAK,EAAEP,SAAOa,WAAvD;AAAA,gBACGN;AADH,MAZJ,EAgBGC,IAAI,iBACH,qBAAC,aAAD;AAAA,gBACGA,IAAI,CAACM,GAAL,CAAS,UAAAC,CAAC;AAAA,4BACT,qBAAC,KAAD;AAAK,UAAA,KAAK,EAAEA;AAAZ,UADS;AAAA,OAAV;AADH,MAjBJ;AAAA,IADF;AA0BD,CApCD;;;AAlEEZ,EAAAA,c;AAEAC,EAAAA,Y;AACAC,EAAAA,a;AACAC,EAAAA,K;AACAC,EAAAA,W;AACAC,EAAAA,I;AACAb,EAAAA,Q;;eAiGaO,iB","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { COLORS, ComponentS, ComponentTextStyle, ComponentXL, ComponentXS, InteractionType, Tag } from '..';\n\nexport interface CardMiddleSectionProps {\n colorBandColor?: string;\n interactionType: InteractionType;\n categoryIcon?: React.ReactNode;\n categoryLabel?: string;\n title: string;\n description?: string;\n tags?: string[];\n disabled: boolean;\n}\n\nconst Container = styled.div<{ interactionType: InteractionType; disabled: boolean }>`\n display: flex;\n flex-grow: 1;\n width: calc(100% - 32px);\n position: relative;\n flex-direction: column;\n padding: 16px;\n gap: 8px;\n\n .descriptionBlock {\n padding: 2px 0;\n }\n\n .titleBlock {\n padding: 2px 0;\n }\n\n ${props =>\n props.interactionType == InteractionType.Clickable\n ? `\n cursor: ${props.disabled ? 'not-allowed' : 'pointer'};\n `\n : ''}\n`;\n\nconst ColorBand = styled.div<{ $color: string }>`\n position: absolute;\n width: 100%;\n top: 0px;\n left: 0px;\n height: 8px;\n background-color: ${props => props.$color};\n`;\n\nconst TagsContainer = styled.div`\n display: flex;\n flex-direction: row;\n padding: 4px 0;\n gap: 4px;\n flex-wrap: wrap;\n`;\n\nconst CategoryContainer = styled.div<{ extraTopMargin: boolean; bottomMargin: boolean }>`\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: none;\n gap: 6px;\n \n svg {\n color: ${COLORS.neutral_500};\n flex-grow: 0;\n flex-shrink: 0;\n }\n`;\n\nconst CardMiddleSection: React.FunctionComponent<CardMiddleSectionProps> = ({\n interactionType,\n colorBandColor,\n categoryIcon,\n categoryLabel,\n title,\n description,\n tags,\n disabled\n}: CardMiddleSectionProps) => {\n return (\n <Container disabled={disabled} interactionType={interactionType}>\n {colorBandColor && <ColorBand $color={colorBandColor} />}\n <CategoryContainer extraTopMargin={Boolean(colorBandColor)} bottomMargin={Boolean(categoryIcon || categoryLabel)}>\n {categoryIcon}\n <ComponentS textStyle={ComponentTextStyle.Bold} color={COLORS.neutral_500}>\n {categoryLabel}\n </ComponentS>\n </CategoryContainer>\n <ComponentXL className=\"titleBlock\" textStyle={ComponentTextStyle.Bold} color={disabled ? COLORS.neutral_500 : COLORS.black}>\n {title}\n </ComponentXL>\n {description && (\n <ComponentS className=\"descriptionBlock\" color={COLORS.neutral_600}>\n {description}\n </ComponentS>\n )}\n {tags && (\n <TagsContainer>\n {tags.map(x => (\n <Tag label={x} />\n ))}\n </TagsContainer>\n )}\n </Container>\n );\n};\n\nexport default CardMiddleSection;\n"],"file":"CardMiddleSection.cjs"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { InteractionType } from '..';
|
|
3
|
+
export interface CardMiddleSectionProps {
|
|
4
|
+
colorBandColor?: string;
|
|
5
|
+
interactionType: InteractionType;
|
|
6
|
+
categoryIcon?: React.ReactNode;
|
|
7
|
+
categoryLabel?: string;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
tags?: string[];
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const CardMiddleSection: React.FunctionComponent<CardMiddleSectionProps>;
|
|
14
|
+
export default CardMiddleSection;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
import _pt from "prop-types";
|
|
3
|
+
|
|
4
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
5
|
+
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { COLORS, ComponentS, ComponentTextStyle, ComponentXL, InteractionType, Tag } from '..';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
var Container = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-grow: 1;\n width: calc(100% - 32px);\n position: relative;\n flex-direction: column;\n padding: 16px;\n gap: 8px;\n\n .descriptionBlock {\n padding: 2px 0;\n }\n\n .titleBlock {\n padding: 2px 0;\n }\n\n ", "\n"])), function (props) {
|
|
12
|
+
return props.interactionType == InteractionType.Clickable ? "\n cursor: ".concat(props.disabled ? 'not-allowed' : 'pointer', ";\n ") : '';
|
|
13
|
+
});
|
|
14
|
+
var ColorBand = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n width: 100%;\n top: 0px;\n left: 0px;\n height: 8px;\n background-color: ", ";\n"])), function (props) {
|
|
15
|
+
return props.$color;
|
|
16
|
+
});
|
|
17
|
+
var TagsContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n padding: 4px 0;\n gap: 4px;\n flex-wrap: wrap;\n"])));
|
|
18
|
+
var CategoryContainer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: none;\n gap: 6px;\n \n svg {\n color: ", ";\n flex-grow: 0;\n flex-shrink: 0;\n }\n"])), COLORS.neutral_500);
|
|
19
|
+
|
|
20
|
+
var CardMiddleSection = function CardMiddleSection(_ref) {
|
|
21
|
+
var interactionType = _ref.interactionType,
|
|
22
|
+
colorBandColor = _ref.colorBandColor,
|
|
23
|
+
categoryIcon = _ref.categoryIcon,
|
|
24
|
+
categoryLabel = _ref.categoryLabel,
|
|
25
|
+
title = _ref.title,
|
|
26
|
+
description = _ref.description,
|
|
27
|
+
tags = _ref.tags,
|
|
28
|
+
disabled = _ref.disabled;
|
|
29
|
+
return /*#__PURE__*/_jsxs(Container, {
|
|
30
|
+
disabled: disabled,
|
|
31
|
+
interactionType: interactionType,
|
|
32
|
+
children: [colorBandColor && /*#__PURE__*/_jsx(ColorBand, {
|
|
33
|
+
$color: colorBandColor
|
|
34
|
+
}), /*#__PURE__*/_jsxs(CategoryContainer, {
|
|
35
|
+
extraTopMargin: Boolean(colorBandColor),
|
|
36
|
+
bottomMargin: Boolean(categoryIcon || categoryLabel),
|
|
37
|
+
children: [categoryIcon, /*#__PURE__*/_jsx(ComponentS, {
|
|
38
|
+
textStyle: ComponentTextStyle.Bold,
|
|
39
|
+
color: COLORS.neutral_500,
|
|
40
|
+
children: categoryLabel
|
|
41
|
+
})]
|
|
42
|
+
}), /*#__PURE__*/_jsx(ComponentXL, {
|
|
43
|
+
className: "titleBlock",
|
|
44
|
+
textStyle: ComponentTextStyle.Bold,
|
|
45
|
+
color: disabled ? COLORS.neutral_500 : COLORS.black,
|
|
46
|
+
children: title
|
|
47
|
+
}), description && /*#__PURE__*/_jsx(ComponentS, {
|
|
48
|
+
className: "descriptionBlock",
|
|
49
|
+
color: COLORS.neutral_600,
|
|
50
|
+
children: description
|
|
51
|
+
}), tags && /*#__PURE__*/_jsx(TagsContainer, {
|
|
52
|
+
children: tags.map(function (x) {
|
|
53
|
+
return /*#__PURE__*/_jsx(Tag, {
|
|
54
|
+
label: x
|
|
55
|
+
});
|
|
56
|
+
})
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
CardMiddleSection.propTypes = {
|
|
62
|
+
colorBandColor: _pt.string,
|
|
63
|
+
categoryIcon: _pt.node,
|
|
64
|
+
categoryLabel: _pt.string,
|
|
65
|
+
title: _pt.string.isRequired,
|
|
66
|
+
description: _pt.string,
|
|
67
|
+
tags: _pt.arrayOf(_pt.string),
|
|
68
|
+
disabled: _pt.bool.isRequired
|
|
69
|
+
};
|
|
70
|
+
export default CardMiddleSection;
|
|
71
|
+
//# sourceMappingURL=CardMiddleSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Card/CardMiddleSection.tsx"],"names":["React","styled","COLORS","ComponentS","ComponentTextStyle","ComponentXL","InteractionType","Tag","Container","div","props","interactionType","Clickable","disabled","ColorBand","$color","TagsContainer","CategoryContainer","neutral_500","CardMiddleSection","colorBandColor","categoryIcon","categoryLabel","title","description","tags","Boolean","Bold","black","neutral_600","map","x"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAASC,MAAT,EAAiBC,UAAjB,EAA6BC,kBAA7B,EAAiDC,WAAjD,EAA2EC,eAA3E,EAA4FC,GAA5F,QAAuG,IAAvG;;;AAaA,IAAMC,SAAS,GAAGP,MAAM,CAACQ,GAAV,mUAiBX,UAAAC,KAAK;AAAA,SACLA,KAAK,C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AAA,SAAS,EAAC,YAAvB;AAAoC,MAAA,SAAS,EAAElB,kBAAkB,CAACuB,IAAlE;AAAwE,MAAA,KAAK,EAAEd,QAAQ,GAAGX,MAAM,CAACgB,WAAV,GAAwBhB,MAAM,CAAC0B,KAAtH;AAAA,gBACGL;AADH,MARF,EAWGC,WAAW,iBACV,KAAC,UAAD;AAAY,MAAA,SAAS,EAAC,kBAAtB;AAAyC,MAAA,KAAK,EAAEtB,MAAM,CAAC2B,WAAvD;AAAA,gBACGL;AADH,MAZJ,EAgBGC,IAAI,iBACH,KAAC,aAAD;AAAA,gBACGA,IAAI,CAACK,GAAL,CAAS,UAAAC,CAAC;AAAA,4BACT,KAAC,GAAD;AAAK,UAAA,KAAK,EAAEA;AAAZ,UADS;AAAA,OAAV;AADH,MAjBJ;AAAA,IADF;AA0BD,CApCD;;;AAlEEX,EAAAA,c;AAEAC,EAAAA,Y;AACAC,EAAAA,a;AACAC,EAAAA,K;AACAC,EAAAA,W;AACAC,EAAAA,I;AACAZ,EAAAA,Q;;AAiGF,eAAeM,iBAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { COLORS, ComponentS, ComponentTextStyle, ComponentXL, ComponentXS, InteractionType, Tag } from '..';\n\nexport interface CardMiddleSectionProps {\n colorBandColor?: string;\n interactionType: InteractionType;\n categoryIcon?: React.ReactNode;\n categoryLabel?: string;\n title: string;\n description?: string;\n tags?: string[];\n disabled: boolean;\n}\n\nconst Container = styled.div<{ interactionType: InteractionType; disabled: boolean }>`\n display: flex;\n flex-grow: 1;\n width: calc(100% - 32px);\n position: relative;\n flex-direction: column;\n padding: 16px;\n gap: 8px;\n\n .descriptionBlock {\n padding: 2px 0;\n }\n\n .titleBlock {\n padding: 2px 0;\n }\n\n ${props =>\n props.interactionType == InteractionType.Clickable\n ? `\n cursor: ${props.disabled ? 'not-allowed' : 'pointer'};\n `\n : ''}\n`;\n\nconst ColorBand = styled.div<{ $color: string }>`\n position: absolute;\n width: 100%;\n top: 0px;\n left: 0px;\n height: 8px;\n background-color: ${props => props.$color};\n`;\n\nconst TagsContainer = styled.div`\n display: flex;\n flex-direction: row;\n padding: 4px 0;\n gap: 4px;\n flex-wrap: wrap;\n`;\n\nconst CategoryContainer = styled.div<{ extraTopMargin: boolean; bottomMargin: boolean }>`\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: none;\n gap: 6px;\n \n svg {\n color: ${COLORS.neutral_500};\n flex-grow: 0;\n flex-shrink: 0;\n }\n`;\n\nconst CardMiddleSection: React.FunctionComponent<CardMiddleSectionProps> = ({\n interactionType,\n colorBandColor,\n categoryIcon,\n categoryLabel,\n title,\n description,\n tags,\n disabled\n}: CardMiddleSectionProps) => {\n return (\n <Container disabled={disabled} interactionType={interactionType}>\n {colorBandColor && <ColorBand $color={colorBandColor} />}\n <CategoryContainer extraTopMargin={Boolean(colorBandColor)} bottomMargin={Boolean(categoryIcon || categoryLabel)}>\n {categoryIcon}\n <ComponentS textStyle={ComponentTextStyle.Bold} color={COLORS.neutral_500}>\n {categoryLabel}\n </ComponentS>\n </CategoryContainer>\n <ComponentXL className=\"titleBlock\" textStyle={ComponentTextStyle.Bold} color={disabled ? COLORS.neutral_500 : COLORS.black}>\n {title}\n </ComponentXL>\n {description && (\n <ComponentS className=\"descriptionBlock\" color={COLORS.neutral_600}>\n {description}\n </ComponentS>\n )}\n {tags && (\n <TagsContainer>\n {tags.map(x => (\n <Tag label={x} />\n ))}\n </TagsContainer>\n )}\n </Container>\n );\n};\n\nexport default CardMiddleSection;\n"],"file":"CardMiddleSection.js"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var React = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
|
+
|
|
20
|
+
var _typography = require("../styles/typography");
|
|
21
|
+
|
|
22
|
+
var _Checkbox = _interopRequireDefault(require("../InputFields/Checkbox"));
|
|
23
|
+
|
|
24
|
+
var _Tag = require("../Tag");
|
|
25
|
+
|
|
26
|
+
var _ = require("..");
|
|
27
|
+
|
|
28
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
|
+
|
|
30
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
31
|
+
|
|
32
|
+
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); }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
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
|
+
|
|
38
|
+
var TagContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n\n top: 16px;\n left: 16px;\n"])));
|
|
39
|
+
|
|
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
|
+
return props.disabled ? "\n img, svg {\n filter: grayscale(100%);\n }" : '';
|
|
42
|
+
}, function (props) {
|
|
43
|
+
return props.interactionType == _.InteractionType.Clickable ? "\n cursor: ".concat(props.disabled ? 'not-allowed' : 'pointer', ";\n ") : '';
|
|
44
|
+
});
|
|
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 margin-right: 9px;\n width: 24px;\n height: 24px;\n flex-grow: 0;\n flex-shrink: 0;\n }\n"])), function (props) {
|
|
47
|
+
return props.$backgroundColor;
|
|
48
|
+
}, function (props) {
|
|
49
|
+
return props.$color;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
var CheckboxContainer = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n top: 0px;\n right: 0px;\n\n .checkbox-icon {\n background-color: ", ";\n }\n"])), _.COLORS.white);
|
|
53
|
+
|
|
54
|
+
var CardTopSection = function CardTopSection(_ref) {
|
|
55
|
+
var interactionType = _ref.interactionType,
|
|
56
|
+
selected = _ref.selected,
|
|
57
|
+
setSelected = _ref.setSelected,
|
|
58
|
+
image = _ref.image,
|
|
59
|
+
tagLabel = _ref.tagLabel,
|
|
60
|
+
tagIcon = _ref.tagIcon,
|
|
61
|
+
_ref$tagVariant = _ref.tagVariant,
|
|
62
|
+
tagVariant = _ref$tagVariant === void 0 ? 'positive' : _ref$tagVariant,
|
|
63
|
+
highlightRibbonIcon = _ref.highlightRibbonIcon,
|
|
64
|
+
highlightRibbonText = _ref.highlightRibbonText,
|
|
65
|
+
highlightRibbonContentColor = _ref.highlightRibbonContentColor,
|
|
66
|
+
highlightRibbonBgColor = _ref.highlightRibbonBgColor,
|
|
67
|
+
disabled = _ref.disabled;
|
|
68
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
69
|
+
disabled: disabled,
|
|
70
|
+
interactionType: interactionType,
|
|
71
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Img, {
|
|
72
|
+
src: image
|
|
73
|
+
}), (selected !== undefined || setSelected !== undefined) && interactionType == _.InteractionType.Selectable && /*#__PURE__*/(0, _jsxRuntime.jsx)(CheckboxContainer, {
|
|
74
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.default, {
|
|
75
|
+
select: function select(selected) {
|
|
76
|
+
return setSelected(selected);
|
|
77
|
+
},
|
|
78
|
+
selected: selected
|
|
79
|
+
})
|
|
80
|
+
}), (tagLabel || tagIcon) && /*#__PURE__*/(0, _jsxRuntime.jsx)(TagContainer, {
|
|
81
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tag.Tag, {
|
|
82
|
+
label: tagLabel,
|
|
83
|
+
variant: tagVariant,
|
|
84
|
+
icon: tagIcon
|
|
85
|
+
})
|
|
86
|
+
}), (highlightRibbonIcon || highlightRibbonText) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(RibbonContainer, {
|
|
87
|
+
$color: highlightRibbonContentColor !== null && highlightRibbonContentColor !== void 0 ? highlightRibbonContentColor : '',
|
|
88
|
+
$backgroundColor: disabled ? _.COLORS.neutral_300 : highlightRibbonBgColor !== null && highlightRibbonBgColor !== void 0 ? highlightRibbonBgColor : '',
|
|
89
|
+
children: [highlightRibbonIcon, highlightRibbonText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.ComponentS, {
|
|
90
|
+
color: highlightRibbonContentColor !== null && highlightRibbonContentColor !== void 0 ? highlightRibbonContentColor : '',
|
|
91
|
+
textStyle: _typography.ComponentTextStyle.Regular,
|
|
92
|
+
children: highlightRibbonText
|
|
93
|
+
})]
|
|
94
|
+
})]
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
CardTopSection.propTypes = {
|
|
99
|
+
selected: _propTypes.default.bool.isRequired,
|
|
100
|
+
setSelected: _propTypes.default.func.isRequired,
|
|
101
|
+
tagLabel: _propTypes.default.string,
|
|
102
|
+
tagIcon: _propTypes.default.node,
|
|
103
|
+
highlightRibbonText: _propTypes.default.string,
|
|
104
|
+
highlightRibbonIcon: _propTypes.default.string,
|
|
105
|
+
highlightRibbonContentColor: _propTypes.default.string,
|
|
106
|
+
highlightRibbonBgColor: _propTypes.default.string,
|
|
107
|
+
image: _propTypes.default.string,
|
|
108
|
+
disabled: _propTypes.default.bool.isRequired
|
|
109
|
+
};
|
|
110
|
+
var _default = CardTopSection;
|
|
111
|
+
exports.default = _default;
|
|
112
|
+
//# sourceMappingURL=CardTopSection.cjs.map
|