@sis-cc/dotstatsuite-visions 6.6.0 → 6.6.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 (293) hide show
  1. package/es/Alert/Alert.js +135 -66
  2. package/es/Alert/index.js +1 -0
  3. package/es/ApiQueries/ApiQueries.js +79 -45
  4. package/es/ApiQueries/Query.js +105 -65
  5. package/es/ApiQueries/index.js +1 -0
  6. package/es/AuthDialog/index.js +103 -62
  7. package/es/Breadcrumbs/Breadcrumbs.js +38 -21
  8. package/es/Breadcrumbs/index.js +1 -0
  9. package/es/Button/Button.js +28 -11
  10. package/es/Button/index.js +1 -0
  11. package/es/ChartsConfig/Axis.js +76 -72
  12. package/es/ChartsConfig/ButtonGroup.js +51 -29
  13. package/es/ChartsConfig/ChartsConfig.js +187 -87
  14. package/es/ChartsConfig/ContainerTitle.js +36 -15
  15. package/es/ChartsConfig/Focus.js +48 -37
  16. package/es/ChartsConfig/Frequency.js +36 -24
  17. package/es/ChartsConfig/Series.js +43 -28
  18. package/es/ChartsConfig/Size.js +50 -36
  19. package/es/ChartsConfig/index.js +1 -0
  20. package/es/ChartsConfig/styles.js +4 -4
  21. package/es/ChartsConfig/utils.js +5 -1
  22. package/es/Chips/Chips.js +154 -99
  23. package/es/Chips/index.js +1 -0
  24. package/es/CollapseButtons/CollapseButtons.js +101 -61
  25. package/es/CollapseButtons/Item.js +70 -45
  26. package/es/CollapseButtons/Paper.js +21 -7
  27. package/es/CollapseButtons/index.js +1 -0
  28. package/es/DataEdit/DataEdit.js +124 -67
  29. package/es/DataEdit/Input.js +58 -27
  30. package/es/DataEdit/index.js +1 -0
  31. package/es/DataFooter/DataFooter.js +115 -68
  32. package/es/DataFooter/index.js +1 -0
  33. package/es/DataHeader/DataHeader.js +113 -75
  34. package/es/DataHeader/Flags.js +21 -8
  35. package/es/DataHeader/Title.js +15 -2
  36. package/es/DataHeader/TooltipHeader.js +63 -33
  37. package/es/DataHeader/index.js +1 -0
  38. package/es/DataHeader/utils.js +8 -8
  39. package/es/Dataflow/Dataflow.js +226 -132
  40. package/es/Dataflow/index.js +1 -0
  41. package/es/ExpansionPanel/ExpansionPanel.js +79 -42
  42. package/es/ExpansionPanel/index.js +1 -0
  43. package/es/ExpansionPanel/styles.js +5 -3
  44. package/es/Icons/AccessibilityFilled.js +8 -6
  45. package/es/Icons/AccessibilityOutlined.js +8 -6
  46. package/es/Icons/AccountFilled.js +8 -6
  47. package/es/Icons/AccountOutlined.js +8 -6
  48. package/es/Icons/Api.js +8 -6
  49. package/es/Icons/Asterisk.js +8 -6
  50. package/es/Icons/Bar.js +8 -6
  51. package/es/Icons/CopyContent.js +8 -6
  52. package/es/Icons/Cross.js +8 -6
  53. package/es/Icons/HSymbol.js +8 -6
  54. package/es/Icons/Row.js +8 -6
  55. package/es/Icons/Scatter.js +8 -6
  56. package/es/Icons/StackedBar.js +8 -6
  57. package/es/Icons/StackedRow.js +8 -6
  58. package/es/Icons/Timeline.js +8 -6
  59. package/es/Icons/VSymbol.js +8 -6
  60. package/es/Icons/Warning.js +14 -11
  61. package/es/Icons/index.js +1 -0
  62. package/es/Input/Input.js +56 -26
  63. package/es/Input/index.js +1 -0
  64. package/es/Input/with-input.js +25 -30
  65. package/es/InputNumber/InputNumber.js +51 -31
  66. package/es/InputNumber/index.js +1 -0
  67. package/es/LabelDivider/LabelDivider.js +18 -7
  68. package/es/LabelDivider/index.js +1 -0
  69. package/es/Loading/Loading.js +18 -9
  70. package/es/Loading/index.js +1 -0
  71. package/es/Logo/Logo.js +17 -11
  72. package/es/Logo/index.js +1 -0
  73. package/es/NoData/NoData.js +25 -17
  74. package/es/NoData/index.js +1 -0
  75. package/es/Pagination/Pagination.js +114 -70
  76. package/es/Pagination/index.js +1 -0
  77. package/es/PeriodPicker/PeriodPicker.js +124 -101
  78. package/es/PeriodPicker/constants.js +13 -78
  79. package/es/PeriodPicker/index.js +1 -0
  80. package/es/PeriodPicker/lib.js +23 -37
  81. package/es/PeriodPicker/styles.js +1 -0
  82. package/es/ScopeList/Header.js +60 -41
  83. package/es/ScopeList/Item.js +144 -98
  84. package/es/ScopeList/ScopeList.js +184 -132
  85. package/es/ScopeList/Selection.js +93 -51
  86. package/es/ScopeList/index.js +1 -0
  87. package/es/ScopeList/styles.js +3 -2
  88. package/es/ScopeList/with-scope-list.js +88 -151
  89. package/es/Select/Select.js +60 -44
  90. package/es/Select/index.js +1 -0
  91. package/es/Share/Form.js +88 -58
  92. package/es/Share/Mode.js +46 -30
  93. package/es/Share/Share.js +64 -41
  94. package/es/Share/index.js +1 -0
  95. package/es/SisccFooter/SisccFooter.js +36 -29
  96. package/es/SisccFooter/index.js +1 -0
  97. package/es/Spotlight/Fields.js +71 -37
  98. package/es/Spotlight/Spotlight.js +92 -51
  99. package/es/Spotlight/index.js +1 -0
  100. package/es/Spotlight/useSpotlight.js +13 -33
  101. package/es/Spotlight/useStyles.js +4 -2
  102. package/es/Table/Table.js +71 -50
  103. package/es/Table/header.js +50 -36
  104. package/es/Table/index.js +1 -0
  105. package/es/Table/itemCell.js +25 -13
  106. package/es/Table/row-header.js +50 -31
  107. package/es/Table/section-header.js +55 -30
  108. package/es/Table/section-rows.js +62 -38
  109. package/es/Table/styles.js +8 -2
  110. package/es/Table/tableCell.js +17 -7
  111. package/es/Table/tooltip.js +41 -21
  112. package/es/Table/useStyles.js +3 -2
  113. package/es/Table/valueCell.js +41 -26
  114. package/es/TableFooter/TableFooter.js +70 -42
  115. package/es/TableFooter/index.js +1 -0
  116. package/es/TableHeader/TableHeader.js +36 -18
  117. package/es/TableHeader/index.js +1 -0
  118. package/es/TableHtml5/TableHtml5.js +72 -60
  119. package/es/TableHtml5/cell.js +55 -35
  120. package/es/TableHtml5/flags.js +58 -29
  121. package/es/TableHtml5/header.js +67 -48
  122. package/es/TableHtml5/index.js +1 -0
  123. package/es/TableHtml5/section.js +121 -83
  124. package/es/TableHtml5/sectionHeader.js +72 -45
  125. package/es/TableHtml5/subHeader.js +63 -44
  126. package/es/TableLayout/Box.js +66 -33
  127. package/es/TableLayout/DnDItem.js +68 -37
  128. package/es/TableLayout/TableLayout.js +177 -105
  129. package/es/TableLayout/constants.js +2 -0
  130. package/es/TableLayout/index.js +1 -0
  131. package/es/TableLayout/lib.js +3 -1
  132. package/es/TablePreview/TablePreview.js +176 -99
  133. package/es/TablePreview/index.js +1 -0
  134. package/es/TablePreview/lib.js +4 -5
  135. package/es/TablePreview/styles.js +1 -0
  136. package/es/Tag/Tag.js +21 -5
  137. package/es/Tag/index.js +1 -0
  138. package/es/ToggleButton/ToggleButton.js +29 -17
  139. package/es/ToggleButton/index.js +1 -0
  140. package/es/Tooltip/Tooltip.js +32 -20
  141. package/es/Tooltip/index.js +1 -0
  142. package/es/VerticalButton/VerticalButton.js +22 -17
  143. package/es/VerticalButton/index.js +1 -0
  144. package/es/index.js +4 -2
  145. package/es/theme.js +14 -22
  146. package/es/utils.js +14 -16
  147. package/lib/Alert/Alert.js +168 -87
  148. package/lib/Alert/index.js +12 -7
  149. package/lib/ApiQueries/ApiQueries.js +105 -61
  150. package/lib/ApiQueries/Query.js +132 -85
  151. package/lib/ApiQueries/index.js +12 -7
  152. package/lib/AuthDialog/index.js +137 -82
  153. package/lib/Breadcrumbs/Breadcrumbs.js +68 -39
  154. package/lib/Breadcrumbs/index.js +12 -7
  155. package/lib/Button/Button.js +47 -28
  156. package/lib/Button/index.js +12 -7
  157. package/lib/ChartsConfig/Axis.js +100 -88
  158. package/lib/ChartsConfig/ButtonGroup.js +74 -43
  159. package/lib/ChartsConfig/ChartsConfig.js +236 -113
  160. package/lib/ChartsConfig/ContainerTitle.js +59 -30
  161. package/lib/ChartsConfig/Focus.js +71 -53
  162. package/lib/ChartsConfig/Frequency.js +59 -39
  163. package/lib/ChartsConfig/Series.js +70 -45
  164. package/lib/ChartsConfig/Size.js +77 -53
  165. package/lib/ChartsConfig/index.js +12 -7
  166. package/lib/ChartsConfig/styles.js +11 -16
  167. package/lib/ChartsConfig/utils.js +13 -14
  168. package/lib/Chips/Chips.js +192 -122
  169. package/lib/Chips/index.js +12 -7
  170. package/lib/CollapseButtons/CollapseButtons.js +134 -84
  171. package/lib/CollapseButtons/Item.js +98 -64
  172. package/lib/CollapseButtons/Paper.js +41 -19
  173. package/lib/CollapseButtons/index.js +12 -7
  174. package/lib/DataEdit/DataEdit.js +156 -88
  175. package/lib/DataEdit/Input.js +82 -42
  176. package/lib/DataEdit/index.js +12 -7
  177. package/lib/DataFooter/DataFooter.js +144 -88
  178. package/lib/DataFooter/index.js +12 -7
  179. package/lib/DataHeader/DataHeader.js +158 -106
  180. package/lib/DataHeader/Flags.js +34 -18
  181. package/lib/DataHeader/Title.js +27 -11
  182. package/lib/DataHeader/TooltipHeader.js +79 -48
  183. package/lib/DataHeader/index.js +12 -7
  184. package/lib/DataHeader/utils.js +10 -16
  185. package/lib/Dataflow/Dataflow.js +277 -159
  186. package/lib/Dataflow/index.js +12 -7
  187. package/lib/ExpansionPanel/ExpansionPanel.js +116 -63
  188. package/lib/ExpansionPanel/index.js +12 -7
  189. package/lib/ExpansionPanel/styles.js +12 -15
  190. package/lib/Icons/AccessibilityFilled.js +17 -15
  191. package/lib/Icons/AccessibilityOutlined.js +17 -15
  192. package/lib/Icons/AccountFilled.js +17 -15
  193. package/lib/Icons/AccountOutlined.js +17 -15
  194. package/lib/Icons/Api.js +17 -15
  195. package/lib/Icons/Asterisk.js +17 -15
  196. package/lib/Icons/Bar.js +17 -15
  197. package/lib/Icons/CopyContent.js +17 -15
  198. package/lib/Icons/Cross.js +17 -15
  199. package/lib/Icons/HSymbol.js +17 -15
  200. package/lib/Icons/Row.js +17 -15
  201. package/lib/Icons/Scatter.js +17 -15
  202. package/lib/Icons/StackedBar.js +17 -15
  203. package/lib/Icons/StackedRow.js +17 -15
  204. package/lib/Icons/Timeline.js +17 -15
  205. package/lib/Icons/VSymbol.js +17 -15
  206. package/lib/Icons/Warning.js +31 -27
  207. package/lib/Icons/index.js +152 -68
  208. package/lib/Input/Input.js +85 -47
  209. package/lib/Input/index.js +12 -7
  210. package/lib/Input/with-input.js +35 -38
  211. package/lib/InputNumber/InputNumber.js +80 -50
  212. package/lib/InputNumber/index.js +12 -7
  213. package/lib/LabelDivider/LabelDivider.js +37 -23
  214. package/lib/LabelDivider/index.js +12 -7
  215. package/lib/Loading/Loading.js +35 -20
  216. package/lib/Loading/index.js +12 -7
  217. package/lib/Logo/Logo.js +28 -20
  218. package/lib/Logo/index.js +12 -7
  219. package/lib/NoData/NoData.js +42 -28
  220. package/lib/NoData/index.js +12 -7
  221. package/lib/Pagination/Pagination.js +150 -91
  222. package/lib/Pagination/index.js +12 -7
  223. package/lib/PeriodPicker/PeriodPicker.js +150 -121
  224. package/lib/PeriodPicker/constants.js +37 -126
  225. package/lib/PeriodPicker/index.js +12 -7
  226. package/lib/PeriodPicker/lib.js +61 -99
  227. package/lib/PeriodPicker/styles.js +4 -7
  228. package/lib/ScopeList/Header.js +88 -58
  229. package/lib/ScopeList/Item.js +177 -116
  230. package/lib/ScopeList/ScopeList.js +234 -160
  231. package/lib/ScopeList/Selection.js +131 -70
  232. package/lib/ScopeList/index.js +12 -7
  233. package/lib/ScopeList/styles.js +9 -10
  234. package/lib/ScopeList/with-scope-list.js +108 -199
  235. package/lib/Select/Select.js +80 -59
  236. package/lib/Select/index.js +12 -7
  237. package/lib/Share/Form.js +119 -77
  238. package/lib/Share/Mode.js +78 -49
  239. package/lib/Share/Share.js +91 -59
  240. package/lib/Share/index.js +12 -7
  241. package/lib/SisccFooter/SisccFooter.js +63 -44
  242. package/lib/SisccFooter/index.js +12 -7
  243. package/lib/Spotlight/Fields.js +100 -54
  244. package/lib/Spotlight/Spotlight.js +136 -75
  245. package/lib/Spotlight/index.js +12 -7
  246. package/lib/Spotlight/useSpotlight.js +20 -44
  247. package/lib/Spotlight/useStyles.js +12 -15
  248. package/lib/Table/Table.js +102 -69
  249. package/lib/Table/header.js +70 -51
  250. package/lib/Table/index.js +12 -7
  251. package/lib/Table/itemCell.js +41 -25
  252. package/lib/Table/row-header.js +75 -49
  253. package/lib/Table/section-header.js +82 -50
  254. package/lib/Table/section-rows.js +94 -60
  255. package/lib/Table/styles.js +25 -23
  256. package/lib/Table/tableCell.js +37 -19
  257. package/lib/Table/tooltip.js +54 -36
  258. package/lib/Table/useStyles.js +8 -11
  259. package/lib/Table/valueCell.js +59 -39
  260. package/lib/TableFooter/TableFooter.js +93 -57
  261. package/lib/TableFooter/index.js +12 -7
  262. package/lib/TableHeader/TableHeader.js +56 -32
  263. package/lib/TableHeader/index.js +12 -7
  264. package/lib/TableHtml5/TableHtml5.js +100 -78
  265. package/lib/TableHtml5/cell.js +84 -52
  266. package/lib/TableHtml5/flags.js +82 -48
  267. package/lib/TableHtml5/header.js +97 -66
  268. package/lib/TableHtml5/index.js +17 -8
  269. package/lib/TableHtml5/section.js +163 -108
  270. package/lib/TableHtml5/sectionHeader.js +102 -64
  271. package/lib/TableHtml5/subHeader.js +93 -64
  272. package/lib/TableLayout/Box.js +97 -54
  273. package/lib/TableLayout/DnDItem.js +98 -58
  274. package/lib/TableLayout/TableLayout.js +232 -140
  275. package/lib/TableLayout/constants.js +6 -8
  276. package/lib/TableLayout/index.js +12 -7
  277. package/lib/TableLayout/lib.js +9 -14
  278. package/lib/TablePreview/TablePreview.js +205 -118
  279. package/lib/TablePreview/index.js +12 -7
  280. package/lib/TablePreview/lib.js +19 -30
  281. package/lib/TablePreview/styles.js +6 -7
  282. package/lib/Tag/Tag.js +38 -19
  283. package/lib/Tag/index.js +12 -7
  284. package/lib/ToggleButton/ToggleButton.js +55 -33
  285. package/lib/ToggleButton/index.js +12 -7
  286. package/lib/Tooltip/Tooltip.js +50 -34
  287. package/lib/Tooltip/index.js +12 -7
  288. package/lib/VerticalButton/VerticalButton.js +46 -40
  289. package/lib/VerticalButton/index.js +12 -7
  290. package/lib/index.js +304 -137
  291. package/lib/theme.js +17 -31
  292. package/lib/utils.js +31 -46
  293. package/package.json +10 -2
package/es/Chips/Chips.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import React, { Fragment } from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import * as R from 'ramda';
3
4
  import cx from 'classnames';
4
5
  import { makeStyles, useTheme } from '@material-ui/core/styles';
@@ -9,8 +10,8 @@ import Chip from '@material-ui/core/Chip';
9
10
  import Cross from '../Icons/Cross';
10
11
  import { getIsRtl, withBlank } from '../utils';
11
12
  import Tooltip from '../Tooltip';
12
- var shownTooltip = R.pipe(R.dropLast(1), R.either(R.isEmpty, R.isNil), R.not);
13
13
 
14
+ var shownTooltip = R.pipe(R.dropLast(1), R.either(R.isEmpty, R.isNil), R.not);
14
15
  var myTooltipRenderer = function myTooltipRenderer(_ref) {
15
16
  var isRtl = _ref.isRtl,
16
17
  labelRenderer = _ref.labelRenderer;
@@ -65,7 +66,7 @@ export var useStyles = makeStyles(function (theme) {
65
66
  fontSize: 10
66
67
  },
67
68
  tooltipIndicator: {
68
- borderBottom: "1px dotted " + theme.palette.primary.main
69
+ borderBottom: '1px dotted ' + theme.palette.primary.main
69
70
  }
70
71
  };
71
72
  });
@@ -76,7 +77,7 @@ var CustomChip = function CustomChip(_ref2) {
76
77
  var id = _ref2.id,
77
78
  parentId = _ref2.parentId,
78
79
  _ref2$items = _ref2.items,
79
- items = _ref2$items === void 0 ? [] : _ref2$items,
80
+ items = _ref2$items === undefined ? [] : _ref2$items,
80
81
  label = _ref2.label,
81
82
  onDelete = _ref2.onDelete,
82
83
  renderer = _ref2.renderer,
@@ -84,124 +85,178 @@ var CustomChip = function CustomChip(_ref2) {
84
85
  iconClasses = _ref2.iconClasses,
85
86
  labelClasses = _ref2.labelClasses,
86
87
  _ref2$ariaLabel = _ref2.ariaLabel,
87
- ariaLabel = _ref2$ariaLabel === void 0 ? 'delete' : _ref2$ariaLabel;
88
+ ariaLabel = _ref2$ariaLabel === undefined ? 'delete' : _ref2$ariaLabel;
89
+
88
90
  var classes = useStyles();
89
91
  var onChange = R.is(Function)(onDelete) ? function () {
90
92
  return onDelete(parentId, R.isNil(id) ? [] : [id]);
91
93
  } : null;
92
94
  var hasTooltip = shownTooltip(items);
93
- return /*#__PURE__*/React.createElement(Tooltip, {
94
- placement: "top",
95
- title: hasTooltip ? renderer(items) : ''
96
- }, /*#__PURE__*/React.createElement(Chip, {
97
- size: "small",
98
- "aria-label": label,
99
- label: hasTooltip ? /*#__PURE__*/React.createElement(Fragment, null, "...", /*#__PURE__*/React.createElement("span", {
100
- className: classes.childrenIndicator
101
- }, '>'), label) : label,
102
- deleteIcon: /*#__PURE__*/React.createElement(IconButton, {
103
- disableRipple: true,
104
- className: iconClasses,
105
- "aria-label": ariaLabel + " " + label,
106
- component: "span",
107
- tabIndex: -1
108
- }, /*#__PURE__*/React.createElement(Cross, null)),
109
- clickable: true,
110
- onDelete: onChange,
111
- className: cx(chipClasses, (_cx = {}, _cx[classes.tooltipIndicator] = hasTooltip, _cx)),
112
- classes: {
113
- label: labelClasses
114
- }
115
- }));
95
+
96
+ return React.createElement(
97
+ Tooltip,
98
+ { placement: 'top', title: hasTooltip ? renderer(items) : '' },
99
+ React.createElement(Chip, {
100
+ size: 'small',
101
+ 'aria-label': label,
102
+ label: hasTooltip ? React.createElement(
103
+ Fragment,
104
+ null,
105
+ '...',
106
+ React.createElement(
107
+ 'span',
108
+ { className: classes.childrenIndicator },
109
+ '>'
110
+ ),
111
+ label
112
+ ) : label,
113
+ deleteIcon: React.createElement(
114
+ IconButton,
115
+ {
116
+ disableRipple: true,
117
+ className: iconClasses,
118
+ 'aria-label': ariaLabel + ' ' + label,
119
+ component: 'span',
120
+ tabIndex: -1
121
+ },
122
+ React.createElement(Cross, null)
123
+ ),
124
+ clickable: true,
125
+ onDelete: onChange,
126
+ className: cx(chipClasses, (_cx = {}, _cx[classes.tooltipIndicator] = hasTooltip, _cx)),
127
+ classes: { label: labelClasses }
128
+ })
129
+ );
116
130
  };
117
131
 
132
+ CustomChip.propTypes = process.env.NODE_ENV !== "production" ? {
133
+ id: PropTypes.string,
134
+ parentId: PropTypes.string,
135
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
136
+ onDelete: PropTypes.func,
137
+ renderer: PropTypes.func,
138
+ chipClasses: PropTypes.string,
139
+ iconClasses: PropTypes.string,
140
+ labelClasses: PropTypes.string,
141
+ ariaLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
142
+ items: PropTypes.array
143
+ } : {};
144
+
118
145
  var Chips = function Chips(_ref3) {
119
146
  var _ref3$items = _ref3.items,
120
- items = _ref3$items === void 0 ? [] : _ref3$items,
147
+ items = _ref3$items === undefined ? [] : _ref3$items,
121
148
  onDelete = _ref3.onDelete,
122
149
  onDeleteAll = _ref3.onDeleteAll,
123
150
  clearAllLabel = _ref3.clearAllLabel,
124
151
  _ref3$labelRenderer = _ref3.labelRenderer,
125
- labelRenderer = _ref3$labelRenderer === void 0 ? R.prop('label') : _ref3$labelRenderer,
152
+ labelRenderer = _ref3$labelRenderer === undefined ? R.prop('label') : _ref3$labelRenderer,
126
153
  tooltipRenderer = _ref3.tooltipRenderer,
127
154
  ariaLabel = _ref3.ariaLabel,
128
155
  _ref3$reducingNbChips = _ref3.reducingNbChips,
129
- reducingNbChips = _ref3$reducingNbChips === void 0 ? 15 : _ref3$reducingNbChips,
156
+ reducingNbChips = _ref3$reducingNbChips === undefined ? 15 : _ref3$reducingNbChips,
130
157
  labels = _ref3.labels;
158
+
131
159
  var classes = useStyles();
132
160
  var theme = useTheme();
133
161
  var isRtl = getIsRtl(theme);
134
- return /*#__PURE__*/React.createElement("div", {
135
- "data-testid": "chips-test-id"
136
- }, R.map(function (itemProps) {
137
- var parentId = itemProps.id,
138
- isNotRemovable = itemProps.isNotRemovable,
139
- _itemProps$values = itemProps.values,
140
- values = _itemProps$values === void 0 ? [] : _itemProps$values;
141
- return /*#__PURE__*/React.createElement(Grid, {
142
- container: true,
143
- className: classes.root,
144
- key: parentId
145
- }, /*#__PURE__*/React.createElement(Grid, {
146
- item: true,
147
- xs: 12
148
- }, /*#__PURE__*/React.createElement(CustomChip, {
149
- parentId: parentId,
150
- label: labelRenderer(itemProps) + ":",
151
- ariaLabel: ariaLabel,
152
- chipClasses: cx(classes.mainChip, classes.chip),
153
- onDelete: isNotRemovable ? null : onDelete,
154
- iconClasses: classes.icon,
155
- labelClasses: cx(classes.spaceLabel, classes.formatLabel)
156
- }), R.pipe(R.length, R.flip(R.gt)(reducingNbChips))(values) ? /*#__PURE__*/React.createElement(CustomChip, {
157
- parentId: parentId,
158
- label: R.length(values) + " " + R.prop('reducingChip')(labels),
159
- chipClasses: cx(classes.secondaryChip, classes.chip),
160
- onDelete: isNotRemovable ? null : onDelete,
161
- iconClasses: classes.icon,
162
- labelClasses: cx(classes.formatLabel)
163
- }) : R.map(function (items) {
164
- var lastItem = R.last(items);
165
- var id = lastItem.id,
166
- isNotRemovable = lastItem.isNotRemovable;
167
- return /*#__PURE__*/React.createElement(CustomChip, {
168
- key: id,
169
- id: id,
170
- items: R.pipe(R.length, R.gte(2)) ? items : null,
171
- renderer: R.is(Function)(tooltipRenderer) ? tooltipRenderer : myTooltipRenderer({
172
- isRtl: isRtl,
173
- labelRenderer: labelRenderer
174
- }),
175
- label: labelRenderer(lastItem),
176
- ariaLabel: ariaLabel,
177
- parentId: parentId,
178
- onDelete: isNotRemovable ? null : onDelete,
179
- chipClasses: cx(classes.secondaryChip, classes.chip),
180
- iconClasses: classes.icon,
181
- labelClasses: cx(classes.formatLabel)
182
- });
183
- })(values), /*#__PURE__*/React.createElement(Divider, {
184
- className: classes.divider
185
- })));
186
- })(items), R.is(Function)(onDeleteAll) && /*#__PURE__*/React.createElement(Grid, {
187
- container: true,
188
- className: classes.root
189
- }, /*#__PURE__*/React.createElement(Grid, {
190
- item: true,
191
- xs: 12
192
- }, /*#__PURE__*/React.createElement(CustomChip, {
193
- label: clearAllLabel,
194
- ariaLabel: ariaLabel,
195
- chipClasses: cx(classes.mainChip, classes.chip),
196
- onDelete: onDeleteAll,
197
- iconClasses: classes.icon,
198
- labelClasses: cx(classes.spaceLabel, classes.formatLabel)
199
- }))));
162
+
163
+ return React.createElement(
164
+ 'div',
165
+ { 'data-testid': 'chips-test-id' },
166
+ R.map(function (itemProps) {
167
+ var parentId = itemProps.id,
168
+ isNotRemovable = itemProps.isNotRemovable,
169
+ _itemProps$values = itemProps.values,
170
+ values = _itemProps$values === undefined ? [] : _itemProps$values;
171
+
172
+ return React.createElement(
173
+ Grid,
174
+ { container: true, className: classes.root, key: parentId },
175
+ React.createElement(
176
+ Grid,
177
+ { item: true, xs: 12 },
178
+ React.createElement(CustomChip, {
179
+ parentId: parentId,
180
+ label: labelRenderer(itemProps) + ':',
181
+ ariaLabel: ariaLabel,
182
+ chipClasses: cx(classes.mainChip, classes.chip),
183
+ onDelete: isNotRemovable ? null : onDelete,
184
+ iconClasses: classes.icon,
185
+ labelClasses: cx(classes.spaceLabel, classes.formatLabel)
186
+ }),
187
+ R.pipe(R.length, R.flip(R.gt)(reducingNbChips))(values) ? React.createElement(CustomChip, {
188
+ parentId: parentId,
189
+ label: R.length(values) + ' ' + R.prop('reducingChip')(labels),
190
+ chipClasses: cx(classes.secondaryChip, classes.chip),
191
+ onDelete: isNotRemovable ? null : onDelete,
192
+ iconClasses: classes.icon,
193
+ labelClasses: cx(classes.formatLabel)
194
+ }) : R.map(function (items) {
195
+ var lastItem = R.last(items);
196
+ var id = lastItem.id,
197
+ isNotRemovable = lastItem.isNotRemovable;
198
+
199
+ return React.createElement(CustomChip, {
200
+ key: id,
201
+ id: id,
202
+ items: R.pipe(R.length, R.gte(2)) ? items : null,
203
+ renderer: R.is(Function)(tooltipRenderer) ? tooltipRenderer : myTooltipRenderer({ isRtl: isRtl, labelRenderer: labelRenderer }),
204
+ label: labelRenderer(lastItem),
205
+ ariaLabel: ariaLabel,
206
+ parentId: parentId,
207
+ onDelete: isNotRemovable ? null : onDelete,
208
+ chipClasses: cx(classes.secondaryChip, classes.chip),
209
+ iconClasses: classes.icon,
210
+ labelClasses: cx(classes.formatLabel)
211
+ });
212
+ })(values),
213
+ React.createElement(Divider, { className: classes.divider })
214
+ )
215
+ );
216
+ })(items),
217
+ R.is(Function)(onDeleteAll) && React.createElement(
218
+ Grid,
219
+ { container: true, className: classes.root },
220
+ React.createElement(
221
+ Grid,
222
+ { item: true, xs: 12 },
223
+ React.createElement(CustomChip, {
224
+ label: clearAllLabel,
225
+ ariaLabel: ariaLabel,
226
+ chipClasses: cx(classes.mainChip, classes.chip),
227
+ onDelete: onDeleteAll,
228
+ iconClasses: classes.icon,
229
+ labelClasses: cx(classes.spaceLabel, classes.formatLabel)
230
+ })
231
+ )
232
+ )
233
+ );
200
234
  };
201
235
 
236
+ Chips.propTypes = process.env.NODE_ENV !== "production" ? {
237
+ items: PropTypes.arrayOf(PropTypes.shape({
238
+ id: PropTypes.string,
239
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
240
+ isNotRemovable: PropTypes.bool,
241
+ values: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.shape({
242
+ id: PropTypes.string,
243
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
244
+ isNotRemovable: PropTypes.bool
245
+ })))
246
+ })),
247
+ clearAllLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
248
+ onDelete: PropTypes.func,
249
+ onDeleteAll: PropTypes.func,
250
+ labelRenderer: PropTypes.func,
251
+ tooltipRenderer: PropTypes.func,
252
+ ariaLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
253
+ reducingNbChips: PropTypes.number,
254
+ labels: PropTypes.shape({
255
+ reducingChip: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
256
+ })
257
+ } : {};
258
+
202
259
  export default withBlank(function (_ref4) {
203
260
  var isBlank = _ref4.isBlank;
204
- return {
205
- isBlank: isBlank
206
- };
261
+ return { isBlank: isBlank };
207
262
  })(Chips);
package/es/Chips/index.js CHANGED
@@ -56,4 +56,5 @@
56
56
  * }
57
57
  * // *tooltip indicator is the dotted line under a chip
58
58
  */
59
+
59
60
  export { default } from './Chips';
@@ -1,5 +1,7 @@
1
- import _extends from "/builds/sis-cc/.stat-suite/dotstatsuite-visions/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/extends";
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
+
2
3
  import React, { useState, useEffect } from 'react';
4
+ import PropTypes from 'prop-types';
3
5
  import * as R from 'ramda';
4
6
  import { makeStyles } from '@material-ui/core/styles';
5
7
  import useMediaQuery from '@material-ui/core/useMediaQuery';
@@ -8,8 +10,10 @@ import Collapse from '@material-ui/core/Collapse';
8
10
  import { ToggleButton } from '../';
9
11
  import Item from './Item';
10
12
  import Paper from './Paper';
13
+
11
14
  export var MAX_COLUMNS = 12;
12
15
  export var COLUMNS = [12, 12, 6, 4, 3, 3, 2, 2, 2, 2, 2, 2, 1];
16
+
13
17
  var useStyles = makeStyles(function () {
14
18
  return {
15
19
  collapseContainer: {
@@ -20,23 +24,25 @@ var useStyles = makeStyles(function () {
20
24
 
21
25
  var CollapseButtons = function CollapseButtons(props) {
22
26
  var _props$items = props.items,
23
- items = _props$items === void 0 ? [] : _props$items,
27
+ items = _props$items === undefined ? [] : _props$items,
24
28
  _props$action = props.action,
25
- action = _props$action === void 0 ? function () {} : _props$action,
29
+ action = _props$action === undefined ? function () {} : _props$action,
26
30
  _props$nbColumns = props.nbColumns,
27
- nbColumns = _props$nbColumns === void 0 ? 3 : _props$nbColumns,
31
+ nbColumns = _props$nbColumns === undefined ? 3 : _props$nbColumns,
28
32
  _props$testId = props.testId,
29
- testId = _props$testId === void 0 ? 'collapseButton' : _props$testId,
33
+ testId = _props$testId === undefined ? 'collapseButton' : _props$testId,
30
34
  isSecondLevelClikable = props.isSecondLevelClikable,
31
35
  _props$gridButtonsPro = props.gridButtonsProps,
32
- gridButtonsProps = _props$gridButtonsPro === void 0 ? {} : _props$gridButtonsPro,
36
+ gridButtonsProps = _props$gridButtonsPro === undefined ? {} : _props$gridButtonsPro,
33
37
  _props$breakpoint = props.breakpoint,
34
- breakpoint = _props$breakpoint === void 0 ? function (theme) {
38
+ breakpoint = _props$breakpoint === undefined ? function (theme) {
35
39
  return theme.breakpoints.down('sm');
36
40
  } : _props$breakpoint,
37
41
  justify = props.justify,
38
42
  _props$textTransform = props.textTransform,
39
- textTransform = _props$textTransform === void 0 ? 'none' : _props$textTransform;
43
+ textTransform = _props$textTransform === undefined ? 'none' : _props$textTransform;
44
+
45
+
40
46
  var classes = useStyles();
41
47
  var isMobileView = useMediaQuery(breakpoint);
42
48
 
@@ -53,9 +59,9 @@ var CollapseButtons = function CollapseButtons(props) {
53
59
 
54
60
  var getValues = function getValues(parentId) {
55
61
  return R.map(function (item) {
56
- return /*#__PURE__*/React.createElement(Item, {
62
+ return React.createElement(Item, {
57
63
  key: R.prop('id')(item),
58
- testId: testId + "_" + parentId + "_value_" + R.prop('id')(item),
64
+ testId: testId + '_' + parentId + '_value_' + R.prop('id')(item),
59
65
  parentId: parentId,
60
66
  item: item,
61
67
  action: action,
@@ -64,58 +70,92 @@ var CollapseButtons = function CollapseButtons(props) {
64
70
  });
65
71
  };
66
72
 
67
- return /*#__PURE__*/React.createElement(Grid, {
68
- container: true,
69
- spacing: 2,
70
- "data-testid": testId,
71
- justifyContent: justify
72
- }, R.map(function (_ref) {
73
- var id = _ref.id,
74
- label = _ref.label,
75
- _ref$values = _ref.values,
76
- values = _ref$values === void 0 ? [] : _ref$values;
77
- return /*#__PURE__*/React.createElement(Grid, _extends({
78
- item: true,
79
- xs: 12,
80
- sm: 12,
81
- md: R.nth(nbColumns)(COLUMNS)
82
- }, gridButtonsProps, {
83
- key: id
84
- }), /*#__PURE__*/React.createElement(ToggleButton, {
85
- textTransform: textTransform,
86
- label: label,
87
- tabindex: R.isNil(toggleId) || R.prop(id)(toggleId) || R.compose(R.not, R.head, R.values)(toggleId) ? 0 : -1,
88
- isOpen: R.prop(id)(toggleId),
89
- toggle: function toggle() {
90
- var _setIsOpen2;
73
+ return React.createElement(
74
+ Grid,
75
+ { container: true, spacing: 2, 'data-testid': testId, justifyContent: justify },
76
+ R.map(function (_ref) {
77
+ var id = _ref.id,
78
+ label = _ref.label,
79
+ _ref$values = _ref.values,
80
+ values = _ref$values === undefined ? [] : _ref$values;
81
+ return React.createElement(
82
+ Grid,
83
+ _extends({ item: true, xs: 12, sm: 12, md: R.nth(nbColumns)(COLUMNS) }, gridButtonsProps, { key: id }),
84
+ React.createElement(ToggleButton, {
85
+ textTransform: textTransform,
86
+ label: label,
87
+ tabindex: R.isNil(toggleId) || R.prop(id)(toggleId) || R.compose(R.not, R.head, R.values)(toggleId) ? 0 : -1,
88
+ isOpen: R.prop(id)(toggleId),
89
+ toggle: function toggle() {
90
+ var _setIsOpen2;
91
91
 
92
- return setIsOpen((_setIsOpen2 = {}, _setIsOpen2[id] = !R.prop(id)(toggleId), _setIsOpen2));
93
- },
94
- testId: testId + "_" + id,
95
- id: id
96
- }), isMobileView && /*#__PURE__*/React.createElement(Collapse, {
97
- in: R.prop(id)(toggleId),
98
- timeout: "auto",
99
- unmountOnExit: true,
100
- className: classes.collapseContainer
101
- }, /*#__PURE__*/React.createElement(Paper, {
102
- elevation: 10,
103
- isMobileView: isMobileView
104
- }, getValues(id)(values))));
105
- })(items), !isMobileView && R.map(function (_ref2) {
106
- var id = _ref2.id,
107
- _ref2$values = _ref2.values,
108
- values = _ref2$values === void 0 ? [] : _ref2$values;
109
- return /*#__PURE__*/React.createElement(Collapse, {
110
- in: R.prop(id)(toggleId),
111
- timeout: "auto",
112
- unmountOnExit: true,
113
- key: id,
114
- className: classes.collapseContainer
115
- }, /*#__PURE__*/React.createElement(Paper, {
116
- elevation: 10
117
- }, getValues(id)(values)));
118
- })(items));
92
+ return setIsOpen((_setIsOpen2 = {}, _setIsOpen2[id] = !R.prop(id)(toggleId), _setIsOpen2));
93
+ },
94
+ testId: testId + '_' + id,
95
+ id: id
96
+ }),
97
+ isMobileView && React.createElement(
98
+ Collapse,
99
+ {
100
+ 'in': R.prop(id)(toggleId),
101
+ timeout: 'auto',
102
+ unmountOnExit: true,
103
+ className: classes.collapseContainer
104
+ },
105
+ React.createElement(
106
+ Paper,
107
+ { elevation: 10, isMobileView: isMobileView },
108
+ getValues(id)(values)
109
+ )
110
+ )
111
+ );
112
+ })(items),
113
+ !isMobileView && R.map(function (_ref2) {
114
+ var id = _ref2.id,
115
+ _ref2$values = _ref2.values,
116
+ values = _ref2$values === undefined ? [] : _ref2$values;
117
+ return React.createElement(
118
+ Collapse,
119
+ {
120
+ 'in': R.prop(id)(toggleId),
121
+ timeout: 'auto',
122
+ unmountOnExit: true,
123
+ key: id,
124
+ className: classes.collapseContainer
125
+ },
126
+ React.createElement(
127
+ Paper,
128
+ { elevation: 10 },
129
+ getValues(id)(values)
130
+ )
131
+ );
132
+ })(items)
133
+ );
119
134
  };
120
135
 
136
+ CollapseButtons.propTypes = process.env.NODE_ENV !== "production" ? {
137
+ testId: PropTypes.string,
138
+ selectedItemId: PropTypes.string,
139
+ items: PropTypes.arrayOf(PropTypes.shape({
140
+ id: PropTypes.string.isRequired,
141
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
142
+ svgPath: PropTypes.string,
143
+ values: PropTypes.arrayOf(PropTypes.shape({
144
+ id: PropTypes.string.isRequired,
145
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
146
+ subtopics: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
147
+ id: PropTypes.string.isRequired,
148
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
149
+ }), PropTypes.string]))
150
+ }))
151
+ })),
152
+ action: PropTypes.func,
153
+ nbColumns: PropTypes.number,
154
+ isSecondLevelClikable: PropTypes.bool,
155
+ breakpoint: PropTypes.func,
156
+ gridButtonsProps: PropTypes.object,
157
+ justify: PropTypes.string,
158
+ textTransform: PropTypes.string
159
+ } : {};
160
+
121
161
  export default CollapseButtons;
@@ -1,11 +1,14 @@
1
- import _extends from "/builds/sis-cc/.stat-suite/dotstatsuite-visions/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/extends";
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
+
2
3
  import React from 'react';
4
+ import PropTypes from 'prop-types';
3
5
  import * as R from 'ramda';
4
6
  import Grid from '@material-ui/core/Grid';
5
7
  import Button from '@material-ui/core/Button';
6
8
  import Link from '@material-ui/core/Link';
7
9
  import { makeStyles } from '@material-ui/core/styles';
8
10
  import SvgIcon from '@material-ui/core/SvgIcon';
11
+
9
12
  var useStyles = makeStyles(function (theme) {
10
13
  return {
11
14
  paperItem: {
@@ -49,52 +52,74 @@ var Item = function Item(_ref) {
49
52
  action = _ref.action,
50
53
  testId = _ref.testId,
51
54
  isSecondLevelClikable = _ref.isSecondLevelClikable;
55
+
52
56
  var classes = useStyles();
53
- return /*#__PURE__*/React.createElement(Grid, {
54
- item: true,
55
- md: 4,
56
- xs: 12,
57
- className: classes.paperItem
58
- }, /*#__PURE__*/React.createElement(Button, {
59
- "aria-label": R.prop('label')(item),
60
- className: classes.button,
61
- fullWidth: true,
62
- "data-testid": testId,
63
- role: "link",
64
- onClick: function onClick() {
65
- if (R.not(R.is(Function)(action))) return;
66
- action(parentId, R.prop('id')(item));
67
- },
68
- tabIndex: 0
69
- }, /*#__PURE__*/React.createElement(SvgIcon, {
70
- className: classes.svg
71
- }, /*#__PURE__*/React.createElement("path", {
72
- d: R.prop('svgPath')(item)
73
- })), /*#__PURE__*/React.createElement(Grid, {
74
- container: true,
75
- item: true,
76
- xs: 12,
77
- direction: "column"
78
- }, /*#__PURE__*/React.createElement("span", {
79
- className: classes.itemTitle
80
- }, R.prop('label')(item)), /*#__PURE__*/React.createElement("span", {
81
- className: classes.itemSubtitle
82
- }, R.map(function (subtopic) {
83
- if (R.not(R.is(Object)(subtopic))) return subtopic;
84
- if (R.not(isSecondLevelClikable)) return R.prop('label')(subtopic);
85
- var id = R.prop('id')(subtopic);
86
- return /*#__PURE__*/React.createElement(Link, {
87
- key: id,
88
- className: classes.itemSubtitleLink,
89
- role: "link",
90
- onClick: function onClick(e) {
91
- if (R.not(R.is(Function)(action))) return;
92
- action(parentId, id);
93
- e.stopPropagation();
57
+
58
+ return React.createElement(
59
+ Grid,
60
+ { item: true, md: 4, xs: 12, className: classes.paperItem },
61
+ React.createElement(
62
+ Button,
63
+ {
64
+ 'aria-label': R.prop('label')(item),
65
+ className: classes.button,
66
+ fullWidth: true,
67
+ 'data-testid': testId,
68
+ role: 'link',
69
+ onClick: function onClick() {
70
+ if (R.not(R.is(Function)(action))) return;
71
+ action(parentId, R.prop('id')(item));
72
+ },
73
+ tabIndex: 0
94
74
  },
95
- tabIndex: 0
96
- }, R.prop('label')(subtopic));
97
- })(R.pipe(R.propOr([], 'subtopics'), R.intersperse(' • '))(item))))));
75
+ React.createElement(
76
+ SvgIcon,
77
+ { className: classes.svg },
78
+ React.createElement('path', { d: R.prop('svgPath')(item) })
79
+ ),
80
+ React.createElement(
81
+ Grid,
82
+ { container: true, item: true, xs: 12, direction: 'column' },
83
+ React.createElement(
84
+ 'span',
85
+ { className: classes.itemTitle },
86
+ R.prop('label')(item)
87
+ ),
88
+ React.createElement(
89
+ 'span',
90
+ { className: classes.itemSubtitle },
91
+ R.map(function (subtopic) {
92
+ if (R.not(R.is(Object)(subtopic))) return subtopic;
93
+ if (R.not(isSecondLevelClikable)) return R.prop('label')(subtopic);
94
+ var id = R.prop('id')(subtopic);
95
+ return React.createElement(
96
+ Link,
97
+ {
98
+ key: id,
99
+ className: classes.itemSubtitleLink,
100
+ role: 'link',
101
+ onClick: function onClick(e) {
102
+ if (R.not(R.is(Function)(action))) return;
103
+ action(parentId, id);
104
+ e.stopPropagation();
105
+ },
106
+ tabIndex: 0
107
+ },
108
+ R.prop('label')(subtopic)
109
+ );
110
+ })(R.pipe(R.propOr([], 'subtopics'), R.intersperse(' • '))(item))
111
+ )
112
+ )
113
+ )
114
+ );
98
115
  };
99
116
 
117
+ Item.propTypes = process.env.NODE_ENV !== "production" ? {
118
+ parentId: PropTypes.string,
119
+ testId: PropTypes.string,
120
+ item: PropTypes.object,
121
+ action: PropTypes.func,
122
+ isSecondLevelClikable: PropTypes.bool
123
+ } : {};
124
+
100
125
  export default Item;