Skip to content

Commit

Permalink
[EuiIcon] Add legacy/undocumented alert->warning alias (#6640)
Browse files Browse the repository at this point in the history
* Add undocumented `alert`->`warning` alias

* [docs] Allow testing the `alert` alias in the playground
- without displaying it in the docs/grid

* changelog
  • Loading branch information
cee-chen authored Mar 9, 2023
1 parent 319bd99 commit 20eff9c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions src-docs/src/services/playground/iconValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { mapOptions } from './mapOptions';
import { PropTypes } from 'react-view';

const iconOptions = mapOptions(iconTypes.concat(logoTypes));
iconOptions.alert = 'warning'; // Legacy alias for Elastic Charts - primarily here for playground testing

export const iconValidator = (prop = { custom: {} }, value) => {
const newProp = {
Expand Down
21 changes: 21 additions & 0 deletions src/components/icon/__snapshots__/icon.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,27 @@ exports[`EuiIcon props type aggregate is rendered 1`] = `
</svg>
`;

exports[`EuiIcon props type alert is rendered 1`] = `
<svg
aria-hidden="true"
class="euiIcon emotion-euiIcon-m-isLoaded"
data-icon-type="alert"
data-is-loaded="true"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M8.55 9.502l.35-3.507a.905.905 0 10-1.8 0l.35 3.507a.552.552 0 001.1 0zM9 12a1 1 0 11-2 0 1 1 0 012 0z"
/>
<path
d="M8.864 1.496a1 1 0 00-1.728 0l-7 12A1 1 0 001 15h14a1 1 0 00.864-1.504l-7-12zM1 14L8 2l7 12H1z"
/>
</svg>
`;

exports[`EuiIcon props type analyzeEvent is rendered 1`] = `
<svg
aria-hidden="true"
Expand Down
1 change: 1 addition & 0 deletions src/components/icon/icon_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ export const typeToPathMap = {
visVisualBuilder: 'vis_visual_builder',
visualizeApp: 'app_visualize',
warning: 'warning',
alert: 'warning', // NOTE: This is an undocumented alias for `warning`, added for legacy compatability with Elastic Charts
watchesApp: 'app_watches',
wordWrap: 'wordWrap',
wordWrapDisabled: 'wordWrapDisabled',
Expand Down
3 changes: 3 additions & 0 deletions upcoming_changelogs/6640.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Bug fixes**

- Added a legacy `alert` alias for the `warning` `EuiIcon` type

0 comments on commit 20eff9c

Please sign in to comment.