@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.
- package/dist/esm/List/ListRow.js +186 -165
- package/dist/esm/List/ListRow.js.map +1 -1
- package/dist/esm/List/__tests__/ListRow.tests.js +6 -48
- package/dist/esm/List/__tests__/ListRow.tests.js.map +1 -1
- package/dist/esm/List/index.js +1 -2
- package/dist/esm/List/index.js.map +1 -1
- package/dist/js/List/ListRow.d.ts +11 -8
- package/dist/js/List/ListRow.js +77 -120
- package/dist/js/List/ListRow.js.map +1 -1
- package/dist/js/List/__tests__/ListRow.tests.js +7 -58
- package/dist/js/List/__tests__/ListRow.tests.js.map +1 -1
- package/dist/js/List/index.d.ts +1 -2
- package/dist/js/List/index.js +0 -8
- package/dist/js/List/index.js.map +1 -1
- package/dist/umd/List/ListRow.js +201 -167
- package/dist/umd/List/ListRow.js.map +1 -1
- package/dist/umd/List/__tests__/ListRow.tests.js +8 -51
- package/dist/umd/List/__tests__/ListRow.tests.js.map +1 -1
- package/dist/umd/List/index.js +5 -8
- package/dist/umd/List/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/List/ListRowDropdown.js +0 -125
- package/dist/esm/List/ListRowDropdown.js.map +0 -1
- package/dist/js/List/ListRowDropdown.d.ts +0 -9
- package/dist/js/List/ListRowDropdown.js +0 -131
- package/dist/js/List/ListRowDropdown.js.map +0 -1
- package/dist/umd/List/ListRowDropdown.js +0 -202
- package/dist/umd/List/ListRowDropdown.js.map +0 -1
package/dist/umd/List/ListRow.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "prop-types", "react", "styled-components", "../
|
|
3
|
+
define(["exports", "prop-types", "react", "styled-components", "../styles", "../styles/typography", "../Tooltips", "../Dropdown", "../icons", "../types"], factory);
|
|
4
4
|
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("prop-types"), require("react"), require("styled-components"), require("../
|
|
5
|
+
factory(exports, require("prop-types"), require("react"), require("styled-components"), require("../styles"), require("../styles/typography"), require("../Tooltips"), require("../Dropdown"), require("../icons"), require("../types"));
|
|
6
6
|
} else {
|
|
7
7
|
var mod = {
|
|
8
8
|
exports: {}
|
|
9
9
|
};
|
|
10
|
-
factory(mod.exports, global.propTypes, global.react, global.styledComponents, global.
|
|
10
|
+
factory(mod.exports, global.propTypes, global.react, global.styledComponents, global.styles, global.typography, global.Tooltips, global.Dropdown, global.icons, global.types);
|
|
11
11
|
global.undefined = mod.exports;
|
|
12
12
|
}
|
|
13
|
-
})(this, function (exports, _propTypes, _react, _styledComponents,
|
|
13
|
+
})(this, function (exports, _propTypes, _react, _styledComponents, _styles, _typography, _Tooltips, _Dropdown, _icons, _types) {
|
|
14
14
|
"use strict";
|
|
15
15
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -23,8 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
var _styledComponents2 = _interopRequireDefault(_styledComponents);
|
|
25
25
|
|
|
26
|
-
var _ListRowDropdown2 = _interopRequireDefault(_ListRowDropdown);
|
|
27
|
-
|
|
28
26
|
function _getRequireWildcardCache(nodeInterop) {
|
|
29
27
|
if (typeof WeakMap !== "function") return null;
|
|
30
28
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -81,213 +79,249 @@
|
|
|
81
79
|
};
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
function _extends() {
|
|
83
|
+
_extends = Object.assign || function (target) {
|
|
84
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
85
|
+
var source = arguments[i];
|
|
88
86
|
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
for (var key in source) {
|
|
88
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
89
|
+
target[key] = source[key];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
};
|
|
94
|
+
return target;
|
|
95
|
+
};
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
&:nth-child(even) {
|
|
99
|
-
background-color: ${props => props.disableDifferentBackgroundforEvenNumbers ? 'inherit' : _styles.COLORS.neutral_20};
|
|
97
|
+
return _extends.apply(this, arguments);
|
|
100
98
|
}
|
|
101
99
|
|
|
102
|
-
.
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
const Row = _styledComponents2.default.div`
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: row;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
border-bottom: 1px solid ${_styles.COLORS.neutral_100};
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
position: relative;
|
|
108
|
+
|
|
109
|
+
color: ${_styles.COLORS.neutral_600};
|
|
110
|
+
background-color: ${_styles.COLORS.white};
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
cursor: default;
|
|
114
|
+
|
|
115
|
+
&.interactive {
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&.interactive.disabled {
|
|
120
|
+
cursor: not-allowed;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&.interactive:hover:not(.in-action):not(.disabled) {
|
|
124
|
+
background-color: ${_styles.COLORS.primary_20};
|
|
125
|
+
color: ${_styles.COLORS.primary_700};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&.interactive:active:not(.in-action):not(.disabled) {
|
|
129
|
+
background-color: ${_styles.COLORS.primary_100};
|
|
130
|
+
color: ${_styles.COLORS.primary_800};
|
|
131
|
+
box-shadow: none;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&.interactive:focus {
|
|
135
|
+
outline: none;
|
|
136
|
+
box-shadow: 0 4px 12px rgba(46, 127, 161, 0.25), 0 0 8px #2E7FA1;
|
|
137
|
+
z-index: 1;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&.disabled {
|
|
141
|
+
.list-item-icon, .list-item-content, .list-item-note, .list-item-actions {
|
|
142
|
+
color: ${_styles.COLORS.neutral_300};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
&.small {
|
|
148
|
+
min-height: 48px;
|
|
149
|
+
padding: 0 8px;
|
|
150
|
+
|
|
151
|
+
.list-item-icon {
|
|
152
|
+
margin-right: 8px;
|
|
105
153
|
}
|
|
106
154
|
|
|
107
|
-
|
|
108
|
-
|
|
155
|
+
.list-item-main-text {
|
|
156
|
+
${(0, _typography.ComponentSStyling)(_styles.ComponentTextStyle.Regular, null)}
|
|
109
157
|
}
|
|
110
158
|
|
|
111
|
-
|
|
112
|
-
|
|
159
|
+
.list-item-actions {
|
|
160
|
+
margin-right: -8px;
|
|
113
161
|
}
|
|
114
162
|
}
|
|
115
|
-
`;
|
|
116
|
-
const DisabledState = _styledComponents.css`
|
|
117
|
-
pointer-events: none;
|
|
118
|
-
background-color: white;
|
|
119
|
-
`;
|
|
120
|
-
const EditRow = _styledComponents2.default.div`
|
|
121
|
-
display: flex;
|
|
122
|
-
justify-content: space-between;
|
|
123
|
-
padding: 8px 12px;
|
|
124
|
-
align-items: center;
|
|
125
163
|
|
|
126
|
-
|
|
164
|
+
&.medium {
|
|
165
|
+
min-height: 56px;
|
|
166
|
+
padding: 0 12px;
|
|
127
167
|
|
|
128
|
-
|
|
168
|
+
.list-item-icon {
|
|
169
|
+
margin-right: 12px;
|
|
170
|
+
}
|
|
129
171
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
align-items: center;
|
|
134
|
-
}
|
|
172
|
+
.list-item-main-text {
|
|
173
|
+
${(0, _typography.ComponentMStyling)(_styles.ComponentTextStyle.Regular, null)}
|
|
174
|
+
}
|
|
135
175
|
|
|
136
|
-
|
|
137
|
-
|
|
176
|
+
.list-item-actions {
|
|
177
|
+
margin-right: -12px;
|
|
178
|
+
}
|
|
138
179
|
}
|
|
139
180
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
181
|
+
&.large {
|
|
182
|
+
min-height: 64px;
|
|
183
|
+
padding: 0 16px;
|
|
143
184
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
185
|
+
.list-item-icon {
|
|
186
|
+
margin-right: 16px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.list-item-main-text {
|
|
190
|
+
${(0, _typography.ComponentLStyling)(_styles.ComponentTextStyle.Regular, null)}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.list-item-actions {
|
|
194
|
+
margin-right: -16px;
|
|
195
|
+
}
|
|
147
196
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
197
|
+
|
|
198
|
+
&.overlay {
|
|
199
|
+
padding: 0 4px;
|
|
200
|
+
|
|
201
|
+
.list-item-actions {
|
|
202
|
+
margin-right: -4px;
|
|
203
|
+
}
|
|
151
204
|
}
|
|
152
|
-
`;
|
|
153
|
-
const LeftSection = _styledComponents2.default.div`
|
|
154
|
-
display: flex;
|
|
155
|
-
flex-direction: row;
|
|
156
|
-
align-items: center;
|
|
157
205
|
|
|
158
|
-
|
|
206
|
+
.list-item-icon {
|
|
207
|
+
width: 24px;
|
|
208
|
+
height: 24px;
|
|
159
209
|
|
|
160
|
-
|
|
161
|
-
|
|
210
|
+
svg {
|
|
211
|
+
width: 24px;
|
|
212
|
+
height: 24px;
|
|
213
|
+
}
|
|
162
214
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
`;
|
|
169
|
-
const RightSection = _styledComponents2.default.div`
|
|
170
|
-
text-align: center;
|
|
171
|
-
display: flex;
|
|
172
|
-
flex-direction: row-reverse;
|
|
173
|
-
`;
|
|
174
|
-
const Note = _styledComponents2.default.div`
|
|
175
|
-
margin: auto;
|
|
176
|
-
`;
|
|
177
|
-
const ButtonWrapper = _styledComponents2.default.div`
|
|
178
|
-
outline: none;
|
|
179
|
-
`;
|
|
180
|
-
const UserDropdownButton = (0, _styledComponents2.default)(_Button.IconButton)`
|
|
181
|
-
display: flex;
|
|
182
|
-
text-decoration: none;
|
|
183
|
-
outline: none;
|
|
184
|
-
div {
|
|
185
|
-
outline: none;
|
|
215
|
+
|
|
216
|
+
.list-item-content {
|
|
217
|
+
flex-grow: 1;
|
|
218
|
+
display: flex;
|
|
219
|
+
flex-direction: column;
|
|
186
220
|
}
|
|
187
221
|
|
|
188
|
-
|
|
189
|
-
background-color : ${_styles.COLORS.primary_20};
|
|
190
|
-
border-radius: 18px;
|
|
222
|
+
.list-item-main-text {
|
|
191
223
|
}
|
|
192
224
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
border-radius: 18px;
|
|
196
|
-
background: ${_styles.COLORS.white};
|
|
225
|
+
.list-item-secondary-text {
|
|
226
|
+
${(0, _typography.ComponentXXSStyling)(_styles.ComponentTextStyle.Regular, null)}
|
|
197
227
|
}
|
|
198
228
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
229
|
+
.list-item-note {
|
|
230
|
+
color: ${_styles.COLORS.neutral_600};
|
|
231
|
+
word-break: initial;
|
|
232
|
+
${(0, _typography.ComponentXSStyling)(_styles.ComponentTextStyle.Regular, null)}
|
|
202
233
|
}
|
|
203
|
-
`;
|
|
204
234
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}, mainInfo);
|
|
235
|
+
.list-item-note.with-tooltip {
|
|
236
|
+
cursor: pointer;
|
|
237
|
+
|
|
238
|
+
> div {
|
|
239
|
+
text-decoration-line: underline;
|
|
240
|
+
text-decoration-style: dashed;
|
|
241
|
+
text-underline-offset: 1px;
|
|
242
|
+
text-decoration-thickness: 1px;
|
|
214
243
|
}
|
|
215
|
-
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.list-item-actions {
|
|
247
|
+
color: ${_styles.COLORS.neutral_600};
|
|
248
|
+
display: flex;
|
|
249
|
+
align-items: center;
|
|
216
250
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
case 'overlay':
|
|
220
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
221
|
-
tabIndex: -1
|
|
222
|
-
}, /*#__PURE__*/React.createElement(_SystemIcons.ArrowDropDown, {
|
|
223
|
-
size: size,
|
|
224
|
-
color: _styles.COLORS.neutral_500
|
|
225
|
-
}));
|
|
226
|
-
|
|
227
|
-
default:
|
|
228
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
229
|
-
tabIndex: -1
|
|
230
|
-
}, /*#__PURE__*/React.createElement(_SystemIcons.MoreVertical, {
|
|
231
|
-
size: size,
|
|
232
|
-
color: _styles.COLORS.neutral_500
|
|
233
|
-
}));
|
|
251
|
+
button div {
|
|
252
|
+
background-color: transparent;
|
|
234
253
|
}
|
|
235
|
-
}
|
|
254
|
+
}
|
|
255
|
+
`;
|
|
236
256
|
|
|
237
257
|
const ListRow = ({
|
|
238
258
|
key,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
259
|
+
size = _types.Size.Medium,
|
|
260
|
+
variant = 'normal',
|
|
261
|
+
icon,
|
|
262
|
+
mainText,
|
|
263
|
+
secondaryText,
|
|
264
|
+
dropdown,
|
|
245
265
|
note,
|
|
246
|
-
|
|
266
|
+
noteTooltip,
|
|
267
|
+
disabled = false,
|
|
268
|
+
action
|
|
247
269
|
}) => {
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
270
|
+
const [inAction, setInAction] = React.useState(false);
|
|
271
|
+
|
|
272
|
+
const handleKeyPress = e => {
|
|
273
|
+
if (e.key === 'Enter') {
|
|
274
|
+
action && action();
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
const rowClassName = (inAction ? 'in-action ' : '').concat(disabled ? 'disabled ' : '').concat(!!action ? 'interactive ' : '').concat('list-item-row ').concat(`${variant} `).concat(`${size}`);
|
|
279
|
+
return /*#__PURE__*/React.createElement(Row, {
|
|
253
280
|
key: key,
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
color: color,
|
|
281
|
+
tabIndex: !!action && !disabled ? 0 : undefined,
|
|
282
|
+
className: rowClassName,
|
|
283
|
+
onKeyPress: e => !disabled && handleKeyPress(e),
|
|
284
|
+
onClick: e => {
|
|
285
|
+
!disabled && action && action();
|
|
286
|
+
},
|
|
261
287
|
"data-hj-suppress": true
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
className:
|
|
266
|
-
}
|
|
267
|
-
className:
|
|
268
|
-
}, /*#__PURE__*/React.createElement(
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
288
|
+
}, !!icon && /*#__PURE__*/React.createElement("div", {
|
|
289
|
+
className: 'list-item-icon'
|
|
290
|
+
}, icon), /*#__PURE__*/React.createElement("div", {
|
|
291
|
+
className: 'list-item-content'
|
|
292
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
293
|
+
className: 'list-item-main-text'
|
|
294
|
+
}, mainText), !!secondaryText && /*#__PURE__*/React.createElement("div", {
|
|
295
|
+
className: 'list-item-secondary-text'
|
|
296
|
+
}, secondaryText)), !!note && /*#__PURE__*/React.createElement(React.Fragment, null, !!noteTooltip && /*#__PURE__*/React.createElement("div", {
|
|
297
|
+
className: 'list-item-note with-tooltip'
|
|
298
|
+
}, /*#__PURE__*/React.createElement(_Tooltips.TooltipWrapper, {
|
|
299
|
+
label: noteTooltip,
|
|
300
|
+
size: size === _types.Size.Large ? _types.Size.Medium : size === _types.Size.Small ? _types.Size.XSmall : _types.Size.Small,
|
|
301
|
+
position: 'top',
|
|
302
|
+
withArrow: true
|
|
303
|
+
}, note)), !noteTooltip && /*#__PURE__*/React.createElement("div", {
|
|
304
|
+
className: 'list-item-note'
|
|
305
|
+
}, note)), !!dropdown && /*#__PURE__*/React.createElement("div", {
|
|
306
|
+
className: 'list-item-actions',
|
|
307
|
+
onMouseEnter: () => setInAction(!dropdown?.disabled),
|
|
308
|
+
onMouseLeave: () => setInAction(false)
|
|
309
|
+
}, /*#__PURE__*/React.createElement(_Dropdown.DropdownButton, _extends({}, dropdown, {
|
|
310
|
+
disabled: disabled || dropdown.disabled,
|
|
311
|
+
icon: variant === 'overlay' ? /*#__PURE__*/React.createElement(_icons.SystemIcons.ArrowDropDown, null) : /*#__PURE__*/React.createElement(_icons.SystemIcons.MoreVertical, null)
|
|
312
|
+
}))));
|
|
279
313
|
};
|
|
280
314
|
|
|
281
315
|
ListRow.propTypes = {
|
|
282
316
|
key: _propTypes2.default.string,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
size: _propTypes2.default.oneOf(['small', 'medium', 'large']).isRequired,
|
|
288
|
-
variant: _propTypes2.default.oneOf(['one-line', 'two-line', 'overlay']).isRequired,
|
|
317
|
+
variant: _propTypes2.default.oneOf(['normal', 'overlay']),
|
|
318
|
+
icon: _propTypes2.default.node,
|
|
319
|
+
mainText: _propTypes2.default.string.isRequired,
|
|
320
|
+
secondaryText: _propTypes2.default.string,
|
|
289
321
|
note: _propTypes2.default.string,
|
|
290
|
-
|
|
322
|
+
noteTooltip: _propTypes2.default.string,
|
|
323
|
+
disabled: _propTypes2.default.bool,
|
|
324
|
+
action: _propTypes2.default.func
|
|
291
325
|
};
|
|
292
326
|
exports.default = ListRow;
|
|
293
327
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/List/ListRow.tsx"],"names":["handleListHeight","size","RowWrapper","styled","div","props","COLORS","neutral_20","DisabledState","css","EditRow","primary_20","primary_100","LeftSection","ComponentSStyling","ComponentTextStyle","MainInfo","RightSection","Note","ButtonWrapper","UserDropdownButton","white","key","Icon","mainInfo","dropdownOptions","disableDifferentBackgroundforEvenNumbers","variant","note","disabled","renderTextData","renderDropdown","neutral_500","ListRow","color","React","dropdownActive","setDropdownActive"],"mappings":";;;;;;;;;;;;;;;;;;;;;MAAA,K;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,QAAMA,gBAAgB,GAAIC,IAAD,IAAiB;AACxC,YAAA,IAAA;AAEE,WAAA,OAAA;AAAe,eAAA,OAAA;;AACf,WAAA,QAAA;AAAgB,eAAA,OAAA;;AAChB;AAAU,eAAA,OAAA;AAJZ;AADF,GAAA;;AASA,QAAMC,UAAU,GAAGC,2BAAOC,GAAkE;AAC5F;AACA,wBAAwBC,KAAK,IAAKA,KAAK,CAALA,wCAAAA,GAAAA,SAAAA,GAA6DC,eAAOC,UAAY;AAClH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA,CAAA;AAoBA,QAAMC,aAAa,GAAGC,qBAAI;AAC1B;AACA;AAFA,CAAA;AAKA,QAAMC,OAAO,GAAGP,2BAAOC,GAAkB;AACzC;AACA;AACA;AACA;AACA;AACA,IAAIC,KAAK,IAAIA,KAAK,CAALA,QAAAA,GAAAA,aAAAA,GAAiC,EAAG;AACjD;AACA,aAAaA,KAAK,IAAIL,gBAAgB,CAACK,KAAK,CAAN,IAAA,CAAc;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwBC,eAAOK,UAAW;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwBL,eAAO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AAA;AAA2B,0BAAA;AAA3B,KAAA,EACGb,IAAI,IAAA,aAAI,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAM,MAAA,IAAI,EAAV,MAAA;AAAkB,MAAA,KAAK,EAAvB,KAAA;AAAgC,MAAA,SAAS,EAAC;AAA1C,KAAA,CADX,EAEIO,cAAc,CAAA,QAAA,EALpB,OAKoB,CAFlB,CAHF,EAAA,aAQE,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,IAAA,EAAA,aACE,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA;AAAe,MAAA,SAAS,EAAC;AAAzB,KAAA,EAAA,aACE,KAAA,CAAA,aAAA,CAAA,kBAAA,EAAA;AACE,MAAA,OAAO,EADT,WAAA;AAEE,MAAA,KAAK,EAFP,UAAA;AAGE,MAAA,MAAM,EAAE,MAAM;AACZO,QAAAA,iBAAiB,CAAjBA,IAAiB,CAAjBA;AACD;AALH,KAAA,EAOIN,cAAc,CAAA,OAAA,EARpB,IAQoB,CAPlB,CADF,EAWGK,cAAc,IAAA,aAAI,KAAA,CAAA,aAAA,CAAA,yBAAA,EAAA;AAAiB,MAAA,IAAI,EAArB,IAAA;AAA6B,MAAA,aAAa,EAAE,MAAMC,iBAAiB,CAAnE,KAAmE,CAAnE;AAA4E,MAAA,OAAO,EAAEZ;AAArF,KAAA,CAXrB,CADF,EAAA,aAeE,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAzBR,IAyBQ,CAfF,CARF,CADF,CADF;AAJF,GAAA;;;AA3CEH,IAAAA,G;AACAC,IAAAA,I;AACAC,IAAAA,Q;AACAC,IAAAA,e;AACAC,IAAAA,wC;AACAzB,IAAAA,I,6BAAM,O,EAAU,Q,EAAW,O;AAC3B0B,IAAAA,O,6BAAS,U,EAAa,U,EAAa,S;AACnCC,IAAAA,I;AACAC,IAAAA,Q;;oBAyEF,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","ComponentSStyling","ComponentTextStyle","ComponentMStyling","ComponentLStyling","ComponentXXSStyling","ComponentXSStyling","key","variant","icon","mainText","secondaryText","note","noteTooltip","disabled","action","ListRow","size","Size","React","handleKeyPress","e","rowClassName","inAction","setInAction","dropdown"],"mappings":";;;;;;;;;;;;;;;;;;;;;MAAA,K;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,QAAMA,GAAG,GAAGC,2BAAOC,GAAI;AACvB;AACA;AACA;AACA;AACA,6BAA6BC,eAAOC,WAAY;AAChD;AACA;AACA;AACA,WAAWD,eAAOE,WAAY;AAC9B,sBAAsBF,eAAOG,KAAM;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwBH,eAAOI,UAAW;AAC1C,aAAaJ,eAAOK,WAAY;AAChC;AACA;AACA;AACA,wBAAwBL,eAAOM,WAAY;AAC3C,aAAaN,eAAOO,WAAY;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeP,eAAOQ,WAAY;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQC,mCAAkBC,2BAAD,OAAjBD,EAAiB,IAAjBA,CAAoD;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQE,mCAAkBD,2BAAD,OAAjBC,EAAiB,IAAjBA,CAAoD;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQC,mCAAkBF,2BAAD,OAAjBE,EAAiB,IAAjBA,CAAoD;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,qCAAoBH,2BAAD,OAAnBG,EAAmB,IAAnBA,CAAsD;AAC5D;AACA;AACA;AACA,aAAab,eAAOE,WAAY;AAChC;AACA,MAAMY,oCAAmBJ,2BAAD,OAAlBI,EAAkB,IAAlBA,CAAqD;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAad,eAAOE,WAAY;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AA1JA,CAAA;;AA4KA,QAAMsB,OAAuC,GAAG,CAAC;AAAA,IAAA,GAAA;AAEEC,IAAAA,IAAI,GAAGC,YAFT,MAAA;AAGEV,IAAAA,OAAO,GAHT,QAAA;AAAA,IAAA,IAAA;AAAA,IAAA,QAAA;AAAA,IAAA,aAAA;AAAA,IAAA,QAAA;AAAA,IAAA,IAAA;AAAA,IAAA,WAAA;AAUEM,IAAAA,QAAQ,GAVV,KAAA;AAWEC,IAAAA;AAXF,GAAD,KAYc;AAE5D,UA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GAAAA,aACF,KAAA,CAAA,aAAA,CAAA,mBAAA,aAAA,EADEA,IACF,CADEA,GAAAA,aAEF,KAAA,CAAA,aAAA,CAAA,mBAAA,YAAA,EAAA,IAAA;AAJpB,KAAA,CAAA,CAHF,CAxCJ,CADF;AA7BF,GAAA;;;AAbED,IAAAA,G;AAEAC,IAAAA,O,6BAAU,Q,EAAW,S;AACrBC,IAAAA,I;AACAC,IAAAA,Q;AACAC,IAAAA,a;AAEAC,IAAAA,I;AACAC,IAAAA,W;AACAC,IAAAA,Q;AACAC,IAAAA,M;;oBAwFF,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"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["react", "@testing-library/react", "../index", "../../icons
|
|
3
|
+
define(["react", "@testing-library/react", "../index", "../../types", "../../icons"], factory);
|
|
4
4
|
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(require("react"), require("@testing-library/react"), require("../index"), require("../../icons
|
|
5
|
+
factory(require("react"), require("@testing-library/react"), require("../index"), require("../../types"), require("../../icons"));
|
|
6
6
|
} else {
|
|
7
7
|
var mod = {
|
|
8
8
|
exports: {}
|
|
9
9
|
};
|
|
10
|
-
factory(global.react, global.react, global.index, global.
|
|
10
|
+
factory(global.react, global.react, global.index, global.types, global.icons);
|
|
11
11
|
global.undefined = mod.exports;
|
|
12
12
|
}
|
|
13
|
-
})(this, function (_react, _react3, _index,
|
|
13
|
+
})(this, function (_react, _react3, _index, _types, _icons) {
|
|
14
14
|
"use strict";
|
|
15
15
|
|
|
16
16
|
var _react2 = _interopRequireDefault(_react);
|
|
@@ -26,56 +26,13 @@
|
|
|
26
26
|
const {
|
|
27
27
|
getByText
|
|
28
28
|
} = (0, _react3.render)( /*#__PURE__*/_react2.default.createElement(_index.ListRow, {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
label: 'Option 1',
|
|
33
|
-
action: () => {},
|
|
34
|
-
key: 'Test1'
|
|
35
|
-
}, {
|
|
36
|
-
label: 'Option 2',
|
|
37
|
-
action: () => {},
|
|
38
|
-
key: 'Test2'
|
|
39
|
-
}],
|
|
40
|
-
variant: "one-line",
|
|
41
|
-
size: "small",
|
|
29
|
+
icon: /*#__PURE__*/_react2.default.createElement(_icons.SystemIcons.Institute, null),
|
|
30
|
+
mainText: 'Laerdal Medical AS',
|
|
31
|
+
size: _types.Size.Small,
|
|
42
32
|
disabled: false
|
|
43
|
-
}
|
|
33
|
+
}));
|
|
44
34
|
expect(getByText('Laerdal Medical AS')).toBeDefined();
|
|
45
35
|
});
|
|
46
|
-
it('When menu is clicked, it opens', async () => {
|
|
47
|
-
const {
|
|
48
|
-
getByRole,
|
|
49
|
-
getByText
|
|
50
|
-
} = (0, _react3.render)( /*#__PURE__*/_react2.default.createElement(_index.ListRow, {
|
|
51
|
-
Icon: _SystemIcons.Institute,
|
|
52
|
-
mainInfo: /*#__PURE__*/_react2.default.createElement("div", null, "Laerdal Medical AS"),
|
|
53
|
-
dropdownOptions: [{
|
|
54
|
-
label: 'Option 1',
|
|
55
|
-
action: () => {},
|
|
56
|
-
key: 'Test1'
|
|
57
|
-
}, {
|
|
58
|
-
label: 'Option 2',
|
|
59
|
-
action: () => {},
|
|
60
|
-
key: 'Test2'
|
|
61
|
-
}],
|
|
62
|
-
variant: "two-line",
|
|
63
|
-
size: "large",
|
|
64
|
-
disabled: true
|
|
65
|
-
}, "Menu 1")); //expect(getByText('Option 1')).not.toBeDefined();
|
|
66
|
-
|
|
67
|
-
getByRole('button').click();
|
|
68
|
-
expect(getByText('Option 1')).toBeDefined();
|
|
69
|
-
});
|
|
70
|
-
/*it('Renders with required input if specified', async () => {
|
|
71
|
-
const { getByPlaceholderText } = render(<DropdownFilter id="Dropdown" list={list} placeholder="Placeholder" required />);
|
|
72
|
-
expect(getByPlaceholderText('Placeholder').required).toBe(true);
|
|
73
|
-
});
|
|
74
|
-
it('Renders with inital value if specified', async () => {
|
|
75
|
-
const initialValue = 'Contact';
|
|
76
|
-
const { getByPlaceholderText } = render(<DropdownFilter id="Dropdown" list={list} placeholder="Placeholder" initalValue={initialValue} />);
|
|
77
|
-
expect(getByPlaceholderText('Placeholder').value).toBe(initialValue);
|
|
78
|
-
});*/
|
|
79
36
|
});
|
|
80
37
|
});
|
|
81
38
|
//# sourceMappingURL=ListRow.tests.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/List/__tests__/ListRow.tests.tsx"],"names":["describe","it","getByText","render","
|
|
1
|
+
{"version":3,"sources":["../../../../src/List/__tests__/ListRow.tests.tsx"],"names":["describe","it","getByText","render","Size","expect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAMAA,EAAAA,QAAQ,CAAA,aAAA,EAAgB,MAAM;AAC5BC,IAAAA,EAAE,CAAA,SAAA,EAAY,YAAY;AACxB,YAAM;AAACC,QAAAA;AAAD,UAAcC,qBAAM,aACxB,gBAAA,aAAA,CAAA,cAAA,EAAA;AACE,QAAA,IAAI,EAAA,aAAE,gBAAA,aAAA,CAAA,mBAAA,SAAA,EADR,IACQ,CADR;AAEE,QAAA,QAAQ,EAFV,oBAAA;AAGE,QAAA,IAAI,EAAEC,YAHR,KAAA;AAIE,QAAA,QAAQ,EAAE;AAJZ,OAAA,CADkBD,CAApB;AAOAE,MAAAA,MAAM,CAACH,SAAS,CAAhBG,oBAAgB,CAAV,CAANA,CAAAA,WAAAA;AARFJ,KAAE,CAAFA;AADFD,GAAQ,CAARA","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"}
|
package/dist/umd/List/index.js
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "./ListRow"
|
|
3
|
+
define(["exports", "./ListRow"], factory);
|
|
4
4
|
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("./ListRow")
|
|
5
|
+
factory(exports, require("./ListRow"));
|
|
6
6
|
} else {
|
|
7
7
|
var mod = {
|
|
8
8
|
exports: {}
|
|
9
9
|
};
|
|
10
|
-
factory(mod.exports, global.ListRow
|
|
10
|
+
factory(mod.exports, global.ListRow);
|
|
11
11
|
global.undefined = mod.exports;
|
|
12
12
|
}
|
|
13
|
-
})(this, function (exports, _ListRow
|
|
13
|
+
})(this, function (exports, _ListRow) {
|
|
14
14
|
"use strict";
|
|
15
15
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", {
|
|
17
17
|
value: true
|
|
18
18
|
});
|
|
19
|
-
exports.
|
|
19
|
+
exports.ListRow = undefined;
|
|
20
20
|
|
|
21
21
|
var _ListRow2 = _interopRequireDefault(_ListRow);
|
|
22
22
|
|
|
23
|
-
var _ListRowDropdown2 = _interopRequireDefault(_ListRowDropdown);
|
|
24
|
-
|
|
25
23
|
function _interopRequireDefault(obj) {
|
|
26
24
|
return obj && obj.__esModule ? obj : {
|
|
27
25
|
default: obj
|
|
@@ -29,6 +27,5 @@
|
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
exports.ListRow = _ListRow2.default;
|
|
32
|
-
exports.ListRowDropdown = _ListRowDropdown2.default;
|
|
33
30
|
});
|
|
34
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/List/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/List/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;UAEA,O,GAAA,iB","sourcesContent":["import ListRow from './ListRow';\n\nexport {ListRow};\n"],"file":"index.js"}
|