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

Add Sparse Vector Token, Update Dense Vector Token #7282

Merged
merged 5 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src-docs/src/views/icon/tokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const tokens: EuiTokenMapType[] = [
'tokenCompletionSuggester',
'tokenConstant',
'tokenDate',
'tokenDenseVector',
'tokenElement',
'tokenEnum',
'tokenEnumMember',
Expand Down Expand Up @@ -66,6 +65,8 @@ const tokens: EuiTokenMapType[] = [
'tokenText',
'tokenTokenCount',
'tokenVariable',
'tokenVectorDense',
'tokenVectorSparse',
];

export default () => (
Expand Down
56 changes: 55 additions & 1 deletion src/components/icon/__snapshots__/icon.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9675,7 +9675,13 @@ exports[`EuiIcon props type tokenDenseVector is rendered 1`] = `
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M4.154 12V4h2.713v1.14H5.658v5.72h1.21V12H4.153Zm7.692-8v8H9.133v-1.14h1.209V5.14h-1.21V4h2.714Z"
d="M2 2.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1H3v10h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-11Z"
/>
<path
d="M6 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm0 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-1 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm4-7a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM8 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm1 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm2-5a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm1 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-1 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
/>
<path
d="M13.5 2a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1H13V3h-1.5a.5.5 0 0 1 0-1h2Z"
/>
</svg>
`;
Expand Down Expand Up @@ -10501,6 +10507,54 @@ exports[`EuiIcon props type tokenVariable is rendered 1`] = `
</svg>
`;

exports[`EuiIcon props type tokenVectorDense is rendered 1`] = `
<svg
aria-hidden="true"
class="euiIcon emotion-euiIcon-m-isLoaded"
data-icon-type="tokenVectorDense"
data-is-loaded="true"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M2 2.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1H3v10h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-11Z"
/>
<path
d="M6 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm0 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-1 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm4-7a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM8 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm1 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm2-5a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm1 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-1 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
/>
<path
d="M13.5 2a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1H13V3h-1.5a.5.5 0 0 1 0-1h2Z"
/>
</svg>
`;

exports[`EuiIcon props type tokenVectorSparse is rendered 1`] = `
<svg
aria-hidden="true"
class="euiIcon emotion-euiIcon-m-isLoaded"
data-icon-type="tokenVectorSparse"
data-is-loaded="true"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M2 2.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1H3v10h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-11ZM8 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
/>
<path
d="M6 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm5 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
/>
<path
d="M13.5 2a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1H13V3h-1.5a.5.5 0 0 1 0-1h2Z"
/>
</svg>
`;

exports[`EuiIcon props type training is rendered 1`] = `
<svg
aria-hidden="true"
Expand Down
36 changes: 36 additions & 0 deletions src/components/icon/assets/tokenVectorDense.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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';
import type { SVGProps } from 'react';
interface SVGRProps {
title?: string;
titleId?: string;
}
const EuiIconTokenVectorDense = ({
title,
titleId,
...props
}: SVGProps<SVGSVGElement> & SVGRProps) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width={16}
height={16}
viewBox="0 0 16 16"
aria-labelledby={titleId}
{...props}
>
{title ? <title id={titleId}>{title}</title> : null}
<path d="M2 2.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1H3v10h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-11Z" />
<path d="M6 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm0 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-1 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm4-7a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM8 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm1 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm2-5a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm1 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-1 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" />
<path d="M13.5 2a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1H13V3h-1.5a.5.5 0 0 1 0-1h2Z" />
</svg>
);
export const icon = EuiIconTokenVectorDense;
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface SVGRProps {
title?: string;
titleId?: string;
}
const EuiIconTokenDenseVector = ({
const EuiIconTokenVectorSparse = ({
title,
titleId,
...props
Expand All @@ -28,7 +28,9 @@ const EuiIconTokenDenseVector = ({
{...props}
>
{title ? <title id={titleId}>{title}</title> : null}
<path d="M4.154 12V4h2.713v1.14H5.658v5.72h1.21V12H4.153Zm7.692-8v8H9.133v-1.14h1.209V5.14h-1.21V4h2.714Z" />
<path d="M2 2.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1H3v10h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-11ZM8 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" />
<path d="M6 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm5 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" />
<path d="M13.5 2a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1H13V3h-1.5a.5.5 0 0 1 0-1h2Z" />
</svg>
);
export const icon = EuiIconTokenDenseVector;
export const icon = EuiIconTokenVectorSparse;
4 changes: 3 additions & 1 deletion src/components/icon/icon_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ export const typeToPathMap = {
tokenCompletionSuggester: 'tokenCompletionSuggester',
tokenConstant: 'tokenConstant',
tokenDate: 'tokenDate',
tokenDenseVector: 'tokenDenseVector',
tokenElement: 'tokenElement',
tokenEnum: 'tokenEnum',
tokenEnumMember: 'tokenEnumMember',
Expand Down Expand Up @@ -488,4 +487,7 @@ export const typeToPathMap = {
tokenText: 'tokenText',
tokenTokenCount: 'tokenTokenCount',
tokenVariable: 'tokenVariable',
tokenVectorDense: 'tokenVectorDense',
tokenDenseVector: 'tokenVectorDense', // NOTE: This is an undocumented alias for `tokenVectorDense`, added for legacy compatability
MichaelMarcialis marked this conversation as resolved.
Show resolved Hide resolved
tokenVectorSparse: 'tokenVectorSparse',
};
3 changes: 0 additions & 3 deletions src/components/icon/svgs/tokens/tokenDenseVector.svg

This file was deleted.

5 changes: 5 additions & 0 deletions src/components/icon/svgs/tokens/tokenVectorDense.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/components/icon/svgs/tokens/tokenVectorSparse.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion src/components/token/__snapshots__/token.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ exports[`EuiToken props iconType as EuiTokenMapType tokenDate is rendered 1`] =

exports[`EuiToken props iconType as EuiTokenMapType tokenDenseVector is rendered 1`] = `
<span
class="euiToken emotion-euiToken-square-light-s-euiColorVis2"
class="euiToken emotion-euiToken-square-light-s-euiColorVis5"
>
<span
data-euiicon-type="tokenDenseVector"
Expand Down Expand Up @@ -694,6 +694,26 @@ exports[`EuiToken props iconType as EuiTokenMapType tokenVariable is rendered 1`
</span>
`;

exports[`EuiToken props iconType as EuiTokenMapType tokenVectorDense is rendered 1`] = `
<span
class="euiToken emotion-euiToken-square-light-s-euiColorVis5"
>
<span
data-euiicon-type="tokenVectorDense"
/>
</span>
`;

exports[`EuiToken props iconType as EuiTokenMapType tokenVectorSparse is rendered 1`] = `
<span
class="euiToken emotion-euiToken-square-light-s-euiColorVis1"
>
<span
data-euiicon-type="tokenVectorSparse"
/>
</span>
`;

exports[`EuiToken props shape circle is rendered 1`] = `
<span
class="euiToken emotion-euiToken-circle-light-s-gray"
Expand Down
22 changes: 16 additions & 6 deletions src/components/token/token_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export type EuiTokenMapType =
| 'tokenCompletionSuggester'
| 'tokenConstant'
| 'tokenDate'
| 'tokenDenseVector'
| 'tokenElement'
| 'tokenEnum'
| 'tokenEnumMember'
Expand Down Expand Up @@ -61,7 +60,10 @@ export type EuiTokenMapType =
| 'tokenTag'
| 'tokenText'
| 'tokenTokenCount'
| 'tokenVariable';
| 'tokenVariable'
| 'tokenVectorDense'
| 'tokenDenseVector' // NOTE: This is an undocumented alias for `tokenVectorDense`, added for legacy compatability
| 'tokenVectorSparse';

/**
* Most of the style combinations for tokens are semi-arbitrary. However, there was an effort
Expand Down Expand Up @@ -108,10 +110,6 @@ export const TOKEN_MAP: {
shape: 'square',
color: 'euiColorVis6',
},
tokenDenseVector: {
shape: 'square',
color: 'euiColorVis2',
},
tokenElement: {
shape: 'square',
color: 'euiColorVis3',
Expand Down Expand Up @@ -284,4 +282,16 @@ export const TOKEN_MAP: {
shape: 'circle',
color: 'euiColorVis7',
},
tokenVectorDense: {
shape: 'square',
color: 'euiColorVis5',
},
tokenDenseVector: {
shape: 'square',
color: 'euiColorVis5',
},
tokenVectorSparse: {
shape: 'square',
color: 'euiColorVis1',
},
};
1 change: 1 addition & 0 deletions upcoming_changelogs/7282.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Added `tokenVectorSparse` token and updated `tokenDenseVector` token (now named `tokenVectorDense`).
Loading