@opengeoweb/shared 2.3.0 → 2.5.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 (27) hide show
  1. package/index.esm.js +327 -146
  2. package/index.umd.js +332 -133
  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/ConfirmationDialog/ConfirmationDialog.stories.d.ts +10 -2
  6. package/lib/components/Manager/EnableButton/EnableButton.d.ts +8 -0
  7. package/lib/components/{DraggableDialog/DraggableDialog.spec.d.ts → Manager/EnableButton/EnableButton.spec.d.ts} +0 -0
  8. package/lib/components/Manager/EnableButton/EnableButton.stories.d.ts +13 -0
  9. package/lib/components/Manager/EnableButton/index.d.ts +1 -0
  10. package/lib/components/Manager/ManagerButton/ManagerButton.d.ts +13 -0
  11. package/lib/components/Manager/ManagerButton/ManagerButton.spec.d.ts +1 -0
  12. package/lib/components/Manager/ManagerButton/ManagerButton.stories.d.ts +13 -0
  13. package/lib/components/Manager/ManagerButton/index.d.ts +1 -0
  14. package/lib/components/Manager/ManagerDeleteButton/ManagerDeleteButton.d.ts +8 -0
  15. package/lib/components/Manager/ManagerDeleteButton/ManagerDeleteButton.spec.d.ts +1 -0
  16. package/lib/components/Manager/ManagerDeleteButton/ManagerDeleteButton.stories.d.ts +13 -0
  17. package/lib/components/Manager/ManagerDeleteButton/index.d.ts +1 -0
  18. package/lib/components/Manager/index.d.ts +4 -0
  19. package/lib/components/Manager/styles.d.ts +5 -0
  20. package/lib/components/ToolContainer/ToolContainerDraggable.d.ts +6 -0
  21. package/lib/components/ToolContainer/index.d.ts +1 -0
  22. package/lib/components/components.stories.d.ts +0 -1
  23. package/lib/components/index.d.ts +1 -1
  24. package/package.json +3 -3
  25. package/lib/components/DraggableDialog/DraggableDialog.d.ts +0 -16
  26. package/lib/components/DraggableDialog/DraggableDialog.stories.d.ts +0 -6
  27. package/lib/components/DraggableDialog/index.d.ts +0 -1
package/index.esm.js CHANGED
@@ -1,17 +1,18 @@
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';
4
- import makeStyles from '@mui/styles/makeStyles';
5
- import { Close, DragIndicator } from '@mui/icons-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
+ import Close from '@mui/icons-material/Close';
6
5
  import { useFormContext } from 'react-hook-form';
7
6
  import { isEmpty, errorMessages } from '@opengeoweb/form-fields';
7
+ import makeStyles from '@mui/styles/makeStyles';
8
8
  import Draggable from 'react-draggable';
9
9
  import { Resizable } from 're-resizable';
10
10
  import { useThemeContext } from '@opengeoweb/theme';
11
+ import { DragIndicator, Close as Close$1, Delete } from '@mui/icons-material';
11
12
  import { throttle } from 'lodash';
12
13
  import withStyles from '@mui/styles/withStyles';
13
- import createStyles from '@mui/styles/createStyles';
14
14
  import MoreVertIcon from '@mui/icons-material/MoreVert';
15
+ import createStyles from '@mui/styles/createStyles';
15
16
 
16
17
  /* *
17
18
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -103,20 +104,6 @@ function __rest(s, e) {
103
104
  return t;
104
105
  }
105
106
 
106
- var useStyles$b = makeStyles(function () {
107
- return {
108
- dialogHeader: {
109
- zIndex: 1,
110
- padding: '8px 20px',
111
- display: 'flex',
112
- justifyContent: 'space-between',
113
- alignItems: 'center'
114
- },
115
- dialogContent: {
116
- padding: '40px 20px 0px 20px !important'
117
- }
118
- };
119
- });
120
107
  var ConfirmationDialog = function ConfirmationDialog(_a) {
121
108
  var open = _a.open,
122
109
  title = _a.title,
@@ -132,8 +119,6 @@ var ConfirmationDialog = function ConfirmationDialog(_a) {
132
119
  content = _a$content === void 0 ? null : _a$content,
133
120
  other = __rest(_a, ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content"]);
134
121
 
135
- var classes = useStyles$b();
136
-
137
122
  other.catchOnCancel;
138
123
  var rest = __rest(other, ["catchOnCancel"]); // remove unwanted props
139
124
 
@@ -141,14 +126,33 @@ var ConfirmationDialog = function ConfirmationDialog(_a) {
141
126
  return /*#__PURE__*/React.createElement(Dialog, Object.assign({
142
127
  "data-testid": "confirmationDialog",
143
128
  open: open,
144
- maxWidth: "sm",
145
- fullWidth: true,
129
+ PaperProps: {
130
+ sx: {
131
+ width: '560px',
132
+ margin: 2.5
133
+ }
134
+ },
146
135
  // fix for briefly showing default options when closing dialog
147
136
  transitionDuration: 0
148
137
  }, rest), /*#__PURE__*/React.createElement(DialogTitle, {
149
- className: classes.dialogHeader
138
+ sx: {
139
+ zIndex: 1,
140
+ padding: 2,
141
+ display: 'flex',
142
+ justifyContent: 'space-between',
143
+ alignItems: 'center'
144
+ }
150
145
  }, /*#__PURE__*/React.createElement(Typography, {
151
- variant: "h5",
146
+ sx: {
147
+ fontSize: {
148
+ xs: '16px',
149
+ sm: '34px'
150
+ },
151
+ fontWeight: {
152
+ xs: 500,
153
+ sm: 400
154
+ }
155
+ },
152
156
  "data-testid": "confirmationDialog-title",
153
157
  component: "span"
154
158
  }, title), /*#__PURE__*/React.createElement(IconButton, {
@@ -159,22 +163,50 @@ var ConfirmationDialog = function ConfirmationDialog(_a) {
159
163
  },
160
164
  size: "small"
161
165
  }, /*#__PURE__*/React.createElement(Close, null))), /*#__PURE__*/React.createElement(DialogContent, {
162
- className: classes.dialogContent
166
+ sx: {
167
+ padding: '8px 16px'
168
+ }
163
169
  }, /*#__PURE__*/React.createElement(Typography, {
164
170
  variant: "body1"
165
- }, description), content), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
166
- "data-testid": "conformationDialog-cancel",
167
- color: "secondary",
168
- variant: "outlined",
171
+ }, description), content), /*#__PURE__*/React.createElement(DialogActions, {
172
+ sx: {
173
+ padding: 2,
174
+ flexDirection: {
175
+ xs: 'column',
176
+ sm: 'row'
177
+ }
178
+ }
179
+ }, /*#__PURE__*/React.createElement(Button, {
180
+ "data-testid": "confirmationDialog-cancel",
181
+ variant: "tertiary",
182
+ sx: {
183
+ width: {
184
+ xs: '100%',
185
+ sm: '150px'
186
+ }
187
+ },
169
188
  onClick: function onClick() {
170
189
  return onClose('CANCELLED');
171
190
  },
172
191
  autoFocus: true,
173
192
  disableRipple: true
174
193
  }, cancelLabel), /*#__PURE__*/React.createElement(Button, {
175
- "data-testid": "conformationDialog-confirm",
176
- color: "secondary",
177
- variant: "contained",
194
+ "data-testid": "confirmationDialog-confirm",
195
+ variant: "primary",
196
+ sx: {
197
+ width: {
198
+ xs: '100%',
199
+ sm: '150px'
200
+ },
201
+ marginLeft: {
202
+ xs: '0px!important',
203
+ sm: '8px!important'
204
+ },
205
+ marginTop: {
206
+ xs: 2,
207
+ sm: 0
208
+ }
209
+ },
178
210
  onClick: onSubmit
179
211
  }, confirmLabel)));
180
212
  };
@@ -656,7 +688,8 @@ var useStyles$a = makeStyles(function () {
656
688
  title: {
657
689
  fontSize: '14px',
658
690
  fontWeight: 'normal',
659
- marginTop: '0px!important'
691
+ marginTop: '0px!important',
692
+ paddingTop: '0px!important'
660
693
  },
661
694
  info: {
662
695
  fontSize: '16px'
@@ -673,8 +706,7 @@ var getIcon = function getIcon(severity) {
673
706
  fill: "transparent"
674
707
  }), /*#__PURE__*/React.createElement("path", {
675
708
  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"
709
+ transform: "translate(-946.000000, -368.000000) translate(930.000000, 356.000000) translate(16.000000, 12.000000)"
678
710
  }));
679
711
 
680
712
  case 'success':
@@ -684,8 +716,7 @@ var getIcon = function getIcon(severity) {
684
716
  fill: "transparent"
685
717
  }), /*#__PURE__*/React.createElement("path", {
686
718
  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"
719
+ transform: "translate(-96.000000, -368.000000) translate(80.000000, 356.000000) translate(16.000000, 12.000000)"
689
720
  }));
690
721
 
691
722
  case 'warning':
@@ -695,8 +726,7 @@ var getIcon = function getIcon(severity) {
695
726
  fill: "transparent"
696
727
  }), /*#__PURE__*/React.createElement("path", {
697
728
  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"
729
+ transform: "translate(-521.000000, -368.000000) translate(505.000000, 356.000000) translate(16.000000, 12.000000)"
700
730
  }));
701
731
 
702
732
  case 'error':
@@ -707,8 +737,7 @@ var getIcon = function getIcon(severity) {
707
737
  fill: "transparent"
708
738
  }), /*#__PURE__*/React.createElement("path", {
709
739
  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"
740
+ transform: "translate(-1371.000000, -368.000000) translate(1355.000000, 356.000000) translate(16.000000, 12.000000)"
712
741
  }));
713
742
  }
714
743
  };
@@ -720,12 +749,31 @@ var AlertBanner = function AlertBanner(_ref) {
720
749
  _ref$info = _ref.info,
721
750
  info = _ref$info === void 0 ? '' : _ref$info,
722
751
  _ref$dataTestId = _ref.dataTestId,
723
- dataTestId = _ref$dataTestId === void 0 ? 'alert-banner' : _ref$dataTestId;
752
+ dataTestId = _ref$dataTestId === void 0 ? 'alert-banner' : _ref$dataTestId,
753
+ _ref$isCompact = _ref.isCompact,
754
+ isCompact = _ref$isCompact === void 0 ? false : _ref$isCompact;
724
755
  var classes = useStyles$a();
725
756
  return /*#__PURE__*/React.createElement(Alert, {
726
757
  "data-testid": dataTestId,
727
758
  severity: severity,
728
- icon: getIcon(severity)
759
+ icon: getIcon(severity),
760
+ sx: isCompact ? {
761
+ height: '32px',
762
+ boxSizing: 'border-box',
763
+ '& .MuiAlert-message': {
764
+ padding: '0px',
765
+ whiteSpace: 'nowrap',
766
+ overflow: 'hidden',
767
+ textOverflow: 'ellipsis',
768
+ '& .MuiTypography-root': {
769
+ display: 'inline'
770
+ }
771
+ },
772
+ '& .MuiAlert-icon': {
773
+ margin: '-3px 10px 0px 0px',
774
+ padding: '0px'
775
+ }
776
+ } : {}
729
777
  }, /*#__PURE__*/React.createElement(AlertTitle, {
730
778
  className: classes.title
731
779
  }, title), info && /*#__PURE__*/React.createElement("div", {
@@ -1336,7 +1384,7 @@ var ToolHeader = function ToolHeader(_ref) {
1336
1384
  boxShadow: 1,
1337
1385
  backgroundColor: 'geowebColors.background.surface',
1338
1386
  padding: styles.padding,
1339
- zIndex: 1,
1387
+ zIndex: 2,
1340
1388
  cursor: isDraggable ? 'move' : null
1341
1389
  }
1342
1390
  }, /*#__PURE__*/React__default.createElement(Grid, {
@@ -1387,7 +1435,7 @@ var ToolHeader = function ToolHeader(_ref) {
1387
1435
  onClick: onClickClose,
1388
1436
  size: "large",
1389
1437
  sx: iconStyle
1390
- }, /*#__PURE__*/React__default.createElement(Close, null)))));
1438
+ }, /*#__PURE__*/React__default.createElement(Close$1, null)))));
1391
1439
  };
1392
1440
 
1393
1441
  /* *
@@ -1418,7 +1466,6 @@ var useStyles$5 = makeStyles(function () {
1418
1466
  content: {
1419
1467
  flex: 1,
1420
1468
  overflowY: 'auto',
1421
- zIndex: 2,
1422
1469
  position: 'relative'
1423
1470
  }
1424
1471
  };
@@ -1462,6 +1509,18 @@ var ToolContainer = function ToolContainer(_a) {
1462
1509
  }, children), isResizable && /*#__PURE__*/React__default.createElement(ToolFooter, null));
1463
1510
  };
1464
1511
 
1512
+ var calculateDialogSizeAndPosition = function calculateDialogSizeAndPosition() {
1513
+ var width = window.innerWidth * 0.85;
1514
+ var height = window.innerHeight * 0.85;
1515
+ var top = window.innerHeight * 0.15 / 2;
1516
+ var left = window.innerWidth * 0.15 / 2;
1517
+ return {
1518
+ width: width,
1519
+ height: height,
1520
+ top: top,
1521
+ left: left
1522
+ };
1523
+ };
1465
1524
  var BASE_Z_INDEX = 100;
1466
1525
 
1467
1526
  var DraggableComponent = function DraggableComponent(_a) {
@@ -1596,6 +1655,7 @@ var DraggableComponent = function DraggableComponent(_a) {
1596
1655
  }, /*#__PURE__*/React__default.createElement("div", {
1597
1656
  style: Object.assign({
1598
1657
  position: 'absolute',
1658
+ pointerEvents: 'all',
1599
1659
  zIndex: zIndex
1600
1660
  }, startPosition),
1601
1661
  ref: nodeRef
@@ -1909,11 +1969,11 @@ var shortcuts = [{
1909
1969
  }, /*#__PURE__*/React__default.createElement(ArrowRightIcon, null))),
1910
1970
  descriptionMac: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1911
1971
  type: "icon"
1912
- }, /*#__PURE__*/React__default.createElement(OptionIcon, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1972
+ }, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1913
1973
  type: "connect"
1914
1974
  }, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1915
1975
  type: "icon"
1916
- }, /*#__PURE__*/React__default.createElement(CommandIcon, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1976
+ }, /*#__PURE__*/React__default.createElement(OptionIcon, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1917
1977
  type: "connect"
1918
1978
  }, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1919
1979
  type: "icon"
@@ -2325,101 +2385,6 @@ var CustomSlider = function CustomSlider(_a) {
2325
2385
  }, props));
2326
2386
  };
2327
2387
 
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
2388
  /* *
2424
2389
  * Licensed under the Apache License, Version 2.0 (the "License");
2425
2390
  * you may not use this file except in compliance with the License.
@@ -2477,10 +2442,12 @@ var ToolButton = function ToolButton(_a) {
2477
2442
  value = _a$value === void 0 ? 0 : _a$value,
2478
2443
  _a$sx = _a.sx,
2479
2444
  sx = _a$sx === void 0 ? {} : _a$sx,
2480
- props = __rest(_a, ["active", "width", "height", "children", "value", "sx"]);
2445
+ _a$variant = _a.variant,
2446
+ variant = _a$variant === void 0 ? 'tool' : _a$variant,
2447
+ props = __rest(_a, ["active", "width", "height", "children", "value", "sx", "variant"]);
2481
2448
 
2482
2449
  return /*#__PURE__*/React.createElement(CustomToggleButton, Object.assign({
2483
- variant: "tool",
2450
+ variant: variant,
2484
2451
  disableRipple: true,
2485
2452
  selected: active,
2486
2453
  value: value,
@@ -2591,6 +2558,220 @@ var ToggleMenu = function ToggleMenu(_ref) {
2591
2558
  }), children));
2592
2559
  };
2593
2560
 
2561
+ /* *
2562
+ * Licensed under the Apache License, Version 2.0 (the "License");
2563
+ * you may not use this file except in compliance with the License.
2564
+ * You may obtain a copy of the License at
2565
+ *
2566
+ * http://www.apache.org/licenses/LICENSE-2.0
2567
+ *
2568
+ * Unless required by applicable law or agreed to in writing, software
2569
+ * distributed under the License is distributed on an "AS IS" BASIS,
2570
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2571
+ * See the License for the specific language governing permissions and
2572
+ * limitations under the License.
2573
+ *
2574
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2575
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
2576
+ * */
2577
+ var useStyles = makeStyles(function (theme) {
2578
+ return createStyles({
2579
+ button: {
2580
+ height: 28,
2581
+ width: 28,
2582
+ borderRadius: 5,
2583
+ marginTop: 2,
2584
+ color: function color(_ref) {
2585
+ var isActive = _ref.isActive,
2586
+ isAccessible = _ref.isAccessible,
2587
+ isEnabled = _ref.isEnabled;
2588
+
2589
+ if (!isEnabled) {
2590
+ return theme.palette.geowebColors.buttons.flat.disabled.color;
2591
+ }
2592
+
2593
+ if (isAccessible) {
2594
+ return theme.palette.geowebColors.greys.accessible;
2595
+ }
2596
+
2597
+ if (isActive) {
2598
+ return theme.palette.common.white;
2599
+ }
2600
+
2601
+ return theme.palette.geowebColors.buttons.flat["default"].color;
2602
+ },
2603
+ backgroundColor: function backgroundColor(_ref2) {
2604
+ var isActive = _ref2.isActive;
2605
+ return isActive ? theme.palette.geowebColors.buttons.primary.active.fill : 'inherit';
2606
+ },
2607
+ '&:focus': {
2608
+ backgroundColor: function backgroundColor(_ref3) {
2609
+ var isActive = _ref3.isActive;
2610
+ return isActive ? theme.palette.geowebColors.buttons.primary.mouseOver.fill : theme.palette.geowebColors.buttons.flat.mouseOver.fill;
2611
+ },
2612
+ outline: theme.palette.geowebColors.buttons.focusDefault.outline,
2613
+ borderRadius: 0
2614
+ },
2615
+ '&:hover': {
2616
+ backgroundColor: function backgroundColor(_ref4) {
2617
+ var isActive = _ref4.isActive;
2618
+ return isActive ? theme.palette.geowebColors.buttons.primary.mouseOver.fill : theme.palette.geowebColors.buttons.flat.mouseOver.fill;
2619
+ }
2620
+ }
2621
+ },
2622
+ popper: {
2623
+ pointerEvents: 'none'
2624
+ }
2625
+ });
2626
+ });
2627
+ var ManagerButton = function ManagerButton(_a) {
2628
+ var _a$tooltipTitle = _a.tooltipTitle,
2629
+ tooltipTitle = _a$tooltipTitle === void 0 ? '' : _a$tooltipTitle,
2630
+ _a$onClick = _a.onClick,
2631
+ onClick = _a$onClick === void 0 ? function () {} : _a$onClick,
2632
+ _a$isActive = _a.isActive,
2633
+ isActive = _a$isActive === void 0 ? false : _a$isActive,
2634
+ _a$isEnabled = _a.isEnabled,
2635
+ isEnabled = _a$isEnabled === void 0 ? true : _a$isEnabled,
2636
+ icon = _a.icon,
2637
+ testId = _a.testId,
2638
+ _a$isAccessible = _a.isAccessible,
2639
+ isAccessible = _a$isAccessible === void 0 ? false : _a$isAccessible,
2640
+ className = _a.className,
2641
+ props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "testId", "isAccessible", "className"]);
2642
+
2643
+ var classes = useStyles({
2644
+ isActive: isActive,
2645
+ isEnabled: isEnabled,
2646
+ isAccessible: isAccessible
2647
+ });
2648
+
2649
+ var handleClick = function handleClick(event) {
2650
+ onClick(event);
2651
+ };
2652
+
2653
+ return /*#__PURE__*/React.createElement(Tooltip, {
2654
+ title: tooltipTitle,
2655
+ placement: "top",
2656
+ classes: {
2657
+ popper: classes.popper
2658
+ }
2659
+ }, /*#__PURE__*/React.createElement(IconButton, Object.assign({
2660
+ size: "small",
2661
+ onClick: handleClick,
2662
+ "data-testid": testId,
2663
+ className: "".concat(classes.button, " ").concat(className),
2664
+ disableFocusRipple: true
2665
+ }, props), icon));
2666
+ };
2667
+
2668
+ /* *
2669
+ * Licensed under the Apache License, Version 2.0 (the "License");
2670
+ * you may not use this file except in compliance with the License.
2671
+ * You may obtain a copy of the License at
2672
+ *
2673
+ * http://www.apache.org/licenses/LICENSE-2.0
2674
+ *
2675
+ * Unless required by applicable law or agreed to in writing, software
2676
+ * distributed under the License is distributed on an "AS IS" BASIS,
2677
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2678
+ * See the License for the specific language governing permissions and
2679
+ * limitations under the License.
2680
+ *
2681
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2682
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
2683
+ * */
2684
+ var ManagerDeleteButton = function ManagerDeleteButton(_ref) {
2685
+ var tooltipTitle = _ref.tooltipTitle,
2686
+ onClickDelete = _ref.onClickDelete,
2687
+ _ref$isEnabled = _ref.isEnabled,
2688
+ isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled;
2689
+ return /*#__PURE__*/React.createElement(ManagerButton, {
2690
+ tooltipTitle: tooltipTitle,
2691
+ onClick: onClickDelete,
2692
+ icon: /*#__PURE__*/React.createElement(Delete, {
2693
+ sx: {
2694
+ width: 20,
2695
+ height: 20
2696
+ }
2697
+ }),
2698
+ testId: "deleteButton",
2699
+ isEnabled: isEnabled
2700
+ });
2701
+ };
2702
+
2703
+ /* *
2704
+ * Licensed under the Apache License, Version 2.0 (the "License");
2705
+ * you may not use this file except in compliance with the License.
2706
+ * You may obtain a copy of the License at
2707
+ *
2708
+ * http://www.apache.org/licenses/LICENSE-2.0
2709
+ *
2710
+ * Unless required by applicable law or agreed to in writing, software
2711
+ * distributed under the License is distributed on an "AS IS" BASIS,
2712
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2713
+ * See the License for the specific language governing permissions and
2714
+ * limitations under the License.
2715
+ *
2716
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2717
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
2718
+ * */
2719
+ var EnableButton = function EnableButton(_ref) {
2720
+ var isEnabled = _ref.isEnabled,
2721
+ title = _ref.title,
2722
+ onChangeEnableLayer = _ref.onChangeEnableLayer;
2723
+
2724
+ var onClick = function onClick() {
2725
+ onChangeEnableLayer(!isEnabled);
2726
+ };
2727
+
2728
+ var visibilityIcon = /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("rect", {
2729
+ width: 24,
2730
+ height: 24,
2731
+ fill: "transparent"
2732
+ }), /*#__PURE__*/React.createElement("path", {
2733
+ 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"
2734
+ }));
2735
+ var visibilityOffIcon = /*#__PURE__*/React.createElement(SvgIcon, {
2736
+ style: {
2737
+ marginTop: 2
2738
+ }
2739
+ }, /*#__PURE__*/React.createElement("rect", {
2740
+ width: 24,
2741
+ height: 24,
2742
+ fill: "transparent"
2743
+ }), /*#__PURE__*/React.createElement("path", {
2744
+ 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"
2745
+ }));
2746
+ return /*#__PURE__*/React.createElement(ManagerButton, {
2747
+ tooltipTitle: title,
2748
+ onClick: onClick,
2749
+ icon: /*#__PURE__*/React.createElement(Checkbox, {
2750
+ sx: {
2751
+ color: 'inherit',
2752
+ padding: 0.5,
2753
+ borderRadius: 1.25,
2754
+ '&.Mui-focusVisible': {
2755
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2756
+ },
2757
+ '&:hover': {
2758
+ backgroundColor: 'transparent!important'
2759
+ },
2760
+ '&.Mui-checked': {
2761
+ color: 'inherit'
2762
+ }
2763
+ },
2764
+ icon: visibilityOffIcon,
2765
+ checkedIcon: visibilityIcon,
2766
+ checked: isEnabled,
2767
+ disableFocusRipple: true,
2768
+ tabIndex: -1
2769
+ }),
2770
+ testId: "enableButton",
2771
+ isEnabled: isEnabled
2772
+ });
2773
+ };
2774
+
2594
2775
  /* *
2595
2776
  * Licensed under the Apache License, Version 2.0 (the "License");
2596
2777
  * you may not use this file except in compliance with the License.
@@ -2625,4 +2806,4 @@ var getAxiosErrorMessage = function getAxiosErrorMessage(error) {
2625
2806
  return 'An error has occurred';
2626
2807
  };
2627
2808
 
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 };
2809
+ 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 };