@agilant/toga-blox 1.0.319-beta.76 → 1.0.319-beta.78

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,6 +1,5 @@
1
1
  import { ComponentProps, ElementType, ReactNode } from "react";
2
2
  import { PopoverRootProps, ContentProps, NavFooterProps, NavHeadingProps, NavigationItemProps, SideNavContextValue, PopoverTriggerProps, PopoverContentProps, UserProfileProps } from "./types.js";
3
- import { BaseButton } from "../index.js";
4
3
  export declare const SideNav: {
5
4
  Root: ({ children, id }: PopoverRootProps) => import("react/jsx-runtime").JSX.Element;
6
5
  Trigger: ({ className, openIcon, ...props }: ComponentProps<"button"> & {
@@ -33,7 +32,6 @@ export declare const SideNav: {
33
32
  as?: T;
34
33
  className?: string;
35
34
  } & import("react").PropsWithoutRef<ComponentProps<T>>) => import("react/jsx-runtime").JSX.Element;
36
- NavigationItem: ({ children, active, listClassName, prefixIconClassName, prefixIcon, ...props }: NavigationItemProps) => import("react/jsx-runtime").JSX.Element;
37
- NavigationItemLink: ({ className, ...props }: ComponentProps<typeof BaseButton>) => import("react/jsx-runtime").JSX.Element;
35
+ NavigationItem: ({ active, listClassName, btnClassName, prefixIconClassName, prefixIcon, liProps, buttonProps, children, }: NavigationItemProps) => import("react/jsx-runtime").JSX.Element;
38
36
  useSideNavContext: () => SideNavContextValue;
39
37
  };
@@ -36,16 +36,13 @@ const NavHeading = ({ as, className, ...props }) => {
36
36
  const Component = as || "h2";
37
37
  return (_jsx(Component, { className: clsx(classes.navHeading, className), ...props }));
38
38
  };
39
- const NavigationItem = ({ children, active, listClassName, prefixIconClassName, prefixIcon, ...props }) => {
40
- return (_jsxs("li", { className: clsx(classes.navigationItem, active && classes.active, listClassName), ...props, children: [prefixIcon && (_jsx("span", { className: clsx(classes.prefixIcon, prefixIconClassName), children: prefixIcon })), children] }));
41
- };
42
- const NavigationItemLink = ({ className, ...props }) => {
39
+ const NavigationItem = ({ active, listClassName, btnClassName, prefixIconClassName, prefixIcon, liProps, buttonProps, children, }) => {
43
40
  const { close } = useSideNavContext();
44
41
  const handleClick = (e) => {
45
- props.onClick?.(e);
42
+ buttonProps.onClick?.(e);
46
43
  close();
47
44
  };
48
- return (_jsx(BaseButton, { onClick: handleClick, className: clsx(classes.navigationItemLink, className), ...props }));
45
+ return (_jsx("li", { className: clsx(classes.navigationItem, active && classes.active, listClassName), ...liProps, children: _jsxs(BaseButton, { onClick: handleClick, className: clsx(classes.navigationItemLink, btnClassName), ...buttonProps, children: [prefixIcon && (_jsx("span", { className: clsx(classes.prefixIcon, prefixIconClassName), children: prefixIcon })), children] }) }));
49
46
  };
50
47
  // side nav footer components:
51
48
  // create logout context to share an id for the popover api
@@ -101,6 +98,5 @@ export const SideNav = {
101
98
  Navigation,
102
99
  NavigationList,
103
100
  NavigationItem,
104
- NavigationItemLink,
105
101
  useSideNavContext,
106
102
  };
@@ -219,11 +219,12 @@
219
219
 
220
220
  /* link that's next to the icon within each nav item */
221
221
  .navigationItemLink {
222
- width: fit-content;
222
+ width: 100%;
223
223
  height: fit-content;
224
224
  padding: 0;
225
225
  background: transparent;
226
226
  color: inherit;
227
+ place-content: start;
227
228
 
228
229
  &:hover,
229
230
  &:focus,
@@ -1,4 +1,5 @@
1
1
  import { ComponentProps, ComponentPropsWithoutRef, ElementType, ReactNode, RefObject } from 'react';
2
+ import { BaseButton } from '../BaseButton/index.js';
2
3
  type NavHeadingOwnProps = {
3
4
  as?: ElementType;
4
5
  };
@@ -34,11 +35,15 @@ type ContentProps = ComponentProps<'div'> & {
34
35
  closeIconClassName?: string;
35
36
  closeIcon: ReactNode;
36
37
  };
37
- type NavigationItemProps = ComponentProps<'li'> & {
38
+ type NavigationItemProps = {
38
39
  active?: boolean;
39
40
  listClassName?: string;
41
+ btnClassName?: string;
40
42
  prefixIconClassName?: string;
41
- prefixIcon: ReactNode;
43
+ prefixIcon?: ReactNode;
44
+ liProps?: ComponentProps<'li'>;
45
+ buttonProps?: ComponentProps<typeof BaseButton>;
46
+ children: ReactNode;
42
47
  };
43
48
  type SideNavContextValue = {
44
49
  popoverId: string;
@@ -149,7 +149,7 @@
149
149
  flex: 1;
150
150
  display: flex;
151
151
  flex-direction: column;
152
- overflow: hidden;
152
+ height: 100%;
153
153
  }
154
154
 
155
155
  /* Header */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agilant/toga-blox",
3
3
  "private": false,
4
- "version": "1.0.319-beta.76",
4
+ "version": "1.0.319-beta.78",
5
5
  "description": "Toga-Blox is a comprehensive and reusable React component library",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",