Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] EUI Visual Refresh Integration #204434

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cqliu1
Copy link
Contributor

@cqliu1 cqliu1 commented Dec 16, 2024

Summary

Related to #203132.
Closes #204591.

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

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, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests 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
  • 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 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

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.

@cqliu1 cqliu1 changed the title [Maps][Borealis] Replace euiThemeVars usage [Maps] EUI Visual Refresh Dec 17, 2024
@cqliu1 cqliu1 changed the title [Maps] EUI Visual Refresh [Maps] EUI Visual Refresh Integration Dec 17, 2024
@cqliu1 cqliu1 marked this pull request as ready for review December 18, 2024 05:20
@cqliu1 cqliu1 requested a review from a team as a code owner December 18, 2024 05:20
@cqliu1 cqliu1 added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v9.0.0 Feature:Maps EUI Visual Refresh labels Dec 18, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@cqliu1 cqliu1 added release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels labels Dec 18, 2024
@elasticmachine
Copy link
Contributor

elasticmachine commented Dec 18, 2024

💔 Build Failed

Failed CI Steps

History

@nreese nreese self-requested a review December 18, 2024 14:39
textY: number;
formattedValue: string | number;
circleCenterY: number;
circleStyle: CSSProperties;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

circleStyle is defined in props but never used in props.

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about the direction where EUI themes are only available in a react component. There are times when we need access to EUI themes outside of a react component. For example, to get hex codes to pass to map-libre. I think we need to loop in @elastic/kibana-design and have a discussion about their plans to deprecate euiThemeVars as this will not work for maps and external libraries like maplibre.

onWidthChange,
}) => {
const { euiTheme } = useEuiTheme();
const circleStyle = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about removing circleStyle const here

value={formattedValue}
/>
<circle
style={{ ...circleStyle, stroke: euiTheme.colors.textParagraph }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then use circleStyle from props here.

@@ -62,7 +61,8 @@ export function VectorStyleLegend({
);
}

function renderMasksByFieldOrigin(fieldOrigin: FIELD_ORIGIN) {
function MasksByFieldOrigin({ fieldOrigin }: { fieldOrigin: FIELD_ORIGIN }) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that MasksByFieldOrigin is a react component, how about moving it into a separate file?

@@ -246,9 +246,11 @@ export class DynamicColorProperty extends DynamicStyleProperty<ColorDynamicOptio
return this._chartsPaletteServiceGetColor('__other__');
}

const { euiTheme } = useEuiTheme();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like euiTheme is unused

@@ -19,7 +18,7 @@ export const OTHER_CATEGORY_LABEL = i18n.translate(
}
);

export const OTHER_CATEGORY_DEFAULT_COLOR = euiThemeVars.euiColorLightShade;
export const OTHER_CATEGORY_DEFAULT_COLOR_TOKEN = 'textSubdued';
Copy link
Contributor

@nreese nreese Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'textSubdued' is not going to work. This value is passed to maplibre for rendering and must be a hex value. For example, this is what a map looks like with a value of 'textSubdued'. The reason being is that OTHER_CATEGORY_DEFAULT_COLOR_TOKEN is used to create a maplibre expression. The expression is invalid with a value of 'textSubdued' so maplibre does not include the expression and all styling is lost.

Screenshot 2024-12-18 at 7 54 00 AM

When instead, it should look like this
Screenshot 2024-12-18 at 7 55 18 AM

@ryankeairns
Copy link
Contributor

I am not sure about the direction where EUI themes are only available in a react component. There are times when we need access to EUI themes outside of a react component. For example, to get hex codes to pass to map-libre. I think we need to loop in @elastic/kibana-design and have a discussion about their plans to deprecate euiThemeVars as this will not work for maps and external libraries like maplibre.

This should loop in @elastic/eui-team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels EUI Visual Refresh Feature:Maps release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Maps] EUI Visual Refresh Integration and QA
5 participants