@laerdal/life-react-components 1.9.8-dev.9.full → 1.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/Card/{VerticalCard/Card.cjs → Card.cjs} +9 -32
  2. package/dist/Card/Card.cjs.map +1 -0
  3. package/dist/Card/{VerticalCard/Card.d.ts → Card.d.ts} +1 -2
  4. package/dist/Card/{VerticalCard/Card.js → Card.js} +8 -29
  5. package/dist/Card/Card.js.map +1 -0
  6. package/dist/Card/{VerticalCard/CardBottomSection.cjs → CardBottomSection.cjs} +25 -40
  7. package/dist/Card/CardBottomSection.cjs.map +1 -0
  8. package/dist/Card/{VerticalCard/CardBottomSection.d.ts → CardBottomSection.d.ts} +4 -4
  9. package/dist/Card/{VerticalCard/CardBottomSection.js → CardBottomSection.js} +11 -25
  10. package/dist/Card/CardBottomSection.js.map +1 -0
  11. package/dist/Card/{VerticalCard/CardMiddleSection.cjs → CardMiddleSection.cjs} +13 -13
  12. package/dist/Card/CardMiddleSection.cjs.map +1 -0
  13. package/dist/Card/{VerticalCard/CardMiddleSection.d.ts → CardMiddleSection.d.ts} +2 -2
  14. package/dist/Card/{VerticalCard/CardMiddleSection.js → CardMiddleSection.js} +2 -2
  15. package/dist/Card/CardMiddleSection.js.map +1 -0
  16. package/dist/Card/{VerticalCard/CardTopSection.cjs → CardTopSection.cjs} +12 -11
  17. package/dist/Card/CardTopSection.cjs.map +1 -0
  18. package/dist/Card/{VerticalCard/CardTopSection.d.ts → CardTopSection.d.ts} +5 -5
  19. package/dist/Card/{VerticalCard/CardTopSection.js → CardTopSection.js} +10 -9
  20. package/dist/Card/CardTopSection.js.map +1 -0
  21. package/dist/Card/index.cjs +64 -8
  22. package/dist/Card/index.cjs.map +1 -1
  23. package/dist/Card/index.d.ts +7 -2
  24. package/dist/Card/index.js +7 -2
  25. package/dist/Card/index.js.map +1 -1
  26. package/dist/Dropdown/DropdownButton.cjs +3 -3
  27. package/dist/Dropdown/DropdownButton.cjs.map +1 -1
  28. package/dist/Dropdown/DropdownButton.d.ts +1 -5
  29. package/dist/Dropdown/DropdownButton.js +4 -3
  30. package/dist/Dropdown/DropdownButton.js.map +1 -1
  31. package/dist/InputFields/NumberField.cjs +63 -139
  32. package/dist/InputFields/NumberField.cjs.map +1 -1
  33. package/dist/InputFields/NumberField.d.ts +1 -4
  34. package/dist/InputFields/NumberField.js +63 -138
  35. package/dist/InputFields/NumberField.js.map +1 -1
  36. package/dist/List/ListRow.cjs +3 -24
  37. package/dist/List/ListRow.cjs.map +1 -1
  38. package/dist/List/ListRow.d.ts +0 -3
  39. package/dist/List/ListRow.js +3 -22
  40. package/dist/List/ListRow.js.map +1 -1
  41. package/dist/Toggles/ToggleButton.cjs +2 -3
  42. package/dist/Toggles/ToggleButton.cjs.map +1 -1
  43. package/dist/Toggles/ToggleButton.d.ts +1 -1
  44. package/dist/Toggles/ToggleButton.js +2 -3
  45. package/dist/Toggles/ToggleButton.js.map +1 -1
  46. package/dist/common/ActionWithin.cjs.map +1 -1
  47. package/dist/common/ActionWithin.js.map +1 -1
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.js.map +1 -1
  50. package/package.json +1 -1
  51. package/dist/Card/HorizontalCard/HorizontalCard.cjs +0 -97
  52. package/dist/Card/HorizontalCard/HorizontalCard.cjs.map +0 -1
  53. package/dist/Card/HorizontalCard/HorizontalCard.d.ts +0 -4
  54. package/dist/Card/HorizontalCard/HorizontalCard.js +0 -74
  55. package/dist/Card/HorizontalCard/HorizontalCard.js.map +0 -1
  56. package/dist/Card/HorizontalCard/HorizontalCardActions.cjs +0 -124
  57. package/dist/Card/HorizontalCard/HorizontalCardActions.cjs.map +0 -1
  58. package/dist/Card/HorizontalCard/HorizontalCardActions.d.ts +0 -5
  59. package/dist/Card/HorizontalCard/HorizontalCardActions.js +0 -98
  60. package/dist/Card/HorizontalCard/HorizontalCardActions.js.map +0 -1
  61. package/dist/Card/HorizontalCard/HorizontalCardBody.cjs +0 -60
  62. package/dist/Card/HorizontalCard/HorizontalCardBody.cjs.map +0 -1
  63. package/dist/Card/HorizontalCard/HorizontalCardBody.d.ts +0 -5
  64. package/dist/Card/HorizontalCard/HorizontalCardBody.js +0 -40
  65. package/dist/Card/HorizontalCard/HorizontalCardBody.js.map +0 -1
  66. package/dist/Card/HorizontalCard/HorizontalCardThumbnail.cjs +0 -49
  67. package/dist/Card/HorizontalCard/HorizontalCardThumbnail.cjs.map +0 -1
  68. package/dist/Card/HorizontalCard/HorizontalCardThumbnail.d.ts +0 -5
  69. package/dist/Card/HorizontalCard/HorizontalCardThumbnail.js +0 -33
  70. package/dist/Card/HorizontalCard/HorizontalCardThumbnail.js.map +0 -1
  71. package/dist/Card/HorizontalCard/index.cjs +0 -33
  72. package/dist/Card/HorizontalCard/index.cjs.map +0 -1
  73. package/dist/Card/HorizontalCard/index.d.ts +0 -2
  74. package/dist/Card/HorizontalCard/index.js +0 -3
  75. package/dist/Card/HorizontalCard/index.js.map +0 -1
  76. package/dist/Card/HorizontalCard/types.cjs +0 -6
  77. package/dist/Card/HorizontalCard/types.cjs.map +0 -1
  78. package/dist/Card/HorizontalCard/types.d.ts +0 -40
  79. package/dist/Card/HorizontalCard/types.js +0 -2
  80. package/dist/Card/HorizontalCard/types.js.map +0 -1
  81. package/dist/Card/VerticalCard/Card.cjs.map +0 -1
  82. package/dist/Card/VerticalCard/Card.js.map +0 -1
  83. package/dist/Card/VerticalCard/CardBottomSection.cjs.map +0 -1
  84. package/dist/Card/VerticalCard/CardBottomSection.js.map +0 -1
  85. package/dist/Card/VerticalCard/CardMiddleSection.cjs.map +0 -1
  86. package/dist/Card/VerticalCard/CardMiddleSection.js.map +0 -1
  87. package/dist/Card/VerticalCard/CardTopSection.cjs.map +0 -1
  88. package/dist/Card/VerticalCard/CardTopSection.js.map +0 -1
  89. package/dist/Card/VerticalCard/index.cjs +0 -88
  90. package/dist/Card/VerticalCard/index.cjs.map +0 -1
  91. package/dist/Card/VerticalCard/index.d.ts +0 -7
  92. package/dist/Card/VerticalCard/index.js +0 -8
  93. package/dist/Card/VerticalCard/index.js.map +0 -1
@@ -11,10 +11,6 @@ exports.default = exports.Wrapper = exports.CardTopLevelContainer = void 0;
11
11
 
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
 
14
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
15
-
16
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
-
18
14
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
19
15
 
20
16
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -29,7 +25,7 @@ var _CardMiddleSection = _interopRequireDefault(require("./CardMiddleSection"));
29
25
 
30
26
  var _CardBottomSection = _interopRequireDefault(require("./CardBottomSection"));
31
27
 
32
- var _index = require("../../index");
28
+ var _ = require("..");
33
29
 
34
30
  var _jsxRuntime = require("react/jsx-runtime");
35
31
 
@@ -43,11 +39,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
43
39
 
44
40
  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) { (0, _defineProperty2.default)(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; }
45
41
 
46
- var CardTopLevelContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n\n border-radius: 8px;\n\n background-clip: padding-box;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n\n .elevated & {\n box-shadow: ", ";\n }\n\n .outline & {\n border: 1px solid ", ";\n }\n"])), _index.COLORS.white, _index.BOXSHADOWS.BOXSHADOW_L1, _index.COLORS.neutral_200);
42
+ var CardTopLevelContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n\n box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);\n border-radius: 8px;\n\n border: 1px solid transparent;\n background-clip: padding-box;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n}\n"])), _.COLORS.white);
47
43
 
48
44
  exports.CardTopLevelContainer = CardTopLevelContainer;
49
45
 
50
- var Wrapper = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n height: max-content;\n width: max-content;\n\n &.interactive:focus {\n ", "\n }\n\n &.interactive:not(.disabled) {\n cursor: pointer;\n\n &.outline:not(.action-within) {\n ", " {\n &:hover {\n background-color: ", ";\n }\n\n &:active, &.active-state {\n background-color: ", ";\n }\n }\n }\n\n &.elevated:not(.action-within) {\n ", " {\n &:hover {\n box-shadow: ", ";\n }\n\n &:active, &.active-state {\n box-shadow: ", ";\n }\n }\n }\n }\n\n &.disabled {\n cursor: not-allowed;\n }\n"])), _index.focusStyles, CardTopLevelContainer, _index.COLORS.primary_20, _index.COLORS.primary_100, CardTopLevelContainer, _index.BOXSHADOWS.BOXSHADOW_L3, _index.BOXSHADOWS.BOXSHADOW_L2);
46
+ var Wrapper = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n height: max-content;\n width: max-content;\n\n &.interactive:focus {\n ", "\n }\n\n &.interactive:not(.disabled) {\n cursor: pointer;\n\n ", " {\n &:active, &.active-state {\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.15);\n border: 1px solid ", ";\n }\n\n &:hover {\n overflow: visible;\n border: 1px solid ", ";\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.15);\n }\n }\n }\n\n &.disabled {\n cursor: not-allowed;\n }\n"])), _.focusStyles, CardTopLevelContainer, _.COLORS.neutral_200, _.COLORS.neutral_200);
51
47
 
52
48
  exports.Wrapper = Wrapper;
53
49
 
@@ -56,24 +52,12 @@ var Card = function Card(_ref) {
56
52
  topSectionProps = _ref.topSectionProps,
57
53
  middleSectionProps = _ref.middleSectionProps,
58
54
  bottomSectionProps = _ref.bottomSectionProps,
59
- disabled = _ref.disabled,
60
- _ref$variant = _ref.variant,
61
- variant = _ref$variant === void 0 ? 'outline' : _ref$variant;
62
-
63
- var _React$useState = React.useState([]),
64
- _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
65
- actionsRefs = _React$useState2[0],
66
- setActionsRefs = _React$useState2[1];
67
-
68
- var checkBoxRef = React.useRef(null);
69
- var containerRef = React.useRef(null);
70
- (0, _index.useActionWithin)(containerRef, [].concat((0, _toConsumableArray2.default)(actionsRefs), [checkBoxRef]));
71
- var cls = "".concat(!!onCardClicked ? 'interactive' : '', " ").concat(disabled ? 'disabled' : '', " ").concat(variant);
55
+ disabled = _ref.disabled;
56
+ var cls = "".concat(!!onCardClicked ? 'interactive' : '', " ").concat(disabled ? 'disabled' : '');
72
57
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
73
- ref: containerRef,
74
58
  className: cls,
75
59
  tabIndex: !!onCardClicked && !disabled ? 0 : -1,
76
- onMouseDown: _index.defaultOnMouseDownHandler,
60
+ onMouseDown: _.defaultOnMouseDownHandler,
77
61
  onKeyDown: function onKeyDown(a) {
78
62
  return a.key === 'Enter' && !disabled && onCardClicked && onCardClicked();
79
63
  },
@@ -81,17 +65,11 @@ var Card = function Card(_ref) {
81
65
  return !disabled && onCardClicked && onCardClicked();
82
66
  },
83
67
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(CardTopLevelContainer, {
84
- children: [topSectionProps && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardTopSection.default, _objectSpread(_objectSpread({
85
- ref: checkBoxRef
86
- }, topSectionProps), {}, {
68
+ children: [topSectionProps && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardTopSection.default, _objectSpread(_objectSpread({}, topSectionProps), {}, {
87
69
  disabled: disabled
88
70
  })), middleSectionProps && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardMiddleSection.default, _objectSpread(_objectSpread({}, middleSectionProps), {}, {
89
71
  disabled: disabled
90
- })), bottomSectionProps && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardBottomSection.default, _objectSpread(_objectSpread({
91
- ref: function ref(instance) {
92
- return setActionsRefs(instance !== null && instance !== void 0 ? instance : []);
93
- }
94
- }, bottomSectionProps), {}, {
72
+ })), bottomSectionProps && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardBottomSection.default, _objectSpread(_objectSpread({}, bottomSectionProps), {}, {
95
73
  disabled: disabled
96
74
  }))]
97
75
  })
@@ -100,8 +78,7 @@ var Card = function Card(_ref) {
100
78
 
101
79
  Card.propTypes = {
102
80
  onCardClicked: _propTypes.default.func,
103
- disabled: _propTypes.default.bool,
104
- variant: _propTypes.default.oneOf(['outline', 'elevated'])
81
+ disabled: _propTypes.default.bool.isRequired
105
82
  };
106
83
  var _default = Card;
107
84
  exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Card/Card.tsx"],"names":["CardTopLevelContainer","styled","div","COLORS","white","Wrapper","focusStyles","neutral_200","Card","onCardClicked","topSectionProps","middleSectionProps","bottomSectionProps","disabled","cls","defaultOnMouseDownHandler","a","key","e"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAEO,IAAMA,qBAAqB,GAAGC,0BAAOC,GAAV,0UACZC,SAAOC,KADK,CAA3B;;;;AAeA,IAAMC,OAAO,GAAGJ,0BAAOC,GAAV,ilBAKdI,aALc,EAWdN,qBAXc,EAcQG,SAAOI,WAdf,EAmBQJ,SAAOI,WAnBf,CAAb;;;;AAuCP,IAAMC,IAAwC,GAAG,SAA3CA,IAA2C,OAMkB;AAAA,MALfC,aAKe,QALfA,aAKe;AAAA,MAJfC,eAIe,QAJfA,eAIe;AAAA,MAHfC,kBAGe,QAHfA,kBAGe;AAAA,MAFfC,kBAEe,QAFfA,kBAEe;AAAA,MADfC,QACe,QADfA,QACe;AAGjE,MAAMC,GAAG,aAAM,CAAC,CAACL,aAAF,GAAkB,aAAlB,GAAkC,EAAxC,cAA8CI,QAAQ,GAAG,UAAH,GAAgB,EAAtE,CAAT;AAEA,sBAEE,qBAAC,OAAD;AAAS,IAAA,SAAS,EAAEC,GAApB;AACS,IAAA,QAAQ,EAAE,CAAC,CAACL,aAAF,IAAmB,CAACI,QAApB,GAA+B,CAA/B,GAAmC,CAAC,CADvD;AAES,IAAA,WAAW,EAAEE,2BAFtB;AAGS,IAAA,SAAS,EAAE,mBAAAC,CAAC;AAAA,aAAIA,CAAC,CAACC,GAAF,KAAU,OAAV,IAAqB,CAACJ,QAAtB,IAAkCJ,aAAlC,IAAmDA,aAAa,EAApE;AAAA,KAHrB;AAIS,IAAA,OAAO,EAAE,iBAAAS,CAAC;AAAA,aAAI,CAACL,QAAD,IAAaJ,aAAb,IAA8BA,aAAa,EAA/C;AAAA,KAJnB;AAAA,2BAKE,sBAAC,qBAAD;AAAA,iBACGC,eAAe,iBAAI,qBAAC,uBAAD,kCAAoBA,eAApB;AAAqC,QAAA,QAAQ,EAAEG;AAA/C,SADtB,EAEGF,kBAAkB,iBACjB,qBAAC,0BAAD,kCAAuBA,kBAAvB;AAA2C,QAAA,QAAQ,EAAEE;AAArD,SAHJ,EAIGD,kBAAkB,iBACjB,qBAAC,0BAAD,kCAAuBA,kBAAvB;AAA2C,QAAA,QAAQ,EAAEC;AAArD,SALJ;AAAA;AALF,IAFF;AAiBD,CA5BD;;;AAPEJ,EAAAA,a;AACAI,EAAAA,Q;;eAoCaL,I","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport CardTopSection, {CardTopSectionProps} from './CardTopSection';\nimport CardMiddleSection, {CardMiddleSectionProps} from './CardMiddleSection';\nimport CardBottomSection, {CardBottomSectionProps} from './CardBottomSection';\nimport {COLORS, defaultOnMouseDownHandler, focusStyles} from '..';\n\nexport const CardTopLevelContainer = styled.div`\n background-color: ${COLORS.white};\n\n box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);\n border-radius: 8px;\n\n border: 1px solid transparent;\n background-clip: padding-box;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n}\n`;\n\n\nexport const Wrapper = styled.div`\n height: max-content;\n width: max-content;\n\n &.interactive:focus {\n ${focusStyles}\n }\n\n &.interactive:not(.disabled) {\n cursor: pointer;\n\n ${CardTopLevelContainer} {\n &:active, &.active-state {\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.15);\n border: 1px solid ${COLORS.neutral_200};\n }\n\n &:hover {\n overflow: visible;\n border: 1px solid ${COLORS.neutral_200};\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.15);\n }\n }\n }\n\n &.disabled {\n cursor: not-allowed;\n }\n`;\n\n\nexport interface CardProps {\n onCardClicked?: () => {};\n disabled: boolean;\n topSectionProps?: CardTopSectionProps;\n middleSectionProps?: CardMiddleSectionProps;\n bottomSectionProps?: CardBottomSectionProps;\n}\n\nconst Card: React.FunctionComponent<CardProps> = ({\n onCardClicked,\n topSectionProps,\n middleSectionProps,\n bottomSectionProps,\n disabled\n }: CardProps) => {\n\n\n const cls = `${!!onCardClicked ? 'interactive' : ''} ${disabled ? 'disabled' : ''}`;\n\n return (\n\n <Wrapper className={cls}\n tabIndex={!!onCardClicked && !disabled ? 0 : -1}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyDown={a => a.key === 'Enter' && !disabled && onCardClicked && onCardClicked()}\n onClick={e => !disabled && onCardClicked && onCardClicked()}>\n <CardTopLevelContainer>\n {topSectionProps && <CardTopSection {...topSectionProps} disabled={disabled}/>}\n {middleSectionProps &&\n <CardMiddleSection {...middleSectionProps} disabled={disabled}/>}\n {bottomSectionProps &&\n <CardBottomSection {...bottomSectionProps} disabled={disabled}/>}\n </CardTopLevelContainer>\n </Wrapper>\n\n );\n};\n\nexport default Card;\n"],"file":"Card.cjs"}
@@ -6,11 +6,10 @@ export declare const CardTopLevelContainer: import("styled-components").StyledCo
6
6
  export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
7
7
  export interface CardProps {
8
8
  onCardClicked?: () => {};
9
- disabled?: boolean;
9
+ disabled: boolean;
10
10
  topSectionProps?: CardTopSectionProps;
11
11
  middleSectionProps?: CardMiddleSectionProps;
12
12
  bottomSectionProps?: CardBottomSectionProps;
13
- variant?: 'outline' | 'elevated';
14
13
  }
15
14
  declare const Card: React.FunctionComponent<CardProps>;
16
15
  export default Card;
@@ -1,6 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
5
3
  import _pt from "prop-types";
6
4
 
@@ -15,32 +13,20 @@ import styled from 'styled-components';
15
13
  import CardTopSection from './CardTopSection';
16
14
  import CardMiddleSection from './CardMiddleSection';
17
15
  import CardBottomSection from './CardBottomSection';
18
- import { BOXSHADOWS, COLORS, defaultOnMouseDownHandler, focusStyles, useActionWithin } from '../../index';
16
+ import { COLORS, defaultOnMouseDownHandler, focusStyles } from '..';
19
17
  import { jsx as _jsx } from "react/jsx-runtime";
20
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
21
- export var CardTopLevelContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n\n border-radius: 8px;\n\n background-clip: padding-box;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n\n .elevated & {\n box-shadow: ", ";\n }\n\n .outline & {\n border: 1px solid ", ";\n }\n"])), COLORS.white, BOXSHADOWS.BOXSHADOW_L1, COLORS.neutral_200);
22
- export var Wrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: max-content;\n width: max-content;\n\n &.interactive:focus {\n ", "\n }\n\n &.interactive:not(.disabled) {\n cursor: pointer;\n\n &.outline:not(.action-within) {\n ", " {\n &:hover {\n background-color: ", ";\n }\n\n &:active, &.active-state {\n background-color: ", ";\n }\n }\n }\n\n &.elevated:not(.action-within) {\n ", " {\n &:hover {\n box-shadow: ", ";\n }\n\n &:active, &.active-state {\n box-shadow: ", ";\n }\n }\n }\n }\n\n &.disabled {\n cursor: not-allowed;\n }\n"])), focusStyles, CardTopLevelContainer, COLORS.primary_20, COLORS.primary_100, CardTopLevelContainer, BOXSHADOWS.BOXSHADOW_L3, BOXSHADOWS.BOXSHADOW_L2);
19
+ export var CardTopLevelContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n\n box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);\n border-radius: 8px;\n\n border: 1px solid transparent;\n background-clip: padding-box;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n}\n"])), COLORS.white);
20
+ export var Wrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: max-content;\n width: max-content;\n\n &.interactive:focus {\n ", "\n }\n\n &.interactive:not(.disabled) {\n cursor: pointer;\n\n ", " {\n &:active, &.active-state {\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.15);\n border: 1px solid ", ";\n }\n\n &:hover {\n overflow: visible;\n border: 1px solid ", ";\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.15);\n }\n }\n }\n\n &.disabled {\n cursor: not-allowed;\n }\n"])), focusStyles, CardTopLevelContainer, COLORS.neutral_200, COLORS.neutral_200);
23
21
 
24
22
  var Card = function Card(_ref) {
25
23
  var onCardClicked = _ref.onCardClicked,
26
24
  topSectionProps = _ref.topSectionProps,
27
25
  middleSectionProps = _ref.middleSectionProps,
28
26
  bottomSectionProps = _ref.bottomSectionProps,
29
- disabled = _ref.disabled,
30
- _ref$variant = _ref.variant,
31
- variant = _ref$variant === void 0 ? 'outline' : _ref$variant;
32
-
33
- var _React$useState = React.useState([]),
34
- _React$useState2 = _slicedToArray(_React$useState, 2),
35
- actionsRefs = _React$useState2[0],
36
- setActionsRefs = _React$useState2[1];
37
-
38
- var checkBoxRef = React.useRef(null);
39
- var containerRef = React.useRef(null);
40
- useActionWithin(containerRef, [].concat(_toConsumableArray(actionsRefs), [checkBoxRef]));
41
- var cls = "".concat(!!onCardClicked ? 'interactive' : '', " ").concat(disabled ? 'disabled' : '', " ").concat(variant);
27
+ disabled = _ref.disabled;
28
+ var cls = "".concat(!!onCardClicked ? 'interactive' : '', " ").concat(disabled ? 'disabled' : '');
42
29
  return /*#__PURE__*/_jsx(Wrapper, {
43
- ref: containerRef,
44
30
  className: cls,
45
31
  tabIndex: !!onCardClicked && !disabled ? 0 : -1,
46
32
  onMouseDown: defaultOnMouseDownHandler,
@@ -51,17 +37,11 @@ var Card = function Card(_ref) {
51
37
  return !disabled && onCardClicked && onCardClicked();
52
38
  },
53
39
  children: /*#__PURE__*/_jsxs(CardTopLevelContainer, {
54
- children: [topSectionProps && /*#__PURE__*/_jsx(CardTopSection, _objectSpread(_objectSpread({
55
- ref: checkBoxRef
56
- }, topSectionProps), {}, {
40
+ children: [topSectionProps && /*#__PURE__*/_jsx(CardTopSection, _objectSpread(_objectSpread({}, topSectionProps), {}, {
57
41
  disabled: disabled
58
42
  })), middleSectionProps && /*#__PURE__*/_jsx(CardMiddleSection, _objectSpread(_objectSpread({}, middleSectionProps), {}, {
59
43
  disabled: disabled
60
- })), bottomSectionProps && /*#__PURE__*/_jsx(CardBottomSection, _objectSpread(_objectSpread({
61
- ref: function ref(instance) {
62
- return setActionsRefs(instance !== null && instance !== void 0 ? instance : []);
63
- }
64
- }, bottomSectionProps), {}, {
44
+ })), bottomSectionProps && /*#__PURE__*/_jsx(CardBottomSection, _objectSpread(_objectSpread({}, bottomSectionProps), {}, {
65
45
  disabled: disabled
66
46
  }))]
67
47
  })
@@ -70,8 +50,7 @@ var Card = function Card(_ref) {
70
50
 
71
51
  Card.propTypes = {
72
52
  onCardClicked: _pt.func,
73
- disabled: _pt.bool,
74
- variant: _pt.oneOf(['outline', 'elevated'])
53
+ disabled: _pt.bool.isRequired
75
54
  };
76
55
  export default Card;
77
56
  //# sourceMappingURL=Card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Card/Card.tsx"],"names":["React","styled","CardTopSection","CardMiddleSection","CardBottomSection","COLORS","defaultOnMouseDownHandler","focusStyles","CardTopLevelContainer","div","white","Wrapper","neutral_200","Card","onCardClicked","topSectionProps","middleSectionProps","bottomSectionProps","disabled","cls","a","key","e"],"mappings":";;;;;;;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,OAAOC,cAAP,MAAkD,kBAAlD;AACA,OAAOC,iBAAP,MAAwD,qBAAxD;AACA,OAAOC,iBAAP,MAAwD,qBAAxD;AACA,SAAQC,MAAR,EAAgBC,yBAAhB,EAA2CC,WAA3C,QAA6D,IAA7D;;;AAEA,OAAO,IAAMC,qBAAqB,GAAGP,MAAM,CAACQ,GAAV,4TACZJ,MAAM,CAACK,KADK,CAA3B;AAeP,OAAO,IAAMC,OAAO,GAAGV,MAAM,CAACQ,GAAV,mkBAKdF,WALc,EAWdC,qBAXc,EAcQH,MAAM,CAACO,WAdf,EAmBQP,MAAM,CAACO,WAnBf,CAAb;;AAuCP,IAAMC,IAAwC,GAAG,SAA3CA,IAA2C,OAMkB;AAAA,MALfC,aAKe,QALfA,aAKe;AAAA,MAJfC,eAIe,QAJfA,eAIe;AAAA,MAHfC,kBAGe,QAHfA,kBAGe;AAAA,MAFfC,kBAEe,QAFfA,kBAEe;AAAA,MADfC,QACe,QADfA,QACe;AAGjE,MAAMC,GAAG,aAAM,CAAC,CAACL,aAAF,GAAkB,aAAlB,GAAkC,EAAxC,cAA8CI,QAAQ,GAAG,UAAH,GAAgB,EAAtE,CAAT;AAEA,sBAEE,KAAC,OAAD;AAAS,IAAA,SAAS,EAAEC,GAApB;AACS,IAAA,QAAQ,EAAE,CAAC,CAACL,aAAF,IAAmB,CAACI,QAApB,GAA+B,CAA/B,GAAmC,CAAC,CADvD;AAES,IAAA,WAAW,EAAEZ,yBAFtB;AAGS,IAAA,SAAS,EAAE,mBAAAc,CAAC;AAAA,aAAIA,CAAC,CAACC,GAAF,KAAU,OAAV,IAAqB,CAACH,QAAtB,IAAkCJ,aAAlC,IAAmDA,aAAa,EAApE;AAAA,KAHrB;AAIS,IAAA,OAAO,EAAE,iBAAAQ,CAAC;AAAA,aAAI,CAACJ,QAAD,IAAaJ,aAAb,IAA8BA,aAAa,EAA/C;AAAA,KAJnB;AAAA,2BAKE,MAAC,qBAAD;AAAA,iBACGC,eAAe,iBAAI,KAAC,cAAD,kCAAoBA,eAApB;AAAqC,QAAA,QAAQ,EAAEG;AAA/C,SADtB,EAEGF,kBAAkB,iBACjB,KAAC,iBAAD,kCAAuBA,kBAAvB;AAA2C,QAAA,QAAQ,EAAEE;AAArD,SAHJ,EAIGD,kBAAkB,iBACjB,KAAC,iBAAD,kCAAuBA,kBAAvB;AAA2C,QAAA,QAAQ,EAAEC;AAArD,SALJ;AAAA;AALF,IAFF;AAiBD,CA5BD;;;AAPEJ,EAAAA,a;AACAI,EAAAA,Q;;AAoCF,eAAeL,IAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport CardTopSection, {CardTopSectionProps} from './CardTopSection';\nimport CardMiddleSection, {CardMiddleSectionProps} from './CardMiddleSection';\nimport CardBottomSection, {CardBottomSectionProps} from './CardBottomSection';\nimport {COLORS, defaultOnMouseDownHandler, focusStyles} from '..';\n\nexport const CardTopLevelContainer = styled.div`\n background-color: ${COLORS.white};\n\n box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);\n border-radius: 8px;\n\n border: 1px solid transparent;\n background-clip: padding-box;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n}\n`;\n\n\nexport const Wrapper = styled.div`\n height: max-content;\n width: max-content;\n\n &.interactive:focus {\n ${focusStyles}\n }\n\n &.interactive:not(.disabled) {\n cursor: pointer;\n\n ${CardTopLevelContainer} {\n &:active, &.active-state {\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.15);\n border: 1px solid ${COLORS.neutral_200};\n }\n\n &:hover {\n overflow: visible;\n border: 1px solid ${COLORS.neutral_200};\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.15);\n }\n }\n }\n\n &.disabled {\n cursor: not-allowed;\n }\n`;\n\n\nexport interface CardProps {\n onCardClicked?: () => {};\n disabled: boolean;\n topSectionProps?: CardTopSectionProps;\n middleSectionProps?: CardMiddleSectionProps;\n bottomSectionProps?: CardBottomSectionProps;\n}\n\nconst Card: React.FunctionComponent<CardProps> = ({\n onCardClicked,\n topSectionProps,\n middleSectionProps,\n bottomSectionProps,\n disabled\n }: CardProps) => {\n\n\n const cls = `${!!onCardClicked ? 'interactive' : ''} ${disabled ? 'disabled' : ''}`;\n\n return (\n\n <Wrapper className={cls}\n tabIndex={!!onCardClicked && !disabled ? 0 : -1}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyDown={a => a.key === 'Enter' && !disabled && onCardClicked && onCardClicked()}\n onClick={e => !disabled && onCardClicked && onCardClicked()}>\n <CardTopLevelContainer>\n {topSectionProps && <CardTopSection {...topSectionProps} disabled={disabled}/>}\n {middleSectionProps &&\n <CardMiddleSection {...middleSectionProps} disabled={disabled}/>}\n {bottomSectionProps &&\n <CardBottomSection {...bottomSectionProps} disabled={disabled}/>}\n </CardTopLevelContainer>\n </Wrapper>\n\n );\n};\n\nexport default Card;\n"],"file":"Card.js"}
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports.default = exports.CardProgressContainer = exports.CardNotesContainer = exports.CardNoteRight = exports.CardNoteLeft = exports.CardButtonRowContainer = exports.CardBottomSectionContainer = exports.CardBottomDivider = exports.CardAuthorContainer = void 0;
11
11
 
12
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
-
14
12
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
13
 
16
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -19,9 +17,9 @@ var React = _interopRequireWildcard(require("react"));
19
17
 
20
18
  var _styledComponents = _interopRequireDefault(require("styled-components"));
21
19
 
22
- var _index = require("../../index");
20
+ var _ = require("..");
23
21
 
24
- var _Button = require("../../Button");
22
+ var _Button = require("../Button");
25
23
 
26
24
  var _jsxRuntime = require("react/jsx-runtime");
27
25
 
@@ -35,17 +33,17 @@ var CardProgressContainer = _styledComponents.default.div(_templateObject || (_t
35
33
 
36
34
  exports.CardProgressContainer = CardProgressContainer;
37
35
 
38
- var CardNotesContainer = _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"])), _index.COLORS.neutral_500);
36
+ var CardNotesContainer = _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);
39
37
 
40
38
  exports.CardNotesContainer = CardNotesContainer;
41
39
 
42
40
  var CardAuthorContainer = _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) {
43
- return props.disabled ? "\n color: ".concat(_index.COLORS.neutral_300, ";\n svg, img {\n filter: grayscale(100%);\n }\n \n ") : '';
41
+ return props.disabled ? "\n color: ".concat(_.COLORS.neutral_300, ";\n svg, img {\n filter: grayscale(100%);\n }\n \n ") : '';
44
42
  });
45
43
 
46
44
  exports.CardAuthorContainer = CardAuthorContainer;
47
45
 
48
- var CardBottomDivider = _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"])), _index.COLORS.neutral_100);
46
+ var CardBottomDivider = _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);
49
47
 
50
48
  exports.CardBottomDivider = CardBottomDivider;
51
49
 
@@ -57,18 +55,19 @@ var CardNoteRight = _styledComponents.default.div(_templateObject6 || (_template
57
55
 
58
56
  exports.CardNoteRight = CardNoteRight;
59
57
 
60
- var CardButtonRowContainer = _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"])), _index.COLORS.neutral_100, _index.COLORS.neutral_600);
58
+ var CardButtonRowContainer = _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);
61
59
 
62
60
  exports.CardButtonRowContainer = CardButtonRowContainer;
63
61
 
64
62
  var CardBottomSectionContainer = _styledComponents.default.div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n padding: 0px 16px 8px 16px;\n width: calc(100% - 32px);\n"])));
65
63
 
66
64
  exports.CardBottomSectionContainer = CardBottomSectionContainer;
67
- var CardBottomSection = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
65
+
66
+ var CardBottomSection = function CardBottomSection(_ref) {
68
67
  var progressLevel = _ref.progressLevel,
69
68
  progressMax = _ref.progressMax,
70
69
  _ref$progressType = _ref.progressType,
71
- progressType = _ref$progressType === void 0 ? _index.LinearProgressType.Line : _ref$progressType,
70
+ progressType = _ref$progressType === void 0 ? _.LinearProgressType.Line : _ref$progressType,
72
71
  noteLeft = _ref.noteLeft,
73
72
  noteLeftIcon = _ref.noteLeftIcon,
74
73
  noteRight = _ref.noteRight,
@@ -77,66 +76,52 @@ var CardBottomSection = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
77
76
  logo = _ref.logo,
78
77
  actions = _ref.actions,
79
78
  disabled = _ref.disabled;
80
-
81
- var _React$useState = React.useState([]),
82
- _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
83
- elRefs = _React$useState2[0],
84
- setElRefs = _React$useState2[1];
85
-
86
- var length = (actions === null || actions === void 0 ? void 0 : actions.length) || 0;
87
- React.useEffect(function () {
88
- setElRefs(Array(length || 0).fill(null).map(function () {
89
- return /*#__PURE__*/React.createRef();
90
- }));
91
- }, [length]);
92
- React.useImperativeHandle(ref, function () {
93
- return elRefs;
94
- }, [elRefs]);
95
79
  var haveAtLeastSomething = progressLevel != undefined || noteLeft || noteLeftIcon || noteRight || noteRightIcon || authorName;
96
80
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(CardBottomSectionContainer, {
97
81
  children: [haveAtLeastSomething && /*#__PURE__*/(0, _jsxRuntime.jsx)(CardBottomDivider, {}), progressLevel != undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(CardProgressContainer, {
98
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.LinearProgress, {
99
- size: _index.Size.Small,
82
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.LinearProgress, {
83
+ size: _.Size.Small,
100
84
  type: progressType,
101
- variant: _index.LinearProgressVariant.Normal,
85
+ variant: _.LinearProgressVariant.Normal,
102
86
  value: progressLevel,
103
87
  max: progressMax !== null && progressMax !== void 0 ? progressMax : progressLevel
104
88
  })
105
89
  }), (noteLeft || noteLeftIcon || noteRight || noteRightIcon) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(CardNotesContainer, {
106
90
  children: [(noteLeft || noteLeftIcon) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(CardNoteLeft, {
107
- children: [noteLeftIcon, /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ComponentXXS, {
108
- color: _index.COLORS.neutral_500,
109
- textStyle: _index.ComponentTextStyle.Bold,
91
+ children: [noteLeftIcon, /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ComponentXXS, {
92
+ color: _.COLORS.neutral_500,
93
+ textStyle: _.ComponentTextStyle.Bold,
110
94
  children: noteLeft
111
95
  })]
112
96
  }), (noteRight || noteRightIcon) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(CardNoteRight, {
113
- children: [noteRightIcon, /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ComponentXXS, {
114
- color: _index.COLORS.neutral_500,
115
- textStyle: _index.ComponentTextStyle.Bold,
97
+ children: [noteRightIcon, /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ComponentXXS, {
98
+ color: _.COLORS.neutral_500,
99
+ textStyle: _.ComponentTextStyle.Bold,
116
100
  children: noteRight
117
101
  })]
118
102
  })]
119
103
  }), (authorName || logo) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(CardAuthorContainer, {
120
104
  disabled: disabled,
121
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ComponentXXS, {
105
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.ComponentXXS, {
122
106
  children: authorName
123
107
  }), logo]
124
108
  }), actions && /*#__PURE__*/(0, _jsxRuntime.jsx)(CardButtonRowContainer, {
125
- children: actions.map(function (x, index) {
109
+ children: actions.map(function (x) {
126
110
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
127
- ref: elRefs[index],
128
111
  disabled: disabled,
129
112
  variant: "secondary",
130
113
  shape: "circular",
131
114
  action: function action(e) {
115
+ e === null || e === void 0 ? void 0 : e.stopPropagation();
132
116
  x.onClick();
133
117
  },
134
118
  children: x.icon
135
- }, index);
119
+ });
136
120
  })
137
121
  })]
138
122
  });
139
- });
123
+ };
124
+
140
125
  CardBottomSection.propTypes = {
141
126
  progressLevel: _propTypes.default.number,
142
127
  progressMax: _propTypes.default.number,
@@ -150,7 +135,7 @@ CardBottomSection.propTypes = {
150
135
  onClick: _propTypes.default.func.isRequired
151
136
  })),
152
137
  logo: _propTypes.default.node,
153
- disabled: _propTypes.default.bool
138
+ disabled: _propTypes.default.bool.isRequired
154
139
  };
155
140
  var _default = CardBottomSection;
156
141
  exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Card/CardBottomSection.tsx"],"names":["CardProgressContainer","styled","div","CardNotesContainer","COLORS","neutral_500","CardAuthorContainer","props","disabled","neutral_300","CardBottomDivider","neutral_100","CardNoteLeft","CardNoteRight","CardButtonRowContainer","neutral_600","CardBottomSectionContainer","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":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;AAuBO,IAAMA,qBAAqB,GAAGC,0BAAOC,GAAV,wGAA3B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AgC,UAAA,OAAO,EAAC,WAAxC;AAAoD,UAAA,KAAK,EAAC,UAA1D;AAAqE,UAAA,MAAM,EAAE,gBAACgC,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,CAvDD;;;AAnHEzB,EAAAA,a;AACAC,EAAAA,W;AAGAI,EAAAA,Q;AACAC,EAAAA,Y;AACAC,EAAAA,S;AACAC,EAAAA,a;AAEAC,EAAAA,U;AACAE,EAAAA,O;AAfAc,IAAAA,I;AACAD,IAAAA,O;;AAeAd,EAAAA,I;AACApB,EAAAA,Q;;eAgKaS,iB","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { COLORS, ComponentTextStyle, ComponentXXS, LinearProgress, LinearProgressType, LinearProgressVariant, Size } from '..';\nimport { IconButton } from '../Button';\n\nexport interface ActionItem {\n icon: React.ReactNode;\n onClick: () => void;\n}\n\nexport interface CardBottomSectionProps {\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\nexport const CardProgressContainer = styled.div`\n padding: 8px 0;\n`;\n\nexport const CardNotesContainer = 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\nexport const CardAuthorContainer = 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\nexport const CardBottomDivider = styled.div`\n border-top: 1px;\n border-top-color: ${COLORS.neutral_100};\n border-top-style: solid;\n width: 100%;\n`;\n\nexport const CardNoteLeft = 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\nexport const CardNoteRight = 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\nexport const CardButtonRowContainer = 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\nexport const CardBottomSectionContainer = styled.div`\n padding: 0px 16px 8px 16px;\n width: calc(100% - 32px);\n`;\n\nconst CardBottomSection: React.FunctionComponent<CardBottomSectionProps> = ({\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 <CardBottomSectionContainer>\n {haveAtLeastSomething && <CardBottomDivider />}\n {progressLevel != undefined && <CardProgressContainer>\n <LinearProgress size={Size.Small}\n type={progressType}\n variant={LinearProgressVariant.Normal}\n value={progressLevel}\n max={progressMax ?? progressLevel} />\n </CardProgressContainer>}\n\n {(noteLeft || noteLeftIcon || noteRight || noteRightIcon) && <CardNotesContainer>\n {(noteLeft || noteLeftIcon) && (\n <CardNoteLeft>\n {noteLeftIcon}\n <ComponentXXS color={COLORS.neutral_500} textStyle={ComponentTextStyle.Bold}>{noteLeft}</ComponentXXS>\n </CardNoteLeft>\n )}\n {(noteRight || noteRightIcon) && (\n <CardNoteRight>\n {noteRightIcon}\n <ComponentXXS color={COLORS.neutral_500} textStyle={ComponentTextStyle.Bold}>{noteRight}</ComponentXXS>\n </CardNoteRight>\n )}\n </CardNotesContainer>}\n\n {(authorName || logo) && <CardAuthorContainer disabled={disabled}>\n <ComponentXXS>{authorName}</ComponentXXS>\n {logo}\n </CardAuthorContainer>}\n\n {actions && <CardButtonRowContainer>\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 </CardButtonRowContainer>}\n </CardBottomSectionContainer>\n );\n};\n\nexport default CardBottomSection;\n"],"file":"CardBottomSection.cjs"}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { LinearProgressType } from '../../index';
2
+ import { LinearProgressType } from '..';
3
3
  export interface ActionItem {
4
4
  icon: React.ReactNode;
5
5
  onClick: () => void;
@@ -15,17 +15,17 @@ export interface CardBottomSectionProps {
15
15
  authorName?: string;
16
16
  actions?: ActionItem[];
17
17
  logo?: React.ReactNode;
18
- disabled?: boolean;
18
+ disabled: boolean;
19
19
  }
20
20
  export declare const CardProgressContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
21
21
  export declare const CardNotesContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
22
22
  export declare const CardAuthorContainer: import("styled-components").StyledComponent<"div", any, {
23
- disabled?: boolean | undefined;
23
+ disabled: boolean;
24
24
  }, never>;
25
25
  export declare const CardBottomDivider: import("styled-components").StyledComponent<"div", any, {}, never>;
26
26
  export declare const CardNoteLeft: import("styled-components").StyledComponent<"div", any, {}, never>;
27
27
  export declare const CardNoteRight: import("styled-components").StyledComponent<"div", any, {}, never>;
28
28
  export declare const CardButtonRowContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
29
29
  export declare const CardBottomSectionContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
30
- declare const CardBottomSection: React.ForwardRefExoticComponent<CardBottomSectionProps & React.RefAttributes<React.RefObject<HTMLButtonElement>[]>>;
30
+ declare const CardBottomSection: React.FunctionComponent<CardBottomSectionProps>;
31
31
  export default CardBottomSection;
@@ -1,4 +1,3 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
3
2
  import _pt from "prop-types";
4
3
 
@@ -6,8 +5,8 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
6
5
 
7
6
  import * as React from 'react';
8
7
  import styled from 'styled-components';
9
- import { COLORS, ComponentTextStyle, ComponentXXS, LinearProgress, LinearProgressType, LinearProgressVariant, Size } from '../../index';
10
- import { IconButton } from '../../Button';
8
+ import { COLORS, ComponentTextStyle, ComponentXXS, LinearProgress, LinearProgressType, LinearProgressVariant, Size } from '..';
9
+ import { IconButton } from '../Button';
11
10
  import { jsx as _jsx } from "react/jsx-runtime";
12
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
12
  export var CardProgressContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 8px 0;\n"])));
@@ -18,9 +17,10 @@ export var CardAuthorContainer = styled.div(_templateObject3 || (_templateObject
18
17
  export var CardBottomDivider = 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);
19
18
  export var CardNoteLeft = 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"])));
20
19
  export var CardNoteRight = 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"])));
21
- export var CardButtonRowContainer = 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);
20
+ export var CardButtonRowContainer = 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);
22
21
  export var CardBottomSectionContainer = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n padding: 0px 16px 8px 16px;\n width: calc(100% - 32px);\n"])));
23
- var CardBottomSection = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
22
+
23
+ var CardBottomSection = function CardBottomSection(_ref) {
24
24
  var progressLevel = _ref.progressLevel,
25
25
  progressMax = _ref.progressMax,
26
26
  _ref$progressType = _ref.progressType,
@@ -33,21 +33,6 @@ var CardBottomSection = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
33
33
  logo = _ref.logo,
34
34
  actions = _ref.actions,
35
35
  disabled = _ref.disabled;
36
-
37
- var _React$useState = React.useState([]),
38
- _React$useState2 = _slicedToArray(_React$useState, 2),
39
- elRefs = _React$useState2[0],
40
- setElRefs = _React$useState2[1];
41
-
42
- var length = (actions === null || actions === void 0 ? void 0 : actions.length) || 0;
43
- React.useEffect(function () {
44
- setElRefs(Array(length || 0).fill(null).map(function () {
45
- return /*#__PURE__*/React.createRef();
46
- }));
47
- }, [length]);
48
- React.useImperativeHandle(ref, function () {
49
- return elRefs;
50
- }, [elRefs]);
51
36
  var haveAtLeastSomething = progressLevel != undefined || noteLeft || noteLeftIcon || noteRight || noteRightIcon || authorName;
52
37
  return /*#__PURE__*/_jsxs(CardBottomSectionContainer, {
53
38
  children: [haveAtLeastSomething && /*#__PURE__*/_jsx(CardBottomDivider, {}), progressLevel != undefined && /*#__PURE__*/_jsx(CardProgressContainer, {
@@ -78,21 +63,22 @@ var CardBottomSection = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
78
63
  children: authorName
79
64
  }), logo]
80
65
  }), actions && /*#__PURE__*/_jsx(CardButtonRowContainer, {
81
- children: actions.map(function (x, index) {
66
+ children: actions.map(function (x) {
82
67
  return /*#__PURE__*/_jsx(IconButton, {
83
- ref: elRefs[index],
84
68
  disabled: disabled,
85
69
  variant: "secondary",
86
70
  shape: "circular",
87
71
  action: function action(e) {
72
+ e === null || e === void 0 ? void 0 : e.stopPropagation();
88
73
  x.onClick();
89
74
  },
90
75
  children: x.icon
91
- }, index);
76
+ });
92
77
  })
93
78
  })]
94
79
  });
95
- });
80
+ };
81
+
96
82
  CardBottomSection.propTypes = {
97
83
  progressLevel: _pt.number,
98
84
  progressMax: _pt.number,
@@ -106,7 +92,7 @@ CardBottomSection.propTypes = {
106
92
  onClick: _pt.func.isRequired
107
93
  })),
108
94
  logo: _pt.node,
109
- disabled: _pt.bool
95
+ disabled: _pt.bool.isRequired
110
96
  };
111
97
  export default CardBottomSection;
112
98
  //# sourceMappingURL=CardBottomSection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Card/CardBottomSection.tsx"],"names":["React","styled","COLORS","ComponentTextStyle","ComponentXXS","LinearProgress","LinearProgressType","LinearProgressVariant","Size","IconButton","CardProgressContainer","div","CardNotesContainer","neutral_500","CardAuthorContainer","props","disabled","neutral_300","CardBottomDivider","neutral_100","CardNoteLeft","CardNoteRight","CardButtonRowContainer","neutral_600","CardBottomSectionContainer","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,cAAnD,EAAmEC,kBAAnE,EAAuFC,qBAAvF,EAA8GC,IAA9G,QAA0H,IAA1H;AACA,SAASC,UAAT,QAA2B,WAA3B;;;AAuBA,OAAO,IAAMC,qBAAqB,GAAGT,MAAM,CAACU,GAAV,0FAA3B;AAIP,OAAO,IAAMC,kBAAkB,GAAGX,MAAM,CAACU,GAAV,oMAGpBT,MAAM,CAACW,WAHa,CAAxB;AASP,OAAO,IAAMC,mBAAmB,GAAGb,MAAM,CAACU,GAAV,qSAgB5B,UAAAI,KAAK;AAAA,SAAIA,KAAK,CAACC,QAAN,0BACAd,MAAM,CAACe,WADP,0EAMP,EANG;AAAA,CAhBuB,CAAzB;AAyBP,OAAO,IAAMC,iBAAiB,GAAGjB,MAAM,CAACU,GAAV,qKAERT,MAAM,CAACiB,WAFC,CAAvB;AAOP,OAAO,IAAMC,YAAY,GAAGnB,MAAM,CAACU,GAAV,gQAAlB;AAcP,OAAO,IAAMU,aAAa,GAAGpB,MAAM,CAACU,GAAV,iQAAnB;AAcP,OAAO,IAAMW,sBAAsB,GAAGrB,MAAM,CAACU,GAAV,oZAMbT,MAAM,CAACiB,WANM,EAkBtBjB,MAAM,CAACqB,WAlBe,CAA5B;AAsBP,OAAO,IAAMC,0BAA0B,GAAGvB,MAAM,CAACU,GAAV,qIAAhC;;AAKP,IAAMc,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styled-components';\nimport { COLORS, ComponentTextStyle, ComponentXXS, LinearProgress, LinearProgressType, LinearProgressVariant, Size } from '..';\nimport { IconButton } from '../Button';\n\nexport interface ActionItem {\n icon: React.ReactNode;\n onClick: () => void;\n}\n\nexport interface CardBottomSectionProps {\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\nexport const CardProgressContainer = styled.div`\n padding: 8px 0;\n`;\n\nexport const CardNotesContainer = 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\nexport const CardAuthorContainer = 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\nexport const CardBottomDivider = styled.div`\n border-top: 1px;\n border-top-color: ${COLORS.neutral_100};\n border-top-style: solid;\n width: 100%;\n`;\n\nexport const CardNoteLeft = 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\nexport const CardNoteRight = 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\nexport const CardButtonRowContainer = 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\nexport const CardBottomSectionContainer = styled.div`\n padding: 0px 16px 8px 16px;\n width: calc(100% - 32px);\n`;\n\nconst CardBottomSection: React.FunctionComponent<CardBottomSectionProps> = ({\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 <CardBottomSectionContainer>\n {haveAtLeastSomething && <CardBottomDivider />}\n {progressLevel != undefined && <CardProgressContainer>\n <LinearProgress size={Size.Small}\n type={progressType}\n variant={LinearProgressVariant.Normal}\n value={progressLevel}\n max={progressMax ?? progressLevel} />\n </CardProgressContainer>}\n\n {(noteLeft || noteLeftIcon || noteRight || noteRightIcon) && <CardNotesContainer>\n {(noteLeft || noteLeftIcon) && (\n <CardNoteLeft>\n {noteLeftIcon}\n <ComponentXXS color={COLORS.neutral_500} textStyle={ComponentTextStyle.Bold}>{noteLeft}</ComponentXXS>\n </CardNoteLeft>\n )}\n {(noteRight || noteRightIcon) && (\n <CardNoteRight>\n {noteRightIcon}\n <ComponentXXS color={COLORS.neutral_500} textStyle={ComponentTextStyle.Bold}>{noteRight}</ComponentXXS>\n </CardNoteRight>\n )}\n </CardNotesContainer>}\n\n {(authorName || logo) && <CardAuthorContainer disabled={disabled}>\n <ComponentXXS>{authorName}</ComponentXXS>\n {logo}\n </CardAuthorContainer>}\n\n {actions && <CardButtonRowContainer>\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 </CardButtonRowContainer>}\n </CardBottomSectionContainer>\n );\n};\n\nexport default CardBottomSection;\n"],"file":"CardBottomSection.js"}
@@ -17,7 +17,7 @@ var React = _interopRequireWildcard(require("react"));
17
17
 
18
18
  var _styledComponents = _interopRequireDefault(require("styled-components"));
19
19
 
20
- var _index = require("../../index");
20
+ var _ = require("..");
21
21
 
22
22
  var _jsxRuntime = require("react/jsx-runtime");
23
23
 
@@ -41,7 +41,7 @@ var CardTagsContainer = _styledComponents.default.div(_templateObject3 || (_temp
41
41
 
42
42
  exports.CardTagsContainer = CardTagsContainer;
43
43
 
44
- var CardCategoryContainer = _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"])), _index.COLORS.neutral_500);
44
+ var CardCategoryContainer = _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);
45
45
 
46
46
  exports.CardCategoryContainer = CardCategoryContainer;
47
47
 
@@ -60,25 +60,25 @@ var CardMiddleSection = function CardMiddleSection(_ref) {
60
60
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(CardCategoryContainer, {
61
61
  extraTopMargin: Boolean(colorBandColor),
62
62
  bottomMargin: Boolean(categoryIcon || categoryLabel),
63
- children: [categoryIcon, /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ComponentS, {
64
- textStyle: _index.ComponentTextStyle.Bold,
65
- color: _index.COLORS.neutral_500,
63
+ children: [categoryIcon, /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ComponentS, {
64
+ textStyle: _.ComponentTextStyle.Bold,
65
+ color: _.COLORS.neutral_500,
66
66
  children: categoryLabel
67
67
  })]
68
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ComponentXL, {
68
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ComponentXL, {
69
69
  className: "titleBlock",
70
- textStyle: _index.ComponentTextStyle.Bold,
71
- color: disabled ? _index.COLORS.neutral_500 : _index.COLORS.black,
70
+ textStyle: _.ComponentTextStyle.Bold,
71
+ color: disabled ? _.COLORS.neutral_500 : _.COLORS.black,
72
72
  children: title
73
- }), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ComponentS, {
73
+ }), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ComponentS, {
74
74
  className: "descriptionBlock",
75
- color: _index.COLORS.neutral_600,
75
+ color: _.COLORS.neutral_600,
76
76
  children: description
77
77
  }), tags && /*#__PURE__*/(0, _jsxRuntime.jsx)(CardTagsContainer, {
78
78
  children: tags.map(function (x, index) {
79
79
  var _x$variant;
80
80
 
81
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Tag, {
81
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tag, {
82
82
  label: x.label,
83
83
  variant: (_x$variant = x.variant) !== null && _x$variant !== void 0 ? _x$variant : 'neutral'
84
84
  }, "".concat(x.label, "_").concat(index));
@@ -87,7 +87,7 @@ var CardMiddleSection = function CardMiddleSection(_ref) {
87
87
  children: row2Tags.map(function (x, index) {
88
88
  var _x$variant2;
89
89
 
90
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Tag, {
90
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Tag, {
91
91
  label: x.label,
92
92
  variant: (_x$variant2 = x.variant) !== null && _x$variant2 !== void 0 ? _x$variant2 : 'neutral'
93
93
  }, "".concat(x.label, "_").concat(index));
@@ -108,7 +108,7 @@ CardMiddleSection.propTypes = {
108
108
  row2Tags: _propTypes.default.arrayOf(_propTypes.default.shape({
109
109
  label: _propTypes.default.string.isRequired
110
110
  })),
111
- disabled: _propTypes.default.bool
111
+ disabled: _propTypes.default.bool.isRequired
112
112
  };
113
113
  var _default = CardMiddleSection;
114
114
  exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Card/CardMiddleSection.tsx"],"names":["CardMiddleSectionContainer","styled","div","CardColorBand","props","$color","CardTagsContainer","CardCategoryContainer","COLORS","neutral_500","CardMiddleSection","colorBandColor","categoryIcon","categoryLabel","title","description","tags","row2Tags","disabled","Boolean","ComponentTextStyle","Bold","black","neutral_600","map","x","index","label","variant"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;AAkBO,IAAMA,0BAA0B,GAAGC,0BAAOC,GAAV,sUAAhC;;;;AAkBA,IAAMC,aAAa,GAAGF,0BAAOC,GAAV,qMAMJ,UAACE,KAAD;AAAA,SAAWA,KAAK,CAACC,MAAjB;AAAA,CANI,CAAnB;;;;AASA,IAAMC,iBAAiB,GAAGL,0BAAOC,GAAV,qLAAvB;;;;AAQA,IAAMK,qBAAqB,GAAGN,0BAAOC,GAAV,mQAQrBM,SAAOC,WARc,CAA3B;;;;AAcP,IAAMC,iBAAkE,GAAG,SAArEA,iBAAqE,OAS7C;AAAA,MAR5BC,cAQ4B,QAR5BA,cAQ4B;AAAA,MAP5BC,YAO4B,QAP5BA,YAO4B;AAAA,MAN5BC,aAM4B,QAN5BA,aAM4B;AAAA,MAL5BC,KAK4B,QAL5BA,KAK4B;AAAA,MAJ5BC,WAI4B,QAJ5BA,WAI4B;AAAA,MAH5BC,IAG4B,QAH5BA,IAG4B;AAAA,MAF5BC,QAE4B,QAF5BA,QAE4B;AAAA,MAD5BC,QAC4B,QAD5BA,QAC4B;AAC5B,sBACE,sBAAC,0BAAD;AAAA,eACGP,cAAc,iBAAI,qBAAC,aAAD;AAAe,MAAA,MAAM,EAAEA;AAAvB,MADrB,eAEE,sBAAC,qBAAD;AAAuB,MAAA,cAAc,EAAEQ,OAAO,CAACR,cAAD,CAA9C;AAAgE,MAAA,YAAY,EAAEQ,OAAO,CAACP,YAAY,IAAIC,aAAjB,CAArF;AA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MAW,IAAAA,K;;AALAV,EAAAA,Q;AAKAU,IAAAA,K;;AAJAT,EAAAA,Q;;eAsGaR,iB","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { COLORS, ComponentS, ComponentTextStyle, ComponentXL, Tag, TagVariants } from '..';\n\nexport interface CardMiddleSectionProps {\n colorBandColor?: string;\n categoryIcon?: React.ReactNode;\n categoryLabel?: string;\n title: string;\n description?: string;\n tags?: CardTag[];\n row2Tags?: CardTag[];\n disabled: boolean;\n}\n\nexport interface CardTag {\n label: string;\n variant?: TagVariants;\n}\n\nexport const CardMiddleSectionContainer = styled.div`\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\nexport const CardColorBand = 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\nexport const CardTagsContainer = styled.div`\n display: flex;\n flex-direction: row;\n padding: 4px 0;\n gap: 4px;\n flex-wrap: wrap;\n`;\n\nexport const CardCategoryContainer = 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 colorBandColor,\n categoryIcon,\n categoryLabel,\n title,\n description,\n tags,\n row2Tags,\n disabled,\n}: CardMiddleSectionProps) => {\n return (\n <CardMiddleSectionContainer>\n {colorBandColor && <CardColorBand $color={colorBandColor} />}\n <CardCategoryContainer extraTopMargin={Boolean(colorBandColor)} bottomMargin={Boolean(categoryIcon || categoryLabel)}>\n {categoryIcon}\n <ComponentS textStyle={ComponentTextStyle.Bold} color={COLORS.neutral_500}>\n {categoryLabel}\n </ComponentS>\n </CardCategoryContainer>\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 <CardTagsContainer>\n {tags.map((x, index) => (\n <Tag key={`${x.label}_${index}`} label={x.label} variant={x.variant ?? 'neutral'} />\n ))}\n </CardTagsContainer>\n )}\n {row2Tags && (\n <CardTagsContainer>\n {row2Tags.map((x, index) => (\n <Tag key={`${x.label}_${index}`} label={x.label} variant={x.variant ?? 'neutral'} />\n ))}\n </CardTagsContainer>\n )}\n </CardMiddleSectionContainer>\n );\n};\n\nexport default CardMiddleSection;\n"],"file":"CardMiddleSection.cjs"}