@opengeoweb/shared 20.0.0 → 20.0.1

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/dist/index.esm.js CHANGED
@@ -833,6 +833,17 @@ var getPosition = function getPosition(menuPosition) {
833
833
  horizontal: 'center'
834
834
  }
835
835
  };
836
+ case 'top':
837
+ return {
838
+ anchorOrigin: {
839
+ vertical: 'top',
840
+ horizontal: 'center'
841
+ },
842
+ transformOrigin: {
843
+ vertical: 'bottom',
844
+ horizontal: 'center'
845
+ }
846
+ };
836
847
  // eslint-disable-next-line default-case-last
837
848
  default:
838
849
  case 'left':
@@ -867,6 +878,7 @@ var ToggleMenu = function ToggleMenu(_ref) {
867
878
  menuItems = _ref.menuItems,
868
879
  children = _ref.children,
869
880
  buttonSx = _ref.buttonSx,
881
+ renderButton = _ref.renderButton,
870
882
  _ref$tooltipTitle = _ref.tooltipTitle,
871
883
  tooltipTitle = _ref$tooltipTitle === void 0 ? '' : _ref$tooltipTitle,
872
884
  _ref$menuTitle = _ref.menuTitle,
@@ -964,7 +976,10 @@ var ToggleMenu = function ToggleMenu(_ref) {
964
976
  }
965
977
  }, [isDefaultOpen, buttonTestId]);
966
978
  return jsxs(Fragment, {
967
- children: [jsx(CustomIconButton, {
979
+ children: [renderButton ? renderButton({
980
+ onClick: handleClick,
981
+ isOpen: isOpen
982
+ }) : jsx(CustomIconButton, {
968
983
  "data-testid": buttonTestId,
969
984
  disabled: isDisabled,
970
985
  id: buttonTestId,
@@ -2240,6 +2255,32 @@ var AppHeader = function AppHeader(_ref) {
2240
2255
  });
2241
2256
  };
2242
2257
 
2258
+ /* *
2259
+ * Licensed under the Apache License, Version 2.0 (the "License");
2260
+ * you may not use this file except in compliance with the License.
2261
+ * You may obtain a copy of the License at
2262
+ *
2263
+ * http://www.apache.org/licenses/LICENSE-2.0
2264
+ *
2265
+ * Unless required by applicable law or agreed to in writing, software
2266
+ * distributed under the License is distributed on an "AS IS" BASIS,
2267
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2268
+ * See the License for the specific language governing permissions and
2269
+ * limitations under the License.
2270
+ *
2271
+ * Copyright 2026 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2272
+ * Copyright 2026 - Finnish Meteorological Institute (FMI)
2273
+ * Copyright 2026 - The Norwegian Meteorological Institute (MET Norway)
2274
+ * */
2275
+ var browserNavigation = {
2276
+ assign: function assign(url) {
2277
+ return window.location.assign(url);
2278
+ },
2279
+ reload: function reload() {
2280
+ return window.location.reload();
2281
+ }
2282
+ };
2283
+
2243
2284
  // TODO: (Sander de Snaijer 2020-07-13) this error wrappper should get more (non-breaking?) logic when we have decided how to handle errors.
2244
2285
  /**
2245
2286
  * ErrorBoundary
@@ -2327,7 +2368,7 @@ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
2327
2368
  info: jsxs("div", {
2328
2369
  children: [jsx("br", {}), error.toString(), jsx("br", {}), errorInfo == null ? void 0 : errorInfo.componentStack, jsx("br", {}), jsx("br", {}), jsx(Link, {
2329
2370
  onClick: function onClick() {
2330
- return window.location.reload();
2371
+ return browserNavigation.reload();
2331
2372
  },
2332
2373
  style: {
2333
2374
  cursor: 'pointer'
@@ -6569,6 +6610,8 @@ var arrowKeySteps = {
6569
6610
  var integerKeys = getAllowedKeys('numeric');
6570
6611
  var CARET_WIDTH = '24px';
6571
6612
  var SIGN_WIDTH = '1ch';
6613
+ // The unit adornment sits inside the filled input's right padding.
6614
+ var FIELD_PADDING_RIGHT = '12px';
6572
6615
  var transparentBackdrop = {
6573
6616
  slotProps: {
6574
6617
  backdrop: {
@@ -6591,6 +6634,24 @@ var styles = {
6591
6634
  marginTop: '16px'
6592
6635
  }
6593
6636
  };
6637
+ /** The field underline is the focus marker, so it spans only the focused part instead of both. */
6638
+ var partFocusUnderline = function partFocusUnderline(unitWidth) {
6639
+ return function (theme) {
6640
+ return {
6641
+ '&:after': {
6642
+ borderColor: theme.palette.geowebColors.captions.captionInformation.rgba,
6643
+ right: "calc(" + unitWidth + " + " + FIELD_PADDING_RIGHT + ")"
6644
+ },
6645
+ /* Mui-focused only follows the value input, so the unit has to claim the underline itself. */
6646
+ '&:has(.MuiSelect-select:focus):after': {
6647
+ left: 'auto',
6648
+ right: 0,
6649
+ transform: 'scaleX(1)',
6650
+ width: "calc(" + unitWidth + " + " + FIELD_PADDING_RIGHT + ")"
6651
+ }
6652
+ };
6653
+ };
6654
+ };
6594
6655
  var isClipboardShortcut = function isClipboardShortcut(event) {
6595
6656
  var isMac = window.navigator.userAgent.includes(' Mac ');
6596
6657
  var hasModifier = isMac ? event.metaKey : event.ctrlKey;
@@ -6707,6 +6768,13 @@ var NumberWithUnitField = function NumberWithUnitField(_ref) {
6707
6768
  variant: "standard",
6708
6769
  children: jsx(Select, {
6709
6770
  MenuProps: transparentBackdrop,
6771
+ /* Select escalates its own min-width rule by repeating its class, so only an inline style wins. */
6772
+ SelectDisplayProps: {
6773
+ style: {
6774
+ textAlign: 'right',
6775
+ width: unitWidth
6776
+ }
6777
+ },
6710
6778
  disableUnderline: true,
6711
6779
  disabled: disabled,
6712
6780
  inputProps: {
@@ -6718,13 +6786,6 @@ var NumberWithUnitField = function NumberWithUnitField(_ref) {
6718
6786
  unit: event.target.value
6719
6787
  });
6720
6788
  },
6721
- /* Select escalates its own min-width rule by repeating its class, so only an inline style wins. */
6722
- SelectDisplayProps: {
6723
- style: {
6724
- textAlign: 'right',
6725
- width: unitWidth
6726
- }
6727
- },
6728
6789
  value: unit,
6729
6790
  variant: "standard",
6730
6791
  children: unitOptions.map(function (option) {
@@ -6748,6 +6809,7 @@ var NumberWithUnitField = function NumberWithUnitField(_ref) {
6748
6809
  },
6749
6810
  onKeyDown: handleKeyDown,
6750
6811
  onPaste: handlePaste,
6812
+ sx: partFocusUnderline(unitWidth),
6751
6813
  value: typedValue
6752
6814
  })]
6753
6815
  });
@@ -6878,4 +6940,4 @@ var SystemScope = {
6878
6940
  plugin: 'plugin'
6879
6941
  };
6880
6942
 
6881
- 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, DateTimePicker, DraggableComponent$1 as Draggable, ErrorBoundary, Filter, FilterChip, FilterOption, LastUpdateTime, LegendToggleButton, NumberWithUnitField, PROJECTION, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField$1 as SearchField, SearchFieldButton, SearchHighlight, SessionStorageKey, StatusTag, StorybookDocsWrapper, StyledSelect, SwitchButton, SystemScope, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, convertNumericInputValue, index$1 as dateUtils, defaultDelay, getAllowedKeys, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getLastUpdateTitle, getPosition, getWarningMessage, isAuthError, isAxiosAuthError, isAxiosError, isDialogFocused, isTargetInteractiveInput, linkifyText, loadAllTranslations, pickerDateToUTC, pollingIntervalTimeout, index as referenceTimeUtils, renderCounter, safelyInitI18nForTestsAndStories, sessionStorageProvider, sharedTranslations, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDebounce, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useResizeObserver, useScrollingInIsolation, useUserMenu, useWheelStopPropagation, utcToPickerDate };
6943
+ 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, DateTimePicker, DraggableComponent$1 as Draggable, ErrorBoundary, Filter, FilterChip, FilterOption, LastUpdateTime, LegendToggleButton, NumberWithUnitField, PROJECTION, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField$1 as SearchField, SearchFieldButton, SearchHighlight, SessionStorageKey, StatusTag, StorybookDocsWrapper, StyledSelect, SwitchButton, SystemScope, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, adjustPosition, browserNavigation, calculateDialogSizeAndPosition, calculateStartSize, convertNumericInputValue, index$1 as dateUtils, defaultDelay, getAllowedKeys, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getLastUpdateTitle, getPosition, getWarningMessage, isAuthError, isAxiosAuthError, isAxiosError, isDialogFocused, isTargetInteractiveInput, linkifyText, loadAllTranslations, pickerDateToUTC, pollingIntervalTimeout, index as referenceTimeUtils, renderCounter, safelyInitI18nForTestsAndStories, sessionStorageProvider, sharedTranslations, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDebounce, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useResizeObserver, useScrollingInIsolation, useUserMenu, useWheelStopPropagation, utcToPickerDate };
@@ -1,7 +1,7 @@
1
1
  import type { PopoverOrigin, SxProps, Theme } from '@mui/material';
2
2
  import React from 'react';
3
3
  import type { Variant } from '../CustomIconButton';
4
- type MenuPosition = 'left' | 'right' | 'bottom';
4
+ type MenuPosition = 'left' | 'right' | 'bottom' | 'top';
5
5
  export declare const getPosition: (menuPosition: MenuPosition) => {
6
6
  anchorOrigin: PopoverOrigin;
7
7
  transformOrigin: PopoverOrigin;
@@ -14,6 +14,10 @@ export interface MenuItemType {
14
14
  isSelected?: boolean;
15
15
  controlType?: 'radio';
16
16
  }
17
+ export interface ToggleMenuButtonRenderProps {
18
+ onClick: (event: React.MouseEvent<HTMLElement>) => void;
19
+ isOpen: boolean;
20
+ }
17
21
  interface ToggleMenuProps {
18
22
  buttonTestId?: string;
19
23
  menuPosition?: MenuPosition;
@@ -23,6 +27,12 @@ interface ToggleMenuProps {
23
27
  secondaryMenuTitle?: string;
24
28
  children?: React.ReactNode;
25
29
  buttonSx?: SxProps<Theme>;
30
+ /**
31
+ * Renders a custom toggle button instead of the default CustomIconButton.
32
+ * The given onClick must be wired to the rendered button so the menu can
33
+ * anchor itself to it.
34
+ */
35
+ renderButton?: (props: ToggleMenuButtonRenderProps) => React.ReactNode;
26
36
  tooltipTitle?: string;
27
37
  variant?: Variant;
28
38
  isDefaultOpen?: boolean;
@@ -115,10 +115,10 @@ export interface PlotParameter {
115
115
  collectionId: string;
116
116
  instanceId?: string;
117
117
  instances?: EDRInstance[];
118
- dimension?: {
118
+ dimensions?: {
119
119
  id: string;
120
120
  value: string;
121
- };
121
+ }[];
122
122
  }
123
123
  export type PlotType = 'bar' | 'line' | 'scatter';
124
124
  export interface EdrParameter {
@@ -0,0 +1,4 @@
1
+ export declare const browserNavigation: {
2
+ assign: (url: string) => void;
3
+ reload: () => void;
4
+ };
@@ -1,4 +1,5 @@
1
1
  export * from './axiosErrorUtils';
2
+ export { browserNavigation } from './browserNavigation';
2
3
  export * as dateUtils from './dateUtils';
3
4
  export * as referenceTimeUtils from './referenceTimeUtils';
4
5
  export * from './linkify';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "20.0.0",
3
+ "version": "20.0.1",
4
4
  "description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,7 +20,7 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@opengeoweb/theme": "20.0.0",
23
+ "@opengeoweb/theme": "20.0.1",
24
24
  "react-draggable": "^4.4.6",
25
25
  "re-resizable": "^6.9.11",
26
26
  "lodash": "^4.18.1",