@opengeoweb/shared 2.3.0 → 2.4.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 (25) hide show
  1. package/index.esm.js +259 -112
  2. package/index.umd.js +265 -100
  3. package/lib/components/AlertBanner/AlertBanner.d.ts +1 -0
  4. package/lib/components/AlertBanner/AlertBanner.stories.d.ts +9 -1
  5. package/lib/components/Manager/EnableButton/EnableButton.d.ts +8 -0
  6. package/lib/components/{DraggableDialog/DraggableDialog.spec.d.ts → Manager/EnableButton/EnableButton.spec.d.ts} +0 -0
  7. package/lib/components/Manager/EnableButton/EnableButton.stories.d.ts +13 -0
  8. package/lib/components/Manager/EnableButton/index.d.ts +1 -0
  9. package/lib/components/Manager/ManagerButton/ManagerButton.d.ts +13 -0
  10. package/lib/components/Manager/ManagerButton/ManagerButton.spec.d.ts +1 -0
  11. package/lib/components/Manager/ManagerButton/ManagerButton.stories.d.ts +13 -0
  12. package/lib/components/Manager/ManagerButton/index.d.ts +1 -0
  13. package/lib/components/Manager/ManagerDeleteButton/ManagerDeleteButton.d.ts +8 -0
  14. package/lib/components/Manager/ManagerDeleteButton/ManagerDeleteButton.spec.d.ts +1 -0
  15. package/lib/components/Manager/ManagerDeleteButton/ManagerDeleteButton.stories.d.ts +13 -0
  16. package/lib/components/Manager/ManagerDeleteButton/index.d.ts +1 -0
  17. package/lib/components/Manager/index.d.ts +4 -0
  18. package/lib/components/Manager/styles.d.ts +5 -0
  19. package/lib/components/ToolContainer/ToolContainerDraggable.d.ts +6 -0
  20. package/lib/components/ToolContainer/index.d.ts +1 -0
  21. package/lib/components/index.d.ts +1 -1
  22. package/package.json +3 -3
  23. package/lib/components/DraggableDialog/DraggableDialog.d.ts +0 -16
  24. package/lib/components/DraggableDialog/DraggableDialog.stories.d.ts +0 -6
  25. package/lib/components/DraggableDialog/index.d.ts +0 -1
package/index.esm.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
- import { Box, Typography, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, Alert, AlertTitle, SvgIcon, Grid, useTheme, Link, Avatar, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Tooltip, Menu, ListItemIcon } from '@mui/material';
3
+ import { Box, Typography, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, Alert, AlertTitle, SvgIcon, Grid, useTheme, Link, Avatar, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Tooltip, Menu, ListItemIcon, Checkbox } from '@mui/material';
4
4
  import makeStyles from '@mui/styles/makeStyles';
5
- import { Close, DragIndicator } from '@mui/icons-material';
5
+ import { Close, DragIndicator, Delete } from '@mui/icons-material';
6
6
  import { useFormContext } from 'react-hook-form';
7
7
  import { isEmpty, errorMessages } from '@opengeoweb/form-fields';
8
8
  import Draggable from 'react-draggable';
@@ -10,8 +10,8 @@ import { Resizable } from 're-resizable';
10
10
  import { useThemeContext } from '@opengeoweb/theme';
11
11
  import { throttle } from 'lodash';
12
12
  import withStyles from '@mui/styles/withStyles';
13
- import createStyles from '@mui/styles/createStyles';
14
13
  import MoreVertIcon from '@mui/icons-material/MoreVert';
14
+ import createStyles from '@mui/styles/createStyles';
15
15
 
16
16
  /* *
17
17
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -656,7 +656,8 @@ var useStyles$a = makeStyles(function () {
656
656
  title: {
657
657
  fontSize: '14px',
658
658
  fontWeight: 'normal',
659
- marginTop: '0px!important'
659
+ marginTop: '0px!important',
660
+ paddingTop: '0px!important'
660
661
  },
661
662
  info: {
662
663
  fontSize: '16px'
@@ -673,8 +674,7 @@ var getIcon = function getIcon(severity) {
673
674
  fill: "transparent"
674
675
  }), /*#__PURE__*/React.createElement("path", {
675
676
  d: "M12 4c4.418 0 8 3.581 8 8 0 4.418-3.582 8-8 8s-8-3.582-8-8c0-4.419 3.582-8 8-8zm1.052 6H10v1.613h.949v3.774H10V17h4v-1.613h-.948V10zM11.99 6c-.837 0-1.491.654-1.491 1.49 0 .837.654 1.51 1.49 1.51.837 0 1.51-.673 1.51-1.51 0-.836-.673-1.49-1.51-1.49z",
676
- transform: "translate(-946.000000, -368.000000) translate(930.000000, 356.000000) translate(16.000000, 12.000000)",
677
- fill: "#0062E6"
677
+ transform: "translate(-946.000000, -368.000000) translate(930.000000, 356.000000) translate(16.000000, 12.000000)"
678
678
  }));
679
679
 
680
680
  case 'success':
@@ -684,8 +684,7 @@ var getIcon = function getIcon(severity) {
684
684
  fill: "transparent"
685
685
  }), /*#__PURE__*/React.createElement("path", {
686
686
  d: "M16.51 10.034l-5.633 5.633-3.387-3.386c-.369-.37-.369-.973 0-1.343.36-.357.983-.357 1.342 0l2.045 2.046 4.292-4.291c.357-.357.983-.359 1.342 0 .368.369.368.97 0 1.341M12 4C7.582 4 4 7.582 4 12s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8",
687
- transform: "translate(-96.000000, -368.000000) translate(80.000000, 356.000000) translate(16.000000, 12.000000)",
688
- fill: "#72BB23"
687
+ transform: "translate(-96.000000, -368.000000) translate(80.000000, 356.000000) translate(16.000000, 12.000000)"
689
688
  }));
690
689
 
691
690
  case 'warning':
@@ -695,8 +694,7 @@ var getIcon = function getIcon(severity) {
695
694
  fill: "transparent"
696
695
  }), /*#__PURE__*/React.createElement("path", {
697
696
  d: "M12.862 16.72c-.22.226-.507.339-.86.339-.364 0-.662-.113-.894-.34-.232-.226-.347-.52-.347-.885 0-.32.118-.59.356-.81.236-.22.531-.331.884-.331.332 0 .613.11.845.33.232.222.347.491.347.811 0 .365-.11.66-.33.886zm.216-9.805l-.134 6.669H11.06l-.15-6.67h2.169zM12 4.5c-4.141 0-7.5 3.359-7.5 7.501s3.359 7.5 7.5 7.5c4.142 0 7.5-3.358 7.5-7.5C19.5 7.86 16.142 4.5 12 4.5z",
698
- transform: "translate(-521.000000, -368.000000) translate(505.000000, 356.000000) translate(16.000000, 12.000000)",
699
- fill: "#FFA800"
697
+ transform: "translate(-521.000000, -368.000000) translate(505.000000, 356.000000) translate(16.000000, 12.000000)"
700
698
  }));
701
699
 
702
700
  case 'error':
@@ -707,8 +705,7 @@ var getIcon = function getIcon(severity) {
707
705
  fill: "transparent"
708
706
  }), /*#__PURE__*/React.createElement("path", {
709
707
  d: "M12.862 16.72c-.22.226-.507.339-.86.339-.364 0-.662-.113-.894-.34-.232-.226-.347-.52-.347-.885 0-.32.118-.59.356-.81.236-.22.531-.331.884-.331.332 0 .613.11.845.33.232.222.347.491.347.811 0 .365-.11.66-.33.886zm.216-9.805l-.134 6.669H11.06l-.15-6.67h2.169zM12 4.5c-4.141 0-7.5 3.359-7.5 7.501s3.359 7.5 7.5 7.5c4.142 0 7.5-3.358 7.5-7.5C19.5 7.86 16.142 4.5 12 4.5z",
710
- transform: "translate(-1371.000000, -368.000000) translate(1355.000000, 356.000000) translate(16.000000, 12.000000)",
711
- fill: "#C00000"
708
+ transform: "translate(-1371.000000, -368.000000) translate(1355.000000, 356.000000) translate(16.000000, 12.000000)"
712
709
  }));
713
710
  }
714
711
  };
@@ -720,12 +717,31 @@ var AlertBanner = function AlertBanner(_ref) {
720
717
  _ref$info = _ref.info,
721
718
  info = _ref$info === void 0 ? '' : _ref$info,
722
719
  _ref$dataTestId = _ref.dataTestId,
723
- dataTestId = _ref$dataTestId === void 0 ? 'alert-banner' : _ref$dataTestId;
720
+ dataTestId = _ref$dataTestId === void 0 ? 'alert-banner' : _ref$dataTestId,
721
+ _ref$isCompact = _ref.isCompact,
722
+ isCompact = _ref$isCompact === void 0 ? false : _ref$isCompact;
724
723
  var classes = useStyles$a();
725
724
  return /*#__PURE__*/React.createElement(Alert, {
726
725
  "data-testid": dataTestId,
727
726
  severity: severity,
728
- icon: getIcon(severity)
727
+ icon: getIcon(severity),
728
+ sx: isCompact ? {
729
+ height: '32px',
730
+ boxSizing: 'border-box',
731
+ '& .MuiAlert-message': {
732
+ padding: '0px',
733
+ whiteSpace: 'nowrap',
734
+ overflow: 'hidden',
735
+ textOverflow: 'ellipsis',
736
+ '& .MuiTypography-root': {
737
+ display: 'inline'
738
+ }
739
+ },
740
+ '& .MuiAlert-icon': {
741
+ margin: '-3px 10px 0px 0px',
742
+ padding: '0px'
743
+ }
744
+ } : {}
729
745
  }, /*#__PURE__*/React.createElement(AlertTitle, {
730
746
  className: classes.title
731
747
  }, title), info && /*#__PURE__*/React.createElement("div", {
@@ -1336,7 +1352,7 @@ var ToolHeader = function ToolHeader(_ref) {
1336
1352
  boxShadow: 1,
1337
1353
  backgroundColor: 'geowebColors.background.surface',
1338
1354
  padding: styles.padding,
1339
- zIndex: 1,
1355
+ zIndex: 2,
1340
1356
  cursor: isDraggable ? 'move' : null
1341
1357
  }
1342
1358
  }, /*#__PURE__*/React__default.createElement(Grid, {
@@ -1418,7 +1434,6 @@ var useStyles$5 = makeStyles(function () {
1418
1434
  content: {
1419
1435
  flex: 1,
1420
1436
  overflowY: 'auto',
1421
- zIndex: 2,
1422
1437
  position: 'relative'
1423
1438
  }
1424
1439
  };
@@ -1462,6 +1477,18 @@ var ToolContainer = function ToolContainer(_a) {
1462
1477
  }, children), isResizable && /*#__PURE__*/React__default.createElement(ToolFooter, null));
1463
1478
  };
1464
1479
 
1480
+ var calculateDialogSizeAndPosition = function calculateDialogSizeAndPosition() {
1481
+ var width = window.innerWidth * 0.85;
1482
+ var height = window.innerHeight * 0.85;
1483
+ var top = window.innerHeight * 0.15 / 2;
1484
+ var left = window.innerWidth * 0.15 / 2;
1485
+ return {
1486
+ width: width,
1487
+ height: height,
1488
+ top: top,
1489
+ left: left
1490
+ };
1491
+ };
1465
1492
  var BASE_Z_INDEX = 100;
1466
1493
 
1467
1494
  var DraggableComponent = function DraggableComponent(_a) {
@@ -1596,6 +1623,7 @@ var DraggableComponent = function DraggableComponent(_a) {
1596
1623
  }, /*#__PURE__*/React__default.createElement("div", {
1597
1624
  style: Object.assign({
1598
1625
  position: 'absolute',
1626
+ pointerEvents: 'all',
1599
1627
  zIndex: zIndex
1600
1628
  }, startPosition),
1601
1629
  ref: nodeRef
@@ -2325,101 +2353,6 @@ var CustomSlider = function CustomSlider(_a) {
2325
2353
  }, props));
2326
2354
  };
2327
2355
 
2328
- /* *
2329
- * Licensed under the Apache License, Version 2.0 (the "License");
2330
- * you may not use this file except in compliance with the License.
2331
- * You may obtain a copy of the License at
2332
- *
2333
- * http://www.apache.org/licenses/LICENSE-2.0
2334
- *
2335
- * Unless required by applicable law or agreed to in writing, software
2336
- * distributed under the License is distributed on an "AS IS" BASIS,
2337
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2338
- * See the License for the specific language governing permissions and
2339
- * limitations under the License.
2340
- *
2341
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2342
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
2343
- * */
2344
- var Z_INDEX_TOP = 600;
2345
- var Z_INDEX_BOTTOM = 550;
2346
- var useStyles = makeStyles(function (theme) {
2347
- return createStyles({
2348
- draggableDialog: function draggableDialog(props) {
2349
- return {
2350
- width: props.dialogWidth ? props.dialogWidth : '90%',
2351
- position: 'absolute',
2352
- top: props.dialogTop ? props.dialogTop : '2%',
2353
- left: '5%',
2354
- maxWidth: '90%',
2355
- maxHeight: props.dialogMaxHeight ? props.dialogMaxHeight : '95%',
2356
- display: 'flex',
2357
- flexDirection: 'column',
2358
- overflow: 'hidden',
2359
- zIndex: props.zIndex
2360
- };
2361
- },
2362
- dialogContent: {
2363
- marginTop: '40px',
2364
- overflowY: 'scroll'
2365
- },
2366
- dialogHeader: function dialogHeader(props) {
2367
- return {
2368
- position: 'absolute',
2369
- display: 'flex',
2370
- justifyContent: 'space-between',
2371
- alignItems: 'center',
2372
- boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.12), 0 0 2px 0 rgba(0, 0, 0, 0.14)',
2373
- width: '100%',
2374
- backgroundColor: theme.palette.geowebColors.background.surface,
2375
- zIndex: props.zIndex + 10
2376
- };
2377
- },
2378
- iconClose: {
2379
- padding: theme.spacing(1)
2380
- },
2381
- iconDrag: {
2382
- padding: theme.spacing(1)
2383
- }
2384
- });
2385
- });
2386
-
2387
- var DraggableDialog = function DraggableDialog(_ref) {
2388
- var handleClose = _ref.handleClose,
2389
- title = _ref.title,
2390
- children = _ref.children,
2391
- _ref$dialogStyling = _ref.dialogStyling,
2392
- dialogStyling = _ref$dialogStyling === void 0 ? {} : _ref$dialogStyling,
2393
- _ref$zIndex = _ref.zIndex,
2394
- zIndex = _ref$zIndex === void 0 ? Z_INDEX_TOP : _ref$zIndex;
2395
- var classes = useStyles(Object.assign(Object.assign({}, dialogStyling), {
2396
- zIndex: zIndex
2397
- }));
2398
- return /*#__PURE__*/React.createElement(Draggable, {
2399
- handle: "strong",
2400
- bounds: "body"
2401
- }, /*#__PURE__*/React.createElement(Paper, {
2402
- "data-testid": title,
2403
- className: classes.draggableDialog,
2404
- elevation: 24
2405
- }, /*#__PURE__*/React.createElement("div", {
2406
- className: classes.dialogHeader
2407
- }, /*#__PURE__*/React.createElement("strong", null, /*#__PURE__*/React.createElement(IconButton, {
2408
- "data-testid": "dragDialog",
2409
- size: "small",
2410
- className: classes.iconDrag
2411
- }, /*#__PURE__*/React.createElement(DragIndicator, null))), /*#__PURE__*/React.createElement(Typography, {
2412
- variant: "subtitle1"
2413
- }, title), /*#__PURE__*/React.createElement(IconButton, {
2414
- "data-testid": "closeDialog",
2415
- size: "small",
2416
- onClick: handleClose,
2417
- className: classes.iconClose
2418
- }, /*#__PURE__*/React.createElement(Close, null))), /*#__PURE__*/React.createElement("div", {
2419
- className: classes.dialogContent
2420
- }, children)));
2421
- };
2422
-
2423
2356
  /* *
2424
2357
  * Licensed under the Apache License, Version 2.0 (the "License");
2425
2358
  * you may not use this file except in compliance with the License.
@@ -2591,6 +2524,220 @@ var ToggleMenu = function ToggleMenu(_ref) {
2591
2524
  }), children));
2592
2525
  };
2593
2526
 
2527
+ /* *
2528
+ * Licensed under the Apache License, Version 2.0 (the "License");
2529
+ * you may not use this file except in compliance with the License.
2530
+ * You may obtain a copy of the License at
2531
+ *
2532
+ * http://www.apache.org/licenses/LICENSE-2.0
2533
+ *
2534
+ * Unless required by applicable law or agreed to in writing, software
2535
+ * distributed under the License is distributed on an "AS IS" BASIS,
2536
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2537
+ * See the License for the specific language governing permissions and
2538
+ * limitations under the License.
2539
+ *
2540
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2541
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
2542
+ * */
2543
+ var useStyles = makeStyles(function (theme) {
2544
+ return createStyles({
2545
+ button: {
2546
+ height: 28,
2547
+ width: 28,
2548
+ borderRadius: 5,
2549
+ marginTop: 2,
2550
+ color: function color(_ref) {
2551
+ var isActive = _ref.isActive,
2552
+ isAccessible = _ref.isAccessible,
2553
+ isEnabled = _ref.isEnabled;
2554
+
2555
+ if (!isEnabled) {
2556
+ return theme.palette.geowebColors.buttons.flat.disabled.color;
2557
+ }
2558
+
2559
+ if (isAccessible) {
2560
+ return theme.palette.geowebColors.greys.accessible;
2561
+ }
2562
+
2563
+ if (isActive) {
2564
+ return theme.palette.common.white;
2565
+ }
2566
+
2567
+ return theme.palette.geowebColors.buttons.flat["default"].color;
2568
+ },
2569
+ backgroundColor: function backgroundColor(_ref2) {
2570
+ var isActive = _ref2.isActive;
2571
+ return isActive ? theme.palette.geowebColors.buttons.primary.active.fill : 'inherit';
2572
+ },
2573
+ '&:focus': {
2574
+ backgroundColor: function backgroundColor(_ref3) {
2575
+ var isActive = _ref3.isActive;
2576
+ return isActive ? theme.palette.geowebColors.buttons.primary.mouseOver.fill : theme.palette.geowebColors.buttons.flat.mouseOver.fill;
2577
+ },
2578
+ outline: theme.palette.geowebColors.buttons.focusDefault.outline,
2579
+ borderRadius: 0
2580
+ },
2581
+ '&:hover': {
2582
+ backgroundColor: function backgroundColor(_ref4) {
2583
+ var isActive = _ref4.isActive;
2584
+ return isActive ? theme.palette.geowebColors.buttons.primary.mouseOver.fill : theme.palette.geowebColors.buttons.flat.mouseOver.fill;
2585
+ }
2586
+ }
2587
+ },
2588
+ popper: {
2589
+ pointerEvents: 'none'
2590
+ }
2591
+ });
2592
+ });
2593
+ var ManagerButton = function ManagerButton(_a) {
2594
+ var _a$tooltipTitle = _a.tooltipTitle,
2595
+ tooltipTitle = _a$tooltipTitle === void 0 ? '' : _a$tooltipTitle,
2596
+ _a$onClick = _a.onClick,
2597
+ onClick = _a$onClick === void 0 ? function () {} : _a$onClick,
2598
+ _a$isActive = _a.isActive,
2599
+ isActive = _a$isActive === void 0 ? false : _a$isActive,
2600
+ _a$isEnabled = _a.isEnabled,
2601
+ isEnabled = _a$isEnabled === void 0 ? true : _a$isEnabled,
2602
+ icon = _a.icon,
2603
+ testId = _a.testId,
2604
+ _a$isAccessible = _a.isAccessible,
2605
+ isAccessible = _a$isAccessible === void 0 ? false : _a$isAccessible,
2606
+ className = _a.className,
2607
+ props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "testId", "isAccessible", "className"]);
2608
+
2609
+ var classes = useStyles({
2610
+ isActive: isActive,
2611
+ isEnabled: isEnabled,
2612
+ isAccessible: isAccessible
2613
+ });
2614
+
2615
+ var handleClick = function handleClick(event) {
2616
+ onClick(event);
2617
+ };
2618
+
2619
+ return /*#__PURE__*/React.createElement(Tooltip, {
2620
+ title: tooltipTitle,
2621
+ placement: "top",
2622
+ classes: {
2623
+ popper: classes.popper
2624
+ }
2625
+ }, /*#__PURE__*/React.createElement(IconButton, Object.assign({
2626
+ size: "small",
2627
+ onClick: handleClick,
2628
+ "data-testid": testId,
2629
+ className: "".concat(classes.button, " ").concat(className),
2630
+ disableFocusRipple: true
2631
+ }, props), icon));
2632
+ };
2633
+
2634
+ /* *
2635
+ * Licensed under the Apache License, Version 2.0 (the "License");
2636
+ * you may not use this file except in compliance with the License.
2637
+ * You may obtain a copy of the License at
2638
+ *
2639
+ * http://www.apache.org/licenses/LICENSE-2.0
2640
+ *
2641
+ * Unless required by applicable law or agreed to in writing, software
2642
+ * distributed under the License is distributed on an "AS IS" BASIS,
2643
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2644
+ * See the License for the specific language governing permissions and
2645
+ * limitations under the License.
2646
+ *
2647
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2648
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
2649
+ * */
2650
+ var ManagerDeleteButton = function ManagerDeleteButton(_ref) {
2651
+ var tooltipTitle = _ref.tooltipTitle,
2652
+ onClickDelete = _ref.onClickDelete,
2653
+ _ref$isEnabled = _ref.isEnabled,
2654
+ isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled;
2655
+ return /*#__PURE__*/React.createElement(ManagerButton, {
2656
+ tooltipTitle: tooltipTitle,
2657
+ onClick: onClickDelete,
2658
+ icon: /*#__PURE__*/React.createElement(Delete, {
2659
+ sx: {
2660
+ width: 20,
2661
+ height: 20
2662
+ }
2663
+ }),
2664
+ testId: "deleteButton",
2665
+ isEnabled: isEnabled
2666
+ });
2667
+ };
2668
+
2669
+ /* *
2670
+ * Licensed under the Apache License, Version 2.0 (the "License");
2671
+ * you may not use this file except in compliance with the License.
2672
+ * You may obtain a copy of the License at
2673
+ *
2674
+ * http://www.apache.org/licenses/LICENSE-2.0
2675
+ *
2676
+ * Unless required by applicable law or agreed to in writing, software
2677
+ * distributed under the License is distributed on an "AS IS" BASIS,
2678
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2679
+ * See the License for the specific language governing permissions and
2680
+ * limitations under the License.
2681
+ *
2682
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2683
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
2684
+ * */
2685
+ var EnableButton = function EnableButton(_ref) {
2686
+ var isEnabled = _ref.isEnabled,
2687
+ title = _ref.title,
2688
+ onChangeEnableLayer = _ref.onChangeEnableLayer;
2689
+
2690
+ var onClick = function onClick() {
2691
+ onChangeEnableLayer(!isEnabled);
2692
+ };
2693
+
2694
+ var visibilityIcon = /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("rect", {
2695
+ width: 24,
2696
+ height: 24,
2697
+ fill: "transparent"
2698
+ }), /*#__PURE__*/React.createElement("path", {
2699
+ d: "M14.4980749,15.8618431 C15.8661433,15.0851043 16.779689,13.6936347 16.779689,12.1014551 C16.779689,10.5092755 15.8661433,9.11870594 14.4980749,8.34106705 C17.6257313,9.18620931 19.3529176,11.4300215 19.8092405,12.1014551 C19.3529176,12.7719886 17.6266313,15.0167008 14.4980749,15.8618431 L14.4980749,15.8618431 Z M4.18985949,12.1014551 C4.64618231,11.4300215 6.37336867,9.18710936 9.49922496,8.3419671 C8.13295665,9.11870594 7.21851093,10.5101755 7.21851093,12.1014551 C7.21851093,13.6936347 8.13295665,15.0842042 9.49922496,15.8618431 C6.37336867,15.0167008 4.64618231,12.7728886 4.18985949,12.1014551 L4.18985949,12.1014551 Z M11.99955,13.8583429 C10.9950998,13.8583429 10.180559,13.0717036 10.180559,12.1014551 C10.180559,11.1312066 10.9950998,10.3445672 11.99955,10.3445672 C13.0031002,10.3445672 13.8176409,11.1312066 13.8176409,12.1014551 C13.8176409,13.0717036 13.0031002,13.8583429 11.99955,13.8583429 L11.99955,13.8583429 Z M20.7983899,11.7666383 C20.6813841,11.5713286 17.8696435,7 11.99955,7 C6.12945647,7 3.31681584,11.5713286 3.19980999,11.7666383 L3,12.1014551 L3.19980999,12.4362718 C3.31681584,12.6306815 6.12945647,17.2020101 11.99955,17.2020101 C17.8696435,17.2020101 20.6813841,12.6306815 20.7983899,12.4362718 L21,12.1014551 L20.7983899,11.7666383 Z"
2700
+ }));
2701
+ var visibilityOffIcon = /*#__PURE__*/React.createElement(SvgIcon, {
2702
+ style: {
2703
+ marginTop: 2
2704
+ }
2705
+ }, /*#__PURE__*/React.createElement("rect", {
2706
+ width: 24,
2707
+ height: 24,
2708
+ fill: "transparent"
2709
+ }), /*#__PURE__*/React.createElement("path", {
2710
+ d: "M12 15.309c-.755 0-1.45-.088-2.092-.236l.798-.797c.41.124.844.192 1.294.192 2.453 0 4.442-1.988 4.442-4.44 0-.495-.085-.907-.234-1.255l.03-.03c1.72.906 2.781 2.167 3.218 2.766-.724.992-3.151 3.8-7.456 3.8zm-7.456-3.8c.442-.607 1.522-1.89 3.276-2.796-.166.36-.261.79-.261 1.315 0 1.228.499 2.34 1.305 3.144l-1.102 1.104c-1.72-.906-2.78-2.169-3.218-2.767zm5.646-3.524c.818 0 1.482.665 1.482 1.483 0 .818-.664 1.481-1.482 1.481s-1.482-.663-1.482-1.481c0-.818.664-1.483 1.482-1.483zm10.608 3.19c-.073-.125-1.245-2.026-3.603-3.388l2.009-2.01c.406-.406.406-1.065 0-1.473-.407-.405-1.066-.405-1.473 0l-2.58 2.582c-.93-.295-1.98-.478-3.151-.478-5.87 0-8.681 4.57-8.798 4.766L3 11.51l.202.335c.073.124 1.244 2.025 3.603 3.387l-2.009 2.01c-.406.406-.406 1.065 0 1.472.204.203.47.305.737.305.266 0 .532-.102.736-.305l2.58-2.58c.93.293 1.98.476 3.151.476 5.87 0 8.681-4.57 8.798-4.765l.202-.335-.202-.335z"
2711
+ }));
2712
+ return /*#__PURE__*/React.createElement(ManagerButton, {
2713
+ tooltipTitle: title,
2714
+ onClick: onClick,
2715
+ icon: /*#__PURE__*/React.createElement(Checkbox, {
2716
+ sx: {
2717
+ color: 'inherit',
2718
+ padding: 0.5,
2719
+ borderRadius: 1.25,
2720
+ '&.Mui-focusVisible': {
2721
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2722
+ },
2723
+ '&:hover': {
2724
+ backgroundColor: 'transparent!important'
2725
+ },
2726
+ '&.Mui-checked': {
2727
+ color: 'inherit'
2728
+ }
2729
+ },
2730
+ icon: visibilityOffIcon,
2731
+ checkedIcon: visibilityIcon,
2732
+ checked: isEnabled,
2733
+ disableFocusRipple: true,
2734
+ tabIndex: -1
2735
+ }),
2736
+ testId: "enableLayer",
2737
+ isEnabled: isEnabled
2738
+ });
2739
+ };
2740
+
2594
2741
  /* *
2595
2742
  * Licensed under the Apache License, Version 2.0 (the "License");
2596
2743
  * you may not use this file except in compliance with the License.
@@ -2625,4 +2772,4 @@ var getAxiosErrorMessage = function getAxiosErrorMessage(error) {
2625
2772
  return 'An error has occurred';
2626
2773
  };
2627
2774
 
2628
- export { AlertBanner, AppHeader, AppLayout, ConfirmationDialog, ConfirmationServiceProvider, CustomSlider, CustomToggleButton, DraggableComponent$1 as Draggable, DraggableDialog, ErrorBoundary, HIDDEN_INPUT_HELPER_IS_DRAFT, ResizeComponent as Resizable, StatusTag, ToggleMenu, ToolButton, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, Z_INDEX_BOTTOM, Z_INDEX_TOP, getAxiosErrorMessage, getInitials, isAxiosError, showPrompt, sliderStyles, useConfirmationDialog, useDialogActions, useDraftFormHelpers, useIsMounted, usePoller, usePreventBrowserClose, usePrevious, useUserMenu };
2775
+ export { AlertBanner, AppHeader, AppLayout, ConfirmationDialog, ConfirmationServiceProvider, CustomSlider, CustomToggleButton, DraggableComponent$1 as Draggable, EnableButton, ErrorBoundary, HIDDEN_INPUT_HELPER_IS_DRAFT, ManagerButton, ManagerDeleteButton, ResizeComponent as Resizable, StatusTag, ToggleMenu, ToolButton, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, calculateDialogSizeAndPosition, getAxiosErrorMessage, getInitials, isAxiosError, showPrompt, sliderStyles, useConfirmationDialog, useDialogActions, useDraftFormHelpers, useIsMounted, usePoller, usePreventBrowserClose, usePrevious, useUserMenu };
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/styles/createStyles'), require('@mui/icons-material/MoreVert')) :
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/styles/createStyles', '@mui/icons-material/MoreVert'], 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.createStyles, global.MoreVertIcon));
5
- })(this, (function (exports, React, material, makeStyles, iconsMaterial, reactHookForm, formFields, Draggable, reResizable, theme, lodash, withStyles, createStyles, MoreVertIcon) { 'use strict';
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';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -29,8 +29,8 @@
29
29
  var makeStyles__default = /*#__PURE__*/_interopDefaultLegacy(makeStyles);
30
30
  var Draggable__default = /*#__PURE__*/_interopDefaultLegacy(Draggable);
31
31
  var withStyles__default = /*#__PURE__*/_interopDefaultLegacy(withStyles);
32
- var createStyles__default = /*#__PURE__*/_interopDefaultLegacy(createStyles);
33
32
  var MoreVertIcon__default = /*#__PURE__*/_interopDefaultLegacy(MoreVertIcon);
33
+ var createStyles__default = /*#__PURE__*/_interopDefaultLegacy(createStyles);
34
34
 
35
35
  /*! *****************************************************************************
36
36
  Copyright (c) Microsoft Corporation.
@@ -507,7 +507,8 @@
507
507
  title: {
508
508
  fontSize: '14px',
509
509
  fontWeight: 'normal',
510
- marginTop: '0px!important'
510
+ marginTop: '0px!important',
511
+ paddingTop: '0px!important'
511
512
  },
512
513
  info: {
513
514
  fontSize: '16px'
@@ -524,8 +525,7 @@
524
525
  fill: "transparent"
525
526
  }), /*#__PURE__*/React__namespace.createElement("path", {
526
527
  d: "M12 4c4.418 0 8 3.581 8 8 0 4.418-3.582 8-8 8s-8-3.582-8-8c0-4.419 3.582-8 8-8zm1.052 6H10v1.613h.949v3.774H10V17h4v-1.613h-.948V10zM11.99 6c-.837 0-1.491.654-1.491 1.49 0 .837.654 1.51 1.49 1.51.837 0 1.51-.673 1.51-1.51 0-.836-.673-1.49-1.51-1.49z",
527
- transform: "translate(-946.000000, -368.000000) translate(930.000000, 356.000000) translate(16.000000, 12.000000)",
528
- fill: "#0062E6"
528
+ transform: "translate(-946.000000, -368.000000) translate(930.000000, 356.000000) translate(16.000000, 12.000000)"
529
529
  }));
530
530
 
531
531
  case 'success':
@@ -535,8 +535,7 @@
535
535
  fill: "transparent"
536
536
  }), /*#__PURE__*/React__namespace.createElement("path", {
537
537
  d: "M16.51 10.034l-5.633 5.633-3.387-3.386c-.369-.37-.369-.973 0-1.343.36-.357.983-.357 1.342 0l2.045 2.046 4.292-4.291c.357-.357.983-.359 1.342 0 .368.369.368.97 0 1.341M12 4C7.582 4 4 7.582 4 12s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8",
538
- transform: "translate(-96.000000, -368.000000) translate(80.000000, 356.000000) translate(16.000000, 12.000000)",
539
- fill: "#72BB23"
538
+ transform: "translate(-96.000000, -368.000000) translate(80.000000, 356.000000) translate(16.000000, 12.000000)"
540
539
  }));
541
540
 
542
541
  case 'warning':
@@ -546,8 +545,7 @@
546
545
  fill: "transparent"
547
546
  }), /*#__PURE__*/React__namespace.createElement("path", {
548
547
  d: "M12.862 16.72c-.22.226-.507.339-.86.339-.364 0-.662-.113-.894-.34-.232-.226-.347-.52-.347-.885 0-.32.118-.59.356-.81.236-.22.531-.331.884-.331.332 0 .613.11.845.33.232.222.347.491.347.811 0 .365-.11.66-.33.886zm.216-9.805l-.134 6.669H11.06l-.15-6.67h2.169zM12 4.5c-4.141 0-7.5 3.359-7.5 7.501s3.359 7.5 7.5 7.5c4.142 0 7.5-3.358 7.5-7.5C19.5 7.86 16.142 4.5 12 4.5z",
549
- transform: "translate(-521.000000, -368.000000) translate(505.000000, 356.000000) translate(16.000000, 12.000000)",
550
- fill: "#FFA800"
548
+ transform: "translate(-521.000000, -368.000000) translate(505.000000, 356.000000) translate(16.000000, 12.000000)"
551
549
  }));
552
550
 
553
551
  case 'error':
@@ -558,8 +556,7 @@
558
556
  fill: "transparent"
559
557
  }), /*#__PURE__*/React__namespace.createElement("path", {
560
558
  d: "M12.862 16.72c-.22.226-.507.339-.86.339-.364 0-.662-.113-.894-.34-.232-.226-.347-.52-.347-.885 0-.32.118-.59.356-.81.236-.22.531-.331.884-.331.332 0 .613.11.845.33.232.222.347.491.347.811 0 .365-.11.66-.33.886zm.216-9.805l-.134 6.669H11.06l-.15-6.67h2.169zM12 4.5c-4.141 0-7.5 3.359-7.5 7.501s3.359 7.5 7.5 7.5c4.142 0 7.5-3.358 7.5-7.5C19.5 7.86 16.142 4.5 12 4.5z",
561
- transform: "translate(-1371.000000, -368.000000) translate(1355.000000, 356.000000) translate(16.000000, 12.000000)",
562
- fill: "#C00000"
559
+ transform: "translate(-1371.000000, -368.000000) translate(1355.000000, 356.000000) translate(16.000000, 12.000000)"
563
560
  }));
564
561
  }
565
562
  };
@@ -571,12 +568,31 @@
571
568
  _c = _a.info,
572
569
  info = _c === void 0 ? '' : _c,
573
570
  _d = _a.dataTestId,
574
- dataTestId = _d === void 0 ? 'alert-banner' : _d;
571
+ dataTestId = _d === void 0 ? 'alert-banner' : _d,
572
+ _e = _a.isCompact,
573
+ isCompact = _e === void 0 ? false : _e;
575
574
  var classes = useStyles$a();
576
575
  return /*#__PURE__*/React__namespace.createElement(material.Alert, {
577
576
  "data-testid": dataTestId,
578
577
  severity: severity,
579
- icon: getIcon(severity)
578
+ icon: getIcon(severity),
579
+ sx: isCompact ? {
580
+ height: '32px',
581
+ boxSizing: 'border-box',
582
+ '& .MuiAlert-message': {
583
+ padding: '0px',
584
+ whiteSpace: 'nowrap',
585
+ overflow: 'hidden',
586
+ textOverflow: 'ellipsis',
587
+ '& .MuiTypography-root': {
588
+ display: 'inline'
589
+ }
590
+ },
591
+ '& .MuiAlert-icon': {
592
+ margin: '-3px 10px 0px 0px',
593
+ padding: '0px'
594
+ }
595
+ } : {}
580
596
  }, /*#__PURE__*/React__namespace.createElement(material.AlertTitle, {
581
597
  className: classes.title
582
598
  }, title), info && /*#__PURE__*/React__namespace.createElement("div", {
@@ -1195,7 +1211,7 @@
1195
1211
  boxShadow: 1,
1196
1212
  backgroundColor: 'geowebColors.background.surface',
1197
1213
  padding: styles.padding,
1198
- zIndex: 1,
1214
+ zIndex: 2,
1199
1215
  cursor: isDraggable ? 'move' : null
1200
1216
  }
1201
1217
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
@@ -1277,7 +1293,6 @@
1277
1293
  content: {
1278
1294
  flex: 1,
1279
1295
  overflowY: 'auto',
1280
- zIndex: 2,
1281
1296
  position: 'relative'
1282
1297
  }
1283
1298
  };
@@ -1339,6 +1354,19 @@
1339
1354
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1340
1355
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1341
1356
  * */
1357
+
1358
+ var calculateDialogSizeAndPosition = function calculateDialogSizeAndPosition() {
1359
+ var width = window.innerWidth * 0.85;
1360
+ var height = window.innerHeight * 0.85;
1361
+ var top = window.innerHeight * 0.15 / 2;
1362
+ var left = window.innerWidth * 0.15 / 2;
1363
+ return {
1364
+ width: width,
1365
+ height: height,
1366
+ top: top,
1367
+ left: left
1368
+ };
1369
+ };
1342
1370
  var BASE_Z_INDEX = 100;
1343
1371
 
1344
1372
  var DraggableComponent = function DraggableComponent(_a) {
@@ -1470,6 +1498,7 @@
1470
1498
  }, /*#__PURE__*/React__default["default"].createElement("div", {
1471
1499
  style: __assign({
1472
1500
  position: 'absolute',
1501
+ pointerEvents: 'all',
1473
1502
  zIndex: zIndex
1474
1503
  }, startPosition),
1475
1504
  ref: nodeRef
@@ -2216,85 +2245,6 @@
2216
2245
  }, props));
2217
2246
  };
2218
2247
 
2219
- var Z_INDEX_TOP = 600;
2220
- var Z_INDEX_BOTTOM = 550;
2221
- var useStyles = makeStyles__default["default"](function (theme) {
2222
- return createStyles__default["default"]({
2223
- draggableDialog: function draggableDialog(props) {
2224
- return {
2225
- width: props.dialogWidth ? props.dialogWidth : '90%',
2226
- position: 'absolute',
2227
- top: props.dialogTop ? props.dialogTop : '2%',
2228
- left: '5%',
2229
- maxWidth: '90%',
2230
- maxHeight: props.dialogMaxHeight ? props.dialogMaxHeight : '95%',
2231
- display: 'flex',
2232
- flexDirection: 'column',
2233
- overflow: 'hidden',
2234
- zIndex: props.zIndex
2235
- };
2236
- },
2237
- dialogContent: {
2238
- marginTop: '40px',
2239
- overflowY: 'scroll'
2240
- },
2241
- dialogHeader: function dialogHeader(props) {
2242
- return {
2243
- position: 'absolute',
2244
- display: 'flex',
2245
- justifyContent: 'space-between',
2246
- alignItems: 'center',
2247
- boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.12), 0 0 2px 0 rgba(0, 0, 0, 0.14)',
2248
- width: '100%',
2249
- backgroundColor: theme.palette.geowebColors.background.surface,
2250
- zIndex: props.zIndex + 10
2251
- };
2252
- },
2253
- iconClose: {
2254
- padding: theme.spacing(1)
2255
- },
2256
- iconDrag: {
2257
- padding: theme.spacing(1)
2258
- }
2259
- });
2260
- });
2261
-
2262
- var DraggableDialog = function DraggableDialog(_a) {
2263
- var handleClose = _a.handleClose,
2264
- title = _a.title,
2265
- children = _a.children,
2266
- _b = _a.dialogStyling,
2267
- dialogStyling = _b === void 0 ? {} : _b,
2268
- _c = _a.zIndex,
2269
- zIndex = _c === void 0 ? Z_INDEX_TOP : _c;
2270
- var classes = useStyles(__assign(__assign({}, dialogStyling), {
2271
- zIndex: zIndex
2272
- }));
2273
- return /*#__PURE__*/React__namespace.createElement(Draggable__default["default"], {
2274
- handle: "strong",
2275
- bounds: "body"
2276
- }, /*#__PURE__*/React__namespace.createElement(material.Paper, {
2277
- "data-testid": title,
2278
- className: classes.draggableDialog,
2279
- elevation: 24
2280
- }, /*#__PURE__*/React__namespace.createElement("div", {
2281
- className: classes.dialogHeader
2282
- }, /*#__PURE__*/React__namespace.createElement("strong", null, /*#__PURE__*/React__namespace.createElement(material.IconButton, {
2283
- "data-testid": "dragDialog",
2284
- size: "small",
2285
- className: classes.iconDrag
2286
- }, /*#__PURE__*/React__namespace.createElement(iconsMaterial.DragIndicator, null))), /*#__PURE__*/React__namespace.createElement(material.Typography, {
2287
- variant: "subtitle1"
2288
- }, title), /*#__PURE__*/React__namespace.createElement(material.IconButton, {
2289
- "data-testid": "closeDialog",
2290
- size: "small",
2291
- onClick: handleClose,
2292
- className: classes.iconClose
2293
- }, /*#__PURE__*/React__namespace.createElement(iconsMaterial.Close, null))), /*#__PURE__*/React__namespace.createElement("div", {
2294
- className: classes.dialogContent
2295
- }, children)));
2296
- };
2297
-
2298
2248
  /* *
2299
2249
  * Licensed under the Apache License, Version 2.0 (the "License");
2300
2250
  * you may not use this file except in compliance with the License.
@@ -2465,6 +2415,220 @@
2465
2415
  }), children));
2466
2416
  };
2467
2417
 
2418
+ /* *
2419
+ * Licensed under the Apache License, Version 2.0 (the "License");
2420
+ * you may not use this file except in compliance with the License.
2421
+ * You may obtain a copy of the License at
2422
+ *
2423
+ * http://www.apache.org/licenses/LICENSE-2.0
2424
+ *
2425
+ * Unless required by applicable law or agreed to in writing, software
2426
+ * distributed under the License is distributed on an "AS IS" BASIS,
2427
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2428
+ * See the License for the specific language governing permissions and
2429
+ * limitations under the License.
2430
+ *
2431
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2432
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
2433
+ * */
2434
+ var useStyles = makeStyles__default["default"](function (theme) {
2435
+ return createStyles__default["default"]({
2436
+ button: {
2437
+ height: 28,
2438
+ width: 28,
2439
+ borderRadius: 5,
2440
+ marginTop: 2,
2441
+ color: function color(_a) {
2442
+ var isActive = _a.isActive,
2443
+ isAccessible = _a.isAccessible,
2444
+ isEnabled = _a.isEnabled;
2445
+
2446
+ if (!isEnabled) {
2447
+ return theme.palette.geowebColors.buttons.flat.disabled.color;
2448
+ }
2449
+
2450
+ if (isAccessible) {
2451
+ return theme.palette.geowebColors.greys.accessible;
2452
+ }
2453
+
2454
+ if (isActive) {
2455
+ return theme.palette.common.white;
2456
+ }
2457
+
2458
+ return theme.palette.geowebColors.buttons.flat["default"].color;
2459
+ },
2460
+ backgroundColor: function backgroundColor(_a) {
2461
+ var isActive = _a.isActive;
2462
+ return isActive ? theme.palette.geowebColors.buttons.primary.active.fill : 'inherit';
2463
+ },
2464
+ '&:focus': {
2465
+ backgroundColor: function backgroundColor(_a) {
2466
+ var isActive = _a.isActive;
2467
+ return isActive ? theme.palette.geowebColors.buttons.primary.mouseOver.fill : theme.palette.geowebColors.buttons.flat.mouseOver.fill;
2468
+ },
2469
+ outline: theme.palette.geowebColors.buttons.focusDefault.outline,
2470
+ borderRadius: 0
2471
+ },
2472
+ '&:hover': {
2473
+ backgroundColor: function backgroundColor(_a) {
2474
+ var isActive = _a.isActive;
2475
+ return isActive ? theme.palette.geowebColors.buttons.primary.mouseOver.fill : theme.palette.geowebColors.buttons.flat.mouseOver.fill;
2476
+ }
2477
+ }
2478
+ },
2479
+ popper: {
2480
+ pointerEvents: 'none'
2481
+ }
2482
+ });
2483
+ });
2484
+ var ManagerButton = function ManagerButton(_a) {
2485
+ var _b = _a.tooltipTitle,
2486
+ tooltipTitle = _b === void 0 ? '' : _b,
2487
+ _c = _a.onClick,
2488
+ onClick = _c === void 0 ? function () {} : _c,
2489
+ _d = _a.isActive,
2490
+ isActive = _d === void 0 ? false : _d,
2491
+ _e = _a.isEnabled,
2492
+ isEnabled = _e === void 0 ? true : _e,
2493
+ icon = _a.icon,
2494
+ testId = _a.testId,
2495
+ _f = _a.isAccessible,
2496
+ isAccessible = _f === void 0 ? false : _f,
2497
+ className = _a.className,
2498
+ props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "testId", "isAccessible", "className"]);
2499
+
2500
+ var classes = useStyles({
2501
+ isActive: isActive,
2502
+ isEnabled: isEnabled,
2503
+ isAccessible: isAccessible
2504
+ });
2505
+
2506
+ var handleClick = function handleClick(event) {
2507
+ onClick(event);
2508
+ };
2509
+
2510
+ return /*#__PURE__*/React__namespace.createElement(material.Tooltip, {
2511
+ title: tooltipTitle,
2512
+ placement: "top",
2513
+ classes: {
2514
+ popper: classes.popper
2515
+ }
2516
+ }, /*#__PURE__*/React__namespace.createElement(material.IconButton, __assign({
2517
+ size: "small",
2518
+ onClick: handleClick,
2519
+ "data-testid": testId,
2520
+ className: classes.button + " " + className,
2521
+ disableFocusRipple: true
2522
+ }, props), icon));
2523
+ };
2524
+
2525
+ /* *
2526
+ * Licensed under the Apache License, Version 2.0 (the "License");
2527
+ * you may not use this file except in compliance with the License.
2528
+ * You may obtain a copy of the License at
2529
+ *
2530
+ * http://www.apache.org/licenses/LICENSE-2.0
2531
+ *
2532
+ * Unless required by applicable law or agreed to in writing, software
2533
+ * distributed under the License is distributed on an "AS IS" BASIS,
2534
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2535
+ * See the License for the specific language governing permissions and
2536
+ * limitations under the License.
2537
+ *
2538
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2539
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
2540
+ * */
2541
+ var ManagerDeleteButton = function ManagerDeleteButton(_a) {
2542
+ var tooltipTitle = _a.tooltipTitle,
2543
+ onClickDelete = _a.onClickDelete,
2544
+ _b = _a.isEnabled,
2545
+ isEnabled = _b === void 0 ? true : _b;
2546
+ return /*#__PURE__*/React__namespace.createElement(ManagerButton, {
2547
+ tooltipTitle: tooltipTitle,
2548
+ onClick: onClickDelete,
2549
+ icon: /*#__PURE__*/React__namespace.createElement(iconsMaterial.Delete, {
2550
+ sx: {
2551
+ width: 20,
2552
+ height: 20
2553
+ }
2554
+ }),
2555
+ testId: "deleteButton",
2556
+ isEnabled: isEnabled
2557
+ });
2558
+ };
2559
+
2560
+ /* *
2561
+ * Licensed under the Apache License, Version 2.0 (the "License");
2562
+ * you may not use this file except in compliance with the License.
2563
+ * You may obtain a copy of the License at
2564
+ *
2565
+ * http://www.apache.org/licenses/LICENSE-2.0
2566
+ *
2567
+ * Unless required by applicable law or agreed to in writing, software
2568
+ * distributed under the License is distributed on an "AS IS" BASIS,
2569
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2570
+ * See the License for the specific language governing permissions and
2571
+ * limitations under the License.
2572
+ *
2573
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2574
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
2575
+ * */
2576
+ var EnableButton = function EnableButton(_a) {
2577
+ var isEnabled = _a.isEnabled,
2578
+ title = _a.title,
2579
+ onChangeEnableLayer = _a.onChangeEnableLayer;
2580
+
2581
+ var onClick = function onClick() {
2582
+ onChangeEnableLayer(!isEnabled);
2583
+ };
2584
+
2585
+ var visibilityIcon = /*#__PURE__*/React__namespace.createElement(material.SvgIcon, null, /*#__PURE__*/React__namespace.createElement("rect", {
2586
+ width: 24,
2587
+ height: 24,
2588
+ fill: "transparent"
2589
+ }), /*#__PURE__*/React__namespace.createElement("path", {
2590
+ d: "M14.4980749,15.8618431 C15.8661433,15.0851043 16.779689,13.6936347 16.779689,12.1014551 C16.779689,10.5092755 15.8661433,9.11870594 14.4980749,8.34106705 C17.6257313,9.18620931 19.3529176,11.4300215 19.8092405,12.1014551 C19.3529176,12.7719886 17.6266313,15.0167008 14.4980749,15.8618431 L14.4980749,15.8618431 Z M4.18985949,12.1014551 C4.64618231,11.4300215 6.37336867,9.18710936 9.49922496,8.3419671 C8.13295665,9.11870594 7.21851093,10.5101755 7.21851093,12.1014551 C7.21851093,13.6936347 8.13295665,15.0842042 9.49922496,15.8618431 C6.37336867,15.0167008 4.64618231,12.7728886 4.18985949,12.1014551 L4.18985949,12.1014551 Z M11.99955,13.8583429 C10.9950998,13.8583429 10.180559,13.0717036 10.180559,12.1014551 C10.180559,11.1312066 10.9950998,10.3445672 11.99955,10.3445672 C13.0031002,10.3445672 13.8176409,11.1312066 13.8176409,12.1014551 C13.8176409,13.0717036 13.0031002,13.8583429 11.99955,13.8583429 L11.99955,13.8583429 Z M20.7983899,11.7666383 C20.6813841,11.5713286 17.8696435,7 11.99955,7 C6.12945647,7 3.31681584,11.5713286 3.19980999,11.7666383 L3,12.1014551 L3.19980999,12.4362718 C3.31681584,12.6306815 6.12945647,17.2020101 11.99955,17.2020101 C17.8696435,17.2020101 20.6813841,12.6306815 20.7983899,12.4362718 L21,12.1014551 L20.7983899,11.7666383 Z"
2591
+ }));
2592
+ var visibilityOffIcon = /*#__PURE__*/React__namespace.createElement(material.SvgIcon, {
2593
+ style: {
2594
+ marginTop: 2
2595
+ }
2596
+ }, /*#__PURE__*/React__namespace.createElement("rect", {
2597
+ width: 24,
2598
+ height: 24,
2599
+ fill: "transparent"
2600
+ }), /*#__PURE__*/React__namespace.createElement("path", {
2601
+ d: "M12 15.309c-.755 0-1.45-.088-2.092-.236l.798-.797c.41.124.844.192 1.294.192 2.453 0 4.442-1.988 4.442-4.44 0-.495-.085-.907-.234-1.255l.03-.03c1.72.906 2.781 2.167 3.218 2.766-.724.992-3.151 3.8-7.456 3.8zm-7.456-3.8c.442-.607 1.522-1.89 3.276-2.796-.166.36-.261.79-.261 1.315 0 1.228.499 2.34 1.305 3.144l-1.102 1.104c-1.72-.906-2.78-2.169-3.218-2.767zm5.646-3.524c.818 0 1.482.665 1.482 1.483 0 .818-.664 1.481-1.482 1.481s-1.482-.663-1.482-1.481c0-.818.664-1.483 1.482-1.483zm10.608 3.19c-.073-.125-1.245-2.026-3.603-3.388l2.009-2.01c.406-.406.406-1.065 0-1.473-.407-.405-1.066-.405-1.473 0l-2.58 2.582c-.93-.295-1.98-.478-3.151-.478-5.87 0-8.681 4.57-8.798 4.766L3 11.51l.202.335c.073.124 1.244 2.025 3.603 3.387l-2.009 2.01c-.406.406-.406 1.065 0 1.472.204.203.47.305.737.305.266 0 .532-.102.736-.305l2.58-2.58c.93.293 1.98.476 3.151.476 5.87 0 8.681-4.57 8.798-4.765l.202-.335-.202-.335z"
2602
+ }));
2603
+ return /*#__PURE__*/React__namespace.createElement(ManagerButton, {
2604
+ tooltipTitle: title,
2605
+ onClick: onClick,
2606
+ icon: /*#__PURE__*/React__namespace.createElement(material.Checkbox, {
2607
+ sx: {
2608
+ color: 'inherit',
2609
+ padding: 0.5,
2610
+ borderRadius: 1.25,
2611
+ '&.Mui-focusVisible': {
2612
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2613
+ },
2614
+ '&:hover': {
2615
+ backgroundColor: 'transparent!important'
2616
+ },
2617
+ '&.Mui-checked': {
2618
+ color: 'inherit'
2619
+ }
2620
+ },
2621
+ icon: visibilityOffIcon,
2622
+ checkedIcon: visibilityIcon,
2623
+ checked: isEnabled,
2624
+ disableFocusRipple: true,
2625
+ tabIndex: -1
2626
+ }),
2627
+ testId: "enableLayer",
2628
+ isEnabled: isEnabled
2629
+ });
2630
+ };
2631
+
2468
2632
  /* *
2469
2633
  * Licensed under the Apache License, Version 2.0 (the "License");
2470
2634
  * you may not use this file except in compliance with the License.
@@ -2507,9 +2671,11 @@
2507
2671
  exports.CustomSlider = CustomSlider;
2508
2672
  exports.CustomToggleButton = CustomToggleButton;
2509
2673
  exports.Draggable = DraggableComponent$1;
2510
- exports.DraggableDialog = DraggableDialog;
2674
+ exports.EnableButton = EnableButton;
2511
2675
  exports.ErrorBoundary = ErrorBoundary;
2512
2676
  exports.HIDDEN_INPUT_HELPER_IS_DRAFT = HIDDEN_INPUT_HELPER_IS_DRAFT;
2677
+ exports.ManagerButton = ManagerButton;
2678
+ exports.ManagerDeleteButton = ManagerDeleteButton;
2513
2679
  exports.Resizable = ResizeComponent;
2514
2680
  exports.StatusTag = StatusTag;
2515
2681
  exports.ToggleMenu = ToggleMenu;
@@ -2521,8 +2687,7 @@
2521
2687
  exports.UserMenu = UserMenu;
2522
2688
  exports.UserMenuItemCheatSheet = UserMenuItemCheatSheet;
2523
2689
  exports.UserMenuItemTheme = MenuItemTheme;
2524
- exports.Z_INDEX_BOTTOM = Z_INDEX_BOTTOM;
2525
- exports.Z_INDEX_TOP = Z_INDEX_TOP;
2690
+ exports.calculateDialogSizeAndPosition = calculateDialogSizeAndPosition;
2526
2691
  exports.getAxiosErrorMessage = getAxiosErrorMessage;
2527
2692
  exports.getInitials = getInitials;
2528
2693
  exports.isAxiosError = isAxiosError;
@@ -5,6 +5,7 @@ interface AlertBannerProps {
5
5
  severity?: AlertColor;
6
6
  info?: string | React.ReactElement;
7
7
  dataTestId?: string;
8
+ isCompact?: boolean;
8
9
  }
9
10
  declare const AlertBanner: React.FC<AlertBannerProps>;
10
11
  export default AlertBanner;
@@ -3,7 +3,15 @@ declare const _default: {
3
3
  title: string;
4
4
  };
5
5
  export default _default;
6
- export declare const AlertBanners: {
6
+ export declare const AlertBannersGWTheme: {
7
+ (): React.ReactElement;
8
+ storyName: string;
9
+ };
10
+ export declare const AlertBannersLight: {
11
+ (): React.ReactElement;
12
+ storyName: string;
13
+ };
14
+ export declare const AlertBannersDark: {
7
15
  (): React.ReactElement;
8
16
  storyName: string;
9
17
  };
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ interface EnableLayerProps {
3
+ isEnabled?: boolean;
4
+ title: string;
5
+ onChangeEnableLayer: (enable: boolean) => void;
6
+ }
7
+ export declare const EnableButton: React.FC<EnableLayerProps>;
8
+ export {};
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ declare const _default: {
3
+ title: string;
4
+ };
5
+ export default _default;
6
+ export declare const EnableButtonLight: {
7
+ (): React.ReactElement;
8
+ storyName: string;
9
+ };
10
+ export declare const EnableButtonDark: {
11
+ (): React.ReactElement;
12
+ storyName: string;
13
+ };
@@ -0,0 +1 @@
1
+ export * from './EnableButton';
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ import { IconButtonProps } from '@mui/material';
3
+ interface ManagerButtonProps extends IconButtonProps {
4
+ tooltipTitle: string;
5
+ onClick?: (event: React.MouseEvent) => void;
6
+ isActive?: boolean;
7
+ isEnabled?: boolean;
8
+ icon: React.ReactNode;
9
+ testId: string;
10
+ isAccessible?: boolean;
11
+ }
12
+ export declare const ManagerButton: React.FC<ManagerButtonProps>;
13
+ export {};
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ declare const _default: {
3
+ title: string;
4
+ };
5
+ export default _default;
6
+ export declare const ManagerButtonLight: {
7
+ (): React.ReactElement;
8
+ storyName: string;
9
+ };
10
+ export declare const ManagerButtonDark: {
11
+ (): React.ReactElement;
12
+ storyName: string;
13
+ };
@@ -0,0 +1 @@
1
+ export * from './ManagerButton';
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ interface DeleteButtonProps {
3
+ tooltipTitle: string;
4
+ onClickDelete: () => void;
5
+ isEnabled?: boolean;
6
+ }
7
+ export declare const ManagerDeleteButton: React.FC<DeleteButtonProps>;
8
+ export {};
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ declare const _default: {
3
+ title: string;
4
+ };
5
+ export default _default;
6
+ export declare const ManagerDeleteButtonLight: {
7
+ (): React.ReactElement;
8
+ storyName: string;
9
+ };
10
+ export declare const ManagerDeleteButtonDark: {
11
+ (): React.ReactElement;
12
+ storyName: string;
13
+ };
@@ -0,0 +1 @@
1
+ export * from './ManagerDeleteButton';
@@ -0,0 +1,4 @@
1
+ export * from './ManagerButton';
2
+ export * from './ManagerDeleteButton';
3
+ export * from './EnableButton';
4
+ export * from './styles';
@@ -0,0 +1,5 @@
1
+ export interface ManagerButtonStyle {
2
+ isActive?: boolean;
3
+ isEnabled?: boolean;
4
+ isAccessible?: boolean;
5
+ }
@@ -1,6 +1,12 @@
1
1
  import React from 'react';
2
2
  import { ResizableComponentProps, Size } from '../DraggableResizable/types';
3
3
  import { HeaderSize } from './types';
4
+ export declare const calculateDialogSizeAndPosition: () => {
5
+ width: number;
6
+ height: number;
7
+ top: number;
8
+ left: number;
9
+ };
4
10
  interface DraggableComponentProps extends Omit<ResizableComponentProps, 'bounds'> {
5
11
  onStartResize?: () => void;
6
12
  isOpen?: boolean;
@@ -1,5 +1,6 @@
1
1
  export { default as ToolContainer } from './ToolContainer';
2
2
  export { default as ToolContainerDraggable } from './ToolContainerDraggable';
3
+ export { calculateDialogSizeAndPosition } from './ToolContainerDraggable';
3
4
  export { default as ToolHeader } from './ToolHeader';
4
5
  export { default as ToolFooter } from './ToolFooter';
5
6
  export * from './types';
@@ -8,7 +8,7 @@ export * from './ErrorBoundary';
8
8
  export * from './UserMenu';
9
9
  export * from './ToolContainer';
10
10
  export * from './CustomSlider';
11
- export * from './DraggableDialog';
12
11
  export * from './CustomToggleButton';
13
12
  export * from './ToolButton';
14
13
  export * from './ToggleMenu';
14
+ export * from './Manager';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,13 +14,13 @@
14
14
  "peerDependencies": {
15
15
  "react": "^17.0.2",
16
16
  "@mui/material": "^5.2.8",
17
- "@opengeoweb/theme": "2.3.0",
17
+ "@opengeoweb/theme": "2.4.0",
18
18
  "@mui/styles": "^5.2.3",
19
19
  "@mui/icons-material": "^5.2.5",
20
20
  "react-draggable": "^4.4.3",
21
21
  "re-resizable": "^6.9.0",
22
22
  "lodash": "^4.17.20",
23
- "@opengeoweb/form-fields": "2.3.0",
23
+ "@opengeoweb/form-fields": "2.4.0",
24
24
  "react-hook-form": "^6.12.1",
25
25
  "moment": "^2.29.0",
26
26
  "moment-timezone": "^0.5.31",
@@ -1,16 +0,0 @@
1
- import * as React from 'react';
2
- export declare const Z_INDEX_TOP = 600;
3
- export declare const Z_INDEX_BOTTOM = 550;
4
- interface DraggableDialogProps {
5
- handleClose: () => void;
6
- title: string;
7
- children?: React.ReactNode;
8
- dialogStyling?: {
9
- dialogWidth?: string;
10
- dialogMaxHeight?: string;
11
- dialogTop?: string;
12
- };
13
- zIndex?: number;
14
- }
15
- declare const DraggableDialog: React.FC<DraggableDialogProps>;
16
- export default DraggableDialog;
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- declare const _default: {
3
- title: string;
4
- };
5
- export default _default;
6
- export declare const DraggableDialogOldTheme: () => React.ReactElement;
@@ -1 +0,0 @@
1
- export { default as DraggableDialog, Z_INDEX_TOP, Z_INDEX_BOTTOM, } from './DraggableDialog';