@equinor/echo-components 0.7.2 → 0.7.5
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/dist/components/charts/lineChart/LineChart.d.ts +3 -2
- package/dist/components/copyToClipboard/CopyToClipboard.d.ts +3 -0
- package/dist/components/floatingSearchBar/FloatingSearchBar.d.ts +1 -1
- package/dist/hooks/useKeyboardNavigation.d.ts +5 -8
- package/dist/index.js +94 -102
- package/dist/index.js.map +1 -1
- package/dist/types/charts.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
/// <reference types="chart.js" />
|
|
3
|
-
import { ChartData, Defaults } from 'chart.js/auto';
|
|
3
|
+
import Chart, { ChartData, Defaults } from 'chart.js/auto';
|
|
4
4
|
import { ChartCallbacks, LineChartConfig } from '../../../types/charts';
|
|
5
5
|
interface Props {
|
|
6
6
|
initialSize: Chart.ChartSize;
|
|
@@ -15,6 +15,7 @@ interface Props {
|
|
|
15
15
|
callbacks?: ChartCallbacks;
|
|
16
16
|
};
|
|
17
17
|
lineChartConfig?: LineChartConfig;
|
|
18
|
+
onChartInstance?: (chartInstance: Chart | undefined) => void;
|
|
18
19
|
}
|
|
19
|
-
declare function LineChart({ initialSize, chartDataSet, chartTitle, xAxisTitle, yAxisTitle, id, testId, chartConfigs, lineChartConfig }: Props): JSX.Element;
|
|
20
|
+
declare function LineChart({ initialSize, chartDataSet, chartTitle, xAxisTitle, yAxisTitle, id, testId, chartConfigs, lineChartConfig, onChartInstance }: Props): JSX.Element;
|
|
20
21
|
export { LineChart };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface CopyToClipboardProps {
|
|
3
3
|
copyableText: string;
|
|
4
|
+
variant?: 'neutral' | 'warning' | 'error' | 'success';
|
|
5
|
+
multiline?: boolean;
|
|
6
|
+
className?: string;
|
|
4
7
|
}
|
|
5
8
|
declare const CopyToClipboard: (props: CopyToClipboardProps) => JSX.Element;
|
|
6
9
|
export { CopyToClipboard };
|
|
@@ -40,5 +40,5 @@ interface SuggestionGroupProps {
|
|
|
40
40
|
focusedOption: number;
|
|
41
41
|
}
|
|
42
42
|
declare function SuggestionGroup({ suggestionGroup, onClick, focusedOption }: SuggestionGroupProps): JSX.Element;
|
|
43
|
-
export { FloatingSearchBar };
|
|
43
|
+
export { FloatingSearchBar, SuggestionGroup };
|
|
44
44
|
export type { Suggestion };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SuggestionGroup } from '../components';
|
|
1
2
|
export type KeyboardEvents = {
|
|
2
3
|
up?: Function;
|
|
3
4
|
right?: Function;
|
|
@@ -6,16 +7,12 @@ export type KeyboardEvents = {
|
|
|
6
7
|
enter?: Function;
|
|
7
8
|
escape?: Function;
|
|
8
9
|
};
|
|
9
|
-
declare const
|
|
10
|
+
declare const useKeyboardNavigation: (keyboardEvents: KeyboardEvents, listenerTarget?: HTMLElement | Document) => void;
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
* 2. user presses a key (usually down) - scroll list to focused element, which should be first item
|
|
13
|
-
* in the first section. Also set focused section.
|
|
14
|
-
* 3. Potentially jump to last in list if user goes up?
|
|
12
|
+
* Handles keyboard navigation and key events in the floating search bar suggestions.
|
|
15
13
|
*/
|
|
16
|
-
declare const
|
|
14
|
+
declare const useSearchBarSectionNavigator: (sections: SuggestionGroup[], initialSelected: number, keyboardEvents: KeyboardEvents, listenerTarget?: HTMLElement | Document) => {
|
|
17
15
|
focusedSection: number;
|
|
18
16
|
focusedOption: number;
|
|
19
17
|
};
|
|
20
|
-
|
|
21
|
-
export { useListNavigator, useSectionNavigator, useKeyboardNavigation };
|
|
18
|
+
export { useSearchBarSectionNavigator, useKeyboardNavigation };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { useState, useEffect, useRef, createElement, Component,
|
|
2
|
+
import React__default, { useState, useEffect, useRef, useCallback, createElement, Component, PureComponent, useLayoutEffect, useMemo, createContext as createContext$1, useContext, forwardRef, isValidElement, cloneElement, useDebugValue } from 'react';
|
|
3
3
|
import { Icon as Icon$1, Button, DotProgress, Banner, CircularProgress, Typography, TextField, Dialog, Search, Tooltip as Tooltip$2, Radio, Slider, Menu, Autocomplete } from '@equinor/eds-core-react';
|
|
4
4
|
import * as ReactDOM from 'react-dom';
|
|
5
5
|
import ReactDOM__default, { findDOMNode, createPortal } from 'react-dom';
|
|
@@ -15341,43 +15341,56 @@ function LineChart(_ref) {
|
|
|
15341
15341
|
testId = _ref$testId === void 0 ? 'em-line-chart' : _ref$testId,
|
|
15342
15342
|
_ref$chartConfigs = _ref.chartConfigs,
|
|
15343
15343
|
chartConfigs = _ref$chartConfigs === void 0 ? {} : _ref$chartConfigs,
|
|
15344
|
-
lineChartConfig = _ref.lineChartConfig
|
|
15344
|
+
lineChartConfig = _ref.lineChartConfig,
|
|
15345
|
+
onChartInstance = _ref.onChartInstance;
|
|
15345
15346
|
var height = initialSize.height,
|
|
15346
15347
|
width = initialSize.width;
|
|
15347
15348
|
var defaults = chartConfigs.defaults,
|
|
15348
15349
|
callbacks = chartConfigs.callbacks;
|
|
15349
|
-
var
|
|
15350
|
+
var canvasRef = useRef(null);
|
|
15351
|
+
var chartInstanceRef = useRef(undefined);
|
|
15352
|
+
var initChartDefaults = useCallback(function () {
|
|
15350
15353
|
var _a, _b, _c, _d, _e;
|
|
15351
15354
|
Chart.defaults.font.size = ((_a = defaults === null || defaults === void 0 ? void 0 : defaults.font) === null || _a === void 0 ? void 0 : _a.size) || 12;
|
|
15352
15355
|
Chart.defaults.font.family = ((_b = defaults === null || defaults === void 0 ? void 0 : defaults.font) === null || _b === void 0 ? void 0 : _b.family) || 'Equinor';
|
|
15353
15356
|
Chart.defaults.interaction.mode = ((_c = defaults === null || defaults === void 0 ? void 0 : defaults.interaction) === null || _c === void 0 ? void 0 : _c.mode) || 'nearest'; // popup
|
|
15354
15357
|
Chart.defaults.elements.point.pointStyle = ((_e = (_d = defaults === null || defaults === void 0 ? void 0 : defaults.elements) === null || _d === void 0 ? void 0 : _d.point) === null || _e === void 0 ? void 0 : _e.pointStyle) || false;
|
|
15355
|
-
};
|
|
15356
|
-
var
|
|
15357
|
-
var _useState = useState(undefined),
|
|
15358
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
15359
|
-
chartInstance = _useState2[0],
|
|
15360
|
-
setChartInstance = _useState2[1];
|
|
15361
|
-
useEffect(function () {
|
|
15362
|
-
var canvas = canvasRef.current;
|
|
15363
|
-
if (chartInstance || !canvas) return;
|
|
15358
|
+
}, [defaults]);
|
|
15359
|
+
var setupChartConfig = useCallback(function () {
|
|
15364
15360
|
initChartDefaults();
|
|
15365
|
-
var
|
|
15366
|
-
if (lineChartConfig)
|
|
15361
|
+
var config;
|
|
15362
|
+
if (lineChartConfig) config = lineChartConfig;else if (chartDataSet) {
|
|
15367
15363
|
var options = {
|
|
15368
15364
|
dataConfig: chartDataSet,
|
|
15369
15365
|
chartTitle: chartTitle,
|
|
15370
15366
|
xAxisTitle: xAxisTitle,
|
|
15371
15367
|
yAxisTitle: yAxisTitle,
|
|
15372
|
-
|
|
15368
|
+
chartCallbacks: callbacks
|
|
15373
15369
|
};
|
|
15374
|
-
|
|
15370
|
+
config = generateChartConfig(options);
|
|
15375
15371
|
} else {
|
|
15376
15372
|
throw new Error('Neither chartDataSet nor lineChartConfig were provided!');
|
|
15377
15373
|
}
|
|
15374
|
+
return config;
|
|
15375
|
+
}, [callbacks, chartDataSet, chartTitle, initChartDefaults, lineChartConfig, xAxisTitle, yAxisTitle]);
|
|
15376
|
+
useEffect(function () {
|
|
15377
|
+
var canvas = canvasRef.current;
|
|
15378
|
+
var chartInstance = chartInstanceRef.current;
|
|
15379
|
+
if (!canvas) return;
|
|
15380
|
+
if (chartInstance) chartInstance.destroy();
|
|
15381
|
+
var chartConfig = setupChartConfig();
|
|
15378
15382
|
var lineChart = new Chart(canvas, chartConfig);
|
|
15379
|
-
|
|
15380
|
-
|
|
15383
|
+
onChartInstance === null || onChartInstance === void 0 ? void 0 : onChartInstance(lineChart);
|
|
15384
|
+
chartInstanceRef.current = lineChart;
|
|
15385
|
+
var cleanup = function cleanup() {
|
|
15386
|
+
var chartInstance = chartInstanceRef.current;
|
|
15387
|
+
if (chartInstance) {
|
|
15388
|
+
chartInstance.destroy();
|
|
15389
|
+
chartInstanceRef.current = undefined;
|
|
15390
|
+
}
|
|
15391
|
+
};
|
|
15392
|
+
return cleanup;
|
|
15393
|
+
}, [callbacks, chartDataSet, chartTitle, initChartDefaults, lineChartConfig, onChartInstance, setupChartConfig, xAxisTitle, yAxisTitle]);
|
|
15381
15394
|
return /*#__PURE__*/React__default.createElement("canvas", {
|
|
15382
15395
|
id: id,
|
|
15383
15396
|
ref: canvasRef,
|
|
@@ -15959,16 +15972,24 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
15959
15972
|
});
|
|
15960
15973
|
}
|
|
15961
15974
|
|
|
15962
|
-
var css_248z$x = ".CopyToClipboard-module_copyToClipboardContainer__xA1rT{cursor:pointer;display:flex;gap:.5rem}.CopyToClipboard-module_readonlyInput__rfIQF{border-bottom:1px solid
|
|
15975
|
+
var css_248z$x = ".CopyToClipboard-module_copyToClipboardContainer__xA1rT{color:#3d3d3d!important;cursor:pointer;display:flex;gap:.5rem;height:36px;min-width:100px}.CopyToClipboard-module_copyToClipboardContainer__xA1rT[aria-label=warning]{background-color:#ffe7d6!important}.CopyToClipboard-module_copyToClipboardContainer__xA1rT[aria-label=error]{background-color:#ffc1c1!important}.CopyToClipboard-module_copyToClipboardContainer__xA1rT[aria-label=success]{background-color:#e6faec!important}.CopyToClipboard-module_copyToClipboardContainer__xA1rT[aria-label$=-multiline]{align-items:center;height:unset}.CopyToClipboard-module_copyToClipboardContainer__xA1rT[aria-label$=warning-multiline]{background-color:#ffe7d6!important}.CopyToClipboard-module_copyToClipboardContainer__xA1rT[aria-label$=error-multiline]{background-color:#ffc1c1!important}.CopyToClipboard-module_copyToClipboardContainer__xA1rT[aria-label$=success-multiline]{background-color:#e6faec}.CopyToClipboard-module_readonlyInput__rfIQF{background-color:#dcdcdc!important;border-bottom:1px solid #dcdcdc;cursor:pointer;min-width:100px;pointer-events:none}.CopyToClipboard-module_readonlyInput__rfIQF>div>textarea{overflow-y:hidden}.CopyToClipboard-module_textFieldSelector__0PJ8S{flex-grow:3}.CopyToClipboard-module_copyButton__XdBoF{width:100px}.CopyToClipboard-module_copyButton__XdBoF[aria-label=error-button],.CopyToClipboard-module_copyButton__XdBoF[aria-label=success-button],.CopyToClipboard-module_copyButton__XdBoF[aria-label=warning-button]{background-color:inherit;border:1px solid #3d3d3d!important;color:#3d3d3d!important}.CopyToClipboard-module_copyButton__XdBoF[aria-pressed=true]>*{border-color:var(--toggleActive);font-size:.7rem}";
|
|
15963
15976
|
var styles$o = {"copyToClipboardContainer":"CopyToClipboard-module_copyToClipboardContainer__xA1rT","readonlyInput":"CopyToClipboard-module_readonlyInput__rfIQF","textFieldSelector":"CopyToClipboard-module_textFieldSelector__0PJ8S","copyButton":"CopyToClipboard-module_copyButton__XdBoF"};
|
|
15964
15977
|
styleInject(css_248z$x);
|
|
15965
15978
|
|
|
15966
15979
|
var CopyToClipboard = function CopyToClipboard(props) {
|
|
15967
15980
|
var _a;
|
|
15981
|
+
if (!props.variant) props.variant = 'neutral';
|
|
15968
15982
|
var _useState = useState(false),
|
|
15969
15983
|
_useState2 = _slicedToArray(_useState, 2),
|
|
15970
15984
|
textIsCopied = _useState2[0],
|
|
15971
15985
|
setTextIsCopied = _useState2[1];
|
|
15986
|
+
var edsRef = useRef(null);
|
|
15987
|
+
useEffect(function autosizeTextarea() {
|
|
15988
|
+
if (props.multiline && edsRef.current instanceof HTMLTextAreaElement) {
|
|
15989
|
+
var textarea = edsRef.current.querySelector('textarea');
|
|
15990
|
+
if (textarea) textarea.style.height = String(textarea.scrollHeight) + 'px';
|
|
15991
|
+
}
|
|
15992
|
+
}, [edsRef, props.multiline]);
|
|
15972
15993
|
function handleClipboard(copyableText) {
|
|
15973
15994
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
|
|
15974
15995
|
return regenerator.wrap(function _callee$(_context) {
|
|
@@ -15981,6 +16002,7 @@ var CopyToClipboard = function CopyToClipboard(props) {
|
|
|
15981
16002
|
_context.next = 3;
|
|
15982
16003
|
return navigator.clipboard.writeText(copyableText);
|
|
15983
16004
|
case 3:
|
|
16005
|
+
// This delay will reset the button label after a short period.
|
|
15984
16006
|
setTimeout(function () {
|
|
15985
16007
|
return setTextIsCopied(false);
|
|
15986
16008
|
}, 2000);
|
|
@@ -15992,10 +16014,12 @@ var CopyToClipboard = function CopyToClipboard(props) {
|
|
|
15992
16014
|
}, _callee);
|
|
15993
16015
|
}));
|
|
15994
16016
|
}
|
|
15995
|
-
/** Handles the operation to highlight the text inside an input element while it is disabled. */
|
|
15996
|
-
function handleReadonlySelect(
|
|
15997
|
-
|
|
15998
|
-
|
|
16017
|
+
/** Handles the operation to highlight the text inside an input or textarea element while it is disabled. */
|
|
16018
|
+
function handleReadonlySelect() {
|
|
16019
|
+
if (!edsRef.current) return undefined;
|
|
16020
|
+
var edsInput;
|
|
16021
|
+
if (props.multiline) edsInput = edsRef.current.querySelector('textarea');else edsInput = edsRef.current.querySelector('input');
|
|
16022
|
+
if (edsInput instanceof HTMLInputElement || edsInput instanceof HTMLTextAreaElement) {
|
|
15999
16023
|
edsInput.disabled = false;
|
|
16000
16024
|
edsInput.focus();
|
|
16001
16025
|
edsInput.select();
|
|
@@ -16003,18 +16027,22 @@ var CopyToClipboard = function CopyToClipboard(props) {
|
|
|
16003
16027
|
}
|
|
16004
16028
|
}
|
|
16005
16029
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
16006
|
-
className: styles$o.copyToClipboardContainer
|
|
16030
|
+
className: styles$o.copyToClipboardContainer,
|
|
16031
|
+
"aria-label": props.multiline ? "".concat(props.variant, "-multiline") : props.variant
|
|
16007
16032
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
16008
16033
|
className: styles$o.textFieldSelector,
|
|
16009
|
-
onClick: function onClick(
|
|
16010
|
-
return handleReadonlySelect(
|
|
16034
|
+
onClick: function onClick() {
|
|
16035
|
+
return handleReadonlySelect();
|
|
16011
16036
|
}
|
|
16012
16037
|
}, /*#__PURE__*/React__default.createElement(TextField, {
|
|
16038
|
+
ref: edsRef,
|
|
16013
16039
|
className: styles$o.readonlyInput,
|
|
16014
16040
|
id: "copy-".concat((_a = props.copyableText) === null || _a === void 0 ? void 0 : _a.substring(0, 8)),
|
|
16015
16041
|
value: props.copyableText,
|
|
16016
|
-
disabled: true
|
|
16042
|
+
disabled: true,
|
|
16043
|
+
multiline: props.multiline
|
|
16017
16044
|
})), /*#__PURE__*/React__default.createElement(Button, {
|
|
16045
|
+
"aria-label": "".concat(props.variant, "-button"),
|
|
16018
16046
|
className: styles$o.copyButton,
|
|
16019
16047
|
variant: "outlined",
|
|
16020
16048
|
onClick: function onClick() {
|
|
@@ -32715,55 +32743,30 @@ var Keys = {
|
|
|
32715
32743
|
Enter: 'enter',
|
|
32716
32744
|
Escape: 'escape'
|
|
32717
32745
|
};
|
|
32718
|
-
var
|
|
32719
|
-
var
|
|
32720
|
-
var
|
|
32721
|
-
|
|
32722
|
-
|
|
32723
|
-
|
|
32724
|
-
|
|
32725
|
-
setCurrIndex = _useState2[1];
|
|
32726
|
-
var downHandler = useCallback(function (e) {
|
|
32727
|
-
setCurrIndex(function (c) {
|
|
32728
|
-
return c < listLength - 1 ? c + 1 : listLength - 1;
|
|
32729
|
-
});
|
|
32730
|
-
}, [listLength]);
|
|
32731
|
-
var upHandler = useCallback(function (e) {
|
|
32732
|
-
setCurrIndex(function (c) {
|
|
32733
|
-
return c < 0 ? -1 : c - 1;
|
|
32734
|
-
});
|
|
32735
|
-
}, [listLength]);
|
|
32736
|
-
var enter = useCallback(function () {
|
|
32737
|
-
if (keyboardEvents === null || keyboardEvents === void 0 ? void 0 : keyboardEvents.enter) {
|
|
32738
|
-
if (currIndex === -1) {
|
|
32739
|
-
return;
|
|
32740
|
-
}
|
|
32741
|
-
keyboardEvents.enter(currIndex);
|
|
32746
|
+
var useKeyboardNavigation = function useKeyboardNavigation(keyboardEvents) {
|
|
32747
|
+
var listenerTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
|
|
32748
|
+
var handleKeyDown = useCallback(function (e) {
|
|
32749
|
+
var key = Keys[e.key];
|
|
32750
|
+
var handler = keyboardEvents[key];
|
|
32751
|
+
if (handler) {
|
|
32752
|
+
handler(e);
|
|
32742
32753
|
}
|
|
32743
|
-
}, [
|
|
32744
|
-
|
|
32745
|
-
up: upHandler,
|
|
32746
|
-
down: downHandler,
|
|
32747
|
-
enter: enter
|
|
32748
|
-
}, listenerTarget);
|
|
32749
|
-
return currIndex;
|
|
32754
|
+
}, [keyboardEvents]);
|
|
32755
|
+
useEventListener('keydown', handleKeyDown, false, listenerTarget);
|
|
32750
32756
|
};
|
|
32751
32757
|
/**
|
|
32752
|
-
*
|
|
32753
|
-
* 2. user presses a key (usually down) - scroll list to focused element, which should be first item
|
|
32754
|
-
* in the first section. Also set focused section.
|
|
32755
|
-
* 3. Potentially jump to last in list if user goes up?
|
|
32758
|
+
* Handles keyboard navigation and key events in the floating search bar suggestions.
|
|
32756
32759
|
*/
|
|
32757
|
-
var
|
|
32760
|
+
var useSearchBarSectionNavigator = function useSearchBarSectionNavigator(sections, initialSelected, keyboardEvents) {
|
|
32758
32761
|
var listenerTarget = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document;
|
|
32762
|
+
var _useState = useState(initialSelected),
|
|
32763
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32764
|
+
focusedSection = _useState2[0],
|
|
32765
|
+
setFocusedSection = _useState2[1];
|
|
32759
32766
|
var _useState3 = useState(initialSelected),
|
|
32760
32767
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
32761
|
-
|
|
32762
|
-
|
|
32763
|
-
var _useState5 = useState(initialSelected),
|
|
32764
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
32765
|
-
focusedOption = _useState6[0],
|
|
32766
|
-
setFocusedOption = _useState6[1];
|
|
32768
|
+
focusedOption = _useState4[0],
|
|
32769
|
+
setFocusedOption = _useState4[1];
|
|
32767
32770
|
var up = useCallback(function () {
|
|
32768
32771
|
var nextSection = focusedSection;
|
|
32769
32772
|
var nextOption = focusedOption;
|
|
@@ -32841,17 +32844,6 @@ var useSectionNavigator = function useSectionNavigator(sections, initialSelected
|
|
|
32841
32844
|
focusedOption: focusedOption
|
|
32842
32845
|
};
|
|
32843
32846
|
};
|
|
32844
|
-
var useKeyboardNavigation = function useKeyboardNavigation(keyboardEvents) {
|
|
32845
|
-
var listenerTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
|
|
32846
|
-
var handleKeyDown = useCallback(function (e) {
|
|
32847
|
-
var key = Keys[e.key];
|
|
32848
|
-
var handler = keyboardEvents[key];
|
|
32849
|
-
if (handler) {
|
|
32850
|
-
handler(e);
|
|
32851
|
-
}
|
|
32852
|
-
}, [keyboardEvents]);
|
|
32853
|
-
useEventListener('keydown', handleKeyDown, false, listenerTarget);
|
|
32854
|
-
};
|
|
32855
32847
|
|
|
32856
32848
|
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)}";
|
|
32857
32849
|
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"};
|
|
@@ -32884,13 +32876,14 @@ var FloatingSearchBar = function FloatingSearchBar(_ref) {
|
|
|
32884
32876
|
setIsOpen(true);
|
|
32885
32877
|
};
|
|
32886
32878
|
var closeMenu = function closeMenu() {
|
|
32887
|
-
if (isOpen)
|
|
32888
|
-
setIsOpen(false);
|
|
32889
|
-
}
|
|
32879
|
+
if (isOpen) setIsOpen(false);
|
|
32890
32880
|
};
|
|
32891
32881
|
EchoUtils.Hooks.useOnOutsideClick(closeMenu, {
|
|
32892
32882
|
refs: [containerRef]
|
|
32893
32883
|
});
|
|
32884
|
+
useKeyboardNavigation({
|
|
32885
|
+
escape: closeMenu
|
|
32886
|
+
});
|
|
32894
32887
|
function onClick(suggestion) {
|
|
32895
32888
|
setValue(suggestion.label);
|
|
32896
32889
|
closeMenu();
|
|
@@ -32900,9 +32893,7 @@ var FloatingSearchBar = function FloatingSearchBar(_ref) {
|
|
|
32900
32893
|
ref: containerRef,
|
|
32901
32894
|
className: style$2.searchbarWrapper,
|
|
32902
32895
|
onFocus: function onFocus() {
|
|
32903
|
-
|
|
32904
|
-
openMenu();
|
|
32905
|
-
}
|
|
32896
|
+
return value && openMenu();
|
|
32906
32897
|
},
|
|
32907
32898
|
autoComplete: 'off',
|
|
32908
32899
|
onSubmit: function onSubmit(e) {
|
|
@@ -32916,14 +32907,12 @@ var FloatingSearchBar = function FloatingSearchBar(_ref) {
|
|
|
32916
32907
|
"aria-haspopup": "true",
|
|
32917
32908
|
className: style$2.searchbar,
|
|
32918
32909
|
onChange: function onChange(e) {
|
|
32910
|
+
//TODO: Prevent up and down arrow keys from moving the cursor back and forth.
|
|
32911
|
+
// It appears EDS swallows the Up and Down arrow events.
|
|
32919
32912
|
var val = e.target.value;
|
|
32920
32913
|
setValue(val);
|
|
32921
32914
|
onSearchQueryChange(val);
|
|
32922
|
-
if (val === '')
|
|
32923
|
-
closeMenu();
|
|
32924
|
-
} else if (!isOpen) {
|
|
32925
|
-
openMenu();
|
|
32926
|
-
}
|
|
32915
|
+
if (val === '') closeMenu();else if (!isOpen) openMenu();
|
|
32927
32916
|
},
|
|
32928
32917
|
value: value
|
|
32929
32918
|
}), isOpen && /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -32946,15 +32935,15 @@ function SearchSuggestions(_ref2) {
|
|
|
32946
32935
|
var suggestionGroups = _ref2.suggestionGroups,
|
|
32947
32936
|
containerRef = _ref2.containerRef,
|
|
32948
32937
|
onClick = _ref2.onClick;
|
|
32949
|
-
var
|
|
32938
|
+
var _useSearchBarSectionN = useSearchBarSectionNavigator(suggestionGroups, 0, {
|
|
32950
32939
|
enter: function enter() {
|
|
32951
32940
|
var section = suggestionGroups[focusedSection];
|
|
32952
32941
|
var option = section.options[focusedOption];
|
|
32953
32942
|
onClick(option);
|
|
32954
32943
|
}
|
|
32955
32944
|
}, containerRef !== null && containerRef !== void 0 ? containerRef : undefined),
|
|
32956
|
-
focusedSection =
|
|
32957
|
-
focusedOption =
|
|
32945
|
+
focusedSection = _useSearchBarSectionN.focusedSection,
|
|
32946
|
+
focusedOption = _useSearchBarSectionN.focusedOption;
|
|
32958
32947
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, suggestionGroups.map(function (suggestionGroup, index) {
|
|
32959
32948
|
return /*#__PURE__*/React__default.createElement(SuggestionGroup, {
|
|
32960
32949
|
suggestionGroup: suggestionGroup,
|
|
@@ -33216,7 +33205,7 @@ function LayerLegend(_ref) {
|
|
|
33216
33205
|
}, children));
|
|
33217
33206
|
}
|
|
33218
33207
|
|
|
33219
|
-
var css_248z$i = ".listItem-module_flexContainer__coznC{display:flex;flex-flow:row nowrap;justify-content:flex-start}.listItem-module_container__sivKu{align-items:center;box-sizing:border-box;gap:.5rem;
|
|
33208
|
+
var css_248z$i = ".listItem-module_flexContainer__coznC{display:flex;flex-flow:row nowrap;justify-content:flex-start}.listItem-module_container__sivKu{align-items:center;box-sizing:border-box;gap:.5rem;padding:.625rem 1rem}.listItem-module_listItemContainer__MtMLQ{border-bottom:1px solid var(--default)}.listItem-module_hoverItem__bPUhP:first-child{border-top:1px solid var(--default)}.listItem-module_hoverItem__bPUhP:hover{background-color:var(--equiGray5);cursor:pointer}.listItem-module_infoContainer__V0R7i{align-items:center;display:grid;flex-grow:1;gap:.2rem;grid-template-columns:1fr}.listItem-module_icon__lHCt6{align-items:center;border-radius:50%;display:flex;flex-direction:column;justify-content:center;padding:.5rem;width:max-content}";
|
|
33220
33209
|
var styles$g = {"flexContainer":"listItem-module_flexContainer__coznC","container":"listItem-module_container__sivKu listItem-module_flexContainer__coznC","listItemContainer":"listItem-module_listItemContainer__MtMLQ listItem-module_container__sivKu listItem-module_flexContainer__coznC","hoverItem":"listItem-module_hoverItem__bPUhP","infoContainer":"listItem-module_infoContainer__V0R7i","icon":"listItem-module_icon__lHCt6"};
|
|
33221
33210
|
styleInject(css_248z$i);
|
|
33222
33211
|
|
|
@@ -33238,8 +33227,7 @@ function ListItem(props) {
|
|
|
33238
33227
|
}, props.listAction, props.visual, props.icon && /*#__PURE__*/React__default.createElement("div", {
|
|
33239
33228
|
className: styles$g.icon,
|
|
33240
33229
|
style: {
|
|
33241
|
-
backgroundColor: props.icon.backgroundColor
|
|
33242
|
-
margin: props.icon.backgroundColor ? '0.5rem 0' : ''
|
|
33230
|
+
backgroundColor: props.icon.backgroundColor
|
|
33243
33231
|
}
|
|
33244
33232
|
}, /*#__PURE__*/React__default.createElement(Icon$1, {
|
|
33245
33233
|
name: props.icon.name,
|
|
@@ -39417,7 +39405,8 @@ function SheetTopArea(_ref) {
|
|
|
39417
39405
|
onOrientationChange: onOrientationChange
|
|
39418
39406
|
}), closeSheet && /*#__PURE__*/React__default.createElement(Button, {
|
|
39419
39407
|
variant: "ghost_icon",
|
|
39420
|
-
onClick: closeSheet
|
|
39408
|
+
onClick: closeSheet,
|
|
39409
|
+
"aria-label": "Close"
|
|
39421
39410
|
}, /*#__PURE__*/React__default.createElement(Icon$1, {
|
|
39422
39411
|
name: "close",
|
|
39423
39412
|
color: "var(--asBuilt)"
|
|
@@ -39442,7 +39431,8 @@ function SheetOrientationActions(_ref2) {
|
|
|
39442
39431
|
variant: "ghost_icon",
|
|
39443
39432
|
onClick: function onClick() {
|
|
39444
39433
|
return handleChange(SideSheetOrientation.Vertical);
|
|
39445
|
-
}
|
|
39434
|
+
},
|
|
39435
|
+
"aria-label": "Set sheet orientation Vertical"
|
|
39446
39436
|
}, /*#__PURE__*/React__default.createElement(Icon$1, {
|
|
39447
39437
|
name: "sheet_leftposition",
|
|
39448
39438
|
color: calculateColor(SideSheetOrientation.Vertical)
|
|
@@ -39450,7 +39440,8 @@ function SheetOrientationActions(_ref2) {
|
|
|
39450
39440
|
variant: "ghost_icon",
|
|
39451
39441
|
onClick: function onClick() {
|
|
39452
39442
|
return handleChange(SideSheetOrientation.Horizontal);
|
|
39453
|
-
}
|
|
39443
|
+
},
|
|
39444
|
+
"aria-label": "Set sheet orientation Horizontal"
|
|
39454
39445
|
}, /*#__PURE__*/React__default.createElement(Icon$1, {
|
|
39455
39446
|
name: "sheet_bottom_position",
|
|
39456
39447
|
color: calculateColor(SideSheetOrientation.Horizontal)
|
|
@@ -39458,7 +39449,8 @@ function SheetOrientationActions(_ref2) {
|
|
|
39458
39449
|
variant: "ghost_icon",
|
|
39459
39450
|
onClick: function onClick() {
|
|
39460
39451
|
return handleChange(SideSheetOrientation.Fullscreen);
|
|
39461
|
-
}
|
|
39452
|
+
},
|
|
39453
|
+
"aria-label": "Set sheet orientation Fullscreen"
|
|
39462
39454
|
}, /*#__PURE__*/React__default.createElement(Icon$1, {
|
|
39463
39455
|
name: "fullscreen",
|
|
39464
39456
|
color: calculateColor(SideSheetOrientation.Fullscreen)
|
|
@@ -40202,5 +40194,5 @@ var OptionsList = function OptionsList(_ref) {
|
|
|
40202
40194
|
}));
|
|
40203
40195
|
};
|
|
40204
40196
|
|
|
40205
|
-
export { BlackLink, ButtonWithPopover, ContextMenu, CopyToClipboard, DataInfoButton, DialogGenerator, DraggableItemsWrapper, Dropdown, EchoBottomBar, EchoCard, EchoHeader, EchoTooltip, FloatingActionButton, FloatingSearchBar, Icon, IconList, InlineTagIconLink, LayerLegend, LineChart, LinkCard, ListItem, ListRow, MainLegend, MenuButton, OptionsList, Panel, PanelContent, PanelContentWrapper, PanelWrapper, RadioButtonGroup, ReactDatePicker, RoundIconButton, RoundIconButtonVariants, SideSheet, SideSheetOrientation, SidebarButton, SliderField, SplitView, TagCategoryIcon, TagCategoryType, TagContextMenu, TagIcon, TagIconShadowWrapper, TextIconButton, TimePicker, WorkOrderListItem, classnames$3 as classnames, echoIcons, getIcon, map_legend_info, notifications_m1, notifications_m2, notifications_m3, notifications_m4, notifications_m5, notifications_m6, notifications_m9, notifications_main_group, punches_main_group, punches_pa, punches_pb, robim_external_ald, robim_external_iwit, robim_external_methane_sensor, robim_external_satellite, robim_external_timp, robim_external_timp_text, themeConst, useIsMobile, useKeyboardNavigation,
|
|
40197
|
+
export { BlackLink, ButtonWithPopover, ContextMenu, CopyToClipboard, DataInfoButton, DialogGenerator, DraggableItemsWrapper, Dropdown, EchoBottomBar, EchoCard, EchoHeader, EchoTooltip, FloatingActionButton, FloatingSearchBar, Icon, IconList, InlineTagIconLink, LayerLegend, LineChart, LinkCard, ListItem, ListRow, MainLegend, MenuButton, OptionsList, Panel, PanelContent, PanelContentWrapper, PanelWrapper, RadioButtonGroup, ReactDatePicker, RoundIconButton, RoundIconButtonVariants, SideSheet, SideSheetOrientation, SidebarButton, SliderField, SplitView, SuggestionGroup, TagCategoryIcon, TagCategoryType, TagContextMenu, TagIcon, TagIconShadowWrapper, TextIconButton, TimePicker, WorkOrderListItem, classnames$3 as classnames, echoIcons, getIcon, map_legend_info, notifications_m1, notifications_m2, notifications_m3, notifications_m4, notifications_m5, notifications_m6, notifications_m9, notifications_main_group, punches_main_group, punches_pa, punches_pb, robim_external_ald, robim_external_iwit, robim_external_methane_sensor, robim_external_satellite, robim_external_timp, robim_external_timp_text, themeConst, useIsMobile, useKeyboardNavigation, usePanelStore, useSearchBarSectionNavigator, workorders_main_group, workorders_pm01, workorders_pm02, workorders_pm03, workorders_pm04, workorders_pm05, workorders_pm06, workorders_pm10, workorders_pm15, workorders_pm20 };
|
|
40206
40198
|
//# sourceMappingURL=index.js.map
|