Adjusting EuiToken for use as ES field types#2758
Merged
cchaos merged 19 commits intoelastic:masterfrom Feb 5, 2020
Merged
Conversation
added 13 commits
January 10, 2020 16:37
…ette Slight changes to these colors: - Neon pink became light pink - Primary is no longer used but uses the blue from vis palette instead
…ph names Cleans up Token code Makes background color more subtle
- Fill now takes ‘light’, ‘dark’, or ‘none’ - No more `hideBorder`, comes with ‘light’ fill
- Had to create a couple mixins to support changing the tint color from the graphic to behindText variant - $tokenTypes -> $euiTokenTypes - Now restricting to only 10 colors - removed 12 (hot pink) - changed usage of 11 (hot green) to 00 (vis green) - Added $euiPaletteColorBlindKeys for finding if key exists in map
…me names for the vis palette (euiColorVis) Plus on extra called “gray” that gets appended via SASS map-merge
- Allowing passing of a custom color value (but only works with none or dark fill)
cchaos
commented
Jan 14, 2020
ryankeairns
approved these changes
Jan 15, 2020
Contributor
ryankeairns
left a comment
There was a problem hiding this comment.
This looks great, my feedback is largely suggestions so marking as Approved.
Side note
The files weren't touched directly by this PR, but the tokens in the Tree View component seem a little smaller than they were previously, perhaps on the verge of too small.
chandlerprall
suggested changes
Jan 17, 2020
chandlerprall
approved these changes
Feb 4, 2020
Contributor
chandlerprall
left a comment
There was a problem hiding this comment.
Changes LGTM; pulled & tested locally
Contributor
Author
|
Jenkins, test this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Live build: https://cchaos-current-pr.netlify.com/#/display/icons
With the unfortunate demise of Code, we were left with the opportunity to reuse EuiToken for our need to provide a service/icon for representing ES field type (which are showcased all over Kibana and in different ways at the moment).
This PR, causes some breaking changes to EuiToken to suit these new needs, but without completely butchering the original intent (hopefully, @daveyholler).
I will start by explaining the changes I've made and then demonstrate use cases.
Changes (visual and code-breaking)
Prop changes
Before, in order to change the display of the token you had to pass an object called
displayOptionswhich supported the keys ofcolor,shape,fill, andhideBorder. Now, you can pass these keys directly to the EuiToken component as props.More on the actual prop value changes below.
Color
Visual
When we test using the Tokens as they were in Discover, the colors were very bright and were a bit too Crayola. This PR subdues the background by fading it even more and decreasing the contrast of the border.
Entire list of icon before and after below.
Code
The originally accepted colors for tokens was an array of enums from
tokenTint01totokenTint10that were mapped to colors in a SASS map. It used a combination of brand palette, vis palette, and custom hex values. I was able to remap these colors to use all vis palette colors plus the addition of a 'gray'.To reduce cognitive load on the consumer, however, I removed the idea that they had to remember or look for the colors of these custom tokenTint colors. Instead, they can use the vis palette naming scheme that has already been established and be found on the Colors guideline page (
euiColorVis0toeuiColorVis9).Further, EuiToken now allows consumers to pass any valid color string as the color property. If it is not one of the vis named colors, it will simply create the token version that has the fully colored background.
Fill
Previously
fillwas a simple boolean that, when true, would turn the normally faded background color to a non-faded (fully opaque) background color. Now, this prop is an enum supporting:lightfor the faded versiondarkfor the non-faded versionnonefor no background at allFixes
When using the
fill=trueit changed the icon's fill from being the color supplied to a hard-coded white. This could cause issues with contrast, so instead, the newfill=darkproperty, useslightOrDarkTextto determine if the text should be white or black.hideBorder
This property has been completely removed in favor of the simple fill properties above.
However, the original border was an outset box-shadow that would turn the normally
16x16token into a visually18x18token. The main issue I ran into was that this would cause the icon to get cut off if it's parent hadoverflow: hidden.Example:

So instead I changed the box shadow to be inset, which maintains the visual size and fixes this problem. Though maybe the spacing between icon and and border are not as ideal.
Final changes of the original set
Only a few colors values for the token types have changed but overall kept the original design.
More icons
EuiToken uses a subset of icons that begin with
tokenliketokenString. These are essentially 12x12 pixel versions of the originals. To maintain pixel alignment at these smaller sizes the glyphs themselves were tweaked. Therefore, I also had to add token (12x12) versions of:These are the ES field type tokens created for Kibana:
Example usage in Discover
I also updated EuiDataGridShchema to extend EuiToken instead of simply EuiIcon
Checklist
Will do all the unchecked list items after review in case there are major changes.