Skip to content

Commit

Permalink
Merge branch 'master' into header_sections
Browse files Browse the repository at this point in the history
  • Loading branch information
cchaos authored Mar 2, 2020
2 parents c27867f + aea12fa commit 4b75fdc
Show file tree
Hide file tree
Showing 125 changed files with 1,245 additions and 423 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- `EuiButton` now has a single return statement ([#2954](https://github.com/elastic/eui/pull/2954))
- Added `isSortable` props to `EuiDataGridColumn` and `EuiDataGridSchemaDetector` to mark them as un-sortable ([#2952](https://github.com/elastic/eui/pull/2952))
- Converted `EuiForm` to TypeScript, added many missing `/form` Prop types ([#2896](https://github.com/elastic/eui/pull/2896))
- Empty table th elements replaced with td in `EuiTable`. ([#2934](https://github.com/elastic/eui/pull/2934))
- Added default prompt text to `aria-describedby` for `EuiFilePicker` ([#2919](https://github.com/elastic/eui/pull/2919))
- Added SASS variables for text variants of the primary palette `$euiColorPrimaryText`, `$euiColorSecondaryText`, etc... Updated components to use these new variables. ([#2873](https://github.com/elastic/eui/pull/2873))
- Updated SASS mixin `makeHighContrastColor()` to default `$background: $euiPageBackgroundColor` and `$ratio: 4.5`. Created `makeGraphicContrastColor()` for graphic specific contrast levels of 3.0. ([#2873](https://github.com/elastic/eui/pull/2873))
- Added `arrowDisplay` prop to `EuiAccordion` for changing side or hiding completely ([#2914](https://github.com/elastic/eui/pull/2914))
- Added `prepend` and `append` ability to `EuiFieldSearch` ([#2914](https://github.com/elastic/eui/pull/2914))
- Added `notification` and `notificationColor` props to `EuiHeaderSectionItemButton` ([#2914](https://github.com/elastic/eui/pull/2914))
- Added `folderCheck`, `folderExclamation`, `push`, `quote`, `reporter` and `users` icons ([#2935](https://github.com/elastic/eui/pull/2935))
- Updated `folderClosed` and `folderOpen` to match new additions and sit better on the pixel grid ([#2935](https://github.com/elastic/eui/pull/2935))
- Added `sections` and `position` props to `EuiHeader` ([#2928](https://github.com/elastic/eui/pull/2928))

**Bug fixes**

- Fixed `EuiDataGrid` breaking if invalid schema passed ([#2955](https://github.com/elastic/eui/pull/2955))
- Fixed `EuiTitle` not rendering child classes ([#2925](https://github.com/elastic/eui/pull/2925))
- Extended `div` element in `EuiFlyout` type ([#2914](https://github.com/elastic/eui/pull/2914))
- Fixed popover positioning service to be more lenient when positioning 0-width or 0-height content ([#2948](https://github.com/elastic/eui/pull/2948))

**Theme: Amsterdam**

- Altered `secondary`, `accent` colors to be more saturated ([#2873](https://github.com/elastic/eui/pull/2873))

## [`20.0.1`](https://github.com/elastic/eui/tree/v20.0.1)

**Bug fixes**

- Added TypeScript definition for `EuiCodeEditor`'s accepting `react-ace` props ([#2926](https://github.com/elastic/eui/pull/2926))
- Added `@types/react-input-autosize` to project's `dependencies` ([#2930](https://github.com/elastic/eui/pull/2930))

## [`20.0.0`](https://github.com/elastic/eui/tree/v20.0.0)

Expand Down
6 changes: 3 additions & 3 deletions docs/bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/bundle.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@types/lodash": "^4.14.116",
"@types/numeral": "^0.0.25",
"@types/react-beautiful-dnd": "^10.1.0",
"@types/react-input-autosize": "^2.0.2",
"@types/react-virtualized": "^9.18.7",
"chroma-js": "^2.0.4",
"classnames": "^2.2.5",
Expand Down Expand Up @@ -89,7 +90,6 @@
"@types/jest": "^24.0.6",
"@types/react": "^16.9.11",
"@types/react-dom": "^16.9.4",
"@types/react-input-autosize": "^2.0.1",
"@types/react-is": "^16.7.1",
"@types/resize-observer-browser": "^0.1.1",
"@types/tabbable": "^3.1.0",
Expand Down
3 changes: 0 additions & 3 deletions src-docs/src/actions/action_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ export default keyMirror({
REGISTER_SECTION: null,
UNREGISTER_SECTION: null,

// Theme actions
TOGGLE_THEME: null,

// Locale actions
TOGGLE_LOCALE: null,
});
2 changes: 0 additions & 2 deletions src-docs/src/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export { toggleTheme } from './theme_actions';

export { toggleLocale } from './locale_actions';
8 changes: 0 additions & 8 deletions src-docs/src/actions/theme_actions.js

This file was deleted.

7 changes: 1 addition & 6 deletions src-docs/src/components/guide_page/guide_page_chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@ export class GuidePageChrome extends Component {
closePopover={this.closePopover.bind(this)}>
<EuiPopoverTitle>Docs options</EuiPopoverTitle>
<div className="guideOptionsPopover">
<GuideThemeSelector
onToggleTheme={this.props.onToggleTheme}
selectedTheme={this.props.selectedTheme}
/>
<GuideThemeSelector />
{location.host === 'localhost:8030' ? ( // eslint-disable-line no-restricted-globals
<GuideLocaleSelector
onToggleLocale={this.props.onToggleLocale}
Expand Down Expand Up @@ -332,8 +329,6 @@ export class GuidePageChrome extends Component {

GuidePageChrome.propTypes = {
currentRoute: PropTypes.object.isRequired,
onToggleTheme: PropTypes.func.isRequired,
selectedTheme: PropTypes.string.isRequired,
onToggleLocale: PropTypes.func.isRequired,
selectedLocale: PropTypes.string.isRequired,
navigation: PropTypes.array.isRequired,
Expand Down
43 changes: 39 additions & 4 deletions src-docs/src/components/guide_section/guide_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,53 @@ export class GuideSection extends Component {
if (name === 'javascript') {
renderedCode = renderedCode
.replace(
/(from )'(..\/)+src\/components(\/?';)/,
/(from )'(..\/)+src\/components(\/?';)/g,
"from '@elastic/eui';"
)
.replace(
/(from )'(..\/)+src\/services(\/?';)/,
/(from )'(..\/)+src\/services(\/?';)/g,
"from '@elastic/eui/lib/services';"
)
.replace(
/(from )'(..\/)+src\/components\/.*?';/,
/(from )'(..\/)+src\/components\/.*?';/g,
"from '@elastic/eui';"
);
renderedCode = renderedCode.split('\n');
let linesWithImport = [];
// eslint-disable-next-line guard-for-in
for (const idx in renderedCode) {
const line = renderedCode[idx];
if (
line.includes('import') &&
line.includes("from '@elastic/eui';")
) {
linesWithImport.push(line);
renderedCode[idx] = '';
}
}

if (linesWithImport.length > 1) {
linesWithImport[0] = linesWithImport[0].replace(
" } from '@elastic/eui';",
','
);
for (let i = 1; i < linesWithImport.length - 1; linesWithImport++) {
linesWithImport[i] = linesWithImport[i]
.replace('import {', '')
.replace(" } from '@elastic/eui';", ',');
}
linesWithImport[linesWithImport.length - 1] = linesWithImport[
linesWithImport.length - 1
].replace('import {', '');
}
const newImport = linesWithImport.join('');
renderedCode.unshift(newImport);
renderedCode = renderedCode.join('\n');
let len = renderedCode.replace('\n\n\n', '\n\n').length;
while (len < renderedCode.length) {
renderedCode = renderedCode.replace('\n\n\n', '\n\n');
len = renderedCode.replace('\n\n\n', '\n\n').length;
}
} else if (name === 'html') {
renderedCode = code.render();
}
Expand Down Expand Up @@ -461,7 +497,6 @@ GuideSection.propTypes = {
PropTypes.arrayOf(PropTypes.string),
]),
children: PropTypes.any,
toggleTheme: PropTypes.func.isRequired,
theme: PropTypes.string.isRequired,
routes: PropTypes.object.isRequired,
props: PropTypes.object,
Expand Down
12 changes: 2 additions & 10 deletions src-docs/src/components/guide_section/guide_section_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,12 @@ import { connect } from 'react-redux';

import { GuideSection } from './guide_section';

import { getTheme, getRoutes } from '../../store';

import { toggleTheme } from '../../actions';
import { getRoutes } from '../../store';

function mapStateToProps(state) {
return {
theme: getTheme(state),
routes: getRoutes(state),
};
}

export const GuideSectionContainer = connect(
mapStateToProps,
{
toggleTheme,
}
)(GuideSection);
export const GuideSectionContainer = connect(mapStateToProps)(GuideSection);
Original file line number Diff line number Diff line change
@@ -1,59 +1,28 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import React from 'react';

import { ThemeContext } from '../with_theme';
import { EuiSelect, EuiFormRow } from '../../../../src/components';
import { EUI_THEMES } from '../../../../src/themes';

export class GuideThemeSelector extends Component {
constructor(props) {
super(props);

this.themeOptions = [
{
text: 'Light',
value: 'light',
},
{
text: 'Dark',
value: 'dark',
},
{
text: 'Amsterdam: Light',
value: 'amsterdam-light',
},
{
text: 'Amsterdam: Dark',
value: 'amsterdam-dark',
},
];

this.state = {
value: this.themeOptions[0].value,
};
}

onChange = e => {
this.setState({
value: e.target.value,
});
};

render() {
return (
<EuiFormRow label="Theme">
<EuiSelect
options={this.themeOptions}
value={this.props.selectedTheme}
onChange={e => {
this.props.onToggleTheme(e.target.value);
}}
aria-label="Switch the theme"
/>
</EuiFormRow>
);
}
}
export const GuideThemeSelector = () => {
return (
<ThemeContext.Consumer>
{context => <GuideThemeSelectorComponent context={context} />}
</ThemeContext.Consumer>
);
};

GuideThemeSelector.propTypes = {
onToggleTheme: PropTypes.func.isRequired,
selectedTheme: PropTypes.string.isRequired,
const GuideThemeSelectorComponent = ({ context }) => {
return (
<EuiFormRow label="Theme">
<EuiSelect
options={EUI_THEMES}
value={context.theme}
onChange={e => {
context.changeTheme(e.target.value);
}}
aria-label="Switch the theme"
/>
</EuiFormRow>
);
};
2 changes: 1 addition & 1 deletion src-docs/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export { GuidePage, GuidePageChrome } from './guide_page';

export { GuideSection, GuideSectionTypes } from './guide_section';

export { withTheme } from './with_theme';
export { ThemeProvider, ThemeContext } from './with_theme';
1 change: 0 additions & 1 deletion src-docs/src/components/with_theme/index.js

This file was deleted.

1 change: 1 addition & 0 deletions src-docs/src/components/with_theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ThemeProvider, ThemeContext } from './theme_context';
51 changes: 51 additions & 0 deletions src-docs/src/components/with_theme/theme_context.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from 'react';
import { EUI_THEMES, EUI_THEME } from '../../../../src/themes';
// @ts-ignore
import { applyTheme } from '../../services';

const defaultState = {
theme: EUI_THEMES[0].value,
changeTheme: (themeValue: EUI_THEME['value']) => {
applyTheme(themeValue);
},
};

interface State {
theme: EUI_THEME['value'];
}

export const ThemeContext = React.createContext(defaultState);

export class ThemeProvider extends React.Component<object, State> {
constructor(props: object) {
super(props);

const theme = localStorage.getItem('theme') || defaultState.theme;
applyTheme(theme);

this.state = {
theme,
};
}

changeTheme = (themeValue: EUI_THEME['value']) => {
this.setState({ theme: themeValue }, () => {
localStorage.setItem('theme', themeValue);
applyTheme(themeValue);
});
};

render() {
const { children } = this.props;
const { theme } = this.state;
return (
<ThemeContext.Provider
value={{
theme,
changeTheme: this.changeTheme,
}}>
{children}
</ThemeContext.Provider>
);
}
}
11 changes: 0 additions & 11 deletions src-docs/src/components/with_theme/with_theme.js

This file was deleted.

50 changes: 50 additions & 0 deletions src-docs/src/views/accordion/accordion_arrow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React from 'react';

import {
EuiAccordion,
EuiText,
EuiCode,
EuiSpacer,
} from '../../../../src/components';

export default () => (
<div>
<EuiAccordion
id="accordion10"
buttonContent="Arrows default to the left"
paddingSize="s">
<EuiText>
<p>
Any content inside of <EuiCode>EuiAccordion</EuiCode> will appear
here.
</p>
</EuiText>
</EuiAccordion>
<EuiSpacer />
<EuiAccordion
id="accordion11"
arrowDisplay="right"
buttonContent="This one has it on the right"
paddingSize="s">
<EuiText>
<p>
Any content inside of <EuiCode>EuiAccordion</EuiCode> will appear
here.
</p>
</EuiText>
</EuiAccordion>
<EuiSpacer />
<EuiAccordion
id="accordion12"
arrowDisplay="none"
buttonContent="This one has it removed entirely"
paddingSize="s">
<EuiText>
<p>
Any content inside of <EuiCode>EuiAccordion</EuiCode> will appear
here.
</p>
</EuiText>
</EuiAccordion>
</div>
);
Loading

0 comments on commit 4b75fdc

Please sign in to comment.