) {
let childItems;
if (items && isOpen) {
@@ -85,29 +138,16 @@ export const EuiSideNavItem = ({
);
+ const renderItemProps: GuaranteedRenderItemProps = {
+ href,
+ onClick,
+ className: buttonClasses,
+ children: buttonContent,
+ };
return (
- {renderItem({
- href,
- onClick,
- className: buttonClasses,
- children: buttonContent,
- ...rest,
- })}
+
{childItems}
);
-};
-
-EuiSideNavItem.propTypes = {
- isOpen: PropTypes.bool,
- isSelected: PropTypes.bool,
- isParent: PropTypes.bool,
- icon: PropTypes.node,
- onClick: PropTypes.func,
- href: PropTypes.string,
- items: PropTypes.node,
- children: PropTypes.node,
- depth: PropTypes.number,
- renderItem: PropTypes.func,
-};
+}
diff --git a/src/components/side_nav/side_nav_types.ts b/src/components/side_nav/side_nav_types.ts
new file mode 100644
index 00000000000..a06de80710c
--- /dev/null
+++ b/src/components/side_nav/side_nav_types.ts
@@ -0,0 +1,42 @@
+import { ReactElement, ReactNode, MouseEventHandler } from 'react';
+
+import { RenderItem } from './side_nav_item';
+
+export interface EuiSideNavItemType {
+ /**
+ * A value that is passed to React as the `key` for this item
+ */
+ id: string | number;
+ /**
+ * If set to true it will force the item to display in an "open" state at all times.
+ */
+ forceOpen?: boolean;
+ /**
+ * Is an optional string to be passed as the navigation item's `href` prop, and by default it will force rendering of the item as an ``.
+ */
+ href?: string;
+ /**
+ * React node which will be rendered as a small icon to the left of the navigation item text.
+ */
+ icon?: ReactElement;
+ /**
+ * If set to true it will render the item in a visible "selected" state, and will force all ancestor navigation items to render in an "open" state.
+ */
+ isSelected?: boolean;
+ /**
+ * Array containing additional item objects, representing nested children of this navigation item.
+ */
+ items?: Array>;
+ /**
+ * React node representing the text to render for this item (usually a string will suffice).
+ */
+ name: ReactNode;
+ /**
+ * Callback function to be passed as the navigation item's `onClick` prop, and by default it will force rendering of the item as a `