@decisiv/ui-components 2.0.1-alpha.221 → 2.0.1-alpha.223
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/lib/atoms/OptionsList/Category/index.d.ts +1 -1
- package/lib/atoms/OptionsList/Category/index.d.ts.map +1 -1
- package/lib/atoms/OptionsList/Category/index.js +55 -13
- package/lib/atoms/OptionsList/Category/styles.d.ts +1 -2
- package/lib/atoms/OptionsList/Category/styles.d.ts.map +1 -1
- package/lib/atoms/OptionsList/Category/styles.js +0 -1
- package/lib/atoms/OptionsList/Option/index.d.ts.map +1 -1
- package/lib/atoms/OptionsList/Option/index.js +15 -5
- package/lib/atoms/OptionsList/Option/styles.d.ts.map +1 -1
- package/lib/atoms/OptionsList/Option/styles.js +1 -1
- package/lib/atoms/OptionsList/index.d.ts +1 -44
- package/lib/atoms/OptionsList/index.d.ts.map +1 -1
- package/lib/atoms/OptionsList/index.js +245 -37
- package/lib/atoms/OptionsList/index.test.js +139 -30
- package/lib/atoms/OptionsList/schema.d.ts.map +1 -1
- package/lib/atoms/OptionsList/schema.js +2 -1
- package/lib/atoms/OptionsList/styles.d.ts +45 -0
- package/lib/atoms/OptionsList/styles.d.ts.map +1 -0
- package/lib/atoms/OptionsList/styles.js +29 -0
- package/lib/atoms/OptionsList/types.d.ts +28 -1
- package/lib/atoms/OptionsList/types.d.ts.map +1 -1
- package/lib/atoms/OptionsList/utils.d.ts +3 -1
- package/lib/atoms/OptionsList/utils.d.ts.map +1 -1
- package/lib/atoms/OptionsList/utils.js +79 -2
- package/lib/components/Combobox/index.d.ts.map +1 -1
- package/lib/components/Combobox/index.js +4 -2
- package/lib/components/Combobox/index.test.js +10 -6
- package/lib/components/Combobox/types.d.ts +1 -0
- package/lib/components/Combobox/types.d.ts.map +1 -1
- package/lib/components/Table/Grip.d.ts +6 -2
- package/lib/components/Table/Grip.d.ts.map +1 -1
- package/lib/components/Table/Grip.js +9 -3
- package/lib/components/Wizard/index.d.ts +8 -1
- package/lib/components/Wizard/index.d.ts.map +1 -1
- package/lib/components/Wizard/index.js +31 -19
- package/lib/components/Wizard/index.test.js +117 -28
- package/lib/components/Wizard/schema.d.ts.map +1 -1
- package/lib/components/Wizard/schema.js +4 -3
- package/package.json +3 -1
|
@@ -101,12 +101,65 @@ var defaultProps = {
|
|
|
101
101
|
onChange: jest.fn()
|
|
102
102
|
};
|
|
103
103
|
describe('OptionsList', function () {
|
|
104
|
+
describe('virtualization', function () {
|
|
105
|
+
it('renders with virtualization enabled', function () {
|
|
106
|
+
var _render = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
107
|
+
enableVirtualization: true
|
|
108
|
+
})), {
|
|
109
|
+
wrapper: wrapper
|
|
110
|
+
}),
|
|
111
|
+
container = _render.container; // Verify that react-window's List container is rendered
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
var listContainer = container.querySelector('[style*="overflow"]');
|
|
115
|
+
expect(listContainer).toBeTruthy();
|
|
116
|
+
});
|
|
117
|
+
it('renders without virtualization by default', function () {
|
|
118
|
+
var _render2 = render(_react.default.createElement(_.default, defaultProps), {
|
|
119
|
+
wrapper: wrapper
|
|
120
|
+
}),
|
|
121
|
+
queryByText = _render2.queryByText; // Verify all items are rendered directly (not virtualized)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
expect(queryByText(item0Label)).toBeTruthy();
|
|
125
|
+
expect(queryByText('Option 1')).toBeTruthy();
|
|
126
|
+
expect(queryByText(item2Label)).toBeTruthy();
|
|
127
|
+
});
|
|
128
|
+
it('warns when enableVirtualization is used with drag-drop', function () {
|
|
129
|
+
var consoleSpy = jest.spyOn(console, 'warn').mockImplementation();
|
|
130
|
+
var onDragEnd = jest.fn();
|
|
131
|
+
render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
132
|
+
enableVirtualization: true,
|
|
133
|
+
onDragEnd: onDragEnd
|
|
134
|
+
})), {
|
|
135
|
+
wrapper: wrapper
|
|
136
|
+
});
|
|
137
|
+
expect(consoleSpy).toHaveBeenCalledWith('OptionsList: enableVirtualization is ignored when onDragEnd is provided. Virtualization and drag-and-drop are incompatible.');
|
|
138
|
+
consoleSpy.mockRestore();
|
|
139
|
+
});
|
|
140
|
+
it('disables virtualization when drag-drop is enabled', function () {
|
|
141
|
+
var onDragEnd = jest.fn();
|
|
142
|
+
|
|
143
|
+
var _render3 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
144
|
+
enableVirtualization: true,
|
|
145
|
+
onDragEnd: onDragEnd
|
|
146
|
+
})), {
|
|
147
|
+
wrapper: wrapper
|
|
148
|
+
}),
|
|
149
|
+
queryByText = _render3.queryByText; // All items should be rendered directly (not virtualized) when drag-drop is enabled
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
expect(queryByText(item0Label)).toBeTruthy();
|
|
153
|
+
expect(queryByText('Option 1')).toBeTruthy();
|
|
154
|
+
expect(queryByText(item2Label)).toBeTruthy();
|
|
155
|
+
});
|
|
156
|
+
});
|
|
104
157
|
['small', 'medium'].forEach(function (size) {
|
|
105
158
|
it('renders items and categories sub items', function () {
|
|
106
|
-
var
|
|
159
|
+
var _render4 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
107
160
|
size: size
|
|
108
161
|
}))),
|
|
109
|
-
queryByText =
|
|
162
|
+
queryByText = _render4.queryByText;
|
|
110
163
|
|
|
111
164
|
items.forEach(function (item) {
|
|
112
165
|
var label = item.label;
|
|
@@ -126,11 +179,11 @@ describe('OptionsList', function () {
|
|
|
126
179
|
return _react.default.createElement("span", null, "".concat(label, " foo"));
|
|
127
180
|
};
|
|
128
181
|
|
|
129
|
-
var
|
|
182
|
+
var _render5 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
130
183
|
renderOptionLabel: renderOptionLabel,
|
|
131
184
|
size: size
|
|
132
185
|
}))),
|
|
133
|
-
queryByText =
|
|
186
|
+
queryByText = _render5.queryByText;
|
|
134
187
|
|
|
135
188
|
items.forEach(function (item) {
|
|
136
189
|
var label = item.label;
|
|
@@ -146,19 +199,19 @@ describe('OptionsList', function () {
|
|
|
146
199
|
});
|
|
147
200
|
});
|
|
148
201
|
it('checks that labelDetails when provided ', function () {
|
|
149
|
-
var
|
|
202
|
+
var _render6 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
150
203
|
size: size
|
|
151
204
|
}))),
|
|
152
|
-
getByText =
|
|
205
|
+
getByText = _render6.getByText;
|
|
153
206
|
|
|
154
207
|
expect(getByText('test detail label')).toBeInTheDocument();
|
|
155
208
|
});
|
|
156
209
|
it('navigates through the options with arrow keys', function () {
|
|
157
|
-
var
|
|
210
|
+
var _render7 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
158
211
|
size: size
|
|
159
212
|
}))),
|
|
160
|
-
getByText =
|
|
161
|
-
container =
|
|
213
|
+
getByText = _render7.getByText,
|
|
214
|
+
container = _render7.container;
|
|
162
215
|
|
|
163
216
|
var optionsList = container.querySelector('ul'); // simulate it is focused while tabbing
|
|
164
217
|
|
|
@@ -187,12 +240,12 @@ describe('OptionsList', function () {
|
|
|
187
240
|
it('selects an item with Enter or Space key', function () {
|
|
188
241
|
var onChange = jest.fn();
|
|
189
242
|
|
|
190
|
-
var
|
|
243
|
+
var _render8 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
191
244
|
onChange: onChange,
|
|
192
245
|
size: size
|
|
193
246
|
}))),
|
|
194
|
-
getByLabelText =
|
|
195
|
-
container =
|
|
247
|
+
getByLabelText = _render8.getByLabelText,
|
|
248
|
+
container = _render8.container;
|
|
196
249
|
|
|
197
250
|
var selectedItem = defaultProps.items[1];
|
|
198
251
|
var optionsList = container.querySelector('ul'); // simulate it is focused while tabbing
|
|
@@ -229,13 +282,13 @@ describe('OptionsList', function () {
|
|
|
229
282
|
disabled: true
|
|
230
283
|
}];
|
|
231
284
|
|
|
232
|
-
var
|
|
285
|
+
var _render9 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
233
286
|
items: onlyDisabledItems,
|
|
234
287
|
onChange: onChange,
|
|
235
288
|
size: size
|
|
236
289
|
}))),
|
|
237
|
-
getByLabelText =
|
|
238
|
-
container =
|
|
290
|
+
getByLabelText = _render9.getByLabelText,
|
|
291
|
+
container = _render9.container;
|
|
239
292
|
|
|
240
293
|
var optionsList = container.querySelector('ul'); // simulate it is focused while tabbing
|
|
241
294
|
|
|
@@ -262,12 +315,12 @@ describe('OptionsList', function () {
|
|
|
262
315
|
it('calls onChange with id when item is clicked', function () {
|
|
263
316
|
var onChange = jest.fn();
|
|
264
317
|
|
|
265
|
-
var
|
|
318
|
+
var _render10 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
266
319
|
onChange: onChange,
|
|
267
320
|
size: size
|
|
268
321
|
}))),
|
|
269
|
-
getByText =
|
|
270
|
-
getByLabelText =
|
|
322
|
+
getByText = _render10.getByText,
|
|
323
|
+
getByLabelText = _render10.getByLabelText;
|
|
271
324
|
|
|
272
325
|
var item = items[0];
|
|
273
326
|
|
|
@@ -286,12 +339,12 @@ describe('OptionsList', function () {
|
|
|
286
339
|
it('does not calls onChange when item is clicked', function () {
|
|
287
340
|
var onChange = jest.fn();
|
|
288
341
|
|
|
289
|
-
var
|
|
342
|
+
var _render11 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
290
343
|
onChange: onChange,
|
|
291
344
|
size: size
|
|
292
345
|
}))),
|
|
293
|
-
getByText =
|
|
294
|
-
getByLabelText =
|
|
346
|
+
getByText = _render11.getByText,
|
|
347
|
+
getByLabelText = _render11.getByLabelText;
|
|
295
348
|
|
|
296
349
|
_react2.fireEvent.click(getByText(disabledItemLabel));
|
|
297
350
|
|
|
@@ -305,12 +358,12 @@ describe('OptionsList', function () {
|
|
|
305
358
|
it('prefers value over internal', function () {
|
|
306
359
|
var selected = items[1];
|
|
307
360
|
|
|
308
|
-
var
|
|
361
|
+
var _render12 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
309
362
|
selected: selected.id,
|
|
310
363
|
size: size
|
|
311
364
|
}))),
|
|
312
|
-
getByText =
|
|
313
|
-
getByLabelText =
|
|
365
|
+
getByText = _render12.getByText,
|
|
366
|
+
getByLabelText = _render12.getByLabelText;
|
|
314
367
|
|
|
315
368
|
var item = items[0];
|
|
316
369
|
|
|
@@ -325,13 +378,13 @@ describe('OptionsList', function () {
|
|
|
325
378
|
it('calls onChange with array of selected ids when item is clicked', function () {
|
|
326
379
|
var onChange = jest.fn();
|
|
327
380
|
|
|
328
|
-
var
|
|
381
|
+
var _render13 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
329
382
|
onChange: onChange,
|
|
330
383
|
multiple: true,
|
|
331
384
|
size: size
|
|
332
385
|
}))),
|
|
333
|
-
getByText =
|
|
334
|
-
getByLabelText =
|
|
386
|
+
getByText = _render13.getByText,
|
|
387
|
+
getByLabelText = _render13.getByLabelText;
|
|
335
388
|
|
|
336
389
|
var item = items[0];
|
|
337
390
|
|
|
@@ -370,13 +423,13 @@ describe('OptionsList', function () {
|
|
|
370
423
|
onClick: onClick
|
|
371
424
|
}];
|
|
372
425
|
|
|
373
|
-
var
|
|
426
|
+
var _render14 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
374
427
|
actions: actions,
|
|
375
428
|
multiple: true,
|
|
376
429
|
size: size
|
|
377
430
|
}))),
|
|
378
|
-
baseElement =
|
|
379
|
-
getByText =
|
|
431
|
+
baseElement = _render14.baseElement,
|
|
432
|
+
getByText = _render14.getByText;
|
|
380
433
|
|
|
381
434
|
actions.forEach(function (_ref5) {
|
|
382
435
|
var label = _ref5.text;
|
|
@@ -385,5 +438,61 @@ describe('OptionsList', function () {
|
|
|
385
438
|
expect(baseElement).toMatchSnapshot();
|
|
386
439
|
});
|
|
387
440
|
});
|
|
441
|
+
describe('drag and drop', function () {
|
|
442
|
+
it('has draggable attributes', function () {
|
|
443
|
+
var mockedFn = jest.fn();
|
|
444
|
+
|
|
445
|
+
var _render15 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
446
|
+
size: size,
|
|
447
|
+
onDragEnd: mockedFn
|
|
448
|
+
}))),
|
|
449
|
+
getByText = _render15.getByText;
|
|
450
|
+
|
|
451
|
+
var item = items[0];
|
|
452
|
+
expect(getByText(item.label).closest('li')).toHaveAttribute('draggable');
|
|
453
|
+
var category = items[2];
|
|
454
|
+
category.items.forEach(function (subItem) {
|
|
455
|
+
expect(getByText(subItem.label).closest('li')).toHaveAttribute('draggable');
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
|
+
it('does not have draggable attributes when onDragEnd is not provided', function () {
|
|
459
|
+
var _render16 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
460
|
+
size: size
|
|
461
|
+
}))),
|
|
462
|
+
getByText = _render16.getByText;
|
|
463
|
+
|
|
464
|
+
var item = items[0];
|
|
465
|
+
expect(getByText(item.label).closest('li')).not.toHaveAttribute('draggable');
|
|
466
|
+
var category = items[2];
|
|
467
|
+
category.items.forEach(function (subItem) {
|
|
468
|
+
expect(getByText(subItem.label).closest('li')).not.toHaveAttribute('draggable');
|
|
469
|
+
});
|
|
470
|
+
}); // TODO: re-enable once migrated to pragmatic-drag-and-drop
|
|
471
|
+
|
|
472
|
+
it.skip('calls onDragEnd when drag ends', function () {
|
|
473
|
+
var mockedFn = jest.fn();
|
|
474
|
+
|
|
475
|
+
var _render17 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
476
|
+
size: size,
|
|
477
|
+
onDragEnd: mockedFn
|
|
478
|
+
}))),
|
|
479
|
+
getByText = _render17.getByText;
|
|
480
|
+
|
|
481
|
+
var draggableElement = getByText(items[0].label).closest('li');
|
|
482
|
+
var dropTarget = getByText('Option 2').closest('li');
|
|
483
|
+
|
|
484
|
+
_react2.fireEvent.dragStart(draggableElement);
|
|
485
|
+
|
|
486
|
+
_react2.fireEvent.dragEnter(dropTarget);
|
|
487
|
+
|
|
488
|
+
_react2.fireEvent.dragOver(dropTarget);
|
|
489
|
+
|
|
490
|
+
_react2.fireEvent.drop(dropTarget);
|
|
491
|
+
|
|
492
|
+
_react2.fireEvent.dragEnd(draggableElement);
|
|
493
|
+
|
|
494
|
+
expect(mockedFn).toHaveBeenCalled();
|
|
495
|
+
});
|
|
496
|
+
});
|
|
388
497
|
});
|
|
389
498
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/atoms/OptionsList/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/atoms/OptionsList/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAA2C,CAAC;AAgFxD,eAAe,MAAM,CAAC"}
|
|
@@ -41,7 +41,8 @@ schema.makePropTypes = function () {
|
|
|
41
41
|
selectable: _reactDesc.PropTypes.bool.description('Enables selection in the options list.').defaultValue(true),
|
|
42
42
|
role: _reactDesc.PropTypes.string.description('The role assigned to the list.').defaultValue('listbox'),
|
|
43
43
|
itemRole: _reactDesc.PropTypes.string.description('The role assigned to each item in the list.').defaultValue('option'),
|
|
44
|
-
size: _reactDesc.PropTypes.oneOf(['small', 'medium']).description('Defines the size of the OptionList').defaultValue('small')
|
|
44
|
+
size: _reactDesc.PropTypes.oneOf(['small', 'medium']).description('Defines the size of the OptionList').defaultValue('small'),
|
|
45
|
+
onDragEnd: _reactDesc.PropTypes.func.description("If present, enables Drag-and-Drop sorting. This function will be called after the order of rows changes when a row is dragged and dropped. It is called with 2 arguments: the index from where it's dragged, and the index to where it's dropped. If there are grouped rows then each argument is an array where the first element is the group index and the second the row index inside the group. See below for function signature.")
|
|
45
46
|
};
|
|
46
47
|
};
|
|
47
48
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const Container: import("styled-components").StyledComponent<"ul", any, Pick<Partial<{
|
|
2
|
+
height?: string | import("../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
|
|
3
|
+
readonly XS: "XS";
|
|
4
|
+
readonly SM: "SM";
|
|
5
|
+
readonly MD: "MD";
|
|
6
|
+
readonly LG: "LG";
|
|
7
|
+
readonly XL: "XL";
|
|
8
|
+
}> | undefined;
|
|
9
|
+
maxHeight?: string | import("../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
|
|
10
|
+
readonly XS: "XS";
|
|
11
|
+
readonly SM: "SM";
|
|
12
|
+
readonly MD: "MD";
|
|
13
|
+
readonly LG: "LG";
|
|
14
|
+
readonly XL: "XL";
|
|
15
|
+
}> | undefined;
|
|
16
|
+
maxWidth?: string | import("../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
|
|
17
|
+
readonly XS: "XS";
|
|
18
|
+
readonly SM: "SM";
|
|
19
|
+
readonly MD: "MD";
|
|
20
|
+
readonly LG: "LG";
|
|
21
|
+
readonly XL: "XL";
|
|
22
|
+
}> | undefined;
|
|
23
|
+
minHeight?: string | import("../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
|
|
24
|
+
readonly XS: "XS";
|
|
25
|
+
readonly SM: "SM";
|
|
26
|
+
readonly MD: "MD";
|
|
27
|
+
readonly LG: "LG";
|
|
28
|
+
readonly XL: "XL";
|
|
29
|
+
}> | undefined;
|
|
30
|
+
minWidth?: string | import("../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
|
|
31
|
+
readonly XS: "XS";
|
|
32
|
+
readonly SM: "SM";
|
|
33
|
+
readonly MD: "MD";
|
|
34
|
+
readonly LG: "LG";
|
|
35
|
+
readonly XL: "XL";
|
|
36
|
+
}> | undefined;
|
|
37
|
+
width?: string | import("../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
|
|
38
|
+
readonly XS: "XS";
|
|
39
|
+
readonly SM: "SM";
|
|
40
|
+
readonly MD: "MD";
|
|
41
|
+
readonly LG: "LG";
|
|
42
|
+
readonly XL: "XL";
|
|
43
|
+
}> | undefined;
|
|
44
|
+
}>, "maxHeight" | "maxWidth" | "minWidth">, never>;
|
|
45
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/atoms/OptionsList/styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAmCrB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Container = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
15
|
+
var Container = _styledComponents.default.ul.withConfig({
|
|
16
|
+
displayName: "styles__Container",
|
|
17
|
+
componentId: "sc-1rytot8-0"
|
|
18
|
+
})(["list-style:none;margin:0;width:100%;height:auto;max-height:", ";max-width:", ";padding:0;overflow:auto;position:relative;", " ", " ", " &:focus{outline:none;}"], (0, _rem.default)(310), (0, _rem.default)(340), function (_ref) {
|
|
19
|
+
var minWidth = _ref.minWidth;
|
|
20
|
+
return minWidth ? "\n min-width: ".concat(minWidth, ";\n") : '';
|
|
21
|
+
}, function (_ref2) {
|
|
22
|
+
var maxWidth = _ref2.maxWidth;
|
|
23
|
+
return maxWidth ? "\n max-width: ".concat(maxWidth, ";\n") : '';
|
|
24
|
+
}, function (_ref3) {
|
|
25
|
+
var maxHeight = _ref3.maxHeight;
|
|
26
|
+
return maxHeight ? "\n max-height: ".concat(maxHeight, ";\n") : '';
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
exports.Container = Container;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BorderRadiusProperty } from 'csstype';
|
|
2
2
|
import { KeyboardEvent } from 'react';
|
|
3
3
|
import { IconProps } from '@decisiv/iconix';
|
|
4
|
+
import { DraggableProvidedDragHandleProps, DraggableProvidedDraggableProps } from 'react-beautiful-dnd';
|
|
4
5
|
import { AvatarProps } from '../../components/Avatar';
|
|
5
6
|
import { BadgeProps } from '../../components/Badge';
|
|
6
7
|
import { DimensionsProps } from '../../modifiers/dimensions';
|
|
@@ -41,6 +42,8 @@ export interface Category {
|
|
|
41
42
|
label: string;
|
|
42
43
|
showCheckbox?: boolean;
|
|
43
44
|
size?: Size;
|
|
45
|
+
indexOffset?: number;
|
|
46
|
+
isDragEnabled?: boolean;
|
|
44
47
|
}
|
|
45
48
|
export declare type CategoryProps = Category;
|
|
46
49
|
export declare type IconComponent = (props: IconProps) => JSX.Element;
|
|
@@ -54,6 +57,10 @@ interface BaseOption {
|
|
|
54
57
|
showCheckbox?: boolean;
|
|
55
58
|
meta?: Record<any, unknown>;
|
|
56
59
|
size?: Size;
|
|
60
|
+
providerRef?: React.Ref<HTMLLIElement>;
|
|
61
|
+
draggableProps?: DraggableProvidedDraggableProps;
|
|
62
|
+
dragHandleProps?: DraggableProvidedDragHandleProps;
|
|
63
|
+
isDragEnabled?: boolean;
|
|
57
64
|
}
|
|
58
65
|
export interface ItemOption extends BaseOption {
|
|
59
66
|
value?: string;
|
|
@@ -85,10 +92,15 @@ export interface OptionsListProps extends OptionsListDimensions {
|
|
|
85
92
|
role?: string;
|
|
86
93
|
itemRole?: string;
|
|
87
94
|
pointerEvents?: string;
|
|
95
|
+
onDragEnd?: (from: number | number[], to: number | number[]) => void;
|
|
96
|
+
enableVirtualization?: boolean;
|
|
88
97
|
}
|
|
89
98
|
export declare type OptionsListContainerRef = HTMLUListElement;
|
|
90
|
-
export interface StyledCategoryProps
|
|
99
|
+
export interface StyledCategoryProps {
|
|
91
100
|
size: Size;
|
|
101
|
+
ref?: React.Ref<HTMLLIElement>;
|
|
102
|
+
ariaDisabled?: boolean;
|
|
103
|
+
role?: string;
|
|
92
104
|
}
|
|
93
105
|
export interface ContainerProps {
|
|
94
106
|
borderRadius?: BorderRadiusProperty<string>;
|
|
@@ -101,5 +113,20 @@ export interface ContainerProps {
|
|
|
101
113
|
export interface StyledLinkProps extends LinkProps {
|
|
102
114
|
disabled: boolean;
|
|
103
115
|
}
|
|
116
|
+
export interface FlattenedItem {
|
|
117
|
+
item: Item;
|
|
118
|
+
type: 'option' | 'category-header';
|
|
119
|
+
originalItem: Item;
|
|
120
|
+
}
|
|
121
|
+
export interface VirtualRowProps {
|
|
122
|
+
index: number;
|
|
123
|
+
style: React.CSSProperties;
|
|
124
|
+
data: {
|
|
125
|
+
flattenedItems: FlattenedItem[];
|
|
126
|
+
borderRadius?: string;
|
|
127
|
+
showCheckbox: boolean;
|
|
128
|
+
size: 'small' | 'medium';
|
|
129
|
+
};
|
|
130
|
+
}
|
|
104
131
|
export {};
|
|
105
132
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/atoms/OptionsList/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAA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KAAK,CAAC,aAAa,CAAC;IAC3B,IAAI,EAAE;QACJ,cAAc,EAAE,aAAa,EAAE,CAAC;QAChC,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,OAAO,CAAC;QACtB,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;KAC1B,CAAC;CACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Item, Category, Option, LinkOption } from './types';
|
|
1
|
+
import { Item, Category, Option, LinkOption, FlattenedItem } from './types';
|
|
2
2
|
export declare const getId: (item: Item) => string;
|
|
3
3
|
export declare const isCategory: (item: Item) => item is Category;
|
|
4
4
|
export declare const sanitizeIds: (ids: string | string[] | undefined, multiple: boolean) => string[];
|
|
@@ -6,4 +6,6 @@ export declare const ensureItemIsVisible: (container: HTMLUListElement | null, i
|
|
|
6
6
|
focus?: boolean | undefined;
|
|
7
7
|
} | undefined) => void;
|
|
8
8
|
export declare const isLink: (item: Option) => item is LinkOption;
|
|
9
|
+
export declare const flattenItems: (items: Item[]) => FlattenedItem[];
|
|
10
|
+
export declare const getItemHeight: (flattenedItem: FlattenedItem, size?: "small" | "medium") => number;
|
|
9
11
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/atoms/OptionsList/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/atoms/OptionsList/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE5E,eAAO,MAAM,KAAK,wBAAgD,CAAC;AAEnE,eAAO,MAAM,UAAU,kCACuB,CAAC;AAE/C,eAAO,MAAM,WAAW,qEAWvB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;sBA+B/B,CAAC;AAEF,eAAO,MAAM,MAAM,sCACgB,CAAC;AAepC,eAAO,MAAM,YAAY,oCA+BxB,CAAC;AAYF,eAAO,MAAM,aAAa,qEAkBzB,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isLink = exports.ensureItemIsVisible = exports.sanitizeIds = exports.isCategory = exports.getId = void 0;
|
|
6
|
+
exports.getItemHeight = exports.flattenItems = exports.isLink = exports.ensureItemIsVisible = exports.sanitizeIds = exports.isCategory = exports.getId = void 0;
|
|
7
7
|
|
|
8
8
|
var _castArray = _interopRequireDefault(require("lodash/castArray"));
|
|
9
9
|
|
|
@@ -73,5 +73,82 @@ exports.ensureItemIsVisible = ensureItemIsVisible;
|
|
|
73
73
|
var isLink = function isLink(item) {
|
|
74
74
|
return 'linkTo' in item && !!item.linkTo;
|
|
75
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* Flatten items array to include category items inline for virtualization
|
|
78
|
+
*
|
|
79
|
+
* Categories are rendered as:
|
|
80
|
+
* - Category header (with special styling)
|
|
81
|
+
* - Followed by its items
|
|
82
|
+
*
|
|
83
|
+
* This function transforms:
|
|
84
|
+
* [Option1, Category{items: [Option2, Option3]}, Option4]
|
|
85
|
+
*
|
|
86
|
+
* Into:
|
|
87
|
+
* [Option1, CategoryHeader, Option2, Option3, Option4]
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
exports.isLink = isLink;
|
|
92
|
+
|
|
93
|
+
var flattenItems = function flattenItems(items) {
|
|
94
|
+
var flattened = [];
|
|
95
|
+
items.forEach(function (item) {
|
|
96
|
+
if (isCategory(item)) {
|
|
97
|
+
// Add the category header
|
|
98
|
+
flattened.push({
|
|
99
|
+
item: item,
|
|
100
|
+
type: 'category-header',
|
|
101
|
+
originalItem: item
|
|
102
|
+
}); // Add all items within the category
|
|
103
|
+
|
|
104
|
+
item.items.forEach(function (subItem) {
|
|
105
|
+
flattened.push({
|
|
106
|
+
item: subItem,
|
|
107
|
+
type: 'option',
|
|
108
|
+
originalItem: item // Keep reference to parent category
|
|
109
|
+
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
} else {
|
|
113
|
+
// Regular option
|
|
114
|
+
flattened.push({
|
|
115
|
+
item: item,
|
|
116
|
+
type: 'option',
|
|
117
|
+
originalItem: item
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return flattened;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Calculate item height based on type and size for virtualization
|
|
125
|
+
*
|
|
126
|
+
* Heights are based on the styled-components padding values:
|
|
127
|
+
* - Options (small): 5px top + 5px bottom padding + ~25px content = ~35px
|
|
128
|
+
* - Options (medium): 10px top + 10px bottom padding + ~25px content = ~45px
|
|
129
|
+
* - Categories (small): 15px top + 7px bottom padding + ~20px content = ~42px
|
|
130
|
+
* - Categories (medium): 15px top + 10px bottom padding + ~25px content = ~50px
|
|
131
|
+
* - Options with labelDetails: Add ~20px extra height
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
exports.flattenItems = flattenItems;
|
|
136
|
+
|
|
137
|
+
var getItemHeight = function getItemHeight(flattenedItem) {
|
|
138
|
+
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'small';
|
|
139
|
+
var type = flattenedItem.type,
|
|
140
|
+
item = flattenedItem.item;
|
|
141
|
+
|
|
142
|
+
if (type === 'category-header') {
|
|
143
|
+
// Category headers are taller
|
|
144
|
+
return size === 'medium' ? 50 : 42;
|
|
145
|
+
} // Regular option
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
var baseHeight = size === 'medium' ? 45 : 35; // Check if option has labelDetails (secondary text) which adds height
|
|
149
|
+
|
|
150
|
+
var hasLabelDetails = 'labelDetails' in item && item.labelDetails;
|
|
151
|
+
return hasLabelDetails ? baseHeight + 20 : baseHeight;
|
|
152
|
+
};
|
|
76
153
|
|
|
77
|
-
exports.
|
|
154
|
+
exports.getItemHeight = getItemHeight;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Combobox/index.tsx"],"names":[],"mappings":"AASA,OAAc,EAGZ,sBAAsB,EAQvB,MAAM,OAAO,CAAC;AA2Bf,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAQ,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Combobox/index.tsx"],"names":[],"mappings":"AASA,OAAc,EAGZ,sBAAsB,EAQvB,MAAM,OAAO,CAAC;AA2Bf,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAQ,MAAM,SAAS,CAAC;AA8mBhE,QAAA,MAAM,eAAe,EAAE,sBAAsB,CAC3C,gBAAgB,EAChB,aAAa,CACS,CAAC;AAOzB,eAAe,eAAe,CAAC"}
|
|
@@ -126,7 +126,8 @@ function Combobox(props, ref) {
|
|
|
126
126
|
containerSelector = props.containerSelector,
|
|
127
127
|
pointerEvents = props.pointerEvents,
|
|
128
128
|
externalIsPopoverVisible = props.isPopoverVisible,
|
|
129
|
-
externalListRef = props.listRef
|
|
129
|
+
externalListRef = props.listRef,
|
|
130
|
+
enableVirtualization = props.enableVirtualization;
|
|
130
131
|
|
|
131
132
|
var _useCombobox = (0, _useCombobox2.default)(props),
|
|
132
133
|
getInputFieldProps = _useCombobox.getInputFieldProps,
|
|
@@ -605,7 +606,8 @@ function Combobox(props, ref) {
|
|
|
605
606
|
visible: Boolean(popoverVisibleStateToUse || loading),
|
|
606
607
|
renderOptionLabel: renderOptionLabel,
|
|
607
608
|
zIndex: zIndex,
|
|
608
|
-
pointerEvents: pointerEvents
|
|
609
|
+
pointerEvents: pointerEvents,
|
|
610
|
+
enableVirtualization: enableVirtualization
|
|
609
611
|
}));
|
|
610
612
|
}));
|
|
611
613
|
}
|
|
@@ -854,7 +854,8 @@ describe('Combobox', function () {
|
|
|
854
854
|
_react2.fireEvent.click(queryByLabelText('test'));
|
|
855
855
|
|
|
856
856
|
expect((0, _react2.queryByText)(baseElement, defaultOptions[0].label)).toBeInTheDocument();
|
|
857
|
-
|
|
857
|
+
var li = (0, _react2.queryByText)(baseElement, defaultOptions[1].label).parentElement.parentElement.parentElement;
|
|
858
|
+
expect(li).toHaveAttribute('aria-selected', 'true');
|
|
858
859
|
});
|
|
859
860
|
describe('when typing', function () {
|
|
860
861
|
it('does NOT update the selection automatically', function () {
|
|
@@ -887,7 +888,8 @@ describe('Combobox', function () {
|
|
|
887
888
|
});
|
|
888
889
|
|
|
889
890
|
expect(onChangeValue).toHaveBeenCalledTimes(1);
|
|
890
|
-
|
|
891
|
+
var li = (0, _react2.queryByText)(baseElement, defaultOptions[1].label).parentElement.parentElement.parentElement;
|
|
892
|
+
expect(li).toHaveAttribute('aria-selected', 'true');
|
|
891
893
|
});
|
|
892
894
|
});
|
|
893
895
|
describe('when clicking the clear button', function () {
|
|
@@ -958,7 +960,7 @@ describe('Combobox', function () {
|
|
|
958
960
|
});
|
|
959
961
|
describe('when a controlled component', function () {
|
|
960
962
|
it('initializes with and prefers prop values', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
961
|
-
var newInputValue, onChangeInputValue, onChangeValue, _render32, baseElement, queryByLabelText, rerender;
|
|
963
|
+
var newInputValue, onChangeInputValue, onChangeValue, _render32, baseElement, queryByLabelText, rerender, li, li2;
|
|
962
964
|
|
|
963
965
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
964
966
|
while (1) {
|
|
@@ -1019,10 +1021,12 @@ describe('Combobox', function () {
|
|
|
1019
1021
|
|
|
1020
1022
|
_react2.fireEvent.click(queryByLabelText('test'));
|
|
1021
1023
|
|
|
1022
|
-
|
|
1023
|
-
expect(
|
|
1024
|
+
li = (0, _react2.queryByText)(baseElement, defaultOptions[0].label).parentElement.parentElement.parentElement;
|
|
1025
|
+
expect(li).toHaveAttribute('aria-selected', 'true');
|
|
1026
|
+
li2 = (0, _react2.queryByText)(baseElement, defaultOptions[1].label).parentElement.parentElement.parentElement;
|
|
1027
|
+
expect(li2).toHaveAttribute('aria-selected', 'false');
|
|
1024
1028
|
|
|
1025
|
-
case
|
|
1029
|
+
case 25:
|
|
1026
1030
|
case "end":
|
|
1027
1031
|
return _context.stop();
|
|
1028
1032
|
}
|
|
@@ -12,6 +12,7 @@ export interface ComboboxProps extends Omit<React.InputHTMLAttributes<ComboboxIn
|
|
|
12
12
|
clearButtonLabel?: string;
|
|
13
13
|
defaultInputValue?: string;
|
|
14
14
|
defaultValue?: string;
|
|
15
|
+
enableVirtualization?: boolean;
|
|
15
16
|
inputValue?: string;
|
|
16
17
|
isPopoverVisible?: boolean;
|
|
17
18
|
multiple?: boolean;
|