@equinor/echo-components 0.6.2 → 0.6.4
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
2
|
import { LayerInfo } from '@types';
|
|
3
3
|
interface MainLegendProps {
|
|
4
4
|
/**
|
|
@@ -9,6 +9,14 @@ interface MainLegendProps {
|
|
|
9
9
|
* Layer information
|
|
10
10
|
*/
|
|
11
11
|
layers: LayerInfo[];
|
|
12
|
+
/**
|
|
13
|
+
* Styling for the main legend
|
|
14
|
+
*/
|
|
15
|
+
legendStyle?: CSSProperties;
|
|
16
|
+
/**
|
|
17
|
+
* Styling for the content of the legend
|
|
18
|
+
*/
|
|
19
|
+
legendContentStyle?: CSSProperties;
|
|
12
20
|
}
|
|
13
|
-
declare function MainLegend({ legends, layers }: MainLegendProps): JSX.Element;
|
|
21
|
+
declare function MainLegend({ legends, layers, legendStyle, legendContentStyle }: MainLegendProps): JSX.Element;
|
|
14
22
|
export { MainLegend };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
2
|
interface LayerLegendProps {
|
|
3
3
|
/**
|
|
4
4
|
* Layer title
|
|
@@ -24,6 +24,10 @@ interface LayerLegendProps {
|
|
|
24
24
|
* Used to disable layer legend usage
|
|
25
25
|
*/
|
|
26
26
|
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Styling for the content of the legend
|
|
29
|
+
*/
|
|
30
|
+
style?: CSSProperties;
|
|
27
31
|
}
|
|
28
|
-
declare function LayerLegend({ title, iconName, itemsCount, itemsTitle, children, disabled }: LayerLegendProps): JSX.Element;
|
|
32
|
+
declare function LayerLegend({ title, iconName, itemsCount, itemsTitle, children, disabled, style }: LayerLegendProps): JSX.Element;
|
|
29
33
|
export { LayerLegend };
|
package/dist/index.js
CHANGED
|
@@ -17675,198 +17675,6 @@ var FloatingActionButton = function FloatingActionButton(_ref) {
|
|
|
17675
17675
|
}), variant === 'square_icon_with_text' && label);
|
|
17676
17676
|
};
|
|
17677
17677
|
|
|
17678
|
-
var css_248z$m = ".floatingSearchBar-module_searchbarWrapper__-sSMM{max-width:344px;position:relative}.floatingSearchBar-module_searchbar__0U3fZ div[class^=Input__Container]{background:none;box-shadow:none;height:48px}.floatingSearchBar-module_searchbar__0U3fZ div[class^=Input__Container]:focus-within{outline:none}.floatingSearchBar-module_searchbar__0U3fZ input{background:rgba(0,0,0,.8);border-radius:4px;color:#dee5e7}.floatingSearchBar-module_searchbar__0U3fZ svg{color:#dee5e7}.floatingSearchBar-module_searchbar__0U3fZ input::placeholder{color:#dee5e7}.floatingSearchBar-module_searchbar__0U3fZ input:focus,.floatingSearchBar-module_searchbar__0U3fZ input:hover{background:rgba(0,0,0,.9)}.floatingSearchBar-module_searchbar__0U3fZ button{opacity:.6}.floatingSearchBar-module_searchbar__0U3fZ button:hover{background:transparent;opacity:1}.floatingSearchBar-module_searchbar__0U3fZ button:focus{opacity:1;outline-color:var(--white)}.floatingSearchBar-module_items__oxyVh{background:rgba(0,0,0,.9);border-radius:4px;margin-top:4px;max-height:400px;overflow:auto;padding:8px 0;position:absolute;width:100%}.floatingSearchBar-module_items__oxyVh::-webkit-scrollbar-thumb{background:hsla(0,0%,100%,.25);border:2px solid hsla(0,0%,100%,.06)}.floatingSearchBar-module_items__oxyVh::-webkit-scrollbar-track{background:rgba(0,0,0,.9)}.floatingSearchBar-module_groupWrapper__B6-q3{color:var(--white);font-size:1rem;font-style:normal;font-weight:400;line-height:1rem;list-style:none;margin:0;padding:0}.floatingSearchBar-module_groupTitle__3fYBM{border-bottom:1px solid hsla(0,0%,100%,.16);padding:.5rem 1rem}.floatingSearchBar-module_item__nxfxG{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;gap:1rem;padding:1rem 1.25rem}.floatingSearchBar-module_item__nxfxG svg{min-width:24px}.floatingSearchBar-module_loading__lY-99{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;gap:1rem;justify-content:center;padding:1rem 1.25rem}.floatingSearchBar-module_item__nxfxG:hover{background:hsla(0,0%,100%,.16);cursor:pointer}.floatingSearchBar-module_activeItem__IQ7gz{background:hsla(0,0%,100%,.16)}";
|
|
17679
|
-
var style$2 = {"searchbarWrapper":"floatingSearchBar-module_searchbarWrapper__-sSMM","searchbar":"floatingSearchBar-module_searchbar__0U3fZ","items":"floatingSearchBar-module_items__oxyVh","groupWrapper":"floatingSearchBar-module_groupWrapper__B6-q3","groupTitle":"floatingSearchBar-module_groupTitle__3fYBM","item":"floatingSearchBar-module_item__nxfxG","loading":"floatingSearchBar-module_loading__lY-99","activeItem":"floatingSearchBar-module_activeItem__IQ7gz"};
|
|
17680
|
-
styleInject(css_248z$m);
|
|
17681
|
-
|
|
17682
|
-
var useEventListener = function useEventListener(eventName, handler, options) {
|
|
17683
|
-
var element = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document;
|
|
17684
|
-
var savedHandler = useRef();
|
|
17685
|
-
useEffect(function () {
|
|
17686
|
-
savedHandler.current = handler;
|
|
17687
|
-
}, [handler]);
|
|
17688
|
-
useEffect(function () {
|
|
17689
|
-
if (!element || !element.addEventListener) {
|
|
17690
|
-
return;
|
|
17691
|
-
}
|
|
17692
|
-
var eventListener = function eventListener(event) {
|
|
17693
|
-
return savedHandler.current(event);
|
|
17694
|
-
};
|
|
17695
|
-
element.addEventListener(eventName, eventListener, options);
|
|
17696
|
-
return function () {
|
|
17697
|
-
element.removeEventListener(eventName, eventListener, options);
|
|
17698
|
-
};
|
|
17699
|
-
}, [eventName, element, options]);
|
|
17700
|
-
};
|
|
17701
|
-
|
|
17702
|
-
var useInitial = EchoUtils.Hooks.useInitial;
|
|
17703
|
-
/**
|
|
17704
|
-
* Hook for checking if page is loaded from mobile device.
|
|
17705
|
-
* @returns boolean true if on mobile.
|
|
17706
|
-
*/
|
|
17707
|
-
function useIsMobile() {
|
|
17708
|
-
var _useState = useState(false),
|
|
17709
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
17710
|
-
isMobile = _useState2[0],
|
|
17711
|
-
setIsMobile = _useState2[1];
|
|
17712
|
-
useInitial(function () {
|
|
17713
|
-
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
|
17714
|
-
// true for mobile device
|
|
17715
|
-
setIsMobile(true);
|
|
17716
|
-
} else {
|
|
17717
|
-
// false for not mobile device
|
|
17718
|
-
setIsMobile(false);
|
|
17719
|
-
}
|
|
17720
|
-
});
|
|
17721
|
-
return isMobile;
|
|
17722
|
-
}
|
|
17723
|
-
|
|
17724
|
-
var Keys = {
|
|
17725
|
-
ArrowUp: 'up',
|
|
17726
|
-
ArrowRight: 'right',
|
|
17727
|
-
ArrowDown: 'down',
|
|
17728
|
-
ArrowLeft: 'left',
|
|
17729
|
-
Enter: 'enter',
|
|
17730
|
-
Escape: 'escape'
|
|
17731
|
-
};
|
|
17732
|
-
var useListNavigator = function useListNavigator(listLength) {
|
|
17733
|
-
var initialIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
17734
|
-
var keyboardEvents = arguments.length > 2 ? arguments[2] : undefined;
|
|
17735
|
-
var listenerTarget = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document;
|
|
17736
|
-
var _useState = useState(initialIndex),
|
|
17737
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
17738
|
-
currIndex = _useState2[0],
|
|
17739
|
-
setCurrIndex = _useState2[1];
|
|
17740
|
-
var downHandler = useCallback(function (e) {
|
|
17741
|
-
setCurrIndex(function (c) {
|
|
17742
|
-
return c < listLength - 1 ? c + 1 : listLength - 1;
|
|
17743
|
-
});
|
|
17744
|
-
}, [listLength]);
|
|
17745
|
-
var upHandler = useCallback(function (e) {
|
|
17746
|
-
setCurrIndex(function (c) {
|
|
17747
|
-
return c < 0 ? -1 : c - 1;
|
|
17748
|
-
});
|
|
17749
|
-
}, [listLength]);
|
|
17750
|
-
var enter = useCallback(function () {
|
|
17751
|
-
if (keyboardEvents === null || keyboardEvents === void 0 ? void 0 : keyboardEvents.enter) {
|
|
17752
|
-
if (currIndex === -1) {
|
|
17753
|
-
return;
|
|
17754
|
-
}
|
|
17755
|
-
keyboardEvents.enter(currIndex);
|
|
17756
|
-
}
|
|
17757
|
-
}, [currIndex, keyboardEvents]);
|
|
17758
|
-
useKeyboardNavigation({
|
|
17759
|
-
up: upHandler,
|
|
17760
|
-
down: downHandler,
|
|
17761
|
-
enter: enter
|
|
17762
|
-
}, listenerTarget);
|
|
17763
|
-
return currIndex;
|
|
17764
|
-
};
|
|
17765
|
-
/**
|
|
17766
|
-
* 1. On open: focus should be undefined/inactive. (list should scroll/show selected item if any).
|
|
17767
|
-
* 2. user presses a key (usually down) - scroll list to focused element, which should be first item
|
|
17768
|
-
* in the first section. Also set focused section.
|
|
17769
|
-
* 3. Potentially jump to last in list if user goes up?
|
|
17770
|
-
*/
|
|
17771
|
-
var useSectionNavigator = function useSectionNavigator(sections, initialSelected, keyboardEvents) {
|
|
17772
|
-
var listenerTarget = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document;
|
|
17773
|
-
var _useState3 = useState(initialSelected),
|
|
17774
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
17775
|
-
focusedSection = _useState4[0],
|
|
17776
|
-
setFocusedSection = _useState4[1];
|
|
17777
|
-
var _useState5 = useState(initialSelected),
|
|
17778
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
17779
|
-
focusedOption = _useState6[0],
|
|
17780
|
-
setFocusedOption = _useState6[1];
|
|
17781
|
-
var up = useCallback(function () {
|
|
17782
|
-
var nextSection = focusedSection;
|
|
17783
|
-
var nextOption = focusedOption;
|
|
17784
|
-
if (nextOption > 0) {
|
|
17785
|
-
// there exists more options in this section
|
|
17786
|
-
setFocusedOption(nextOption - 1);
|
|
17787
|
-
} else {
|
|
17788
|
-
// we're on the first option in section and should move to a previous section.
|
|
17789
|
-
if (nextSection > 0) {
|
|
17790
|
-
nextSection -= 1;
|
|
17791
|
-
// getting last index of option in section
|
|
17792
|
-
nextOption = sections[nextSection].options.length - 1;
|
|
17793
|
-
setFocusedSection(nextSection);
|
|
17794
|
-
setFocusedOption(nextOption);
|
|
17795
|
-
} else {
|
|
17796
|
-
// if initial is deselected -- we add this step.
|
|
17797
|
-
if (initialSelected === -1 && focusedOption === 0 && focusedSection === 0) {
|
|
17798
|
-
// deselect
|
|
17799
|
-
setFocusedSection(-1);
|
|
17800
|
-
setFocusedOption(-1);
|
|
17801
|
-
} else {
|
|
17802
|
-
// we're at deselected - move user down to end
|
|
17803
|
-
nextSection = sections.length - 1;
|
|
17804
|
-
nextOption = sections[nextSection].options.length - 1;
|
|
17805
|
-
setFocusedSection(nextSection);
|
|
17806
|
-
setFocusedOption(nextOption);
|
|
17807
|
-
}
|
|
17808
|
-
}
|
|
17809
|
-
}
|
|
17810
|
-
}, [sections, focusedSection, focusedOption]);
|
|
17811
|
-
var down = useCallback(function () {
|
|
17812
|
-
var _a, _b;
|
|
17813
|
-
var nextSection = focusedSection;
|
|
17814
|
-
var nextOption = focusedOption;
|
|
17815
|
-
if (nextOption < ((_b = (_a = sections[nextSection]) === null || _a === void 0 ? void 0 : _a.options.length) !== null && _b !== void 0 ? _b : 0) - 1) {
|
|
17816
|
-
setFocusedOption(nextOption + 1);
|
|
17817
|
-
} else {
|
|
17818
|
-
// we're at the end of options in section
|
|
17819
|
-
if (nextSection < sections.length - 1) {
|
|
17820
|
-
// there exists more sections
|
|
17821
|
-
setFocusedSection(nextSection + 1);
|
|
17822
|
-
setFocusedOption(0);
|
|
17823
|
-
} else {
|
|
17824
|
-
// we're at the end of sections - back to start (de-selected).
|
|
17825
|
-
// props says we need a deselected step
|
|
17826
|
-
if (initialSelected === -1) {
|
|
17827
|
-
setFocusedSection(-1);
|
|
17828
|
-
setFocusedOption(-1);
|
|
17829
|
-
} else {
|
|
17830
|
-
setFocusedSection(0);
|
|
17831
|
-
setFocusedOption(0);
|
|
17832
|
-
}
|
|
17833
|
-
}
|
|
17834
|
-
}
|
|
17835
|
-
}, [sections, focusedSection, focusedOption]);
|
|
17836
|
-
var enter = useCallback(function () {
|
|
17837
|
-
if (keyboardEvents.enter) {
|
|
17838
|
-
if (focusedOption === -1 && focusedSection === -1) {
|
|
17839
|
-
return;
|
|
17840
|
-
}
|
|
17841
|
-
keyboardEvents.enter(focusedSection, focusedOption);
|
|
17842
|
-
}
|
|
17843
|
-
}, [focusedSection, focusedOption, keyboardEvents]);
|
|
17844
|
-
var escape = useCallback(function () {
|
|
17845
|
-
keyboardEvents.escape && keyboardEvents.escape();
|
|
17846
|
-
}, [focusedSection, focusedOption, keyboardEvents]);
|
|
17847
|
-
useKeyboardNavigation({
|
|
17848
|
-
up: up,
|
|
17849
|
-
down: down,
|
|
17850
|
-
enter: enter,
|
|
17851
|
-
escape: escape
|
|
17852
|
-
}, listenerTarget);
|
|
17853
|
-
return {
|
|
17854
|
-
focusedSection: focusedSection,
|
|
17855
|
-
focusedOption: focusedOption
|
|
17856
|
-
};
|
|
17857
|
-
};
|
|
17858
|
-
var useKeyboardNavigation = function useKeyboardNavigation(keyboardEvents) {
|
|
17859
|
-
var listenerTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
|
|
17860
|
-
var handleKeyDown = useCallback(function (e) {
|
|
17861
|
-
var key = Keys[e.key];
|
|
17862
|
-
var handler = keyboardEvents[key];
|
|
17863
|
-
if (handler) {
|
|
17864
|
-
handler(e);
|
|
17865
|
-
}
|
|
17866
|
-
}, [keyboardEvents]);
|
|
17867
|
-
useEventListener('keydown', handleKeyDown, false, listenerTarget);
|
|
17868
|
-
};
|
|
17869
|
-
|
|
17870
17678
|
function classnames$1() {
|
|
17871
17679
|
for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
17872
17680
|
parts[_key] = arguments[_key];
|
|
@@ -18220,6 +18028,198 @@ function getIcon(tagCategoryDescription) {
|
|
|
18220
18028
|
});
|
|
18221
18029
|
}
|
|
18222
18030
|
|
|
18031
|
+
var useEventListener = function useEventListener(eventName, handler, options) {
|
|
18032
|
+
var element = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document;
|
|
18033
|
+
var savedHandler = useRef();
|
|
18034
|
+
useEffect(function () {
|
|
18035
|
+
savedHandler.current = handler;
|
|
18036
|
+
}, [handler]);
|
|
18037
|
+
useEffect(function () {
|
|
18038
|
+
if (!element || !element.addEventListener) {
|
|
18039
|
+
return;
|
|
18040
|
+
}
|
|
18041
|
+
var eventListener = function eventListener(event) {
|
|
18042
|
+
return savedHandler.current(event);
|
|
18043
|
+
};
|
|
18044
|
+
element.addEventListener(eventName, eventListener, options);
|
|
18045
|
+
return function () {
|
|
18046
|
+
element.removeEventListener(eventName, eventListener, options);
|
|
18047
|
+
};
|
|
18048
|
+
}, [eventName, element, options]);
|
|
18049
|
+
};
|
|
18050
|
+
|
|
18051
|
+
var useInitial = EchoUtils.Hooks.useInitial;
|
|
18052
|
+
/**
|
|
18053
|
+
* Hook for checking if page is loaded from mobile device.
|
|
18054
|
+
* @returns boolean true if on mobile.
|
|
18055
|
+
*/
|
|
18056
|
+
function useIsMobile() {
|
|
18057
|
+
var _useState = useState(false),
|
|
18058
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18059
|
+
isMobile = _useState2[0],
|
|
18060
|
+
setIsMobile = _useState2[1];
|
|
18061
|
+
useInitial(function () {
|
|
18062
|
+
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
|
18063
|
+
// true for mobile device
|
|
18064
|
+
setIsMobile(true);
|
|
18065
|
+
} else {
|
|
18066
|
+
// false for not mobile device
|
|
18067
|
+
setIsMobile(false);
|
|
18068
|
+
}
|
|
18069
|
+
});
|
|
18070
|
+
return isMobile;
|
|
18071
|
+
}
|
|
18072
|
+
|
|
18073
|
+
var Keys = {
|
|
18074
|
+
ArrowUp: 'up',
|
|
18075
|
+
ArrowRight: 'right',
|
|
18076
|
+
ArrowDown: 'down',
|
|
18077
|
+
ArrowLeft: 'left',
|
|
18078
|
+
Enter: 'enter',
|
|
18079
|
+
Escape: 'escape'
|
|
18080
|
+
};
|
|
18081
|
+
var useListNavigator = function useListNavigator(listLength) {
|
|
18082
|
+
var initialIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
18083
|
+
var keyboardEvents = arguments.length > 2 ? arguments[2] : undefined;
|
|
18084
|
+
var listenerTarget = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document;
|
|
18085
|
+
var _useState = useState(initialIndex),
|
|
18086
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18087
|
+
currIndex = _useState2[0],
|
|
18088
|
+
setCurrIndex = _useState2[1];
|
|
18089
|
+
var downHandler = useCallback(function (e) {
|
|
18090
|
+
setCurrIndex(function (c) {
|
|
18091
|
+
return c < listLength - 1 ? c + 1 : listLength - 1;
|
|
18092
|
+
});
|
|
18093
|
+
}, [listLength]);
|
|
18094
|
+
var upHandler = useCallback(function (e) {
|
|
18095
|
+
setCurrIndex(function (c) {
|
|
18096
|
+
return c < 0 ? -1 : c - 1;
|
|
18097
|
+
});
|
|
18098
|
+
}, [listLength]);
|
|
18099
|
+
var enter = useCallback(function () {
|
|
18100
|
+
if (keyboardEvents === null || keyboardEvents === void 0 ? void 0 : keyboardEvents.enter) {
|
|
18101
|
+
if (currIndex === -1) {
|
|
18102
|
+
return;
|
|
18103
|
+
}
|
|
18104
|
+
keyboardEvents.enter(currIndex);
|
|
18105
|
+
}
|
|
18106
|
+
}, [currIndex, keyboardEvents]);
|
|
18107
|
+
useKeyboardNavigation({
|
|
18108
|
+
up: upHandler,
|
|
18109
|
+
down: downHandler,
|
|
18110
|
+
enter: enter
|
|
18111
|
+
}, listenerTarget);
|
|
18112
|
+
return currIndex;
|
|
18113
|
+
};
|
|
18114
|
+
/**
|
|
18115
|
+
* 1. On open: focus should be undefined/inactive. (list should scroll/show selected item if any).
|
|
18116
|
+
* 2. user presses a key (usually down) - scroll list to focused element, which should be first item
|
|
18117
|
+
* in the first section. Also set focused section.
|
|
18118
|
+
* 3. Potentially jump to last in list if user goes up?
|
|
18119
|
+
*/
|
|
18120
|
+
var useSectionNavigator = function useSectionNavigator(sections, initialSelected, keyboardEvents) {
|
|
18121
|
+
var listenerTarget = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document;
|
|
18122
|
+
var _useState3 = useState(initialSelected),
|
|
18123
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
18124
|
+
focusedSection = _useState4[0],
|
|
18125
|
+
setFocusedSection = _useState4[1];
|
|
18126
|
+
var _useState5 = useState(initialSelected),
|
|
18127
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
18128
|
+
focusedOption = _useState6[0],
|
|
18129
|
+
setFocusedOption = _useState6[1];
|
|
18130
|
+
var up = useCallback(function () {
|
|
18131
|
+
var nextSection = focusedSection;
|
|
18132
|
+
var nextOption = focusedOption;
|
|
18133
|
+
if (nextOption > 0) {
|
|
18134
|
+
// there exists more options in this section
|
|
18135
|
+
setFocusedOption(nextOption - 1);
|
|
18136
|
+
} else {
|
|
18137
|
+
// we're on the first option in section and should move to a previous section.
|
|
18138
|
+
if (nextSection > 0) {
|
|
18139
|
+
nextSection -= 1;
|
|
18140
|
+
// getting last index of option in section
|
|
18141
|
+
nextOption = sections[nextSection].options.length - 1;
|
|
18142
|
+
setFocusedSection(nextSection);
|
|
18143
|
+
setFocusedOption(nextOption);
|
|
18144
|
+
} else {
|
|
18145
|
+
// if initial is deselected -- we add this step.
|
|
18146
|
+
if (initialSelected === -1 && focusedOption === 0 && focusedSection === 0) {
|
|
18147
|
+
// deselect
|
|
18148
|
+
setFocusedSection(-1);
|
|
18149
|
+
setFocusedOption(-1);
|
|
18150
|
+
} else {
|
|
18151
|
+
// we're at deselected - move user down to end
|
|
18152
|
+
nextSection = sections.length - 1;
|
|
18153
|
+
nextOption = sections[nextSection].options.length - 1;
|
|
18154
|
+
setFocusedSection(nextSection);
|
|
18155
|
+
setFocusedOption(nextOption);
|
|
18156
|
+
}
|
|
18157
|
+
}
|
|
18158
|
+
}
|
|
18159
|
+
}, [sections, focusedSection, focusedOption]);
|
|
18160
|
+
var down = useCallback(function () {
|
|
18161
|
+
var _a, _b;
|
|
18162
|
+
var nextSection = focusedSection;
|
|
18163
|
+
var nextOption = focusedOption;
|
|
18164
|
+
if (nextOption < ((_b = (_a = sections[nextSection]) === null || _a === void 0 ? void 0 : _a.options.length) !== null && _b !== void 0 ? _b : 0) - 1) {
|
|
18165
|
+
setFocusedOption(nextOption + 1);
|
|
18166
|
+
} else {
|
|
18167
|
+
// we're at the end of options in section
|
|
18168
|
+
if (nextSection < sections.length - 1) {
|
|
18169
|
+
// there exists more sections
|
|
18170
|
+
setFocusedSection(nextSection + 1);
|
|
18171
|
+
setFocusedOption(0);
|
|
18172
|
+
} else {
|
|
18173
|
+
// we're at the end of sections - back to start (de-selected).
|
|
18174
|
+
// props says we need a deselected step
|
|
18175
|
+
if (initialSelected === -1) {
|
|
18176
|
+
setFocusedSection(-1);
|
|
18177
|
+
setFocusedOption(-1);
|
|
18178
|
+
} else {
|
|
18179
|
+
setFocusedSection(0);
|
|
18180
|
+
setFocusedOption(0);
|
|
18181
|
+
}
|
|
18182
|
+
}
|
|
18183
|
+
}
|
|
18184
|
+
}, [sections, focusedSection, focusedOption]);
|
|
18185
|
+
var enter = useCallback(function () {
|
|
18186
|
+
if (keyboardEvents.enter) {
|
|
18187
|
+
if (focusedOption === -1 && focusedSection === -1) {
|
|
18188
|
+
return;
|
|
18189
|
+
}
|
|
18190
|
+
keyboardEvents.enter(focusedSection, focusedOption);
|
|
18191
|
+
}
|
|
18192
|
+
}, [focusedSection, focusedOption, keyboardEvents]);
|
|
18193
|
+
var escape = useCallback(function () {
|
|
18194
|
+
keyboardEvents.escape && keyboardEvents.escape();
|
|
18195
|
+
}, [focusedSection, focusedOption, keyboardEvents]);
|
|
18196
|
+
useKeyboardNavigation({
|
|
18197
|
+
up: up,
|
|
18198
|
+
down: down,
|
|
18199
|
+
enter: enter,
|
|
18200
|
+
escape: escape
|
|
18201
|
+
}, listenerTarget);
|
|
18202
|
+
return {
|
|
18203
|
+
focusedSection: focusedSection,
|
|
18204
|
+
focusedOption: focusedOption
|
|
18205
|
+
};
|
|
18206
|
+
};
|
|
18207
|
+
var useKeyboardNavigation = function useKeyboardNavigation(keyboardEvents) {
|
|
18208
|
+
var listenerTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
|
|
18209
|
+
var handleKeyDown = useCallback(function (e) {
|
|
18210
|
+
var key = Keys[e.key];
|
|
18211
|
+
var handler = keyboardEvents[key];
|
|
18212
|
+
if (handler) {
|
|
18213
|
+
handler(e);
|
|
18214
|
+
}
|
|
18215
|
+
}, [keyboardEvents]);
|
|
18216
|
+
useEventListener('keydown', handleKeyDown, false, listenerTarget);
|
|
18217
|
+
};
|
|
18218
|
+
|
|
18219
|
+
var css_248z$m = ".floatingSearchBar-module_searchbarWrapper__-sSMM{max-width:404px;position:relative}.floatingSearchBar-module_searchbar__0U3fZ div[class^=Input__Container]{background:none;box-shadow:none;height:48px}.floatingSearchBar-module_searchbar__0U3fZ div[class^=Input__Container]:focus-within{outline:none}.floatingSearchBar-module_searchbar__0U3fZ input{background:rgba(0,0,0,.8);border-radius:4px;color:#dee5e7}.floatingSearchBar-module_searchbar__0U3fZ svg{color:#dee5e7}.floatingSearchBar-module_searchbar__0U3fZ input::placeholder{color:#dee5e7}.floatingSearchBar-module_searchbar__0U3fZ input:focus,.floatingSearchBar-module_searchbar__0U3fZ input:hover{background:rgba(0,0,0,.9)}.floatingSearchBar-module_searchbar__0U3fZ button{opacity:.6}.floatingSearchBar-module_searchbar__0U3fZ button:hover{background:transparent;opacity:1}.floatingSearchBar-module_searchbar__0U3fZ button:focus{opacity:1;outline-color:var(--white)}.floatingSearchBar-module_items__oxyVh{background:rgba(0,0,0,.9);border-radius:4px;margin-top:4px;max-height:400px;overflow:auto;padding:8px 0;position:absolute;width:100%}.floatingSearchBar-module_items__oxyVh::-webkit-scrollbar-thumb{background:hsla(0,0%,100%,.25);border:2px solid hsla(0,0%,100%,.06)}.floatingSearchBar-module_items__oxyVh::-webkit-scrollbar-track{background:rgba(0,0,0,.9)}.floatingSearchBar-module_groupWrapper__B6-q3{color:var(--white);font-size:1rem;font-style:normal;font-weight:400;line-height:1rem;list-style:none;margin:0;padding:0}.floatingSearchBar-module_groupTitle__3fYBM{border-bottom:1px solid hsla(0,0%,100%,.16);padding:.5rem 1rem}.floatingSearchBar-module_item__nxfxG{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;gap:1rem;padding:1rem 1.25rem}.floatingSearchBar-module_item__nxfxG svg{min-width:24px}.floatingSearchBar-module_loading__lY-99{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;gap:1rem;justify-content:center;padding:1rem 1.25rem}.floatingSearchBar-module_item__nxfxG:hover{background:hsla(0,0%,100%,.16);cursor:pointer}.floatingSearchBar-module_activeItem__IQ7gz{background:hsla(0,0%,100%,.16)}";
|
|
18220
|
+
var style$2 = {"searchbarWrapper":"floatingSearchBar-module_searchbarWrapper__-sSMM","searchbar":"floatingSearchBar-module_searchbar__0U3fZ","items":"floatingSearchBar-module_items__oxyVh","groupWrapper":"floatingSearchBar-module_groupWrapper__B6-q3","groupTitle":"floatingSearchBar-module_groupTitle__3fYBM","item":"floatingSearchBar-module_item__nxfxG","loading":"floatingSearchBar-module_loading__lY-99","activeItem":"floatingSearchBar-module_activeItem__IQ7gz"};
|
|
18221
|
+
styleInject(css_248z$m);
|
|
18222
|
+
|
|
18223
18223
|
/**
|
|
18224
18224
|
* Floating search bar
|
|
18225
18225
|
*
|
|
@@ -18263,7 +18263,9 @@ var FloatingSearchBar = function FloatingSearchBar(_ref) {
|
|
|
18263
18263
|
ref: containerRef,
|
|
18264
18264
|
className: style$2.searchbarWrapper,
|
|
18265
18265
|
onFocus: function onFocus() {
|
|
18266
|
-
|
|
18266
|
+
if (value) {
|
|
18267
|
+
openMenu();
|
|
18268
|
+
}
|
|
18267
18269
|
},
|
|
18268
18270
|
autoComplete: 'off',
|
|
18269
18271
|
onSubmit: function onSubmit(e) {
|
|
@@ -18277,17 +18279,17 @@ var FloatingSearchBar = function FloatingSearchBar(_ref) {
|
|
|
18277
18279
|
"aria-haspopup": "true",
|
|
18278
18280
|
className: style$2.searchbar,
|
|
18279
18281
|
onChange: function onChange(e) {
|
|
18280
|
-
var
|
|
18281
|
-
setValue(
|
|
18282
|
-
onSearchQueryChange(
|
|
18283
|
-
if (
|
|
18282
|
+
var val = e.target.value;
|
|
18283
|
+
setValue(val);
|
|
18284
|
+
onSearchQueryChange(val);
|
|
18285
|
+
if (val === '') {
|
|
18284
18286
|
closeMenu();
|
|
18285
18287
|
} else if (!isOpen) {
|
|
18286
18288
|
openMenu();
|
|
18287
18289
|
}
|
|
18288
18290
|
},
|
|
18289
18291
|
value: value
|
|
18290
|
-
}),
|
|
18292
|
+
}), isOpen && /*#__PURE__*/React__default.createElement("div", {
|
|
18291
18293
|
className: style$2.items
|
|
18292
18294
|
}, isLoading && /*#__PURE__*/React__default.createElement("li", {
|
|
18293
18295
|
className: style$2.loading,
|
|
@@ -18411,8 +18413,8 @@ var InlineTagIconLink = function InlineTagIconLink(_ref) {
|
|
|
18411
18413
|
}, description)));
|
|
18412
18414
|
};
|
|
18413
18415
|
|
|
18414
|
-
var css_248z$k = ".MainLegend-module_accordion__xjveF{align-items:center;align-self:flex-start;background:rgba(0,0,0,.65);border-radius:4px;color:var(--white);cursor:pointer;display:flex;font-size:.875rem;font-weight:500;height:2.25rem;justify-content:space-between;padding:8px 14px;user-select:none;width:100%}.MainLegend-
|
|
18415
|
-
var styles$i = {"accordion":"MainLegend-module_accordion__xjveF","left":"MainLegend-module_left__NKMwB","right":"MainLegend-module_right__0BIFF","icon":"MainLegend-module_icon__neT4f","content":"MainLegend-module_content__nzDkL","layerIcon":"MainLegend-module_layerIcon__xI2Mf"};
|
|
18416
|
+
var css_248z$k = ".MainLegend-module_accordion__xjveF{align-items:center;align-self:flex-start;background:rgba(0,0,0,.65);border-radius:4px;color:var(--white);cursor:pointer;display:flex;font-size:.875rem;font-weight:500;height:2.25rem;justify-content:space-between;margin-top:2px;max-width:460px;padding:8px 14px;user-select:none;width:100%}.MainLegend-module_accordionDesktop__Z7SS-:hover{background:rgba(0,0,0,.9);color:var(--white)}.MainLegend-module_accordionMobile__tOTvf{width:278px}.MainLegend-module_left__NKMwB,.MainLegend-module_right__0BIFF{align-items:center;display:flex}.MainLegend-module_icon__neT4f{margin-right:8px}.MainLegend-module_content__nzDkL{align-self:stretch;display:flex;flex-direction:column;overflow:auto;padding-right:4px}.MainLegend-module_content__nzDkL::-webkit-scrollbar{width:8px}.MainLegend-module_content__nzDkL::-webkit-scrollbar-thumb{background:rgba(0,0,0,.65)}.MainLegend-module_content__nzDkL::-webkit-scrollbar-track{background:none}.MainLegend-module_contentMobile__msQoO{padding-right:0;width:278px}.MainLegend-module_contentMobile__msQoO::-webkit-scrollbar{display:none}.MainLegend-module_layerIcon__xI2Mf{margin-right:10px}.MainLegend-module_layerIcon__xI2Mf:last-of-type{margin-right:0}";
|
|
18417
|
+
var styles$i = {"accordion":"MainLegend-module_accordion__xjveF","accordionDesktop":"MainLegend-module_accordionDesktop__Z7SS- MainLegend-module_accordion__xjveF","accordionMobile":"MainLegend-module_accordionMobile__tOTvf MainLegend-module_accordion__xjveF","left":"MainLegend-module_left__NKMwB","right":"MainLegend-module_right__0BIFF","icon":"MainLegend-module_icon__neT4f","content":"MainLegend-module_content__nzDkL","contentMobile":"MainLegend-module_contentMobile__msQoO MainLegend-module_content__nzDkL","layerIcon":"MainLegend-module_layerIcon__xI2Mf"};
|
|
18416
18418
|
styleInject(css_248z$k);
|
|
18417
18419
|
|
|
18418
18420
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
@@ -18442,8 +18444,11 @@ function separateLayers(layers) {
|
|
|
18442
18444
|
return [iconLayers, nonIconLayers];
|
|
18443
18445
|
}
|
|
18444
18446
|
function MainLegend(_ref) {
|
|
18447
|
+
var _classnames, _classnames2;
|
|
18445
18448
|
var legends = _ref.legends,
|
|
18446
|
-
layers = _ref.layers
|
|
18449
|
+
layers = _ref.layers,
|
|
18450
|
+
legendStyle = _ref.legendStyle,
|
|
18451
|
+
legendContentStyle = _ref.legendContentStyle;
|
|
18447
18452
|
var _useState = useState([]),
|
|
18448
18453
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18449
18454
|
defaultLayers = _useState2[0],
|
|
@@ -18477,10 +18482,14 @@ function MainLegend(_ref) {
|
|
|
18477
18482
|
}).join(' ');
|
|
18478
18483
|
return undefined;
|
|
18479
18484
|
};
|
|
18485
|
+
var accordion = classnames$1((_classnames = {}, _defineProperty$1(_classnames, styles$i.accordionMobile, isMobile), _defineProperty$1(_classnames, styles$i.accordionDesktop, !isMobile), _classnames));
|
|
18486
|
+
var content = classnames$1((_classnames2 = {}, _defineProperty$1(_classnames2, styles$i.contentMobile, isMobile), _defineProperty$1(_classnames2, styles$i.content, !isMobile), _classnames2));
|
|
18480
18487
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isOpen && /*#__PURE__*/React__default.createElement("div", {
|
|
18481
|
-
|
|
18488
|
+
style: legendContentStyle,
|
|
18489
|
+
className: content
|
|
18482
18490
|
}, legends), /*#__PURE__*/React__default.createElement("button", {
|
|
18483
|
-
|
|
18491
|
+
style: legendStyle,
|
|
18492
|
+
className: accordion,
|
|
18484
18493
|
onClick: toggle,
|
|
18485
18494
|
role: "widget"
|
|
18486
18495
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -18514,32 +18523,36 @@ function MainLegend(_ref) {
|
|
|
18514
18523
|
}, /*#__PURE__*/React__default.createElement("div", null, "+", defaultLayers.length)))));
|
|
18515
18524
|
}
|
|
18516
18525
|
|
|
18517
|
-
var css_248z$j = ".LayerLegend-module_layerLegendContainer__DLfLy{background:rgba(0,0,0,.65);border-radius:4px;color:var(--white);cursor:pointer;font-weight:500;margin-bottom:2px;user-select:none}.LayerLegend-module_header__8NHIX{align-items:center;display:flex;height:2.5rem;justify-content:space-between;padding:12px;width:100%}.LayerLegend-
|
|
18518
|
-
var styles$h = {"layerLegendContainer":"LayerLegend-module_layerLegendContainer__DLfLy","header":"LayerLegend-module_header__8NHIX","
|
|
18526
|
+
var css_248z$j = ".LayerLegend-module_layerLegendContainer__DLfLy{background:rgba(0,0,0,.65);border-radius:4px;color:var(--white);cursor:pointer;font-weight:500;margin-bottom:2px;max-width:460px;user-select:none}.LayerLegend-module_layerLegendContainer__DLfLy:last-of-type{margin-bottom:0}.LayerLegend-module_header__8NHIX{align-items:center;display:flex;height:2.5rem;justify-content:space-between;padding:12px;width:100%}.LayerLegend-module_desktopHeader__ztHh3{cursor:pointer}.LayerLegend-module_desktopHeader__ztHh3:hover{background:rgba(0,0,0,.9);border-radius:4px;color:var(--white)}.LayerLegend-module_leftInactive__1Lq18{align-items:center;display:flex;font-size:.875rem}.LayerLegend-module_leftActive__KrRDh{font-weight:700}.LayerLegend-module_right__-IwVs{align-items:center;display:flex;font-size:.625rem}.LayerLegend-module_icon__8VwWd{margin-right:8px}.LayerLegend-module_content__ElkbY{cursor:auto;height:auto;padding-bottom:14px;padding-top:8px;width:100%}.LayerLegend-module_items__BC1cp{margin-right:4px}";
|
|
18527
|
+
var styles$h = {"layerLegendContainer":"LayerLegend-module_layerLegendContainer__DLfLy","header":"LayerLegend-module_header__8NHIX","desktopHeader":"LayerLegend-module_desktopHeader__ztHh3 LayerLegend-module_header__8NHIX","mobileHeader":"LayerLegend-module_mobileHeader__qDHmS LayerLegend-module_header__8NHIX","disabledHeader":"LayerLegend-module_disabledHeader__Rd25i LayerLegend-module_header__8NHIX","leftInactive":"LayerLegend-module_leftInactive__1Lq18","leftActive":"LayerLegend-module_leftActive__KrRDh LayerLegend-module_leftInactive__1Lq18","right":"LayerLegend-module_right__-IwVs","icon":"LayerLegend-module_icon__8VwWd","content":"LayerLegend-module_content__ElkbY","items":"LayerLegend-module_items__BC1cp"};
|
|
18519
18528
|
styleInject(css_248z$j);
|
|
18520
18529
|
|
|
18521
18530
|
function LayerLegend(_ref) {
|
|
18522
|
-
var _classnames;
|
|
18531
|
+
var _classnames, _classnames2;
|
|
18523
18532
|
var title = _ref.title,
|
|
18524
18533
|
iconName = _ref.iconName,
|
|
18525
18534
|
itemsCount = _ref.itemsCount,
|
|
18526
18535
|
itemsTitle = _ref.itemsTitle,
|
|
18527
18536
|
children = _ref.children,
|
|
18528
|
-
disabled = _ref.disabled
|
|
18537
|
+
disabled = _ref.disabled,
|
|
18538
|
+
style = _ref.style;
|
|
18529
18539
|
var _useState = useState(false),
|
|
18530
18540
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18531
18541
|
isOpen = _useState2[0],
|
|
18532
18542
|
setIsOpen = _useState2[1];
|
|
18543
|
+
var isMobile = useIsMobile();
|
|
18533
18544
|
var toggle = function toggle() {
|
|
18534
18545
|
setIsOpen(function (isOpen) {
|
|
18535
18546
|
return !isOpen;
|
|
18536
18547
|
});
|
|
18537
18548
|
};
|
|
18538
18549
|
var left = classnames$1((_classnames = {}, _defineProperty$1(_classnames, styles$h.leftActive, isOpen), _defineProperty$1(_classnames, styles$h.leftInactive, !isOpen), _classnames));
|
|
18550
|
+
var header = classnames$1((_classnames2 = {}, _defineProperty$1(_classnames2, styles$h.mobileHeader, isMobile), _defineProperty$1(_classnames2, styles$h.desktopHeader, !isMobile), _classnames2));
|
|
18539
18551
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
18552
|
+
style: style,
|
|
18540
18553
|
className: styles$h.layerLegendContainer
|
|
18541
18554
|
}, /*#__PURE__*/React__default.createElement("button", {
|
|
18542
|
-
className: disabled ? styles$h.disabledHeader :
|
|
18555
|
+
className: disabled ? styles$h.disabledHeader : header,
|
|
18543
18556
|
onClick: toggle,
|
|
18544
18557
|
"aria-expanded": isOpen,
|
|
18545
18558
|
"aria-controls": "legendContent",
|
|
@@ -18552,9 +18565,9 @@ function LayerLegend(_ref) {
|
|
|
18552
18565
|
name: iconName
|
|
18553
18566
|
}), /*#__PURE__*/React__default.createElement("div", null, title)), /*#__PURE__*/React__default.createElement("div", {
|
|
18554
18567
|
className: styles$h.right
|
|
18555
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
18568
|
+
}, !isMobile && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
18556
18569
|
className: styles$h.items
|
|
18557
|
-
}, itemsTitle ? itemsTitle.toUpperCase() : 'ITEMS', ":"), /*#__PURE__*/React__default.createElement("div", null, itemsCount), !disabled && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isOpen ? /*#__PURE__*/React__default.createElement(Icon$1, {
|
|
18570
|
+
}, itemsTitle ? itemsTitle.toUpperCase() : 'ITEMS', ":"), /*#__PURE__*/React__default.createElement("div", null, itemsCount)), !disabled && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isOpen ? /*#__PURE__*/React__default.createElement(Icon$1, {
|
|
18558
18571
|
size: 24,
|
|
18559
18572
|
name: "chevron_up"
|
|
18560
18573
|
}) : /*#__PURE__*/React__default.createElement(Icon$1, {
|