@opengeoweb/shared 9.36.0 → 9.37.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { Box, Typography, Tooltip, IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, useTheme, Drawer, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, Grid2, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Switch, Slider, ToggleButton, Menu, ListSubheader, ListItemText, ListItemIcon, styled, Select, Accordion, AccordionSummary, AccordionDetails, FormLabel, TextField, InputAdornment, Chip, Stack, debounce as debounce$1, Checkbox, ListItemButton } from '@mui/material';
3
- import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Resize, Admin, useThemeContext, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, ChevronDown, Search, Clear, Cached } from '@opengeoweb/theme';
3
+ import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Resize, Admin, useThemeContext, ThemeTypes, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, ChevronDown, Search, Clear, Cached } from '@opengeoweb/theme';
4
4
  import * as React from 'react';
5
5
  import React__default, { useRef, Component, useState } from 'react';
6
6
  import 'i18next';
@@ -10,7 +10,7 @@ import Draggable from 'react-draggable';
10
10
  import { Resizable } from 're-resizable';
11
11
  import * as Sentry from '@sentry/react';
12
12
  import { useStore } from 'react-redux';
13
- 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, getDay, getDayOfYear, getMonth, getWeek, getYear, isWithinInterval } from 'date-fns';
13
+ 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';
14
14
  import { configureStore } from '@reduxjs/toolkit';
15
15
 
16
16
  var en = {
@@ -66,6 +66,7 @@ var en = {
66
66
  "shared-clear": "Clear",
67
67
  "shared-light": "Light",
68
68
  "shared-dark": "Dark",
69
+ "shared-xmas": "Christmas",
69
70
  "shared-filter-all": "All",
70
71
  "shared-filter-my-presets": "My presets",
71
72
  "shared-filter-system-presets": "System presets",
@@ -125,6 +126,7 @@ var fi = {
125
126
  "shared-clear": "Tyhjennä",
126
127
  "shared-light": "Vaalea",
127
128
  "shared-dark": "Tumma",
129
+ "shared-xmas": "Joulu",
128
130
  "shared-filter-all": "Kaikki",
129
131
  "shared-filter-my-presets": "Omat presetit",
130
132
  "shared-filter-system-presets": "Järestelmä presetit",
@@ -184,6 +186,7 @@ var no = {
184
186
  "shared-clear": "Tøm",
185
187
  "shared-light": "Lys",
186
188
  "shared-dark": "Mørk",
189
+ "shared-xmas": "Christmas",
187
190
  "shared-filter-all": "Alle",
188
191
  "shared-filter-my-presets": "Mine presets",
189
192
  "shared-filter-system-presets": "System presets",
@@ -243,6 +246,7 @@ var nl = {
243
246
  "shared-clear": "Wissen",
244
247
  "shared-light": "Licht",
245
248
  "shared-dark": "Donker",
249
+ "shared-xmas": "Kerstmis",
246
250
  "shared-filter-all": "Alle",
247
251
  "shared-filter-my-presets": "Mijn presets",
248
252
  "shared-filter-system-presets": "Systeem presets",
@@ -1476,7 +1480,7 @@ var AppLayout = function AppLayout(_ref) {
1476
1480
  };
1477
1481
 
1478
1482
  var AppHeader = function AppHeader(_ref) {
1479
- var _sx;
1483
+ var _sx, _theme$palette$geoweb;
1480
1484
  var menu = _ref.menu,
1481
1485
  userMenu = _ref.userMenu,
1482
1486
  workspaceTopBar = _ref.workspaceTopBar,
@@ -1529,7 +1533,14 @@ var AppHeader = function AppHeader(_ref) {
1529
1533
  alignItems: 'center',
1530
1534
  cursor: onClick ? 'pointer' : 'auto'
1531
1535
  },
1532
- children: [jsx(GeoWebLogo, {
1536
+ children: [(_theme$palette$geoweb = theme.palette.geowebColors.logo) != null && _theme$palette$geoweb.image ? jsx("img", {
1537
+ src: theme.palette.geowebColors.logo.image,
1538
+ alt: "GeoWeb",
1539
+ style: {
1540
+ height: '29px',
1541
+ width: '47px'
1542
+ }
1543
+ }) : jsx(GeoWebLogo, {
1533
1544
  style: {
1534
1545
  position: 'relative',
1535
1546
  top: '-1px',
@@ -1952,8 +1963,8 @@ var UserMenu = function UserMenu(_ref) {
1952
1963
 
1953
1964
  var MenuItemTheme = function MenuItemTheme() {
1954
1965
  var _useThemeContext = useThemeContext(),
1955
- isDark = _useThemeContext.isDark,
1956
- toggleTheme = _useThemeContext.toggleTheme;
1966
+ namedTheme = _useThemeContext.namedTheme,
1967
+ setThemeName = _useThemeContext.setThemeName;
1957
1968
  var _useTranslation = useTranslation(SHARED_NAMESPACE),
1958
1969
  t = _useTranslation.t;
1959
1970
  return jsx(MenuItem, {
@@ -1964,19 +1975,29 @@ var MenuItemTheme = function MenuItemTheme() {
1964
1975
  children: t('shared-choose-app-mode')
1965
1976
  }), jsx(Grid2, {
1966
1977
  children: jsxs(RadioGroup, {
1967
- onChange: toggleTheme,
1978
+ onChange: function onChange(event, value) {
1979
+ if (value && setThemeName) {
1980
+ setThemeName(value);
1981
+ }
1982
+ },
1968
1983
  children: [jsx(FormControlLabel, {
1969
- value: true,
1984
+ value: ThemeTypes.LIGHT_THEME,
1970
1985
  control: jsx(Radio, {
1971
- checked: !isDark
1986
+ checked: (namedTheme == null ? void 0 : namedTheme.name) === ThemeTypes.LIGHT_THEME
1972
1987
  }),
1973
1988
  label: t('shared-light')
1974
1989
  }), jsx(FormControlLabel, {
1975
- value: false,
1990
+ value: ThemeTypes.DARK_THEME,
1976
1991
  control: jsx(Radio, {
1977
- checked: isDark
1992
+ checked: (namedTheme == null ? void 0 : namedTheme.name) === ThemeTypes.DARK_THEME
1978
1993
  }),
1979
1994
  label: t('shared-dark')
1995
+ }), jsx(FormControlLabel, {
1996
+ value: ThemeTypes.XMAS2024_THEME,
1997
+ control: jsx(Radio, {
1998
+ checked: (namedTheme == null ? void 0 : namedTheme.name) === ThemeTypes.XMAS2024_THEME
1999
+ }),
2000
+ label: t('shared-xmas') + " 2024"
1980
2001
  })]
1981
2002
  })
1982
2003
  })]
@@ -3462,7 +3483,7 @@ var CustomSlider = function CustomSlider(_ref) {
3462
3483
  rest.forEach(function (element) {
3463
3484
  return element.classList.remove('selectedLabel');
3464
3485
  });
3465
- }, [value, themeContext.isDark]);
3486
+ }, [value, themeContext.namedTheme]);
3466
3487
  // autofocus
3467
3488
  React.useEffect(function () {
3468
3489
  if (shouldAutoFocus && element.current) {
@@ -5710,6 +5731,29 @@ var convertNOWandTODAYFormatsToUTC = function convertNOWandTODAYFormatsToUTC(tim
5710
5731
  }
5711
5732
  throw new Error('Invalid endTime format');
5712
5733
  };
5734
+ /**
5735
+ * @name setSeconds
5736
+ * @category Second Helpers
5737
+ * @summary Set the seconds to the given date.
5738
+ *
5739
+ * @description
5740
+ * Set the seconds to the given date.
5741
+ *
5742
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
5743
+ *
5744
+ * @param date - The date to be changed
5745
+ * @param seconds - The seconds of the new date
5746
+ *
5747
+ * @returns The new date with the seconds set
5748
+ *
5749
+ * @example
5750
+ * // Set 45 seconds to 1 September 2014 11:30:40:
5751
+ * const result = setSeconds(new Date(2014, 8, 1, 11, 30, 40), 45)
5752
+ * //=> Mon Sep 01 2014 11:30:45
5753
+ */
5754
+ var setSeconds = function setSeconds(date, seconds) {
5755
+ return setSeconds$1(date, seconds);
5756
+ };
5713
5757
 
5714
5758
  /* *
5715
5759
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -5772,6 +5816,7 @@ var index = /*#__PURE__*/Object.freeze({
5772
5816
  parseISO: parseISO,
5773
5817
  roundToNearestMinutes: roundToNearestMinutes,
5774
5818
  set: set,
5819
+ setSeconds: setSeconds,
5775
5820
  setUTCDate: setUTCDate,
5776
5821
  startOfDay: startOfDay,
5777
5822
  startOfDayUTC: startOfDayUTC,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "9.36.0",
3
+ "version": "9.37.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": {
@@ -334,6 +334,27 @@ export declare const convertNOWFormatToUTC: (timeValue: string) => string;
334
334
  * @returns Time in UTC format
335
335
  */
336
336
  export declare const convertNOWandTODAYFormatsToUTC: (timeValue: string) => string;
337
+ /**
338
+ * @name setSeconds
339
+ * @category Second Helpers
340
+ * @summary Set the seconds to the given date.
341
+ *
342
+ * @description
343
+ * Set the seconds to the given date.
344
+ *
345
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
346
+ *
347
+ * @param date - The date to be changed
348
+ * @param seconds - The seconds of the new date
349
+ *
350
+ * @returns The new date with the seconds set
351
+ *
352
+ * @example
353
+ * // Set 45 seconds to 1 September 2014 11:30:40:
354
+ * const result = setSeconds(new Date(2014, 8, 1, 11, 30, 40), 45)
355
+ * //=> Mon Sep 01 2014 11:30:45
356
+ */
357
+ export declare const setSeconds: (date: Date, seconds: number) => Date;
337
358
  /**
338
359
  * Compares two dates if values are the same
339
360
  * @param {Date} date - first date