Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiToken] Update tokenKeyword and rename old tokenKeyword as tokenTag #5251

Merged
merged 16 commits into from
Oct 14, 2021
Merged
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Updated `tokenKeyword` to match the definition of keyword field type ([#5251](https://github.com/elastic/eui/pull/5251))

**Bug fixes**

- Fixed `SuperDatePicker` from crashing due to invalid time input ([#5263](https://github.com/elastic/eui/pull/5263))
- Fixed content in `EuiFilterButton` again when `numFilters` is undefined ([#5268](https://github.com/elastic/eui/pull/5268))

**Breaking changes**

- Renamed `tokenKeyword` icon to `tokenTag` in `EuiToken` ([#5251](https://github.com/elastic/eui/pull/5251))

## [`39.1.0`](https://github.com/elastic/eui/tree/v39.1.0)

- Added support for `ghost` and `text` `EuiIcon` colors on Elastic logos ([#5245](https://github.com/elastic/eui/pull/5245))
Expand Down
1 change: 1 addition & 0 deletions src-docs/src/views/icon/tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const tokens = [
'tokenRankFeature',
'tokenRankFeatures',
'tokenKeyword',
'tokenTag',
'tokenCompletionSuggester',
'tokenDenseVector',
'tokenText',
Expand Down
29 changes: 23 additions & 6 deletions src/components/icon/__snapshots__/icon.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8641,12 +8641,7 @@ exports[`EuiIcon props type tokenKeyword is rendered 1`] = `
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M5.75 7.375a.25.25 0 00-.25.25v.75c0 .138.112.25.25.25h3.5a.25.25 0 00.25-.25v-.75a.25.25 0 00-.25-.25h-3.5z"
/>
<path
clip-rule="evenodd"
d="M3 5a1 1 0 011-1h5.989a1 1 0 01.825.436l2.05 3a1 1 0 010 1.128l-2.05 3A1 1 0 019.99 12H4a1 1 0 01-1-1V5zm1.25.75a.5.5 0 01.5-.5h4.745a.5.5 0 01.405.206l1.636 2.25a.5.5 0 010 .588L9.9 10.544a.5.5 0 01-.405.206H4.75a.5.5 0 01-.5-.5v-4.5z"
fill-rule="evenodd"
d="M10.33 10.28c-.12.04-.29.07-.42.07-.23 0-.43-.08-.53-.3l-.63-1.34 2.32-2.81H9.3L7.76 7.93h-.09L8.22 4H6.59l-1.05 7.5h1.63l.27-1.94h.1l.43 1.12c.27.71.74.92 1.33.92.23 0 .6-.04.86-.11l.17-1.21z"
/>
</svg>
`;
Expand Down Expand Up @@ -9038,6 +9033,28 @@ exports[`EuiIcon props type tokenSymbol is rendered 1`] = `
</svg>
`;

exports[`EuiIcon props type tokenTag is rendered 1`] = `
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiIcon-isLoaded"
focusable="false"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M5.75 7.375a.25.25 0 00-.25.25v.75c0 .138.112.25.25.25h3.5a.25.25 0 00.25-.25v-.75a.25.25 0 00-.25-.25h-3.5z"
/>
<path
clip-rule="evenodd"
d="M3 5a1 1 0 011-1h5.989a1 1 0 01.825.436l2.05 3a1 1 0 010 1.128l-2.05 3A1 1 0 019.99 12H4a1 1 0 01-1-1V5zm1.25.75a.5.5 0 01.5-.5h4.745a.5.5 0 01.405.206l1.636 2.25a.5.5 0 010 .588L9.9 10.544a.5.5 0 01-.405.206H4.75a.5.5 0 01-.5-.5v-4.5z"
fill-rule="evenodd"
/>
</svg>
`;

exports[`EuiIcon props type tokenText is rendered 1`] = `
<svg
aria-hidden="true"
Expand Down
9 changes: 2 additions & 7 deletions src/components/icon/assets/tokenKeyword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,15 @@ const EuiIconTokenKeyword = ({
...props
}: React.SVGProps<SVGSVGElement> & SVGRProps) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width={16}
height={16}
viewBox="0 0 16 16"
xmlns="http://www.w3.org/2000/svg"
aria-labelledby={titleId}
{...props}
>
{title ? <title id={titleId}>{title}</title> : null}
<path d="M5.75 7.375a.25.25 0 00-.25.25v.75c0 .138.112.25.25.25h3.5a.25.25 0 00.25-.25v-.75a.25.25 0 00-.25-.25h-3.5z" />
<path
fillRule="evenodd"
clipRule="evenodd"
d="M3 5a1 1 0 011-1h5.989a1 1 0 01.825.436l2.05 3a1 1 0 010 1.128l-2.05 3A1 1 0 019.99 12H4a1 1 0 01-1-1V5zm1.25.75a.5.5 0 01.5-.5h4.745a.5.5 0 01.405.206l1.636 2.25a.5.5 0 010 .588L9.9 10.544a.5.5 0 01-.405.206H4.75a.5.5 0 01-.5-.5v-4.5z"
/>
<path d="M10.33 10.28c-.12.04-.29.07-.42.07-.23 0-.43-.08-.53-.3l-.63-1.34 2.32-2.81H9.3L7.76 7.93h-.09L8.22 4H6.59l-1.05 7.5h1.63l.27-1.94h.1l.43 1.12c.27.71.74.92 1.33.92.23 0 .6-.04.86-.11l.17-1.21z" />
</svg>
);

Expand Down
40 changes: 40 additions & 0 deletions src/components/icon/assets/tokenTag.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

// THIS IS A GENERATED FILE. DO NOT MODIFY MANUALLY. @see scripts/compile-icons.js

import * as React from 'react';
interface SVGRProps {
title?: string;
titleId?: string;
}

const EuiIconTokenTag = ({
title,
titleId,
...props
}: React.SVGProps<SVGSVGElement> & SVGRProps) => (
<svg
width={16}
height={16}
viewBox="0 0 16 16"
xmlns="http://www.w3.org/2000/svg"
aria-labelledby={titleId}
{...props}
>
{title ? <title id={titleId}>{title}</title> : null}
<path d="M5.75 7.375a.25.25 0 00-.25.25v.75c0 .138.112.25.25.25h3.5a.25.25 0 00.25-.25v-.75a.25.25 0 00-.25-.25h-3.5z" />
<path
fillRule="evenodd"
clipRule="evenodd"
d="M3 5a1 1 0 011-1h5.989a1 1 0 01.825.436l2.05 3a1 1 0 010 1.128l-2.05 3A1 1 0 019.99 12H4a1 1 0 01-1-1V5zm1.25.75a.5.5 0 01.5-.5h4.745a.5.5 0 01.405.206l1.636 2.25a.5.5 0 010 .588L9.9 10.544a.5.5 0 01-.405.206H4.75a.5.5 0 01-.5-.5v-4.5z"
/>
</svg>
);

export const icon = EuiIconTokenTag;
1 change: 1 addition & 0 deletions src/components/icon/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ const typeToPathMap = {
tokenRankFeature: 'tokenRankFeature',
tokenRankFeatures: 'tokenRankFeatures',
tokenKeyword: 'tokenKeyword',
tokenTag: 'tokenTag',
tokenCompletionSuggester: 'tokenCompletionSuggester',
tokenDenseVector: 'tokenDenseVector',
tokenText: 'tokenText',
Expand Down
9 changes: 3 additions & 6 deletions src/components/icon/svgs/tokens/tokenKeyword.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/components/icon/svgs/tokens/tokenTag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion src/components/token/__snapshots__/token.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ exports[`EuiToken props iconType as EuiTokenMapType tokenKey is rendered 1`] = `

exports[`EuiToken props iconType as EuiTokenMapType tokenKeyword is rendered 1`] = `
<span
class="euiToken euiToken--euiColorVis9 euiToken--square euiToken--light euiToken--small"
class="euiToken euiToken--euiColorVis1 euiToken--square euiToken--light euiToken--small"
>
<span
data-euiicon-type="tokenKeyword"
Expand Down Expand Up @@ -633,6 +633,16 @@ exports[`EuiToken props iconType as EuiTokenMapType tokenSymbol is rendered 1`]
</span>
`;

exports[`EuiToken props iconType as EuiTokenMapType tokenTag is rendered 1`] = `
<span
class="euiToken euiToken--euiColorVis9 euiToken--square euiToken--light euiToken--small"
>
<span
data-euiicon-type="tokenTag"
/>
</span>
`;

exports[`EuiToken props iconType as EuiTokenMapType tokenText is rendered 1`] = `
<span
class="euiToken euiToken--euiColorVis3 euiToken--square euiToken--light euiToken--small"
Expand Down
7 changes: 6 additions & 1 deletion src/components/token/token_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export type EuiTokenMapType =
| 'tokenRankFeature'
| 'tokenRankFeatures'
| 'tokenKeyword'
| 'tokenTag'
| 'tokenCompletionSuggester'
| 'tokenDenseVector'
| 'tokenText'
Expand Down Expand Up @@ -244,10 +245,14 @@ export const TOKEN_MAP: {
shape: 'square',
color: 'euiColorVis3',
},
tokenKeyword: {
tokenTag: {
shape: 'square',
color: 'euiColorVis9',
},
tokenKeyword: {
shape: 'square',
color: 'euiColorVis1',
},
tokenCompletionSuggester: {
shape: 'square',
color: 'euiColorVis1',
Expand Down