diff --git a/integration/server/generate/vrt_page_template.js b/integration/server/generate/vrt_page_template.js index c040e81e56..d71d1c5e15 100644 --- a/integration/server/generate/vrt_page_template.js +++ b/integration/server/generate/vrt_page_template.js @@ -20,6 +20,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { VRTPage } from './vrt_page'; import { appendIconComponentCache } from '@elastic/eui/es/components/icon/icon'; + appendIconComponentCache({ arrowUp: require('@elastic/eui/es/components/icon/assets/arrow_up').icon, arrowLeft: require('@elastic/eui/es/components/icon/assets/arrow_left').icon, @@ -32,6 +33,9 @@ appendIconComponentCache({ pencil: require('@elastic/eui/es/components/icon/assets/pencil').icon, visualizeApp: require('@elastic/eui/es/components/icon/assets/app_visualize').icon, }); + +document.querySelector('html')?.classList.add('disable-animations'); + ReactDOM.render(, document.getElementById('story-root') as HTMLElement); `.trim(); diff --git a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-interactions-clicks-hovers-on-legend-items-bar-chart-visually-looks-correct-1-snap.png b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-interactions-clicks-hovers-on-legend-items-bar-chart-visually-looks-correct-1-snap.png index 79ef147912..32d4c8db39 100644 Binary files a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-interactions-clicks-hovers-on-legend-items-bar-chart-visually-looks-correct-1-snap.png and b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-interactions-clicks-hovers-on-legend-items-bar-chart-visually-looks-correct-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-legend-inside-chart-visually-looks-correct-1-snap.png b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-legend-inside-chart-visually-looks-correct-1-snap.png index ae1a0112b4..819d77ae03 100644 Binary files a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-legend-inside-chart-visually-looks-correct-1-snap.png and b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-legend-inside-chart-visually-looks-correct-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-legend-left-visually-looks-correct-1-snap.png b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-legend-left-visually-looks-correct-1-snap.png index 12027bb827..5203eb6a80 100644 Binary files a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-legend-left-visually-looks-correct-1-snap.png and b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-legend-left-visually-looks-correct-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-legend-right-visually-looks-correct-1-snap.png b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-legend-right-visually-looks-correct-1-snap.png index 79ef147912..32d4c8db39 100644 Binary files a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-legend-right-visually-looks-correct-1-snap.png and b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-legend-right-visually-looks-correct-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-stylings-custom-series-colors-via-accessor-function-visually-looks-correct-1-snap.png b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-stylings-custom-series-colors-via-accessor-function-visually-looks-correct-1-snap.png index 1b1c8516e1..c6688968d4 100644 Binary files a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-stylings-custom-series-colors-via-accessor-function-visually-looks-correct-1-snap.png and b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-stylings-custom-series-colors-via-accessor-function-visually-looks-correct-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-stylings-custom-series-colors-via-colors-array-visually-looks-correct-1-snap.png b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-stylings-custom-series-colors-via-colors-array-visually-looks-correct-1-snap.png index cef1bde001..235916de17 100644 Binary files a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-stylings-custom-series-colors-via-colors-array-visually-looks-correct-1-snap.png and b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-stylings-custom-series-colors-via-colors-array-visually-looks-correct-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/area-stories-test-ts-area-series-stories-negative-log-areas-shows-only-negative-values-when-hiding-positive-one-1-snap.png b/integration/tests/__image_snapshots__/area-stories-test-ts-area-series-stories-negative-log-areas-shows-only-negative-values-when-hiding-positive-one-1-snap.png index 5343f3443b..94a030130b 100644 Binary files a/integration/tests/__image_snapshots__/area-stories-test-ts-area-series-stories-negative-log-areas-shows-only-negative-values-when-hiding-positive-one-1-snap.png and b/integration/tests/__image_snapshots__/area-stories-test-ts-area-series-stories-negative-log-areas-shows-only-negative-values-when-hiding-positive-one-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/interactions-test-ts-interactions-tooltips-should-render-current-tooltip-for-split-and-y-accessors-1-snap.png b/integration/tests/__image_snapshots__/interactions-test-ts-interactions-tooltips-should-render-current-tooltip-for-split-and-y-accessors-1-snap.png index 3886f345dc..0ea4e98332 100644 Binary files a/integration/tests/__image_snapshots__/interactions-test-ts-interactions-tooltips-should-render-current-tooltip-for-split-and-y-accessors-1-snap.png and b/integration/tests/__image_snapshots__/interactions-test-ts-interactions-tooltips-should-render-current-tooltip-for-split-and-y-accessors-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-keyboard-navigation-should-navigate-to-legend-item-with-tab-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-keyboard-navigation-should-navigate-to-legend-item-with-tab-1-snap.png index 73b6b04e52..eaebe671d9 100644 Binary files a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-keyboard-navigation-should-navigate-to-legend-item-with-tab-1-snap.png and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-keyboard-navigation-should-navigate-to-legend-item-with-tab-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-left-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-left-1-snap.png index ae1a0112b4..fb7d9eac84 100644 Binary files a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-left-1-snap.png and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-left-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-left-in-dark-mode-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-left-in-dark-mode-1-snap.png index 29b994009e..a962276c64 100644 Binary files a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-left-in-dark-mode-1-snap.png and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-left-in-dark-mode-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-left-in-multiline-mode-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-left-in-multiline-mode-1-snap.png new file mode 100644 index 0000000000..6d12cd33ef Binary files /dev/null and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-left-in-multiline-mode-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-right-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-right-1-snap.png index ae1a0112b4..819d77ae03 100644 Binary files a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-right-1-snap.png and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-right-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-right-in-dark-mode-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-right-in-dark-mode-1-snap.png index 29b994009e..f0aa8d119f 100644 Binary files a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-right-in-dark-mode-1-snap.png and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-right-in-dark-mode-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-right-in-multiline-mode-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-right-in-multiline-mode-1-snap.png new file mode 100644 index 0000000000..ae54f48312 Binary files /dev/null and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-bottom-right-in-multiline-mode-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-left-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-left-1-snap.png index ae1a0112b4..3518aea59e 100644 Binary files a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-left-1-snap.png and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-left-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-left-in-dark-mode-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-left-in-dark-mode-1-snap.png index 29b994009e..a00349dca3 100644 Binary files a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-left-in-dark-mode-1-snap.png and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-left-in-dark-mode-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-left-in-multiline-mode-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-left-in-multiline-mode-1-snap.png new file mode 100644 index 0000000000..f78edf2364 Binary files /dev/null and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-left-in-multiline-mode-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-right-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-right-1-snap.png index ae1a0112b4..33832abddc 100644 Binary files a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-right-1-snap.png and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-right-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-right-in-dark-mode-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-right-in-dark-mode-1-snap.png index 29b994009e..1f81696304 100644 Binary files a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-right-in-dark-mode-1-snap.png and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-right-in-dark-mode-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-right-in-multiline-mode-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-right-in-multiline-mode-1-snap.png new file mode 100644 index 0000000000..de1a34fd81 Binary files /dev/null and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-display-top-right-in-multiline-mode-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-truncate-multiline-labels-up-to-max-lines-set-to-0-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-truncate-multiline-labels-up-to-max-lines-set-to-0-1-snap.png new file mode 100644 index 0000000000..9aa7f17b80 Binary files /dev/null and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-truncate-multiline-labels-up-to-max-lines-set-to-0-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-truncate-multiline-labels-up-to-max-lines-set-to-1-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-truncate-multiline-labels-up-to-max-lines-set-to-1-1-snap.png new file mode 100644 index 0000000000..bd8b4e5971 Binary files /dev/null and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-truncate-multiline-labels-up-to-max-lines-set-to-1-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-truncate-multiline-labels-up-to-max-lines-set-to-3-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-truncate-multiline-labels-up-to-max-lines-set-to-3-1-snap.png new file mode 100644 index 0000000000..9aa7f17b80 Binary files /dev/null and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-legend-inside-chart-should-correctly-truncate-multiline-labels-up-to-max-lines-set-to-3-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-should-breakup-multiline-legend-labels-with-long-continous-words-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-should-breakup-multiline-legend-labels-with-long-continous-words-1-snap.png new file mode 100644 index 0000000000..7b5d17d12b Binary files /dev/null and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-should-breakup-multiline-legend-labels-with-long-continous-words-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-should-correctly-render-multiline-nested-legend-labels-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-should-correctly-render-multiline-nested-legend-labels-1-snap.png new file mode 100644 index 0000000000..39aa2fef0c Binary files /dev/null and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-should-correctly-render-multiline-nested-legend-labels-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-should-correctly-render-very-long-multiline-legend-labels-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-should-correctly-render-very-long-multiline-legend-labels-1-snap.png new file mode 100644 index 0000000000..380903be00 Binary files /dev/null and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-should-correctly-render-very-long-multiline-legend-labels-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-tooltip-placement-with-legend-should-render-tooltip-with-left-legend-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-tooltip-placement-with-legend-should-render-tooltip-with-left-legend-1-snap.png index 5d8c3c4be2..39c1ddd3e0 100644 Binary files a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-tooltip-placement-with-legend-should-render-tooltip-with-left-legend-1-snap.png and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-tooltip-placement-with-legend-should-render-tooltip-with-left-legend-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-tooltip-placement-with-legend-should-render-tooltip-with-right-legend-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-tooltip-placement-with-legend-should-render-tooltip-with-right-legend-1-snap.png index 856176451e..40cafa31a9 100644 Binary files a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-tooltip-placement-with-legend-should-render-tooltip-with-right-legend-1-snap.png and b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-tooltip-placement-with-legend-should-render-tooltip-with-right-legend-1-snap.png differ diff --git a/integration/tests/interactions.test.ts b/integration/tests/interactions.test.ts index 656c4ac1dd..81a280a62e 100644 --- a/integration/tests/interactions.test.ts +++ b/integration/tests/interactions.test.ts @@ -366,6 +366,7 @@ describe('Interactions', () => { { left: 282, top: 80 }, { screenshotSelector: '#story-root', + delay: 1000, }, ); }); diff --git a/integration/tests/legend_stories.test.ts b/integration/tests/legend_stories.test.ts index 5cc9d4bc1b..878e7dafde 100644 --- a/integration/tests/legend_stories.test.ts +++ b/integration/tests/legend_stories.test.ts @@ -27,7 +27,7 @@ describe('Legend stories', () => { }); it('should 0 legend buffer', async () => { await common.expectChartAtUrlToMatchScreenshot( - 'http://localhost:9001/?path=/story/legend--legend-spacing-buffer&knob-legend buffer value=0', + 'http://localhost:9001/?path=/story/legend--legend-spacing-buffer&knob-legend buffer value=0&knob-max legend label lines=1', ); }); it('should have the same order as nested with no indent even if there are repeated labels', async () => { @@ -36,6 +36,24 @@ describe('Legend stories', () => { ); }); + it('should correctly render multiline nested legend labels', async () => { + await common.expectChartAtUrlToMatchScreenshot( + 'http://localhost:9001/?path=/story/legend--piechart&globals=backgrounds.value:!hex(fff);themes.value:Light&knob-Hide color picker=true&knob-Hide color picker_Legend=true&knob-Legend position=right&knob-Legend position_Legend=right&knob-max legend label lines=0&knob-Number of series=5&knob-Popover position=leftCenter&knob-Popover position_Legend=leftCenter&knob-Series with long name=3&knob-direction_Legend=vertical&knob-floating columns_Legend=2&knob-hAlign_Legend=right&knob-legend buffer value=80&knob-legend margins=20&knob-long label text_Legend=Non do aliqua veniam dolore ipsum eu aliquip. Culpa in duis amet non velit qui non ullamco sit adipisicing. Ut sunt Lorem mollit exercitation deserunt officia sunt ipsum eu amet.&knob-multiline Legend labels=true&knob-vAlign_Legend=bottom&knob-Partition Layout=sunburst&knob-flatLegend=&knob-showLegendExtra=&knob-legendMaxDepth=2&knob-legendStrategy=key', + ); + }); + + it('should correctly render very long multiline legend labels', async () => { + await common.expectChartAtUrlToMatchScreenshot( + 'http://localhost:9001/?path=/story/legend--legend-spacing-buffer&globals=backgrounds.value:transparent;themes.value:Light&knob-Hide color picker=true&knob-Hide color picker_Legend=true&knob-Legend position=right&knob-Legend position_Legend=right&knob-Number of series=5&knob-Partition Layout=sunburst&knob-Popover position=leftCenter&knob-Popover position_Legend=leftCenter&knob-Series with long name=3&knob-direction_Legend=vertical&knob-flatLegend=true&knob-floating columns_Legend=2&knob-hAlign_Legend=right&knob-legend buffer value=80&knob-legend margins=20&knob-legendMaxDepth=3&knob-legendStrategy=key&knob-long label text_Legend=Non do aliqua veniam dolore ipsum eu aliquip. Culpa in duis amet non velit qui non ullamco sit adipisicing. Ut sunt Lorem mollit exercitation deserunt officia sunt ipsum eu amet.&knob-max legend label lines=0&knob-showLegendExtra=true&knob-use long labels=true&knob-vAlign_Legend=bottom', + ); + }); + + it('should breakup multiline legend labels with long continous words', async () => { + await common.expectChartAtUrlToMatchScreenshot( + 'http://localhost:9001/?path=/story/legend--inside-chart&globals=backgrounds.value:transparent;themes.value:Light&knob-Inside chart_Legend=false&knob-Legend position_Legend=right&knob-max label lines_Legend=0&knob-Number of series=5&knob-Popover position_Legend=leftCenter&knob-Series with long name=3&knob-direction_Legend=vertical&knob-floating columns_Legend=2&knob-hAlign_Legend=right&knob-long label_Legend=a few separate words then averyongcontinuouswordthatneedstobebrokenup&knob-vAlign_Legend=bottom', + ); + }); + it('should render color picker on mouse click', async () => { const action = async () => { await common.clickMouseRelativeToDOMElement({ left: 0, top: 0 }, '.echLegendItem__color'); @@ -160,25 +178,46 @@ describe('Legend stories', () => { }, ); }); + describe('Legend inside chart', () => { + const getPositionalUrl = (p1: string, p2: string, others: string = '') => + `http://localhost:9001/?path=/story/legend--inside-chart&knob-vAlign_Legend=${p1}&knob-hAlign_Legend=${p2}${others}`; + it.each([ [Position.Top, Position.Left], [Position.Top, Position.Right], [Position.Bottom, Position.Left], [Position.Bottom, Position.Right], - ])('should correctly display %s %s', async (pos1, pos2) => { - await common.expectChartAtUrlToMatchScreenshot( - `http://localhost:9001/?path=/story/legend--inside-chart&knob-Legend Position[0]=${pos1}&knob-Legend Position[1]=${pos2}&globals=themes.value:Light`, - ); + ])('should correctly display %s %s', async (p1, p2) => { + await common.expectChartAtUrlToMatchScreenshot(getPositionalUrl(p1, p2, '&globals=themes.value:Light')); + }); + + it.each([ + [Position.Top, Position.Left], + [Position.Top, Position.Right], + [Position.Bottom, Position.Left], + [Position.Bottom, Position.Right], + ])('should correctly display %s %s in dark mode', async (p1, p2) => { + await common.expectChartAtUrlToMatchScreenshot(getPositionalUrl(p1, p2, '&globals=themes.value:Dark')); }); + + const longLabel = + 'Non do aliqua veniam dolore ipsum eu aliquip. Culpa in duis amet non velit qui non ullamco sit adipisicing. Ut sunt Lorem mollit exercitation deserunt officia sunt ipsum eu amet.'; + it.each([ [Position.Top, Position.Left], [Position.Top, Position.Right], [Position.Bottom, Position.Left], [Position.Bottom, Position.Right], - ])('should correctly display %s %s in dark mode', async (pos1, pos2) => { + ])('should correctly display %s %s in multiline mode', async (p1, p2) => { + await common.expectChartAtUrlToMatchScreenshot( + getPositionalUrl(p1, p2, `&knob-max label lines_Legend=0&knob-long label_Legend=${longLabel}`), + ); + }); + + it.each([0, 1, 3])('should correctly truncate multiline labels up to maxLines set to %d', async (maxLines) => { await common.expectChartAtUrlToMatchScreenshot( - `http://localhost:9001/?path=/story/legend--inside-chart&knob-Legend Position[0]=${pos1}&knob-Legend Position[1]=${pos2}&globals=themes.value:Dark`, + `http://localhost:9001/?path=/story/legend--inside-chart&globals=backgrounds.value:transparent;themes.value:Light&knob-Number of series=5&knob-Series with long name=3&knob-Inside chart_Legend=false&knob-floating columns_Legend=2&knob-vAlign_Legend=bottom&knob-hAlign_Legend=right&knob-direction_Legend=vertical&knob-max label lines_Legend=${maxLines}&knob-long label_Legend=${longLabel}`, ); }); }); diff --git a/package.json b/package.json index 174b10236d..cde24e5276 100644 --- a/package.json +++ b/package.json @@ -13,20 +13,20 @@ }, "scripts": { "prepack": "echo 'This package is not published, see pacakges/*' && exit 1", - "autoprefix:css": "lerna run --loglevel=silent --scope @elastic/charts autoprefix:css --stream", - "api:check": "lerna run --loglevel=silent --scope @elastic/charts api:check --stream", - "api:check:local": "lerna run --loglevel=silent --scope @elastic/charts api:check:local --stream", - "api:extract": "lerna run --loglevel=silent --scope @elastic/charts api:extract --stream", + "autoprefix:css": "lerna run --loglevel=silent --scope @elastic/charts autoprefix:css --stream --no-prefix", + "api:check": "lerna run --loglevel=silent --scope @elastic/charts api:check --stream --no-prefix", + "api:check:local": "lerna run --loglevel=silent --scope @elastic/charts api:check:local --stream --no-prefix", + "api:extract": "lerna run --loglevel=silent --scope @elastic/charts api:extract --stream --no-prefix", "backport": "backport", - "build": "lerna run --loglevel=silent --scope @elastic/charts build --stream", - "build:ts": "lerna run --loglevel=silent --scope @elastic/charts build:ts --stream", - "build:css": "lerna run --loglevel=silent --scope @elastic/charts build:css --stream", - "build:clean": "lerna run --loglevel=silent --scope @elastic/charts build:clean --stream", - "build:compile": "lerna run --loglevel=silent --scope @elastic/charts build:compile --stream", - "build:sass": "lerna run --loglevel=silent --scope @elastic/charts build:sass --stream", - "build:check": "lerna run --loglevel=silent --scope @elastic/charts build:check --stream", - "build:watch": "lerna run --loglevel=silent --scope @elastic/charts build:watch --stream", - "concat:sass": "lerna run --loglevel=silent --scope @elastic/charts concat:sass --stream", + "build": "lerna run --loglevel=silent --scope @elastic/charts build --stream --no-prefix", + "build:ts": "lerna run --loglevel=silent --scope @elastic/charts build:ts --stream --no-prefix", + "build:css": "lerna run --loglevel=silent --scope @elastic/charts build:css --stream --no-prefix", + "build:clean": "lerna run --loglevel=silent --scope @elastic/charts build:clean --stream --no-prefix", + "build:compile": "lerna run --loglevel=silent --scope @elastic/charts build:compile --stream --no-prefix", + "build:sass": "lerna run --loglevel=silent --scope @elastic/charts build:sass --stream --no-prefix", + "build:check": "lerna run --loglevel=silent --scope @elastic/charts build:check --stream --no-prefix", + "build:watch": "lerna run --loglevel=silent --scope @elastic/charts build:watch --stream --no-prefix", + "concat:sass": "lerna run --loglevel=silent --scope @elastic/charts concat:sass --stream --no-prefix", "cz": "git-cz", "lint": "NODE_ENV=production eslint --quiet --ext .tsx,.ts,.js .", "lint:fix": "yarn lint --fix", @@ -36,8 +36,8 @@ "pq": "pretty-quick", "semantic-release": "semantic-release", "start": "yarn storybook", - "storybook": "lerna run --scope charts-storybook start --stream", - "storybook:build": "lerna run --scope charts-storybook build --stream", + "storybook": "lerna run --scope charts-storybook start --stream --no-prefix", + "storybook:build": "lerna run --scope charts-storybook build --stream --no-prefix", "test": "jest --verbose --config jest.config.js", "test:tz": "yarn test:tz-utc && yarn test:tz-ny && yarn test:tz-jp", "test:tz-utc": "TZ=UTC jest --verbose --config=jest.tz.config.js", @@ -52,7 +52,7 @@ "test:integration:generate:examples": "./scripts/extract_examples.sh", "test:integration:generate:page": "./scripts/compile_vrt_page.sh", "test:integration:server": "cd integration/server && RNG_SEED='elastic-charts' webpack serve --content-base integration/server", - "typecheck:src": "lerna run --loglevel=silent --scope @elastic/charts typecheck --stream", + "typecheck:src": "lerna run --loglevel=silent --scope @elastic/charts typecheck --stream --no-prefix", "typecheck:all": "tsc -p ./tsconfig.json --noEmit", "ts:prune": "ts-prune", "link:kibana": "node ./packages/link_kibana" diff --git a/packages/charts/api/charts.api.md b/packages/charts/api/charts.api.md index 8a3cf9ce8f..65aa14d3f2 100644 --- a/packages/charts/api/charts.api.md +++ b/packages/charts/api/charts.api.md @@ -1147,6 +1147,11 @@ export interface LegendColorPickerProps { // @public (undocumented) export type LegendItemListener = (series: SeriesIdentifier[]) => void; +// @public (undocumented) +export interface LegendLabelOptions { + maxLines: number; +} + // @public export type LegendPath = LegendPathElement[]; @@ -1204,6 +1209,7 @@ export type LegendStrategy = $Values; // @public (undocumented) export interface LegendStyle { horizontalHeight: number; + labelOptions: LegendLabelOptions; margin: number; spacingBuffer: number; verticalWidth: number; diff --git a/packages/charts/src/chart_types/xy_chart/utils/dimensions.test.ts b/packages/charts/src/chart_types/xy_chart/utils/dimensions.test.ts index 95c1414881..ad7a28ba27 100644 --- a/packages/charts/src/chart_types/xy_chart/utils/dimensions.test.ts +++ b/packages/charts/src/chart_types/xy_chart/utils/dimensions.test.ts @@ -62,6 +62,9 @@ describe('Computed chart dimensions', () => { horizontalHeight: 10, spacingBuffer: 10, margin: 0, + labelOptions: { + maxLines: 1, + }, }; const defaultTheme = LIGHT_THEME; const chartTheme = { diff --git a/packages/charts/src/components/__snapshots__/chart.test.tsx.snap b/packages/charts/src/components/__snapshots__/chart.test.tsx.snap index b900ee20da..fed2b24d8e 100644 --- a/packages/charts/src/components/__snapshots__/chart.test.tsx.snap +++ b/packages/charts/src/components/__snapshots__/chart.test.tsx.snap @@ -24,22 +24,24 @@ exports[`Chart should render the legend name test 1`] = `
    - +
  • - -
    - - - - - - - -
    -
    -
  • - - - -
    +
  • -
    +
  • - - - -
    +
  • -
    +
  • - - - -
    +
  • -
    +
  • - - - -
    +
  • " `; exports[`Legend #legendColorPicker should match snapshot after onClose is called 1`] = ` -" +"
  • - - - -
    +
  • -
    +
  • - - - -
    +
  • -
    +
  • - - - -
    +
  • -
    +
  • - - - -
    +
  • " @@ -183,24 +199,26 @@ exports[`Legend #legendColorPicker should render colorPicker when color is click `; exports[`Legend #legendColorPicker should render colorPicker when color is clicked 2`] = ` -" +"
  • - - - -
    +
  • @@ -216,64 +234,70 @@ exports[`Legend #legendColorPicker should render colorPicker when color is click
- +
  • - - - -
    +
  • -
    +
  • - - - -
    +
  • -
    +
  • - - - -
    +
  • " diff --git a/packages/charts/src/components/legend/_legend_item.scss b/packages/charts/src/components/legend/_legend_item.scss index c70377fae7..42a6d3508f 100644 --- a/packages/charts/src/components/legend/_legend_item.scss +++ b/packages/charts/src/components/legend/_legend_item.scss @@ -6,12 +6,17 @@ $legendItemHeight: #{$euiFontSizeXS * $euiLineHeight}; display: flex; flex-wrap: nowrap; justify-content: space-between; - align-items: center; + align-items: flex-start; position: relative; - > *:not(.background) { + // wrapper is needed to isolate color icon when wrapped or not + .colorWrapper > *:first-of-type { // euiPopover adds a div with height of 19px otherwise - height: $legendItemHeight; // prevents color dot from shifting + // this prevents color dot from shifting when wrapped + height: $legendItemHeight; + } + + > *:not(.background) { margin-left: $euiSizeXS; &:last-child:not(.echLegendItem__extra) { @@ -43,6 +48,7 @@ $legendItemHeight: #{$euiFontSizeXS * $euiLineHeight}; display: flex; justify-content: center; align-items: center; + height: $legendItemHeight; max-width: calc(#{$legendItemHeight} + #{$euiSizeXS * 2}); .euiPopover, @@ -62,18 +68,28 @@ $legendItemHeight: #{$euiFontSizeXS * $euiLineHeight}; &__label { @include euiFontSizeXS; - @include euiTextTruncate; flex: 1 1 auto; text-align: left; vertical-align: baseline; letter-spacing: unset; align-items: center; - &--clickable { - &:hover { - cursor: pointer; - text-decoration: underline; - } + &--singleline { + @include euiTextTruncate; + } + + // div to prevent changing to button + &--multiline:is(div) { + hyphens: auto; + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; // number of lines to show, overridden in element styles + } + + &--clickable:hover { + cursor: pointer; + text-decoration: underline; } } diff --git a/packages/charts/src/components/legend/label.tsx b/packages/charts/src/components/legend/label.tsx index b4b3d29efb..4b23b127fa 100644 --- a/packages/charts/src/components/legend/label.tsx +++ b/packages/charts/src/components/legend/label.tsx @@ -7,37 +7,60 @@ */ import classNames from 'classnames'; -import React, { MouseEventHandler } from 'react'; +import React, { KeyboardEventHandler, MouseEventHandler, useCallback } from 'react'; + +import { LegendLabelOptions } from '../../utils/themes/theme'; interface LabelProps { label: string; isSeriesHidden?: boolean; isToggleable?: boolean; - onClick?: MouseEventHandler; + onToggle?: (negate: boolean) => void; + options: LegendLabelOptions; } /** * Label component used to display text in legend item * @internal */ -export function Label({ label, isToggleable, onClick, isSeriesHidden }: LabelProps) { +export function Label({ label, isToggleable, onToggle, isSeriesHidden, options }: LabelProps) { + const maxLines = Math.abs(options.maxLines); const labelClassNames = classNames('echLegendItem__label', { - 'echLegendItem__label--clickable': Boolean(onClick), + 'echLegendItem__label--clickable': Boolean(onToggle), + 'echLegendItem__label--singleline': maxLines === 1, + 'echLegendItem__label--multiline': maxLines > 1, }); + const onClick: MouseEventHandler = useCallback(({ shiftKey }) => onToggle?.(shiftKey), [onToggle]); + const onKeyDown: KeyboardEventHandler = useCallback( + ({ key, shiftKey }) => { + if (key === ' ' || key === 'Enter') onToggle?.(shiftKey); + }, + [onToggle], + ); + + const title = options.maxLines > 0 ? label : ''; // full text already visible + const clampStyles = maxLines > 1 ? { WebkitLineClamp: maxLines } : {}; + return isToggleable ? ( - +
    ) : ( -
    +
    {label}
    ); diff --git a/packages/charts/src/components/legend/legend.tsx b/packages/charts/src/components/legend/legend.tsx index f93fcecb71..0bb39812e9 100644 --- a/packages/charts/src/components/legend/legend.tsx +++ b/packages/charts/src/components/legend/legend.tsx @@ -103,6 +103,7 @@ function LegendComponent(props: LegendStateProps & LegendDispatchProps) { toggleDeselectSeriesAction: props.onToggleDeselectSeriesAction, colorPicker: config.legendColorPicker, action: config.legendAction, + labelOptions: legend.labelOptions, }; const positionStyle = legendPositionStyle(config, size, chartDimensions, containerDimensions); return ( diff --git a/packages/charts/src/components/legend/legend_item.tsx b/packages/charts/src/components/legend/legend_item.tsx index 201a983eed..5c5723a5ba 100644 --- a/packages/charts/src/components/legend/legend_item.tsx +++ b/packages/charts/src/components/legend/legend_item.tsx @@ -30,6 +30,7 @@ import { } from '../../state/actions/legend'; import { Color, LayoutDirection } from '../../utils/common'; import { deepEqual } from '../../utils/fast_deep_equal'; +import { LegendLabelOptions } from '../../utils/themes/theme'; import { Color as ItemColor } from './color'; import { renderExtra } from './extra'; import { Label as ItemLabel } from './label'; @@ -45,6 +46,7 @@ export interface LegendItemProps { positionConfig: LegendPositionConfig; extraValues: Map; showExtra: boolean; + labelOptions: LegendLabelOptions; colorPicker?: LegendColorPicker; action?: LegendAction; onClick?: LegendItemListener; @@ -113,19 +115,19 @@ export class LegendListItem extends Component /** * Returns click function only if toggleable or click listern is provided */ - handleLabelClick = (legendItemId: SeriesIdentifier[]): MouseEventHandler | undefined => { + onLabelToggle = (legendItemId: SeriesIdentifier[]): ((negate: boolean) => void) | undefined => { const { item, onClick, toggleDeselectSeriesAction, totalItems } = this.props; if (totalItems <= 1 || (!item.isToggleable && !onClick)) { return; } - return ({ shiftKey }) => { + return (negate) => { if (onClick) { onClick(legendItemId); } if (item.isToggleable) { - toggleDeselectSeriesAction(legendItemId, shiftKey); + toggleDeselectSeriesAction(legendItemId, negate); } }; }; @@ -163,7 +165,16 @@ export class LegendListItem extends Component } render() { - const { extraValues, item, showExtra, colorPicker, totalItems, action: Action, positionConfig } = this.props; + const { + extraValues, + item, + showExtra, + colorPicker, + totalItems, + action: Action, + positionConfig, + labelOptions, + } = this.props; const { color, isSeriesHidden, isItemHidden, seriesIdentifiers, label, pointStyle } = item; if (isItemHidden) return null; @@ -189,19 +200,22 @@ export class LegendListItem extends Component data-ech-series-name={label} >
    - +
    + +
    1 && item.isToggleable} - onClick={this.handleLabelClick(seriesIdentifiers)} + onToggle={this.onLabelToggle(seriesIdentifiers)} isSeriesHidden={isSeriesHidden} /> {extra && !isSeriesHidden && renderExtra(extra)} diff --git a/packages/charts/src/components/tooltip/_tooltip.scss b/packages/charts/src/components/tooltip/_tooltip.scss index 9e53efaa00..a8890837d4 100644 --- a/packages/charts/src/components/tooltip/_tooltip.scss +++ b/packages/charts/src/components/tooltip/_tooltip.scss @@ -46,8 +46,7 @@ } &__label { - overflow-wrap: break-word; - word-wrap: break-word; + hyphens: auto; min-width: 1px; flex: 1 1 auto; } diff --git a/packages/charts/src/utils/themes/dark_theme.ts b/packages/charts/src/utils/themes/dark_theme.ts index 3e45e79f86..f09f1b3b93 100644 --- a/packages/charts/src/utils/themes/dark_theme.ts +++ b/packages/charts/src/utils/themes/dark_theme.ts @@ -170,6 +170,9 @@ export const DARK_THEME: Theme = { horizontalHeight: 64, spacingBuffer: 10, margin: 0, + labelOptions: { + maxLines: 1, + }, }, crosshair: { band: { diff --git a/packages/charts/src/utils/themes/light_theme.ts b/packages/charts/src/utils/themes/light_theme.ts index 4221264954..54d25a179b 100644 --- a/packages/charts/src/utils/themes/light_theme.ts +++ b/packages/charts/src/utils/themes/light_theme.ts @@ -170,6 +170,9 @@ export const LIGHT_THEME: Theme = { horizontalHeight: 64, spacingBuffer: 10, margin: 0, + labelOptions: { + maxLines: 1, + }, }, crosshair: { band: { diff --git a/packages/charts/src/utils/themes/theme.ts b/packages/charts/src/utils/themes/theme.ts index b6cff2f933..b78753a4fd 100644 --- a/packages/charts/src/utils/themes/theme.ts +++ b/packages/charts/src/utils/themes/theme.ts @@ -199,6 +199,19 @@ export interface BackgroundStyle { */ color: string; } + +/** @public */ +export interface LegendLabelOptions { + /** + * Sets maxlines allowable before truncating + * + * Setting value to `0` will _never_ truncate the text + * + * @defaultValue 1 + */ + maxLines: number; +} + /** @public */ export interface LegendStyle { /** @@ -225,6 +238,10 @@ export interface LegendStyle { * TODO: make SimplePadding when after axis changes are added */ margin: number; + /** + * Options to control legend labels + */ + labelOptions: LegendLabelOptions; } /** @public */ export interface Theme { diff --git a/storybook/stories/legend/10_sunburst.tsx b/storybook/stories/legend/10_sunburst.tsx index f6b2d2c189..deeb2eae35 100644 --- a/storybook/stories/legend/10_sunburst.tsx +++ b/storybook/stories/legend/10_sunburst.tsx @@ -39,7 +39,8 @@ export const Example = () => { max: 3, step: 1, }); - const legendStrategy = select('legendStrategy', LegendStrategy, LegendStrategy.Key); + const legendStrategy = select('legendStrategy', LegendStrategy, LegendStrategy.Key as LegendStrategy); + const maxLines = number('max legend label lines', 1, { min: 0, step: 1 }); return ( @@ -50,6 +51,7 @@ export const Example = () => { legendStrategy={legendStrategy} legendMaxDepth={legendMaxDepth} baseTheme={useBaseTheme()} + theme={{ legend: { labelOptions: { maxLines } } }} /> ); +const getLabelOptionKnobs = (): LegendLabelOptions => { + const group = 'Label options'; + + return { + maxLines: number('max label lines', 1, { min: 0, step: 1 }, group), + }; +}; + export const Example = () => { - const hideActions = boolean('Hide legend action', false); - const showLegendExtra = !boolean('Hide legend extra', false); - const showColorPicker = !boolean('Hide color picker', true); - const legendPosition = getPositionKnob('Legend position'); - const euiPopoverPosition = getEuiPopoverPositionKnob(); + const hideActions = boolean('Hide legend action', false, 'Legend'); + const showLegendExtra = !boolean('Hide legend extra', false, 'Legend'); + const showColorPicker = !boolean('Hide color picker', true, 'Legend'); + const legendPosition = getPositionKnob('Legend position', undefined, 'Legend'); + const euiPopoverPosition = getEuiPopoverPositionKnob(undefined, undefined, 'Legend'); + const labelOptions = getLabelOptionKnobs(); return ( ( margin: number('legend margins', 20, { min: 0, }), + labelOptions: { + maxLines: number('max legend label lines', 2, { min: 0, step: 1 }), + }, }, }} baseTheme={useBaseTheme()} diff --git a/storybook/stories/legend/13_inside_chart.tsx b/storybook/stories/legend/13_inside_chart.tsx index f4ad558cf9..17702db472 100644 --- a/storybook/stories/legend/13_inside_chart.tsx +++ b/storybook/stories/legend/13_inside_chart.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { select, boolean, number } from '@storybook/addon-knobs'; +import { select, boolean, number, text } from '@storybook/addon-knobs'; import React from 'react'; import { @@ -76,6 +76,7 @@ export const Example = () => { LayoutDirection.Vertical, 'Legend', ); + const maxLines = number('max label lines', 1, { min: 0, step: 1 }, 'Legend'); return ( @@ -89,6 +90,9 @@ export const Example = () => { floating, floatingColumns, }} + theme={{ + legend: { labelOptions: { maxLines } }, + }} baseTheme={useBaseTheme()} /> @@ -110,7 +114,7 @@ export const Example = () => { if (i >= seriesWithLongName * 10 && i < seriesWithLongName * 10 + 10) { return { ...d, - g: 'long name', + g: text('long label', 'long name', 'Legend'), }; } return d; diff --git a/storybook/stories/legend/8_spacing_buffer.tsx b/storybook/stories/legend/8_spacing_buffer.tsx index d1b85715f9..6e0069e22c 100644 --- a/storybook/stories/legend/8_spacing_buffer.tsx +++ b/storybook/stories/legend/8_spacing_buffer.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { number } from '@storybook/addon-knobs'; +import { boolean, number } from '@storybook/addon-knobs'; import React from 'react'; import { Axis, BarSeries, Chart, Position, ScaleType, Settings, PartialTheme } from '@elastic/charts'; @@ -17,8 +17,12 @@ export const Example = () => { const theme: PartialTheme = { legend: { spacingBuffer: number('legend buffer value', 80), + labelOptions: { + maxLines: number('max legend label lines', 0, { min: 0, step: 1 }), + }, }, }; + const longLabels = boolean('use long labels', false); return ( @@ -27,7 +31,7 @@ export const Example = () => { Number(d).toFixed(2)} /> { ]} /> +export const getPositionKnob = (name = 'chartRotation', defaultValue: Position = Position.Right, group?: string) => select( name, { @@ -111,6 +111,7 @@ export const getPositionKnob = (name = 'chartRotation', defaultValue: Position = Bottom: Position.Bottom, }, defaultValue, + group, ); export const getPlacementKnob = (name = 'placement', defaultValue?: Placement, groupId?: string) => { @@ -158,6 +159,7 @@ export const getStickToKnob = (name = 'stickTo', defaultValue = TooltipStickTo.M export const getEuiPopoverPositionKnob = ( name = 'Popover position', defaultValue: PopoverAnchorPosition = 'leftCenter', + group?: string, ) => select( name, @@ -176,6 +178,7 @@ export const getEuiPopoverPositionKnob = ( rightDown: 'rightDown', }, defaultValue, + group, ); export function arrayKnobs(name: string, values: (string | number)[]): (string | number)[] {