mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
apply prettier styles
This commit is contained in:
parent
64ad4f3f92
commit
bf04235dae
7130 changed files with 31393 additions and 37163 deletions
|
@ -26,7 +26,7 @@ const debounce = require('lodash/function/debounce');
|
|||
const platform = require('os').platform();
|
||||
const isPlatformWindows = /^win/.test(platform);
|
||||
|
||||
module.exports = function(grunt) {
|
||||
module.exports = function (grunt) {
|
||||
grunt.initConfig({
|
||||
clean: {
|
||||
target: ['target'],
|
||||
|
@ -62,7 +62,7 @@ module.exports = function(grunt) {
|
|||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.registerTask('prodBuild', ['clean:target', 'copy:makeProdBuild', 'babel:prodBuild']);
|
||||
|
||||
grunt.registerTask('docSiteBuild', function() {
|
||||
grunt.registerTask('docSiteBuild', function () {
|
||||
const done = this.async();
|
||||
|
||||
const serverCmd = {
|
||||
|
@ -94,17 +94,17 @@ module.exports = function(grunt) {
|
|||
uiFrameworkServerBuild.then(done);
|
||||
});
|
||||
|
||||
grunt.registerTask('docSiteStart', function() {
|
||||
grunt.registerTask('docSiteStart', function () {
|
||||
const done = this.async();
|
||||
Promise.all([uiFrameworkWatch(), uiFrameworkServerStart()]).then(done);
|
||||
});
|
||||
|
||||
grunt.registerTask('compileCssLight', function() {
|
||||
grunt.registerTask('compileCssLight', function () {
|
||||
const done = this.async();
|
||||
uiFrameworkCompileLight().then(done);
|
||||
});
|
||||
|
||||
grunt.registerTask('compileCssDark', function() {
|
||||
grunt.registerTask('compileCssDark', function () {
|
||||
const done = this.async();
|
||||
uiFrameworkCompileDark().then(done);
|
||||
});
|
||||
|
@ -146,19 +146,19 @@ module.exports = function(grunt) {
|
|||
const src = 'src/kui_light.scss';
|
||||
const dest = 'dist/kui_light.css';
|
||||
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve) => {
|
||||
sass.render(
|
||||
{
|
||||
file: src,
|
||||
},
|
||||
function(error, result) {
|
||||
function (error, result) {
|
||||
if (error) {
|
||||
grunt.log.error(error);
|
||||
}
|
||||
|
||||
postcss([postcssConfig])
|
||||
.process(result.css, { from: src, to: dest })
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
grunt.file.write(dest, result.css);
|
||||
|
||||
if (result.map) {
|
||||
|
@ -176,19 +176,19 @@ module.exports = function(grunt) {
|
|||
const src = 'src/kui_dark.scss';
|
||||
const dest = 'dist/kui_dark.css';
|
||||
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve) => {
|
||||
sass.render(
|
||||
{
|
||||
file: src,
|
||||
},
|
||||
function(error, result) {
|
||||
function (error, result) {
|
||||
if (error) {
|
||||
grunt.log.error(error);
|
||||
}
|
||||
|
||||
postcss([postcssConfig])
|
||||
.process(result.css, { from: src, to: dest })
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
grunt.file.write(dest, result.css);
|
||||
|
||||
if (result.map) {
|
||||
|
|
|
@ -25,7 +25,7 @@ export const registerSection = (id, name) => ({
|
|||
name,
|
||||
});
|
||||
|
||||
export const unregisterSection = id => ({
|
||||
export const unregisterSection = (id) => ({
|
||||
type: ActionTypes.UNREGISTER_SECTION,
|
||||
id,
|
||||
});
|
||||
|
|
|
@ -19,4 +19,4 @@
|
|||
|
||||
import React from 'react';
|
||||
|
||||
export const GuideCode = props => <code className="guideCode">{props.children}</code>;
|
||||
export const GuideCode = (props) => <code className="guideCode">{props.children}</code>;
|
||||
|
|
|
@ -65,7 +65,7 @@ export class GuideCodeViewer extends Component {
|
|||
'is-code-viewer-open': this.props.isOpen,
|
||||
});
|
||||
|
||||
const codeSections = this.props.source.map(sourceObject =>
|
||||
const codeSections = this.props.source.map((sourceObject) =>
|
||||
this.renderSection(sourceObject.type, sourceObject.code)
|
||||
);
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ export class GuideDemo extends Component {
|
|||
});
|
||||
|
||||
return (
|
||||
<div className={classes} ref={c => (this.content = c)} {...rest}>
|
||||
<div className={classes} ref={(c) => (this.content = c)} {...rest}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import React from 'react';
|
||||
|
||||
export const GuideLink = props => (
|
||||
export const GuideLink = (props) => (
|
||||
<a href={props.href} target={props.target} className="guideLink">
|
||||
{props.children}
|
||||
</a>
|
||||
|
|
|
@ -120,7 +120,7 @@ export class GuideNav extends Component {
|
|||
});
|
||||
|
||||
const componentNavItems = this.props.components
|
||||
.filter(item => item.name.toLowerCase().indexOf(this.state.search.toLowerCase()) !== -1)
|
||||
.filter((item) => item.name.toLowerCase().indexOf(this.state.search.toLowerCase()) !== -1)
|
||||
.map((item, index) => {
|
||||
const icon = item.hasReact ? <div className="guideNavItem__reactLogo" /> : undefined;
|
||||
return (
|
||||
|
@ -135,7 +135,7 @@ export class GuideNav extends Component {
|
|||
});
|
||||
|
||||
const sandboxNavItems = this.props.sandboxes
|
||||
.filter(item => item.name.toLowerCase().indexOf(this.state.search.toLowerCase()) !== -1)
|
||||
.filter((item) => item.name.toLowerCase().indexOf(this.state.search.toLowerCase()) !== -1)
|
||||
.map((item, index) => {
|
||||
const icon = item.hasReact ? <div className="guideNavItem__reactLogo" /> : undefined;
|
||||
return (
|
||||
|
|
|
@ -21,7 +21,7 @@ import { connect } from 'react-redux';
|
|||
import { getSections } from '../../store';
|
||||
import { GuidePage } from './guide_page';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
sections: getSections(state),
|
||||
});
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
|
||||
export const GuidePageSideNav = props => {
|
||||
export const GuidePageSideNav = (props) => {
|
||||
return (
|
||||
<div className="guidePageSideNav">
|
||||
<div className="guidePageSideNav__title">{props.title}</div>
|
||||
|
|
|
@ -19,4 +19,4 @@
|
|||
|
||||
import React from 'react';
|
||||
|
||||
export const GuideText = props => <div className="guideText">{props.children}</div>;
|
||||
export const GuideText = (props) => <div className="guideText">{props.children}</div>;
|
||||
|
|
|
@ -58,16 +58,16 @@ const routes = [
|
|||
];
|
||||
|
||||
// Update document title with route name.
|
||||
const onRouteEnter = route => {
|
||||
const onRouteEnter = (route) => {
|
||||
const leafRoute = route.routes[route.routes.length - 1];
|
||||
document.title = leafRoute.name
|
||||
? `Kibana UI Framework - ${leafRoute.name}`
|
||||
: 'Kibana UI Framework';
|
||||
};
|
||||
|
||||
const syncTitleWithRoutes = routesList => {
|
||||
const syncTitleWithRoutes = (routesList) => {
|
||||
if (!routesList) return;
|
||||
routesList.forEach(route => {
|
||||
routesList.forEach((route) => {
|
||||
route.onEnter = onRouteEnter; // eslint-disable-line no-param-reassign
|
||||
if (route.indexRoute) {
|
||||
// Index routes have a weird relationship with their "parent" routes,
|
||||
|
|
|
@ -159,14 +159,14 @@ export default {
|
|||
return allRoutes;
|
||||
},
|
||||
getPreviousRoute: function getPreviousRoute(routeName) {
|
||||
const index = allRoutes.findIndex(item => {
|
||||
const index = allRoutes.findIndex((item) => {
|
||||
return item.name === routeName;
|
||||
});
|
||||
|
||||
return index >= 0 ? allRoutes[index - 1] : undefined;
|
||||
},
|
||||
getNextRoute: function getNextRoute(routeName) {
|
||||
const index = allRoutes.findIndex(item => {
|
||||
const index = allRoutes.findIndex((item) => {
|
||||
return item.name === routeName;
|
||||
});
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ function one(str) {
|
|||
}
|
||||
|
||||
function each(items, src, dest) {
|
||||
return items.map(item => {
|
||||
return items.map((item) => {
|
||||
const _item = item;
|
||||
_item[dest] = one(_item[src]);
|
||||
return _item;
|
||||
|
|
|
@ -40,7 +40,7 @@ export default function sectionsReducer(state = defaultState, action) {
|
|||
|
||||
case ActionTypes.UNREGISTER_SECTION: {
|
||||
const sections = state.sections.slice();
|
||||
const index = sections.findIndex(section => section.id === action.id);
|
||||
const index = sections.findIndex((section) => section.id === action.id);
|
||||
sections.splice(index, 1);
|
||||
|
||||
return {
|
||||
|
|
|
@ -36,7 +36,7 @@ import BarThreeSections from './bar_three_sections';
|
|||
import barThreeSectionsSource from '!!raw-loader!./bar_three_sections';
|
||||
const barThreeSectionsHtml = renderToHtml(BarThreeSections);
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="Bar"
|
||||
|
|
|
@ -29,7 +29,7 @@ export default () => (
|
|||
<br />
|
||||
|
||||
<form
|
||||
onSubmit={e => {
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
window.alert('Submit');
|
||||
}}
|
||||
|
@ -40,7 +40,7 @@ export default () => (
|
|||
<br />
|
||||
|
||||
<form
|
||||
onSubmit={e => {
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
window.alert('Submit');
|
||||
}}
|
||||
|
|
|
@ -71,7 +71,7 @@ const elementsHtml = renderToHtml(Elements);
|
|||
|
||||
import sizesHtml from './button_sizes.html';
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="Basic Button"
|
||||
|
|
|
@ -31,9 +31,9 @@ export default class extends Component {
|
|||
};
|
||||
}
|
||||
|
||||
onToggleContent = ev => {
|
||||
onToggleContent = (ev) => {
|
||||
ev.preventDefault();
|
||||
this.setState(state => ({
|
||||
this.setState((state) => ({
|
||||
isExpanded: !state.isExpanded,
|
||||
}));
|
||||
};
|
||||
|
|
|
@ -32,7 +32,7 @@ import CollapseButtonAria from './collapse_button_aria';
|
|||
import collapseButtonAriaSource from '!!raw-loader!./collapse_button_aria';
|
||||
const collapseButtonAriaHtml = renderToHtml(CollapseButtonAria);
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="CollapseButton"
|
||||
|
|
|
@ -32,7 +32,7 @@ import { ControlledTableWithEmptyPrompt } from './table_with_empty_prompt';
|
|||
import tableWithEmptyPromptSource from '!!raw-loader!./table_with_empty_prompt'; // eslint-disable-line import/default
|
||||
const tableWithEmptyPromptHtml = renderToHtml(ControlledTableWithEmptyPrompt);
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="Empty table prompt"
|
||||
|
|
|
@ -37,24 +37,24 @@ class KuiCheckBoxExample extends Component {
|
|||
<div>
|
||||
<KuiCheckBox
|
||||
isChecked={this.state.value1}
|
||||
onChange={event => this.handleChange(event, 'value1')}
|
||||
onChange={(event) => this.handleChange(event, 'value1')}
|
||||
/>
|
||||
<hr className="guideBreak" />
|
||||
<KuiCheckBox
|
||||
isChecked={this.state.value2}
|
||||
onChange={event => this.handleChange(event, 'value2')}
|
||||
onChange={(event) => this.handleChange(event, 'value2')}
|
||||
/>
|
||||
<hr className="guideBreak" />
|
||||
<KuiCheckBox
|
||||
isChecked={this.state.value3}
|
||||
onChange={event => this.handleChange(event, 'value3')}
|
||||
onChange={(event) => this.handleChange(event, 'value3')}
|
||||
isDisabled
|
||||
/>
|
||||
<hr className="guideBreak" />
|
||||
<KuiCheckBoxLabel
|
||||
text="With clickable label"
|
||||
isChecked={this.state.value4}
|
||||
onChange={event => this.handleChange(event, 'value4')}
|
||||
onChange={(event) => this.handleChange(event, 'value4')}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -59,7 +59,7 @@ import CheckBox from './check_box';
|
|||
import checkBoxSource from '!!raw-loader!./check_box';
|
||||
const checkBoxHtml = renderToHtml(CheckBox);
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="Label"
|
||||
|
|
|
@ -36,7 +36,10 @@ class KuiSelectExample extends Component {
|
|||
render() {
|
||||
return (
|
||||
<div>
|
||||
<KuiSelect value={this.state.value1} onChange={event => this.handleChange(event, 'value1')}>
|
||||
<KuiSelect
|
||||
value={this.state.value1}
|
||||
onChange={(event) => this.handleChange(event, 'value1')}
|
||||
>
|
||||
<option value="apple">Apple</option>
|
||||
<option value="bread">Bread</option>
|
||||
<option value="cheese">Cheese</option>
|
||||
|
@ -44,7 +47,7 @@ class KuiSelectExample extends Component {
|
|||
<hr className="guideBreak" />
|
||||
<KuiSelect
|
||||
value={this.state.value2}
|
||||
onChange={event => this.handleChange(event, 'value2')}
|
||||
onChange={(event) => this.handleChange(event, 'value2')}
|
||||
isDisabled
|
||||
>
|
||||
<option>Disabled</option>
|
||||
|
@ -52,7 +55,7 @@ class KuiSelectExample extends Component {
|
|||
<hr className="guideBreak" />
|
||||
<KuiSelect
|
||||
value={this.state.value3}
|
||||
onChange={event => this.handleChange(event, 'value3')}
|
||||
onChange={(event) => this.handleChange(event, 'value3')}
|
||||
isInvalid
|
||||
>
|
||||
<option>Invalid</option>
|
||||
|
@ -60,7 +63,7 @@ class KuiSelectExample extends Component {
|
|||
<hr className="guideBreak" />
|
||||
<KuiSelect
|
||||
value={this.state.value4}
|
||||
onChange={event => this.handleChange(event, 'value4')}
|
||||
onChange={(event) => this.handleChange(event, 'value4')}
|
||||
size="small"
|
||||
>
|
||||
<option>Small</option>
|
||||
|
@ -68,7 +71,7 @@ class KuiSelectExample extends Component {
|
|||
<hr className="guideBreak" />
|
||||
<KuiSelect
|
||||
value={this.state.value5}
|
||||
onChange={event => this.handleChange(event, 'value5')}
|
||||
onChange={(event) => this.handleChange(event, 'value5')}
|
||||
size="large"
|
||||
>
|
||||
<option>Large</option>
|
||||
|
|
|
@ -40,38 +40,38 @@ class KuiTextAreaExample extends Component {
|
|||
<KuiTextArea
|
||||
placeholder="Placeholder text"
|
||||
value={this.state.value1}
|
||||
onChange={event => this.handleChange(event, 'value1')}
|
||||
onChange={(event) => this.handleChange(event, 'value1')}
|
||||
/>
|
||||
<hr className="guideBreak" />
|
||||
<KuiTextArea
|
||||
value={this.state.value2}
|
||||
onChange={event => this.handleChange(event, 'value2')}
|
||||
onChange={(event) => this.handleChange(event, 'value2')}
|
||||
/>
|
||||
<hr className="guideBreak" />
|
||||
<KuiTextArea
|
||||
isInvalid
|
||||
value={this.state.value3}
|
||||
onChange={event => this.handleChange(event, 'value3')}
|
||||
onChange={(event) => this.handleChange(event, 'value3')}
|
||||
/>
|
||||
<hr className="guideBreak" />
|
||||
<KuiTextArea
|
||||
isDisabled
|
||||
value={this.state.value4}
|
||||
onChange={event => this.handleChange(event, 'value4')}
|
||||
onChange={(event) => this.handleChange(event, 'value4')}
|
||||
/>
|
||||
<hr className="guideBreak" />
|
||||
<KuiTextArea
|
||||
placeholder="Small"
|
||||
value={this.state.value5}
|
||||
size="small"
|
||||
onChange={event => this.handleChange(event, 'value5')}
|
||||
onChange={(event) => this.handleChange(event, 'value5')}
|
||||
/>
|
||||
<hr className="guideBreak" />
|
||||
<KuiTextArea
|
||||
placeholder="Large"
|
||||
value={this.state.value6}
|
||||
size="large"
|
||||
onChange={event => this.handleChange(event, 'value6')}
|
||||
onChange={(event) => this.handleChange(event, 'value6')}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -33,7 +33,7 @@ class KuiTextAreaNonResizableExample extends Component {
|
|||
return (
|
||||
<KuiTextArea
|
||||
value={this.state.value1}
|
||||
onChange={event => this.handleChange(event, 'value1')}
|
||||
onChange={(event) => this.handleChange(event, 'value1')}
|
||||
isNonResizable
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -40,39 +40,39 @@ class KuiTextInputExample extends Component {
|
|||
<KuiTextInput
|
||||
value={this.state.value1}
|
||||
placeholder="Placeholder text"
|
||||
onChange={event => this.handleChange(event, 'value1')}
|
||||
onChange={(event) => this.handleChange(event, 'value1')}
|
||||
/>
|
||||
<hr className="guideBreak" />
|
||||
<KuiTextInput
|
||||
value={this.state.value2}
|
||||
autoFocus
|
||||
onChange={event => this.handleChange(event, 'value2')}
|
||||
onChange={(event) => this.handleChange(event, 'value2')}
|
||||
/>
|
||||
<hr className="guideBreak" />
|
||||
<KuiTextInput
|
||||
value={this.state.value3}
|
||||
isInvalid
|
||||
onChange={event => this.handleChange(event, 'value3')}
|
||||
onChange={(event) => this.handleChange(event, 'value3')}
|
||||
/>
|
||||
<hr className="guideBreak" />
|
||||
<KuiTextInput
|
||||
value={this.state.value4}
|
||||
isDisabled
|
||||
onChange={event => this.handleChange(event, 'value4')}
|
||||
onChange={(event) => this.handleChange(event, 'value4')}
|
||||
/>
|
||||
<hr className="guideBreak" />
|
||||
<KuiTextInput
|
||||
value={this.state.value5}
|
||||
size="small"
|
||||
placeholder="Small"
|
||||
onChange={event => this.handleChange(event, 'value5')}
|
||||
onChange={(event) => this.handleChange(event, 'value5')}
|
||||
/>
|
||||
<hr className="guideBreak" />
|
||||
<KuiTextInput
|
||||
value={this.state.value6}
|
||||
size="large"
|
||||
placeholder="Large"
|
||||
onChange={event => this.handleChange(event, 'value6')}
|
||||
onChange={(event) => this.handleChange(event, 'value6')}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -28,7 +28,7 @@ import FieldGroup from './field_group';
|
|||
import fieldGroupSource from '!!raw-loader!./field_group';
|
||||
const fieldGroupHtml = renderToHtml(FieldGroup);
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="FieldGroup"
|
||||
|
|
|
@ -38,7 +38,7 @@ import inactiveHtml from './icon_inactive.html';
|
|||
import spinnerHtml from './icon_spinner.html';
|
||||
import spinnerJs from 'raw-loader!./icon_spinner.js';
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="Icon"
|
||||
|
|
|
@ -26,7 +26,7 @@ import successHtml from './info_panel_success.html';
|
|||
import warningHtml from './info_panel_warning.html';
|
||||
import errorHtml from './info_panel_error.html';
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="Info"
|
||||
|
|
|
@ -23,7 +23,7 @@ import { GuideDemo, GuidePage, GuideSection, GuideSectionTypes } from '../../com
|
|||
|
||||
import linkHtml from './link.html';
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="Link"
|
||||
|
|
|
@ -58,7 +58,7 @@ const localNavWithTabsHtml = renderToHtml(LocalNavWithTabs);
|
|||
|
||||
import datePickerHtml from './local_nav_date_picker.html';
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="Simple"
|
||||
|
|
|
@ -32,7 +32,7 @@ import { PagerButtons } from './pager_buttons';
|
|||
import pagerButtonsSource from '!!raw-loader!./pager_buttons'; // eslint-disable-line import/default
|
||||
const pagerButtonsHtml = renderToHtml(PagerButtons);
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="Pager"
|
||||
|
|
|
@ -25,7 +25,7 @@ import panelHtml from './panel.html';
|
|||
import panelWithToolBarHtml from './panel_with_toolbar.html';
|
||||
import panelWithHeaderSectionsHtml from './panel_with_header_sections.html';
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="Panel"
|
||||
|
|
|
@ -27,7 +27,7 @@ import successHtml from './status_text_success.html';
|
|||
import warningHtml from './status_text_warning.html';
|
||||
import errorHtml from './status_text_error.html';
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="StatusText"
|
||||
|
|
|
@ -57,12 +57,12 @@ export class FluidTable extends Component {
|
|||
[
|
||||
{
|
||||
name: 'title',
|
||||
getValue: item => item.title.toLowerCase(),
|
||||
getValue: (item) => item.title.toLowerCase(),
|
||||
isAscending: true,
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
getValue: item => item.description.toLowerCase(),
|
||||
getValue: (item) => item.description.toLowerCase(),
|
||||
isAscending: true,
|
||||
},
|
||||
],
|
||||
|
@ -70,7 +70,7 @@ export class FluidTable extends Component {
|
|||
);
|
||||
}
|
||||
|
||||
onSort = prop => {
|
||||
onSort = (prop) => {
|
||||
this.sortableProperties.sortOn(prop);
|
||||
|
||||
this.setState({
|
||||
|
@ -79,7 +79,7 @@ export class FluidTable extends Component {
|
|||
};
|
||||
|
||||
renderRows() {
|
||||
return this.items.map(item => (
|
||||
return this.items.map((item) => (
|
||||
<KuiTableRow key={item.title}>
|
||||
<KuiTableRowCell>{item.title}</KuiTableRowCell>
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ export class ListingTable extends Component {
|
|||
];
|
||||
}
|
||||
|
||||
onItemSelectionChanged = selectedRowIds => {
|
||||
onItemSelectionChanged = (selectedRowIds) => {
|
||||
this.setState({ selectedRowIds });
|
||||
};
|
||||
|
||||
|
|
|
@ -85,12 +85,12 @@ export class Table extends Component {
|
|||
[
|
||||
{
|
||||
name: 'title',
|
||||
getValue: item => item.title.toLowerCase(),
|
||||
getValue: (item) => item.title.toLowerCase(),
|
||||
isAscending: true,
|
||||
},
|
||||
{
|
||||
name: 'status',
|
||||
getValue: item => item.status.toLowerCase(),
|
||||
getValue: (item) => item.status.toLowerCase(),
|
||||
isAscending: true,
|
||||
},
|
||||
],
|
||||
|
@ -98,7 +98,7 @@ export class Table extends Component {
|
|||
);
|
||||
}
|
||||
|
||||
onSort = prop => {
|
||||
onSort = (prop) => {
|
||||
this.sortableProperties.sortOn(prop);
|
||||
|
||||
this.setState({
|
||||
|
@ -106,35 +106,35 @@ export class Table extends Component {
|
|||
});
|
||||
};
|
||||
|
||||
toggleItem = item => {
|
||||
this.setState(previousState => {
|
||||
toggleItem = (item) => {
|
||||
this.setState((previousState) => {
|
||||
const rowToSelectedStateMap = new Map(previousState.rowToSelectedStateMap);
|
||||
rowToSelectedStateMap.set(item, !rowToSelectedStateMap.get(item));
|
||||
return { rowToSelectedStateMap };
|
||||
});
|
||||
};
|
||||
|
||||
isItemChecked = item => {
|
||||
isItemChecked = (item) => {
|
||||
return this.state.rowToSelectedStateMap.get(item);
|
||||
};
|
||||
|
||||
togglePopover = item => {
|
||||
this.setState(previousState => {
|
||||
togglePopover = (item) => {
|
||||
this.setState((previousState) => {
|
||||
const rowToOpenActionsPopoverMap = new Map(previousState.rowToOpenActionsPopoverMap);
|
||||
rowToOpenActionsPopoverMap.set(item, !rowToOpenActionsPopoverMap.get(item));
|
||||
return { rowToOpenActionsPopoverMap };
|
||||
});
|
||||
};
|
||||
|
||||
closePopover = item => {
|
||||
this.setState(previousState => {
|
||||
closePopover = (item) => {
|
||||
this.setState((previousState) => {
|
||||
const rowToOpenActionsPopoverMap = new Map(previousState.rowToOpenActionsPopoverMap);
|
||||
rowToOpenActionsPopoverMap.set(item, false);
|
||||
return { rowToOpenActionsPopoverMap };
|
||||
});
|
||||
};
|
||||
|
||||
isPopoverOpen = item => {
|
||||
isPopoverOpen = (item) => {
|
||||
return this.state.rowToOpenActionsPopoverMap.get(item);
|
||||
};
|
||||
|
||||
|
@ -146,7 +146,7 @@ export class Table extends Component {
|
|||
renderRows() {
|
||||
const rows = [];
|
||||
|
||||
this.items.forEach(item => {
|
||||
this.items.forEach((item) => {
|
||||
const classes = classNames({
|
||||
'kuiTableRowCell--wrap': item.isWrapped,
|
||||
});
|
||||
|
|
|
@ -52,7 +52,7 @@ import { ListingTableLoadingItems } from './listing_table_loading_items';
|
|||
import listingTableLoadingItemsSource from '!!raw-loader!./listing_table_loading_items'; // eslint-disable-line import/default
|
||||
const listingTableLoadingItemsHtml = renderToHtml(ListingTableLoadingItems);
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="Table"
|
||||
|
|
|
@ -49,7 +49,7 @@ class KuiTabsExample extends React.Component {
|
|||
};
|
||||
}
|
||||
|
||||
onSelectedTabChanged = id => {
|
||||
onSelectedTabChanged = (id) => {
|
||||
this.setState({
|
||||
selectedTabId: id,
|
||||
});
|
||||
|
|
|
@ -35,7 +35,7 @@ import Tabs from './tabs';
|
|||
import tabsSource from '!!raw-loader!./tabs';
|
||||
const tabsHtml = renderToHtml(Tabs);
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="Tabs"
|
||||
|
|
|
@ -32,7 +32,7 @@ import { ToolBarFooter } from './tool_bar_footer';
|
|||
import toolBarFooterSource from '!!raw-loader!./tool_bar_footer'; // eslint-disable-line import/default
|
||||
const toolBarFooterHtml = renderToHtml(ToolBarFooter);
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="ToolBar"
|
||||
|
|
|
@ -35,7 +35,7 @@ import textHtml from './text.html';
|
|||
import subTextHtml from './sub_text.html';
|
||||
import subduedHtml from './subdued_type.html';
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="Title"
|
||||
|
|
|
@ -26,7 +26,7 @@ import verticalRhythmSmallHtml from './vertical_rhythm_small.html';
|
|||
import verticalRhythmAsWrapperHtml from './vertical_rhythm_as_wrapper.html';
|
||||
import verticalRhythmOnComponentHtml from './vertical_rhythm_on_component.html';
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuidePage title={props.route.name}>
|
||||
<GuideSection
|
||||
title="VerticalRhythm"
|
||||
|
|
|
@ -28,7 +28,7 @@ import {
|
|||
|
||||
import html from './view_sandbox.html';
|
||||
|
||||
export default props => (
|
||||
export default (props) => (
|
||||
<GuideSandbox>
|
||||
<GuideDemo isFullScreen={true} html={html} />
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ module.exports = class extends Generator {
|
|||
},
|
||||
],
|
||||
},
|
||||
]).then(answers => {
|
||||
]).then((answers) => {
|
||||
this.config = answers;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ module.exports = class extends Generator {
|
|||
},
|
||||
],
|
||||
},
|
||||
]).then(answers => {
|
||||
]).then((answers) => {
|
||||
this.config = answers;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ module.exports = class extends Generator {
|
|||
type: 'confirm',
|
||||
default: true,
|
||||
},
|
||||
]).then(answers => {
|
||||
]).then((answers) => {
|
||||
this.config = answers;
|
||||
|
||||
if (!answers.name || !answers.name.trim()) {
|
||||
|
@ -62,7 +62,7 @@ module.exports = class extends Generator {
|
|||
writing() {
|
||||
const config = this.config;
|
||||
|
||||
const writeComponent = isStatelessFunction => {
|
||||
const writeComponent = (isStatelessFunction) => {
|
||||
const componentName = utils.makeComponentName(config.name);
|
||||
const cssClassName = utils.lowerCaseFirstLetter(componentName);
|
||||
const fileName = config.name;
|
||||
|
|
|
@ -47,7 +47,7 @@ module.exports = class extends Generator {
|
|||
name: 'folderName',
|
||||
type: 'input',
|
||||
store: true,
|
||||
default: answers => answers.name,
|
||||
default: (answers) => answers.name,
|
||||
});
|
||||
|
||||
prompts.push({
|
||||
|
@ -58,7 +58,7 @@ module.exports = class extends Generator {
|
|||
});
|
||||
}
|
||||
|
||||
return this.prompt(prompts).then(answers => {
|
||||
return this.prompt(prompts).then((answers) => {
|
||||
this.config = answers;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ function makeComponentName(str, usePrefix = true) {
|
|||
const words = str.split('_');
|
||||
|
||||
const componentName = words
|
||||
.map(function(word) {
|
||||
.map(function (word) {
|
||||
return upperCaseFirstLetter(word);
|
||||
})
|
||||
.join('');
|
||||
|
@ -30,13 +30,13 @@ function makeComponentName(str, usePrefix = true) {
|
|||
}
|
||||
|
||||
function lowerCaseFirstLetter(str) {
|
||||
return str.replace(/\w\S*/g, function(txt) {
|
||||
return str.replace(/\w\S*/g, function (txt) {
|
||||
return txt.charAt(0).toLowerCase() + txt.substr(1);
|
||||
});
|
||||
}
|
||||
|
||||
function upperCaseFirstLetter(str) {
|
||||
return str.replace(/\w\S*/g, function(txt) {
|
||||
return str.replace(/\w\S*/g, function (txt) {
|
||||
return txt.charAt(0).toUpperCase() + txt.substr(1);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ const KuiLinkButton = ({
|
|||
children,
|
||||
...rest
|
||||
}) => {
|
||||
const onClick = e => {
|
||||
const onClick = (e) => {
|
||||
if (disabled) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ describe('KuiButton', () => {
|
|||
|
||||
describe('Props', () => {
|
||||
describe('buttonType', () => {
|
||||
BUTTON_TYPES.forEach(buttonType => {
|
||||
BUTTON_TYPES.forEach((buttonType) => {
|
||||
describe(`${buttonType}`, () => {
|
||||
test(`renders the ${buttonType} class`, () => {
|
||||
const $button = render(<KuiButton buttonType={buttonType} aria-label="aria label" />);
|
||||
|
|
|
@ -22,7 +22,7 @@ import React from 'react';
|
|||
|
||||
import classNames from 'classnames';
|
||||
|
||||
const KuiButtonGroup = props => {
|
||||
const KuiButtonGroup = (props) => {
|
||||
const classes = classNames('kuiButtonGroup', {
|
||||
'kuiButtonGroup--united': props.isUnited,
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@ import classNames from 'classnames';
|
|||
|
||||
const ICON_TYPES = ['create', 'delete', 'previous', 'next', 'loading', 'settings', 'menu'];
|
||||
|
||||
const KuiButtonIcon = props => {
|
||||
const KuiButtonIcon = (props) => {
|
||||
const typeToClassNameMap = {
|
||||
create: 'fa-plus',
|
||||
delete: 'fa-trash',
|
||||
|
|
|
@ -33,7 +33,7 @@ describe('KuiButtonIcon', () => {
|
|||
|
||||
describe('Props', () => {
|
||||
describe('type', () => {
|
||||
ICON_TYPES.forEach(type => {
|
||||
ICON_TYPES.forEach((type) => {
|
||||
describe(`${type}`, () => {
|
||||
test(`renders the ${type} class`, () => {
|
||||
const $buttonIcon = render(<KuiButtonIcon type={type} />);
|
||||
|
|
|
@ -49,7 +49,7 @@ describe('KuiLinkButton', () => {
|
|||
|
||||
describe('Props', () => {
|
||||
describe('buttonType', () => {
|
||||
BUTTON_TYPES.forEach(buttonType => {
|
||||
BUTTON_TYPES.forEach((buttonType) => {
|
||||
describe(`${buttonType}`, () => {
|
||||
test(`renders the ${buttonType} class`, () => {
|
||||
const $button = render(
|
||||
|
|
|
@ -47,7 +47,7 @@ describe('KuiSubmitButton', () => {
|
|||
|
||||
describe('Props', () => {
|
||||
describe('buttonType', () => {
|
||||
BUTTON_TYPES.forEach(buttonType => {
|
||||
BUTTON_TYPES.forEach((buttonType) => {
|
||||
describe(`${buttonType}`, () => {
|
||||
test(`renders the ${buttonType} class`, () => {
|
||||
const $button = render(<KuiSubmitButton buttonType={buttonType} />);
|
||||
|
|
|
@ -27,7 +27,7 @@ import { DIRECTIONS, KuiCollapseButton } from './collapse_button';
|
|||
describe('KuiCollapseButton', () => {
|
||||
describe('Props', () => {
|
||||
describe('direction', () => {
|
||||
DIRECTIONS.forEach(direction => {
|
||||
DIRECTIONS.forEach((direction) => {
|
||||
describe(`${direction}`, () => {
|
||||
test(`renders the ${direction} class`, () => {
|
||||
const component = <KuiCollapseButton direction={direction} {...requiredProps} />;
|
||||
|
|
|
@ -77,7 +77,7 @@ describe('KuiSelect', () => {
|
|||
});
|
||||
|
||||
describe('size', () => {
|
||||
SELECT_SIZE.forEach(size => {
|
||||
SELECT_SIZE.forEach((size) => {
|
||||
test(`renders ${size}`, () => {
|
||||
const component = <KuiSelect size={size} onChange={() => {}} />;
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ describe('KuiTextArea', () => {
|
|||
});
|
||||
|
||||
describe('size', () => {
|
||||
TEXTAREA_SIZE.forEach(size => {
|
||||
TEXTAREA_SIZE.forEach((size) => {
|
||||
test(`renders ${size}`, () => {
|
||||
const component = <KuiTextArea size={size} onChange={() => {}} />;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ describe('KuiTextInput', () => {
|
|||
});
|
||||
|
||||
describe('size', () => {
|
||||
TEXTINPUT_SIZE.forEach(size => {
|
||||
TEXTINPUT_SIZE.forEach((size) => {
|
||||
test(`renders ${size}`, () => {
|
||||
const component = <KuiTextInput size={size} onChange={() => {}} />;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ export function KuiListingTable({
|
|||
if (areAllRowsSelected()) {
|
||||
onItemSelectionChanged([]);
|
||||
} else {
|
||||
onItemSelectionChanged(rows.map(row => row.id));
|
||||
onItemSelectionChanged(rows.map((row) => row.id));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import { mount, shallow } from 'enzyme';
|
|||
import { requiredProps, takeMountedSnapshot } from '../../../test';
|
||||
import { KuiListingTable } from './listing_table';
|
||||
|
||||
const getProps = customProps => {
|
||||
const getProps = (customProps) => {
|
||||
const defaultProps = {
|
||||
header: ['Breed', 'Description'],
|
||||
rows: [
|
||||
|
@ -59,20 +59,14 @@ test('renders KuiListingTable', () => {
|
|||
test('selecting a row calls onItemSelectionChanged', () => {
|
||||
const props = getProps();
|
||||
const component = shallow(<KuiListingTable {...props} />);
|
||||
component
|
||||
.find('KuiListingTableRow')
|
||||
.at(1)
|
||||
.prop('onSelectionChanged')('1');
|
||||
component.find('KuiListingTableRow').at(1).prop('onSelectionChanged')('1');
|
||||
expect(props.onItemSelectionChanged).toHaveBeenCalledWith(['1']);
|
||||
});
|
||||
|
||||
test('selectedRowIds is preserved when onItemSelectionChanged is called', () => {
|
||||
const props = getProps({ selectedRowIds: ['3'] });
|
||||
const component = shallow(<KuiListingTable {...props} />);
|
||||
component
|
||||
.find('KuiListingTableRow')
|
||||
.at(0)
|
||||
.prop('onSelectionChanged')('1');
|
||||
component.find('KuiListingTableRow').at(0).prop('onSelectionChanged')('1');
|
||||
expect(props.onItemSelectionChanged).toHaveBeenCalledWith(expect.arrayContaining(['1', '3']));
|
||||
});
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ describe('KuiTitle', () => {
|
|||
});
|
||||
|
||||
describe('renders size', () => {
|
||||
SIZES.forEach(size => {
|
||||
SIZES.forEach((size) => {
|
||||
test(size, () => {
|
||||
const component = render(
|
||||
<KuiTitle size={size}>
|
||||
|
|
|
@ -27,5 +27,5 @@ import uuid from 'uuid';
|
|||
*/
|
||||
export function htmlIdGenerator(idPrefix) {
|
||||
const prefix = idPrefix || uuid.v1();
|
||||
return suffix => `${prefix}_${suffix || uuid.v1()}`;
|
||||
return (suffix) => `${prefix}_${suffix || uuid.v1()}`;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ export class SortableProperties {
|
|||
* @returns {SortableProperty|undefined}
|
||||
*/
|
||||
getSortablePropertyByName(propertyName) {
|
||||
return this.sortableProperties.find(property => property.name === propertyName);
|
||||
return this.sortableProperties.find((property) => property.name === propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,19 +22,19 @@ import { SortableProperties } from './sortable_properties';
|
|||
describe('SortProperties', () => {
|
||||
const name = {
|
||||
name: 'name',
|
||||
getValue: bird => bird.name,
|
||||
getValue: (bird) => bird.name,
|
||||
isAscending: true,
|
||||
};
|
||||
|
||||
const size = {
|
||||
name: 'size',
|
||||
getValue: bird => bird.size,
|
||||
getValue: (bird) => bird.size,
|
||||
isAscending: false,
|
||||
};
|
||||
|
||||
const color = {
|
||||
name: 'color',
|
||||
getValue: bird => bird.color,
|
||||
getValue: (bird) => bird.color,
|
||||
isAscending: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* containing both React components and HTML elements. This function removes the React components,
|
||||
* leaving only HTML elements in the snapshot.
|
||||
*/
|
||||
export const takeMountedSnapshot = mountedComponent => {
|
||||
export const takeMountedSnapshot = (mountedComponent) => {
|
||||
const html = mountedComponent.html();
|
||||
const template = document.createElement('template');
|
||||
template.innerHTML = html; // eslint-disable-line no-unsanitized/property
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue