diff --git a/src-docs/src/components/guide_section/_guide_section.scss b/src-docs/src/components/guide_section/_guide_section.scss
index b408a51918e..8784d0bc8d5 100644
--- a/src-docs/src/components/guide_section/_guide_section.scss
+++ b/src-docs/src/components/guide_section/_guide_section.scss
@@ -7,3 +7,8 @@
.guideSection__space {
height: $euiSizeL;
}
+
+.guideSection__tableCodeBlock {
+ padding-left: $euiSizeXS;
+ padding-right: $euiSizeXS;
+}
diff --git a/src-docs/src/components/guide_section/guide_section.js b/src-docs/src/components/guide_section/guide_section.js
index 9592b7a07d3..9c29cfe37e6 100644
--- a/src-docs/src/components/guide_section/guide_section.js
+++ b/src-docs/src/components/guide_section/guide_section.js
@@ -309,6 +309,12 @@ export class GuideSection extends Component {
type,
} = props[propName];
+ const codeBlockProps = {
+ className: 'guideSection__tableCodeBlock',
+ paddingSize: 'none',
+ language: 'ts',
+ };
+
let humanizedName = (
{propName}
);
@@ -324,6 +330,11 @@ export class GuideSection extends Component {
const humanizedType = humanizeType(type);
+ const functionMatches = [
+ ...humanizedType.matchAll(/\([^=]*\) =>\s\w*\)*/g),
+ ];
+ const types = humanizedType.split(/\([^=]*\) =>\s\w*\)*/);
+
const typeMarkup = (
{markup(humanizedType)}
);
@@ -331,21 +342,58 @@ export class GuideSection extends Component {
let defaultValueMarkup = '';
if (defaultValue) {
defaultValueMarkup = [
-
- {defaultValue.value}
- ,
+
+ {defaultValue.value}
+ ,
];
if (defaultValue.comment) {
defaultValueMarkup.push(`(${defaultValue.comment})`);
}
}
+
+ let defaultTypeCell = (
+
+ {typeMarkup}
+
+ );
+ if (functionMatches.length > 0) {
+ const elements = [];
+ let j = 0;
+ for (let i = 0; i < types.length; i++) {
+ if (functionMatches[j]) {
+ elements.push(
+
+ {types[i]}
+
+ );
+ elements.push(
+
+ {functionMatches[j][0]}
+
+ );
+ j++;
+ } else {
+ elements.push(
+
+ {types[i]}
+
+ );
+ }
+ }
+ defaultTypeCell = (
+
+
+ {elements}
+
+
+ );
+ }
+
const cells = [
{humanizedName}
,
-
- {typeMarkup}
- ,
+ defaultTypeCell,