Skip to content

Commit

Permalink
Revert "[Storybook] Add stories for more components (letters R-S) - P…
Browse files Browse the repository at this point in the history
…art 2 (elastic#7728)"

This reverts commit bd992c1.
  • Loading branch information
tkajtoch committed May 17, 2024
1 parent ae12f8d commit 1208d9a
Show file tree
Hide file tree
Showing 19 changed files with 7 additions and 474 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,10 @@ export class EuiSelectableList<T> extends Component<
static defaultProps = {
rowHeight: 32,
searchValue: '',
isVirtualized: true as const,
isVirtualized: true,
};

private animationFrameId: number | undefined;
// counter for tracking list renders and ensuring rerenders
private listRowRerender = 0;

constructor(props: EuiSelectableListProps<T>) {
super(props);
Expand Down Expand Up @@ -260,47 +258,9 @@ export class EuiSelectableList<T> extends Component<
}
};

shouldComponentUpdate(
nextProps: Readonly<EuiSelectableListProps<T>>
): boolean {
const {
allowExclusions,
showIcons,
paddingSize,
textWrap,
onFocusBadge,
searchable,
} = this.props;

// using shouldComponentUpdate to determine needed rerender before actual rerender
// without needing state updates or lagging behind on updates
if (
nextProps.allowExclusions !== allowExclusions ||
nextProps.showIcons !== showIcons ||
nextProps.paddingSize !== paddingSize ||
nextProps.textWrap !== textWrap ||
nextProps.onFocusBadge !== onFocusBadge ||
nextProps.searchable !== searchable
) {
this.listRowRerender += 1;
}

return true;
}

componentDidUpdate(prevProps: EuiSelectableListProps<T>) {
const {
isVirtualized,
activeOptionIndex,
visibleOptions,
options,
allowExclusions,
showIcons,
paddingSize,
textWrap,
onFocusBadge,
searchable,
} = this.props;
const { isVirtualized, activeOptionIndex, visibleOptions, options } =
this.props;

if (prevProps.activeOptionIndex !== activeOptionIndex) {
const { makeOptionId } = this.props;
Expand Down Expand Up @@ -338,20 +298,6 @@ export class EuiSelectableList<T> extends Component<
...this.calculateAriaSetAttrs(optionArray),
});
}

// ensure that ListRow updates based on item props
if (isVirtualized) {
if (
prevProps.allowExclusions !== allowExclusions ||
prevProps.showIcons !== showIcons ||
prevProps.paddingSize !== paddingSize ||
prevProps.textWrap !== textWrap ||
prevProps.onFocusBadge !== onFocusBadge ||
prevProps.searchable !== searchable
) {
this.forceVirtualizedListRowRerender();
}
}
}

// This utility is necessary to exclude group labels from the aria set count
Expand Down Expand Up @@ -732,7 +678,7 @@ export class EuiSelectableList<T> extends Component<
React.createElement(
this.ListRow,
{
key: `${index}-${this.listRowRerender}`,
key: index,
data: this.state.optionArray,
index,
},
Expand Down

This file was deleted.

This file was deleted.

4 changes: 1 addition & 3 deletions packages/eui/src/components/selectable/selectable_option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import { CommonProps, ExclusiveUnion } from '../common';
import type { EuiTextTruncateProps } from '../text_truncate';
import { EuiToolTipProps } from '../tool_tip';

export const OPTION_CHECKED_STATES = ['on', 'off', 'mixed', undefined] as const;
export type EuiSelectableOptionCheckedType =
(typeof OPTION_CHECKED_STATES)[number];
export type EuiSelectableOptionCheckedType = 'on' | 'off' | 'mixed' | undefined;

export type EuiSelectableOptionBase = CommonProps & {
/**
Expand Down
Loading

0 comments on commit 1208d9a

Please sign in to comment.