superdesk-ui-framework 3.0.1-beta.9 → 3.0.1

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.
Files changed (160) hide show
  1. package/app/fonts/sd_icons.eot +0 -0
  2. package/app/fonts/sd_icons.svg +1 -0
  3. package/app/fonts/sd_icons.ttf +0 -0
  4. package/app/fonts/sd_icons.woff +0 -0
  5. package/app/scripts/toggleBoxNext.js +1 -1
  6. package/app/styles/_big-icon-font.scss +1 -1
  7. package/app/styles/_buttons.scss +11 -6
  8. package/app/styles/_content-divider.scss +63 -8
  9. package/app/styles/_helpers.scss +24 -1
  10. package/app/styles/_icon-font.scss +11 -10
  11. package/app/styles/_labels.scss +0 -1
  12. package/app/styles/_master-desk.scss +5 -4
  13. package/app/styles/_modals.scss +7 -3
  14. package/app/styles/_normalize.scss +4 -0
  15. package/app/styles/_sd-tag-input.scss +56 -2
  16. package/app/styles/_simple-list.scss +0 -2
  17. package/app/styles/_table-list.scss +116 -12
  18. package/app/styles/app.scss +3 -0
  19. package/app/styles/components/_list-item.scss +23 -16
  20. package/app/styles/components/_sd-collapse-box.scss +6 -6
  21. package/app/styles/components/_sd-comment-box.scss +8 -4
  22. package/app/styles/components/_sd-editor-popup.scss +4 -4
  23. package/app/styles/components/_sd-media-carousel.scss +37 -2
  24. package/app/styles/components/_sd-pagination.scss +41 -0
  25. package/app/styles/components/_sd-photo-preview.scss +2 -2
  26. package/app/styles/components/_subnav.scss +470 -470
  27. package/app/styles/design-tokens/_new-colors.scss +29 -12
  28. package/app/styles/dropdowns/_basic-dropdown.scss +6 -0
  29. package/app/styles/form-elements/_input-wrap.scss +138 -0
  30. package/app/styles/form-elements/_inputs.scss +230 -61
  31. package/app/styles/grids/_grid-layout.scss +13 -14
  32. package/app/styles/interface-elements/_side-panel.scss +1 -1
  33. package/app/styles/layout/_editor.scss +6 -0
  34. package/app/styles/menus/_sd-sidebar-menu.scss +1 -1
  35. package/app/styles/primereact/_pr-datepicker.scss +16 -2
  36. package/app/styles/primereact/_pr-dialog.scss +9 -0
  37. package/app/styles/primereact/_pr-menu.scss +6 -5
  38. package/app/styles/variables/_colors.scss +47 -47
  39. package/app/template/search-handler.html +2 -2
  40. package/app-typescript/components/ContentDivider.tsx +3 -0
  41. package/app-typescript/components/DatePicker.tsx +8 -9
  42. package/app-typescript/components/Dropdown.tsx +127 -82
  43. package/app-typescript/components/DurationInput.tsx +39 -14
  44. package/app-typescript/components/Form/FormLabel.tsx +8 -1
  45. package/app-typescript/components/Form/InputBase.tsx +12 -2
  46. package/app-typescript/components/Input.tsx +4 -4
  47. package/app-typescript/components/Label.tsx +17 -1
  48. package/app-typescript/components/Layouts/AuthoringFrame.tsx +2 -1
  49. package/app-typescript/components/Layouts/AuthoringFrameRightBar.tsx +21 -2
  50. package/app-typescript/components/Layouts/AuthoringInnerHeader.tsx +1 -1
  51. package/app-typescript/components/Layouts/AuthoringMain.tsx +4 -2
  52. package/app-typescript/components/Layouts/CoreLayout.tsx +3 -1
  53. package/app-typescript/components/Layouts/CoreLayoutMain.tsx +10 -1
  54. package/app-typescript/components/Lists/ContentList.tsx +64 -30
  55. package/app-typescript/components/Lists/TableList.tsx +255 -53
  56. package/app-typescript/components/Menu.tsx +2 -2
  57. package/app-typescript/components/Modal.tsx +6 -2
  58. package/app-typescript/components/MultiSelect.tsx +1 -1
  59. package/app-typescript/components/NavButton.tsx +2 -1
  60. package/app-typescript/components/Navigation/SideBarMenu.tsx +30 -4
  61. package/app-typescript/components/SearchBar.tsx +11 -3
  62. package/app-typescript/components/Spacer.tsx +87 -0
  63. package/app-typescript/components/TimePicker.tsx +2 -13
  64. package/app-typescript/components/TreeSelect.tsx +286 -180
  65. package/app-typescript/index.ts +1 -0
  66. package/dist/examples.bundle.css +110 -71
  67. package/dist/examples.bundle.js +23848 -21661
  68. package/dist/playgrounds/react-playgrounds/CoreLayout.tsx +505 -2
  69. package/dist/playgrounds/react-playgrounds/Index.tsx +1 -0
  70. package/dist/playgrounds/react-playgrounds/Multiedit.tsx +321 -0
  71. package/dist/playgrounds/react-playgrounds/RundownEditor.tsx +17 -19
  72. package/dist/playgrounds/react-playgrounds/Rundowns.tsx +22 -23
  73. package/dist/playgrounds/react-playgrounds/TestGround.tsx +226 -25
  74. package/dist/react/ContentDivider.tsx +22 -18
  75. package/dist/react/ContentList.tsx +188 -12
  76. package/dist/react/DatePicker.tsx +50 -2
  77. package/dist/react/Dropdowns.tsx +580 -48
  78. package/dist/react/DurationInput.tsx +7 -3
  79. package/dist/react/Inputs.tsx +1 -7
  80. package/dist/react/Modal.tsx +154 -22
  81. package/dist/react/MultiSelect.tsx +5 -5
  82. package/dist/react/NavButtons.tsx +31 -1
  83. package/dist/react/TableList.tsx +52 -139
  84. package/dist/react/Togglebox.tsx +1 -1
  85. package/dist/react/TreeSelect.tsx +167 -176
  86. package/dist/sd_icons.eot +0 -0
  87. package/dist/sd_icons.svg +1 -0
  88. package/dist/sd_icons.ttf +0 -0
  89. package/dist/sd_icons.woff +0 -0
  90. package/dist/superdesk-ui.bundle.css +1100 -407
  91. package/dist/superdesk-ui.bundle.js +6591 -4035
  92. package/dist/vendor.bundle.js +27 -27
  93. package/examples/css/docs-page.css +4 -4
  94. package/examples/index.js +4 -0
  95. package/examples/pages/playgrounds/react-playgrounds/CoreLayout.tsx +505 -2
  96. package/examples/pages/playgrounds/react-playgrounds/Index.tsx +1 -0
  97. package/examples/pages/playgrounds/react-playgrounds/Multiedit.tsx +321 -0
  98. package/examples/pages/playgrounds/react-playgrounds/RundownEditor.tsx +17 -19
  99. package/examples/pages/playgrounds/react-playgrounds/Rundowns.tsx +22 -23
  100. package/examples/pages/playgrounds/react-playgrounds/TestGround.tsx +226 -25
  101. package/examples/pages/react/ContentDivider.tsx +22 -18
  102. package/examples/pages/react/ContentList.tsx +188 -12
  103. package/examples/pages/react/DatePicker.tsx +50 -2
  104. package/examples/pages/react/Dropdowns.tsx +580 -48
  105. package/examples/pages/react/DurationInput.tsx +7 -3
  106. package/examples/pages/react/Inputs.tsx +1 -7
  107. package/examples/pages/react/Modal.tsx +154 -22
  108. package/examples/pages/react/MultiSelect.tsx +5 -5
  109. package/examples/pages/react/NavButtons.tsx +31 -1
  110. package/examples/pages/react/TableList.tsx +52 -139
  111. package/examples/pages/react/Togglebox.tsx +1 -1
  112. package/examples/pages/react/TreeSelect.tsx +167 -176
  113. package/package.json +3 -5
  114. package/react/components/ContentDivider.d.ts +1 -0
  115. package/react/components/ContentDivider.js +2 -0
  116. package/react/components/DatePicker.d.ts +2 -2
  117. package/react/components/DatePicker.js +3 -3
  118. package/react/components/Dropdown.d.ts +6 -5
  119. package/react/components/Dropdown.js +57 -30
  120. package/react/components/DurationInput.d.ts +1 -1
  121. package/react/components/DurationInput.js +46 -17
  122. package/react/components/Form/FormLabel.d.ts +4 -1
  123. package/react/components/Form/FormLabel.js +9 -3
  124. package/react/components/Form/InputBase.d.ts +0 -1
  125. package/react/components/Form/InputBase.js +15 -1
  126. package/react/components/Input.d.ts +3 -3
  127. package/react/components/Input.js +2 -1
  128. package/react/components/Label.d.ts +1 -0
  129. package/react/components/Label.js +17 -2
  130. package/react/components/Layouts/AuthoringFrame.d.ts +1 -0
  131. package/react/components/Layouts/AuthoringFrame.js +1 -1
  132. package/react/components/Layouts/AuthoringFrameRightBar.d.ts +9 -2
  133. package/react/components/Layouts/AuthoringFrameRightBar.js +14 -3
  134. package/react/components/Layouts/AuthoringInnerHeader.js +1 -1
  135. package/react/components/Layouts/AuthoringMain.js +1 -1
  136. package/react/components/Layouts/CoreLayout.d.ts +2 -0
  137. package/react/components/Layouts/CoreLayout.js +1 -1
  138. package/react/components/Layouts/CoreLayoutMain.d.ts +2 -0
  139. package/react/components/Layouts/CoreLayoutMain.js +8 -1
  140. package/react/components/Lists/ContentList.d.ts +6 -0
  141. package/react/components/Lists/ContentList.js +42 -16
  142. package/react/components/Lists/TableList.d.ts +30 -8
  143. package/react/components/Lists/TableList.js +127 -24
  144. package/react/components/Menu.js +1 -1
  145. package/react/components/Modal.d.ts +2 -0
  146. package/react/components/Modal.js +3 -3
  147. package/react/components/MultiSelect.d.ts +40 -0
  148. package/react/components/MultiSelect.js +70 -0
  149. package/react/components/NavButton.d.ts +1 -1
  150. package/react/components/Navigation/SideBarMenu.d.ts +6 -0
  151. package/react/components/Navigation/SideBarMenu.js +19 -2
  152. package/react/components/SearchBar.d.ts +1 -1
  153. package/react/components/SearchBar.js +15 -7
  154. package/react/components/TimePicker.d.ts +1 -5
  155. package/react/components/TimePicker.js +3 -7
  156. package/react/components/TreeSelect.d.ts +12 -5
  157. package/react/components/TreeSelect.js +189 -116
  158. package/react/index.d.ts +1 -0
  159. package/react/index.js +3 -0
  160. package/patches/@superdesk+primereact+5.0.2-4.patch +0 -66
@@ -10,70 +10,127 @@ interface IState {
10
10
  options: any;
11
11
  options2: any;
12
12
  inputValue: string;
13
+ arr: any;
13
14
  }
14
15
 
15
- let itemArr = [
16
+ let options = [
16
17
  {
17
- value: 'Category1',
18
+ value: {name: 'Category1'},
18
19
  children: [
19
20
  {
20
- value: 'Sub-Category1',
21
+ value: {name: 'Sub-category1'},
21
22
  children: [
22
- {value: 'Item10'}
23
+ {value: {name: 'Item20'}}
23
24
  ]
24
25
  },
25
26
  {
26
- value: 'Sub-Category2',
27
+ value: {name: 'Sub-category2'},
28
+ children: [
29
+ {value: {name: 'Item21'}}
30
+ ]
31
+ }
32
+ ,
33
+ {
34
+ value: {name: 'Sub-category3'},
35
+ children: [
36
+ {value: {name: 'Item22'}}
37
+ ]
38
+ }
39
+ ,
40
+ {
41
+ value: {name: 'Sub-category4'},
42
+ children: [
43
+ {value: {name: 'Item23'}}
44
+ ]
45
+ }
46
+ ,
47
+ {
48
+ value: {name: 'Sub-category5'},
27
49
  children: [
28
- {value: 'Item11'}
50
+ {value: {name: 'Item24'}}
51
+ ]
52
+ }
53
+ ,
54
+ {
55
+ value: {name: 'Sub-category6'},
56
+ children: [
57
+ {value: {name: 'Item25'}}
29
58
  ]
30
59
  }
31
60
  ]
32
61
  },
33
62
  {
34
- value: 'Category2',
63
+ value: {name: 'Category2'},
35
64
  children: [
36
65
  {
37
- value: 'Sub-Category3'
66
+ value: {name: 'Item8'}
38
67
  },
39
68
  {
40
- value: 'Sub-Category4'
69
+ value: {name: 'Item9'}
41
70
  }
42
71
  ]
43
72
  },
44
73
  {
45
- value: 'Category3',
74
+ value: {name: 'Category3', bgColor: 'red'},
46
75
  children: [
47
76
  {
48
- value: 'Sub-Category5'
77
+ value: {name: 'Item10'}
49
78
  },
50
79
  {
51
- value: 'Sub-Category6'
80
+ value: {name: 'Item11'}
52
81
  }
53
82
  ]
54
83
  },
55
84
  ]
56
85
 
57
- let itemArr2 = [
86
+ let options2 = [
58
87
  {
59
- value: {name: 'Category1'},
88
+ value: {name: 'Category1', border: 'red'},
60
89
  children: [
61
90
  {
62
91
  value: {name: 'Sub-category1'},
63
92
  children: [
64
- {value: {name: 'Item5'}}
93
+ {value: {name: 'Item20'}}
65
94
  ]
66
95
  },
67
96
  {
68
97
  value: {name: 'Sub-category2'},
69
98
  children: [
70
- {value: {name: 'Item7'}}
99
+ {value: {name: 'Item21'}}
100
+ ]
101
+ }
102
+ ,
103
+ {
104
+ value: {name: 'Sub-category3'},
105
+ children: [
106
+ {value: {name: 'Item22'}}
107
+ ]
108
+ }
109
+ ,
110
+ {
111
+ value: {name: 'Sub-category4'},
112
+ children: [
113
+ {value: {name: 'Item23'}}
114
+ ]
115
+ }
116
+ ,
117
+ {
118
+ value: {name: 'Sub-category5'},
119
+ children: [
120
+ {value: {name: 'Item24'}}
121
+ ]
122
+ }
123
+ ,
124
+ {
125
+ value: {name: 'Sub-category6'},
126
+ children: [
127
+ {value: {name: 'Item25'}}
71
128
  ]
72
129
  }
73
130
  ]
74
131
  },
75
132
  {
76
- value: {name: 'Category2'},
133
+ value: {name: 'Category2', border: 'green'},
77
134
  children: [
78
135
  {
79
136
  value: {name: 'Item8'}
@@ -84,7 +141,7 @@ let itemArr2 = [
84
141
  ]
85
142
  },
86
143
  {
87
- value: {name: 'Category3'},
144
+ value: {name: 'Category3', border: 'yellow'},
88
145
  children: [
89
146
  {
90
147
  value: {name: 'Item10'}
@@ -96,32 +153,28 @@ let itemArr2 = [
96
153
  },
97
154
  ]
98
155
 
99
- const source = [
100
- {
101
- 'name': 'Article (news)',
102
- 'qcode': 'Article',
103
- },
104
- {
105
- 'name': 'Sidebar',
106
- 'qcode': 'Sidebar',
107
- },
108
- {
109
- 'name': 'Factbox',
110
- 'qcode': 'Factbox',
111
- },
112
- ];
156
+ let fetchedArr = [];
157
+ fetch('https://nominatim.openstreetmap.org/search/berlin?format=json&addressdetails=1&limit=20').then(response => response.json()).then(data => fetchedArr = data
158
+ );
159
+
160
+ type ICancelFn = () => void;
113
161
 
114
162
  function searchOptions(
115
163
  term: string,
116
- callback: (res: Array<ITreeNode<{name: string; qcode: string;}>>) => void,
117
- ): void {
118
- setTimeout(() => {
164
+ callback: (res: any) => void,
165
+ ): ICancelFn {
166
+ let timeout = setTimeout(() => {
167
+
119
168
  callback(
120
- source
121
- .filter((item) => item.name.toLocaleLowerCase().includes(term.toLocaleLowerCase()))
169
+ fetchedArr
170
+ .filter((item: any) => item.display_name.toLocaleLowerCase().includes(term.toLocaleLowerCase()))
122
171
  .map((item) => ({value: item})),
123
- );
172
+ );
124
173
  }, 1000);
174
+
175
+ return () => {
176
+ clearTimeout(timeout);
177
+ }
125
178
  }
126
179
 
127
180
  export class TreeSelectDocs extends React.Component<{}, IState> {
@@ -130,10 +183,12 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
130
183
  this.state = {
131
184
  value: [],
132
185
  value2: [],
133
- options: itemArr2,
134
- options2: itemArr2,
135
- inputValue: ''
186
+ options: options,
187
+ options2: options,
188
+ inputValue: '',
189
+ arr: []
136
190
  }
191
+
137
192
 
138
193
  this.handleChange = this.handleChange.bind(this);
139
194
  }
@@ -146,13 +201,13 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
146
201
  this.setState({
147
202
  options: option.item
148
203
  })
149
- }
204
+ }
150
205
  }
151
206
 
152
207
  render() {
153
208
  return (
154
209
  <section className='docs-page__container'>
155
- <h2 className='docs-page__h2'>TreeSelect (in progress)</h2>
210
+ <h2 className='docs-page__h2'>TreeSelect</h2>
156
211
 
157
212
  <Markup.ReactMarkupCodePreview>{`
158
213
  <TreeSelect
@@ -170,20 +225,29 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
170
225
  <div className='docs-page__content-row docs-page__content-row--no-margin'>
171
226
  <div className='form__row'>
172
227
  <TreeSelect
228
+ value={[{name: 'Item1'}, {name: 'Item2'}]}
229
+ getOptions={() => options}
230
+ kind={'synchronous'}
173
231
  getId={(item) => item.name}
174
232
  getLabel={(item) => item.name}
175
- getOptions={() => itemArr2}
176
- value={[{name: 'Item1'}, {name: 'Item2'}]}
233
+ getBackgroundColor={(item: any) => item.bgColor}
177
234
  selectBranchWithChildren={true}
178
- onChange={(e) => console.log(e)}
179
235
  allowMultiple
180
- kind={'synchronous'}
181
236
  fullWidth
237
+ singleLevelSearch
238
+ required
182
239
  info={'Info Message'}
183
240
  error={'Error Message'}
184
- required
185
241
  label={'TreeSelect Label'}
186
-
242
+ searchPlaceholder='Search...'
243
+ onChange={(e) => false}
244
+ valueTemplate={(item, Wrapper) => {
245
+ return (
246
+ <Wrapper backgroundColor={item.bgColor}>
247
+ <span>{item.name}</span>
248
+ </Wrapper>
249
+ );
250
+ }}
187
251
  />
188
252
  </div>
189
253
  </div>
@@ -191,21 +255,29 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
191
255
 
192
256
  <Markup.ReactMarkupCode>{`
193
257
  <TreeSelect
258
+ value={[{name: 'Item1'}, {name: 'Item2'}]}
259
+ getOptions={() => options}
260
+ kind={'synchronous'}
194
261
  getId={(item) => item.name}
195
262
  getLabel={(item) => item.name}
196
- getOptions={() => {
197
- return itemArr2
198
- }}
199
- value={[{name: 'Item1'}, {name: 'Item2'}]}
263
+ getBackgroundColor={(item: any) => item.bgColor}
200
264
  selectBranchWithChildren={true}
201
- onChange={(e) => console.log(e)}
202
265
  allowMultiple
203
- kind={'synchronous'}
204
266
  fullWidth
267
+ singleLevelSearch
268
+ required
205
269
  info={'Info Message'}
206
270
  error={'Error Message'}
207
- required
208
271
  label={'TreeSelect Label'}
272
+ searchPlaceholder='Search...'
273
+ onChange={(e) => false}
274
+ valueTemplate={(item, Wrapper) => {
275
+ return (
276
+ <Wrapper backgroundColor={item.bgColor}>
277
+ <span>{item.name}</span>
278
+ </Wrapper>
279
+ );
280
+ }}
209
281
  />
210
282
  `}</Markup.ReactMarkupCode>
211
283
 
@@ -223,10 +295,10 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
223
295
  onChange={(val) => {
224
296
  this.setState({value: val});
225
297
  }}
226
- getLabel={({name}) => name}
227
- getId={({qcode}) => qcode}
298
+ getLabel={({display_name}) => display_name
299
+ }
300
+ getId={({qcode}) => qcode.display_name}
228
301
  selectBranchWithChildren={false}
229
- optionTemplate={(item) => <span style={{color: 'blue'}}>{item.name}</span>}
230
302
  allowMultiple={true}
231
303
  />
232
304
  </div>
@@ -257,17 +329,22 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
257
329
  <div className='docs-page__content-row docs-page__content-row--no-margin'>
258
330
  <div className='form__row'>
259
331
  <TreeSelect
332
+ getOptions={() => options2}
333
+ kind={'synchronous'}
260
334
  getId={(item) => item.name}
261
335
  getLabel={(item) => item.name}
336
+ getBackgroundColor={(item) => item.bgColor}
337
+ getBorderColor={(item) => item.border}
262
338
  placeholder='Select one'
263
- getOptions={() => this.state.options}
264
- kind={'synchronous'}
265
- onChange={(e) => console.log(e)}
339
+ selectBranchWithChildren={true}
340
+ onChange={(e) => false}
266
341
  optionTemplate={(item: any) => {
267
342
  return <div>Label: {item.name}</div>
268
343
  }}
269
- valueTemplate={(item: any) => {
270
- return <span>Label: {item.name}</span>
344
+ valueTemplate={(item: any, Wrapper) => {
345
+ return <Wrapper borderColor={item.border}>
346
+ <span>{item.name}</span>
347
+ </Wrapper>
271
348
  }}
272
349
  />
273
350
  </div>
@@ -276,17 +353,22 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
276
353
 
277
354
  <Markup.ReactMarkupCode>{`
278
355
  <TreeSelect
356
+ getOptions={() => options2}
357
+ kind={'synchronous'}
279
358
  getId={(item) => item.name}
280
359
  getLabel={(item) => item.name}
281
- value={[{name: 'Item4'}, {name: 'Item10'}]}
282
- getOptions={() => this.state.options}
283
- kind={'synchronous'}
284
- onChange={(e) => console.log(e)}
360
+ getBackgroundColor={(item) => item.bgColor}
361
+ getBorderColor={(item) => item.border}
362
+ placeholder='Select one'
363
+ selectBranchWithChildren={true}
364
+ onChange={(e) => false}
285
365
  optionTemplate={(item: any) => {
286
366
  return <div>Label: {item.name}</div>
287
367
  }}
288
- valueTemplate={(item: any) => {
289
- return <span>Label: {item.name}</span>
368
+ valueTemplate={(item: any, Wrapper) => {
369
+ return <Wrapper borderColor={item.border}>
370
+ <span>{item.name}</span>
371
+ </Wrapper>
290
372
  }}
291
373
  />
292
374
  `}</Markup.ReactMarkupCode>
@@ -302,12 +384,25 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
302
384
  <Prop name='selectBranchWithChildren' isRequired={false} type='boolean' default='false' description='When specified, select branch with children is enabled.'/>
303
385
  <Prop name='readonly' isRequired={false} type='boolean' default='false' description='When specified, component changes are not enabled.'/>
304
386
  <Prop name='loading' isRequired={false} type='boolean' default='false' description='Adds a loading indicator in dropdown.'/>
387
+ <Prop name='allowMultiple' isRequired={false} type='boolean' default='/' description='Enable multi-select mode.'/>
388
+ <Prop name='singleLevelSearch' isRequired={false} type='boolean' default='/' description='Limit search to only the level that is displayed.'/>
389
+ <Prop name='placeholder' isRequired={false} type='string' default='/' description='Placeholder of component in single select mode.'/>
390
+ <Prop name='searchPlaceholder' isRequired={false} type='string' default='/' description='Filter input placeholder.'/>
305
391
  <Prop name='getLabel' isRequired={true} type='Function' default='/' description='Callback to invoke when value changes.'/>
306
392
  <Prop name='getId' isRequired={true} type='Function' default='/' description='Callback to invoke when value changes.'/>
307
- <Prop name='valueTemplate' isRequired={false} type='Function' default='/' description='Function that gets an item in the value and returns the content for it.'/>
308
- <Prop name='optionTemplate' isRequired={false} type='Function' default='/' description='Function that gets the option and returns the content for it.'/>
393
+ <Prop name='getBackgroundColor' isRequired={true} type='Function' default='/' description='Function to return background color of individual item in options.'/>
394
+ <Prop name='getBorderColor' isRequired={true} type='Function' default='/' description='Function to return border color of individual item in options in single-select mode.'/>
395
+ <Prop name='valueTemplate' isRequired={false} type='Function(item, Wrapper)' default='/' description='Function that gets an item in the value and returns the content for it.'/>
396
+ <Prop name='optionTemplate' isRequired={false} type='Function(item)' default='/' description='Function that gets the option and returns the content for it.'/>
309
397
  <Prop name='searchOptions' isRequired={false} type='Function' default='/' description='The function will be called when a search is initiated from UI in asynchronous mode.'/>
310
398
  <Prop name='onChange' isRequired={true} type='Function' default='/' description='Callback to invoke when value changes.'/>
399
+ <Prop name='label' isRequired={false} type='string' default='/' description='Input label'/>
400
+ <Prop name='info' isRequired={false} type='string' default='/' description='Hint text'/>
401
+ <Prop name='error' isRequired={false} type='string' default='/' description='Error text'/>
402
+ <Prop name='inlineLabel' isRequired={false} type='boolean' default='false' description='Position labels as inline'/>
403
+ <Prop name='required' isRequired={false} type='boolean' default='false' description='Mark field as required'/>
404
+ <Prop name='disabled' isRequired={false} type='boolean' default='false' description='Mark field as disabled'/>
405
+ <Prop name='invalid' isRequired={false} type='boolean' default='false' description='Mark field as invalid'/>
311
406
  </PropsList>
312
407
 
313
408
  <p className='docs-page__paragraph'>synchronous:</p>
@@ -325,107 +420,3 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
325
420
  )
326
421
  }
327
422
  }
328
-
329
- // import React from 'react';
330
- // import {ITreeNode, TreeSelect} from './TreeSelect';
331
-
332
- // type IProps = {};
333
-
334
- // interface IVocabularyItem {
335
- // qcode: string;
336
- // name: string;
337
- // }
338
-
339
- // interface IState {
340
- // value: Array<IVocabularyItem>;
341
- // }
342
-
343
- // const source: Array<ITreeNode<IVocabularyItem>> = [
344
- // {
345
- // value: {
346
- // 'name': 'Article (news)',
347
- // 'qcode': 'Article',
348
- // },
349
- // children: [
350
- // {
351
- // value: {
352
- // 'name': 'Test 1',
353
- // 'qcode': 'test-1',
354
- // },
355
- // }
356
- // ],
357
- // },
358
- // {
359
- // value: {
360
- // 'name': 'Sidebar',
361
- // 'qcode': 'Sidebar',
362
- // },
363
- // children: [
364
- // {
365
- // value: {
366
- // 'name': 'Test 2',
367
- // 'qcode': 'test-2',
368
- // },
369
- // }
370
- // ],
371
- // },
372
- // {
373
- // value: {
374
- // 'name': 'Factbox',
375
- // 'qcode': 'Factbox',
376
- // },
377
- // children: [
378
- // {
379
- // value: {
380
- // 'name': 'Test 3',
381
- // 'qcode': 'test-3',
382
- // },
383
- // }
384
- // ],
385
- // }
386
- // ];
387
-
388
- // export class TreeSelectDocs extends React.PureComponent<IProps, IState> {
389
- // constructor(props: IProps) {
390
- // super(props);
391
- // this.state = {
392
- // value: [],
393
- // };
394
- // }
395
- // render() {
396
- // return (
397
- // // <TreeSelect
398
- // // kind="synchronous"
399
- // // getOptions={() => source}
400
- // // value={this.state.value}
401
- // // onChange={(val) => {
402
- // // this.setState({value: val});
403
- // // }}
404
- // // getId={(item) => item.name}
405
- // // getLabel={(item) => item.name}
406
- // // selectBranchWithChildren={false}
407
- // // optionTemplate={(item) => <span style={{color: 'blue'}}>{item.name}</span>}
408
- // // allowMultiple={true}
409
-
410
- // // />
411
-
412
- // <TreeSelect
413
- // getId={(item) => item.name}
414
- // getLabel={(item) => item.name}
415
- // getOptions={() => {
416
- // return source
417
- // }}
418
- // //value={[{name: 'Item1'}, {name: 'Item2'}]}
419
- // //selectBranchWithChildren={true}
420
- // onChange={(e) => console.log(e)}
421
- // allowMultiple
422
- // kind={'synchronous'}
423
- // fullWidth
424
- // info={'Info Message'}
425
- // error={'Error Message'}
426
- // required
427
- // label={'TreeSelect Label'}
428
- // />
429
- // );
430
- // }
431
- // }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superdesk-ui-framework",
3
- "version": "3.0.1-beta.9",
3
+ "version": "3.0.1",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,8 +23,7 @@
23
23
  "build-ui": "webpack && tsc && npm run lint",
24
24
  "lint": "eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}'",
25
25
  "lint-fix": "tsc -p tsconfig.json --noEmit && tslint --fix -c tslint.json 'app-typescript/**/*.{ts,tsx}'",
26
- "prepublishOnly": "npm run build",
27
- "postinstall": "patch-package"
26
+ "prepublishOnly": "npm run build"
28
27
  },
29
28
  "devDependencies": {
30
29
  "@types/chart.js": "^2.9.24",
@@ -61,7 +60,6 @@
61
60
  "jquery-ui": "^1.12.1",
62
61
  "lodash": "4.17.21",
63
62
  "node-sass": "6.0",
64
- "patch-package": "6.2.0",
65
63
  "prismjs": "^1.28.0",
66
64
  "prop-types": "^15.6.0",
67
65
  "react": "16.8.6",
@@ -86,7 +84,7 @@
86
84
  "dependencies": {
87
85
  "@material-ui/lab": "^4.0.0-alpha.56",
88
86
  "@popperjs/core": "^2.4.0",
89
- "@superdesk/primereact": "^5.0.2-4",
87
+ "@superdesk/primereact": "^5.0.2-6",
90
88
  "@types/node": "^14.10.2",
91
89
  "chart.js": "^2.9.3",
92
90
  "date-fns": "2.7.0",
@@ -4,6 +4,7 @@ interface IProps {
4
4
  orientation?: 'horizontal' | 'vertical';
5
5
  align?: 'center' | 'left' | 'right';
6
6
  border?: boolean;
7
+ margin?: 'x-small' | 'small' | 'medium' | 'large' | 'none';
7
8
  children?: React.ReactNode;
8
9
  }
9
10
  export declare class ContentDivider extends React.PureComponent<IProps> {
@@ -54,6 +54,8 @@ var ContentDivider = /** @class */ (function (_super) {
54
54
  _a["sd-content-divider--".concat(this.props.type)] = this.props.type || this.props.type !== undefined,
55
55
  _a["sd-content-divider--text-".concat(this.props.align)] = this.props.align || this.props.align !== undefined,
56
56
  _a["sd-content-divider--".concat(this.props.orientation)] = this.props.orientation || this.props.orientation !== undefined,
57
+ _a['sd-content-divider--margin-medium'] = this.props.margin === undefined,
58
+ _a["sd-content-divider--margin-".concat(this.props.margin)] = this.props.margin || this.props.margin !== undefined,
57
59
  _a));
58
60
  if (this.props.children) {
59
61
  return (React.createElement("div", { className: "sd-content-divider--with-text " + classes, role: "separator" },
@@ -2,13 +2,13 @@ import * as React from 'react';
2
2
  import { LocaleSettings, CalendarProps } from '@superdesk/primereact/calendar';
3
3
  export declare type DatePickerLocaleSettings = Omit<LocaleSettings, 'today' | 'clear'>;
4
4
  interface IDatePickerBase {
5
- disabled?: boolean;
6
5
  dateFormat: string;
7
- shortcuts?: Array<{
6
+ headerButtonBar?: Array<{
8
7
  days: number;
9
8
  label: string;
10
9
  }>;
11
10
  locale?: DatePickerLocaleSettings;
11
+ disabled?: boolean;
12
12
  inlineLabel?: boolean;
13
13
  required?: boolean;
14
14
  fullWidth?: boolean;
@@ -139,9 +139,9 @@ var DatePicker = /** @class */ (function (_super) {
139
139
  // updating internal state so a user can continue typing and enter a valid value
140
140
  _this.setState({ value: event.value, valid: false });
141
141
  }
142
- }, locale: locale, dateFormat: this.props.dateFormat.replace('YYYY', 'yy').replace('MM', 'mm').replace('DD', 'dd'), showIcon: true, icon: "icon-calendar", headerTemplate: function () { return _this.props.shortcuts == null ? null : (React.createElement("div", { style: { width: '100%', display: 'flex', justifyContent: 'space-between', marginBottom: 10 } }, _this.props.shortcuts.map(function (_a, i) {
142
+ }, locale: locale, dateFormat: this.props.dateFormat.replace('YYYY', 'yy').replace('MM', 'mm').replace('DD', 'dd'), showIcon: true, icon: "icon-calendar", headerTemplate: function () { return _this.props.headerButtonBar == null ? null : (React.createElement("div", { className: "datepicker-header-toolbar" }, _this.props.headerButtonBar.map(function (_a, i) {
143
143
  var label = _a.label, days = _a.days;
144
- return (React.createElement("button", { key: i, className: "btn btn--hollow btn--small", onClick: function () {
144
+ return (React.createElement("button", { key: i, className: "btn btn--small", onClick: function () {
145
145
  _this.props.onChange((0, addDays_1.default)(new Date(), days));
146
146
  if (_this.instance != null && typeof _this.instance.hideOverlay === 'function') {
147
147
  _this.instance.hideOverlay();
@@ -176,7 +176,7 @@ var DatePickerISO = /** @class */ (function (_super) {
176
176
  else {
177
177
  _this.props.onChange((0, format_1.default)(value, 'yyyy-MM-dd'));
178
178
  }
179
- }, disabled: this.props.disabled, shortcuts: this.props.shortcuts, dateFormat: this.props.dateFormat, locale: this.props.locale, inlineLabel: this.props.inlineLabel, required: this.props.required, fullWidth: this.props.fullWidth, invalid: this.props.invalid, labelHidden: this.props.labelHidden, tabindex: this.props.tabindex, label: this.props.label, info: this.props.info, error: this.props.error }));
179
+ }, disabled: this.props.disabled, headerButtonBar: this.props.headerButtonBar, dateFormat: this.props.dateFormat, locale: this.props.locale, inlineLabel: this.props.inlineLabel, required: this.props.required, fullWidth: this.props.fullWidth, invalid: this.props.invalid, labelHidden: this.props.labelHidden, tabindex: this.props.tabindex, label: this.props.label, info: this.props.info, error: this.props.error }));
180
180
  };
181
181
  return DatePickerISO;
182
182
  }(React.PureComponent));
@@ -1,29 +1,30 @@
1
1
  import * as React from 'react';
2
2
  export interface IMenuItem {
3
- label: string;
3
+ label: string | React.ReactNode;
4
4
  icon?: string;
5
5
  active?: boolean;
6
6
  onSelect(): void;
7
7
  }
8
8
  export interface ISubmenu {
9
9
  type: 'submenu';
10
- label: string;
10
+ label: string | React.ReactNode;
11
11
  icon?: string;
12
12
  items: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
13
13
  }
14
14
  export interface IMenuGroup {
15
15
  type: 'group';
16
- label?: string;
16
+ label?: string | React.ReactNode;
17
17
  items: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
18
18
  }
19
19
  interface IMenu {
20
- label?: string;
20
+ label?: string | React.ReactNode;
21
21
  align?: 'left' | 'right';
22
22
  items: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
23
23
  header?: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
24
24
  footer?: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
25
25
  append?: boolean;
26
26
  children: React.ReactNode;
27
+ onChange?(event?: any): void;
27
28
  }
28
- export declare const Dropdown: ({ items, header, footer, children, append, align, }: IMenu) => JSX.Element;
29
+ export declare const Dropdown: ({ items, header, footer, children, append, align, onChange, }: IMenu) => JSX.Element;
29
30
  export {};