Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,57 @@ import {
} from '@elastic/eui-docgen';
import { useCallback, useMemo } from 'react';
import { css } from '@emotion/react';
import { PropTableExtendedTypes } from './extended_types';
import Heading from '@theme/Heading';
import types from '@elastic/eui-docgen/dist/types.json';

import { PropTableExtendedTypes } from './extended_types';

export interface Source {
fileName: string;
line: number;
character: number;
url: string;
}

export interface Child {
id: number;
name: string;
variant: string;
kind: number;
flags: Record<string, unknown>;
children?: Child[];
groups?: Group[];
sources?: Source[];
type?: {
type: string;
types?: { type: string; value?: string }[];
declaration?: Record<string, unknown>;
target?: { qualifiedName: string };
name?: string;
package?: string;
};
defaultValue?: string;
}

export interface Group {
title: string;
children: number[];
}

export interface Types {
schemaVersion: string;
id: number;
name: string;
variant: string;
kind: number;
flags: Record<string, unknown>;
children: Child[];
groups: Group[];
packageName: string;
readme: unknown[];
symbolIdMap: Record<string, unknown>;
files: Record<string, unknown>;
}

export interface PropTableProps {
definition: ProcessedComponent;
Expand Down Expand Up @@ -136,15 +185,30 @@ export const PropTable = ({
value: ProcessedComponentProp['description'],
prop: ProcessedComponentProp
) {
const result = value
.replace(/{@link (\w+)}/g, (_, componentName) => {
const componentSource = (types as Types).children.find(
(item) => item.name === componentName
)?.sources?.[0];

if (componentSource) {
const { fileName, line } = componentSource;
return `[${componentName}](https://github.com/elastic/eui/tree/main/packages/${fileName}#L${line})`;
} else {
return `\`${componentName}\``;
}
})
.trim();

return (
<EuiFlexGroup
direction="column"
alignItems="flexStart"
gutterSize="s"
>
{value?.trim() && (
{result && (
<EuiMarkdownFormat css={styles.description}>
{value}
{result}
</EuiMarkdownFormat>
)}
{prop.type && (
Expand Down
8 changes: 5 additions & 3 deletions packages/eui-docgen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"clear": "rimraf dist/ lib/",
"generate": "ts-node src/main.ts",
"build": "tsc && yarn generate"
"build": "tsc && yarn generate && yarn typedoc",
"typedoc": "typedoc"
},
"repository": {
"type": "git",
Expand All @@ -18,10 +19,11 @@
"glob": "^11.0.0",
"react-docgen-typescript": "^2.2.2",
"ts-node": "^10.9.2",
"typescript": "~5.5.4"
"typescript": "^5.8.3"
},
"devDependencies": {
"rimraf": "^6.0.1"
"rimraf": "^6.0.1",
"typedoc": "^0.28.3"
},
"files": [
"dist",
Expand Down
12 changes: 12 additions & 0 deletions packages/eui-docgen/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://typedoc.org/schema.json",
"entryPoints": ["../eui"],
"entryPointStrategy": "packages",
"outputs": [
{
"name": "json",
"path": "dist/types.json",
}
],
"exclude": ["**/node_modules/**"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export interface _EuiThemeTitle {
export type _EuiThemeFont = _EuiThemeFontBase & {
scale: _EuiThemeFontScales;
/**
* @see {@link https://eui.elastic.co/#/theming/typography/values%23font-weight | Reference} for more information
* See {@link https://eui.elastic.co/#/theming/typography/values%23font-weight | Reference} for more information
*/
weight: _EuiThemeFontWeights;
body: _EuiThemeBody;
Expand Down
2 changes: 1 addition & 1 deletion packages/eui-theme-common/src/services/theme/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export type EuiThemeShapeBase = {
/** - Default value: 16 */
base: _EuiThemeBase;
/**
* @see {@link https://eui.elastic.co/#/theming/sizing | Reference} for more information
* See {@link https://eui.elastic.co/#/theming/sizing | Reference} for more information
*/
size: _EuiThemeSizes;
font: _EuiThemeFont;
Expand Down
3 changes: 3 additions & 0 deletions packages/eui/changelogs/upcoming/8626.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Dependency updates**

- Updated `typescript` to v5.8.3
11 changes: 6 additions & 5 deletions packages/eui/src/components/basic_table/basic_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ interface BasicTableProps<T extends object>
*/
cellProps?: object | CellPropsCallback<T>;
/**
* An array of one of the objects: #EuiTableFieldDataColumnType, #EuiTableComputedColumnType or #EuiTableActionsColumnType.
* An array of one of the objects: {@link EuiTableFieldDataColumnType}, {@link EuiTableComputedColumnType} or {@link EuiTableActionsColumnType}.
*/
columns: Array<EuiBasicTableColumn<T>>;
/**
Expand All @@ -251,23 +251,24 @@ interface BasicTableProps<T extends object>
*/
noItemsMessage?: ReactNode;
/**
* Called whenever pagination or sorting changes (this property is required when either pagination or sorting is configured). See #Criteria or #CriteriaWithPagination
* Called whenever pagination or sorting changes (this property is required when either pagination or sorting is configured).
* {@link Criteria} or {@link CriteriaWithPagination}
*/
onChange?: (criteria: Criteria<T>) => void;
/**
* Configures #Pagination
* Configures {@link Pagination}
*/
pagination?: undefined;
/**
* Applied to `EuiTableRow`
*/
rowProps?: object | RowPropsCallback<T>;
/**
* Configures #EuiTableSelectionType
* Configures {@link EuiTableSelectionType}
*/
selection?: EuiTableSelectionType<T>;
/**
* Configures #EuiTableSortingType
* Configures {@link EuiTableSortingType}
*/
sorting?: EuiTableSortingType<T>;
/**
Expand Down
12 changes: 7 additions & 5 deletions packages/eui/src/components/basic_table/in_memory_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type InMemoryTableProps<T extends object> = Omit<
> & {
message?: ReactNode;
/**
* Configures #Search.
* Configures {@link Search}.
*/
search?: Search;
/**
Expand All @@ -93,11 +93,11 @@ type InMemoryTableProps<T extends object> = Omit<
*/
searchFormat?: 'eql' | 'text';
/**
* Configures #Pagination
* Configures {@link Pagination}
*/
pagination?: undefined;
/**
* Configures #EuiTableSortingType
* Configures {@link EuiTableSortingType}
*/
sorting?: Sorting;
/**
Expand All @@ -107,11 +107,13 @@ type InMemoryTableProps<T extends object> = Omit<
/**
* `onChange` is not required when `pagination` and/or `sorting` are configured,
* but if `onChange` is present it is responsible for handling state for each/both.
* See #Criteria or #CriteriaWithPagination
* {@link Criteria} or {@link CriteriaWithPagination}
*/
onChange?: EuiBasicTableProps<T>['onChange'];
/**
* Callback for when table pagination or sorting is changed. This is meant to be informational only, and not used to set any state as the in-memory table already manages this state. See #Criteria or #CriteriaWithPagination.
* Callback for when table pagination or sorting is changed. This is meant to be informational only,
* and not used to set any state as the in-memory table already manages this state.
* {@link Criteria} or {@link CriteriaWithPagination}.
*/
onTableChange?: (nextValues: Criteria<T>) => void;
executeQueryOptions?: {
Expand Down
2 changes: 1 addition & 1 deletion packages/eui/src/components/basic_table/table_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export type EuiTableComputedColumnType<T> = CommonProps &

export type EuiTableActionsColumnType<T extends object> = {
/**
* An array of one of the objects: #DefaultItemAction or #CustomItemAction
* An array of one of the objects: {@link DefaultItemAction} or {@link CustomItemAction}
*/
actions: Array<Action<T>>;
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/eui/src/components/breadcrumbs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export type EuiBreadcrumbResponsiveMaxCount = {
export type EuiBreadcrumbsProps = CommonProps & {
/**
* Hides extra (above the max) breadcrumbs under a collapsed item as the window gets smaller.
* Pass a custom #EuiBreadcrumbResponsiveMaxCount object to change the number of breadcrumbs to show at the particular breakpoints.
* Pass a custom {@link EuiBreadcrumbResponsiveMaxCount} object to change the number of breadcrumbs to show at the particular breakpoints.
*
* Pass `false` to turn this behavior off.
*
Expand All @@ -55,7 +55,7 @@ export type EuiBreadcrumbsProps = CommonProps & {
max?: number | null;

/**
* The array of individual #EuiBreadcrumb items
* The array of individual {@link EuiBreadcrumb} items
*/
breadcrumbs: EuiBreadcrumbProps[];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export type EuiButtonGroupProps = CommonProps & {
*/
type?: 'single' | 'multi';
/**
* An array of #EuiButtonGroupOptionProps
* An array of {@link EuiButtonGroupOptionProps}
*/
options: EuiButtonGroupOptionProps[];
} & (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export type EuiCollapsibleNavItemProps = _SharedEuiCollapsibleNavItemProps &
/**
* Will render either an accordion or group of nested child item links.
*
* Accepts any #EuiCollapsibleNavItemProps. Or, to render completely custom
* Accepts any {@link EuiCollapsibleNavItemProps}. Or, to render completely custom
* subitem content, pass an object with a `renderItem` callback.
*/
items: EuiCollapsibleNavSubItemProps[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type EuiColorPaletteDisplaySize = (typeof SIZES)[number];

export interface EuiColorPaletteDisplayShared {
/**
* Array of color `strings` or an array of #PaletteColorStop. The stops must be numbers in an ordered range.
* Array of color `strings` or an array of {@link PaletteColorStop}. The stops must be numbers in an ordered range.
*/
palette: string[] | PaletteColorStop[];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export interface EuiColorPalettePickerPaletteTextProps extends CommonProps {
*/
type: 'text';
/**
* Array of color `strings` or an array of #PaletteColorStop. The stops must be numbers in an ordered range.
* Array of color `strings` or an array of {@link PaletteColorStop}. The stops must be numbers in an ordered range.
*/
palette?: string[] | PaletteColorStop[];
}
Expand All @@ -70,7 +70,7 @@ export interface EuiColorPalettePickerPaletteFixedProps extends CommonProps {
*/
type: 'fixed';
/**
* Array of color `strings` or an array of #PaletteColorStop. The stops must be numbers in an ordered range.
* Array of color `strings` or an array of {@link PaletteColorStop}. The stops must be numbers in an ordered range.
*/
palette: string[] | PaletteColorStop[];
}
Expand All @@ -93,7 +93,7 @@ export interface EuiColorPalettePickerPaletteGradientProps extends CommonProps {
*/
type: 'gradient';
/**
* Array of color `strings` or an array of #PaletteColorStop. The stops must be numbers in an ordered range.
* Array of color `strings` or an array of {@link PaletteColorStop}. The stops must be numbers in an ordered range.
*/
palette: string[] | PaletteColorStop[];
}
Expand All @@ -114,7 +114,7 @@ export type EuiColorPalettePickerProps<T extends string> = CommonProps &
selectionDisplay?: 'palette' | 'title';

/**
* An array of one of the following objects: #EuiColorPalettePickerPaletteText, #EuiColorPalettePickerPaletteFixed, #EuiColorPalettePickerPaletteGradient
* An array of one of the following objects: {@link EuiColorPalettePickerPaletteText}, {@link EuiColorPalettePickerPaletteFixed}, {@link EuiColorPalettePickerPaletteGradient}
*/
palettes: EuiColorPalettePickerPaletteProps[];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export type EuiComboBoxOptionsListProps<T> = CommonProps & {
onOptionEnterKey?: OptionHandler<T>;
onScroll?: ListProps['onScroll'];
/**
* Array of EuiComboBoxOptionOption objects. See #EuiComboBoxOptionOption
* Array of EuiComboBoxOptionOption objects. See {@link EuiComboBoxOptionOption}
*/
options: Array<EuiComboBoxOptionOption<T>>;
renderOption?: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type EuiCommentListProps = Omit<
'items' | 'gutterSize'
> & {
/**
* List of comments to render. See #EuiComment
* List of comments to render. See {@link EuiComment}
*/
comments?: EuiCommentProps[];
/**
Expand Down
Loading