Skip to content

Commit

Permalink
[Controls] EUI Visual Refresh Integration (elastic#204439)
Browse files Browse the repository at this point in the history
## Summary

Related to elastic#203132.
Part of [elastic#204593](elastic#204593).

This replaces all references to euiThemeVars in favor of the useEuiTheme
hook for controls.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
cqliu1 and kibanamachine authored Dec 18, 2024
1 parent 07c85dc commit 160311c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const OptionsListPopoverSuggestionBadge = ({ documentCount }: { documentC
size="xs"
aria-hidden={true}
className="eui-textNumber"
color={euiTheme.colors.subduedText}
color={euiTheme.colors.textSubdued}
data-test-subj="optionsList-document-count-badge"
css={css`
font-weight: ${euiTheme.font.weight.medium} !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@

import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';

import { EuiHighlight, EuiSelectable } from '@elastic/eui';
import { EuiHighlight, EuiSelectable, useEuiTheme } from '@elastic/eui';
import { EuiSelectableOption } from '@elastic/eui/src/components/selectable/selectable_option';
import { useBatchedPublishingSubjects } from '@kbn/presentation-publishing';
import { euiThemeVars } from '@kbn/ui-theme';

import { OptionsListSuggestions } from '../../../../../common/options_list/types';
import { OptionsListSelection } from '../../../../../common/options_list/options_list_selections';
Expand All @@ -35,6 +34,8 @@ export const OptionsListPopoverSuggestions = ({
displaySettings: { hideExists },
} = useOptionsListContext();

const { euiTheme } = useEuiTheme();

const [
sort,
searchString,
Expand Down Expand Up @@ -147,13 +148,13 @@ export const OptionsListPopoverSuggestions = ({
if (!listbox) return;

const { scrollTop, scrollHeight, clientHeight } = listbox;
if (scrollTop + clientHeight >= scrollHeight - parseInt(euiThemeVars.euiSizeXXL, 10)) {
if (scrollTop + clientHeight >= scrollHeight - parseInt(euiTheme.size.xxl, 10)) {
// reached the "bottom" of the list, where euiSizeXXL acts as a "margin of error" so that the user doesn't
// have to scroll **all the way** to the bottom in order to load more options
stateManager.requestSize.next(totalCardinality ?? MAX_OPTIONS_LIST_REQUEST_SIZE);
api.loadMoreSubject.next(null); // trigger refetch with loadMoreSubject
}
}, [api.loadMoreSubject, stateManager.requestSize, totalCardinality]);
}, [api.loadMoreSubject, euiTheme.size.xxl, stateManager.requestSize, totalCardinality]);

const renderOption = useCallback(
(option: EuiSelectableOption, searchStringValue: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ export const rangeSliderControlStyles = (euiThemeContext: UseEuiTheme) => {
&:placeholder-shown,
&::placeholder {
font-weight: ${euiTheme.font.weight.regular};
color: ${euiTheme.colors.subduedText};
color: ${euiTheme.colors.textSubdued};
}
`,
invalid: css`
&:not(:invalid) {
color: ${euiTheme.colors.warningText};
color: ${euiTheme.colors.textWarning};
}
&:invalid {
color: ${euiTheme.colors.dangerText};
color: ${euiTheme.colors.textDanger};
}
`,
// unset the red underline for values between steps
Expand Down
1 change: 0 additions & 1 deletion src/plugins/controls/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"@kbn/i18n-react",
"@kbn/datemath",
"@kbn/config-schema",
"@kbn/ui-theme",
"@kbn/safer-lodash-set",
"@kbn/ui-actions-plugin",
"@kbn/core-mount-utils-browser",
Expand Down

0 comments on commit 160311c

Please sign in to comment.