superdesk-ui-framework 2.4.10 → 2.4.15
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/scripts/modals.js +22 -9
- package/app/styles/app.scss +1 -0
- package/app/styles/form-elements/_select-grid.scss +77 -0
- package/app/styles/pr-superdesk-theme.scss +1 -0
- package/app/styles/primereact/_pr-skeleton.scss +35 -0
- package/app-typescript/components/IconPicker.tsx +277 -0
- package/app-typescript/components/ListItemLoader.tsx +30 -0
- package/app-typescript/components/SelectGrid.tsx +233 -0
- package/app-typescript/components/Skeleton.tsx +48 -0
- package/app-typescript/components/Tag.tsx +4 -3
- package/app-typescript/index.ts +5 -0
- package/dist/components/modals.html +1 -0
- package/dist/examples.bundle.js +3051 -1766
- package/dist/react/IconFont.tsx +7 -6
- package/dist/react/IconPicker.tsx +65 -0
- package/dist/react/Index.tsx +16 -1
- package/dist/react/ListItems.tsx +34 -0
- package/dist/react/SelectGrid.tsx +121 -0
- package/dist/react/Tags.tsx +14 -3
- package/dist/superdesk-ui.bundle.css +3356 -0
- package/dist/superdesk-ui.bundle.js +2563 -1480
- package/dist/vendor.bundle.js +49646 -49624
- package/examples/pages/components/modals.html +1 -0
- package/examples/pages/react/IconFont.tsx +7 -6
- package/examples/pages/react/IconPicker.tsx +65 -0
- package/examples/pages/react/Index.tsx +16 -1
- package/examples/pages/react/ListItems.tsx +34 -0
- package/examples/pages/react/SelectGrid.tsx +121 -0
- package/examples/pages/react/Tags.tsx +14 -3
- package/package.json +1 -1
- package/react/components/IconPicker.d.ts +24 -0
- package/react/components/IconPicker.js +283 -0
- package/react/components/ListItemLoader.d.ts +4 -0
- package/react/components/ListItemLoader.js +62 -0
- package/react/components/SelectGrid.d.ts +45 -0
- package/react/components/SelectGrid.js +179 -0
- package/react/components/Skeleton.d.ts +30 -0
- package/react/components/Skeleton.js +55 -0
- package/react/components/Tag.d.ts +2 -1
- package/react/components/Tag.js +3 -3
- package/react/index.d.ts +4 -0
- package/react/index.js +8 -0
package/dist/react/IconFont.tsx
CHANGED
@@ -3,19 +3,20 @@ import * as Markup from "../../js/react";
|
|
3
3
|
|
4
4
|
import { Icon, Prop, PropsList } from '../../../app-typescript';
|
5
5
|
|
6
|
+
//@ts-ignore
|
6
7
|
import * as iconFont from '../../../app/styles/_icon-font.scss';
|
7
8
|
|
8
|
-
export default class IconFontDoc extends React.PureComponent{
|
9
|
-
render(){
|
9
|
+
export default class IconFontDoc extends React.PureComponent {
|
10
|
+
render() {
|
10
11
|
const array = iconFont.icon.split(', ');
|
11
12
|
const icons = array.map((icon, index) =>
|
12
13
|
<li key={index}>
|
13
|
-
<Icon name={icon}/>
|
14
|
+
<Icon name={icon} />
|
14
15
|
<span>{icon}</span>
|
15
16
|
</li>
|
16
|
-
|
17
|
-
return(
|
18
|
-
<section className="docs-page__container">
|
17
|
+
);
|
18
|
+
return (
|
19
|
+
<section className="docs-page__container">
|
19
20
|
<h2 className="docs-page__h2 docs-page__text-align--center">Icon font</h2>
|
20
21
|
<Markup.ReactMarkupCodePreview>{`
|
21
22
|
<Icon name="photo" />
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import * as Markup from "../../js/react";
|
3
|
+
import { IconPicker, PropsList, Prop } from "../../../app-typescript";
|
4
|
+
|
5
|
+
const IconPickerDocs = () => {
|
6
|
+
|
7
|
+
const [value, setValue] = React.useState('amp');
|
8
|
+
|
9
|
+
return (
|
10
|
+
<section className="docs-page__container">
|
11
|
+
<h2 className="docs-page__h2">Icon Picker</h2>
|
12
|
+
<Markup.ReactMarkupCodePreview>{`
|
13
|
+
<IconPicker
|
14
|
+
label="Icon"
|
15
|
+
filterPlaceholder="Search..."
|
16
|
+
translateFunction={(text: string): string => text}
|
17
|
+
value={value}
|
18
|
+
onChange={(value) => {
|
19
|
+
setValue(value);
|
20
|
+
}}
|
21
|
+
/>
|
22
|
+
`}
|
23
|
+
</Markup.ReactMarkupCodePreview>
|
24
|
+
<Markup.ReactMarkup>
|
25
|
+
<Markup.ReactMarkupPreview>
|
26
|
+
<IconPicker
|
27
|
+
label="Icon"
|
28
|
+
filterPlaceholder="Search..."
|
29
|
+
translateFunction={(text: string): string => text}
|
30
|
+
value={value}
|
31
|
+
onChange={(value) => {
|
32
|
+
setValue(value);
|
33
|
+
}}
|
34
|
+
/>
|
35
|
+
</Markup.ReactMarkupPreview>
|
36
|
+
<Markup.ReactMarkupCode>{`
|
37
|
+
|
38
|
+
const [value, setValue] = React.useState("amp");
|
39
|
+
...
|
40
|
+
<IconPicker
|
41
|
+
label="Icon"
|
42
|
+
filterPlaceholder="Search..."
|
43
|
+
translateFunction={(text: string): string => text}
|
44
|
+
value={value}
|
45
|
+
onChange={(value) => {
|
46
|
+
setValue(value);
|
47
|
+
}}
|
48
|
+
/>
|
49
|
+
`}</Markup.ReactMarkupCode>
|
50
|
+
</Markup.ReactMarkup>
|
51
|
+
|
52
|
+
<h3 className="docs-page__h3">Props</h3>
|
53
|
+
<PropsList>
|
54
|
+
<Prop name='label' isRequired={false} type='string' default='Icon' description='Select label' />
|
55
|
+
<Prop name='filterPlaceholder' isRequired={false} type='string' default='Search...' description='Filter placeholder' />
|
56
|
+
<Prop name='translateFunction' isRequired={false} type='function' default='(text) => text' description='eg: gettext' />
|
57
|
+
<Prop name='value' isRequired={true} type='string' default='null' description='Current value' />
|
58
|
+
<Prop name='onChange' isRequired={true} type='Function' default='null' description='Callback onChange event ' />
|
59
|
+
</PropsList>
|
60
|
+
|
61
|
+
</section>
|
62
|
+
)
|
63
|
+
}
|
64
|
+
|
65
|
+
export default IconPickerDocs;
|
package/dist/react/Index.tsx
CHANGED
@@ -41,6 +41,9 @@ import GridItemDoc from './GridItem';
|
|
41
41
|
import ModalDoc from './Modal';
|
42
42
|
import CarouselDoc from './Carousel';
|
43
43
|
import ToggleboxDocs from './Togglebox';
|
44
|
+
import ListItemsDoc from './ListItems';
|
45
|
+
import SelectGridDocs from './SelectGrid';
|
46
|
+
import IconPickerDocs from "./IconPicker";
|
44
47
|
|
45
48
|
import * as Playgrounds from '../playgrounds/react-playgrounds/Index';
|
46
49
|
import { SelectWithTemplateDocs } from './SelectWithTemplate';
|
@@ -137,7 +140,10 @@ const pages = {
|
|
137
140
|
},
|
138
141
|
"togglebox": {
|
139
142
|
name: "Togglebox"
|
140
|
-
}
|
143
|
+
},
|
144
|
+
'list-items': {
|
145
|
+
name: 'List items'
|
146
|
+
},
|
141
147
|
}
|
142
148
|
},
|
143
149
|
formComponents: {
|
@@ -155,6 +161,9 @@ const pages = {
|
|
155
161
|
'select': {
|
156
162
|
name: 'Select',
|
157
163
|
},
|
164
|
+
'select-grid': {
|
165
|
+
name: 'Select Grid',
|
166
|
+
},
|
158
167
|
'select-with-template': {
|
159
168
|
name: 'Select with template',
|
160
169
|
},
|
@@ -164,6 +173,9 @@ const pages = {
|
|
164
173
|
'time-picker': {
|
165
174
|
name: 'Time Picker',
|
166
175
|
},
|
176
|
+
'icon-picker': {
|
177
|
+
name: 'Icon Picker',
|
178
|
+
},
|
167
179
|
'switch': {
|
168
180
|
name: 'Switch'
|
169
181
|
},
|
@@ -231,6 +243,9 @@ class ReactDoc extends React.Component {
|
|
231
243
|
<Route path="/react/carousel" component={CarouselDoc} />
|
232
244
|
<Route path="/react/menu" component={MenuDocs} />
|
233
245
|
<Route path="/react/togglebox" component={ToggleboxDocs} />
|
246
|
+
<Route path="/react/list-items" component={ListItemsDoc} />
|
247
|
+
<Route path="/react/select-grid" component={SelectGridDocs} />
|
248
|
+
<Route path="/react/icon-picker" component={IconPickerDocs} />
|
234
249
|
<Route path="/" component={ReactDefault} />
|
235
250
|
</Switch>
|
236
251
|
</main>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import * as Markup from "../../js/react";
|
3
|
+
import { ListItemLoader, PropsList } from "../../../app-typescript";
|
4
|
+
|
5
|
+
export default class ListItemsDoc extends React.Component {
|
6
|
+
render() {
|
7
|
+
return (
|
8
|
+
<section className="docs-page__container">
|
9
|
+
<h2 className="docs-page__h2">List Items</h2>
|
10
|
+
<Markup.ReactMarkupCodePreview>{`
|
11
|
+
<ListItemLoader />
|
12
|
+
`}
|
13
|
+
</Markup.ReactMarkupCodePreview>
|
14
|
+
<h3 className="docs-page__h3 docs-page__h3--small-top-m">Loader type of list items</h3>
|
15
|
+
<p className="docs-page__paragraph">Basic layout structure for list elements. The content inside the elements serves just as an example.</p>
|
16
|
+
<Markup.ReactMarkup>
|
17
|
+
<Markup.ReactMarkupPreview>
|
18
|
+
<div className="docs-page__content-row">
|
19
|
+
<ListItemLoader />
|
20
|
+
</div>
|
21
|
+
</Markup.ReactMarkupPreview>
|
22
|
+
<Markup.ReactMarkupCode>{`
|
23
|
+
<ListItemLoader />
|
24
|
+
`}</Markup.ReactMarkupCode>
|
25
|
+
</Markup.ReactMarkup>
|
26
|
+
|
27
|
+
<h3 className="docs-page__h3">Props</h3>
|
28
|
+
<PropsList>
|
29
|
+
|
30
|
+
</PropsList>
|
31
|
+
</section>
|
32
|
+
)
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,121 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import * as Markup from "../../js/react";
|
3
|
+
import { SelectGrid, Alert, PropsList, Prop } from "../../../app-typescript";
|
4
|
+
|
5
|
+
const SelectGridDocs = () => {
|
6
|
+
const letters = [
|
7
|
+
{ value: 'A', label: 'A' },
|
8
|
+
{ value: 'B', label: 'B' },
|
9
|
+
{ value: 'C', label: 'C' },
|
10
|
+
{ value: 'D', label: 'D' },
|
11
|
+
{ value: 'E', label: 'E' },
|
12
|
+
{ value: 'F', label: 'F' },
|
13
|
+
{ value: 'G', label: 'G' },
|
14
|
+
{ value: 'H', label: 'H' },
|
15
|
+
{ value: 'K', label: 'K' },
|
16
|
+
{ value: 'L', label: 'L' },
|
17
|
+
{ value: 'M', label: 'M' },
|
18
|
+
{ value: 'N', label: 'N' },
|
19
|
+
{ value: 'O', label: 'O' },
|
20
|
+
{ value: 'P', label: 'P' },
|
21
|
+
{ value: 'R', label: 'R' },
|
22
|
+
{ value: 'S', label: 'S' },
|
23
|
+
{ value: 'T', label: 'T' },
|
24
|
+
{ value: 'U', label: 'U' }
|
25
|
+
];
|
26
|
+
|
27
|
+
const [selectedItem, setSelectedItem] = React.useState(letters[0]);
|
28
|
+
|
29
|
+
return (
|
30
|
+
<section className="docs-page__container">
|
31
|
+
<h2 className="docs-page__h2">Select Grid</h2>
|
32
|
+
<p className="docs-page__paragraph">Universal select component with grid display of items. You can define your own trigger and item template.</p>
|
33
|
+
<p className="docs-page__paragraph">IconPicker is built on top of it.</p>
|
34
|
+
<Markup.ReactMarkupCodePreview>{`
|
35
|
+
<SelectGrid
|
36
|
+
label="Label"
|
37
|
+
filterPlaceholder="Search..."
|
38
|
+
getItems={(searchString) => {
|
39
|
+
return new Promise((resolve) => {
|
40
|
+
resolve([{ value: 'value', label: 'Label' }]);
|
41
|
+
});
|
42
|
+
}}
|
43
|
+
onChange={(value) => { }}
|
44
|
+
itemTemplate={({ item }) => <div />}
|
45
|
+
triggerTemplate={() => <button />}
|
46
|
+
/>
|
47
|
+
`}
|
48
|
+
</Markup.ReactMarkupCodePreview>
|
49
|
+
<Markup.ReactMarkup>
|
50
|
+
<Markup.ReactMarkupPreview>
|
51
|
+
<SelectGrid
|
52
|
+
label="Letter"
|
53
|
+
filterPlaceholder="Search..."
|
54
|
+
getItems={(searchString) => {
|
55
|
+
return new Promise((resolve) => {
|
56
|
+
if (searchString == null) {
|
57
|
+
resolve(letters);
|
58
|
+
} else {
|
59
|
+
resolve(letters.filter(({ label }) => label.toLocaleLowerCase().includes(searchString.toLocaleLowerCase())));
|
60
|
+
}
|
61
|
+
});
|
62
|
+
}}
|
63
|
+
onChange={(value) => {
|
64
|
+
setSelectedItem(value);
|
65
|
+
}}
|
66
|
+
itemTemplate={({ item }) => <div style={{ fontSize: '20px' }}>{item.label}</div>}
|
67
|
+
triggerTemplate={({ onClick }) => <button className="btn" onClick={onClick}>{selectedItem.label}</button>}
|
68
|
+
|
69
|
+
/>
|
70
|
+
</Markup.ReactMarkupPreview>
|
71
|
+
<Markup.ReactMarkupCode>{`
|
72
|
+
const letters = [
|
73
|
+
{ value: 'A', label: 'A' },
|
74
|
+
{ value: 'B', label: 'B' },
|
75
|
+
{ value: 'C', label: 'C' },
|
76
|
+
...
|
77
|
+
];
|
78
|
+
|
79
|
+
const [selectedItem, setSelectedItem] = React.useState(letters[0]);
|
80
|
+
...
|
81
|
+
<SelectGrid
|
82
|
+
label="Letter"
|
83
|
+
filterPlaceholder="Search..."
|
84
|
+
getItems={(searchString) => {
|
85
|
+
return new Promise((resolve) => {
|
86
|
+
if (searchString == null) {
|
87
|
+
resolve(letters);
|
88
|
+
} else {
|
89
|
+
resolve(letters.filter(({ label }) => label.toLocaleLowerCase().includes(searchString.toLocaleLowerCase())));
|
90
|
+
}
|
91
|
+
});
|
92
|
+
}}
|
93
|
+
onChange={(value) => {
|
94
|
+
setSelectedItem(value);
|
95
|
+
}}
|
96
|
+
itemTemplate={({ item }) => <div style={{ fontSize: '20px' }}>{item.label}</div>}
|
97
|
+
triggerTemplate={({ onClick }) => <button className="btn" onClick={onClick}>{selectedItem.label}</button>}
|
98
|
+
|
99
|
+
/>
|
100
|
+
`}</Markup.ReactMarkupCode>
|
101
|
+
</Markup.ReactMarkup>
|
102
|
+
|
103
|
+
<h3 className="docs-page__h3">Props</h3>
|
104
|
+
<PropsList>
|
105
|
+
<Prop name='label' isRequired={true} type='string' default='null' description='Select label' />
|
106
|
+
<Prop name='filterPlaceholder' isRequired={false} type='string' default='Search...' description='Filter placeholder' />
|
107
|
+
<Prop name='getItems' isRequired={true} type='function' default='false' description='Callback function that should return promise which resolves with array of items' />
|
108
|
+
<Prop name='onChange' isRequired={true} type='function' default='false' description='Callback on change event' />
|
109
|
+
<Prop name='itemTemplate' isRequired={true} type='Component' default='null' description='item renderer' />
|
110
|
+
<Prop name='triggerTemplate' isRequired={true} type='Component' default='null' description='trigger button renderer' />
|
111
|
+
</PropsList>
|
112
|
+
<Alert style='hollow' size='normal' type='alert' restoreIcon='info'>
|
113
|
+
1. triggerTemplate should include <button /> with onClick event. Otherwise keyboard controls won't work. <br />
|
114
|
+
2. Item should be an object with at least label and value.
|
115
|
+
</Alert>
|
116
|
+
</section>
|
117
|
+
)
|
118
|
+
}
|
119
|
+
|
120
|
+
|
121
|
+
export default SelectGridDocs;
|
package/dist/react/Tags.tsx
CHANGED
@@ -10,7 +10,13 @@ export default class TagDoc extends React.Component<{}, ITag> {
|
|
10
10
|
constructor(props){
|
11
11
|
super(props);
|
12
12
|
this.state = {
|
13
|
-
tags: [
|
13
|
+
tags: [
|
14
|
+
{text: 'This is a tag'},
|
15
|
+
{text: 'This is another tag', shade:'darker'},
|
16
|
+
{text: 'Lorem ipsum', shade:'highlight1'},
|
17
|
+
{text: 'Dolor amet', shade:'highlight2', shape:'square'},
|
18
|
+
{text: 'Read only tag', readOnly: true}
|
19
|
+
],
|
14
20
|
}
|
15
21
|
this.handleClick=this.handleClick.bind(this);
|
16
22
|
}
|
@@ -37,7 +43,12 @@ export default class TagDoc extends React.Component<{}, ITag> {
|
|
37
43
|
{this.state.tags.map((tag,index)=>{
|
38
44
|
return (
|
39
45
|
<React.Fragment key={index}>
|
40
|
-
<Tag keyValue={index}
|
46
|
+
<Tag keyValue={index}
|
47
|
+
text={tag.text}
|
48
|
+
shade={tag.shade}
|
49
|
+
shape={tag.shape}
|
50
|
+
readOnly={tag.readOnly}
|
51
|
+
onClick={()=>this.handleClick(index)}/>
|
41
52
|
</React.Fragment>
|
42
53
|
)
|
43
54
|
})}
|
@@ -63,4 +74,4 @@ export default class TagDoc extends React.Component<{}, ITag> {
|
|
63
74
|
</section>
|
64
75
|
)
|
65
76
|
}
|
66
|
-
}
|
77
|
+
}
|