@opengeoweb/shared 2.6.0 → 2.9.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.
- package/index.esm.js +83 -23
- package/index.umd.js +96 -32
- package/lib/components/AlertBanner/AlertBanner.d.ts +4 -0
- package/lib/components/ToggleMenu/ToggleMenu.d.ts +11 -3
- package/lib/components/ToggleMenu/ToggleMenu.stories.d.ts +8 -2
- package/lib/components/TooltipSelect/TooltipSelect.d.ts +1 -0
- package/lib/components/TooltipSelect/tooltipContainerStyles.d.ts +1 -1
- package/package.json +3 -3
package/index.esm.js
CHANGED
|
@@ -166,7 +166,7 @@ var ConfirmationDialog = function ConfirmationDialog(_a) {
|
|
|
166
166
|
sx: {
|
|
167
167
|
padding: '8px 16px'
|
|
168
168
|
}
|
|
169
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
169
|
+
}, description && /*#__PURE__*/React.createElement(Typography, {
|
|
170
170
|
variant: "body1"
|
|
171
171
|
}, description), content), /*#__PURE__*/React.createElement(DialogActions, {
|
|
172
172
|
sx: {
|
|
@@ -758,6 +758,12 @@ var AlertIcon = function AlertIcon(_ref) {
|
|
|
758
758
|
}
|
|
759
759
|
};
|
|
760
760
|
|
|
761
|
+
var IconChevronRight = /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("path", {
|
|
762
|
+
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",
|
|
763
|
+
id: "chrevron-right",
|
|
764
|
+
transform: "rotate(90 13.002 12.335)"
|
|
765
|
+
}));
|
|
766
|
+
|
|
761
767
|
var AlertBanner = function AlertBanner(_ref) {
|
|
762
768
|
var title = _ref.title,
|
|
763
769
|
_ref$severity = _ref.severity,
|
|
@@ -769,7 +775,9 @@ var AlertBanner = function AlertBanner(_ref) {
|
|
|
769
775
|
_ref$isCompact = _ref.isCompact,
|
|
770
776
|
isCompact = _ref$isCompact === void 0 ? false : _ref$isCompact,
|
|
771
777
|
_ref$shouldClose = _ref.shouldClose,
|
|
772
|
-
shouldClose = _ref$shouldClose === void 0 ? false : _ref$shouldClose
|
|
778
|
+
shouldClose = _ref$shouldClose === void 0 ? false : _ref$shouldClose,
|
|
779
|
+
_ref$actionButtonProp = _ref.actionButtonProps,
|
|
780
|
+
actionButtonProps = _ref$actionButtonProp === void 0 ? undefined : _ref$actionButtonProp;
|
|
773
781
|
|
|
774
782
|
var _React$useState = React.useState(true),
|
|
775
783
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -832,7 +840,17 @@ var AlertBanner = function AlertBanner(_ref) {
|
|
|
832
840
|
fontSize: '16px',
|
|
833
841
|
marginTop: 1
|
|
834
842
|
}
|
|
835
|
-
}, info)
|
|
843
|
+
}, info), actionButtonProps && /*#__PURE__*/React.createElement(Button, {
|
|
844
|
+
variant: "flat",
|
|
845
|
+
onClick: function onClick(event) {
|
|
846
|
+
setIsOpen(false);
|
|
847
|
+
actionButtonProps.onClick(event);
|
|
848
|
+
},
|
|
849
|
+
sx: {
|
|
850
|
+
backgroundColor: 'transparent!important'
|
|
851
|
+
},
|
|
852
|
+
startIcon: IconChevronRight
|
|
853
|
+
}, actionButtonProps.title.toUpperCase()));
|
|
836
854
|
};
|
|
837
855
|
|
|
838
856
|
/* *
|
|
@@ -2548,9 +2566,20 @@ var getPosition = function getPosition(menuPosition) {
|
|
|
2548
2566
|
horizontal: 'right'
|
|
2549
2567
|
}
|
|
2550
2568
|
};
|
|
2569
|
+
|
|
2570
|
+
case 'right':
|
|
2571
|
+
return {
|
|
2572
|
+
anchorOrigin: {
|
|
2573
|
+
vertical: 'center',
|
|
2574
|
+
horizontal: 'right'
|
|
2575
|
+
},
|
|
2576
|
+
transformOrigin: {
|
|
2577
|
+
vertical: 'center',
|
|
2578
|
+
horizontal: 'left'
|
|
2579
|
+
}
|
|
2580
|
+
};
|
|
2551
2581
|
}
|
|
2552
2582
|
};
|
|
2553
|
-
|
|
2554
2583
|
var ToggleMenu = function ToggleMenu(_ref) {
|
|
2555
2584
|
var _ref$buttonTestId = _ref.buttonTestId,
|
|
2556
2585
|
buttonTestId = _ref$buttonTestId === void 0 ? 'toggleMenuButton' : _ref$buttonTestId,
|
|
@@ -2560,7 +2589,10 @@ var ToggleMenu = function ToggleMenu(_ref) {
|
|
|
2560
2589
|
children = _ref.children,
|
|
2561
2590
|
buttonSx = _ref.buttonSx,
|
|
2562
2591
|
_ref$tooltipTitle = _ref.tooltipTitle,
|
|
2563
|
-
tooltipTitle = _ref$tooltipTitle === void 0 ? '' : _ref$tooltipTitle
|
|
2592
|
+
tooltipTitle = _ref$tooltipTitle === void 0 ? '' : _ref$tooltipTitle,
|
|
2593
|
+
variant = _ref.variant,
|
|
2594
|
+
_ref$isDefaultOpen = _ref.isDefaultOpen,
|
|
2595
|
+
isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen;
|
|
2564
2596
|
|
|
2565
2597
|
var _React$useState = React.useState(null),
|
|
2566
2598
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -2574,18 +2606,27 @@ var ToggleMenu = function ToggleMenu(_ref) {
|
|
|
2574
2606
|
transformOrigin = _getPosition.transformOrigin;
|
|
2575
2607
|
|
|
2576
2608
|
var handleClick = function handleClick(event) {
|
|
2609
|
+
event.stopPropagation();
|
|
2577
2610
|
setAnchorEl(event.currentTarget);
|
|
2578
2611
|
};
|
|
2579
2612
|
|
|
2580
|
-
var handleClose = function handleClose() {
|
|
2613
|
+
var handleClose = function handleClose(event) {
|
|
2614
|
+
event.stopPropagation();
|
|
2581
2615
|
setAnchorEl(null);
|
|
2582
2616
|
};
|
|
2583
2617
|
|
|
2618
|
+
React.useEffect(function () {
|
|
2619
|
+
if (isDefaultOpen) {
|
|
2620
|
+
setAnchorEl(document.getElementById(buttonTestId));
|
|
2621
|
+
}
|
|
2622
|
+
}, [isDefaultOpen, buttonTestId]);
|
|
2584
2623
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ToolButton, {
|
|
2585
2624
|
active: isOpen,
|
|
2586
2625
|
sx: buttonSx,
|
|
2587
2626
|
onClick: handleClick,
|
|
2588
|
-
"data-testid": buttonTestId
|
|
2627
|
+
"data-testid": buttonTestId,
|
|
2628
|
+
variant: variant,
|
|
2629
|
+
id: buttonTestId
|
|
2589
2630
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
2590
2631
|
placement: "top",
|
|
2591
2632
|
title: tooltipTitle
|
|
@@ -2612,9 +2653,9 @@ var ToggleMenu = function ToggleMenu(_ref) {
|
|
|
2612
2653
|
action = menuItem.action;
|
|
2613
2654
|
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
2614
2655
|
key: text,
|
|
2615
|
-
onClick: function onClick() {
|
|
2616
|
-
action();
|
|
2617
|
-
handleClose();
|
|
2656
|
+
onClick: function onClick(event) {
|
|
2657
|
+
action(event);
|
|
2658
|
+
handleClose(event);
|
|
2618
2659
|
}
|
|
2619
2660
|
}, icon && /*#__PURE__*/React.createElement(ListItemIcon, null, icon), /*#__PURE__*/React.createElement(Typography, null, text));
|
|
2620
2661
|
}), children));
|
|
@@ -2851,7 +2892,8 @@ var EnableButton = function EnableButton(_ref) {
|
|
|
2851
2892
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2852
2893
|
* */
|
|
2853
2894
|
var tooltipContainerStyles = function tooltipContainerStyles(isEnabled) {
|
|
2854
|
-
|
|
2895
|
+
var hasBackgroundColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2896
|
+
return Object.assign({
|
|
2855
2897
|
width: '100%',
|
|
2856
2898
|
height: 32,
|
|
2857
2899
|
fontWeight: 500,
|
|
@@ -2866,22 +2908,19 @@ var tooltipContainerStyles = function tooltipContainerStyles(isEnabled) {
|
|
|
2866
2908
|
borderColor: 'transparent!important'
|
|
2867
2909
|
},
|
|
2868
2910
|
'&:hover .MuiSelect-select': {
|
|
2869
|
-
|
|
2911
|
+
outline: function outline(theme) {
|
|
2912
|
+
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2913
|
+
}
|
|
2870
2914
|
},
|
|
2871
2915
|
'&.Mui-focused .MuiSelect-select': {
|
|
2872
2916
|
outline: function outline(theme) {
|
|
2873
2917
|
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2874
|
-
}
|
|
2875
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2876
|
-
},
|
|
2877
|
-
'&:hover&.MuiButton-root': {
|
|
2878
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2918
|
+
}
|
|
2879
2919
|
},
|
|
2880
2920
|
'&:focus&.MuiButton-root': {
|
|
2881
2921
|
outline: function outline(theme) {
|
|
2882
2922
|
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2883
|
-
}
|
|
2884
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2923
|
+
}
|
|
2885
2924
|
},
|
|
2886
2925
|
'& .MuiSvgIcon-root': {
|
|
2887
2926
|
transition: 'none',
|
|
@@ -2892,7 +2931,27 @@ var tooltipContainerStyles = function tooltipContainerStyles(isEnabled) {
|
|
|
2892
2931
|
'&>div': {
|
|
2893
2932
|
paddingLeft: 1
|
|
2894
2933
|
}
|
|
2895
|
-
};
|
|
2934
|
+
}, hasBackgroundColor && backgroundColor);
|
|
2935
|
+
};
|
|
2936
|
+
var backgroundColor = {
|
|
2937
|
+
'&:hover .MuiSelect-select': {
|
|
2938
|
+
outline: function outline(theme) {
|
|
2939
|
+
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2940
|
+
},
|
|
2941
|
+
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2942
|
+
},
|
|
2943
|
+
'&.Mui-focused .MuiSelect-select': {
|
|
2944
|
+
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2945
|
+
},
|
|
2946
|
+
'&:hover&.MuiButton-root': {
|
|
2947
|
+
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2948
|
+
},
|
|
2949
|
+
'&:focus&.MuiButton-root': {
|
|
2950
|
+
outline: function outline(theme) {
|
|
2951
|
+
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2952
|
+
},
|
|
2953
|
+
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2954
|
+
}
|
|
2896
2955
|
};
|
|
2897
2956
|
|
|
2898
2957
|
var TooltipSelect = function TooltipSelect(_a) {
|
|
@@ -2907,7 +2966,8 @@ var TooltipSelect = function TooltipSelect(_a) {
|
|
|
2907
2966
|
requiresCtrlToChange = _a$requiresCtrlToChan === void 0 ? false : _a$requiresCtrlToChan,
|
|
2908
2967
|
isEnabled = _a.isEnabled,
|
|
2909
2968
|
noStyling = _a.noStyling,
|
|
2910
|
-
|
|
2969
|
+
hasBackgroundColor = _a.hasBackgroundColor,
|
|
2970
|
+
props = __rest(_a, ["tooltip", "list", "currentIndex", "onChangeMouseWheel", "requiresCtrlToChange", "isEnabled", "noStyling", "hasBackgroundColor"]);
|
|
2911
2971
|
|
|
2912
2972
|
props.disableUnderline;
|
|
2913
2973
|
var otherProps = __rest(props, ["disableUnderline"]);
|
|
@@ -2953,7 +3013,7 @@ var TooltipSelect = function TooltipSelect(_a) {
|
|
|
2953
3013
|
title: tooltip,
|
|
2954
3014
|
placement: "top",
|
|
2955
3015
|
open: tooltipOpen,
|
|
2956
|
-
sx: noStyling ? undefined : tooltipContainerStyles(isEnabled)
|
|
3016
|
+
sx: noStyling ? undefined : tooltipContainerStyles(isEnabled, hasBackgroundColor)
|
|
2957
3017
|
}, /*#__PURE__*/React.createElement(Select, Object.assign({
|
|
2958
3018
|
onOpen: onOpen,
|
|
2959
3019
|
onClose: onClose,
|
|
@@ -3042,4 +3102,4 @@ var getAxiosErrorMessage = function getAxiosErrorMessage(error) {
|
|
|
3042
3102
|
return 'An error has occurred';
|
|
3043
3103
|
};
|
|
3044
3104
|
|
|
3045
|
-
export { AlertBanner, AlertIcon, 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, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, calculateDialogSizeAndPosition, getAxiosErrorMessage, getInitials, isAxiosError, showPrompt, sliderStyles, tooltipContainerStyles, useConfirmationDialog, useDialogActions, useDraftFormHelpers, useIsMounted, usePoller, usePreventBrowserClose, usePrevious, useUserMenu };
|
|
3105
|
+
export { AlertBanner, AlertIcon, 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, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, calculateDialogSizeAndPosition, getAxiosErrorMessage, getInitials, getPosition, isAxiosError, showPrompt, sliderStyles, tooltipContainerStyles, useConfirmationDialog, useDialogActions, useDraftFormHelpers, useIsMounted, usePoller, usePreventBrowserClose, usePrevious, useUserMenu };
|
package/index.umd.js
CHANGED
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
sx: {
|
|
224
224
|
padding: '8px 16px'
|
|
225
225
|
}
|
|
226
|
-
}, /*#__PURE__*/React__namespace.createElement(material.Typography, {
|
|
226
|
+
}, description && /*#__PURE__*/React__namespace.createElement(material.Typography, {
|
|
227
227
|
variant: "body1"
|
|
228
228
|
}, description), content), /*#__PURE__*/React__namespace.createElement(material.DialogActions, {
|
|
229
229
|
sx: {
|
|
@@ -611,6 +611,12 @@
|
|
|
611
611
|
}
|
|
612
612
|
};
|
|
613
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
|
+
|
|
614
620
|
var AlertBanner = function AlertBanner(_a) {
|
|
615
621
|
var title = _a.title,
|
|
616
622
|
_b = _a.severity,
|
|
@@ -622,11 +628,13 @@
|
|
|
622
628
|
_e = _a.isCompact,
|
|
623
629
|
isCompact = _e === void 0 ? false : _e,
|
|
624
630
|
_f = _a.shouldClose,
|
|
625
|
-
shouldClose = _f === void 0 ? false : _f
|
|
631
|
+
shouldClose = _f === void 0 ? false : _f,
|
|
632
|
+
_g = _a.actionButtonProps,
|
|
633
|
+
actionButtonProps = _g === void 0 ? undefined : _g;
|
|
626
634
|
|
|
627
|
-
var
|
|
628
|
-
isOpen =
|
|
629
|
-
setIsOpen =
|
|
635
|
+
var _h = __read(React__namespace.useState(true), 2),
|
|
636
|
+
isOpen = _h[0],
|
|
637
|
+
setIsOpen = _h[1];
|
|
630
638
|
|
|
631
639
|
return isOpen && /*#__PURE__*/React__namespace.createElement(material.Alert, {
|
|
632
640
|
"data-testid": dataTestId,
|
|
@@ -684,7 +692,17 @@
|
|
|
684
692
|
fontSize: '16px',
|
|
685
693
|
marginTop: 1
|
|
686
694
|
}
|
|
687
|
-
}, info)
|
|
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()));
|
|
688
706
|
};
|
|
689
707
|
|
|
690
708
|
/* *
|
|
@@ -2441,9 +2459,20 @@
|
|
|
2441
2459
|
horizontal: 'right'
|
|
2442
2460
|
}
|
|
2443
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
|
+
};
|
|
2444
2474
|
}
|
|
2445
2475
|
};
|
|
2446
|
-
|
|
2447
2476
|
var ToggleMenu = function ToggleMenu(_a) {
|
|
2448
2477
|
var _b = _a.buttonTestId,
|
|
2449
2478
|
buttonTestId = _b === void 0 ? 'toggleMenuButton' : _b,
|
|
@@ -2453,31 +2482,43 @@
|
|
|
2453
2482
|
children = _a.children,
|
|
2454
2483
|
buttonSx = _a.buttonSx,
|
|
2455
2484
|
_d = _a.tooltipTitle,
|
|
2456
|
-
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;
|
|
2457
2489
|
|
|
2458
|
-
var
|
|
2459
|
-
anchorEl =
|
|
2460
|
-
setAnchorEl =
|
|
2490
|
+
var _f = __read(React__namespace.useState(null), 2),
|
|
2491
|
+
anchorEl = _f[0],
|
|
2492
|
+
setAnchorEl = _f[1];
|
|
2461
2493
|
|
|
2462
2494
|
var isOpen = Boolean(anchorEl);
|
|
2463
2495
|
|
|
2464
|
-
var
|
|
2465
|
-
anchorOrigin =
|
|
2466
|
-
transformOrigin =
|
|
2496
|
+
var _g = getPosition(menuPosition),
|
|
2497
|
+
anchorOrigin = _g.anchorOrigin,
|
|
2498
|
+
transformOrigin = _g.transformOrigin;
|
|
2467
2499
|
|
|
2468
2500
|
var handleClick = function handleClick(event) {
|
|
2501
|
+
event.stopPropagation();
|
|
2469
2502
|
setAnchorEl(event.currentTarget);
|
|
2470
2503
|
};
|
|
2471
2504
|
|
|
2472
|
-
var handleClose = function handleClose() {
|
|
2505
|
+
var handleClose = function handleClose(event) {
|
|
2506
|
+
event.stopPropagation();
|
|
2473
2507
|
setAnchorEl(null);
|
|
2474
2508
|
};
|
|
2475
2509
|
|
|
2510
|
+
React__namespace.useEffect(function () {
|
|
2511
|
+
if (isDefaultOpen) {
|
|
2512
|
+
setAnchorEl(document.getElementById(buttonTestId));
|
|
2513
|
+
}
|
|
2514
|
+
}, [isDefaultOpen, buttonTestId]);
|
|
2476
2515
|
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ToolButton, {
|
|
2477
2516
|
active: isOpen,
|
|
2478
2517
|
sx: buttonSx,
|
|
2479
2518
|
onClick: handleClick,
|
|
2480
|
-
"data-testid": buttonTestId
|
|
2519
|
+
"data-testid": buttonTestId,
|
|
2520
|
+
variant: variant,
|
|
2521
|
+
id: buttonTestId
|
|
2481
2522
|
}, /*#__PURE__*/React__namespace.createElement(material.Tooltip, {
|
|
2482
2523
|
placement: "top",
|
|
2483
2524
|
title: tooltipTitle
|
|
@@ -2504,9 +2545,9 @@
|
|
|
2504
2545
|
action = menuItem.action;
|
|
2505
2546
|
return /*#__PURE__*/React__namespace.createElement(material.MenuItem, {
|
|
2506
2547
|
key: text,
|
|
2507
|
-
onClick: function onClick() {
|
|
2508
|
-
action();
|
|
2509
|
-
handleClose();
|
|
2548
|
+
onClick: function onClick(event) {
|
|
2549
|
+
action(event);
|
|
2550
|
+
handleClose(event);
|
|
2510
2551
|
}
|
|
2511
2552
|
}, icon && /*#__PURE__*/React__namespace.createElement(material.ListItemIcon, null, icon), /*#__PURE__*/React__namespace.createElement(material.Typography, null, text));
|
|
2512
2553
|
}), children));
|
|
@@ -2742,8 +2783,12 @@
|
|
|
2742
2783
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2743
2784
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2744
2785
|
* */
|
|
2745
|
-
var tooltipContainerStyles = function tooltipContainerStyles(isEnabled) {
|
|
2746
|
-
|
|
2786
|
+
var tooltipContainerStyles = function tooltipContainerStyles(isEnabled, hasBackgroundColor) {
|
|
2787
|
+
if (hasBackgroundColor === void 0) {
|
|
2788
|
+
hasBackgroundColor = true;
|
|
2789
|
+
}
|
|
2790
|
+
|
|
2791
|
+
return __assign({
|
|
2747
2792
|
width: '100%',
|
|
2748
2793
|
height: 32,
|
|
2749
2794
|
fontWeight: 500,
|
|
@@ -2758,22 +2803,19 @@
|
|
|
2758
2803
|
borderColor: 'transparent!important'
|
|
2759
2804
|
},
|
|
2760
2805
|
'&:hover .MuiSelect-select': {
|
|
2761
|
-
|
|
2806
|
+
outline: function outline(theme) {
|
|
2807
|
+
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2808
|
+
}
|
|
2762
2809
|
},
|
|
2763
2810
|
'&.Mui-focused .MuiSelect-select': {
|
|
2764
2811
|
outline: function outline(theme) {
|
|
2765
2812
|
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2766
|
-
}
|
|
2767
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2768
|
-
},
|
|
2769
|
-
'&:hover&.MuiButton-root': {
|
|
2770
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2813
|
+
}
|
|
2771
2814
|
},
|
|
2772
2815
|
'&:focus&.MuiButton-root': {
|
|
2773
2816
|
outline: function outline(theme) {
|
|
2774
2817
|
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2775
|
-
}
|
|
2776
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2818
|
+
}
|
|
2777
2819
|
},
|
|
2778
2820
|
'& .MuiSvgIcon-root': {
|
|
2779
2821
|
transition: 'none',
|
|
@@ -2784,7 +2826,27 @@
|
|
|
2784
2826
|
'&>div': {
|
|
2785
2827
|
paddingLeft: 1
|
|
2786
2828
|
}
|
|
2787
|
-
};
|
|
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
|
+
}
|
|
2788
2850
|
};
|
|
2789
2851
|
|
|
2790
2852
|
/* *
|
|
@@ -2815,7 +2877,8 @@
|
|
|
2815
2877
|
requiresCtrlToChange = _e === void 0 ? false : _e,
|
|
2816
2878
|
isEnabled = _a.isEnabled,
|
|
2817
2879
|
noStyling = _a.noStyling,
|
|
2818
|
-
|
|
2880
|
+
hasBackgroundColor = _a.hasBackgroundColor,
|
|
2881
|
+
props = __rest(_a, ["tooltip", "list", "currentIndex", "onChangeMouseWheel", "requiresCtrlToChange", "isEnabled", "noStyling", "hasBackgroundColor"]);
|
|
2819
2882
|
|
|
2820
2883
|
props.disableUnderline;
|
|
2821
2884
|
var otherProps = __rest(props, ["disableUnderline"]);
|
|
@@ -2859,7 +2922,7 @@
|
|
|
2859
2922
|
title: tooltip,
|
|
2860
2923
|
placement: "top",
|
|
2861
2924
|
open: tooltipOpen,
|
|
2862
|
-
sx: noStyling ? undefined : tooltipContainerStyles(isEnabled)
|
|
2925
|
+
sx: noStyling ? undefined : tooltipContainerStyles(isEnabled, hasBackgroundColor)
|
|
2863
2926
|
}, /*#__PURE__*/React__namespace.createElement(material.Select, __assign({
|
|
2864
2927
|
onOpen: onOpen,
|
|
2865
2928
|
onClose: onClose,
|
|
@@ -2977,6 +3040,7 @@
|
|
|
2977
3040
|
exports.calculateDialogSizeAndPosition = calculateDialogSizeAndPosition;
|
|
2978
3041
|
exports.getAxiosErrorMessage = getAxiosErrorMessage;
|
|
2979
3042
|
exports.getInitials = getInitials;
|
|
3043
|
+
exports.getPosition = getPosition;
|
|
2980
3044
|
exports.isAxiosError = isAxiosError;
|
|
2981
3045
|
exports.showPrompt = showPrompt;
|
|
2982
3046
|
exports.sliderStyles = sliderStyles;
|
|
@@ -7,6 +7,10 @@ interface AlertBannerProps {
|
|
|
7
7
|
dataTestId?: string;
|
|
8
8
|
isCompact?: boolean;
|
|
9
9
|
shouldClose?: boolean;
|
|
10
|
+
actionButtonProps?: {
|
|
11
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
12
|
+
title: string;
|
|
13
|
+
};
|
|
10
14
|
}
|
|
11
15
|
declare const AlertBanner: React.FC<AlertBannerProps>;
|
|
12
16
|
export default AlertBanner;
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
import { PopoverOrigin, SxProps, Theme } from '@mui/material';
|
|
3
|
+
import { ButtonVariant } from '@opengeoweb/theme';
|
|
4
|
+
declare type MenuPosition = 'left' | 'right' | 'bottom';
|
|
5
|
+
export declare const getPosition: (menuPosition: MenuPosition) => {
|
|
6
|
+
anchorOrigin: PopoverOrigin;
|
|
7
|
+
transformOrigin: PopoverOrigin;
|
|
8
|
+
};
|
|
3
9
|
declare type MenuItemType = {
|
|
4
10
|
text: string;
|
|
5
|
-
action: () => void;
|
|
11
|
+
action: (event: React.MouseEvent) => void;
|
|
6
12
|
icon?: React.ReactNode;
|
|
7
13
|
};
|
|
8
14
|
interface ToggleMenuProps {
|
|
9
15
|
buttonTestId?: string;
|
|
10
|
-
menuPosition?:
|
|
16
|
+
menuPosition?: MenuPosition;
|
|
11
17
|
menuItems?: MenuItemType[];
|
|
12
18
|
children?: React.ReactNode;
|
|
13
19
|
buttonSx?: SxProps<Theme>;
|
|
14
20
|
tooltipTitle?: string;
|
|
21
|
+
variant?: ButtonVariant;
|
|
22
|
+
isDefaultOpen?: boolean;
|
|
15
23
|
}
|
|
16
24
|
export declare const ToggleMenu: React.FC<ToggleMenuProps>;
|
|
17
25
|
export {};
|
|
@@ -3,5 +3,11 @@ declare const _default: {
|
|
|
3
3
|
title: string;
|
|
4
4
|
};
|
|
5
5
|
export default _default;
|
|
6
|
-
export declare const ToggleMenuLight:
|
|
7
|
-
|
|
6
|
+
export declare const ToggleMenuLight: {
|
|
7
|
+
(): React.ReactElement;
|
|
8
|
+
storyName: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const ToggleMenuDark: {
|
|
11
|
+
(): React.ReactElement;
|
|
12
|
+
storyName: string;
|
|
13
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material';
|
|
2
|
-
export declare const tooltipContainerStyles: (isEnabled: boolean) => SxProps<Theme>;
|
|
2
|
+
export declare const tooltipContainerStyles: (isEnabled: boolean, hasBackgroundColor?: boolean) => SxProps<Theme>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/shared",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.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.
|
|
17
|
+
"@opengeoweb/theme": "2.9.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.
|
|
23
|
+
"@opengeoweb/form-fields": "2.9.0",
|
|
24
24
|
"react-hook-form": "^6.12.1",
|
|
25
25
|
"moment": "^2.29.0",
|
|
26
26
|
"moment-timezone": "^0.5.31",
|