@opengeoweb/shared 2.4.1 → 2.7.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 +380 -82
  2. package/index.umd.js +416 -96
  3. package/lib/components/AlertBanner/AlertBanner.d.ts +5 -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/{Manager/EnableButton → EnableButton}/EnableButton.d.ts +0 -0
  7. package/lib/components/{Manager/EnableButton → EnableButton}/EnableButton.spec.d.ts +0 -0
  8. package/lib/components/{Manager/EnableButton → EnableButton}/EnableButton.stories.d.ts +0 -0
  9. package/lib/components/{Manager/EnableButton → EnableButton}/index.d.ts +0 -0
  10. package/lib/components/{Manager/ManagerButton → ManagerButton}/ManagerButton.d.ts +5 -0
  11. package/lib/components/{Manager/ManagerButton → ManagerButton}/ManagerButton.spec.d.ts +0 -0
  12. package/lib/components/{Manager/ManagerButton → ManagerButton}/ManagerButton.stories.d.ts +0 -0
  13. package/lib/components/{Manager/ManagerButton → ManagerButton}/index.d.ts +0 -0
  14. package/lib/components/{Manager/ManagerDeleteButton → ManagerDeleteButton}/ManagerDeleteButton.d.ts +0 -0
  15. package/lib/components/{Manager/ManagerDeleteButton → ManagerDeleteButton}/ManagerDeleteButton.spec.d.ts +0 -0
  16. package/lib/components/{Manager/ManagerDeleteButton → ManagerDeleteButton}/ManagerDeleteButton.stories.d.ts +0 -0
  17. package/lib/components/{Manager/ManagerDeleteButton → ManagerDeleteButton}/index.d.ts +0 -0
  18. package/lib/components/ToggleMenu/ToggleMenu.d.ts +11 -3
  19. package/lib/components/ToggleMenu/ToggleMenu.stories.d.ts +8 -2
  20. package/lib/components/ToolContainer/ToolContainerDraggable.d.ts +1 -0
  21. package/lib/components/ToolContainer/types.d.ts +1 -0
  22. package/lib/components/TooltipSelect/TooltipSelect.d.ts +17 -0
  23. package/lib/components/TooltipSelect/TooltipSelect.spec.d.ts +1 -0
  24. package/lib/components/TooltipSelect/TooltipSelect.stories.d.ts +13 -0
  25. package/lib/components/TooltipSelect/index.d.ts +2 -0
  26. package/lib/components/TooltipSelect/tooltipContainerStyles.d.ts +2 -0
  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
@@ -402,12 +402,20 @@
402
402
  };
403
403
 
404
404
  var HIDDEN_INPUT_HELPER_IS_DRAFT = 'IS_DRAFT';
405
- var useDraftFormHelpers = function useDraftFormHelpers() {
405
+ var useDraftFormHelpers = function useDraftFormHelpers(isDefaultDraft) {
406
+ if (isDefaultDraft === void 0) {
407
+ isDefaultDraft = false;
408
+ }
409
+
406
410
  var _a = reactHookForm.useFormContext(),
407
411
  getValues = _a.getValues,
408
412
  setValue = _a.setValue,
409
413
  register = _a.register;
410
414
 
415
+ React__namespace.useEffect(function () {
416
+ setValue(HIDDEN_INPUT_HELPER_IS_DRAFT, isDefaultDraft); // eslint-disable-next-line react-hooks/exhaustive-deps
417
+ }, []);
418
+
411
419
  var isDraft = function isDraft() {
412
420
  return getValues(HIDDEN_INPUT_HELPER_IS_DRAFT) === true;
413
421
  };
@@ -425,9 +433,7 @@
425
433
  };
426
434
 
427
435
  var DraftFieldHelper = function DraftFieldHelper() {
428
- return /*#__PURE__*/React__namespace.createElement("input", __assign({
429
- defaultValue: "false"
430
- }, register(HIDDEN_INPUT_HELPER_IS_DRAFT), {
436
+ return /*#__PURE__*/React__namespace.createElement("input", __assign({}, register(HIDDEN_INPUT_HELPER_IS_DRAFT), {
431
437
  type: "hidden"
432
438
  }));
433
439
  };
@@ -534,24 +540,21 @@
534
540
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
535
541
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
536
542
  * */
537
- var useStyles$a = makeStyles__default["default"](function () {
538
- return {
539
- title: {
540
- fontSize: '14px',
541
- fontWeight: 'normal',
542
- marginTop: '0px!important',
543
- paddingTop: '0px!important'
544
- },
545
- info: {
546
- fontSize: '16px'
547
- }
548
- };
549
- });
550
543
 
551
- 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
+
552
550
  switch (severity) {
553
551
  case 'info':
554
- 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", {
555
558
  width: 24,
556
559
  height: 24,
557
560
  fill: "transparent"
@@ -561,7 +564,12 @@
561
564
  }));
562
565
 
563
566
  case 'success':
564
- 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", {
565
573
  width: 24,
566
574
  height: 24,
567
575
  fill: "transparent"
@@ -571,7 +579,12 @@
571
579
  }));
572
580
 
573
581
  case 'warning':
574
- 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", {
575
588
  width: 24,
576
589
  height: 24,
577
590
  fill: "transparent"
@@ -582,7 +595,12 @@
582
595
 
583
596
  case 'error':
584
597
  default:
585
- 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", {
586
604
  width: 24,
587
605
  height: 24,
588
606
  fill: "transparent"
@@ -593,6 +611,12 @@
593
611
  }
594
612
  };
595
613
 
614
+ var IconChevronRight = /*#__PURE__*/React__namespace.createElement(material.SvgIcon, null, /*#__PURE__*/React__namespace.createElement("path", {
615
+ d: "M5.427 15.03c-.57.618-.57 1.57 0 2.188.57.603 1.494.603 2.062 0l5.514-5.843 5.512 5.843c.57.603 1.494.603 2.063 0 .285-.303.426-.7.426-1.094a1.59 1.59 0 0 0-.426-1.094L13.003 7l-7.576 8.03z",
616
+ id: "chrevron-right",
617
+ transform: "rotate(90 13.002 12.335)"
618
+ }));
619
+
596
620
  var AlertBanner = function AlertBanner(_a) {
597
621
  var title = _a.title,
598
622
  _b = _a.severity,
@@ -602,12 +626,31 @@
602
626
  _d = _a.dataTestId,
603
627
  dataTestId = _d === void 0 ? 'alert-banner' : _d,
604
628
  _e = _a.isCompact,
605
- isCompact = _e === void 0 ? false : _e;
606
- var classes = useStyles$a();
607
- return /*#__PURE__*/React__namespace.createElement(material.Alert, {
629
+ isCompact = _e === void 0 ? false : _e,
630
+ _f = _a.shouldClose,
631
+ shouldClose = _f === void 0 ? false : _f,
632
+ _g = _a.actionButtonProps,
633
+ actionButtonProps = _g === void 0 ? undefined : _g;
634
+
635
+ var _h = __read(React__namespace.useState(true), 2),
636
+ isOpen = _h[0],
637
+ setIsOpen = _h[1];
638
+
639
+ return isOpen && /*#__PURE__*/React__namespace.createElement(material.Alert, {
608
640
  "data-testid": dataTestId,
609
641
  severity: severity,
610
- icon: getIcon(severity),
642
+ icon: /*#__PURE__*/React__namespace.createElement(AlertIcon, {
643
+ severity: severity
644
+ }),
645
+ action: shouldClose ? /*#__PURE__*/React__namespace.createElement(material.Button, {
646
+ variant: "flat",
647
+ onClick: function onClick() {
648
+ return setIsOpen(false);
649
+ },
650
+ sx: {
651
+ backgroundColor: 'transparent!important'
652
+ }
653
+ }, "CLOSE") : undefined,
611
654
  sx: isCompact ? {
612
655
  height: '32px',
613
656
  boxSizing: 'border-box',
@@ -624,12 +667,42 @@
624
667
  margin: '-3px 10px 0px 0px',
625
668
  padding: '0px'
626
669
  }
627
- } : {}
670
+ } : {
671
+ padding: '3px 16px',
672
+ '& .MuiAlert-message': {
673
+ padding: '8px 0'
674
+ },
675
+ '& .MuiAlert-icon': {
676
+ padding: '8px 0'
677
+ },
678
+ '& .MuiAlert-action': {
679
+ padding: 0
680
+ }
681
+ }
628
682
  }, /*#__PURE__*/React__namespace.createElement(material.AlertTitle, {
629
- className: classes.title
630
- }, title), info && /*#__PURE__*/React__namespace.createElement("div", {
631
- className: classes.info
632
- }, info));
683
+ sx: {
684
+ fontSize: '14px',
685
+ fontWeight: 'normal',
686
+ marginTop: '0px!important',
687
+ paddingTop: '0px!important',
688
+ marginBottom: '0px!important'
689
+ }
690
+ }, title), info && /*#__PURE__*/React__namespace.createElement(material.Box, {
691
+ sx: {
692
+ fontSize: '16px',
693
+ marginTop: 1
694
+ }
695
+ }, info), actionButtonProps && /*#__PURE__*/React__namespace.createElement(material.Button, {
696
+ variant: "flat",
697
+ onClick: function onClick(event) {
698
+ setIsOpen(false);
699
+ actionButtonProps.onClick(event);
700
+ },
701
+ sx: {
702
+ backgroundColor: 'transparent!important'
703
+ },
704
+ startIcon: IconChevronRight
705
+ }, actionButtonProps.title.toUpperCase()));
633
706
  };
634
707
 
635
708
  /* *
@@ -648,7 +721,7 @@
648
721
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
649
722
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
650
723
  * */
651
- var useStyles$9 = makeStyles__default["default"](function () {
724
+ var useStyles$8 = makeStyles__default["default"](function () {
652
725
  return {
653
726
  wrapper: {
654
727
  height: '100vh',
@@ -665,7 +738,7 @@
665
738
  var AppLayout = function AppLayout(_a) {
666
739
  var header = _a.header,
667
740
  children = _a.children;
668
- var classes = useStyles$9();
741
+ var classes = useStyles$8();
669
742
  return /*#__PURE__*/React__default["default"].createElement("div", {
670
743
  className: classes.wrapper
671
744
  }, header, /*#__PURE__*/React__default["default"].createElement("main", {
@@ -691,7 +764,7 @@
691
764
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
692
765
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
693
766
  * */
694
- var useStyles$8 = makeStyles__default["default"](function (theme) {
767
+ var useStyles$7 = makeStyles__default["default"](function (theme) {
695
768
  var _a;
696
769
 
697
770
  return {
@@ -728,7 +801,7 @@
728
801
  userMenu = _a.userMenu,
729
802
  _b = _a.title,
730
803
  title = _b === void 0 ? 'GeoWeb' : _b;
731
- var classes = useStyles$8();
804
+ var classes = useStyles$7();
732
805
  return /*#__PURE__*/React__default["default"].createElement("header", {
733
806
  className: classes.header
734
807
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
@@ -1002,7 +1075,7 @@
1002
1075
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1003
1076
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1004
1077
  * */
1005
- var useStyles$7 = makeStyles__default["default"](function (theme) {
1078
+ var useStyles$6 = makeStyles__default["default"](function (theme) {
1006
1079
  return {
1007
1080
  container: {
1008
1081
  position: 'absolute',
@@ -1050,7 +1123,7 @@
1050
1123
  } : _d,
1051
1124
  children = _a.children,
1052
1125
  initials = _a.initials;
1053
- var classes = useStyles$7();
1126
+ var classes = useStyles$6();
1054
1127
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
1055
1128
  "data-testid": "userButton",
1056
1129
  onClick: onToggle,
@@ -1133,7 +1206,7 @@
1133
1206
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1134
1207
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1135
1208
  * */
1136
- var useStyles$6 = makeStyles__default["default"](function (theme) {
1209
+ var useStyles$5 = makeStyles__default["default"](function (theme) {
1137
1210
  return {
1138
1211
  footer: {
1139
1212
  boxShadow: theme.shadows[1],
@@ -1146,7 +1219,7 @@
1146
1219
  }); // drag handles will be handled by DraggableResizable/Resizable
1147
1220
 
1148
1221
  var ToolFooter = function ToolFooter() {
1149
- var classes = useStyles$6();
1222
+ var classes = useStyles$5();
1150
1223
  return /*#__PURE__*/React__default["default"].createElement("footer", {
1151
1224
  className: classes.footer
1152
1225
  });
@@ -1229,13 +1302,17 @@
1229
1302
  _c = _a.isDraggable,
1230
1303
  isDraggable = _c === void 0 ? false : _c,
1231
1304
  _d = _a.className,
1232
- className = _d === void 0 ? '' : _d;
1305
+ className = _d === void 0 ? '' : _d,
1306
+ _e = _a.leftComponent,
1307
+ leftComponent = _e === void 0 ? null : _e;
1233
1308
  var styles = getStyle(size);
1234
1309
 
1235
1310
  var onClickClose = function onClickClose() {
1236
1311
  return onClose();
1237
1312
  };
1238
1313
 
1314
+ var columnSizeIcon = leftComponent ? 3 : 1;
1315
+ var columnSizeTitle = leftComponent ? 6 : 10;
1239
1316
  return /*#__PURE__*/React__default["default"].createElement(material.Box, {
1240
1317
  component: "header",
1241
1318
  className: className,
@@ -1251,26 +1328,27 @@
1251
1328
  alignItems: "center"
1252
1329
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1253
1330
  item: true,
1254
- xs: 1
1255
- }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1331
+ xs: columnSizeIcon
1332
+ }, isDraggable && size !== 'xxs' && !leftComponent && /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1256
1333
  container: true,
1257
1334
  justifyContent: "flex-start"
1258
- }, isDraggable && size !== 'xxs' && /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
1335
+ }, /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
1259
1336
  "data-testid": "dragBtn",
1260
1337
  disableRipple: true,
1261
1338
  size: "large",
1262
1339
  sx: __assign(__assign({}, iconStyle), {
1263
1340
  pointerEvents: 'none'
1264
1341
  })
1265
- }, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.DragIndicator, null)))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1342
+ }, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.DragIndicator, null))), leftComponent && leftComponent), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1266
1343
  item: true,
1267
- xs: 10
1344
+ xs: columnSizeTitle
1268
1345
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1269
1346
  container: true,
1270
1347
  justifyContent: "center",
1271
1348
  alignItems: "center"
1272
1349
  }, title && /*#__PURE__*/React__default["default"].createElement(material.Typography, {
1273
1350
  variant: "h2",
1351
+ noWrap: true,
1274
1352
  sx: {
1275
1353
  fontSize: styles.fontSize,
1276
1354
  fontWeight: styles.fontWeight
@@ -1286,7 +1364,7 @@
1286
1364
  })
1287
1365
  }, /*#__PURE__*/React__default["default"].createElement(iconsMaterial.DragIndicator, null)))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1288
1366
  item: true,
1289
- xs: 1,
1367
+ xs: columnSizeIcon,
1290
1368
  container: true,
1291
1369
  justifyContent: "flex-end"
1292
1370
  }, onClose && /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
@@ -1313,22 +1391,20 @@
1313
1391
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1314
1392
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1315
1393
  * */
1316
- var useStyles$5 = makeStyles__default["default"](function () {
1317
- return {
1318
- container: {
1319
- overflow: 'hidden',
1320
- borderRadius: 0,
1321
- display: 'flex',
1322
- flexDirection: 'column',
1323
- height: '100%'
1324
- },
1325
- content: {
1326
- flex: 1,
1327
- overflowY: 'auto',
1328
- position: 'relative'
1329
- }
1330
- };
1331
- });
1394
+ var styles$1 = {
1395
+ container: {
1396
+ overflow: 'hidden',
1397
+ borderRadius: 0,
1398
+ display: 'flex',
1399
+ flexDirection: 'column',
1400
+ height: '100%'
1401
+ },
1402
+ content: {
1403
+ flex: 1,
1404
+ overflowY: 'auto',
1405
+ position: 'relative'
1406
+ }
1407
+ };
1332
1408
  var BASE_ELEVATION = 5;
1333
1409
 
1334
1410
  var ToolContainer = function ToolContainer(_a) {
@@ -1350,20 +1426,22 @@
1350
1426
  _h = _a.headerClassName,
1351
1427
  // elevation_06
1352
1428
  headerClassName = _h === void 0 ? '' : _h,
1353
- props = __rest(_a, ["title", "size", "children", "onClose", "isResizable", "isDraggable", "maxHeight", "elevation", "headerClassName"]);
1429
+ _j = _a.leftComponent,
1430
+ leftComponent = _j === void 0 ? null : _j,
1431
+ props = __rest(_a, ["title", "size", "children", "onClose", "isResizable", "isDraggable", "maxHeight", "elevation", "headerClassName", "leftComponent"]);
1354
1432
 
1355
- var classes = useStyles$5();
1356
1433
  return /*#__PURE__*/React__default["default"].createElement(material.Paper, __assign({
1357
1434
  elevation: elevation,
1358
- className: classes.container
1435
+ sx: styles$1.container
1359
1436
  }, props), /*#__PURE__*/React__default["default"].createElement(ToolHeader, {
1360
1437
  title: title,
1361
1438
  size: size,
1362
1439
  isDraggable: isDraggable,
1363
1440
  onClose: onClose,
1364
- className: headerClassName
1365
- }), /*#__PURE__*/React__default["default"].createElement("div", {
1366
- className: classes.content,
1441
+ className: headerClassName,
1442
+ leftComponent: leftComponent
1443
+ }), /*#__PURE__*/React__default["default"].createElement(material.Box, {
1444
+ sx: styles$1.content,
1367
1445
  style: {
1368
1446
  maxHeight: maxHeight
1369
1447
  }
@@ -1439,30 +1517,32 @@
1439
1517
  order = _l === void 0 ? 1 : _l,
1440
1518
  _m = _a.source,
1441
1519
  source = _m === void 0 ? 'app' : _m,
1442
- props = __rest(_a, ["title", "bounds", "headerSize", "startSize", "startPosition", "children", "isOpen", "onClose", "initialMaxHeight", "onChangeSize", "onMouseDown", "order", "source"]);
1520
+ _o = _a.leftComponent,
1521
+ leftComponent = _o === void 0 ? null : _o,
1522
+ props = __rest(_a, ["title", "bounds", "headerSize", "startSize", "startPosition", "children", "isOpen", "onClose", "initialMaxHeight", "onChangeSize", "onMouseDown", "order", "source", "leftComponent"]);
1443
1523
 
1444
1524
  var zIndex = (source === 'app' ? BASE_Z_INDEX : 1000) + order;
1445
1525
  var elevation = BASE_ELEVATION + order;
1446
1526
  var nodeRef = React__default["default"].useRef(null);
1447
1527
 
1448
- var _o = __read(React__default["default"].useState({
1528
+ var _p = __read(React__default["default"].useState({
1449
1529
  x: 0,
1450
1530
  y: 0
1451
1531
  }), 2),
1452
- position = _o[0],
1453
- setPosition = _o[1];
1532
+ position = _p[0],
1533
+ setPosition = _p[1];
1454
1534
 
1455
- var _p = __read(React__default["default"].useState(startSize), 2),
1456
- size = _p[0],
1457
- setSize = _p[1];
1535
+ var _q = __read(React__default["default"].useState(startSize), 2),
1536
+ size = _q[0],
1537
+ setSize = _q[1];
1458
1538
 
1459
1539
  var onStopDrag = React__default["default"].useCallback(function (_event, position) {
1460
1540
  setPosition(position);
1461
1541
  }, [setPosition]);
1462
1542
 
1463
- var _q = __read(React__default["default"].useState(defaultInitialMaxHeight), 2),
1464
- initialMaxHeight = _q[0],
1465
- setInitialMaxHeight = _q[1];
1543
+ var _r = __read(React__default["default"].useState(defaultInitialMaxHeight), 2),
1544
+ initialMaxHeight = _r[0],
1545
+ setInitialMaxHeight = _r[1];
1466
1546
 
1467
1547
  var onStartResize = function onStartResize() {
1468
1548
  setInitialMaxHeight('initial');
@@ -1548,7 +1628,8 @@
1548
1628
  isDraggable: true,
1549
1629
  isResizable: true,
1550
1630
  elevation: elevation,
1551
- headerClassName: headerClassName
1631
+ headerClassName: headerClassName,
1632
+ leftComponent: leftComponent
1552
1633
  }, children)))) : null;
1553
1634
  };
1554
1635
 
@@ -1828,11 +1909,11 @@
1828
1909
  }, /*#__PURE__*/React__default["default"].createElement(ArrowRightIcon, null))),
1829
1910
  descriptionMac: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1830
1911
  type: "icon"
1831
- }, /*#__PURE__*/React__default["default"].createElement(OptionIcon, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1912
+ }, "Ctrl"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1832
1913
  type: "connect"
1833
1914
  }, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1834
1915
  type: "icon"
1835
- }, /*#__PURE__*/React__default["default"].createElement(CommandIcon, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1916
+ }, /*#__PURE__*/React__default["default"].createElement(OptionIcon, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1836
1917
  type: "connect"
1837
1918
  }, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1838
1919
  type: "icon"
@@ -2334,10 +2415,12 @@
2334
2415
  value = _d === void 0 ? 0 : _d,
2335
2416
  _e = _a.sx,
2336
2417
  sx = _e === void 0 ? {} : _e,
2337
- props = __rest(_a, ["active", "width", "height", "children", "value", "sx"]);
2418
+ _f = _a.variant,
2419
+ variant = _f === void 0 ? 'tool' : _f,
2420
+ props = __rest(_a, ["active", "width", "height", "children", "value", "sx", "variant"]);
2338
2421
 
2339
2422
  return /*#__PURE__*/React__namespace.createElement(CustomToggleButton, __assign({
2340
- variant: "tool",
2423
+ variant: variant,
2341
2424
  disableRipple: true,
2342
2425
  selected: active,
2343
2426
  value: value,
@@ -2376,9 +2459,20 @@
2376
2459
  horizontal: 'right'
2377
2460
  }
2378
2461
  };
2462
+
2463
+ case 'right':
2464
+ return {
2465
+ anchorOrigin: {
2466
+ vertical: 'center',
2467
+ horizontal: 'right'
2468
+ },
2469
+ transformOrigin: {
2470
+ vertical: 'center',
2471
+ horizontal: 'left'
2472
+ }
2473
+ };
2379
2474
  }
2380
2475
  };
2381
-
2382
2476
  var ToggleMenu = function ToggleMenu(_a) {
2383
2477
  var _b = _a.buttonTestId,
2384
2478
  buttonTestId = _b === void 0 ? 'toggleMenuButton' : _b,
@@ -2388,31 +2482,43 @@
2388
2482
  children = _a.children,
2389
2483
  buttonSx = _a.buttonSx,
2390
2484
  _d = _a.tooltipTitle,
2391
- tooltipTitle = _d === void 0 ? '' : _d;
2485
+ tooltipTitle = _d === void 0 ? '' : _d,
2486
+ variant = _a.variant,
2487
+ _e = _a.isDefaultOpen,
2488
+ isDefaultOpen = _e === void 0 ? false : _e;
2392
2489
 
2393
- var _e = __read(React__namespace.useState(null), 2),
2394
- anchorEl = _e[0],
2395
- setAnchorEl = _e[1];
2490
+ var _f = __read(React__namespace.useState(null), 2),
2491
+ anchorEl = _f[0],
2492
+ setAnchorEl = _f[1];
2396
2493
 
2397
2494
  var isOpen = Boolean(anchorEl);
2398
2495
 
2399
- var _f = getPosition(menuPosition),
2400
- anchorOrigin = _f.anchorOrigin,
2401
- transformOrigin = _f.transformOrigin;
2496
+ var _g = getPosition(menuPosition),
2497
+ anchorOrigin = _g.anchorOrigin,
2498
+ transformOrigin = _g.transformOrigin;
2402
2499
 
2403
2500
  var handleClick = function handleClick(event) {
2501
+ event.stopPropagation();
2404
2502
  setAnchorEl(event.currentTarget);
2405
2503
  };
2406
2504
 
2407
- var handleClose = function handleClose() {
2505
+ var handleClose = function handleClose(event) {
2506
+ event.stopPropagation();
2408
2507
  setAnchorEl(null);
2409
2508
  };
2410
2509
 
2510
+ React__namespace.useEffect(function () {
2511
+ if (isDefaultOpen) {
2512
+ setAnchorEl(document.getElementById(buttonTestId));
2513
+ }
2514
+ }, [isDefaultOpen, buttonTestId]);
2411
2515
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ToolButton, {
2412
2516
  active: isOpen,
2413
2517
  sx: buttonSx,
2414
2518
  onClick: handleClick,
2415
- "data-testid": buttonTestId
2519
+ "data-testid": buttonTestId,
2520
+ variant: variant,
2521
+ id: buttonTestId
2416
2522
  }, /*#__PURE__*/React__namespace.createElement(material.Tooltip, {
2417
2523
  placement: "top",
2418
2524
  title: tooltipTitle
@@ -2439,9 +2545,9 @@
2439
2545
  action = menuItem.action;
2440
2546
  return /*#__PURE__*/React__namespace.createElement(material.MenuItem, {
2441
2547
  key: text,
2442
- onClick: function onClick() {
2443
- action();
2444
- handleClose();
2548
+ onClick: function onClick(event) {
2549
+ action(event);
2550
+ handleClose(event);
2445
2551
  }
2446
2552
  }, icon && /*#__PURE__*/React__namespace.createElement(material.ListItemIcon, null, icon), /*#__PURE__*/React__namespace.createElement(material.Typography, null, text));
2447
2553
  }), children));
@@ -2661,6 +2767,216 @@
2661
2767
  });
2662
2768
  };
2663
2769
 
2770
+ /* *
2771
+ * Licensed under the Apache License, Version 2.0 (the "License");
2772
+ * you may not use this file except in compliance with the License.
2773
+ * You may obtain a copy of the License at
2774
+ *
2775
+ * http://www.apache.org/licenses/LICENSE-2.0
2776
+ *
2777
+ * Unless required by applicable law or agreed to in writing, software
2778
+ * distributed under the License is distributed on an "AS IS" BASIS,
2779
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2780
+ * See the License for the specific language governing permissions and
2781
+ * limitations under the License.
2782
+ *
2783
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2784
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
2785
+ * */
2786
+ var tooltipContainerStyles = function tooltipContainerStyles(isEnabled, hasBackgroundColor) {
2787
+ if (hasBackgroundColor === void 0) {
2788
+ hasBackgroundColor = true;
2789
+ }
2790
+
2791
+ return __assign({
2792
+ width: '100%',
2793
+ height: 32,
2794
+ fontWeight: 500,
2795
+ fontSize: function fontSize(theme) {
2796
+ return theme.palette.geowebColors.layerManager.tableRowDefaultText.fontSize;
2797
+ },
2798
+ color: isEnabled ? 'geowebColors.layerManager.tableRowDefaultText.rgba' : 'geowebColors.layerManager.tableRowDisabledText.rgba',
2799
+ '& .MuiOutlinedInput-input': {
2800
+ padding: '6px 24px 6px 8px'
2801
+ },
2802
+ '& .MuiOutlinedInput-notchedOutline': {
2803
+ borderColor: 'transparent!important'
2804
+ },
2805
+ '&:hover .MuiSelect-select': {
2806
+ outline: function outline(theme) {
2807
+ return theme.palette.geowebColors.buttons.focusDefault.outline;
2808
+ }
2809
+ },
2810
+ '&.Mui-focused .MuiSelect-select': {
2811
+ outline: function outline(theme) {
2812
+ return theme.palette.geowebColors.buttons.focusDefault.outline;
2813
+ }
2814
+ },
2815
+ '&:focus&.MuiButton-root': {
2816
+ outline: function outline(theme) {
2817
+ return theme.palette.geowebColors.buttons.focusDefault.outline;
2818
+ }
2819
+ },
2820
+ '& .MuiSvgIcon-root': {
2821
+ transition: 'none',
2822
+ fill: function fill(theme) {
2823
+ return isEnabled ? theme.palette.geowebColors.buttons.flat["default"].color : theme.palette.geowebColors.buttons.flat.disabled.color;
2824
+ }
2825
+ },
2826
+ '&>div': {
2827
+ paddingLeft: 1
2828
+ }
2829
+ }, hasBackgroundColor && backgroundColor);
2830
+ };
2831
+ var backgroundColor = {
2832
+ '&:hover .MuiSelect-select': {
2833
+ outline: function outline(theme) {
2834
+ return theme.palette.geowebColors.buttons.focusDefault.outline;
2835
+ },
2836
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2837
+ },
2838
+ '&.Mui-focused .MuiSelect-select': {
2839
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2840
+ },
2841
+ '&:hover&.MuiButton-root': {
2842
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2843
+ },
2844
+ '&:focus&.MuiButton-root': {
2845
+ outline: function outline(theme) {
2846
+ return theme.palette.geowebColors.buttons.focusDefault.outline;
2847
+ },
2848
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2849
+ }
2850
+ };
2851
+
2852
+ /* *
2853
+ * Licensed under the Apache License, Version 2.0 (the "License");
2854
+ * you may not use this file except in compliance with the License.
2855
+ * You may obtain a copy of the License at
2856
+ *
2857
+ * http://www.apache.org/licenses/LICENSE-2.0
2858
+ *
2859
+ * Unless required by applicable law or agreed to in writing, software
2860
+ * distributed under the License is distributed on an "AS IS" BASIS,
2861
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2862
+ * See the License for the specific language governing permissions and
2863
+ * limitations under the License.
2864
+ *
2865
+ * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2866
+ * Copyright 2020 - Finnish Meteorological Institute (FMI)
2867
+ * */
2868
+ var TooltipSelect = function TooltipSelect(_a) {
2869
+ var tooltip = _a.tooltip,
2870
+ _b = _a.list,
2871
+ list = _b === void 0 ? [] : _b,
2872
+ _c = _a.currentIndex,
2873
+ currentIndex = _c === void 0 ? -1 : _c,
2874
+ _d = _a.onChangeMouseWheel,
2875
+ onChangeMouseWheel = _d === void 0 ? function () {} : _d,
2876
+ _e = _a.requiresCtrlToChange,
2877
+ requiresCtrlToChange = _e === void 0 ? false : _e,
2878
+ isEnabled = _a.isEnabled,
2879
+ noStyling = _a.noStyling,
2880
+ hasBackgroundColor = _a.hasBackgroundColor,
2881
+ props = __rest(_a, ["tooltip", "list", "currentIndex", "onChangeMouseWheel", "requiresCtrlToChange", "isEnabled", "noStyling", "hasBackgroundColor"]);
2882
+
2883
+ props.disableUnderline;
2884
+ var otherProps = __rest(props, ["disableUnderline"]);
2885
+
2886
+ var _f = __read(React__namespace.useState(false), 2),
2887
+ selectOpen = _f[0],
2888
+ setSelectOpen = _f[1];
2889
+
2890
+ var _g = __read(React__namespace.useState(false), 2),
2891
+ tooltipOpen = _g[0],
2892
+ setTooltipOpen = _g[1];
2893
+
2894
+ var onWheel = React__namespace.useCallback(function (event) {
2895
+ if (requiresCtrlToChange && (event.ctrlKey || event.metaKey) || !requiresCtrlToChange) {
2896
+ if (selectOpen) return;
2897
+ var direction = event.deltaY < 0 ? 1 : -1;
2898
+ var newValue = list[Math.min(Math.max(currentIndex - direction, 0), list.length - 1)];
2899
+ onChangeMouseWheel(newValue);
2900
+ }
2901
+ }, [selectOpen, currentIndex, list, onChangeMouseWheel, requiresCtrlToChange]);
2902
+ var onOpen = React__namespace.useCallback(function () {
2903
+ setSelectOpen(true);
2904
+ setTooltipOpen(false);
2905
+ }, []);
2906
+ var onClose = React__namespace.useCallback(function () {
2907
+ setSelectOpen(false);
2908
+ }, []);
2909
+ var onMouseEnter = React__namespace.useCallback(function () {
2910
+ if (!selectOpen) setTooltipOpen(true);
2911
+ }, [selectOpen]);
2912
+ var onMouseLeave = React__namespace.useCallback(function () {
2913
+ setTooltipOpen(false);
2914
+ }, []);
2915
+ var onFocus = React__namespace.useCallback(function () {
2916
+ setTooltipOpen(true);
2917
+ }, []);
2918
+ var onBlur = React__namespace.useCallback(function () {
2919
+ setTooltipOpen(false);
2920
+ }, []);
2921
+ return /*#__PURE__*/React__namespace.createElement(material.Tooltip, {
2922
+ title: tooltip,
2923
+ placement: "top",
2924
+ open: tooltipOpen,
2925
+ sx: noStyling ? undefined : tooltipContainerStyles(isEnabled, hasBackgroundColor)
2926
+ }, /*#__PURE__*/React__namespace.createElement(material.Select, __assign({
2927
+ onOpen: onOpen,
2928
+ onClose: onClose,
2929
+ onMouseEnter: onMouseEnter,
2930
+ onMouseLeave: onMouseLeave,
2931
+ onFocus: onFocus,
2932
+ onBlur: onBlur,
2933
+ onWheel: onWheel,
2934
+ MenuProps: {
2935
+ BackdropProps: {
2936
+ sx: {
2937
+ '&.MuiBackdrop-root': {
2938
+ backgroundColor: 'transparent'
2939
+ }
2940
+ }
2941
+ },
2942
+ sx: {
2943
+ '& ul': {
2944
+ backgroundColor: 'geowebColors.background.surface'
2945
+ },
2946
+ '& li': {
2947
+ fontSize: '16px',
2948
+ padding: '12px',
2949
+ '&:hover': {
2950
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2951
+ },
2952
+ '&.Mui-selected': {
2953
+ color: 'geowebColors.buttons.tool.active.color',
2954
+ backgroundColor: 'geowebColors.buttons.tool.active.fill',
2955
+ boxShadow: "none",
2956
+ '&:hover': {
2957
+ backgroundColor: 'geowebColors.buttons.tool.activeMouseOver.fill'
2958
+ },
2959
+ '&:focus': {
2960
+ backgroundColor: 'geowebColors.buttons.tool.activeMouseOver.fill'
2961
+ }
2962
+ },
2963
+ '&:after': {
2964
+ background: 'none!important'
2965
+ },
2966
+ '&.Mui-disabled': {
2967
+ fontSize: '12px',
2968
+ opacity: 0.67,
2969
+ padding: '0px 12px',
2970
+ '&.MuiMenuItem-root': {
2971
+ minHeight: '30px!important'
2972
+ }
2973
+ }
2974
+ }
2975
+ }
2976
+ }
2977
+ }, otherProps)));
2978
+ };
2979
+
2664
2980
  /* *
2665
2981
  * Licensed under the Apache License, Version 2.0 (the "License");
2666
2982
  * you may not use this file except in compliance with the License.
@@ -2696,6 +3012,7 @@
2696
3012
  };
2697
3013
 
2698
3014
  exports.AlertBanner = AlertBanner;
3015
+ exports.AlertIcon = AlertIcon;
2699
3016
  exports.AppHeader = AppHeader;
2700
3017
  exports.AppLayout = AppLayout;
2701
3018
  exports.ConfirmationDialog = ConfirmationDialog;
@@ -2716,15 +3033,18 @@
2716
3033
  exports.ToolContainerDraggable = DraggableComponent;
2717
3034
  exports.ToolFooter = ToolFooter;
2718
3035
  exports.ToolHeader = ToolHeader;
3036
+ exports.TooltipSelect = TooltipSelect;
2719
3037
  exports.UserMenu = UserMenu;
2720
3038
  exports.UserMenuItemCheatSheet = UserMenuItemCheatSheet;
2721
3039
  exports.UserMenuItemTheme = MenuItemTheme;
2722
3040
  exports.calculateDialogSizeAndPosition = calculateDialogSizeAndPosition;
2723
3041
  exports.getAxiosErrorMessage = getAxiosErrorMessage;
2724
3042
  exports.getInitials = getInitials;
3043
+ exports.getPosition = getPosition;
2725
3044
  exports.isAxiosError = isAxiosError;
2726
3045
  exports.showPrompt = showPrompt;
2727
3046
  exports.sliderStyles = sliderStyles;
3047
+ exports.tooltipContainerStyles = tooltipContainerStyles;
2728
3048
  exports.useConfirmationDialog = useConfirmationDialog;
2729
3049
  exports.useDialogActions = useDialogActions;
2730
3050
  exports.useDraftFormHelpers = useDraftFormHelpers;