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.
@@ -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
- <IconButton icon='dots-vertical' ariaValue='More actions' onClick={()=> this.changeStatus(item, 'archived')} />
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>
@@ -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;
@@ -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 &#x3C;button /&#x3E; 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;
@@ -74,4 +74,4 @@ export default class TagDoc extends React.Component<{}, ITag> {
74
74
  </section>
75
75
  )
76
76
  }
77
- }
77
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superdesk-ui-framework",
3
- "version": "2.4.12",
3
+ "version": "2.4.17",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -105,7 +105,6 @@ exports.Dropdown = function (_a) {
105
105
  if (toggleRef && menuRef) {
106
106
  core_1.createPopper(toggleRef, menuRef, {
107
107
  placement: checkAlign() ? 'bottom-end' : 'bottom-start',
108
- strategy: 'fixed',
109
108
  });
110
109
  menuRef.style.display = 'block';
111
110
  }
@@ -0,0 +1,24 @@
1
+ import * as React from 'react';
2
+ import { IItem } from "./SelectGrid";
3
+ interface IProps {
4
+ label?: string;
5
+ filterPlaceholder?: string;
6
+ translateFunction?: (text: string) => string;
7
+ value: string;
8
+ onChange(icon: string): void;
9
+ }
10
+ interface IState {
11
+ icons: Array<IItem>;
12
+ }
13
+ export declare class IconPicker extends React.PureComponent<IProps, IState> {
14
+ constructor(props: IProps);
15
+ componentDidMount(): void;
16
+ getItems: (searchString: string | null) => Promise<Array<IItem>>;
17
+ onChange: (item: IItem) => void;
18
+ triggerTemplate: (props: any) => JSX.Element;
19
+ itemTemplate: ({ item }: {
20
+ item: IItem | null;
21
+ }) => JSX.Element | null;
22
+ render(): JSX.Element;
23
+ }
24
+ export {};
@@ -0,0 +1,283 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
18
+ }) : (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ }));
22
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
24
+ }) : function(o, v) {
25
+ o["default"] = v;
26
+ });
27
+ var __importStar = (this && this.__importStar) || function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ var __spreadArrays = (this && this.__spreadArrays) || function () {
35
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
36
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
37
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
38
+ r[k] = a[j];
39
+ return r;
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.IconPicker = void 0;
43
+ var React = __importStar(require("react"));
44
+ // @ts-ignore
45
+ var iconFont = __importStar(require("../../app/styles/_icon-font.scss"));
46
+ var Button_1 = require("./Button");
47
+ var Icon_1 = require("./Icon");
48
+ var SelectGrid_1 = require("./SelectGrid");
49
+ var IconPicker = /** @class */ (function (_super) {
50
+ __extends(IconPicker, _super);
51
+ function IconPicker(props) {
52
+ var _this = _super.call(this, props) || this;
53
+ _this.getItems = function (searchString) {
54
+ return new Promise(function (resolve) {
55
+ var icons = __spreadArrays(_this.state.icons);
56
+ if (searchString) {
57
+ icons = icons.filter(function (icon) { return (icon.value.toLowerCase().includes(searchString) ||
58
+ icon.label.toLowerCase().includes(searchString)); });
59
+ }
60
+ resolve(icons);
61
+ });
62
+ };
63
+ _this.onChange = function (item) {
64
+ _this.props.onChange(item.value);
65
+ };
66
+ _this.triggerTemplate = function (props) { return React.createElement(Button_1.Button, { icon: _this.props.value, text: _this.props.value, onClick: function (e) { props.onClick(e); }, iconOnly: true }); };
67
+ _this.itemTemplate = function (_a) {
68
+ var item = _a.item;
69
+ return item ?
70
+ (React.createElement(React.Fragment, null,
71
+ React.createElement(Icon_1.Icon, { name: item.value }),
72
+ React.createElement("span", { className: "sd-text__normal sd-padding-t--1" }, item.label))) : null;
73
+ };
74
+ _this.state = { icons: [] };
75
+ return _this;
76
+ }
77
+ IconPicker.prototype.componentDidMount = function () {
78
+ var translateFunction = this.props.translateFunction ?
79
+ this.props.translateFunction : function (text) { return text; };
80
+ this.setState({
81
+ icons: getIcons(translateFunction),
82
+ });
83
+ };
84
+ IconPicker.prototype.render = function () {
85
+ return (React.createElement(SelectGrid_1.SelectGrid, { label: this.props.label || "Icon", filterPlaceholder: this.props.filterPlaceholder || "Search...", getItems: this.getItems, onChange: this.onChange, itemTemplate: this.itemTemplate, triggerTemplate: this.triggerTemplate }));
86
+ };
87
+ return IconPicker;
88
+ }(React.PureComponent));
89
+ exports.IconPicker = IconPicker;
90
+ var getIcons = function (translateFunction) {
91
+ var translatedIconNameMap = {
92
+ 'add-gallery': 'Add Gallery',
93
+ 'add-image': 'Add Image',
94
+ 'adjust': 'Adjust',
95
+ 'align-center': 'Align Center',
96
+ 'align-justify': 'Align Justify',
97
+ 'align-left': 'Align Left',
98
+ 'align-right': 'Align Right',
99
+ 'amp': 'AMP',
100
+ 'analytics': 'Analytics',
101
+ 'archive': 'Archive',
102
+ 'arrow-left': 'Arrow Left',
103
+ 'arrow-right': 'Arrow Right',
104
+ 'arrow-small': 'Arrow Small',
105
+ 'ascending': 'Ascending',
106
+ 'assign': 'Assign',
107
+ 'attachment': 'Attachment',
108
+ 'attachment-large': 'Attachment Large',
109
+ 'audio': 'Audio',
110
+ 'backward-thin': 'Backward Thin',
111
+ 'ban-circle': 'Ban Circle',
112
+ 'bell': 'Bell',
113
+ 'bold': 'Bold',
114
+ 'broadcast': 'Broadcast',
115
+ 'broadcast-create': 'Broadcast Create',
116
+ 'business': 'Business',
117
+ 'calendar': 'Calendar',
118
+ 'calendar-list': 'Calendar List',
119
+ 'chevron-down-thin': 'Chevron Down Thin',
120
+ 'chevron-left-thin': 'Chevron Left Thin',
121
+ 'chevron-right-thin': 'Chevron Right Thin',
122
+ 'chevron-up-thin': 'Chevron Up Thin',
123
+ 'clear-all': 'Clear All',
124
+ 'clear-format': 'Clear Format',
125
+ 'close-small': 'Close Small',
126
+ 'close-thick': 'Close Thick',
127
+ 'code': 'Code',
128
+ 'collapse': 'Collapse',
129
+ 'comment': 'Comment',
130
+ 'composite': 'Composite',
131
+ 'copy': 'Copy',
132
+ 'crop': 'Crop',
133
+ 'cut': 'Cut',
134
+ 'descending': 'Descending',
135
+ 'dots': 'Dots',
136
+ 'dots-vertical': 'Dots Vertical',
137
+ 'download': 'Download',
138
+ 'download-alt': 'Download Alternate',
139
+ 'edit-line': 'Edit Line',
140
+ 'envelope': 'Envelope',
141
+ 'event': 'Event',
142
+ 'exclamation-sign': 'Exclamation Sign',
143
+ 'expand': 'Expand',
144
+ 'expand-thin': 'Expand Thin',
145
+ 'external': 'External',
146
+ 'eye-open': 'Eye Open',
147
+ 'facebook': 'Facebook',
148
+ 'facebook-circle': 'Facebook Circle',
149
+ 'fast_forward': 'Fast Forward',
150
+ 'fast_rewind': 'Fast Rewind',
151
+ 'fetch-as': 'Fetch As',
152
+ 'file': 'File',
153
+ 'filter-large': 'Filter Large',
154
+ 'flip-horizontal': 'Flip Horizontal',
155
+ 'flip-vertical': 'Flip Vertical',
156
+ 'folder-close': 'Folder Close',
157
+ 'folder-open': 'Folder Open',
158
+ 'font': 'Font',
159
+ 'forward-thin': 'Forward Thin',
160
+ 'fullscreen': 'Fullscreen',
161
+ 'globe': 'Globe',
162
+ 'graphic': 'Graphic',
163
+ 'grid-view': 'Grid View',
164
+ 'grid-view-large': 'Grid View Large',
165
+ 'heading-1': 'Heading 1',
166
+ 'heading-2': 'Heading 2',
167
+ 'heading-3': 'Heading 3',
168
+ 'heading-4': 'Heading 4',
169
+ 'heading-5': 'Heading 5',
170
+ 'heading-6': 'Heading 6',
171
+ 'heart': 'Heart',
172
+ 'help-large': 'Help Large',
173
+ 'highlight-package': 'Highlight Package',
174
+ 'home': 'Home',
175
+ 'indent-left': 'Indent Left',
176
+ 'indent-right': 'Indent Right',
177
+ 'info-large': 'Info Large',
178
+ 'info-sign': 'Info Sign',
179
+ 'ingest': 'Ingest',
180
+ 'instagram': 'Instagram',
181
+ 'italic': 'Italic',
182
+ 'kanban-view': 'Kanban View',
183
+ 'kill': 'Kill',
184
+ 'link': 'Link',
185
+ 'linked-in': 'LinkedIn',
186
+ 'linked-in-circle': 'LinkedIn Circle',
187
+ 'list-alt': 'List Alternate',
188
+ 'list-menu': 'List Menu',
189
+ 'list-plus': 'List Plus',
190
+ 'list-view': 'List View',
191
+ 'lock': 'Lock',
192
+ 'map-marker': 'Map Marker',
193
+ 'minus-sign': 'Minus Sign',
194
+ 'minus-small': 'Minus Small',
195
+ 'mobile': 'Mobile',
196
+ 'move': 'Move',
197
+ 'multi-star': 'Multi Start',
198
+ 'multiedit': 'Multi Edit',
199
+ 'new-doc': 'New Document',
200
+ 'ok': 'Okay',
201
+ 'ordered-list': 'Ordered List',
202
+ 'package-create': 'Package Create',
203
+ 'package-plus': 'Package Plus',
204
+ 'paragraph': 'Paragraph',
205
+ 'paste': 'Paste',
206
+ 'pause': 'Pause',
207
+ 'paywall': 'Paywall',
208
+ 'pencil': 'Pencil',
209
+ 'phone': 'Phone',
210
+ 'photo': 'Photo',
211
+ 'pick': 'Pick',
212
+ 'picture': 'Picture',
213
+ 'pin': 'Pin',
214
+ 'play': 'Play',
215
+ 'plus-large': 'Plus Large',
216
+ 'plus-sign': 'Plus Sign',
217
+ 'plus-small': 'Plus Small',
218
+ 'post': 'Post',
219
+ 'preformatted': 'Preformatted',
220
+ 'preview-mode': 'Preview Mode',
221
+ 'print': 'Print',
222
+ 'question-sign': 'Question Sign',
223
+ 'quote': 'Quote',
224
+ 'random': 'Random',
225
+ 'recurring': 'Recurring',
226
+ 'redo': 'Redo',
227
+ 'refresh': 'Refresh',
228
+ 'remove-sign': 'Remove Sign',
229
+ 'repeat': 'Repeat',
230
+ 'retweet': 'Retweet',
231
+ 'revert': 'Revert',
232
+ 'rotate-left': 'Rotate Left',
233
+ 'rotate-right': 'Rotate Right',
234
+ 'search': 'Search',
235
+ 'settings': 'Settings',
236
+ 'share-alt': 'Share Alternate',
237
+ 'signal': 'Signal',
238
+ 'skip_next': 'Skip Next',
239
+ 'skip_previous': 'Skip Previous',
240
+ 'slideshow': 'Slideshow',
241
+ 'star': 'Star',
242
+ 'star-empty': 'Star Empty',
243
+ 'stop': 'Stop',
244
+ 'stream': 'Stream',
245
+ 'strikethrough': 'Strikethrough',
246
+ 'subscript': 'Subscript',
247
+ 'suggestion': 'Suggestion',
248
+ 'superscript': 'Superscript',
249
+ 'switches': 'Switches',
250
+ 'table': 'Table',
251
+ 'takes-package': 'Takes Package',
252
+ 'tasks': 'Tasks',
253
+ 'text': 'Text',
254
+ 'text-format': 'Text Format',
255
+ 'th': 'Table Header',
256
+ 'th-large': 'Table Header Large',
257
+ 'th-list': 'Table Header List',
258
+ 'time': 'Time',
259
+ 'to-lowercase': 'To Lowercase',
260
+ 'to-uppercase': 'To Uppercase',
261
+ 'trash': 'Trash',
262
+ 'twitter': 'Twitter',
263
+ 'twitter-circle': 'Twitter Circle',
264
+ 'underline': 'Underline',
265
+ 'undo': 'Undo',
266
+ 'unlocked': 'Unlocked',
267
+ 'unordered-list': 'Unordered List',
268
+ 'unspike': 'Unspike',
269
+ 'upload': 'Upload',
270
+ 'user': 'User',
271
+ 'video': 'Video',
272
+ 'warning-sign': 'Warning Sign',
273
+ 'zoom-in': 'Zoom In',
274
+ 'zoom-out': 'Zoom Out',
275
+ };
276
+ return iconFont.icon
277
+ .split(', ')
278
+ .sort()
279
+ .map(function (icon) { return ({
280
+ value: icon,
281
+ label: translatedIconNameMap[icon] ? translateFunction(translatedIconNameMap[icon]) : icon,
282
+ }); });
283
+ };
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { OverlayPanel } from '@superdesk/primereact/overlaypanel';
3
+ /**
4
+ * @ngdoc react
5
+ * @name SelectGrid
6
+ * @description searchable select component with grid view of items
7
+ */
8
+ export interface IItem {
9
+ value: string;
10
+ label: string;
11
+ [extra: string]: any;
12
+ }
13
+ interface IProps {
14
+ getItems(searchString: string | null): Promise<Array<IItem>>;
15
+ onChange(value: IItem): void;
16
+ itemTemplate: React.ComponentType<{
17
+ item: IItem | null;
18
+ }>;
19
+ triggerTemplate: React.ComponentType<any>;
20
+ label: string;
21
+ filterPlaceholder?: string;
22
+ }
23
+ interface IState {
24
+ items: Array<IItem>;
25
+ loading: boolean;
26
+ isOpen: boolean;
27
+ }
28
+ export declare class SelectGrid extends React.PureComponent<IProps, IState> {
29
+ htmlId: string;
30
+ buttonContainer: React.RefObject<HTMLDivElement>;
31
+ overlayPanel: React.RefObject<OverlayPanel>;
32
+ searchInput: React.RefObject<HTMLInputElement>;
33
+ gridContainer: React.RefObject<HTMLDivElement>;
34
+ constructor(props: IProps);
35
+ componentDidMount(): void;
36
+ componentWillUnmount(): void;
37
+ togglePopup: (event?: React.SyntheticEvent<Element, Event> | undefined) => void;
38
+ search: (event: React.ChangeEvent<HTMLInputElement>) => void;
39
+ loadItems: (searchString?: string | null) => void;
40
+ select: (item: IItem) => void;
41
+ getItemElement: (index: number) => HTMLDivElement | null | undefined;
42
+ handleKeydown: (event: KeyboardEvent) => void;
43
+ render(): JSX.Element;
44
+ }
45
+ export {};