@pantheon-systems/pds-toolkit-react 1.0.0-dev.266 → 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
@@ -9172,7 +9172,14 @@ const ds = (C) => {
9172
9172
  onClick: G,
9173
9173
  type: "button"
9174
9174
  },
9175
- /* @__PURE__ */ e.createElement(U, { iconName: "caretDown", iconSize: "md" }),
9175
+ /* @__PURE__ */ e.createElement(
9176
+ U,
9177
+ {
9178
+ iconName: "caretDown",
9179
+ iconSize: "md",
9180
+ verticalAlign: "-0.0625rem"
9181
+ }
9182
+ ),
9176
9183
  /* @__PURE__ */ e.createElement("span", { className: "visually-hidden" }, `${a.toggle} ${Se(S.linkContent)} ${a.submenu}`)
9177
9184
  ), St(S.linkContent, S.links)), /* @__PURE__ */ e.createElement(
9178
9185
  "ul",
@@ -12088,7 +12095,7 @@ const l4 = (o) => {
12088
12095
  return;
12089
12096
  }
12090
12097
  y(!_);
12091
- }, E = Oe(t), $ = E.__unslotted, H = E.sidebar, k = /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("aside", { className: `${C}__sidebar` }, H), /* @__PURE__ */ e.createElement("div", { className: `${C}__content` }, $)), w = /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("aside", { className: `${C}__sidebar`, style: m }, n && /* @__PURE__ */ e.createElement(
12098
+ }, E = Oe(t), $ = E.__unslotted, H = E.sidebar, k = /* @__PURE__ */ e.createElement(e.Fragment, null, H && /* @__PURE__ */ e.createElement("aside", { className: `${C}__sidebar` }, H), /* @__PURE__ */ e.createElement("div", { className: `${C}__content` }, $)), w = /* @__PURE__ */ e.createElement(e.Fragment, null, H && /* @__PURE__ */ e.createElement("aside", { className: `${C}__sidebar`, style: m }, n && /* @__PURE__ */ e.createElement(
12092
12099
  "button",
12093
12100
  {
12094
12101
  className: `${C}__sidebar-toggle-button`,
@@ -12155,7 +12162,7 @@ const l4 = (o) => {
12155
12162
  const p = "pds-docs-layout", g = l ? `${p}--isMobile` : null, u = {
12156
12163
  width: n,
12157
12164
  minWidth: `${s}rem`
12158
- }, d = Oe(t), b = d.__unslotted || d.content, _ = d.sidebar, y = /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("aside", { className: `${p}__sidebar` }, _), /* @__PURE__ */ e.createElement("div", { className: `${p}__content` }, b)), C = /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("aside", { className: `${p}__sidebar`, style: u }, /* @__PURE__ */ e.createElement("div", { className: `${p}__sidebar-inner` }, _)), /* @__PURE__ */ e.createElement("div", { className: `${p}__content` }, b));
12165
+ }, d = Oe(t), b = d.__unslotted || d.content, _ = d.sidebar, y = /* @__PURE__ */ e.createElement(e.Fragment, null, _ && /* @__PURE__ */ e.createElement("aside", { className: `${p}__sidebar` }, _), /* @__PURE__ */ e.createElement("div", { className: `${p}__content` }, b)), C = /* @__PURE__ */ e.createElement(e.Fragment, null, _ && /* @__PURE__ */ e.createElement("aside", { className: `${p}__sidebar`, style: u }, /* @__PURE__ */ e.createElement("div", { className: `${p}__sidebar-inner` }, _)), /* @__PURE__ */ e.createElement("div", { className: `${p}__content` }, b));
12159
12166
  return /* @__PURE__ */ e.createElement(
12160
12167
  "div",
12161
12168
  L({
@@ -12430,6 +12437,7 @@ export {
12430
12437
  Vs as DashboardGlobal,
12431
12438
  C4 as DashboardInner,
12432
12439
  Ss as DashboardNav,
12440
+ En as DashboardNavItem,
12433
12441
  As as DashboardSearch,
12434
12442
  us as DashboardStat,
12435
12443
  _4 as DocsLayout,
@@ -12482,6 +12490,7 @@ export {
12482
12490
  Rs as SideNav,
12483
12491
  Os as SideNavCompact,
12484
12492
  Fs as SideNavGlobal,
12493
+ Ln as SideNavGlobalItem,
12485
12494
  b4 as SidebarLayout,
12486
12495
  is as SiteCard,
12487
12496
  a4 as SiteDashboardHeading,