@opengeoweb/shared 2.4.0 → 2.6.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.
Files changed (31) hide show
  1. package/index.esm.js +376 -106
  2. package/index.umd.js +404 -116
  3. package/lib/components/AlertBanner/AlertBanner.d.ts +1 -0
  4. package/lib/components/AlertIcon/AlertIcon.d.ts +8 -0
  5. package/lib/components/AlertIcon/index.d.ts +1 -0
  6. package/lib/components/ConfirmationDialog/ConfirmationDialog.stories.d.ts +10 -2
  7. package/lib/components/{Manager/EnableButton → EnableButton}/EnableButton.d.ts +0 -0
  8. package/lib/components/{Manager/EnableButton → EnableButton}/EnableButton.spec.d.ts +0 -0
  9. package/lib/components/{Manager/EnableButton → EnableButton}/EnableButton.stories.d.ts +0 -0
  10. package/lib/components/{Manager/EnableButton → EnableButton}/index.d.ts +0 -0
  11. package/lib/components/{Manager/ManagerButton → ManagerButton}/ManagerButton.d.ts +5 -0
  12. package/lib/components/{Manager/ManagerButton → ManagerButton}/ManagerButton.spec.d.ts +0 -0
  13. package/lib/components/{Manager/ManagerButton → ManagerButton}/ManagerButton.stories.d.ts +0 -0
  14. package/lib/components/{Manager/ManagerButton → ManagerButton}/index.d.ts +0 -0
  15. package/lib/components/{Manager/ManagerDeleteButton → ManagerDeleteButton}/ManagerDeleteButton.d.ts +0 -0
  16. package/lib/components/{Manager/ManagerDeleteButton → ManagerDeleteButton}/ManagerDeleteButton.spec.d.ts +0 -0
  17. package/lib/components/{Manager/ManagerDeleteButton → ManagerDeleteButton}/ManagerDeleteButton.stories.d.ts +0 -0
  18. package/lib/components/{Manager/ManagerDeleteButton → ManagerDeleteButton}/index.d.ts +0 -0
  19. package/lib/components/ToolContainer/ToolContainerDraggable.d.ts +1 -0
  20. package/lib/components/ToolContainer/types.d.ts +1 -0
  21. package/lib/components/TooltipSelect/TooltipSelect.d.ts +16 -0
  22. package/lib/components/TooltipSelect/TooltipSelect.spec.d.ts +1 -0
  23. package/lib/components/TooltipSelect/TooltipSelect.stories.d.ts +13 -0
  24. package/lib/components/TooltipSelect/index.d.ts +2 -0
  25. package/lib/components/TooltipSelect/tooltipContainerStyles.d.ts +2 -0
  26. package/lib/components/components.stories.d.ts +0 -1
  27. package/lib/components/index.d.ts +5 -1
  28. package/lib/hooks/useDraftFormHelpers/useDraftFormHelpers.d.ts +1 -1
  29. package/package.json +3 -3
  30. package/lib/components/Manager/index.d.ts +0 -4
  31. package/lib/components/Manager/styles.d.ts +0 -5
package/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('@mui/styles/makeStyles'), require('@mui/icons-material'), require('react-hook-form'), require('@opengeoweb/form-fields'), require('react-draggable'), require('re-resizable'), require('@opengeoweb/theme'), require('lodash'), require('@mui/styles/withStyles'), require('@mui/icons-material/MoreVert'), require('@mui/styles/createStyles')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', '@mui/styles/makeStyles', '@mui/icons-material', 'react-hook-form', '@opengeoweb/form-fields', 'react-draggable', 're-resizable', '@opengeoweb/theme', 'lodash', '@mui/styles/withStyles', '@mui/icons-material/MoreVert', '@mui/styles/createStyles'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Shared = {}, global.React, global.material, global.makeStyles, global.iconsMaterial, global.reactHookForm, global.formFields, global.Draggable, global.reResizable, global.theme, global.lodash, global.withStyles, global.MoreVertIcon, global.createStyles));
5
- })(this, (function (exports, React, material, makeStyles, iconsMaterial, reactHookForm, formFields, Draggable, reResizable, theme, lodash, withStyles, MoreVertIcon, createStyles) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('@mui/icons-material/Close'), require('react-hook-form'), require('@opengeoweb/form-fields'), require('@mui/styles/makeStyles'), require('react-draggable'), require('re-resizable'), require('@opengeoweb/theme'), require('@mui/icons-material'), require('lodash'), require('@mui/styles/withStyles'), require('@mui/icons-material/MoreVert'), require('@mui/styles/createStyles')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', '@mui/icons-material/Close', 'react-hook-form', '@opengeoweb/form-fields', '@mui/styles/makeStyles', 'react-draggable', 're-resizable', '@opengeoweb/theme', '@mui/icons-material', 'lodash', '@mui/styles/withStyles', '@mui/icons-material/MoreVert', '@mui/styles/createStyles'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Shared = {}, global.React, global.material, global.Close, global.reactHookForm, global.formFields, global.makeStyles, global.Draggable, global.reResizable, global.theme, global.iconsMaterial, global.lodash, global.withStyles, global.MoreVertIcon, global.createStyles));
5
+ })(this, (function (exports, React, material, Close, reactHookForm, formFields, makeStyles, Draggable, reResizable, theme, iconsMaterial, lodash, withStyles, MoreVertIcon, createStyles) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -26,6 +26,7 @@
26
26
 
27
27
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
28
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
29
+ var Close__default = /*#__PURE__*/_interopDefaultLegacy(Close);
29
30
  var makeStyles__default = /*#__PURE__*/_interopDefaultLegacy(makeStyles);
30
31
  var Draggable__default = /*#__PURE__*/_interopDefaultLegacy(Draggable);
31
32
  var withStyles__default = /*#__PURE__*/_interopDefaultLegacy(withStyles);
@@ -160,20 +161,6 @@
160
161
  }, content));
161
162
  };
162
163
 
163
- var useStyles$b = makeStyles__default["default"](function () {
164
- return {
165
- dialogHeader: {
166
- zIndex: 1,
167
- padding: '8px 20px',
168
- display: 'flex',
169
- justifyContent: 'space-between',
170
- alignItems: 'center'
171
- },
172
- dialogContent: {
173
- padding: '40px 20px 0px 20px !important'
174
- }
175
- };
176
- });
177
164
  var ConfirmationDialog = function ConfirmationDialog(_a) {
178
165
  var open = _a.open,
179
166
  title = _a.title,
@@ -189,8 +176,6 @@
189
176
  content = _e === void 0 ? null : _e,
190
177
  other = __rest(_a, ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content"]);
191
178
 
192
- var classes = useStyles$b();
193
-
194
179
  other.catchOnCancel;
195
180
  var rest = __rest(other, ["catchOnCancel"]); // remove unwanted props
196
181
 
@@ -198,14 +183,33 @@
198
183
  return /*#__PURE__*/React__namespace.createElement(material.Dialog, __assign({
199
184
  "data-testid": "confirmationDialog",
200
185
  open: open,
201
- maxWidth: "sm",
202
- fullWidth: true,
186
+ PaperProps: {
187
+ sx: {
188
+ width: '560px',
189
+ margin: 2.5
190
+ }
191
+ },
203
192
  // fix for briefly showing default options when closing dialog
204
193
  transitionDuration: 0
205
194
  }, rest), /*#__PURE__*/React__namespace.createElement(material.DialogTitle, {
206
- className: classes.dialogHeader
195
+ sx: {
196
+ zIndex: 1,
197
+ padding: 2,
198
+ display: 'flex',
199
+ justifyContent: 'space-between',
200
+ alignItems: 'center'
201
+ }
207
202
  }, /*#__PURE__*/React__namespace.createElement(material.Typography, {
208
- variant: "h5",
203
+ sx: {
204
+ fontSize: {
205
+ xs: '16px',
206
+ sm: '34px'
207
+ },
208
+ fontWeight: {
209
+ xs: 500,
210
+ sm: 400
211
+ }
212
+ },
209
213
  "data-testid": "confirmationDialog-title",
210
214
  component: "span"
211
215
  }, title), /*#__PURE__*/React__namespace.createElement(material.IconButton, {
@@ -215,23 +219,51 @@
215
219
  return onClose('CLOSED');
216
220
  },
217
221
  size: "small"
218
- }, /*#__PURE__*/React__namespace.createElement(iconsMaterial.Close, null))), /*#__PURE__*/React__namespace.createElement(material.DialogContent, {
219
- className: classes.dialogContent
222
+ }, /*#__PURE__*/React__namespace.createElement(Close__default["default"], null))), /*#__PURE__*/React__namespace.createElement(material.DialogContent, {
223
+ sx: {
224
+ padding: '8px 16px'
225
+ }
220
226
  }, /*#__PURE__*/React__namespace.createElement(material.Typography, {
221
227
  variant: "body1"
222
- }, description), content), /*#__PURE__*/React__namespace.createElement(material.DialogActions, null, /*#__PURE__*/React__namespace.createElement(material.Button, {
223
- "data-testid": "conformationDialog-cancel",
224
- color: "secondary",
225
- variant: "outlined",
228
+ }, description), content), /*#__PURE__*/React__namespace.createElement(material.DialogActions, {
229
+ sx: {
230
+ padding: 2,
231
+ flexDirection: {
232
+ xs: 'column',
233
+ sm: 'row'
234
+ }
235
+ }
236
+ }, /*#__PURE__*/React__namespace.createElement(material.Button, {
237
+ "data-testid": "confirmationDialog-cancel",
238
+ variant: "tertiary",
239
+ sx: {
240
+ width: {
241
+ xs: '100%',
242
+ sm: '150px'
243
+ }
244
+ },
226
245
  onClick: function onClick() {
227
246
  return onClose('CANCELLED');
228
247
  },
229
248
  autoFocus: true,
230
249
  disableRipple: true
231
250
  }, cancelLabel), /*#__PURE__*/React__namespace.createElement(material.Button, {
232
- "data-testid": "conformationDialog-confirm",
233
- color: "secondary",
234
- variant: "contained",
251
+ "data-testid": "confirmationDialog-confirm",
252
+ variant: "primary",
253
+ sx: {
254
+ width: {
255
+ xs: '100%',
256
+ sm: '150px'
257
+ },
258
+ marginLeft: {
259
+ xs: '0px!important',
260
+ sm: '8px!important'
261
+ },
262
+ marginTop: {
263
+ xs: 2,
264
+ sm: 0
265
+ }
266
+ },
235
267
  onClick: onSubmit
236
268
  }, confirmLabel)));
237
269
  };
@@ -370,12 +402,20 @@
370
402
  };
371
403
 
372
404
  var HIDDEN_INPUT_HELPER_IS_DRAFT = 'IS_DRAFT';
373
- var useDraftFormHelpers = function useDraftFormHelpers() {
405
+ var useDraftFormHelpers = function useDraftFormHelpers(isDefaultDraft) {
406
+ if (isDefaultDraft === void 0) {
407
+ isDefaultDraft = false;
408
+ }
409
+
374
410
  var _a = reactHookForm.useFormContext(),
375
411
  getValues = _a.getValues,
376
412
  setValue = _a.setValue,
377
413
  register = _a.register;
378
414
 
415
+ React__namespace.useEffect(function () {
416
+ setValue(HIDDEN_INPUT_HELPER_IS_DRAFT, isDefaultDraft); // eslint-disable-next-line react-hooks/exhaustive-deps
417
+ }, []);
418
+
379
419
  var isDraft = function isDraft() {
380
420
  return getValues(HIDDEN_INPUT_HELPER_IS_DRAFT) === true;
381
421
  };
@@ -393,9 +433,7 @@
393
433
  };
394
434
 
395
435
  var DraftFieldHelper = function DraftFieldHelper() {
396
- return /*#__PURE__*/React__namespace.createElement("input", __assign({
397
- defaultValue: "false"
398
- }, register(HIDDEN_INPUT_HELPER_IS_DRAFT), {
436
+ return /*#__PURE__*/React__namespace.createElement("input", __assign({}, register(HIDDEN_INPUT_HELPER_IS_DRAFT), {
399
437
  type: "hidden"
400
438
  }));
401
439
  };
@@ -502,24 +540,21 @@
502
540
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
503
541
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
504
542
  * */
505
- var useStyles$a = makeStyles__default["default"](function () {
506
- return {
507
- title: {
508
- fontSize: '14px',
509
- fontWeight: 'normal',
510
- marginTop: '0px!important',
511
- paddingTop: '0px!important'
512
- },
513
- info: {
514
- fontSize: '16px'
515
- }
516
- };
517
- });
518
543
 
519
- var getIcon = function getIcon(severity) {
544
+ var AlertIcon = function AlertIcon(_a) {
545
+ var _b = _a.severity,
546
+ severity = _b === void 0 ? 'error' : _b,
547
+ _c = _a.dataTestId,
548
+ dataTestId = _c === void 0 ? 'alert-icon' : _c;
549
+
520
550
  switch (severity) {
521
551
  case 'info':
522
- return /*#__PURE__*/React__namespace.createElement(material.SvgIcon, null, /*#__PURE__*/React__namespace.createElement("rect", {
552
+ return /*#__PURE__*/React__namespace.createElement(material.SvgIcon, {
553
+ sx: {
554
+ color: 'geowebColors.functional.notification'
555
+ },
556
+ "data-testid": dataTestId
557
+ }, /*#__PURE__*/React__namespace.createElement("rect", {
523
558
  width: 24,
524
559
  height: 24,
525
560
  fill: "transparent"
@@ -529,7 +564,12 @@
529
564
  }));
530
565
 
531
566
  case 'success':
532
- return /*#__PURE__*/React__namespace.createElement(material.SvgIcon, null, /*#__PURE__*/React__namespace.createElement("rect", {
567
+ return /*#__PURE__*/React__namespace.createElement(material.SvgIcon, {
568
+ sx: {
569
+ color: 'geowebColors.functional.success'
570
+ },
571
+ "data-testid": dataTestId
572
+ }, /*#__PURE__*/React__namespace.createElement("rect", {
533
573
  width: 24,
534
574
  height: 24,
535
575
  fill: "transparent"
@@ -539,7 +579,12 @@
539
579
  }));
540
580
 
541
581
  case 'warning':
542
- return /*#__PURE__*/React__namespace.createElement(material.SvgIcon, null, /*#__PURE__*/React__namespace.createElement("rect", {
582
+ return /*#__PURE__*/React__namespace.createElement(material.SvgIcon, {
583
+ sx: {
584
+ color: 'geowebColors.functional.warning'
585
+ },
586
+ "data-testid": dataTestId
587
+ }, /*#__PURE__*/React__namespace.createElement("rect", {
543
588
  width: 24,
544
589
  height: 24,
545
590
  fill: "transparent"
@@ -550,7 +595,12 @@
550
595
 
551
596
  case 'error':
552
597
  default:
553
- return /*#__PURE__*/React__namespace.createElement(material.SvgIcon, null, /*#__PURE__*/React__namespace.createElement("rect", {
598
+ return /*#__PURE__*/React__namespace.createElement(material.SvgIcon, {
599
+ sx: {
600
+ color: 'geowebColors.functional.error'
601
+ },
602
+ "data-testid": dataTestId
603
+ }, /*#__PURE__*/React__namespace.createElement("rect", {
554
604
  width: 24,
555
605
  height: 24,
556
606
  fill: "transparent"
@@ -570,12 +620,29 @@
570
620
  _d = _a.dataTestId,
571
621
  dataTestId = _d === void 0 ? 'alert-banner' : _d,
572
622
  _e = _a.isCompact,
573
- isCompact = _e === void 0 ? false : _e;
574
- var classes = useStyles$a();
575
- return /*#__PURE__*/React__namespace.createElement(material.Alert, {
623
+ isCompact = _e === void 0 ? false : _e,
624
+ _f = _a.shouldClose,
625
+ shouldClose = _f === void 0 ? false : _f;
626
+
627
+ var _g = __read(React__namespace.useState(true), 2),
628
+ isOpen = _g[0],
629
+ setIsOpen = _g[1];
630
+
631
+ return isOpen && /*#__PURE__*/React__namespace.createElement(material.Alert, {
576
632
  "data-testid": dataTestId,
577
633
  severity: severity,
578
- icon: getIcon(severity),
634
+ icon: /*#__PURE__*/React__namespace.createElement(AlertIcon, {
635
+ severity: severity
636
+ }),
637
+ action: shouldClose ? /*#__PURE__*/React__namespace.createElement(material.Button, {
638
+ variant: "flat",
639
+ onClick: function onClick() {
640
+ return setIsOpen(false);
641
+ },
642
+ sx: {
643
+ backgroundColor: 'transparent!important'
644
+ }
645
+ }, "CLOSE") : undefined,
579
646
  sx: isCompact ? {
580
647
  height: '32px',
581
648
  boxSizing: 'border-box',
@@ -592,11 +659,31 @@
592
659
  margin: '-3px 10px 0px 0px',
593
660
  padding: '0px'
594
661
  }
595
- } : {}
662
+ } : {
663
+ padding: '3px 16px',
664
+ '& .MuiAlert-message': {
665
+ padding: '8px 0'
666
+ },
667
+ '& .MuiAlert-icon': {
668
+ padding: '8px 0'
669
+ },
670
+ '& .MuiAlert-action': {
671
+ padding: 0
672
+ }
673
+ }
596
674
  }, /*#__PURE__*/React__namespace.createElement(material.AlertTitle, {
597
- className: classes.title
598
- }, title), info && /*#__PURE__*/React__namespace.createElement("div", {
599
- className: classes.info
675
+ sx: {
676
+ fontSize: '14px',
677
+ fontWeight: 'normal',
678
+ marginTop: '0px!important',
679
+ paddingTop: '0px!important',
680
+ marginBottom: '0px!important'
681
+ }
682
+ }, title), info && /*#__PURE__*/React__namespace.createElement(material.Box, {
683
+ sx: {
684
+ fontSize: '16px',
685
+ marginTop: 1
686
+ }
600
687
  }, info));
601
688
  };
602
689
 
@@ -616,7 +703,7 @@
616
703
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
617
704
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
618
705
  * */
619
- var useStyles$9 = makeStyles__default["default"](function () {
706
+ var useStyles$8 = makeStyles__default["default"](function () {
620
707
  return {
621
708
  wrapper: {
622
709
  height: '100vh',
@@ -633,7 +720,7 @@
633
720
  var AppLayout = function AppLayout(_a) {
634
721
  var header = _a.header,
635
722
  children = _a.children;
636
- var classes = useStyles$9();
723
+ var classes = useStyles$8();
637
724
  return /*#__PURE__*/React__default["default"].createElement("div", {
638
725
  className: classes.wrapper
639
726
  }, header, /*#__PURE__*/React__default["default"].createElement("main", {
@@ -659,7 +746,7 @@
659
746
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
660
747
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
661
748
  * */
662
- var useStyles$8 = makeStyles__default["default"](function (theme) {
749
+ var useStyles$7 = makeStyles__default["default"](function (theme) {
663
750
  var _a;
664
751
 
665
752
  return {
@@ -696,7 +783,7 @@
696
783
  userMenu = _a.userMenu,
697
784
  _b = _a.title,
698
785
  title = _b === void 0 ? 'GeoWeb' : _b;
699
- var classes = useStyles$8();
786
+ var classes = useStyles$7();
700
787
  return /*#__PURE__*/React__default["default"].createElement("header", {
701
788
  className: classes.header
702
789
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
@@ -970,7 +1057,7 @@
970
1057
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
971
1058
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
972
1059
  * */
973
- var useStyles$7 = makeStyles__default["default"](function (theme) {
1060
+ var useStyles$6 = makeStyles__default["default"](function (theme) {
974
1061
  return {
975
1062
  container: {
976
1063
  position: 'absolute',
@@ -1018,7 +1105,7 @@
1018
1105
  } : _d,
1019
1106
  children = _a.children,
1020
1107
  initials = _a.initials;
1021
- var classes = useStyles$7();
1108
+ var classes = useStyles$6();
1022
1109
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
1023
1110
  "data-testid": "userButton",
1024
1111
  onClick: onToggle,
@@ -1101,7 +1188,7 @@
1101
1188
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1102
1189
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1103
1190
  * */
1104
- var useStyles$6 = makeStyles__default["default"](function (theme) {
1191
+ var useStyles$5 = makeStyles__default["default"](function (theme) {
1105
1192
  return {
1106
1193
  footer: {
1107
1194
  boxShadow: theme.shadows[1],
@@ -1114,7 +1201,7 @@
1114
1201
  }); // drag handles will be handled by DraggableResizable/Resizable
1115
1202
 
1116
1203
  var ToolFooter = function ToolFooter() {
1117
- var classes = useStyles$6();
1204
+ var classes = useStyles$5();
1118
1205
  return /*#__PURE__*/React__default["default"].createElement("footer", {
1119
1206
  className: classes.footer
1120
1207
  });
@@ -1197,13 +1284,17 @@
1197
1284
  _c = _a.isDraggable,
1198
1285
  isDraggable = _c === void 0 ? false : _c,
1199
1286
  _d = _a.className,
1200
- className = _d === void 0 ? '' : _d;
1287
+ className = _d === void 0 ? '' : _d,
1288
+ _e = _a.leftComponent,
1289
+ leftComponent = _e === void 0 ? null : _e;
1201
1290
  var styles = getStyle(size);
1202
1291
 
1203
1292
  var onClickClose = function onClickClose() {
1204
1293
  return onClose();
1205
1294
  };
1206
1295
 
1296
+ var columnSizeIcon = leftComponent ? 3 : 1;
1297
+ var columnSizeTitle = leftComponent ? 6 : 10;
1207
1298
  return /*#__PURE__*/React__default["default"].createElement(material.Box, {
1208
1299
  component: "header",
1209
1300
  className: className,
@@ -1219,26 +1310,27 @@
1219
1310
  alignItems: "center"
1220
1311
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1221
1312
  item: true,
1222
- xs: 1
1223
- }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1313
+ xs: columnSizeIcon
1314
+ }, isDraggable && size !== 'xxs' && !leftComponent && /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1224
1315
  container: true,
1225
1316
  justifyContent: "flex-start"
1226
- }, isDraggable && size !== 'xxs' && /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
1317
+ }, /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
1227
1318
  "data-testid": "dragBtn",
1228
1319
  disableRipple: true,
1229
1320
  size: "large",
1230
1321
  sx: __assign(__assign({}, iconStyle), {
1231
1322
  pointerEvents: 'none'
1232
1323
  })
1233
- }, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.DragIndicator, null)))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1324
+ }, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.DragIndicator, null))), leftComponent && leftComponent), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1234
1325
  item: true,
1235
- xs: 10
1326
+ xs: columnSizeTitle
1236
1327
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1237
1328
  container: true,
1238
1329
  justifyContent: "center",
1239
1330
  alignItems: "center"
1240
1331
  }, title && /*#__PURE__*/React__default["default"].createElement(material.Typography, {
1241
1332
  variant: "h2",
1333
+ noWrap: true,
1242
1334
  sx: {
1243
1335
  fontSize: styles.fontSize,
1244
1336
  fontWeight: styles.fontWeight
@@ -1254,7 +1346,7 @@
1254
1346
  })
1255
1347
  }, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.DragIndicator, null)))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1256
1348
  item: true,
1257
- xs: 1,
1349
+ xs: columnSizeIcon,
1258
1350
  container: true,
1259
1351
  justifyContent: "flex-end"
1260
1352
  }, onClose && /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
@@ -1281,22 +1373,20 @@
1281
1373
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1282
1374
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1283
1375
  * */
1284
- var useStyles$5 = makeStyles__default["default"](function () {
1285
- return {
1286
- container: {
1287
- overflow: 'hidden',
1288
- borderRadius: 0,
1289
- display: 'flex',
1290
- flexDirection: 'column',
1291
- height: '100%'
1292
- },
1293
- content: {
1294
- flex: 1,
1295
- overflowY: 'auto',
1296
- position: 'relative'
1297
- }
1298
- };
1299
- });
1376
+ var styles$1 = {
1377
+ container: {
1378
+ overflow: 'hidden',
1379
+ borderRadius: 0,
1380
+ display: 'flex',
1381
+ flexDirection: 'column',
1382
+ height: '100%'
1383
+ },
1384
+ content: {
1385
+ flex: 1,
1386
+ overflowY: 'auto',
1387
+ position: 'relative'
1388
+ }
1389
+ };
1300
1390
  var BASE_ELEVATION = 5;
1301
1391
 
1302
1392
  var ToolContainer = function ToolContainer(_a) {
@@ -1318,20 +1408,22 @@
1318
1408
  _h = _a.headerClassName,
1319
1409
  // elevation_06
1320
1410
  headerClassName = _h === void 0 ? '' : _h,
1321
- props = __rest(_a, ["title", "size", "children", "onClose", "isResizable", "isDraggable", "maxHeight", "elevation", "headerClassName"]);
1411
+ _j = _a.leftComponent,
1412
+ leftComponent = _j === void 0 ? null : _j,
1413
+ props = __rest(_a, ["title", "size", "children", "onClose", "isResizable", "isDraggable", "maxHeight", "elevation", "headerClassName", "leftComponent"]);
1322
1414
 
1323
- var classes = useStyles$5();
1324
1415
  return /*#__PURE__*/React__default["default"].createElement(material.Paper, __assign({
1325
1416
  elevation: elevation,
1326
- className: classes.container
1417
+ sx: styles$1.container
1327
1418
  }, props), /*#__PURE__*/React__default["default"].createElement(ToolHeader, {
1328
1419
  title: title,
1329
1420
  size: size,
1330
1421
  isDraggable: isDraggable,
1331
1422
  onClose: onClose,
1332
- className: headerClassName
1333
- }), /*#__PURE__*/React__default["default"].createElement("div", {
1334
- className: classes.content,
1423
+ className: headerClassName,
1424
+ leftComponent: leftComponent
1425
+ }), /*#__PURE__*/React__default["default"].createElement(material.Box, {
1426
+ sx: styles$1.content,
1335
1427
  style: {
1336
1428
  maxHeight: maxHeight
1337
1429
  }
@@ -1407,30 +1499,32 @@
1407
1499
  order = _l === void 0 ? 1 : _l,
1408
1500
  _m = _a.source,
1409
1501
  source = _m === void 0 ? 'app' : _m,
1410
- props = __rest(_a, ["title", "bounds", "headerSize", "startSize", "startPosition", "children", "isOpen", "onClose", "initialMaxHeight", "onChangeSize", "onMouseDown", "order", "source"]);
1502
+ _o = _a.leftComponent,
1503
+ leftComponent = _o === void 0 ? null : _o,
1504
+ props = __rest(_a, ["title", "bounds", "headerSize", "startSize", "startPosition", "children", "isOpen", "onClose", "initialMaxHeight", "onChangeSize", "onMouseDown", "order", "source", "leftComponent"]);
1411
1505
 
1412
1506
  var zIndex = (source === 'app' ? BASE_Z_INDEX : 1000) + order;
1413
1507
  var elevation = BASE_ELEVATION + order;
1414
1508
  var nodeRef = React__default["default"].useRef(null);
1415
1509
 
1416
- var _o = __read(React__default["default"].useState({
1510
+ var _p = __read(React__default["default"].useState({
1417
1511
  x: 0,
1418
1512
  y: 0
1419
1513
  }), 2),
1420
- position = _o[0],
1421
- setPosition = _o[1];
1514
+ position = _p[0],
1515
+ setPosition = _p[1];
1422
1516
 
1423
- var _p = __read(React__default["default"].useState(startSize), 2),
1424
- size = _p[0],
1425
- setSize = _p[1];
1517
+ var _q = __read(React__default["default"].useState(startSize), 2),
1518
+ size = _q[0],
1519
+ setSize = _q[1];
1426
1520
 
1427
1521
  var onStopDrag = React__default["default"].useCallback(function (_event, position) {
1428
1522
  setPosition(position);
1429
1523
  }, [setPosition]);
1430
1524
 
1431
- var _q = __read(React__default["default"].useState(defaultInitialMaxHeight), 2),
1432
- initialMaxHeight = _q[0],
1433
- setInitialMaxHeight = _q[1];
1525
+ var _r = __read(React__default["default"].useState(defaultInitialMaxHeight), 2),
1526
+ initialMaxHeight = _r[0],
1527
+ setInitialMaxHeight = _r[1];
1434
1528
 
1435
1529
  var onStartResize = function onStartResize() {
1436
1530
  setInitialMaxHeight('initial');
@@ -1516,7 +1610,8 @@
1516
1610
  isDraggable: true,
1517
1611
  isResizable: true,
1518
1612
  elevation: elevation,
1519
- headerClassName: headerClassName
1613
+ headerClassName: headerClassName,
1614
+ leftComponent: leftComponent
1520
1615
  }, children)))) : null;
1521
1616
  };
1522
1617
 
@@ -1796,11 +1891,11 @@
1796
1891
  }, /*#__PURE__*/React__default["default"].createElement(ArrowRightIcon, null))),
1797
1892
  descriptionMac: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1798
1893
  type: "icon"
1799
- }, /*#__PURE__*/React__default["default"].createElement(OptionIcon, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1894
+ }, "Ctrl"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1800
1895
  type: "connect"
1801
1896
  }, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1802
1897
  type: "icon"
1803
- }, /*#__PURE__*/React__default["default"].createElement(CommandIcon, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1898
+ }, /*#__PURE__*/React__default["default"].createElement(OptionIcon, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1804
1899
  type: "connect"
1805
1900
  }, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1806
1901
  type: "icon"
@@ -2302,10 +2397,12 @@
2302
2397
  value = _d === void 0 ? 0 : _d,
2303
2398
  _e = _a.sx,
2304
2399
  sx = _e === void 0 ? {} : _e,
2305
- props = __rest(_a, ["active", "width", "height", "children", "value", "sx"]);
2400
+ _f = _a.variant,
2401
+ variant = _f === void 0 ? 'tool' : _f,
2402
+ props = __rest(_a, ["active", "width", "height", "children", "value", "sx", "variant"]);
2306
2403
 
2307
2404
  return /*#__PURE__*/React__namespace.createElement(CustomToggleButton, __assign({
2308
- variant: "tool",
2405
+ variant: variant,
2309
2406
  disableRipple: true,
2310
2407
  selected: active,
2311
2408
  value: value,
@@ -2624,11 +2721,199 @@
2624
2721
  disableFocusRipple: true,
2625
2722
  tabIndex: -1
2626
2723
  }),
2627
- testId: "enableLayer",
2724
+ testId: "enableButton",
2628
2725
  isEnabled: isEnabled
2629
2726
  });
2630
2727
  };
2631
2728
 
2729
+ /* *
2730
+ * Licensed under the Apache License, Version 2.0 (the "License");
2731
+ * you may not use this file except in compliance with the License.
2732
+ * You may obtain a copy of the License at
2733
+ *
2734
+ * http://www.apache.org/licenses/LICENSE-2.0
2735
+ *
2736
+ * Unless required by applicable law or agreed to in writing, software
2737
+ * distributed under the License is distributed on an "AS IS" BASIS,
2738
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2739
+ * See the License for the specific language governing permissions and
2740
+ * limitations under the License.
2741
+ *
2742
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2743
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
2744
+ * */
2745
+ var tooltipContainerStyles = function tooltipContainerStyles(isEnabled) {
2746
+ return {
2747
+ width: '100%',
2748
+ height: 32,
2749
+ fontWeight: 500,
2750
+ fontSize: function fontSize(theme) {
2751
+ return theme.palette.geowebColors.layerManager.tableRowDefaultText.fontSize;
2752
+ },
2753
+ color: isEnabled ? 'geowebColors.layerManager.tableRowDefaultText.rgba' : 'geowebColors.layerManager.tableRowDisabledText.rgba',
2754
+ '& .MuiOutlinedInput-input': {
2755
+ padding: '6px 24px 6px 8px'
2756
+ },
2757
+ '& .MuiOutlinedInput-notchedOutline': {
2758
+ borderColor: 'transparent!important'
2759
+ },
2760
+ '&:hover .MuiSelect-select': {
2761
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2762
+ },
2763
+ '&.Mui-focused .MuiSelect-select': {
2764
+ outline: function outline(theme) {
2765
+ return theme.palette.geowebColors.buttons.focusDefault.outline;
2766
+ },
2767
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2768
+ },
2769
+ '&:hover&.MuiButton-root': {
2770
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2771
+ },
2772
+ '&:focus&.MuiButton-root': {
2773
+ outline: function outline(theme) {
2774
+ return theme.palette.geowebColors.buttons.focusDefault.outline;
2775
+ },
2776
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2777
+ },
2778
+ '& .MuiSvgIcon-root': {
2779
+ transition: 'none',
2780
+ fill: function fill(theme) {
2781
+ return isEnabled ? theme.palette.geowebColors.buttons.flat["default"].color : theme.palette.geowebColors.buttons.flat.disabled.color;
2782
+ }
2783
+ },
2784
+ '&>div': {
2785
+ paddingLeft: 1
2786
+ }
2787
+ };
2788
+ };
2789
+
2790
+ /* *
2791
+ * Licensed under the Apache License, Version 2.0 (the "License");
2792
+ * you may not use this file except in compliance with the License.
2793
+ * You may obtain a copy of the License at
2794
+ *
2795
+ * http://www.apache.org/licenses/LICENSE-2.0
2796
+ *
2797
+ * Unless required by applicable law or agreed to in writing, software
2798
+ * distributed under the License is distributed on an "AS IS" BASIS,
2799
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2800
+ * See the License for the specific language governing permissions and
2801
+ * limitations under the License.
2802
+ *
2803
+ * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2804
+ * Copyright 2020 - Finnish Meteorological Institute (FMI)
2805
+ * */
2806
+ var TooltipSelect = function TooltipSelect(_a) {
2807
+ var tooltip = _a.tooltip,
2808
+ _b = _a.list,
2809
+ list = _b === void 0 ? [] : _b,
2810
+ _c = _a.currentIndex,
2811
+ currentIndex = _c === void 0 ? -1 : _c,
2812
+ _d = _a.onChangeMouseWheel,
2813
+ onChangeMouseWheel = _d === void 0 ? function () {} : _d,
2814
+ _e = _a.requiresCtrlToChange,
2815
+ requiresCtrlToChange = _e === void 0 ? false : _e,
2816
+ isEnabled = _a.isEnabled,
2817
+ noStyling = _a.noStyling,
2818
+ props = __rest(_a, ["tooltip", "list", "currentIndex", "onChangeMouseWheel", "requiresCtrlToChange", "isEnabled", "noStyling"]);
2819
+
2820
+ props.disableUnderline;
2821
+ var otherProps = __rest(props, ["disableUnderline"]);
2822
+
2823
+ var _f = __read(React__namespace.useState(false), 2),
2824
+ selectOpen = _f[0],
2825
+ setSelectOpen = _f[1];
2826
+
2827
+ var _g = __read(React__namespace.useState(false), 2),
2828
+ tooltipOpen = _g[0],
2829
+ setTooltipOpen = _g[1];
2830
+
2831
+ var onWheel = React__namespace.useCallback(function (event) {
2832
+ if (requiresCtrlToChange && (event.ctrlKey || event.metaKey) || !requiresCtrlToChange) {
2833
+ if (selectOpen) return;
2834
+ var direction = event.deltaY < 0 ? 1 : -1;
2835
+ var newValue = list[Math.min(Math.max(currentIndex - direction, 0), list.length - 1)];
2836
+ onChangeMouseWheel(newValue);
2837
+ }
2838
+ }, [selectOpen, currentIndex, list, onChangeMouseWheel, requiresCtrlToChange]);
2839
+ var onOpen = React__namespace.useCallback(function () {
2840
+ setSelectOpen(true);
2841
+ setTooltipOpen(false);
2842
+ }, []);
2843
+ var onClose = React__namespace.useCallback(function () {
2844
+ setSelectOpen(false);
2845
+ }, []);
2846
+ var onMouseEnter = React__namespace.useCallback(function () {
2847
+ if (!selectOpen) setTooltipOpen(true);
2848
+ }, [selectOpen]);
2849
+ var onMouseLeave = React__namespace.useCallback(function () {
2850
+ setTooltipOpen(false);
2851
+ }, []);
2852
+ var onFocus = React__namespace.useCallback(function () {
2853
+ setTooltipOpen(true);
2854
+ }, []);
2855
+ var onBlur = React__namespace.useCallback(function () {
2856
+ setTooltipOpen(false);
2857
+ }, []);
2858
+ return /*#__PURE__*/React__namespace.createElement(material.Tooltip, {
2859
+ title: tooltip,
2860
+ placement: "top",
2861
+ open: tooltipOpen,
2862
+ sx: noStyling ? undefined : tooltipContainerStyles(isEnabled)
2863
+ }, /*#__PURE__*/React__namespace.createElement(material.Select, __assign({
2864
+ onOpen: onOpen,
2865
+ onClose: onClose,
2866
+ onMouseEnter: onMouseEnter,
2867
+ onMouseLeave: onMouseLeave,
2868
+ onFocus: onFocus,
2869
+ onBlur: onBlur,
2870
+ onWheel: onWheel,
2871
+ MenuProps: {
2872
+ BackdropProps: {
2873
+ sx: {
2874
+ '&.MuiBackdrop-root': {
2875
+ backgroundColor: 'transparent'
2876
+ }
2877
+ }
2878
+ },
2879
+ sx: {
2880
+ '& ul': {
2881
+ backgroundColor: 'geowebColors.background.surface'
2882
+ },
2883
+ '& li': {
2884
+ fontSize: '16px',
2885
+ padding: '12px',
2886
+ '&:hover': {
2887
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2888
+ },
2889
+ '&.Mui-selected': {
2890
+ color: 'geowebColors.buttons.tool.active.color',
2891
+ backgroundColor: 'geowebColors.buttons.tool.active.fill',
2892
+ boxShadow: "none",
2893
+ '&:hover': {
2894
+ backgroundColor: 'geowebColors.buttons.tool.activeMouseOver.fill'
2895
+ },
2896
+ '&:focus': {
2897
+ backgroundColor: 'geowebColors.buttons.tool.activeMouseOver.fill'
2898
+ }
2899
+ },
2900
+ '&:after': {
2901
+ background: 'none!important'
2902
+ },
2903
+ '&.Mui-disabled': {
2904
+ fontSize: '12px',
2905
+ opacity: 0.67,
2906
+ padding: '0px 12px',
2907
+ '&.MuiMenuItem-root': {
2908
+ minHeight: '30px!important'
2909
+ }
2910
+ }
2911
+ }
2912
+ }
2913
+ }
2914
+ }, otherProps)));
2915
+ };
2916
+
2632
2917
  /* *
2633
2918
  * Licensed under the Apache License, Version 2.0 (the "License");
2634
2919
  * you may not use this file except in compliance with the License.
@@ -2664,6 +2949,7 @@
2664
2949
  };
2665
2950
 
2666
2951
  exports.AlertBanner = AlertBanner;
2952
+ exports.AlertIcon = AlertIcon;
2667
2953
  exports.AppHeader = AppHeader;
2668
2954
  exports.AppLayout = AppLayout;
2669
2955
  exports.ConfirmationDialog = ConfirmationDialog;
@@ -2684,6 +2970,7 @@
2684
2970
  exports.ToolContainerDraggable = DraggableComponent;
2685
2971
  exports.ToolFooter = ToolFooter;
2686
2972
  exports.ToolHeader = ToolHeader;
2973
+ exports.TooltipSelect = TooltipSelect;
2687
2974
  exports.UserMenu = UserMenu;
2688
2975
  exports.UserMenuItemCheatSheet = UserMenuItemCheatSheet;
2689
2976
  exports.UserMenuItemTheme = MenuItemTheme;
@@ -2693,6 +2980,7 @@
2693
2980
  exports.isAxiosError = isAxiosError;
2694
2981
  exports.showPrompt = showPrompt;
2695
2982
  exports.sliderStyles = sliderStyles;
2983
+ exports.tooltipContainerStyles = tooltipContainerStyles;
2696
2984
  exports.useConfirmationDialog = useConfirmationDialog;
2697
2985
  exports.useDialogActions = useDialogActions;
2698
2986
  exports.useDraftFormHelpers = useDraftFormHelpers;