superdesk-ui-framework 3.1.27 → 4.0.0
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/app/styles/layout/_editor.scss +1 -1
- package/app-typescript/components/Dropdown.tsx +120 -165
- package/app-typescript/components/Layouts/Panel.tsx +3 -2
- package/app-typescript/components/Menu.tsx +3 -4
- package/app-typescript/components/Modal.tsx +4 -2
- package/app-typescript/components/MultiSelect.tsx +3 -2
- package/app-typescript/components/Popover.tsx +0 -2
- package/app-typescript/components/SelectWithTemplate.tsx +3 -1
- package/app-typescript/components/ShowPopup.tsx +9 -5
- package/app-typescript/components/SubNav.tsx +5 -6
- package/app-typescript/components/TreeMenu.tsx +3 -2
- package/app-typescript/components/TreeSelect/TreeSelect.tsx +3 -2
- package/app-typescript/components/WithPopover.tsx +0 -2
- package/app-typescript/components/_Positioner.tsx +3 -4
- package/app-typescript/components/avatar/avatar-group.tsx +0 -3
- package/app-typescript/index.ts +1 -0
- package/app-typescript/zIndex.tsx +5 -0
- package/dist/components/CreateButton.tsx +2 -2
- package/dist/components/Dropdowns.tsx +4 -483
- package/dist/components/Modal.tsx +0 -12
- package/dist/components/MultiSelect.tsx +0 -2
- package/dist/components/NavButtons.tsx +4 -4
- package/dist/components/Panel.tsx +0 -1
- package/dist/components/Popover.tsx +0 -3
- package/dist/components/SubNav.tsx +9 -10
- package/dist/components/TableList.tsx +1 -1
- package/dist/design-patterns/ThreePaneLayoutPattern.tsx +3 -3
- package/dist/examples.bundle.js +3110 -3478
- package/dist/playgrounds/react-playgrounds/CoreLayout.tsx +2 -3
- package/dist/playgrounds/react-playgrounds/EditorTest.tsx +1 -1
- package/dist/playgrounds/react-playgrounds/Multiedit.tsx +1 -2
- package/dist/playgrounds/react-playgrounds/PageLayoutTest.tsx +1 -1
- package/dist/playgrounds/react-playgrounds/PersonalProfile.tsx +2 -2
- package/dist/playgrounds/react-playgrounds/Rundowns.tsx +3 -10
- package/dist/playgrounds/react-playgrounds/SamsPlayground.tsx +2 -3
- package/dist/playgrounds/react-playgrounds/TestGround.tsx +0 -4
- package/dist/playgrounds/react-playgrounds/UiPlayground.tsx +2 -3
- package/dist/superdesk-ui.bundle.css +1 -1
- package/dist/superdesk-ui.bundle.js +2406 -2399
- package/dist/vendor.bundle.js +21 -21
- package/examples/pages/components/CreateButton.tsx +2 -2
- package/examples/pages/components/Dropdowns.tsx +4 -483
- package/examples/pages/components/Modal.tsx +0 -12
- package/examples/pages/components/MultiSelect.tsx +0 -2
- package/examples/pages/components/NavButtons.tsx +4 -4
- package/examples/pages/components/Panel.tsx +0 -1
- package/examples/pages/components/Popover.tsx +0 -3
- package/examples/pages/components/SubNav.tsx +9 -10
- package/examples/pages/components/TableList.tsx +1 -1
- package/examples/pages/design-patterns/ThreePaneLayoutPattern.tsx +3 -3
- package/examples/pages/playgrounds/react-playgrounds/CoreLayout.tsx +2 -3
- package/examples/pages/playgrounds/react-playgrounds/EditorTest.tsx +1 -1
- package/examples/pages/playgrounds/react-playgrounds/Multiedit.tsx +1 -2
- package/examples/pages/playgrounds/react-playgrounds/PageLayoutTest.tsx +1 -1
- package/examples/pages/playgrounds/react-playgrounds/PersonalProfile.tsx +2 -2
- package/examples/pages/playgrounds/react-playgrounds/Rundowns.tsx +3 -10
- package/examples/pages/playgrounds/react-playgrounds/SamsPlayground.tsx +2 -3
- package/examples/pages/playgrounds/react-playgrounds/TestGround.tsx +0 -4
- package/examples/pages/playgrounds/react-playgrounds/UiPlayground.tsx +2 -3
- package/package.json +1 -1
- package/react/components/Dropdown.d.ts +1 -3
- package/react/components/Dropdown.js +31 -60
- package/react/components/Layouts/Panel.d.ts +1 -1
- package/react/components/Layouts/Panel.js +5 -2
- package/react/components/Menu.d.ts +1 -1
- package/react/components/Menu.js +3 -3
- package/react/components/Modal.d.ts +1 -1
- package/react/components/Modal.js +5 -2
- package/react/components/MultiSelect.d.ts +1 -1
- package/react/components/MultiSelect.js +3 -1
- package/react/components/Popover.d.ts +0 -1
- package/react/components/Popover.js +1 -1
- package/react/components/SelectWithTemplate.d.ts +3 -0
- package/react/components/SelectWithTemplate.js +3 -0
- package/react/components/ShowPopup.d.ts +20 -1
- package/react/components/ShowPopup.js +12 -5
- package/react/components/SubNav.d.ts +0 -1
- package/react/components/SubNav.js +1 -4
- package/react/components/TreeMenu.d.ts +1 -1
- package/react/components/TreeMenu.js +3 -1
- package/react/components/TreeSelect/TreeSelect.d.ts +1 -1
- package/react/components/TreeSelect/TreeSelect.js +3 -1
- package/react/components/WithPopover.d.ts +0 -1
- package/react/components/WithPopover.js +1 -1
- package/react/components/_Positioner.d.ts +0 -1
- package/react/components/_Positioner.js +3 -3
- package/react/components/avatar/avatar-group.d.ts +0 -1
- package/react/components/avatar/avatar-group.js +2 -3
- package/react/index.d.ts +1 -0
- package/react/index.js +4 -1
- package/react/zIndex.d.ts +2 -0
- package/react/zIndex.js +8 -0
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
2
2
|
import * as ReactDOM from 'react-dom';
|
3
3
|
import { createPopper } from '@popperjs/core';
|
4
4
|
import { useId } from "react-id-generator";
|
5
|
+
import {getNextZIndex} from './../zIndex';
|
5
6
|
|
6
7
|
export interface IMenuItem {
|
7
8
|
label: string | React.ReactNode;
|
@@ -33,9 +34,7 @@ interface IMenu {
|
|
33
34
|
items: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
34
35
|
header?: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
35
36
|
footer?: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
36
|
-
append?: boolean;
|
37
37
|
children: React.ReactNode;
|
38
|
-
zIndex?: number;
|
39
38
|
onChange?(event?: any): void;
|
40
39
|
maxHeight?: number;
|
41
40
|
}
|
@@ -47,12 +46,16 @@ export const Dropdown = ({
|
|
47
46
|
header,
|
48
47
|
footer,
|
49
48
|
children,
|
50
|
-
append,
|
51
49
|
align,
|
52
|
-
zIndex,
|
53
50
|
onChange,
|
54
51
|
maxHeight,
|
55
52
|
}: IMenu) => {
|
53
|
+
const [zIndex, setZIndex] = React.useState<number>(-1);
|
54
|
+
|
55
|
+
if (zIndex === -1) {
|
56
|
+
setZIndex(getNextZIndex());
|
57
|
+
}
|
58
|
+
|
56
59
|
const [open, setOpen] = React.useState(false);
|
57
60
|
const [change, setChange] = React.useState(false);
|
58
61
|
const [menuID] = useId();
|
@@ -87,7 +90,7 @@ export const Dropdown = ({
|
|
87
90
|
}, [change]);
|
88
91
|
|
89
92
|
React.useLayoutEffect(() => {
|
90
|
-
if (
|
93
|
+
if (change) {
|
91
94
|
addInPlaceholder();
|
92
95
|
}
|
93
96
|
setChange(true);
|
@@ -96,10 +99,11 @@ export const Dropdown = ({
|
|
96
99
|
function createAppendMenu() {
|
97
100
|
if (header && footer) {
|
98
101
|
return (
|
99
|
-
<div
|
102
|
+
<div
|
103
|
+
className='dropdown__menu dropdown__menu--has-head-foot'
|
100
104
|
id={menuID} role='menu'
|
101
105
|
ref={ref}
|
102
|
-
style={{zIndex
|
106
|
+
style={{zIndex}}
|
103
107
|
>
|
104
108
|
<ul className='dropdown__menu-header'>
|
105
109
|
{headerElements}
|
@@ -114,10 +118,13 @@ export const Dropdown = ({
|
|
114
118
|
);
|
115
119
|
} else if (header) {
|
116
120
|
return (
|
117
|
-
<div
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
+
<div
|
122
|
+
className='dropdown__menu dropdown__menu--has-head-foot'
|
123
|
+
id={menuID}
|
124
|
+
role='menu'
|
125
|
+
ref={ref}
|
126
|
+
style={{zIndex}}
|
127
|
+
>
|
121
128
|
<ul className='dropdown__menu-header'>
|
122
129
|
{headerElements}
|
123
130
|
</ul>
|
@@ -128,11 +135,13 @@ export const Dropdown = ({
|
|
128
135
|
);
|
129
136
|
} else if (footer) {
|
130
137
|
return (
|
131
|
-
<div
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
138
|
+
<div
|
139
|
+
className='dropdown__menu dropdown__menu--has-head-foot'
|
140
|
+
id={menuID}
|
141
|
+
role='menu'
|
142
|
+
ref={ref}
|
143
|
+
style={{zIndex}}
|
144
|
+
>
|
136
145
|
<ul className='dropdown__menu-body'>
|
137
146
|
{dropdownElements}
|
138
147
|
</ul>
|
@@ -143,10 +152,13 @@ export const Dropdown = ({
|
|
143
152
|
);
|
144
153
|
} else {
|
145
154
|
return (
|
146
|
-
<ul
|
147
|
-
|
148
|
-
|
149
|
-
|
155
|
+
<ul
|
156
|
+
className='dropdown__menu '
|
157
|
+
id={menuID}
|
158
|
+
role='menu'
|
159
|
+
ref={ref}
|
160
|
+
style={{...{zIndex, overflowY: 'auto'}, ...maxHeightStyle}}
|
161
|
+
>
|
150
162
|
{dropdownElements}
|
151
163
|
</ul>
|
152
164
|
);
|
@@ -157,27 +169,17 @@ export const Dropdown = ({
|
|
157
169
|
if (!open) {
|
158
170
|
let menuRef: any;
|
159
171
|
setOpen(true);
|
160
|
-
|
172
|
+
setTimeout(() => {
|
161
173
|
menuRef = ref.current;
|
162
174
|
let toggleRef = buttonRef.current;
|
163
175
|
if (toggleRef && menuRef) {
|
164
176
|
createPopper(toggleRef, menuRef, {
|
165
177
|
placement: checkAlign() ? 'bottom-end' : 'bottom-start',
|
178
|
+
strategy: 'fixed',
|
166
179
|
});
|
180
|
+
menuRef.style.display = 'block';
|
167
181
|
}
|
168
|
-
}
|
169
|
-
setTimeout(() => {
|
170
|
-
menuRef = ref.current;
|
171
|
-
let toggleRef = buttonRef.current;
|
172
|
-
if (toggleRef && menuRef) {
|
173
|
-
createPopper(toggleRef, menuRef, {
|
174
|
-
placement: checkAlign() ? 'bottom-end' : 'bottom-start',
|
175
|
-
strategy: 'fixed',
|
176
|
-
});
|
177
|
-
menuRef.style.display = 'block';
|
178
|
-
}
|
179
|
-
}, 0);
|
180
|
-
}
|
182
|
+
}, 0);
|
181
183
|
document.addEventListener('click', closeMenu);
|
182
184
|
setTimeout(() => {
|
183
185
|
menuRef.getElementsByTagName('button')[0].focus();
|
@@ -218,20 +220,23 @@ export const Dropdown = ({
|
|
218
220
|
item['items'].forEach((el: any, key: number) => {
|
219
221
|
submenuItems.push(each(el, key));
|
220
222
|
});
|
223
|
+
|
221
224
|
return (
|
222
225
|
<DropdownItemWithSubmenu
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
226
|
+
key={index}
|
227
|
+
index={index}
|
228
|
+
item={item}
|
229
|
+
menuID={menuID}
|
230
|
+
subMenuItems={submenuItems}
|
231
|
+
onChange={onChange}
|
232
|
+
/>
|
229
233
|
);
|
230
234
|
} else if (item['type'] === 'group') {
|
231
235
|
let groupItems: any = [];
|
232
236
|
item['items'].forEach((el: any, key: number) => {
|
233
237
|
groupItems.push(each(el, key));
|
234
238
|
});
|
239
|
+
|
235
240
|
return (
|
236
241
|
<React.Fragment key={index}>
|
237
242
|
<li>
|
@@ -245,108 +250,52 @@ export const Dropdown = ({
|
|
245
250
|
} else {
|
246
251
|
return (
|
247
252
|
<DropdownItem
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
253
|
+
key={index}
|
254
|
+
label={item['label']}
|
255
|
+
icon={item['icon']}
|
256
|
+
active={item['active']}
|
257
|
+
onSelect={item['onSelect']}
|
258
|
+
onChange={onChange}
|
259
|
+
/>
|
254
260
|
);
|
255
261
|
}
|
256
262
|
}
|
257
263
|
|
258
264
|
return (
|
259
265
|
<div className={'dropdown ' + (open ? 'open' : '')}>
|
260
|
-
{
|
261
|
-
|
262
|
-
|
263
|
-
{
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
return React.cloneElement(children, attrs);
|
275
|
-
})()}
|
276
|
-
</div> : null)
|
277
|
-
:
|
278
|
-
<button
|
279
|
-
style={{whiteSpace: 'nowrap'}}
|
280
|
-
ref={buttonRef}
|
281
|
-
className=' dropdown__toggle dropdown-toggle'
|
282
|
-
aria-haspopup="menu"
|
283
|
-
tabIndex={0}
|
284
|
-
aria-expanded={open}
|
285
|
-
onClick={toggleDisplay}
|
286
|
-
>
|
287
|
-
{children}
|
288
|
-
<span className="dropdown__caret"></span>
|
289
|
-
</button>}
|
266
|
+
{
|
267
|
+
typeof children === 'object'
|
268
|
+
? (React.isValidElement(children)
|
269
|
+
? <div ref={buttonRef} style={{ display: 'content' }}>
|
270
|
+
{(() => {
|
271
|
+
const attrs = {
|
272
|
+
className: children.props.className
|
273
|
+
? (children.props.className + ' dropdown__toggle dropdown-toggle')
|
274
|
+
: 'dropdown__toggle dropdown-toggle',
|
275
|
+
'aria-haspopup': "menu",
|
276
|
+
'aria-expanded': open,
|
277
|
+
onClick: toggleDisplay,
|
278
|
+
ref: buttonRef,
|
279
|
+
};
|
290
280
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
);
|
310
|
-
} else if (header) {
|
311
|
-
return (
|
312
|
-
<div className='dropdown__menu dropdown__menu--has-head-foot'
|
313
|
-
role='menu'
|
314
|
-
ref={ref}
|
315
|
-
style={{zIndex: zIndex}}>
|
316
|
-
<ul className='dropdown__menu-header'>
|
317
|
-
{headerElements}
|
318
|
-
</ul>
|
319
|
-
<ul className='dropdown__menu-body'>
|
320
|
-
{dropdownElements}
|
321
|
-
</ul>
|
322
|
-
</div>
|
323
|
-
);
|
324
|
-
} else if (footer) {
|
325
|
-
return (
|
326
|
-
<div className='dropdown__menu dropdown__menu--has-head-foot'
|
327
|
-
role='menu'
|
328
|
-
ref={ref}
|
329
|
-
style={{zIndex: zIndex}}>
|
330
|
-
<ul className='dropdown__menu-body'>
|
331
|
-
{dropdownElements}
|
332
|
-
</ul>
|
333
|
-
<ul className='dropdown__menu-footer dropdown__menu-footer--has-list '>
|
334
|
-
{footerElements}
|
335
|
-
</ul>
|
336
|
-
</div>
|
337
|
-
);
|
338
|
-
} else {
|
339
|
-
return (
|
340
|
-
<ul className='dropdown__menu'
|
341
|
-
role='menu'
|
342
|
-
ref={ref}
|
343
|
-
style={{zIndex: zIndex}}>
|
344
|
-
{dropdownElements}
|
345
|
-
</ul>
|
346
|
-
);
|
347
|
-
}
|
348
|
-
})()}
|
349
|
-
</div >
|
281
|
+
return React.cloneElement(children, attrs);
|
282
|
+
})()}
|
283
|
+
</div>
|
284
|
+
: null)
|
285
|
+
: <button
|
286
|
+
style={{whiteSpace: 'nowrap'}}
|
287
|
+
ref={buttonRef}
|
288
|
+
className=' dropdown__toggle dropdown-toggle'
|
289
|
+
aria-haspopup="menu"
|
290
|
+
tabIndex={0}
|
291
|
+
aria-expanded={open}
|
292
|
+
onClick={toggleDisplay}
|
293
|
+
>
|
294
|
+
{children}
|
295
|
+
<span className="dropdown__caret"></span>
|
296
|
+
</button>
|
297
|
+
}
|
298
|
+
</div>
|
350
299
|
);
|
351
300
|
};
|
352
301
|
|
@@ -359,16 +308,18 @@ onChange,
|
|
359
308
|
}: IMenuItemRes) => {
|
360
309
|
return (
|
361
310
|
<li role='none' className={active ? 'dropdown__menu-item--active' : ''}>
|
362
|
-
<button
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
onChange
|
370
|
-
|
371
|
-
|
311
|
+
<button
|
312
|
+
tabIndex={0}
|
313
|
+
role='menuitem'
|
314
|
+
onClick={() => {
|
315
|
+
setTimeout(() => {
|
316
|
+
onSelect();
|
317
|
+
});
|
318
|
+
if (onChange) {
|
319
|
+
onChange();
|
320
|
+
}
|
321
|
+
}}
|
322
|
+
>
|
372
323
|
<i className={icon ? ('icon-' + icon) : ''}></i>
|
373
324
|
{label}
|
374
325
|
</button>
|
@@ -410,31 +361,35 @@ const DropdownItemWithSubmenu = ({
|
|
410
361
|
|
411
362
|
return (
|
412
363
|
<li key={index} ref={refButtonSubMenu}>
|
413
|
-
<div
|
414
|
-
|
364
|
+
<div
|
365
|
+
className='dropdown'
|
366
|
+
onMouseLeave={() => setOpen(false)}
|
367
|
+
>
|
415
368
|
<button
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
369
|
+
className='dropdown__toggle dropdown-toggle'
|
370
|
+
aria-haspopup="menu"
|
371
|
+
tabIndex={0}
|
372
|
+
onClick={() => {
|
373
|
+
if (item.onSelect) {
|
374
|
+
setTimeout(() => {
|
375
|
+
item.onSelect();
|
376
|
+
});
|
377
|
+
}
|
378
|
+
if (onChange) {
|
379
|
+
onChange();
|
380
|
+
}
|
381
|
+
}}
|
382
|
+
onMouseOver={() => setOpen(true)}
|
383
|
+
>
|
430
384
|
{item['icon'] ? <i className={'icon-' + item['icon']}></i> : null}
|
431
385
|
{item['label']}
|
432
386
|
</button>
|
433
387
|
<ul
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
388
|
+
role='menu'
|
389
|
+
ref={refSubMenu}
|
390
|
+
style={{display: 'none'}}
|
391
|
+
className='dropdown__menu'
|
392
|
+
>
|
438
393
|
{subMenuItems}
|
439
394
|
</ul>
|
440
395
|
</div>
|
@@ -3,6 +3,7 @@ import { IconButton } from '../IconButton';
|
|
3
3
|
import { Spinner, LoadingOverlay } from '../Spinner';
|
4
4
|
import classNames from 'classnames';
|
5
5
|
import {ButtonGroup} from '../ButtonGroup';
|
6
|
+
import {getNextZIndex} from '../../zIndex';
|
6
7
|
|
7
8
|
// ============= Panel ============ //
|
8
9
|
|
@@ -64,7 +65,6 @@ export default class Panel extends React.PureComponent<IPropsPanel> {
|
|
64
65
|
|
65
66
|
interface IPropsPanelHeader {
|
66
67
|
color?: 'light' | 'darker' | 'blueGrey' | 'blueGreyDarker'; // defaults to 'light'
|
67
|
-
zIndex?: number;
|
68
68
|
title?: string;
|
69
69
|
theme?: 'light-ui' | 'dark-ui'; // defaults to 'light
|
70
70
|
className?: string;
|
@@ -73,6 +73,7 @@ interface IPropsPanelHeader {
|
|
73
73
|
}
|
74
74
|
|
75
75
|
class PanelHeader extends React.PureComponent<IPropsPanelHeader> {
|
76
|
+
private zIndex: number = getNextZIndex();
|
76
77
|
constructor(props: IPropsPanelHeader) {
|
77
78
|
super(props);
|
78
79
|
}
|
@@ -86,7 +87,7 @@ class PanelHeader extends React.PureComponent<IPropsPanelHeader> {
|
|
86
87
|
}, this.props.className);
|
87
88
|
|
88
89
|
let style = {
|
89
|
-
zIndex: this.
|
90
|
+
zIndex: this.zIndex,
|
90
91
|
};
|
91
92
|
|
92
93
|
let defaultTheme = darkColors.includes(this.props.color || '') ? 'dark-ui' : null;
|
@@ -4,6 +4,7 @@ import {SyntheticEvent} from 'react';
|
|
4
4
|
import {TieredMenu} from '@superdesk/primereact/tieredmenu';
|
5
5
|
import {MenuItem as IPrimeMenuItem} from '@superdesk/primereact/components/menuitem/MenuItem';
|
6
6
|
import {assertNever} from '../helpers';
|
7
|
+
import {getNextZIndex} from '../zIndex';
|
7
8
|
|
8
9
|
/**
|
9
10
|
* Known issues:
|
@@ -57,11 +58,8 @@ interface IMenuBranch {
|
|
57
58
|
interface IProps {
|
58
59
|
items: Array<IMenuItem>;
|
59
60
|
children: (toggle: (event: SyntheticEvent) => void) => JSX.Element;
|
60
|
-
zIndex?: number;
|
61
61
|
}
|
62
62
|
|
63
|
-
const superdeskTopBarZIndex = 1050;
|
64
|
-
|
65
63
|
function isSeparator(item: IMenuItem): item is ISeparator {
|
66
64
|
return (item as any)['separator'] === true;
|
67
65
|
}
|
@@ -77,6 +75,7 @@ function isMenuBranch(item: IMenuItem): item is IMenuBranch {
|
|
77
75
|
export class Menu extends React.Component<IProps, {}> {
|
78
76
|
private menu: TieredMenu | null;
|
79
77
|
private focusedBefore: Element | null;
|
78
|
+
private zIndex: number = getNextZIndex();
|
80
79
|
|
81
80
|
constructor(props: IProps) {
|
82
81
|
super(props);
|
@@ -164,7 +163,7 @@ export class Menu extends React.Component<IProps, {}> {
|
|
164
163
|
}
|
165
164
|
}}
|
166
165
|
data-test-id="menu"
|
167
|
-
zIndex={this.
|
166
|
+
zIndex={this.zIndex}
|
168
167
|
/>
|
169
168
|
</div>
|
170
169
|
</React.Fragment>
|
@@ -2,13 +2,13 @@ import * as React from 'react';
|
|
2
2
|
import { Dialog as PrimeDialog } from '@superdesk/primereact/dialog';
|
3
3
|
import classNames from 'classnames';
|
4
4
|
import {noop} from 'lodash';
|
5
|
+
import {getNextZIndex} from './../zIndex';
|
5
6
|
|
6
7
|
interface IProps {
|
7
8
|
id?: string;
|
8
9
|
className?: string;
|
9
10
|
theme?: string;
|
10
11
|
visible?: boolean;
|
11
|
-
zIndex?: number;
|
12
12
|
closeOnEscape?: boolean;
|
13
13
|
contentBg?: 'default' | 'medium' | 'dark';
|
14
14
|
contentPadding?: 'none' | 'small' | 'medium' | 'large';
|
@@ -33,6 +33,8 @@ interface IProps {
|
|
33
33
|
}
|
34
34
|
|
35
35
|
export class Modal extends React.Component<IProps, {}> {
|
36
|
+
private zIndex: number = getNextZIndex();
|
37
|
+
|
36
38
|
render() {
|
37
39
|
let classes = classNames({
|
38
40
|
[`p-dialog-content--${this.props.size}`]: this.props.size,
|
@@ -58,7 +60,7 @@ export class Modal extends React.Component<IProps, {}> {
|
|
58
60
|
contentClassName={classes}
|
59
61
|
onShow={this.props.onShow}
|
60
62
|
onHide={this.props.onHide ?? noop}
|
61
|
-
zIndex={this.
|
63
|
+
zIndex={this.zIndex}
|
62
64
|
position={this.props.position}
|
63
65
|
closable={this.props.onHide != null ? true : false}
|
64
66
|
>
|
@@ -5,6 +5,7 @@ import nextId from "react-id-generator";
|
|
5
5
|
import { InputWrapper } from "./Form";
|
6
6
|
import {IInputWrapper} from './Form/InputWrapper';
|
7
7
|
import {SelectPreview} from './SelectPreview';
|
8
|
+
import {getNextZIndex} from '../zIndex';
|
8
9
|
|
9
10
|
interface IProps<T> extends IInputWrapper {
|
10
11
|
value: Array<T>;
|
@@ -19,7 +20,6 @@ interface IProps<T> extends IInputWrapper {
|
|
19
20
|
filter?: boolean;
|
20
21
|
showClear?: boolean;
|
21
22
|
showSelectAll?: boolean;
|
22
|
-
zIndex?: number;
|
23
23
|
optionLabel: (option: T) => string;
|
24
24
|
itemTemplate?(item: T): JSX.Element | undefined;
|
25
25
|
selectedItemTemplate?(value: T): JSX.Element | undefined;
|
@@ -34,6 +34,7 @@ interface IState<T> {
|
|
34
34
|
|
35
35
|
export class MultiSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
36
36
|
private htmlId = nextId();
|
37
|
+
private zIndex: number = getNextZIndex();
|
37
38
|
|
38
39
|
constructor(props: IProps<T>) {
|
39
40
|
super(props);
|
@@ -80,7 +81,7 @@ export class MultiSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
80
81
|
options={this.props.options}
|
81
82
|
onChange={({value}) => this.props.onChange(value)}
|
82
83
|
display="chip"
|
83
|
-
zIndex={this.
|
84
|
+
zIndex={this.zIndex}
|
84
85
|
filter={this.props.filter}
|
85
86
|
appendTo={document.body}
|
86
87
|
placeholder={this.props.placeholder}
|
@@ -7,7 +7,6 @@ interface IProps {
|
|
7
7
|
triggerSelector: string; // CSS selector for an element that will be used to toggle the popover.
|
8
8
|
displayCloseButton?: boolean; // defaults to true
|
9
9
|
placement?: PopperOptions['placement']; // defaults to auto
|
10
|
-
zIndex?: number;
|
11
10
|
}
|
12
11
|
|
13
12
|
export class Popover extends React.Component<IProps> {
|
@@ -17,7 +16,6 @@ export class Popover extends React.Component<IProps> {
|
|
17
16
|
triggerSelector={this.props.triggerSelector}
|
18
17
|
placement={this.props.placement ?? 'auto'}
|
19
18
|
className="sd-popover"
|
20
|
-
zIndex={this.props.zIndex}
|
21
19
|
>
|
22
20
|
<div className="sd-popover__header">
|
23
21
|
<h4 className="sd-popover__title" tabIndex={0} id='popoverTitle'>{this.props.title}</h4>
|
@@ -29,7 +29,9 @@ interface IState<T> {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
const labelKey = 'label';
|
32
|
-
|
32
|
+
/**
|
33
|
+
* @deprecated use MultiSelect or TreeSelect
|
34
|
+
*/
|
33
35
|
export class SelectWithTemplate<T> extends React.Component<IProps<T>, IState<T>> {
|
34
36
|
componentRef: Dropdown | null;
|
35
37
|
private htmlId = nextId();
|
@@ -4,18 +4,19 @@ import ReactDOM from 'react-dom';
|
|
4
4
|
import {createPopper, Instance as PopperInstance, Placement, Modifier} from '@popperjs/core';
|
5
5
|
import {throttle} from 'lodash';
|
6
6
|
import maxSize from 'popper-max-size-modifier';
|
7
|
+
import {getNextZIndex} from '../zIndex';
|
7
8
|
|
8
9
|
interface IPropsPopupPositioner {
|
9
10
|
referenceElement: HTMLElement;
|
10
11
|
placement: Placement;
|
11
|
-
zIndex?: number;
|
12
12
|
onClose(): void;
|
13
13
|
closeOnHoverEnd?: boolean;
|
14
14
|
}
|
15
15
|
|
16
|
-
class PopupPositioner extends React.PureComponent<IPropsPopupPositioner> {
|
16
|
+
export class PopupPositioner extends React.PureComponent<IPropsPopupPositioner> {
|
17
17
|
private wrapperEl: HTMLDivElement | null;
|
18
18
|
private popper: PopperInstance | null;
|
19
|
+
private zIndex: number = getNextZIndex();
|
19
20
|
|
20
21
|
constructor(props: IPropsPopupPositioner) {
|
21
22
|
super(props);
|
@@ -123,7 +124,12 @@ class PopupPositioner extends React.PureComponent<IPropsPopupPositioner> {
|
|
123
124
|
ref={(el) => {
|
124
125
|
this.wrapperEl = el;
|
125
126
|
}}
|
126
|
-
style={{
|
127
|
+
style={{
|
128
|
+
position: 'absolute',
|
129
|
+
left: '-100vw',
|
130
|
+
display: 'flex',
|
131
|
+
zIndex: this.zIndex,
|
132
|
+
}}
|
127
133
|
>
|
128
134
|
{this.props.children}
|
129
135
|
</div>
|
@@ -138,7 +144,6 @@ export function showPopup(
|
|
138
144
|
referenceElement: HTMLElement,
|
139
145
|
placement: Placement,
|
140
146
|
Component: React.ComponentType<{closePopup(): void}>,
|
141
|
-
zIndex?: number,
|
142
147
|
closeOnHoverEnd?: boolean,
|
143
148
|
onClose?: () => void,
|
144
149
|
): {close: () => void} {
|
@@ -158,7 +163,6 @@ export function showPopup(
|
|
158
163
|
referenceElement={referenceElement}
|
159
164
|
placement={placement}
|
160
165
|
onClose={closeFn}
|
161
|
-
zIndex={zIndex}
|
162
166
|
closeOnHoverEnd={closeOnHoverEnd || false}
|
163
167
|
>
|
164
168
|
<Component
|
@@ -3,7 +3,6 @@ import classNames from 'classnames';
|
|
3
3
|
|
4
4
|
interface IProps {
|
5
5
|
color?: 'light' | 'darker' | 'blueGrey' | 'blueGreyDarker'; // defaults to 'light'
|
6
|
-
zIndex?: number;
|
7
6
|
theme?: 'light' | 'dark'; // defaults to 'light
|
8
7
|
className?: string;
|
9
8
|
}
|
@@ -32,14 +31,14 @@ export class SubNav extends React.PureComponent<IProps> {
|
|
32
31
|
'subnav--light': this.props.color === undefined,
|
33
32
|
[`subnav--${this.props.color}`]: this.props.color || this.props.color !== undefined,
|
34
33
|
}, this.props.className);
|
35
|
-
|
36
|
-
zIndex: 1000 + (this.props.zIndex ? this.props.zIndex : 0),
|
37
|
-
};
|
34
|
+
|
38
35
|
let defaultTheme = darkColors.includes(this.props.color || '') ? 'dark-ui' : null;
|
39
36
|
|
40
37
|
return (
|
41
|
-
<div
|
42
|
-
|
38
|
+
<div
|
39
|
+
data-theme={this.props.theme ? `${this.props.theme}-ui` : defaultTheme}
|
40
|
+
className={classes}
|
41
|
+
>
|
43
42
|
{this.props.children}
|
44
43
|
</div>
|
45
44
|
);
|