@sis-cc/dotstatsuite-visions 10.24.1 → 10.26.0

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.
@@ -53,7 +53,7 @@ var useStyles = makeStyles(function (theme) {
53
53
  },
54
54
  selectionTitle: {
55
55
  fontSize: '12px',
56
- fontFamily: 'Helvetica Neue',
56
+ fontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif",
57
57
  fontWeight: '500',
58
58
  color: theme.palette.grey['A700']
59
59
  },
@@ -117,11 +117,13 @@ var useStyles = makeStyles(function (theme) {
117
117
  flexDirection: 'row-reverse',
118
118
  alignItems: 'center',
119
119
  '& p': {
120
+ paddingLeft: '5px',
120
121
  fontSize: '12px',
121
- fontFamily: 'Helvetica Neue',
122
+ fontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif",
122
123
  color: theme.palette.primary.main,
123
124
  fontWeight: '500',
124
- lineHeight: 1.43
125
+ lineHeight: 1.43,
126
+ textAlign: 'left'
125
127
  },
126
128
  '& img': {
127
129
  width: 21,
@@ -148,12 +150,21 @@ var useStyles = makeStyles(function (theme) {
148
150
  },
149
151
  tooltip: {
150
152
  backgroundColor: theme.palette.action.hover
153
+ },
154
+ subheader: {
155
+ display: 'flex',
156
+ flexDirection: 'column',
157
+ alignItems: 'flex-start',
158
+ justifyContent: 'space-between'
159
+ },
160
+ narrowHeader: {
161
+ alignItems: 'flex-start'
151
162
  }
152
163
  };
153
164
  });
154
165
 
155
166
  var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
156
- var _cx;
167
+ var _cx, _cx2, _cx3, _cx4;
157
168
 
158
169
  var id = props.id,
159
170
  title = props.title,
@@ -183,11 +194,7 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
183
194
  setSelection = _useState2[1];
184
195
 
185
196
  var classes = useStyles();
186
-
187
- var _useState3 = useState(0),
188
- height = _useState3[0],
189
- setHeight = _useState3[1];
190
-
197
+ // const [height, setHeight] = useState(0);
191
198
  var getTotal = function getTotal(items, spotlightAcc) {
192
199
  var itemsIds = R.pluck('id', items);
193
200
  var total = R.pipe(R.uniq, R.length)(itemsIds);
@@ -196,13 +203,13 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
196
203
  }
197
204
  return total;
198
205
  };
199
- var measureRef = React.useCallback(function (node) {
200
- if (node !== null) {
201
- setHeight(node.getBoundingClientRect().height * 75 / 100);
202
- }
203
- });
206
+ // const measureRef = React.useCallback(node => {
207
+ // if (node !== null) {
208
+ // setHeight((node.getBoundingClientRect().height * 75) / 100);
209
+ // }
210
+ // });
204
211
 
205
- var listHeight = height - 170;
212
+ // const listHeight = height - 170;
206
213
  var selectionItems = R.map(function (item) {
207
214
  return _extends({}, item, {
208
215
  isSelected: R.has(item.id, selection) ? !item.isSelected : !!item.isSelected
@@ -210,7 +217,7 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
210
217
  }, items);
211
218
  var indexedFilteredItems = R.indexBy(getHierarchicalId, selectionItems);
212
219
 
213
- var selectionOptions = [{
220
+ var selectionOptions = [[{
214
221
  value: 'single',
215
222
  label: R.prop('singleSelection', labels),
216
223
  img: singleImg
@@ -218,7 +225,7 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
218
225
  value: 'children',
219
226
  label: R.prop('childrenSelection', labels),
220
227
  img: childrenImg
221
- }, {
228
+ }], [{
222
229
  value: 'branch',
223
230
  label: R.prop('branchSelection', labels),
224
231
  img: branchImg
@@ -226,7 +233,7 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
226
233
  value: 'level',
227
234
  label: R.prop('levelSelection', labels),
228
235
  img: levelImg
229
- }];
236
+ }]];
230
237
 
231
238
  var _allGroupedItems = R.pipe(R.map(function (item) {
232
239
  return _extends({}, item, {
@@ -281,7 +288,6 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
281
288
  var nextSelection = R.reduce(function (acc, id) {
282
289
  return R.has(id, acc) ? acc : R.assoc(id, id, acc);
283
290
  }, {}, allIds);
284
- setSelectionMode('selectAll');
285
291
  setSelection(nextSelection);
286
292
  };
287
293
 
@@ -291,99 +297,118 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
291
297
  var nextSelection = R.reduce(function (acc, id) {
292
298
  return R.has(id, acc) ? acc : R.assoc(id, id, acc);
293
299
  }, {}, ids);
294
- setSelectionMode('deselectAll');
295
300
  setSelection(nextSelection);
296
301
  };
297
-
302
+ var mapIndexed = R.addIndex(R.map);
298
303
  return React.createElement(
299
304
  Dialog,
300
305
  {
301
306
  open: isOpen,
302
307
  PaperComponent: PaperComponent,
303
308
  'aria-labelledby': 'draggable-dialog-title',
304
- onClose: onClose,
305
- ref: measureRef,
306
- 'aria-modal': true
309
+ onClose: onClose
310
+ // ref={measureRef}
311
+ , 'aria-modal': true
307
312
  },
308
313
  React.createElement(
309
314
  DialogTitle,
310
315
  { style: { cursor: 'move' }, id: 'draggable-dialog-title' },
311
316
  React.createElement(
312
317
  'div',
313
- { className: classes.header },
318
+ { className: cx(classes.header, (_cx = {}, _cx[classes.narrowHeader] = isNarrow, _cx)) },
314
319
  React.createElement(
315
320
  'div',
316
- { className: classes.headerLabel, 'aria-label': title },
317
- '\xA0',
318
- title
319
- ),
320
- React.createElement(
321
- 'div',
322
- { className: classes.selectModeContainer },
321
+ { className: isNarrow ? classes.subheader : classes.header },
323
322
  React.createElement(
324
323
  'div',
325
- { className: classes.hint },
326
- React.createElement(
327
- Tooltip,
328
- {
329
- variant: 'light',
330
- title: React.createElement(
331
- Typography,
332
- { variant: 'body2' },
333
- R.prop('hint', labels)
334
- ),
335
- 'aria-label': R.prop('hint', labels),
336
- tabIndex: 0
337
- },
338
- React.createElement(HintIcon, null)
339
- ),
340
- React.createElement(
341
- Typography,
342
- {
343
- className: classes.selectionTitle,
344
- 'aria-label': R.prop('selectionMode', labels),
345
- tabIndex: 0
346
- },
347
- R.prop('selectionMode', labels)
348
- )
324
+ { className: classes.headerLabel, 'aria-label': title },
325
+ '\xA0',
326
+ title
349
327
  ),
350
- R.map(function (_ref) {
351
- var value = _ref.value,
352
- label = _ref.label,
353
- img = _ref.img;
354
- return React.createElement(
355
- Tooltip,
356
- {
357
- key: value,
358
- classes: { tooltip: classes.tooltip },
359
- title: React.createElement('img', { style: { width: '72px', height: '90px' }, src: img, alt: value }),
360
- tabIndex: -1
361
- },
328
+ React.createElement(
329
+ 'div',
330
+ { className: cx(classes.selectModeContainer, (_cx2 = {}, _cx2[classes.narrowHeader] = isNarrow, _cx2)) },
331
+ React.createElement(
332
+ 'div',
333
+ { className: classes.hint },
362
334
  React.createElement(
363
- Button,
335
+ Tooltip,
364
336
  {
365
- className: classes.selectButton,
366
- selected: value === selectionMode,
367
- onClick: function onClick() {
368
- setSelectionMode(value);
369
- },
370
- 'aria-pressed': value === selectionMode,
371
- 'aria-label': label,
372
- tabIndex: 0
373
- },
374
- React.createElement(
375
- Paper,
376
- { className: classes.selectModeItem, key: value },
377
- React.createElement(
337
+ variant: 'light',
338
+ title: React.createElement(
378
339
  Typography,
379
- null,
380
- label
340
+ { variant: 'body2' },
341
+ R.prop('hint', labels)
381
342
  ),
382
- !R.isNil(img) && R.is(String, img) && React.createElement('img', { src: img, alt: value })
383
- )
343
+ 'aria-label': R.prop('hint', labels),
344
+ tabIndex: 0
345
+ },
346
+ React.createElement(HintIcon, null)
347
+ ),
348
+ React.createElement(
349
+ Typography,
350
+ {
351
+ className: classes.selectionTitle,
352
+ 'aria-label': R.prop('selectionMode', labels),
353
+ tabIndex: 0
354
+ },
355
+ R.prop('selectionMode', labels)
384
356
  )
385
- );
386
- }, selectionOptions)
357
+ ),
358
+ React.createElement(
359
+ 'div',
360
+ {
361
+ className: cx(classes.selectModeContainer, (_cx3 = {}, _cx3[classes.narrowHeader] = isNarrow, _cx3))
362
+ },
363
+ mapIndexed(function (el, index) {
364
+ return React.createElement(
365
+ 'div',
366
+ { key: index },
367
+ R.map(function (_ref) {
368
+ var value = _ref.value,
369
+ label = _ref.label,
370
+ img = _ref.img;
371
+ return React.createElement(
372
+ Tooltip,
373
+ {
374
+ key: value,
375
+ classes: { tooltip: classes.tooltip },
376
+ title: React.createElement('img', {
377
+ style: { width: '72px', height: '90px' },
378
+ src: img,
379
+ alt: value
380
+ }),
381
+ tabIndex: -1
382
+ },
383
+ React.createElement(
384
+ Button,
385
+ {
386
+ className: classes.selectButton,
387
+ selected: value === selectionMode,
388
+ onClick: function onClick() {
389
+ setSelectionMode(value);
390
+ },
391
+ 'aria-pressed': value === selectionMode,
392
+ 'aria-label': label,
393
+ tabIndex: 0
394
+ },
395
+ React.createElement(
396
+ Paper,
397
+ { className: classes.selectModeItem, key: value },
398
+ React.createElement(
399
+ Typography,
400
+ null,
401
+ label
402
+ ),
403
+ !R.isNil(img) && R.is(String, img) && React.createElement('img', { src: img, alt: value })
404
+ )
405
+ )
406
+ );
407
+ }, el)
408
+ );
409
+ }, selectionOptions)
410
+ )
411
+ )
387
412
  ),
388
413
  React.createElement(
389
414
  'div',
@@ -408,7 +433,7 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
408
433
  { container: true },
409
434
  React.createElement(
410
435
  Grid,
411
- { item: true, xs: 12, className: cx(classes.topElements, (_cx = {}, _cx[classes.narrowTop] = isNarrow, _cx)) },
436
+ { item: true, xs: 12, className: cx(classes.topElements, (_cx4 = {}, _cx4[classes.narrowTop] = isNarrow, _cx4)) },
412
437
  React.createElement(
413
438
  'div',
414
439
  { className: isNarrow ? classes.narrowSpotlight : classes.spotlight },
@@ -423,26 +448,34 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
423
448
  ),
424
449
  React.createElement(
425
450
  'div',
426
- null,
451
+ { style: { display: 'flex', flexDirection: isNarrow ? 'column' : 'row' } },
427
452
  React.createElement(
428
- Button,
429
- { onClick: collapseAll, color: 'primary' },
430
- R.prop('colapseAll', labels)
431
- ),
432
- React.createElement(
433
- Button,
434
- { style: { marginLeft: 10 }, onClick: expandAll, color: 'primary' },
435
- R.prop('expandAll', labels)
436
- ),
437
- React.createElement(
438
- Button,
439
- { onClick: selectAll, color: 'primary' },
440
- R.prop('selectAll', labels)
453
+ 'div',
454
+ null,
455
+ React.createElement(
456
+ Button,
457
+ { onClick: collapseAll, color: 'primary' },
458
+ R.prop('colapseAll', labels)
459
+ ),
460
+ React.createElement(
461
+ Button,
462
+ { style: { marginLeft: 10 }, onClick: expandAll, color: 'primary' },
463
+ R.prop('expandAll', labels)
464
+ )
441
465
  ),
442
466
  React.createElement(
443
- Button,
444
- { style: { marginLeft: 10 }, onClick: deselectAll, color: 'primary' },
445
- R.prop('deselectAll', labels)
467
+ 'div',
468
+ null,
469
+ React.createElement(
470
+ Button,
471
+ { onClick: selectAll, color: 'primary' },
472
+ R.prop('selectAll', labels)
473
+ ),
474
+ React.createElement(
475
+ Button,
476
+ { style: { marginLeft: 10 }, onClick: deselectAll, color: 'primary' },
477
+ R.prop('deselectAll', labels)
478
+ )
446
479
  )
447
480
  ),
448
481
  React.createElement(Divider, { className: classes.divider })
@@ -458,7 +491,7 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
458
491
  items: selectionItems,
459
492
  changeSelection: onChangeSelection,
460
493
  withExpandControl: true,
461
- treeHeight: listHeight,
494
+ treeHeight: 0,
462
495
  scopeGetter: scopeGetter,
463
496
  expandedIds: expandedIds
464
497
  }))
@@ -0,0 +1,100 @@
1
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
+
3
+ import React from 'react';
4
+ import Grid from '@material-ui/core/Grid';
5
+ import PropTypes from 'prop-types';
6
+ import * as R from 'ramda';
7
+ import { makeStyles } from '@material-ui/core/styles';
8
+ import TextareaAutosize from '@material-ui/core/TextareaAutosize';
9
+ import Typography from '@material-ui/core/Typography';
10
+ import useMediaQuery from '@material-ui/core/useMediaQuery';
11
+ import { Button } from '../';
12
+ import { CircularProgress } from '@material-ui/core';
13
+
14
+ var useStyles = makeStyles(function (theme) {
15
+ return {
16
+ container: {
17
+ boxShadow: 'none',
18
+ width: '100%',
19
+ padding: 20
20
+ },
21
+ textarea: {
22
+ width: '100%',
23
+ margin: theme.spacing(0.5, 0, 0, 0)
24
+ },
25
+ title: _extends({
26
+ paddingBottom: 30
27
+ }, R.pathOr({}, ['mixins', 'share', 'title'], theme))
28
+ };
29
+ });
30
+
31
+ var ShortUrls = function ShortUrls(_ref) {
32
+ var labels = _ref.labels,
33
+ onClick = _ref.onClick,
34
+ isLoading = _ref.isLoading,
35
+ contentValue = _ref.contentValue;
36
+
37
+ var isNarrow = useMediaQuery(function (theme) {
38
+ return theme.breakpoints.down('sm');
39
+ });
40
+ var classes = useStyles();
41
+ return React.createElement(
42
+ Grid,
43
+ { className: classes.container },
44
+ React.createElement(
45
+ Typography,
46
+ { variant: 'h6', className: classes.title },
47
+ R.prop('title')(labels)
48
+ ),
49
+ React.createElement(
50
+ Grid,
51
+ {
52
+ container: true,
53
+ justifyContent: isNarrow ? 'center' : 'flex-start',
54
+ alignItems: isNarrow ? 'left' : 'center',
55
+ direction: isNarrow ? 'column-reverse' : 'row'
56
+ },
57
+ React.createElement(
58
+ Grid,
59
+ { item: true, xs: 12, sm: 12, md: 4, lg: 5 },
60
+ React.createElement(
61
+ Button,
62
+ {
63
+ 'aria-label': R.propOr('', 'generateUrl')(labels),
64
+ type: 'submit',
65
+ variant: 'contained',
66
+ color: 'primary',
67
+ disabled: isLoading || R.isNil(onClick),
68
+ alternative: 'siscc',
69
+ onClick: onClick,
70
+ className: classes.submitButton
71
+ },
72
+ isLoading ? React.createElement(CircularProgress, { size: 24 }) : R.propOr('', 'generateUrl')(labels)
73
+ )
74
+ ),
75
+ React.createElement(
76
+ Grid,
77
+ { item: true, xs: 12, sm: 12, md: 8, lg: 7 },
78
+ React.createElement(TextareaAutosize, {
79
+ 'aria-label': contentValue,
80
+ className: classes.textarea,
81
+ minRows: 2,
82
+ maxRows: 2,
83
+ readOnly: true,
84
+ value: contentValue
85
+ })
86
+ )
87
+ )
88
+ );
89
+ };
90
+ ShortUrls.propTypes = process.env.NODE_ENV !== "production" ? {
91
+ onClick: PropTypes.func,
92
+ isLoading: PropTypes.bool,
93
+ contentValue: PropTypes.string,
94
+ labels: PropTypes.shape({
95
+ generateUrl: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
96
+ title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
97
+ errorMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
98
+ })
99
+ } : {};
100
+ export default ShortUrls;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * ShortUrls, it's a component to shorten your large URL
3
+ *
4
+ * @memberOf VISIONS
5
+ * @name ShortUrls
6
+ * @tag component
7
+ * @api public
8
+ * @props
9
+ * ShortUrls.propTypes = {
10
+ * onClick: PropTypes.func,
11
+ * isLoading: PropTypes.bool,
12
+ * contentValue: PropTypes.string,
13
+ * labels: PropTypes.shape({
14
+ * generateUrl: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
15
+ * title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
16
+ * errorMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
17
+ * }),
18
+ * };
19
+ * @demoReady
20
+ */
21
+
22
+ export { default } from './ShortUrls';
package/es/index.js CHANGED
@@ -31,6 +31,7 @@ export { spotlightScopeListEngine, reduceChildren } from './utils';
31
31
  //export { default as ScopeList } from './ScopeList';
32
32
  export { default as Select } from './Select';
33
33
  export { default as Share } from './Share';
34
+ export { default as ShortUrls } from './ShortUrls';
34
35
  export { default as SisccFooter } from './SisccFooter';
35
36
  export { default as Spotlight } from './Spotlight';
36
37
  export { default as TableFooter } from './TableFooter';