@laerdal/life-react-components 1.2.1-dev.1.full → 1.2.1-dev.2

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.
@@ -11,19 +11,21 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
 
14
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
14
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
15
15
 
16
- var _Button = require("../Button");
16
+ var _styles = require("../styles");
17
17
 
18
- var _SystemIcons = require("../icons/systemicons/SystemIcons");
18
+ var _typography = require("../styles/typography");
19
19
 
20
- var _styles = require("../styles");
20
+ var _Tooltips = require("../Tooltips");
21
21
 
22
- var _ListRowDropdown = _interopRequireDefault(require("./ListRowDropdown"));
22
+ var _Dropdown = require("../Dropdown");
23
23
 
24
- var _typography = require("../styles/typography");
24
+ var _icons = require("../icons");
25
25
 
26
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
26
+ var _types = require("../types");
27
+
28
+ var _templateObject;
27
29
 
28
30
  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
31
 
@@ -31,6 +33,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
31
33
 
32
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
35
 
36
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
37
+
34
38
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
35
39
 
36
40
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -45,135 +49,88 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
45
49
 
46
50
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
47
51
 
48
- var handleListHeight = function handleListHeight(size) {
49
- switch (size) {
50
- case 'small':
51
- return '48px;';
52
-
53
- case 'medium':
54
- return '56px;';
55
-
56
- default:
57
- return '64px;';
58
- }
59
- };
60
-
61
- var RowWrapper = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &:nth-child(even) {\n background-color: ", ";\n }\n\n .interaction {\n :hover {\n background-color: white;\n }\n\n :focus {\n background-color: white;\n }\n\n :active { \n background-color: white;\n }\n }\n"])), function (props) {
62
- return props.disableDifferentBackgroundforEvenNumbers ? 'inherit' : _styles.COLORS.neutral_20;
63
- });
64
-
65
- var DisabledState = (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n pointer-events: none;\n background-color: white;\n"])));
66
-
67
- var EditRow = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n padding: 8px 12px;\n align-items: center;\n\n ", "\n\n height : ", "\n\n .user-actions {\n display: flex;\n position: relative;\n align-items: center;\n }\n\n .somePaddingForAlignment {\n padding: 0 3px 0 0;\n }\n\n &:hover { \n background-color: ", "; \n }\n\n &:focus { \n background-color: white;\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2E7FA1; \n }\n \n &:active { \n background-color: ", ";\n }\n"])), function (props) {
68
- return props.disabled ? DisabledState : '';
69
- }, function (props) {
70
- return handleListHeight(props.size);
71
- }, _styles.COLORS.primary_20, _styles.COLORS.primary_100);
72
-
73
- var LeftSection = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n\n ", "\n\n svg {\n margin-right: 12px;\n }\n"])), (0, _typography.ComponentSStyling)(_styles.ComponentTextStyle.Regular, 'inherit'));
74
-
75
- var MainInfo = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: auto 1em auto 0;\n display: flex;\n flex-direction: column;\n"])));
76
-
77
- var RightSection = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n text-align: center;\n display: flex;\n flex-direction: row-reverse;\n"])));
78
-
79
- var Note = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin: auto;\n"])));
80
-
81
- var ButtonWrapper = _styledComponents.default.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n outline: none;\n"])));
82
-
83
- var UserDropdownButton = (0, _styledComponents.default)(_Button.IconButton)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n display: flex;\n text-decoration: none;\n outline: none;\n div {\n outline: none;\n }\n\n &:hover > div {\n background-color : ", ";\n border-radius: 18px;\n }\n\n &:focus > div {\n box-shadow:0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2E7FA1;\n border-radius: 18px;\n background: ", ";\n }\n\n &:active > div {\n background-color : ", ";\n border-radius: 18px;\n }\n"])), _styles.COLORS.primary_20, _styles.COLORS.white, _styles.COLORS.primary_100);
84
-
85
- var renderTextData = function renderTextData(mainInfo, variant) {
86
- if (variant == 'two-line') {
87
- return /*#__PURE__*/React.createElement(MainInfo, {
88
- "data-hj-suppress": true
89
- }, mainInfo, /*#__PURE__*/React.createElement("small", null, "some secondary text"));
90
- } else {
91
- return /*#__PURE__*/React.createElement(MainInfo, {
92
- "data-hj-suppress": true
93
- }, mainInfo);
94
- }
95
- };
96
-
97
- var renderDropdown = function renderDropdown(variant, size) {
98
- switch (variant) {
99
- case 'overlay':
100
- return /*#__PURE__*/React.createElement("div", {
101
- tabIndex: -1
102
- }, /*#__PURE__*/React.createElement(_SystemIcons.ArrowDropDown, {
103
- size: size,
104
- color: _styles.COLORS.neutral_500
105
- }));
106
-
107
- default:
108
- return /*#__PURE__*/React.createElement("div", {
109
- tabIndex: -1
110
- }, /*#__PURE__*/React.createElement(_SystemIcons.MoreVertical, {
111
- size: size,
112
- color: _styles.COLORS.neutral_500
113
- }));
114
- }
115
- };
52
+ var Row = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n border-bottom: 1px solid ", ";\n box-sizing: border-box;\n position: relative;\n\n color: ", ";\n background-color: ", ";\n\n\n cursor: default;\n\n &.interactive {\n cursor: pointer;\n }\n\n &.interactive.disabled {\n cursor: not-allowed;\n }\n\n &.interactive:hover:not(.in-action):not(.disabled) {\n background-color: ", ";\n color: ", ";\n }\n\n &.interactive:active:not(.in-action):not(.disabled) {\n background-color: ", ";\n color: ", ";\n box-shadow: none;\n }\n\n &.interactive:focus {\n outline: none;\n box-shadow: 0 4px 12px rgba(46, 127, 161, 0.25), 0 0 8px #2E7FA1;\n z-index: 1;\n }\n\n &.disabled {\n .list-item-icon, .list-item-content, .list-item-note, .list-item-actions {\n color: ", ";\n }\n }\n\n\n &.small {\n min-height: 48px;\n padding: 0 8px;\n\n .list-item-icon {\n margin-right: 8px;\n }\n\n .list-item-main-text {\n ", "\n }\n\n .list-item-actions {\n margin-right: -8px;\n }\n }\n\n &.medium {\n min-height: 56px;\n padding: 0 12px;\n\n .list-item-icon {\n margin-right: 12px;\n }\n\n .list-item-main-text {\n ", "\n }\n\n .list-item-actions {\n margin-right: -12px;\n }\n }\n\n &.large {\n min-height: 64px;\n padding: 0 16px;\n\n .list-item-icon {\n margin-right: 16px;\n }\n\n .list-item-main-text {\n ", "\n }\n\n .list-item-actions {\n margin-right: -16px;\n }\n }\n\n &.overlay {\n padding: 0 4px;\n\n .list-item-actions {\n margin-right: -4px;\n }\n }\n\n .list-item-icon {\n width: 24px;\n height: 24px;\n\n svg {\n width: 24px;\n height: 24px;\n }\n }\n\n .list-item-content {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n }\n\n .list-item-main-text {\n }\n\n .list-item-secondary-text {\n ", "\n }\n\n .list-item-note {\n color: ", ";\n word-break: initial;\n ", "\n }\n\n .list-item-note.with-tooltip {\n cursor: pointer;\n\n > div {\n text-decoration-line: underline;\n text-decoration-style: dashed;\n text-underline-offset: 1px;\n text-decoration-thickness: 1px;\n }\n }\n\n .list-item-actions {\n color: ", ";\n display: flex;\n align-items: center;\n\n button div {\n background-color: transparent;\n }\n }\n"])), _styles.COLORS.neutral_100, _styles.COLORS.neutral_600, _styles.COLORS.white, _styles.COLORS.primary_20, _styles.COLORS.primary_700, _styles.COLORS.primary_100, _styles.COLORS.primary_800, _styles.COLORS.neutral_300, (0, _typography.ComponentSStyling)(_styles.ComponentTextStyle.Regular, null), (0, _typography.ComponentMStyling)(_styles.ComponentTextStyle.Regular, null), (0, _typography.ComponentLStyling)(_styles.ComponentTextStyle.Regular, null), (0, _typography.ComponentXXSStyling)(_styles.ComponentTextStyle.Regular, null), _styles.COLORS.neutral_600, (0, _typography.ComponentXSStyling)(_styles.ComponentTextStyle.Regular, null), _styles.COLORS.neutral_600);
116
53
 
117
54
  var ListRow = function ListRow(_ref) {
118
55
  var key = _ref.key,
119
- Icon = _ref.Icon,
120
- mainInfo = _ref.mainInfo,
121
- dropdownOptions = _ref.dropdownOptions,
122
- disableDifferentBackgroundforEvenNumbers = _ref.disableDifferentBackgroundforEvenNumbers,
123
- size = _ref.size,
124
- variant = _ref.variant,
56
+ _ref$size = _ref.size,
57
+ size = _ref$size === void 0 ? _types.Size.Medium : _ref$size,
58
+ _ref$variant = _ref.variant,
59
+ variant = _ref$variant === void 0 ? 'normal' : _ref$variant,
60
+ icon = _ref.icon,
61
+ mainText = _ref.mainText,
62
+ secondaryText = _ref.secondaryText,
63
+ dropdown = _ref.dropdown,
125
64
  note = _ref.note,
126
- disabled = _ref.disabled;
127
- var color = _styles.COLORS.black;
65
+ noteTooltip = _ref.noteTooltip,
66
+ _ref$disabled = _ref.disabled,
67
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
68
+ action = _ref.action;
128
69
 
129
70
  var _React$useState = React.useState(false),
130
71
  _React$useState2 = _slicedToArray(_React$useState, 2),
131
- dropdownActive = _React$useState2[0],
132
- setDropdownActive = _React$useState2[1];
72
+ inAction = _React$useState2[0],
73
+ setInAction = _React$useState2[1];
74
+
75
+ var handleKeyPress = function handleKeyPress(e) {
76
+ if (e.key === 'Enter') {
77
+ action && action();
78
+ }
79
+ };
133
80
 
134
- return /*#__PURE__*/React.createElement(RowWrapper, {
135
- disableDifferentBackgroundforEvenNumbers: disableDifferentBackgroundforEvenNumbers
136
- }, /*#__PURE__*/React.createElement(EditRow, {
81
+ var rowClassName = (inAction ? 'in-action ' : '').concat(disabled ? 'disabled ' : '').concat(!!action ? 'interactive ' : '').concat('list-item-row ').concat("".concat(variant, " ")).concat("".concat(size));
82
+ return /*#__PURE__*/React.createElement(Row, {
137
83
  key: key,
138
- size: size,
139
- variant: variant,
140
- disabled: disabled,
141
- disableDifferentBackgroundforEvenNumbers: disableDifferentBackgroundforEvenNumbers,
142
- className: dropdownActive ? 'interaction' : ''
143
- }, /*#__PURE__*/React.createElement(LeftSection, {
144
- color: color,
84
+ tabIndex: !!action && !disabled ? 0 : undefined,
85
+ className: rowClassName,
86
+ onKeyPress: function onKeyPress(e) {
87
+ return !disabled && handleKeyPress(e);
88
+ },
89
+ onClick: function onClick(e) {
90
+ !disabled && action && action();
91
+ },
145
92
  "data-hj-suppress": true
146
- }, Icon && /*#__PURE__*/React.createElement(Icon, {
147
- size: "22px",
148
- color: color,
149
- className: "somePaddingForAlignment"
150
- }), renderTextData(mainInfo, variant)), /*#__PURE__*/React.createElement(RightSection, null, /*#__PURE__*/React.createElement(ButtonWrapper, {
151
- className: "user-actions"
152
- }, /*#__PURE__*/React.createElement(UserDropdownButton, {
153
- variant: "secondary",
154
- shape: "circular",
155
- action: function action() {
156
- setDropdownActive(true);
157
- }
158
- }, renderDropdown(variant, size)), dropdownActive && /*#__PURE__*/React.createElement(_ListRowDropdown.default, {
159
- size: size,
160
- closeDropdown: function closeDropdown() {
161
- return setDropdownActive(false);
93
+ }, !!icon && /*#__PURE__*/React.createElement("div", {
94
+ className: 'list-item-icon'
95
+ }, icon), /*#__PURE__*/React.createElement("div", {
96
+ className: 'list-item-content'
97
+ }, /*#__PURE__*/React.createElement("div", {
98
+ className: 'list-item-main-text'
99
+ }, mainText), !!secondaryText && /*#__PURE__*/React.createElement("div", {
100
+ className: 'list-item-secondary-text'
101
+ }, secondaryText)), !!note && /*#__PURE__*/React.createElement(React.Fragment, null, !!noteTooltip && /*#__PURE__*/React.createElement("div", {
102
+ className: 'list-item-note with-tooltip'
103
+ }, /*#__PURE__*/React.createElement(_Tooltips.TooltipWrapper, {
104
+ label: noteTooltip,
105
+ size: size === _types.Size.Large ? _types.Size.Medium : size === _types.Size.Small ? _types.Size.XSmall : _types.Size.Small,
106
+ position: 'top',
107
+ withArrow: true
108
+ }, note)), !noteTooltip && /*#__PURE__*/React.createElement("div", {
109
+ className: 'list-item-note'
110
+ }, note)), !!dropdown && /*#__PURE__*/React.createElement("div", {
111
+ className: 'list-item-actions',
112
+ onMouseEnter: function onMouseEnter() {
113
+ return setInAction(!(dropdown !== null && dropdown !== void 0 && dropdown.disabled));
162
114
  },
163
- options: dropdownOptions
164
- })), /*#__PURE__*/React.createElement(Note, null, note))));
115
+ onMouseLeave: function onMouseLeave() {
116
+ return setInAction(false);
117
+ }
118
+ }, /*#__PURE__*/React.createElement(_Dropdown.DropdownButton, _extends({}, dropdown, {
119
+ disabled: disabled || dropdown.disabled,
120
+ icon: variant === 'overlay' ? /*#__PURE__*/React.createElement(_icons.SystemIcons.ArrowDropDown, null) : /*#__PURE__*/React.createElement(_icons.SystemIcons.MoreVertical, null)
121
+ }))));
165
122
  };
166
123
 
167
124
  ListRow.propTypes = {
168
125
  key: _propTypes.default.string,
169
- Icon: _propTypes.default.any,
170
- mainInfo: _propTypes.default.any.isRequired,
171
- dropdownOptions: _propTypes.default.array.isRequired,
172
- disableDifferentBackgroundforEvenNumbers: _propTypes.default.bool,
173
- size: _propTypes.default.oneOf(['small', 'medium', 'large']).isRequired,
174
- variant: _propTypes.default.oneOf(['one-line', 'two-line', 'overlay']).isRequired,
126
+ variant: _propTypes.default.oneOf(['normal', 'overlay']),
127
+ icon: _propTypes.default.node,
128
+ mainText: _propTypes.default.string.isRequired,
129
+ secondaryText: _propTypes.default.string,
175
130
  note: _propTypes.default.string,
176
- disabled: _propTypes.default.bool.isRequired
131
+ noteTooltip: _propTypes.default.string,
132
+ disabled: _propTypes.default.bool,
133
+ action: _propTypes.default.func
177
134
  };
178
135
  var _default = ListRow;
179
136
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/List/ListRow.tsx"],"names":["handleListHeight","size","RowWrapper","styled","div","props","disableDifferentBackgroundforEvenNumbers","COLORS","neutral_20","DisabledState","css","EditRow","disabled","primary_20","primary_100","LeftSection","ComponentTextStyle","Regular","MainInfo","RightSection","Note","ButtonWrapper","UserDropdownButton","IconButton","white","renderTextData","mainInfo","variant","renderDropdown","neutral_500","ListRow","key","Icon","dropdownOptions","note","color","black","React","useState","dropdownActive","setDropdownActive"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,IAAD,EAAiB;AACxC,UAAOA,IAAP;AAEE,SAAK,OAAL;AAAe,aAAO,OAAP;;AACf,SAAK,QAAL;AAAgB,aAAO,OAAP;;AAChB;AA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AAA,SAAS,EAAGiC,cAAc,GAAC,aAAD,GAAe;AAF3C,kBAGE,oBAAC,WAAD;AAAa,IAAA,KAAK,EAAEJ,KAApB;AAA2B;AAA3B,KACGH,IAAI,iBAAI,oBAAC,IAAD;AAAM,IAAA,IAAI,EAAC,MAAX;AAAkB,IAAA,KAAK,EAAEG,KAAzB;AAAgC,IAAA,SAAS,EAAC;AAA1C,IADX,EAEIV,cAAc,CAACC,QAAD,EAAWC,OAAX,CAFlB,CAHF,eAQE,oBAAC,YAAD,qBACE,oBAAC,aAAD;AAAe,IAAA,SAAS,EAAC;AAAzB,kBACE,oBAAC,kBAAD;AACE,IAAA,OAAO,EAAC,WADV;AAEE,IAAA,KAAK,EAAC,UAFR;AAGE,IAAA,MAAM,EAAE,kBAAM;AACZa,MAAAA,iBAAiB,CAAC,IAAD,CAAjB;AACD;AALH,KAOIZ,cAAc,CAACD,OAAD,EAAU1B,IAAV,CAPlB,CADF,EAWGsC,cAAc,iBAAI,oBAAC,wBAAD;AAAiB,IAAA,IAAI,EAAEtC,IAAvB;AAA6B,IAAA,aAAa,EAAE;AAAA,aAAMuC,iBAAiB,CAAC,KAAD,CAAvB;AAAA,KAA5C;AAA4E,IAAA,OAAO,EAAEP;AAArF,IAXrB,CADF,eAeE,oBAAC,IAAD,QACKC,IADL,CAfF,CARF,CADF,CADF;AAgCD,CApCD;;;AA3CEH,EAAAA,G;AACAC,EAAAA,I;AACAN,EAAAA,Q;AACAO,EAAAA,e;AACA3B,EAAAA,wC;AACAL,EAAAA,I,4BAAM,O,EAAU,Q,EAAW,O;AAC3B0B,EAAAA,O,4BAAS,U,EAAa,U,EAAa,S;AACnCO,EAAAA,I;AACAtB,EAAAA,Q;;eAyEakB,O","sourcesContent":["import * as React from 'react';\nimport styled, {css} from 'styled-components';\nimport {Button, IconButton} from '../Button';\nimport {ArrowDropDown, MoreVertical} from '../icons/systemicons/SystemIcons';\nimport {COLORS, ComponentTextStyle} from '../styles';\nimport {ListRowDropdownOption} from '../types';\n\nimport ListRowDropdown from './ListRowDropdown';\nimport {ComponentSStyling} from '../styles/typography';\n\nconst handleListHeight = (size:string) => {\n switch(size)\n {\n case 'small' : return '48px;';\n case 'medium' : return '56px;';\n default : return '64px;';\n }\n}\n\nconst RowWrapper = styled.div<{disableDifferentBackgroundforEvenNumbers:boolean|undefined}>`\n &:nth-child(even) {\n background-color: ${props => (props.disableDifferentBackgroundforEvenNumbers ? 'inherit' : COLORS.neutral_20)};\n }\n\n .interaction {\n :hover {\n background-color: white;\n }\n\n :focus {\n background-color: white;\n }\n\n :active { \n background-color: white;\n }\n }\n`;\n\nconst DisabledState = css`\n pointer-events: none;\n background-color: white;\n`;\n\nconst EditRow = styled.div<ListRowProps>`\n display: flex;\n justify-content: space-between;\n padding: 8px 12px;\n align-items: center;\n\n ${props => props.disabled ? DisabledState : ''}\n\n height : ${props => handleListHeight(props.size) }\n\n .user-actions {\n display: flex;\n position: relative;\n align-items: center;\n }\n\n .somePaddingForAlignment {\n padding: 0 3px 0 0;\n }\n\n &:hover { \n background-color: ${COLORS.primary_20}; \n }\n\n &:focus { \n background-color: white;\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2E7FA1; \n }\n \n &:active { \n background-color: ${COLORS.primary_100};\n }\n`;\n\nconst LeftSection = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n\n ${ComponentSStyling(ComponentTextStyle.Regular, 'inherit')}\n\n svg {\n margin-right: 12px;\n }\n`;\n\nconst MainInfo = styled.div`\n margin: auto 1em auto 0;\n display: flex;\n flex-direction: column;\n`;\n\nconst RightSection = styled.div`\n text-align: center;\n display: flex;\n flex-direction: row-reverse;\n`;\n\nconst Note = styled.div`\n margin: auto;\n`;\n\nconst ButtonWrapper = styled.div`\n outline: none;\n`;\n\nconst UserDropdownButton = styled(IconButton)`\n display: flex;\n text-decoration: none;\n outline: none;\n div {\n outline: none;\n }\n\n &:hover > div {\n background-color : ${COLORS.primary_20};\n border-radius: 18px;\n }\n\n &:focus > div {\n box-shadow:0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2E7FA1;\n border-radius: 18px;\n background: ${COLORS.white};\n }\n\n &:active > div {\n background-color : ${COLORS.primary_100};\n border-radius: 18px;\n }\n`;\n\ntype Props = {\n key?: string;\n Icon?: any;\n mainInfo: any;\n dropdownOptions: ListRowDropdownOption[];\n disableDifferentBackgroundforEvenNumbers?: boolean;\n size: 'small' | 'medium' | 'large';\n variant: 'one-line' | 'two-line' | 'overlay';\n note?: string;\n disabled: boolean;\n};\n\nconst renderTextData = (mainInfo: any, variant?: string) => {\n if(variant == 'two-line'){\n return (\n <MainInfo data-hj-suppress>{mainInfo}\n <small>some secondary text</small>\n </MainInfo>\n )\n }\n else{\n return (\n <MainInfo data-hj-suppress>{mainInfo}</MainInfo>\n )\n }\n}\n\nconst renderDropdown = (variant: string, size: string) =>{\n switch(variant){\n case 'overlay' : return (\n <div tabIndex={-1}>\n <ArrowDropDown size={size} color={COLORS.neutral_500} />\n </div>\n );\n \n default : return (\n <div tabIndex={-1}>\n <MoreVertical size={size} color={COLORS.neutral_500} />\n </div>\n );\n }\n \n}\n\nconst ListRow: React.FunctionComponent<Props> = ({ key, Icon, mainInfo, dropdownOptions, disableDifferentBackgroundforEvenNumbers, size, variant, note, disabled }: Props) => {\n const color = COLORS.black;\n const [dropdownActive, setDropdownActive] = React.useState<Boolean>(false);\n\n return (\n <RowWrapper disableDifferentBackgroundforEvenNumbers={disableDifferentBackgroundforEvenNumbers}>\n <EditRow key={key} size={size} variant = {variant} disabled = {disabled}\n disableDifferentBackgroundforEvenNumbers={disableDifferentBackgroundforEvenNumbers}\n className={(dropdownActive?'interaction':'')}>\n <LeftSection color={color} data-hj-suppress>\n {Icon && <Icon size=\"22px\" color={color} className=\"somePaddingForAlignment\" />}\n { renderTextData(mainInfo, variant) }\n </LeftSection>\n\n <RightSection>\n <ButtonWrapper className=\"user-actions\">\n <UserDropdownButton\n variant=\"secondary\"\n shape='circular'\n action={() => {\n setDropdownActive(true);\n }}>\n {\n renderDropdown(variant, size)\n }\n </UserDropdownButton>\n {dropdownActive && <ListRowDropdown size={size} closeDropdown={() => setDropdownActive(false)} options={dropdownOptions} />}\n </ButtonWrapper>\n\n <Note>\n {note}\n </Note>\n </RightSection>\n </EditRow>\n </RowWrapper>\n );\n};\n\nexport default ListRow;\n\ntype ListRowProps = {\n disableDifferentBackgroundforEvenNumbers? : boolean;\n size: string;\n variant: string;\n disabled: boolean;\n}"],"file":"ListRow.js"}
1
+ {"version":3,"sources":["../../../src/List/ListRow.tsx"],"names":["Row","styled","div","COLORS","neutral_100","neutral_600","white","primary_20","primary_700","primary_100","primary_800","neutral_300","ComponentTextStyle","Regular","ListRow","key","size","Size","Medium","variant","icon","mainText","secondaryText","dropdown","note","noteTooltip","disabled","action","React","useState","inAction","setInAction","handleKeyPress","e","rowClassName","concat","undefined","Large","Small","XSmall"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAQA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,GAAG,GAAGC,0BAAOC,GAAV,4+EAKoBC,eAAOC,WAL3B,EASED,eAAOE,WATT,EAUaF,eAAOG,KAVpB,EAwBeH,eAAOI,UAxBtB,EAyBIJ,eAAOK,WAzBX,EA6BeL,eAAOM,WA7BtB,EA8BIN,eAAOO,WA9BX,EA0CMP,eAAOQ,WA1Cb,EAwDD,mCAAkBC,2BAAmBC,OAArC,EAA8C,IAA9C,CAxDC,EAyED,mCAAkBD,2BAAmBC,OAArC,EAA8C,IAA9C,CAzEC,EA0FD,mCAAkBD,2BAAmBC,OAArC,EAA8C,IAA9C,CA1FC,EA8HH,qCAAoBD,2BAAmBC,OAAvC,EAAgD,IAAhD,CA9HG,EAkIIV,eAAOE,WAlIX,EAoIH,oCAAmBO,2BAAmBC,OAAtC,EAA+C,IAA/C,CApIG,EAmJIV,eAAOE,WAnJX,CAAT;;AA4KA,IA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,IAAA,QAAQ,EAAEG,QAAQ,IAAIH,QAAQ,CAACG,QAD/C;AAEgB,IAAA,IAAI,EAAEP,OAAO,KAAK,SAAZ,gBACF,oBAAC,kBAAD,CAAa,aAAb,OADE,gBAEF,oBAAC,kBAAD,CAAa,YAAb;AAJpB,KAHF,CAxCJ,CADF;AAsDD,CAnFD;;;AAbEJ,EAAAA,G;AAEAI,EAAAA,O,4BAAU,Q,EAAW,S;AACrBC,EAAAA,I;AACAC,EAAAA,Q;AACAC,EAAAA,a;AAEAE,EAAAA,I;AACAC,EAAAA,W;AACAC,EAAAA,Q;AACAC,EAAAA,M;;eAwFab,O","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {COLORS, ComponentTextStyle} from '../styles';\n\nimport {\n ComponentLStyling,\n ComponentMStyling,\n ComponentSStyling,\n ComponentXSStyling,\n ComponentXXSStyling\n} from '../styles/typography';\nimport {DropdownButtonProps} from '../Dropdown/DropdownButtonTypes';\nimport {TooltipWrapper} from '../Tooltips';\nimport {DropdownButton} from '../Dropdown';\nimport {SystemIcons} from '../icons';\nimport {Size} from '../types';\n\nconst Row = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n border-bottom: 1px solid ${COLORS.neutral_100};\n box-sizing: border-box;\n position: relative;\n\n color: ${COLORS.neutral_600};\n background-color: ${COLORS.white};\n\n\n cursor: default;\n\n &.interactive {\n cursor: pointer;\n }\n\n &.interactive.disabled {\n cursor: not-allowed;\n }\n\n &.interactive:hover:not(.in-action):not(.disabled) {\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_700};\n }\n\n &.interactive:active:not(.in-action):not(.disabled) {\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n box-shadow: none;\n }\n\n &.interactive:focus {\n outline: none;\n box-shadow: 0 4px 12px rgba(46, 127, 161, 0.25), 0 0 8px #2E7FA1;\n z-index: 1;\n }\n\n &.disabled {\n .list-item-icon, .list-item-content, .list-item-note, .list-item-actions {\n color: ${COLORS.neutral_300};\n }\n }\n\n\n &.small {\n min-height: 48px;\n padding: 0 8px;\n\n .list-item-icon {\n margin-right: 8px;\n }\n\n .list-item-main-text {\n ${ComponentSStyling(ComponentTextStyle.Regular, null)}\n }\n\n .list-item-actions {\n margin-right: -8px;\n }\n }\n\n &.medium {\n min-height: 56px;\n padding: 0 12px;\n\n .list-item-icon {\n margin-right: 12px;\n }\n\n .list-item-main-text {\n ${ComponentMStyling(ComponentTextStyle.Regular, null)}\n }\n\n .list-item-actions {\n margin-right: -12px;\n }\n }\n\n &.large {\n min-height: 64px;\n padding: 0 16px;\n\n .list-item-icon {\n margin-right: 16px;\n }\n\n .list-item-main-text {\n ${ComponentLStyling(ComponentTextStyle.Regular, null)}\n }\n\n .list-item-actions {\n margin-right: -16px;\n }\n }\n\n &.overlay {\n padding: 0 4px;\n\n .list-item-actions {\n margin-right: -4px;\n }\n }\n\n .list-item-icon {\n width: 24px;\n height: 24px;\n\n svg {\n width: 24px;\n height: 24px;\n }\n }\n\n .list-item-content {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n }\n\n .list-item-main-text {\n }\n\n .list-item-secondary-text {\n ${ComponentXXSStyling(ComponentTextStyle.Regular, null)}\n }\n\n .list-item-note {\n color: ${COLORS.neutral_600};\n word-break: initial;\n ${ComponentXSStyling(ComponentTextStyle.Regular, null)}\n }\n\n .list-item-note.with-tooltip {\n cursor: pointer;\n\n > div {\n text-decoration-line: underline;\n text-decoration-style: dashed;\n text-underline-offset: 1px;\n text-decoration-thickness: 1px;\n }\n }\n\n .list-item-actions {\n color: ${COLORS.neutral_600};\n display: flex;\n align-items: center;\n\n button div {\n background-color: transparent;\n }\n }\n`;\n\n\ntype Props = {\n key?: string;\n size?: Size;\n variant?: 'normal' | 'overlay';\n icon?: React.ReactNode;\n mainText: string;\n secondaryText?: string;\n dropdown?: Pick<DropdownButtonProps, 'items' | 'onClick' | 'disabled' | 'width'>;\n note?: string;\n noteTooltip?: string;\n disabled?: boolean;\n action?: () => void;\n};\n\nconst ListRow: React.FunctionComponent<Props> = ({\n key,\n size = Size.Medium,\n variant = 'normal',\n icon,\n mainText,\n secondaryText,\n dropdown,\n note,\n noteTooltip,\n disabled = false,\n action\n }: Props) => {\n\n const [inAction, setInAction] = React.useState<Boolean>(false);\n\n const handleKeyPress = (e: any) => {\n if (e.key === 'Enter') {\n action && action()\n }\n }\n\n const rowClassName = (inAction ? 'in-action ' : '')\n .concat(disabled ? 'disabled ' : '')\n .concat(!!action ? 'interactive ' : '')\n .concat('list-item-row ')\n .concat(`${variant} `)\n .concat(`${size}`);\n\n return (\n <Row key={key}\n tabIndex={!!action && !disabled ? 0 : undefined}\n className={rowClassName}\n onKeyPress={(e) => !disabled && handleKeyPress(e)}\n onClick={e => {\n !disabled && action && action();\n }}\n data-hj-suppress>\n {\n !!icon &&\n <div className={'list-item-icon'}>{icon}</div>\n }\n <div className={'list-item-content'}>\n <div className={'list-item-main-text'}>{mainText}</div>\n {!!secondaryText && <div className={'list-item-secondary-text'}>{secondaryText}</div>}\n </div>\n {\n !!note &&\n <>\n {\n !!noteTooltip &&\n <div className={'list-item-note with-tooltip'}>\n <TooltipWrapper label={noteTooltip}\n size={size === Size.Large ? Size.Medium : size === Size.Small ? Size.XSmall : Size.Small}\n position={'top'}\n withArrow={true}>\n {note}\n </TooltipWrapper>\n </div>\n }\n {\n !noteTooltip &&\n <div className={'list-item-note'}>\n {note}\n </div>\n }\n </>\n }\n {\n !!dropdown &&\n <div className={'list-item-actions'}\n onMouseEnter={() => setInAction(!dropdown?.disabled)}\n onMouseLeave={() => setInAction(false)}>\n <DropdownButton {...dropdown}\n disabled={disabled || dropdown.disabled}\n icon={variant === 'overlay'\n ? <SystemIcons.ArrowDropDown/>\n : <SystemIcons.MoreVertical/>}\n />\n </div>\n }\n </Row>\n );\n};\n\nexport default ListRow;\n\n"],"file":"ListRow.js"}
@@ -6,7 +6,9 @@ var _react2 = require("@testing-library/react");
6
6
 
7
7
  var _index = require("../index");
8
8
 
9
- var _SystemIcons = require("../../icons/systemicons/SystemIcons");
9
+ var _types = require("../../types");
10
+
11
+ var _icons = require("../../icons");
10
12
 
11
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
14
 
@@ -23,21 +25,11 @@ describe('<ListRow />', function () {
23
25
  switch (_context.prev = _context.next) {
24
26
  case 0:
25
27
  _render = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.ListRow, {
26
- Icon: _SystemIcons.Institute,
27
- mainInfo: /*#__PURE__*/_react.default.createElement("div", null, "Laerdal Medical AS"),
28
- dropdownOptions: [{
29
- label: 'Option 1',
30
- action: function action() {},
31
- key: 'Test1'
32
- }, {
33
- label: 'Option 2',
34
- action: function action() {},
35
- key: 'Test2'
36
- }],
37
- variant: "one-line",
38
- size: "small",
28
+ icon: /*#__PURE__*/_react.default.createElement(_icons.SystemIcons.Institute, null),
29
+ mainText: 'Laerdal Medical AS',
30
+ size: _types.Size.Small,
39
31
  disabled: false
40
- }, "Menu 1")), getByText = _render.getByText;
32
+ })), getByText = _render.getByText;
41
33
  expect(getByText('Laerdal Medical AS')).toBeDefined();
42
34
 
43
35
  case 2:
@@ -47,48 +39,5 @@ describe('<ListRow />', function () {
47
39
  }
48
40
  }, _callee);
49
41
  })));
50
- it('When menu is clicked, it opens', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
51
- var _render2, getByRole, getByText;
52
-
53
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
54
- while (1) {
55
- switch (_context2.prev = _context2.next) {
56
- case 0:
57
- _render2 = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.ListRow, {
58
- Icon: _SystemIcons.Institute,
59
- mainInfo: /*#__PURE__*/_react.default.createElement("div", null, "Laerdal Medical AS"),
60
- dropdownOptions: [{
61
- label: 'Option 1',
62
- action: function action() {},
63
- key: 'Test1'
64
- }, {
65
- label: 'Option 2',
66
- action: function action() {},
67
- key: 'Test2'
68
- }],
69
- variant: "two-line",
70
- size: "large",
71
- disabled: true
72
- }, "Menu 1")), getByRole = _render2.getByRole, getByText = _render2.getByText; //expect(getByText('Option 1')).not.toBeDefined();
73
-
74
- getByRole('button').click();
75
- expect(getByText('Option 1')).toBeDefined();
76
-
77
- case 3:
78
- case "end":
79
- return _context2.stop();
80
- }
81
- }
82
- }, _callee2);
83
- })));
84
- /*it('Renders with required input if specified', async () => {
85
- const { getByPlaceholderText } = render(<DropdownFilter id="Dropdown" list={list} placeholder="Placeholder" required />);
86
- expect(getByPlaceholderText('Placeholder').required).toBe(true);
87
- });
88
- it('Renders with inital value if specified', async () => {
89
- const initialValue = 'Contact';
90
- const { getByPlaceholderText } = render(<DropdownFilter id="Dropdown" list={list} placeholder="Placeholder" initalValue={initialValue} />);
91
- expect(getByPlaceholderText('Placeholder').value).toBe(initialValue);
92
- });*/
93
42
  });
94
43
  //# sourceMappingURL=ListRow.tests.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/List/__tests__/ListRow.tests.tsx"],"names":["describe","it","Institute","label","action","key","getByText","expect","toBeDefined","getByRole","click"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;;;;;;;AAEAA,QAAQ,CAAC,aAAD,EAAgB,YAAM;AAC5BC,EAAAA,EAAE,CAAC,SAAD,uEAAY;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,sBACU,kCACpB,6BAAC,cAAD;AACE,cAAA,IAAI,EAAEC,sBADR;AAEE,cAAA,QAAQ,eAAE,+DAFZ;AAGE,cAAA,eAAe,EAAE,CACf;AAAEC,gBAAAA,KAAK,EAAE,UAAT;AAAqBC,gBAAAA,MAAM,EAAE,kBAAM,CAAE,CAArC;AAAuCC,gBAAAA,GAAG,EAAE;AAA5C,eADe,EAEf;AAAEF,gBAAAA,KAAK,EAAE,UAAT;AAAqBC,gBAAAA,MAAM,EAAE,kBAAM,CAAE,CAArC;AAAuCC,gBAAAA,GAAG,EAAE;AAA5C,eAFe,CAHnB;AAOE,cAAA,OAAO,EAAC,UAPV;AAQE,cAAA,IAAI,EAAC,OARP;AASE,cAAA,QAAQ,EAAE;AATZ,wBADoB,CADV,EACJC,SADI,WACJA,SADI;AAgBZC,YAAAA,MAAM,CAACD,SAAS,CAAC,oBAAD,CAAV,CAAN,CAAwCE,WAAxC;;AAhBY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAAZ,GAAF;AAmBAP,EAAAA,EAAE,CAAC,gCAAD,uEAAmC;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,uBACF,kCAC/B,6BAAC,cAAD;AACE,cAAA,IAAI,EAAEC,sBADR;AAEE,cAAA,QAAQ,eAAE,+DAFZ;AAGE,cAAA,eAAe,EAAE,CACf;AAAEC,gBAAAA,KAAK,EAAE,UAAT;AAAqBC,gBAAAA,MAAM,EAAE,kBAAM,CAAE,CAArC;AAAuCC,gBAAAA,GAAG,EAAE;AAA5C,eADe,EAEf;AAAEF,gBAAAA,KAAK,EAAE,UAAT;AAAqBC,gBAAAA,MAAM,EAAE,kBAAM,CAAE,CAArC;AAAuCC,gBAAAA,GAAG,EAAE;AAA5C,eAFe,CAHnB;AAOE,cAAA,OAAO,EAAC,UAPV;AAQE,cAAA,IAAI,EAAC,OARP;AASE,cAAA,QAAQ,EAAE;AATZ,wBAD+B,CADE,EAC3BI,SAD2B,YAC3BA,SAD2B,EAChBH,SADgB,YAChBA,SADgB,EAgBnC;;AACAG,YAAAA,SAAS,CAAC,QAAD,CAAT,CAAoBC,KAApB;AACAH,YAAAA,MAAM,CAACD,SAAS,CAAC,UAAD,CAAV,CAAN,CAA8BE,WAA9B;;AAlBmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAAnC,GAAF;AAqBA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEC,CAnDO,CAAR","sourcesContent":["import React from 'react';\nimport { render } from '@testing-library/react';\nimport { ListRow } from '../index';\nimport { Institute } from '../../icons/systemicons/SystemIcons';\n\ndescribe('<ListRow />', () => {\n it('Renders', async () => {\n const { getByText } = render(\n <ListRow\n Icon={Institute}\n mainInfo={<div>Laerdal Medical AS</div>}\n dropdownOptions={[\n { label: 'Option 1', action: () => {}, key: 'Test1' },\n { label: 'Option 2', action: () => {}, key: 'Test2' },\n ]}\n variant='one-line'\n size='small'\n disabled={false}\n >\n Menu 1\n </ListRow>,\n );\n expect(getByText('Laerdal Medical AS')).toBeDefined();\n });\n\n it('When menu is clicked, it opens', async () => {\n const { getByRole, getByText } = render(\n <ListRow\n Icon={Institute}\n mainInfo={<div>Laerdal Medical AS</div>}\n dropdownOptions={[\n { label: 'Option 1', action: () => {}, key: 'Test1' },\n { label: 'Option 2', action: () => {}, key: 'Test2' },\n ]}\n variant='two-line'\n size='large'\n disabled={true}>\n Menu 1\n </ListRow>,\n );\n\n //expect(getByText('Option 1')).not.toBeDefined();\n getByRole('button').click();\n expect(getByText('Option 1')).toBeDefined();\n });\n\n /*it('Renders with required input if specified', async () => {\n const { getByPlaceholderText } = render(<DropdownFilter id=\"Dropdown\" list={list} placeholder=\"Placeholder\" required />);\n expect(getByPlaceholderText('Placeholder').required).toBe(true);\n });\n\n it('Renders with inital value if specified', async () => {\n const initialValue = 'Contact';\n const { getByPlaceholderText } = render(<DropdownFilter id=\"Dropdown\" list={list} placeholder=\"Placeholder\" initalValue={initialValue} />);\n expect(getByPlaceholderText('Placeholder').value).toBe(initialValue);\n });*/\n});\n"],"file":"ListRow.tests.js"}
1
+ {"version":3,"sources":["../../../../src/List/__tests__/ListRow.tests.tsx"],"names":["describe","it","Size","Small","getByText","expect","toBeDefined"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEAA,QAAQ,CAAC,aAAD,EAAgB,YAAM;AAC5BC,EAAAA,EAAE,CAAC,SAAD,uEAAY;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,sBACQ,kCAClB,6BAAC,cAAD;AACE,cAAA,IAAI,eAAE,6BAAC,kBAAD,CAAa,SAAb,OADR;AAEE,cAAA,QAAQ,EAAE,oBAFZ;AAGE,cAAA,IAAI,EAAEC,YAAKC,KAHb;AAIE,cAAA,QAAQ,EAAE;AAJZ,cADkB,CADR,EACLC,SADK,WACLA,SADK;AAQZC,YAAAA,MAAM,CAACD,SAAS,CAAC,oBAAD,CAAV,CAAN,CAAwCE,WAAxC;;AARY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAAZ,GAAF;AAUD,CAXO,CAAR","sourcesContent":["import React from 'react';\nimport {render} from '@testing-library/react';\nimport {ListRow} from '../index';\nimport {Size} from '../../types';\nimport {SystemIcons} from '../../icons';\n\ndescribe('<ListRow />', () => {\n it('Renders', async () => {\n const {getByText} = render(\n <ListRow\n icon={<SystemIcons.Institute/>}\n mainText={'Laerdal Medical AS'}\n size={Size.Small}\n disabled={false}/>,\n );\n expect(getByText('Laerdal Medical AS')).toBeDefined();\n });\n});\n"],"file":"ListRow.tests.js"}
@@ -1,3 +1,2 @@
1
1
  import ListRow from './ListRow';
2
- import ListRowDropdown from './ListRowDropdown';
3
- export { ListRow, ListRowDropdown };
2
+ export { ListRow };
@@ -9,16 +9,8 @@ Object.defineProperty(exports, "ListRow", {
9
9
  return _ListRow.default;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "ListRowDropdown", {
13
- enumerable: true,
14
- get: function get() {
15
- return _ListRowDropdown.default;
16
- }
17
- });
18
12
 
19
13
  var _ListRow = _interopRequireDefault(require("./ListRow"));
20
14
 
21
- var _ListRowDropdown = _interopRequireDefault(require("./ListRowDropdown"));
22
-
23
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/List/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["import ListRow from './ListRow';\nimport ListRowDropdown from './ListRowDropdown';\n\nexport { ListRow, ListRowDropdown };\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/List/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["import ListRow from './ListRow';\n\nexport {ListRow};\n"],"file":"index.js"}