@equinor/echo-components 0.7.3 → 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.
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export interface CopyToClipboardProps {
3
3
  copyableText: string;
4
- variant?: 'neutral' | 'warning' | 'error';
4
+ variant?: 'neutral' | 'warning' | 'error' | 'success';
5
5
  multiline?: boolean;
6
6
  className?: string;
7
7
  }
@@ -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 useListNavigator: (listLength: number, initialIndex?: number, keyboardEvents?: KeyboardEvents, listenerTarget?: Document | HTMLElement) => number;
10
+ declare const useKeyboardNavigation: (keyboardEvents: KeyboardEvents, listenerTarget?: HTMLElement | Document) => void;
10
11
  /**
11
- * 1. On open: focus should be undefined/inactive. (list should scroll/show selected item if any).
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 useSectionNavigator: (sections: any[], initialSelected: number, keyboardEvents: KeyboardEvents, listenerTarget?: HTMLElement | Document) => {
14
+ declare const useSearchBarSectionNavigator: (sections: SuggestionGroup[], initialSelected: number, keyboardEvents: KeyboardEvents, listenerTarget?: HTMLElement | Document) => {
17
15
  focusedSection: number;
18
16
  focusedOption: number;
19
17
  };
20
- declare const useKeyboardNavigation: (keyboardEvents: KeyboardEvents, listenerTarget?: HTMLElement | Document) => void;
21
- export { useListNavigator, useSectionNavigator, useKeyboardNavigation };
18
+ export { useSearchBarSectionNavigator, useKeyboardNavigation };