Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into list-group-ts-defs
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Mar 20, 2019
2 parents 4a648e2 + bff0469 commit 5ac2845
Show file tree
Hide file tree
Showing 8 changed files with 9,217 additions and 9,190 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@

- Adds type definitions for `EuiListGroup` and `EuiListGroupItem` ([#1737](https://github.com/elastic/eui/pull/1737))

## [`9.4.2`](https://github.com/elastic/eui/tree/v9.4.2)

**Bug fixes**

- Fixed `hexToRgb` from erroring on an incorrect string input ([#1741](https://github.com/elastic/eui/pull/1741))
- Fixed `EuiBadge` custom `color` prop type ([#1741](https://github.com/elastic/eui/pull/1741))
- Fixed inaccurately required `onRefresh` prop (should be optional) that was introduced in types in version 9.4.1 ([#1743](https://github.com/elastic/eui/pull/1743))

## [`9.4.1`](https://github.com/elastic/eui/tree/v9.4.1)

**Bug fixes**

- Adds missing type and fixes closure-scope problem for `SuperDatePicker`'s `onRefresh` callback ([#1732](https://github.com/elastic/eui/pull/1732))
- Changed `EuiBottomBar` to refer to the end of document ([#1727](https://github.com/elastic/eui/pull/1727))
- Fixed `EuiComboBox`'s calls to its `onBlur` prop ([#1739](https://github.com/elastic/eui/pull/1739))

## [`9.4.0`](https://github.com/elastic/eui/tree/v9.4.0)

Expand Down
18,358 changes: 9,182 additions & 9,176 deletions docs/bundle.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "@elastic/eui",
"description": "Elastic UI Component Library",
"version": "9.4.0",
"version": "9.4.2",
"license": "Apache-2.0",
"main": "lib",
"module": "es",
"types": "eui.d.ts",
"postcss": {},
"docker_image": "node:8",
"sideEffects": false,
"scripts": {
"preinstall": "node ./preinstall_check",
"start": "webpack-dev-server --port 8030 --inline --hot --config=src-docs/webpack.config.js",
Expand Down
2 changes: 1 addition & 1 deletion src/components/badge/badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const EuiBadge = ({

function checkValidColor(props, propName, componentName) {
const validHex = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(props.color);
if (props.color && !validHex && !COLORS.includes(props.color)) {
if (props.color != null && !validHex && !COLORS.includes(props.color)) {
throw new Error(
`${componentName} needs to pass a valid color. This can either be a three ` +
`or six character hex value or one of the following: ${COLORS}`
Expand Down
18 changes: 10 additions & 8 deletions src/components/combo_box/combo_box.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,19 +286,20 @@ export class EuiComboBox extends Component {
const focusedInInput = this.comboBox && this.comboBox.contains(e.relatedTarget);
if (!focusedInOptionsList && !focusedInInput) {
this.closeList();
}

// If the user tabs away or changes focus to another element, take whatever input they've
// typed and convert it into a pill, to prevent the combo box from looking like a text input.
if (!this.hasActiveOption() && !focusedInInput && !focusedInOptionsList) {
this.addCustomOption();
if (this.props.onBlur) {
this.props.onBlur();
}

// If the user tabs away or changes focus to another element, take whatever input they've
// typed and convert it into a pill, to prevent the combo box from looking like a text input.
if (!this.hasActiveOption()) {
this.addCustomOption();
}
}
}

onComboBoxBlur = () => {
if (this.props.onBlur) {
this.props.onBlur();
}
this.setState({ hasFocus: false });
}

Expand Down Expand Up @@ -571,6 +572,7 @@ export class EuiComboBox extends Component {
onChange, // eslint-disable-line no-unused-vars
onSearchChange, // eslint-disable-line no-unused-vars
async, // eslint-disable-line no-unused-vars
onBlur, // eslint-disable-line no-unused-vars
isInvalid,
rowHeight,
isClearable,
Expand Down
2 changes: 1 addition & 1 deletion src/components/date_picker/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ declare module '@elastic/eui' {
isPaused?: boolean;
refreshInterval?: number;
onTimeChange: (props: OnTimeChangeProps) => void;
onRefresh: (props: OnRefreshProps) => void;
onRefresh?: (props: OnRefreshProps) => void;
onRefreshChange?: (props: OnRefreshChangeProps) => void;
commonlyUsedRanges?: EuiSuperDatePickerCommonRange[];
dateFormat?: string;
Expand Down
11 changes: 9 additions & 2 deletions src/services/color/hex_to_rgb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ export function hexToRgb(hex: string): rgbDef {
(m, r1, g1, b1) => r1 + r1 + g1 + g1 + b1 + b1
);

const [, r, g, b] = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)!;
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16)];
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)!;

if (result) {
const [, r, g, b] = result;
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16)];
}

// fallback to prevent errors
return [0, 0, 0];
}

0 comments on commit 5ac2845

Please sign in to comment.