From 0b4160dfd5e4e19f225c07bd9f024edd6722428c Mon Sep 17 00:00:00 2001 From: Ian <52504170+ibacher@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:07:21 -0400 Subject: [PATCH 1/2] fix(UIShell): Export prop types for components --- packages/react/src/components/Link/index.tsx | 4 ++-- .../src/components/UIShell/HeaderContainer.tsx | 2 +- .../src/components/UIShell/HeaderMenuButton.tsx | 2 +- .../src/components/UIShell/HeaderMenuItem.tsx | 2 +- .../react/src/components/UIShell/HeaderName.tsx | 2 +- .../src/components/UIShell/HeaderNavigation.tsx | 2 +- .../components/UIShell/HeaderSideNavItems.tsx | 2 +- .../react/src/components/UIShell/SideNav.tsx | 2 +- .../src/components/UIShell/SkipToContent.tsx | 2 +- packages/react/src/components/UIShell/index.ts | 16 ++++++++-------- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/react/src/components/Link/index.tsx b/packages/react/src/components/Link/index.tsx index 67c6a3704a3d..9b145b5d8d08 100644 --- a/packages/react/src/components/Link/index.tsx +++ b/packages/react/src/components/Link/index.tsx @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import Link from './Link'; +import Link, { type LinkProps } from './Link'; export default Link; -export { Link }; +export { Link, type LinkProps }; diff --git a/packages/react/src/components/UIShell/HeaderContainer.tsx b/packages/react/src/components/UIShell/HeaderContainer.tsx index 51d2b0a9ac19..89a0c0d88bef 100644 --- a/packages/react/src/components/UIShell/HeaderContainer.tsx +++ b/packages/react/src/components/UIShell/HeaderContainer.tsx @@ -15,7 +15,7 @@ interface HeaderContainerRenderProps { onClickSideNavExpand: () => void; } -interface HeaderContainerProps { +export interface HeaderContainerProps { isSideNavExpanded?: boolean; render: React.ComponentType; } diff --git a/packages/react/src/components/UIShell/HeaderMenuButton.tsx b/packages/react/src/components/UIShell/HeaderMenuButton.tsx index f70bb704ed98..3db4cf4f0f62 100644 --- a/packages/react/src/components/UIShell/HeaderMenuButton.tsx +++ b/packages/react/src/components/UIShell/HeaderMenuButton.tsx @@ -18,7 +18,7 @@ type HeaderMenuButtonBaseProps = Omit< 'title' | 'type' >; -interface HeaderMenuButtonProps extends HeaderMenuButtonBaseProps { +export interface HeaderMenuButtonProps extends HeaderMenuButtonBaseProps { 'aria-label'?: string; 'aria-labelledby'?: string; className?: string; diff --git a/packages/react/src/components/UIShell/HeaderMenuItem.tsx b/packages/react/src/components/UIShell/HeaderMenuItem.tsx index d5f968febd3a..0dbb0a8673bc 100644 --- a/packages/react/src/components/UIShell/HeaderMenuItem.tsx +++ b/packages/react/src/components/UIShell/HeaderMenuItem.tsx @@ -19,7 +19,7 @@ import Link, { LinkProps, LinkPropTypes } from './Link'; import { usePrefix } from '../../internal/usePrefix'; import deprecate from '../../prop-types/deprecate'; -type HeaderMenuItemProps = LinkProps & { +export interface HeaderMenuItemProps extends LinkProps { className?: string | undefined; isActive?: boolean | undefined; isCurrentPage?: boolean | undefined; diff --git a/packages/react/src/components/UIShell/HeaderName.tsx b/packages/react/src/components/UIShell/HeaderName.tsx index b44c6c5233b3..dadffd159b96 100644 --- a/packages/react/src/components/UIShell/HeaderName.tsx +++ b/packages/react/src/components/UIShell/HeaderName.tsx @@ -11,7 +11,7 @@ import PropTypes from 'prop-types'; import Link, { type LinkProps, LinkPropTypes } from './Link'; import { usePrefix } from '../../internal/usePrefix'; -type HeaderNameProps = LinkProps & { +export interface HeaderNameProps extends LinkProps { prefix?: string | undefined; }; diff --git a/packages/react/src/components/UIShell/HeaderNavigation.tsx b/packages/react/src/components/UIShell/HeaderNavigation.tsx index cfb03a8ae739..73e5f91ba563 100644 --- a/packages/react/src/components/UIShell/HeaderNavigation.tsx +++ b/packages/react/src/components/UIShell/HeaderNavigation.tsx @@ -11,7 +11,7 @@ import PropTypes from 'prop-types'; import { AriaLabelPropType } from '../../prop-types/AriaPropTypes'; import { usePrefix } from '../../internal/usePrefix'; -type HeaderNavigationProps = ComponentProps<'nav'>; +export interface HeaderNavigationProps extends ComponentProps<'nav'> {}; export default function HeaderNavigation({ 'aria-label': ariaLabel, diff --git a/packages/react/src/components/UIShell/HeaderSideNavItems.tsx b/packages/react/src/components/UIShell/HeaderSideNavItems.tsx index a7dceee7b4d3..27593d915ce0 100644 --- a/packages/react/src/components/UIShell/HeaderSideNavItems.tsx +++ b/packages/react/src/components/UIShell/HeaderSideNavItems.tsx @@ -10,7 +10,7 @@ import React, { type ReactNode } from 'react'; import PropTypes from 'prop-types'; import { usePrefix } from '../../internal/usePrefix'; -interface HeaderSideNavItemsProps { +export interface HeaderSideNavItemsProps { className?: string | undefined; children?: ReactNode; hasDivider?: boolean | undefined; diff --git a/packages/react/src/components/UIShell/SideNav.tsx b/packages/react/src/components/UIShell/SideNav.tsx index 27f3f0b2c76d..99a1887b0ad3 100644 --- a/packages/react/src/components/UIShell/SideNav.tsx +++ b/packages/react/src/components/UIShell/SideNav.tsx @@ -28,7 +28,7 @@ import { useMatchMedia } from '../../internal/useMatchMedia'; // TO-DO: comment back in when footer is added for rails // import SideNavFooter from './SideNavFooter'; -interface SideNavProps extends ComponentProps<'nav'> { +export interface SideNavProps extends ComponentProps<'nav'> { expanded?: boolean | undefined; defaultExpanded?: boolean | undefined; isChildOfHeader?: boolean | undefined; diff --git a/packages/react/src/components/UIShell/SkipToContent.tsx b/packages/react/src/components/UIShell/SkipToContent.tsx index d1b9a78a4bb5..c6712896b0fc 100644 --- a/packages/react/src/components/UIShell/SkipToContent.tsx +++ b/packages/react/src/components/UIShell/SkipToContent.tsx @@ -10,7 +10,7 @@ import React, { ComponentProps } from 'react'; import PropTypes from 'prop-types'; import { usePrefix } from '../../internal/usePrefix'; -type SkipToContentProps = Omit, 'children'> & { +export type SkipToContentProps = Omit, 'children'> & { children?: string | undefined; }; diff --git a/packages/react/src/components/UIShell/index.ts b/packages/react/src/components/UIShell/index.ts index 5d82354e9b9b..bfd9ea354dd3 100644 --- a/packages/react/src/components/UIShell/index.ts +++ b/packages/react/src/components/UIShell/index.ts @@ -8,23 +8,23 @@ export { default as Content } from './Content'; export { default as Header } from './Header'; -export { default as HeaderContainer } from './HeaderContainer'; +export { default as HeaderContainer, type HeaderContainerProps } from './HeaderContainer'; export { default as HeaderGlobalAction } from './HeaderGlobalAction'; export { default as HeaderGlobalBar } from './HeaderGlobalBar'; export { default as HeaderMenu } from './HeaderMenu'; -export { default as HeaderMenuButton } from './HeaderMenuButton'; -export { default as HeaderMenuItem } from './HeaderMenuItem'; -export { default as HeaderName } from './HeaderName'; -export { default as HeaderNavigation } from './HeaderNavigation'; +export { default as HeaderMenuButton, type HeaderPanelProps } from './HeaderMenuButton'; +export { default as HeaderMenuItem, type HeaderMenuItemProps } from './HeaderMenuItem'; +export { default as HeaderName, type HeaderNameProps } from './HeaderName'; +export { default as HeaderNavigation, type HeaderNavigationProps } from './HeaderNavigation'; export { default as HeaderPanel } from './HeaderPanel'; -export { default as HeaderSideNavItems } from './HeaderSideNavItems'; +export { default as HeaderSideNavItems, type HeaderSideNavItemsProps } from './HeaderSideNavItems'; export { default as Switcher } from './Switcher'; export { default as SwitcherItem } from './SwitcherItem'; export { default as SwitcherDivider } from './SwitcherDivider'; -export { default as SkipToContent } from './SkipToContent'; +export { default as SkipToContent, type SkipToContentProps } from './SkipToContent'; -export { default as SideNav } from './SideNav'; +export { default as SideNav, type SideNavProps } from './SideNav'; export { default as SideNavDetails } from './SideNavDetails'; export { default as SideNavDivider } from './SideNavDivider'; export { default as SideNavFooter } from './SideNavFooter'; From cd4d9cae313e1177243bd417e6fda300b62de217 Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 18 Sep 2023 10:30:59 -0400 Subject: [PATCH 2/2] fix(ui-shell): fix build issues flagged by CI --- packages/react/src/components/Link/Link.tsx | 2 +- .../src/components/UIShell/HeaderMenuItem.tsx | 2 +- .../src/components/UIShell/HeaderName.tsx | 2 +- .../components/UIShell/HeaderNavigation.tsx | 2 +- .../react/src/components/UIShell/index.ts | 30 +++++++++++++++---- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/packages/react/src/components/Link/Link.tsx b/packages/react/src/components/Link/Link.tsx index 0b729fd03d28..11c8dc028415 100644 --- a/packages/react/src/components/Link/Link.tsx +++ b/packages/react/src/components/Link/Link.tsx @@ -16,7 +16,7 @@ import React, { } from 'react'; import { usePrefix } from '../../internal/usePrefix'; -interface LinkProps extends AnchorHTMLAttributes { +export interface LinkProps extends AnchorHTMLAttributes { /** * @description Indicates the element that represents the * current item within a container or set of related diff --git a/packages/react/src/components/UIShell/HeaderMenuItem.tsx b/packages/react/src/components/UIShell/HeaderMenuItem.tsx index 0b2653c33269..0fde47f0a1e6 100644 --- a/packages/react/src/components/UIShell/HeaderMenuItem.tsx +++ b/packages/react/src/components/UIShell/HeaderMenuItem.tsx @@ -19,7 +19,7 @@ import Link, { LinkProps, LinkPropTypes } from './Link'; import { usePrefix } from '../../internal/usePrefix'; import deprecate from '../../prop-types/deprecate'; -export interface HeaderMenuItemProps extends LinkProps { +export type HeaderMenuItemProps = LinkProps & { className?: string | undefined; isActive?: boolean | undefined; isCurrentPage?: boolean | undefined; diff --git a/packages/react/src/components/UIShell/HeaderName.tsx b/packages/react/src/components/UIShell/HeaderName.tsx index dadffd159b96..911bc3031cdf 100644 --- a/packages/react/src/components/UIShell/HeaderName.tsx +++ b/packages/react/src/components/UIShell/HeaderName.tsx @@ -11,7 +11,7 @@ import PropTypes from 'prop-types'; import Link, { type LinkProps, LinkPropTypes } from './Link'; import { usePrefix } from '../../internal/usePrefix'; -export interface HeaderNameProps extends LinkProps { +export type HeaderNameProps = LinkProps & { prefix?: string | undefined; }; diff --git a/packages/react/src/components/UIShell/HeaderNavigation.tsx b/packages/react/src/components/UIShell/HeaderNavigation.tsx index 73e5f91ba563..bc97302b48b7 100644 --- a/packages/react/src/components/UIShell/HeaderNavigation.tsx +++ b/packages/react/src/components/UIShell/HeaderNavigation.tsx @@ -11,7 +11,7 @@ import PropTypes from 'prop-types'; import { AriaLabelPropType } from '../../prop-types/AriaPropTypes'; import { usePrefix } from '../../internal/usePrefix'; -export interface HeaderNavigationProps extends ComponentProps<'nav'> {}; +export type HeaderNavigationProps = ComponentProps<'nav'>; export default function HeaderNavigation({ 'aria-label': ariaLabel, diff --git a/packages/react/src/components/UIShell/index.ts b/packages/react/src/components/UIShell/index.ts index bfd9ea354dd3..ad1bfa8e7ef7 100644 --- a/packages/react/src/components/UIShell/index.ts +++ b/packages/react/src/components/UIShell/index.ts @@ -8,21 +8,39 @@ export { default as Content } from './Content'; export { default as Header } from './Header'; -export { default as HeaderContainer, type HeaderContainerProps } from './HeaderContainer'; +export { + default as HeaderContainer, + type HeaderContainerProps, +} from './HeaderContainer'; export { default as HeaderGlobalAction } from './HeaderGlobalAction'; export { default as HeaderGlobalBar } from './HeaderGlobalBar'; export { default as HeaderMenu } from './HeaderMenu'; -export { default as HeaderMenuButton, type HeaderPanelProps } from './HeaderMenuButton'; -export { default as HeaderMenuItem, type HeaderMenuItemProps } from './HeaderMenuItem'; +export { + default as HeaderMenuButton, + type HeaderMenuButtonProps, +} from './HeaderMenuButton'; +export { + default as HeaderMenuItem, + type HeaderMenuItemProps, +} from './HeaderMenuItem'; export { default as HeaderName, type HeaderNameProps } from './HeaderName'; -export { default as HeaderNavigation, type HeaderNavigationProps } from './HeaderNavigation'; +export { + default as HeaderNavigation, + type HeaderNavigationProps, +} from './HeaderNavigation'; export { default as HeaderPanel } from './HeaderPanel'; -export { default as HeaderSideNavItems, type HeaderSideNavItemsProps } from './HeaderSideNavItems'; +export { + default as HeaderSideNavItems, + type HeaderSideNavItemsProps, +} from './HeaderSideNavItems'; export { default as Switcher } from './Switcher'; export { default as SwitcherItem } from './SwitcherItem'; export { default as SwitcherDivider } from './SwitcherDivider'; -export { default as SkipToContent, type SkipToContentProps } from './SkipToContent'; +export { + default as SkipToContent, + type SkipToContentProps, +} from './SkipToContent'; export { default as SideNav, type SideNavProps } from './SideNav'; export { default as SideNavDetails } from './SideNavDetails';