Fix the exported documentation for StructuredMetadataTable
Signed-off-by: Boris Bera <beraboris@gmail.com>
This commit is contained in:
@@ -120,10 +120,10 @@ export type BottomLinkProps = {
|
||||
onClick?: (event: React_2.MouseEvent<HTMLAnchorElement>) => void;
|
||||
};
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_19" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_18" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @public
|
||||
export function Breadcrumbs(props: Props_19): React_2.JSX.Element;
|
||||
export function Breadcrumbs(props: Props_18): React_2.JSX.Element;
|
||||
|
||||
// @public (undocumented)
|
||||
export type BreadcrumbsClickableTextClassKey = 'root';
|
||||
@@ -177,11 +177,11 @@ export interface CodeSnippetProps {
|
||||
text: string;
|
||||
}
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_13" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_12" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @public
|
||||
export function Content(
|
||||
props: PropsWithChildren<Props_13>,
|
||||
props: PropsWithChildren<Props_12>,
|
||||
): React_2.JSX.Element;
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "ContentHeaderProps" needs to be exported by the entry point index.d.ts
|
||||
@@ -454,10 +454,10 @@ export function GitHubIcon(props: IconComponentProps): React_2.JSX.Element;
|
||||
// @public (undocumented)
|
||||
export function GroupIcon(props: IconComponentProps): React_2.JSX.Element;
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_14" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_13" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @public
|
||||
export function Header(props: PropsWithChildren<Props_14>): React_2.JSX.Element;
|
||||
export function Header(props: PropsWithChildren<Props_13>): React_2.JSX.Element;
|
||||
|
||||
// @public (undocumented)
|
||||
export function HeaderActionMenu(
|
||||
@@ -564,10 +564,10 @@ export type IconLinkVerticalProps = {
|
||||
// @public (undocumented)
|
||||
export type IdentityProviders = ('guest' | 'custom' | SignInProviderConfig)[];
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_15" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_14" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @public
|
||||
export function InfoCard(props: Props_15): JSX.Element;
|
||||
export function InfoCard(props: Props_14): JSX.Element;
|
||||
|
||||
// @public (undocumented)
|
||||
export type InfoCardClassKey =
|
||||
@@ -795,11 +795,11 @@ export function OverflowTooltip(props: Props_9): React_2.JSX.Element;
|
||||
// @public (undocumented)
|
||||
export type OverflowTooltipClassKey = 'container';
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_16" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_15" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-missing-release-tag) "Page" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export function Page(props: Props_16): React_2.JSX.Element;
|
||||
export function Page(props: Props_15): React_2.JSX.Element;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "PageClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
@@ -1125,11 +1125,11 @@ export type SidebarSubmenuProps = {
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_17" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_16" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-missing-release-tag) "SignInPage" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export function SignInPage(props: Props_17): React_2.JSX.Element;
|
||||
export function SignInPage(props: Props_16): React_2.JSX.Element;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "SignInPageClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
@@ -1222,11 +1222,10 @@ export function StatusWarning(
|
||||
props: PropsWithChildren<{}>,
|
||||
): React_2.JSX.Element;
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_12" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-missing-release-tag) "StructuredMetadataTable" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export function StructuredMetadataTable(props: Props_12): React_2.JSX.Element;
|
||||
export function StructuredMetadataTable(
|
||||
props: StructuredMetadataTableProps,
|
||||
): React_2.JSX.Element;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "StructuredMetadataTableListClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
@@ -1238,6 +1237,20 @@ export type StructuredMetadataTableListClassKey = 'root';
|
||||
// @public (undocumented)
|
||||
export type StructuredMetadataTableNestedListClassKey = 'root';
|
||||
|
||||
// @public (undocumented)
|
||||
export interface StructuredMetadataTableProps {
|
||||
// (undocumented)
|
||||
dense?: boolean;
|
||||
// (undocumented)
|
||||
metadata: {
|
||||
[key: string]: any;
|
||||
};
|
||||
// (undocumented)
|
||||
options?: {
|
||||
titleFormat?: (key: string) => string;
|
||||
};
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export type SubmenuOptions = {
|
||||
drawerWidthClosed?: number;
|
||||
@@ -1305,12 +1318,12 @@ export type Tab = {
|
||||
>;
|
||||
};
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_18" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-forgotten-export) The symbol "Props_17" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-missing-release-tag) "TabbedCard" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export function TabbedCard(
|
||||
props: PropsWithChildren<Props_18>,
|
||||
props: PropsWithChildren<Props_17>,
|
||||
): React_2.JSX.Element;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "TabbedCardClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
|
||||
+23
-20
@@ -85,11 +85,10 @@ function renderMap(
|
||||
) {
|
||||
const values = Object.keys(map).map(key => {
|
||||
const value = toValue(map[key], options, true);
|
||||
const fmtKey = options.titleFormat?.(key) ?? startCase(key);
|
||||
return (
|
||||
<MetadataListItem key={key}>
|
||||
<Typography variant="body2" component="span">
|
||||
{`${fmtKey}: `}
|
||||
{`${options.titleFormat(key)}: `}
|
||||
</Typography>
|
||||
{value}
|
||||
</MetadataListItem>
|
||||
@@ -144,7 +143,7 @@ const TableItem = ({
|
||||
options: Options;
|
||||
}) => {
|
||||
return (
|
||||
<MetadataTableItem title={options.titleFormat?.(title) ?? startCase(title)}>
|
||||
<MetadataTableItem title={options.titleFormat(title)}>
|
||||
<ItemValue value={value} options={options} />
|
||||
</MetadataTableItem>
|
||||
);
|
||||
@@ -156,25 +155,29 @@ function mapToItems(info: { [key: string]: string }, options: Options) {
|
||||
));
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Function to format the keys from the `metadata` object. Defaults to
|
||||
* startCase from the lodash library.
|
||||
* @param key A key within the `metadata`
|
||||
* @returns Formatted key
|
||||
* @see {@link startCase}
|
||||
*/
|
||||
titleFormat?: (key: string) => string;
|
||||
}
|
||||
|
||||
type Props = {
|
||||
/** @public */
|
||||
export interface StructuredMetadataTableProps {
|
||||
metadata: { [key: string]: any };
|
||||
dense?: boolean;
|
||||
options?: Options;
|
||||
};
|
||||
options?: {
|
||||
/**
|
||||
* Function to format the keys from the `metadata` object. Defaults to
|
||||
* startCase from the lodash library.
|
||||
* @param key - A key within the `metadata`
|
||||
* @returns Formatted key
|
||||
*/
|
||||
titleFormat?: (key: string) => string;
|
||||
};
|
||||
}
|
||||
|
||||
export function StructuredMetadataTable(props: Props) {
|
||||
const { metadata, dense = true, options } = props;
|
||||
const metadataItems = mapToItems(metadata, options || {});
|
||||
type Options = Required<NonNullable<StructuredMetadataTableProps['options']>>;
|
||||
|
||||
/** @public */
|
||||
export function StructuredMetadataTable(props: StructuredMetadataTableProps) {
|
||||
const { metadata, dense = true, options = {} } = props;
|
||||
const metadataItems = mapToItems(metadata, {
|
||||
titleFormat: startCase,
|
||||
...options,
|
||||
});
|
||||
return <MetadataTable dense={dense}>{metadataItems}</MetadataTable>;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,10 @@ export type {
|
||||
MetadataTableListClassKey,
|
||||
MetadataTableListItemClassKey,
|
||||
} from './MetadataTable';
|
||||
export { StructuredMetadataTable } from './StructuredMetadataTable';
|
||||
export {
|
||||
StructuredMetadataTable,
|
||||
type StructuredMetadataTableProps,
|
||||
} from './StructuredMetadataTable';
|
||||
export type {
|
||||
StructuredMetadataTableListClassKey,
|
||||
StructuredMetadataTableNestedListClassKey,
|
||||
|
||||
Reference in New Issue
Block a user