@pantheon-systems/pds-toolkit-react 1.0.0-dev.267 → 1.0.0-dev.268

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,4 +1,4 @@
1
- import React, { ComponentPropsWithoutRef } from 'react';
1
+ import React, { ComponentPropsWithoutRef, ReactElement } from 'react';
2
2
  import { NavigationItem } from '@components/navigation/navigation-types';
3
3
  import './dropdown-menu.css';
4
4
  /**
@@ -8,7 +8,7 @@ export interface DropdownMenuProps extends ComponentPropsWithoutRef<'div'> {
8
8
  /**
9
9
  * Heading text. If a string is passed, it will be rendered as a heading. If a link is passed, it will be rendered as a link.
10
10
  */
11
- headingText?: string | JSX.Element;
11
+ headingText?: string | ReactElement;
12
12
  /**
13
13
  * Menu items to render.
14
14
  */
@@ -1,4 +1,4 @@
1
- import React, { ComponentPropsWithoutRef } from 'react';
1
+ import React, { ComponentPropsWithoutRef, ReactElement } from 'react';
2
2
  import { NavigationItem } from '@components/navigation/navigation-types';
3
3
  import './side-nav.css';
4
4
  /**
@@ -16,7 +16,7 @@ export interface SideNavProps extends ComponentPropsWithoutRef<'nav'> {
16
16
  /**
17
17
  * Heading text. If a link is passed, it will be rendered as a link.
18
18
  */
19
- headingText?: string | JSX.Element;
19
+ headingText?: string | ReactElement;
20
20
  /**
21
21
  * Labels for translatable strings.
22
22
  */
@@ -1,6 +1,12 @@
1
- import React, { ComponentPropsWithoutRef } from 'react';
1
+ import React, { ComponentPropsWithoutRef, ReactElement } from 'react';
2
2
  import { NavigationItem } from '@components/navigation/navigation-types';
3
3
  import './side-nav-compact.css';
4
+ export type SideNavCompactItem = NavigationItem & {
5
+ /**
6
+ * A boolean indicating whether the item is a submenu.
7
+ */
8
+ path?: string;
9
+ };
4
10
  /**
5
11
  * Prop types for SideNavCompact
6
12
  */
@@ -16,7 +22,7 @@ export interface SideNavCompactProps extends ComponentPropsWithoutRef<'nav'> {
16
22
  /**
17
23
  * Heading text. If a link is passed, it will be rendered as a link.
18
24
  */
19
- headingText?: string | JSX.Element;
25
+ headingText?: string | ReactElement;
20
26
  /**
21
27
  * Labels for translatable strings.
22
28
  */
@@ -27,7 +33,7 @@ export interface SideNavCompactProps extends ComponentPropsWithoutRef<'nav'> {
27
33
  /**
28
34
  * Menu items to render.
29
35
  */
30
- menuItems: NavigationItem[];
36
+ menuItems: SideNavCompactItem[];
31
37
  /**
32
38
  * Mobile menu will be enabled when viewport is at or below this number in pixels.
33
39
  */
@@ -1,3 +1,4 @@
1
+ import type { ReactElement } from 'react';
1
2
  export type NavigationItem = {
2
3
  /**
3
4
  * A boolean indicating whether the item is the active item.
@@ -6,15 +7,11 @@ export type NavigationItem = {
6
7
  /**
7
8
  * Link content — a fully-formed link element using the router of your choice. If a string is provided instead, the item will be rendered as a link that navigates to the first child item.
8
9
  */
9
- linkContent: JSX.Element | string;
10
+ linkContent: ReactElement | string;
10
11
  /**
11
12
  * Submenu items.
12
13
  */
13
14
  links?: NavigationItem[];
14
- /**
15
- * A boolean indicating whether the item is a submenu.
16
- */
17
- path?: string;
18
15
  };
19
16
  export type FlattenedNavigationItem = {
20
17
  /**
@@ -24,7 +21,7 @@ export type FlattenedNavigationItem = {
24
21
  /**
25
22
  * Link content — a fully-formed link element using the router of your choice.
26
23
  */
27
- linkContent: JSX.Element;
24
+ linkContent: ReactElement;
28
25
  /**
29
26
  * Nesting level of the item.
30
27
  */
@@ -1,8 +1,9 @@
1
+ import React, { ReactElement } from 'react';
1
2
  import { PDSIcon } from '@components/icons/Icon/Icon';
2
3
  import { NavigationItem } from '@components/navigation/navigation-types';
3
4
  export declare const isActiveItem: (item: NavigationItem) => boolean;
4
5
  export declare const isActiveTrail: (item: NavigationItem) => boolean;
5
- export declare const getActiveLink: (items: NavigationItem[]) => JSX.Element | null;
6
- export declare const getLinkContentString: (linkContent: JSX.Element | string) => string;
7
- export declare const processNavLinkContent: (linkContent: JSX.Element | string, links?: NavigationItem[]) => JSX.Element | string;
8
- export declare const processSideNavGlobalLinkContent: (baseClass: string, linkContent: JSX.Element | string, links?: NavigationItem[], icon?: PDSIcon) => JSX.Element;
6
+ export declare const getActiveLink: (items: NavigationItem[]) => ReactElement | null;
7
+ export declare const getLinkContentString: (linkContent: ReactElement | string) => string;
8
+ export declare const processNavLinkContent: (linkContent: ReactElement | string, links?: NavigationItem[]) => ReactElement | string;
9
+ export declare const processSideNavGlobalLinkContent: (baseClass: string, linkContent: ReactElement | string, links?: NavigationItem[], icon?: PDSIcon) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
package/_dist/index.d.ts CHANGED
@@ -58,6 +58,7 @@ export * from './components/Modal/Modal';
58
58
  export * from './components/navigation/Breadcrumb/Breadcrumb';
59
59
  export * from './components/navigation/ButtonNav/ButtonNav';
60
60
  export * from './components/navigation/DashboardNav/DashboardNav';
61
+ export * from './components/navigation/DashboardNav/DashboardNavItem';
61
62
  export * from './components/navigation/DashboardSearch/DashboardSearch';
62
63
  export * from './components/navigation/DropdownMenu/DropdownMenu';
63
64
  export * from './components/navigation/Navbar/Navbar';
@@ -65,6 +66,7 @@ export * from './components/navigation/NavMenu/NavMenu';
65
66
  export * from './components/navigation/SideNav/SideNav';
66
67
  export * from './components/navigation/SideNavCompact/SideNavCompact';
67
68
  export * from './components/navigation/SideNavGlobal/SideNavGlobal';
69
+ export * from './components/navigation/SideNavGlobal/SideNavGlobalItem';
68
70
  export * from './components/navigation/TabMenu/TabMenu';
69
71
  export * from './components/navigation/UserMenu/UserMenu';
70
72
  export * from './components/navigation/WorkspaceSelector/WorkspaceSelector';
@@ -113,6 +115,7 @@ export * from './layouts/SidebarLayout/SidebarLayout';
113
115
  export * from './layouts/StepperLayout/StepperLayout';
114
116
  export * from './layouts/ThreeItemLayout/ThreeItemLayout';
115
117
  export * from './layouts/TwoItemLayout/TwoItemLayout';
118
+ export * from './components/navigation/navigation-types';
116
119
  export * from './libs/types/custom-types';
117
120
  export { ResponsiveContext } from './utilities/context-providers/ResponsiveContext/ResponsiveContext';
118
121
  export { useClipboard } from './utilities/hooks/useClipboard';
package/_dist/index.js CHANGED
@@ -12437,6 +12437,7 @@ export {
12437
12437
  Vs as DashboardGlobal,
12438
12438
  C4 as DashboardInner,
12439
12439
  Ss as DashboardNav,
12440
+ En as DashboardNavItem,
12440
12441
  As as DashboardSearch,
12441
12442
  us as DashboardStat,
12442
12443
  _4 as DocsLayout,
@@ -12489,6 +12490,7 @@ export {
12489
12490
  Rs as SideNav,
12490
12491
  Os as SideNavCompact,
12491
12492
  Fs as SideNavGlobal,
12493
+ Ln as SideNavGlobalItem,
12492
12494
  b4 as SidebarLayout,
12493
12495
  is as SiteCard,
12494
12496
  a4 as SiteDashboardHeading,