Giter Club home page Giter Club logo

eui's Introduction

Elastic UI Framework

The Elastic UI Framework is a collection of React UI components for quickly building user interfaces at Elastic.

Check out our full documentation site which contains many examples of components in the EUI framework aesthetic, and how to use them in your products. Our FAQ below covers common usage questions โ€” for other general questions regarding EUI, check out the Discussions tab.

Frequently Asked Questions

What is the Elastic UI Framework?

The Elastic UI Framework (EUI) is a design library in use at Elastic to build React applications that need to share our branding and aesthetics. It distributes typed UI React components and static assets for use in building web layouts. Alongside the React components, we ship theme & style utilities that can be used independently on their own.

The primary goal of this library is to provide reusable UI components that can be used throughout Elastic's web products. As React components, they remove CSS from the process of building UIs. As a single source of truth, the framework allows our designers to make changes to our aesthetic directly in the code. And unit test coverage for the UI components allows us to deliver a stable "API for user interfaces".

Can I use EUI?

Please see Elastic's licensing FAQ: Iโ€™m using EUI or Elastic Charts in my application outside of Kibana, how does this affect me?

Why is EUI open source?

Many of Elastic's products are open source and rely upon this library to function. The Elastic UI Framework began as a folder of code in Kibana and we decided it could be used beyond that codebase. It exists as an independent library so that patterns can be shared across teams and design standards can be scaled across our organization. Since most of our products are open source, we treat this one similarly as far as public publishing and conversation even if its usage tends to focus more inward towards Elastic itself.

What is the versioning, release, and upgrade strategy?

We use semver for versioning and use that to denote breaking changes in EUI upgrades. Traditionally we consider API changes in our prop names or existing component functionality to be a reason for a breaking change, but do not track the renaming of CSS selectors, mixins or other style changes under this same rigor.

Traditionally releases are made weekly against whatever is in the main branch and you can upgrade from NPM as you see fit.

Can I contribute to EUI?

Yes! We welcome community-contributed PRs, especially around feature requests that the EUI team may not have bandwidth to carry out alone. You can find documentation around creating and submitting new components in our wiki.

What about reporting bugs and feature requests?

Bug reports and feature requests are most welcome, but our roadmap and prioritization are driven primarily by internal Elastic usage.

Please note that in order to keep our backlog manageable and focused on tasks we intend to complete, feature requests & tech debt issues that are inactive for a year will be auto-closed (bugs will remain open if determined to be reproducible and valid).

This activity counter can be soft reset by commenting on the issue directly, but please do so mindfully. We would ask that you proactively let the EUI team know why this request matters to you or how it impacts you or your users, in order to help us prioritize accordingly.

The EUI team, like everyone else, has a finite amount of time and resources, and it is not humanly possible for us to implement every task or feature requested of us. However, that's where the beauty of open source comes in - if your request is important to you, we strongly encourage you to contribute code directly to EUI that addresses your issue or request!

What is the status of EUI's theming?

The EUI library was previously built upon Sass and is in the process of migrating to CSS-in-JS (specifically Emotion). While this work is in progress, we ask for your patience with our in-between state in areas such as documentation and setup.

If you're a Kibana developer with questions around CSS-in-JS usage in Kibana, please check out our FAQ discussion!

Wiki

Our wiki docs contain instructions and guidelines on multiple areas of EUI usage and development that are too detailed for an initial README. For more information, see:

License

Dual-licensed under Elastic v2 and Server Side Public License, v1. See Elastic's licensing FAQ for details.

eui's People

Contributors

1copenut avatar andreadelrio avatar anishagg17 avatar ashikmeerankutty avatar bevacqua avatar breehall avatar cchaos avatar cee-chen avatar chandlerprall avatar cjcenizal avatar daveyholler avatar dependabot[bot] avatar dmeiss avatar ffknob avatar jasonstoltz avatar joshmock avatar mdefazio avatar michaelmarcialis avatar miukimiu avatar nreese avatar pugnascotia avatar renovate[bot] avatar ryankeairns avatar snide avatar stacey-gammon avatar theodesp avatar thompsongl avatar tkajtoch avatar uboness avatar weltenwort avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eui's Issues

Disabled radio behavior

Cursor is still a pointer

I would also posit that we don't sufficiently distinguish between disabled components and active components (in general), the color change is barely noticeable and the cursor change is only noticed when mousing over. A more clear distinction would improve UX

<EuiButton> should be able to render links

Sometimes we need to style a link like a button, which KuiButton can't do. react-bootstrap takes the approach of switch what element is rendered depending on whether an href is passed, so we could take that approach perhaps. I don't know if that gets tricker with e.g. react-router.

Popover too coupled

I think Popover might be the only case where I smell code in this otherwise pristine library.

Popover examples look like this:

default class extends Component {
  state = {
    isPopoverOpen: false,
  }

  onButtonClick() {
    this.setState({
      isPopoverOpen: !this.state.isPopoverOpen,
    });
  }

  closePopover() {
    this.setState({
      isPopoverOpen: false,
    });
  }

  render() {
    const button = (
      <EuiButton
        iconType="arrowDown"
        iconSide="right"
        onClick={this.onButtonClick.bind(this)}
      >
        Show popover
      </EuiButton>
    );

    return (
      <EuiPopover
        ownFocus
        button={button}
        isOpen={this.state.isPopoverOpen}
        closePopover={this.closePopover.bind(this)}
      >
        <div style={{ width: '300px' }}>Popover content that&rsquo;s wider than the default width</div>
      </EuiPopover>
    );
  }
}

Some issues I see here:

  • Hierarchy: the button is a tree-child of the popover, but information-wise the popover is the child, since you can't ever see it if you don't click the button
  • Coupling: I should be able to connect popovers to all kinds of things, not just buttons specifically. What if I want more control, like a popover on hover or a popover for autocomplete that shows up in some way I want to program up?
  • Even though we have coupled popover and the button that it's "appended to", we still have to manually manage state to open/close and determine whether the popover is open/closed

Having looked at the HTML, that answers the first problem: the popover creates a DOM node that wraps the button, when the popover is open a panel is shown next to it, and CSS gives it the effect that makes it pop over the button. So far so good.

I realize this is a subtle problem with a complicated UI component, but to me we should consider either of:

  • Have the <EuiPopover> handle open/close state on its own
  • Untangle the components by doing something like:
<EuiPopover popup={ MyPopup }>
  {
    ({ isOpen, toggle }) =>
      <button onClick={ toggle }>
        { isOpen ? 'Close' : 'Open' }
      </button>
  }
</EuiPopover>

function MyPopup({ close }) {
  return <div>
    <h1>This is what pops up</h1>
    <button onClick={ close }>Close</button>
  </div>
}

What I like about such approach is that we'd force the consumer to decouple the popover contents from the trigger, we simplify the state management by handling most of it, we don't implicitly name the trigger heavily suggesting it should be a button, and the popup can live separate from the, e.g, menu bar that's probably not all that related to the contents.

Similarly to the trigger mechanism, we can pass a close prop to MyPopup, maybe expecting ({ close }) => <MyPopup close={ close } /> or a functional component directly, which takes it as a prop without any middleware functions

Thoughts? @cjcenizal

CSS compile needs to hot load on file change

@bevacqua @pugnascotia Funny didn't notice this till now, but it doesn't look like the CSS compiles on a change to the SCSS files. If you can help me out there I can take on a bunch of those issues in the issue list. Sorry, I'm pretty oblivious to Webpack so I don't know how to trigger it.

EuiFormHelpText adds a lot of padding when below EuiProgress

Maybe EuiFormHelpText wasn't intended to be widely used outside of EUI, but we did adopt it extensively in our Cloud experiment, and it looks a bit off when added right below a progress like so:

  <span>
    <EuiProgress value={ used } max={ total } />
    <EuiFormHelpText>
      <FormattedMessage
        id='allocated-feature-stats-table.available-capacity'
        defaultMessage='{available} of {total}'
        values={ {
          available: prettySize(available),
          total: prettySize(total)
        } } />
    </EuiFormHelpText>
  </span>

screen shot 2017-10-28 at 14 53 56

Responsive modals

Need to make modals responsive. Will likely need to fix the height of the body to trap the scrolling behavior to the modal itself, then remove the masking / container for the modal so it's just a single "page" action.

<EuiHeaderLogo> is Kibana specific

Implementation:

<a href={href} className={classes} {...rest}>
  <EuiIcon
    className="euiHeaderLogo__icon"
    type="logoKibana"
    size="xLarge"
    title="Go to Kibana home page"
  />
</a>

It should allow the user to set the type (and, perhaps, default to logoElastic or at least to nothingness), and it should not have the Go to Kibana title, which can be provided by the consumer.

Table cells should have a way to turn off text mode

In this snippet:

<span className="kuiTableCellContent__text">

The issue is that when we want to render full-width cells such as Node distribution in the following table:

screen shot 2017-10-23 at 11 41 15

We need to do something like .ourTable .kuiTableCellContent__text { width: 100% }. Is this reasonable, or should we have a prop to turn off the text mode, whereby we don't add the extra span highlighted here:

screen shot 2017-10-23 at 11 43 22

I'd rather not have consumers need to dig into the internal classes as much as possible (in the context of React components at least), since that's the value in React for the most part, abstracting the classes away

In conclusion, would it be possible to do something like:

{
  this.props.allowOverflow === true
    ? children
    : <span className='kuiTableCellContent__text'>{ children }</span>
}

Figure out `eui.now.sh` build automation

We need a CI job on Travis or similar to build eui.now.sh on every change to master. I think this is the right approach at this time.

Alternatively, long-term, I would say we need a deploy task that takes care of bumping the package version, publishing to npm, and deploying to now.

Palette names

As noted in #54, we use "text" and "default" to refer to similar palette colors, which could be confusing for people.

Badge uses "default":

image

ButtonEmpty uses "text":

image

My suggestion is to just drop "text" and use "default" instead, since a prop of color="text" doesn't mean much to me, especially in the case of <KuiTextColor color="text">.

Add block styling to EuiCode

@cjcenizal @bevacqua Was thinking

<EuiCode format="block">{code}</EuiCode>

with inline being the default format?

Then maybe adding a highlight prop that will do highlight.js rendering? Might also need a size prop for size of the text used?

I have the styling in my head, but if you have any specific ideas for how you want this componentized lemme know.

Text right below an input looks funny

This may be just me misusing the component library, but when we have:

<EuiFieldText
  value={ currentValue }
  onChange={ e => this.updateValue(e.target.value) } />

<EuiText>
  <FormattedMessage
    id='region-settings-index.specify-a-cname-description'
    defaultMessage='Specify a CNAME that replaces the default hostname. This CNAME is used to modify your cluster and Kibana endpoints.' />
</EuiText>

It renders them kind of super close:

screen shot 2017-10-24 at 20 25 57

I'm 100% fine if this is not intended to be optimal in the context of EUI.

Default icon color

We currently do

.euiIcon { fill: black }
.euiIcon__basic { fill: black }  // which I'm not sure why we even apply since the main class already does this

I suggest that we consider { fill: currentColor } as that's way easier to work around without mushing with CSS

Thoughts @snide?

Yeoman tasks

We need to add NPM scripts for running these tasks. In Kibana, these scripts are defined as:

    "uiFramework:createComponent": "yo ./ui_framework/generator-kui/app/component.js",
    "uiFramework:documentComponent": "yo ./ui_framework/generator-kui/app/documentation.js"

I think createComponent and createDocumentation might be better names. Suggestions welcome.

NPM script for running Jest tests

For reference, here's the config we're using in Kibana:

{
  "rootDir": "../../",
  "roots": [
    "<rootDir>/src/core_plugins",
    "<rootDir>/ui_framework/"
  ],
  "collectCoverageFrom": [
    "ui_framework/src/components/**/*.js",
    "!ui_framework/src/components/index.js",
    "!ui_framework/src/components/**/*/index.js",
    "ui_framework/src/services/**/*.js",
    "!ui_framework/src/services/index.js",
    "!ui_framework/src/services/**/*/index.js"
  ],
  "moduleNameMapper": {
    "^ui_framework/components": "<rootDir>/ui_framework/components",
    "^ui_framework/services": "<rootDir>/ui_framework/services",
    "^ui_framework/src/test": "<rootDir>/ui_framework/src/test",
    "^ui/(.*)": "<rootDir>/src/ui/public/$1",
    "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/jest/mocks/file_mock.js",
    "\\.(css|less|scss)$": "<rootDir>/src/jest/mocks/style_mock.js"
  },
  "setupFiles": [
    "<rootDir>/src/jest/setup/request_animation_frame_polyfill.js"
  ],
  "coverageDirectory": "<rootDir>/target/jest-coverage",
  "coverageReporters": [
    "html"
  ],
  "moduleFileExtensions": [
    "js",
    "json"
  ],
  "testMatch": [
    "**/*.test.js"
  ],
  "testPathIgnorePatterns": [
    "<rootDir>/ui_framework/dist/",
    "<rootDir>/ui_framework/doc_site/",
    "<rootDir>/ui_framework/generator-kui/"
  ],
  "transform": {
    "^.+\\.js$": "<rootDir>/src/jest/babelTransform.js"
  },
  "transformIgnorePatterns": [
    "[/\\\\]node_modules[/\\\\].+\\.js$"
  ],
  "snapshotSerializers": [
    "<rootDir>/node_modules/enzyme-to-json/serializer"
  ]
}

Figure out bottom bar component padding issues

Bottom bar uses fixed position on the screen. This means it will often overlap content at the bottom of the normally rendered page. We should find some way to apply a bottom padding (bottom bar height + $kuiSizeL) to the bottom of the page to account for it.

Possibilities I can think of:

  • Do a domNode check and just apply a class to the body. Only one body in a page, so should be ok.
  • Make some sort of prop on a body component to account for this kind of thing. Lower level item would need to talk up the chain.

Fix arrow coloring in popovers with context menus

The popover arrows need to be more aware of context menu title in regards to color. Right now they'll always appear dark no matter the position or usage. I have this mostly working for popovers themselves, just need to rework it for context menus.

image

Open-source

  • OK from Kevin
  • Licensing (PR open at #20)
  • Figure out eui.now.sh build automation (issue #21)

<KuiButton> needs submit prop

We're shadowing type='submit' for <button> because type is used to declare primary, secondary, and so on.

<button
disabled={isDisabled}
className={classes}
{...rest}

We should either rename type to something else such as hue='danger', or add a submit prop that results in <button type='submit'>.

Both approaches have their pros and cons. type fits the button "roles" very well, role would also clash with aria props, etc. At the same time, submit={ Boolean } wouldn't fix support for <button type='button'> either.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.