@opengeoweb/warnings 9.29.0 → 9.29.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/index.esm.js CHANGED
@@ -13,12 +13,12 @@ import { generateMapId, LayerType, getWMJSMapById, getGeoCoordFromLatLong, WMBBO
13
13
  import { snackbarActions, snackbarTypes } from '@opengeoweb/snackbar';
14
14
  import * as React from 'react';
15
15
  import React__default, { useState, useEffect, useRef } from 'react';
16
- import { styled, Box, Typography, ListItem, Grid2, Paper, ListItemButton, Stack, LinearProgress, Button, MenuItem, FormHelperText, Tabs, Tab, Card, CardContent, CircularProgress, Menu, DialogTitle, DialogContent, Switch } from '@mui/material';
16
+ import { styled, Box, Typography, ListItem, Grid2, Paper, ListItemButton, Stack, LinearProgress, Button, MenuItem, FormHelperText, Tabs, Tab, Card, CardContent, CircularProgress, Menu, DialogTitle, DialogContent, Switch, ListItemIcon, Checkbox, ListItemText } from '@mui/material';
17
17
  import { VariableSizeList } from 'react-window';
18
18
  import AutoSizer from 'react-virtualized-auto-sizer';
19
19
  import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider, ProductStatus, useAirmetList, useSigmetList } from '@opengeoweb/api';
20
20
  import { useFormContext } from 'react-hook-form';
21
- import { isEqual, cloneDeep, clamp } from 'lodash';
21
+ import { isEqual, cloneDeep, clamp, debounce } from 'lodash';
22
22
  import { useAuthenticationContext } from '@opengeoweb/authentication';
23
23
  import { produce } from 'immer';
24
24
  import { isAxiosError } from 'axios';
@@ -149,8 +149,10 @@ var en = {
149
149
  "filter-source": "Sources",
150
150
  "filter-hide": "Hide {{subject}}",
151
151
  "filter-show": "Show {{subject}}",
152
- airmet: "Airmet",
153
- sigmet: "Sigmet",
152
+ "filter-only": "ONLY",
153
+ "warning-domain-aviation": "Aviation",
154
+ "warning-domain-maritime": "Maritime",
155
+ "warning-domain-public": "Public",
154
156
  "error-title-retry": "Try again",
155
157
  "aviation-phenomenon-radioactive-cloud": "Radioactive cloud",
156
158
  "aviation-phenomenon-heavy-sandstorm": "Heavy sandstorm",
@@ -318,7 +320,6 @@ var nl = {
318
320
  "filter-phenomenon": "Fenomenen",
319
321
  "filter-level": "Niveaus",
320
322
  "filter-source": "Bronnen",
321
- "error-title-retry": "Probeer opnieuw",
322
323
  "warning-dialog-expire-succes": "Waarschuwing laten verlopen is succesvol",
323
324
  "warning-dialog-expire-title": "Waarschuwing laten verlopen",
324
325
  "warning-dialog-expire-confirm": "Verlopen",
@@ -326,7 +327,12 @@ var nl = {
326
327
  "warning-dialog-withdraw-succes": "Waarschuwing is succesvol ingetrokken",
327
328
  "warning-dialog-withdraw-title": "Waarschuwing intrekken",
328
329
  "warning-dialog-withdraw-confirm": "Intrekken",
329
- "warning-dialog-withdraw-description": "Weet je zeker dat je deze waarschuwing wilt intrekken?"
330
+ "warning-dialog-withdraw-description": "Weet je zeker dat je deze waarschuwing wilt intrekken?",
331
+ "filter-only": "ALLEEN",
332
+ "warning-domain-aviation": "Luchtvaart",
333
+ "warning-domain-maritime": "Maritiem",
334
+ "warning-domain-public": "Publiek",
335
+ "error-title-retry": "Probeer opnieuw"
330
336
  };
331
337
  var fi = {
332
338
  "drawing-tool-form-tools": "Työkalut",
@@ -452,7 +458,6 @@ var fi = {
452
458
  "filter-phenomenon": "ei käännetty",
453
459
  "filter-level": "ei käännetty",
454
460
  "filter-source": "ei käännetty",
455
- "error-title-retry": "Yritä uudelleen",
456
461
  "warning-dialog-expire-succes": "ei käännetty",
457
462
  "warning-dialog-expire-title": "ei käännetty",
458
463
  "warning-dialog-expire-confirm": "ei käännetty",
@@ -460,7 +465,12 @@ var fi = {
460
465
  "warning-dialog-withdraw-succes": "ei käännetty",
461
466
  "warning-dialog-withdraw-title": "ei käännetty",
462
467
  "warning-dialog-withdraw-confirm": "ei käännetty",
463
- "warning-dialog-withdraw-description": "ei käännetty"
468
+ "warning-dialog-withdraw-description": "ei käännetty",
469
+ "filter-only": "Pelkästään",
470
+ "warning-domain-aviation": "ei käännetty",
471
+ "warning-domain-maritime": "ei käännetty",
472
+ "warning-domain-public": "ei käännetty",
473
+ "error-title-retry": "Yritä uudelleen"
464
474
  };
465
475
  var no = {
466
476
  "drawing-tool-form-tools": "Verktøy",
@@ -586,7 +596,6 @@ var no = {
586
596
  "filter-phenomenon": "Fenomen",
587
597
  "filter-level": "Grad",
588
598
  "filter-source": "Kilder",
589
- "error-title-retry": "Prøv igjen",
590
599
  "warning-dialog-expire-succes": "ikke oversatt",
591
600
  "warning-dialog-expire-title": "ikke oversatt",
592
601
  "warning-dialog-expire-confirm": "ikke oversatt",
@@ -594,7 +603,12 @@ var no = {
594
603
  "warning-dialog-withdraw-succes": "ikke oversatt",
595
604
  "warning-dialog-withdraw-title": "ikke oversatt",
596
605
  "warning-dialog-withdraw-confirm": "ikke oversatt",
597
- "warning-dialog-withdraw-description": "ikke oversatt"
606
+ "warning-dialog-withdraw-description": "ikke oversatt",
607
+ "filter-only": "BARE",
608
+ "warning-domain-aviation": "ikke oversatt",
609
+ "warning-domain-maritime": "ikke oversatt",
610
+ "warning-domain-public": "ikke oversatt",
611
+ "error-title-retry": "Prøv igjen"
598
612
  };
599
613
  var warningsTranslations = {
600
614
  en: en,
@@ -4164,9 +4178,6 @@ const getFilterlistWithTranslationKeys = filterList => filterList.reduce((fiterL
4164
4178
  const defaultFilters = [{
4165
4179
  key: 'incident',
4166
4180
  translationKey: 'filter-incident'
4167
- }, {
4168
- key: 'domain',
4169
- translationKey: 'filter-domain'
4170
4181
  }, {
4171
4182
  key: 'phenomenon',
4172
4183
  translationKey: 'filter-phenomenon',
@@ -13909,7 +13920,6 @@ const FilterChipWithOptions = ({
13909
13920
  children: jsx(FilterChip, {
13910
13921
  id: id,
13911
13922
  label: label,
13912
- onAction: onClickOptions,
13913
13923
  actionIcon: actionButton(selectedFiltersAmount),
13914
13924
  isSelected: isAnyFilterSelected,
13915
13925
  handleClick: onClickOptions,
@@ -14071,14 +14081,218 @@ const FilterChipWithOptionsConnect = ({
14071
14081
  }));
14072
14082
  };
14073
14083
 
14084
+ const FilterOption = ({
14085
+ filterId,
14086
+ optionId,
14087
+ checked,
14088
+ onClick,
14089
+ label
14090
+ }) => {
14091
+ const {
14092
+ t
14093
+ } = useWarningsTranslation();
14094
+ const [showOnly, setShowOnly] = useState(false);
14095
+ const updateShowOnly = debounce(show => setShowOnly(show), 100);
14096
+ return jsx(ListItem, Object.assign({
14097
+ disablePadding: true,
14098
+ dense: true,
14099
+ sx: {
14100
+ width: '100%',
14101
+ minWidth: '300px',
14102
+ paddingRight: '0px',
14103
+ marginLeft: '-12px',
14104
+ fontSize: '12px'
14105
+ },
14106
+ secondaryAction: showOnly && jsx(CustomIconButton, Object.assign({
14107
+ "aria-label": `Only ${optionId}`,
14108
+ style: {
14109
+ backgroundColor: 'transparent',
14110
+ width: 'auto'
14111
+ },
14112
+ edge: "end",
14113
+ onClick: () => onClick(!checked, true),
14114
+ onMouseOver: () => updateShowOnly(true),
14115
+ onMouseOut: () => updateShowOnly(false)
14116
+ }, {
14117
+ children: jsx(Typography, Object.assign({
14118
+ sx: {
14119
+ color: 'geowebColors.buttons.primary.default.fill',
14120
+ fontSize: '14px',
14121
+ fontWeight: 500
14122
+ }
14123
+ }, {
14124
+ children: t('filter-only')
14125
+ }))
14126
+ }))
14127
+ }, {
14128
+ children: jsxs(ListItemButton, Object.assign({
14129
+ role: undefined,
14130
+ onClick: () => onClick(!checked),
14131
+ onMouseOver: () => updateShowOnly(true),
14132
+ onMouseOut: () => updateShowOnly(false),
14133
+ dense: true,
14134
+ disableGutters: true,
14135
+ sx: {
14136
+ padding: 0
14137
+ }
14138
+ }, {
14139
+ children: [jsx(ListItemIcon, {
14140
+ children: jsx(Checkbox, {
14141
+ checked: checked,
14142
+ tabIndex: -1,
14143
+ disableRipple: true,
14144
+ inputProps: {
14145
+ 'aria-labelledby': optionId,
14146
+ 'aria-label': optionId
14147
+ }
14148
+ })
14149
+ }), jsx(ListItemText, {
14150
+ id: optionId,
14151
+ sx: {
14152
+ padding: 0,
14153
+ margin: 0
14154
+ },
14155
+ primary: label || t(`warning-${filterId}-${optionId}`)
14156
+ })]
14157
+ }))
14158
+ }), optionId);
14159
+ };
14160
+
14161
+ const ExpandableFilterChip = ({
14162
+ id,
14163
+ options,
14164
+ updateFilter
14165
+ }) => {
14166
+ const {
14167
+ t
14168
+ } = useWarningsTranslation();
14169
+ const [anchorEl, setAnchorEl] = useState(null);
14170
+ const selectedOptions = Object.keys(options).filter(k => options[k]);
14171
+ const allSelected = selectedOptions.length === Object.keys(options).length;
14172
+ return jsxs(Fragment, {
14173
+ children: [jsx(CustomTooltip, Object.assign({
14174
+ title: t('filter-options'),
14175
+ placement: "bottom"
14176
+ }, {
14177
+ children: jsx("span", Object.assign({
14178
+ style: {
14179
+ margin: 0
14180
+ }
14181
+ }, {
14182
+ children: jsx(FilterChip, {
14183
+ id: id,
14184
+ label: t(`filter-${id}`),
14185
+ isSelected: selectedOptions.length > 0,
14186
+ onClick: ref => setAnchorEl(ref),
14187
+ isDisabled: false,
14188
+ size: "medium",
14189
+ actionIcon: jsxs(Grid2, Object.assign({
14190
+ container: true,
14191
+ alignItems: "center",
14192
+ style: {
14193
+ marginRight: '8px',
14194
+ minWidth: '36px'
14195
+ }
14196
+ }, {
14197
+ children: [jsx(Options, {}), jsx(Typography, Object.assign({
14198
+ variant: "body2",
14199
+ sx: {
14200
+ paddingLeft: 0.5
14201
+ }
14202
+ }, {
14203
+ children: selectedOptions.length > 0 && selectedOptions.length
14204
+ }))]
14205
+ }))
14206
+ })
14207
+ }))
14208
+ })), jsxs(Menu, Object.assign({
14209
+ title: t(`filter-${id}`),
14210
+ open: Boolean(anchorEl),
14211
+ onClose: () => setAnchorEl(null),
14212
+ anchorEl: anchorEl,
14213
+ BackdropProps: {
14214
+ style: {
14215
+ opacity: 0,
14216
+ transition: 'none'
14217
+ }
14218
+ },
14219
+ sx: {
14220
+ padding: 3
14221
+ }
14222
+ }, {
14223
+ children: [jsxs(DialogTitle, Object.assign({
14224
+ id: "dialog-title",
14225
+ sx: {
14226
+ zIndex: 1,
14227
+ padding: '8px 18px 16px 24px',
14228
+ display: 'flex',
14229
+ justifyContent: 'space-between',
14230
+ alignItems: 'center'
14231
+ }
14232
+ }, {
14233
+ children: [jsx(Typography, Object.assign({
14234
+ sx: {
14235
+ fontSize: '20px',
14236
+ fontWeight: 500,
14237
+ paddingRight: 1
14238
+ },
14239
+ "data-testid": "customDialog-title",
14240
+ component: "span"
14241
+ }, {
14242
+ children: t(`filter-${id}`)
14243
+ })), jsx(CustomIconButton, Object.assign({
14244
+ "aria-label": t('close-dialog-confirm'),
14245
+ onClick: () => setAnchorEl(null),
14246
+ sx: {
14247
+ '&.MuiIconButton-root': {
14248
+ color: 'geowebColors.greys.accessible'
14249
+ }
14250
+ }
14251
+ }, {
14252
+ children: jsx(Close, {})
14253
+ }))]
14254
+ })), jsxs(DialogContent, Object.assign({
14255
+ sx: {
14256
+ padding: '0px 24px 16px 24px'
14257
+ }
14258
+ }, {
14259
+ children: [jsxs(Grid2, Object.assign({
14260
+ container: true,
14261
+ justifyContent: "space-between",
14262
+ alignItems: "center"
14263
+ }, {
14264
+ children: [t('filter-select-all'), jsx(Switch, {
14265
+ inputProps: {
14266
+ 'aria-label': t('filter-select-all')
14267
+ },
14268
+ checked: allSelected,
14269
+ onChange: () => updateFilter(id, 'ALL', !allSelected),
14270
+ sx: {
14271
+ marginRight: '-12px',
14272
+ marginTop: '-6px'
14273
+ }
14274
+ })]
14275
+ })), jsx(Box, {
14276
+ children: Object.keys(options).map(optionId => {
14277
+ return jsx(FilterOption, {
14278
+ filterId: id,
14279
+ optionId: optionId,
14280
+ checked: options[optionId],
14281
+ onClick: (checked, only) => updateFilter(id, optionId, checked, only)
14282
+ }, `${id}-${optionId}`);
14283
+ })
14284
+ })]
14285
+ }))]
14286
+ }))]
14287
+ });
14288
+ };
14289
+
14074
14290
  const FilterList = ({
14075
14291
  filters: _filters = [],
14076
14292
  onClickAll: _onClickAll = () => {},
14077
14293
  isAllSelected: _isAllSelected = true,
14078
- showSigmet: _showSigmet = false,
14079
- showAirmet: _showAirmet = false,
14080
- setShowSigmet,
14081
- setShowAirmet
14294
+ filterState,
14295
+ updateFilter
14082
14296
  }) => {
14083
14297
  const {
14084
14298
  t
@@ -14116,49 +14330,11 @@ const FilterList = ({
14116
14330
  return jsx(FilterChipWithOptionsConnect, {
14117
14331
  filter: filter
14118
14332
  }, filter.id);
14119
- }), setShowSigmet && jsx(CustomTooltip, Object.assign({
14120
- title: _showSigmet ? t('filter-hide', {
14121
- subject: t('sigmet')
14122
- }) : t('filter-show', {
14123
- subject: t('sigmet')
14124
- }),
14125
- placement: "bottom"
14126
- }, {
14127
- children: jsx("span", Object.assign({
14128
- style: {
14129
- margin: 0
14130
- }
14131
- }, {
14132
- children: jsx(FilterChip, {
14133
- id: "sigmet",
14134
- label: t('sigmet'),
14135
- isSelected: _showSigmet,
14136
- handleClick: () => setShowSigmet(!_showSigmet),
14137
- size: "medium"
14138
- })
14139
- }))
14140
- })), setShowAirmet && jsx(CustomTooltip, Object.assign({
14141
- title: _showAirmet ? t('filter-hide', {
14142
- subject: t('airmet')
14143
- }) : t('filter-show', {
14144
- subject: t('airmet')
14145
- }),
14146
- placement: "bottom"
14147
- }, {
14148
- children: jsx("span", Object.assign({
14149
- style: {
14150
- margin: 0
14151
- }
14152
- }, {
14153
- children: jsx(FilterChip, {
14154
- id: "airmet",
14155
- label: t('airmet'),
14156
- isSelected: _showAirmet,
14157
- handleClick: () => setShowAirmet(!_showAirmet),
14158
- size: "medium"
14159
- })
14160
- }))
14161
- }))]
14333
+ }), filterState && Object.keys(filterState).map(filterId => jsx(ExpandableFilterChip, {
14334
+ id: filterId,
14335
+ options: filterState[filterId],
14336
+ updateFilter: updateFilter
14337
+ }, filterId))]
14162
14338
  }));
14163
14339
  };
14164
14340
 
@@ -14774,6 +14950,57 @@ const WarningListItem = _a => {
14774
14950
  }), warning.id);
14775
14951
  };
14776
14952
 
14953
+ var Domain;
14954
+ (function (Domain) {
14955
+ Domain["aviation"] = "aviation";
14956
+ Domain["maritime"] = "maritime";
14957
+ Domain["public"] = "public";
14958
+ })(Domain || (Domain = {}));
14959
+ const defaultDomainFilter = {
14960
+ aviation: false,
14961
+ maritime: false,
14962
+ public: true
14963
+ };
14964
+ const useWarningFilters = () => {
14965
+ const [domainFilter, setDomainFilter] = useState(defaultDomainFilter);
14966
+ const updateState = (state, optionKey, value, only) => {
14967
+ if (only) {
14968
+ return Object.keys(state).reduce((acc, k) => Object.assign(Object.assign({}, acc), {
14969
+ [k]: k === optionKey
14970
+ }), {});
14971
+ }
14972
+ return optionKey === 'ALL' ? Object.keys(state).reduce((acc, k) => Object.assign(Object.assign({}, acc), {
14973
+ [k]: value
14974
+ }), {}) : Object.assign(Object.assign({}, state), {
14975
+ [optionKey]: value
14976
+ });
14977
+ };
14978
+ const updateFilter = (filterKey, optionKey, value, only) => {
14979
+ if (filterKey === 'ALL') {
14980
+ return;
14981
+ }
14982
+ if (filterKey === 'domain') {
14983
+ setDomainFilter(state => {
14984
+ return updateState(state, optionKey, value, only);
14985
+ });
14986
+ }
14987
+ };
14988
+ const byFilterState = warning => {
14989
+ const levelDomain = ['SIG', 'AIR'].find(d => d === warning.warningDetail.level) ? Domain.aviation : Domain.public;
14990
+ if (!domainFilter[levelDomain]) {
14991
+ return false;
14992
+ }
14993
+ return true;
14994
+ };
14995
+ return {
14996
+ filterState: {
14997
+ domain: domainFilter
14998
+ },
14999
+ updateFilter,
15000
+ byFilterState
15001
+ };
15002
+ };
15003
+
14777
15004
  const sortWarningsOnStatus = warnings => {
14778
15005
  return warnings.reduce((allWarnings, warning) => {
14779
15006
  const status = warning.status || mapProductStatusToWarningStatus(warning.productStatus);
@@ -14838,10 +15065,6 @@ const PublicWarningList = ({
14838
15065
  error,
14839
15066
  selectedPublicWarningId: _selectedPublicWarningId = '',
14840
15067
  lastUpdatedTime,
14841
- showSigmet,
14842
- showAirmet,
14843
- setShowSigmet,
14844
- setShowAirmet,
14845
15068
  onSelectWarning: _onSelectWarning = () => {},
14846
15069
  onEditWarning: _onEditWarning = () => {},
14847
15070
  onCreateWarning: _onCreateWarning = () => {},
@@ -14856,7 +15079,12 @@ const PublicWarningList = ({
14856
15079
  const {
14857
15080
  t
14858
15081
  } = useWarningsTranslation();
14859
- const sortedWarnings = sortWarningsOnStatus(_warnings);
15082
+ const {
15083
+ filterState,
15084
+ updateFilter,
15085
+ byFilterState
15086
+ } = useWarningFilters();
15087
+ const sortedWarnings = sortWarningsOnStatus(_warnings.filter(byFilterState));
14860
15088
  const items = [{
14861
15089
  status: PublicWarningStatus.TODO,
14862
15090
  totalWarnings: sortedWarnings.todo.length
@@ -14947,10 +15175,8 @@ const PublicWarningList = ({
14947
15175
  filters: filters,
14948
15176
  isAllSelected: _isAllChipSelected,
14949
15177
  onClickAll: _onClickAllChip,
14950
- showSigmet: showSigmet,
14951
- showAirmet: showAirmet,
14952
- setShowSigmet: setShowSigmet,
14953
- setShowAirmet: setShowAirmet
15178
+ filterState: filterState,
15179
+ updateFilter: updateFilter
14954
15180
  })
14955
15181
  })), jsxs(Grid2, Object.assign({
14956
15182
  className: "create-warning",
@@ -15297,8 +15523,6 @@ const PublicWarningListConnect = () => {
15297
15523
  refetch: refetchSigmetList,
15298
15524
  isFetching: isFetchingSigmet
15299
15525
  } = useSigmetList();
15300
- const [showAirmet, setShowAirmet] = React__default.useState(false);
15301
- const [showSigmet, setShowSigmet] = React__default.useState(false);
15302
15526
  const [confirmDialogOptions, setConfirmDialogOptions] = React__default.useState(undefined);
15303
15527
  const filters = useSelector(selectAllFilters);
15304
15528
  const isAllChipSelected = useSelector(getIsAllSelected);
@@ -15431,7 +15655,7 @@ const PublicWarningListConnect = () => {
15431
15655
  }, [dispatch, warnings]);
15432
15656
  const transformedSigmets = (sigmetList === null || sigmetList === void 0 ? void 0 : sigmetList.map(transformSigmetToWarningFormat)) || [];
15433
15657
  const transformedAirmets = (airmetList === null || airmetList === void 0 ? void 0 : airmetList.map(transformAirmetToWarningFormat)) || [];
15434
- const combinedWarnings = filteredWarnings.concat(showSigmet ? transformedSigmets : []).concat(showAirmet ? transformedAirmets : []).sort((w1, w2) => {
15658
+ const combinedWarnings = filteredWarnings.concat(transformedSigmets).concat(transformedAirmets).sort((w1, w2) => {
15435
15659
  var _a;
15436
15660
  return ((_a = w2.lastUpdatedTime) === null || _a === void 0 ? void 0 : _a.localeCompare(w1.lastUpdatedTime || '')) || 0;
15437
15661
  });
@@ -15452,11 +15676,7 @@ const PublicWarningListConnect = () => {
15452
15676
  onRefetchWarnings: fetchWarnings,
15453
15677
  filters: filters,
15454
15678
  isAllChipSelected: isAllChipSelected,
15455
- onClickAllChip: onClickAllChip,
15456
- showSigmet: showSigmet,
15457
- showAirmet: showAirmet,
15458
- setShowSigmet: setShowSigmet,
15459
- setShowAirmet: setShowAirmet
15679
+ onClickAllChip: onClickAllChip
15460
15680
  }), confirmDialogOptions && jsx(ConfirmDeleteWarningDialog, {
15461
15681
  onClose: () => setConfirmDialogOptions(undefined),
15462
15682
  title: confirmDialogOptions.title,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/warnings",
3
- "version": "9.29.0",
3
+ "version": "9.29.1",
4
4
  "description": "GeoWeb warinings library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { FilterState, UpdateFilter } from '../PublicWarningList/hooks';
3
+ type IdType = keyof FilterState;
4
+ interface Props {
5
+ id: IdType;
6
+ options: FilterState[IdType];
7
+ updateFilter: UpdateFilter;
8
+ }
9
+ declare const ExpandableFilterChip: React.FC<Props>;
10
+ export default ExpandableFilterChip;
@@ -1,13 +1,12 @@
1
1
  import { FC } from 'react';
2
2
  import { WarningListFilter } from '../../store/publicWarnings/types';
3
+ import { FilterState, UpdateFilter } from '../PublicWarningList/hooks';
3
4
  interface FilterListProps {
4
5
  filters?: WarningListFilter[];
5
6
  onClickAll?: (isChecked: boolean) => void;
6
7
  isAllSelected?: boolean;
7
- showSigmet?: boolean;
8
- showAirmet?: boolean;
9
- setShowSigmet?: React.Dispatch<React.SetStateAction<boolean>>;
10
- setShowAirmet?: React.Dispatch<React.SetStateAction<boolean>>;
8
+ filterState?: FilterState;
9
+ updateFilter: UpdateFilter;
11
10
  }
12
11
  declare const FilterList: FC<FilterListProps>;
13
12
  export default FilterList;
@@ -0,0 +1,12 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { FilterState, OptionKey } from '../PublicWarningList/hooks';
3
+ type FilterType = keyof FilterState;
4
+ interface Props {
5
+ filterId: FilterType;
6
+ optionId: OptionKey<FilterType>;
7
+ checked: boolean;
8
+ onClick: (checked: boolean, only?: boolean) => void;
9
+ label?: ReactNode;
10
+ }
11
+ declare const FilterOption: React.FC<Props>;
12
+ export default FilterOption;
@@ -20,9 +20,5 @@ export declare const PublicWarningList: React.FC<{
20
20
  filters?: WarningListFilter[];
21
21
  onClickAllChip?: (isChecked: boolean) => void;
22
22
  isAllChipSelected?: boolean;
23
- showSigmet?: boolean;
24
- showAirmet?: boolean;
25
- setShowSigmet?: React.Dispatch<React.SetStateAction<boolean>>;
26
- setShowAirmet?: React.Dispatch<React.SetStateAction<boolean>>;
27
23
  } & WarningStatusProps>;
28
24
  export default PublicWarningList;
@@ -0,0 +1,19 @@
1
+ import { PublicWarning } from '../../store/publicWarningForm/types';
2
+ declare enum Domain {
3
+ aviation = "aviation",
4
+ maritime = "maritime",
5
+ public = "public"
6
+ }
7
+ declare const defaultDomainFilter: Record<Domain, boolean>;
8
+ export interface FilterState {
9
+ domain: typeof defaultDomainFilter;
10
+ }
11
+ export type FilterKeyType = keyof FilterState;
12
+ export type OptionKey<T extends FilterKeyType> = keyof FilterState[T];
13
+ export type UpdateFilter = <T extends FilterKeyType>(filterKey: T | 'ALL', optionKey: OptionKey<T> | 'ALL', value: boolean, only?: boolean) => void;
14
+ export declare const useWarningFilters: () => {
15
+ filterState: FilterState;
16
+ updateFilter: UpdateFilter;
17
+ byFilterState: (warning: PublicWarning) => boolean;
18
+ };
19
+ export {};