diff --git a/CHANGELOG.md b/CHANGELOG.md
index de1a0196cf6..b1d3ecd58cd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)
+- Added `EuiToken` component ([#1270](https://github.com/elastic/eui/pull/1270))
- Added `beaker` icon to `EuiIcon` and updated the `EuiBetaBadge` styling ([#1291](https://github.com/elastic/eui/pull/1291/))
- Removed calls to deprecated `findDOMNode` ([#1285](https://github.com/elastic/eui/pull/1285))
@@ -10,6 +11,7 @@
- `popover_positioning` service's methods no longer accept React node values ([#1285](https://github.com/elastic/eui/pull/1285))
**Bug fixes**
+
- Added TypeScript definitions for tab components ([#1288](https://github.com/elastic/eui/pull/1288))
## [`4.8.0`](https://github.com/elastic/eui/tree/v4.8.0)
@@ -36,6 +38,7 @@
- Added [Framer X](http://www.framer.com) component source files under the `src-framer` directory ([#1263](https://github.com/elastic/eui/pull/1263))
- Added `compressed` prop to `EuiComboBox` ([#1258](https://github.com/elastic/eui/pull/1258))
- Added guidelines for Sass usage. ([#1257](https://github.com/elastic/eui/pull/1257))
+- Adding a `branch` icon to `EuiIcon` ([#1249](https://github.com/elastic/eui/pull/1249/))
**Bug fixes**
diff --git a/src-docs/src/views/icon/icon_example.js b/src-docs/src/views/icon/icon_example.js
index 02c6444f401..7b035eace14 100644
--- a/src-docs/src/views/icon/icon_example.js
+++ b/src-docs/src/views/icon/icon_example.js
@@ -9,6 +9,7 @@ import {
import {
EuiCode,
EuiIcon,
+ EuiToken,
} from '../../../../src/components';
const iconHtmlWarning = () => (
@@ -24,6 +25,9 @@ const iconsHtml = renderToHtml(iconHtmlWarning);
import Icons from './icons';
const iconsSource = require('!!raw-loader!./icons');
+import Tokens from './tokens';
+const tokensSource = require('!!raw-loader!./tokens');
+
import Apps from './apps';
const appsSource = require('!!raw-loader!./apps');
@@ -95,6 +99,37 @@ export const IconExample = {
),
demo: ,
+ }, {
+ title: 'Tokens',
+ source: [{
+ type: GuideSectionTypes.JS,
+ code: tokensSource,
+ }, {
+ type: GuideSectionTypes.HTML,
+ code: iconsHtml,
+ }],
+ text: (
+
+
+ Tokens are most commonly used in search to help visually classify results.
+ The tokens included in EUI can be used to identify a number of code-based
+ search results.
+
+
+
+ An EuiToken accepts any valid EuiIcon as its
+ iconType property. However, icons designed specifically for
+ use in the EuiToken are prefixed with "token" in their name.
+
+
+
+ Multiple variants are available including: shape , size ,
+ color , hideBorder , and fill .
+
+
+ ),
+ props: { EuiToken },
+ demo: ,
}, {
title: 'Machine learning icons',
source: [{
diff --git a/src-docs/src/views/icon/icons.js b/src-docs/src/views/icon/icons.js
index f4c20e2ac79..5695fb7aff0 100644
--- a/src-docs/src/views/icon/icons.js
+++ b/src-docs/src/views/icon/icons.js
@@ -153,7 +153,7 @@ const iconTypes = [
'visText',
'visTimelion',
'visVega',
- 'visVisualBuilder',
+ 'visVisualBuilder'
];
export default () => (
diff --git a/src-docs/src/views/icon/tokens.js b/src-docs/src/views/icon/tokens.js
new file mode 100644
index 00000000000..3eb56d5683a
--- /dev/null
+++ b/src-docs/src/views/icon/tokens.js
@@ -0,0 +1,128 @@
+import React, { Fragment } from 'react';
+
+import {
+ EuiFlexGrid,
+ EuiFlexItem,
+ EuiPanel,
+ EuiText,
+ EuiToken,
+ EuiSpacer,
+} from '../../../../src/components';
+
+const tokens = [
+ 'tokenAnnotation',
+ 'tokenArray',
+ 'tokenBoolean',
+ 'tokenClass',
+ 'tokenConstant',
+ 'tokenElement',
+ 'tokenEnum',
+ 'tokenEnumMember',
+ 'tokenEvent',
+ 'tokenException',
+ 'tokenField',
+ 'tokenFunction',
+ 'tokenInterface',
+ 'tokenKey',
+ 'tokenMethod',
+ 'tokenNull',
+ 'tokenNumber',
+ 'tokenObject',
+ 'tokenOperator',
+ 'tokenPackage',
+ 'tokenParameter',
+ 'tokenProperty',
+ 'tokenString',
+ 'tokenStruct',
+ 'tokenVariable',
+ 'tokenFile',
+ 'tokenSymbol',
+ 'tokenRepo'
+];
+
+export default () => (
+
+
+ {
+ tokens.map(token => (
+
+
+
+
+
+
+ {token}
+
+
+
+ ))
+ }
+
+
+
+
+
+
+
+
+
+
+
+ A custom token
+
+
+
+
+
+
+
+
+
+ A custom token
+
+
+
+
+
+
+
+
+
+ A custom token
+
+
+
+
+
+);
diff --git a/src/components/icon/__snapshots__/icon.test.js.snap b/src/components/icon/__snapshots__/icon.test.js.snap
index 02e261a65d0..c0d38192b67 100644
--- a/src/components/icon/__snapshots__/icon.test.js.snap
+++ b/src/components/icon/__snapshots__/icon.test.js.snap
@@ -5067,6 +5067,447 @@ exports[`EuiIcon props type timelionApp is rendered 1`] = `
`;
+exports[`EuiIcon props type tokenAnnotation is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenArray is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenBoolean is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenClass is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenConstant is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenElement is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenEnum is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenEnumMember is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenEvent is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenException is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenField is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenFile is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenFunction is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenInterface is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenKey is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenMethod is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenNull is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenNumber is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenObject is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenOperator is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenPackage is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenParameter is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenProperty is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenRepo is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenString is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenStruct is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenSymbol is rendered 1`] = `
+
+
+
+`;
+
+exports[`EuiIcon props type tokenVariable is rendered 1`] = `
+
+
+
+`;
+
exports[`EuiIcon props type trash is rendered 1`] = `
+
+
diff --git a/src/components/icon/assets/tokens/tokenArray.svg b/src/components/icon/assets/tokens/tokenArray.svg
new file mode 100644
index 00000000000..9ec65f32a39
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenArray.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenBoolean.svg b/src/components/icon/assets/tokens/tokenBoolean.svg
new file mode 100644
index 00000000000..538209f0346
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenBoolean.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenClass.svg b/src/components/icon/assets/tokens/tokenClass.svg
new file mode 100644
index 00000000000..a488b9c362b
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenClass.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenConstant.svg b/src/components/icon/assets/tokens/tokenConstant.svg
new file mode 100644
index 00000000000..382a2722dd1
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenConstant.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenElement.svg b/src/components/icon/assets/tokens/tokenElement.svg
new file mode 100644
index 00000000000..c3ee750e392
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenElement.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenEnum.svg b/src/components/icon/assets/tokens/tokenEnum.svg
new file mode 100644
index 00000000000..a7fc4f33ddf
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenEnum.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenEnumMember.svg b/src/components/icon/assets/tokens/tokenEnumMember.svg
new file mode 100644
index 00000000000..97e8942ab4e
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenEnumMember.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenEvent.svg b/src/components/icon/assets/tokens/tokenEvent.svg
new file mode 100644
index 00000000000..cced9f3e640
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenEvent.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenException.svg b/src/components/icon/assets/tokens/tokenException.svg
new file mode 100644
index 00000000000..9f9c76907a6
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenException.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenField.svg b/src/components/icon/assets/tokens/tokenField.svg
new file mode 100644
index 00000000000..0ed4b5ae1c6
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenField.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenFile.svg b/src/components/icon/assets/tokens/tokenFile.svg
new file mode 100644
index 00000000000..5d47c04a206
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenFile.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenFunction.svg b/src/components/icon/assets/tokens/tokenFunction.svg
new file mode 100644
index 00000000000..0d6fff2ec43
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenFunction.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenInterface.svg b/src/components/icon/assets/tokens/tokenInterface.svg
new file mode 100644
index 00000000000..63c6fd04a3b
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenInterface.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenKey.svg b/src/components/icon/assets/tokens/tokenKey.svg
new file mode 100644
index 00000000000..5350085bf1e
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenKey.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenMethod.svg b/src/components/icon/assets/tokens/tokenMethod.svg
new file mode 100644
index 00000000000..b5b725d0d64
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenMethod.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenNull.svg b/src/components/icon/assets/tokens/tokenNull.svg
new file mode 100644
index 00000000000..eb226b2cdf1
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenNull.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenNumber.svg b/src/components/icon/assets/tokens/tokenNumber.svg
new file mode 100644
index 00000000000..8390c89062f
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenNumber.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenObject.svg b/src/components/icon/assets/tokens/tokenObject.svg
new file mode 100644
index 00000000000..6bb97bdab86
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenObject.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenOperator.svg b/src/components/icon/assets/tokens/tokenOperator.svg
new file mode 100644
index 00000000000..bf735fbd9e0
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenOperator.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenPackage.svg b/src/components/icon/assets/tokens/tokenPackage.svg
new file mode 100644
index 00000000000..ba5fbe90b10
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenPackage.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenParameter.svg b/src/components/icon/assets/tokens/tokenParameter.svg
new file mode 100644
index 00000000000..899cb8f819f
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenParameter.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenProperty.svg b/src/components/icon/assets/tokens/tokenProperty.svg
new file mode 100644
index 00000000000..899cb8f819f
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenProperty.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenRepo.svg b/src/components/icon/assets/tokens/tokenRepo.svg
new file mode 100644
index 00000000000..1c099a26f73
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenRepo.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenString.svg b/src/components/icon/assets/tokens/tokenString.svg
new file mode 100644
index 00000000000..f475016c112
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenString.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenStruct.svg b/src/components/icon/assets/tokens/tokenStruct.svg
new file mode 100644
index 00000000000..3eae7a65f6f
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenStruct.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenSymbol.svg b/src/components/icon/assets/tokens/tokenSymbol.svg
new file mode 100644
index 00000000000..a0f959a5d5a
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenSymbol.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/assets/tokens/tokenVariable.svg b/src/components/icon/assets/tokens/tokenVariable.svg
new file mode 100644
index 00000000000..9e9a0c62b5d
--- /dev/null
+++ b/src/components/icon/assets/tokens/tokenVariable.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/icon/icon.js b/src/components/icon/icon.js
index a2e3295ef2d..13cd01addf1 100644
--- a/src/components/icon/icon.js
+++ b/src/components/icon/icon.js
@@ -239,6 +239,36 @@ import visualizeApp from './assets/app_visualize.svg';
import watchesApp from './assets/app_watches.svg';
import wrench from './assets/wrench.svg';
+// Token Icon Imports
+import tokenClass from './assets/tokens/tokenClass.svg';
+import tokenProperty from './assets/tokens/tokenProperty.svg';
+import tokenEnum from './assets/tokens/tokenEnum.svg';
+import tokenVariable from './assets/tokens/tokenVariable.svg';
+import tokenMethod from './assets/tokens/tokenMethod.svg';
+import tokenAnnotation from './assets/tokens/tokenAnnotation.svg';
+import tokenException from './assets/tokens/tokenException.svg';
+import tokenInterface from './assets/tokens/tokenInterface.svg';
+import tokenParameter from './assets/tokens/tokenParameter.svg';
+import tokenField from './assets/tokens/tokenField.svg';
+import tokenElement from './assets/tokens/tokenElement.svg';
+import tokenFunction from './assets/tokens/tokenFunction.svg';
+import tokenBoolean from './assets/tokens/tokenBoolean.svg';
+import tokenString from './assets/tokens/tokenString.svg';
+import tokenArray from './assets/tokens/tokenArray.svg';
+import tokenNumber from './assets/tokens/tokenNumber.svg';
+import tokenConstant from './assets/tokens/tokenConstant.svg';
+import tokenObject from './assets/tokens/tokenObject.svg';
+import tokenEvent from './assets/tokens/tokenEvent.svg';
+import tokenKey from './assets/tokens/tokenKey.svg';
+import tokenNull from './assets/tokens/tokenNull.svg';
+import tokenStruct from './assets/tokens/tokenStruct.svg';
+import tokenPackage from './assets/tokens/tokenPackage.svg';
+import tokenOperator from './assets/tokens/tokenOperator.svg';
+import tokenEnumMember from './assets/tokens/tokenEnumMember.svg';
+import tokenRepo from './assets/tokens/tokenRepo.svg';
+import tokenSymbol from './assets/tokens/tokenSymbol.svg';
+import tokenFile from './assets/tokens/tokenFile.svg';
+
const typeToIconMap = {
addDataApp,
advancedSettingsApp,
@@ -476,6 +506,34 @@ const typeToIconMap = {
packetbeatApp,
securityAnalyticsApp,
sqlApp,
+ tokenClass,
+ tokenProperty,
+ tokenEnum,
+ tokenVariable,
+ tokenMethod,
+ tokenAnnotation,
+ tokenException,
+ tokenInterface,
+ tokenParameter,
+ tokenField,
+ tokenElement,
+ tokenFunction,
+ tokenBoolean,
+ tokenString,
+ tokenArray,
+ tokenNumber,
+ tokenConstant,
+ tokenObject,
+ tokenEvent,
+ tokenKey,
+ tokenNull,
+ tokenStruct,
+ tokenPackage,
+ tokenOperator,
+ tokenEnumMember,
+ tokenRepo,
+ tokenSymbol,
+ tokenFile
};
export const TYPES = Object.keys(typeToIconMap);
diff --git a/src/components/icon/index.d.ts b/src/components/icon/index.d.ts
index 9079af0f79f..20f0f830324 100644
--- a/src/components/icon/index.d.ts
+++ b/src/components/icon/index.d.ts
@@ -242,6 +242,34 @@ declare module '@elastic/eui' {
| 'packetbeatApp'
| 'securityAnalyticsApp'
| 'sqlApp'
+ | 'tokenClass'
+ | 'tokenProperty'
+ | 'tokenEnum'
+ | 'tokenVariable'
+ | 'tokenMethod'
+ | 'tokenAnnotation'
+ | 'tokenException'
+ | 'tokenInterface'
+ | 'tokenParameter'
+ | 'tokenField'
+ | 'tokenElement'
+ | 'tokenFunction'
+ | 'tokenBoolean'
+ | 'tokenString'
+ | 'tokenArray'
+ | 'tokenNumber'
+ | 'tokenConstant'
+ | 'tokenObject'
+ | 'tokenEvent'
+ | 'tokenKey'
+ | 'tokenNull'
+ | 'tokenStruct'
+ | 'tokenPackage'
+ | 'tokenOperator'
+ | 'tokenEnumMember'
+ | 'tokenTypeRepo'
+ | 'tokenTypeSymbol'
+ | 'tokenTypeFile'
export type IconSize = 'original' | 's' | 'm' | 'l' | 'xl' | 'xxl';
diff --git a/src/components/index.js b/src/components/index.js
index 221a8d87b6c..c09b340e33d 100644
--- a/src/components/index.js
+++ b/src/components/index.js
@@ -295,6 +295,10 @@ export {
EuiTableSortMobileItem,
} from './table';
+export {
+ EuiToken
+} from './token';
+
export {
EuiBasicTable,
EuiInMemoryTable
diff --git a/src/components/index.scss b/src/components/index.scss
index cae8f53eb33..e58c30baf51 100644
--- a/src/components/index.scss
+++ b/src/components/index.scss
@@ -51,6 +51,7 @@
@import 'tabs/index';
@import 'title/index';
@import 'toast/index';
+@import 'token/index';
@import 'toggle/index';
@import 'tool_tip/index';
@import 'text/index';
diff --git a/src/components/token/__snapshots__/token.test.js.snap b/src/components/token/__snapshots__/token.test.js.snap
new file mode 100644
index 00000000000..b055af8f74e
--- /dev/null
+++ b/src/components/token/__snapshots__/token.test.js.snap
@@ -0,0 +1,477 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`EuiToken is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props color tokenTint01 is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props color tokenTint02 is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props color tokenTint03 is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props color tokenTint04 is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props color tokenTint05 is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props color tokenTint06 is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props color tokenTint07 is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props color tokenTint08 is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props color tokenTint09 is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props color tokenTint10 is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props shape circle is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props shape rectangle is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props shape square is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props size l is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props size m is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiToken props size s is rendered 1`] = `
+
+
+
+
+
+
+
+
+`;
diff --git a/src/components/token/_index.scss b/src/components/token/_index.scss
new file mode 100644
index 00000000000..486546cf04e
--- /dev/null
+++ b/src/components/token/_index.scss
@@ -0,0 +1 @@
+@import 'token';
diff --git a/src/components/token/_token.scss b/src/components/token/_token.scss
new file mode 100644
index 00000000000..c8ebacb4fbc
--- /dev/null
+++ b/src/components/token/_token.scss
@@ -0,0 +1,88 @@
+.euiToken {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ svg {
+ width: 100%;
+ height: 100%;
+ margin: auto;
+ }
+}
+
+.euiToken--circle {
+ border-radius: 50%;
+}
+
+.euiToken--square {
+ // These are pretty small elements, the standard size
+ // is just slightly too large.
+ border-radius: $euiBorderRadius - 1px;
+}
+
+.euiToken--small {
+ width: $euiSize;
+ height: $euiSize;
+ &.euiToken--rectangle {
+ padding: 0 $euiSizeXS;
+ }
+}
+
+.euiToken--medium {
+ width: $euiSizeL;
+ height: $euiSizeL;
+ &.euiToken--rectangle {
+ padding: 0 $euiSizeS;
+ }
+}
+
+.euiToken--large {
+ width: $euiSizeXL;
+ height: $euiSizeXL;
+
+ &.euiToken--rectangle {
+ padding: 0 ($euiSize * .5);
+ }
+}
+
+.euiToken--rectangle {
+ box-sizing: content-box;
+}
+
+$tokenTypes: (
+ tokenTint01: $euiColorPrimary,
+ tokenTint02: $euiColorAccent,
+ tokenTint03: $euiColorVis3,
+ tokenTint04: $euiColorVis7,
+ tokenTint05: $euiColorVis1,
+ tokenTint06: $euiColorVis5,
+ tokenTint07: $euiColorVis0,
+ tokenTint08: $euiColorVis9,
+ tokenTint09: #FF00FF,
+ tokenTint10: #26AB00,
+ tokenTint11: #4C1604,
+ tokenTint12: #666666
+);
+
+@each $tintName, $tintValue in $tokenTypes {
+ .euiToken--#{$tintName} {
+ box-shadow: 0 0 0 1px $tintValue;
+
+ $backgroundColor: tintOrShade($tintValue, 70%, 70%);
+ background-color: $backgroundColor;
+
+ &.euiToken--no-border {
+ box-shadow: none;
+ }
+
+ &.euiToken--fill {
+ background-color: $tintValue;
+ svg {
+ fill: $euiColorGhost;
+ }
+ }
+
+ svg {
+ fill: makeHighContrastColor($tintValue, $backgroundColor);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/components/token/index.d.ts b/src/components/token/index.d.ts
new file mode 100644
index 00000000000..dbfdc7ad0c9
--- /dev/null
+++ b/src/components/token/index.d.ts
@@ -0,0 +1,47 @@
+///
+///
+
+import { SFC, HTMLAttributes } from 'react';
+
+declare module '@elastic/eui' {
+
+ /**
+ * token type defs
+ *
+ * @see './token.js'
+ */
+
+ export type TokenSize = 's' | 'm' | 'l';
+
+ export type TokenColor =
+ | 'tokenTint01'
+ | 'tokenTint02'
+ | 'tokenTint03'
+ | 'tokenTint04'
+ | 'tokenTint05'
+ | 'tokenTint06'
+ | 'tokenTint07'
+ | 'tokenTint08'
+ | 'tokenTint09'
+ | 'tokenTint10'
+ | 'tokenTint11'
+ | 'tokenTint12'
+
+ export type TokenShape =
+ | 'circle'
+ | 'square'
+ | 'rectangle'
+
+ export interface EuiTokenProps {
+ iconType: IconType;
+ size?: TokenSize;
+ displayOptions?: {
+ color?: TokenColor;
+ shape?: TokenShape;
+ fill?: boolean;
+ hasBorder?: boolean;
+ };
+ }
+
+ export const EuiToken: SFC>;
+}
diff --git a/src/components/token/index.js b/src/components/token/index.js
new file mode 100644
index 00000000000..ff55a40cc19
--- /dev/null
+++ b/src/components/token/index.js
@@ -0,0 +1,5 @@
+export {
+ EuiToken,
+ SIZES as TOKEN_SIZES,
+ SHAPES as TOKEN_SHAPES,
+} from './token';
diff --git a/src/components/token/token.js b/src/components/token/token.js
new file mode 100644
index 00000000000..b0fa4701b65
--- /dev/null
+++ b/src/components/token/token.js
@@ -0,0 +1,102 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import classNames from 'classnames';
+import { ICON_TYPES, EuiIcon } from '../icon';
+import { TOKEN_MAP } from './token_map';
+
+const sizeToClassMap = {
+ s: 'euiToken--small',
+ m: 'euiToken--medium',
+ l: 'euiToken--large',
+};
+
+export const SIZES = Object.keys(sizeToClassMap);
+
+const shapeToClassMap = {
+ circle: 'euiToken--circle',
+ square: 'euiToken--square',
+ rectangle: 'euiToken--rectangle',
+};
+
+export const SHAPES = Object.keys(shapeToClassMap);
+
+export const EuiToken = ({
+ iconType,
+ displayOptions,
+ size,
+ className,
+ ...rest,
+}) => {
+
+ // Check if display options is empty
+ const displayOptionsIsEmpty = Object.keys(displayOptions).length === 0 && displayOptions.constructor === Object;
+
+ let tokenShape;
+ let tokenColor;
+ let fill;
+ let tokenHidesBorder;
+
+ // Check if this has a mapping, and doesn't have custom displayOptions
+ if ((iconType in TOKEN_MAP) && (displayOptionsIsEmpty)) {
+ tokenShape = TOKEN_MAP[iconType].shape;
+ tokenColor = TOKEN_MAP[iconType].color;
+ fill = (TOKEN_MAP[iconType].fill ? true : false);
+ tokenHidesBorder = (TOKEN_MAP[iconType].hideBorder ? true : false);
+ } else {
+ // Use the displayOptions passed or use some defaults
+ tokenShape = displayOptions.shape ? displayOptions.shape : 'square';
+ tokenColor = displayOptions.color ? displayOptions.color : 'tokenTint01';
+ fill = displayOptions.fill ? true : false;
+ tokenHidesBorder = displayOptions.hideBorder ? true : false;
+ }
+
+ const classes = classNames(
+ 'euiToken',
+ `euiToken--${tokenShape}`,
+ `euiToken--${tokenColor}`,
+ sizeToClassMap[size],
+ {
+ 'euiToken--fill': fill,
+ 'euiToken--no-border': tokenHidesBorder
+ },
+ className
+ );
+
+ return (
+
+
+
+ );
+};
+
+EuiToken.propTypes = {
+ /**
+ * An EUI icon type
+ */
+ iconType: PropTypes.oneOf(ICON_TYPES).isRequired,
+ /**
+ * Size of the token
+ */
+ size: PropTypes.oneOf(SIZES),
+ /**
+ * By default EUI will auto color tokens. You can can however control it
+ * - `color`: can be `tokenTint01` thru `tokenTint10`
+ * - `shape`: square, circle, rectangle as options
+ * - `fill`: makes it a solid color
+ * - `hideBorder`: disables the outer border
+ */
+ displayOptions: PropTypes.shape({
+ color: PropTypes.string,
+ shape: PropTypes.string,
+ fill: PropTypes.boolean,
+ hideBorder: PropTypes.boolean,
+ }),
+};
+
+EuiToken.defaultProps = {
+ size: 's',
+ displayOptions: {},
+};
diff --git a/src/components/token/token.test.js b/src/components/token/token.test.js
new file mode 100644
index 00000000000..7869d1c6a33
--- /dev/null
+++ b/src/components/token/token.test.js
@@ -0,0 +1,94 @@
+import React from 'react';
+import { render } from 'enzyme';
+
+import {
+ EuiToken,
+ SHAPES,
+ SIZES
+} from './token';
+
+const tokenColors = [
+ 'tokenTint01',
+ 'tokenTint02',
+ 'tokenTint03',
+ 'tokenTint04',
+ 'tokenTint05',
+ 'tokenTint06',
+ 'tokenTint07',
+ 'tokenTint08',
+ 'tokenTint09',
+ 'tokenTint10'
+];
+
+describe('EuiToken', () => {
+ test('is rendered', () => {
+ const component = render(
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+
+ describe('props', () => {
+ describe('shape', () => {
+ SHAPES.forEach(shape => {
+ test(`${shape} is rendered`, () => {
+ const component = render (
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+ });
+ });
+
+ describe('color', () => {
+ tokenColors.forEach(color => {
+ test(`${color} is rendered`, () => {
+ const component = render (
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+ });
+ });
+
+ describe('size', () => {
+ SIZES.forEach(tokenSize => {
+ test(`${tokenSize} is rendered`, () => {
+ const component = render (
+
+ );
+
+ expect(component)
+ .toMatchSnapshot();
+ });
+ });
+ });
+ });
+});
\ No newline at end of file
diff --git a/src/components/token/token_map.js b/src/components/token/token_map.js
new file mode 100644
index 00000000000..578f9aeb9d7
--- /dev/null
+++ b/src/components/token/token_map.js
@@ -0,0 +1,124 @@
+// Sets default displayOptions for EuiTokens based on iconType
+// tokenClass: {
+// 'shape': 'square',
+// 'color': 'tokenTint01',
+// 'fill': false,
+// },
+
+export const TOKEN_MAP = {
+ tokenClass: {
+ 'shape': 'circle',
+ 'color': 'tokenTint01',
+ },
+ tokenProperty: {
+ 'shape': 'circle',
+ 'color': 'tokenTint02',
+ },
+ tokenEnum: {
+ 'shape': 'circle',
+ 'color': 'tokenTint03',
+ },
+ tokenVariable: {
+ 'shape': 'circle',
+ 'color': 'tokenTint04',
+ },
+ tokenMethod: {
+ 'shape': 'square',
+ 'color': 'tokenTint02',
+ },
+ tokenAnnotation: {
+ 'shape': 'square',
+ 'color': 'tokenTint06',
+ },
+ tokenException: {
+ 'shape': 'circle',
+ 'color': 'tokenTint07',
+ },
+ tokenInterface: {
+ 'shape': 'circle',
+ 'color': 'tokenTint08',
+ },
+ tokenParameter: {
+ 'shape': 'square',
+ 'color': 'tokenTint09',
+ },
+ tokenField: {
+ 'shape': 'circle',
+ 'color': 'tokenTint10',
+ },
+ tokenElement: {
+ 'shape': 'square',
+ 'color': 'tokenTint03',
+ },
+ tokenFunction: {
+ 'shape': 'circle',
+ 'color': 'tokenTint02',
+ },
+ tokenBoolean: {
+ 'shape': 'square',
+ 'color': 'tokenTint05',
+ },
+ tokenString: {
+ 'shape': 'square',
+ 'color': 'tokenTint07',
+ },
+ tokenArray: {
+ 'shape': 'square',
+ 'color': 'tokenTint04',
+ },
+ tokenNumber: {
+ 'shape': 'circle',
+ 'color': 'tokenTint05',
+ },
+ tokenConstant: {
+ 'shape': 'circle',
+ 'color': 'tokenTint07',
+ },
+ tokenObject: {
+ 'shape': 'square',
+ 'color': 'tokenTint03',
+ },
+ tokenEvent: {
+ 'shape': 'circle',
+ 'color': 'tokenTint09',
+ },
+ tokenKey: {
+ 'shape': 'circle',
+ 'color': 'tokenTint06',
+ },
+ tokenNull: {
+ 'shape': 'square',
+ 'color': 'tokenTint02',
+ },
+ tokenStruct: {
+ 'shape': 'square',
+ 'color': 'tokenTint07',
+ },
+ tokenPackage: {
+ 'shape': 'square',
+ 'color': 'tokenTint10',
+ },
+ tokenOperator: {
+ 'shape': 'circle',
+ 'color': 'tokenTint09',
+ },
+ tokenEnumMember: {
+ 'shape': 'square',
+ 'color': 'tokenTint04',
+ },
+ tokenRepo: {
+ 'shape': 'rectangle',
+ 'color': 'tokenTint05',
+ 'fill': true,
+ },
+ tokenSymbol: {
+ 'shape': 'rectangle',
+ 'color': 'tokenTint07',
+ 'fill': true,
+ },
+ tokenFile: {
+ 'shape': 'rectangle',
+ 'color': 'tokenTint12',
+ 'fill': true,
+ },
+};
\ No newline at end of file