@opengeoweb/shared 6.0.0 → 6.0.2

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.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
@@ -1,5 +1,5 @@
1
1
  import * as React$1 from 'react';
2
- import React__default, { useRef, createContext, version, useContext } from 'react';
2
+ import React__default, { useRef, useContext } from 'react';
3
3
  import { Box, Typography, Tooltip, IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, useTheme, Drawer, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, Grid, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListSubheader, ListItemIcon, Select, Accordion, AccordionSummary, AccordionDetails } from '@mui/material';
4
4
  import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Resize, useThemeContext, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, ChevronDown } from '@opengeoweb/theme';
5
5
  import require$$2, { flushSync } from 'react-dom';
@@ -30,7 +30,12 @@ function __rest(s, e) {
30
30
  t[p[i]] = s[p[i]];
31
31
  }
32
32
  return t;
33
- }
33
+ }
34
+
35
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
36
+ var e = new Error(message);
37
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
38
+ };
34
39
 
35
40
  var bgColors = {
36
41
  green: 'geowebColors.functional.successOutline.fill',
@@ -22761,7 +22766,7 @@ var useHandleSizeFromOutsideComponent = function useHandleSizeFromOutsideCompone
22761
22766
  position: position,
22762
22767
  startSize: startSize
22763
22768
  }) : getLeftPositionAndSize({
22764
- currentX: currentX,
22769
+ currentX: currentX - boundsNode.getBoundingClientRect().x,
22765
22770
  newWidth: newWidth,
22766
22771
  maxWidth: maxWidth,
22767
22772
  position: position,
@@ -23476,11 +23481,14 @@ var CustomSlider = function CustomSlider(_a) {
23476
23481
  var element = React$1.useRef(null);
23477
23482
  var themeContext = useThemeContext();
23478
23483
  React$1.useEffect(function () {
23484
+ if (!element.current) {
23485
+ return;
23486
+ }
23479
23487
  var activeMarkLabelElements = element.current.getElementsByClassName('MuiSlider-markLabelActive');
23480
- var _reverse = _toConsumableArray(activeMarkLabelElements).reverse(),
23481
- _reverse2 = _toArray(_reverse),
23482
- first = _reverse2[0],
23483
- rest = _reverse2.slice(1);
23488
+ var _Array$from$reverse = Array.from(activeMarkLabelElements).reverse(),
23489
+ _Array$from$reverse2 = _toArray(_Array$from$reverse),
23490
+ first = _Array$from$reverse2[0],
23491
+ rest = _Array$from$reverse2.slice(1);
23484
23492
  if (first) {
23485
23493
  first.classList.add('selectedLabel');
23486
23494
  }
@@ -24307,40 +24315,39 @@ if (
24307
24315
 
24308
24316
  if (process.env.NODE_ENV === 'production') ;
24309
24317
 
24310
- const ContextKey = Symbol.for(`react-redux-context-${version}`);
24311
- const gT = globalThis;
24318
+ const ContextKey = Symbol.for(`react-redux-context`);
24319
+ const gT = typeof globalThis !== "undefined" ? globalThis :
24320
+ /* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
24321
+ {};
24312
24322
 
24313
24323
  function getContext() {
24314
- let realContext = gT[ContextKey];
24324
+ var _gT$ContextKey;
24325
+
24326
+ if (!React$1.createContext) return {};
24327
+ const contextMap = (_gT$ContextKey = gT[ContextKey]) != null ? _gT$ContextKey : gT[ContextKey] = new Map();
24328
+ let realContext = contextMap.get(React$1.createContext);
24315
24329
 
24316
24330
  if (!realContext) {
24317
- realContext = createContext(null);
24331
+ realContext = React$1.createContext(null);
24318
24332
 
24319
24333
  if (process.env.NODE_ENV !== 'production') {
24320
24334
  realContext.displayName = 'ReactRedux';
24321
24335
  }
24322
24336
 
24323
- gT[ContextKey] = realContext;
24337
+ contextMap.set(React$1.createContext, realContext);
24324
24338
  }
24325
24339
 
24326
24340
  return realContext;
24327
24341
  }
24328
24342
 
24329
- const ReactReduxContext = /*#__PURE__*/new Proxy({}, /*#__PURE__*/new Proxy({}, {
24330
- get(_, handler) {
24331
- const target = getContext(); // @ts-ignore
24332
-
24333
- return (_target, ...args) => Reflect[handler](target, ...args);
24334
- }
24335
-
24336
- }));
24343
+ const ReactReduxContext = /*#__PURE__*/getContext();
24337
24344
 
24338
- /**
24339
- * Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level
24340
- * hook that you should usually not need to call directly.
24341
- *
24342
- * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
24343
- * @returns {Function} A `useReduxContext` hook bound to the specified context.
24345
+ /**
24346
+ * Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level
24347
+ * hook that you should usually not need to call directly.
24348
+ *
24349
+ * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
24350
+ * @returns {Function} A `useReduxContext` hook bound to the specified context.
24344
24351
  */
24345
24352
  function createReduxContextHook(context = ReactReduxContext) {
24346
24353
  return function useReduxContext() {
@@ -24353,21 +24360,21 @@ function createReduxContextHook(context = ReactReduxContext) {
24353
24360
  return contextValue;
24354
24361
  };
24355
24362
  }
24356
- /**
24357
- * A hook to access the value of the `ReactReduxContext`. This is a low-level
24358
- * hook that you should usually not need to call directly.
24359
- *
24360
- * @returns {any} the value of the `ReactReduxContext`
24361
- *
24362
- * @example
24363
- *
24364
- * import React from 'react'
24365
- * import { useReduxContext } from 'react-redux'
24366
- *
24367
- * export const CounterComponent = () => {
24368
- * const { store } = useReduxContext()
24369
- * return <div>{store.getState()}</div>
24370
- * }
24363
+ /**
24364
+ * A hook to access the value of the `ReactReduxContext`. This is a low-level
24365
+ * hook that you should usually not need to call directly.
24366
+ *
24367
+ * @returns {any} the value of the `ReactReduxContext`
24368
+ *
24369
+ * @example
24370
+ *
24371
+ * import React from 'react'
24372
+ * import { useReduxContext } from 'react-redux'
24373
+ *
24374
+ * export const CounterComponent = () => {
24375
+ * const { store } = useReduxContext()
24376
+ * return <div>{store.getState()}</div>
24377
+ * }
24371
24378
  */
24372
24379
 
24373
24380
  const useReduxContext = /*#__PURE__*/createReduxContextHook();
@@ -24838,11 +24845,11 @@ reactIs_development.typeOf = typeOf;
24838
24845
 
24839
24846
  if (process.env.NODE_ENV === 'production') ;
24840
24847
 
24841
- /**
24842
- * Hook factory, which creates a `useStore` hook bound to a given context.
24843
- *
24844
- * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
24845
- * @returns {Function} A `useStore` hook bound to the specified context.
24848
+ /**
24849
+ * Hook factory, which creates a `useStore` hook bound to a given context.
24850
+ *
24851
+ * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
24852
+ * @returns {Function} A `useStore` hook bound to the specified context.
24846
24853
  */
24847
24854
 
24848
24855
  function createStoreHook(context = ReactReduxContext) {
@@ -24857,20 +24864,20 @@ function createStoreHook(context = ReactReduxContext) {
24857
24864
  return store;
24858
24865
  };
24859
24866
  }
24860
- /**
24861
- * A hook to access the redux store.
24862
- *
24863
- * @returns {any} the redux store
24864
- *
24865
- * @example
24866
- *
24867
- * import React from 'react'
24868
- * import { useStore } from 'react-redux'
24869
- *
24870
- * export const ExampleComponent = () => {
24871
- * const store = useStore()
24872
- * return <div>{store.getState()}</div>
24873
- * }
24867
+ /**
24868
+ * A hook to access the redux store.
24869
+ *
24870
+ * @returns {any} the redux store
24871
+ *
24872
+ * @example
24873
+ *
24874
+ * import React from 'react'
24875
+ * import { useStore } from 'react-redux'
24876
+ *
24877
+ * export const ExampleComponent = () => {
24878
+ * const store = useStore()
24879
+ * return <div>{store.getState()}</div>
24880
+ * }
24874
24881
  */
24875
24882
 
24876
24883
  const useStore = /*#__PURE__*/createStoreHook();
package/package.json CHANGED
@@ -1,27 +1,26 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
- "module": "./index.js",
11
- "main": "./index.js",
10
+ "module": "./index.esm.js",
12
11
  "type": "module",
13
- "types": "./src/index.d.ts",
12
+ "main": "./index.esm.js",
14
13
  "dependencies": {},
15
14
  "peerDependencies": {
16
15
  "@mui/material": "5.12.0",
17
- "@opengeoweb/theme": "6.0.0",
16
+ "@opengeoweb/theme": "6.0.2",
18
17
  "@redux-eggs/core": "2.2.0",
19
18
  "axios": "1.4.0",
20
- "date-fns": "2.29.3",
19
+ "date-fns": "2.30.0",
21
20
  "lodash": "4.17.21",
22
- "re-resizable": "6.9.9",
21
+ "re-resizable": "6.9.11",
23
22
  "react": "18.2.0",
24
23
  "react-draggable": "4.4.5",
25
- "react-redux": "8.1.1"
24
+ "react-redux": "8.1.2"
26
25
  }
27
26
  }
@@ -9,7 +9,7 @@ export interface ConfirmationOptions {
9
9
  cancelLabel?: string;
10
10
  content?: React.ReactNode;
11
11
  }
12
- export declare type ConfirmationAction = 'CANCELLED' | DialogAction;
12
+ export type ConfirmationAction = 'CANCELLED' | DialogAction;
13
13
  export interface ConfirmationDialogProps extends ConfirmationOptions {
14
14
  disableAutoFocus?: boolean;
15
15
  onSubmit: () => void;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ConfirmationAction, ConfirmationOptions } from './ConfirmationDialog';
3
- declare type ConfirmationContext = (options: ConfirmationOptions) => Promise<void>;
3
+ type ConfirmationContext = (options: ConfirmationOptions) => Promise<void>;
4
4
  export declare const useConfirmationDialog: () => ConfirmationContext;
5
5
  export declare const useDialogActions: (awaitingPromiseRef: React.MutableRefObject<{
6
6
  resolve: () => void;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { DialogProps } from '@mui/material';
3
- export declare type DialogAction = 'CLOSED';
3
+ export type DialogAction = 'CLOSED';
4
4
  export interface CustomDialogProps extends DialogProps {
5
5
  description?: string;
6
6
  actions?: React.ReactNode;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { IconButtonProps, TooltipProps as MuiTooltipProps } from '@mui/material';
3
- export declare type Variant = 'flat' | 'tool' | 'boxed';
4
- declare type TooltipProps = Omit<MuiTooltipProps, 'children'>;
3
+ export type Variant = 'flat' | 'tool' | 'boxed';
4
+ type TooltipProps = Omit<MuiTooltipProps, 'children'>;
5
5
  export interface CustomIconProps extends IconButtonProps {
6
6
  tooltipTitle?: string;
7
7
  variant?: Variant;
@@ -1,15 +1,15 @@
1
1
  /// <reference types="react" />
2
2
  import { ResizableProps } from 're-resizable';
3
- export declare type DraggablePosition = {
3
+ export type DraggablePosition = {
4
4
  x: number;
5
5
  y: number;
6
6
  };
7
- export declare type Position = {
7
+ export type Position = {
8
8
  top: number;
9
9
  left?: number;
10
10
  right?: number;
11
11
  };
12
- export declare type Size = {
12
+ export type Size = {
13
13
  width?: number | string;
14
14
  height?: number | string;
15
15
  };
@@ -1,4 +1,8 @@
1
1
  import * as React from 'react';
2
+ declare const _default: {
3
+ title: string;
4
+ };
5
+ export default _default;
2
6
  export declare const ErrorBoundaryDemo: {
3
7
  (): React.ReactElement;
4
8
  storyName: string;
@@ -1,12 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import { PopoverOrigin, SxProps, Theme } from '@mui/material';
3
3
  import { Variant } from '../CustomIconButton';
4
- declare type MenuPosition = 'left' | 'right' | 'bottom';
4
+ type MenuPosition = 'left' | 'right' | 'bottom';
5
5
  export declare const getPosition: (menuPosition: MenuPosition) => {
6
6
  anchorOrigin: PopoverOrigin;
7
7
  transformOrigin: PopoverOrigin;
8
8
  };
9
- declare type MenuItemType = {
9
+ type MenuItemType = {
10
10
  text: string;
11
11
  action: (event: React.MouseEvent) => void;
12
12
  icon?: React.ReactNode;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { PaperProps } from '@mui/material';
3
- export declare type HeaderSize = 'xxs' | 'xs' | 'small' | 'medium' | 'large';
3
+ export type HeaderSize = 'xxs' | 'xs' | 'small' | 'medium' | 'large';
4
4
  export interface ToolHeaderProps {
5
5
  title?: string;
6
6
  size?: HeaderSize;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { SelectProps } from '@mui/material';
3
- declare type ListELement = {
3
+ type ListELement = {
4
4
  value: string;
5
5
  };
6
6
  interface TooltipSelectProps extends SelectProps {
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- declare type ShortCut = {
2
+ type ShortCut = {
3
3
  title: string;
4
4
  description: React.ReactNode;
5
5
  descriptionMac?: React.ReactNode;
6
6
  };
7
- declare type Platform = 'windows' | 'mac';
7
+ type Platform = 'windows' | 'mac';
8
8
  export declare const shortcuts: ShortCut[];
9
9
  export declare const getShortcutList: (shortcutList: ShortCut[], platform?: Platform) => ShortCut[];
10
10
  interface ShortcutListProps {
@@ -130,7 +130,7 @@ export declare const isBetween: (date: Date, from: Date, to: Date, inclusivity?:
130
130
  * createDate('2022-12-13T00:00:00.000Z');
131
131
  * // => 2022-12-13T00:00:00.000Z
132
132
  */
133
- export declare const createDate: (yearOrIsoString?: string | number | undefined, month?: number | undefined, day?: number | undefined, hours?: number, minutes?: number, seconds?: number, milliseconds?: number) => Date;
133
+ export declare const createDate: (yearOrIsoString?: number | string, month?: number, day?: number, hours?: number, minutes?: number, seconds?: number, milliseconds?: number) => Date;
134
134
  /**
135
135
  *
136
136
  * @param date
@@ -182,7 +182,7 @@ export declare const isAfter: (date: Date | number, dateToCompare: Date | number
182
182
  * @param dateStr - string containing date
183
183
  * @returns {Date} - Date in UTC
184
184
  */
185
- export declare const utc: (dateStr?: string | undefined) => Date;
185
+ export declare const utc: (dateStr?: string) => Date;
186
186
  /**
187
187
  * Check if a date object is valid
188
188
  * @param {Date} date - date to be checked