superdesk-ui-framework 3.0.2 → 3.0.4
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/app.scss +2 -1
- package/app/styles/editor/_editor-themes.scss +6 -1
- package/app/styles/form-elements/_inputs.scss +8 -8
- package/app/styles/layout/_editor.scss +5 -2
- package/app/styles/primereact/_pr-tag-input.scss +61 -0
- package/app-typescript/components/Layouts/AuthoringInnerBody.tsx +8 -1
- package/app-typescript/components/Layouts/AuthoringMain.tsx +2 -1
- package/app-typescript/components/MultiSelect.tsx +2 -0
- package/app-typescript/components/Navigation/SideBarTabs.tsx +34 -36
- package/app-typescript/components/TagInput.tsx +49 -233
- package/app-typescript/index.ts +0 -2
- package/dist/examples.bundle.js +2521 -2235
- package/dist/playgrounds/react-playgrounds/EditorTest.tsx +21 -18
- package/dist/playgrounds/react-playgrounds/Multiedit.tsx +29 -21
- package/dist/react/Index.tsx +3 -3
- package/dist/react/MultiSelect.tsx +4 -3
- package/dist/react/TagInputDocs.tsx +82 -0
- package/dist/superdesk-ui.bundle.css +73 -2
- package/dist/superdesk-ui.bundle.js +1503 -1704
- package/dist/vendor.bundle.js +19 -19
- package/examples/pages/playgrounds/react-playgrounds/EditorTest.tsx +21 -18
- package/examples/pages/playgrounds/react-playgrounds/Multiedit.tsx +29 -21
- package/examples/pages/react/Index.tsx +3 -3
- package/examples/pages/react/MultiSelect.tsx +4 -3
- package/examples/pages/react/TagInputDocs.tsx +82 -0
- package/package.json +2 -2
- package/react/components/Layouts/AuthoringInnerBody.d.ts +1 -0
- package/react/components/Layouts/AuthoringInnerBody.js +5 -1
- package/react/components/Layouts/AuthoringMain.d.ts +1 -0
- package/react/components/Layouts/AuthoringMain.js +1 -1
- package/react/components/MultiSelect.d.ts +1 -0
- package/react/components/MultiSelect.js +1 -1
- package/react/components/Navigation/SideBarTabs.d.ts +7 -8
- package/react/components/Navigation/SideBarTabs.js +21 -22
- package/react/index.d.ts +0 -2
- package/react/index.js +1 -6
- package/app-typescript/components/TagInputTest.tsx +0 -76
- package/dist/react/TagInputs.tsx +0 -92
- package/examples/pages/react/TagInputs.tsx +0 -92
- package/react/components/TagInput.d.ts +0 -7
- package/react/components/TagInput.js +0 -200
- package/react/components/TagInputTest.d.ts +0 -18
- package/react/components/TagInputTest.js +0 -91
package/app/styles/app.scss
CHANGED
@@ -257,6 +257,11 @@ $body-font-size: (
|
|
257
257
|
min-height: 9.2rem;
|
258
258
|
}
|
259
259
|
|
260
|
+
.theme-editor {
|
261
|
+
background-color: var(--sd-editor-colour__main-bg);
|
262
|
+
color: var(--sd-editor-colour__txt);
|
263
|
+
}
|
264
|
+
|
260
265
|
.theme-preview {
|
261
266
|
margin: 0 -2rem -2rem -2rem;
|
262
267
|
padding: 2rem;
|
@@ -269,7 +274,7 @@ $body-font-size: (
|
|
269
274
|
&:hover {
|
270
275
|
.theme-preview__label {
|
271
276
|
opacity: 1;
|
272
|
-
}
|
277
|
+
}
|
273
278
|
}
|
274
279
|
@each $name, $font in $theme-font-list {
|
275
280
|
&.sd-editor--font-#{$name} {
|
@@ -186,7 +186,7 @@
|
|
186
186
|
-webkit-appearance: none;
|
187
187
|
}
|
188
188
|
::-webkit-color-swatch-wrapper {
|
189
|
-
padding: 0;
|
189
|
+
padding: 0;
|
190
190
|
}
|
191
191
|
}
|
192
192
|
}
|
@@ -411,7 +411,7 @@
|
|
411
411
|
.sd-line-input__label {
|
412
412
|
line-height: 140%;
|
413
413
|
}
|
414
|
-
}
|
414
|
+
}
|
415
415
|
|
416
416
|
&.sd-line-input--required {
|
417
417
|
.sd-line-input__label::after {
|
@@ -876,7 +876,7 @@
|
|
876
876
|
box-shadow: none;
|
877
877
|
}
|
878
878
|
input {
|
879
|
-
&.duration-input, &.duration-input:hover, &.duration-input:focus {
|
879
|
+
&.duration-input, &.duration-input:hover, &.duration-input:focus {
|
880
880
|
opacity: 0.5;
|
881
881
|
//background-color: var(--color-input-bg);
|
882
882
|
//border-bottom: 1px dotted var(--color-input-border);
|
@@ -970,12 +970,12 @@
|
|
970
970
|
background-color: transparent;
|
971
971
|
}
|
972
972
|
}
|
973
|
-
|
973
|
+
|
974
974
|
&.sd-input--disabled {
|
975
975
|
input,
|
976
976
|
textarea {
|
977
|
-
&.sd-input__input,
|
978
|
-
&.sd-input__input:hover,
|
977
|
+
&.sd-input__input,
|
978
|
+
&.sd-input__input:hover,
|
979
979
|
&.sd-input__input:focus {
|
980
980
|
opacity: 0.5;
|
981
981
|
background-color: transparent;
|
@@ -1012,7 +1012,7 @@
|
|
1012
1012
|
pointer-events: none;
|
1013
1013
|
}
|
1014
1014
|
}
|
1015
|
-
|
1015
|
+
|
1016
1016
|
&.sd-input--invalid {
|
1017
1017
|
input, textarea {
|
1018
1018
|
&.sd-input__input {
|
@@ -1064,7 +1064,7 @@
|
|
1064
1064
|
}
|
1065
1065
|
}
|
1066
1066
|
}
|
1067
|
-
|
1067
|
+
|
1068
1068
|
}
|
1069
1069
|
|
1070
1070
|
///////////////// -------------------- Duration & Time-Date input --------------------- /////////////////
|
@@ -282,6 +282,9 @@
|
|
282
282
|
grid-row: authoringBody;
|
283
283
|
|
284
284
|
background-color: var(--sd-colour-panel-bg--000);
|
285
|
+
}
|
286
|
+
|
287
|
+
.sd-editor-content__authoring-body-padding {
|
285
288
|
padding: 3.2rem 4rem 5.2rem 4rem;
|
286
289
|
}
|
287
290
|
|
@@ -332,7 +335,7 @@
|
|
332
335
|
background-color: transparent;
|
333
336
|
cursor: pointer;
|
334
337
|
}
|
335
|
-
|
338
|
+
|
336
339
|
::-webkit-scrollbar-thumb {
|
337
340
|
background: var(--sd-colour__webkit-scrollbar-thumb);
|
338
341
|
}
|
@@ -401,4 +404,4 @@
|
|
401
404
|
border-color: var(--sd-colour-interactive--alpha-50);
|
402
405
|
box-shadow: inset 0 0 0 4px var(--sd-colour-interactive--alpha-20);
|
403
406
|
}
|
404
|
-
}
|
407
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
.p-chips {
|
2
|
+
font-size: 14px;
|
3
|
+
font-weight: normal;
|
4
|
+
height: 100%;
|
5
|
+
}
|
6
|
+
|
7
|
+
.p-chips-token {
|
8
|
+
@include tag-label;
|
9
|
+
transition: background-color .2s ease-out, color .1s ease-out, opacity .1s ease-out;
|
10
|
+
background: $tag-label-BG-default;
|
11
|
+
color: currentColor;
|
12
|
+
padding: 5px;
|
13
|
+
border-left: 20px;
|
14
|
+
border-radius: 30px;
|
15
|
+
|
16
|
+
&.selected {
|
17
|
+
background-color: var(--sd-colour-interactive--alpha-70);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
.p-chips-token-icon {
|
22
|
+
color: var(--color-text-lighter);
|
23
|
+
font-size: 20px;
|
24
|
+
&:hover {
|
25
|
+
cursor: pointer;
|
26
|
+
color: var(--color-text-light);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
.p-chips-token-label {
|
31
|
+
display: flex;
|
32
|
+
flex-direction: row;
|
33
|
+
align-items: center;
|
34
|
+
margin: 2px;
|
35
|
+
padding: 2px 2px 2px 3px;
|
36
|
+
}
|
37
|
+
|
38
|
+
.p-chips-multiple-container {
|
39
|
+
padding: 2px 0;
|
40
|
+
display: flex;
|
41
|
+
justify-content: flex-start;
|
42
|
+
align-items: center;
|
43
|
+
flex-wrap: wrap;
|
44
|
+
gap: $sd-base-increment / 8;
|
45
|
+
width: 100%;
|
46
|
+
transition: all 0.3s cubic-bezier(0.55, 0, 0.55, 0.2);
|
47
|
+
border-radius: 2px 2px 0 0;
|
48
|
+
font-size: 13px;
|
49
|
+
}
|
50
|
+
|
51
|
+
.tags-input__padding-disabled {
|
52
|
+
span {
|
53
|
+
padding-left: 0;
|
54
|
+
padding-inline: 4px;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
.p-chips-input-token {
|
59
|
+
font-size: 14px;
|
60
|
+
margin: 5px;
|
61
|
+
}
|
@@ -1,13 +1,20 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
+
import classNames from 'classnames';
|
2
3
|
|
3
4
|
interface IProps {
|
4
5
|
children?: React.ReactNode;
|
6
|
+
noPadding?: boolean;
|
5
7
|
}
|
6
8
|
|
7
9
|
export class AuthoringInnerBody extends React.PureComponent<IProps> {
|
8
10
|
render() {
|
9
11
|
return (
|
10
|
-
<article
|
12
|
+
<article
|
13
|
+
className={classNames(
|
14
|
+
'sd-editor-content__authoring-body',
|
15
|
+
{'sd-editor-content__authoring-body-padding': this.props.noPadding === false},
|
16
|
+
)}
|
17
|
+
>
|
11
18
|
{this.props.children}
|
12
19
|
</article>
|
13
20
|
);
|
@@ -18,6 +18,7 @@ interface IProps {
|
|
18
18
|
headerCollapsed?: boolean;
|
19
19
|
headerPadding?: 'small' | 'medium' | 'large';
|
20
20
|
toolbarCustom?: boolean;
|
21
|
+
noPaddingForContent?: boolean;
|
21
22
|
}
|
22
23
|
|
23
24
|
export class AuthoringMain extends React.PureComponent<IProps> {
|
@@ -42,7 +43,7 @@ export class AuthoringMain extends React.PureComponent<IProps> {
|
|
42
43
|
{this.props.authoringBookmarks}
|
43
44
|
</AuthorinInnerSideBar>
|
44
45
|
)}
|
45
|
-
<AuthoringInnerBody>
|
46
|
+
<AuthoringInnerBody noPadding={this.props.noPaddingForContent}>
|
46
47
|
{this.props.children}
|
47
48
|
</AuthoringInnerBody>
|
48
49
|
</AuthoringMainContent>
|
@@ -18,6 +18,7 @@ interface IProps<T> {
|
|
18
18
|
filter?: boolean;
|
19
19
|
showClear?: boolean;
|
20
20
|
showSelectAll?: boolean;
|
21
|
+
zIndex?: number;
|
21
22
|
itemTemplate?(item: any): JSX.Element | undefined;
|
22
23
|
selectedItemTemplate?(value: any): JSX.Element | undefined;
|
23
24
|
onChange(newValue: Array<T>): void;
|
@@ -77,6 +78,7 @@ export class MultiSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
77
78
|
options={this.props.options}
|
78
79
|
onChange={({value}) => this.props.onChange(value)}
|
79
80
|
display="chip"
|
81
|
+
zIndex={this.props.zIndex}
|
80
82
|
filter={this.props.filter}
|
81
83
|
filterBy={this.props.optionLabel}
|
82
84
|
appendTo={document.body}
|
@@ -1,49 +1,46 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { Icon } from '../Icon';
|
3
3
|
import { Badge } from '../Badge';
|
4
|
+
import classNames from 'classnames';
|
4
5
|
|
5
6
|
interface IProps {
|
7
|
+
activeTab: string | null;
|
8
|
+
onActiveTabChange(val: string | null): void;
|
6
9
|
items: Array<ISideBarTab | 'divider'>;
|
7
10
|
side?: 'none' | 'left' | 'right';
|
8
11
|
}
|
9
12
|
|
10
13
|
export interface ISideBarTab {
|
14
|
+
id: string;
|
11
15
|
icon: string;
|
12
16
|
size: 'small' | 'big'; // defaults to 'small'
|
13
17
|
tooltip?: string;
|
14
|
-
active?: boolean;
|
15
18
|
badgeValue?: string;
|
16
|
-
onClick(event: React.MouseEvent<
|
19
|
+
onClick(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>): void;
|
17
20
|
}
|
18
21
|
|
19
|
-
|
20
|
-
index: number;
|
21
|
-
closeIndex: number;
|
22
|
-
}
|
23
|
-
|
24
|
-
export class SideBarTabs extends React.PureComponent<IProps, IState> {
|
22
|
+
export class SideBarTabs extends React.PureComponent<IProps> {
|
25
23
|
constructor(props: IProps) {
|
26
24
|
super(props);
|
27
|
-
|
28
|
-
index: -1,
|
29
|
-
closeIndex: -1,
|
30
|
-
};
|
25
|
+
|
31
26
|
this.handleClick = this.handleClick.bind(this);
|
32
27
|
}
|
33
28
|
|
34
|
-
|
35
|
-
this.
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
this.setState({
|
40
|
-
closeIndex: indexNumber,
|
41
|
-
index: -1,
|
42
|
-
});
|
29
|
+
componentDidMount(): void {
|
30
|
+
const activeItem = this.props.items.find((item) => item !== 'divider' && item.id === this.props.activeTab);
|
31
|
+
|
32
|
+
if (activeItem != null && activeItem !== 'divider') {
|
33
|
+
this.props.onActiveTabChange(activeItem.id);
|
43
34
|
}
|
35
|
+
}
|
44
36
|
|
45
|
-
|
46
|
-
item.
|
37
|
+
handleClick(item: ISideBarTab, event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) {
|
38
|
+
if (this.props.activeTab === item.id) {
|
39
|
+
this.props.onActiveTabChange(null);
|
40
|
+
} else {
|
41
|
+
this.props.onActiveTabChange(item.id);
|
42
|
+
item.onClick(event);
|
43
|
+
}
|
47
44
|
}
|
48
45
|
|
49
46
|
render() {
|
@@ -57,23 +54,24 @@ export class SideBarTabs extends React.PureComponent<IProps, IState> {
|
|
57
54
|
);
|
58
55
|
} else {
|
59
56
|
return (
|
60
|
-
<li key={index} data-sd-tooltip={item
|
61
|
-
<a
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
}
|
57
|
+
<li key={index} data-sd-tooltip={item.tooltip} data-flow='left'>
|
58
|
+
<a
|
59
|
+
role='button'
|
60
|
+
aria-label={item.tooltip}
|
61
|
+
className={classNames(
|
62
|
+
'sd-sidetab-menu__btn',
|
63
|
+
{'sd-sidetab-menu__btn--active': item.id === this.props.activeTab},
|
64
|
+
)}
|
65
|
+
onClick={(event) => this.handleClick(item, event)}
|
66
|
+
>
|
67
|
+
{item.badgeValue != null && (
|
68
|
+
<Badge text={item['badgeValue']} type='primary' />
|
69
|
+
)}
|
73
70
|
|
74
71
|
<span className='sd-sidetab-menu__main-icon '>
|
75
72
|
<Icon size={item['size']} name={item['icon']} />
|
76
73
|
</span>
|
74
|
+
|
77
75
|
<i className='sd-sidetab-menu__helper-icon icon-close-small'></i>
|
78
76
|
</a>
|
79
77
|
</li>
|
@@ -1,237 +1,53 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import
|
3
|
-
import {
|
4
|
-
import
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
import { Chips } from '@superdesk/primereact/chips';
|
3
|
+
import {InputWrapper} from './Form';
|
4
|
+
import nextId from "react-id-generator";
|
5
|
+
|
6
|
+
interface IProps {
|
7
|
+
value: Array<string>;
|
8
|
+
onChange(value: Array<string>): void;
|
9
|
+
placeholder: string;
|
10
|
+
invalid?: boolean;
|
11
|
+
inlineLabel?: boolean;
|
12
|
+
labelHidden?: boolean;
|
13
|
+
tabindex?: number;
|
14
|
+
fullWidth?: boolean;
|
15
|
+
info?: string;
|
16
|
+
error?: string;
|
17
|
+
required?: boolean;
|
18
|
+
label?: string;
|
19
|
+
disabled?: boolean;
|
14
20
|
}
|
15
21
|
|
16
|
-
export
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
const val = e.target.value;
|
47
|
-
if (val.length > 1) {
|
48
|
-
setInvalid(false);
|
49
|
-
}
|
50
|
-
if (e.key === 'Enter' && val) {
|
51
|
-
if (val.length > 2 && freetype) {
|
52
|
-
setInvalid(false);
|
53
|
-
if (checkTag(val) === 0) {
|
54
|
-
setTags((tag) => tag.concat(val));
|
55
|
-
let inputRefVariable: any = inputRef.current;
|
56
|
-
if (inputRefVariable) {
|
57
|
-
inputRefVariable.value = null;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
} else {
|
61
|
-
setInvalid(true);
|
62
|
-
}
|
63
|
-
} else if (e.key === 'Backspace' && !val) {
|
64
|
-
setSelectNumber(tags.length - 1);
|
65
|
-
if (selectNumber !== -1) {
|
66
|
-
removeTag(selectNumber);
|
67
|
-
setSelectNumber(-1);
|
68
|
-
}
|
69
|
-
} else if (e.key === 'ArrowLeft' && !val) {
|
70
|
-
if (selectNumber > 0) {
|
71
|
-
setSelectNumber(selectNumber - 1);
|
72
|
-
} else {
|
73
|
-
setSelectNumber(tags.length - 1);
|
74
|
-
}
|
75
|
-
} else if (e.key === 'ArrowRight' && !val) {
|
76
|
-
if (selectNumber !== -1 && selectNumber < tags.length - 1) {
|
77
|
-
setSelectNumber(selectNumber + 1);
|
78
|
-
} else {
|
79
|
-
setSelectNumber(0);
|
80
|
-
}
|
81
|
-
}
|
82
|
-
}
|
83
|
-
|
84
|
-
function checkTag(newTag: any) {
|
85
|
-
let count = 0;
|
86
|
-
tags.forEach(function(tag) {
|
87
|
-
if (tag === newTag) {
|
88
|
-
count = 1;
|
89
|
-
}
|
90
|
-
});
|
91
|
-
return count;
|
92
|
-
}
|
93
|
-
|
94
|
-
function removeTag(i: number) {
|
95
|
-
let newTags = clone(tags);
|
96
|
-
newTags.splice(i, 1);
|
97
|
-
setTags(newTags);
|
98
|
-
}
|
99
|
-
|
100
|
-
function onTextChanged(e: any) {
|
101
|
-
if (items) {
|
102
|
-
const value = e.target.value;
|
103
|
-
let newSuggestions = [];
|
104
|
-
if (value.length > 1) {
|
105
|
-
const regex = new RegExp(`^${value}`, 'i');
|
106
|
-
newSuggestions = items.sort().filter((v) => regex.test(v));
|
107
|
-
}
|
108
|
-
setSuggestions(newSuggestions);
|
109
|
-
}
|
110
|
-
}
|
111
|
-
|
112
|
-
function addTag(item: any) {
|
113
|
-
if (checkTag(item) === 0) {
|
114
|
-
setTags((tag) => tag.concat(item));
|
115
|
-
let inputRefVariable: any = inputRef.current;
|
116
|
-
if (inputRefVariable) {
|
117
|
-
inputRefVariable.value = null;
|
118
|
-
}
|
119
|
-
}
|
120
|
-
setSuggestions([]);
|
121
|
-
}
|
122
|
-
|
123
|
-
function toggleSuggestions() {
|
124
|
-
if (!openSuggestion) {
|
125
|
-
setOpenSuggestion(true);
|
126
|
-
document.addEventListener('click', closeSuggestions);
|
127
|
-
} else {
|
128
|
-
setOpenSuggestion(false);
|
129
|
-
}
|
130
|
-
}
|
131
|
-
|
132
|
-
function closeSuggestions() {
|
133
|
-
document.removeEventListener('click', closeSuggestions);
|
134
|
-
setOpenSuggestion(false);
|
135
|
-
}
|
136
|
-
|
137
|
-
function toggleFocus() {
|
138
|
-
if (!focus) {
|
139
|
-
setFocus(true);
|
140
|
-
document.addEventListener('click', removeFocus);
|
141
|
-
} else {
|
142
|
-
setFocus(false);
|
143
|
-
}
|
22
|
+
export class TagInput extends React.Component<IProps> {
|
23
|
+
private htmlId: string = nextId();
|
24
|
+
|
25
|
+
render() {
|
26
|
+
const {onChange, value, placeholder} = this.props;
|
27
|
+
|
28
|
+
return (
|
29
|
+
<InputWrapper
|
30
|
+
label={this.props.label}
|
31
|
+
error={this.props.error}
|
32
|
+
required={this.props.required}
|
33
|
+
disabled={this.props.disabled}
|
34
|
+
invalid={this.props.invalid}
|
35
|
+
info={this.props.info}
|
36
|
+
inlineLabel={this.props.inlineLabel}
|
37
|
+
labelHidden={this.props.labelHidden}
|
38
|
+
fullWidth={this.props.fullWidth}
|
39
|
+
htmlId={this.htmlId}
|
40
|
+
tabindex={this.props.tabindex}>
|
41
|
+
<Chips
|
42
|
+
className={`tags-input--multi-select sd-input__input ${this.props.disabled ? ' tags-input__padding-disabled' : ''}`}
|
43
|
+
allowDuplicate={false}
|
44
|
+
separator=","
|
45
|
+
onChange={(event) => onChange(event.value)}
|
46
|
+
value={value}
|
47
|
+
placeholder={placeholder}
|
48
|
+
disabled={this.props.disabled}
|
49
|
+
/>
|
50
|
+
</InputWrapper>
|
51
|
+
);
|
144
52
|
}
|
145
|
-
|
146
|
-
function removeFocus() {
|
147
|
-
document.removeEventListener('click', removeFocus);
|
148
|
-
setFocus(false);
|
149
|
-
}
|
150
|
-
|
151
|
-
function renderSuggestions() {
|
152
|
-
if (openSuggestion) {
|
153
|
-
return (
|
154
|
-
<div className='autocomplete' ref={refSuggestions}>
|
155
|
-
<ul className='suggestion-list' >
|
156
|
-
{suggestions.length !== 0 ? (
|
157
|
-
suggestions.map((item, index) =>
|
158
|
-
<li className={'suggestion-item'}
|
159
|
-
onClick={() => addTag(item)}
|
160
|
-
key={index}>
|
161
|
-
{item}
|
162
|
-
</li>,
|
163
|
-
)
|
164
|
-
) : (
|
165
|
-
items?.map((item, index) =>
|
166
|
-
<li className={'suggestion-item'}
|
167
|
-
onClick={() => addTag(item)}
|
168
|
-
key={index}>
|
169
|
-
{item}
|
170
|
-
</li>,
|
171
|
-
)
|
172
|
-
)}
|
173
|
-
</ul>
|
174
|
-
</div>
|
175
|
-
);
|
176
|
-
} else if (suggestions.length === 0) {
|
177
|
-
return null;
|
178
|
-
} else {
|
179
|
-
return (
|
180
|
-
<div className='autocomplete' ref={refSuggestions}>
|
181
|
-
<ul className='suggestion-list' >
|
182
|
-
{suggestions.map((item, index) =>
|
183
|
-
<li className={'suggestion-item'}
|
184
|
-
onClick={() => addTag(item)}
|
185
|
-
key={index}>
|
186
|
-
{item}
|
187
|
-
</li>,
|
188
|
-
)}
|
189
|
-
</ul>
|
190
|
-
</div>
|
191
|
-
);
|
192
|
-
}
|
193
|
-
}
|
194
|
-
|
195
|
-
let classes = classNames('tags-input__tags', {
|
196
|
-
'focused': focus,
|
197
|
-
'tag-input__invalid-tag': invalid,
|
198
|
-
});
|
199
|
-
|
200
|
-
return (
|
201
|
-
<div className='sd-tag-input' data-label={label} >
|
202
|
-
<label className='tags-input__label'>{label}</label>
|
203
|
-
<div className='tags-input' ref={refTagInput}>
|
204
|
-
<div className={classes} >
|
205
|
-
{items ?
|
206
|
-
<button className="tags-input__add-button"
|
207
|
-
onClick={toggleSuggestions}>
|
208
|
-
<i className="icon-plus-large"></i>
|
209
|
-
</button> : null}
|
210
|
-
<ul className='tags-input__tag-list'>
|
211
|
-
{tags.map((tag, i) => {
|
212
|
-
return (
|
213
|
-
<li className={'tags-input__tag-item' + (selectNumber === i ? ' selected' : '')}
|
214
|
-
key={i}>
|
215
|
-
{tag}
|
216
|
-
<a type='button' className='tags-input__remove-button' onClick={() => removeTag(i)}>
|
217
|
-
<i className='icon-close-small'></i>
|
218
|
-
</a>
|
219
|
-
</li>
|
220
|
-
);
|
221
|
-
})}
|
222
|
-
<li className='input-tag__tags__input'>
|
223
|
-
<input
|
224
|
-
type='text'
|
225
|
-
className={'tags-input__input' + (invalid ? ' invalid-tag' : '')}
|
226
|
-
onChange={onTextChanged}
|
227
|
-
ref={inputRef}
|
228
|
-
onKeyDown={inputKeyDown}
|
229
|
-
onClick={toggleFocus} />
|
230
|
-
</li>
|
231
|
-
</ul>
|
232
|
-
</div>
|
233
|
-
{items ? renderSuggestions() : null}
|
234
|
-
</div>
|
235
|
-
</div>
|
236
|
-
);
|
237
|
-
};
|
53
|
+
}
|
package/app-typescript/index.ts
CHANGED
@@ -57,8 +57,6 @@ export { Autocomplete } from './components/Autocomplete';
|
|
57
57
|
export { DonutChart } from './components/DonutChart';
|
58
58
|
export { Carousel } from './components/Carousel';
|
59
59
|
export { Modal } from './components/Modal';
|
60
|
-
export { TagInput } from './components/TagInput';
|
61
|
-
export { TagInputTest } from './components/TagInputTest';
|
62
60
|
export { GridList } from './components/GridList';
|
63
61
|
export { GridItem, GridItemContent, GridItemMedia, GridItemFooter, GridItemContentBlock,
|
64
62
|
GridItemTime, GridItemTitle, GridItemText, GridItemSlug, GridItemFooterBlock,
|