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

Explicitly support EUI Icons in EuiContextMenuItemIcon type definition #7804

Conversation

eokoneyo
Copy link
Contributor

Summary

This PR includes changes to the type definition for EuiContextMenuItemIcon so that support for valid EUI IconType is explicit.

This change would be transparent to the end user, and is more a DX improvement.

@eokoneyo eokoneyo requested a review from a team as a code owner May 31, 2024 09:49
@eokoneyo eokoneyo force-pushed the chore/explicitly-support-eui-icon-in-context-menu branch from 94a013c to bbf6e95 Compare May 31, 2024 09:57
@eokoneyo eokoneyo self-assigned this May 31, 2024
import { EuiToolTip, EuiToolTipProps } from '../tool_tip';

import { euiContextMenuItemStyles } from './context_menu_item.styles';

export type EuiContextMenuItemIcon = ReactElement<any> | string | HTMLElement;
export type EuiContextMenuItemIcon = IconType | ReactElement<any>;
Copy link
Contributor

@cee-chen cee-chen May 31, 2024

Choose a reason for hiding this comment

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

This removes | HTMLElement as a supported type - was that intentional? It's not clear to me whether this change was meant to be additive or subtractive. If only the former, this unfortunately may end up messing with Kibana usages that pass, e.g. icon={someRawSvg} or similar.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @eokoneyo! Just checking in on this PR again - did you have a chance to look at the above? If not, I might go ahead and tweak your PR to add in | HTMLElement in again for safety and merge that if no type errors occur.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @eokoneyo! Just checking in on this PR again - did you have a chance to look at the above? If not, I might go ahead and tweak your PR to add in | HTMLElement in again for safety and merge that if no type errors occur.

Hey @cee-chen thanks for the ping, it wasn't particularly intentional. I'd made the assumption that even SVG usages would ideally be of the react component form. I'll be reverting to include support for HTMLElement.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's definitely the ideal, but since it was previously supported we have to mark it a breaking change if we're no longer typing for it, which I'd prefer to avoid for small changes. There probably is some consumer out there who's passing a raw <svg /> element to this prop who would be upset otherwise 🫠

@kibanamachine
Copy link

Preview staging links for this PR:

@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 11, 2024

💚 Build Succeeded

History

cc @eokoneyo

Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

Thanks a million Eyo!!

@cee-chen cee-chen enabled auto-merge (squash) June 11, 2024 17:55
@cee-chen cee-chen merged commit dacb6d2 into elastic:main Jun 11, 2024
5 checks passed
jbudz added a commit to elastic/kibana that referenced this pull request Jun 28, 2024
`v95.1.0`⏩`v95.2.0`

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

## [`v95.2.0`](https://github.com/elastic/eui/releases/v95.2.0)

- Updated `EuiContextMenuItemIcon`'s type definition to explicitly
define support for `EuiIcon`'s `IconType`
([#7804](elastic/eui#7804))
- Updated `EuiSteps` to support a new `titleSize="xxs"` style, which
outputs the same title font size but smaller unnumbered step indicators
([#7813](elastic/eui#7813))
- Updated `EuiStepsHorizontal` to support a new `size="xs"` style, which
outputs smaller unnumbered step indicators
([#7813](elastic/eui#7813))
- Updated `EuiStepNumber` to support new `titleSize="none"` which omits
rendering step numbers, and will only render icons
([#7813](elastic/eui#7813))
- Updated `setEuiDevProviderWarning` to additionally accept a custom
callback function, which warning messages will be passed to
([#7820](elastic/eui#7820))
- Updated `EuiIcon` to feature updated `logoElasticStack` logo for
referencing Elastic Stack platform
([#7838](elastic/eui#7838))
- Updated `EuiIcon` to feature updated `casesApp` design.
([#7840](elastic/eui#7840))
- Updated `EuiComboBox` to no longer autocomplete searched text when
used within forms ([#7842](elastic/eui#7842))

**CSS-in-JS conversions**

- Converted `EuiFilePicker` to Emotion; Removed
`$euiFilePickerTallHeight`
([#7833](elastic/eui#7833))

---------

Co-authored-by: Jon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants