@opengeoweb/warnings 12.8.0 → 12.10.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.
Files changed (26) hide show
  1. package/README.md +6 -0
  2. package/index.esm.js +1451 -282
  3. package/package.json +14 -13
  4. package/src/lib/components/ComponentsLookUp/ComponentsLookUp.d.ts +9 -2
  5. package/src/lib/components/MaritimeWarningsForm/AreaList/AreaList.d.ts +9 -0
  6. package/src/lib/components/MaritimeWarningsForm/AreaList/AreaList.spec.d.ts +1 -0
  7. package/src/lib/components/MaritimeWarningsForm/AreaList/index.d.ts +1 -0
  8. package/src/lib/components/MaritimeWarningsForm/AssignedAreas/AssignedAreas.d.ts +11 -0
  9. package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.d.ts +19 -0
  10. package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.stories.d.ts +9 -0
  11. package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsFormConnect.d.ts +6 -0
  12. package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsFormConnect.spec.d.ts +1 -0
  13. package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsFormConnect.stories.d.ts +11 -0
  14. package/src/lib/components/MaritimeWarningsForm/MartitimeWarningsForm.spec.d.ts +2 -0
  15. package/src/lib/components/MaritimeWarningsForm/WarningList/WarningList.d.ts +15 -0
  16. package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListDragHandle.d.ts +2 -0
  17. package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListItem.d.ts +14 -0
  18. package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListSelect.d.ts +19 -0
  19. package/src/lib/components/MaritimeWarningsForm/WarningList/WindForceSelect.d.ts +22 -0
  20. package/src/lib/components/MaritimeWarningsForm/areas.d.ts +2 -0
  21. package/src/lib/components/MaritimeWarningsForm/index.d.ts +1 -0
  22. package/src/lib/components/MaritimeWarningsForm/options.d.ts +5 -0
  23. package/src/lib/components/MaritimeWarningsForm/types.d.ts +15 -0
  24. package/src/lib/components/MaritimeWarningsForm/useMaritimeWarningsFormState.d.ts +52 -0
  25. package/src/lib/components/MaritimeWarningsForm/useMaritimeWarningsFormState.spec.d.ts +1 -0
  26. package/src/lib/store/publicWarningForm/types.d.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/warnings",
3
- "version": "12.8.0",
3
+ "version": "12.10.0",
4
4
  "description": "GeoWeb warinings library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,31 +8,32 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/api": "12.8.0",
12
- "@opengeoweb/shared": "12.8.0",
13
- "@opengeoweb/store": "12.8.0",
14
- "@opengeoweb/webmap-react": "12.8.0",
11
+ "@opengeoweb/api": "12.10.0",
12
+ "@opengeoweb/shared": "12.10.0",
13
+ "@opengeoweb/store": "12.10.0",
14
+ "@opengeoweb/webmap-react": "12.10.0",
15
15
  "@tanstack/react-query": "^5.69.2",
16
16
  "react-redux": "^9.2.0",
17
- "@opengeoweb/theme": "12.8.0",
18
- "@opengeoweb/form-fields": "12.8.0",
17
+ "@opengeoweb/theme": "12.10.0",
18
+ "@opengeoweb/form-fields": "12.10.0",
19
19
  "react-hook-form": "^7.50.1",
20
20
  "lodash": "^4.17.21",
21
21
  "@reduxjs/toolkit": "^2.6.1",
22
- "@opengeoweb/snackbar": "12.8.0",
22
+ "@opengeoweb/snackbar": "12.10.0",
23
23
  "react-window": "^1.8.10",
24
24
  "react-virtualized-auto-sizer": "^1.0.20",
25
25
  "axios": "^1.7.7",
26
- "@opengeoweb/core": "12.8.0",
27
- "@opengeoweb/webmap": "12.8.0",
28
- "@opengeoweb/authentication": "12.8.0",
29
- "@opengeoweb/sigmet-airmet": "12.8.0",
26
+ "@opengeoweb/core": "12.10.0",
27
+ "@opengeoweb/webmap": "12.10.0",
28
+ "@opengeoweb/authentication": "12.10.0",
29
+ "@opengeoweb/sigmet-airmet": "12.10.0",
30
30
  "react-i18next": "^15.1.1",
31
31
  "i18next": "^25.0.1",
32
32
  "@mui/material": "^7.0.1",
33
33
  "ol": "^10.4.0",
34
34
  "msw": "^2.7.3",
35
- "@types/geojson": "^7946.0.14"
35
+ "@types/geojson": "^7946.0.14",
36
+ "react-sortablejs": "^6.1.4"
36
37
  },
37
38
  "peerDependencies": {
38
39
  "react": "18",
@@ -1,13 +1,20 @@
1
1
  import * as React from 'react';
2
2
  import { ApiModule, ApiUrls } from '@opengeoweb/api';
3
- export type WarningListComponentType = 'WarningList';
3
+ import { PickedFilterState } from '../FilterList/filter-hooks';
4
+ import { MaritimeWarningsDomain } from '../MaritimeWarningsForm/types';
5
+ export type WarningListComponentType = 'WarningList' | 'MaritimeWarnings';
6
+ interface WarningsInitialProps {
7
+ filterState?: PickedFilterState;
8
+ domain?: MaritimeWarningsDomain;
9
+ }
4
10
  export interface ComponentsLookUpPayload {
5
11
  componentType: WarningListComponentType;
6
12
  id: string;
7
13
  title?: string;
8
- initialProps: Record<string, never>;
14
+ initialProps: WarningsInitialProps;
9
15
  }
10
16
  export interface ApiModuleProps extends ApiModule {
11
17
  config: ApiUrls;
12
18
  }
13
19
  export declare const componentsLookUp: (payload: ComponentsLookUpPayload) => React.ReactElement;
20
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { Area } from '../types';
3
+ export interface AreaListProps {
4
+ areas: Area[];
5
+ selected: string[];
6
+ disabled: string[];
7
+ onClickItem?: (id: string) => void;
8
+ }
9
+ export declare const AreaList: React.MemoExoticComponent<({ areas, selected, disabled, onClickItem }: AreaListProps) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1 @@
1
+ export * from './AreaList';
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Area } from '../types';
3
+ export interface AssignedAreasProps {
4
+ assignedAreas: Area[];
5
+ selectedAreaIds: string[];
6
+ onAddClick: () => void;
7
+ onDeleteClick: (id: string) => void;
8
+ onToggleSelectArea: (id: string) => void;
9
+ shouldShowDistricts?: boolean;
10
+ }
11
+ export declare const AssignedAreas: React.FC<AssignedAreasProps>;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import type { MaritimeWarningItem, Area, MaritimeWarningItemAttributes } from './types';
3
+ export interface MaritimeWarningsFormProps {
4
+ areas: Area[];
5
+ selectedAreaIds: string[];
6
+ warnings: MaritimeWarningItem[];
7
+ modified: boolean;
8
+ onToggleSelectArea: (id: string) => void;
9
+ onAddSelectedAreas: (id: string) => void;
10
+ onRemoveWarning: (id: string) => void;
11
+ onRemoveArea: (id: string) => void;
12
+ onAddWarning: () => void;
13
+ onChangeWarning: (id: string, newValues: Partial<MaritimeWarningItemAttributes>) => void;
14
+ onMoveWarning: (oldIndex: number, newIndex: number) => void;
15
+ onSubmit: () => void;
16
+ onClear: () => void;
17
+ shouldShowDistricts?: boolean;
18
+ }
19
+ export declare const MaritimeWarningsForm: React.FC<MaritimeWarningsFormProps>;
@@ -0,0 +1,9 @@
1
+ import { StoryObj, Meta } from '@storybook/react';
2
+ import { MaritimeWarningsForm } from './MaritimeWarningsForm';
3
+ type Story = StoryObj<typeof MaritimeWarningsForm>;
4
+ declare const meta: Meta<typeof MaritimeWarningsForm>;
5
+ export default meta;
6
+ export declare const LightMode: Story;
7
+ export declare const DarkMode: Story;
8
+ export declare const MaritimeWarningsFormMobileLight: Story;
9
+ export declare const MaritimeWarningsFormMobileDark: Story;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { MaritimeWarningsDomain } from './types';
3
+ export interface MaritimeWarningsFormConnectProps {
4
+ domain: MaritimeWarningsDomain;
5
+ }
6
+ export declare const MaritimeWarningsFormConnect: React.FC<MaritimeWarningsFormConnectProps>;
@@ -0,0 +1,11 @@
1
+ import { StoryObj, Meta } from '@storybook/react';
2
+ import React from 'react';
3
+ import { MaritimeWarningsFormConnectProps } from './MaritimeWarningsFormConnect';
4
+ declare const MaritimeWarningsFormConnectDemo: React.FC<MaritimeWarningsFormConnectProps>;
5
+ type Story = StoryObj<typeof MaritimeWarningsFormConnectDemo>;
6
+ declare const meta: Meta<typeof MaritimeWarningsFormConnectDemo>;
7
+ export default meta;
8
+ export declare const LightMode: Story;
9
+ export declare const DarkMode: Story;
10
+ export declare const CoastalWatersLight: Story;
11
+ export declare const CoastalWatersDark: Story;
@@ -0,0 +1,2 @@
1
+ import { WarningListSelectOption } from './WarningList/WarningListSelect';
2
+ export declare function selectOption(container: HTMLElement, comboboxLabel: string, optionLabel: WarningListSelectOption['label']): Promise<void>;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { Area, MaritimeWarningItem, MaritimeWarningItemAttributes } from '../types';
3
+ export interface WarningListProps {
4
+ warnings: MaritimeWarningItem[];
5
+ onAddSelectedAreas: (id: string) => void;
6
+ onRemoveArea: (areaId: string) => void;
7
+ onRemoveWarning: (id: string) => void;
8
+ onChangeWarning: (id: string, newValues: Partial<MaritimeWarningItemAttributes>) => void;
9
+ onToggleSelectArea: (areaId: string) => void;
10
+ onMoveWarning: (oldIndex: number, newIndex: number) => void;
11
+ selectedAreaIds: string[];
12
+ areas: Area[];
13
+ shouldShowDistricts?: boolean;
14
+ }
15
+ export declare const WarningList: React.FC<WarningListProps>;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const WarningListDragHandle: React.FC;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { Area, MaritimeWarningItem, MaritimeWarningItemAttributes } from '../types';
3
+ export interface WarningListItemProps {
4
+ warning: MaritimeWarningItem;
5
+ areas: Area[];
6
+ selectedAreaIds: string[];
7
+ onAddClick: (id: string) => void;
8
+ onRemove: (id: string) => void;
9
+ onChange: (id: string, values: MaritimeWarningItemAttributes) => void;
10
+ onToggleSelectArea: (id: string) => void;
11
+ onRemoveArea: (id: string) => void;
12
+ shouldShowDistricts?: boolean;
13
+ }
14
+ export declare const WarningListItem: React.MemoExoticComponent<({ warning, areas, selectedAreaIds, onAddClick, onRemove, onChange, onToggleSelectArea, onRemoveArea, shouldShowDistricts, }: WarningListItemProps) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,19 @@
1
+ import { SxProps } from '@mui/material';
2
+ import { TFunction } from 'i18next';
3
+ import React from 'react';
4
+ export interface WarningListSelectOption {
5
+ value: string;
6
+ label: string | ((t: TFunction) => string);
7
+ }
8
+ export interface WarningListSelectProps {
9
+ options: WarningListSelectOption[];
10
+ label: string;
11
+ value?: string;
12
+ onChange: (value: string) => void;
13
+ renderOption?: (option: WarningListSelectOption, index: number) => React.ReactNode;
14
+ renderValue?: (option: unknown) => React.ReactNode;
15
+ gridArea: string;
16
+ additionalStyling?: SxProps;
17
+ isDisabled?: boolean;
18
+ }
19
+ export declare const WarningListSelect: React.MemoExoticComponent<({ options, value, label, onChange, renderOption, renderValue, gridArea, additionalStyling, isDisabled, }: WarningListSelectProps) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ export declare enum WindForceLevel {
3
+ moderate = "moderate",
4
+ severe = "severe",
5
+ extreme = "extreme"
6
+ }
7
+ export interface ColorDefinition {
8
+ color: string;
9
+ textColor: string;
10
+ borderColor: string;
11
+ }
12
+ export declare const windForceStyles: Record<WindForceLevel, ColorDefinition>;
13
+ export interface WindForceOption {
14
+ level: WindForceLevel;
15
+ value: string;
16
+ }
17
+ export declare const WindForceSelect: React.FC<{
18
+ value?: string;
19
+ onChange: (value: string) => void;
20
+ gridArea: string;
21
+ options: WindForceOption[];
22
+ }>;
@@ -0,0 +1,2 @@
1
+ import { Area, MaritimeWarningsDomain } from './types';
2
+ export declare const areasByDomain: Record<MaritimeWarningsDomain, Area[]>;
@@ -0,0 +1 @@
1
+ export * from './MaritimeWarningsForm';
@@ -0,0 +1,5 @@
1
+ import { WindForceOption } from './WarningList/WindForceSelect';
2
+ import { WarningListSelectOption } from './WarningList/WarningListSelect';
3
+ export declare const windDirections: WarningListSelectOption[];
4
+ export declare const change: WarningListSelectOption[];
5
+ export declare const windForce: WindForceOption[];
@@ -0,0 +1,15 @@
1
+ export interface Area {
2
+ label: string;
3
+ id: string;
4
+ }
5
+ export interface MaritimeWarningItemAttributes {
6
+ windDirectionFrom?: string;
7
+ windForce?: string;
8
+ changeType?: string;
9
+ windDirectionTo?: string;
10
+ }
11
+ export interface MaritimeWarningItem extends MaritimeWarningItemAttributes {
12
+ id: string;
13
+ assignedAreaIds: string[];
14
+ }
15
+ export type MaritimeWarningsDomain = 'northSeaDistricts' | 'coastalWaters';
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import { MaritimeWarningItem, MaritimeWarningItemAttributes } from './types';
3
+ export declare function createWarning(): MaritimeWarningItem;
4
+ interface State {
5
+ selectedAreaIds: string[];
6
+ warnings: MaritimeWarningItem[];
7
+ modified: boolean;
8
+ }
9
+ export declare const initialState: State;
10
+ interface Initialize {
11
+ type: 'initialize';
12
+ warnings: MaritimeWarningItem[];
13
+ }
14
+ interface ToggleSelectArea {
15
+ type: 'toggleSelectArea';
16
+ id: string;
17
+ }
18
+ interface NewWarning {
19
+ type: 'newWarning';
20
+ }
21
+ interface AddSelectedAreasToWarning {
22
+ type: 'addSelectedAreasToWarning';
23
+ id: string;
24
+ }
25
+ interface RemoveWarning {
26
+ type: 'removeWarning';
27
+ id: string;
28
+ }
29
+ interface ChangeWarning {
30
+ type: 'changeWarning';
31
+ id: string;
32
+ newValues: Partial<MaritimeWarningItemAttributes>;
33
+ }
34
+ interface RemoveArea {
35
+ type: 'removeArea';
36
+ areaId: string;
37
+ }
38
+ interface ClearWarnings {
39
+ type: 'clearWarnings';
40
+ }
41
+ interface MoveWarning {
42
+ type: 'moveWarning';
43
+ oldIndex: number;
44
+ newIndex: number;
45
+ }
46
+ type Action = ToggleSelectArea | NewWarning | Initialize | AddSelectedAreasToWarning | ChangeWarning | RemoveWarning | RemoveArea | ClearWarnings | MoveWarning;
47
+ export declare function reducer(state: State, action: Action): State;
48
+ export declare function useMaritimeWarningsFormState(): [
49
+ State,
50
+ React.Dispatch<Action>
51
+ ];
52
+ export {};
@@ -34,7 +34,7 @@ export declare enum PublicWarningStatus {
34
34
  IGNORED = "IGNORED",
35
35
  WITHDRAWN = "WITHDRAWN"
36
36
  }
37
- export type WarningType = 'public' | 'airmet' | 'sigmet';
37
+ export type WarningType = 'public' | 'airmet' | 'sigmet' | 'maritimeWarningCoastal' | 'maritimeWarningNorthSea';
38
38
  interface BaseWarning {
39
39
  status?: PublicWarningStatus;
40
40
  productStatus?: ProductStatus;