superdesk-ui-framework 3.0.1-beta.13 → 3.0.1-beta.14
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/.vscode/settings.json +5 -0
- package/app/styles/_table-list.scss +1 -0
- package/app/styles/dropdowns/_basic-dropdown.scss +6 -0
- package/app-typescript/components/Dropdown.tsx +65 -65
- package/app-typescript/components/DurationInput.tsx +14 -4
- package/app-typescript/components/Lists/ContentList.tsx +28 -4
- package/app-typescript/components/Lists/TableList.tsx +11 -9
- package/app-typescript/dist/components/Alert.d.ts +16 -0
- package/app-typescript/dist/components/Autocomplete.d.ts +48 -0
- package/app-typescript/dist/components/Avatar.d.ts +33 -0
- package/app-typescript/dist/components/Badge.d.ts +13 -0
- package/app-typescript/dist/components/Button.d.ts +23 -0
- package/app-typescript/dist/components/ButtonGroup.d.ts +12 -0
- package/app-typescript/dist/components/CheckButtonGroup.d.ts +11 -0
- package/app-typescript/dist/components/CheckGroup.d.ts +9 -0
- package/app-typescript/dist/components/Checkbox.d.ts +19 -0
- package/app-typescript/dist/components/CheckboxButton.d.ts +19 -0
- package/app-typescript/dist/components/DatePicker.d.ts +37 -0
- package/app-typescript/dist/components/Divider.d.ts +9 -0
- package/app-typescript/dist/components/DonutChart.d.ts +12 -0
- package/app-typescript/dist/components/Dropdown.d.ts +28 -0
- package/app-typescript/dist/components/DropdownFirst.d.ts +42 -0
- package/app-typescript/dist/components/EmptyState.d.ts +11 -0
- package/app-typescript/dist/components/FormLabel.d.ts +9 -0
- package/app-typescript/dist/components/Genie.d.ts +13 -0
- package/app-typescript/dist/components/GridItem.d.ts +69 -0
- package/app-typescript/dist/components/GridList.d.ts +14 -0
- package/app-typescript/dist/components/HeadingText.d.ts +10 -0
- package/app-typescript/dist/components/HelloWorld.d.ts +8 -0
- package/app-typescript/dist/components/Icon.d.ts +12 -0
- package/app-typescript/dist/components/IconButton.d.ts +12 -0
- package/app-typescript/dist/components/IconLabel.d.ts +11 -0
- package/app-typescript/dist/components/Input.d.ts +24 -0
- package/app-typescript/dist/components/Label.d.ts +15 -0
- package/app-typescript/dist/components/LeftMenu.d.ts +26 -0
- package/app-typescript/dist/components/Loader.d.ts +8 -0
- package/app-typescript/dist/components/NavButton.d.ts +15 -0
- package/app-typescript/dist/components/Popover.d.ts +13 -0
- package/app-typescript/dist/components/PropsList.d.ts +15 -0
- package/app-typescript/dist/components/Radio.d.ts +19 -0
- package/app-typescript/dist/components/RadioButton.d.ts +20 -0
- package/app-typescript/dist/components/Select.d.ts +29 -0
- package/app-typescript/dist/components/SelectWithTemplate.d.ts +32 -0
- package/app-typescript/dist/components/SlidingToolbar.d.ts +8 -0
- package/app-typescript/dist/components/StrechBar.d.ts +4 -0
- package/app-typescript/dist/components/SubNav.d.ts +10 -0
- package/app-typescript/dist/components/Switch.d.ts +12 -0
- package/app-typescript/dist/components/TabCustom.d.ts +25 -0
- package/app-typescript/dist/components/TabList.d.ts +22 -0
- package/app-typescript/dist/components/Tag.d.ts +9 -0
- package/app-typescript/dist/components/TagInput.d.ts +7 -0
- package/app-typescript/dist/components/TagInputTest.d.ts +18 -0
- package/app-typescript/dist/components/TimePicker.d.ts +11 -0
- package/app-typescript/dist/components/Tooltip.d.ts +11 -0
- package/app-typescript/dist/components/_Positioner.d.ts +27 -0
- package/app-typescript/dist/index.d.ts +56 -0
- package/dist/examples.bundle.js +538 -122
- package/dist/playgrounds/react-playgrounds/RundownEditor.tsx +3 -9
- package/dist/playgrounds/react-playgrounds/Rundowns.tsx +9 -19
- package/dist/react/ContentList.tsx +2 -10
- package/dist/react/Dropdowns.tsx +357 -5
- package/dist/react/TableList.tsx +28 -30
- package/dist/superdesk-ui.bundle.css +8 -3
- package/dist/superdesk-ui.bundle.js +232 -94
- package/examples/pages/playgrounds/react-playgrounds/RundownEditor.tsx +3 -9
- package/examples/pages/playgrounds/react-playgrounds/Rundowns.tsx +9 -19
- package/examples/pages/react/ContentList.tsx +2 -10
- package/examples/pages/react/Dropdowns.tsx +357 -5
- package/examples/pages/react/TableList.tsx +28 -30
- package/package.json +1 -1
- package/react/components/Dropdown.d.ts +4 -4
- package/react/components/Dropdown.js +19 -15
- package/react/components/DurationInput.d.ts +1 -1
- package/react/components/DurationInput.js +14 -4
- package/react/components/Lists/ContentList.d.ts +5 -0
- package/react/components/Lists/ContentList.js +36 -15
- package/react/components/Lists/TableList.d.ts +5 -5
- package/react/components/Lists/TableList.js +6 -4
- package/yarn-error.log +111 -0
@@ -109,6 +109,10 @@ $focus-box-shadow: 0 0 0 3px $sd-colour--focus-shadow;
|
|
109
109
|
border-radius: $dropdownMenuBorderRadius;
|
110
110
|
text-align: start;
|
111
111
|
|
112
|
+
.dropdown {
|
113
|
+
width: 100%;
|
114
|
+
}
|
115
|
+
|
112
116
|
// Links within the dropdown menu
|
113
117
|
li, .dropdown__menu-item {
|
114
118
|
a:not(.btn), button:not(.btn):not(.dropdown__menu-close):not(.toggle-button) {
|
@@ -193,8 +197,10 @@ $focus-box-shadow: 0 0 0 3px $sd-colour--focus-shadow;
|
|
193
197
|
}
|
194
198
|
.dropdown__menu-body {
|
195
199
|
overflow-y: auto;
|
200
|
+
overflow-x: hidden;
|
196
201
|
flex: 0 1;
|
197
202
|
padding: 0.6rem 0;
|
203
|
+
max-height: 320px;
|
198
204
|
}
|
199
205
|
.dropdown__menu-body:first-child {
|
200
206
|
.dropdown__menu-label {
|
@@ -4,7 +4,7 @@ import { createPopper } from '@popperjs/core';
|
|
4
4
|
import { useId } from "react-id-generator";
|
5
5
|
|
6
6
|
export interface IMenuItem {
|
7
|
-
label: string;
|
7
|
+
label: string | React.ReactNode;
|
8
8
|
icon?: string;
|
9
9
|
active?: boolean;
|
10
10
|
onSelect(): void;
|
@@ -16,19 +16,19 @@ interface IMenuItemRes extends IMenuItem {
|
|
16
16
|
|
17
17
|
export interface ISubmenu {
|
18
18
|
type: 'submenu';
|
19
|
-
label: string;
|
19
|
+
label: string | React.ReactNode;
|
20
20
|
icon?: string;
|
21
21
|
items: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
22
22
|
}
|
23
23
|
|
24
24
|
export interface IMenuGroup {
|
25
25
|
type: 'group';
|
26
|
-
label?: string;
|
26
|
+
label?: string | React.ReactNode;
|
27
27
|
items: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
28
28
|
}
|
29
29
|
|
30
30
|
interface IMenu {
|
31
|
-
label?: string;
|
31
|
+
label?: string | React.ReactNode;
|
32
32
|
align?: 'left' | 'right';
|
33
33
|
items: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
34
34
|
header?: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
@@ -38,6 +38,8 @@ interface IMenu {
|
|
38
38
|
onChange?(event?: any): void;
|
39
39
|
}
|
40
40
|
|
41
|
+
const DROPDOWN_ID_CONTAINER = "sd-dropdown-constainer";
|
42
|
+
|
41
43
|
export const Dropdown = ({
|
42
44
|
items,
|
43
45
|
header,
|
@@ -50,7 +52,6 @@ export const Dropdown = ({
|
|
50
52
|
const [open, setOpen] = React.useState(false);
|
51
53
|
const [change, setChange] = React.useState(false);
|
52
54
|
const [menuID] = useId();
|
53
|
-
const DROPDOWN_ID = "react-placeholder";
|
54
55
|
const ref = React.useRef(null);
|
55
56
|
const buttonRef = React.useRef(null);
|
56
57
|
const headerElements = header?.map((el, index) => {
|
@@ -66,11 +67,10 @@ export const Dropdown = ({
|
|
66
67
|
});
|
67
68
|
|
68
69
|
React.useEffect(() => {
|
69
|
-
const existingElement = document.getElementById(
|
70
|
+
const existingElement = document.getElementById(DROPDOWN_ID_CONTAINER);
|
70
71
|
if (!existingElement) {
|
71
72
|
const el = document.createElement("div");
|
72
|
-
el.id =
|
73
|
-
// style placeholder
|
73
|
+
el.id = DROPDOWN_ID_CONTAINER;
|
74
74
|
el.style.position = 'absolute';
|
75
75
|
el.style.top = '0';
|
76
76
|
el.style.left = '0';
|
@@ -79,7 +79,6 @@ export const Dropdown = ({
|
|
79
79
|
|
80
80
|
document.body.appendChild(el);
|
81
81
|
}
|
82
|
-
|
83
82
|
}, [change]);
|
84
83
|
|
85
84
|
React.useLayoutEffect(() => {
|
@@ -89,14 +88,10 @@ export const Dropdown = ({
|
|
89
88
|
setChange(true);
|
90
89
|
}, [open]);
|
91
90
|
|
92
|
-
// structure for append menu
|
93
91
|
function createAppendMenu() {
|
94
92
|
if (header && footer) {
|
95
93
|
return (
|
96
|
-
<div className='dropdown__menu dropdown__menu--has-head-foot'
|
97
|
-
id={menuID}
|
98
|
-
role='menu'
|
99
|
-
ref={ref}>
|
94
|
+
<div className='dropdown__menu dropdown__menu--has-head-foot' id={menuID} role='menu' ref={ref}>
|
100
95
|
<ul className='dropdown__menu-header'>
|
101
96
|
{headerElements}
|
102
97
|
</ul>
|
@@ -110,10 +105,7 @@ export const Dropdown = ({
|
|
110
105
|
);
|
111
106
|
} else if (header) {
|
112
107
|
return (
|
113
|
-
<div className='dropdown__menu dropdown__menu--has-head-foot'
|
114
|
-
id={menuID}
|
115
|
-
role='menu'
|
116
|
-
ref={ref}>
|
108
|
+
<div className='dropdown__menu dropdown__menu--has-head-foot' id={menuID} role='menu' ref={ref}>
|
117
109
|
<ul className='dropdown__menu-header'>
|
118
110
|
{headerElements}
|
119
111
|
</ul>
|
@@ -124,10 +116,7 @@ export const Dropdown = ({
|
|
124
116
|
);
|
125
117
|
} else if (footer) {
|
126
118
|
return (
|
127
|
-
<div className='dropdown__menu dropdown__menu--has-head-foot'
|
128
|
-
id={menuID}
|
129
|
-
role='menu'
|
130
|
-
ref={ref}>
|
119
|
+
<div className='dropdown__menu dropdown__menu--has-head-foot' id={menuID} role='menu' ref={ref}>
|
131
120
|
<ul className='dropdown__menu-body'>
|
132
121
|
{dropdownElements}
|
133
122
|
</ul>
|
@@ -138,17 +127,13 @@ export const Dropdown = ({
|
|
138
127
|
);
|
139
128
|
} else {
|
140
129
|
return (
|
141
|
-
<ul className='dropdown__menu '
|
142
|
-
id={menuID}
|
143
|
-
role='menu'
|
144
|
-
ref={ref}>
|
130
|
+
<ul className='dropdown__menu ' id={menuID} role='menu' ref={ref}>
|
145
131
|
{dropdownElements}
|
146
132
|
</ul>
|
147
133
|
);
|
148
134
|
}
|
149
135
|
}
|
150
136
|
|
151
|
-
// toggle menu
|
152
137
|
function toggleDisplay() {
|
153
138
|
if (!open) {
|
154
139
|
let menuRef: any;
|
@@ -197,14 +182,13 @@ export const Dropdown = ({
|
|
197
182
|
}
|
198
183
|
|
199
184
|
function addInPlaceholder() {
|
200
|
-
const placeholder = document.getElementById(
|
185
|
+
const placeholder = document.getElementById(DROPDOWN_ID_CONTAINER);
|
201
186
|
let menu = createAppendMenu();
|
202
187
|
if (open) {
|
203
188
|
return ReactDOM.render(menu, placeholder);
|
204
189
|
} else {
|
205
|
-
|
206
|
-
|
207
|
-
menuDOM.style.display = 'none';
|
190
|
+
if (placeholder) {
|
191
|
+
ReactDOM.unmountComponentAtNode(placeholder);
|
208
192
|
}
|
209
193
|
}
|
210
194
|
}
|
@@ -217,10 +201,12 @@ export const Dropdown = ({
|
|
217
201
|
});
|
218
202
|
return (
|
219
203
|
<DropdownItemWithSubmenu
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
204
|
+
key={index}
|
205
|
+
index={index}
|
206
|
+
item={item}
|
207
|
+
menuID={menuID}
|
208
|
+
subMenuItems={submenuItems}
|
209
|
+
onChange={onChange} />
|
224
210
|
);
|
225
211
|
} else if (item['type'] === 'group') {
|
226
212
|
let groupItems: any = [];
|
@@ -240,17 +226,18 @@ export const Dropdown = ({
|
|
240
226
|
} else {
|
241
227
|
return (
|
242
228
|
<DropdownItem
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
229
|
+
key={index}
|
230
|
+
label={item['label']}
|
231
|
+
icon={item['icon']}
|
232
|
+
active={item['active']}
|
233
|
+
onSelect={item['onSelect']}
|
234
|
+
onChange={onChange} />
|
235
|
+
);
|
249
236
|
}
|
250
237
|
}
|
251
238
|
|
252
239
|
return (
|
253
|
-
<div className={'dropdown ' + (open ? 'open' : '')}
|
240
|
+
<div className={'dropdown ' + (open ? 'open' : '')}>
|
254
241
|
{typeof children === 'object' ?
|
255
242
|
(React.isValidElement(children) ?
|
256
243
|
<div ref={buttonRef} style={{ display: 'content' }}>
|
@@ -264,11 +251,11 @@ export const Dropdown = ({
|
|
264
251
|
</div> : null)
|
265
252
|
:
|
266
253
|
<button ref={buttonRef}
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
254
|
+
className=' dropdown__toggle dropdown-toggle'
|
255
|
+
aria-haspopup="menu"
|
256
|
+
tabIndex={0}
|
257
|
+
aria-expanded={open}
|
258
|
+
onClick={toggleDisplay}>
|
272
259
|
{children}
|
273
260
|
<span className="dropdown__caret"></span>
|
274
261
|
</button>}
|
@@ -277,7 +264,7 @@ export const Dropdown = ({
|
|
277
264
|
null : (function() {
|
278
265
|
if (header && footer) {
|
279
266
|
return (
|
280
|
-
<div className='dropdown__menu dropdown__menu--has-head-foot' role='menu' ref={ref}
|
267
|
+
<div className='dropdown__menu dropdown__menu--has-head-foot' role='menu' ref={ref}>
|
281
268
|
<ul className='dropdown__menu-header'>
|
282
269
|
{headerElements}
|
283
270
|
</ul>
|
@@ -291,7 +278,7 @@ export const Dropdown = ({
|
|
291
278
|
);
|
292
279
|
} else if (header) {
|
293
280
|
return (
|
294
|
-
<div className='dropdown__menu dropdown__menu--has-head-foot' role='menu' ref={ref}
|
281
|
+
<div className='dropdown__menu dropdown__menu--has-head-foot' role='menu' ref={ref}>
|
295
282
|
<ul className='dropdown__menu-header'>
|
296
283
|
{headerElements}
|
297
284
|
</ul>
|
@@ -302,7 +289,7 @@ export const Dropdown = ({
|
|
302
289
|
);
|
303
290
|
} else if (footer) {
|
304
291
|
return (
|
305
|
-
<div className='dropdown__menu dropdown__menu--has-head-foot' role='menu' ref={ref}
|
292
|
+
<div className='dropdown__menu dropdown__menu--has-head-foot' role='menu' ref={ref}>
|
306
293
|
<ul className='dropdown__menu-body'>
|
307
294
|
{dropdownElements}
|
308
295
|
</ul>
|
@@ -313,7 +300,7 @@ export const Dropdown = ({
|
|
313
300
|
);
|
314
301
|
} else {
|
315
302
|
return (
|
316
|
-
<ul className='dropdown__menu' role='menu' ref={ref}
|
303
|
+
<ul className='dropdown__menu' role='menu' ref={ref}>
|
317
304
|
{dropdownElements}
|
318
305
|
</ul>
|
319
306
|
);
|
@@ -332,7 +319,9 @@ onChange,
|
|
332
319
|
}: IMenuItemRes) => {
|
333
320
|
return (
|
334
321
|
<li role='none' className={active ? 'dropdown__menu-item--active' : ''}>
|
335
|
-
<button tabIndex={0}
|
322
|
+
<button tabIndex={0}
|
323
|
+
role='menuitem'
|
324
|
+
onClick={() => {
|
336
325
|
onSelect();
|
337
326
|
if (onChange) {
|
338
327
|
onChange();
|
@@ -348,23 +337,25 @@ onChange,
|
|
348
337
|
const DropdownItemWithSubmenu = ({
|
349
338
|
index,
|
350
339
|
item,
|
340
|
+
menuID,
|
351
341
|
subMenuItems,
|
342
|
+
onChange,
|
352
343
|
}: IMenuItem | any) => {
|
353
344
|
const [open, setOpen] = React.useState<undefined | boolean>(undefined);
|
354
345
|
|
355
346
|
const refButtonSubMenu = React.useRef(null);
|
356
347
|
const refSubMenu = React.useRef(null);
|
348
|
+
const placeholder = document.getElementById(menuID);
|
357
349
|
|
358
350
|
React.useEffect(() => {
|
359
351
|
let subMenuRef: any = refSubMenu.current;
|
360
352
|
let subToggleRef = refButtonSubMenu.current;
|
361
353
|
|
362
354
|
if (open === true) {
|
363
|
-
|
355
|
+
placeholder?.appendChild(subMenuRef);
|
364
356
|
subMenuRef.style.display = 'block';
|
365
|
-
|
366
357
|
} else if (open === false) {
|
367
|
-
|
358
|
+
placeholder?.removeChild(subMenuRef);
|
368
359
|
subMenuRef.style.display = 'none';
|
369
360
|
}
|
370
361
|
|
@@ -377,20 +368,29 @@ const DropdownItemWithSubmenu = ({
|
|
377
368
|
|
378
369
|
return (
|
379
370
|
<li key={index} ref={refButtonSubMenu}>
|
380
|
-
<div className='dropdown'
|
371
|
+
<div className='dropdown'
|
372
|
+
onMouseLeave={() => setOpen(false)}>
|
381
373
|
<button
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
374
|
+
className='dropdown__toggle dropdown-toggle'
|
375
|
+
aria-haspopup="menu"
|
376
|
+
tabIndex={0}
|
377
|
+
onClick={() => {
|
378
|
+
if (item.onSelect) {
|
379
|
+
item.onSelect();
|
380
|
+
}
|
381
|
+
if (onChange) {
|
382
|
+
onChange();
|
383
|
+
}
|
384
|
+
}}
|
385
|
+
onMouseOver={() => setOpen(true) }>
|
387
386
|
{item['icon'] ? <i className={'icon-' + item['icon']}></i> : null}
|
388
387
|
{item['label']}
|
389
388
|
</button>
|
390
|
-
<ul
|
391
|
-
|
392
|
-
|
393
|
-
|
389
|
+
<ul
|
390
|
+
role='menu'
|
391
|
+
ref={refSubMenu}
|
392
|
+
style={{display: 'none'}}
|
393
|
+
className='dropdown__menu'>
|
394
394
|
{subMenuItems}
|
395
395
|
</ul>
|
396
396
|
</div>
|
@@ -356,7 +356,7 @@ export class DurationInput extends React.PureComponent<IProps, IState> {
|
|
356
356
|
}
|
357
357
|
}
|
358
358
|
|
359
|
-
export function getDurationString(seconds: number) {
|
359
|
+
export function getDurationString(seconds: number, zero?: boolean) {
|
360
360
|
function zeroPad(value: number | string) {
|
361
361
|
if (value.toString().length === 1 || value === 0) {
|
362
362
|
return `0${value}`;
|
@@ -367,9 +367,19 @@ export function getDurationString(seconds: number) {
|
|
367
367
|
}
|
368
368
|
}
|
369
369
|
|
370
|
-
let hour
|
371
|
-
let minute
|
372
|
-
let second
|
370
|
+
let hour;
|
371
|
+
let minute;
|
372
|
+
let second;
|
373
|
+
|
374
|
+
if (zero) {
|
375
|
+
hour = zeroPad(Math.floor(seconds / 3600));
|
376
|
+
minute = zeroPad(Math.floor((seconds % 3600) / 60));
|
377
|
+
second = zeroPad(Math.floor(seconds % 60));
|
378
|
+
} else {
|
379
|
+
hour = Math.floor(seconds / 3600);
|
380
|
+
minute = Math.floor((seconds % 3600) / 60);
|
381
|
+
second = Math.floor(seconds % 60);
|
382
|
+
}
|
373
383
|
|
374
384
|
if (Number(hour) === 0 && Number(minute) > 0) {
|
375
385
|
return `${minute}m ${second}s`;
|
@@ -14,8 +14,34 @@ interface IPropsItem {
|
|
14
14
|
}
|
15
15
|
|
16
16
|
class ContentListItem extends React.PureComponent<IPropsItem> {
|
17
|
+
|
18
|
+
private timer: any;
|
19
|
+
private delay = 200;
|
20
|
+
private prevent = false;
|
21
|
+
|
22
|
+
onSingleClick = () => {
|
23
|
+
this.timer = setTimeout(() => {
|
24
|
+
if (!this.prevent) {
|
25
|
+
if (this.props.onClick) {
|
26
|
+
this.props.onClick();
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}, this.delay);
|
30
|
+
}
|
31
|
+
|
32
|
+
onDoubleClick = () => {
|
33
|
+
clearTimeout(this.timer);
|
34
|
+
this.prevent = true;
|
35
|
+
if (this.props.onDoubleClick) {
|
36
|
+
this.props.onDoubleClick();
|
37
|
+
}
|
38
|
+
setTimeout(() => {
|
39
|
+
this.prevent = false;
|
40
|
+
}, this.delay);
|
41
|
+
}
|
42
|
+
|
17
43
|
render() {
|
18
|
-
let classes = classNames('sd-list-item sd-
|
44
|
+
let classes = classNames('sd-list-item sd-shadow--z1', {
|
19
45
|
'sd-list-item--activated': this.props.activated,
|
20
46
|
'sd-list-item--selected': this.props.selected,
|
21
47
|
'fetched': this.props.archived,
|
@@ -23,8 +49,7 @@ class ContentListItem extends React.PureComponent<IPropsItem> {
|
|
23
49
|
});
|
24
50
|
|
25
51
|
return (
|
26
|
-
|
27
|
-
<div className="sd-list-item sd-shadow--z1">
|
52
|
+
<div className={classes} onClick={this.onSingleClick} onDoubleClick={this.onDoubleClick}>
|
28
53
|
{this.props.locked
|
29
54
|
? <div className="sd-list-item__border sd-list-item__border--locked"></div>
|
30
55
|
: <div className="sd-list-item__border"></div>}
|
@@ -47,7 +72,6 @@ class ContentListItem extends React.PureComponent<IPropsItem> {
|
|
47
72
|
{this.props.action}
|
48
73
|
</div>
|
49
74
|
</div>
|
50
|
-
</div>
|
51
75
|
);
|
52
76
|
}
|
53
77
|
}
|
@@ -9,12 +9,12 @@ export interface IProps {
|
|
9
9
|
array: Array<IPropsArrayItem>;
|
10
10
|
addItem?: boolean;
|
11
11
|
dragAndDrop?: boolean;
|
12
|
-
itemsDropdown?: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
13
12
|
className?: string;
|
14
13
|
readOnly?: boolean;
|
15
14
|
showDragHandle?: 'always' | 'onHover' | 'none'; // always default
|
16
15
|
onDrag?(start: number, end: number): void;
|
17
16
|
onAddItem?(index: number, item?: IPropsArrayItem ): void;
|
17
|
+
itemsDropdown?(index?: number): Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
18
18
|
}
|
19
19
|
|
20
20
|
export interface IPropsArrayItem {
|
@@ -22,9 +22,9 @@ export interface IPropsArrayItem {
|
|
22
22
|
center?: React.ReactNode;
|
23
23
|
end?: React.ReactNode;
|
24
24
|
action?: React.ReactNode;
|
25
|
+
hexColor?: string;
|
25
26
|
onClick?(): void;
|
26
27
|
onDoubleClick?(): void;
|
27
|
-
hexColor?: string;
|
28
28
|
}
|
29
29
|
|
30
30
|
interface IState {
|
@@ -86,7 +86,7 @@ class TableList extends React.PureComponent<IProps, IState> {
|
|
86
86
|
dropDown() {
|
87
87
|
return (
|
88
88
|
<Dropdown
|
89
|
-
items={this.props.itemsDropdown ? this.props.itemsDropdown : []}>
|
89
|
+
items={this.props.itemsDropdown ? this.props.itemsDropdown() : []}>
|
90
90
|
<Button
|
91
91
|
type="primary"
|
92
92
|
icon="plus-large"
|
@@ -135,7 +135,9 @@ class TableList extends React.PureComponent<IProps, IState> {
|
|
135
135
|
? item.onDoubleClick
|
136
136
|
: undefined}
|
137
137
|
addItem={this.props.addItem}
|
138
|
-
itemsDropdown={this.props.itemsDropdown
|
138
|
+
itemsDropdown={() => this.props.itemsDropdown
|
139
|
+
? this.props.itemsDropdown(index)
|
140
|
+
: []}
|
139
141
|
hexColor={item.hexColor}
|
140
142
|
onAddItem={() => this.props.onAddItem
|
141
143
|
&& this.props.onAddItem(index, item)}
|
@@ -172,7 +174,7 @@ class TableList extends React.PureComponent<IProps, IState> {
|
|
172
174
|
? item.onDoubleClick
|
173
175
|
: undefined}
|
174
176
|
addItem={this.props.addItem}
|
175
|
-
itemsDropdown={this.props.itemsDropdown}
|
177
|
+
itemsDropdown={() => this.props.itemsDropdown ? this.props.itemsDropdown(index) : []}
|
176
178
|
hexColor={item.hexColor}
|
177
179
|
onAddItem={() => this.props.onAddItem
|
178
180
|
&& this.props.onAddItem(index, item)}
|
@@ -208,14 +210,14 @@ export interface IPropsItem {
|
|
208
210
|
end?: React.ReactNode;
|
209
211
|
action?: React.ReactNode;
|
210
212
|
addItem?: boolean;
|
211
|
-
itemsDropdown?: any;
|
212
213
|
dragAndDrop?: boolean;
|
214
|
+
hexColor?: string;
|
215
|
+
showDragHandle?: 'always' | 'onHover' | 'none';
|
213
216
|
onClick?(): void;
|
214
217
|
onDoubleClick?(): void;
|
215
218
|
onSelect?(): void;
|
216
219
|
onAddItem?(e: number): void;
|
217
|
-
|
218
|
-
showDragHandle?: 'always' | 'onHover' | 'none';
|
220
|
+
itemsDropdown?(index?: number): Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
219
221
|
}
|
220
222
|
|
221
223
|
class TableListItem extends React.PureComponent<IPropsItem> {
|
@@ -281,7 +283,7 @@ class TableListItem extends React.PureComponent<IPropsItem> {
|
|
281
283
|
<div className='table-list__add-bar'>
|
282
284
|
<Dropdown
|
283
285
|
onChange={this.props.onAddItem}
|
284
|
-
items={this.props.itemsDropdown ? this.props.itemsDropdown : []}>
|
286
|
+
items={this.props.itemsDropdown ? this.props.itemsDropdown() : []}>
|
285
287
|
<Button
|
286
288
|
type="primary"
|
287
289
|
icon="plus-large"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
interface IProps {
|
3
|
+
type?: 'primary' | 'success' | 'warning' | 'alert' | 'highlight' | 'sd-green';
|
4
|
+
style?: 'filled' | 'hollow';
|
5
|
+
size?: 'normal' | 'small';
|
6
|
+
restoreIcon?: 'info' | 'help';
|
7
|
+
}
|
8
|
+
interface IState {
|
9
|
+
open: boolean;
|
10
|
+
}
|
11
|
+
export declare class Alert extends React.PureComponent<IProps, IState> {
|
12
|
+
constructor(props: IProps);
|
13
|
+
onToggle(): void;
|
14
|
+
render(): JSX.Element;
|
15
|
+
}
|
16
|
+
export {};
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
interface IProps {
|
3
|
+
items: Array<any>;
|
4
|
+
keyValue?: string;
|
5
|
+
minLength?: number;
|
6
|
+
value?: string | object;
|
7
|
+
label?: string;
|
8
|
+
placeholder?: string;
|
9
|
+
info?: string;
|
10
|
+
error?: string;
|
11
|
+
required?: boolean;
|
12
|
+
disabled?: boolean;
|
13
|
+
invalid?: boolean;
|
14
|
+
inlineLabel?: boolean;
|
15
|
+
isSearchField?: boolean;
|
16
|
+
listItemTemplate?(value: any): any;
|
17
|
+
search?(searhString: string, callback: (result: Array<any>) => void): {
|
18
|
+
cancel: () => void;
|
19
|
+
};
|
20
|
+
onChange(newValue: string): void;
|
21
|
+
onSelect?(suggestion: string): void;
|
22
|
+
}
|
23
|
+
interface IState {
|
24
|
+
selectedItem: any;
|
25
|
+
filteredItems: any;
|
26
|
+
invalid: boolean;
|
27
|
+
focused: boolean;
|
28
|
+
}
|
29
|
+
export declare class Autocomplete extends React.Component<IProps, IState> {
|
30
|
+
latestCall?: {
|
31
|
+
cancel: () => void;
|
32
|
+
};
|
33
|
+
constructor(props: IProps);
|
34
|
+
htmlId: string;
|
35
|
+
search(term: string): void;
|
36
|
+
searchItem(event: any): void;
|
37
|
+
handleChange(event: {
|
38
|
+
originalEvent: Event;
|
39
|
+
value: any;
|
40
|
+
}): void;
|
41
|
+
handleSelect(event: {
|
42
|
+
originalEvent: Event;
|
43
|
+
value: any;
|
44
|
+
}): void;
|
45
|
+
handleInputClear(): void;
|
46
|
+
render(): JSX.Element;
|
47
|
+
}
|
48
|
+
export {};
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
interface IBase {
|
3
|
+
tooltipText?: string;
|
4
|
+
}
|
5
|
+
interface IImageAvatar extends IBase {
|
6
|
+
imageUrl?: string;
|
7
|
+
}
|
8
|
+
interface ITextAvatar extends IBase {
|
9
|
+
text: string;
|
10
|
+
}
|
11
|
+
export declare class AvatarContentText extends React.PureComponent<ITextAvatar> {
|
12
|
+
render(): JSX.Element;
|
13
|
+
}
|
14
|
+
export declare class AvatarContentImage extends React.PureComponent<IImageAvatar> {
|
15
|
+
render(): JSX.Element;
|
16
|
+
}
|
17
|
+
interface IPropsAvatarWrapper {
|
18
|
+
size?: 'small' | 'medium' | 'large' | 'x-large' | 'xx-large';
|
19
|
+
statusIndicator?: {
|
20
|
+
status: 'online' | 'offline';
|
21
|
+
tooltipText?: string;
|
22
|
+
};
|
23
|
+
administratorIndicator?: {
|
24
|
+
enabled: boolean;
|
25
|
+
tooltipText?: string;
|
26
|
+
};
|
27
|
+
children: React.ReactNode;
|
28
|
+
'data-test-id'?: string;
|
29
|
+
}
|
30
|
+
export declare class AvatarWrapper extends React.PureComponent<IPropsAvatarWrapper> {
|
31
|
+
render(): JSX.Element;
|
32
|
+
}
|
33
|
+
export {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
interface IProps {
|
3
|
+
text?: string;
|
4
|
+
type?: 'default' | 'primary' | 'success' | 'warning' | 'alert' | 'highlight' | 'light';
|
5
|
+
color?: string;
|
6
|
+
shape?: 'round' | 'square';
|
7
|
+
children?: React.ReactNode;
|
8
|
+
'data-test-id'?: string;
|
9
|
+
}
|
10
|
+
export declare class Badge extends React.PureComponent<IProps> {
|
11
|
+
render(): JSX.Element;
|
12
|
+
}
|
13
|
+
export {};
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
interface IButtonBase {
|
3
|
+
id?: string;
|
4
|
+
theme?: 'light' | 'dark';
|
5
|
+
type?: 'default' | 'primary' | 'success' | 'warning' | 'alert' | 'highlight' | 'sd-green';
|
6
|
+
size?: 'small' | 'normal' | 'large';
|
7
|
+
children?: never;
|
8
|
+
icon?: string;
|
9
|
+
disabled?: boolean;
|
10
|
+
iconOnly?: boolean;
|
11
|
+
onClick(): void;
|
12
|
+
'data-test-id'?: string;
|
13
|
+
}
|
14
|
+
interface IPropsButton extends IButtonBase {
|
15
|
+
text: string;
|
16
|
+
expand?: boolean;
|
17
|
+
style?: 'filled' | 'hollow' | 'text-only';
|
18
|
+
shape?: 'square' | 'round';
|
19
|
+
}
|
20
|
+
export declare class Button extends React.PureComponent<IPropsButton> {
|
21
|
+
render(): JSX.Element;
|
22
|
+
}
|
23
|
+
export {};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
interface IProps {
|
3
|
+
orientation?: 'horizontal' | 'vertical';
|
4
|
+
spaces?: 'comfort' | 'compact';
|
5
|
+
align?: 'left' | 'right' | 'center' | 'inline';
|
6
|
+
padded?: boolean;
|
7
|
+
children: React.ReactNode;
|
8
|
+
}
|
9
|
+
export declare class ButtonGroup extends React.PureComponent<IProps> {
|
10
|
+
render(): JSX.Element;
|
11
|
+
}
|
12
|
+
export {};
|