Repository navigation
Closed as not planned
Meta
3 / 33 of 3 issues completed
Copy link
Description
This is a meta ticket to discuss the rollout plan of the CSS in JS solution (Emotion). It is for documenting the expected upgrade process both within EUI and by consuming applications, and being transparent about our timeline.
(Tentative) Timeline & tasks
Spring 2021:
Get the contexts built out and (partially) used in the EUI components and docs, as well as thoroughly tested in downstream applications like Kibana and Cloud. Figure out all the dependencies, hooks and possible state management that go with it.
- EuiContext: Overall context layer that would encompass theming, layering, etc… ([CSS-in-JS] Context and foundation #4440)
- EuiThemeContext: Theme specific layer with at least these properties: ([CSS-in-JS] Context and foundation #4440)
-
themeName -
colorMode: ‘light’ | ‘dark’ -
{ colors: {primar, secondary, etc} }
-
-
<ColorMode>aka:<DarkMode>{component}</DarkMode>for switching of themes at the component level ([CSS-in-JS] Context and foundation #4440)
Summer 2021:
- Build out the theme layer ([CSS-in-JS] Global theme #4643)
- Convert all the SASS invisibles (variables, functions, etc) to JS
- Usage documentation
- Enable Emotion in Kibana (Enable CSS-in-JS styling with
emotionkibana#98157) - Initial release of context layer and global theme ([FEATURE] CSS-in-JS via
emotion, initial release #4511) - Add more documentation ([Docs]
EuiThemeProviderglobal theme switching #5072) - Add global theme context provider in Kibana (Create a theming React context provider integration for applications kibana#108972)
Fall 2021:
Start shifting component styles from SASS to JS. This part will probably take a full year and probably means phasing out the old 'legacy' theme, making Amsterdam default.
- Add global reset file via Emotion ([CSS-in-JS] Global style reset with
emotion#5122) - Deprecate current theme for Amsterdam ([CSS-in-JS] [Breaking] Deprecating EUI theme to Legacy #5222)
- EUI breaking/major release with peerDep on
@emotion/react([CSS-in-JS]@emotion/reactinsrc/#5121) from this point forward using only the generated CSS is not supported, EUI must be used through React
### 2022-2024
- [ ] #5685
Beyond component conversions:
[ ] Deprecate Sass usage in EUI docsNot being done, as EUI docs will be deprecated in favor of EUI+- [Emotion] Memoize all generated styles #7561
- [Emotion] Figure out what exports we do and don't want to make public #7025
- Convert Kibana's usage of
styled-componentsto Emotion - Deprecate using EUI's SCSS mixins/variables
- Elastic Charts theme as an EuiTheme
Needs discussion
- Remove use of
ghostandinkin favor ofEuiThemeProvider+colorMode(see discussion)- I'm not sure if this still needs to be done or if this is something to instead be visited in the new theme/visual refresh work.
- Deprecate using EUI's classnames
- Remove class names (after a lengthy deprecation period)
- For context, the deprecation of
classNames was something Caroline and Greg were pushing for. I'm not convinced that it's even feasible considering Kibana however.
- For context, the deprecation of
Reacted by Elliot Wright, Atif Ali, Gabi Maeztu, Luis Hdez and Gabriel Bianconi
Reacted by Elliot Wright, Jon Marsh, Gerrie van Wyk and Gabi Maeztu
Reacted by Dave Snider, Felix Stürmer, Elizabet Oliveira, Benjamin Kniffler, Søren Louv-Jansen, Andrea Del Rio, Scott Hutcheson, Elliot Wright, Lori Karikari, Pedro Rodriguez Alia and 2 more
Sub-issues
Collapse Sub-issuesSub-issues
Loading 3 sub-issues
Activity
cchaos commentedon Oct 6, 2020
Requests
speedprop (feature request) #4116justifyContentandalignItemslikeEuiFlexGroup#4878[-][Meta] CSS in JS: Switching to Emotion[/-][+][Meta] CSS-in-JS: Switching to `emotion`[/+]cchaos commentedon Aug 15, 2021
Upgrade process
Questions
cssprop on an object prop apply as expectedcreateElementusages, replace with emotion’s createElement equivalent?cssis applied on a custom component which element gets the style? What if there's a fragment at the top level?EUI
See #5685
Charts theme
Can we create a EuiThemeCharts similar to EuiThemeDefault that can be used primarily as a React hook to pass the theme down to an elastic-charts implementation? And it know the light/dark color mode automatically.
Consuming apps
lightwave commentedon Oct 30, 2021
Will EUI theme be compatible with the theme specification used in theme-ui and styled system?
cchaos commentedon Nov 1, 2021
lightwave commentedon Nov 3, 2021
cchaos commentedon Nov 3, 2021
@lightwave I've converted your questions to a discussion to keep this Meta issue centered around tasks. #5351
jlalmes commentedon Nov 23, 2021
Keen to help out with the implementation and rollout for this. Our use case:
"primary","primaryText"colors at runtime using theEuiThemeProvider@elastic/eui/dist/eui_theme_amsterdam_light.csscss file in our bundle.It seems that we're blocked by this PR #4575 which will outline the game plan for moving forward & converting all other components from sass to emotion. What is the current status of this - and how can we help move this PR closer to alpha/beta/production?
cchaos commentedon Nov 23, 2021
👋 Hey @jlalmes, that's exciting and we'd absolutely love the help during the conversion. You are correct about #4575 being the next step in the process. We like to put a lot of thinking up front in the endeavors so it's less likely that we look back and wish we had done it differently 😄 . We've tentatively given ourselves the typically slow month of December to figure that part out and have a final plan hopefully by the beginning of 2022. We totally understand your pain points and we hope this will solve most of them. Mostly we've been having to juggle prioritizing this work in tandem with other consumer priorities.
[-][Meta] CSS-in-JS: Switching to `emotion`[/-][+][Meta][CSS-in-JS] Switching to `emotion`[/+]3 remaining items
docs: deprecate SCSS usage in style guide (#237160)