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

[EuiIcon] Add tokenSemanticText glyph #7971

Merged
merged 9 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions packages/eui/changelogs/upcoming/7971.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Added semantic text token [#7971](https://github.com/elastic/eui/pull/7971)
cee-chen marked this conversation as resolved.
Show resolved Hide resolved

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%_ if (features) { -%>
- Added/Updated ...
- Added semantic text token [#7971](https://github.com/elastic/eui/pull/7971)
cee-chen marked this conversation as resolved.
Show resolved Hide resolved

<%_ } -%>
<%_ if (bugFixes) { -%>
Expand Down
1 change: 1 addition & 0 deletions packages/eui/src-docs/src/views/icon/tokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const tokens: EuiTokenMapType[] = [
'tokenRankFeatures',
'tokenRepo',
'tokenSearchType',
'tokenSemanticText',
'tokenShape',
'tokenString',
'tokenStruct',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10893,6 +10893,24 @@ exports[`EuiIcon props type tokenSearchType is rendered 1`] = `
</svg>
`;

exports[`EuiIcon props type tokenSemanticText is rendered 1`] = `
<svg
aria-hidden="true"
class="euiIcon emotion-euiIcon-m-isLoaded"
data-icon-type="tokenSemanticText"
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-11ZM13.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-1h2ZM9.098 4.5l-.244 1.393h.896l-.212 1.211h-.896l-.435 2.574c-.024.176-.013.308.034.398.046.09.163.138.35.145.072.004.22-.005.445-.026L8.91 11.46a2.75 2.75 0 0 1-.916.129c-.528-.007-.923-.162-1.186-.466-.262-.304-.37-.716-.32-1.237l.455-2.78H6.25l.207-1.212h.694L7.394 4.5h1.704Z"
/>
</svg>
`;

exports[`EuiIcon props type tokenShape is rendered 1`] = `
<svg
aria-hidden="true"
Expand Down
34 changes: 34 additions & 0 deletions packages/eui/src/components/icon/assets/tokenSemanticText.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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 EuiIconTokenSemanticText = ({
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-11ZM13.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-1h2ZM9.098 4.5l-.244 1.393h.896l-.212 1.211h-.896l-.435 2.574c-.024.176-.013.308.034.398.046.09.163.138.35.145.072.004.22-.005.445-.026L8.91 11.46a2.75 2.75 0 0 1-.916.129c-.528-.007-.923-.162-1.186-.466-.262-.304-.37-.716-.32-1.237l.455-2.78H6.25l.207-1.212h.694L7.394 4.5h1.704Z" />
</svg>
);
export const icon = EuiIconTokenSemanticText;
1 change: 1 addition & 0 deletions packages/eui/src/components/icon/icon_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ export const typeToPathMap = {
tokenRankFeatures: 'tokenRankFeatures',
tokenRepo: 'tokenRepo',
tokenSearchType: 'tokenSearchType',
tokenSemanticText: 'tokenSemanticText',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming you are willing to update the SVG file name to snake case, this value will need to be updated to match.

tokenShape: 'tokenShape',
tokenString: 'tokenString',
tokenStruct: 'tokenStruct',
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to rename this file from tokenSemanticText.svg to token_semantic_text.svg? I know icons and tokens currently use a mix of camel and snake case, but I think it would be good to use snake case going forward to be consistent with the rest of the EUI file names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm onboard with this, but since all the tokens are named with camelCase currently, it's probably best to do a PR just for this change. Feels odd if this would be the only one that is snake_case for the time being.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, we can do it in bulk separately. Thanks!

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,16 @@ exports[`EuiToken props iconType as EuiTokenMapType tokenSearchType is rendered
</span>
`;

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

exports[`EuiToken props iconType as EuiTokenMapType tokenShape is rendered 1`] = `
<span
class="euiToken emotion-euiToken-circle-light-s-euiColorVis8"
Expand Down
5 changes: 5 additions & 0 deletions packages/eui/src/components/token/token_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export type EuiTokenMapType =
| 'tokenRankFeatures'
| 'tokenRepo'
| 'tokenSearchType'
| 'tokenSemanticText'
| 'tokenShape'
| 'tokenString'
| 'tokenStruct'
Expand Down Expand Up @@ -255,6 +256,10 @@ export const TOKEN_MAP: {
shape: 'square',
color: 'euiColorVis5',
},
tokenSemanticText: {
shape: 'square',
color: 'euiColorVis0',
},
tokenShape: {
shape: 'circle',
color: 'euiColorVis8',
Expand Down
Loading