diff --git a/.babelrc b/.babelrc index f2c1b7c54c3c..8bf450dd9ce3 100644 --- a/.babelrc +++ b/.babelrc @@ -18,6 +18,17 @@ "transform-async-generator-functions", "transform-object-rest-spread", // stage 2 - "transform-class-properties" + "transform-class-properties", + [ + "inline-react-svg", + { + "svgo": { + "plugins": [ + { "cleanupIDs": false }, + { "removeViewBox": false }, + ] + } + } + ] ] } diff --git a/package.json b/package.json index 05d7c5d003db..b2c28f7e5339 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "babel-jest": "21.0.0", "babel-loader": "7.1.2", "babel-plugin-add-module-exports": "0.2.1", + "babel-plugin-inline-react-svg": "^0.5.2", "babel-plugin-transform-async-generator-functions": "6.24.1", "babel-plugin-transform-class-properties": "6.24.1", "babel-plugin-transform-object-rest-spread": "6.26.0", diff --git a/src/components/accordion/__snapshots__/accordion.test.js.snap b/src/components/accordion/__snapshots__/accordion.test.js.snap index 6dbed35b448f..aa109dc1aa21 100644 --- a/src/components/accordion/__snapshots__/accordion.test.js.snap +++ b/src/components/accordion/__snapshots__/accordion.test.js.snap @@ -24,13 +24,24 @@ exports[`EuiAccordion is rendered 1`] = ` class="euiFlexItem euiFlexItem--flexGrowZero" > - - arrow right icon - + + + diff --git a/src/components/context_menu/__snapshots__/context_menu.test.js.snap b/src/components/context_menu/__snapshots__/context_menu.test.js.snap index 2992e247cf6a..2323d9c9a8e0 100644 --- a/src/components/context_menu/__snapshots__/context_menu.test.js.snap +++ b/src/components/context_menu/__snapshots__/context_menu.test.js.snap @@ -26,13 +26,24 @@ exports[`EuiContextMenu props panels and initialPanelId allows you to click the class="euiContextMenu__itemLayout" > - - arrow left icon - + + + - - arrow left icon - + + + - - arrow left icon - + + + - - arrow right icon - + + + @@ -158,13 +202,24 @@ exports[`EuiContextMenu props panels and initialPanelId allows you to click the 2b - - arrow right icon - + + + @@ -182,13 +237,24 @@ exports[`EuiContextMenu props panels and initialPanelId allows you to click the 2c - - arrow right icon - + + + @@ -215,13 +281,24 @@ exports[`EuiContextMenu props panels and initialPanelId renders the referenced p class="euiContextMenu__itemLayout" > - - arrow left icon - + + + - - arrow right icon - + + + diff --git a/src/components/context_menu/__snapshots__/context_menu_panel.test.js.snap b/src/components/context_menu/__snapshots__/context_menu_panel.test.js.snap index 937a29103d9a..8f936d5219e7 100644 --- a/src/components/context_menu/__snapshots__/context_menu_panel.test.js.snap +++ b/src/components/context_menu/__snapshots__/context_menu_panel.test.js.snap @@ -27,13 +27,24 @@ exports[`EuiContextMenuPanel props onClose renders a button as a title 1`] = ` class="euiContextMenu__itemLayout" > - - arrow left icon - + + + - - lock icon - + + + diff --git a/src/components/form/field_search/__snapshots__/field_search.test.js.snap b/src/components/form/field_search/__snapshots__/field_search.test.js.snap index d1009b20fa47..672400bf6613 100644 --- a/src/components/form/field_search/__snapshots__/field_search.test.js.snap +++ b/src/components/form/field_search/__snapshots__/field_search.test.js.snap @@ -11,13 +11,22 @@ exports[`EuiFieldSearch is rendered 1`] = ` type="search" /> - - search icon - + + + diff --git a/src/components/form/select/__snapshots__/select.test.js.snap b/src/components/form/select/__snapshots__/select.test.js.snap index 3796290e61de..2a51da91af99 100644 --- a/src/components/form/select/__snapshots__/select.test.js.snap +++ b/src/components/form/select/__snapshots__/select.test.js.snap @@ -10,13 +10,23 @@ exports[`EuiSelect is rendered 1`] = ` data-test-subj="test subject string" /> - - arrow down icon - + + + diff --git a/src/components/form/switch/__snapshots__/switch.test.js.snap b/src/components/form/switch/__snapshots__/switch.test.js.snap index 24d93656806d..5303bc861c24 100644 --- a/src/components/form/switch/__snapshots__/switch.test.js.snap +++ b/src/components/form/switch/__snapshots__/switch.test.js.snap @@ -20,23 +20,42 @@ exports[`EuiSwitch is rendered 1`] = ` class="euiSwitch__track" > - - cross icon - + + + - - check icon - + + + diff --git a/src/components/header/__snapshots__/header_logo.test.js.snap b/src/components/header/__snapshots__/header_logo.test.js.snap index c7abb8da72d1..44605201f8a2 100644 --- a/src/components/header/__snapshots__/header_logo.test.js.snap +++ b/src/components/header/__snapshots__/header_logo.test.js.snap @@ -7,14 +7,42 @@ exports[`EuiHeaderLogo is rendered 1`] = ` data-test-subj="test subject string" > - - logo elastic icon - - + + + + + + + + `; @@ -25,14 +53,42 @@ exports[`EuiHeaderLogo renders href 1`] = ` href="#" > - - logo elastic icon - - + + + + + + + + `; diff --git a/src/components/header/header_alert/__snapshots__/header_alert.test.js.snap b/src/components/header/header_alert/__snapshots__/header_alert.test.js.snap index bf9051d793d5..24453187cbe8 100644 --- a/src/components/header/header_alert/__snapshots__/header_alert.test.js.snap +++ b/src/components/header/header_alert/__snapshots__/header_alert.test.js.snap @@ -13,13 +13,23 @@ exports[`EuiHeaderAlert is rendered 1`] = ` > diff --git a/src/components/health/__snapshots__/health.test.js.snap b/src/components/health/__snapshots__/health.test.js.snap index fb2414027660..9b6d66e8d071 100644 --- a/src/components/health/__snapshots__/health.test.js.snap +++ b/src/components/health/__snapshots__/health.test.js.snap @@ -13,13 +13,24 @@ exports[`EuiHealth is rendered 1`] = ` class="euiFlexItem euiFlexItem--flexGrowZero" > - - dot icon - + + + diff --git a/src/components/icon/__snapshots__/icon.test.js.snap b/src/components/icon/__snapshots__/icon.test.js.snap index 1fe8321e4775..050efa3fd534 100644 --- a/src/components/icon/__snapshots__/icon.test.js.snap +++ b/src/components/icon/__snapshots__/icon.test.js.snap @@ -5,1208 +5,2557 @@ exports[`EuiIcon is rendered 1`] = ` aria-label="aria-label" class="euiIcon testClass1 testClass2 euiIcon--medium" data-test-subj="test subject string" + height="16" + viewBox="0 0 16 16" + width="16" + xlink="http://www.w3.org/1999/xlink" + xmlns="http://www.w3.org/2000/svg" > - - search icon - + + + `; exports[`EuiIcon renders size l 1`] = ` - - search icon - + + + `; exports[`EuiIcon renders size m 1`] = ` - - search icon - + + + `; exports[`EuiIcon renders size original 1`] = ` - - search icon - + + + `; exports[`EuiIcon renders size xl 1`] = ` - - search icon - + + + `; exports[`EuiIcon renders size xxl 1`] = ` - - search icon - + + + `; exports[`EuiIcon renders type addDataApp 1`] = ` - - add data app icon - - + aria-label="add data app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + `; exports[`EuiIcon renders type advancedSettingsApp 1`] = ` - - advanced settings app icon - - + aria-label="advanced settings app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + + + `; exports[`EuiIcon renders type alert 1`] = ` - - alert icon - - + + + + `; exports[`EuiIcon renders type apmApp 1`] = ` - - apm app icon - - + aria-label="apm app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xlink="http://www.w3.org/1999/xlink" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + + + + + + + + + + + + + + + + + + + + + `; exports[`EuiIcon renders type apps 1`] = ` - - apps icon - + + + `; exports[`EuiIcon renders type arrowDown 1`] = ` - - arrow down icon - + + + `; exports[`EuiIcon renders type arrowLeft 1`] = ` - - arrow left icon - + + + `; exports[`EuiIcon renders type arrowRight 1`] = ` - - arrow right icon - + + + `; exports[`EuiIcon renders type arrowUp 1`] = ` - - arrow up icon - + + + `; exports[`EuiIcon renders type bolt 1`] = ` - - bolt icon - + + + `; exports[`EuiIcon renders type boxesHorizontal 1`] = ` - - boxes horizontal icon - + + + `; exports[`EuiIcon renders type boxesVertical 1`] = ` - - boxes vertical icon - + + + `; exports[`EuiIcon renders type brush 1`] = ` - - brush icon - + + + `; exports[`EuiIcon renders type bullseye 1`] = ` - - bullseye icon - + + + `; exports[`EuiIcon renders type check 1`] = ` - - check icon - + + + `; exports[`EuiIcon renders type clock 1`] = ` - - clock icon - + + + `; exports[`EuiIcon renders type console 1`] = ` - - console icon - + + + `; exports[`EuiIcon renders type consoleApp 1`] = ` - - console app icon - - + aria-label="console app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + `; exports[`EuiIcon renders type controlsHorizontal 1`] = ` - - controls horizontal icon - + + + `; exports[`EuiIcon renders type controlsVertical 1`] = ` - - controls vertical icon - + + + `; exports[`EuiIcon renders type copy 1`] = ` - - copy icon - + + + + `; exports[`EuiIcon renders type copyClipboard 1`] = ` - - copy clipboard icon - - + `; exports[`EuiIcon renders type cross 1`] = ` - - cross icon - + + + `; exports[`EuiIcon renders type dashboardApp 1`] = ` - - dashboard app icon - - + aria-label="dashboard app icon" + class="euiIcon euiIcon--medium" + height="30" + viewBox="0 0 30 30" + width="30" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + `; exports[`EuiIcon renders type devToolsApp 1`] = ` - - dev tools app icon - - + aria-label="dev tools app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + `; exports[`EuiIcon renders type discoverApp 1`] = ` - - discover app icon - - + aria-label="discover app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + `; exports[`EuiIcon renders type document 1`] = ` - - document icon - + + + `; exports[`EuiIcon renders type dot 1`] = ` - - dot icon - + + + `; exports[`EuiIcon renders type empty 1`] = ` - - empty icon - - - + height="16" + viewBox="0 0 16 16" + width="16" + xmlns="http://www.w3.org/2000/svg" +/> `; exports[`EuiIcon renders type faceHappy 1`] = ` - - face happy icon - - + aria-label="face happy icon" + class="euiIcon euiIcon--medium" + height="16" + viewBox="0 0 16 16" + width="16" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + `; exports[`EuiIcon renders type faceSad 1`] = ` - - face sad icon - - + aria-label="face sad icon" + class="euiIcon euiIcon--medium" + height="16" + viewBox="0 0 16 16" + width="16" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + `; exports[`EuiIcon renders type fullScreen 1`] = ` - - full screen icon - + + + `; exports[`EuiIcon renders type gear 1`] = ` - - gear icon - + + + `; exports[`EuiIcon renders type graphApp 1`] = ` - - graph app icon - - + + + + `; exports[`EuiIcon renders type grid 1`] = ` - - grid icon - + + + `; exports[`EuiIcon renders type grokApp 1`] = ` - - grok app icon - - + + + + + `; exports[`EuiIcon renders type help 1`] = ` - - help icon - + + + `; exports[`EuiIcon renders type indexPatternApp 1`] = ` - - index pattern app icon - - + aria-label="index pattern app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + `; exports[`EuiIcon renders type invert 1`] = ` - - invert icon - - + `; exports[`EuiIcon renders type link 1`] = ` - - link icon - + + + `; exports[`EuiIcon renders type list 1`] = ` - - list icon - + + + `; exports[`EuiIcon renders type listAdd 1`] = ` - - list add icon - - `; exports[`EuiIcon renders type lock 1`] = ` - - lock icon - + + + `; exports[`EuiIcon renders type loggingApp 1`] = ` - - logging app icon - - + aria-label="logging app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + `; exports[`EuiIcon renders type logoBeats 1`] = ` - - logo beats icon - - + aria-label="logo beats icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + + `; exports[`EuiIcon renders type logoCloud 1`] = ` - - logo cloud icon - - + aria-label="logo cloud icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + + `; exports[`EuiIcon renders type logoElastic 1`] = ` - - logo elastic icon - - + aria-label="logo elastic icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + + + `; exports[`EuiIcon renders type logoElasticSearch 1`] = ` - - logo elastic search icon - - + aria-label="logo elastic search icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + + + + + `; exports[`EuiIcon renders type logoElasticStack 1`] = ` - - logo elastic stack icon - - + aria-label="logo elastic stack icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + `; exports[`EuiIcon renders type logoGmail 1`] = ` - - logo gmail icon - - + aria-label="logo gmail icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + + + + `; exports[`EuiIcon renders type logoKibana 1`] = ` - - logo kibana icon - - + + + `; exports[`EuiIcon renders type logoLogstash 1`] = ` - - logo logstash icon - - + aria-label="logo logstash icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + `; exports[`EuiIcon renders type logoSlack 1`] = ` - - logo slack icon - - + + + + + `; exports[`EuiIcon renders type logoWebhook 1`] = ` - - logo webhook icon - - + + + + + `; exports[`EuiIcon renders type logoXpack 1`] = ` - - logo xpack icon - - + aria-label="logo xpack icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + + + `; exports[`EuiIcon renders type machineLearningApp 1`] = ` - - machine learning app icon - - + + + + `; exports[`EuiIcon renders type managementApp 1`] = ` - - management app icon - - + aria-label="management app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + `; exports[`EuiIcon renders type mapMarker 1`] = ` - - map marker icon - + + + `; exports[`EuiIcon renders type minusInCircle 1`] = ` - - minus in circle icon - - `; exports[`EuiIcon renders type monitoringApp 1`] = ` - - monitoring app icon - - + + + + + `; exports[`EuiIcon renders type node 1`] = ` - - node icon - - `; exports[`EuiIcon renders type pencil 1`] = ` - - pencil icon - + + + `; exports[`EuiIcon renders type pin 1`] = ` - - pin icon - - `; exports[`EuiIcon renders type pipelineApp 1`] = ` - - pipeline app icon - - + aria-label="pipeline app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + + + + + `; exports[`EuiIcon renders type plusInCircle 1`] = ` - - plus in circle icon - + + + `; exports[`EuiIcon renders type questionInCircle 1`] = ` - - question in circle icon - - + `; exports[`EuiIcon renders type reportingApp 1`] = ` - - reporting app icon - - + aria-label="reporting app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + `; exports[`EuiIcon renders type savedObjectsApp 1`] = ` - - saved objects app icon - - + aria-label="saved objects app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + + + + `; exports[`EuiIcon renders type search 1`] = ` - - search icon - + + + `; exports[`EuiIcon renders type searchProfilerApp 1`] = ` - - search profiler app icon - - + + + + + `; exports[`EuiIcon renders type securityApp 1`] = ` - - security app icon - - + + + + `; exports[`EuiIcon renders type shard 1`] = ` - - shard icon - - `; exports[`EuiIcon renders type share 1`] = ` - - share icon - + + + `; exports[`EuiIcon renders type sortDown 1`] = ` - - sort down icon - + + + `; exports[`EuiIcon renders type sortUp 1`] = ` - - sort up icon - + + + `; exports[`EuiIcon renders type starEmpty 1`] = ` - - star empty icon - + + + `; exports[`EuiIcon renders type tear 1`] = ` - - tear icon - + + + `; exports[`EuiIcon renders type timelionApp 1`] = ` - - timelion app icon - - + + + + `; exports[`EuiIcon renders type trash 1`] = ` - - trash icon - + + + `; exports[`EuiIcon renders type upgradeAssistantApp 1`] = ` - - upgrade assistant app icon - - + + + + `; exports[`EuiIcon renders type user 1`] = ` - - user icon - - + + + + `; exports[`EuiIcon renders type usersRolesApp 1`] = ` - - users roles app icon - - + aria-label="users roles app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + + + `; exports[`EuiIcon renders type visualizeApp 1`] = ` - - visualize app icon - - + aria-label="visualize app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + `; exports[`EuiIcon renders type watchesApp 1`] = ` - - watches app icon - - + aria-label="watches app icon" + class="euiIcon euiIcon--medium" + height="32" + viewBox="0 0 32 32" + width="32" + xmlns="http://www.w3.org/2000/svg" +> + + + + + `; exports[`EuiIcon renders type wrench 1`] = ` - - wrench icon - - + `; exports[`EuiIcon title defaults to a humanized version of the type 1`] = ` - - dashboard app icon - - + aria-label="dashboard app icon" + class="euiIcon euiIcon--medium" + height="30" + viewBox="0 0 30 30" + width="30" + xmlns="http://www.w3.org/2000/svg" +> + + + + + + `; exports[`EuiIcon title is rendered 1`] = ` - - a custom title - + + + `; diff --git a/src/components/icon/icon.js b/src/components/icon/icon.js index 4c3bbfb69e10..f878943f5068 100644 --- a/src/components/icon/icon.js +++ b/src/components/icon/icon.js @@ -2,91 +2,91 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import './assets/alert.svg'; -import './assets/app_add_data.svg'; -import './assets/app_advanced_settings.svg'; -import './assets/app_apm.svg'; -import './assets/app_console.svg'; -import './assets/app_dashboard.svg'; -import './assets/app_devtools.svg'; -import './assets/app_discover.svg'; -import './assets/app_graph.svg'; -import './assets/app_grok.svg'; -import './assets/app_index_pattern.svg'; -import './assets/app_logging.svg'; -import './assets/app_management.svg'; -import './assets/app_ml.svg'; -import './assets/app_monitoring.svg'; -import './assets/app_pipeline.svg'; -import './assets/app_reporting.svg'; -import './assets/app_saved_objects.svg'; -import './assets/app_search_profiler.svg'; -import './assets/app_security.svg'; -import './assets/app_timelion.svg'; -import './assets/app_upgrade_assistant.svg'; -import './assets/app_users_roles.svg'; -import './assets/app_visualize.svg'; -import './assets/app_watches.svg'; -import './assets/apps.svg'; -import './assets/arrow_down.svg'; -import './assets/arrow_left.svg'; -import './assets/arrow_right.svg'; -import './assets/arrow_up.svg'; -import './assets/bolt.svg'; -import './assets/boxes_horizontal.svg'; -import './assets/boxes_vertical.svg'; -import './assets/brush.svg'; -import './assets/bullseye.svg'; -import './assets/check.svg'; -import './assets/clock.svg'; -import './assets/console.svg'; -import './assets/controls_horizontal.svg'; -import './assets/controls_vertical.svg'; -import './assets/copy.svg'; -import './assets/copy_clipboard.svg'; -import './assets/cross.svg'; -import './assets/document.svg'; -import './assets/dot.svg'; -import './assets/empty.svg'; -import './assets/face_happy.svg'; -import './assets/face_sad.svg'; -import './assets/full_screen.svg'; -import './assets/gear.svg'; -import './assets/grid.svg'; -import './assets/help.svg'; -import './assets/invert.svg'; -import './assets/link.svg'; -import './assets/list_add.svg'; -import './assets/list.svg'; -import './assets/lock.svg'; -import './assets/logo_beats.svg'; -import './assets/logo_cloud.svg'; -import './assets/logo_elastic.svg'; -import './assets/logo_elastic_search.svg'; -import './assets/logo_elastic_stack.svg'; -import './assets/logo_gmail.svg'; -import './assets/logo_logstash.svg'; -import './assets/logo_slack.svg'; -import './assets/logo_webhook.svg'; -import './assets/logo_xpack.svg'; -import './assets/logo_kibana.svg'; -import './assets/map_marker.svg'; -import './assets/minus_in_circle.svg'; -import './assets/node.svg'; -import './assets/pencil.svg'; -import './assets/pin.svg'; -import './assets/plus_in_circle.svg'; -import './assets/question_in_circle.svg'; -import './assets/search.svg'; -import './assets/shard.svg'; -import './assets/share.svg'; -import './assets/sort_down.svg'; -import './assets/sort_up.svg'; -import './assets/star_empty.svg'; -import './assets/tear.svg'; -import './assets/trash.svg'; -import './assets/user.svg'; -import './assets/wrench.svg'; +import alert from './assets/alert.svg'; +import addDataApp from './assets/app_add_data.svg'; +import advancedSettingsApp from './assets/app_advanced_settings.svg'; +import apmApp from './assets/app_apm.svg'; +import consoleApp from './assets/app_console.svg'; +import dashboardApp from './assets/app_dashboard.svg'; +import devToolsApp from './assets/app_devtools.svg'; +import discoverApp from './assets/app_discover.svg'; +import graphApp from './assets/app_graph.svg'; +import grokApp from './assets/app_grok.svg'; +import indexPatternApp from './assets/app_index_pattern.svg'; +import loggingApp from './assets/app_logging.svg'; +import managementApp from './assets/app_management.svg'; +import machineLearningApp from './assets/app_ml.svg'; +import monitoringApp from './assets/app_monitoring.svg'; +import pipelineApp from './assets/app_pipeline.svg'; +import reportingApp from './assets/app_reporting.svg'; +import savedObjectsApp from './assets/app_saved_objects.svg'; +import searchProfilerApp from './assets/app_search_profiler.svg'; +import securityApp from './assets/app_security.svg'; +import timelionApp from './assets/app_timelion.svg'; +import upgradeAssistantApp from './assets/app_upgrade_assistant.svg'; +import usersRolesApp from './assets/app_users_roles.svg'; +import visualizeApp from './assets/app_visualize.svg'; +import watchesApp from './assets/app_watches.svg'; +import apps from './assets/apps.svg'; +import arrowDown from './assets/arrow_down.svg'; +import arrowLeft from './assets/arrow_left.svg'; +import arrowRight from './assets/arrow_right.svg'; +import arrowUp from './assets/arrow_up.svg'; +import bolt from './assets/bolt.svg'; +import boxesHorizontal from './assets/boxes_horizontal.svg'; +import boxesVertical from './assets/boxes_vertical.svg'; +import brush from './assets/brush.svg'; +import bullseye from './assets/bullseye.svg'; +import check from './assets/check.svg'; +import clock from './assets/clock.svg'; +import console from './assets/console.svg'; +import controlsHorizontal from './assets/controls_horizontal.svg'; +import controlsVertical from './assets/controls_vertical.svg'; +import copy from './assets/copy.svg'; +import copyClipboard from './assets/copy_clipboard.svg'; +import cross from './assets/cross.svg'; +import document from './assets/document.svg'; +import dot from './assets/dot.svg'; +import empty from './assets/empty.svg'; +import faceHappy from './assets/face_happy.svg'; +import faceSad from './assets/face_sad.svg'; +import fullScreen from './assets/full_screen.svg'; +import gear from './assets/gear.svg'; +import grid from './assets/grid.svg'; +import help from './assets/help.svg'; +import invert from './assets/invert.svg'; +import link from './assets/link.svg'; +import listAdd from './assets/list_add.svg'; +import list from './assets/list.svg'; +import lock from './assets/lock.svg'; +import logoBeats from './assets/logo_beats.svg'; +import logoCloud from './assets/logo_cloud.svg'; +import logoElastic from './assets/logo_elastic.svg'; +import logoElasticSearch from './assets/logo_elastic_search.svg'; +import logoElasticStack from './assets/logo_elastic_stack.svg'; +import logoGmail from './assets/logo_gmail.svg'; +import logoLogstash from './assets/logo_logstash.svg'; +import logoSlack from './assets/logo_slack.svg'; +import logoWebhook from './assets/logo_webhook.svg'; +import logoXpack from './assets/logo_xpack.svg'; +import logoKibana from './assets/logo_kibana.svg'; +import mapMarker from './assets/map_marker.svg'; +import minusInCircle from './assets/minus_in_circle.svg'; +import node from './assets/node.svg'; +import pencil from './assets/pencil.svg'; +import pin from './assets/pin.svg'; +import plusInCircle from './assets/plus_in_circle.svg'; +import questionInCircle from './assets/question_in_circle.svg'; +import search from './assets/search.svg'; +import shard from './assets/shard.svg'; +import share from './assets/share.svg'; +import sortDown from './assets/sort_down.svg'; +import sortUp from './assets/sort_up.svg'; +import starEmpty from './assets/star_empty.svg'; +import tear from './assets/tear.svg'; +import trash from './assets/trash.svg'; +import user from './assets/user.svg'; +import wrench from './assets/wrench.svg'; const humanizeCamelCase = str => ( // Put spaces between words in camel-cased strings. @@ -94,92 +94,91 @@ const humanizeCamelCase = str => ( ); const typeToIconMap = { - alert: 'alert', - addDataApp: 'app_add_data', - advancedSettingsApp: 'app_advanced_settings', - apmApp: 'app_apm', - apps: 'apps', - arrowDown: 'arrow_down', - arrowLeft: 'arrow_left', - arrowRight: 'arrow_right', - arrowUp: 'arrow_up', - bolt: 'bolt', - boxesHorizontal: 'boxes_horizontal', - boxesVertical: 'boxes_vertical', - brush: 'brush', - bullseye: 'bullseye', - check: 'check', - clock: 'clock', - console: 'console', - consoleApp: 'app_console', - controlsHorizontal: 'controls_horizontal', - controlsVertical: 'controls_vertical', - copy: 'copy', - copyClipboard: 'copy_clipboard', - cross: 'cross', - dashboardApp: 'app_dashboard', - devToolsApp: 'app_devtools', - discoverApp: 'app_discover', - document: 'document', - dot: 'dot', - empty: 'empty', - faceHappy: 'face_happy', - faceSad: 'face_sad', - fullScreen: 'full_screen', - gear: 'gear', - graphApp: 'app_graph', - grid: 'grid', - grokApp: 'app_grok', - help: 'help', - indexPatternApp: 'app_index_pattern', - invert: 'invert', - link: 'link', - list: 'list', - listAdd: 'list_add', - lock: 'lock', - loggingApp: 'app_logging', - logoBeats: 'logo_beats', - logoCloud: 'logo_cloud', - logoElastic: 'logo_elastic', - logoElasticSearch: 'logo_elastic_search', - logoElasticStack: 'logo_elastic_stack', - logoGmail: 'logo_gmail', - logoKibana: 'logo_kibana', - logoLogstash: 'logo_logstash', - logoSlack: 'logo_slack', - logoWebhook: 'logo_webhook', - logoXpack: 'logo_xpack', - machineLearningApp: 'app_ml', - managementApp: 'app_management', - mapMarker: 'map_marker', - minusInCircle: 'minus_in_circle', - monitoringApp: 'app_monitoring', - node: 'node', - pencil: 'pencil', - pin: 'pin', - pipelineApp: 'app_pipeline', - plusInCircle: 'plus_in_circle', - questionInCircle: 'question_in_circle', - reportingApp: 'app_reporting', - savedObjectsApp: 'app_saved_objects', - search: 'search', - searchProfilerApp: 'app_search_profiler', - securityApp: 'app_security', - shard: 'shard', - share: 'share', - share: 'share', - sortDown: 'sort_down', - sortUp: 'sort_up', - starEmpty: 'star_empty', - tear: 'tear', - timelionApp: 'app_timelion', - trash: 'trash', - usersRolesApp: 'app_users_roles', - upgradeAssistantApp: 'app_upgrade_assistant', - user: 'user', - visualizeApp: 'app_visualize', - watchesApp: 'app_watches', - wrench: 'wrench', + alert, + addDataApp, + advancedSettingsApp, + apmApp, + apps, + arrowDown, + arrowLeft, + arrowRight, + arrowUp, + bolt, + boxesHorizontal, + boxesVertical, + brush, + bullseye, + check, + clock, + console, + consoleApp, + controlsHorizontal, + controlsVertical, + copy, + copyClipboard, + cross, + dashboardApp, + devToolsApp, + discoverApp, + document, + dot, + empty, + faceHappy, + faceSad, + fullScreen, + gear, + graphApp, + grid, + grokApp, + help, + indexPatternApp, + invert, + link, + list, + listAdd, + lock, + loggingApp, + logoBeats, + logoCloud, + logoElastic, + logoElasticSearch, + logoElasticStack, + logoGmail, + logoKibana, + logoLogstash, + logoSlack, + logoWebhook, + logoXpack, + machineLearningApp, + managementApp, + mapMarker, + minusInCircle, + monitoringApp, + node, + pencil, + pin, + pipelineApp, + plusInCircle, + questionInCircle, + reportingApp, + savedObjectsApp, + search, + searchProfilerApp, + securityApp, + shard, + share, + sortDown, + sortUp, + starEmpty, + tear, + timelionApp, + trash, + usersRolesApp, + upgradeAssistantApp, + user, + visualizeApp, + watchesApp, + wrench }; export const TYPES = Object.keys(typeToIconMap); @@ -222,17 +221,9 @@ export const EuiIcon = ({ ? title : `${humanizeCamelCase(type)} icon`; - const svgReference = ; + const Svg = typeToIconMap[type] || empty; - return ( - - {titleText} - {svgReference} - - ); + return ; }; EuiIcon.propTypes = { diff --git a/src/components/loading/__snapshots__/loading_kibana.test.js.snap b/src/components/loading/__snapshots__/loading_kibana.test.js.snap index bb848f137ed0..d75a699792cf 100644 --- a/src/components/loading/__snapshots__/loading_kibana.test.js.snap +++ b/src/components/loading/__snapshots__/loading_kibana.test.js.snap @@ -10,13 +10,28 @@ exports[`EuiLoadingKibana is rendered 1`] = ` class="euiLoadingKibana__icon" > - - logo kibana icon - - + + + diff --git a/src/components/pagination/__snapshots__/pagination.test.js.snap b/src/components/pagination/__snapshots__/pagination.test.js.snap index d68f32b4936e..76e25e999b28 100644 --- a/src/components/pagination/__snapshots__/pagination.test.js.snap +++ b/src/components/pagination/__snapshots__/pagination.test.js.snap @@ -15,13 +15,24 @@ exports[`EuiPagination is rendered 1`] = ` > @@ -38,13 +49,24 @@ exports[`EuiPagination is rendered 1`] = ` > diff --git a/src/components/side_nav/__snapshots__/side_nav.test.js.snap b/src/components/side_nav/__snapshots__/side_nav.test.js.snap index 7e47df7da0b0..b8935d8da325 100644 --- a/src/components/side_nav/__snapshots__/side_nav.test.js.snap +++ b/src/components/side_nav/__snapshots__/side_nav.test.js.snap @@ -18,13 +18,22 @@ exports[`EuiSideNav is rendered 1`] = ` /> @@ -51,13 +60,22 @@ exports[`EuiSideNav isOpenOnMobile defaults to false 1`] = ` /> @@ -84,13 +102,22 @@ exports[`EuiSideNav isOpenOnMobile is rendered when specified as true 1`] = ` /> diff --git a/yarn.lock b/yarn.lock index aa529121e2fd..184629b668c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -616,6 +616,17 @@ babel-plugin-check-es2015-constants@^6.22.0: dependencies: babel-runtime "^6.22.0" +babel-plugin-inline-react-svg@^0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/babel-plugin-inline-react-svg/-/babel-plugin-inline-react-svg-0.5.2.tgz#f4c9ea5384e8d08a7a4f96a19f22a5eab0ddf3a9" + dependencies: + babel-template "^6.15.0" + babel-traverse "^6.15.0" + babylon "^6.10.0" + lodash.isplainobject "^4.0.6" + resolve-from "^2.0.0" + svgo "^0.7.0" + babel-plugin-istanbul@^4.0.0: version "4.1.5" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.5.tgz#6760cdd977f411d3e175bb064f2bc327d99b2b6e" @@ -1011,7 +1022,7 @@ babel-template@7.0.0-beta.0: babylon "7.0.0-beta.22" lodash "^4.2.0" -babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.26.0: +babel-template@^6.15.0, babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" dependencies: @@ -1035,7 +1046,7 @@ babel-traverse@7.0.0-beta.0: invariant "^2.2.0" lodash "^4.2.0" -babel-traverse@^6.18.0, babel-traverse@^6.24.1, babel-traverse@^6.26.0: +babel-traverse@^6.15.0, babel-traverse@^6.18.0, babel-traverse@^6.24.1, babel-traverse@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" dependencies: @@ -1070,7 +1081,7 @@ babylon@7.0.0-beta.22: version "7.0.0-beta.22" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.22.tgz#74f0ad82ed7c7c3cfeab74cf684f815104161b65" -babylon@^6.18.0: +babylon@^6.10.0, babylon@^6.18.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" @@ -4925,6 +4936,10 @@ lodash.isequal@^4.1.1: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" +lodash.isplainobject@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" + lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" @@ -7059,6 +7074,10 @@ resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" +resolve-from@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" + resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"