@opengeoweb/shared 12.1.2 → 12.2.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 +506 -359
- package/package.json +2 -2
- package/src/index.d.ts +1 -1
- package/src/lib/components/ConfirmationDialog/ConfirmationButtons.d.ts +1 -1
- package/src/lib/components/ConfirmationDialog/ConfirmationDialog.d.ts +1 -1
- package/src/lib/components/CustomDialog/CustomDialog.d.ts +3 -1
- package/src/lib/components/CustomDialog/CustomDialog.stories.d.ts +3 -0
- package/src/lib/components/CustomDialog/CustomDialogHeader.d.ts +13 -0
- package/src/lib/components/CustomDialog/CustomDialogHeader.spec.d.ts +1 -0
- package/src/lib/components/CustomDialog/CustomDialogHeader.stories.d.ts +11 -0
- package/src/lib/components/CustomDialog/index.d.ts +1 -0
- package/src/lib/components/CustomDialog/types.d.ts +1 -0
- package/src/lib/components/LastUpdateTime/LastUpdateTime.d.ts +2 -1
- package/src/lib/components/TooltipSelect/TooltipSelect.d.ts +4 -0
- package/src/lib/types/types.d.ts +8 -6
- package/src/lib/utils/i18n.d.ts +7 -0
- package/src/lib/utils/i18n.spec.d.ts +1 -0
package/index.esm.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { Box, Typography, Tooltip, IconButton,
|
|
2
|
+
import { Box, Typography, useTheme, Tooltip, IconButton, Menu, ListSubheader, MenuItem, Grid2, ListItemText, ListItemIcon, DialogTitle, Button, Dialog, DialogContent, DialogActions, Paper, CircularProgress, Alert, AlertTitle, Drawer, Link, Avatar as Avatar$1, ClickAwayListener, MenuList, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Switch, Slider, ToggleButton, styled, Select, Accordion, AccordionSummary, AccordionDetails, FormLabel, TextField, InputAdornment, Chip, Stack, debounce as debounce$1, ListItemButton, Checkbox } from '@mui/material';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { useRef, Component, useState } from 'react';
|
|
5
|
-
import { Resize, Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Admin, useThemeContext, ThemeTypes, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, ChevronDown, Search, Clear, Cached } from '@opengeoweb/theme';
|
|
6
5
|
import Draggable from 'react-draggable';
|
|
7
6
|
import { Resizable } from 're-resizable';
|
|
7
|
+
import { Resize, Options, Close, ChevronLeft, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Admin, useThemeContext, ThemeTypes, KeyOption, ArrowLeft, ArrowRight, KeyCommand, ArrowUp, ArrowDown, ChevronDown, Search, Clear, Cached } from '@opengeoweb/theme';
|
|
8
8
|
import 'i18next';
|
|
9
|
-
import { useTranslation } from 'react-i18next';
|
|
9
|
+
import { initReactI18next, useTranslation } from 'react-i18next';
|
|
10
10
|
import { throttle, escapeRegExp, debounce } from 'lodash';
|
|
11
11
|
import * as Sentry from '@sentry/react';
|
|
12
12
|
import { parseISO, parse, format, isEqual, add as add$1, sub as sub$1, differenceInYears as differenceInYears$1, differenceInMonths as differenceInMonths$1, differenceInDays as differenceInDays$1, differenceInMinutes as differenceInMinutes$1, differenceInHours as differenceInHours$1, differenceInSeconds as differenceInSeconds$1, roundToNearestMinutes as roundToNearestMinutes$1, isBefore as isBefore$1, isAfter as isAfter$1, isValid as isValid$1, getUnixTime, fromUnixTime, set as set$1, getHours as getHours$1, startOfDay, addMinutes, addHours, setSeconds as setSeconds$1, getDay, getDayOfYear, getMonth, getWeek, getYear, isWithinInterval } from 'date-fns';
|
|
@@ -72,7 +72,8 @@ var en = {
|
|
|
72
72
|
"shared-filter-system-presets": "System presets",
|
|
73
73
|
"shared-filter-shared-presets": "Shared presets",
|
|
74
74
|
"shared-filter-search": "Search",
|
|
75
|
-
"shared-only": "ONLY"
|
|
75
|
+
"shared-only": "ONLY",
|
|
76
|
+
"shared-customdialog-back": "Back"
|
|
76
77
|
};
|
|
77
78
|
var fi = {
|
|
78
79
|
"shared-choose-app-mode": "Sovelluksen väriteema",
|
|
@@ -134,7 +135,8 @@ var fi = {
|
|
|
134
135
|
"shared-filter-system-presets": "Järestelmä presetit",
|
|
135
136
|
"shared-filter-shared-presets": "ei käännetty",
|
|
136
137
|
"shared-filter-search": "Etsi",
|
|
137
|
-
"shared-only": "Pelkästään"
|
|
138
|
+
"shared-only": "Pelkästään",
|
|
139
|
+
"shared-customdialog-back": "PALAA TAKAISIN"
|
|
138
140
|
};
|
|
139
141
|
var no = {
|
|
140
142
|
"shared-choose-app-mode": "Velg din standardmodus",
|
|
@@ -196,7 +198,8 @@ var no = {
|
|
|
196
198
|
"shared-filter-system-presets": "System presets",
|
|
197
199
|
"shared-filter-shared-presets": "Delte arbeidsflater",
|
|
198
200
|
"shared-filter-search": "Søk",
|
|
199
|
-
"shared-only": "BARE"
|
|
201
|
+
"shared-only": "BARE",
|
|
202
|
+
"shared-customdialog-back": "Tilbake"
|
|
200
203
|
};
|
|
201
204
|
var nl = {
|
|
202
205
|
"shared-choose-app-mode": "Kies je standaard app-modus",
|
|
@@ -258,7 +261,8 @@ var nl = {
|
|
|
258
261
|
"shared-filter-system-presets": "Systeem presets",
|
|
259
262
|
"shared-filter-shared-presets": "Gedeelde presets",
|
|
260
263
|
"shared-filter-search": "Zoeken",
|
|
261
|
-
"shared-only": "ALLEEN"
|
|
264
|
+
"shared-only": "ALLEEN",
|
|
265
|
+
"shared-customdialog-back": "Terug"
|
|
262
266
|
};
|
|
263
267
|
var sharedTranslations = {
|
|
264
268
|
en: en,
|
|
@@ -299,7 +303,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
299
303
|
if (null == r) return {};
|
|
300
304
|
var t = {};
|
|
301
305
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
302
|
-
if (e.indexOf(n)
|
|
306
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
303
307
|
t[n] = r[n];
|
|
304
308
|
}
|
|
305
309
|
return t;
|
|
@@ -322,9 +326,9 @@ function _regeneratorRuntime() {
|
|
|
322
326
|
function define(t, e, r) {
|
|
323
327
|
return Object.defineProperty(t, e, {
|
|
324
328
|
value: r,
|
|
325
|
-
enumerable:
|
|
326
|
-
configurable:
|
|
327
|
-
writable:
|
|
329
|
+
enumerable: true,
|
|
330
|
+
configurable: true,
|
|
331
|
+
writable: true
|
|
328
332
|
}), t[e];
|
|
329
333
|
}
|
|
330
334
|
try {
|
|
@@ -417,7 +421,7 @@ function _regeneratorRuntime() {
|
|
|
417
421
|
if ("throw" === i) throw a;
|
|
418
422
|
return {
|
|
419
423
|
value: t,
|
|
420
|
-
done:
|
|
424
|
+
done: true
|
|
421
425
|
};
|
|
422
426
|
}
|
|
423
427
|
for (n.method = i, n.arg = a;;) {
|
|
@@ -468,7 +472,7 @@ function _regeneratorRuntime() {
|
|
|
468
472
|
function Context(t) {
|
|
469
473
|
this.tryEntries = [{
|
|
470
474
|
tryLoc: "root"
|
|
471
|
-
}], t.forEach(pushTryEntry, this), this.reset(
|
|
475
|
+
}], t.forEach(pushTryEntry, this), this.reset(true);
|
|
472
476
|
}
|
|
473
477
|
function values(e) {
|
|
474
478
|
if (e || "" === e) {
|
|
@@ -478,8 +482,8 @@ function _regeneratorRuntime() {
|
|
|
478
482
|
if (!isNaN(e.length)) {
|
|
479
483
|
var o = -1,
|
|
480
484
|
i = function next() {
|
|
481
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done =
|
|
482
|
-
return next.value = t, next.done =
|
|
485
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = false, next;
|
|
486
|
+
return next.value = t, next.done = true, next;
|
|
483
487
|
};
|
|
484
488
|
return i.next = i;
|
|
485
489
|
}
|
|
@@ -488,10 +492,10 @@ function _regeneratorRuntime() {
|
|
|
488
492
|
}
|
|
489
493
|
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
490
494
|
value: GeneratorFunctionPrototype,
|
|
491
|
-
configurable:
|
|
495
|
+
configurable: true
|
|
492
496
|
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
493
497
|
value: GeneratorFunction,
|
|
494
|
-
configurable:
|
|
498
|
+
configurable: true
|
|
495
499
|
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
496
500
|
var e = "function" == typeof t && t.constructor;
|
|
497
501
|
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
@@ -520,17 +524,17 @@ function _regeneratorRuntime() {
|
|
|
520
524
|
return r.reverse(), function next() {
|
|
521
525
|
for (; r.length;) {
|
|
522
526
|
var t = r.pop();
|
|
523
|
-
if (t in e) return next.value = t, next.done =
|
|
527
|
+
if (t in e) return next.value = t, next.done = false, next;
|
|
524
528
|
}
|
|
525
|
-
return next.done =
|
|
529
|
+
return next.done = true, next;
|
|
526
530
|
};
|
|
527
531
|
}, e.values = values, Context.prototype = {
|
|
528
532
|
constructor: Context,
|
|
529
533
|
reset: function (e) {
|
|
530
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done =
|
|
534
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
531
535
|
},
|
|
532
536
|
stop: function () {
|
|
533
|
-
this.done =
|
|
537
|
+
this.done = true;
|
|
534
538
|
var t = this.tryEntries[0].completion;
|
|
535
539
|
if ("throw" === t.type) throw t.arg;
|
|
536
540
|
return this.rval;
|
|
@@ -549,10 +553,10 @@ function _regeneratorRuntime() {
|
|
|
549
553
|
var c = n.call(i, "catchLoc"),
|
|
550
554
|
u = n.call(i, "finallyLoc");
|
|
551
555
|
if (c && u) {
|
|
552
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc,
|
|
556
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
|
553
557
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
554
558
|
} else if (c) {
|
|
555
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc,
|
|
559
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
|
556
560
|
} else {
|
|
557
561
|
if (!u) throw Error("try statement without catch or finally");
|
|
558
562
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
@@ -674,96 +678,14 @@ var StatusTag = function StatusTag(_ref) {
|
|
|
674
678
|
});
|
|
675
679
|
};
|
|
676
680
|
|
|
677
|
-
var
|
|
678
|
-
var useControlledTooltip = function useControlledTooltip() {
|
|
679
|
-
var _React$useState = React.useState(false),
|
|
680
|
-
tooltipOpen = _React$useState[0],
|
|
681
|
-
setTooltipOpen = _React$useState[1];
|
|
682
|
-
var _React$useState2 = React.useState(false),
|
|
683
|
-
delayedTooltip = _React$useState2[0],
|
|
684
|
-
setDelayedTooltip = _React$useState2[1];
|
|
685
|
-
React.useEffect(function () {
|
|
686
|
-
if (tooltipOpen === true) {
|
|
687
|
-
var timer = setTimeout(function () {
|
|
688
|
-
return setDelayedTooltip(true);
|
|
689
|
-
}, defaultDelay);
|
|
690
|
-
return function () {
|
|
691
|
-
clearTimeout(timer);
|
|
692
|
-
};
|
|
693
|
-
}
|
|
694
|
-
setDelayedTooltip(false);
|
|
695
|
-
return function () {};
|
|
696
|
-
}, [tooltipOpen]);
|
|
697
|
-
return [delayedTooltip, setTooltipOpen];
|
|
698
|
-
};
|
|
699
|
-
var CustomTooltip = function CustomTooltip(props) {
|
|
700
|
-
return jsx(Tooltip, Object.assign({}, props, {
|
|
701
|
-
enterDelay: defaultDelay,
|
|
702
|
-
enterNextDelay: defaultDelay,
|
|
703
|
-
disableInteractive: true
|
|
704
|
-
}));
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
var _excluded$d = ["tooltipTitle", "variant", "isSelected", "shouldShowAsDisabled", "size", "children", "className", "tooltipProps"];
|
|
708
|
-
var CustomIconButtonNoMemo = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
709
|
-
var _ref$tooltipTitle = _ref.tooltipTitle,
|
|
710
|
-
defaultTooltipTitle = _ref$tooltipTitle === void 0 ? '' : _ref$tooltipTitle,
|
|
711
|
-
_ref$variant = _ref.variant,
|
|
712
|
-
variant = _ref$variant === void 0 ? 'flat' : _ref$variant,
|
|
713
|
-
_ref$isSelected = _ref.isSelected,
|
|
714
|
-
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
715
|
-
_ref$shouldShowAsDisa = _ref.shouldShowAsDisabled,
|
|
716
|
-
shouldShowAsDisabled = _ref$shouldShowAsDisa === void 0 ? false : _ref$shouldShowAsDisa,
|
|
717
|
-
_ref$size = _ref.size,
|
|
718
|
-
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
719
|
-
children = _ref.children,
|
|
720
|
-
className = _ref.className,
|
|
721
|
-
defaultTooltipProps = _ref.tooltipProps,
|
|
722
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
|
723
|
-
var classNames = [].concat(className ? [className] : [], isSelected ? ['Mui-selected'] : [], [variant]).join(' ');
|
|
724
|
-
var tooltipTitle = (defaultTooltipProps == null ? void 0 : defaultTooltipProps.title) || defaultTooltipTitle;
|
|
725
|
-
var tooltipProps = React.useMemo(function () {
|
|
726
|
-
return Object.assign({}, defaultTooltipProps, {
|
|
727
|
-
title: tooltipTitle,
|
|
728
|
-
placement: (defaultTooltipProps == null ? void 0 : defaultTooltipProps.placement) || 'top',
|
|
729
|
-
sx: {
|
|
730
|
-
pointerEvents: 'none'
|
|
731
|
-
}
|
|
732
|
-
});
|
|
733
|
-
}, [defaultTooltipProps, tooltipTitle]);
|
|
734
|
-
var renderIconButton = function renderIconButton() {
|
|
735
|
-
return jsx(IconButton, Object.assign({
|
|
736
|
-
"aria-label": tooltipTitle
|
|
737
|
-
}, props, {
|
|
738
|
-
size: size,
|
|
739
|
-
className: classNames,
|
|
740
|
-
ref: ref,
|
|
741
|
-
"aria-pressed": isSelected,
|
|
742
|
-
sx: Object.assign({}, props.sx, shouldShowAsDisabled && {
|
|
743
|
-
'&.MuiIconButton-root': {
|
|
744
|
-
color: "geowebColors.iconButtons." + variant + ".disabled.color"
|
|
745
|
-
},
|
|
746
|
-
'&.Mui-focusVisible': {
|
|
747
|
-
color: "geowebColors.iconButtons." + variant + ".default.color"
|
|
748
|
-
}
|
|
749
|
-
}),
|
|
750
|
-
children: children
|
|
751
|
-
}));
|
|
752
|
-
};
|
|
753
|
-
return tooltipTitle && !props.disabled ? jsx(CustomTooltip, Object.assign({}, tooltipProps, {
|
|
754
|
-
children: renderIconButton()
|
|
755
|
-
})) : renderIconButton();
|
|
756
|
-
});
|
|
757
|
-
var CustomIconButton = /*#__PURE__*/React.memo(CustomIconButtonNoMemo);
|
|
758
|
-
|
|
759
|
-
var _excluded$c = ["bounds", "setIsDragging", "children", "onStop"];
|
|
681
|
+
var _excluded$d = ["bounds", "setIsDragging", "children", "onStop"];
|
|
760
682
|
var DraggableComponent$1 = function DraggableComponent(_ref) {
|
|
761
683
|
var _ref$bounds = _ref.bounds,
|
|
762
684
|
bounds = _ref$bounds === void 0 ? 'body' : _ref$bounds,
|
|
763
685
|
setIsDragging = _ref.setIsDragging,
|
|
764
686
|
children = _ref.children,
|
|
765
687
|
onStop = _ref.onStop,
|
|
766
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
688
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
|
767
689
|
var onDragStart = function onDragStart(e) {
|
|
768
690
|
// This makes sure that nothing is selected during drag
|
|
769
691
|
setIsDragging && setIsDragging(true);
|
|
@@ -785,7 +707,7 @@ var DraggableComponent$1 = function DraggableComponent(_ref) {
|
|
|
785
707
|
}));
|
|
786
708
|
};
|
|
787
709
|
|
|
788
|
-
var _excluded$
|
|
710
|
+
var _excluded$c = ["children", "onResizeStart", "onResizeStop", "size", "setSize", "minHeight", "minWidth", "enable", "nodeRef"];
|
|
789
711
|
var isDraggingClassName = 'is-dragging';
|
|
790
712
|
var useBoundsProps = function useBoundsProps(nodeRef) {
|
|
791
713
|
var _React$useState = React__default.useState({}),
|
|
@@ -828,7 +750,7 @@ var ResizeComponent = function ResizeComponent(_ref) {
|
|
|
828
750
|
topLeft: true
|
|
829
751
|
} : _ref$enable,
|
|
830
752
|
nodeRef = _ref.nodeRef,
|
|
831
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
753
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
|
832
754
|
var theme = useTheme();
|
|
833
755
|
var onStartResize = React__default.useCallback(function (event, _direction, node) {
|
|
834
756
|
event.stopPropagation();
|
|
@@ -871,30 +793,466 @@ var ResizeComponent = function ResizeComponent(_ref) {
|
|
|
871
793
|
fill: "" + theme.palette.geowebColors.buttons.flat["default"].color
|
|
872
794
|
},
|
|
873
795
|
sx: {
|
|
874
|
-
display: 'none'
|
|
875
|
-
},
|
|
876
|
-
className: "resizableHandle"
|
|
877
|
-
}),
|
|
878
|
-
bottomLeft: jsx(Resize, {
|
|
879
|
-
isRightAligned: true,
|
|
880
|
-
style: {
|
|
881
|
-
fill: "" + theme.palette.geowebColors.buttons.flat["default"].color
|
|
796
|
+
display: 'none'
|
|
797
|
+
},
|
|
798
|
+
className: "resizableHandle"
|
|
799
|
+
}),
|
|
800
|
+
bottomLeft: jsx(Resize, {
|
|
801
|
+
isRightAligned: true,
|
|
802
|
+
style: {
|
|
803
|
+
fill: "" + theme.palette.geowebColors.buttons.flat["default"].color
|
|
804
|
+
},
|
|
805
|
+
sx: {
|
|
806
|
+
display: 'none'
|
|
807
|
+
},
|
|
808
|
+
className: "resizableHandle"
|
|
809
|
+
})
|
|
810
|
+
},
|
|
811
|
+
enable: enable,
|
|
812
|
+
onResizeStart: onStartResize
|
|
813
|
+
}, props, {
|
|
814
|
+
children: children
|
|
815
|
+
}));
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
var defaultDelay = 1000;
|
|
819
|
+
var useControlledTooltip = function useControlledTooltip() {
|
|
820
|
+
var _React$useState = React.useState(false),
|
|
821
|
+
tooltipOpen = _React$useState[0],
|
|
822
|
+
setTooltipOpen = _React$useState[1];
|
|
823
|
+
var _React$useState2 = React.useState(false),
|
|
824
|
+
delayedTooltip = _React$useState2[0],
|
|
825
|
+
setDelayedTooltip = _React$useState2[1];
|
|
826
|
+
React.useEffect(function () {
|
|
827
|
+
if (tooltipOpen === true) {
|
|
828
|
+
var timer = setTimeout(function () {
|
|
829
|
+
return setDelayedTooltip(true);
|
|
830
|
+
}, defaultDelay);
|
|
831
|
+
return function () {
|
|
832
|
+
clearTimeout(timer);
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
setDelayedTooltip(false);
|
|
836
|
+
return function () {};
|
|
837
|
+
}, [tooltipOpen]);
|
|
838
|
+
return [delayedTooltip, setTooltipOpen];
|
|
839
|
+
};
|
|
840
|
+
var CustomTooltip = function CustomTooltip(props) {
|
|
841
|
+
return jsx(Tooltip, Object.assign({}, props, {
|
|
842
|
+
enterDelay: defaultDelay,
|
|
843
|
+
enterNextDelay: defaultDelay,
|
|
844
|
+
disableInteractive: true
|
|
845
|
+
}));
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
var _excluded$b = ["tooltipTitle", "variant", "isSelected", "shouldShowAsDisabled", "size", "children", "className", "tooltipProps"];
|
|
849
|
+
var CustomIconButtonNoMemo = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
850
|
+
var _ref$tooltipTitle = _ref.tooltipTitle,
|
|
851
|
+
defaultTooltipTitle = _ref$tooltipTitle === void 0 ? '' : _ref$tooltipTitle,
|
|
852
|
+
_ref$variant = _ref.variant,
|
|
853
|
+
variant = _ref$variant === void 0 ? 'flat' : _ref$variant,
|
|
854
|
+
_ref$isSelected = _ref.isSelected,
|
|
855
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
856
|
+
_ref$shouldShowAsDisa = _ref.shouldShowAsDisabled,
|
|
857
|
+
shouldShowAsDisabled = _ref$shouldShowAsDisa === void 0 ? false : _ref$shouldShowAsDisa,
|
|
858
|
+
_ref$size = _ref.size,
|
|
859
|
+
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
860
|
+
children = _ref.children,
|
|
861
|
+
className = _ref.className,
|
|
862
|
+
defaultTooltipProps = _ref.tooltipProps,
|
|
863
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
864
|
+
var classNames = [].concat(className ? [className] : [], isSelected ? ['Mui-selected'] : [], [variant]).join(' ');
|
|
865
|
+
var tooltipTitle = (defaultTooltipProps == null ? void 0 : defaultTooltipProps.title) || defaultTooltipTitle;
|
|
866
|
+
var tooltipProps = React.useMemo(function () {
|
|
867
|
+
return Object.assign({}, defaultTooltipProps, {
|
|
868
|
+
title: tooltipTitle,
|
|
869
|
+
placement: (defaultTooltipProps == null ? void 0 : defaultTooltipProps.placement) || 'top',
|
|
870
|
+
sx: {
|
|
871
|
+
pointerEvents: 'none'
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
}, [defaultTooltipProps, tooltipTitle]);
|
|
875
|
+
var renderIconButton = function renderIconButton() {
|
|
876
|
+
return jsx(IconButton, Object.assign({
|
|
877
|
+
"aria-label": tooltipTitle
|
|
878
|
+
}, props, {
|
|
879
|
+
size: size,
|
|
880
|
+
className: classNames,
|
|
881
|
+
ref: ref,
|
|
882
|
+
"aria-pressed": isSelected,
|
|
883
|
+
sx: Object.assign({}, props.sx, shouldShowAsDisabled && {
|
|
884
|
+
'&.MuiIconButton-root': {
|
|
885
|
+
color: "geowebColors.iconButtons." + variant + ".disabled.color"
|
|
886
|
+
},
|
|
887
|
+
'&.Mui-focusVisible': {
|
|
888
|
+
color: "geowebColors.iconButtons." + variant + ".default.color"
|
|
889
|
+
}
|
|
890
|
+
}),
|
|
891
|
+
children: children
|
|
892
|
+
}));
|
|
893
|
+
};
|
|
894
|
+
return tooltipTitle && !props.disabled ? jsx(CustomTooltip, Object.assign({}, tooltipProps, {
|
|
895
|
+
children: renderIconButton()
|
|
896
|
+
})) : renderIconButton();
|
|
897
|
+
});
|
|
898
|
+
var CustomIconButton = /*#__PURE__*/React.memo(CustomIconButtonNoMemo);
|
|
899
|
+
|
|
900
|
+
var getPosition = function getPosition(menuPosition) {
|
|
901
|
+
switch (menuPosition) {
|
|
902
|
+
case 'bottom':
|
|
903
|
+
return {
|
|
904
|
+
anchorOrigin: {
|
|
905
|
+
vertical: 'bottom',
|
|
906
|
+
horizontal: 'center'
|
|
907
|
+
},
|
|
908
|
+
transformOrigin: {
|
|
909
|
+
vertical: 'top',
|
|
910
|
+
horizontal: 'center'
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
// eslint-disable-next-line default-case-last
|
|
914
|
+
default:
|
|
915
|
+
case 'left':
|
|
916
|
+
return {
|
|
917
|
+
anchorOrigin: {
|
|
918
|
+
vertical: 'center',
|
|
919
|
+
horizontal: 'left'
|
|
920
|
+
},
|
|
921
|
+
transformOrigin: {
|
|
922
|
+
vertical: 'center',
|
|
923
|
+
horizontal: 'right'
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
case 'right':
|
|
927
|
+
return {
|
|
928
|
+
anchorOrigin: {
|
|
929
|
+
vertical: 'center',
|
|
930
|
+
horizontal: 'right'
|
|
931
|
+
},
|
|
932
|
+
transformOrigin: {
|
|
933
|
+
vertical: 'center',
|
|
934
|
+
horizontal: 'left'
|
|
935
|
+
}
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
var ToggleMenu = function ToggleMenu(_ref) {
|
|
940
|
+
var _ref$buttonTestId = _ref.buttonTestId,
|
|
941
|
+
buttonTestId = _ref$buttonTestId === void 0 ? 'toggleMenuButton' : _ref$buttonTestId,
|
|
942
|
+
_ref$menuPosition = _ref.menuPosition,
|
|
943
|
+
menuPosition = _ref$menuPosition === void 0 ? 'left' : _ref$menuPosition,
|
|
944
|
+
menuItems = _ref.menuItems,
|
|
945
|
+
children = _ref.children,
|
|
946
|
+
buttonSx = _ref.buttonSx,
|
|
947
|
+
_ref$tooltipTitle = _ref.tooltipTitle,
|
|
948
|
+
tooltipTitle = _ref$tooltipTitle === void 0 ? '' : _ref$tooltipTitle,
|
|
949
|
+
_ref$menuTitle = _ref.menuTitle,
|
|
950
|
+
menuTitle = _ref$menuTitle === void 0 ? '' : _ref$menuTitle,
|
|
951
|
+
_ref$variant = _ref.variant,
|
|
952
|
+
variant = _ref$variant === void 0 ? 'tool' : _ref$variant,
|
|
953
|
+
_ref$isDefaultOpen = _ref.isDefaultOpen,
|
|
954
|
+
isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen,
|
|
955
|
+
_ref$buttonIcon = _ref.buttonIcon,
|
|
956
|
+
buttonIcon = _ref$buttonIcon === void 0 ? jsx(Options, {}) : _ref$buttonIcon,
|
|
957
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
958
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
|
|
959
|
+
var _React$useState = React.useState(null),
|
|
960
|
+
anchorEl = _React$useState[0],
|
|
961
|
+
setAnchorEl = _React$useState[1];
|
|
962
|
+
var isOpen = Boolean(anchorEl);
|
|
963
|
+
var _getPosition = getPosition(menuPosition),
|
|
964
|
+
anchorOrigin = _getPosition.anchorOrigin,
|
|
965
|
+
transformOrigin = _getPosition.transformOrigin;
|
|
966
|
+
var handleClick = function handleClick(event) {
|
|
967
|
+
event.stopPropagation();
|
|
968
|
+
setAnchorEl(event.currentTarget);
|
|
969
|
+
};
|
|
970
|
+
var handleClose = function handleClose(event) {
|
|
971
|
+
event.stopPropagation();
|
|
972
|
+
setAnchorEl(null);
|
|
973
|
+
};
|
|
974
|
+
React.useEffect(function () {
|
|
975
|
+
if (isDefaultOpen) {
|
|
976
|
+
setAnchorEl(document.getElementById(buttonTestId));
|
|
977
|
+
}
|
|
978
|
+
}, [isDefaultOpen, buttonTestId]);
|
|
979
|
+
return jsxs(Fragment, {
|
|
980
|
+
children: [jsx(CustomIconButton, {
|
|
981
|
+
tooltipProps: {
|
|
982
|
+
placement: 'top',
|
|
983
|
+
title: tooltipTitle
|
|
984
|
+
},
|
|
985
|
+
isSelected: isOpen,
|
|
986
|
+
sx: buttonSx,
|
|
987
|
+
onClick: handleClick,
|
|
988
|
+
"data-testid": buttonTestId,
|
|
989
|
+
variant: variant,
|
|
990
|
+
id: buttonTestId,
|
|
991
|
+
disabled: isDisabled,
|
|
992
|
+
children: buttonIcon
|
|
993
|
+
}), jsxs(Menu, {
|
|
994
|
+
anchorEl: anchorEl,
|
|
995
|
+
open: isOpen,
|
|
996
|
+
onClose: function onClose(event, reason) {
|
|
997
|
+
if (reason === 'tabKeyDown') {
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
handleClose(event);
|
|
1001
|
+
},
|
|
1002
|
+
anchorOrigin: anchorOrigin,
|
|
1003
|
+
transformOrigin: transformOrigin,
|
|
1004
|
+
BackdropProps: {
|
|
1005
|
+
style: {
|
|
1006
|
+
opacity: 0,
|
|
1007
|
+
transition: 'none'
|
|
1008
|
+
}
|
|
1009
|
+
},
|
|
1010
|
+
MenuListProps: Object.assign({}, children && {
|
|
1011
|
+
style: {
|
|
1012
|
+
padding: '0px'
|
|
1013
|
+
}
|
|
1014
|
+
}),
|
|
1015
|
+
children: [menuTitle && jsx(ListSubheader, {
|
|
1016
|
+
"data-testid": "toggleMenuTitle",
|
|
1017
|
+
children: jsx(Typography, {
|
|
1018
|
+
sx: {
|
|
1019
|
+
fontSize: '12px'
|
|
1020
|
+
},
|
|
1021
|
+
children: menuTitle
|
|
1022
|
+
})
|
|
1023
|
+
}), menuItems && menuItems.length ? menuItems.map(function (menuItem) {
|
|
1024
|
+
var text = menuItem.text,
|
|
1025
|
+
icon = menuItem.icon,
|
|
1026
|
+
action = menuItem.action,
|
|
1027
|
+
isDisabled = menuItem.isDisabled;
|
|
1028
|
+
return jsx(MenuItem, {
|
|
1029
|
+
onClick: function onClick(event) {
|
|
1030
|
+
action(event);
|
|
1031
|
+
handleClose(event);
|
|
1032
|
+
},
|
|
1033
|
+
disabled: isDisabled,
|
|
1034
|
+
selected: menuItem.isSelected,
|
|
1035
|
+
children: jsxs(Grid2, {
|
|
1036
|
+
container: true,
|
|
1037
|
+
spacing: 2,
|
|
1038
|
+
justifyContent: "space-between",
|
|
1039
|
+
size: "grow",
|
|
1040
|
+
children: [jsx(Grid2, {
|
|
1041
|
+
children: jsx(ListItemText, {
|
|
1042
|
+
children: text
|
|
1043
|
+
})
|
|
1044
|
+
}), icon && jsx(Grid2, {
|
|
1045
|
+
alignItems: "flex-end",
|
|
1046
|
+
children: jsx(ListItemIcon, {
|
|
1047
|
+
sx: {
|
|
1048
|
+
'&.MuiListItemIcon-root': {
|
|
1049
|
+
minWidth: '24px'
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
children: icon
|
|
1053
|
+
})
|
|
1054
|
+
})]
|
|
1055
|
+
})
|
|
1056
|
+
}, text);
|
|
1057
|
+
}) : jsx("div", {}) // Needed to make the menu work without any menuItems
|
|
1058
|
+
, children]
|
|
1059
|
+
})]
|
|
1060
|
+
});
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
/* *
|
|
1064
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1065
|
+
* you may not use this file except in compliance with the License.
|
|
1066
|
+
* You may obtain a copy of the License at
|
|
1067
|
+
*
|
|
1068
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1069
|
+
*
|
|
1070
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1071
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1072
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1073
|
+
* See the License for the specific language governing permissions and
|
|
1074
|
+
* limitations under the License.
|
|
1075
|
+
*
|
|
1076
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1077
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
1078
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
1079
|
+
* */
|
|
1080
|
+
var SHARED_NAMESPACE = 'shared';
|
|
1081
|
+
var geowebLanguages = ['en', 'fi', 'no', 'nl'];
|
|
1082
|
+
var loadAllTranslations = function loadAllTranslations(i18nInstance, translationsToLoad) {
|
|
1083
|
+
translationsToLoad.forEach(function (_ref) {
|
|
1084
|
+
var ns = _ref.ns,
|
|
1085
|
+
translations = _ref.translations;
|
|
1086
|
+
geowebLanguages.forEach(function (lang) {
|
|
1087
|
+
i18nInstance.addResourceBundle(lang, ns, translations[lang]);
|
|
1088
|
+
});
|
|
1089
|
+
});
|
|
1090
|
+
};
|
|
1091
|
+
var safelyInitI18nForTestsAndStories = function safelyInitI18nForTestsAndStories(i18nInstance, namespace, translationsToLoad, initLanguage) {
|
|
1092
|
+
// This check ensures that we don't init the library many times.
|
|
1093
|
+
// - in tests, the init is done globally, so this should not init
|
|
1094
|
+
// - in stories, this function should init, but only once if called many times
|
|
1095
|
+
if (!i18nInstance.isInitialized && !i18nInstance.isInitializing) {
|
|
1096
|
+
void i18nInstance.use(initReactI18next).init({
|
|
1097
|
+
lng: initLanguage != null ? initLanguage : 'en',
|
|
1098
|
+
ns: namespace,
|
|
1099
|
+
interpolation: {
|
|
1100
|
+
escapeValue: false
|
|
1101
|
+
},
|
|
1102
|
+
resources: {}
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
loadAllTranslations(i18nInstance, translationsToLoad);
|
|
1106
|
+
};
|
|
1107
|
+
var useSharedTranslation = function useSharedTranslation() {
|
|
1108
|
+
return useTranslation([SHARED_NAMESPACE]);
|
|
1109
|
+
};
|
|
1110
|
+
|
|
1111
|
+
var Title = function Title(_ref) {
|
|
1112
|
+
var title = _ref.title;
|
|
1113
|
+
return jsx(Typography, {
|
|
1114
|
+
sx: {
|
|
1115
|
+
fontSize: '16px',
|
|
1116
|
+
fontWeight: 500,
|
|
1117
|
+
height: 24,
|
|
1118
|
+
textOverflow: 'ellipsis',
|
|
1119
|
+
overflow: 'hidden',
|
|
1120
|
+
whiteSpace: 'nowrap',
|
|
1121
|
+
color: 'geowebColors.typographyAndIcons.text'
|
|
1122
|
+
},
|
|
1123
|
+
"data-testid": "customDialog-title",
|
|
1124
|
+
component: "span",
|
|
1125
|
+
children: title
|
|
1126
|
+
});
|
|
1127
|
+
};
|
|
1128
|
+
var CustomDialogHeader = function CustomDialogHeader(_ref2) {
|
|
1129
|
+
var headerActions = _ref2.headerActions,
|
|
1130
|
+
title = _ref2.title,
|
|
1131
|
+
onClose = _ref2.onClose;
|
|
1132
|
+
var _useSharedTranslation = useSharedTranslation(),
|
|
1133
|
+
t = _useSharedTranslation.t;
|
|
1134
|
+
return !headerActions ? jsxs(DialogTitle, {
|
|
1135
|
+
id: "dialog-title",
|
|
1136
|
+
sx: {
|
|
1137
|
+
zIndex: 1,
|
|
1138
|
+
padding: 2,
|
|
1139
|
+
display: 'flex',
|
|
1140
|
+
justifyContent: 'space-between',
|
|
1141
|
+
alignItems: 'center'
|
|
1142
|
+
},
|
|
1143
|
+
children: [title && jsx(Title, {
|
|
1144
|
+
title: title
|
|
1145
|
+
}), jsx(CustomIconButton, {
|
|
1146
|
+
"data-testid": "customDialog-close",
|
|
1147
|
+
"aria-label": "close",
|
|
1148
|
+
onClick: function onClick() {
|
|
1149
|
+
return onClose('CLOSED');
|
|
1150
|
+
},
|
|
1151
|
+
sx: {
|
|
1152
|
+
'&.MuiIconButton-root': {
|
|
1153
|
+
color: 'geowebColors.greys.accessible'
|
|
1154
|
+
}
|
|
1155
|
+
},
|
|
1156
|
+
children: jsx(Close, {
|
|
1157
|
+
"data-testid": "CloseIcon"
|
|
1158
|
+
})
|
|
1159
|
+
})]
|
|
1160
|
+
}) : jsxs(Grid2, {
|
|
1161
|
+
container: true,
|
|
1162
|
+
"data-testid": "dialog-action-header",
|
|
1163
|
+
alignItems: "center",
|
|
1164
|
+
sx: {
|
|
1165
|
+
boxShadow: 1,
|
|
1166
|
+
py: 0.5,
|
|
1167
|
+
px: 1,
|
|
1168
|
+
zIndex: 1
|
|
1169
|
+
},
|
|
1170
|
+
"aria-label": "Dialog options header",
|
|
1171
|
+
children: [jsx(Grid2, {
|
|
1172
|
+
size: 4,
|
|
1173
|
+
children: jsx(Button, {
|
|
1174
|
+
onClick: function onClick() {
|
|
1175
|
+
return onClose('CLOSED');
|
|
1176
|
+
},
|
|
1177
|
+
variant: "flat",
|
|
1178
|
+
"aria-label": "close",
|
|
1179
|
+
startIcon: jsx(ChevronLeft, {}),
|
|
1180
|
+
"data-testid": "contentdialog-close",
|
|
1181
|
+
sx: {
|
|
1182
|
+
textTransform: 'uppercase'
|
|
882
1183
|
},
|
|
1184
|
+
children: t('shared-customdialog-back')
|
|
1185
|
+
})
|
|
1186
|
+
}), jsx(Grid2, {
|
|
1187
|
+
sx: {
|
|
1188
|
+
display: 'flex',
|
|
1189
|
+
justifyContent: 'center',
|
|
1190
|
+
textAlign: 'center'
|
|
1191
|
+
},
|
|
1192
|
+
size: 4,
|
|
1193
|
+
children: title && jsx(Title, {
|
|
1194
|
+
title: title
|
|
1195
|
+
})
|
|
1196
|
+
}), jsx(Grid2, {
|
|
1197
|
+
size: 4,
|
|
1198
|
+
children: jsx(Box, {
|
|
883
1199
|
sx: {
|
|
884
|
-
display: '
|
|
1200
|
+
display: 'flex',
|
|
1201
|
+
justifyContent: 'flex-end',
|
|
1202
|
+
'button:not(:first-of-type)': {
|
|
1203
|
+
marginLeft: 1
|
|
1204
|
+
}
|
|
885
1205
|
},
|
|
886
|
-
|
|
1206
|
+
children: jsxs(Box, {
|
|
1207
|
+
children: [jsx(Box, {
|
|
1208
|
+
display: {
|
|
1209
|
+
xs: 'none',
|
|
1210
|
+
lg: 'flex'
|
|
1211
|
+
},
|
|
1212
|
+
children: headerActions.map(function (_ref3) {
|
|
1213
|
+
var action = _ref3.action,
|
|
1214
|
+
text = _ref3.text,
|
|
1215
|
+
variant = _ref3.variant,
|
|
1216
|
+
_ref3$isDisabled = _ref3.isDisabled,
|
|
1217
|
+
isDisabled = _ref3$isDisabled === void 0 ? false : _ref3$isDisabled;
|
|
1218
|
+
return jsx(Button, {
|
|
1219
|
+
onClick: action,
|
|
1220
|
+
variant: variant || 'flat',
|
|
1221
|
+
sx: {
|
|
1222
|
+
minWidth: 96
|
|
1223
|
+
},
|
|
1224
|
+
disabled: isDisabled,
|
|
1225
|
+
children: text
|
|
1226
|
+
}, text + "-" + variant);
|
|
1227
|
+
})
|
|
1228
|
+
}), jsx(Box, {
|
|
1229
|
+
display: {
|
|
1230
|
+
sm: 'block',
|
|
1231
|
+
lg: 'none'
|
|
1232
|
+
},
|
|
1233
|
+
children: headerActions.length > 0 && jsx(ToggleMenu, {
|
|
1234
|
+
menuItems: headerActions.map(function (_ref4) {
|
|
1235
|
+
var text = _ref4.text,
|
|
1236
|
+
action = _ref4.action,
|
|
1237
|
+
isDisabled = _ref4.isDisabled,
|
|
1238
|
+
isSelected = _ref4.isSelected;
|
|
1239
|
+
return {
|
|
1240
|
+
text: text,
|
|
1241
|
+
action: action,
|
|
1242
|
+
isDisabled: isDisabled,
|
|
1243
|
+
isSelected: isSelected
|
|
1244
|
+
};
|
|
1245
|
+
})
|
|
1246
|
+
})
|
|
1247
|
+
})]
|
|
1248
|
+
})
|
|
887
1249
|
})
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
onResizeStart: onStartResize
|
|
891
|
-
}, props, {
|
|
892
|
-
children: children
|
|
893
|
-
}));
|
|
1250
|
+
})]
|
|
1251
|
+
});
|
|
894
1252
|
};
|
|
895
1253
|
|
|
896
1254
|
var _excluded$a = ["defaultSize", "onResizeStop", "hasLayout"],
|
|
897
|
-
_excluded2$2 = ["title", "onClose", "description", "actions", "children", "sx", "resizableDefaultSize", "isResizable", "hasLayout", "shouldRenderInline", "slotProps", "disableRestoreFocus"];
|
|
1255
|
+
_excluded2$2 = ["title", "onClose", "description", "actions", "children", "sx", "resizableDefaultSize", "isResizable", "hasLayout", "shouldRenderInline", "slotProps", "disableRestoreFocus", "headerActions"];
|
|
898
1256
|
var PaperComponent = function PaperComponent(_ref) {
|
|
899
1257
|
var _ref$defaultSize = _ref.defaultSize,
|
|
900
1258
|
defaultSize = _ref$defaultSize === void 0 ? {
|
|
@@ -968,25 +1326,28 @@ var CustomDialog = function CustomDialog(_ref2) {
|
|
|
968
1326
|
slotProps = _ref2.slotProps,
|
|
969
1327
|
_ref2$disableRestoreF = _ref2.disableRestoreFocus,
|
|
970
1328
|
disableRestoreFocus = _ref2$disableRestoreF === void 0 ? true : _ref2$disableRestoreF,
|
|
1329
|
+
headerActions = _ref2.headerActions,
|
|
971
1330
|
other = _objectWithoutPropertiesLoose(_ref2, _excluded2$2);
|
|
972
1331
|
var _React$useState = React.useState(resizableDefaultSize),
|
|
973
1332
|
size = _React$useState[0],
|
|
974
1333
|
setSize = _React$useState[1];
|
|
975
1334
|
return jsx(Dialog, Object.assign({
|
|
976
1335
|
"data-testid": "customDialog",
|
|
977
|
-
PaperProps: {
|
|
978
|
-
sx: Object.assign({
|
|
979
|
-
width: '560px',
|
|
980
|
-
margin: 2.5
|
|
981
|
-
}, sx)
|
|
982
|
-
},
|
|
983
1336
|
// fix for briefly showing default options when closing dialog
|
|
984
1337
|
transitionDuration: 0,
|
|
985
1338
|
onClose: function onClose() {
|
|
986
1339
|
_onClose('CLOSED');
|
|
987
1340
|
},
|
|
988
1341
|
"aria-labelledby": "dialog-title",
|
|
989
|
-
slotProps: Object.assign({}, slotProps,
|
|
1342
|
+
slotProps: Object.assign({}, slotProps, {
|
|
1343
|
+
paper: {
|
|
1344
|
+
sx: Object.assign({}, !other.fullWidth && !other.maxWidth && {
|
|
1345
|
+
maxWidth: '560px'
|
|
1346
|
+
}, other.maxWidth && {
|
|
1347
|
+
maxWidth: other.maxWidth
|
|
1348
|
+
}, sx)
|
|
1349
|
+
}
|
|
1350
|
+
}, isResizable && {
|
|
990
1351
|
paper: {
|
|
991
1352
|
defaultSize: size,
|
|
992
1353
|
onResizeStop: setSize,
|
|
@@ -1017,38 +1378,10 @@ var CustomDialog = function CustomDialog(_ref2) {
|
|
|
1017
1378
|
disableRestoreFocus: disableRestoreFocus
|
|
1018
1379
|
}, other, {
|
|
1019
1380
|
children: hasLayout ? jsxs(Fragment, {
|
|
1020
|
-
children: [
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
padding: 2,
|
|
1025
|
-
display: 'flex',
|
|
1026
|
-
justifyContent: 'space-between',
|
|
1027
|
-
alignItems: 'center'
|
|
1028
|
-
},
|
|
1029
|
-
children: [jsx(Typography, {
|
|
1030
|
-
sx: {
|
|
1031
|
-
fontSize: '16px',
|
|
1032
|
-
fontWeight: 500
|
|
1033
|
-
},
|
|
1034
|
-
"data-testid": "customDialog-title",
|
|
1035
|
-
component: "span",
|
|
1036
|
-
children: title
|
|
1037
|
-
}), jsx(CustomIconButton, {
|
|
1038
|
-
"data-testid": "customDialog-close",
|
|
1039
|
-
"aria-label": "close",
|
|
1040
|
-
onClick: function onClick() {
|
|
1041
|
-
return _onClose('CLOSED');
|
|
1042
|
-
},
|
|
1043
|
-
sx: {
|
|
1044
|
-
'&.MuiIconButton-root': {
|
|
1045
|
-
color: 'geowebColors.greys.accessible'
|
|
1046
|
-
}
|
|
1047
|
-
},
|
|
1048
|
-
children: jsx(Close, {
|
|
1049
|
-
"data-testid": "CloseIcon"
|
|
1050
|
-
})
|
|
1051
|
-
})]
|
|
1381
|
+
children: [jsx(CustomDialogHeader, {
|
|
1382
|
+
title: title,
|
|
1383
|
+
headerActions: headerActions,
|
|
1384
|
+
onClose: _onClose
|
|
1052
1385
|
}), jsxs(DialogContent, {
|
|
1053
1386
|
sx: {
|
|
1054
1387
|
padding: '8px 16px'
|
|
@@ -1057,7 +1390,7 @@ var CustomDialog = function CustomDialog(_ref2) {
|
|
|
1057
1390
|
variant: "body1",
|
|
1058
1391
|
children: description
|
|
1059
1392
|
}), children]
|
|
1060
|
-
}), jsx(DialogActions, {
|
|
1393
|
+
}), !headerActions && jsx(DialogActions, {
|
|
1061
1394
|
sx: {
|
|
1062
1395
|
padding: 2,
|
|
1063
1396
|
flexDirection: {
|
|
@@ -1071,28 +1404,6 @@ var CustomDialog = function CustomDialog(_ref2) {
|
|
|
1071
1404
|
}));
|
|
1072
1405
|
};
|
|
1073
1406
|
|
|
1074
|
-
/* *
|
|
1075
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1076
|
-
* you may not use this file except in compliance with the License.
|
|
1077
|
-
* You may obtain a copy of the License at
|
|
1078
|
-
*
|
|
1079
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1080
|
-
*
|
|
1081
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1082
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1083
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1084
|
-
* See the License for the specific language governing permissions and
|
|
1085
|
-
* limitations under the License.
|
|
1086
|
-
*
|
|
1087
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1088
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1089
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1090
|
-
* */
|
|
1091
|
-
var SHARED_NAMESPACE = 'shared';
|
|
1092
|
-
var useSharedTranslation = function useSharedTranslation() {
|
|
1093
|
-
return useTranslation([SHARED_NAMESPACE]);
|
|
1094
|
-
};
|
|
1095
|
-
|
|
1096
1407
|
var confirmStyle = {
|
|
1097
1408
|
width: {
|
|
1098
1409
|
xs: '100%',
|
|
@@ -3666,169 +3977,6 @@ var CustomToggleButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3666
3977
|
}, props));
|
|
3667
3978
|
});
|
|
3668
3979
|
|
|
3669
|
-
var getPosition = function getPosition(menuPosition) {
|
|
3670
|
-
switch (menuPosition) {
|
|
3671
|
-
case 'bottom':
|
|
3672
|
-
return {
|
|
3673
|
-
anchorOrigin: {
|
|
3674
|
-
vertical: 'bottom',
|
|
3675
|
-
horizontal: 'center'
|
|
3676
|
-
},
|
|
3677
|
-
transformOrigin: {
|
|
3678
|
-
vertical: 'top',
|
|
3679
|
-
horizontal: 'center'
|
|
3680
|
-
}
|
|
3681
|
-
};
|
|
3682
|
-
// eslint-disable-next-line default-case-last
|
|
3683
|
-
default:
|
|
3684
|
-
case 'left':
|
|
3685
|
-
return {
|
|
3686
|
-
anchorOrigin: {
|
|
3687
|
-
vertical: 'center',
|
|
3688
|
-
horizontal: 'left'
|
|
3689
|
-
},
|
|
3690
|
-
transformOrigin: {
|
|
3691
|
-
vertical: 'center',
|
|
3692
|
-
horizontal: 'right'
|
|
3693
|
-
}
|
|
3694
|
-
};
|
|
3695
|
-
case 'right':
|
|
3696
|
-
return {
|
|
3697
|
-
anchorOrigin: {
|
|
3698
|
-
vertical: 'center',
|
|
3699
|
-
horizontal: 'right'
|
|
3700
|
-
},
|
|
3701
|
-
transformOrigin: {
|
|
3702
|
-
vertical: 'center',
|
|
3703
|
-
horizontal: 'left'
|
|
3704
|
-
}
|
|
3705
|
-
};
|
|
3706
|
-
}
|
|
3707
|
-
};
|
|
3708
|
-
var ToggleMenu = function ToggleMenu(_ref) {
|
|
3709
|
-
var _ref$buttonTestId = _ref.buttonTestId,
|
|
3710
|
-
buttonTestId = _ref$buttonTestId === void 0 ? 'toggleMenuButton' : _ref$buttonTestId,
|
|
3711
|
-
_ref$menuPosition = _ref.menuPosition,
|
|
3712
|
-
menuPosition = _ref$menuPosition === void 0 ? 'left' : _ref$menuPosition,
|
|
3713
|
-
menuItems = _ref.menuItems,
|
|
3714
|
-
children = _ref.children,
|
|
3715
|
-
buttonSx = _ref.buttonSx,
|
|
3716
|
-
_ref$tooltipTitle = _ref.tooltipTitle,
|
|
3717
|
-
tooltipTitle = _ref$tooltipTitle === void 0 ? '' : _ref$tooltipTitle,
|
|
3718
|
-
_ref$menuTitle = _ref.menuTitle,
|
|
3719
|
-
menuTitle = _ref$menuTitle === void 0 ? '' : _ref$menuTitle,
|
|
3720
|
-
_ref$variant = _ref.variant,
|
|
3721
|
-
variant = _ref$variant === void 0 ? 'tool' : _ref$variant,
|
|
3722
|
-
_ref$isDefaultOpen = _ref.isDefaultOpen,
|
|
3723
|
-
isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen,
|
|
3724
|
-
_ref$buttonIcon = _ref.buttonIcon,
|
|
3725
|
-
buttonIcon = _ref$buttonIcon === void 0 ? jsx(Options, {}) : _ref$buttonIcon,
|
|
3726
|
-
_ref$isDisabled = _ref.isDisabled,
|
|
3727
|
-
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
|
|
3728
|
-
var _React$useState = React.useState(null),
|
|
3729
|
-
anchorEl = _React$useState[0],
|
|
3730
|
-
setAnchorEl = _React$useState[1];
|
|
3731
|
-
var isOpen = Boolean(anchorEl);
|
|
3732
|
-
var _getPosition = getPosition(menuPosition),
|
|
3733
|
-
anchorOrigin = _getPosition.anchorOrigin,
|
|
3734
|
-
transformOrigin = _getPosition.transformOrigin;
|
|
3735
|
-
var handleClick = function handleClick(event) {
|
|
3736
|
-
event.stopPropagation();
|
|
3737
|
-
setAnchorEl(event.currentTarget);
|
|
3738
|
-
};
|
|
3739
|
-
var handleClose = function handleClose(event) {
|
|
3740
|
-
event.stopPropagation();
|
|
3741
|
-
setAnchorEl(null);
|
|
3742
|
-
};
|
|
3743
|
-
React.useEffect(function () {
|
|
3744
|
-
if (isDefaultOpen) {
|
|
3745
|
-
setAnchorEl(document.getElementById(buttonTestId));
|
|
3746
|
-
}
|
|
3747
|
-
}, [isDefaultOpen, buttonTestId]);
|
|
3748
|
-
return jsxs(Fragment, {
|
|
3749
|
-
children: [jsx(CustomIconButton, {
|
|
3750
|
-
tooltipProps: {
|
|
3751
|
-
placement: 'top',
|
|
3752
|
-
title: tooltipTitle
|
|
3753
|
-
},
|
|
3754
|
-
isSelected: isOpen,
|
|
3755
|
-
sx: buttonSx,
|
|
3756
|
-
onClick: handleClick,
|
|
3757
|
-
"data-testid": buttonTestId,
|
|
3758
|
-
variant: variant,
|
|
3759
|
-
id: buttonTestId,
|
|
3760
|
-
disabled: isDisabled,
|
|
3761
|
-
children: buttonIcon
|
|
3762
|
-
}), jsxs(Menu, {
|
|
3763
|
-
anchorEl: anchorEl,
|
|
3764
|
-
open: isOpen,
|
|
3765
|
-
onClose: function onClose(event, reason) {
|
|
3766
|
-
if (reason === 'tabKeyDown') {
|
|
3767
|
-
return;
|
|
3768
|
-
}
|
|
3769
|
-
handleClose(event);
|
|
3770
|
-
},
|
|
3771
|
-
anchorOrigin: anchorOrigin,
|
|
3772
|
-
transformOrigin: transformOrigin,
|
|
3773
|
-
BackdropProps: {
|
|
3774
|
-
style: {
|
|
3775
|
-
opacity: 0,
|
|
3776
|
-
transition: 'none'
|
|
3777
|
-
}
|
|
3778
|
-
},
|
|
3779
|
-
MenuListProps: Object.assign({}, children && {
|
|
3780
|
-
style: {
|
|
3781
|
-
padding: '0px'
|
|
3782
|
-
}
|
|
3783
|
-
}),
|
|
3784
|
-
children: [menuTitle && jsx(ListSubheader, {
|
|
3785
|
-
"data-testid": "toggleMenuTitle",
|
|
3786
|
-
children: jsx(Typography, {
|
|
3787
|
-
sx: {
|
|
3788
|
-
fontSize: '12px'
|
|
3789
|
-
},
|
|
3790
|
-
children: menuTitle
|
|
3791
|
-
})
|
|
3792
|
-
}), menuItems && menuItems.length ? menuItems.map(function (menuItem) {
|
|
3793
|
-
var text = menuItem.text,
|
|
3794
|
-
icon = menuItem.icon,
|
|
3795
|
-
action = menuItem.action,
|
|
3796
|
-
isDisabled = menuItem.isDisabled;
|
|
3797
|
-
return jsx(MenuItem, {
|
|
3798
|
-
onClick: function onClick(event) {
|
|
3799
|
-
action(event);
|
|
3800
|
-
handleClose(event);
|
|
3801
|
-
},
|
|
3802
|
-
disabled: isDisabled,
|
|
3803
|
-
selected: menuItem.isSelected,
|
|
3804
|
-
children: jsxs(Grid2, {
|
|
3805
|
-
container: true,
|
|
3806
|
-
spacing: 2,
|
|
3807
|
-
justifyContent: "space-between",
|
|
3808
|
-
size: "grow",
|
|
3809
|
-
children: [jsx(Grid2, {
|
|
3810
|
-
children: jsx(ListItemText, {
|
|
3811
|
-
children: text
|
|
3812
|
-
})
|
|
3813
|
-
}), icon && jsx(Grid2, {
|
|
3814
|
-
alignItems: "flex-end",
|
|
3815
|
-
children: jsx(ListItemIcon, {
|
|
3816
|
-
sx: {
|
|
3817
|
-
'&.MuiListItemIcon-root': {
|
|
3818
|
-
minWidth: '24px'
|
|
3819
|
-
}
|
|
3820
|
-
},
|
|
3821
|
-
children: icon
|
|
3822
|
-
})
|
|
3823
|
-
})]
|
|
3824
|
-
})
|
|
3825
|
-
}, text);
|
|
3826
|
-
}) : jsx("div", {}) // Needed to make the menu work without any menuItems
|
|
3827
|
-
, children]
|
|
3828
|
-
})]
|
|
3829
|
-
});
|
|
3830
|
-
};
|
|
3831
|
-
|
|
3832
3980
|
var _excluded$4 = ["tooltip", "list", "currentIndex", "onChangeMouseWheel", "requiresCtrlToChange", "isEnabled", "hasBackgroundColor", "variant", "additionalStyling", "skipLocalStyling"],
|
|
3833
3981
|
_excluded2 = ["className", "additionalStyling"];
|
|
3834
3982
|
var TooltipSelect = function TooltipSelect(_ref) {
|
|
@@ -4364,7 +4512,9 @@ var LastUpdateTime = function LastUpdateTime(_ref) {
|
|
|
4364
4512
|
var _ref$onPressRefresh = _ref.onPressRefresh,
|
|
4365
4513
|
onPressRefresh = _ref$onPressRefresh === void 0 ? function () {} : _ref$onPressRefresh,
|
|
4366
4514
|
lastUpdateTime = _ref.lastUpdateTime,
|
|
4367
|
-
dataTestId = _ref.dataTestId
|
|
4515
|
+
dataTestId = _ref.dataTestId,
|
|
4516
|
+
_ref$hideLabel = _ref.hideLabel,
|
|
4517
|
+
hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel;
|
|
4368
4518
|
var _useTranslation = useTranslation(SHARED_NAMESPACE),
|
|
4369
4519
|
t = _useTranslation.t;
|
|
4370
4520
|
return jsxs(Box, {
|
|
@@ -4374,7 +4524,7 @@ var LastUpdateTime = function LastUpdateTime(_ref) {
|
|
|
4374
4524
|
height: '100%',
|
|
4375
4525
|
justifyContent: 'flex-end'
|
|
4376
4526
|
},
|
|
4377
|
-
children: [jsx(Typography, {
|
|
4527
|
+
children: [!hideLabel && jsx(Typography, {
|
|
4378
4528
|
sx: {
|
|
4379
4529
|
color: 'geowebColors.captions.captionStatus.rgba',
|
|
4380
4530
|
fontSize: '10px',
|
|
@@ -4889,7 +5039,8 @@ var Filter = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
4889
5039
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
4890
5040
|
return jsx(Box, {
|
|
4891
5041
|
sx: Object.assign({
|
|
4892
|
-
marginBottom: '8px'
|
|
5042
|
+
marginBottom: '8px',
|
|
5043
|
+
width: '100%'
|
|
4893
5044
|
}, props.sx),
|
|
4894
5045
|
ref: ref,
|
|
4895
5046
|
children: jsxs(Stack, {
|
|
@@ -6027,9 +6178,5 @@ var SystemScope = {
|
|
|
6027
6178
|
user: 'user',
|
|
6028
6179
|
system: 'system'
|
|
6029
6180
|
};
|
|
6030
|
-
// eslint-disable-next-line no-redeclare
|
|
6031
|
-
var PresetScope = Object.assign({}, SystemScope, {
|
|
6032
|
-
shared: 'shared'
|
|
6033
|
-
});
|
|
6034
6181
|
|
|
6035
|
-
export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, CanvasComponent, ConfirmationButtons, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEBOUNCE_TIMEOUT, DEFAULT_ERROR_MESSAGE, DEFAULT_FILTER_HEIGHT, DraggableComponent$1 as Draggable, ErrorBoundary, Filter, FilterChip, FilterOption, LastUpdateTime, PROJECTION,
|
|
6182
|
+
export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, CanvasComponent, ConfirmationButtons, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomDialogHeader, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEBOUNCE_TIMEOUT, DEFAULT_ERROR_MESSAGE, DEFAULT_FILTER_HEIGHT, DraggableComponent$1 as Draggable, ErrorBoundary, Filter, FilterChip, FilterOption, LastUpdateTime, PROJECTION, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField$1 as SearchField, SearchFieldButton, SearchHighlight, StatusTag, StorybookDocsWrapper, StyledSelect, SwitchButton, SystemScope, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, UserMenuItemSentryRecording, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, createToolkitMockStore, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getLastUpdateTitle, getPosition, getWarningMessage, isAxiosAuthError, isAxiosError, loadAllTranslations, pollingIntervalTimeout, renderCounter, safelyInitI18nForTestsAndStories, sharedTranslations, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDebounce, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, useWheelStopPropagation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/shared",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.2.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": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@opengeoweb/theme": "12.
|
|
11
|
+
"@opengeoweb/theme": "12.2.0",
|
|
12
12
|
"react-draggable": "^4.4.6",
|
|
13
13
|
"re-resizable": "^6.9.11",
|
|
14
14
|
"lodash": "^4.17.21",
|
package/src/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export * from './lib/components';
|
|
|
3
3
|
export * from './lib/hooks';
|
|
4
4
|
export * from './lib/utils';
|
|
5
5
|
export * from './lib/types';
|
|
6
|
-
export { SHARED_NAMESPACE } from './lib/utils/i18n';
|
|
6
|
+
export { SHARED_NAMESPACE, loadAllTranslations, safelyInitI18nForTestsAndStories, } from './lib/utils/i18n';
|
|
7
7
|
export { sharedTranslations };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { DialogAction } from '../CustomDialog';
|
|
2
|
+
import { DialogAction } from '../CustomDialog/types';
|
|
3
3
|
export type ConfirmationAction = 'CANCELLED' | DialogAction;
|
|
4
4
|
export interface ConfirmationButtonsProps {
|
|
5
5
|
confirmLabel?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ModalProps, SxProps, Theme } from '@mui/material';
|
|
3
|
-
import { DialogAction } from '../CustomDialog';
|
|
3
|
+
import { DialogAction } from '../CustomDialog/types';
|
|
4
4
|
export interface ConfirmationOptions {
|
|
5
5
|
title?: string;
|
|
6
6
|
description?: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DialogProps } from '@mui/material';
|
|
3
3
|
import { Size } from '../DraggableResizable';
|
|
4
|
-
|
|
4
|
+
import { DialogAction } from './types';
|
|
5
|
+
import { HeaderAction } from './CustomDialogHeader';
|
|
5
6
|
export interface CustomDialogProps extends DialogProps {
|
|
6
7
|
description?: string;
|
|
7
8
|
actions?: React.ReactNode;
|
|
@@ -10,6 +11,7 @@ export interface CustomDialogProps extends DialogProps {
|
|
|
10
11
|
resizableDefaultSize?: Size;
|
|
11
12
|
hasLayout?: boolean;
|
|
12
13
|
shouldRenderInline?: boolean;
|
|
14
|
+
headerActions?: HeaderAction[];
|
|
13
15
|
}
|
|
14
16
|
export declare const CustomDialog: React.FC<CustomDialogProps>;
|
|
15
17
|
export default CustomDialog;
|
|
@@ -10,6 +10,8 @@ export default _default;
|
|
|
10
10
|
type Story = StoryObj<typeof CustomDialog>;
|
|
11
11
|
export declare const CustomDialogLight: Story;
|
|
12
12
|
export declare const CustomDialogDark: Story;
|
|
13
|
+
export declare const CustomDialogFullWidth: Story;
|
|
14
|
+
export declare const CustomDialogFixedWith: Story;
|
|
13
15
|
export declare const CustomDialogLargeContent: Story;
|
|
14
16
|
export declare const CustomDialogLargeContentResizable: Story;
|
|
15
17
|
export declare const CustomDialogResizable: Story;
|
|
@@ -17,3 +19,4 @@ export declare const CustomDialogResizableWithInitialSize: Story;
|
|
|
17
19
|
export declare const CustomDialogRenderInline: Story;
|
|
18
20
|
export declare const CustomDialogResizableNoLayout: Story;
|
|
19
21
|
export declare const CustomDialogWithAutofocus: Story;
|
|
22
|
+
export declare const CustomDialogHeaderActions: Story;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ButtonVariant } from '@opengeoweb/theme';
|
|
3
|
+
import { DialogAction } from './types';
|
|
4
|
+
import { MenuItemType } from '../ToggleMenu';
|
|
5
|
+
export type HeaderAction = MenuItemType & {
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
};
|
|
8
|
+
export declare const CustomDialogHeader: React.FC<{
|
|
9
|
+
headerActions?: HeaderAction[];
|
|
10
|
+
title?: string;
|
|
11
|
+
onClose: (reason: DialogAction) => void;
|
|
12
|
+
}>;
|
|
13
|
+
export default CustomDialogHeader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { CustomDialogHeader } from './CustomDialogHeader';
|
|
3
|
+
type Story = StoryObj<typeof CustomDialogHeader>;
|
|
4
|
+
declare const meta: Meta<typeof CustomDialogHeader>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const HeaderActions: Story;
|
|
7
|
+
export declare const HeaderActionsDark: Story;
|
|
8
|
+
export declare const HeaderTitle: Story;
|
|
9
|
+
export declare const HeaderTitleDark: Story;
|
|
10
|
+
export declare const HeaderActionsDisabled: Story;
|
|
11
|
+
export declare const HeaderActionsEmpty: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DialogAction = 'CLOSED';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { TFunction } from 'i18next';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
export declare const getLastUpdateTitle: (time: string, t: TFunction) => string;
|
|
4
4
|
interface LastUpdateTimeProps {
|
|
5
5
|
onPressRefresh: () => void;
|
|
6
6
|
lastUpdateTime?: string;
|
|
7
7
|
dataTestId?: string;
|
|
8
|
+
hideLabel?: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare const LastUpdateTime: React.FC<LastUpdateTimeProps>;
|
|
10
11
|
export default LastUpdateTime;
|
|
@@ -16,5 +16,9 @@ type TooltipSelectProps = Omit<BaseSelectProps, 'sx'> & {
|
|
|
16
16
|
skipLocalStyling?: boolean;
|
|
17
17
|
};
|
|
18
18
|
export declare const TooltipSelect: React.FC<TooltipSelectProps>;
|
|
19
|
+
interface StyledSelectProps extends Omit<TooltipSelectProps, 'tooltip' | 'skipLocalStyling'> {
|
|
20
|
+
skipLocalStyling: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const StyledSelect: import("@emotion/styled").StyledComponent<Omit<StyledSelectProps, "ref"> & React.RefAttributes<unknown> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
|
|
19
23
|
export declare const tooltipContainerStyles: (theme: Theme, isEnabled: boolean, hasBackgroundColor?: boolean) => object;
|
|
20
24
|
export {};
|
package/src/lib/types/types.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export interface ConfigType {
|
|
|
20
20
|
GW_PRESET_BACKEND_URL?: string;
|
|
21
21
|
GW_CAP_BASE_URL?: string;
|
|
22
22
|
GW_DRAWINGS_BASE_URL?: string;
|
|
23
|
+
GW_WARNINGS_WORKSPACE_ID?: string;
|
|
24
|
+
GW_SPACEWEATHER_WORKSPACE_ID?: string;
|
|
23
25
|
GW_TECHNICAL_RELEASE_NOTES_URL?: string;
|
|
24
26
|
GW_VERSION_PROGRESS_NOTES_URL?: string;
|
|
25
27
|
GW_LOCATION_BASE_URL?: string;
|
|
@@ -36,6 +38,12 @@ export interface ConfigType {
|
|
|
36
38
|
GW_FEATURE_TAF_AUTOTAF_ENABLED?: boolean;
|
|
37
39
|
GW_LANGUAGE?: string;
|
|
38
40
|
}
|
|
41
|
+
export interface SoundingsCollection {
|
|
42
|
+
name: string;
|
|
43
|
+
id: string;
|
|
44
|
+
url: string;
|
|
45
|
+
description: string;
|
|
46
|
+
}
|
|
39
47
|
export interface TimeSeriesService {
|
|
40
48
|
id: string;
|
|
41
49
|
description: string;
|
|
@@ -50,12 +58,6 @@ export declare const SystemScope: {
|
|
|
50
58
|
readonly user: SystemScope;
|
|
51
59
|
readonly system: SystemScope;
|
|
52
60
|
};
|
|
53
|
-
export type PresetScope = SystemScope | 'shared';
|
|
54
|
-
export declare const PresetScope: {
|
|
55
|
-
readonly shared: PresetScope;
|
|
56
|
-
readonly user: SystemScope;
|
|
57
|
-
readonly system: SystemScope;
|
|
58
|
-
};
|
|
59
61
|
export interface PlotPreset {
|
|
60
62
|
connectedMap?: string;
|
|
61
63
|
mapId: string;
|
package/src/lib/utils/i18n.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import i18n from 'i18next';
|
|
2
2
|
import { UseTranslationResponse } from 'react-i18next';
|
|
3
3
|
export declare const SHARED_NAMESPACE = "shared";
|
|
4
|
+
type GeoWebLanguage = 'en' | 'fi' | 'no' | 'nl';
|
|
5
|
+
interface TranslationToLoad {
|
|
6
|
+
ns: string;
|
|
7
|
+
translations: Record<GeoWebLanguage, Record<string, string>>;
|
|
8
|
+
}
|
|
9
|
+
export declare const loadAllTranslations: (i18nInstance: typeof i18n, translationsToLoad: TranslationToLoad[]) => void;
|
|
10
|
+
export declare const safelyInitI18nForTestsAndStories: (i18nInstance: typeof i18n, namespace: string, translationsToLoad: TranslationToLoad[], initLanguage?: string) => void;
|
|
4
11
|
export declare const initSharedI18n: () => void;
|
|
5
12
|
export declare const translateKeyOutsideComponents: (key: string, params?: Record<string, string | number> | undefined) => string;
|
|
6
13
|
export declare const useSharedTranslation: () => UseTranslationResponse<typeof SHARED_NAMESPACE, typeof i18n>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|