@equinor/echo-components 0.5.10 → 0.5.11

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.
@@ -12,6 +12,7 @@ export * from './floatingSearchBar/FloatingSearchBar';
12
12
  export * from './inlineTagIconLink/InlineTagIconLink';
13
13
  export * from './listItem';
14
14
  export * from './listRow/ListRow';
15
+ export * from './rightPanel';
15
16
  export * from './sidebarButton/SidebarButton';
16
17
  export * from './sidesheet';
17
18
  export * from './splitView';
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { PanelSize } from '../../types/menuItem';
3
+ export interface PanelContextState {
4
+ activePanel: string | undefined;
5
+ panelSize: PanelSize;
6
+ updateActivePanel: (newActivePanel: string | undefined) => void;
7
+ updatePanelSize: (newPanelSize: PanelSize) => void;
8
+ }
9
+ /**
10
+ * Panel context with default initialized values
11
+ *
12
+ */
13
+ export declare const PanelContext: React.Context<PanelContextState>;
14
+ /**
15
+ * The panel context wrapper that should be used within Panel component to store the state of the panel
16
+ *
17
+ */
18
+ export declare const PanelContextWrapper: React.FC;
19
+ export default PanelContextWrapper;
@@ -0,0 +1,5 @@
1
+ export * from './menuButton/MenuButton';
2
+ export * from './panel/Panel';
3
+ export * from './panelContent/PanelContent';
4
+ export * from './panelWrapper/PanelWrapper';
5
+ export * from './usePanelContext';
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ interface MenuButtonProps {
3
+ text: string;
4
+ active: boolean;
5
+ onClick: (event?: React.MouseEvent<HTMLButtonElement>) => void;
6
+ children: React.ReactNode;
7
+ refValue?: React.RefObject<HTMLButtonElement>;
8
+ id?: string;
9
+ }
10
+ /**
11
+ * The menu bottom items
12
+ * On desktop it will have an active border on the left,
13
+ * and on mobile the active border will be on the bottom
14
+ * Contains an icon and a descriptive text
15
+ * @param {*} {
16
+ * text, the text below the icon, also displayed on hover
17
+ * active, boolean describing the buttons active state
18
+ * children, the icon to be displayed
19
+ * onClick, the on click event
20
+ * refValue, a reference value in case its needed
21
+ * id: the id of the button in case its needed
22
+ * }
23
+ * @return {*} {JSX.Element}
24
+ */
25
+ declare const MenuButton: React.FC<MenuButtonProps>;
26
+ export default MenuButton;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { MenuItem } from '../../../types/menuItem';
3
+ interface PanelProps {
4
+ menuItems: MenuItem[];
5
+ header: string | React.ReactNode;
6
+ }
7
+ /**
8
+ * The actual right side panel. This component wraps the panel with a panel state
9
+ *
10
+ * @param {PanelProps} {
11
+ * menuItems, the items to be displayed in the menu and its belonging panels
12
+ * header, the header that will be displayed on mobile.
13
+ * If its a string then it will only display a header text. But it can also be a component with self defined html
14
+ * }
15
+ * @return {*} {JSX.Element}
16
+ */
17
+ export declare const Panel: React.FC<PanelProps>;
18
+ export default Panel;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ interface PanelContentProps {
3
+ header: string;
4
+ children: React.ReactNode;
5
+ backToMainPanel?: () => void;
6
+ }
7
+ /**
8
+ * The component that wraps the panel drawer content
9
+ * This components displays a header with close and possible back button
10
+ * It also displays the content wrapped with some css
11
+ *
12
+ * @param {PanelContentProps} {
13
+ * header, the header text to display
14
+ * children, the panels content
15
+ * backToMainPanel: optional parameter that controls whether the panel should have a back button or not
16
+ * to be used in cases where there are panels within panels
17
+ * }
18
+ * @return {*} {JSX.Element}
19
+ */
20
+ export declare const PanelContent: React.FC<PanelContentProps>;
21
+ export default PanelContent;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { MenuItem } from '../../../types/menuItem';
3
+ interface PanelWrapperProps {
4
+ menuItems: MenuItem[];
5
+ header: string | React.ReactNode;
6
+ }
7
+ /**
8
+ * Component that display's the buttons in a panel. It will automatically try to calculate how many buttons to display
9
+ * and how many buttons to hide behind the more menu.
10
+ * It controls which panel to display when a button is clicked
11
+ * On desktop this component will render on the right side, and on the top in mobile view
12
+ *
13
+ * @param {*} {
14
+ * menuItems, the items to be displayed in the menu and its belonging panels
15
+ * header, the header that will be displayed on mobile.
16
+ * If its a string then it will only display a header text. But it can also be a component with self defined html
17
+ * }
18
+ * @return {*} {JSX.Element}
19
+ */
20
+ export declare const PanelWrapper: React.FC<PanelWrapperProps>;
21
+ export default PanelWrapper;
@@ -0,0 +1,8 @@
1
+ import { PanelContextState } from './PanelContextWrapper';
2
+ /**
3
+ * Hook that exposes panel context, if not used within a PanelContext this hook will throw an error
4
+ *
5
+ * @export
6
+ * @return {*} {PanelContextState} Returns the existing panel context or throws error if not used within a PanelContext
7
+ */
8
+ export declare function usePanelContext(): PanelContextState;