superdesk-ui-framework 2.4.12 → 2.4.17
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 +1 -2
- package/app/styles/app.scss +1 -0
- package/app/styles/form-elements/_select-grid.scss +77 -0
- package/app-typescript/components/Dropdown.tsx +0 -1
- package/app-typescript/components/IconPicker.tsx +277 -0
- package/app-typescript/components/SelectGrid.tsx +233 -0
- package/app-typescript/index.ts +2 -0
- package/dist/examples.bundle.js +3128 -1902
- package/dist/playgrounds/react-playgrounds/SamsPlayground.tsx +14 -1
- package/dist/react/IconFont.tsx +7 -6
- package/dist/react/IconPicker.tsx +65 -0
- package/dist/react/Index.tsx +10 -0
- package/dist/react/SelectGrid.tsx +121 -0
- package/dist/react/Tags.tsx +1 -1
- package/dist/superdesk-ui.bundle.css +3327 -0
- package/dist/superdesk-ui.bundle.js +2329 -1398
- package/dist/vendor.bundle.js +13699 -13695
- package/examples/pages/playgrounds/react-playgrounds/SamsPlayground.tsx +14 -1
- package/examples/pages/react/IconFont.tsx +7 -6
- package/examples/pages/react/IconPicker.tsx +65 -0
- package/examples/pages/react/Index.tsx +10 -0
- package/examples/pages/react/SelectGrid.tsx +121 -0
- package/examples/pages/react/Tags.tsx +1 -1
- package/package.json +1 -1
- package/react/components/Dropdown.js +0 -1
- package/react/components/IconPicker.d.ts +24 -0
- package/react/components/IconPicker.js +283 -0
- package/react/components/SelectGrid.d.ts +45 -0
- package/react/components/SelectGrid.js +179 -0
- package/react/index.d.ts +2 -0
- package/react/index.js +4 -0
@@ -228,7 +228,20 @@ export class SamsPlayground extends React.Component<IProps, IState> {
|
|
228
228
|
<Badge text={item.priority} shape='square' color={item.priorityColor} />
|
229
229
|
</GridElements.GridItemFooterBlock>
|
230
230
|
<GridElements.GridItemFooterActions>
|
231
|
-
<
|
231
|
+
<Dropdown
|
232
|
+
align = 'right'
|
233
|
+
append = {true}
|
234
|
+
items={[
|
235
|
+
{
|
236
|
+
type: 'group', label: 'Actions', items: [
|
237
|
+
'divider',
|
238
|
+
{ label: 'Edit', icon: 'pencil', onSelect: () => this.setState({ dropDownState: 'Edit ' }) },
|
239
|
+
{ label: 'Download', icon: 'download', onSelect: () => this.setState({ dropDownState: 'Download' }) },
|
240
|
+
{ label: 'Delete', icon: 'trash', onSelect: () => this.setState({ dropDownState: 'Delete' }) },
|
241
|
+
]
|
242
|
+
}]}>
|
243
|
+
<IconButton ariaValue='dropdown-more-options' icon='dots-vertical' onClick={() => false} />
|
244
|
+
</Dropdown>
|
232
245
|
</GridElements.GridItemFooterActions>
|
233
246
|
</GridElements.GridItemFooter>
|
234
247
|
</GridElements.GridItem>
|
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
@@ -42,6 +42,8 @@ import ModalDoc from './Modal';
|
|
42
42
|
import CarouselDoc from './Carousel';
|
43
43
|
import ToggleboxDocs from './Togglebox';
|
44
44
|
import ListItemsDoc from './ListItems';
|
45
|
+
import SelectGridDocs from './SelectGrid';
|
46
|
+
import IconPickerDocs from "./IconPicker";
|
45
47
|
|
46
48
|
import * as Playgrounds from '../playgrounds/react-playgrounds/Index';
|
47
49
|
import { SelectWithTemplateDocs } from './SelectWithTemplate';
|
@@ -159,6 +161,9 @@ const pages = {
|
|
159
161
|
'select': {
|
160
162
|
name: 'Select',
|
161
163
|
},
|
164
|
+
'select-grid': {
|
165
|
+
name: 'Select Grid',
|
166
|
+
},
|
162
167
|
'select-with-template': {
|
163
168
|
name: 'Select with template',
|
164
169
|
},
|
@@ -168,6 +173,9 @@ const pages = {
|
|
168
173
|
'time-picker': {
|
169
174
|
name: 'Time Picker',
|
170
175
|
},
|
176
|
+
'icon-picker': {
|
177
|
+
name: 'Icon Picker',
|
178
|
+
},
|
171
179
|
'switch': {
|
172
180
|
name: 'Switch'
|
173
181
|
},
|
@@ -236,6 +244,8 @@ class ReactDoc extends React.Component {
|
|
236
244
|
<Route path="/react/menu" component={MenuDocs} />
|
237
245
|
<Route path="/react/togglebox" component={ToggleboxDocs} />
|
238
246
|
<Route path="/react/list-items" component={ListItemsDoc} />
|
247
|
+
<Route path="/react/select-grid" component={SelectGridDocs} />
|
248
|
+
<Route path="/react/icon-picker" component={IconPickerDocs} />
|
239
249
|
<Route path="/" component={ReactDefault} />
|
240
250
|
</Switch>
|
241
251
|
</main>
|
@@ -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